Merge "API: Use message-per-value for apihelp-query+allusers-param-prop"
[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:blank_param
123 !! text
124 {{{1}}}
125 {{{}}}
126 !! endarticle
127
128 !! article
129 Template:table_attribs
130 !! text
131 <noinclude>
132 |</noinclude>style="color:red;"|Foo
133 !! endarticle
134
135 !! article
136 Template:table_attribs_2
137 !! text
138 <noinclude>
139 |</noinclude>style="color:red;"|Foo
140 |Bar||Baz
141 !! endarticle
142
143 !! article
144 Template:table_attribs_3
145 !! text
146 <noinclude>
147 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
148 !! endarticle
149
150 !! article
151 Template:table_attribs_4
152 !! text
153 | style="background-color:#DC241f;" width="10px" |
154 !! endarticle
155
156 !! article
157 Template:table_attribs_5
158 !! text
159 <noinclude>
160 |</noinclude>style="color:red;"||Bar
161 !! endarticle
162
163 !! article
164 Template:table_attribs_6
165 !! text
166 style="background: <nowiki>
167
168
169 red;</nowiki>" |
170 !! endarticle
171
172 !! article
173 Template:table_attribs_7
174 !! text
175 <noinclude>
176 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
177 !! endarticle
178
179 !! article
180 Template:table_header_cells
181 !! text
182 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
183 !! endarticle
184
185 !! article
186 Template:table_cells
187 !! text
188 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
189 !! endarticle
190
191 !! article
192 Template:PartialTable
193 !! text
194 {|
195 |-
196 !! endarticle
197
198 !! article
199 Template:image_attribs
200 !! text
201 <noinclude>
202 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
203 !! endarticle
204
205 ## See T48811 for details
206 !! article
207 Template:mixed_attr_content_template
208 !! text
209 style="color:red;" title="T48811"
210 |-
211 |foo
212 !! endarticle
213
214 !! article
215 Template:definition_list
216 !! text
217 one
218 ::two
219 !! endarticle
220
221 !! article
222 A?b
223 !! text
224 Weirdo titles!
225 !! endarticle
226
227 !!article
228 Template:Bullet
229 !!text
230 * Bar
231 !!endarticle
232
233 !!article
234 Template:OpenTable
235 !!text
236 {|
237 !!endarticle
238
239 !!article
240 Template:EmptyLITest
241 !!text
242 *a
243 *
244 *
245 *b
246 !!endarticle
247
248 !!article
249 Template:EmptyTRTest
250 !!text
251 {|
252 |-
253 |-
254 |foo
255 |-
256 |-
257 |bar
258 |}
259 !!endarticle
260
261 !!article
262 Template:EmptyTRWithHTMLAttrTest
263 !!text
264 <table>
265 <tr align="center"></tr>
266 <tr><td>foo</td></tr>
267 <tr align="center"></tr>
268 <tr><td>bar</td></tr>
269 </table>
270 !!endarticle
271
272 ###
273 ### Basic tests
274 ###
275 !! test
276 Blank input
277 !! wikitext
278 !! html
279 !! end
280
281
282 !! test
283 Simple paragraph
284 !! wikitext
285 This is a simple paragraph.
286 !! html
287 <p>This is a simple paragraph.
288 </p>
289 !! end
290
291 !! test
292 Paragraphs with extra newline spacing
293 !! wikitext
294 foo
295
296 bar
297
298
299 baz
300
301
302
303 booz
304 !! html
305 <p>foo
306 </p><p>bar
307 </p><p><br />
308 baz
309 </p><p><br />
310 </p><p>booz
311 </p>
312 !! end
313
314 !! test
315 Paragraphs with newline spacing with comment lines in between
316 !! wikitext
317 ----
318 a
319 <!--foo-->
320 b
321 ----
322 a
323 <!--foo--><!--More than 1 comment, still stripped-->
324 b
325 ----
326 a
327 <!--foo--> <!----> <!-- bar -->
328 b
329 ----
330 a
331 <!--foo-->
332
333 b
334 ----
335 a
336
337 <!--foo-->
338 b
339 ----
340 a
341 <!--foo-->
342
343
344 b
345 ----
346 a
347
348
349 <!--foo-->
350 b
351 ----
352 !! html
353 <hr />
354 <p>a
355 b
356 </p>
357 <hr />
358 <p>a
359 b
360 </p>
361 <hr />
362 <p>a
363 b
364 </p>
365 <hr />
366 <p>a
367 </p><p>b
368 </p>
369 <hr />
370 <p>a
371 </p><p>b
372 </p>
373 <hr />
374 <p>a
375 </p><p><br />
376 b
377 </p>
378 <hr />
379 <p>a
380 </p><p><br />
381 b
382 </p>
383 <hr />
384
385 !! end
386
387 !! test
388 Paragraphs with newline spacing with non-empty white-space lines in between
389 !! wikitext
390 ----
391 a
392
393 b
394 ----
395 a
396
397
398 b
399 ----
400 !! html
401 <hr />
402 <p>a
403 </p><p>b
404 </p>
405 <hr />
406 <p>a
407 </p><p><br />
408 b
409 </p>
410 <hr />
411
412 !! end
413
414 !! test
415 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
416 !! wikitext
417 ----
418 a
419 <!--foo-->
420 b
421 ----
422 a
423 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
424 b
425 ----
426 a
427
428 <!--foo-->
429 <!--bar-->
430 b
431 ----
432 a
433
434 <!--foo-->
435 <!--bar-->
436
437 b
438 ----
439 !! html
440 <hr />
441 <p>a
442 b
443 </p>
444 <hr />
445 <p>a
446 b
447 </p>
448 <hr />
449 <p>a
450 </p><p>b
451 </p>
452 <hr />
453 <p>a
454 </p><p><br />
455 b
456 </p>
457 <hr />
458
459 !! end
460
461 !! test
462 Extra newlines: More paragraphs with indented comment
463 !! wikitext
464 a
465
466 <!--boo-->
467
468 b
469 !! html
470 <p>a
471 </p><p><br />
472 b
473 </p>
474 !!end
475
476 !! test
477 Extra newlines followed by heading
478 !! wikitext
479 a
480
481
482
483 =b=
484 [[a]]
485
486
487 =b=
488 !! html
489 <p>a
490 </p><p><br />
491 </p>
492 <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>
493 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
494 </p><p><br />
495 </p>
496 <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>
497
498 !! end
499
500 !! test
501 Extra newlines between heading and content are swallowed
502 !! wikitext
503 =b=
504
505
506
507 [[a]]
508 !! html
509 <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>
510 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
511 </p>
512 !! end
513
514 !! test
515 Parsing an URL
516 !! wikitext
517 http://fr.wikipedia.org/wiki/🍺
518 <!-- EasterEgg we love beer, better be able be able to link to it -->
519 !! html
520 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
521 </p>
522 !! end
523
524 # Note that the html+tidy output removes the spaces after the <li>,
525 # which is a bug (http://sourceforge.net/p/tidy/bugs/945/, etc).
526 # This is an issue for all tests with lists. We intentionally do
527 # *not* add html+tidy clauses for these, as we don't want to
528 # document/test the broken behavior. (Parsoid matches the non-tidy
529 # output in these cases.)
530
531 !! test
532 Simple list
533 !! wikitext
534 * Item 1
535 * Item 2
536 !! html
537 <ul><li> Item 1</li>
538 <li> Item 2</li></ul>
539
540 !! end
541
542 !! test
543 Italics and bold
544 !! wikitext
545 * plain
546 * plain''italic''plain
547 * plain''italic''plain''italic''plain
548 * plain'''bold'''plain
549 * plain'''bold'''plain'''bold'''plain
550 * plain''italic''plain'''bold'''plain
551 * plain'''bold'''plain''italic''plain
552 * plain''italic'''bold-italic'''italic''plain
553 * plain'''bold''bold-italic''bold'''plain
554 * plain'''''bold-italic'''italic''plain
555 * plain'''''bold-italic''bold'''plain
556 * plain''italic'''bold-italic'''''plain
557 * plain'''bold''bold-italic'''''plain
558 * plain l'''italic''plain
559 * plain l''''bold''' plain
560 !! html
561 <ul><li> plain</li>
562 <li> plain<i>italic</i>plain</li>
563 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
564 <li> plain<b>bold</b>plain</li>
565 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
566 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
567 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
568 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
569 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
570 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
571 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
572 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
573 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
574 <li> plain l'<i>italic</i>plain</li>
575 <li> plain l'<b>bold</b> plain</li></ul>
576
577 !! end
578
579 # this example taken from the [[simple:Moon]] article (bug 47326)
580 !! test
581 Italics and possessives (1)
582 !! wikitext
583 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
584 !! html
585 <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
586 </p>
587 !! end
588
589 # this example taken from [[en:Flaming Pie]] (bug 49926)
590 !! test
591 Italics and possessives (2)
592 !! wikitext
593 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
594 !! html
595 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
596 </p>
597 !! end
598
599 # this example taken from [[en:Dictionary]] (bug 49926)
600 !! test
601 Italics and possessives (3)
602 !! wikitext
603 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''.
604 !! html
605 <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>.
606 </p>
607 !! end
608
609
610 ###
611 ### 2-quote opening sequence tests
612 ###
613 !! test
614 Italics and bold: 2-quote opening sequence: (2,2)
615 !! wikitext
616 ''foo''
617 !! html
618 <p><i>foo</i>
619 </p>
620 !!end
621
622 !! test
623 Italics and bold: 2-quote opening sequence: (2,3)
624 !! wikitext
625 ''foo'''
626 !! html/*
627 <p><i>foo'</i>
628 </p>
629 !!end
630
631 !! test
632 Italics and bold: 2-quote opening sequence: (2,4)
633 !! options
634 parsoid=wt2html
635 !! wikitext
636 ''foo''''
637 !! html/*
638 <p><i>foo''</i>
639 </p>
640 !!end
641
642 # same html as previous, but wikitext adjusted to match parsoid html2wt
643 !! test
644 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
645 !! wikitext
646 ''foo<nowiki>''</nowiki>''
647 !! html
648 <p><i>foo''</i>
649 </p>
650 !! end
651
652 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
653 !! test
654 Italics and bold: 2-quote opening sequence: (2,5)
655 !! options
656 parsoid=wt2html
657 !! wikitext
658 ''foo'''''
659 !! html/php
660 <p><i>foo</i>
661 </p>
662 !! html/parsoid
663 <p><i>foo</i><b></b>
664 </p>
665 !!end
666
667 # same html as previous, but wikitext adjusted to match parsoid html2wt
668 !! test
669 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
670 !! wikitext
671 ''foo'''''<nowiki/>'''
672 !! html/php
673 <p><i>foo</i>
674 </p>
675 !! html/parsoid
676 <p><i>foo</i><b></b>
677 </p>
678 !! end
679
680
681 ###
682 ### 3-quote opening sequence tests
683 ###
684
685 !! test
686 Italics and bold: 3-quote opening sequence: (3,2)
687 !! wikitext
688 '''foo''
689 !! html/*
690 <p>'<i>foo</i>
691 </p>
692 !!end
693
694 !! test
695 Italics and bold: 3-quote opening sequence: (3,3)
696 !! wikitext
697 '''foo'''
698 !! html
699 <p><b>foo</b>
700 </p>
701 !!end
702
703 !! test
704 Italics and bold: 3-quote opening sequence: (3,4)
705 !! wikitext
706 '''foo''''
707 !! html/*
708 <p><b>foo'</b>
709 </p>
710 !!end
711
712 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
713 !! test
714 Italics and bold: 3-quote opening sequence: (3,5)
715 !! options
716 parsoid=wt2html
717 !! wikitext
718 '''foo'''''
719 !! html/php
720 <p><b>foo</b>
721 </p>
722 !! html/parsoid
723 <p><b>foo</b><i></i>
724 </p>
725 !!end
726
727 # same html as previous, but wikitext adjusted to match parsoid html2wt
728 !! test
729 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
730 !! wikitext
731 '''foo'''''<nowiki/>''
732 !! html/php
733 <p><b>foo</b>
734 </p>
735 !! html/parsoid
736 <p><b>foo</b><i></i>
737 </p>
738 !! end
739
740
741 ###
742 ### 4-quote opening sequence tests
743 ###
744
745 !! test
746 Italics and bold: 4-quote opening sequence: (4,2)
747 !! options
748 parsoid=wt2html
749 !! wikitext
750 ''''foo''
751 !! html/*
752 <p>''<i>foo</i>
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,2) w/ nowiki
759 !! wikitext
760 <nowiki>''</nowiki>''foo''
761 !! html
762 <p>''<i>foo</i>
763 </p>
764 !! end
765
766 !! test
767 Italics and bold: 4-quote opening sequence: (4,3)
768 !! wikitext
769 ''''foo'''
770 !! html/*
771 <p>'<b>foo</b>
772 </p>
773 !!end
774
775 !! test
776 Italics and bold: 4-quote opening sequence: (4,4)
777 !! options
778 parsoid=wt2html
779 !! wikitext
780 ''''foo''''
781 !! html/*
782 <p>'<b>foo'</b>
783 </p>
784 !!end
785
786 # same html as previous, but wikitext adjusted to match parsoid html2wt
787 !! test
788 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
789 !! wikitext
790 '<nowiki/>'''foo''''
791 !! html
792 <p>'<b>foo'</b>
793 </p>
794 !! end
795
796 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
797 !! test
798 Italics and bold: 4-quote opening sequence: (4,5)
799 !! options
800 parsoid=wt2html
801 !! wikitext
802 ''''foo'''''
803 !! html/php
804 <p>'<b>foo</b>
805 </p>
806 !! html/parsoid
807 <p>'<b>foo</b><i></i>
808 </p>
809 !!end
810
811 # same html as previous, but wikitext adjusted to match parsoid html2wt
812 !! test
813 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
814 !! wikitext
815 '<nowiki/>'''foo'''''<nowiki/>''
816 !! html/php
817 <p>'<b>foo</b>
818 </p>
819 !! html/parsoid
820 <p>'<b>foo</b><i></i>
821 </p>
822 !! end
823
824
825 ###
826 ### 5-quote opening sequence tests
827 ###
828
829 !! test
830 Italics and bold: 5-quote opening sequence: (5,2)
831 !! options
832 parsoid=wt2html
833 !! wikitext
834 '''''foo''
835 !! html/*
836 <p><b><i>foo</i></b>
837 </p>
838 !!end
839
840 # same html as previous, but wikitext adjusted to match parsoid html2wt
841 !! test
842 Italics and bold: 5-quote opening sequence: (5,2+3)
843 !! wikitext
844 '''''foo'''''
845 !! html/*
846 <p><i><b>foo</b></i>
847 </p>
848 !! end
849
850 !! test
851 Italics and bold: 5-quote opening sequence: (5,3)
852 !! options
853 parsoid=wt2html
854 !! wikitext
855 '''''foo'''
856 !! html/*
857 <p><i><b>foo</b></i>
858 </p>
859 !!end
860
861 # same html as previous, but wikitext adjusted to match parsoid html2wt
862 !! test
863 Italics and bold: 5-quote opening sequence: (5,3+2)
864 !! wikitext
865 '''''foo'''''
866 !! html
867 <p><i><b>foo</b></i>
868 </p>
869 !! end
870
871 !! test
872 Italics and bold: 5-quote opening sequence: (5,4)
873 !! options
874 parsoid=wt2html
875 !! wikitext
876 '''''foo''''
877 !! html/*
878 <p><i><b>foo'</b></i>
879 </p>
880 !!end
881
882 !! test
883 Italics and bold: 5-quote opening sequence: (5,5)
884 !! wikitext
885 '''''foo'''''
886 !! html
887 <p><i><b>foo</b></i>
888 </p>
889 !!end
890
891 !! test
892 Italics and bold: 5-quote opening sequence: (5,6)
893 !! wikitext
894 '''''foo''''''
895 !! html/*
896 <p><i><b>foo'</b></i>
897 </p>
898 !! end
899
900 ###
901 ### multiple quote sequences in a line
902 ###
903 !! test
904 Italics and bold: multiple quote sequences: (2,4,2)
905 !! options
906 parsoid=wt2html
907 !! wikitext
908 ''foo''''bar''
909 !! html/*
910 <p><i>foo'<b>bar</b></i>
911 </p>
912 !!end
913
914
915 # same html as previous, but wikitext adjusted to match parsoid html2wt
916 !! test
917 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
918 !! wikitext
919 ''foo'<nowiki/>'''bar'''''
920 !! html
921 <p><i>foo'<b>bar</b></i>
922 </p>
923 !! end
924
925
926 !! test
927 Italics and bold: multiple quote sequences: (2,4,3)
928 !! options
929 parsoid=wt2html
930 !! wikitext
931 ''foo''''bar'''
932 !! html/*
933 <p><i>foo'<b>bar</b></i>
934 </p>
935 !!end
936
937
938 # same html as previous, but wikitext adjusted to match parsoid html2wt
939 !! test
940 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
941 !! wikitext
942 ''foo'<nowiki/>'''bar'''''
943 !! html
944 <p><i>foo'<b>bar</b></i>
945 </p>
946 !! end
947
948
949 !! test
950 Italics and bold: multiple quote sequences: (2,4,4)
951 !! options
952 parsoid=wt2html
953 !! wikitext
954 ''foo''''bar''''
955 !! html/*
956 <p><i>foo'<b>bar'</b></i>
957 </p>
958 !!end
959
960
961 # same html as previous, but wikitext adjusted to match parsoid html2wt
962 !! test
963 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
964 !! wikitext
965 ''foo'<nowiki/>'''bar'<nowiki/>'''''
966 !! html
967 <p><i>foo'<b>bar'</b></i>
968 </p>
969 !! end
970
971
972 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
973 !! test
974 Italics and bold: multiple quote sequences: (3,4,2)
975 !! options
976 parsoid=wt2html
977 !! wikitext
978 '''foo''''bar''
979 !! html/php
980 <p><b>foo'</b>bar
981 </p>
982 !! html/parsoid
983 <p><b>foo'</b>bar<i></i>
984 </p>
985 !!end
986
987 # same html as previous, but wikitext adjusted to match parsoid html2wt
988 !! test
989 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
990 !! options
991 parsoid
992 !! wikitext
993 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
994 !! html/php
995 <p><b>foo'</b>bar
996 </p>
997 !! html/parsoid
998 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
999 </p>
1000 !! end
1001
1002
1003 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1004 !! test
1005 Italics and bold: multiple quote sequences: (3,4,3)
1006 !! options
1007 parsoid=wt2html
1008 !! wikitext
1009 '''foo''''bar'''
1010 !! html/php
1011 <p><b>foo'</b>bar
1012 </p>
1013 !! html/parsoid
1014 <p><b>foo'</b>bar<b></b>
1015 </p>
1016 !!end
1017
1018 # same html as previous, but wikitext adjusted to match parsoid html2wt
1019 !! test
1020 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1021 !! wikitext
1022 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
1023 !! html/php
1024 <p><b>foo'</b>bar
1025 </p>
1026 !! html/parsoid
1027 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
1028 </p>
1029 !! end
1030
1031 ###
1032 ### other quote tests
1033 ###
1034 !! test
1035 Italics and bold: other quote tests: (2,3,5)
1036 !! wikitext
1037 ''this is about '''foo's family'''''
1038 !! html
1039 <p><i>this is about <b>foo's family</b></i>
1040 </p>
1041 !!end
1042
1043
1044 !! test
1045 Italics and bold: other quote tests: (2,(3,3),2)
1046 !! wikitext
1047 ''this is about '''foo's''' family''
1048 !! html
1049 <p><i>this is about <b>foo's</b> family</i>
1050 </p>
1051 !!end
1052
1053
1054 !! test
1055 Italics and bold: other quote tests: (3,2,3,2)
1056 !! options
1057 parsoid=wt2html
1058 !! wikitext
1059 '''this is about ''foo'''s family''
1060 !! html/*
1061 <p><b>this is about <i>foo</i></b><i>s family</i>
1062 </p>
1063 !!end
1064
1065
1066 # same html as previous, but wikitext adjusted to match parsoid html2wt
1067 !! test
1068 Italics and bold: other quote tests: (3,2,3+2+2,2)
1069 !! wikitext
1070 '''this is about ''foo'''''<nowiki/>''s family''
1071 !! html
1072 <p><b>this is about <i>foo</i></b><i>s family</i>
1073 </p>
1074 !! end
1075
1076
1077 !! test
1078 Italics and bold: other quote tests: (3,2,3,3)
1079 !! wikitext
1080 '''this is about ''foo'''s family'''
1081 !! html/*
1082 <p>'<i>this is about </i>foo<b>s family</b>
1083 </p>
1084 !!end
1085
1086
1087 !! test
1088 Italics and bold: other quote tests: (3,(2,2),3)
1089 !! wikitext
1090 '''this is about ''foo's'' family'''
1091 !! html
1092 <p><b>this is about <i>foo's</i> family</b>
1093 </p>
1094 !!end
1095
1096
1097 !! test
1098 Italicized possessive
1099 !! wikitext
1100 The ''[[Main Page]]'''s talk page.
1101 !! html/php
1102 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1103 </p>
1104 !! html/parsoid
1105 <p>The <i><a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1106 !! end
1107
1108 !! test
1109 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1110 (Requires tidy for PHP parser output to be fixed up)
1111 !! options
1112 parsoid=wt2html,wt2wt
1113 !! wikitext
1114 {|
1115 !''a!!''b
1116 |''a||''b
1117 |}
1118 !! html/php+tidy
1119 <table>
1120 <tr>
1121 <th><i>a</i></th>
1122 <th><i>b</i></th>
1123 <td><i>a</i></td>
1124 <td><i>b</i></td>
1125 </tr>
1126 </table>
1127 !! html/parsoid
1128 <table>
1129 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1130 <td><i>a</i></td><td><i>b</i></td></tr>
1131 </tbody></table>
1132 !! end
1133
1134 ###
1135 ### Non-html5 tags
1136 ###
1137
1138 !! test
1139 Non-html5 tags should be accepted
1140 !! wikitext
1141 <center>''foo''</center>
1142 <big>''foo''</big>
1143 <font>''foo''</font>
1144 <strike>''foo''</strike>
1145 <tt>''foo''</tt>
1146 !! html
1147 <center><i>foo</i></center>
1148 <p><big><i>foo</i></big>
1149 <font><i>foo</i></font>
1150 <strike><i>foo</i></strike>
1151 <tt><i>foo</i></tt>
1152 </p>
1153 !! end
1154
1155 !! test
1156 <wbr> is valid wikitext (bug 52468)
1157 !! wikitext
1158 <wbr>
1159 !! html
1160 <p><wbr />
1161 </p>
1162 !! end
1163
1164 # <strike> is HTML4, <s> is HTML4/5.
1165 !! test
1166 <s> or <strike> for strikethrough
1167 !! wikitext
1168 <strike>strike</strike>
1169
1170 <s>s</s>
1171 !! html
1172 <p><strike>strike</strike>
1173 </p><p><s>s</s>
1174 </p>
1175 !! end
1176
1177 ## a not permitted
1178 ## i,b,br omitted
1179 !! test
1180 Text-level semantic html elements in wikitext
1181 !! wikitext
1182 <em>text</em>
1183 <strong>text</strong>
1184 <small>text</small>
1185 <s>text</s>
1186 <cite>text</cite>
1187 <q>text</q>
1188 <dfn>text</dfn>
1189 <abbr>text</abbr>
1190 <data>text</data>
1191 <time>text</time>
1192 <code>text</code>
1193 <var>text</var>
1194 <samp>text</samp>
1195 <kbd>text</kbd>
1196 <sub>text</sub>
1197 <u>text</u>
1198 <mark>text</mark>
1199 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1200 <bdi>text</bdi>
1201 <bdo>text</bdo>
1202 <span>text</span>
1203 <wbr />
1204 !! html
1205 <p><em>text</em>
1206 <strong>text</strong>
1207 <small>text</small>
1208 <s>text</s>
1209 <cite>text</cite>
1210 <q>text</q>
1211 <dfn>text</dfn>
1212 <abbr>text</abbr>
1213 <data>text</data>
1214 <time>text</time>
1215 <code>text</code>
1216 <var>text</var>
1217 <samp>text</samp>
1218 <kbd>text</kbd>
1219 <sub>text</sub>
1220 <u>text</u>
1221 <mark>text</mark>
1222 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1223 <bdi>text</bdi>
1224 <bdo>text</bdo>
1225 <span>text</span>
1226 <wbr />
1227 </p>
1228 !! end
1229
1230 # test cases taken from
1231 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1232 !! test
1233 Ruby markup (W3C-style)
1234 !! wikitext
1235 ; Mono-ruby for individual base characters
1236 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1237 ; Group ruby
1238 : <ruby>今日<rt>きょう</rt></ruby>
1239 ; Jukugo ruby
1240 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1241 ; Inline ruby
1242 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1243 ; Double-sided ruby
1244 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1245 <ruby>
1246 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1247 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1248 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1249 </ruby>
1250 !! html
1251 <dl><dt> Mono-ruby for individual base characters</dt>
1252 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1253 <dt> Group ruby</dt>
1254 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1255 <dt> Jukugo ruby</dt>
1256 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1257 <dt> Inline ruby</dt>
1258 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1259 <dt> Double-sided ruby</dt>
1260 <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>
1261 <p><ruby>
1262 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1263 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1264 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1265 </ruby>
1266 </p>
1267 !! end
1268
1269 # The next two test different paths in the sanitizer.
1270 !! test
1271 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
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
1285 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1286 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1287 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1288 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1289 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1290 </p><p>&lt;sub-ID#1&gt;
1291 </p>
1292 !! end
1293
1294 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1295 # If the non-word-character tag made it through the sanitizer, tidy
1296 # would munge it up.
1297 !! test
1298 Non-word characters don't terminate tag names + tidy
1299 !! wikitext
1300 <blockquote|>a</blockquote>
1301
1302 <b→> doesn't terminate </b→>
1303
1304 <bä> doesn't terminate </bä>
1305
1306 <boo> doesn't terminate </boo>
1307
1308 <s.foo> doesn't terminate </s.foo>
1309
1310 <sub-ID#1>
1311 !! html+tidy
1312 <p>&lt;blockquote|&gt;a</p>
1313 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1314 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1315 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1316 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1317 <p>&lt;sub-ID#1&gt;</p>
1318 !! end
1319
1320 ###
1321 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1322 ### This checks that HTML5 tags (with non-word characters in the tag
1323 ### name) make it safely through the parser -- the Sanitizer will
1324 ### munge them later, as it should.
1325 ###
1326 !! test
1327 Non-word characters are valid in extension tags (T19663)
1328 !! wikitext
1329 <tåg>tåg</tåg>
1330 !! html/php
1331 <pre>
1332 'tåg'
1333 array (
1334 )
1335 </pre>
1336
1337 !! end
1338
1339 !! test
1340 Isolated close tags should be treated as literal text (bug 52760)
1341 !! options
1342 parsoid=wt2html
1343 !! wikitext
1344 </b>
1345
1346 <s.foo>s</s>
1347 !! html/php+tidy
1348 <p>&lt;s.foo&gt;s</p>
1349 !! html/parsoid
1350 <p>&lt;s.foo&gt;s</p>
1351 !! end
1352
1353 ###
1354 ### Special characters
1355 ###
1356
1357 !! test
1358 Bare pipe character (bug 52363)
1359 !! wikitext
1360 |
1361 !! html
1362 <p>|
1363 </p>
1364 !! end
1365
1366 !! test
1367 Bare pipe character from a template (bug 52363)
1368 !! wikitext
1369 {{pipe}}
1370 !! html
1371 <p>|
1372 </p>
1373 !! end
1374
1375 ###
1376 ### <nowiki> test cases
1377 ###
1378
1379 !! test
1380 <nowiki> unordered list
1381 !! wikitext
1382 <nowiki>* This is not an unordered list item.</nowiki>
1383 !! html/php
1384 <p>* This is not an unordered list item.
1385 </p>
1386 !! html/parsoid
1387 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1388 !! end
1389
1390 !! test
1391 <nowiki> spacing
1392 !! wikitext
1393 <nowiki>Lorem ipsum dolor
1394
1395 sed abit.
1396 sed nullum.
1397
1398 :and a colon
1399 </nowiki>
1400 !! html/php
1401 <p>Lorem ipsum dolor
1402
1403 sed abit.
1404 sed nullum.
1405
1406 :and a colon
1407
1408 </p>
1409 !! html/parsoid
1410 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1411
1412 sed abit.
1413 sed nullum.
1414
1415 :and a colon
1416 </span></p>
1417 !! end
1418
1419 !! test
1420 nowiki 3
1421 !! wikitext
1422 :There is not nowiki.
1423 :There is <nowiki>nowiki</nowiki>.
1424
1425 #There is not nowiki.
1426 #There is <nowiki>nowiki</nowiki>.
1427
1428 *There is not nowiki.
1429 *There is <nowiki>nowiki</nowiki>.
1430 !! html/php
1431 <dl><dd>There is not nowiki.</dd>
1432 <dd>There is nowiki.</dd></dl>
1433 <ol><li>There is not nowiki.</li>
1434 <li>There is nowiki.</li></ol>
1435 <ul><li>There is not nowiki.</li>
1436 <li>There is nowiki.</li></ul>
1437
1438 !! html/parsoid
1439 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1440 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1441
1442 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1443 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1444
1445 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1446 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1447 !! end
1448
1449 !! test
1450 Entities inside <nowiki>
1451 !! wikitext
1452 <nowiki>&lt;</nowiki>
1453 !! html
1454 <p>&lt;
1455 </p>
1456 !! end
1457
1458 !! test
1459 Entities inside template parameters
1460 !! wikitext
1461 {{echo|&ndash;}}
1462 !! html/php+tidy
1463 <p>–</p>
1464 !! html/parsoid
1465 <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>
1466 !! end
1467
1468 !! test
1469 Properly escape nowiki when combined with other wiki markup
1470 !! options
1471 parsoid=html2wt
1472 !! html/parsoid
1473 <p>* &lt;/nowiki&gt; tag</p>
1474 !! wikitext
1475 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1476 !! end
1477
1478 !! test
1479 T93824: Put escaped HTML tags inside nowiki
1480 !! options
1481 parsoid=html2wt
1482 !! html/parsoid
1483 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1484 !! wikitext
1485 <nowiki><h2>foo</h2></nowiki>
1486 !! end
1487
1488 !! test
1489 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1490 !! options
1491 parsoid=html2wt
1492 !! html/parsoid
1493 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1494 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1495 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1496 !! wikitext
1497 This text: L'[[Foo]]
1498 This text: L<nowiki>''</nowiki>[[Foo]]
1499 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1500 !! end
1501
1502 # This test fails because wikitext whitespace is not normalized before comparing.
1503 !! test
1504 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1505 !! options
1506 parsoid=html2wt
1507 !! html/parsoid
1508 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1509 </p>
1510 !! wikitext
1511 This text : L<nowiki>''</nowiki>[[Foo]]
1512 !! end
1513
1514 # This test and the next one are html2wt only as they test that incorrect wikitext
1515 # passed in template arguments gets escaped or wrapped in nowikis where required.
1516 !! test
1517 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1518 !! options
1519 parsoid=html2wt
1520 !! html/parsoid
1521 <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>
1522 <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>
1523 !! wikitext
1524 {{echo|foo{{!}}bar}}
1525 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1526 !! end
1527
1528 !! test
1529 T53961: Output correct nowikis in template arguments
1530 !! options
1531 parsoid=html2wt
1532 !! html/parsoid
1533 <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>
1534 <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>
1535 <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>
1536 <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>
1537 <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>
1538 !! wikitext
1539 {{echo|a [ b}}
1540 {{echo|a <nowiki>}}</nowiki> b}}
1541 {{echo|<nowiki>a [[ b</nowiki>}}
1542 {{echo|a {{!}} <nowiki>{{ ]]</nowiki>}}
1543 {{echo|a <nowiki>}</nowiki>}}
1544 !! end
1545
1546 !! test
1547 Cases where "!!" needs nowiki protection
1548 !! options
1549 parsoid=html2wt
1550 !! html/parsoid
1551 <table>
1552 <tr><th>this needs protection !! here</th></tr>
1553 </table>
1554
1555 <table>
1556 <tr><th>this does not need
1557 protection !! here</th></tr>
1558 </table>
1559 !! wikitext
1560 {|
1561 !<nowiki>this needs protection !! here</nowiki>
1562 |}
1563
1564 {|
1565 !this does not need
1566 protection !! here
1567 |}
1568 !! end
1569
1570 ###
1571 ### Comments
1572 ###
1573 !! test
1574 Comments and Indent-Pre
1575 !! wikitext
1576 <!-- comment 1 --> asdf
1577
1578 <!-- comment 1 --> asdf
1579 <!-- comment 2 -->
1580
1581 <!-- comment 1 --> asdf
1582 <!-- comment 2 -->xyz
1583
1584 <!-- comment 1 --> asdf
1585 <!-- comment 2 --> xyz
1586 !! html
1587 <pre>asdf
1588 </pre>
1589 <pre>asdf
1590 </pre>
1591 <pre>asdf
1592 </pre>
1593 <p>xyz
1594 </p>
1595 <pre>asdf
1596 xyz
1597 </pre>
1598 !! end
1599
1600 !! test
1601 Comment test 2a
1602 !! wikitext
1603 asdf
1604 <!-- comment 1 -->
1605 jkl
1606 !! html
1607 <p>asdf
1608 jkl
1609 </p>
1610 !! end
1611
1612 !! test
1613 Comment test 2b
1614 !! wikitext
1615 asdf
1616 <!-- comment 1 -->
1617
1618 jkl
1619 !! html
1620 <p>asdf
1621 </p><p>jkl
1622 </p>
1623 !! end
1624
1625 !! test
1626 Comment test 3
1627 !! wikitext
1628 asdf
1629 <!-- comment 1 -->
1630 <!-- comment 2 -->
1631 jkl
1632 !! html
1633 <p>asdf
1634 jkl
1635 </p>
1636 !! end
1637
1638 !! test
1639 Comment test 4
1640 !! wikitext
1641 asdf<!-- comment 1 -->jkl
1642 !! html
1643 <p>asdfjkl
1644 </p>
1645 !! end
1646
1647 !! test
1648 Comment spacing
1649 !! wikitext
1650 a
1651 <!-- foo --> b <!-- bar -->
1652 c
1653 !! html
1654 <p>a
1655 </p>
1656 <pre> b
1657 </pre>
1658 <p>c
1659 </p>
1660 !! end
1661
1662 !! test
1663 Comment whitespace
1664 !! wikitext
1665 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1666 !! html
1667
1668 !! end
1669
1670 !! test
1671 Comment semantics and delimiters
1672 !! wikitext
1673 <!-- --><!----><!-----><!------>
1674 !! html/php
1675
1676 !! html/parsoid
1677 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1678 !! end
1679
1680 !! test
1681 Comment semantics and delimiters, redux
1682 !! wikitext
1683 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1684 -- foo -- funky huh? ... -->
1685 !! html/php
1686
1687 !! html/parsoid
1688 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1689 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1690 !! end
1691
1692 !! test
1693 Comment semantics and delimiters: directors cut
1694 !! wikitext
1695 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1696 everything starting with < followed by !-- until the first -- and > we see,
1697 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1698 -->-->
1699 !! html/php
1700 <p>--&gt;
1701 </p>
1702 !! html/parsoid
1703 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1704 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1705 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1706 --><p>--></p>
1707 !! end
1708
1709 !! test
1710 Comment semantics: nesting
1711 !! wikitext
1712 <!--<!-- no, we're not going to do anything fancy here -->-->
1713 !! html/php
1714 <p>--&gt;
1715 </p>
1716 !! html/parsoid
1717 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1718 !! end
1719
1720 # Parsoid closes the unclosed comment, even if it means a slight
1721 # round-trip diff.
1722 !! test
1723 Comment semantics: unclosed comment at end
1724 !! options
1725 parsoid=wt2html,html2html
1726 !! wikitext
1727 <!--This comment will run out to the end of the document
1728 !! html/php
1729
1730 !! html/parsoid
1731 <!--This comment will run out to the end of the document-->
1732 !! end
1733
1734 !! test
1735 Comment semantics: normalize comments to play nice with XML and browsers
1736 !! wikitext
1737 <!-- Browsers --!> think this is closed -->
1738 <!--> This would normally be text -->
1739 <!---> As would this -->
1740 <!-- XML doesn't like trailing dashes -------->
1741 <!-- Nor doubled hyphens -- anywhere in the data -->
1742 But this is not a comment.
1743 !! html/php
1744 <p>But this is not a comment.
1745 </p>
1746 !! html/parsoid
1747 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1748 <!--&#x3E; This would normally be text -->
1749 <!--&#x2D;&#x3E; As would this -->
1750 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1751 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1752 <p>But this is not a comment.</p>
1753 !! end
1754
1755 !! test
1756 Comment semantics: round-trip even text which contains encoded -->
1757 !! wikitext
1758 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1759 !! html/parsoid
1760 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1761 !! end
1762
1763 !! test
1764 Comment in template title
1765 !! wikitext
1766 {{f<!---->oo}}
1767 !! html
1768 <p>FOO
1769 </p>
1770 !! end
1771
1772 !! test
1773 Comment on its own line post-expand
1774 !! wikitext
1775 a
1776 {{blank}}<!---->
1777 b
1778 !! html
1779 <p>a
1780 </p><p>b
1781 </p>
1782 !! end
1783
1784 !! test
1785 Comment on its own line post-expand with non-significant whitespace
1786 !! wikitext
1787 a
1788 {{blank}} <!---->
1789 b
1790 !! html
1791 <p>a
1792 </p><p>b
1793 </p>
1794 !! end
1795
1796 !! test
1797 Multiple comments should still parse as SOL-transparent
1798 !! options
1799 parsoid=wt2html,wt2wt
1800 !! wikitext
1801 <!--c1-->*a
1802 <!--c2--><!--c3--><!--c4-->*b
1803 !! html/php
1804 <ul><li>a</li>
1805 <li>b</li></ul>
1806
1807 !! html/parsoid
1808 <!--c1--><ul>
1809 <li>a
1810 </li>
1811 <!--c2--><!--c3--><!--c4-->
1812 <li>b
1813 </li>
1814 </ul>
1815 !! end
1816
1817 ###
1818 ### paragraph wrapping tests
1819 ###
1820 !! test
1821 No block tags
1822 !! wikitext
1823 a
1824
1825 b
1826 !! html
1827 <p>a
1828 </p><p>b
1829 </p>
1830 !! end
1831
1832 !! test
1833 Block tag on one line (<div>)
1834 !! wikitext
1835 a <div>foo</div>
1836
1837 b
1838 !! html
1839 a <div>foo</div>
1840 <p>b
1841 </p>
1842 !! html+tidy
1843 <p>a</p>
1844 <div>foo</div>
1845 <p>b</p>
1846 !! end
1847
1848 !! test
1849 Block tag on one line (<blockquote>)
1850 !! wikitext
1851 a <blockquote>foo</blockquote>
1852
1853 b
1854 !! html
1855 a <blockquote>foo</blockquote>
1856 <p>b
1857 </p>
1858 !! html+tidy
1859 <p>a</p>
1860 <blockquote>
1861 <p>foo</p>
1862 </blockquote>
1863 <p>b</p>
1864 !! end
1865
1866 !! test
1867 Block tag on both lines (<div>)
1868 !! wikitext
1869 a <div>foo</div>
1870
1871 b <div>foo</div>
1872 !! html
1873 a <div>foo</div>
1874 b <div>foo</div>
1875
1876 !! html+tidy
1877 <p>a</p>
1878 <div>foo</div>
1879 <p>b</p>
1880 <div>foo</div>
1881 !! end
1882
1883 !! test
1884 Block tag on both lines (<blockquote>)
1885 !! wikitext
1886 a <blockquote>foo</blockquote>
1887
1888 b <blockquote>foo</blockquote>
1889 !! html
1890 a <blockquote>foo</blockquote>
1891 b <blockquote>foo</blockquote>
1892
1893 !! html+tidy
1894 <p>a</p>
1895 <blockquote>
1896 <p>foo</p>
1897 </blockquote>
1898 <p>b</p>
1899 <blockquote>
1900 <p>foo</p>
1901 </blockquote>
1902 !! end
1903
1904 !! test
1905 Multiple lines without block tags
1906 !! wikitext
1907 <div>foo</div> a
1908 b
1909 c
1910 d<!--foo--> e
1911 x <div>foo</div> z
1912 !! html
1913 <div>foo</div> a
1914 <p>b
1915 c
1916 d e
1917 </p>
1918 x <div>foo</div> z
1919
1920 !! html+tidy
1921 <div>foo</div>
1922 <p>a</p>
1923 <p>b c d e</p>
1924 <p>x</p>
1925 <div>foo</div>
1926 <p>z</p>
1927 !! end
1928
1929 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1930 # So, we have a separate section for Parsoid. We don't want
1931 # to mimic this stripping behavior in Parsoid. It affects
1932 # editing experience and also requires us to maintain additional
1933 # info for RT-ing.
1934 !! test
1935 Empty lines between lines with block tags
1936 !! wikitext
1937 <div></div>
1938
1939
1940 <div></div>a
1941
1942 b
1943 <div>a</div>b
1944
1945 <div>b</div>d
1946
1947
1948 <div>e</div>
1949 !! html
1950 <div></div>
1951 <p><br />
1952 </p>
1953 <div></div>a
1954 <p>b
1955 </p>
1956 <div>a</div>b
1957 <div>b</div>d
1958 <p><br />
1959 </p>
1960 <div>e</div>
1961
1962 !! html+tidy
1963 <p><br /></p>
1964 <p>a</p>
1965 <p>b</p>
1966 <div>a</div>
1967 <p>b</p>
1968 <div>b</div>
1969 <p>d</p>
1970 <p><br /></p>
1971 <div>e</div>
1972 !! html/parsoid
1973 <div data-parsoid='{"stx":"html"}'></div>
1974
1975 <p><br /></p>
1976 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1977
1978 <p>b</p>
1979 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1980
1981 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1982
1983 <p><br /></p>
1984 <div data-parsoid='{"stx":"html"}'>e</div>
1985 !! end
1986
1987 ## PHP parser emits output which is broken
1988 !! test
1989 Unclosed HTML p-tags should be handled properly
1990 !! wikitext
1991 <div><p>foo</div>
1992 a
1993
1994 b
1995 !! html/php+tidy
1996 <div>
1997 <p>foo</p>
1998 </div>
1999 <p>a</p>
2000 <p>b</p>
2001 !! html/parsoid
2002 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2003 <p>a</p>
2004 <p>b</p>
2005 !! end
2006
2007 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2008 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2009 ## them for now.
2010 !! test
2011 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2012 !! options
2013 parsoid=wt2html
2014 !! wikitext
2015 a [[Category:A1]] [[Category:A2]]
2016 [[Category:A3]]
2017 [[Category:A4]]
2018 !! html/parsoid
2019 <p>a</p>
2020 <link rel="mw:PageProp/Category" href="./Category:A1"/> <link rel="mw:PageProp/Category" href="./Category:A2"/> <link rel="mw:PageProp/Category" href="./Category:A3"/> <link rel="mw:PageProp/Category" href="./Category:A4"/>
2021 !! end
2022
2023 !! test
2024 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2025 !! options
2026 parsoid=wt2html
2027 !! wikitext
2028 [[Category:A1]]a
2029 !! html/parsoid
2030 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2031 !! end
2032
2033 ###
2034 ### Preformatted text
2035 ###
2036 !! test
2037 Preformatted text
2038 !! wikitext
2039 This is some
2040 Preformatted text
2041 With ''italic''
2042 And '''bold'''
2043 And a [[Main Page|link]]
2044 !! html
2045 <pre>This is some
2046 Preformatted text
2047 With <i>italic</i>
2048 And <b>bold</b>
2049 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2050 </pre>
2051 !! end
2052
2053 !! test
2054 Tabs don't trigger preformatted text
2055 !! wikitext
2056 This is not
2057 preformatted text.
2058 This is preformatted text.
2059 So is this.
2060 !! html
2061 <p> This is not
2062 preformatted text.
2063 </p>
2064 <pre>This is preformatted text.
2065 So is this.
2066 </pre>
2067 !! end
2068
2069 !! test
2070 Ident preformatting with inline content
2071 !! wikitext
2072 a
2073 ''b''
2074 !! html
2075 <pre>a
2076 <i>b</i>
2077 </pre>
2078 !! end
2079
2080 !! test
2081 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2082 !! wikitext
2083 <pre><nowiki>
2084 <b>
2085 <cite>
2086 <em>
2087 </nowiki></pre>
2088 !! html
2089 <pre>
2090 &lt;b&gt;
2091 &lt;cite&gt;
2092 &lt;em&gt;
2093 </pre>
2094
2095 !! end
2096
2097 !! test
2098 Regression with preformatted in <center>
2099 !! wikitext
2100 <center>
2101 Blah
2102 </center>
2103 !! html
2104 <center>
2105 <pre>Blah
2106 </pre>
2107 </center>
2108
2109 !! end
2110
2111 !! test
2112 Bug 52763: Preformatted in <blockquote>
2113 !! wikitext
2114 <blockquote>
2115 Blah
2116 {|
2117 |
2118 indented cell (no pre-wrapping!)
2119 |}
2120 </blockquote>
2121 !! html
2122 <blockquote>
2123 <p> Blah
2124 </p>
2125 <table>
2126 <tr>
2127 <td>
2128 <p> indented cell (no pre-wrapping!)
2129 </p>
2130 </td></tr></table>
2131 </blockquote>
2132
2133 !! end
2134
2135 !! test
2136 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2137 !! wikitext
2138 <blockquote>
2139 Foo
2140
2141 Bar
2142 </blockquote>
2143 !! html
2144 <blockquote>
2145 <p>Foo
2146 </p><p>Bar
2147 </p>
2148 </blockquote>
2149
2150 !! end
2151
2152 !! test
2153 Bug 15491: <ins>/<del> in blockquote
2154 !! wikitext
2155 <blockquote>
2156 Foo <del>bar</del> <ins>baz</ins> quux
2157 </blockquote>
2158 !! html
2159 <blockquote>
2160 <p>Foo <del>bar</del> <ins>baz</ins> quux
2161 </p>
2162 </blockquote>
2163
2164 !! end
2165
2166 # Note that the p-wrapping is newline sensitive, which could be
2167 # considered a bug: tidy will wrap only the 'Foo' in the example
2168 # below in a <p> tag. (see comment 23-25 of bug #6200)
2169 !! test
2170 Bug 15491: <ins>/<del> in blockquote (2)
2171 !! wikitext
2172 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2173 </blockquote>
2174 !! html
2175 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2176 </blockquote>
2177
2178 !! html+tidy
2179 <blockquote>
2180 <p>Foo</p>
2181 <del>bar</del> <ins>baz</ins> quux</blockquote>
2182 !! end
2183
2184 !! test
2185 <pre> with attributes (bug 3202)
2186 !! wikitext
2187 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2188 !! html
2189 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2190
2191 !! end
2192
2193 !! test
2194 <pre> with width attribute (bug 3202)
2195 !! wikitext
2196 <pre width="8">Narrow screen goodies</pre>
2197 !! html
2198 <pre width="8">Narrow screen goodies</pre>
2199
2200 !! end
2201
2202 !! test
2203 <pre> with forbidden attribute (bug 3202)
2204 !! wikitext
2205 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2206 !! html
2207 <pre width="8">Narrow screen goodies</pre>
2208
2209 !! end
2210
2211 !! test
2212 Entities inside <pre>
2213 !! wikitext
2214 <pre>&lt;</pre>
2215 !! html
2216 <pre>&lt;</pre>
2217
2218 !! end
2219
2220 !! test
2221 <pre> with forbidden attribute values (bug 3202)
2222 !! wikitext
2223 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2224 !! html
2225 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2226
2227 !! end
2228
2229 !! test
2230 <nowiki> inside <pre> (bug 13238)
2231 !! wikitext
2232 <pre>
2233 <nowiki>
2234 </pre>
2235 <pre>
2236 <nowiki></nowiki>
2237 </pre>
2238 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2239 !! html
2240 <pre>
2241 &lt;nowiki&gt;
2242 </pre>
2243 <pre>
2244
2245 </pre>
2246 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2247
2248 !! end
2249
2250 !! test
2251 <nowiki> and <pre> preference (first one wins)
2252 !! wikitext
2253 <pre>
2254 <nowiki>
2255 </pre>
2256 </nowiki>
2257 </pre>
2258
2259 <nowiki>
2260 <pre>
2261 <nowiki>
2262 </pre>
2263 </nowiki>
2264 </pre>
2265
2266 !! html/php
2267 <pre>
2268 &lt;nowiki&gt;
2269 </pre>
2270 <p>&lt;/nowiki&gt;
2271 &lt;/pre&gt;
2272 </p><p>
2273 &lt;pre&gt;
2274 &lt;nowiki&gt;
2275 &lt;/pre&gt;
2276
2277 &lt;/pre&gt;
2278 </p>
2279 !! html/parsoid
2280 <pre data-parsoid='{"stx":"html","strippedNL":true}'>&lt;nowiki>
2281 </pre>
2282 <p><span typeof="mw:Placeholder" data-parsoid='{"src":"&lt;/nowiki>"}'>&lt;/nowiki></span>
2283 &lt;/pre></p>
2284
2285 <p><span typeof="mw:Nowiki">
2286 &lt;pre>
2287 &lt;nowiki>
2288 &lt;/pre>
2289 </span>
2290 &lt;/pre></p>
2291 !! end
2292
2293 !! test
2294 </pre> inside nowiki
2295 !! wikitext
2296 <nowiki></pre></nowiki>
2297 !! html
2298 <p>&lt;/pre&gt;
2299 </p>
2300 !! end
2301
2302 # Parsoid doesn't strip empty tags, like Tidy does.
2303 !! test
2304 Empty pre; pre inside other HTML tags (bug 54946)
2305 !! options
2306 parsoid=wt2html,wt2wt
2307 !! wikitext
2308 a
2309
2310 <div><pre>
2311 foo
2312 </pre></div>
2313 <pre></pre>
2314 !! html/php
2315 <p>a
2316 </p>
2317 <div><pre>
2318 foo
2319 </pre></div>
2320 <pre></pre>
2321
2322 !! html/php+tidy
2323 <p>a</p>
2324 <div>
2325 <pre>
2326 foo
2327 </pre></div>
2328 !! html/parsoid
2329 <p>a</p>
2330
2331 <div><pre>foo
2332 </pre></div>
2333 <pre></pre>
2334 !! end
2335
2336 !! test
2337 HTML pre followed by indent-pre
2338 !! wikitext
2339 <pre>foo</pre>
2340 bar
2341 !! html
2342 <pre>foo</pre>
2343 <pre>bar
2344 </pre>
2345 !! end
2346
2347 # Note that tidy removes the empty <p> tags from the start and end.
2348 # Parsoid does not, by design.
2349 !!test
2350 Block tag pre
2351 !! wikitext
2352 <p><pre>foo</pre></p>
2353 !! html/php+tidy
2354 <pre>
2355 foo
2356 </pre>
2357 !! html/parsoid
2358 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2359 !!end
2360
2361 !!test
2362 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2363 !! wikitext
2364 {{echo|}}
2365 !! html
2366
2367 !!end
2368
2369 !!test
2370 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2371 !! wikitext
2372 {{echo|
2373 foo}}
2374 !! html
2375 <p>foo
2376 </p>
2377 !!end
2378
2379 !! test
2380 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2381 !! wikitext
2382 {{echo|a
2383 b}}
2384 !! html
2385 <pre>a
2386 </pre>
2387 <p>b
2388 </p>
2389 !!end
2390
2391 !! test
2392 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2393 !! wikitext
2394 {{echo|a
2395 b
2396 c
2397 d
2398 e
2399 }}
2400 !! html
2401 <pre>a
2402 </pre>
2403 <p>b
2404 c
2405 </p>
2406 <pre>d
2407 </pre>
2408 <p>e
2409 </p>
2410 !!end
2411
2412 !!test
2413 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2414 !! wikitext
2415 {{echo| foo}}
2416
2417 {{echo| foo}}{{echo| bar}}
2418
2419 {{echo| foo}}
2420 {{echo| bar}}
2421
2422 {{echo|<!--cmt--> foo}}
2423
2424 <!--cmt-->{{echo| foo}}
2425
2426 {{echo|{{echo| }}bar}}
2427 !! html
2428 <pre>foo
2429 </pre>
2430 <pre>foo bar
2431 </pre>
2432 <pre>foo
2433 bar
2434 </pre>
2435 <pre>foo
2436 </pre>
2437 <pre>foo
2438 </pre>
2439 <pre>bar
2440 </pre>
2441 !!end
2442
2443 !! test
2444 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2445 !! wikitext
2446 {{echo| }}a
2447
2448 {{echo|
2449 }}a
2450
2451 {{echo|
2452 b}}
2453
2454 {{echo|a
2455 }}b
2456
2457 {{echo|a
2458 }} b
2459 !! html
2460 <pre>a
2461 </pre>
2462 <p><br />
2463 </p>
2464 <pre>a
2465 </pre>
2466 <p><br />
2467 </p>
2468 <pre>b
2469 </pre>
2470 <p>a
2471 </p>
2472 <pre>b
2473 </pre>
2474 <p>a
2475 </p>
2476 <pre>b
2477 </pre>
2478 !!end
2479
2480 !! test
2481 Pres with newline attributes
2482 !! wikitext
2483 <pre class="one
2484 two">hi</pre>
2485 !! html/php
2486 <pre class="one two">hi</pre>
2487
2488 !! html/parsoid
2489 <pre class="one
2490 two" data-parsoid='{"stx":"html"}'>hi</pre>
2491 !! end
2492
2493 !! test
2494 Things that look like <pre> tags aren't treated as such
2495 !! wikitext
2496 Barack Obama <President> of the United States
2497 <President></President>
2498 !! html
2499 <p>Barack Obama &lt;President&gt; of the United States
2500 &lt;President&gt;&lt;/President&gt;
2501 </p>
2502 !! end
2503
2504 ## PHP parser discards the "<pre " string
2505 !! test
2506 Handle broken pre-like tags (bug 64025)
2507 !! options
2508 parsoid=wt2html
2509 !! wikitext
2510 {{echo|<pre <pre>x</pre>}}
2511
2512 <table><pre </table>
2513 !! html/php
2514 <pre>x</pre>
2515 <table><pre></pre></table>
2516
2517 !! html/parsoid
2518 <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>
2519
2520
2521 <p>&lt;pre </p>
2522
2523 <table></table>
2524 !! end
2525
2526 !! test
2527 Parsoid: handle pre with space after attribute
2528 !! options
2529 parsoid=wt2html
2530 !! wikitext
2531 <pre style="width:50%;" >{{echo|foo}}</pre>
2532 !! html/php
2533 <pre style="width:50%;">{{echo|foo}}</pre>
2534
2535 !! html/parsoid
2536 <pre style="width:50%;">{{echo|foo}}</pre>
2537 !! end
2538
2539 # TODO / maybe: fix wt2wt for this
2540 !! test
2541 Parsoid: Don't paragraph-wrap fosterable content
2542 !! options
2543 parsoid=wt2html
2544 !! wikitext
2545 {|
2546 <td></td>
2547 <td></td>
2548
2549
2550
2551 |}
2552 !! html
2553 <table>
2554
2555 <tbody>
2556 <tr>
2557 <td></td>
2558
2559 <td></td></tr>
2560
2561
2562
2563 </tbody></table>
2564 !! end
2565
2566 !! test
2567 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2568 !! options
2569 parsoid=wt2html
2570 !! wikitext
2571 {|
2572 <td>
2573 <td>
2574 </td>
2575
2576
2577
2578 |}
2579 !! html
2580 <table>
2581
2582 <tbody>
2583 <tr>
2584 <td></td>
2585
2586 <td>
2587 </td></tr>
2588
2589
2590
2591 </tbody></table>
2592 !! end
2593
2594
2595 #--------------------------------------------------------------------
2596 # Transclusion parameter whitespace stripping tests
2597 # Behavior is different for positional and named parameters
2598 #--------------------------------------------------------------------
2599 !! test
2600 Templates: Strip leading and trailing whitespace from named-param values
2601 !! wikitext
2602 {{echo|1= a }}
2603
2604 {{echo|1= {{echo|b}} }}
2605
2606 {{echo| 1 =
2607 c }}
2608
2609 {{echo| 1 =
2610 * d
2611 }}
2612 !! html
2613 <p>a
2614 </p><p>b
2615 </p><p>c
2616 </p>
2617 <ul><li> d</li></ul>
2618
2619 !! end
2620
2621 !! test
2622 Templates: Don't strip whitespace from positional-param values
2623 !! wikitext
2624 {{echo|a }}
2625
2626 {{echo|{{echo|b}} }}
2627
2628 {{echo| c
2629 }}
2630
2631 {{echo| {{echo|d}}
2632 }}
2633
2634 {{echo|
2635 e}}
2636
2637 {{echo|
2638 * f}}
2639
2640 {{echo|
2641 }}g
2642 !! html
2643 <p>a
2644 </p><p>b
2645 </p>
2646 <pre>c
2647 </pre>
2648 <p><br />
2649 </p>
2650 <pre>d
2651 </pre>
2652 <p><br />
2653 </p>
2654 <pre>e
2655 </pre>
2656 <p><br />
2657 </p>
2658 <ul><li> f</li></ul>
2659 <p><br />
2660 </p>
2661 <pre>g
2662 </pre>
2663 !! end
2664
2665 !! test
2666 Templates: Handle empty comment-and-ws-only lines correctly
2667 !! wikitext
2668 {{echo|foo
2669 <!--should be ignored-->
2670 <!--should be ignored as well-->
2671 bar}}
2672 !! html
2673 <p>foo
2674 bar
2675 </p>
2676 !! end
2677
2678 !! test
2679 Templates: Handle comments in the target
2680 !! wikitext
2681 {{echo
2682 <!-- should be ignored -->
2683 |foo}}
2684
2685 {{echo<!-- should be ignored -->
2686 |foo}}
2687
2688 {{echo<!-- should be ignored -->|foo}}
2689
2690 {{<!-- should be ignored -->echo|foo}}
2691 !!html/parsoid
2692 <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>
2693
2694 <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>
2695
2696 <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>
2697
2698 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2699 !!end
2700
2701 !! test
2702 Templates: Handle comments in parameter names (bug 67657)
2703 !! wikitext
2704 {{echo|1
2705 <!-- should be ignored -->
2706 =foo}}
2707
2708 {{echo|
2709 <!-- should be ignored -->
2710 1 = foo}}
2711
2712 {{echo|1<!-- should be ignored --> = foo}}
2713
2714 {{echo|<!-- should be ignored -->1 = foo}}
2715 !!html/parsoid
2716 <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>
2717
2718 <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>
2719
2720 <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>
2721
2722 <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>
2723 !!end
2724
2725 !! test
2726 Templates: Other wikitext in parameter names (bug 67657)
2727 !! wikitext
2728 {{echo|''1''=foo}}
2729 !!html/parsoid
2730 <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>
2731 !!html/php
2732 <p>{{{1}}}
2733 </p>
2734 !!end
2735
2736 #--------------------------------------------------------------------
2737 # Transclusion parameter escaping tests
2738 #--------------------------------------------------------------------
2739 !! test
2740 Templates: Parsoid parameter escaping test 1
2741 !! wikitext
2742 {{echo|[foo]|{{echo|[bar]}}}}
2743 !! html/php+tidy
2744 <p>[foo]</p>
2745 !! html/parsoid
2746 <p about="#mwt1" typeof="mw:Transclusion"
2747 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2748 !! end
2749
2750 !! test
2751 Parsoid: Pipes in external links in template parameter
2752 !! wikitext
2753 {{echo|[{{echo|http://example.com}} link]}}
2754 !! html/php+tidy
2755 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2756 !! html/parsoid
2757 <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>
2758 !! end
2759
2760 !! test
2761 Parsoid: pipe in transclusion parameter
2762 !! wikitext
2763 {{echo|http://foo.com/a&#124;b}}
2764 !! html/php+tidy
2765 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2766 !! html/parsoid
2767 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2768 typeof="mw:Transclusion"
2769 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>
2770 !! end
2771
2772 !! test
2773 Parsoid: Pipe in external link target and content in template parameter
2774 !! options
2775 parsoid=html2wt,wt2wt
2776 !! wikitext
2777 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2778 !! html/php+tidy
2779 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2780 !! html/parsoid
2781 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2782 typeof="mw:Transclusion"
2783 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2784 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2785 !! end
2786
2787 !! test
2788 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2789 !! options
2790 parsoid
2791 !! wikitext
2792 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2793 !! html
2794 <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>
2795 !! end
2796
2797 !! test
2798 Templates: Don't escape already nowiki-escaped text in template parameters
2799 !! options
2800 parsoid=html2wt,wt2wt
2801 !! wikitext
2802 {{echo|foo<nowiki>|</nowiki>bar}}
2803 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2804 {{echo|<nowiki></nowiki>}}
2805 !! html/php+tidy
2806 <p>foo|bar &lt;div&gt;</p>
2807 !! html/parsoid
2808 <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>
2809 <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>
2810 <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>
2811 </p>
2812 !! end
2813
2814 ## Bug 52824
2815 !! test
2816 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2817 !! options
2818 parsoid=html2wt,wt2wt
2819 !! wikitext
2820 {{echo|{{echo|1=bar}}}}
2821 !! html/php+tidy
2822 <p>bar</p>
2823 !! html/parsoid
2824 <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>
2825 !! end
2826
2827 ## Bug 56733
2828 !! test
2829 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2830 !! wikitext
2831 {{echo|a : b}}
2832 !! html/php+tidy
2833 <p>a&#160;: b</p>
2834 !! html/parsoid
2835 <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:DisplaySpace mw:Placeholder" data-parsoid='{"isDisplayHack":true}'> </span>: b</p>
2836 !! end
2837
2838 ## Bug T73412
2839 !! test
2840 Templates: Preserve blank parameter names
2841 !! wikitext
2842 {{echo|=foo}}
2843 !! html/php+tidy
2844 <p>{{{1}}}</p>
2845 !! html/parsoid
2846 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2847 !! end
2848
2849 !! test
2850 Templates: Preserve blank parameter names in other positions
2851 !! wikitext
2852 {{blank_param|bar|=foo}}
2853 !! html/php+tidy
2854 <p>bar foo</p>
2855 !! html/parsoid
2856 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]},{"k":"","named":true,"spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"blank_param","href":"./Template:Blank_param"},"params":{"1":{"wt":"bar"},"":{"wt":"foo"}},"i":0}}]}'>bar
2857 foo</p>
2858 !! end
2859
2860 ###
2861 ### Parsoid-centric tests for testing RT edge cases for pre
2862 ###
2863
2864 !!test
2865 1a. Indent-Pre and Comments
2866 !! wikitext
2867 a
2868 <!--a-->
2869 c
2870 !! html
2871 <pre>a
2872 </pre>
2873 <p>c
2874 </p>
2875 !!end
2876
2877 !!test
2878 1b. Indent-Pre and Comments
2879 !! wikitext
2880 a
2881 <!--a-->
2882 c
2883 !! html
2884 <pre>a
2885 </pre>
2886 <p>c
2887 </p>
2888 !!end
2889
2890 !!test
2891 1c. Indent-Pre and Comments
2892 !! wikitext
2893 <!--a--> a
2894
2895 <!--a--> a
2896 !! html
2897 <pre> a
2898 </pre>
2899 <pre> a
2900 </pre>
2901 !!end
2902
2903 !!test
2904 1d. Indent-Pre and Comments
2905 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2906 !! wikitext
2907 <!--a--> a
2908
2909 <!--b-->b
2910 !! html
2911 <pre>a
2912 </pre>
2913 <pre>b
2914 </pre>
2915 !!end
2916
2917 !!test
2918 2a. Indent-Pre and tables
2919 !! wikitext
2920 {|
2921 |-
2922 !h1!!h2
2923 |foo||bar
2924 |}
2925 !! html
2926 <table>
2927
2928 <tr>
2929 <th>h1</th>
2930 <th>h2
2931 </th>
2932 <td>foo</td>
2933 <td>bar
2934 </td></tr></table>
2935
2936 !!end
2937
2938 !!test
2939 2b. Indent-Pre and tables
2940 !! wikitext
2941 {|
2942 |-
2943 |foo
2944 |}
2945 !! html
2946 <table>
2947
2948 <tr>
2949 <td>foo
2950 </td></tr></table>
2951
2952 !!end
2953
2954 !!test
2955 2c. Indent-Pre and tables (bug 42252)
2956 !! wikitext
2957 {|
2958 |+ foo
2959 ! | bar
2960 |}
2961 !! html
2962 <table>
2963 <caption> foo
2964 </caption>
2965 <tr>
2966 <th> bar
2967 </th></tr></table>
2968
2969 !!end
2970
2971 !!test
2972 2d. Indent-Pre and tables
2973 !! wikitext
2974 a
2975 {|
2976 | b
2977 |}
2978 !! html/php
2979 <pre>a
2980 </pre>
2981 <table>
2982 <tr>
2983 <td> b
2984 </td></tr></table>
2985
2986 !! html/parsoid
2987 <pre>a</pre>
2988 <table>
2989 <tbody><tr><td> b</td></tr>
2990 </tbody></table>
2991 !!end
2992
2993 !!test
2994 2e. Indent-Pre and table-line syntax
2995 !! wikitext
2996 a
2997 | b
2998 | c
2999 !! html/php
3000 <pre>a
3001 | b
3002 | c
3003 </pre>
3004 !!end
3005
3006 !!test
3007 2f. Indent-pre started by table-line syntax
3008 !! wikitext
3009 a
3010 | b
3011 | c
3012 !! html/php
3013 <p>a
3014 </p>
3015 <pre>| b
3016 | c
3017 </pre>
3018 !! html/parsoid
3019 <p>a</p>
3020 <pre>
3021 | b
3022 | c</pre>
3023 !!end
3024
3025 !!test
3026 3a. Indent-Pre and block tags (single-line html)
3027 !! wikitext
3028 a <p> foo </p>
3029 b <div> foo </div>
3030 c <blockquote> foo </blockquote>
3031 <span> foo </span>
3032 !! html
3033 a <p> foo </p>
3034 b <div> foo </div>
3035 c <blockquote> foo </blockquote>
3036 <pre><span> foo </span>
3037 </pre>
3038 !! html/parsoid
3039 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3040 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3041 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3042 <pre><span> foo </span>
3043 </pre>
3044 !! html+tidy
3045 <p>a</p>
3046 <p>foo</p>
3047 <p>b</p>
3048 <div>foo</div>
3049 <p>c</p>
3050 <blockquote>
3051 <p>foo</p>
3052 </blockquote>
3053 <pre>
3054 <span> foo </span>
3055 </pre>
3056 !! end
3057
3058 !!test
3059 3b. Indent-Pre and block tags (multi-line html)
3060 !! wikitext
3061 a <span>foo</span>
3062 b <div> foo </div>
3063 !! html
3064 <pre>a <span>foo</span>
3065 </pre>
3066 b <div> foo </div>
3067
3068 !! html/parsoid
3069 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3070 b <div data-parsoid='{"stx":"html"}'> foo </div>
3071 !! html+tidy
3072 <pre>
3073 a <span>foo</span>
3074 </pre>
3075 <p>b</p>
3076 <div>foo</div>
3077 !!end
3078
3079 !!test
3080 3c. Indent-Pre and block tags (pre-content on separate line)
3081 !! wikitext
3082 <p>
3083 foo
3084 </p>
3085
3086 <div>
3087 foo
3088 </div>
3089
3090 <center>
3091 foo
3092 </center>
3093
3094 <blockquote>
3095 foo
3096 </blockquote>
3097
3098 <blockquote>
3099 <pre>
3100 foo
3101 </pre>
3102 </blockquote>
3103
3104 <table><tr><td>
3105 foo
3106 </td></tr></table>
3107
3108 <ul><li>
3109 foo
3110 </li></ul>
3111
3112 !! html
3113 <p>
3114 foo
3115 </p>
3116 <div>
3117 <pre>foo
3118 </pre>
3119 </div>
3120 <center>
3121 <pre>foo
3122 </pre>
3123 </center>
3124 <blockquote>
3125 <p> foo
3126 </p>
3127 </blockquote>
3128 <blockquote>
3129 <pre>
3130 foo
3131 </pre>
3132 </blockquote>
3133 <table><tr><td>
3134 <pre>foo
3135 </pre>
3136 </td></tr></table>
3137 <ul><li>
3138 foo
3139 </li></ul>
3140
3141 !!end
3142
3143 !!test
3144 4. Indent-Pre and extension tags
3145 !! wikitext
3146 a <gallery>
3147 File:foobar.jpg
3148 </gallery>
3149 !! html
3150 a <ul class="gallery mw-gallery-traditional">
3151 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
3152 <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>
3153 <div class="gallerytext">
3154 </div>
3155 </div></li>
3156 </ul>
3157
3158 !! html+tidy
3159 <p>a</p>
3160 <ul class="gallery mw-gallery-traditional">
3161 <li class="gallerybox" style="width: 155px">
3162 <div style="width: 155px">
3163 <div class="thumb" style="width: 150px;">
3164 <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>
3165 </div>
3166 <div class="gallerytext"></div>
3167 </div>
3168 </li>
3169 </ul>
3170 !!end
3171
3172 !! test
3173 Table wikitext syntax outside wiki-tables
3174 !! wikitext
3175 a
3176 ! not a table heading
3177 |- not a table row
3178 | not a table cell
3179 | class="foo bar" | baz
3180 b
3181 |}
3182 |-
3183 c
3184 !! html
3185 <p>a
3186 ! not a table heading
3187 |- not a table row
3188 | not a table cell
3189 | class="foo bar" | baz
3190 b
3191 |}
3192 |-
3193 c
3194 </p>
3195 !! end
3196
3197 !!test
3198 Render paragraphs when indent-pre is suppressed in blocklevels
3199 !! wikitext
3200 <blockquote>
3201 foo
3202
3203 bar
3204 </blockquote>
3205 !! html
3206 <blockquote>
3207 <p> foo
3208 </p><p> bar
3209 </p>
3210 </blockquote>
3211
3212 !!end
3213
3214 !!test
3215 4. Multiple spaces at start-of-line
3216 !! wikitext
3217 <p> foo </p>
3218 foo
3219 {|
3220 |foo
3221 |}
3222 !! html
3223 <p> foo </p>
3224 <pre> foo
3225 </pre>
3226 <table>
3227 <tr>
3228 <td>foo
3229 </td></tr></table>
3230
3231 !!end
3232
3233 ## NOTE: the leading white-space chars on empty line are significant
3234 !! test
3235 5a. White-space in indent-pre
3236 !! wikitext
3237 a<br />
3238
3239 b
3240 !! html
3241 <pre>a<br />
3242
3243 b
3244 </pre>
3245 !! end
3246
3247 ## NOTE: the leading white-space chars on empty line are significant
3248 !! test
3249 5b. White-space in indent-pre
3250 !! wikitext
3251 a
3252
3253 b
3254
3255
3256 c
3257 !! html
3258 <pre>a
3259
3260 b
3261
3262
3263 c
3264 </pre>
3265 !! end
3266
3267 !! test
3268 5c. White-space in indent-pre
3269 !! wikitext
3270 ''a''
3271 ''b''
3272 ''c''
3273 !! html
3274 <pre><i>a</i>
3275 <i>b</i>
3276 <i>c</i>
3277 </pre>
3278 !! end
3279
3280 !! test
3281 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3282 !! wikitext
3283 a
3284
3285 <!-- continue -->
3286 b
3287
3288 c
3289
3290 d
3291 !! html
3292 <pre>a
3293
3294 b
3295 </pre>
3296 <pre>c
3297
3298 </pre>
3299 <p>d
3300 </p>
3301 !! end
3302
3303 !! test
3304 7a. Indent-pre and category links
3305 !! options
3306 parsoid=wt2html,wt2wt
3307 !! wikitext
3308 [[Category:foo]] <!-- No pre-wrapping -->
3309 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3310 !! html/php+tidy
3311 !! html/parsoid
3312 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3313 <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&#x2D;wrapping -->
3314 !! end
3315
3316 !! test
3317 7b. Indent-pre and category links
3318 !! options
3319 parsoid=wt2html,wt2wt
3320 !! wikitext
3321 [[Category:foo]] a
3322 [[Category:foo]] {{echo|b}}
3323 !! html
3324 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3325 <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>
3326 !! end
3327
3328 !! test
3329 Indent-Pre: Newlines in comments shouldn't affect sol state
3330 !! wikitext
3331 a <!--
3332 foo
3333 --> b
3334 !! html/php+tidy
3335 <p>a b</p>
3336 !! html/parsoid
3337 <p>a <!--
3338 foo
3339 --> b</p>
3340 !! end
3341
3342 ###
3343 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3344 ###
3345
3346 !!test
3347 HTML-pre: 1. embedded newlines
3348 !! wikitext
3349 <pre>foo</pre>
3350
3351 <pre>
3352 foo
3353 </pre>
3354
3355 <pre>
3356
3357 foo
3358 </pre>
3359
3360 <pre>
3361
3362
3363 foo
3364 </pre>
3365 !! html/php+tidy
3366 <pre>
3367 foo
3368 </pre>
3369 <pre>
3370 foo
3371 </pre>
3372 <pre>
3373
3374 foo
3375 </pre>
3376 <pre>
3377
3378
3379 foo
3380 </pre>
3381 !! html/parsoid
3382 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3383
3384 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3385 foo
3386 </pre>
3387
3388 <pre data-parsoid='{"stx":"html"}'>
3389
3390 foo
3391 </pre>
3392
3393 <pre data-parsoid='{"stx":"html"}'>
3394
3395
3396 foo
3397 </pre>
3398 !!end
3399
3400 !! test
3401 HTML-pre: big spaces
3402 !! wikitext
3403 <pre>
3404
3405
3406
3407
3408 haha
3409
3410
3411
3412
3413 haha
3414
3415
3416
3417
3418 </pre>
3419 !! html/php+tidy
3420 <pre>
3421
3422
3423
3424
3425 haha
3426
3427
3428
3429
3430 haha
3431
3432
3433
3434
3435 </pre>
3436 !! html/parsoid
3437 <pre data-parsoid='{"stx":"html"}'>
3438
3439
3440
3441
3442 haha
3443
3444
3445
3446
3447 haha
3448
3449
3450
3451
3452 </pre>
3453 !! end
3454
3455 !!test
3456 HTML-pre: 2: indented text
3457 !! wikitext
3458 <pre>
3459 foo
3460 </pre>
3461 !! html
3462 <pre>
3463 foo
3464 </pre>
3465
3466 !!end
3467
3468 !!test
3469 HTML-pre: 3: other wikitext
3470 !! wikitext
3471 <pre>
3472 * foo
3473 # bar
3474 = no-h =
3475 '' no-italic ''
3476 [[ NoLink ]]
3477 </pre>
3478 !! html/php
3479 <pre>
3480 * foo
3481 # bar
3482 = no-h =
3483 '' no-italic ''
3484 [[ NoLink ]]
3485 </pre>
3486
3487 !! html/parsoid
3488 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3489 # bar
3490 = no-h =
3491 '' no-italic ''
3492 [[ NoLink ]]
3493 </pre>
3494 !!end
3495
3496 ###
3497 ### Definition lists
3498 ###
3499 !! test
3500 Simple definition
3501 !! wikitext
3502 ; name : Definition
3503 !! html
3504 <dl><dt> name&#160;</dt>
3505 <dd> Definition</dd></dl>
3506
3507 !! end
3508
3509 !! test
3510 Definition list for indentation only
3511 !! wikitext
3512 : Indented text
3513 !! html
3514 <dl><dd> Indented text</dd></dl>
3515
3516 !! end
3517
3518 !! test
3519 Definition list with no space
3520 !! wikitext
3521 ;name:Definition
3522 !! html
3523 <dl><dt>name</dt>
3524 <dd>Definition</dd></dl>
3525
3526 !!end
3527
3528 !! test
3529 Definition list with URL link
3530 !! wikitext
3531 ; http://example.com/ : definition
3532 !! html
3533 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3534 <dd> definition</dd></dl>
3535
3536 !! end
3537
3538 !! test
3539 Definition list with bracketed URL link
3540 !! wikitext
3541 ;[http://www.example.com/ Example]:Something about it
3542 !! html
3543 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3544 <dd>Something about it</dd></dl>
3545
3546 !! end
3547
3548 !! test
3549 Definition list with wikilink containing colon
3550 !! wikitext
3551 ; [[Help:FAQ]]: The least-read page on Wikipedia
3552 !! html
3553 <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>
3554 <dd> The least-read page on Wikipedia</dd></dl>
3555
3556 !! end
3557
3558 # At Brion's and JeLuF's insistence... :)
3559 !! test
3560 Definition list with news link containing colon
3561 !! wikitext
3562 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3563 !! html/php
3564 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3565 <dd> This isn't even a real newsgroup!</dd></dl>
3566
3567 !! html/parsoid
3568 <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>
3569 !! end
3570
3571 !! test
3572 Malformed definition list with colon
3573 !! wikitext
3574 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3575 !! html
3576 <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>
3577
3578 !! end
3579
3580 !! test
3581 Definition lists: colon in external link text
3582 !! wikitext
3583 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3584 !! html
3585 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3586 <dd> OK, I made that up</dd></dl>
3587
3588 !! end
3589
3590 !! test
3591 Definition lists: colon in HTML attribute
3592 !! wikitext
3593 ;<b style="display: inline">bold</b>
3594 !! html
3595 <dl><dt><b style="display: inline">bold</b></dt></dl>
3596
3597 !! end
3598
3599 !! test
3600 Definition lists: self-closed tag
3601 !! wikitext
3602 ;one<br/>two : two-line fun
3603 !! html
3604 <dl><dt>one<br />two&#160;</dt>
3605 <dd> two-line fun</dd></dl>
3606
3607 !! end
3608
3609 !! test
3610 Bug 11748: Literal closing tags
3611 !! wikitext
3612 <dl>
3613 <dt>test 1</dt>
3614 <dd>test test test test test</dd>
3615 <dt>test 2</dt>
3616 <dd>test test test test test</dd>
3617 </dl>
3618 !! html
3619 <dl>
3620 <dt>test 1</dt>
3621 <dd>test test test test test</dd>
3622 <dt>test 2</dt>
3623 <dd>test test test test test</dd>
3624 </dl>
3625
3626 !! end
3627
3628 !! test
3629 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3630 !! wikitext
3631 <ul><li>
3632 ; term : description
3633 * unordered
3634 </li></ul>
3635 !! html
3636 <ul><li>
3637 <dl><dt> term&#160;</dt>
3638 <dd> description</dd></dl>
3639 <ul><li> unordered</li></ul>
3640 </li></ul>
3641
3642 !! end
3643
3644 !! test
3645
3646 Definition list with empty definition and following paragraph
3647 !! wikitext
3648 ; term:
3649 Paragraph text
3650 !! html
3651 <dl><dt> term</dt>
3652 <dd></dd></dl>
3653 <p>Paragraph text
3654 </p>
3655 !! end
3656
3657 !! test
3658 Nested definition lists using html syntax
3659 !! wikitext
3660 <dl><dt>x</dt>
3661 <dd>a</dd>
3662 <dd>b</dd></dl>
3663
3664 !! end
3665
3666 !! test
3667 Definition Lists: No nesting: Multiple dd's
3668 !! wikitext
3669 ;x
3670 :a
3671 :b
3672 !! html
3673 <dl><dt>x</dt>
3674 <dd>a</dd>
3675 <dd>b</dd></dl>
3676
3677 !! end
3678
3679 !! test
3680 Definition Lists: Indentation: Regular
3681 !! wikitext
3682 :i1
3683 ::i2
3684 :::i3
3685 !! html
3686 <dl><dd>i1
3687 <dl><dd>i2
3688 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3689
3690 !! end
3691
3692 !! test
3693 Definition Lists: Indentation: Missing 1st level
3694 !! wikitext
3695 ::i2
3696 :::i3
3697 !! html
3698 <dl><dd><dl><dd>i2
3699 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3700
3701 !! end
3702
3703 !! test
3704 Definition Lists: Indentation: Multi-level indent
3705 !! wikitext
3706 :::i3
3707 !! html
3708 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3709
3710 !! end
3711
3712 !! test
3713 Definition Lists: Hacky use to indent tables
3714 !! wikitext
3715 ::{|
3716 |foo
3717 |bar
3718 |}
3719 this text
3720 should be left alone
3721 !! html
3722 <dl><dd><dl><dd><table>
3723 <tr>
3724 <td>foo
3725 </td>
3726 <td>bar
3727 </td></tr></table></dd></dl></dd></dl>
3728 <p>this text
3729 should be left alone
3730 </p>
3731 !! end
3732
3733 !! test
3734 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3735 !! wikitext
3736 <!-- foo -->
3737 ::{|
3738 |foo
3739 |bar
3740 |}<!-- bar -->
3741 this text
3742 should be left alone
3743 !! html/parsoid
3744 <!-- foo -->
3745 <dl><dd><dl><dd><table><tr>
3746 <td>foo</td>
3747 <td>bar</td>
3748 </tr></table><!-- bar --></dd></dl></dd></dl>
3749 <p>this text
3750 should be left alone</p>
3751 !! end
3752
3753 !! test
3754 Definition Lists: Hacky use to indent tables, with comment before table
3755 !! wikitext
3756 ::<!-- foo -->{|
3757 |foo
3758 |}
3759 !! html/parsoid
3760 <dl><dd><dl><dd><!-- foo --><table><tr>
3761 <td>foo</td>
3762 </tr></table></dd></dl></dd></dl>
3763 !! end
3764
3765 # The trailing whitespace in this test is to catch a regression in
3766 # Parsoid after T54473.
3767 !! test
3768 Definition Lists: Hacky use to indent tables (WS-insensitive)
3769 !! wikitext
3770 : {|
3771 |a
3772 |}
3773 !! html/php
3774 <dl><dd><table>
3775 <tr>
3776 <td>a
3777 </td></tr></table></dd></dl>
3778
3779 !! html/parsoid
3780 <dl><dd> <table>
3781 <tbody><tr><td>a</td></tr>
3782 </tbody></table> </dd></dl>
3783 !! end
3784
3785 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3786 ## as an empty dt item. It also ignores all but the last ";" when followed
3787 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3788 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3789 ## ";"s.
3790 ##
3791 ## Ex: ";;t2 ::d2" is transformed into:
3792 ##
3793 ## <dl>
3794 ## <dt>t2 </dt>
3795 ## <dd>
3796 ## <dl>
3797 ## <dt></dt>
3798 ## <dd>d2</dd>
3799 ## </dl>
3800 ## </dd>
3801 ## </dl>
3802 ##
3803 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3804 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3805 ##
3806 ## <dl>
3807 ## <dt>
3808 ## <dl>
3809 ## <dt>t2 </dt>
3810 ## <dd>:d2</dd>
3811 ## </dl>
3812 ## </dt>
3813 ## </dl>
3814 ##
3815 ## All Parsoid only definition list tests have this difference.
3816 ##
3817 ## See also: https://phabricator.wikimedia.org/T8569
3818 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3819
3820 !! test
3821 Table / list interaction: indented table with lists in table contents
3822 !! wikitext
3823 :{|
3824 |-
3825 | a
3826 * b
3827 |-
3828 | c
3829 * d
3830 |}
3831 !! html
3832 <dl><dd><table>
3833
3834 <tr>
3835 <td> a
3836 <ul><li> b</li></ul>
3837 </td></tr>
3838 <tr>
3839 <td> c
3840 <ul><li> d</li></ul>
3841 </td></tr></table></dd></dl>
3842
3843 !! end
3844
3845 !!test
3846 Table / list interaction: lists nested in tables nested in indented lists
3847 !! wikitext
3848 :{|
3849 |
3850 :a
3851 :b
3852 |
3853 *c
3854 *d
3855 |}
3856
3857 *e
3858 *f
3859 !! html
3860 <dl><dd><table>
3861 <tr>
3862 <td>
3863 <dl><dd>a</dd>
3864 <dd>b</dd></dl>
3865 </td>
3866 <td>
3867 <ul><li>c</li>
3868 <li>d</li></ul>
3869 </td></tr></table></dd></dl>
3870 <ul><li>e</li>
3871 <li>f</li></ul>
3872
3873 !!end
3874
3875 !! test
3876 Definition Lists: Nesting: Multi-level (Parsoid only)
3877 !! options
3878 parsoid
3879 !! wikitext
3880 ;t1 :d1
3881 ;;t2 ::d2
3882 ;;;t3 :::d3
3883 !! html
3884 <dl>
3885 <dt>t1 </dt>
3886 <dd>d1</dd>
3887 <dt>
3888 <dl>
3889 <dt>t2 </dt>
3890 <dd>:d2</dd>
3891 <dt>
3892 <dl>
3893 <dt>t3 </dt>
3894 <dd>::d3</dd>
3895 </dl>
3896 </dt>
3897 </dl>
3898 </dt>
3899 </dl>
3900
3901
3902 !! end
3903
3904
3905 !! test
3906 Definition Lists: Nesting: Test 2 (Parsoid only)
3907 !! wikitext
3908 ;t1
3909 ::d2
3910 !! html/php+tidy
3911 <dl>
3912 <dt>t1</dt>
3913 <dd>
3914 <dl>
3915 <dd>d2</dd>
3916 </dl>
3917 </dd>
3918 </dl>
3919 !! html/parsoid
3920 <dl>
3921 <dt>t1</dt>
3922 <dd>
3923 <dl>
3924 <dd>d2</dd>
3925 </dl>
3926 </dd>
3927 </dl>
3928
3929 !! end
3930
3931
3932 !! test
3933 Definition Lists: Nesting: Test 3 (Parsoid only)
3934 !! wikitext
3935 :;t1
3936 ::::d2
3937 !! html/php+tidy
3938 <dl>
3939 <dd>
3940 <dl>
3941 <dt>t1</dt>
3942 <dd>
3943 <dl>
3944 <dd>
3945 <dl>
3946 <dd>d2</dd>
3947 </dl>
3948 </dd>
3949 </dl>
3950 </dd>
3951 </dl>
3952 </dd>
3953 </dl>
3954 !! html/parsoid
3955 <dl>
3956 <dd>
3957 <dl>
3958 <dt>t1</dt>
3959 <dd>
3960 <dl>
3961 <dd>
3962 <dl>
3963 <dd>d2</dd>
3964 </dl>
3965 </dd>
3966 </dl>
3967 </dd>
3968 </dl>
3969 </dd>
3970 </dl>
3971
3972 !! end
3973
3974
3975 !! test
3976 Definition Lists: Nesting: Test 4
3977 !! wikitext
3978 ::;t3
3979 :::d3
3980 !! html
3981 <dl><dd><dl><dd><dl><dt>t3</dt>
3982 <dd>d3</dd></dl></dd></dl></dd></dl>
3983
3984 !! end
3985
3986
3987 ## The Parsoid team believes the following three test exposes a
3988 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
3989 ## wrong to close the <dl> after the <dt> containing the <ul>.)
3990 ## It also exposes a "misfeature" in tidy, which doesn't like
3991 ## <dl> tags with a single <dt> child; it converts the <dt> into
3992 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
3993 !! test
3994 Definition Lists: Mixed Lists: Test 1
3995 !! wikitext
3996 :;* foo
3997 ::* bar
3998 :; baz
3999 !! html/php
4000 <dl><dd><dl><dt><ul><li> foo</li>
4001 <li> bar</li></ul></dt></dl>
4002 <dl><dt> baz</dt></dl></dd></dl>
4003
4004 !! html/php+tidy
4005 <dl>
4006 <dd>
4007 <dl>
4008 <dd>
4009 <ul>
4010 <li>foo</li>
4011 <li>bar</li>
4012 </ul>
4013 </dd>
4014 </dl>
4015 <dl>
4016 <dt>baz</dt>
4017 </dl>
4018 </dd>
4019 </dl>
4020 !! html/parsoid
4021 <dl>
4022 <dd><dl>
4023 <dt><ul>
4024 <li> foo
4025 </li>
4026 </ul></dt>
4027 <dd><ul>
4028 <li> bar
4029 </li>
4030 </ul></dd>
4031 <dt> baz</dt>
4032 </dl></dd>
4033 </dl>
4034 !! end
4035
4036 !! test
4037 Definition Lists: Mixed Lists: Test 2
4038 !! wikitext
4039 *: d1
4040 *: d2
4041 !! html
4042 <ul><li><dl><dd> d1</dd>
4043 <dd> d2</dd></dl></li></ul>
4044
4045 !! end
4046
4047
4048 !! test
4049 Definition Lists: Mixed Lists: Test 3
4050 !! wikitext
4051 *::: d1
4052 *::: d2
4053 !! html
4054 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4055 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4056
4057 !! end
4058
4059
4060 !! test
4061 Definition Lists: Mixed Lists: Test 4
4062 !! wikitext
4063 *;d1 :d2
4064 *;d3 :d4
4065 !! html
4066 <ul><li><dl><dt>d1&#160;</dt>
4067 <dd>d2</dd>
4068 <dt>d3&#160;</dt>
4069 <dd>d4</dd></dl></li></ul>
4070
4071 !! end
4072
4073
4074 !! test
4075 Definition Lists: Mixed Lists: Test 5
4076 !! wikitext
4077 *:d1
4078 *:: d2
4079 !! html
4080 <ul><li><dl><dd>d1
4081 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4082
4083 !! end
4084
4085
4086 !! test
4087 Definition Lists: Mixed Lists: Test 6
4088 !! wikitext
4089 #*:d1
4090 #*::: d3
4091 !! html
4092 <ol><li><ul><li><dl><dd>d1
4093 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4094
4095 !! end
4096
4097
4098 !! test
4099 Definition Lists: Mixed Lists: Test 7
4100 !! wikitext
4101 :* d1
4102 :* d2
4103 !! html
4104 <dl><dd><ul><li> d1</li>
4105 <li> d2</li></ul></dd></dl>
4106
4107 !! end
4108
4109
4110 !! test
4111 Definition Lists: Mixed Lists: Test 8
4112 !! wikitext
4113 :* d1
4114 ::* d2
4115 !! html
4116 <dl><dd><ul><li> d1</li></ul>
4117 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4118
4119 !! end
4120
4121
4122 !! test
4123 Definition Lists: Mixed Lists: Test 9
4124 !! wikitext
4125 *;foo :bar
4126 !! html
4127 <ul><li><dl><dt>foo&#160;</dt>
4128 <dd>bar</dd></dl></li></ul>
4129
4130 !! end
4131
4132
4133 !! test
4134 Definition Lists: Mixed Lists: Test 10
4135 !! wikitext
4136 *#;foo :bar
4137 !! html
4138 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4139 <dd>bar</dd></dl></li></ol></li></ul>
4140
4141 !! end
4142
4143 # The Parsoid team disagrees with the PHP parser's seemingly-random
4144 # rules regarding dd/dt on the next two tests. Parsoid is more
4145 # consistent, and recognizes the shared nesting and keeps the
4146 # still-open tags around until the nesting is complete.
4147 # (And tidy again converts <dt> to <dd> before 'bar'.)
4148
4149 !! test
4150 Definition Lists: Mixed Lists: Test 11
4151 !! wikitext
4152 *#*#;*;;foo :bar
4153 *#*#;boo :baz
4154 !! html/php
4155 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4156 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4157 <dl><dt>boo&#160;</dt>
4158 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4159
4160 !! html/php+tidy
4161 <ul>
4162 <li>
4163 <ol>
4164 <li>
4165 <ul>
4166 <li>
4167 <ol>
4168 <li>
4169 <dl>
4170 <dt>foo&#160;</dt>
4171 <dd>
4172 <ul>
4173 <li>
4174 <dl>
4175 <dd>
4176 <dl>
4177 <dt>bar</dt>
4178 </dl>
4179 </dd>
4180 </dl>
4181 </li>
4182 </ul>
4183 </dd>
4184 </dl>
4185 <dl>
4186 <dt>boo&#160;</dt>
4187 <dd>baz</dd>
4188 </dl>
4189 </li>
4190 </ol>
4191 </li>
4192 </ul>
4193 </li>
4194 </ol>
4195 </li>
4196 </ul>
4197 !! html/parsoid
4198 <ul>
4199 <li>
4200 <ol>
4201 <li>
4202 <ul>
4203 <li>
4204 <ol>
4205 <li>
4206 <dl>
4207 <dt>
4208 <ul>
4209 <li>
4210 <dl>
4211 <dt>
4212 <dl>
4213 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4214 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4215 </dl></dt>
4216 </dl></li>
4217 </ul></dt>
4218 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4219 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4220 </dl></li>
4221 </ol></li>
4222 </ul></li>
4223 </ol></li>
4224 </ul>
4225 !! end
4226
4227
4228 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4229 # From whitelist:
4230 # * The test is wrong, there are two colons where there should be :;
4231 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4232 !! test
4233 Definition Lists: Weird Ones: Test 1
4234 !! wikitext
4235 *#;*::;; foo : bar (who uses this?)
4236 !! html/php
4237 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4238 <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>
4239
4240 !! html/php+tidy
4241 <ul>
4242 <li>
4243 <ol>
4244 <li>
4245 <dl>
4246 <dt>foo&#160;</dt>
4247 <dd>
4248 <ul>
4249 <li>
4250 <dl>
4251 <dd>
4252 <dl>
4253 <dd>
4254 <dl>
4255 <dd>
4256 <dl>
4257 <dt>bar (who uses this?)</dt>
4258 </dl>
4259 </dd>
4260 </dl>
4261 </dd>
4262 </dl>
4263 </dd>
4264 </dl>
4265 </li>
4266 </ul>
4267 </dd>
4268 </dl>
4269 </li>
4270 </ol>
4271 </li>
4272 </ul>
4273 !! html/parsoid
4274 <ul>
4275 <li>
4276 <ol>
4277 <li>
4278 <dl>
4279 <dt>
4280 <ul>
4281 <li>
4282 <dl>
4283 <dd>
4284 <dl>
4285 <dd>
4286 <dl>
4287 <dt>
4288 <dl>
4289 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4290 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4291 </dl></dt>
4292 </dl></dd>
4293 </dl></dd>
4294 </dl></li>
4295 </ul></dt>
4296 </dl></li>
4297 </ol></li>
4298 </ul>
4299 !! end
4300
4301 !! test
4302 Definition Lists: colons occurring in tags
4303 !! wikitext
4304 ;a:b
4305 ;'''a:b'''
4306 ;<i>a:b</i>
4307 ;<span>a:b</span>
4308 ;<div>a:b</div>
4309 ;<div>a
4310 :b</div>
4311 ;{{echo|a:b}}
4312 ;{{echo|''a:b''}}
4313 ;;;''a:b''
4314 !! html+tidy
4315 <dl>
4316 <dt>a</dt>
4317 <dd>b</dd>
4318 <dt><b>a:b</b></dt>
4319 <dt><i>a:b</i></dt>
4320 <dt><span>a:b</span></dt>
4321 <dd>
4322 <div>a:b</div>
4323 </dd>
4324 <dd>
4325 <div>a
4326 <dl>
4327 <dd>b</dd>
4328 </dl>
4329 </div>
4330 </dd>
4331 <dt>a</dt>
4332 <dd>b</dd>
4333 <dt><i>a:b</i></dt>
4334 </dl>
4335 <dl>
4336 <dd>
4337 <dl>
4338 <dd>
4339 <dl>
4340 <dt><i>a:b</i></dt>
4341 </dl>
4342 </dd>
4343 </dl>
4344 </dd>
4345 </dl>
4346 !! html/parsoid
4347 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4348 <dt><b>a:b</b></dt>
4349 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4350 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4351 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4352 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4353 <dd>b</dd>
4354 <dt><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a:b"}},"i":0}}]}'>a:b</span></dt>
4355 <dt><i about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;a:b&#39;&#39;"}},"i":0}}]}'>a:b</i>
4356 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4357 !! end
4358
4359 !! test
4360 Definition Lists: colons and tables 1
4361 !! wikitext
4362 :{|
4363 | x
4364 |}
4365 :{|
4366 | y
4367 |}
4368 !! html
4369 <dl><dd><table>
4370 <tr>
4371 <td> x
4372 </td></tr></table></dd></dl>
4373 <dl><dd><table>
4374 <tr>
4375 <td> y
4376 </td></tr></table></dd></dl>
4377
4378 !! end
4379
4380 # Parsoid's output (as documented below) differs from php's in this case.
4381 # This is probably a bug. If we fixup parsoid to match php's output, the
4382 # above test should pass and the below test case can be removed. It is
4383 # unclear which output is more desirable.
4384
4385 !! test
4386 Definition Lists: colons and tables 2
4387 !! wikitext
4388 :{|
4389 | x
4390 |}
4391 :{|
4392 | y
4393 |}
4394 !! html/parsoid
4395 <dl><dd><table>
4396 <tr>
4397 <td> x
4398 </td></tr></table></dd>
4399 <dd><table>
4400 <tr>
4401 <td> y
4402 </td></tr></table></dd></dl>
4403 !! end
4404
4405 !! test
4406 Definition Lists: template interaction
4407 !! wikitext
4408 ::{{definition_list}}
4409
4410 :one
4411 ::{{definition_list}}
4412 :::two
4413 :::three
4414 ::four
4415 !! html/parsoid
4416 <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">
4417 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4418
4419 <dl><dd data-parsoid='{}'>one
4420 <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">
4421 </span><dd about="#mwt2">two
4422 <dl><dd>two</dd>
4423 <dd>three</dd></dl></dd>
4424 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4425 !! end
4426
4427
4428 ###
4429 ### External links
4430 ###
4431 !! test
4432 External links: non-bracketed
4433 !! wikitext
4434 Non-bracketed: http://example.com
4435 !! html
4436 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4437 </p>
4438 !! end
4439
4440 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4441 !! test
4442 External links: numbered
4443 !! wikitext
4444 Numbered: [http://example.com]
4445 Numbered: [http://example.net]
4446 Numbered: [http://example.com]
4447 !! html/php
4448 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4449 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4450 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4451 </p>
4452 !! html/parsoid
4453 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4454 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4455 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4456 !!end
4457
4458 !! test
4459 External links: specified text
4460 !! wikitext
4461 Specified text: [http://example.com link]
4462 !! html
4463 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4464 </p>
4465 !!end
4466
4467 !! test
4468 External links: trail
4469 !! wikitext
4470 Linktrails should not work for external links: [http://example.com link]s
4471 !! html
4472 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4473 </p>
4474 !! end
4475
4476 !! test
4477 External links: dollar sign in URL
4478 !! wikitext
4479 http://example.com/1$2345
4480 !! html
4481 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4482 </p>
4483 !! end
4484
4485 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4486 !! test
4487 External links: dollar sign in URL (autonumber)
4488 !! wikitext
4489 [http://example.com/1$2345]
4490 !! html/php
4491 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4492 </p>
4493 !! html/parsoid
4494 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4495 !!end
4496
4497 !! test
4498 External links: open square bracket forbidden in URL (bug 4377)
4499 !! options
4500 parsoid=wt2html,wt2wt,html2html
4501 !! wikitext
4502 http://example.com/1[2345
4503 !! html/php
4504 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4505 </p>
4506 !! html/parsoid
4507 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4508 !! end
4509
4510 !! test
4511 External links: open square bracket forbidden in URL (named) (bug 4377)
4512 !! options
4513 parsoid=wt2html,html2html
4514 !! wikitext
4515 [http://example.com/1[2345]
4516 !! html/php
4517 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4518 </p>
4519 !! html/parsoid
4520 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4521 !!end
4522
4523 # parsoid adds a space before the link name
4524 !! test
4525 External links: open square bracket forbidden in URL (named) (bug 4377)
4526 Parsoid variant.
4527 !! wikitext
4528 [http://example.com/1 [2345]
4529 !! html
4530 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4531 </p>
4532 !!end
4533
4534 !! test
4535 External links: nowiki in URL link text (bug 6230)
4536 !! wikitext
4537 [http://example.com/ <nowiki>''example site''</nowiki>]
4538 !! html
4539 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4540 </p>
4541 !! end
4542
4543 !! test
4544 External links: newline forbidden in text (bug 6230 regression check)
4545 !! wikitext
4546 [http://example.com/ first
4547 second]
4548 !! html
4549 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4550 second]
4551 </p>
4552 !!end
4553
4554 !! test
4555 External links: Pipe char between url and text
4556 !! wikitext
4557 [http://example.com | link]
4558 !! html
4559 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4560 </p>
4561 !!end
4562
4563 !! test
4564 External links: protocol-relative URL in brackets
4565 !! wikitext
4566 [//example.com/ Test]
4567 !! html
4568 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4569 </p>
4570 !! end
4571
4572 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4573 !! test
4574 External links: protocol-relative URL in brackets without text
4575 !! wikitext
4576 [//example.com]
4577 !! html/php
4578 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4579 </p>
4580 !! html/parsoid
4581 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4582 !! end
4583
4584 !! test
4585 External links: protocol-relative URL in free text is left alone
4586 !! wikitext
4587 //example.com/Foo
4588 !! html
4589 <p>//example.com/Foo
4590 </p>
4591 !!end
4592
4593 !! test
4594 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4595 !! wikitext
4596 foo//example.com/Foo
4597 !! html
4598 <p>foo//example.com/Foo
4599 </p>
4600 !! end
4601
4602 !! test
4603 External links: with no contents
4604 !! wikitext
4605 [http://en.wikipedia.org/wiki/Foo]
4606
4607 [[wikipedia:Foo|Bar]]
4608
4609 [[wikipedia:Foo|<span>Bar</span>]]
4610 !! html/php
4611 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4612 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4613 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4614 </p>
4615 !! html/parsoid
4616 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4617 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4618 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4619 !! end
4620
4621 !! test
4622 External links: Free with trailing punctuation
4623 !! wikitext
4624 http://example.com,
4625 http://example.com;
4626 http://example.com\
4627 http://example.com.
4628 http://example.com:
4629 http://example.com!
4630 http://example.com?
4631 http://example.com)
4632 http://example.com/url_with_(brackets)
4633 (http://example.com/url_without_brackets)
4634 http://example.com/url_with_entity&nbsp;
4635 http://example.com/url_with_entity&#xA0;
4636 http://example.com/url_with_entity&#160;
4637 http://example.com/url_with_entity&lt;
4638 http://example.com/url_with_entity&#x3C;
4639 http://example.com/url_with_entity&#60;
4640 !! html/php
4641 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4642 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4643 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4644 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4645 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4646 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4647 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4648 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4649 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4650 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4651 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4652 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4653 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4654 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4655 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4656 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4657 </p>
4658 !! html/parsoid
4659 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4660 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4661 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4662 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4663 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4664 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4665 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4666 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4667 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4668 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4669 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4670 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4671 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4672 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity">&lt;</span>
4673 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a>
4674 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a></p>
4675 !! end
4676
4677 !! test
4678 External links: Lone protocols are never linked (T105697)
4679 !! wikitext
4680 http://
4681 http://;
4682 (http://)
4683 bitcoin:
4684 bitcoin:;
4685 (bitcoin:)
4686 !! html
4687 <p>http://
4688 http://;
4689 (http://)
4690 bitcoin:
4691 bitcoin:;
4692 (bitcoin:)
4693 </p>
4694 !! end
4695
4696 !! test
4697 External links: No preceding word characters allowed (bug 65278)
4698 !! wikitext
4699 NOPEhttp://example.com
4700 N0http://example.com
4701 ok:http://example.com
4702 ok-http://example.com
4703 !! html
4704 <p>NOPEhttp://example.com
4705 N0http://example.com
4706 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4707 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4708 </p>
4709 !! end
4710
4711 !! test
4712 External image
4713 !! wikitext
4714 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4715 !! html
4716 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4717 </p>
4718 !! end
4719
4720 !! test
4721 External image from https
4722 !! wikitext
4723 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4724 !! html
4725 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4726 </p>
4727 !! end
4728
4729 !! test
4730 External image (when not allowed)
4731 !! options
4732 wgAllowExternalImages=0
4733 !! wikitext
4734 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4735 !! html
4736 <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>
4737 </p>
4738 !! end
4739
4740 !! test
4741 Link to non-http image, no img tag
4742 !! wikitext
4743 Link to non-http image, no img tag: ftp://example.com/test.jpg
4744 !! html
4745 <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>
4746 </p>
4747 !! end
4748
4749 !! test
4750 External links: terminating separator
4751 !! wikitext
4752 Terminating separator: http://example.com/thing,
4753 !! html
4754 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4755 </p>
4756 !! end
4757
4758 !! test
4759 External links: intervening separator
4760 !! wikitext
4761 Intervening separator: http://example.com/1,2,3
4762 !! html
4763 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4764 </p>
4765 !! end
4766
4767 !! test
4768 External links: old bug with URL in query
4769 !! wikitext
4770 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4771 !! html
4772 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4773 </p>
4774 !! end
4775
4776 !! test
4777 External links: old URL-in-URL bug, mixed protocols
4778 !! wikitext
4779 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4780 !! html
4781 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4782 </p>
4783 !!end
4784
4785 !! test
4786 External links: URL in text
4787 !! wikitext
4788 URL in text: [http://example.com http://example.com]
4789 !! html
4790 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4791 </p>
4792 !! end
4793
4794 !! test
4795 External links: Clickable images
4796 !! wikitext
4797 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4798 !! html/php
4799 <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>
4800 </p>
4801 !! html/parsoid
4802 <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>
4803 !! end
4804
4805 !! test
4806 External links: raw ampersand
4807 !! wikitext
4808 Old &amp; use: http://x&y
4809 !! html
4810 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4811 </p>
4812 !! end
4813
4814 !! test
4815 External links: encoded ampersand
4816 !! wikitext
4817 Old &amp; use: http://x&amp;y
4818 !! html/php
4819 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4820 </p>
4821 !! html/parsoid
4822 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4823 !! end
4824
4825 !! test
4826 External links: encoded equals (bug 6102)
4827 !! wikitext
4828 http://example.com/?foo&#61;bar
4829 !! html/php
4830 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4831 </p>
4832 !! html/parsoid
4833 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4834 !! end
4835
4836 ##
4837 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4838 ## does it number them. As discussed in bug 53505, we can identify
4839 ## autonumbered links via CSS.
4840 ##
4841
4842 !! test
4843 External links: [raw ampersand]
4844 !! wikitext
4845 Old &amp; use: [http://x&y]
4846 !! html/php
4847 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4848 </p>
4849 !! html/parsoid
4850 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4851 !! end
4852
4853 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4854 # mode will return the [raw ampersand] wikitext
4855 !! test
4856 External links: [encoded ampersand]
4857 !! options
4858 parsoid=wt2html,wt2wt,html2html
4859 !! wikitext
4860 Old &amp; use: [http://x&amp;y]
4861 !! html/php
4862 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4863 </p>
4864 !! html/parsoid
4865 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4866 !! end
4867
4868 !! test
4869 External links: [raw equals]
4870 !! wikitext
4871 [http://example.com/?foo=bar]
4872 !! html/php
4873 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4874 </p>
4875 !! html/parsoid
4876 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4877 !! end
4878
4879 # note that parsoid html is identical to [raw equals] case; so html2wt
4880 # mode will return the [raw equals] wikitext
4881 !! test
4882 External links: [encoded equals] (bug 6102)
4883 !! options
4884 parsoid=wt2html,wt2wt,html2html
4885 !! wikitext
4886 [http://example.com/?foo&#61;bar]
4887 !! html/php
4888 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4889 </p>
4890 !! html/parsoid
4891 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4892 !! end
4893
4894 # xxx parsoid strips the IDN character, so the round-trip tests will
4895 # obviously fail and are disabled. --cscott
4896 !! test
4897 External links: [IDN ignored character reference in hostname; strip it right off]
4898 !! options
4899 parsoid=wt2html,wt2wt,html2html
4900 !! wikitext
4901 [http://e&zwnj;xample.com/]
4902 !! html/php
4903 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4904 </p>
4905 !! html/parsoid
4906 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4907 !! end
4908
4909 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4910 # Where an external link could easily circumvent the sanitization of the text of
4911 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4912 # test demands a higher standard. That's a bit strange.
4913 #
4914 # Example:
4915 #
4916 # http://e‌xample.com -> [http://example.com|http://example.com]
4917 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4918 #
4919 # The first example is sanitized, but the second is not. Any security benefits
4920 # from this production are trivial to circumvent. Either remove this test and
4921 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4922 # the test accordingly.
4923 #
4924 # All our love,
4925 # The Parsoid team.
4926 # xxx parsoid strips the IDN character, so the round-trip tests will
4927 # obviously fail and are disabled. --cscott
4928 !! test
4929 External links: IDN ignored character reference in hostname; strip it right off
4930 !! options
4931 parsoid=wt2html,html2html
4932 !! wikitext
4933 http://e&zwnj;xample.com/
4934 !! html/php
4935 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4936 </p>
4937 !! html/parsoid
4938 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4939 !! end
4940
4941 !! test
4942 External links: www.jpeg.org (bug 554)
4943 !! wikitext
4944 http://www.jpeg.org
4945 !! html
4946 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4947 </p>
4948 !! end
4949
4950 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4951 !! test
4952 External links: URL within URL (original bug 2)
4953 !! wikitext
4954 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4955 !! html/php
4956 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4957 </p>
4958 !! html/parsoid
4959 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4960 !! end
4961
4962 !! test
4963 BUG 361: URL inside bracketed URL
4964 !! wikitext
4965 [http://www.example.com/foo http://www.example.com/bar]
4966 !! html
4967 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4968 </p>
4969 !! end
4970
4971 !! test
4972 BUG 361: URL within URL, not bracketed
4973 !! wikitext
4974 http://www.example.com/foo?=http://www.example.com/bar
4975 !! html
4976 <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>
4977 </p>
4978 !! end
4979
4980 !! test
4981 BUG 289: ">"-token in URL-tail
4982 !! wikitext
4983 http://www.example.com/<hello>
4984 !! html
4985 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
4986 </p>
4987 !!end
4988
4989 !! test
4990 BUG 289: literal ">"-token in URL-tail
4991 !! wikitext
4992 http://www.example.com/<b>html</b>
4993 !! html/php
4994 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
4995 </p>
4996 !! html/parsoid
4997 <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>
4998 !! end
4999
5000 !! test
5001 BUG 289: ">"-token in bracketed URL
5002 !! wikitext
5003 [http://www.example.com/<hello> stuff]
5004 !! html
5005 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5006 </p>
5007 !!end
5008
5009 !! test
5010 BUG 289: literal ">"-token in bracketed URL
5011 !! wikitext
5012 [http://www.example.com/<b>html</b> stuff]
5013 !! html
5014 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5015 </p>
5016 !!end
5017
5018 !! test
5019 BUG 289: literal double quote at end of URL
5020 !! wikitext
5021 http://www.example.com/"hello"
5022 !! html
5023 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5024 </p>
5025 !!end
5026
5027 !! test
5028 BUG 289: literal double quote in bracketed URL
5029 !! wikitext
5030 [http://www.example.com/"hello" stuff]
5031 !! html
5032 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5033 </p>
5034 !!end
5035
5036 !! test
5037 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5038 !! wikitext
5039 [http://www.example.com test]
5040 !! html
5041 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5042 </p>
5043 !! end
5044
5045 !! test
5046 External links: link text with spaces
5047 !! wikitext
5048 [http://www.example.com a b c]
5049 [http://www.example.com ''a'' ''b'']
5050 !! html
5051 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5052 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5053 </p>
5054 !! end
5055
5056 !! test
5057 External links: wiki links within external link (Bug 3695)
5058 !! wikitext
5059 [http://example.com [[wikilink]] embedded in ext link]
5060 !! html/php
5061 <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>
5062 </p>
5063 !! html/parsoid
5064 <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>
5065 !! end
5066
5067 !! test
5068 BUG 787: Links with one slash after the url protocol are invalid
5069 !! wikitext
5070 http:/example.com
5071
5072 [http:/example.com title]
5073 !! html
5074 <p>http:/example.com
5075 </p><p>[http:/example.com title]
5076 </p>
5077 !! end
5078
5079 !! test
5080 Bracketed external links with template-generated invalid target
5081 !! wikitext
5082 [{{echo|http:/example.com}} title]
5083 !! html
5084 <p>[http:/example.com title]
5085 </p>
5086 !! end
5087
5088 !! test
5089 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5090 !! wikitext
5091 ''[http://example.com text'']
5092 [http://example.com '''text]'''
5093 ''Something [http://example.com in italic'']
5094 ''Something [http://example.com mixed''''', even bold]'''
5095 '''''Now [http://example.com both''''']
5096 !! html
5097 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5098 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5099 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5100 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5101 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5102 </p>
5103 !! end
5104
5105
5106 !! test
5107 Bug 4781: %26 in URL
5108 !! wikitext
5109 http://www.example.com/?title=AT%26T
5110 !! html/php
5111 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5112 </p>
5113 !! html/parsoid
5114 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5115 !! end
5116
5117 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5118 # % is actually legal in HTML5. Any change in output would need testing though.
5119 !! test
5120 Bug 4781, 5267: %25 in URL
5121 !! wikitext
5122 http://www.example.com/?title=100%25_Bran
5123 !! html/php
5124 <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>
5125 </p>
5126 !! html/parsoid
5127 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5128 !! end
5129
5130 !! test
5131 Bug 4781, 5267: %28, %29 in URL
5132 !! wikitext
5133 http://www.example.com/?title=Ben-Hur_%281959_film%29
5134 !! html/php
5135 <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>
5136 </p>
5137 !! html/parsoid
5138 <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>
5139 !! end
5140
5141
5142 !! test
5143 Bug 4781: %26 in autonumber URL
5144 !! wikitext
5145 [http://www.example.com/?title=AT%26T]
5146 !! html/php
5147 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5148 </p>
5149 !! html/parsoid
5150 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5151 !! end
5152
5153 !! test
5154 Bug 4781, 5267: %26 in autonumber URL
5155 !! wikitext
5156 [http://www.example.com/?title=100%25_Bran]
5157 !! html/php
5158 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5159 </p>
5160 !! html/parsoid
5161 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5162 !! end
5163
5164 !! test
5165 Bug 4781, 5267: %28, %29 in autonumber URL
5166 !! wikitext
5167 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5168 !! html/php
5169 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5170 </p>
5171 !! html/parsoid
5172 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5173 !! end
5174
5175
5176 !! test
5177 Bug 4781: %26 in bracketed URL
5178 !! wikitext
5179 [http://www.example.com/?title=AT%26T link]
5180 !! html/php
5181 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5182 </p>
5183 !! html/parsoid
5184 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5185 !! end
5186
5187 !! test
5188 Bug 4781, 5267: %25 in bracketed URL
5189 !! wikitext
5190 [http://www.example.com/?title=100%25_Bran link]
5191 !! html
5192 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5193 </p>
5194 !! end
5195
5196 !! test
5197 Bug 4781, 5267: %28, %29 in bracketed URL
5198 !! wikitext
5199 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5200 !! html/php
5201 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5202 </p>
5203 !! html/parsoid
5204 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5205 !! end
5206
5207 !! test
5208 External link containing a period in the anchor. (bug 63947)
5209 !! wikitext
5210 [//foo.org/bar#baz. bang]
5211
5212 [//foo.org/bar. bang]
5213 !! html/php
5214 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5215 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5216 </p>
5217 !! html/parsoid
5218 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5219 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5220 !! end
5221
5222 !! test
5223 External link containing a single quote. (bug 63947)
5224 !! wikitext
5225 [//foo.org/bar'baz]
5226
5227 [//foo.org/bar'baz bang]
5228 !! html/php
5229 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5230 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5231 </p>
5232 !! html/parsoid
5233 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5234 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5235 !! end
5236
5237
5238 !! test
5239 External link containing a period in the anchor. (bug 63947)
5240 !! wikitext
5241 [//foo.org/bar#baz. bang]
5242
5243 [//foo.org/bar. bang]
5244 !! html/php
5245 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5246 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5247 </p>
5248 !! html/parsoid
5249 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5250 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5251 !! end
5252
5253 !! test
5254 External link containing a single quote. (bug 63947)
5255 !! wikitext
5256 [//foo.org/bar'baz]
5257
5258 [//foo.org/bar'baz bang]
5259 !! html/php
5260 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5261 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5262 </p>
5263 !! html/parsoid
5264 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5265 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5266 !! end
5267
5268
5269 !! test
5270 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5271 !! wikitext
5272 Some [http://example.com/ pretty ''italics'' and stuff]!
5273 !! html
5274 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5275 </p>
5276 !! end
5277
5278 !! test
5279 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5280 !! wikitext
5281 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5282 !! html
5283 <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>
5284 </p>
5285 !! end
5286
5287 !! test
5288 External link containing double-single-quotes with no space separating the url from text in italics
5289 !! wikitext
5290 [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]].]
5291 !! html/php
5292 <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>
5293 </p>
5294 !! html/php+tidy
5295 <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>
5296 !! html/parsoid
5297 <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>
5298 !! end
5299
5300 !! test
5301 External link with comments in link text
5302 !! wikitext
5303 [http://www.google.com Google <!-- comment -->]
5304 !! html
5305 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5306 </p>
5307 !! end
5308
5309 !! test
5310 URL-encoding in URL functions (single parameter)
5311 !! wikitext
5312 {{localurl:Some page|amp=&}}
5313 !! html
5314 <p>/index.php?title=Some_page&amp;amp=&amp;
5315 </p>
5316 !! end
5317
5318 !! test
5319 URL-encoding in URL functions (multiple parameters)
5320 !! wikitext
5321 {{localurl:Some page|q=?&amp=&}}
5322 !! html
5323 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5324 </p>
5325 !! end
5326
5327 !! test
5328 Brackets in urls
5329 !! wikitext
5330 http://example.com/index.php?foozoid%5B%5D=bar
5331
5332 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5333 !! html/php
5334 <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>
5335 </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>
5336 </p>
5337 !! html/parsoid
5338 <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>
5339
5340 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5341 !! end
5342
5343 !! test
5344 IPv6 urls (bug 21261)
5345 !! options
5346 disabled
5347 !! wikitext
5348 http://[2404:130:0:1000::187:2]/index.php
5349 !! html
5350 <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>
5351 </p>
5352 !! end
5353
5354 !! test
5355 Non-extlinks in brackets
5356 !! wikitext
5357 [foo]
5358 [foo bar]
5359 [foo ''bar'']
5360 [fool's] errand
5361 [fool's errand]
5362 [{{echo|foo}}]
5363 [{{echo|foo}} bar]
5364 [{{echo|foo}} ''bar'']
5365 [{{echo|foo}}l's] errand
5366 [{{echo|foo}}l's errand]
5367 [url={{echo|foo}}]
5368 [url=http://example.com]
5369 !! html
5370 <p>[foo]
5371 [foo bar]
5372 [foo <i>bar</i>]
5373 [fool's] errand
5374 [fool's errand]
5375 [foo]
5376 [foo bar]
5377 [foo <i>bar</i>]
5378 [fool's] errand
5379 [fool's errand]
5380 [url=foo]
5381 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5382 </p>
5383 !! end
5384
5385 !! test
5386 Percent encoding in external links
5387 !! wikitext
5388 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5389 !! html/php
5390 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5391 </p>
5392 !! html/parsoid
5393 <p><a rel="mw:ExtLink"
5394 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5395 !! end
5396
5397 !! test
5398 Use url link syntax for links where the content is equal the link target
5399 !! wikitext
5400 http://example.com
5401 !! html/php
5402 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5403 </p>
5404 !! html/parsoid
5405 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5406 !! end
5407
5408 !! test
5409 Parenthesis in external links, especially URL links
5410 !! wikitext
5411 http://example.com)
5412
5413 http://example.com/test)
5414
5415 http://example.com/(test)
5416
5417 http://example.com/((test)
5418
5419 (http://example.com/(test))
5420
5421 (http://example.com/(test)))))
5422
5423 http://example.com/a)b
5424
5425 [http://example.com) foo]
5426 !! html/php
5427 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5428 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5429 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5430 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5431 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5432 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5433 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5434 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5435 </p>
5436 !! html/parsoid
5437 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5438 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5439 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5440 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5441 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5442 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5443 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5444 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5445 !! end
5446
5447 !! test
5448 Parenthesis in external links, w/ transclusion or comment
5449 !! wikitext
5450 (http://example.com/{{echo|hi}})
5451
5452 (http://example.com<!-- hi -->)
5453 !! html/php
5454 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5455 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5456 </p>
5457 !! html/parsoid
5458 <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>
5459
5460 <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>
5461 !! end
5462
5463 !! test
5464 Serialize <a> tags with invalid link targets as plain text
5465 !! options
5466 parsoid=html2wt
5467 !! html/parsoid
5468 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5469 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5470 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5471 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5472 !! wikitext
5473 text
5474 <nowiki>*</nowiki>text
5475 <nowiki>[[foo]]</nowiki>
5476 <nowiki>*a [[foo]]</nowiki>
5477 !! end
5478
5479 !! test
5480 mw:ExtLink -vs- mw:WikiLink (T94723)
5481 !! options
5482 parsoid=html2wt
5483 !! html/parsoid
5484 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"},"dsr":[0,11,6,2]}'>Bar</a>
5485 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5486 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5487 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5488 <p>
5489 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5490 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5491 </p>
5492 !! wikitext
5493 [[Foo|Bar]]
5494 [[Foo|Bar]]
5495 [[wikipedia:Foo|Bar]]
5496 [[wikipedia:Foo|Bar]]
5497
5498 [[wikipedia:European_Robin|European Robin]]
5499 [[wikipedia:European_Robin|European Robin]]
5500 !! end
5501
5502 !! test
5503 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5504 !! options
5505 parsoid=wt2wt
5506 !! wikitext
5507 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5508 !! html/parsoid
5509 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5510 !! end
5511
5512
5513 ###
5514 ### Quotes
5515 ###
5516
5517 !! test
5518 Quotes
5519 !! wikitext
5520 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5521
5522 Normal text. '''''Bold italic text.''''' Normal text.
5523 !! html
5524 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5525 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5526 </p>
5527 !! end
5528
5529
5530 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5531 # parser strips. The wikitext contains just the first half of the bold
5532 # quote pair.
5533 !! test
5534 Unclosed and unmatched quotes
5535 !! wikitext
5536 '''''Bold italic text '''with bold deactivated''' in between.'''''
5537
5538 '''''Bold italic text ''with italic deactivated'' in between.'''''
5539
5540 '''Bold text..
5541
5542 ..spanning two paragraphs (should not work).'''
5543
5544 '''Bold tag left open
5545
5546 ''Italic tag left open
5547
5548 Normal text.
5549
5550 <!-- Unmatching number of opening, closing tags: -->
5551 '''This year''''s election ''should'' beat '''last year''''s.
5552
5553 ''Tom'''s car is bigger than ''Susan'''s.
5554
5555 Plain ''italic'''s plain
5556 !! html/php
5557 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5558 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5559 </p><p><b>Bold text..</b>
5560 </p><p>..spanning two paragraphs (should not work).
5561 </p><p><b>Bold tag left open</b>
5562 </p><p><i>Italic tag left open</i>
5563 </p><p>Normal text.
5564 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5565 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5566 </p><p>Plain <i>italic'</i>s plain
5567 </p>
5568 !! html/parsoid
5569 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5570 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5571 </p><p><b>Bold text..</b>
5572 </p><p>..spanning two paragraphs (should not work).<b></b>
5573 </p><p><b>Bold tag left open</b>
5574 </p><p><i>Italic tag left open</i>
5575 </p><p>Normal text.
5576 </p>
5577 <!-- Unmatching number of opening, closing tags: -->
5578 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5579 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5580 </p><p>Plain <i>italic'</i>s plain
5581 </p>
5582 !! end
5583
5584 ###
5585 ### Tables
5586 ###
5587 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5588 ###
5589
5590 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5591 # is the bare minimum required by the spec, see:
5592 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5593 # Parsoid team replies: empty table tags are legal in HTML5
5594 !! test
5595 A table with no data.
5596 !! options
5597 parsoid=wt2html
5598 !! wikitext
5599 {||}
5600 !! html/php
5601
5602 !! html/parsoid
5603 <table></table>
5604
5605 !! end
5606
5607 !! test
5608 A table with stray table end tags on start tag line (wt2html)
5609 !! options
5610 parsoid=wt2html
5611 !! wikitext
5612 {|style="color: red;"|}
5613
5614 {|style="color: red;" |}
5615 |foo
5616 |}
5617
5618 {|style="color: red;"|} id="foo"
5619 |foo
5620 |}
5621
5622 {|style="color: red;" |} id="foo"
5623 |foo
5624 |}
5625 !! html
5626 <table style="color: red;"></table>
5627
5628 <table style="color: red;">
5629 <tbody><tr>
5630 <td>foo</td>
5631 </tr></tbody>
5632 </table>
5633
5634 <table style="color: red;" id="foo">
5635 <tbody><tr>
5636 <td>foo</td>
5637 </tr></tbody>
5638 </table>
5639
5640 <table style="color: red;" id="foo">
5641 <tbody><tr>
5642 <td>foo</td>
5643 </tr></tbody>
5644 </table>
5645
5646 !! end
5647
5648 !! test
5649 A table with no data (take 2)
5650 !! wikitext
5651 {|
5652 |}
5653 !! html/parsoid
5654 <table></table>
5655 !! end
5656
5657 # A table with nothing but a caption is invalid XHTML, we might want to render
5658 # this as <p>caption</p>
5659 # Parsoid team replies: table with only a caption is legal in HTML5
5660 !! test
5661 A table with nothing but a caption
5662 !! wikitext
5663 {|
5664 |+ caption
5665 |}
5666 !! html/php
5667 <table>
5668 <caption> caption
5669 </caption><tr><td></td></tr></table>
5670
5671 !! html/parsoid
5672 <table><caption> caption</caption></table>
5673 !! end
5674
5675 !! test
5676 A table with caption with default-spaced attributes and a table row
5677 !! wikitext
5678 {|
5679 |+ style="color: red;" | caption1
5680 |-
5681 | foo
5682 |}
5683 !! html
5684 <table>
5685 <caption style="color: red;"> caption1
5686 </caption>
5687 <tr>
5688 <td> foo
5689 </td></tr></table>
5690
5691 !! end
5692
5693 !! test
5694 A table with captions with non-default spaced attributes and a table row
5695 !! wikitext
5696 {|
5697 |+style="color: red;"|caption2
5698 |+ style="color: red;"| caption3
5699 |-
5700 | foo
5701 |}
5702 !! html
5703 <table>
5704 <caption style="color: red;">caption2
5705 </caption>
5706 <caption style="color: red;"> caption3
5707 </caption>
5708 <tr>
5709 <td> foo
5710 </td></tr></table>
5711
5712 !! end
5713
5714 !! test
5715 Table td-cell syntax variations
5716 !! wikitext
5717 {|
5718 | foo bar foo | baz
5719 | foo bar foo || baz
5720 | style='color:red;' | baz
5721 | style='color:red;' || baz
5722 |}
5723 !! html
5724 <table>
5725 <tr>
5726 <td> baz
5727 </td>
5728 <td> foo bar foo </td>
5729 <td> baz
5730 </td>
5731 <td style="color:red;"> baz
5732 </td>
5733 <td> style='color:red;' </td>
5734 <td> baz
5735 </td></tr></table>
5736
5737 !! end
5738
5739 !! test
5740 Simple table
5741 !! wikitext
5742 {|
5743 | 1 || 2
5744 |-
5745 | 3 || 4
5746 |}
5747 !! html
5748 <table>
5749 <tr>
5750 <td> 1 </td>
5751 <td> 2
5752 </td></tr>
5753 <tr>
5754 <td> 3 </td>
5755 <td> 4
5756 </td></tr></table>
5757
5758 !! end
5759
5760 !! test
5761 Simple table but with multiple dashes for row wikitext
5762 !! wikitext
5763 {|
5764 | foo
5765 |-----
5766 | bar
5767 |}
5768 !! html
5769 <table>
5770 <tr>
5771 <td> foo
5772 </td></tr>
5773 <tr>
5774 <td> bar
5775 </td></tr></table>
5776
5777 !! end
5778
5779 !! test
5780 Multiplication table
5781 !! wikitext
5782 {| border="1" cellpadding="2"
5783 |+Multiplication table
5784 |-
5785 ! &times; !! 1 !! 2 !! 3
5786 |-
5787 ! 1
5788 | 1 || 2 || 3
5789 |-
5790 ! 2
5791 | 2 || 4 || 6
5792 |-
5793 ! 3
5794 | 3 || 6 || 9
5795 |-
5796 ! 4
5797 | 4 || 8 || 12
5798 |-
5799 ! 5
5800 | 5 || 10 || 15
5801 |}
5802 !! html
5803 <table border="1" cellpadding="2">
5804 <caption>Multiplication table
5805 </caption>
5806 <tr>
5807 <th> &#215; </th>
5808 <th> 1 </th>
5809 <th> 2 </th>
5810 <th> 3
5811 </th></tr>
5812 <tr>
5813 <th> 1
5814 </th>
5815 <td> 1 </td>
5816 <td> 2 </td>
5817 <td> 3
5818 </td></tr>
5819 <tr>
5820 <th> 2
5821 </th>
5822 <td> 2 </td>
5823 <td> 4 </td>
5824 <td> 6
5825 </td></tr>
5826 <tr>
5827 <th> 3
5828 </th>
5829 <td> 3 </td>
5830 <td> 6 </td>
5831 <td> 9
5832 </td></tr>
5833 <tr>
5834 <th> 4
5835 </th>
5836 <td> 4 </td>
5837 <td> 8 </td>
5838 <td> 12
5839 </td></tr>
5840 <tr>
5841 <th> 5
5842 </th>
5843 <td> 5 </td>
5844 <td> 10 </td>
5845 <td> 15
5846 </td></tr></table>
5847
5848 !! end
5849
5850 !! test
5851 Accept "||" in table headings
5852 !! wikitext
5853 {|
5854 !h1 || h2
5855 |}
5856 !! html
5857 <table>
5858 <tr>
5859 <th>h1 </th>
5860 <th> h2
5861 </th></tr></table>
5862
5863 !! end
5864
5865 !! test
5866 Accept "!!" in table data
5867 !! wikitext
5868 {|
5869 | Foo!! ||
5870 |}
5871 !! html
5872 <table>
5873 <tr>
5874 <td> Foo!! </td>
5875 <td>
5876 </td></tr></table>
5877
5878 !! html/parsoid
5879 <table>
5880 <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>
5881 </tbody></table>
5882 !! end
5883
5884 !! test
5885 Accept "||" in indented table headings
5886 !! wikitext
5887 :{|
5888 !h1 || h2
5889 |}
5890 !! html
5891 <dl><dd><table>
5892 <tr>
5893 <th>h1 </th>
5894 <th> h2
5895 </th></tr></table></dd></dl>
5896
5897 !! end
5898
5899 !! test
5900 Accept "!!" in templates
5901 !! wikitext
5902 {|
5903 !a {{echo|b!!c}}
5904 |}
5905 !! html/php
5906 <table>
5907 <tr>
5908 <th>a b</th>
5909 <th>c
5910 </th></tr></table>
5911
5912 !! html/parsoid
5913 <table>
5914 <tbody><tr><th typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":["!a ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b!!c"}},"i":0}}]}'>a b</th><th about="#mwt1">c</th></tr>
5915 !! end
5916
5917 !! test
5918 Accept "!!" in table headings after newline
5919 !! wikitext
5920 {|
5921 !a
5922 b!!c
5923 |}
5924 !! html/php
5925 <table>
5926 <tr>
5927 <th>a
5928 <p>b!!c
5929 </p>
5930 </th></tr></table>
5931
5932 !! html/parsoid
5933 <table>
5934 <tbody><tr><th>a
5935 <p>b!!c</p></th></tr>
5936 </tbody></table>
5937 !! end
5938
5939 !! test
5940 Accept "!!" in table data of mixed wikitext / html syntax
5941 !! wikitext
5942 {|
5943 !a
5944 <tr><td>b!!c</td></tr>
5945 |}
5946 !! html+tidy
5947 <table>
5948 <tr>
5949 <th>a</th>
5950 </tr>
5951 <tr>
5952 <td>b!!c</td>
5953 </tr>
5954 </table>
5955 !! html/parsoid
5956 <table>
5957 <tbody><tr><th>a</th></tr>
5958 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
5959 </tbody></table>
5960 !! end
5961
5962 !! test
5963 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
5964 !! wikitext
5965 {|
5966 !| h1
5967 || a
5968 |}
5969 !! html
5970 <table>
5971 <tr>
5972 <th> h1
5973 </th>
5974 <td> a
5975 </td></tr></table>
5976
5977 !! end
5978
5979 !!test
5980 Accept "| !" at start of line in tables (ignore !-attribute)
5981 !! wikitext
5982 {|
5983 |-
5984 | !style="color:red" | bar
5985 |}
5986 !! html
5987 <table>
5988
5989 <tr>
5990 <td> bar
5991 </td></tr></table>
5992
5993 !!end
5994
5995 !!test
5996 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 +/-
5997 !! wikitext
5998 {|
5999 |-
6000 |style='color:red;'|+1
6001 |style='color:blue;'|-1
6002 |-
6003 | 1 || 2 || 3
6004 | 1 ||+2 ||-3
6005 |-
6006 | +1
6007 | -1
6008 |}
6009 !! html
6010 <table>
6011
6012 <tr>
6013 <td style="color:red;">+1
6014 </td>
6015 <td style="color:blue;">-1
6016 </td></tr>
6017 <tr>
6018 <td> 1 </td>
6019 <td> 2 </td>
6020 <td> 3
6021 </td>
6022 <td> 1 </td>
6023 <td>+2 </td>
6024 <td>-3
6025 </td></tr>
6026 <tr>
6027 <td> +1
6028 </td>
6029 <td> -1
6030 </td></tr></table>
6031
6032 !!end
6033
6034 !! test
6035 Table rowspan
6036 !! wikitext
6037 {| border=1
6038 | Cell 1, row 1
6039 |rowspan=2| Cell 2, row 1 (and 2)
6040 | Cell 3, row 1
6041 |-
6042 | Cell 1, row 2
6043 | Cell 3, row 2
6044 |}
6045 !! html
6046 <table border="1">
6047 <tr>
6048 <td> Cell 1, row 1
6049 </td>
6050 <td rowspan="2"> Cell 2, row 1 (and 2)
6051 </td>
6052 <td> Cell 3, row 1
6053 </td></tr>
6054 <tr>
6055 <td> Cell 1, row 2
6056 </td>
6057 <td> Cell 3, row 2
6058 </td></tr></table>
6059
6060 !! end
6061
6062 !! test
6063 Nested table
6064 !! wikitext
6065 {| border=1
6066 | &alpha;
6067 |
6068 {| bgcolor=#ABCDEF border=2
6069 |nested
6070 |-
6071 |table
6072 |}
6073 |the original table again
6074 |}
6075 !! html
6076 <table border="1">
6077 <tr>
6078 <td> &#945;
6079 </td>
6080 <td>
6081 <table bgcolor="#ABCDEF" border="2">
6082 <tr>
6083 <td>nested
6084 </td></tr>
6085 <tr>
6086 <td>table
6087 </td></tr></table>
6088 </td>
6089 <td>the original table again
6090 </td></tr></table>
6091
6092 !! end
6093
6094 !! test
6095 Invalid attributes in table cell (bug 1830)
6096 !! wikitext
6097 {|
6098 |Cell:|broken
6099 |}
6100 !! html
6101 <table>
6102 <tr>
6103 <td>broken
6104 </td></tr></table>
6105
6106 !! end
6107
6108 !! test
6109 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6110 !! wikitext
6111 {|
6112 | title="foo" |bar
6113 | title="foo<nowiki>|</nowiki>" |bar
6114 | title="foo<nowiki>|</nowiki>" bar
6115 |}
6116 !! html
6117 <table>
6118 <tr>
6119 <td title="foo">bar
6120 </td>
6121 <td title="foo&#124;">bar
6122 </td>
6123 <td> title="foo|" bar
6124 </td></tr></table>
6125
6126 !! end
6127
6128 # The "|}" to close the table is missing from the input, so parsoid's
6129 # *2wt modes will fail.
6130 !! test
6131 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
6132 !! options
6133 parsoid=wt2html,html2html
6134 !! wikitext
6135 {|
6136 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6137 !! html/php
6138 <table>
6139 <tr>
6140 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6141 <td>]" onmouseover="alert(document.cookie)"&gt;test
6142 </td>
6143 </tr>
6144 </table>
6145
6146 !! html/parsoid
6147 <table><tbody>
6148 <tr>
6149 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6150 !! end
6151
6152 # FIXME: The php output is broken.
6153 !! test
6154 ! and || in td attributes should not be parsed as <th>/<td>
6155 !! wikitext
6156 {|
6157 | style="color: red !important;" data-contrived="put this here ||" | foo
6158 |}
6159 !! html/php
6160 <table>
6161 <tr>
6162 <td> style="color: red !important;" data-contrived="put this here </td>
6163 <td> foo
6164 </td></tr></table>
6165
6166 !! html/parsoid
6167 <table>
6168 <tbody><tr><td style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"autoInsertedEnd":true}'> foo</td></tr>
6169 </tbody></table>
6170 !! end
6171
6172 !! test
6173 Indented table markup mixed with indented pre content (proposed in bug 6200)
6174 !! wikitext
6175 <table>
6176 <tr>
6177 <td>
6178 Text that should be rendered preformatted
6179 </td>
6180 </tr>
6181 </table>
6182 !! html
6183 <table>
6184 <tr>
6185 <td>
6186 <pre>Text that should be rendered preformatted
6187 </pre>
6188 </td>
6189 </tr>
6190 </table>
6191
6192 !! end
6193
6194 !! test
6195 1. Template-generated table cell attributes and cell content
6196 !! wikitext
6197 {|
6198 |{{table_attribs}}
6199 | {{table_attribs}}
6200 || {{table_attribs_5}}
6201 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6202 |align=center {{table_attribs}}
6203 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6204 |}
6205 !! html
6206 <table>
6207 <tr>
6208 <td style="color:red;">Foo
6209 </td>
6210 <td style="color:red;">Foo
6211 </td>
6212 <td> style="color:red;"</td>
6213 <td>Bar
6214 </td>
6215 <td style="color:red;">Foo
6216 </td>
6217 <td align="center" style="color:red;">Foo
6218 </td>
6219 <td align="center" style="color:red;">Foo
6220 </td></tr></table>
6221
6222 !! end
6223
6224 !! test
6225 2. Template-generated table cell attributes and cell content
6226 !! wikitext
6227 {|
6228 |{{table_attribs_2}}
6229 |}
6230 !! html/php
6231 <table>
6232 <tr>
6233 <td style="color:red;">Foo
6234 </td>
6235 <td>Bar</td>
6236 <td>Baz
6237 </td></tr></table>
6238
6239 !! html/parsoid
6240 <table>
6241 <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>
6242 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6243 </tbody></table>
6244 !! end
6245
6246 !! test
6247 3. Template-generated table cell attributes and cell content
6248 !! wikitext
6249 {|
6250 !align=center {{table_header_cells}}
6251 |-
6252 |align=center {{table_cells}}
6253 |}
6254 !! html/php
6255 <table>
6256 <tr>
6257 <th align="center" style="color:red;">Foo</th>
6258 <th style="color:red;"><i>Bar</i></th>
6259 <th style="color:brown;"><i>Foo</i> and Baz
6260 </th></tr>
6261 <tr>
6262 <td align="center" style="color:red;">Foo</td>
6263 <td style="color:red;"><i>Bar</i></td>
6264 <td style="color:brown;"><i>Foo</i> and Baz
6265 </td></tr></table>
6266
6267 !! html/parsoid
6268 <table>
6269 <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>
6270 <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>
6271 </tbody></table>
6272 !! end
6273
6274 !! test
6275 4. Template-generated table cell attributes and cell content inside a templated table
6276 !! wikitext
6277 {{tbl-start}}
6278 !align=center {{table_header_cells}}
6279 |-
6280 |align=center {{table_cells}}
6281 {{tbl-end}}
6282 !! html/php
6283 <table>
6284 <tr>
6285 <th align="center" style="color:red;">Foo</th>
6286 <th style="color:red;"><i>Bar</i></th>
6287 <th style="color:brown;"><i>Foo</i> and Baz
6288 </th></tr>
6289 <tr>
6290 <td align="center" style="color:red;">Foo</td>
6291 <td style="color:red;"><i>Bar</i></td>
6292 <td style="color:brown;"><i>Foo</i> and Baz
6293 </td></tr></table>
6294
6295 !! html/parsoid
6296 <table about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[],[],[],[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"tbl-start","href":"./Template:Tbl-start"},"params":{},"i":0}},"\n!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":1}},"\n|-\n|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":2}},"\n",{"template":{"target":{"wt":"tbl-end","href":"./Template:Tbl-end"},"params":{},"i":3}}]}'>
6297 <tbody><tr><th align="center" style="color:red;">Foo</th><th style="color:red;"><i>Bar</i></th><th style="color:brown;"><i>Foo</i> and Baz</th></tr>
6298 <tr>
6299 <td align="center" style="color:red;">Foo</td><td style="color:red;"><i>Bar</i></td><td style="color:brown;"><i>Foo</i> and Baz</td></tr>
6300 </tbody></table>
6301 !! end
6302
6303 ## Edge case fix to prevent future regressions
6304 !! test
6305 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6306 !! wikitext
6307 {|
6308 |{{table_attribs_7}}
6309 |}
6310 <references />
6311 !! html/parsoid
6312 <table>
6313 <tbody><tr><td style="background:#f9f9f9;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_7","href":"./Template:Table_attribs_7"},"params":{},"i":0}}]}'>Foo<span class="mw-ref" id="cite_ref-1" rel="dc:references" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></td></tr>
6314 </tbody></table>
6315 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
6316 !! end
6317
6318 !! test
6319 Table with row followed by newlines and table heading
6320 !! wikitext
6321 {|
6322 |-
6323
6324 ! foo
6325 |}
6326 !! html
6327 <table>
6328
6329
6330 <tr>
6331 <th> foo
6332 </th></tr></table>
6333
6334 !! end
6335
6336 !! test
6337 Table with empty line following the start tag
6338 !! wikitext
6339 {|
6340
6341 |-
6342 | foo
6343 |}
6344 !! html
6345 <table>
6346
6347
6348 <tr>
6349 <td> foo
6350 </td></tr></table>
6351
6352 !! end
6353
6354 # FIXME: Preserve the attribute properly (with an empty string as value) in
6355 # the PHP parser. Parsoid implements the behavior below.
6356 !! test
6357 Table attributes with empty value
6358 !! wikitext
6359 {|
6360 | style=| hello
6361 |}
6362 !! html/parsoid
6363 <table>
6364 <tbody>
6365 <tr>
6366 <td style=""> hello
6367 </td></tr></tbody></table>
6368
6369 !! end
6370
6371 !! test
6372 Wikitext table with a lot of comments
6373 !! wikitext
6374 {|
6375 <!-- c0 -->
6376 | foo
6377 <!-- c1 -->
6378 |-<!-- c2 -->
6379 <!-- c3 -->
6380 |<!-- c4 -->
6381 <!-- c5 -->
6382 |}
6383 !! html
6384 <table>
6385 <tr>
6386 <td> foo
6387 </td></tr>
6388 <tr>
6389 <td>
6390 </td></tr></table>
6391
6392 !! end
6393
6394 !! test
6395 Wikitext table comments represented in parsoid dom
6396 !! wikitext
6397 {|<!--c1--><!--c2-->
6398 |-<!--c3-->
6399 | x
6400 |}
6401 !! html/php+tidy
6402 <table>
6403 <tr>
6404 <td>x</td>
6405 </tr>
6406 </table>
6407 !! html/parsoid
6408 <table><!--c1--><!--c2-->
6409 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6410 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6411 </tbody></table>
6412 !! end
6413
6414 !! test
6415 Wikitext table with double-line table cell
6416 !! wikitext
6417 {|
6418 |a
6419 b
6420 |}
6421 !! html
6422 <table>
6423 <tr>
6424 <td>a
6425 <p>b
6426 </p>
6427 </td></tr></table>
6428
6429 !! end
6430
6431 !! test
6432 Table cell with a single comment
6433 !! wikitext
6434 {|
6435 | <!-- c1 -->
6436 | a
6437 |}
6438 !! html
6439 <table>
6440 <tr>
6441 <td>
6442 </td>
6443 <td> a
6444 </td></tr></table>
6445
6446 !! end
6447
6448 !! test
6449 Table-cell after a comment-only-empty-line
6450 !! wikitext
6451 {|
6452 |a
6453 <!--c1-->
6454 <!--c2-->| b
6455 |}
6456 !! html
6457 <table>
6458 <tr>
6459 <td>a
6460 </td>
6461 <td> b
6462 </td></tr></table>
6463
6464 !! html/parsoid
6465 <table>
6466 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6467 <!--c1-->
6468 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6469 </tbody></table>
6470
6471 !! end
6472
6473 !! test
6474 Build table with {{!}}
6475 !! wikitext
6476 {{{!}} class="wikitable"
6477 ! header
6478 ! second header
6479 {{!}}- style="color:red;"
6480 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6481 {{!}}}
6482 !! html
6483 <table class="wikitable">
6484 <tr>
6485 <th> header
6486 </th>
6487 <th> second header
6488 </th></tr>
6489 <tr style="color:red;">
6490 <td> data </td>
6491 <td style="color:red;"> second data
6492 </td></tr></table>
6493
6494 !! end
6495
6496 !! test
6497 Build table with pipe as data
6498 !! wikitext
6499 {| class="wikitable"
6500 ! header
6501 ! second header
6502 |- style="color:red;"
6503 | data || style="color:red;" | second data
6504 |-
6505 | style="color:red;" | data with | || style="color:red;" | second data with |
6506 |-
6507 || data with | ||| second data with |
6508 |}
6509 !! html
6510 <table class="wikitable">
6511 <tr>
6512 <th> header
6513 </th>
6514 <th> second header
6515 </th></tr>
6516 <tr style="color:red;">
6517 <td> data </td>
6518 <td style="color:red;"> second data
6519 </td></tr>
6520 <tr>
6521 <td style="color:red;"> data with | </td>
6522 <td style="color:red;"> second data with |
6523 </td></tr>
6524 <tr>
6525 <td> data with | </td>
6526 <td> second data with |
6527 </td></tr></table>
6528
6529 !! end
6530
6531 !! test
6532 Build table with wikilink
6533 !! wikitext
6534 {| class="wikitable"
6535 ! header || second header
6536 |- style="color:red;"
6537 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6538 |-
6539 | data || second data [[Main Page|link|text with pipe]]
6540 |}
6541 !! html
6542 <table class="wikitable">
6543 <tr>
6544 <th> header </th>
6545 <th> second header
6546 </th></tr>
6547 <tr style="color:red;">
6548 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6549 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6550 </td></tr>
6551 <tr>
6552 <td> data </td>
6553 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6554 </td></tr></table>
6555
6556 !! end
6557
6558 # The expected HTML structure in this test is debatable. The PHP parser does
6559 # not parse this kind of table at all. The main focus for Parsoid is on
6560 # round-tripping, so this output is ok for now. TODO: revisit!
6561 !! test
6562 Wikitext table with html-syntax row
6563 !! wikitext
6564 {|
6565 |-
6566 <td>foo</td>
6567 |}
6568 !! html/parsoid
6569 <table>
6570 <tbody>
6571 <tr>
6572 <td>foo</td></tr></tbody></table>
6573 !! end
6574
6575 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6576 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6577 ## PHP parser, which tidy then compounds by fostering the content
6578 ## entirely out of the table. Parsoid recognizes the table context
6579 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6580 ## depends on PHP's treatment of broken table markup!
6581 !! test
6582 Implicit <td> after a |-
6583 !! options
6584 parsoid=wt2html,html2html
6585 !! wikitext
6586 {|
6587 |-
6588 a
6589 |}
6590 !! html/php
6591 <table>
6592
6593 a
6594 </table>
6595
6596 !! html/php+tidy
6597 <p>a</p>
6598 !! html/parsoid
6599 <table>
6600 <tr><td>a</td></tr>
6601 </table>
6602 !! end
6603
6604 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6605 !! test
6606 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6607 !! options
6608 parsoid=wt2html,html2html
6609 !! wikitext
6610 {|
6611 |-
6612 |
6613 a
6614 |-
6615 b
6616 |}
6617 !! html/php
6618 <table>
6619
6620 <tr>
6621 <td>
6622 <pre>a
6623 </pre>
6624 </td></tr>
6625 b
6626 </table>
6627
6628 !! html/php+tidy
6629 <p>b</p>
6630 <table>
6631 <tr>
6632 <td>
6633 <pre>
6634 a
6635 </pre></td>
6636 </tr>
6637 </table>
6638 !! html/parsoid
6639 <table>
6640 <tbody>
6641 <tr><td><pre>a</pre></td></tr>
6642 <tr><td> b</td></tr>
6643 </tbody>
6644 </table>
6645 !! end
6646
6647 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6648 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6649 !! test
6650 Lists should be recognized in an implicit <td> context
6651 !! options
6652 parsoid=wt2html,html2html
6653 !! wikitext
6654 {|
6655 |-
6656 *a
6657 |}
6658 !! html/php
6659 <table>
6660
6661 <ul><li>a</li></ul>
6662 </table>
6663
6664 !! html/php+tidy
6665 <ul>
6666 <li>a</li>
6667 </ul>
6668 !! html/parsoid
6669 <table>
6670 <tr>
6671 <td><ul>
6672 <li>a</li>
6673 </ul></td>
6674 </tr>
6675 </table>
6676 !! end
6677
6678 !! test
6679 Table cells not properly parsed in an implicit-td context
6680 !! wikitext
6681 {|
6682 |-
6683 {{table_attribs_4}} || a || b
6684 |}
6685 !! html/php+tidy
6686 <table>
6687 <tr>
6688 <td style="background-color:#DC241f;" width="10px"></td>
6689 <td>a</td>
6690 <td>b</td>
6691 </tr>
6692 </table>
6693 !! html/parsoid
6694 <table>
6695 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6696 <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>
6697 </tbody></table>
6698 !! end
6699
6700 !! test
6701 Parsoid: Round-trip tables directly followed by content (bug 51219)
6702 !! options
6703 parsoid=wt2html,wt2wt
6704 !! wikitext
6705 {|
6706 |foo
6707 |} bar
6708
6709 {|
6710 |baz
6711 |}<b>quux</b>
6712 !! html+tidy
6713 <table>
6714 <tr>
6715 <td>foo</td>
6716 </tr>
6717 </table>
6718 <p>bar</p>
6719 <table>
6720 <tr>
6721 <td>baz</td>
6722 </tr>
6723 </table>
6724 <p><b>quux</b></p>
6725 !! end
6726
6727 !! test
6728 Parsoid: Default to a newline after tables in new content (bug 51219)
6729 !! options
6730 parsoid=html2wt
6731 !! html/parsoid
6732 <table><tbody>
6733 <tr><td>foo</td></tr></tbody></table> bar
6734 <table><tbody>
6735 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6736 !! wikitext
6737 {|
6738 |foo
6739 |}
6740 <nowiki> </nowiki>bar
6741 {|
6742 |baz
6743 |}
6744 '''quux'''
6745 !! end
6746
6747 !! test
6748 Parsoid: newline inducing block nodes don't suppress <nowiki>
6749 !! options
6750 parsoid=html2wt
6751 !! html/parsoid
6752 a<h1>foo</h1>
6753 !! wikitext
6754 <nowiki> </nowiki>a
6755
6756 = foo =
6757 !! end
6758
6759 !! test
6760 Parsoid: Row-syntax table headings followed by comment & table cells
6761 !! options
6762 parsoid=wt2html,wt2wt
6763 !! wikitext
6764 {|
6765 ! foo || bar
6766 <!-- foo --> || baz || quux
6767 |}
6768 !! html/php
6769 <table>
6770 <tr>
6771 <th> foo </th>
6772 <th> bar
6773 </th>
6774 <td> baz </td>
6775 <td> quux
6776 </td></tr></table>
6777
6778 !! html/parsoid
6779 <table>
6780 <tbody><tr><th> foo </th><th> bar
6781 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
6782 </tbody></table>
6783 !! end
6784
6785
6786 # PHP throws away the (semi-broken) "foo" class here; Parsoid
6787 # preserves it.
6788 !!test
6789 Parsoid: Recover better from broken table attributes
6790 !!options
6791 parsoid=wt2html
6792 !!wikitext
6793 {| class="foo
6794 | class="bar" |
6795 foo
6796 |}
6797 !!html/php+tidy
6798 <table>
6799 <tr>
6800 <td class="bar">
6801 <p>foo</p>
6802 </td>
6803 </tr>
6804 </table>
6805 !!html/parsoid
6806 <table class="foo">
6807 <tr>
6808 <td class="bar">
6809 <p>foo</p></td></tr>
6810 </tbody></table>
6811 !!end
6812
6813 !! test
6814 Strip unsupported table tags
6815 !! options
6816 parsoid=html2wt
6817 !! html/parsoid
6818 <table>
6819 <thead>
6820 <tr>
6821 <th>Month</th>
6822 <th>Savings</th>
6823 </tr>
6824 </thead>
6825 <tbody>
6826 <tr>
6827 <td>January</td>
6828 <td>$100</td>
6829 </tr>
6830 <tr>
6831 <td>February</td>
6832 <td>$80</td>
6833 </tr>
6834 </tbody>
6835 <tfoot>
6836 <tr>
6837 <td>Sum</td>
6838 <td>$180</td>
6839 </tr>
6840 </tfoot>
6841 </table>
6842 !! wikitext
6843 {|
6844
6845 !Month
6846 !Savings
6847
6848 |January
6849 |$100
6850
6851 |-
6852 |February
6853 |$80
6854
6855 |Sum
6856 |$180
6857
6858 |}
6859 !! end
6860
6861 !!test
6862 Testing serialization after deletion of table cells
6863 !!options
6864 parsoid={
6865 "modes": ["wt2wt", "selser"],
6866 "changes": [
6867 ["#x", "remove"]
6868 ]
6869 }
6870 !!wikitext
6871 {|
6872 !h1 !!h2 !!h3
6873 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
6874 |}
6875 !! wikitext/edited
6876 {|
6877 !h1 !!h2 !!h3
6878 |c2 |||c3
6879 |}
6880 !!end
6881
6882 ###
6883 ### Internal links
6884 ###
6885 !! test
6886 Plain link, capitalized
6887 !! wikitext
6888 [[Main Page]]
6889 !! html
6890 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6891 </p>
6892 !! end
6893
6894 !! test
6895 Plain link, uncapitalized
6896 !! wikitext
6897 [[main Page]]
6898 !! html
6899 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
6900 </p>
6901 !! end
6902
6903 !! test
6904 Piped link
6905 !! wikitext
6906 [[Main Page|The Main Page]]
6907 !! html
6908 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6909 </p>
6910 !! end
6911
6912 !! test
6913 Piped link with comment in link text
6914 !! wikitext
6915 [[Main Page|The Main<!--front--> Page]]
6916 !! html
6917 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6918 </p>
6919 !! end
6920
6921 !! test
6922 Piped link with multiple pipe characters in link text
6923 !! wikitext
6924 [[Main Page||The|Main|Page|]]
6925 !! html/php
6926 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
6927 </p>
6928 !! html/parsoid
6929 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
6930 !! end
6931
6932 !! test
6933 Broken link
6934 !! wikitext
6935 [[Zigzagzogzagzig]]
6936 !! html
6937 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
6938 </p>
6939 !! end
6940
6941 !! test
6942 Broken link with fragment
6943 !! wikitext
6944 [[Zigzagzogzagzig#zug]]
6945 !! html
6946 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
6947 </p>
6948 !! end
6949
6950 !! test
6951 Special page link with fragment
6952 !! wikitext
6953 [[Special:Version#anchor]]
6954 !! html
6955 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
6956 </p>
6957 !! end
6958
6959 !! test
6960 Nonexistent special page link with fragment
6961 !! wikitext
6962 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
6963 !! html
6964 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
6965 </p>
6966 !! end
6967
6968 !! test
6969 Link with prefix
6970 !! wikitext
6971 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
6972 !! html
6973 <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>
6974 </p>
6975 !! end
6976
6977 !! test
6978 Link with suffix
6979 !! wikitext
6980 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
6981 !! html
6982 <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>!!!
6983 </p>
6984 !! end
6985
6986 !! article
6987 prefixed article
6988 !! text
6989 Some text
6990 !! endarticle
6991
6992 !! test
6993 Bug 43661: Piped links with identical prefixes
6994 !! wikitext
6995 [[prefixed article|prefixed articles with spaces]]
6996
6997 [[prefixed article|prefixed articlesaoeu]]
6998
6999 [[Main Page|Main Page test]]
7000 !! html
7001 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7002 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7003 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7004 </p>
7005 !! end
7006
7007
7008 !! test
7009 Link with HTML entity in suffix / tail
7010 !! wikitext
7011 [[Main Page]]&quot;, [[Main Page]]&#97;
7012 !! html/php
7013 <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;
7014 </p>
7015 !! html/parsoid
7016 <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>
7017 !! end
7018
7019 !! test
7020 Link with 3 brackets
7021 !! wikitext
7022 [[[Main Page]]]
7023 !! html
7024 <p>[[[Main Page]]]
7025 </p>
7026 !! end
7027
7028 !! test
7029 Link with 4 brackets
7030 !! wikitext
7031 [[[[Main Page]]]]
7032 !! html
7033 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7034 </p>
7035 !! end
7036
7037 !! test
7038 Piped link with 3 brackets
7039 !! wikitext
7040 [[[main page|the main page]]]
7041 !! html
7042 <p>[[[main page|the main page]]]
7043 </p>
7044 !! end
7045
7046 !! test
7047 Piped link with extlink-like text
7048 !! wikitext
7049 [[Main Page|[bar]]]
7050 [[Main Page|This is a [bar]]]
7051 !! html/php
7052 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7053 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7054 </p>
7055 !! html/parsoid
7056 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7057 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7058 !! end
7059
7060 !! test
7061 Link with multiple pipes
7062 !! wikitext
7063 [[Main Page|The|Main|Page]]
7064 !! html
7065 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7066 </p>
7067 !! end
7068
7069 # Note that parsoid does not munge anchor text; all non-space
7070 # characters are valid in HTML5 ids.
7071 !! test
7072 Anchor containing a #. (bug 63430)
7073 !! wikitext
7074 [[Main Page#And#Link]]
7075 !! html/php
7076 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7077 </p>
7078 !! html/parsoid
7079 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
7080 !! end
7081
7082 !! test
7083 Link to namespaces
7084 !! wikitext
7085 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7086 !! html
7087 <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>
7088 </p>
7089 !! end
7090
7091 !! test
7092 Link with space in namespace
7093 !! wikitext
7094 [[User talk:Foo bar]]
7095 !! html
7096 <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>
7097 </p>
7098 !! end
7099
7100 !! article
7101 MemoryAlpha:AlphaTest
7102 !! text
7103 This is an article in the MemoryAlpha namespace
7104 (which shadows the memoryalpha interwiki link).
7105 !! endarticle
7106
7107 !! test
7108 Namespace takes precedence over interwiki link (bug 51680)
7109 !! wikitext
7110 [[MemoryAlpha:AlphaTest]]
7111 !! html
7112 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7113 </p>
7114 !! end
7115
7116 # The previous test doesn't work correctly in html2*, due to not recognizing the
7117 # link as an internal one. This one checks for the correct behavior.
7118 !! test
7119 Link to namespace preferred over interwiki with correct rel attribute
7120 !! options
7121 parsoid=html2wt,html2html
7122 !! html/parsoid
7123 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7124 !! wikitext
7125 [[MemoryAlpha:AlphaTest]]
7126 !! end
7127
7128 !! test
7129 Piped link to namespace
7130 !! wikitext
7131 [[Meta:Disclaimers|The disclaimers]]
7132 !! html
7133 <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>
7134 </p>
7135 !! end
7136
7137 !! test
7138 Link containing }
7139 !! wikitext
7140 [[Usually caused by a typo (oops}]]
7141 !! html
7142 <p>[[Usually caused by a typo (oops}]]
7143 </p>
7144 !! end
7145
7146 !! article
7147 7% Solution
7148 !! text
7149 Just a test of an article title containing a percent.
7150 !! endarticle
7151
7152 !! test
7153 Link containing % (not as a hex sequence)
7154 !! wikitext
7155 [[7% Solution]]
7156 !! html/php
7157 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7158 </p>
7159 !! html/parsoid
7160 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7161 !! end
7162
7163 # note that the parsoid HTML is identical to the previous test output,
7164 # so the previous test ensures that the html2wt mode will generate the
7165 # "not as a hex sequence" wikitext.
7166 !! test
7167 Link containing % as a single hex sequence interpreted to char
7168 !! options
7169 parsoid=wt2wt,wt2html,html2html
7170 !! wikitext
7171 [[7%25 Solution]]
7172 !! html/php
7173 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7174 </p>
7175 !! html/parsoid
7176 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7177 !!end
7178
7179 !! test
7180 Link containing % as a double hex sequence interpreted to hex sequence
7181 !! wikitext
7182 [[7%2525 Solution]]
7183 !! html
7184 <p>[[7%2525 Solution]]
7185 </p>
7186 !!end
7187
7188 # note that parsoid does not munge anchor text; all non-space
7189 # characters are valid in HTML5 anchors.
7190 !! test
7191 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7192 Example for such a section: == < ==
7193 !! wikitext
7194 [[%23%3c]][[%23%3e]]
7195 !! html/php
7196 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7197 </p>
7198 !! html/parsoid
7199 <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>
7200 !! end
7201
7202 !! test
7203 Link containing "<#" and ">#" as a hex sequences
7204 !! wikitext
7205 [[%3c%23]][[%3e%23]]
7206 !! html
7207 <p>[[%3c%23]][[%3e%23]]
7208 </p>
7209 !! end
7210
7211 !! test
7212 Link containing an equals sign
7213 !! wikitext
7214 [[Special:BookSources/isbn=4-00-026157-6]]
7215 !! html/php
7216 <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>
7217 </p>
7218 !! html/parsoid
7219 <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>
7220 !! end
7221
7222 !! article
7223 Foo~bar
7224 !! text
7225 Just a test of an article title containing a tilde.
7226 !! endarticle
7227
7228 # note that links containing signatures, like [[Foo~~~~]], are
7229 # massaged by the pre-save transform (PST) and so the tildes are never
7230 # seen by the parser.
7231 !! test
7232 Link containing a tilde
7233 !! wikitext
7234 [[Foo~bar]]
7235 !! html/php
7236 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7237 </p>
7238 !! html/parsoid
7239 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7240 !! end
7241
7242 !! test
7243 Link containing double-single-quotes '' (bug 4598)
7244 !! wikitext
7245 [[Lista d''e paise d''o munno]]
7246 !! html/php
7247 <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>
7248 </p>
7249 !! html/parsoid
7250 <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>
7251 !! end
7252
7253 !! test
7254 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7255 !! wikitext
7256 Some [[Link|pretty ''italics'' and stuff]]!
7257 !! html/php
7258 <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>!
7259 </p>
7260 !! html/parsoid
7261 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7262 !! end
7263
7264 !! test
7265 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7266 !! wikitext
7267 ''Some [[Link|pretty ''italics'' and stuff]]!''
7268 !! html
7269 <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>
7270 </p>
7271 !! end
7272
7273 !! test
7274 Link with double quotes in title part (literal) and alternate part (interpreted)
7275 !! wikitext
7276 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7277
7278 [[''Pentecoste'']]
7279
7280 [[''Pentecoste''|Pentecoste]]
7281
7282 [[''Pentecoste''|''Pentecoste'']]
7283 !! html/php
7284 <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>
7285 </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>
7286 </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>
7287 </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>
7288 </p>
7289 !! html/parsoid
7290 <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>
7291 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7292 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7293 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7294 !! end
7295
7296 !! test
7297 Broken image links with HTML captions (bug 39700)
7298 !! wikitext
7299 [[File:Nonexistent|<script></script>]]
7300 [[File:Nonexistent|100x100px|<script></script>]]
7301 [[File:Nonexistent|&lt;]]
7302 [[File:Nonexistent|a<i>b</i>c]]
7303 !! html/php
7304 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7305 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7306 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7307 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7308 </p>
7309 !! html/parsoid
7310 <p><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;script&amp;gt;&amp;lt;/script&amp;gt;"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span>
7311 <span typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;script&amp;gt;&amp;lt;/script&amp;gt;"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="100" width="100"/></a></span>
7312 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=\"{&amp;quot;src&amp;quot;:&amp;quot;&amp;amp;lt;&amp;quot;,&amp;quot;srcContent&amp;quot;:&amp;quot;&lt;&amp;quot;,&amp;quot;dsr&amp;quot;:[107,111,null,null]}\">&amp;lt;&lt;/span>"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span>
7313 <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 data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[134,142,3,4]}\">b&lt;/i>c"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span></p>
7314 !! end
7315
7316 !! test
7317 Plain link to URL
7318 !! wikitext
7319 [[http://www.example.com]]
7320 !! html/php
7321 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7322 </p>
7323 !! html/parsoid
7324 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7325 !! end
7326
7327 !! test
7328 Plain link to URL with link text
7329 !! wikitext
7330 [[http://www.example.com Link text]]
7331 !! html
7332 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7333 </p>
7334 !! end
7335
7336 !! test
7337 Plain link to protocol-relative URL
7338 !! wikitext
7339 [[//www.example.com]]
7340 !! html/php
7341 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7342 </p>
7343 !! html/parsoid
7344 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7345 !! end
7346
7347 !! test
7348 Plain link to protocol-relative URL with link text
7349 !! wikitext
7350 [[//www.example.com Link text]]
7351 !! html
7352 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7353 </p>
7354 !! end
7355
7356 !! test
7357 Plain link to page with question mark in title
7358 !! wikitext
7359 [[A?b]]
7360
7361 [[A?b|Baz]]
7362 !! html
7363 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7364 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7365 </p>
7366 !! end
7367
7368
7369 # I'm fairly sure the expected result here is wrong.
7370 # We want these to be URL links, not pseudo-pages with URLs for titles....
7371 # However the current output is also pretty screwy.
7372 #
7373 # ----
7374 # I'm changing it to match the current output--it arguably makes more
7375 # sense in the light of the test above. Old expected result was:
7376 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7377 #</p>
7378 # But I think this test is bordering on "garbage in, garbage out" anyway.
7379 # -- wtm
7380 !! test
7381 Piped link to URL
7382 !! wikitext
7383 Piped link to URL: [[http://www.example.com|an example URL]]
7384 !! html/php
7385 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7386 </p>
7387 !! html/parsoid
7388 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7389 !! end
7390
7391 !! test
7392 BUG 2: [[page|http://url/]] should link to page, not http://url/
7393 !! wikitext
7394 [[Main Page|http://url/]]
7395 !! html/php
7396 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7397 </p>
7398 !! html/parsoid
7399 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7400 !! end
7401
7402 # Parsoid does not mark self-links, by design.
7403 !! test
7404 BUG 337: Escaped self-links should be bold
7405 !! options
7406 title=[[Bug462]]
7407 !! wikitext
7408 [[Bu&#103;462]] [[Bug462]]
7409 !! html/php
7410 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7411 </p>
7412 !! html/php+tidy
7413 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7414 !! html/parsoid
7415 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7416 !! end
7417
7418 !! test
7419 Self-link to section should not be bold
7420 !! options
7421 title=[[Main Page]]
7422 !! wikitext
7423 [[Main Page#section]]
7424 !! html
7425 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7426 </p>
7427 !! end
7428
7429 !! article
7430 00
7431 !! text
7432 This is 00.
7433 !! endarticle
7434
7435 !!test
7436 Self-link to numeric title
7437 !!options
7438 title=[[0]]
7439 !! wikitext
7440 [[0]]
7441 !! html
7442 <p><strong class="selflink">0</strong>
7443 </p>
7444 !!end
7445
7446 !!test
7447 Link to numeric-equivalent title
7448 !!options
7449 title=[[0]]
7450 !! wikitext
7451 [[00]]
7452 !! html
7453 <p><a href="/wiki/00" title="00">00</a>
7454 </p>
7455 !!end
7456
7457 !! test
7458 <nowiki> inside a link
7459 !! wikitext
7460 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7461 !! html
7462 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7463 </p>
7464 !! end
7465
7466 !! test
7467 Non-breaking spaces in title
7468 !! wikitext
7469 [[&nbsp; Main &nbsp; Page &nbsp;]]
7470 !! html
7471 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7472 </p>
7473 !!end
7474
7475 !! test
7476 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7477 !! options
7478 language=ca
7479 !! wikitext
7480 '''[[Main Page]]'''
7481 !! html
7482 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7483 </p>
7484 !! end
7485
7486 !! test
7487 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7488 !! options
7489 language=ca
7490 !! wikitext
7491 ''[[Main Page]]''
7492 !! html
7493 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7494 </p>
7495 !! end
7496
7497 !! test
7498 Internal link with en linktrail: no apostrophes (bug 27473)
7499 !! options
7500 language=en
7501 !! wikitext
7502 [[Something]]'nice
7503 !! html
7504 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
7505 </p>
7506 !! end
7507
7508 !! test
7509 Internal link with ca linktrail with apostrophes (bug 27473)
7510 !! options
7511 language=ca
7512 !! wikitext
7513 [[Something]]'nice
7514 !! html
7515 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
7516 </p>
7517 !! end
7518
7519 !! test
7520 Internal link with kaa linktrail with apostrophes (bug 27473)
7521 !! options
7522 language=kaa
7523 !! wikitext
7524 [[Something]]'nice
7525 !! html
7526 <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>
7527 </p>
7528 !! end
7529
7530 !! test
7531 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
7532 !! wikitext
7533 [[User:Foo/Test/63636:Bar|Test]]
7534 !! html/php
7535 <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>
7536 </p>
7537 !! html/parsoid
7538 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
7539 !! end
7540
7541 !! test
7542 Purely hash wikilink
7543 !! options
7544 title=[[User:test/123]]
7545 !! wikitext
7546 [[#a|b]]
7547 !! html/php
7548 <p><a href="#a">b</a>
7549 </p>
7550 !! html/parsoid
7551 <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>
7552 !! end
7553
7554 !! test
7555 1. Interaction of linktrail and template encapsulation
7556 !! options
7557 parsoid
7558 !! wikitext
7559 {{echo|[[Foo]]}}l
7560 !! html
7561 <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>
7562 !! end
7563
7564 !! test
7565 2. Interaction of linktrail and template encapsulation
7566 !! options
7567 parsoid
7568 !! wikitext
7569 {{echo|Some [[Fool]]}}s
7570 !! html
7571 <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>
7572 !! end
7573
7574 !! test
7575 3. Interaction of linktrail and template encapsulation
7576 !! options
7577 parsoid
7578 !! wikitext
7579 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
7580 !! html
7581 <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>
7582 !! end
7583
7584 !! article
7585 Söfnuður
7586 !! text
7587 Test.
7588 !! endarticle
7589
7590 !! test
7591 Internal link with is link prefix
7592 !! options
7593 language=is
7594 !! wikitext
7595 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
7596 !! html
7597 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
7598 </p>
7599 !! end
7600
7601 !! article
7602 Mótmælendatrú
7603 !! text
7604 Test.
7605 !! endarticle
7606
7607 !! test
7608 Internal link with is link trail and link prefix
7609 !! options
7610 language=is
7611 !! wikitext
7612 [[mótmælendatrú|xxx]]ar
7613 [[mótmælendatrú]]ar
7614 mótmælenda[[söfnuður]]
7615 mótmælenda[[söfnuður|söfnuðir]]
7616 mótmælenda[[söfnuður|söfnuðir]]xxx
7617 !! html
7618 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
7619 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
7620 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
7621 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
7622 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
7623 </p>
7624 !! end
7625
7626 !! test
7627 Parsoid link trail escaping
7628 !! options
7629 parsoid=html2wt,html2html
7630 !! html/parsoid
7631 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
7632 !! wikitext
7633 [[apple]]<nowiki/>s
7634 !! end
7635
7636 !! test
7637 Parsoid link prefix escaping
7638 !! options
7639 language=is
7640 parsoid=html2wt,html2html
7641 !! html/parsoid
7642 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
7643 !! wikitext
7644 Aðrir mótmælenda<nowiki/>[[söfnuður]]
7645 !! end
7646
7647 !! test
7648 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
7649 !! wikitext
7650 [[Foo| bar]]
7651
7652 [[Foo| ''bar'']]
7653
7654 [http://wp.org foo]
7655
7656 [http://wp.org ''foo'']
7657 !! html
7658 <p><a href="/wiki/Foo" title="Foo"> bar</a>
7659 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
7660 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
7661 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
7662 </p>
7663 !! end
7664
7665 !! test
7666 Parsoid: Scoped parsing should handle mixed transclusions and plain text
7667 !! options
7668 parsoid
7669 !! wikitext
7670 [[Foo|{{echo|a}} b {{echo|c}}]]
7671 !! html
7672 <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>
7673 !! end
7674
7675 !! test
7676 Link with angle bracket after anchor
7677 !! wikitext
7678 [[Foo#<bar>]]
7679 !! html/php
7680 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
7681 </p>
7682 !! html/parsoid
7683 <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>
7684 !! end
7685
7686 ###
7687 ### Interwiki links (see maintenance/interwiki.sql)
7688 ###
7689
7690 !! test
7691 Inline interwiki link
7692 !! options
7693 parsoid=wt2html,wt2wt,html2html
7694 !! wikitext
7695 [[MeatBall:SoftSecurity]]
7696 !! html/php
7697 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
7698 </p>
7699 !! html/parsoid
7700 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
7701 !! end
7702
7703 !! test
7704 Inline interwiki link with empty title (bug 2372)
7705 !! options
7706 parsoid=wt2html,wt2wt,html2html
7707 !! wikitext
7708 [[MeatBall:]]
7709 !! html/php
7710 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
7711 </p>
7712 !! html/parsoid
7713 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
7714 !! end
7715
7716 !! test
7717 Interwiki link encoding conversion (bug 1636)
7718 !! wikitext
7719 *[[Wikipedia:ro:Olteni&#0355;a]]
7720 *[[Wikipedia:ro:Olteni&#355;a]]
7721 !! html
7722 <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>
7723 <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>
7724
7725 !! html+tidy
7726 <ul>
7727 <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>
7728 <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>
7729 </ul>
7730 !! end
7731
7732 !! test
7733 Interwiki link with fragment (bug 2130)
7734 !! wikitext
7735 [[MeatBall:SoftSecurity#foo]]
7736 !! html
7737 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
7738 </p>
7739 !! end
7740
7741 # Ideally the wikipedia: prefix here should be proto-relative too
7742 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
7743 # define the 'en' prefix, and originally the test used 'wikipedia',
7744 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
7745 # article.
7746 !! test
7747 Different interwiki prefixes mapping to the same URL
7748 !! wikitext
7749 [[:en:Foo]]
7750
7751 [[:en:Foo|Foo]]
7752
7753 [[wikipedia:Foo]]
7754
7755 [[:wikipedia:Foo|Foo]]
7756
7757 [[wikipedia:en:Foo]]
7758
7759 [[:wikipedia:en:Foo]]
7760
7761 [[ wikiPEdia :Foo]]
7762 !! html/parsoid
7763 <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>
7764
7765 <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>
7766
7767 <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>
7768
7769 <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>
7770
7771 <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>
7772
7773 <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>
7774
7775 <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>
7776 !! end
7777
7778 !! test
7779 Interwiki links that cannot be represented in wiki syntax
7780 !! wikitext
7781 [[meatball:ok]]
7782 [[meatball:ok#foo|ok with fragment]]
7783 [[meatball:ok_as_well?|ok ending with ? mark]]
7784 [http://de.wikipedia.org/wiki/Foo?action=history has query]
7785 [http://de.wikipedia.org/wiki/#foo is just fragment]
7786
7787 !! html/php
7788 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
7789 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
7790 <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>
7791 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7792 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
7793 </p>
7794 !! html/parsoid
7795 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
7796 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
7797 <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>
7798 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7799 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
7800 !! end
7801
7802 !! test
7803 Interwiki links: trail
7804 !! wikitext
7805 [[wikipedia:Foo|Ba]]r
7806 !! html/php
7807 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
7808 </p>
7809 !! html/parsoid
7810 <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>
7811 !! end
7812
7813 !! test
7814 Local interwiki link
7815 !! options
7816 parsoid=wt2html,wt2wt,html2html
7817 !! wikitext
7818 [[local:Template:Foo]]
7819 !! html/php
7820 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
7821 </p>
7822 !! html/parsoid
7823 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
7824 !! end
7825
7826 # Parsoid does not mark self-links, by design.
7827 !! test
7828 Local interwiki link: self-link to current page
7829 !! options
7830 title=[[Main Page]]
7831 parsoid=wt2html,wt2wt,html2html
7832 !! wikitext
7833 [[local:Main Page]]
7834 !! html/php
7835 <p><strong class="selflink">local:Main Page</strong>
7836 </p>
7837 !! html/parsoid
7838 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
7839 !! end
7840
7841 !! test
7842 Local interwiki link: prefix only (bug 64167)
7843 !! options
7844 parsoid=wt2html,wt2wt,html2html
7845 !! wikitext
7846 [[local:]]
7847 !! html/php
7848 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
7849 </p>
7850 !! html/parsoid
7851 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
7852 !! end
7853
7854 !! test
7855 Local interwiki link: with additional interwiki prefix (bug 61357)
7856 !! options
7857 parsoid=wt2html,wt2wt,html2html
7858 !! wikitext
7859 [[local:meatball:Hello]]
7860 !! html/php
7861 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
7862 </p>
7863 !! html/parsoid
7864 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
7865 !! end
7866
7867 !! test
7868 Multiple local interwiki link prefixes
7869 !! wikitext
7870 [[local:local:local:local:mi:local:Foo]]
7871 !! options
7872 parsoid=wt2html,wt2wt,html2html
7873 !! html/php
7874 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
7875 </p>
7876 !! html/parsoid
7877 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
7878 !! end
7879
7880 ###
7881 ### Interlanguage links
7882 ### Language links (so that searching for '### language' matches..)
7883 ###
7884
7885 !! test
7886 Interlanguage link
7887 !! options
7888 parsoid=wt2html,wt2wt,html2html
7889 !! wikitext
7890 Blah blah blah
7891 [[zh:Chinese]]
7892 !! html/php
7893 <p>Blah blah blah
7894 </p>
7895 !! html/parsoid
7896 <p>Blah blah blah</p>
7897 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7898 !! end
7899
7900 !! test
7901 Interlanguage link with spacing
7902 !! options
7903 parsoid=wt2html,wt2wt,html2html
7904 !! wikitext
7905 Blah blah blah
7906 [[ zh : Chinese ]]
7907 !! html/php
7908 <p>Blah blah blah
7909 </p>
7910 !! html/parsoid
7911 <p>Blah blah blah</p>
7912 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7913 !! end
7914
7915 !! test
7916 Double interlanguage link
7917 !! options
7918 parsoid=wt2html,wt2wt,html2html
7919 !! wikitext
7920 Blah blah blah
7921 [[es:Spanish]]
7922 [[zh:Chinese]]
7923 !! html/php
7924 <p>Blah blah blah
7925 </p>
7926 !! html/parsoid
7927 <p>Blah blah blah</p>
7928 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7929 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7930 !! end
7931
7932 !! test
7933 Interlanguage link variations
7934 !! options
7935 parsoid=wt2html,wt2wt,html2html
7936 !! wikitext
7937 Blah blah blah
7938 [[ es :Spanish]]
7939 [[ ZH :Chinese]]
7940 [[es:Foo_bar]]
7941 !! html/php
7942 <p>Blah blah blah
7943 </p>
7944 !! html/parsoid
7945 <p>Blah blah blah</p>
7946 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
7947 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
7948 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
7949 !! end
7950
7951 !! test
7952 Space and question mark encoding in interlanguage links (T95473)
7953 !! options
7954 parsoid=wt2html,wt2wt,html2html
7955 !! wikitext
7956 Blah blah blah
7957 [[es:Foo bar?]]
7958 !! html/php
7959 <p>Blah blah blah
7960 </p>
7961 !! html/parsoid
7962 <p>Blah blah blah</p>
7963 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
7964 !! end
7965
7966 !! test
7967 Interlanguage link, with prefix links
7968 !! options
7969 language=ln
7970 !! wikitext
7971 Blah blah blah
7972 [[zh:Chinese]]
7973 !! html/php
7974 <p>Blah blah blah
7975 </p>
7976 !! html/parsoid
7977 <p>Blah blah blah</p>
7978 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7979 !! end
7980
7981 !! test
7982 Double interlanguage link, with prefix links (bug 8897)
7983 !! options
7984 language=ln
7985 !! wikitext
7986 Blah blah blah
7987 [[es:Spanish]]
7988 [[zh:Chinese]]
7989 !! html/php
7990 <p>Blah blah blah
7991 </p>
7992 !! html/parsoid
7993 <p>Blah blah blah</p>
7994 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
7995 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7996 !! end
7997
7998 !! test
7999 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8000 !! wikitext
8001 Blah blah blah
8002 [[mul:Article]]
8003 !! html/php
8004 <p>Blah blah blah
8005 </p>
8006 !! html/parsoid
8007 <p>Blah blah blah</p>
8008 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8009 !! end
8010
8011 !! test
8012 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8013 !! options
8014 language=ln
8015 !! wikitext
8016 [[WW&nbsp;II]]
8017 !! html
8018 <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>
8019 </p>
8020 !! end
8021
8022 !! test
8023 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8024 !! options
8025 parsoid=html2wt
8026 !! html/parsoid
8027 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8028 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8029 !! wikitext
8030 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8031
8032 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
8033 !! end
8034
8035 !! test
8036 Parsoid: handle constructor well
8037 !! wikitext
8038 [[constructor]]
8039
8040 [[constructor:foo]]
8041 !! html/php
8042 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8043 </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>
8044 </p>
8045 !! html/parsoid
8046 <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>
8047
8048 <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>
8049 !! end
8050
8051 !! article
8052 ko:
8053 !! text
8054 Test.
8055 !! endarticle
8056
8057 # Note that `ko` isn't a known interlanguage prefix
8058 !! test
8059 Parsoid: recognize interlanguage links without a target page
8060 !! options
8061 ill
8062 !! wikitext
8063 [[es:]]
8064
8065 [[ko:]]
8066 !! html/php
8067 es:
8068 !! html/parsoid
8069 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8070
8071 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8072 !! end
8073
8074 # Note that `ko` isn't a known interwiki prefix
8075 !! test
8076 Parsoid: recognize interwiki links without a target page
8077 !! options
8078 parsoid=wt2html,wt2wt,html2html
8079 !! wikitext
8080 [[:es:]]
8081
8082 [[:ko:]]
8083 !! html/php
8084 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8085 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8086 </p>
8087 !! html/parsoid
8088 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8089 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8090 !! end
8091
8092 !! test
8093 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8094 !! wikitext
8095 [[mi:Foo]]
8096 !! html/php
8097 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8098 </p>
8099 !! html/parsoid
8100 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8101 !! end
8102
8103 !! test
8104 Interlanguage link with preceding local interwiki link (bug 68085)
8105 !! options
8106 parsoid=wt2html,wt2wt,html2html
8107 !! wikitext
8108 Blah blah blah
8109 [[local:es:Spanish]]
8110 !! html/php
8111 <p>Blah blah blah
8112 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8113 </p>
8114 !! html/parsoid
8115 <p>Blah blah blah
8116 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8117 !! end
8118
8119 !! test
8120 Looks like an interlanguage link, but is actually a local interwiki
8121 !! options
8122 parsoid=wt2html,wt2wt,html2html
8123 !! wikitext
8124 Blah blah blah
8125 [[mi:Template:Foo]]
8126 !! html/php
8127 <p>Blah blah blah
8128 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8129 </p>
8130 !! html/parsoid
8131 <p>Blah blah blah
8132 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8133 !! end
8134
8135 ###
8136 ### Redirects, Parsoid-only
8137 ###
8138
8139 !! test
8140 1. Simple redirect to page
8141 !! wikitext
8142 #REDIRECT [[Main Page]]
8143 !! html/parsoid
8144 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8145 !! end
8146
8147 !! test
8148 2. Other redirect variants
8149 !! wikitext
8150 #REDIRECT [[Main_Page]]
8151 !! html/parsoid
8152 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8153 !! end
8154
8155 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8156 # This tests the Parsoid bail-out code.
8157 !! test
8158 3. Other redirect variants
8159 !! wikitext
8160 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8161 !! html/parsoid
8162 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8163 !! end
8164
8165 !! test
8166 4. Redirect to a templated destination
8167 !! wikitext
8168 #REDIRECT [[{{echo|Foo}}bar]]
8169 !! html/parsoid
8170 <link typeof="mw:ExpandedAttrs" rel="mw:PageProp/redirect" href="./Foobar" data-mw='{"attribs":[[{"txt":"href"},{"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;:[12,24,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;Foo&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">Foo&lt;/span>bar"}]]}'/>
8171 !! end
8172
8173 !! test
8174 Empty redirect
8175 !! options
8176 parsoid=wt2html,wt2wt
8177 !! wikitext
8178 #REDIRECT [[]]
8179 !! html/parsoid
8180 <ol>
8181 <li>REDIRECT [[]]</li></ol>
8182 !! end
8183
8184 !! test
8185 Optional colon in #REDIRECT
8186 !! options
8187 # the colon is archaic syntax. we support it for wt2html, but we
8188 # don't care that it roundtrips back to the modern syntax.
8189 parsoid=wt2html,html2html
8190 !! wikitext
8191 #REDIRECT:[[Main Page]]
8192 !! html/parsoid
8193 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8194 !! end
8195
8196 !! test
8197 Whitespace in #REDIRECT with optional colon
8198 !! options
8199 # the colon and gratuitous whitespace is archaic syntax. we support
8200 # it for wt2html, but we don't care that it roundtrips back to the
8201 # modern syntax (without extra whitespace)
8202 parsoid=wt2html,html2html
8203 !! wikitext
8204
8205 #REDIRECT
8206 :
8207 [[Main Page]]
8208 !! html/parsoid
8209 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8210 !! end
8211
8212 !! test
8213 Piped link in #REDIRECT
8214 !! options
8215 # content after piped link is ignored. we support this syntax,
8216 # but don't care that the piped link is lost when we roundtrip this.
8217 parsoid=wt2html
8218 !! wikitext
8219 #REDIRECT [[Main Page|bar]]
8220 !! html/parsoid
8221 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8222 !! end
8223
8224 !! test
8225 Redirect to category (T104502)
8226 !! options
8227 parsoid=wt2html,wt2wt
8228 !! wikitext
8229 #REDIRECT [[Category:Foo]]
8230 !! html/parsoid
8231 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8232 !! end
8233
8234 !! test
8235 Redirect to category with URL encoding (T104502)
8236 !! options
8237 parsoid=wt2html
8238 !! wikitext
8239 #REDIRECT [[Category%3AFoo]]
8240 !! html/parsoid
8241 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8242 !! end
8243
8244 !! test
8245 Redirect to category page
8246 !! wikitext
8247 #REDIRECT [[:Category:Foo]]
8248 !! html/parsoid
8249 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8250 !! end
8251
8252 !! test
8253 Redirect to image page (1)
8254 !! wikitext
8255 #REDIRECT [[File:Wiki.png]]
8256 !! html/parsoid
8257 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8258 !! end
8259
8260 !! test
8261 Redirect to image page (2)
8262 !! wikitext
8263 #REDIRECT [[Image:Wiki.png]]
8264 !! html/parsoid
8265 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8266 !! end
8267
8268 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8269 # Next test confirms this.
8270 !! test
8271 Redirect to language (1) (T104918)
8272 !! options
8273 parsoid=wt2html,wt2wt,html2html
8274 !! wikitext
8275 #REDIRECT [[en:File:Wiki.png]]
8276 !! html/parsoid
8277 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8278 !! end
8279
8280 !! test
8281 Redirect to language (2) (T104918)
8282 !! wikitext
8283 #REDIRECT [[:en:File:Wiki.png]]
8284 !! html/parsoid
8285 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8286 !! end
8287
8288 !! test
8289 Redirect to interwiki (T104918)
8290 !! wikitext
8291 #REDIRECT [[meatball:File:Wiki.png]]
8292 !! html/parsoid
8293 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8294 !! end
8295
8296 !! test
8297 Non-English #REDIRECT
8298 !! options
8299 language=is
8300 !! wikitext
8301 #TILVÍSUN [[Main Page]]
8302 !! html/parsoid
8303 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8304 !! end
8305
8306 !! test
8307 Redirect syntax under text isn't considered a redirect
8308 !! wikitext
8309 some text
8310 #redirect [[Main Page]]
8311 !! html/parsoid
8312 <p>some text</p>
8313 <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>
8314 !! end
8315
8316 # FIXME: Should hoist the redirect to the top of the page and ensure there
8317 # is only one.
8318 !! test
8319 New redirect
8320 !! options
8321 parsoid=html2wt
8322 !! html/parsoid
8323 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8324 !! wikitext
8325 Foo
8326 #REDIRECT [[Foo]]
8327 !! end
8328
8329 ##
8330 ## XHTML tidiness
8331 ###
8332
8333 !! test
8334 <br> to <br />
8335 !! wikitext
8336 1<br>2<br />3
8337 !! html
8338 <p>1<br />2<br />3
8339 </p>
8340 !! end
8341
8342 !! test
8343 Broken br tag sanitization
8344 !! wikitext
8345 </br>
8346 !! html/php
8347 <p>&lt;/br&gt;
8348 </p>
8349 !! end
8350
8351 # TODO: Fix html2html mode (bug 51055)!
8352 !! test
8353 Parsoid: Broken br tag recognition
8354 !! options
8355 parsoid=wt2html
8356 !! wikitext
8357 </br>
8358
8359 <br/ >
8360 !! html+tidy
8361 <p><br /></p>
8362 <p><br /></p>
8363 !! end
8364
8365 !! test
8366 Incorrecly removing closing slashes from correctly formed XHTML
8367 !! wikitext
8368 <br style="clear:both;" />
8369 !! html
8370 <p><br style="clear:both;" />
8371 </p>
8372 !! end
8373
8374 !! test
8375 Failing to transform badly formed HTML into correct XHTML
8376 !! wikitext
8377 <br style="clear: left;">
8378 <br style="clear: right;">
8379 <br style="clear: both;">
8380 !! html
8381 <p><br style="clear: left;" />
8382 <br style="clear: right;" />
8383 <br style="clear: both;" />
8384 </p>
8385 !!end
8386
8387 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8388 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8389 !! test
8390 Handling html with a div self-closing tag
8391 !! wikitext
8392 <div title />
8393 <div title/>
8394 <div title/ >
8395 <div title=bar />
8396 <div title=bar/>
8397 <div title=bar/ >
8398 !! html/php
8399 <p>&lt;div title /&gt;
8400 &lt;div title/&gt;
8401 </p>
8402 <div>
8403 <p>&lt;div title=bar /&gt;
8404 &lt;div title=bar/&gt;
8405 </p>
8406 <div title="bar/"></div>
8407 </div>
8408
8409 !! html/parsoid
8410 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8411 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8412 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
8413 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8414 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8415 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
8416 !! end
8417
8418 !! test
8419 Handling html with a br self-closing tag
8420 !! wikitext
8421 <br title />
8422 <br title/>
8423 <br title/ >
8424 <br title=bar />
8425 <br title=bar/>
8426 <br title=bar/ >
8427 !! html/php
8428 <p><br title="" />
8429 <br title="" />
8430 <br />
8431 <br title="bar" />
8432 <br title="bar" />
8433 <br title="bar/" />
8434 </p>
8435 !! html/parsoid
8436 <p><br title="" />
8437 <br title="" />
8438 <br title="" />
8439 <br title="bar" />
8440 <br title="bar" />
8441 <br title="bar/" />
8442 </p>
8443 !! end
8444
8445 !! test
8446 Horizontal ruler (should it add that extra space?)
8447 !! wikitext
8448 <hr>
8449 <hr >
8450 foo <hr
8451 > bar
8452 !! html+tidy
8453 <hr />
8454 <hr />
8455 <p>foo</p>
8456 <hr />
8457 <p>bar</p>
8458 !! end
8459
8460 !! test
8461 Horizontal ruler -- 4+ dashes render hr
8462 !! wikitext
8463 ----
8464 !! html
8465 <hr />
8466
8467 !! end
8468
8469 !! test
8470 Horizontal ruler -- eats additional dashes on the same line
8471 !! wikitext
8472 ---------
8473 !! html
8474 <hr />
8475
8476 !! end
8477
8478 !! test
8479 Horizontal ruler -- does not collapse dashes on consecutive lines
8480 !! wikitext
8481 ----
8482 ----
8483 !! html
8484 <hr />
8485 <hr />
8486
8487 !! end
8488
8489 !! test
8490 Horizontal ruler -- <4 dashes render as plain text
8491 !! wikitext
8492 ---
8493 !! html
8494 <p>---
8495 </p>
8496 !! end
8497
8498 !! test
8499 Horizontal ruler -- Supports content following dashes on same line
8500 !! wikitext
8501 ---- Foo
8502 !! html
8503 <hr /> Foo
8504
8505 !! html+tidy
8506 <hr />
8507 <p>Foo</p>
8508 !! end
8509
8510 ###
8511 ### Block-level elements
8512 ###
8513 !! test
8514 Common list
8515 !! wikitext
8516 *Common list
8517 * item 2
8518 *item 3
8519 !! html
8520 <ul><li>Common list</li>
8521 <li> item 2</li>
8522 <li>item 3</li></ul>
8523
8524 !! end
8525
8526 !! test
8527 Numbered list
8528 !! wikitext
8529 #Numbered list
8530 #item 2
8531 # item 3
8532 !! html
8533 <ol><li>Numbered list</li>
8534 <li>item 2</li>
8535 <li> item 3</li></ol>
8536
8537 !! end
8538
8539 !! test
8540 Mixed list
8541 !! wikitext
8542 *Mixed list
8543 *# with numbers
8544 ** and bullets
8545 *# and numbers
8546 *bullets again
8547 **bullet level 2
8548 ***bullet level 3
8549 ***#Number on level 4
8550 **bullet level 2
8551 **#Number on level 3
8552 **#Number on level 3
8553 *#number level 2
8554 *Level 1
8555 *** Level 3
8556 #** Level 3, but ordered
8557 !! html
8558 <ul><li>Mixed list
8559 <ol><li> with numbers</li></ol>
8560 <ul><li> and bullets</li></ul>
8561 <ol><li> and numbers</li></ol></li>
8562 <li>bullets again
8563 <ul><li>bullet level 2
8564 <ul><li>bullet level 3
8565 <ol><li>Number on level 4</li></ol></li></ul></li>
8566 <li>bullet level 2
8567 <ol><li>Number on level 3</li>
8568 <li>Number on level 3</li></ol></li></ul>
8569 <ol><li>number level 2</li></ol></li>
8570 <li>Level 1
8571 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
8572 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
8573
8574 !! end
8575
8576 !! test
8577 Nested lists 1
8578 !! wikitext
8579 *foo
8580 **bar
8581 !! html
8582 <ul><li>foo
8583 <ul><li>bar</li></ul></li></ul>
8584
8585 !! end
8586
8587 !! test
8588 Nested lists 2
8589 !! wikitext
8590 **foo
8591 *bar
8592 !! html
8593 <ul><li><ul><li>foo</li></ul></li>
8594 <li>bar</li></ul>
8595
8596 !! end
8597
8598 !! test
8599 Nested lists 3 (first element empty)
8600 !! wikitext
8601 *
8602 **bar
8603 !! html
8604 <ul><li>
8605 <ul><li>bar</li></ul></li></ul>
8606
8607 !! end
8608
8609 !! test
8610 Nested lists 4 (first element empty)
8611 !! wikitext
8612 **
8613 *bar
8614 !! html
8615 <ul><li><ul><li></li></ul></li>
8616 <li>bar</li></ul>
8617
8618 !! end
8619
8620 !! test
8621 Nested lists 5 (both elements empty)
8622 !! wikitext
8623 **
8624 *
8625 !! html
8626 <ul><li><ul><li></li></ul></li>
8627 <li></li></ul>
8628
8629 !! end
8630
8631 !! test
8632 Nested lists 6 (both elements empty)
8633 !! wikitext
8634 *
8635 **
8636 !! html
8637 <ul><li>
8638 <ul><li></li></ul></li></ul>
8639
8640 !! end
8641
8642 !! test
8643 Nested lists 7 (skip initial nesting levels)
8644 !! wikitext
8645 *** foo
8646 !! html
8647 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
8648
8649 !! end
8650
8651 !! test
8652 Nested lists 8 (multiple nesting transitions)
8653 !! wikitext
8654 * foo
8655 *** bar
8656 ** baz
8657 * boo
8658 !! html
8659 <ul><li> foo
8660 <ul><li><ul><li> bar</li></ul></li>
8661 <li> baz</li></ul></li>
8662 <li> boo</li></ul>
8663
8664 !! end
8665
8666 !! test
8667 Nested lists 9 (extension interaction)
8668 !! options
8669 parsoid
8670 !! wikitext
8671 *<references />
8672 !! html/parsoid
8673 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
8674 !! end
8675
8676 !! test
8677 1. Lists with start-of-line-transparent tokens before bullets: Comments
8678 !! wikitext
8679 *foo
8680 *<!--cmt-->bar
8681 <!--cmt-->*baz
8682 !! html
8683 <ul><li>foo</li>
8684 <li>bar</li>
8685 <li>baz</li></ul>
8686
8687 !! end
8688
8689 !! test
8690 2. Lists with start-of-line-transparent tokens before bullets: Template close
8691 !! wikitext
8692 *foo {{echo|bar
8693 }}*baz
8694 !! html
8695 <ul><li>foo bar</li>
8696 <li>baz</li></ul>
8697
8698 !! end
8699
8700 !! test
8701 List items are not parsed correctly following a <pre> block (bug 785)
8702 !! wikitext
8703 * <pre>foo</pre>
8704 * <pre>bar</pre>
8705 * zar
8706 !! html/php
8707 <ul><li> <pre>foo</pre></li>
8708 <li> <pre>bar</pre></li>
8709 <li> zar</li></ul>
8710
8711 !! html/parsoid
8712 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
8713 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
8714 <li> zar</li></ul>
8715 !! end
8716
8717 !! test
8718 List items from template
8719 !! wikitext
8720
8721 {{inner list}}
8722 * item 2
8723
8724 * item 0
8725 {{inner list}}
8726 * item 2
8727
8728 * item 0
8729 * notSOL{{inner list}}
8730 * item 2
8731 !! html
8732 <ul><li> item 1</li>
8733 <li> item 2</li></ul>
8734 <ul><li> item 0</li>
8735 <li> item 1</li>
8736 <li> item 2</li></ul>
8737 <ul><li> item 0</li>
8738 <li> notSOL</li>
8739 <li> item 1</li>
8740 <li> item 2</li></ul>
8741
8742 !! end
8743
8744 !! test
8745 List interrupted by empty line or heading
8746 !! wikitext
8747 * foo
8748
8749 ** bar
8750 == A heading ==
8751 * Another list item
8752 !! html
8753 <ul><li> foo</li></ul>
8754 <ul><li><ul><li> bar</li></ul></li></ul>
8755 <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>
8756 <ul><li> Another list item</li></ul>
8757
8758 !!end
8759
8760 !!test
8761 Multiple list tags generated by templates
8762 !! wikitext
8763 {{echo|<li>}}a
8764 {{echo|<li>}}b
8765 {{echo|<li>}}c
8766 !! html
8767 <li>a
8768 <li>b
8769 <li>c</li>
8770 </li>
8771 </li>
8772
8773 !! html+tidy
8774 <ul>
8775 <li>a</li>
8776 <li>b</li>
8777 <li>c</li>
8778 </ul>
8779 !!end
8780
8781 !!test
8782 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
8783 !! wikitext
8784 *a
8785 <!--This line will NOT split the list-->
8786 *b
8787 <!--This line will NOT split the list either-->
8788 *c
8789 <!--foo--> <!----> <!--This line NOT split the list either-->
8790 *d
8791 !! html
8792 <ul><li>a</li>
8793 <li>b</li>
8794 <li>c</li>
8795 <li>d</li></ul>
8796
8797 !!end
8798
8799 !!test
8800 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
8801 !! wikitext
8802 *a
8803 <!--This line will NOT split the list-->
8804 *b
8805 <!--This line will NOT split the list either-->
8806 *c
8807 <!--foo--> <!----> <!--This line NOT split the list
8808 either-->
8809 *d
8810 !! html
8811 <ul><li>a</li>
8812 <li>b</li>
8813 <li>c</li>
8814 <li>d</li></ul>
8815
8816 !!end
8817
8818 !!test
8819 Test the li-hack
8820 (The PHP parser relies on Tidy for the hack)
8821 !!options
8822 parsoid=wt2html,wt2wt
8823 !! wikitext
8824 * foo
8825 * <li>li-hack
8826 * {{echo|<li>templated li-hack}}
8827 * <!--foo--> <li> unsupported li-hack with preceding comments
8828
8829 <ul>
8830 <li><li>not a li-hack
8831 </li>
8832 </ul>
8833 !! html+tidy
8834 <ul>
8835 <li>foo</li>
8836 <li>li-hack</li>
8837 <li>templated li-hack</li>
8838 <li>unsupported li-hack with preceding comments</li>
8839 </ul>
8840 <ul>
8841 <li>not a li-hack</li>
8842 </ul>
8843 !!end
8844
8845 !! test
8846 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
8847 !! options
8848 parsoid
8849 !! wikitext
8850 # foo
8851 ## bar
8852 * foo
8853 ** bar
8854 : foo
8855 :: bar
8856 !! html
8857 <ol>
8858 <li> foo<ol>
8859 <li> bar</li>
8860 </ol></li>
8861 </ol><ul>
8862 <li> foo<ul>
8863 <li> bar</li>
8864 </ul></li>
8865 </ul><dl>
8866 <dd> foo<dl>
8867 <dd> bar</dd>
8868 </dl></dd>
8869 </dl>
8870 !! end
8871
8872 !! test
8873 Parsoid: Test of whitespace serialization with Templated bullets
8874 !! options
8875 parsoid
8876 !! wikitext
8877 * {{bullet}}
8878 !! html
8879 <ul>
8880 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
8881 </ul>
8882 !! end
8883
8884 # ------------------------------------------------------------------------
8885 # The next set of tests are about Parsoid's ability to handle badly nested
8886 # tags (parse, minimize scope of fixup, and roundtrip back)
8887 # ------------------------------------------------------------------------
8888
8889 !! test
8890 Unbalanced closing block tags break a list
8891 (php parser relies on Tidy to fix up)
8892 !! wikitext
8893 <div>
8894 *a</div><div>
8895 *b</div>
8896 !! html+tidy
8897 <div>
8898 <ul>
8899 <li>a</li>
8900 </ul>
8901 </div>
8902 <div>
8903 <ul>
8904 <li>b</li>
8905 </ul>
8906 </div>
8907 !! end
8908
8909 # Parsoid fails this test, but it might be tricky to support properly.
8910 # See bug 68395.
8911 !! test
8912 Unbalanced closing non-block tags don't break a list
8913 (php parser relies on Tidy to fix up)
8914 !! wikitext
8915 <span>
8916 *a</span><span>
8917 *b</span>
8918 !! html/php+tidy
8919 <ul>
8920 <li><span>a</span></li>
8921 <li><span>b</span></li>
8922 </ul>
8923 !! html/parsoid
8924 <span>
8925 <ul>
8926 <li>a<span></span>
8927 </li>
8928 <li>b
8929 </li>
8930 </ul>
8931 </span>
8932 !! end
8933
8934 !! test
8935 Unclosed formatting tags that straddle lists are closed and reopened
8936 (php parser relies on Tidy to fix up)
8937 !! options
8938 parsoid=wt2html,wt2wt,html2html
8939 !! wikitext
8940 # <s> a
8941 # b </s>
8942 !! html/php+tidy
8943 <ol>
8944 <li><s>a</s></li>
8945 <li><s>b</s></li>
8946 </ol>
8947 !! html/parsoid
8948 <ol><li> <s> a</s></li>
8949 <li><s> b </s></li></ol>
8950 !! end
8951
8952 # See bug 68395.
8953 !!test
8954 1. List embedded in a formatting tag
8955 !! wikitext
8956 <small>
8957 * foo
8958 </small>
8959 !! html/php+tidy
8960 <ul>
8961 <li><small>foo</small></li>
8962 </ul>
8963 !! html/parsoid
8964 <small>
8965 <ul>
8966 <li> foo</li>
8967 </ul>
8968 </small>
8969 !!end
8970
8971 ## Ugly Parsoid output here
8972 ## Not sure what the right output is.
8973 !!test
8974 2. List embedded in a formatting tag
8975 !! wikitext
8976 <small>
8977 *a
8978 *b</small>
8979 !! html/php+tidy
8980 <ul>
8981 <li><small>a</small></li>
8982 <li><small>b</small></li>
8983 </ul>
8984 !! html/parsoid
8985 <small></small>
8986 <ul><small>
8987 <li>a</li>
8988 </small>
8989 <li><small>b</small></li>
8990 </ul>
8991 !!end
8992
8993 # Ugly Parsoid and PHP parser output here
8994 # Not sure if we want to make this a test!
8995 #
8996 ## !!test
8997 ## 3. Unclosed formatting tags in list elements
8998 ## !! wikitext
8999 ## *<small>a
9000 ## *<small>b
9001 ## !! html/php+tidy
9002 ## <ul>
9003 ## <li><small>a</small></li>
9004 ## <li><small><small>b</small></small></li>
9005 ## </ul>
9006 ## !! html/parsoid
9007 ## <ul>
9008 ## <li><small>a</small></li>
9009 ## <small>
9010 ## <li><small>b</small></li>
9011 ## </small></ul>
9012 ## !!end
9013
9014 # This is a bug in the PHP parser + tidy combination.
9015 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9016 # and then fostered out of the table by tidy.)
9017 # We believe the Parsoid output to be correct.
9018 !! test
9019 Table with missing opening <tr> tag
9020 !! options
9021 parsoid=wt2html,wt2wt
9022 !! wikitext
9023 <table>
9024 <td>foo</td>
9025 </tr>
9026 </table>
9027 !! html+tidy
9028 <table>
9029 <tr>
9030 <td>foo</td>
9031 </tr>
9032 </table>
9033 !! end
9034
9035 ###
9036 ### Magic Words
9037 ###
9038
9039 # Note that the current date is hard-coded as
9040 # 1970-01-01T00:02:03Z (a Thursday)
9041 # when running parser tests. The timezone is also fixed to GMT, so
9042 # local date will be identical to current date.
9043
9044 !! test
9045 Magic Word: {{CURRENTDAY}}
9046 !! wikitext
9047 {{CURRENTDAY}}
9048 !! html
9049 <p>1
9050 </p>
9051 !! end
9052
9053 !! test
9054 Magic Word: {{CURRENTDAY2}}
9055 !! wikitext
9056 {{CURRENTDAY2}}
9057 !! html
9058 <p>01
9059 </p>
9060 !! end
9061
9062 !! test
9063 Magic Word: {{CURRENTDAYNAME}}
9064 !! wikitext
9065 {{CURRENTDAYNAME}}
9066 !! html
9067 <p>Thursday
9068 </p>
9069 !! end
9070
9071 !! test
9072 Magic Word: {{CURRENTDOW}}
9073 !! wikitext
9074 {{CURRENTDOW}}
9075 !! html
9076 <p>4
9077 </p>
9078 !! end
9079
9080 !! test
9081 Magic Word: {{CURRENTMONTH}}
9082 !! wikitext
9083 {{CURRENTMONTH}}
9084 !! html
9085 <p>01
9086 </p>
9087 !! end
9088
9089 !! test
9090 Magic Word: {{CURRENTMONTH1}}
9091 !! wikitext
9092 {{CURRENTMONTH1}}
9093 !! html
9094 <p>1
9095 </p>
9096 !! end
9097
9098 !! test
9099 Magic Word: {{CURRENTMONTHABBREV}}
9100 !! wikitext
9101 {{CURRENTMONTHABBREV}}
9102 !! html
9103 <p>Jan
9104 </p>
9105 !! end
9106
9107 !! test
9108 Magic Word: {{CURRENTMONTHNAME}}
9109 !! wikitext
9110 {{CURRENTMONTHNAME}}
9111 !! html
9112 <p>January
9113 </p>
9114 !! end
9115
9116 !! test
9117 Magic Word: {{CURRENTMONTHNAMEGEN}}
9118 !! wikitext
9119 {{CURRENTMONTHNAMEGEN}}
9120 !! html
9121 <p>January
9122 </p>
9123 !! end
9124
9125 !! test
9126 Magic Word: {{CURRENTTIME}}
9127 !! wikitext
9128 {{CURRENTTIME}}
9129 !! html
9130 <p>00:02
9131 </p>
9132 !! end
9133
9134 !! test
9135 Magic Word: {{CURRENTHOUR}}
9136 !! wikitext
9137 {{CURRENTHOUR}}
9138 !! html
9139 <p>00
9140 </p>
9141 !! end
9142
9143 !! test
9144 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9145 !! wikitext
9146 {{CURRENTWEEK}}
9147 !! html
9148 <p>1
9149 </p>
9150 !! end
9151
9152 !! test
9153 Magic Word: {{CURRENTYEAR}}
9154 !! wikitext
9155 {{CURRENTYEAR}}
9156 !! html
9157 <p>1970
9158 </p>
9159 !! end
9160
9161 !! test
9162 Magic Word: {{CURRENTTIMESTAMP}}
9163 !! wikitext
9164 {{CURRENTTIMESTAMP}}
9165 !! html
9166 <p>19700101000203
9167 </p>
9168 !! end
9169
9170 !! test
9171 Magic Words LOCAL (UTC)
9172 !! wikitext
9173 * {{LOCALMONTH}}
9174 * {{LOCALMONTH1}}
9175 * {{LOCALMONTHNAME}}
9176 * {{LOCALMONTHNAMEGEN}}
9177 * {{LOCALMONTHABBREV}}
9178 * {{LOCALDAY}}
9179 * {{LOCALDAY2}}
9180 * {{LOCALDAYNAME}}
9181 * {{LOCALYEAR}}
9182 * {{LOCALTIME}}
9183 * {{LOCALHOUR}}
9184 * {{LOCALWEEK}}
9185 * {{LOCALDOW}}
9186 * {{LOCALTIMESTAMP}}
9187 !! html
9188 <ul><li> 01</li>
9189 <li> 1</li>
9190 <li> January</li>
9191 <li> January</li>
9192 <li> Jan</li>
9193 <li> 1</li>
9194 <li> 01</li>
9195 <li> Thursday</li>
9196 <li> 1970</li>
9197 <li> 00:02</li>
9198 <li> 00</li>
9199 <li> 1</li>
9200 <li> 4</li>
9201 <li> 19700101000203</li></ul>
9202
9203 !! end
9204
9205 !! test
9206 Magic Word: {{FULLPAGENAME}}
9207 !! options
9208 title=[[User:Ævar Arnfjörð Bjarmason]]
9209 !! wikitext
9210 {{FULLPAGENAME}}
9211 !! html
9212 <p>User:Ævar Arnfjörð Bjarmason
9213 </p>
9214 !! end
9215
9216 !! test
9217 Magic Word: {{FULLPAGENAMEE}}
9218 !! options
9219 title=[[User:Ævar Arnfjörð Bjarmason]]
9220 !! wikitext
9221 {{FULLPAGENAMEE}}
9222 !! html
9223 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9224 </p>
9225 !! end
9226
9227 !! test
9228 Magic Word: {{TALKSPACE}}
9229 !! options
9230 title=[[User:Ævar Arnfjörð Bjarmason]]
9231 !! wikitext
9232 {{TALKSPACE}}
9233 !! html
9234 <p>User talk
9235 </p>
9236 !! end
9237
9238 !! test
9239 Magic Word: {{TALKSPACE}}, same namespace
9240 !! options
9241 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9242 !! wikitext
9243 {{TALKSPACE}}
9244 !! html
9245 <p>User talk
9246 </p>
9247 !! end
9248
9249 !! test
9250 Magic Word: {{TALKSPACE}}, main namespace
9251 !! options
9252 title=[[Parser Test]]
9253 !! wikitext
9254 {{TALKSPACE}}
9255 !! html
9256 <p>Talk
9257 </p>
9258 !! end
9259
9260 !! test
9261 Magic Word: {{TALKSPACEE}}
9262 !! options
9263 title=[[User:Ævar Arnfjörð Bjarmason]]
9264 !! wikitext
9265 {{TALKSPACEE}}
9266 !! html
9267 <p>User_talk
9268 </p>
9269 !! end
9270
9271 !! test
9272 Magic Word: {{SUBJECTSPACE}}
9273 !! options
9274 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9275 !! wikitext
9276 {{SUBJECTSPACE}}
9277 !! html
9278 <p>User
9279 </p>
9280 !! end
9281
9282 !! test
9283 Magic Word: {{SUBJECTSPACE}}, same namespace
9284 !! options
9285 title=[[User:Ævar Arnfjörð Bjarmason]]
9286 !! wikitext
9287 {{SUBJECTSPACE}}
9288 !! html
9289 <p>User
9290 </p>
9291 !! end
9292
9293 !! test
9294 Magic Word: {{SUBJECTSPACE}}, main namespace
9295 !! options
9296 title=[[Parser Test]]
9297 !! wikitext
9298 {{SUBJECTSPACE}}
9299 !! html
9300
9301 !! end
9302
9303 !! test
9304 Magic Word: {{SUBJECTSPACEE}}
9305 !! options
9306 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9307 !! wikitext
9308 {{SUBJECTSPACEE}}
9309 !! html
9310 <p>User
9311 </p>
9312 !! end
9313
9314 !! test
9315 Magic Word: {{NAMESPACE}}
9316 !! options
9317 title=[[User:Ævar Arnfjörð Bjarmason]]
9318 !! wikitext
9319 {{NAMESPACE}}
9320 !! html
9321 <p>User
9322 </p>
9323 !! end
9324
9325 !! test
9326 Magic Word: {{NAMESPACEE}}
9327 !! options
9328 title=[[User:Ævar Arnfjörð Bjarmason]]
9329 !! wikitext
9330 {{NAMESPACEE}}
9331 !! html
9332 <p>User
9333 </p>
9334 !! end
9335
9336 !! test
9337 Magic Word: {{NAMESPACENUMBER}}
9338 !! options
9339 title=[[User:Ævar Arnfjörð Bjarmason]]
9340 !! wikitext
9341 {{NAMESPACENUMBER}}
9342 !! html
9343 <p>2
9344 </p>
9345 !! end
9346
9347 !! test
9348 Magic Word: {{SUBPAGENAME}}
9349 !! options
9350 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9351 !! wikitext
9352 {{SUBPAGENAME}}
9353 !! html
9354 <p>sub ö
9355 </p>
9356 !! end
9357
9358 !! test
9359 Magic Word: {{SUBPAGENAMEE}}
9360 !! options
9361 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9362 !! wikitext
9363 {{SUBPAGENAMEE}}
9364 !! html
9365 <p>sub_%C3%B6
9366 </p>
9367 !! end
9368
9369 !! test
9370 Magic Word: {{ROOTPAGENAME}}
9371 !! options
9372 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9373 !! wikitext
9374 {{ROOTPAGENAME}}
9375 !! html
9376 <p>Ævar Arnfjörð Bjarmason
9377 </p>
9378 !! end
9379
9380 !! test
9381 Magic Word: {{ROOTPAGENAMEE}}
9382 !! options
9383 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9384 !! wikitext
9385 {{ROOTPAGENAMEE}}
9386 !! html
9387 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9388 </p>
9389 !! end
9390
9391 !! test
9392 Magic Word: {{BASEPAGENAME}}
9393 !! options
9394 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9395 !! wikitext
9396 {{BASEPAGENAME}}
9397 !! html
9398 <p>Ævar Arnfjörð Bjarmason
9399 </p>
9400 !! end
9401
9402 !! test
9403 Magic Word: {{BASEPAGENAMEE}}
9404 !! options
9405 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9406 !! wikitext
9407 {{BASEPAGENAMEE}}
9408 !! html
9409 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9410 </p>
9411 !! end
9412
9413 !! test
9414 Magic Word: {{TALKPAGENAME}}
9415 !! options
9416 title=[[User:Ævar Arnfjörð Bjarmason]]
9417 !! wikitext
9418 {{TALKPAGENAME}}
9419 !! html
9420 <p>User talk:Ævar Arnfjörð Bjarmason
9421 </p>
9422 !! end
9423
9424 !! test
9425 Magic Word: {{TALKPAGENAMEE}}
9426 !! options
9427 title=[[User:Ævar Arnfjörð Bjarmason]]
9428 !! wikitext
9429 {{TALKPAGENAMEE}}
9430 !! html
9431 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9432 </p>
9433 !! end
9434
9435 !! test
9436 Magic Word: {{SUBJECTPAGENAME}}
9437 !! options
9438 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9439 !! wikitext
9440 {{SUBJECTPAGENAME}}
9441 !! html
9442 <p>User:Ævar Arnfjörð Bjarmason
9443 </p>
9444 !! end
9445
9446 !! test
9447 Magic Word: {{SUBJECTPAGENAMEE}}
9448 !! options
9449 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9450 !! wikitext
9451 {{SUBJECTPAGENAMEE}}
9452 !! html
9453 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9454 </p>
9455 !! end
9456
9457 !! test
9458 Magic Word: {{NUMBEROFFILES}}
9459 !! wikitext
9460 {{NUMBEROFFILES}}
9461 !! html
9462 <p>5
9463 </p>
9464 !! end
9465
9466 !! test
9467 Magic Word: {{PAGENAME}}
9468 !! options
9469 title=[[User:Ævar Arnfjörð Bjarmason]]
9470 !! wikitext
9471 {{PAGENAME}}
9472 !! html
9473 <p>Ævar Arnfjörð Bjarmason
9474 </p>
9475 !! end
9476
9477 !! test
9478 Magic Word: {{PAGENAME}} with metacharacters
9479 !! options
9480 title=[['foo & bar = baz']]
9481 !! wikitext
9482 ''{{PAGENAME}}''
9483 !! html/php
9484 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
9485 </p>
9486 !! html+tidy
9487 <p><i>'foo &amp; bar = baz'</i></p>
9488 !! end
9489
9490 !! test
9491 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
9492 !! options
9493 title=[[*RFC 1234 http://example.com/]]
9494 !! wikitext
9495 {{PAGENAME}}
9496 !! html/php
9497 <p>&#42;RFC&#32;1234 http&#58;//example.com/
9498 </p>
9499 !! html+tidy
9500 <p>*RFC 1234 http://example.com/</p>
9501 !! end
9502
9503 !! test
9504 Magic Word: {{PAGENAMEE}}
9505 !! options
9506 title=[[User:Ævar Arnfjörð Bjarmason]]
9507 !! wikitext
9508 {{PAGENAMEE}}
9509 !! html
9510 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9511 </p>
9512 !! end
9513
9514 !! test
9515 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
9516 !! options
9517 title=[[*RFC 1234 http://example.com/]]
9518 !! wikitext
9519 {{PAGENAMEE}}
9520 !! html/php
9521 <p>&#42;RFC_1234_http&#58;//example.com/
9522 </p>
9523 !! html+tidy
9524 <p>*RFC_1234_http://example.com/</p>
9525 !! end
9526
9527 !! test
9528 Magic Word: {{REVISIONID}}
9529 !! wikitext
9530 {{REVISIONID}}
9531 !! html
9532 <p>1337
9533 </p>
9534 !! end
9535
9536 !! test
9537 Magic Word: {{SCRIPTPATH}}
9538 !! wikitext
9539 {{SCRIPTPATH}}
9540 !! html
9541 <p>/
9542 </p>
9543 !! end
9544
9545 !! test
9546 Magic Word: {{STYLEPATH}}
9547 !! wikitext
9548 {{STYLEPATH}}
9549 !! html
9550 <p>/skins
9551 </p>
9552 !! end
9553
9554 !! test
9555 Magic Word: {{SERVER}}
9556 !! wikitext
9557 {{SERVER}}
9558 !! html
9559 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9560 </p>
9561 !! end
9562
9563 !! test
9564 Magic Word: {{SERVERNAME}}
9565 !! wikitext
9566 {{SERVERNAME}}
9567 !! html
9568 <p>example.org
9569 </p>
9570 !! end
9571
9572 !! test
9573 Magic Word: {{SITENAME}}
9574 !! wikitext
9575 {{SITENAME}}
9576 !! html
9577 <p>MediaWiki
9578 </p>
9579 !! end
9580
9581 !! test
9582 Case-sensitive magic words, when cased differently, should just be template transclusions
9583 !! wikitext
9584 {{CurrentMonth}}
9585 {{currentday}}
9586 {{cURreNTweEK}}
9587 {{currentHour}}
9588 !! html
9589 <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>
9590 <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>
9591 <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>
9592 <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>
9593 </p>
9594 !! end
9595
9596 !! test
9597 Case-insensitive magic words should still work with weird casing.
9598 !! wikitext
9599 {{sErVeRNaMe}}
9600 {{LCFirst:AOEU}}
9601 {{ucFIRST:aoeu}}
9602 {{SERver}}
9603 !! html
9604 <p>example.org
9605 aOEU
9606 Aoeu
9607 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9608 </p>
9609 !! end
9610
9611 # From plwiki:PLOS_ONE
9612 !! test
9613 Parsoid: Page property magic word with magic word contents
9614 !! wikitext
9615 {{DISPLAYTITLE:''{{PAGENAME}}''}}
9616 !! html/parsoid
9617 <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>"}]]}'/>
9618 !! end
9619
9620 !! test
9621 Parsoid: Template-generated DISPLAYTITLE
9622 !! wikitext
9623 {{{{echo|DISPLAYTITLE}}:Foo}}
9624 !! html/parsoid
9625 <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}}]}'/>
9626 !! end
9627
9628 !! test
9629 Namespace 1 {{ns:1}}
9630 !! wikitext
9631 {{ns:1}}
9632 !! html
9633 <p>Talk
9634 </p>
9635 !! end
9636
9637 !! test
9638 Namespace 1 {{ns:01}}
9639 !! wikitext
9640 {{ns:01}}
9641 !! html
9642 <p>Talk
9643 </p>
9644 !! end
9645
9646 !! test
9647 Namespace 0 {{ns:0}} (bug 4783)
9648 !! wikitext
9649 {{ns:0}}
9650 !! html
9651
9652 !! end
9653
9654 !! test
9655 Namespace 0 {{ns:00}} (bug 4783)
9656 !! wikitext
9657 {{ns:00}}
9658 !! html
9659
9660 !! end
9661
9662 !! test
9663 Namespace -1 {{ns:-1}}
9664 !! wikitext
9665 {{ns:-1}}
9666 !! html
9667 <p>Special
9668 </p>
9669 !! end
9670
9671 !! test
9672 Namespace User {{ns:User}}
9673 !! wikitext
9674 {{ns:User}}
9675 !! html
9676 <p>User
9677 </p>
9678 !! end
9679
9680 !! test
9681 Namespace User talk {{ns:User_talk}}
9682 !! wikitext
9683 {{ns:User_talk}}
9684 !! html
9685 <p>User talk
9686 </p>
9687 !! end
9688
9689 !! test
9690 Namespace User talk {{ns:uSeR tAlK}}
9691 !! wikitext
9692 {{ns:uSeR tAlK}}
9693 !! html
9694 <p>User talk
9695 </p>
9696 !! end
9697
9698 !! test
9699 Namespace File {{ns:File}}
9700 !! wikitext
9701 {{ns:File}}
9702 !! html
9703 <p>File
9704 </p>
9705 !! end
9706
9707 !! test
9708 Namespace File {{ns:Image}}
9709 !! wikitext
9710 {{ns:Image}}
9711 !! html
9712 <p>File
9713 </p>
9714 !! end
9715
9716 !! test
9717 Namespace (lang=de) Benutzer {{ns:User}}
9718 !! options
9719 language=de
9720 !! wikitext
9721 {{ns:User}}
9722 !! html
9723 <p>Benutzer
9724 </p>
9725 !! end
9726
9727 !! test
9728 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
9729 !! options
9730 language=de
9731 !! wikitext
9732 {{ns:3}}
9733 !! html
9734 <p>Benutzer Diskussion
9735 </p>
9736 !! end
9737
9738
9739 !! test
9740 Urlencode
9741 !! wikitext
9742 {{urlencode:hi world?!}}
9743 {{urlencode:hi world?!|WIKI}}
9744 {{urlencode:hi world?!|PATH}}
9745 {{urlencode:hi world?!|QUERY}}
9746 !! html
9747 <p>hi+world%3F%21
9748 hi_world%3F!
9749 hi%20world%3F%21
9750 hi+world%3F%21
9751 </p>
9752 !! end
9753
9754 !! test
9755 Magic Word: prioritize type info over data-parsoid
9756 !! options
9757 parsoid=html2wt
9758 !! html/parsoid
9759 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
9760 !! wikitext
9761 __FORCETOC__
9762 !! end
9763
9764 !! test
9765 Magic Word: serialize on separate line (parsoid)
9766 !! options
9767 parsoid=wt2wt,html2wt
9768 !! wikitext
9769 foo
9770 __NOTOC__
9771 bar
9772 !! html/parsoid
9773 foo<meta property="mw:PageProp/notoc"/>bar
9774 !! end
9775
9776 !! test
9777 Magic Word: rt non-english wikis
9778 !! options
9779 parsoid=wt2wt
9780 language=de
9781 !! wikitext
9782 __NOEDITSECTION__
9783 !! html/parsoid
9784 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
9785 !! end
9786
9787 !!test
9788 __proto__ is treated as normal wikitext (T105997)
9789 !!wikitext
9790 __proto__
9791 !!html
9792 <p>__proto__
9793 </p>
9794 !!end
9795
9796 ###
9797 ### Magic links
9798 ###
9799 !! test
9800 Magic links: internal link to RFC (bug 479)
9801 !! wikitext
9802 [[RFC 123]]
9803 !! html
9804 <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>
9805 </p>
9806 !! end
9807
9808 !! test
9809 Magic links: RFC (bug 479)
9810 !! wikitext
9811 RFC 822
9812 !! html
9813 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9814 </p>
9815 !! end
9816
9817 !! test
9818 Magic links: RFC (bug 65278)
9819 !! wikitext
9820 This is RFC 822 but thisRFC 822 is not RFC 822linked.
9821 !! html
9822 <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.
9823 </p>
9824 !! end
9825
9826 !! test
9827 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
9828 !! wikitext
9829 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
9830 RFC
9831 822
9832 !! html
9833 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9834 RFC
9835 822
9836 </p>
9837 !! end
9838
9839 !! test
9840 Magic links: ISBN (bug 1937)
9841 !! wikitext
9842 ISBN 0-306-40615-2
9843 !! html
9844 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
9845 </p>
9846 !! end
9847
9848 !! test
9849 Magic links: ISBN (bug 65278)
9850 !! wikitext
9851 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
9852 !! html/php
9853 <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.
9854 </p>
9855 !! html/parsoid
9856 <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>
9857 !! end
9858
9859 !! test
9860 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
9861 !! wikitext
9862 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
9863 ISBN
9864 9780316098113
9865 ISBN 978
9866 0316098113
9867 !! html
9868 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
9869 ISBN
9870 9780316098113
9871 ISBN 978
9872 0316098113
9873 </p>
9874 !! end
9875
9876 !! test
9877 Magic links: PMID incorrectly converts space to underscore
9878 !! wikitext
9879 PMID 1234
9880 !! html
9881 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9882 </p>
9883 !! end
9884
9885 !! test
9886 Magic links: PMID (bug 65278)
9887 !! wikitext
9888 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
9889 !! html
9890 <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.
9891 </p>
9892 !! end
9893
9894 !! test
9895 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
9896 !! wikitext
9897 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
9898 PMID
9899 1234
9900 !! html
9901 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9902 PMID
9903 1234
9904 </p>
9905 !! end
9906
9907 ###
9908 ### Templates
9909 ####
9910
9911 !! test
9912 Nonexistent template
9913 !! wikitext
9914 {{thistemplatedoesnotexist}}
9915 !! html
9916 <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>
9917 </p>
9918 !! end
9919
9920 !! test
9921 Template with invalid target containing tags
9922 !! wikitext
9923 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
9924 !! html
9925 <p>{{a<b>b</b>|foo|a=b|a = b}}
9926 </p>
9927 !! end
9928
9929 !! test
9930 Template with invalid target containing unclosed tag
9931 !! wikitext
9932 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
9933 !! html
9934 <p>{{a<b>|foo|a=b|a = b}}</b>
9935 </p>
9936 !! end
9937
9938 !! test
9939 Template with invalid target containing wikilink
9940 !! wikitext
9941 {{[[Main Page]]}}
9942 !! html/php
9943 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
9944 </p>
9945 !! html/parsoid
9946 <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>
9947 !! end
9948
9949 !! test
9950 Template with just whitespace in it, bug #68421
9951 !! wikitext
9952 {{echo|{{ }}}}
9953 !! html/parsoid
9954 <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>
9955 !! end
9956
9957 !! article
9958 Template:test
9959 !! text
9960 This is a test template
9961 !! endarticle
9962
9963 !! test
9964 Simple template
9965 !! wikitext
9966 {{test}}
9967 !! html
9968 <p>This is a test template
9969 </p>
9970 !! end
9971
9972 !! test
9973 Template with explicit namespace
9974 !! wikitext
9975 {{Template:test}}
9976 !! html
9977 <p>This is a test template
9978 </p>
9979 !! end
9980
9981
9982 !! article
9983 Template:paramtest
9984 !! text
9985 This is a test template with parameter {{{param}}}
9986 !! endarticle
9987
9988 !! test
9989 Template parameter
9990 !! wikitext
9991 {{paramtest|param=foo}}
9992 !! html
9993 <p>This is a test template with parameter foo
9994 </p>
9995 !! end
9996
9997 !! article
9998 Template:paramtestnum
9999 !! text
10000 [[{{{1}}}|{{{2}}}]]
10001 !! endarticle
10002
10003 !! test
10004 Template unnamed parameter
10005 !! wikitext
10006 {{paramtestnum|Main Page|the main page}}
10007 !! html
10008 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10009 </p>
10010 !! end
10011
10012 !! article
10013 Template:templatesimple
10014 !! text
10015 (test)
10016 !! endarticle
10017
10018 !! article
10019 Template:templateredirect
10020 !! text
10021 #redirect [[Template:templatesimple]]
10022 !! endarticle
10023
10024 !! article
10025 Template:templateasargtestnum
10026 !! text
10027 {{{{{1}}}}}
10028 !! endarticle
10029
10030 !! article
10031 Template:templateasargtest
10032 !! text
10033 {{template{{{templ}}}}}
10034 !! endarticle
10035
10036 !! article
10037 Template:templateasargtest2
10038 !! text
10039 {{{{{templ}}}}}
10040 !! endarticle
10041
10042 !! test
10043 Template with template name as unnamed argument
10044 !! wikitext
10045 {{templateasargtestnum|templatesimple}}
10046 !! html
10047 <p>(test)
10048 </p>
10049 !! end
10050
10051 !! test
10052 Template with template name as argument
10053 !! wikitext
10054 {{templateasargtest|templ=simple}}
10055 !! html
10056 <p>(test)
10057 </p>
10058 !! end
10059
10060 !! test
10061 Template with template name as argument (2)
10062 !! wikitext
10063 {{templateasargtest2|templ=templatesimple}}
10064 !! html
10065 <p>(test)
10066 </p>
10067 !! end
10068
10069 !! article
10070 Template:templateasargtestdefault
10071 !! text
10072 {{{{{templ|templatesimple}}}}}
10073 !! endarticle
10074
10075 !! article
10076 Template:templa
10077 !! text
10078 '''templ'''
10079 !! endarticle
10080
10081 !! test
10082 Template with default value
10083 !! wikitext
10084 {{templateasargtestdefault}}
10085 !! html
10086 <p>(test)
10087 </p>
10088 !! end
10089
10090 !! test
10091 Template with default value (value set)
10092 !! wikitext
10093 {{templateasargtestdefault|templ=templa}}
10094 !! html
10095 <p><b>templ</b>
10096 </p>
10097 !! end
10098
10099 !! test
10100 Template redirect
10101 !! wikitext
10102 {{templateredirect}}
10103 !! html/php
10104 <p>(test)
10105 </p>
10106 !! html/parsoid
10107 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10108 !! end
10109
10110 !! test
10111 Template with argument in separate line
10112 !! wikitext
10113 {{ templateasargtest |
10114 templ = simple }}
10115 !! html
10116 <p>(test)
10117 </p>
10118 !! end
10119
10120 !! test
10121 Template with complex template as argument
10122 !! wikitext
10123 {{paramtest|
10124 param ={{ templateasargtest |
10125 templ = simple }}}}
10126 !! html
10127 <p>This is a test template with parameter (test)
10128 </p>
10129 !! end
10130
10131 !! test
10132 Template with thumb image (with link in description)
10133 !! wikitext
10134 {{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10135 !! html/php
10136 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>
10137
10138 !! html+tidy
10139 <p>This is a test template with parameter</p>
10140 <div class="thumb tright">
10141 <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>
10142 <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>
10143 </div>
10144 </div>
10145 !! html/parsoid
10146 <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>
10147 !! end
10148
10149 !! article
10150 Template:complextemplate
10151 !! text
10152 {{{1}}} {{paramtest|
10153 param ={{{param}}}}}
10154 !! endarticle
10155
10156 !! test
10157 Template with complex arguments
10158 !! wikitext
10159 {{complextemplate|
10160 param ={{ templateasargtest |
10161 templ = simple }}|[[Template:complextemplate|link]]}}
10162 !! html
10163 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10164 </p>
10165 !! end
10166
10167 !! test
10168 BUG 553: link with two variables in a piped link
10169 !! wikitext
10170 {|
10171 |[[{{{1}}}|{{{2}}}]]
10172 |}
10173 !! html
10174 <table>
10175 <tr>
10176 <td>[[{{{1}}}|{{{2}}}]]
10177 </td></tr></table>
10178
10179 !! end
10180
10181 !! test
10182 Magic variable as template parameter
10183 !! wikitext
10184 {{paramtest|param={{SITENAME}}}}
10185 !! html
10186 <p>This is a test template with parameter MediaWiki
10187 </p>
10188 !! end
10189
10190 !! article
10191 Template:linktest
10192 !! text
10193 [[{{{param}}}|link]]
10194 !! endarticle
10195
10196 !! test
10197 Template parameter as link source
10198 !! wikitext
10199 {{linktest|param=Main Page}}
10200 !! html
10201 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10202 </p>
10203 !! end
10204
10205 !!article
10206 Template:paramtest2
10207 !! text
10208 including another template, {{paramtest|param={{{arg}}}}}
10209 !! endarticle
10210
10211 !! test
10212 Template passing argument to another template
10213 !! wikitext
10214 {{paramtest2|arg='hmm'}}
10215 !! html
10216 <p>including another template, This is a test template with parameter 'hmm'
10217 </p>
10218 !! end
10219
10220 !! article
10221 Template:Linktest2
10222 !! text
10223 Main Page
10224 !! endarticle
10225
10226 !! test
10227 Template as link source
10228 !! wikitext
10229 [[{{linktest2}}]]
10230
10231 [[{{linktest2}}|Main Page]]
10232
10233 [[{{linktest2}}]]Page
10234 !! html
10235 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10236 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10237 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10238 </p>
10239 !! end
10240
10241
10242 !! article
10243 Template:loop1
10244 !! text
10245 {{loop2}}
10246 !! endarticle
10247
10248 !! article
10249 Template:loop2
10250 !! text
10251 {{loop1}}
10252 !! endarticle
10253
10254 !! test
10255 Template infinite loop
10256 !! wikitext
10257 {{loop1}}
10258 !! html
10259 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10260 </p>
10261 !! end
10262
10263 !! test
10264 Template from main namespace
10265 !! wikitext
10266 {{:Main Page}}
10267 !! html
10268 <p>blah blah
10269 </p>
10270 !! end
10271
10272 !! article
10273 Template:table
10274 !! text
10275 {|
10276 | 1 || 2
10277 |-
10278 | 3 || 4
10279 |}
10280 !! endarticle
10281
10282 !! test
10283 BUG 529: Template with table, not included at beginning of line
10284 !! wikitext
10285 foo {{table}}
10286 !! html
10287 <p>foo
10288 </p>
10289 <table>
10290 <tr>
10291 <td> 1 </td>
10292 <td> 2
10293 </td></tr>
10294 <tr>
10295 <td> 3 </td>
10296 <td> 4
10297 </td></tr></table>
10298
10299 !! end
10300
10301 !! test
10302 BUG 523: Template shouldn't eat newline (or add an extra one before table)
10303 !! wikitext
10304 foo
10305 {{table}}
10306 !! html
10307 <p>foo
10308 </p>
10309 <table>
10310 <tr>
10311 <td> 1 </td>
10312 <td> 2
10313 </td></tr>
10314 <tr>
10315 <td> 3 </td>
10316 <td> 4
10317 </td></tr></table>
10318
10319 !! end
10320
10321 !! test
10322 BUG 41: Template parameters shown as broken links
10323 !! wikitext
10324 {{{parameter}}}
10325 !! html
10326 <p>{{{parameter}}}
10327 </p>
10328 !! end
10329
10330 !! test
10331 Template with targets containing wikilinks
10332 !! wikitext
10333 {{[[foo]]}}
10334
10335 {{[[{{echo|foo}}]]}}
10336
10337 {{{{echo|[[foo}}]]}}
10338 !! html
10339 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10340 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10341 </p><p>{{[[foo}}]]
10342 </p>
10343 !! end
10344
10345 !! article
10346 Template:''
10347 !! text
10348 bar
10349 !! endarticle
10350
10351 !! test
10352 Templates: Double quotes as template target
10353 !! wikitext
10354 foo {{''}} baz
10355 !! html/php
10356 <p>foo bar baz
10357 </p>
10358 !! html/parsoid
10359 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
10360 </p>
10361 !! end
10362
10363 !! article
10364 Template:MSGNW test
10365 !! text
10366 ''None'' of '''this''' should be
10367 * interpreted
10368 but rather passed unmodified
10369 {{test}}
10370 <gallery>
10371 File:Foobar.jpg
10372 </gallery>
10373 <!-- comment -->
10374 !! endarticle
10375
10376 # hmm, fix this or just deprecate msgnw and document its behavior?
10377 !! test
10378 msgnw keyword
10379 !! wikitext
10380 {{msgnw:MSGNW test}}
10381 !! html/php
10382 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
10383 &#42; interpreted
10384 &#32;but rather passed unmodified
10385 &#123;&#123;test&#125;&#125;
10386 &#60;gallery&#62;
10387 File:Foobar.jpg
10388 &#60;/gallery&#62;
10389 &#60;!-- comment --&#62;
10390 </p>
10391 !! end
10392
10393 !! test
10394 int keyword
10395 !! wikitext
10396 {{int:youhavenewmessages|lots of money|not!}}
10397 !! html
10398 <p>You have lots of money (not!).
10399 </p>
10400 !! end
10401
10402 !! article
10403 Template:Includes
10404 !! text
10405 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10406 !! endarticle
10407
10408 !! test
10409 <includeonly> and <noinclude> being included
10410 !! wikitext
10411 {{Includes}}
10412 !! html
10413 <p>Foobar
10414 </p>
10415 !! end
10416
10417 !! article
10418 Template:Includes2
10419 !! text
10420 <onlyinclude>Foo</onlyinclude>bar
10421 !! endarticle
10422
10423 !! test
10424 <onlyinclude> being included
10425 !! wikitext
10426 {{Includes2}}
10427 !! html
10428 <p>Foo
10429 </p>
10430 !! end
10431
10432
10433 !! article
10434 Template:Includes3
10435 !! text
10436 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
10437 !! endarticle
10438
10439 !! test
10440 <onlyinclude> and <includeonly> being included
10441 !! wikitext
10442 {{Includes3}}
10443 !! html
10444 <p>Foo
10445 </p>
10446 !! end
10447
10448 !! test
10449 <includeonly> and <noinclude> on a page
10450 !! wikitext
10451 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10452 !! html
10453 <p>Foozar
10454 </p>
10455 !! end
10456
10457 !! test
10458 Un-closed <noinclude>
10459 !! wikitext
10460 <noinclude>
10461 !! html
10462 !! end
10463
10464 !! test
10465 <onlyinclude> on a page
10466 !! wikitext
10467 <onlyinclude>Foo</onlyinclude>bar
10468 !! html
10469 <p>Foobar
10470 </p>
10471 !! end
10472
10473 !! test
10474 Un-closed <onlyinclude>
10475 !! wikitext
10476 <onlyinclude>
10477 !! html
10478 !! end
10479
10480 !!test
10481 Self-closed noinclude, includeonly, onlyinclude tags
10482 !! wikitext
10483 <noinclude />
10484 <includeonly />
10485 <onlyinclude />
10486 !! html
10487 <p><br />
10488 </p>
10489 !!end
10490
10491 !!test
10492 Unbalanced includeonly and noinclude tags
10493 !! wikitext
10494 {|
10495 |a</noinclude>
10496 |b</noinclude></noinclude>
10497 |c</noinclude></includeonly>
10498 |d</includeonly></includeonly>
10499 |}
10500 !! html
10501 <table>
10502 <tr>
10503 <td>a
10504 </td>
10505 <td>b
10506 </td>
10507 <td>c&lt;/includeonly&gt;
10508 </td>
10509 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
10510 </td></tr></table>
10511
10512 !!end
10513
10514 !! article
10515 Template:Includeonly section
10516 !! text
10517 <includeonly>
10518 ==Includeonly section==
10519 </includeonly>
10520 ==Section T-1==
10521 !!endarticle
10522
10523 !! test
10524 Bug 6563: Edit link generation for section shown by <includeonly>
10525 !! wikitext
10526 {{includeonly section}}
10527 !! html
10528 <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>
10529 <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>
10530
10531 !! end
10532
10533 # Uses same input as the contents of [[Template:Includeonly section]]
10534 !! test
10535 Bug 6563: Section extraction for section shown by <includeonly>
10536 !! options
10537 section=T-2
10538 !! wikitext
10539 <includeonly>
10540 ==Includeonly section==
10541 </includeonly>
10542 ==Section T-2==
10543 !! html
10544 ==Section T-2==
10545 !! end
10546
10547 !! test
10548 Bug 6563: Edit link generation for section suppressed by <includeonly>
10549 !! wikitext
10550 <includeonly>
10551 ==Includeonly section==
10552 </includeonly>
10553 ==Section 1==
10554 !! html
10555 <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>
10556
10557 !! end
10558
10559 !! test
10560 Bug 6563: Section extraction for section suppressed by <includeonly>
10561 !! options
10562 section=1
10563 !! wikitext
10564 <includeonly>
10565 ==Includeonly section==
10566 </includeonly>
10567 ==Section 1==
10568 !! html
10569 ==Section 1==
10570 !! end
10571
10572 !! test
10573 Un-closed <includeonly>
10574 !! wikitext
10575 <includeonly>
10576 !! html
10577 !! end
10578
10579 !! test
10580 Includes and comments at SOL
10581 !! wikitext
10582 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
10583
10584 <noinclude>
10585 some
10586 </noinclude>* stuff
10587 * here
10588
10589 <includeonly>can have stuff</includeonly>=== here ===
10590
10591 !! html/php
10592 <h2><span class="mw-headline" id="hu">hu</span></h2>
10593 <p>some
10594 </p>
10595 <ul><li> stuff</li>
10596 <li> here</li></ul>
10597 <h3><span class="mw-headline" id="here">here</span></h3>
10598
10599 !! html/parsoid
10600 <!-- 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>
10601
10602 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
10603 <p>some</p>
10604 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
10605 <li> here</li></ul>
10606
10607 <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>
10608
10609 !! end
10610
10611 # TODO: test with DOM fragment reuse!
10612 !! test
10613 Parsoid: DOM fragment reuse
10614 !! options
10615 parsoid=wt2wt,wt2html
10616 !! wikitext
10617 a{{echo|b<table></table>c}}d
10618
10619 a{{echo|b
10620 <table></table>
10621 c}}d
10622
10623 {{echo|a
10624
10625 <table></table>
10626
10627 b}}
10628 !! html
10629 <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>
10630
10631 <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">
10632 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
10633 </span><p about="#mwt2">cd</p>
10634
10635 <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">
10636
10637 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
10638
10639 </span><p about="#mwt3">b</p>
10640 !! end
10641
10642 !! test
10643 Parsoid: Merge double tds (T52603)
10644 !! options
10645 parsoid
10646 !! wikitext
10647 {|
10648 |{{echo|{{!}} foo}}
10649 |}
10650 !! html
10651 <table><tbody>
10652 <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>
10653 </tbody></table>
10654 !! end
10655
10656 !! test
10657 Parsoid: Merge double tds in nested transclusion content (T52603)
10658 !! options
10659 parsoid
10660 !! wikitext
10661 {{echo|<div>}}
10662 {|
10663 |{{echo|{{!}} foo}}
10664 |}
10665 {{echo|</div>}}
10666 !! html
10667 <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}}]}'>
10668 <table><tbody>
10669 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
10670 </tbody></table>
10671 </div>
10672 !! end
10673
10674 ###
10675 ### <includeonly> and <noinclude> in attributes
10676 ###
10677 !!test
10678 0. includeonly around the entire attribute
10679 !! wikitext
10680 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
10681 !! html
10682 <p><span id="v2">bar</span>
10683 </p>
10684 !!end
10685
10686 !!test
10687 1. includeonly in html attr key
10688 !! wikitext
10689 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
10690 !! html
10691 <p><span id="foo">bar</span>
10692 </p>
10693 !!end
10694
10695 !!test
10696 2. includeonly in html attr value
10697 !! wikitext
10698 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
10699 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
10700 !! html
10701 <p><span id="v1">bar</span>
10702 <span id="v1">bar</span>
10703 </p>
10704 !!end
10705
10706 !!test
10707 3. includeonly in part of an attr value
10708 !! wikitext
10709 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
10710 !! html
10711 <p><span style="color:red;">bar</span>
10712 </p>
10713 !!end
10714
10715 !!test
10716 4. includeonly in table attributes
10717 !! wikitext
10718 {|
10719 |- <noinclude>
10720 |-
10721 |a
10722 </noinclude>
10723 |- <includeonly>
10724 |-
10725 |b
10726 </includeonly>
10727 |}
10728 !! html
10729 <table>
10730
10731
10732 <tr>
10733 <td>a
10734 </td></tr>
10735 </table>
10736
10737 !!end
10738
10739 ###
10740 ### Token Stream Patcher tests
10741 ###
10742 ### These tests won't always pass wt2wt and other modes because
10743 ### on serialization, the table will be output on a new line.
10744 ### For now, we are blacklisting them, and using this to test selser.
10745 ###
10746
10747 !!test
10748 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
10749 !!options
10750 parsoid=wt2html,wt2wt
10751 !!wikitext
10752 {{echo|}}{| width = '100%'
10753 |foo
10754 |}
10755 !!html/parsoid
10756 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
10757 <tbody><tr><td>foo</td></tr>
10758 </tbody></table>
10759 !!end
10760
10761 !!test
10762 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
10763 !!options
10764 parsoid=wt2html,wt2wt
10765 !!wikitext
10766 <includeonly>a</includeonly>{| {{{b}}}
10767 |c
10768 |}
10769 !!html/parsoid
10770 <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}}}":""}}'>
10771 <tbody><tr><td>c</td></tr>
10772 </tbody></table>
10773
10774 !!end
10775
10776 ###
10777 ### Testing parsing of templates where a template arg
10778 ### has the same name as the template itself.
10779 ###
10780
10781 !! article
10782 Template:quote
10783 !! text
10784 {{{quote|{{{1}}}}}}
10785 !! endarticle
10786
10787 !!test
10788 Templates: Template Name/Arg clash: 1. Use of positional param
10789 !! wikitext
10790 {{quote|foo}}
10791 !! html
10792 <p>foo
10793 </p>
10794 !!end
10795
10796 !!test
10797 Templates: Template Name/Arg clash: 2. Use of named param
10798 !! wikitext
10799 {{quote|quote=foo}}
10800 !! html
10801 <p>foo
10802 </p>
10803 !!end
10804
10805 !!test
10806 Templates: Template Name/Arg clash: 3. Use of named param with empty input
10807 !! wikitext
10808 {{quote|quote}}
10809 !! html
10810 <p>quote
10811 </p>
10812 !!end
10813
10814 ###
10815 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
10816 ###
10817
10818 !!test
10819 Templates: 1. Simple use
10820 !! wikitext
10821 {{echo|Foo}}
10822 !! html
10823 <p>Foo
10824 </p>
10825 !!end
10826
10827 !!test
10828 Templates: 2. Inside a block tag
10829 !! wikitext
10830 <div>{{echo|Foo}}</div>
10831 <blockquote>{{echo|Foo}}</blockquote>
10832 !! html
10833 <div>Foo</div>
10834 <blockquote>Foo</blockquote>
10835
10836 !! html+tidy
10837 <div>Foo</div>
10838 <blockquote>
10839 <p>Foo</p>
10840 </blockquote>
10841 !!end
10842
10843 !!test
10844 Templates: P-wrapping: 1a. Templates on consecutive lines
10845 !! wikitext
10846 {{echo|Foo}}
10847 {{echo|bar}}
10848 !! html
10849 <p>Foo
10850 bar
10851 </p>
10852 !!end
10853
10854 !!test
10855 Templates: P-wrapping: 1b. Templates on consecutive lines
10856 !! wikitext
10857 Foo
10858
10859 {{echo|bar}}
10860 {{echo|baz}}
10861 !! html
10862 <p>Foo
10863 </p><p>bar
10864 baz
10865 </p>
10866 !!end
10867
10868 !!test
10869 Templates: P-wrapping: 1c. Templates on consecutive lines
10870 !! wikitext
10871 {{echo|Foo}}
10872 {{echo|bar}} <div>baz</div>
10873 !! html
10874 <p>Foo
10875 </p>
10876 bar <div>baz</div>
10877
10878 !! html+tidy
10879 <p>Foo</p>
10880 <p>bar</p>
10881 <div>baz</div>
10882 !! end
10883
10884 !!test
10885 Templates: P-wrapping: 1d. Template preceded by comment-only line
10886 !!options
10887 parsoid
10888 !! wikitext
10889 <!-- foo -->
10890 {{echo|Bar}}
10891 !! html
10892 <!-- foo -->
10893
10894 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
10895 !!end
10896
10897 !!test
10898 Templates: Inline Text: 1. Multiple template uses
10899 !! wikitext
10900 {{echo|Foo}}bar{{echo|baz}}
10901 !! html
10902 <p>Foobarbaz
10903 </p>
10904 !!end
10905
10906 !!test
10907 Templates: Inline Text: 2. Back-to-back template uses
10908 !! wikitext
10909 {{echo|Foo}}{{echo|bar}}
10910 !! html
10911 <p>Foobar
10912 </p>
10913 !!end
10914
10915 !!test
10916 Templates: Block Tags: 1. Multiple template uses
10917 !! wikitext
10918 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
10919 !! html
10920 <div>Foo</div><div>bar</div><div>baz</div>
10921
10922 !!end
10923
10924 !!test
10925 Templates: Block Tags: 2. Back-to-back template uses
10926 !! wikitext
10927 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
10928 !! html
10929 <div>Foo</div><div>bar</div>
10930
10931 !!end
10932
10933 # This is an edge case relating to paragraph wrapping.
10934 !!test
10935 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
10936 !! wikitext
10937 {{echo|a
10938 b</p>}}
10939 !! html/parsoid
10940 <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
10941 b</p>
10942 !!end
10943
10944 !!test
10945 Templates: Links: 1. Simple example
10946 !! wikitext
10947 {{echo|[[Foo|bar]]}}
10948 !! html
10949 <p><a href="/wiki/Foo" title="Foo">bar</a>
10950 </p>
10951 !!end
10952
10953 !!test
10954 Templates: Links: 2. Generation of link href
10955 !! wikitext
10956 [[{{echo|Foo}}|bar]]
10957 !! html
10958 <p><a href="/wiki/Foo" title="Foo">bar</a>
10959 </p>
10960 !!end
10961
10962 !!test
10963 Templates: Links: 3. Generation of part of a link href
10964 !! wikitext
10965 [[Fo{{echo|o}}|bar]]
10966
10967 [[Foo{{echo|bar}}]]
10968
10969 [[Foo{{echo|bar}}baz]]
10970
10971 [[Foo{{echo|bar}}|bar]]
10972
10973 [[:Foo{{echo|bar}}]]
10974
10975 [[:Foo{{echo|bar}}|bar]]
10976 !! html
10977 <p><a href="/wiki/Foo" title="Foo">bar</a>
10978 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10979 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
10980 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10981 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10982 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
10983 </p>
10984 !!end
10985
10986 !!test
10987 Templates: Links: 4. Multiple templates generating link href
10988 !! wikitext
10989 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
10990 !! html
10991 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
10992 </p>
10993 !!end
10994
10995 !!test
10996 Templates: Links: 5. Generation of link text
10997 !! wikitext
10998 [[Foo|{{echo|bar}}]]
10999 !! html
11000 <p><a href="/wiki/Foo" title="Foo">bar</a>
11001 </p>
11002 !!end
11003
11004 !!test
11005 Templates: Links: 5. Nested templates (only outermost template should be marked)
11006 !! wikitext
11007 {{echo|[[{{echo|Foo}}|bar]]}}
11008 !! html
11009 <p><a href="/wiki/Foo" title="Foo">bar</a>
11010 </p>
11011 !!end
11012
11013 !!test
11014 Templates: HTML Tag: 1. Generation of HTML attr. key
11015 !! wikitext
11016 <div {{echo|style}}="color:red;">foo</div>
11017 !! html
11018 <div style="color:red;">foo</div>
11019
11020 !!end
11021
11022 !!test
11023 Templates: HTML Tag: 2. Generation of HTML attr. value
11024 !! wikitext
11025 <div style={{echo|'color:red;'}}>foo</div>
11026 !! html
11027 <div style="color:red;">foo</div>
11028
11029 !!end
11030
11031 !!test
11032 Templates: HTML Tag: 3. Generation of HTML attr key and value
11033 !! wikitext
11034 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11035 !! html
11036 <div style="color:red;">foo</div>
11037
11038 !!end
11039
11040 !!test
11041 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11042 !! wikitext
11043 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11044 !! html
11045 <div title="This is a long title with just one piece templated">foo</div>
11046
11047 !!end
11048
11049 !!test
11050 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11051 !! wikitext
11052 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11053 !! html
11054 <div title="This is a long title with just one piece templated">foo</div>
11055
11056 !!end
11057
11058 !!test
11059 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11060 !! wikitext
11061 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11062 !! html
11063 <div title="This is a long title with just one piece templated">foo</div>
11064
11065 !!end
11066
11067 # SSS FIXME: While it is great we added support for all this,
11068 # do we want to make this part of the spec? Maybe we want to
11069 # deprecate this kind of usage in the future?
11070 !!test
11071 Templates: HTML Tag: 7. Generation of partial attribute key string
11072 !! wikitext
11073 <div st{{echo|yle}}="color:red;">foo</div>
11074 !! html
11075 <div style="color:red;">foo</div>
11076
11077 !!end
11078
11079 !! test
11080 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11081 !! wikitext
11082 <div {{echo|1=id="v1"}}>bar</div>
11083 !! html
11084 <div id="v1">bar</div>
11085
11086 !!end
11087
11088 !! test
11089 Templates: HTML Tag: 9. Multiple template-generated attributes
11090 !! wikitext
11091 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11092 !! html
11093 <div id="v1" title="foo">bar</div>
11094
11095 !!end
11096
11097 !! test
11098 Templates: Support for templates generating attributes and content
11099 !! wikitext
11100 {| {{mixed_attr_content_template}}
11101 |-
11102 |bar
11103 |}
11104 !! html/php
11105 <table style="color:red;" title="T48811">
11106
11107 <tr>
11108 <td>foo
11109 </td></tr>
11110 <tr>
11111 <td>bar
11112 </td></tr></table>
11113
11114 !! html/parsoid
11115 <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|}"]}'>
11116 <tbody><tr>
11117 <td>foo</td></tr>
11118 <tr>
11119 <td>bar</td></tr>
11120 </tbody></table>
11121 !!end
11122
11123 !! test
11124 1. Entities and nowikis inside templated attributes should be handled correctly
11125 !! wikitext
11126 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11127 !! html/php
11128 <div style="background:#f9f9f9;">foo</div>
11129
11130 !! html/parsoid
11131 <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>
11132 !! end
11133
11134 !! test
11135 2. Entities and nowikis inside templated attributes should be handled correctly
11136 !! wikitext
11137 {|
11138 |{{table_attribs_3}}
11139 |}
11140 !! html/php
11141 <table>
11142 <tr>
11143 <td style="background:#f9f9f9;">Foo
11144 </td></tr></table>
11145
11146 !! html/parsoid
11147 <table>
11148 <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>
11149 </tbody></table>
11150 !! end
11151
11152 !! test
11153 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11154 !! wikitext
11155 {{tbl-start}}
11156 |{{table_attribs_3}}
11157 {{tbl-end}}
11158 !! html/php
11159 <table>
11160 <tr>
11161 <td style="background:#f9f9f9;">Foo
11162 </td></tr></table>
11163
11164 !! html/parsoid
11165 <table about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[],[],[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"tbl-start","href":"./Template:Tbl-start"},"params":{},"i":0}},"\n|",{"template":{"target":{"wt":"table_attribs_3","href":"./Template:Table_attribs_3"},"params":{},"i":1}},"\n",{"template":{"target":{"wt":"tbl-end","href":"./Template:Tbl-end"},"params":{},"i":2}}]}'>
11166 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11167 </tbody></table>
11168 !! end
11169
11170 # T107622
11171 !! test
11172 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11173 !! wikitext
11174 {|
11175 | {{table_attribs_6}} hi
11176 |}
11177 !! html/php
11178 <table>
11179 <tr>
11180 <td style="background: red;"> hi
11181 </td></tr></table>
11182
11183 !! html/parsoid
11184 <table>
11185 <tbody><tr><td style="background: red;" typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":["| ",{"template":{"target":{"wt":"table_attribs_6","href":"./Template:Table_attribs_6"},"params":{},"i":0}}," hi"]}'> hi</td></tr>
11186 </tbody></table>
11187 !! end
11188
11189 !!test
11190 Templates: HTML Tables: 1. Generating start of a HTML table
11191 !! wikitext
11192 {{echo|<table><tr><td>foo</td>}}</tr></table>
11193 !! html
11194 <table><tr><td>foo</td></tr></table>
11195
11196 !!end
11197
11198 !!test
11199 Templates: HTML Tables: 2a. Generating middle of a HTML table
11200 !! wikitext
11201 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11202 !! html
11203 <table><tr><td>foo</td></tr></table>
11204
11205 !!end
11206
11207 !!test
11208 Templates: HTML Tables: 2b. Generating middle of a HTML table
11209 !! wikitext
11210 <table>{{echo|<tr><td>foo</td></tr>}}</table>
11211 !! html
11212 <table><tr><td>foo</td></tr></table>
11213
11214 !!end
11215
11216 !!test
11217 Templates: HTML Tables: 3. Generating end of a HTML table
11218 !! wikitext
11219 <table><tr>{{echo|<td>foo</td></tr></table>}}
11220 !! html
11221 <table><tr><td>foo</td></tr></table>
11222
11223 !!end
11224
11225 !!test
11226 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
11227 !! wikitext
11228 {{echo|<table>}}<tr><td>foo</td></tr></table>
11229 !! html
11230 <table><tr><td>foo</td></tr></table>
11231
11232 !!end
11233
11234 !!test
11235 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
11236 !! wikitext
11237 <table>{{echo|<tr>}}<td>foo</td></tr></table>
11238 !! html
11239 <table><tr><td>foo</td></tr></table>
11240
11241 !!end
11242
11243 !!test
11244 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
11245 !! wikitext
11246 <table><tr>{{echo|<td>}}foo</td></tr></table>
11247 !! html
11248 <table><tr><td>foo</td></tr></table>
11249
11250 !!end
11251
11252 !!test
11253 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
11254 !! wikitext
11255 <table><tr><td>foo{{echo|</td>}}</tr></table>
11256 !! html
11257 <table><tr><td>foo</td></tr></table>
11258
11259 !!end
11260
11261 !!test
11262 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
11263 !! wikitext
11264 <table><tr><td>foo</td>{{echo|</tr>}}</table>
11265 !! html
11266 <table><tr><td>foo</td></tr></table>
11267
11268 !!end
11269
11270 !!test
11271 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
11272 !! wikitext
11273 <table><tr><td>foo</td></tr>{{echo|</table>}}
11274 !! html
11275 <table><tr><td>foo</td></tr></table>
11276
11277 !!end
11278
11279 !!test
11280 Templates: HTML Tables: 5. Proper fostering of categories from inside
11281 !!options
11282 parsoid=wt2html,wt2wt
11283 !! wikitext
11284 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
11285 <!--Two categories (Bug 50330)-->
11286 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
11287 !! html
11288 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
11289 <!--Two categories (Bug 50330)-->
11290 <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>
11291 !!end
11292
11293 !!test
11294 Templates: Wiki Tables: 1a. Fostering of entire template content
11295 !! wikitext
11296 {|
11297 {{echo|a}}
11298 |}
11299 !! html
11300 <table>
11301 a
11302 <tr><td></td></tr></table>
11303
11304 !! html+tidy
11305 <p>a</p>
11306 <table>
11307 <tr>
11308 <td></td>
11309 </tr>
11310 </table>
11311 !! end
11312
11313 !!test
11314 Templates: Wiki Tables: 1b. Fostering of entire template content
11315 !! wikitext
11316 {|
11317 {{echo|<div>}}
11318 foo
11319 {{echo|</div>}}
11320 |}
11321 !! html
11322 <table>
11323 <div>
11324 <p>foo
11325 </p>
11326 </div>
11327 <tr><td></td></tr></table>
11328
11329 !! html+tidy
11330 <div>
11331 <p>foo</p>
11332 </div>
11333 <table>
11334 <tr>
11335 <td></td>
11336 </tr>
11337 </table>
11338 !! end
11339
11340 !!test
11341 Templates: Wiki Tables: 2. Fostering of partial template content
11342 !! wikitext
11343 {|
11344 {{echo|a
11345 <div>b</div>}}
11346 |}
11347 !! html
11348 <table>
11349 a
11350 <div>b</div>
11351 <tr><td></td></tr></table>
11352
11353 !! html+tidy
11354 <p>a</p>
11355 <div>b</div>
11356 <table>
11357 <tr>
11358 <td></td>
11359 </tr>
11360 </table>
11361 !! end
11362
11363 !!test
11364 Templates: Wiki Tables: 3. td-content via multiple templates
11365 !! wikitext
11366 {|
11367 {{echo|{{pipe}}a}}{{echo|b}}
11368 |}
11369 !! html
11370 <table>
11371 <tr>
11372 <td>ab
11373 </td></tr></table>
11374
11375 !!end
11376
11377 !!test
11378 Templates: Wiki Tables: 4. Templated tags, no content
11379 !! wikitext
11380 {{tbl-start}}
11381 {{tbl-end}}
11382 !! html
11383 <table>
11384 <tr><td></td></tr></table>
11385
11386 !!end
11387
11388 !!test
11389 Templates: Wiki Tables: 5. Templated tags, regular td-tags
11390 !! wikitext
11391 {{tbl-start}}
11392 |foo
11393 {{tbl-end}}
11394 !! html
11395 <table>
11396 <tr>
11397 <td>foo
11398 </td></tr></table>
11399
11400 !!end
11401
11402 !!test
11403 Templates: Wiki Tables: 6. Templated tags, templated td-tags
11404 !! wikitext
11405 {{tbl-start}}
11406 {{!}}foo
11407 {{tbl-end}}
11408 !! html
11409 <table>
11410 <tr>
11411 <td>foo
11412 </td></tr></table>
11413
11414 !!end
11415
11416 ## This test case is very specific to Parsoid's internals
11417 ## and is hence only tested for Parsoid's code. Parsoid uses
11418 ## a <meta> marker tag for <ref> tags and they are expanded
11419 ## much later. We are verifying that this <meta> tag usage
11420 ## doesn't prevent foster parenting.
11421 !!test
11422 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
11423 !!wikitext
11424 {{PartialTable}}<ref>foo</ref>
11425 |}
11426
11427 <references />
11428 !!html/parsoid
11429 <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"PartialTable","href":"./Template:PartialTable"},"params":{},"i":0}},"&lt;ref>foo&lt;/ref>\n|}"]}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span><table about="#mwt2">
11430 <tbody>
11431 </tbody></table>
11432
11433 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
11434 !!end
11435
11436 !! test
11437 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
11438 !! wikitext
11439 {{echo|
11440 {{{!}}
11441 {{!}}-}}
11442 <onlyinclude>
11443 |foo
11444 </onlyinclude>
11445 {{!}}}
11446 !! html/parsoid
11447 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n{{{!}}\n{{!}}-"}},"i":0}},"\n&lt;onlyinclude>\n|foo\n&lt;/onlyinclude>\n{{!}}}"]}'>
11448 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
11449 <tbody><tr>
11450
11451 <td>foo
11452 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
11453 </tbody></table>
11454 !! end
11455
11456 !!test
11457 Templates: Lists: Multi-line list-items via templates
11458 !! wikitext
11459 *{{echo|a {{nonexistent|
11460 unused}}}}
11461 *{{echo|b {{nonexistent|
11462 unused}}}}
11463 !! html
11464 <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>
11465 <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>
11466
11467 !!end
11468
11469 !!test
11470 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
11471 !! wikitext
11472 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
11473 !! html
11474 <p><i>ab</i>c<i>d</i>e
11475 </p>
11476 !!end
11477
11478 !!test
11479 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
11480 (PHP parser generates misnested html)
11481 !! wikitext
11482 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
11483 !! html/parsoid
11484 <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>
11485 !!end
11486
11487 !!test
11488 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
11489 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
11490 !! options
11491 parsoid=wt2html,wt2wt
11492 !! wikitext
11493 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
11494 !! html
11495 <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>
11496 <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>
11497 <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>
11498 !!end
11499
11500 !!test
11501 Templates: Ugly nesting: 4. Divs opened/closed across templates
11502 !! wikitext
11503 a<div>b{{echo|c</div>d}}e
11504 !! html
11505 a<div>bc</div>de
11506
11507 !! html+tidy
11508 <p>a</p>
11509 <div>bc</div>
11510 <p>de</p>
11511 !! end
11512
11513 !!test
11514 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
11515 (Parsoid-centric)
11516 !! options
11517 parsoid
11518 !! wikitext
11519 {|
11520 |{{echo|foo</table>}}
11521 |bar
11522 |}
11523 !! html
11524 <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|}"]}'>
11525
11526 <tbody>
11527 <tr>
11528 <td>foo</td></tr></tbody></table><span about="#mwt1">
11529 </span><span about="#mwt1">|bar</span><span about="#mwt1">
11530 |}</span>
11531 !!end
11532
11533 !!test
11534 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
11535 (Parsoid-centric)
11536 !! options
11537 parsoid
11538 !! wikitext
11539 <table>
11540 <tr>
11541 <td>
11542 <table>
11543 <tr>
11544 <td>1. {{echo|foo </table>}}</td>
11545 <td> bar </td>
11546 <td>2. {{echo|baz </table>}}</td>
11547 </tr>
11548 <tr>
11549 <td>abc</td>
11550 </tr>
11551 </table>
11552 </td>
11553 </tr>
11554 <tr>
11555 <td>xyz</td>
11556 </tr>
11557 </table>
11558 !! html
11559 <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>"]}'>
11560 <tbody><tr>
11561 <td>
11562 <table>
11563 <tbody><tr>
11564 <td>1. foo </td></tr></tbody></table></td>
11565 <td> bar </td>
11566 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
11567 </span><span about="#mwt2">
11568 </span><span about="#mwt2">
11569 </span><span about="#mwt2">abc</span><span about="#mwt2">
11570 </span><span about="#mwt2">
11571 </span><span about="#mwt2">
11572 </span><span about="#mwt2">
11573 </span><span about="#mwt2">
11574 </span><span about="#mwt2">
11575 </span><span about="#mwt2">xyz</span><span about="#mwt2">
11576 </span><span about="#mwt2">
11577 </span>
11578 !!end
11579
11580 !! test
11581 Templates: Ugly templates: 3. newline-only template parameter
11582 !! wikitext
11583 foo {{echo|
11584 }}
11585 !! html
11586 <p>foo
11587 </p>
11588 !! end
11589
11590 # This looks like a bug: a single newline triggers p/br for some reason.
11591 !! test
11592 Templates: Ugly templates: 4. newline-only template parameter inconsistency
11593 !! wikitext
11594 {{echo|
11595 }}
11596 !! html
11597 <p><br />
11598 </p>
11599 !! end
11600
11601 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
11602 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
11603 !! test
11604 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
11605 !! wikitext
11606 {{echo|<table>}}
11607 {{echo|<div>foo}}
11608 {{echo|</table>}}
11609 !! html/parsoid
11610 <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
11611 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11612 </table>
11613 !! end
11614
11615 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
11616 # that are "identical" and generate nesting cycles in the algorithm
11617 !! test
11618 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
11619 !! wikitext
11620 {{echo|<table><tr><td><table>}}
11621 {{echo|<div>}}
11622 {{echo|</div>}}
11623 !! html/parsoid
11624 <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"}'>
11625 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11626 </table></td></tr></tbody></table>
11627 !! end
11628
11629 !!test
11630 Parser Functions: 1. Simple example
11631 !! wikitext
11632 {{uc:foo}}
11633 !! html
11634 <p>FOO
11635 </p>
11636 !!end
11637
11638 !!test
11639 Parser Functions: 2. Nested use (only outermost should be marked up)
11640 !! wikitext
11641 {{uc:{{lc:FOO}}}}
11642 !! html
11643 <p>FOO
11644 </p>
11645 !!end
11646
11647 ###
11648 ### Pre-save transform tests
11649 ###
11650 !! test
11651 pre-save transform: subst:
11652 !! options
11653 pst
11654 !! wikitext
11655 {{subst:test}}
11656 !! html/php
11657 This is a test template
11658 !! end
11659
11660 !! test
11661 pre-save transform: normal template
11662 !! options
11663 pst
11664 !! wikitext
11665 {{test}}
11666 !! html/php
11667 {{test}}
11668 !! end
11669
11670 !! test
11671 pre-save transform: nonexistent template
11672 !! options
11673 pst
11674 !! wikitext
11675 {{thistemplatedoesnotexist}}
11676 !! html/php
11677 {{thistemplatedoesnotexist}}
11678 !! end
11679
11680 !! test
11681 pre-save transform: subst magic variables
11682 !! options
11683 pst
11684 !! wikitext
11685 {{subst:SITENAME}}
11686 !! html/php
11687 MediaWiki
11688 !! end
11689
11690 # This is bug 89, which I fixed. -- wtm
11691 !! test
11692 pre-save transform: subst: templates with parameters
11693 !! options
11694 pst
11695 !! wikitext
11696 {{subst:paramtest|param="something else"}}
11697 !! html/php
11698 This is a test template with parameter "something else"
11699 !! end
11700
11701 !! article
11702 Template:nowikitest
11703 !! text
11704 <nowiki>'''not wiki'''</nowiki>
11705 !! endarticle
11706
11707 !! test
11708 pre-save transform: nowiki in subst (bug 1188)
11709 !! options
11710 pst
11711 !! wikitext
11712 {{subst:nowikitest}}
11713 !! html/php
11714 <nowiki>'''not wiki'''</nowiki>
11715 !! end
11716
11717 !! article
11718 Template:commenttest
11719 !! text
11720 This template has <!-- a comment --> in it.
11721 !! endarticle
11722
11723 !! test
11724 pre-save transform: comment in subst (bug 1936)
11725 !! options
11726 pst
11727 !! wikitext
11728 {{subst:commenttest}}
11729 !! html/php
11730 This template has <!-- a comment --> in it.
11731 !! end
11732
11733 !! test
11734 pre-save transform: unclosed tag
11735 !! options
11736 pst noxml
11737 !! wikitext
11738 <nowiki>'''not wiki'''
11739 !! html/php
11740 <nowiki>'''not wiki'''
11741 !! end
11742
11743 !! test
11744 pre-save transform: mixed tag case
11745 !! options
11746 pst noxml
11747 !! wikitext
11748 <NOwiki>'''not wiki'''</noWIKI>
11749 !! html/php
11750 <NOwiki>'''not wiki'''</noWIKI>
11751 !! end
11752
11753 !! test
11754 pre-save transform: unclosed comment in <nowiki>
11755 !! options
11756 pst noxml
11757 !! wikitext
11758 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
11759 !! html/php
11760 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
11761 !!end
11762
11763 # Leading @ in this template definition works around a limitation
11764 # in parsoid's parserTests which otherwise strips the <span> from the
11765 # result (confusing it for a template wrapper)
11766 !! article
11767 Template:dangerous
11768 !!text
11769 @<span onmouseover="alert('crap')">Oh no</span>
11770 !!endarticle
11771
11772 !!test
11773 (confirming safety of fix for subst bug 1936)
11774 !! wikitext
11775 {{Template:dangerous}}
11776 !! html
11777 <p>@<span>Oh no</span>
11778 </p>
11779 !! end
11780
11781 !! test
11782 pre-save transform: comment containing gallery (bug 5024)
11783 !! options
11784 pst
11785 !! wikitext
11786 <!-- <gallery>data</gallery> -->
11787 !! html/php
11788 <!-- <gallery>data</gallery> -->
11789 !!end
11790
11791 !! test
11792 pre-save transform: comment containing extension
11793 !! options
11794 pst
11795 !! wikitext
11796 <!-- <tag>data</tag> -->
11797 !! html/php
11798 <!-- <tag>data</tag> -->
11799 !!end
11800
11801 !! test
11802 pre-save transform: comment containing nowiki
11803 !! options
11804 pst
11805 !! wikitext
11806 <!-- <nowiki>data</nowiki> -->
11807 !! html/php
11808 <!-- <nowiki>data</nowiki> -->
11809 !!end
11810
11811 !! test
11812 pre-save transform: <noinclude> in subst (bug 3298)
11813 !! options
11814 pst
11815 !! wikitext
11816 {{subst:Includes}}
11817 !! html/php
11818 Foobar
11819 !! end
11820
11821 !! test
11822 pre-save transform: <onlyinclude> in subst (bug 3298)
11823 !! options
11824 pst
11825 !! wikitext
11826 {{subst:Includes2}}
11827 !! html/php
11828 Foo
11829 !! end
11830
11831 !! article
11832 Template:SubstTest
11833 !!text
11834 {{<includeonly>subst:</includeonly>Includes}}
11835 !! endarticle
11836
11837 !! article
11838 Template:SafeSubstTest
11839 !! text
11840 {{<includeonly>safesubst:</includeonly>Includes}}
11841 !! endarticle
11842
11843 !! test
11844 bug 22297: safesubst: works during PST
11845 !! options
11846 pst
11847 !! wikitext
11848 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
11849 !! html/php
11850 FoobarFoobar
11851 !! end
11852
11853 !! test
11854 bug 22297: safesubst: works during normal parse
11855 !! wikitext
11856 {{SafeSubstTest}}
11857 !! html
11858 <p>Foobar
11859 </p>
11860 !! end
11861
11862 !! test
11863 subst: does not work during normal parse
11864 !! wikitext
11865 {{SubstTest}}
11866 !! html
11867 <p>{{subst:Includes}}
11868 </p>
11869 !! end
11870
11871 !! test
11872 pre-save transform: context links ("pipe trick")
11873 !! options
11874 pst
11875 !! wikitext
11876 [[Article (context)|]]
11877 [[Bar:Article|]]
11878 [[:Bar:Article|]]
11879 [[Bar:Article (context)|]]
11880 [[:Bar:Article (context)|]]
11881 [[|Article]]
11882 [[|Article (context)]]
11883 [[Bar:X (Y) Z|]]
11884 [[:Bar:X (Y) Z|]]
11885 !! html/php
11886 [[Article (context)|Article]]
11887 [[Bar:Article|Article]]
11888 [[:Bar:Article|Article]]
11889 [[Bar:Article (context)|Article]]
11890 [[:Bar:Article (context)|Article]]
11891 [[Article]]
11892 [[Article (context)]]
11893 [[Bar:X (Y) Z|X (Y) Z]]
11894 [[:Bar:X (Y) Z|X (Y) Z]]
11895 !! end
11896
11897 !! test
11898 pre-save transform: context links ("pipe trick") with interwiki prefix
11899 !! options
11900 pst
11901 !! wikitext
11902 [[interwiki:Article|]]
11903 [[:interwiki:Article|]]
11904 [[interwiki:Bar:Article|]]
11905 [[:interwiki:Bar:Article|]]
11906 !! html/php
11907 [[interwiki:Article|Article]]
11908 [[:interwiki:Article|Article]]
11909 [[interwiki:Bar:Article|Bar:Article]]
11910 [[:interwiki:Bar:Article|Bar:Article]]
11911 !! end
11912
11913 !! test
11914 pre-save transform: context links ("pipe trick") with parens in title
11915 !! options
11916 pst title=[[Somearticle (context)]]
11917 !! wikitext
11918 [[|Article]]
11919 !! html/php
11920 [[Article (context)|Article]]
11921 !! end
11922
11923 !! test
11924 pre-save transform: context links ("pipe trick") with comma in title
11925 !! options
11926 pst title=[[Someplace, Somewhere]]
11927 !! wikitext
11928 [[|Otherplace]]
11929 [[Otherplace, Elsewhere|]]
11930 [[Otherplace, Elsewhere, Anywhere|]]
11931 !! html/php
11932 [[Otherplace, Somewhere|Otherplace]]
11933 [[Otherplace, Elsewhere|Otherplace]]
11934 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
11935 !! end
11936
11937 !! test
11938 pre-save transform: context links ("pipe trick") with parens and comma
11939 !! options
11940 pst title=[[Someplace (IGNORED), Somewhere]]
11941 !! wikitext
11942 [[|Otherplace]]
11943 [[Otherplace (place), Elsewhere|]]
11944 !! html/php
11945 [[Otherplace, Somewhere|Otherplace]]
11946 [[Otherplace (place), Elsewhere|Otherplace]]
11947 !! end
11948
11949 !! test
11950 pre-save transform: context links ("pipe trick") with comma and parens
11951 !! options
11952 pst title=[[Who, me? (context)]]
11953 !! wikitext
11954 [[|Yes, you.]]
11955 [[Me, Myself, and I (1937 song)|]]
11956 !! html/php
11957 [[Yes, you. (context)|Yes, you.]]
11958 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
11959 !! end
11960
11961 !! test
11962 pre-save transform: context links ("pipe trick") with namespace
11963 !! options
11964 pst title=[[Ns:Somearticle]]
11965 !! wikitext
11966 [[|Article]]
11967 !! html/php
11968 [[Ns:Article|Article]]
11969 !! end
11970
11971 !! test
11972 pre-save transform: context links ("pipe trick") with namespace and parens
11973 !! options
11974 pst title=[[Ns:Somearticle (context)]]
11975 !! wikitext
11976 [[|Article]]
11977 !! html/php
11978 [[Ns:Article (context)|Article]]
11979 !! end
11980
11981 !! test
11982 pre-save transform: context links ("pipe trick") with namespace and comma
11983 !! options
11984 pst title=[[Ns:Somearticle, Context, Whatever]]
11985 !! wikitext
11986 [[|Article]]
11987 !! html/php
11988 [[Ns:Article, Context, Whatever|Article]]
11989 !! end
11990
11991 !! test
11992 pre-save transform: context links ("pipe trick") with namespace, comma and parens
11993 !! options
11994 pst title=[[Ns:Somearticle, Context (context)]]
11995 !! wikitext
11996 [[|Article]]
11997 !! html/php
11998 [[Ns:Article (context)|Article]]
11999 !! end
12000
12001 !! test
12002 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12003 !! options
12004 pst title=[[Ns:Somearticle (IGNORED), Context]]
12005 !! wikitext
12006 [[|Article]]
12007 !! html/php
12008 [[Ns:Article, Context|Article]]
12009 !! end
12010
12011 !! test
12012 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12013 !! options
12014 pst
12015 !! wikitext
12016 [[Article(context)|]]
12017 [[Bar:Article(context)|]]
12018 [[:Bar:Article(context)|]]
12019 [[|Article(context)]]
12020 [[Bar:X(Y)Z|]]
12021 [[:Bar:X(Y)Z|]]
12022 !! html/php
12023 [[Article(context)|Article]]
12024 [[Bar:Article(context)|Article]]
12025 [[:Bar:Article(context)|Article]]
12026 [[Article(context)]]
12027 [[Bar:X(Y)Z|X(Y)Z]]
12028 [[:Bar:X(Y)Z|X(Y)Z]]
12029 !! end
12030
12031 !! test
12032 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12033 !! options
12034 pst
12035 !! wikitext
12036 [[Article (context)|]]
12037 [[Bar:Article (context)|]]
12038 [[:Bar:Article (context)|]]
12039 [[|Article (context)]]
12040 [[Bar:X (Y) Z|]]
12041 [[:Bar:X (Y) Z|]]
12042 !! html/php
12043 [[Article (context)|Article]]
12044 [[Bar:Article (context)|Article]]
12045 [[:Bar:Article (context)|Article]]
12046 [[Article (context)]]
12047 [[Bar:X (Y) Z|X (Y) Z]]
12048 [[:Bar:X (Y) Z|X (Y) Z]]
12049 !! end
12050
12051 !! test
12052 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12053 !! options
12054 pst
12055 !! wikitext
12056 [[Article(context)|]]
12057 [[Bar:Article(context)|]]
12058 [[:Bar:Article(context)|]]
12059 [[|Article(context)]]
12060 [[Bar:X(Y)Z|]]
12061 [[:Bar:X(Y)Z|]]
12062 !! html/php
12063 [[Article(context)|Article]]
12064 [[Bar:Article(context)|Article]]
12065 [[:Bar:Article(context)|Article]]
12066 [[Article(context)]]
12067 [[Bar:X(Y)Z|X(Y)Z]]
12068 [[:Bar:X(Y)Z|X(Y)Z]]
12069 !! end
12070
12071 !! test
12072 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12073 !! options
12074 pst
12075 !! wikitext
12076 [[Article (context), context|]]
12077 [[Article (context),context|]]
12078 [[Bar:Article (context), context|]]
12079 [[Bar:Article (context),context|]]
12080 [[:Bar:Article (context), context|]]
12081 [[:Bar:Article (context),context|]]
12082 !! html/php
12083 [[Article (context), context|Article]]
12084 [[Article (context),context|Article]]
12085 [[Bar:Article (context), context|Article]]
12086 [[Bar:Article (context),context|Article]]
12087 [[:Bar:Article (context), context|Article]]
12088 [[:Bar:Article (context),context|Article]]
12089 !! end
12090
12091 !! test
12092 pre-save transform: trim trailing empty lines
12093 !! options
12094 pst
12095 !! wikitext
12096 Empty lines are trimmed
12097
12098
12099
12100
12101 !! html/php
12102 Empty lines are trimmed
12103 !! end
12104
12105 !! test
12106 pre-save transform: Signature expansion
12107 !! options
12108 pst
12109 !! wikitext
12110 * ~~~
12111 * <noinclude>~~~</noinclude>
12112 * <includeonly>~~~</includeonly>
12113 * <onlyinclude>~~~</onlyinclude>
12114 !! html/php
12115 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12116 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12117 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12118 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12119 !! end
12120
12121
12122 !! test
12123 pre-save transform: Signature expansion in nowiki tags (bug 93)
12124 !! options
12125 pst disabled
12126 !! wikitext
12127 Shall not expand:
12128
12129 <nowiki>~~~~</nowiki>
12130
12131 <includeonly><nowiki>~~~~</nowiki></includeonly>
12132
12133 <noinclude><nowiki>~~~~</nowiki></noinclude>
12134
12135 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12136
12137 {{subst:Foo}} shall be converted to FOO
12138
12139 As well as inside noinclude/onlyinclude
12140 <noinclude>{{subst:Foo}}</noinclude>
12141 <onlyinclude>{{subst:Foo}}</onlyinclude>
12142
12143 But not inside includeonly
12144 <includeonly>{{subst:Foo}}</includeonly>
12145 !! html/php
12146 Shall not expand:
12147
12148 <nowiki>~~~~</nowiki>
12149
12150 <includeonly><nowiki>~~~~</nowiki></includeonly>
12151
12152 <noinclude><nowiki>~~~~</nowiki></noinclude>
12153
12154 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12155
12156 FOO shall be converted to FOO
12157
12158 As well as inside noinclude/onlyinclude
12159 <noinclude>FOO</noinclude>
12160 <onlyinclude>FOO</onlyinclude>
12161
12162 But not inside includeonly
12163 <includeonly>{{subst:Foo}}</includeonly>
12164 !! end
12165
12166 !! test
12167 Parsoid: Recognize nowiki with trailing space in tags
12168 !! options
12169 parsoid=wt2html
12170 !! wikitext
12171 <nowiki ><div>[[foo]]</nowiki >
12172
12173 a<nowiki / >b
12174
12175 c<nowiki />d
12176
12177 e<nowiki/ >f
12178 !! html
12179 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12180 <p>ab</p>
12181 <p>cd</p>
12182 <p>ef</p>
12183 !! end
12184
12185 !! test
12186 Parsoid: Recognize nowiki with odd capitalization
12187 !! options
12188 parsoid=wt2html
12189 !! wikitext
12190 <noWikI ><div>[[foo]]</Nowiki >
12191 !! html
12192 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12193 !! end
12194
12195
12196 !! test
12197 Parsoid: Escape nowiki with trailing space in tags
12198 !! options
12199 parsoid=html2wt
12200 !! html/parsoid
12201 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12202 <p>a&lt;nowiki /&gt;b</p>
12203 <p>c&lt;nowiki/ &gt;d</p>
12204 !! wikitext
12205 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12206
12207 a&lt;nowiki /&gt;b
12208
12209 c&lt;nowiki/ &gt;d
12210 !! end
12211
12212 !! test
12213 Parsoid: Escape weird noWikI capitalizations
12214 !! options
12215 parsoid=html2wt
12216 !! html/parsoid
12217 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
12218 !! wikitext
12219 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
12220 !! end
12221
12222 ###
12223 ### Message transform tests
12224 ###
12225 !! test
12226 message transform: magic variables
12227 !! options
12228 msg
12229 !! wikitext
12230 {{SITENAME}}
12231 !! html
12232 MediaWiki
12233 !! end
12234
12235 !! test
12236 message transform: should not transform wiki markup
12237 !! options
12238 msg
12239 !! wikitext
12240 ''test''
12241 !! html
12242 ''test''
12243 !! end
12244
12245 !! test
12246 message transform: <noinclude> in transcluded template (bug 4926)
12247 !! options
12248 msg
12249 !! wikitext
12250 {{Includes}}
12251 !! html
12252 Foobar
12253 !! end
12254
12255 !! test
12256 message transform: <onlyinclude> in transcluded template (bug 4926)
12257 !! options
12258 msg
12259 !! wikitext
12260 {{Includes2}}
12261 !! html
12262 Foo
12263 !! end
12264
12265 !! test
12266 {{#special:}} page name, known
12267 !! options
12268 msg
12269 !! wikitext
12270 {{#special:Recentchanges}}
12271 !! html
12272 Special:RecentChanges
12273 !! end
12274
12275 !! test
12276 {{#special:}} page name with subpage, known
12277 !! options
12278 msg
12279 !! wikitext
12280 {{#special:Recentchanges/param}}
12281 !! html
12282 Special:RecentChanges/param
12283 !! end
12284
12285 !! test
12286 {{#special:}} page name, unknown
12287 !! options
12288 msg
12289 !! wikitext
12290 {{#special:foobar nonexistent}}
12291 !! html
12292 Special:Foobar nonexistent
12293 !! end
12294
12295 !! test
12296 {{#speciale:}} page name, known
12297 !! options
12298 msg
12299 !! wikitext
12300 {{#speciale:Recentchanges}}
12301 !! html
12302 Special:RecentChanges
12303 !! end
12304
12305 !! test
12306 {{#speciale:}} page name with subpage, known
12307 !! options
12308 msg
12309 !! wikitext
12310 {{#speciale:Recentchanges/param}}
12311 !! html
12312 Special:RecentChanges/param
12313 !! end
12314
12315 !! test
12316 {{#speciale:}} page name, unknown
12317 !! options
12318 msg
12319 !! wikitext
12320 {{#speciale:foobar nonexistent}}
12321 !! html
12322 Special:Foobar_nonexistent
12323 !! end
12324
12325 ###
12326 ### Images
12327 ###
12328 ### For Parsoid-specific tests, see
12329 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12330
12331 !! test
12332 Simple image
12333 !! options
12334 parsoid=wt2html,wt2wt,html2html
12335 !! wikitext
12336 [[Image:foobar.jpg]]
12337 !! html/php
12338 <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>
12339 </p>
12340 !! html/parsoid
12341 <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>
12342 !! end
12343
12344 !! test
12345 Simple image (using File: namespace, now canonical)
12346 !! wikitext
12347 [[File:Foobar.jpg]]
12348 !! html/php
12349 <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>
12350 </p>
12351 !! html/parsoid
12352 <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>
12353 !! end
12354
12355 !! test
12356 Right-aligned image
12357 !! wikitext
12358 [[File:Foobar.jpg|right]]
12359 !! html/php
12360 <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>
12361
12362 !! html/parsoid
12363 <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>
12364 !! end
12365
12366 !! test
12367 Image with caption
12368 !! wikitext
12369 [[File:Foobar.jpg|right|Caption text]]
12370 !! html/php
12371 <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>
12372
12373 !! html/parsoid
12374 <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>
12375 !! end
12376
12377 !! test
12378 Image with caption, bug 53312 #1
12379 !! wikitext
12380 [[File:Foobar.jpg|right|Caption page stuff]]
12381 !! html/php
12382 <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>
12383
12384 !! html/parsoid
12385 <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>
12386 !! end
12387
12388 !! test
12389 Image with caption, bug 53312 #2
12390 !! wikitext
12391 [[File:Foobar.jpg|right|Caption page=]]
12392 !! html/php
12393 <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>
12394
12395 !! html/parsoid
12396 <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>
12397 !! end
12398
12399 !! test
12400 Image with caption, bug 53312 #3
12401 !! wikitext
12402 [[File:Foobar.jpg|right|Caption page=stuff]]
12403 !! html/php
12404 <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>
12405
12406 !! html/parsoid
12407 <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>
12408 !! end
12409
12410 !! test
12411 Allow empty links in image captions (Bug 60753)
12412 !! options
12413 thumbsize=220
12414 !! wikitext
12415 [[File:Foobar.jpg|thumb|Caption [[Link1]]
12416 [[]]
12417 [[Link2]]
12418 ]]
12419 !! html/php
12420 <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>
12421
12422 !! html/parsoid
12423 <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>
12424 [[]]
12425 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
12426 </figcaption></figure>
12427 !! end
12428
12429 !! test
12430 Titles in unlinked images (T23454)
12431 !! wikitext
12432 [[File:Foobar.jpg|link=|stuff]]
12433 !! html/php
12434 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
12435 </p>
12436 !! end
12437
12438 !! test
12439 Link with empty target
12440 !! wikitext
12441 [[]]
12442 !! html
12443 <p>[[]]
12444 </p>
12445 !! end
12446
12447 !! test
12448 Image with link trail
12449 !! wikitext
12450 Linktrails should not work for images: [[File:Foobar.jpg]]s
12451 !! html/php
12452 <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
12453 </p>
12454 !! html/parsoid
12455 <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>
12456 !! end
12457
12458 !! test
12459 Image with empty attribute
12460 !! options
12461 parsoid=wt2html,wt2wt,html2html
12462 !! wikitext
12463 [[File:Foobar.jpg|right||Caption text]]
12464 !! html/php
12465 <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>
12466
12467 !! html/parsoid
12468 <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>
12469 !! end
12470
12471 !! test
12472 1. Block image with individual attributes from templates
12473 !! wikitext
12474 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
12475 !! html/php
12476 <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>
12477
12478 !! html/parsoid
12479 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[24,38,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
12480 !! end
12481
12482 !! test
12483 2. Block Image with individual attributes from templates
12484 !! wikitext
12485 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
12486 !! html/php
12487 <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>
12488
12489 !! html/parsoid
12490 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt3" data-mw='{"attribs":[["thumbnail",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[18,32,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;thumb&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">thumb&lt;/span>"}],["width",{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[33,47,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
12491 !! end
12492
12493 !! test
12494 3. Inline image with individual attributes from templates
12495 !! wikitext
12496 [[File:Foobar.jpg|{{echo|50px}}]]
12497 !! html/php
12498 <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>
12499 </p>
12500 !! html/parsoid
12501 <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>
12502 !! end
12503
12504 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
12505 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
12506 !! test
12507 Image with multiple attributes from the same template
12508 !! wikitext
12509 [[File:Foobar.jpg|{{image_attribs}}]]
12510 !! html/php
12511 <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>
12512
12513 !! html/parsoid
12514 <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>
12515 !! end
12516
12517 !! test
12518 Image with link tails
12519 !! options
12520 thumbsize=220
12521 !! wikitext
12522 123[[File:Foobar.jpg]]456
12523 123[[File:Foobar.jpg|right]]456
12524 123[[File:Foobar.jpg|thumb]]456
12525 !! html/php
12526 <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
12527 </p>
12528 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
12529 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
12530
12531 !! html/php+tidy
12532 <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>
12533 <p>123</p>
12534 <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>
12535 <p>456 123</p>
12536 <div class="thumb tright">
12537 <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>
12538 <div class="thumbcaption">
12539 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
12540 </div>
12541 </div>
12542 </div>
12543 <p>456</p>
12544 !! html/parsoid
12545 <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>
12546 <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>
12547 <p>123</p><figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></figure><p>456</p>
12548 !! end
12549
12550 !! test
12551 Image with multiple captions -- only last one is accepted
12552 !! wikitext
12553 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
12554 !! html/php
12555 <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>
12556
12557 !! html/parsoid
12558 <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>
12559 !! end
12560
12561 !! test
12562 Image with multiple widths -- use last
12563 !! wikitext
12564 [[File:Foobar.jpg|200px|300px|caption]]
12565 !! html/php
12566 <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>
12567 </p>
12568 !! html/parsoid
12569 <p><span typeof="mw:Image" data-mw='{"caption":"caption"}'><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></span></p>
12570 !! end
12571
12572 !! test
12573 Image with multiple alignments -- use first (bug 48664)
12574 !! options
12575 thumbsize=220
12576 !! wikitext
12577 [[File:Foobar.jpg|thumb|left|right|center|caption]]
12578
12579 [[File:Foobar.jpg|middle|text-top|caption]]
12580 !! html/php
12581 <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>
12582 <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>
12583 </p>
12584 !! html/parsoid
12585 <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/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12586 <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>
12587 !! end
12588
12589 !! test
12590 Image with width attribute at different positions
12591 !! wikitext
12592 [[File:Foobar.jpg|200px|right|Caption]]
12593 [[File:Foobar.jpg|right|200px|Caption]]
12594 [[File:Foobar.jpg|right|Caption|200px]]
12595 !! html/php
12596 <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>
12597 <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>
12598 <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>
12599
12600 !! html/parsoid
12601 <figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
12602 <figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
12603 <figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
12604 !! end
12605
12606 # a sad bit of backward-compatibility
12607 !! test
12608 Image with size specified with pxpx (bug 13500, 51628)
12609 !! options
12610 parsoid=wt2html,wt2wt,html2html
12611 !! wikitext
12612 [[File:Foobar.jpg|20pxpx]]
12613 [[File:Foobar.jpg|200x20pxpx]]
12614 !! html/php
12615 <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>
12616 <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>
12617 </p>
12618 !! html/parsoid
12619 <p><span typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/20px-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/thumb/3/3a/Foobar.jpg/177px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="20" width="177"/></a></span></p>
12620 !! end
12621
12622 !! test
12623 Image with link parameter, wiki target
12624 !! wikitext
12625 [[File:Foobar.jpg|link=Main Page]]
12626 !! html/php
12627 <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>
12628 </p>
12629 !! html/parsoid
12630 <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>
12631 !! end
12632
12633 # parsoid bug 49293 (part 1)
12634 !! test
12635 Image with link parameter, URL target
12636 !! wikitext
12637 [[File:Foobar.jpg|link=http://example.com/]]
12638 !! html/php
12639 <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>
12640 </p>
12641 !! html/parsoid
12642 <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>
12643 !! end
12644
12645 # parsoid bug 49293 (part 2)
12646 !! test
12647 Image with link parameter, protocol-less URL target
12648 !! wikitext
12649 [[File:Foobar.jpg|link=//example.com/]]
12650 !! html/php
12651 <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>
12652 </p>
12653 !! html/parsoid
12654 <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>
12655 !! end
12656
12657 !! test
12658 Escaping non-block captions (T107435)
12659 !! options
12660 parsoid={
12661 "modes": ["wt2wt"],
12662 "changes": [
12663 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
12664 ]
12665 }
12666 !! wikitext
12667 [[Image:Foobar.jpg|caption]]
12668 !! wikitext/edited
12669 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
12670 !! end
12671
12672 !! test
12673 Image with link parameter, wgExternalLinkTarget
12674 !! wikitext
12675 [[Image:foobar.jpg|link=http://example.com/]]
12676 !! config
12677 wgExternalLinkTarget='foobar'
12678 !! html
12679 <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>
12680 </p>
12681 !! end
12682
12683 !! test
12684 Image with link parameter, wgNoFollowLinks set to false
12685 !! wikitext
12686 [[Image:foobar.jpg|link=http://example.com/]]
12687 !! config
12688 wgNoFollowLinks=false
12689 !! html
12690 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12691 </p>
12692 !! end
12693
12694 !! test
12695 Image with link parameter, wgNoFollowDomainExceptions
12696 !! wikitext
12697 [[Image:foobar.jpg|link=http://example.com/]]
12698 !! config
12699 wgNoFollowDomainExceptions='example.com'
12700 !! html
12701 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12702 </p>
12703 !! end
12704
12705 !! test
12706 Image with link parameter, wgExternalLinkTarget, unnamed parameter
12707 !! wikitext
12708 [[Image:foobar.jpg|link=http://example.com/|Title]]
12709 !! config
12710 wgExternalLinkTarget='foobar'
12711 !! html
12712 <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>
12713 </p>
12714 !! end
12715
12716 !! test
12717 Image with empty link parameter
12718 !! wikitext
12719 [[File:Foobar.jpg|link=]]
12720 !! html/php
12721 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
12722 </p>
12723 !! html/parsoid
12724 <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>
12725 !! end
12726
12727 !! test
12728 Image with link parameter (wiki target) and unnamed parameter
12729 !! wikitext
12730 [[File:Foobar.jpg|link=Main_Page|Title]]
12731 !! html/php
12732 <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>
12733 </p>
12734 !! html/parsoid
12735 <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>
12736 !! end
12737
12738 !! test
12739 Image with link parameter (URL target) and unnamed parameter
12740 !! wikitext
12741 [[File:Foobar.jpg|link=http://example.com/|Title]]
12742 !! html/php
12743 <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>
12744 </p>
12745 !! html/parsoid
12746 <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>
12747 !! end
12748
12749 !! test
12750 Thumbnail image with link parameter
12751 !! options
12752 thumbsize=220
12753 parsoid=wt2html,wt2wt,html2html
12754 !! wikitext
12755 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
12756 !! html/php
12757 <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>
12758
12759 !! html/parsoid
12760 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="http://example.com/"><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"/></a><figcaption>Title</figcaption></figure>
12761 !! end
12762
12763 !! test
12764 Manually-specified thumbnail image
12765 !! options
12766 thumbsize=220
12767 !! wikitext
12768 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
12769 !! html/php
12770 <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>
12771
12772 !! html/parsoid
12773 <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>
12774 !! end
12775
12776 !! test
12777 Manually-specified thumbnail image with explicit link to wiki page
12778 !! options
12779 thumbsize=220
12780 parsoid=wt2html,wt2wt,html2html
12781 !! wikitext
12782 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
12783 !! html/php
12784 <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>
12785
12786 !! html/parsoid
12787 <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>
12788 !! end
12789
12790 !! test
12791 Manually-specified thumbnail image with explicit link to url
12792 !! options
12793 thumbsize=220
12794 parsoid=wt2html,wt2wt,html2html
12795 !! wikitext
12796 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
12797 !! html/php
12798 <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>
12799
12800 !! html/parsoid
12801 <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>
12802 !! end
12803
12804 !! test
12805 Manually-specified thumbnail image with explicit no link
12806 !! options
12807 thumbsize=220
12808 parsoid=wt2html,wt2wt,html2html
12809 !! wikitext
12810 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
12811 !! html/php
12812 <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>
12813
12814 !! html/parsoid
12815 <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>
12816 !! end
12817
12818 !! test
12819 Manually-specified thumbnail image with explicit link and alt text
12820 !! options
12821 thumbsize=220
12822 parsoid=wt2html,wt2wt,html2html
12823 !! wikitext
12824 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
12825 !! html/php
12826 <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>
12827
12828 !! html/parsoid
12829 <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>
12830 !! end
12831
12832 !! test
12833 Image with frame and link
12834 !! options
12835 parsoid=wt2html,wt2wt,html2html
12836 !! wikitext
12837 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
12838 !! html/php
12839 <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>
12840
12841 !! html/parsoid
12842 <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>
12843 !! end
12844
12845 !! test
12846 Image with frame and link and explicit alt
12847 !! options
12848 parsoid=wt2html,wt2wt,html2html
12849 !! wikitext
12850 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
12851 !! html/php
12852 <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>
12853
12854 !! html/parsoid
12855 <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>
12856 !! end
12857
12858 !! test
12859 Image with wiki markup in implicit alt
12860 !! wikitext
12861 [[Image:Foobar.jpg|testing '''bold''' in alt]]
12862
12863 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
12864 !! html/php
12865 <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>
12866 </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>
12867 </p>
12868 !! html/parsoid
12869 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"testing &lt;b data-parsoid=\"{&amp;quot;dsr&amp;quot;:[27,37,3,3]}\">bold&lt;/b> in alt"}'><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" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"Image:Foobar.jpg"}}'/></a></span></p>
12870 <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" data-parsoid='{"a":{"alt":"testing bold in alt","resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"alt":"alt=testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt","resource":"Image:Foobar.jpg"}}'/></a></span></p>
12871 !! end
12872
12873 !! test
12874 Alt image option should handle most kinds of wikitext without barfing
12875 !! wikitext
12876 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
12877 !! html/php
12878 <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>
12879
12880 !! html/parsoid
12881 <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>
12882 !! end
12883
12884 ###################
12885 # Conflicting image format options.
12886 # First option specified should 'win'.
12887 # All three cases in each test should be identical.
12888
12889 !! test
12890 Image with 'frameless' first.
12891 !! options
12892 parsoid=wt2html,wt2wt,html2html
12893 !! wikitext
12894 [[File:Foobar.jpg|frameless|caption]]
12895
12896 [[File:Foobar.jpg|frameless|frame|caption]]
12897
12898 [[File:Foobar.jpg|frameless|thumb|caption]]
12899 !! html/php
12900 <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>
12901 </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>
12902 </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>
12903 </p>
12904 !! html/parsoid
12905 <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/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
12906 <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/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
12907 <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/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
12908 !! end
12909
12910 !! test
12911 Image with 'frame' first.
12912 !! options
12913 parsoid=wt2html,wt2wt,html2html
12914 !! wikitext
12915 [[File:Foobar.jpg|frame|caption]]
12916 [[File:Foobar.jpg|frame|frameless|caption]]
12917 [[File:Foobar.jpg|frame|thumb|caption]]
12918 !! html/php
12919 <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>
12920 <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>
12921 <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>
12922
12923 !! html/parsoid
12924 <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>
12925 <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>
12926 <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>
12927 !! end
12928
12929 !! test
12930 Image with 'thumb' first.
12931 !! options
12932 parsoid=wt2html,wt2wt,html2html
12933 !! wikitext
12934 [[File:Foobar.jpg|thumb|caption]]
12935 [[File:Foobar.jpg|thumb|frameless|caption]]
12936 [[File:Foobar.jpg|thumb|frame|caption]]
12937 !! html/php
12938 <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>
12939 <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>
12940 <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>
12941
12942 !! html/parsoid
12943 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12944 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12945 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12946 !! end
12947
12948 ###################
12949 # Image sizing.
12950 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
12951 # and https://phabricator.wikimedia.org/T64258
12952 # Foobar has actual size of 1941x220
12953 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
12954 # a scalable format.
12955 # 2. Framed images always ignore size options; always render at default size.
12956 # 3. "Unspecified format" and border are the only types which can be
12957 # enlarged.
12958
12959 !! test
12960 Image: "unspecified format" and border enlarge
12961 !! options
12962 parsoid=wt2html,wt2wt,html2html
12963 !! wikitext
12964 [[File:Foobar.jpg|2000px]]
12965
12966 [[File:Foobar.jpg|border|2000px]]
12967 !! html/php
12968 <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>
12969 </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>
12970 </p>
12971 !! html/parsoid
12972 <p><span typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1941px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="227" width="2000"/></a></span></p>
12973 <p><span class="mw-image-border" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1941px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="227" width="2000"/></a></span></p>
12974 !! end
12975
12976 !! test
12977 Image: "unspecified format" and border reduce
12978 !! options
12979 parsoid=wt2html,wt2wt,html2html
12980 !! wikitext
12981 [[File:Foobar.jpg|1000px]]
12982
12983 [[File:Foobar.jpg|border|1000px]]
12984 !! html/php
12985 <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>
12986 </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>
12987 </p>
12988 !! html/parsoid
12989 <p><span typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="113" width="1000"/></a></span></p>
12990 <p><span class="mw-image-border" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="113" width="1000"/></a></span></p>
12991 !! end
12992
12993 !! test
12994 Image: thumbs reduce
12995 !! options
12996 parsoid=wt2html,wt2wt,html2html
12997 !! wikitext
12998 [[File:Foobar.jpg|thumb|50px]]
12999 !! html/php
13000 <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>
13001
13002 !! html/parsoid
13003 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></figure>
13004 !! end
13005
13006 !! test
13007 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13008 !! options
13009 parsoid=wt2html,wt2wt,html2html
13010 !! wikitext
13011 [[File:Foobar.jpg|thumb|2000px]]
13012
13013 [[File:Foobar.svg|thumb|2000px]]
13014 !! html/php
13015 <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>
13016 <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>
13017
13018 !! html/parsoid
13019 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1941px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
13020 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/240px-Foobar.svg" data-file-width="240" data-file-height="180" data-file-type="drawing" height="1500" width="2000"/></a></figure>
13021 !! end
13022
13023 !! test
13024 Image: frameless can reduce in size
13025 !! options
13026 parsoid=wt2html,wt2wt,html2html
13027 !! wikitext
13028 [[File:Foobar.jpg|frameless|50px]]
13029 !! html/php
13030 <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>
13031 </p>
13032 !! html/parsoid
13033 <p><span typeof="mw:Image/Frameless"><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"/></a></span></p>
13034 !! end
13035
13036 !! test
13037 Image: bitmap frameless can't be enlarged past original size, but vector can
13038 !! options
13039 parsoid=wt2html,wt2wt,html2html
13040 !! wikitext
13041 [[File:Foobar.jpg|frameless|2000px]]
13042
13043 [[File:Foobar.svg|frameless|2000px]]
13044 !! html/php
13045 <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>
13046 </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>
13047 </p>
13048 !! html/parsoid
13049 <p><span typeof="mw:Image/Frameless"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1941px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13050 <p><span typeof="mw:Image/Frameless"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/240px-Foobar.svg" data-file-width="240" data-file-height="180" data-file-type="drawing" height="1500" width="2000"/></a></span></p>
13051 !! end
13052
13053 !! test
13054 Image: framed images are always unscaled.
13055 !! options
13056 parsoid=wt2html,wt2wt,html2html
13057 !! wikitext
13058 [[File:Foobar.jpg|frame]]
13059
13060 [[File:Foobar.jpg|frame|50px]]
13061
13062 [[File:Foobar.jpg|frame|50x50px]]
13063
13064 [[File:Foobar.jpg|frame|2000px]]
13065 !! html/php
13066 <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>
13067 <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>
13068 <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>
13069 <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>
13070
13071 !! html/parsoid
13072 <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>
13073 <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>
13074 <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>
13075 <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>
13076 !! end
13077
13078 ###################
13079
13080 !! test
13081 Link to image page- image page normally doesn't exists, hence edit link
13082 Add test with existing image page
13083 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13084 !! wikitext
13085 [[:Image:test]]
13086 !! html
13087 <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>
13088 </p>
13089 !! end
13090
13091 !! test
13092 bug 18784 Link to non-existent image page with caption should use caption as link text
13093 !! wikitext
13094 [[:Image:test|caption]]
13095 !! html
13096 <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>
13097 </p>
13098 !! end
13099
13100 !! test
13101 Frameless image caption with a free URL
13102 !! wikitext
13103 [[File:Foobar.jpg|http://example.com]]
13104 !! html/php
13105 <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>
13106 </p>
13107 !! html/parsoid
13108 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&lt;a rel=\"mw:ExtLink\" href=\"http://example.com\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;url&amp;quot;,&amp;quot;dsr&amp;quot;:[18,36,0,0]}\">http://example.com&lt;/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>
13109 !! end
13110
13111 !! test
13112 Thumbnail image caption with a free URL
13113 !! options
13114 thumbsize=220
13115 !! wikitext
13116 [[File:Foobar.jpg|thumb|http://example.com]]
13117 !! html/php
13118 <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>
13119
13120 !! html/parsoid
13121 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-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>
13122 !! end
13123
13124 !! test
13125 Thumbnail image caption with a free URL and explicit alt
13126 !! options
13127 thumbsize=220
13128 parsoid=wt2html,wt2wt,html2html
13129 !! wikitext
13130 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13131 !! html/php
13132 <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>
13133
13134 !! html/parsoid
13135 <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/thumb/3/3a/Foobar.jpg/220px-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>
13136 !! end
13137
13138 !! test
13139 SVG thumbnails with no language set
13140 !! options
13141 !! wikitext
13142 [[File:Foobar.svg|thumb|caption]]
13143 !! html/php
13144 <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>
13145
13146 !! html/parsoid
13147 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/220px-Foobar.svg" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>caption</figcaption></figure>
13148 !! end
13149
13150 !! test
13151 SVG thumbnails with language de
13152 !! options
13153 parsoid=wt2html,wt2wt,html2html
13154 !! wikitext
13155 [[File:Foobar.svg|thumb|caption|lang=de]]
13156 !! html/php
13157 <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>
13158
13159 !! html/parsoid
13160 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/220px-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>
13161 !! end
13162
13163 !! test
13164 SVG thumbnails with invalid language code
13165 !! options
13166 parsoid=wt2html,wt2wt,html2html
13167 !! wikitext
13168 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
13169 !! html/php
13170 <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>
13171
13172 !! html/parsoid
13173 <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>
13174 !! end
13175
13176 !! test
13177 BUG 1887: A ISBN with a thumbnail
13178 !! wikitext
13179 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
13180 !! html/php
13181 <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>
13182
13183 !! html/parsoid
13184 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-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>
13185 !! end
13186
13187 !! test
13188 BUG 1887: A RFC with a thumbnail
13189 !! wikitext
13190 [[File:Foobar.jpg|thumb|This is RFC 12354]]
13191 !! html/php
13192 <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>
13193
13194 !! html/parsoid
13195 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-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>
13196 !! end
13197
13198 !! test
13199 BUG 1887: A mailto link with a thumbnail
13200 !! wikitext
13201 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
13202 !! html/php
13203 <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>
13204
13205 !! html/parsoid
13206 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-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>
13207 !! end
13208
13209 # Pending resolution to bug 368
13210 !! test
13211 BUG 648: Frameless image caption with a link
13212 !! wikitext
13213 [[File:Foobar.jpg|text with a [[link]] in it]]
13214 !! html/php
13215 <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>
13216 </p>
13217 !! html/parsoid
13218 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with 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;:[30,38,2,2]}\">link&lt;/a> 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>
13219 !! end
13220
13221 !! test
13222 BUG 648: Frameless image caption with a link (suffix)
13223 !! wikitext
13224 [[File:Foobar.jpg|text with a [[link]]foo in it]]
13225 !! html/php
13226 <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>
13227 </p>
13228 !! html/parsoid
13229 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with 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;:[30,41,2,5],&amp;quot;tail&amp;quot;:&amp;quot;foo&amp;quot;}\">linkfoo&lt;/a> 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>
13230 !! end
13231
13232 !! test
13233 BUG 648: Frameless image caption with an interwiki link
13234 !! wikitext
13235 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
13236 !! html/php
13237 <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>
13238 </p>
13239 !! html/parsoid
13240 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a &lt;a rel=\"mw:ExtLink\" href=\"http://www.usemod.com/cgi-bin/mb.pl?Link\" title=\"meatball: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;http://www.usemod.com/cgi-bin/mb.pl?Link&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;MeatBall:Link&amp;quot;},&amp;quot;isIW&amp;quot;:true,&amp;quot;dsr&amp;quot;:[30,47,2,2]}\">MeatBall:Link&lt;/a> 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>
13241 !! end
13242
13243 !! test
13244 BUG 648: Frameless image caption with a piped interwiki link
13245 !! wikitext
13246 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
13247 !! html/php
13248 <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>
13249 </p>
13250 !! html/parsoid
13251 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a &lt;a rel=\"mw:ExtLink\" href=\"http://www.usemod.com/cgi-bin/mb.pl?Link\" title=\"meatball:Link\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;piped&amp;quot;,&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;http://www.usemod.com/cgi-bin/mb.pl?Link&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;MeatBall:Link&amp;quot;},&amp;quot;isIW&amp;quot;:true,&amp;quot;dsr&amp;quot;:[30,52,16,2]}\">link&lt;/a> 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>
13252 !! end
13253
13254 !! test
13255 T107474: Frameless image caption with <nowiki>
13256 !! wikitext
13257 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
13258 !! html/parsoid
13259 <p><span class="mw-default-size" typeof="mw:Image mw:Placeholder" data-mw='{"caption":"&lt;span typeof=\"mw:Nowiki\">text with a [[MeatBall:Link|link]] in it&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="220" width="1941"/></a></span></p>
13260 !! end
13261
13262 !! test
13263 Escape HTML special chars in image alt text
13264 !! wikitext
13265 [[File:Foobar.jpg|& < > "]]
13266 !! html/php
13267 <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>
13268 </p>
13269 !! html/parsoid
13270 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&amp;amp; &amp;lt; &amp;gt; \""}'><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>
13271 !! end
13272
13273 !! test
13274 BUG 499: Alt text should have &#1234;, not &amp;1234;
13275 !! wikitext
13276 [[File:Foobar.jpg|&#9792;]]
13277 !! html/php
13278 <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>
13279 </p>
13280 !! html/parsoid
13281 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=\"{&amp;quot;src&amp;quot;:&amp;quot;&amp;amp;#9792;&amp;quot;,&amp;quot;srcContent&amp;quot;:&amp;quot;♀&amp;quot;,&amp;quot;dsr&amp;quot;:[18,25,null,null]}\">♀&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="220" width="1941"/></a></span></p>
13282 !! end
13283
13284 !! test
13285 Broken image caption with link
13286 !! options
13287 parsoid=wt2html,wt2wt,html2html
13288 !! wikitext
13289 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
13290 !! html/php
13291 <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.
13292 </p>
13293 !! html/parsoid
13294 <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>
13295 !! end
13296
13297 !! test
13298 Image caption containing another image
13299 !! wikitext
13300 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
13301 !! html/php
13302 <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>
13303
13304 !! html/parsoid
13305 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-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>
13306 !! end
13307
13308 !! test
13309 Image: caption containing a newline
13310 !! wikitext
13311 [[File:Foobar.jpg|This
13312 *is some text]]
13313 !! html/php
13314 <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>
13315 </p>
13316 !! html/parsoid
13317 <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>
13318 !!end
13319
13320 !!test
13321 Image: caption containing leading space
13322 (The leading space should not trigger nowiki escaping in wt2wt mode)
13323 !! wikitext
13324 [[File:Foobar.jpg|thumb| bar]]
13325 !! html/php
13326 <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>
13327
13328 !! html/parsoid
13329 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption> bar</figcaption></figure>
13330 !!end
13331
13332 !! test
13333 Image: caption containing a table
13334 !! options
13335 parsoid=wt2html,wt2wt,html2html
13336 !! wikitext
13337 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
13338 {|
13339 ! Foo !! Bar
13340 |-
13341 | Foo1 || Bar1
13342 |}
13343 and some more text.]]
13344 !! html/php
13345 <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>
13346
13347 !! html/parsoid
13348 <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 is an example image thumbnail caption with a table
13349 <table>
13350 <tbody>
13351 <tr><th>Foo </th><th>Bar</th></tr>
13352 <tr>
13353 <td>Foo1 </td>
13354 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
13355 !! end
13356
13357 !! test
13358 Bug 3090: External links other than http: in image captions
13359 !! wikitext
13360 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
13361 !! html/php
13362 <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>
13363
13364 !! html/parsoid
13365 <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 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>
13366 !! end
13367
13368 !! test
13369 Custom class
13370 !! options
13371 parsoid=wt2html,wt2wt,html2html
13372 !! wikitext
13373 [[Image:foobar.jpg|a|class=b]]
13374 !! html/php
13375 <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>
13376 </p>
13377 !! html/parsoid
13378 <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>
13379 !! end
13380
13381 !! test
13382 Localized image handling (1).
13383 !! options
13384 parsoid=wt2html,wt2wt,html2html
13385 language=es
13386 !! wikitext
13387 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
13388 !! html/php
13389 <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>
13390
13391 !! html/parsoid
13392 <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>
13393 !! end
13394
13395 !! test
13396 Localized image handling (2).
13397 !! options
13398 thumbsize=220
13399 parsoid=wt2html,wt2wt,html2html
13400 language=es
13401 !! wikitext
13402 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
13403 !! html/php
13404 <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>
13405
13406 !! html/parsoid
13407 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="Foo"><img resource="./Archivo: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"/></a><figcaption>caption</figcaption></figure>
13408 !! end
13409
13410 !! test
13411 "border", "frameless" and "class" attributes on an image.
13412 !! options
13413 thumbsize=220
13414 parsoid=wt2html,wt2wt,html2html
13415 !! wikitext
13416 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
13417 !! html/php
13418 <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>
13419 </p>
13420 !! html/parsoid
13421 <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/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
13422 !! end
13423
13424 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
13425 !! test
13426 Invalid image attributes (bug 62500)
13427 !! options
13428 thumbsize=220
13429 parsoid=wt2html,wt2wt,html2html
13430 !! wikitext
13431 [[File:Foobar.jpg|thumb|float|left|caption]]
13432
13433 [[File:Foobar.jpg|thumb|righ|caption]]
13434
13435 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
13436 !! html/php
13437 <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>
13438 <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>
13439 <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>
13440
13441 !! html/parsoid
13442 <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/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
13443 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
13444 <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/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
13445 !! end
13446
13447 !! article
13448 File:Barfoo.jpg
13449 !! text
13450 #REDIRECT [[File:Barfoo.jpg]]
13451 !! endarticle
13452
13453 # FIXME: Parsoid should run this test -- but we'd need to teach the
13454 # mockAPI about the redirected Barfoo.jpg image.
13455 !! test
13456 Redirected image
13457 !! wikitext
13458 [[Image:Barfoo.jpg]]
13459 !! html/php
13460 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
13461 </p>
13462 !! end
13463
13464 !! test
13465 Missing image with uploads disabled
13466 !! options
13467 wgEnableUploads=0
13468 !! wikitext
13469 [[File:Foobaz.jpg]]
13470 !! html/php
13471 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
13472 </p>
13473 !! html/parsoid
13474 <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>
13475 !! end
13476
13477 # Parsoid-specific testing for images
13478 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13479 # Currently imperfect due to a flaw in the Parsoid testrunner
13480 # Work in progress
13481 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
13482 # image tests.
13483
13484 !! test
13485 Parsoid-specific image handling - simple image with size and middle alignment
13486 !! wikitext
13487 [[File:Foobar.jpg|middle|50px]]
13488 !! html/parsoid
13489 <p><span class="mw-valign-middle" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
13490 !! end
13491
13492 !! test
13493 Parsoid-specific image handling - simple image with size, middle alignment,
13494 non-standard namespace alias
13495 !! options
13496 parsoid=wt2wt,wt2html,html2html
13497 !! wikitext
13498 [[Image:Foobar.jpg|middle|50px]]
13499 !! html/parsoid
13500 <p><span class="mw-valign-middle" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
13501 !! end
13502
13503 !! test
13504 Parsoid-specific image handling - simple image with size and middle alignment
13505 (existing content)
13506 !! wikitext
13507 [[File:Foobar.jpg|50px|middle]]
13508 !! html/parsoid
13509 <p><span class="mw-valign-middle" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"50px"},{"ck":"middle","ak":"middle"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" 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>
13510 !! end
13511
13512 !! test
13513 Parsoid-specific image handling - simple image with size and middle alignment
13514 and non-standard namespace name
13515 !! options
13516 parsoid=wt2html,wt2wt,html2html
13517 !! wikitext
13518 [[Image:Foobar.jpg|50px|middle]]
13519 !! html/parsoid
13520 <p><span class="mw-valign-middle" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
13521 !! end
13522
13523 !! test
13524 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
13525 !! wikitext
13526 [[File:Foobar.jpg|500x10px|baseline|caption]]
13527 !! html/parsoid
13528 <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>
13529 !! end
13530
13531 !! test
13532 Parsoid-specific image handling - simple image with border and size spec
13533 !! wikitext
13534 [[File:Foobar.jpg|50px|border|caption]]
13535 !! html/parsoid
13536 <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>
13537 !! end
13538
13539 !! test
13540 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13541 !! wikitext
13542 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
13543 !! html/parsoid
13544 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption content</figcaption></figure>
13545 !! end
13546
13547 !! test
13548 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13549 (existing content)
13550 !! wikitext
13551 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
13552 !! html/parsoid
13553 <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/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 content</figcaption></figure>
13554 !! end
13555
13556 !! test
13557 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
13558 !! wikitext
13559 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
13560 !! html/parsoid
13561 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a><figcaption>caption</figcaption></figure>
13562 !! end
13563
13564 !! test
13565 Parsoid-specific image handling - thumbnail with specific size, halign,
13566 valign, and caption (existing content)
13567 !! wikitext
13568 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
13569 !! html/parsoid
13570 <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>
13571 !! end
13572
13573 !! test
13574 Parsoid-specific image handling - framed image with specific size and caption
13575 (size is ignored)
13576 !! options
13577 parsoid=wt2html,wt2wt,html2html
13578 !! wikitext
13579 [[File:Foobar.jpg|frame|500x50px|caption]]
13580 !! html/parsoid
13581 <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>
13582 !! end
13583
13584 !! test
13585 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
13586 (size is ignored)
13587 !! options
13588 parsoid=wt2html,wt2wt,html2html
13589 !! wikitext
13590 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
13591 !! html/parsoid
13592 <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>
13593 !! end
13594
13595 !! test
13596 Parsoid-specific image handling - frameless image with specific size, border, and caption
13597 !! wikitext
13598 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
13599 !! html/parsoid
13600 <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>
13601 !! end
13602
13603 !! test
13604 Parsoid-specific image handling - simple image with a formatted caption
13605 !! wikitext
13606 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
13607 !! html/parsoid
13608 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&lt;table data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[18,81,7,8]}\">&lt;tbody data-parsoid=\"{&amp;quot;dsr&amp;quot;:[25,73,0,0]}\">&lt;tr data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[25,54,4,5]}\">&lt;td data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[29,39,4,5]}\">a&lt;/td>&lt;td data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[39,49,4,5]}\">b&lt;/td>&lt;/tr>&lt;tr data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[54,73,4,5]}\">&lt;td data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[58,68,4,5]}\">c&lt;/td>&lt;/tr>&lt;/tbody>&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>
13609 !! end
13610
13611 !! test
13612 Parsoid-specific image handling - caption with a template in it
13613 !! wikitext
13614 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
13615 !! html/parsoid
13616 <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>
13617 !! end
13618
13619 !! test
13620 Parsoid-specific image handling - caption with unbalanced tags in it
13621 !! options
13622 parsoid=wt2html,wt2wt,html2html
13623 !! wikitext
13624 foo
13625 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
13626 bar
13627 !! html/parsoid
13628 <p>foo</p>
13629 <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 <center>unbalanced tag in it.</center></figcaption></figure>
13630 <p>bar</p>
13631 !! end
13632
13633 !! test
13634 Parsoid-specific image handling - empty caption (1)
13635 !! options
13636 parsoid=wt2html,wt2wt
13637 !! wikitext
13638 [[File:Foobar.jpg|thumb|]]
13639 !! html/parsoid
13640 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption></figcaption></figure>
13641 !! end
13642
13643 # empty captions don't get serialized unless we're in the "round trip" case
13644 !! test
13645 Parsoid-specific image handling - empty caption (2)
13646 !! options
13647 parsoid=html2wt
13648 !! html/parsoid
13649 <figure class="mw-default-size" typeof="mw:Image/Thumb">
13650 <a href="./File:Foobar.jpg">
13651 <img resource="./File:Foobar.jpg"
13652 src="//example.com/images/3/3a/Foobar.jpg"
13653 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
13654 height="25" width="220"/>
13655 </a>
13656 <figcaption></figcaption>
13657 </figure>
13658 !! wikitext
13659 [[File:Foobar.jpg|thumb]]
13660 !! end
13661
13662 !! test
13663 Parsoid-specific image handling - whitespace caption
13664 !! wikitext
13665 [[File:Foobar.jpg|thumb| ]]
13666 !! html/parsoid
13667 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption> </figcaption></figure>
13668 !! end
13669
13670 !! test
13671 Parsoid-specific image handling - lang option
13672 !! wikitext
13673 foo
13674 [[File:Foobar.svg|lang=de|caption]]
13675 bar
13676 !! html/parsoid
13677 <p>foo
13678 <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>
13679 bar</p>
13680 !! end
13681
13682
13683 ###
13684 ### Subpages
13685 ###
13686 !! article
13687 Subpage test/subpage
13688 !! text
13689 foo
13690 !! endarticle
13691
13692 !! test
13693 Subpage link
13694 !! options
13695 subpage title=[[Subpage test]]
13696 !! wikitext
13697 [[/subpage]]
13698 !! html
13699 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
13700 </p>
13701 !! end
13702
13703 !! test
13704 Subpage noslash link
13705 !! options
13706 subpage title=[[Subpage test]]
13707 !! wikitext
13708 [[/subpage/]]
13709 !! html
13710 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
13711 </p>
13712 !! end
13713
13714 !! article
13715 Subpage test/1/2/subpage
13716 !! text
13717 blah
13718 !! endarticle
13719
13720 !! test
13721 Relative subpage noslash link
13722 !! options
13723 parsoid=wt2wt,wt2html,html2html
13724 subpage title=[[Subpage test/1/2/3/4]]
13725 !! wikitext
13726 [[../../subpage/]]
13727
13728 [[../../subpage]]
13729 !! html/php
13730 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
13731 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
13732 </p>
13733 !! html/parsoid
13734 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
13735 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
13736 !! end
13737
13738 !! test
13739 Parsoid: dot-slash prefixed wikilinks
13740 !! wikitext
13741 [[./foo]]
13742
13743 [[././bar]]
13744
13745 [[././baz/]]
13746 !! html/php
13747 <p>[[./foo]]
13748 </p><p>[[././bar]]
13749 </p><p>[[././baz/]]
13750 </p>
13751 !! html/parsoid
13752 <p>[[./foo]]
13753 </p><p>[[././bar]]
13754 </p><p>[[././baz/]]
13755 </p>
13756 !! end
13757
13758 !! test
13759 Render invalid page names as plain text (bug 51090)
13760 !! wikitext
13761 [[./../foo|bar]]
13762 [[foo�|bar]]
13763 [[foo/.|bar]]
13764 [[foo/..|bar]]
13765 [[foo~~~bar]]
13766 [[foo>bar]]
13767 [[foo[bar]]
13768 [[.]]
13769 [[..]]
13770 [[foo././bar]]
13771
13772 [[{{echo|./../foo}}|bar]]
13773 [[{{echo|foo/.}}|bar]]
13774 [[{{echo|foo/..}}|bar]]
13775 [[{{echo|foo~~~~bar}}]]
13776 [[{{echo|foo>bar}}]]
13777 [[{{echo|foo././bar}}]]
13778 [[{{echo|foo{bar}}]]
13779 [[{{echo|foo}bar}}]]
13780 [[{{echo|foo[bar}}]]
13781 [[{{echo|foo]bar}}]]
13782 [[{{echo|foo<bar}}]]
13783 !!html/php
13784 <p>[[./../foo|bar]]
13785 [[foo�|bar]]
13786 [[foo/.|bar]]
13787 [[foo/..|bar]]
13788 [[foo~~~bar]]
13789 [[foo&gt;bar]]
13790 [[foo[bar]]
13791 [[.]]
13792 [[..]]
13793 [[foo././bar]]
13794 </p><p>[[./../foo|bar]]
13795 [[foo/.|bar]]
13796 [[foo/..|bar]]
13797 [[foo~~~~bar]]
13798 [[foo&gt;bar]]
13799 [[foo././bar]]
13800 [[foo{bar]]
13801 [[foo}bar]]
13802 [[foo[bar]]
13803 [[foo]bar]]
13804 [[foo&lt;bar]]
13805 </p>
13806 !!html/parsoid
13807 <p>[[./../foo|bar]]
13808 [[foo�|bar]]
13809 [[foo/.|bar]]
13810 [[foo/..|bar]]
13811 [[foo~~~bar]]
13812 [[foo>bar]]
13813 [[foo[bar]]
13814 [[.]]
13815 [[..]]
13816 [[foo././bar]]</p>
13817
13818 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
13819 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
13820 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
13821 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
13822 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
13823 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
13824 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
13825 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
13826 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
13827 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
13828 [[<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>
13829 !!end
13830
13831 !! test
13832 Disabled subpages
13833 !! wikitext
13834 [[/subpage]]
13835 !! html
13836 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
13837 </p>
13838 !! end
13839
13840 !! test
13841 BUG 561: {{/Subpage}}
13842 !! options
13843 subpage title=[[Page]]
13844 !! wikitext
13845 {{/Subpage}}
13846 !! html
13847 <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>
13848 </p>
13849 !! end
13850
13851 ###
13852 ### Categories
13853 ###
13854 !! article
13855 Category:MediaWiki User's Guide
13856 !! text
13857 blah
13858 !! endarticle
13859
13860 !! test
13861 Link to category
13862 !! wikitext
13863 [[:Category:MediaWiki User's Guide]]
13864 !! html
13865 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
13866 </p>
13867 !! end
13868
13869 !! test
13870 Simple category
13871 !! options
13872 cat
13873 !! wikitext
13874 [[Category:MediaWiki User's Guide]]
13875 !! html
13876 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13877 !! end
13878
13879 !! test
13880 PAGESINCATEGORY invalid title fatal (r33546 fix)
13881 !! wikitext
13882 {{PAGESINCATEGORY:<bogus>}}
13883 !! html
13884 <p>0
13885 </p>
13886 !! end
13887
13888 !! test
13889 Category with different sort key
13890 !! options
13891 cat
13892 !! wikitext
13893 [[Category:MediaWiki User's Guide|Foo]]
13894 !! html
13895 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13896 !! end
13897
13898 !! test
13899 Category with identical sort key
13900 !! options
13901 cat
13902 !! wikitext
13903 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
13904 !! html
13905 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13906 !! end
13907
13908 !! test
13909 Category with empty sort key
13910 !! options
13911 cat
13912 pst
13913 !! wikitext
13914 [[Category:MediaWiki User's Guide|]]
13915 !! html
13916 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
13917 !! end
13918
13919 !! test
13920 Category with empty sort key and parentheses
13921 !! options
13922 cat
13923 pst
13924 !! wikitext
13925 [[Category:Foo (bar)|]]
13926 !! html
13927 [[Category:Foo (bar)|Foo]]
13928 !! end
13929
13930 !! test
13931 Category with link tail
13932 !! options
13933 cat
13934 pst
13935 !! wikitext
13936 123[[Category:Foo]]456
13937 !! html
13938 123[[Category:Foo]]456
13939 !! end
13940
13941 !! test
13942 Category with template
13943 !! options
13944 cat
13945 pst
13946 !! wikitext
13947 [[Category:{{echo|Foo}}]]
13948 !! html
13949 [[Category:{{echo|Foo}}]]
13950 !! end
13951
13952 !! test
13953 Category with template in sort key
13954 !! options
13955 cat
13956 pst
13957 !! wikitext
13958 [[Category:Foo|{{echo|Bar}}]]
13959 !! html
13960 [[Category:Foo|{{echo|Bar}}]]
13961 !! end
13962
13963 !! test
13964 Category with template in sort key and title
13965 !! options
13966 cat
13967 pst
13968 !! wikitext
13969 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
13970 !! html
13971 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
13972 !! end
13973
13974 !! test
13975 Category / paragraph interactions
13976 !! wikitext
13977 Foo [[Category:Baz]] Bar
13978
13979 Foo [[Category:Baz]]
13980 Bar
13981
13982 Foo
13983 [[Category:Baz]]
13984 Bar
13985
13986 Foo
13987 [[Category:Baz]] Bar
13988
13989 Foo
13990 [[Category:Baz]]
13991 [[Category:Baz]]
13992 [[Category:Baz]]
13993 Bar
13994
13995 [[Category:Baz]]
13996 [[Category:Baz]]
13997 [[Category:Baz]]
13998
13999 [[Category:Baz]]
14000 {{echo|[[Category:Baz]]}}
14001 [[Category:Baz]]
14002 !! html
14003 <p>Foo Bar
14004 </p><p>Foo
14005 Bar
14006 </p><p>Foo
14007 Bar
14008 </p><p>Foo Bar
14009 </p><p>Foo
14010 Bar
14011 </p>
14012 !! end
14013
14014 ## The whitespace on the empty line is part of the test. Please do not delete
14015 !! test
14016 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14017 !! options
14018 parsoid=wt2html,wt2wt
14019 !! wikitext
14020 This
14021
14022 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14023
14024 {{echo|[[Category:Foo]] and so should this!}}
14025 !! html
14026 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14027 </p>
14028 !! html/parsoid
14029 <p>This
14030
14031 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14032
14033 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]] and so should this!"}},"i":0}}]}'/><span about="#mwt1"> and so should this!</span></p>
14034 !! end
14035
14036 ## Parsoid will not try to wt2wt this while preserving newlines because
14037 ## it suppresses excess newlines within list items -- and we don't want to
14038 ## introduce a special case just for categories, which is, in reality somewhat
14039 ## odd behavior -- categories are unlikely to be used in list items like this
14040 ## in top-level pages and are only likely to show up in template-generated
14041 ## list items where this RT-ing is a non-issue.
14042 ##
14043 ## The whitespace on the empty line is part of the test. Please do not delete
14044 !! test
14045 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14046 !! options
14047 parsoid=wt2html
14048 !! wikitext
14049 * This
14050
14051 [[Category:Foo]] and this should be part of the same list item
14052 * So should this
14053
14054 {{echo|[[Category:Foo]] and this should be part of the same list item}}
14055 !! html
14056 <ul><li>This and this should be part of the same list item</li>
14057 <li>So should this and this should be part of the same list item</li></ul>
14058 !! html/parsoid
14059 <ul>
14060 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
14061 <li>So should this <link rel="mw:PageProp/Category" href="./Category:Foo" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]] and this should be part of the same list item"}},"i":0}}]}'/><span> and this should be part of the same list item</span></li>
14062 </ul>
14063 !! end
14064
14065 ## Newlines and categories that follow the last item of a list
14066 ## are treated differently because this (list followed by categories)
14067 ## is an extremely common pattern on wikis.
14068 !! test
14069 3. Categories and newlines: newline suppression for last list item should RT properly
14070 !! wikitext
14071 * a
14072 * b
14073
14074 [[Category:Foo]]
14075
14076 [[Category:Bar]]
14077 [[Category:Baz]]
14078 !! html/parsoid
14079 <ul><li> a</li>
14080 <li> b</li></ul>
14081
14082 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14083
14084 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14085 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14086 !! end
14087
14088 !! test
14089 4. Categories and newlines: newline suppression for last list item should RT properly
14090 !! wikitext
14091 * a
14092 **** b
14093
14094 [[Category:Foo]]
14095 !! html/parsoid
14096 <ul><li> a
14097 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
14098
14099 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14100 !! end
14101
14102 ## only wt2html for this to make sure the algo only applies to the rightmost path
14103 !! test
14104 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
14105 !! options
14106 parsoid=wt2html
14107 !! wikitext
14108 * a
14109 ** b
14110 [[Category:Foo]]
14111 * c
14112 ** d
14113 [[Category:Foo]]
14114 !! html/parsoid
14115 <ul><li> a
14116 <ul><li> b
14117 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
14118 <li> c
14119 <ul><li> d</li></ul></li></ul>
14120 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14121 !! end
14122
14123 !! test
14124 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
14125 !! wikitext
14126 * a [[Category:Foo]]
14127 !! html/parsoid
14128 <ul><li>a <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul>
14129 !! end
14130
14131 # This test also demonstrates because of newline+category tunneling
14132 # through the list hander, template wrapping doesn't expand to the
14133 # containing list when the list item swallows the category.
14134 !! test
14135 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
14136 !! wikitext
14137 * {{echo|a
14138 [[Category:Foo]]}}
14139 !! html/parsoid
14140 <ul><li> <span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n[[Category:Foo]]"}},"i":0}}]}'>a</span><span about="#mwt1">
14141 </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul>
14142 !! end
14143
14144 !! test
14145 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
14146 !! wikitext
14147 * a
14148
14149 {{echo|[[Category:Foo]]
14150 [[Category:Bar]]}}
14151 [[Category:Baz]]
14152 !! html/parsoid
14153 <ul><li> a</li></ul>
14154
14155 <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"},"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]]\n[[Category:Bar]]"}},"i":0}}]}'/><span about="#mwt1">
14156 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14157 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14158 !! end
14159
14160 !! test
14161 Parsoid: Serialize link to category page with colon escape
14162 !! options
14163 parsoid
14164 !! wikitext
14165
14166 [[:Category:Foo]]
14167 [[:Category:Foo|Bar]]
14168 !! html
14169 <p>
14170 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
14171 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
14172 </p>
14173 !! end
14174
14175 # html2wt localizes the "Category" namespace.
14176 # XXX the <link> element needs an empty data-parsoid attribute, or
14177 # else the html2html test fails because spaces are inserted.
14178 !! test
14179 Link prefix/suffixes aren't applied to category links
14180 !! options
14181 parsoid=wt2html,wt2wt,html2html
14182 language=is
14183 !! wikitext
14184 x[[Category:Foo]]y
14185 !! html/php
14186 <p>xy
14187 </p>
14188 !! html/parsoid
14189 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
14190 !! end
14191
14192 !! test
14193 Parsoid: Serialize link to file page with colon escape
14194 !! options
14195 parsoid
14196 !! wikitext
14197
14198 [[:File:Foo.png]]
14199 [[:File:Foo.png|Bar]]
14200 !! html
14201 <p>
14202 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
14203 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
14204 </p>
14205 !! end
14206
14207 !! test
14208 Parsoid: Serialize a genuine category link without colon escape
14209 !! options
14210 parsoid
14211 !! wikitext
14212 [[Category:Foo]]
14213 [[Category:Foo|Bar]]
14214 !! html
14215 <link rel="mw:PageProp/Category" href="./Category:Foo">
14216 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
14217 !! end
14218
14219 !! test
14220 Normalize hrefs properly before testing for invalid link targets (bug 70894)
14221 !! options
14222 parsoid=html2wt
14223 !! html/parsoid
14224 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
14225 !! wikitext
14226 [[Category:Toxine bactérienne]]
14227 !! end
14228
14229 !! test
14230 Parsoid: Defaultsort
14231 !! wikitext
14232 {{DEFAULTSORT:Foo}}
14233 !! html/parsoid
14234 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
14235 !! end
14236
14237 !! test
14238 Parsoid: Defaultsort (template-generated)
14239 !! wikitext
14240 {{{{echo|DEFAULTSORT}}:Foo}}
14241 !! html/parsoid
14242 <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}}]}'/>
14243 !! end
14244
14245 ###
14246 ### Inter-language links
14247 ###
14248 !! test
14249 Interlanguage links
14250 !! options
14251 ill
14252 !! wikitext
14253 [[es:Alimento]]
14254 [[fr:Nourriture]]
14255 [[zh:食品]]
14256 !! html/php
14257 es:Alimento fr:Nourriture zh:食品
14258 !! html/parsoid
14259 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
14260 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
14261 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
14262 !! end
14263
14264 !! test
14265 Duplicate interlanguage links (bug 24502)
14266 !! options
14267 ill
14268 !! wikitext
14269 [[es:1]]
14270 [[es:2]]
14271 [[fr:1]]
14272 [[fr:2]]
14273 !! html/php
14274 es:1 fr:1
14275 !! html/parsoid
14276 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
14277 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
14278 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
14279 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
14280 !! end
14281
14282 ###
14283 ### Sections
14284 ###
14285 !! test
14286 Basic section headings
14287 !! wikitext
14288 == Headline 1 ==
14289 Some text
14290
14291 ==Headline 2==
14292 More
14293 ===Smaller headline===
14294 Blah blah
14295 !! html
14296 <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>
14297 <p>Some text
14298 </p>
14299 <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>
14300 <p>More
14301 </p>
14302 <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>
14303 <p>Blah blah
14304 </p>
14305 !! end
14306
14307 !! test
14308 Section headings with TOC
14309 !! wikitext
14310 == Headline 1 ==
14311 === Subheadline 1 ===
14312 ===== Skipping a level =====
14313 ====== Skipping a level ======
14314
14315 == Headline 2 ==
14316 Some text
14317 ===Another headline===
14318 !! html
14319 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14320 <ul>
14321 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
14322 <ul>
14323 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
14324 <ul>
14325 <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>
14326 <ul>
14327 <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>
14328 </ul>
14329 </li>
14330 </ul>
14331 </li>
14332 </ul>
14333 </li>
14334 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
14335 <ul>
14336 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
14337 </ul>
14338 </li>
14339 </ul>
14340 </div>
14341
14342 <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>
14343 <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>
14344 <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>
14345 <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>
14346 <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>
14347 <p>Some text
14348 </p>
14349 <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>
14350
14351 !! end
14352
14353 !! test
14354 TOC anchors don't collide
14355 !! wikitext
14356 __FORCETOC__
14357 == Headline 2 ==
14358 == Headline ==
14359 == Headline 2 ==
14360 == Headline ==
14361 !! html/php
14362 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14363 <ul>
14364 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
14365 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
14366 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
14367 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
14368 </ul>
14369 </div>
14370
14371 <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>
14372 <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>
14373 <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>
14374 <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>
14375
14376 !! end
14377
14378 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
14379 !! test
14380 Handling of sections up to level 6 and beyond
14381 !! wikitext
14382 = Level 1 Heading=
14383 == Level 2 Heading==
14384 === Level 3 Heading===
14385 ==== Level 4 Heading====
14386 ===== Level 5 Heading=====
14387 ====== Level 6 Heading======
14388 ======= Level 7 Heading=======
14389 ======== Level 8 Heading========
14390 ========= Level 9 Heading=========
14391 ========== Level 10 Heading==========
14392 !! html
14393 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14394 <ul>
14395 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
14396 <ul>
14397 <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>
14398 <ul>
14399 <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>
14400 <ul>
14401 <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>
14402 <ul>
14403 <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>
14404 <ul>
14405 <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>
14406 <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>
14407 <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>
14408 <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>
14409 <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>
14410 </ul>
14411 </li>
14412 </ul>
14413 </li>
14414 </ul>
14415 </li>
14416 </ul>
14417 </li>
14418 </ul>
14419 </li>
14420 </ul>
14421 </div>
14422
14423 <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>
14424 <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>
14425 <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>
14426 <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>
14427 <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>
14428 <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>
14429 <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>
14430 <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>
14431 <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>
14432 <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>
14433
14434 !! end
14435
14436 !! test
14437 TOC regression (T11764)
14438 !! wikitext
14439 == title 1 ==
14440 === title 1.1 ===
14441 ==== title 1.1.1 ====
14442 === title 1.2 ===
14443 == title 2 ==
14444 === title 2.1 ===
14445 !! html
14446 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14447 <ul>
14448 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14449 <ul>
14450 <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>
14451 <ul>
14452 <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>
14453 </ul>
14454 </li>
14455 <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>
14456 </ul>
14457 </li>
14458 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14459 <ul>
14460 <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>
14461 </ul>
14462 </li>
14463 </ul>
14464 </div>
14465
14466 <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>
14467 <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>
14468 <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>
14469 <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>
14470 <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>
14471 <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>
14472
14473 !! end
14474
14475 !! test
14476 TOC for heading containing <span id="..."></span> (T96153)
14477 !! wikitext
14478 __FORCETOC__
14479 ==<span id="old-anchor"></span>New title==
14480 !! html/php
14481 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14482 <ul>
14483 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
14484 </ul>
14485 </div>
14486
14487 <h2><span class="mw-headline" id="New_title"><span id="old-anchor"></span>New title</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: New title">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
14488
14489 !! end
14490
14491 !! test
14492 TOC with wgMaxTocLevel=3 (bug 6204)
14493 !! options
14494 wgMaxTocLevel=3
14495 !! wikitext
14496 == title 1 ==
14497 === title 1.1 ===
14498 ==== title 1.1.1 ====
14499 === title 1.2 ===
14500 == title 2 ==
14501 === title 2.1 ===
14502 !! html
14503 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14504 <ul>
14505 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14506 <ul>
14507 <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>
14508 <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>
14509 </ul>
14510 </li>
14511 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14512 <ul>
14513 <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>
14514 </ul>
14515 </li>
14516 </ul>
14517 </div>
14518
14519 <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>
14520 <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>
14521 <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>
14522 <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>
14523 <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>
14524 <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>
14525
14526 !! end
14527
14528 !! test
14529 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
14530 !! options
14531 wgMaxTocLevel=3
14532 !! wikitext
14533 ==Section 1==
14534 ===Section 1.1===
14535 ====Section 1.1.1====
14536 ====Section 1.1.1.1====
14537 ==Section 2==
14538 !! html
14539 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14540 <ul>
14541 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
14542 <ul>
14543 <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>
14544 </ul>
14545 </li>
14546 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
14547 </ul>
14548 </div>
14549
14550 <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>
14551 <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>
14552 <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>
14553 <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>
14554 <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>
14555
14556 !! end
14557
14558
14559 !! test
14560 Resolving duplicate section names
14561 !! wikitext
14562 == Foo bar ==
14563 == Foo bar ==
14564 !! html
14565 <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>
14566 <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>
14567
14568 !! end
14569
14570 !! test
14571 Resolving duplicate section names with differing case (bug 10721)
14572 !! wikitext
14573 == Foo bar ==
14574 == Foo Bar ==
14575 !! html
14576 <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>
14577 <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>
14578
14579 !! end
14580
14581 !! article
14582 Template:sections
14583 !! text
14584 ===Section 1===
14585 ==Section 2==
14586 !! endarticle
14587
14588 !! test
14589 Template with sections, __NOTOC__
14590 !! wikitext
14591 __NOTOC__
14592 ==Section 0==
14593 {{sections}}
14594 ==Section 4==
14595 !! html
14596 <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>
14597 <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>
14598 <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>
14599 <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>
14600
14601 !! end
14602
14603 !! test
14604 __NOEDITSECTION__ keyword
14605 !! wikitext
14606 __NOEDITSECTION__
14607 ==Section 1==
14608 ==Section 2==
14609 !! html
14610 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
14611 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
14612
14613 !! end
14614
14615 !! test
14616 Link inside a section heading
14617 !! wikitext
14618 ==Section with a [[Main Page|link]] in it==
14619 !! html
14620 <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>
14621
14622 !! end
14623
14624 !! test
14625 TOC regression (T14077)
14626 !! wikitext
14627 __TOC__
14628 == title 1 ==
14629 === title 1.1 ===
14630 == title 2 ==
14631 !! html
14632 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14633 <ul>
14634 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14635 <ul>
14636 <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>
14637 </ul>
14638 </li>
14639 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
14640 </ul>
14641 </div>
14642
14643 <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>
14644 <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>
14645 <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>
14646
14647 !! end
14648
14649 !! test
14650 BUG 1219 URL next to image (good)
14651 !! wikitext
14652 http://example.com [[File:Foobar.jpg]]
14653 !! html/php
14654 <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>
14655 </p>
14656 !! html/parsoid
14657 <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>
14658 !!end
14659
14660 !! test
14661 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
14662 !! wikitext
14663 ===
14664 The line above must have a trailing space!
14665 === <!--
14666 --> <!-- -->
14667 But just in case it doesn't...
14668 !! html
14669 <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>
14670 <p>The line above must have a trailing space!
14671 </p>
14672 <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>
14673 <p>But just in case it doesn't...
14674 </p>
14675 !! end
14676
14677 !! test
14678 Header with special characters (bug 25462)
14679 !! wikitext
14680 The tooltips shall not show entities to the user (ie. be double escaped)
14681
14682 == text > text ==
14683 section 1
14684
14685 == text < text ==
14686 section 2
14687
14688 == text & text ==
14689 section 3
14690
14691 == text ' text ==
14692 section 4
14693
14694 == text " text ==
14695 section 5
14696 !! html
14697 <p>The tooltips shall not show entities to the user (ie. be double escaped)
14698 </p>
14699 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14700 <ul>
14701 <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>
14702 <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>
14703 <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>
14704 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
14705 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
14706 </ul>
14707 </div>
14708
14709 <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>
14710 <p>section 1
14711 </p>
14712 <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>
14713 <p>section 2
14714 </p>
14715 <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>
14716 <p>section 3
14717 </p>
14718 <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>
14719 <p>section 4
14720 </p>
14721 <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>
14722 <p>section 5
14723 </p>
14724 !! end
14725
14726 !! test
14727 Header with space, plus and underscore as entity
14728 !! wikitext
14729 Id should not contain + for spaces
14730
14731 == Space between Text ==
14732 section 1
14733
14734 == Space-Entity&#32;between&#32;Text ==
14735 section 2
14736
14737 == Plus+between+Text ==
14738 section 3
14739
14740 == Plus-Entity&#43;between&#43;Text ==
14741 section 4
14742
14743 == Underscore_between_Text ==
14744 section 5
14745
14746 == Underscore-Entity&#95;between&#95;Text ==
14747 section 6
14748
14749 [[#Space between Text]]
14750 [[#Space-Entity&#32;between&#32;Text]]
14751 [[#Plus+between+Text]]
14752 [[#Plus-Entity&#43;between&#43;Text]]
14753 [[#Underscore_between_Text]]
14754 [[#Underscore-Entity&#95;between&#95;Text]]
14755 !! html
14756 <p>Id should not contain + for spaces
14757 </p>
14758 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14759 <ul>
14760 <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>
14761 <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>
14762 <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>
14763 <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>
14764 <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>
14765 <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>
14766 </ul>
14767 </div>
14768
14769 <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>
14770 <p>section 1
14771 </p>
14772 <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>
14773 <p>section 2
14774 </p>
14775 <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>
14776 <p>section 3
14777 </p>
14778 <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>
14779 <p>section 4
14780 </p>
14781 <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>
14782 <p>section 5
14783 </p>
14784 <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>
14785 <p>section 6
14786 </p><p><a href="#Space_between_Text">#Space between Text</a>
14787 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
14788 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
14789 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
14790 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
14791 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
14792 </p>
14793 !! end
14794
14795 !! test
14796 Headers with excess '=' characters
14797 (Are similar tests necessary beyond the 1st level?)
14798 !! wikitext
14799 =foo==
14800 ==foo=
14801 =''italic'' heading==
14802 ==''italic'' heading=
14803 !! html
14804 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14805 <ul>
14806 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
14807 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
14808 <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>
14809 <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>
14810 </ul>
14811 </div>
14812
14813 <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>
14814 <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>
14815 <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>
14816 <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>
14817
14818 !! end
14819
14820 !! test
14821 HTML headers vs TOC (bug 23393)
14822 (__NOEDITSECTION__ for clearer output, doesn't matter here)
14823 !! wikitext
14824 <h1>Header 1</h1>
14825 == Header 1.1 ==
14826 == Header 1.2 ==
14827
14828 <h1>Header 2
14829 </h1>
14830 == Header 2.1 ==
14831 == Header 2.2 ==
14832 __NOEDITSECTION__
14833 !! html
14834 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14835 <ul>
14836 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
14837 <ul>
14838 <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>
14839 <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>
14840 </ul>
14841 </li>
14842 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
14843 <ul>
14844 <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>
14845 <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>
14846 </ul>
14847 </li>
14848 </ul>
14849 </div>
14850
14851 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
14852 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
14853 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
14854 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
14855 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
14856 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
14857
14858 !! end
14859
14860 !! test
14861 Single-line or multiline-comments can follow headings
14862 !! options
14863 parsoid=wt2html,wt2wt
14864 !! wikitext
14865 ==foo==<!---->
14866 ==bar==<!--c1-->
14867 ==baz==<!--
14868 c2
14869 c3-->
14870 !! html
14871 <h2><span class="mw-headline" id="foo">foo</span></h2>
14872 <h2><span class="mw-headline" id="bar">bar</span></h2>
14873 <h2><span class="mw-headline" id="baz">baz</span></h2>
14874
14875 !! end
14876
14877 !! test
14878 BUG 1219 URL next to image (broken)
14879 !! wikitext
14880 http://example.com[[File:Foobar.jpg]]
14881 !! html/php
14882 <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>
14883 </p>
14884 !! html/parsoid
14885 <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>
14886 !!end
14887
14888 !! test
14889 Bug 1186 news: in the middle of text
14890 !! wikitext
14891 http://en.wikinews.org/wiki/Wikinews:Workplace
14892 !! html
14893 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
14894 </p>
14895 !!end
14896
14897
14898 !! test
14899 Namespaced link must have a title
14900 !! wikitext
14901 [[Project:]]
14902 !! html
14903 <p>[[Project:]]
14904 </p>
14905 !!end
14906
14907 !! test
14908 Namespaced link must have a title (bad fragment version)
14909 !! wikitext
14910 [[Project:#fragment]]
14911 !! html
14912 <p>[[Project:#fragment]]
14913 </p>
14914 !!end
14915
14916
14917 ###
14918 ### HTML tags and HTML attributes
14919 ###
14920
14921 !! test
14922 div with no attributes
14923 !! wikitext
14924 <div>HTML rocks</div>
14925 !! html
14926 <div>HTML rocks</div>
14927
14928 !! end
14929
14930 !! test
14931 div with double-quoted attribute
14932 !! wikitext
14933 <div id="rock">HTML rocks</div>
14934 !! html
14935 <div id="rock">HTML rocks</div>
14936
14937 !! end
14938
14939 !! test
14940 div with single-quoted attribute
14941 !! wikitext
14942 <div id='rock'>HTML rocks</div>
14943 !! html
14944 <div id="rock">HTML rocks</div>
14945
14946 !! end
14947
14948 !! test
14949 div with unquoted attribute
14950 !! wikitext
14951 <div id=rock>HTML rocks</div>
14952 !! html
14953 <div id="rock">HTML rocks</div>
14954
14955 !! end
14956
14957 !! test
14958 div with illegal double attributes
14959 !! wikitext
14960 <div id="a" id="b">HTML rocks</div>
14961 !! html
14962 <div id="b">HTML rocks</div>
14963
14964 !!end
14965
14966 # FIXME: produce empty string instead of "class" in the PHP parser, following
14967 # the HTML5 spec.
14968 !! test
14969 div with empty attribute value, space before equals
14970 !! options
14971 parsoid
14972 !! wikitext
14973 <div class =>HTML rocks</div>
14974 !! html
14975 <div class="">HTML rocks</div>
14976
14977 !! end
14978
14979 !! test
14980 div with multiple empty attribute values
14981 !! options
14982 parsoid
14983 !! wikitext
14984 <div id= title=>HTML rocks</div>
14985 !! html
14986 <div id="" title="">HTML rocks</div>
14987
14988 !! end
14989
14990 !! test
14991 table with multiple empty attribute values
14992 !! options
14993 parsoid
14994 !! wikitext
14995 {| title= id=
14996 | hi
14997 |}
14998 !! html
14999 <table title="" id="">
15000 <tbody><tr><td> hi</td></tr>
15001 </tbody></table>
15002 !! end
15003
15004 !! test
15005 div with braces in attribute value
15006 !! wikitext
15007 <div title="{}">Foo</div>
15008 !! html/php
15009 <div title="&#123;}">Foo</div>
15010
15011 !! html/parsoid
15012 <div title="{}">Foo</div>
15013 !! end
15014
15015 # This it very inconsistent in the PHP parser: it returns
15016 # class="class" if there is a space between the name and the equal sign (see
15017 # 'div with empty attribute value, space before equals'), but strips the
15018 # attribute completely if the space is missing. We hope that not much content
15019 # depends on this, so are implementing the behavior below in Parsoid for
15020 # consistencies' sake.
15021 # FIXME: fix this behavior in the PHP parser?
15022 !! test
15023 div with empty attribute value, no space before equals
15024 !! options
15025 parsoid=wt2html,html2html
15026 !! wikitext
15027 <div class=>HTML rocks</div>
15028 !! html/php
15029 <div>HTML rocks</div>
15030
15031 !! html/parsoid
15032 <div class="">HTML rocks</div>
15033 !! end
15034
15035 !! test
15036 HTML multiple attributes correction
15037 !! wikitext
15038 <p class="error" class="awesome">Awesome!</p>
15039 !! html
15040 <p class="awesome">Awesome!</p>
15041
15042 !!end
15043
15044 !! test
15045 Table multiple attributes correction
15046 !! wikitext
15047 {|
15048 !+ class="error" class="awesome"| status
15049 |}
15050 !! html
15051 <table>
15052 <tr>
15053 <th class="awesome"> status
15054 </th></tr></table>
15055
15056 !!end
15057
15058 !! test
15059 DIV IN UPPERCASE
15060 !! wikitext
15061 <DIV ID="x">HTML ROCKS</DIV>
15062 !! html
15063 <div id="x">HTML ROCKS</div>
15064
15065 !!end
15066
15067 !! test
15068 Non-ASCII pseudo-tags are rendered as text
15069 !! wikitext
15070 <khyô>
15071 !! html
15072 <p>&lt;khyô&gt;
15073 </p>
15074 !! end
15075
15076 !! test
15077 Pseudo-tag with URL 'name' renders as url link
15078 !! wikitext
15079 <http://example.com/>
15080 !! html
15081 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
15082 </p>
15083 !! end
15084
15085 !! test
15086 text with amp in the middle of nowhere
15087 !! wikitext
15088 Remember AT&T?
15089 !! html
15090 <p>Remember AT&amp;T?
15091 </p>
15092 !! end
15093
15094 !! test
15095 text with character entity: eacute
15096 !! wikitext
15097 I always thought &eacute; was a cute letter.
15098 !! html
15099 <p>I always thought &#233; was a cute letter.
15100 </p>
15101 !! html+tidy
15102 <p>I always thought é was a cute letter.</p>
15103 !! end
15104
15105 !! test
15106 text with entity-escaped character entity-like string: eacute
15107 !! wikitext
15108 I always thought &amp;eacute; was a cute letter.
15109 !! html
15110 <p>I always thought &amp;eacute; was a cute letter.
15111 </p>
15112 !! end
15113
15114 !! test
15115 text with undefined character entity: xacute
15116 !! wikitext
15117 I always thought &xacute; was a cute letter.
15118 !! html
15119 <p>I always thought &amp;xacute; was a cute letter.
15120 </p>
15121 !! end
15122
15123 !! test
15124 HTML5 tags
15125 !! wikitext
15126 <data value="5">five</data>
15127 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15128 <mark>This highlighted text</mark>
15129 !! html
15130 <p><data value="5">five</data>
15131 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15132 <mark>This highlighted text</mark>
15133 </p>
15134 !! end
15135
15136 !! test
15137 HTML tag with leading space is parsed as text
15138 !! wikitext
15139 < div>foo< /div>
15140 !! html
15141 <p>&lt; div&gt;foo&lt; /div&gt;
15142 </p>
15143 !! end
15144
15145 ###
15146 ### Nesting tests (see bug 41545, 50604, 51081)
15147 ###
15148
15149 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
15150 # Note that html2wt is considerably more difficult if we use <b> in
15151 # the test case, instead of <big>
15152 !! test
15153 Ensure that HTML adoption agency algorithm is properly implemented.
15154 !! wikitext
15155 <big>X<big>Y</big>Z</big>
15156 !! html
15157 <p><big>X<big>Y</big>Z</big>
15158 </p>
15159 !! end
15160
15161 # This was bug 41545 in the PHP parser.
15162 # Note that tidy doesn't handle this correctly.
15163 !! test
15164 Nesting of <kbd>
15165 !! wikitext
15166 <kbd>X<kbd>Y</kbd>Z</kbd>
15167 !! html
15168 <p><kbd>X<kbd>Y</kbd>Z</kbd>
15169 </p>
15170 !! end
15171
15172 # The following cases were bug 51081 in the PHP parser.
15173 # Note that there are some other nestable tags (b, i, etc) which are
15174 # not covered; see bug 51081 for discussion.
15175
15176 # Note that tidy doesn't handle this correctly.
15177 !! test
15178 Nesting of <em>
15179 !! wikitext
15180 <em>X<em>Y</em>Z</em>
15181 !! html
15182 <p><em>X<em>Y</em>Z</em>
15183 </p>
15184 !! end
15185
15186 # Note that tidy doesn't handle this correctly.
15187 !! test
15188 Nesting of <strong>
15189 !! wikitext
15190 <strong>X<strong>Y</strong>Z</strong>
15191 !! html
15192 <p><strong>X<strong>Y</strong>Z</strong>
15193 </p>
15194 !! end
15195
15196 !! test
15197 Nesting of <q>
15198 !! wikitext
15199 <q>X<q>Y</q>Z</q>
15200 !! html+tidy
15201 <p><q>X<q>Y</q>Z</q></p>
15202 !! end
15203
15204 # Note that tidy doesn't handle this correctly.
15205 !! test
15206 Nesting of <ruby>
15207 !! wikitext
15208 <ruby>X<ruby>Y</ruby>Z</ruby>
15209 !! html
15210 <p><ruby>X<ruby>Y</ruby>Z</ruby>
15211 </p>
15212 !! end
15213
15214 # Note that tidy doesn't handle this correctly.
15215 !! test
15216 Nesting of <bdo>
15217 !! wikitext
15218 <bdo>X<bdo>Y</bdo>Z</bdo>
15219 !! html
15220 <p><bdo>X<bdo>Y</bdo>Z</bdo>
15221 </p>
15222 !! end
15223
15224
15225 ###
15226 ### Media links
15227 ###
15228
15229 !! test
15230 Media link
15231 !! wikitext
15232 [[Media:Foobar.jpg]]
15233 !! html
15234 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
15235 </p>
15236 !! end
15237
15238 !! test
15239 Media link with text
15240 !! wikitext
15241 [[Media:Foobar.jpg|A neat file to look at]]
15242 !! html
15243 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
15244 </p>
15245 !! end
15246
15247 # FIXME: this is still bad HTML tag nesting
15248 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
15249 !! test
15250 Media link with nasty text
15251 !! wikitext
15252 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
15253 !! html
15254 <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>
15255
15256 !! html+tidy
15257 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
15258 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
15259 !! end
15260
15261 !! test
15262 Media link to nonexistent file (bug 1702)
15263 !! wikitext
15264 [[Media:No such.jpg]]
15265 !! html
15266 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
15267 </p>
15268 !! end
15269
15270 !! test
15271 Image link to nonexistent file (bug 1850 - good)
15272 !! wikitext
15273 [[File:No_such.jpg]]
15274 !! html/php
15275 <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>
15276 </p>
15277 !! html/parsoid
15278 <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>
15279 !! end
15280
15281 !! test
15282 :Image link to nonexistent file (bug 1850 - bad)
15283 !! wikitext
15284 [[:Image:No such.jpg]]
15285 !! html/php
15286 <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>
15287 </p>
15288 !! html/parsoid
15289 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
15290 !! end
15291
15292
15293
15294 !! test
15295 Character reference normalization in link text (bug 1938)
15296 !! wikitext
15297 [[Main Page|this&that]]
15298 !! html
15299 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
15300 </p>
15301 !!end
15302
15303 !! article
15304 אַ
15305 !! text
15306 Test for unicode normalization
15307
15308 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
15309 !! endarticle
15310
15311 !! test
15312 (bug 19451) Links should refer to the normalized form.
15313 !! wikitext
15314 [[&#xFB2E;]]
15315 [[&#x5d0;&#x5b7;]]
15316 [[&#x5d0;ַ]]
15317 [[א&#x5b7;]]
15318 [[אַ]]
15319 !! html
15320 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
15321 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
15322 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
15323 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
15324 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
15325 </p>
15326 !! end
15327
15328 !! test
15329 Empty attribute crash test (bug 2067)
15330 !! wikitext
15331 <font color="">foo</font>
15332 !! html
15333 <p><font color="">foo</font>
15334 </p>
15335 !! end
15336
15337 !! test
15338 Empty attribute crash test single-quotes (bug 2067)
15339 !! wikitext
15340 <font color=''>foo</font>
15341 !! html
15342 <p><font color="">foo</font>
15343 </p>
15344 !! end
15345
15346 !! test
15347 Attribute test: equals, then nothing
15348 !! wikitext
15349 <font color=>foo</font>
15350 !! html
15351 <p><font>foo</font>
15352 </p>
15353 !! end
15354
15355 !! test
15356 Attribute test: unquoted value
15357 !! wikitext
15358 <font color=x>foo</font>
15359 !! html
15360 <p><font color="x">foo</font>
15361 </p>
15362 !! end
15363
15364 !! test
15365 Attribute test: unquoted but illegal value (hash)
15366 !! wikitext
15367 <font color=#x>foo</font>
15368 !! html
15369 <p><font color="#x">foo</font>
15370 </p>
15371 !! end
15372
15373 # Parsoid does not serialize to empty attribute syntax,
15374 # so wt2wt and html2wt cases are skipped
15375 !! test
15376 Attribute test: no value (T54330)
15377 !! options
15378 parsoid=wt2html,html2html
15379 !! wikitext
15380 <font color>foo</font>
15381 !! html/php
15382 <p><font color="">foo</font>
15383 </p>
15384 !! html/parsoid
15385 <p><font color="">foo</font></p>
15386 !! end
15387
15388 !! test
15389 Bug 2095: link with three closing brackets
15390 !! wikitext
15391 [[Main Page]]]
15392 !! html/php
15393 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
15394 </p>
15395 !! html/parsoid
15396 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
15397 !! end
15398
15399 !! test
15400 Bug 2095: link with pipe and three closing brackets
15401 !! wikitext
15402 [[Main Page|link]]]
15403 !! html/php
15404 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
15405 </p>
15406 !! html/parsoid
15407 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
15408 !! end
15409
15410 !! test
15411 Bug 2095: link with pipe and three closing brackets, version 2
15412 !! wikitext
15413 [[Main Page|[http://example.com/]]]
15414 !! html/php
15415 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
15416 </p>
15417 !! html/parsoid
15418 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
15419 !! end
15420
15421
15422 ###
15423 ### Safety
15424 ###
15425
15426 !! article
15427 Template:Dangerous attribute
15428 !! text
15429 " onmouseover="alert(document.cookie)
15430 !! endarticle
15431
15432 !! article
15433 Template:Dangerous style attribute
15434 !! text
15435 border-size: expression(alert(document.cookie))
15436 !! endarticle
15437
15438 !! article
15439 Template:Div style
15440 !! text
15441 <div style="float: right; {{{1}}}">Magic div</div>
15442 !! endarticle
15443
15444 !! test
15445 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
15446 !! wikitext
15447 <div title="{{test}}"></div>
15448 !! html
15449 <div title="This is a test template"></div>
15450
15451 !! end
15452
15453 # Parsoid has enough context to handle this case
15454 !! test
15455 Bug 2304: HTML attribute safety (dangerous template; 2309)
15456 !! wikitext
15457 <div title="{{dangerous attribute}}"></div>
15458 !! html/php
15459 <div title=""></div>
15460
15461 !! html/parsoid
15462 <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>
15463 !! end
15464
15465 !! test
15466 Bug 2304: HTML attribute safety (dangerous style template; 2309)
15467 !! wikitext
15468 <div style="{{dangerous style attribute}}"></div>
15469 !! html
15470 <div style="/* insecure input */"></div>
15471
15472 !! end
15473
15474 !! test
15475 Bug 2304: HTML attribute safety (safe parameter; 2309)
15476 !! wikitext
15477 {{div style|width: 200px}}
15478 !! html
15479 <div style="float: right; width: 200px">Magic div</div>
15480
15481 !! end
15482
15483 !! test
15484 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
15485 !! wikitext
15486 {{div style|width: expression(alert(document.cookie))}}
15487 !! html
15488 <div style="/* insecure input */">Magic div</div>
15489
15490 !! end
15491
15492 !! test
15493 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
15494 !! wikitext
15495 {{div style|"><script>alert(document.cookie)</script>}}
15496 !! html
15497 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15498
15499 !! end
15500
15501 !! test
15502 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
15503 !! wikitext
15504 {{div style|" ><script>alert(document.cookie)</script>}}
15505 !! html
15506 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15507
15508 !! end
15509
15510 !! test
15511 Bug 2304: HTML attribute safety (link)
15512 !! wikitext
15513 <div title="[[Main Page]]"></div>
15514 !! html
15515 <div title="&#91;&#91;Main Page]]"></div>
15516
15517 !! end
15518
15519 !! test
15520 Bug 2304: HTML attribute safety (italics)
15521 !! wikitext
15522 <div title="''foobar''"></div>
15523 !! html
15524 <div title="&#39;&#39;foobar&#39;&#39;"></div>
15525
15526 !! end
15527
15528 !! test
15529 Bug 2304: HTML attribute safety (bold)
15530 !! wikitext
15531 <div title="'''foobar'''"></div>
15532 !! html
15533 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
15534
15535 !! end
15536
15537
15538 !! test
15539 Bug 2304: HTML attribute safety (ISBN)
15540 !! wikitext
15541 <div title="ISBN 1234567890"></div>
15542 !! html
15543 <div title="&#73;SBN 1234567890"></div>
15544
15545 !! end
15546
15547 !! test
15548 Bug 2304: HTML attribute safety (RFC)
15549 !! wikitext
15550 <div title="RFC 1234"></div>
15551 !! html
15552 <div title="&#82;FC 1234"></div>
15553
15554 !! end
15555
15556 !! test
15557 Bug 2304: HTML attribute safety (PMID)
15558 !! wikitext
15559 <div title="PMID 1234567890"></div>
15560 !! html
15561 <div title="&#80;MID 1234567890"></div>
15562
15563 !! end
15564
15565 !! test
15566 Bug 2304: HTML attribute safety (web link)
15567 !! wikitext
15568 <div title="http://example.com/"></div>
15569 !! html
15570 <div title="http&#58;//example.com/"></div>
15571
15572 !! end
15573
15574 !! test
15575 Bug 2304: HTML attribute safety (named web link)
15576 !! wikitext
15577 <div title="[http://example.com/ link]"></div>
15578 !! html
15579 <div title="&#91;http&#58;//example.com/ link]"></div>
15580
15581 !! end
15582
15583 !! test
15584 Bug 3244: HTML attribute safety (extension; safe)
15585 !! wikitext
15586 <div style="<nowiki>background:blue</nowiki>"></div>
15587 !! html
15588 <div style="background:blue"></div>
15589
15590 !! end
15591
15592 !! test
15593 Bug 3244: HTML attribute safety (extension; unsafe)
15594 !! wikitext
15595 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
15596 !! html
15597 <div style="/* insecure input */"></div>
15598
15599 !! end
15600
15601 # More MSIE fun discovered by Tom Gilder
15602
15603 !! test
15604 MSIE CSS safety test: spurious slash
15605 !! wikitext
15606 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
15607 !! html
15608 <div style="/* insecure input */">evil</div>
15609
15610 !! end
15611
15612 !! test
15613 MSIE CSS safety test: hex code
15614 !! wikitext
15615 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
15616 !! html
15617 <div style="/* insecure input */">evil</div>
15618
15619 !! end
15620
15621 !! test
15622 MSIE CSS safety test: comment in url
15623 !! wikitext
15624 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
15625 !! html
15626 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
15627
15628 !! end
15629
15630 !! test
15631 MSIE CSS safety test: comment in expression
15632 !! wikitext
15633 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
15634 !! html
15635 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
15636
15637 !! end
15638
15639 !! test
15640 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
15641 !! wikitext
15642 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
15643 !! html
15644 <p style="/* invalid control char */">A</p>
15645
15646 !! end
15647
15648 !! test
15649 MSIE 6 CSS safety test: Fullwidth (bug 55332)
15650 !! wikitext
15651 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
15652 <div style="top:EXPRESSION(alert())">B</div>
15653 !! html
15654 <p style="/* insecure input */">A</p>
15655 <div style="/* insecure input */">B</div>
15656
15657 !! end
15658
15659 !! test
15660 MSIE 6 CSS safety test: IPA extensions (bug 55332)
15661 !! wikitext
15662 <div style="background-image:uʀʟ(javascript:alert())">A</div>
15663 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
15664 !! html
15665 <div style="/* insecure input */">A</div>
15666 <p style="/* insecure input */">B</p>
15667
15668 !! end
15669
15670 !! test
15671 MSIE 6 CSS safety test: sup/sub script (bug 55332)
15672 !! wikitext
15673 <div style="background-image:url⁽javascript:alert())">A</div>
15674 <div style="background-image:url₍javascript:alert())">B</div>
15675 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
15676 !! html
15677 <div style="/* insecure input */">A</div>
15678 <div style="/* insecure input */">B</div>
15679 <p style="/* insecure input */">C</p>
15680
15681 !! end
15682
15683 !! test
15684 Opera -o-link CSS
15685 !! wikitext
15686 <div
15687 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;"
15688 style="-o-link:attr(title);-o-link-source:current">X</div>
15689 !! html
15690 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
15691
15692 !! end
15693
15694 !! test
15695 MSIE 6 CSS safety test: Repetition markers (bug 55332)
15696 !! wikitext
15697 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
15698 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
15699 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
15700 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
15701 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
15702 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
15703 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
15704 !! html
15705 <p style="/* insecure input */">A</p>
15706 <p style="/* insecure input */">B</p>
15707 <p style="/* insecure input */">C</p>
15708 <p style="/* insecure input */">D</p>
15709 <p style="/* insecure input */">E</p>
15710 <p style="/* insecure input */">F</p>
15711 <p style="/* insecure input */">G</p>
15712
15713 !! end
15714
15715 !! test
15716 Table attribute legitimate extension
15717 !! wikitext
15718 {|
15719 !+ style="<nowiki>color:blue</nowiki>"| status
15720 |}
15721 !! html
15722 <table>
15723 <tr>
15724 <th style="color:blue"> status
15725 </th></tr></table>
15726
15727 !!end
15728
15729 !! test
15730 Table attribute safety
15731 !! wikitext
15732 {|
15733 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
15734 |}
15735 !! html
15736 <table>
15737 <tr>
15738 <th style="/* insecure input */"> status
15739 </th></tr></table>
15740
15741 !! end
15742
15743 !! test
15744 CSS line continuation 1
15745 !! wikitext
15746 <div style="background-image: u\&#10;rl(test.jpg);"></div>
15747 !! html
15748 <div style="/* insecure input */"></div>
15749
15750 !! end
15751
15752 !! test
15753 CSS line continuation 2
15754 !! wikitext
15755 <div style="background-image: u\&#13;rl(test.jpg); "></div>
15756 !! html
15757 <div style="/* insecure input */"></div>
15758
15759 !! end
15760
15761 !! article
15762 Template:Identity
15763 !! text
15764 {{{1}}}
15765 !! endarticle
15766
15767 !! test
15768 Expansion of multi-line templates in attribute values (bug 6255)
15769 !! wikitext
15770 <div style="background: {{identity|#00FF00}}">-</div>
15771 !! html
15772 <div style="background: #00FF00">-</div>
15773
15774 !! end
15775
15776
15777 !! test
15778 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
15779 !! wikitext
15780 <div style="background:
15781 #00FF00">-</div>
15782 !! html/php
15783 <div style="background: #00FF00">-</div>
15784
15785 !! html/parsoid
15786 <div style="background:
15787 #00FF00">-</div>
15788 !! end
15789
15790 !! test
15791 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
15792 !! wikitext
15793 <div style="background: &#10;#00FF00">-</div>
15794 !! html
15795 <div style="background: &#10;#00FF00">-</div>
15796
15797 !! end
15798
15799 !! test
15800 evil <math>-wiki-tags without Extension:Math enabled
15801 !! wikitext
15802 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
15803 !! html+tidy
15804 <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>
15805 !! end
15806
15807 ###
15808 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
15809 ###
15810 !! test
15811 Parser hook: empty input
15812 !! wikitext
15813 <tag></tag>
15814 !! html/php
15815 <pre>
15816 ''
15817 array (
15818 )
15819 </pre>
15820
15821 !! end
15822
15823 !! test
15824 Parser hook: empty input using terminated empty elements
15825 !! wikitext
15826 <tag/>
15827 !! html/php
15828 <pre>
15829 NULL
15830 array (
15831 )
15832 </pre>
15833
15834 !! end
15835
15836 !! test
15837 Parser hook: empty input using terminated empty elements (space before)
15838 !! wikitext
15839 <tag />
15840 !! html/php
15841 <pre>
15842 NULL
15843 array (
15844 )
15845 </pre>
15846
15847 !! end
15848
15849 !! test
15850 Parser hook: basic input
15851 !! wikitext
15852 <tag>input</tag>
15853 !! html/php
15854 <pre>
15855 'input'
15856 array (
15857 )
15858 </pre>
15859
15860 !! end
15861
15862
15863 !! test
15864 Parser hook: case insensitive
15865 !! wikitext
15866 <TAG>input</TAG>
15867 !! html/php
15868 <pre>
15869 'input'
15870 array (
15871 )
15872 </pre>
15873
15874 !! end
15875
15876
15877 !! test
15878 Parser hook: case insensitive, redux
15879 !! wikitext
15880 <TaG>input</TAg>
15881 !! html/php
15882 <pre>
15883 'input'
15884 array (
15885 )
15886 </pre>
15887
15888 !! end
15889
15890 !! test
15891 Parser hook: nested tags
15892 !! options
15893 noxml
15894 !! wikitext
15895 <tag><tag></tag></tag>
15896 !! html/php
15897 <pre>
15898 '<tag>'
15899 array (
15900 )
15901 </pre>&lt;/tag&gt;
15902
15903 !! end
15904
15905 !! test
15906 Parser hook: basic arguments
15907 !! wikitext
15908 <tag width=200 height = "100" depth = '50' square></tag>
15909 !! html/php
15910 <pre>
15911 ''
15912 array (
15913 'width' => '200',
15914 'height' => '100',
15915 'depth' => '50',
15916 'square' => '',
15917 )
15918 </pre>
15919
15920 !! end
15921
15922 !! test
15923 Parser hook: argument containing a forward slash (bug 5344)
15924 !! wikitext
15925 <tag filename='/tmp/bla'></tag>
15926 !! html/php
15927 <pre>
15928 ''
15929 array (
15930 'filename' => '/tmp/bla',
15931 )
15932 </pre>
15933
15934 !! end
15935
15936 !! test
15937 Parser hook: empty input using terminated empty elements (bug 2374)
15938 !! wikitext
15939 <tag foo=bar/>text
15940 !! html/php
15941 <pre>
15942 NULL
15943 array (
15944 'foo' => 'bar',
15945 )
15946 </pre>text
15947
15948 !! end
15949
15950 # </tag> should be output literally since there is no matching tag that begins it
15951 !! test
15952 Parser hook: basic arguments using terminated empty elements (bug 2374)
15953 !! wikitext
15954 <tag width=200 height = "100" depth = '50' square/>
15955 other stuff
15956 </tag>
15957 !! html/php
15958 <pre>
15959 NULL
15960 array (
15961 'width' => '200',
15962 'height' => '100',
15963 'depth' => '50',
15964 'square' => '',
15965 )
15966 </pre>
15967 <p>other stuff
15968 &lt;/tag&gt;
15969 </p>
15970 !! end
15971
15972 ###
15973 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
15974 ###
15975
15976 !! test
15977 Parser hook: static parser hook not inside a comment
15978 !! wikitext
15979 <statictag>hello, world</statictag>
15980 <statictag action=flush/>
15981 !! html/php
15982 <p>hello, world
15983 </p>
15984 !! end
15985
15986
15987 !! test
15988 Parser hook: static parser hook inside a comment
15989 !! wikitext
15990 <!-- <statictag>hello, world</statictag> -->
15991 <statictag action=flush/>
15992 !! html/php
15993 <p><br />
15994 </p>
15995 !! end
15996
15997 # Nested template calls; this case was broken by Parser.php rev 1.506,
15998 # since reverted.
15999
16000 !! article
16001 Template:One-parameter
16002 !! text
16003 (My parameter is: {{{1}}})
16004 !! endarticle
16005
16006 !! article
16007 Template:Map-one-parameter
16008 !! text
16009 {{{{{1}}}|{{{2}}}}}
16010 !! endarticle
16011
16012 !! test
16013 Nested template calls
16014 !! wikitext
16015 {{Map-one-parameter|One-parameter|param}}
16016 !! html
16017 <p>(My parameter is: param)
16018 </p>
16019 !! end
16020
16021
16022 ###
16023 ### Sanitizer
16024 ###
16025
16026 # HTML+Tidy effectively strips out the empty tags completely
16027 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
16028 # which Tidy would have done for the PHP parser had there been content inside it.
16029 !! test
16030 Sanitizer: Closing of open tags
16031 !! wikitext
16032 <s></s><table></table>
16033 !! html
16034 <s></s><table></table>
16035
16036 !! html/parsoid
16037 <p><s></s></p><table></table>
16038 !! end
16039
16040 !! test
16041 Sanitizer: Closing of open but not closed tags
16042 !! wikitext
16043 <s>foo
16044 !! html
16045 <p><s>foo</s>
16046 </p>
16047 !! end
16048
16049 !! test
16050 Sanitizer: Closing of closed but not open tags
16051 !! options
16052 parsoid=wt2html
16053 !! wikitext
16054 </s>
16055 !! html/php+tidy
16056 !! html/parsoid
16057 !! end
16058
16059 !! test
16060 Sanitizer: Closing of closed but not open table tags
16061 !! options
16062 parsoid=wt2html
16063 !! wikitext
16064 Table not started</td></tr></table>
16065 !! html/php+tidy
16066 <p>Table not started</p>
16067 !! html/parsoid
16068 <p>Table not started</p>
16069 !! end
16070
16071 !! test
16072 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
16073 !! wikitext
16074 <span id="æ: v">byte</span>[[#æ: v|backlink]]
16075 !! html
16076 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
16077 </p>
16078 !! end
16079
16080 # In HTML5, the restrictions are that id must contain at least one character,
16081 # and must not contain any space characters.
16082 !! test
16083 Sanitizer: Validating the contents of the id attribute (bug 4515)
16084 !! options
16085 disabled
16086 !! wikitext
16087 <br id="" /><br id="a space" />
16088 !! html
16089 Something ...
16090 !! end
16091
16092 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
16093 !! test
16094 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
16095 !! options
16096 disabled
16097 !! wikitext
16098 <br id="foo" /><br id="foo" />
16099 !! html
16100 Something need to be done. foo-2 ?
16101 !! end
16102
16103 !! test
16104 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
16105 !! wikitext
16106 <div itemscope>
16107 <meta itemprop="hello" content="world">
16108 <meta http-equiv="refresh" content="5">
16109 <meta itemprop="hello" http-equiv="refresh" content="5">
16110 <link itemprop="hello" href="{{SERVER}}">
16111 <link rel="stylesheet" href="{{SERVER}}">
16112 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
16113 </div>
16114 !! html
16115 <div itemscope="">
16116 <p> <meta itemprop="hello" content="world" />
16117 &lt;meta http-equiv="refresh" content="5"&gt;
16118 <meta itemprop="hello" content="5" />
16119 </p>
16120 <link itemprop="hello" href="http&#58;//example.org" />
16121 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
16122 <link itemprop="hello" href="http&#58;//example.org" />
16123 </div>
16124
16125 !! end
16126
16127 !! test
16128 Language converter: output gets cut off unexpectedly (bug 5757)
16129 !! options
16130 language=zh
16131 !! wikitext
16132 this bit is safe: }-
16133
16134 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
16135
16136 then we get cut off here: }-
16137
16138 all additional text is vanished
16139 !! html
16140 <p>this bit is safe: }-
16141 </p><p>but if we add a conversion instance: xxx
16142 </p><p>then we get cut off here: }-
16143 </p><p>all additional text is vanished
16144 </p>
16145 !! end
16146
16147 !! test
16148 Self closed html pairs (bug 5487)
16149 !! options
16150 !! wikitext
16151 <center><font id="bug" />Centered text</center>
16152 <div><font id="bug2" />In div text</div>
16153 !! html
16154 <center>&lt;font id="bug" /&gt;Centered text</center>
16155 <div>&lt;font id="bug2" /&gt;In div text</div>
16156
16157 !! end
16158
16159 #
16160 #
16161 #
16162
16163 !! test
16164 Punctuation: nbsp before exclamation
16165 !! wikitext
16166 C'est grave !
16167 !! html
16168 <p>C'est grave&#160;!
16169 </p>
16170 !! end
16171
16172 !! test
16173 Punctuation: CSS !important (bug 11874)
16174 !! wikitext
16175 <div style="width:50% !important">important</div>
16176 !! html
16177 <div style="width:50% !important">important</div>
16178
16179 !!end
16180
16181 !! test
16182 Punctuation: CSS ! important (bug 11874; with space after)
16183 !! wikitext
16184 <div style="width:50% ! important">important</div>
16185 !! html
16186 <div style="width:50% ! important">important</div>
16187
16188 !!end
16189
16190 !! test
16191 HTML bullet list, closed tags (bug 5497)
16192 !! wikitext
16193 <ul>
16194 <li>One</li>
16195 <li>Two</li>
16196 </ul>
16197 !! html/php
16198 <ul>
16199 <li>One</li>
16200 <li>Two</li>
16201 </ul>
16202
16203 !! html/parsoid
16204 <ul data-parsoid='{"stx":"html"}'>
16205 <li data-parsoid='{"stx":"html"}'>One</li>
16206 <li data-parsoid='{"stx":"html"}'>Two</li>
16207 </ul>
16208
16209 !! end
16210
16211 !! test
16212 HTML bullet list, unclosed tags (bug 5497)
16213 !! wikitext
16214 <ul>
16215 <li>One
16216 <li>Two
16217 </ul>
16218 !! html/php+tidy
16219 <ul>
16220 <li>One</li>
16221 <li>Two</li>
16222 </ul>
16223 !! html/parsoid
16224 <ul data-parsoid='{"stx":"html"}'>
16225 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16226 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16227 </ul>
16228
16229 !! end
16230
16231 !! test
16232 HTML ordered list, closed tags (bug 5497)
16233 !! wikitext
16234 <ol>
16235 <li>One</li>
16236 <li>Two</li>
16237 </ol>
16238 !! html/php
16239 <ol>
16240 <li>One</li>
16241 <li>Two</li>
16242 </ol>
16243
16244 !! html/parsoid
16245 <ol data-parsoid='{"stx":"html"}'>
16246 <li data-parsoid='{"stx":"html"}'>One</li>
16247 <li data-parsoid='{"stx":"html"}'>Two</li>
16248 </ol>
16249
16250 !! end
16251
16252 !! test
16253 HTML ordered list, unclosed tags (bug 5497)
16254 !! options
16255 !! wikitext
16256 <ol>
16257 <li>One
16258 <li>Two
16259 </ol>
16260 !! html/php+tidy
16261 <ol>
16262 <li>One</li>
16263 <li>Two</li>
16264 </ol>
16265 !! html/parsoid
16266 <ol data-parsoid='{"stx":"html"}'>
16267 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16268 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16269 </ol>
16270
16271 !! end
16272
16273 !! test
16274 HTML nested bullet list, closed tags (bug 5497)
16275 !! wikitext
16276 <ul>
16277 <li>One</li>
16278 <li>Two:
16279 <ul>
16280 <li>Sub-one</li>
16281 <li>Sub-two</li>
16282 </ul>
16283 </li>
16284 </ul>
16285 !! html
16286 <ul>
16287 <li>One</li>
16288 <li>Two:
16289 <ul>
16290 <li>Sub-one</li>
16291 <li>Sub-two</li>
16292 </ul>
16293 </li>
16294 </ul>
16295
16296 !! end
16297
16298 !! test
16299 HTML nested bullet list, open tags (bug 5497)
16300 !! wikitext
16301 <ul>
16302 <li>One
16303 <li>Two:
16304 <ul>
16305 <li>Sub-one
16306 <li>Sub-two
16307 </ul>
16308 </ul>
16309 !! html/php+tidy
16310 <ul>
16311 <li>One</li>
16312 <li>Two:
16313 <ul>
16314 <li>Sub-one</li>
16315 <li>Sub-two</li>
16316 </ul>
16317 </li>
16318 </ul>
16319 !! html/parsoid
16320 <ul>
16321 <li>One
16322 </li>
16323 <li>Two:
16324 <ul>
16325 <li>Sub-one
16326 </li>
16327 <li>Sub-two
16328 </li>
16329 </ul>
16330 </li>
16331 </ul>
16332
16333 !! end
16334
16335 !! test
16336 HTML nested ordered list, closed tags (bug 5497)
16337 !! wikitext
16338 <ol>
16339 <li>One</li>
16340 <li>Two:
16341 <ol>
16342 <li>Sub-one</li>
16343 <li>Sub-two</li>
16344 </ol>
16345 </li>
16346 </ol>
16347 !! html
16348 <ol>
16349 <li>One</li>
16350 <li>Two:
16351 <ol>
16352 <li>Sub-one</li>
16353 <li>Sub-two</li>
16354 </ol>
16355 </li>
16356 </ol>
16357
16358 !! end
16359
16360 !! test
16361 HTML nested ordered list, open tags (bug 5497)
16362 !! wikitext
16363 <ol>
16364 <li>One
16365 <li>Two:
16366 <ol>
16367 <li>Sub-one
16368 <li>Sub-two
16369 </ol>
16370 </ol>
16371 !! html/php
16372 <ol>
16373 <li>One
16374 <li>Two:
16375 <ol>
16376 <li>Sub-one
16377 <li>Sub-two
16378 </ol>
16379 </ol>
16380
16381 !! html/parsoid
16382 <ol>
16383 <li>One
16384 </li>
16385 <li>Two:
16386 <ol>
16387 <li>Sub-one
16388 </li>
16389 <li>Sub-two
16390 </li>
16391 </ol>
16392 </li>
16393 </ol>
16394
16395 !! end
16396
16397 !! test
16398 HTML ordered list item with parameters oddity
16399 !! wikitext
16400 <ol><li id="fragment">One</li>
16401 </ol>
16402 !! html
16403 <ol><li id="fragment">One</li>
16404 </ol>
16405
16406 !! end
16407
16408 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
16409 !!test
16410 bug 5918: autonumbering
16411 !! wikitext
16412 [http://first/] [http://second] [ftp://ftp]
16413
16414 ftp://inlineftp
16415
16416 [mailto:enclosed@mail.tld With target]
16417
16418 [mailto:enclosed@mail.tld]
16419
16420 mailto:inline@mail.tld
16421 !! html/php
16422 <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>
16423 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
16424 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
16425 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
16426 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
16427 </p>
16428 !! html/parsoid
16429 <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>
16430 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
16431 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
16432 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
16433 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
16434 !! end
16435
16436
16437 #
16438 # Security and HTML correctness
16439 # From Nick Jenkins' fuzz testing
16440 #
16441
16442 !! test
16443 Fuzz testing: Parser13
16444 !! wikitext
16445 {|
16446 | http://a|
16447 !! html
16448 <table>
16449 <tr>
16450 <td>
16451 </td>
16452 </tr>
16453 </table>
16454
16455 !! end
16456
16457 !! test
16458 Fuzz testing: Parser14
16459 !! wikitext
16460 == onmouseover= ==
16461 http://__TOC__
16462 !! html
16463 <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>
16464 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16465 <ul>
16466 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16467 </ul>
16468 </div>
16469
16470
16471 !! html+tidy
16472 <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>
16473 <p>http://</p>
16474 <div id="toc" class="toc">
16475 <div id="toctitle">
16476 <h2>Contents</h2>
16477 </div>
16478 <ul>
16479 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16480 </ul>
16481 </div>
16482 <p></p>
16483 !! end
16484
16485 !! test
16486 Fuzz testing: Parser14-table
16487 !! wikitext
16488 ==a==
16489 {| STYLE=__TOC__
16490 !! html
16491 <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>
16492 <table style="&#95;_TOC&#95;_">
16493 <tr><td></td></tr>
16494 </table>
16495
16496 !! html+tidy
16497 <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>
16498 <table style="__TOC__">
16499 <tr>
16500 <td></td>
16501 </tr>
16502 </table>
16503 !! end
16504
16505 # Known to produce bogus xml (extra </td>)
16506 !! test
16507 Fuzz testing: Parser16
16508 !! options
16509 noxml
16510 !! wikitext
16511 {|
16512 !https://||||||
16513 !! html
16514 <table>
16515 <tr>
16516 <th>https://</th>
16517 <th></th>
16518 <th></th>
16519 <th>
16520 </td>
16521 </tr>
16522 </table>
16523
16524 !! html+tidy
16525 <table>
16526 <tr>
16527 <th>https://</th>
16528 <th></th>
16529 <th></th>
16530 <th></th>
16531 </tr>
16532 </table>
16533 !! end
16534
16535 !! test
16536 Fuzz testing: Parser21
16537 !! wikitext
16538 {|
16539 ! irc://{{ftp://a" onmouseover="alert('hello world');"
16540 |
16541 !! html
16542 <table>
16543 <tr>
16544 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
16545 </th>
16546 <td>
16547 </td>
16548 </tr>
16549 </table>
16550
16551 !! end
16552
16553 !! test
16554 Fuzz testing: Parser22
16555 !! wikitext
16556 http://===r:::https://b
16557
16558 {|
16559 !! html
16560 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
16561 </p>
16562 <table>
16563 <tr><td></td></tr>
16564 </table>
16565
16566 !! end
16567
16568 # Known to produce bad XML for now
16569 !! test
16570 Fuzz testing: Parser24
16571 !! options
16572 noxml
16573 !! wikitext
16574 {|
16575 {{{|
16576 <u CLASS=
16577 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
16578 <br style="onmouseover='alert(document.cookie);' " />
16579
16580 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
16581 |
16582 !! html
16583 <table>
16584 {{{|
16585 <u class="&#124;">}}}} &gt;
16586 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
16587
16588 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
16589 <tr>
16590 <td></u>
16591 </td>
16592 </tr>
16593 </table>
16594
16595 !! end
16596
16597 # Note: the current result listed for this is not what the original one was,
16598 # but the original bug was JavaScript injection, which is fixed in any case.
16599 # It's not clear that the original result listed was any more correct than the
16600 # current one. Original result:
16601 # <p>{{{|
16602 # </p>
16603 # <li class="&#124;&#124;">
16604 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
16605 !!test
16606 Fuzz testing: Parser25 (bug 6055)
16607 !! wikitext
16608 {{{
16609 |
16610 <LI CLASS=||
16611 >
16612 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
16613 !! html
16614 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
16615 </p>
16616 !! end
16617
16618 !!test
16619 Fuzz testing: URL adjacent extension (with space, clean)
16620 !! wikitext
16621 http://example.com <nowiki>junk</nowiki>
16622 !! html/php
16623 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
16624 </p>
16625 !! html/parsoid
16626 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
16627 !! end
16628
16629 !!test
16630 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
16631 !! wikitext
16632 http://example.com<nowiki>junk</nowiki>
16633 !! html/php
16634 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
16635 </p>
16636 !! html/parsoid
16637 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
16638 !! end
16639
16640 !!test
16641 Fuzz testing: URL adjacent extension (no space, dirty; pre)
16642 !! wikitext
16643 http://example.com<pre>junk</pre>
16644 !! html/php
16645 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
16646
16647 !! html/php+tidy
16648 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
16649 <pre>
16650 junk
16651 </pre>
16652 !! html/parsoid
16653 <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>
16654 !!end
16655
16656 !!test
16657 Fuzz testing: image with bogus manual thumbnail
16658 !! wikitext
16659 [[Image:foobar.jpg|thumbnail= ]]
16660 !! html/php
16661 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
16662
16663 !! html/parsoid
16664 <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>
16665 !!end
16666
16667 !! test
16668 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
16669 !! wikitext
16670 <pre dir="&#10;"></pre>
16671 !! html
16672 <pre dir="&#10;"></pre>
16673
16674 !! end
16675
16676 !! test
16677 Parsing optional HTML elements (Bug 6171)
16678 !! options
16679 !! wikitext
16680 <table>
16681 <tr>
16682 <td> Some tabular data</td>
16683 <td> More tabular data ...
16684 <td> And yet som tabular data</td>
16685 </tr>
16686 </table>
16687 !! html
16688 <table>
16689 <tr>
16690 <td> Some tabular data</td>
16691 <td> More tabular data ...
16692 </td><td> And yet som tabular data</td>
16693 </tr>
16694 </table>
16695
16696 !! end
16697
16698 !! test
16699 Correct handling of <td>, <tr> (Bug 6171)
16700 !! options
16701 !! wikitext
16702 <table>
16703 <tr>
16704 <td> Some tabular data</td>
16705 <td> More tabular data ...</td>
16706 <td> And yet som tabular data</td>
16707 </tr>
16708 </table>
16709 !! html
16710 <table>
16711 <tr>
16712 <td> Some tabular data</td>
16713 <td> More tabular data ...</td>
16714 <td> And yet som tabular data</td>
16715 </tr>
16716 </table>
16717
16718 !! end
16719
16720
16721 !! test
16722 Parsing crashing regression (fr:JavaScript)
16723 !! wikitext
16724 </body></x>
16725 !! html
16726 <p>&lt;/body&gt;&lt;/x&gt;
16727 </p>
16728 !! end
16729
16730 !! test
16731 Inline wiki vs wiki block nesting
16732 !! wikitext
16733 '''Bold paragraph
16734
16735 New wiki paragraph
16736 !! html
16737 <p><b>Bold paragraph</b>
16738 </p><p>New wiki paragraph
16739 </p>
16740 !! end
16741
16742 # FIXME: The current php output is documented
16743 # and desired output is the parsoid target.
16744 !! test
16745 Inline HTML vs wiki block nesting
16746 !! wikitext
16747 <b>Bold paragraph
16748
16749 New wiki paragraph
16750 !! html/php
16751 <p><b>Bold paragraph
16752 </p><p>New wiki paragraph</b>
16753 </p>
16754 !! html/parsoid
16755 <p><b>Bold paragraph</b>
16756 </p><p>New wiki paragraph
16757 </p>
16758 !! end
16759
16760 # Original result was this:
16761 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
16762 # </p>
16763 # While that might be marginally more intuitive, maybe, the six-apostrophe
16764 # construct is clearly pathological and the result stated here (which is what
16765 # the parser actually does) is about as reasonable as anything.
16766 !!test
16767 Mixing markup for italics and bold
16768 !! options
16769 !! wikitext
16770 '''bold''''''bold''bolditalics'''''
16771 !! html
16772 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
16773 </p>
16774 !! end
16775
16776
16777 !! article
16778 Xyzzyx
16779 !! text
16780 Article for special page transclusion test
16781 !! endarticle
16782
16783 !! test
16784 Special page transclusion
16785 !! options
16786 !! wikitext
16787 {{Special:Prefixindex/Xyzzyx}}
16788 !! html
16789 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16790
16791 !! end
16792
16793 !! test
16794 Special page transclusion twice (bug 5021)
16795 !! options
16796 !! wikitext
16797 {{Special:Prefixindex/Xyzzyx}}
16798 {{Special:Prefixindex/Xyzzyx}}
16799 !! html
16800 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16801 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16802
16803 !! end
16804
16805 !! test
16806 Transclusion of default MediaWiki message
16807 !! wikitext
16808 {{MediaWiki:Mainpage}}
16809 !! html
16810 <p>Main Page
16811 </p>
16812 !! end
16813
16814 !! test
16815 Transclusion of nonexistent MediaWiki message
16816 !! wikitext
16817 {{MediaWiki:Mainpagexxx}}
16818 !! html
16819 <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>
16820 </p>
16821 !! end
16822
16823 !! test
16824 Transclusion of MediaWiki message with underscore
16825 !! wikitext
16826 {{MediaWiki:history_short}}
16827 !! html
16828 <p>History
16829 </p>
16830 !! end
16831
16832 !! test
16833 Transclusion of MediaWiki message with space
16834 !! wikitext
16835 {{MediaWiki:history short}}
16836 !! html
16837 <p>History
16838 </p>
16839 !! end
16840
16841 !! test
16842 Invalid header with following text
16843 !! wikitext
16844 = x = y
16845 !! html
16846 <p>= x = y
16847 </p>
16848 !! end
16849
16850
16851 !! test
16852 Section extraction test (section 0)
16853 !! options
16854 section=0
16855 !! wikitext
16856 start
16857 ==a==
16858 ===aa===
16859 ====aaa====
16860 ==b==
16861 ===ba===
16862 ===bb===
16863 ====bba====
16864 ===bc===
16865 ==c==
16866 ===ca===
16867 !! html/php
16868 start
16869 !! end
16870
16871 !! test
16872 Section extraction test (section 1)
16873 !! options
16874 section=1
16875 !! wikitext
16876 start
16877 ==a==
16878 ===aa===
16879 ====aaa====
16880 ==b==
16881 ===ba===
16882 ===bb===
16883 ====bba====
16884 ===bc===
16885 ==c==
16886 ===ca===
16887 !! html/php
16888 ==a==
16889 ===aa===
16890 ====aaa====
16891 !! end
16892
16893 !! test
16894 Section extraction test (section 2)
16895 !! options
16896 section=2
16897 !! wikitext
16898 start
16899 ==a==
16900 ===aa===
16901 ====aaa====
16902 ==b==
16903 ===ba===
16904 ===bb===
16905 ====bba====
16906 ===bc===
16907 ==c==
16908 ===ca===
16909 !! html/php
16910 ===aa===
16911 ====aaa====
16912 !! end
16913
16914 !! test
16915 Section extraction test (section 3)
16916 !! options
16917 section=3
16918 !! wikitext
16919 start
16920 ==a==
16921 ===aa===
16922 ====aaa====
16923 ==b==
16924 ===ba===
16925 ===bb===
16926 ====bba====
16927 ===bc===
16928 ==c==
16929 ===ca===
16930 !! html/php
16931 ====aaa====
16932 !! end
16933
16934 !! test
16935 Section extraction test (section 4)
16936 !! options
16937 section=4
16938 !! wikitext
16939 start
16940 ==a==
16941 ===aa===
16942 ====aaa====
16943 ==b==
16944 ===ba===
16945 ===bb===
16946 ====bba====
16947 ===bc===
16948 ==c==
16949 ===ca===
16950 !! html/php
16951 ==b==
16952 ===ba===
16953 ===bb===
16954 ====bba====
16955 ===bc===
16956 !! end
16957
16958 !! test
16959 Section extraction test (section 5)
16960 !! options
16961 section=5
16962 !! wikitext
16963 start
16964 ==a==
16965 ===aa===
16966 ====aaa====
16967 ==b==
16968 ===ba===
16969 ===bb===
16970 ====bba====
16971 ===bc===
16972 ==c==
16973 ===ca===
16974 !! html/php
16975 ===ba===
16976 !! end
16977
16978 !! test
16979 Section extraction test (section 6)
16980 !! options
16981 section=6
16982 !! wikitext
16983 start
16984 ==a==
16985 ===aa===
16986 ====aaa====
16987 ==b==
16988 ===ba===
16989 ===bb===
16990 ====bba====
16991 ===bc===
16992 ==c==
16993 ===ca===
16994 !! html/php
16995 ===bb===
16996 ====bba====
16997 !! end
16998
16999 !! test
17000 Section extraction test (section 7)
17001 !! options
17002 section=7
17003 !! wikitext
17004 start
17005 ==a==
17006 ===aa===
17007 ====aaa====
17008 ==b==
17009 ===ba===
17010 ===bb===
17011 ====bba====
17012 ===bc===
17013 ==c==
17014 ===ca===
17015 !! html/php
17016 ====bba====
17017 !! end
17018
17019 !! test
17020 Section extraction test (section 8)
17021 !! options
17022 section=8
17023 !! wikitext
17024 start
17025 ==a==
17026 ===aa===
17027 ====aaa====
17028 ==b==
17029 ===ba===
17030 ===bb===
17031 ====bba====
17032 ===bc===
17033 ==c==
17034 ===ca===
17035 !! html/php
17036 ===bc===
17037 !! end
17038
17039 !! test
17040 Section extraction test (section 9)
17041 !! options
17042 section=9
17043 !! wikitext
17044 start
17045 ==a==
17046 ===aa===
17047 ====aaa====
17048 ==b==
17049 ===ba===
17050 ===bb===
17051 ====bba====
17052 ===bc===
17053 ==c==
17054 ===ca===
17055 !! html/php
17056 ==c==
17057 ===ca===
17058 !! end
17059
17060 !! test
17061 Section extraction test (section 10)
17062 !! options
17063 section=10
17064 !! wikitext
17065 start
17066 ==a==
17067 ===aa===
17068 ====aaa====
17069 ==b==
17070 ===ba===
17071 ===bb===
17072 ====bba====
17073 ===bc===
17074 ==c==
17075 ===ca===
17076 !! html/php
17077 ===ca===
17078 !! end
17079
17080 !! test
17081 Section extraction test (nonexistent section 11)
17082 !! options
17083 section=11
17084 !! wikitext
17085 start
17086 ==a==
17087 ===aa===
17088 ====aaa====
17089 ==b==
17090 ===ba===
17091 ===bb===
17092 ====bba====
17093 ===bc===
17094 ==c==
17095 ===ca===
17096 !! html/php
17097 !! end
17098
17099 !! test
17100 Section extraction test with bogus heading (section 1)
17101 !! options
17102 section=1
17103 !! wikitext
17104 ==a==
17105 ==bogus== not a legal section
17106 ==b==
17107 !! html/php
17108 ==a==
17109 ==bogus== not a legal section
17110 !! end
17111
17112 !! test
17113 Section extraction test with bogus heading (section 2)
17114 !! options
17115 section=2
17116 !! wikitext
17117 ==a==
17118 ==bogus== not a legal section
17119 ==b==
17120 !! html/php
17121 ==b==
17122 !! end
17123
17124 !! test
17125 Section extraction test with comment after heading (section 1)
17126 !! options
17127 section=1
17128 !! wikitext
17129 ==a==
17130 ==b== <!-- -->
17131 ==c==
17132 !! html/php
17133 ==a==
17134 !! end
17135
17136 !! test
17137 Section extraction test with comment after heading (section 2)
17138 !! options
17139 section=2
17140 !! wikitext
17141 ==a==
17142 ==b== <!-- -->
17143 ==c==
17144 !! html/php
17145 ==b== <!-- -->
17146 !! end
17147
17148 !! test
17149 Section extraction test with bogus <nowiki> heading (section 1)
17150 !! options
17151 section=1
17152 !! wikitext
17153 ==a==
17154 ==bogus== <nowiki>not a legal section</nowiki>
17155 ==b==
17156 !! html/php
17157 ==a==
17158 ==bogus== <nowiki>not a legal section</nowiki>
17159 !! end
17160
17161 !! test
17162 Section extraction test with bogus <nowiki> heading (section 2)
17163 !! options
17164 section=2
17165 !! wikitext
17166 ==a==
17167 ==bogus== <nowiki>not a legal section</nowiki>
17168 ==b==
17169 !! html/php
17170 ==b==
17171 !! end
17172
17173 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
17174 # instead of respecting commented sections
17175 !! test
17176 Section extraction prefixed by comment (section 1)
17177 !! options
17178 section=1
17179 !! wikitext
17180 <!-- -->==sec1==
17181 ==sec2==
17182 !! html/php
17183 ==sec2==
17184 !!end
17185
17186 !! test
17187 Section extraction prefixed by comment (section 2)
17188 !! options
17189 section=2
17190 !! wikitext
17191 <!-- -->==sec1==
17192 ==sec2==
17193 !! html/php
17194
17195 !!end
17196
17197 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
17198 # instead of respecting HTML-style headings
17199 !! test
17200 Section extraction, mixed wiki and html (section 1)
17201 !! options
17202 section=1
17203 !! wikitext
17204 <h2>unmarked</h2>
17205 unmarked
17206 ==1==
17207 one
17208 ==2==
17209 two
17210 !! html/php
17211 ==1==
17212 one
17213 !! end
17214
17215 !! test
17216 Section extraction, mixed wiki and html (section 2)
17217 !! options
17218 section=2
17219 !! wikitext
17220 <h2>unmarked</h2>
17221 unmarked
17222 ==1==
17223 one
17224 ==2==
17225 two
17226 !! html/php
17227 ==2==
17228 two
17229 !! end
17230
17231
17232 # Formerly testing for bug 3342
17233 !! test
17234 Section extraction, heading surrounded by <noinclude>
17235 !! options
17236 section=1
17237 !! wikitext
17238 <noinclude>==unmarked==</noinclude>
17239 ==marked==
17240 !! html/php
17241 ==marked==
17242 !!end
17243
17244 # Test behavior of bug 19910
17245 !! test
17246 Sectiion with all-equals
17247 !! options
17248 section=2
17249 !! wikitext
17250 ===
17251 The line above must have a trailing space
17252 === <!--
17253 --> <!-- -->
17254 But just in case it doesn't...
17255 !! html/php
17256 === <!--
17257 --> <!-- -->
17258 But just in case it doesn't...
17259 !! end
17260
17261 !! test
17262 Section replacement test (section 0)
17263 !! options
17264 replace=0,"xxx"
17265 !! wikitext
17266 start
17267 ==a==
17268 ===aa===
17269 ====aaa====
17270 ==b==
17271 ===ba===
17272 ===bb===
17273 ====bba====
17274 ===bc===
17275 ==c==
17276 ===ca===
17277 !! html/php
17278 xxx
17279
17280 ==a==
17281 ===aa===
17282 ====aaa====
17283 ==b==
17284 ===ba===
17285 ===bb===
17286 ====bba====
17287 ===bc===
17288 ==c==
17289 ===ca===
17290 !! end
17291
17292 !! test
17293 Section replacement test (section 1)
17294 !! options
17295 replace=1,"xxx"
17296 !! wikitext
17297 start
17298 ==a==
17299 ===aa===
17300 ====aaa====
17301 ==b==
17302 ===ba===
17303 ===bb===
17304 ====bba====
17305 ===bc===
17306 ==c==
17307 ===ca===
17308 !! html/php
17309 start
17310 xxx
17311
17312 ==b==
17313 ===ba===
17314 ===bb===
17315 ====bba====
17316 ===bc===
17317 ==c==
17318 ===ca===
17319 !! end
17320
17321 !! test
17322 Section replacement test (section 2)
17323 !! options
17324 replace=2,"xxx"
17325 !! wikitext
17326 start
17327 ==a==
17328 ===aa===
17329 ====aaa====
17330 ==b==
17331 ===ba===
17332 ===bb===
17333 ====bba====
17334 ===bc===
17335 ==c==
17336 ===ca===
17337 !! html/php
17338 start
17339 ==a==
17340 xxx
17341
17342 ==b==
17343 ===ba===
17344 ===bb===
17345 ====bba====
17346 ===bc===
17347 ==c==
17348 ===ca===
17349 !! end
17350
17351 !! test
17352 Section replacement test (section 3)
17353 !! options
17354 replace=3,"xxx"
17355 !! wikitext
17356 start
17357 ==a==
17358 ===aa===
17359 ====aaa====
17360 ==b==
17361 ===ba===
17362 ===bb===
17363 ====bba====
17364 ===bc===
17365 ==c==
17366 ===ca===
17367 !! html/php
17368 start
17369 ==a==
17370 ===aa===
17371 xxx
17372
17373 ==b==
17374 ===ba===
17375 ===bb===
17376 ====bba====
17377 ===bc===
17378 ==c==
17379 ===ca===
17380 !! end
17381
17382 !! test
17383 Section replacement test (section 4)
17384 !! options
17385 replace=4,"xxx"
17386 !! wikitext
17387 start
17388 ==a==
17389 ===aa===
17390 ====aaa====
17391 ==b==
17392 ===ba===
17393 ===bb===
17394 ====bba====
17395 ===bc===
17396 ==c==
17397 ===ca===
17398 !! html/php
17399 start
17400 ==a==
17401 ===aa===
17402 ====aaa====
17403 xxx
17404
17405 ==c==
17406 ===ca===
17407 !! end
17408
17409 !! test
17410 Section replacement test (section 5)
17411 !! options
17412 replace=5,"xxx"
17413 !! wikitext
17414 start
17415 ==a==
17416 ===aa===
17417 ====aaa====
17418 ==b==
17419 ===ba===
17420 ===bb===
17421 ====bba====
17422 ===bc===
17423 ==c==
17424 ===ca===
17425 !! html/php
17426 start
17427 ==a==
17428 ===aa===
17429 ====aaa====
17430 ==b==
17431 xxx
17432
17433 ===bb===
17434 ====bba====
17435 ===bc===
17436 ==c==
17437 ===ca===
17438 !! end
17439
17440 !! test
17441 Section replacement test (section 6)
17442 !! options
17443 replace=6,"xxx"
17444 !! wikitext
17445 start
17446 ==a==
17447 ===aa===
17448 ====aaa====
17449 ==b==
17450 ===ba===
17451 ===bb===
17452 ====bba====
17453 ===bc===
17454 ==c==
17455 ===ca===
17456 !! html/php
17457 start
17458 ==a==
17459 ===aa===
17460 ====aaa====
17461 ==b==
17462 ===ba===
17463 xxx
17464
17465 ===bc===
17466 ==c==
17467 ===ca===
17468 !! end
17469
17470 !! test
17471 Section replacement test (section 7)
17472 !! options
17473 replace=7,"xxx"
17474 !! wikitext
17475 start
17476 ==a==
17477 ===aa===
17478 ====aaa====
17479 ==b==
17480 ===ba===
17481 ===bb===
17482 ====bba====
17483 ===bc===
17484 ==c==
17485 ===ca===
17486 !! html/php
17487 start
17488 ==a==
17489 ===aa===
17490 ====aaa====
17491 ==b==
17492 ===ba===
17493 ===bb===
17494 xxx
17495
17496 ===bc===
17497 ==c==
17498 ===ca===
17499 !! end
17500
17501 !! test
17502 Section replacement test (section 8)
17503 !! options
17504 replace=8,"xxx"
17505 !! wikitext
17506 start
17507 ==a==
17508 ===aa===
17509 ====aaa====
17510 ==b==
17511 ===ba===
17512 ===bb===
17513 ====bba====
17514 ===bc===
17515 ==c==
17516 ===ca===
17517 !! html/php
17518 start
17519 ==a==
17520 ===aa===
17521 ====aaa====
17522 ==b==
17523 ===ba===
17524 ===bb===
17525 ====bba====
17526 xxx
17527
17528 ==c==
17529 ===ca===
17530 !!end
17531
17532 !! test
17533 Section replacement test (section 9)
17534 !! options
17535 replace=9,"xxx"
17536 !! wikitext
17537 start
17538 ==a==
17539 ===aa===
17540 ====aaa====
17541 ==b==
17542 ===ba===
17543 ===bb===
17544 ====bba====
17545 ===bc===
17546 ==c==
17547 ===ca===
17548 !! html/php
17549 start
17550 ==a==
17551 ===aa===
17552 ====aaa====
17553 ==b==
17554 ===ba===
17555 ===bb===
17556 ====bba====
17557 ===bc===
17558 xxx
17559 !! end
17560
17561 !! test
17562 Section replacement test (section 10)
17563 !! options
17564 replace=10,"xxx"
17565 !! wikitext
17566 start
17567 ==a==
17568 ===aa===
17569 ====aaa====
17570 ==b==
17571 ===ba===
17572 ===bb===
17573 ====bba====
17574 ===bc===
17575 ==c==
17576 ===ca===
17577 !! html/php
17578 start
17579 ==a==
17580 ===aa===
17581 ====aaa====
17582 ==b==
17583 ===ba===
17584 ===bb===
17585 ====bba====
17586 ===bc===
17587 ==c==
17588 xxx
17589 !! end
17590
17591 !! test
17592 Section replacement test with initial whitespace (bug 13728)
17593 !! options
17594 replace=2,"xxx"
17595 !! wikitext
17596 Preformatted initial line
17597 ==a==
17598 ===a===
17599 !! html/php
17600 Preformatted initial line
17601 ==a==
17602 xxx
17603 !! end
17604
17605
17606 !! test
17607 Section extraction, heading followed by pre with 20 spaces (bug 6398)
17608 !! options
17609 section=1
17610 !! wikitext
17611 ==a==
17612 a
17613 !! html/php
17614 ==a==
17615 a
17616 !! end
17617
17618 !! test
17619 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
17620 !! options
17621 section=1
17622 !! wikitext
17623 ==a==
17624 a
17625 !! html/php
17626 ==a==
17627 a
17628 !! end
17629
17630
17631 !! test
17632 Section extraction, <pre> around bogus header (bug 10309)
17633 !! options
17634 noxml section=2
17635 !! wikitext
17636 == Section One ==
17637 <pre>
17638 =======
17639 </pre>
17640
17641 == Section Two ==
17642 stuff
17643 !! html/php
17644 == Section Two ==
17645 stuff
17646 !! end
17647
17648 !! test
17649 Section replacement, <pre> around bogus header (bug 10309)
17650 !! options
17651 noxml replace=2,"xxx"
17652 !! wikitext
17653 == Section One ==
17654 <pre>
17655 =======
17656 </pre>
17657
17658 == Section Two ==
17659 stuff
17660 !! html/php
17661 == Section One ==
17662 <pre>
17663 =======
17664 </pre>
17665
17666 xxx
17667 !! end
17668
17669
17670 !! test
17671 Handling of &#x0A; in URLs
17672 !! wikitext
17673 ** irc://&#x0A;a
17674 !! html/php
17675 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17676
17677 !! html/parsoid
17678 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
17679 a">irc://
17680 a</a></li></ul></li></ul>
17681 !! end
17682
17683 !! test
17684 Handling of %0A in URLs
17685 !! wikitext
17686 ** irc://%0Aa
17687 !! html/php
17688 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17689
17690 !! html/parsoid
17691 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17692 !! end
17693
17694
17695 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
17696 !! test
17697 5 quotes, code coverage +1 line
17698 !! options
17699 parsoid=wt2html
17700 !! wikitext
17701 '''''
17702 !! html/php
17703 !! html/parsoid
17704 <p><b><i></i></b></p>
17705 !! end
17706
17707 # same html as previous, but wikitext adjusted to match parsoid html2wt
17708 # note that wt2html and html2html will put the <i> before the <b>
17709 !! test
17710 5 quotes, code coverage +1 line w/ nowiki (1)
17711 !! options
17712 parsoid=wt2wt,html2wt
17713 !! wikitext
17714 '''''<nowiki/>'''''
17715 !! html/php
17716 <p><i></i>
17717 </p>
17718 !! html/parsoid
17719 <p><b><i></i></b></p>
17720 !! end
17721
17722 # same as previous, just swapping the <i> and <b>
17723 !! test
17724 5 quotes, code coverage +1 line w/ nowiki (2)
17725 !! wikitext
17726 '''''<nowiki/>'''''
17727 !! html/php
17728 <p><i></i>
17729 </p>
17730 !! html/parsoid
17731 <p><i><b></b></i></p>
17732 !! end
17733
17734 !! test
17735 Special:Search page linking.
17736 !! wikitext
17737 {{Special:search}}
17738 !! html
17739 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
17740 </p>
17741 !! end
17742
17743 !! test
17744 {{!}} is a magic word
17745 !! wikitext
17746 {{!}} is a magic word there and {{!}} is still a magic word here
17747 !! html/php
17748 <p>| is a magic word there and | is still a magic word here
17749 </p>
17750 !! html/parsoid
17751 <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>
17752 !! end
17753
17754 !! test
17755 Say the magic word
17756 !! options
17757 title=[[Parser test]]
17758 !! wikitext
17759 * {{PAGENAME}}
17760 * {{PAGENAMEE}}
17761 * {{FULLPAGENAME}}
17762 * {{FULLPAGENAMEE}}
17763 * {{BASEPAGENAME}}
17764 * {{BASEPAGENAMEE}}
17765 * {{SUBPAGENAME}}
17766 * {{SUBPAGENAMEE}}
17767 * {{ROOTPAGENAME}}
17768 * {{ROOTPAGENAMEE}}
17769 * {{TALKPAGENAME}}
17770 * {{TALKPAGENAMEE}}
17771 * {{SUBJECTPAGENAME}}
17772 * {{SUBJECTPAGENAMEE}}
17773 * {{NAMESPACEE}}
17774 * {{NAMESPACE}}
17775 * {{NAMESPACENUMBER}}
17776 * {{TALKSPACE}}
17777 * {{TALKSPACEE}}
17778 * {{SUBJECTSPACE}}
17779 * {{SUBJECTSPACEE}}
17780 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
17781 !! html
17782 <ul><li> Parser test</li>
17783 <li> Parser_test</li>
17784 <li> Parser test</li>
17785 <li> Parser_test</li>
17786 <li> Parser test</li>
17787 <li> Parser_test</li>
17788 <li> Parser test</li>
17789 <li> Parser_test</li>
17790 <li> Parser test</li>
17791 <li> Parser_test</li>
17792 <li> Talk:Parser test</li>
17793 <li> Talk:Parser_test</li>
17794 <li> Parser test</li>
17795 <li> Parser_test</li>
17796 <li> </li>
17797 <li> </li>
17798 <li> 0</li>
17799 <li> Talk</li>
17800 <li> Talk</li>
17801 <li> </li>
17802 <li> </li>
17803 <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>
17804
17805 !! end
17806 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
17807
17808 !! test
17809 Gallery
17810 !! wikitext
17811 <gallery>
17812 image1.png |
17813 image2.gif|||||
17814
17815 image3|
17816 image4 |300px| centre
17817 image5.svg| http://///////
17818 [[x|xx]]]]
17819 * image6
17820 </gallery>
17821 !! html
17822 <ul class="gallery mw-gallery-traditional">
17823 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17824 <div class="thumb" style="height: 150px;">Image1.png</div>
17825 <div class="gallerytext">
17826 </div>
17827 </div></li>
17828 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17829 <div class="thumb" style="height: 150px;">Image2.gif</div>
17830 <div class="gallerytext">
17831 <p>||||
17832 </p>
17833 </div>
17834 </div></li>
17835 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17836 <div class="thumb" style="height: 150px;">Image3</div>
17837 <div class="gallerytext">
17838 </div>
17839 </div></li>
17840 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17841 <div class="thumb" style="height: 150px;">Image4</div>
17842 <div class="gallerytext">
17843 <p>300px| centre
17844 </p>
17845 </div>
17846 </div></li>
17847 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17848 <div class="thumb" style="height: 150px;">Image5.svg</div>
17849 <div class="gallerytext">
17850 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
17851 </p>
17852 </div>
17853 </div></li>
17854 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17855 <div class="thumb" style="height: 150px;">* image6</div>
17856 <div class="gallerytext">
17857 </div>
17858 </div></li>
17859 </ul>
17860
17861 !! end
17862
17863 !! test
17864 Gallery (with options)
17865 !! wikitext
17866 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
17867 File:Nonexistent.jpg|caption
17868 File:Nonexistent.jpg
17869 image:foobar.jpg|some '''caption''' [[Main Page]]
17870 image:foobar.jpg
17871 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
17872 </gallery>
17873 !! html
17874 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
17875 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
17876 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17877 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
17878 <div class="gallerytext">
17879 <p>caption
17880 </p>
17881 </div>
17882 </div></li>
17883 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17884 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
17885 <div class="gallerytext">
17886 </div>
17887 </div></li>
17888 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17889 <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>
17890 <div class="gallerytext">
17891 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17892 </p>
17893 </div>
17894 </div></li>
17895 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17896 <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>
17897 <div class="gallerytext">
17898 </div>
17899 </div></li>
17900 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17901 <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>
17902 <div class="gallerytext">
17903 <p>Blabla|blabla.
17904 </p>
17905 </div>
17906 </div></li>
17907 </ul>
17908
17909 !! end
17910
17911 !! test
17912 Gallery with link that has fragment
17913 !! wikitext
17914 <gallery>
17915 image:foobar.jpg|link=Main_Page
17916 image:foobar.jpg|link=Main_Page#section
17917 image:foobar.jpg|link=Main Page#section|caption
17918 </gallery>
17919 !! html
17920 <ul class="gallery mw-gallery-traditional">
17921 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17922 <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>
17923 <div class="gallerytext">
17924 </div>
17925 </div></li>
17926 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17927 <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>
17928 <div class="gallerytext">
17929 </div>
17930 </div></li>
17931 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17932 <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>
17933 <div class="gallerytext">
17934 <p>caption
17935 </p>
17936 </div>
17937 </div></li>
17938 </ul>
17939
17940 !! end
17941
17942 !! test
17943 Gallery with wikitext inside caption
17944 !! wikitext
17945 <gallery>
17946 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
17947 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
17948 </gallery>
17949 !! html
17950 <ul class="gallery mw-gallery-traditional">
17951 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17952 <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>
17953 <div class="gallerytext">
17954 <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>
17955 </p>
17956 </div>
17957 </div></li>
17958 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17959 <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>
17960 <div class="gallerytext">
17961 <p>This is a test template
17962 </p>
17963 </div>
17964 </div></li>
17965 </ul>
17966
17967 !! end
17968
17969 !! test
17970 gallery (with showfilename option)
17971 !! wikitext
17972 <gallery showfilename>
17973 File:Nonexistent.jpg|caption
17974 File:Nonexistent.jpg
17975 image:foobar.jpg|some '''caption''' [[Main Page]]
17976 File:Foobar.jpg
17977 </gallery>
17978 !! html
17979 <ul class="gallery mw-gallery-traditional">
17980 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17981 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17982 <div class="gallerytext">
17983 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
17984 caption
17985 </p>
17986 </div>
17987 </div></li>
17988 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17989 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
17990 <div class="gallerytext">
17991 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
17992 </p>
17993 </div>
17994 </div></li>
17995 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17996 <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>
17997 <div class="gallerytext">
17998 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
17999 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18000 </p>
18001 </div>
18002 </div></li>
18003 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18004 <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>
18005 <div class="gallerytext">
18006 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18007 </p>
18008 </div>
18009 </div></li>
18010 </ul>
18011
18012 !! end
18013
18014 !! test
18015 Gallery (with namespace-less filenames)
18016 !! wikitext
18017 <gallery>
18018 File:Nonexistent.jpg
18019 Nonexistent.jpg
18020 image:foobar.jpg
18021 foobar.jpg
18022 </gallery>
18023 !! html
18024 <ul class="gallery mw-gallery-traditional">
18025 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18026 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18027 <div class="gallerytext">
18028 </div>
18029 </div></li>
18030 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18031 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18032 <div class="gallerytext">
18033 </div>
18034 </div></li>
18035 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18036 <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>
18037 <div class="gallerytext">
18038 </div>
18039 </div></li>
18040 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18041 <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>
18042 <div class="gallerytext">
18043 </div>
18044 </div></li>
18045 </ul>
18046
18047 !! end
18048
18049 !! test
18050 HTML Hex character encoding (spells the word "JavaScript")
18051 !! options
18052 parsoid=wt2html,wt2wt,html2html
18053 !! wikitext
18054 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
18055 !! html/php
18056 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
18057 </p>
18058 !! html/php+tidy
18059 <p>JavaScript</p>
18060 !! html/parsoid
18061 <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>
18062 !! end
18063
18064 !! test
18065 HTML Hex character encoding bogus encoding (bug 26437 regression check)
18066 !! wikitext
18067 &#xsee;&#XSEE;
18068 !! html/php
18069 <p>&amp;#xsee;&amp;#XSEE;
18070 </p>
18071 !! html/parsoid
18072 <p>&amp;#xsee;&amp;#XSEE;</p>
18073 !! end
18074
18075 !! test
18076 HTML Hex character encoding mixed case
18077 !! options
18078 parsoid=wt2html,wt2wt,html2html
18079 !! wikitext
18080 &#xEE;&#Xee;
18081 !! html/php
18082 <p>&#xee;&#xee;
18083 </p>
18084 !! html/php+tidy
18085 <p>îî</p>
18086 !! html/parsoid
18087 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
18088 !! end
18089
18090 !! test
18091 __FORCETOC__ override
18092 !! wikitext
18093 __NEWSECTIONLINK__
18094 __FORCETOC__
18095 !! html/php
18096 <p><br />
18097 </p>
18098 !! end
18099
18100 !! test
18101 ISBN code coverage
18102 !! wikitext
18103 ISBN 978-0-1234-56&#x20;789
18104 !! html
18105 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
18106 </p>
18107 !! html+tidy
18108 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
18109 !! html/parsoid
18110 <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>
18111 !! end
18112
18113 !! test
18114 ISBN followed by 5 spaces
18115 !! wikitext
18116 ISBN
18117 !! html
18118 <p>ISBN
18119 </p>
18120 !! end
18121
18122 !! test
18123 Double ISBN
18124 !! wikitext
18125 ISBN ISBN 1234567890
18126 !! html/php
18127 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18128 </p>
18129 !! html/parsoid
18130 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
18131 !! end
18132
18133 # Uppercase X and lowercase x as well
18134 !! test
18135 ISBN with an X
18136 !! wikitext
18137 ISBN 3-462-04561-X
18138 ISBN 3-462-04561-x
18139 ISBN 080442957X
18140 ISBN 080442957x
18141 ISBN 978080442957X
18142 ISBN 978080442957x
18143 !! html/php
18144 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
18145 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
18146 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
18147 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
18148 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
18149 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
18150 </p>
18151 !! html/parsoid
18152 <p><a href="./Special:BookSources/346204561X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
18153 <a href="./Special:BookSources/346204561X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
18154 <a href="./Special:BookSources/080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
18155 <a href="./Special:BookSources/080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
18156 <a href="./Special:BookSources/978080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
18157 <a href="./Special:BookSources/978080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
18158 !! end
18159
18160 !! test
18161 ISBN with empty prefix (parsoid test)
18162 !! wikitext
18163 ISBN 1234567890
18164 !! html/php
18165 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18166 </p>
18167 !! html/parsoid
18168 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
18169 !! end
18170
18171 !! test
18172 Bug 22905: <abbr> followed by ISBN followed by </a>
18173 !! wikitext
18174 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
18175 !! html/php
18176 <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>
18177 </p>
18178 !! html/parsoid
18179 <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>
18180 !! end
18181
18182 !! test
18183 Double RFC
18184 !! wikitext
18185 RFC RFC 1234
18186 !! html
18187 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
18188 </p>
18189 !! end
18190
18191 !! test
18192 Double RFC with a wiki link
18193 !! wikitext
18194 RFC [[RFC 1234]]
18195 !! html
18196 <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>
18197 </p>
18198 !! end
18199
18200 !! test
18201 RFC code coverage
18202 !! wikitext
18203 RFC 983&#x20;987
18204 !! html
18205 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
18206 </p>
18207 !! html+tidy
18208 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
18209 !! end
18210
18211 !! test
18212 Centre-aligned image
18213 !! wikitext
18214 [[Image:foobar.jpg|centre]]
18215 !! html
18216 <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>
18217
18218 !!end
18219
18220 !! test
18221 None-aligned image
18222 !! wikitext
18223 [[Image:foobar.jpg|none]]
18224 !! html
18225 <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>
18226
18227 !!end
18228
18229 !! test
18230 Width + Height sized image (using px) (height is ignored)
18231 !! wikitext
18232 [[Image:foobar.jpg|640x480px]]
18233 !! html
18234 <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>
18235 </p>
18236 !!end
18237
18238 !! test
18239 Width-sized image (using px, no following whitespace)
18240 !! wikitext
18241 [[Image:foobar.jpg|640px]]
18242 !! html
18243 <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>
18244 </p>
18245 !!end
18246
18247 !! test
18248 Width-sized image (using px, with following whitespace - test regression from r39467)
18249 !! wikitext
18250 [[Image:foobar.jpg|640px ]]
18251 !! html
18252 <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>
18253 </p>
18254 !!end
18255
18256 !! test
18257 Width-sized image (using px, with preceding whitespace - test regression from r39467)
18258 !! wikitext
18259 [[Image:foobar.jpg| 640px]]
18260 !! html
18261 <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>
18262 </p>
18263 !!end
18264
18265 !! test
18266 Image with page parameter
18267 !! options
18268 djvu
18269 !! wikitext
18270 [[File:LoremIpsum.djvu|page=2]]
18271 !! html/php
18272 <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>
18273 </p>
18274 !! html/parsoid
18275 <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>
18276 !! end
18277
18278 !! test
18279 Another italics / bold test
18280 !! wikitext
18281 ''' ''x'
18282 !! html
18283 <pre>'<i> </i>x'
18284 </pre>
18285 !!end
18286
18287 # FIXME: The php output seems broken. It's interleaving some open/close tags.
18288 !! test
18289 dt/dd/dl test
18290 !! wikitext
18291 :;;;::
18292 !! html/php
18293 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
18294
18295 !! html/parsoid
18296 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
18297
18298 !!end
18299
18300
18301 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
18302 !! test
18303 Images with the "|" character in the comment
18304 !! wikitext
18305 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
18306 !! html/php
18307 <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>
18308
18309 !! html/parsoid
18310 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-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>
18311 !! end
18312
18313 !! test
18314 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
18315 !! wikitext
18316 <html><script>alert(1);</script></html>
18317 !! html
18318 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
18319 </p>
18320 !! end
18321
18322 !! test
18323 HTML with raw HTML ($wgRawHtml==true)
18324 !! options
18325 wgRawHtml=1
18326 !! wikitext
18327 <html><script>alert(1);</script></html>
18328 !! html
18329 <p><script>alert(1);</script>
18330 </p>
18331 !! end
18332
18333 !! test
18334 Parents of subpages, one level up
18335 !! options
18336 subpage title=[[Subpage test/L1/L2/L3]]
18337 !! wikitext
18338 [[../|L2]]
18339 !! html
18340 <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>
18341 </p>
18342 !! end
18343
18344
18345 !! test
18346 Parents of subpages, one level up, not named
18347 !! options
18348 subpage title=[[Subpage test/L1/L2/L3]]
18349 !! wikitext
18350 [[../]]
18351 !! html
18352 <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>
18353 </p>
18354 !! end
18355
18356
18357
18358 !! test
18359 Parents of subpages, two levels up
18360 !! options
18361 subpage title=[[Subpage test/L1/L2/L3]]
18362 !! wikitext
18363 [[../../|L1]]2
18364
18365 [[../../|L1]]l
18366 !! html
18367 <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
18368 </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>
18369 </p>
18370 !! end
18371
18372 !! test
18373 Parents of subpages, two levels up, without trailing slash or name.
18374 !! options
18375 subpage title=[[Subpage test/L1/L2/L3]]
18376 !! wikitext
18377 [[../..]]
18378 !! html
18379 <p>[[../..]]
18380 </p>
18381 !! end
18382
18383 !! test
18384 Parents of subpages, two levels up, with lots of extra trailing slashes.
18385 !! options
18386 subpage title=[[Subpage test/L1/L2/L3]]
18387 !! wikitext
18388 [[../../////]]
18389 !! html
18390 <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>
18391 </p>
18392 !! end
18393
18394 !! article
18395 Subpage test/L1/L2/L3Sibling
18396 !! text
18397 Sibling article
18398 !! endarticle
18399
18400 !! test
18401 Transclusion of a sibling page (one level up)
18402 !! options
18403 subpage title=[[Subpage test/L1/L2/L3]]
18404 !! wikitext
18405 {{../L3Sibling}}
18406 !! html
18407 <p>Sibling article
18408 </p>
18409 !! end
18410
18411 !! test
18412 Transclusion of a child page
18413 !! options
18414 subpage title=[[Subpage test/L1/L2]]
18415 !! wikitext
18416 {{/L3Sibling}}
18417 !! html
18418 <p>Sibling article
18419 </p>
18420 !! end
18421
18422 !! test
18423 Non-transclusion because of too many up levels
18424 !! options
18425 subpage title=[[Subpage test/L1/L2/L3]]
18426 !! wikitext
18427 {{../../../../More than parent}}
18428 !! html
18429 <p>{{../../../../More than parent}}
18430 </p>
18431 !! end
18432
18433 !! test
18434 Definition list code coverage
18435 !! wikitext
18436 ; title : def
18437 ; title : def
18438 ;title: def
18439 !! html/php
18440 <dl><dt> title &#160;</dt>
18441 <dd> def</dd>
18442 <dt> title&#160;</dt>
18443 <dd> def</dd>
18444 <dt>title</dt>
18445 <dd> def</dd></dl>
18446
18447 !! html/parsoid
18448 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18449 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18450 <dt>title</dt><dd> def</dd></dl>
18451 !! end
18452
18453 !! test
18454 Don't fall for the self-closing div
18455 !! wikitext
18456 <div>hello world</div/>
18457 !! html
18458 <div>hello world</div>
18459
18460 !! end
18461
18462 !! test
18463 MSGNW magic word
18464 !! wikitext
18465 {{MSGNW:msg}}
18466 !! html/php
18467 <p>&#91;&#91;:Template:Msg&#93;&#93;
18468 </p>
18469 !! end
18470
18471 !! test
18472 RAW magic word
18473 !! wikitext
18474 {{RAW:QUERTY}}
18475 !! html
18476 <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>
18477 </p>
18478 !! end
18479
18480 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
18481 !! test
18482 Always escape literal '>' in output, not just after '<'
18483 !! wikitext
18484 ><>
18485 !! html
18486 <p>&gt;&lt;&gt;
18487 </p>
18488 !! end
18489
18490 !! test
18491 Template caching
18492 !! wikitext
18493 {{Test}}
18494 {{Test}}
18495 !! html
18496 <p>This is a test template
18497 This is a test template
18498 </p>
18499 !! end
18500
18501
18502 !! article
18503 MediaWiki:Fake
18504 !! text
18505 ==header==
18506 !! endarticle
18507
18508 !! test
18509 Inclusion of !userCanEdit() content
18510 !! wikitext
18511 {{MediaWiki:Fake}}
18512 !! html
18513 <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>
18514
18515 !! end
18516
18517
18518 !! test
18519 Out-of-order TOC heading levels
18520 !! wikitext
18521 ==2==
18522 ======6======
18523 ===3===
18524 =1=
18525 =====5=====
18526 ==2==
18527 !! html
18528 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18529 <ul>
18530 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
18531 <ul>
18532 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
18533 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
18534 </ul>
18535 </li>
18536 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
18537 <ul>
18538 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
18539 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
18540 </ul>
18541 </li>
18542 </ul>
18543 </div>
18544
18545 <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>
18546 <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>
18547 <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>
18548 <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>
18549 <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>
18550 <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>
18551
18552 !! end
18553
18554
18555 !! test
18556 ISBN with a dummy number
18557 !! wikitext
18558 ISBN ---
18559 !! html
18560 <p>ISBN ---
18561 </p>
18562 !! end
18563
18564
18565 !! test
18566 ISBN with space-delimited number
18567 !! wikitext
18568 ISBN 92 9017 032 8
18569 !! html
18570 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
18571 </p>
18572 !! end
18573
18574
18575 !! test
18576 ISBN with multiple spaces, no number
18577 !! wikitext
18578 ISBN foo
18579 !! html
18580 <p>ISBN foo
18581 </p>
18582 !! end
18583
18584
18585 !! test
18586 ISBN length
18587 !! wikitext
18588 ISBN 123456789
18589
18590 ISBN 1234567890
18591
18592 ISBN 12345678901
18593 !! html
18594 <p>ISBN 123456789
18595 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18596 </p><p>ISBN 12345678901
18597 </p>
18598 !! end
18599
18600
18601 !! test
18602 ISBN with trailing year (bug 8110)
18603 !! wikitext
18604 ISBN 1-234-56789-0 - 2006
18605
18606 ISBN 1 234 56789 0 - 2006
18607 !! html
18608 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
18609 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
18610 </p>
18611 !! end
18612
18613
18614 !! test
18615 anchorencode
18616 !! wikitext
18617 {{anchorencode:foo bar©#%n}}
18618 !! html
18619 <p>foo_bar.C2.A9.23.25n
18620 </p>
18621 !! end
18622
18623 !! test
18624 anchorencode trims spaces
18625 !! wikitext
18626 {{anchorencode: __pretty__please__}}
18627 !! html
18628 <p>pretty_please
18629 </p>
18630 !! end
18631
18632 !! test
18633 anchorencode deals with links
18634 !! wikitext
18635 {{anchorencode: [[hello|world]] [[hi]]}}
18636 !! html
18637 <p>world_hi
18638 </p>
18639 !! end
18640
18641 !! test
18642 anchorencode deals with templates
18643 !! wikitext
18644 {{anchorencode: {{Foo}} }}
18645 !! html
18646 <p>FOO
18647 </p>
18648 !! end
18649
18650 !! test
18651 anchorencode encodes like the TOC generator: (bug 18431)
18652 !! wikitext
18653 === _ +:.3A%3A&&amp;]] ===
18654 {{anchorencode: _ +:.3A%3A&&amp;]] }}
18655 __NOEDITSECTION__
18656 !! html
18657 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
18658 <p>.2B:.3A.253A.26.26.5D.5D
18659 </p>
18660 !! end
18661
18662 !! test
18663 Bug 6200: blockquotes and paragraph formatting
18664 !! wikitext
18665 <blockquote>
18666 foo
18667 </blockquote>
18668
18669 bar
18670
18671 baz
18672 !! html
18673 <blockquote>
18674 <p>foo
18675 </p>
18676 </blockquote>
18677 <p>bar
18678 </p>
18679 <pre>baz
18680 </pre>
18681 !! end
18682
18683 !! test
18684 Bug 8293: Use of center tag ruins paragraph formatting
18685 !! wikitext
18686 <center>
18687 foo
18688 </center>
18689
18690 bar
18691
18692 baz
18693 !! html
18694 <center>
18695 <p>foo
18696 </p>
18697 </center>
18698 <p>bar
18699 </p>
18700 <pre>baz
18701 </pre>
18702 !! end
18703
18704 !!test
18705 Parsing of overlapping (improperly nested) inline html tags
18706 !! wikitext
18707 <span><s>x</span></s>
18708 !! html/php
18709 <p><span><s>x&lt;/span&gt;</s></span>
18710 </p>
18711 !! html/parsoid
18712 <p><span><s>x</s></span>
18713 </p>
18714 !!end
18715
18716 ###
18717 ### Language variants related tests
18718 ###
18719 !! test
18720 Self-link in language variants
18721 !! options
18722 title=[[Dunav]] language=sr
18723 !! wikitext
18724 Both [[Dunav]] and [[Дунав]] are names for this river.
18725 !! html
18726 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
18727 </p>
18728 !!end
18729
18730 !! article
18731 Дуна
18732 !! text
18733 content
18734 !! endarticle
18735
18736 !! test
18737 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
18738 !! options
18739 title=[[Duna]] language=sr
18740 !! wikitext
18741 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
18742 !! html
18743 <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.
18744 </p>
18745 !! end
18746
18747 !! test
18748 Link to a section of a variant of this title shouldn't be parsed as self-link
18749 !! options
18750 title=[[Duna]] language=sr
18751 !! wikitext
18752 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
18753 !! html
18754 <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.
18755 </p>
18756 !! end
18757
18758 !! test
18759 Link to pages in language variants
18760 !! options
18761 language=sr
18762 !! wikitext
18763 Main Page can be written as [[Маин Паге]]
18764 !! html
18765 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
18766 </p>
18767 !!end
18768
18769
18770 !! test
18771 Multiple links to pages in language variants
18772 !! options
18773 language=sr
18774 !! wikitext
18775 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
18776 !! html
18777 <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>.
18778 </p>
18779 !!end
18780
18781
18782 !! test
18783 Simple template in language variants
18784 !! options
18785 language=sr
18786 !! wikitext
18787 {{тест}}
18788 !! html
18789 <p>This is a test template
18790 </p>
18791 !! end
18792
18793
18794 !! test
18795 Template with explicit namespace in language variants
18796 !! options
18797 language=sr
18798 !! wikitext
18799 {{Template:тест}}
18800 !! html
18801 <p>This is a test template
18802 </p>
18803 !! end
18804
18805
18806 !! test
18807 Basic test for template parameter in language variants
18808 !! options
18809 language=sr
18810 !! wikitext
18811 {{парамтест|param=foo}}
18812 !! html
18813 <p>This is a test template with parameter foo
18814 </p>
18815 !! end
18816
18817
18818 !! test
18819 Simple category in language variants
18820 !! options
18821 language=sr cat
18822 !! wikitext
18823 [[Category:МедиаWики Усер'с Гуиде]]
18824 !! html
18825 <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>
18826 !! end
18827
18828
18829 !! article
18830 Category:分类
18831 !! text
18832 blah
18833 !! endarticle
18834
18835 !! article
18836 Category:分類
18837 !! text
18838 blah
18839 !! endarticle
18840
18841 !! test
18842 Don't convert blue categorylinks to another variant (bug 33210)
18843 !! options
18844 language=zh cat
18845 !! wikitext
18846 [[A]][[Category:分类]]
18847 !! html
18848 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
18849 !! end
18850
18851
18852 !! test
18853 Stripping -{}- tags (language variants)
18854 !! options
18855 language=sr
18856 !! wikitext
18857 Latin proverb: -{Ne nuntium necare}-
18858 !! html
18859 <p>Latin proverb: Ne nuntium necare
18860 </p>
18861 !! end
18862
18863
18864 !! test
18865 Prevent conversion with -{}- tags (language variants)
18866 !! options
18867 language=sr variant=sr-ec
18868 !! wikitext
18869 Latinski: -{Ne nuntium necare}-
18870 !! html
18871 <p>Латински: Ne nuntium necare
18872 </p>
18873 !! end
18874
18875
18876 !! test
18877 Prevent conversion of text with -{}- tags (language variants)
18878 !! options
18879 language=sr variant=sr-ec
18880 !! wikitext
18881 Latinski: -{Ne nuntium necare}-
18882 !! html
18883 <p>Латински: Ne nuntium necare
18884 </p>
18885 !! end
18886
18887
18888 !! test
18889 Prevent conversion of links with -{}- tags (language variants)
18890 !! options
18891 language=sr variant=sr-ec
18892 !! wikitext
18893 -{[[Main Page]]}-
18894 !! html
18895 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18896 </p>
18897 !! end
18898
18899
18900 !! test
18901 -{}- tags within headlines (within html for parserConvert())
18902 !! options
18903 language=sr variant=sr-ec
18904 !! wikitext
18905 == -{Naslov}- ==
18906 !! html
18907 <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>
18908
18909 !! end
18910
18911
18912 !! test
18913 Explicit definition of language variant alternatives
18914 !! options
18915 language=zh variant=zh-tw
18916 !! wikitext
18917 -{zh:China;zh-tw:Taiwan}-, not China
18918 !! html
18919 <p>Taiwan, not China
18920 </p>
18921 !! end
18922
18923
18924 !! test
18925 Conversion around HTML tags
18926 !! options
18927 language=sr variant=sr-ec
18928 !! wikitext
18929 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
18930 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
18931 !! html
18932 <p>
18933 <span title="ЛаCтин">ски</span>
18934 </p>
18935 !! end
18936
18937
18938 !! test
18939 Explicit session-wise language variant mapping (A flag and - flag)
18940 !! options
18941 language=zh variant=zh-tw
18942 !! wikitext
18943 Taiwan is not China.
18944 But -{A|zh:China;zh-tw:Taiwan}- is China,
18945 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
18946 and -{China}- is China.
18947 !! html
18948 <p>Taiwan is not China.
18949 But Taiwan is Taiwan,
18950 (This should be stripped!)
18951 and China is China.
18952 </p>
18953 !! end
18954
18955 !! test
18956 Explicit session-wise language variant mapping (H flag for hide)
18957 !! options
18958 language=zh variant=zh-tw
18959 !! wikitext
18960 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
18961 Taiwan is China.
18962 !! html
18963 <p>(This should be stripped!)
18964 Taiwan is Taiwan.
18965 </p>
18966 !! end
18967
18968 !! test
18969 Adding explicit conversion rule for title (T flag)
18970 !! options
18971 language=zh variant=zh-tw showtitle
18972 !! wikitext
18973 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
18974 !! html
18975 Taiwan
18976 <p>Should be stripped!
18977 </p>
18978 !! end
18979
18980 !! test
18981 Testing that changing the language variant here in the tests actually works
18982 !! options
18983 language=zh variant=zh showtitle
18984 !! wikitext
18985 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
18986 !! html
18987 China
18988 <p>Should be stripped!
18989 </p>
18990 !! end
18991
18992 !! test
18993 Recursive conversion of alt and title attrs shouldn't clear converter state
18994 !! options
18995 language=zh variant=zh-cn showtitle
18996 !! wikitext
18997 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
18998 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
18999 !! html
19000 China
19001 <p>
19002 Should be stripped<span title="Exclamation">!</span>
19003 </p>
19004 !! end
19005
19006 !! test
19007 Bug 24072: more test on conversion rule for title
19008 !! options
19009 language=zh variant=zh-tw showtitle
19010 !! wikitext
19011 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19012 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
19013 !! html
19014 Taiwan
19015 <p>This should be stripped!
19016 This won't take interferes with the title rule.
19017 </p>
19018 !! end
19019
19020 !! test
19021 Partly disable title conversion if variant == main language code
19022 !! options
19023 language=zh variant=zh title=[[ZH]] showtitle
19024 !! wikitext
19025 -{T|zh-cn:CN;zh-tw:TW}-
19026 !! html
19027 ZH
19028 <p>
19029 </p>
19030 !! end
19031
19032 !! test
19033 Partly disable title conversion if variant == main language code, more
19034 !! options
19035 language=zh variant=zh title=[[ZH]] showtitle
19036 !! wikitext
19037 -{T|TW}-
19038 !! html
19039 ZH
19040 <p>
19041 </p>
19042 !! end
19043
19044 !! test
19045 Raw output of variant escape tags (R flag)
19046 !! options
19047 language=zh variant=zh-tw
19048 !! wikitext
19049 Raw: -{R|zh:China;zh-tw:Taiwan}-
19050 !! html
19051 <p>Raw: zh:China;zh-tw:Taiwan
19052 </p>
19053 !! end
19054
19055 !! test
19056 Strings evaluating false shouldn't be ignored by Language converter (T51072)
19057 !! options
19058 language=zh variant=zh-cn
19059 !! input
19060 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
19061 !! result
19062 <p>0
19063 </p>
19064 !! end
19065
19066 !! test
19067 Conversion rules from [numeric-only string] to [something else] (T48634)
19068 !! options
19069 language=zh variant=zh-cn
19070 !! input
19071 -{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
19072 !! result
19073 <p>D12345EE12345
19074 </p>
19075 !! end
19076
19077 !! test
19078 Bidirectional converter rule entries with an empty value should be ignored (T53551)
19079 !! options
19080 language=zh variant=zh-cn
19081 !! input
19082 -{H|zh-cn:foo;zh-tw:;}-foobar
19083 !! result
19084 <p>foobar
19085 </p>
19086 !! end
19087
19088 !! test
19089 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
19090 !! options
19091 language=zh variant=zh-cn
19092 !! input
19093 -{H|=>zh-cn:foo;}-foobar
19094 !! result
19095 <p>foobar
19096 </p>
19097 !! end
19098
19099 !! test
19100 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
19101 !! options
19102 language=zh variant=zh-cn
19103 !! input
19104 -{H|}-foobar
19105 !! result
19106 <p>foobar
19107 </p>
19108 !! end
19109
19110 !! test
19111 Nested using of manual convert syntax
19112 !! options
19113 language=zh variant=zh-hk
19114 !! wikitext
19115 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
19116 !! html
19117 <p>Nested: Hello Hong Kong!
19118 </p>
19119 !! end
19120
19121 !! test
19122 Proper conversion of text in external links
19123 !! options
19124 language=sr variant=sr-ec
19125 !! wikitext
19126 http://www.google.com
19127 gopher://www.google.com
19128 [http://www.google.com http://www.google.com]
19129 [gopher://www.google.com gopher://www.google.com]
19130 [https://www.google.com irc://www.google.com]
19131 [ftp://www.google.com www.google.com/ftp://dir]
19132 [//www.google.com www.google.com]
19133 !! html
19134 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19135 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19136 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19137 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19138 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
19139 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
19140 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
19141 </p>
19142 !! end
19143
19144 !! test
19145 Do not convert roman numbers to language variants
19146 !! options
19147 language=sr variant=sr-ec
19148 !! wikitext
19149 Fridrih IV je car.
19150 !! html
19151 <p>Фридрих IV је цар.
19152 </p>
19153 !! end
19154
19155 !! test
19156 Unclosed language converter markup "-{"
19157 !! options
19158 language=sr
19159 !! wikitext
19160 -{T|hello
19161 !! html
19162 <p>-{T|hello
19163 </p>
19164 !! end
19165
19166 !! test
19167 Don't convert raw rule "-{R|=&gt;}-" to "=>"
19168 !! options
19169 language=sr
19170 !! wikitext
19171 -{R|=&gt;}-
19172 !! html
19173 <p>=&gt;
19174 </p>
19175 !!end
19176
19177 !! test
19178 Don't break link parsing if language converter markup is in the caption.
19179 !! options
19180 language=sr variant=sr-ec
19181 !! wikitext
19182 [[Main Page|-{R|main page}-]]
19183 !! html
19184 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
19185 </p>
19186 !! end
19187
19188 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19189 !! test
19190 Don't break image parsing if language converter markup is in the caption.
19191 !! options
19192 language=sr
19193 !! wikitext
19194 [[File:Foobar.jpg|-{R|caption}-]]
19195 !! html/parsoid
19196 <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>
19197 </p>
19198 !! end
19199
19200 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19201 !! test
19202 Don't break list handling if language converter markup is in the item.
19203 !! options
19204 language=zh variant=zh-cn
19205 !! wikitext
19206 ;-{zh-cn:AAA;zh-tw:BBB}-
19207 !! html/php
19208 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
19209
19210 !! html/parsoid
19211 <dl><dt>AAA
19212 </dt></dl>
19213 !! end
19214
19215 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19216 !! test
19217 Don't break table handling if language converter markup is in the cell.
19218 !! options
19219 language=sr variant=sr-ec
19220 !! wikitext
19221 {|
19222 |-
19223 | -{R|B}-
19224 |}
19225 !! html/php
19226 <table>
19227
19228 <tr>
19229 <td>Б}-
19230 </td></tr></table>
19231
19232 !! html/parsoid
19233 <table>
19234
19235 <tr>
19236 <td> B
19237 </td></tr></table>
19238
19239 !! end
19240
19241 !! test
19242 Bug 529: Uncovered bullet
19243 !! wikitext
19244 * Foo {{bullet}}
19245 !! html
19246 <ul><li> Foo </li>
19247 <li> Bar</li></ul>
19248
19249 !! end
19250
19251 # Plain MediaWiki does not remove empty lists, but tidy actually does.
19252 # Templates in Wikipedia rely on this behavior, as tidy has always been
19253 # enabled there. These tests are normally run *without* tidy, so specify the
19254 # full output here.
19255 # To test realistic parsing behavior, apply a tidy-like transformation to both
19256 # the expected output and your parser's output.
19257 !! test
19258 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
19259 !! wikitext
19260 ******* Foo {{bullet}}
19261 !! html
19262 <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>
19263 <li> Bar</li></ul>
19264
19265 !! end
19266
19267 !! test
19268 Bug 529: Uncovered table already at line-start
19269 !! wikitext
19270 x
19271
19272 {{table}}
19273 y
19274 !! html
19275 <p>x
19276 </p>
19277 <table>
19278 <tr>
19279 <td> 1 </td>
19280 <td> 2
19281 </td></tr>
19282 <tr>
19283 <td> 3 </td>
19284 <td> 4
19285 </td></tr></table>
19286 <p>y
19287 </p>
19288 !! end
19289
19290 !! test
19291 Bug 529: Uncovered bullet in parser function result
19292 !! wikitext
19293 * Foo {{lc:{{bullet}} }}
19294 !! html
19295 <ul><li> Foo </li>
19296 <li> bar</li></ul>
19297
19298 !! end
19299
19300 !! test
19301 Bug 5678: Double-parsed template argument
19302 !! wikitext
19303 {{lc:{{{1}}}|hello}}
19304 !! html
19305 <p>{{{1}}}
19306 </p>
19307 !! end
19308
19309 !! test
19310 Bug 5678: Double-parsed template invocation
19311 !! wikitext
19312 {{lc:{{paramtest {{!}} param = hello }} }}
19313 !! html
19314 <p>{{paramtest | param = hello }}
19315 </p>
19316 !! end
19317
19318 !! test
19319 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
19320 !! options
19321 language=cs
19322 title=[[Main Page]]
19323 !! wikitext
19324 {{PRVNÍVELKÉ:ěščř}}
19325 {{prvnívelké:ěščř}}
19326 {{PRVNÍMALÉ:ěščř}}
19327 {{prvnímalé:ěščř}}
19328 {{MALÁ:ěščř}}
19329 {{malá:ěščř}}
19330 {{VELKÁ:ěščř}}
19331 {{velká:ěščř}}
19332 !! html
19333 <p>Ěščř
19334 Ěščř
19335 ěščř
19336 ěščř
19337 ěščř
19338 ěščř
19339 ĚŠČŘ
19340 ĚŠČŘ
19341 </p>
19342 !! end
19343
19344 !! test
19345 Morwen/13: Unclosed link followed by heading
19346 !! wikitext
19347 [[link
19348 ==heading==
19349 !! html
19350 <p>[[link
19351 </p>
19352 <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>
19353
19354 !! end
19355
19356 !! test
19357 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
19358 !! wikitext
19359 {{foo|
19360 =heading=
19361 !! html
19362 <p>{{foo|
19363 </p>
19364 <h1><span class="mw-headline" id="heading">heading</span></h1>
19365
19366 !! end
19367
19368 !! test
19369 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
19370 !! wikitext
19371 {{foo|
19372 ==heading==
19373 !! html
19374 <p>{{foo|
19375 </p>
19376 <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>
19377
19378 !! end
19379
19380 !! test
19381 Tildes in comments
19382 !! options
19383 pst
19384 !! wikitext
19385 <!-- ~~~~ -->
19386 !! html
19387 <!-- ~~~~ -->
19388 !! end
19389
19390 !! test
19391 Paragraphs inside divs (no extra line breaks)
19392 !! wikitext
19393 <div>Line one
19394
19395 Line two</div>
19396 !! html
19397 <div>Line one
19398 Line two</div>
19399
19400 !! end
19401
19402 !! test
19403 Paragraphs inside divs (extra line break on open)
19404 !! wikitext
19405 <div>
19406 Line one
19407
19408 Line two</div>
19409 !! html
19410 <div>
19411 <p>Line one
19412 </p>
19413 Line two</div>
19414
19415 !! end
19416
19417 !! test
19418 Paragraphs inside divs (extra line break on close)
19419 !! wikitext
19420 <div>Line one
19421
19422 Line two
19423 </div>
19424 !! html
19425 <div>Line one
19426 <p>Line two
19427 </p>
19428 </div>
19429
19430 !! end
19431
19432 !! test
19433 Paragraphs inside divs (extra line break on open and close)
19434 !! wikitext
19435 <div>
19436 Line one
19437
19438 Line two
19439 </div>
19440 !! html
19441 <div>
19442 <p>Line one
19443 </p><p>Line two
19444 </p>
19445 </div>
19446
19447 !! end
19448
19449 !! test
19450 Nesting tags, paragraphs on lines which begin with <div>
19451 !! wikitext
19452 <div></div><strong>A
19453 B</strong>
19454 !! html/php+tidy
19455 <p><strong>A</strong></p>
19456 <p><strong>B</strong></p>
19457 !! html/parsoid
19458 <div></div>
19459 <p><strong>A
19460 B</strong>
19461 </p>
19462 !! end
19463
19464 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
19465 !! test
19466 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
19467 !! wikitext
19468 <blockquote>Line one
19469
19470 Line two</blockquote>
19471 !! html
19472 <blockquote>Line one
19473 Line two</blockquote>
19474
19475 !! html+tidy
19476 <blockquote>
19477 <p>Line one Line two</p>
19478 </blockquote>
19479 !! end
19480
19481 !! test
19482 Bug 6200: paragraphs inside blockquotes (extra line break on open)
19483 !! wikitext
19484 <blockquote>
19485 Line one
19486
19487 Line two</blockquote>
19488 !! html
19489 <blockquote>
19490 <p>Line one
19491 </p>
19492 Line two</blockquote>
19493
19494 !! html+tidy
19495 <blockquote>
19496 <p>Line one</p>
19497 Line two</blockquote>
19498 !! end
19499
19500 !! test
19501 Bug 6200: paragraphs inside blockquotes (extra line break on close)
19502 !! wikitext
19503 <blockquote>Line one
19504
19505 Line two
19506 </blockquote>
19507 !! html
19508 <blockquote>Line one
19509 <p>Line two
19510 </p>
19511 </blockquote>
19512
19513 !! html+tidy
19514 <blockquote>
19515 <p>Line one</p>
19516 <p>Line two</p>
19517 </blockquote>
19518 !! end
19519
19520 !! test
19521 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
19522 !! wikitext
19523 <blockquote>
19524 Line one
19525
19526 Line two
19527 </blockquote>
19528 !! html
19529 <blockquote>
19530 <p>Line one
19531 </p><p>Line two
19532 </p>
19533 </blockquote>
19534
19535 !! html+tidy
19536 <blockquote>
19537 <p>Line one</p>
19538 <p>Line two</p>
19539 </blockquote>
19540 !! end
19541
19542 !! test
19543 Paragraphs inside blockquotes/divs (no extra line breaks)
19544 !! wikitext
19545 <blockquote><div>Line one
19546
19547 Line two</div></blockquote>
19548 !! html
19549 <blockquote><div>Line one
19550 Line two</div></blockquote>
19551
19552 !! end
19553
19554 !! test
19555 Paragraphs inside blockquotes/divs (extra line break on open)
19556 !! wikitext
19557 <blockquote><div>
19558 Line one
19559
19560 Line two</div></blockquote>
19561 !! html
19562 <blockquote><div>
19563 <p>Line one
19564 </p>
19565 Line two</div></blockquote>
19566
19567 !! end
19568
19569 !! test
19570 Paragraphs inside blockquotes/divs (extra line break on close)
19571 !! wikitext
19572 <blockquote><div>Line one
19573
19574 Line two
19575 </div></blockquote>
19576 !! html
19577 <blockquote><div>Line one
19578 <p>Line two
19579 </p>
19580 </div></blockquote>
19581
19582 !! end
19583
19584 !! test
19585 Paragraphs inside blockquotes/divs (extra line break on open and close)
19586 !! wikitext
19587 <blockquote><div>
19588 Line one
19589
19590 Line two
19591 </div></blockquote>
19592 !! html
19593 <blockquote><div>
19594 <p>Line one
19595 </p><p>Line two
19596 </p>
19597 </div></blockquote>
19598
19599 !! end
19600
19601 !! test
19602 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
19603 !! options
19604 wgLinkHolderBatchSize=0
19605 !! wikitext
19606 [[meatball:1]]
19607 [[meatball:2]]
19608 [[meatball:3]]
19609 !! html
19610 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
19611 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
19612 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
19613 </p>
19614 !! end
19615
19616 !! test
19617 Free external link invading image caption
19618 !! wikitext
19619 [[Image:Foobar.jpg|thumb|http://x|hello]]
19620 !! html
19621 <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>
19622
19623 !! end
19624
19625 !! test
19626 Bug 15196: localised external link numbers
19627 !! options
19628 language=fa
19629 !! wikitext
19630 [http://en.wikipedia.org/]
19631 !! html/php
19632 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
19633 </p>
19634 !! html/parsoid
19635 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
19636 !! end
19637
19638 !! test
19639 Multibyte character in padleft
19640 !! wikitext
19641 {{padleft:-Hello|7|Æ}}
19642 !! html
19643 <p>Æ-Hello
19644 </p>
19645 !! end
19646
19647 !! test
19648 Multibyte character in padright
19649 !! wikitext
19650 {{padright:Hello-|7|Æ}}
19651 !! html
19652 <p>Hello-Æ
19653 </p>
19654 !! end
19655
19656 !!test
19657 formatdate parser function
19658 !! wikitext
19659 {{#formatdate:2009-03-24}}
19660 !! html
19661 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
19662 </p>
19663 !! end
19664
19665 !!test
19666 formatdate parser function, with default format
19667 !! wikitext
19668 {{#formatdate:2009-03-24|mdy}}
19669 !! html
19670 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
19671 </p>
19672 !! end
19673
19674 !! test
19675 Spacing of numbers in formatted dates
19676 !! wikitext
19677 {{#formatdate:January 15}}
19678 !! html
19679 <p><span class="mw-formatted-date" title="01-15">January 15</span>
19680 </p>
19681 !! end
19682
19683 !! test
19684 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
19685 !! options
19686 language=nl title=[[MediaWiki:Common.css]]
19687 !! wikitext
19688 {{#formatdate:2009-03-24|dmy}}
19689 !! html
19690 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
19691 </p>
19692 !! end
19693
19694 #
19695 #
19696 #
19697
19698 #
19699 # Edit comments
19700 #
19701
19702 !! test
19703 Edit comment with link
19704 !! options
19705 comment
19706 !! wikitext
19707 I like the [[Main Page]] a lot
19708 !! html
19709 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
19710 !!end
19711
19712 !! test
19713 Edit comment with link and link text
19714 !! options
19715 comment
19716 !! wikitext
19717 I like the [[Main Page|best pages]] a lot
19718 !! html
19719 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
19720 !!end
19721
19722 !! test
19723 Edit comment with link and link text with suffix
19724 !! options
19725 comment
19726 !! wikitext
19727 I like the [[Main Page|best page]]s a lot
19728 !! html
19729 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
19730 !!end
19731
19732 !! test
19733 Edit comment with section link (non-local, eg in history list)
19734 !! options
19735 comment title=[[Main Page]]
19736 !! wikitext
19737 /* External links */ removed bogus entries
19738 !! html
19739 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
19740 !!end
19741
19742 !! test
19743 Edit comment with section link and text before it (non-local, eg in history list)
19744 !! options
19745 comment title=[[Main Page]]
19746 !! wikitext
19747 pre-comment text /* External links */ removed bogus entries
19748 !! html
19749 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>
19750 !!end
19751
19752 !! test
19753 Edit comment with section link (local, eg in diff view)
19754 !! options
19755 comment local title=[[Main Page]]
19756 !! wikitext
19757 /* External links */ removed bogus entries
19758 !! html
19759 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
19760 !!end
19761
19762 !! test
19763 Edit comment with subpage link (bug 14080)
19764 !! options
19765 comment
19766 subpage
19767 title=[[Subpage test]]
19768 !! wikitext
19769 Poked at a [[/subpage]] here...
19770 !! html
19771 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
19772 !!end
19773
19774 !! test
19775 Edit comment with subpage link and link text (bug 14080)
19776 !! options
19777 comment
19778 subpage
19779 title=[[Subpage test]]
19780 !! wikitext
19781 Poked at a [[/subpage|neat little page]] here...
19782 !! html
19783 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
19784 !!end
19785
19786 !! test
19787 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
19788 !! options
19789 comment
19790 title=[[Subpage test]]
19791 !! wikitext
19792 Poked at a [[/subpage]] here...
19793 !! html
19794 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...
19795 !!end
19796
19797 !! test
19798 Edit comment with bare anchor link (local, as on diff)
19799 !! options
19800 comment
19801 local
19802 title=[[Main Page]]
19803 !! wikitext
19804 [[#section]]
19805 !! html
19806 <a href="#section">#section</a>
19807 !! end
19808
19809 !! test
19810 Edit comment with bare anchor link (non-local, as on history)
19811 !! options
19812 comment
19813 title=[[Main Page]]
19814 !! wikitext
19815 [[#section]]
19816 !! html
19817 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
19818 !! end
19819
19820 !! test
19821 Anchor starting with underscore
19822 !! wikitext
19823 [[#_ref|One]]
19824 !! html
19825 <p><a href="#_ref">One</a>
19826 </p>
19827 !! end
19828
19829 !! test
19830 Id starting with underscore
19831 !! wikitext
19832 <div id="_ref"></div>
19833 !! html
19834 <div id="_ref"></div>
19835
19836 !! end
19837
19838 !! test
19839 Space normalisation on autocomment (bug 22784)
19840 !! options
19841 comment
19842 title=[[Main Page]]
19843 !! wikitext
19844 /* __hello__world__ */
19845 !! html
19846 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
19847 !! end
19848
19849 !! test
19850 percent-encoding and + signs in comments (Bug 26410)
19851 !! options
19852 comment
19853 !! wikitext
19854 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
19855 !! html/php
19856 <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>
19857 !! end
19858
19859 # Parsoid doesn't support this yet: see bug 73581
19860 # but it *should* omit the 'src' attribute if the image is bad.
19861 # PHP side of tests was disabled in
19862 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
19863 # because of issues in the PHP parserTests infrastructure
19864 # (but the output below is indeed what the PHP side emits)
19865 !! test
19866 Bad images - basic functionality
19867 !! wikitext
19868 [[File:Bad.jpg]]
19869 !! DISABLED/html/php
19870 !! html/parsoid
19871 <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>
19872 !! end
19873
19874 !! test
19875 Bad images - bug 16039: text after bad image disappears
19876 !! wikitext
19877 Foo bar
19878 [[File:Bad.jpg]]
19879 Bar foo
19880 !! DISABLED/html/php
19881 <p>Foo bar
19882 </p><p>Bar foo
19883 </p>
19884 !! html/parsoid
19885 <p>Foo bar
19886 <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>
19887 Bar foo</p>
19888 !! end
19889
19890 !! test
19891 Verify that displaytitle works (bug #22501) no displaytitle
19892 !! options
19893 showtitle
19894 !! config
19895 wgAllowDisplayTitle=true
19896 wgRestrictDisplayTitle=false
19897 !! wikitext
19898 this is not the the title
19899 !! html/php
19900 Parser test
19901 <p>this is not the the title
19902 </p>
19903 !! end
19904
19905 !! test
19906 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
19907 !! options
19908 showtitle
19909 title=[[Screen]]
19910 !! config
19911 wgAllowDisplayTitle=true
19912 wgRestrictDisplayTitle=false
19913 !! wikitext
19914 this is not the the title
19915 {{DISPLAYTITLE:whatever}}
19916 !! html/php
19917 whatever
19918 <p>this is not the the title
19919 </p>
19920 !! end
19921
19922 !! test
19923 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
19924 !! options
19925 showtitle
19926 title=[[Screen]]
19927 !! config
19928 wgAllowDisplayTitle=true
19929 wgRestrictDisplayTitle=true
19930 !! wikitext
19931 this is not the the title
19932 {{DISPLAYTITLE:whatever}}
19933 !! html/php
19934 Screen
19935 <p>this is not the the title
19936 </p>
19937 !! end
19938
19939 !! test
19940 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
19941 !! options
19942 showtitle
19943 title=[[Screen]]
19944 !! config
19945 wgAllowDisplayTitle=true
19946 wgRestrictDisplayTitle=true
19947 !! wikitext
19948 this is not the the title
19949 {{DISPLAYTITLE:screen}}
19950 !! html/php
19951 screen
19952 <p>this is not the the title
19953 </p>
19954 !! end
19955
19956 !! test
19957 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
19958 !! options
19959 showtitle
19960 title=[[Screen]]
19961 !! config
19962 wgAllowDisplayTitle=false
19963 !! wikitext
19964 this is not the the title
19965 {{DISPLAYTITLE:screen}}
19966 !! html/php
19967 Screen
19968 <p>this is not the the title
19969 <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>
19970 </p>
19971 !! end
19972
19973 !! test
19974 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
19975 !! options
19976 showtitle
19977 title=[[Screen]]
19978 !! config
19979 wgAllowDisplayTitle=false
19980 !! wikitext
19981 this is not the the title
19982 !! html/php
19983 Screen
19984 <p>this is not the the title
19985 </p>
19986 !! end
19987
19988 !! test
19989 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
19990 !! options
19991 showtitle
19992 title=[[Screen]]
19993 !! config
19994 wgAllowDisplayTitle=true
19995 wgRestrictDisplayTitle=true
19996 !! wikitext
19997 this is not the the title
19998 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
19999 !! html/php
20000 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
20001 <p>this is not the the title
20002 </p>
20003 !! end
20004
20005 !! test
20006 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
20007 !! options
20008 showtitle
20009 title=[[Screen]]
20010 !! config
20011 wgAllowDisplayTitle=true
20012 wgRestrictDisplayTitle=true
20013 !! wikitext
20014 this is not the the title
20015 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
20016 !! html/php
20017 <span style="color: red;">s</span>creen
20018 <p>this is not the the title
20019 </p>
20020 !! end
20021
20022 !! test
20023 Page status indicators: Empty name is invalid
20024 !! options
20025 showindicators
20026 !! wikitext
20027 <indicator name=" "></indicator>
20028 <indicator></indicator>
20029 !! html
20030 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20031 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20032 </p>
20033 !! end
20034
20035 !! test
20036 Page status indicators: Weird syntaxes that are okay
20037 !! options
20038 showindicators
20039 !! wikitext
20040 <indicator name="empty" />
20041 <indicator name="name"></indicator>
20042 !! html
20043 empty=
20044 name=
20045 <p><br />
20046 </p>
20047 !! end
20048
20049 !! test
20050 Page status indicators: Torture test
20051 !! options
20052 showindicators
20053 !! wikitext
20054 <indicator name="01">hello world</indicator>
20055 <indicator name="02">[[Main Page]]</indicator>
20056 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
20057 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
20058 <indicator name="05">* foo
20059 * bar</indicator>
20060 <indicator name="06"><nowiki>foo</nowiki></indicator>
20061 <indicator name="07"> Preformatted</indicator>
20062 <indicator name="08"><div>Broken tag</indicator>
20063 <indicator name="09">{| class=wikitable
20064 | cell
20065 |}</indicator>
20066 <indicator name="10">Two
20067
20068 paragraphs</indicator>
20069 !! html
20070 01=hello world
20071 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20072 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" />
20073 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>
20074 05=<ul><li> foo</li>
20075 <li> bar</li></ul>
20076
20077 06=foo
20078 07=<pre>Preformatted
20079 </pre>
20080 08=<div>Broken tag</div>
20081
20082 09=<table class="wikitable">
20083 <tr>
20084 <td> cell
20085 </td></tr></table>
20086
20087 10=<p>Two
20088 </p><p>paragraphs
20089 </p>
20090 <p><br />
20091 </p><p><br />
20092 </p><p><br />
20093 </p><p><br />
20094 </p><p><br />
20095 </p>
20096 !! end
20097
20098 !! test
20099 preload: check <noinclude> and <includeonly>
20100 !! options
20101 preload
20102 !! wikitext
20103 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
20104 !! html/php
20105 Hello kind world.
20106 !! end
20107
20108 !! test
20109 preload: check <onlyinclude>
20110 !! options
20111 preload
20112 !! wikitext
20113 Goodbye <onlyinclude>Hello world</onlyinclude>
20114 !! html/php
20115 Hello world
20116 !! end
20117
20118 !! test
20119 preload: can pass tags through if we want to
20120 !! options
20121 preload
20122 !! wikitext
20123 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
20124 !! html/php
20125 <includeonly>Hello world</includeonly>
20126 !! end
20127
20128 !! test
20129 preload: check that it doesn't try to do tricks
20130 !! options
20131 preload
20132 !! wikitext
20133 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20134 !! html/php
20135 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20136 !! end
20137
20138 !! test
20139 Play a bit with r67090 and bug 3158
20140 !! wikitext
20141 <div style="width:50% !important">&nbsp;</div>
20142 <div style="width:50%&nbsp;!important">&nbsp;</div>
20143 <div style="width:50%&#160;!important">&nbsp;</div>
20144 <div style="border : solid;">&nbsp;</div>
20145 !! html/php
20146 <div style="width:50% !important">&#160;</div>
20147 <div style="width:50% !important">&#160;</div>
20148 <div style="width:50% !important">&#160;</div>
20149 <div style="border&#160;: solid;">&#160;</div>
20150
20151 !! html/parsoid
20152 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20153 <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>
20154 <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>
20155 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20156
20157 !! end
20158
20159 !! test
20160 HTML5 data attributes
20161 !! wikitext
20162 <span data-foo="bar">Baz</span>
20163 <p data-abc-def_hij="">Quuz</p>
20164 !! html
20165 <p><span data-foo="bar">Baz</span>
20166 </p>
20167 <p data-abc-def_hij="">Quuz</p>
20168
20169 !! end
20170
20171 !! test
20172 percent-encoding and + signs in internal links (Bug 26410)
20173 !! wikitext
20174 [[User:+%]] [[Page+title%]]
20175 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
20176 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
20177 [[%33%45]] [[%33%45+]]
20178 !! html/php
20179 <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>
20180 <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>
20181 <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>
20182 <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>
20183 </p>
20184 !! html/parsoid
20185 <p><a rel="mw:WikiLink" href="./User:+%25" title="User:+%">User:+%</a> <a rel="mw:WikiLink" href="Page+title%25" title="Page+title%">Page+title%</a>
20186 <a rel="mw:WikiLink" href="%25+" title="%+">%+</a> <a rel="mw:WikiLink" href="%25+" title="%+">%20</a> <a rel="mw:WikiLink" href="%25+" title="%+">%+ </a> <a rel="mw:WikiLink" href="%25+r" title="%+r">%+r</a>
20187 <a rel="mw:WikiLink" href="%25" title="%">%</a> <a rel="mw:WikiLink" href="+" title="+">+</a> <span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"bogus","ak":"foo"},{"ck":"caption","ak":"[[bar]]"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;a rel=\"mw:WikiLink\" href=\"./Bar\" title=\"Bar\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;simple&amp;quot;,&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;./Bar&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;bar&amp;quot;},&amp;quot;dsr&amp;quot;:[94,101,2,2]}\">bar&lt;/a>"}'><a href="./File:%25+abc9"><img resource="./File:%25+abc9" src="./Special:FilePath/%25+abc9" height="220" width="220" data-parsoid='{"a":{"resource":"./File:%25+abc9","height":"220","width":"220"},"sa":{"resource":"File:%+abc%39"}}'/></a></span>
20188 <a rel="mw:WikiLink" href="./3E" title="3E" data-parsoid='{"stx":"simple","a":{"href":"./3E"},"sa":{"href":"%33%45"}}'>3E</a> <a rel="mw:WikiLink" href="./3E+" title="3E+" data-parsoid='{"stx":"simple","a":{"href":"./3E+"},"sa":{"href":"%33%45+"}}'>3E+</a></p>
20189 !! end
20190
20191 !! test
20192 Special characters in embedded file links (bug 27679)
20193 !! wikitext
20194 [[File:Contains & ampersand.jpg]]
20195 [[File:Does not exist.jpg|Title with & ampersand]]
20196 !! html/php
20197 <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>
20198 <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>
20199 </p>
20200 !! html/parsoid
20201 <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>
20202 <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;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>
20203 !! end
20204
20205 !! test
20206 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
20207 !! wikitext
20208 Text&apos;s been normalized?
20209 !! html
20210 <p>Text&#39;s been normalized?
20211 </p>
20212 !! end
20213
20214 !! test
20215 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
20216 !! wikitext
20217 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
20218 !! html
20219 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
20220 </p>
20221 !! end
20222
20223 !! test
20224 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
20225 !! wikitext
20226 [http://www.example.org/ ideograms]
20227 !! html
20228 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
20229 </p>
20230 !! end
20231
20232 !! test
20233 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
20234 !! wikitext
20235 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
20236 !! html
20237 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
20238 </p>
20239 !! end
20240
20241 !! article
20242 Mediawiki:loop1
20243 !! text
20244 {{Identical|A}}
20245 !! endarticle
20246
20247 !! article
20248 Mediawiki:loop2
20249 !! text
20250 {{Identical|B}}
20251 !! endarticle
20252
20253 !! article
20254 Template:Identical
20255 !! text
20256 {{int:loop1}}
20257 {{int:loop2}}
20258 !! endarticle
20259
20260 !! test
20261 Bug 31098 Template which includes system messages which includes the template
20262 !! wikitext
20263 {{Identical}}
20264 !! html
20265 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20266 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20267 </p>
20268 !! end
20269
20270 !! test
20271 Bug31490 Turkish: ucfirst 'blah'
20272 !! options
20273 language=tr
20274 !! wikitext
20275 {{ucfirst:blah}}
20276 !! html
20277 <p>Blah
20278 </p>
20279 !! end
20280
20281 !! test
20282 Bug31490 Turkish: ucfirst 'ix'
20283 !! options
20284 language=tr
20285 !! wikitext
20286 {{ucfirst:ix}}
20287 !! html
20288 <p>İx
20289 </p>
20290 !! end
20291
20292 !! test
20293 Bug31490 Turkish: lcfirst 'BLAH'
20294 !! options
20295 language=tr
20296 !! wikitext
20297 {{lcfirst:BLAH}}
20298 !! html
20299 <p>bLAH
20300 </p>
20301 !! end
20302
20303 !! test
20304 Bug31490 Turkish: ucfırst (with a dotless i)
20305 !! options
20306 language=tr
20307 !! wikitext
20308 {{ucfırst:blah}}
20309 !! html
20310 <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>
20311 </p>
20312 !! end
20313
20314 !! test
20315 Bug31490 ucfırst (with a dotless i) with English language
20316 !! options
20317 language=en
20318 !! wikitext
20319 {{ucfırst:blah}}
20320 !! html
20321 <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>
20322 </p>
20323 !! end
20324
20325 !! test
20326 Bug 26375: TOC with italics
20327 !! options
20328 title=[[Main Page]]
20329 !! wikitext
20330 __TOC__
20331 == ''Lost'' episodes ==
20332 !! html
20333 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20334 <ul>
20335 <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>
20336 </ul>
20337 </div>
20338
20339 <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>
20340
20341 !! end
20342
20343 !! test
20344 Bug 26375: TOC with bold
20345 !! options
20346 title=[[Main Page]]
20347 !! wikitext
20348 __TOC__
20349 == '''should be bold''' then normal text ==
20350 !! html
20351 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20352 <ul>
20353 <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>
20354 </ul>
20355 </div>
20356
20357 <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>
20358
20359 !! end
20360
20361 !! test
20362 Bug 33845: Headings become cursive in TOC when they contain an image
20363 !! options
20364 title=[[Main Page]]
20365 !! wikitext
20366 __TOC__
20367 == Image [[Image:foobar.jpg]] ==
20368 !! html
20369 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20370 <ul>
20371 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
20372 </ul>
20373 </div>
20374
20375 <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>
20376
20377 !! end
20378
20379 !! test
20380 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
20381 !! options
20382 title=[[Main Page]]
20383 !! wikitext
20384 __TOC__
20385 == <blockquote>Quote</blockquote> ==
20386 !! html
20387 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20388 <ul>
20389 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20390 </ul>
20391 </div>
20392
20393 <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>
20394
20395 !! html+tidy
20396 <p></p>
20397 <div id="toc" class="toc">
20398 <div id="toctitle">
20399 <h2>Contents</h2>
20400 </div>
20401 <ul>
20402 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20403 </ul>
20404 </div>
20405 <p></p>
20406 <h2><span class="mw-headline" id="Quote"></span></h2>
20407 <blockquote>
20408 <p><span class="mw-headline" id="Quote">Quote</span></p>
20409 </blockquote>
20410 <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>
20411 !! end
20412
20413 !! test
20414 Unclosed tags in TOC
20415 !! options
20416 title=[[Main Page]]
20417 !! wikitext
20418 __TOC__
20419 == Proof: 2 < 3 ==
20420 <small>Hanc marginis exiguitas non caperet.</small>
20421 QED
20422 !! html
20423 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20424 <ul>
20425 <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>
20426 </ul>
20427 </div>
20428
20429 <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>
20430 <p><small>Hanc marginis exiguitas non caperet.</small>
20431 QED
20432 </p>
20433 !! end
20434
20435 !! test
20436 Multiple tags in TOC
20437 !! wikitext
20438 __TOC__
20439 == <i>Foo</i> <b>Bar</b> ==
20440
20441 == <i>Foo</i> <blockquote>Bar</blockquote> ==
20442 !! html
20443 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20444 <ul>
20445 <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>
20446 <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>
20447 </ul>
20448 </div>
20449
20450 <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>
20451 <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>
20452
20453 !! html+tidy
20454 <p></p>
20455 <div id="toc" class="toc">
20456 <div id="toctitle">
20457 <h2>Contents</h2>
20458 </div>
20459 <ul>
20460 <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>
20461 <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>
20462 </ul>
20463 </div>
20464 <p></p>
20465 <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>
20466 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
20467 <blockquote>
20468 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
20469 </blockquote>
20470 <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>
20471 !! end
20472
20473 !! test
20474 Tags with parameters in TOC
20475 !! wikitext
20476 __TOC__
20477 == <sup class="in-h2">Hello</sup> ==
20478
20479 == <sup class="a > b">Evilbye</sup> ==
20480 !! html
20481 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20482 <ul>
20483 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
20484 <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>
20485 </ul>
20486 </div>
20487
20488 <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>
20489 <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>
20490
20491 !! end
20492
20493 !! test
20494 span tags with directionality in TOC
20495 !! wikitext
20496 __TOC__
20497 == <span dir="ltr">C++</span> ==
20498
20499 == <span dir="rtl">זבנג!</span> ==
20500
20501 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
20502
20503 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
20504
20505 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
20506 !! html
20507 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20508 <ul>
20509 <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>
20510 <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>
20511 <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>
20512 <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>
20513 <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>
20514 </ul>
20515 </div>
20516
20517 <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>
20518 <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>
20519 <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>
20520 <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>
20521 <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>
20522
20523 !! end
20524
20525 !! test
20526 Bug 72884: bdi element in ToC
20527 !! wikitext
20528 __TOC__
20529 == <bdi>test</bdi> ==
20530 !! html
20531 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20532 <ul>
20533 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
20534 </ul>
20535 </div>
20536
20537 <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>
20538
20539 !! end
20540
20541 # Note that the html output does not have the <p></p>, but the
20542 # html+tidy output *does*. This is because the empty <p></p> is
20543 # removed by the sanitizer, but only when tidy is *not* enabled (!).
20544 !! test
20545 Empty <p> tag in TOC, removed by Sanitizer (T92892)
20546 !! wikitext
20547 __TOC__
20548 == x ==
20549 !! html
20550 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20551 <ul>
20552 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
20553 </ul>
20554 </div>
20555
20556 <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>
20557
20558 !! html+tidy
20559 <p></p>
20560 <div id="toc" class="toc">
20561 <div id="toctitle">
20562 <h2>Contents</h2>
20563 </div>
20564 <ul>
20565 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
20566 </ul>
20567 </div>
20568 <p></p>
20569 <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>
20570 !! end
20571
20572 !! article
20573 MediaWiki:Bug32057
20574 !! text
20575 == {{int:headline_sample}} ==
20576 !! endarticle
20577
20578 !! test
20579 Bug 32057: Title needed when expanding <h> nodes.
20580 !! options
20581 title=[[Main Page]]
20582 !! wikitext
20583 {{int:Bug32057}}
20584 !! html
20585 <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>
20586
20587 !! end
20588
20589 !! test
20590 Strip marker in urlencode
20591 !! wikitext
20592 {{urlencode:x<nowiki/>y}}
20593 {{urlencode:x<nowiki/>y|wiki}}
20594 {{urlencode:x<nowiki/>y|path}}
20595 {{urlencode:x<pre id="one">two</pre>y}}
20596 !! html
20597 <p>xy
20598 xy
20599 xy
20600 xy
20601 </p>
20602 !! end
20603
20604 !! test
20605 Strip marker in lc
20606 !! wikitext
20607 {{lc:x<nowiki/>y}}
20608 !! html
20609 <p>xy
20610 </p>
20611 !! end
20612
20613 !! test
20614 Strip marker in uc
20615 !! wikitext
20616 {{uc:x<nowiki/>y}}
20617 !! html
20618 <p>XY
20619 </p>
20620 !! end
20621
20622 !! test
20623 Strip marker in formatNum
20624 !! wikitext
20625 {{formatnum:1<nowiki/>2}}
20626 {{formatnum:1<nowiki/>2|R}}
20627 !! html
20628 <p>12
20629 12
20630 </p>
20631 !! end
20632
20633 !! test
20634 Check noCommafy in formatNum
20635 !! options
20636 language=be-tarask
20637 !! wikitext
20638 {{formatnum:123456.78}}
20639 {{formatnum:123456.78|NOSEP}}
20640 !! html
20641 <p>123 456,78
20642 123456.78
20643 </p>
20644 !! end
20645
20646 !! test
20647 Wrong option for formatNum (bug 56199)
20648 !! wikitext
20649 {{formatnum:1,234.56|Random}}
20650 {{formatnum:1,234.56|EVERYTHING}}
20651 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
20652 !! html
20653 <p>1,234.56
20654 1,234.56
20655 1,234.56
20656 </p>
20657 !! end
20658
20659 !! test
20660 Strip marker in grammar
20661 !! options
20662 language=fi
20663 !! wikitext
20664 {{grammar:elative|foo<nowiki/>bar}}
20665 !! html
20666 <p>foobarista
20667 </p>
20668 !! end
20669
20670 !! test
20671 Strip marker in padleft
20672 !! wikitext
20673 {{padleft:|2|x<nowiki/>y}}
20674 !! html
20675 <p>xy
20676 </p>
20677 !! end
20678
20679 !! test
20680 Strip marker in padright
20681 !! wikitext
20682 {{padright:|2|x<nowiki/>y}}
20683 !! html
20684 <p>xy
20685 </p>
20686 !! end
20687
20688 !! test
20689 Strip marker in anchorencode
20690 !! wikitext
20691 {{anchorencode:x<nowiki/>y}}
20692 !! html
20693 <p>xy
20694 </p>
20695 !! end
20696
20697 !! test
20698 nowiki inside link inside heading (bug 18295)
20699 !! wikitext
20700 ==[[foo|x<nowiki>y</nowiki>z]]==
20701 !! html
20702 <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>
20703
20704 !! end
20705
20706 !! test
20707 new support for bdi element (bug 31817)
20708 !! wikitext
20709 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
20710 !! html
20711 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
20712
20713 !!end
20714
20715 !! test
20716 Ignore pipe between table row attributes
20717 !! wikitext
20718 {|
20719 | quux
20720 |- id=foo | style='color: red'
20721 | bar
20722 |}
20723 !! html
20724 <table>
20725 <tr>
20726 <td> quux
20727 </td></tr>
20728 <tr id="foo" style="color: red">
20729 <td> bar
20730 </td></tr></table>
20731
20732 !! end
20733
20734 !!test
20735 Gallery override link with WikiLink (bug 34852)
20736 !! wikitext
20737 <gallery>
20738 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
20739 </gallery>
20740 !! html
20741 <ul class="gallery mw-gallery-traditional">
20742 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20743 <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>
20744 <div class="gallerytext">
20745 <p>caption
20746 </p>
20747 </div>
20748 </div></li>
20749 </ul>
20750
20751 !! end
20752
20753 !!test
20754 Gallery override link with absolute external link (bug 34852)
20755 !! wikitext
20756 <gallery>
20757 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
20758 </gallery>
20759 !! html
20760 <ul class="gallery mw-gallery-traditional">
20761 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20762 <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>
20763 <div class="gallerytext">
20764 <p>caption
20765 </p>
20766 </div>
20767 </div></li>
20768 </ul>
20769
20770 !! end
20771
20772 !!test
20773 Gallery override link with malicious javascript (bug 34852)
20774 !! wikitext
20775 <gallery>
20776 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
20777 </gallery>
20778 !! html
20779 <ul class="gallery mw-gallery-traditional">
20780 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20781 <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>
20782 <div class="gallerytext">
20783 <p>caption
20784 </p>
20785 </div>
20786 </div></li>
20787 </ul>
20788
20789 !! end
20790
20791 !!test
20792 Gallery with invalid title as link (bug 43964)
20793 !! wikitext
20794 <gallery>
20795 File:foobar.jpg|link=<
20796 </gallery>
20797 !! html
20798 <ul class="gallery mw-gallery-traditional">
20799 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20800 <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>
20801 <div class="gallerytext">
20802 </div>
20803 </div></li>
20804 </ul>
20805
20806 !! end
20807
20808 !!test
20809 Language parser function
20810 !! wikitext
20811 {{#language:ar}}
20812 !! html
20813 <p>العربية
20814 </p>
20815 !! end
20816
20817 !!test
20818 Padleft and padright as substr
20819 !! wikitext
20820 {{padleft:|3|abcde}}
20821 {{padright:|3|abcde}}
20822 !! html
20823 <p>abc
20824 abc
20825 </p>
20826 !! end
20827
20828 !!test
20829 Special parser function
20830 !! wikitext
20831 {{#special:RandomPage}}
20832 {{#special:BaDtItLe}}
20833 {{#special:Foobar}}
20834 !! html
20835 <p>Special:Random
20836 Special:Badtitle
20837 Special:Foobar
20838 </p>
20839 !! end
20840
20841 !!test
20842 Bug 34939 - Case insensitive link parsing ([HttP://])
20843 !! wikitext
20844 [HttP://MediaWiki.Org/]
20845 !! html/php
20846 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
20847 </p>
20848 !! html/parsoid
20849 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
20850 !! end
20851
20852 !!test
20853 Bug 34939 - Case insensitive link parsing ([HttP:// title])
20854 !! wikitext
20855 [HttP://MediaWiki.Org/ MediaWiki]
20856 !! html
20857 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
20858 </p>
20859 !! end
20860
20861 !!test
20862 Bug 34939 - Case insensitive link parsing (HttP://)
20863 !! wikitext
20864 HttP://MediaWiki.Org/
20865 !! html/php
20866 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
20867 </p>
20868 !! html/parsoid
20869 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
20870 !! end
20871
20872 !!test
20873 Disable TOC
20874 !! options
20875 notoc
20876 !! wikitext
20877 Lead
20878 == Section 1 ==
20879 == Section 2 ==
20880 == Section 3 ==
20881 == Section 4 ==
20882 == Section 5 ==
20883 !! html
20884 <p>Lead
20885 </p>
20886
20887 <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>
20888 <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>
20889 <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>
20890 <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>
20891 <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>
20892
20893 !! end
20894
20895
20896 ###
20897 ### Parsoid-specific tests
20898 ### Parsoid-PHP parser incompatibilities
20899 ###
20900 !!test
20901 1. SOL-sensitive wikitext tokens as template-args
20902 !!options
20903 parsoid=wt2html,wt2wt
20904 !! wikitext
20905 {{echo|*a}}
20906 {{echo|#a}}
20907 {{echo|:a}}
20908 !! html
20909 <span about="#mwt1" typeof="mw:Transclusion">
20910 </span><ul about="#mwt1"><li>a</li>
20911 </ul>
20912 <span about="#mwt2" typeof="mw:Transclusion">
20913 </span><ol about="#mwt2"><li>a</li>
20914 </ol>
20915 <span about="#mwt3" typeof="mw:Transclusion">
20916 </span><dl about="#mwt3"><dd>a</dd>
20917 </dl>
20918 !!end
20919
20920 #### -----------------------------------------------------------------
20921 #### Parsoid-specific functionality tests
20922 #### -----------------------------------------------------------------
20923
20924 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
20925 # We know wt2wt will fail, but we expect selser to pass.
20926 # Due to the nature of our testing, wt2wt and selser tests will enter the
20927 # blacklist and we'll catch selser regressions based on changes to the
20928 # blacklist entries for selser tests.
20929 !! test
20930 1. Bad treebuilder fixup of formatting elt is cleaned up
20931 !! options
20932 parsoid=wt2html,wt2wt
20933 !! wikitext
20934 {|
20935 |
20936 <small>
20937 [[Image:Foobar.jpg|right|Test]]
20938 </small>
20939 |}
20940 !! html/parsoid
20941 <table>
20942 <tbody><tr><td>
20943 <small>
20944 <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>
20945 </small>
20946 </td></tr>
20947 </tbody></table>
20948 !! end
20949
20950 !! test
20951 2. Bad treebuilder fixup of formatting elt is cleaned up
20952 !! options
20953 parsoid=wt2html,wt2wt
20954 !! wikitext
20955 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
20956
20957 <small>[[Image:Foobar.jpg|right|300px]]</small>
20958 !! html/parsoid
20959
20960 <p><b>foo</b></p>
20961 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-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>
20962 <p><b>bar</b></p>
20963 <small><figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a></figure></small>
20964 !! end
20965
20966 !! test
20967 3. Bad treebuilder fixup of formatting elt is cleaned up
20968 !! options
20969 parsoid=wt2html,wt2wt
20970 !! wikitext
20971 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
20972 !! html/parsoid
20973 <p><small><b>foo</b></small></p>
20974 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><small><b>caption</b></small></figcaption></figure>
20975 <p><small><b>bar</b></small></p>
20976 !! end
20977
20978 !! test
20979 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
20980 !! options
20981 parsoid=wt2html,wt2wt
20982 !! wikitext
20983 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
20984 !! html/parsoid
20985 <p><b><small></small></b></p>
20986 <figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a></figure>
20987 <p></p>
20988 !! end
20989
20990 #### ----------------------------------------------------------------
20991 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
20992 #### tags. Parsoid's output for these tags differs from that of the
20993 #### PHP parser.
20994 #### ----------------------------------------------------------------
20995
20996 !!test
20997 Ref: 1. ref-location should be replaced with an index span
20998 !!options
20999 parsoid
21000 !! wikitext
21001 A <ref>foo</ref>
21002 B <ref name="x">foo</ref>
21003 C <ref name="y" />
21004 <references />
21005 !! html
21006 <p>A <span about="#mwt2" class="mw-ref" 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"><span class="mw-reflink-text">[1]</span></a></span>
21007 B <span about="#mwt4" class="mw-ref" 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"><span class="mw-reflink-text">[2]</span></a></span>
21008 C <span about="#mwt6" class="mw-ref" 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"><span class="mw-reflink-text">[3]</span></a></span></p>
21009 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21010 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
21011 <li about="#cite_note-x-2" id="cite_note-x-2"><a href="#cite_ref-x_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-x-2" class="mw-reference-text">foo</span></li>
21012 <li about="#cite_note-y-3" id="cite_note-y-3"><a href="#cite_ref-y_3-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-y-3" class="mw-reference-text"></span></li>
21013 </ol>
21014 !!end
21015
21016 !!test
21017 Ref: 2. ref-tags with identical names should all get the same index
21018 !!options
21019 parsoid
21020 !! wikitext
21021 A <ref name="x">foo</ref>
21022 B <ref name="x" />
21023 <references />
21024 !! html
21025 <p>A <span about="#mwt2" class="mw-ref" 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"><span class="mw-reflink-text">[1]</span></a></span>
21026 B <span about="#mwt4" class="mw-ref" 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"><span class="mw-reflink-text">[1]</span></a></span></p>
21027 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21028 <li about="#cite_note-x-1" id="cite_note-x-1"><span rel="mw:referencedBy"><a href="#cite_ref-x_1-0"><span class="mw-linkback-text">1 </span></a><a href="#cite_ref-x_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-x-1" class="mw-reference-text">foo</span></li>
21029 </ol>
21030 !!end
21031
21032 !!test
21033 Ref: 3. spaces in ref-names should be ignored
21034 !!options
21035 parsoid
21036 !! wikitext
21037 A <ref name="x">foo</ref>
21038 B <ref name=" x " />
21039 C <ref name= x />
21040 <references />
21041 !! html
21042 <p>A <span about="#mwt2" class="mw-ref" 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"><span class="mw-reflink-text">[1]</span></a></span>
21043 B <span about="#mwt4" class="mw-ref" 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"><span class="mw-reflink-text">[1]</span></a></span>
21044 C <span about="#mwt6" class="mw-ref" 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"><span class="mw-reflink-text">[1]</span></a></span></p>
21045 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21046 <li about="#cite_note-x-1" id="cite_note-x-1"><span rel="mw:referencedBy"><a href="#cite_ref-x_1-0"><span class="mw-linkback-text">1 </span></a><a href="#cite_ref-x_1-1"><span class="mw-linkback-text">2 </span></a><a href="#cite_ref-x_1-2"><span class="mw-linkback-text">3 </span></a></span> <span id="mw-reference-text-cite_note-x-1" class="mw-reference-text">foo</span></li>
21047 </ol>
21048 !!end
21049
21050 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
21051 !!test
21052 Ref: 4. 'constructor' should be accepted as a valid ref-name
21053 !!options
21054 parsoid
21055 !! wikitext
21056 A <ref name="constructor">foo</ref>
21057 <references />
21058 !! html
21059 <p>A <span about="#mwt2" class="mw-ref" 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"><span class="mw-reflink-text">[1]</span></a></span></p>
21060 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21061 <li about="#cite_note-constructor-1" id="cite_note-constructor-1"><a href="#cite_ref-constructor_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-constructor-1" class="mw-reference-text">foo</span></li>
21062 </ol>
21063 !!end
21064
21065 !!test
21066 Ref: 5. body should accept generic wikitext
21067 !!options
21068 parsoid
21069 !! wikitext
21070 A <ref>
21071 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
21072 </ref>
21073
21074 <references />
21075 !! html
21076 <p>A <span about="#mwt2" class="mw-ref" 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"><span class="mw-reflink-text">[1]</span></a></span></p>
21077
21078 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21079 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <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>
21080 </span></li>
21081 </ol>
21082 !!end
21083
21084 !!test
21085 Ref: 6. indent-pres should not be output in ref-body
21086 !!options
21087 parsoid
21088 !! wikitext
21089 A <ref>
21090 foo
21091 bar
21092 baz
21093 </ref>
21094
21095 <references />
21096 !! html
21097 <p>A <span about="#mwt2" class="mw-ref" 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"><span class="mw-reflink-text">[1]</span></a></span></p>
21098
21099 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21100 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo
21101 bar
21102 baz
21103 </span></li>
21104 </ol>
21105 !!end
21106
21107 !!test
21108 Ref: 7. No p-wrapping in ref-body
21109 !!options
21110 parsoid
21111 !! wikitext
21112 A <ref>
21113 foo
21114
21115 bar
21116
21117
21118 baz
21119
21120
21121
21122 booz
21123 </ref>
21124
21125 <references />
21126 !! html
21127 <p>A <span about="#mwt2" class="mw-ref" 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"><span class="mw-reflink-text">[1]</span></a></span></p>
21128
21129 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21130 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo
21131
21132 bar
21133
21134
21135 baz
21136
21137
21138
21139 booz
21140 </span></li>
21141 </ol>
21142 !!end
21143
21144 !!test
21145 Ref: 8. transclusion wikitext has lower precedence
21146 !!options
21147 parsoid
21148 !! wikitext
21149 A <ref> foo {{echo|</ref> B C}}
21150
21151 <references />
21152 !! html
21153 <p>A <span about="#mwt2" class="mw-ref" 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"><span class="mw-reflink-text">[1]</span></a></span> B C<span typeof="mw:Nowiki">}}</span></p>
21154 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21155 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <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>
21156 </ol>
21157 !!end
21158
21159 !!test
21160 Ref: 9. unclosed comments should not leak out of ref-body
21161 !!options
21162 parsoid
21163 !! wikitext
21164 A <ref> foo <!--</ref> B C
21165 <references />
21166 !! html
21167 <p>A <span about="#mwt2" class="mw-ref" 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"><span class="mw-reflink-text">[1]</span></a></span> B C</p>
21168 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21169 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo <!----></span></li>
21170 </ol>
21171 !!end
21172
21173 !!test
21174 Ref: 10. Unclosed HTML tags should not leak out of ref-body
21175 !!options
21176 parsoid
21177 !! wikitext
21178 A <ref> <b> foo </ref> B C
21179
21180 <references />
21181 !! html
21182 <p>A <span about="#mwt2" class="mw-ref" 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"><span class="mw-reflink-text">[1]</span></a></span> B C</p>
21183
21184
21185 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21186 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><b data-parsoid='{"stx":"html","autoInsertedEnd":true}'> foo </b></span></li>
21187 </ol>
21188 !!end
21189
21190 !!test
21191 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
21192 !!options
21193 parsoid
21194 !! wikitext
21195 A <ref>foo</ref> B
21196 C <ref>bar</ref> D
21197 <references />
21198 !! html
21199 <p>A <span about="#mwt2" class="mw-ref" 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"><span class="mw-reflink-text">[1]</span></a></span> B
21200 C <span about="#mwt4" class="mw-ref" 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"><span class="mw-reflink-text">[2]</span></a></span> D</p>
21201 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21202 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
21203 <li about="#cite_note-2" id="cite_note-2"><a href="#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
21204 </ol>
21205 !!end
21206
21207 !!test
21208 Ref: 12. ref-tags act as trailing newline migration barrier
21209 !! wikitext
21210 <!--the newline at the end of this line moves out of the p tag-->a
21211
21212 b<!--the newline at the end of this line stays inside the p tag--> <ref />
21213 <ref />
21214
21215 c
21216 <references />
21217 !! html/parsoid
21218 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
21219
21220
21221 <p>b<!--the newline at the end of this line stays inside the p tag--> <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
21222 <span about="#mwt4" class="mw-ref" id="cite_ref-2" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","attrs":{}}'><a href="#cite_note-2"><span class="mw-reflink-text">[2]</span></a></span></p>
21223
21224 <p>c</p>
21225 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21226 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"></span></li>
21227 <li about="#cite_note-2" id="cite_note-2"><a href="#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text"></span></li></ol>
21228 !!end
21229
21230 !!test
21231 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
21232 !!options
21233 parsoid
21234 !! wikitext
21235 <ref>foo</ref> A
21236 <ref>bar
21237 </ref> B
21238 <references />
21239 !! html
21240 <p><span about="#mwt2" class="mw-ref" 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"><span class="mw-reflink-text">[1]</span></a></span> A
21241 <span about="#mwt4" class="mw-ref" 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"><span class="mw-reflink-text">[2]</span></a></span> B</p>
21242 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21243 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
21244 <li about="#cite_note-2" id="cite_note-2"><a href="#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar
21245 </span></li>
21246 </ol>
21247 !!end
21248
21249 !!test
21250 Ref: 14. A nested ref-tag should be emitted as plain text
21251 !!options
21252 parsoid
21253 !! wikitext
21254 <ref>foo <ref>bar</ref> baz</ref>
21255
21256 <references />
21257 !! html
21258 <p><span about="#mwt2" class="mw-ref" 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"><span class="mw-reflink-text">[1]</span></a></span>
21259 </p>
21260 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21261 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo &lt;ref>bar&lt;/ref> baz</span></li>
21262 </ol>
21263 !!end
21264
21265 !!test
21266 Ref: 15. ref-tags with identical names should get identical indexes
21267 !!options
21268 parsoid
21269 !! wikitext
21270 A1 <ref name="a">foo</ref> A2 <ref name="a" />
21271 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
21272
21273 <references />
21274 !! html
21275 <p>A1 <span about="#mwt3" class="mw-ref" 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"><span class="mw-reflink-text">[1]</span></a></span> A2 <span about="#mwt4" class="mw-ref" 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"><span class="mw-reflink-text">[1]</span></a></span>
21276 B1 <span about="#mwt7" class="mw-ref" 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"><span class="mw-reflink-text">[2]</span></a></span> B2 <span about="#mwt8" class="mw-ref" 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"><span class="mw-reflink-text">[2]</span></a></span></p>
21277
21278 <ol class="mw-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"><span class="mw-linkback-text">1 </span></a><a href="#cite_ref-a_1-1"><span class="mw-linkback-text">2 </span></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"><span class="mw-linkback-text">1 </span></a><a href="#cite_ref-b_2-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">bar</span></li>
21279 </ol>
21280 !!end
21281
21282 ## We don't bother wt2wt-ing non-standard whitespace
21283 !!test
21284 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
21285 !!options
21286 parsoid=wt2html
21287 !! wikitext
21288 A <ref >foo</ref >
21289
21290 <references />
21291 !! html
21292 <p>A <span about="#mwt2" class="mw-ref" 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"><span class="mw-reflink-text">[1]</span></a></span></p>
21293 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21294 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
21295 !!end
21296
21297 !!test
21298 Ref: 17. Generate valid HTML5 id/about attributes
21299 !!options
21300 parsoid
21301 !!wikitext
21302 <ref name="a b">foo</ref>
21303
21304 <references />
21305 !!html
21306 <p><span class="mw-ref" 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"><span class="mw-reflink-text">[1]</span></a></span>
21307 </p>
21308
21309 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21310 <li about="#cite_note-a_b-1" id="cite_note-a_b-1"><a href="#cite_ref-a_b_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-a_b-1" class="mw-reference-text">foo</span></li>
21311 </ol>
21312 !!end
21313
21314 !!test
21315 Ref: 18. T58916: Extension attributes should be parsed as plain text
21316 !!options
21317 parsoid
21318 !!wikitext
21319 <ref name="{{echo|a}}">foo</ref>
21320
21321 <references />
21322 !!html
21323 <p><span class="mw-ref" 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"><span class="mw-reflink-text">[1]</span></a></span>
21324 </p>
21325
21326 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21327 <li about="#cite_note-.7B.7Becho.7Ca.7D.7D-1" id="cite_note-.7B.7Becho.7Ca.7D.7D-1"><a href="#cite_ref-.7B.7Becho.7Ca.7D.7D_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-.7B.7Becho.7Ca.7D.7D-1" class="mw-reference-text">foo</span></li>
21328 </ol>
21329 !!end
21330
21331 !!test
21332 Ref: 19. ref-tags with identical name encodings should get identical indexes
21333 !!options
21334 parsoid
21335 !! wikitext
21336 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
21337
21338 <references />
21339 !! html
21340 <p>1 <span about="#mwt3" class="mw-ref" 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"><span class="mw-reflink-text">[1]</span></a></span> 2 <span about="#mwt4" class="mw-ref" 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"><span class="mw-reflink-text">[1]</span></a></span>
21341 </p>
21342 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21343 <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"><span class="mw-linkback-text">1 </span></a><a href="#cite_ref-a_.26_b_1-1"><span class="mw-linkback-text">2 </span></a></span> <span id="mw-reference-text-cite_note-a_.26_b-1" class="mw-reference-text">foo</span></li>
21344 </ol>
21345 !!end
21346
21347 !!test
21348 Ref: 20. ref-tags with identical names but different content should keep it
21349 !!options
21350 parsoid
21351 !! wikitext
21352 A <ref name="foo">Foo one</ref>
21353 B <ref name="foo">Foo two</ref>
21354 C <ref name="foo" />
21355
21356 <references />
21357 !! html
21358 <p>A <span about="#mwt2" class="mw-ref" 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"><span class="mw-reflink-text">[1]</span></a></span>
21359 B <span about="#mwt4" class="mw-ref" 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"><span class="mw-reflink-text">[1]</span></a></span>
21360 C <span about="#mwt6" class="mw-ref" 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"><span class="mw-reflink-text">[1]</span></a></span></p>
21361
21362 <ol class="mw-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"><span class="mw-linkback-text">1 </span></a><a href="#cite_ref-foo_1-1"><span class="mw-linkback-text">2 </span></a><a href="#cite_ref-foo_1-2"><span class="mw-linkback-text">3 </span></a></span> <span id="mw-reference-text-cite_note-foo-1" class="mw-reference-text">Foo one</span></li>
21363 </ol>
21364 !!end
21365
21366 !!test
21367 References: 1. references tag without any refs should be handled properly
21368 !! wikitext
21369 <references />
21370 !! html/parsoid
21371 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21372 !!end
21373
21374 !!test
21375 References: 2. references tag with group only outputs references from that group
21376 !! wikitext
21377 A <ref group="a">foo</ref>
21378 B <ref group="b">bar</ref>
21379 C <ref>baz</ref>
21380
21381 <references group="a" />
21382 <references />
21383 <references group="b" />
21384 !! html/parsoid
21385 <p>A <span about="#mwt2" class="mw-ref" 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" data-mw-group="a"><span class="mw-reflink-text">[a 1]</span></a></span>
21386 B <span about="#mwt4" class="mw-ref" 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" data-mw-group="b"><span class="mw-reflink-text">[b 1]</span></a></span>
21387 C <span class="mw-ref" 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"><span class="mw-reflink-text">[1]</span></a></span></p>
21388
21389 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
21390 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" data-mw-group="a" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
21391 </ol>
21392 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
21393 <li about="#cite_note-3" id="cite_note-3"><a href="#cite_ref-3" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-3" class="mw-reference-text">baz</span></li>
21394 </ol>
21395 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
21396 <li about="#cite_note-2" id="cite_note-2"><a href="#cite_ref-2" data-mw-group="b" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
21397 </ol>
21398 !!end
21399
21400 !!test
21401 References: 3. ref list should be cleared after processing references
21402 !! wikitext
21403 A <ref>foo</ref>
21404
21405 <references />
21406
21407 B <ref>bar</ref>
21408
21409 <references />
21410 !! html/parsoid
21411 <p>A <span about="#mwt2" class="mw-ref" 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"><span class="mw-reflink-text">[1]</span></a></span></p>
21412
21413 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
21414 </ol>
21415
21416 <p>B <span about="#mwt6" class="mw-ref" 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"><span class="mw-reflink-text">[1]</span></a></span></p>
21417
21418 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21419 <li about="#cite_note-2" id="cite_note-2"><a href="#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
21420 </ol>
21421 !!end
21422
21423 !!test
21424 References: 4. only referenced group should be cleared after processing references
21425 !! wikitext
21426 A <ref group="a">afoo</ref>
21427 B <ref>bfoo</ref>
21428
21429 <references group="a" />
21430
21431 C <ref>cfoo</ref>
21432
21433 <references />
21434 !! html/parsoid
21435 <p>A <span about="#mwt2" class="mw-ref" 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" data-mw-group="a"><span class="mw-reflink-text">[a 1]</span></a></span>
21436 B <span about="#mwt4" class="mw-ref" 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"><span class="mw-reflink-text">[1]</span></a></span></p>
21437
21438 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" data-mw-group="a" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">afoo</span></li>
21439 </ol>
21440
21441 <p>C <span about="#mwt8" class="mw-ref" 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"><span class="mw-reflink-text">[2]</span></a></span></p>
21442
21443 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-2" id="cite_note-2"><a href="#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bfoo</span></li><li about="#cite_note-3" id="cite_note-3"><a href="#cite_ref-3" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-3" class="mw-reference-text">cfoo</span></li>
21444 </ol>
21445 !!end
21446
21447 !!test
21448 References: 5. ref tags in references should be processed while ignoring all other content
21449 !! wikitext
21450 A <ref name="a" />
21451 B <ref name="b">bar</ref>
21452
21453 <references>
21454 <ref name="a">foo</ref>
21455 This should just get lost.
21456 </references>
21457 !! html/parsoid
21458 <p>A <span about="#mwt2" class="mw-ref" 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"><span class="mw-reflink-text">[1]</span></a></span>
21459 B <span about="#mwt4" class="mw-ref" 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"><span class="mw-reflink-text">[2]</span></a></span></p>
21460
21461
21462 <ol class="mw-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=\"mw-ref\" 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\" style=\"counter-reset: mw-Ref 1;\">&lt;span class=\"mw-reflink-text\">[1]&lt;/span>&lt;/a>&lt;/span>\n"},"attrs":{}}'><li about="#cite_note-a-1" id="cite_note-a-1"><a href="#cite_ref-a_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <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"><a href="#cite_ref-b_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">bar</span></li>
21463 </ol>
21464 !!end
21465
21466 !!test
21467 References: 6. <references /> from a transclusion
21468 !! wikitext
21469 <ref>Foo</ref> {{echo|<references />}}
21470 !! html/parsoid
21471 <p><span about="#mwt3" class="mw-ref" 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"><span class="mw-reflink-text">[1]</span></a></span></p> <ol class="mw-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"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">Foo</span></li>
21472 </ol>
21473 !!end
21474
21475 !! test
21476 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
21477 !! wikitext
21478 A <ref>foo bar for a</ref>
21479 B <ref group="X" name="b" />
21480
21481 <references />
21482
21483 <references group="X">
21484 <ref name="b">foo</ref>
21485 </references>
21486 !! html/parsoid
21487 <p>A <span about="#mwt2" class="mw-ref" 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"><span class="mw-reflink-text">[1]</span></a></span>
21488 B <span about="#mwt4" class="mw-ref" 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" data-mw-group="X"><span class="mw-reflink-text">[X 1]</span></a></span>
21489 </p>
21490
21491 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21492 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo bar for a</span></li>
21493 </ol>
21494
21495 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="X" data-mw='{"name":"references","body":{"extsrc":"&lt;ref name=\"b\">foo&lt;/ref>","html":"\n&lt;span about=\"#mwt10\" class=\"mw-ref\" 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\" style=\"counter-reset: mw-Ref 1;\" data-mw-group=\"X\">&lt;span class=\"mw-reflink-text\">[X 1]&lt;/span>&lt;/a>&lt;/span>\n"},"attrs":{"group":"X"}}'>
21496 <li about="#cite_note-b-2" id="cite_note-b-2"><a href="#cite_ref-b_2-0" data-mw-group="X" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">foo</span></li>
21497 </ol>
21498 !! end
21499
21500 !! test
21501 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
21502 !! wikitext
21503 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
21504 <references />
21505 !! html/parsoid
21506 <p>X<span about="#mwt2" class="mw-ref" 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"><span class="mw-reflink-text">[1]</span></a></span></p>
21507 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt7" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <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>
21508 </ol>
21509 !!end
21510
21511 # This test only works in wt2html now as the <references /> are always generated
21512 # unless selser is active. Once T72722 is fixed, we should add a changes test
21513 # here to ensure that unrelated changes don't add the new <references /> in
21514 # wt2wt.
21515 !! test
21516 References: 9. Generate missing references list at the end
21517 !! wikitext
21518 A <ref>foo</ref>
21519 B <ref group="inexistent">bar</ref>
21520 !! html/parsoid
21521 <p>A <span class="mw-ref" 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"><span class="mw-reflink-text">[1]</span></a></span> B <span class="mw-ref" 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" data-mw-group="inexistent"><span class="mw-reflink-text">[inexistent 1]</span></a></span></p>
21522 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21523 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
21524 </ol>
21525 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
21526 <li about="#cite_note-2" id="cite_note-2"><a href="#cite_ref-2" data-mw-group="inexistent" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
21527 </ol>
21528 !! end
21529
21530 !! test
21531 References: 10. New <references/> shouldn't be added for unrelated edits.
21532 !! options
21533 parsoid={
21534 "modes": ["selser"],
21535 "changes": [["#x", "remove"]],
21536 "selser": "noauto"
21537 }
21538 !! wikitext
21539 Unrelated text<span id="x"> that's going to disappear</span>.
21540 A <ref>foo</ref>
21541 !! wikitext/edited
21542 Unrelated text.
21543 A <ref>foo</ref>
21544 !!end
21545
21546 !! test
21547 Entities in ref name
21548 !! wikitext
21549 <ref name="test &amp; me">hi</ref>
21550 <references />
21551 !! html/parsoid
21552 <p><span about="#mwt2" class="mw-ref" 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"><span class="mw-reflink-text">[1]</span></a></span></p>
21553 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21554 <li about="#cite_note-test_.26_me-1" id="cite_note-test_.26_me-1"><a href="#cite_ref-test_.26_me_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-test_.26_me-1" class="mw-reference-text">hi</span></li>
21555 </ol>
21556 !! end
21557
21558 # This test is wt2html only because we're permitting the serializer to produce
21559 # dirty diffs, normalizing the unclosed references to the self-closed version.
21560 !! test
21561 Generate references for unclosed references tag
21562 !! options
21563 parsoid=wt2html
21564 !! wikitext
21565 a<ref>foo</ref>
21566
21567 <references>
21568 !! html/parsoid
21569 <p>a<span about="#mwt2" class="mw-ref" 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"><span class="mw-reflink-text">[1]</span></a></span></p>
21570 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21571 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
21572 !! end
21573
21574 !! test
21575 New reference serializes on its own line
21576 !! options
21577 parsoid=wt2wt,html2wt
21578 !! wikitext
21579 foo
21580 <references />
21581 !! html/parsoid
21582 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21583 !! end
21584
21585 #### ----------------------------------------------------------------
21586 #### Parsoid-only testing of Parsoid's impl of LST
21587 #### Not implemented yet, see
21588 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
21589 #### ----------------------------------------------------------------
21590
21591 !!test
21592 LST Sections: 1. Simple section start and end
21593 !! wikitext
21594 <section begin="2011-05-16" />
21595 <section end="2014-04-10 (MW 1.23wmf22)" />
21596 !! html/parsoid
21597 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
21598 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
21599 !! end
21600
21601 #--------- Test stripping of empty nodes in template content ----------
21602 !!test
21603 Empty LI and TR nodes should be stripped from template content
21604 !!wikitext
21605 {{EmptyLITest}}
21606 {{EmptyTRTest}}
21607 !!html/parsoid
21608 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
21609 <li>a</li>
21610 <li>b</li>
21611 </ul>
21612 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
21613 <tbody>
21614 <tr>
21615 <td>foo</td>
21616 </tr>
21617 <tr>
21618 <td>bar</td>
21619 </tr>
21620 </tbody>
21621 </table>
21622 !!end
21623
21624 !!test
21625 Empty LI and TR nodes should not be stripped from top-level content
21626 !!wikitext
21627 * a
21628 *
21629 * b
21630 {|
21631 |-
21632 |-
21633 |foo
21634 |}
21635 !!html/parsoid
21636 <ul>
21637 <li> a</li>
21638 <li></li>
21639 <li> b</li>
21640 </ul>
21641 <table>
21642 <tbody>
21643 <tr></tr>
21644 <tr>
21645 <td>foo</td>
21646 </tr>
21647 </tbody>
21648 </table>
21649 !!end
21650
21651 !!test
21652 Empty TR nodes should not be stripped if they have any attributes set
21653 !!wikitext
21654 {{EmptyTRWithHTMLAttrTest}}
21655 !!html/parsoid
21656 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
21657 <tr align="center"></tr>
21658 <tr><td>foo</td></tr>
21659 <tr align="center"></tr>
21660 <tr><td>bar</td></tr>
21661 </table>
21662 !!end
21663
21664 #### ----------------------------------------------------------------
21665 #### The following section of tests are primarily to test
21666 #### wikitext escaping capabilities of Parsoid. Given that
21667 #### escaping can be done any number of ways, the wikitext (input)
21668 #### is always adjusted to reflect how Parsoid adds nowiki
21669 #### escape tags.
21670 ####
21671 #### We are marking several tests as parsoid-only since the
21672 #### HTML in the result section is different from what the
21673 #### PHP parser generates for it.
21674 #### ----------------------------------------------------------------
21675
21676
21677 #### --------------- Headings ---------------
21678 #### 0. Unnested
21679 #### 1. Nested inside html <h1>=foo=</h1>
21680 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
21681 #### 3. Nested inside html with wikitext split by html tags
21682 #### 4. No escape needed
21683 #### 5. Empty headings <h1></h1>
21684 #### 6. Heading chars in SOL context
21685 #### ----------------------------------------
21686 !! test
21687 Headings: 0. Unnested
21688 !! options
21689 parsoid
21690 !! wikitext
21691 <nowiki>=foo=</nowiki>
21692
21693 <nowiki> =foo= </nowiki>
21694 <!--cmt-->
21695 <nowiki>=foo=</nowiki>
21696
21697 =foo''a''<nowiki>=</nowiki>
21698 !! html
21699 <p><span typeof="mw:Nowiki">=foo=</span></p>
21700
21701 <p><span typeof="mw:Nowiki"> =foo= </span>
21702 <!--cmt-->
21703 <span typeof="mw:Nowiki">=foo=</span></p>
21704
21705 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
21706 !!end
21707
21708 # New headings and existing headings are handled differently
21709 !! test
21710 Headings: 1. Nested inside html
21711 !! options
21712 parsoid=html2wt
21713 !! html/parsoid
21714 <h1>=foo=</h1>
21715 <h2>=foo=</h2>
21716 <h3>=foo=</h3>
21717
21718 <h1 data-parsoid=''>=foo=</h1>
21719 <h2 data-parsoid=''>=foo=</h2>
21720 <h3 data-parsoid=''>=foo=</h3>
21721 <h4 data-parsoid=''>=foo=</h4>
21722 <h5 data-parsoid=''>=foo=</h5>
21723 <h6 data-parsoid=''>=foo=</h6>
21724 !! wikitext
21725 = =foo= =
21726
21727 == =foo= ==
21728
21729 === =foo= ===
21730
21731 =<nowiki>=foo=</nowiki>=
21732 ==<nowiki>=foo=</nowiki>==
21733 ===<nowiki>=foo=</nowiki>===
21734 ====<nowiki>=foo=</nowiki>====
21735 =====<nowiki>=foo=</nowiki>=====
21736 ======<nowiki>=foo=</nowiki>======
21737
21738 !!end
21739
21740 !! test
21741 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
21742 !! options
21743 parsoid=html2wt
21744 !! html/parsoid
21745 <h1>foo</h1>*bar
21746 <h1>foo</h1>=bar
21747 <h1>foo</h1>=bar=
21748 !! wikitext
21749 = foo =
21750 <nowiki>*</nowiki>bar
21751
21752 = foo =
21753 =bar
21754
21755 = foo =
21756 <nowiki>=bar=</nowiki>
21757 !!end
21758
21759 !! test
21760 Headings: 3. Nested inside html with wikitext split by html tags
21761 !! options
21762 parsoid=html2wt,wt2wt
21763 !! wikitext
21764 = ='''bold'''<nowiki>foo=</nowiki> =
21765 !! html/parsoid
21766 <h1>=<b>bold</b>foo=</h1>
21767 !!end
21768
21769 !! test
21770 Headings: 4a. No escaping needed (testing just h1 and h2)
21771 !! wikitext
21772 = =foo =
21773
21774 = foo= =
21775
21776 = =foo= =
21777
21778 = =foo= bar =
21779
21780 == =foo ==
21781
21782 == foo= ==
21783
21784 = = =
21785
21786 = ''=''foo= =
21787 !! html/parsoid
21788 <h1>=foo</h1>
21789 <h1>foo=</h1>
21790 <h1> =foo= </h1>
21791 <h1>=foo= bar</h1>
21792 <h2>=foo</h2>
21793 <h2>foo=</h2>
21794 <h1>=</h1>
21795 <h1><i>=</i>foo=</h1>
21796 !!end
21797
21798 !! test
21799 Headings: 4b. No escaping needed (inside p-tags)
21800 !! options
21801 parsoid=html2wt
21802 !! html/parsoid
21803 <p>===
21804 =foo= x
21805 =foo= <s></s>
21806 </p>
21807 !! wikitext
21808 ===
21809 =foo= x
21810 =foo= <s></s>
21811 !!end
21812
21813 !! test
21814 Headings: 5. Empty headings
21815 !! wikitext
21816 =<nowiki/>=
21817
21818 ==<nowiki/>==
21819
21820 ===<nowiki/>===
21821
21822 ====<nowiki/>====
21823
21824 =====<nowiki/>=====
21825
21826 ======<nowiki/>======
21827 !! html/parsoid
21828 <h1 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h1>
21829
21830 <h2 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h2>
21831
21832 <h3 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h3>
21833
21834 <h4 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h4>
21835
21836 <h5 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h5>
21837
21838 <h6 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h6>
21839 !!end
21840
21841 !! test
21842 Headings: 6a. Heading chars in SOL context (with trailing spaces)
21843 !! wikitext
21844 <nowiki>=a=</nowiki>
21845
21846 <nowiki>=a=</nowiki>
21847
21848 <nowiki>=a=</nowiki>
21849
21850 <nowiki>=a=</nowiki>
21851 !! html/php
21852 <p>=a=
21853 </p><p>=a=
21854 </p><p>=a=
21855 </p><p>=a=
21856 </p>
21857 !! html/parsoid
21858 <p><span typeof="mw:Nowiki">=a=</span></p>
21859
21860 <p><span typeof="mw:Nowiki">=a=</span></p>
21861
21862 <p><span typeof="mw:Nowiki">=a=</span></p>
21863
21864 <p><span typeof="mw:Nowiki">=a=</span></p>
21865 !!end
21866
21867 !! test
21868 Headings: 6b. Heading chars in SOL context (with trailing newlines)
21869 !! wikitext
21870 <nowiki>=a=
21871 b</nowiki>
21872
21873 <nowiki>=a=
21874 b</nowiki>
21875
21876 <nowiki>=a=
21877 b</nowiki>
21878
21879 <nowiki>=a=
21880 b</nowiki>
21881 !! html/php
21882 <p>=a=
21883 b
21884 </p><p>=a=
21885 b
21886 </p><p>=a=
21887 b
21888 </p><p>=a=
21889 b
21890 </p>
21891 !! html/parsoid
21892 <p><span typeof="mw:Nowiki">=a=
21893 b</span></p>
21894
21895 <p><span typeof="mw:Nowiki">=a=
21896 b</span></p>
21897
21898 <p><span typeof="mw:Nowiki">=a=
21899 b</span></p>
21900
21901 <p><span typeof="mw:Nowiki">=a=
21902 b</span></p>
21903 !!end
21904
21905 !! test
21906 Headings: 6c. Heading chars in SOL context (leading newline break)
21907 !! wikitext
21908 a
21909 <nowiki>=b=</nowiki>
21910 !! html/php
21911 <p>a
21912 =b=
21913 </p>
21914 !! html/parsoid
21915 <p>a
21916 <span typeof="mw:Nowiki">=b=</span>
21917 !!end
21918
21919 !! test
21920 Headings: 6d. Heading chars in SOL context (with interspersed comments)
21921 !! wikitext
21922 <!--c0--><nowiki>=a=</nowiki>
21923
21924 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
21925 !! html/php
21926 <p>=a=
21927 </p><p>=a=
21928 </p>
21929 !! html/parsoid
21930 <!--c0--><p><span typeof="mw:Nowiki">=a=</span></p>
21931
21932 <!--c1--><p><span typeof="mw:Nowiki">=a=</span></p> <!--c2--> <!--c3-->
21933 !!end
21934
21935 !! test
21936 Headings: 6d. Heading chars in SOL context (No escaping needed)
21937 !! options
21938 parsoid=html2wt
21939 !! html/parsoid
21940 =a=<div>b</div>
21941 !! wikitext
21942 =a=<div>b</div>
21943 !!end
21944
21945 !! test
21946 Headings: 7. Insert a newline between new content and headings
21947 !! options
21948 parsoid=html2wt
21949 !! html/parsoid
21950 <h2>NEW</h2>
21951 <p>new</p>
21952 <h2 data-parsoid='{}'>A</h2>
21953 <p data-parsoid='{}'>a</p>
21954 !! wikitext
21955 == NEW ==
21956 new
21957
21958 ==A==
21959 a
21960
21961 !! end
21962
21963 #### --------------- Lists ---------------
21964 #### 0. Outside nests (*foo, etc.)
21965 #### 1. Nested inside html <ul><li>*foo</li></ul>
21966 #### 2. Inside definition lists
21967 #### 3. Only bullets at start should be escaped
21968 #### 4. No escapes needed
21969 #### 5. No unnecessary escapes
21970 #### 6. Escape bullets in SOL position
21971 #### 7. Escape bullets in a multi-line context
21972 #### ----------------------------------------
21973
21974 !! test
21975 Lists: 0. Outside nests
21976 !! wikitext
21977 <nowiki>*</nowiki>foo
21978
21979 <nowiki>#</nowiki>foo
21980
21981 <nowiki>;Foo:</nowiki>bar
21982 !! html/php
21983 <p>*foo
21984 </p><p>#foo
21985 </p><p>;Foo:bar
21986 </p>
21987 !! html/parsoid
21988 <p><span typeof="mw:Nowiki">*</span>foo</p>
21989
21990 <p><span typeof="mw:Nowiki">#</span>foo</p>
21991
21992 <p><span typeof="mw:Nowiki">;Foo:</span>bar</p>
21993 !!end
21994
21995 !! test
21996 Lists: 1. Nested inside html
21997 !! wikitext
21998 *<nowiki>*foo</nowiki>
21999
22000 *<nowiki>#foo</nowiki>
22001
22002 *<nowiki>:foo</nowiki>
22003
22004 *<nowiki>;foo</nowiki>
22005
22006 #<nowiki>*foo</nowiki>
22007
22008 #<nowiki>#foo</nowiki>
22009
22010 #<nowiki>:foo</nowiki>
22011
22012 #<nowiki>;foo</nowiki>
22013 !! html
22014 <ul><li>*foo</li></ul>
22015 <ul><li>#foo</li></ul>
22016 <ul><li>:foo</li></ul>
22017 <ul><li>;foo</li></ul>
22018 <ol><li>*foo</li></ol>
22019 <ol><li>#foo</li></ol>
22020 <ol><li>:foo</li></ol>
22021 <ol><li>;foo</li></ol>
22022
22023 !!end
22024
22025 !! test
22026 Lists: 2. Inside definition lists
22027 !! wikitext
22028 ;<nowiki>;foo</nowiki>
22029
22030 ;<nowiki>:foo</nowiki>
22031
22032 ;<nowiki>:foo</nowiki>
22033 :bar
22034
22035 :<nowiki>:foo</nowiki>
22036 !! html
22037 <dl><dt>;foo</dt></dl>
22038 <dl><dt>:foo</dt></dl>
22039 <dl><dt>:foo</dt>
22040 <dd>bar</dd></dl>
22041 <dl><dd>:foo</dd></dl>
22042
22043 !!end
22044
22045 !! test
22046 Lists: 3. Only bullets at start of text should be escaped
22047 !! wikitext
22048 *<nowiki>*foo*bar</nowiki>
22049
22050 *<nowiki>*foo</nowiki>''it''*bar
22051 !! html
22052 <ul><li>*foo*bar</li></ul>
22053 <ul><li>*foo<i>it</i>*bar</li></ul>
22054
22055 !!end
22056
22057 !! test
22058 Lists: 4. No escapes needed
22059 !! options
22060 parsoid
22061 !! wikitext
22062 *foo*bar
22063
22064 *''foo''*bar
22065
22066 *[[Foo]]: bar
22067
22068 *[[Foo]]*bar
22069 !! html
22070 <ul>
22071 <li>foo*bar
22072 </li>
22073 </ul>
22074 <ul>
22075 <li><i>foo</i>*bar
22076 </li>
22077 </ul>
22078 <ul>
22079 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
22080 </li>
22081 </ul>
22082 <ul>
22083 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
22084 </li>
22085 </ul>
22086 !!end
22087
22088 !! test
22089 Lists: 5. No unnecessary escapes
22090 !! wikitext
22091 * bar <span><nowiki>[[foo]]</nowiki></span>
22092
22093 * =bar <span><nowiki>[[foo]]</nowiki></span>
22094
22095 * [[bar <span><nowiki>[[foo]]</nowiki></span>
22096
22097 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
22098
22099 * =bar <span>foo]]</span>=
22100
22101 * <s></s>: a
22102
22103 * ''* foo''
22104 !! html
22105 <ul><li> bar <span>[[foo]]</span></li></ul>
22106 <ul><li> =bar <span>[[foo]]</span></li></ul>
22107 <ul><li> [[bar <span>[[foo]]</span></li></ul>
22108 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
22109 <ul><li> =bar <span>foo]]</span>=</li></ul>
22110 <ul><li> <s></s>: a</li></ul>
22111 <ul><li> <i>* foo</i></li></ul>
22112
22113 !!end
22114
22115 !! test
22116 Lists: 6. Escape bullets in SOL position
22117 !! options
22118 parsoid=html2wt
22119 !! html/parsoid
22120 <p><!--cmt-->*foo</p>
22121 !! wikitext
22122 <!--cmt--><nowiki>*</nowiki>foo
22123 !!end
22124
22125 !! test
22126 Lists: 7. Escape bullets in a multi-line context
22127 !! wikitext
22128 a
22129 <nowiki>*</nowiki>b
22130 !! html
22131 <p>a
22132 *b
22133 </p>
22134 !!end
22135
22136 !! test
22137 Lists: 8. Escape colons only if not present in tags
22138 !! options
22139 parsoid=html2wt
22140 !! html/parsoid
22141 <dl><dt>a:b<i>c:d</i></dt></dl>
22142 !! wikitext
22143 ; <nowiki>a:b</nowiki>''c:d''
22144 !! end
22145
22146 #### --------------- HRs ---------------
22147 #### 1. Single line
22148 #### -----------------------------------
22149
22150 !! test
22151 HRs: 1. Single line
22152 !! wikitext
22153 ----<nowiki>----</nowiki>
22154 ----=foo=
22155 ----*foo
22156 !! html+tidy
22157 <hr />
22158 <p>----</p>
22159 <hr />
22160 <p>=foo=</p>
22161 <hr />
22162 <p>*foo</p>
22163 !! end
22164
22165 #### --------------- Tables ---------------
22166 #### 1a. Simple example
22167 #### 1b. No escaping needed (!foo)
22168 #### 1c. No escaping needed (|foo)
22169 #### 1d. No escaping needed (|}foo)
22170 ####
22171 #### 2a. Nested in td (<td>foo|bar</td>)
22172 #### 2b. Nested in td (<td>foo||bar</td>)
22173 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
22174 ####
22175 #### 3a. Nested in th (<th>foo!bar</th>)
22176 #### 3b. Nested in th (<th>foo!!bar</th>)
22177 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
22178 ####
22179 #### 4a. Escape -
22180 #### 4b. Escape +
22181 #### 4c. No escaping needed
22182 #### --------------------------------------
22183
22184 !! test
22185 Tables: 1a. Simple example
22186 !! wikitext
22187 <nowiki>{|
22188 |}</nowiki>
22189 !! html
22190 <p>{|
22191 |}
22192 </p>
22193 !! end
22194
22195 !! test
22196 Tables: 1b. No escaping needed
22197 !! wikitext
22198 !foo
22199 !! html
22200 <p>!foo
22201 </p>
22202 !! end
22203
22204 !! test
22205 Tables: 1c. No escaping needed
22206 !! wikitext
22207 |foo
22208 !! html
22209 <p>|foo
22210 </p>
22211 !! end
22212
22213 !! test
22214 Tables: 1d. No escaping needed
22215 !! wikitext
22216 |}foo
22217 !! html
22218 <p>|}foo
22219 </p>
22220 !! end
22221
22222 !! test
22223 Tables: 2a. Nested in td
22224 !! options
22225 parsoid=html2wt
22226 !! html/parsoid
22227 <table><tbody><tr>
22228 <td>foo|bar</td></tr>
22229 <tr><td>x<div>a|b</div></td>
22230 </tbody></table>
22231 !! wikitext
22232 {|
22233 |<nowiki>foo|bar</nowiki>
22234 |-
22235 |x<div><nowiki>a|b</nowiki></div>
22236 |}
22237 !! html/php+tidy
22238 <table>
22239 <tr>
22240 <td>foo|bar</td>
22241 </tr>
22242 <tr>
22243 <td>x
22244 <div>a|b</div>
22245 </td>
22246 </tr>
22247 </table>
22248 !! end
22249
22250 !! test
22251 Tables: 2b. Nested in td
22252 !! options
22253 parsoid=html2wt
22254 !! html/parsoid
22255 <table><tbody><tr>
22256 <td>foo||bar</td>
22257 <td>a<i>b||c</i></td>
22258 <td>a<i><div>b||c</div></i></td>
22259 </tr></tbody></table>
22260 !! wikitext
22261 {|
22262 |<nowiki>foo||bar</nowiki>
22263 |a''<nowiki>b||c</nowiki>''
22264 |a''<div><nowiki>b||c</nowiki></div>''
22265 |}
22266 !! html/php
22267 <table>
22268 <tr>
22269 <td>foo||bar
22270 </td>
22271 <td>a<i>b||c</i>
22272 </td>
22273 <td>a<i><div>b||c</div></i>
22274 </td></tr></table>
22275
22276 !! end
22277
22278 !! test
22279 Tables: 2c. Nested in td -- no escaping needed
22280 !! wikitext
22281 {|
22282
22283 |foo!!bar
22284 |}
22285 !! html/*
22286 <table>
22287
22288 <tr>
22289 <td>foo!!bar
22290 </td></tr></table>
22291
22292 !! end
22293
22294 !! test
22295 Tables: 3a. Nested in th
22296 !! wikitext
22297 {|
22298
22299 !foo!bar
22300 |}
22301 !! html/*
22302 <table>
22303
22304 <tr>
22305 <th>foo!bar
22306 </th></tr></table>
22307
22308 !! end
22309
22310 !! test
22311 Tables: 3b. Nested in th
22312 !! options
22313 parsoid=html2wt
22314 !! html/parsoid
22315 <table><tbody>
22316 <tr><th>foo!!bar</th>
22317 <th><i>foo|bar</i></th>
22318 <th><i>foo!!bar</i></th>
22319 <th><i><span>foo!!bar</span></i></th>
22320 </tr></tbody></table>
22321 !! wikitext
22322 {|
22323 !<nowiki>foo!!bar</nowiki>
22324 !''<nowiki>foo|bar</nowiki>''
22325 !''<nowiki>foo!!bar</nowiki>''
22326 !''<span><nowiki>foo!!bar</nowiki></span>''
22327 |}
22328 !! html/php
22329 <table>
22330 <tr>
22331 <th>foo!!bar
22332 </th>
22333 <th><i>foo|bar</i>
22334 </th>
22335 <th><i>foo!!bar</i>
22336 </th>
22337 <th><i><span>foo!!bar</span></i>
22338 </th></tr></table>
22339
22340 !! end
22341
22342 !! test
22343 Tables: 3c. Nested in th
22344 !! options
22345 parsoid=html2wt
22346 !! html/parsoid
22347 <table><tbody>
22348 <tr><th>foo||bar</th>
22349 <th><span typeof="mw:Nowiki">foo||bar</span></th>
22350 </tr></tbody></table>
22351 !! wikitext
22352 {|
22353 !<nowiki>foo||bar</nowiki>
22354 !<nowiki>foo||bar</nowiki>
22355 |}
22356 !! html/php
22357 <table>
22358 <tr>
22359 <th>foo||bar
22360 </th>
22361 <th>foo||bar
22362 </th></tr></table>
22363
22364 !! end
22365
22366 !! test
22367 Tables: 4a. Escape -
22368 !! options
22369 parsoid=html2wt
22370 !! html/*
22371 <table>
22372
22373 <tr>
22374 <th>-bar
22375 </th></tr>
22376 <tr>
22377 <td>-bar
22378 </td></tr></table>
22379
22380 !! wikitext
22381 {|
22382
22383 !-bar
22384
22385 |-
22386 |<nowiki>-bar</nowiki>
22387 |}
22388 !! end
22389
22390 !! test
22391 Tables: 4b. Escape +
22392 !! options
22393 parsoid=html2wt
22394 !! html/*
22395 <table>
22396
22397 <tr>
22398 <th>+bar
22399 </th></tr>
22400 <tr>
22401 <td>+bar
22402 </td></tr></table>
22403
22404 !! wikitext
22405 {|
22406
22407 !+bar
22408
22409 |-
22410 |<nowiki>+bar</nowiki>
22411 |}
22412 !! end
22413
22414 !! test
22415 Tables: 4c. No escaping needed
22416 !! wikitext
22417 {|
22418 |foo-bar
22419 |foo+bar
22420 |-
22421 |''foo''-bar
22422 |''foo''+bar
22423 |-
22424 |foo
22425 bar|baz
22426 +bar
22427 -bar
22428 |-
22429 |x
22430 <div>a|b</div>
22431 |}
22432 !! html/php
22433 <table>
22434 <tr>
22435 <td>foo-bar
22436 </td>
22437 <td>foo+bar
22438 </td></tr>
22439 <tr>
22440 <td><i>foo</i>-bar
22441 </td>
22442 <td><i>foo</i>+bar
22443 </td></tr>
22444 <tr>
22445 <td>foo
22446 <p>bar|baz
22447 +bar
22448 -bar
22449 </p>
22450 </td></tr>
22451 <tr>
22452 <td>x
22453 <div>a|b</div>
22454 </td></tr></table>
22455
22456 !! html/parsoid
22457 <table><tbody>
22458 <tr><td>foo-bar</td><td>foo+bar</td></tr>
22459 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
22460 <tr><td>foo
22461 <p>bar|baz
22462 +bar
22463 -bar</p></td></tr>
22464 <tr><td>x
22465 <div>a|b</div></td>
22466 </tbody></table>
22467 !! end
22468
22469 !! test
22470 Tables: 4d. No escaping needed
22471 !! wikitext
22472 {|
22473 |[[Foo]]-bar
22474 ||+1
22475 ||-2
22476 |}
22477 !! html/php
22478 <table>
22479 <tr>
22480 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
22481 </td>
22482 <td>+1
22483 </td>
22484 <td>-2
22485 </td></tr></table>
22486
22487 !! html/parsoid
22488 <table>
22489 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
22490 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
22491 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
22492 </tbody></table>
22493 !! end
22494
22495 !! test
22496 Tables: Digest broken attributes on table and tr tag
22497 !! options
22498 parsoid=wt2html
22499 !! wikitext
22500 {| || |} ++
22501 |- || || ++ --
22502 |- > [
22503 |}
22504 !! html
22505 <table>
22506 <tbody>
22507 <tr></tr>
22508 <tr></tr>
22509 </tbody></table>
22510 !! end
22511
22512 !! test
22513 T97430: Don't emit empty nowiki pairs around marker meta tags
22514 !! options
22515 parsoid=html2wt
22516 !! html/parsoid
22517 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
22518 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
22519 !! wikitext
22520 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
22521 <nowiki>|</nowiki>** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
22522 !! end
22523
22524 !! test
22525 Unclosed xmlish element in table line shouldn't eat end delimiters
22526 !! wikitext
22527 {|
22528 | <foo
22529 | bar>
22530 |}
22531 !! html/php
22532 <table>
22533 <tr>
22534 <td> &lt;foo
22535 </td>
22536 <td> bar&gt;
22537 </td></tr></table>
22538
22539 !! html/parsoid
22540 <table>
22541 <tbody><tr><td> &lt;foo</td>
22542 <td> bar></td></tr>
22543 </tbody></table>
22544 !! end
22545
22546 #### --------------- Links ----------------
22547 #### 1. Quote marks in link text
22548 #### 2. Wikilinks: Escapes needed
22549 #### 3. Wikilinks: No escapes needed
22550 #### 4. Extlinks: Escapes needed
22551 #### 5. Extlinks: No escapes needed
22552 #### --------------------------------------
22553 !! test
22554 Links 1. WikiLinks: No escapes needed
22555 !! wikitext
22556 [[Foo|Foo''boo'']]
22557 [[Foo|[Foobar]]]
22558 [[Foo|x [Foobar] x]]
22559 !! html/php
22560 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
22561 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
22562 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
22563 </p>
22564 !! html/parsoid
22565 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
22566 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
22567 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
22568 !! end
22569
22570 !! test
22571 Links 2. WikiLinks: Escapes needed
22572 !! options
22573 parsoid=html2wt
22574 !! html/parsoid
22575 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
22576 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
22577 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
22578 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
22579 <a href="Foo" rel="mw:WikiLink">|Bar</a>
22580 <a href="Foo" rel="mw:WikiLink">]]bar</a>
22581 <a href="Foo" rel="mw:WikiLink">[[bar</a>
22582 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
22583 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
22584 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
22585 !! wikitext
22586 [[Foo|<nowiki>Foobar]</nowiki>]]
22587 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
22588 [[Foo|<nowiki>[[Bar]]</nowiki>]]
22589 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
22590 [[Foo|<nowiki>|Bar</nowiki>]]
22591 [[Foo|<nowiki>]]bar</nowiki>]]
22592 [[Foo|<nowiki>[[bar</nowiki>]]
22593 [[Foo|<nowiki>x [[ y</nowiki>]]
22594 [[Foo|<nowiki>x ]] y</nowiki>]]
22595 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
22596 !! html/php
22597 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
22598 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
22599 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
22600 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
22601 <a href="/wiki/Foo" title="Foo">|Bar</a>
22602 <a href="/wiki/Foo" title="Foo">]]bar</a>
22603 <a href="/wiki/Foo" title="Foo">[[bar</a>
22604 <a href="/wiki/Foo" title="Foo">x [[ y</a>
22605 <a href="/wiki/Foo" title="Foo">x ]] y</a>
22606 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
22607 </p>
22608 !! end
22609
22610 !! test
22611 Links 3. WikiLinks: No escapes needed
22612 !! wikitext
22613 [[Foo|[Foobar]]
22614 [[Foo|foo|bar]]
22615 !! html/php
22616 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
22617 <a href="/wiki/Foo" title="Foo">foo|bar</a>
22618 </p>
22619 !! html/parsoid
22620 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
22621 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
22622 !! end
22623
22624 !! test
22625 Links 4. ExtLinks: Escapes needed
22626 !! options
22627 parsoid=html2wt
22628 !! html/parsoid
22629 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
22630 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
22631 <p>[http://google.com]</p>
22632 <p>[http://google.com google]</p>
22633 !! wikitext
22634 [http://google.com <nowiki>[google]</nowiki>]
22635 [http://google.com <nowiki>google]</nowiki>]
22636
22637 <nowiki>[http://google.com]</nowiki>
22638
22639 <nowiki>[http://google.com google]</nowiki>
22640
22641 !! html/php
22642 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
22643 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
22644 </p><p>[http://google.com]
22645 </p><p>[http://google.com google]
22646 </p>
22647 !! end
22648
22649 !! test
22650 Links 5. ExtLinks: No escapes needed
22651 !! wikitext
22652 [http://google.com [google]
22653 !! html/php
22654 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
22655 </p>
22656 !! html/parsoid
22657 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
22658 !! end
22659
22660 !! test
22661 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
22662 !! html/parsoid
22663 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
22664 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
22665 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
22666 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
22667 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
22668 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
22669 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
22670 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
22671 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
22672 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
22673 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
22674 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
22675 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
22676 </p>
22677 !! wikitext
22678 x<nowiki/>http://example.com<nowiki/>y
22679 http://example.com<nowiki/>?x
22680 http://example.com<nowiki/>&x
22681 http://example.com<nowiki/>'x
22682 http://example.com<nowiki/>,x
22683 http://example.com<nowiki/>.x
22684 http://example.com<nowiki/>;x
22685 http://example.com<nowiki/>:x
22686 http://example.com<nowiki/>;x
22687 http://example.com<nowiki/>!x
22688 http://example.com<nowiki/>=x
22689 http://example.com<nowiki/>(x)
22690 http://example.com(x<nowiki/>)
22691 !! end
22692
22693 !! test
22694 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
22695 !! html/parsoid
22696 <p>x
22697 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
22698 y
22699 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
22700 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
22701 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
22702 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
22703 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
22704 </p>
22705 !! wikitext
22706 x
22707 http://example.com
22708 y
22709 "http://example.com"
22710 (http://example.com)
22711 (http://example.com) foo
22712 http://example.com,
22713 http://example.com, foo
22714 !! html/php
22715 <p>x
22716 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
22717 y
22718 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
22719 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
22720 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
22721 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
22722 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
22723 </p>
22724 !! end
22725
22726 !! test
22727 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
22728 !! html/parsoid
22729 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
22730 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
22731 !! wikitext
22732 http://example.com.,;:!?\
22733 -http://example.com:
22734 !! html/php
22735 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
22736 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
22737 </p>
22738 !! end
22739
22740 !! test
22741 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
22742 !! html/parsoid
22743 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
22744 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
22745 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
22746 !! wikitext
22747 RFC 123<nowiki/>4
22748 RFC 123<nowiki/>y
22749 X<nowiki/>RFC 123<nowiki/>y
22750 !! end
22751
22752 !! test
22753 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
22754 !! html/parsoid
22755 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
22756 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
22757 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
22758 </p>
22759 !! wikitext
22760 RFC 123?foo
22761 RFC 123&foo
22762 -RFC 123-
22763 !! html/php
22764 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
22765 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
22766 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
22767 </p>
22768 !! end
22769
22770 !! test
22771 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
22772 !! html/parsoid
22773 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
22774 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
22775 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
22776 !! wikitext
22777 PMID 123<nowiki/>4
22778 PMID 123<nowiki/>y
22779 X<nowiki/>PMID 123<nowiki/>y
22780 !! end
22781
22782 !! test
22783 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
22784 !! html/parsoid
22785 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
22786 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
22787 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
22788 </p>
22789 !! wikitext
22790 PMID 123?foo
22791 PMID 123&foo
22792 -PMID 123-
22793 !! html/php
22794 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
22795 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
22796 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
22797 </p>
22798 !! end
22799
22800 !! test
22801 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
22802 !! html/parsoid
22803 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
22804 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
22805 a<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
22806 </p>
22807 !! wikitext
22808 ISBN 1234567890<nowiki/>1
22809 ISBN 1234567890<nowiki/>x
22810 a<nowiki/>ISBN 1234567890<nowiki/>b
22811 !! end
22812
22813 !! test
22814 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
22815 !! html/parsoid
22816 <p>-<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
22817 !! wikitext
22818 -ISBN 1234567890's
22819 !! html/php
22820 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
22821 </p>
22822 !! end
22823
22824 !! test
22825 Links 14. Protect link-like plain text. (Parsoid bug T78425)
22826 !! options
22827 parsoid=html2wt
22828 !! html/*
22829 <p>this is not a link: http://example.com
22830 </p>
22831 !! wikitext
22832 <nowiki>this is not a link: http://example.com</nowiki>
22833 !! end
22834
22835 !! test
22836 Links 15. Link trails can't become link prefixes.
22837 !! options
22838 language=is
22839 !! wikitext
22840 [[Söfnuður]]-[[00]]
22841 !! html/php
22842 <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>
22843 </p>
22844 !! html/parsoid
22845 <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>
22846 !! end
22847
22848 #### --------------- Quotes ---------------
22849 #### 1. Quotes inside <b> and <i>
22850 #### 2. Link fragments separated by <i> and <b> tags
22851 #### 3. Link fragments inside <i> and <b>
22852 #### 4. No escaping needed
22853 #### --------------------------------------
22854 !! test
22855 1a. Quotes inside <b> and <i>
22856 !! options
22857 parsoid=html2wt,wt2wt
22858 !! wikitext
22859 ''<nowiki/>'foo'''
22860 ''<nowiki>''foo''</nowiki>''
22861 ''<nowiki>'''foo'''</nowiki>''
22862 ''foo''<nowiki/>'s
22863 '''<nowiki/>'foo''''
22864 '''<nowiki>''foo''</nowiki>'''
22865 '''<nowiki>'''foo'''</nowiki>'''
22866 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
22867 '''foo'''<nowiki/>'s
22868 '''foo''
22869 ''foo''<nowiki/>'
22870 ''foo'''<nowiki/>'
22871 '''foo''<nowiki/>'
22872 ''''foo'''
22873 '''foo'''<nowiki/>'
22874 ''''foo'''<nowiki/>'
22875 ''fools'<span> errand</span>''
22876 ''<span>fool</span>'s errand''
22877 '<nowiki/>''foo'' bar '''baz''
22878 a|!*#-:;+-~[]{}b'''x''
22879 !! html/*
22880 <p><i>'foo'</i>
22881 <i>''foo''</i>
22882 <i>'''foo'''</i>
22883 <i>foo</i>'s
22884 <b>'foo'</b>
22885 <b>''foo''</b>
22886 <b>'''foo'''</b>
22887 <b>foo'<i>bar'</i>baz</b>
22888 <b>foo</b>'s
22889 '<i>foo</i>
22890 <i>foo</i>'
22891 <i>foo'</i>'
22892 '<i>foo</i>'
22893 '<b>foo</b>
22894 <b>foo</b>'
22895 '<b>foo</b>'
22896 <i>fools'<span> errand</span></i>
22897 <i><span>fool</span>'s errand</i>
22898 '<i>foo</i> bar '<i>baz</i>
22899 a|!*#-:;+-~[]{}b'<i>x</i>
22900 </p>
22901 !! end
22902
22903 !! test
22904 1b. Quotes inside <b> and <i> with other tags on same line
22905 !! options
22906 parsoid=html2wt,wt2wt
22907 !! wikitext
22908 '''a'' foo ''[[bar]]''
22909 ''a''' foo ''[[bar]]''
22910 ''a''' foo '''{{echo|[[bar]]}}'''
22911 [[foo]] x'''[[bar]]''
22912 '''foo'' <ref>test</ref>
22913 '''foo'' <div title="name">test</div>
22914 '''foo'' and <br> bar
22915 <references />
22916 !! html
22917 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
22918 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
22919 <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>
22920 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
22921 '<i>foo</i> <span class="mw-ref" 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"><span class="mw-reflink-text">[1]</span></a></span>
22922 '<i>foo</i> <div title="name">test</div>
22923 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
22924 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22925 <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>
22926 </ol>
22927 !! end
22928
22929 !! test
22930 2. Link fragments separated by <i> and <b> tags
22931 !! wikitext
22932 [[''foo''<nowiki>hello]]</nowiki>
22933
22934 [['''foo'''<nowiki>hello]]</nowiki>
22935 !! html
22936 <p>[[<i>foo</i>hello]]
22937 </p><p>[[<b>foo</b>hello]]
22938 </p>
22939 !! end
22940
22941 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
22942 # this is one of the shortcomings of this format
22943 !! test
22944 3. Link fragments inside <i> and <b>
22945 !! wikitext
22946 ''[[foo''<nowiki>]]</nowiki>
22947
22948 '''[[foo'''<nowiki>]]</nowiki>
22949 !! html
22950 <p><i>[[foo</i>]]
22951 </p><p><b>[[foo</b>]]
22952 </p>
22953 !! end
22954
22955 !! test
22956 4. No escaping needed
22957 !! wikitext
22958 '<span>''bar''</span>'
22959 '<span>'''bar'''</span>'
22960 'a:b'foo
22961 !! html
22962 <p>'<span><i>bar</i></span>'
22963 '<span><b>bar</b></span>'
22964 'a:b'foo
22965 </p>
22966 !! end
22967
22968 #### ----------- Paragraphs ---------------
22969 #### 1. No unnecessary escapes
22970 #### --------------------------------------
22971
22972 !! test
22973 1. No unnecessary escapes
22974 !! wikitext
22975 bar <span><nowiki>[[foo]]</nowiki></span>
22976
22977 =bar <span><nowiki>[[foo]]</nowiki></span>
22978
22979 [[bar <span><nowiki>[[foo]]</nowiki></span>
22980
22981 ]]bar <span><nowiki>[[foo]]</nowiki></span>
22982
22983 =bar <span>foo]]</span><nowiki>=</nowiki>
22984 !! html
22985 <p>bar <span>[[foo]]</span>
22986 </p><p>=bar <span>[[foo]]</span>
22987 </p><p>[[bar <span>[[foo]]</span>
22988 </p><p>]]bar <span>[[foo]]</span>
22989 </p><p>=bar <span>foo]]</span>=
22990 </p>
22991 !!end
22992
22993 #### ----------------------- PRE --------------------------
22994 #### 1. Leading whitespace in SOL context should be escaped
22995 #### ------------------------------------------------------
22996 !! test
22997 1. Leading whitespace in SOL context should be escaped
22998 !! options
22999 parsoid
23000 !! wikitext
23001 <nowiki> </nowiki>a
23002
23003 <nowiki> </nowiki> a
23004
23005 <nowiki> </nowiki>a(tab)
23006
23007 <nowiki> </nowiki> a
23008 <!--cmt-->
23009 <nowiki> </nowiki> a
23010
23011 a
23012 <nowiki> </nowiki>b
23013
23014 a
23015 <nowiki> </nowiki>b
23016
23017 a
23018 <nowiki> </nowiki> b
23019 !! html
23020 <p> a</p>
23021 <p> a</p>
23022 <p> a(tab)</p>
23023 <p> a</p>
23024 <p><!--cmt--> a</p>
23025 <p>a
23026 b</p>
23027 <p>a
23028 b</p>
23029 <p>a
23030 b</p>
23031 !! end
23032
23033 !! test
23034 2. Leading whitespace in non-indent-pre contexts should not be escaped
23035 !! options
23036 parsoid
23037 !! wikitext
23038 foo <ref>''a''
23039 b</ref>
23040 <references />
23041 !! html
23042 <p>foo <span about="#mwt2" class="mw-ref" 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"><span class="mw-reflink-text">[1]</span></a></span></p>
23043 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23044 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><i data-parsoid='{"dsr":[9,14,2,2]}'>a</i>
23045 b</span></li>
23046 </ol>
23047 !! end
23048
23049 !! test
23050 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
23051 !! options
23052 parsoid
23053 !! wikitext
23054 <blockquote>
23055 a
23056 <span>b</span>
23057 c
23058 </blockquote>
23059 !! html
23060 <blockquote>
23061 <p>
23062 a
23063 <span>b</span>
23064 c</p>
23065 </blockquote>
23066 !! end
23067
23068 !! test
23069 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
23070 !! options
23071 parsoid
23072 !! wikitext
23073 [[File:Foobar.jpg|thumb|caption]]
23074 !! html/parsoid
23075 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
23076 !! end
23077
23078 !! test
23079 5. Nowiki escaping should account for indent-pres
23080 !! options
23081 parsoid=html2wt
23082 !! html/parsoid
23083 <pre>==foo==</pre>
23084 !! wikitext
23085 ==foo==
23086 !! end
23087
23088 !!test
23089 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
23090 !! options
23091 parsoid
23092 !! wikitext
23093 * foo
23094 * bar
23095 !! html
23096 <pre>
23097 * foo
23098 * bar
23099 </pre>
23100 !! end
23101
23102 #### --------------- Behavior Switches --------------------
23103
23104 !! test
23105 1. Valid behavior switches should be escaped
23106 !! options
23107 parsoid=html2wt
23108 !! html/parsoid
23109 __TOC__
23110 <i>__TOC__</i>
23111 !! wikitext
23112 <nowiki>__TOC__</nowiki>
23113 ''<nowiki>__TOC__</nowiki>''
23114 !! end
23115
23116 !! test
23117 2. Invalid behavior switches should not be escaped
23118 !! options
23119 parsoid=html2wt
23120 !! html/parsoid
23121 __TOO__
23122 __|__
23123 !! wikitext
23124 __TOO__
23125 __|__
23126 !! end
23127
23128 # We use indent-pre as an indirect way to test for sol-transparent behavior.
23129 !! test
23130 Behavior switches should be SOL-transparent
23131 !! wikitext
23132 __TOC__
23133
23134 <!-- this one's bogus -->
23135 __TOO__
23136
23137 __TOC__ foo
23138
23139 __TOC__ bar
23140 !! html/parsoid
23141 <meta property="mw:PageProp/toc" />
23142
23143 <!-- this one's bogus -->
23144 <pre>__TOO__</pre>
23145
23146 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
23147
23148 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
23149 !! end
23150
23151 #### --------------- HTML tags ---------------
23152 #### 1. a tags
23153 #### 2. other tags
23154 #### 3. multi-line html tag
23155 #### 4. extension tags
23156 #### -----------------------------------------
23157 !! test
23158 1. a tags
23159 !! options
23160 parsoid
23161 !! wikitext
23162 <a href="http://google.com">google</a>
23163 !! html
23164 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
23165 !! end
23166
23167 !! test
23168 2. other tags
23169 !! wikitext
23170 * <nowiki><div>foo</div></nowiki>
23171 * <nowiki><div style="color:red">foo</div></nowiki>
23172 * <nowiki><td></nowiki>
23173 !! html
23174 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
23175 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
23176 <li> &lt;td&gt;</li></ul>
23177
23178 !! end
23179
23180 !! test
23181 3. multi-line html tag
23182 !! wikitext
23183 <nowiki><div
23184 >foo</div
23185 ></nowiki>
23186 !! html
23187 <p>&lt;div
23188 &gt;foo&lt;/div
23189 &gt;
23190 </p>
23191 !! end
23192
23193 !! test
23194 4. extension tags
23195 !! wikitext
23196 <nowiki><ref>foo</ref></nowiki>
23197
23198 <nowiki><ref>bar</nowiki>
23199
23200 baz<nowiki></ref></nowiki>
23201 !! html
23202 <p>&lt;ref&gt;foo&lt;/ref&gt;
23203 </p><p>&lt;ref&gt;bar
23204 </p><p>baz&lt;/ref&gt;
23205 </p>
23206 !! end
23207
23208 #### --------------- Others ---------------
23209 !! test
23210 Escaping nowikis
23211 !! wikitext
23212 &lt;nowiki&gt;foo&lt;/nowiki&gt;
23213 !! html
23214 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
23215 </p>
23216 !! end
23217
23218 ## The quote-char in the input is necessary for triggering the bug
23219 !! test
23220 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
23221 !! options
23222 parsoid=wt2wt,html2wt
23223 !! wikitext
23224 foo's bar :
23225 !! html
23226 <p>foo's bar :</p>
23227 !! end
23228
23229 !! test
23230
23231 Tag-like HTML structures are passed through as text
23232 !! wikitext
23233 <x y>
23234
23235 <x.y>
23236
23237 <x-y>
23238
23239 1>2
23240
23241 x<y
23242
23243 a>b
23244
23245 1<d e>f
23246 !! html
23247 <p>&lt;x y&gt;
23248 </p><p>&lt;x.y&gt;
23249 </p><p>&lt;x-y&gt;
23250 </p><p>1&gt;2
23251 </p><p>x&lt;y
23252 </p><p>a&gt;b
23253 </p><p>1&lt;d e&gt;f
23254 </p>
23255 !! end
23256
23257 !! test
23258 HTML tag with necessary entities in attributes
23259 !! wikitext
23260 <span title="&amp;amp;">foo</span>
23261 !! html
23262 <p><span title="&amp;amp;">foo</span>
23263 </p>
23264 !! end
23265
23266 !! test
23267 HTML tag with 'unnecessary' entity encoding in attributes
23268 !! wikitext
23269 <span title="&amp;">foo</span>
23270 !! html
23271 <p><span title="&amp;">foo</span>
23272 </p>
23273 !! end
23274
23275 !! test
23276 HTML tag with broken attribute value quoting
23277 !! wikitext
23278 <span title="Hello world>Foo</span>
23279 !! html/php
23280 <p><span>Foo</span>
23281 </p>
23282 !! html/parsoid
23283 <p><span title="Hello world">Foo</span>
23284 </p>
23285 !! end
23286
23287 !! test
23288 Parsoid-only: HTML tag with broken attribute value quoting
23289 !! options
23290 parsoid
23291 !! wikitext
23292 <span title="Hello world>Foo</span>
23293 !! html
23294 <p><span title="Hello world">Foo</span>
23295 </p>
23296 !! end
23297
23298 !! test
23299 Table with broken attribute value quoting
23300 !! wikitext
23301 {|
23302 | title="Hello world|Foo
23303 |}
23304 !! html/php
23305 <table>
23306 <tr>
23307 <td>Foo
23308 </td></tr></table>
23309
23310 !! html/parsoid
23311 <table>
23312 <tr>
23313 <td title="Hello world">Foo
23314 </td></tr></table>
23315
23316 !! end
23317
23318 !! test
23319 Table with broken attribute value quoting on consecutive lines
23320 !! wikitext
23321 {|
23322 | title="Hello world|Foo
23323 | style="color:red|Bar
23324 |}
23325 !! html/php
23326 <table>
23327 <tr>
23328 <td>Foo
23329 </td>
23330 <td>Bar
23331 </td></tr></table>
23332
23333 !! html/parsoid
23334 <table><tbody>
23335 <tr>
23336 <td title="Hello world">Foo
23337 </td><td style="color: red">Bar
23338 </td></tr></tbody></table>
23339
23340 !! end
23341
23342 !! test
23343 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23344 !! options
23345 parsoid
23346 !! wikitext
23347 {{}}
23348 !! html
23349 {{}}
23350 !! end
23351
23352 !! test
23353 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23354 !! options
23355 parsoid
23356 !! wikitext
23357 }}{{
23358 !! html
23359 }}{{
23360 !! end
23361
23362 !!test
23363 Accept empty td cell attribute
23364 !! wikitext
23365 {|
23366 | align="center" | foo || |
23367 |}
23368 !! html
23369 <table>
23370 <tr>
23371 <td align="center"> foo </td>
23372 <td>
23373 </td></tr></table>
23374
23375 !!end
23376
23377 !!test
23378 Non-empty attributes in th-cells
23379 !! wikitext
23380 {|
23381 ! Foo !! style="color: red" | Bar
23382 |}
23383 !! html
23384 <table>
23385 <tr>
23386 <th> Foo </th>
23387 <th style="color: red"> Bar
23388 </th></tr></table>
23389
23390 !!end
23391
23392 !!test
23393 Accept empty attributes in th-cells
23394 !! wikitext
23395 {|
23396 !| foo !!| bar
23397 |}
23398 !! html
23399 <table>
23400 <tr>
23401 <th> foo </th>
23402 <th> bar
23403 </th></tr></table>
23404
23405 !!end
23406
23407 !!test
23408 Empty table rows go away
23409 !! wikitext
23410 {|
23411 | Hello
23412 | there
23413 |- class="foo"
23414 |-
23415 |}
23416 !! html
23417 <table>
23418 <tr>
23419 <td> Hello
23420 </td>
23421 <td> there
23422 </td></tr>
23423
23424 </table>
23425
23426 !! end
23427
23428 ###
23429 ### Parsoid-centric tests for testing RTing of inter-element separators
23430 ### Edge cases not tested by existing parser tests and specific to
23431 ### Parsoid-specific serialization strategies.
23432 ###
23433
23434 !!test
23435 RT-ed inter-element separators should be valid separators
23436 !! wikitext
23437 {|
23438 |- [[foo]]
23439 |}
23440 !! html
23441 <table>
23442
23443 </table>
23444
23445 !!end
23446
23447 # Parsoid-only since PHP parser relies on Tidy for correct output
23448 !!test
23449 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
23450 !!options
23451 parsoid
23452 !! wikitext
23453 {|
23454 |<small>foo
23455 bar
23456 |}
23457
23458 {|
23459 |<small>foo<small>
23460 |}
23461 !! html
23462 <table>
23463 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
23464 <p>bar</p></small></td></tr>
23465 </tbody></table>
23466
23467 <table>
23468 <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>
23469 </tbody></table>
23470 !!end
23471
23472 # Note that the "style" attribute is really a template parameter here.
23473 # The = would have to be {{=}} if you wanted the literal.
23474 !!test
23475 Empty TD followed by TD with tpl-generated attribute
23476 !! wikitext
23477 {|
23478 |-
23479 |
23480 |{{echo|style='color:red'}}|foo
23481 |}
23482 !! html
23483 <table>
23484
23485 <tr>
23486 <td>
23487 </td>
23488 <td>foo
23489 </td></tr></table>
23490
23491 !!end
23492
23493 !!test
23494 Indented table with an empty td
23495 !! wikitext
23496 {|
23497 |-
23498 |
23499 |foo
23500 |}
23501 !! html
23502 <table>
23503
23504 <tr>
23505 <td>
23506 </td>
23507 <td>foo
23508 </td></tr></table>
23509
23510 !!end
23511
23512 ## We have some newline diffs RT-ing this edge case
23513 ## and it is not important enough -- we seem to be emitting
23514 ## at most 2 newlines after a </tr> and this is unrelated to
23515 ## the issue from T85627 that this is testing.
23516 !!test
23517 Indented table with blank lines in between (T85627)
23518 !! options
23519 parsoid=wt2html
23520 !! wikitext
23521 {|
23522 |foo
23523
23524
23525 |}
23526 !! html
23527 <table>
23528
23529 <tr>
23530 <td>foo
23531 </td></tr></table>
23532
23533 !!end
23534
23535 !!test
23536 Indented block & table
23537 !! wikitext
23538 <div>foo</div>
23539 {|
23540 |foo
23541 |}
23542 !! html/php
23543 <div>foo</div>
23544 <table>
23545 <tr>
23546 <td>foo
23547 </td></tr></table>
23548
23549 !! html/parsoid
23550 <div data-parsoid='{"stx":"html"}'>foo</div>
23551 <table><tbody>
23552 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
23553 </tbody></table>
23554 !!end
23555
23556 !! test
23557 Indent and comment before table row
23558 !! wikitext
23559 {|
23560 <!--hi-->|-
23561 | there
23562 |}
23563 !! html/php
23564 <table>
23565
23566 <tr>
23567 <td> there
23568 </td></tr></table>
23569
23570 !! html/parsoid
23571 <table>
23572 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
23573 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
23574 </tbody></table>
23575 !! end
23576
23577 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
23578 !!test
23579 Empty TR followed by a template-generated TR
23580 !!options
23581 parsoid
23582 !! wikitext
23583 {|
23584 |-
23585 {{echo|<tr><td>foo</td></tr>}}
23586 |}
23587 !! html
23588 <table>
23589 <tbody>
23590 <tr></tr>
23591 <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}}]}'>
23592 <td>foo</td></tr>
23593 </tbody></table>
23594 !!end
23595
23596 ## PHP and parsoid output differ for this, and since this is primarily
23597 ## for testing Parsoid's serializer, marking this Parsoid only
23598 !!test
23599 Empty TR followed by mixed-ws-comment line should RT correctly
23600 !!options
23601 parsoid
23602 !! wikitext
23603 {|
23604 |-
23605 <!--c-->
23606 |-
23607 <!--c--> <!--d-->
23608 |}
23609 !! html
23610 <table>
23611 <tbody>
23612 <tr></tr>
23613 <!--c-->
23614 <tr>
23615 <!--c--> </tr><!--d-->
23616 </tbody></table>
23617
23618 !!end
23619
23620 !!test
23621 Multi-line image caption generated by templates with/without trailing newlines
23622 !! wikitext
23623 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
23624 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
23625 !! html/parsoid
23626 <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>
23627 <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>
23628 !!end
23629
23630 !! test
23631 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
23632 !! options
23633 parsoid=html2wt
23634 !! html/parsoid
23635 <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>
23636
23637 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
23638 !! wikitext
23639 <includeonly>foo</includeonly>
23640 new para
23641
23642 [[Category:Foo]]
23643
23644 = new heading =
23645 !! end
23646
23647 ## PHP emits broken html for this, and since this is primarily
23648 ## a Parsoid serializer test, marking this Parsoid only
23649 !!test
23650 Improperly nested inline or quotes tags with whitespace in between
23651 !! wikitext
23652 <span> <s>x</span> </s>
23653 ''' ''x''' ''
23654 !! html/parsoid
23655 <p><span> <s>x</s></span><s> </s>
23656 <b> <i>x</i></b><i> </i>
23657 </p>
23658 !!end
23659
23660 !!test
23661 Encapsulate protected attributes from wt
23662 !! wikitext
23663 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
23664 !! html/parsoid
23665 <body><div data-x-typeof="mw:placeholder stuff" data-x-data-mw="whoo" data-x-data-parsoid="weird" data-x-data-parsoid-other="no" data-x-about="time" data-x-rel="mw:true">foo</div>
23666 </body>
23667 !!end
23668
23669 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
23670 ## Having nested or stray pre tags results in the attempt to add duplicates,
23671 ## causing an assertion fail. This test tries to prevent that situation.
23672 !!test
23673 Ensure ParagraphWrapper can deal with stray closing pre tags
23674 !!options
23675 parsoid=wt2html
23676 !! wikitext
23677 plain text</pre>
23678 !! html/parsoid
23679 plain text
23680 !!end
23681
23682 !!test
23683 1. Ensure fostered text content is wrapped in element nodes
23684 !!options
23685 parsoid=wt2html
23686 !! wikitext
23687 <table>hi</table><table>ho</table>
23688 !! html/parsoid
23689 <p>hi</p>
23690 <table></table>
23691 <p>ho</p>
23692 <table></table>
23693 !!end
23694
23695 !!test
23696 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
23697 !!options
23698 parsoid=wt2html,wt2wt
23699 !! wikitext
23700 <table>
23701 <tr> || ||
23702 <td> a
23703 </table>
23704 !! html/parsoid
23705 <p> || ||
23706 </p><table>
23707 <tbody><tr><td> a</td></tr>
23708 </tbody></table>
23709 !!end
23710
23711 !!test
23712 Encapsulation properly handles null DSR information from foster box
23713 !!options
23714 parsoid=wt2html,wt2wt
23715 !! wikitext
23716 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
23717 !! html/parsoid
23718 <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>
23719 !!end
23720
23721 !!test
23722 1. Encapsulate foster-parented transclusion content
23723 !!options
23724 parsoid=wt2wt,wt2html
23725 !! wikitext
23726 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
23727 !! html/parsoid
23728 <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>
23729 <tbody>
23730 <tr>
23731 <td>bar</td>
23732 </tr>
23733 </tbody>
23734 </table>
23735 !!end
23736
23737 !!test
23738 2. Encapsulate foster-parented transclusion content
23739 !!options
23740 parsoid=wt2wt,wt2html
23741 !! wikitext
23742 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
23743 !! html/parsoid
23744 <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>
23745 <table>
23746 <tbody>
23747 <tr>
23748 <td>bar</td>
23749 </tr>
23750 </tbody>
23751 </table>
23752 !!end
23753
23754 !!test
23755 3. Encapsulate foster-parented transclusion content
23756 !!options
23757 parsoid=wt2wt,wt2html
23758 !! wikitext
23759 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
23760 !! html/parsoid
23761 <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;]}">
23762 <p>foo</p>
23763 </div>
23764 <table>
23765 <tbody>
23766 <tr>
23767 <td>bar</td>
23768 </tr>
23769 </tbody>
23770 </table>
23771 !!end
23772
23773 !!test
23774 4. Encapsulate foster-parented transclusion content
23775 !!options
23776 parsoid=wt2wt,wt2html
23777 !! wikitext
23778 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
23779 !! html/parsoid
23780 <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;]}">
23781 <p>foo</p>
23782 </div>
23783 <table>
23784 <tbody>
23785 <tr>
23786 <td>bar</td>
23787 </tr>
23788 </tbody>
23789 </table>
23790 !!end
23791
23792 !!test
23793 5. Encapsulate foster-parented transclusion content
23794 !!options
23795 parsoid=wt2wt,wt2html
23796 !! wikitext
23797 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
23798 !! html/parsoid
23799 <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>
23800 <table>
23801 <tbody>
23802 <tr>
23803 <td>
23804 <div>
23805 <p>foo</p>
23806 </div>
23807 </td>
23808 </tr>
23809 </tbody>
23810 </table>
23811 !!end
23812
23813 !!test
23814 6. Encapsulate foster-parented transclusion content
23815 !!options
23816 parsoid=wt2wt,wt2html
23817 !! wikitext
23818 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
23819 !! html/parsoid
23820 <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>
23821 <table>
23822 <tbody>
23823 <tr>
23824 <td>
23825 <div>
23826 <p>foo</p>
23827 </div>
23828 </td>
23829 </tr>
23830 </tbody>
23831 </table>
23832 <p>ok</p>
23833 !!end
23834
23835 !!test
23836 7. Encapsulate foster-parented transclusion content
23837 !!options
23838 parsoid=wt2wt,wt2html
23839 !! wikitext
23840 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
23841 !! html/parsoid
23842 <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>
23843 <table>
23844 <tbody>
23845 <tr>
23846 <td>bar</td>
23847 </tr>
23848 </tbody>
23849 </table>
23850 !!end
23851
23852 # Note that the wt is broken on purpose: the = should be {{=}} if you
23853 # don't want it to be a template parameter key.
23854 !!test
23855 8. Encapsulate foster-parented transclusion content
23856 !!options
23857 parsoid=wt2wt,wt2html
23858 !! wikitext
23859 {{echo|a
23860 }}{|{{echo|style='color:red'}}
23861 |-
23862 |b
23863 |}
23864 !! html/parsoid
23865 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
23866 <span> </span>
23867 <p typeof="mw:Transclusion" data-mw='{"parts":["{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"style":{"wt":"&#39;color:red&#39;"}},"i":0}},"\n|-\n|b\n|}"]}'>{{{1}}}</p>
23868 <table>
23869 <tbody>
23870 <tr>
23871 <td>b</td>
23872 </tr>
23873 </tbody>
23874 </table>
23875 !!end
23876
23877 !!test
23878 9. Encapsulate foster-parented transclusion content
23879 !!options
23880 parsoid=wt2wt,wt2html
23881 !! wikitext
23882 <table>{{echo|hi</table>hello}}
23883 !! html/parsoid
23884 <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>
23885 !!end
23886
23887 !!test
23888 Table in fosterable position
23889 !!options
23890 parsoid=wt2html,wt2wt
23891 !! wikitext
23892 {{OpenTable}}
23893 <div>
23894 {|
23895 |}
23896 </div>
23897 |}
23898 !! html/parsoid
23899 <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">
23900 </span>
23901 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
23902
23903 <table>
23904 </table>
23905 !!end
23906
23907 # Parsoid only for bug 64747
23908 !! test
23909 Properly encapsulate empty-content transclusions in fosterable positions
23910 !! wikitext
23911 <table>
23912 {{#if:|
23913 <td>foo</td>
23914 }}
23915 </table>
23916 !! html/parsoid
23917 <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":["","","",""]}]]}'>
23918
23919 </table>
23920 !! end
23921
23922 !!test
23923 Support <object> element with .data attribute
23924 !!options
23925 parsoid=html2wt
23926 !! html/parsoid
23927 <object data="test.swf"></object>
23928 !! wikitext
23929 <object data="test.swf"></object>
23930 !!end
23931
23932 !! test
23933 Don't block XML namespace declaration
23934 !! wikitext
23935 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
23936 !! html/php
23937 <p><span>MediaWiki</span>
23938 </p>
23939 !! html/parsoid
23940 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
23941 !! end
23942
23943 # -----------------------------------------------------------------
23944 # The following section of tests are primarily to spec requirements
23945 # around serialization of new/edited content.
23946 #
23947 # All these tests are marked Parsoid html2wt and html2html only
23948 # ----------------------------------------------------------------
23949
23950 # 'mi' is a localinterwiki prefix as well as a language
23951 !! test
23952 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
23953 !! options
23954 parsoid=html2wt
23955 !! html/parsoid
23956 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
23957 !! wikitext
23958 [[Foo]]
23959 !! end
23960
23961 # See T93839
23962 !! test
23963 New wikilinks should be serialized properly
23964 !! options
23965 parsoid=html2wt
23966 !! html/parsoid
23967 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
23968 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
23969 !! wikitext
23970 [[Foo]]
23971 [[Foo]]
23972 !! end
23973
23974 !! test
23975 New wiki links (href variations)
23976 !! options
23977 parsoid=html2wt
23978 !! html/parsoid
23979 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
23980 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
23981 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
23982 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
23983 !! wikitext
23984 [[Foo_bar]]
23985 [[Foo_bar]]
23986 [[Foo_bar]]
23987 [[Toxine bactérienne]]
23988 !! end
23989
23990 !! test
23991 New wiki links (content string variations)
23992 !! options
23993 parsoid=html2wt
23994 !! html/parsoid
23995 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
23996 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
23997 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
23998 !! wikitext
23999 [[Foo_bar]]
24000 [[Foo bar]]
24001 [[Foo_bar|./Foo_bar]]
24002 !! end
24003
24004 !! test
24005 New category links (href variations)
24006 !! options
24007 parsoid=html2wt
24008 !! html/parsoid
24009 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
24010 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
24011 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
24012 !! wikitext
24013 [[Category:Toxine bactérienne]]
24014 [[Category:Toxine bactérienne]]
24015 [[Category:Toxine bactérienne]]
24016 !! end
24017
24018 !! test
24019 New sol transparent links don't need indent-pre nowiki protection
24020 !! options
24021 parsoid=html2wt
24022 language=de
24023 !! html/parsoid
24024 <link rel="mw:PageProp/redirect" href="./Main_Page">
24025 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
24026 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
24027 !! wikitext
24028 #WEITERLEITUNG [[Main Page]]
24029 <!-- this is good --> [[Category:Good]]
24030 <!-- this is great --> [[Kategorie:Great]]
24031 !! end
24032
24033 !! test
24034 New interlanguage links (href variations)
24035 !! options
24036 parsoid=html2wt
24037 !! html/parsoid
24038 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
24039 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
24040 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
24041 !! wikitext
24042 [[es:Toxine bactérienne]]
24043 [[es:Toxine_bactérienne]]
24044 [[es:Toxine_bactérienne]]
24045 !! end
24046
24047 !! test
24048 Image: Modifying size of an image (1)
24049 !! options
24050 parsoid={
24051 "modes": ["wt2wt"],
24052 "changes": [
24053 ["img[height]", "attr", "height", "22"],
24054 ["img[width]", "attr", "width", "200"]
24055 ]
24056 }
24057 !! wikitext
24058 [[Image:Foobar.jpg|230x230px]]
24059 !! wikitext/edited
24060 [[Image:Foobar.jpg|200x200px]]
24061 !!end
24062
24063 !! test
24064 Image: Modifying size of an image (2)
24065 !! options
24066 parsoid={
24067 "modes": ["wt2wt"],
24068 "changes": [
24069 ["img[height]", "attr", "height", "100"],
24070 ["img[width]", "attr", "width", "500"]
24071 ]
24072 }
24073 !! wikitext
24074 [[Image:Foobar.jpg|230x230px]]
24075 !! wikitext/edited
24076 [[Image:Foobar.jpg|500x500px]]
24077 !!end
24078
24079 # Change in size is ignored so long as class='mw-default-size'
24080 !! test
24081 Image: Modifying size of an image (3)
24082 !! options
24083 parsoid={
24084 "modes": ["wt2wt"],
24085 "changes": [
24086 ["figure[class]", "removeClass", "mw-default-size"],
24087 ["figure img", "attr", "height", "19"],
24088 ["figure img", "attr", "width", "170"]
24089 ]
24090 }
24091 !! wikitext
24092 [[Image:Foobar.jpg|thumb]]
24093 !! wikitext/edited
24094 [[Image:Foobar.jpg|thumb|170x170px]]
24095 !!end
24096
24097 !! test
24098 Image: Modifying alignment of an image (bug 48665)
24099 !! options
24100 parsoid={
24101 "modes": ["wt2wt"],
24102 "changes": [
24103 ["figure[class]", "removeClass", "mw-halign-right"],
24104 ["figure[class]", "addClass", "mw-halign-left"]
24105 ]
24106 }
24107 !! wikitext
24108 [[Image:Foobar.jpg|thumb|caption|right]]
24109 !! wikitext/edited
24110 [[Image:Foobar.jpg|thumb|caption|left]]
24111 !! end
24112
24113 !! test
24114 Image: Modifying mw-default-size of an frameless image (bug 62805)
24115 !! options
24116 parsoid={
24117 "modes": ["wt2wt"],
24118 "changes": [
24119 ["figure.mw-default-size", "removeClass", "mw-default-size"]
24120 ]
24121 }
24122 !! wikitext
24123 [[Image:Foobar.jpg|frameless|right]]
24124 !! wikitext/edited
24125 [[Image:Foobar.jpg|frameless|right|220x220px]]
24126 !! end
24127
24128 !! test
24129 Image: Modifying valign of an image (bug 49221)
24130 !! options
24131 parsoid={
24132 "modes": ["wt2wt"],
24133 "changes": [
24134 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
24135 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
24136 ]
24137 }
24138 !! wikitext
24139 [[File:Foobar.jpg|20px|middle]]
24140 !! wikitext/edited
24141 [[File:Foobar.jpg|20px|text-top]]
24142 !! end
24143
24144 !! test
24145 Image: Modifying alt attribute of an image (bug 56400)
24146 !! options
24147 parsoid={
24148 "modes": ["wt2wt"],
24149 "changes": [
24150 ["img[alt]", "attr", "alt", "some alternate edited text"]
24151 ]
24152 }
24153 !! wikitext
24154 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
24155 !! wikitext/edited
24156 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
24157 !!end
24158
24159 !! test
24160 Image: Modifying caption of an image
24161 !! options
24162 parsoid={
24163 "modes": ["wt2wt"],
24164 "changes": [
24165 ["figcaption", "text", "new caption"]
24166 ]
24167 }
24168 !! wikitext
24169 [[Image:Foobar.jpg|thumb|original caption]]
24170 !! wikitext/edited
24171 [[Image:Foobar.jpg|thumb|new caption]]
24172 !!end
24173
24174 !! test
24175 Image: empty alt attribute (bug 48924)
24176 !! options
24177 parsoid
24178 !! wikitext
24179 [[File:Foobar.jpg|thumb|alt=|bar]]
24180 !! html
24181 <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>
24182 !! end
24183
24184 !! test
24185 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
24186 !! options
24187 parsoid=html2wt
24188 language=ar
24189 disabled
24190 !! html/parsoid
24191 <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>
24192 !! wikitext
24193 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
24194 !! end
24195
24196 !! test
24197 Image: Block level image should have \n before and after
24198 !! wikitext
24199 123
24200 [[File:Foobar.jpg|right|thumb|150x150px]]
24201 456
24202 !! html/parsoid
24203 <p>123</p>
24204 <figure class="mw-halign-right" typeof="mw:Image/Thumb"><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"/></a></figure>
24205 <p>456</p>
24206 !!end
24207
24208 !! test
24209 Image: New block level image should have \n before and after (existing content)
24210 !! wikitext
24211 123
24212 [[File:Foobar.jpg|right|thumb|150x150px]]
24213 456
24214 !! html/parsoid
24215 <p>123</p>
24216 <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>
24217 <p>456</p>
24218 !!end
24219
24220 !! test
24221 Image: upright option (parsoid)
24222 !! wikitext
24223 [[File:Foobar.jpg|thumb|upright|caption]]
24224 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
24225 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
24226 !! html/parsoid
24227 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/170px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="19" width="170"/></a><figcaption>caption</figcaption></figure>
24228 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/110px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="12" width="110"/></a><figcaption>caption</figcaption></figure>
24229 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/500px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="57" width="500"/></a><figcaption>caption</figcaption></figure>
24230 !!end
24231
24232 !! test
24233 Image: upright option is ignored on inline and frame images (parsoid)
24234 !! wikitext
24235 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
24236 !! html/parsoid
24237 <p><span typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/500px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="57" width="500"/></a></span></p>
24238 !!end
24239
24240 !! test
24241 Image: from basic HTML (1)
24242 !! options
24243 parsoid=html2wt
24244 !! html/parsoid
24245 <span typeof="mw:Image">
24246 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24247 </span>
24248 !! wikitext
24249 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24250 !! end
24251
24252 !! test
24253 Image: from basic HTML (2)
24254 !! options
24255 parsoid=html2wt
24256 !! html/parsoid
24257 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24258 !! wikitext
24259 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24260 !! end
24261
24262 !! test
24263 Image: from basic HTML (3)
24264 !! options
24265 parsoid=html2wt
24266 !! html/parsoid
24267 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
24268 !! wikitext
24269 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
24270 !! end
24271
24272 !! test
24273 Image: from basic HTML (4)
24274 !! options
24275 parsoid=html2wt
24276 !! html/parsoid
24277 <img src="./File:Foobar.jpg">
24278 !! wikitext
24279 [[File:Foobar.jpg|link=]]
24280 !! end
24281
24282 !! test
24283 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
24284 !! options
24285 parsoid=html2wt
24286 !! html/parsoid
24287 <ul>
24288 <li><p>foo</p></li>
24289 </ul>
24290 !! wikitext
24291 * foo
24292 !! end
24293
24294 !! test
24295 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
24296 !! options
24297 parsoid=html2wt
24298 !! html/parsoid
24299 <ul> <li>foo</li></ul>
24300 !! wikitext
24301 * foo
24302 !! end
24303
24304 !! test
24305 Don't strip leading whitespace when handling indent-pre suppressing tags
24306 !! options
24307 parsoid=html2wt
24308 !! html/parsoid
24309 <table>
24310 <tr><td> indented row</td></tr>
24311 </table>
24312 <blockquote><p>
24313 <b>This is very bold of you!</b>
24314 </p>
24315 <table><tr><td>
24316 indented cell (no pre-wrapping!)
24317 </td></tr></table>
24318 </blockquote>
24319 <p>foo</p>
24320 <div>bar</div>
24321 !! wikitext
24322 {|
24323 | indented row
24324 |}
24325 <blockquote>
24326 '''This is very bold of you!'''
24327
24328 {|
24329 |
24330 indented cell (no pre-wrapping!)
24331 |}
24332 </blockquote>
24333 foo
24334 <div>bar</div>
24335 !! end
24336
24337 !! test
24338 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
24339 !! options
24340 parsoid=html2wt
24341 !! html/parsoid
24342 <p>foo</p>
24343 <span>bar</span>
24344
24345 <span>foo2
24346 </span>bar2
24347
24348 <div>foo</div>
24349 <span>bar</span>
24350
24351 <div>
24352 <span>foo</span>
24353 </div>
24354 !! wikitext
24355 foo
24356 <nowiki> </nowiki><span>bar</span>
24357
24358 <span>foo2
24359 <nowiki> </nowiki></span>bar2
24360
24361 <div>foo</div>
24362 <nowiki> </nowiki><span>bar</span>
24363
24364 <div>
24365 <nowiki> </nowiki><span>foo</span>
24366 </div>
24367 !! end
24368
24369 !! test
24370 Lists: Dont insert newlines in a serialized list item.
24371 !! options
24372 parsoid=html2wt
24373 !! html/parsoid
24374 <ul><li>a<br>b</li><li>c</li></ul>
24375 !! wikitext
24376 * a<br>b
24377 * c
24378 !! end
24379
24380 !! test
24381 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
24382 !! options
24383 parsoid={
24384 "modes": ["html2wt"],
24385 "scrubWikitext": false
24386 }
24387 !! html/parsoid
24388 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
24389 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
24390
24391 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
24392 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
24393
24394 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
24395
24396 <h2><meta property="mw:PageProp/toc" /> ok</h2>
24397 !! wikitext
24398 == hello there [[Category:A1]] ==
24399
24400 == [[Category:A2]] hi pal ==
24401
24402 == <!--foo--> [[Category:A3]] how goes it ==
24403
24404 == it goes well [[Category:A4]] <!--bar--> ==
24405
24406 ==howdy [[Category:A5]] ==
24407
24408 == __TOC__ ok ==
24409 !! end
24410
24411 !! test
24412 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
24413 !! options
24414 parsoid={
24415 "modes": ["html2wt"],
24416 "scrubWikitext": true
24417 }
24418 !! html/parsoid
24419 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
24420 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
24421
24422 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
24423 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
24424
24425 <h2><meta property="mw:PageProp/toc" /> ok</h2>
24426 !! wikitext
24427 == hello there ==
24428 [[Category:A1]]
24429 [[Category:A2]]
24430
24431 == hi pal ==
24432
24433 <!--foo--> [[Category:A3]]
24434
24435 == how goes it ==
24436
24437 == it goes well ==
24438 [[Category:A4]] <!--bar-->
24439
24440 __TOC__
24441
24442 == ok ==
24443 !! end
24444
24445 !! test
24446 Headings: Don't hoist metas that come from templates
24447 !! options
24448 parsoid={
24449 "modes": ["html2wt"],
24450 "scrubWikitext": true
24451 }
24452 !! html/parsoid
24453 <h2><span about="#mwt1" typeof="mw:Transclusion" data-parsoid="{}" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo [[Category:Foo]]"}},"i":0}}]}'>foo </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" data-parsoid="{}" /></h2>
24454 !! wikitext
24455 == {{echo|foo [[Category:Foo]]}} ==
24456 !! end
24457
24458 !! test
24459 Headings: Category in ref isn't hoisted
24460 !! options
24461 parsoid={
24462 "modes": ["html2wt"],
24463 "scrubWikitext": true
24464 }
24465 !! html/parsoid
24466 <h2> 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> </h2>
24467
24468 <ol class="references" typeof="mw:Extension/references" about="#mwt3" 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">bar <link rel="mw:PageProp/Category" href="./Category:Baz" /> </span></li></ol>
24469 !! wikitext
24470 == foo <ref>bar
24471 [[Category:Baz]] </ref> ==
24472
24473 <references />
24474 !! end
24475
24476 !! test
24477 Parsoid: Serialize positional parameters with = in them as named parameter
24478 !! options
24479 parsoid=html2wt
24480 !! html/parsoid
24481 <p about="#mwt1" typeof="mw:Transclusion"
24482 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
24483
24484 <p about="#mwt1" typeof="mw:Transclusion"
24485 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
24486
24487 <!--Orig params with data-parsoid has heuristics for handling = chars-->
24488 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
24489 <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>
24490 !! wikitext
24491 {{echo|1 = f=oo}}
24492
24493 {{echo|1 = f=oo|2 = bar}}
24494
24495 <!--Orig params with data-parsoid has heuristics for handling = chars-->
24496 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
24497 {{echo|<nowiki>f=oo</nowiki>|bar}}
24498 !! end
24499
24500 !! test
24501 Parsoid: Serialize positional parameters with = in extlink as named parameter
24502 !! options
24503 parsoid=html2wt
24504 !! html/parsoid
24505 <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>
24506 !! wikitext
24507 {{echo|1 = http://stuff?is=ok}}
24508 !! end
24509
24510 !! test
24511 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
24512 !! options
24513 parsoid=html2wt
24514 !! html/parsoid
24515 <div>a<p>b</p></div>
24516 <div>a
24517 <p>b</p></div>
24518 <div>
24519 a
24520 <p>b</p></div>
24521 !! wikitext
24522 <div>a
24523 b
24524 </div>
24525 <div>a
24526 b
24527 </div>
24528 <div>
24529 a
24530
24531 b
24532 </div>
24533 !! end
24534
24535 !! test
24536 Substrings resembling wikitext in hrefs should not get nowiki escapes
24537 !! options
24538 parsoid=html2wt
24539 !! html/parsoid
24540 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
24541 !! wikitext
24542 [[Foo''bar''baz]]
24543 !! end
24544
24545 !! test
24546 Enforce single-line context in the serializer
24547 !! options
24548 parsoid=html2wt
24549 !! html/parsoid
24550 <h2>testing
24551 123</h2>
24552
24553 <h2> hi <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bogus","href":"./Template:Bogus"},"params":{"1":{"wt":"there\nyou"}},"i":0}}]}'>there</span><span about="#mwt1">
24554 </span><span about="#mwt1">you</span> </h2>
24555
24556 <h2> 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> </h2>
24557
24558 <ol class="references" typeof="mw:Extension/references" about="#mwt3" 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" data-parsoid="{}">hello
24559 there</span></li></ol>
24560
24561 <ul><li>asd
24562 sdf</li></ul>
24563
24564 <ul><li>foo
24565 bar
24566 baz</li>
24567 <li>foo <b>bar</b>
24568 baz</li></ul>
24569
24570 <dl><dt>hi
24571 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
24572 ho</dd></dl>
24573
24574 <dl><dd> <table>
24575 <tbody><tr><td> ha
24576 ha
24577 ha</td></tr>
24578 </tbody></table></dd></dl>
24579 !! wikitext
24580 == testing 123 ==
24581
24582 == hi {{bogus|there
24583 you}} ==
24584
24585 == foo <ref>hello
24586 there</ref> ==
24587
24588 <references />
24589
24590 * asd sdf
24591
24592 * foo bar baz
24593 * foo '''bar''' baz
24594
24595 ; hi ho : hi ho
24596
24597 : {|
24598 | ha
24599 ha
24600 ha
24601 |}
24602 !! end
24603
24604 !! test
24605 Serialize new placeholder space without spans
24606 !! options
24607 parsoid=html2wt
24608 !! html/parsoid
24609 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
24610
24611 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
24612
24613 <span typeof="mw:Extension/ref" data-mw="{&quot;name&quot;:&quot;ref&quot;,&quot;body&quot;:{&quot;html&quot;:&quot;foo<span typeof=\&quot;mw:Placeholder\&quot;>&amp;nbsp;</span>: bar&quot;}}"><sup>[1]</sup></span>ok</p>
24614 !! wikitext
24615 foo : bar
24616
24617 foo : bar
24618
24619 <ref>foo : bar</ref>ok
24620 !! end
24621
24622
24623 #-----------------------
24624 # Tag minimization tests
24625 #-----------------------
24626
24627 !! test
24628 1. I/B quote minimization: wikitext-only tags should be combined
24629 !! options
24630 parsoid=html2wt
24631 !! html/parsoid
24632 <p><i>A</i><i>B</i></p>
24633 <p><b>A</b><b>B</b></p>
24634 <p><i>A</i><b><i>B</i></b></p>
24635 <p><b>A</b><i><b>B</b></i></p>
24636 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
24637 <p><i><b>A</b></i><i><b>B</b></i></p>
24638 <p><i><b>A</b></i><b><i>B</i></b></p>
24639 <p><b><i>A</i></b><i><b>B</b></i></p>
24640 !! wikitext
24641 ''AB''
24642
24643 '''AB'''
24644
24645 ''A'''B'''''
24646
24647 '''A''B'''''
24648
24649 '''A''BC''D'''
24650
24651 '''''AB'''''
24652
24653 '''''AB'''''
24654
24655 '''''AB'''''
24656 !! end
24657
24658 !! test
24659 2. I/B quote minimization: wikitext and html tags should not be combined
24660 !! options
24661 parsoid=html2wt
24662 !! html/parsoid
24663 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
24664 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
24665 !! wikitext
24666 ''A''<i>B</i>
24667
24668 ''A''<nowiki/>'''<i>B</i>'''
24669 !! end
24670
24671 !! test
24672 3. I/B quote minimization: templated content stops minimization
24673 !! options
24674 parsoid=html2wt
24675 !! html/parsoid
24676 <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>
24677 <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>
24678 !! wikitext
24679 ''A''{{echo|''B''}}
24680
24681 ''A''{{echo|'''''B'''''}}
24682 !! end
24683
24684 !! test
24685 4. I/B quote minimization: new content should be mimimized with adjacent old content
24686 !! options
24687 parsoid=html2wt
24688 !! html/parsoid
24689 <p><i>A</i><i>B</i></p>
24690 <p><b>A</b><b>B</b></p>
24691 <p><i>A</i><b><i>B</i></b></p>
24692 !! wikitext
24693 ''AB''
24694
24695 '''AB'''
24696
24697 ''A'''B'''''
24698 !! end
24699
24700 !! test
24701 5a. Merge adjacent quote nodes if they've been edited
24702 !! options
24703 parsoid={
24704 "modes": ["wt2wt", "selser"],
24705 "changes": [
24706 ["p", "contents", "remove", ":contains('b')"]
24707 ]
24708 }
24709 !! wikitext
24710 ''a''b''c''
24711 !! wikitext/edited
24712 ''ac''
24713 !! end
24714
24715 !! test
24716 5b. Merge adjacent quote nodes if they've been edited
24717 !! options
24718 parsoid={
24719 "modes": ["wt2wt", "selser"],
24720 "changes": [
24721 ["#x", "remove"]
24722 ]
24723 }
24724 !! wikitext
24725 ''a''<span id="x">b</span>''c''
24726 !! wikitext/edited
24727 ''ac''
24728 !! end
24729
24730 !! test
24731 1. Merge adjacent link nodes as long as at least one element is new
24732 !! options
24733 parsoid={
24734 "modes": ["html2wt"],
24735 "scrubWikitext": true
24736 }
24737 !! html/parsoid
24738 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
24739 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
24740 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
24741 !! wikitext
24742 [[Football]]
24743 [[Football]]
24744 [[Football|Foot]][[Football|ball]]
24745 !! end
24746
24747 !! test
24748 2. Merge adjacent link nodes and enable additional normalizations
24749 !! options
24750 parsoid={
24751 "modes": ["html2wt"],
24752 "scrubWikitext": true
24753 }
24754 !! html/parsoid
24755 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
24756 !! wikitext
24757 [[Football|''Football'']]
24758 !! end
24759
24760 !! test
24761 3. Don't merge adjacent link nodes if scrubWikitext is false
24762 !! options
24763 parsoid={
24764 "modes": ["html2wt"],
24765 "scrubWikitext": false
24766 }
24767 !! html/parsoid
24768 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
24769 !! wikitext
24770 [[Football|Foot]][[Football|ball]]
24771 !! end
24772
24773 #------------------------------
24774 # End of tag minimization tests
24775 #------------------------------
24776
24777 !!test
24778 Bug 54262: New entities
24779 !! options
24780 parsoid=html2wt
24781 !! html/parsoid
24782 <span typeof="mw:Entity">&nbsp;</span>
24783 !! wikitext
24784 &nbsp;
24785 !! end
24786
24787 ## Note that there is no wikitext output for 'unknownproperty' ##
24788 ## Unknown magic words are silently dropped ##
24789
24790 !! test
24791 Magic words
24792 !! options
24793 parsoid=html2wt
24794 !! html/parsoid
24795 <meta property='mw:PageProp/toc' />
24796 <meta property='mw:PageProp/notoc' />
24797 <meta property='mw:PageProp/forcetoc' />
24798 <meta property='mw:PageProp/index' />
24799 <meta property='mw:PageProp/noindex' />
24800 <meta property='mw:PageProp/nogallery' />
24801 <meta property='mw:PageProp/noeditsection' />
24802 <meta property='mw:PageProp/notitleconvert' />
24803 <meta property='mw:PageProp/nocontentconvert' />
24804 <meta property='mw:PageProp/unknownproperty' />
24805 !! wikitext
24806 __TOC__
24807 __NOTOC__
24808 __FORCETOC__
24809 __INDEX__
24810 __NOINDEX__
24811 __NOGALLERY__
24812 __NOEDITSECTION__
24813 __NOTITLECONVERT__
24814 __NOCONTENTCONVERT__
24815 !! end
24816
24817 !! test
24818 Consecutive <pre>s should not get merged
24819 !! options
24820 parsoid=html2wt,html2html
24821 !! html/parsoid
24822 <pre>a</pre><pre>b</pre>
24823
24824 <pre>c
24825 </pre><pre>
24826 d</pre>
24827
24828 <pre>e
24829
24830 </pre><pre>
24831
24832 f</pre>
24833 !! wikitext
24834 a
24835
24836 b
24837
24838 c
24839
24840 d
24841
24842 e
24843
24844
24845
24846 f
24847 !! end
24848
24849 !! test
24850 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
24851 !! options
24852 parsoid=html2wt
24853 !! html/parsoid
24854 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
24855 !! wikitext
24856 [[Special:BookSources/1234567890|ISBN 1234567895]]
24857 !! end
24858
24859 !! test
24860 Edited RFC links not serializable as RFC links should serialize as extlinks
24861 !! options
24862 parsoid=html2wt
24863 !! html/parsoid
24864 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
24865 !! wikitext
24866 [//tools.ietf.org/html/rfc123 New RFC]
24867 !! end
24868
24869 !! test
24870 Edited PMID links not serializable as PMID links should serialize as extlinks
24871 !! options
24872 parsoid=html2wt
24873 !! html/parsoid
24874 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
24875 !! wikitext
24876 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
24877 !! end
24878
24879 !! test
24880 WTS of autolinks with trailing/surrounding context
24881 !! options
24882 parsoid=html2wt
24883 !! html/parsoid
24884 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
24885 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
24886 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
24887 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
24888 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
24889 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
24890 !! wikitext
24891 http://cscott.net<nowiki/>'''foo'''
24892
24893 http://cscott.net<b>foo</b>
24894
24895 '''http://cscott.net<nowiki/>'''
24896
24897 '''http://cscott.net '''
24898
24899 '''http://cscott.net<nowiki/>x'''
24900
24901 http://cscott.net<nowiki/>x
24902 !! end
24903
24904 !! test
24905 WTS of autolinks with nowikis (round-trip)
24906 !! wikitext
24907 x<nowiki/>http://cscott.net<nowiki/>x
24908 !! html/parsoid
24909 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
24910 !! end
24911
24912 # this is the "easy" test because it leaves in place all the
24913 # data-parsoid information indicating this is an autolink
24914 !! test
24915 WTS of autolinks with escapes (editing)
24916 !! options
24917 parsoid={
24918 "modes": ["wt2wt"],
24919 "changes": [
24920 [ "meta", "remove" ]
24921 ]
24922 }
24923 !! wikitext
24924 x<nowiki/>http://cscott.net<nowiki/>x
24925 !! wikitext/edited
24926 x<nowiki/>http://cscott.net<nowiki/>x
24927 !! end
24928
24929 !! test
24930 WTS of edited autolink-like text (T103364)
24931 !! options
24932 parsoid={
24933 "modes": ["wt2wt"],
24934 "changes": [
24935 [ "span[typeof]", "removeAttr", "typeof" ]
24936 ]
24937 }
24938 !! wikitext
24939 Not a link: <nowiki>http://example.com</nowiki>.
24940 !! wikitext/edited
24941 Not a link: <span><nowiki>http://example.com</nowiki></span>.
24942 !! end
24943
24944 !! test
24945 WTS of newly-authored autolink-like text (T103364)
24946 !! options
24947 parsoid=html2wt
24948 !! html/parsoid
24949 <p>http://example.com is not a link.</p>
24950 !! wikitext
24951 <nowiki>http://example.com is not a link.</nowiki>
24952 !! end
24953
24954 !! test
24955 WTS of autolink-like text after an autolink (T108563)
24956 !! options
24957 parsoid=html2wt
24958 !! html/parsoid
24959 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
24960 !! wikitext
24961 http://example.com<nowiki> http://example.com is not a link.</nowiki>
24962 !! end
24963
24964 !! test
24965 Edited Redirect link should emit a non-piped wikitext link
24966 !! options
24967 parsoid=html2wt
24968 !! html/parsoid
24969 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
24970 !! wikitext
24971 #REDIRECT [[Bar]]
24972 !! end
24973
24974 !! test
24975 T75121: Infer extension name from typeOf if data-mw is not present
24976 !! options
24977 parsoid=html2wt
24978 !! html/parsoid
24979 <div typeOf="mw:Extension/foo"></div>
24980 !! wikitext
24981 <foo />
24982 !! end
24983
24984 # Note that the <p> wrapping isn't present in PHP parser output
24985 # The important thing for this test is that P-wrapping doesn't
24986 # interfere with the <nowiki> protection for leading - in <td>
24987 # (which isn't necessary for <th>).
24988 !! test
24989 T88318: p-wrapped dash in table.
24990 !! options
24991 parsoid=html2wt,wt2wt
24992 !! html/parsoid
24993 <table><tbody>
24994 <tr><th><p>-</p></th><th><p>- </p></th></tr>
24995 <tr><td><p>-</p></td><td><p>- </p></td></tr>
24996 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
24997 </tbody></table>
24998 !! wikitext
24999 {|
25000 !-
25001 !-
25002 |-
25003 |<nowiki>-</nowiki>
25004 |<nowiki>- </nowiki>
25005 |-
25006 |<small>-</small>
25007 |<br>
25008 -
25009 |<br>
25010 -
25011 |}
25012 !! html/php+tidy
25013 <table>
25014 <tr>
25015 <th>-</th>
25016 <th>-</th>
25017 </tr>
25018 <tr>
25019 <td>-</td>
25020 <td>-</td>
25021 </tr>
25022 <tr>
25023 <td><small>-</small></td>
25024 <td><br />
25025 <p>-</p>
25026 </td>
25027 <td><br />
25028 <p>-</p>
25029 </td>
25030 </tr>
25031 </table>
25032 !! end
25033
25034 !! test
25035 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
25036 !! options
25037 parsoid=html2wt
25038 !! html/parsoid
25039 <table id='mwAb'>
25040 <td id='mwAc'>foo</td>
25041 <td id='serialize-this'>bar</td>
25042 </table>
25043 !! wikitext
25044 {|
25045 |foo
25046 | id="serialize-this" |bar
25047 |}
25048 !! end
25049
25050 !! test
25051 Parsoid-like element ids should not be serialized to wikitext unless shadowed
25052 !! options
25053 parsoid=html2wt
25054 !! html/parsoid
25055 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
25056 !! wikitext
25057 <div id="hello">ok</div>
25058 !! end
25059
25060 !! test
25061 WTS change modes
25062 !! options
25063 parsoid={
25064 "modes": ["wt2wt"],
25065 "changes": [
25066 [ "#xyz", "before", "<b>before</b> stuff " ],
25067 [ "#xyz", "after", " stuff <i>after</i>" ],
25068 [ "#xyz", "html", "x <b>y</b> z" ]
25069 ]
25070 }
25071 !! wikitext
25072 <span id="xyz">hello</span>
25073 !! wikitext/edited
25074 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
25075 !! end
25076
25077 !! test
25078 Never serialize a-tag as html, regardless of what data-parsoid has to say
25079 !! options
25080 parsoid=html2wt
25081 !! html/parsoid
25082 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
25083 !! wikitext
25084 [[Foo]]
25085 !! end
25086
25087 ## SSS FIXME: This is broken output nevertheless.
25088 ## What might be a reasonable non-broken output for this?
25089 ## This is an edge case unlikely to be seen in production
25090 ## that I am not wasting more time on this right now.
25091 !! test
25092 Never serialize a-tag as html, no matter what attributes it has
25093 !! options
25094 parsoid=html2wt
25095 !! html/parsoid
25096 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
25097 !! wikitext
25098 [http://boo.org http://boohoo.org]
25099 !! end
25100
25101 # Misnested is an indication that selser can reuse the source but these have
25102 # shown to sneak through on occasion. See T101768.
25103 # The original wikitext here is: [http://test.com [[one]] two three]
25104 !! test
25105 Strip span tags added to mark as misnested
25106 !! options
25107 parsoid=html2wt
25108 !! html/parsoid
25109 <p data-parsoid='{}'><a rel="mw:ExtLink" href="http://test.com" data-parsoid='{"targetOff":17,"contentOffsets":[17,34]}'></a><a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"simple","a":{"href":"./One"},"sa":{"href":"one"},"misnested":true}'>one</a><span data-parsoid='{"misnested":true}'> two three</span></p>
25110 !! wikitext
25111 [http://test.com][[one]] two three
25112 !! end
25113
25114 # --------------------------------------------
25115 # Tests spec'ing wikitext serialization norms |
25116 # --------------------------------------------
25117
25118 !! test
25119 Lists: Add space after bullets
25120 !! options
25121 parsoid=html2wt
25122 !! html/parsoid
25123 <ul>
25124 <li>foo</li>
25125 <li> bar</li>
25126 <li><span> baz</span></li>
25127 </ul>
25128 !! wikitext
25129 * foo
25130 * bar
25131 * <span> baz</span>
25132 !! end
25133
25134 !! test
25135 1. Headings: Add space before/after == (T53744)
25136 !! options
25137 parsoid=html2wt
25138 !! html/parsoid
25139 <h2>foo</h2>
25140 <h2> bar</h2>
25141 <h2>baz </h2>
25142 <h2><span> baz</span></h2>
25143 !! wikitext
25144 == foo ==
25145
25146 == bar ==
25147
25148 == baz ==
25149
25150 == <span> baz</span> ==
25151 !! end
25152
25153 !! test
25154 2. Headings: Add space before/after == even after hoisted content
25155 !! options
25156 parsoid={
25157 "modes": ["html2wt"],
25158 "scrubWikitext": true
25159 }
25160 !! html/parsoid
25161 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
25162 !! wikitext
25163 [[Category:A2]]
25164
25165 == ok ==
25166 !! end
25167
25168 !! test
25169 1. Headings: suppress newly created empty headings
25170 !! options
25171 parsoid={
25172 "modes": ["html2wt"],
25173 "scrubWikitext": true
25174 }
25175 !! html/parsoid
25176 <h2></h2>
25177 !! wikitext
25178 !! end
25179
25180 !! test
25181 2. Headings: don't suppress empty headings if scrubWikitext is false
25182 !! options
25183 parsoid=html2wt
25184 !! html/parsoid
25185 <h2></h2>
25186 !! wikitext
25187 ==<nowiki/>==
25188 !! end
25189
25190 !! test
25191 3. Headings: suppress empty headings on edits
25192 !! options
25193 parsoid={
25194 "modes": ["selser"],
25195 "scrubWikitext": true,
25196 "changes": [
25197 [ "#x", "remove"]
25198 ]
25199 }
25200 !! wikitext
25201 ==<span id="x">foo</span>==
25202 !! wikitext/edited
25203 !! end
25204
25205 !! test
25206 1. WT Quote Tags: suppress newly created empty style tags
25207 !! options
25208 parsoid={
25209 "modes": ["html2wt"],
25210 "scrubWikitext": true
25211 }
25212 !! html/parsoid
25213 <i></i><b></b>
25214 !! wikitext
25215 !! end
25216
25217 !! test
25218 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
25219 !! options
25220 parsoid=html2wt
25221 !! html/parsoid
25222 <i></i><b></b>
25223 !! wikitext
25224 ''<nowiki/>'''''<nowiki/>'''
25225 !! end
25226
25227 !! test
25228 3. WT Quote Tags: suppress empty style tags on edits
25229 !! options
25230 parsoid={
25231 "modes": ["selser"],
25232 "scrubWikitext": true,
25233 "changes": [
25234 [ "#x", "remove"]
25235 ]
25236 }
25237 !! wikitext
25238 '''<span id="x">foo</span>'''
25239 !! wikitext/edited
25240 !! end
25241
25242 !! test
25243 1. Anchors: suppress newly created empty anchors
25244 !! options
25245 parsoid={
25246 "modes": ["html2wt"],
25247 "scrubWikitext": true
25248 }
25249 !! html/parsoid
25250 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
25251 !! wikitext
25252 !! end
25253
25254 !! test
25255 2. Anchors: don't suppress empty anchors if scrubWikitext is false
25256 !! options
25257 parsoid={
25258 "modes": ["html2wt"],
25259 "scrubWikitext": false
25260 }
25261 !! html/parsoid
25262 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
25263 !! wikitext
25264 [[Test|<nowiki/>]]
25265 !! end
25266
25267 !! test
25268 3. Anchors: suppress empty anchors on edits
25269 !! options
25270 parsoid={
25271 "modes": ["selser"],
25272 "scrubWikitext": true,
25273 "changes": [
25274 [ "#x", "remove"]
25275 ]
25276 }
25277 !! wikitext
25278 [[Test|<span id="x">foo</span>]]
25279 !! wikitext/edited
25280 !! end
25281
25282 !! test
25283 3a. Anchors: do not suppress numbered extlinks
25284 !! options
25285 parsoid={
25286 "modes": ["wt2wt"],
25287 "scrubWikitext": true
25288 }
25289 !! wikitext
25290 [http://foo.com]
25291 !! html/parsoid
25292 <a rel="mw:ExtLink" href="http://foo.com"></a>
25293 !! end
25294
25295 !! test
25296 3b. Anchors: do not suppress numbered extlinks
25297 !! options
25298 parsoid={
25299 "modes": ["wt2wt"],
25300 "scrubWikitext": true,
25301 "changes": [
25302 [ "#x", "remove"]
25303 ]
25304 }
25305 !! wikitext
25306 [http://foo.com <span id="x">foo</span>]
25307 !! wikitext/edited
25308 [http://foo.com]
25309 !! end
25310
25311 !!test
25312 Normalizations should be restricted to edited content
25313 !!options
25314 parsoid={
25315 "modes": ["selser"],
25316 "scrubWikitext": true,
25317 "changes": [
25318 [ "h1", "before", "<i></i>"]
25319 ]
25320 }
25321 !!wikitext
25322 a
25323 = =
25324 b
25325 !!wikitext/edited
25326 a
25327 = =
25328 b
25329 !!end
25330
25331 !! test
25332 1. Multiple normalizations (html2wt)
25333 !! options
25334 parsoid={
25335 "modes": ["html2wt"],
25336 "scrubWikitext": true
25337 }
25338 !! html
25339 <h2><i></i></h2>
25340 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
25341 </a><b><i></i></b>x</p>
25342 !! wikitext
25343
25344 [[foo]]
25345 x
25346
25347 !! end
25348
25349 !! test
25350 2. Multiple normalizations (selser)
25351 !! options
25352 parsoid={
25353 "modes": ["selser"],
25354 "scrubWikitext": true,
25355 "changes": [
25356 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
25357 ]
25358 }
25359 !! wikitext
25360 <span id="x">foo</span>
25361 !! wikitext/edited
25362 <span id="x">foo</span>
25363
25364 x
25365 !! end
25366
25367 !! test
25368 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
25369 !! options
25370 parsoid={
25371 "modes": ["html2wt"],
25372 "scrubWikitext": true
25373 }
25374 !! html/parsoid
25375 <p> hi</p>
25376 <p> hello</p>
25377 !! wikitext
25378 hi
25379
25380 hello
25381 !! end
25382
25383 !! test
25384 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
25385 !! options
25386 parsoid=html2wt
25387 !! html/parsoid
25388 <p> hi</p>
25389 <p> hello</p>
25390 !! wikitext
25391 <nowiki> </nowiki>hi
25392
25393 <nowiki> </nowiki> hello
25394 !! end
25395
25396 !! test
25397 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
25398 !! options
25399 parsoid={
25400 "modes": ["html2wt"],
25401 "scrubWikitext": true
25402 }
25403 !! html/parsoid
25404 <p>Foo
25405 bar
25406 baz</p>
25407
25408 <table><tr><td>Foo
25409 bar
25410 baz bang</td></tr></table>
25411
25412 <p><!--boo--> foo
25413 bar</p>
25414
25415 <p> foo
25416 bar<span>boo</span></p>
25417 !! wikitext
25418 Foo
25419 bar
25420 baz
25421
25422 {|
25423 |Foo
25424 bar
25425 baz bang
25426 |}
25427
25428 <!--boo-->foo
25429 bar
25430
25431 foo
25432 bar<span>boo</span>
25433 !! end
25434
25435 !! test
25436 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
25437 !! options
25438 parsoid={
25439 "modes": ["selser"],
25440 "scrubWikitext": true,
25441 "changes": [
25442 [ "p", "html", " a\n b" ]
25443 ]
25444 }
25445 !! wikitext
25446 xyz
25447 !! wikitext/edited
25448 a
25449 b
25450 !! end
25451
25452 !! test
25453 1. New links that end in spaces
25454 !! options
25455 parsoid={
25456 "modes": ["html2wt"],
25457 "scrubWikitext": false
25458 }
25459 !! html/parsoid
25460 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
25461 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
25462 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
25463 !! wikitext
25464 [[Berlin ]]<nowiki/>is the capital of Germany.
25465
25466 [[Foo ]]'''bar'''
25467
25468 [[Boston ]] is a city.
25469 !! end
25470
25471 !! test
25472 2. New links that end in spaces
25473 !! options
25474 parsoid={
25475 "modes": ["html2wt"],
25476 "scrubWikitext": true
25477 }
25478 !! html/parsoid
25479 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
25480 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
25481 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
25482 !! wikitext
25483 [[Berlin]] is the capital of Germany.
25484
25485 [[Foo]] '''bar'''
25486
25487 [[Boston]] is a city.
25488 !! end
25489
25490 !! test
25491 1. Table cells with escapable prefixes
25492 !! options
25493 parsoid={
25494 "modes": ["html2wt"],
25495 "scrubWikitext": false
25496 }
25497 !! html
25498 <table>
25499 <tr><td>a</td></tr>
25500 <tr><td>-</td></tr>
25501 <tr><td>+</td></tr>
25502 </table>
25503 !! wikitext
25504 {|
25505 |a
25506 |-
25507 |<nowiki>-</nowiki>
25508 |-
25509 |<nowiki>+</nowiki>
25510 |}
25511 !! end
25512
25513 !! test
25514 2. Table cells with escapable prefixes
25515 !! options
25516 parsoid={
25517 "modes": ["html2wt"],
25518 "scrubWikitext": true
25519 }
25520 !! html
25521 <table>
25522 <tr><td>a</td></tr>
25523 <tr><td>-</td></tr>
25524 <tr><td>+</td></tr>
25525 </table>
25526 !! wikitext
25527 {|
25528 |a
25529 |-
25530 | -
25531 |-
25532 | +
25533 |}
25534 !! end
25535
25536 !! test
25537 3a. Table cells with escapable prefixes after edits
25538 !! options
25539 parsoid={
25540 "modes": ["selser"],
25541 "scrubWikitext": true,
25542 "changes": [
25543 [ "table tbody tr:first-child td:first-child", "remove"]
25544 ]
25545 }
25546 !! wikitext
25547 {|
25548 |a||-
25549 |}
25550 !! wikitext/edited
25551 {|
25552 | -
25553 |}
25554 !! end
25555
25556 !! test
25557 3b. Table cells with escapable prefixes after edits
25558 !! options
25559 parsoid={
25560 "modes": ["selser"],
25561 "scrubWikitext": true,
25562 "changes": [
25563 [ "table tbody tr:first-child td:first-child", "html", "-" ],
25564 [ "#x", "remove" ]
25565 ]
25566 }
25567 !! wikitext
25568 {|
25569 |pqr
25570 |<span id="x">foo</span>+
25571 |}
25572 !! wikitext/edited
25573 {|
25574 | -
25575 | +
25576 |}
25577 !! end
25578
25579 # FIXME: This test will fail because
25580 # normalization doesn't realize that the id attribute
25581 # will eliminate the escapable scenario
25582 !! test
25583 4a. Table cells without escapable prefixes after edits
25584 !! options
25585 parsoid={
25586 "modes": ["selser"],
25587 "scrubWikitext": true,
25588 "changes": [
25589 [ "#x", "html", "-" ]
25590 ]
25591 }
25592 !! wikitext
25593 {|
25594 | id="x" |abcd
25595 |}
25596 !! wikitext/edited
25597 {|
25598 | id="x" |-
25599 |}
25600 !! end
25601
25602 ## This tests normalizer's ability to discriminate between
25603 ## cells having identical content.
25604 !! test
25605 4b. Table cells without escapable prefixes after edits
25606 !! options
25607 parsoid={
25608 "modes": ["selser"],
25609 "scrubWikitext": true,
25610 "changes": [
25611 [ "td", "html", "-" ]
25612 ]
25613 }
25614 !! wikitext
25615 {|
25616 |a||b
25617 |}
25618 !! wikitext/edited
25619 {|
25620 | -||-
25621 |}
25622 !! end
25623
25624 ## This tests normalizer's ability to not be tripped by
25625 ## comments (and whitespace)
25626 !! test
25627 4c. Table cells without escapable prefixes after edits
25628 !! options
25629 parsoid={
25630 "modes": ["selser"],
25631 "scrubWikitext": true,
25632 "changes": [
25633 [ "table tbody tr td:first-child", "remove" ]
25634 ]
25635 }
25636 !! wikitext
25637 {|
25638 |-
25639 <!--foo--> |a||-
25640 |}
25641 !! wikitext/edited
25642 {|
25643 |-
25644 <!--foo--> | -
25645 |}
25646 !! end
25647
25648 ## This tests normalizer's ability to handle HTML cells
25649 !! test
25650 4d. Table cells without escapable prefixes after edits
25651 !! options
25652 parsoid={
25653 "modes": ["selser"],
25654 "scrubWikitext": true,
25655 "changes": [
25656 [ "td", "html", "-" ]
25657 ]
25658 }
25659 !! wikitext
25660 <table>
25661 <tr><td>a</td></tr>
25662 </table>
25663 !! wikitext/edited
25664 <table>
25665 <tr><td>-</td></tr>
25666 </table>
25667 !! end
25668
25669 # ---------------------------------------------------
25670 # End of tests spec'ing wikitext serialization norms |
25671 # ---------------------------------------------------
25672
25673 # -----------------------------------------------------------------
25674 # End of section for Parsoid-only html2wt tests for serialization
25675 # of new content
25676 # -----------------------------------------------------------------
25677
25678 # -----------------------------------------------------------------
25679 # The following section of tests are primarily to spec behavior of
25680 # the selective serializer. All these tests have manual selser
25681 # changes. The automated selser changes for all tests handle the
25682 # wide variation of changes, but these tests here capture specs
25683 # deterministically.
25684 # ----------------------------------------------------------------
25685
25686 ## T90517
25687 !! test
25688 Selser: New comments should not be lost
25689 !! options
25690 parsoid={
25691 "modes": ["selser"],
25692 "changes": [
25693 [ "#a", "after", "<!--c1-->" ],
25694 [ "#b", "before", "<!--c2-->" ]
25695 ]
25696 }
25697 !! wikitext
25698 <span id="a">a</span>
25699
25700 <span id="b">b</span>
25701 !! wikitext/edited
25702 <span id="a">a</span><!--c1-->
25703
25704 <!--c2--><span id="b">b</span>
25705 !! end
25706
25707 ## T89383
25708 !! test
25709 Selser: Check for validity of DSR before using it
25710 !! options
25711 parsoid={
25712 "modes": ["selser"],
25713 "changes": [
25714 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
25715 ]
25716 }
25717 !! wikitext
25718 <span id="a">a</span>
25719 !! wikitext/edited
25720 {{DISPLAYTITLE:foo}}
25721 <span id="a">a</span>
25722 !! end
25723
25724 !! test
25725 1. DOMDiff: Changes to <ref> content should be looked up using id
25726 !! options
25727 parsoid={
25728 "modes": ["selser"],
25729 "changes": [
25730 ["#X", "after", "bar"],
25731 ["#Y", "after", "baz"]
25732 ]
25733 }
25734 !! wikitext
25735 X <ref><span id="X">foo</span></ref>
25736 Y <ref name="a" />
25737 <references>
25738 <ref name="a"><span id="Y">foo</span></ref>
25739 </references>
25740 !! wikitext/edited
25741 X <ref><span id="X">foo</span>bar</ref>
25742 Y <ref name="a" />
25743 <references>
25744 <ref name="a"><span id="Y">foo</span>baz</ref>
25745 </references>
25746 !! end
25747
25748 !! test
25749 2. DOMDiff: Changes to <ref> content should be looked up using id
25750 !! options
25751 parsoid={
25752 "modes": ["selser"],
25753 "changes": [
25754 ["#Z", "after", "bar"]
25755 ]
25756 }
25757 !! wikitext
25758 A <ref>foo bar for a</ref>
25759 B <ref group="X" name="b" />
25760
25761 <references />
25762
25763 <references group="X">
25764 <ref name="b"><span id="Z">foo</span></ref>
25765 </references>
25766 !! wikitext/edited
25767 A <ref>foo bar for a</ref>
25768 B <ref group="X" name="b" />
25769
25770 <references />
25771
25772 <references group="X">
25773 <ref name="b"><span id="Z">foo</span>bar</ref>
25774 </references>
25775 !! end