Merge "Added a tombstone comment to WANObjectCache"
[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, autolink format (T23261)
5345 !! wikitext
5346 http://[2404:130:0:1000::187:2]/index.php
5347
5348 Examples from RFC2373, section 2.2:
5349 * http://[1080::8:800:200C:417A]/unicast
5350 * http://[FF01::101]/multicast
5351 * http://[::1]/loopback
5352 * http://[::]/unspecified
5353 * http://[::13.1.68.3]/ipv4compat
5354 * http://[::FFFF:129.144.52.38]/ipv4compat
5355
5356 Examples from RFC 2732, section 2:
5357 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5358 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5359 * http://[3ffe:2a00:100:7031::1]
5360 * http://[1080::8:800:200C:417A]/foo
5361 * http://[::192.9.5.5]/ipng
5362 * http://[::FFFF:129.144.52.38]:80/index.html
5363 * http://[2010:836B:4179::836B:4179]
5364
5365 !! html
5366 <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>
5367 </p><p>Examples from RFC2373, section 2.2:
5368 </p>
5369 <ul><li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5370 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5371 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5372 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5373 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5374 <li> <a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5375 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5376 </p>
5377 <ul><li> <a rel="nofollow" class="external free" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5378 <li> <a rel="nofollow" class="external free" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5379 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5380 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5381 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5382 <li> <a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5383 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5384
5385 !! end
5386
5387 !! test
5388 IPv6 urls, bracketed format (T23261)
5389 !! wikitext
5390 [http://[2404:130:0:1000::187:2]/index.php test]
5391
5392 Examples from RFC2373, section 2.2:
5393 * [http://[1080::8:800:200C:417A] unicast]
5394 * [http://[FF01::101] multicast]
5395 * [http://[::1]/ loopback]
5396 * [http://[::] unspecified]
5397 * [http://[::13.1.68.3] ipv4compat]
5398 * [http://[::FFFF:129.144.52.38] ipv4compat]
5399
5400 Examples from RFC 2732, section 2:
5401 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5402 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5403 * [http://[3ffe:2a00:100:7031::1] 3]
5404 * [http://[1080::8:800:200C:417A]/foo 4]
5405 * [http://[::192.9.5.5]/ipng 5]
5406 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5407 * [http://[2010:836B:4179::836B:4179] 7]
5408
5409 !! html
5410 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5411 </p><p>Examples from RFC2373, section 2.2:
5412 </p>
5413 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5414 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5415 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5416 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5417 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5418 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5419 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5420 </p>
5421 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5422 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5423 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5424 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5425 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5426 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5427 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5428
5429 !! end
5430
5431 !! test
5432 Non-extlinks in brackets
5433 !! wikitext
5434 [foo]
5435 [foo bar]
5436 [foo ''bar'']
5437 [fool's] errand
5438 [fool's errand]
5439 [{{echo|foo}}]
5440 [{{echo|foo}} bar]
5441 [{{echo|foo}} ''bar'']
5442 [{{echo|foo}}l's] errand
5443 [{{echo|foo}}l's errand]
5444 [url={{echo|foo}}]
5445 [url=http://example.com]
5446 !! html
5447 <p>[foo]
5448 [foo bar]
5449 [foo <i>bar</i>]
5450 [fool's] errand
5451 [fool's errand]
5452 [foo]
5453 [foo bar]
5454 [foo <i>bar</i>]
5455 [fool's] errand
5456 [fool's errand]
5457 [url=foo]
5458 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5459 </p>
5460 !! end
5461
5462 !! test
5463 Percent encoding in external links
5464 !! wikitext
5465 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5466 !! html/php
5467 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5468 </p>
5469 !! html/parsoid
5470 <p><a rel="mw:ExtLink"
5471 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5472 !! end
5473
5474 !! test
5475 Use url link syntax for links where the content is equal the link target
5476 !! wikitext
5477 http://example.com
5478 !! html/php
5479 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5480 </p>
5481 !! html/parsoid
5482 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5483 !! end
5484
5485 !! test
5486 Parenthesis in external links, especially URL links
5487 !! wikitext
5488 http://example.com)
5489
5490 http://example.com/test)
5491
5492 http://example.com/(test)
5493
5494 http://example.com/((test)
5495
5496 (http://example.com/(test))
5497
5498 (http://example.com/(test)))))
5499
5500 http://example.com/a)b
5501
5502 [http://example.com) foo]
5503 !! html/php
5504 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5505 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5506 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5507 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5508 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5509 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5510 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5511 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5512 </p>
5513 !! html/parsoid
5514 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5515 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5516 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5517 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5518 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5519 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5520 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5521 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5522 !! end
5523
5524 !! test
5525 Parenthesis in external links, w/ transclusion or comment
5526 !! wikitext
5527 (http://example.com/{{echo|hi}})
5528
5529 (http://example.com<!-- hi -->)
5530 !! html/php
5531 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5532 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5533 </p>
5534 !! html/parsoid
5535 <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>
5536
5537 <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>
5538 !! end
5539
5540 !! test
5541 Serialize <a> tags with invalid link targets as plain text
5542 !! options
5543 parsoid=html2wt
5544 !! html/parsoid
5545 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5546 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5547 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5548 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5549 !! wikitext
5550 text
5551 <nowiki>*</nowiki>text
5552 <nowiki>[[foo]]</nowiki>
5553 <nowiki>*a [[foo]]</nowiki>
5554 !! end
5555
5556 !! test
5557 mw:ExtLink -vs- mw:WikiLink (T94723)
5558 !! options
5559 parsoid=html2wt
5560 !! html/parsoid
5561 <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>
5562 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5563 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5564 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5565 <p>
5566 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5567 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5568 </p>
5569 !! wikitext
5570 [[Foo|Bar]]
5571 [[Foo|Bar]]
5572 [[wikipedia:Foo|Bar]]
5573 [[wikipedia:Foo|Bar]]
5574
5575 [[wikipedia:European_Robin|European Robin]]
5576 [[wikipedia:European_Robin|European Robin]]
5577 !! end
5578
5579 !! test
5580 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5581 !! options
5582 parsoid=wt2wt
5583 !! wikitext
5584 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5585 !! html/parsoid
5586 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5587 !! end
5588
5589
5590 ###
5591 ### Quotes
5592 ###
5593
5594 !! test
5595 Quotes
5596 !! wikitext
5597 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5598
5599 Normal text. '''''Bold italic text.''''' Normal text.
5600 !! html
5601 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5602 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5603 </p>
5604 !! end
5605
5606
5607 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5608 # parser strips. The wikitext contains just the first half of the bold
5609 # quote pair.
5610 !! test
5611 Unclosed and unmatched quotes
5612 !! wikitext
5613 '''''Bold italic text '''with bold deactivated''' in between.'''''
5614
5615 '''''Bold italic text ''with italic deactivated'' in between.'''''
5616
5617 '''Bold text..
5618
5619 ..spanning two paragraphs (should not work).'''
5620
5621 '''Bold tag left open
5622
5623 ''Italic tag left open
5624
5625 Normal text.
5626
5627 <!-- Unmatching number of opening, closing tags: -->
5628 '''This year''''s election ''should'' beat '''last year''''s.
5629
5630 ''Tom'''s car is bigger than ''Susan'''s.
5631
5632 Plain ''italic'''s plain
5633 !! html/php
5634 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5635 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5636 </p><p><b>Bold text..</b>
5637 </p><p>..spanning two paragraphs (should not work).
5638 </p><p><b>Bold tag left open</b>
5639 </p><p><i>Italic tag left open</i>
5640 </p><p>Normal text.
5641 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5642 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5643 </p><p>Plain <i>italic'</i>s plain
5644 </p>
5645 !! html/parsoid
5646 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5647 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5648 </p><p><b>Bold text..</b>
5649 </p><p>..spanning two paragraphs (should not work).<b></b>
5650 </p><p><b>Bold tag left open</b>
5651 </p><p><i>Italic tag left open</i>
5652 </p><p>Normal text.
5653 </p>
5654 <!-- Unmatching number of opening, closing tags: -->
5655 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5656 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5657 </p><p>Plain <i>italic'</i>s plain
5658 </p>
5659 !! end
5660
5661 ###
5662 ### Tables
5663 ###
5664 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5665 ###
5666
5667 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5668 # is the bare minimum required by the spec, see:
5669 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5670 # Parsoid team replies: empty table tags are legal in HTML5
5671 !! test
5672 A table with no data.
5673 !! options
5674 parsoid=wt2html
5675 !! wikitext
5676 {||}
5677 !! html/php
5678
5679 !! html/parsoid
5680 <table></table>
5681
5682 !! end
5683
5684 !! test
5685 A table with stray table end tags on start tag line (wt2html)
5686 !! options
5687 parsoid=wt2html
5688 !! wikitext
5689 {|style="color: red;"|}
5690
5691 {|style="color: red;" |}
5692 |foo
5693 |}
5694
5695 {|style="color: red;"|} id="foo"
5696 |foo
5697 |}
5698
5699 {|style="color: red;" |} id="foo"
5700 |foo
5701 |}
5702 !! html
5703 <table style="color: red;"></table>
5704
5705 <table style="color: red;">
5706 <tbody><tr>
5707 <td>foo</td>
5708 </tr></tbody>
5709 </table>
5710
5711 <table style="color: red;" id="foo">
5712 <tbody><tr>
5713 <td>foo</td>
5714 </tr></tbody>
5715 </table>
5716
5717 <table style="color: red;" id="foo">
5718 <tbody><tr>
5719 <td>foo</td>
5720 </tr></tbody>
5721 </table>
5722
5723 !! end
5724
5725 !! test
5726 A table with no data (take 2)
5727 !! wikitext
5728 {|
5729 |}
5730 !! html/parsoid
5731 <table></table>
5732 !! end
5733
5734 # A table with nothing but a caption is invalid XHTML, we might want to render
5735 # this as <p>caption</p>
5736 # Parsoid team replies: table with only a caption is legal in HTML5
5737 !! test
5738 A table with nothing but a caption
5739 !! wikitext
5740 {|
5741 |+ caption
5742 |}
5743 !! html/php
5744 <table>
5745 <caption> caption
5746 </caption><tr><td></td></tr></table>
5747
5748 !! html/parsoid
5749 <table><caption> caption</caption></table>
5750 !! end
5751
5752 !! test
5753 A table with caption with default-spaced attributes and a table row
5754 !! wikitext
5755 {|
5756 |+ style="color: red;" | caption1
5757 |-
5758 | foo
5759 |}
5760 !! html
5761 <table>
5762 <caption style="color: red;"> caption1
5763 </caption>
5764 <tr>
5765 <td> foo
5766 </td></tr></table>
5767
5768 !! end
5769
5770 !! test
5771 A table with captions with non-default spaced attributes and a table row
5772 !! wikitext
5773 {|
5774 |+style="color: red;"|caption2
5775 |+ style="color: red;"| caption3
5776 |-
5777 | foo
5778 |}
5779 !! html
5780 <table>
5781 <caption style="color: red;">caption2
5782 </caption>
5783 <caption style="color: red;"> caption3
5784 </caption>
5785 <tr>
5786 <td> foo
5787 </td></tr></table>
5788
5789 !! end
5790
5791 !! test
5792 Table td-cell syntax variations
5793 !! wikitext
5794 {|
5795 | foo bar foo | baz
5796 | foo bar foo || baz
5797 | style='color:red;' | baz
5798 | style='color:red;' || baz
5799 |}
5800 !! html
5801 <table>
5802 <tr>
5803 <td> baz
5804 </td>
5805 <td> foo bar foo </td>
5806 <td> baz
5807 </td>
5808 <td style="color:red;"> baz
5809 </td>
5810 <td> style='color:red;' </td>
5811 <td> baz
5812 </td></tr></table>
5813
5814 !! end
5815
5816 !! test
5817 Simple table
5818 !! wikitext
5819 {|
5820 | 1 || 2
5821 |-
5822 | 3 || 4
5823 |}
5824 !! html
5825 <table>
5826 <tr>
5827 <td> 1 </td>
5828 <td> 2
5829 </td></tr>
5830 <tr>
5831 <td> 3 </td>
5832 <td> 4
5833 </td></tr></table>
5834
5835 !! end
5836
5837 !! test
5838 Simple table but with multiple dashes for row wikitext
5839 !! wikitext
5840 {|
5841 | foo
5842 |-----
5843 | bar
5844 |}
5845 !! html
5846 <table>
5847 <tr>
5848 <td> foo
5849 </td></tr>
5850 <tr>
5851 <td> bar
5852 </td></tr></table>
5853
5854 !! end
5855
5856 !! test
5857 Multiplication table
5858 !! wikitext
5859 {| border="1" cellpadding="2"
5860 |+Multiplication table
5861 |-
5862 ! &times; !! 1 !! 2 !! 3
5863 |-
5864 ! 1
5865 | 1 || 2 || 3
5866 |-
5867 ! 2
5868 | 2 || 4 || 6
5869 |-
5870 ! 3
5871 | 3 || 6 || 9
5872 |-
5873 ! 4
5874 | 4 || 8 || 12
5875 |-
5876 ! 5
5877 | 5 || 10 || 15
5878 |}
5879 !! html
5880 <table border="1" cellpadding="2">
5881 <caption>Multiplication table
5882 </caption>
5883 <tr>
5884 <th> &#215; </th>
5885 <th> 1 </th>
5886 <th> 2 </th>
5887 <th> 3
5888 </th></tr>
5889 <tr>
5890 <th> 1
5891 </th>
5892 <td> 1 </td>
5893 <td> 2 </td>
5894 <td> 3
5895 </td></tr>
5896 <tr>
5897 <th> 2
5898 </th>
5899 <td> 2 </td>
5900 <td> 4 </td>
5901 <td> 6
5902 </td></tr>
5903 <tr>
5904 <th> 3
5905 </th>
5906 <td> 3 </td>
5907 <td> 6 </td>
5908 <td> 9
5909 </td></tr>
5910 <tr>
5911 <th> 4
5912 </th>
5913 <td> 4 </td>
5914 <td> 8 </td>
5915 <td> 12
5916 </td></tr>
5917 <tr>
5918 <th> 5
5919 </th>
5920 <td> 5 </td>
5921 <td> 10 </td>
5922 <td> 15
5923 </td></tr></table>
5924
5925 !! end
5926
5927 !! test
5928 Accept "||" in table headings
5929 !! wikitext
5930 {|
5931 !h1 || h2
5932 |}
5933 !! html
5934 <table>
5935 <tr>
5936 <th>h1 </th>
5937 <th> h2
5938 </th></tr></table>
5939
5940 !! end
5941
5942 !! test
5943 Accept "!!" in table data
5944 !! wikitext
5945 {|
5946 | Foo!! ||
5947 |}
5948 !! html
5949 <table>
5950 <tr>
5951 <td> Foo!! </td>
5952 <td>
5953 </td></tr></table>
5954
5955 !! html/parsoid
5956 <table>
5957 <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>
5958 </tbody></table>
5959 !! end
5960
5961 !! test
5962 Accept "||" in indented table headings
5963 !! wikitext
5964 :{|
5965 !h1 || h2
5966 |}
5967 !! html
5968 <dl><dd><table>
5969 <tr>
5970 <th>h1 </th>
5971 <th> h2
5972 </th></tr></table></dd></dl>
5973
5974 !! end
5975
5976 !! test
5977 Accept "!!" in templates
5978 !! wikitext
5979 {|
5980 !a {{echo|b!!c}}
5981 |}
5982 !! html/php
5983 <table>
5984 <tr>
5985 <th>a b</th>
5986 <th>c
5987 </th></tr></table>
5988
5989 !! html/parsoid
5990 <table>
5991 <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>
5992 !! end
5993
5994 !! test
5995 Accept "!!" in table headings after newline
5996 !! wikitext
5997 {|
5998 !a
5999 b!!c
6000 |}
6001 !! html/php
6002 <table>
6003 <tr>
6004 <th>a
6005 <p>b!!c
6006 </p>
6007 </th></tr></table>
6008
6009 !! html/parsoid
6010 <table>
6011 <tbody><tr><th>a
6012 <p>b!!c</p></th></tr>
6013 </tbody></table>
6014 !! end
6015
6016 !! test
6017 Accept "!!" in table data of mixed wikitext / html syntax
6018 !! wikitext
6019 {|
6020 !a
6021 <tr><td>b!!c</td></tr>
6022 |}
6023 !! html+tidy
6024 <table>
6025 <tr>
6026 <th>a</th>
6027 </tr>
6028 <tr>
6029 <td>b!!c</td>
6030 </tr>
6031 </table>
6032 !! html/parsoid
6033 <table>
6034 <tbody><tr><th>a</th></tr>
6035 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6036 </tbody></table>
6037 !! end
6038
6039 !! test
6040 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6041 !! wikitext
6042 {|
6043 !| h1
6044 || a
6045 |}
6046 !! html
6047 <table>
6048 <tr>
6049 <th> h1
6050 </th>
6051 <td> a
6052 </td></tr></table>
6053
6054 !! end
6055
6056 !!test
6057 Accept "| !" at start of line in tables (ignore !-attribute)
6058 !! wikitext
6059 {|
6060 |-
6061 | !style="color:red" | bar
6062 |}
6063 !! html
6064 <table>
6065
6066 <tr>
6067 <td> bar
6068 </td></tr></table>
6069
6070 !!end
6071
6072 !!test
6073 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 +/-
6074 !! wikitext
6075 {|
6076 |-
6077 |style='color:red;'|+1
6078 |style='color:blue;'|-1
6079 |-
6080 | 1 || 2 || 3
6081 | 1 ||+2 ||-3
6082 |-
6083 | +1
6084 | -1
6085 |}
6086 !! html
6087 <table>
6088
6089 <tr>
6090 <td style="color:red;">+1
6091 </td>
6092 <td style="color:blue;">-1
6093 </td></tr>
6094 <tr>
6095 <td> 1 </td>
6096 <td> 2 </td>
6097 <td> 3
6098 </td>
6099 <td> 1 </td>
6100 <td>+2 </td>
6101 <td>-3
6102 </td></tr>
6103 <tr>
6104 <td> +1
6105 </td>
6106 <td> -1
6107 </td></tr></table>
6108
6109 !!end
6110
6111 !! test
6112 Table rowspan
6113 !! wikitext
6114 {| border=1
6115 | Cell 1, row 1
6116 |rowspan=2| Cell 2, row 1 (and 2)
6117 | Cell 3, row 1
6118 |-
6119 | Cell 1, row 2
6120 | Cell 3, row 2
6121 |}
6122 !! html
6123 <table border="1">
6124 <tr>
6125 <td> Cell 1, row 1
6126 </td>
6127 <td rowspan="2"> Cell 2, row 1 (and 2)
6128 </td>
6129 <td> Cell 3, row 1
6130 </td></tr>
6131 <tr>
6132 <td> Cell 1, row 2
6133 </td>
6134 <td> Cell 3, row 2
6135 </td></tr></table>
6136
6137 !! end
6138
6139 !! test
6140 Nested table
6141 !! wikitext
6142 {| border=1
6143 | &alpha;
6144 |
6145 {| bgcolor=#ABCDEF border=2
6146 |nested
6147 |-
6148 |table
6149 |}
6150 |the original table again
6151 |}
6152 !! html
6153 <table border="1">
6154 <tr>
6155 <td> &#945;
6156 </td>
6157 <td>
6158 <table bgcolor="#ABCDEF" border="2">
6159 <tr>
6160 <td>nested
6161 </td></tr>
6162 <tr>
6163 <td>table
6164 </td></tr></table>
6165 </td>
6166 <td>the original table again
6167 </td></tr></table>
6168
6169 !! end
6170
6171 !! test
6172 Invalid attributes in table cell (bug 1830)
6173 !! wikitext
6174 {|
6175 |Cell:|broken
6176 |}
6177 !! html
6178 <table>
6179 <tr>
6180 <td>broken
6181 </td></tr></table>
6182
6183 !! end
6184
6185 !! test
6186 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6187 !! wikitext
6188 {|
6189 | title="foo" |bar
6190 | title="foo<nowiki>|</nowiki>" |bar
6191 | title="foo<nowiki>|</nowiki>" bar
6192 |}
6193 !! html
6194 <table>
6195 <tr>
6196 <td title="foo">bar
6197 </td>
6198 <td title="foo&#124;">bar
6199 </td>
6200 <td> title="foo|" bar
6201 </td></tr></table>
6202
6203 !! end
6204
6205 # The "|}" to close the table is missing from the input, so parsoid's
6206 # *2wt modes will fail.
6207 !! test
6208 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
6209 !! options
6210 parsoid=wt2html,html2html
6211 !! wikitext
6212 {|
6213 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6214 !! html/php
6215 <table>
6216 <tr>
6217 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6218 <td>]" onmouseover="alert(document.cookie)"&gt;test
6219 </td>
6220 </tr>
6221 </table>
6222
6223 !! html/parsoid
6224 <table><tbody>
6225 <tr>
6226 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6227 !! end
6228
6229 # FIXME: The php output is broken.
6230 !! test
6231 ! and || in td attributes should not be parsed as <th>/<td>
6232 !! wikitext
6233 {|
6234 | style="color: red !important;" data-contrived="put this here ||" | foo
6235 |}
6236 !! html/php
6237 <table>
6238 <tr>
6239 <td> style="color: red !important;" data-contrived="put this here </td>
6240 <td> foo
6241 </td></tr></table>
6242
6243 !! html/parsoid
6244 <table>
6245 <tbody><tr><td style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"autoInsertedEnd":true}'> foo</td></tr>
6246 </tbody></table>
6247 !! end
6248
6249 !! test
6250 Indented table markup mixed with indented pre content (proposed in bug 6200)
6251 !! wikitext
6252 <table>
6253 <tr>
6254 <td>
6255 Text that should be rendered preformatted
6256 </td>
6257 </tr>
6258 </table>
6259 !! html
6260 <table>
6261 <tr>
6262 <td>
6263 <pre>Text that should be rendered preformatted
6264 </pre>
6265 </td>
6266 </tr>
6267 </table>
6268
6269 !! end
6270
6271 !! test
6272 1. Template-generated table cell attributes and cell content
6273 !! wikitext
6274 {|
6275 |{{table_attribs}}
6276 | {{table_attribs}}
6277 || {{table_attribs_5}}
6278 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6279 |align=center {{table_attribs}}
6280 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6281 |}
6282 !! html
6283 <table>
6284 <tr>
6285 <td style="color:red;">Foo
6286 </td>
6287 <td style="color:red;">Foo
6288 </td>
6289 <td> style="color:red;"</td>
6290 <td>Bar
6291 </td>
6292 <td style="color:red;">Foo
6293 </td>
6294 <td align="center" style="color:red;">Foo
6295 </td>
6296 <td align="center" style="color:red;">Foo
6297 </td></tr></table>
6298
6299 !! end
6300
6301 !! test
6302 2. Template-generated table cell attributes and cell content
6303 !! wikitext
6304 {|
6305 |{{table_attribs_2}}
6306 |}
6307 !! html/php
6308 <table>
6309 <tr>
6310 <td style="color:red;">Foo
6311 </td>
6312 <td>Bar</td>
6313 <td>Baz
6314 </td></tr></table>
6315
6316 !! html/parsoid
6317 <table>
6318 <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>
6319 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6320 </tbody></table>
6321 !! end
6322
6323 !! test
6324 3. Template-generated table cell attributes and cell content
6325 !! wikitext
6326 {|
6327 !align=center {{table_header_cells}}
6328 |-
6329 |align=center {{table_cells}}
6330 |}
6331 !! html/php
6332 <table>
6333 <tr>
6334 <th align="center" style="color:red;">Foo</th>
6335 <th style="color:red;"><i>Bar</i></th>
6336 <th style="color:brown;"><i>Foo</i> and Baz
6337 </th></tr>
6338 <tr>
6339 <td align="center" style="color:red;">Foo</td>
6340 <td style="color:red;"><i>Bar</i></td>
6341 <td style="color:brown;"><i>Foo</i> and Baz
6342 </td></tr></table>
6343
6344 !! html/parsoid
6345 <table>
6346 <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>
6347 <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>
6348 </tbody></table>
6349 !! end
6350
6351 !! test
6352 4. Template-generated table cell attributes and cell content inside a templated table
6353 !! wikitext
6354 {{tbl-start}}
6355 !align=center {{table_header_cells}}
6356 |-
6357 |align=center {{table_cells}}
6358 {{tbl-end}}
6359 !! html/php
6360 <table>
6361 <tr>
6362 <th align="center" style="color:red;">Foo</th>
6363 <th style="color:red;"><i>Bar</i></th>
6364 <th style="color:brown;"><i>Foo</i> and Baz
6365 </th></tr>
6366 <tr>
6367 <td align="center" style="color:red;">Foo</td>
6368 <td style="color:red;"><i>Bar</i></td>
6369 <td style="color:brown;"><i>Foo</i> and Baz
6370 </td></tr></table>
6371
6372 !! html/parsoid
6373 <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}}]}'>
6374 <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>
6375 <tr>
6376 <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>
6377 </tbody></table>
6378 !! end
6379
6380 ## Edge case fix to prevent future regressions
6381 !! test
6382 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6383 !! wikitext
6384 {|
6385 |{{table_attribs_7}}
6386 |}
6387 <references />
6388 !! html/parsoid
6389 <table>
6390 <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>
6391 </tbody></table>
6392 <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>
6393 !! end
6394
6395 !! test
6396 Table with row followed by newlines and table heading
6397 !! wikitext
6398 {|
6399 |-
6400
6401 ! foo
6402 |}
6403 !! html
6404 <table>
6405
6406
6407 <tr>
6408 <th> foo
6409 </th></tr></table>
6410
6411 !! end
6412
6413 !! test
6414 Table with empty line following the start tag
6415 !! wikitext
6416 {|
6417
6418 |-
6419 | foo
6420 |}
6421 !! html
6422 <table>
6423
6424
6425 <tr>
6426 <td> foo
6427 </td></tr></table>
6428
6429 !! end
6430
6431 # FIXME: Preserve the attribute properly (with an empty string as value) in
6432 # the PHP parser. Parsoid implements the behavior below.
6433 !! test
6434 Table attributes with empty value
6435 !! wikitext
6436 {|
6437 | style=| hello
6438 |}
6439 !! html/parsoid
6440 <table>
6441 <tbody>
6442 <tr>
6443 <td style=""> hello
6444 </td></tr></tbody></table>
6445
6446 !! end
6447
6448 !! test
6449 Wikitext table with a lot of comments
6450 !! wikitext
6451 {|
6452 <!-- c0 -->
6453 | foo
6454 <!-- c1 -->
6455 |-<!-- c2 -->
6456 <!-- c3 -->
6457 |<!-- c4 -->
6458 <!-- c5 -->
6459 |}
6460 !! html
6461 <table>
6462 <tr>
6463 <td> foo
6464 </td></tr>
6465 <tr>
6466 <td>
6467 </td></tr></table>
6468
6469 !! end
6470
6471 !! test
6472 Wikitext table comments represented in parsoid dom
6473 !! wikitext
6474 {|<!--c1--><!--c2-->
6475 |-<!--c3-->
6476 | x
6477 |}
6478 !! html/php+tidy
6479 <table>
6480 <tr>
6481 <td>x</td>
6482 </tr>
6483 </table>
6484 !! html/parsoid
6485 <table><!--c1--><!--c2-->
6486 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6487 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6488 </tbody></table>
6489 !! end
6490
6491 !! test
6492 Wikitext table with double-line table cell
6493 !! wikitext
6494 {|
6495 |a
6496 b
6497 |}
6498 !! html
6499 <table>
6500 <tr>
6501 <td>a
6502 <p>b
6503 </p>
6504 </td></tr></table>
6505
6506 !! end
6507
6508 !! test
6509 Table cell with a single comment
6510 !! wikitext
6511 {|
6512 | <!-- c1 -->
6513 | a
6514 |}
6515 !! html
6516 <table>
6517 <tr>
6518 <td>
6519 </td>
6520 <td> a
6521 </td></tr></table>
6522
6523 !! end
6524
6525 !! test
6526 Table-cell after a comment-only-empty-line
6527 !! wikitext
6528 {|
6529 |a
6530 <!--c1-->
6531 <!--c2-->| b
6532 |}
6533 !! html
6534 <table>
6535 <tr>
6536 <td>a
6537 </td>
6538 <td> b
6539 </td></tr></table>
6540
6541 !! html/parsoid
6542 <table>
6543 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6544 <!--c1-->
6545 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6546 </tbody></table>
6547
6548 !! end
6549
6550 !! test
6551 Build table with {{!}}
6552 !! wikitext
6553 {{{!}} class="wikitable"
6554 ! header
6555 ! second header
6556 {{!}}- style="color:red;"
6557 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6558 {{!}}}
6559 !! html
6560 <table class="wikitable">
6561 <tr>
6562 <th> header
6563 </th>
6564 <th> second header
6565 </th></tr>
6566 <tr style="color:red;">
6567 <td> data </td>
6568 <td style="color:red;"> second data
6569 </td></tr></table>
6570
6571 !! end
6572
6573 !! test
6574 Build table with pipe as data
6575 !! wikitext
6576 {| class="wikitable"
6577 ! header
6578 ! second header
6579 |- style="color:red;"
6580 | data || style="color:red;" | second data
6581 |-
6582 | style="color:red;" | data with | || style="color:red;" | second data with |
6583 |-
6584 || data with | ||| second data with |
6585 |}
6586 !! html
6587 <table class="wikitable">
6588 <tr>
6589 <th> header
6590 </th>
6591 <th> second header
6592 </th></tr>
6593 <tr style="color:red;">
6594 <td> data </td>
6595 <td style="color:red;"> second data
6596 </td></tr>
6597 <tr>
6598 <td style="color:red;"> data with | </td>
6599 <td style="color:red;"> second data with |
6600 </td></tr>
6601 <tr>
6602 <td> data with | </td>
6603 <td> second data with |
6604 </td></tr></table>
6605
6606 !! end
6607
6608 !! test
6609 Build table with wikilink
6610 !! wikitext
6611 {| class="wikitable"
6612 ! header || second header
6613 |- style="color:red;"
6614 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6615 |-
6616 | data || second data [[Main Page|link|text with pipe]]
6617 |}
6618 !! html
6619 <table class="wikitable">
6620 <tr>
6621 <th> header </th>
6622 <th> second header
6623 </th></tr>
6624 <tr style="color:red;">
6625 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6626 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6627 </td></tr>
6628 <tr>
6629 <td> data </td>
6630 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6631 </td></tr></table>
6632
6633 !! end
6634
6635 # The expected HTML structure in this test is debatable. The PHP parser does
6636 # not parse this kind of table at all. The main focus for Parsoid is on
6637 # round-tripping, so this output is ok for now. TODO: revisit!
6638 !! test
6639 Wikitext table with html-syntax row
6640 !! wikitext
6641 {|
6642 |-
6643 <td>foo</td>
6644 |}
6645 !! html/parsoid
6646 <table>
6647 <tbody>
6648 <tr>
6649 <td>foo</td></tr></tbody></table>
6650 !! end
6651
6652 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6653 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6654 ## PHP parser, which tidy then compounds by fostering the content
6655 ## entirely out of the table. Parsoid recognizes the table context
6656 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6657 ## depends on PHP's treatment of broken table markup!
6658 !! test
6659 Implicit <td> after a |-
6660 !! options
6661 parsoid=wt2html,html2html
6662 !! wikitext
6663 {|
6664 |-
6665 a
6666 |}
6667 !! html/php
6668 <table>
6669
6670 a
6671 </table>
6672
6673 !! html/php+tidy
6674 <p>a</p>
6675 !! html/parsoid
6676 <table>
6677 <tr><td>a</td></tr>
6678 </table>
6679 !! end
6680
6681 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6682 !! test
6683 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6684 !! options
6685 parsoid=wt2html,html2html
6686 !! wikitext
6687 {|
6688 |-
6689 |
6690 a
6691 |-
6692 b
6693 |}
6694 !! html/php
6695 <table>
6696
6697 <tr>
6698 <td>
6699 <pre>a
6700 </pre>
6701 </td></tr>
6702 b
6703 </table>
6704
6705 !! html/php+tidy
6706 <p>b</p>
6707 <table>
6708 <tr>
6709 <td>
6710 <pre>
6711 a
6712 </pre></td>
6713 </tr>
6714 </table>
6715 !! html/parsoid
6716 <table>
6717 <tbody>
6718 <tr><td><pre>a</pre></td></tr>
6719 <tr><td> b</td></tr>
6720 </tbody>
6721 </table>
6722 !! end
6723
6724 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6725 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6726 !! test
6727 Lists should be recognized in an implicit <td> context
6728 !! options
6729 parsoid=wt2html,html2html
6730 !! wikitext
6731 {|
6732 |-
6733 *a
6734 |}
6735 !! html/php
6736 <table>
6737
6738 <ul><li>a</li></ul>
6739 </table>
6740
6741 !! html/php+tidy
6742 <ul>
6743 <li>a</li>
6744 </ul>
6745 !! html/parsoid
6746 <table>
6747 <tr>
6748 <td><ul>
6749 <li>a</li>
6750 </ul></td>
6751 </tr>
6752 </table>
6753 !! end
6754
6755 !! test
6756 Table cells not properly parsed in an implicit-td context
6757 !! wikitext
6758 {|
6759 |-
6760 {{table_attribs_4}} || a || b
6761 |}
6762 !! html/php+tidy
6763 <table>
6764 <tr>
6765 <td style="background-color:#DC241f;" width="10px"></td>
6766 <td>a</td>
6767 <td>b</td>
6768 </tr>
6769 </table>
6770 !! html/parsoid
6771 <table>
6772 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6773 <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>
6774 </tbody></table>
6775 !! end
6776
6777 !! test
6778 Parsoid: Round-trip tables directly followed by content (bug 51219)
6779 !! options
6780 parsoid=wt2html,wt2wt
6781 !! wikitext
6782 {|
6783 |foo
6784 |} bar
6785
6786 {|
6787 |baz
6788 |}<b>quux</b>
6789 !! html+tidy
6790 <table>
6791 <tr>
6792 <td>foo</td>
6793 </tr>
6794 </table>
6795 <p>bar</p>
6796 <table>
6797 <tr>
6798 <td>baz</td>
6799 </tr>
6800 </table>
6801 <p><b>quux</b></p>
6802 !! end
6803
6804 !! test
6805 Parsoid: Default to a newline after tables in new content (bug 51219)
6806 !! options
6807 parsoid=html2wt
6808 !! html/parsoid
6809 <table><tbody>
6810 <tr><td>foo</td></tr></tbody></table> bar
6811 <table><tbody>
6812 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6813 !! wikitext
6814 {|
6815 |foo
6816 |}
6817 <nowiki> </nowiki>bar
6818 {|
6819 |baz
6820 |}
6821 '''quux'''
6822 !! end
6823
6824 !! test
6825 Parsoid: newline inducing block nodes don't suppress <nowiki>
6826 !! options
6827 parsoid=html2wt
6828 !! html/parsoid
6829 a<h1>foo</h1>
6830 !! wikitext
6831 <nowiki> </nowiki>a
6832
6833 = foo =
6834 !! end
6835
6836 !! test
6837 Parsoid: Row-syntax table headings followed by comment & table cells
6838 !! options
6839 parsoid=wt2html,wt2wt
6840 !! wikitext
6841 {|
6842 ! foo || bar
6843 <!-- foo --> || baz || quux
6844 |}
6845 !! html/php
6846 <table>
6847 <tr>
6848 <th> foo </th>
6849 <th> bar
6850 </th>
6851 <td> baz </td>
6852 <td> quux
6853 </td></tr></table>
6854
6855 !! html/parsoid
6856 <table>
6857 <tbody><tr><th> foo </th><th> bar
6858 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
6859 </tbody></table>
6860 !! end
6861
6862
6863 # PHP throws away the (semi-broken) "foo" class here; Parsoid
6864 # preserves it.
6865 !!test
6866 Parsoid: Recover better from broken table attributes
6867 !!options
6868 parsoid=wt2html
6869 !!wikitext
6870 {| class="foo
6871 | class="bar" |
6872 foo
6873 |}
6874 !!html/php+tidy
6875 <table>
6876 <tr>
6877 <td class="bar">
6878 <p>foo</p>
6879 </td>
6880 </tr>
6881 </table>
6882 !!html/parsoid
6883 <table class="foo">
6884 <tr>
6885 <td class="bar">
6886 <p>foo</p></td></tr>
6887 </tbody></table>
6888 !!end
6889
6890 !! test
6891 Strip unsupported table tags
6892 !! options
6893 parsoid=html2wt
6894 !! html/parsoid
6895 <table>
6896 <thead>
6897 <tr>
6898 <th>Month</th>
6899 <th>Savings</th>
6900 </tr>
6901 </thead>
6902 <tbody>
6903 <tr>
6904 <td>January</td>
6905 <td>$100</td>
6906 </tr>
6907 <tr>
6908 <td>February</td>
6909 <td>$80</td>
6910 </tr>
6911 </tbody>
6912 <tfoot>
6913 <tr>
6914 <td>Sum</td>
6915 <td>$180</td>
6916 </tr>
6917 </tfoot>
6918 </table>
6919 !! wikitext
6920 {|
6921
6922 !Month
6923 !Savings
6924
6925 |January
6926 |$100
6927
6928 |-
6929 |February
6930 |$80
6931
6932 |Sum
6933 |$180
6934
6935 |}
6936 !! end
6937
6938 !!test
6939 Testing serialization after deletion of table cells
6940 !!options
6941 parsoid={
6942 "modes": ["wt2wt", "selser"],
6943 "changes": [
6944 ["#x", "remove"]
6945 ]
6946 }
6947 !!wikitext
6948 {|
6949 !h1 !!h2 !!h3
6950 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
6951 |}
6952 !! wikitext/edited
6953 {|
6954 !h1 !!h2 !!h3
6955 |c2 |||c3
6956 |}
6957 !!end
6958
6959 ###
6960 ### Internal links
6961 ###
6962 !! test
6963 Plain link, capitalized
6964 !! wikitext
6965 [[Main Page]]
6966 !! html
6967 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6968 </p>
6969 !! end
6970
6971 !! test
6972 Plain link, uncapitalized
6973 !! wikitext
6974 [[main Page]]
6975 !! html
6976 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
6977 </p>
6978 !! end
6979
6980 !! test
6981 Piped link
6982 !! wikitext
6983 [[Main Page|The Main Page]]
6984 !! html
6985 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6986 </p>
6987 !! end
6988
6989 !! test
6990 Piped link with comment in link text
6991 !! wikitext
6992 [[Main Page|The Main<!--front--> Page]]
6993 !! html
6994 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6995 </p>
6996 !! end
6997
6998 !! test
6999 Piped link with multiple pipe characters in link text
7000 !! wikitext
7001 [[Main Page||The|Main|Page|]]
7002 !! html/php
7003 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7004 </p>
7005 !! html/parsoid
7006 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7007 !! end
7008
7009 !! test
7010 Broken link
7011 !! wikitext
7012 [[Zigzagzogzagzig]]
7013 !! html
7014 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7015 </p>
7016 !! end
7017
7018 !! test
7019 Broken link with fragment
7020 !! wikitext
7021 [[Zigzagzogzagzig#zug]]
7022 !! html
7023 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7024 </p>
7025 !! end
7026
7027 !! test
7028 Special page link with fragment
7029 !! wikitext
7030 [[Special:Version#anchor]]
7031 !! html
7032 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7033 </p>
7034 !! end
7035
7036 !! test
7037 Nonexistent special page link with fragment
7038 !! wikitext
7039 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7040 !! html
7041 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7042 </p>
7043 !! end
7044
7045 !! test
7046 Link with prefix
7047 !! wikitext
7048 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7049 !! html
7050 <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>
7051 </p>
7052 !! end
7053
7054 !! test
7055 Link with suffix
7056 !! wikitext
7057 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7058 !! html
7059 <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>!!!
7060 </p>
7061 !! end
7062
7063 !! article
7064 prefixed article
7065 !! text
7066 Some text
7067 !! endarticle
7068
7069 !! test
7070 Bug 43661: Piped links with identical prefixes
7071 !! wikitext
7072 [[prefixed article|prefixed articles with spaces]]
7073
7074 [[prefixed article|prefixed articlesaoeu]]
7075
7076 [[Main Page|Main Page test]]
7077 !! html
7078 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7079 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7080 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7081 </p>
7082 !! end
7083
7084
7085 !! test
7086 Link with HTML entity in suffix / tail
7087 !! wikitext
7088 [[Main Page]]&quot;, [[Main Page]]&#97;
7089 !! html/php
7090 <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;
7091 </p>
7092 !! html/parsoid
7093 <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>
7094 !! end
7095
7096 !! test
7097 Link with 3 brackets
7098 !! wikitext
7099 [[[Main Page]]]
7100 !! html
7101 <p>[[[Main Page]]]
7102 </p>
7103 !! end
7104
7105 !! test
7106 Link with 4 brackets
7107 !! wikitext
7108 [[[[Main Page]]]]
7109 !! html
7110 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7111 </p>
7112 !! end
7113
7114 !! test
7115 Piped link with 3 brackets
7116 !! wikitext
7117 [[[main page|the main page]]]
7118 !! html
7119 <p>[[[main page|the main page]]]
7120 </p>
7121 !! end
7122
7123 !! test
7124 Piped link with extlink-like text
7125 !! wikitext
7126 [[Main Page|[bar]]]
7127 [[Main Page|This is a [bar]]]
7128 !! html/php
7129 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7130 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7131 </p>
7132 !! html/parsoid
7133 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7134 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7135 !! end
7136
7137 !! test
7138 Link with multiple pipes
7139 !! wikitext
7140 [[Main Page|The|Main|Page]]
7141 !! html
7142 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7143 </p>
7144 !! end
7145
7146 # Note that parsoid does not munge anchor text; all non-space
7147 # characters are valid in HTML5 ids.
7148 !! test
7149 Anchor containing a #. (bug 63430)
7150 !! wikitext
7151 [[Main Page#And#Link]]
7152 !! html/php
7153 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7154 </p>
7155 !! html/parsoid
7156 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
7157 !! end
7158
7159 !! test
7160 Link to namespaces
7161 !! wikitext
7162 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7163 !! html
7164 <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>
7165 </p>
7166 !! end
7167
7168 !! test
7169 Link with space in namespace
7170 !! wikitext
7171 [[User talk:Foo bar]]
7172 !! html
7173 <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>
7174 </p>
7175 !! end
7176
7177 !! article
7178 MemoryAlpha:AlphaTest
7179 !! text
7180 This is an article in the MemoryAlpha namespace
7181 (which shadows the memoryalpha interwiki link).
7182 !! endarticle
7183
7184 !! test
7185 Namespace takes precedence over interwiki link (bug 51680)
7186 !! wikitext
7187 [[MemoryAlpha:AlphaTest]]
7188 !! html
7189 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7190 </p>
7191 !! end
7192
7193 # The previous test doesn't work correctly in html2*, due to not recognizing the
7194 # link as an internal one. This one checks for the correct behavior.
7195 !! test
7196 Link to namespace preferred over interwiki with correct rel attribute
7197 !! options
7198 parsoid=html2wt,html2html
7199 !! html/parsoid
7200 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7201 !! wikitext
7202 [[MemoryAlpha:AlphaTest]]
7203 !! end
7204
7205 !! test
7206 Piped link to namespace
7207 !! wikitext
7208 [[Meta:Disclaimers|The disclaimers]]
7209 !! html
7210 <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>
7211 </p>
7212 !! end
7213
7214 !! test
7215 Link containing }
7216 !! wikitext
7217 [[Usually caused by a typo (oops}]]
7218 !! html
7219 <p>[[Usually caused by a typo (oops}]]
7220 </p>
7221 !! end
7222
7223 !! article
7224 7% Solution
7225 !! text
7226 Just a test of an article title containing a percent.
7227 !! endarticle
7228
7229 !! test
7230 Link containing % (not as a hex sequence)
7231 !! wikitext
7232 [[7% Solution]]
7233 !! html/php
7234 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7235 </p>
7236 !! html/parsoid
7237 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7238 !! end
7239
7240 # note that the parsoid HTML is identical to the previous test output,
7241 # so the previous test ensures that the html2wt mode will generate the
7242 # "not as a hex sequence" wikitext.
7243 !! test
7244 Link containing % as a single hex sequence interpreted to char
7245 !! options
7246 parsoid=wt2wt,wt2html,html2html
7247 !! wikitext
7248 [[7%25 Solution]]
7249 !! html/php
7250 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7251 </p>
7252 !! html/parsoid
7253 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7254 !!end
7255
7256 !! test
7257 Link containing % as a double hex sequence interpreted to hex sequence
7258 !! wikitext
7259 [[7%2525 Solution]]
7260 !! html
7261 <p>[[7%2525 Solution]]
7262 </p>
7263 !!end
7264
7265 # note that parsoid does not munge anchor text; all non-space
7266 # characters are valid in HTML5 anchors.
7267 !! test
7268 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7269 Example for such a section: == < ==
7270 !! wikitext
7271 [[%23%3c]][[%23%3e]]
7272 !! html/php
7273 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7274 </p>
7275 !! html/parsoid
7276 <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>
7277 !! end
7278
7279 !! test
7280 Link containing "<#" and ">#" as a hex sequences
7281 !! wikitext
7282 [[%3c%23]][[%3e%23]]
7283 !! html
7284 <p>[[%3c%23]][[%3e%23]]
7285 </p>
7286 !! end
7287
7288 !! test
7289 Link containing an equals sign
7290 !! wikitext
7291 [[Special:BookSources/isbn=4-00-026157-6]]
7292 !! html/php
7293 <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>
7294 </p>
7295 !! html/parsoid
7296 <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>
7297 !! end
7298
7299 !! article
7300 Foo~bar
7301 !! text
7302 Just a test of an article title containing a tilde.
7303 !! endarticle
7304
7305 # note that links containing signatures, like [[Foo~~~~]], are
7306 # massaged by the pre-save transform (PST) and so the tildes are never
7307 # seen by the parser.
7308 !! test
7309 Link containing a tilde
7310 !! wikitext
7311 [[Foo~bar]]
7312 !! html/php
7313 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7314 </p>
7315 !! html/parsoid
7316 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7317 !! end
7318
7319 !! test
7320 Link containing double-single-quotes '' (bug 4598)
7321 !! wikitext
7322 [[Lista d''e paise d''o munno]]
7323 !! html/php
7324 <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>
7325 </p>
7326 !! html/parsoid
7327 <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>
7328 !! end
7329
7330 !! test
7331 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7332 !! wikitext
7333 Some [[Link|pretty ''italics'' and stuff]]!
7334 !! html/php
7335 <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>!
7336 </p>
7337 !! html/parsoid
7338 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7339 !! end
7340
7341 !! test
7342 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7343 !! wikitext
7344 ''Some [[Link|pretty ''italics'' and stuff]]!''
7345 !! html
7346 <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>
7347 </p>
7348 !! end
7349
7350 !! test
7351 Link with double quotes in title part (literal) and alternate part (interpreted)
7352 !! wikitext
7353 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7354
7355 [[''Pentecoste'']]
7356
7357 [[''Pentecoste''|Pentecoste]]
7358
7359 [[''Pentecoste''|''Pentecoste'']]
7360 !! html/php
7361 <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>
7362 </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>
7363 </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>
7364 </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>
7365 </p>
7366 !! html/parsoid
7367 <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>
7368 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7369 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7370 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7371 !! end
7372
7373 !! test
7374 Broken image links with HTML captions (bug 39700)
7375 !! wikitext
7376 [[File:Nonexistent|<script></script>]]
7377 [[File:Nonexistent|100x100px|<script></script>]]
7378 [[File:Nonexistent|&lt;]]
7379 [[File:Nonexistent|a<i>b</i>c]]
7380 !! html/php
7381 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7382 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7383 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7384 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7385 </p>
7386 !! html/parsoid
7387 <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>
7388 <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>
7389 <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>
7390 <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>
7391 !! end
7392
7393 !! test
7394 Plain link to URL
7395 !! wikitext
7396 [[http://www.example.com]]
7397 !! html/php
7398 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7399 </p>
7400 !! html/parsoid
7401 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7402 !! end
7403
7404 !! test
7405 Plain link to URL with link text
7406 !! wikitext
7407 [[http://www.example.com Link text]]
7408 !! html
7409 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7410 </p>
7411 !! end
7412
7413 !! test
7414 Plain link to protocol-relative URL
7415 !! wikitext
7416 [[//www.example.com]]
7417 !! html/php
7418 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7419 </p>
7420 !! html/parsoid
7421 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7422 !! end
7423
7424 !! test
7425 Plain link to protocol-relative URL with link text
7426 !! wikitext
7427 [[//www.example.com Link text]]
7428 !! html
7429 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7430 </p>
7431 !! end
7432
7433 !! test
7434 Plain link to page with question mark in title
7435 !! wikitext
7436 [[A?b]]
7437
7438 [[A?b|Baz]]
7439 !! html
7440 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7441 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7442 </p>
7443 !! end
7444
7445
7446 # I'm fairly sure the expected result here is wrong.
7447 # We want these to be URL links, not pseudo-pages with URLs for titles....
7448 # However the current output is also pretty screwy.
7449 #
7450 # ----
7451 # I'm changing it to match the current output--it arguably makes more
7452 # sense in the light of the test above. Old expected result was:
7453 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7454 #</p>
7455 # But I think this test is bordering on "garbage in, garbage out" anyway.
7456 # -- wtm
7457 !! test
7458 Piped link to URL
7459 !! wikitext
7460 Piped link to URL: [[http://www.example.com|an example URL]]
7461 !! html/php
7462 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7463 </p>
7464 !! html/parsoid
7465 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7466 !! end
7467
7468 !! test
7469 BUG 2: [[page|http://url/]] should link to page, not http://url/
7470 !! wikitext
7471 [[Main Page|http://url/]]
7472 !! html/php
7473 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7474 </p>
7475 !! html/parsoid
7476 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7477 !! end
7478
7479 # Parsoid does not mark self-links, by design.
7480 !! test
7481 BUG 337: Escaped self-links should be bold
7482 !! options
7483 title=[[Bug462]]
7484 !! wikitext
7485 [[Bu&#103;462]] [[Bug462]]
7486 !! html/php
7487 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7488 </p>
7489 !! html/php+tidy
7490 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7491 !! html/parsoid
7492 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7493 !! end
7494
7495 !! test
7496 Self-link to section should not be bold
7497 !! options
7498 title=[[Main Page]]
7499 !! wikitext
7500 [[Main Page#section]]
7501 !! html
7502 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7503 </p>
7504 !! end
7505
7506 !! article
7507 00
7508 !! text
7509 This is 00.
7510 !! endarticle
7511
7512 !!test
7513 Self-link to numeric title
7514 !!options
7515 title=[[0]]
7516 !! wikitext
7517 [[0]]
7518 !! html
7519 <p><strong class="selflink">0</strong>
7520 </p>
7521 !!end
7522
7523 !!test
7524 Link to numeric-equivalent title
7525 !!options
7526 title=[[0]]
7527 !! wikitext
7528 [[00]]
7529 !! html
7530 <p><a href="/wiki/00" title="00">00</a>
7531 </p>
7532 !!end
7533
7534 !! test
7535 <nowiki> inside a link
7536 !! wikitext
7537 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7538 !! html
7539 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7540 </p>
7541 !! end
7542
7543 !! test
7544 Non-breaking spaces in title
7545 !! wikitext
7546 [[&nbsp; Main &nbsp; Page &nbsp;]]
7547 !! html
7548 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7549 </p>
7550 !!end
7551
7552 !! test
7553 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7554 !! options
7555 language=ca
7556 !! wikitext
7557 '''[[Main Page]]'''
7558 !! html
7559 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7560 </p>
7561 !! end
7562
7563 !! test
7564 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7565 !! options
7566 language=ca
7567 !! wikitext
7568 ''[[Main Page]]''
7569 !! html
7570 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7571 </p>
7572 !! end
7573
7574 !! test
7575 Internal link with en linktrail: no apostrophes (bug 27473)
7576 !! options
7577 language=en
7578 !! wikitext
7579 [[Something]]'nice
7580 !! html
7581 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
7582 </p>
7583 !! end
7584
7585 !! test
7586 Internal link with ca linktrail with apostrophes (bug 27473)
7587 !! options
7588 language=ca
7589 !! wikitext
7590 [[Something]]'nice
7591 !! html
7592 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
7593 </p>
7594 !! end
7595
7596 !! test
7597 Internal link with kaa linktrail with apostrophes (bug 27473)
7598 !! options
7599 language=kaa
7600 !! wikitext
7601 [[Something]]'nice
7602 !! html
7603 <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>
7604 </p>
7605 !! end
7606
7607 !! test
7608 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
7609 !! wikitext
7610 [[User:Foo/Test/63636:Bar|Test]]
7611 !! html/php
7612 <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>
7613 </p>
7614 !! html/parsoid
7615 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
7616 !! end
7617
7618 !! test
7619 Purely hash wikilink
7620 !! options
7621 title=[[User:test/123]]
7622 !! wikitext
7623 [[#a|b]]
7624 !! html/php
7625 <p><a href="#a">b</a>
7626 </p>
7627 !! html/parsoid
7628 <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>
7629 !! end
7630
7631 !! test
7632 1. Interaction of linktrail and template encapsulation
7633 !! options
7634 parsoid
7635 !! wikitext
7636 {{echo|[[Foo]]}}l
7637 !! html
7638 <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>
7639 !! end
7640
7641 !! test
7642 2. Interaction of linktrail and template encapsulation
7643 !! options
7644 parsoid
7645 !! wikitext
7646 {{echo|Some [[Fool]]}}s
7647 !! html
7648 <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>
7649 !! end
7650
7651 !! test
7652 3. Interaction of linktrail and template encapsulation
7653 !! options
7654 parsoid
7655 !! wikitext
7656 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
7657 !! html
7658 <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>
7659 !! end
7660
7661 !! article
7662 Söfnuður
7663 !! text
7664 Test.
7665 !! endarticle
7666
7667 !! test
7668 Internal link with is link prefix
7669 !! options
7670 language=is
7671 !! wikitext
7672 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
7673 !! html
7674 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
7675 </p>
7676 !! end
7677
7678 !! article
7679 Mótmælendatrú
7680 !! text
7681 Test.
7682 !! endarticle
7683
7684 !! test
7685 Internal link with is link trail and link prefix
7686 !! options
7687 language=is
7688 !! wikitext
7689 [[mótmælendatrú|xxx]]ar
7690 [[mótmælendatrú]]ar
7691 mótmælenda[[söfnuður]]
7692 mótmælenda[[söfnuður|söfnuðir]]
7693 mótmælenda[[söfnuður|söfnuðir]]xxx
7694 !! html
7695 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
7696 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
7697 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
7698 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
7699 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
7700 </p>
7701 !! end
7702
7703 !! test
7704 Parsoid link trail escaping
7705 !! options
7706 parsoid=html2wt,html2html
7707 !! html/parsoid
7708 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
7709 !! wikitext
7710 [[apple]]<nowiki/>s
7711 !! end
7712
7713 !! test
7714 Parsoid link prefix escaping
7715 !! options
7716 language=is
7717 parsoid=html2wt,html2html
7718 !! html/parsoid
7719 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
7720 !! wikitext
7721 Aðrir mótmælenda<nowiki/>[[söfnuður]]
7722 !! end
7723
7724 !! test
7725 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
7726 !! wikitext
7727 [[Foo| bar]]
7728
7729 [[Foo| ''bar'']]
7730
7731 [http://wp.org foo]
7732
7733 [http://wp.org ''foo'']
7734 !! html
7735 <p><a href="/wiki/Foo" title="Foo"> bar</a>
7736 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
7737 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
7738 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
7739 </p>
7740 !! end
7741
7742 !! test
7743 Parsoid: Scoped parsing should handle mixed transclusions and plain text
7744 !! options
7745 parsoid
7746 !! wikitext
7747 [[Foo|{{echo|a}} b {{echo|c}}]]
7748 !! html
7749 <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>
7750 !! end
7751
7752 !! test
7753 Link with angle bracket after anchor
7754 !! wikitext
7755 [[Foo#<bar>]]
7756 !! html/php
7757 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
7758 </p>
7759 !! html/parsoid
7760 <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>
7761 !! end
7762
7763 ###
7764 ### Interwiki links (see maintenance/interwiki.sql)
7765 ###
7766
7767 !! test
7768 Inline interwiki link
7769 !! options
7770 parsoid=wt2html,wt2wt,html2html
7771 !! wikitext
7772 [[MeatBall:SoftSecurity]]
7773 !! html/php
7774 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
7775 </p>
7776 !! html/parsoid
7777 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
7778 !! end
7779
7780 !! test
7781 Inline interwiki link with empty title (bug 2372)
7782 !! options
7783 parsoid=wt2html,wt2wt,html2html
7784 !! wikitext
7785 [[MeatBall:]]
7786 !! html/php
7787 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
7788 </p>
7789 !! html/parsoid
7790 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
7791 !! end
7792
7793 !! test
7794 Interwiki link encoding conversion (bug 1636)
7795 !! wikitext
7796 *[[Wikipedia:ro:Olteni&#0355;a]]
7797 *[[Wikipedia:ro:Olteni&#355;a]]
7798 !! html
7799 <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>
7800 <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>
7801
7802 !! html+tidy
7803 <ul>
7804 <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>
7805 <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>
7806 </ul>
7807 !! end
7808
7809 !! test
7810 Interwiki link with fragment (bug 2130)
7811 !! wikitext
7812 [[MeatBall:SoftSecurity#foo]]
7813 !! html
7814 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
7815 </p>
7816 !! end
7817
7818 # Ideally the wikipedia: prefix here should be proto-relative too
7819 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
7820 # define the 'en' prefix, and originally the test used 'wikipedia',
7821 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
7822 # article.
7823 !! test
7824 Different interwiki prefixes mapping to the same URL
7825 !! wikitext
7826 [[:en:Foo]]
7827
7828 [[:en:Foo|Foo]]
7829
7830 [[wikipedia:Foo]]
7831
7832 [[:wikipedia:Foo|Foo]]
7833
7834 [[wikipedia:en:Foo]]
7835
7836 [[:wikipedia:en:Foo]]
7837
7838 [[ wikiPEdia :Foo]]
7839 !! html/parsoid
7840 <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>
7841
7842 <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>
7843
7844 <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>
7845
7846 <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>
7847
7848 <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>
7849
7850 <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>
7851
7852 <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>
7853 !! end
7854
7855 !! test
7856 Interwiki links that cannot be represented in wiki syntax
7857 !! wikitext
7858 [[meatball:ok]]
7859 [[meatball:ok#foo|ok with fragment]]
7860 [[meatball:ok_as_well?|ok ending with ? mark]]
7861 [http://de.wikipedia.org/wiki/Foo?action=history has query]
7862 [http://de.wikipedia.org/wiki/#foo is just fragment]
7863
7864 !! html/php
7865 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
7866 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
7867 <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>
7868 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7869 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
7870 </p>
7871 !! html/parsoid
7872 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
7873 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
7874 <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>
7875 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7876 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
7877 !! end
7878
7879 !! test
7880 Interwiki links: trail
7881 !! wikitext
7882 [[wikipedia:Foo|Ba]]r
7883 !! html/php
7884 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
7885 </p>
7886 !! html/parsoid
7887 <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>
7888 !! end
7889
7890 !! test
7891 Local interwiki link
7892 !! options
7893 parsoid=wt2html,wt2wt,html2html
7894 !! wikitext
7895 [[local:Template:Foo]]
7896 !! html/php
7897 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
7898 </p>
7899 !! html/parsoid
7900 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
7901 !! end
7902
7903 # Parsoid does not mark self-links, by design.
7904 !! test
7905 Local interwiki link: self-link to current page
7906 !! options
7907 title=[[Main Page]]
7908 parsoid=wt2html,wt2wt,html2html
7909 !! wikitext
7910 [[local:Main Page]]
7911 !! html/php
7912 <p><strong class="selflink">local:Main Page</strong>
7913 </p>
7914 !! html/parsoid
7915 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
7916 !! end
7917
7918 !! test
7919 Local interwiki link: prefix only (bug 64167)
7920 !! options
7921 parsoid=wt2html,wt2wt,html2html
7922 !! wikitext
7923 [[local:]]
7924 !! html/php
7925 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
7926 </p>
7927 !! html/parsoid
7928 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
7929 !! end
7930
7931 !! test
7932 Local interwiki link: with additional interwiki prefix (bug 61357)
7933 !! options
7934 parsoid=wt2html,wt2wt,html2html
7935 !! wikitext
7936 [[local:meatball:Hello]]
7937 !! html/php
7938 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
7939 </p>
7940 !! html/parsoid
7941 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
7942 !! end
7943
7944 !! test
7945 Multiple local interwiki link prefixes
7946 !! wikitext
7947 [[local:local:local:local:mi:local:Foo]]
7948 !! options
7949 parsoid=wt2html,wt2wt,html2html
7950 !! html/php
7951 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
7952 </p>
7953 !! html/parsoid
7954 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
7955 !! end
7956
7957 ###
7958 ### Interlanguage links
7959 ### Language links (so that searching for '### language' matches..)
7960 ###
7961
7962 !! test
7963 Interlanguage link
7964 !! options
7965 parsoid=wt2html,wt2wt,html2html
7966 !! wikitext
7967 Blah blah blah
7968 [[zh:Chinese]]
7969 !! html/php
7970 <p>Blah blah blah
7971 </p>
7972 !! html/parsoid
7973 <p>Blah blah blah</p>
7974 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7975 !! end
7976
7977 !! test
7978 Interlanguage link with spacing
7979 !! options
7980 parsoid=wt2html,wt2wt,html2html
7981 !! wikitext
7982 Blah blah blah
7983 [[ zh : Chinese ]]
7984 !! html/php
7985 <p>Blah blah blah
7986 </p>
7987 !! html/parsoid
7988 <p>Blah blah blah</p>
7989 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7990 !! end
7991
7992 !! test
7993 Double interlanguage link
7994 !! options
7995 parsoid=wt2html,wt2wt,html2html
7996 !! wikitext
7997 Blah blah blah
7998 [[es:Spanish]]
7999 [[zh:Chinese]]
8000 !! html/php
8001 <p>Blah blah blah
8002 </p>
8003 !! html/parsoid
8004 <p>Blah blah blah</p>
8005 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8006 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8007 !! end
8008
8009 !! test
8010 Interlanguage link variations
8011 !! options
8012 parsoid=wt2html,wt2wt,html2html
8013 !! wikitext
8014 Blah blah blah
8015 [[ es :Spanish]]
8016 [[ ZH :Chinese]]
8017 [[es:Foo_bar]]
8018 !! html/php
8019 <p>Blah blah blah
8020 </p>
8021 !! html/parsoid
8022 <p>Blah blah blah</p>
8023 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8024 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8025 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8026 !! end
8027
8028 !! test
8029 Space and question mark encoding in interlanguage links (T95473)
8030 !! options
8031 parsoid=wt2html,wt2wt,html2html
8032 !! wikitext
8033 Blah blah blah
8034 [[es:Foo bar?]]
8035 !! html/php
8036 <p>Blah blah blah
8037 </p>
8038 !! html/parsoid
8039 <p>Blah blah blah</p>
8040 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8041 !! end
8042
8043 !! test
8044 Interlanguage link, with prefix links
8045 !! options
8046 language=ln
8047 !! wikitext
8048 Blah blah blah
8049 [[zh:Chinese]]
8050 !! html/php
8051 <p>Blah blah blah
8052 </p>
8053 !! html/parsoid
8054 <p>Blah blah blah</p>
8055 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8056 !! end
8057
8058 !! test
8059 Double interlanguage link, with prefix links (bug 8897)
8060 !! options
8061 language=ln
8062 !! wikitext
8063 Blah blah blah
8064 [[es:Spanish]]
8065 [[zh:Chinese]]
8066 !! html/php
8067 <p>Blah blah blah
8068 </p>
8069 !! html/parsoid
8070 <p>Blah blah blah</p>
8071 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8072 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8073 !! end
8074
8075 !! test
8076 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8077 !! wikitext
8078 Blah blah blah
8079 [[mul:Article]]
8080 !! html/php
8081 <p>Blah blah blah
8082 </p>
8083 !! html/parsoid
8084 <p>Blah blah blah</p>
8085 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8086 !! end
8087
8088 !! test
8089 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8090 !! options
8091 language=ln
8092 !! wikitext
8093 [[WW&nbsp;II]]
8094 !! html
8095 <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>
8096 </p>
8097 !! end
8098
8099 !! test
8100 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8101 !! options
8102 parsoid=html2wt
8103 !! html/parsoid
8104 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8105 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8106 !! wikitext
8107 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8108
8109 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
8110 !! end
8111
8112 !! test
8113 Parsoid: handle constructor well
8114 !! wikitext
8115 [[constructor]]
8116
8117 [[constructor:foo]]
8118 !! html/php
8119 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8120 </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>
8121 </p>
8122 !! html/parsoid
8123 <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>
8124
8125 <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>
8126 !! end
8127
8128 !! article
8129 ko:
8130 !! text
8131 Test.
8132 !! endarticle
8133
8134 # Note that `ko` isn't a known interlanguage prefix
8135 !! test
8136 Parsoid: recognize interlanguage links without a target page
8137 !! options
8138 ill
8139 !! wikitext
8140 [[es:]]
8141
8142 [[ko:]]
8143 !! html/php
8144 es:
8145 !! html/parsoid
8146 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8147
8148 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8149 !! end
8150
8151 # Note that `ko` isn't a known interwiki prefix
8152 !! test
8153 Parsoid: recognize interwiki links without a target page
8154 !! options
8155 parsoid=wt2html,wt2wt,html2html
8156 !! wikitext
8157 [[:es:]]
8158
8159 [[:ko:]]
8160 !! html/php
8161 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8162 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8163 </p>
8164 !! html/parsoid
8165 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8166 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8167 !! end
8168
8169 !! test
8170 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8171 !! wikitext
8172 [[mi:Foo]]
8173 !! html/php
8174 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8175 </p>
8176 !! html/parsoid
8177 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8178 !! end
8179
8180 !! test
8181 Interlanguage link with preceding local interwiki link (bug 68085)
8182 !! options
8183 parsoid=wt2html,wt2wt,html2html
8184 !! wikitext
8185 Blah blah blah
8186 [[local:es:Spanish]]
8187 !! html/php
8188 <p>Blah blah blah
8189 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8190 </p>
8191 !! html/parsoid
8192 <p>Blah blah blah
8193 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8194 !! end
8195
8196 !! test
8197 Looks like an interlanguage link, but is actually a local interwiki
8198 !! options
8199 parsoid=wt2html,wt2wt,html2html
8200 !! wikitext
8201 Blah blah blah
8202 [[mi:Template:Foo]]
8203 !! html/php
8204 <p>Blah blah blah
8205 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8206 </p>
8207 !! html/parsoid
8208 <p>Blah blah blah
8209 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8210 !! end
8211
8212 ###
8213 ### Redirects, Parsoid-only
8214 ###
8215
8216 !! test
8217 1. Simple redirect to page
8218 !! wikitext
8219 #REDIRECT [[Main Page]]
8220 !! html/parsoid
8221 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8222 !! end
8223
8224 !! test
8225 2. Other redirect variants
8226 !! wikitext
8227 #REDIRECT [[Main_Page]]
8228 !! html/parsoid
8229 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8230 !! end
8231
8232 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8233 # This tests the Parsoid bail-out code.
8234 !! test
8235 3. Other redirect variants
8236 !! wikitext
8237 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8238 !! html/parsoid
8239 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8240 !! end
8241
8242 !! test
8243 4. Redirect to a templated destination
8244 !! wikitext
8245 #REDIRECT [[{{echo|Foo}}bar]]
8246 !! html/parsoid
8247 <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"}]]}'/>
8248 !! end
8249
8250 !! test
8251 Empty redirect
8252 !! options
8253 parsoid=wt2html,wt2wt
8254 !! wikitext
8255 #REDIRECT [[]]
8256 !! html/parsoid
8257 <ol>
8258 <li>REDIRECT [[]]</li></ol>
8259 !! end
8260
8261 !! test
8262 Optional colon in #REDIRECT
8263 !! options
8264 # the colon is archaic syntax. we support it for wt2html, but we
8265 # don't care that it roundtrips back to the modern syntax.
8266 parsoid=wt2html,html2html
8267 !! wikitext
8268 #REDIRECT:[[Main Page]]
8269 !! html/parsoid
8270 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8271 !! end
8272
8273 !! test
8274 Whitespace in #REDIRECT with optional colon
8275 !! options
8276 # the colon and gratuitous whitespace is archaic syntax. we support
8277 # it for wt2html, but we don't care that it roundtrips back to the
8278 # modern syntax (without extra whitespace)
8279 parsoid=wt2html,html2html
8280 !! wikitext
8281
8282 #REDIRECT
8283 :
8284 [[Main Page]]
8285 !! html/parsoid
8286 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8287 !! end
8288
8289 !! test
8290 Piped link in #REDIRECT
8291 !! options
8292 # content after piped link is ignored. we support this syntax,
8293 # but don't care that the piped link is lost when we roundtrip this.
8294 parsoid=wt2html
8295 !! wikitext
8296 #REDIRECT [[Main Page|bar]]
8297 !! html/parsoid
8298 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8299 !! end
8300
8301 !! test
8302 Redirect to category (T104502)
8303 !! options
8304 parsoid=wt2html,wt2wt
8305 !! wikitext
8306 #REDIRECT [[Category:Foo]]
8307 !! html/parsoid
8308 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8309 !! end
8310
8311 !! test
8312 Redirect to category with URL encoding (T104502)
8313 !! options
8314 parsoid=wt2html
8315 !! wikitext
8316 #REDIRECT [[Category%3AFoo]]
8317 !! html/parsoid
8318 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8319 !! end
8320
8321 !! test
8322 Redirect to category page
8323 !! wikitext
8324 #REDIRECT [[:Category:Foo]]
8325 !! html/parsoid
8326 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8327 !! end
8328
8329 !! test
8330 Redirect to image page (1)
8331 !! wikitext
8332 #REDIRECT [[File:Wiki.png]]
8333 !! html/parsoid
8334 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8335 !! end
8336
8337 !! test
8338 Redirect to image page (2)
8339 !! wikitext
8340 #REDIRECT [[Image:Wiki.png]]
8341 !! html/parsoid
8342 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8343 !! end
8344
8345 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8346 # Next test confirms this.
8347 !! test
8348 Redirect to language (1) (T104918)
8349 !! options
8350 parsoid=wt2html,wt2wt,html2html
8351 !! wikitext
8352 #REDIRECT [[en:File:Wiki.png]]
8353 !! html/parsoid
8354 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8355 !! end
8356
8357 !! test
8358 Redirect to language (2) (T104918)
8359 !! wikitext
8360 #REDIRECT [[:en:File:Wiki.png]]
8361 !! html/parsoid
8362 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8363 !! end
8364
8365 !! test
8366 Redirect to interwiki (T104918)
8367 !! wikitext
8368 #REDIRECT [[meatball:File:Wiki.png]]
8369 !! html/parsoid
8370 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8371 !! end
8372
8373 !! test
8374 Non-English #REDIRECT
8375 !! options
8376 language=is
8377 !! wikitext
8378 #TILVÍSUN [[Main Page]]
8379 !! html/parsoid
8380 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8381 !! end
8382
8383 !! test
8384 Redirect syntax under text isn't considered a redirect
8385 !! wikitext
8386 some text
8387 #redirect [[Main Page]]
8388 !! html/parsoid
8389 <p>some text</p>
8390 <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>
8391 !! end
8392
8393 # FIXME: Should hoist the redirect to the top of the page and ensure there
8394 # is only one.
8395 !! test
8396 New redirect
8397 !! options
8398 parsoid=html2wt
8399 !! html/parsoid
8400 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8401 !! wikitext
8402 Foo
8403 #REDIRECT [[Foo]]
8404 !! end
8405
8406 ##
8407 ## XHTML tidiness
8408 ###
8409
8410 !! test
8411 <br> to <br />
8412 !! wikitext
8413 1<br>2<br />3
8414 !! html
8415 <p>1<br />2<br />3
8416 </p>
8417 !! end
8418
8419 !! test
8420 Broken br tag sanitization
8421 !! wikitext
8422 </br>
8423 !! html/php
8424 <p>&lt;/br&gt;
8425 </p>
8426 !! end
8427
8428 # TODO: Fix html2html mode (bug 51055)!
8429 !! test
8430 Parsoid: Broken br tag recognition
8431 !! options
8432 parsoid=wt2html
8433 !! wikitext
8434 </br>
8435
8436 <br/ >
8437 !! html+tidy
8438 <p><br /></p>
8439 <p><br /></p>
8440 !! end
8441
8442 !! test
8443 Incorrecly removing closing slashes from correctly formed XHTML
8444 !! wikitext
8445 <br style="clear:both;" />
8446 !! html
8447 <p><br style="clear:both;" />
8448 </p>
8449 !! end
8450
8451 !! test
8452 Failing to transform badly formed HTML into correct XHTML
8453 !! wikitext
8454 <br style="clear: left;">
8455 <br style="clear: right;">
8456 <br style="clear: both;">
8457 !! html
8458 <p><br style="clear: left;" />
8459 <br style="clear: right;" />
8460 <br style="clear: both;" />
8461 </p>
8462 !!end
8463
8464 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8465 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8466 !! test
8467 Handling html with a div self-closing tag
8468 !! wikitext
8469 <div title />
8470 <div title/>
8471 <div title/ >
8472 <div title=bar />
8473 <div title=bar/>
8474 <div title=bar/ >
8475 !! html/php
8476 <p>&lt;div title /&gt;
8477 &lt;div title/&gt;
8478 </p>
8479 <div>
8480 <p>&lt;div title=bar /&gt;
8481 &lt;div title=bar/&gt;
8482 </p>
8483 <div title="bar/"></div>
8484 </div>
8485
8486 !! html/parsoid
8487 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8488 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8489 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
8490 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8491 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8492 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
8493 !! end
8494
8495 !! test
8496 Handling html with a br self-closing tag
8497 !! wikitext
8498 <br title />
8499 <br title/>
8500 <br title/ >
8501 <br title=bar />
8502 <br title=bar/>
8503 <br title=bar/ >
8504 !! html/php
8505 <p><br title="" />
8506 <br title="" />
8507 <br />
8508 <br title="bar" />
8509 <br title="bar" />
8510 <br title="bar/" />
8511 </p>
8512 !! html/parsoid
8513 <p><br title="" />
8514 <br title="" />
8515 <br title="" />
8516 <br title="bar" />
8517 <br title="bar" />
8518 <br title="bar/" />
8519 </p>
8520 !! end
8521
8522 !! test
8523 Horizontal ruler (should it add that extra space?)
8524 !! wikitext
8525 <hr>
8526 <hr >
8527 foo <hr
8528 > bar
8529 !! html+tidy
8530 <hr />
8531 <hr />
8532 <p>foo</p>
8533 <hr />
8534 <p>bar</p>
8535 !! end
8536
8537 !! test
8538 Horizontal ruler -- 4+ dashes render hr
8539 !! wikitext
8540 ----
8541 !! html
8542 <hr />
8543
8544 !! end
8545
8546 !! test
8547 Horizontal ruler -- eats additional dashes on the same line
8548 !! wikitext
8549 ---------
8550 !! html
8551 <hr />
8552
8553 !! end
8554
8555 !! test
8556 Horizontal ruler -- does not collapse dashes on consecutive lines
8557 !! wikitext
8558 ----
8559 ----
8560 !! html
8561 <hr />
8562 <hr />
8563
8564 !! end
8565
8566 !! test
8567 Horizontal ruler -- <4 dashes render as plain text
8568 !! wikitext
8569 ---
8570 !! html
8571 <p>---
8572 </p>
8573 !! end
8574
8575 !! test
8576 Horizontal ruler -- Supports content following dashes on same line
8577 !! wikitext
8578 ---- Foo
8579 !! html
8580 <hr /> Foo
8581
8582 !! html+tidy
8583 <hr />
8584 <p>Foo</p>
8585 !! end
8586
8587 ###
8588 ### Block-level elements
8589 ###
8590 !! test
8591 Common list
8592 !! wikitext
8593 *Common list
8594 * item 2
8595 *item 3
8596 !! html
8597 <ul><li>Common list</li>
8598 <li> item 2</li>
8599 <li>item 3</li></ul>
8600
8601 !! end
8602
8603 !! test
8604 Numbered list
8605 !! wikitext
8606 #Numbered list
8607 #item 2
8608 # item 3
8609 !! html
8610 <ol><li>Numbered list</li>
8611 <li>item 2</li>
8612 <li> item 3</li></ol>
8613
8614 !! end
8615
8616 !! test
8617 Mixed list
8618 !! wikitext
8619 *Mixed list
8620 *# with numbers
8621 ** and bullets
8622 *# and numbers
8623 *bullets again
8624 **bullet level 2
8625 ***bullet level 3
8626 ***#Number on level 4
8627 **bullet level 2
8628 **#Number on level 3
8629 **#Number on level 3
8630 *#number level 2
8631 *Level 1
8632 *** Level 3
8633 #** Level 3, but ordered
8634 !! html
8635 <ul><li>Mixed list
8636 <ol><li> with numbers</li></ol>
8637 <ul><li> and bullets</li></ul>
8638 <ol><li> and numbers</li></ol></li>
8639 <li>bullets again
8640 <ul><li>bullet level 2
8641 <ul><li>bullet level 3
8642 <ol><li>Number on level 4</li></ol></li></ul></li>
8643 <li>bullet level 2
8644 <ol><li>Number on level 3</li>
8645 <li>Number on level 3</li></ol></li></ul>
8646 <ol><li>number level 2</li></ol></li>
8647 <li>Level 1
8648 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
8649 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
8650
8651 !! end
8652
8653 !! test
8654 Nested lists 1
8655 !! wikitext
8656 *foo
8657 **bar
8658 !! html
8659 <ul><li>foo
8660 <ul><li>bar</li></ul></li></ul>
8661
8662 !! end
8663
8664 !! test
8665 Nested lists 2
8666 !! wikitext
8667 **foo
8668 *bar
8669 !! html
8670 <ul><li><ul><li>foo</li></ul></li>
8671 <li>bar</li></ul>
8672
8673 !! end
8674
8675 !! test
8676 Nested lists 3 (first element empty)
8677 !! wikitext
8678 *
8679 **bar
8680 !! html
8681 <ul><li>
8682 <ul><li>bar</li></ul></li></ul>
8683
8684 !! end
8685
8686 !! test
8687 Nested lists 4 (first element empty)
8688 !! wikitext
8689 **
8690 *bar
8691 !! html
8692 <ul><li><ul><li></li></ul></li>
8693 <li>bar</li></ul>
8694
8695 !! end
8696
8697 !! test
8698 Nested lists 5 (both elements empty)
8699 !! wikitext
8700 **
8701 *
8702 !! html
8703 <ul><li><ul><li></li></ul></li>
8704 <li></li></ul>
8705
8706 !! end
8707
8708 !! test
8709 Nested lists 6 (both elements empty)
8710 !! wikitext
8711 *
8712 **
8713 !! html
8714 <ul><li>
8715 <ul><li></li></ul></li></ul>
8716
8717 !! end
8718
8719 !! test
8720 Nested lists 7 (skip initial nesting levels)
8721 !! wikitext
8722 *** foo
8723 !! html
8724 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
8725
8726 !! end
8727
8728 !! test
8729 Nested lists 8 (multiple nesting transitions)
8730 !! wikitext
8731 * foo
8732 *** bar
8733 ** baz
8734 * boo
8735 !! html
8736 <ul><li> foo
8737 <ul><li><ul><li> bar</li></ul></li>
8738 <li> baz</li></ul></li>
8739 <li> boo</li></ul>
8740
8741 !! end
8742
8743 !! test
8744 Nested lists 9 (extension interaction)
8745 !! options
8746 parsoid
8747 !! wikitext
8748 *<references />
8749 !! html/parsoid
8750 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
8751 !! end
8752
8753 !! test
8754 1. Lists with start-of-line-transparent tokens before bullets: Comments
8755 !! wikitext
8756 *foo
8757 *<!--cmt-->bar
8758 <!--cmt-->*baz
8759 !! html
8760 <ul><li>foo</li>
8761 <li>bar</li>
8762 <li>baz</li></ul>
8763
8764 !! end
8765
8766 !! test
8767 2. Lists with start-of-line-transparent tokens before bullets: Template close
8768 !! wikitext
8769 *foo {{echo|bar
8770 }}*baz
8771 !! html
8772 <ul><li>foo bar</li>
8773 <li>baz</li></ul>
8774
8775 !! end
8776
8777 !! test
8778 List items are not parsed correctly following a <pre> block (bug 785)
8779 !! wikitext
8780 * <pre>foo</pre>
8781 * <pre>bar</pre>
8782 * zar
8783 !! html/php
8784 <ul><li> <pre>foo</pre></li>
8785 <li> <pre>bar</pre></li>
8786 <li> zar</li></ul>
8787
8788 !! html/parsoid
8789 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
8790 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
8791 <li> zar</li></ul>
8792 !! end
8793
8794 !! test
8795 List items from template
8796 !! wikitext
8797
8798 {{inner list}}
8799 * item 2
8800
8801 * item 0
8802 {{inner list}}
8803 * item 2
8804
8805 * item 0
8806 * notSOL{{inner list}}
8807 * item 2
8808 !! html
8809 <ul><li> item 1</li>
8810 <li> item 2</li></ul>
8811 <ul><li> item 0</li>
8812 <li> item 1</li>
8813 <li> item 2</li></ul>
8814 <ul><li> item 0</li>
8815 <li> notSOL</li>
8816 <li> item 1</li>
8817 <li> item 2</li></ul>
8818
8819 !! end
8820
8821 !! test
8822 List interrupted by empty line or heading
8823 !! wikitext
8824 * foo
8825
8826 ** bar
8827 == A heading ==
8828 * Another list item
8829 !! html
8830 <ul><li> foo</li></ul>
8831 <ul><li><ul><li> bar</li></ul></li></ul>
8832 <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>
8833 <ul><li> Another list item</li></ul>
8834
8835 !!end
8836
8837 !!test
8838 Multiple list tags generated by templates
8839 !! wikitext
8840 {{echo|<li>}}a
8841 {{echo|<li>}}b
8842 {{echo|<li>}}c
8843 !! html
8844 <li>a
8845 <li>b
8846 <li>c</li>
8847 </li>
8848 </li>
8849
8850 !! html+tidy
8851 <ul>
8852 <li>a</li>
8853 <li>b</li>
8854 <li>c</li>
8855 </ul>
8856 !!end
8857
8858 !!test
8859 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
8860 !! wikitext
8861 *a
8862 <!--This line will NOT split the list-->
8863 *b
8864 <!--This line will NOT split the list either-->
8865 *c
8866 <!--foo--> <!----> <!--This line NOT split the list either-->
8867 *d
8868 !! html
8869 <ul><li>a</li>
8870 <li>b</li>
8871 <li>c</li>
8872 <li>d</li></ul>
8873
8874 !!end
8875
8876 !!test
8877 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
8878 !! wikitext
8879 *a
8880 <!--This line will NOT split the list-->
8881 *b
8882 <!--This line will NOT split the list either-->
8883 *c
8884 <!--foo--> <!----> <!--This line NOT split the list
8885 either-->
8886 *d
8887 !! html
8888 <ul><li>a</li>
8889 <li>b</li>
8890 <li>c</li>
8891 <li>d</li></ul>
8892
8893 !!end
8894
8895 !!test
8896 Test the li-hack
8897 (The PHP parser relies on Tidy for the hack)
8898 !!options
8899 parsoid=wt2html,wt2wt
8900 !! wikitext
8901 * foo
8902 * <li>li-hack
8903 * {{echo|<li>templated li-hack}}
8904 * <!--foo--> <li> unsupported li-hack with preceding comments
8905
8906 <ul>
8907 <li><li>not a li-hack
8908 </li>
8909 </ul>
8910 !! html+tidy
8911 <ul>
8912 <li>foo</li>
8913 <li>li-hack</li>
8914 <li>templated li-hack</li>
8915 <li>unsupported li-hack with preceding comments</li>
8916 </ul>
8917 <ul>
8918 <li>not a li-hack</li>
8919 </ul>
8920 !!end
8921
8922 !! test
8923 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
8924 !! options
8925 parsoid
8926 !! wikitext
8927 # foo
8928 ## bar
8929 * foo
8930 ** bar
8931 : foo
8932 :: bar
8933 !! html
8934 <ol>
8935 <li> foo<ol>
8936 <li> bar</li>
8937 </ol></li>
8938 </ol><ul>
8939 <li> foo<ul>
8940 <li> bar</li>
8941 </ul></li>
8942 </ul><dl>
8943 <dd> foo<dl>
8944 <dd> bar</dd>
8945 </dl></dd>
8946 </dl>
8947 !! end
8948
8949 !! test
8950 Parsoid: Test of whitespace serialization with Templated bullets
8951 !! options
8952 parsoid
8953 !! wikitext
8954 * {{bullet}}
8955 !! html
8956 <ul>
8957 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
8958 </ul>
8959 !! end
8960
8961 # ------------------------------------------------------------------------
8962 # The next set of tests are about Parsoid's ability to handle badly nested
8963 # tags (parse, minimize scope of fixup, and roundtrip back)
8964 # ------------------------------------------------------------------------
8965
8966 !! test
8967 Unbalanced closing block tags break a list
8968 (php parser relies on Tidy to fix up)
8969 !! wikitext
8970 <div>
8971 *a</div><div>
8972 *b</div>
8973 !! html+tidy
8974 <div>
8975 <ul>
8976 <li>a</li>
8977 </ul>
8978 </div>
8979 <div>
8980 <ul>
8981 <li>b</li>
8982 </ul>
8983 </div>
8984 !! end
8985
8986 # Parsoid fails this test, but it might be tricky to support properly.
8987 # See bug 68395.
8988 !! test
8989 Unbalanced closing non-block tags don't break a list
8990 (php parser relies on Tidy to fix up)
8991 !! wikitext
8992 <span>
8993 *a</span><span>
8994 *b</span>
8995 !! html/php+tidy
8996 <ul>
8997 <li><span>a</span></li>
8998 <li><span>b</span></li>
8999 </ul>
9000 !! html/parsoid
9001 <span>
9002 <ul>
9003 <li>a<span></span>
9004 </li>
9005 <li>b
9006 </li>
9007 </ul>
9008 </span>
9009 !! end
9010
9011 !! test
9012 Unclosed formatting tags that straddle lists are closed and reopened
9013 (php parser relies on Tidy to fix up)
9014 !! options
9015 parsoid=wt2html,wt2wt,html2html
9016 !! wikitext
9017 # <s> a
9018 # b </s>
9019 !! html/php+tidy
9020 <ol>
9021 <li><s>a</s></li>
9022 <li><s>b</s></li>
9023 </ol>
9024 !! html/parsoid
9025 <ol><li> <s> a</s></li>
9026 <li><s> b </s></li></ol>
9027 !! end
9028
9029 # See bug 68395.
9030 !!test
9031 1. List embedded in a formatting tag
9032 !! wikitext
9033 <small>
9034 * foo
9035 </small>
9036 !! html/php+tidy
9037 <ul>
9038 <li><small>foo</small></li>
9039 </ul>
9040 !! html/parsoid
9041 <small>
9042 <ul>
9043 <li> foo</li>
9044 </ul>
9045 </small>
9046 !!end
9047
9048 ## Ugly Parsoid output here
9049 ## Not sure what the right output is.
9050 !!test
9051 2. List embedded in a formatting tag
9052 !! wikitext
9053 <small>
9054 *a
9055 *b</small>
9056 !! html/php+tidy
9057 <ul>
9058 <li><small>a</small></li>
9059 <li><small>b</small></li>
9060 </ul>
9061 !! html/parsoid
9062 <small></small>
9063 <ul><small>
9064 <li>a</li>
9065 </small>
9066 <li><small>b</small></li>
9067 </ul>
9068 !!end
9069
9070 # Ugly Parsoid and PHP parser output here
9071 # Not sure if we want to make this a test!
9072 #
9073 ## !!test
9074 ## 3. Unclosed formatting tags in list elements
9075 ## !! wikitext
9076 ## *<small>a
9077 ## *<small>b
9078 ## !! html/php+tidy
9079 ## <ul>
9080 ## <li><small>a</small></li>
9081 ## <li><small><small>b</small></small></li>
9082 ## </ul>
9083 ## !! html/parsoid
9084 ## <ul>
9085 ## <li><small>a</small></li>
9086 ## <small>
9087 ## <li><small>b</small></li>
9088 ## </small></ul>
9089 ## !!end
9090
9091 # This is a bug in the PHP parser + tidy combination.
9092 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9093 # and then fostered out of the table by tidy.)
9094 # We believe the Parsoid output to be correct.
9095 !! test
9096 Table with missing opening <tr> tag
9097 !! options
9098 parsoid=wt2html,wt2wt
9099 !! wikitext
9100 <table>
9101 <td>foo</td>
9102 </tr>
9103 </table>
9104 !! html+tidy
9105 <table>
9106 <tr>
9107 <td>foo</td>
9108 </tr>
9109 </table>
9110 !! end
9111
9112 ###
9113 ### Magic Words
9114 ###
9115
9116 # Note that the current date is hard-coded as
9117 # 1970-01-01T00:02:03Z (a Thursday)
9118 # when running parser tests. The timezone is also fixed to GMT, so
9119 # local date will be identical to current date.
9120
9121 !! test
9122 Magic Word: {{CURRENTDAY}}
9123 !! wikitext
9124 {{CURRENTDAY}}
9125 !! html
9126 <p>1
9127 </p>
9128 !! end
9129
9130 !! test
9131 Magic Word: {{CURRENTDAY2}}
9132 !! wikitext
9133 {{CURRENTDAY2}}
9134 !! html
9135 <p>01
9136 </p>
9137 !! end
9138
9139 !! test
9140 Magic Word: {{CURRENTDAYNAME}}
9141 !! wikitext
9142 {{CURRENTDAYNAME}}
9143 !! html
9144 <p>Thursday
9145 </p>
9146 !! end
9147
9148 !! test
9149 Magic Word: {{CURRENTDOW}}
9150 !! wikitext
9151 {{CURRENTDOW}}
9152 !! html
9153 <p>4
9154 </p>
9155 !! end
9156
9157 !! test
9158 Magic Word: {{CURRENTMONTH}}
9159 !! wikitext
9160 {{CURRENTMONTH}}
9161 !! html
9162 <p>01
9163 </p>
9164 !! end
9165
9166 !! test
9167 Magic Word: {{CURRENTMONTH1}}
9168 !! wikitext
9169 {{CURRENTMONTH1}}
9170 !! html
9171 <p>1
9172 </p>
9173 !! end
9174
9175 !! test
9176 Magic Word: {{CURRENTMONTHABBREV}}
9177 !! wikitext
9178 {{CURRENTMONTHABBREV}}
9179 !! html
9180 <p>Jan
9181 </p>
9182 !! end
9183
9184 !! test
9185 Magic Word: {{CURRENTMONTHNAME}}
9186 !! wikitext
9187 {{CURRENTMONTHNAME}}
9188 !! html
9189 <p>January
9190 </p>
9191 !! end
9192
9193 !! test
9194 Magic Word: {{CURRENTMONTHNAMEGEN}}
9195 !! wikitext
9196 {{CURRENTMONTHNAMEGEN}}
9197 !! html
9198 <p>January
9199 </p>
9200 !! end
9201
9202 !! test
9203 Magic Word: {{CURRENTTIME}}
9204 !! wikitext
9205 {{CURRENTTIME}}
9206 !! html
9207 <p>00:02
9208 </p>
9209 !! end
9210
9211 !! test
9212 Magic Word: {{CURRENTHOUR}}
9213 !! wikitext
9214 {{CURRENTHOUR}}
9215 !! html
9216 <p>00
9217 </p>
9218 !! end
9219
9220 !! test
9221 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9222 !! wikitext
9223 {{CURRENTWEEK}}
9224 !! html
9225 <p>1
9226 </p>
9227 !! end
9228
9229 !! test
9230 Magic Word: {{CURRENTYEAR}}
9231 !! wikitext
9232 {{CURRENTYEAR}}
9233 !! html
9234 <p>1970
9235 </p>
9236 !! end
9237
9238 !! test
9239 Magic Word: {{CURRENTTIMESTAMP}}
9240 !! wikitext
9241 {{CURRENTTIMESTAMP}}
9242 !! html
9243 <p>19700101000203
9244 </p>
9245 !! end
9246
9247 !! test
9248 Magic Words LOCAL (UTC)
9249 !! wikitext
9250 * {{LOCALMONTH}}
9251 * {{LOCALMONTH1}}
9252 * {{LOCALMONTHNAME}}
9253 * {{LOCALMONTHNAMEGEN}}
9254 * {{LOCALMONTHABBREV}}
9255 * {{LOCALDAY}}
9256 * {{LOCALDAY2}}
9257 * {{LOCALDAYNAME}}
9258 * {{LOCALYEAR}}
9259 * {{LOCALTIME}}
9260 * {{LOCALHOUR}}
9261 * {{LOCALWEEK}}
9262 * {{LOCALDOW}}
9263 * {{LOCALTIMESTAMP}}
9264 !! html
9265 <ul><li> 01</li>
9266 <li> 1</li>
9267 <li> January</li>
9268 <li> January</li>
9269 <li> Jan</li>
9270 <li> 1</li>
9271 <li> 01</li>
9272 <li> Thursday</li>
9273 <li> 1970</li>
9274 <li> 00:02</li>
9275 <li> 00</li>
9276 <li> 1</li>
9277 <li> 4</li>
9278 <li> 19700101000203</li></ul>
9279
9280 !! end
9281
9282 !! test
9283 Magic Word: {{FULLPAGENAME}}
9284 !! options
9285 title=[[User:Ævar Arnfjörð Bjarmason]]
9286 !! wikitext
9287 {{FULLPAGENAME}}
9288 !! html
9289 <p>User:Ævar Arnfjörð Bjarmason
9290 </p>
9291 !! end
9292
9293 !! test
9294 Magic Word: {{FULLPAGENAMEE}}
9295 !! options
9296 title=[[User:Ævar Arnfjörð Bjarmason]]
9297 !! wikitext
9298 {{FULLPAGENAMEE}}
9299 !! html
9300 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9301 </p>
9302 !! end
9303
9304 !! test
9305 Magic Word: {{TALKSPACE}}
9306 !! options
9307 title=[[User:Ævar Arnfjörð Bjarmason]]
9308 !! wikitext
9309 {{TALKSPACE}}
9310 !! html
9311 <p>User talk
9312 </p>
9313 !! end
9314
9315 !! test
9316 Magic Word: {{TALKSPACE}}, same namespace
9317 !! options
9318 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9319 !! wikitext
9320 {{TALKSPACE}}
9321 !! html
9322 <p>User talk
9323 </p>
9324 !! end
9325
9326 !! test
9327 Magic Word: {{TALKSPACE}}, main namespace
9328 !! options
9329 title=[[Parser Test]]
9330 !! wikitext
9331 {{TALKSPACE}}
9332 !! html
9333 <p>Talk
9334 </p>
9335 !! end
9336
9337 !! test
9338 Magic Word: {{TALKSPACEE}}
9339 !! options
9340 title=[[User:Ævar Arnfjörð Bjarmason]]
9341 !! wikitext
9342 {{TALKSPACEE}}
9343 !! html
9344 <p>User_talk
9345 </p>
9346 !! end
9347
9348 !! test
9349 Magic Word: {{SUBJECTSPACE}}
9350 !! options
9351 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9352 !! wikitext
9353 {{SUBJECTSPACE}}
9354 !! html
9355 <p>User
9356 </p>
9357 !! end
9358
9359 !! test
9360 Magic Word: {{SUBJECTSPACE}}, same namespace
9361 !! options
9362 title=[[User:Ævar Arnfjörð Bjarmason]]
9363 !! wikitext
9364 {{SUBJECTSPACE}}
9365 !! html
9366 <p>User
9367 </p>
9368 !! end
9369
9370 !! test
9371 Magic Word: {{SUBJECTSPACE}}, main namespace
9372 !! options
9373 title=[[Parser Test]]
9374 !! wikitext
9375 {{SUBJECTSPACE}}
9376 !! html
9377
9378 !! end
9379
9380 !! test
9381 Magic Word: {{SUBJECTSPACEE}}
9382 !! options
9383 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9384 !! wikitext
9385 {{SUBJECTSPACEE}}
9386 !! html
9387 <p>User
9388 </p>
9389 !! end
9390
9391 !! test
9392 Magic Word: {{NAMESPACE}}
9393 !! options
9394 title=[[User:Ævar Arnfjörð Bjarmason]]
9395 !! wikitext
9396 {{NAMESPACE}}
9397 !! html
9398 <p>User
9399 </p>
9400 !! end
9401
9402 !! test
9403 Magic Word: {{NAMESPACEE}}
9404 !! options
9405 title=[[User:Ævar Arnfjörð Bjarmason]]
9406 !! wikitext
9407 {{NAMESPACEE}}
9408 !! html
9409 <p>User
9410 </p>
9411 !! end
9412
9413 !! test
9414 Magic Word: {{NAMESPACENUMBER}}
9415 !! options
9416 title=[[User:Ævar Arnfjörð Bjarmason]]
9417 !! wikitext
9418 {{NAMESPACENUMBER}}
9419 !! html
9420 <p>2
9421 </p>
9422 !! end
9423
9424 !! test
9425 Magic Word: {{SUBPAGENAME}}
9426 !! options
9427 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9428 !! wikitext
9429 {{SUBPAGENAME}}
9430 !! html
9431 <p>sub ö
9432 </p>
9433 !! end
9434
9435 !! test
9436 Magic Word: {{SUBPAGENAMEE}}
9437 !! options
9438 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9439 !! wikitext
9440 {{SUBPAGENAMEE}}
9441 !! html
9442 <p>sub_%C3%B6
9443 </p>
9444 !! end
9445
9446 !! test
9447 Magic Word: {{ROOTPAGENAME}}
9448 !! options
9449 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9450 !! wikitext
9451 {{ROOTPAGENAME}}
9452 !! html
9453 <p>Ævar Arnfjörð Bjarmason
9454 </p>
9455 !! end
9456
9457 !! test
9458 Magic Word: {{ROOTPAGENAMEE}}
9459 !! options
9460 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9461 !! wikitext
9462 {{ROOTPAGENAMEE}}
9463 !! html
9464 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9465 </p>
9466 !! end
9467
9468 !! test
9469 Magic Word: {{BASEPAGENAME}}
9470 !! options
9471 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9472 !! wikitext
9473 {{BASEPAGENAME}}
9474 !! html
9475 <p>Ævar Arnfjörð Bjarmason
9476 </p>
9477 !! end
9478
9479 !! test
9480 Magic Word: {{BASEPAGENAMEE}}
9481 !! options
9482 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9483 !! wikitext
9484 {{BASEPAGENAMEE}}
9485 !! html
9486 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9487 </p>
9488 !! end
9489
9490 !! test
9491 Magic Word: {{TALKPAGENAME}}
9492 !! options
9493 title=[[User:Ævar Arnfjörð Bjarmason]]
9494 !! wikitext
9495 {{TALKPAGENAME}}
9496 !! html
9497 <p>User talk:Ævar Arnfjörð Bjarmason
9498 </p>
9499 !! end
9500
9501 !! test
9502 Magic Word: {{TALKPAGENAMEE}}
9503 !! options
9504 title=[[User:Ævar Arnfjörð Bjarmason]]
9505 !! wikitext
9506 {{TALKPAGENAMEE}}
9507 !! html
9508 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9509 </p>
9510 !! end
9511
9512 !! test
9513 Magic Word: {{SUBJECTPAGENAME}}
9514 !! options
9515 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9516 !! wikitext
9517 {{SUBJECTPAGENAME}}
9518 !! html
9519 <p>User:Ævar Arnfjörð Bjarmason
9520 </p>
9521 !! end
9522
9523 !! test
9524 Magic Word: {{SUBJECTPAGENAMEE}}
9525 !! options
9526 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9527 !! wikitext
9528 {{SUBJECTPAGENAMEE}}
9529 !! html
9530 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9531 </p>
9532 !! end
9533
9534 !! test
9535 Magic Word: {{NUMBEROFFILES}}
9536 !! wikitext
9537 {{NUMBEROFFILES}}
9538 !! html
9539 <p>5
9540 </p>
9541 !! end
9542
9543 !! test
9544 Magic Word: {{PAGENAME}}
9545 !! options
9546 title=[[User:Ævar Arnfjörð Bjarmason]]
9547 !! wikitext
9548 {{PAGENAME}}
9549 !! html
9550 <p>Ævar Arnfjörð Bjarmason
9551 </p>
9552 !! end
9553
9554 !! test
9555 Magic Word: {{PAGENAME}} with metacharacters
9556 !! options
9557 title=[['foo & bar = baz']]
9558 !! wikitext
9559 ''{{PAGENAME}}''
9560 !! html/php
9561 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
9562 </p>
9563 !! html+tidy
9564 <p><i>'foo &amp; bar = baz'</i></p>
9565 !! end
9566
9567 !! test
9568 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
9569 !! options
9570 title=[[*RFC 1234 http://example.com/]]
9571 !! wikitext
9572 {{PAGENAME}}
9573 !! html/php
9574 <p>&#42;RFC&#32;1234 http&#58;//example.com/
9575 </p>
9576 !! html+tidy
9577 <p>*RFC 1234 http://example.com/</p>
9578 !! end
9579
9580 !! test
9581 Magic Word: {{PAGENAMEE}}
9582 !! options
9583 title=[[User:Ævar Arnfjörð Bjarmason]]
9584 !! wikitext
9585 {{PAGENAMEE}}
9586 !! html
9587 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9588 </p>
9589 !! end
9590
9591 !! test
9592 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
9593 !! options
9594 title=[[*RFC 1234 http://example.com/]]
9595 !! wikitext
9596 {{PAGENAMEE}}
9597 !! html/php
9598 <p>&#42;RFC_1234_http&#58;//example.com/
9599 </p>
9600 !! html+tidy
9601 <p>*RFC_1234_http://example.com/</p>
9602 !! end
9603
9604 !! test
9605 Magic Word: {{REVISIONID}}
9606 !! wikitext
9607 {{REVISIONID}}
9608 !! html
9609 <p>1337
9610 </p>
9611 !! end
9612
9613 !! test
9614 Magic Word: {{SCRIPTPATH}}
9615 !! wikitext
9616 {{SCRIPTPATH}}
9617 !! html
9618 <p>/
9619 </p>
9620 !! end
9621
9622 !! test
9623 Magic Word: {{STYLEPATH}}
9624 !! wikitext
9625 {{STYLEPATH}}
9626 !! html
9627 <p>/skins
9628 </p>
9629 !! end
9630
9631 !! test
9632 Magic Word: {{SERVER}}
9633 !! wikitext
9634 {{SERVER}}
9635 !! html
9636 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9637 </p>
9638 !! end
9639
9640 !! test
9641 Magic Word: {{SERVERNAME}}
9642 !! wikitext
9643 {{SERVERNAME}}
9644 !! html
9645 <p>example.org
9646 </p>
9647 !! end
9648
9649 !! test
9650 Magic Word: {{SITENAME}}
9651 !! wikitext
9652 {{SITENAME}}
9653 !! html
9654 <p>MediaWiki
9655 </p>
9656 !! end
9657
9658 !! test
9659 Case-sensitive magic words, when cased differently, should just be template transclusions
9660 !! wikitext
9661 {{CurrentMonth}}
9662 {{currentday}}
9663 {{cURreNTweEK}}
9664 {{currentHour}}
9665 !! html
9666 <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>
9667 <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>
9668 <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>
9669 <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>
9670 </p>
9671 !! end
9672
9673 !! test
9674 Case-insensitive magic words should still work with weird casing.
9675 !! wikitext
9676 {{sErVeRNaMe}}
9677 {{LCFirst:AOEU}}
9678 {{ucFIRST:aoeu}}
9679 {{SERver}}
9680 !! html
9681 <p>example.org
9682 aOEU
9683 Aoeu
9684 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9685 </p>
9686 !! end
9687
9688 # From plwiki:PLOS_ONE
9689 !! test
9690 Parsoid: Page property magic word with magic word contents
9691 !! wikitext
9692 {{DISPLAYTITLE:''{{PAGENAME}}''}}
9693 !! html/parsoid
9694 <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>"}]]}'/>
9695 !! end
9696
9697 !! test
9698 Parsoid: Template-generated DISPLAYTITLE
9699 !! wikitext
9700 {{{{echo|DISPLAYTITLE}}:Foo}}
9701 !! html/parsoid
9702 <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}}]}'/>
9703 !! end
9704
9705 !! test
9706 Namespace 1 {{ns:1}}
9707 !! wikitext
9708 {{ns:1}}
9709 !! html
9710 <p>Talk
9711 </p>
9712 !! end
9713
9714 !! test
9715 Namespace 1 {{ns:01}}
9716 !! wikitext
9717 {{ns:01}}
9718 !! html
9719 <p>Talk
9720 </p>
9721 !! end
9722
9723 !! test
9724 Namespace 0 {{ns:0}} (bug 4783)
9725 !! wikitext
9726 {{ns:0}}
9727 !! html
9728
9729 !! end
9730
9731 !! test
9732 Namespace 0 {{ns:00}} (bug 4783)
9733 !! wikitext
9734 {{ns:00}}
9735 !! html
9736
9737 !! end
9738
9739 !! test
9740 Namespace -1 {{ns:-1}}
9741 !! wikitext
9742 {{ns:-1}}
9743 !! html
9744 <p>Special
9745 </p>
9746 !! end
9747
9748 !! test
9749 Namespace User {{ns:User}}
9750 !! wikitext
9751 {{ns:User}}
9752 !! html
9753 <p>User
9754 </p>
9755 !! end
9756
9757 !! test
9758 Namespace User talk {{ns:User_talk}}
9759 !! wikitext
9760 {{ns:User_talk}}
9761 !! html
9762 <p>User talk
9763 </p>
9764 !! end
9765
9766 !! test
9767 Namespace User talk {{ns:uSeR tAlK}}
9768 !! wikitext
9769 {{ns:uSeR tAlK}}
9770 !! html
9771 <p>User talk
9772 </p>
9773 !! end
9774
9775 !! test
9776 Namespace File {{ns:File}}
9777 !! wikitext
9778 {{ns:File}}
9779 !! html
9780 <p>File
9781 </p>
9782 !! end
9783
9784 !! test
9785 Namespace File {{ns:Image}}
9786 !! wikitext
9787 {{ns:Image}}
9788 !! html
9789 <p>File
9790 </p>
9791 !! end
9792
9793 !! test
9794 Namespace (lang=de) Benutzer {{ns:User}}
9795 !! options
9796 language=de
9797 !! wikitext
9798 {{ns:User}}
9799 !! html
9800 <p>Benutzer
9801 </p>
9802 !! end
9803
9804 !! test
9805 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
9806 !! options
9807 language=de
9808 !! wikitext
9809 {{ns:3}}
9810 !! html
9811 <p>Benutzer Diskussion
9812 </p>
9813 !! end
9814
9815
9816 !! test
9817 Urlencode
9818 !! wikitext
9819 {{urlencode:hi world?!}}
9820 {{urlencode:hi world?!|WIKI}}
9821 {{urlencode:hi world?!|PATH}}
9822 {{urlencode:hi world?!|QUERY}}
9823 !! html
9824 <p>hi+world%3F%21
9825 hi_world%3F!
9826 hi%20world%3F%21
9827 hi+world%3F%21
9828 </p>
9829 !! end
9830
9831 !! test
9832 Magic Word: prioritize type info over data-parsoid
9833 !! options
9834 parsoid=html2wt
9835 !! html/parsoid
9836 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
9837 !! wikitext
9838 __FORCETOC__
9839 !! end
9840
9841 !! test
9842 Magic Word: serialize on separate line (parsoid)
9843 !! options
9844 parsoid=wt2wt,html2wt
9845 !! wikitext
9846 foo
9847 __NOTOC__
9848 bar
9849 !! html/parsoid
9850 foo<meta property="mw:PageProp/notoc"/>bar
9851 !! end
9852
9853 !! test
9854 Magic Word: rt non-english wikis
9855 !! options
9856 parsoid=wt2wt
9857 language=de
9858 !! wikitext
9859 __NOEDITSECTION__
9860 !! html/parsoid
9861 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
9862 !! end
9863
9864 !!test
9865 __proto__ is treated as normal wikitext (T105997)
9866 !!wikitext
9867 __proto__
9868 !!html
9869 <p>__proto__
9870 </p>
9871 !!end
9872
9873 ###
9874 ### Magic links
9875 ###
9876 !! test
9877 Magic links: internal link to RFC (bug 479)
9878 !! wikitext
9879 [[RFC 123]]
9880 !! html
9881 <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>
9882 </p>
9883 !! end
9884
9885 !! test
9886 Magic links: RFC (bug 479)
9887 !! wikitext
9888 RFC 822
9889 !! html
9890 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9891 </p>
9892 !! end
9893
9894 !! test
9895 Magic links: RFC (bug 65278)
9896 !! wikitext
9897 This is RFC 822 but thisRFC 822 is not RFC 822linked.
9898 !! html
9899 <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.
9900 </p>
9901 !! end
9902
9903 !! test
9904 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
9905 !! wikitext
9906 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
9907 RFC
9908 822
9909 !! html
9910 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9911 RFC
9912 822
9913 </p>
9914 !! end
9915
9916 !! test
9917 Magic links: ISBN (bug 1937)
9918 !! wikitext
9919 ISBN 0-306-40615-2
9920 !! html
9921 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
9922 </p>
9923 !! end
9924
9925 !! test
9926 Magic links: ISBN (bug 65278)
9927 !! wikitext
9928 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
9929 !! html/php
9930 <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.
9931 </p>
9932 !! html/parsoid
9933 <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>
9934 !! end
9935
9936 !! test
9937 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
9938 !! wikitext
9939 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
9940 ISBN
9941 9780316098113
9942 ISBN 978
9943 0316098113
9944 !! html
9945 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
9946 ISBN
9947 9780316098113
9948 ISBN 978
9949 0316098113
9950 </p>
9951 !! end
9952
9953 !! test
9954 Magic links: PMID incorrectly converts space to underscore
9955 !! wikitext
9956 PMID 1234
9957 !! html
9958 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9959 </p>
9960 !! end
9961
9962 !! test
9963 Magic links: PMID (bug 65278)
9964 !! wikitext
9965 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
9966 !! html
9967 <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.
9968 </p>
9969 !! end
9970
9971 !! test
9972 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
9973 !! wikitext
9974 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
9975 PMID
9976 1234
9977 !! html
9978 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9979 PMID
9980 1234
9981 </p>
9982 !! end
9983
9984 ###
9985 ### Templates
9986 ####
9987
9988 !! test
9989 Nonexistent template
9990 !! wikitext
9991 {{thistemplatedoesnotexist}}
9992 !! html
9993 <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>
9994 </p>
9995 !! end
9996
9997 !! test
9998 Template with invalid target containing tags
9999 !! wikitext
10000 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10001 !! html
10002 <p>{{a<b>b</b>|foo|a=b|a = b}}
10003 </p>
10004 !! end
10005
10006 !! test
10007 Template with invalid target containing unclosed tag
10008 !! wikitext
10009 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10010 !! html
10011 <p>{{a<b>|foo|a=b|a = b}}</b>
10012 </p>
10013 !! end
10014
10015 !! test
10016 Template with invalid target containing wikilink
10017 !! wikitext
10018 {{[[Main Page]]}}
10019 !! html/php
10020 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10021 </p>
10022 !! html/parsoid
10023 <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>
10024 !! end
10025
10026 !! test
10027 Template with just whitespace in it, bug #68421
10028 !! wikitext
10029 {{echo|{{ }}}}
10030 !! html/parsoid
10031 <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>
10032 !! end
10033
10034 !! article
10035 Template:test
10036 !! text
10037 This is a test template
10038 !! endarticle
10039
10040 !! test
10041 Simple template
10042 !! wikitext
10043 {{test}}
10044 !! html
10045 <p>This is a test template
10046 </p>
10047 !! end
10048
10049 !! test
10050 Template with explicit namespace
10051 !! wikitext
10052 {{Template:test}}
10053 !! html
10054 <p>This is a test template
10055 </p>
10056 !! end
10057
10058
10059 !! article
10060 Template:paramtest
10061 !! text
10062 This is a test template with parameter {{{param}}}
10063 !! endarticle
10064
10065 !! test
10066 Template parameter
10067 !! wikitext
10068 {{paramtest|param=foo}}
10069 !! html
10070 <p>This is a test template with parameter foo
10071 </p>
10072 !! end
10073
10074 !! article
10075 Template:paramtestnum
10076 !! text
10077 [[{{{1}}}|{{{2}}}]]
10078 !! endarticle
10079
10080 !! test
10081 Template unnamed parameter
10082 !! wikitext
10083 {{paramtestnum|Main Page|the main page}}
10084 !! html
10085 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10086 </p>
10087 !! end
10088
10089 !! article
10090 Template:templatesimple
10091 !! text
10092 (test)
10093 !! endarticle
10094
10095 !! article
10096 Template:templateredirect
10097 !! text
10098 #redirect [[Template:templatesimple]]
10099 !! endarticle
10100
10101 !! article
10102 Template:templateasargtestnum
10103 !! text
10104 {{{{{1}}}}}
10105 !! endarticle
10106
10107 !! article
10108 Template:templateasargtest
10109 !! text
10110 {{template{{{templ}}}}}
10111 !! endarticle
10112
10113 !! article
10114 Template:templateasargtest2
10115 !! text
10116 {{{{{templ}}}}}
10117 !! endarticle
10118
10119 !! test
10120 Template with template name as unnamed argument
10121 !! wikitext
10122 {{templateasargtestnum|templatesimple}}
10123 !! html
10124 <p>(test)
10125 </p>
10126 !! end
10127
10128 !! test
10129 Template with template name as argument
10130 !! wikitext
10131 {{templateasargtest|templ=simple}}
10132 !! html
10133 <p>(test)
10134 </p>
10135 !! end
10136
10137 !! test
10138 Template with template name as argument (2)
10139 !! wikitext
10140 {{templateasargtest2|templ=templatesimple}}
10141 !! html
10142 <p>(test)
10143 </p>
10144 !! end
10145
10146 !! article
10147 Template:templateasargtestdefault
10148 !! text
10149 {{{{{templ|templatesimple}}}}}
10150 !! endarticle
10151
10152 !! article
10153 Template:templa
10154 !! text
10155 '''templ'''
10156 !! endarticle
10157
10158 !! test
10159 Template with default value
10160 !! wikitext
10161 {{templateasargtestdefault}}
10162 !! html
10163 <p>(test)
10164 </p>
10165 !! end
10166
10167 !! test
10168 Template with default value (value set)
10169 !! wikitext
10170 {{templateasargtestdefault|templ=templa}}
10171 !! html
10172 <p><b>templ</b>
10173 </p>
10174 !! end
10175
10176 !! test
10177 Template redirect
10178 !! wikitext
10179 {{templateredirect}}
10180 !! html/php
10181 <p>(test)
10182 </p>
10183 !! html/parsoid
10184 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10185 !! end
10186
10187 !! test
10188 Template with argument in separate line
10189 !! wikitext
10190 {{ templateasargtest |
10191 templ = simple }}
10192 !! html
10193 <p>(test)
10194 </p>
10195 !! end
10196
10197 !! test
10198 Template with complex template as argument
10199 !! wikitext
10200 {{paramtest|
10201 param ={{ templateasargtest |
10202 templ = simple }}}}
10203 !! html
10204 <p>This is a test template with parameter (test)
10205 </p>
10206 !! end
10207
10208 !! test
10209 Template with thumb image (with link in description)
10210 !! wikitext
10211 {{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10212 !! html/php
10213 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>
10214
10215 !! html+tidy
10216 <p>This is a test template with parameter</p>
10217 <div class="thumb tright">
10218 <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>
10219 <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>
10220 </div>
10221 </div>
10222 !! html/parsoid
10223 <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>
10224 !! end
10225
10226 !! article
10227 Template:complextemplate
10228 !! text
10229 {{{1}}} {{paramtest|
10230 param ={{{param}}}}}
10231 !! endarticle
10232
10233 !! test
10234 Template with complex arguments
10235 !! wikitext
10236 {{complextemplate|
10237 param ={{ templateasargtest |
10238 templ = simple }}|[[Template:complextemplate|link]]}}
10239 !! html
10240 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10241 </p>
10242 !! end
10243
10244 !! test
10245 BUG 553: link with two variables in a piped link
10246 !! wikitext
10247 {|
10248 |[[{{{1}}}|{{{2}}}]]
10249 |}
10250 !! html
10251 <table>
10252 <tr>
10253 <td>[[{{{1}}}|{{{2}}}]]
10254 </td></tr></table>
10255
10256 !! end
10257
10258 !! test
10259 Magic variable as template parameter
10260 !! wikitext
10261 {{paramtest|param={{SITENAME}}}}
10262 !! html
10263 <p>This is a test template with parameter MediaWiki
10264 </p>
10265 !! end
10266
10267 !! article
10268 Template:linktest
10269 !! text
10270 [[{{{param}}}|link]]
10271 !! endarticle
10272
10273 !! test
10274 Template parameter as link source
10275 !! wikitext
10276 {{linktest|param=Main Page}}
10277 !! html
10278 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10279 </p>
10280 !! end
10281
10282 !!article
10283 Template:paramtest2
10284 !! text
10285 including another template, {{paramtest|param={{{arg}}}}}
10286 !! endarticle
10287
10288 !! test
10289 Template passing argument to another template
10290 !! wikitext
10291 {{paramtest2|arg='hmm'}}
10292 !! html
10293 <p>including another template, This is a test template with parameter 'hmm'
10294 </p>
10295 !! end
10296
10297 !! article
10298 Template:Linktest2
10299 !! text
10300 Main Page
10301 !! endarticle
10302
10303 !! test
10304 Template as link source
10305 !! wikitext
10306 [[{{linktest2}}]]
10307
10308 [[{{linktest2}}|Main Page]]
10309
10310 [[{{linktest2}}]]Page
10311 !! html
10312 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10313 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10314 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10315 </p>
10316 !! end
10317
10318
10319 !! article
10320 Template:loop1
10321 !! text
10322 {{loop2}}
10323 !! endarticle
10324
10325 !! article
10326 Template:loop2
10327 !! text
10328 {{loop1}}
10329 !! endarticle
10330
10331 !! test
10332 Template infinite loop
10333 !! wikitext
10334 {{loop1}}
10335 !! html
10336 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10337 </p>
10338 !! end
10339
10340 !! test
10341 Template from main namespace
10342 !! wikitext
10343 {{:Main Page}}
10344 !! html
10345 <p>blah blah
10346 </p>
10347 !! end
10348
10349 !! article
10350 Template:table
10351 !! text
10352 {|
10353 | 1 || 2
10354 |-
10355 | 3 || 4
10356 |}
10357 !! endarticle
10358
10359 !! test
10360 BUG 529: Template with table, not included at beginning of line
10361 !! wikitext
10362 foo {{table}}
10363 !! html
10364 <p>foo
10365 </p>
10366 <table>
10367 <tr>
10368 <td> 1 </td>
10369 <td> 2
10370 </td></tr>
10371 <tr>
10372 <td> 3 </td>
10373 <td> 4
10374 </td></tr></table>
10375
10376 !! end
10377
10378 !! test
10379 BUG 523: Template shouldn't eat newline (or add an extra one before table)
10380 !! wikitext
10381 foo
10382 {{table}}
10383 !! html
10384 <p>foo
10385 </p>
10386 <table>
10387 <tr>
10388 <td> 1 </td>
10389 <td> 2
10390 </td></tr>
10391 <tr>
10392 <td> 3 </td>
10393 <td> 4
10394 </td></tr></table>
10395
10396 !! end
10397
10398 !! test
10399 BUG 41: Template parameters shown as broken links
10400 !! wikitext
10401 {{{parameter}}}
10402 !! html
10403 <p>{{{parameter}}}
10404 </p>
10405 !! end
10406
10407 !! test
10408 Template with targets containing wikilinks
10409 !! wikitext
10410 {{[[foo]]}}
10411
10412 {{[[{{echo|foo}}]]}}
10413
10414 {{{{echo|[[foo}}]]}}
10415 !! html
10416 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10417 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10418 </p><p>{{[[foo}}]]
10419 </p>
10420 !! end
10421
10422 !! article
10423 Template:''
10424 !! text
10425 bar
10426 !! endarticle
10427
10428 !! test
10429 Templates: Double quotes as template target
10430 !! wikitext
10431 foo {{''}} baz
10432 !! html/php
10433 <p>foo bar baz
10434 </p>
10435 !! html/parsoid
10436 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
10437 </p>
10438 !! end
10439
10440 !! article
10441 Template:MSGNW test
10442 !! text
10443 ''None'' of '''this''' should be
10444 * interpreted
10445 but rather passed unmodified
10446 {{test}}
10447 <gallery>
10448 File:Foobar.jpg
10449 </gallery>
10450 <!-- comment -->
10451 !! endarticle
10452
10453 # hmm, fix this or just deprecate msgnw and document its behavior?
10454 !! test
10455 msgnw keyword
10456 !! wikitext
10457 {{msgnw:MSGNW test}}
10458 !! html/php
10459 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
10460 &#42; interpreted
10461 &#32;but rather passed unmodified
10462 &#123;&#123;test&#125;&#125;
10463 &#60;gallery&#62;
10464 File:Foobar.jpg
10465 &#60;/gallery&#62;
10466 &#60;!-- comment --&#62;
10467 </p>
10468 !! end
10469
10470 !! test
10471 int keyword
10472 !! wikitext
10473 {{int:youhavenewmessages|lots of money|not!}}
10474 !! html
10475 <p>You have lots of money (not!).
10476 </p>
10477 !! end
10478
10479 !! article
10480 Template:Includes
10481 !! text
10482 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10483 !! endarticle
10484
10485 !! test
10486 <includeonly> and <noinclude> being included
10487 !! wikitext
10488 {{Includes}}
10489 !! html
10490 <p>Foobar
10491 </p>
10492 !! end
10493
10494 !! article
10495 Template:Includes2
10496 !! text
10497 <onlyinclude>Foo</onlyinclude>bar
10498 !! endarticle
10499
10500 !! test
10501 <onlyinclude> being included
10502 !! wikitext
10503 {{Includes2}}
10504 !! html
10505 <p>Foo
10506 </p>
10507 !! end
10508
10509
10510 !! article
10511 Template:Includes3
10512 !! text
10513 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
10514 !! endarticle
10515
10516 !! test
10517 <onlyinclude> and <includeonly> being included
10518 !! wikitext
10519 {{Includes3}}
10520 !! html
10521 <p>Foo
10522 </p>
10523 !! end
10524
10525 !! test
10526 <includeonly> and <noinclude> on a page
10527 !! wikitext
10528 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10529 !! html
10530 <p>Foozar
10531 </p>
10532 !! end
10533
10534 !! test
10535 Un-closed <noinclude>
10536 !! wikitext
10537 <noinclude>
10538 !! html
10539 !! end
10540
10541 !! test
10542 <onlyinclude> on a page
10543 !! wikitext
10544 <onlyinclude>Foo</onlyinclude>bar
10545 !! html
10546 <p>Foobar
10547 </p>
10548 !! end
10549
10550 !! test
10551 Un-closed <onlyinclude>
10552 !! wikitext
10553 <onlyinclude>
10554 !! html
10555 !! end
10556
10557 !!test
10558 Self-closed noinclude, includeonly, onlyinclude tags
10559 !! wikitext
10560 <noinclude />
10561 <includeonly />
10562 <onlyinclude />
10563 !! html
10564 <p><br />
10565 </p>
10566 !!end
10567
10568 !!test
10569 Unbalanced includeonly and noinclude tags
10570 !! wikitext
10571 {|
10572 |a</noinclude>
10573 |b</noinclude></noinclude>
10574 |c</noinclude></includeonly>
10575 |d</includeonly></includeonly>
10576 |}
10577 !! html
10578 <table>
10579 <tr>
10580 <td>a
10581 </td>
10582 <td>b
10583 </td>
10584 <td>c&lt;/includeonly&gt;
10585 </td>
10586 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
10587 </td></tr></table>
10588
10589 !!end
10590
10591 !! article
10592 Template:Includeonly section
10593 !! text
10594 <includeonly>
10595 ==Includeonly section==
10596 </includeonly>
10597 ==Section T-1==
10598 !!endarticle
10599
10600 !! test
10601 Bug 6563: Edit link generation for section shown by <includeonly>
10602 !! wikitext
10603 {{includeonly section}}
10604 !! html
10605 <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>
10606 <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>
10607
10608 !! end
10609
10610 # Uses same input as the contents of [[Template:Includeonly section]]
10611 !! test
10612 Bug 6563: Section extraction for section shown by <includeonly>
10613 !! options
10614 section=T-2
10615 !! wikitext
10616 <includeonly>
10617 ==Includeonly section==
10618 </includeonly>
10619 ==Section T-2==
10620 !! html
10621 ==Section T-2==
10622 !! end
10623
10624 !! test
10625 Bug 6563: Edit link generation for section suppressed by <includeonly>
10626 !! wikitext
10627 <includeonly>
10628 ==Includeonly section==
10629 </includeonly>
10630 ==Section 1==
10631 !! html
10632 <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>
10633
10634 !! end
10635
10636 !! test
10637 Bug 6563: Section extraction for section suppressed by <includeonly>
10638 !! options
10639 section=1
10640 !! wikitext
10641 <includeonly>
10642 ==Includeonly section==
10643 </includeonly>
10644 ==Section 1==
10645 !! html
10646 ==Section 1==
10647 !! end
10648
10649 !! test
10650 Un-closed <includeonly>
10651 !! wikitext
10652 <includeonly>
10653 !! html
10654 !! end
10655
10656 !! test
10657 Includes and comments at SOL
10658 !! wikitext
10659 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
10660
10661 <noinclude>
10662 some
10663 </noinclude>* stuff
10664 * here
10665
10666 <includeonly>can have stuff</includeonly>=== here ===
10667
10668 !! html/php
10669 <h2><span class="mw-headline" id="hu">hu</span></h2>
10670 <p>some
10671 </p>
10672 <ul><li> stuff</li>
10673 <li> here</li></ul>
10674 <h3><span class="mw-headline" id="here">here</span></h3>
10675
10676 !! html/parsoid
10677 <!-- 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>
10678
10679 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
10680 <p>some</p>
10681 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
10682 <li> here</li></ul>
10683
10684 <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>
10685
10686 !! end
10687
10688 # TODO: test with DOM fragment reuse!
10689 !! test
10690 Parsoid: DOM fragment reuse
10691 !! options
10692 parsoid=wt2wt,wt2html
10693 !! wikitext
10694 a{{echo|b<table></table>c}}d
10695
10696 a{{echo|b
10697 <table></table>
10698 c}}d
10699
10700 {{echo|a
10701
10702 <table></table>
10703
10704 b}}
10705 !! html
10706 <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>
10707
10708 <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">
10709 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
10710 </span><p about="#mwt2">cd</p>
10711
10712 <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">
10713
10714 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
10715
10716 </span><p about="#mwt3">b</p>
10717 !! end
10718
10719 !! test
10720 Parsoid: Merge double tds (T52603)
10721 !! options
10722 parsoid
10723 !! wikitext
10724 {|
10725 |{{echo|{{!}} foo}}
10726 |}
10727 !! html
10728 <table><tbody>
10729 <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>
10730 </tbody></table>
10731 !! end
10732
10733 !! test
10734 Parsoid: Merge double tds in nested transclusion content (T52603)
10735 !! options
10736 parsoid
10737 !! wikitext
10738 {{echo|<div>}}
10739 {|
10740 |{{echo|{{!}} foo}}
10741 |}
10742 {{echo|</div>}}
10743 !! html
10744 <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}}]}'>
10745 <table><tbody>
10746 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
10747 </tbody></table>
10748 </div>
10749 !! end
10750
10751 ###
10752 ### <includeonly> and <noinclude> in attributes
10753 ###
10754 !!test
10755 0. includeonly around the entire attribute
10756 !! wikitext
10757 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
10758 !! html
10759 <p><span id="v2">bar</span>
10760 </p>
10761 !!end
10762
10763 !!test
10764 1. includeonly in html attr key
10765 !! wikitext
10766 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
10767 !! html
10768 <p><span id="foo">bar</span>
10769 </p>
10770 !!end
10771
10772 !!test
10773 2. includeonly in html attr value
10774 !! wikitext
10775 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
10776 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
10777 !! html
10778 <p><span id="v1">bar</span>
10779 <span id="v1">bar</span>
10780 </p>
10781 !!end
10782
10783 !!test
10784 3. includeonly in part of an attr value
10785 !! wikitext
10786 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
10787 !! html
10788 <p><span style="color:red;">bar</span>
10789 </p>
10790 !!end
10791
10792 !!test
10793 4. includeonly in table attributes
10794 !! wikitext
10795 {|
10796 |- <noinclude>
10797 |-
10798 |a
10799 </noinclude>
10800 |- <includeonly>
10801 |-
10802 |b
10803 </includeonly>
10804 |}
10805 !! html
10806 <table>
10807
10808
10809 <tr>
10810 <td>a
10811 </td></tr>
10812 </table>
10813
10814 !!end
10815
10816 ###
10817 ### Token Stream Patcher tests
10818 ###
10819 ### These tests won't always pass wt2wt and other modes because
10820 ### on serialization, the table will be output on a new line.
10821 ### For now, we are blacklisting them, and using this to test selser.
10822 ###
10823
10824 !!test
10825 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
10826 !!options
10827 parsoid=wt2html,wt2wt
10828 !!wikitext
10829 {{echo|}}{| width = '100%'
10830 |foo
10831 |}
10832 !!html/parsoid
10833 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
10834 <tbody><tr><td>foo</td></tr>
10835 </tbody></table>
10836 !!end
10837
10838 !!test
10839 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
10840 !!options
10841 parsoid=wt2html,wt2wt
10842 !!wikitext
10843 <includeonly>a</includeonly>{| {{{b}}}
10844 |c
10845 |}
10846 !!html/parsoid
10847 <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}}}":""}}'>
10848 <tbody><tr><td>c</td></tr>
10849 </tbody></table>
10850
10851 !!end
10852
10853 ###
10854 ### Testing parsing of templates where a template arg
10855 ### has the same name as the template itself.
10856 ###
10857
10858 !! article
10859 Template:quote
10860 !! text
10861 {{{quote|{{{1}}}}}}
10862 !! endarticle
10863
10864 !!test
10865 Templates: Template Name/Arg clash: 1. Use of positional param
10866 !! wikitext
10867 {{quote|foo}}
10868 !! html
10869 <p>foo
10870 </p>
10871 !!end
10872
10873 !!test
10874 Templates: Template Name/Arg clash: 2. Use of named param
10875 !! wikitext
10876 {{quote|quote=foo}}
10877 !! html
10878 <p>foo
10879 </p>
10880 !!end
10881
10882 !!test
10883 Templates: Template Name/Arg clash: 3. Use of named param with empty input
10884 !! wikitext
10885 {{quote|quote}}
10886 !! html
10887 <p>quote
10888 </p>
10889 !!end
10890
10891 ###
10892 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
10893 ###
10894
10895 !!test
10896 Templates: 1. Simple use
10897 !! wikitext
10898 {{echo|Foo}}
10899 !! html
10900 <p>Foo
10901 </p>
10902 !!end
10903
10904 !!test
10905 Templates: 2. Inside a block tag
10906 !! wikitext
10907 <div>{{echo|Foo}}</div>
10908 <blockquote>{{echo|Foo}}</blockquote>
10909 !! html
10910 <div>Foo</div>
10911 <blockquote>Foo</blockquote>
10912
10913 !! html+tidy
10914 <div>Foo</div>
10915 <blockquote>
10916 <p>Foo</p>
10917 </blockquote>
10918 !!end
10919
10920 !!test
10921 Templates: P-wrapping: 1a. Templates on consecutive lines
10922 !! wikitext
10923 {{echo|Foo}}
10924 {{echo|bar}}
10925 !! html
10926 <p>Foo
10927 bar
10928 </p>
10929 !!end
10930
10931 !!test
10932 Templates: P-wrapping: 1b. Templates on consecutive lines
10933 !! wikitext
10934 Foo
10935
10936 {{echo|bar}}
10937 {{echo|baz}}
10938 !! html
10939 <p>Foo
10940 </p><p>bar
10941 baz
10942 </p>
10943 !!end
10944
10945 !!test
10946 Templates: P-wrapping: 1c. Templates on consecutive lines
10947 !! wikitext
10948 {{echo|Foo}}
10949 {{echo|bar}} <div>baz</div>
10950 !! html
10951 <p>Foo
10952 </p>
10953 bar <div>baz</div>
10954
10955 !! html+tidy
10956 <p>Foo</p>
10957 <p>bar</p>
10958 <div>baz</div>
10959 !! end
10960
10961 !!test
10962 Templates: P-wrapping: 1d. Template preceded by comment-only line
10963 !!options
10964 parsoid
10965 !! wikitext
10966 <!-- foo -->
10967 {{echo|Bar}}
10968 !! html
10969 <!-- foo -->
10970
10971 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
10972 !!end
10973
10974 !!test
10975 Templates: Inline Text: 1. Multiple template uses
10976 !! wikitext
10977 {{echo|Foo}}bar{{echo|baz}}
10978 !! html
10979 <p>Foobarbaz
10980 </p>
10981 !!end
10982
10983 !!test
10984 Templates: Inline Text: 2. Back-to-back template uses
10985 !! wikitext
10986 {{echo|Foo}}{{echo|bar}}
10987 !! html
10988 <p>Foobar
10989 </p>
10990 !!end
10991
10992 !!test
10993 Templates: Block Tags: 1. Multiple template uses
10994 !! wikitext
10995 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
10996 !! html
10997 <div>Foo</div><div>bar</div><div>baz</div>
10998
10999 !!end
11000
11001 !!test
11002 Templates: Block Tags: 2. Back-to-back template uses
11003 !! wikitext
11004 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11005 !! html
11006 <div>Foo</div><div>bar</div>
11007
11008 !!end
11009
11010 # This is an edge case relating to paragraph wrapping.
11011 !!test
11012 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11013 !! wikitext
11014 {{echo|a
11015 b</p>}}
11016 !! html/parsoid
11017 <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
11018 b</p>
11019 !!end
11020
11021 !!test
11022 Templates: Links: 1. Simple example
11023 !! wikitext
11024 {{echo|[[Foo|bar]]}}
11025 !! html
11026 <p><a href="/wiki/Foo" title="Foo">bar</a>
11027 </p>
11028 !!end
11029
11030 !!test
11031 Templates: Links: 2. Generation of link href
11032 !! wikitext
11033 [[{{echo|Foo}}|bar]]
11034 !! html
11035 <p><a href="/wiki/Foo" title="Foo">bar</a>
11036 </p>
11037 !!end
11038
11039 !!test
11040 Templates: Links: 3. Generation of part of a link href
11041 !! wikitext
11042 [[Fo{{echo|o}}|bar]]
11043
11044 [[Foo{{echo|bar}}]]
11045
11046 [[Foo{{echo|bar}}baz]]
11047
11048 [[Foo{{echo|bar}}|bar]]
11049
11050 [[:Foo{{echo|bar}}]]
11051
11052 [[:Foo{{echo|bar}}|bar]]
11053 !! html
11054 <p><a href="/wiki/Foo" title="Foo">bar</a>
11055 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11056 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11057 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11058 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11059 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11060 </p>
11061 !!end
11062
11063 !!test
11064 Templates: Links: 4. Multiple templates generating link href
11065 !! wikitext
11066 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11067 !! html
11068 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11069 </p>
11070 !!end
11071
11072 !!test
11073 Templates: Links: 5. Generation of link text
11074 !! wikitext
11075 [[Foo|{{echo|bar}}]]
11076 !! html
11077 <p><a href="/wiki/Foo" title="Foo">bar</a>
11078 </p>
11079 !!end
11080
11081 !!test
11082 Templates: Links: 5. Nested templates (only outermost template should be marked)
11083 !! wikitext
11084 {{echo|[[{{echo|Foo}}|bar]]}}
11085 !! html
11086 <p><a href="/wiki/Foo" title="Foo">bar</a>
11087 </p>
11088 !!end
11089
11090 !!test
11091 Templates: HTML Tag: 1. Generation of HTML attr. key
11092 !! wikitext
11093 <div {{echo|style}}="color:red;">foo</div>
11094 !! html
11095 <div style="color:red;">foo</div>
11096
11097 !!end
11098
11099 !!test
11100 Templates: HTML Tag: 2. Generation of HTML attr. value
11101 !! wikitext
11102 <div style={{echo|'color:red;'}}>foo</div>
11103 !! html
11104 <div style="color:red;">foo</div>
11105
11106 !!end
11107
11108 !!test
11109 Templates: HTML Tag: 3. Generation of HTML attr key and value
11110 !! wikitext
11111 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11112 !! html
11113 <div style="color:red;">foo</div>
11114
11115 !!end
11116
11117 !!test
11118 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11119 !! wikitext
11120 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11121 !! html
11122 <div title="This is a long title with just one piece templated">foo</div>
11123
11124 !!end
11125
11126 !!test
11127 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11128 !! wikitext
11129 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11130 !! html
11131 <div title="This is a long title with just one piece templated">foo</div>
11132
11133 !!end
11134
11135 !!test
11136 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11137 !! wikitext
11138 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11139 !! html
11140 <div title="This is a long title with just one piece templated">foo</div>
11141
11142 !!end
11143
11144 # SSS FIXME: While it is great we added support for all this,
11145 # do we want to make this part of the spec? Maybe we want to
11146 # deprecate this kind of usage in the future?
11147 !!test
11148 Templates: HTML Tag: 7. Generation of partial attribute key string
11149 !! wikitext
11150 <div st{{echo|yle}}="color:red;">foo</div>
11151 !! html
11152 <div style="color:red;">foo</div>
11153
11154 !!end
11155
11156 !! test
11157 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11158 !! wikitext
11159 <div {{echo|1=id="v1"}}>bar</div>
11160 !! html
11161 <div id="v1">bar</div>
11162
11163 !!end
11164
11165 !! test
11166 Templates: HTML Tag: 9. Multiple template-generated attributes
11167 !! wikitext
11168 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11169 !! html
11170 <div id="v1" title="foo">bar</div>
11171
11172 !!end
11173
11174 !! test
11175 Templates: Support for templates generating attributes and content
11176 !! wikitext
11177 {| {{mixed_attr_content_template}}
11178 |-
11179 |bar
11180 |}
11181 !! html/php
11182 <table style="color:red;" title="T48811">
11183
11184 <tr>
11185 <td>foo
11186 </td></tr>
11187 <tr>
11188 <td>bar
11189 </td></tr></table>
11190
11191 !! html/parsoid
11192 <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|}"]}'>
11193 <tbody><tr>
11194 <td>foo</td></tr>
11195 <tr>
11196 <td>bar</td></tr>
11197 </tbody></table>
11198 !!end
11199
11200 !! test
11201 1. Entities and nowikis inside templated attributes should be handled correctly
11202 !! wikitext
11203 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11204 !! html/php
11205 <div style="background:#f9f9f9;">foo</div>
11206
11207 !! html/parsoid
11208 <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>
11209 !! end
11210
11211 !! test
11212 2. Entities and nowikis inside templated attributes should be handled correctly
11213 !! wikitext
11214 {|
11215 |{{table_attribs_3}}
11216 |}
11217 !! html/php
11218 <table>
11219 <tr>
11220 <td style="background:#f9f9f9;">Foo
11221 </td></tr></table>
11222
11223 !! html/parsoid
11224 <table>
11225 <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>
11226 </tbody></table>
11227 !! end
11228
11229 !! test
11230 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11231 !! wikitext
11232 {{tbl-start}}
11233 |{{table_attribs_3}}
11234 {{tbl-end}}
11235 !! html/php
11236 <table>
11237 <tr>
11238 <td style="background:#f9f9f9;">Foo
11239 </td></tr></table>
11240
11241 !! html/parsoid
11242 <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}}]}'>
11243 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11244 </tbody></table>
11245 !! end
11246
11247 # T107622
11248 !! test
11249 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11250 !! wikitext
11251 {|
11252 | {{table_attribs_6}} hi
11253 |}
11254 !! html/php
11255 <table>
11256 <tr>
11257 <td style="background: red;"> hi
11258 </td></tr></table>
11259
11260 !! html/parsoid
11261 <table>
11262 <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>
11263 </tbody></table>
11264 !! end
11265
11266 !!test
11267 Templates: HTML Tables: 1. Generating start of a HTML table
11268 !! wikitext
11269 {{echo|<table><tr><td>foo</td>}}</tr></table>
11270 !! html
11271 <table><tr><td>foo</td></tr></table>
11272
11273 !!end
11274
11275 !!test
11276 Templates: HTML Tables: 2a. Generating middle of a HTML table
11277 !! wikitext
11278 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11279 !! html
11280 <table><tr><td>foo</td></tr></table>
11281
11282 !!end
11283
11284 !!test
11285 Templates: HTML Tables: 2b. Generating middle of a HTML table
11286 !! wikitext
11287 <table>{{echo|<tr><td>foo</td></tr>}}</table>
11288 !! html
11289 <table><tr><td>foo</td></tr></table>
11290
11291 !!end
11292
11293 !!test
11294 Templates: HTML Tables: 3. Generating end of a HTML table
11295 !! wikitext
11296 <table><tr>{{echo|<td>foo</td></tr></table>}}
11297 !! html
11298 <table><tr><td>foo</td></tr></table>
11299
11300 !!end
11301
11302 !!test
11303 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
11304 !! wikitext
11305 {{echo|<table>}}<tr><td>foo</td></tr></table>
11306 !! html
11307 <table><tr><td>foo</td></tr></table>
11308
11309 !!end
11310
11311 !!test
11312 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
11313 !! wikitext
11314 <table>{{echo|<tr>}}<td>foo</td></tr></table>
11315 !! html
11316 <table><tr><td>foo</td></tr></table>
11317
11318 !!end
11319
11320 !!test
11321 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
11322 !! wikitext
11323 <table><tr>{{echo|<td>}}foo</td></tr></table>
11324 !! html
11325 <table><tr><td>foo</td></tr></table>
11326
11327 !!end
11328
11329 !!test
11330 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
11331 !! wikitext
11332 <table><tr><td>foo{{echo|</td>}}</tr></table>
11333 !! html
11334 <table><tr><td>foo</td></tr></table>
11335
11336 !!end
11337
11338 !!test
11339 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
11340 !! wikitext
11341 <table><tr><td>foo</td>{{echo|</tr>}}</table>
11342 !! html
11343 <table><tr><td>foo</td></tr></table>
11344
11345 !!end
11346
11347 !!test
11348 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
11349 !! wikitext
11350 <table><tr><td>foo</td></tr>{{echo|</table>}}
11351 !! html
11352 <table><tr><td>foo</td></tr></table>
11353
11354 !!end
11355
11356 !!test
11357 Templates: HTML Tables: 5. Proper fostering of categories from inside
11358 !!options
11359 parsoid=wt2html,wt2wt
11360 !! wikitext
11361 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
11362 <!--Two categories (Bug 50330)-->
11363 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
11364 !! html
11365 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
11366 <!--Two categories (Bug 50330)-->
11367 <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>
11368 !!end
11369
11370 !!test
11371 Templates: Wiki Tables: 1a. Fostering of entire template content
11372 !! wikitext
11373 {|
11374 {{echo|a}}
11375 |}
11376 !! html
11377 <table>
11378 a
11379 <tr><td></td></tr></table>
11380
11381 !! html+tidy
11382 <p>a</p>
11383 <table>
11384 <tr>
11385 <td></td>
11386 </tr>
11387 </table>
11388 !! end
11389
11390 !!test
11391 Templates: Wiki Tables: 1b. Fostering of entire template content
11392 !! wikitext
11393 {|
11394 {{echo|<div>}}
11395 foo
11396 {{echo|</div>}}
11397 |}
11398 !! html
11399 <table>
11400 <div>
11401 <p>foo
11402 </p>
11403 </div>
11404 <tr><td></td></tr></table>
11405
11406 !! html+tidy
11407 <div>
11408 <p>foo</p>
11409 </div>
11410 <table>
11411 <tr>
11412 <td></td>
11413 </tr>
11414 </table>
11415 !! end
11416
11417 !!test
11418 Templates: Wiki Tables: 2. Fostering of partial template content
11419 !! wikitext
11420 {|
11421 {{echo|a
11422 <div>b</div>}}
11423 |}
11424 !! html
11425 <table>
11426 a
11427 <div>b</div>
11428 <tr><td></td></tr></table>
11429
11430 !! html+tidy
11431 <p>a</p>
11432 <div>b</div>
11433 <table>
11434 <tr>
11435 <td></td>
11436 </tr>
11437 </table>
11438 !! end
11439
11440 !!test
11441 Templates: Wiki Tables: 3. td-content via multiple templates
11442 !! wikitext
11443 {|
11444 {{echo|{{pipe}}a}}{{echo|b}}
11445 |}
11446 !! html
11447 <table>
11448 <tr>
11449 <td>ab
11450 </td></tr></table>
11451
11452 !!end
11453
11454 !!test
11455 Templates: Wiki Tables: 4. Templated tags, no content
11456 !! wikitext
11457 {{tbl-start}}
11458 {{tbl-end}}
11459 !! html
11460 <table>
11461 <tr><td></td></tr></table>
11462
11463 !!end
11464
11465 !!test
11466 Templates: Wiki Tables: 5. Templated tags, regular td-tags
11467 !! wikitext
11468 {{tbl-start}}
11469 |foo
11470 {{tbl-end}}
11471 !! html
11472 <table>
11473 <tr>
11474 <td>foo
11475 </td></tr></table>
11476
11477 !!end
11478
11479 !!test
11480 Templates: Wiki Tables: 6. Templated tags, templated td-tags
11481 !! wikitext
11482 {{tbl-start}}
11483 {{!}}foo
11484 {{tbl-end}}
11485 !! html
11486 <table>
11487 <tr>
11488 <td>foo
11489 </td></tr></table>
11490
11491 !!end
11492
11493 ## This test case is very specific to Parsoid's internals
11494 ## and is hence only tested for Parsoid's code. Parsoid uses
11495 ## a <meta> marker tag for <ref> tags and they are expanded
11496 ## much later. We are verifying that this <meta> tag usage
11497 ## doesn't prevent foster parenting.
11498 !!test
11499 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
11500 !!wikitext
11501 {{PartialTable}}<ref>foo</ref>
11502 |}
11503
11504 <references />
11505 !!html/parsoid
11506 <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">
11507 <tbody>
11508 </tbody></table>
11509
11510 <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>
11511 !!end
11512
11513 !! test
11514 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
11515 !! wikitext
11516 {{echo|
11517 {{{!}}
11518 {{!}}-}}
11519 <onlyinclude>
11520 |foo
11521 </onlyinclude>
11522 {{!}}}
11523 !! html/parsoid
11524 <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{{!}}}"]}'>
11525 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
11526 <tbody><tr>
11527
11528 <td>foo
11529 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
11530 </tbody></table>
11531 !! end
11532
11533 !!test
11534 Templates: Lists: Multi-line list-items via templates
11535 !! wikitext
11536 *{{echo|a {{nonexistent|
11537 unused}}}}
11538 *{{echo|b {{nonexistent|
11539 unused}}}}
11540 !! html
11541 <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>
11542 <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>
11543
11544 !!end
11545
11546 !!test
11547 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
11548 !! wikitext
11549 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
11550 !! html
11551 <p><i>ab</i>c<i>d</i>e
11552 </p>
11553 !!end
11554
11555 !!test
11556 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
11557 (PHP parser generates misnested html)
11558 !! wikitext
11559 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
11560 !! html/parsoid
11561 <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>
11562 !!end
11563
11564 !!test
11565 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
11566 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
11567 !! options
11568 parsoid=wt2html,wt2wt
11569 !! wikitext
11570 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
11571 !! html
11572 <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>
11573 <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>
11574 <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>
11575 !!end
11576
11577 !!test
11578 Templates: Ugly nesting: 4. Divs opened/closed across templates
11579 !! wikitext
11580 a<div>b{{echo|c</div>d}}e
11581 !! html
11582 a<div>bc</div>de
11583
11584 !! html+tidy
11585 <p>a</p>
11586 <div>bc</div>
11587 <p>de</p>
11588 !! end
11589
11590 !!test
11591 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
11592 (Parsoid-centric)
11593 !! options
11594 parsoid
11595 !! wikitext
11596 {|
11597 |{{echo|foo</table>}}
11598 |bar
11599 |}
11600 !! html
11601 <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|}"]}'>
11602
11603 <tbody>
11604 <tr>
11605 <td>foo</td></tr></tbody></table><span about="#mwt1">
11606 </span><span about="#mwt1">|bar</span><span about="#mwt1">
11607 |}</span>
11608 !!end
11609
11610 !!test
11611 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
11612 (Parsoid-centric)
11613 !! options
11614 parsoid
11615 !! wikitext
11616 <table>
11617 <tr>
11618 <td>
11619 <table>
11620 <tr>
11621 <td>1. {{echo|foo </table>}}</td>
11622 <td> bar </td>
11623 <td>2. {{echo|baz </table>}}</td>
11624 </tr>
11625 <tr>
11626 <td>abc</td>
11627 </tr>
11628 </table>
11629 </td>
11630 </tr>
11631 <tr>
11632 <td>xyz</td>
11633 </tr>
11634 </table>
11635 !! html
11636 <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>"]}'>
11637 <tbody><tr>
11638 <td>
11639 <table>
11640 <tbody><tr>
11641 <td>1. foo </td></tr></tbody></table></td>
11642 <td> bar </td>
11643 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
11644 </span><span about="#mwt2">
11645 </span><span about="#mwt2">
11646 </span><span about="#mwt2">abc</span><span about="#mwt2">
11647 </span><span about="#mwt2">
11648 </span><span about="#mwt2">
11649 </span><span about="#mwt2">
11650 </span><span about="#mwt2">
11651 </span><span about="#mwt2">
11652 </span><span about="#mwt2">xyz</span><span about="#mwt2">
11653 </span><span about="#mwt2">
11654 </span>
11655 !!end
11656
11657 !! test
11658 Templates: Ugly templates: 3. newline-only template parameter
11659 !! wikitext
11660 foo {{echo|
11661 }}
11662 !! html
11663 <p>foo
11664 </p>
11665 !! end
11666
11667 # This looks like a bug: a single newline triggers p/br for some reason.
11668 !! test
11669 Templates: Ugly templates: 4. newline-only template parameter inconsistency
11670 !! wikitext
11671 {{echo|
11672 }}
11673 !! html
11674 <p><br />
11675 </p>
11676 !! end
11677
11678 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
11679 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
11680 !! test
11681 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
11682 !! wikitext
11683 {{echo|<table>}}
11684 {{echo|<div>foo}}
11685 {{echo|</table>}}
11686 !! html/parsoid
11687 <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
11688 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11689 </table>
11690 !! end
11691
11692 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
11693 # that are "identical" and generate nesting cycles in the algorithm
11694 !! test
11695 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
11696 !! wikitext
11697 {{echo|<table><tr><td><table>}}
11698 {{echo|<div>}}
11699 {{echo|</div>}}
11700 !! html/parsoid
11701 <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"}'>
11702 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11703 </table></td></tr></tbody></table>
11704 !! end
11705
11706 !!test
11707 Parser Functions: 1. Simple example
11708 !! wikitext
11709 {{uc:foo}}
11710 !! html
11711 <p>FOO
11712 </p>
11713 !!end
11714
11715 !!test
11716 Parser Functions: 2. Nested use (only outermost should be marked up)
11717 !! wikitext
11718 {{uc:{{lc:FOO}}}}
11719 !! html
11720 <p>FOO
11721 </p>
11722 !!end
11723
11724 ###
11725 ### Pre-save transform tests
11726 ###
11727 !! test
11728 pre-save transform: subst:
11729 !! options
11730 pst
11731 !! wikitext
11732 {{subst:test}}
11733 !! html/php
11734 This is a test template
11735 !! end
11736
11737 !! test
11738 pre-save transform: normal template
11739 !! options
11740 pst
11741 !! wikitext
11742 {{test}}
11743 !! html/php
11744 {{test}}
11745 !! end
11746
11747 !! test
11748 pre-save transform: nonexistent template
11749 !! options
11750 pst
11751 !! wikitext
11752 {{thistemplatedoesnotexist}}
11753 !! html/php
11754 {{thistemplatedoesnotexist}}
11755 !! end
11756
11757 !! test
11758 pre-save transform: subst magic variables
11759 !! options
11760 pst
11761 !! wikitext
11762 {{subst:SITENAME}}
11763 !! html/php
11764 MediaWiki
11765 !! end
11766
11767 # This is bug 89, which I fixed. -- wtm
11768 !! test
11769 pre-save transform: subst: templates with parameters
11770 !! options
11771 pst
11772 !! wikitext
11773 {{subst:paramtest|param="something else"}}
11774 !! html/php
11775 This is a test template with parameter "something else"
11776 !! end
11777
11778 !! article
11779 Template:nowikitest
11780 !! text
11781 <nowiki>'''not wiki'''</nowiki>
11782 !! endarticle
11783
11784 !! test
11785 pre-save transform: nowiki in subst (bug 1188)
11786 !! options
11787 pst
11788 !! wikitext
11789 {{subst:nowikitest}}
11790 !! html/php
11791 <nowiki>'''not wiki'''</nowiki>
11792 !! end
11793
11794 !! article
11795 Template:commenttest
11796 !! text
11797 This template has <!-- a comment --> in it.
11798 !! endarticle
11799
11800 !! test
11801 pre-save transform: comment in subst (bug 1936)
11802 !! options
11803 pst
11804 !! wikitext
11805 {{subst:commenttest}}
11806 !! html/php
11807 This template has <!-- a comment --> in it.
11808 !! end
11809
11810 !! test
11811 pre-save transform: unclosed tag
11812 !! options
11813 pst noxml
11814 !! wikitext
11815 <nowiki>'''not wiki'''
11816 !! html/php
11817 <nowiki>'''not wiki'''
11818 !! end
11819
11820 !! test
11821 pre-save transform: mixed tag case
11822 !! options
11823 pst noxml
11824 !! wikitext
11825 <NOwiki>'''not wiki'''</noWIKI>
11826 !! html/php
11827 <NOwiki>'''not wiki'''</noWIKI>
11828 !! end
11829
11830 !! test
11831 pre-save transform: unclosed comment in <nowiki>
11832 !! options
11833 pst noxml
11834 !! wikitext
11835 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
11836 !! html/php
11837 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
11838 !!end
11839
11840 # Leading @ in this template definition works around a limitation
11841 # in parsoid's parserTests which otherwise strips the <span> from the
11842 # result (confusing it for a template wrapper)
11843 !! article
11844 Template:dangerous
11845 !!text
11846 @<span onmouseover="alert('crap')">Oh no</span>
11847 !!endarticle
11848
11849 !!test
11850 (confirming safety of fix for subst bug 1936)
11851 !! wikitext
11852 {{Template:dangerous}}
11853 !! html
11854 <p>@<span>Oh no</span>
11855 </p>
11856 !! end
11857
11858 !! test
11859 pre-save transform: comment containing gallery (bug 5024)
11860 !! options
11861 pst
11862 !! wikitext
11863 <!-- <gallery>data</gallery> -->
11864 !! html/php
11865 <!-- <gallery>data</gallery> -->
11866 !!end
11867
11868 !! test
11869 pre-save transform: comment containing extension
11870 !! options
11871 pst
11872 !! wikitext
11873 <!-- <tag>data</tag> -->
11874 !! html/php
11875 <!-- <tag>data</tag> -->
11876 !!end
11877
11878 !! test
11879 pre-save transform: comment containing nowiki
11880 !! options
11881 pst
11882 !! wikitext
11883 <!-- <nowiki>data</nowiki> -->
11884 !! html/php
11885 <!-- <nowiki>data</nowiki> -->
11886 !!end
11887
11888 !! test
11889 pre-save transform: <noinclude> in subst (bug 3298)
11890 !! options
11891 pst
11892 !! wikitext
11893 {{subst:Includes}}
11894 !! html/php
11895 Foobar
11896 !! end
11897
11898 !! test
11899 pre-save transform: <onlyinclude> in subst (bug 3298)
11900 !! options
11901 pst
11902 !! wikitext
11903 {{subst:Includes2}}
11904 !! html/php
11905 Foo
11906 !! end
11907
11908 !! article
11909 Template:SubstTest
11910 !!text
11911 {{<includeonly>subst:</includeonly>Includes}}
11912 !! endarticle
11913
11914 !! article
11915 Template:SafeSubstTest
11916 !! text
11917 {{<includeonly>safesubst:</includeonly>Includes}}
11918 !! endarticle
11919
11920 !! test
11921 bug 22297: safesubst: works during PST
11922 !! options
11923 pst
11924 !! wikitext
11925 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
11926 !! html/php
11927 FoobarFoobar
11928 !! end
11929
11930 !! test
11931 bug 22297: safesubst: works during normal parse
11932 !! wikitext
11933 {{SafeSubstTest}}
11934 !! html
11935 <p>Foobar
11936 </p>
11937 !! end
11938
11939 !! test
11940 subst: does not work during normal parse
11941 !! wikitext
11942 {{SubstTest}}
11943 !! html
11944 <p>{{subst:Includes}}
11945 </p>
11946 !! end
11947
11948 !! test
11949 pre-save transform: context links ("pipe trick")
11950 !! options
11951 pst
11952 !! wikitext
11953 [[Article (context)|]]
11954 [[Bar:Article|]]
11955 [[:Bar:Article|]]
11956 [[Bar:Article (context)|]]
11957 [[:Bar:Article (context)|]]
11958 [[|Article]]
11959 [[|Article (context)]]
11960 [[Bar:X (Y) Z|]]
11961 [[:Bar:X (Y) Z|]]
11962 !! html/php
11963 [[Article (context)|Article]]
11964 [[Bar:Article|Article]]
11965 [[:Bar:Article|Article]]
11966 [[Bar:Article (context)|Article]]
11967 [[:Bar:Article (context)|Article]]
11968 [[Article]]
11969 [[Article (context)]]
11970 [[Bar:X (Y) Z|X (Y) Z]]
11971 [[:Bar:X (Y) Z|X (Y) Z]]
11972 !! end
11973
11974 !! test
11975 pre-save transform: context links ("pipe trick") with interwiki prefix
11976 !! options
11977 pst
11978 !! wikitext
11979 [[interwiki:Article|]]
11980 [[:interwiki:Article|]]
11981 [[interwiki:Bar:Article|]]
11982 [[:interwiki:Bar:Article|]]
11983 !! html/php
11984 [[interwiki:Article|Article]]
11985 [[:interwiki:Article|Article]]
11986 [[interwiki:Bar:Article|Bar:Article]]
11987 [[:interwiki:Bar:Article|Bar:Article]]
11988 !! end
11989
11990 !! test
11991 pre-save transform: context links ("pipe trick") with parens in title
11992 !! options
11993 pst title=[[Somearticle (context)]]
11994 !! wikitext
11995 [[|Article]]
11996 !! html/php
11997 [[Article (context)|Article]]
11998 !! end
11999
12000 !! test
12001 pre-save transform: context links ("pipe trick") with comma in title
12002 !! options
12003 pst title=[[Someplace, Somewhere]]
12004 !! wikitext
12005 [[|Otherplace]]
12006 [[Otherplace, Elsewhere|]]
12007 [[Otherplace, Elsewhere, Anywhere|]]
12008 !! html/php
12009 [[Otherplace, Somewhere|Otherplace]]
12010 [[Otherplace, Elsewhere|Otherplace]]
12011 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12012 !! end
12013
12014 !! test
12015 pre-save transform: context links ("pipe trick") with parens and comma
12016 !! options
12017 pst title=[[Someplace (IGNORED), Somewhere]]
12018 !! wikitext
12019 [[|Otherplace]]
12020 [[Otherplace (place), Elsewhere|]]
12021 !! html/php
12022 [[Otherplace, Somewhere|Otherplace]]
12023 [[Otherplace (place), Elsewhere|Otherplace]]
12024 !! end
12025
12026 !! test
12027 pre-save transform: context links ("pipe trick") with comma and parens
12028 !! options
12029 pst title=[[Who, me? (context)]]
12030 !! wikitext
12031 [[|Yes, you.]]
12032 [[Me, Myself, and I (1937 song)|]]
12033 !! html/php
12034 [[Yes, you. (context)|Yes, you.]]
12035 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12036 !! end
12037
12038 !! test
12039 pre-save transform: context links ("pipe trick") with namespace
12040 !! options
12041 pst title=[[Ns:Somearticle]]
12042 !! wikitext
12043 [[|Article]]
12044 !! html/php
12045 [[Ns:Article|Article]]
12046 !! end
12047
12048 !! test
12049 pre-save transform: context links ("pipe trick") with namespace and parens
12050 !! options
12051 pst title=[[Ns:Somearticle (context)]]
12052 !! wikitext
12053 [[|Article]]
12054 !! html/php
12055 [[Ns:Article (context)|Article]]
12056 !! end
12057
12058 !! test
12059 pre-save transform: context links ("pipe trick") with namespace and comma
12060 !! options
12061 pst title=[[Ns:Somearticle, Context, Whatever]]
12062 !! wikitext
12063 [[|Article]]
12064 !! html/php
12065 [[Ns:Article, Context, Whatever|Article]]
12066 !! end
12067
12068 !! test
12069 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12070 !! options
12071 pst title=[[Ns:Somearticle, Context (context)]]
12072 !! wikitext
12073 [[|Article]]
12074 !! html/php
12075 [[Ns:Article (context)|Article]]
12076 !! end
12077
12078 !! test
12079 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12080 !! options
12081 pst title=[[Ns:Somearticle (IGNORED), Context]]
12082 !! wikitext
12083 [[|Article]]
12084 !! html/php
12085 [[Ns:Article, Context|Article]]
12086 !! end
12087
12088 !! test
12089 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12090 !! options
12091 pst
12092 !! wikitext
12093 [[Article(context)|]]
12094 [[Bar:Article(context)|]]
12095 [[:Bar:Article(context)|]]
12096 [[|Article(context)]]
12097 [[Bar:X(Y)Z|]]
12098 [[:Bar:X(Y)Z|]]
12099 !! html/php
12100 [[Article(context)|Article]]
12101 [[Bar:Article(context)|Article]]
12102 [[:Bar:Article(context)|Article]]
12103 [[Article(context)]]
12104 [[Bar:X(Y)Z|X(Y)Z]]
12105 [[:Bar:X(Y)Z|X(Y)Z]]
12106 !! end
12107
12108 !! test
12109 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12110 !! options
12111 pst
12112 !! wikitext
12113 [[Article (context)|]]
12114 [[Bar:Article (context)|]]
12115 [[:Bar:Article (context)|]]
12116 [[|Article (context)]]
12117 [[Bar:X (Y) Z|]]
12118 [[:Bar:X (Y) Z|]]
12119 !! html/php
12120 [[Article (context)|Article]]
12121 [[Bar:Article (context)|Article]]
12122 [[:Bar:Article (context)|Article]]
12123 [[Article (context)]]
12124 [[Bar:X (Y) Z|X (Y) Z]]
12125 [[:Bar:X (Y) Z|X (Y) Z]]
12126 !! end
12127
12128 !! test
12129 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12130 !! options
12131 pst
12132 !! wikitext
12133 [[Article(context)|]]
12134 [[Bar:Article(context)|]]
12135 [[:Bar:Article(context)|]]
12136 [[|Article(context)]]
12137 [[Bar:X(Y)Z|]]
12138 [[:Bar:X(Y)Z|]]
12139 !! html/php
12140 [[Article(context)|Article]]
12141 [[Bar:Article(context)|Article]]
12142 [[:Bar:Article(context)|Article]]
12143 [[Article(context)]]
12144 [[Bar:X(Y)Z|X(Y)Z]]
12145 [[:Bar:X(Y)Z|X(Y)Z]]
12146 !! end
12147
12148 !! test
12149 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12150 !! options
12151 pst
12152 !! wikitext
12153 [[Article (context), context|]]
12154 [[Article (context),context|]]
12155 [[Bar:Article (context), context|]]
12156 [[Bar:Article (context),context|]]
12157 [[:Bar:Article (context), context|]]
12158 [[:Bar:Article (context),context|]]
12159 !! html/php
12160 [[Article (context), context|Article]]
12161 [[Article (context),context|Article]]
12162 [[Bar:Article (context), context|Article]]
12163 [[Bar:Article (context),context|Article]]
12164 [[:Bar:Article (context), context|Article]]
12165 [[:Bar:Article (context),context|Article]]
12166 !! end
12167
12168 !! test
12169 pre-save transform: trim trailing empty lines
12170 !! options
12171 pst
12172 !! wikitext
12173 Empty lines are trimmed
12174
12175
12176
12177
12178 !! html/php
12179 Empty lines are trimmed
12180 !! end
12181
12182 !! test
12183 pre-save transform: Signature expansion
12184 !! options
12185 pst
12186 !! wikitext
12187 * ~~~
12188 * <noinclude>~~~</noinclude>
12189 * <includeonly>~~~</includeonly>
12190 * <onlyinclude>~~~</onlyinclude>
12191 !! html/php
12192 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12193 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12194 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12195 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12196 !! end
12197
12198
12199 !! test
12200 pre-save transform: Signature expansion in nowiki tags (bug 93)
12201 !! options
12202 pst disabled
12203 !! wikitext
12204 Shall not expand:
12205
12206 <nowiki>~~~~</nowiki>
12207
12208 <includeonly><nowiki>~~~~</nowiki></includeonly>
12209
12210 <noinclude><nowiki>~~~~</nowiki></noinclude>
12211
12212 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12213
12214 {{subst:Foo}} shall be converted to FOO
12215
12216 As well as inside noinclude/onlyinclude
12217 <noinclude>{{subst:Foo}}</noinclude>
12218 <onlyinclude>{{subst:Foo}}</onlyinclude>
12219
12220 But not inside includeonly
12221 <includeonly>{{subst:Foo}}</includeonly>
12222 !! html/php
12223 Shall not expand:
12224
12225 <nowiki>~~~~</nowiki>
12226
12227 <includeonly><nowiki>~~~~</nowiki></includeonly>
12228
12229 <noinclude><nowiki>~~~~</nowiki></noinclude>
12230
12231 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12232
12233 FOO shall be converted to FOO
12234
12235 As well as inside noinclude/onlyinclude
12236 <noinclude>FOO</noinclude>
12237 <onlyinclude>FOO</onlyinclude>
12238
12239 But not inside includeonly
12240 <includeonly>{{subst:Foo}}</includeonly>
12241 !! end
12242
12243 !! test
12244 Parsoid: Recognize nowiki with trailing space in tags
12245 !! options
12246 parsoid=wt2html
12247 !! wikitext
12248 <nowiki ><div>[[foo]]</nowiki >
12249
12250 a<nowiki / >b
12251
12252 c<nowiki />d
12253
12254 e<nowiki/ >f
12255 !! html
12256 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12257 <p>ab</p>
12258 <p>cd</p>
12259 <p>ef</p>
12260 !! end
12261
12262 !! test
12263 Parsoid: Recognize nowiki with odd capitalization
12264 !! options
12265 parsoid=wt2html
12266 !! wikitext
12267 <noWikI ><div>[[foo]]</Nowiki >
12268 !! html
12269 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12270 !! end
12271
12272
12273 !! test
12274 Parsoid: Escape nowiki with trailing space in tags
12275 !! options
12276 parsoid=html2wt
12277 !! html/parsoid
12278 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12279 <p>a&lt;nowiki /&gt;b</p>
12280 <p>c&lt;nowiki/ &gt;d</p>
12281 !! wikitext
12282 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12283
12284 a&lt;nowiki /&gt;b
12285
12286 c&lt;nowiki/ &gt;d
12287 !! end
12288
12289 !! test
12290 Parsoid: Escape weird noWikI capitalizations
12291 !! options
12292 parsoid=html2wt
12293 !! html/parsoid
12294 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
12295 !! wikitext
12296 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
12297 !! end
12298
12299 ###
12300 ### Message transform tests
12301 ###
12302 !! test
12303 message transform: magic variables
12304 !! options
12305 msg
12306 !! wikitext
12307 {{SITENAME}}
12308 !! html
12309 MediaWiki
12310 !! end
12311
12312 !! test
12313 message transform: should not transform wiki markup
12314 !! options
12315 msg
12316 !! wikitext
12317 ''test''
12318 !! html
12319 ''test''
12320 !! end
12321
12322 !! test
12323 message transform: <noinclude> in transcluded template (bug 4926)
12324 !! options
12325 msg
12326 !! wikitext
12327 {{Includes}}
12328 !! html
12329 Foobar
12330 !! end
12331
12332 !! test
12333 message transform: <onlyinclude> in transcluded template (bug 4926)
12334 !! options
12335 msg
12336 !! wikitext
12337 {{Includes2}}
12338 !! html
12339 Foo
12340 !! end
12341
12342 !! test
12343 {{#special:}} page name, known
12344 !! options
12345 msg
12346 !! wikitext
12347 {{#special:Recentchanges}}
12348 !! html
12349 Special:RecentChanges
12350 !! end
12351
12352 !! test
12353 {{#special:}} page name with subpage, known
12354 !! options
12355 msg
12356 !! wikitext
12357 {{#special:Recentchanges/param}}
12358 !! html
12359 Special:RecentChanges/param
12360 !! end
12361
12362 !! test
12363 {{#special:}} page name, unknown
12364 !! options
12365 msg
12366 !! wikitext
12367 {{#special:foobar nonexistent}}
12368 !! html
12369 Special:Foobar nonexistent
12370 !! end
12371
12372 !! test
12373 {{#speciale:}} page name, known
12374 !! options
12375 msg
12376 !! wikitext
12377 {{#speciale:Recentchanges}}
12378 !! html
12379 Special:RecentChanges
12380 !! end
12381
12382 !! test
12383 {{#speciale:}} page name with subpage, known
12384 !! options
12385 msg
12386 !! wikitext
12387 {{#speciale:Recentchanges/param}}
12388 !! html
12389 Special:RecentChanges/param
12390 !! end
12391
12392 !! test
12393 {{#speciale:}} page name, unknown
12394 !! options
12395 msg
12396 !! wikitext
12397 {{#speciale:foobar nonexistent}}
12398 !! html
12399 Special:Foobar_nonexistent
12400 !! end
12401
12402 ###
12403 ### Images
12404 ###
12405 ### For Parsoid-specific tests, see
12406 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12407
12408 !! test
12409 Simple image
12410 !! options
12411 parsoid=wt2html,wt2wt,html2html
12412 !! wikitext
12413 [[Image:foobar.jpg]]
12414 !! html/php
12415 <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>
12416 </p>
12417 !! html/parsoid
12418 <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>
12419 !! end
12420
12421 !! test
12422 Simple image (using File: namespace, now canonical)
12423 !! wikitext
12424 [[File:Foobar.jpg]]
12425 !! html/php
12426 <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>
12427 </p>
12428 !! html/parsoid
12429 <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>
12430 !! end
12431
12432 !! test
12433 Right-aligned image
12434 !! wikitext
12435 [[File:Foobar.jpg|right]]
12436 !! html/php
12437 <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>
12438
12439 !! html/parsoid
12440 <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>
12441 !! end
12442
12443 !! test
12444 Image with caption
12445 !! wikitext
12446 [[File:Foobar.jpg|right|Caption text]]
12447 !! html/php
12448 <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>
12449
12450 !! html/parsoid
12451 <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>
12452 !! end
12453
12454 !! test
12455 Image with caption, bug 53312 #1
12456 !! wikitext
12457 [[File:Foobar.jpg|right|Caption page stuff]]
12458 !! html/php
12459 <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>
12460
12461 !! html/parsoid
12462 <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>
12463 !! end
12464
12465 !! test
12466 Image with caption, bug 53312 #2
12467 !! wikitext
12468 [[File:Foobar.jpg|right|Caption page=]]
12469 !! html/php
12470 <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>
12471
12472 !! html/parsoid
12473 <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>
12474 !! end
12475
12476 !! test
12477 Image with caption, bug 53312 #3
12478 !! wikitext
12479 [[File:Foobar.jpg|right|Caption page=stuff]]
12480 !! html/php
12481 <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>
12482
12483 !! html/parsoid
12484 <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>
12485 !! end
12486
12487 !! test
12488 Allow empty links in image captions (Bug 60753)
12489 !! options
12490 thumbsize=220
12491 !! wikitext
12492 [[File:Foobar.jpg|thumb|Caption [[Link1]]
12493 [[]]
12494 [[Link2]]
12495 ]]
12496 !! html/php
12497 <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>
12498
12499 !! html/parsoid
12500 <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>
12501 [[]]
12502 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
12503 </figcaption></figure>
12504 !! end
12505
12506 !! test
12507 Titles in unlinked images (T23454)
12508 !! wikitext
12509 [[File:Foobar.jpg|link=|stuff]]
12510 !! html/php
12511 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
12512 </p>
12513 !! end
12514
12515 !! test
12516 Link with empty target
12517 !! wikitext
12518 [[]]
12519 !! html
12520 <p>[[]]
12521 </p>
12522 !! end
12523
12524 !! test
12525 Image with link trail
12526 !! wikitext
12527 Linktrails should not work for images: [[File:Foobar.jpg]]s
12528 !! html/php
12529 <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
12530 </p>
12531 !! html/parsoid
12532 <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>
12533 !! end
12534
12535 !! test
12536 Image with empty attribute
12537 !! options
12538 parsoid=wt2html,wt2wt,html2html
12539 !! wikitext
12540 [[File:Foobar.jpg|right||Caption text]]
12541 !! html/php
12542 <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>
12543
12544 !! html/parsoid
12545 <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>
12546 !! end
12547
12548 !! test
12549 1. Block image with individual attributes from templates
12550 !! wikitext
12551 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
12552 !! html/php
12553 <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>
12554
12555 !! html/parsoid
12556 <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>
12557 !! end
12558
12559 !! test
12560 2. Block Image with individual attributes from templates
12561 !! wikitext
12562 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
12563 !! html/php
12564 <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>
12565
12566 !! html/parsoid
12567 <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>
12568 !! end
12569
12570 !! test
12571 3. Inline image with individual attributes from templates
12572 !! wikitext
12573 [[File:Foobar.jpg|{{echo|50px}}]]
12574 !! html/php
12575 <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>
12576 </p>
12577 !! html/parsoid
12578 <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>
12579 !! end
12580
12581 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
12582 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
12583 !! test
12584 Image with multiple attributes from the same template
12585 !! wikitext
12586 [[File:Foobar.jpg|{{image_attribs}}]]
12587 !! html/php
12588 <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>
12589
12590 !! html/parsoid
12591 <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>
12592 !! end
12593
12594 !! test
12595 Image with link tails
12596 !! options
12597 thumbsize=220
12598 !! wikitext
12599 123[[File:Foobar.jpg]]456
12600 123[[File:Foobar.jpg|right]]456
12601 123[[File:Foobar.jpg|thumb]]456
12602 !! html/php
12603 <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
12604 </p>
12605 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
12606 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
12607
12608 !! html/php+tidy
12609 <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>
12610 <p>123</p>
12611 <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>
12612 <p>456 123</p>
12613 <div class="thumb tright">
12614 <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>
12615 <div class="thumbcaption">
12616 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
12617 </div>
12618 </div>
12619 </div>
12620 <p>456</p>
12621 !! html/parsoid
12622 <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>
12623 <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>
12624 <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>
12625 !! end
12626
12627 !! test
12628 Image with multiple captions -- only last one is accepted
12629 !! wikitext
12630 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
12631 !! html/php
12632 <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>
12633
12634 !! html/parsoid
12635 <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>
12636 !! end
12637
12638 !! test
12639 Image with multiple widths -- use last
12640 !! wikitext
12641 [[File:Foobar.jpg|200px|300px|caption]]
12642 !! html/php
12643 <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>
12644 </p>
12645 !! html/parsoid
12646 <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>
12647 !! end
12648
12649 !! test
12650 Image with multiple alignments -- use first (bug 48664)
12651 !! options
12652 thumbsize=220
12653 !! wikitext
12654 [[File:Foobar.jpg|thumb|left|right|center|caption]]
12655
12656 [[File:Foobar.jpg|middle|text-top|caption]]
12657 !! html/php
12658 <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>
12659 <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>
12660 </p>
12661 !! html/parsoid
12662 <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>
12663 <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>
12664 !! end
12665
12666 !! test
12667 Image with width attribute at different positions
12668 !! wikitext
12669 [[File:Foobar.jpg|200px|right|Caption]]
12670 [[File:Foobar.jpg|right|200px|Caption]]
12671 [[File:Foobar.jpg|right|Caption|200px]]
12672 !! html/php
12673 <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>
12674 <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>
12675 <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>
12676
12677 !! html/parsoid
12678 <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>
12679 <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>
12680 <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>
12681 !! end
12682
12683 # a sad bit of backward-compatibility
12684 !! test
12685 Image with size specified with pxpx (bug 13500, 51628)
12686 !! options
12687 parsoid=wt2html,wt2wt,html2html
12688 !! wikitext
12689 [[File:Foobar.jpg|20pxpx]]
12690 [[File:Foobar.jpg|200x20pxpx]]
12691 !! html/php
12692 <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>
12693 <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>
12694 </p>
12695 !! html/parsoid
12696 <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>
12697 !! end
12698
12699 !! test
12700 Image with link parameter, wiki target
12701 !! wikitext
12702 [[File:Foobar.jpg|link=Main Page]]
12703 !! html/php
12704 <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>
12705 </p>
12706 !! html/parsoid
12707 <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>
12708 !! end
12709
12710 # parsoid bug 49293 (part 1)
12711 !! test
12712 Image with link parameter, URL target
12713 !! wikitext
12714 [[File:Foobar.jpg|link=http://example.com/]]
12715 !! html/php
12716 <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>
12717 </p>
12718 !! html/parsoid
12719 <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>
12720 !! end
12721
12722 # parsoid bug 49293 (part 2)
12723 !! test
12724 Image with link parameter, protocol-less URL target
12725 !! wikitext
12726 [[File:Foobar.jpg|link=//example.com/]]
12727 !! html/php
12728 <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>
12729 </p>
12730 !! html/parsoid
12731 <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>
12732 !! end
12733
12734 !! test
12735 Escaping non-block captions (T107435)
12736 !! options
12737 parsoid={
12738 "modes": ["wt2wt"],
12739 "changes": [
12740 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
12741 ]
12742 }
12743 !! wikitext
12744 [[Image:Foobar.jpg|caption]]
12745 !! wikitext/edited
12746 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
12747 !! end
12748
12749 !! test
12750 Image with link parameter, wgExternalLinkTarget
12751 !! wikitext
12752 [[Image:foobar.jpg|link=http://example.com/]]
12753 !! config
12754 wgExternalLinkTarget='foobar'
12755 !! html
12756 <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>
12757 </p>
12758 !! end
12759
12760 !! test
12761 Image with link parameter, wgNoFollowLinks set to false
12762 !! wikitext
12763 [[Image:foobar.jpg|link=http://example.com/]]
12764 !! config
12765 wgNoFollowLinks=false
12766 !! html
12767 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12768 </p>
12769 !! end
12770
12771 !! test
12772 Image with link parameter, wgNoFollowDomainExceptions
12773 !! wikitext
12774 [[Image:foobar.jpg|link=http://example.com/]]
12775 !! config
12776 wgNoFollowDomainExceptions='example.com'
12777 !! html
12778 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12779 </p>
12780 !! end
12781
12782 !! test
12783 Image with link parameter, wgExternalLinkTarget, unnamed parameter
12784 !! wikitext
12785 [[Image:foobar.jpg|link=http://example.com/|Title]]
12786 !! config
12787 wgExternalLinkTarget='foobar'
12788 !! html
12789 <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>
12790 </p>
12791 !! end
12792
12793 !! test
12794 Image with empty link parameter
12795 !! wikitext
12796 [[File:Foobar.jpg|link=]]
12797 !! html/php
12798 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
12799 </p>
12800 !! html/parsoid
12801 <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>
12802 !! end
12803
12804 !! test
12805 Image with link parameter (wiki target) and unnamed parameter
12806 !! wikitext
12807 [[File:Foobar.jpg|link=Main_Page|Title]]
12808 !! html/php
12809 <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>
12810 </p>
12811 !! html/parsoid
12812 <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>
12813 !! end
12814
12815 !! test
12816 Image with link parameter (URL target) and unnamed parameter
12817 !! wikitext
12818 [[File:Foobar.jpg|link=http://example.com/|Title]]
12819 !! html/php
12820 <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>
12821 </p>
12822 !! html/parsoid
12823 <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>
12824 !! end
12825
12826 !! test
12827 Thumbnail image with link parameter
12828 !! options
12829 thumbsize=220
12830 parsoid=wt2html,wt2wt,html2html
12831 !! wikitext
12832 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
12833 !! html/php
12834 <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>
12835
12836 !! html/parsoid
12837 <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>
12838 !! end
12839
12840 !! test
12841 Manually-specified thumbnail image
12842 !! options
12843 thumbsize=220
12844 !! wikitext
12845 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
12846 !! html/php
12847 <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>
12848
12849 !! html/parsoid
12850 <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>
12851 !! end
12852
12853 !! test
12854 Manually-specified thumbnail image with explicit link to wiki page
12855 !! options
12856 thumbsize=220
12857 parsoid=wt2html,wt2wt,html2html
12858 !! wikitext
12859 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
12860 !! html/php
12861 <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>
12862
12863 !! html/parsoid
12864 <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>
12865 !! end
12866
12867 !! test
12868 Manually-specified thumbnail image with explicit link to url
12869 !! options
12870 thumbsize=220
12871 parsoid=wt2html,wt2wt,html2html
12872 !! wikitext
12873 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
12874 !! html/php
12875 <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>
12876
12877 !! html/parsoid
12878 <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>
12879 !! end
12880
12881 !! test
12882 Manually-specified thumbnail image with explicit no link
12883 !! options
12884 thumbsize=220
12885 parsoid=wt2html,wt2wt,html2html
12886 !! wikitext
12887 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
12888 !! html/php
12889 <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>
12890
12891 !! html/parsoid
12892 <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>
12893 !! end
12894
12895 !! test
12896 Manually-specified thumbnail image with explicit link and alt text
12897 !! options
12898 thumbsize=220
12899 parsoid=wt2html,wt2wt,html2html
12900 !! wikitext
12901 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
12902 !! html/php
12903 <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>
12904
12905 !! html/parsoid
12906 <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>
12907 !! end
12908
12909 !! test
12910 Image with frame and link
12911 !! options
12912 parsoid=wt2html,wt2wt,html2html
12913 !! wikitext
12914 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
12915 !! html/php
12916 <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>
12917
12918 !! html/parsoid
12919 <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>
12920 !! end
12921
12922 !! test
12923 Image with frame and link and explicit alt
12924 !! options
12925 parsoid=wt2html,wt2wt,html2html
12926 !! wikitext
12927 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
12928 !! html/php
12929 <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>
12930
12931 !! html/parsoid
12932 <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>
12933 !! end
12934
12935 !! test
12936 Image with wiki markup in implicit alt
12937 !! wikitext
12938 [[Image:Foobar.jpg|testing '''bold''' in alt]]
12939
12940 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
12941 !! html/php
12942 <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>
12943 </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>
12944 </p>
12945 !! html/parsoid
12946 <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>
12947 <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>
12948 !! end
12949
12950 !! test
12951 Alt image option should handle most kinds of wikitext without barfing
12952 !! wikitext
12953 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
12954 !! html/php
12955 <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>
12956
12957 !! html/parsoid
12958 <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>
12959 !! end
12960
12961 ###################
12962 # Conflicting image format options.
12963 # First option specified should 'win'.
12964 # All three cases in each test should be identical.
12965
12966 !! test
12967 Image with 'frameless' first.
12968 !! options
12969 parsoid=wt2html,wt2wt,html2html
12970 !! wikitext
12971 [[File:Foobar.jpg|frameless|caption]]
12972
12973 [[File:Foobar.jpg|frameless|frame|caption]]
12974
12975 [[File:Foobar.jpg|frameless|thumb|caption]]
12976 !! html/php
12977 <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>
12978 </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>
12979 </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>
12980 </p>
12981 !! html/parsoid
12982 <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>
12983 <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>
12984 <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>
12985 !! end
12986
12987 !! test
12988 Image with 'frame' first.
12989 !! options
12990 parsoid=wt2html,wt2wt,html2html
12991 !! wikitext
12992 [[File:Foobar.jpg|frame|caption]]
12993 [[File:Foobar.jpg|frame|frameless|caption]]
12994 [[File:Foobar.jpg|frame|thumb|caption]]
12995 !! html/php
12996 <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>
12997 <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>
12998 <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>
12999
13000 !! html/parsoid
13001 <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>
13002 <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>
13003 <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>
13004 !! end
13005
13006 !! test
13007 Image with 'thumb' first.
13008 !! options
13009 parsoid=wt2html,wt2wt,html2html
13010 !! wikitext
13011 [[File:Foobar.jpg|thumb|caption]]
13012 [[File:Foobar.jpg|thumb|frameless|caption]]
13013 [[File:Foobar.jpg|thumb|frame|caption]]
13014 !! html/php
13015 <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>
13016 <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>
13017 <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>
13018
13019 !! html/parsoid
13020 <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>
13021 <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>
13022 <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>
13023 !! end
13024
13025 ###################
13026 # Image sizing.
13027 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13028 # and https://phabricator.wikimedia.org/T64258
13029 # Foobar has actual size of 1941x220
13030 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13031 # a scalable format.
13032 # 2. Framed images always ignore size options; always render at default size.
13033 # 3. "Unspecified format" and border are the only types which can be
13034 # enlarged.
13035
13036 !! test
13037 Image: "unspecified format" and border enlarge
13038 !! options
13039 parsoid=wt2html,wt2wt,html2html
13040 !! wikitext
13041 [[File:Foobar.jpg|2000px]]
13042
13043 [[File:Foobar.jpg|border|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="2000" height="227" /></a>
13046 </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>
13047 </p>
13048 !! html/parsoid
13049 <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>
13050 <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>
13051 !! end
13052
13053 !! test
13054 Image: "unspecified format" and border reduce
13055 !! options
13056 parsoid=wt2html,wt2wt,html2html
13057 !! wikitext
13058 [[File:Foobar.jpg|1000px]]
13059
13060 [[File:Foobar.jpg|border|1000px]]
13061 !! html/php
13062 <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>
13063 </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>
13064 </p>
13065 !! html/parsoid
13066 <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>
13067 <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>
13068 !! end
13069
13070 !! test
13071 Image: thumbs reduce
13072 !! options
13073 parsoid=wt2html,wt2wt,html2html
13074 !! wikitext
13075 [[File:Foobar.jpg|thumb|50px]]
13076 !! html/php
13077 <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>
13078
13079 !! html/parsoid
13080 <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>
13081 !! end
13082
13083 !! test
13084 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13085 !! options
13086 parsoid=wt2html,wt2wt,html2html
13087 !! wikitext
13088 [[File:Foobar.jpg|thumb|2000px]]
13089
13090 [[File:Foobar.svg|thumb|2000px]]
13091 !! html/php
13092 <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>
13093 <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>
13094
13095 !! html/parsoid
13096 <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>
13097 <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>
13098 !! end
13099
13100 !! test
13101 Image: frameless can reduce in size
13102 !! options
13103 parsoid=wt2html,wt2wt,html2html
13104 !! wikitext
13105 [[File:Foobar.jpg|frameless|50px]]
13106 !! html/php
13107 <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>
13108 </p>
13109 !! html/parsoid
13110 <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>
13111 !! end
13112
13113 !! test
13114 Image: bitmap frameless can't be enlarged past original size, but vector can
13115 !! options
13116 parsoid=wt2html,wt2wt,html2html
13117 !! wikitext
13118 [[File:Foobar.jpg|frameless|2000px]]
13119
13120 [[File:Foobar.svg|frameless|2000px]]
13121 !! html/php
13122 <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>
13123 </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>
13124 </p>
13125 !! html/parsoid
13126 <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>
13127 <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>
13128 !! end
13129
13130 !! test
13131 Image: framed images are always unscaled.
13132 !! options
13133 parsoid=wt2html,wt2wt,html2html
13134 !! wikitext
13135 [[File:Foobar.jpg|frame]]
13136
13137 [[File:Foobar.jpg|frame|50px]]
13138
13139 [[File:Foobar.jpg|frame|50x50px]]
13140
13141 [[File:Foobar.jpg|frame|2000px]]
13142 !! html/php
13143 <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>
13144 <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>
13145 <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>
13146 <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>
13147
13148 !! html/parsoid
13149 <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>
13150 <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>
13151 <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>
13152 <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>
13153 !! end
13154
13155 ###################
13156
13157 !! test
13158 Link to image page- image page normally doesn't exists, hence edit link
13159 Add test with existing image page
13160 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13161 !! wikitext
13162 [[:Image:test]]
13163 !! html
13164 <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>
13165 </p>
13166 !! end
13167
13168 !! test
13169 bug 18784 Link to non-existent image page with caption should use caption as link text
13170 !! wikitext
13171 [[:Image:test|caption]]
13172 !! html
13173 <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>
13174 </p>
13175 !! end
13176
13177 !! test
13178 Frameless image caption with a free URL
13179 !! wikitext
13180 [[File:Foobar.jpg|http://example.com]]
13181 !! html/php
13182 <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>
13183 </p>
13184 !! html/parsoid
13185 <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>
13186 !! end
13187
13188 !! test
13189 Thumbnail image caption with a free URL
13190 !! options
13191 thumbsize=220
13192 !! wikitext
13193 [[File:Foobar.jpg|thumb|http://example.com]]
13194 !! html/php
13195 <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>
13196
13197 !! html/parsoid
13198 <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>
13199 !! end
13200
13201 !! test
13202 Thumbnail image caption with a free URL and explicit alt
13203 !! options
13204 thumbsize=220
13205 parsoid=wt2html,wt2wt,html2html
13206 !! wikitext
13207 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13208 !! html/php
13209 <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>
13210
13211 !! html/parsoid
13212 <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>
13213 !! end
13214
13215 !! test
13216 SVG thumbnails with no language set
13217 !! options
13218 !! wikitext
13219 [[File:Foobar.svg|thumb|caption]]
13220 !! html/php
13221 <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>
13222
13223 !! html/parsoid
13224 <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>
13225 !! end
13226
13227 !! test
13228 SVG thumbnails with language de
13229 !! options
13230 parsoid=wt2html,wt2wt,html2html
13231 !! wikitext
13232 [[File:Foobar.svg|thumb|caption|lang=de]]
13233 !! html/php
13234 <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>
13235
13236 !! html/parsoid
13237 <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>
13238 !! end
13239
13240 !! test
13241 SVG thumbnails with invalid language code
13242 !! options
13243 parsoid=wt2html,wt2wt,html2html
13244 !! wikitext
13245 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
13246 !! html/php
13247 <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>
13248
13249 !! html/parsoid
13250 <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>
13251 !! end
13252
13253 !! test
13254 BUG 1887: A ISBN with a thumbnail
13255 !! wikitext
13256 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
13257 !! html/php
13258 <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>
13259
13260 !! html/parsoid
13261 <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>
13262 !! end
13263
13264 !! test
13265 BUG 1887: A RFC with a thumbnail
13266 !! wikitext
13267 [[File:Foobar.jpg|thumb|This is RFC 12354]]
13268 !! html/php
13269 <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>
13270
13271 !! html/parsoid
13272 <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>
13273 !! end
13274
13275 !! test
13276 BUG 1887: A mailto link with a thumbnail
13277 !! wikitext
13278 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
13279 !! html/php
13280 <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>
13281
13282 !! html/parsoid
13283 <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>
13284 !! end
13285
13286 # Pending resolution to bug 368
13287 !! test
13288 BUG 648: Frameless image caption with a link
13289 !! wikitext
13290 [[File:Foobar.jpg|text with a [[link]] in it]]
13291 !! html/php
13292 <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>
13293 </p>
13294 !! html/parsoid
13295 <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>
13296 !! end
13297
13298 !! test
13299 BUG 648: Frameless image caption with a link (suffix)
13300 !! wikitext
13301 [[File:Foobar.jpg|text with a [[link]]foo in it]]
13302 !! html/php
13303 <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>
13304 </p>
13305 !! html/parsoid
13306 <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>
13307 !! end
13308
13309 !! test
13310 BUG 648: Frameless image caption with an interwiki link
13311 !! wikitext
13312 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
13313 !! html/php
13314 <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>
13315 </p>
13316 !! html/parsoid
13317 <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>
13318 !! end
13319
13320 !! test
13321 BUG 648: Frameless image caption with a piped interwiki link
13322 !! wikitext
13323 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
13324 !! html/php
13325 <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>
13326 </p>
13327 !! html/parsoid
13328 <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>
13329 !! end
13330
13331 !! test
13332 T107474: Frameless image caption with <nowiki>
13333 !! wikitext
13334 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
13335 !! html/parsoid
13336 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&lt;span typeof=\"mw:Nowiki\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[18,75,8,9]}\">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>
13337 !! end
13338
13339 !! test
13340 Escape HTML special chars in image alt text
13341 !! wikitext
13342 [[File:Foobar.jpg|& < > "]]
13343 !! html/php
13344 <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>
13345 </p>
13346 !! html/parsoid
13347 <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>
13348 !! end
13349
13350 !! test
13351 BUG 499: Alt text should have &#1234;, not &amp;1234;
13352 !! wikitext
13353 [[File:Foobar.jpg|&#9792;]]
13354 !! html/php
13355 <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>
13356 </p>
13357 !! html/parsoid
13358 <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>
13359 !! end
13360
13361 !! test
13362 Broken image caption with link
13363 !! options
13364 parsoid=wt2html,wt2wt,html2html
13365 !! wikitext
13366 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
13367 !! html/php
13368 <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.
13369 </p>
13370 !! html/parsoid
13371 <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>
13372 !! end
13373
13374 !! test
13375 Image caption containing another image
13376 !! wikitext
13377 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
13378 !! html/php
13379 <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>
13380
13381 !! html/parsoid
13382 <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>
13383 !! end
13384
13385 !! test
13386 Image: caption containing a newline
13387 !! wikitext
13388 [[File:Foobar.jpg|This
13389 *is some text]]
13390 !! html/php
13391 <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>
13392 </p>
13393 !! html/parsoid
13394 <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>
13395 !!end
13396
13397 !!test
13398 Image: caption containing leading space
13399 (The leading space should not trigger nowiki escaping in wt2wt mode)
13400 !! wikitext
13401 [[File:Foobar.jpg|thumb| bar]]
13402 !! html/php
13403 <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>
13404
13405 !! html/parsoid
13406 <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>
13407 !!end
13408
13409 !! test
13410 Image: caption containing a table
13411 !! options
13412 parsoid=wt2html,wt2wt,html2html
13413 !! wikitext
13414 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
13415 {|
13416 ! Foo !! Bar
13417 |-
13418 | Foo1 || Bar1
13419 |}
13420 and some more text.]]
13421 !! html/php
13422 <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>
13423
13424 !! html/parsoid
13425 <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
13426 <table>
13427 <tbody>
13428 <tr><th>Foo </th><th>Bar</th></tr>
13429 <tr>
13430 <td>Foo1 </td>
13431 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
13432 !! end
13433
13434 !! test
13435 Bug 3090: External links other than http: in image captions
13436 !! wikitext
13437 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
13438 !! html/php
13439 <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>
13440
13441 !! html/parsoid
13442 <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>
13443 !! end
13444
13445 !! test
13446 Custom class
13447 !! options
13448 parsoid=wt2html,wt2wt,html2html
13449 !! wikitext
13450 [[Image:foobar.jpg|a|class=b]]
13451 !! html/php
13452 <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>
13453 </p>
13454 !! html/parsoid
13455 <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>
13456 !! end
13457
13458 !! test
13459 Localized image handling (1).
13460 !! options
13461 parsoid=wt2html,wt2wt,html2html
13462 language=es
13463 !! wikitext
13464 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
13465 !! html/php
13466 <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>
13467
13468 !! html/parsoid
13469 <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>
13470 !! end
13471
13472 !! test
13473 Localized image handling (2).
13474 !! options
13475 thumbsize=220
13476 parsoid=wt2html,wt2wt,html2html
13477 language=es
13478 !! wikitext
13479 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
13480 !! html/php
13481 <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>
13482
13483 !! html/parsoid
13484 <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>
13485 !! end
13486
13487 !! test
13488 "border", "frameless" and "class" attributes on an image.
13489 !! options
13490 thumbsize=220
13491 parsoid=wt2html,wt2wt,html2html
13492 !! wikitext
13493 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
13494 !! html/php
13495 <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>
13496 </p>
13497 !! html/parsoid
13498 <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>
13499 !! end
13500
13501 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
13502 !! test
13503 Invalid image attributes (bug 62500)
13504 !! options
13505 thumbsize=220
13506 parsoid=wt2html,wt2wt,html2html
13507 !! wikitext
13508 [[File:Foobar.jpg|thumb|float|left|caption]]
13509
13510 [[File:Foobar.jpg|thumb|righ|caption]]
13511
13512 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
13513 !! html/php
13514 <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>
13515 <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>
13516 <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>
13517
13518 !! html/parsoid
13519 <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>
13520 <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>
13521 <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>
13522 !! end
13523
13524 !! article
13525 File:Barfoo.jpg
13526 !! text
13527 #REDIRECT [[File:Barfoo.jpg]]
13528 !! endarticle
13529
13530 # FIXME: Parsoid should run this test -- but we'd need to teach the
13531 # mockAPI about the redirected Barfoo.jpg image.
13532 !! test
13533 Redirected image
13534 !! wikitext
13535 [[Image:Barfoo.jpg]]
13536 !! html/php
13537 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
13538 </p>
13539 !! end
13540
13541 !! test
13542 Missing image with uploads disabled
13543 !! options
13544 wgEnableUploads=0
13545 !! wikitext
13546 [[File:Foobaz.jpg]]
13547 !! html/php
13548 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
13549 </p>
13550 !! html/parsoid
13551 <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>
13552 !! end
13553
13554 # Parsoid-specific testing for images
13555 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13556 # Currently imperfect due to a flaw in the Parsoid testrunner
13557 # Work in progress
13558 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
13559 # image tests.
13560
13561 !! test
13562 Parsoid-specific image handling - simple image with size and middle alignment
13563 !! wikitext
13564 [[File:Foobar.jpg|middle|50px]]
13565 !! html/parsoid
13566 <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>
13567 !! end
13568
13569 !! test
13570 Parsoid-specific image handling - simple image with size, middle alignment,
13571 non-standard namespace alias
13572 !! options
13573 parsoid=wt2wt,wt2html,html2html
13574 !! wikitext
13575 [[Image:Foobar.jpg|middle|50px]]
13576 !! html/parsoid
13577 <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>
13578 !! end
13579
13580 !! test
13581 Parsoid-specific image handling - simple image with size and middle alignment
13582 (existing content)
13583 !! wikitext
13584 [[File:Foobar.jpg|50px|middle]]
13585 !! html/parsoid
13586 <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>
13587 !! end
13588
13589 !! test
13590 Parsoid-specific image handling - simple image with size and middle alignment
13591 and non-standard namespace name
13592 !! options
13593 parsoid=wt2html,wt2wt,html2html
13594 !! wikitext
13595 [[Image:Foobar.jpg|50px|middle]]
13596 !! html/parsoid
13597 <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>
13598 !! end
13599
13600 !! test
13601 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
13602 !! wikitext
13603 [[File:Foobar.jpg|500x10px|baseline|caption]]
13604 !! html/parsoid
13605 <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>
13606 !! end
13607
13608 !! test
13609 Parsoid-specific image handling - simple image with border and size spec
13610 !! wikitext
13611 [[File:Foobar.jpg|50px|border|caption]]
13612 !! html/parsoid
13613 <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>
13614 !! end
13615
13616 !! test
13617 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13618 !! wikitext
13619 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
13620 !! html/parsoid
13621 <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>
13622 !! end
13623
13624 !! test
13625 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13626 (existing content)
13627 !! wikitext
13628 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
13629 !! html/parsoid
13630 <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>
13631 !! end
13632
13633 !! test
13634 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
13635 !! wikitext
13636 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
13637 !! html/parsoid
13638 <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>
13639 !! end
13640
13641 !! test
13642 Parsoid-specific image handling - thumbnail with specific size, halign,
13643 valign, and caption (existing content)
13644 !! wikitext
13645 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
13646 !! html/parsoid
13647 <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>
13648 !! end
13649
13650 !! test
13651 Parsoid-specific image handling - framed image with specific size and caption
13652 (size is ignored)
13653 !! options
13654 parsoid=wt2html,wt2wt,html2html
13655 !! wikitext
13656 [[File:Foobar.jpg|frame|500x50px|caption]]
13657 !! html/parsoid
13658 <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>
13659 !! end
13660
13661 !! test
13662 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
13663 (size is ignored)
13664 !! options
13665 parsoid=wt2html,wt2wt,html2html
13666 !! wikitext
13667 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
13668 !! html/parsoid
13669 <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>
13670 !! end
13671
13672 !! test
13673 Parsoid-specific image handling - frameless image with specific size, border, and caption
13674 !! wikitext
13675 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
13676 !! html/parsoid
13677 <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>
13678 !! end
13679
13680 !! test
13681 Parsoid-specific image handling - simple image with a formatted caption
13682 !! wikitext
13683 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
13684 !! html/parsoid
13685 <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>
13686 !! end
13687
13688 !! test
13689 Parsoid-specific image handling - caption with a template in it
13690 !! wikitext
13691 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
13692 !! html/parsoid
13693 <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>
13694 !! end
13695
13696 !! test
13697 Parsoid-specific image handling - caption with unbalanced tags in it
13698 !! options
13699 parsoid=wt2html,wt2wt,html2html
13700 !! wikitext
13701 foo
13702 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
13703 bar
13704 !! html/parsoid
13705 <p>foo</p>
13706 <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>
13707 <p>bar</p>
13708 !! end
13709
13710 !! test
13711 Parsoid-specific image handling - empty caption (1)
13712 !! options
13713 parsoid=wt2html,wt2wt
13714 !! wikitext
13715 [[File:Foobar.jpg|thumb|]]
13716 !! html/parsoid
13717 <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>
13718 !! end
13719
13720 # empty captions don't get serialized unless we're in the "round trip" case
13721 !! test
13722 Parsoid-specific image handling - empty caption (2)
13723 !! options
13724 parsoid=html2wt
13725 !! html/parsoid
13726 <figure class="mw-default-size" typeof="mw:Image/Thumb">
13727 <a href="./File:Foobar.jpg">
13728 <img resource="./File:Foobar.jpg"
13729 src="//example.com/images/3/3a/Foobar.jpg"
13730 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
13731 height="25" width="220"/>
13732 </a>
13733 <figcaption></figcaption>
13734 </figure>
13735 !! wikitext
13736 [[File:Foobar.jpg|thumb]]
13737 !! end
13738
13739 !! test
13740 Parsoid-specific image handling - whitespace caption
13741 !! wikitext
13742 [[File:Foobar.jpg|thumb| ]]
13743 !! html/parsoid
13744 <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>
13745 !! end
13746
13747 !! test
13748 Parsoid-specific image handling - lang option
13749 !! wikitext
13750 foo
13751 [[File:Foobar.svg|lang=de|caption]]
13752 bar
13753 !! html/parsoid
13754 <p>foo
13755 <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>
13756 bar</p>
13757 !! end
13758
13759 ## Edge case bug in Parsoid
13760 !! test
13761 T93580: Templated <ref> inside images
13762 !! wikitext
13763 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
13764
13765 <references />
13766 !! html/parsoid
13767 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Caption with templated ref: {{echo|&lt;ref>foo&lt;/ref>}}"}]}'><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/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 with templated ref: <span about="#mwt5" 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&lt;/ref>"}},"i":0}}]}'><a href="#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></figcaption></figure>
13768
13769 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" 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>
13770 !! end
13771
13772 ###
13773 ### Subpages
13774 ###
13775 !! article
13776 Subpage test/subpage
13777 !! text
13778 foo
13779 !! endarticle
13780
13781 !! test
13782 Subpage link
13783 !! options
13784 subpage title=[[Subpage test]]
13785 !! wikitext
13786 [[/subpage]]
13787 !! html
13788 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
13789 </p>
13790 !! end
13791
13792 !! test
13793 Subpage noslash link
13794 !! options
13795 subpage title=[[Subpage test]]
13796 !! wikitext
13797 [[/subpage/]]
13798 !! html
13799 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
13800 </p>
13801 !! end
13802
13803 !! article
13804 Subpage test/1/2/subpage
13805 !! text
13806 blah
13807 !! endarticle
13808
13809 !! test
13810 Relative subpage noslash link
13811 !! options
13812 parsoid=wt2wt,wt2html,html2html
13813 subpage title=[[Subpage test/1/2/3/4]]
13814 !! wikitext
13815 [[../../subpage/]]
13816
13817 [[../../subpage]]
13818 !! html/php
13819 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
13820 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
13821 </p>
13822 !! html/parsoid
13823 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
13824 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
13825 !! end
13826
13827 !! test
13828 Parsoid: dot-slash prefixed wikilinks
13829 !! wikitext
13830 [[./foo]]
13831
13832 [[././bar]]
13833
13834 [[././baz/]]
13835 !! html/php
13836 <p>[[./foo]]
13837 </p><p>[[././bar]]
13838 </p><p>[[././baz/]]
13839 </p>
13840 !! html/parsoid
13841 <p>[[./foo]]
13842 </p><p>[[././bar]]
13843 </p><p>[[././baz/]]
13844 </p>
13845 !! end
13846
13847 !! test
13848 Render invalid page names as plain text (bug 51090)
13849 !! wikitext
13850 [[./../foo|bar]]
13851 [[foo�|bar]]
13852 [[foo/.|bar]]
13853 [[foo/..|bar]]
13854 [[foo~~~bar]]
13855 [[foo>bar]]
13856 [[foo[bar]]
13857 [[.]]
13858 [[..]]
13859 [[foo././bar]]
13860
13861 [[{{echo|./../foo}}|bar]]
13862 [[{{echo|foo/.}}|bar]]
13863 [[{{echo|foo/..}}|bar]]
13864 [[{{echo|foo~~~~bar}}]]
13865 [[{{echo|foo>bar}}]]
13866 [[{{echo|foo././bar}}]]
13867 [[{{echo|foo{bar}}]]
13868 [[{{echo|foo}bar}}]]
13869 [[{{echo|foo[bar}}]]
13870 [[{{echo|foo]bar}}]]
13871 [[{{echo|foo<bar}}]]
13872 !!html/php
13873 <p>[[./../foo|bar]]
13874 [[foo�|bar]]
13875 [[foo/.|bar]]
13876 [[foo/..|bar]]
13877 [[foo~~~bar]]
13878 [[foo&gt;bar]]
13879 [[foo[bar]]
13880 [[.]]
13881 [[..]]
13882 [[foo././bar]]
13883 </p><p>[[./../foo|bar]]
13884 [[foo/.|bar]]
13885 [[foo/..|bar]]
13886 [[foo~~~~bar]]
13887 [[foo&gt;bar]]
13888 [[foo././bar]]
13889 [[foo{bar]]
13890 [[foo}bar]]
13891 [[foo[bar]]
13892 [[foo]bar]]
13893 [[foo&lt;bar]]
13894 </p>
13895 !!html/parsoid
13896 <p>[[./../foo|bar]]
13897 [[foo�|bar]]
13898 [[foo/.|bar]]
13899 [[foo/..|bar]]
13900 [[foo~~~bar]]
13901 [[foo>bar]]
13902 [[foo[bar]]
13903 [[.]]
13904 [[..]]
13905 [[foo././bar]]</p>
13906
13907 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
13908 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
13909 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
13910 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
13911 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
13912 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
13913 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
13914 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
13915 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
13916 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
13917 [[<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>
13918 !!end
13919
13920 !! test
13921 Disabled subpages
13922 !! wikitext
13923 [[/subpage]]
13924 !! html
13925 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
13926 </p>
13927 !! end
13928
13929 !! test
13930 BUG 561: {{/Subpage}}
13931 !! options
13932 subpage title=[[Page]]
13933 !! wikitext
13934 {{/Subpage}}
13935 !! html
13936 <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>
13937 </p>
13938 !! end
13939
13940 ###
13941 ### Categories
13942 ###
13943 !! article
13944 Category:MediaWiki User's Guide
13945 !! text
13946 blah
13947 !! endarticle
13948
13949 !! test
13950 Link to category
13951 !! wikitext
13952 [[:Category:MediaWiki User's Guide]]
13953 !! html
13954 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
13955 </p>
13956 !! end
13957
13958 !! test
13959 Simple category
13960 !! options
13961 cat
13962 !! wikitext
13963 [[Category:MediaWiki User's Guide]]
13964 !! html
13965 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13966 !! end
13967
13968 !! test
13969 PAGESINCATEGORY invalid title fatal (r33546 fix)
13970 !! wikitext
13971 {{PAGESINCATEGORY:<bogus>}}
13972 !! html
13973 <p>0
13974 </p>
13975 !! end
13976
13977 !! test
13978 Category with different sort key
13979 !! options
13980 cat
13981 !! wikitext
13982 [[Category:MediaWiki User's Guide|Foo]]
13983 !! html
13984 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13985 !! end
13986
13987 !! test
13988 Category with identical sort key
13989 !! options
13990 cat
13991 !! wikitext
13992 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
13993 !! html
13994 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13995 !! end
13996
13997 !! test
13998 Category with empty sort key
13999 !! options
14000 cat
14001 pst
14002 !! wikitext
14003 [[Category:MediaWiki User's Guide|]]
14004 !! html
14005 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14006 !! end
14007
14008 !! test
14009 Category with empty sort key and parentheses
14010 !! options
14011 cat
14012 pst
14013 !! wikitext
14014 [[Category:Foo (bar)|]]
14015 !! html
14016 [[Category:Foo (bar)|Foo]]
14017 !! end
14018
14019 !! test
14020 Category with link tail
14021 !! options
14022 cat
14023 pst
14024 !! wikitext
14025 123[[Category:Foo]]456
14026 !! html
14027 123[[Category:Foo]]456
14028 !! end
14029
14030 !! test
14031 Category with template
14032 !! options
14033 cat
14034 pst
14035 !! wikitext
14036 [[Category:{{echo|Foo}}]]
14037 !! html
14038 [[Category:{{echo|Foo}}]]
14039 !! end
14040
14041 !! test
14042 Category with template in sort key
14043 !! options
14044 cat
14045 pst
14046 !! wikitext
14047 [[Category:Foo|{{echo|Bar}}]]
14048 !! html
14049 [[Category:Foo|{{echo|Bar}}]]
14050 !! end
14051
14052 !! test
14053 Category with template in sort key and title
14054 !! options
14055 cat
14056 pst
14057 !! wikitext
14058 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14059 !! html
14060 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14061 !! end
14062
14063 !! test
14064 Category / paragraph interactions
14065 !! wikitext
14066 Foo [[Category:Baz]] Bar
14067
14068 Foo [[Category:Baz]]
14069 Bar
14070
14071 Foo
14072 [[Category:Baz]]
14073 Bar
14074
14075 Foo
14076 [[Category:Baz]] Bar
14077
14078 Foo
14079 [[Category:Baz]]
14080 [[Category:Baz]]
14081 [[Category:Baz]]
14082 Bar
14083
14084 [[Category:Baz]]
14085 [[Category:Baz]]
14086 [[Category:Baz]]
14087
14088 [[Category:Baz]]
14089 {{echo|[[Category:Baz]]}}
14090 [[Category:Baz]]
14091 !! html
14092 <p>Foo Bar
14093 </p><p>Foo
14094 Bar
14095 </p><p>Foo
14096 Bar
14097 </p><p>Foo Bar
14098 </p><p>Foo
14099 Bar
14100 </p>
14101 !! end
14102
14103 ## The whitespace on the empty line is part of the test. Please do not delete
14104 !! test
14105 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14106 !! options
14107 parsoid=wt2html,wt2wt
14108 !! wikitext
14109 This
14110
14111 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14112
14113 {{echo|[[Category:Foo]] and so should this!}}
14114 !! html
14115 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14116 </p>
14117 !! html/parsoid
14118 <p>This
14119
14120 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14121
14122 <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>
14123 !! end
14124
14125 ## Parsoid will not try to wt2wt this while preserving newlines because
14126 ## it suppresses excess newlines within list items -- and we don't want to
14127 ## introduce a special case just for categories, which is, in reality somewhat
14128 ## odd behavior -- categories are unlikely to be used in list items like this
14129 ## in top-level pages and are only likely to show up in template-generated
14130 ## list items where this RT-ing is a non-issue.
14131 ##
14132 ## The whitespace on the empty line is part of the test. Please do not delete
14133 !! test
14134 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14135 !! options
14136 parsoid=wt2html
14137 !! wikitext
14138 * This
14139
14140 [[Category:Foo]] and this should be part of the same list item
14141 * So should this
14142
14143 {{echo|[[Category:Foo]] and this should be part of the same list item}}
14144 !! html
14145 <ul><li>This and this should be part of the same list item</li>
14146 <li>So should this and this should be part of the same list item</li></ul>
14147 !! html/parsoid
14148 <ul>
14149 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
14150 <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>
14151 </ul>
14152 !! end
14153
14154 ## Newlines and categories that follow the last item of a list
14155 ## are treated differently because this (list followed by categories)
14156 ## is an extremely common pattern on wikis.
14157 !! test
14158 3. Categories and newlines: newline suppression for last list item should RT properly
14159 !! wikitext
14160 * a
14161 * b
14162
14163 [[Category:Foo]]
14164
14165 [[Category:Bar]]
14166 [[Category:Baz]]
14167 !! html/parsoid
14168 <ul><li> a</li>
14169 <li> b</li></ul>
14170
14171 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14172
14173 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14174 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14175 !! end
14176
14177 !! test
14178 4. Categories and newlines: newline suppression for last list item should RT properly
14179 !! wikitext
14180 * a
14181 **** b
14182
14183 [[Category:Foo]]
14184 !! html/parsoid
14185 <ul><li> a
14186 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
14187
14188 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14189 !! end
14190
14191 ## only wt2html for this to make sure the algo only applies to the rightmost path
14192 !! test
14193 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
14194 !! options
14195 parsoid=wt2html
14196 !! wikitext
14197 * a
14198 ** b
14199 [[Category:Foo]]
14200 * c
14201 ** d
14202 [[Category:Foo]]
14203 !! html/parsoid
14204 <ul><li> a
14205 <ul><li> b
14206 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
14207 <li> c
14208 <ul><li> d</li></ul></li></ul>
14209 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14210 !! end
14211
14212 !! test
14213 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
14214 !! wikitext
14215 * a [[Category:Foo]]
14216 !! html/parsoid
14217 <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>
14218 !! end
14219
14220 # This test also demonstrates because of newline+category tunneling
14221 # through the list hander, template wrapping doesn't expand to the
14222 # containing list when the list item swallows the category.
14223 !! test
14224 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
14225 !! wikitext
14226 * {{echo|a
14227 [[Category:Foo]]}}
14228 !! html/parsoid
14229 <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">
14230 </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>
14231 !! end
14232
14233 !! test
14234 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
14235 !! wikitext
14236 * a
14237
14238 {{echo|[[Category:Foo]]
14239 [[Category:Bar]]}}
14240 [[Category:Baz]]
14241 !! html/parsoid
14242 <ul><li> a</li></ul>
14243
14244 <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">
14245 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14246 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14247 !! end
14248
14249 !! test
14250 Parsoid: Serialize link to category page with colon escape
14251 !! options
14252 parsoid
14253 !! wikitext
14254
14255 [[:Category:Foo]]
14256 [[:Category:Foo|Bar]]
14257 !! html
14258 <p>
14259 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
14260 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
14261 </p>
14262 !! end
14263
14264 # html2wt localizes the "Category" namespace.
14265 # XXX the <link> element needs an empty data-parsoid attribute, or
14266 # else the html2html test fails because spaces are inserted.
14267 !! test
14268 Link prefix/suffixes aren't applied to category links
14269 !! options
14270 parsoid=wt2html,wt2wt,html2html
14271 language=is
14272 !! wikitext
14273 x[[Category:Foo]]y
14274 !! html/php
14275 <p>xy
14276 </p>
14277 !! html/parsoid
14278 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
14279 !! end
14280
14281 !! test
14282 Parsoid: Serialize link to file page with colon escape
14283 !! options
14284 parsoid
14285 !! wikitext
14286
14287 [[:File:Foo.png]]
14288 [[:File:Foo.png|Bar]]
14289 !! html
14290 <p>
14291 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
14292 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
14293 </p>
14294 !! end
14295
14296 !! test
14297 Parsoid: Serialize a genuine category link without colon escape
14298 !! options
14299 parsoid
14300 !! wikitext
14301 [[Category:Foo]]
14302 [[Category:Foo|Bar]]
14303 !! html
14304 <link rel="mw:PageProp/Category" href="./Category:Foo">
14305 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
14306 !! end
14307
14308 !! test
14309 Normalize hrefs properly before testing for invalid link targets (bug 70894)
14310 !! options
14311 parsoid=html2wt
14312 !! html/parsoid
14313 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
14314 !! wikitext
14315 [[Category:Toxine bactérienne]]
14316 !! end
14317
14318 !! test
14319 Parsoid: Defaultsort
14320 !! wikitext
14321 {{DEFAULTSORT:Foo}}
14322 !! html/parsoid
14323 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
14324 !! end
14325
14326 !! test
14327 Parsoid: Defaultsort (template-generated)
14328 !! wikitext
14329 {{{{echo|DEFAULTSORT}}:Foo}}
14330 !! html/parsoid
14331 <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}}]}'/>
14332 !! end
14333
14334 ###
14335 ### Inter-language links
14336 ###
14337 !! test
14338 Interlanguage links
14339 !! options
14340 ill
14341 !! wikitext
14342 [[es:Alimento]]
14343 [[fr:Nourriture]]
14344 [[zh:食品]]
14345 !! html/php
14346 es:Alimento fr:Nourriture zh:食品
14347 !! html/parsoid
14348 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
14349 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
14350 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
14351 !! end
14352
14353 !! test
14354 Duplicate interlanguage links (bug 24502)
14355 !! options
14356 ill
14357 !! wikitext
14358 [[es:1]]
14359 [[es:2]]
14360 [[fr:1]]
14361 [[fr:2]]
14362 !! html/php
14363 es:1 fr:1
14364 !! html/parsoid
14365 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
14366 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
14367 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
14368 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
14369 !! end
14370
14371 ###
14372 ### Sections
14373 ###
14374 !! test
14375 Basic section headings
14376 !! wikitext
14377 == Headline 1 ==
14378 Some text
14379
14380 ==Headline 2==
14381 More
14382 ===Smaller headline===
14383 Blah blah
14384 !! html
14385 <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>
14386 <p>Some text
14387 </p>
14388 <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>
14389 <p>More
14390 </p>
14391 <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>
14392 <p>Blah blah
14393 </p>
14394 !! end
14395
14396 !! test
14397 Section headings with TOC
14398 !! wikitext
14399 == Headline 1 ==
14400 === Subheadline 1 ===
14401 ===== Skipping a level =====
14402 ====== Skipping a level ======
14403
14404 == Headline 2 ==
14405 Some text
14406 ===Another headline===
14407 !! html
14408 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14409 <ul>
14410 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
14411 <ul>
14412 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
14413 <ul>
14414 <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>
14415 <ul>
14416 <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>
14417 </ul>
14418 </li>
14419 </ul>
14420 </li>
14421 </ul>
14422 </li>
14423 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
14424 <ul>
14425 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
14426 </ul>
14427 </li>
14428 </ul>
14429 </div>
14430
14431 <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>
14432 <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>
14433 <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>
14434 <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>
14435 <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>
14436 <p>Some text
14437 </p>
14438 <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>
14439
14440 !! end
14441
14442 !! test
14443 TOC anchors don't collide
14444 !! wikitext
14445 __FORCETOC__
14446 == Headline 2 ==
14447 == Headline ==
14448 == Headline 2 ==
14449 == Headline ==
14450 !! html/php
14451 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14452 <ul>
14453 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
14454 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
14455 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
14456 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
14457 </ul>
14458 </div>
14459
14460 <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>
14461 <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>
14462 <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>
14463 <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>
14464
14465 !! end
14466
14467 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
14468 !! test
14469 Handling of sections up to level 6 and beyond
14470 !! wikitext
14471 = Level 1 Heading=
14472 == Level 2 Heading==
14473 === Level 3 Heading===
14474 ==== Level 4 Heading====
14475 ===== Level 5 Heading=====
14476 ====== Level 6 Heading======
14477 ======= Level 7 Heading=======
14478 ======== Level 8 Heading========
14479 ========= Level 9 Heading=========
14480 ========== Level 10 Heading==========
14481 !! html
14482 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14483 <ul>
14484 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
14485 <ul>
14486 <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>
14487 <ul>
14488 <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>
14489 <ul>
14490 <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>
14491 <ul>
14492 <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>
14493 <ul>
14494 <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>
14495 <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>
14496 <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>
14497 <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>
14498 <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>
14499 </ul>
14500 </li>
14501 </ul>
14502 </li>
14503 </ul>
14504 </li>
14505 </ul>
14506 </li>
14507 </ul>
14508 </li>
14509 </ul>
14510 </div>
14511
14512 <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>
14513 <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>
14514 <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>
14515 <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>
14516 <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>
14517 <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>
14518 <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>
14519 <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>
14520 <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>
14521 <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>
14522
14523 !! end
14524
14525 !! test
14526 TOC regression (T11764)
14527 !! wikitext
14528 == title 1 ==
14529 === title 1.1 ===
14530 ==== title 1.1.1 ====
14531 === title 1.2 ===
14532 == title 2 ==
14533 === title 2.1 ===
14534 !! html
14535 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14536 <ul>
14537 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14538 <ul>
14539 <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>
14540 <ul>
14541 <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>
14542 </ul>
14543 </li>
14544 <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>
14545 </ul>
14546 </li>
14547 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14548 <ul>
14549 <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>
14550 </ul>
14551 </li>
14552 </ul>
14553 </div>
14554
14555 <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>
14556 <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>
14557 <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>
14558 <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>
14559 <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>
14560 <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>
14561
14562 !! end
14563
14564 !! test
14565 TOC for heading containing <span id="..."></span> (T96153)
14566 !! wikitext
14567 __FORCETOC__
14568 ==<span id="old-anchor"></span>New title==
14569 !! html/php
14570 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14571 <ul>
14572 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
14573 </ul>
14574 </div>
14575
14576 <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>
14577
14578 !! end
14579
14580 !! test
14581 TOC with wgMaxTocLevel=3 (bug 6204)
14582 !! options
14583 wgMaxTocLevel=3
14584 !! wikitext
14585 == title 1 ==
14586 === title 1.1 ===
14587 ==== title 1.1.1 ====
14588 === title 1.2 ===
14589 == title 2 ==
14590 === title 2.1 ===
14591 !! html
14592 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14593 <ul>
14594 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14595 <ul>
14596 <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>
14597 <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>
14598 </ul>
14599 </li>
14600 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14601 <ul>
14602 <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>
14603 </ul>
14604 </li>
14605 </ul>
14606 </div>
14607
14608 <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>
14609 <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>
14610 <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>
14611 <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>
14612 <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>
14613 <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>
14614
14615 !! end
14616
14617 !! test
14618 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
14619 !! options
14620 wgMaxTocLevel=3
14621 !! wikitext
14622 ==Section 1==
14623 ===Section 1.1===
14624 ====Section 1.1.1====
14625 ====Section 1.1.1.1====
14626 ==Section 2==
14627 !! html
14628 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14629 <ul>
14630 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
14631 <ul>
14632 <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>
14633 </ul>
14634 </li>
14635 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
14636 </ul>
14637 </div>
14638
14639 <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>
14640 <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>
14641 <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>
14642 <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>
14643 <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>
14644
14645 !! end
14646
14647
14648 !! test
14649 Resolving duplicate section names
14650 !! wikitext
14651 == Foo bar ==
14652 == Foo bar ==
14653 !! html
14654 <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>
14655 <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>
14656
14657 !! end
14658
14659 !! test
14660 Resolving duplicate section names with differing case (bug 10721)
14661 !! wikitext
14662 == Foo bar ==
14663 == Foo Bar ==
14664 !! html
14665 <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>
14666 <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>
14667
14668 !! end
14669
14670 !! article
14671 Template:sections
14672 !! text
14673 ===Section 1===
14674 ==Section 2==
14675 !! endarticle
14676
14677 !! test
14678 Template with sections, __NOTOC__
14679 !! wikitext
14680 __NOTOC__
14681 ==Section 0==
14682 {{sections}}
14683 ==Section 4==
14684 !! html
14685 <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>
14686 <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>
14687 <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>
14688 <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>
14689
14690 !! end
14691
14692 !! test
14693 __NOEDITSECTION__ keyword
14694 !! wikitext
14695 __NOEDITSECTION__
14696 ==Section 1==
14697 ==Section 2==
14698 !! html
14699 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
14700 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
14701
14702 !! end
14703
14704 !! test
14705 Link inside a section heading
14706 !! wikitext
14707 ==Section with a [[Main Page|link]] in it==
14708 !! html
14709 <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>
14710
14711 !! end
14712
14713 !! test
14714 TOC regression (T14077)
14715 !! wikitext
14716 __TOC__
14717 == title 1 ==
14718 === title 1.1 ===
14719 == title 2 ==
14720 !! html
14721 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14722 <ul>
14723 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14724 <ul>
14725 <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>
14726 </ul>
14727 </li>
14728 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
14729 </ul>
14730 </div>
14731
14732 <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>
14733 <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>
14734 <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>
14735
14736 !! end
14737
14738 !! test
14739 BUG 1219 URL next to image (good)
14740 !! wikitext
14741 http://example.com [[File:Foobar.jpg]]
14742 !! html/php
14743 <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>
14744 </p>
14745 !! html/parsoid
14746 <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>
14747 !!end
14748
14749 !! test
14750 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
14751 !! wikitext
14752 ===
14753 The line above must have a trailing space!
14754 === <!--
14755 --> <!-- -->
14756 But just in case it doesn't...
14757 !! html
14758 <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>
14759 <p>The line above must have a trailing space!
14760 </p>
14761 <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>
14762 <p>But just in case it doesn't...
14763 </p>
14764 !! end
14765
14766 !! test
14767 Header with special characters (bug 25462)
14768 !! wikitext
14769 The tooltips shall not show entities to the user (ie. be double escaped)
14770
14771 == text > text ==
14772 section 1
14773
14774 == text < text ==
14775 section 2
14776
14777 == text & text ==
14778 section 3
14779
14780 == text ' text ==
14781 section 4
14782
14783 == text " text ==
14784 section 5
14785 !! html
14786 <p>The tooltips shall not show entities to the user (ie. be double escaped)
14787 </p>
14788 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14789 <ul>
14790 <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>
14791 <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>
14792 <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>
14793 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
14794 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
14795 </ul>
14796 </div>
14797
14798 <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>
14799 <p>section 1
14800 </p>
14801 <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>
14802 <p>section 2
14803 </p>
14804 <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>
14805 <p>section 3
14806 </p>
14807 <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>
14808 <p>section 4
14809 </p>
14810 <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>
14811 <p>section 5
14812 </p>
14813 !! end
14814
14815 !! test
14816 Header with space, plus and underscore as entity
14817 !! wikitext
14818 Id should not contain + for spaces
14819
14820 == Space between Text ==
14821 section 1
14822
14823 == Space-Entity&#32;between&#32;Text ==
14824 section 2
14825
14826 == Plus+between+Text ==
14827 section 3
14828
14829 == Plus-Entity&#43;between&#43;Text ==
14830 section 4
14831
14832 == Underscore_between_Text ==
14833 section 5
14834
14835 == Underscore-Entity&#95;between&#95;Text ==
14836 section 6
14837
14838 [[#Space between Text]]
14839 [[#Space-Entity&#32;between&#32;Text]]
14840 [[#Plus+between+Text]]
14841 [[#Plus-Entity&#43;between&#43;Text]]
14842 [[#Underscore_between_Text]]
14843 [[#Underscore-Entity&#95;between&#95;Text]]
14844 !! html
14845 <p>Id should not contain + for spaces
14846 </p>
14847 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14848 <ul>
14849 <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>
14850 <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>
14851 <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>
14852 <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>
14853 <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>
14854 <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>
14855 </ul>
14856 </div>
14857
14858 <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>
14859 <p>section 1
14860 </p>
14861 <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>
14862 <p>section 2
14863 </p>
14864 <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>
14865 <p>section 3
14866 </p>
14867 <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>
14868 <p>section 4
14869 </p>
14870 <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>
14871 <p>section 5
14872 </p>
14873 <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>
14874 <p>section 6
14875 </p><p><a href="#Space_between_Text">#Space between Text</a>
14876 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
14877 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
14878 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
14879 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
14880 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
14881 </p>
14882 !! end
14883
14884 !! test
14885 Headers with excess '=' characters
14886 (Are similar tests necessary beyond the 1st level?)
14887 !! wikitext
14888 =foo==
14889 ==foo=
14890 =''italic'' heading==
14891 ==''italic'' heading=
14892 !! html
14893 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14894 <ul>
14895 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
14896 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
14897 <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>
14898 <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>
14899 </ul>
14900 </div>
14901
14902 <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>
14903 <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>
14904 <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>
14905 <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>
14906
14907 !! end
14908
14909 !! test
14910 HTML headers vs TOC (bug 23393)
14911 (__NOEDITSECTION__ for clearer output, doesn't matter here)
14912 !! wikitext
14913 <h1>Header 1</h1>
14914 == Header 1.1 ==
14915 == Header 1.2 ==
14916
14917 <h1>Header 2
14918 </h1>
14919 == Header 2.1 ==
14920 == Header 2.2 ==
14921 __NOEDITSECTION__
14922 !! html
14923 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14924 <ul>
14925 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
14926 <ul>
14927 <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>
14928 <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>
14929 </ul>
14930 </li>
14931 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
14932 <ul>
14933 <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>
14934 <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>
14935 </ul>
14936 </li>
14937 </ul>
14938 </div>
14939
14940 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
14941 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
14942 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
14943 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
14944 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
14945 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
14946
14947 !! end
14948
14949 !! test
14950 Single-line or multiline-comments can follow headings
14951 !! options
14952 parsoid=wt2html,wt2wt
14953 !! wikitext
14954 ==foo==<!---->
14955 ==bar==<!--c1-->
14956 ==baz==<!--
14957 c2
14958 c3-->
14959 !! html
14960 <h2><span class="mw-headline" id="foo">foo</span></h2>
14961 <h2><span class="mw-headline" id="bar">bar</span></h2>
14962 <h2><span class="mw-headline" id="baz">baz</span></h2>
14963
14964 !! end
14965
14966 !! test
14967 BUG 1219 URL next to image (broken)
14968 !! wikitext
14969 http://example.com[[File:Foobar.jpg]]
14970 !! html/php
14971 <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>
14972 </p>
14973 !! html/parsoid
14974 <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>
14975 !!end
14976
14977 !! test
14978 Bug 1186 news: in the middle of text
14979 !! wikitext
14980 http://en.wikinews.org/wiki/Wikinews:Workplace
14981 !! html
14982 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
14983 </p>
14984 !!end
14985
14986
14987 !! test
14988 Namespaced link must have a title
14989 !! wikitext
14990 [[Project:]]
14991 !! html
14992 <p>[[Project:]]
14993 </p>
14994 !!end
14995
14996 !! test
14997 Namespaced link must have a title (bad fragment version)
14998 !! wikitext
14999 [[Project:#fragment]]
15000 !! html
15001 <p>[[Project:#fragment]]
15002 </p>
15003 !!end
15004
15005
15006 ###
15007 ### HTML tags and HTML attributes
15008 ###
15009
15010 !! test
15011 div with no attributes
15012 !! wikitext
15013 <div>HTML rocks</div>
15014 !! html
15015 <div>HTML rocks</div>
15016
15017 !! end
15018
15019 !! test
15020 div with double-quoted attribute
15021 !! wikitext
15022 <div id="rock">HTML rocks</div>
15023 !! html
15024 <div id="rock">HTML rocks</div>
15025
15026 !! end
15027
15028 !! test
15029 div with single-quoted attribute
15030 !! wikitext
15031 <div id='rock'>HTML rocks</div>
15032 !! html
15033 <div id="rock">HTML rocks</div>
15034
15035 !! end
15036
15037 !! test
15038 div with unquoted attribute
15039 !! wikitext
15040 <div id=rock>HTML rocks</div>
15041 !! html
15042 <div id="rock">HTML rocks</div>
15043
15044 !! end
15045
15046 !! test
15047 div with illegal double attributes
15048 !! wikitext
15049 <div id="a" id="b">HTML rocks</div>
15050 !! html
15051 <div id="b">HTML rocks</div>
15052
15053 !!end
15054
15055 # FIXME: produce empty string instead of "class" in the PHP parser, following
15056 # the HTML5 spec.
15057 !! test
15058 div with empty attribute value, space before equals
15059 !! options
15060 parsoid
15061 !! wikitext
15062 <div class =>HTML rocks</div>
15063 !! html
15064 <div class="">HTML rocks</div>
15065
15066 !! end
15067
15068 !! test
15069 div with multiple empty attribute values
15070 !! options
15071 parsoid
15072 !! wikitext
15073 <div id= title=>HTML rocks</div>
15074 !! html
15075 <div id="" title="">HTML rocks</div>
15076
15077 !! end
15078
15079 !! test
15080 table with multiple empty attribute values
15081 !! options
15082 parsoid
15083 !! wikitext
15084 {| title= id=
15085 | hi
15086 |}
15087 !! html
15088 <table title="" id="">
15089 <tbody><tr><td> hi</td></tr>
15090 </tbody></table>
15091 !! end
15092
15093 !! test
15094 div with braces in attribute value
15095 !! wikitext
15096 <div title="{}">Foo</div>
15097 !! html/php
15098 <div title="&#123;}">Foo</div>
15099
15100 !! html/parsoid
15101 <div title="{}">Foo</div>
15102 !! end
15103
15104 # This it very inconsistent in the PHP parser: it returns
15105 # class="class" if there is a space between the name and the equal sign (see
15106 # 'div with empty attribute value, space before equals'), but strips the
15107 # attribute completely if the space is missing. We hope that not much content
15108 # depends on this, so are implementing the behavior below in Parsoid for
15109 # consistencies' sake.
15110 # FIXME: fix this behavior in the PHP parser?
15111 !! test
15112 div with empty attribute value, no space before equals
15113 !! options
15114 parsoid=wt2html,html2html
15115 !! wikitext
15116 <div class=>HTML rocks</div>
15117 !! html/php
15118 <div>HTML rocks</div>
15119
15120 !! html/parsoid
15121 <div class="">HTML rocks</div>
15122 !! end
15123
15124 !! test
15125 HTML multiple attributes correction
15126 !! wikitext
15127 <p class="error" class="awesome">Awesome!</p>
15128 !! html
15129 <p class="awesome">Awesome!</p>
15130
15131 !!end
15132
15133 !! test
15134 Table multiple attributes correction
15135 !! wikitext
15136 {|
15137 !+ class="error" class="awesome"| status
15138 |}
15139 !! html
15140 <table>
15141 <tr>
15142 <th class="awesome"> status
15143 </th></tr></table>
15144
15145 !!end
15146
15147 !! test
15148 DIV IN UPPERCASE
15149 !! wikitext
15150 <DIV ID="x">HTML ROCKS</DIV>
15151 !! html
15152 <div id="x">HTML ROCKS</div>
15153
15154 !!end
15155
15156 !! test
15157 Non-ASCII pseudo-tags are rendered as text
15158 !! wikitext
15159 <khyô>
15160 !! html
15161 <p>&lt;khyô&gt;
15162 </p>
15163 !! end
15164
15165 !! test
15166 Pseudo-tag with URL 'name' renders as url link
15167 !! wikitext
15168 <http://example.com/>
15169 !! html
15170 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
15171 </p>
15172 !! end
15173
15174 !! test
15175 text with amp in the middle of nowhere
15176 !! wikitext
15177 Remember AT&T?
15178 !! html
15179 <p>Remember AT&amp;T?
15180 </p>
15181 !! end
15182
15183 !! test
15184 text with character entity: eacute
15185 !! wikitext
15186 I always thought &eacute; was a cute letter.
15187 !! html
15188 <p>I always thought &#233; was a cute letter.
15189 </p>
15190 !! html+tidy
15191 <p>I always thought é was a cute letter.</p>
15192 !! end
15193
15194 !! test
15195 text with entity-escaped character entity-like string: eacute
15196 !! wikitext
15197 I always thought &amp;eacute; was a cute letter.
15198 !! html
15199 <p>I always thought &amp;eacute; was a cute letter.
15200 </p>
15201 !! end
15202
15203 !! test
15204 text with undefined character entity: xacute
15205 !! wikitext
15206 I always thought &xacute; was a cute letter.
15207 !! html
15208 <p>I always thought &amp;xacute; was a cute letter.
15209 </p>
15210 !! end
15211
15212 !! test
15213 HTML5 tags
15214 !! wikitext
15215 <data value="5">five</data>
15216 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15217 <mark>This highlighted text</mark>
15218 !! html
15219 <p><data value="5">five</data>
15220 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15221 <mark>This highlighted text</mark>
15222 </p>
15223 !! end
15224
15225 !! test
15226 HTML tag with leading space is parsed as text
15227 !! wikitext
15228 < div>foo< /div>
15229 !! html
15230 <p>&lt; div&gt;foo&lt; /div&gt;
15231 </p>
15232 !! end
15233
15234 ###
15235 ### Nesting tests (see bug 41545, 50604, 51081)
15236 ###
15237
15238 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
15239 # Note that html2wt is considerably more difficult if we use <b> in
15240 # the test case, instead of <big>
15241 !! test
15242 Ensure that HTML adoption agency algorithm is properly implemented.
15243 !! wikitext
15244 <big>X<big>Y</big>Z</big>
15245 !! html
15246 <p><big>X<big>Y</big>Z</big>
15247 </p>
15248 !! end
15249
15250 # This was bug 41545 in the PHP parser.
15251 # Note that tidy doesn't handle this correctly.
15252 !! test
15253 Nesting of <kbd>
15254 !! wikitext
15255 <kbd>X<kbd>Y</kbd>Z</kbd>
15256 !! html
15257 <p><kbd>X<kbd>Y</kbd>Z</kbd>
15258 </p>
15259 !! end
15260
15261 # The following cases were bug 51081 in the PHP parser.
15262 # Note that there are some other nestable tags (b, i, etc) which are
15263 # not covered; see bug 51081 for discussion.
15264
15265 # Note that tidy doesn't handle this correctly.
15266 !! test
15267 Nesting of <em>
15268 !! wikitext
15269 <em>X<em>Y</em>Z</em>
15270 !! html
15271 <p><em>X<em>Y</em>Z</em>
15272 </p>
15273 !! end
15274
15275 # Note that tidy doesn't handle this correctly.
15276 !! test
15277 Nesting of <strong>
15278 !! wikitext
15279 <strong>X<strong>Y</strong>Z</strong>
15280 !! html
15281 <p><strong>X<strong>Y</strong>Z</strong>
15282 </p>
15283 !! end
15284
15285 !! test
15286 Nesting of <q>
15287 !! wikitext
15288 <q>X<q>Y</q>Z</q>
15289 !! html+tidy
15290 <p><q>X<q>Y</q>Z</q></p>
15291 !! end
15292
15293 # Note that tidy doesn't handle this correctly.
15294 !! test
15295 Nesting of <ruby>
15296 !! wikitext
15297 <ruby>X<ruby>Y</ruby>Z</ruby>
15298 !! html
15299 <p><ruby>X<ruby>Y</ruby>Z</ruby>
15300 </p>
15301 !! end
15302
15303 # Note that tidy doesn't handle this correctly.
15304 !! test
15305 Nesting of <bdo>
15306 !! wikitext
15307 <bdo>X<bdo>Y</bdo>Z</bdo>
15308 !! html
15309 <p><bdo>X<bdo>Y</bdo>Z</bdo>
15310 </p>
15311 !! end
15312
15313
15314 ###
15315 ### Media links
15316 ###
15317
15318 !! test
15319 Media link
15320 !! wikitext
15321 [[Media:Foobar.jpg]]
15322 !! html
15323 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
15324 </p>
15325 !! end
15326
15327 !! test
15328 Media link with text
15329 !! wikitext
15330 [[Media:Foobar.jpg|A neat file to look at]]
15331 !! html
15332 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
15333 </p>
15334 !! end
15335
15336 # FIXME: this is still bad HTML tag nesting
15337 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
15338 !! test
15339 Media link with nasty text
15340 !! wikitext
15341 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
15342 !! html
15343 <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>
15344
15345 !! html+tidy
15346 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
15347 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
15348 !! end
15349
15350 !! test
15351 Media link to nonexistent file (bug 1702)
15352 !! wikitext
15353 [[Media:No such.jpg]]
15354 !! html
15355 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
15356 </p>
15357 !! end
15358
15359 !! test
15360 Image link to nonexistent file (bug 1850 - good)
15361 !! wikitext
15362 [[File:No_such.jpg]]
15363 !! html/php
15364 <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>
15365 </p>
15366 !! html/parsoid
15367 <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>
15368 !! end
15369
15370 !! test
15371 :Image link to nonexistent file (bug 1850 - bad)
15372 !! wikitext
15373 [[:Image:No such.jpg]]
15374 !! html/php
15375 <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>
15376 </p>
15377 !! html/parsoid
15378 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
15379 !! end
15380
15381
15382
15383 !! test
15384 Character reference normalization in link text (bug 1938)
15385 !! wikitext
15386 [[Main Page|this&that]]
15387 !! html
15388 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
15389 </p>
15390 !!end
15391
15392 !! article
15393 אַ
15394 !! text
15395 Test for unicode normalization
15396
15397 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
15398 !! endarticle
15399
15400 !! test
15401 (bug 19451) Links should refer to the normalized form.
15402 !! wikitext
15403 [[&#xFB2E;]]
15404 [[&#x5d0;&#x5b7;]]
15405 [[&#x5d0;ַ]]
15406 [[א&#x5b7;]]
15407 [[אַ]]
15408 !! html
15409 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
15410 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
15411 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
15412 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
15413 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
15414 </p>
15415 !! end
15416
15417 !! test
15418 Empty attribute crash test (bug 2067)
15419 !! wikitext
15420 <font color="">foo</font>
15421 !! html
15422 <p><font color="">foo</font>
15423 </p>
15424 !! end
15425
15426 !! test
15427 Empty attribute crash test single-quotes (bug 2067)
15428 !! wikitext
15429 <font color=''>foo</font>
15430 !! html
15431 <p><font color="">foo</font>
15432 </p>
15433 !! end
15434
15435 !! test
15436 Attribute test: equals, then nothing
15437 !! wikitext
15438 <font color=>foo</font>
15439 !! html
15440 <p><font>foo</font>
15441 </p>
15442 !! end
15443
15444 !! test
15445 Attribute test: unquoted value
15446 !! wikitext
15447 <font color=x>foo</font>
15448 !! html
15449 <p><font color="x">foo</font>
15450 </p>
15451 !! end
15452
15453 !! test
15454 Attribute test: unquoted but illegal value (hash)
15455 !! wikitext
15456 <font color=#x>foo</font>
15457 !! html
15458 <p><font color="#x">foo</font>
15459 </p>
15460 !! end
15461
15462 # Parsoid does not serialize to empty attribute syntax,
15463 # so wt2wt and html2wt cases are skipped
15464 !! test
15465 Attribute test: no value (T54330)
15466 !! options
15467 parsoid=wt2html,html2html
15468 !! wikitext
15469 <font color>foo</font>
15470 !! html/php
15471 <p><font color="">foo</font>
15472 </p>
15473 !! html/parsoid
15474 <p><font color="">foo</font></p>
15475 !! end
15476
15477 !! test
15478 Bug 2095: link with three closing brackets
15479 !! wikitext
15480 [[Main Page]]]
15481 !! html/php
15482 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
15483 </p>
15484 !! html/parsoid
15485 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
15486 !! end
15487
15488 !! test
15489 Bug 2095: link with pipe and three closing brackets
15490 !! wikitext
15491 [[Main Page|link]]]
15492 !! html/php
15493 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
15494 </p>
15495 !! html/parsoid
15496 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
15497 !! end
15498
15499 !! test
15500 Bug 2095: link with pipe and three closing brackets, version 2
15501 !! wikitext
15502 [[Main Page|[http://example.com/]]]
15503 !! html/php
15504 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
15505 </p>
15506 !! html/parsoid
15507 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
15508 !! end
15509
15510
15511 ###
15512 ### Safety
15513 ###
15514
15515 !! article
15516 Template:Dangerous attribute
15517 !! text
15518 " onmouseover="alert(document.cookie)
15519 !! endarticle
15520
15521 !! article
15522 Template:Dangerous style attribute
15523 !! text
15524 border-size: expression(alert(document.cookie))
15525 !! endarticle
15526
15527 !! article
15528 Template:Div style
15529 !! text
15530 <div style="float: right; {{{1}}}">Magic div</div>
15531 !! endarticle
15532
15533 !! test
15534 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
15535 !! wikitext
15536 <div title="{{test}}"></div>
15537 !! html
15538 <div title="This is a test template"></div>
15539
15540 !! end
15541
15542 # Parsoid has enough context to handle this case
15543 !! test
15544 Bug 2304: HTML attribute safety (dangerous template; 2309)
15545 !! wikitext
15546 <div title="{{dangerous attribute}}"></div>
15547 !! html/php
15548 <div title=""></div>
15549
15550 !! html/parsoid
15551 <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>
15552 !! end
15553
15554 !! test
15555 Bug 2304: HTML attribute safety (dangerous style template; 2309)
15556 !! wikitext
15557 <div style="{{dangerous style attribute}}"></div>
15558 !! html
15559 <div style="/* insecure input */"></div>
15560
15561 !! end
15562
15563 !! test
15564 Bug 2304: HTML attribute safety (safe parameter; 2309)
15565 !! wikitext
15566 {{div style|width: 200px}}
15567 !! html
15568 <div style="float: right; width: 200px">Magic div</div>
15569
15570 !! end
15571
15572 !! test
15573 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
15574 !! wikitext
15575 {{div style|width: expression(alert(document.cookie))}}
15576 !! html
15577 <div style="/* insecure input */">Magic div</div>
15578
15579 !! end
15580
15581 !! test
15582 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
15583 !! wikitext
15584 {{div style|"><script>alert(document.cookie)</script>}}
15585 !! html
15586 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15587
15588 !! end
15589
15590 !! test
15591 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
15592 !! wikitext
15593 {{div style|" ><script>alert(document.cookie)</script>}}
15594 !! html
15595 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15596
15597 !! end
15598
15599 !! test
15600 Bug 2304: HTML attribute safety (link)
15601 !! wikitext
15602 <div title="[[Main Page]]"></div>
15603 !! html
15604 <div title="&#91;&#91;Main Page]]"></div>
15605
15606 !! end
15607
15608 !! test
15609 Bug 2304: HTML attribute safety (italics)
15610 !! wikitext
15611 <div title="''foobar''"></div>
15612 !! html
15613 <div title="&#39;&#39;foobar&#39;&#39;"></div>
15614
15615 !! end
15616
15617 !! test
15618 Bug 2304: HTML attribute safety (bold)
15619 !! wikitext
15620 <div title="'''foobar'''"></div>
15621 !! html
15622 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
15623
15624 !! end
15625
15626
15627 !! test
15628 Bug 2304: HTML attribute safety (ISBN)
15629 !! wikitext
15630 <div title="ISBN 1234567890"></div>
15631 !! html
15632 <div title="&#73;SBN 1234567890"></div>
15633
15634 !! end
15635
15636 !! test
15637 Bug 2304: HTML attribute safety (RFC)
15638 !! wikitext
15639 <div title="RFC 1234"></div>
15640 !! html
15641 <div title="&#82;FC 1234"></div>
15642
15643 !! end
15644
15645 !! test
15646 Bug 2304: HTML attribute safety (PMID)
15647 !! wikitext
15648 <div title="PMID 1234567890"></div>
15649 !! html
15650 <div title="&#80;MID 1234567890"></div>
15651
15652 !! end
15653
15654 !! test
15655 Bug 2304: HTML attribute safety (web link)
15656 !! wikitext
15657 <div title="http://example.com/"></div>
15658 !! html
15659 <div title="http&#58;//example.com/"></div>
15660
15661 !! end
15662
15663 !! test
15664 Bug 2304: HTML attribute safety (named web link)
15665 !! wikitext
15666 <div title="[http://example.com/ link]"></div>
15667 !! html
15668 <div title="&#91;http&#58;//example.com/ link]"></div>
15669
15670 !! end
15671
15672 !! test
15673 Bug 3244: HTML attribute safety (extension; safe)
15674 !! wikitext
15675 <div style="<nowiki>background:blue</nowiki>"></div>
15676 !! html
15677 <div style="background:blue"></div>
15678
15679 !! end
15680
15681 !! test
15682 Bug 3244: HTML attribute safety (extension; unsafe)
15683 !! wikitext
15684 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
15685 !! html
15686 <div style="/* insecure input */"></div>
15687
15688 !! end
15689
15690 # More MSIE fun discovered by Tom Gilder
15691
15692 !! test
15693 MSIE CSS safety test: spurious slash
15694 !! wikitext
15695 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
15696 !! html
15697 <div style="/* insecure input */">evil</div>
15698
15699 !! end
15700
15701 !! test
15702 MSIE CSS safety test: hex code
15703 !! wikitext
15704 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
15705 !! html
15706 <div style="/* insecure input */">evil</div>
15707
15708 !! end
15709
15710 !! test
15711 MSIE CSS safety test: comment in url
15712 !! wikitext
15713 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
15714 !! html
15715 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
15716
15717 !! end
15718
15719 !! test
15720 MSIE CSS safety test: comment in expression
15721 !! wikitext
15722 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
15723 !! html
15724 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
15725
15726 !! end
15727
15728 !! test
15729 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
15730 !! wikitext
15731 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
15732 !! html
15733 <p style="/* invalid control char */">A</p>
15734
15735 !! end
15736
15737 !! test
15738 MSIE 6 CSS safety test: Fullwidth (bug 55332)
15739 !! wikitext
15740 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
15741 <div style="top:EXPRESSION(alert())">B</div>
15742 !! html
15743 <p style="/* insecure input */">A</p>
15744 <div style="/* insecure input */">B</div>
15745
15746 !! end
15747
15748 !! test
15749 MSIE 6 CSS safety test: IPA extensions (bug 55332)
15750 !! wikitext
15751 <div style="background-image:uʀʟ(javascript:alert())">A</div>
15752 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
15753 !! html
15754 <div style="/* insecure input */">A</div>
15755 <p style="/* insecure input */">B</p>
15756
15757 !! end
15758
15759 !! test
15760 MSIE 6 CSS safety test: sup/sub script (bug 55332)
15761 !! wikitext
15762 <div style="background-image:url⁽javascript:alert())">A</div>
15763 <div style="background-image:url₍javascript:alert())">B</div>
15764 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
15765 !! html
15766 <div style="/* insecure input */">A</div>
15767 <div style="/* insecure input */">B</div>
15768 <p style="/* insecure input */">C</p>
15769
15770 !! end
15771
15772 !! test
15773 Opera -o-link CSS
15774 !! wikitext
15775 <div
15776 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;"
15777 style="-o-link:attr(title);-o-link-source:current">X</div>
15778 !! html
15779 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
15780
15781 !! end
15782
15783 !! test
15784 MSIE 6 CSS safety test: Repetition markers (bug 55332)
15785 !! wikitext
15786 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
15787 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
15788 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
15789 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
15790 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
15791 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
15792 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
15793 !! html
15794 <p style="/* insecure input */">A</p>
15795 <p style="/* insecure input */">B</p>
15796 <p style="/* insecure input */">C</p>
15797 <p style="/* insecure input */">D</p>
15798 <p style="/* insecure input */">E</p>
15799 <p style="/* insecure input */">F</p>
15800 <p style="/* insecure input */">G</p>
15801
15802 !! end
15803
15804 !! test
15805 Table attribute legitimate extension
15806 !! wikitext
15807 {|
15808 !+ style="<nowiki>color:blue</nowiki>"| status
15809 |}
15810 !! html
15811 <table>
15812 <tr>
15813 <th style="color:blue"> status
15814 </th></tr></table>
15815
15816 !!end
15817
15818 !! test
15819 Table attribute safety
15820 !! wikitext
15821 {|
15822 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
15823 |}
15824 !! html
15825 <table>
15826 <tr>
15827 <th style="/* insecure input */"> status
15828 </th></tr></table>
15829
15830 !! end
15831
15832 !! test
15833 CSS line continuation 1
15834 !! wikitext
15835 <div style="background-image: u\&#10;rl(test.jpg);"></div>
15836 !! html
15837 <div style="/* insecure input */"></div>
15838
15839 !! end
15840
15841 !! test
15842 CSS line continuation 2
15843 !! wikitext
15844 <div style="background-image: u\&#13;rl(test.jpg); "></div>
15845 !! html
15846 <div style="/* invalid control char */"></div>
15847
15848 !! end
15849
15850 !! article
15851 Template:Identity
15852 !! text
15853 {{{1}}}
15854 !! endarticle
15855
15856 !! test
15857 Expansion of multi-line templates in attribute values (bug 6255)
15858 !! wikitext
15859 <div style="background: {{identity|#00FF00}}">-</div>
15860 !! html
15861 <div style="background: #00FF00">-</div>
15862
15863 !! end
15864
15865
15866 !! test
15867 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
15868 !! wikitext
15869 <div style="background:
15870 #00FF00">-</div>
15871 !! html/php
15872 <div style="background: #00FF00">-</div>
15873
15874 !! html/parsoid
15875 <div style="background:
15876 #00FF00">-</div>
15877 !! end
15878
15879 !! test
15880 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
15881 !! wikitext
15882 <div style="background: &#10;#00FF00">-</div>
15883 !! html
15884 <div style="background: &#10;#00FF00">-</div>
15885
15886 !! end
15887
15888 !! test
15889 evil <math>-wiki-tags without Extension:Math enabled
15890 !! wikitext
15891 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
15892 !! html+tidy
15893 <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>
15894 !! end
15895
15896 ###
15897 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
15898 ###
15899 !! test
15900 Parser hook: empty input
15901 !! wikitext
15902 <tag></tag>
15903 !! html/php
15904 <pre>
15905 ''
15906 array (
15907 )
15908 </pre>
15909
15910 !! end
15911
15912 !! test
15913 Parser hook: empty input using terminated empty elements
15914 !! wikitext
15915 <tag/>
15916 !! html/php
15917 <pre>
15918 NULL
15919 array (
15920 )
15921 </pre>
15922
15923 !! end
15924
15925 !! test
15926 Parser hook: empty input using terminated empty elements (space before)
15927 !! wikitext
15928 <tag />
15929 !! html/php
15930 <pre>
15931 NULL
15932 array (
15933 )
15934 </pre>
15935
15936 !! end
15937
15938 !! test
15939 Parser hook: basic input
15940 !! wikitext
15941 <tag>input</tag>
15942 !! html/php
15943 <pre>
15944 'input'
15945 array (
15946 )
15947 </pre>
15948
15949 !! end
15950
15951
15952 !! test
15953 Parser hook: case insensitive
15954 !! wikitext
15955 <TAG>input</TAG>
15956 !! html/php
15957 <pre>
15958 'input'
15959 array (
15960 )
15961 </pre>
15962
15963 !! end
15964
15965
15966 !! test
15967 Parser hook: case insensitive, redux
15968 !! wikitext
15969 <TaG>input</TAg>
15970 !! html/php
15971 <pre>
15972 'input'
15973 array (
15974 )
15975 </pre>
15976
15977 !! end
15978
15979 !! test
15980 Parser hook: nested tags
15981 !! options
15982 noxml
15983 !! wikitext
15984 <tag><tag></tag></tag>
15985 !! html/php
15986 <pre>
15987 '<tag>'
15988 array (
15989 )
15990 </pre>&lt;/tag&gt;
15991
15992 !! end
15993
15994 !! test
15995 Parser hook: basic arguments
15996 !! wikitext
15997 <tag width=200 height = "100" depth = '50' square></tag>
15998 !! html/php
15999 <pre>
16000 ''
16001 array (
16002 'width' => '200',
16003 'height' => '100',
16004 'depth' => '50',
16005 'square' => '',
16006 )
16007 </pre>
16008
16009 !! end
16010
16011 !! test
16012 Parser hook: argument containing a forward slash (bug 5344)
16013 !! wikitext
16014 <tag filename='/tmp/bla'></tag>
16015 !! html/php
16016 <pre>
16017 ''
16018 array (
16019 'filename' => '/tmp/bla',
16020 )
16021 </pre>
16022
16023 !! end
16024
16025 !! test
16026 Parser hook: empty input using terminated empty elements (bug 2374)
16027 !! wikitext
16028 <tag foo=bar/>text
16029 !! html/php
16030 <pre>
16031 NULL
16032 array (
16033 'foo' => 'bar',
16034 )
16035 </pre>text
16036
16037 !! end
16038
16039 # </tag> should be output literally since there is no matching tag that begins it
16040 !! test
16041 Parser hook: basic arguments using terminated empty elements (bug 2374)
16042 !! wikitext
16043 <tag width=200 height = "100" depth = '50' square/>
16044 other stuff
16045 </tag>
16046 !! html/php
16047 <pre>
16048 NULL
16049 array (
16050 'width' => '200',
16051 'height' => '100',
16052 'depth' => '50',
16053 'square' => '',
16054 )
16055 </pre>
16056 <p>other stuff
16057 &lt;/tag&gt;
16058 </p>
16059 !! end
16060
16061 ###
16062 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
16063 ###
16064
16065 !! test
16066 Parser hook: static parser hook not inside a comment
16067 !! wikitext
16068 <statictag>hello, world</statictag>
16069 <statictag action=flush/>
16070 !! html/php
16071 <p>hello, world
16072 </p>
16073 !! end
16074
16075
16076 !! test
16077 Parser hook: static parser hook inside a comment
16078 !! wikitext
16079 <!-- <statictag>hello, world</statictag> -->
16080 <statictag action=flush/>
16081 !! html/php
16082 <p><br />
16083 </p>
16084 !! end
16085
16086 # Nested template calls; this case was broken by Parser.php rev 1.506,
16087 # since reverted.
16088
16089 !! article
16090 Template:One-parameter
16091 !! text
16092 (My parameter is: {{{1}}})
16093 !! endarticle
16094
16095 !! article
16096 Template:Map-one-parameter
16097 !! text
16098 {{{{{1}}}|{{{2}}}}}
16099 !! endarticle
16100
16101 !! test
16102 Nested template calls
16103 !! wikitext
16104 {{Map-one-parameter|One-parameter|param}}
16105 !! html
16106 <p>(My parameter is: param)
16107 </p>
16108 !! end
16109
16110
16111 ###
16112 ### Sanitizer
16113 ###
16114
16115 # HTML+Tidy effectively strips out the empty tags completely
16116 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
16117 # which Tidy would have done for the PHP parser had there been content inside it.
16118 !! test
16119 Sanitizer: Closing of open tags
16120 !! wikitext
16121 <s></s><table></table>
16122 !! html
16123 <s></s><table></table>
16124
16125 !! html/parsoid
16126 <p><s></s></p><table></table>
16127 !! end
16128
16129 !! test
16130 Sanitizer: Closing of open but not closed tags
16131 !! wikitext
16132 <s>foo
16133 !! html
16134 <p><s>foo</s>
16135 </p>
16136 !! end
16137
16138 !! test
16139 Sanitizer: Closing of closed but not open tags
16140 !! options
16141 parsoid=wt2html
16142 !! wikitext
16143 </s>
16144 !! html/php+tidy
16145 !! html/parsoid
16146 !! end
16147
16148 !! test
16149 Sanitizer: Closing of closed but not open table tags
16150 !! options
16151 parsoid=wt2html
16152 !! wikitext
16153 Table not started</td></tr></table>
16154 !! html/php+tidy
16155 <p>Table not started</p>
16156 !! html/parsoid
16157 <p>Table not started</p>
16158 !! end
16159
16160 !! test
16161 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
16162 !! wikitext
16163 <span id="æ: v">byte</span>[[#æ: v|backlink]]
16164 !! html
16165 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
16166 </p>
16167 !! end
16168
16169 # In HTML5, the restrictions are that id must contain at least one character,
16170 # and must not contain any space characters.
16171 !! test
16172 Sanitizer: Validating the contents of the id attribute (bug 4515)
16173 !! options
16174 disabled
16175 !! wikitext
16176 <br id="" /><br id="a space" />
16177 !! html
16178 Something ...
16179 !! end
16180
16181 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
16182 !! test
16183 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
16184 !! options
16185 disabled
16186 !! wikitext
16187 <br id="foo" /><br id="foo" />
16188 !! html
16189 Something need to be done. foo-2 ?
16190 !! end
16191
16192 !! test
16193 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
16194 !! wikitext
16195 <div itemscope>
16196 <meta itemprop="hello" content="world">
16197 <meta http-equiv="refresh" content="5">
16198 <meta itemprop="hello" http-equiv="refresh" content="5">
16199 <link itemprop="hello" href="{{SERVER}}">
16200 <link rel="stylesheet" href="{{SERVER}}">
16201 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
16202 </div>
16203 !! html
16204 <div itemscope="">
16205 <p> <meta itemprop="hello" content="world" />
16206 &lt;meta http-equiv="refresh" content="5"&gt;
16207 <meta itemprop="hello" content="5" />
16208 </p>
16209 <link itemprop="hello" href="http&#58;//example.org" />
16210 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
16211 <link itemprop="hello" href="http&#58;//example.org" />
16212 </div>
16213
16214 !! end
16215
16216 !! test
16217 Language converter: output gets cut off unexpectedly (bug 5757)
16218 !! options
16219 language=zh
16220 !! wikitext
16221 this bit is safe: }-
16222
16223 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
16224
16225 then we get cut off here: }-
16226
16227 all additional text is vanished
16228 !! html
16229 <p>this bit is safe: }-
16230 </p><p>but if we add a conversion instance: xxx
16231 </p><p>then we get cut off here: }-
16232 </p><p>all additional text is vanished
16233 </p>
16234 !! end
16235
16236 !! test
16237 Self closed html pairs (bug 5487)
16238 !! options
16239 !! wikitext
16240 <center><font id="bug" />Centered text</center>
16241 <div><font id="bug2" />In div text</div>
16242 !! html
16243 <center>&lt;font id="bug" /&gt;Centered text</center>
16244 <div>&lt;font id="bug2" /&gt;In div text</div>
16245
16246 !! end
16247
16248 #
16249 #
16250 #
16251
16252 !! test
16253 Punctuation: nbsp before exclamation
16254 !! wikitext
16255 C'est grave !
16256 !! html
16257 <p>C'est grave&#160;!
16258 </p>
16259 !! end
16260
16261 !! test
16262 Punctuation: CSS !important (bug 11874)
16263 !! wikitext
16264 <div style="width:50% !important">important</div>
16265 !! html
16266 <div style="width:50% !important">important</div>
16267
16268 !!end
16269
16270 !! test
16271 Punctuation: CSS ! important (bug 11874; with space after)
16272 !! wikitext
16273 <div style="width:50% ! important">important</div>
16274 !! html
16275 <div style="width:50% ! important">important</div>
16276
16277 !!end
16278
16279 !! test
16280 HTML bullet list, closed tags (bug 5497)
16281 !! wikitext
16282 <ul>
16283 <li>One</li>
16284 <li>Two</li>
16285 </ul>
16286 !! html/php
16287 <ul>
16288 <li>One</li>
16289 <li>Two</li>
16290 </ul>
16291
16292 !! html/parsoid
16293 <ul data-parsoid='{"stx":"html"}'>
16294 <li data-parsoid='{"stx":"html"}'>One</li>
16295 <li data-parsoid='{"stx":"html"}'>Two</li>
16296 </ul>
16297
16298 !! end
16299
16300 !! test
16301 HTML bullet list, unclosed tags (bug 5497)
16302 !! wikitext
16303 <ul>
16304 <li>One
16305 <li>Two
16306 </ul>
16307 !! html/php+tidy
16308 <ul>
16309 <li>One</li>
16310 <li>Two</li>
16311 </ul>
16312 !! html/parsoid
16313 <ul data-parsoid='{"stx":"html"}'>
16314 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16315 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16316 </ul>
16317
16318 !! end
16319
16320 !! test
16321 HTML ordered list, closed tags (bug 5497)
16322 !! wikitext
16323 <ol>
16324 <li>One</li>
16325 <li>Two</li>
16326 </ol>
16327 !! html/php
16328 <ol>
16329 <li>One</li>
16330 <li>Two</li>
16331 </ol>
16332
16333 !! html/parsoid
16334 <ol data-parsoid='{"stx":"html"}'>
16335 <li data-parsoid='{"stx":"html"}'>One</li>
16336 <li data-parsoid='{"stx":"html"}'>Two</li>
16337 </ol>
16338
16339 !! end
16340
16341 !! test
16342 HTML ordered list, unclosed tags (bug 5497)
16343 !! options
16344 !! wikitext
16345 <ol>
16346 <li>One
16347 <li>Two
16348 </ol>
16349 !! html/php+tidy
16350 <ol>
16351 <li>One</li>
16352 <li>Two</li>
16353 </ol>
16354 !! html/parsoid
16355 <ol data-parsoid='{"stx":"html"}'>
16356 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16357 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16358 </ol>
16359
16360 !! end
16361
16362 !! test
16363 HTML nested bullet list, closed tags (bug 5497)
16364 !! wikitext
16365 <ul>
16366 <li>One</li>
16367 <li>Two:
16368 <ul>
16369 <li>Sub-one</li>
16370 <li>Sub-two</li>
16371 </ul>
16372 </li>
16373 </ul>
16374 !! html
16375 <ul>
16376 <li>One</li>
16377 <li>Two:
16378 <ul>
16379 <li>Sub-one</li>
16380 <li>Sub-two</li>
16381 </ul>
16382 </li>
16383 </ul>
16384
16385 !! end
16386
16387 !! test
16388 HTML nested bullet list, open tags (bug 5497)
16389 !! wikitext
16390 <ul>
16391 <li>One
16392 <li>Two:
16393 <ul>
16394 <li>Sub-one
16395 <li>Sub-two
16396 </ul>
16397 </ul>
16398 !! html/php+tidy
16399 <ul>
16400 <li>One</li>
16401 <li>Two:
16402 <ul>
16403 <li>Sub-one</li>
16404 <li>Sub-two</li>
16405 </ul>
16406 </li>
16407 </ul>
16408 !! html/parsoid
16409 <ul>
16410 <li>One
16411 </li>
16412 <li>Two:
16413 <ul>
16414 <li>Sub-one
16415 </li>
16416 <li>Sub-two
16417 </li>
16418 </ul>
16419 </li>
16420 </ul>
16421
16422 !! end
16423
16424 !! test
16425 HTML nested ordered list, closed tags (bug 5497)
16426 !! wikitext
16427 <ol>
16428 <li>One</li>
16429 <li>Two:
16430 <ol>
16431 <li>Sub-one</li>
16432 <li>Sub-two</li>
16433 </ol>
16434 </li>
16435 </ol>
16436 !! html
16437 <ol>
16438 <li>One</li>
16439 <li>Two:
16440 <ol>
16441 <li>Sub-one</li>
16442 <li>Sub-two</li>
16443 </ol>
16444 </li>
16445 </ol>
16446
16447 !! end
16448
16449 !! test
16450 HTML nested ordered list, open tags (bug 5497)
16451 !! wikitext
16452 <ol>
16453 <li>One
16454 <li>Two:
16455 <ol>
16456 <li>Sub-one
16457 <li>Sub-two
16458 </ol>
16459 </ol>
16460 !! html/php
16461 <ol>
16462 <li>One
16463 <li>Two:
16464 <ol>
16465 <li>Sub-one
16466 <li>Sub-two
16467 </ol>
16468 </ol>
16469
16470 !! html/parsoid
16471 <ol>
16472 <li>One
16473 </li>
16474 <li>Two:
16475 <ol>
16476 <li>Sub-one
16477 </li>
16478 <li>Sub-two
16479 </li>
16480 </ol>
16481 </li>
16482 </ol>
16483
16484 !! end
16485
16486 !! test
16487 HTML ordered list item with parameters oddity
16488 !! wikitext
16489 <ol><li id="fragment">One</li>
16490 </ol>
16491 !! html
16492 <ol><li id="fragment">One</li>
16493 </ol>
16494
16495 !! end
16496
16497 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
16498 !!test
16499 bug 5918: autonumbering
16500 !! wikitext
16501 [http://first/] [http://second] [ftp://ftp]
16502
16503 ftp://inlineftp
16504
16505 [mailto:enclosed@mail.tld With target]
16506
16507 [mailto:enclosed@mail.tld]
16508
16509 mailto:inline@mail.tld
16510 !! html/php
16511 <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>
16512 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
16513 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
16514 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
16515 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
16516 </p>
16517 !! html/parsoid
16518 <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>
16519 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
16520 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
16521 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
16522 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
16523 !! end
16524
16525
16526 #
16527 # Security and HTML correctness
16528 # From Nick Jenkins' fuzz testing
16529 #
16530
16531 !! test
16532 Fuzz testing: Parser13
16533 !! wikitext
16534 {|
16535 | http://a|
16536 !! html
16537 <table>
16538 <tr>
16539 <td>
16540 </td>
16541 </tr>
16542 </table>
16543
16544 !! end
16545
16546 !! test
16547 Fuzz testing: Parser14
16548 !! wikitext
16549 == onmouseover= ==
16550 http://__TOC__
16551 !! html
16552 <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>
16553 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16554 <ul>
16555 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16556 </ul>
16557 </div>
16558
16559
16560 !! html+tidy
16561 <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>
16562 <p>http://</p>
16563 <div id="toc" class="toc">
16564 <div id="toctitle">
16565 <h2>Contents</h2>
16566 </div>
16567 <ul>
16568 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16569 </ul>
16570 </div>
16571 <p></p>
16572 !! end
16573
16574 !! test
16575 Fuzz testing: Parser14-table
16576 !! wikitext
16577 ==a==
16578 {| STYLE=__TOC__
16579 !! html
16580 <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>
16581 <table style="&#95;_TOC&#95;_">
16582 <tr><td></td></tr>
16583 </table>
16584
16585 !! html+tidy
16586 <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>
16587 <table style="__TOC__">
16588 <tr>
16589 <td></td>
16590 </tr>
16591 </table>
16592 !! end
16593
16594 # Known to produce bogus xml (extra </td>)
16595 !! test
16596 Fuzz testing: Parser16
16597 !! options
16598 noxml
16599 !! wikitext
16600 {|
16601 !https://||||||
16602 !! html
16603 <table>
16604 <tr>
16605 <th>https://</th>
16606 <th></th>
16607 <th></th>
16608 <th>
16609 </td>
16610 </tr>
16611 </table>
16612
16613 !! html+tidy
16614 <table>
16615 <tr>
16616 <th>https://</th>
16617 <th></th>
16618 <th></th>
16619 <th></th>
16620 </tr>
16621 </table>
16622 !! end
16623
16624 !! test
16625 Fuzz testing: Parser21
16626 !! wikitext
16627 {|
16628 ! irc://{{ftp://a" onmouseover="alert('hello world');"
16629 |
16630 !! html
16631 <table>
16632 <tr>
16633 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
16634 </th>
16635 <td>
16636 </td>
16637 </tr>
16638 </table>
16639
16640 !! end
16641
16642 !! test
16643 Fuzz testing: Parser22
16644 !! wikitext
16645 http://===r:::https://b
16646
16647 {|
16648 !! html
16649 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
16650 </p>
16651 <table>
16652 <tr><td></td></tr>
16653 </table>
16654
16655 !! end
16656
16657 # Known to produce bad XML for now
16658 !! test
16659 Fuzz testing: Parser24
16660 !! options
16661 noxml
16662 !! wikitext
16663 {|
16664 {{{|
16665 <u CLASS=
16666 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
16667 <br style="onmouseover='alert(document.cookie);' " />
16668
16669 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
16670 |
16671 !! html
16672 <table>
16673 {{{|
16674 <u class="&#124;">}}}} &gt;
16675 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
16676
16677 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
16678 <tr>
16679 <td></u>
16680 </td>
16681 </tr>
16682 </table>
16683
16684 !! end
16685
16686 # Note: the current result listed for this is not what the original one was,
16687 # but the original bug was JavaScript injection, which is fixed in any case.
16688 # It's not clear that the original result listed was any more correct than the
16689 # current one. Original result:
16690 # <p>{{{|
16691 # </p>
16692 # <li class="&#124;&#124;">
16693 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
16694 !!test
16695 Fuzz testing: Parser25 (bug 6055)
16696 !! wikitext
16697 {{{
16698 |
16699 <LI CLASS=||
16700 >
16701 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
16702 !! html
16703 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
16704 </p>
16705 !! end
16706
16707 !!test
16708 Fuzz testing: URL adjacent extension (with space, clean)
16709 !! wikitext
16710 http://example.com <nowiki>junk</nowiki>
16711 !! html/php
16712 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
16713 </p>
16714 !! html/parsoid
16715 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
16716 !! end
16717
16718 !!test
16719 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
16720 !! wikitext
16721 http://example.com<nowiki>junk</nowiki>
16722 !! html/php
16723 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
16724 </p>
16725 !! html/parsoid
16726 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
16727 !! end
16728
16729 !!test
16730 Fuzz testing: URL adjacent extension (no space, dirty; pre)
16731 !! wikitext
16732 http://example.com<pre>junk</pre>
16733 !! html/php
16734 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
16735
16736 !! html/php+tidy
16737 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
16738 <pre>
16739 junk
16740 </pre>
16741 !! html/parsoid
16742 <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>
16743 !!end
16744
16745 !!test
16746 Fuzz testing: image with bogus manual thumbnail
16747 !! wikitext
16748 [[Image:foobar.jpg|thumbnail= ]]
16749 !! html/php
16750 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
16751
16752 !! html/parsoid
16753 <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>
16754 !!end
16755
16756 !! test
16757 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
16758 !! wikitext
16759 <pre dir="&#10;"></pre>
16760 !! html
16761 <pre dir="&#10;"></pre>
16762
16763 !! end
16764
16765 !! test
16766 Parsing optional HTML elements (Bug 6171)
16767 !! options
16768 !! wikitext
16769 <table>
16770 <tr>
16771 <td> Some tabular data</td>
16772 <td> More tabular data ...
16773 <td> And yet som tabular data</td>
16774 </tr>
16775 </table>
16776 !! html
16777 <table>
16778 <tr>
16779 <td> Some tabular data</td>
16780 <td> More tabular data ...
16781 </td><td> And yet som tabular data</td>
16782 </tr>
16783 </table>
16784
16785 !! end
16786
16787 !! test
16788 Correct handling of <td>, <tr> (Bug 6171)
16789 !! options
16790 !! wikitext
16791 <table>
16792 <tr>
16793 <td> Some tabular data</td>
16794 <td> More tabular data ...</td>
16795 <td> And yet som tabular data</td>
16796 </tr>
16797 </table>
16798 !! html
16799 <table>
16800 <tr>
16801 <td> Some tabular data</td>
16802 <td> More tabular data ...</td>
16803 <td> And yet som tabular data</td>
16804 </tr>
16805 </table>
16806
16807 !! end
16808
16809
16810 !! test
16811 Parsing crashing regression (fr:JavaScript)
16812 !! wikitext
16813 </body></x>
16814 !! html
16815 <p>&lt;/body&gt;&lt;/x&gt;
16816 </p>
16817 !! end
16818
16819 !! test
16820 Inline wiki vs wiki block nesting
16821 !! wikitext
16822 '''Bold paragraph
16823
16824 New wiki paragraph
16825 !! html
16826 <p><b>Bold paragraph</b>
16827 </p><p>New wiki paragraph
16828 </p>
16829 !! end
16830
16831 # FIXME: The current php output is documented
16832 # and desired output is the parsoid target.
16833 !! test
16834 Inline HTML vs wiki block nesting
16835 !! wikitext
16836 <b>Bold paragraph
16837
16838 New wiki paragraph
16839 !! html/php
16840 <p><b>Bold paragraph
16841 </p><p>New wiki paragraph</b>
16842 </p>
16843 !! html/parsoid
16844 <p><b>Bold paragraph</b>
16845 </p><p>New wiki paragraph
16846 </p>
16847 !! end
16848
16849 # Original result was this:
16850 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
16851 # </p>
16852 # While that might be marginally more intuitive, maybe, the six-apostrophe
16853 # construct is clearly pathological and the result stated here (which is what
16854 # the parser actually does) is about as reasonable as anything.
16855 !!test
16856 Mixing markup for italics and bold
16857 !! options
16858 !! wikitext
16859 '''bold''''''bold''bolditalics'''''
16860 !! html
16861 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
16862 </p>
16863 !! end
16864
16865
16866 !! article
16867 Xyzzyx
16868 !! text
16869 Article for special page transclusion test
16870 !! endarticle
16871
16872 !! test
16873 Special page transclusion
16874 !! options
16875 !! wikitext
16876 {{Special:Prefixindex/Xyzzyx}}
16877 !! html
16878 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16879
16880 !! end
16881
16882 !! test
16883 Special page transclusion twice (bug 5021)
16884 !! options
16885 !! wikitext
16886 {{Special:Prefixindex/Xyzzyx}}
16887 {{Special:Prefixindex/Xyzzyx}}
16888 !! html
16889 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16890 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16891
16892 !! end
16893
16894 !! test
16895 Transclusion of default MediaWiki message
16896 !! wikitext
16897 {{MediaWiki:Mainpage}}
16898 !! html
16899 <p>Main Page
16900 </p>
16901 !! end
16902
16903 !! test
16904 Transclusion of nonexistent MediaWiki message
16905 !! wikitext
16906 {{MediaWiki:Mainpagexxx}}
16907 !! html
16908 <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>
16909 </p>
16910 !! end
16911
16912 !! test
16913 Transclusion of MediaWiki message with underscore
16914 !! wikitext
16915 {{MediaWiki:history_short}}
16916 !! html
16917 <p>History
16918 </p>
16919 !! end
16920
16921 !! test
16922 Transclusion of MediaWiki message with space
16923 !! wikitext
16924 {{MediaWiki:history short}}
16925 !! html
16926 <p>History
16927 </p>
16928 !! end
16929
16930 !! test
16931 Invalid header with following text
16932 !! wikitext
16933 = x = y
16934 !! html
16935 <p>= x = y
16936 </p>
16937 !! end
16938
16939
16940 !! test
16941 Section extraction test (section 0)
16942 !! options
16943 section=0
16944 !! wikitext
16945 start
16946 ==a==
16947 ===aa===
16948 ====aaa====
16949 ==b==
16950 ===ba===
16951 ===bb===
16952 ====bba====
16953 ===bc===
16954 ==c==
16955 ===ca===
16956 !! html/php
16957 start
16958 !! end
16959
16960 !! test
16961 Section extraction test (section 1)
16962 !! options
16963 section=1
16964 !! wikitext
16965 start
16966 ==a==
16967 ===aa===
16968 ====aaa====
16969 ==b==
16970 ===ba===
16971 ===bb===
16972 ====bba====
16973 ===bc===
16974 ==c==
16975 ===ca===
16976 !! html/php
16977 ==a==
16978 ===aa===
16979 ====aaa====
16980 !! end
16981
16982 !! test
16983 Section extraction test (section 2)
16984 !! options
16985 section=2
16986 !! wikitext
16987 start
16988 ==a==
16989 ===aa===
16990 ====aaa====
16991 ==b==
16992 ===ba===
16993 ===bb===
16994 ====bba====
16995 ===bc===
16996 ==c==
16997 ===ca===
16998 !! html/php
16999 ===aa===
17000 ====aaa====
17001 !! end
17002
17003 !! test
17004 Section extraction test (section 3)
17005 !! options
17006 section=3
17007 !! wikitext
17008 start
17009 ==a==
17010 ===aa===
17011 ====aaa====
17012 ==b==
17013 ===ba===
17014 ===bb===
17015 ====bba====
17016 ===bc===
17017 ==c==
17018 ===ca===
17019 !! html/php
17020 ====aaa====
17021 !! end
17022
17023 !! test
17024 Section extraction test (section 4)
17025 !! options
17026 section=4
17027 !! wikitext
17028 start
17029 ==a==
17030 ===aa===
17031 ====aaa====
17032 ==b==
17033 ===ba===
17034 ===bb===
17035 ====bba====
17036 ===bc===
17037 ==c==
17038 ===ca===
17039 !! html/php
17040 ==b==
17041 ===ba===
17042 ===bb===
17043 ====bba====
17044 ===bc===
17045 !! end
17046
17047 !! test
17048 Section extraction test (section 5)
17049 !! options
17050 section=5
17051 !! wikitext
17052 start
17053 ==a==
17054 ===aa===
17055 ====aaa====
17056 ==b==
17057 ===ba===
17058 ===bb===
17059 ====bba====
17060 ===bc===
17061 ==c==
17062 ===ca===
17063 !! html/php
17064 ===ba===
17065 !! end
17066
17067 !! test
17068 Section extraction test (section 6)
17069 !! options
17070 section=6
17071 !! wikitext
17072 start
17073 ==a==
17074 ===aa===
17075 ====aaa====
17076 ==b==
17077 ===ba===
17078 ===bb===
17079 ====bba====
17080 ===bc===
17081 ==c==
17082 ===ca===
17083 !! html/php
17084 ===bb===
17085 ====bba====
17086 !! end
17087
17088 !! test
17089 Section extraction test (section 7)
17090 !! options
17091 section=7
17092 !! wikitext
17093 start
17094 ==a==
17095 ===aa===
17096 ====aaa====
17097 ==b==
17098 ===ba===
17099 ===bb===
17100 ====bba====
17101 ===bc===
17102 ==c==
17103 ===ca===
17104 !! html/php
17105 ====bba====
17106 !! end
17107
17108 !! test
17109 Section extraction test (section 8)
17110 !! options
17111 section=8
17112 !! wikitext
17113 start
17114 ==a==
17115 ===aa===
17116 ====aaa====
17117 ==b==
17118 ===ba===
17119 ===bb===
17120 ====bba====
17121 ===bc===
17122 ==c==
17123 ===ca===
17124 !! html/php
17125 ===bc===
17126 !! end
17127
17128 !! test
17129 Section extraction test (section 9)
17130 !! options
17131 section=9
17132 !! wikitext
17133 start
17134 ==a==
17135 ===aa===
17136 ====aaa====
17137 ==b==
17138 ===ba===
17139 ===bb===
17140 ====bba====
17141 ===bc===
17142 ==c==
17143 ===ca===
17144 !! html/php
17145 ==c==
17146 ===ca===
17147 !! end
17148
17149 !! test
17150 Section extraction test (section 10)
17151 !! options
17152 section=10
17153 !! wikitext
17154 start
17155 ==a==
17156 ===aa===
17157 ====aaa====
17158 ==b==
17159 ===ba===
17160 ===bb===
17161 ====bba====
17162 ===bc===
17163 ==c==
17164 ===ca===
17165 !! html/php
17166 ===ca===
17167 !! end
17168
17169 !! test
17170 Section extraction test (nonexistent section 11)
17171 !! options
17172 section=11
17173 !! wikitext
17174 start
17175 ==a==
17176 ===aa===
17177 ====aaa====
17178 ==b==
17179 ===ba===
17180 ===bb===
17181 ====bba====
17182 ===bc===
17183 ==c==
17184 ===ca===
17185 !! html/php
17186 !! end
17187
17188 !! test
17189 Section extraction test with bogus heading (section 1)
17190 !! options
17191 section=1
17192 !! wikitext
17193 ==a==
17194 ==bogus== not a legal section
17195 ==b==
17196 !! html/php
17197 ==a==
17198 ==bogus== not a legal section
17199 !! end
17200
17201 !! test
17202 Section extraction test with bogus heading (section 2)
17203 !! options
17204 section=2
17205 !! wikitext
17206 ==a==
17207 ==bogus== not a legal section
17208 ==b==
17209 !! html/php
17210 ==b==
17211 !! end
17212
17213 !! test
17214 Section extraction test with comment after heading (section 1)
17215 !! options
17216 section=1
17217 !! wikitext
17218 ==a==
17219 ==b== <!-- -->
17220 ==c==
17221 !! html/php
17222 ==a==
17223 !! end
17224
17225 !! test
17226 Section extraction test with comment after heading (section 2)
17227 !! options
17228 section=2
17229 !! wikitext
17230 ==a==
17231 ==b== <!-- -->
17232 ==c==
17233 !! html/php
17234 ==b== <!-- -->
17235 !! end
17236
17237 !! test
17238 Section extraction test with bogus <nowiki> heading (section 1)
17239 !! options
17240 section=1
17241 !! wikitext
17242 ==a==
17243 ==bogus== <nowiki>not a legal section</nowiki>
17244 ==b==
17245 !! html/php
17246 ==a==
17247 ==bogus== <nowiki>not a legal section</nowiki>
17248 !! end
17249
17250 !! test
17251 Section extraction test with bogus <nowiki> heading (section 2)
17252 !! options
17253 section=2
17254 !! wikitext
17255 ==a==
17256 ==bogus== <nowiki>not a legal section</nowiki>
17257 ==b==
17258 !! html/php
17259 ==b==
17260 !! end
17261
17262 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
17263 # instead of respecting commented sections
17264 !! test
17265 Section extraction prefixed by comment (section 1)
17266 !! options
17267 section=1
17268 !! wikitext
17269 <!-- -->==sec1==
17270 ==sec2==
17271 !! html/php
17272 ==sec2==
17273 !!end
17274
17275 !! test
17276 Section extraction prefixed by comment (section 2)
17277 !! options
17278 section=2
17279 !! wikitext
17280 <!-- -->==sec1==
17281 ==sec2==
17282 !! html/php
17283
17284 !!end
17285
17286 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
17287 # instead of respecting HTML-style headings
17288 !! test
17289 Section extraction, mixed wiki and html (section 1)
17290 !! options
17291 section=1
17292 !! wikitext
17293 <h2>unmarked</h2>
17294 unmarked
17295 ==1==
17296 one
17297 ==2==
17298 two
17299 !! html/php
17300 ==1==
17301 one
17302 !! end
17303
17304 !! test
17305 Section extraction, mixed wiki and html (section 2)
17306 !! options
17307 section=2
17308 !! wikitext
17309 <h2>unmarked</h2>
17310 unmarked
17311 ==1==
17312 one
17313 ==2==
17314 two
17315 !! html/php
17316 ==2==
17317 two
17318 !! end
17319
17320
17321 # Formerly testing for bug 3342
17322 !! test
17323 Section extraction, heading surrounded by <noinclude>
17324 !! options
17325 section=1
17326 !! wikitext
17327 <noinclude>==unmarked==</noinclude>
17328 ==marked==
17329 !! html/php
17330 ==marked==
17331 !!end
17332
17333 # Test behavior of bug 19910
17334 !! test
17335 Sectiion with all-equals
17336 !! options
17337 section=2
17338 !! wikitext
17339 ===
17340 The line above must have a trailing space
17341 === <!--
17342 --> <!-- -->
17343 But just in case it doesn't...
17344 !! html/php
17345 === <!--
17346 --> <!-- -->
17347 But just in case it doesn't...
17348 !! end
17349
17350 !! test
17351 Section replacement test (section 0)
17352 !! options
17353 replace=0,"xxx"
17354 !! wikitext
17355 start
17356 ==a==
17357 ===aa===
17358 ====aaa====
17359 ==b==
17360 ===ba===
17361 ===bb===
17362 ====bba====
17363 ===bc===
17364 ==c==
17365 ===ca===
17366 !! html/php
17367 xxx
17368
17369 ==a==
17370 ===aa===
17371 ====aaa====
17372 ==b==
17373 ===ba===
17374 ===bb===
17375 ====bba====
17376 ===bc===
17377 ==c==
17378 ===ca===
17379 !! end
17380
17381 !! test
17382 Section replacement test (section 1)
17383 !! options
17384 replace=1,"xxx"
17385 !! wikitext
17386 start
17387 ==a==
17388 ===aa===
17389 ====aaa====
17390 ==b==
17391 ===ba===
17392 ===bb===
17393 ====bba====
17394 ===bc===
17395 ==c==
17396 ===ca===
17397 !! html/php
17398 start
17399 xxx
17400
17401 ==b==
17402 ===ba===
17403 ===bb===
17404 ====bba====
17405 ===bc===
17406 ==c==
17407 ===ca===
17408 !! end
17409
17410 !! test
17411 Section replacement test (section 2)
17412 !! options
17413 replace=2,"xxx"
17414 !! wikitext
17415 start
17416 ==a==
17417 ===aa===
17418 ====aaa====
17419 ==b==
17420 ===ba===
17421 ===bb===
17422 ====bba====
17423 ===bc===
17424 ==c==
17425 ===ca===
17426 !! html/php
17427 start
17428 ==a==
17429 xxx
17430
17431 ==b==
17432 ===ba===
17433 ===bb===
17434 ====bba====
17435 ===bc===
17436 ==c==
17437 ===ca===
17438 !! end
17439
17440 !! test
17441 Section replacement test (section 3)
17442 !! options
17443 replace=3,"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 xxx
17461
17462 ==b==
17463 ===ba===
17464 ===bb===
17465 ====bba====
17466 ===bc===
17467 ==c==
17468 ===ca===
17469 !! end
17470
17471 !! test
17472 Section replacement test (section 4)
17473 !! options
17474 replace=4,"xxx"
17475 !! wikitext
17476 start
17477 ==a==
17478 ===aa===
17479 ====aaa====
17480 ==b==
17481 ===ba===
17482 ===bb===
17483 ====bba====
17484 ===bc===
17485 ==c==
17486 ===ca===
17487 !! html/php
17488 start
17489 ==a==
17490 ===aa===
17491 ====aaa====
17492 xxx
17493
17494 ==c==
17495 ===ca===
17496 !! end
17497
17498 !! test
17499 Section replacement test (section 5)
17500 !! options
17501 replace=5,"xxx"
17502 !! wikitext
17503 start
17504 ==a==
17505 ===aa===
17506 ====aaa====
17507 ==b==
17508 ===ba===
17509 ===bb===
17510 ====bba====
17511 ===bc===
17512 ==c==
17513 ===ca===
17514 !! html/php
17515 start
17516 ==a==
17517 ===aa===
17518 ====aaa====
17519 ==b==
17520 xxx
17521
17522 ===bb===
17523 ====bba====
17524 ===bc===
17525 ==c==
17526 ===ca===
17527 !! end
17528
17529 !! test
17530 Section replacement test (section 6)
17531 !! options
17532 replace=6,"xxx"
17533 !! wikitext
17534 start
17535 ==a==
17536 ===aa===
17537 ====aaa====
17538 ==b==
17539 ===ba===
17540 ===bb===
17541 ====bba====
17542 ===bc===
17543 ==c==
17544 ===ca===
17545 !! html/php
17546 start
17547 ==a==
17548 ===aa===
17549 ====aaa====
17550 ==b==
17551 ===ba===
17552 xxx
17553
17554 ===bc===
17555 ==c==
17556 ===ca===
17557 !! end
17558
17559 !! test
17560 Section replacement test (section 7)
17561 !! options
17562 replace=7,"xxx"
17563 !! wikitext
17564 start
17565 ==a==
17566 ===aa===
17567 ====aaa====
17568 ==b==
17569 ===ba===
17570 ===bb===
17571 ====bba====
17572 ===bc===
17573 ==c==
17574 ===ca===
17575 !! html/php
17576 start
17577 ==a==
17578 ===aa===
17579 ====aaa====
17580 ==b==
17581 ===ba===
17582 ===bb===
17583 xxx
17584
17585 ===bc===
17586 ==c==
17587 ===ca===
17588 !! end
17589
17590 !! test
17591 Section replacement test (section 8)
17592 !! options
17593 replace=8,"xxx"
17594 !! wikitext
17595 start
17596 ==a==
17597 ===aa===
17598 ====aaa====
17599 ==b==
17600 ===ba===
17601 ===bb===
17602 ====bba====
17603 ===bc===
17604 ==c==
17605 ===ca===
17606 !! html/php
17607 start
17608 ==a==
17609 ===aa===
17610 ====aaa====
17611 ==b==
17612 ===ba===
17613 ===bb===
17614 ====bba====
17615 xxx
17616
17617 ==c==
17618 ===ca===
17619 !!end
17620
17621 !! test
17622 Section replacement test (section 9)
17623 !! options
17624 replace=9,"xxx"
17625 !! wikitext
17626 start
17627 ==a==
17628 ===aa===
17629 ====aaa====
17630 ==b==
17631 ===ba===
17632 ===bb===
17633 ====bba====
17634 ===bc===
17635 ==c==
17636 ===ca===
17637 !! html/php
17638 start
17639 ==a==
17640 ===aa===
17641 ====aaa====
17642 ==b==
17643 ===ba===
17644 ===bb===
17645 ====bba====
17646 ===bc===
17647 xxx
17648 !! end
17649
17650 !! test
17651 Section replacement test (section 10)
17652 !! options
17653 replace=10,"xxx"
17654 !! wikitext
17655 start
17656 ==a==
17657 ===aa===
17658 ====aaa====
17659 ==b==
17660 ===ba===
17661 ===bb===
17662 ====bba====
17663 ===bc===
17664 ==c==
17665 ===ca===
17666 !! html/php
17667 start
17668 ==a==
17669 ===aa===
17670 ====aaa====
17671 ==b==
17672 ===ba===
17673 ===bb===
17674 ====bba====
17675 ===bc===
17676 ==c==
17677 xxx
17678 !! end
17679
17680 !! test
17681 Section replacement test with initial whitespace (bug 13728)
17682 !! options
17683 replace=2,"xxx"
17684 !! wikitext
17685 Preformatted initial line
17686 ==a==
17687 ===a===
17688 !! html/php
17689 Preformatted initial line
17690 ==a==
17691 xxx
17692 !! end
17693
17694
17695 !! test
17696 Section extraction, heading followed by pre with 20 spaces (bug 6398)
17697 !! options
17698 section=1
17699 !! wikitext
17700 ==a==
17701 a
17702 !! html/php
17703 ==a==
17704 a
17705 !! end
17706
17707 !! test
17708 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
17709 !! options
17710 section=1
17711 !! wikitext
17712 ==a==
17713 a
17714 !! html/php
17715 ==a==
17716 a
17717 !! end
17718
17719
17720 !! test
17721 Section extraction, <pre> around bogus header (bug 10309)
17722 !! options
17723 noxml section=2
17724 !! wikitext
17725 == Section One ==
17726 <pre>
17727 =======
17728 </pre>
17729
17730 == Section Two ==
17731 stuff
17732 !! html/php
17733 == Section Two ==
17734 stuff
17735 !! end
17736
17737 !! test
17738 Section replacement, <pre> around bogus header (bug 10309)
17739 !! options
17740 noxml replace=2,"xxx"
17741 !! wikitext
17742 == Section One ==
17743 <pre>
17744 =======
17745 </pre>
17746
17747 == Section Two ==
17748 stuff
17749 !! html/php
17750 == Section One ==
17751 <pre>
17752 =======
17753 </pre>
17754
17755 xxx
17756 !! end
17757
17758
17759 !! test
17760 Handling of &#x0A; in URLs
17761 !! wikitext
17762 ** irc://&#x0A;a
17763 !! html/php
17764 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17765
17766 !! html/parsoid
17767 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
17768 a">irc://
17769 a</a></li></ul></li></ul>
17770 !! end
17771
17772 !! test
17773 Handling of %0A in URLs
17774 !! wikitext
17775 ** irc://%0Aa
17776 !! html/php
17777 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17778
17779 !! html/parsoid
17780 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17781 !! end
17782
17783
17784 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
17785 !! test
17786 5 quotes, code coverage +1 line
17787 !! options
17788 parsoid=wt2html
17789 !! wikitext
17790 '''''
17791 !! html/php
17792 !! html/parsoid
17793 <p><b><i></i></b></p>
17794 !! end
17795
17796 # same html as previous, but wikitext adjusted to match parsoid html2wt
17797 # note that wt2html and html2html will put the <i> before the <b>
17798 !! test
17799 5 quotes, code coverage +1 line w/ nowiki (1)
17800 !! options
17801 parsoid=wt2wt,html2wt
17802 !! wikitext
17803 '''''<nowiki/>'''''
17804 !! html/php
17805 <p><i></i>
17806 </p>
17807 !! html/parsoid
17808 <p><b><i></i></b></p>
17809 !! end
17810
17811 # same as previous, just swapping the <i> and <b>
17812 !! test
17813 5 quotes, code coverage +1 line w/ nowiki (2)
17814 !! wikitext
17815 '''''<nowiki/>'''''
17816 !! html/php
17817 <p><i></i>
17818 </p>
17819 !! html/parsoid
17820 <p><i><b></b></i></p>
17821 !! end
17822
17823 !! test
17824 Special:Search page linking.
17825 !! wikitext
17826 {{Special:search}}
17827 !! html
17828 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
17829 </p>
17830 !! end
17831
17832 !! test
17833 {{!}} is a magic word
17834 !! wikitext
17835 {{!}} is a magic word there and {{!}} is still a magic word here
17836 !! html/php
17837 <p>| is a magic word there and | is still a magic word here
17838 </p>
17839 !! html/parsoid
17840 <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>
17841 !! end
17842
17843 !! test
17844 Say the magic word
17845 !! options
17846 title=[[Parser test]]
17847 !! wikitext
17848 * {{PAGENAME}}
17849 * {{PAGENAMEE}}
17850 * {{FULLPAGENAME}}
17851 * {{FULLPAGENAMEE}}
17852 * {{BASEPAGENAME}}
17853 * {{BASEPAGENAMEE}}
17854 * {{SUBPAGENAME}}
17855 * {{SUBPAGENAMEE}}
17856 * {{ROOTPAGENAME}}
17857 * {{ROOTPAGENAMEE}}
17858 * {{TALKPAGENAME}}
17859 * {{TALKPAGENAMEE}}
17860 * {{SUBJECTPAGENAME}}
17861 * {{SUBJECTPAGENAMEE}}
17862 * {{NAMESPACEE}}
17863 * {{NAMESPACE}}
17864 * {{NAMESPACENUMBER}}
17865 * {{TALKSPACE}}
17866 * {{TALKSPACEE}}
17867 * {{SUBJECTSPACE}}
17868 * {{SUBJECTSPACEE}}
17869 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
17870 !! html
17871 <ul><li> Parser test</li>
17872 <li> Parser_test</li>
17873 <li> Parser test</li>
17874 <li> Parser_test</li>
17875 <li> Parser test</li>
17876 <li> Parser_test</li>
17877 <li> Parser test</li>
17878 <li> Parser_test</li>
17879 <li> Parser test</li>
17880 <li> Parser_test</li>
17881 <li> Talk:Parser test</li>
17882 <li> Talk:Parser_test</li>
17883 <li> Parser test</li>
17884 <li> Parser_test</li>
17885 <li> </li>
17886 <li> </li>
17887 <li> 0</li>
17888 <li> Talk</li>
17889 <li> Talk</li>
17890 <li> </li>
17891 <li> </li>
17892 <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>
17893
17894 !! end
17895 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
17896
17897 !! test
17898 Gallery
17899 !! wikitext
17900 <gallery>
17901 image1.png |
17902 image2.gif|||||
17903
17904 image3|
17905 image4 |300px| centre
17906 image5.svg| http://///////
17907 [[x|xx]]]]
17908 * image6
17909 </gallery>
17910 !! html
17911 <ul class="gallery mw-gallery-traditional">
17912 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17913 <div class="thumb" style="height: 150px;">Image1.png</div>
17914 <div class="gallerytext">
17915 </div>
17916 </div></li>
17917 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17918 <div class="thumb" style="height: 150px;">Image2.gif</div>
17919 <div class="gallerytext">
17920 <p>||||
17921 </p>
17922 </div>
17923 </div></li>
17924 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17925 <div class="thumb" style="height: 150px;">Image3</div>
17926 <div class="gallerytext">
17927 </div>
17928 </div></li>
17929 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17930 <div class="thumb" style="height: 150px;">Image4</div>
17931 <div class="gallerytext">
17932 <p>300px| centre
17933 </p>
17934 </div>
17935 </div></li>
17936 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17937 <div class="thumb" style="height: 150px;">Image5.svg</div>
17938 <div class="gallerytext">
17939 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
17940 </p>
17941 </div>
17942 </div></li>
17943 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17944 <div class="thumb" style="height: 150px;">* image6</div>
17945 <div class="gallerytext">
17946 </div>
17947 </div></li>
17948 </ul>
17949
17950 !! end
17951
17952 !! test
17953 Gallery (with options)
17954 !! wikitext
17955 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
17956 File:Nonexistent.jpg|caption
17957 File:Nonexistent.jpg
17958 image:foobar.jpg|some '''caption''' [[Main Page]]
17959 image:foobar.jpg
17960 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
17961 </gallery>
17962 !! html
17963 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
17964 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
17965 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17966 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
17967 <div class="gallerytext">
17968 <p>caption
17969 </p>
17970 </div>
17971 </div></li>
17972 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17973 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
17974 <div class="gallerytext">
17975 </div>
17976 </div></li>
17977 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17978 <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>
17979 <div class="gallerytext">
17980 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17981 </p>
17982 </div>
17983 </div></li>
17984 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17985 <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>
17986 <div class="gallerytext">
17987 </div>
17988 </div></li>
17989 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17990 <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>
17991 <div class="gallerytext">
17992 <p>Blabla|blabla.
17993 </p>
17994 </div>
17995 </div></li>
17996 </ul>
17997
17998 !! end
17999
18000 !! test
18001 Gallery with link that has fragment
18002 !! wikitext
18003 <gallery>
18004 image:foobar.jpg|link=Main_Page
18005 image:foobar.jpg|link=Main_Page#section
18006 image:foobar.jpg|link=Main Page#section|caption
18007 </gallery>
18008 !! html
18009 <ul class="gallery mw-gallery-traditional">
18010 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18011 <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>
18012 <div class="gallerytext">
18013 </div>
18014 </div></li>
18015 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18016 <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>
18017 <div class="gallerytext">
18018 </div>
18019 </div></li>
18020 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18021 <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>
18022 <div class="gallerytext">
18023 <p>caption
18024 </p>
18025 </div>
18026 </div></li>
18027 </ul>
18028
18029 !! end
18030
18031 !! test
18032 Gallery with wikitext inside caption
18033 !! wikitext
18034 <gallery>
18035 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
18036 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
18037 </gallery>
18038 !! html
18039 <ul class="gallery mw-gallery-traditional">
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="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>
18042 <div class="gallerytext">
18043 <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>
18044 </p>
18045 </div>
18046 </div></li>
18047 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18048 <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>
18049 <div class="gallerytext">
18050 <p>This is a test template
18051 </p>
18052 </div>
18053 </div></li>
18054 </ul>
18055
18056 !! end
18057
18058 !! test
18059 gallery (with showfilename option)
18060 !! wikitext
18061 <gallery showfilename>
18062 File:Nonexistent.jpg|caption
18063 File:Nonexistent.jpg
18064 image:foobar.jpg|some '''caption''' [[Main Page]]
18065 File:Foobar.jpg
18066 </gallery>
18067 !! html
18068 <ul class="gallery mw-gallery-traditional">
18069 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18070 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18071 <div class="gallerytext">
18072 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18073 caption
18074 </p>
18075 </div>
18076 </div></li>
18077 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18078 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18079 <div class="gallerytext">
18080 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18081 </p>
18082 </div>
18083 </div></li>
18084 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18085 <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>
18086 <div class="gallerytext">
18087 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18088 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18089 </p>
18090 </div>
18091 </div></li>
18092 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18093 <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>
18094 <div class="gallerytext">
18095 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18096 </p>
18097 </div>
18098 </div></li>
18099 </ul>
18100
18101 !! end
18102
18103 !! test
18104 Gallery (with namespace-less filenames)
18105 !! wikitext
18106 <gallery>
18107 File:Nonexistent.jpg
18108 Nonexistent.jpg
18109 image:foobar.jpg
18110 foobar.jpg
18111 </gallery>
18112 !! html
18113 <ul class="gallery mw-gallery-traditional">
18114 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18115 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18116 <div class="gallerytext">
18117 </div>
18118 </div></li>
18119 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18120 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18121 <div class="gallerytext">
18122 </div>
18123 </div></li>
18124 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18125 <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>
18126 <div class="gallerytext">
18127 </div>
18128 </div></li>
18129 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18130 <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>
18131 <div class="gallerytext">
18132 </div>
18133 </div></li>
18134 </ul>
18135
18136 !! end
18137
18138 !! test
18139 HTML Hex character encoding (spells the word "JavaScript")
18140 !! options
18141 parsoid=wt2html,wt2wt,html2html
18142 !! wikitext
18143 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
18144 !! html/php
18145 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
18146 </p>
18147 !! html/php+tidy
18148 <p>JavaScript</p>
18149 !! html/parsoid
18150 <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>
18151 !! end
18152
18153 !! test
18154 HTML Hex character encoding bogus encoding (bug 26437 regression check)
18155 !! wikitext
18156 &#xsee;&#XSEE;
18157 !! html/php
18158 <p>&amp;#xsee;&amp;#XSEE;
18159 </p>
18160 !! html/parsoid
18161 <p>&amp;#xsee;&amp;#XSEE;</p>
18162 !! end
18163
18164 !! test
18165 HTML Hex character encoding mixed case
18166 !! options
18167 parsoid=wt2html,wt2wt,html2html
18168 !! wikitext
18169 &#xEE;&#Xee;
18170 !! html/php
18171 <p>&#xee;&#xee;
18172 </p>
18173 !! html/php+tidy
18174 <p>îî</p>
18175 !! html/parsoid
18176 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
18177 !! end
18178
18179 # See: http://www.w3.org/TR/html5/syntax.html#character-references
18180 # Note that U+000C (form feed) is not a valid XML character, so
18181 # it is banned even though allowed in HTML5.
18182 !! test
18183 Illegal character references (T106578)
18184 !! wikitext
18185 ; Null: &#00;
18186 ; FF: &#xC;
18187 ; CR: &#xD;
18188 ; Control (low): &#8;
18189 ; Control (high): &#x7F; &#x9F;
18190 ; Surrogate: &#xD83D;&#xDCA9;
18191 ; This is an okay astral character: &#x1F4A9;
18192 !! html+tidy
18193 <dl>
18194 <dt>Null</dt>
18195 <dd>&amp;#00;</dd>
18196 <dt>FF</dt>
18197 <dd>&amp;#xC;</dd>
18198 <dt>CR</dt>
18199 <dd>&amp;#xD;</dd>
18200 <dt>Control (low)</dt>
18201 <dd>&amp;#8;</dd>
18202 <dt>Control (high)</dt>
18203 <dd>&amp;#x7F; &amp;#x9F;</dd>
18204 <dt>Surrogate</dt>
18205 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
18206 <dt>This is an okay astral character</dt>
18207 <dd>💩</dd>
18208 </dl>
18209 !! end
18210
18211 !! test
18212 __FORCETOC__ override
18213 !! wikitext
18214 __NEWSECTIONLINK__
18215 __FORCETOC__
18216 !! html/php
18217 <p><br />
18218 </p>
18219 !! end
18220
18221 !! test
18222 ISBN code coverage
18223 !! wikitext
18224 ISBN 978-0-1234-56&#x20;789
18225 !! html
18226 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
18227 </p>
18228 !! html+tidy
18229 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
18230 !! html/parsoid
18231 <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>
18232 !! end
18233
18234 !! test
18235 ISBN followed by 5 spaces
18236 !! wikitext
18237 ISBN
18238 !! html
18239 <p>ISBN
18240 </p>
18241 !! end
18242
18243 !! test
18244 Double ISBN
18245 !! wikitext
18246 ISBN ISBN 1234567890
18247 !! html/php
18248 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18249 </p>
18250 !! html/parsoid
18251 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
18252 !! end
18253
18254 # Uppercase X and lowercase x as well
18255 !! test
18256 ISBN with an X
18257 !! wikitext
18258 ISBN 3-462-04561-X
18259 ISBN 3-462-04561-x
18260 ISBN 080442957X
18261 ISBN 080442957x
18262 ISBN 978080442957X
18263 ISBN 978080442957x
18264 !! html/php
18265 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
18266 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
18267 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
18268 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
18269 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
18270 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
18271 </p>
18272 !! html/parsoid
18273 <p><a href="./Special:BookSources/346204561X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
18274 <a href="./Special:BookSources/346204561X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
18275 <a href="./Special:BookSources/080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
18276 <a href="./Special:BookSources/080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
18277 <a href="./Special:BookSources/978080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
18278 <a href="./Special:BookSources/978080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
18279 !! end
18280
18281 !! test
18282 ISBN with empty prefix (parsoid test)
18283 !! wikitext
18284 ISBN 1234567890
18285 !! html/php
18286 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18287 </p>
18288 !! html/parsoid
18289 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
18290 !! end
18291
18292 !! test
18293 Bug 22905: <abbr> followed by ISBN followed by </a>
18294 !! wikitext
18295 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
18296 !! html/php
18297 <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>
18298 </p>
18299 !! html/parsoid
18300 <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>
18301 !! end
18302
18303 !! test
18304 Double RFC
18305 !! wikitext
18306 RFC RFC 1234
18307 !! html
18308 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
18309 </p>
18310 !! end
18311
18312 !! test
18313 Double RFC with a wiki link
18314 !! wikitext
18315 RFC [[RFC 1234]]
18316 !! html
18317 <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>
18318 </p>
18319 !! end
18320
18321 !! test
18322 RFC code coverage
18323 !! wikitext
18324 RFC 983&#x20;987
18325 !! html
18326 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
18327 </p>
18328 !! html+tidy
18329 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
18330 !! end
18331
18332 !! test
18333 Centre-aligned image
18334 !! wikitext
18335 [[Image:foobar.jpg|centre]]
18336 !! html
18337 <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>
18338
18339 !!end
18340
18341 !! test
18342 None-aligned image
18343 !! wikitext
18344 [[Image:foobar.jpg|none]]
18345 !! html
18346 <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>
18347
18348 !!end
18349
18350 !! test
18351 Width + Height sized image (using px) (height is ignored)
18352 !! wikitext
18353 [[Image:foobar.jpg|640x480px]]
18354 !! html
18355 <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>
18356 </p>
18357 !!end
18358
18359 !! test
18360 Width-sized image (using px, no following whitespace)
18361 !! wikitext
18362 [[Image:foobar.jpg|640px]]
18363 !! html
18364 <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>
18365 </p>
18366 !!end
18367
18368 !! test
18369 Width-sized image (using px, with following whitespace - test regression from r39467)
18370 !! wikitext
18371 [[Image:foobar.jpg|640px ]]
18372 !! html
18373 <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>
18374 </p>
18375 !!end
18376
18377 !! test
18378 Width-sized image (using px, with preceding whitespace - test regression from r39467)
18379 !! wikitext
18380 [[Image:foobar.jpg| 640px]]
18381 !! html
18382 <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>
18383 </p>
18384 !!end
18385
18386 !! test
18387 Image with page parameter
18388 !! options
18389 djvu
18390 !! wikitext
18391 [[File:LoremIpsum.djvu|page=2]]
18392 !! html/php
18393 <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>
18394 </p>
18395 !! html/parsoid
18396 <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>
18397 !! end
18398
18399 !! test
18400 Another italics / bold test
18401 !! wikitext
18402 ''' ''x'
18403 !! html
18404 <pre>'<i> </i>x'
18405 </pre>
18406 !!end
18407
18408 # FIXME: The php output seems broken. It's interleaving some open/close tags.
18409 !! test
18410 dt/dd/dl test
18411 !! wikitext
18412 :;;;::
18413 !! html/php
18414 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
18415
18416 !! html/parsoid
18417 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
18418
18419 !!end
18420
18421
18422 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
18423 !! test
18424 Images with the "|" character in the comment
18425 !! wikitext
18426 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
18427 !! html/php
18428 <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>
18429
18430 !! html/parsoid
18431 <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>
18432 !! end
18433
18434 !! test
18435 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
18436 !! wikitext
18437 <html><script>alert(1);</script></html>
18438 !! html
18439 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
18440 </p>
18441 !! end
18442
18443 !! test
18444 HTML with raw HTML ($wgRawHtml==true)
18445 !! options
18446 wgRawHtml=1
18447 !! wikitext
18448 <html><script>alert(1);</script></html>
18449 !! html
18450 <p><script>alert(1);</script>
18451 </p>
18452 !! end
18453
18454 !! test
18455 Parents of subpages, one level up
18456 !! options
18457 subpage title=[[Subpage test/L1/L2/L3]]
18458 !! wikitext
18459 [[../|L2]]
18460 !! html
18461 <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>
18462 </p>
18463 !! end
18464
18465
18466 !! test
18467 Parents of subpages, one level up, not named
18468 !! options
18469 subpage title=[[Subpage test/L1/L2/L3]]
18470 !! wikitext
18471 [[../]]
18472 !! html
18473 <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>
18474 </p>
18475 !! end
18476
18477
18478
18479 !! test
18480 Parents of subpages, two levels up
18481 !! options
18482 subpage title=[[Subpage test/L1/L2/L3]]
18483 !! wikitext
18484 [[../../|L1]]2
18485
18486 [[../../|L1]]l
18487 !! html
18488 <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
18489 </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>
18490 </p>
18491 !! end
18492
18493 !! test
18494 Parents of subpages, two levels up, without trailing slash or name.
18495 !! options
18496 subpage title=[[Subpage test/L1/L2/L3]]
18497 !! wikitext
18498 [[../..]]
18499 !! html
18500 <p>[[../..]]
18501 </p>
18502 !! end
18503
18504 !! test
18505 Parents of subpages, two levels up, with lots of extra trailing slashes.
18506 !! options
18507 subpage title=[[Subpage test/L1/L2/L3]]
18508 !! wikitext
18509 [[../../////]]
18510 !! html
18511 <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>
18512 </p>
18513 !! end
18514
18515 !! article
18516 Subpage test/L1/L2/L3Sibling
18517 !! text
18518 Sibling article
18519 !! endarticle
18520
18521 !! test
18522 Transclusion of a sibling page (one level up)
18523 !! options
18524 subpage title=[[Subpage test/L1/L2/L3]]
18525 !! wikitext
18526 {{../L3Sibling}}
18527 !! html
18528 <p>Sibling article
18529 </p>
18530 !! end
18531
18532 !! test
18533 Transclusion of a child page
18534 !! options
18535 subpage title=[[Subpage test/L1/L2]]
18536 !! wikitext
18537 {{/L3Sibling}}
18538 !! html
18539 <p>Sibling article
18540 </p>
18541 !! end
18542
18543 !! test
18544 Non-transclusion because of too many up levels
18545 !! options
18546 subpage title=[[Subpage test/L1/L2/L3]]
18547 !! wikitext
18548 {{../../../../More than parent}}
18549 !! html
18550 <p>{{../../../../More than parent}}
18551 </p>
18552 !! end
18553
18554 !! test
18555 Definition list code coverage
18556 !! wikitext
18557 ; title : def
18558 ; title : def
18559 ;title: def
18560 !! html/php
18561 <dl><dt> title &#160;</dt>
18562 <dd> def</dd>
18563 <dt> title&#160;</dt>
18564 <dd> def</dd>
18565 <dt>title</dt>
18566 <dd> def</dd></dl>
18567
18568 !! html/parsoid
18569 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18570 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18571 <dt>title</dt><dd> def</dd></dl>
18572 !! end
18573
18574 !! test
18575 Don't fall for the self-closing div
18576 !! wikitext
18577 <div>hello world</div/>
18578 !! html
18579 <div>hello world</div>
18580
18581 !! end
18582
18583 !! test
18584 MSGNW magic word
18585 !! wikitext
18586 {{MSGNW:msg}}
18587 !! html/php
18588 <p>&#91;&#91;:Template:Msg&#93;&#93;
18589 </p>
18590 !! end
18591
18592 !! test
18593 RAW magic word
18594 !! wikitext
18595 {{RAW:QUERTY}}
18596 !! html
18597 <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>
18598 </p>
18599 !! end
18600
18601 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
18602 !! test
18603 Always escape literal '>' in output, not just after '<'
18604 !! wikitext
18605 ><>
18606 !! html
18607 <p>&gt;&lt;&gt;
18608 </p>
18609 !! end
18610
18611 !! test
18612 Template caching
18613 !! wikitext
18614 {{Test}}
18615 {{Test}}
18616 !! html
18617 <p>This is a test template
18618 This is a test template
18619 </p>
18620 !! end
18621
18622
18623 !! article
18624 MediaWiki:Fake
18625 !! text
18626 ==header==
18627 !! endarticle
18628
18629 !! test
18630 Inclusion of !userCanEdit() content
18631 !! wikitext
18632 {{MediaWiki:Fake}}
18633 !! html
18634 <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>
18635
18636 !! end
18637
18638
18639 !! test
18640 Out-of-order TOC heading levels
18641 !! wikitext
18642 ==2==
18643 ======6======
18644 ===3===
18645 =1=
18646 =====5=====
18647 ==2==
18648 !! html
18649 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18650 <ul>
18651 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
18652 <ul>
18653 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
18654 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
18655 </ul>
18656 </li>
18657 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
18658 <ul>
18659 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
18660 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
18661 </ul>
18662 </li>
18663 </ul>
18664 </div>
18665
18666 <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>
18667 <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>
18668 <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>
18669 <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>
18670 <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>
18671 <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>
18672
18673 !! end
18674
18675
18676 !! test
18677 ISBN with a dummy number
18678 !! wikitext
18679 ISBN ---
18680 !! html
18681 <p>ISBN ---
18682 </p>
18683 !! end
18684
18685
18686 !! test
18687 ISBN with space-delimited number
18688 !! wikitext
18689 ISBN 92 9017 032 8
18690 !! html
18691 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
18692 </p>
18693 !! end
18694
18695
18696 !! test
18697 ISBN with multiple spaces, no number
18698 !! wikitext
18699 ISBN foo
18700 !! html
18701 <p>ISBN foo
18702 </p>
18703 !! end
18704
18705
18706 !! test
18707 ISBN length
18708 !! wikitext
18709 ISBN 123456789
18710
18711 ISBN 1234567890
18712
18713 ISBN 12345678901
18714 !! html
18715 <p>ISBN 123456789
18716 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18717 </p><p>ISBN 12345678901
18718 </p>
18719 !! end
18720
18721
18722 !! test
18723 ISBN with trailing year (bug 8110)
18724 !! wikitext
18725 ISBN 1-234-56789-0 - 2006
18726
18727 ISBN 1 234 56789 0 - 2006
18728 !! html
18729 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
18730 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
18731 </p>
18732 !! end
18733
18734
18735 !! test
18736 anchorencode
18737 !! wikitext
18738 {{anchorencode:foo bar©#%n}}
18739 !! html
18740 <p>foo_bar.C2.A9.23.25n
18741 </p>
18742 !! end
18743
18744 !! test
18745 anchorencode trims spaces
18746 !! wikitext
18747 {{anchorencode: __pretty__please__}}
18748 !! html
18749 <p>pretty_please
18750 </p>
18751 !! end
18752
18753 !! test
18754 anchorencode deals with links
18755 !! wikitext
18756 {{anchorencode: [[hello|world]] [[hi]]}}
18757 !! html
18758 <p>world_hi
18759 </p>
18760 !! end
18761
18762 !! test
18763 anchorencode deals with templates
18764 !! wikitext
18765 {{anchorencode: {{Foo}} }}
18766 !! html
18767 <p>FOO
18768 </p>
18769 !! end
18770
18771 !! test
18772 anchorencode encodes like the TOC generator: (bug 18431)
18773 !! wikitext
18774 === _ +:.3A%3A&&amp;]] ===
18775 {{anchorencode: _ +:.3A%3A&&amp;]] }}
18776 __NOEDITSECTION__
18777 !! html
18778 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
18779 <p>.2B:.3A.253A.26.26.5D.5D
18780 </p>
18781 !! end
18782
18783 !! test
18784 Bug 6200: blockquotes and paragraph formatting
18785 !! wikitext
18786 <blockquote>
18787 foo
18788 </blockquote>
18789
18790 bar
18791
18792 baz
18793 !! html
18794 <blockquote>
18795 <p>foo
18796 </p>
18797 </blockquote>
18798 <p>bar
18799 </p>
18800 <pre>baz
18801 </pre>
18802 !! end
18803
18804 !! test
18805 Bug 8293: Use of center tag ruins paragraph formatting
18806 !! wikitext
18807 <center>
18808 foo
18809 </center>
18810
18811 bar
18812
18813 baz
18814 !! html
18815 <center>
18816 <p>foo
18817 </p>
18818 </center>
18819 <p>bar
18820 </p>
18821 <pre>baz
18822 </pre>
18823 !! end
18824
18825 !!test
18826 Parsing of overlapping (improperly nested) inline html tags
18827 !! wikitext
18828 <span><s>x</span></s>
18829 !! html/php
18830 <p><span><s>x&lt;/span&gt;</s></span>
18831 </p>
18832 !! html/parsoid
18833 <p><span><s>x</s></span>
18834 </p>
18835 !!end
18836
18837 ###
18838 ### Language variants related tests
18839 ###
18840 !! test
18841 Self-link in language variants
18842 !! options
18843 title=[[Dunav]] language=sr
18844 !! wikitext
18845 Both [[Dunav]] and [[Дунав]] are names for this river.
18846 !! html
18847 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
18848 </p>
18849 !!end
18850
18851 !! article
18852 Дуна
18853 !! text
18854 content
18855 !! endarticle
18856
18857 !! test
18858 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
18859 !! options
18860 title=[[Duna]] language=sr
18861 !! wikitext
18862 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
18863 !! html
18864 <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.
18865 </p>
18866 !! end
18867
18868 !! test
18869 Link to a section of a variant of this title shouldn't be parsed as self-link
18870 !! options
18871 title=[[Duna]] language=sr
18872 !! wikitext
18873 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
18874 !! html
18875 <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.
18876 </p>
18877 !! end
18878
18879 !! test
18880 Link to pages in language variants
18881 !! options
18882 language=sr
18883 !! wikitext
18884 Main Page can be written as [[Маин Паге]]
18885 !! html
18886 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
18887 </p>
18888 !!end
18889
18890
18891 !! test
18892 Multiple links to pages in language variants
18893 !! options
18894 language=sr
18895 !! wikitext
18896 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
18897 !! html
18898 <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>.
18899 </p>
18900 !!end
18901
18902
18903 !! test
18904 Simple template in language variants
18905 !! options
18906 language=sr
18907 !! wikitext
18908 {{тест}}
18909 !! html
18910 <p>This is a test template
18911 </p>
18912 !! end
18913
18914
18915 !! test
18916 Template with explicit namespace in language variants
18917 !! options
18918 language=sr
18919 !! wikitext
18920 {{Template:тест}}
18921 !! html
18922 <p>This is a test template
18923 </p>
18924 !! end
18925
18926
18927 !! test
18928 Basic test for template parameter in language variants
18929 !! options
18930 language=sr
18931 !! wikitext
18932 {{парамтест|param=foo}}
18933 !! html
18934 <p>This is a test template with parameter foo
18935 </p>
18936 !! end
18937
18938
18939 !! test
18940 Simple category in language variants
18941 !! options
18942 language=sr cat
18943 !! wikitext
18944 [[Category:МедиаWики Усер'с Гуиде]]
18945 !! html
18946 <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>
18947 !! end
18948
18949
18950 !! article
18951 Category:分类
18952 !! text
18953 blah
18954 !! endarticle
18955
18956 !! article
18957 Category:分類
18958 !! text
18959 blah
18960 !! endarticle
18961
18962 !! test
18963 Don't convert blue categorylinks to another variant (bug 33210)
18964 !! options
18965 language=zh cat
18966 !! wikitext
18967 [[A]][[Category:分类]]
18968 !! html
18969 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
18970 !! end
18971
18972
18973 !! test
18974 Stripping -{}- tags (language variants)
18975 !! options
18976 language=sr
18977 !! wikitext
18978 Latin proverb: -{Ne nuntium necare}-
18979 !! html
18980 <p>Latin proverb: Ne nuntium necare
18981 </p>
18982 !! end
18983
18984
18985 !! test
18986 Prevent conversion with -{}- tags (language variants)
18987 !! options
18988 language=sr variant=sr-ec
18989 !! wikitext
18990 Latinski: -{Ne nuntium necare}-
18991 !! html
18992 <p>Латински: Ne nuntium necare
18993 </p>
18994 !! end
18995
18996
18997 !! test
18998 Prevent conversion of text with -{}- tags (language variants)
18999 !! options
19000 language=sr variant=sr-ec
19001 !! wikitext
19002 Latinski: -{Ne nuntium necare}-
19003 !! html
19004 <p>Латински: Ne nuntium necare
19005 </p>
19006 !! end
19007
19008
19009 !! test
19010 Prevent conversion of links with -{}- tags (language variants)
19011 !! options
19012 language=sr variant=sr-ec
19013 !! wikitext
19014 -{[[Main Page]]}-
19015 !! html
19016 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19017 </p>
19018 !! end
19019
19020
19021 !! test
19022 -{}- tags within headlines (within html for parserConvert())
19023 !! options
19024 language=sr variant=sr-ec
19025 !! wikitext
19026 == -{Naslov}- ==
19027 !! html
19028 <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>
19029
19030 !! end
19031
19032
19033 !! test
19034 Explicit definition of language variant alternatives
19035 !! options
19036 language=zh variant=zh-tw
19037 !! wikitext
19038 -{zh:China;zh-tw:Taiwan}-, not China
19039 !! html
19040 <p>Taiwan, not China
19041 </p>
19042 !! end
19043
19044
19045 !! test
19046 Conversion around HTML tags
19047 !! options
19048 language=sr variant=sr-ec
19049 !! wikitext
19050 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
19051 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
19052 !! html
19053 <p>
19054 <span title="ЛаCтин">ски</span>
19055 </p>
19056 !! end
19057
19058
19059 !! test
19060 Explicit session-wise language variant mapping (A flag and - flag)
19061 !! options
19062 language=zh variant=zh-tw
19063 !! wikitext
19064 Taiwan is not China.
19065 But -{A|zh:China;zh-tw:Taiwan}- is China,
19066 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
19067 and -{China}- is China.
19068 !! html
19069 <p>Taiwan is not China.
19070 But Taiwan is Taiwan,
19071 (This should be stripped!)
19072 and China is China.
19073 </p>
19074 !! end
19075
19076 !! test
19077 Explicit session-wise language variant mapping (H flag for hide)
19078 !! options
19079 language=zh variant=zh-tw
19080 !! wikitext
19081 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
19082 Taiwan is China.
19083 !! html
19084 <p>(This should be stripped!)
19085 Taiwan is Taiwan.
19086 </p>
19087 !! end
19088
19089 !! test
19090 Adding explicit conversion rule for title (T flag)
19091 !! options
19092 language=zh variant=zh-tw showtitle
19093 !! wikitext
19094 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19095 !! html
19096 Taiwan
19097 <p>Should be stripped!
19098 </p>
19099 !! end
19100
19101 !! test
19102 Testing that changing the language variant here in the tests actually works
19103 !! options
19104 language=zh variant=zh showtitle
19105 !! wikitext
19106 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19107 !! html
19108 China
19109 <p>Should be stripped!
19110 </p>
19111 !! end
19112
19113 !! test
19114 Recursive conversion of alt and title attrs shouldn't clear converter state
19115 !! options
19116 language=zh variant=zh-cn showtitle
19117 !! wikitext
19118 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
19119 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
19120 !! html
19121 China
19122 <p>
19123 Should be stripped<span title="Exclamation">!</span>
19124 </p>
19125 !! end
19126
19127 !! test
19128 Bug 24072: more test on conversion rule for title
19129 !! options
19130 language=zh variant=zh-tw showtitle
19131 !! wikitext
19132 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19133 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
19134 !! html
19135 Taiwan
19136 <p>This should be stripped!
19137 This won't take interferes with the title rule.
19138 </p>
19139 !! end
19140
19141 !! test
19142 Partly disable title conversion if variant == main language code
19143 !! options
19144 language=zh variant=zh title=[[ZH]] showtitle
19145 !! wikitext
19146 -{T|zh-cn:CN;zh-tw:TW}-
19147 !! html
19148 ZH
19149 <p>
19150 </p>
19151 !! end
19152
19153 !! test
19154 Partly disable title conversion if variant == main language code, more
19155 !! options
19156 language=zh variant=zh title=[[ZH]] showtitle
19157 !! wikitext
19158 -{T|TW}-
19159 !! html
19160 ZH
19161 <p>
19162 </p>
19163 !! end
19164
19165 !! test
19166 Raw output of variant escape tags (R flag)
19167 !! options
19168 language=zh variant=zh-tw
19169 !! wikitext
19170 Raw: -{R|zh:China;zh-tw:Taiwan}-
19171 !! html
19172 <p>Raw: zh:China;zh-tw:Taiwan
19173 </p>
19174 !! end
19175
19176 !! test
19177 Strings evaluating false shouldn't be ignored by Language converter (T51072)
19178 !! options
19179 language=zh variant=zh-cn
19180 !! input
19181 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
19182 !! result
19183 <p>0
19184 </p>
19185 !! end
19186
19187 !! test
19188 Conversion rules from [numeric-only string] to [something else] (T48634)
19189 !! options
19190 language=zh variant=zh-cn
19191 !! input
19192 -{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
19193 !! result
19194 <p>D12345EE12345
19195 </p>
19196 !! end
19197
19198 !! test
19199 Bidirectional converter rule entries with an empty value should be ignored (T53551)
19200 !! options
19201 language=zh variant=zh-cn
19202 !! input
19203 -{H|zh-cn:foo;zh-tw:;}-foobar
19204 !! result
19205 <p>foobar
19206 </p>
19207 !! end
19208
19209 !! test
19210 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
19211 !! options
19212 language=zh variant=zh-cn
19213 !! input
19214 -{H|=>zh-cn:foo;}-foobar
19215 !! result
19216 <p>foobar
19217 </p>
19218 !! end
19219
19220 !! test
19221 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
19222 !! options
19223 language=zh variant=zh-cn
19224 !! input
19225 -{H|}-foobar
19226 !! result
19227 <p>foobar
19228 </p>
19229 !! end
19230
19231 !! test
19232 Nested using of manual convert syntax
19233 !! options
19234 language=zh variant=zh-hk
19235 !! wikitext
19236 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
19237 !! html
19238 <p>Nested: Hello Hong Kong!
19239 </p>
19240 !! end
19241
19242 !! test
19243 Proper conversion of text in external links
19244 !! options
19245 language=sr variant=sr-ec
19246 !! wikitext
19247 http://www.google.com
19248 gopher://www.google.com
19249 [http://www.google.com http://www.google.com]
19250 [gopher://www.google.com gopher://www.google.com]
19251 [https://www.google.com irc://www.google.com]
19252 [ftp://www.google.com www.google.com/ftp://dir]
19253 [//www.google.com www.google.com]
19254 !! html
19255 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19256 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19257 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19258 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19259 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
19260 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
19261 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
19262 </p>
19263 !! end
19264
19265 !! test
19266 Do not convert roman numbers to language variants
19267 !! options
19268 language=sr variant=sr-ec
19269 !! wikitext
19270 Fridrih IV je car.
19271 !! html
19272 <p>Фридрих IV је цар.
19273 </p>
19274 !! end
19275
19276 !! test
19277 Unclosed language converter markup "-{"
19278 !! options
19279 language=sr
19280 !! wikitext
19281 -{T|hello
19282 !! html
19283 <p>-{T|hello
19284 </p>
19285 !! end
19286
19287 !! test
19288 Don't convert raw rule "-{R|=&gt;}-" to "=>"
19289 !! options
19290 language=sr
19291 !! wikitext
19292 -{R|=&gt;}-
19293 !! html
19294 <p>=&gt;
19295 </p>
19296 !!end
19297
19298 !! test
19299 Don't break link parsing if language converter markup is in the caption.
19300 !! options
19301 language=sr variant=sr-ec
19302 !! wikitext
19303 [[Main Page|-{R|main page}-]]
19304 !! html
19305 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
19306 </p>
19307 !! end
19308
19309 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19310 !! test
19311 Don't break image parsing if language converter markup is in the caption.
19312 !! options
19313 language=sr
19314 !! wikitext
19315 [[File:Foobar.jpg|-{R|caption}-]]
19316 !! html/parsoid
19317 <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>
19318 </p>
19319 !! end
19320
19321 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19322 !! test
19323 Don't break list handling if language converter markup is in the item.
19324 !! options
19325 language=zh variant=zh-cn
19326 !! wikitext
19327 ;-{zh-cn:AAA;zh-tw:BBB}-
19328 !! html/php
19329 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
19330
19331 !! html/parsoid
19332 <dl><dt>AAA
19333 </dt></dl>
19334 !! end
19335
19336 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19337 !! test
19338 Don't break table handling if language converter markup is in the cell.
19339 !! options
19340 language=sr variant=sr-ec
19341 !! wikitext
19342 {|
19343 |-
19344 | -{R|B}-
19345 |}
19346 !! html/php
19347 <table>
19348
19349 <tr>
19350 <td>Б}-
19351 </td></tr></table>
19352
19353 !! html/parsoid
19354 <table>
19355
19356 <tr>
19357 <td> B
19358 </td></tr></table>
19359
19360 !! end
19361
19362 !! test
19363 Bug 529: Uncovered bullet
19364 !! wikitext
19365 * Foo {{bullet}}
19366 !! html
19367 <ul><li> Foo </li>
19368 <li> Bar</li></ul>
19369
19370 !! end
19371
19372 # Plain MediaWiki does not remove empty lists, but tidy actually does.
19373 # Templates in Wikipedia rely on this behavior, as tidy has always been
19374 # enabled there. These tests are normally run *without* tidy, so specify the
19375 # full output here.
19376 # To test realistic parsing behavior, apply a tidy-like transformation to both
19377 # the expected output and your parser's output.
19378 !! test
19379 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
19380 !! wikitext
19381 ******* Foo {{bullet}}
19382 !! html
19383 <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>
19384 <li> Bar</li></ul>
19385
19386 !! end
19387
19388 !! test
19389 Bug 529: Uncovered table already at line-start
19390 !! wikitext
19391 x
19392
19393 {{table}}
19394 y
19395 !! html
19396 <p>x
19397 </p>
19398 <table>
19399 <tr>
19400 <td> 1 </td>
19401 <td> 2
19402 </td></tr>
19403 <tr>
19404 <td> 3 </td>
19405 <td> 4
19406 </td></tr></table>
19407 <p>y
19408 </p>
19409 !! end
19410
19411 !! test
19412 Bug 529: Uncovered bullet in parser function result
19413 !! wikitext
19414 * Foo {{lc:{{bullet}} }}
19415 !! html
19416 <ul><li> Foo </li>
19417 <li> bar</li></ul>
19418
19419 !! end
19420
19421 !! test
19422 Bug 5678: Double-parsed template argument
19423 !! wikitext
19424 {{lc:{{{1}}}|hello}}
19425 !! html
19426 <p>{{{1}}}
19427 </p>
19428 !! end
19429
19430 !! test
19431 Bug 5678: Double-parsed template invocation
19432 !! wikitext
19433 {{lc:{{paramtest {{!}} param = hello }} }}
19434 !! html
19435 <p>{{paramtest | param = hello }}
19436 </p>
19437 !! end
19438
19439 !! test
19440 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
19441 !! options
19442 language=cs
19443 title=[[Main Page]]
19444 !! wikitext
19445 {{PRVNÍVELKÉ:ěščř}}
19446 {{prvnívelké:ěščř}}
19447 {{PRVNÍMALÉ:ěščř}}
19448 {{prvnímalé:ěščř}}
19449 {{MALÁ:ěščř}}
19450 {{malá:ěščř}}
19451 {{VELKÁ:ěščř}}
19452 {{velká:ěščř}}
19453 !! html
19454 <p>Ěščř
19455 Ěščř
19456 ěščř
19457 ěščř
19458 ěščř
19459 ěščř
19460 ĚŠČŘ
19461 ĚŠČŘ
19462 </p>
19463 !! end
19464
19465 !! test
19466 Morwen/13: Unclosed link followed by heading
19467 !! wikitext
19468 [[link
19469 ==heading==
19470 !! html
19471 <p>[[link
19472 </p>
19473 <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>
19474
19475 !! end
19476
19477 !! test
19478 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
19479 !! wikitext
19480 {{foo|
19481 =heading=
19482 !! html
19483 <p>{{foo|
19484 </p>
19485 <h1><span class="mw-headline" id="heading">heading</span></h1>
19486
19487 !! end
19488
19489 !! test
19490 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
19491 !! wikitext
19492 {{foo|
19493 ==heading==
19494 !! html
19495 <p>{{foo|
19496 </p>
19497 <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>
19498
19499 !! end
19500
19501 !! test
19502 Tildes in comments
19503 !! options
19504 pst
19505 !! wikitext
19506 <!-- ~~~~ -->
19507 !! html
19508 <!-- ~~~~ -->
19509 !! end
19510
19511 !! test
19512 Paragraphs inside divs (no extra line breaks)
19513 !! wikitext
19514 <div>Line one
19515
19516 Line two</div>
19517 !! html
19518 <div>Line one
19519 Line two</div>
19520
19521 !! end
19522
19523 !! test
19524 Paragraphs inside divs (extra line break on open)
19525 !! wikitext
19526 <div>
19527 Line one
19528
19529 Line two</div>
19530 !! html
19531 <div>
19532 <p>Line one
19533 </p>
19534 Line two</div>
19535
19536 !! end
19537
19538 !! test
19539 Paragraphs inside divs (extra line break on close)
19540 !! wikitext
19541 <div>Line one
19542
19543 Line two
19544 </div>
19545 !! html
19546 <div>Line one
19547 <p>Line two
19548 </p>
19549 </div>
19550
19551 !! end
19552
19553 !! test
19554 Paragraphs inside divs (extra line break on open and close)
19555 !! wikitext
19556 <div>
19557 Line one
19558
19559 Line two
19560 </div>
19561 !! html
19562 <div>
19563 <p>Line one
19564 </p><p>Line two
19565 </p>
19566 </div>
19567
19568 !! end
19569
19570 !! test
19571 Nesting tags, paragraphs on lines which begin with <div>
19572 !! wikitext
19573 <div></div><strong>A
19574 B</strong>
19575 !! html/php+tidy
19576 <p><strong>A</strong></p>
19577 <p><strong>B</strong></p>
19578 !! html/parsoid
19579 <div></div>
19580 <p><strong>A
19581 B</strong>
19582 </p>
19583 !! end
19584
19585 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
19586 !! test
19587 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
19588 !! wikitext
19589 <blockquote>Line one
19590
19591 Line two</blockquote>
19592 !! html
19593 <blockquote>Line one
19594 Line two</blockquote>
19595
19596 !! html+tidy
19597 <blockquote>
19598 <p>Line one Line two</p>
19599 </blockquote>
19600 !! end
19601
19602 !! test
19603 Bug 6200: paragraphs inside blockquotes (extra line break on open)
19604 !! wikitext
19605 <blockquote>
19606 Line one
19607
19608 Line two</blockquote>
19609 !! html
19610 <blockquote>
19611 <p>Line one
19612 </p>
19613 Line two</blockquote>
19614
19615 !! html+tidy
19616 <blockquote>
19617 <p>Line one</p>
19618 Line two</blockquote>
19619 !! end
19620
19621 !! test
19622 Bug 6200: paragraphs inside blockquotes (extra line break on close)
19623 !! wikitext
19624 <blockquote>Line one
19625
19626 Line two
19627 </blockquote>
19628 !! html
19629 <blockquote>Line one
19630 <p>Line two
19631 </p>
19632 </blockquote>
19633
19634 !! html+tidy
19635 <blockquote>
19636 <p>Line one</p>
19637 <p>Line two</p>
19638 </blockquote>
19639 !! end
19640
19641 !! test
19642 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
19643 !! wikitext
19644 <blockquote>
19645 Line one
19646
19647 Line two
19648 </blockquote>
19649 !! html
19650 <blockquote>
19651 <p>Line one
19652 </p><p>Line two
19653 </p>
19654 </blockquote>
19655
19656 !! html+tidy
19657 <blockquote>
19658 <p>Line one</p>
19659 <p>Line two</p>
19660 </blockquote>
19661 !! end
19662
19663 !! test
19664 Paragraphs inside blockquotes/divs (no extra line breaks)
19665 !! wikitext
19666 <blockquote><div>Line one
19667
19668 Line two</div></blockquote>
19669 !! html
19670 <blockquote><div>Line one
19671 Line two</div></blockquote>
19672
19673 !! end
19674
19675 !! test
19676 Paragraphs inside blockquotes/divs (extra line break on open)
19677 !! wikitext
19678 <blockquote><div>
19679 Line one
19680
19681 Line two</div></blockquote>
19682 !! html
19683 <blockquote><div>
19684 <p>Line one
19685 </p>
19686 Line two</div></blockquote>
19687
19688 !! end
19689
19690 !! test
19691 Paragraphs inside blockquotes/divs (extra line break on close)
19692 !! wikitext
19693 <blockquote><div>Line one
19694
19695 Line two
19696 </div></blockquote>
19697 !! html
19698 <blockquote><div>Line one
19699 <p>Line two
19700 </p>
19701 </div></blockquote>
19702
19703 !! end
19704
19705 !! test
19706 Paragraphs inside blockquotes/divs (extra line break on open and close)
19707 !! wikitext
19708 <blockquote><div>
19709 Line one
19710
19711 Line two
19712 </div></blockquote>
19713 !! html
19714 <blockquote><div>
19715 <p>Line one
19716 </p><p>Line two
19717 </p>
19718 </div></blockquote>
19719
19720 !! end
19721
19722 !! test
19723 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
19724 !! options
19725 wgLinkHolderBatchSize=0
19726 !! wikitext
19727 [[meatball:1]]
19728 [[meatball:2]]
19729 [[meatball:3]]
19730 !! html
19731 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
19732 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
19733 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
19734 </p>
19735 !! end
19736
19737 !! test
19738 Free external link invading image caption
19739 !! wikitext
19740 [[Image:Foobar.jpg|thumb|http://x|hello]]
19741 !! html
19742 <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>
19743
19744 !! end
19745
19746 !! test
19747 Bug 15196: localised external link numbers
19748 !! options
19749 language=fa
19750 !! wikitext
19751 [http://en.wikipedia.org/]
19752 !! html/php
19753 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
19754 </p>
19755 !! html/parsoid
19756 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
19757 !! end
19758
19759 !! test
19760 Multibyte character in padleft
19761 !! wikitext
19762 {{padleft:-Hello|7|Æ}}
19763 !! html
19764 <p>Æ-Hello
19765 </p>
19766 !! end
19767
19768 !! test
19769 Multibyte character in padright
19770 !! wikitext
19771 {{padright:Hello-|7|Æ}}
19772 !! html
19773 <p>Hello-Æ
19774 </p>
19775 !! end
19776
19777 !!test
19778 formatdate parser function
19779 !! wikitext
19780 {{#formatdate:2009-03-24}}
19781 !! html
19782 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
19783 </p>
19784 !! end
19785
19786 !!test
19787 formatdate parser function, with default format
19788 !! wikitext
19789 {{#formatdate:2009-03-24|mdy}}
19790 !! html
19791 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
19792 </p>
19793 !! end
19794
19795 !! test
19796 Spacing of numbers in formatted dates
19797 !! wikitext
19798 {{#formatdate:January 15}}
19799 !! html
19800 <p><span class="mw-formatted-date" title="01-15">January 15</span>
19801 </p>
19802 !! end
19803
19804 !! test
19805 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
19806 !! options
19807 language=nl title=[[MediaWiki:Common.css]]
19808 !! wikitext
19809 {{#formatdate:2009-03-24|dmy}}
19810 !! html
19811 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
19812 </p>
19813 !! end
19814
19815 #
19816 #
19817 #
19818
19819 #
19820 # Edit comments
19821 #
19822
19823 !! test
19824 Edit comment with link
19825 !! options
19826 comment
19827 !! wikitext
19828 I like the [[Main Page]] a lot
19829 !! html
19830 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
19831 !!end
19832
19833 !! test
19834 Edit comment with link and link text
19835 !! options
19836 comment
19837 !! wikitext
19838 I like the [[Main Page|best pages]] a lot
19839 !! html
19840 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
19841 !!end
19842
19843 !! test
19844 Edit comment with link and link text with suffix
19845 !! options
19846 comment
19847 !! wikitext
19848 I like the [[Main Page|best page]]s a lot
19849 !! html
19850 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
19851 !!end
19852
19853 !! test
19854 Edit comment with section link (non-local, eg in history list)
19855 !! options
19856 comment title=[[Main Page]]
19857 !! wikitext
19858 /* External links */ removed bogus entries
19859 !! html
19860 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
19861 !!end
19862
19863 !! test
19864 Edit comment with section link and text before it (non-local, eg in history list)
19865 !! options
19866 comment title=[[Main Page]]
19867 !! wikitext
19868 pre-comment text /* External links */ removed bogus entries
19869 !! html
19870 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>
19871 !!end
19872
19873 !! test
19874 Edit comment with section link (local, eg in diff view)
19875 !! options
19876 comment local title=[[Main Page]]
19877 !! wikitext
19878 /* External links */ removed bogus entries
19879 !! html
19880 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
19881 !!end
19882
19883 !! test
19884 Edit comment with subpage link (bug 14080)
19885 !! options
19886 comment
19887 subpage
19888 title=[[Subpage test]]
19889 !! wikitext
19890 Poked at a [[/subpage]] here...
19891 !! html
19892 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
19893 !!end
19894
19895 !! test
19896 Edit comment with subpage link and link text (bug 14080)
19897 !! options
19898 comment
19899 subpage
19900 title=[[Subpage test]]
19901 !! wikitext
19902 Poked at a [[/subpage|neat little page]] here...
19903 !! html
19904 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
19905 !!end
19906
19907 !! test
19908 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
19909 !! options
19910 comment
19911 title=[[Subpage test]]
19912 !! wikitext
19913 Poked at a [[/subpage]] here...
19914 !! html
19915 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...
19916 !!end
19917
19918 !! test
19919 Edit comment with bare anchor link (local, as on diff)
19920 !! options
19921 comment
19922 local
19923 title=[[Main Page]]
19924 !! wikitext
19925 [[#section]]
19926 !! html
19927 <a href="#section">#section</a>
19928 !! end
19929
19930 !! test
19931 Edit comment with bare anchor link (non-local, as on history)
19932 !! options
19933 comment
19934 title=[[Main Page]]
19935 !! wikitext
19936 [[#section]]
19937 !! html
19938 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
19939 !! end
19940
19941 !! test
19942 Anchor starting with underscore
19943 !! wikitext
19944 [[#_ref|One]]
19945 !! html
19946 <p><a href="#_ref">One</a>
19947 </p>
19948 !! end
19949
19950 !! test
19951 Id starting with underscore
19952 !! wikitext
19953 <div id="_ref"></div>
19954 !! html
19955 <div id="_ref"></div>
19956
19957 !! end
19958
19959 !! test
19960 Space normalisation on autocomment (bug 22784)
19961 !! options
19962 comment
19963 title=[[Main Page]]
19964 !! wikitext
19965 /* __hello__world__ */
19966 !! html
19967 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
19968 !! end
19969
19970 !! test
19971 percent-encoding and + signs in comments (Bug 26410)
19972 !! options
19973 comment
19974 !! wikitext
19975 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
19976 !! html/php
19977 <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>
19978 !! end
19979
19980 # Parsoid doesn't support this yet: see bug 73581
19981 # but it *should* omit the 'src' attribute if the image is bad.
19982 # PHP side of tests was disabled in
19983 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
19984 # because of issues in the PHP parserTests infrastructure
19985 # (but the output below is indeed what the PHP side emits)
19986 !! test
19987 Bad images - basic functionality
19988 !! wikitext
19989 [[File:Bad.jpg]]
19990 !! DISABLED/html/php
19991 !! html/parsoid
19992 <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>
19993 !! end
19994
19995 !! test
19996 Bad images - bug 16039: text after bad image disappears
19997 !! wikitext
19998 Foo bar
19999 [[File:Bad.jpg]]
20000 Bar foo
20001 !! DISABLED/html/php
20002 <p>Foo bar
20003 </p><p>Bar foo
20004 </p>
20005 !! html/parsoid
20006 <p>Foo bar
20007 <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>
20008 Bar foo</p>
20009 !! end
20010
20011 !! test
20012 Verify that displaytitle works (bug #22501) no displaytitle
20013 !! options
20014 showtitle
20015 !! config
20016 wgAllowDisplayTitle=true
20017 wgRestrictDisplayTitle=false
20018 !! wikitext
20019 this is not the the title
20020 !! html/php
20021 Parser test
20022 <p>this is not the the title
20023 </p>
20024 !! end
20025
20026 !! test
20027 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
20028 !! options
20029 showtitle
20030 title=[[Screen]]
20031 !! config
20032 wgAllowDisplayTitle=true
20033 wgRestrictDisplayTitle=false
20034 !! wikitext
20035 this is not the the title
20036 {{DISPLAYTITLE:whatever}}
20037 !! html/php
20038 whatever
20039 <p>this is not the the title
20040 </p>
20041 !! end
20042
20043 !! test
20044 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
20045 !! options
20046 showtitle
20047 title=[[Screen]]
20048 !! config
20049 wgAllowDisplayTitle=true
20050 wgRestrictDisplayTitle=true
20051 !! wikitext
20052 this is not the the title
20053 {{DISPLAYTITLE:whatever}}
20054 !! html/php
20055 Screen
20056 <p>this is not the the title
20057 </p>
20058 !! end
20059
20060 !! test
20061 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
20062 !! options
20063 showtitle
20064 title=[[Screen]]
20065 !! config
20066 wgAllowDisplayTitle=true
20067 wgRestrictDisplayTitle=true
20068 !! wikitext
20069 this is not the the title
20070 {{DISPLAYTITLE:screen}}
20071 !! html/php
20072 screen
20073 <p>this is not the the title
20074 </p>
20075 !! end
20076
20077 !! test
20078 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
20079 !! options
20080 showtitle
20081 title=[[Screen]]
20082 !! config
20083 wgAllowDisplayTitle=false
20084 !! wikitext
20085 this is not the the title
20086 {{DISPLAYTITLE:screen}}
20087 !! html/php
20088 Screen
20089 <p>this is not the the title
20090 <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>
20091 </p>
20092 !! end
20093
20094 !! test
20095 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
20096 !! options
20097 showtitle
20098 title=[[Screen]]
20099 !! config
20100 wgAllowDisplayTitle=false
20101 !! wikitext
20102 this is not the the title
20103 !! html/php
20104 Screen
20105 <p>this is not the the title
20106 </p>
20107 !! end
20108
20109 !! test
20110 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
20111 !! options
20112 showtitle
20113 title=[[Screen]]
20114 !! config
20115 wgAllowDisplayTitle=true
20116 wgRestrictDisplayTitle=true
20117 !! wikitext
20118 this is not the the title
20119 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
20120 !! html/php
20121 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
20122 <p>this is not the the title
20123 </p>
20124 !! end
20125
20126 !! test
20127 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
20128 !! options
20129 showtitle
20130 title=[[Screen]]
20131 !! config
20132 wgAllowDisplayTitle=true
20133 wgRestrictDisplayTitle=true
20134 !! wikitext
20135 this is not the the title
20136 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
20137 !! html/php
20138 <span style="color: red;">s</span>creen
20139 <p>this is not the the title
20140 </p>
20141 !! end
20142
20143 !! test
20144 Page status indicators: Empty name is invalid
20145 !! options
20146 showindicators
20147 !! wikitext
20148 <indicator name=" "></indicator>
20149 <indicator></indicator>
20150 !! html
20151 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20152 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20153 </p>
20154 !! end
20155
20156 !! test
20157 Page status indicators: Weird syntaxes that are okay
20158 !! options
20159 showindicators
20160 !! wikitext
20161 <indicator name="empty" />
20162 <indicator name="name"></indicator>
20163 !! html
20164 empty=
20165 name=
20166 <p><br />
20167 </p>
20168 !! end
20169
20170 !! test
20171 Page status indicators: Torture test
20172 !! options
20173 showindicators
20174 !! wikitext
20175 <indicator name="01">hello world</indicator>
20176 <indicator name="02">[[Main Page]]</indicator>
20177 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
20178 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
20179 <indicator name="05">* foo
20180 * bar</indicator>
20181 <indicator name="06"><nowiki>foo</nowiki></indicator>
20182 <indicator name="07"> Preformatted</indicator>
20183 <indicator name="08"><div>Broken tag</indicator>
20184 <indicator name="09">{| class=wikitable
20185 | cell
20186 |}</indicator>
20187 <indicator name="10">Two
20188
20189 paragraphs</indicator>
20190 !! html
20191 01=hello world
20192 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20193 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" />
20194 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>
20195 05=<ul><li> foo</li>
20196 <li> bar</li></ul>
20197
20198 06=foo
20199 07=<pre>Preformatted
20200 </pre>
20201 08=<div>Broken tag</div>
20202
20203 09=<table class="wikitable">
20204 <tr>
20205 <td> cell
20206 </td></tr></table>
20207
20208 10=<p>Two
20209 </p><p>paragraphs
20210 </p>
20211 <p><br />
20212 </p><p><br />
20213 </p><p><br />
20214 </p><p><br />
20215 </p><p><br />
20216 </p>
20217 !! end
20218
20219 !! test
20220 preload: check <noinclude> and <includeonly>
20221 !! options
20222 preload
20223 !! wikitext
20224 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
20225 !! html/php
20226 Hello kind world.
20227 !! end
20228
20229 !! test
20230 preload: check <onlyinclude>
20231 !! options
20232 preload
20233 !! wikitext
20234 Goodbye <onlyinclude>Hello world</onlyinclude>
20235 !! html/php
20236 Hello world
20237 !! end
20238
20239 !! test
20240 preload: can pass tags through if we want to
20241 !! options
20242 preload
20243 !! wikitext
20244 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
20245 !! html/php
20246 <includeonly>Hello world</includeonly>
20247 !! end
20248
20249 !! test
20250 preload: check that it doesn't try to do tricks
20251 !! options
20252 preload
20253 !! wikitext
20254 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20255 !! html/php
20256 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20257 !! end
20258
20259 !! test
20260 Play a bit with r67090 and bug 3158
20261 !! wikitext
20262 <div style="width:50% !important">&nbsp;</div>
20263 <div style="width:50%&nbsp;!important">&nbsp;</div>
20264 <div style="width:50%&#160;!important">&nbsp;</div>
20265 <div style="border : solid;">&nbsp;</div>
20266 !! html/php
20267 <div style="width:50% !important">&#160;</div>
20268 <div style="width:50% !important">&#160;</div>
20269 <div style="width:50% !important">&#160;</div>
20270 <div style="border&#160;: solid;">&#160;</div>
20271
20272 !! html/parsoid
20273 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20274 <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>
20275 <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>
20276 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20277
20278 !! end
20279
20280 !! test
20281 HTML5 data attributes
20282 !! wikitext
20283 <span data-foo="bar">Baz</span>
20284 <p data-abc-def_hij="">Quuz</p>
20285 !! html
20286 <p><span data-foo="bar">Baz</span>
20287 </p>
20288 <p data-abc-def_hij="">Quuz</p>
20289
20290 !! end
20291
20292 !! test
20293 percent-encoding and + signs in internal links (Bug 26410)
20294 !! wikitext
20295 [[User:+%]] [[Page+title%]]
20296 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
20297 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
20298 [[%33%45]] [[%33%45+]]
20299 !! html/php
20300 <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>
20301 <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>
20302 <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>
20303 <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>
20304 </p>
20305 !! html/parsoid
20306 <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>
20307 <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>
20308 <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>
20309 <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>
20310 !! end
20311
20312 !! test
20313 Special characters in embedded file links (bug 27679)
20314 !! wikitext
20315 [[File:Contains & ampersand.jpg]]
20316 [[File:Does not exist.jpg|Title with & ampersand]]
20317 !! html/php
20318 <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>
20319 <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>
20320 </p>
20321 !! html/parsoid
20322 <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>
20323 <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>
20324 !! end
20325
20326 !! test
20327 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
20328 !! wikitext
20329 Text&apos;s been normalized?
20330 !! html
20331 <p>Text&#39;s been normalized?
20332 </p>
20333 !! end
20334
20335 !! test
20336 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
20337 !! wikitext
20338 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
20339 !! html
20340 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
20341 </p>
20342 !! end
20343
20344 !! test
20345 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
20346 !! wikitext
20347 [http://www.example.org/ ideograms]
20348 !! html
20349 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
20350 </p>
20351 !! end
20352
20353 !! test
20354 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
20355 !! wikitext
20356 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
20357 !! html
20358 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
20359 </p>
20360 !! end
20361
20362 !! article
20363 Mediawiki:loop1
20364 !! text
20365 {{Identical|A}}
20366 !! endarticle
20367
20368 !! article
20369 Mediawiki:loop2
20370 !! text
20371 {{Identical|B}}
20372 !! endarticle
20373
20374 !! article
20375 Template:Identical
20376 !! text
20377 {{int:loop1}}
20378 {{int:loop2}}
20379 !! endarticle
20380
20381 !! test
20382 Bug 31098 Template which includes system messages which includes the template
20383 !! wikitext
20384 {{Identical}}
20385 !! html
20386 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20387 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20388 </p>
20389 !! end
20390
20391 !! test
20392 Bug31490 Turkish: ucfirst 'blah'
20393 !! options
20394 language=tr
20395 !! wikitext
20396 {{ucfirst:blah}}
20397 !! html
20398 <p>Blah
20399 </p>
20400 !! end
20401
20402 !! test
20403 Bug31490 Turkish: ucfirst 'ix'
20404 !! options
20405 language=tr
20406 !! wikitext
20407 {{ucfirst:ix}}
20408 !! html
20409 <p>İx
20410 </p>
20411 !! end
20412
20413 !! test
20414 Bug31490 Turkish: lcfirst 'BLAH'
20415 !! options
20416 language=tr
20417 !! wikitext
20418 {{lcfirst:BLAH}}
20419 !! html
20420 <p>bLAH
20421 </p>
20422 !! end
20423
20424 !! test
20425 Bug31490 Turkish: ucfırst (with a dotless i)
20426 !! options
20427 language=tr
20428 !! wikitext
20429 {{ucfırst:blah}}
20430 !! html
20431 <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>
20432 </p>
20433 !! end
20434
20435 !! test
20436 Bug31490 ucfırst (with a dotless i) with English language
20437 !! options
20438 language=en
20439 !! wikitext
20440 {{ucfırst:blah}}
20441 !! html
20442 <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>
20443 </p>
20444 !! end
20445
20446 !! test
20447 Bug 26375: TOC with italics
20448 !! options
20449 title=[[Main Page]]
20450 !! wikitext
20451 __TOC__
20452 == ''Lost'' episodes ==
20453 !! html
20454 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20455 <ul>
20456 <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>
20457 </ul>
20458 </div>
20459
20460 <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>
20461
20462 !! end
20463
20464 !! test
20465 Bug 26375: TOC with bold
20466 !! options
20467 title=[[Main Page]]
20468 !! wikitext
20469 __TOC__
20470 == '''should be bold''' then normal text ==
20471 !! html
20472 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20473 <ul>
20474 <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>
20475 </ul>
20476 </div>
20477
20478 <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>
20479
20480 !! end
20481
20482 !! test
20483 Bug 33845: Headings become cursive in TOC when they contain an image
20484 !! options
20485 title=[[Main Page]]
20486 !! wikitext
20487 __TOC__
20488 == Image [[Image:foobar.jpg]] ==
20489 !! html
20490 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20491 <ul>
20492 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
20493 </ul>
20494 </div>
20495
20496 <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>
20497
20498 !! end
20499
20500 !! test
20501 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
20502 !! options
20503 title=[[Main Page]]
20504 !! wikitext
20505 __TOC__
20506 == <blockquote>Quote</blockquote> ==
20507 !! html
20508 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20509 <ul>
20510 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20511 </ul>
20512 </div>
20513
20514 <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>
20515
20516 !! html+tidy
20517 <p></p>
20518 <div id="toc" class="toc">
20519 <div id="toctitle">
20520 <h2>Contents</h2>
20521 </div>
20522 <ul>
20523 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20524 </ul>
20525 </div>
20526 <p></p>
20527 <h2><span class="mw-headline" id="Quote"></span></h2>
20528 <blockquote>
20529 <p><span class="mw-headline" id="Quote">Quote</span></p>
20530 </blockquote>
20531 <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>
20532 !! end
20533
20534 !! test
20535 Unclosed tags in TOC
20536 !! options
20537 title=[[Main Page]]
20538 !! wikitext
20539 __TOC__
20540 == Proof: 2 < 3 ==
20541 <small>Hanc marginis exiguitas non caperet.</small>
20542 QED
20543 !! html
20544 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20545 <ul>
20546 <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>
20547 </ul>
20548 </div>
20549
20550 <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>
20551 <p><small>Hanc marginis exiguitas non caperet.</small>
20552 QED
20553 </p>
20554 !! end
20555
20556 !! test
20557 Multiple tags in TOC
20558 !! wikitext
20559 __TOC__
20560 == <i>Foo</i> <b>Bar</b> ==
20561
20562 == <i>Foo</i> <blockquote>Bar</blockquote> ==
20563 !! html
20564 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20565 <ul>
20566 <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>
20567 <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>
20568 </ul>
20569 </div>
20570
20571 <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>
20572 <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>
20573
20574 !! html+tidy
20575 <p></p>
20576 <div id="toc" class="toc">
20577 <div id="toctitle">
20578 <h2>Contents</h2>
20579 </div>
20580 <ul>
20581 <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>
20582 <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>
20583 </ul>
20584 </div>
20585 <p></p>
20586 <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>
20587 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
20588 <blockquote>
20589 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
20590 </blockquote>
20591 <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>
20592 !! end
20593
20594 !! test
20595 Tags with parameters in TOC
20596 !! wikitext
20597 __TOC__
20598 == <sup class="in-h2">Hello</sup> ==
20599
20600 == <sup class="a > b">Evilbye</sup> ==
20601 !! html
20602 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20603 <ul>
20604 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
20605 <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>
20606 </ul>
20607 </div>
20608
20609 <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>
20610 <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>
20611
20612 !! end
20613
20614 !! test
20615 span tags with directionality in TOC
20616 !! wikitext
20617 __TOC__
20618 == <span dir="ltr">C++</span> ==
20619
20620 == <span dir="rtl">זבנג!</span> ==
20621
20622 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
20623
20624 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
20625
20626 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
20627 !! html
20628 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20629 <ul>
20630 <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>
20631 <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>
20632 <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>
20633 <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>
20634 <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>
20635 </ul>
20636 </div>
20637
20638 <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>
20639 <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>
20640 <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>
20641 <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>
20642 <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>
20643
20644 !! end
20645
20646 !! test
20647 Bug 72884: bdi element in ToC
20648 !! wikitext
20649 __TOC__
20650 == <bdi>test</bdi> ==
20651 !! html
20652 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20653 <ul>
20654 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
20655 </ul>
20656 </div>
20657
20658 <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>
20659
20660 !! end
20661
20662 # Note that the html output does not have the <p></p>, but the
20663 # html+tidy output *does*. This is because the empty <p></p> is
20664 # removed by the sanitizer, but only when tidy is *not* enabled (!).
20665 !! test
20666 Empty <p> tag in TOC, removed by Sanitizer (T92892)
20667 !! wikitext
20668 __TOC__
20669 == x ==
20670 !! html
20671 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20672 <ul>
20673 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
20674 </ul>
20675 </div>
20676
20677 <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>
20678
20679 !! html+tidy
20680 <p></p>
20681 <div id="toc" class="toc">
20682 <div id="toctitle">
20683 <h2>Contents</h2>
20684 </div>
20685 <ul>
20686 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
20687 </ul>
20688 </div>
20689 <p></p>
20690 <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>
20691 !! end
20692
20693 !! article
20694 MediaWiki:Bug32057
20695 !! text
20696 == {{int:headline_sample}} ==
20697 !! endarticle
20698
20699 !! test
20700 Bug 32057: Title needed when expanding <h> nodes.
20701 !! options
20702 title=[[Main Page]]
20703 !! wikitext
20704 {{int:Bug32057}}
20705 !! html
20706 <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>
20707
20708 !! end
20709
20710 !! test
20711 Strip marker in urlencode
20712 !! wikitext
20713 {{urlencode:x<nowiki/>y}}
20714 {{urlencode:x<nowiki/>y|wiki}}
20715 {{urlencode:x<nowiki/>y|path}}
20716 {{urlencode:x<pre id="one">two</pre>y}}
20717 !! html
20718 <p>xy
20719 xy
20720 xy
20721 xy
20722 </p>
20723 !! end
20724
20725 !! test
20726 Strip marker in lc
20727 !! wikitext
20728 {{lc:x<nowiki/>y}}
20729 !! html
20730 <p>xy
20731 </p>
20732 !! end
20733
20734 !! test
20735 Strip marker in uc
20736 !! wikitext
20737 {{uc:x<nowiki/>y}}
20738 !! html
20739 <p>XY
20740 </p>
20741 !! end
20742
20743 !! test
20744 Strip marker in formatNum
20745 !! wikitext
20746 {{formatnum:1<nowiki/>2}}
20747 {{formatnum:1<nowiki/>2|R}}
20748 !! html
20749 <p>12
20750 12
20751 </p>
20752 !! end
20753
20754 !! test
20755 Check noCommafy in formatNum
20756 !! options
20757 language=be-tarask
20758 !! wikitext
20759 {{formatnum:123456.78}}
20760 {{formatnum:123456.78|NOSEP}}
20761 !! html
20762 <p>123 456,78
20763 123456.78
20764 </p>
20765 !! end
20766
20767 !! test
20768 Wrong option for formatNum (bug 56199)
20769 !! wikitext
20770 {{formatnum:1,234.56|Random}}
20771 {{formatnum:1,234.56|EVERYTHING}}
20772 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
20773 !! html
20774 <p>1,234.56
20775 1,234.56
20776 1,234.56
20777 </p>
20778 !! end
20779
20780 !! test
20781 Strip marker in grammar
20782 !! options
20783 language=fi
20784 !! wikitext
20785 {{grammar:elative|foo<nowiki/>bar}}
20786 !! html
20787 <p>foobarista
20788 </p>
20789 !! end
20790
20791 !! test
20792 Strip marker in padleft
20793 !! wikitext
20794 {{padleft:|2|x<nowiki/>y}}
20795 !! html
20796 <p>xy
20797 </p>
20798 !! end
20799
20800 !! test
20801 Strip marker in padright
20802 !! wikitext
20803 {{padright:|2|x<nowiki/>y}}
20804 !! html
20805 <p>xy
20806 </p>
20807 !! end
20808
20809 !! test
20810 Strip marker in anchorencode
20811 !! wikitext
20812 {{anchorencode:x<nowiki/>y}}
20813 !! html
20814 <p>xy
20815 </p>
20816 !! end
20817
20818 !! test
20819 nowiki inside link inside heading (bug 18295)
20820 !! wikitext
20821 ==[[foo|x<nowiki>y</nowiki>z]]==
20822 !! html
20823 <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>
20824
20825 !! end
20826
20827 !! test
20828 new support for bdi element (bug 31817)
20829 !! wikitext
20830 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
20831 !! html
20832 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
20833
20834 !!end
20835
20836 !! test
20837 Ignore pipe between table row attributes
20838 !! wikitext
20839 {|
20840 | quux
20841 |- id=foo | style='color: red'
20842 | bar
20843 |}
20844 !! html
20845 <table>
20846 <tr>
20847 <td> quux
20848 </td></tr>
20849 <tr id="foo" style="color: red">
20850 <td> bar
20851 </td></tr></table>
20852
20853 !! end
20854
20855 !!test
20856 Gallery override link with WikiLink (bug 34852)
20857 !! wikitext
20858 <gallery>
20859 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
20860 </gallery>
20861 !! html
20862 <ul class="gallery mw-gallery-traditional">
20863 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20864 <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>
20865 <div class="gallerytext">
20866 <p>caption
20867 </p>
20868 </div>
20869 </div></li>
20870 </ul>
20871
20872 !! end
20873
20874 !!test
20875 Gallery override link with absolute external link (bug 34852)
20876 !! wikitext
20877 <gallery>
20878 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
20879 </gallery>
20880 !! html
20881 <ul class="gallery mw-gallery-traditional">
20882 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20883 <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>
20884 <div class="gallerytext">
20885 <p>caption
20886 </p>
20887 </div>
20888 </div></li>
20889 </ul>
20890
20891 !! end
20892
20893 !!test
20894 Gallery override link with malicious javascript (bug 34852)
20895 !! wikitext
20896 <gallery>
20897 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
20898 </gallery>
20899 !! html
20900 <ul class="gallery mw-gallery-traditional">
20901 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20902 <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>
20903 <div class="gallerytext">
20904 <p>caption
20905 </p>
20906 </div>
20907 </div></li>
20908 </ul>
20909
20910 !! end
20911
20912 !!test
20913 Gallery with invalid title as link (bug 43964)
20914 !! wikitext
20915 <gallery>
20916 File:foobar.jpg|link=<
20917 </gallery>
20918 !! html
20919 <ul class="gallery mw-gallery-traditional">
20920 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20921 <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>
20922 <div class="gallerytext">
20923 </div>
20924 </div></li>
20925 </ul>
20926
20927 !! end
20928
20929 !!test
20930 Language parser function
20931 !! wikitext
20932 {{#language:ar}}
20933 !! html
20934 <p>العربية
20935 </p>
20936 !! end
20937
20938 !!test
20939 Padleft and padright as substr
20940 !! wikitext
20941 {{padleft:|3|abcde}}
20942 {{padright:|3|abcde}}
20943 !! html
20944 <p>abc
20945 abc
20946 </p>
20947 !! end
20948
20949 !!test
20950 Special parser function
20951 !! wikitext
20952 {{#special:RandomPage}}
20953 {{#special:BaDtItLe}}
20954 {{#special:Foobar}}
20955 !! html
20956 <p>Special:Random
20957 Special:Badtitle
20958 Special:Foobar
20959 </p>
20960 !! end
20961
20962 !!test
20963 Bug 34939 - Case insensitive link parsing ([HttP://])
20964 !! wikitext
20965 [HttP://MediaWiki.Org/]
20966 !! html/php
20967 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
20968 </p>
20969 !! html/parsoid
20970 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
20971 !! end
20972
20973 !!test
20974 Bug 34939 - Case insensitive link parsing ([HttP:// title])
20975 !! wikitext
20976 [HttP://MediaWiki.Org/ MediaWiki]
20977 !! html
20978 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
20979 </p>
20980 !! end
20981
20982 !!test
20983 Bug 34939 - Case insensitive link parsing (HttP://)
20984 !! wikitext
20985 HttP://MediaWiki.Org/
20986 !! html/php
20987 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
20988 </p>
20989 !! html/parsoid
20990 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
20991 !! end
20992
20993 !!test
20994 Disable TOC
20995 !! options
20996 notoc
20997 !! wikitext
20998 Lead
20999 == Section 1 ==
21000 == Section 2 ==
21001 == Section 3 ==
21002 == Section 4 ==
21003 == Section 5 ==
21004 !! html
21005 <p>Lead
21006 </p>
21007
21008 <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>
21009 <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>
21010 <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>
21011 <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>
21012 <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>
21013
21014 !! end
21015
21016
21017 ###
21018 ### Parsoid-specific tests
21019 ### Parsoid-PHP parser incompatibilities
21020 ###
21021 !!test
21022 1. SOL-sensitive wikitext tokens as template-args
21023 !!options
21024 parsoid=wt2html,wt2wt
21025 !! wikitext
21026 {{echo|*a}}
21027 {{echo|#a}}
21028 {{echo|:a}}
21029 !! html
21030 <span about="#mwt1" typeof="mw:Transclusion">
21031 </span><ul about="#mwt1"><li>a</li>
21032 </ul>
21033 <span about="#mwt2" typeof="mw:Transclusion">
21034 </span><ol about="#mwt2"><li>a</li>
21035 </ol>
21036 <span about="#mwt3" typeof="mw:Transclusion">
21037 </span><dl about="#mwt3"><dd>a</dd>
21038 </dl>
21039 !!end
21040
21041 #### -----------------------------------------------------------------
21042 #### Parsoid-specific functionality tests
21043 #### -----------------------------------------------------------------
21044
21045 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
21046 # We know wt2wt will fail, but we expect selser to pass.
21047 # Due to the nature of our testing, wt2wt and selser tests will enter the
21048 # blacklist and we'll catch selser regressions based on changes to the
21049 # blacklist entries for selser tests.
21050 !! test
21051 1. Bad treebuilder fixup of formatting elt is cleaned up
21052 !! options
21053 parsoid=wt2html,wt2wt
21054 !! wikitext
21055 {|
21056 |
21057 <small>
21058 [[Image:Foobar.jpg|right|Test]]
21059 </small>
21060 |}
21061 !! html/parsoid
21062 <table>
21063 <tbody><tr><td>
21064 <small>
21065 <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>
21066 </small>
21067 </td></tr>
21068 </tbody></table>
21069 !! end
21070
21071 !! test
21072 2. Bad treebuilder fixup of formatting elt is cleaned up
21073 !! options
21074 parsoid=wt2html,wt2wt
21075 !! wikitext
21076 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
21077
21078 <small>[[Image:Foobar.jpg|right|300px]]</small>
21079 !! html/parsoid
21080
21081 <p><b>foo</b></p>
21082 <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>
21083 <p><b>bar</b></p>
21084 <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>
21085 !! end
21086
21087 !! test
21088 3. Bad treebuilder fixup of formatting elt is cleaned up
21089 !! options
21090 parsoid=wt2html,wt2wt
21091 !! wikitext
21092 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
21093 !! html/parsoid
21094 <p><small><b>foo</b></small></p>
21095 <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>
21096 <p><small><b>bar</b></small></p>
21097 !! end
21098
21099 !! test
21100 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
21101 !! options
21102 parsoid=wt2html,wt2wt
21103 !! wikitext
21104 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
21105 !! html/parsoid
21106 <p><b><small></small></b></p>
21107 <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>
21108 <p></p>
21109 !! end
21110
21111 #### ----------------------------------------------------------------
21112 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
21113 #### tags. Parsoid's output for these tags differs from that of the
21114 #### PHP parser.
21115 #### ----------------------------------------------------------------
21116
21117 !!test
21118 Ref: 1. ref-location should be replaced with an index span
21119 !!options
21120 parsoid
21121 !! wikitext
21122 A <ref>foo</ref>
21123 B <ref name="x">foo</ref>
21124 C <ref name="y" />
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>
21128 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>
21129 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>
21130 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21131 <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>
21132 <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>
21133 <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>
21134 </ol>
21135 !!end
21136
21137 !!test
21138 Ref: 2. ref-tags with identical names should all get the same index
21139 !!options
21140 parsoid
21141 !! wikitext
21142 A <ref name="x">foo</ref>
21143 B <ref name="x" />
21144 <references />
21145 !! html
21146 <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>
21147 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>
21148 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21149 <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>
21150 </ol>
21151 !!end
21152
21153 !!test
21154 Ref: 3. spaces in ref-names should be ignored
21155 !!options
21156 parsoid
21157 !! wikitext
21158 A <ref name="x">foo</ref>
21159 B <ref name=" x " />
21160 C <ref name= x />
21161 <references />
21162 !! html
21163 <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>
21164 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>
21165 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>
21166 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21167 <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>
21168 </ol>
21169 !!end
21170
21171 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
21172 !!test
21173 Ref: 4. 'constructor' should be accepted as a valid ref-name
21174 !!options
21175 parsoid
21176 !! wikitext
21177 A <ref name="constructor">foo</ref>
21178 <references />
21179 !! html
21180 <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>
21181 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21182 <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>
21183 </ol>
21184 !!end
21185
21186 !!test
21187 Ref: 5. body should accept generic wikitext
21188 !!options
21189 parsoid
21190 !! wikitext
21191 A <ref>
21192 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
21193 </ref>
21194
21195 <references />
21196 !! html
21197 <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>
21198
21199 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21200 <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>
21201 </span></li>
21202 </ol>
21203 !!end
21204
21205 !!test
21206 Ref: 6. indent-pres should not be output in ref-body
21207 !!options
21208 parsoid
21209 !! wikitext
21210 A <ref>
21211 foo
21212 bar
21213 baz
21214 </ref>
21215
21216 <references />
21217 !! html
21218 <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>
21219
21220 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21221 <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
21222 bar
21223 baz
21224 </span></li>
21225 </ol>
21226 !!end
21227
21228 !!test
21229 Ref: 7. No p-wrapping in ref-body
21230 !!options
21231 parsoid
21232 !! wikitext
21233 A <ref>
21234 foo
21235
21236 bar
21237
21238
21239 baz
21240
21241
21242
21243 booz
21244 </ref>
21245
21246 <references />
21247 !! html
21248 <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>
21249
21250 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21251 <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
21252
21253 bar
21254
21255
21256 baz
21257
21258
21259
21260 booz
21261 </span></li>
21262 </ol>
21263 !!end
21264
21265 !!test
21266 Ref: 8. transclusion wikitext has lower precedence
21267 !!options
21268 parsoid
21269 !! wikitext
21270 A <ref> foo {{echo|</ref> B C}}
21271
21272 <references />
21273 !! html
21274 <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>
21275 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21276 <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>
21277 </ol>
21278 !!end
21279
21280 !!test
21281 Ref: 9. unclosed comments should not leak out of ref-body
21282 !!options
21283 parsoid
21284 !! wikitext
21285 A <ref> foo <!--</ref> B C
21286 <references />
21287 !! html
21288 <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>
21289 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21290 <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>
21291 </ol>
21292 !!end
21293
21294 !!test
21295 Ref: 10. Unclosed HTML tags should not leak out of ref-body
21296 !!options
21297 parsoid
21298 !! wikitext
21299 A <ref> <b> foo </ref> B C
21300
21301 <references />
21302 !! html
21303 <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>
21304
21305
21306 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21307 <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>
21308 </ol>
21309 !!end
21310
21311 !!test
21312 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
21313 !!options
21314 parsoid
21315 !! wikitext
21316 A <ref>foo</ref> B
21317 C <ref>bar</ref> D
21318 <references />
21319 !! html
21320 <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
21321 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>
21322 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21323 <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>
21324 <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>
21325 </ol>
21326 !!end
21327
21328 !!test
21329 Ref: 12. ref-tags act as trailing newline migration barrier
21330 !! wikitext
21331 <!--the newline at the end of this line moves out of the p tag-->a
21332
21333 b<!--the newline at the end of this line stays inside the p tag--> <ref />
21334 <ref />
21335
21336 c
21337 <references />
21338 !! html/parsoid
21339 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
21340
21341
21342 <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>
21343 <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>
21344
21345 <p>c</p>
21346 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21347 <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>
21348 <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>
21349 !!end
21350
21351 !!test
21352 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
21353 !!options
21354 parsoid
21355 !! wikitext
21356 <ref>foo</ref> A
21357 <ref>bar
21358 </ref> B
21359 <references />
21360 !! html
21361 <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
21362 <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>
21363 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21364 <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>
21365 <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
21366 </span></li>
21367 </ol>
21368 !!end
21369
21370 !!test
21371 Ref: 14. A nested ref-tag should be emitted as plain text
21372 !!options
21373 parsoid
21374 !! wikitext
21375 <ref>foo <ref>bar</ref> baz</ref>
21376
21377 <references />
21378 !! html
21379 <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>
21380 </p>
21381 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21382 <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>
21383 </ol>
21384 !!end
21385
21386 !!test
21387 Ref: 15. ref-tags with identical names should get identical indexes
21388 !!options
21389 parsoid
21390 !! wikitext
21391 A1 <ref name="a">foo</ref> A2 <ref name="a" />
21392 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
21393
21394 <references />
21395 !! html
21396 <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>
21397 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>
21398
21399 <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>
21400 </ol>
21401 !!end
21402
21403 ## We don't bother wt2wt-ing non-standard whitespace
21404 !!test
21405 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
21406 !!options
21407 parsoid=wt2html
21408 !! wikitext
21409 A <ref >foo</ref >
21410
21411 <references />
21412 !! html
21413 <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>
21414 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21415 <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>
21416 !!end
21417
21418 !!test
21419 Ref: 17. Generate valid HTML5 id/about attributes
21420 !!options
21421 parsoid
21422 !!wikitext
21423 <ref name="a b">foo</ref>
21424
21425 <references />
21426 !!html
21427 <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>
21428 </p>
21429
21430 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21431 <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>
21432 </ol>
21433 !!end
21434
21435 !!test
21436 Ref: 18. T58916: Extension attributes should be parsed as plain text
21437 !!options
21438 parsoid
21439 !!wikitext
21440 <ref name="{{echo|a}}">foo</ref>
21441
21442 <references />
21443 !!html
21444 <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>
21445 </p>
21446
21447 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21448 <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>
21449 </ol>
21450 !!end
21451
21452 !!test
21453 Ref: 19. ref-tags with identical name encodings should get identical indexes
21454 !!options
21455 parsoid
21456 !! wikitext
21457 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
21458
21459 <references />
21460 !! html
21461 <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>
21462 </p>
21463 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21464 <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>
21465 </ol>
21466 !!end
21467
21468 !!test
21469 Ref: 20. ref-tags with identical names but different content should keep it
21470 !!options
21471 parsoid
21472 !! wikitext
21473 A <ref name="foo">Foo one</ref>
21474 B <ref name="foo">Foo two</ref>
21475 C <ref name="foo" />
21476
21477 <references />
21478 !! html
21479 <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>
21480 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>
21481 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>
21482
21483 <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>
21484 </ol>
21485 !!end
21486
21487 !!test
21488 References: 1. references tag without any refs should be handled properly
21489 !! wikitext
21490 <references />
21491 !! html/parsoid
21492 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21493 !!end
21494
21495 !!test
21496 References: 2. references tag with group only outputs references from that group
21497 !! wikitext
21498 A <ref group="a">foo</ref>
21499 B <ref group="b">bar</ref>
21500 C <ref>baz</ref>
21501
21502 <references group="a" />
21503 <references />
21504 <references group="b" />
21505 !! html/parsoid
21506 <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>
21507 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>
21508 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>
21509
21510 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
21511 <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>
21512 </ol>
21513 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
21514 <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>
21515 </ol>
21516 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
21517 <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>
21518 </ol>
21519 !!end
21520
21521 !!test
21522 References: 3. ref list should be cleared after processing references
21523 !! wikitext
21524 A <ref>foo</ref>
21525
21526 <references />
21527
21528 B <ref>bar</ref>
21529
21530 <references />
21531 !! html/parsoid
21532 <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>
21533
21534 <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>
21535 </ol>
21536
21537 <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>
21538
21539 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21540 <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>
21541 </ol>
21542 !!end
21543
21544 !!test
21545 References: 4. only referenced group should be cleared after processing references
21546 !! wikitext
21547 A <ref group="a">afoo</ref>
21548 B <ref>bfoo</ref>
21549
21550 <references group="a" />
21551
21552 C <ref>cfoo</ref>
21553
21554 <references />
21555 !! html/parsoid
21556 <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>
21557 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>
21558
21559 <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>
21560 </ol>
21561
21562 <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>
21563
21564 <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>
21565 </ol>
21566 !!end
21567
21568 !!test
21569 References: 5. ref tags in references should be processed while ignoring all other content
21570 !! wikitext
21571 A <ref name="a" />
21572 B <ref name="b">bar</ref>
21573
21574 <references>
21575 <ref name="a">foo</ref>
21576 This should just get lost.
21577 </references>
21578 !! html/parsoid
21579 <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>
21580 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>
21581
21582
21583 <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>
21584 </ol>
21585 !!end
21586
21587 !!test
21588 References: 6. <references /> from a transclusion
21589 !! wikitext
21590 <ref>Foo</ref> {{echo|<references />}}
21591 !! html/parsoid
21592 <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>
21593 </ol>
21594 !!end
21595
21596 !! test
21597 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
21598 !! wikitext
21599 A <ref>foo bar for a</ref>
21600 B <ref group="X" name="b" />
21601
21602 <references />
21603
21604 <references group="X">
21605 <ref name="b">foo</ref>
21606 </references>
21607 !! html/parsoid
21608 <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>
21609 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>
21610 </p>
21611
21612 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21613 <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>
21614 </ol>
21615
21616 <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"}}'>
21617 <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>
21618 </ol>
21619 !! end
21620
21621 !! test
21622 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
21623 !! wikitext
21624 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
21625 <references />
21626 !! html/parsoid
21627 <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>
21628 <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>
21629 </ol>
21630 !!end
21631
21632 # This test only works in wt2html now as the <references /> are always generated
21633 # unless selser is active. Once T72722 is fixed, we should add a changes test
21634 # here to ensure that unrelated changes don't add the new <references /> in
21635 # wt2wt.
21636 !! test
21637 References: 9. Generate missing references list at the end
21638 !! wikitext
21639 A <ref>foo</ref>
21640 B <ref group="inexistent">bar</ref>
21641 !! html/parsoid
21642 <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>
21643 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21644 <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>
21645 </ol>
21646 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
21647 <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>
21648 </ol>
21649 !! end
21650
21651 !! test
21652 References: 10. New <references/> shouldn't be added for unrelated edits.
21653 !! options
21654 parsoid={
21655 "modes": ["selser"],
21656 "changes": [["#x", "remove"]],
21657 "selser": "noauto"
21658 }
21659 !! wikitext
21660 Unrelated text<span id="x"> that's going to disappear</span>.
21661 A <ref>foo</ref>
21662 !! wikitext/edited
21663 Unrelated text.
21664 A <ref>foo</ref>
21665 !!end
21666
21667 !! test
21668 Entities in ref name
21669 !! wikitext
21670 <ref name="test &amp; me">hi</ref>
21671 <references />
21672 !! html/parsoid
21673 <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>
21674 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21675 <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>
21676 </ol>
21677 !! end
21678
21679 # This test is wt2html only because we're permitting the serializer to produce
21680 # dirty diffs, normalizing the unclosed references to the self-closed version.
21681 !! test
21682 Generate references for unclosed references tag
21683 !! options
21684 parsoid=wt2html
21685 !! wikitext
21686 a<ref>foo</ref>
21687
21688 <references>
21689 !! html/parsoid
21690 <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>
21691 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21692 <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>
21693 !! end
21694
21695 !! test
21696 New reference serializes on its own line
21697 !! options
21698 parsoid=wt2wt,html2wt
21699 !! wikitext
21700 foo
21701 <references />
21702 !! html/parsoid
21703 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21704 !! end
21705
21706 #### ----------------------------------------------------------------
21707 #### Parsoid-only testing of Parsoid's impl of LST
21708 #### Not implemented yet, see
21709 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
21710 #### ----------------------------------------------------------------
21711
21712 !!test
21713 LST Sections: 1. Simple section start and end
21714 !! wikitext
21715 <section begin="2011-05-16" />
21716 <section end="2014-04-10 (MW 1.23wmf22)" />
21717 !! html/parsoid
21718 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
21719 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
21720 !! end
21721
21722 #--------- Test stripping of empty nodes in template content ----------
21723 !!test
21724 Empty LI and TR nodes should be stripped from template content
21725 !!wikitext
21726 {{EmptyLITest}}
21727 {{EmptyTRTest}}
21728 !!html/parsoid
21729 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
21730 <li>a</li>
21731 <li>b</li>
21732 </ul>
21733 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
21734 <tbody>
21735 <tr>
21736 <td>foo</td>
21737 </tr>
21738 <tr>
21739 <td>bar</td>
21740 </tr>
21741 </tbody>
21742 </table>
21743 !!end
21744
21745 !!test
21746 Empty LI and TR nodes should not be stripped from top-level content
21747 !!wikitext
21748 * a
21749 *
21750 * b
21751 {|
21752 |-
21753 |-
21754 |foo
21755 |}
21756 !!html/parsoid
21757 <ul>
21758 <li> a</li>
21759 <li></li>
21760 <li> b</li>
21761 </ul>
21762 <table>
21763 <tbody>
21764 <tr></tr>
21765 <tr>
21766 <td>foo</td>
21767 </tr>
21768 </tbody>
21769 </table>
21770 !!end
21771
21772 !!test
21773 Empty TR nodes should not be stripped if they have any attributes set
21774 !!wikitext
21775 {{EmptyTRWithHTMLAttrTest}}
21776 !!html/parsoid
21777 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
21778 <tr align="center"></tr>
21779 <tr><td>foo</td></tr>
21780 <tr align="center"></tr>
21781 <tr><td>bar</td></tr>
21782 </table>
21783 !!end
21784
21785 #### ----------------------------------------------------------------
21786 #### The following section of tests are primarily to test
21787 #### wikitext escaping capabilities of Parsoid. Given that
21788 #### escaping can be done any number of ways, the wikitext (input)
21789 #### is always adjusted to reflect how Parsoid adds nowiki
21790 #### escape tags.
21791 ####
21792 #### We are marking several tests as parsoid-only since the
21793 #### HTML in the result section is different from what the
21794 #### PHP parser generates for it.
21795 #### ----------------------------------------------------------------
21796
21797
21798 #### --------------- Headings ---------------
21799 #### 0. Unnested
21800 #### 1. Nested inside html <h1>=foo=</h1>
21801 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
21802 #### 3. Nested inside html with wikitext split by html tags
21803 #### 4. No escape needed
21804 #### 5. Empty headings <h1></h1>
21805 #### 6. Heading chars in SOL context
21806 #### ----------------------------------------
21807 !! test
21808 Headings: 0. Unnested
21809 !! options
21810 parsoid
21811 !! wikitext
21812 <nowiki>=foo=</nowiki>
21813
21814 <nowiki> =foo= </nowiki>
21815 <!--cmt-->
21816 <nowiki>=foo=</nowiki>
21817
21818 =foo''a''<nowiki>=</nowiki>
21819 !! html
21820 <p><span typeof="mw:Nowiki">=foo=</span></p>
21821
21822 <p><span typeof="mw:Nowiki"> =foo= </span>
21823 <!--cmt-->
21824 <span typeof="mw:Nowiki">=foo=</span></p>
21825
21826 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
21827 !!end
21828
21829 # New headings and existing headings are handled differently
21830 !! test
21831 Headings: 1. Nested inside html
21832 !! options
21833 parsoid=html2wt
21834 !! html/parsoid
21835 <h1>=foo=</h1>
21836 <h2>=foo=</h2>
21837 <h3>=foo=</h3>
21838
21839 <h1 data-parsoid=''>=foo=</h1>
21840 <h2 data-parsoid=''>=foo=</h2>
21841 <h3 data-parsoid=''>=foo=</h3>
21842 <h4 data-parsoid=''>=foo=</h4>
21843 <h5 data-parsoid=''>=foo=</h5>
21844 <h6 data-parsoid=''>=foo=</h6>
21845 !! wikitext
21846 = =foo= =
21847
21848 == =foo= ==
21849
21850 === =foo= ===
21851
21852 =<nowiki>=foo=</nowiki>=
21853 ==<nowiki>=foo=</nowiki>==
21854 ===<nowiki>=foo=</nowiki>===
21855 ====<nowiki>=foo=</nowiki>====
21856 =====<nowiki>=foo=</nowiki>=====
21857 ======<nowiki>=foo=</nowiki>======
21858
21859 !!end
21860
21861 !! test
21862 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
21863 !! options
21864 parsoid=html2wt
21865 !! html/parsoid
21866 <h1>foo</h1>*bar
21867 <h1>foo</h1>=bar
21868 <h1>foo</h1>=bar=
21869 !! wikitext
21870 = foo =
21871 <nowiki>*</nowiki>bar
21872
21873 = foo =
21874 =bar
21875
21876 = foo =
21877 <nowiki>=bar=</nowiki>
21878 !!end
21879
21880 !! test
21881 Headings: 3. Nested inside html with wikitext split by html tags
21882 !! options
21883 parsoid=html2wt,wt2wt
21884 !! wikitext
21885 = ='''bold'''<nowiki>foo=</nowiki> =
21886 !! html/parsoid
21887 <h1>=<b>bold</b>foo=</h1>
21888 !!end
21889
21890 !! test
21891 Headings: 4a. No escaping needed (testing just h1 and h2)
21892 !! wikitext
21893 = =foo =
21894
21895 = foo= =
21896
21897 = =foo= =
21898
21899 = =foo= bar =
21900
21901 == =foo ==
21902
21903 == foo= ==
21904
21905 = = =
21906
21907 = ''=''foo= =
21908 !! html/parsoid
21909 <h1>=foo</h1>
21910 <h1>foo=</h1>
21911 <h1> =foo= </h1>
21912 <h1>=foo= bar</h1>
21913 <h2>=foo</h2>
21914 <h2>foo=</h2>
21915 <h1>=</h1>
21916 <h1><i>=</i>foo=</h1>
21917 !!end
21918
21919 !! test
21920 Headings: 4b. No escaping needed (inside p-tags)
21921 !! options
21922 parsoid=html2wt
21923 !! html/parsoid
21924 <p>===
21925 =foo= x
21926 =foo= <s></s>
21927 </p>
21928 !! wikitext
21929 ===
21930 =foo= x
21931 =foo= <s></s>
21932 !!end
21933
21934 !! test
21935 Headings: 5. Empty headings
21936 !! wikitext
21937 =<nowiki/>=
21938
21939 ==<nowiki/>==
21940
21941 ===<nowiki/>===
21942
21943 ====<nowiki/>====
21944
21945 =====<nowiki/>=====
21946
21947 ======<nowiki/>======
21948 !! html/parsoid
21949 <h1 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h1>
21950
21951 <h2 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h2>
21952
21953 <h3 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h3>
21954
21955 <h4 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h4>
21956
21957 <h5 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h5>
21958
21959 <h6 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h6>
21960 !!end
21961
21962 !! test
21963 Headings: 6a. Heading chars in SOL context (with trailing spaces)
21964 !! wikitext
21965 <nowiki>=a=</nowiki>
21966
21967 <nowiki>=a=</nowiki>
21968
21969 <nowiki>=a=</nowiki>
21970
21971 <nowiki>=a=</nowiki>
21972 !! html/php
21973 <p>=a=
21974 </p><p>=a=
21975 </p><p>=a=
21976 </p><p>=a=
21977 </p>
21978 !! html/parsoid
21979 <p><span typeof="mw:Nowiki">=a=</span></p>
21980
21981 <p><span typeof="mw:Nowiki">=a=</span></p>
21982
21983 <p><span typeof="mw:Nowiki">=a=</span></p>
21984
21985 <p><span typeof="mw:Nowiki">=a=</span></p>
21986 !!end
21987
21988 !! test
21989 Headings: 6b. Heading chars in SOL context (with trailing newlines)
21990 !! wikitext
21991 <nowiki>=a=
21992 b</nowiki>
21993
21994 <nowiki>=a=
21995 b</nowiki>
21996
21997 <nowiki>=a=
21998 b</nowiki>
21999
22000 <nowiki>=a=
22001 b</nowiki>
22002 !! html/php
22003 <p>=a=
22004 b
22005 </p><p>=a=
22006 b
22007 </p><p>=a=
22008 b
22009 </p><p>=a=
22010 b
22011 </p>
22012 !! html/parsoid
22013 <p><span typeof="mw:Nowiki">=a=
22014 b</span></p>
22015
22016 <p><span typeof="mw:Nowiki">=a=
22017 b</span></p>
22018
22019 <p><span typeof="mw:Nowiki">=a=
22020 b</span></p>
22021
22022 <p><span typeof="mw:Nowiki">=a=
22023 b</span></p>
22024 !!end
22025
22026 !! test
22027 Headings: 6c. Heading chars in SOL context (leading newline break)
22028 !! wikitext
22029 a
22030 <nowiki>=b=</nowiki>
22031 !! html/php
22032 <p>a
22033 =b=
22034 </p>
22035 !! html/parsoid
22036 <p>a
22037 <span typeof="mw:Nowiki">=b=</span>
22038 !!end
22039
22040 !! test
22041 Headings: 6d. Heading chars in SOL context (with interspersed comments)
22042 !! wikitext
22043 <!--c0--><nowiki>=a=</nowiki>
22044
22045 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
22046 !! html/php
22047 <p>=a=
22048 </p><p>=a=
22049 </p>
22050 !! html/parsoid
22051 <!--c0--><p><span typeof="mw:Nowiki">=a=</span></p>
22052
22053 <!--c1--><p><span typeof="mw:Nowiki">=a=</span></p> <!--c2--> <!--c3-->
22054 !!end
22055
22056 !! test
22057 Headings: 6d. Heading chars in SOL context (No escaping needed)
22058 !! options
22059 parsoid=html2wt
22060 !! html/parsoid
22061 =a=<div>b</div>
22062 !! wikitext
22063 =a=<div>b</div>
22064 !!end
22065
22066 !! test
22067 Headings: 7. Insert a newline between new content and headings
22068 !! options
22069 parsoid=html2wt
22070 !! html/parsoid
22071 <h2>NEW</h2>
22072 <p>new</p>
22073 <h2 data-parsoid='{}'>A</h2>
22074 <p data-parsoid='{}'>a</p>
22075 !! wikitext
22076 == NEW ==
22077 new
22078
22079 ==A==
22080 a
22081
22082 !! end
22083
22084 #### --------------- Lists ---------------
22085 #### 0. Outside nests (*foo, etc.)
22086 #### 1. Nested inside html <ul><li>*foo</li></ul>
22087 #### 2. Inside definition lists
22088 #### 3. Only bullets at start should be escaped
22089 #### 4. No escapes needed
22090 #### 5. No unnecessary escapes
22091 #### 6. Escape bullets in SOL position
22092 #### 7. Escape bullets in a multi-line context
22093 #### ----------------------------------------
22094
22095 !! test
22096 Lists: 0. Outside nests
22097 !! wikitext
22098 <nowiki>*</nowiki>foo
22099
22100 <nowiki>#</nowiki>foo
22101
22102 <nowiki>;Foo:</nowiki>bar
22103 !! html/php
22104 <p>*foo
22105 </p><p>#foo
22106 </p><p>;Foo:bar
22107 </p>
22108 !! html/parsoid
22109 <p><span typeof="mw:Nowiki">*</span>foo</p>
22110
22111 <p><span typeof="mw:Nowiki">#</span>foo</p>
22112
22113 <p><span typeof="mw:Nowiki">;Foo:</span>bar</p>
22114 !!end
22115
22116 !! test
22117 Lists: 1. Nested inside html
22118 !! wikitext
22119 *<nowiki>*foo</nowiki>
22120
22121 *<nowiki>#foo</nowiki>
22122
22123 *<nowiki>:foo</nowiki>
22124
22125 *<nowiki>;foo</nowiki>
22126
22127 #<nowiki>*foo</nowiki>
22128
22129 #<nowiki>#foo</nowiki>
22130
22131 #<nowiki>:foo</nowiki>
22132
22133 #<nowiki>;foo</nowiki>
22134 !! html
22135 <ul><li>*foo</li></ul>
22136 <ul><li>#foo</li></ul>
22137 <ul><li>:foo</li></ul>
22138 <ul><li>;foo</li></ul>
22139 <ol><li>*foo</li></ol>
22140 <ol><li>#foo</li></ol>
22141 <ol><li>:foo</li></ol>
22142 <ol><li>;foo</li></ol>
22143
22144 !!end
22145
22146 !! test
22147 Lists: 2. Inside definition lists
22148 !! wikitext
22149 ;<nowiki>;foo</nowiki>
22150
22151 ;<nowiki>:foo</nowiki>
22152
22153 ;<nowiki>:foo</nowiki>
22154 :bar
22155
22156 :<nowiki>:foo</nowiki>
22157 !! html
22158 <dl><dt>;foo</dt></dl>
22159 <dl><dt>:foo</dt></dl>
22160 <dl><dt>:foo</dt>
22161 <dd>bar</dd></dl>
22162 <dl><dd>:foo</dd></dl>
22163
22164 !!end
22165
22166 !! test
22167 Lists: 3. Only bullets at start of text should be escaped
22168 !! wikitext
22169 *<nowiki>*foo*bar</nowiki>
22170
22171 *<nowiki>*foo</nowiki>''it''*bar
22172 !! html
22173 <ul><li>*foo*bar</li></ul>
22174 <ul><li>*foo<i>it</i>*bar</li></ul>
22175
22176 !!end
22177
22178 !! test
22179 Lists: 4. No escapes needed
22180 !! options
22181 parsoid
22182 !! wikitext
22183 *foo*bar
22184
22185 *''foo''*bar
22186
22187 *[[Foo]]: bar
22188
22189 *[[Foo]]*bar
22190 !! html
22191 <ul>
22192 <li>foo*bar
22193 </li>
22194 </ul>
22195 <ul>
22196 <li><i>foo</i>*bar
22197 </li>
22198 </ul>
22199 <ul>
22200 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
22201 </li>
22202 </ul>
22203 <ul>
22204 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
22205 </li>
22206 </ul>
22207 !!end
22208
22209 !! test
22210 Lists: 5. No unnecessary escapes
22211 !! wikitext
22212 * bar <span><nowiki>[[foo]]</nowiki></span>
22213
22214 * =bar <span><nowiki>[[foo]]</nowiki></span>
22215
22216 * [[bar <span><nowiki>[[foo]]</nowiki></span>
22217
22218 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
22219
22220 * =bar <span>foo]]</span>=
22221
22222 * <s></s>: a
22223
22224 * ''* foo''
22225 !! html
22226 <ul><li> bar <span>[[foo]]</span></li></ul>
22227 <ul><li> =bar <span>[[foo]]</span></li></ul>
22228 <ul><li> [[bar <span>[[foo]]</span></li></ul>
22229 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
22230 <ul><li> =bar <span>foo]]</span>=</li></ul>
22231 <ul><li> <s></s>: a</li></ul>
22232 <ul><li> <i>* foo</i></li></ul>
22233
22234 !!end
22235
22236 !! test
22237 Lists: 6. Escape bullets in SOL position
22238 !! options
22239 parsoid=html2wt
22240 !! html/parsoid
22241 <p><!--cmt-->*foo</p>
22242 !! wikitext
22243 <!--cmt--><nowiki>*</nowiki>foo
22244 !!end
22245
22246 !! test
22247 Lists: 7. Escape bullets in a multi-line context
22248 !! wikitext
22249 a
22250 <nowiki>*</nowiki>b
22251 !! html
22252 <p>a
22253 *b
22254 </p>
22255 !!end
22256
22257 !! test
22258 Lists: 8. Escape colons only if not present in tags
22259 !! options
22260 parsoid=html2wt
22261 !! html/parsoid
22262 <dl><dt>a:b<i>c:d</i></dt></dl>
22263 !! wikitext
22264 ; <nowiki>a:b</nowiki>''c:d''
22265 !! end
22266
22267 #### --------------- HRs ---------------
22268 #### 1. Single line
22269 #### -----------------------------------
22270
22271 !! test
22272 HRs: 1. Single line
22273 !! wikitext
22274 ----<nowiki>----</nowiki>
22275 ----=foo=
22276 ----*foo
22277 !! html+tidy
22278 <hr />
22279 <p>----</p>
22280 <hr />
22281 <p>=foo=</p>
22282 <hr />
22283 <p>*foo</p>
22284 !! end
22285
22286 #### --------------- Tables ---------------
22287 #### 1a. Simple example
22288 #### 1b. No escaping needed (!foo)
22289 #### 1c. No escaping needed (|foo)
22290 #### 1d. No escaping needed (|}foo)
22291 ####
22292 #### 2a. Nested in td (<td>foo|bar</td>)
22293 #### 2b. Nested in td (<td>foo||bar</td>)
22294 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
22295 ####
22296 #### 3a. Nested in th (<th>foo!bar</th>)
22297 #### 3b. Nested in th (<th>foo!!bar</th>)
22298 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
22299 ####
22300 #### 4a. Escape -
22301 #### 4b. Escape +
22302 #### 4c. No escaping needed
22303 #### --------------------------------------
22304
22305 !! test
22306 Tables: 1a. Simple example
22307 !! wikitext
22308 <nowiki>{|
22309 |}</nowiki>
22310 !! html
22311 <p>{|
22312 |}
22313 </p>
22314 !! end
22315
22316 !! test
22317 Tables: 1b. No escaping needed
22318 !! wikitext
22319 !foo
22320 !! html
22321 <p>!foo
22322 </p>
22323 !! end
22324
22325 !! test
22326 Tables: 1c. No escaping needed
22327 !! wikitext
22328 |foo
22329 !! html
22330 <p>|foo
22331 </p>
22332 !! end
22333
22334 !! test
22335 Tables: 1d. No escaping needed
22336 !! wikitext
22337 |}foo
22338 !! html
22339 <p>|}foo
22340 </p>
22341 !! end
22342
22343 !! test
22344 Tables: 2a. Nested in td
22345 !! options
22346 parsoid=html2wt
22347 !! html/parsoid
22348 <table><tbody><tr>
22349 <td>foo|bar</td></tr>
22350 <tr><td>x<div>a|b</div></td>
22351 </tbody></table>
22352 !! wikitext
22353 {|
22354 |<nowiki>foo|bar</nowiki>
22355 |-
22356 |x<div><nowiki>a|b</nowiki></div>
22357 |}
22358 !! html/php+tidy
22359 <table>
22360 <tr>
22361 <td>foo|bar</td>
22362 </tr>
22363 <tr>
22364 <td>x
22365 <div>a|b</div>
22366 </td>
22367 </tr>
22368 </table>
22369 !! end
22370
22371 !! test
22372 Tables: 2b. Nested in td
22373 !! options
22374 parsoid=html2wt
22375 !! html/parsoid
22376 <table><tbody><tr>
22377 <td>foo||bar</td>
22378 <td>a<i>b||c</i></td>
22379 <td>a<i><div>b||c</div></i></td>
22380 </tr></tbody></table>
22381 !! wikitext
22382 {|
22383 |<nowiki>foo||bar</nowiki>
22384 |a''<nowiki>b||c</nowiki>''
22385 |a''<div><nowiki>b||c</nowiki></div>''
22386 |}
22387 !! html/php
22388 <table>
22389 <tr>
22390 <td>foo||bar
22391 </td>
22392 <td>a<i>b||c</i>
22393 </td>
22394 <td>a<i><div>b||c</div></i>
22395 </td></tr></table>
22396
22397 !! end
22398
22399 !! test
22400 Tables: 2c. Nested in td -- no escaping needed
22401 !! wikitext
22402 {|
22403
22404 |foo!!bar
22405 |}
22406 !! html/*
22407 <table>
22408
22409 <tr>
22410 <td>foo!!bar
22411 </td></tr></table>
22412
22413 !! end
22414
22415 !! test
22416 Tables: 3a. Nested in th
22417 !! wikitext
22418 {|
22419
22420 !foo!bar
22421 |}
22422 !! html/*
22423 <table>
22424
22425 <tr>
22426 <th>foo!bar
22427 </th></tr></table>
22428
22429 !! end
22430
22431 !! test
22432 Tables: 3b. Nested in th
22433 !! options
22434 parsoid=html2wt
22435 !! html/parsoid
22436 <table><tbody>
22437 <tr><th>foo!!bar</th>
22438 <th><i>foo|bar</i></th>
22439 <th><i>foo!!bar</i></th>
22440 <th><i><span>foo!!bar</span></i></th>
22441 </tr></tbody></table>
22442 !! wikitext
22443 {|
22444 !<nowiki>foo!!bar</nowiki>
22445 !''<nowiki>foo|bar</nowiki>''
22446 !''<nowiki>foo!!bar</nowiki>''
22447 !''<span><nowiki>foo!!bar</nowiki></span>''
22448 |}
22449 !! html/php
22450 <table>
22451 <tr>
22452 <th>foo!!bar
22453 </th>
22454 <th><i>foo|bar</i>
22455 </th>
22456 <th><i>foo!!bar</i>
22457 </th>
22458 <th><i><span>foo!!bar</span></i>
22459 </th></tr></table>
22460
22461 !! end
22462
22463 !! test
22464 Tables: 3c. Nested in th
22465 !! options
22466 parsoid=html2wt
22467 !! html/parsoid
22468 <table><tbody>
22469 <tr><th>foo||bar</th>
22470 <th><span typeof="mw:Nowiki">foo||bar</span></th>
22471 </tr></tbody></table>
22472 !! wikitext
22473 {|
22474 !<nowiki>foo||bar</nowiki>
22475 !<nowiki>foo||bar</nowiki>
22476 |}
22477 !! html/php
22478 <table>
22479 <tr>
22480 <th>foo||bar
22481 </th>
22482 <th>foo||bar
22483 </th></tr></table>
22484
22485 !! end
22486
22487 !! test
22488 Tables: 4a. Escape -
22489 !! options
22490 parsoid=html2wt
22491 !! html/*
22492 <table>
22493
22494 <tr>
22495 <th>-bar
22496 </th></tr>
22497 <tr>
22498 <td>-bar
22499 </td></tr></table>
22500
22501 !! wikitext
22502 {|
22503
22504 !-bar
22505
22506 |-
22507 |<nowiki>-bar</nowiki>
22508 |}
22509 !! end
22510
22511 !! test
22512 Tables: 4b. Escape +
22513 !! options
22514 parsoid=html2wt
22515 !! html/*
22516 <table>
22517
22518 <tr>
22519 <th>+bar
22520 </th></tr>
22521 <tr>
22522 <td>+bar
22523 </td></tr></table>
22524
22525 !! wikitext
22526 {|
22527
22528 !+bar
22529
22530 |-
22531 |<nowiki>+bar</nowiki>
22532 |}
22533 !! end
22534
22535 !! test
22536 Tables: 4c. No escaping needed
22537 !! wikitext
22538 {|
22539 |foo-bar
22540 |foo+bar
22541 |-
22542 |''foo''-bar
22543 |''foo''+bar
22544 |-
22545 |foo
22546 bar|baz
22547 +bar
22548 -bar
22549 |-
22550 |x
22551 <div>a|b</div>
22552 |}
22553 !! html/php
22554 <table>
22555 <tr>
22556 <td>foo-bar
22557 </td>
22558 <td>foo+bar
22559 </td></tr>
22560 <tr>
22561 <td><i>foo</i>-bar
22562 </td>
22563 <td><i>foo</i>+bar
22564 </td></tr>
22565 <tr>
22566 <td>foo
22567 <p>bar|baz
22568 +bar
22569 -bar
22570 </p>
22571 </td></tr>
22572 <tr>
22573 <td>x
22574 <div>a|b</div>
22575 </td></tr></table>
22576
22577 !! html/parsoid
22578 <table><tbody>
22579 <tr><td>foo-bar</td><td>foo+bar</td></tr>
22580 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
22581 <tr><td>foo
22582 <p>bar|baz
22583 +bar
22584 -bar</p></td></tr>
22585 <tr><td>x
22586 <div>a|b</div></td>
22587 </tbody></table>
22588 !! end
22589
22590 !! test
22591 Tables: 4d. No escaping needed
22592 !! wikitext
22593 {|
22594 |[[Foo]]-bar
22595 ||+1
22596 ||-2
22597 |}
22598 !! html/php
22599 <table>
22600 <tr>
22601 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
22602 </td>
22603 <td>+1
22604 </td>
22605 <td>-2
22606 </td></tr></table>
22607
22608 !! html/parsoid
22609 <table>
22610 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
22611 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
22612 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
22613 </tbody></table>
22614 !! end
22615
22616 !! test
22617 Tables: Digest broken attributes on table and tr tag
22618 !! options
22619 parsoid=wt2html
22620 !! wikitext
22621 {| || |} ++
22622 |- || || ++ --
22623 |- > [
22624 |}
22625 !! html
22626 <table>
22627 <tbody>
22628 <tr></tr>
22629 <tr></tr>
22630 </tbody></table>
22631 !! end
22632
22633 !! test
22634 T97430: Don't emit empty nowiki pairs around marker meta tags
22635 !! options
22636 parsoid=html2wt
22637 !! html/parsoid
22638 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
22639 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
22640 !! wikitext
22641 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
22642 <nowiki>|</nowiki>** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
22643 !! end
22644
22645 !! test
22646 Unclosed xmlish element in table line shouldn't eat end delimiters
22647 !! wikitext
22648 {|
22649 | <foo
22650 | bar>
22651 |}
22652 !! html/php
22653 <table>
22654 <tr>
22655 <td> &lt;foo
22656 </td>
22657 <td> bar&gt;
22658 </td></tr></table>
22659
22660 !! html/parsoid
22661 <table>
22662 <tbody><tr><td> &lt;foo</td>
22663 <td> bar></td></tr>
22664 </tbody></table>
22665 !! end
22666
22667 #### --------------- Links ----------------
22668 #### 1. Quote marks in link text
22669 #### 2. Wikilinks: Escapes needed
22670 #### 3. Wikilinks: No escapes needed
22671 #### 4. Extlinks: Escapes needed
22672 #### 5. Extlinks: No escapes needed
22673 #### --------------------------------------
22674 !! test
22675 Links 1. WikiLinks: No escapes needed
22676 !! wikitext
22677 [[Foo|Foo''boo'']]
22678 [[Foo|[Foobar]]]
22679 [[Foo|x [Foobar] x]]
22680 !! html/php
22681 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
22682 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
22683 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
22684 </p>
22685 !! html/parsoid
22686 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
22687 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
22688 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
22689 !! end
22690
22691 !! test
22692 Links 2. WikiLinks: Escapes needed
22693 !! options
22694 parsoid=html2wt
22695 !! html/parsoid
22696 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
22697 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
22698 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
22699 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
22700 <a href="Foo" rel="mw:WikiLink">|Bar</a>
22701 <a href="Foo" rel="mw:WikiLink">]]bar</a>
22702 <a href="Foo" rel="mw:WikiLink">[[bar</a>
22703 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
22704 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
22705 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
22706 !! wikitext
22707 [[Foo|<nowiki>Foobar]</nowiki>]]
22708 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
22709 [[Foo|<nowiki>[[Bar]]</nowiki>]]
22710 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
22711 [[Foo|<nowiki>|Bar</nowiki>]]
22712 [[Foo|<nowiki>]]bar</nowiki>]]
22713 [[Foo|<nowiki>[[bar</nowiki>]]
22714 [[Foo|<nowiki>x [[ y</nowiki>]]
22715 [[Foo|<nowiki>x ]] y</nowiki>]]
22716 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
22717 !! html/php
22718 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
22719 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
22720 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
22721 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
22722 <a href="/wiki/Foo" title="Foo">|Bar</a>
22723 <a href="/wiki/Foo" title="Foo">]]bar</a>
22724 <a href="/wiki/Foo" title="Foo">[[bar</a>
22725 <a href="/wiki/Foo" title="Foo">x [[ y</a>
22726 <a href="/wiki/Foo" title="Foo">x ]] y</a>
22727 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
22728 </p>
22729 !! end
22730
22731 !! test
22732 Links 3. WikiLinks: No escapes needed
22733 !! wikitext
22734 [[Foo|[Foobar]]
22735 [[Foo|foo|bar]]
22736 !! html/php
22737 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
22738 <a href="/wiki/Foo" title="Foo">foo|bar</a>
22739 </p>
22740 !! html/parsoid
22741 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
22742 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
22743 !! end
22744
22745 !! test
22746 Links 4. ExtLinks: Escapes needed
22747 !! options
22748 parsoid=html2wt
22749 !! html/parsoid
22750 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
22751 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
22752 <p>[http://google.com]</p>
22753 <p>[http://google.com google]</p>
22754 !! wikitext
22755 [http://google.com <nowiki>[google]</nowiki>]
22756 [http://google.com <nowiki>google]</nowiki>]
22757
22758 <nowiki>[http://google.com]</nowiki>
22759
22760 <nowiki>[http://google.com google]</nowiki>
22761
22762 !! html/php
22763 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
22764 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
22765 </p><p>[http://google.com]
22766 </p><p>[http://google.com google]
22767 </p>
22768 !! end
22769
22770 !! test
22771 Links 5. ExtLinks: No escapes needed
22772 !! wikitext
22773 [http://google.com [google]
22774 !! html/php
22775 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
22776 </p>
22777 !! html/parsoid
22778 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
22779 !! end
22780
22781 !! test
22782 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
22783 !! html/parsoid
22784 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
22785 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
22786 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
22787 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
22788 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
22789 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
22790 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
22791 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
22792 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
22793 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
22794 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
22795 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
22796 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
22797 </p>
22798 !! wikitext
22799 x<nowiki/>http://example.com<nowiki/>y
22800 http://example.com<nowiki/>?x
22801 http://example.com<nowiki/>&x
22802 http://example.com<nowiki/>'x
22803 http://example.com<nowiki/>,x
22804 http://example.com<nowiki/>.x
22805 http://example.com<nowiki/>;x
22806 http://example.com<nowiki/>:x
22807 http://example.com<nowiki/>;x
22808 http://example.com<nowiki/>!x
22809 http://example.com<nowiki/>=x
22810 http://example.com<nowiki/>(x)
22811 http://example.com(x<nowiki/>)
22812 !! end
22813
22814 !! test
22815 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
22816 !! html/parsoid
22817 <p>x
22818 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
22819 y
22820 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
22821 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
22822 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
22823 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
22824 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
22825 </p>
22826 !! wikitext
22827 x
22828 http://example.com
22829 y
22830 "http://example.com"
22831 (http://example.com)
22832 (http://example.com) foo
22833 http://example.com,
22834 http://example.com, foo
22835 !! html/php
22836 <p>x
22837 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
22838 y
22839 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
22840 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
22841 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
22842 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
22843 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
22844 </p>
22845 !! end
22846
22847 !! test
22848 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
22849 !! html/parsoid
22850 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
22851 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
22852 !! wikitext
22853 http://example.com.,;:!?\
22854 -http://example.com:
22855 !! html/php
22856 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
22857 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
22858 </p>
22859 !! end
22860
22861 !! test
22862 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
22863 !! html/parsoid
22864 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
22865 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
22866 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
22867 !! wikitext
22868 RFC 123<nowiki/>4
22869 RFC 123<nowiki/>y
22870 X<nowiki/>RFC 123<nowiki/>y
22871 !! end
22872
22873 !! test
22874 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
22875 !! html/parsoid
22876 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
22877 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
22878 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
22879 </p>
22880 !! wikitext
22881 RFC 123?foo
22882 RFC 123&foo
22883 -RFC 123-
22884 !! html/php
22885 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
22886 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
22887 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
22888 </p>
22889 !! end
22890
22891 !! test
22892 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
22893 !! html/parsoid
22894 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
22895 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
22896 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
22897 !! wikitext
22898 PMID 123<nowiki/>4
22899 PMID 123<nowiki/>y
22900 X<nowiki/>PMID 123<nowiki/>y
22901 !! end
22902
22903 !! test
22904 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
22905 !! html/parsoid
22906 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
22907 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
22908 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
22909 </p>
22910 !! wikitext
22911 PMID 123?foo
22912 PMID 123&foo
22913 -PMID 123-
22914 !! html/php
22915 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
22916 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
22917 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
22918 </p>
22919 !! end
22920
22921 !! test
22922 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
22923 !! html/parsoid
22924 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
22925 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
22926 a<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
22927 </p>
22928 !! wikitext
22929 ISBN 1234567890<nowiki/>1
22930 ISBN 1234567890<nowiki/>x
22931 a<nowiki/>ISBN 1234567890<nowiki/>b
22932 !! end
22933
22934 !! test
22935 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
22936 !! html/parsoid
22937 <p>-<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
22938 !! wikitext
22939 -ISBN 1234567890's
22940 !! html/php
22941 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
22942 </p>
22943 !! end
22944
22945 !! test
22946 Links 14. Protect link-like plain text. (Parsoid bug T78425)
22947 !! options
22948 parsoid=html2wt
22949 !! html/*
22950 <p>this is not a link: http://example.com
22951 </p>
22952 !! wikitext
22953 <nowiki>this is not a link: http://example.com</nowiki>
22954 !! end
22955
22956 !! test
22957 Links 15. Link trails can't become link prefixes.
22958 !! options
22959 language=is
22960 !! wikitext
22961 [[Söfnuður]]-[[00]]
22962 !! html/php
22963 <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>
22964 </p>
22965 !! html/parsoid
22966 <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>
22967 !! end
22968
22969 #### --------------- Quotes ---------------
22970 #### 1. Quotes inside <b> and <i>
22971 #### 2. Link fragments separated by <i> and <b> tags
22972 #### 3. Link fragments inside <i> and <b>
22973 #### 4. No escaping needed
22974 #### --------------------------------------
22975 !! test
22976 1a. Quotes inside <b> and <i>
22977 !! options
22978 parsoid=html2wt,wt2wt
22979 !! wikitext
22980 ''<nowiki/>'foo'''
22981 ''<nowiki>''foo''</nowiki>''
22982 ''<nowiki>'''foo'''</nowiki>''
22983 ''foo''<nowiki/>'s
22984 '''<nowiki/>'foo''''
22985 '''<nowiki>''foo''</nowiki>'''
22986 '''<nowiki>'''foo'''</nowiki>'''
22987 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
22988 '''foo'''<nowiki/>'s
22989 '''foo''
22990 ''foo''<nowiki/>'
22991 ''foo'''<nowiki/>'
22992 '''foo''<nowiki/>'
22993 ''''foo'''
22994 '''foo'''<nowiki/>'
22995 ''''foo'''<nowiki/>'
22996 ''fools'<span> errand</span>''
22997 ''<span>fool</span>'s errand''
22998 '<nowiki/>''foo'' bar '''baz''
22999 a|!*#-:;+-~[]{}b'''x''
23000 !! html/*
23001 <p><i>'foo'</i>
23002 <i>''foo''</i>
23003 <i>'''foo'''</i>
23004 <i>foo</i>'s
23005 <b>'foo'</b>
23006 <b>''foo''</b>
23007 <b>'''foo'''</b>
23008 <b>foo'<i>bar'</i>baz</b>
23009 <b>foo</b>'s
23010 '<i>foo</i>
23011 <i>foo</i>'
23012 <i>foo'</i>'
23013 '<i>foo</i>'
23014 '<b>foo</b>
23015 <b>foo</b>'
23016 '<b>foo</b>'
23017 <i>fools'<span> errand</span></i>
23018 <i><span>fool</span>'s errand</i>
23019 '<i>foo</i> bar '<i>baz</i>
23020 a|!*#-:;+-~[]{}b'<i>x</i>
23021 </p>
23022 !! end
23023
23024 !! test
23025 1b. Quotes inside <b> and <i> with other tags on same line
23026 !! options
23027 parsoid=html2wt,wt2wt
23028 !! wikitext
23029 '''a'' foo ''[[bar]]''
23030 ''a''' foo ''[[bar]]''
23031 ''a''' foo '''{{echo|[[bar]]}}'''
23032 [[foo]] x'''[[bar]]''
23033 '''foo'' <ref>test</ref>
23034 '''foo'' <div title="name">test</div>
23035 '''foo'' and <br> bar
23036 <references />
23037 !! html
23038 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23039 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23040 <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>
23041 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
23042 '<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>
23043 '<i>foo</i> <div title="name">test</div>
23044 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
23045 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
23046 <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>
23047 </ol>
23048 !! end
23049
23050 !! test
23051 2. Link fragments separated by <i> and <b> tags
23052 !! wikitext
23053 [[''foo''<nowiki>hello]]</nowiki>
23054
23055 [['''foo'''<nowiki>hello]]</nowiki>
23056 !! html
23057 <p>[[<i>foo</i>hello]]
23058 </p><p>[[<b>foo</b>hello]]
23059 </p>
23060 !! end
23061
23062 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
23063 # this is one of the shortcomings of this format
23064 !! test
23065 3. Link fragments inside <i> and <b>
23066 !! wikitext
23067 ''[[foo''<nowiki>]]</nowiki>
23068
23069 '''[[foo'''<nowiki>]]</nowiki>
23070 !! html
23071 <p><i>[[foo</i>]]
23072 </p><p><b>[[foo</b>]]
23073 </p>
23074 !! end
23075
23076 !! test
23077 4. No escaping needed
23078 !! wikitext
23079 '<span>''bar''</span>'
23080 '<span>'''bar'''</span>'
23081 'a:b'foo
23082 !! html
23083 <p>'<span><i>bar</i></span>'
23084 '<span><b>bar</b></span>'
23085 'a:b'foo
23086 </p>
23087 !! end
23088
23089 #### ----------- Paragraphs ---------------
23090 #### 1. No unnecessary escapes
23091 #### --------------------------------------
23092
23093 !! test
23094 1. No unnecessary escapes
23095 !! wikitext
23096 bar <span><nowiki>[[foo]]</nowiki></span>
23097
23098 =bar <span><nowiki>[[foo]]</nowiki></span>
23099
23100 [[bar <span><nowiki>[[foo]]</nowiki></span>
23101
23102 ]]bar <span><nowiki>[[foo]]</nowiki></span>
23103
23104 =bar <span>foo]]</span><nowiki>=</nowiki>
23105 !! html
23106 <p>bar <span>[[foo]]</span>
23107 </p><p>=bar <span>[[foo]]</span>
23108 </p><p>[[bar <span>[[foo]]</span>
23109 </p><p>]]bar <span>[[foo]]</span>
23110 </p><p>=bar <span>foo]]</span>=
23111 </p>
23112 !!end
23113
23114 #### ----------------------- PRE --------------------------
23115 #### 1. Leading whitespace in SOL context should be escaped
23116 #### ------------------------------------------------------
23117 !! test
23118 1. Leading whitespace in SOL context should be escaped
23119 !! options
23120 parsoid
23121 !! wikitext
23122 <nowiki> </nowiki>a
23123
23124 <nowiki> </nowiki> a
23125
23126 <nowiki> </nowiki>a(tab)
23127
23128 <nowiki> </nowiki> a
23129 <!--cmt-->
23130 <nowiki> </nowiki> a
23131
23132 a
23133 <nowiki> </nowiki>b
23134
23135 a
23136 <nowiki> </nowiki>b
23137
23138 a
23139 <nowiki> </nowiki> b
23140 !! html
23141 <p> a</p>
23142 <p> a</p>
23143 <p> a(tab)</p>
23144 <p> a</p>
23145 <p><!--cmt--> a</p>
23146 <p>a
23147 b</p>
23148 <p>a
23149 b</p>
23150 <p>a
23151 b</p>
23152 !! end
23153
23154 !! test
23155 2. Leading whitespace in non-indent-pre contexts should not be escaped
23156 !! options
23157 parsoid
23158 !! wikitext
23159 foo <ref>''a''
23160 b</ref>
23161 <references />
23162 !! html
23163 <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>
23164 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23165 <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>
23166 b</span></li>
23167 </ol>
23168 !! end
23169
23170 !! test
23171 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
23172 !! options
23173 parsoid
23174 !! wikitext
23175 <blockquote>
23176 a
23177 <span>b</span>
23178 c
23179 </blockquote>
23180 !! html
23181 <blockquote>
23182 <p>
23183 a
23184 <span>b</span>
23185 c</p>
23186 </blockquote>
23187 !! end
23188
23189 !! test
23190 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
23191 !! options
23192 parsoid
23193 !! wikitext
23194 [[File:Foobar.jpg|thumb|caption]]
23195 !! html/parsoid
23196 <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>
23197 !! end
23198
23199 !! test
23200 5. Nowiki escaping should account for indent-pres
23201 !! options
23202 parsoid=html2wt
23203 !! html/parsoid
23204 <pre>==foo==</pre>
23205 !! wikitext
23206 ==foo==
23207 !! end
23208
23209 !!test
23210 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
23211 !! options
23212 parsoid
23213 !! wikitext
23214 * foo
23215 * bar
23216 !! html
23217 <pre>
23218 * foo
23219 * bar
23220 </pre>
23221 !! end
23222
23223 #### --------------- Behavior Switches --------------------
23224
23225 !! test
23226 1. Valid behavior switches should be escaped
23227 !! options
23228 parsoid=html2wt
23229 !! html/parsoid
23230 __TOC__
23231 <i>__TOC__</i>
23232 !! wikitext
23233 <nowiki>__TOC__</nowiki>
23234 ''<nowiki>__TOC__</nowiki>''
23235 !! end
23236
23237 !! test
23238 2. Invalid behavior switches should not be escaped
23239 !! options
23240 parsoid=html2wt
23241 !! html/parsoid
23242 __TOO__
23243 __|__
23244 !! wikitext
23245 __TOO__
23246 __|__
23247 !! end
23248
23249 # We use indent-pre as an indirect way to test for sol-transparent behavior.
23250 !! test
23251 Behavior switches should be SOL-transparent
23252 !! wikitext
23253 __TOC__
23254
23255 <!-- this one's bogus -->
23256 __TOO__
23257
23258 __TOC__ foo
23259
23260 __TOC__ bar
23261 !! html/parsoid
23262 <meta property="mw:PageProp/toc" />
23263
23264 <!-- this one's bogus -->
23265 <pre>__TOO__</pre>
23266
23267 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
23268
23269 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
23270 !! end
23271
23272 #### --------------- HTML tags ---------------
23273 #### 1. a tags
23274 #### 2. other tags
23275 #### 3. multi-line html tag
23276 #### 4. extension tags
23277 #### -----------------------------------------
23278 !! test
23279 1. a tags
23280 !! options
23281 parsoid
23282 !! wikitext
23283 <a href="http://google.com">google</a>
23284 !! html
23285 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
23286 !! end
23287
23288 !! test
23289 2. other tags
23290 !! wikitext
23291 * <nowiki><div>foo</div></nowiki>
23292 * <nowiki><div style="color:red">foo</div></nowiki>
23293 * <nowiki><td></nowiki>
23294 !! html
23295 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
23296 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
23297 <li> &lt;td&gt;</li></ul>
23298
23299 !! end
23300
23301 !! test
23302 3. multi-line html tag
23303 !! wikitext
23304 <nowiki><div
23305 >foo</div
23306 ></nowiki>
23307 !! html
23308 <p>&lt;div
23309 &gt;foo&lt;/div
23310 &gt;
23311 </p>
23312 !! end
23313
23314 !! test
23315 4. extension tags
23316 !! wikitext
23317 <nowiki><ref>foo</ref></nowiki>
23318
23319 <nowiki><ref>bar</nowiki>
23320
23321 baz<nowiki></ref></nowiki>
23322 !! html
23323 <p>&lt;ref&gt;foo&lt;/ref&gt;
23324 </p><p>&lt;ref&gt;bar
23325 </p><p>baz&lt;/ref&gt;
23326 </p>
23327 !! end
23328
23329 #### --------------- Others ---------------
23330 !! test
23331 Escaping nowikis
23332 !! wikitext
23333 &lt;nowiki&gt;foo&lt;/nowiki&gt;
23334 !! html
23335 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
23336 </p>
23337 !! end
23338
23339 ## The quote-char in the input is necessary for triggering the bug
23340 !! test
23341 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
23342 !! options
23343 parsoid=wt2wt,html2wt
23344 !! wikitext
23345 foo's bar :
23346 !! html
23347 <p>foo's bar :</p>
23348 !! end
23349
23350 !! test
23351
23352 Tag-like HTML structures are passed through as text
23353 !! wikitext
23354 <x y>
23355
23356 <x.y>
23357
23358 <x-y>
23359
23360 1>2
23361
23362 x<y
23363
23364 a>b
23365
23366 1<d e>f
23367 !! html
23368 <p>&lt;x y&gt;
23369 </p><p>&lt;x.y&gt;
23370 </p><p>&lt;x-y&gt;
23371 </p><p>1&gt;2
23372 </p><p>x&lt;y
23373 </p><p>a&gt;b
23374 </p><p>1&lt;d e&gt;f
23375 </p>
23376 !! end
23377
23378 !! test
23379 HTML tag with necessary entities in attributes
23380 !! wikitext
23381 <span title="&amp;amp;">foo</span>
23382 !! html
23383 <p><span title="&amp;amp;">foo</span>
23384 </p>
23385 !! end
23386
23387 !! test
23388 HTML tag with 'unnecessary' entity encoding in attributes
23389 !! wikitext
23390 <span title="&amp;">foo</span>
23391 !! html
23392 <p><span title="&amp;">foo</span>
23393 </p>
23394 !! end
23395
23396 !! test
23397 HTML tag with broken attribute value quoting
23398 !! wikitext
23399 <span title="Hello world>Foo</span>
23400 !! html/php
23401 <p><span>Foo</span>
23402 </p>
23403 !! html/parsoid
23404 <p><span title="Hello world">Foo</span>
23405 </p>
23406 !! end
23407
23408 !! test
23409 Parsoid-only: HTML tag with broken attribute value quoting
23410 !! options
23411 parsoid
23412 !! wikitext
23413 <span title="Hello world>Foo</span>
23414 !! html
23415 <p><span title="Hello world">Foo</span>
23416 </p>
23417 !! end
23418
23419 !! test
23420 Table with broken attribute value quoting
23421 !! wikitext
23422 {|
23423 | title="Hello world|Foo
23424 |}
23425 !! html/php
23426 <table>
23427 <tr>
23428 <td>Foo
23429 </td></tr></table>
23430
23431 !! html/parsoid
23432 <table>
23433 <tr>
23434 <td title="Hello world">Foo
23435 </td></tr></table>
23436
23437 !! end
23438
23439 !! test
23440 Table with broken attribute value quoting on consecutive lines
23441 !! wikitext
23442 {|
23443 | title="Hello world|Foo
23444 | style="color:red|Bar
23445 |}
23446 !! html/php
23447 <table>
23448 <tr>
23449 <td>Foo
23450 </td>
23451 <td>Bar
23452 </td></tr></table>
23453
23454 !! html/parsoid
23455 <table><tbody>
23456 <tr>
23457 <td title="Hello world">Foo
23458 </td><td style="color: red">Bar
23459 </td></tr></tbody></table>
23460
23461 !! end
23462
23463 !! test
23464 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23465 !! options
23466 parsoid
23467 !! wikitext
23468 {{}}
23469 !! html
23470 {{}}
23471 !! end
23472
23473 !! test
23474 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23475 !! options
23476 parsoid
23477 !! wikitext
23478 }}{{
23479 !! html
23480 }}{{
23481 !! end
23482
23483 !!test
23484 Accept empty td cell attribute
23485 !! wikitext
23486 {|
23487 | align="center" | foo || |
23488 |}
23489 !! html
23490 <table>
23491 <tr>
23492 <td align="center"> foo </td>
23493 <td>
23494 </td></tr></table>
23495
23496 !!end
23497
23498 !!test
23499 Non-empty attributes in th-cells
23500 !! wikitext
23501 {|
23502 ! Foo !! style="color: red" | Bar
23503 |}
23504 !! html
23505 <table>
23506 <tr>
23507 <th> Foo </th>
23508 <th style="color: red"> Bar
23509 </th></tr></table>
23510
23511 !!end
23512
23513 !!test
23514 Accept empty attributes in th-cells
23515 !! wikitext
23516 {|
23517 !| foo !!| bar
23518 |}
23519 !! html
23520 <table>
23521 <tr>
23522 <th> foo </th>
23523 <th> bar
23524 </th></tr></table>
23525
23526 !!end
23527
23528 !!test
23529 Empty table rows go away
23530 !! wikitext
23531 {|
23532 | Hello
23533 | there
23534 |- class="foo"
23535 |-
23536 |}
23537 !! html
23538 <table>
23539 <tr>
23540 <td> Hello
23541 </td>
23542 <td> there
23543 </td></tr>
23544
23545 </table>
23546
23547 !! end
23548
23549 ###
23550 ### Parsoid-centric tests for testing RTing of inter-element separators
23551 ### Edge cases not tested by existing parser tests and specific to
23552 ### Parsoid-specific serialization strategies.
23553 ###
23554
23555 !!test
23556 RT-ed inter-element separators should be valid separators
23557 !! wikitext
23558 {|
23559 |- [[foo]]
23560 |}
23561 !! html
23562 <table>
23563
23564 </table>
23565
23566 !!end
23567
23568 # Parsoid-only since PHP parser relies on Tidy for correct output
23569 !!test
23570 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
23571 !!options
23572 parsoid
23573 !! wikitext
23574 {|
23575 |<small>foo
23576 bar
23577 |}
23578
23579 {|
23580 |<small>foo<small>
23581 |}
23582 !! html
23583 <table>
23584 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
23585 <p>bar</p></small></td></tr>
23586 </tbody></table>
23587
23588 <table>
23589 <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>
23590 </tbody></table>
23591 !!end
23592
23593 # Note that the "style" attribute is really a template parameter here.
23594 # The = would have to be {{=}} if you wanted the literal.
23595 !!test
23596 Empty TD followed by TD with tpl-generated attribute
23597 !! wikitext
23598 {|
23599 |-
23600 |
23601 |{{echo|style='color:red'}}|foo
23602 |}
23603 !! html
23604 <table>
23605
23606 <tr>
23607 <td>
23608 </td>
23609 <td>foo
23610 </td></tr></table>
23611
23612 !!end
23613
23614 !!test
23615 Indented table with an empty td
23616 !! wikitext
23617 {|
23618 |-
23619 |
23620 |foo
23621 |}
23622 !! html
23623 <table>
23624
23625 <tr>
23626 <td>
23627 </td>
23628 <td>foo
23629 </td></tr></table>
23630
23631 !!end
23632
23633 ## We have some newline diffs RT-ing this edge case
23634 ## and it is not important enough -- we seem to be emitting
23635 ## at most 2 newlines after a </tr> and this is unrelated to
23636 ## the issue from T85627 that this is testing.
23637 !!test
23638 Indented table with blank lines in between (T85627)
23639 !! options
23640 parsoid=wt2html
23641 !! wikitext
23642 {|
23643 |foo
23644
23645
23646 |}
23647 !! html
23648 <table>
23649
23650 <tr>
23651 <td>foo
23652 </td></tr></table>
23653
23654 !!end
23655
23656 !!test
23657 Indented block & table
23658 !! wikitext
23659 <div>foo</div>
23660 {|
23661 |foo
23662 |}
23663 !! html/php
23664 <div>foo</div>
23665 <table>
23666 <tr>
23667 <td>foo
23668 </td></tr></table>
23669
23670 !! html/parsoid
23671 <div data-parsoid='{"stx":"html"}'>foo</div>
23672 <table><tbody>
23673 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
23674 </tbody></table>
23675 !!end
23676
23677 !! test
23678 Indent and comment before table row
23679 !! wikitext
23680 {|
23681 <!--hi-->|-
23682 | there
23683 |}
23684 !! html/php
23685 <table>
23686
23687 <tr>
23688 <td> there
23689 </td></tr></table>
23690
23691 !! html/parsoid
23692 <table>
23693 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
23694 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
23695 </tbody></table>
23696 !! end
23697
23698 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
23699 !!test
23700 Empty TR followed by a template-generated TR
23701 !!options
23702 parsoid
23703 !! wikitext
23704 {|
23705 |-
23706 {{echo|<tr><td>foo</td></tr>}}
23707 |}
23708 !! html
23709 <table>
23710 <tbody>
23711 <tr></tr>
23712 <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}}]}'>
23713 <td>foo</td></tr>
23714 </tbody></table>
23715 !!end
23716
23717 ## PHP and parsoid output differ for this, and since this is primarily
23718 ## for testing Parsoid's serializer, marking this Parsoid only
23719 !!test
23720 Empty TR followed by mixed-ws-comment line should RT correctly
23721 !!options
23722 parsoid
23723 !! wikitext
23724 {|
23725 |-
23726 <!--c-->
23727 |-
23728 <!--c--> <!--d-->
23729 |}
23730 !! html
23731 <table>
23732 <tbody>
23733 <tr></tr>
23734 <!--c-->
23735 <tr>
23736 <!--c--> </tr><!--d-->
23737 </tbody></table>
23738
23739 !!end
23740
23741 !!test
23742 Multi-line image caption generated by templates with/without trailing newlines
23743 !! wikitext
23744 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
23745 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
23746 !! html/parsoid
23747 <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>
23748 <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>
23749 !!end
23750
23751 !! test
23752 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
23753 !! options
23754 parsoid=html2wt
23755 !! html/parsoid
23756 <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>
23757
23758 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
23759 !! wikitext
23760 <includeonly>foo</includeonly>
23761 new para
23762
23763 [[Category:Foo]]
23764
23765 = new heading =
23766 !! end
23767
23768 ## PHP emits broken html for this, and since this is primarily
23769 ## a Parsoid serializer test, marking this Parsoid only
23770 !!test
23771 Improperly nested inline or quotes tags with whitespace in between
23772 !! wikitext
23773 <span> <s>x</span> </s>
23774 ''' ''x''' ''
23775 !! html/parsoid
23776 <p><span> <s>x</s></span><s> </s>
23777 <b> <i>x</i></b><i> </i>
23778 </p>
23779 !!end
23780
23781 !!test
23782 Encapsulate protected attributes from wt
23783 !! wikitext
23784 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
23785 !! html/parsoid
23786 <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>
23787 </body>
23788 !!end
23789
23790 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
23791 ## Having nested or stray pre tags results in the attempt to add duplicates,
23792 ## causing an assertion fail. This test tries to prevent that situation.
23793 !!test
23794 Ensure ParagraphWrapper can deal with stray closing pre tags
23795 !!options
23796 parsoid=wt2html
23797 !! wikitext
23798 plain text</pre>
23799 !! html/parsoid
23800 plain text
23801 !!end
23802
23803 !!test
23804 1. Ensure fostered text content is wrapped in element nodes
23805 !!options
23806 parsoid=wt2html
23807 !! wikitext
23808 <table>hi</table><table>ho</table>
23809 !! html/parsoid
23810 <p>hi</p>
23811 <table></table>
23812 <p>ho</p>
23813 <table></table>
23814 !!end
23815
23816 !!test
23817 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
23818 !!options
23819 parsoid=wt2html,wt2wt
23820 !! wikitext
23821 <table>
23822 <tr> || ||
23823 <td> a
23824 </table>
23825 !! html/parsoid
23826 <p> || ||
23827 </p><table>
23828 <tbody><tr><td> a</td></tr>
23829 </tbody></table>
23830 !!end
23831
23832 !!test
23833 Encapsulation properly handles null DSR information from foster box
23834 !!options
23835 parsoid=wt2html,wt2wt
23836 !! wikitext
23837 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
23838 !! html/parsoid
23839 <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>
23840 !!end
23841
23842 !!test
23843 1. Encapsulate foster-parented transclusion content
23844 !!options
23845 parsoid=wt2wt,wt2html
23846 !! wikitext
23847 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
23848 !! html/parsoid
23849 <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>
23850 <tbody>
23851 <tr>
23852 <td>bar</td>
23853 </tr>
23854 </tbody>
23855 </table>
23856 !!end
23857
23858 !!test
23859 2. Encapsulate foster-parented transclusion content
23860 !!options
23861 parsoid=wt2wt,wt2html
23862 !! wikitext
23863 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
23864 !! html/parsoid
23865 <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>
23866 <table>
23867 <tbody>
23868 <tr>
23869 <td>bar</td>
23870 </tr>
23871 </tbody>
23872 </table>
23873 !!end
23874
23875 !!test
23876 3. Encapsulate foster-parented transclusion content
23877 !!options
23878 parsoid=wt2wt,wt2html
23879 !! wikitext
23880 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
23881 !! html/parsoid
23882 <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;]}">
23883 <p>foo</p>
23884 </div>
23885 <table>
23886 <tbody>
23887 <tr>
23888 <td>bar</td>
23889 </tr>
23890 </tbody>
23891 </table>
23892 !!end
23893
23894 !!test
23895 4. Encapsulate foster-parented transclusion content
23896 !!options
23897 parsoid=wt2wt,wt2html
23898 !! wikitext
23899 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
23900 !! html/parsoid
23901 <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;]}">
23902 <p>foo</p>
23903 </div>
23904 <table>
23905 <tbody>
23906 <tr>
23907 <td>bar</td>
23908 </tr>
23909 </tbody>
23910 </table>
23911 !!end
23912
23913 !!test
23914 5. Encapsulate foster-parented transclusion content
23915 !!options
23916 parsoid=wt2wt,wt2html
23917 !! wikitext
23918 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
23919 !! html/parsoid
23920 <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>
23921 <table>
23922 <tbody>
23923 <tr>
23924 <td>
23925 <div>
23926 <p>foo</p>
23927 </div>
23928 </td>
23929 </tr>
23930 </tbody>
23931 </table>
23932 !!end
23933
23934 !!test
23935 6. Encapsulate foster-parented transclusion content
23936 !!options
23937 parsoid=wt2wt,wt2html
23938 !! wikitext
23939 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
23940 !! html/parsoid
23941 <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>
23942 <table>
23943 <tbody>
23944 <tr>
23945 <td>
23946 <div>
23947 <p>foo</p>
23948 </div>
23949 </td>
23950 </tr>
23951 </tbody>
23952 </table>
23953 <p>ok</p>
23954 !!end
23955
23956 !!test
23957 7. Encapsulate foster-parented transclusion content
23958 !!options
23959 parsoid=wt2wt,wt2html
23960 !! wikitext
23961 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
23962 !! html/parsoid
23963 <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>
23964 <table>
23965 <tbody>
23966 <tr>
23967 <td>bar</td>
23968 </tr>
23969 </tbody>
23970 </table>
23971 !!end
23972
23973 # Note that the wt is broken on purpose: the = should be {{=}} if you
23974 # don't want it to be a template parameter key.
23975 !!test
23976 8. Encapsulate foster-parented transclusion content
23977 !!options
23978 parsoid=wt2wt,wt2html
23979 !! wikitext
23980 {{echo|a
23981 }}{|{{echo|style='color:red'}}
23982 |-
23983 |b
23984 |}
23985 !! html/parsoid
23986 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
23987 <span> </span>
23988 <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>
23989 <table>
23990 <tbody>
23991 <tr>
23992 <td>b</td>
23993 </tr>
23994 </tbody>
23995 </table>
23996 !!end
23997
23998 !!test
23999 9. Encapsulate foster-parented transclusion content
24000 !!options
24001 parsoid=wt2wt,wt2html
24002 !! wikitext
24003 <table>{{echo|hi</table>hello}}
24004 !! html/parsoid
24005 <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>
24006 !!end
24007
24008 !!test
24009 Table in fosterable position
24010 !!options
24011 parsoid=wt2html,wt2wt
24012 !! wikitext
24013 {{OpenTable}}
24014 <div>
24015 {|
24016 |}
24017 </div>
24018 |}
24019 !! html/parsoid
24020 <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">
24021 </span>
24022 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
24023
24024 <table>
24025 </table>
24026 !!end
24027
24028 # Parsoid only for bug 64747
24029 !! test
24030 Properly encapsulate empty-content transclusions in fosterable positions
24031 !! wikitext
24032 <table>
24033 {{#if:|
24034 <td>foo</td>
24035 }}
24036 </table>
24037 !! html/parsoid
24038 <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":["","","",""]}]]}'>
24039
24040 </table>
24041 !! end
24042
24043 !!test
24044 Support <object> element with .data attribute
24045 !!options
24046 parsoid=html2wt
24047 !! html/parsoid
24048 <object data="test.swf"></object>
24049 !! wikitext
24050 <object data="test.swf"></object>
24051 !!end
24052
24053 !! test
24054 Don't block XML namespace declaration
24055 !! wikitext
24056 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24057 !! html/php
24058 <p><span>MediaWiki</span>
24059 </p>
24060 !! html/parsoid
24061 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
24062 !! end
24063
24064 # -----------------------------------------------------------------
24065 # The following section of tests are primarily to spec requirements
24066 # around serialization of new/edited content.
24067 #
24068 # All these tests are marked Parsoid html2wt and html2html only
24069 # ----------------------------------------------------------------
24070
24071 # 'mi' is a localinterwiki prefix as well as a language
24072 !! test
24073 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
24074 !! options
24075 parsoid=html2wt
24076 !! html/parsoid
24077 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
24078 !! wikitext
24079 [[Foo]]
24080 !! end
24081
24082 # See T93839
24083 !! test
24084 New wikilinks should be serialized properly
24085 !! options
24086 parsoid=html2wt
24087 !! html/parsoid
24088 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
24089 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
24090 !! wikitext
24091 [[Foo]]
24092 [[Foo]]
24093 !! end
24094
24095 !! test
24096 New wiki links (href variations)
24097 !! options
24098 parsoid=html2wt
24099 !! html/parsoid
24100 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24101 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
24102 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
24103 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
24104 !! wikitext
24105 [[Foo_bar]]
24106 [[Foo_bar]]
24107 [[Foo_bar]]
24108 [[Toxine bactérienne]]
24109 !! end
24110
24111 !! test
24112 New wiki links (content string variations)
24113 !! options
24114 parsoid=html2wt
24115 !! html/parsoid
24116 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24117 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
24118 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
24119 !! wikitext
24120 [[Foo_bar]]
24121 [[Foo bar]]
24122 [[Foo_bar|./Foo_bar]]
24123 !! end
24124
24125 !! test
24126 New category links (href variations)
24127 !! options
24128 parsoid=html2wt
24129 !! html/parsoid
24130 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
24131 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
24132 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
24133 !! wikitext
24134 [[Category:Toxine bactérienne]]
24135 [[Category:Toxine bactérienne]]
24136 [[Category:Toxine bactérienne]]
24137 !! end
24138
24139 !! test
24140 New sol transparent links don't need indent-pre nowiki protection
24141 !! options
24142 parsoid=html2wt
24143 language=de
24144 !! html/parsoid
24145 <link rel="mw:PageProp/redirect" href="./Main_Page">
24146 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
24147 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
24148 !! wikitext
24149 #WEITERLEITUNG [[Main Page]]
24150 <!-- this is good --> [[Category:Good]]
24151 <!-- this is great --> [[Kategorie:Great]]
24152 !! end
24153
24154 !! test
24155 New interlanguage links (href variations)
24156 !! options
24157 parsoid=html2wt
24158 !! html/parsoid
24159 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
24160 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
24161 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
24162 !! wikitext
24163 [[es:Toxine bactérienne]]
24164 [[es:Toxine_bactérienne]]
24165 [[es:Toxine_bactérienne]]
24166 !! end
24167
24168 !! test
24169 Image: Modifying size of an image (1)
24170 !! options
24171 parsoid={
24172 "modes": ["wt2wt"],
24173 "changes": [
24174 ["img[height]", "attr", "height", "22"],
24175 ["img[width]", "attr", "width", "200"]
24176 ]
24177 }
24178 !! wikitext
24179 [[Image:Foobar.jpg|230x230px]]
24180 !! wikitext/edited
24181 [[Image:Foobar.jpg|200x200px]]
24182 !!end
24183
24184 !! test
24185 Image: Modifying size of an image (2)
24186 !! options
24187 parsoid={
24188 "modes": ["wt2wt"],
24189 "changes": [
24190 ["img[height]", "attr", "height", "100"],
24191 ["img[width]", "attr", "width", "500"]
24192 ]
24193 }
24194 !! wikitext
24195 [[Image:Foobar.jpg|230x230px]]
24196 !! wikitext/edited
24197 [[Image:Foobar.jpg|500x500px]]
24198 !!end
24199
24200 # Change in size is ignored so long as class='mw-default-size'
24201 !! test
24202 Image: Modifying size of an image (3)
24203 !! options
24204 parsoid={
24205 "modes": ["wt2wt"],
24206 "changes": [
24207 ["figure[class]", "removeClass", "mw-default-size"],
24208 ["figure img", "attr", "height", "19"],
24209 ["figure img", "attr", "width", "170"]
24210 ]
24211 }
24212 !! wikitext
24213 [[Image:Foobar.jpg|thumb]]
24214 !! wikitext/edited
24215 [[Image:Foobar.jpg|thumb|170x170px]]
24216 !!end
24217
24218 !! test
24219 Image: Modifying alignment of an image (bug 48665)
24220 !! options
24221 parsoid={
24222 "modes": ["wt2wt"],
24223 "changes": [
24224 ["figure[class]", "removeClass", "mw-halign-right"],
24225 ["figure[class]", "addClass", "mw-halign-left"]
24226 ]
24227 }
24228 !! wikitext
24229 [[Image:Foobar.jpg|thumb|caption|right]]
24230 !! wikitext/edited
24231 [[Image:Foobar.jpg|thumb|caption|left]]
24232 !! end
24233
24234 !! test
24235 Image: Modifying mw-default-size of an frameless image (bug 62805)
24236 !! options
24237 parsoid={
24238 "modes": ["wt2wt"],
24239 "changes": [
24240 ["figure.mw-default-size", "removeClass", "mw-default-size"]
24241 ]
24242 }
24243 !! wikitext
24244 [[Image:Foobar.jpg|frameless|right]]
24245 !! wikitext/edited
24246 [[Image:Foobar.jpg|frameless|right|220x220px]]
24247 !! end
24248
24249 !! test
24250 Image: Modifying valign of an image (bug 49221)
24251 !! options
24252 parsoid={
24253 "modes": ["wt2wt"],
24254 "changes": [
24255 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
24256 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
24257 ]
24258 }
24259 !! wikitext
24260 [[File:Foobar.jpg|20px|middle]]
24261 !! wikitext/edited
24262 [[File:Foobar.jpg|20px|text-top]]
24263 !! end
24264
24265 !! test
24266 Image: Modifying alt attribute of an image (bug 56400)
24267 !! options
24268 parsoid={
24269 "modes": ["wt2wt"],
24270 "changes": [
24271 ["img[alt]", "attr", "alt", "some alternate edited text"]
24272 ]
24273 }
24274 !! wikitext
24275 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
24276 !! wikitext/edited
24277 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
24278 !!end
24279
24280 !! test
24281 Image: Modifying caption of an image
24282 !! options
24283 parsoid={
24284 "modes": ["wt2wt"],
24285 "changes": [
24286 ["figcaption", "text", "new caption"]
24287 ]
24288 }
24289 !! wikitext
24290 [[Image:Foobar.jpg|thumb|original caption]]
24291 !! wikitext/edited
24292 [[Image:Foobar.jpg|thumb|new caption]]
24293 !!end
24294
24295 !! test
24296 Image: empty alt attribute (bug 48924)
24297 !! options
24298 parsoid
24299 !! wikitext
24300 [[File:Foobar.jpg|thumb|alt=|bar]]
24301 !! html
24302 <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>
24303 !! end
24304
24305 !! test
24306 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
24307 !! options
24308 parsoid=html2wt
24309 language=ar
24310 disabled
24311 !! html/parsoid
24312 <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>
24313 !! wikitext
24314 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
24315 !! end
24316
24317 !! test
24318 Image: Block level image should have \n before and after
24319 !! wikitext
24320 123
24321 [[File:Foobar.jpg|right|thumb|150x150px]]
24322 456
24323 !! html/parsoid
24324 <p>123</p>
24325 <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>
24326 <p>456</p>
24327 !!end
24328
24329 !! test
24330 Image: New block level image should have \n before and after (existing content)
24331 !! wikitext
24332 123
24333 [[File:Foobar.jpg|right|thumb|150x150px]]
24334 456
24335 !! html/parsoid
24336 <p>123</p>
24337 <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>
24338 <p>456</p>
24339 !!end
24340
24341 !! test
24342 Image: upright option (parsoid)
24343 !! wikitext
24344 [[File:Foobar.jpg|thumb|upright|caption]]
24345 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
24346 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
24347 !! html/parsoid
24348 <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>
24349 <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>
24350 <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>
24351 !!end
24352
24353 !! test
24354 Image: upright option is ignored on inline and frame images (parsoid)
24355 !! wikitext
24356 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
24357 !! html/parsoid
24358 <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>
24359 !!end
24360
24361 !! test
24362 Image: from basic HTML (1)
24363 !! options
24364 parsoid=html2wt
24365 !! html/parsoid
24366 <span typeof="mw:Image">
24367 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24368 </span>
24369 !! wikitext
24370 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24371 !! end
24372
24373 !! test
24374 Image: from basic HTML (2)
24375 !! options
24376 parsoid=html2wt
24377 !! html/parsoid
24378 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24379 !! wikitext
24380 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24381 !! end
24382
24383 !! test
24384 Image: from basic HTML (3)
24385 !! options
24386 parsoid=html2wt
24387 !! html/parsoid
24388 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
24389 !! wikitext
24390 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
24391 !! end
24392
24393 !! test
24394 Image: from basic HTML (4)
24395 !! options
24396 parsoid=html2wt
24397 !! html/parsoid
24398 <img src="./File:Foobar.jpg">
24399 !! wikitext
24400 [[File:Foobar.jpg|link=]]
24401 !! end
24402
24403 !! test
24404 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
24405 !! options
24406 parsoid=html2wt
24407 !! html/parsoid
24408 <ul>
24409 <li><p>foo</p></li>
24410 </ul>
24411 !! wikitext
24412 * foo
24413 !! end
24414
24415 !! test
24416 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
24417 !! options
24418 parsoid=html2wt
24419 !! html/parsoid
24420 <ul> <li>foo</li></ul>
24421 !! wikitext
24422 * foo
24423 !! end
24424
24425 !! test
24426 Don't strip leading whitespace when handling indent-pre suppressing tags
24427 !! options
24428 parsoid=html2wt
24429 !! html/parsoid
24430 <table>
24431 <tr><td> indented row</td></tr>
24432 </table>
24433 <blockquote><p>
24434 <b>This is very bold of you!</b>
24435 </p>
24436 <table><tr><td>
24437 indented cell (no pre-wrapping!)
24438 </td></tr></table>
24439 </blockquote>
24440 <p>foo</p>
24441 <div>bar</div>
24442 !! wikitext
24443 {|
24444 | indented row
24445 |}
24446 <blockquote>
24447 '''This is very bold of you!'''
24448
24449 {|
24450 |
24451 indented cell (no pre-wrapping!)
24452 |}
24453 </blockquote>
24454 foo
24455 <div>bar</div>
24456 !! end
24457
24458 !! test
24459 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
24460 !! options
24461 parsoid=html2wt
24462 !! html/parsoid
24463 <p>foo</p>
24464 <span>bar</span>
24465
24466 <span>foo2
24467 </span>bar2
24468
24469 <div>foo</div>
24470 <span>bar</span>
24471
24472 <div>
24473 <span>foo</span>
24474 </div>
24475 !! wikitext
24476 foo
24477 <nowiki> </nowiki><span>bar</span>
24478
24479 <span>foo2
24480 <nowiki> </nowiki></span>bar2
24481
24482 <div>foo</div>
24483 <nowiki> </nowiki><span>bar</span>
24484
24485 <div>
24486 <nowiki> </nowiki><span>foo</span>
24487 </div>
24488 !! end
24489
24490 !! test
24491 Lists: Dont insert newlines in a serialized list item.
24492 !! options
24493 parsoid=html2wt
24494 !! html/parsoid
24495 <ul><li>a<br>b</li><li>c</li></ul>
24496 !! wikitext
24497 * a<br>b
24498 * c
24499 !! end
24500
24501 !! test
24502 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
24503 !! options
24504 parsoid={
24505 "modes": ["html2wt"],
24506 "scrubWikitext": false
24507 }
24508 !! html/parsoid
24509 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
24510 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
24511
24512 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
24513 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
24514
24515 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
24516
24517 <h2><meta property="mw:PageProp/toc" /> ok</h2>
24518 !! wikitext
24519 == hello there [[Category:A1]] ==
24520
24521 == [[Category:A2]] hi pal ==
24522
24523 == <!--foo--> [[Category:A3]] how goes it ==
24524
24525 == it goes well [[Category:A4]] <!--bar--> ==
24526
24527 ==howdy [[Category:A5]] ==
24528
24529 == __TOC__ ok ==
24530 !! end
24531
24532 !! test
24533 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
24534 !! options
24535 parsoid={
24536 "modes": ["html2wt"],
24537 "scrubWikitext": true
24538 }
24539 !! html/parsoid
24540 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
24541 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
24542
24543 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
24544 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
24545
24546 <h2><meta property="mw:PageProp/toc" /> ok</h2>
24547 !! wikitext
24548 == hello there ==
24549 [[Category:A1]]
24550 [[Category:A2]]
24551
24552 == hi pal ==
24553
24554 <!--foo--> [[Category:A3]]
24555
24556 == how goes it ==
24557
24558 == it goes well ==
24559 [[Category:A4]] <!--bar-->
24560
24561 __TOC__
24562
24563 == ok ==
24564 !! end
24565
24566 !! test
24567 Headings: Don't hoist metas that come from templates
24568 !! options
24569 parsoid={
24570 "modes": ["html2wt"],
24571 "scrubWikitext": true
24572 }
24573 !! html/parsoid
24574 <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>
24575 !! wikitext
24576 == {{echo|foo [[Category:Foo]]}} ==
24577 !! end
24578
24579 !! test
24580 Headings: Category in ref isn't hoisted
24581 !! options
24582 parsoid={
24583 "modes": ["html2wt"],
24584 "scrubWikitext": true
24585 }
24586 !! html/parsoid
24587 <h2> 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> </h2>
24588
24589 <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>
24590 !! wikitext
24591 == foo <ref>bar
24592 [[Category:Baz]] </ref> ==
24593
24594 <references />
24595 !! end
24596
24597 !! test
24598 Parsoid: Serialize positional parameters with = in them as named parameter
24599 !! options
24600 parsoid=html2wt
24601 !! html/parsoid
24602 <p about="#mwt1" typeof="mw:Transclusion"
24603 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
24604
24605 <p about="#mwt1" typeof="mw:Transclusion"
24606 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
24607
24608 <!--Orig params with data-parsoid has heuristics for handling = chars-->
24609 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
24610 <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>
24611 !! wikitext
24612 {{echo|1 = f=oo}}
24613
24614 {{echo|1 = f=oo|2 = bar}}
24615
24616 <!--Orig params with data-parsoid has heuristics for handling = chars-->
24617 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
24618 {{echo|<nowiki>f=oo</nowiki>|bar}}
24619 !! end
24620
24621 !! test
24622 Parsoid: Serialize positional parameters with = in extlink as named parameter
24623 !! options
24624 parsoid=html2wt
24625 !! html/parsoid
24626 <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>
24627 !! wikitext
24628 {{echo|1 = http://stuff?is=ok}}
24629 !! end
24630
24631 !! test
24632 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
24633 !! options
24634 parsoid=html2wt
24635 !! html/parsoid
24636 <div>a<p>b</p></div>
24637 <div>a
24638 <p>b</p></div>
24639 <div>
24640 a
24641 <p>b</p></div>
24642 !! wikitext
24643 <div>a
24644 b
24645 </div>
24646 <div>a
24647 b
24648 </div>
24649 <div>
24650 a
24651
24652 b
24653 </div>
24654 !! end
24655
24656 !! test
24657 Substrings resembling wikitext in hrefs should not get nowiki escapes
24658 !! options
24659 parsoid=html2wt
24660 !! html/parsoid
24661 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
24662 !! wikitext
24663 [[Foo''bar''baz]]
24664 !! end
24665
24666 !! test
24667 Enforce single-line context in the serializer
24668 !! options
24669 parsoid=html2wt
24670 !! html/parsoid
24671 <h2>testing
24672 123</h2>
24673
24674 <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">
24675 </span><span about="#mwt1">you</span> </h2>
24676
24677 <h2> 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> </h2>
24678
24679 <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
24680 there</span></li></ol>
24681
24682 <ul><li>asd
24683 sdf</li></ul>
24684
24685 <ul><li>foo
24686 bar
24687 baz</li>
24688 <li>foo <b>bar</b>
24689 baz</li></ul>
24690
24691 <dl><dt>hi
24692 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
24693 ho</dd></dl>
24694
24695 <dl><dd> <table>
24696 <tbody><tr><td> ha
24697 ha
24698 ha</td></tr>
24699 </tbody></table></dd></dl>
24700 !! wikitext
24701 == testing 123 ==
24702
24703 == hi {{bogus|there
24704 you}} ==
24705
24706 == foo <ref>hello
24707 there</ref> ==
24708
24709 <references />
24710
24711 * asd sdf
24712
24713 * foo bar baz
24714 * foo '''bar''' baz
24715
24716 ; hi ho : hi ho
24717
24718 : {|
24719 | ha
24720 ha
24721 ha
24722 |}
24723 !! end
24724
24725 !! test
24726 Serialize new placeholder space without spans
24727 !! options
24728 parsoid=html2wt
24729 !! html/parsoid
24730 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
24731
24732 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
24733
24734 <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>
24735 !! wikitext
24736 foo : bar
24737
24738 foo : bar
24739
24740 <ref>foo : bar</ref>ok
24741 !! end
24742
24743
24744 #-----------------------
24745 # Tag minimization tests
24746 #-----------------------
24747
24748 !! test
24749 1. I/B quote minimization: wikitext-only tags should be combined
24750 !! options
24751 parsoid=html2wt
24752 !! html/parsoid
24753 <p><i>A</i><i>B</i></p>
24754 <p><b>A</b><b>B</b></p>
24755 <p><i>A</i><b><i>B</i></b></p>
24756 <p><b>A</b><i><b>B</b></i></p>
24757 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
24758 <p><i><b>A</b></i><i><b>B</b></i></p>
24759 <p><i><b>A</b></i><b><i>B</i></b></p>
24760 <p><b><i>A</i></b><i><b>B</b></i></p>
24761 !! wikitext
24762 ''AB''
24763
24764 '''AB'''
24765
24766 ''A'''B'''''
24767
24768 '''A''B'''''
24769
24770 '''A''BC''D'''
24771
24772 '''''AB'''''
24773
24774 '''''AB'''''
24775
24776 '''''AB'''''
24777 !! end
24778
24779 !! test
24780 2. I/B quote minimization: wikitext and html tags should not be combined
24781 !! options
24782 parsoid=html2wt
24783 !! html/parsoid
24784 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
24785 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
24786 !! wikitext
24787 ''A''<i>B</i>
24788
24789 ''A''<nowiki/>'''<i>B</i>'''
24790 !! end
24791
24792 !! test
24793 3. I/B quote minimization: templated content stops minimization
24794 !! options
24795 parsoid=html2wt
24796 !! html/parsoid
24797 <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>
24798 <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>
24799 !! wikitext
24800 ''A''{{echo|''B''}}
24801
24802 ''A''{{echo|'''''B'''''}}
24803 !! end
24804
24805 !! test
24806 4. I/B quote minimization: new content should be mimimized with adjacent old content
24807 !! options
24808 parsoid=html2wt
24809 !! html/parsoid
24810 <p><i>A</i><i>B</i></p>
24811 <p><b>A</b><b>B</b></p>
24812 <p><i>A</i><b><i>B</i></b></p>
24813 !! wikitext
24814 ''AB''
24815
24816 '''AB'''
24817
24818 ''A'''B'''''
24819 !! end
24820
24821 !! test
24822 5a. Merge adjacent quote nodes if they've been edited
24823 !! options
24824 parsoid={
24825 "modes": ["wt2wt", "selser"],
24826 "changes": [
24827 ["p", "contents", "remove", ":contains('b')"]
24828 ]
24829 }
24830 !! wikitext
24831 ''a''b''c''
24832 !! wikitext/edited
24833 ''ac''
24834 !! end
24835
24836 !! test
24837 5b. Merge adjacent quote nodes if they've been edited
24838 !! options
24839 parsoid={
24840 "modes": ["wt2wt", "selser"],
24841 "changes": [
24842 ["#x", "remove"]
24843 ]
24844 }
24845 !! wikitext
24846 ''a''<span id="x">b</span>''c''
24847 !! wikitext/edited
24848 ''ac''
24849 !! end
24850
24851 !! test
24852 1. Merge adjacent link nodes as long as at least one element is new
24853 !! options
24854 parsoid={
24855 "modes": ["html2wt"],
24856 "scrubWikitext": true
24857 }
24858 !! html/parsoid
24859 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
24860 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
24861 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
24862 !! wikitext
24863 [[Football]]
24864 [[Football]]
24865 [[Football|Foot]][[Football|ball]]
24866 !! end
24867
24868 !! test
24869 2. Merge adjacent link nodes and enable additional normalizations
24870 !! options
24871 parsoid={
24872 "modes": ["html2wt"],
24873 "scrubWikitext": true
24874 }
24875 !! html/parsoid
24876 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
24877 !! wikitext
24878 [[Football|''Football'']]
24879 !! end
24880
24881 !! test
24882 3. Don't merge adjacent link nodes if scrubWikitext is false
24883 !! options
24884 parsoid={
24885 "modes": ["html2wt"],
24886 "scrubWikitext": false
24887 }
24888 !! html/parsoid
24889 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
24890 !! wikitext
24891 [[Football|Foot]][[Football|ball]]
24892 !! end
24893
24894 #------------------------------
24895 # End of tag minimization tests
24896 #------------------------------
24897
24898 !!test
24899 Bug 54262: New entities
24900 !! options
24901 parsoid=html2wt
24902 !! html/parsoid
24903 <span typeof="mw:Entity">&nbsp;</span>
24904 !! wikitext
24905 &nbsp;
24906 !! end
24907
24908 ## Note that there is no wikitext output for 'unknownproperty' ##
24909 ## Unknown magic words are silently dropped ##
24910
24911 !! test
24912 Magic words
24913 !! options
24914 parsoid=html2wt
24915 !! html/parsoid
24916 <meta property='mw:PageProp/toc' />
24917 <meta property='mw:PageProp/notoc' />
24918 <meta property='mw:PageProp/forcetoc' />
24919 <meta property='mw:PageProp/index' />
24920 <meta property='mw:PageProp/noindex' />
24921 <meta property='mw:PageProp/nogallery' />
24922 <meta property='mw:PageProp/noeditsection' />
24923 <meta property='mw:PageProp/notitleconvert' />
24924 <meta property='mw:PageProp/nocontentconvert' />
24925 <meta property='mw:PageProp/unknownproperty' />
24926 !! wikitext
24927 __TOC__
24928 __NOTOC__
24929 __FORCETOC__
24930 __INDEX__
24931 __NOINDEX__
24932 __NOGALLERY__
24933 __NOEDITSECTION__
24934 __NOTITLECONVERT__
24935 __NOCONTENTCONVERT__
24936 !! end
24937
24938 !! test
24939 Consecutive <pre>s should not get merged
24940 !! options
24941 parsoid=html2wt,html2html
24942 !! html/parsoid
24943 <pre>a</pre><pre>b</pre>
24944
24945 <pre>c
24946 </pre><pre>
24947 d</pre>
24948
24949 <pre>e
24950
24951 </pre><pre>
24952
24953 f</pre>
24954 !! wikitext
24955 a
24956
24957 b
24958
24959 c
24960
24961 d
24962
24963 e
24964
24965
24966
24967 f
24968 !! end
24969
24970 !! test
24971 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
24972 !! options
24973 parsoid=html2wt
24974 !! html/parsoid
24975 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
24976 !! wikitext
24977 [[Special:BookSources/1234567890|ISBN 1234567895]]
24978 !! end
24979
24980 !! test
24981 Edited RFC links not serializable as RFC links should serialize as extlinks
24982 !! options
24983 parsoid=html2wt
24984 !! html/parsoid
24985 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
24986 !! wikitext
24987 [//tools.ietf.org/html/rfc123 New RFC]
24988 !! end
24989
24990 !! test
24991 Edited PMID links not serializable as PMID links should serialize as extlinks
24992 !! options
24993 parsoid=html2wt
24994 !! html/parsoid
24995 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
24996 !! wikitext
24997 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
24998 !! end
24999
25000 !! test
25001 WTS of autolinks with trailing/surrounding context
25002 !! options
25003 parsoid=html2wt
25004 !! html/parsoid
25005 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
25006 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
25007 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
25008 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
25009 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
25010 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
25011 !! wikitext
25012 http://cscott.net<nowiki/>'''foo'''
25013
25014 http://cscott.net<b>foo</b>
25015
25016 '''http://cscott.net<nowiki/>'''
25017
25018 '''http://cscott.net '''
25019
25020 '''http://cscott.net<nowiki/>x'''
25021
25022 http://cscott.net<nowiki/>x
25023 !! end
25024
25025 !! test
25026 WTS of autolinks with nowikis (round-trip)
25027 !! wikitext
25028 x<nowiki/>http://cscott.net<nowiki/>x
25029 !! html/parsoid
25030 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
25031 !! end
25032
25033 # this is the "easy" test because it leaves in place all the
25034 # data-parsoid information indicating this is an autolink
25035 !! test
25036 WTS of autolinks with escapes (editing)
25037 !! options
25038 parsoid={
25039 "modes": ["wt2wt"],
25040 "changes": [
25041 [ "meta", "remove" ]
25042 ]
25043 }
25044 !! wikitext
25045 x<nowiki/>http://cscott.net<nowiki/>x
25046 !! wikitext/edited
25047 x<nowiki/>http://cscott.net<nowiki/>x
25048 !! end
25049
25050 !! test
25051 WTS of edited autolink-like text (T103364)
25052 !! options
25053 parsoid={
25054 "modes": ["wt2wt"],
25055 "changes": [
25056 [ "span[typeof]", "removeAttr", "typeof" ]
25057 ]
25058 }
25059 !! wikitext
25060 Not a link: <nowiki>http://example.com</nowiki>.
25061 !! wikitext/edited
25062 Not a link: <span><nowiki>http://example.com</nowiki></span>.
25063 !! end
25064
25065 !! test
25066 WTS of newly-authored autolink-like text (T103364)
25067 !! options
25068 parsoid=html2wt
25069 !! html/parsoid
25070 <p>http://example.com is not a link.</p>
25071 !! wikitext
25072 <nowiki>http://example.com is not a link.</nowiki>
25073 !! end
25074
25075 !! test
25076 WTS of autolink-like text after an autolink (T108563)
25077 !! options
25078 parsoid=html2wt
25079 !! html/parsoid
25080 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
25081 !! wikitext
25082 http://example.com<nowiki> http://example.com is not a link.</nowiki>
25083 !! end
25084
25085 !! test
25086 Edited Redirect link should emit a non-piped wikitext link
25087 !! options
25088 parsoid=html2wt
25089 !! html/parsoid
25090 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
25091 !! wikitext
25092 #REDIRECT [[Bar]]
25093 !! end
25094
25095 !! test
25096 T75121: Infer extension name from typeOf if data-mw is not present
25097 !! options
25098 parsoid=html2wt
25099 !! html/parsoid
25100 <div typeOf="mw:Extension/foo"></div>
25101 !! wikitext
25102 <foo />
25103 !! end
25104
25105 # Note that the <p> wrapping isn't present in PHP parser output
25106 # The important thing for this test is that P-wrapping doesn't
25107 # interfere with the <nowiki> protection for leading - in <td>
25108 # (which isn't necessary for <th>).
25109 !! test
25110 T88318: p-wrapped dash in table.
25111 !! options
25112 parsoid=html2wt,wt2wt
25113 !! html/parsoid
25114 <table><tbody>
25115 <tr><th><p>-</p></th><th><p>- </p></th></tr>
25116 <tr><td><p>-</p></td><td><p>- </p></td></tr>
25117 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
25118 </tbody></table>
25119 !! wikitext
25120 {|
25121 !-
25122 !-
25123 |-
25124 |<nowiki>-</nowiki>
25125 |<nowiki>- </nowiki>
25126 |-
25127 |<small>-</small>
25128 |<br>
25129 -
25130 |<br>
25131 -
25132 |}
25133 !! html/php+tidy
25134 <table>
25135 <tr>
25136 <th>-</th>
25137 <th>-</th>
25138 </tr>
25139 <tr>
25140 <td>-</td>
25141 <td>-</td>
25142 </tr>
25143 <tr>
25144 <td><small>-</small></td>
25145 <td><br />
25146 <p>-</p>
25147 </td>
25148 <td><br />
25149 <p>-</p>
25150 </td>
25151 </tr>
25152 </table>
25153 !! end
25154
25155 !! test
25156 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
25157 !! options
25158 parsoid=html2wt
25159 !! html/parsoid
25160 <table id='mwAb'>
25161 <td id='mwAc'>foo</td>
25162 <td id='serialize-this'>bar</td>
25163 </table>
25164 !! wikitext
25165 {|
25166 |foo
25167 | id="serialize-this" |bar
25168 |}
25169 !! end
25170
25171 !! test
25172 Parsoid-like element ids should not be serialized to wikitext unless shadowed
25173 !! options
25174 parsoid=html2wt
25175 !! html/parsoid
25176 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
25177 !! wikitext
25178 <div id="hello">ok</div>
25179 !! end
25180
25181 !! test
25182 WTS change modes
25183 !! options
25184 parsoid={
25185 "modes": ["wt2wt"],
25186 "changes": [
25187 [ "#xyz", "before", "<b>before</b> stuff " ],
25188 [ "#xyz", "after", " stuff <i>after</i>" ],
25189 [ "#xyz", "html", "x <b>y</b> z" ]
25190 ]
25191 }
25192 !! wikitext
25193 <span id="xyz">hello</span>
25194 !! wikitext/edited
25195 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
25196 !! end
25197
25198 !! test
25199 Never serialize a-tag as html, regardless of what data-parsoid has to say
25200 !! options
25201 parsoid=html2wt
25202 !! html/parsoid
25203 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
25204 !! wikitext
25205 [[Foo]]
25206 !! end
25207
25208 ## SSS FIXME: This is broken output nevertheless.
25209 ## What might be a reasonable non-broken output for this?
25210 ## This is an edge case unlikely to be seen in production
25211 ## that I am not wasting more time on this right now.
25212 !! test
25213 Never serialize a-tag as html, no matter what attributes it has
25214 !! options
25215 parsoid=html2wt
25216 !! html/parsoid
25217 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
25218 !! wikitext
25219 [http://boo.org http://boohoo.org]
25220 !! end
25221
25222 # Misnested is an indication that selser can reuse the source but these have
25223 # shown to sneak through on occasion. See T101768.
25224 # The original wikitext here is: [http://test.com [[one]] two three]
25225 !! test
25226 Strip span tags added to mark as misnested
25227 !! options
25228 parsoid=html2wt
25229 !! html/parsoid
25230 <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>
25231 !! wikitext
25232 [http://test.com][[one]] two three
25233 !! end
25234
25235 # --------------------------------------------
25236 # Tests spec'ing wikitext serialization norms |
25237 # --------------------------------------------
25238
25239 !! test
25240 Lists: Add space after bullets
25241 !! options
25242 parsoid=html2wt
25243 !! html/parsoid
25244 <ul>
25245 <li>foo</li>
25246 <li> bar</li>
25247 <li><span> baz</span></li>
25248 </ul>
25249 !! wikitext
25250 * foo
25251 * bar
25252 * <span> baz</span>
25253 !! end
25254
25255 !! test
25256 1. Headings: Add space before/after == (T53744)
25257 !! options
25258 parsoid=html2wt
25259 !! html/parsoid
25260 <h2>foo</h2>
25261 <h2> bar</h2>
25262 <h2>baz </h2>
25263 <h2><span> baz</span></h2>
25264 !! wikitext
25265 == foo ==
25266
25267 == bar ==
25268
25269 == baz ==
25270
25271 == <span> baz</span> ==
25272 !! end
25273
25274 !! test
25275 2. Headings: Add space before/after == even after hoisted content
25276 !! options
25277 parsoid={
25278 "modes": ["html2wt"],
25279 "scrubWikitext": true
25280 }
25281 !! html/parsoid
25282 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
25283 !! wikitext
25284 [[Category:A2]]
25285
25286 == ok ==
25287 !! end
25288
25289 !! test
25290 1. Headings: suppress newly created empty headings
25291 !! options
25292 parsoid={
25293 "modes": ["html2wt"],
25294 "scrubWikitext": true
25295 }
25296 !! html/parsoid
25297 <h2></h2>
25298 !! wikitext
25299 !! end
25300
25301 !! test
25302 2. Headings: don't suppress empty headings if scrubWikitext is false
25303 !! options
25304 parsoid=html2wt
25305 !! html/parsoid
25306 <h2></h2>
25307 !! wikitext
25308 ==<nowiki/>==
25309 !! end
25310
25311 !! test
25312 3. Headings: suppress empty headings on edits
25313 !! options
25314 parsoid={
25315 "modes": ["selser"],
25316 "scrubWikitext": true,
25317 "changes": [
25318 [ "#x", "remove"]
25319 ]
25320 }
25321 !! wikitext
25322 ==<span id="x">foo</span>==
25323 !! wikitext/edited
25324 !! end
25325
25326 !! test
25327 1. WT Quote Tags: suppress newly created empty style tags
25328 !! options
25329 parsoid={
25330 "modes": ["html2wt"],
25331 "scrubWikitext": true
25332 }
25333 !! html/parsoid
25334 <i></i><b></b>
25335 !! wikitext
25336 !! end
25337
25338 !! test
25339 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
25340 !! options
25341 parsoid=html2wt
25342 !! html/parsoid
25343 <i></i><b></b>
25344 !! wikitext
25345 ''<nowiki/>'''''<nowiki/>'''
25346 !! end
25347
25348 !! test
25349 3. WT Quote Tags: suppress empty style tags on edits
25350 !! options
25351 parsoid={
25352 "modes": ["selser"],
25353 "scrubWikitext": true,
25354 "changes": [
25355 [ "#x", "remove"]
25356 ]
25357 }
25358 !! wikitext
25359 '''<span id="x">foo</span>'''
25360 !! wikitext/edited
25361 !! end
25362
25363 !! test
25364 1. Anchors: suppress newly created empty anchors
25365 !! options
25366 parsoid={
25367 "modes": ["html2wt"],
25368 "scrubWikitext": true
25369 }
25370 !! html/parsoid
25371 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
25372 !! wikitext
25373 !! end
25374
25375 !! test
25376 2. Anchors: don't suppress empty anchors if scrubWikitext is false
25377 !! options
25378 parsoid={
25379 "modes": ["html2wt"],
25380 "scrubWikitext": false
25381 }
25382 !! html/parsoid
25383 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
25384 !! wikitext
25385 [[Test|<nowiki/>]]
25386 !! end
25387
25388 !! test
25389 3. Anchors: suppress empty anchors on edits
25390 !! options
25391 parsoid={
25392 "modes": ["selser"],
25393 "scrubWikitext": true,
25394 "changes": [
25395 [ "#x", "remove"]
25396 ]
25397 }
25398 !! wikitext
25399 [[Test|<span id="x">foo</span>]]
25400 !! wikitext/edited
25401 !! end
25402
25403 !! test
25404 3a. Anchors: do not suppress numbered extlinks
25405 !! options
25406 parsoid={
25407 "modes": ["wt2wt"],
25408 "scrubWikitext": true
25409 }
25410 !! wikitext
25411 [http://foo.com]
25412 !! html/parsoid
25413 <a rel="mw:ExtLink" href="http://foo.com"></a>
25414 !! end
25415
25416 !! test
25417 3b. Anchors: do not suppress numbered extlinks
25418 !! options
25419 parsoid={
25420 "modes": ["wt2wt"],
25421 "scrubWikitext": true,
25422 "changes": [
25423 [ "#x", "remove"]
25424 ]
25425 }
25426 !! wikitext
25427 [http://foo.com <span id="x">foo</span>]
25428 !! wikitext/edited
25429 [http://foo.com]
25430 !! end
25431
25432 !!test
25433 Normalizations should be restricted to edited content
25434 !!options
25435 parsoid={
25436 "modes": ["selser"],
25437 "scrubWikitext": true,
25438 "changes": [
25439 [ "h1", "before", "<i></i>"]
25440 ]
25441 }
25442 !!wikitext
25443 a
25444 = =
25445 b
25446 !!wikitext/edited
25447 a
25448 = =
25449 b
25450 !!end
25451
25452 !! test
25453 1. Multiple normalizations (html2wt)
25454 !! options
25455 parsoid={
25456 "modes": ["html2wt"],
25457 "scrubWikitext": true
25458 }
25459 !! html
25460 <h2><i></i></h2>
25461 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
25462 </a><b><i></i></b>x</p>
25463 !! wikitext
25464
25465 [[foo]]
25466 x
25467
25468 !! end
25469
25470 !! test
25471 2. Multiple normalizations (selser)
25472 !! options
25473 parsoid={
25474 "modes": ["selser"],
25475 "scrubWikitext": true,
25476 "changes": [
25477 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
25478 ]
25479 }
25480 !! wikitext
25481 <span id="x">foo</span>
25482 !! wikitext/edited
25483 <span id="x">foo</span>
25484
25485 x
25486 !! end
25487
25488 !! test
25489 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
25490 !! options
25491 parsoid={
25492 "modes": ["html2wt"],
25493 "scrubWikitext": true
25494 }
25495 !! html/parsoid
25496 <p> hi</p>
25497 <p> hello</p>
25498 !! wikitext
25499 hi
25500
25501 hello
25502 !! end
25503
25504 !! test
25505 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
25506 !! options
25507 parsoid=html2wt
25508 !! html/parsoid
25509 <p> hi</p>
25510 <p> hello</p>
25511 !! wikitext
25512 <nowiki> </nowiki>hi
25513
25514 <nowiki> </nowiki> hello
25515 !! end
25516
25517 !! test
25518 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
25519 !! options
25520 parsoid={
25521 "modes": ["html2wt"],
25522 "scrubWikitext": true
25523 }
25524 !! html/parsoid
25525 <p>Foo
25526 bar
25527 baz</p>
25528
25529 <table><tr><td>Foo
25530 bar
25531 baz bang</td></tr></table>
25532
25533 <p><!--boo--> foo
25534 bar</p>
25535
25536 <p> foo
25537 bar<span>boo</span></p>
25538 !! wikitext
25539 Foo
25540 bar
25541 baz
25542
25543 {|
25544 |Foo
25545 bar
25546 baz bang
25547 |}
25548
25549 <!--boo-->foo
25550 bar
25551
25552 foo
25553 bar<span>boo</span>
25554 !! end
25555
25556 !! test
25557 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
25558 !! options
25559 parsoid={
25560 "modes": ["selser"],
25561 "scrubWikitext": true,
25562 "changes": [
25563 [ "p", "html", " a\n b" ]
25564 ]
25565 }
25566 !! wikitext
25567 xyz
25568 !! wikitext/edited
25569 a
25570 b
25571 !! end
25572
25573 !! test
25574 1. New links that end in spaces
25575 !! options
25576 parsoid={
25577 "modes": ["html2wt"],
25578 "scrubWikitext": false
25579 }
25580 !! html/parsoid
25581 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
25582 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
25583 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
25584 !! wikitext
25585 [[Berlin ]]<nowiki/>is the capital of Germany.
25586
25587 [[Foo ]]'''bar'''
25588
25589 [[Boston ]] is a city.
25590 !! end
25591
25592 !! test
25593 2. New links that end in spaces
25594 !! options
25595 parsoid={
25596 "modes": ["html2wt"],
25597 "scrubWikitext": true
25598 }
25599 !! html/parsoid
25600 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
25601 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
25602 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
25603 !! wikitext
25604 [[Berlin]] is the capital of Germany.
25605
25606 [[Foo]] '''bar'''
25607
25608 [[Boston]] is a city.
25609 !! end
25610
25611 !! test
25612 1. Table cells with escapable prefixes
25613 !! options
25614 parsoid={
25615 "modes": ["html2wt"],
25616 "scrubWikitext": false
25617 }
25618 !! html
25619 <table>
25620 <tr><td>a</td></tr>
25621 <tr><td>-</td></tr>
25622 <tr><td>+</td></tr>
25623 </table>
25624 !! wikitext
25625 {|
25626 |a
25627 |-
25628 |<nowiki>-</nowiki>
25629 |-
25630 |<nowiki>+</nowiki>
25631 |}
25632 !! end
25633
25634 !! test
25635 2. Table cells with escapable prefixes
25636 !! options
25637 parsoid={
25638 "modes": ["html2wt"],
25639 "scrubWikitext": true
25640 }
25641 !! html
25642 <table>
25643 <tr><td>a</td></tr>
25644 <tr><td>-</td></tr>
25645 <tr><td>+</td></tr>
25646 </table>
25647 !! wikitext
25648 {|
25649 |a
25650 |-
25651 | -
25652 |-
25653 | +
25654 |}
25655 !! end
25656
25657 !! test
25658 3a. Table cells with escapable prefixes after edits
25659 !! options
25660 parsoid={
25661 "modes": ["selser"],
25662 "scrubWikitext": true,
25663 "changes": [
25664 [ "table tbody tr:first-child td:first-child", "remove"]
25665 ]
25666 }
25667 !! wikitext
25668 {|
25669 |a||-
25670 |}
25671 !! wikitext/edited
25672 {|
25673 | -
25674 |}
25675 !! end
25676
25677 !! test
25678 3b. Table cells with escapable prefixes after edits
25679 !! options
25680 parsoid={
25681 "modes": ["selser"],
25682 "scrubWikitext": true,
25683 "changes": [
25684 [ "table tbody tr:first-child td:first-child", "html", "-" ],
25685 [ "#x", "remove" ]
25686 ]
25687 }
25688 !! wikitext
25689 {|
25690 |pqr
25691 |<span id="x">foo</span>+
25692 |}
25693 !! wikitext/edited
25694 {|
25695 | -
25696 | +
25697 |}
25698 !! end
25699
25700 # FIXME: This test will fail because
25701 # normalization doesn't realize that the id attribute
25702 # will eliminate the escapable scenario
25703 !! test
25704 4a. Table cells without escapable prefixes after edits
25705 !! options
25706 parsoid={
25707 "modes": ["selser"],
25708 "scrubWikitext": true,
25709 "changes": [
25710 [ "#x", "html", "-" ]
25711 ]
25712 }
25713 !! wikitext
25714 {|
25715 | id="x" |abcd
25716 |}
25717 !! wikitext/edited
25718 {|
25719 | id="x" |-
25720 |}
25721 !! end
25722
25723 ## This tests normalizer's ability to discriminate between
25724 ## cells having identical content.
25725 !! test
25726 4b. Table cells without escapable prefixes after edits
25727 !! options
25728 parsoid={
25729 "modes": ["selser"],
25730 "scrubWikitext": true,
25731 "changes": [
25732 [ "td", "html", "-" ]
25733 ]
25734 }
25735 !! wikitext
25736 {|
25737 |a||b
25738 |}
25739 !! wikitext/edited
25740 {|
25741 | -||-
25742 |}
25743 !! end
25744
25745 ## This tests normalizer's ability to not be tripped by
25746 ## comments (and whitespace)
25747 !! test
25748 4c. Table cells without escapable prefixes after edits
25749 !! options
25750 parsoid={
25751 "modes": ["selser"],
25752 "scrubWikitext": true,
25753 "changes": [
25754 [ "table tbody tr td:first-child", "remove" ]
25755 ]
25756 }
25757 !! wikitext
25758 {|
25759 |-
25760 <!--foo--> |a||-
25761 |}
25762 !! wikitext/edited
25763 {|
25764 |-
25765 <!--foo--> | -
25766 |}
25767 !! end
25768
25769 ## This tests normalizer's ability to handle HTML cells
25770 !! test
25771 4d. Table cells without escapable prefixes after edits
25772 !! options
25773 parsoid={
25774 "modes": ["selser"],
25775 "scrubWikitext": true,
25776 "changes": [
25777 [ "td", "html", "-" ]
25778 ]
25779 }
25780 !! wikitext
25781 <table>
25782 <tr><td>a</td></tr>
25783 </table>
25784 !! wikitext/edited
25785 <table>
25786 <tr><td>-</td></tr>
25787 </table>
25788 !! end
25789
25790 # ---------------------------------------------------
25791 # End of tests spec'ing wikitext serialization norms |
25792 # ---------------------------------------------------
25793
25794 # -----------------------------------------------------------------
25795 # End of section for Parsoid-only html2wt tests for serialization
25796 # of new content
25797 # -----------------------------------------------------------------
25798
25799 # -----------------------------------------------------------------
25800 # The following section of tests are primarily to spec behavior of
25801 # the selective serializer. All these tests have manual selser
25802 # changes. The automated selser changes for all tests handle the
25803 # wide variation of changes, but these tests here capture specs
25804 # deterministically.
25805 # ----------------------------------------------------------------
25806
25807 ## T90517
25808 !! test
25809 Selser: New comments should not be lost
25810 !! options
25811 parsoid={
25812 "modes": ["selser"],
25813 "changes": [
25814 [ "#a", "after", "<!--c1-->" ],
25815 [ "#b", "before", "<!--c2-->" ]
25816 ]
25817 }
25818 !! wikitext
25819 <span id="a">a</span>
25820
25821 <span id="b">b</span>
25822 !! wikitext/edited
25823 <span id="a">a</span><!--c1-->
25824
25825 <!--c2--><span id="b">b</span>
25826 !! end
25827
25828 ## T89383
25829 !! test
25830 Selser: Check for validity of DSR before using it
25831 !! options
25832 parsoid={
25833 "modes": ["selser"],
25834 "changes": [
25835 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
25836 ]
25837 }
25838 !! wikitext
25839 <span id="a">a</span>
25840 !! wikitext/edited
25841 {{DISPLAYTITLE:foo}}
25842 <span id="a">a</span>
25843 !! end
25844
25845 !! test
25846 1. DOMDiff: Changes to <ref> content should be looked up using id
25847 !! options
25848 parsoid={
25849 "modes": ["selser"],
25850 "changes": [
25851 ["#X", "after", "bar"],
25852 ["#Y", "after", "baz"]
25853 ]
25854 }
25855 !! wikitext
25856 X <ref><span id="X">foo</span></ref>
25857 Y <ref name="a" />
25858 <references>
25859 <ref name="a"><span id="Y">foo</span></ref>
25860 </references>
25861 !! wikitext/edited
25862 X <ref><span id="X">foo</span>bar</ref>
25863 Y <ref name="a" />
25864 <references>
25865 <ref name="a"><span id="Y">foo</span>baz</ref>
25866 </references>
25867 !! end
25868
25869 !! test
25870 2. DOMDiff: Changes to <ref> content should be looked up using id
25871 !! options
25872 parsoid={
25873 "modes": ["selser"],
25874 "changes": [
25875 ["#Z", "after", "bar"]
25876 ]
25877 }
25878 !! wikitext
25879 A <ref>foo bar for a</ref>
25880 B <ref group="X" name="b" />
25881
25882 <references />
25883
25884 <references group="X">
25885 <ref name="b"><span id="Z">foo</span></ref>
25886 </references>
25887 !! wikitext/edited
25888 A <ref>foo bar for a</ref>
25889 B <ref group="X" name="b" />
25890
25891 <references />
25892
25893 <references group="X">
25894 <ref name="b"><span id="Z">foo</span>bar</ref>
25895 </references>
25896 !! end