Merge "resourceloader: Use FileContentsHasher in safeFileHash()"
[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/php
2061 <p> This is not
2062 preformatted text.
2063 </p>
2064 <pre>This is preformatted text.
2065 So is this.
2066 </pre>
2067 !! html/parsoid
2068 <p> This is not
2069 preformatted text.</p>
2070 <pre>This is preformatted text.
2071 So is this.</pre>
2072 !! end
2073
2074 !! test
2075 Space before tab needs nowiki pre protection
2076 !! options
2077 parsoid=html2wt
2078 !! html/parsoid
2079 <p> a</p>
2080 !! wikitext
2081 <nowiki> </nowiki> a
2082 !! end
2083
2084 !! test
2085 Ident preformatting with inline content
2086 !! wikitext
2087 a
2088 ''b''
2089 !! html
2090 <pre>a
2091 <i>b</i>
2092 </pre>
2093 !! end
2094
2095 !! test
2096 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2097 !! wikitext
2098 <pre><nowiki>
2099 <b>
2100 <cite>
2101 <em>
2102 </nowiki></pre>
2103 !! html
2104 <pre>
2105 &lt;b&gt;
2106 &lt;cite&gt;
2107 &lt;em&gt;
2108 </pre>
2109
2110 !! end
2111
2112 !! test
2113 Regression with preformatted in <center>
2114 !! wikitext
2115 <center>
2116 Blah
2117 </center>
2118 !! html
2119 <center>
2120 <pre>Blah
2121 </pre>
2122 </center>
2123
2124 !! end
2125
2126 !! test
2127 Bug 52763: Preformatted in <blockquote>
2128 !! wikitext
2129 <blockquote>
2130 Blah
2131 {|
2132 |
2133 indented cell (no pre-wrapping!)
2134 |}
2135 </blockquote>
2136 !! html
2137 <blockquote>
2138 <p> Blah
2139 </p>
2140 <table>
2141 <tr>
2142 <td>
2143 <p> indented cell (no pre-wrapping!)
2144 </p>
2145 </td></tr></table>
2146 </blockquote>
2147
2148 !! end
2149
2150 !! test
2151 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2152 !! wikitext
2153 <blockquote>
2154 Foo
2155
2156 Bar
2157 </blockquote>
2158 !! html
2159 <blockquote>
2160 <p>Foo
2161 </p><p>Bar
2162 </p>
2163 </blockquote>
2164
2165 !! end
2166
2167 !! test
2168 Bug 15491: <ins>/<del> in blockquote
2169 !! wikitext
2170 <blockquote>
2171 Foo <del>bar</del> <ins>baz</ins> quux
2172 </blockquote>
2173 !! html
2174 <blockquote>
2175 <p>Foo <del>bar</del> <ins>baz</ins> quux
2176 </p>
2177 </blockquote>
2178
2179 !! end
2180
2181 # Note that the p-wrapping is newline sensitive, which could be
2182 # considered a bug: tidy will wrap only the 'Foo' in the example
2183 # below in a <p> tag. (see comment 23-25 of bug #6200)
2184 !! test
2185 Bug 15491: <ins>/<del> in blockquote (2)
2186 !! wikitext
2187 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2188 </blockquote>
2189 !! html
2190 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2191 </blockquote>
2192
2193 !! html+tidy
2194 <blockquote>
2195 <p>Foo</p>
2196 <del>bar</del> <ins>baz</ins> quux</blockquote>
2197 !! end
2198
2199 !! test
2200 <pre> with attributes (bug 3202)
2201 !! wikitext
2202 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2203 !! html
2204 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2205
2206 !! end
2207
2208 !! test
2209 <pre> with width attribute (bug 3202)
2210 !! wikitext
2211 <pre width="8">Narrow screen goodies</pre>
2212 !! html
2213 <pre width="8">Narrow screen goodies</pre>
2214
2215 !! end
2216
2217 !! test
2218 <pre> with forbidden attribute (bug 3202)
2219 !! wikitext
2220 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2221 !! html
2222 <pre width="8">Narrow screen goodies</pre>
2223
2224 !! end
2225
2226 !! test
2227 Entities inside <pre>
2228 !! wikitext
2229 <pre>&lt;</pre>
2230 !! html
2231 <pre>&lt;</pre>
2232
2233 !! end
2234
2235 !! test
2236 <pre> with forbidden attribute values (bug 3202)
2237 !! wikitext
2238 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2239 !! html
2240 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2241
2242 !! end
2243
2244 !! test
2245 <nowiki> inside <pre> (bug 13238)
2246 !! wikitext
2247 <pre>
2248 <nowiki>
2249 </pre>
2250 <pre>
2251 <nowiki></nowiki>
2252 </pre>
2253 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2254 !! html
2255 <pre>
2256 &lt;nowiki&gt;
2257 </pre>
2258 <pre>
2259
2260 </pre>
2261 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2262
2263 !! end
2264
2265 !! test
2266 <nowiki> and <pre> preference (first one wins)
2267 !! wikitext
2268 <pre>
2269 <nowiki>
2270 </pre>
2271 </nowiki>
2272 </pre>
2273
2274 <nowiki>
2275 <pre>
2276 <nowiki>
2277 </pre>
2278 </nowiki>
2279 </pre>
2280
2281 !! html/php
2282 <pre>
2283 &lt;nowiki&gt;
2284 </pre>
2285 <p>&lt;/nowiki&gt;
2286 &lt;/pre&gt;
2287 </p><p>
2288 &lt;pre&gt;
2289 &lt;nowiki&gt;
2290 &lt;/pre&gt;
2291
2292 &lt;/pre&gt;
2293 </p>
2294 !! html/parsoid
2295 <pre data-parsoid='{"stx":"html","strippedNL":true}'>&lt;nowiki>
2296 </pre>
2297 <p><span typeof="mw:Placeholder" data-parsoid='{"src":"&lt;/nowiki>"}'>&lt;/nowiki></span>
2298 &lt;/pre></p>
2299
2300 <p><span typeof="mw:Nowiki">
2301 &lt;pre>
2302 &lt;nowiki>
2303 &lt;/pre>
2304 </span>
2305 &lt;/pre></p>
2306 !! end
2307
2308 !! test
2309 </pre> inside nowiki
2310 !! wikitext
2311 <nowiki></pre></nowiki>
2312 !! html
2313 <p>&lt;/pre&gt;
2314 </p>
2315 !! end
2316
2317 # Parsoid doesn't strip empty tags, like Tidy does.
2318 !! test
2319 Empty pre; pre inside other HTML tags (bug 54946)
2320 !! options
2321 parsoid=wt2html,wt2wt
2322 !! wikitext
2323 a
2324
2325 <div><pre>
2326 foo
2327 </pre></div>
2328 <pre></pre>
2329 !! html/php
2330 <p>a
2331 </p>
2332 <div><pre>
2333 foo
2334 </pre></div>
2335 <pre></pre>
2336
2337 !! html/php+tidy
2338 <p>a</p>
2339 <div>
2340 <pre>
2341 foo
2342 </pre></div>
2343 !! html/parsoid
2344 <p>a</p>
2345
2346 <div><pre>foo
2347 </pre></div>
2348 <pre></pre>
2349 !! end
2350
2351 !! test
2352 HTML pre followed by indent-pre
2353 !! wikitext
2354 <pre>foo</pre>
2355 bar
2356 !! html
2357 <pre>foo</pre>
2358 <pre>bar
2359 </pre>
2360 !! end
2361
2362 # Note that tidy removes the empty <p> tags from the start and end.
2363 # Parsoid does not, by design.
2364 !!test
2365 Block tag pre
2366 !! wikitext
2367 <p><pre>foo</pre></p>
2368 !! html/php+tidy
2369 <pre>
2370 foo
2371 </pre>
2372 !! html/parsoid
2373 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2374 !!end
2375
2376 !!test
2377 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2378 !! wikitext
2379 {{echo|}}
2380 !! html
2381
2382 !!end
2383
2384 !!test
2385 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2386 !! wikitext
2387 {{echo|
2388 foo}}
2389 !! html
2390 <p>foo
2391 </p>
2392 !!end
2393
2394 !! test
2395 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2396 !! wikitext
2397 {{echo|a
2398 b}}
2399 !! html
2400 <pre>a
2401 </pre>
2402 <p>b
2403 </p>
2404 !!end
2405
2406 !! test
2407 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2408 !! wikitext
2409 {{echo|a
2410 b
2411 c
2412 d
2413 e
2414 }}
2415 !! html
2416 <pre>a
2417 </pre>
2418 <p>b
2419 c
2420 </p>
2421 <pre>d
2422 </pre>
2423 <p>e
2424 </p>
2425 !!end
2426
2427 !!test
2428 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2429 !! wikitext
2430 {{echo| foo}}
2431
2432 {{echo| foo}}{{echo| bar}}
2433
2434 {{echo| foo}}
2435 {{echo| bar}}
2436
2437 {{echo|<!--cmt--> foo}}
2438
2439 <!--cmt-->{{echo| foo}}
2440
2441 {{echo|{{echo| }}bar}}
2442 !! html
2443 <pre>foo
2444 </pre>
2445 <pre>foo bar
2446 </pre>
2447 <pre>foo
2448 bar
2449 </pre>
2450 <pre>foo
2451 </pre>
2452 <pre>foo
2453 </pre>
2454 <pre>bar
2455 </pre>
2456 !!end
2457
2458 !! test
2459 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2460 !! wikitext
2461 {{echo| }}a
2462
2463 {{echo|
2464 }}a
2465
2466 {{echo|
2467 b}}
2468
2469 {{echo|a
2470 }}b
2471
2472 {{echo|a
2473 }} b
2474 !! html
2475 <pre>a
2476 </pre>
2477 <p><br />
2478 </p>
2479 <pre>a
2480 </pre>
2481 <p><br />
2482 </p>
2483 <pre>b
2484 </pre>
2485 <p>a
2486 </p>
2487 <pre>b
2488 </pre>
2489 <p>a
2490 </p>
2491 <pre>b
2492 </pre>
2493 !!end
2494
2495 !! test
2496 Pres with newline attributes
2497 !! wikitext
2498 <pre class="one
2499 two">hi</pre>
2500 !! html/php
2501 <pre class="one two">hi</pre>
2502
2503 !! html/parsoid
2504 <pre class="one
2505 two" data-parsoid='{"stx":"html"}'>hi</pre>
2506 !! end
2507
2508 !! test
2509 Things that look like <pre> tags aren't treated as such
2510 !! wikitext
2511 Barack Obama <President> of the United States
2512 <President></President>
2513 !! html
2514 <p>Barack Obama &lt;President&gt; of the United States
2515 &lt;President&gt;&lt;/President&gt;
2516 </p>
2517 !! end
2518
2519 ## PHP parser discards the "<pre " string
2520 !! test
2521 Handle broken pre-like tags (bug 64025)
2522 !! options
2523 parsoid=wt2html
2524 !! wikitext
2525 {{echo|<pre <pre>x</pre>}}
2526
2527 <table><pre </table>
2528 !! html/php
2529 <pre>x</pre>
2530 <table><pre></pre></table>
2531
2532 !! html/parsoid
2533 <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>
2534
2535
2536 <p>&lt;pre </p>
2537
2538 <table></table>
2539 !! end
2540
2541 !! test
2542 Parsoid: handle pre with space after attribute
2543 !! options
2544 parsoid=wt2html
2545 !! wikitext
2546 <pre style="width:50%;" >{{echo|foo}}</pre>
2547 !! html/php
2548 <pre style="width:50%;">{{echo|foo}}</pre>
2549
2550 !! html/parsoid
2551 <pre style="width:50%;">{{echo|foo}}</pre>
2552 !! end
2553
2554 # TODO / maybe: fix wt2wt for this
2555 !! test
2556 Parsoid: Don't paragraph-wrap fosterable content
2557 !! options
2558 parsoid=wt2html
2559 !! wikitext
2560 {|
2561 <td></td>
2562 <td></td>
2563
2564
2565
2566 |}
2567 !! html
2568 <table>
2569
2570 <tbody>
2571 <tr>
2572 <td></td>
2573
2574 <td></td></tr>
2575
2576
2577
2578 </tbody></table>
2579 !! end
2580
2581 !! test
2582 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2583 !! options
2584 parsoid=wt2html
2585 !! wikitext
2586 {|
2587 <td>
2588 <td>
2589 </td>
2590
2591
2592
2593 |}
2594 !! html
2595 <table>
2596
2597 <tbody>
2598 <tr>
2599 <td></td>
2600
2601 <td>
2602 </td></tr>
2603
2604
2605
2606 </tbody></table>
2607 !! end
2608
2609
2610 #--------------------------------------------------------------------
2611 # Transclusion parameter whitespace stripping tests
2612 # Behavior is different for positional and named parameters
2613 #--------------------------------------------------------------------
2614 !! test
2615 Templates: Strip leading and trailing whitespace from named-param values
2616 !! wikitext
2617 {{echo|1= a }}
2618
2619 {{echo|1= {{echo|b}} }}
2620
2621 {{echo| 1 =
2622 c }}
2623
2624 {{echo| 1 =
2625 * d
2626 }}
2627 !! html
2628 <p>a
2629 </p><p>b
2630 </p><p>c
2631 </p>
2632 <ul><li> d</li></ul>
2633
2634 !! end
2635
2636 !! test
2637 Templates: Don't strip whitespace from positional-param values
2638 !! wikitext
2639 {{echo|a }}
2640
2641 {{echo|{{echo|b}} }}
2642
2643 {{echo| c
2644 }}
2645
2646 {{echo| {{echo|d}}
2647 }}
2648
2649 {{echo|
2650 e}}
2651
2652 {{echo|
2653 * f}}
2654
2655 {{echo|
2656 }}g
2657 !! html
2658 <p>a
2659 </p><p>b
2660 </p>
2661 <pre>c
2662 </pre>
2663 <p><br />
2664 </p>
2665 <pre>d
2666 </pre>
2667 <p><br />
2668 </p>
2669 <pre>e
2670 </pre>
2671 <p><br />
2672 </p>
2673 <ul><li> f</li></ul>
2674 <p><br />
2675 </p>
2676 <pre>g
2677 </pre>
2678 !! end
2679
2680 !! test
2681 Templates: Handle empty comment-and-ws-only lines correctly
2682 !! wikitext
2683 {{echo|foo
2684 <!--should be ignored-->
2685 <!--should be ignored as well-->
2686 bar}}
2687 !! html
2688 <p>foo
2689 bar
2690 </p>
2691 !! end
2692
2693 !! test
2694 Templates: Handle comments in the target
2695 !! wikitext
2696 {{echo
2697 <!-- should be ignored -->
2698 |foo}}
2699
2700 {{echo<!-- should be ignored -->
2701 |foo}}
2702
2703 {{echo<!-- should be ignored -->|foo}}
2704
2705 {{<!-- should be ignored -->echo|foo}}
2706 !!html/parsoid
2707 <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>
2708
2709 <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>
2710
2711 <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>
2712
2713 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2714 !!end
2715
2716 !! test
2717 Templates: Handle comments in parameter names (bug 67657)
2718 !! wikitext
2719 {{echo|1
2720 <!-- should be ignored -->
2721 =foo}}
2722
2723 {{echo|
2724 <!-- should be ignored -->
2725 1 = foo}}
2726
2727 {{echo|1<!-- should be ignored --> = foo}}
2728
2729 {{echo|<!-- should be ignored -->1 = foo}}
2730 !!html/parsoid
2731 <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>
2732
2733 <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>
2734
2735 <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>
2736
2737 <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>
2738 !!end
2739
2740 !! test
2741 Templates: Other wikitext in parameter names (bug 67657)
2742 !! wikitext
2743 {{echo|''1''=foo}}
2744 !!html/parsoid
2745 <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>
2746 !!html/php
2747 <p>{{{1}}}
2748 </p>
2749 !!end
2750
2751 #--------------------------------------------------------------------
2752 # Transclusion parameter escaping tests
2753 #--------------------------------------------------------------------
2754 !! test
2755 Templates: Parsoid parameter escaping test 1
2756 !! wikitext
2757 {{echo|[foo]|{{echo|[bar]}}}}
2758 !! html/php+tidy
2759 <p>[foo]</p>
2760 !! html/parsoid
2761 <p about="#mwt1" typeof="mw:Transclusion"
2762 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2763 !! end
2764
2765 !! test
2766 Parsoid: Pipes in external links in template parameter
2767 !! wikitext
2768 {{echo|[{{echo|http://example.com}} link]}}
2769 !! html/php+tidy
2770 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2771 !! html/parsoid
2772 <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>
2773 !! end
2774
2775 !! test
2776 Parsoid: pipe in transclusion parameter
2777 !! wikitext
2778 {{echo|http://foo.com/a&#124;b}}
2779 !! html/php+tidy
2780 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2781 !! html/parsoid
2782 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2783 typeof="mw:Transclusion"
2784 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>
2785 !! end
2786
2787 !! test
2788 Parsoid: Pipe in external link target and content in template parameter
2789 !! options
2790 parsoid=html2wt,wt2wt
2791 !! wikitext
2792 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2793 !! html/php+tidy
2794 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2795 !! html/parsoid
2796 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2797 typeof="mw:Transclusion"
2798 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2799 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2800 !! end
2801
2802 !! test
2803 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2804 !! options
2805 parsoid
2806 !! wikitext
2807 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2808 !! html
2809 <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>
2810 !! end
2811
2812 !! test
2813 Templates: Don't escape already nowiki-escaped text in template parameters
2814 !! options
2815 parsoid=html2wt,wt2wt
2816 !! wikitext
2817 {{echo|foo<nowiki>|</nowiki>bar}}
2818 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2819 {{echo|<nowiki></nowiki>}}
2820 !! html/php+tidy
2821 <p>foo|bar &lt;div&gt;</p>
2822 !! html/parsoid
2823 <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>
2824 <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>
2825 <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>
2826 </p>
2827 !! end
2828
2829 ## Bug 52824
2830 !! test
2831 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2832 !! options
2833 parsoid=html2wt,wt2wt
2834 !! wikitext
2835 {{echo|{{echo|1=bar}}}}
2836 !! html/php+tidy
2837 <p>bar</p>
2838 !! html/parsoid
2839 <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>
2840 !! end
2841
2842 ## Bug 56733
2843 !! test
2844 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2845 !! wikitext
2846 {{echo|a : b}}
2847 !! html/php+tidy
2848 <p>a&#160;: b</p>
2849 !! html/parsoid
2850 <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>
2851 !! end
2852
2853 ## Bug T73412
2854 !! test
2855 Templates: Preserve blank parameter names
2856 !! wikitext
2857 {{echo|=foo}}
2858 !! html/php+tidy
2859 <p>{{{1}}}</p>
2860 !! html/parsoid
2861 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2862 !! end
2863
2864 !! test
2865 Templates: Preserve blank parameter names in other positions
2866 !! wikitext
2867 {{blank_param|bar|=foo}}
2868 !! html/php+tidy
2869 <p>bar foo</p>
2870 !! html/parsoid
2871 <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
2872 foo</p>
2873 !! end
2874
2875 ###
2876 ### Parsoid-centric tests for testing RT edge cases for pre
2877 ###
2878
2879 !!test
2880 1a. Indent-Pre and Comments
2881 !! wikitext
2882 a
2883 <!--a-->
2884 c
2885 !! html
2886 <pre>a
2887 </pre>
2888 <p>c
2889 </p>
2890 !!end
2891
2892 !!test
2893 1b. Indent-Pre and Comments
2894 !! wikitext
2895 a
2896 <!--a-->
2897 c
2898 !! html
2899 <pre>a
2900 </pre>
2901 <p>c
2902 </p>
2903 !!end
2904
2905 !!test
2906 1c. Indent-Pre and Comments
2907 !! wikitext
2908 <!--a--> a
2909
2910 <!--a--> a
2911 !! html
2912 <pre> a
2913 </pre>
2914 <pre> a
2915 </pre>
2916 !!end
2917
2918 !!test
2919 1d. Indent-Pre and Comments
2920 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2921 !! wikitext
2922 <!--a--> a
2923
2924 <!--b-->b
2925 !! html
2926 <pre>a
2927 </pre>
2928 <pre>b
2929 </pre>
2930 !!end
2931
2932 !!test
2933 2a. Indent-Pre and tables
2934 !! wikitext
2935 {|
2936 |-
2937 !h1!!h2
2938 |foo||bar
2939 |}
2940 !! html
2941 <table>
2942
2943 <tr>
2944 <th>h1</th>
2945 <th>h2
2946 </th>
2947 <td>foo</td>
2948 <td>bar
2949 </td></tr></table>
2950
2951 !!end
2952
2953 !!test
2954 2b. Indent-Pre and tables
2955 !! wikitext
2956 {|
2957 |-
2958 |foo
2959 |}
2960 !! html
2961 <table>
2962
2963 <tr>
2964 <td>foo
2965 </td></tr></table>
2966
2967 !!end
2968
2969 !!test
2970 2c. Indent-Pre and tables (bug 42252)
2971 !! wikitext
2972 {|
2973 |+ foo
2974 ! | bar
2975 |}
2976 !! html
2977 <table>
2978 <caption> foo
2979 </caption>
2980 <tr>
2981 <th> bar
2982 </th></tr></table>
2983
2984 !!end
2985
2986 !!test
2987 2d. Indent-Pre and tables
2988 !! wikitext
2989 a
2990 {|
2991 | b
2992 |}
2993 !! html/php
2994 <pre>a
2995 </pre>
2996 <table>
2997 <tr>
2998 <td> b
2999 </td></tr></table>
3000
3001 !! html/parsoid
3002 <pre>a</pre>
3003 <table>
3004 <tbody><tr><td> b</td></tr>
3005 </tbody></table>
3006 !!end
3007
3008 !!test
3009 2e. Indent-Pre and table-line syntax
3010 !! wikitext
3011 a
3012 | b
3013 | c
3014 !! html/php
3015 <pre>a
3016 | b
3017 | c
3018 </pre>
3019 !!end
3020
3021 !!test
3022 2f. Indent-pre started by table-line syntax
3023 !! wikitext
3024 a
3025 | b
3026 | c
3027 !! html/php
3028 <p>a
3029 </p>
3030 <pre>| b
3031 | c
3032 </pre>
3033 !! html/parsoid
3034 <p>a</p>
3035 <pre>
3036 | b
3037 | c</pre>
3038 !!end
3039
3040 !!test
3041 3a. Indent-Pre and block tags (single-line html)
3042 !! wikitext
3043 a <p> foo </p>
3044 b <div> foo </div>
3045 c <blockquote> foo </blockquote>
3046 <span> foo </span>
3047 !! html
3048 a <p> foo </p>
3049 b <div> foo </div>
3050 c <blockquote> foo </blockquote>
3051 <pre><span> foo </span>
3052 </pre>
3053 !! html/parsoid
3054 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3055 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3056 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3057 <pre><span> foo </span>
3058 </pre>
3059 !! html+tidy
3060 <p>a</p>
3061 <p>foo</p>
3062 <p>b</p>
3063 <div>foo</div>
3064 <p>c</p>
3065 <blockquote>
3066 <p>foo</p>
3067 </blockquote>
3068 <pre>
3069 <span> foo </span>
3070 </pre>
3071 !! end
3072
3073 !!test
3074 3b. Indent-Pre and block tags (multi-line html)
3075 !! wikitext
3076 a <span>foo</span>
3077 b <div> foo </div>
3078 !! html
3079 <pre>a <span>foo</span>
3080 </pre>
3081 b <div> foo </div>
3082
3083 !! html/parsoid
3084 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3085 b <div data-parsoid='{"stx":"html"}'> foo </div>
3086 !! html+tidy
3087 <pre>
3088 a <span>foo</span>
3089 </pre>
3090 <p>b</p>
3091 <div>foo</div>
3092 !!end
3093
3094 !!test
3095 3c. Indent-Pre and block tags (pre-content on separate line)
3096 !! wikitext
3097 <p>
3098 foo
3099 </p>
3100
3101 <div>
3102 foo
3103 </div>
3104
3105 <center>
3106 foo
3107 </center>
3108
3109 <blockquote>
3110 foo
3111 </blockquote>
3112
3113 <blockquote>
3114 <pre>
3115 foo
3116 </pre>
3117 </blockquote>
3118
3119 <table><tr><td>
3120 foo
3121 </td></tr></table>
3122
3123 <ul><li>
3124 foo
3125 </li></ul>
3126
3127 !! html
3128 <p>
3129 foo
3130 </p>
3131 <div>
3132 <pre>foo
3133 </pre>
3134 </div>
3135 <center>
3136 <pre>foo
3137 </pre>
3138 </center>
3139 <blockquote>
3140 <p> foo
3141 </p>
3142 </blockquote>
3143 <blockquote>
3144 <pre>
3145 foo
3146 </pre>
3147 </blockquote>
3148 <table><tr><td>
3149 <pre>foo
3150 </pre>
3151 </td></tr></table>
3152 <ul><li>
3153 foo
3154 </li></ul>
3155
3156 !!end
3157
3158 !!test
3159 4. Indent-Pre and extension tags
3160 !! wikitext
3161 a <gallery>
3162 File:foobar.jpg
3163 </gallery>
3164 !! html
3165 a <ul class="gallery mw-gallery-traditional">
3166 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
3167 <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>
3168 <div class="gallerytext">
3169 </div>
3170 </div></li>
3171 </ul>
3172
3173 !! html+tidy
3174 <p>a</p>
3175 <ul class="gallery mw-gallery-traditional">
3176 <li class="gallerybox" style="width: 155px">
3177 <div style="width: 155px">
3178 <div class="thumb" style="width: 150px;">
3179 <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>
3180 </div>
3181 <div class="gallerytext"></div>
3182 </div>
3183 </li>
3184 </ul>
3185 !!end
3186
3187 !! test
3188 Table wikitext syntax outside wiki-tables
3189 !! wikitext
3190 a
3191 ! not a table heading
3192 |- not a table row
3193 | not a table cell
3194 | class="foo bar" | baz
3195 b
3196 |}
3197 |-
3198 c
3199 !! html
3200 <p>a
3201 ! not a table heading
3202 |- not a table row
3203 | not a table cell
3204 | class="foo bar" | baz
3205 b
3206 |}
3207 |-
3208 c
3209 </p>
3210 !! end
3211
3212 !!test
3213 Render paragraphs when indent-pre is suppressed in blocklevels
3214 !! wikitext
3215 <blockquote>
3216 foo
3217
3218 bar
3219 </blockquote>
3220 !! html
3221 <blockquote>
3222 <p> foo
3223 </p><p> bar
3224 </p>
3225 </blockquote>
3226
3227 !!end
3228
3229 !!test
3230 4. Multiple spaces at start-of-line
3231 !! wikitext
3232 <p> foo </p>
3233 foo
3234 {|
3235 |foo
3236 |}
3237 !! html
3238 <p> foo </p>
3239 <pre> foo
3240 </pre>
3241 <table>
3242 <tr>
3243 <td>foo
3244 </td></tr></table>
3245
3246 !!end
3247
3248 ## NOTE: the leading white-space chars on empty line are significant
3249 !! test
3250 5a. White-space in indent-pre
3251 !! wikitext
3252 a<br />
3253
3254 b
3255 !! html
3256 <pre>a<br />
3257
3258 b
3259 </pre>
3260 !! end
3261
3262 ## NOTE: the leading white-space chars on empty line are significant
3263 !! test
3264 5b. White-space in indent-pre
3265 !! wikitext
3266 a
3267
3268 b
3269
3270
3271 c
3272 !! html
3273 <pre>a
3274
3275 b
3276
3277
3278 c
3279 </pre>
3280 !! end
3281
3282 !! test
3283 5c. White-space in indent-pre
3284 !! wikitext
3285 ''a''
3286 ''b''
3287 ''c''
3288 !! html
3289 <pre><i>a</i>
3290 <i>b</i>
3291 <i>c</i>
3292 </pre>
3293 !! end
3294
3295 !! test
3296 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3297 !! wikitext
3298 a
3299
3300 <!-- continue -->
3301 b
3302
3303 c
3304
3305 d
3306 !! html
3307 <pre>a
3308
3309 b
3310 </pre>
3311 <pre>c
3312
3313 </pre>
3314 <p>d
3315 </p>
3316 !! end
3317
3318 !! test
3319 7a. Indent-pre and category links
3320 !! options
3321 parsoid=wt2html,wt2wt
3322 !! wikitext
3323 [[Category:foo]] <!-- No pre-wrapping -->
3324 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3325 !! html/php+tidy
3326 !! html/parsoid
3327 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3328 <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 -->
3329 !! end
3330
3331 !! test
3332 7b. Indent-pre and category links
3333 !! options
3334 parsoid=wt2html,wt2wt
3335 !! wikitext
3336 [[Category:foo]] a
3337 [[Category:foo]] {{echo|b}}
3338 !! html
3339 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3340 <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>
3341 !! end
3342
3343 !! test
3344 Indent-Pre: Newlines in comments shouldn't affect sol state
3345 !! wikitext
3346 a <!--
3347 foo
3348 --> b
3349 !! html/php+tidy
3350 <p>a b</p>
3351 !! html/parsoid
3352 <p>a <!--
3353 foo
3354 --> b</p>
3355 !! end
3356
3357 ###
3358 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3359 ###
3360
3361 !!test
3362 HTML-pre: 1. embedded newlines
3363 !! wikitext
3364 <pre>foo</pre>
3365
3366 <pre>
3367 foo
3368 </pre>
3369
3370 <pre>
3371
3372 foo
3373 </pre>
3374
3375 <pre>
3376
3377
3378 foo
3379 </pre>
3380 !! html/php+tidy
3381 <pre>
3382 foo
3383 </pre>
3384 <pre>
3385 foo
3386 </pre>
3387 <pre>
3388
3389 foo
3390 </pre>
3391 <pre>
3392
3393
3394 foo
3395 </pre>
3396 !! html/parsoid
3397 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3398
3399 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3400 foo
3401 </pre>
3402
3403 <pre data-parsoid='{"stx":"html"}'>
3404
3405 foo
3406 </pre>
3407
3408 <pre data-parsoid='{"stx":"html"}'>
3409
3410
3411 foo
3412 </pre>
3413 !!end
3414
3415 !! test
3416 HTML-pre: big spaces
3417 !! wikitext
3418 <pre>
3419
3420
3421
3422
3423 haha
3424
3425
3426
3427
3428 haha
3429
3430
3431
3432
3433 </pre>
3434 !! html/php+tidy
3435 <pre>
3436
3437
3438
3439
3440 haha
3441
3442
3443
3444
3445 haha
3446
3447
3448
3449
3450 </pre>
3451 !! html/parsoid
3452 <pre data-parsoid='{"stx":"html"}'>
3453
3454
3455
3456
3457 haha
3458
3459
3460
3461
3462 haha
3463
3464
3465
3466
3467 </pre>
3468 !! end
3469
3470 !!test
3471 HTML-pre: 2: indented text
3472 !! wikitext
3473 <pre>
3474 foo
3475 </pre>
3476 !! html
3477 <pre>
3478 foo
3479 </pre>
3480
3481 !!end
3482
3483 !!test
3484 HTML-pre: 3: other wikitext
3485 !! wikitext
3486 <pre>
3487 * foo
3488 # bar
3489 = no-h =
3490 '' no-italic ''
3491 [[ NoLink ]]
3492 </pre>
3493 !! html/php
3494 <pre>
3495 * foo
3496 # bar
3497 = no-h =
3498 '' no-italic ''
3499 [[ NoLink ]]
3500 </pre>
3501
3502 !! html/parsoid
3503 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3504 # bar
3505 = no-h =
3506 '' no-italic ''
3507 [[ NoLink ]]
3508 </pre>
3509 !!end
3510
3511 ###
3512 ### Definition lists
3513 ###
3514 !! test
3515 Simple definition
3516 !! wikitext
3517 ; name : Definition
3518 !! html
3519 <dl><dt> name&#160;</dt>
3520 <dd> Definition</dd></dl>
3521
3522 !! end
3523
3524 !! test
3525 Definition list for indentation only
3526 !! wikitext
3527 : Indented text
3528 !! html
3529 <dl><dd> Indented text</dd></dl>
3530
3531 !! end
3532
3533 !! test
3534 Definition list with no space
3535 !! wikitext
3536 ;name:Definition
3537 !! html
3538 <dl><dt>name</dt>
3539 <dd>Definition</dd></dl>
3540
3541 !!end
3542
3543 !! test
3544 Definition list with URL link
3545 !! wikitext
3546 ; http://example.com/ : definition
3547 !! html
3548 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3549 <dd> definition</dd></dl>
3550
3551 !! end
3552
3553 !! test
3554 Definition list with bracketed URL link
3555 !! wikitext
3556 ;[http://www.example.com/ Example]:Something about it
3557 !! html
3558 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3559 <dd>Something about it</dd></dl>
3560
3561 !! end
3562
3563 !! test
3564 Definition list with wikilink containing colon
3565 !! wikitext
3566 ; [[Help:FAQ]]: The least-read page on Wikipedia
3567 !! html
3568 <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>
3569 <dd> The least-read page on Wikipedia</dd></dl>
3570
3571 !! end
3572
3573 # At Brion's and JeLuF's insistence... :)
3574 !! test
3575 Definition list with news link containing colon
3576 !! wikitext
3577 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3578 !! html/php
3579 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3580 <dd> This isn't even a real newsgroup!</dd></dl>
3581
3582 !! html/parsoid
3583 <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>
3584 !! end
3585
3586 !! test
3587 Malformed definition list with colon
3588 !! wikitext
3589 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3590 !! html
3591 <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>
3592
3593 !! end
3594
3595 !! test
3596 Definition lists: colon in external link text
3597 !! wikitext
3598 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3599 !! html
3600 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3601 <dd> OK, I made that up</dd></dl>
3602
3603 !! end
3604
3605 !! test
3606 Definition lists: colon in HTML attribute
3607 !! wikitext
3608 ;<b style="display: inline">bold</b>
3609 !! html
3610 <dl><dt><b style="display: inline">bold</b></dt></dl>
3611
3612 !! end
3613
3614 !! test
3615 Definition lists: self-closed tag
3616 !! wikitext
3617 ;one<br/>two : two-line fun
3618 !! html
3619 <dl><dt>one<br />two&#160;</dt>
3620 <dd> two-line fun</dd></dl>
3621
3622 !! end
3623
3624 !! test
3625 Bug 11748: Literal closing tags
3626 !! wikitext
3627 <dl>
3628 <dt>test 1</dt>
3629 <dd>test test test test test</dd>
3630 <dt>test 2</dt>
3631 <dd>test test test test test</dd>
3632 </dl>
3633 !! html
3634 <dl>
3635 <dt>test 1</dt>
3636 <dd>test test test test test</dd>
3637 <dt>test 2</dt>
3638 <dd>test test test test test</dd>
3639 </dl>
3640
3641 !! end
3642
3643 !! test
3644 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3645 !! wikitext
3646 <ul><li>
3647 ; term : description
3648 * unordered
3649 </li></ul>
3650 !! html
3651 <ul><li>
3652 <dl><dt> term&#160;</dt>
3653 <dd> description</dd></dl>
3654 <ul><li> unordered</li></ul>
3655 </li></ul>
3656
3657 !! end
3658
3659 !! test
3660
3661 Definition list with empty definition and following paragraph
3662 !! wikitext
3663 ; term:
3664 Paragraph text
3665 !! html
3666 <dl><dt> term</dt>
3667 <dd></dd></dl>
3668 <p>Paragraph text
3669 </p>
3670 !! end
3671
3672 !! test
3673 Nested definition lists using html syntax
3674 !! wikitext
3675 <dl><dt>x</dt>
3676 <dd>a</dd>
3677 <dd>b</dd></dl>
3678
3679 !! end
3680
3681 !! test
3682 Definition Lists: No nesting: Multiple dd's
3683 !! wikitext
3684 ;x
3685 :a
3686 :b
3687 !! html
3688 <dl><dt>x</dt>
3689 <dd>a</dd>
3690 <dd>b</dd></dl>
3691
3692 !! end
3693
3694 !! test
3695 Definition Lists: Indentation: Regular
3696 !! wikitext
3697 :i1
3698 ::i2
3699 :::i3
3700 !! html
3701 <dl><dd>i1
3702 <dl><dd>i2
3703 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3704
3705 !! end
3706
3707 !! test
3708 Definition Lists: Indentation: Missing 1st level
3709 !! wikitext
3710 ::i2
3711 :::i3
3712 !! html
3713 <dl><dd><dl><dd>i2
3714 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3715
3716 !! end
3717
3718 !! test
3719 Definition Lists: Indentation: Multi-level indent
3720 !! wikitext
3721 :::i3
3722 !! html
3723 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3724
3725 !! end
3726
3727 !! test
3728 Definition Lists: Hacky use to indent tables
3729 !! wikitext
3730 ::{|
3731 |foo
3732 |bar
3733 |}
3734 this text
3735 should be left alone
3736 !! html
3737 <dl><dd><dl><dd><table>
3738 <tr>
3739 <td>foo
3740 </td>
3741 <td>bar
3742 </td></tr></table></dd></dl></dd></dl>
3743 <p>this text
3744 should be left alone
3745 </p>
3746 !! end
3747
3748 !! test
3749 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3750 !! wikitext
3751 <!-- foo -->
3752 ::{|
3753 |foo
3754 |bar
3755 |}<!-- bar -->
3756 this text
3757 should be left alone
3758 !! html/parsoid
3759 <!-- foo -->
3760 <dl><dd><dl><dd><table><tr>
3761 <td>foo</td>
3762 <td>bar</td>
3763 </tr></table><!-- bar --></dd></dl></dd></dl>
3764 <p>this text
3765 should be left alone</p>
3766 !! end
3767
3768 !! test
3769 Definition Lists: Hacky use to indent tables, with comment before table
3770 !! wikitext
3771 ::<!-- foo -->{|
3772 |foo
3773 |}
3774 !! html/parsoid
3775 <dl><dd><dl><dd><!-- foo --><table><tr>
3776 <td>foo</td>
3777 </tr></table></dd></dl></dd></dl>
3778 !! end
3779
3780 # The trailing whitespace in this test is to catch a regression in
3781 # Parsoid after T54473.
3782 !! test
3783 Definition Lists: Hacky use to indent tables (WS-insensitive)
3784 !! wikitext
3785 : {|
3786 |a
3787 |}
3788 !! html/php
3789 <dl><dd><table>
3790 <tr>
3791 <td>a
3792 </td></tr></table></dd></dl>
3793
3794 !! html/parsoid
3795 <dl><dd> <table>
3796 <tbody><tr><td>a</td></tr>
3797 </tbody></table> </dd></dl>
3798 !! end
3799
3800 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3801 ## as an empty dt item. It also ignores all but the last ";" when followed
3802 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3803 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3804 ## ";"s.
3805 ##
3806 ## Ex: ";;t2 ::d2" is transformed into:
3807 ##
3808 ## <dl>
3809 ## <dt>t2 </dt>
3810 ## <dd>
3811 ## <dl>
3812 ## <dt></dt>
3813 ## <dd>d2</dd>
3814 ## </dl>
3815 ## </dd>
3816 ## </dl>
3817 ##
3818 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3819 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3820 ##
3821 ## <dl>
3822 ## <dt>
3823 ## <dl>
3824 ## <dt>t2 </dt>
3825 ## <dd>:d2</dd>
3826 ## </dl>
3827 ## </dt>
3828 ## </dl>
3829 ##
3830 ## All Parsoid only definition list tests have this difference.
3831 ##
3832 ## See also: https://phabricator.wikimedia.org/T8569
3833 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3834
3835 !! test
3836 Table / list interaction: indented table with lists in table contents
3837 !! wikitext
3838 :{|
3839 |-
3840 | a
3841 * b
3842 |-
3843 | c
3844 * d
3845 |}
3846 !! html
3847 <dl><dd><table>
3848
3849 <tr>
3850 <td> a
3851 <ul><li> b</li></ul>
3852 </td></tr>
3853 <tr>
3854 <td> c
3855 <ul><li> d</li></ul>
3856 </td></tr></table></dd></dl>
3857
3858 !! end
3859
3860 !!test
3861 Table / list interaction: lists nested in tables nested in indented lists
3862 !! wikitext
3863 :{|
3864 |
3865 :a
3866 :b
3867 |
3868 *c
3869 *d
3870 |}
3871
3872 *e
3873 *f
3874 !! html
3875 <dl><dd><table>
3876 <tr>
3877 <td>
3878 <dl><dd>a</dd>
3879 <dd>b</dd></dl>
3880 </td>
3881 <td>
3882 <ul><li>c</li>
3883 <li>d</li></ul>
3884 </td></tr></table></dd></dl>
3885 <ul><li>e</li>
3886 <li>f</li></ul>
3887
3888 !!end
3889
3890 !! test
3891 Definition Lists: Nesting: Multi-level (Parsoid only)
3892 !! options
3893 parsoid
3894 !! wikitext
3895 ;t1 :d1
3896 ;;t2 ::d2
3897 ;;;t3 :::d3
3898 !! html
3899 <dl>
3900 <dt>t1 </dt>
3901 <dd>d1</dd>
3902 <dt>
3903 <dl>
3904 <dt>t2 </dt>
3905 <dd>:d2</dd>
3906 <dt>
3907 <dl>
3908 <dt>t3 </dt>
3909 <dd>::d3</dd>
3910 </dl>
3911 </dt>
3912 </dl>
3913 </dt>
3914 </dl>
3915
3916
3917 !! end
3918
3919
3920 !! test
3921 Definition Lists: Nesting: Test 2 (Parsoid only)
3922 !! wikitext
3923 ;t1
3924 ::d2
3925 !! html/php+tidy
3926 <dl>
3927 <dt>t1</dt>
3928 <dd>
3929 <dl>
3930 <dd>d2</dd>
3931 </dl>
3932 </dd>
3933 </dl>
3934 !! html/parsoid
3935 <dl>
3936 <dt>t1</dt>
3937 <dd>
3938 <dl>
3939 <dd>d2</dd>
3940 </dl>
3941 </dd>
3942 </dl>
3943
3944 !! end
3945
3946
3947 !! test
3948 Definition Lists: Nesting: Test 3 (Parsoid only)
3949 !! wikitext
3950 :;t1
3951 ::::d2
3952 !! html/php+tidy
3953 <dl>
3954 <dd>
3955 <dl>
3956 <dt>t1</dt>
3957 <dd>
3958 <dl>
3959 <dd>
3960 <dl>
3961 <dd>d2</dd>
3962 </dl>
3963 </dd>
3964 </dl>
3965 </dd>
3966 </dl>
3967 </dd>
3968 </dl>
3969 !! html/parsoid
3970 <dl>
3971 <dd>
3972 <dl>
3973 <dt>t1</dt>
3974 <dd>
3975 <dl>
3976 <dd>
3977 <dl>
3978 <dd>d2</dd>
3979 </dl>
3980 </dd>
3981 </dl>
3982 </dd>
3983 </dl>
3984 </dd>
3985 </dl>
3986
3987 !! end
3988
3989
3990 !! test
3991 Definition Lists: Nesting: Test 4
3992 !! wikitext
3993 ::;t3
3994 :::d3
3995 !! html
3996 <dl><dd><dl><dd><dl><dt>t3</dt>
3997 <dd>d3</dd></dl></dd></dl></dd></dl>
3998
3999 !! end
4000
4001
4002 ## The Parsoid team believes the following three test exposes a
4003 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4004 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4005 ## It also exposes a "misfeature" in tidy, which doesn't like
4006 ## <dl> tags with a single <dt> child; it converts the <dt> into
4007 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4008 !! test
4009 Definition Lists: Mixed Lists: Test 1
4010 !! wikitext
4011 :;* foo
4012 ::* bar
4013 :; baz
4014 !! html/php
4015 <dl><dd><dl><dt><ul><li> foo</li>
4016 <li> bar</li></ul></dt></dl>
4017 <dl><dt> baz</dt></dl></dd></dl>
4018
4019 !! html/php+tidy
4020 <dl>
4021 <dd>
4022 <dl>
4023 <dd>
4024 <ul>
4025 <li>foo</li>
4026 <li>bar</li>
4027 </ul>
4028 </dd>
4029 </dl>
4030 <dl>
4031 <dt>baz</dt>
4032 </dl>
4033 </dd>
4034 </dl>
4035 !! html/parsoid
4036 <dl>
4037 <dd><dl>
4038 <dt><ul>
4039 <li> foo
4040 </li>
4041 </ul></dt>
4042 <dd><ul>
4043 <li> bar
4044 </li>
4045 </ul></dd>
4046 <dt> baz</dt>
4047 </dl></dd>
4048 </dl>
4049 !! end
4050
4051 !! test
4052 Definition Lists: Mixed Lists: Test 2
4053 !! wikitext
4054 *: d1
4055 *: d2
4056 !! html
4057 <ul><li><dl><dd> d1</dd>
4058 <dd> d2</dd></dl></li></ul>
4059
4060 !! end
4061
4062
4063 !! test
4064 Definition Lists: Mixed Lists: Test 3
4065 !! wikitext
4066 *::: d1
4067 *::: d2
4068 !! html
4069 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4070 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4071
4072 !! end
4073
4074
4075 !! test
4076 Definition Lists: Mixed Lists: Test 4
4077 !! wikitext
4078 *;d1 :d2
4079 *;d3 :d4
4080 !! html
4081 <ul><li><dl><dt>d1&#160;</dt>
4082 <dd>d2</dd>
4083 <dt>d3&#160;</dt>
4084 <dd>d4</dd></dl></li></ul>
4085
4086 !! end
4087
4088
4089 !! test
4090 Definition Lists: Mixed Lists: Test 5
4091 !! wikitext
4092 *:d1
4093 *:: d2
4094 !! html
4095 <ul><li><dl><dd>d1
4096 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4097
4098 !! end
4099
4100
4101 !! test
4102 Definition Lists: Mixed Lists: Test 6
4103 !! wikitext
4104 #*:d1
4105 #*::: d3
4106 !! html
4107 <ol><li><ul><li><dl><dd>d1
4108 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4109
4110 !! end
4111
4112
4113 !! test
4114 Definition Lists: Mixed Lists: Test 7
4115 !! wikitext
4116 :* d1
4117 :* d2
4118 !! html
4119 <dl><dd><ul><li> d1</li>
4120 <li> d2</li></ul></dd></dl>
4121
4122 !! end
4123
4124
4125 !! test
4126 Definition Lists: Mixed Lists: Test 8
4127 !! wikitext
4128 :* d1
4129 ::* d2
4130 !! html
4131 <dl><dd><ul><li> d1</li></ul>
4132 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4133
4134 !! end
4135
4136
4137 !! test
4138 Definition Lists: Mixed Lists: Test 9
4139 !! wikitext
4140 *;foo :bar
4141 !! html
4142 <ul><li><dl><dt>foo&#160;</dt>
4143 <dd>bar</dd></dl></li></ul>
4144
4145 !! end
4146
4147
4148 !! test
4149 Definition Lists: Mixed Lists: Test 10
4150 !! wikitext
4151 *#;foo :bar
4152 !! html
4153 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4154 <dd>bar</dd></dl></li></ol></li></ul>
4155
4156 !! end
4157
4158 # The Parsoid team disagrees with the PHP parser's seemingly-random
4159 # rules regarding dd/dt on the next two tests. Parsoid is more
4160 # consistent, and recognizes the shared nesting and keeps the
4161 # still-open tags around until the nesting is complete.
4162 # (And tidy again converts <dt> to <dd> before 'bar'.)
4163
4164 !! test
4165 Definition Lists: Mixed Lists: Test 11
4166 !! wikitext
4167 *#*#;*;;foo :bar
4168 *#*#;boo :baz
4169 !! html/php
4170 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4171 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4172 <dl><dt>boo&#160;</dt>
4173 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4174
4175 !! html/php+tidy
4176 <ul>
4177 <li>
4178 <ol>
4179 <li>
4180 <ul>
4181 <li>
4182 <ol>
4183 <li>
4184 <dl>
4185 <dt>foo&#160;</dt>
4186 <dd>
4187 <ul>
4188 <li>
4189 <dl>
4190 <dd>
4191 <dl>
4192 <dt>bar</dt>
4193 </dl>
4194 </dd>
4195 </dl>
4196 </li>
4197 </ul>
4198 </dd>
4199 </dl>
4200 <dl>
4201 <dt>boo&#160;</dt>
4202 <dd>baz</dd>
4203 </dl>
4204 </li>
4205 </ol>
4206 </li>
4207 </ul>
4208 </li>
4209 </ol>
4210 </li>
4211 </ul>
4212 !! html/parsoid
4213 <ul>
4214 <li>
4215 <ol>
4216 <li>
4217 <ul>
4218 <li>
4219 <ol>
4220 <li>
4221 <dl>
4222 <dt>
4223 <ul>
4224 <li>
4225 <dl>
4226 <dt>
4227 <dl>
4228 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4229 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4230 </dl></dt>
4231 </dl></li>
4232 </ul></dt>
4233 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4234 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4235 </dl></li>
4236 </ol></li>
4237 </ul></li>
4238 </ol></li>
4239 </ul>
4240 !! end
4241
4242
4243 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4244 # From whitelist:
4245 # * The test is wrong, there are two colons where there should be :;
4246 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4247 !! test
4248 Definition Lists: Weird Ones: Test 1
4249 !! wikitext
4250 *#;*::;; foo : bar (who uses this?)
4251 !! html/php
4252 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4253 <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>
4254
4255 !! html/php+tidy
4256 <ul>
4257 <li>
4258 <ol>
4259 <li>
4260 <dl>
4261 <dt>foo&#160;</dt>
4262 <dd>
4263 <ul>
4264 <li>
4265 <dl>
4266 <dd>
4267 <dl>
4268 <dd>
4269 <dl>
4270 <dd>
4271 <dl>
4272 <dt>bar (who uses this?)</dt>
4273 </dl>
4274 </dd>
4275 </dl>
4276 </dd>
4277 </dl>
4278 </dd>
4279 </dl>
4280 </li>
4281 </ul>
4282 </dd>
4283 </dl>
4284 </li>
4285 </ol>
4286 </li>
4287 </ul>
4288 !! html/parsoid
4289 <ul>
4290 <li>
4291 <ol>
4292 <li>
4293 <dl>
4294 <dt>
4295 <ul>
4296 <li>
4297 <dl>
4298 <dd>
4299 <dl>
4300 <dd>
4301 <dl>
4302 <dt>
4303 <dl>
4304 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4305 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4306 </dl></dt>
4307 </dl></dd>
4308 </dl></dd>
4309 </dl></li>
4310 </ul></dt>
4311 </dl></li>
4312 </ol></li>
4313 </ul>
4314 !! end
4315
4316 !! test
4317 Definition Lists: colons occurring in tags
4318 !! wikitext
4319 ;a:b
4320 ;'''a:b'''
4321 ;<i>a:b</i>
4322 ;<span>a:b</span>
4323 ;<div>a:b</div>
4324 ;<div>a
4325 :b</div>
4326 ;{{echo|a:b}}
4327 ;{{echo|''a:b''}}
4328 ;;;''a:b''
4329 !! html+tidy
4330 <dl>
4331 <dt>a</dt>
4332 <dd>b</dd>
4333 <dt><b>a:b</b></dt>
4334 <dt><i>a:b</i></dt>
4335 <dt><span>a:b</span></dt>
4336 <dd>
4337 <div>a:b</div>
4338 </dd>
4339 <dd>
4340 <div>a
4341 <dl>
4342 <dd>b</dd>
4343 </dl>
4344 </div>
4345 </dd>
4346 <dt>a</dt>
4347 <dd>b</dd>
4348 <dt><i>a:b</i></dt>
4349 </dl>
4350 <dl>
4351 <dd>
4352 <dl>
4353 <dd>
4354 <dl>
4355 <dt><i>a:b</i></dt>
4356 </dl>
4357 </dd>
4358 </dl>
4359 </dd>
4360 </dl>
4361 !! html/parsoid
4362 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4363 <dt><b>a:b</b></dt>
4364 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4365 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4366 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4367 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4368 <dd>b</dd>
4369 <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>
4370 <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>
4371 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4372 !! end
4373
4374 !! test
4375 Definition Lists: colons and tables 1
4376 !! wikitext
4377 :{|
4378 | x
4379 |}
4380 :{|
4381 | y
4382 |}
4383 !! html
4384 <dl><dd><table>
4385 <tr>
4386 <td> x
4387 </td></tr></table></dd></dl>
4388 <dl><dd><table>
4389 <tr>
4390 <td> y
4391 </td></tr></table></dd></dl>
4392
4393 !! end
4394
4395 # Parsoid's output (as documented below) differs from php's in this case.
4396 # This is probably a bug. If we fixup parsoid to match php's output, the
4397 # above test should pass and the below test case can be removed. It is
4398 # unclear which output is more desirable.
4399
4400 !! test
4401 Definition Lists: colons and tables 2
4402 !! wikitext
4403 :{|
4404 | x
4405 |}
4406 :{|
4407 | y
4408 |}
4409 !! html/parsoid
4410 <dl><dd><table>
4411 <tr>
4412 <td> x
4413 </td></tr></table></dd>
4414 <dd><table>
4415 <tr>
4416 <td> y
4417 </td></tr></table></dd></dl>
4418 !! end
4419
4420 !! test
4421 Definition Lists: template interaction
4422 !! wikitext
4423 ::{{definition_list}}
4424
4425 :one
4426 ::{{definition_list}}
4427 :::two
4428 :::three
4429 ::four
4430 !! html/parsoid
4431 <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">
4432 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4433
4434 <dl><dd data-parsoid='{}'>one
4435 <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">
4436 </span><dd about="#mwt2">two
4437 <dl><dd>two</dd>
4438 <dd>three</dd></dl></dd>
4439 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4440 !! end
4441
4442
4443 ###
4444 ### External links
4445 ###
4446 !! test
4447 External links: non-bracketed
4448 !! wikitext
4449 Non-bracketed: http://example.com
4450 !! html
4451 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4452 </p>
4453 !! end
4454
4455 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4456 !! test
4457 External links: numbered
4458 !! wikitext
4459 Numbered: [http://example.com]
4460 Numbered: [http://example.net]
4461 Numbered: [http://example.com]
4462 !! html/php
4463 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4464 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4465 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4466 </p>
4467 !! html/parsoid
4468 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4469 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4470 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4471 !!end
4472
4473 !! test
4474 External links: specified text
4475 !! wikitext
4476 Specified text: [http://example.com link]
4477 !! html
4478 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4479 </p>
4480 !!end
4481
4482 !! test
4483 External links: trail
4484 !! wikitext
4485 Linktrails should not work for external links: [http://example.com link]s
4486 !! html
4487 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4488 </p>
4489 !! end
4490
4491 !! test
4492 External links: dollar sign in URL
4493 !! wikitext
4494 http://example.com/1$2345
4495 !! html
4496 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4497 </p>
4498 !! end
4499
4500 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4501 !! test
4502 External links: dollar sign in URL (autonumber)
4503 !! wikitext
4504 [http://example.com/1$2345]
4505 !! html/php
4506 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4507 </p>
4508 !! html/parsoid
4509 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4510 !!end
4511
4512 !! test
4513 External links: open square bracket forbidden in URL (bug 4377)
4514 !! options
4515 parsoid=wt2html,wt2wt,html2html
4516 !! wikitext
4517 http://example.com/1[2345
4518 !! html/php
4519 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4520 </p>
4521 !! html/parsoid
4522 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4523 !! end
4524
4525 !! test
4526 External links: open square bracket forbidden in URL (named) (bug 4377)
4527 !! options
4528 parsoid=wt2html,html2html
4529 !! wikitext
4530 [http://example.com/1[2345]
4531 !! html/php
4532 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4533 </p>
4534 !! html/parsoid
4535 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4536 !!end
4537
4538 # parsoid adds a space before the link name
4539 !! test
4540 External links: open square bracket forbidden in URL (named) (bug 4377)
4541 Parsoid variant.
4542 !! wikitext
4543 [http://example.com/1 [2345]
4544 !! html
4545 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4546 </p>
4547 !!end
4548
4549 !! test
4550 External links: nowiki in URL link text (bug 6230)
4551 !! wikitext
4552 [http://example.com/ <nowiki>''example site''</nowiki>]
4553 !! html
4554 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4555 </p>
4556 !! end
4557
4558 !! test
4559 External links: newline forbidden in text (bug 6230 regression check)
4560 !! wikitext
4561 [http://example.com/ first
4562 second]
4563 !! html
4564 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4565 second]
4566 </p>
4567 !!end
4568
4569 !! test
4570 External links: Pipe char between url and text
4571 !! wikitext
4572 [http://example.com | link]
4573 !! html
4574 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4575 </p>
4576 !!end
4577
4578 !! test
4579 External links: protocol-relative URL in brackets
4580 !! wikitext
4581 [//example.com/ Test]
4582 !! html
4583 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4584 </p>
4585 !! end
4586
4587 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4588 !! test
4589 External links: protocol-relative URL in brackets without text
4590 !! wikitext
4591 [//example.com]
4592 !! html/php
4593 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4594 </p>
4595 !! html/parsoid
4596 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4597 !! end
4598
4599 !! test
4600 External links: protocol-relative URL in free text is left alone
4601 !! wikitext
4602 //example.com/Foo
4603 !! html
4604 <p>//example.com/Foo
4605 </p>
4606 !!end
4607
4608 !! test
4609 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4610 !! wikitext
4611 foo//example.com/Foo
4612 !! html
4613 <p>foo//example.com/Foo
4614 </p>
4615 !! end
4616
4617 !! test
4618 External links: with no contents
4619 !! wikitext
4620 [http://en.wikipedia.org/wiki/Foo]
4621
4622 [[wikipedia:Foo|Bar]]
4623
4624 [[wikipedia:Foo|<span>Bar</span>]]
4625 !! html/php
4626 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4627 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4628 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4629 </p>
4630 !! html/parsoid
4631 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4632 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4633 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4634 !! end
4635
4636 !! test
4637 External links: Free with trailing punctuation
4638 !! wikitext
4639 http://example.com,
4640 http://example.com;
4641 http://example.com\
4642 http://example.com.
4643 http://example.com:
4644 http://example.com!
4645 http://example.com?
4646 http://example.com)
4647 http://example.com/url_with_(brackets)
4648 (http://example.com/url_without_brackets)
4649 http://example.com/url_with_entity&amp;
4650 http://example.com/url_with_entity&#x26;
4651 http://example.com/url_with_entity&#038;
4652 http://example.com/url_with_entity&nbsp;
4653 http://example.com/url_with_entity&#xA0;
4654 http://example.com/url_with_entity&#160;
4655 http://example.com/url_with_entity&lt;
4656 http://example.com/url_with_entity&#x3C;
4657 http://example.com/url_with_entity&#60;
4658 !! html/php
4659 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4660 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4661 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4662 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4663 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4664 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4665 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4666 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4667 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4668 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4669 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4670 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4671 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4672 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4673 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4674 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4675 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4676 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4677 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4678 </p>
4679 !! html/parsoid
4680 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4681 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4682 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4683 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4684 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4685 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4686 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4687 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4688 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4689 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4690 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4691 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4692 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4693 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity">&lt;</span>
4694 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a>
4695 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a></p>
4696 !! end
4697
4698 !! test
4699 External links: Lone protocols are never linked (T105697)
4700 !! wikitext
4701 http://
4702 http://;
4703 (http://)
4704 bitcoin:
4705 bitcoin:;
4706 (bitcoin:)
4707 !! html
4708 <p>http://
4709 http://;
4710 (http://)
4711 bitcoin:
4712 bitcoin:;
4713 (bitcoin:)
4714 </p>
4715 !! end
4716
4717 !! test
4718 External links: No preceding word characters allowed (bug 65278)
4719 !! wikitext
4720 NOPEhttp://example.com
4721 N0http://example.com
4722 ok:http://example.com
4723 ok-http://example.com
4724 !! html
4725 <p>NOPEhttp://example.com
4726 N0http://example.com
4727 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4728 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4729 </p>
4730 !! end
4731
4732 !! test
4733 External image
4734 !! wikitext
4735 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4736 !! html
4737 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4738 </p>
4739 !! end
4740
4741 !! test
4742 External image from https
4743 !! wikitext
4744 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4745 !! html
4746 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4747 </p>
4748 !! end
4749
4750 !! test
4751 External image (when not allowed)
4752 !! options
4753 wgAllowExternalImages=0
4754 !! wikitext
4755 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4756 !! html
4757 <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>
4758 </p>
4759 !! end
4760
4761 !! test
4762 Link to non-http image, no img tag
4763 !! wikitext
4764 Link to non-http image, no img tag: ftp://example.com/test.jpg
4765 !! html
4766 <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>
4767 </p>
4768 !! end
4769
4770 !! test
4771 External links: terminating separator
4772 !! wikitext
4773 Terminating separator: http://example.com/thing,
4774 !! html
4775 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4776 </p>
4777 !! end
4778
4779 !! test
4780 External links: intervening separator
4781 !! wikitext
4782 Intervening separator: http://example.com/1,2,3
4783 !! html
4784 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4785 </p>
4786 !! end
4787
4788 !! test
4789 External links: old bug with URL in query
4790 !! wikitext
4791 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4792 !! html
4793 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4794 </p>
4795 !! end
4796
4797 !! test
4798 External links: old URL-in-URL bug, mixed protocols
4799 !! wikitext
4800 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4801 !! html
4802 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4803 </p>
4804 !!end
4805
4806 !! test
4807 External links: URL in text
4808 !! wikitext
4809 URL in text: [http://example.com http://example.com]
4810 !! html
4811 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4812 </p>
4813 !! end
4814
4815 !! test
4816 External links: Clickable images
4817 !! wikitext
4818 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4819 !! html/php
4820 <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>
4821 </p>
4822 !! html/parsoid
4823 <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>
4824 !! end
4825
4826 !! test
4827 External links: raw ampersand
4828 !! wikitext
4829 Old &amp; use: http://x&y
4830 !! html
4831 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4832 </p>
4833 !! end
4834
4835 !! test
4836 External links: encoded ampersand
4837 !! wikitext
4838 Old &amp; use: http://x&amp;y
4839 !! html/php
4840 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4841 </p>
4842 !! html/parsoid
4843 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4844 !! end
4845
4846 !! test
4847 External links: encoded equals (bug 6102)
4848 !! wikitext
4849 http://example.com/?foo&#61;bar
4850 !! html/php
4851 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4852 </p>
4853 !! html/parsoid
4854 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4855 !! end
4856
4857 ##
4858 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4859 ## does it number them. As discussed in bug 53505, we can identify
4860 ## autonumbered links via CSS.
4861 ##
4862
4863 !! test
4864 External links: [raw ampersand]
4865 !! wikitext
4866 Old &amp; use: [http://x&y]
4867 !! html/php
4868 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4869 </p>
4870 !! html/parsoid
4871 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4872 !! end
4873
4874 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4875 # mode will return the [raw ampersand] wikitext
4876 !! test
4877 External links: [encoded ampersand]
4878 !! options
4879 parsoid=wt2html,wt2wt,html2html
4880 !! wikitext
4881 Old &amp; use: [http://x&amp;y]
4882 !! html/php
4883 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4884 </p>
4885 !! html/parsoid
4886 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4887 !! end
4888
4889 !! test
4890 External links: [raw equals]
4891 !! wikitext
4892 [http://example.com/?foo=bar]
4893 !! html/php
4894 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4895 </p>
4896 !! html/parsoid
4897 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4898 !! end
4899
4900 # note that parsoid html is identical to [raw equals] case; so html2wt
4901 # mode will return the [raw equals] wikitext
4902 !! test
4903 External links: [encoded equals] (bug 6102)
4904 !! options
4905 parsoid=wt2html,wt2wt,html2html
4906 !! wikitext
4907 [http://example.com/?foo&#61;bar]
4908 !! html/php
4909 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4910 </p>
4911 !! html/parsoid
4912 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4913 !! end
4914
4915 # xxx parsoid strips the IDN character, so the round-trip tests will
4916 # obviously fail and are disabled. --cscott
4917 !! test
4918 External links: [IDN ignored character reference in hostname; strip it right off]
4919 !! options
4920 parsoid=wt2html,wt2wt,html2html
4921 !! wikitext
4922 [http://e&zwnj;xample.com/]
4923 !! html/php
4924 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4925 </p>
4926 !! html/parsoid
4927 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4928 !! end
4929
4930 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4931 # Where an external link could easily circumvent the sanitization of the text of
4932 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4933 # test demands a higher standard. That's a bit strange.
4934 #
4935 # Example:
4936 #
4937 # http://e‌xample.com -> [http://example.com|http://example.com]
4938 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4939 #
4940 # The first example is sanitized, but the second is not. Any security benefits
4941 # from this production are trivial to circumvent. Either remove this test and
4942 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4943 # the test accordingly.
4944 #
4945 # All our love,
4946 # The Parsoid team.
4947 # xxx parsoid strips the IDN character, so the round-trip tests will
4948 # obviously fail and are disabled. --cscott
4949 !! test
4950 External links: IDN ignored character reference in hostname; strip it right off
4951 !! options
4952 parsoid=wt2html,html2html
4953 !! wikitext
4954 http://e&zwnj;xample.com/
4955 !! html/php
4956 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4957 </p>
4958 !! html/parsoid
4959 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4960 !! end
4961
4962 !! test
4963 External links: www.jpeg.org (bug 554)
4964 !! wikitext
4965 http://www.jpeg.org
4966 !! html
4967 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4968 </p>
4969 !! end
4970
4971 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4972 !! test
4973 External links: URL within URL (original bug 2)
4974 !! wikitext
4975 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4976 !! html/php
4977 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4978 </p>
4979 !! html/parsoid
4980 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4981 !! end
4982
4983 !! test
4984 BUG 361: URL inside bracketed URL
4985 !! wikitext
4986 [http://www.example.com/foo http://www.example.com/bar]
4987 !! html
4988 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4989 </p>
4990 !! end
4991
4992 !! test
4993 BUG 361: URL within URL, not bracketed
4994 !! wikitext
4995 http://www.example.com/foo?=http://www.example.com/bar
4996 !! html
4997 <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>
4998 </p>
4999 !! end
5000
5001 !! test
5002 BUG 289: ">"-token in URL-tail
5003 !! wikitext
5004 http://www.example.com/<hello>
5005 !! html
5006 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5007 </p>
5008 !!end
5009
5010 !! test
5011 BUG 289: literal ">"-token in URL-tail
5012 !! wikitext
5013 http://www.example.com/<b>html</b>
5014 !! html/php
5015 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5016 </p>
5017 !! html/parsoid
5018 <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>
5019 !! end
5020
5021 !! test
5022 BUG 289: ">"-token in bracketed URL
5023 !! wikitext
5024 [http://www.example.com/<hello> stuff]
5025 !! html
5026 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5027 </p>
5028 !!end
5029
5030 !! test
5031 BUG 289: literal ">"-token in bracketed URL
5032 !! wikitext
5033 [http://www.example.com/<b>html</b> stuff]
5034 !! html
5035 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5036 </p>
5037 !!end
5038
5039 !! test
5040 BUG 289: literal double quote at end of URL
5041 !! wikitext
5042 http://www.example.com/"hello"
5043 !! html
5044 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5045 </p>
5046 !!end
5047
5048 !! test
5049 BUG 289: literal double quote in bracketed URL
5050 !! wikitext
5051 [http://www.example.com/"hello" stuff]
5052 !! html
5053 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5054 </p>
5055 !!end
5056
5057 !! test
5058 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5059 !! wikitext
5060 [http://www.example.com test]
5061 !! html
5062 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5063 </p>
5064 !! end
5065
5066 !! test
5067 External links: link text with spaces
5068 !! wikitext
5069 [http://www.example.com a b c]
5070 [http://www.example.com ''a'' ''b'']
5071 !! html
5072 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5073 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5074 </p>
5075 !! end
5076
5077 !! test
5078 External links: wiki links within external link (Bug 3695)
5079 !! wikitext
5080 [http://example.com [[wikilink]] embedded in ext link]
5081 !! html/php
5082 <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>
5083 </p>
5084 !! html/parsoid
5085 <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>
5086 !! end
5087
5088 !! test
5089 BUG 787: Links with one slash after the url protocol are invalid
5090 !! wikitext
5091 http:/example.com
5092
5093 [http:/example.com title]
5094 !! html
5095 <p>http:/example.com
5096 </p><p>[http:/example.com title]
5097 </p>
5098 !! end
5099
5100 !! test
5101 Bracketed external links with template-generated invalid target
5102 !! wikitext
5103 [{{echo|http:/example.com}} title]
5104 !! html
5105 <p>[http:/example.com title]
5106 </p>
5107 !! end
5108
5109 !! test
5110 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5111 !! wikitext
5112 ''[http://example.com text'']
5113 [http://example.com '''text]'''
5114 ''Something [http://example.com in italic'']
5115 ''Something [http://example.com mixed''''', even bold]'''
5116 '''''Now [http://example.com both''''']
5117 !! html
5118 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5119 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5120 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5121 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5122 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5123 </p>
5124 !! end
5125
5126
5127 !! test
5128 Bug 4781: %26 in URL
5129 !! wikitext
5130 http://www.example.com/?title=AT%26T
5131 !! html/php
5132 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5133 </p>
5134 !! html/parsoid
5135 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5136 !! end
5137
5138 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5139 # % is actually legal in HTML5. Any change in output would need testing though.
5140 !! test
5141 Bug 4781, 5267: %25 in URL
5142 !! wikitext
5143 http://www.example.com/?title=100%25_Bran
5144 !! html/php
5145 <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>
5146 </p>
5147 !! html/parsoid
5148 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5149 !! end
5150
5151 !! test
5152 Bug 4781, 5267: %28, %29 in URL
5153 !! wikitext
5154 http://www.example.com/?title=Ben-Hur_%281959_film%29
5155 !! html/php
5156 <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>
5157 </p>
5158 !! html/parsoid
5159 <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>
5160 !! end
5161
5162
5163 !! test
5164 Bug 4781: %26 in autonumber URL
5165 !! wikitext
5166 [http://www.example.com/?title=AT%26T]
5167 !! html/php
5168 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5169 </p>
5170 !! html/parsoid
5171 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5172 !! end
5173
5174 !! test
5175 Bug 4781, 5267: %26 in autonumber URL
5176 !! wikitext
5177 [http://www.example.com/?title=100%25_Bran]
5178 !! html/php
5179 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5180 </p>
5181 !! html/parsoid
5182 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5183 !! end
5184
5185 !! test
5186 Bug 4781, 5267: %28, %29 in autonumber URL
5187 !! wikitext
5188 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5189 !! html/php
5190 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5191 </p>
5192 !! html/parsoid
5193 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5194 !! end
5195
5196
5197 !! test
5198 Bug 4781: %26 in bracketed URL
5199 !! wikitext
5200 [http://www.example.com/?title=AT%26T link]
5201 !! html/php
5202 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5203 </p>
5204 !! html/parsoid
5205 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5206 !! end
5207
5208 !! test
5209 Bug 4781, 5267: %25 in bracketed URL
5210 !! wikitext
5211 [http://www.example.com/?title=100%25_Bran link]
5212 !! html
5213 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5214 </p>
5215 !! end
5216
5217 !! test
5218 Bug 4781, 5267: %28, %29 in bracketed URL
5219 !! wikitext
5220 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5221 !! html/php
5222 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5223 </p>
5224 !! html/parsoid
5225 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5226 !! end
5227
5228 !! test
5229 External link containing a period in the anchor. (bug 63947)
5230 !! wikitext
5231 [//foo.org/bar#baz. bang]
5232
5233 [//foo.org/bar. bang]
5234 !! html/php
5235 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5236 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5237 </p>
5238 !! html/parsoid
5239 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5240 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5241 !! end
5242
5243 !! test
5244 External link containing a single quote. (bug 63947)
5245 !! wikitext
5246 [//foo.org/bar'baz]
5247
5248 [//foo.org/bar'baz bang]
5249 !! html/php
5250 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5251 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5252 </p>
5253 !! html/parsoid
5254 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5255 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5256 !! end
5257
5258 !! test
5259 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5260 !! wikitext
5261 Some [http://example.com/ pretty ''italics'' and stuff]!
5262 !! html
5263 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5264 </p>
5265 !! end
5266
5267 !! test
5268 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5269 !! wikitext
5270 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5271 !! html
5272 <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>
5273 </p>
5274 !! end
5275
5276 !! test
5277 External link containing double-single-quotes with no space separating the url from text in italics
5278 !! wikitext
5279 [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]].]
5280 !! html/php
5281 <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>
5282 </p>
5283 !! html/php+tidy
5284 <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>
5285 !! html/parsoid
5286 <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>
5287 !! end
5288
5289 !! test
5290 External link with comments in link text
5291 !! wikitext
5292 [http://www.google.com Google <!-- comment -->]
5293 !! html/php
5294 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5295 </p>
5296 !! html/parsoid
5297 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5298 !! end
5299
5300 !! test
5301 External link to bare IPv4 address
5302 !! wikitext
5303 [http://192.168.0.1 Link]
5304 !! html/php
5305 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5306 </p>
5307 !! html/parsoid
5308 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5309 !! end
5310
5311 !! test
5312 URL-encoding in URL functions (single parameter)
5313 !! wikitext
5314 {{localurl:Some page|amp=&}}
5315 !! html
5316 <p>/index.php?title=Some_page&amp;amp=&amp;
5317 </p>
5318 !! end
5319
5320 !! test
5321 URL-encoding in URL functions (multiple parameters)
5322 !! wikitext
5323 {{localurl:Some page|q=?&amp=&}}
5324 !! html
5325 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5326 </p>
5327 !! end
5328
5329 !! test
5330 Brackets in urls
5331 !! wikitext
5332 http://example.com/index.php?foozoid%5B%5D=bar
5333
5334 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5335 !! html/php
5336 <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>
5337 </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>
5338 </p>
5339 !! html/parsoid
5340 <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>
5341
5342 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5343 !! end
5344
5345 !! test
5346 IPv6 urls, autolink format (T23261)
5347 !! wikitext
5348 http://[2404:130:0:1000::187:2]/index.php
5349
5350 Examples from RFC 2373, section 2.2:
5351 * http://[1080::8:800:200C:417A]/unicast
5352 * http://[FF01::101]/multicast
5353 * http://[::1]/loopback
5354 * http://[::]/unspecified
5355 * http://[::13.1.68.3]/ipv4compat
5356 * http://[::FFFF:129.144.52.38]/ipv4compat
5357
5358 Examples from RFC 2732, section 2:
5359 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5360 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5361 * http://[3ffe:2a00:100:7031::1]
5362 * http://[1080::8:800:200C:417A]/foo
5363 * http://[::192.9.5.5]/ipng
5364 * http://[::FFFF:129.144.52.38]:80/index.html
5365 * http://[2010:836B:4179::836B:4179]
5366
5367 !! html/php
5368 <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>
5369 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5370 </p>
5371 <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>
5372 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5373 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5374 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5375 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5376 <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>
5377 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5378 </p>
5379 <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>
5380 <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>
5381 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5382 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5383 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5384 <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>
5385 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5386
5387 !! html/parsoid
5388 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a></p>
5389
5390 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5391 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5392 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5393 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5394 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5395 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5396 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5397
5398 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5399 <ul><li> <a rel="mw:ExtLink" 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>
5400 <li> <a rel="mw:ExtLink" 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>
5401 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5402 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5403 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5404 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5405 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5406 !! end
5407
5408 !! test
5409 IPv6 urls, bracketed format (T23261)
5410 !! wikitext
5411 [http://[2404:130:0:1000::187:2]/index.php test]
5412
5413 Examples from RFC 2373, section 2.2:
5414 * [http://[1080::8:800:200C:417A] unicast]
5415 * [http://[FF01::101] multicast]
5416 * [http://[::1]/ loopback]
5417 * [http://[::] unspecified]
5418 * [http://[::13.1.68.3] ipv4compat]
5419 * [http://[::FFFF:129.144.52.38] ipv4compat]
5420
5421 Examples from RFC 2732, section 2:
5422 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5423 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5424 * [http://[3ffe:2a00:100:7031::1] 3]
5425 * [http://[1080::8:800:200C:417A]/foo 4]
5426 * [http://[::192.9.5.5]/ipng 5]
5427 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5428 * [http://[2010:836B:4179::836B:4179] 7]
5429
5430 !! html/php
5431 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5432 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5433 </p>
5434 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5435 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5436 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5437 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5438 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5439 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5440 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5441 </p>
5442 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5443 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5444 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5445 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5446 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5447 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5448 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5449
5450 !! html/parsoid
5451 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5452
5453 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5454 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5455 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5456 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5457 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5458 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5459 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5460
5461 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5462 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5463 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5464 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5465 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5466 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5467 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5468 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5469 !! end
5470
5471 !! test
5472 Non-extlinks in brackets
5473 !! wikitext
5474 [foo]
5475 [foo bar]
5476 [foo ''bar'']
5477 [fool's] errand
5478 [fool's errand]
5479 [{{echo|foo}}]
5480 [{{echo|foo}} bar]
5481 [{{echo|foo}} ''bar'']
5482 [{{echo|foo}}l's] errand
5483 [{{echo|foo}}l's errand]
5484 [url={{echo|foo}}]
5485 [url=http://example.com]
5486 [http:// bare protocols don't count]
5487 !! html/php
5488 <p>[foo]
5489 [foo bar]
5490 [foo <i>bar</i>]
5491 [fool's] errand
5492 [fool's errand]
5493 [foo]
5494 [foo bar]
5495 [foo <i>bar</i>]
5496 [fool's] errand
5497 [fool's errand]
5498 [url=foo]
5499 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5500 [http:// bare protocols don't count]
5501 </p>
5502 !! html/parsoid
5503 <p>[foo]
5504 [foo bar]
5505 [foo <i>bar</i>]
5506 [fool's] errand
5507 [fool's errand]
5508 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5509 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5510 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5511 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5512 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5513 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5514 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5515 [http:// bare protocols don't count]</p>
5516 !! end
5517
5518 !! test
5519 Percent encoding in external links
5520 !! wikitext
5521 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5522 !! html/php
5523 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5524 </p>
5525 !! html/parsoid
5526 <p><a rel="mw:ExtLink"
5527 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5528 !! end
5529
5530 !! test
5531 Use url link syntax for links where the content is equal the link target
5532 !! wikitext
5533 http://example.com
5534 !! html/php
5535 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5536 </p>
5537 !! html/parsoid
5538 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5539 !! end
5540
5541 !! test
5542 Parenthesis in external links, especially URL links
5543 !! wikitext
5544 http://example.com)
5545
5546 http://example.com/test)
5547
5548 http://example.com/(test)
5549
5550 http://example.com/((test)
5551
5552 (http://example.com/(test))
5553
5554 (http://example.com/(test)))))
5555
5556 http://example.com/a)b
5557
5558 [http://example.com) foo]
5559 !! html/php
5560 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5561 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5562 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5563 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5564 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5565 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5566 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5567 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5568 </p>
5569 !! html/parsoid
5570 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5571 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5572 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5573 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5574 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5575 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5576 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5577 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5578 !! end
5579
5580 !! test
5581 Parenthesis in external links, w/ transclusion or comment
5582 !! wikitext
5583 (http://example.com/{{echo|hi}})
5584
5585 (http://example.com<!-- hi -->)
5586 !! html/php
5587 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5588 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5589 </p>
5590 !! html/parsoid
5591 <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>
5592
5593 <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>
5594 !! end
5595
5596 !! test
5597 Serialize <a> tags with invalid link targets as plain text
5598 !! options
5599 parsoid=html2wt
5600 !! html/parsoid
5601 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5602 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5603 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5604 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5605 !! wikitext
5606 text
5607 <nowiki>*</nowiki>text
5608 <nowiki>[[foo]]</nowiki>
5609 <nowiki>*a [[foo]]</nowiki>
5610 !! end
5611
5612 !! test
5613 mw:ExtLink -vs- mw:WikiLink (T94723)
5614 !! options
5615 parsoid=html2wt
5616 !! html/parsoid
5617 <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>
5618 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5619 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5620 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5621 <p>
5622 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5623 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5624 </p>
5625 !! wikitext
5626 [[Foo|Bar]]
5627 [[Foo|Bar]]
5628 [[wikipedia:Foo|Bar]]
5629 [[wikipedia:Foo|Bar]]
5630
5631 [[wikipedia:European_Robin|European Robin]]
5632 [[wikipedia:European_Robin|European Robin]]
5633 !! end
5634
5635 !! test
5636 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5637 !! options
5638 parsoid=wt2wt
5639 !! wikitext
5640 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5641 !! html/parsoid
5642 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5643 !! end
5644
5645
5646 ###
5647 ### Quotes
5648 ###
5649
5650 !! test
5651 Quotes
5652 !! wikitext
5653 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5654
5655 Normal text. '''''Bold italic text.''''' Normal text.
5656 !! html
5657 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5658 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5659 </p>
5660 !! end
5661
5662
5663 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5664 # parser strips. The wikitext contains just the first half of the bold
5665 # quote pair.
5666 !! test
5667 Unclosed and unmatched quotes
5668 !! wikitext
5669 '''''Bold italic text '''with bold deactivated''' in between.'''''
5670
5671 '''''Bold italic text ''with italic deactivated'' in between.'''''
5672
5673 '''Bold text..
5674
5675 ..spanning two paragraphs (should not work).'''
5676
5677 '''Bold tag left open
5678
5679 ''Italic tag left open
5680
5681 Normal text.
5682
5683 <!-- Unmatching number of opening, closing tags: -->
5684 '''This year''''s election ''should'' beat '''last year''''s.
5685
5686 ''Tom'''s car is bigger than ''Susan'''s.
5687
5688 Plain ''italic'''s plain
5689 !! html/php
5690 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5691 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5692 </p><p><b>Bold text..</b>
5693 </p><p>..spanning two paragraphs (should not work).
5694 </p><p><b>Bold tag left open</b>
5695 </p><p><i>Italic tag left open</i>
5696 </p><p>Normal text.
5697 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5698 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5699 </p><p>Plain <i>italic'</i>s plain
5700 </p>
5701 !! html/parsoid
5702 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5703 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5704 </p><p><b>Bold text..</b>
5705 </p><p>..spanning two paragraphs (should not work).<b></b>
5706 </p><p><b>Bold tag left open</b>
5707 </p><p><i>Italic tag left open</i>
5708 </p><p>Normal text.
5709 </p>
5710 <!-- Unmatching number of opening, closing tags: -->
5711 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5712 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5713 </p><p>Plain <i>italic'</i>s plain
5714 </p>
5715 !! end
5716
5717 ###
5718 ### Tables
5719 ###
5720 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5721 ###
5722
5723 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5724 # is the bare minimum required by the spec, see:
5725 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5726 # Parsoid team replies: empty table tags are legal in HTML5
5727 !! test
5728 A table with no data.
5729 !! options
5730 parsoid=wt2html
5731 !! wikitext
5732 {||}
5733 !! html/php
5734
5735 !! html/parsoid
5736 <table></table>
5737
5738 !! end
5739
5740 !! test
5741 A table with stray table end tags on start tag line (wt2html)
5742 !! options
5743 parsoid=wt2html
5744 !! wikitext
5745 {|style="color: red;"|}
5746
5747 {|style="color: red;" |}
5748 |foo
5749 |}
5750
5751 {|style="color: red;"|} id="foo"
5752 |foo
5753 |}
5754
5755 {|style="color: red;" |} id="foo"
5756 |foo
5757 |}
5758 !! html
5759 <table style="color: red;"></table>
5760
5761 <table style="color: red;">
5762 <tbody><tr>
5763 <td>foo</td>
5764 </tr></tbody>
5765 </table>
5766
5767 <table style="color: red;" id="foo">
5768 <tbody><tr>
5769 <td>foo</td>
5770 </tr></tbody>
5771 </table>
5772
5773 <table style="color: red;" id="foo">
5774 <tbody><tr>
5775 <td>foo</td>
5776 </tr></tbody>
5777 </table>
5778
5779 !! end
5780
5781 !! test
5782 A table with no data (take 2)
5783 !! wikitext
5784 {|
5785 |}
5786 !! html/parsoid
5787 <table></table>
5788 !! end
5789
5790 # A table with nothing but a caption is invalid XHTML, we might want to render
5791 # this as <p>caption</p>
5792 # Parsoid team replies: table with only a caption is legal in HTML5
5793 !! test
5794 A table with nothing but a caption
5795 !! wikitext
5796 {|
5797 |+ caption
5798 |}
5799 !! html/php
5800 <table>
5801 <caption> caption
5802 </caption><tr><td></td></tr></table>
5803
5804 !! html/parsoid
5805 <table><caption> caption</caption></table>
5806 !! end
5807
5808 !! test
5809 A table with caption with default-spaced attributes and a table row
5810 !! wikitext
5811 {|
5812 |+ style="color: red;" | caption1
5813 |-
5814 | foo
5815 |}
5816 !! html
5817 <table>
5818 <caption style="color: red;"> caption1
5819 </caption>
5820 <tr>
5821 <td> foo
5822 </td></tr></table>
5823
5824 !! end
5825
5826 !! test
5827 A table with captions with non-default spaced attributes and a table row
5828 !! wikitext
5829 {|
5830 |+style="color: red;"|caption2
5831 |+ style="color: red;"| caption3
5832 |-
5833 | foo
5834 |}
5835 !! html
5836 <table>
5837 <caption style="color: red;">caption2
5838 </caption>
5839 <caption style="color: red;"> caption3
5840 </caption>
5841 <tr>
5842 <td> foo
5843 </td></tr></table>
5844
5845 !! end
5846
5847 !! test
5848 Table td-cell syntax variations
5849 !! wikitext
5850 {|
5851 | foo bar foo | baz
5852 | foo bar foo || baz
5853 | style='color:red;' | baz
5854 | style='color:red;' || baz
5855 |}
5856 !! html
5857 <table>
5858 <tr>
5859 <td> baz
5860 </td>
5861 <td> foo bar foo </td>
5862 <td> baz
5863 </td>
5864 <td style="color:red;"> baz
5865 </td>
5866 <td> style='color:red;' </td>
5867 <td> baz
5868 </td></tr></table>
5869
5870 !! end
5871
5872 !! test
5873 Simple table
5874 !! wikitext
5875 {|
5876 | 1 || 2
5877 |-
5878 | 3 || 4
5879 |}
5880 !! html
5881 <table>
5882 <tr>
5883 <td> 1 </td>
5884 <td> 2
5885 </td></tr>
5886 <tr>
5887 <td> 3 </td>
5888 <td> 4
5889 </td></tr></table>
5890
5891 !! end
5892
5893 !! test
5894 Simple table but with multiple dashes for row wikitext
5895 !! wikitext
5896 {|
5897 | foo
5898 |-----
5899 | bar
5900 |}
5901 !! html
5902 <table>
5903 <tr>
5904 <td> foo
5905 </td></tr>
5906 <tr>
5907 <td> bar
5908 </td></tr></table>
5909
5910 !! end
5911
5912 !! test
5913 Multiplication table
5914 !! wikitext
5915 {| border="1" cellpadding="2"
5916 |+Multiplication table
5917 |-
5918 ! &times; !! 1 !! 2 !! 3
5919 |-
5920 ! 1
5921 | 1 || 2 || 3
5922 |-
5923 ! 2
5924 | 2 || 4 || 6
5925 |-
5926 ! 3
5927 | 3 || 6 || 9
5928 |-
5929 ! 4
5930 | 4 || 8 || 12
5931 |-
5932 ! 5
5933 | 5 || 10 || 15
5934 |}
5935 !! html
5936 <table border="1" cellpadding="2">
5937 <caption>Multiplication table
5938 </caption>
5939 <tr>
5940 <th> &#215; </th>
5941 <th> 1 </th>
5942 <th> 2 </th>
5943 <th> 3
5944 </th></tr>
5945 <tr>
5946 <th> 1
5947 </th>
5948 <td> 1 </td>
5949 <td> 2 </td>
5950 <td> 3
5951 </td></tr>
5952 <tr>
5953 <th> 2
5954 </th>
5955 <td> 2 </td>
5956 <td> 4 </td>
5957 <td> 6
5958 </td></tr>
5959 <tr>
5960 <th> 3
5961 </th>
5962 <td> 3 </td>
5963 <td> 6 </td>
5964 <td> 9
5965 </td></tr>
5966 <tr>
5967 <th> 4
5968 </th>
5969 <td> 4 </td>
5970 <td> 8 </td>
5971 <td> 12
5972 </td></tr>
5973 <tr>
5974 <th> 5
5975 </th>
5976 <td> 5 </td>
5977 <td> 10 </td>
5978 <td> 15
5979 </td></tr></table>
5980
5981 !! end
5982
5983 !! test
5984 Accept "||" in table headings
5985 !! wikitext
5986 {|
5987 !h1 || h2
5988 |}
5989 !! html
5990 <table>
5991 <tr>
5992 <th>h1 </th>
5993 <th> h2
5994 </th></tr></table>
5995
5996 !! end
5997
5998 !! test
5999 Accept "!!" in table data
6000 !! wikitext
6001 {|
6002 | Foo!! ||
6003 |}
6004 !! html
6005 <table>
6006 <tr>
6007 <td> Foo!! </td>
6008 <td>
6009 </td></tr></table>
6010
6011 !! html/parsoid
6012 <table>
6013 <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>
6014 </tbody></table>
6015 !! end
6016
6017 !! test
6018 Accept "||" in indented table headings
6019 !! wikitext
6020 :{|
6021 !h1 || h2
6022 |}
6023 !! html
6024 <dl><dd><table>
6025 <tr>
6026 <th>h1 </th>
6027 <th> h2
6028 </th></tr></table></dd></dl>
6029
6030 !! end
6031
6032 !! test
6033 Accept "!!" in templates
6034 !! wikitext
6035 {|
6036 !a {{echo|b!!c}}
6037 |}
6038 !! html/php
6039 <table>
6040 <tr>
6041 <th>a b</th>
6042 <th>c
6043 </th></tr></table>
6044
6045 !! html/parsoid
6046 <table>
6047 <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>
6048 !! end
6049
6050 !! test
6051 Accept "!!" in table headings after newline
6052 !! wikitext
6053 {|
6054 !a
6055 b!!c
6056 |}
6057 !! html/php
6058 <table>
6059 <tr>
6060 <th>a
6061 <p>b!!c
6062 </p>
6063 </th></tr></table>
6064
6065 !! html/parsoid
6066 <table>
6067 <tbody><tr><th>a
6068 <p>b!!c</p></th></tr>
6069 </tbody></table>
6070 !! end
6071
6072 !! test
6073 Accept "!!" in table data of mixed wikitext / html syntax
6074 !! wikitext
6075 {|
6076 !a
6077 <tr><td>b!!c</td></tr>
6078 |}
6079 !! html+tidy
6080 <table>
6081 <tr>
6082 <th>a</th>
6083 </tr>
6084 <tr>
6085 <td>b!!c</td>
6086 </tr>
6087 </table>
6088 !! html/parsoid
6089 <table>
6090 <tbody><tr><th>a</th></tr>
6091 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6092 </tbody></table>
6093 !! end
6094
6095 !! test
6096 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6097 !! wikitext
6098 {|
6099 !| h1
6100 || a
6101 |}
6102 !! html
6103 <table>
6104 <tr>
6105 <th> h1
6106 </th>
6107 <td> a
6108 </td></tr></table>
6109
6110 !! end
6111
6112 !!test
6113 Accept "| !" at start of line in tables (ignore !-attribute)
6114 !! wikitext
6115 {|
6116 |-
6117 | !style="color:red" | bar
6118 |}
6119 !! html
6120 <table>
6121
6122 <tr>
6123 <td> bar
6124 </td></tr></table>
6125
6126 !!end
6127
6128 !!test
6129 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 +/-
6130 !! wikitext
6131 {|
6132 |-
6133 |style='color:red;'|+1
6134 |style='color:blue;'|-1
6135 |-
6136 | 1 || 2 || 3
6137 | 1 ||+2 ||-3
6138 |-
6139 | +1
6140 | -1
6141 |}
6142 !! html
6143 <table>
6144
6145 <tr>
6146 <td style="color:red;">+1
6147 </td>
6148 <td style="color:blue;">-1
6149 </td></tr>
6150 <tr>
6151 <td> 1 </td>
6152 <td> 2 </td>
6153 <td> 3
6154 </td>
6155 <td> 1 </td>
6156 <td>+2 </td>
6157 <td>-3
6158 </td></tr>
6159 <tr>
6160 <td> +1
6161 </td>
6162 <td> -1
6163 </td></tr></table>
6164
6165 !!end
6166
6167 !! test
6168 Table rowspan
6169 !! wikitext
6170 {| border=1
6171 | Cell 1, row 1
6172 |rowspan=2| Cell 2, row 1 (and 2)
6173 | Cell 3, row 1
6174 |-
6175 | Cell 1, row 2
6176 | Cell 3, row 2
6177 |}
6178 !! html
6179 <table border="1">
6180 <tr>
6181 <td> Cell 1, row 1
6182 </td>
6183 <td rowspan="2"> Cell 2, row 1 (and 2)
6184 </td>
6185 <td> Cell 3, row 1
6186 </td></tr>
6187 <tr>
6188 <td> Cell 1, row 2
6189 </td>
6190 <td> Cell 3, row 2
6191 </td></tr></table>
6192
6193 !! end
6194
6195 !! test
6196 Nested table
6197 !! wikitext
6198 {| border=1
6199 | &alpha;
6200 |
6201 {| bgcolor=#ABCDEF border=2
6202 |nested
6203 |-
6204 |table
6205 |}
6206 |the original table again
6207 |}
6208 !! html
6209 <table border="1">
6210 <tr>
6211 <td> &#945;
6212 </td>
6213 <td>
6214 <table bgcolor="#ABCDEF" border="2">
6215 <tr>
6216 <td>nested
6217 </td></tr>
6218 <tr>
6219 <td>table
6220 </td></tr></table>
6221 </td>
6222 <td>the original table again
6223 </td></tr></table>
6224
6225 !! end
6226
6227 !! test
6228 Invalid attributes in table cell (bug 1830)
6229 !! wikitext
6230 {|
6231 |Cell:|broken
6232 |}
6233 !! html
6234 <table>
6235 <tr>
6236 <td>broken
6237 </td></tr></table>
6238
6239 !! end
6240
6241 !! test
6242 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6243 !! wikitext
6244 {|
6245 | title="foo" |bar
6246 | title="foo<nowiki>|</nowiki>" |bar
6247 | title="foo<nowiki>|</nowiki>" bar
6248 |}
6249 !! html/php
6250 <table>
6251 <tr>
6252 <td title="foo">bar
6253 </td>
6254 <td title="foo&#124;">bar
6255 </td>
6256 <td> title="foo|" bar
6257 </td></tr></table>
6258
6259 !! html/parsoid
6260 <table>
6261 <tbody><tr><td title="foo">bar</td>
6262 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6263 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6264 </tbody></table>
6265 !! end
6266
6267 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6268 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6269 # *2wt modes will fail.
6270 !! test
6271 Table security: embedded pipes
6272 !! options
6273 parsoid=wt2html,html2html
6274 !! wikitext
6275 {|
6276 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6277 !! html/php
6278 <table>
6279 <tr>
6280 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6281 <td>]" onmouseover="alert(document.cookie)"&gt;test
6282 </td>
6283 </tr>
6284 </table>
6285
6286 !! html/parsoid
6287 <table><tbody>
6288 <tr>
6289 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6290 !! end
6291
6292 # FIXME: The output seems broken. Filed as T110268.
6293 !! test
6294 ! and || in td attributes should not be parsed as <th>/<td>
6295 !! options
6296 parsoid=wt2html
6297 !! wikitext
6298 {|
6299 | style="color: red !important;" data-contrived="put this here ||" | foo
6300 |}
6301 !! html/php
6302 <table>
6303 <tr>
6304 <td> style="color: red !important;" data-contrived="put this here </td>
6305 <td> foo
6306 </td></tr></table>
6307
6308 !! html/parsoid
6309 <table>
6310 <tbody><tr><td> style="color: red !important;" data-contrived="put this here </td><td data-parsoid='{"stx_v":"row","a":{"\"":null},"sa":{"\"":""},"autoInsertedEnd":true}'> foo</td></tr>
6311 </tbody></table>
6312 !! end
6313
6314 !! test
6315 Indented table markup mixed with indented pre content (proposed in bug 6200)
6316 !! wikitext
6317 <table>
6318 <tr>
6319 <td>
6320 Text that should be rendered preformatted
6321 </td>
6322 </tr>
6323 </table>
6324 !! html
6325 <table>
6326 <tr>
6327 <td>
6328 <pre>Text that should be rendered preformatted
6329 </pre>
6330 </td>
6331 </tr>
6332 </table>
6333
6334 !! end
6335
6336 !! test
6337 1. Template-generated table cell attributes and cell content
6338 !! wikitext
6339 {|
6340 |{{table_attribs}}
6341 | {{table_attribs}}
6342 || {{table_attribs_5}}
6343 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6344 |align=center {{table_attribs}}
6345 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6346 |}
6347 !! html
6348 <table>
6349 <tr>
6350 <td style="color:red;">Foo
6351 </td>
6352 <td style="color:red;">Foo
6353 </td>
6354 <td> style="color:red;"</td>
6355 <td>Bar
6356 </td>
6357 <td style="color:red;">Foo
6358 </td>
6359 <td align="center" style="color:red;">Foo
6360 </td>
6361 <td align="center" style="color:red;">Foo
6362 </td></tr></table>
6363
6364 !! end
6365
6366 !! test
6367 2. Template-generated table cell attributes and cell content
6368 !! wikitext
6369 {|
6370 |{{table_attribs_2}}
6371 |}
6372 !! html/php
6373 <table>
6374 <tr>
6375 <td style="color:red;">Foo
6376 </td>
6377 <td>Bar</td>
6378 <td>Baz
6379 </td></tr></table>
6380
6381 !! html/parsoid
6382 <table>
6383 <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>
6384 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6385 </tbody></table>
6386 !! end
6387
6388 !! test
6389 3. Template-generated table cell attributes and cell content
6390 !! wikitext
6391 {|
6392 !align=center {{table_header_cells}}
6393 |-
6394 |align=center {{table_cells}}
6395 |}
6396 !! html/php
6397 <table>
6398 <tr>
6399 <th align="center" style="color:red;">Foo</th>
6400 <th style="color:red;"><i>Bar</i></th>
6401 <th style="color:brown;"><i>Foo</i> and Baz
6402 </th></tr>
6403 <tr>
6404 <td align="center" style="color:red;">Foo</td>
6405 <td style="color:red;"><i>Bar</i></td>
6406 <td style="color:brown;"><i>Foo</i> and Baz
6407 </td></tr></table>
6408
6409 !! html/parsoid
6410 <table>
6411 <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>
6412 <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>
6413 </tbody></table>
6414 !! end
6415
6416 !! test
6417 4. Template-generated table cell attributes and cell content inside a templated table
6418 !! wikitext
6419 {{tbl-start}}
6420 !align=center {{table_header_cells}}
6421 |-
6422 |align=center {{table_cells}}
6423 {{tbl-end}}
6424 !! html/php
6425 <table>
6426 <tr>
6427 <th align="center" style="color:red;">Foo</th>
6428 <th style="color:red;"><i>Bar</i></th>
6429 <th style="color:brown;"><i>Foo</i> and Baz
6430 </th></tr>
6431 <tr>
6432 <td align="center" style="color:red;">Foo</td>
6433 <td style="color:red;"><i>Bar</i></td>
6434 <td style="color:brown;"><i>Foo</i> and Baz
6435 </td></tr></table>
6436
6437 !! html/parsoid
6438 <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}}]}'>
6439 <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>
6440 <tr>
6441 <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>
6442 </tbody></table>
6443 !! end
6444
6445 ## Edge case fix to prevent future regressions
6446 !! test
6447 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6448 !! wikitext
6449 {|
6450 |{{table_attribs_7}}
6451 |}
6452 <references />
6453 !! html/parsoid
6454 <table>
6455 <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>
6456 </tbody></table>
6457 <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>
6458 !! end
6459
6460 !! test
6461 Table with row followed by newlines and table heading
6462 !! wikitext
6463 {|
6464 |-
6465
6466 ! foo
6467 |}
6468 !! html
6469 <table>
6470
6471
6472 <tr>
6473 <th> foo
6474 </th></tr></table>
6475
6476 !! end
6477
6478 !! test
6479 Table with empty line following the start tag
6480 !! wikitext
6481 {|
6482
6483 |-
6484 | foo
6485 |}
6486 !! html
6487 <table>
6488
6489
6490 <tr>
6491 <td> foo
6492 </td></tr></table>
6493
6494 !! end
6495
6496 # FIXME: Preserve the attribute properly (with an empty string as value) in
6497 # the PHP parser. Parsoid implements the behavior below.
6498 !! test
6499 Table attributes with empty value
6500 !! wikitext
6501 {|
6502 | style=| hello
6503 |}
6504 !! html/parsoid
6505 <table>
6506 <tbody>
6507 <tr>
6508 <td style=""> hello
6509 </td></tr></tbody></table>
6510
6511 !! end
6512
6513 !! test
6514 Wikitext table with a lot of comments
6515 !! wikitext
6516 {|
6517 <!-- c0 -->
6518 | foo
6519 <!-- c1 -->
6520 |-<!-- c2 -->
6521 <!-- c3 -->
6522 |<!-- c4 -->
6523 <!-- c5 -->
6524 |}
6525 !! html
6526 <table>
6527 <tr>
6528 <td> foo
6529 </td></tr>
6530 <tr>
6531 <td>
6532 </td></tr></table>
6533
6534 !! end
6535
6536 !! test
6537 Wikitext table comments represented in parsoid dom
6538 !! wikitext
6539 {|<!--c1--><!--c2-->
6540 |-<!--c3-->
6541 | x
6542 |}
6543 !! html/php+tidy
6544 <table>
6545 <tr>
6546 <td>x</td>
6547 </tr>
6548 </table>
6549 !! html/parsoid
6550 <table><!--c1--><!--c2-->
6551 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6552 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6553 </tbody></table>
6554 !! end
6555
6556 !! test
6557 Wikitext table with double-line table cell
6558 !! wikitext
6559 {|
6560 |a
6561 b
6562 |}
6563 !! html
6564 <table>
6565 <tr>
6566 <td>a
6567 <p>b
6568 </p>
6569 </td></tr></table>
6570
6571 !! end
6572
6573 !! test
6574 Table cell with a single comment
6575 !! wikitext
6576 {|
6577 | <!-- c1 -->
6578 | a
6579 |}
6580 !! html
6581 <table>
6582 <tr>
6583 <td>
6584 </td>
6585 <td> a
6586 </td></tr></table>
6587
6588 !! end
6589
6590 !! test
6591 Table-cell after a comment-only-empty-line
6592 !! wikitext
6593 {|
6594 |a
6595 <!--c1-->
6596 <!--c2-->| b
6597 |}
6598 !! html
6599 <table>
6600 <tr>
6601 <td>a
6602 </td>
6603 <td> b
6604 </td></tr></table>
6605
6606 !! html/parsoid
6607 <table>
6608 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6609 <!--c1-->
6610 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6611 </tbody></table>
6612
6613 !! end
6614
6615 !! test
6616 Build table with {{!}}
6617 !! wikitext
6618 {{{!}} class="wikitable"
6619 ! header
6620 ! second header
6621 {{!}}- style="color:red;"
6622 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6623 {{!}}}
6624 !! html
6625 <table class="wikitable">
6626 <tr>
6627 <th> header
6628 </th>
6629 <th> second header
6630 </th></tr>
6631 <tr style="color:red;">
6632 <td> data </td>
6633 <td style="color:red;"> second data
6634 </td></tr></table>
6635
6636 !! end
6637
6638 !! test
6639 Build table with pipe as data
6640 !! wikitext
6641 {| class="wikitable"
6642 ! header
6643 ! second header
6644 |- style="color:red;"
6645 | data || style="color:red;" | second data
6646 |-
6647 | style="color:red;" | data with | || style="color:red;" | second data with |
6648 |-
6649 || data with | ||| second data with |
6650 |}
6651 !! html
6652 <table class="wikitable">
6653 <tr>
6654 <th> header
6655 </th>
6656 <th> second header
6657 </th></tr>
6658 <tr style="color:red;">
6659 <td> data </td>
6660 <td style="color:red;"> second data
6661 </td></tr>
6662 <tr>
6663 <td style="color:red;"> data with | </td>
6664 <td style="color:red;"> second data with |
6665 </td></tr>
6666 <tr>
6667 <td> data with | </td>
6668 <td> second data with |
6669 </td></tr></table>
6670
6671 !! end
6672
6673 !! test
6674 Build table with wikilink
6675 !! wikitext
6676 {| class="wikitable"
6677 ! header || second header
6678 |- style="color:red;"
6679 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6680 |-
6681 | data || second data [[Main Page|link|text with pipe]]
6682 |}
6683 !! html
6684 <table class="wikitable">
6685 <tr>
6686 <th> header </th>
6687 <th> second header
6688 </th></tr>
6689 <tr style="color:red;">
6690 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6691 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6692 </td></tr>
6693 <tr>
6694 <td> data </td>
6695 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6696 </td></tr></table>
6697
6698 !! end
6699
6700 # The expected HTML structure in this test is debatable. The PHP parser does
6701 # not parse this kind of table at all. The main focus for Parsoid is on
6702 # round-tripping, so this output is ok for now. TODO: revisit!
6703 !! test
6704 Wikitext table with html-syntax row
6705 !! wikitext
6706 {|
6707 |-
6708 <td>foo</td>
6709 |}
6710 !! html/parsoid
6711 <table>
6712 <tbody>
6713 <tr>
6714 <td>foo</td></tr></tbody></table>
6715 !! end
6716
6717 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6718 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6719 ## PHP parser, which tidy then compounds by fostering the content
6720 ## entirely out of the table. Parsoid recognizes the table context
6721 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6722 ## depends on PHP's treatment of broken table markup!
6723 !! test
6724 Implicit <td> after a |-
6725 !! options
6726 parsoid=wt2html,html2html
6727 !! wikitext
6728 {|
6729 |-
6730 a
6731 |}
6732 !! html/php
6733 <table>
6734
6735 a
6736 </table>
6737
6738 !! html/php+tidy
6739 <p>a</p>
6740 !! html/parsoid
6741 <table>
6742 <tr><td>a</td></tr>
6743 </table>
6744 !! end
6745
6746 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6747 !! test
6748 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6749 !! options
6750 parsoid=wt2html,html2html
6751 !! wikitext
6752 {|
6753 |-
6754 |
6755 a
6756 |-
6757 b
6758 |}
6759 !! html/php
6760 <table>
6761
6762 <tr>
6763 <td>
6764 <pre>a
6765 </pre>
6766 </td></tr>
6767 b
6768 </table>
6769
6770 !! html/php+tidy
6771 <p>b</p>
6772 <table>
6773 <tr>
6774 <td>
6775 <pre>
6776 a
6777 </pre></td>
6778 </tr>
6779 </table>
6780 !! html/parsoid
6781 <table>
6782 <tbody>
6783 <tr><td><pre>a</pre></td></tr>
6784 <tr><td> b</td></tr>
6785 </tbody>
6786 </table>
6787 !! end
6788
6789 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6790 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6791 !! test
6792 Lists should be recognized in an implicit <td> context
6793 !! options
6794 parsoid=wt2html,html2html
6795 !! wikitext
6796 {|
6797 |-
6798 *a
6799 |}
6800 !! html/php
6801 <table>
6802
6803 <ul><li>a</li></ul>
6804 </table>
6805
6806 !! html/php+tidy
6807 <ul>
6808 <li>a</li>
6809 </ul>
6810 !! html/parsoid
6811 <table>
6812 <tr>
6813 <td><ul>
6814 <li>a</li>
6815 </ul></td>
6816 </tr>
6817 </table>
6818 !! end
6819
6820 !! test
6821 Table cells not properly parsed in an implicit-td context
6822 !! wikitext
6823 {|
6824 |-
6825 {{table_attribs_4}} || a || b
6826 |}
6827 !! html/php+tidy
6828 <table>
6829 <tr>
6830 <td style="background-color:#DC241f;" width="10px"></td>
6831 <td>a</td>
6832 <td>b</td>
6833 </tr>
6834 </table>
6835 !! html/parsoid
6836 <table>
6837 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6838 <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>
6839 </tbody></table>
6840 !! end
6841
6842 !! test
6843 Parsoid: Round-trip tables directly followed by content (bug 51219)
6844 !! options
6845 parsoid=wt2html,wt2wt
6846 !! wikitext
6847 {|
6848 |foo
6849 |} bar
6850
6851 {|
6852 |baz
6853 |}<b>quux</b>
6854 !! html+tidy
6855 <table>
6856 <tr>
6857 <td>foo</td>
6858 </tr>
6859 </table>
6860 <p>bar</p>
6861 <table>
6862 <tr>
6863 <td>baz</td>
6864 </tr>
6865 </table>
6866 <p><b>quux</b></p>
6867 !! end
6868
6869 !! test
6870 Parsoid: Default to a newline after tables in new content (bug 51219)
6871 !! options
6872 parsoid=html2wt
6873 !! html/parsoid
6874 <table><tbody>
6875 <tr><td>foo</td></tr></tbody></table> bar
6876 <table><tbody>
6877 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6878 !! wikitext
6879 {|
6880 |foo
6881 |}
6882 <nowiki> </nowiki>bar
6883 {|
6884 |baz
6885 |}
6886 '''quux'''
6887 !! end
6888
6889 !! test
6890 Parsoid: newline inducing block nodes don't suppress <nowiki>
6891 !! options
6892 parsoid=html2wt
6893 !! html/parsoid
6894 a<h1>foo</h1>
6895 !! wikitext
6896 <nowiki> </nowiki>a
6897
6898 = foo =
6899 !! end
6900
6901 !! test
6902 Parsoid: Row-syntax table headings followed by comment & table cells
6903 !! options
6904 parsoid=wt2html,wt2wt
6905 !! wikitext
6906 {|
6907 ! foo || bar
6908 <!-- foo --> || baz || quux
6909 |}
6910 !! html/php
6911 <table>
6912 <tr>
6913 <th> foo </th>
6914 <th> bar
6915 </th>
6916 <td> baz </td>
6917 <td> quux
6918 </td></tr></table>
6919
6920 !! html/parsoid
6921 <table>
6922 <tbody><tr><th> foo </th><th> bar
6923 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
6924 </tbody></table>
6925 !! end
6926
6927 !!test
6928 Parsoid: Recover better from broken table attributes
6929 !!options
6930 parsoid=wt2html
6931 !!wikitext
6932 {| class="foo
6933 | class="bar" |
6934 foo
6935 |}
6936 !!html/php+tidy
6937 <table class="foo">
6938 <tr>
6939 <td class="bar">
6940 <p>foo</p>
6941 </td>
6942 </tr>
6943 </table>
6944 !!html/parsoid
6945 <table class="foo">
6946 <tr>
6947 <td class="bar">
6948 <p>foo</p></td></tr>
6949 </tbody></table>
6950 !!end
6951
6952 !! test
6953 Tables: Digest broken attributes on table and tr tag
6954 !! options
6955 parsoid=wt2html
6956 !! wikitext
6957 {| || |} ++
6958 |- || || ++ --
6959 |- > [
6960 |}
6961 !! html
6962 <table>
6963 <tbody>
6964 <tr></tr>
6965 <tr></tr>
6966 </tbody></table>
6967 !! end
6968
6969 !! test
6970 Strip unsupported table tags
6971 !! options
6972 parsoid=html2wt
6973 !! html/parsoid
6974 <table>
6975 <thead>
6976 <tr>
6977 <th>Month</th>
6978 <th>Savings</th>
6979 </tr>
6980 </thead>
6981 <tbody>
6982 <tr>
6983 <td>January</td>
6984 <td>$100</td>
6985 </tr>
6986 <tr>
6987 <td>February</td>
6988 <td>$80</td>
6989 </tr>
6990 </tbody>
6991 <tfoot>
6992 <tr>
6993 <td>Sum</td>
6994 <td>$180</td>
6995 </tr>
6996 </tfoot>
6997 </table>
6998 !! wikitext
6999 {|
7000
7001 !Month
7002 !Savings
7003
7004 |January
7005 |$100
7006
7007 |-
7008 |February
7009 |$80
7010
7011 |Sum
7012 |$180
7013
7014 |}
7015 !! end
7016
7017 !!test
7018 Testing serialization after deletion of table cells
7019 !!options
7020 parsoid={
7021 "modes": ["wt2wt", "selser"],
7022 "changes": [
7023 ["#x", "remove"]
7024 ]
7025 }
7026 !!wikitext
7027 {|
7028 !h1 !!h2 !!h3
7029 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7030 |}
7031 !! wikitext/edited
7032 {|
7033 !h1 !!h2 !!h3
7034 |c2 |||c3
7035 |}
7036 !!end
7037
7038 ###
7039 ### Internal links
7040 ###
7041 !! test
7042 Plain link, capitalized
7043 !! wikitext
7044 [[Main Page]]
7045 !! html
7046 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7047 </p>
7048 !! end
7049
7050 !! test
7051 Plain link, uncapitalized
7052 !! wikitext
7053 [[main Page]]
7054 !! html
7055 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7056 </p>
7057 !! end
7058
7059 !! test
7060 Piped link
7061 !! wikitext
7062 [[Main Page|The Main Page]]
7063 !! html
7064 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7065 </p>
7066 !! end
7067
7068 !! test
7069 Piped link with comment in link text
7070 !! wikitext
7071 [[Main Page|The Main<!--front--> Page]]
7072 !! html
7073 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7074 </p>
7075 !! end
7076
7077 !! test
7078 Piped link with multiple pipe characters in link text
7079 !! wikitext
7080 [[Main Page||The|Main|Page|]]
7081 !! html/php
7082 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7083 </p>
7084 !! html/parsoid
7085 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7086 !! end
7087
7088 !! test
7089 Broken link
7090 !! wikitext
7091 [[Zigzagzogzagzig]]
7092 !! html
7093 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7094 </p>
7095 !! end
7096
7097 !! test
7098 Broken link with fragment
7099 !! wikitext
7100 [[Zigzagzogzagzig#zug]]
7101 !! html
7102 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7103 </p>
7104 !! end
7105
7106 !! test
7107 Special page link with fragment
7108 !! wikitext
7109 [[Special:Version#anchor]]
7110 !! html
7111 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7112 </p>
7113 !! end
7114
7115 !! test
7116 Nonexistent special page link with fragment
7117 !! wikitext
7118 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7119 !! html
7120 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7121 </p>
7122 !! end
7123
7124 !! test
7125 Link with prefix
7126 !! wikitext
7127 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7128 !! html
7129 <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>
7130 </p>
7131 !! end
7132
7133 !! test
7134 Link with suffix
7135 !! wikitext
7136 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7137 !! html
7138 <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>!!!
7139 </p>
7140 !! end
7141
7142 !! article
7143 prefixed article
7144 !! text
7145 Some text
7146 !! endarticle
7147
7148 !! test
7149 Bug 43661: Piped links with identical prefixes
7150 !! wikitext
7151 [[prefixed article|prefixed articles with spaces]]
7152
7153 [[prefixed article|prefixed articlesaoeu]]
7154
7155 [[Main Page|Main Page test]]
7156 !! html
7157 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7158 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7159 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7160 </p>
7161 !! end
7162
7163
7164 !! test
7165 Link with HTML entity in suffix / tail
7166 !! wikitext
7167 [[Main Page]]&quot;, [[Main Page]]&#97;
7168 !! html/php
7169 <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;
7170 </p>
7171 !! html/parsoid
7172 <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>
7173 !! end
7174
7175 !! test
7176 Link with 3 brackets
7177 !! wikitext
7178 [[[Main Page]]]
7179 Foo [[[Main Page]]]
7180 !! html
7181 <p>[[[Main Page]]]
7182 Foo [[[Main Page]]]
7183 </p>
7184 !! end
7185
7186 !! test
7187 Link with 4 brackets
7188 !! wikitext
7189 [[[[Main Page]]]]
7190 !! html
7191 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7192 </p>
7193 !! end
7194
7195 !! test
7196 Piped link with 3 brackets
7197 !! wikitext
7198 [[[main page|the main page]]]
7199 !! html
7200 <p>[[[main page|the main page]]]
7201 </p>
7202 !! end
7203
7204 !! test
7205 Piped link with extlink-like text
7206 !! wikitext
7207 [[Main Page|[bar]]]
7208 [[Main Page|This is a [bar]]]
7209 !! html/php
7210 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7211 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7212 </p>
7213 !! html/parsoid
7214 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7215 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7216 !! end
7217
7218 !! test
7219 Link with multiple pipes
7220 !! wikitext
7221 [[Main Page|The|Main|Page]]
7222 !! html
7223 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7224 </p>
7225 !! end
7226
7227 # Note that parsoid does not munge anchor text; all non-space
7228 # characters are valid in HTML5 ids.
7229 !! test
7230 Anchor containing a #. (bug 63430)
7231 !! wikitext
7232 [[Main Page#And#Link]]
7233 !! html/php
7234 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7235 </p>
7236 !! html/parsoid
7237 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
7238 !! end
7239
7240 !! test
7241 Link to namespaces
7242 !! wikitext
7243 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7244 !! html
7245 <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>
7246 </p>
7247 !! end
7248
7249 !! test
7250 Link with space in namespace
7251 !! wikitext
7252 [[User talk:Foo bar]]
7253 !! html
7254 <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>
7255 </p>
7256 !! end
7257
7258 !! article
7259 MemoryAlpha:AlphaTest
7260 !! text
7261 This is an article in the MemoryAlpha namespace
7262 (which shadows the memoryalpha interwiki link).
7263 !! endarticle
7264
7265 !! test
7266 Namespace takes precedence over interwiki link (bug 51680)
7267 !! wikitext
7268 [[MemoryAlpha:AlphaTest]]
7269 !! html
7270 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7271 </p>
7272 !! end
7273
7274 # The previous test doesn't work correctly in html2*, due to not recognizing the
7275 # link as an internal one. This one checks for the correct behavior.
7276 !! test
7277 Link to namespace preferred over interwiki with correct rel attribute
7278 !! options
7279 parsoid=html2wt,html2html
7280 !! html/parsoid
7281 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7282 !! wikitext
7283 [[MemoryAlpha:AlphaTest]]
7284 !! end
7285
7286 !! test
7287 Piped link to namespace
7288 !! wikitext
7289 [[Meta:Disclaimers|The disclaimers]]
7290 !! html
7291 <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>
7292 </p>
7293 !! end
7294
7295 !! test
7296 Link containing }
7297 !! wikitext
7298 [[Usually caused by a typo (oops}]]
7299 !! html
7300 <p>[[Usually caused by a typo (oops}]]
7301 </p>
7302 !! end
7303
7304 !! article
7305 7% Solution
7306 !! text
7307 Just a test of an article title containing a percent.
7308 !! endarticle
7309
7310 !! test
7311 Link containing % (not as a hex sequence)
7312 !! wikitext
7313 [[7% Solution]]
7314 !! html/php
7315 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7316 </p>
7317 !! html/parsoid
7318 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7319 !! end
7320
7321 # note that the parsoid HTML is identical to the previous test output,
7322 # so the previous test ensures that the html2wt mode will generate the
7323 # "not as a hex sequence" wikitext.
7324 !! test
7325 Link containing % as a single hex sequence interpreted to char
7326 !! options
7327 parsoid=wt2wt,wt2html,html2html
7328 !! wikitext
7329 [[7%25 Solution]]
7330 !! html/php
7331 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7332 </p>
7333 !! html/parsoid
7334 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7335 !!end
7336
7337 !! test
7338 Link containing % as a double hex sequence interpreted to hex sequence
7339 !! wikitext
7340 [[7%2525 Solution]]
7341 !! html
7342 <p>[[7%2525 Solution]]
7343 </p>
7344 !!end
7345
7346 # note that parsoid does not munge anchor text; all non-space
7347 # characters are valid in HTML5 anchors.
7348 !! test
7349 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7350 Example for such a section: == < ==
7351 !! wikitext
7352 [[%23%3c]][[%23%3e]]
7353 !! html/php
7354 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7355 </p>
7356 !! html/parsoid
7357 <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>
7358 !! end
7359
7360 !! test
7361 Link containing "<#" and ">#" as a hex sequences
7362 !! wikitext
7363 [[%3c%23]][[%3e%23]]
7364 !! html
7365 <p>[[%3c%23]][[%3e%23]]
7366 </p>
7367 !! end
7368
7369 !! test
7370 Link containing an equals sign
7371 !! wikitext
7372 [[Special:BookSources/isbn=4-00-026157-6]]
7373 !! html/php
7374 <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>
7375 </p>
7376 !! html/parsoid
7377 <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>
7378 !! end
7379
7380 !! article
7381 Foo~bar
7382 !! text
7383 Just a test of an article title containing a tilde.
7384 !! endarticle
7385
7386 # note that links containing signatures, like [[Foo~~~~]], are
7387 # massaged by the pre-save transform (PST) and so the tildes are never
7388 # seen by the parser.
7389 !! test
7390 Link containing a tilde
7391 !! wikitext
7392 [[Foo~bar]]
7393 !! html/php
7394 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7395 </p>
7396 !! html/parsoid
7397 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7398 !! end
7399
7400 !! test
7401 Link containing double-single-quotes '' (bug 4598)
7402 !! wikitext
7403 [[Lista d''e paise d''o munno]]
7404 !! html/php
7405 <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>
7406 </p>
7407 !! html/parsoid
7408 <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>
7409 !! end
7410
7411 !! test
7412 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7413 !! wikitext
7414 Some [[Link|pretty ''italics'' and stuff]]!
7415 !! html/php
7416 <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>!
7417 </p>
7418 !! html/parsoid
7419 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7420 !! end
7421
7422 !! test
7423 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7424 !! wikitext
7425 ''Some [[Link|pretty ''italics'' and stuff]]!''
7426 !! html
7427 <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>
7428 </p>
7429 !! end
7430
7431 !! test
7432 Link with double quotes in title part (literal) and alternate part (interpreted)
7433 !! wikitext
7434 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7435
7436 [[''Pentecoste'']]
7437
7438 [[''Pentecoste''|Pentecoste]]
7439
7440 [[''Pentecoste''|''Pentecoste'']]
7441 !! html/php
7442 <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>
7443 </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>
7444 </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>
7445 </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>
7446 </p>
7447 !! html/parsoid
7448 <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>
7449 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7450 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7451 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7452 !! end
7453
7454 !! test
7455 Broken image links with HTML captions (bug 39700)
7456 !! wikitext
7457 [[File:Nonexistent|<script></script>]]
7458 [[File:Nonexistent|100x100px|<script></script>]]
7459 [[File:Nonexistent|&lt;]]
7460 [[File:Nonexistent|a<i>b</i>c]]
7461 !! html/php
7462 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7463 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7464 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7465 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7466 </p>
7467 !! html/parsoid
7468 <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>
7469 <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>
7470 <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>
7471 <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>
7472 !! end
7473
7474 !! test
7475 Plain link to URL
7476 !! wikitext
7477 [[http://www.example.com]]
7478 !! html/php
7479 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7480 </p>
7481 !! html/parsoid
7482 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7483 !! end
7484
7485 !! test
7486 Plain link to URL with link text
7487 !! wikitext
7488 [[http://www.example.com Link text]]
7489 !! html
7490 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7491 </p>
7492 !! end
7493
7494 !! test
7495 Plain link to protocol-relative URL
7496 !! wikitext
7497 [[//www.example.com]]
7498 !! html/php
7499 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7500 </p>
7501 !! html/parsoid
7502 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7503 !! end
7504
7505 !! test
7506 Plain link to protocol-relative URL with link text
7507 !! wikitext
7508 [[//www.example.com Link text]]
7509 !! html
7510 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7511 </p>
7512 !! end
7513
7514 !! test
7515 Plain link to page with question mark in title
7516 !! wikitext
7517 [[A?b]]
7518
7519 [[A?b|Baz]]
7520 !! html
7521 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7522 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7523 </p>
7524 !! end
7525
7526
7527 # I'm fairly sure the expected result here is wrong.
7528 # We want these to be URL links, not pseudo-pages with URLs for titles....
7529 # However the current output is also pretty screwy.
7530 #
7531 # ----
7532 # I'm changing it to match the current output--it arguably makes more
7533 # sense in the light of the test above. Old expected result was:
7534 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7535 #</p>
7536 # But I think this test is bordering on "garbage in, garbage out" anyway.
7537 # -- wtm
7538 !! test
7539 Piped link to URL
7540 !! wikitext
7541 Piped link to URL: [[http://www.example.com|an example URL]]
7542 !! html/php
7543 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7544 </p>
7545 !! html/parsoid
7546 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7547 !! end
7548
7549 !! test
7550 BUG 2: [[page|http://url/]] should link to page, not http://url/
7551 !! wikitext
7552 [[Main Page|http://url/]]
7553 !! html/php
7554 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7555 </p>
7556 !! html/parsoid
7557 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7558 !! end
7559
7560 # Parsoid does not mark self-links, by design.
7561 !! test
7562 BUG 337: Escaped self-links should be bold
7563 !! options
7564 title=[[Bug462]]
7565 !! wikitext
7566 [[Bu&#103;462]] [[Bug462]]
7567 !! html/php
7568 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7569 </p>
7570 !! html/php+tidy
7571 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7572 !! html/parsoid
7573 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7574 !! end
7575
7576 !! test
7577 Self-link to section should not be bold
7578 !! options
7579 title=[[Main Page]]
7580 !! wikitext
7581 [[Main Page#section]]
7582 !! html
7583 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7584 </p>
7585 !! end
7586
7587 !! article
7588 00
7589 !! text
7590 This is 00.
7591 !! endarticle
7592
7593 !!test
7594 Self-link to numeric title
7595 !!options
7596 title=[[0]]
7597 !! wikitext
7598 [[0]]
7599 !! html
7600 <p><strong class="selflink">0</strong>
7601 </p>
7602 !!end
7603
7604 !!test
7605 Link to numeric-equivalent title
7606 !!options
7607 title=[[0]]
7608 !! wikitext
7609 [[00]]
7610 !! html
7611 <p><a href="/wiki/00" title="00">00</a>
7612 </p>
7613 !!end
7614
7615 !! test
7616 <nowiki> inside a link
7617 !! wikitext
7618 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7619 !! html
7620 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7621 </p>
7622 !! end
7623
7624 !! test
7625 Non-breaking spaces in title
7626 !! wikitext
7627 [[&nbsp; Main &nbsp; Page &nbsp;]]
7628 !! html
7629 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7630 </p>
7631 !!end
7632
7633 !! test
7634 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7635 !! options
7636 language=ca
7637 !! wikitext
7638 '''[[Main Page]]'''
7639 !! html
7640 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7641 </p>
7642 !! end
7643
7644 !! test
7645 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7646 !! options
7647 language=ca
7648 !! wikitext
7649 ''[[Main Page]]''
7650 !! html
7651 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7652 </p>
7653 !! end
7654
7655 !! test
7656 Internal link with en linktrail: no apostrophes (bug 27473)
7657 !! options
7658 language=en
7659 !! wikitext
7660 [[Something]]'nice
7661 !! html
7662 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
7663 </p>
7664 !! end
7665
7666 !! test
7667 Internal link with ca linktrail with apostrophes (bug 27473)
7668 !! options
7669 language=ca
7670 !! wikitext
7671 [[Something]]'nice
7672 !! html
7673 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
7674 </p>
7675 !! end
7676
7677 !! test
7678 Internal link with kaa linktrail with apostrophes (bug 27473)
7679 !! options
7680 language=kaa
7681 !! wikitext
7682 [[Something]]'nice
7683 !! html
7684 <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>
7685 </p>
7686 !! end
7687
7688 !! test
7689 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
7690 !! wikitext
7691 [[User:Foo/Test/63636:Bar|Test]]
7692 !! html/php
7693 <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>
7694 </p>
7695 !! html/parsoid
7696 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
7697 !! end
7698
7699 !! test
7700 Purely hash wikilink
7701 !! options
7702 title=[[User:test/123]]
7703 !! wikitext
7704 [[#a|b]]
7705 !! html/php
7706 <p><a href="#a">b</a>
7707 </p>
7708 !! html/parsoid
7709 <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>
7710 !! end
7711
7712 !! test
7713 1. Interaction of linktrail and template encapsulation
7714 !! options
7715 parsoid
7716 !! wikitext
7717 {{echo|[[Foo]]}}l
7718 !! html
7719 <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>
7720 !! end
7721
7722 !! test
7723 2. Interaction of linktrail and template encapsulation
7724 !! options
7725 parsoid
7726 !! wikitext
7727 {{echo|Some [[Fool]]}}s
7728 !! html
7729 <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>
7730 !! end
7731
7732 !! test
7733 3. Interaction of linktrail and template encapsulation
7734 !! options
7735 parsoid
7736 !! wikitext
7737 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
7738 !! html
7739 <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>
7740 !! end
7741
7742 !! article
7743 Söfnuður
7744 !! text
7745 Test.
7746 !! endarticle
7747
7748 !! test
7749 Internal link with is link prefix
7750 !! options
7751 language=is
7752 !! wikitext
7753 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
7754 !! html
7755 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
7756 </p>
7757 !! end
7758
7759 !! article
7760 Mótmælendatrú
7761 !! text
7762 Test.
7763 !! endarticle
7764
7765 !! test
7766 Internal link with is link trail and link prefix
7767 !! options
7768 language=is
7769 !! wikitext
7770 [[mótmælendatrú|xxx]]ar
7771 [[mótmælendatrú]]ar
7772 mótmælenda[[söfnuður]]
7773 mótmælenda[[söfnuður|söfnuðir]]
7774 mótmælenda[[söfnuður|söfnuðir]]xxx
7775 !! html
7776 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
7777 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
7778 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
7779 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
7780 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
7781 </p>
7782 !! end
7783
7784 !! test
7785 Parsoid link trail escaping
7786 !! options
7787 parsoid=html2wt,html2html
7788 !! html/parsoid
7789 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
7790 !! wikitext
7791 [[apple]]<nowiki/>s
7792 !! end
7793
7794 !! test
7795 Parsoid link prefix escaping
7796 !! options
7797 language=is
7798 parsoid=html2wt,html2html
7799 !! html/parsoid
7800 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
7801 !! wikitext
7802 Aðrir mótmælenda<nowiki/>[[söfnuður]]
7803 !! end
7804
7805 !! test
7806 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
7807 !! wikitext
7808 [[Foo| bar]]
7809
7810 [[Foo| ''bar'']]
7811
7812 [http://wp.org foo]
7813
7814 [http://wp.org ''foo'']
7815 !! html
7816 <p><a href="/wiki/Foo" title="Foo"> bar</a>
7817 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
7818 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
7819 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
7820 </p>
7821 !! end
7822
7823 !! test
7824 Parsoid: Scoped parsing should handle mixed transclusions and plain text
7825 !! options
7826 parsoid
7827 !! wikitext
7828 [[Foo|{{echo|a}} b {{echo|c}}]]
7829 !! html
7830 <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>
7831 !! end
7832
7833 !! test
7834 Link with angle bracket after anchor
7835 !! wikitext
7836 [[Foo#<bar>]]
7837 !! html/php
7838 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
7839 </p>
7840 !! html/parsoid
7841 <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>
7842 !! end
7843
7844 ###
7845 ### Interwiki links (see maintenance/interwiki.sql)
7846 ###
7847
7848 !! test
7849 Inline interwiki link
7850 !! options
7851 parsoid=wt2html,wt2wt,html2html
7852 !! wikitext
7853 [[MeatBall:SoftSecurity]]
7854 !! html/php
7855 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
7856 </p>
7857 !! html/parsoid
7858 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
7859 !! end
7860
7861 !! test
7862 Inline interwiki link with empty title (bug 2372)
7863 !! options
7864 parsoid=wt2html,wt2wt,html2html
7865 !! wikitext
7866 [[MeatBall:]]
7867 !! html/php
7868 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
7869 </p>
7870 !! html/parsoid
7871 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
7872 !! end
7873
7874 !! test
7875 Interwiki link encoding conversion (bug 1636)
7876 !! wikitext
7877 *[[Wikipedia:ro:Olteni&#0355;a]]
7878 *[[Wikipedia:ro:Olteni&#355;a]]
7879 !! html
7880 <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>
7881 <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>
7882
7883 !! html+tidy
7884 <ul>
7885 <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>
7886 <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>
7887 </ul>
7888 !! end
7889
7890 !! test
7891 Interwiki link with fragment (bug 2130)
7892 !! wikitext
7893 [[MeatBall:SoftSecurity#foo]]
7894 !! html
7895 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
7896 </p>
7897 !! end
7898
7899 # Ideally the wikipedia: prefix here should be proto-relative too
7900 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
7901 # define the 'en' prefix, and originally the test used 'wikipedia',
7902 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
7903 # article.
7904 !! test
7905 Different interwiki prefixes mapping to the same URL
7906 !! wikitext
7907 [[:en:Foo]]
7908
7909 [[:en:Foo|Foo]]
7910
7911 [[wikipedia:Foo]]
7912
7913 [[:wikipedia:Foo|Foo]]
7914
7915 [[wikipedia:en:Foo]]
7916
7917 [[:wikipedia:en:Foo]]
7918
7919 [[ wikiPEdia :Foo]]
7920 !! html/parsoid
7921 <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>
7922
7923 <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>
7924
7925 <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>
7926
7927 <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>
7928
7929 <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>
7930
7931 <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>
7932
7933 <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>
7934 !! end
7935
7936 !! test
7937 Interwiki links that cannot be represented in wiki syntax
7938 !! wikitext
7939 [[meatball:ok]]
7940 [[meatball:ok#foo|ok with fragment]]
7941 [[meatball:ok_as_well?|ok ending with ? mark]]
7942 [http://de.wikipedia.org/wiki/Foo?action=history has query]
7943 [http://de.wikipedia.org/wiki/#foo is just fragment]
7944
7945 !! html/php
7946 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
7947 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
7948 <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>
7949 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7950 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
7951 </p>
7952 !! html/parsoid
7953 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
7954 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
7955 <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>
7956 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7957 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
7958 !! end
7959
7960 !! test
7961 Interwiki links: trail
7962 !! wikitext
7963 [[wikipedia:Foo|Ba]]r
7964 !! html/php
7965 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
7966 </p>
7967 !! html/parsoid
7968 <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>
7969 !! end
7970
7971 !! test
7972 Local interwiki link
7973 !! options
7974 parsoid=wt2html,wt2wt,html2html
7975 !! wikitext
7976 [[local:Template:Foo]]
7977 !! html/php
7978 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
7979 </p>
7980 !! html/parsoid
7981 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
7982 !! end
7983
7984 # Parsoid does not mark self-links, by design.
7985 !! test
7986 Local interwiki link: self-link to current page
7987 !! options
7988 title=[[Main Page]]
7989 parsoid=wt2html,wt2wt,html2html
7990 !! wikitext
7991 [[local:Main Page]]
7992 !! html/php
7993 <p><strong class="selflink">local:Main Page</strong>
7994 </p>
7995 !! html/parsoid
7996 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
7997 !! end
7998
7999 !! test
8000 Local interwiki link: prefix only (bug 64167)
8001 !! options
8002 parsoid=wt2html,wt2wt,html2html
8003 !! wikitext
8004 [[local:]]
8005 !! html/php
8006 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8007 </p>
8008 !! html/parsoid
8009 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8010 !! end
8011
8012 !! test
8013 Local interwiki link: with additional interwiki prefix (bug 61357)
8014 !! options
8015 parsoid=wt2html,wt2wt,html2html
8016 !! wikitext
8017 [[local:meatball:Hello]]
8018 !! html/php
8019 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8020 </p>
8021 !! html/parsoid
8022 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8023 !! end
8024
8025 !! test
8026 Multiple local interwiki link prefixes
8027 !! wikitext
8028 [[local:local:local:local:mi:local:Foo]]
8029 !! options
8030 parsoid=wt2html,wt2wt,html2html
8031 !! html/php
8032 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8033 </p>
8034 !! html/parsoid
8035 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8036 !! end
8037
8038 ###
8039 ### Interlanguage links
8040 ### Language links (so that searching for '### language' matches..)
8041 ###
8042
8043 !! test
8044 Interlanguage link
8045 !! options
8046 parsoid=wt2html,wt2wt,html2html
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 Interlanguage link with spacing
8060 !! options
8061 parsoid=wt2html,wt2wt,html2html
8062 !! wikitext
8063 Blah blah blah
8064 [[ zh : Chinese ]]
8065 !! html/php
8066 <p>Blah blah blah
8067 </p>
8068 !! html/parsoid
8069 <p>Blah blah blah</p>
8070 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8071 !! end
8072
8073 !! test
8074 Double interlanguage link
8075 !! options
8076 parsoid=wt2html,wt2wt,html2html
8077 !! wikitext
8078 Blah blah blah
8079 [[es:Spanish]]
8080 [[zh:Chinese]]
8081 !! html/php
8082 <p>Blah blah blah
8083 </p>
8084 !! html/parsoid
8085 <p>Blah blah blah</p>
8086 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8087 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8088 !! end
8089
8090 !! test
8091 Interlanguage link variations
8092 !! options
8093 parsoid=wt2html,wt2wt,html2html
8094 !! wikitext
8095 Blah blah blah
8096 [[ es :Spanish]]
8097 [[ ZH :Chinese]]
8098 [[es:Foo_bar]]
8099 !! html/php
8100 <p>Blah blah blah
8101 </p>
8102 !! html/parsoid
8103 <p>Blah blah blah</p>
8104 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8105 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8106 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8107 !! end
8108
8109 !! test
8110 Space and question mark encoding in interlanguage links (T95473)
8111 !! options
8112 parsoid=wt2html,wt2wt,html2html
8113 !! wikitext
8114 Blah blah blah
8115 [[es:Foo bar?]]
8116 !! html/php
8117 <p>Blah blah blah
8118 </p>
8119 !! html/parsoid
8120 <p>Blah blah blah</p>
8121 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8122 !! end
8123
8124 !! test
8125 Interlanguage link, with prefix links
8126 !! options
8127 language=ln
8128 !! wikitext
8129 Blah blah blah
8130 [[zh:Chinese]]
8131 !! html/php
8132 <p>Blah blah blah
8133 </p>
8134 !! html/parsoid
8135 <p>Blah blah blah</p>
8136 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8137 !! end
8138
8139 !! test
8140 Double interlanguage link, with prefix links (bug 8897)
8141 !! options
8142 language=ln
8143 !! wikitext
8144 Blah blah blah
8145 [[es:Spanish]]
8146 [[zh:Chinese]]
8147 !! html/php
8148 <p>Blah blah blah
8149 </p>
8150 !! html/parsoid
8151 <p>Blah blah blah</p>
8152 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8153 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8154 !! end
8155
8156 !! test
8157 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8158 !! wikitext
8159 Blah blah blah
8160 [[mul:Article]]
8161 !! html/php
8162 <p>Blah blah blah
8163 </p>
8164 !! html/parsoid
8165 <p>Blah blah blah</p>
8166 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8167 !! end
8168
8169 !! test
8170 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8171 !! options
8172 language=ln
8173 !! wikitext
8174 [[WW&nbsp;II]]
8175 !! html
8176 <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>
8177 </p>
8178 !! end
8179
8180 !! test
8181 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8182 !! options
8183 parsoid=html2wt
8184 !! html/parsoid
8185 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8186 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8187 !! wikitext
8188 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8189
8190 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
8191 !! end
8192
8193 !! test
8194 Parsoid: handle constructor well
8195 !! wikitext
8196 [[constructor]]
8197
8198 [[constructor:foo]]
8199 !! html/php
8200 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8201 </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>
8202 </p>
8203 !! html/parsoid
8204 <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>
8205
8206 <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>
8207 !! end
8208
8209 !! article
8210 ko:
8211 !! text
8212 Test.
8213 !! endarticle
8214
8215 # Note that `ko` isn't a known interlanguage prefix
8216 !! test
8217 Parsoid: recognize interlanguage links without a target page
8218 !! options
8219 ill
8220 !! wikitext
8221 [[es:]]
8222
8223 [[ko:]]
8224 !! html/php
8225 es:
8226 !! html/parsoid
8227 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8228
8229 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8230 !! end
8231
8232 # Note that `ko` isn't a known interwiki prefix
8233 !! test
8234 Parsoid: recognize interwiki links without a target page
8235 !! options
8236 parsoid=wt2html,wt2wt,html2html
8237 !! wikitext
8238 [[:es:]]
8239
8240 [[:ko:]]
8241 !! html/php
8242 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8243 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8244 </p>
8245 !! html/parsoid
8246 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8247 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8248 !! end
8249
8250 !! test
8251 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8252 !! wikitext
8253 [[mi:Foo]]
8254 !! html/php
8255 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8256 </p>
8257 !! html/parsoid
8258 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8259 !! end
8260
8261 !! test
8262 Interlanguage link with preceding local interwiki link (bug 68085)
8263 !! options
8264 parsoid=wt2html,wt2wt,html2html
8265 !! wikitext
8266 Blah blah blah
8267 [[local:es:Spanish]]
8268 !! html/php
8269 <p>Blah blah blah
8270 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8271 </p>
8272 !! html/parsoid
8273 <p>Blah blah blah
8274 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8275 !! end
8276
8277 !! test
8278 Looks like an interlanguage link, but is actually a local interwiki
8279 !! options
8280 parsoid=wt2html,wt2wt,html2html
8281 !! wikitext
8282 Blah blah blah
8283 [[mi:Template:Foo]]
8284 !! html/php
8285 <p>Blah blah blah
8286 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8287 </p>
8288 !! html/parsoid
8289 <p>Blah blah blah
8290 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8291 !! end
8292
8293 ###
8294 ### Redirects, Parsoid-only
8295 ###
8296
8297 !! test
8298 1. Simple redirect to page
8299 !! wikitext
8300 #REDIRECT [[Main Page]]
8301 !! html/parsoid
8302 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8303 !! end
8304
8305 !! test
8306 2. Other redirect variants
8307 !! wikitext
8308 #REDIRECT [[Main_Page]]
8309 !! html/parsoid
8310 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8311 !! end
8312
8313 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8314 # This tests the Parsoid bail-out code.
8315 !! test
8316 3. Other redirect variants
8317 !! wikitext
8318 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8319 !! html/parsoid
8320 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8321 !! end
8322
8323 !! test
8324 4. Redirect to a templated destination
8325 !! wikitext
8326 #REDIRECT [[{{echo|Foo}}bar]]
8327 !! html/parsoid
8328 <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"}]]}'/>
8329 !! end
8330
8331 !! test
8332 Empty redirect
8333 !! options
8334 parsoid=wt2html,wt2wt
8335 !! wikitext
8336 #REDIRECT [[]]
8337 !! html/parsoid
8338 <ol>
8339 <li>REDIRECT [[]]</li></ol>
8340 !! end
8341
8342 !! test
8343 Optional colon in #REDIRECT
8344 !! options
8345 # the colon is archaic syntax. we support it for wt2html, but we
8346 # don't care that it roundtrips back to the modern syntax.
8347 parsoid=wt2html,html2html
8348 !! wikitext
8349 #REDIRECT:[[Main Page]]
8350 !! html/parsoid
8351 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8352 !! end
8353
8354 !! test
8355 Whitespace in #REDIRECT with optional colon
8356 !! options
8357 # the colon and gratuitous whitespace is archaic syntax. we support
8358 # it for wt2html, but we don't care that it roundtrips back to the
8359 # modern syntax (without extra whitespace)
8360 parsoid=wt2html,html2html
8361 !! wikitext
8362
8363 #REDIRECT
8364 :
8365 [[Main Page]]
8366 !! html/parsoid
8367 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8368 !! end
8369
8370 !! test
8371 Piped link in #REDIRECT
8372 !! options
8373 # content after piped link is ignored. we support this syntax,
8374 # but don't care that the piped link is lost when we roundtrip this.
8375 parsoid=wt2html
8376 !! wikitext
8377 #REDIRECT [[Main Page|bar]]
8378 !! html/parsoid
8379 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8380 !! end
8381
8382 !! test
8383 Redirect to category (T104502)
8384 !! options
8385 parsoid=wt2html,wt2wt
8386 !! wikitext
8387 #REDIRECT [[Category:Foo]]
8388 !! html/parsoid
8389 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8390 !! end
8391
8392 !! test
8393 Redirect to category with URL encoding (T104502)
8394 !! options
8395 parsoid=wt2html
8396 !! wikitext
8397 #REDIRECT [[Category%3AFoo]]
8398 !! html/parsoid
8399 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8400 !! end
8401
8402 !! test
8403 Redirect to category page
8404 !! wikitext
8405 #REDIRECT [[:Category:Foo]]
8406 !! html/parsoid
8407 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8408 !! end
8409
8410 !! test
8411 Redirect to image page (1)
8412 !! wikitext
8413 #REDIRECT [[File:Wiki.png]]
8414 !! html/parsoid
8415 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8416 !! end
8417
8418 !! test
8419 Redirect to image page (2)
8420 !! wikitext
8421 #REDIRECT [[Image:Wiki.png]]
8422 !! html/parsoid
8423 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8424 !! end
8425
8426 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8427 # Next test confirms this.
8428 !! test
8429 Redirect to language (1) (T104918)
8430 !! options
8431 parsoid=wt2html,wt2wt,html2html
8432 !! wikitext
8433 #REDIRECT [[en:File:Wiki.png]]
8434 !! html/parsoid
8435 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8436 !! end
8437
8438 !! test
8439 Redirect to language (2) (T104918)
8440 !! wikitext
8441 #REDIRECT [[:en:File:Wiki.png]]
8442 !! html/parsoid
8443 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8444 !! end
8445
8446 !! test
8447 Redirect to interwiki (T104918)
8448 !! wikitext
8449 #REDIRECT [[meatball:File:Wiki.png]]
8450 !! html/parsoid
8451 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8452 !! end
8453
8454 !! test
8455 Non-English #REDIRECT
8456 !! options
8457 language=is
8458 !! wikitext
8459 #TILVÍSUN [[Main Page]]
8460 !! html/parsoid
8461 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8462 !! end
8463
8464 !! test
8465 Redirect syntax under text isn't considered a redirect
8466 !! wikitext
8467 some text
8468 #redirect [[Main Page]]
8469 !! html/parsoid
8470 <p>some text</p>
8471 <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>
8472 !! end
8473
8474 # FIXME: Should hoist the redirect to the top of the page and ensure there
8475 # is only one.
8476 !! test
8477 New redirect
8478 !! options
8479 parsoid=html2wt
8480 !! html/parsoid
8481 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8482 !! wikitext
8483 Foo
8484 #REDIRECT [[Foo]]
8485 !! end
8486
8487 ##
8488 ## XHTML tidiness
8489 ###
8490
8491 !! test
8492 <br> to <br />
8493 !! wikitext
8494 1<br>2<br />3
8495 !! html
8496 <p>1<br />2<br />3
8497 </p>
8498 !! end
8499
8500 !! test
8501 Broken br tag sanitization
8502 !! wikitext
8503 </br>
8504 !! html/php
8505 <p>&lt;/br&gt;
8506 </p>
8507 !! end
8508
8509 # TODO: Fix html2html mode (bug 51055)!
8510 !! test
8511 Parsoid: Broken br tag recognition
8512 !! options
8513 parsoid=wt2html
8514 !! wikitext
8515 </br>
8516
8517 <br/ >
8518 !! html+tidy
8519 <p><br /></p>
8520 <p><br /></p>
8521 !! end
8522
8523 !! test
8524 Incorrecly removing closing slashes from correctly formed XHTML
8525 !! wikitext
8526 <br style="clear:both;" />
8527 !! html
8528 <p><br style="clear:both;" />
8529 </p>
8530 !! end
8531
8532 !! test
8533 Failing to transform badly formed HTML into correct XHTML
8534 !! wikitext
8535 <br style="clear: left;">
8536 <br style="clear: right;">
8537 <br style="clear: both;">
8538 !! html
8539 <p><br style="clear: left;" />
8540 <br style="clear: right;" />
8541 <br style="clear: both;" />
8542 </p>
8543 !!end
8544
8545 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8546 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8547 !! test
8548 Handling html with a div self-closing tag
8549 !! wikitext
8550 <div title />
8551 <div title/>
8552 <div title/ >
8553 <div title=bar />
8554 <div title=bar/>
8555 <div title=bar/ >
8556 !! html/php
8557 <p>&lt;div title /&gt;
8558 &lt;div title/&gt;
8559 </p>
8560 <div>
8561 <p>&lt;div title=bar /&gt;
8562 &lt;div title=bar/&gt;
8563 </p>
8564 <div title="bar/"></div>
8565 </div>
8566
8567 !! html/parsoid
8568 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8569 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8570 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
8571 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8572 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8573 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
8574 !! end
8575
8576 !! test
8577 Handling html with a br self-closing tag
8578 !! wikitext
8579 <br title />
8580 <br title/>
8581 <br title/ >
8582 <br title=bar />
8583 <br title=bar/>
8584 <br title=bar/ >
8585 !! html/php
8586 <p><br title="" />
8587 <br title="" />
8588 <br />
8589 <br title="bar" />
8590 <br title="bar" />
8591 <br title="bar/" />
8592 </p>
8593 !! html/parsoid
8594 <p><br title="" />
8595 <br title="" />
8596 <br title="" />
8597 <br title="bar" />
8598 <br title="bar" />
8599 <br title="bar/" />
8600 </p>
8601 !! end
8602
8603 !! test
8604 Horizontal ruler (should it add that extra space?)
8605 !! wikitext
8606 <hr>
8607 <hr >
8608 foo <hr
8609 > bar
8610 !! html+tidy
8611 <hr />
8612 <hr />
8613 <p>foo</p>
8614 <hr />
8615 <p>bar</p>
8616 !! end
8617
8618 !! test
8619 Horizontal ruler -- 4+ dashes render hr
8620 !! wikitext
8621 ----
8622 !! html
8623 <hr />
8624
8625 !! end
8626
8627 !! test
8628 Horizontal ruler -- eats additional dashes on the same line
8629 !! wikitext
8630 ---------
8631 !! html
8632 <hr />
8633
8634 !! end
8635
8636 !! test
8637 Horizontal ruler -- does not collapse dashes on consecutive lines
8638 !! wikitext
8639 ----
8640 ----
8641 !! html
8642 <hr />
8643 <hr />
8644
8645 !! end
8646
8647 !! test
8648 Horizontal ruler -- <4 dashes render as plain text
8649 !! wikitext
8650 ---
8651 !! html
8652 <p>---
8653 </p>
8654 !! end
8655
8656 !! test
8657 Horizontal ruler -- Supports content following dashes on same line
8658 !! wikitext
8659 ---- Foo
8660 !! html
8661 <hr /> Foo
8662
8663 !! html+tidy
8664 <hr />
8665 <p>Foo</p>
8666 !! end
8667
8668 ###
8669 ### Block-level elements
8670 ###
8671 !! test
8672 Common list
8673 !! wikitext
8674 *Common list
8675 * item 2
8676 *item 3
8677 !! html
8678 <ul><li>Common list</li>
8679 <li> item 2</li>
8680 <li>item 3</li></ul>
8681
8682 !! end
8683
8684 !! test
8685 Numbered list
8686 !! wikitext
8687 #Numbered list
8688 #item 2
8689 # item 3
8690 !! html
8691 <ol><li>Numbered list</li>
8692 <li>item 2</li>
8693 <li> item 3</li></ol>
8694
8695 !! end
8696
8697 !! test
8698 Mixed list
8699 !! wikitext
8700 *Mixed list
8701 *# with numbers
8702 ** and bullets
8703 *# and numbers
8704 *bullets again
8705 **bullet level 2
8706 ***bullet level 3
8707 ***#Number on level 4
8708 **bullet level 2
8709 **#Number on level 3
8710 **#Number on level 3
8711 *#number level 2
8712 *Level 1
8713 *** Level 3
8714 #** Level 3, but ordered
8715 !! html
8716 <ul><li>Mixed list
8717 <ol><li> with numbers</li></ol>
8718 <ul><li> and bullets</li></ul>
8719 <ol><li> and numbers</li></ol></li>
8720 <li>bullets again
8721 <ul><li>bullet level 2
8722 <ul><li>bullet level 3
8723 <ol><li>Number on level 4</li></ol></li></ul></li>
8724 <li>bullet level 2
8725 <ol><li>Number on level 3</li>
8726 <li>Number on level 3</li></ol></li></ul>
8727 <ol><li>number level 2</li></ol></li>
8728 <li>Level 1
8729 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
8730 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
8731
8732 !! end
8733
8734 !! test
8735 Nested lists 1
8736 !! wikitext
8737 *foo
8738 **bar
8739 !! html
8740 <ul><li>foo
8741 <ul><li>bar</li></ul></li></ul>
8742
8743 !! end
8744
8745 !! test
8746 Nested lists 2
8747 !! wikitext
8748 **foo
8749 *bar
8750 !! html
8751 <ul><li><ul><li>foo</li></ul></li>
8752 <li>bar</li></ul>
8753
8754 !! end
8755
8756 !! test
8757 Nested lists 3 (first element empty)
8758 !! wikitext
8759 *
8760 **bar
8761 !! html
8762 <ul><li>
8763 <ul><li>bar</li></ul></li></ul>
8764
8765 !! end
8766
8767 !! test
8768 Nested lists 4 (first element empty)
8769 !! wikitext
8770 **
8771 *bar
8772 !! html
8773 <ul><li><ul><li></li></ul></li>
8774 <li>bar</li></ul>
8775
8776 !! end
8777
8778 !! test
8779 Nested lists 5 (both elements empty)
8780 !! wikitext
8781 **
8782 *
8783 !! html
8784 <ul><li><ul><li></li></ul></li>
8785 <li></li></ul>
8786
8787 !! end
8788
8789 !! test
8790 Nested lists 6 (both elements empty)
8791 !! wikitext
8792 *
8793 **
8794 !! html
8795 <ul><li>
8796 <ul><li></li></ul></li></ul>
8797
8798 !! end
8799
8800 !! test
8801 Nested lists 7 (skip initial nesting levels)
8802 !! wikitext
8803 *** foo
8804 !! html
8805 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
8806
8807 !! end
8808
8809 !! test
8810 Nested lists 8 (multiple nesting transitions)
8811 !! wikitext
8812 * foo
8813 *** bar
8814 ** baz
8815 * boo
8816 !! html
8817 <ul><li> foo
8818 <ul><li><ul><li> bar</li></ul></li>
8819 <li> baz</li></ul></li>
8820 <li> boo</li></ul>
8821
8822 !! end
8823
8824 !! test
8825 Nested lists 9 (extension interaction)
8826 !! options
8827 parsoid
8828 !! wikitext
8829 *<references />
8830 !! html/parsoid
8831 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
8832 !! end
8833
8834 !! test
8835 1. Lists with start-of-line-transparent tokens before bullets: Comments
8836 !! wikitext
8837 *foo
8838 *<!--cmt-->bar
8839 <!--cmt-->*baz
8840 !! html
8841 <ul><li>foo</li>
8842 <li>bar</li>
8843 <li>baz</li></ul>
8844
8845 !! end
8846
8847 !! test
8848 2. Lists with start-of-line-transparent tokens before bullets: Template close
8849 !! wikitext
8850 *foo {{echo|bar
8851 }}*baz
8852 !! html
8853 <ul><li>foo bar</li>
8854 <li>baz</li></ul>
8855
8856 !! end
8857
8858 !! test
8859 List items are not parsed correctly following a <pre> block (bug 785)
8860 !! wikitext
8861 * <pre>foo</pre>
8862 * <pre>bar</pre>
8863 * zar
8864 !! html/php
8865 <ul><li> <pre>foo</pre></li>
8866 <li> <pre>bar</pre></li>
8867 <li> zar</li></ul>
8868
8869 !! html/parsoid
8870 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
8871 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
8872 <li> zar</li></ul>
8873 !! end
8874
8875 !! test
8876 List items from template
8877 !! wikitext
8878
8879 {{inner list}}
8880 * item 2
8881
8882 * item 0
8883 {{inner list}}
8884 * item 2
8885
8886 * item 0
8887 * notSOL{{inner list}}
8888 * item 2
8889 !! html
8890 <ul><li> item 1</li>
8891 <li> item 2</li></ul>
8892 <ul><li> item 0</li>
8893 <li> item 1</li>
8894 <li> item 2</li></ul>
8895 <ul><li> item 0</li>
8896 <li> notSOL</li>
8897 <li> item 1</li>
8898 <li> item 2</li></ul>
8899
8900 !! end
8901
8902 !! test
8903 List interrupted by empty line or heading
8904 !! wikitext
8905 * foo
8906
8907 ** bar
8908 == A heading ==
8909 * Another list item
8910 !! html
8911 <ul><li> foo</li></ul>
8912 <ul><li><ul><li> bar</li></ul></li></ul>
8913 <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>
8914 <ul><li> Another list item</li></ul>
8915
8916 !!end
8917
8918 !!test
8919 Multiple list tags generated by templates
8920 !! wikitext
8921 {{echo|<li>}}a
8922 {{echo|<li>}}b
8923 {{echo|<li>}}c
8924 !! html
8925 <li>a
8926 <li>b
8927 <li>c</li>
8928 </li>
8929 </li>
8930
8931 !! html+tidy
8932 <ul>
8933 <li>a</li>
8934 <li>b</li>
8935 <li>c</li>
8936 </ul>
8937 !!end
8938
8939 !!test
8940 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
8941 !! wikitext
8942 *a
8943 <!--This line will NOT split the list-->
8944 *b
8945 <!--This line will NOT split the list either-->
8946 *c
8947 <!--foo--> <!----> <!--This line NOT split the list either-->
8948 *d
8949 !! html
8950 <ul><li>a</li>
8951 <li>b</li>
8952 <li>c</li>
8953 <li>d</li></ul>
8954
8955 !!end
8956
8957 !!test
8958 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
8959 !! wikitext
8960 *a
8961 <!--This line will NOT split the list-->
8962 *b
8963 <!--This line will NOT split the list either-->
8964 *c
8965 <!--foo--> <!----> <!--This line NOT split the list
8966 either-->
8967 *d
8968 !! html
8969 <ul><li>a</li>
8970 <li>b</li>
8971 <li>c</li>
8972 <li>d</li></ul>
8973
8974 !!end
8975
8976 !!test
8977 Test the li-hack
8978 (The PHP parser relies on Tidy for the hack)
8979 !!options
8980 parsoid=wt2html,wt2wt
8981 !! wikitext
8982 * foo
8983 * <li>li-hack
8984 * {{echo|<li>templated li-hack}}
8985 * <!--foo--> <li> unsupported li-hack with preceding comments
8986
8987 <ul>
8988 <li><li>not a li-hack
8989 </li>
8990 </ul>
8991 !! html+tidy
8992 <ul>
8993 <li>foo</li>
8994 <li>li-hack</li>
8995 <li>templated li-hack</li>
8996 <li>unsupported li-hack with preceding comments</li>
8997 </ul>
8998 <ul>
8999 <li>not a li-hack</li>
9000 </ul>
9001 !!end
9002
9003 !! test
9004 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9005 !! options
9006 parsoid
9007 !! wikitext
9008 # foo
9009 ## bar
9010 * foo
9011 ** bar
9012 : foo
9013 :: bar
9014 !! html
9015 <ol>
9016 <li> foo<ol>
9017 <li> bar</li>
9018 </ol></li>
9019 </ol><ul>
9020 <li> foo<ul>
9021 <li> bar</li>
9022 </ul></li>
9023 </ul><dl>
9024 <dd> foo<dl>
9025 <dd> bar</dd>
9026 </dl></dd>
9027 </dl>
9028 !! end
9029
9030 !! test
9031 Parsoid: Test of whitespace serialization with Templated bullets
9032 !! options
9033 parsoid
9034 !! wikitext
9035 * {{bullet}}
9036 !! html
9037 <ul>
9038 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9039 </ul>
9040 !! end
9041
9042 # ------------------------------------------------------------------------
9043 # The next set of tests are about Parsoid's ability to handle badly nested
9044 # tags (parse, minimize scope of fixup, and roundtrip back)
9045 # ------------------------------------------------------------------------
9046
9047 !! test
9048 Unbalanced closing block tags break a list
9049 (php parser relies on Tidy to fix up)
9050 !! wikitext
9051 <div>
9052 *a</div><div>
9053 *b</div>
9054 !! html+tidy
9055 <div>
9056 <ul>
9057 <li>a</li>
9058 </ul>
9059 </div>
9060 <div>
9061 <ul>
9062 <li>b</li>
9063 </ul>
9064 </div>
9065 !! end
9066
9067 # Parsoid fails this test, but it might be tricky to support properly.
9068 # See bug 68395.
9069 !! test
9070 Unbalanced closing non-block tags don't break a list
9071 (php parser relies on Tidy to fix up)
9072 !! wikitext
9073 <span>
9074 *a</span><span>
9075 *b</span>
9076 !! html/php+tidy
9077 <ul>
9078 <li><span>a</span></li>
9079 <li><span>b</span></li>
9080 </ul>
9081 !! html/parsoid
9082 <span>
9083 <ul>
9084 <li>a<span></span>
9085 </li>
9086 <li>b
9087 </li>
9088 </ul>
9089 </span>
9090 !! end
9091
9092 !! test
9093 Unclosed formatting tags that straddle lists are closed and reopened
9094 (php parser relies on Tidy to fix up)
9095 !! options
9096 parsoid=wt2html,wt2wt,html2html
9097 !! wikitext
9098 # <s> a
9099 # b </s>
9100 !! html/php+tidy
9101 <ol>
9102 <li><s>a</s></li>
9103 <li><s>b</s></li>
9104 </ol>
9105 !! html/parsoid
9106 <ol><li> <s> a</s></li>
9107 <li><s> b </s></li></ol>
9108 !! end
9109
9110 # See bug 68395.
9111 !!test
9112 1. List embedded in a formatting tag
9113 !! wikitext
9114 <small>
9115 * foo
9116 </small>
9117 !! html/php+tidy
9118 <ul>
9119 <li><small>foo</small></li>
9120 </ul>
9121 !! html/parsoid
9122 <small>
9123 <ul>
9124 <li> foo</li>
9125 </ul>
9126 </small>
9127 !!end
9128
9129 ## Ugly Parsoid output here
9130 ## Not sure what the right output is.
9131 !!test
9132 2. List embedded in a formatting tag
9133 !! wikitext
9134 <small>
9135 *a
9136 *b</small>
9137 !! html/php+tidy
9138 <ul>
9139 <li><small>a</small></li>
9140 <li><small>b</small></li>
9141 </ul>
9142 !! html/parsoid
9143 <small></small>
9144 <ul><small>
9145 <li>a</li>
9146 </small>
9147 <li><small>b</small></li>
9148 </ul>
9149 !!end
9150
9151 # Ugly Parsoid and PHP parser output here
9152 # Not sure if we want to make this a test!
9153 #
9154 ## !!test
9155 ## 3. Unclosed formatting tags in list elements
9156 ## !! wikitext
9157 ## *<small>a
9158 ## *<small>b
9159 ## !! html/php+tidy
9160 ## <ul>
9161 ## <li><small>a</small></li>
9162 ## <li><small><small>b</small></small></li>
9163 ## </ul>
9164 ## !! html/parsoid
9165 ## <ul>
9166 ## <li><small>a</small></li>
9167 ## <small>
9168 ## <li><small>b</small></li>
9169 ## </small></ul>
9170 ## !!end
9171
9172 # This is a bug in the PHP parser + tidy combination.
9173 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9174 # and then fostered out of the table by tidy.)
9175 # We believe the Parsoid output to be correct.
9176 !! test
9177 Table with missing opening <tr> tag
9178 !! options
9179 parsoid=wt2html,wt2wt
9180 !! wikitext
9181 <table>
9182 <td>foo</td>
9183 </tr>
9184 </table>
9185 !! html+tidy
9186 <table>
9187 <tr>
9188 <td>foo</td>
9189 </tr>
9190 </table>
9191 !! end
9192
9193 ###
9194 ### Magic Words
9195 ###
9196
9197 # Note that the current date is hard-coded as
9198 # 1970-01-01T00:02:03Z (a Thursday)
9199 # when running parser tests. The timezone is also fixed to GMT, so
9200 # local date will be identical to current date.
9201
9202 !! test
9203 Magic Word: {{CURRENTDAY}}
9204 !! wikitext
9205 {{CURRENTDAY}}
9206 !! html
9207 <p>1
9208 </p>
9209 !! end
9210
9211 !! test
9212 Magic Word: {{CURRENTDAY2}}
9213 !! wikitext
9214 {{CURRENTDAY2}}
9215 !! html
9216 <p>01
9217 </p>
9218 !! end
9219
9220 !! test
9221 Magic Word: {{CURRENTDAYNAME}}
9222 !! wikitext
9223 {{CURRENTDAYNAME}}
9224 !! html
9225 <p>Thursday
9226 </p>
9227 !! end
9228
9229 !! test
9230 Magic Word: {{CURRENTDOW}}
9231 !! wikitext
9232 {{CURRENTDOW}}
9233 !! html
9234 <p>4
9235 </p>
9236 !! end
9237
9238 !! test
9239 Magic Word: {{CURRENTMONTH}}
9240 !! wikitext
9241 {{CURRENTMONTH}}
9242 !! html
9243 <p>01
9244 </p>
9245 !! end
9246
9247 !! test
9248 Magic Word: {{CURRENTMONTH1}}
9249 !! wikitext
9250 {{CURRENTMONTH1}}
9251 !! html
9252 <p>1
9253 </p>
9254 !! end
9255
9256 !! test
9257 Magic Word: {{CURRENTMONTHABBREV}}
9258 !! wikitext
9259 {{CURRENTMONTHABBREV}}
9260 !! html
9261 <p>Jan
9262 </p>
9263 !! end
9264
9265 !! test
9266 Magic Word: {{CURRENTMONTHNAME}}
9267 !! wikitext
9268 {{CURRENTMONTHNAME}}
9269 !! html
9270 <p>January
9271 </p>
9272 !! end
9273
9274 !! test
9275 Magic Word: {{CURRENTMONTHNAMEGEN}}
9276 !! wikitext
9277 {{CURRENTMONTHNAMEGEN}}
9278 !! html
9279 <p>January
9280 </p>
9281 !! end
9282
9283 !! test
9284 Magic Word: {{CURRENTTIME}}
9285 !! wikitext
9286 {{CURRENTTIME}}
9287 !! html
9288 <p>00:02
9289 </p>
9290 !! end
9291
9292 !! test
9293 Magic Word: {{CURRENTHOUR}}
9294 !! wikitext
9295 {{CURRENTHOUR}}
9296 !! html
9297 <p>00
9298 </p>
9299 !! end
9300
9301 !! test
9302 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9303 !! wikitext
9304 {{CURRENTWEEK}}
9305 !! html
9306 <p>1
9307 </p>
9308 !! end
9309
9310 !! test
9311 Magic Word: {{CURRENTYEAR}}
9312 !! wikitext
9313 {{CURRENTYEAR}}
9314 !! html
9315 <p>1970
9316 </p>
9317 !! end
9318
9319 !! test
9320 Magic Word: {{CURRENTTIMESTAMP}}
9321 !! wikitext
9322 {{CURRENTTIMESTAMP}}
9323 !! html
9324 <p>19700101000203
9325 </p>
9326 !! end
9327
9328 !! test
9329 Magic Words LOCAL (UTC)
9330 !! wikitext
9331 * {{LOCALMONTH}}
9332 * {{LOCALMONTH1}}
9333 * {{LOCALMONTHNAME}}
9334 * {{LOCALMONTHNAMEGEN}}
9335 * {{LOCALMONTHABBREV}}
9336 * {{LOCALDAY}}
9337 * {{LOCALDAY2}}
9338 * {{LOCALDAYNAME}}
9339 * {{LOCALYEAR}}
9340 * {{LOCALTIME}}
9341 * {{LOCALHOUR}}
9342 * {{LOCALWEEK}}
9343 * {{LOCALDOW}}
9344 * {{LOCALTIMESTAMP}}
9345 !! html
9346 <ul><li> 01</li>
9347 <li> 1</li>
9348 <li> January</li>
9349 <li> January</li>
9350 <li> Jan</li>
9351 <li> 1</li>
9352 <li> 01</li>
9353 <li> Thursday</li>
9354 <li> 1970</li>
9355 <li> 00:02</li>
9356 <li> 00</li>
9357 <li> 1</li>
9358 <li> 4</li>
9359 <li> 19700101000203</li></ul>
9360
9361 !! end
9362
9363 !! test
9364 Magic Word: {{FULLPAGENAME}}
9365 !! options
9366 title=[[User:Ævar Arnfjörð Bjarmason]]
9367 !! wikitext
9368 {{FULLPAGENAME}}
9369 !! html
9370 <p>User:Ævar Arnfjörð Bjarmason
9371 </p>
9372 !! end
9373
9374 !! test
9375 Magic Word: {{FULLPAGENAMEE}}
9376 !! options
9377 title=[[User:Ævar Arnfjörð Bjarmason]]
9378 !! wikitext
9379 {{FULLPAGENAMEE}}
9380 !! html
9381 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9382 </p>
9383 !! end
9384
9385 !! test
9386 Magic Word: {{TALKSPACE}}
9387 !! options
9388 title=[[User:Ævar Arnfjörð Bjarmason]]
9389 !! wikitext
9390 {{TALKSPACE}}
9391 !! html
9392 <p>User talk
9393 </p>
9394 !! end
9395
9396 !! test
9397 Magic Word: {{TALKSPACE}}, same namespace
9398 !! options
9399 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9400 !! wikitext
9401 {{TALKSPACE}}
9402 !! html
9403 <p>User talk
9404 </p>
9405 !! end
9406
9407 !! test
9408 Magic Word: {{TALKSPACE}}, main namespace
9409 !! options
9410 title=[[Parser Test]]
9411 !! wikitext
9412 {{TALKSPACE}}
9413 !! html
9414 <p>Talk
9415 </p>
9416 !! end
9417
9418 !! test
9419 Magic Word: {{TALKSPACEE}}
9420 !! options
9421 title=[[User:Ævar Arnfjörð Bjarmason]]
9422 !! wikitext
9423 {{TALKSPACEE}}
9424 !! html
9425 <p>User_talk
9426 </p>
9427 !! end
9428
9429 !! test
9430 Magic Word: {{SUBJECTSPACE}}
9431 !! options
9432 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9433 !! wikitext
9434 {{SUBJECTSPACE}}
9435 !! html
9436 <p>User
9437 </p>
9438 !! end
9439
9440 !! test
9441 Magic Word: {{SUBJECTSPACE}}, same namespace
9442 !! options
9443 title=[[User:Ævar Arnfjörð Bjarmason]]
9444 !! wikitext
9445 {{SUBJECTSPACE}}
9446 !! html
9447 <p>User
9448 </p>
9449 !! end
9450
9451 !! test
9452 Magic Word: {{SUBJECTSPACE}}, main namespace
9453 !! options
9454 title=[[Parser Test]]
9455 !! wikitext
9456 {{SUBJECTSPACE}}
9457 !! html
9458
9459 !! end
9460
9461 !! test
9462 Magic Word: {{SUBJECTSPACEE}}
9463 !! options
9464 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9465 !! wikitext
9466 {{SUBJECTSPACEE}}
9467 !! html
9468 <p>User
9469 </p>
9470 !! end
9471
9472 !! test
9473 Magic Word: {{NAMESPACE}}
9474 !! options
9475 title=[[User:Ævar Arnfjörð Bjarmason]]
9476 !! wikitext
9477 {{NAMESPACE}}
9478 !! html
9479 <p>User
9480 </p>
9481 !! end
9482
9483 !! test
9484 Magic Word: {{NAMESPACEE}}
9485 !! options
9486 title=[[User:Ævar Arnfjörð Bjarmason]]
9487 !! wikitext
9488 {{NAMESPACEE}}
9489 !! html
9490 <p>User
9491 </p>
9492 !! end
9493
9494 !! test
9495 Magic Word: {{NAMESPACENUMBER}}
9496 !! options
9497 title=[[User:Ævar Arnfjörð Bjarmason]]
9498 !! wikitext
9499 {{NAMESPACENUMBER}}
9500 !! html
9501 <p>2
9502 </p>
9503 !! end
9504
9505 !! test
9506 Magic Word: {{SUBPAGENAME}}
9507 !! options
9508 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9509 !! wikitext
9510 {{SUBPAGENAME}}
9511 !! html
9512 <p>sub ö
9513 </p>
9514 !! end
9515
9516 !! test
9517 Magic Word: {{SUBPAGENAMEE}}
9518 !! options
9519 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9520 !! wikitext
9521 {{SUBPAGENAMEE}}
9522 !! html
9523 <p>sub_%C3%B6
9524 </p>
9525 !! end
9526
9527 !! test
9528 Magic Word: {{ROOTPAGENAME}}
9529 !! options
9530 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9531 !! wikitext
9532 {{ROOTPAGENAME}}
9533 !! html
9534 <p>Ævar Arnfjörð Bjarmason
9535 </p>
9536 !! end
9537
9538 !! test
9539 Magic Word: {{ROOTPAGENAMEE}}
9540 !! options
9541 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9542 !! wikitext
9543 {{ROOTPAGENAMEE}}
9544 !! html
9545 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9546 </p>
9547 !! end
9548
9549 !! test
9550 Magic Word: {{BASEPAGENAME}}
9551 !! options
9552 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9553 !! wikitext
9554 {{BASEPAGENAME}}
9555 !! html
9556 <p>Ævar Arnfjörð Bjarmason
9557 </p>
9558 !! end
9559
9560 !! test
9561 Magic Word: {{BASEPAGENAMEE}}
9562 !! options
9563 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9564 !! wikitext
9565 {{BASEPAGENAMEE}}
9566 !! html
9567 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9568 </p>
9569 !! end
9570
9571 !! test
9572 Magic Word: {{TALKPAGENAME}}
9573 !! options
9574 title=[[User:Ævar Arnfjörð Bjarmason]]
9575 !! wikitext
9576 {{TALKPAGENAME}}
9577 !! html
9578 <p>User talk:Ævar Arnfjörð Bjarmason
9579 </p>
9580 !! end
9581
9582 !! test
9583 Magic Word: {{TALKPAGENAMEE}}
9584 !! options
9585 title=[[User:Ævar Arnfjörð Bjarmason]]
9586 !! wikitext
9587 {{TALKPAGENAMEE}}
9588 !! html
9589 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9590 </p>
9591 !! end
9592
9593 !! test
9594 Magic Word: {{SUBJECTPAGENAME}}
9595 !! options
9596 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9597 !! wikitext
9598 {{SUBJECTPAGENAME}}
9599 !! html
9600 <p>User:Ævar Arnfjörð Bjarmason
9601 </p>
9602 !! end
9603
9604 !! test
9605 Magic Word: {{SUBJECTPAGENAMEE}}
9606 !! options
9607 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9608 !! wikitext
9609 {{SUBJECTPAGENAMEE}}
9610 !! html
9611 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9612 </p>
9613 !! end
9614
9615 !! test
9616 Magic Word: {{NUMBEROFFILES}}
9617 !! wikitext
9618 {{NUMBEROFFILES}}
9619 !! html
9620 <p>5
9621 </p>
9622 !! end
9623
9624 !! test
9625 Magic Word: {{PAGENAME}}
9626 !! options
9627 title=[[User:Ævar Arnfjörð Bjarmason]]
9628 !! wikitext
9629 {{PAGENAME}}
9630 !! html
9631 <p>Ævar Arnfjörð Bjarmason
9632 </p>
9633 !! end
9634
9635 !! test
9636 Magic Word: {{PAGENAME}} with metacharacters
9637 !! options
9638 title=[['foo & bar = baz']]
9639 !! wikitext
9640 ''{{PAGENAME}}''
9641 !! html/php
9642 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
9643 </p>
9644 !! html+tidy
9645 <p><i>'foo &amp; bar = baz'</i></p>
9646 !! end
9647
9648 !! test
9649 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
9650 !! options
9651 title=[[*RFC 1234 http://example.com/]]
9652 !! wikitext
9653 {{PAGENAME}}
9654 !! html/php
9655 <p>&#42;RFC&#32;1234 http&#58;//example.com/
9656 </p>
9657 !! html+tidy
9658 <p>*RFC 1234 http://example.com/</p>
9659 !! end
9660
9661 !! test
9662 Magic Word: {{PAGENAMEE}}
9663 !! options
9664 title=[[User:Ævar Arnfjörð Bjarmason]]
9665 !! wikitext
9666 {{PAGENAMEE}}
9667 !! html
9668 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9669 </p>
9670 !! end
9671
9672 !! test
9673 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
9674 !! options
9675 title=[[*RFC 1234 http://example.com/]]
9676 !! wikitext
9677 {{PAGENAMEE}}
9678 !! html/php
9679 <p>&#42;RFC_1234_http&#58;//example.com/
9680 </p>
9681 !! html+tidy
9682 <p>*RFC_1234_http://example.com/</p>
9683 !! end
9684
9685 !! test
9686 Magic Word: {{REVISIONID}}
9687 !! wikitext
9688 {{REVISIONID}}
9689 !! html
9690 <p>1337
9691 </p>
9692 !! end
9693
9694 !! test
9695 Magic Word: {{SCRIPTPATH}}
9696 !! wikitext
9697 {{SCRIPTPATH}}
9698 !! html
9699 <p>/
9700 </p>
9701 !! end
9702
9703 !! test
9704 Magic Word: {{STYLEPATH}}
9705 !! wikitext
9706 {{STYLEPATH}}
9707 !! html
9708 <p>/skins
9709 </p>
9710 !! end
9711
9712 !! test
9713 Magic Word: {{SERVER}}
9714 !! wikitext
9715 {{SERVER}}
9716 !! html
9717 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9718 </p>
9719 !! end
9720
9721 !! test
9722 Magic Word: {{SERVERNAME}}
9723 !! wikitext
9724 {{SERVERNAME}}
9725 !! html
9726 <p>example.org
9727 </p>
9728 !! end
9729
9730 !! test
9731 Magic Word: {{SITENAME}}
9732 !! wikitext
9733 {{SITENAME}}
9734 !! html
9735 <p>MediaWiki
9736 </p>
9737 !! end
9738
9739 !! test
9740 Case-sensitive magic words, when cased differently, should just be template transclusions
9741 !! wikitext
9742 {{CurrentMonth}}
9743 {{currentday}}
9744 {{cURreNTweEK}}
9745 {{currentHour}}
9746 !! html
9747 <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>
9748 <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>
9749 <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>
9750 <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>
9751 </p>
9752 !! end
9753
9754 !! test
9755 Case-insensitive magic words should still work with weird casing.
9756 !! wikitext
9757 {{sErVeRNaMe}}
9758 {{LCFirst:AOEU}}
9759 {{ucFIRST:aoeu}}
9760 {{SERver}}
9761 !! html
9762 <p>example.org
9763 aOEU
9764 Aoeu
9765 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9766 </p>
9767 !! end
9768
9769 # From plwiki:PLOS_ONE
9770 !! test
9771 Parsoid: Page property magic word with magic word contents
9772 !! wikitext
9773 {{DISPLAYTITLE:''{{PAGENAME}}''}}
9774 !! html/parsoid
9775 <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>"}]]}'/>
9776 !! end
9777
9778 !! test
9779 Parsoid: Template-generated DISPLAYTITLE
9780 !! wikitext
9781 {{{{echo|DISPLAYTITLE}}:Foo}}
9782 !! html/parsoid
9783 <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}}]}'/>
9784 !! end
9785
9786 !! test
9787 Namespace 1 {{ns:1}}
9788 !! wikitext
9789 {{ns:1}}
9790 !! html
9791 <p>Talk
9792 </p>
9793 !! end
9794
9795 !! test
9796 Namespace 1 {{ns:01}}
9797 !! wikitext
9798 {{ns:01}}
9799 !! html
9800 <p>Talk
9801 </p>
9802 !! end
9803
9804 !! test
9805 Namespace 0 {{ns:0}} (bug 4783)
9806 !! wikitext
9807 {{ns:0}}
9808 !! html
9809
9810 !! end
9811
9812 !! test
9813 Namespace 0 {{ns:00}} (bug 4783)
9814 !! wikitext
9815 {{ns:00}}
9816 !! html
9817
9818 !! end
9819
9820 !! test
9821 Namespace -1 {{ns:-1}}
9822 !! wikitext
9823 {{ns:-1}}
9824 !! html
9825 <p>Special
9826 </p>
9827 !! end
9828
9829 !! test
9830 Namespace User {{ns:User}}
9831 !! wikitext
9832 {{ns:User}}
9833 !! html
9834 <p>User
9835 </p>
9836 !! end
9837
9838 !! test
9839 Namespace User talk {{ns:User_talk}}
9840 !! wikitext
9841 {{ns:User_talk}}
9842 !! html
9843 <p>User talk
9844 </p>
9845 !! end
9846
9847 !! test
9848 Namespace User talk {{ns:uSeR tAlK}}
9849 !! wikitext
9850 {{ns:uSeR tAlK}}
9851 !! html
9852 <p>User talk
9853 </p>
9854 !! end
9855
9856 !! test
9857 Namespace File {{ns:File}}
9858 !! wikitext
9859 {{ns:File}}
9860 !! html
9861 <p>File
9862 </p>
9863 !! end
9864
9865 !! test
9866 Namespace File {{ns:Image}}
9867 !! wikitext
9868 {{ns:Image}}
9869 !! html
9870 <p>File
9871 </p>
9872 !! end
9873
9874 !! test
9875 Namespace (lang=de) Benutzer {{ns:User}}
9876 !! options
9877 language=de
9878 !! wikitext
9879 {{ns:User}}
9880 !! html
9881 <p>Benutzer
9882 </p>
9883 !! end
9884
9885 !! test
9886 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
9887 !! options
9888 language=de
9889 !! wikitext
9890 {{ns:3}}
9891 !! html
9892 <p>Benutzer Diskussion
9893 </p>
9894 !! end
9895
9896
9897 !! test
9898 Urlencode
9899 !! wikitext
9900 {{urlencode:hi world?!}}
9901 {{urlencode:hi world?!|WIKI}}
9902 {{urlencode:hi world?!|PATH}}
9903 {{urlencode:hi world?!|QUERY}}
9904 !! html
9905 <p>hi+world%3F%21
9906 hi_world%3F!
9907 hi%20world%3F%21
9908 hi+world%3F%21
9909 </p>
9910 !! end
9911
9912 !! test
9913 Magic Word: prioritize type info over data-parsoid
9914 !! options
9915 parsoid=html2wt
9916 !! html/parsoid
9917 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
9918 !! wikitext
9919 __FORCETOC__
9920 !! end
9921
9922 !! test
9923 Magic Word: serialize on separate line (parsoid)
9924 !! options
9925 parsoid=wt2wt,html2wt
9926 !! wikitext
9927 foo
9928 __NOTOC__
9929 bar
9930 !! html/parsoid
9931 foo<meta property="mw:PageProp/notoc"/>bar
9932 !! end
9933
9934 !! test
9935 Magic Word: rt non-english wikis
9936 !! options
9937 parsoid=wt2wt
9938 language=de
9939 !! wikitext
9940 __NOEDITSECTION__
9941 !! html/parsoid
9942 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
9943 !! end
9944
9945 !!test
9946 __proto__ is treated as normal wikitext (T105997)
9947 !!wikitext
9948 __proto__
9949 !!html
9950 <p>__proto__
9951 </p>
9952 !!end
9953
9954 ###
9955 ### Magic links
9956 ###
9957 !! test
9958 Magic links: internal link to RFC (bug 479)
9959 !! wikitext
9960 [[RFC 123]]
9961 !! html/php
9962 <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>
9963 </p>
9964 !! html/parsoid
9965 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
9966 !! end
9967
9968 !! test
9969 Magic links: RFC (bug 479)
9970 !! wikitext
9971 RFC 822
9972 !! html/php
9973 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9974 </p>
9975 !! html/parsoid
9976 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
9977 !! end
9978
9979 !! test
9980 Magic links: RFC (bug 65278)
9981 !! wikitext
9982 This is RFC 822 but thisRFC 822 is not RFC 822linked.
9983 !! html/php
9984 <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.
9985 </p>
9986 !! html/parsoid
9987 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
9988 !! end
9989
9990 !! test
9991 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
9992 !! wikitext
9993 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
9994 RFC
9995 822
9996 !! html/php
9997 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9998 RFC
9999 822
10000 </p>
10001 !! html/parsoid
10002 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 822</a>
10003 RFC
10004 822</p>
10005 !! end
10006
10007 !! test
10008 Magic links: ISBN (bug 1937)
10009 !! wikitext
10010 ISBN 0-306-40615-2
10011 !! html/php
10012 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10013 </p>
10014 !! html/parsoid
10015 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10016 !! end
10017
10018 !! test
10019 Magic links: ISBN (bug 65278)
10020 !! wikitext
10021 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10022 !! html/php
10023 <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.
10024 </p>
10025 !! html/parsoid
10026 <p>This is <a href="./Special:BookSources/9780316098113" rel="mw:WikiLink">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.</p>
10027 !! end
10028
10029 !! test
10030 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10031 !! wikitext
10032 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10033 ISBN
10034 9780316098113
10035 ISBN 978
10036 0316098113
10037 !! html/php
10038 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10039 ISBN
10040 9780316098113
10041 ISBN 978
10042 0316098113
10043 </p>
10044 !! html/parsoid
10045 <p><a href="./Special:BookSources/9780316098113" rel="mw:WikiLink">ISBN <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 978<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>0<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>316<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span>09811<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>3</a>
10046 ISBN
10047 9780316098113
10048 ISBN 978
10049 0316098113</p>
10050 !! end
10051
10052 !! test
10053 Magic links: PMID incorrectly converts space to underscore
10054 !! wikitext
10055 PMID 1234
10056 !! html/php
10057 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10058 </p>
10059 !! html/parsoid
10060 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10061 !! end
10062
10063 !! test
10064 Magic links: PMID (bug 65278)
10065 !! wikitext
10066 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10067 !! html/php
10068 <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.
10069 </p>
10070 !! html/parsoid
10071 <p>This is <a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.</p>
10072 !! end
10073
10074 !! test
10075 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10076 !! wikitext
10077 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10078 PMID
10079 1234
10080 !! html/php
10081 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10082 PMID
10083 1234
10084 </p>
10085 !! html/parsoid
10086 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 1234</a>
10087 PMID
10088 1234</p>
10089 !! end
10090
10091 ###
10092 ### Templates
10093 ####
10094
10095 !! test
10096 Nonexistent template
10097 !! wikitext
10098 {{thistemplatedoesnotexist}}
10099 !! html
10100 <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>
10101 </p>
10102 !! end
10103
10104 !! test
10105 Template with invalid target containing tags
10106 !! wikitext
10107 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10108 !! html
10109 <p>{{a<b>b</b>|foo|a=b|a = b}}
10110 </p>
10111 !! end
10112
10113 !! test
10114 Template with invalid target containing unclosed tag
10115 !! wikitext
10116 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10117 !! html
10118 <p>{{a<b>|foo|a=b|a = b}}</b>
10119 </p>
10120 !! end
10121
10122 !! test
10123 Template with invalid target containing wikilink
10124 !! wikitext
10125 {{[[Main Page]]}}
10126 !! html/php
10127 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10128 </p>
10129 !! html/parsoid
10130 <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>
10131 !! end
10132
10133 !! test
10134 Template with just whitespace in it, bug #68421
10135 !! wikitext
10136 {{echo|{{ }}}}
10137 !! html/parsoid
10138 <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>
10139 !! end
10140
10141 !! article
10142 Template:test
10143 !! text
10144 This is a test template
10145 !! endarticle
10146
10147 !! test
10148 Simple template
10149 !! wikitext
10150 {{test}}
10151 !! html
10152 <p>This is a test template
10153 </p>
10154 !! end
10155
10156 !! test
10157 Template with explicit namespace
10158 !! wikitext
10159 {{Template:test}}
10160 !! html
10161 <p>This is a test template
10162 </p>
10163 !! end
10164
10165
10166 !! article
10167 Template:paramtest
10168 !! text
10169 This is a test template with parameter {{{param}}}
10170 !! endarticle
10171
10172 !! test
10173 Template parameter
10174 !! wikitext
10175 {{paramtest|param=foo}}
10176 !! html
10177 <p>This is a test template with parameter foo
10178 </p>
10179 !! end
10180
10181 !! article
10182 Template:paramtestnum
10183 !! text
10184 [[{{{1}}}|{{{2}}}]]
10185 !! endarticle
10186
10187 !! test
10188 Template unnamed parameter
10189 !! wikitext
10190 {{paramtestnum|Main Page|the main page}}
10191 !! html
10192 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10193 </p>
10194 !! end
10195
10196 !! article
10197 Template:templatesimple
10198 !! text
10199 (test)
10200 !! endarticle
10201
10202 !! article
10203 Template:templateredirect
10204 !! text
10205 #redirect [[Template:templatesimple]]
10206 !! endarticle
10207
10208 !! article
10209 Template:templateasargtestnum
10210 !! text
10211 {{{{{1}}}}}
10212 !! endarticle
10213
10214 !! article
10215 Template:templateasargtest
10216 !! text
10217 {{template{{{templ}}}}}
10218 !! endarticle
10219
10220 !! article
10221 Template:templateasargtest2
10222 !! text
10223 {{{{{templ}}}}}
10224 !! endarticle
10225
10226 !! test
10227 Template with template name as unnamed argument
10228 !! wikitext
10229 {{templateasargtestnum|templatesimple}}
10230 !! html
10231 <p>(test)
10232 </p>
10233 !! end
10234
10235 !! test
10236 Template with template name as argument
10237 !! wikitext
10238 {{templateasargtest|templ=simple}}
10239 !! html
10240 <p>(test)
10241 </p>
10242 !! end
10243
10244 !! test
10245 Template with template name as argument (2)
10246 !! wikitext
10247 {{templateasargtest2|templ=templatesimple}}
10248 !! html
10249 <p>(test)
10250 </p>
10251 !! end
10252
10253 !! article
10254 Template:templateasargtestdefault
10255 !! text
10256 {{{{{templ|templatesimple}}}}}
10257 !! endarticle
10258
10259 !! article
10260 Template:templa
10261 !! text
10262 '''templ'''
10263 !! endarticle
10264
10265 !! test
10266 Template with default value
10267 !! wikitext
10268 {{templateasargtestdefault}}
10269 !! html
10270 <p>(test)
10271 </p>
10272 !! end
10273
10274 !! test
10275 Template with default value (value set)
10276 !! wikitext
10277 {{templateasargtestdefault|templ=templa}}
10278 !! html
10279 <p><b>templ</b>
10280 </p>
10281 !! end
10282
10283 !! test
10284 Template redirect
10285 !! wikitext
10286 {{templateredirect}}
10287 !! html/php
10288 <p>(test)
10289 </p>
10290 !! html/parsoid
10291 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10292 !! end
10293
10294 !! test
10295 Template with argument in separate line
10296 !! wikitext
10297 {{ templateasargtest |
10298 templ = simple }}
10299 !! html
10300 <p>(test)
10301 </p>
10302 !! end
10303
10304 !! test
10305 Template with complex template as argument
10306 !! wikitext
10307 {{paramtest|
10308 param ={{ templateasargtest |
10309 templ = simple }}}}
10310 !! html
10311 <p>This is a test template with parameter (test)
10312 </p>
10313 !! end
10314
10315 !! test
10316 Template with thumb image (with link in description)
10317 !! wikitext
10318 {{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10319 !! html/php
10320 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>
10321
10322 !! html+tidy
10323 <p>This is a test template with parameter</p>
10324 <div class="thumb tright">
10325 <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>
10326 <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>
10327 </div>
10328 </div>
10329 !! html/parsoid
10330 <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>
10331 !! end
10332
10333 !! article
10334 Template:complextemplate
10335 !! text
10336 {{{1}}} {{paramtest|
10337 param ={{{param}}}}}
10338 !! endarticle
10339
10340 !! test
10341 Template with complex arguments
10342 !! wikitext
10343 {{complextemplate|
10344 param ={{ templateasargtest |
10345 templ = simple }}|[[Template:complextemplate|link]]}}
10346 !! html
10347 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10348 </p>
10349 !! end
10350
10351 !! test
10352 BUG 553: link with two variables in a piped link
10353 !! wikitext
10354 {|
10355 |[[{{{1}}}|{{{2}}}]]
10356 |}
10357 !! html
10358 <table>
10359 <tr>
10360 <td>[[{{{1}}}|{{{2}}}]]
10361 </td></tr></table>
10362
10363 !! end
10364
10365 !! test
10366 Magic variable as template parameter
10367 !! wikitext
10368 {{paramtest|param={{SITENAME}}}}
10369 !! html
10370 <p>This is a test template with parameter MediaWiki
10371 </p>
10372 !! end
10373
10374 !! article
10375 Template:linktest
10376 !! text
10377 [[{{{param}}}|link]]
10378 !! endarticle
10379
10380 !! test
10381 Template parameter as link source
10382 !! wikitext
10383 {{linktest|param=Main Page}}
10384 !! html
10385 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10386 </p>
10387 !! end
10388
10389 !!article
10390 Template:paramtest2
10391 !! text
10392 including another template, {{paramtest|param={{{arg}}}}}
10393 !! endarticle
10394
10395 !! test
10396 Template passing argument to another template
10397 !! wikitext
10398 {{paramtest2|arg='hmm'}}
10399 !! html
10400 <p>including another template, This is a test template with parameter 'hmm'
10401 </p>
10402 !! end
10403
10404 !! article
10405 Template:Linktest2
10406 !! text
10407 Main Page
10408 !! endarticle
10409
10410 !! test
10411 Template as link source
10412 !! wikitext
10413 [[{{linktest2}}]]
10414
10415 [[{{linktest2}}|Main Page]]
10416
10417 [[{{linktest2}}]]Page
10418 !! html
10419 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10420 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10421 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10422 </p>
10423 !! end
10424
10425
10426 !! article
10427 Template:loop1
10428 !! text
10429 {{loop2}}
10430 !! endarticle
10431
10432 !! article
10433 Template:loop2
10434 !! text
10435 {{loop1}}
10436 !! endarticle
10437
10438 !! test
10439 Template infinite loop
10440 !! wikitext
10441 {{loop1}}
10442 !! html
10443 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10444 </p>
10445 !! end
10446
10447 !! test
10448 Template from main namespace
10449 !! wikitext
10450 {{:Main Page}}
10451 !! html
10452 <p>blah blah
10453 </p>
10454 !! end
10455
10456 !! article
10457 Template:table
10458 !! text
10459 {|
10460 | 1 || 2
10461 |-
10462 | 3 || 4
10463 |}
10464 !! endarticle
10465
10466 !! test
10467 BUG 529: Template with table, not included at beginning of line
10468 !! wikitext
10469 foo {{table}}
10470 !! html
10471 <p>foo
10472 </p>
10473 <table>
10474 <tr>
10475 <td> 1 </td>
10476 <td> 2
10477 </td></tr>
10478 <tr>
10479 <td> 3 </td>
10480 <td> 4
10481 </td></tr></table>
10482
10483 !! end
10484
10485 !! test
10486 BUG 523: Template shouldn't eat newline (or add an extra one before table)
10487 !! wikitext
10488 foo
10489 {{table}}
10490 !! html
10491 <p>foo
10492 </p>
10493 <table>
10494 <tr>
10495 <td> 1 </td>
10496 <td> 2
10497 </td></tr>
10498 <tr>
10499 <td> 3 </td>
10500 <td> 4
10501 </td></tr></table>
10502
10503 !! end
10504
10505 !! test
10506 BUG 41: Template parameters shown as broken links
10507 !! wikitext
10508 {{{parameter}}}
10509 !! html
10510 <p>{{{parameter}}}
10511 </p>
10512 !! end
10513
10514 !! test
10515 Template with targets containing wikilinks
10516 !! wikitext
10517 {{[[foo]]}}
10518
10519 {{[[{{echo|foo}}]]}}
10520
10521 {{{{echo|[[foo}}]]}}
10522 !! html
10523 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10524 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10525 </p><p>{{[[foo}}]]
10526 </p>
10527 !! end
10528
10529 !! article
10530 Template:''
10531 !! text
10532 bar
10533 !! endarticle
10534
10535 !! test
10536 Templates: Double quotes as template target
10537 !! wikitext
10538 foo {{''}} baz
10539 !! html/php
10540 <p>foo bar baz
10541 </p>
10542 !! html/parsoid
10543 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
10544 </p>
10545 !! end
10546
10547 !! article
10548 Template:MSGNW test
10549 !! text
10550 ''None'' of '''this''' should be
10551 * interpreted
10552 but rather passed unmodified
10553 {{test}}
10554 <gallery>
10555 File:Foobar.jpg
10556 </gallery>
10557 <!-- comment -->
10558 !! endarticle
10559
10560 # hmm, fix this or just deprecate msgnw and document its behavior?
10561 !! test
10562 msgnw keyword
10563 !! wikitext
10564 {{msgnw:MSGNW test}}
10565 !! html/php
10566 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
10567 &#42; interpreted
10568 &#32;but rather passed unmodified
10569 &#123;&#123;test&#125;&#125;
10570 &#60;gallery&#62;
10571 File:Foobar.jpg
10572 &#60;/gallery&#62;
10573 &#60;!-- comment --&#62;
10574 </p>
10575 !! end
10576
10577 !! test
10578 int keyword
10579 !! wikitext
10580 {{int:youhavenewmessages|lots of money|not!}}
10581 !! html
10582 <p>You have lots of money (not!).
10583 </p>
10584 !! end
10585
10586 !! test
10587 int keyword - non-existing message
10588 !! wikitext
10589 {{int:var}}
10590 !! html
10591 <p>&lt;var&gt;
10592 </p>
10593 !! end
10594
10595 !! article
10596 Template:Includes
10597 !! text
10598 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10599 !! endarticle
10600
10601 !! test
10602 <includeonly> and <noinclude> being included
10603 !! wikitext
10604 {{Includes}}
10605 !! html
10606 <p>Foobar
10607 </p>
10608 !! end
10609
10610 !! article
10611 Template:Includes2
10612 !! text
10613 <onlyinclude>Foo</onlyinclude>bar
10614 !! endarticle
10615
10616 !! test
10617 <onlyinclude> being included
10618 !! wikitext
10619 {{Includes2}}
10620 !! html
10621 <p>Foo
10622 </p>
10623 !! end
10624
10625
10626 !! article
10627 Template:Includes3
10628 !! text
10629 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
10630 !! endarticle
10631
10632 !! test
10633 <onlyinclude> and <includeonly> being included
10634 !! wikitext
10635 {{Includes3}}
10636 !! html
10637 <p>Foo
10638 </p>
10639 !! end
10640
10641 !! test
10642 <includeonly> and <noinclude> on a page
10643 !! wikitext
10644 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10645 !! html
10646 <p>Foozar
10647 </p>
10648 !! end
10649
10650 !! test
10651 Un-closed <noinclude>
10652 !! wikitext
10653 <noinclude>
10654 !! html
10655 !! end
10656
10657 !! test
10658 <onlyinclude> on a page
10659 !! wikitext
10660 <onlyinclude>Foo</onlyinclude>bar
10661 !! html
10662 <p>Foobar
10663 </p>
10664 !! end
10665
10666 !! test
10667 Un-closed <onlyinclude>
10668 !! wikitext
10669 <onlyinclude>
10670 !! html
10671 !! end
10672
10673 !!test
10674 Self-closed noinclude, includeonly, onlyinclude tags
10675 !! wikitext
10676 <noinclude />
10677 <includeonly />
10678 <onlyinclude />
10679 !! html
10680 <p><br />
10681 </p>
10682 !!end
10683
10684 !!test
10685 Unbalanced includeonly and noinclude tags
10686 !! wikitext
10687 {|
10688 |a</noinclude>
10689 |b</noinclude></noinclude>
10690 |c</noinclude></includeonly>
10691 |d</includeonly></includeonly>
10692 |}
10693 !! html
10694 <table>
10695 <tr>
10696 <td>a
10697 </td>
10698 <td>b
10699 </td>
10700 <td>c&lt;/includeonly&gt;
10701 </td>
10702 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
10703 </td></tr></table>
10704
10705 !!end
10706
10707 !! article
10708 Template:Includeonly section
10709 !! text
10710 <includeonly>
10711 ==Includeonly section==
10712 </includeonly>
10713 ==Section T-1==
10714 !!endarticle
10715
10716 !! test
10717 Bug 6563: Edit link generation for section shown by <includeonly>
10718 !! wikitext
10719 {{includeonly section}}
10720 !! html
10721 <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>
10722 <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>
10723
10724 !! end
10725
10726 # Uses same input as the contents of [[Template:Includeonly section]]
10727 !! test
10728 Bug 6563: Section extraction for section shown by <includeonly>
10729 !! options
10730 section=T-2
10731 !! wikitext
10732 <includeonly>
10733 ==Includeonly section==
10734 </includeonly>
10735 ==Section T-2==
10736 !! html
10737 ==Section T-2==
10738 !! end
10739
10740 !! test
10741 Bug 6563: Edit link generation for section suppressed by <includeonly>
10742 !! wikitext
10743 <includeonly>
10744 ==Includeonly section==
10745 </includeonly>
10746 ==Section 1==
10747 !! html
10748 <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>
10749
10750 !! end
10751
10752 !! test
10753 Bug 6563: Section extraction for section suppressed by <includeonly>
10754 !! options
10755 section=1
10756 !! wikitext
10757 <includeonly>
10758 ==Includeonly section==
10759 </includeonly>
10760 ==Section 1==
10761 !! html
10762 ==Section 1==
10763 !! end
10764
10765 !! test
10766 Un-closed <includeonly>
10767 !! wikitext
10768 <includeonly>
10769 !! html
10770 !! end
10771
10772 !! test
10773 Includes and comments at SOL
10774 !! wikitext
10775 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
10776
10777 <noinclude>
10778 some
10779 </noinclude>* stuff
10780 * here
10781
10782 <includeonly>can have stuff</includeonly>=== here ===
10783
10784 !! html/php
10785 <h2><span class="mw-headline" id="hu">hu</span></h2>
10786 <p>some
10787 </p>
10788 <ul><li> stuff</li>
10789 <li> here</li></ul>
10790 <h3><span class="mw-headline" id="here">here</span></h3>
10791
10792 !! html/parsoid
10793 <!-- 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>
10794
10795 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
10796 <p>some</p>
10797 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
10798 <li> here</li></ul>
10799
10800 <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>
10801
10802 !! end
10803
10804 # TODO: test with DOM fragment reuse!
10805 !! test
10806 Parsoid: DOM fragment reuse
10807 !! options
10808 parsoid=wt2wt,wt2html
10809 !! wikitext
10810 a{{echo|b<table></table>c}}d
10811
10812 a{{echo|b
10813 <table></table>
10814 c}}d
10815
10816 {{echo|a
10817
10818 <table></table>
10819
10820 b}}
10821 !! html
10822 <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>
10823
10824 <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">
10825 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
10826 </span><p about="#mwt2">cd</p>
10827
10828 <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">
10829
10830 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
10831
10832 </span><p about="#mwt3">b</p>
10833 !! end
10834
10835 !! test
10836 Parsoid: Merge double tds (T52603)
10837 !! options
10838 parsoid
10839 !! wikitext
10840 {|
10841 |{{echo|{{!}} foo}}
10842 |}
10843 !! html
10844 <table><tbody>
10845 <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>
10846 </tbody></table>
10847 !! end
10848
10849 !! test
10850 Parsoid: Merge double tds in nested transclusion content (T52603)
10851 !! options
10852 parsoid
10853 !! wikitext
10854 {{echo|<div>}}
10855 {|
10856 |{{echo|{{!}} foo}}
10857 |}
10858 {{echo|</div>}}
10859 !! html
10860 <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}}]}'>
10861 <table><tbody>
10862 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
10863 </tbody></table>
10864 </div>
10865 !! end
10866
10867 ###
10868 ### <includeonly> and <noinclude> in attributes
10869 ###
10870 !!test
10871 0. includeonly around the entire attribute
10872 !! wikitext
10873 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
10874 !! html
10875 <p><span id="v2">bar</span>
10876 </p>
10877 !!end
10878
10879 !!test
10880 1. includeonly in html attr key
10881 !! wikitext
10882 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
10883 !! html
10884 <p><span id="foo">bar</span>
10885 </p>
10886 !!end
10887
10888 !!test
10889 2. includeonly in html attr value
10890 !! wikitext
10891 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
10892 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
10893 !! html
10894 <p><span id="v1">bar</span>
10895 <span id="v1">bar</span>
10896 </p>
10897 !!end
10898
10899 !!test
10900 3. includeonly in part of an attr value
10901 !! wikitext
10902 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
10903 !! html
10904 <p><span style="color:red;">bar</span>
10905 </p>
10906 !!end
10907
10908 !!test
10909 4. includeonly in table attributes
10910 !! wikitext
10911 {|
10912 |- <noinclude>
10913 |-
10914 |a
10915 </noinclude>
10916 |- <includeonly>
10917 |-
10918 |b
10919 </includeonly>
10920 |}
10921 !! html
10922 <table>
10923
10924
10925 <tr>
10926 <td>a
10927 </td></tr>
10928 </table>
10929
10930 !!end
10931
10932 ###
10933 ### Token Stream Patcher tests
10934 ###
10935 ### These tests won't always pass wt2wt and other modes because
10936 ### on serialization, the table will be output on a new line.
10937 ### For now, we are blacklisting them, and using this to test selser.
10938 ###
10939
10940 !!test
10941 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
10942 !!options
10943 parsoid=wt2html,wt2wt
10944 !!wikitext
10945 {{echo|}}{| width = '100%'
10946 |foo
10947 |}
10948 !!html/parsoid
10949 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
10950 <tbody><tr><td>foo</td></tr>
10951 </tbody></table>
10952 !!end
10953
10954 !!test
10955 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
10956 !!options
10957 parsoid=wt2html,wt2wt
10958 !!wikitext
10959 <includeonly>a</includeonly>{| {{{b}}}
10960 |c
10961 |}
10962 !!html/parsoid
10963 <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}}}":""}}'>
10964 <tbody><tr><td>c</td></tr>
10965 </tbody></table>
10966
10967 !!end
10968
10969 ###
10970 ### Testing parsing of templates where a template arg
10971 ### has the same name as the template itself.
10972 ###
10973
10974 !! article
10975 Template:quote
10976 !! text
10977 {{{quote|{{{1}}}}}}
10978 !! endarticle
10979
10980 !!test
10981 Templates: Template Name/Arg clash: 1. Use of positional param
10982 !! wikitext
10983 {{quote|foo}}
10984 !! html
10985 <p>foo
10986 </p>
10987 !!end
10988
10989 !!test
10990 Templates: Template Name/Arg clash: 2. Use of named param
10991 !! wikitext
10992 {{quote|quote=foo}}
10993 !! html
10994 <p>foo
10995 </p>
10996 !!end
10997
10998 !!test
10999 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11000 !! wikitext
11001 {{quote|quote}}
11002 !! html
11003 <p>quote
11004 </p>
11005 !!end
11006
11007 ###
11008 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11009 ###
11010
11011 !!test
11012 Templates: 1. Simple use
11013 !! wikitext
11014 {{echo|Foo}}
11015 !! html
11016 <p>Foo
11017 </p>
11018 !!end
11019
11020 !!test
11021 Templates: 2. Inside a block tag
11022 !! wikitext
11023 <div>{{echo|Foo}}</div>
11024 <blockquote>{{echo|Foo}}</blockquote>
11025 !! html
11026 <div>Foo</div>
11027 <blockquote>Foo</blockquote>
11028
11029 !! html+tidy
11030 <div>Foo</div>
11031 <blockquote>
11032 <p>Foo</p>
11033 </blockquote>
11034 !!end
11035
11036 !!test
11037 Templates: P-wrapping: 1a. Templates on consecutive lines
11038 !! wikitext
11039 {{echo|Foo}}
11040 {{echo|bar}}
11041 !! html
11042 <p>Foo
11043 bar
11044 </p>
11045 !!end
11046
11047 !!test
11048 Templates: P-wrapping: 1b. Templates on consecutive lines
11049 !! wikitext
11050 Foo
11051
11052 {{echo|bar}}
11053 {{echo|baz}}
11054 !! html
11055 <p>Foo
11056 </p><p>bar
11057 baz
11058 </p>
11059 !!end
11060
11061 !!test
11062 Templates: P-wrapping: 1c. Templates on consecutive lines
11063 !! wikitext
11064 {{echo|Foo}}
11065 {{echo|bar}} <div>baz</div>
11066 !! html
11067 <p>Foo
11068 </p>
11069 bar <div>baz</div>
11070
11071 !! html+tidy
11072 <p>Foo</p>
11073 <p>bar</p>
11074 <div>baz</div>
11075 !! end
11076
11077 !!test
11078 Templates: P-wrapping: 1d. Template preceded by comment-only line
11079 !!options
11080 parsoid
11081 !! wikitext
11082 <!-- foo -->
11083 {{echo|Bar}}
11084 !! html
11085 <!-- foo -->
11086
11087 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11088 !!end
11089
11090 !!test
11091 Templates: Inline Text: 1. Multiple template uses
11092 !! wikitext
11093 {{echo|Foo}}bar{{echo|baz}}
11094 !! html
11095 <p>Foobarbaz
11096 </p>
11097 !!end
11098
11099 !!test
11100 Templates: Inline Text: 2. Back-to-back template uses
11101 !! wikitext
11102 {{echo|Foo}}{{echo|bar}}
11103 !! html
11104 <p>Foobar
11105 </p>
11106 !!end
11107
11108 !!test
11109 Templates: Block Tags: 1. Multiple template uses
11110 !! wikitext
11111 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11112 !! html
11113 <div>Foo</div><div>bar</div><div>baz</div>
11114
11115 !!end
11116
11117 !!test
11118 Templates: Block Tags: 2. Back-to-back template uses
11119 !! wikitext
11120 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11121 !! html
11122 <div>Foo</div><div>bar</div>
11123
11124 !!end
11125
11126 # This is an edge case relating to paragraph wrapping.
11127 !!test
11128 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11129 !! wikitext
11130 {{echo|a
11131 b</p>}}
11132 !! html/parsoid
11133 <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
11134 b</p>
11135 !!end
11136
11137 !!test
11138 Templates: Links: 1. Simple example
11139 !! wikitext
11140 {{echo|[[Foo|bar]]}}
11141 !! html
11142 <p><a href="/wiki/Foo" title="Foo">bar</a>
11143 </p>
11144 !!end
11145
11146 !!test
11147 Templates: Links: 2. Generation of link href
11148 !! wikitext
11149 [[{{echo|Foo}}|bar]]
11150 !! html
11151 <p><a href="/wiki/Foo" title="Foo">bar</a>
11152 </p>
11153 !!end
11154
11155 !!test
11156 Templates: Links: 3. Generation of part of a link href
11157 !! wikitext
11158 [[Fo{{echo|o}}|bar]]
11159
11160 [[Foo{{echo|bar}}]]
11161
11162 [[Foo{{echo|bar}}baz]]
11163
11164 [[Foo{{echo|bar}}|bar]]
11165
11166 [[:Foo{{echo|bar}}]]
11167
11168 [[:Foo{{echo|bar}}|bar]]
11169 !! html
11170 <p><a href="/wiki/Foo" title="Foo">bar</a>
11171 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11172 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11173 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11174 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11175 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11176 </p>
11177 !!end
11178
11179 !!test
11180 Templates: Links: 4. Multiple templates generating link href
11181 !! wikitext
11182 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11183 !! html
11184 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11185 </p>
11186 !!end
11187
11188 !!test
11189 Templates: Links: 5. Generation of link text
11190 !! wikitext
11191 [[Foo|{{echo|bar}}]]
11192 !! html
11193 <p><a href="/wiki/Foo" title="Foo">bar</a>
11194 </p>
11195 !!end
11196
11197 !!test
11198 Templates: Links: 5. Nested templates (only outermost template should be marked)
11199 !! wikitext
11200 {{echo|[[{{echo|Foo}}|bar]]}}
11201 !! html
11202 <p><a href="/wiki/Foo" title="Foo">bar</a>
11203 </p>
11204 !!end
11205
11206 !!test
11207 Templates: HTML Tag: 1. Generation of HTML attr. key
11208 !! wikitext
11209 <div {{echo|style}}="color:red;">foo</div>
11210 !! html
11211 <div style="color:red;">foo</div>
11212
11213 !!end
11214
11215 !!test
11216 Templates: HTML Tag: 2. Generation of HTML attr. value
11217 !! wikitext
11218 <div style={{echo|'color:red;'}}>foo</div>
11219 !! html
11220 <div style="color:red;">foo</div>
11221
11222 !!end
11223
11224 !!test
11225 Templates: HTML Tag: 3. Generation of HTML attr key and value
11226 !! wikitext
11227 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11228 !! html
11229 <div style="color:red;">foo</div>
11230
11231 !!end
11232
11233 !!test
11234 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11235 !! wikitext
11236 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11237 !! html
11238 <div title="This is a long title with just one piece templated">foo</div>
11239
11240 !!end
11241
11242 !!test
11243 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11244 !! wikitext
11245 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11246 !! html
11247 <div title="This is a long title with just one piece templated">foo</div>
11248
11249 !!end
11250
11251 !!test
11252 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11253 !! wikitext
11254 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11255 !! html
11256 <div title="This is a long title with just one piece templated">foo</div>
11257
11258 !!end
11259
11260 # SSS FIXME: While it is great we added support for all this,
11261 # do we want to make this part of the spec? Maybe we want to
11262 # deprecate this kind of usage in the future?
11263 !!test
11264 Templates: HTML Tag: 7. Generation of partial attribute key string
11265 !! wikitext
11266 <div st{{echo|yle}}="color:red;">foo</div>
11267 !! html
11268 <div style="color:red;">foo</div>
11269
11270 !!end
11271
11272 !! test
11273 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11274 !! wikitext
11275 <div {{echo|1=id="v1"}}>bar</div>
11276 !! html
11277 <div id="v1">bar</div>
11278
11279 !!end
11280
11281 !! test
11282 Templates: HTML Tag: 9. Multiple template-generated attributes
11283 !! wikitext
11284 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11285 !! html
11286 <div id="v1" title="foo">bar</div>
11287
11288 !!end
11289
11290 !! test
11291 Templates: Support for templates generating attributes and content
11292 !! wikitext
11293 {| {{mixed_attr_content_template}}
11294 |-
11295 |bar
11296 |}
11297 !! html/php
11298 <table style="color:red;" title="T48811">
11299
11300 <tr>
11301 <td>foo
11302 </td></tr>
11303 <tr>
11304 <td>bar
11305 </td></tr></table>
11306
11307 !! html/parsoid
11308 <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|}"]}'>
11309 <tbody><tr>
11310 <td>foo</td></tr>
11311 <tr>
11312 <td>bar</td></tr>
11313 </tbody></table>
11314 !!end
11315
11316 !! test
11317 1. Entities and nowikis inside templated attributes should be handled correctly
11318 !! wikitext
11319 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11320 !! html/php
11321 <div style="background:#f9f9f9;">foo</div>
11322
11323 !! html/parsoid
11324 <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>
11325 !! end
11326
11327 !! test
11328 2. Entities and nowikis inside templated attributes should be handled correctly
11329 !! wikitext
11330 {|
11331 |{{table_attribs_3}}
11332 |}
11333 !! html/php
11334 <table>
11335 <tr>
11336 <td style="background:#f9f9f9;">Foo
11337 </td></tr></table>
11338
11339 !! html/parsoid
11340 <table>
11341 <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>
11342 </tbody></table>
11343 !! end
11344
11345 !! test
11346 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11347 !! wikitext
11348 {{tbl-start}}
11349 |{{table_attribs_3}}
11350 {{tbl-end}}
11351 !! html/php
11352 <table>
11353 <tr>
11354 <td style="background:#f9f9f9;">Foo
11355 </td></tr></table>
11356
11357 !! html/parsoid
11358 <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}}]}'>
11359 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11360 </tbody></table>
11361 !! end
11362
11363 # T107622
11364 !! test
11365 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11366 !! wikitext
11367 {|
11368 | {{table_attribs_6}} hi
11369 |}
11370 !! html/php
11371 <table>
11372 <tr>
11373 <td style="background: red;"> hi
11374 </td></tr></table>
11375
11376 !! html/parsoid
11377 <table>
11378 <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>
11379 </tbody></table>
11380 !! end
11381
11382 !!test
11383 Templates: HTML Tables: 1. Generating start of a HTML table
11384 !! wikitext
11385 {{echo|<table><tr><td>foo</td>}}</tr></table>
11386 !! html
11387 <table><tr><td>foo</td></tr></table>
11388
11389 !!end
11390
11391 !!test
11392 Templates: HTML Tables: 2a. Generating middle of a HTML table
11393 !! wikitext
11394 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11395 !! html
11396 <table><tr><td>foo</td></tr></table>
11397
11398 !!end
11399
11400 !!test
11401 Templates: HTML Tables: 2b. Generating middle of a HTML table
11402 !! wikitext
11403 <table>{{echo|<tr><td>foo</td></tr>}}</table>
11404 !! html
11405 <table><tr><td>foo</td></tr></table>
11406
11407 !!end
11408
11409 !!test
11410 Templates: HTML Tables: 3. Generating end of a HTML table
11411 !! wikitext
11412 <table><tr>{{echo|<td>foo</td></tr></table>}}
11413 !! html
11414 <table><tr><td>foo</td></tr></table>
11415
11416 !!end
11417
11418 !!test
11419 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
11420 !! wikitext
11421 {{echo|<table>}}<tr><td>foo</td></tr></table>
11422 !! html
11423 <table><tr><td>foo</td></tr></table>
11424
11425 !!end
11426
11427 !!test
11428 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
11429 !! wikitext
11430 <table>{{echo|<tr>}}<td>foo</td></tr></table>
11431 !! html
11432 <table><tr><td>foo</td></tr></table>
11433
11434 !!end
11435
11436 !!test
11437 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
11438 !! wikitext
11439 <table><tr>{{echo|<td>}}foo</td></tr></table>
11440 !! html
11441 <table><tr><td>foo</td></tr></table>
11442
11443 !!end
11444
11445 !!test
11446 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
11447 !! wikitext
11448 <table><tr><td>foo{{echo|</td>}}</tr></table>
11449 !! html
11450 <table><tr><td>foo</td></tr></table>
11451
11452 !!end
11453
11454 !!test
11455 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
11456 !! wikitext
11457 <table><tr><td>foo</td>{{echo|</tr>}}</table>
11458 !! html
11459 <table><tr><td>foo</td></tr></table>
11460
11461 !!end
11462
11463 !!test
11464 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
11465 !! wikitext
11466 <table><tr><td>foo</td></tr>{{echo|</table>}}
11467 !! html
11468 <table><tr><td>foo</td></tr></table>
11469
11470 !!end
11471
11472 !!test
11473 Templates: HTML Tables: 5. Proper fostering of categories from inside
11474 !!options
11475 parsoid=wt2html,wt2wt
11476 !! wikitext
11477 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
11478 <!--Two categories (Bug 50330)-->
11479 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
11480 !! html
11481 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
11482 <!--Two categories (Bug 50330)-->
11483 <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>
11484 !!end
11485
11486 !!test
11487 Templates: Wiki Tables: 1a. Fostering of entire template content
11488 !! wikitext
11489 {|
11490 {{echo|a}}
11491 |}
11492 !! html
11493 <table>
11494 a
11495 <tr><td></td></tr></table>
11496
11497 !! html+tidy
11498 <p>a</p>
11499 <table>
11500 <tr>
11501 <td></td>
11502 </tr>
11503 </table>
11504 !! end
11505
11506 !!test
11507 Templates: Wiki Tables: 1b. Fostering of entire template content
11508 !! wikitext
11509 {|
11510 {{echo|<div>}}
11511 foo
11512 {{echo|</div>}}
11513 |}
11514 !! html
11515 <table>
11516 <div>
11517 <p>foo
11518 </p>
11519 </div>
11520 <tr><td></td></tr></table>
11521
11522 !! html+tidy
11523 <div>
11524 <p>foo</p>
11525 </div>
11526 <table>
11527 <tr>
11528 <td></td>
11529 </tr>
11530 </table>
11531 !! end
11532
11533 !!test
11534 Templates: Wiki Tables: 2. Fostering of partial template content
11535 !! wikitext
11536 {|
11537 {{echo|a
11538 <div>b</div>}}
11539 |}
11540 !! html
11541 <table>
11542 a
11543 <div>b</div>
11544 <tr><td></td></tr></table>
11545
11546 !! html+tidy
11547 <p>a</p>
11548 <div>b</div>
11549 <table>
11550 <tr>
11551 <td></td>
11552 </tr>
11553 </table>
11554 !! end
11555
11556 !!test
11557 Templates: Wiki Tables: 3. td-content via multiple templates
11558 !! wikitext
11559 {|
11560 {{echo|{{pipe}}a}}{{echo|b}}
11561 |}
11562 !! html
11563 <table>
11564 <tr>
11565 <td>ab
11566 </td></tr></table>
11567
11568 !!end
11569
11570 !!test
11571 Templates: Wiki Tables: 4. Templated tags, no content
11572 !! wikitext
11573 {{tbl-start}}
11574 {{tbl-end}}
11575 !! html
11576 <table>
11577 <tr><td></td></tr></table>
11578
11579 !!end
11580
11581 !!test
11582 Templates: Wiki Tables: 5. Templated tags, regular td-tags
11583 !! wikitext
11584 {{tbl-start}}
11585 |foo
11586 {{tbl-end}}
11587 !! html
11588 <table>
11589 <tr>
11590 <td>foo
11591 </td></tr></table>
11592
11593 !!end
11594
11595 !!test
11596 Templates: Wiki Tables: 6. Templated tags, templated td-tags
11597 !! wikitext
11598 {{tbl-start}}
11599 {{!}}foo
11600 {{tbl-end}}
11601 !! html
11602 <table>
11603 <tr>
11604 <td>foo
11605 </td></tr></table>
11606
11607 !!end
11608
11609 ## This test case is very specific to Parsoid's internals
11610 ## and is hence only tested for Parsoid's code. Parsoid uses
11611 ## a <meta> marker tag for <ref> tags and they are expanded
11612 ## much later. We are verifying that this <meta> tag usage
11613 ## doesn't prevent foster parenting.
11614 !!test
11615 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
11616 !!wikitext
11617 {{PartialTable}}<ref>foo</ref>
11618 |}
11619
11620 <references />
11621 !!html/parsoid
11622 <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">
11623 <tbody>
11624 </tbody></table>
11625
11626 <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>
11627 !!end
11628
11629 !! test
11630 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
11631 !! wikitext
11632 {{echo|
11633 {{{!}}
11634 {{!}}-}}
11635 <onlyinclude>
11636 |foo
11637 </onlyinclude>
11638 {{!}}}
11639 !! html/parsoid
11640 <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{{!}}}"]}'>
11641 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
11642 <tbody><tr>
11643
11644 <td>foo
11645 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
11646 </tbody></table>
11647 !! end
11648
11649 !!test
11650 Templates: Lists: Multi-line list-items via templates
11651 !! wikitext
11652 *{{echo|a {{nonexistent|
11653 unused}}}}
11654 *{{echo|b {{nonexistent|
11655 unused}}}}
11656 !! html
11657 <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>
11658 <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>
11659
11660 !!end
11661
11662 !!test
11663 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
11664 !! wikitext
11665 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
11666 !! html
11667 <p><i>ab</i>c<i>d</i>e
11668 </p>
11669 !!end
11670
11671 !!test
11672 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
11673 (PHP parser generates misnested html)
11674 !! wikitext
11675 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
11676 !! html/parsoid
11677 <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>
11678 !!end
11679
11680 !!test
11681 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
11682 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
11683 !! options
11684 parsoid=wt2html,wt2wt
11685 !! wikitext
11686 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
11687 !! html
11688 <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>
11689 <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>
11690 <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>
11691 !!end
11692
11693 !!test
11694 Templates: Ugly nesting: 4. Divs opened/closed across templates
11695 !! wikitext
11696 a<div>b{{echo|c</div>d}}e
11697 !! html
11698 a<div>bc</div>de
11699
11700 !! html+tidy
11701 <p>a</p>
11702 <div>bc</div>
11703 <p>de</p>
11704 !! end
11705
11706 !!test
11707 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
11708 (Parsoid-centric)
11709 !! options
11710 parsoid
11711 !! wikitext
11712 {|
11713 |{{echo|foo</table>}}
11714 |bar
11715 |}
11716 !! html
11717 <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|}"]}'>
11718
11719 <tbody>
11720 <tr>
11721 <td>foo</td></tr></tbody></table><span about="#mwt1">
11722 </span><span about="#mwt1">|bar</span><span about="#mwt1">
11723 |}</span>
11724 !!end
11725
11726 !!test
11727 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
11728 (Parsoid-centric)
11729 !! options
11730 parsoid
11731 !! wikitext
11732 <table>
11733 <tr>
11734 <td>
11735 <table>
11736 <tr>
11737 <td>1. {{echo|foo </table>}}</td>
11738 <td> bar </td>
11739 <td>2. {{echo|baz </table>}}</td>
11740 </tr>
11741 <tr>
11742 <td>abc</td>
11743 </tr>
11744 </table>
11745 </td>
11746 </tr>
11747 <tr>
11748 <td>xyz</td>
11749 </tr>
11750 </table>
11751 !! html
11752 <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>"]}'>
11753 <tbody><tr>
11754 <td>
11755 <table>
11756 <tbody><tr>
11757 <td>1. foo </td></tr></tbody></table></td>
11758 <td> bar </td>
11759 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
11760 </span><span about="#mwt2">
11761 </span><span about="#mwt2">
11762 </span><span about="#mwt2">abc</span><span about="#mwt2">
11763 </span><span about="#mwt2">
11764 </span><span about="#mwt2">
11765 </span><span about="#mwt2">
11766 </span><span about="#mwt2">
11767 </span><span about="#mwt2">
11768 </span><span about="#mwt2">xyz</span><span about="#mwt2">
11769 </span><span about="#mwt2">
11770 </span>
11771 !!end
11772
11773 !! test
11774 Templates: Ugly templates: 3. newline-only template parameter
11775 !! wikitext
11776 foo {{echo|
11777 }}
11778 !! html
11779 <p>foo
11780 </p>
11781 !! end
11782
11783 # This looks like a bug: a single newline triggers p/br for some reason.
11784 !! test
11785 Templates: Ugly templates: 4. newline-only template parameter inconsistency
11786 !! wikitext
11787 {{echo|
11788 }}
11789 !! html
11790 <p><br />
11791 </p>
11792 !! end
11793
11794 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
11795 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
11796 !! test
11797 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
11798 !! wikitext
11799 {{echo|<table>}}
11800 {{echo|<div>foo}}
11801 {{echo|</table>}}
11802 !! html/parsoid
11803 <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
11804 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11805 </table>
11806 !! end
11807
11808 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
11809 # that are "identical" and generate nesting cycles in the algorithm
11810 !! test
11811 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
11812 !! wikitext
11813 {{echo|<table><tr><td><table>}}
11814 {{echo|<div>}}
11815 {{echo|</div>}}
11816 !! html/parsoid
11817 <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"}'>
11818 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11819 </table></td></tr></tbody></table>
11820 !! end
11821
11822 !!test
11823 Parser Functions: 1. Simple example
11824 !! wikitext
11825 {{uc:foo}}
11826 !! html
11827 <p>FOO
11828 </p>
11829 !!end
11830
11831 !!test
11832 Parser Functions: 2. Nested use (only outermost should be marked up)
11833 !! wikitext
11834 {{uc:{{lc:FOO}}}}
11835 !! html
11836 <p>FOO
11837 </p>
11838 !!end
11839
11840 ###
11841 ### Pre-save transform tests
11842 ###
11843 !! test
11844 pre-save transform: subst:
11845 !! options
11846 pst
11847 !! wikitext
11848 {{subst:test}}
11849 !! html/php
11850 This is a test template
11851 !! end
11852
11853 !! test
11854 pre-save transform: normal template
11855 !! options
11856 pst
11857 !! wikitext
11858 {{test}}
11859 !! html/php
11860 {{test}}
11861 !! end
11862
11863 !! test
11864 pre-save transform: nonexistent template
11865 !! options
11866 pst
11867 !! wikitext
11868 {{thistemplatedoesnotexist}}
11869 !! html/php
11870 {{thistemplatedoesnotexist}}
11871 !! end
11872
11873 !! test
11874 pre-save transform: subst magic variables
11875 !! options
11876 pst
11877 !! wikitext
11878 {{subst:SITENAME}}
11879 !! html/php
11880 MediaWiki
11881 !! end
11882
11883 # This is bug 89, which I fixed. -- wtm
11884 !! test
11885 pre-save transform: subst: templates with parameters
11886 !! options
11887 pst
11888 !! wikitext
11889 {{subst:paramtest|param="something else"}}
11890 !! html/php
11891 This is a test template with parameter "something else"
11892 !! end
11893
11894 !! article
11895 Template:nowikitest
11896 !! text
11897 <nowiki>'''not wiki'''</nowiki>
11898 !! endarticle
11899
11900 !! test
11901 pre-save transform: nowiki in subst (bug 1188)
11902 !! options
11903 pst
11904 !! wikitext
11905 {{subst:nowikitest}}
11906 !! html/php
11907 <nowiki>'''not wiki'''</nowiki>
11908 !! end
11909
11910 !! article
11911 Template:commenttest
11912 !! text
11913 This template has <!-- a comment --> in it.
11914 !! endarticle
11915
11916 !! test
11917 pre-save transform: comment in subst (bug 1936)
11918 !! options
11919 pst
11920 !! wikitext
11921 {{subst:commenttest}}
11922 !! html/php
11923 This template has <!-- a comment --> in it.
11924 !! end
11925
11926 !! test
11927 pre-save transform: unclosed tag
11928 !! options
11929 pst noxml
11930 !! wikitext
11931 <nowiki>'''not wiki'''
11932 !! html/php
11933 <nowiki>'''not wiki'''
11934 !! end
11935
11936 !! test
11937 pre-save transform: mixed tag case
11938 !! options
11939 pst noxml
11940 !! wikitext
11941 <NOwiki>'''not wiki'''</noWIKI>
11942 !! html/php
11943 <NOwiki>'''not wiki'''</noWIKI>
11944 !! end
11945
11946 !! test
11947 pre-save transform: unclosed comment in <nowiki>
11948 !! options
11949 pst noxml
11950 !! wikitext
11951 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
11952 !! html/php
11953 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
11954 !!end
11955
11956 # Leading @ in this template definition works around a limitation
11957 # in parsoid's parserTests which otherwise strips the <span> from the
11958 # result (confusing it for a template wrapper)
11959 !! article
11960 Template:dangerous
11961 !!text
11962 @<span onmouseover="alert('crap')">Oh no</span>
11963 !!endarticle
11964
11965 !!test
11966 (confirming safety of fix for subst bug 1936)
11967 !! wikitext
11968 {{Template:dangerous}}
11969 !! html
11970 <p>@<span>Oh no</span>
11971 </p>
11972 !! end
11973
11974 !! test
11975 pre-save transform: comment containing gallery (bug 5024)
11976 !! options
11977 pst
11978 !! wikitext
11979 <!-- <gallery>data</gallery> -->
11980 !! html/php
11981 <!-- <gallery>data</gallery> -->
11982 !!end
11983
11984 !! test
11985 pre-save transform: comment containing extension
11986 !! options
11987 pst
11988 !! wikitext
11989 <!-- <tag>data</tag> -->
11990 !! html/php
11991 <!-- <tag>data</tag> -->
11992 !!end
11993
11994 !! test
11995 pre-save transform: comment containing nowiki
11996 !! options
11997 pst
11998 !! wikitext
11999 <!-- <nowiki>data</nowiki> -->
12000 !! html/php
12001 <!-- <nowiki>data</nowiki> -->
12002 !!end
12003
12004 !! test
12005 pre-save transform: <noinclude> in subst (bug 3298)
12006 !! options
12007 pst
12008 !! wikitext
12009 {{subst:Includes}}
12010 !! html/php
12011 Foobar
12012 !! end
12013
12014 !! test
12015 pre-save transform: <onlyinclude> in subst (bug 3298)
12016 !! options
12017 pst
12018 !! wikitext
12019 {{subst:Includes2}}
12020 !! html/php
12021 Foo
12022 !! end
12023
12024 !! article
12025 Template:SubstTest
12026 !!text
12027 {{<includeonly>subst:</includeonly>Includes}}
12028 !! endarticle
12029
12030 !! article
12031 Template:SafeSubstTest
12032 !! text
12033 {{<includeonly>safesubst:</includeonly>Includes}}
12034 !! endarticle
12035
12036 !! test
12037 bug 22297: safesubst: works during PST
12038 !! options
12039 pst
12040 !! wikitext
12041 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12042 !! html/php
12043 FoobarFoobar
12044 !! end
12045
12046 !! test
12047 bug 22297: safesubst: works during normal parse
12048 !! wikitext
12049 {{SafeSubstTest}}
12050 !! html
12051 <p>Foobar
12052 </p>
12053 !! end
12054
12055 !! test
12056 subst: does not work during normal parse
12057 !! wikitext
12058 {{SubstTest}}
12059 !! html
12060 <p>{{subst:Includes}}
12061 </p>
12062 !! end
12063
12064 !! test
12065 pre-save transform: context links ("pipe trick")
12066 !! options
12067 pst
12068 !! wikitext
12069 [[Article (context)|]]
12070 [[Bar:Article|]]
12071 [[:Bar:Article|]]
12072 [[Bar:Article (context)|]]
12073 [[:Bar:Article (context)|]]
12074 [[|Article]]
12075 [[|Article (context)]]
12076 [[Bar:X (Y) Z|]]
12077 [[:Bar:X (Y) Z|]]
12078 !! html/php
12079 [[Article (context)|Article]]
12080 [[Bar:Article|Article]]
12081 [[:Bar:Article|Article]]
12082 [[Bar:Article (context)|Article]]
12083 [[:Bar:Article (context)|Article]]
12084 [[Article]]
12085 [[Article (context)]]
12086 [[Bar:X (Y) Z|X (Y) Z]]
12087 [[:Bar:X (Y) Z|X (Y) Z]]
12088 !! end
12089
12090 !! test
12091 pre-save transform: context links ("pipe trick") with interwiki prefix
12092 !! options
12093 pst
12094 !! wikitext
12095 [[interwiki:Article|]]
12096 [[:interwiki:Article|]]
12097 [[interwiki:Bar:Article|]]
12098 [[:interwiki:Bar:Article|]]
12099 !! html/php
12100 [[interwiki:Article|Article]]
12101 [[:interwiki:Article|Article]]
12102 [[interwiki:Bar:Article|Bar:Article]]
12103 [[:interwiki:Bar:Article|Bar:Article]]
12104 !! end
12105
12106 !! test
12107 pre-save transform: context links ("pipe trick") with parens in title
12108 !! options
12109 pst title=[[Somearticle (context)]]
12110 !! wikitext
12111 [[|Article]]
12112 !! html/php
12113 [[Article (context)|Article]]
12114 !! end
12115
12116 !! test
12117 pre-save transform: context links ("pipe trick") with comma in title
12118 !! options
12119 pst title=[[Someplace, Somewhere]]
12120 !! wikitext
12121 [[|Otherplace]]
12122 [[Otherplace, Elsewhere|]]
12123 [[Otherplace, Elsewhere, Anywhere|]]
12124 !! html/php
12125 [[Otherplace, Somewhere|Otherplace]]
12126 [[Otherplace, Elsewhere|Otherplace]]
12127 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12128 !! end
12129
12130 !! test
12131 pre-save transform: context links ("pipe trick") with parens and comma
12132 !! options
12133 pst title=[[Someplace (IGNORED), Somewhere]]
12134 !! wikitext
12135 [[|Otherplace]]
12136 [[Otherplace (place), Elsewhere|]]
12137 !! html/php
12138 [[Otherplace, Somewhere|Otherplace]]
12139 [[Otherplace (place), Elsewhere|Otherplace]]
12140 !! end
12141
12142 !! test
12143 pre-save transform: context links ("pipe trick") with comma and parens
12144 !! options
12145 pst title=[[Who, me? (context)]]
12146 !! wikitext
12147 [[|Yes, you.]]
12148 [[Me, Myself, and I (1937 song)|]]
12149 !! html/php
12150 [[Yes, you. (context)|Yes, you.]]
12151 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12152 !! end
12153
12154 !! test
12155 pre-save transform: context links ("pipe trick") with namespace
12156 !! options
12157 pst title=[[Ns:Somearticle]]
12158 !! wikitext
12159 [[|Article]]
12160 !! html/php
12161 [[Ns:Article|Article]]
12162 !! end
12163
12164 !! test
12165 pre-save transform: context links ("pipe trick") with namespace and parens
12166 !! options
12167 pst title=[[Ns:Somearticle (context)]]
12168 !! wikitext
12169 [[|Article]]
12170 !! html/php
12171 [[Ns:Article (context)|Article]]
12172 !! end
12173
12174 !! test
12175 pre-save transform: context links ("pipe trick") with namespace and comma
12176 !! options
12177 pst title=[[Ns:Somearticle, Context, Whatever]]
12178 !! wikitext
12179 [[|Article]]
12180 !! html/php
12181 [[Ns:Article, Context, Whatever|Article]]
12182 !! end
12183
12184 !! test
12185 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12186 !! options
12187 pst title=[[Ns:Somearticle, Context (context)]]
12188 !! wikitext
12189 [[|Article]]
12190 !! html/php
12191 [[Ns:Article (context)|Article]]
12192 !! end
12193
12194 !! test
12195 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12196 !! options
12197 pst title=[[Ns:Somearticle (IGNORED), Context]]
12198 !! wikitext
12199 [[|Article]]
12200 !! html/php
12201 [[Ns:Article, Context|Article]]
12202 !! end
12203
12204 !! test
12205 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12206 !! options
12207 pst
12208 !! wikitext
12209 [[Article(context)|]]
12210 [[Bar:Article(context)|]]
12211 [[:Bar:Article(context)|]]
12212 [[|Article(context)]]
12213 [[Bar:X(Y)Z|]]
12214 [[:Bar:X(Y)Z|]]
12215 !! html/php
12216 [[Article(context)|Article]]
12217 [[Bar:Article(context)|Article]]
12218 [[:Bar:Article(context)|Article]]
12219 [[Article(context)]]
12220 [[Bar:X(Y)Z|X(Y)Z]]
12221 [[:Bar:X(Y)Z|X(Y)Z]]
12222 !! end
12223
12224 !! test
12225 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12226 !! options
12227 pst
12228 !! wikitext
12229 [[Article (context)|]]
12230 [[Bar:Article (context)|]]
12231 [[:Bar:Article (context)|]]
12232 [[|Article (context)]]
12233 [[Bar:X (Y) Z|]]
12234 [[:Bar:X (Y) Z|]]
12235 !! html/php
12236 [[Article (context)|Article]]
12237 [[Bar:Article (context)|Article]]
12238 [[:Bar:Article (context)|Article]]
12239 [[Article (context)]]
12240 [[Bar:X (Y) Z|X (Y) Z]]
12241 [[:Bar:X (Y) Z|X (Y) Z]]
12242 !! end
12243
12244 !! test
12245 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12246 !! options
12247 pst
12248 !! wikitext
12249 [[Article(context)|]]
12250 [[Bar:Article(context)|]]
12251 [[:Bar:Article(context)|]]
12252 [[|Article(context)]]
12253 [[Bar:X(Y)Z|]]
12254 [[:Bar:X(Y)Z|]]
12255 !! html/php
12256 [[Article(context)|Article]]
12257 [[Bar:Article(context)|Article]]
12258 [[:Bar:Article(context)|Article]]
12259 [[Article(context)]]
12260 [[Bar:X(Y)Z|X(Y)Z]]
12261 [[:Bar:X(Y)Z|X(Y)Z]]
12262 !! end
12263
12264 !! test
12265 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12266 !! options
12267 pst
12268 !! wikitext
12269 [[Article (context), context|]]
12270 [[Article (context),context|]]
12271 [[Bar:Article (context), context|]]
12272 [[Bar:Article (context),context|]]
12273 [[:Bar:Article (context), context|]]
12274 [[:Bar:Article (context),context|]]
12275 !! html/php
12276 [[Article (context), context|Article]]
12277 [[Article (context),context|Article]]
12278 [[Bar:Article (context), context|Article]]
12279 [[Bar:Article (context),context|Article]]
12280 [[:Bar:Article (context), context|Article]]
12281 [[:Bar:Article (context),context|Article]]
12282 !! end
12283
12284 !! test
12285 pre-save transform: trim trailing empty lines
12286 !! options
12287 pst
12288 !! wikitext
12289 Empty lines are trimmed
12290
12291
12292
12293
12294 !! html/php
12295 Empty lines are trimmed
12296 !! end
12297
12298 !! test
12299 pre-save transform: Signature expansion
12300 !! options
12301 pst
12302 !! wikitext
12303 * ~~~
12304 * <noinclude>~~~</noinclude>
12305 * <includeonly>~~~</includeonly>
12306 * <onlyinclude>~~~</onlyinclude>
12307 !! html/php
12308 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12309 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12310 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12311 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12312 !! end
12313
12314
12315 !! test
12316 pre-save transform: Signature expansion in nowiki tags (bug 93)
12317 !! options
12318 pst disabled
12319 !! wikitext
12320 Shall not expand:
12321
12322 <nowiki>~~~~</nowiki>
12323
12324 <includeonly><nowiki>~~~~</nowiki></includeonly>
12325
12326 <noinclude><nowiki>~~~~</nowiki></noinclude>
12327
12328 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12329
12330 {{subst:Foo}} shall be converted to FOO
12331
12332 As well as inside noinclude/onlyinclude
12333 <noinclude>{{subst:Foo}}</noinclude>
12334 <onlyinclude>{{subst:Foo}}</onlyinclude>
12335
12336 But not inside includeonly
12337 <includeonly>{{subst:Foo}}</includeonly>
12338 !! html/php
12339 Shall not expand:
12340
12341 <nowiki>~~~~</nowiki>
12342
12343 <includeonly><nowiki>~~~~</nowiki></includeonly>
12344
12345 <noinclude><nowiki>~~~~</nowiki></noinclude>
12346
12347 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12348
12349 FOO shall be converted to FOO
12350
12351 As well as inside noinclude/onlyinclude
12352 <noinclude>FOO</noinclude>
12353 <onlyinclude>FOO</onlyinclude>
12354
12355 But not inside includeonly
12356 <includeonly>{{subst:Foo}}</includeonly>
12357 !! end
12358
12359 !! test
12360 Parsoid: Recognize nowiki with trailing space in tags
12361 !! options
12362 parsoid=wt2html
12363 !! wikitext
12364 <nowiki ><div>[[foo]]</nowiki >
12365
12366 a<nowiki / >b
12367
12368 c<nowiki />d
12369
12370 e<nowiki/ >f
12371 !! html
12372 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12373 <p>ab</p>
12374 <p>cd</p>
12375 <p>ef</p>
12376 !! end
12377
12378 !! test
12379 Parsoid: Recognize nowiki with odd capitalization
12380 !! options
12381 parsoid=wt2html
12382 !! wikitext
12383 <noWikI ><div>[[foo]]</Nowiki >
12384 !! html
12385 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12386 !! end
12387
12388
12389 !! test
12390 Parsoid: Escape nowiki with trailing space in tags
12391 !! options
12392 parsoid=html2wt
12393 !! html/parsoid
12394 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12395 <p>a&lt;nowiki /&gt;b</p>
12396 <p>c&lt;nowiki/ &gt;d</p>
12397 !! wikitext
12398 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12399
12400 a&lt;nowiki /&gt;b
12401
12402 c&lt;nowiki/ &gt;d
12403 !! end
12404
12405 !! test
12406 Parsoid: Escape weird noWikI capitalizations
12407 !! options
12408 parsoid=html2wt
12409 !! html/parsoid
12410 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
12411 !! wikitext
12412 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
12413 !! end
12414
12415 ###
12416 ### Message transform tests
12417 ###
12418 !! test
12419 message transform: magic variables
12420 !! options
12421 msg
12422 !! wikitext
12423 {{SITENAME}}
12424 !! html
12425 MediaWiki
12426 !! end
12427
12428 !! test
12429 message transform: should not transform wiki markup
12430 !! options
12431 msg
12432 !! wikitext
12433 ''test''
12434 !! html
12435 ''test''
12436 !! end
12437
12438 !! test
12439 message transform: <noinclude> in transcluded template (bug 4926)
12440 !! options
12441 msg
12442 !! wikitext
12443 {{Includes}}
12444 !! html
12445 Foobar
12446 !! end
12447
12448 !! test
12449 message transform: <onlyinclude> in transcluded template (bug 4926)
12450 !! options
12451 msg
12452 !! wikitext
12453 {{Includes2}}
12454 !! html
12455 Foo
12456 !! end
12457
12458 !! test
12459 {{#special:}} page name, known
12460 !! options
12461 msg
12462 !! wikitext
12463 {{#special:Recentchanges}}
12464 !! html
12465 Special:RecentChanges
12466 !! end
12467
12468 !! test
12469 {{#special:}} page name with subpage, known
12470 !! options
12471 msg
12472 !! wikitext
12473 {{#special:Recentchanges/param}}
12474 !! html
12475 Special:RecentChanges/param
12476 !! end
12477
12478 !! test
12479 {{#special:}} page name, unknown
12480 !! options
12481 msg
12482 !! wikitext
12483 {{#special:foobar nonexistent}}
12484 !! html
12485 Special:Foobar nonexistent
12486 !! end
12487
12488 !! test
12489 {{#speciale:}} page name, known
12490 !! options
12491 msg
12492 !! wikitext
12493 {{#speciale:Recentchanges}}
12494 !! html
12495 Special:RecentChanges
12496 !! end
12497
12498 !! test
12499 {{#speciale:}} page name with subpage, known
12500 !! options
12501 msg
12502 !! wikitext
12503 {{#speciale:Recentchanges/param}}
12504 !! html
12505 Special:RecentChanges/param
12506 !! end
12507
12508 !! test
12509 {{#speciale:}} page name, unknown
12510 !! options
12511 msg
12512 !! wikitext
12513 {{#speciale:foobar nonexistent}}
12514 !! html
12515 Special:Foobar_nonexistent
12516 !! end
12517
12518 ###
12519 ### Images
12520 ###
12521 ### For Parsoid-specific tests, see
12522 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12523
12524 !! test
12525 Simple image
12526 !! options
12527 parsoid=wt2html,wt2wt,html2html
12528 !! wikitext
12529 [[Image:foobar.jpg]]
12530 !! html/php
12531 <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>
12532 </p>
12533 !! html/parsoid
12534 <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>
12535 !! end
12536
12537 !! test
12538 Simple image (using File: namespace, now canonical)
12539 !! wikitext
12540 [[File:Foobar.jpg]]
12541 !! html/php
12542 <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>
12543 </p>
12544 !! html/parsoid
12545 <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>
12546 !! end
12547
12548 !! test
12549 Right-aligned image
12550 !! wikitext
12551 [[File:Foobar.jpg|right]]
12552 !! html/php
12553 <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>
12554
12555 !! html/parsoid
12556 <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>
12557 !! end
12558
12559 !! test
12560 Image with caption
12561 !! wikitext
12562 [[File:Foobar.jpg|right|Caption text]]
12563 !! html/php
12564 <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>
12565
12566 !! html/parsoid
12567 <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>
12568 !! end
12569
12570 !! test
12571 Image with caption, bug 53312 #1
12572 !! wikitext
12573 [[File:Foobar.jpg|right|Caption page stuff]]
12574 !! html/php
12575 <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>
12576
12577 !! html/parsoid
12578 <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>
12579 !! end
12580
12581 !! test
12582 Image with caption, bug 53312 #2
12583 !! wikitext
12584 [[File:Foobar.jpg|right|Caption page=]]
12585 !! html/php
12586 <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>
12587
12588 !! html/parsoid
12589 <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>
12590 !! end
12591
12592 !! test
12593 Image with caption, bug 53312 #3
12594 !! wikitext
12595 [[File:Foobar.jpg|right|Caption page=stuff]]
12596 !! html/php
12597 <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>
12598
12599 !! html/parsoid
12600 <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>
12601 !! end
12602
12603 !! test
12604 Allow empty links in image captions (Bug 60753)
12605 !! options
12606 thumbsize=220
12607 !! wikitext
12608 [[File:Foobar.jpg|thumb|Caption [[Link1]]
12609 [[]]
12610 [[Link2]]
12611 ]]
12612 !! html/php
12613 <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>
12614
12615 !! html/parsoid
12616 <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>
12617 [[]]
12618 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
12619 </figcaption></figure>
12620 !! end
12621
12622 !! test
12623 Titles in unlinked images (T23454)
12624 !! wikitext
12625 [[File:Foobar.jpg|link=|stuff]]
12626 !! html/php
12627 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
12628 </p>
12629 !! end
12630
12631 !! test
12632 Link with empty target
12633 !! wikitext
12634 [[]]
12635 !! html
12636 <p>[[]]
12637 </p>
12638 !! end
12639
12640 !! test
12641 Image with link trail
12642 !! wikitext
12643 Linktrails should not work for images: [[File:Foobar.jpg]]s
12644 !! html/php
12645 <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
12646 </p>
12647 !! html/parsoid
12648 <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>
12649 !! end
12650
12651 !! test
12652 Image with empty attribute
12653 !! options
12654 parsoid=wt2html,wt2wt,html2html
12655 !! wikitext
12656 [[File:Foobar.jpg|right||Caption text]]
12657 !! html/php
12658 <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>
12659
12660 !! html/parsoid
12661 <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>
12662 !! end
12663
12664 !! test
12665 1. Block image with individual attributes from templates
12666 !! wikitext
12667 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
12668 !! html/php
12669 <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>
12670
12671 !! html/parsoid
12672 <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>
12673 !! end
12674
12675 !! test
12676 2. Block Image with individual attributes from templates
12677 !! wikitext
12678 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
12679 !! html/php
12680 <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>
12681
12682 !! html/parsoid
12683 <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>
12684 !! end
12685
12686 !! test
12687 3. Inline image with individual attributes from templates
12688 !! wikitext
12689 [[File:Foobar.jpg|{{echo|50px}}]]
12690 !! html/php
12691 <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>
12692 </p>
12693 !! html/parsoid
12694 <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>
12695 !! end
12696
12697 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
12698 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
12699 !! test
12700 Image with multiple attributes from the same template
12701 !! wikitext
12702 [[File:Foobar.jpg|{{image_attribs}}]]
12703 !! html/php
12704 <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>
12705
12706 !! html/parsoid
12707 <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>
12708 !! end
12709
12710 !! test
12711 Image with link tails
12712 !! options
12713 thumbsize=220
12714 !! wikitext
12715 123[[File:Foobar.jpg]]456
12716 123[[File:Foobar.jpg|right]]456
12717 123[[File:Foobar.jpg|thumb]]456
12718 !! html/php
12719 <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
12720 </p>
12721 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
12722 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
12723
12724 !! html/php+tidy
12725 <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>
12726 <p>123</p>
12727 <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>
12728 <p>456 123</p>
12729 <div class="thumb tright">
12730 <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>
12731 <div class="thumbcaption">
12732 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
12733 </div>
12734 </div>
12735 </div>
12736 <p>456</p>
12737 !! html/parsoid
12738 <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>
12739 <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>
12740 <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>
12741 !! end
12742
12743 !! test
12744 Image with multiple captions -- only last one is accepted
12745 !! wikitext
12746 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
12747 !! html/php
12748 <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>
12749
12750 !! html/parsoid
12751 <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>
12752 !! end
12753
12754 !! test
12755 Image with multiple widths -- use last
12756 !! wikitext
12757 [[File:Foobar.jpg|200px|300px|caption]]
12758 !! html/php
12759 <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>
12760 </p>
12761 !! html/parsoid
12762 <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>
12763 !! end
12764
12765 !! test
12766 Image with multiple alignments -- use first (bug 48664)
12767 !! options
12768 thumbsize=220
12769 !! wikitext
12770 [[File:Foobar.jpg|thumb|left|right|center|caption]]
12771
12772 [[File:Foobar.jpg|middle|text-top|caption]]
12773 !! html/php
12774 <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>
12775 <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>
12776 </p>
12777 !! html/parsoid
12778 <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>
12779 <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>
12780 !! end
12781
12782 !! test
12783 Image with width attribute at different positions
12784 !! wikitext
12785 [[File:Foobar.jpg|200px|right|Caption]]
12786 [[File:Foobar.jpg|right|200px|Caption]]
12787 [[File:Foobar.jpg|right|Caption|200px]]
12788 !! html/php
12789 <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>
12790 <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>
12791 <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>
12792
12793 !! html/parsoid
12794 <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>
12795 <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>
12796 <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>
12797 !! end
12798
12799 # a sad bit of backward-compatibility
12800 !! test
12801 Image with size specified with pxpx (bug 13500, 51628)
12802 !! options
12803 parsoid=wt2html,wt2wt,html2html
12804 !! wikitext
12805 [[File:Foobar.jpg|20pxpx]]
12806 [[File:Foobar.jpg|200x20pxpx]]
12807 !! html/php
12808 <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>
12809 <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>
12810 </p>
12811 !! html/parsoid
12812 <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>
12813 !! end
12814
12815 !! test
12816 Image with link parameter, wiki target
12817 !! wikitext
12818 [[File:Foobar.jpg|link=Main Page]]
12819 !! html/php
12820 <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>
12821 </p>
12822 !! html/parsoid
12823 <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>
12824 !! end
12825
12826 # parsoid bug 49293 (part 1)
12827 !! test
12828 Image with link parameter, URL target
12829 !! wikitext
12830 [[File:Foobar.jpg|link=http://example.com/]]
12831 !! html/php
12832 <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>
12833 </p>
12834 !! html/parsoid
12835 <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>
12836 !! end
12837
12838 # parsoid bug 49293 (part 2)
12839 !! test
12840 Image with link parameter, protocol-less URL target
12841 !! wikitext
12842 [[File:Foobar.jpg|link=//example.com/]]
12843 !! html/php
12844 <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>
12845 </p>
12846 !! html/parsoid
12847 <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>
12848 !! end
12849
12850 !! test
12851 Escaping non-block captions (T107435)
12852 !! options
12853 parsoid={
12854 "modes": ["wt2wt"],
12855 "changes": [
12856 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
12857 ]
12858 }
12859 !! wikitext
12860 [[Image:Foobar.jpg|caption]]
12861 !! wikitext/edited
12862 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
12863 !! end
12864
12865 !! test
12866 Image with link parameter, wgExternalLinkTarget
12867 !! wikitext
12868 [[Image:foobar.jpg|link=http://example.com/]]
12869 !! config
12870 wgExternalLinkTarget='foobar'
12871 !! html
12872 <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>
12873 </p>
12874 !! end
12875
12876 !! test
12877 Image with link parameter, wgNoFollowLinks set to false
12878 !! wikitext
12879 [[Image:foobar.jpg|link=http://example.com/]]
12880 !! config
12881 wgNoFollowLinks=false
12882 !! html
12883 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12884 </p>
12885 !! end
12886
12887 !! test
12888 Image with link parameter, wgNoFollowDomainExceptions
12889 !! wikitext
12890 [[Image:foobar.jpg|link=http://example.com/]]
12891 !! config
12892 wgNoFollowDomainExceptions='example.com'
12893 !! html
12894 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12895 </p>
12896 !! end
12897
12898 !! test
12899 Image with link parameter, wgExternalLinkTarget, unnamed parameter
12900 !! wikitext
12901 [[Image:foobar.jpg|link=http://example.com/|Title]]
12902 !! config
12903 wgExternalLinkTarget='foobar'
12904 !! html
12905 <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>
12906 </p>
12907 !! end
12908
12909 !! test
12910 Image with empty link parameter
12911 !! wikitext
12912 [[File:Foobar.jpg|link=]]
12913 !! html/php
12914 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
12915 </p>
12916 !! html/parsoid
12917 <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>
12918 !! end
12919
12920 !! test
12921 Image with link parameter (wiki target) and unnamed parameter
12922 !! wikitext
12923 [[File:Foobar.jpg|link=Main_Page|Title]]
12924 !! html/php
12925 <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>
12926 </p>
12927 !! html/parsoid
12928 <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>
12929 !! end
12930
12931 !! test
12932 Image with link parameter (URL target) and unnamed parameter
12933 !! wikitext
12934 [[File:Foobar.jpg|link=http://example.com/|Title]]
12935 !! html/php
12936 <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>
12937 </p>
12938 !! html/parsoid
12939 <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>
12940 !! end
12941
12942 !! test
12943 Thumbnail image with link parameter
12944 !! options
12945 thumbsize=220
12946 parsoid=wt2html,wt2wt,html2html
12947 !! wikitext
12948 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
12949 !! html/php
12950 <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>
12951
12952 !! html/parsoid
12953 <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>
12954 !! end
12955
12956 !! test
12957 Manually-specified thumbnail image
12958 !! options
12959 thumbsize=220
12960 !! wikitext
12961 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
12962 !! html/php
12963 <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>
12964
12965 !! html/parsoid
12966 <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>
12967 !! end
12968
12969 !! test
12970 Manually-specified thumbnail image with explicit link to wiki page
12971 !! options
12972 thumbsize=220
12973 parsoid=wt2html,wt2wt,html2html
12974 !! wikitext
12975 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
12976 !! html/php
12977 <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>
12978
12979 !! html/parsoid
12980 <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>
12981 !! end
12982
12983 !! test
12984 Manually-specified thumbnail image with explicit link to url
12985 !! options
12986 thumbsize=220
12987 parsoid=wt2html,wt2wt,html2html
12988 !! wikitext
12989 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
12990 !! html/php
12991 <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>
12992
12993 !! html/parsoid
12994 <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>
12995 !! end
12996
12997 !! test
12998 Manually-specified thumbnail image with explicit no link
12999 !! options
13000 thumbsize=220
13001 parsoid=wt2html,wt2wt,html2html
13002 !! wikitext
13003 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13004 !! html/php
13005 <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>
13006
13007 !! html/parsoid
13008 <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>
13009 !! end
13010
13011 !! test
13012 Manually-specified thumbnail image with explicit link and alt text
13013 !! options
13014 thumbsize=220
13015 parsoid=wt2html,wt2wt,html2html
13016 !! wikitext
13017 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13018 !! html/php
13019 <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>
13020
13021 !! html/parsoid
13022 <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>
13023 !! end
13024
13025 !! test
13026 Image with frame and link
13027 !! options
13028 parsoid=wt2html,wt2wt,html2html
13029 !! wikitext
13030 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13031 !! html/php
13032 <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>
13033
13034 !! html/parsoid
13035 <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>
13036 !! end
13037
13038 !! test
13039 Image with frame and link and explicit alt
13040 !! options
13041 parsoid=wt2html,wt2wt,html2html
13042 !! wikitext
13043 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13044 !! html/php
13045 <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>
13046
13047 !! html/parsoid
13048 <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>
13049 !! end
13050
13051 !! test
13052 Image with wiki markup in implicit alt
13053 !! wikitext
13054 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13055
13056 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13057 !! html/php
13058 <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>
13059 </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>
13060 </p>
13061 !! html/parsoid
13062 <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>
13063 <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>
13064 !! end
13065
13066 !! test
13067 Alt image option should handle most kinds of wikitext without barfing
13068 !! wikitext
13069 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13070 !! html/php
13071 <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>
13072
13073 !! html/parsoid
13074 <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>
13075 !! end
13076
13077 ###################
13078 # Conflicting image format options.
13079 # First option specified should 'win'.
13080 # All three cases in each test should be identical.
13081
13082 !! test
13083 Image with 'frameless' first.
13084 !! options
13085 parsoid=wt2html,wt2wt,html2html
13086 !! wikitext
13087 [[File:Foobar.jpg|frameless|caption]]
13088
13089 [[File:Foobar.jpg|frameless|frame|caption]]
13090
13091 [[File:Foobar.jpg|frameless|thumb|caption]]
13092 !! html/php
13093 <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>
13094 </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>
13095 </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>
13096 </p>
13097 !! html/parsoid
13098 <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>
13099 <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>
13100 <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>
13101 !! end
13102
13103 !! test
13104 Image with 'frame' first.
13105 !! options
13106 parsoid=wt2html,wt2wt,html2html
13107 !! wikitext
13108 [[File:Foobar.jpg|frame|caption]]
13109 [[File:Foobar.jpg|frame|frameless|caption]]
13110 [[File:Foobar.jpg|frame|thumb|caption]]
13111 !! html/php
13112 <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>
13113 <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>
13114 <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>
13115
13116 !! html/parsoid
13117 <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>
13118 <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>
13119 <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>
13120 !! end
13121
13122 !! test
13123 Image with 'thumb' first.
13124 !! options
13125 parsoid=wt2html,wt2wt,html2html
13126 !! wikitext
13127 [[File:Foobar.jpg|thumb|caption]]
13128 [[File:Foobar.jpg|thumb|frameless|caption]]
13129 [[File:Foobar.jpg|thumb|frame|caption]]
13130 !! html/php
13131 <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>
13132 <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>
13133 <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>
13134
13135 !! html/parsoid
13136 <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>
13137 <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>
13138 <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>
13139 !! end
13140
13141 ###################
13142 # Image sizing.
13143 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13144 # and https://phabricator.wikimedia.org/T64258
13145 # Foobar has actual size of 1941x220
13146 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13147 # a scalable format.
13148 # 2. Framed images always ignore size options; always render at default size.
13149 # 3. "Unspecified format" and border are the only types which can be
13150 # enlarged.
13151
13152 !! test
13153 Image: "unspecified format" and border enlarge
13154 !! options
13155 parsoid=wt2html,wt2wt,html2html
13156 !! wikitext
13157 [[File:Foobar.jpg|2000px]]
13158
13159 [[File:Foobar.jpg|border|2000px]]
13160 !! html/php
13161 <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>
13162 </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>
13163 </p>
13164 !! html/parsoid
13165 <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>
13166 <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>
13167 !! end
13168
13169 !! test
13170 Image: "unspecified format" and border reduce
13171 !! options
13172 parsoid=wt2html,wt2wt,html2html
13173 !! wikitext
13174 [[File:Foobar.jpg|1000px]]
13175
13176 [[File:Foobar.jpg|border|1000px]]
13177 !! html/php
13178 <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>
13179 </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>
13180 </p>
13181 !! html/parsoid
13182 <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>
13183 <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>
13184 !! end
13185
13186 !! test
13187 Image: thumbs reduce
13188 !! options
13189 parsoid=wt2html,wt2wt,html2html
13190 !! wikitext
13191 [[File:Foobar.jpg|thumb|50px]]
13192 !! html/php
13193 <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>
13194
13195 !! html/parsoid
13196 <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>
13197 !! end
13198
13199 !! test
13200 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13201 !! options
13202 parsoid=wt2html,wt2wt,html2html
13203 !! wikitext
13204 [[File:Foobar.jpg|thumb|2000px]]
13205
13206 [[File:Foobar.svg|thumb|2000px]]
13207 !! html/php
13208 <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>
13209 <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>
13210
13211 !! html/parsoid
13212 <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>
13213 <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>
13214 !! end
13215
13216 !! test
13217 Image: frameless can reduce in size
13218 !! options
13219 parsoid=wt2html,wt2wt,html2html
13220 !! wikitext
13221 [[File:Foobar.jpg|frameless|50px]]
13222 !! html/php
13223 <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>
13224 </p>
13225 !! html/parsoid
13226 <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>
13227 !! end
13228
13229 !! test
13230 Image: bitmap frameless can't be enlarged past original size, but vector can
13231 !! options
13232 parsoid=wt2html,wt2wt,html2html
13233 !! wikitext
13234 [[File:Foobar.jpg|frameless|2000px]]
13235
13236 [[File:Foobar.svg|frameless|2000px]]
13237 !! html/php
13238 <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>
13239 </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>
13240 </p>
13241 !! html/parsoid
13242 <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>
13243 <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>
13244 !! end
13245
13246 !! test
13247 Image: framed images are always unscaled.
13248 !! options
13249 parsoid=wt2html,wt2wt,html2html
13250 !! wikitext
13251 [[File:Foobar.jpg|frame]]
13252
13253 [[File:Foobar.jpg|frame|50px]]
13254
13255 [[File:Foobar.jpg|frame|50x50px]]
13256
13257 [[File:Foobar.jpg|frame|2000px]]
13258 !! html/php
13259 <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>
13260 <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>
13261 <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>
13262 <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>
13263
13264 !! html/parsoid
13265 <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>
13266 <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>
13267 <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>
13268 <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>
13269 !! end
13270
13271 ###################
13272
13273 !! test
13274 Link to image page- image page normally doesn't exists, hence edit link
13275 Add test with existing image page
13276 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13277 !! wikitext
13278 [[:Image:test]]
13279 !! html
13280 <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>
13281 </p>
13282 !! end
13283
13284 !! test
13285 bug 18784 Link to non-existent image page with caption should use caption as link text
13286 !! wikitext
13287 [[:Image:test|caption]]
13288 !! html
13289 <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>
13290 </p>
13291 !! end
13292
13293 !! test
13294 Frameless image caption with a free URL
13295 !! wikitext
13296 [[File:Foobar.jpg|http://example.com]]
13297 !! html/php
13298 <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>
13299 </p>
13300 !! html/parsoid
13301 <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>
13302 !! end
13303
13304 !! test
13305 Thumbnail image caption with a free URL
13306 !! options
13307 thumbsize=220
13308 !! wikitext
13309 [[File:Foobar.jpg|thumb|http://example.com]]
13310 !! html/php
13311 <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>
13312
13313 !! html/parsoid
13314 <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>
13315 !! end
13316
13317 !! test
13318 Thumbnail image caption with a free URL and explicit alt
13319 !! options
13320 thumbsize=220
13321 parsoid=wt2html,wt2wt,html2html
13322 !! wikitext
13323 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13324 !! html/php
13325 <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>
13326
13327 !! html/parsoid
13328 <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>
13329 !! end
13330
13331 !! test
13332 SVG thumbnails with no language set
13333 !! options
13334 !! wikitext
13335 [[File:Foobar.svg|thumb|caption]]
13336 !! html/php
13337 <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>
13338
13339 !! html/parsoid
13340 <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>
13341 !! end
13342
13343 !! test
13344 SVG thumbnails with language de
13345 !! options
13346 parsoid=wt2html,wt2wt,html2html
13347 !! wikitext
13348 [[File:Foobar.svg|thumb|caption|lang=de]]
13349 !! html/php
13350 <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>
13351
13352 !! html/parsoid
13353 <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>
13354 !! end
13355
13356 !! test
13357 SVG thumbnails with invalid language code
13358 !! options
13359 parsoid=wt2html,wt2wt,html2html
13360 !! wikitext
13361 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
13362 !! html/php
13363 <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>
13364
13365 !! html/parsoid
13366 <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>
13367 !! end
13368
13369 !! test
13370 BUG 1887: A ISBN with a thumbnail
13371 !! wikitext
13372 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
13373 !! html/php
13374 <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>
13375
13376 !! html/parsoid
13377 <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:WikiLink">ISBN 1235467890</a></figcaption></figure>
13378 !! end
13379
13380 !! test
13381 BUG 1887: A RFC with a thumbnail
13382 !! wikitext
13383 [[File:Foobar.jpg|thumb|This is RFC 12354]]
13384 !! html/php
13385 <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>
13386
13387 !! html/parsoid
13388 <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>
13389 !! end
13390
13391 !! test
13392 BUG 1887: A mailto link with a thumbnail
13393 !! wikitext
13394 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
13395 !! html/php
13396 <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>
13397
13398 !! html/parsoid
13399 <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>
13400 !! end
13401
13402 # Pending resolution to bug 368
13403 !! test
13404 BUG 648: Frameless image caption with a link
13405 !! wikitext
13406 [[File:Foobar.jpg|text with a [[link]] in it]]
13407 !! html/php
13408 <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>
13409 </p>
13410 !! html/parsoid
13411 <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>
13412 !! end
13413
13414 !! test
13415 BUG 648: Frameless image caption with a link (suffix)
13416 !! wikitext
13417 [[File:Foobar.jpg|text with a [[link]]foo in it]]
13418 !! html/php
13419 <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>
13420 </p>
13421 !! html/parsoid
13422 <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>
13423 !! end
13424
13425 !! test
13426 BUG 648: Frameless image caption with an interwiki link
13427 !! wikitext
13428 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
13429 !! html/php
13430 <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>
13431 </p>
13432 !! html/parsoid
13433 <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>
13434 !! end
13435
13436 !! test
13437 BUG 648: Frameless image caption with a piped interwiki link
13438 !! wikitext
13439 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
13440 !! html/php
13441 <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>
13442 </p>
13443 !! html/parsoid
13444 <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>
13445 !! end
13446
13447 !! test
13448 T107474: Frameless image caption with <nowiki>
13449 !! wikitext
13450 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
13451 !! html/parsoid
13452 <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>
13453 !! end
13454
13455 !! test
13456 Escape HTML special chars in image alt text
13457 !! wikitext
13458 [[File:Foobar.jpg|& < > "]]
13459 !! html/php
13460 <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>
13461 </p>
13462 !! html/parsoid
13463 <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>
13464 !! end
13465
13466 !! test
13467 BUG 499: Alt text should have &#1234;, not &amp;1234;
13468 !! wikitext
13469 [[File:Foobar.jpg|&#9792;]]
13470 !! html/php
13471 <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>
13472 </p>
13473 !! html/parsoid
13474 <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>
13475 !! end
13476
13477 !! test
13478 Broken image caption with link
13479 !! options
13480 parsoid=wt2html,wt2wt,html2html
13481 !! wikitext
13482 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
13483 !! html/php
13484 <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.
13485 </p>
13486 !! html/parsoid
13487 <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>
13488 !! end
13489
13490 !! test
13491 Image caption containing another image
13492 !! wikitext
13493 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
13494 !! html/php
13495 <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>
13496
13497 !! html/parsoid
13498 <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>
13499 !! end
13500
13501 !! test
13502 Image: caption containing a newline
13503 !! wikitext
13504 [[File:Foobar.jpg|This
13505 *is some text]]
13506 !! html/php
13507 <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>
13508 </p>
13509 !! html/parsoid
13510 <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>
13511 !!end
13512
13513 !!test
13514 Image: caption containing leading space
13515 (The leading space should not trigger nowiki escaping in wt2wt mode)
13516 !! wikitext
13517 [[File:Foobar.jpg|thumb| bar]]
13518 !! html/php
13519 <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>
13520
13521 !! html/parsoid
13522 <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>
13523 !!end
13524
13525 !! test
13526 Image: caption containing a table
13527 !! options
13528 parsoid=wt2html,wt2wt,html2html
13529 !! wikitext
13530 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
13531 {|
13532 ! Foo !! Bar
13533 |-
13534 | Foo1 || Bar1
13535 |}
13536 and some more text.]]
13537 !! html/php
13538 <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>
13539
13540 !! html/parsoid
13541 <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
13542 <table>
13543 <tbody>
13544 <tr><th>Foo </th><th>Bar</th></tr>
13545 <tr>
13546 <td>Foo1 </td>
13547 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
13548 !! end
13549
13550 !! test
13551 Bug 3090: External links other than http: in image captions
13552 !! wikitext
13553 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
13554 !! html/php
13555 <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>
13556
13557 !! html/parsoid
13558 <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>
13559 !! end
13560
13561 !! test
13562 Custom class
13563 !! options
13564 parsoid=wt2html,wt2wt,html2html
13565 !! wikitext
13566 [[Image:foobar.jpg|a|class=b]]
13567 !! html/php
13568 <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>
13569 </p>
13570 !! html/parsoid
13571 <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>
13572 !! end
13573
13574 !! test
13575 Localized image handling (1).
13576 !! options
13577 parsoid=wt2html,wt2wt,html2html
13578 language=es
13579 !! wikitext
13580 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
13581 !! html/php
13582 <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>
13583
13584 !! html/parsoid
13585 <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>
13586 !! end
13587
13588 !! test
13589 Localized image handling (2).
13590 !! options
13591 thumbsize=220
13592 parsoid=wt2html,wt2wt,html2html
13593 language=es
13594 !! wikitext
13595 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
13596 !! html/php
13597 <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>
13598
13599 !! html/parsoid
13600 <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>
13601 !! end
13602
13603 !! test
13604 "border", "frameless" and "class" attributes on an image.
13605 !! options
13606 thumbsize=220
13607 parsoid=wt2html,wt2wt,html2html
13608 !! wikitext
13609 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
13610 !! html/php
13611 <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>
13612 </p>
13613 !! html/parsoid
13614 <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>
13615 !! end
13616
13617 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
13618 !! test
13619 Invalid image attributes (bug 62500)
13620 !! options
13621 thumbsize=220
13622 parsoid=wt2html,wt2wt,html2html
13623 !! wikitext
13624 [[File:Foobar.jpg|thumb|float|left|caption]]
13625
13626 [[File:Foobar.jpg|thumb|righ|caption]]
13627
13628 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
13629 !! html/php
13630 <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>
13631 <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>
13632 <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>
13633
13634 !! html/parsoid
13635 <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>
13636 <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>
13637 <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>
13638 !! end
13639
13640 !! article
13641 File:Barfoo.jpg
13642 !! text
13643 #REDIRECT [[File:Barfoo.jpg]]
13644 !! endarticle
13645
13646 # FIXME: Parsoid should run this test -- but we'd need to teach the
13647 # mockAPI about the redirected Barfoo.jpg image.
13648 !! test
13649 Redirected image
13650 !! wikitext
13651 [[Image:Barfoo.jpg]]
13652 !! html/php
13653 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
13654 </p>
13655 !! end
13656
13657 !! test
13658 Missing image with uploads disabled
13659 !! options
13660 wgEnableUploads=0
13661 !! wikitext
13662 [[File:Foobaz.jpg]]
13663 !! html/php
13664 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
13665 </p>
13666 !! html/parsoid
13667 <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>
13668 !! end
13669
13670 # Parsoid-specific testing for images
13671 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13672 # Currently imperfect due to a flaw in the Parsoid testrunner
13673 # Work in progress
13674 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
13675 # image tests.
13676
13677 !! test
13678 Parsoid-specific image handling - simple image with size and middle alignment
13679 !! wikitext
13680 [[File:Foobar.jpg|middle|50px]]
13681 !! html/parsoid
13682 <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>
13683 !! end
13684
13685 !! test
13686 Parsoid-specific image handling - simple image with size, middle alignment,
13687 non-standard namespace alias
13688 !! options
13689 parsoid=wt2wt,wt2html,html2html
13690 !! wikitext
13691 [[Image:Foobar.jpg|middle|50px]]
13692 !! html/parsoid
13693 <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>
13694 !! end
13695
13696 !! test
13697 Parsoid-specific image handling - simple image with size and middle alignment
13698 (existing content)
13699 !! wikitext
13700 [[File:Foobar.jpg|50px|middle]]
13701 !! html/parsoid
13702 <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>
13703 !! end
13704
13705 !! test
13706 Parsoid-specific image handling - simple image with size and middle alignment
13707 and non-standard namespace name
13708 !! options
13709 parsoid=wt2html,wt2wt,html2html
13710 !! wikitext
13711 [[Image:Foobar.jpg|50px|middle]]
13712 !! html/parsoid
13713 <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>
13714 !! end
13715
13716 !! test
13717 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
13718 !! wikitext
13719 [[File:Foobar.jpg|500x10px|baseline|caption]]
13720 !! html/parsoid
13721 <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>
13722 !! end
13723
13724 !! test
13725 Parsoid-specific image handling - simple image with border and size spec
13726 !! wikitext
13727 [[File:Foobar.jpg|50px|border|caption]]
13728 !! html/parsoid
13729 <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>
13730 !! end
13731
13732 !! test
13733 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13734 !! wikitext
13735 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
13736 !! html/parsoid
13737 <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>
13738 !! end
13739
13740 !! test
13741 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13742 (existing content)
13743 !! wikitext
13744 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
13745 !! html/parsoid
13746 <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>
13747 !! end
13748
13749 !! test
13750 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
13751 !! wikitext
13752 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
13753 !! html/parsoid
13754 <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>
13755 !! end
13756
13757 !! test
13758 Parsoid-specific image handling - thumbnail with specific size, halign,
13759 valign, and caption (existing content)
13760 !! wikitext
13761 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
13762 !! html/parsoid
13763 <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>
13764 !! end
13765
13766 !! test
13767 Parsoid-specific image handling - framed image with specific size and caption
13768 (size is ignored)
13769 !! options
13770 parsoid=wt2html,wt2wt,html2html
13771 !! wikitext
13772 [[File:Foobar.jpg|frame|500x50px|caption]]
13773 !! html/parsoid
13774 <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>
13775 !! end
13776
13777 !! test
13778 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
13779 (size is ignored)
13780 !! options
13781 parsoid=wt2html,wt2wt,html2html
13782 !! wikitext
13783 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
13784 !! html/parsoid
13785 <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>
13786 !! end
13787
13788 !! test
13789 Parsoid-specific image handling - frameless image with specific size, border, and caption
13790 !! wikitext
13791 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
13792 !! html/parsoid
13793 <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>
13794 !! end
13795
13796 !! test
13797 Parsoid-specific image handling - simple image with a formatted caption
13798 !! wikitext
13799 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
13800 !! html/parsoid
13801 <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>
13802 !! end
13803
13804 !! test
13805 Parsoid-specific image handling - caption with a template in it
13806 !! wikitext
13807 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
13808 !! html/parsoid
13809 <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>
13810 !! end
13811
13812 !! test
13813 Parsoid-specific image handling - caption with unbalanced tags in it
13814 !! options
13815 parsoid=wt2html,wt2wt,html2html
13816 !! wikitext
13817 foo
13818 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
13819 bar
13820 !! html/parsoid
13821 <p>foo</p>
13822 <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>
13823 <p>bar</p>
13824 !! end
13825
13826 !! test
13827 Parsoid-specific image handling - empty caption (1)
13828 !! options
13829 parsoid=wt2html,wt2wt
13830 !! wikitext
13831 [[File:Foobar.jpg|thumb|]]
13832 !! html/parsoid
13833 <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>
13834 !! end
13835
13836 # empty captions don't get serialized unless we're in the "round trip" case
13837 !! test
13838 Parsoid-specific image handling - empty caption (2)
13839 !! options
13840 parsoid=html2wt
13841 !! html/parsoid
13842 <figure class="mw-default-size" typeof="mw:Image/Thumb">
13843 <a href="./File:Foobar.jpg">
13844 <img resource="./File:Foobar.jpg"
13845 src="//example.com/images/3/3a/Foobar.jpg"
13846 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
13847 height="25" width="220"/>
13848 </a>
13849 <figcaption></figcaption>
13850 </figure>
13851 !! wikitext
13852 [[File:Foobar.jpg|thumb]]
13853 !! end
13854
13855 !! test
13856 Parsoid-specific image handling - whitespace caption
13857 !! wikitext
13858 [[File:Foobar.jpg|thumb| ]]
13859 !! html/parsoid
13860 <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>
13861 !! end
13862
13863 !! test
13864 Parsoid-specific image handling - lang option
13865 !! wikitext
13866 foo
13867 [[File:Foobar.svg|lang=de|caption]]
13868 bar
13869 !! html/parsoid
13870 <p>foo
13871 <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>
13872 bar</p>
13873 !! end
13874
13875 ## Edge case bugs in Parsoid from T93580
13876 !! test
13877 T93580: 1. Templated <ref> inside block images
13878 !! wikitext
13879 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
13880
13881 <references />
13882 !! html/parsoid
13883 <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>
13884
13885 <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>
13886 !! end
13887
13888 !! test
13889 T93580: 2. <ref> inside inline images
13890 !! wikitext
13891 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
13892
13893 <references />
13894 !! html/parsoid
13895 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: &lt;ref>foo&lt;/ref>"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;span about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[64,78,5,6]}\" data-mw=\"{&amp;quot;name&amp;quot;:&amp;quot;ref&amp;quot;,&amp;quot;body&amp;quot;:{&amp;quot;id&amp;quot;:&amp;quot;mw-reference-text-cite_note-1&amp;quot;},&amp;quot;attrs&amp;quot;:{}}\">&lt;a href=\"#cite_note-1\" style=\"counter-reset: mw-Ref 1;\">&lt;span class=\"mw-reflink-text\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=\"{&amp;quot;group&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;content&amp;quot;:&amp;quot;foo&amp;quot;,&amp;quot;hasRefInRef&amp;quot;:false,&amp;quot;dsr&amp;quot;:[64,78,5,6],&amp;quot;tmp&amp;quot;:{}}\" data-mw=\"{}\">"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./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":"File:Foobar.jpg"}}'/></a></span></p>
13896
13897 <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" data-parsoid="{}">foo</span></li></ol>
13898 !! end
13899
13900 !! test
13901 T93580: 3. Templated <ref> inside inline images
13902 !! wikitext
13903 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
13904
13905 <references />
13906 !! html/parsoid
13907 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: {{echo|&lt;ref>{{echo|foo}}&lt;/ref>}}"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;span about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Transclusion mw:Extension/ref\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[64,96,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;&lt;ref>{{echo|foo}}&lt;/ref>&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">&lt;a href=\"#cite_note-1\" style=\"counter-reset: mw-Ref 1;\">&lt;span class=\"mw-reflink-text\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Transclusion mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=\"{&amp;quot;group&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;content&amp;quot;:&amp;quot;foo&amp;quot;,&amp;quot;hasRefInRef&amp;quot;:false,&amp;quot;dsr&amp;quot;:[64,96,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;]}]],&amp;quot;tmp&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;&lt;ref>{{echo|foo}}&lt;/ref>&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./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":"File:Foobar.jpg"}}'/></a></span></p>
13908
13909 <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>
13910 !! end
13911
13912 ###
13913 ### Subpages
13914 ###
13915 !! article
13916 Subpage test/subpage
13917 !! text
13918 foo
13919 !! endarticle
13920
13921 !! test
13922 Subpage link
13923 !! options
13924 subpage title=[[Subpage test]]
13925 !! wikitext
13926 [[/subpage]]
13927 !! html
13928 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
13929 </p>
13930 !! end
13931
13932 !! test
13933 Subpage noslash link
13934 !! options
13935 subpage title=[[Subpage test]]
13936 !! wikitext
13937 [[/subpage/]]
13938 !! html
13939 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
13940 </p>
13941 !! end
13942
13943 !! article
13944 Subpage test/1/2/subpage
13945 !! text
13946 blah
13947 !! endarticle
13948
13949 !! test
13950 Relative subpage noslash link
13951 !! options
13952 parsoid=wt2wt,wt2html,html2html
13953 subpage title=[[Subpage test/1/2/3/4]]
13954 !! wikitext
13955 [[../../subpage/]]
13956
13957 [[../../subpage]]
13958 !! html/php
13959 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
13960 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
13961 </p>
13962 !! html/parsoid
13963 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
13964 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
13965 !! end
13966
13967 !! test
13968 Parsoid: dot-slash prefixed wikilinks
13969 !! wikitext
13970 [[./foo]]
13971
13972 [[././bar]]
13973
13974 [[././baz/]]
13975 !! html/php
13976 <p>[[./foo]]
13977 </p><p>[[././bar]]
13978 </p><p>[[././baz/]]
13979 </p>
13980 !! html/parsoid
13981 <p>[[./foo]]
13982 </p><p>[[././bar]]
13983 </p><p>[[././baz/]]
13984 </p>
13985 !! end
13986
13987 !! test
13988 Render invalid page names as plain text (bug 51090)
13989 !! wikitext
13990 [[./../foo|bar]]
13991 [[foo�|bar]]
13992 [[foo/.|bar]]
13993 [[foo/..|bar]]
13994 [[foo~~~bar]]
13995 [[foo>bar]]
13996 [[foo[bar]]
13997 [[.]]
13998 [[..]]
13999 [[foo././bar]]
14000
14001 [[{{echo|./../foo}}|bar]]
14002 [[{{echo|foo/.}}|bar]]
14003 [[{{echo|foo/..}}|bar]]
14004 [[{{echo|foo~~~~bar}}]]
14005 [[{{echo|foo>bar}}]]
14006 [[{{echo|foo././bar}}]]
14007 [[{{echo|foo{bar}}]]
14008 [[{{echo|foo}bar}}]]
14009 [[{{echo|foo[bar}}]]
14010 [[{{echo|foo]bar}}]]
14011 [[{{echo|foo<bar}}]]
14012 !!html/php
14013 <p>[[./../foo|bar]]
14014 [[foo�|bar]]
14015 [[foo/.|bar]]
14016 [[foo/..|bar]]
14017 [[foo~~~bar]]
14018 [[foo&gt;bar]]
14019 [[foo[bar]]
14020 [[.]]
14021 [[..]]
14022 [[foo././bar]]
14023 </p><p>[[./../foo|bar]]
14024 [[foo/.|bar]]
14025 [[foo/..|bar]]
14026 [[foo~~~~bar]]
14027 [[foo&gt;bar]]
14028 [[foo././bar]]
14029 [[foo{bar]]
14030 [[foo}bar]]
14031 [[foo[bar]]
14032 [[foo]bar]]
14033 [[foo&lt;bar]]
14034 </p>
14035 !!html/parsoid
14036 <p>[[./../foo|bar]]
14037 [[foo�|bar]]
14038 [[foo/.|bar]]
14039 [[foo/..|bar]]
14040 [[foo~~~bar]]
14041 [[foo>bar]]
14042 [[foo[bar]]
14043 [[.]]
14044 [[..]]
14045 [[foo././bar]]</p>
14046
14047 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14048 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14049 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14050 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14051 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14052 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14053 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14054 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14055 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14056 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14057 [[<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>
14058 !!end
14059
14060 !! test
14061 Disabled subpages
14062 !! wikitext
14063 [[/subpage]]
14064 !! html
14065 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14066 </p>
14067 !! end
14068
14069 !! test
14070 BUG 561: {{/Subpage}}
14071 !! options
14072 subpage title=[[Page]]
14073 !! wikitext
14074 {{/Subpage}}
14075 !! html
14076 <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>
14077 </p>
14078 !! end
14079
14080 ###
14081 ### Categories
14082 ###
14083 !! article
14084 Category:MediaWiki User's Guide
14085 !! text
14086 blah
14087 !! endarticle
14088
14089 !! test
14090 Link to category
14091 !! wikitext
14092 [[:Category:MediaWiki User's Guide]]
14093 !! html
14094 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14095 </p>
14096 !! end
14097
14098 !! test
14099 Simple category
14100 !! options
14101 cat
14102 !! wikitext
14103 [[Category:MediaWiki User's Guide]]
14104 !! html
14105 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14106 !! end
14107
14108 !! test
14109 PAGESINCATEGORY invalid title fatal (r33546 fix)
14110 !! wikitext
14111 {{PAGESINCATEGORY:<bogus>}}
14112 !! html
14113 <p>0
14114 </p>
14115 !! end
14116
14117 !! test
14118 Category with different sort key
14119 !! options
14120 cat
14121 !! wikitext
14122 [[Category:MediaWiki User's Guide|Foo]]
14123 !! html
14124 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14125 !! end
14126
14127 !! test
14128 Category with identical sort key
14129 !! options
14130 cat
14131 !! wikitext
14132 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14133 !! html
14134 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14135 !! end
14136
14137 !! test
14138 Category with empty sort key
14139 !! options
14140 cat
14141 pst
14142 !! wikitext
14143 [[Category:MediaWiki User's Guide|]]
14144 !! html
14145 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14146 !! end
14147
14148 !! test
14149 Category with empty sort key and parentheses
14150 !! options
14151 cat
14152 pst
14153 !! wikitext
14154 [[Category:Foo (bar)|]]
14155 !! html
14156 [[Category:Foo (bar)|Foo]]
14157 !! end
14158
14159 !! test
14160 Category with link tail
14161 !! options
14162 cat
14163 pst
14164 !! wikitext
14165 123[[Category:Foo]]456
14166 !! html
14167 123[[Category:Foo]]456
14168 !! end
14169
14170 !! test
14171 Category with template
14172 !! options
14173 cat
14174 pst
14175 !! wikitext
14176 [[Category:{{echo|Foo}}]]
14177 !! html
14178 [[Category:{{echo|Foo}}]]
14179 !! end
14180
14181 !! test
14182 Category with template in sort key
14183 !! options
14184 cat
14185 pst
14186 !! wikitext
14187 [[Category:Foo|{{echo|Bar}}]]
14188 !! html
14189 [[Category:Foo|{{echo|Bar}}]]
14190 !! end
14191
14192 !! test
14193 Category with template in sort key and title
14194 !! options
14195 cat
14196 pst
14197 !! wikitext
14198 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14199 !! html
14200 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14201 !! end
14202
14203 !! test
14204 Category / paragraph interactions
14205 !! wikitext
14206 Foo [[Category:Baz]] Bar
14207
14208 Foo [[Category:Baz]]
14209 Bar
14210
14211 Foo
14212 [[Category:Baz]]
14213 Bar
14214
14215 Foo
14216 [[Category:Baz]] Bar
14217
14218 Foo
14219 [[Category:Baz]]
14220 [[Category:Baz]]
14221 [[Category:Baz]]
14222 Bar
14223
14224 [[Category:Baz]]
14225 [[Category:Baz]]
14226 [[Category:Baz]]
14227
14228 [[Category:Baz]]
14229 {{echo|[[Category:Baz]]}}
14230 [[Category:Baz]]
14231 !! html
14232 <p>Foo Bar
14233 </p><p>Foo
14234 Bar
14235 </p><p>Foo
14236 Bar
14237 </p><p>Foo Bar
14238 </p><p>Foo
14239 Bar
14240 </p>
14241 !! end
14242
14243 ## The whitespace on the empty line is part of the test. Please do not delete
14244 !! test
14245 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14246 !! options
14247 parsoid=wt2html,wt2wt
14248 !! wikitext
14249 This
14250
14251 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14252
14253 {{echo|[[Category:Foo]] and so should this!}}
14254 !! html
14255 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14256 </p>
14257 !! html/parsoid
14258 <p>This
14259
14260 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14261
14262 <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>
14263 !! end
14264
14265 ## Parsoid will not try to wt2wt this while preserving newlines because
14266 ## it suppresses excess newlines within list items -- and we don't want to
14267 ## introduce a special case just for categories, which is, in reality somewhat
14268 ## odd behavior -- categories are unlikely to be used in list items like this
14269 ## in top-level pages and are only likely to show up in template-generated
14270 ## list items where this RT-ing is a non-issue.
14271 ##
14272 ## The whitespace on the empty line is part of the test. Please do not delete
14273 !! test
14274 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14275 !! options
14276 parsoid=wt2html
14277 !! wikitext
14278 * This
14279
14280 [[Category:Foo]] and this should be part of the same list item
14281 * So should this
14282
14283 {{echo|[[Category:Foo]] and this should be part of the same list item}}
14284 !! html
14285 <ul><li>This and this should be part of the same list item</li>
14286 <li>So should this and this should be part of the same list item</li></ul>
14287 !! html/parsoid
14288 <ul>
14289 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
14290 <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>
14291 </ul>
14292 !! end
14293
14294 ## Newlines and categories that follow the last item of a list
14295 ## are treated differently because this (list followed by categories)
14296 ## is an extremely common pattern on wikis.
14297 !! test
14298 3. Categories and newlines: newline suppression for last list item should RT properly
14299 !! wikitext
14300 * a
14301 * b
14302
14303 [[Category:Foo]]
14304
14305 [[Category:Bar]]
14306 [[Category:Baz]]
14307 !! html/parsoid
14308 <ul><li> a</li>
14309 <li> b</li></ul>
14310
14311 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14312
14313 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14314 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14315 !! end
14316
14317 !! test
14318 4. Categories and newlines: newline suppression for last list item should RT properly
14319 !! wikitext
14320 * a
14321 **** b
14322
14323 [[Category:Foo]]
14324 !! html/parsoid
14325 <ul><li> a
14326 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
14327
14328 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14329 !! end
14330
14331 ## only wt2html for this to make sure the algo only applies to the rightmost path
14332 !! test
14333 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
14334 !! options
14335 parsoid=wt2html
14336 !! wikitext
14337 * a
14338 ** b
14339 [[Category:Foo]]
14340 * c
14341 ** d
14342 [[Category:Foo]]
14343 !! html/parsoid
14344 <ul><li> a
14345 <ul><li> b
14346 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
14347 <li> c
14348 <ul><li> d</li></ul></li></ul>
14349 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14350 !! end
14351
14352 !! test
14353 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
14354 !! wikitext
14355 * a [[Category:Foo]]
14356 !! html/parsoid
14357 <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>
14358 !! end
14359
14360 # This test also demonstrates because of newline+category tunneling
14361 # through the list hander, template wrapping doesn't expand to the
14362 # containing list when the list item swallows the category.
14363 !! test
14364 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
14365 !! wikitext
14366 * {{echo|a
14367 [[Category:Foo]]}}
14368 !! html/parsoid
14369 <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">
14370 </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>
14371 !! end
14372
14373 !! test
14374 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
14375 !! wikitext
14376 * a
14377
14378 {{echo|[[Category:Foo]]
14379 [[Category:Bar]]}}
14380 [[Category:Baz]]
14381 !! html/parsoid
14382 <ul><li> a</li></ul>
14383
14384 <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">
14385 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14386 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14387 !! end
14388
14389 !! test
14390 Parsoid: Serialize link to category page with colon escape
14391 !! options
14392 parsoid
14393 !! wikitext
14394
14395 [[:Category:Foo]]
14396 [[:Category:Foo|Bar]]
14397 !! html
14398 <p>
14399 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
14400 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
14401 </p>
14402 !! end
14403
14404 # html2wt localizes the "Category" namespace.
14405 # XXX the <link> element needs an empty data-parsoid attribute, or
14406 # else the html2html test fails because spaces are inserted.
14407 !! test
14408 Link prefix/suffixes aren't applied to category links
14409 !! options
14410 parsoid=wt2html,wt2wt,html2html
14411 language=is
14412 !! wikitext
14413 x[[Category:Foo]]y
14414 !! html/php
14415 <p>xy
14416 </p>
14417 !! html/parsoid
14418 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
14419 !! end
14420
14421 !! test
14422 Parsoid: Serialize link to file page with colon escape
14423 !! options
14424 parsoid
14425 !! wikitext
14426
14427 [[:File:Foo.png]]
14428 [[:File:Foo.png|Bar]]
14429 !! html
14430 <p>
14431 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
14432 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
14433 </p>
14434 !! end
14435
14436 !! test
14437 Parsoid: Serialize a genuine category link without colon escape
14438 !! options
14439 parsoid
14440 !! wikitext
14441 [[Category:Foo]]
14442 [[Category:Foo|Bar]]
14443 !! html
14444 <link rel="mw:PageProp/Category" href="./Category:Foo">
14445 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
14446 !! end
14447
14448 !! test
14449 Normalize hrefs properly before testing for invalid link targets (bug 70894)
14450 !! options
14451 parsoid=html2wt
14452 !! html/parsoid
14453 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
14454 !! wikitext
14455 [[Category:Toxine bactérienne]]
14456 !! end
14457
14458 !! test
14459 Parsoid: Defaultsort
14460 !! wikitext
14461 {{DEFAULTSORT:Foo}}
14462 !! html/parsoid
14463 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
14464 !! end
14465
14466 !! test
14467 Parsoid: Defaultsort (template-generated)
14468 !! wikitext
14469 {{{{echo|DEFAULTSORT}}:Foo}}
14470 !! html/parsoid
14471 <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}}]}'/>
14472 !! end
14473
14474 ###
14475 ### Inter-language links
14476 ###
14477 !! test
14478 Interlanguage links
14479 !! options
14480 ill
14481 !! wikitext
14482 [[es:Alimento]]
14483 [[fr:Nourriture]]
14484 [[zh:食品]]
14485 !! html/php
14486 es:Alimento fr:Nourriture zh:食品
14487 !! html/parsoid
14488 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
14489 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
14490 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
14491 !! end
14492
14493 !! test
14494 Duplicate interlanguage links (bug 24502)
14495 !! options
14496 ill
14497 !! wikitext
14498 [[es:1]]
14499 [[es:2]]
14500 [[fr:1]]
14501 [[fr:2]]
14502 !! html/php
14503 es:1 fr:1
14504 !! html/parsoid
14505 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
14506 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
14507 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
14508 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
14509 !! end
14510
14511 ###
14512 ### Sections
14513 ###
14514 !! test
14515 Basic section headings
14516 !! wikitext
14517 == Headline 1 ==
14518 Some text
14519
14520 ==Headline 2==
14521 More
14522 ===Smaller headline===
14523 Blah blah
14524 !! html
14525 <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>
14526 <p>Some text
14527 </p>
14528 <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>
14529 <p>More
14530 </p>
14531 <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>
14532 <p>Blah blah
14533 </p>
14534 !! end
14535
14536 !! test
14537 Section headings with TOC
14538 !! wikitext
14539 == Headline 1 ==
14540 === Subheadline 1 ===
14541 ===== Skipping a level =====
14542 ====== Skipping a level ======
14543
14544 == Headline 2 ==
14545 Some text
14546 ===Another headline===
14547 !! html
14548 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14549 <ul>
14550 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
14551 <ul>
14552 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
14553 <ul>
14554 <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>
14555 <ul>
14556 <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>
14557 </ul>
14558 </li>
14559 </ul>
14560 </li>
14561 </ul>
14562 </li>
14563 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
14564 <ul>
14565 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
14566 </ul>
14567 </li>
14568 </ul>
14569 </div>
14570
14571 <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>
14572 <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>
14573 <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>
14574 <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>
14575 <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>
14576 <p>Some text
14577 </p>
14578 <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>
14579
14580 !! end
14581
14582 !! test
14583 TOC anchors don't collide
14584 !! wikitext
14585 __FORCETOC__
14586 == Headline 2 ==
14587 == Headline ==
14588 == Headline 2 ==
14589 == Headline ==
14590 !! html/php
14591 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14592 <ul>
14593 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
14594 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
14595 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
14596 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
14597 </ul>
14598 </div>
14599
14600 <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>
14601 <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>
14602 <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>
14603 <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>
14604
14605 !! end
14606
14607 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
14608 !! test
14609 Handling of sections up to level 6 and beyond
14610 !! wikitext
14611 = Level 1 Heading=
14612 == Level 2 Heading==
14613 === Level 3 Heading===
14614 ==== Level 4 Heading====
14615 ===== Level 5 Heading=====
14616 ====== Level 6 Heading======
14617 ======= Level 7 Heading=======
14618 ======== Level 8 Heading========
14619 ========= Level 9 Heading=========
14620 ========== Level 10 Heading==========
14621 !! html
14622 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14623 <ul>
14624 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
14625 <ul>
14626 <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>
14627 <ul>
14628 <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>
14629 <ul>
14630 <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>
14631 <ul>
14632 <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>
14633 <ul>
14634 <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>
14635 <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>
14636 <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>
14637 <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>
14638 <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>
14639 </ul>
14640 </li>
14641 </ul>
14642 </li>
14643 </ul>
14644 </li>
14645 </ul>
14646 </li>
14647 </ul>
14648 </li>
14649 </ul>
14650 </div>
14651
14652 <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>
14653 <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>
14654 <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>
14655 <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>
14656 <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>
14657 <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>
14658 <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>
14659 <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>
14660 <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>
14661 <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>
14662
14663 !! end
14664
14665 !! test
14666 TOC regression (T11764)
14667 !! wikitext
14668 == title 1 ==
14669 === title 1.1 ===
14670 ==== title 1.1.1 ====
14671 === title 1.2 ===
14672 == title 2 ==
14673 === title 2.1 ===
14674 !! html
14675 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14676 <ul>
14677 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14678 <ul>
14679 <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>
14680 <ul>
14681 <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>
14682 </ul>
14683 </li>
14684 <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>
14685 </ul>
14686 </li>
14687 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14688 <ul>
14689 <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>
14690 </ul>
14691 </li>
14692 </ul>
14693 </div>
14694
14695 <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>
14696 <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>
14697 <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>
14698 <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>
14699 <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>
14700 <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>
14701
14702 !! end
14703
14704 !! test
14705 TOC for heading containing <span id="..."></span> (T96153)
14706 !! wikitext
14707 __FORCETOC__
14708 ==<span id="old-anchor"></span>New title==
14709 !! html/php
14710 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14711 <ul>
14712 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
14713 </ul>
14714 </div>
14715
14716 <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>
14717
14718 !! end
14719
14720 !! test
14721 TOC with wgMaxTocLevel=3 (bug 6204)
14722 !! options
14723 wgMaxTocLevel=3
14724 !! wikitext
14725 == title 1 ==
14726 === title 1.1 ===
14727 ==== title 1.1.1 ====
14728 === title 1.2 ===
14729 == title 2 ==
14730 === title 2.1 ===
14731 !! html
14732 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14733 <ul>
14734 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14735 <ul>
14736 <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>
14737 <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>
14738 </ul>
14739 </li>
14740 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14741 <ul>
14742 <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>
14743 </ul>
14744 </li>
14745 </ul>
14746 </div>
14747
14748 <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>
14749 <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>
14750 <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>
14751 <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>
14752 <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>
14753 <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>
14754
14755 !! end
14756
14757 !! test
14758 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
14759 !! options
14760 wgMaxTocLevel=3
14761 !! wikitext
14762 ==Section 1==
14763 ===Section 1.1===
14764 ====Section 1.1.1====
14765 ====Section 1.1.1.1====
14766 ==Section 2==
14767 !! html
14768 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14769 <ul>
14770 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
14771 <ul>
14772 <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>
14773 </ul>
14774 </li>
14775 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
14776 </ul>
14777 </div>
14778
14779 <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>
14780 <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>
14781 <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>
14782 <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>
14783 <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>
14784
14785 !! end
14786
14787
14788 !! test
14789 Resolving duplicate section names
14790 !! wikitext
14791 == Foo bar ==
14792 == Foo bar ==
14793 !! html
14794 <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>
14795 <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>
14796
14797 !! end
14798
14799 !! test
14800 Resolving duplicate section names with differing case (bug 10721)
14801 !! wikitext
14802 == Foo bar ==
14803 == Foo Bar ==
14804 !! html
14805 <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>
14806 <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>
14807
14808 !! end
14809
14810 !! article
14811 Template:sections
14812 !! text
14813 ===Section 1===
14814 ==Section 2==
14815 !! endarticle
14816
14817 !! test
14818 Template with sections, __NOTOC__
14819 !! wikitext
14820 __NOTOC__
14821 ==Section 0==
14822 {{sections}}
14823 ==Section 4==
14824 !! html
14825 <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>
14826 <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>
14827 <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>
14828 <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>
14829
14830 !! end
14831
14832 !! test
14833 __NOEDITSECTION__ keyword
14834 !! wikitext
14835 __NOEDITSECTION__
14836 ==Section 1==
14837 ==Section 2==
14838 !! html
14839 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
14840 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
14841
14842 !! end
14843
14844 !! test
14845 Link inside a section heading
14846 !! wikitext
14847 ==Section with a [[Main Page|link]] in it==
14848 !! html
14849 <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>
14850
14851 !! end
14852
14853 !! test
14854 TOC regression (T14077)
14855 !! wikitext
14856 __TOC__
14857 == title 1 ==
14858 === title 1.1 ===
14859 == title 2 ==
14860 !! html
14861 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14862 <ul>
14863 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14864 <ul>
14865 <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>
14866 </ul>
14867 </li>
14868 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
14869 </ul>
14870 </div>
14871
14872 <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>
14873 <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>
14874 <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>
14875
14876 !! end
14877
14878 !! test
14879 BUG 1219 URL next to image (good)
14880 !! wikitext
14881 http://example.com [[File:Foobar.jpg]]
14882 !! html/php
14883 <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>
14884 </p>
14885 !! html/parsoid
14886 <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>
14887 !!end
14888
14889 !! test
14890 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
14891 !! wikitext
14892 ===
14893 The line above must have a trailing space!
14894 === <!--
14895 --> <!-- -->
14896 But just in case it doesn't...
14897 !! html
14898 <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>
14899 <p>The line above must have a trailing space!
14900 </p>
14901 <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>
14902 <p>But just in case it doesn't...
14903 </p>
14904 !! end
14905
14906 !! test
14907 Header with special characters (bug 25462)
14908 !! wikitext
14909 The tooltips shall not show entities to the user (ie. be double escaped)
14910
14911 == text > text ==
14912 section 1
14913
14914 == text < text ==
14915 section 2
14916
14917 == text & text ==
14918 section 3
14919
14920 == text ' text ==
14921 section 4
14922
14923 == text " text ==
14924 section 5
14925 !! html
14926 <p>The tooltips shall not show entities to the user (ie. be double escaped)
14927 </p>
14928 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14929 <ul>
14930 <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>
14931 <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>
14932 <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>
14933 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
14934 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
14935 </ul>
14936 </div>
14937
14938 <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>
14939 <p>section 1
14940 </p>
14941 <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>
14942 <p>section 2
14943 </p>
14944 <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>
14945 <p>section 3
14946 </p>
14947 <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>
14948 <p>section 4
14949 </p>
14950 <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>
14951 <p>section 5
14952 </p>
14953 !! end
14954
14955 !! test
14956 Header with space, plus and underscore as entity
14957 !! wikitext
14958 Id should not contain + for spaces
14959
14960 == Space between Text ==
14961 section 1
14962
14963 == Space-Entity&#32;between&#32;Text ==
14964 section 2
14965
14966 == Plus+between+Text ==
14967 section 3
14968
14969 == Plus-Entity&#43;between&#43;Text ==
14970 section 4
14971
14972 == Underscore_between_Text ==
14973 section 5
14974
14975 == Underscore-Entity&#95;between&#95;Text ==
14976 section 6
14977
14978 [[#Space between Text]]
14979 [[#Space-Entity&#32;between&#32;Text]]
14980 [[#Plus+between+Text]]
14981 [[#Plus-Entity&#43;between&#43;Text]]
14982 [[#Underscore_between_Text]]
14983 [[#Underscore-Entity&#95;between&#95;Text]]
14984 !! html
14985 <p>Id should not contain + for spaces
14986 </p>
14987 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14988 <ul>
14989 <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>
14990 <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>
14991 <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>
14992 <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>
14993 <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>
14994 <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>
14995 </ul>
14996 </div>
14997
14998 <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>
14999 <p>section 1
15000 </p>
15001 <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>
15002 <p>section 2
15003 </p>
15004 <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>
15005 <p>section 3
15006 </p>
15007 <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>
15008 <p>section 4
15009 </p>
15010 <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>
15011 <p>section 5
15012 </p>
15013 <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>
15014 <p>section 6
15015 </p><p><a href="#Space_between_Text">#Space between Text</a>
15016 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15017 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15018 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15019 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15020 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15021 </p>
15022 !! end
15023
15024 !! test
15025 Headers with excess '=' characters
15026 (Are similar tests necessary beyond the 1st level?)
15027 !! wikitext
15028 =foo==
15029 ==foo=
15030 =''italic'' heading==
15031 ==''italic'' heading=
15032 !! html
15033 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15034 <ul>
15035 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15036 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15037 <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>
15038 <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>
15039 </ul>
15040 </div>
15041
15042 <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>
15043 <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>
15044 <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>
15045 <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>
15046
15047 !! end
15048
15049 !! test
15050 HTML headers vs TOC (bug 23393)
15051 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15052 !! wikitext
15053 <h1>Header 1</h1>
15054 == Header 1.1 ==
15055 == Header 1.2 ==
15056
15057 <h1>Header 2
15058 </h1>
15059 == Header 2.1 ==
15060 == Header 2.2 ==
15061 __NOEDITSECTION__
15062 !! html
15063 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15064 <ul>
15065 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15066 <ul>
15067 <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>
15068 <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>
15069 </ul>
15070 </li>
15071 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15072 <ul>
15073 <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>
15074 <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>
15075 </ul>
15076 </li>
15077 </ul>
15078 </div>
15079
15080 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15081 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15082 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15083 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15084 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15085 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15086
15087 !! end
15088
15089 !! test
15090 Single-line or multiline-comments can follow headings
15091 !! options
15092 parsoid=wt2html,wt2wt
15093 !! wikitext
15094 ==foo==<!---->
15095 ==bar==<!--c1-->
15096 ==baz==<!--
15097 c2
15098 c3-->
15099 !! html
15100 <h2><span class="mw-headline" id="foo">foo</span></h2>
15101 <h2><span class="mw-headline" id="bar">bar</span></h2>
15102 <h2><span class="mw-headline" id="baz">baz</span></h2>
15103
15104 !! end
15105
15106 !! test
15107 BUG 1219 URL next to image (broken)
15108 !! wikitext
15109 http://example.com[[File:Foobar.jpg]]
15110 !! html/php
15111 <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>
15112 </p>
15113 !! html/parsoid
15114 <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>
15115 !!end
15116
15117 !! test
15118 Bug 1186 news: in the middle of text
15119 !! wikitext
15120 http://en.wikinews.org/wiki/Wikinews:Workplace
15121 !! html
15122 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15123 </p>
15124 !!end
15125
15126
15127 !! test
15128 Namespaced link must have a title
15129 !! wikitext
15130 [[Project:]]
15131 !! html
15132 <p>[[Project:]]
15133 </p>
15134 !!end
15135
15136 !! test
15137 Namespaced link must have a title (bad fragment version)
15138 !! wikitext
15139 [[Project:#fragment]]
15140 !! html
15141 <p>[[Project:#fragment]]
15142 </p>
15143 !!end
15144
15145
15146 ###
15147 ### HTML tags and HTML attributes
15148 ###
15149
15150 !! test
15151 div with no attributes
15152 !! wikitext
15153 <div>HTML rocks</div>
15154 !! html
15155 <div>HTML rocks</div>
15156
15157 !! end
15158
15159 !! test
15160 div with double-quoted attribute
15161 !! wikitext
15162 <div id="rock">HTML rocks</div>
15163 !! html
15164 <div id="rock">HTML rocks</div>
15165
15166 !! end
15167
15168 !! test
15169 div with single-quoted attribute
15170 !! wikitext
15171 <div id='rock'>HTML rocks</div>
15172 !! html
15173 <div id="rock">HTML rocks</div>
15174
15175 !! end
15176
15177 !! test
15178 div with unquoted attribute
15179 !! wikitext
15180 <div id=rock>HTML rocks</div>
15181 !! html
15182 <div id="rock">HTML rocks</div>
15183
15184 !! end
15185
15186 !! test
15187 div with illegal double attributes
15188 !! wikitext
15189 <div id="a" id="b">HTML rocks</div>
15190 !! html
15191 <div id="b">HTML rocks</div>
15192
15193 !!end
15194
15195 # FIXME: produce empty string instead of "class" in the PHP parser, following
15196 # the HTML5 spec.
15197 !! test
15198 div with empty attribute value, space before equals
15199 !! options
15200 parsoid
15201 !! wikitext
15202 <div class =>HTML rocks</div>
15203 !! html
15204 <div class="">HTML rocks</div>
15205
15206 !! end
15207
15208 !! test
15209 div with multiple empty attribute values
15210 !! options
15211 parsoid
15212 !! wikitext
15213 <div id= title=>HTML rocks</div>
15214 !! html
15215 <div id="" title="">HTML rocks</div>
15216
15217 !! end
15218
15219 !! test
15220 table with multiple empty attribute values
15221 !! options
15222 parsoid
15223 !! wikitext
15224 {| title= id=
15225 | hi
15226 |}
15227 !! html
15228 <table title="" id="">
15229 <tbody><tr><td> hi</td></tr>
15230 </tbody></table>
15231 !! end
15232
15233 !! test
15234 div with braces in attribute value
15235 !! wikitext
15236 <div title="{}">Foo</div>
15237 !! html/php
15238 <div title="&#123;}">Foo</div>
15239
15240 !! html/parsoid
15241 <div title="{}">Foo</div>
15242 !! end
15243
15244 # This it very inconsistent in the PHP parser: it returns
15245 # class="class" if there is a space between the name and the equal sign (see
15246 # 'div with empty attribute value, space before equals'), but strips the
15247 # attribute completely if the space is missing. We hope that not much content
15248 # depends on this, so are implementing the behavior below in Parsoid for
15249 # consistencies' sake.
15250 # FIXME: fix this behavior in the PHP parser?
15251 !! test
15252 div with empty attribute value, no space before equals
15253 !! options
15254 parsoid=wt2html,html2html
15255 !! wikitext
15256 <div class=>HTML rocks</div>
15257 !! html/php
15258 <div>HTML rocks</div>
15259
15260 !! html/parsoid
15261 <div class="">HTML rocks</div>
15262 !! end
15263
15264 !! test
15265 HTML multiple attributes correction
15266 !! wikitext
15267 <p class="error" class="awesome">Awesome!</p>
15268 !! html
15269 <p class="awesome">Awesome!</p>
15270
15271 !!end
15272
15273 !! test
15274 Table multiple attributes correction
15275 !! wikitext
15276 {|
15277 !+ class="error" class="awesome"| status
15278 |}
15279 !! html
15280 <table>
15281 <tr>
15282 <th class="awesome"> status
15283 </th></tr></table>
15284
15285 !!end
15286
15287 !! test
15288 DIV IN UPPERCASE
15289 !! wikitext
15290 <DIV ID="x">HTML ROCKS</DIV>
15291 !! html
15292 <div id="x">HTML ROCKS</div>
15293
15294 !!end
15295
15296 !! test
15297 Non-ASCII pseudo-tags are rendered as text
15298 !! wikitext
15299 <khyô>
15300 !! html
15301 <p>&lt;khyô&gt;
15302 </p>
15303 !! end
15304
15305 !! test
15306 Pseudo-tag with URL 'name' renders as url link
15307 !! wikitext
15308 <http://example.com/>
15309 !! html
15310 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
15311 </p>
15312 !! end
15313
15314 !! test
15315 text with amp in the middle of nowhere
15316 !! wikitext
15317 Remember AT&T?
15318 !! html
15319 <p>Remember AT&amp;T?
15320 </p>
15321 !! end
15322
15323 !! test
15324 text with character entity: eacute
15325 !! wikitext
15326 I always thought &eacute; was a cute letter.
15327 !! html
15328 <p>I always thought &#233; was a cute letter.
15329 </p>
15330 !! html+tidy
15331 <p>I always thought é was a cute letter.</p>
15332 !! end
15333
15334 !! test
15335 text with entity-escaped character entity-like string: eacute
15336 !! wikitext
15337 I always thought &amp;eacute; was a cute letter.
15338 !! html
15339 <p>I always thought &amp;eacute; was a cute letter.
15340 </p>
15341 !! end
15342
15343 !! test
15344 text with undefined character entity: xacute
15345 !! wikitext
15346 I always thought &xacute; was a cute letter.
15347 !! html
15348 <p>I always thought &amp;xacute; was a cute letter.
15349 </p>
15350 !! end
15351
15352 !! test
15353 HTML5 tags
15354 !! wikitext
15355 <data value="5">five</data>
15356 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15357 <mark>This highlighted text</mark>
15358 !! html
15359 <p><data value="5">five</data>
15360 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15361 <mark>This highlighted text</mark>
15362 </p>
15363 !! end
15364
15365 !! test
15366 HTML tag with leading space is parsed as text
15367 !! wikitext
15368 < div>foo< /div>
15369 !! html
15370 <p>&lt; div&gt;foo&lt; /div&gt;
15371 </p>
15372 !! end
15373
15374 ###
15375 ### Nesting tests (see bug 41545, 50604, 51081)
15376 ###
15377
15378 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
15379 # Note that html2wt is considerably more difficult if we use <b> in
15380 # the test case, instead of <big>
15381 !! test
15382 Ensure that HTML adoption agency algorithm is properly implemented.
15383 !! wikitext
15384 <big>X<big>Y</big>Z</big>
15385 !! html
15386 <p><big>X<big>Y</big>Z</big>
15387 </p>
15388 !! end
15389
15390 # This was bug 41545 in the PHP parser.
15391 # Note that tidy doesn't handle this correctly.
15392 !! test
15393 Nesting of <kbd>
15394 !! wikitext
15395 <kbd>X<kbd>Y</kbd>Z</kbd>
15396 !! html
15397 <p><kbd>X<kbd>Y</kbd>Z</kbd>
15398 </p>
15399 !! end
15400
15401 # The following cases were bug 51081 in the PHP parser.
15402 # Note that there are some other nestable tags (b, i, etc) which are
15403 # not covered; see bug 51081 for discussion.
15404
15405 # Note that tidy doesn't handle this correctly.
15406 !! test
15407 Nesting of <em>
15408 !! wikitext
15409 <em>X<em>Y</em>Z</em>
15410 !! html
15411 <p><em>X<em>Y</em>Z</em>
15412 </p>
15413 !! end
15414
15415 # Note that tidy doesn't handle this correctly.
15416 !! test
15417 Nesting of <strong>
15418 !! wikitext
15419 <strong>X<strong>Y</strong>Z</strong>
15420 !! html
15421 <p><strong>X<strong>Y</strong>Z</strong>
15422 </p>
15423 !! end
15424
15425 !! test
15426 Nesting of <q>
15427 !! wikitext
15428 <q>X<q>Y</q>Z</q>
15429 !! html+tidy
15430 <p><q>X<q>Y</q>Z</q></p>
15431 !! end
15432
15433 # Note that tidy doesn't handle this correctly.
15434 !! test
15435 Nesting of <ruby>
15436 !! wikitext
15437 <ruby>X<ruby>Y</ruby>Z</ruby>
15438 !! html
15439 <p><ruby>X<ruby>Y</ruby>Z</ruby>
15440 </p>
15441 !! end
15442
15443 # Note that tidy doesn't handle this correctly.
15444 !! test
15445 Nesting of <bdo>
15446 !! wikitext
15447 <bdo>X<bdo>Y</bdo>Z</bdo>
15448 !! html
15449 <p><bdo>X<bdo>Y</bdo>Z</bdo>
15450 </p>
15451 !! end
15452
15453
15454 ###
15455 ### Media links
15456 ###
15457
15458 !! test
15459 Media link
15460 !! wikitext
15461 [[Media:Foobar.jpg]]
15462 !! html
15463 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
15464 </p>
15465 !! end
15466
15467 !! test
15468 Media link with text
15469 !! wikitext
15470 [[Media:Foobar.jpg|A neat file to look at]]
15471 !! html
15472 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
15473 </p>
15474 !! end
15475
15476 # FIXME: this is still bad HTML tag nesting
15477 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
15478 !! test
15479 Media link with nasty text
15480 !! wikitext
15481 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
15482 !! html
15483 <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>
15484
15485 !! html+tidy
15486 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
15487 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
15488 !! end
15489
15490 !! test
15491 Media link to nonexistent file (bug 1702)
15492 !! wikitext
15493 [[Media:No such.jpg]]
15494 !! html
15495 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
15496 </p>
15497 !! end
15498
15499 !! test
15500 Image link to nonexistent file (bug 1850 - good)
15501 !! wikitext
15502 [[File:No_such.jpg]]
15503 !! html/php
15504 <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>
15505 </p>
15506 !! html/parsoid
15507 <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>
15508 !! end
15509
15510 !! test
15511 :Image link to nonexistent file (bug 1850 - bad)
15512 !! wikitext
15513 [[:Image:No such.jpg]]
15514 !! html/php
15515 <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>
15516 </p>
15517 !! html/parsoid
15518 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
15519 !! end
15520
15521
15522
15523 !! test
15524 Character reference normalization in link text (bug 1938)
15525 !! wikitext
15526 [[Main Page|this&that]]
15527 !! html
15528 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
15529 </p>
15530 !!end
15531
15532 !! article
15533 אַ
15534 !! text
15535 Test for unicode normalization
15536
15537 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
15538 !! endarticle
15539
15540 !! test
15541 (bug 19451) Links should refer to the normalized form.
15542 !! wikitext
15543 [[&#xFB2E;]]
15544 [[&#x5d0;&#x5b7;]]
15545 [[&#x5d0;ַ]]
15546 [[א&#x5b7;]]
15547 [[אַ]]
15548 !! html
15549 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
15550 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
15551 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
15552 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
15553 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
15554 </p>
15555 !! end
15556
15557 !! test
15558 Empty attribute crash test (bug 2067)
15559 !! wikitext
15560 <font color="">foo</font>
15561 !! html
15562 <p><font color="">foo</font>
15563 </p>
15564 !! end
15565
15566 !! test
15567 Empty attribute crash test single-quotes (bug 2067)
15568 !! wikitext
15569 <font color=''>foo</font>
15570 !! html
15571 <p><font color="">foo</font>
15572 </p>
15573 !! end
15574
15575 !! test
15576 Attribute test: equals, then nothing
15577 !! wikitext
15578 <font color=>foo</font>
15579 !! html
15580 <p><font>foo</font>
15581 </p>
15582 !! end
15583
15584 !! test
15585 Attribute test: unquoted value
15586 !! wikitext
15587 <font color=x>foo</font>
15588 !! html
15589 <p><font color="x">foo</font>
15590 </p>
15591 !! end
15592
15593 !! test
15594 Attribute test: unquoted but illegal value (hash)
15595 !! wikitext
15596 <font color=#x>foo</font>
15597 !! html
15598 <p><font color="#x">foo</font>
15599 </p>
15600 !! end
15601
15602 # Parsoid does not serialize to empty attribute syntax,
15603 # so wt2wt and html2wt cases are skipped
15604 !! test
15605 Attribute test: no value (T54330)
15606 !! options
15607 parsoid=wt2html,html2html
15608 !! wikitext
15609 <font color>foo</font>
15610 !! html/php
15611 <p><font color="">foo</font>
15612 </p>
15613 !! html/parsoid
15614 <p><font color="">foo</font></p>
15615 !! end
15616
15617 !! test
15618 Bug 2095: link with three closing brackets
15619 !! wikitext
15620 [[Main Page]]]
15621 !! html/php
15622 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
15623 </p>
15624 !! html/parsoid
15625 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
15626 !! end
15627
15628 !! test
15629 Bug 2095: link with pipe and three closing brackets
15630 !! wikitext
15631 [[Main Page|link]]]
15632 !! html/php
15633 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
15634 </p>
15635 !! html/parsoid
15636 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
15637 !! end
15638
15639 !! test
15640 Bug 2095: link with pipe and three closing brackets, version 2
15641 !! wikitext
15642 [[Main Page|[http://example.com/]]]
15643 !! html/php
15644 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
15645 </p>
15646 !! html/parsoid
15647 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
15648 !! end
15649
15650
15651 ###
15652 ### Safety
15653 ###
15654
15655 !! article
15656 Template:Dangerous attribute
15657 !! text
15658 " onmouseover="alert(document.cookie)
15659 !! endarticle
15660
15661 !! article
15662 Template:Dangerous style attribute
15663 !! text
15664 border-size: expression(alert(document.cookie))
15665 !! endarticle
15666
15667 !! article
15668 Template:Div style
15669 !! text
15670 <div style="float: right; {{{1}}}">Magic div</div>
15671 !! endarticle
15672
15673 !! test
15674 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
15675 !! wikitext
15676 <div title="{{test}}"></div>
15677 !! html
15678 <div title="This is a test template"></div>
15679
15680 !! end
15681
15682 # Parsoid has enough context to handle this case
15683 !! test
15684 Bug 2304: HTML attribute safety (dangerous template; 2309)
15685 !! wikitext
15686 <div title="{{dangerous attribute}}"></div>
15687 !! html/php
15688 <div title=""></div>
15689
15690 !! html/parsoid
15691 <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>
15692 !! end
15693
15694 !! test
15695 Bug 2304: HTML attribute safety (dangerous style template; 2309)
15696 !! wikitext
15697 <div style="{{dangerous style attribute}}"></div>
15698 !! html
15699 <div style="/* insecure input */"></div>
15700
15701 !! end
15702
15703 !! test
15704 Bug 2304: HTML attribute safety (safe parameter; 2309)
15705 !! wikitext
15706 {{div style|width: 200px}}
15707 !! html
15708 <div style="float: right; width: 200px">Magic div</div>
15709
15710 !! end
15711
15712 !! test
15713 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
15714 !! wikitext
15715 {{div style|width: expression(alert(document.cookie))}}
15716 !! html
15717 <div style="/* insecure input */">Magic div</div>
15718
15719 !! end
15720
15721 !! test
15722 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
15723 !! wikitext
15724 {{div style|"><script>alert(document.cookie)</script>}}
15725 !! html
15726 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15727
15728 !! end
15729
15730 !! test
15731 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
15732 !! wikitext
15733 {{div style|" ><script>alert(document.cookie)</script>}}
15734 !! html
15735 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15736
15737 !! end
15738
15739 !! test
15740 Bug 2304: HTML attribute safety (link)
15741 !! wikitext
15742 <div title="[[Main Page]]"></div>
15743 !! html
15744 <div title="&#91;&#91;Main Page]]"></div>
15745
15746 !! end
15747
15748 !! test
15749 Bug 2304: HTML attribute safety (italics)
15750 !! wikitext
15751 <div title="''foobar''"></div>
15752 !! html
15753 <div title="&#39;&#39;foobar&#39;&#39;"></div>
15754
15755 !! end
15756
15757 !! test
15758 Bug 2304: HTML attribute safety (bold)
15759 !! wikitext
15760 <div title="'''foobar'''"></div>
15761 !! html
15762 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
15763
15764 !! end
15765
15766
15767 !! test
15768 Bug 2304: HTML attribute safety (ISBN)
15769 !! wikitext
15770 <div title="ISBN 1234567890"></div>
15771 !! html
15772 <div title="&#73;SBN 1234567890"></div>
15773
15774 !! end
15775
15776 !! test
15777 Bug 2304: HTML attribute safety (RFC)
15778 !! wikitext
15779 <div title="RFC 1234"></div>
15780 !! html
15781 <div title="&#82;FC 1234"></div>
15782
15783 !! end
15784
15785 !! test
15786 Bug 2304: HTML attribute safety (PMID)
15787 !! wikitext
15788 <div title="PMID 1234567890"></div>
15789 !! html
15790 <div title="&#80;MID 1234567890"></div>
15791
15792 !! end
15793
15794 !! test
15795 Bug 2304: HTML attribute safety (web link)
15796 !! wikitext
15797 <div title="http://example.com/"></div>
15798 !! html
15799 <div title="http&#58;//example.com/"></div>
15800
15801 !! end
15802
15803 !! test
15804 Bug 2304: HTML attribute safety (named web link)
15805 !! wikitext
15806 <div title="[http://example.com/ link]"></div>
15807 !! html
15808 <div title="&#91;http&#58;//example.com/ link]"></div>
15809
15810 !! end
15811
15812 !! test
15813 Bug 3244: HTML attribute safety (extension; safe)
15814 !! wikitext
15815 <div style="<nowiki>background:blue</nowiki>"></div>
15816 !! html
15817 <div style="background:blue"></div>
15818
15819 !! end
15820
15821 !! test
15822 Bug 3244: HTML attribute safety (extension; unsafe)
15823 !! wikitext
15824 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
15825 !! html
15826 <div style="/* insecure input */"></div>
15827
15828 !! end
15829
15830 # More MSIE fun discovered by Tom Gilder
15831
15832 !! test
15833 MSIE CSS safety test: spurious slash
15834 !! wikitext
15835 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
15836 !! html
15837 <div style="/* insecure input */">evil</div>
15838
15839 !! end
15840
15841 !! test
15842 MSIE CSS safety test: hex code
15843 !! wikitext
15844 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
15845 !! html
15846 <div style="/* insecure input */">evil</div>
15847
15848 !! end
15849
15850 !! test
15851 MSIE CSS safety test: comment in url
15852 !! wikitext
15853 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
15854 !! html
15855 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
15856
15857 !! end
15858
15859 !! test
15860 MSIE CSS safety test: comment in expression
15861 !! wikitext
15862 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
15863 !! html
15864 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
15865
15866 !! end
15867
15868 !! test
15869 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
15870 !! wikitext
15871 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
15872 !! html
15873 <p style="/* invalid control char */">A</p>
15874
15875 !! end
15876
15877 !! test
15878 MSIE 6 CSS safety test: Fullwidth (bug 55332)
15879 !! wikitext
15880 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
15881 <div style="top:EXPRESSION(alert())">B</div>
15882 !! html
15883 <p style="/* insecure input */">A</p>
15884 <div style="/* insecure input */">B</div>
15885
15886 !! end
15887
15888 !! test
15889 MSIE 6 CSS safety test: IPA extensions (bug 55332)
15890 !! wikitext
15891 <div style="background-image:uʀʟ(javascript:alert())">A</div>
15892 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
15893 !! html
15894 <div style="/* insecure input */">A</div>
15895 <p style="/* insecure input */">B</p>
15896
15897 !! end
15898
15899 !! test
15900 MSIE 6 CSS safety test: sup/sub script (bug 55332)
15901 !! wikitext
15902 <div style="background-image:url⁽javascript:alert())">A</div>
15903 <div style="background-image:url₍javascript:alert())">B</div>
15904 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
15905 !! html
15906 <div style="/* insecure input */">A</div>
15907 <div style="/* insecure input */">B</div>
15908 <p style="/* insecure input */">C</p>
15909
15910 !! end
15911
15912 # FIXME: Parsoid fails to sanitize this! See T58846.
15913 !! test
15914 Opera -o-link CSS
15915 !! wikitext
15916 <div
15917 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;"
15918 style="-o-link:attr(title);-o-link-source:current">X</div>
15919 !! html
15920 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
15921
15922 !! end
15923
15924 !! test
15925 MSIE 6 CSS safety test: Repetition markers (bug 55332)
15926 !! wikitext
15927 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
15928 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
15929 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
15930 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
15931 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
15932 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
15933 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
15934 !! html
15935 <p style="/* insecure input */">A</p>
15936 <p style="/* insecure input */">B</p>
15937 <p style="/* insecure input */">C</p>
15938 <p style="/* insecure input */">D</p>
15939 <p style="/* insecure input */">E</p>
15940 <p style="/* insecure input */">F</p>
15941 <p style="/* insecure input */">G</p>
15942
15943 !! end
15944
15945 !! test
15946 Table attribute legitimate extension
15947 !! wikitext
15948 {|
15949 !+ style="<nowiki>color:blue</nowiki>"| status
15950 |}
15951 !! html
15952 <table>
15953 <tr>
15954 <th style="color:blue"> status
15955 </th></tr></table>
15956
15957 !!end
15958
15959 !! test
15960 Table attribute safety
15961 !! wikitext
15962 {|
15963 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
15964 |}
15965 !! html
15966 <table>
15967 <tr>
15968 <th style="/* insecure input */"> status
15969 </th></tr></table>
15970
15971 !! end
15972
15973 !! test
15974 CSS line continuation 1
15975 !! wikitext
15976 <div style="background-image: u\&#10;rl(test.jpg);"></div>
15977 !! html
15978 <div style="/* insecure input */"></div>
15979
15980 !! end
15981
15982 !! test
15983 CSS line continuation 2
15984 !! wikitext
15985 <div style="background-image: u\&#13;rl(test.jpg); "></div>
15986 !! html
15987 <div style="/* invalid control char */"></div>
15988
15989 !! end
15990
15991 !! article
15992 Template:Identity
15993 !! text
15994 {{{1}}}
15995 !! endarticle
15996
15997 !! test
15998 Expansion of multi-line templates in attribute values (bug 6255)
15999 !! wikitext
16000 <div style="background: {{identity|#00FF00}}">-</div>
16001 !! html
16002 <div style="background: #00FF00">-</div>
16003
16004 !! end
16005
16006
16007 !! test
16008 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16009 !! wikitext
16010 <div style="background:
16011 #00FF00">-</div>
16012 !! html/php
16013 <div style="background: #00FF00">-</div>
16014
16015 !! html/parsoid
16016 <div style="background:
16017 #00FF00">-</div>
16018 !! end
16019
16020 !! test
16021 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16022 !! wikitext
16023 <div style="background: &#10;#00FF00">-</div>
16024 !! html
16025 <div style="background: &#10;#00FF00">-</div>
16026
16027 !! end
16028
16029 !! test
16030 evil <math>-wiki-tags without Extension:Math enabled
16031 !! wikitext
16032 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
16033 !! html+tidy
16034 <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>
16035 !! end
16036
16037 ###
16038 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16039 ###
16040 !! test
16041 Parser hook: empty input
16042 !! wikitext
16043 <tag></tag>
16044 !! html/php
16045 <pre>
16046 ''
16047 array (
16048 )
16049 </pre>
16050
16051 !! end
16052
16053 !! test
16054 Parser hook: empty input using terminated empty elements
16055 !! wikitext
16056 <tag/>
16057 !! html/php
16058 <pre>
16059 NULL
16060 array (
16061 )
16062 </pre>
16063
16064 !! end
16065
16066 !! test
16067 Parser hook: empty input using terminated empty elements (space before)
16068 !! wikitext
16069 <tag />
16070 !! html/php
16071 <pre>
16072 NULL
16073 array (
16074 )
16075 </pre>
16076
16077 !! end
16078
16079 !! test
16080 Parser hook: basic input
16081 !! wikitext
16082 <tag>input</tag>
16083 !! html/php
16084 <pre>
16085 'input'
16086 array (
16087 )
16088 </pre>
16089
16090 !! end
16091
16092
16093 !! test
16094 Parser hook: case insensitive
16095 !! wikitext
16096 <TAG>input</TAG>
16097 !! html/php
16098 <pre>
16099 'input'
16100 array (
16101 )
16102 </pre>
16103
16104 !! end
16105
16106
16107 !! test
16108 Parser hook: case insensitive, redux
16109 !! wikitext
16110 <TaG>input</TAg>
16111 !! html/php
16112 <pre>
16113 'input'
16114 array (
16115 )
16116 </pre>
16117
16118 !! end
16119
16120 !! test
16121 Parser hook: nested tags
16122 !! options
16123 noxml
16124 !! wikitext
16125 <tag><tag></tag></tag>
16126 !! html/php
16127 <pre>
16128 '<tag>'
16129 array (
16130 )
16131 </pre>&lt;/tag&gt;
16132
16133 !! end
16134
16135 !! test
16136 Parser hook: basic arguments
16137 !! wikitext
16138 <tag width=200 height = "100" depth = '50' square></tag>
16139 !! html/php
16140 <pre>
16141 ''
16142 array (
16143 'width' => '200',
16144 'height' => '100',
16145 'depth' => '50',
16146 'square' => '',
16147 )
16148 </pre>
16149
16150 !! end
16151
16152 !! test
16153 Parser hook: argument containing a forward slash (bug 5344)
16154 !! wikitext
16155 <tag filename='/tmp/bla'></tag>
16156 !! html/php
16157 <pre>
16158 ''
16159 array (
16160 'filename' => '/tmp/bla',
16161 )
16162 </pre>
16163
16164 !! end
16165
16166 !! test
16167 Parser hook: empty input using terminated empty elements (bug 2374)
16168 !! wikitext
16169 <tag foo=bar/>text
16170 !! html/php
16171 <pre>
16172 NULL
16173 array (
16174 'foo' => 'bar',
16175 )
16176 </pre>text
16177
16178 !! end
16179
16180 # </tag> should be output literally since there is no matching tag that begins it
16181 !! test
16182 Parser hook: basic arguments using terminated empty elements (bug 2374)
16183 !! wikitext
16184 <tag width=200 height = "100" depth = '50' square/>
16185 other stuff
16186 </tag>
16187 !! html/php
16188 <pre>
16189 NULL
16190 array (
16191 'width' => '200',
16192 'height' => '100',
16193 'depth' => '50',
16194 'square' => '',
16195 )
16196 </pre>
16197 <p>other stuff
16198 &lt;/tag&gt;
16199 </p>
16200 !! end
16201
16202 ###
16203 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
16204 ###
16205
16206 !! test
16207 Parser hook: static parser hook not inside a comment
16208 !! wikitext
16209 <statictag>hello, world</statictag>
16210 <statictag action=flush/>
16211 !! html/php
16212 <p>hello, world
16213 </p>
16214 !! end
16215
16216
16217 !! test
16218 Parser hook: static parser hook inside a comment
16219 !! wikitext
16220 <!-- <statictag>hello, world</statictag> -->
16221 <statictag action=flush/>
16222 !! html/php
16223 <p><br />
16224 </p>
16225 !! end
16226
16227 # Nested template calls; this case was broken by Parser.php rev 1.506,
16228 # since reverted.
16229
16230 !! article
16231 Template:One-parameter
16232 !! text
16233 (My parameter is: {{{1}}})
16234 !! endarticle
16235
16236 !! article
16237 Template:Map-one-parameter
16238 !! text
16239 {{{{{1}}}|{{{2}}}}}
16240 !! endarticle
16241
16242 !! test
16243 Nested template calls
16244 !! wikitext
16245 {{Map-one-parameter|One-parameter|param}}
16246 !! html
16247 <p>(My parameter is: param)
16248 </p>
16249 !! end
16250
16251
16252 ###
16253 ### Sanitizer
16254 ###
16255
16256 # HTML+Tidy effectively strips out the empty tags completely
16257 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
16258 # which Tidy would have done for the PHP parser had there been content inside it.
16259 !! test
16260 Sanitizer: Closing of open tags
16261 !! wikitext
16262 <s></s><table></table>
16263 !! html
16264 <s></s><table></table>
16265
16266 !! html/parsoid
16267 <p><s></s></p><table></table>
16268 !! end
16269
16270 !! test
16271 Sanitizer: Closing of open but not closed tags
16272 !! wikitext
16273 <s>foo
16274 !! html
16275 <p><s>foo</s>
16276 </p>
16277 !! end
16278
16279 !! test
16280 Sanitizer: Closing of closed but not open tags
16281 !! options
16282 parsoid=wt2html
16283 !! wikitext
16284 </s>
16285 !! html/php+tidy
16286 !! html/parsoid
16287 !! end
16288
16289 !! test
16290 Sanitizer: Closing of closed but not open table tags
16291 !! options
16292 parsoid=wt2html
16293 !! wikitext
16294 Table not started</td></tr></table>
16295 !! html/php+tidy
16296 <p>Table not started</p>
16297 !! html/parsoid
16298 <p>Table not started</p>
16299 !! end
16300
16301 !! test
16302 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
16303 !! wikitext
16304 <span id="æ: v">byte</span>[[#æ: v|backlink]]
16305 !! html
16306 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
16307 </p>
16308 !! end
16309
16310 # In HTML5, the restrictions are that id must contain at least one character,
16311 # and must not contain any space characters.
16312 !! test
16313 Sanitizer: Validating the contents of the id attribute (bug 4515)
16314 !! options
16315 disabled
16316 !! wikitext
16317 <br id="" /><br id="a space" />
16318 !! html
16319 Something ...
16320 !! end
16321
16322 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
16323 !! test
16324 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
16325 !! options
16326 disabled
16327 !! wikitext
16328 <br id="foo" /><br id="foo" />
16329 !! html
16330 Something need to be done. foo-2 ?
16331 !! end
16332
16333 !! test
16334 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
16335 !! wikitext
16336 <div itemscope>
16337 <meta itemprop="hello" content="world">
16338 <meta http-equiv="refresh" content="5">
16339 <meta itemprop="hello" http-equiv="refresh" content="5">
16340 <link itemprop="hello" href="{{SERVER}}">
16341 <link rel="stylesheet" href="{{SERVER}}">
16342 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
16343 </div>
16344 !! html
16345 <div itemscope="">
16346 <p> <meta itemprop="hello" content="world" />
16347 &lt;meta http-equiv="refresh" content="5"&gt;
16348 <meta itemprop="hello" content="5" />
16349 </p>
16350 <link itemprop="hello" href="http&#58;//example.org" />
16351 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
16352 <link itemprop="hello" href="http&#58;//example.org" />
16353 </div>
16354
16355 !! end
16356
16357 !! test
16358 Language converter: output gets cut off unexpectedly (bug 5757)
16359 !! options
16360 language=zh
16361 !! wikitext
16362 this bit is safe: }-
16363
16364 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
16365
16366 then we get cut off here: }-
16367
16368 all additional text is vanished
16369 !! html
16370 <p>this bit is safe: }-
16371 </p><p>but if we add a conversion instance: xxx
16372 </p><p>then we get cut off here: }-
16373 </p><p>all additional text is vanished
16374 </p>
16375 !! end
16376
16377 !! test
16378 Self closed html pairs (bug 5487)
16379 !! options
16380 !! wikitext
16381 <center><font id="bug" />Centered text</center>
16382 <div><font id="bug2" />In div text</div>
16383 !! html
16384 <center>&lt;font id="bug" /&gt;Centered text</center>
16385 <div>&lt;font id="bug2" /&gt;In div text</div>
16386
16387 !! end
16388
16389 #
16390 #
16391 #
16392
16393 !! test
16394 Punctuation: nbsp before exclamation
16395 !! wikitext
16396 C'est grave !
16397 !! html
16398 <p>C'est grave&#160;!
16399 </p>
16400 !! end
16401
16402 !! test
16403 Punctuation: CSS !important (bug 11874)
16404 !! wikitext
16405 <div style="width:50% !important">important</div>
16406 !! html
16407 <div style="width:50% !important">important</div>
16408
16409 !!end
16410
16411 !! test
16412 Punctuation: CSS ! important (bug 11874; with space after)
16413 !! wikitext
16414 <div style="width:50% ! important">important</div>
16415 !! html
16416 <div style="width:50% ! important">important</div>
16417
16418 !!end
16419
16420 !! test
16421 HTML bullet list, closed tags (bug 5497)
16422 !! wikitext
16423 <ul>
16424 <li>One</li>
16425 <li>Two</li>
16426 </ul>
16427 !! html/php
16428 <ul>
16429 <li>One</li>
16430 <li>Two</li>
16431 </ul>
16432
16433 !! html/parsoid
16434 <ul data-parsoid='{"stx":"html"}'>
16435 <li data-parsoid='{"stx":"html"}'>One</li>
16436 <li data-parsoid='{"stx":"html"}'>Two</li>
16437 </ul>
16438
16439 !! end
16440
16441 !! test
16442 HTML bullet list, unclosed tags (bug 5497)
16443 !! wikitext
16444 <ul>
16445 <li>One
16446 <li>Two
16447 </ul>
16448 !! html/php+tidy
16449 <ul>
16450 <li>One</li>
16451 <li>Two</li>
16452 </ul>
16453 !! html/parsoid
16454 <ul data-parsoid='{"stx":"html"}'>
16455 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16456 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16457 </ul>
16458
16459 !! end
16460
16461 !! test
16462 HTML ordered list, closed tags (bug 5497)
16463 !! wikitext
16464 <ol>
16465 <li>One</li>
16466 <li>Two</li>
16467 </ol>
16468 !! html/php
16469 <ol>
16470 <li>One</li>
16471 <li>Two</li>
16472 </ol>
16473
16474 !! html/parsoid
16475 <ol data-parsoid='{"stx":"html"}'>
16476 <li data-parsoid='{"stx":"html"}'>One</li>
16477 <li data-parsoid='{"stx":"html"}'>Two</li>
16478 </ol>
16479
16480 !! end
16481
16482 !! test
16483 HTML ordered list, unclosed tags (bug 5497)
16484 !! options
16485 !! wikitext
16486 <ol>
16487 <li>One
16488 <li>Two
16489 </ol>
16490 !! html/php+tidy
16491 <ol>
16492 <li>One</li>
16493 <li>Two</li>
16494 </ol>
16495 !! html/parsoid
16496 <ol data-parsoid='{"stx":"html"}'>
16497 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16498 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16499 </ol>
16500
16501 !! end
16502
16503 !! test
16504 HTML nested bullet list, closed tags (bug 5497)
16505 !! wikitext
16506 <ul>
16507 <li>One</li>
16508 <li>Two:
16509 <ul>
16510 <li>Sub-one</li>
16511 <li>Sub-two</li>
16512 </ul>
16513 </li>
16514 </ul>
16515 !! html
16516 <ul>
16517 <li>One</li>
16518 <li>Two:
16519 <ul>
16520 <li>Sub-one</li>
16521 <li>Sub-two</li>
16522 </ul>
16523 </li>
16524 </ul>
16525
16526 !! end
16527
16528 !! test
16529 HTML nested bullet list, open tags (bug 5497)
16530 !! wikitext
16531 <ul>
16532 <li>One
16533 <li>Two:
16534 <ul>
16535 <li>Sub-one
16536 <li>Sub-two
16537 </ul>
16538 </ul>
16539 !! html/php+tidy
16540 <ul>
16541 <li>One</li>
16542 <li>Two:
16543 <ul>
16544 <li>Sub-one</li>
16545 <li>Sub-two</li>
16546 </ul>
16547 </li>
16548 </ul>
16549 !! html/parsoid
16550 <ul>
16551 <li>One
16552 </li>
16553 <li>Two:
16554 <ul>
16555 <li>Sub-one
16556 </li>
16557 <li>Sub-two
16558 </li>
16559 </ul>
16560 </li>
16561 </ul>
16562
16563 !! end
16564
16565 !! test
16566 HTML nested ordered list, closed tags (bug 5497)
16567 !! wikitext
16568 <ol>
16569 <li>One</li>
16570 <li>Two:
16571 <ol>
16572 <li>Sub-one</li>
16573 <li>Sub-two</li>
16574 </ol>
16575 </li>
16576 </ol>
16577 !! html
16578 <ol>
16579 <li>One</li>
16580 <li>Two:
16581 <ol>
16582 <li>Sub-one</li>
16583 <li>Sub-two</li>
16584 </ol>
16585 </li>
16586 </ol>
16587
16588 !! end
16589
16590 !! test
16591 HTML nested ordered list, open tags (bug 5497)
16592 !! wikitext
16593 <ol>
16594 <li>One
16595 <li>Two:
16596 <ol>
16597 <li>Sub-one
16598 <li>Sub-two
16599 </ol>
16600 </ol>
16601 !! html/php
16602 <ol>
16603 <li>One
16604 <li>Two:
16605 <ol>
16606 <li>Sub-one
16607 <li>Sub-two
16608 </ol>
16609 </ol>
16610
16611 !! html/parsoid
16612 <ol>
16613 <li>One
16614 </li>
16615 <li>Two:
16616 <ol>
16617 <li>Sub-one
16618 </li>
16619 <li>Sub-two
16620 </li>
16621 </ol>
16622 </li>
16623 </ol>
16624
16625 !! end
16626
16627 !! test
16628 HTML ordered list item with parameters oddity
16629 !! wikitext
16630 <ol><li id="fragment">One</li>
16631 </ol>
16632 !! html
16633 <ol><li id="fragment">One</li>
16634 </ol>
16635
16636 !! end
16637
16638 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
16639 !!test
16640 bug 5918: autonumbering
16641 !! wikitext
16642 [http://first/] [http://second] [ftp://ftp]
16643
16644 ftp://inlineftp
16645
16646 [mailto:enclosed@mail.tld With target]
16647
16648 [mailto:enclosed@mail.tld]
16649
16650 mailto:inline@mail.tld
16651 !! html/php
16652 <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>
16653 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
16654 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
16655 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
16656 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
16657 </p>
16658 !! html/parsoid
16659 <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>
16660 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
16661 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
16662 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
16663 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
16664 !! end
16665
16666
16667 #
16668 # Security and HTML correctness
16669 # From Nick Jenkins' fuzz testing
16670 #
16671
16672 !! test
16673 Fuzz testing: Parser13
16674 !! wikitext
16675 {|
16676 | http://a|
16677 !! html
16678 <table>
16679 <tr>
16680 <td>
16681 </td>
16682 </tr>
16683 </table>
16684
16685 !! end
16686
16687 !! test
16688 Fuzz testing: Parser14
16689 !! wikitext
16690 == onmouseover= ==
16691 http://__TOC__
16692 !! html
16693 <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>
16694 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16695 <ul>
16696 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16697 </ul>
16698 </div>
16699
16700
16701 !! html+tidy
16702 <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>
16703 <p>http://</p>
16704 <div id="toc" class="toc">
16705 <div id="toctitle">
16706 <h2>Contents</h2>
16707 </div>
16708 <ul>
16709 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16710 </ul>
16711 </div>
16712 <p></p>
16713 !! end
16714
16715 !! test
16716 Fuzz testing: Parser14-table
16717 !! wikitext
16718 ==a==
16719 {| STYLE=__TOC__
16720 !! html
16721 <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>
16722 <table style="&#95;_TOC&#95;_">
16723 <tr><td></td></tr>
16724 </table>
16725
16726 !! html+tidy
16727 <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>
16728 <table style="__TOC__">
16729 <tr>
16730 <td></td>
16731 </tr>
16732 </table>
16733 !! end
16734
16735 # Known to produce bogus xml (extra </td>)
16736 !! test
16737 Fuzz testing: Parser16
16738 !! options
16739 noxml
16740 !! wikitext
16741 {|
16742 !https://||||||
16743 !! html
16744 <table>
16745 <tr>
16746 <th>https://</th>
16747 <th></th>
16748 <th></th>
16749 <th>
16750 </td>
16751 </tr>
16752 </table>
16753
16754 !! html+tidy
16755 <table>
16756 <tr>
16757 <th>https://</th>
16758 <th></th>
16759 <th></th>
16760 <th></th>
16761 </tr>
16762 </table>
16763 !! end
16764
16765 !! test
16766 Fuzz testing: Parser21
16767 !! wikitext
16768 {|
16769 ! irc://{{ftp://a" onmouseover="alert('hello world');"
16770 |
16771 !! html
16772 <table>
16773 <tr>
16774 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
16775 </th>
16776 <td>
16777 </td>
16778 </tr>
16779 </table>
16780
16781 !! end
16782
16783 !! test
16784 Fuzz testing: Parser22
16785 !! wikitext
16786 http://===r:::https://b
16787
16788 {|
16789 !! html
16790 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
16791 </p>
16792 <table>
16793 <tr><td></td></tr>
16794 </table>
16795
16796 !! end
16797
16798 # Known to produce bad XML for now
16799 !! test
16800 Fuzz testing: Parser24
16801 !! options
16802 noxml
16803 !! wikitext
16804 {|
16805 {{{|
16806 <u CLASS=
16807 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
16808 <br style="onmouseover='alert(document.cookie);' " />
16809
16810 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
16811 |
16812 !! html
16813 <table>
16814 {{{|
16815 <u class="&#124;">}}}} &gt;
16816 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
16817
16818 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
16819 <tr>
16820 <td></u>
16821 </td>
16822 </tr>
16823 </table>
16824
16825 !! end
16826
16827 # Note: the current result listed for this is not what the original one was,
16828 # but the original bug was JavaScript injection, which is fixed in any case.
16829 # It's not clear that the original result listed was any more correct than the
16830 # current one. Original result:
16831 # <p>{{{|
16832 # </p>
16833 # <li class="&#124;&#124;">
16834 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
16835 !!test
16836 Fuzz testing: Parser25 (bug 6055)
16837 !! wikitext
16838 {{{
16839 |
16840 <LI CLASS=||
16841 >
16842 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
16843 !! html
16844 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
16845 </p>
16846 !! end
16847
16848 !!test
16849 Fuzz testing: URL adjacent extension (with space, clean)
16850 !! wikitext
16851 http://example.com <nowiki>junk</nowiki>
16852 !! html/php
16853 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
16854 </p>
16855 !! html/parsoid
16856 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
16857 !! end
16858
16859 !!test
16860 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
16861 !! wikitext
16862 http://example.com<nowiki>junk</nowiki>
16863 !! html/php
16864 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
16865 </p>
16866 !! html/parsoid
16867 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
16868 !! end
16869
16870 !!test
16871 Fuzz testing: URL adjacent extension (no space, dirty; pre)
16872 !! wikitext
16873 http://example.com<pre>junk</pre>
16874 !! html/php
16875 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
16876
16877 !! html/php+tidy
16878 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
16879 <pre>
16880 junk
16881 </pre>
16882 !! html/parsoid
16883 <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>
16884 !!end
16885
16886 !!test
16887 Fuzz testing: image with bogus manual thumbnail
16888 !! wikitext
16889 [[Image:foobar.jpg|thumbnail= ]]
16890 !! html/php
16891 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
16892
16893 !! html/parsoid
16894 <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>
16895 !!end
16896
16897 !! test
16898 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
16899 !! wikitext
16900 <pre dir="&#10;"></pre>
16901 !! html
16902 <pre dir="&#10;"></pre>
16903
16904 !! end
16905
16906 !! test
16907 Parsing optional HTML elements (Bug 6171)
16908 !! options
16909 !! wikitext
16910 <table>
16911 <tr>
16912 <td> Some tabular data</td>
16913 <td> More tabular data ...
16914 <td> And yet som tabular data</td>
16915 </tr>
16916 </table>
16917 !! html
16918 <table>
16919 <tr>
16920 <td> Some tabular data</td>
16921 <td> More tabular data ...
16922 </td><td> And yet som tabular data</td>
16923 </tr>
16924 </table>
16925
16926 !! end
16927
16928 !! test
16929 Correct handling of <td>, <tr> (Bug 6171)
16930 !! options
16931 !! wikitext
16932 <table>
16933 <tr>
16934 <td> Some tabular data</td>
16935 <td> More tabular data ...</td>
16936 <td> And yet som tabular data</td>
16937 </tr>
16938 </table>
16939 !! html
16940 <table>
16941 <tr>
16942 <td> Some tabular data</td>
16943 <td> More tabular data ...</td>
16944 <td> And yet som tabular data</td>
16945 </tr>
16946 </table>
16947
16948 !! end
16949
16950
16951 !! test
16952 Parsing crashing regression (fr:JavaScript)
16953 !! wikitext
16954 </body></x>
16955 !! html
16956 <p>&lt;/body&gt;&lt;/x&gt;
16957 </p>
16958 !! end
16959
16960 !! test
16961 Inline wiki vs wiki block nesting
16962 !! wikitext
16963 '''Bold paragraph
16964
16965 New wiki paragraph
16966 !! html
16967 <p><b>Bold paragraph</b>
16968 </p><p>New wiki paragraph
16969 </p>
16970 !! end
16971
16972 # FIXME: The current php output is documented
16973 # and desired output is the parsoid target.
16974 !! test
16975 Inline HTML vs wiki block nesting
16976 !! wikitext
16977 <b>Bold paragraph
16978
16979 New wiki paragraph
16980 !! html/php
16981 <p><b>Bold paragraph
16982 </p><p>New wiki paragraph</b>
16983 </p>
16984 !! html/parsoid
16985 <p><b>Bold paragraph</b>
16986 </p><p>New wiki paragraph
16987 </p>
16988 !! end
16989
16990 # Original result was this:
16991 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
16992 # </p>
16993 # While that might be marginally more intuitive, maybe, the six-apostrophe
16994 # construct is clearly pathological and the result stated here (which is what
16995 # the parser actually does) is about as reasonable as anything.
16996 !!test
16997 Mixing markup for italics and bold
16998 !! options
16999 !! wikitext
17000 '''bold''''''bold''bolditalics'''''
17001 !! html
17002 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
17003 </p>
17004 !! end
17005
17006
17007 !! article
17008 Xyzzyx
17009 !! text
17010 Article for special page transclusion test
17011 !! endarticle
17012
17013 !! test
17014 Special page transclusion
17015 !! options
17016 !! wikitext
17017 {{Special:Prefixindex/Xyzzyx}}
17018 !! html
17019 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
17020
17021 !! end
17022
17023 !! test
17024 Special page transclusion twice (bug 5021)
17025 !! options
17026 !! wikitext
17027 {{Special:Prefixindex/Xyzzyx}}
17028 {{Special:Prefixindex/Xyzzyx}}
17029 !! html
17030 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
17031 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
17032
17033 !! end
17034
17035 !! test
17036 Transclusion of default MediaWiki message
17037 !! wikitext
17038 {{MediaWiki:Mainpage}}
17039 !! html
17040 <p>Main Page
17041 </p>
17042 !! end
17043
17044 !! test
17045 Transclusion of nonexistent MediaWiki message
17046 !! wikitext
17047 {{MediaWiki:Mainpagexxx}}
17048 !! html
17049 <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>
17050 </p>
17051 !! end
17052
17053 !! test
17054 Transclusion of MediaWiki message with underscore
17055 !! wikitext
17056 {{MediaWiki:history_short}}
17057 !! html
17058 <p>History
17059 </p>
17060 !! end
17061
17062 !! test
17063 Transclusion of MediaWiki message with space
17064 !! wikitext
17065 {{MediaWiki:history short}}
17066 !! html
17067 <p>History
17068 </p>
17069 !! end
17070
17071 !! test
17072 Invalid header with following text
17073 !! wikitext
17074 = x = y
17075 !! html
17076 <p>= x = y
17077 </p>
17078 !! end
17079
17080
17081 !! test
17082 Section extraction test (section 0)
17083 !! options
17084 section=0
17085 !! wikitext
17086 start
17087 ==a==
17088 ===aa===
17089 ====aaa====
17090 ==b==
17091 ===ba===
17092 ===bb===
17093 ====bba====
17094 ===bc===
17095 ==c==
17096 ===ca===
17097 !! html/php
17098 start
17099 !! end
17100
17101 !! test
17102 Section extraction test (section 1)
17103 !! options
17104 section=1
17105 !! wikitext
17106 start
17107 ==a==
17108 ===aa===
17109 ====aaa====
17110 ==b==
17111 ===ba===
17112 ===bb===
17113 ====bba====
17114 ===bc===
17115 ==c==
17116 ===ca===
17117 !! html/php
17118 ==a==
17119 ===aa===
17120 ====aaa====
17121 !! end
17122
17123 !! test
17124 Section extraction test (section 2)
17125 !! options
17126 section=2
17127 !! wikitext
17128 start
17129 ==a==
17130 ===aa===
17131 ====aaa====
17132 ==b==
17133 ===ba===
17134 ===bb===
17135 ====bba====
17136 ===bc===
17137 ==c==
17138 ===ca===
17139 !! html/php
17140 ===aa===
17141 ====aaa====
17142 !! end
17143
17144 !! test
17145 Section extraction test (section 3)
17146 !! options
17147 section=3
17148 !! wikitext
17149 start
17150 ==a==
17151 ===aa===
17152 ====aaa====
17153 ==b==
17154 ===ba===
17155 ===bb===
17156 ====bba====
17157 ===bc===
17158 ==c==
17159 ===ca===
17160 !! html/php
17161 ====aaa====
17162 !! end
17163
17164 !! test
17165 Section extraction test (section 4)
17166 !! options
17167 section=4
17168 !! wikitext
17169 start
17170 ==a==
17171 ===aa===
17172 ====aaa====
17173 ==b==
17174 ===ba===
17175 ===bb===
17176 ====bba====
17177 ===bc===
17178 ==c==
17179 ===ca===
17180 !! html/php
17181 ==b==
17182 ===ba===
17183 ===bb===
17184 ====bba====
17185 ===bc===
17186 !! end
17187
17188 !! test
17189 Section extraction test (section 5)
17190 !! options
17191 section=5
17192 !! wikitext
17193 start
17194 ==a==
17195 ===aa===
17196 ====aaa====
17197 ==b==
17198 ===ba===
17199 ===bb===
17200 ====bba====
17201 ===bc===
17202 ==c==
17203 ===ca===
17204 !! html/php
17205 ===ba===
17206 !! end
17207
17208 !! test
17209 Section extraction test (section 6)
17210 !! options
17211 section=6
17212 !! wikitext
17213 start
17214 ==a==
17215 ===aa===
17216 ====aaa====
17217 ==b==
17218 ===ba===
17219 ===bb===
17220 ====bba====
17221 ===bc===
17222 ==c==
17223 ===ca===
17224 !! html/php
17225 ===bb===
17226 ====bba====
17227 !! end
17228
17229 !! test
17230 Section extraction test (section 7)
17231 !! options
17232 section=7
17233 !! wikitext
17234 start
17235 ==a==
17236 ===aa===
17237 ====aaa====
17238 ==b==
17239 ===ba===
17240 ===bb===
17241 ====bba====
17242 ===bc===
17243 ==c==
17244 ===ca===
17245 !! html/php
17246 ====bba====
17247 !! end
17248
17249 !! test
17250 Section extraction test (section 8)
17251 !! options
17252 section=8
17253 !! wikitext
17254 start
17255 ==a==
17256 ===aa===
17257 ====aaa====
17258 ==b==
17259 ===ba===
17260 ===bb===
17261 ====bba====
17262 ===bc===
17263 ==c==
17264 ===ca===
17265 !! html/php
17266 ===bc===
17267 !! end
17268
17269 !! test
17270 Section extraction test (section 9)
17271 !! options
17272 section=9
17273 !! wikitext
17274 start
17275 ==a==
17276 ===aa===
17277 ====aaa====
17278 ==b==
17279 ===ba===
17280 ===bb===
17281 ====bba====
17282 ===bc===
17283 ==c==
17284 ===ca===
17285 !! html/php
17286 ==c==
17287 ===ca===
17288 !! end
17289
17290 !! test
17291 Section extraction test (section 10)
17292 !! options
17293 section=10
17294 !! wikitext
17295 start
17296 ==a==
17297 ===aa===
17298 ====aaa====
17299 ==b==
17300 ===ba===
17301 ===bb===
17302 ====bba====
17303 ===bc===
17304 ==c==
17305 ===ca===
17306 !! html/php
17307 ===ca===
17308 !! end
17309
17310 !! test
17311 Section extraction test (nonexistent section 11)
17312 !! options
17313 section=11
17314 !! wikitext
17315 start
17316 ==a==
17317 ===aa===
17318 ====aaa====
17319 ==b==
17320 ===ba===
17321 ===bb===
17322 ====bba====
17323 ===bc===
17324 ==c==
17325 ===ca===
17326 !! html/php
17327 !! end
17328
17329 !! test
17330 Section extraction test with bogus heading (section 1)
17331 !! options
17332 section=1
17333 !! wikitext
17334 ==a==
17335 ==bogus== not a legal section
17336 ==b==
17337 !! html/php
17338 ==a==
17339 ==bogus== not a legal section
17340 !! end
17341
17342 !! test
17343 Section extraction test with bogus heading (section 2)
17344 !! options
17345 section=2
17346 !! wikitext
17347 ==a==
17348 ==bogus== not a legal section
17349 ==b==
17350 !! html/php
17351 ==b==
17352 !! end
17353
17354 !! test
17355 Section extraction test with comment after heading (section 1)
17356 !! options
17357 section=1
17358 !! wikitext
17359 ==a==
17360 ==b== <!-- -->
17361 ==c==
17362 !! html/php
17363 ==a==
17364 !! end
17365
17366 !! test
17367 Section extraction test with comment after heading (section 2)
17368 !! options
17369 section=2
17370 !! wikitext
17371 ==a==
17372 ==b== <!-- -->
17373 ==c==
17374 !! html/php
17375 ==b== <!-- -->
17376 !! end
17377
17378 !! test
17379 Section extraction test with bogus <nowiki> heading (section 1)
17380 !! options
17381 section=1
17382 !! wikitext
17383 ==a==
17384 ==bogus== <nowiki>not a legal section</nowiki>
17385 ==b==
17386 !! html/php
17387 ==a==
17388 ==bogus== <nowiki>not a legal section</nowiki>
17389 !! end
17390
17391 !! test
17392 Section extraction test with bogus <nowiki> heading (section 2)
17393 !! options
17394 section=2
17395 !! wikitext
17396 ==a==
17397 ==bogus== <nowiki>not a legal section</nowiki>
17398 ==b==
17399 !! html/php
17400 ==b==
17401 !! end
17402
17403 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
17404 # instead of respecting commented sections
17405 !! test
17406 Section extraction prefixed by comment (section 1)
17407 !! options
17408 section=1
17409 !! wikitext
17410 <!-- -->==sec1==
17411 ==sec2==
17412 !! html/php
17413 ==sec2==
17414 !!end
17415
17416 !! test
17417 Section extraction prefixed by comment (section 2)
17418 !! options
17419 section=2
17420 !! wikitext
17421 <!-- -->==sec1==
17422 ==sec2==
17423 !! html/php
17424
17425 !!end
17426
17427 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
17428 # instead of respecting HTML-style headings
17429 !! test
17430 Section extraction, mixed wiki and html (section 1)
17431 !! options
17432 section=1
17433 !! wikitext
17434 <h2>unmarked</h2>
17435 unmarked
17436 ==1==
17437 one
17438 ==2==
17439 two
17440 !! html/php
17441 ==1==
17442 one
17443 !! end
17444
17445 !! test
17446 Section extraction, mixed wiki and html (section 2)
17447 !! options
17448 section=2
17449 !! wikitext
17450 <h2>unmarked</h2>
17451 unmarked
17452 ==1==
17453 one
17454 ==2==
17455 two
17456 !! html/php
17457 ==2==
17458 two
17459 !! end
17460
17461
17462 # Formerly testing for bug 3342
17463 !! test
17464 Section extraction, heading surrounded by <noinclude>
17465 !! options
17466 section=1
17467 !! wikitext
17468 <noinclude>==unmarked==</noinclude>
17469 ==marked==
17470 !! html/php
17471 ==marked==
17472 !!end
17473
17474 # Test behavior of bug 19910
17475 !! test
17476 Sectiion with all-equals
17477 !! options
17478 section=2
17479 !! wikitext
17480 ===
17481 The line above must have a trailing space
17482 === <!--
17483 --> <!-- -->
17484 But just in case it doesn't...
17485 !! html/php
17486 === <!--
17487 --> <!-- -->
17488 But just in case it doesn't...
17489 !! end
17490
17491 !! test
17492 Section replacement test (section 0)
17493 !! options
17494 replace=0,"xxx"
17495 !! wikitext
17496 start
17497 ==a==
17498 ===aa===
17499 ====aaa====
17500 ==b==
17501 ===ba===
17502 ===bb===
17503 ====bba====
17504 ===bc===
17505 ==c==
17506 ===ca===
17507 !! html/php
17508 xxx
17509
17510 ==a==
17511 ===aa===
17512 ====aaa====
17513 ==b==
17514 ===ba===
17515 ===bb===
17516 ====bba====
17517 ===bc===
17518 ==c==
17519 ===ca===
17520 !! end
17521
17522 !! test
17523 Section replacement test (section 1)
17524 !! options
17525 replace=1,"xxx"
17526 !! wikitext
17527 start
17528 ==a==
17529 ===aa===
17530 ====aaa====
17531 ==b==
17532 ===ba===
17533 ===bb===
17534 ====bba====
17535 ===bc===
17536 ==c==
17537 ===ca===
17538 !! html/php
17539 start
17540 xxx
17541
17542 ==b==
17543 ===ba===
17544 ===bb===
17545 ====bba====
17546 ===bc===
17547 ==c==
17548 ===ca===
17549 !! end
17550
17551 !! test
17552 Section replacement test (section 2)
17553 !! options
17554 replace=2,"xxx"
17555 !! wikitext
17556 start
17557 ==a==
17558 ===aa===
17559 ====aaa====
17560 ==b==
17561 ===ba===
17562 ===bb===
17563 ====bba====
17564 ===bc===
17565 ==c==
17566 ===ca===
17567 !! html/php
17568 start
17569 ==a==
17570 xxx
17571
17572 ==b==
17573 ===ba===
17574 ===bb===
17575 ====bba====
17576 ===bc===
17577 ==c==
17578 ===ca===
17579 !! end
17580
17581 !! test
17582 Section replacement test (section 3)
17583 !! options
17584 replace=3,"xxx"
17585 !! wikitext
17586 start
17587 ==a==
17588 ===aa===
17589 ====aaa====
17590 ==b==
17591 ===ba===
17592 ===bb===
17593 ====bba====
17594 ===bc===
17595 ==c==
17596 ===ca===
17597 !! html/php
17598 start
17599 ==a==
17600 ===aa===
17601 xxx
17602
17603 ==b==
17604 ===ba===
17605 ===bb===
17606 ====bba====
17607 ===bc===
17608 ==c==
17609 ===ca===
17610 !! end
17611
17612 !! test
17613 Section replacement test (section 4)
17614 !! options
17615 replace=4,"xxx"
17616 !! wikitext
17617 start
17618 ==a==
17619 ===aa===
17620 ====aaa====
17621 ==b==
17622 ===ba===
17623 ===bb===
17624 ====bba====
17625 ===bc===
17626 ==c==
17627 ===ca===
17628 !! html/php
17629 start
17630 ==a==
17631 ===aa===
17632 ====aaa====
17633 xxx
17634
17635 ==c==
17636 ===ca===
17637 !! end
17638
17639 !! test
17640 Section replacement test (section 5)
17641 !! options
17642 replace=5,"xxx"
17643 !! wikitext
17644 start
17645 ==a==
17646 ===aa===
17647 ====aaa====
17648 ==b==
17649 ===ba===
17650 ===bb===
17651 ====bba====
17652 ===bc===
17653 ==c==
17654 ===ca===
17655 !! html/php
17656 start
17657 ==a==
17658 ===aa===
17659 ====aaa====
17660 ==b==
17661 xxx
17662
17663 ===bb===
17664 ====bba====
17665 ===bc===
17666 ==c==
17667 ===ca===
17668 !! end
17669
17670 !! test
17671 Section replacement test (section 6)
17672 !! options
17673 replace=6,"xxx"
17674 !! wikitext
17675 start
17676 ==a==
17677 ===aa===
17678 ====aaa====
17679 ==b==
17680 ===ba===
17681 ===bb===
17682 ====bba====
17683 ===bc===
17684 ==c==
17685 ===ca===
17686 !! html/php
17687 start
17688 ==a==
17689 ===aa===
17690 ====aaa====
17691 ==b==
17692 ===ba===
17693 xxx
17694
17695 ===bc===
17696 ==c==
17697 ===ca===
17698 !! end
17699
17700 !! test
17701 Section replacement test (section 7)
17702 !! options
17703 replace=7,"xxx"
17704 !! wikitext
17705 start
17706 ==a==
17707 ===aa===
17708 ====aaa====
17709 ==b==
17710 ===ba===
17711 ===bb===
17712 ====bba====
17713 ===bc===
17714 ==c==
17715 ===ca===
17716 !! html/php
17717 start
17718 ==a==
17719 ===aa===
17720 ====aaa====
17721 ==b==
17722 ===ba===
17723 ===bb===
17724 xxx
17725
17726 ===bc===
17727 ==c==
17728 ===ca===
17729 !! end
17730
17731 !! test
17732 Section replacement test (section 8)
17733 !! options
17734 replace=8,"xxx"
17735 !! wikitext
17736 start
17737 ==a==
17738 ===aa===
17739 ====aaa====
17740 ==b==
17741 ===ba===
17742 ===bb===
17743 ====bba====
17744 ===bc===
17745 ==c==
17746 ===ca===
17747 !! html/php
17748 start
17749 ==a==
17750 ===aa===
17751 ====aaa====
17752 ==b==
17753 ===ba===
17754 ===bb===
17755 ====bba====
17756 xxx
17757
17758 ==c==
17759 ===ca===
17760 !!end
17761
17762 !! test
17763 Section replacement test (section 9)
17764 !! options
17765 replace=9,"xxx"
17766 !! wikitext
17767 start
17768 ==a==
17769 ===aa===
17770 ====aaa====
17771 ==b==
17772 ===ba===
17773 ===bb===
17774 ====bba====
17775 ===bc===
17776 ==c==
17777 ===ca===
17778 !! html/php
17779 start
17780 ==a==
17781 ===aa===
17782 ====aaa====
17783 ==b==
17784 ===ba===
17785 ===bb===
17786 ====bba====
17787 ===bc===
17788 xxx
17789 !! end
17790
17791 !! test
17792 Section replacement test (section 10)
17793 !! options
17794 replace=10,"xxx"
17795 !! wikitext
17796 start
17797 ==a==
17798 ===aa===
17799 ====aaa====
17800 ==b==
17801 ===ba===
17802 ===bb===
17803 ====bba====
17804 ===bc===
17805 ==c==
17806 ===ca===
17807 !! html/php
17808 start
17809 ==a==
17810 ===aa===
17811 ====aaa====
17812 ==b==
17813 ===ba===
17814 ===bb===
17815 ====bba====
17816 ===bc===
17817 ==c==
17818 xxx
17819 !! end
17820
17821 !! test
17822 Section replacement test with initial whitespace (bug 13728)
17823 !! options
17824 replace=2,"xxx"
17825 !! wikitext
17826 Preformatted initial line
17827 ==a==
17828 ===a===
17829 !! html/php
17830 Preformatted initial line
17831 ==a==
17832 xxx
17833 !! end
17834
17835
17836 !! test
17837 Section extraction, heading followed by pre with 20 spaces (bug 6398)
17838 !! options
17839 section=1
17840 !! wikitext
17841 ==a==
17842 a
17843 !! html/php
17844 ==a==
17845 a
17846 !! end
17847
17848 !! test
17849 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
17850 !! options
17851 section=1
17852 !! wikitext
17853 ==a==
17854 a
17855 !! html/php
17856 ==a==
17857 a
17858 !! end
17859
17860
17861 !! test
17862 Section extraction, <pre> around bogus header (bug 10309)
17863 !! options
17864 noxml section=2
17865 !! wikitext
17866 == Section One ==
17867 <pre>
17868 =======
17869 </pre>
17870
17871 == Section Two ==
17872 stuff
17873 !! html/php
17874 == Section Two ==
17875 stuff
17876 !! end
17877
17878 !! test
17879 Section replacement, <pre> around bogus header (bug 10309)
17880 !! options
17881 noxml replace=2,"xxx"
17882 !! wikitext
17883 == Section One ==
17884 <pre>
17885 =======
17886 </pre>
17887
17888 == Section Two ==
17889 stuff
17890 !! html/php
17891 == Section One ==
17892 <pre>
17893 =======
17894 </pre>
17895
17896 xxx
17897 !! end
17898
17899
17900 !! test
17901 Handling of &#x0A; in URLs
17902 !! wikitext
17903 ** irc://&#x0A;a
17904 !! html/php
17905 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17906
17907 !! html/parsoid
17908 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
17909 a">irc://
17910 a</a></li></ul></li></ul>
17911 !! end
17912
17913 !! test
17914 Handling of %0A in URLs
17915 !! wikitext
17916 ** irc://%0Aa
17917 !! html/php
17918 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17919
17920 !! html/parsoid
17921 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17922 !! end
17923
17924
17925 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
17926 !! test
17927 5 quotes, code coverage +1 line
17928 !! options
17929 parsoid=wt2html
17930 !! wikitext
17931 '''''
17932 !! html/php
17933 !! html/parsoid
17934 <p><b><i></i></b></p>
17935 !! end
17936
17937 # same html as previous, but wikitext adjusted to match parsoid html2wt
17938 # note that wt2html and html2html will put the <i> before the <b>
17939 !! test
17940 5 quotes, code coverage +1 line w/ nowiki (1)
17941 !! options
17942 parsoid=wt2wt,html2wt
17943 !! wikitext
17944 '''''<nowiki/>'''''
17945 !! html/php
17946 <p><i></i>
17947 </p>
17948 !! html/parsoid
17949 <p><b><i></i></b></p>
17950 !! end
17951
17952 # same as previous, just swapping the <i> and <b>
17953 !! test
17954 5 quotes, code coverage +1 line w/ nowiki (2)
17955 !! wikitext
17956 '''''<nowiki/>'''''
17957 !! html/php
17958 <p><i></i>
17959 </p>
17960 !! html/parsoid
17961 <p><i><b></b></i></p>
17962 !! end
17963
17964 !! test
17965 Special:Search page linking.
17966 !! wikitext
17967 {{Special:search}}
17968 !! html
17969 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
17970 </p>
17971 !! end
17972
17973 !! test
17974 {{!}} is a magic word
17975 !! wikitext
17976 {{!}} is a magic word there and {{!}} is still a magic word here
17977 !! html/php
17978 <p>| is a magic word there and | is still a magic word here
17979 </p>
17980 !! html/parsoid
17981 <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>
17982 !! end
17983
17984 !! test
17985 Say the magic word
17986 !! options
17987 title=[[Parser test]]
17988 !! wikitext
17989 * {{PAGENAME}}
17990 * {{PAGENAMEE}}
17991 * {{FULLPAGENAME}}
17992 * {{FULLPAGENAMEE}}
17993 * {{BASEPAGENAME}}
17994 * {{BASEPAGENAMEE}}
17995 * {{SUBPAGENAME}}
17996 * {{SUBPAGENAMEE}}
17997 * {{ROOTPAGENAME}}
17998 * {{ROOTPAGENAMEE}}
17999 * {{TALKPAGENAME}}
18000 * {{TALKPAGENAMEE}}
18001 * {{SUBJECTPAGENAME}}
18002 * {{SUBJECTPAGENAMEE}}
18003 * {{NAMESPACEE}}
18004 * {{NAMESPACE}}
18005 * {{NAMESPACENUMBER}}
18006 * {{TALKSPACE}}
18007 * {{TALKSPACEE}}
18008 * {{SUBJECTSPACE}}
18009 * {{SUBJECTSPACEE}}
18010 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18011 !! html
18012 <ul><li> Parser test</li>
18013 <li> Parser_test</li>
18014 <li> Parser test</li>
18015 <li> Parser_test</li>
18016 <li> Parser test</li>
18017 <li> Parser_test</li>
18018 <li> Parser test</li>
18019 <li> Parser_test</li>
18020 <li> Parser test</li>
18021 <li> Parser_test</li>
18022 <li> Talk:Parser test</li>
18023 <li> Talk:Parser_test</li>
18024 <li> Parser test</li>
18025 <li> Parser_test</li>
18026 <li> </li>
18027 <li> </li>
18028 <li> 0</li>
18029 <li> Talk</li>
18030 <li> Talk</li>
18031 <li> </li>
18032 <li> </li>
18033 <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>
18034
18035 !! end
18036 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18037
18038 !! test
18039 Gallery
18040 !! wikitext
18041 <gallery>
18042 image1.png |
18043 image2.gif|||||
18044
18045 image3|
18046 image4 |300px| centre
18047 image5.svg| http://///////
18048 [[x|xx]]]]
18049 * image6
18050 </gallery>
18051 !! html
18052 <ul class="gallery mw-gallery-traditional">
18053 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18054 <div class="thumb" style="height: 150px;">Image1.png</div>
18055 <div class="gallerytext">
18056 </div>
18057 </div></li>
18058 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18059 <div class="thumb" style="height: 150px;">Image2.gif</div>
18060 <div class="gallerytext">
18061 <p>||||
18062 </p>
18063 </div>
18064 </div></li>
18065 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18066 <div class="thumb" style="height: 150px;">Image3</div>
18067 <div class="gallerytext">
18068 </div>
18069 </div></li>
18070 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18071 <div class="thumb" style="height: 150px;">Image4</div>
18072 <div class="gallerytext">
18073 <p>300px| centre
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;">Image5.svg</div>
18079 <div class="gallerytext">
18080 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
18081 </p>
18082 </div>
18083 </div></li>
18084 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18085 <div class="thumb" style="height: 150px;">* image6</div>
18086 <div class="gallerytext">
18087 </div>
18088 </div></li>
18089 </ul>
18090
18091 !! end
18092
18093 !! test
18094 Gallery (with options)
18095 !! wikitext
18096 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
18097 File:Nonexistent.jpg|caption
18098 File:Nonexistent.jpg
18099 image:foobar.jpg|some '''caption''' [[Main Page]]
18100 image:foobar.jpg
18101 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
18102 </gallery>
18103 !! html
18104 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
18105 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
18106 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18107 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18108 <div class="gallerytext">
18109 <p>caption
18110 </p>
18111 </div>
18112 </div></li>
18113 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18114 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18115 <div class="gallerytext">
18116 </div>
18117 </div></li>
18118 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18119 <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>
18120 <div class="gallerytext">
18121 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18122 </p>
18123 </div>
18124 </div></li>
18125 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18126 <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>
18127 <div class="gallerytext">
18128 </div>
18129 </div></li>
18130 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18131 <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>
18132 <div class="gallerytext">
18133 <p>Blabla|blabla.
18134 </p>
18135 </div>
18136 </div></li>
18137 </ul>
18138
18139 !! end
18140
18141 !! test
18142 Gallery with link that has fragment
18143 !! wikitext
18144 <gallery>
18145 image:foobar.jpg|link=Main_Page
18146 image:foobar.jpg|link=Main_Page#section
18147 image:foobar.jpg|link=Main Page#section|caption
18148 </gallery>
18149 !! html
18150 <ul class="gallery mw-gallery-traditional">
18151 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18152 <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>
18153 <div class="gallerytext">
18154 </div>
18155 </div></li>
18156 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18157 <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>
18158 <div class="gallerytext">
18159 </div>
18160 </div></li>
18161 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18162 <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>
18163 <div class="gallerytext">
18164 <p>caption
18165 </p>
18166 </div>
18167 </div></li>
18168 </ul>
18169
18170 !! end
18171
18172 !! test
18173 Gallery with wikitext inside caption
18174 !! wikitext
18175 <gallery>
18176 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
18177 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
18178 </gallery>
18179 !! html
18180 <ul class="gallery mw-gallery-traditional">
18181 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18182 <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>
18183 <div class="gallerytext">
18184 <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>
18185 </p>
18186 </div>
18187 </div></li>
18188 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18189 <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>
18190 <div class="gallerytext">
18191 <p>This is a test template
18192 </p>
18193 </div>
18194 </div></li>
18195 </ul>
18196
18197 !! end
18198
18199 !! test
18200 gallery (with showfilename option)
18201 !! wikitext
18202 <gallery showfilename>
18203 File:Nonexistent.jpg|caption
18204 File:Nonexistent.jpg
18205 image:foobar.jpg|some '''caption''' [[Main Page]]
18206 File:Foobar.jpg
18207 </gallery>
18208 !! html
18209 <ul class="gallery mw-gallery-traditional">
18210 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18211 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18212 <div class="gallerytext">
18213 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18214 caption
18215 </p>
18216 </div>
18217 </div></li>
18218 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18219 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18220 <div class="gallerytext">
18221 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18222 </p>
18223 </div>
18224 </div></li>
18225 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18226 <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>
18227 <div class="gallerytext">
18228 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18229 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18230 </p>
18231 </div>
18232 </div></li>
18233 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18234 <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>
18235 <div class="gallerytext">
18236 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18237 </p>
18238 </div>
18239 </div></li>
18240 </ul>
18241
18242 !! end
18243
18244 !! test
18245 Gallery (with namespace-less filenames)
18246 !! wikitext
18247 <gallery>
18248 File:Nonexistent.jpg
18249 Nonexistent.jpg
18250 image:foobar.jpg
18251 foobar.jpg
18252 </gallery>
18253 !! html
18254 <ul class="gallery mw-gallery-traditional">
18255 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18256 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18257 <div class="gallerytext">
18258 </div>
18259 </div></li>
18260 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18261 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18262 <div class="gallerytext">
18263 </div>
18264 </div></li>
18265 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18266 <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>
18267 <div class="gallerytext">
18268 </div>
18269 </div></li>
18270 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18271 <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>
18272 <div class="gallerytext">
18273 </div>
18274 </div></li>
18275 </ul>
18276
18277 !! end
18278
18279 !! test
18280 HTML Hex character encoding (spells the word "JavaScript")
18281 !! options
18282 parsoid=wt2html,wt2wt,html2html
18283 !! wikitext
18284 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
18285 !! html/php
18286 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
18287 </p>
18288 !! html/php+tidy
18289 <p>JavaScript</p>
18290 !! html/parsoid
18291 <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>
18292 !! end
18293
18294 !! test
18295 HTML Hex character encoding bogus encoding (bug 26437 regression check)
18296 !! wikitext
18297 &#xsee;&#XSEE;
18298 !! html/php
18299 <p>&amp;#xsee;&amp;#XSEE;
18300 </p>
18301 !! html/parsoid
18302 <p>&amp;#xsee;&amp;#XSEE;</p>
18303 !! end
18304
18305 !! test
18306 HTML Hex character encoding mixed case
18307 !! options
18308 parsoid=wt2html,wt2wt,html2html
18309 !! wikitext
18310 &#xEE;&#Xee;
18311 !! html/php
18312 <p>&#xee;&#xee;
18313 </p>
18314 !! html/php+tidy
18315 <p>îî</p>
18316 !! html/parsoid
18317 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
18318 !! end
18319
18320 # See: http://www.w3.org/TR/html5/syntax.html#character-references
18321 # Note that U+000C (form feed) is not a valid XML character, so
18322 # it is banned even though allowed in HTML5.
18323 !! test
18324 Illegal character references (T106578)
18325 !! wikitext
18326 ; Null: &#00;
18327 ; FF: &#xC;
18328 ; CR: &#xD;
18329 ; Control (low): &#8;
18330 ; Control (high): &#x7F; &#x9F;
18331 ; Surrogate: &#xD83D;&#xDCA9;
18332 ; This is an okay astral character: &#x1F4A9;
18333 !! html+tidy
18334 <dl>
18335 <dt>Null</dt>
18336 <dd>&amp;#00;</dd>
18337 <dt>FF</dt>
18338 <dd>&amp;#xC;</dd>
18339 <dt>CR</dt>
18340 <dd>&amp;#xD;</dd>
18341 <dt>Control (low)</dt>
18342 <dd>&amp;#8;</dd>
18343 <dt>Control (high)</dt>
18344 <dd>&amp;#x7F; &amp;#x9F;</dd>
18345 <dt>Surrogate</dt>
18346 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
18347 <dt>This is an okay astral character</dt>
18348 <dd>💩</dd>
18349 </dl>
18350 !! end
18351
18352 !! test
18353 __FORCETOC__ override
18354 !! wikitext
18355 __NEWSECTIONLINK__
18356 __FORCETOC__
18357 !! html/php
18358 <p><br />
18359 </p>
18360 !! end
18361
18362 !! test
18363 ISBN code coverage
18364 !! wikitext
18365 ISBN 978-0-1234-56&#x20;789
18366 !! html
18367 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
18368 </p>
18369 !! html+tidy
18370 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
18371 !! html/parsoid
18372 <p><a href="./Special:BookSources/9780123456" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978-0-1234-56</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x20;","srcContent":" "}'> </span>789</p>
18373 !! end
18374
18375 !! test
18376 ISBN followed by 5 spaces
18377 !! wikitext
18378 ISBN
18379 !! html
18380 <p>ISBN
18381 </p>
18382 !! end
18383
18384 !! test
18385 Double ISBN
18386 !! wikitext
18387 ISBN ISBN 1234567890
18388 !! html/php
18389 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18390 </p>
18391 !! html/parsoid
18392 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
18393 !! end
18394
18395 # Uppercase X and lowercase x as well
18396 !! test
18397 ISBN with an X
18398 !! wikitext
18399 ISBN 3-462-04561-X
18400 ISBN 3-462-04561-x
18401 ISBN 080442957X
18402 ISBN 080442957x
18403 ISBN 978080442957X
18404 ISBN 978080442957x
18405 !! html/php
18406 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
18407 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
18408 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
18409 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
18410 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
18411 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
18412 </p>
18413 !! html/parsoid
18414 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
18415 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
18416 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
18417 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
18418 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
18419 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
18420 !! end
18421
18422 !! test
18423 ISBN with empty prefix (parsoid test)
18424 !! wikitext
18425 ISBN 1234567890
18426 !! html/php
18427 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18428 </p>
18429 !! html/parsoid
18430 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
18431 !! end
18432
18433 !! test
18434 Bug 22905: <abbr> followed by ISBN followed by </a>
18435 !! wikitext
18436 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
18437 !! html/php
18438 <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>
18439 </p>
18440 !! html/parsoid
18441 <p><abbr data-parsoid='{"stx":"html"}'>(fr)</abbr> <a href="./Special:BookSources/2753300917" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 2753300917</a> <a rel="mw:ExtLink" href="http://www.example.com">example.com</a></p>
18442 !! end
18443
18444 !! test
18445 Double RFC
18446 !! wikitext
18447 RFC RFC 1234
18448 !! html
18449 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
18450 </p>
18451 !! end
18452
18453 !! test
18454 Double RFC with a wiki link
18455 !! wikitext
18456 RFC [[RFC 1234]]
18457 !! html
18458 <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>
18459 </p>
18460 !! end
18461
18462 !! test
18463 RFC code coverage
18464 !! wikitext
18465 RFC 983&#x20;987
18466 !! html
18467 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
18468 </p>
18469 !! html+tidy
18470 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
18471 !! end
18472
18473 !! test
18474 Centre-aligned image
18475 !! wikitext
18476 [[Image:foobar.jpg|centre]]
18477 !! html
18478 <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>
18479
18480 !!end
18481
18482 !! test
18483 None-aligned image
18484 !! wikitext
18485 [[Image:foobar.jpg|none]]
18486 !! html
18487 <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>
18488
18489 !!end
18490
18491 !! test
18492 Width + Height sized image (using px) (height is ignored)
18493 !! wikitext
18494 [[Image:foobar.jpg|640x480px]]
18495 !! html
18496 <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>
18497 </p>
18498 !!end
18499
18500 !! test
18501 Width-sized image (using px, no following whitespace)
18502 !! wikitext
18503 [[Image:foobar.jpg|640px]]
18504 !! html
18505 <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>
18506 </p>
18507 !!end
18508
18509 !! test
18510 Width-sized image (using px, with following whitespace - test regression from r39467)
18511 !! wikitext
18512 [[Image:foobar.jpg|640px ]]
18513 !! html
18514 <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>
18515 </p>
18516 !!end
18517
18518 !! test
18519 Width-sized image (using px, with preceding whitespace - test regression from r39467)
18520 !! wikitext
18521 [[Image:foobar.jpg| 640px]]
18522 !! html
18523 <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>
18524 </p>
18525 !!end
18526
18527 !! test
18528 Image with page parameter
18529 !! options
18530 djvu
18531 !! wikitext
18532 [[File:LoremIpsum.djvu|page=2]]
18533 !! html/php
18534 <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>
18535 </p>
18536 !! html/parsoid
18537 <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>
18538 !! end
18539
18540 !! test
18541 Another italics / bold test
18542 !! wikitext
18543 ''' ''x'
18544 !! html
18545 <pre>'<i> </i>x'
18546 </pre>
18547 !!end
18548
18549 # FIXME: The php output seems broken. It's interleaving some open/close tags.
18550 !! test
18551 dt/dd/dl test
18552 !! wikitext
18553 :;;;::
18554 !! html/php
18555 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
18556
18557 !! html/parsoid
18558 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
18559
18560 !!end
18561
18562
18563 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
18564 !! test
18565 Images with the "|" character in the comment
18566 !! wikitext
18567 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
18568 !! html/php
18569 <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>
18570
18571 !! html/parsoid
18572 <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>
18573 !! end
18574
18575 !! test
18576 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
18577 !! wikitext
18578 <html><script>alert(1);</script></html>
18579 !! html
18580 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
18581 </p>
18582 !! end
18583
18584 !! test
18585 HTML with raw HTML ($wgRawHtml==true)
18586 !! options
18587 wgRawHtml=1
18588 !! wikitext
18589 <html><script>alert(1);</script></html>
18590 !! html
18591 <p><script>alert(1);</script>
18592 </p>
18593 !! end
18594
18595 !! test
18596 Parents of subpages, one level up
18597 !! options
18598 subpage title=[[Subpage test/L1/L2/L3]]
18599 !! wikitext
18600 [[../|L2]]
18601 !! html
18602 <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>
18603 </p>
18604 !! end
18605
18606
18607 !! test
18608 Parents of subpages, one level up, not named
18609 !! options
18610 subpage title=[[Subpage test/L1/L2/L3]]
18611 !! wikitext
18612 [[../]]
18613 !! html
18614 <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>
18615 </p>
18616 !! end
18617
18618
18619
18620 !! test
18621 Parents of subpages, two levels up
18622 !! options
18623 subpage title=[[Subpage test/L1/L2/L3]]
18624 !! wikitext
18625 [[../../|L1]]2
18626
18627 [[../../|L1]]l
18628 !! html
18629 <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
18630 </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>
18631 </p>
18632 !! end
18633
18634 !! test
18635 Parents of subpages, two levels up, without trailing slash or name.
18636 !! options
18637 subpage title=[[Subpage test/L1/L2/L3]]
18638 !! wikitext
18639 [[../..]]
18640 !! html
18641 <p>[[../..]]
18642 </p>
18643 !! end
18644
18645 !! test
18646 Parents of subpages, two levels up, with lots of extra trailing slashes.
18647 !! options
18648 subpage title=[[Subpage test/L1/L2/L3]]
18649 !! wikitext
18650 [[../../////]]
18651 !! html
18652 <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>
18653 </p>
18654 !! end
18655
18656 !! article
18657 Subpage test/L1/L2/L3Sibling
18658 !! text
18659 Sibling article
18660 !! endarticle
18661
18662 !! test
18663 Transclusion of a sibling page (one level up)
18664 !! options
18665 subpage title=[[Subpage test/L1/L2/L3]]
18666 !! wikitext
18667 {{../L3Sibling}}
18668 !! html
18669 <p>Sibling article
18670 </p>
18671 !! end
18672
18673 !! test
18674 Transclusion of a child page
18675 !! options
18676 subpage title=[[Subpage test/L1/L2]]
18677 !! wikitext
18678 {{/L3Sibling}}
18679 !! html
18680 <p>Sibling article
18681 </p>
18682 !! end
18683
18684 !! test
18685 Non-transclusion because of too many up levels
18686 !! options
18687 subpage title=[[Subpage test/L1/L2/L3]]
18688 !! wikitext
18689 {{../../../../More than parent}}
18690 !! html
18691 <p>{{../../../../More than parent}}
18692 </p>
18693 !! end
18694
18695 !! test
18696 Definition list code coverage
18697 !! wikitext
18698 ; title : def
18699 ; title : def
18700 ;title: def
18701 !! html/php
18702 <dl><dt> title &#160;</dt>
18703 <dd> def</dd>
18704 <dt> title&#160;</dt>
18705 <dd> def</dd>
18706 <dt>title</dt>
18707 <dd> def</dd></dl>
18708
18709 !! html/parsoid
18710 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18711 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18712 <dt>title</dt><dd> def</dd></dl>
18713 !! end
18714
18715 !! test
18716 Don't fall for the self-closing div
18717 !! wikitext
18718 <div>hello world</div/>
18719 !! html
18720 <div>hello world</div>
18721
18722 !! end
18723
18724 !! test
18725 MSGNW magic word
18726 !! wikitext
18727 {{MSGNW:msg}}
18728 !! html/php
18729 <p>&#91;&#91;:Template:Msg&#93;&#93;
18730 </p>
18731 !! end
18732
18733 !! test
18734 RAW magic word
18735 !! wikitext
18736 {{RAW:QUERTY}}
18737 !! html
18738 <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>
18739 </p>
18740 !! end
18741
18742 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
18743 !! test
18744 Always escape literal '>' in output, not just after '<'
18745 !! wikitext
18746 ><>
18747 !! html
18748 <p>&gt;&lt;&gt;
18749 </p>
18750 !! end
18751
18752 !! test
18753 Template caching
18754 !! wikitext
18755 {{Test}}
18756 {{Test}}
18757 !! html
18758 <p>This is a test template
18759 This is a test template
18760 </p>
18761 !! end
18762
18763
18764 !! article
18765 MediaWiki:Fake
18766 !! text
18767 ==header==
18768 !! endarticle
18769
18770 !! test
18771 Inclusion of !userCanEdit() content
18772 !! wikitext
18773 {{MediaWiki:Fake}}
18774 !! html
18775 <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>
18776
18777 !! end
18778
18779
18780 !! test
18781 Out-of-order TOC heading levels
18782 !! wikitext
18783 ==2==
18784 ======6======
18785 ===3===
18786 =1=
18787 =====5=====
18788 ==2==
18789 !! html
18790 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18791 <ul>
18792 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
18793 <ul>
18794 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
18795 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
18796 </ul>
18797 </li>
18798 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
18799 <ul>
18800 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
18801 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
18802 </ul>
18803 </li>
18804 </ul>
18805 </div>
18806
18807 <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>
18808 <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>
18809 <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>
18810 <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>
18811 <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>
18812 <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>
18813
18814 !! end
18815
18816
18817 !! test
18818 ISBN with a dummy number
18819 !! wikitext
18820 ISBN ---
18821 !! html
18822 <p>ISBN ---
18823 </p>
18824 !! end
18825
18826
18827 !! test
18828 ISBN with space-delimited number
18829 !! wikitext
18830 ISBN 92 9017 032 8
18831 !! html
18832 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
18833 </p>
18834 !! end
18835
18836
18837 !! test
18838 ISBN with multiple spaces, no number
18839 !! wikitext
18840 ISBN foo
18841 !! html
18842 <p>ISBN foo
18843 </p>
18844 !! end
18845
18846
18847 !! test
18848 ISBN length
18849 !! wikitext
18850 ISBN 123456789
18851
18852 ISBN 1234567890
18853
18854 ISBN 12345678901
18855 !! html
18856 <p>ISBN 123456789
18857 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18858 </p><p>ISBN 12345678901
18859 </p>
18860 !! end
18861
18862
18863 !! test
18864 ISBN with trailing year (bug 8110)
18865 !! wikitext
18866 ISBN 1-234-56789-0 - 2006
18867
18868 ISBN 1 234 56789 0 - 2006
18869 !! html
18870 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
18871 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
18872 </p>
18873 !! end
18874
18875
18876 !! test
18877 anchorencode
18878 !! wikitext
18879 {{anchorencode:foo bar©#%n}}
18880 !! html
18881 <p>foo_bar.C2.A9.23.25n
18882 </p>
18883 !! end
18884
18885 !! test
18886 anchorencode trims spaces
18887 !! wikitext
18888 {{anchorencode: __pretty__please__}}
18889 !! html
18890 <p>pretty_please
18891 </p>
18892 !! end
18893
18894 !! test
18895 anchorencode deals with links
18896 !! wikitext
18897 {{anchorencode: [[hello|world]] [[hi]]}}
18898 !! html
18899 <p>world_hi
18900 </p>
18901 !! end
18902
18903 !! test
18904 anchorencode deals with templates
18905 !! wikitext
18906 {{anchorencode: {{Foo}} }}
18907 !! html
18908 <p>FOO
18909 </p>
18910 !! end
18911
18912 !! test
18913 anchorencode encodes like the TOC generator: (bug 18431)
18914 !! wikitext
18915 === _ +:.3A%3A&&amp;]] ===
18916 {{anchorencode: _ +:.3A%3A&&amp;]] }}
18917 __NOEDITSECTION__
18918 !! html
18919 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
18920 <p>.2B:.3A.253A.26.26.5D.5D
18921 </p>
18922 !! end
18923
18924 !! test
18925 Bug 6200: blockquotes and paragraph formatting
18926 !! wikitext
18927 <blockquote>
18928 foo
18929 </blockquote>
18930
18931 bar
18932
18933 baz
18934 !! html
18935 <blockquote>
18936 <p>foo
18937 </p>
18938 </blockquote>
18939 <p>bar
18940 </p>
18941 <pre>baz
18942 </pre>
18943 !! end
18944
18945 !! test
18946 Bug 8293: Use of center tag ruins paragraph formatting
18947 !! wikitext
18948 <center>
18949 foo
18950 </center>
18951
18952 bar
18953
18954 baz
18955 !! html
18956 <center>
18957 <p>foo
18958 </p>
18959 </center>
18960 <p>bar
18961 </p>
18962 <pre>baz
18963 </pre>
18964 !! end
18965
18966 !!test
18967 Parsing of overlapping (improperly nested) inline html tags
18968 !! wikitext
18969 <span><s>x</span></s>
18970 !! html/php
18971 <p><span><s>x&lt;/span&gt;</s></span>
18972 </p>
18973 !! html/parsoid
18974 <p><span><s>x</s></span>
18975 </p>
18976 !!end
18977
18978 ###
18979 ### Language variants related tests
18980 ###
18981 !! test
18982 Self-link in language variants
18983 !! options
18984 title=[[Dunav]] language=sr
18985 !! wikitext
18986 Both [[Dunav]] and [[Дунав]] are names for this river.
18987 !! html
18988 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
18989 </p>
18990 !!end
18991
18992 !! article
18993 Дуна
18994 !! text
18995 content
18996 !! endarticle
18997
18998 !! test
18999 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
19000 !! options
19001 title=[[Duna]] language=sr
19002 !! wikitext
19003 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
19004 !! html
19005 <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.
19006 </p>
19007 !! end
19008
19009 !! test
19010 Link to a section of a variant of this title shouldn't be parsed as self-link
19011 !! options
19012 title=[[Duna]] language=sr
19013 !! wikitext
19014 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
19015 !! html
19016 <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.
19017 </p>
19018 !! end
19019
19020 !! test
19021 Link to pages in language variants
19022 !! options
19023 language=sr
19024 !! wikitext
19025 Main Page can be written as [[Маин Паге]]
19026 !! html
19027 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
19028 </p>
19029 !!end
19030
19031
19032 !! test
19033 Multiple links to pages in language variants
19034 !! options
19035 language=sr
19036 !! wikitext
19037 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
19038 !! html
19039 <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>.
19040 </p>
19041 !!end
19042
19043
19044 !! test
19045 Simple template in language variants
19046 !! options
19047 language=sr
19048 !! wikitext
19049 {{тест}}
19050 !! html
19051 <p>This is a test template
19052 </p>
19053 !! end
19054
19055
19056 !! test
19057 Template with explicit namespace in language variants
19058 !! options
19059 language=sr
19060 !! wikitext
19061 {{Template:тест}}
19062 !! html
19063 <p>This is a test template
19064 </p>
19065 !! end
19066
19067
19068 !! test
19069 Basic test for template parameter in language variants
19070 !! options
19071 language=sr
19072 !! wikitext
19073 {{парамтест|param=foo}}
19074 !! html
19075 <p>This is a test template with parameter foo
19076 </p>
19077 !! end
19078
19079
19080 !! test
19081 Simple category in language variants
19082 !! options
19083 language=sr cat
19084 !! wikitext
19085 [[Category:МедиаWики Усер'с Гуиде]]
19086 !! html
19087 <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>
19088 !! end
19089
19090
19091 !! article
19092 Category:分类
19093 !! text
19094 blah
19095 !! endarticle
19096
19097 !! article
19098 Category:分類
19099 !! text
19100 blah
19101 !! endarticle
19102
19103 !! test
19104 Don't convert blue categorylinks to another variant (bug 33210)
19105 !! options
19106 language=zh cat
19107 !! wikitext
19108 [[A]][[Category:分类]]
19109 !! html
19110 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
19111 !! end
19112
19113
19114 !! test
19115 Stripping -{}- tags (language variants)
19116 !! options
19117 language=sr
19118 !! wikitext
19119 Latin proverb: -{Ne nuntium necare}-
19120 !! html
19121 <p>Latin proverb: Ne nuntium necare
19122 </p>
19123 !! end
19124
19125
19126 !! test
19127 Prevent conversion with -{}- tags (language variants)
19128 !! options
19129 language=sr variant=sr-ec
19130 !! wikitext
19131 Latinski: -{Ne nuntium necare}-
19132 !! html
19133 <p>Латински: Ne nuntium necare
19134 </p>
19135 !! end
19136
19137
19138 !! test
19139 Prevent conversion of text with -{}- tags (language variants)
19140 !! options
19141 language=sr variant=sr-ec
19142 !! wikitext
19143 Latinski: -{Ne nuntium necare}-
19144 !! html
19145 <p>Латински: Ne nuntium necare
19146 </p>
19147 !! end
19148
19149
19150 !! test
19151 Prevent conversion of links with -{}- tags (language variants)
19152 !! options
19153 language=sr variant=sr-ec
19154 !! wikitext
19155 -{[[Main Page]]}-
19156 !! html
19157 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19158 </p>
19159 !! end
19160
19161
19162 !! test
19163 -{}- tags within headlines (within html for parserConvert())
19164 !! options
19165 language=sr variant=sr-ec
19166 !! wikitext
19167 == -{Naslov}- ==
19168 !! html
19169 <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>
19170
19171 !! end
19172
19173
19174 !! test
19175 Explicit definition of language variant alternatives
19176 !! options
19177 language=zh variant=zh-tw
19178 !! wikitext
19179 -{zh:China;zh-tw:Taiwan}-, not China
19180 !! html
19181 <p>Taiwan, not China
19182 </p>
19183 !! end
19184
19185
19186 !! test
19187 Conversion around HTML tags
19188 !! options
19189 language=sr variant=sr-ec
19190 !! wikitext
19191 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
19192 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
19193 !! html
19194 <p>
19195 <span title="ЛаCтин">ски</span>
19196 </p>
19197 !! end
19198
19199
19200 !! test
19201 Explicit session-wise language variant mapping (A flag and - flag)
19202 !! options
19203 language=zh variant=zh-tw
19204 !! wikitext
19205 Taiwan is not China.
19206 But -{A|zh:China;zh-tw:Taiwan}- is China,
19207 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
19208 and -{China}- is China.
19209 !! html
19210 <p>Taiwan is not China.
19211 But Taiwan is Taiwan,
19212 (This should be stripped!)
19213 and China is China.
19214 </p>
19215 !! end
19216
19217 !! test
19218 Explicit session-wise language variant mapping (H flag for hide)
19219 !! options
19220 language=zh variant=zh-tw
19221 !! wikitext
19222 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
19223 Taiwan is China.
19224 !! html
19225 <p>(This should be stripped!)
19226 Taiwan is Taiwan.
19227 </p>
19228 !! end
19229
19230 !! test
19231 Adding explicit conversion rule for title (T flag)
19232 !! options
19233 language=zh variant=zh-tw showtitle
19234 !! wikitext
19235 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19236 !! html
19237 Taiwan
19238 <p>Should be stripped!
19239 </p>
19240 !! end
19241
19242 !! test
19243 Testing that changing the language variant here in the tests actually works
19244 !! options
19245 language=zh variant=zh showtitle
19246 !! wikitext
19247 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19248 !! html
19249 China
19250 <p>Should be stripped!
19251 </p>
19252 !! end
19253
19254 !! test
19255 Recursive conversion of alt and title attrs shouldn't clear converter state
19256 !! options
19257 language=zh variant=zh-cn showtitle
19258 !! wikitext
19259 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
19260 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
19261 !! html
19262 China
19263 <p>
19264 Should be stripped<span title="Exclamation">!</span>
19265 </p>
19266 !! end
19267
19268 !! test
19269 Bug 24072: more test on conversion rule for title
19270 !! options
19271 language=zh variant=zh-tw showtitle
19272 !! wikitext
19273 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19274 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
19275 !! html
19276 Taiwan
19277 <p>This should be stripped!
19278 This won't take interferes with the title rule.
19279 </p>
19280 !! end
19281
19282 !! test
19283 Partly disable title conversion if variant == main language code
19284 !! options
19285 language=zh variant=zh title=[[ZH]] showtitle
19286 !! wikitext
19287 -{T|zh-cn:CN;zh-tw:TW}-
19288 !! html
19289 ZH
19290 <p>
19291 </p>
19292 !! end
19293
19294 !! test
19295 Partly disable title conversion if variant == main language code, more
19296 !! options
19297 language=zh variant=zh title=[[ZH]] showtitle
19298 !! wikitext
19299 -{T|TW}-
19300 !! html
19301 ZH
19302 <p>
19303 </p>
19304 !! end
19305
19306 !! test
19307 Raw output of variant escape tags (R flag)
19308 !! options
19309 language=zh variant=zh-tw
19310 !! wikitext
19311 Raw: -{R|zh:China;zh-tw:Taiwan}-
19312 !! html
19313 <p>Raw: zh:China;zh-tw:Taiwan
19314 </p>
19315 !! end
19316
19317 !! test
19318 Strings evaluating false shouldn't be ignored by Language converter (T51072)
19319 !! options
19320 language=zh variant=zh-cn
19321 !! input
19322 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
19323 !! result
19324 <p>0
19325 </p>
19326 !! end
19327
19328 !! test
19329 Conversion rules from [numeric-only string] to [something else] (T48634)
19330 !! options
19331 language=zh variant=zh-cn
19332 !! input
19333 -{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
19334 !! result
19335 <p>D12345EE12345
19336 </p>
19337 !! end
19338
19339 !! test
19340 Bidirectional converter rule entries with an empty value should be ignored (T53551)
19341 !! options
19342 language=zh variant=zh-cn
19343 !! input
19344 -{H|zh-cn:foo;zh-tw:;}-foobar
19345 !! result
19346 <p>foobar
19347 </p>
19348 !! end
19349
19350 !! test
19351 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
19352 !! options
19353 language=zh variant=zh-cn
19354 !! input
19355 -{H|=>zh-cn:foo;}-foobar
19356 !! result
19357 <p>foobar
19358 </p>
19359 !! end
19360
19361 !! test
19362 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
19363 !! options
19364 language=zh variant=zh-cn
19365 !! input
19366 -{H|}-foobar
19367 !! result
19368 <p>foobar
19369 </p>
19370 !! end
19371
19372 !! test
19373 Nested using of manual convert syntax
19374 !! options
19375 language=zh variant=zh-hk
19376 !! wikitext
19377 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
19378 !! html
19379 <p>Nested: Hello Hong Kong!
19380 </p>
19381 !! end
19382
19383 !! test
19384 Proper conversion of text in external links
19385 !! options
19386 language=sr variant=sr-ec
19387 !! wikitext
19388 http://www.google.com
19389 gopher://www.google.com
19390 [http://www.google.com http://www.google.com]
19391 [gopher://www.google.com gopher://www.google.com]
19392 [https://www.google.com irc://www.google.com]
19393 [ftp://www.google.com www.google.com/ftp://dir]
19394 [//www.google.com www.google.com]
19395 !! html
19396 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19397 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19398 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19399 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19400 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
19401 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
19402 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
19403 </p>
19404 !! end
19405
19406 !! test
19407 Do not convert roman numbers to language variants
19408 !! options
19409 language=sr variant=sr-ec
19410 !! wikitext
19411 Fridrih IV je car.
19412 !! html
19413 <p>Фридрих IV је цар.
19414 </p>
19415 !! end
19416
19417 !! test
19418 Unclosed language converter markup "-{"
19419 !! options
19420 language=sr
19421 !! wikitext
19422 -{T|hello
19423 !! html
19424 <p>-{T|hello
19425 </p>
19426 !! end
19427
19428 !! test
19429 Don't convert raw rule "-{R|=&gt;}-" to "=>"
19430 !! options
19431 language=sr
19432 !! wikitext
19433 -{R|=&gt;}-
19434 !! html
19435 <p>=&gt;
19436 </p>
19437 !!end
19438
19439 !! test
19440 Don't break link parsing if language converter markup is in the caption.
19441 !! options
19442 language=sr variant=sr-ec
19443 !! wikitext
19444 [[Main Page|-{R|main page}-]]
19445 !! html
19446 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
19447 </p>
19448 !! end
19449
19450 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19451 !! test
19452 Don't break image parsing if language converter markup is in the caption.
19453 !! options
19454 language=sr
19455 !! wikitext
19456 [[File:Foobar.jpg|-{R|caption}-]]
19457 !! html/parsoid
19458 <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>
19459 </p>
19460 !! end
19461
19462 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19463 !! test
19464 Don't break list handling if language converter markup is in the item.
19465 !! options
19466 language=zh variant=zh-cn
19467 !! wikitext
19468 ;-{zh-cn:AAA;zh-tw:BBB}-
19469 !! html/php
19470 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
19471
19472 !! html/parsoid
19473 <dl><dt>AAA
19474 </dt></dl>
19475 !! end
19476
19477 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19478 !! test
19479 Don't break table handling if language converter markup is in the cell.
19480 !! options
19481 language=sr variant=sr-ec
19482 !! wikitext
19483 {|
19484 |-
19485 | -{R|B}-
19486 |}
19487 !! html/php
19488 <table>
19489
19490 <tr>
19491 <td>Б}-
19492 </td></tr></table>
19493
19494 !! html/parsoid
19495 <table>
19496
19497 <tr>
19498 <td> B
19499 </td></tr></table>
19500
19501 !! end
19502
19503 !! test
19504 Bug 529: Uncovered bullet
19505 !! wikitext
19506 * Foo {{bullet}}
19507 !! html
19508 <ul><li> Foo </li>
19509 <li> Bar</li></ul>
19510
19511 !! end
19512
19513 # Plain MediaWiki does not remove empty lists, but tidy actually does.
19514 # Templates in Wikipedia rely on this behavior, as tidy has always been
19515 # enabled there. These tests are normally run *without* tidy, so specify the
19516 # full output here.
19517 # To test realistic parsing behavior, apply a tidy-like transformation to both
19518 # the expected output and your parser's output.
19519 !! test
19520 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
19521 !! wikitext
19522 ******* Foo {{bullet}}
19523 !! html
19524 <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>
19525 <li> Bar</li></ul>
19526
19527 !! end
19528
19529 !! test
19530 Bug 529: Uncovered table already at line-start
19531 !! wikitext
19532 x
19533
19534 {{table}}
19535 y
19536 !! html
19537 <p>x
19538 </p>
19539 <table>
19540 <tr>
19541 <td> 1 </td>
19542 <td> 2
19543 </td></tr>
19544 <tr>
19545 <td> 3 </td>
19546 <td> 4
19547 </td></tr></table>
19548 <p>y
19549 </p>
19550 !! end
19551
19552 !! test
19553 Bug 529: Uncovered bullet in parser function result
19554 !! wikitext
19555 * Foo {{lc:{{bullet}} }}
19556 !! html
19557 <ul><li> Foo </li>
19558 <li> bar</li></ul>
19559
19560 !! end
19561
19562 !! test
19563 Bug 5678: Double-parsed template argument
19564 !! wikitext
19565 {{lc:{{{1}}}|hello}}
19566 !! html
19567 <p>{{{1}}}
19568 </p>
19569 !! end
19570
19571 !! test
19572 Bug 5678: Double-parsed template invocation
19573 !! wikitext
19574 {{lc:{{paramtest {{!}} param = hello }} }}
19575 !! html
19576 <p>{{paramtest | param = hello }}
19577 </p>
19578 !! end
19579
19580 !! test
19581 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
19582 !! options
19583 language=cs
19584 title=[[Main Page]]
19585 !! wikitext
19586 {{PRVNÍVELKÉ:ěščř}}
19587 {{prvnívelké:ěščř}}
19588 {{PRVNÍMALÉ:ěščř}}
19589 {{prvnímalé:ěščř}}
19590 {{MALÁ:ěščř}}
19591 {{malá:ěščř}}
19592 {{VELKÁ:ěščř}}
19593 {{velká:ěščř}}
19594 !! html
19595 <p>Ěščř
19596 Ěščř
19597 ěščř
19598 ěščř
19599 ěščř
19600 ěščř
19601 ĚŠČŘ
19602 ĚŠČŘ
19603 </p>
19604 !! end
19605
19606 !! test
19607 Morwen/13: Unclosed link followed by heading
19608 !! wikitext
19609 [[link
19610 ==heading==
19611 !! html
19612 <p>[[link
19613 </p>
19614 <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>
19615
19616 !! end
19617
19618 !! test
19619 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
19620 !! wikitext
19621 {{foo|
19622 =heading=
19623 !! html
19624 <p>{{foo|
19625 </p>
19626 <h1><span class="mw-headline" id="heading">heading</span></h1>
19627
19628 !! end
19629
19630 !! test
19631 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
19632 !! wikitext
19633 {{foo|
19634 ==heading==
19635 !! html
19636 <p>{{foo|
19637 </p>
19638 <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>
19639
19640 !! end
19641
19642 !! test
19643 Tildes in comments
19644 !! options
19645 pst
19646 !! wikitext
19647 <!-- ~~~~ -->
19648 !! html
19649 <!-- ~~~~ -->
19650 !! end
19651
19652 !! test
19653 Paragraphs inside divs (no extra line breaks)
19654 !! wikitext
19655 <div>Line one
19656
19657 Line two</div>
19658 !! html
19659 <div>Line one
19660 Line two</div>
19661
19662 !! end
19663
19664 !! test
19665 Paragraphs inside divs (extra line break on open)
19666 !! wikitext
19667 <div>
19668 Line one
19669
19670 Line two</div>
19671 !! html
19672 <div>
19673 <p>Line one
19674 </p>
19675 Line two</div>
19676
19677 !! end
19678
19679 !! test
19680 Paragraphs inside divs (extra line break on close)
19681 !! wikitext
19682 <div>Line one
19683
19684 Line two
19685 </div>
19686 !! html
19687 <div>Line one
19688 <p>Line two
19689 </p>
19690 </div>
19691
19692 !! end
19693
19694 !! test
19695 Paragraphs inside divs (extra line break on open and close)
19696 !! wikitext
19697 <div>
19698 Line one
19699
19700 Line two
19701 </div>
19702 !! html
19703 <div>
19704 <p>Line one
19705 </p><p>Line two
19706 </p>
19707 </div>
19708
19709 !! end
19710
19711 !! test
19712 Nesting tags, paragraphs on lines which begin with <div>
19713 !! wikitext
19714 <div></div><strong>A
19715 B</strong>
19716 !! html/php+tidy
19717 <p><strong>A</strong></p>
19718 <p><strong>B</strong></p>
19719 !! html/parsoid
19720 <div></div>
19721 <p><strong>A
19722 B</strong>
19723 </p>
19724 !! end
19725
19726 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
19727 !! test
19728 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
19729 !! wikitext
19730 <blockquote>Line one
19731
19732 Line two</blockquote>
19733 !! html
19734 <blockquote>Line one
19735 Line two</blockquote>
19736
19737 !! html+tidy
19738 <blockquote>
19739 <p>Line one Line two</p>
19740 </blockquote>
19741 !! end
19742
19743 !! test
19744 Bug 6200: paragraphs inside blockquotes (extra line break on open)
19745 !! wikitext
19746 <blockquote>
19747 Line one
19748
19749 Line two</blockquote>
19750 !! html
19751 <blockquote>
19752 <p>Line one
19753 </p>
19754 Line two</blockquote>
19755
19756 !! html+tidy
19757 <blockquote>
19758 <p>Line one</p>
19759 Line two</blockquote>
19760 !! end
19761
19762 !! test
19763 Bug 6200: paragraphs inside blockquotes (extra line break on close)
19764 !! wikitext
19765 <blockquote>Line one
19766
19767 Line two
19768 </blockquote>
19769 !! html
19770 <blockquote>Line one
19771 <p>Line two
19772 </p>
19773 </blockquote>
19774
19775 !! html+tidy
19776 <blockquote>
19777 <p>Line one</p>
19778 <p>Line two</p>
19779 </blockquote>
19780 !! end
19781
19782 !! test
19783 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
19784 !! wikitext
19785 <blockquote>
19786 Line one
19787
19788 Line two
19789 </blockquote>
19790 !! html
19791 <blockquote>
19792 <p>Line one
19793 </p><p>Line two
19794 </p>
19795 </blockquote>
19796
19797 !! html+tidy
19798 <blockquote>
19799 <p>Line one</p>
19800 <p>Line two</p>
19801 </blockquote>
19802 !! end
19803
19804 !! test
19805 Paragraphs inside blockquotes/divs (no extra line breaks)
19806 !! wikitext
19807 <blockquote><div>Line one
19808
19809 Line two</div></blockquote>
19810 !! html
19811 <blockquote><div>Line one
19812 Line two</div></blockquote>
19813
19814 !! end
19815
19816 !! test
19817 Paragraphs inside blockquotes/divs (extra line break on open)
19818 !! wikitext
19819 <blockquote><div>
19820 Line one
19821
19822 Line two</div></blockquote>
19823 !! html
19824 <blockquote><div>
19825 <p>Line one
19826 </p>
19827 Line two</div></blockquote>
19828
19829 !! end
19830
19831 !! test
19832 Paragraphs inside blockquotes/divs (extra line break on close)
19833 !! wikitext
19834 <blockquote><div>Line one
19835
19836 Line two
19837 </div></blockquote>
19838 !! html
19839 <blockquote><div>Line one
19840 <p>Line two
19841 </p>
19842 </div></blockquote>
19843
19844 !! end
19845
19846 !! test
19847 Paragraphs inside blockquotes/divs (extra line break on open and close)
19848 !! wikitext
19849 <blockquote><div>
19850 Line one
19851
19852 Line two
19853 </div></blockquote>
19854 !! html
19855 <blockquote><div>
19856 <p>Line one
19857 </p><p>Line two
19858 </p>
19859 </div></blockquote>
19860
19861 !! end
19862
19863 !! test
19864 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
19865 !! options
19866 wgLinkHolderBatchSize=0
19867 !! wikitext
19868 [[meatball:1]]
19869 [[meatball:2]]
19870 [[meatball:3]]
19871 !! html
19872 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
19873 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
19874 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
19875 </p>
19876 !! end
19877
19878 !! test
19879 Free external link invading image caption
19880 !! wikitext
19881 [[Image:Foobar.jpg|thumb|http://x|hello]]
19882 !! html
19883 <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>
19884
19885 !! end
19886
19887 !! test
19888 Bug 15196: localised external link numbers
19889 !! options
19890 language=fa
19891 !! wikitext
19892 [http://en.wikipedia.org/]
19893 !! html/php
19894 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
19895 </p>
19896 !! html/parsoid
19897 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
19898 !! end
19899
19900 !! test
19901 Multibyte character in padleft
19902 !! wikitext
19903 {{padleft:-Hello|7|Æ}}
19904 !! html
19905 <p>Æ-Hello
19906 </p>
19907 !! end
19908
19909 !! test
19910 Multibyte character in padright
19911 !! wikitext
19912 {{padright:Hello-|7|Æ}}
19913 !! html
19914 <p>Hello-Æ
19915 </p>
19916 !! end
19917
19918 !!test
19919 formatdate parser function
19920 !! wikitext
19921 {{#formatdate:2009-03-24}}
19922 !! html
19923 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
19924 </p>
19925 !! end
19926
19927 !!test
19928 formatdate parser function, with default format
19929 !! wikitext
19930 {{#formatdate:2009-03-24|mdy}}
19931 !! html
19932 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
19933 </p>
19934 !! end
19935
19936 !! test
19937 Spacing of numbers in formatted dates
19938 !! wikitext
19939 {{#formatdate:January 15}}
19940 !! html
19941 <p><span class="mw-formatted-date" title="01-15">January 15</span>
19942 </p>
19943 !! end
19944
19945 !! test
19946 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
19947 !! options
19948 language=nl title=[[MediaWiki:Common.css]]
19949 !! wikitext
19950 {{#formatdate:2009-03-24|dmy}}
19951 !! html
19952 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
19953 </p>
19954 !! end
19955
19956 #
19957 #
19958 #
19959
19960 #
19961 # Edit comments
19962 #
19963
19964 !! test
19965 Edit comment with link
19966 !! options
19967 comment
19968 !! wikitext
19969 I like the [[Main Page]] a lot
19970 !! html
19971 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
19972 !!end
19973
19974 !! test
19975 Edit comment with link and link text
19976 !! options
19977 comment
19978 !! wikitext
19979 I like the [[Main Page|best pages]] a lot
19980 !! html
19981 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
19982 !!end
19983
19984 !! test
19985 Edit comment with link and link text with suffix
19986 !! options
19987 comment
19988 !! wikitext
19989 I like the [[Main Page|best page]]s a lot
19990 !! html
19991 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
19992 !!end
19993
19994 !! test
19995 Edit comment with section link (non-local, eg in history list)
19996 !! options
19997 comment title=[[Main Page]]
19998 !! wikitext
19999 /* External links */ removed bogus entries
20000 !! html
20001 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20002 !!end
20003
20004 !! test
20005 Edit comment with section link and text before it (non-local, eg in history list)
20006 !! options
20007 comment title=[[Main Page]]
20008 !! wikitext
20009 pre-comment text /* External links */ removed bogus entries
20010 !! html
20011 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>
20012 !!end
20013
20014 !! test
20015 Edit comment with section link (local, eg in diff view)
20016 !! options
20017 comment local title=[[Main Page]]
20018 !! wikitext
20019 /* External links */ removed bogus entries
20020 !! html
20021 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20022 !!end
20023
20024 !! test
20025 Edit comment with subpage link (bug 14080)
20026 !! options
20027 comment
20028 subpage
20029 title=[[Subpage test]]
20030 !! wikitext
20031 Poked at a [[/subpage]] here...
20032 !! html
20033 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
20034 !!end
20035
20036 !! test
20037 Edit comment with subpage link and link text (bug 14080)
20038 !! options
20039 comment
20040 subpage
20041 title=[[Subpage test]]
20042 !! wikitext
20043 Poked at a [[/subpage|neat little page]] here...
20044 !! html
20045 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
20046 !!end
20047
20048 !! test
20049 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
20050 !! options
20051 comment
20052 title=[[Subpage test]]
20053 !! wikitext
20054 Poked at a [[/subpage]] here...
20055 !! html
20056 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...
20057 !!end
20058
20059 !! test
20060 Edit comment with bare anchor link (local, as on diff)
20061 !! options
20062 comment
20063 local
20064 title=[[Main Page]]
20065 !! wikitext
20066 [[#section]]
20067 !! html
20068 <a href="#section">#section</a>
20069 !! end
20070
20071 !! test
20072 Edit comment with bare anchor link (non-local, as on history)
20073 !! options
20074 comment
20075 title=[[Main Page]]
20076 !! wikitext
20077 [[#section]]
20078 !! html
20079 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
20080 !! end
20081
20082 !! test
20083 Anchor starting with underscore
20084 !! wikitext
20085 [[#_ref|One]]
20086 !! html
20087 <p><a href="#_ref">One</a>
20088 </p>
20089 !! end
20090
20091 !! test
20092 Id starting with underscore
20093 !! wikitext
20094 <div id="_ref"></div>
20095 !! html
20096 <div id="_ref"></div>
20097
20098 !! end
20099
20100 !! test
20101 Space normalisation on autocomment (bug 22784)
20102 !! options
20103 comment
20104 title=[[Main Page]]
20105 !! wikitext
20106 /* __hello__world__ */
20107 !! html
20108 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
20109 !! end
20110
20111 !! test
20112 percent-encoding and + signs in comments (Bug 26410)
20113 !! options
20114 comment
20115 !! wikitext
20116 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
20117 !! html/php
20118 <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>
20119 !! end
20120
20121 # Parsoid doesn't support this yet: see bug 73581
20122 # but it *should* omit the 'src' attribute if the image is bad.
20123 # PHP side of tests was disabled in
20124 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
20125 # because of issues in the PHP parserTests infrastructure
20126 # (but the output below is indeed what the PHP side emits)
20127 !! test
20128 Bad images - basic functionality
20129 !! wikitext
20130 [[File:Bad.jpg]]
20131 !! DISABLED/html/php
20132 !! html/parsoid
20133 <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>
20134 !! end
20135
20136 !! test
20137 Bad images - bug 16039: text after bad image disappears
20138 !! wikitext
20139 Foo bar
20140 [[File:Bad.jpg]]
20141 Bar foo
20142 !! DISABLED/html/php
20143 <p>Foo bar
20144 </p><p>Bar foo
20145 </p>
20146 !! html/parsoid
20147 <p>Foo bar
20148 <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>
20149 Bar foo</p>
20150 !! end
20151
20152 !! test
20153 Verify that displaytitle works (bug #22501) no displaytitle
20154 !! options
20155 showtitle
20156 !! config
20157 wgAllowDisplayTitle=true
20158 wgRestrictDisplayTitle=false
20159 !! wikitext
20160 this is not the the title
20161 !! html/php
20162 Parser test
20163 <p>this is not the the title
20164 </p>
20165 !! end
20166
20167 !! test
20168 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
20169 !! options
20170 showtitle
20171 title=[[Screen]]
20172 !! config
20173 wgAllowDisplayTitle=true
20174 wgRestrictDisplayTitle=false
20175 !! wikitext
20176 this is not the the title
20177 {{DISPLAYTITLE:whatever}}
20178 !! html/php
20179 whatever
20180 <p>this is not the the title
20181 </p>
20182 !! end
20183
20184 !! test
20185 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
20186 !! options
20187 showtitle
20188 title=[[Screen]]
20189 !! config
20190 wgAllowDisplayTitle=true
20191 wgRestrictDisplayTitle=true
20192 !! wikitext
20193 this is not the the title
20194 {{DISPLAYTITLE:whatever}}
20195 !! html/php
20196 Screen
20197 <p>this is not the the title
20198 </p>
20199 !! end
20200
20201 !! test
20202 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
20203 !! options
20204 showtitle
20205 title=[[Screen]]
20206 !! config
20207 wgAllowDisplayTitle=true
20208 wgRestrictDisplayTitle=true
20209 !! wikitext
20210 this is not the the title
20211 {{DISPLAYTITLE:screen}}
20212 !! html/php
20213 screen
20214 <p>this is not the the title
20215 </p>
20216 !! end
20217
20218 !! test
20219 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
20220 !! options
20221 showtitle
20222 title=[[Screen]]
20223 !! config
20224 wgAllowDisplayTitle=false
20225 !! wikitext
20226 this is not the the title
20227 {{DISPLAYTITLE:screen}}
20228 !! html/php
20229 Screen
20230 <p>this is not the the title
20231 <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>
20232 </p>
20233 !! end
20234
20235 !! test
20236 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
20237 !! options
20238 showtitle
20239 title=[[Screen]]
20240 !! config
20241 wgAllowDisplayTitle=false
20242 !! wikitext
20243 this is not the the title
20244 !! html/php
20245 Screen
20246 <p>this is not the the title
20247 </p>
20248 !! end
20249
20250 !! test
20251 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
20252 !! options
20253 showtitle
20254 title=[[Screen]]
20255 !! config
20256 wgAllowDisplayTitle=true
20257 wgRestrictDisplayTitle=true
20258 !! wikitext
20259 this is not the the title
20260 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
20261 !! html/php
20262 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
20263 <p>this is not the the title
20264 </p>
20265 !! end
20266
20267 !! test
20268 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
20269 !! options
20270 showtitle
20271 title=[[Screen]]
20272 !! config
20273 wgAllowDisplayTitle=true
20274 wgRestrictDisplayTitle=true
20275 !! wikitext
20276 this is not the the title
20277 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
20278 !! html/php
20279 <span style="color: red;">s</span>creen
20280 <p>this is not the the title
20281 </p>
20282 !! end
20283
20284 !! test
20285 Page status indicators: Empty name is invalid
20286 !! options
20287 showindicators
20288 !! wikitext
20289 <indicator name=" "></indicator>
20290 <indicator></indicator>
20291 !! html
20292 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20293 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20294 </p>
20295 !! end
20296
20297 !! test
20298 Page status indicators: Weird syntaxes that are okay
20299 !! options
20300 showindicators
20301 !! wikitext
20302 <indicator name="empty" />
20303 <indicator name="name"></indicator>
20304 !! html
20305 empty=
20306 name=
20307 <p><br />
20308 </p>
20309 !! end
20310
20311 !! test
20312 Page status indicators: Torture test
20313 !! options
20314 showindicators
20315 !! wikitext
20316 <indicator name="01">hello world</indicator>
20317 <indicator name="02">[[Main Page]]</indicator>
20318 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
20319 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
20320 <indicator name="05">* foo
20321 * bar</indicator>
20322 <indicator name="06"><nowiki>foo</nowiki></indicator>
20323 <indicator name="07"> Preformatted</indicator>
20324 <indicator name="08"><div>Broken tag</indicator>
20325 <indicator name="09">{| class=wikitable
20326 | cell
20327 |}</indicator>
20328 <indicator name="10">Two
20329
20330 paragraphs</indicator>
20331 !! html
20332 01=hello world
20333 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20334 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" />
20335 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>
20336 05=<ul><li> foo</li>
20337 <li> bar</li></ul>
20338
20339 06=foo
20340 07=<pre>Preformatted
20341 </pre>
20342 08=<div>Broken tag</div>
20343
20344 09=<table class="wikitable">
20345 <tr>
20346 <td> cell
20347 </td></tr></table>
20348
20349 10=<p>Two
20350 </p><p>paragraphs
20351 </p>
20352 <p><br />
20353 </p><p><br />
20354 </p><p><br />
20355 </p><p><br />
20356 </p><p><br />
20357 </p>
20358 !! end
20359
20360 !! test
20361 preload: check <noinclude> and <includeonly>
20362 !! options
20363 preload
20364 !! wikitext
20365 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
20366 !! html/php
20367 Hello kind world.
20368 !! end
20369
20370 !! test
20371 preload: check <onlyinclude>
20372 !! options
20373 preload
20374 !! wikitext
20375 Goodbye <onlyinclude>Hello world</onlyinclude>
20376 !! html/php
20377 Hello world
20378 !! end
20379
20380 !! test
20381 preload: can pass tags through if we want to
20382 !! options
20383 preload
20384 !! wikitext
20385 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
20386 !! html/php
20387 <includeonly>Hello world</includeonly>
20388 !! end
20389
20390 !! test
20391 preload: check that it doesn't try to do tricks
20392 !! options
20393 preload
20394 !! wikitext
20395 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20396 !! html/php
20397 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20398 !! end
20399
20400 !! test
20401 Play a bit with r67090 and bug 3158
20402 !! wikitext
20403 <div style="width:50% !important">&nbsp;</div>
20404 <div style="width:50%&nbsp;!important">&nbsp;</div>
20405 <div style="width:50%&#160;!important">&nbsp;</div>
20406 <div style="border : solid;">&nbsp;</div>
20407 !! html/php
20408 <div style="width:50% !important">&#160;</div>
20409 <div style="width:50% !important">&#160;</div>
20410 <div style="width:50% !important">&#160;</div>
20411 <div style="border&#160;: solid;">&#160;</div>
20412
20413 !! html/parsoid
20414 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20415 <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>
20416 <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>
20417 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20418
20419 !! end
20420
20421 !! test
20422 HTML5 data attributes
20423 !! wikitext
20424 <span data-foo="bar">Baz</span>
20425 <p data-abc-def_hij="">Quuz</p>
20426 !! html
20427 <p><span data-foo="bar">Baz</span>
20428 </p>
20429 <p data-abc-def_hij="">Quuz</p>
20430
20431 !! end
20432
20433 !! test
20434 percent-encoding and + signs in internal links (Bug 26410)
20435 !! wikitext
20436 [[User:+%]] [[Page+title%]]
20437 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
20438 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
20439 [[%33%45]] [[%33%45+]]
20440 !! html/php
20441 <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>
20442 <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>
20443 <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>
20444 <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>
20445 </p>
20446 !! html/parsoid
20447 <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>
20448 <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>
20449 <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>
20450 <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>
20451 !! end
20452
20453 !! test
20454 Special characters in embedded file links (bug 27679)
20455 !! wikitext
20456 [[File:Contains & ampersand.jpg]]
20457 [[File:Does not exist.jpg|Title with & ampersand]]
20458 !! html/php
20459 <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>
20460 <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>
20461 </p>
20462 !! html/parsoid
20463 <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>
20464 <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>
20465 !! end
20466
20467 !! test
20468 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
20469 !! wikitext
20470 Text&apos;s been normalized?
20471 !! html
20472 <p>Text&#39;s been normalized?
20473 </p>
20474 !! end
20475
20476 !! test
20477 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
20478 !! wikitext
20479 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
20480 !! html
20481 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
20482 </p>
20483 !! end
20484
20485 !! test
20486 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
20487 !! wikitext
20488 [http://www.example.org/ ideograms]
20489 !! html
20490 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
20491 </p>
20492 !! end
20493
20494 !! test
20495 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
20496 !! wikitext
20497 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
20498 !! html
20499 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
20500 </p>
20501 !! end
20502
20503 !! article
20504 Mediawiki:loop1
20505 !! text
20506 {{Identical|A}}
20507 !! endarticle
20508
20509 !! article
20510 Mediawiki:loop2
20511 !! text
20512 {{Identical|B}}
20513 !! endarticle
20514
20515 !! article
20516 Template:Identical
20517 !! text
20518 {{int:loop1}}
20519 {{int:loop2}}
20520 !! endarticle
20521
20522 !! test
20523 Bug 31098 Template which includes system messages which includes the template
20524 !! wikitext
20525 {{Identical}}
20526 !! html
20527 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20528 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20529 </p>
20530 !! end
20531
20532 !! test
20533 Bug31490 Turkish: ucfirst 'blah'
20534 !! options
20535 language=tr
20536 !! wikitext
20537 {{ucfirst:blah}}
20538 !! html
20539 <p>Blah
20540 </p>
20541 !! end
20542
20543 !! test
20544 Bug31490 Turkish: ucfirst 'ix'
20545 !! options
20546 language=tr
20547 !! wikitext
20548 {{ucfirst:ix}}
20549 !! html
20550 <p>İx
20551 </p>
20552 !! end
20553
20554 !! test
20555 Bug31490 Turkish: lcfirst 'BLAH'
20556 !! options
20557 language=tr
20558 !! wikitext
20559 {{lcfirst:BLAH}}
20560 !! html
20561 <p>bLAH
20562 </p>
20563 !! end
20564
20565 !! test
20566 Bug31490 Turkish: ucfırst (with a dotless i)
20567 !! options
20568 language=tr
20569 !! wikitext
20570 {{ucfırst:blah}}
20571 !! html
20572 <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>
20573 </p>
20574 !! end
20575
20576 !! test
20577 Bug31490 ucfırst (with a dotless i) with English language
20578 !! options
20579 language=en
20580 !! wikitext
20581 {{ucfırst:blah}}
20582 !! html
20583 <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>
20584 </p>
20585 !! end
20586
20587 !! test
20588 Bug 26375: TOC with italics
20589 !! options
20590 title=[[Main Page]]
20591 !! wikitext
20592 __TOC__
20593 == ''Lost'' episodes ==
20594 !! html
20595 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20596 <ul>
20597 <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>
20598 </ul>
20599 </div>
20600
20601 <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>
20602
20603 !! end
20604
20605 !! test
20606 Bug 26375: TOC with bold
20607 !! options
20608 title=[[Main Page]]
20609 !! wikitext
20610 __TOC__
20611 == '''should be bold''' then normal text ==
20612 !! html
20613 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20614 <ul>
20615 <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>
20616 </ul>
20617 </div>
20618
20619 <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>
20620
20621 !! end
20622
20623 !! test
20624 Bug 33845: Headings become cursive in TOC when they contain an image
20625 !! options
20626 title=[[Main Page]]
20627 !! wikitext
20628 __TOC__
20629 == Image [[Image:foobar.jpg]] ==
20630 !! html
20631 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20632 <ul>
20633 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
20634 </ul>
20635 </div>
20636
20637 <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>
20638
20639 !! end
20640
20641 !! test
20642 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
20643 !! options
20644 title=[[Main Page]]
20645 !! wikitext
20646 __TOC__
20647 == <blockquote>Quote</blockquote> ==
20648 !! html
20649 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20650 <ul>
20651 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20652 </ul>
20653 </div>
20654
20655 <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>
20656
20657 !! html+tidy
20658 <p></p>
20659 <div id="toc" class="toc">
20660 <div id="toctitle">
20661 <h2>Contents</h2>
20662 </div>
20663 <ul>
20664 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20665 </ul>
20666 </div>
20667 <p></p>
20668 <h2><span class="mw-headline" id="Quote"></span></h2>
20669 <blockquote>
20670 <p><span class="mw-headline" id="Quote">Quote</span></p>
20671 </blockquote>
20672 <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>
20673 !! end
20674
20675 !! test
20676 Unclosed tags in TOC
20677 !! options
20678 title=[[Main Page]]
20679 !! wikitext
20680 __TOC__
20681 == Proof: 2 < 3 ==
20682 <small>Hanc marginis exiguitas non caperet.</small>
20683 QED
20684 !! html
20685 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20686 <ul>
20687 <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>
20688 </ul>
20689 </div>
20690
20691 <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>
20692 <p><small>Hanc marginis exiguitas non caperet.</small>
20693 QED
20694 </p>
20695 !! end
20696
20697 !! test
20698 Multiple tags in TOC
20699 !! wikitext
20700 __TOC__
20701 == <i>Foo</i> <b>Bar</b> ==
20702
20703 == <i>Foo</i> <blockquote>Bar</blockquote> ==
20704 !! html
20705 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20706 <ul>
20707 <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>
20708 <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>
20709 </ul>
20710 </div>
20711
20712 <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>
20713 <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>
20714
20715 !! html+tidy
20716 <p></p>
20717 <div id="toc" class="toc">
20718 <div id="toctitle">
20719 <h2>Contents</h2>
20720 </div>
20721 <ul>
20722 <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>
20723 <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>
20724 </ul>
20725 </div>
20726 <p></p>
20727 <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>
20728 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
20729 <blockquote>
20730 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
20731 </blockquote>
20732 <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>
20733 !! end
20734
20735 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
20736 # html5 tag parsing.
20737 !! test
20738 Tags with parameters in TOC
20739 !! options
20740 parsoid=wt2html
20741 !! wikitext
20742 __TOC__
20743 == <sup class="in-h2">Hello</sup> ==
20744
20745 == <sup class="a > b">Evilbye</sup> ==
20746 !! html/php
20747 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20748 <ul>
20749 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
20750 <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>
20751 </ul>
20752 </div>
20753
20754 <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>
20755 <h2><span class="mw-headline" id="b.22.3EEvilbye"><sup class="a"> 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>
20756
20757 !! html/parsoid
20758 <meta property="mw:PageProp/toc" />
20759 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
20760
20761 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
20762 !! end
20763
20764 !! test
20765 span tags with directionality in TOC
20766 !! wikitext
20767 __TOC__
20768 == <span dir="ltr">C++</span> ==
20769
20770 == <span dir="rtl">זבנג!</span> ==
20771
20772 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
20773
20774 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
20775
20776 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
20777 !! html
20778 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20779 <ul>
20780 <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>
20781 <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>
20782 <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>
20783 <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>
20784 <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>
20785 </ul>
20786 </div>
20787
20788 <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>
20789 <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>
20790 <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>
20791 <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>
20792 <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>
20793
20794 !! end
20795
20796 !! test
20797 Bug 72884: bdi element in ToC
20798 !! wikitext
20799 __TOC__
20800 == <bdi>test</bdi> ==
20801 !! html
20802 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20803 <ul>
20804 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
20805 </ul>
20806 </div>
20807
20808 <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>
20809
20810 !! end
20811
20812 # Note that the html output does not have the <p></p>, but the
20813 # html+tidy output *does*. This is because the empty <p></p> is
20814 # removed by the sanitizer, but only when tidy is *not* enabled (!).
20815 !! test
20816 Empty <p> tag in TOC, removed by Sanitizer (T92892)
20817 !! wikitext
20818 __TOC__
20819 == x ==
20820 !! html
20821 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20822 <ul>
20823 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
20824 </ul>
20825 </div>
20826
20827 <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>
20828
20829 !! html+tidy
20830 <p></p>
20831 <div id="toc" class="toc">
20832 <div id="toctitle">
20833 <h2>Contents</h2>
20834 </div>
20835 <ul>
20836 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
20837 </ul>
20838 </div>
20839 <p></p>
20840 <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>
20841 !! end
20842
20843 !! article
20844 MediaWiki:Bug32057
20845 !! text
20846 == {{int:headline_sample}} ==
20847 !! endarticle
20848
20849 !! test
20850 Bug 32057: Title needed when expanding <h> nodes.
20851 !! options
20852 title=[[Main Page]]
20853 !! wikitext
20854 {{int:Bug32057}}
20855 !! html
20856 <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>
20857
20858 !! end
20859
20860 !! test
20861 Strip marker in urlencode
20862 !! wikitext
20863 {{urlencode:x<nowiki/>y}}
20864 {{urlencode:x<nowiki/>y|wiki}}
20865 {{urlencode:x<nowiki/>y|path}}
20866 {{urlencode:x<pre id="one">two</pre>y}}
20867 !! html
20868 <p>xy
20869 xy
20870 xy
20871 xy
20872 </p>
20873 !! end
20874
20875 !! test
20876 Strip marker in lc
20877 !! wikitext
20878 {{lc:x<nowiki/>y}}
20879 !! html
20880 <p>xy
20881 </p>
20882 !! end
20883
20884 !! test
20885 Strip marker in uc
20886 !! wikitext
20887 {{uc:x<nowiki/>y}}
20888 !! html
20889 <p>XY
20890 </p>
20891 !! end
20892
20893 !! test
20894 Strip marker in formatNum
20895 !! wikitext
20896 {{formatnum:1<nowiki/>2}}
20897 {{formatnum:1<nowiki/>2|R}}
20898 !! html
20899 <p>12
20900 12
20901 </p>
20902 !! end
20903
20904 !! test
20905 Check noCommafy in formatNum
20906 !! options
20907 language=be-tarask
20908 !! wikitext
20909 {{formatnum:123456.78}}
20910 {{formatnum:123456.78|NOSEP}}
20911 !! html
20912 <p>123 456,78
20913 123456.78
20914 </p>
20915 !! end
20916
20917 !! test
20918 Wrong option for formatNum (bug 56199)
20919 !! wikitext
20920 {{formatnum:1,234.56|Random}}
20921 {{formatnum:1,234.56|EVERYTHING}}
20922 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
20923 !! html
20924 <p>1,234.56
20925 1,234.56
20926 1,234.56
20927 </p>
20928 !! end
20929
20930 !! test
20931 Strip marker in grammar
20932 !! options
20933 language=fi
20934 !! wikitext
20935 {{grammar:elative|foo<nowiki/>bar}}
20936 !! html
20937 <p>foobarista
20938 </p>
20939 !! end
20940
20941 !! test
20942 Strip marker in padleft
20943 !! wikitext
20944 {{padleft:|2|x<nowiki/>y}}
20945 !! html
20946 <p>xy
20947 </p>
20948 !! end
20949
20950 !! test
20951 Strip marker in padright
20952 !! wikitext
20953 {{padright:|2|x<nowiki/>y}}
20954 !! html
20955 <p>xy
20956 </p>
20957 !! end
20958
20959 !! test
20960 Strip marker in anchorencode
20961 !! wikitext
20962 {{anchorencode:x<nowiki/>y}}
20963 !! html
20964 <p>xy
20965 </p>
20966 !! end
20967
20968 !! test
20969 nowiki inside link inside heading (bug 18295)
20970 !! wikitext
20971 ==[[foo|x<nowiki>y</nowiki>z]]==
20972 !! html
20973 <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>
20974
20975 !! end
20976
20977 !! test
20978 new support for bdi element (bug 31817)
20979 !! wikitext
20980 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
20981 !! html
20982 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
20983
20984 !!end
20985
20986 !! test
20987 Ignore pipe between table row attributes
20988 !! wikitext
20989 {|
20990 | quux
20991 |- id=foo | style='color: red'
20992 | bar
20993 |}
20994 !! html
20995 <table>
20996 <tr>
20997 <td> quux
20998 </td></tr>
20999 <tr id="foo" style="color: red">
21000 <td> bar
21001 </td></tr></table>
21002
21003 !! end
21004
21005 !!test
21006 Gallery override link with WikiLink (bug 34852)
21007 !! wikitext
21008 <gallery>
21009 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
21010 </gallery>
21011 !! html
21012 <ul class="gallery mw-gallery-traditional">
21013 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21014 <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>
21015 <div class="gallerytext">
21016 <p>caption
21017 </p>
21018 </div>
21019 </div></li>
21020 </ul>
21021
21022 !! end
21023
21024 !!test
21025 Gallery override link with absolute external link (bug 34852)
21026 !! wikitext
21027 <gallery>
21028 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21029 </gallery>
21030 !! html
21031 <ul class="gallery mw-gallery-traditional">
21032 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21033 <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>
21034 <div class="gallerytext">
21035 <p>caption
21036 </p>
21037 </div>
21038 </div></li>
21039 </ul>
21040
21041 !! end
21042
21043 !!test
21044 Gallery override link with malicious javascript (bug 34852)
21045 !! wikitext
21046 <gallery>
21047 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21048 </gallery>
21049 !! html
21050 <ul class="gallery mw-gallery-traditional">
21051 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21052 <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>
21053 <div class="gallerytext">
21054 <p>caption
21055 </p>
21056 </div>
21057 </div></li>
21058 </ul>
21059
21060 !! end
21061
21062 !!test
21063 Gallery with invalid title as link (bug 43964)
21064 !! wikitext
21065 <gallery>
21066 File:foobar.jpg|link=<
21067 </gallery>
21068 !! html
21069 <ul class="gallery mw-gallery-traditional">
21070 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21071 <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>
21072 <div class="gallerytext">
21073 </div>
21074 </div></li>
21075 </ul>
21076
21077 !! end
21078
21079 !!test
21080 Language parser function
21081 !! wikitext
21082 {{#language:ar}}
21083 !! html
21084 <p>العربية
21085 </p>
21086 !! end
21087
21088 !!test
21089 Padleft and padright as substr
21090 !! wikitext
21091 {{padleft:|3|abcde}}
21092 {{padright:|3|abcde}}
21093 !! html
21094 <p>abc
21095 abc
21096 </p>
21097 !! end
21098
21099 !!test
21100 Special parser function
21101 !! wikitext
21102 {{#special:RandomPage}}
21103 {{#special:BaDtItLe}}
21104 {{#special:Foobar}}
21105 !! html
21106 <p>Special:Random
21107 Special:Badtitle
21108 Special:Foobar
21109 </p>
21110 !! end
21111
21112 !!test
21113 Bug 34939 - Case insensitive link parsing ([HttP://])
21114 !! wikitext
21115 [HttP://MediaWiki.Org/]
21116 !! html/php
21117 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
21118 </p>
21119 !! html/parsoid
21120 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
21121 !! end
21122
21123 !!test
21124 Bug 34939 - Case insensitive link parsing ([HttP:// title])
21125 !! wikitext
21126 [HttP://MediaWiki.Org/ MediaWiki]
21127 !! html
21128 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
21129 </p>
21130 !! end
21131
21132 !!test
21133 Bug 34939 - Case insensitive link parsing (HttP://)
21134 !! wikitext
21135 HttP://MediaWiki.Org/
21136 !! html/php
21137 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
21138 </p>
21139 !! html/parsoid
21140 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
21141 !! end
21142
21143 !!test
21144 Disable TOC
21145 !! options
21146 notoc
21147 !! wikitext
21148 Lead
21149 == Section 1 ==
21150 == Section 2 ==
21151 == Section 3 ==
21152 == Section 4 ==
21153 == Section 5 ==
21154 !! html
21155 <p>Lead
21156 </p>
21157
21158 <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>
21159 <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>
21160 <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>
21161 <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>
21162 <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>
21163
21164 !! end
21165
21166
21167 ###
21168 ### Parsoid-specific tests
21169 ### Parsoid-PHP parser incompatibilities
21170 ###
21171 !!test
21172 1. SOL-sensitive wikitext tokens as template-args
21173 !!options
21174 parsoid=wt2html,wt2wt
21175 !! wikitext
21176 {{echo|*a}}
21177 {{echo|#a}}
21178 {{echo|:a}}
21179 !! html
21180 <span about="#mwt1" typeof="mw:Transclusion">
21181 </span><ul about="#mwt1"><li>a</li>
21182 </ul>
21183 <span about="#mwt2" typeof="mw:Transclusion">
21184 </span><ol about="#mwt2"><li>a</li>
21185 </ol>
21186 <span about="#mwt3" typeof="mw:Transclusion">
21187 </span><dl about="#mwt3"><dd>a</dd>
21188 </dl>
21189 !!end
21190
21191 #### -----------------------------------------------------------------
21192 #### Parsoid-specific functionality tests
21193 #### -----------------------------------------------------------------
21194
21195 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
21196 # We know wt2wt will fail, but we expect selser to pass.
21197 # Due to the nature of our testing, wt2wt and selser tests will enter the
21198 # blacklist and we'll catch selser regressions based on changes to the
21199 # blacklist entries for selser tests.
21200 !! test
21201 1. Bad treebuilder fixup of formatting elt is cleaned up
21202 !! options
21203 parsoid=wt2html,wt2wt
21204 !! wikitext
21205 {|
21206 |
21207 <small>
21208 [[Image:Foobar.jpg|right|Test]]
21209 </small>
21210 |}
21211 !! html/parsoid
21212 <table>
21213 <tbody><tr><td>
21214 <small>
21215 <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>
21216 </small>
21217 </td></tr>
21218 </tbody></table>
21219 !! end
21220
21221 !! test
21222 2. Bad treebuilder fixup of formatting elt is cleaned up
21223 !! options
21224 parsoid=wt2html,wt2wt
21225 !! wikitext
21226 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
21227
21228 <small>[[Image:Foobar.jpg|right|300px]]</small>
21229 !! html/parsoid
21230
21231 <p><b>foo</b></p>
21232 <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>
21233 <p><b>bar</b></p>
21234 <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>
21235 !! end
21236
21237 !! test
21238 3. Bad treebuilder fixup of formatting elt is cleaned up
21239 !! options
21240 parsoid=wt2html,wt2wt
21241 !! wikitext
21242 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
21243 !! html/parsoid
21244 <p><small><b>foo</b></small></p>
21245 <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>
21246 <p><small><b>bar</b></small></p>
21247 !! end
21248
21249 !! test
21250 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
21251 !! options
21252 parsoid=wt2html,wt2wt
21253 !! wikitext
21254 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
21255 !! html/parsoid
21256 <p><b><small></small></b></p>
21257 <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>
21258 <p></p>
21259 !! end
21260
21261 #### ----------------------------------------------------------------
21262 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
21263 #### tags. Parsoid's output for these tags differs from that of the
21264 #### PHP parser.
21265 #### ----------------------------------------------------------------
21266
21267 !!test
21268 Ref: 1. ref-location should be replaced with an index span
21269 !!options
21270 parsoid
21271 !! wikitext
21272 A <ref>foo</ref>
21273 B <ref name="x">foo</ref>
21274 C <ref name="y" />
21275 <references />
21276 !! html
21277 <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>
21278 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>
21279 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>
21280 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21281 <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>
21282 <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>
21283 <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>
21284 </ol>
21285 !!end
21286
21287 !!test
21288 Ref: 2. ref-tags with identical names should all get the same index
21289 !!options
21290 parsoid
21291 !! wikitext
21292 A <ref name="x">foo</ref>
21293 B <ref name="x" />
21294 <references />
21295 !! html
21296 <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>
21297 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>
21298 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21299 <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>
21300 </ol>
21301 !!end
21302
21303 !!test
21304 Ref: 3. spaces in ref-names should be ignored
21305 !!options
21306 parsoid
21307 !! wikitext
21308 A <ref name="x">foo</ref>
21309 B <ref name=" x " />
21310 C <ref name= x />
21311 <references />
21312 !! html
21313 <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>
21314 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>
21315 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>
21316 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21317 <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>
21318 </ol>
21319 !!end
21320
21321 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
21322 !!test
21323 Ref: 4. 'constructor' should be accepted as a valid ref-name
21324 !!options
21325 parsoid
21326 !! wikitext
21327 A <ref name="constructor">foo</ref>
21328 <references />
21329 !! html
21330 <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>
21331 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21332 <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>
21333 </ol>
21334 !!end
21335
21336 !!test
21337 Ref: 5. body should accept generic wikitext
21338 !!options
21339 parsoid
21340 !! wikitext
21341 A <ref>
21342 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
21343 </ref>
21344
21345 <references />
21346 !! html
21347 <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>
21348
21349 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21350 <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>
21351 </span></li>
21352 </ol>
21353 !!end
21354
21355 !!test
21356 Ref: 6. indent-pres should not be output in ref-body
21357 !!options
21358 parsoid
21359 !! wikitext
21360 A <ref>
21361 foo
21362 bar
21363 baz
21364 </ref>
21365
21366 <references />
21367 !! html
21368 <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>
21369
21370 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21371 <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
21372 bar
21373 baz
21374 </span></li>
21375 </ol>
21376 !!end
21377
21378 !!test
21379 Ref: 7. No p-wrapping in ref-body
21380 !!options
21381 parsoid
21382 !! wikitext
21383 A <ref>
21384 foo
21385
21386 bar
21387
21388
21389 baz
21390
21391
21392
21393 booz
21394 </ref>
21395
21396 <references />
21397 !! html
21398 <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>
21399
21400 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21401 <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
21402
21403 bar
21404
21405
21406 baz
21407
21408
21409
21410 booz
21411 </span></li>
21412 </ol>
21413 !!end
21414
21415 !!test
21416 Ref: 8. transclusion wikitext has lower precedence
21417 !!options
21418 parsoid
21419 !! wikitext
21420 A <ref> foo {{echo|</ref> B C}}
21421
21422 <references />
21423 !! html
21424 <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>
21425 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21426 <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>
21427 </ol>
21428 !!end
21429
21430 !!test
21431 Ref: 9. unclosed comments should not leak out of ref-body
21432 !!options
21433 parsoid
21434 !! wikitext
21435 A <ref> foo <!--</ref> B C
21436 <references />
21437 !! html
21438 <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>
21439 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21440 <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>
21441 </ol>
21442 !!end
21443
21444 !!test
21445 Ref: 10. Unclosed HTML tags should not leak out of ref-body
21446 !!options
21447 parsoid
21448 !! wikitext
21449 A <ref> <b> foo </ref> B C
21450
21451 <references />
21452 !! html
21453 <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>
21454
21455
21456 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21457 <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>
21458 </ol>
21459 !!end
21460
21461 !!test
21462 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
21463 !!options
21464 parsoid
21465 !! wikitext
21466 A <ref>foo</ref> B
21467 C <ref>bar</ref> D
21468 <references />
21469 !! html
21470 <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
21471 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>
21472 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21473 <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>
21474 <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>
21475 </ol>
21476 !!end
21477
21478 !!test
21479 Ref: 12. ref-tags act as trailing newline migration barrier
21480 !! wikitext
21481 <!--the newline at the end of this line moves out of the p tag-->a
21482
21483 b<!--the newline at the end of this line stays inside the p tag--> <ref />
21484 <ref />
21485
21486 c
21487 <references />
21488 !! html/parsoid
21489 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
21490
21491
21492 <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>
21493 <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>
21494
21495 <p>c</p>
21496 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21497 <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>
21498 <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>
21499 !!end
21500
21501 !!test
21502 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
21503 !!options
21504 parsoid
21505 !! wikitext
21506 <ref>foo</ref> A
21507 <ref>bar
21508 </ref> B
21509 <references />
21510 !! html
21511 <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
21512 <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>
21513 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21514 <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>
21515 <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
21516 </span></li>
21517 </ol>
21518 !!end
21519
21520 !!test
21521 Ref: 14. A nested ref-tag should be emitted as plain text
21522 !!options
21523 parsoid
21524 !! wikitext
21525 <ref>foo <ref>bar</ref> baz</ref>
21526
21527 <references />
21528 !! html
21529 <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>
21530 </p>
21531 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21532 <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>
21533 </ol>
21534 !!end
21535
21536 !!test
21537 Ref: 15. ref-tags with identical names should get identical indexes
21538 !!options
21539 parsoid
21540 !! wikitext
21541 A1 <ref name="a">foo</ref> A2 <ref name="a" />
21542 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
21543
21544 <references />
21545 !! html
21546 <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>
21547 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>
21548
21549 <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>
21550 </ol>
21551 !!end
21552
21553 ## We don't bother wt2wt-ing non-standard whitespace
21554 !!test
21555 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
21556 !!options
21557 parsoid=wt2html
21558 !! wikitext
21559 A <ref >foo</ref >
21560
21561 <references />
21562 !! html
21563 <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>
21564 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21565 <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>
21566 !!end
21567
21568 !!test
21569 Ref: 17. Generate valid HTML5 id/about attributes
21570 !!options
21571 parsoid
21572 !!wikitext
21573 <ref name="a b">foo</ref>
21574
21575 <references />
21576 !!html
21577 <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>
21578 </p>
21579
21580 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21581 <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>
21582 </ol>
21583 !!end
21584
21585 !!test
21586 Ref: 18. T58916: Extension attributes should be parsed as plain text
21587 !!options
21588 parsoid
21589 !!wikitext
21590 <ref name="{{echo|a}}">foo</ref>
21591
21592 <references />
21593 !!html
21594 <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>
21595 </p>
21596
21597 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21598 <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>
21599 </ol>
21600 !!end
21601
21602 !!test
21603 Ref: 19. ref-tags with identical name encodings should get identical indexes
21604 !!options
21605 parsoid
21606 !! wikitext
21607 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
21608
21609 <references />
21610 !! html
21611 <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>
21612 </p>
21613 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21614 <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>
21615 </ol>
21616 !!end
21617
21618 !!test
21619 Ref: 20. ref-tags with identical names but different content should keep it
21620 !!options
21621 parsoid
21622 !! wikitext
21623 A <ref name="foo">Foo one</ref>
21624 B <ref name="foo">Foo two</ref>
21625 C <ref name="foo" />
21626
21627 <references />
21628 !! html
21629 <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>
21630 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>
21631 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>
21632
21633 <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>
21634 </ol>
21635 !!end
21636
21637 !!test
21638 References: 1. references tag without any refs should be handled properly
21639 !! wikitext
21640 <references />
21641 !! html/parsoid
21642 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21643 !!end
21644
21645 !!test
21646 References: 2. references tag with group only outputs references from that group
21647 !! wikitext
21648 A <ref group="a">foo</ref>
21649 B <ref group="b">bar</ref>
21650 C <ref>baz</ref>
21651
21652 <references group="a" />
21653 <references />
21654 <references group="b" />
21655 !! html/parsoid
21656 <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>
21657 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>
21658 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>
21659
21660 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
21661 <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>
21662 </ol>
21663 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
21664 <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>
21665 </ol>
21666 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
21667 <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>
21668 </ol>
21669 !!end
21670
21671 !!test
21672 References: 3. ref list should be cleared after processing references
21673 !! wikitext
21674 A <ref>foo</ref>
21675
21676 <references />
21677
21678 B <ref>bar</ref>
21679
21680 <references />
21681 !! html/parsoid
21682 <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>
21683
21684 <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>
21685 </ol>
21686
21687 <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>
21688
21689 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21690 <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>
21691 </ol>
21692 !!end
21693
21694 !!test
21695 References: 4. only referenced group should be cleared after processing references
21696 !! wikitext
21697 A <ref group="a">afoo</ref>
21698 B <ref>bfoo</ref>
21699
21700 <references group="a" />
21701
21702 C <ref>cfoo</ref>
21703
21704 <references />
21705 !! html/parsoid
21706 <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>
21707 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>
21708
21709 <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>
21710 </ol>
21711
21712 <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>
21713
21714 <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>
21715 </ol>
21716 !!end
21717
21718 !!test
21719 References: 5. ref tags in references should be processed while ignoring all other content
21720 !! wikitext
21721 A <ref name="a" />
21722 B <ref name="b">bar</ref>
21723
21724 <references>
21725 <ref name="a">foo</ref>
21726 This should just get lost.
21727 </references>
21728 !! html/parsoid
21729 <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>
21730 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>
21731
21732
21733 <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>
21734 </ol>
21735 !!end
21736
21737 !!test
21738 References: 6. <references /> from a transclusion
21739 !! wikitext
21740 <ref>Foo</ref> {{echo|<references />}}
21741 !! html/parsoid
21742 <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>
21743 </ol>
21744 !!end
21745
21746 !! test
21747 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
21748 !! wikitext
21749 A <ref>foo bar for a</ref>
21750 B <ref group="X" name="b" />
21751
21752 <references />
21753
21754 <references group="X">
21755 <ref name="b">foo</ref>
21756 </references>
21757 !! html/parsoid
21758 <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>
21759 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>
21760 </p>
21761
21762 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21763 <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>
21764 </ol>
21765
21766 <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"}}'>
21767 <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>
21768 </ol>
21769 !! end
21770
21771 !! test
21772 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
21773 !! wikitext
21774 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
21775 <references />
21776 !! html/parsoid
21777 <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>
21778 <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>
21779 </ol>
21780 !!end
21781
21782 # This test only works in wt2html now as the <references /> are always generated
21783 # unless selser is active. Once T72722 is fixed, we should add a changes test
21784 # here to ensure that unrelated changes don't add the new <references /> in
21785 # wt2wt.
21786 !! test
21787 References: 9. Generate missing references list at the end
21788 !! wikitext
21789 A <ref>foo</ref>
21790 B <ref group="inexistent">bar</ref>
21791 !! html/parsoid
21792 <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>
21793 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21794 <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>
21795 </ol>
21796 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
21797 <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>
21798 </ol>
21799 !! end
21800
21801 !! test
21802 References: 10. New <references/> shouldn't be added for unrelated edits.
21803 !! options
21804 parsoid={
21805 "modes": ["selser"],
21806 "changes": [["#x", "remove"]],
21807 "selser": "noauto"
21808 }
21809 !! wikitext
21810 Unrelated text<span id="x"> that's going to disappear</span>.
21811 A <ref>foo</ref>
21812 !! wikitext/edited
21813 Unrelated text.
21814 A <ref>foo</ref>
21815 !!end
21816
21817 !! test
21818 Entities in ref name
21819 !! wikitext
21820 <ref name="test &amp; me">hi</ref>
21821 <references />
21822 !! html/parsoid
21823 <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>
21824 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21825 <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>
21826 </ol>
21827 !! end
21828
21829 # This test is wt2html only because we're permitting the serializer to produce
21830 # dirty diffs, normalizing the unclosed references to the self-closed version.
21831 !! test
21832 Generate references for unclosed references tag
21833 !! options
21834 parsoid=wt2html
21835 !! wikitext
21836 a<ref>foo</ref>
21837
21838 <references>
21839 !! html/parsoid
21840 <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>
21841 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21842 <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>
21843 !! end
21844
21845 !! test
21846 New reference serializes on its own line
21847 !! options
21848 parsoid=wt2wt,html2wt
21849 !! wikitext
21850 foo
21851 <references />
21852 !! html/parsoid
21853 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21854 !! end
21855
21856 #### ----------------------------------------------------------------
21857 #### Parsoid-only testing of Parsoid's impl of LST
21858 #### Not implemented yet, see
21859 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
21860 #### ----------------------------------------------------------------
21861
21862 !!test
21863 LST Sections: 1. Simple section start and end
21864 !! wikitext
21865 <section begin="2011-05-16" />
21866 <section end="2014-04-10 (MW 1.23wmf22)" />
21867 !! html/parsoid
21868 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
21869 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
21870 !! end
21871
21872 #--------- Test stripping of empty nodes in template content ----------
21873 !!test
21874 Empty LI and TR nodes should be stripped from template content
21875 !!wikitext
21876 {{EmptyLITest}}
21877 {{EmptyTRTest}}
21878 !!html/parsoid
21879 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
21880 <li>a</li>
21881 <li>b</li>
21882 </ul>
21883 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
21884 <tbody>
21885 <tr>
21886 <td>foo</td>
21887 </tr>
21888 <tr>
21889 <td>bar</td>
21890 </tr>
21891 </tbody>
21892 </table>
21893 !!end
21894
21895 !!test
21896 Empty LI and TR nodes should not be stripped from top-level content
21897 !!wikitext
21898 * a
21899 *
21900 * b
21901 {|
21902 |-
21903 |-
21904 |foo
21905 |}
21906 !!html/parsoid
21907 <ul>
21908 <li> a</li>
21909 <li></li>
21910 <li> b</li>
21911 </ul>
21912 <table>
21913 <tbody>
21914 <tr></tr>
21915 <tr>
21916 <td>foo</td>
21917 </tr>
21918 </tbody>
21919 </table>
21920 !!end
21921
21922 !!test
21923 Empty TR nodes should not be stripped if they have any attributes set
21924 !!wikitext
21925 {{EmptyTRWithHTMLAttrTest}}
21926 !!html/parsoid
21927 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
21928 <tr align="center"></tr>
21929 <tr><td>foo</td></tr>
21930 <tr align="center"></tr>
21931 <tr><td>bar</td></tr>
21932 </table>
21933 !!end
21934
21935 #### ----------------------------------------------------------------
21936 #### The following section of tests are primarily to test
21937 #### wikitext escaping capabilities of Parsoid. Given that
21938 #### escaping can be done any number of ways, the wikitext (input)
21939 #### is always adjusted to reflect how Parsoid adds nowiki
21940 #### escape tags.
21941 ####
21942 #### We are marking several tests as parsoid-only since the
21943 #### HTML in the result section is different from what the
21944 #### PHP parser generates for it.
21945 #### ----------------------------------------------------------------
21946
21947
21948 #### --------------- Headings ---------------
21949 #### 0. Unnested
21950 #### 1. Nested inside html <h1>=foo=</h1>
21951 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
21952 #### 3. Nested inside html with wikitext split by html tags
21953 #### 4. No escape needed
21954 #### 5. Empty headings <h1></h1>
21955 #### 6. Heading chars in SOL context
21956 #### ----------------------------------------
21957 !! test
21958 Headings: 0. Unnested
21959 !! options
21960 parsoid=html2wt
21961 !! html/parsoid
21962 <p>=foo=</p>
21963
21964 <p> =foo=
21965 <!--cmt-->
21966 =foo=</p>
21967
21968 <p>=foo<i>a</i>=</p>
21969 !! wikitext
21970 <nowiki>=foo=</nowiki>
21971
21972 <nowiki> </nowiki>=foo=
21973 <!--cmt-->
21974 <nowiki>=foo=</nowiki>
21975
21976 =foo''a''<nowiki>=</nowiki>
21977 !!end
21978
21979 # New headings and existing headings are handled differently
21980 !! test
21981 Headings: 1. Nested inside html
21982 !! options
21983 parsoid=html2wt
21984 !! html/parsoid
21985 <h1>=foo=</h1>
21986 <h2>=foo=</h2>
21987 <h3>=foo=</h3>
21988
21989 <h1 data-parsoid=''>=foo=</h1>
21990 <h2 data-parsoid=''>=foo=</h2>
21991 <h3 data-parsoid=''>=foo=</h3>
21992 <h4 data-parsoid=''>=foo=</h4>
21993 <h5 data-parsoid=''>=foo=</h5>
21994 <h6 data-parsoid=''>=foo=</h6>
21995 !! wikitext
21996 = =foo= =
21997
21998 == =foo= ==
21999
22000 === =foo= ===
22001
22002 =<nowiki>=foo=</nowiki>=
22003 ==<nowiki>=foo=</nowiki>==
22004 ===<nowiki>=foo=</nowiki>===
22005 ====<nowiki>=foo=</nowiki>====
22006 =====<nowiki>=foo=</nowiki>=====
22007 ======<nowiki>=foo=</nowiki>======
22008
22009 !!end
22010
22011 !! test
22012 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
22013 !! options
22014 parsoid=html2wt
22015 !! html/parsoid
22016 <h1>foo</h1>*bar
22017 <h1>foo</h1>=bar
22018 <h1>foo</h1>=bar=
22019 !! wikitext
22020 = foo =
22021 <nowiki>*</nowiki>bar
22022
22023 = foo =
22024 =bar
22025
22026 = foo =
22027 <nowiki>=bar=</nowiki>
22028 !!end
22029
22030 !! test
22031 Headings: 3. Nested inside html with wikitext split by html tags
22032 !! options
22033 parsoid=html2wt
22034 !! html/parsoid
22035 <h1>=<b>bold</b>foo=</h1>
22036 !! wikitext
22037 = ='''bold'''<nowiki>foo=</nowiki> =
22038 !!end
22039
22040 !! test
22041 Headings: 4a. No escaping needed (testing just h1 and h2)
22042 !! options
22043 parsoid=html2wt
22044 !! html/parsoid
22045 <h1>=foo</h1>
22046 <h1>foo=</h1>
22047 <h1> =foo= </h1>
22048 <h1>=foo= bar</h1>
22049 <h2>=foo</h2>
22050 <h2>foo=</h2>
22051 <h1>=</h1>
22052 <h1><i>=</i>foo=</h1>
22053 !! wikitext
22054 = =foo =
22055
22056 = foo= =
22057
22058 = =foo= =
22059
22060 = =foo= bar =
22061
22062 == =foo ==
22063
22064 == foo= ==
22065
22066 = = =
22067
22068 = ''=''foo= =
22069 !!end
22070
22071 !! test
22072 Headings: 4b. No escaping needed (inside p-tags)
22073 !! options
22074 parsoid=html2wt
22075 !! html/parsoid
22076 <p>===
22077 =foo= x
22078 =foo= <s></s>
22079 </p>
22080 !! wikitext
22081 ===
22082 =foo= x
22083 =foo= <s></s>
22084 !!end
22085
22086 !! test
22087 Headings: 5. Empty headings
22088 !! options
22089 parsoid=html2wt
22090 !! html/parsoid
22091 <h1 data-parsoid='{}'></h1>
22092
22093 <h2 data-parsoid='{}'></h2>
22094
22095 <h3 data-parsoid='{}'></h3>
22096
22097 <h4 data-parsoid='{}'></h4>
22098
22099 <h5 data-parsoid='{}'></h5>
22100
22101 <h6 data-parsoid='{}'></h6>
22102 !! wikitext
22103 =<nowiki/>=
22104
22105 ==<nowiki/>==
22106
22107 ===<nowiki/>===
22108
22109 ====<nowiki/>====
22110
22111 =====<nowiki/>=====
22112
22113 ======<nowiki/>======
22114 !!end
22115
22116 !! test
22117 Headings: 6a. Heading chars in SOL context (with trailing spaces)
22118 !! options
22119 parsoid=html2wt
22120 !! html/parsoid
22121 <p>=a=</p>
22122
22123 <p>=a=</p>
22124
22125 <p>=a=</p>
22126 !! wikitext
22127 <nowiki>=a=</nowiki>
22128
22129 <nowiki>=a=</nowiki>
22130
22131 <nowiki>=a=</nowiki>
22132 !!end
22133
22134 !! test
22135 Headings: 6b. Heading chars in SOL context (with trailing newlines)
22136 !! options
22137 parsoid=html2wt
22138 !! html/parsoid
22139 <p>=a=
22140 b</p>
22141
22142 <p>=a=
22143 b</p>
22144
22145 <p>=a=
22146 b</p>
22147 !! wikitext
22148 <nowiki>=a=</nowiki>
22149 b
22150
22151 <nowiki>=a=</nowiki>
22152 b
22153
22154 <nowiki>=a=</nowiki>
22155 b
22156 !!end
22157
22158 !! test
22159 Headings: 6c. Heading chars in SOL context (leading newline break)
22160 !! options
22161 parsoid=html2wt
22162 !! html/parsoid
22163 <p>a
22164 =b=</p>
22165 !! wikitext
22166 a
22167 <nowiki>=b=</nowiki>
22168 !!end
22169
22170 !! test
22171 Headings: 6d. Heading chars in SOL context (with interspersed comments)
22172 !! options
22173 parsoid=html2wt
22174 !! html/parsoid
22175 <!--c0--><p>=a=</p>
22176
22177 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
22178 !! wikitext
22179 <!--c0--><nowiki>=a=</nowiki>
22180
22181 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
22182 !!end
22183
22184 !! test
22185 Headings: 6d. Heading chars in SOL context (No escaping needed)
22186 !! options
22187 parsoid=html2wt
22188 !! html/parsoid
22189 =a=<div>b</div>
22190 !! wikitext
22191 =a=<div>b</div>
22192 !!end
22193
22194 !! test
22195 Headings: 7. Insert a newline between new content and headings
22196 !! options
22197 parsoid=html2wt
22198 !! html/parsoid
22199 <h2>NEW</h2>
22200 <p>new</p>
22201 <h2 data-parsoid='{}'>A</h2>
22202 <p data-parsoid='{}'>a</p>
22203 !! wikitext
22204 == NEW ==
22205 new
22206
22207 ==A==
22208 a
22209
22210 !! end
22211
22212 #### --------------- Lists ---------------
22213 #### 0. Outside nests (*foo, etc.)
22214 #### 1. Nested inside html <ul><li>*foo</li></ul>
22215 #### 2. Inside definition lists
22216 #### 3. Only bullets at start should be escaped
22217 #### 4. No escapes needed
22218 #### 5. No unnecessary escapes
22219 #### 6. Escape bullets in SOL position
22220 #### 7. Escape bullets in a multi-line context
22221 #### ----------------------------------------
22222
22223 !! test
22224 Lists: 0. Outside nests
22225 !! options
22226 parsoid=html2wt
22227 !! html/parsoid
22228 <p>*foo</p>
22229
22230 <p>#foo</p>
22231
22232 <p>;Foo:bar</p>
22233 !! wikitext
22234 <nowiki>*</nowiki>foo
22235
22236 <nowiki>#</nowiki>foo
22237
22238 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
22239 !!end
22240
22241 !! test
22242 Lists: 1. Nested inside html
22243 !! options
22244 parsoid=html2wt
22245 !! html/parsoid
22246 <ul><li>*foo</li></ul>
22247 <ul><li>#foo</li></ul>
22248 <ul><li>:foo</li></ul>
22249 <ul><li>;foo</li></ul>
22250 <ol><li>*foo</li></ol>
22251 <ol><li>#foo</li></ol>
22252 <ol><li>:foo</li></ol>
22253 <ol><li>;foo</li></ol>
22254
22255 !! wikitext
22256 *<nowiki>*foo</nowiki>
22257
22258 *<nowiki>#foo</nowiki>
22259
22260 *<nowiki>:foo</nowiki>
22261
22262 *<nowiki>;foo</nowiki>
22263
22264 #<nowiki>*foo</nowiki>
22265
22266 #<nowiki>#foo</nowiki>
22267
22268 #<nowiki>:foo</nowiki>
22269
22270 #<nowiki>;foo</nowiki>
22271 !!end
22272
22273 !! test
22274 Lists: 2. Inside definition lists
22275 !! options
22276 parsoid=html2wt
22277 !! html/parsoid
22278 <dl><dt>;foo</dt></dl>
22279 <dl><dt>:foo</dt></dl>
22280 <dl><dt>:foo</dt>
22281 <dd>bar</dd></dl>
22282 <dl><dd>:foo</dd></dl>
22283
22284 !! wikitext
22285 ;<nowiki>;foo</nowiki>
22286
22287 ;<nowiki>:foo</nowiki>
22288
22289 ;<nowiki>:foo</nowiki>
22290 :bar
22291
22292 :<nowiki>:foo</nowiki>
22293 !!end
22294
22295 !! test
22296 Lists: 3. Only bullets at start of text should be escaped
22297 !! options
22298 parsoid=html2wt
22299 !! html/parsoid
22300 <ul><li>*foo*bar</li></ul>
22301 <ul><li>*foo<i>it</i>*bar</li></ul>
22302
22303 !! wikitext
22304 *<nowiki>*foo*bar</nowiki>
22305
22306 *<nowiki>*foo</nowiki>''it''*bar
22307 !!end
22308
22309 !! test
22310 Lists: 4. No escapes needed
22311 !! options
22312 parsoid=html2wt
22313 !! html/parsoid
22314 <ul>
22315 <li>foo*bar
22316 </li>
22317 </ul>
22318 <ul>
22319 <li><i>foo</i>*bar
22320 </li>
22321 </ul>
22322 <ul>
22323 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
22324 </li>
22325 </ul>
22326 <ul>
22327 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
22328 </li>
22329 </ul>
22330 !! wikitext
22331 *foo*bar
22332
22333 *''foo''*bar
22334
22335 *[[Foo]]: bar
22336
22337 *[[Foo]]*bar
22338 !!end
22339
22340 !! test
22341 Lists: 5. No unnecessary escapes
22342 !! options
22343 parsoid=html2wt
22344 !! html/parsoid
22345 <ul><li> bar <span>[[foo]]</span></li></ul>
22346 <ul><li> =bar <span>[[foo]]</span></li></ul>
22347 <ul><li> [[bar <span>[[foo]]</span></li></ul>
22348 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
22349 <ul><li> =bar <span>foo]]</span>=</li></ul>
22350 <ul><li> <s></s>: a</li></ul>
22351 <ul><li> <i>* foo</i></li></ul>
22352
22353 !! wikitext
22354 * bar <span><nowiki>[[foo]]</nowiki></span>
22355
22356 * =bar <span><nowiki>[[foo]]</nowiki></span>
22357
22358 * [[bar <span><nowiki>[[foo]]</nowiki></span>
22359
22360 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
22361
22362 * =bar <span>foo]]</span>=
22363
22364 * <s></s>: a
22365
22366 * ''* foo''
22367 !!end
22368
22369 !! test
22370 Lists: 6. Escape bullets in SOL position
22371 !! options
22372 parsoid=html2wt
22373 !! html/parsoid
22374 <p><!--cmt-->*foo</p>
22375 !! wikitext
22376 <!--cmt--><nowiki>*</nowiki>foo
22377 !!end
22378
22379 !! test
22380 Lists: 7. Escape bullets in a multi-line context
22381 !! options
22382 parsoid=html2wt
22383 !! html/parsoid
22384 <p>a
22385 *b
22386 </p>
22387 !! wikitext
22388 a
22389 <nowiki>*</nowiki>b
22390 !!end
22391
22392 !! test
22393 Lists: 8. Escape colons only if not present in tags
22394 !! options
22395 parsoid=html2wt
22396 !! html/parsoid
22397 <dl><dt>a:b<i>c:d</i></dt></dl>
22398 !! wikitext
22399 ; <nowiki>a:b</nowiki>''c:d''
22400 !! end
22401
22402 #### --------------- HRs ---------------
22403 #### 1. Single line
22404 #### -----------------------------------
22405
22406 !! test
22407 HRs: 1. Single line
22408 !! options
22409 parsoid=html2wt
22410 !! html/parsoid
22411 <hr />----
22412 <hr />=foo=
22413 <hr />*foo
22414 !! wikitext
22415 ----<nowiki>----</nowiki>
22416 ----=foo=
22417 ----*foo
22418 !! end
22419
22420 #### --------------- Tables ---------------
22421 #### 1a. Simple example
22422 #### 1b. No escaping needed (!foo)
22423 #### 1c. No escaping needed (|foo)
22424 #### 1d. No escaping needed (|}foo)
22425 ####
22426 #### 2a. Nested in td (<td>foo|bar</td>)
22427 #### 2b. Nested in td (<td>foo||bar</td>)
22428 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
22429 ####
22430 #### 3a. Nested in th (<th>foo!bar</th>)
22431 #### 3b. Nested in th (<th>foo!!bar</th>)
22432 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
22433 ####
22434 #### 4a. Escape -
22435 #### 4b. Escape +
22436 #### 4c. No escaping needed
22437 #### --------------------------------------
22438
22439 !! test
22440 Tables: 1a. Simple example
22441 !! options
22442 parsoid=html2wt
22443 !! html/parsoid
22444 <p>{|
22445 |}
22446 </p>
22447 !! wikitext
22448 <nowiki>{|</nowiki>
22449 |}
22450 !! end
22451
22452 !! test
22453 Tables: 1b. No escaping needed
22454 !! options
22455 parsoid=html2wt
22456 !! html/parsoid
22457 <p>!foo
22458 </p>
22459 !! wikitext
22460 !foo
22461 !! end
22462
22463 !! test
22464 Tables: 1c. No escaping needed
22465 !! options
22466 parsoid=html2wt
22467 !! html/parsoid
22468 <p>|foo
22469 </p>
22470 !! wikitext
22471 |foo
22472 !! end
22473
22474 !! test
22475 Tables: 1d. No escaping needed
22476 !! options
22477 parsoid=html2wt
22478 !! html/parsoid
22479 <p>|}foo
22480 </p>
22481 !! wikitext
22482 |}foo
22483 !! end
22484
22485 !! test
22486 Tables: 2a. Nested in td
22487 !! options
22488 parsoid=html2wt
22489 !! html/parsoid
22490 <table><tbody><tr>
22491 <td>foo|bar</td></tr>
22492 <tr><td>x<div>a|b</div></td>
22493 </tbody></table>
22494 !! wikitext
22495 {|
22496 |<nowiki>foo|bar</nowiki>
22497 |-
22498 |x<div><nowiki>a|b</nowiki></div>
22499 |}
22500 !! html/php+tidy
22501 <table>
22502 <tr>
22503 <td>foo|bar</td>
22504 </tr>
22505 <tr>
22506 <td>x
22507 <div>a|b</div>
22508 </td>
22509 </tr>
22510 </table>
22511 !! end
22512
22513 !! test
22514 Tables: 2b. Nested in td
22515 !! options
22516 parsoid=html2wt
22517 !! html/parsoid
22518 <table><tbody><tr>
22519 <td>foo||bar</td>
22520 <td>a<i>b||c</i></td>
22521 <td>a<i><div>b||c</div></i></td>
22522 </tr></tbody></table>
22523 !! wikitext
22524 {|
22525 |<nowiki>foo||bar</nowiki>
22526 |a''<nowiki>b||c</nowiki>''
22527 |a''<div><nowiki>b||c</nowiki></div>''
22528 |}
22529 !! html/php
22530 <table>
22531 <tr>
22532 <td>foo||bar
22533 </td>
22534 <td>a<i>b||c</i>
22535 </td>
22536 <td>a<i><div>b||c</div></i>
22537 </td></tr></table>
22538
22539 !! end
22540
22541 !! test
22542 Tables: 2c. Nested in td -- no escaping needed
22543 !! options
22544 parsoid=html2wt
22545 !! html/*
22546 <table>
22547
22548 <tr>
22549 <td>foo!!bar
22550 </td></tr></table>
22551
22552 !! wikitext
22553 {|
22554
22555 |foo!!bar
22556 |}
22557 !! end
22558
22559 !! test
22560 Tables: 3a. Nested in th
22561 !! options
22562 parsoid=html2wt
22563 !! html/*
22564 <table>
22565
22566 <tr>
22567 <th>foo!bar
22568 </th></tr></table>
22569
22570 !! wikitext
22571 {|
22572
22573 !foo!bar
22574 |}
22575 !! end
22576
22577 !! test
22578 Tables: 3b. Nested in th
22579 !! options
22580 parsoid=html2wt
22581 !! html/parsoid
22582 <table><tbody>
22583 <tr><th>foo!!bar</th>
22584 <th><i>foo|bar</i></th>
22585 <th><i>foo!!bar</i></th>
22586 <th><i><span>foo!!bar</span></i></th>
22587 </tr></tbody></table>
22588 !! wikitext
22589 {|
22590 !<nowiki>foo!!bar</nowiki>
22591 !''<nowiki>foo|bar</nowiki>''
22592 !''<nowiki>foo!!bar</nowiki>''
22593 !''<span><nowiki>foo!!bar</nowiki></span>''
22594 |}
22595 !! html/php
22596 <table>
22597 <tr>
22598 <th>foo!!bar
22599 </th>
22600 <th><i>foo|bar</i>
22601 </th>
22602 <th><i>foo!!bar</i>
22603 </th>
22604 <th><i><span>foo!!bar</span></i>
22605 </th></tr></table>
22606
22607 !! end
22608
22609 !! test
22610 Tables: 3c. Nested in th
22611 !! options
22612 parsoid=html2wt
22613 !! html/parsoid
22614 <table><tbody>
22615 <tr><th>foo||bar</th>
22616 <th><span typeof="mw:Nowiki">foo||bar</span></th>
22617 </tr></tbody></table>
22618 !! wikitext
22619 {|
22620 !<nowiki>foo||bar</nowiki>
22621 !<nowiki>foo||bar</nowiki>
22622 |}
22623 !! html/php
22624 <table>
22625 <tr>
22626 <th>foo||bar
22627 </th>
22628 <th>foo||bar
22629 </th></tr></table>
22630
22631 !! end
22632
22633 !! test
22634 Tables: 4a. Escape -
22635 !! options
22636 parsoid=html2wt
22637 !! html/*
22638 <table>
22639
22640 <tr>
22641 <th>-bar
22642 </th></tr>
22643 <tr>
22644 <td>-bar
22645 </td></tr></table>
22646
22647 !! wikitext
22648 {|
22649
22650 !-bar
22651
22652 |-
22653 |<nowiki>-bar</nowiki>
22654 |}
22655 !! end
22656
22657 !! test
22658 Tables: 4b. Escape +
22659 !! options
22660 parsoid=html2wt
22661 !! html/*
22662 <table>
22663
22664 <tr>
22665 <th>+bar
22666 </th></tr>
22667 <tr>
22668 <td>+bar
22669 </td></tr></table>
22670
22671 !! wikitext
22672 {|
22673
22674 !+bar
22675
22676 |-
22677 |<nowiki>+bar</nowiki>
22678 |}
22679 !! end
22680
22681 !! test
22682 Tables: 4c. No escaping needed
22683 !! options
22684 parsoid=html2wt
22685 !! html/parsoid
22686 <table><tbody>
22687 <tr><td>foo-bar</td><td>foo+bar</td></tr>
22688 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
22689 <tr><td>foo
22690 <p>bar|baz
22691 +bar
22692 -bar</p></td></tr>
22693 <tr><td>x
22694 <div>a|b</div></td>
22695 </tbody></table>
22696 !! wikitext
22697 {|
22698 |foo-bar
22699 |foo+bar
22700 |-
22701 |''foo''-bar
22702 |''foo''+bar
22703 |-
22704 |foo
22705 bar|baz
22706 +bar
22707 -bar
22708 |-
22709 |x
22710 <div>a|b</div>
22711 |}
22712 !! html/php
22713 <table>
22714 <tr>
22715 <td>foo-bar
22716 </td>
22717 <td>foo+bar
22718 </td></tr>
22719 <tr>
22720 <td><i>foo</i>-bar
22721 </td>
22722 <td><i>foo</i>+bar
22723 </td></tr>
22724 <tr>
22725 <td>foo
22726 <p>bar|baz
22727 +bar
22728 -bar
22729 </p>
22730 </td></tr>
22731 <tr>
22732 <td>x
22733 <div>a|b</div>
22734 </td></tr></table>
22735
22736 !! end
22737
22738 !! test
22739 Tables: 4d. No escaping needed
22740 !! options
22741 parsoid=html2wt
22742 !! html/parsoid
22743 <table>
22744 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
22745 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
22746 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
22747 </tbody></table>
22748 !! wikitext
22749 {|
22750 |[[Foo]]-bar
22751 ||+1
22752 ||-2
22753 |}
22754 !! html/php
22755 <table>
22756 <tr>
22757 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
22758 </td>
22759 <td>+1
22760 </td>
22761 <td>-2
22762 </td></tr></table>
22763
22764 !! end
22765
22766 !! test
22767 T97430: Don't emit empty nowiki pairs around marker meta tags
22768 !! options
22769 parsoid=html2wt
22770 !! html/parsoid
22771 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
22772 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
22773 !! wikitext
22774 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
22775 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
22776 !! end
22777
22778 !! test
22779 Unclosed xmlish element in table line shouldn't eat end delimiters
22780 !! options
22781 parsoid=html2wt
22782 !! html/parsoid
22783 <table>
22784 <tbody><tr><td> &lt;foo</td>
22785 <td> bar></td></tr>
22786 </tbody></table>
22787 !! wikitext
22788 {|
22789 | <foo
22790 | bar>
22791 |}
22792 !! html/php
22793 <table>
22794 <tr>
22795 <td> &lt;foo
22796 </td>
22797 <td> bar&gt;
22798 </td></tr></table>
22799
22800 !! end
22801
22802 #### --------------- Links ----------------
22803 #### 1. Quote marks in link text
22804 #### 2. Wikilinks: Escapes needed
22805 #### 3. Wikilinks: No escapes needed
22806 #### 4. Extlinks: Escapes needed
22807 #### 5. Extlinks: No escapes needed
22808 #### --------------------------------------
22809 !! test
22810 Links 1. WikiLinks: No escapes needed
22811 !! options
22812 parsoid=html2wt
22813 !! html/parsoid
22814 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
22815 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
22816 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
22817 !! wikitext
22818 [[Foo|Foo''boo'']]
22819 [[Foo|[Foobar]]]
22820 [[Foo|x [Foobar] x]]
22821 !! html/php
22822 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
22823 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
22824 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
22825 </p>
22826 !! end
22827
22828 !! test
22829 Links 2. WikiLinks: Escapes needed
22830 !! options
22831 parsoid=html2wt
22832 !! html/parsoid
22833 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
22834 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
22835 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
22836 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
22837 <a href="Foo" rel="mw:WikiLink">|Bar</a>
22838 <a href="Foo" rel="mw:WikiLink">]]bar</a>
22839 <a href="Foo" rel="mw:WikiLink">[[bar</a>
22840 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
22841 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
22842 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
22843 !! wikitext
22844 [[Foo|<nowiki>Foobar]</nowiki>]]
22845 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
22846 [[Foo|<nowiki>[[Bar]]</nowiki>]]
22847 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
22848 [[Foo|<nowiki>|Bar</nowiki>]]
22849 [[Foo|<nowiki>]]bar</nowiki>]]
22850 [[Foo|<nowiki>[[bar</nowiki>]]
22851 [[Foo|<nowiki>x [[ y</nowiki>]]
22852 [[Foo|<nowiki>x ]] y</nowiki>]]
22853 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
22854 !! html/php
22855 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
22856 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
22857 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
22858 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
22859 <a href="/wiki/Foo" title="Foo">|Bar</a>
22860 <a href="/wiki/Foo" title="Foo">]]bar</a>
22861 <a href="/wiki/Foo" title="Foo">[[bar</a>
22862 <a href="/wiki/Foo" title="Foo">x [[ y</a>
22863 <a href="/wiki/Foo" title="Foo">x ]] y</a>
22864 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
22865 </p>
22866 !! end
22867
22868 !! test
22869 Links 3. WikiLinks: No escapes needed
22870 !! options
22871 parsoid=html2wt
22872 !! html/parsoid
22873 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
22874 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
22875 !! wikitext
22876 [[Foo|[Foobar]]
22877 [[Foo|foo|bar]]
22878 !! html/php
22879 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
22880 <a href="/wiki/Foo" title="Foo">foo|bar</a>
22881 </p>
22882 !! end
22883
22884 !! test
22885 Links 4. ExtLinks: Escapes needed
22886 !! options
22887 parsoid=html2wt
22888 !! html/parsoid
22889 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
22890 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
22891 <p>[http://google.com]</p>
22892 <p>[http://google.com google]</p>
22893 !! wikitext
22894 [http://google.com <nowiki>[google]</nowiki>]
22895 [http://google.com <nowiki>google]</nowiki>]
22896
22897 <nowiki>[http://google.com]</nowiki>
22898
22899 <nowiki>[http://google.com google]</nowiki>
22900
22901 !! html/php
22902 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
22903 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
22904 </p><p>[http://google.com]
22905 </p><p>[http://google.com google]
22906 </p>
22907 !! end
22908
22909 !! test
22910 Links 5. ExtLinks: No escapes needed
22911 !! options
22912 parsoid=html2wt
22913 !! html/parsoid
22914 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
22915 !! wikitext
22916 [http://google.com [google]
22917 !! html/php
22918 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
22919 </p>
22920 !! end
22921
22922 !! test
22923 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
22924 !! options
22925 parsoid=html2wt
22926 !! html/parsoid
22927 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
22928 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
22929 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
22930 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
22931 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
22932 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
22933 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
22934 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
22935 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
22936 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
22937 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
22938 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
22939 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
22940 </p>
22941 !! wikitext
22942 x<nowiki/>http://example.com<nowiki/>y
22943 http://example.com<nowiki/>?x
22944 http://example.com<nowiki/>&x
22945 http://example.com<nowiki/>'x
22946 http://example.com<nowiki/>,x
22947 http://example.com<nowiki/>.x
22948 http://example.com<nowiki/>;x
22949 http://example.com<nowiki/>:x
22950 http://example.com<nowiki/>;x
22951 http://example.com<nowiki/>!x
22952 http://example.com<nowiki/>=x
22953 http://example.com<nowiki/>(x)
22954 http://example.com(x<nowiki/>)
22955 !! end
22956
22957 !! test
22958 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
22959 !! options
22960 parsoid=html2wt
22961 !! html/parsoid
22962 <p>x
22963 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
22964 y
22965 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
22966 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
22967 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
22968 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
22969 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
22970 </p>
22971 !! wikitext
22972 x
22973 http://example.com
22974 y
22975 "http://example.com"
22976 (http://example.com)
22977 (http://example.com) foo
22978 http://example.com,
22979 http://example.com, foo
22980 !! html/php
22981 <p>x
22982 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
22983 y
22984 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
22985 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
22986 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
22987 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
22988 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
22989 </p>
22990 !! end
22991
22992 !! test
22993 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
22994 !! options
22995 parsoid=html2wt
22996 !! html/parsoid
22997 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
22998 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
22999 !! wikitext
23000 http://example.com.,;:!?\
23001 -http://example.com:
23002 !! html/php
23003 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
23004 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
23005 </p>
23006 !! end
23007
23008 !! test
23009 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
23010 !! options
23011 parsoid=html2wt
23012 !! html/parsoid
23013 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
23014 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
23015 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
23016 !! wikitext
23017 RFC 123<nowiki/>4
23018 RFC 123<nowiki/>y
23019 X<nowiki/>RFC 123<nowiki/>y
23020 !! end
23021
23022 !! test
23023 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
23024 !! options
23025 parsoid=html2wt
23026 !! html/parsoid
23027 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
23028 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
23029 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
23030 </p>
23031 !! wikitext
23032 RFC 123?foo
23033 RFC 123&foo
23034 -RFC 123-
23035 !! html/php
23036 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
23037 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
23038 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
23039 </p>
23040 !! end
23041
23042 !! test
23043 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
23044 !! options
23045 parsoid=html2wt
23046 !! html/parsoid
23047 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
23048 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23049 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23050 !! wikitext
23051 PMID 123<nowiki/>4
23052 PMID 123<nowiki/>y
23053 X<nowiki/>PMID 123<nowiki/>y
23054 !! end
23055
23056 !! test
23057 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
23058 !! options
23059 parsoid=html2wt
23060 !! html/parsoid
23061 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
23062 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
23063 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
23064 </p>
23065 !! wikitext
23066 PMID 123?foo
23067 PMID 123&foo
23068 -PMID 123-
23069 !! html/php
23070 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
23071 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
23072 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
23073 </p>
23074 !! end
23075
23076 !! test
23077 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
23078 !! options
23079 parsoid=html2wt
23080 !! html/parsoid
23081 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
23082 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
23083 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
23084 </p>
23085 !! wikitext
23086 ISBN 1234567890<nowiki/>1
23087 ISBN 1234567890<nowiki/>x
23088 a<nowiki/>ISBN 1234567890<nowiki/>b
23089 !! end
23090
23091 !! test
23092 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
23093 !! options
23094 parsoid=html2wt
23095 !! html/parsoid
23096 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
23097 !! wikitext
23098 -ISBN 1234567890's
23099 !! html/php
23100 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
23101 </p>
23102 !! end
23103
23104 !! test
23105 Links 14. Protect link-like plain text. (Parsoid bug T78425)
23106 !! options
23107 parsoid=html2wt
23108 !! html/*
23109 <p>this is not a link: http://example.com
23110 </p>
23111 !! wikitext
23112 <nowiki>this is not a link: http://example.com</nowiki>
23113 !! end
23114
23115 !! test
23116 Links 15. Link trails can't become link prefixes.
23117 !! options
23118 language=is
23119 parsoid=html2wt
23120 !! html/parsoid
23121 <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>
23122 !! wikitext
23123 [[Söfnuður]]-[[00]]
23124 !! html/php
23125 <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>
23126 </p>
23127 !! end
23128
23129 #### --------------- Quotes ---------------
23130 #### 1. Quotes inside <b> and <i>
23131 #### 2. Link fragments separated by <i> and <b> tags
23132 #### 3. Link fragments inside <i> and <b>
23133 #### 4. No escaping needed
23134 #### --------------------------------------
23135 !! test
23136 1a. Quotes inside <b> and <i>
23137 !! options
23138 parsoid=html2wt
23139 !! html/*
23140 <p><i>'foo'</i>
23141 <i>''foo''</i>
23142 <i>'''foo'''</i>
23143 <i>foo</i>'s
23144 <b>'foo'</b>
23145 <b>''foo''</b>
23146 <b>'''foo'''</b>
23147 <b>foo'<i>bar'</i>baz</b>
23148 <b>foo</b>'s
23149 '<i>foo</i>
23150 <i>foo</i>'
23151 <i>foo'</i>'
23152 '<i>foo</i>'
23153 '<b>foo</b>
23154 <b>foo</b>'
23155 '<b>foo</b>'
23156 <i>fools'<span> errand</span></i>
23157 <i><span>fool</span>'s errand</i>
23158 '<i>foo</i> bar '<i>baz</i>
23159 a|!*#-:;+-~[]{}b'<i>x</i>
23160 </p>
23161 !! wikitext
23162 ''<nowiki/>'foo'''
23163 ''<nowiki>''foo''</nowiki>''
23164 ''<nowiki>'''foo'''</nowiki>''
23165 ''foo''<nowiki/>'s
23166 '''<nowiki/>'foo''''
23167 '''<nowiki>''foo''</nowiki>'''
23168 '''<nowiki>'''foo'''</nowiki>'''
23169 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
23170 '''foo'''<nowiki/>'s
23171 '''foo''
23172 ''foo''<nowiki/>'
23173 ''foo'''<nowiki/>'
23174 '''foo''<nowiki/>'
23175 ''''foo'''
23176 '''foo'''<nowiki/>'
23177 ''''foo'''<nowiki/>'
23178 ''fools'<span> errand</span>''
23179 ''<span>fool</span>'s errand''
23180 '<nowiki/>''foo'' bar '''baz''
23181 a|!*#-:;+-~[]{}b'''x''
23182 !! end
23183
23184 !! test
23185 1b. Quotes inside <b> and <i> with other tags on same line
23186 !! options
23187 parsoid=html2wt
23188 !! html/parsoid
23189 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23190 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23191 <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>
23192 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
23193 '<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>
23194 '<i>foo</i> <div title="name">test</div>
23195 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
23196 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
23197 <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>
23198 </ol>
23199 !! wikitext
23200 '''a'' foo ''[[bar]]''
23201 ''a''' foo ''[[bar]]''
23202 ''a''' foo '''{{echo|[[bar]]}}'''
23203 [[foo]] x'''[[bar]]''
23204 '''foo'' <ref>test</ref>
23205 '''foo'' <div title="name">test</div>
23206 '''foo'' and <br> bar
23207 <references />
23208 !! end
23209
23210 !! test
23211 2. Link fragments separated by <i> and <b> tags
23212 !! options
23213 parsoid=html2wt
23214 !! html/parsoid
23215 <p>[[<i>foo</i>hello]]</p>
23216 <p>[[<b>foo</b>hello]]</p>
23217 !! wikitext
23218 [[''foo''<nowiki>hello]]</nowiki>
23219
23220 [['''foo'''<nowiki>hello]]</nowiki>
23221 !! end
23222
23223 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
23224 # this is one of the shortcomings of this format
23225 !! test
23226 3. Link fragments inside <i> and <b>
23227 !! options
23228 parsoid=html2wt
23229 !! html/parsoid
23230 <p><i>[[foo</i>]]</p>
23231 <p><b>[[foo</b>]]</p>
23232 !! wikitext
23233 ''[[foo''<nowiki>]]</nowiki>
23234
23235 '''[[foo'''<nowiki>]]</nowiki>
23236 !! end
23237
23238 !! test
23239 4. No escaping needed
23240 !! options
23241 options=html2wt
23242 !! html/parsoid
23243 <p>'<span><i>bar</i></span>'
23244 '<span><b>bar</b></span>'
23245 'a:b'foo
23246 </p>
23247 !! wikitext
23248 '<span>''bar''</span>'
23249 '<span>'''bar'''</span>'
23250 'a:b'foo
23251 !! end
23252
23253 #### ----------- Paragraphs ---------------
23254 #### 1. No unnecessary escapes
23255 #### --------------------------------------
23256
23257 !! test
23258 1. No unnecessary escapes
23259 !! options
23260 parsoid=html2wt
23261 !! html/parsoid
23262 <p>bar <span>[[foo]]</span>
23263 </p><p>=bar <span>[[foo]]</span>
23264 </p><p>[[bar <span>[[foo]]</span>
23265 </p><p>]]bar <span>[[foo]]</span>
23266 </p><p>=bar <span>foo]]</span>=
23267 </p>
23268 !! wikitext
23269 bar <span><nowiki>[[foo]]</nowiki></span>
23270
23271 =bar <span><nowiki>[[foo]]</nowiki></span>
23272
23273 [[bar <span><nowiki>[[foo]]</nowiki></span>
23274
23275 ]]bar <span><nowiki>[[foo]]</nowiki></span>
23276
23277 =bar <span>foo]]</span><nowiki>=</nowiki>
23278 !!end
23279
23280 #### ----------------------- PRE --------------------------
23281 #### 1. Leading whitespace in SOL context should be escaped
23282 #### ------------------------------------------------------
23283 !! test
23284 1. Leading whitespace in SOL context should be escaped
23285 !! options
23286 parsoid=html2wt
23287 !! html/parsoid
23288 <p> a</p>
23289
23290 <p> a</p>
23291
23292 <p> a(tab)</p>
23293
23294 <p> a
23295 <!--cmt-->
23296 a</p>
23297
23298 <p>a
23299 b</p>
23300
23301 <p>a
23302 b</p>
23303
23304 <p>a
23305 b</p>
23306 !! wikitext
23307 <nowiki> </nowiki>a
23308
23309 <nowiki> </nowiki> a
23310
23311 a(tab)
23312
23313 <nowiki> </nowiki> a
23314 <!--cmt-->
23315 <nowiki> </nowiki>a
23316
23317 a
23318 <nowiki> </nowiki>b
23319
23320 a
23321 b
23322
23323 a
23324 b
23325 !! html/php
23326 <p> a
23327 </p><p> a
23328 </p><p> a(tab)
23329 </p><p> a
23330 a
23331 </p><p>a
23332 b
23333 </p><p>a
23334 b
23335 </p><p>a
23336 b
23337 </p>
23338 !! end
23339
23340 !! test
23341 2. Leading whitespace in non-indent-pre contexts should not be escaped
23342 !! options
23343 parsoid=htm2wt
23344 !! html/parsoid
23345 <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>
23346 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23347 <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>
23348 b</span></li>
23349 </ol>
23350 !! wikitext
23351 foo <ref>''a''
23352 b</ref>
23353 <references />
23354 !! end
23355
23356 !! test
23357 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
23358 !! options
23359 parsoid=html2wt
23360 !! html/parsoid
23361 <blockquote>
23362 <p>
23363 a
23364 <span>b</span>
23365 c</p>
23366 </blockquote>
23367 !! wikitext
23368 <blockquote>
23369 a
23370 <span>b</span>
23371 c
23372 </blockquote>
23373 !! end
23374
23375 !! test
23376 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
23377 !! options
23378 options=html2wt
23379 !! html/parsoid
23380 <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>
23381 !! wikitext
23382 [[File:Foobar.jpg|thumb|caption]]
23383 !! end
23384
23385 !! test
23386 5. Nowiki escaping should account for indent-pres
23387 !! options
23388 parsoid=html2wt
23389 !! html/parsoid
23390 <pre>==foo==</pre>
23391 !! wikitext
23392 ==foo==
23393 !! end
23394
23395 !!test
23396 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
23397 !! options
23398 parsoid=html2wt
23399 !! html/parsoid
23400 <pre>
23401 * foo
23402 * bar
23403 </pre>
23404 !! wikitext
23405 * foo
23406 * bar
23407 !! end
23408
23409 #### --------------- Behavior Switches --------------------
23410
23411 !! test
23412 1. Valid behavior switches should be escaped
23413 !! options
23414 parsoid=html2wt
23415 !! html/parsoid
23416 __TOC__
23417 <i>__TOC__</i>
23418 !! wikitext
23419 <nowiki>__TOC__</nowiki>
23420 ''<nowiki>__TOC__</nowiki>''
23421 !! end
23422
23423 !! test
23424 2. Invalid behavior switches should not be escaped
23425 !! options
23426 parsoid=html2wt
23427 !! html/parsoid
23428 __TOO__
23429 __|__
23430 !! wikitext
23431 __TOO__
23432 __|__
23433 !! end
23434
23435 # We use indent-pre as an indirect way to test for sol-transparent behavior.
23436 !! test
23437 Behavior switches should be SOL-transparent
23438 !! options
23439 parsoid=html2wt
23440 !! html/parsoid
23441 <meta property="mw:PageProp/toc" />
23442
23443 <!-- this one's bogus -->
23444 <pre>__TOO__</pre>
23445
23446 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
23447
23448 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
23449 !! wikitext
23450 __TOC__
23451
23452 <!-- this one's bogus -->
23453 __TOO__
23454
23455 __TOC__ foo
23456
23457 __TOC__ bar
23458 !! end
23459
23460 #### --------------- HTML tags ---------------
23461 #### 1. a tags
23462 #### 2. other tags
23463 #### 3. multi-line html tag
23464 #### 4. extension tags
23465 #### -----------------------------------------
23466 !! test
23467 1. a tags
23468 !! options
23469 parsoid=html2wt
23470 !! html/parsoid
23471 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
23472 !! wikitext
23473 <a href="http://google.com">google</a>
23474 !! end
23475
23476 !! test
23477 2. other tags
23478 !! options
23479 parsoid=html2wt
23480 !! html/parsoid
23481 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
23482 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
23483 <li> &lt;td&gt;</li></ul>
23484
23485 !! wikitext
23486 * <nowiki><div>foo</div></nowiki>
23487 * <nowiki><div style="color:red">foo</div></nowiki>
23488 * <nowiki><td></nowiki>
23489 !! end
23490
23491 !! test
23492 3. multi-line html tag
23493 !! options
23494 parsoid=html2wt
23495 !! html/parsoid
23496 <p>&lt;div
23497 &gt;foo&lt;/div
23498 &gt;
23499 </p>
23500 !! wikitext
23501 <nowiki><div
23502 >foo</div
23503 ></nowiki>
23504 !! end
23505
23506 !! test
23507 4. extension tags
23508 !! options
23509 parsoid=html2wt
23510 !! html/parsoid
23511 <p>&lt;ref&gt;foo&lt;/ref&gt;
23512 </p><p>&lt;ref&gt;bar
23513 </p><p>baz&lt;/ref&gt;
23514 </p>
23515 !! wikitext
23516 <nowiki><ref>foo</ref></nowiki>
23517
23518 <nowiki><ref>bar</nowiki>
23519
23520 baz<nowiki></ref></nowiki>
23521 !! end
23522
23523 #### --------------- Others ---------------
23524 !! test
23525 Escaping nowikis
23526 !! options
23527 parsoid=html2wt
23528 !! html/parsoid
23529 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
23530 </p>
23531 !! wikitext
23532 &lt;nowiki&gt;foo&lt;/nowiki&gt;
23533 !! end
23534
23535 ## The quote-char in the input is necessary for triggering the bug
23536 !! test
23537 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
23538 !! options
23539 parsoid=html2wt
23540 !! html/parsoid
23541 <p>foo's bar :</p>
23542 !! wikitext
23543 foo's bar :
23544 !! end
23545
23546 #----------- End of wikitext escaping tests --------------
23547
23548 !! test
23549
23550 Tag-like HTML structures are passed through as text
23551 !! wikitext
23552 <x y>
23553
23554 <x.y>
23555
23556 <x-y>
23557
23558 1>2
23559
23560 x<y
23561
23562 a>b
23563
23564 1<d e>f
23565 !! html
23566 <p>&lt;x y&gt;
23567 </p><p>&lt;x.y&gt;
23568 </p><p>&lt;x-y&gt;
23569 </p><p>1&gt;2
23570 </p><p>x&lt;y
23571 </p><p>a&gt;b
23572 </p><p>1&lt;d e&gt;f
23573 </p>
23574 !! end
23575
23576 !! test
23577 HTML tag with necessary entities in attributes
23578 !! wikitext
23579 <span title="&amp;amp;">foo</span>
23580 !! html
23581 <p><span title="&amp;amp;">foo</span>
23582 </p>
23583 !! end
23584
23585 !! test
23586 HTML tag with 'unnecessary' entity encoding in attributes
23587 !! wikitext
23588 <span title="&amp;">foo</span>
23589 !! html
23590 <p><span title="&amp;">foo</span>
23591 </p>
23592 !! end
23593
23594 !! test
23595 HTML tag with broken attribute value quoting
23596 !! wikitext
23597 <span title="Hello world>Foo</span>
23598 !! html/php
23599 <p><span title="Hello world">Foo</span>
23600 </p>
23601 !! html/parsoid
23602 <p><span title="Hello world">Foo</span>
23603 </p>
23604 !! end
23605
23606 !! test
23607 Table with broken attribute value quoting
23608 !! wikitext
23609 {|
23610 | title="Hello world|Foo
23611 |}
23612 !! html/php
23613 <table>
23614 <tr>
23615 <td title="Hello world">Foo
23616 </td></tr></table>
23617
23618 !! html/parsoid
23619 <table>
23620 <tr>
23621 <td title="Hello world">Foo
23622 </td></tr></table>
23623
23624 !! end
23625
23626 !! test
23627 Table with broken attribute value quoting on consecutive lines
23628 !! wikitext
23629 {|
23630 | title="Hello world|Foo
23631 | style="color:red|Bar
23632 |}
23633 !! html/php
23634 <table>
23635 <tr>
23636 <td title="Hello world">Foo
23637 </td>
23638 <td style="color:red">Bar
23639 </td></tr></table>
23640
23641 !! html/parsoid
23642 <table><tbody>
23643 <tr>
23644 <td title="Hello world">Foo
23645 </td><td style="color: red">Bar
23646 </td></tr></tbody></table>
23647
23648 !! end
23649
23650 !! test
23651 2. Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23652 !! options
23653 parsoid
23654 !! wikitext
23655 {{}}
23656 !! html
23657 {{}}
23658 !! end
23659
23660 !! test
23661 1. Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23662 !! options
23663 parsoid
23664 !! wikitext
23665 }}{{
23666 !! html
23667 }}{{
23668 !! end
23669
23670 !!test
23671 Accept empty td cell attribute
23672 !! wikitext
23673 {|
23674 | align="center" | foo || |
23675 |}
23676 !! html
23677 <table>
23678 <tr>
23679 <td align="center"> foo </td>
23680 <td>
23681 </td></tr></table>
23682
23683 !!end
23684
23685 !!test
23686 Non-empty attributes in th-cells
23687 !! wikitext
23688 {|
23689 ! Foo !! style="color: red" | Bar
23690 |}
23691 !! html
23692 <table>
23693 <tr>
23694 <th> Foo </th>
23695 <th style="color: red"> Bar
23696 </th></tr></table>
23697
23698 !!end
23699
23700 !!test
23701 Accept empty attributes in th-cells
23702 !! wikitext
23703 {|
23704 !| foo !!| bar
23705 |}
23706 !! html
23707 <table>
23708 <tr>
23709 <th> foo </th>
23710 <th> bar
23711 </th></tr></table>
23712
23713 !!end
23714
23715 !!test
23716 Empty table rows go away
23717 !! wikitext
23718 {|
23719 | Hello
23720 | there
23721 |- class="foo"
23722 |-
23723 |}
23724 !! html
23725 <table>
23726 <tr>
23727 <td> Hello
23728 </td>
23729 <td> there
23730 </td></tr>
23731
23732 </table>
23733
23734 !! end
23735
23736 ###
23737 ### Parsoid-centric tests for testing RTing of inter-element separators
23738 ### Edge cases not tested by existing parser tests and specific to
23739 ### Parsoid-specific serialization strategies.
23740 ###
23741
23742 !!test
23743 RT-ed inter-element separators should be valid separators
23744 !! wikitext
23745 {|
23746 |- [[foo]]
23747 |}
23748 !! html
23749 <table>
23750
23751 </table>
23752
23753 !!end
23754
23755 # Parsoid-only since PHP parser relies on Tidy for correct output
23756 !!test
23757 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
23758 !!options
23759 parsoid
23760 !! wikitext
23761 {|
23762 |<small>foo
23763 bar
23764 |}
23765
23766 {|
23767 |<small>foo<small>
23768 |}
23769 !! html
23770 <table>
23771 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
23772 <p>bar</p></small></td></tr>
23773 </tbody></table>
23774
23775 <table>
23776 <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>
23777 </tbody></table>
23778 !!end
23779
23780 # Note that the "style" attribute is really a template parameter here.
23781 # The = would have to be {{=}} if you wanted the literal.
23782 !!test
23783 Empty TD followed by TD with tpl-generated attribute
23784 !! wikitext
23785 {|
23786 |-
23787 |
23788 |{{echo|style='color:red'}}|foo
23789 |}
23790 !! html
23791 <table>
23792
23793 <tr>
23794 <td>
23795 </td>
23796 <td>foo
23797 </td></tr></table>
23798
23799 !!end
23800
23801 !!test
23802 Indented table with an empty td
23803 !! wikitext
23804 {|
23805 |-
23806 |
23807 |foo
23808 |}
23809 !! html
23810 <table>
23811
23812 <tr>
23813 <td>
23814 </td>
23815 <td>foo
23816 </td></tr></table>
23817
23818 !!end
23819
23820 ## We have some newline diffs RT-ing this edge case
23821 ## and it is not important enough -- we seem to be emitting
23822 ## at most 2 newlines after a </tr> and this is unrelated to
23823 ## the issue from T85627 that this is testing.
23824 !!test
23825 Indented table with blank lines in between (T85627)
23826 !! options
23827 parsoid=wt2html
23828 !! wikitext
23829 {|
23830 |foo
23831
23832
23833 |}
23834 !! html
23835 <table>
23836
23837 <tr>
23838 <td>foo
23839 </td></tr></table>
23840
23841 !!end
23842
23843 !!test
23844 Indented block & table
23845 !! wikitext
23846 <div>foo</div>
23847 {|
23848 |foo
23849 |}
23850 !! html/php
23851 <div>foo</div>
23852 <table>
23853 <tr>
23854 <td>foo
23855 </td></tr></table>
23856
23857 !! html/parsoid
23858 <div data-parsoid='{"stx":"html"}'>foo</div>
23859 <table><tbody>
23860 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
23861 </tbody></table>
23862 !!end
23863
23864 !! test
23865 Indent and comment before table row
23866 !! wikitext
23867 {|
23868 <!--hi-->|-
23869 | there
23870 |}
23871 !! html/php
23872 <table>
23873
23874 <tr>
23875 <td> there
23876 </td></tr></table>
23877
23878 !! html/parsoid
23879 <table>
23880 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
23881 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
23882 </tbody></table>
23883 !! end
23884
23885 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
23886 !!test
23887 Empty TR followed by a template-generated TR
23888 !!options
23889 parsoid
23890 !! wikitext
23891 {|
23892 |-
23893 {{echo|<tr><td>foo</td></tr>}}
23894 |}
23895 !! html
23896 <table>
23897 <tbody>
23898 <tr></tr>
23899 <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}}]}'>
23900 <td>foo</td></tr>
23901 </tbody></table>
23902 !!end
23903
23904 ## PHP and parsoid output differ for this, and since this is primarily
23905 ## for testing Parsoid's serializer, marking this Parsoid only
23906 !!test
23907 Empty TR followed by mixed-ws-comment line should RT correctly
23908 !!options
23909 parsoid
23910 !! wikitext
23911 {|
23912 |-
23913 <!--c-->
23914 |-
23915 <!--c--> <!--d-->
23916 |}
23917 !! html
23918 <table>
23919 <tbody>
23920 <tr></tr>
23921 <!--c-->
23922 <tr>
23923 <!--c--> </tr><!--d-->
23924 </tbody></table>
23925
23926 !!end
23927
23928 !!test
23929 Multi-line image caption generated by templates with/without trailing newlines
23930 !! wikitext
23931 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
23932 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
23933 !! html/parsoid
23934 <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>
23935 <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>
23936 !!end
23937
23938 !! test
23939 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
23940 !! options
23941 parsoid=html2wt
23942 !! html/parsoid
23943 <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>
23944
23945 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
23946 !! wikitext
23947 <includeonly>foo</includeonly>
23948 new para
23949
23950 [[Category:Foo]]
23951
23952 = new heading =
23953 !! end
23954
23955 ## PHP emits broken html for this, and since this is primarily
23956 ## a Parsoid serializer test, marking this Parsoid only
23957 !!test
23958 Improperly nested inline or quotes tags with whitespace in between
23959 !! wikitext
23960 <span> <s>x</span> </s>
23961 ''' ''x''' ''
23962 !! html/parsoid
23963 <p><span> <s>x</s></span><s> </s>
23964 <b> <i>x</i></b><i> </i>
23965 </p>
23966 !!end
23967
23968 !!test
23969 Encapsulate protected attributes from wt
23970 !! wikitext
23971 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
23972 !! html/parsoid
23973 <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>
23974 </body>
23975 !!end
23976
23977 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
23978 ## Having nested or stray pre tags results in the attempt to add duplicates,
23979 ## causing an assertion fail. This test tries to prevent that situation.
23980 !!test
23981 Ensure ParagraphWrapper can deal with stray closing pre tags
23982 !!options
23983 parsoid=wt2html
23984 !! wikitext
23985 plain text</pre>
23986 !! html/parsoid
23987 plain text
23988 !!end
23989
23990 !!test
23991 1. Ensure fostered text content is wrapped in element nodes
23992 !!options
23993 parsoid=wt2html
23994 !! wikitext
23995 <table>hi</table><table>ho</table>
23996 !! html/parsoid
23997 <p>hi</p>
23998 <table></table>
23999 <p>ho</p>
24000 <table></table>
24001 !!end
24002
24003 !!test
24004 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
24005 !!options
24006 parsoid=wt2html,wt2wt
24007 !! wikitext
24008 <table>
24009 <tr> || ||
24010 <td> a
24011 </table>
24012 !! html/parsoid
24013 <p> || ||
24014 </p><table>
24015 <tbody><tr><td> a</td></tr>
24016 </tbody></table>
24017 !!end
24018
24019 !!test
24020 Encapsulation properly handles null DSR information from foster box
24021 !!options
24022 parsoid=wt2html,wt2wt
24023 !! wikitext
24024 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
24025 !! html/parsoid
24026 <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>
24027 !!end
24028
24029 !!test
24030 1. Encapsulate foster-parented transclusion content
24031 !!options
24032 parsoid=wt2wt,wt2html
24033 !! wikitext
24034 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
24035 !! html/parsoid
24036 <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>
24037 <tbody>
24038 <tr>
24039 <td>bar</td>
24040 </tr>
24041 </tbody>
24042 </table>
24043 !!end
24044
24045 !!test
24046 2. Encapsulate foster-parented transclusion content
24047 !!options
24048 parsoid=wt2wt,wt2html
24049 !! wikitext
24050 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
24051 !! html/parsoid
24052 <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>
24053 <table>
24054 <tbody>
24055 <tr>
24056 <td>bar</td>
24057 </tr>
24058 </tbody>
24059 </table>
24060 !!end
24061
24062 !!test
24063 3. Encapsulate foster-parented transclusion content
24064 !!options
24065 parsoid=wt2wt,wt2html
24066 !! wikitext
24067 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24068 !! html/parsoid
24069 <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;]}">
24070 <p>foo</p>
24071 </div>
24072 <table>
24073 <tbody>
24074 <tr>
24075 <td>bar</td>
24076 </tr>
24077 </tbody>
24078 </table>
24079 !!end
24080
24081 !!test
24082 4. Encapsulate foster-parented transclusion content
24083 !!options
24084 parsoid=wt2wt,wt2html
24085 !! wikitext
24086 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24087 !! html/parsoid
24088 <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;]}">
24089 <p>foo</p>
24090 </div>
24091 <table>
24092 <tbody>
24093 <tr>
24094 <td>bar</td>
24095 </tr>
24096 </tbody>
24097 </table>
24098 !!end
24099
24100 !!test
24101 5. Encapsulate foster-parented transclusion content
24102 !!options
24103 parsoid=wt2wt,wt2html
24104 !! wikitext
24105 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
24106 !! html/parsoid
24107 <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>
24108 <table>
24109 <tbody>
24110 <tr>
24111 <td>
24112 <div>
24113 <p>foo</p>
24114 </div>
24115 </td>
24116 </tr>
24117 </tbody>
24118 </table>
24119 !!end
24120
24121 !!test
24122 6. Encapsulate foster-parented transclusion content
24123 !!options
24124 parsoid=wt2wt,wt2html
24125 !! wikitext
24126 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
24127 !! html/parsoid
24128 <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>
24129 <table>
24130 <tbody>
24131 <tr>
24132 <td>
24133 <div>
24134 <p>foo</p>
24135 </div>
24136 </td>
24137 </tr>
24138 </tbody>
24139 </table>
24140 <p>ok</p>
24141 !!end
24142
24143 !!test
24144 7. Encapsulate foster-parented transclusion content
24145 !!options
24146 parsoid=wt2wt,wt2html
24147 !! wikitext
24148 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
24149 !! html/parsoid
24150 <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>
24151 <table>
24152 <tbody>
24153 <tr>
24154 <td>bar</td>
24155 </tr>
24156 </tbody>
24157 </table>
24158 !!end
24159
24160 # Note that the wt is broken on purpose: the = should be {{=}} if you
24161 # don't want it to be a template parameter key.
24162 !!test
24163 8. Encapsulate foster-parented transclusion content
24164 !!options
24165 parsoid=wt2wt,wt2html
24166 !! wikitext
24167 {{echo|a
24168 }}{|{{echo|style='color:red'}}
24169 |-
24170 |b
24171 |}
24172 !! html/parsoid
24173 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
24174 <span> </span>
24175 <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>
24176 <table>
24177 <tbody>
24178 <tr>
24179 <td>b</td>
24180 </tr>
24181 </tbody>
24182 </table>
24183 !!end
24184
24185 !!test
24186 9. Encapsulate foster-parented transclusion content
24187 !!options
24188 parsoid=wt2wt,wt2html
24189 !! wikitext
24190 <table>{{echo|hi</table>hello}}
24191 !! html/parsoid
24192 <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>
24193 !!end
24194
24195 !!test
24196 Table in fosterable position
24197 !!options
24198 parsoid=wt2html,wt2wt
24199 !! wikitext
24200 {{OpenTable}}
24201 <div>
24202 {|
24203 |}
24204 </div>
24205 |}
24206 !! html/parsoid
24207 <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">
24208 </span>
24209 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
24210
24211 <table>
24212 </table>
24213 !!end
24214
24215 # Parsoid only for bug 64747
24216 !! test
24217 Properly encapsulate empty-content transclusions in fosterable positions
24218 !! wikitext
24219 <table>
24220 {{#if:|
24221 <td>foo</td>
24222 }}
24223 </table>
24224 !! html/parsoid
24225 <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":["","","",""]}]]}'>
24226
24227 </table>
24228 !! end
24229
24230 !!test
24231 Support <object> element with .data attribute
24232 !!options
24233 parsoid=html2wt
24234 !! html/parsoid
24235 <object data="test.swf"></object>
24236 !! wikitext
24237 <object data="test.swf"></object>
24238 !!end
24239
24240 !! test
24241 Don't block XML namespace declaration
24242 !! wikitext
24243 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24244 !! html/php
24245 <p><span>MediaWiki</span>
24246 </p>
24247 !! html/parsoid
24248 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
24249 !! end
24250
24251 # -----------------------------------------------------------------
24252 # The following section of tests are primarily to spec requirements
24253 # around serialization of new/edited content.
24254 #
24255 # All these tests are marked Parsoid html2wt and html2html only
24256 # ----------------------------------------------------------------
24257
24258 # 'mi' is a localinterwiki prefix as well as a language
24259 !! test
24260 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
24261 !! options
24262 parsoid=html2wt
24263 !! html/parsoid
24264 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
24265 !! wikitext
24266 [[Foo]]
24267 !! end
24268
24269 # See T93839
24270 !! test
24271 New wikilinks should be serialized properly
24272 !! options
24273 parsoid=html2wt
24274 !! html/parsoid
24275 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
24276 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
24277 !! wikitext
24278 [[Foo]]
24279 [[Foo]]
24280 !! end
24281
24282 !! test
24283 New wiki links (href variations)
24284 !! options
24285 parsoid=html2wt
24286 !! html/parsoid
24287 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24288 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
24289 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
24290 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
24291 !! wikitext
24292 [[Foo_bar]]
24293 [[Foo_bar]]
24294 [[Foo_bar]]
24295 [[Toxine bactérienne]]
24296 !! end
24297
24298 !! test
24299 New wiki links (content string variations)
24300 !! options
24301 parsoid=html2wt
24302 !! html/parsoid
24303 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24304 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
24305 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
24306 !! wikitext
24307 [[Foo_bar]]
24308 [[Foo bar]]
24309 [[Foo_bar|./Foo_bar]]
24310 !! end
24311
24312 !! test
24313 New category links (href variations)
24314 !! options
24315 parsoid=html2wt
24316 !! html/parsoid
24317 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
24318 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
24319 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
24320 !! wikitext
24321 [[Category:Toxine bactérienne]]
24322 [[Category:Toxine bactérienne]]
24323 [[Category:Toxine bactérienne]]
24324 !! end
24325
24326 !! test
24327 New sol transparent links don't need indent-pre nowiki protection
24328 !! options
24329 parsoid=html2wt
24330 language=de
24331 !! html/parsoid
24332 <link rel="mw:PageProp/redirect" href="./Main_Page">
24333 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
24334 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
24335 !! wikitext
24336 #WEITERLEITUNG [[Main Page]]
24337 <!-- this is good --> [[Category:Good]]
24338 <!-- this is great --> [[Kategorie:Great]]
24339 !! end
24340
24341 !! test
24342 New interlanguage links (href variations)
24343 !! options
24344 parsoid=html2wt
24345 !! html/parsoid
24346 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
24347 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
24348 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
24349 !! wikitext
24350 [[es:Toxine bactérienne]]
24351 [[es:Toxine_bactérienne]]
24352 [[es:Toxine_bactérienne]]
24353 !! end
24354
24355 !! test
24356 Image: Modifying size of an image (1)
24357 !! options
24358 parsoid={
24359 "modes": ["wt2wt"],
24360 "changes": [
24361 ["img[height]", "attr", "height", "22"],
24362 ["img[width]", "attr", "width", "200"]
24363 ]
24364 }
24365 !! wikitext
24366 [[Image:Foobar.jpg|230x230px]]
24367 !! wikitext/edited
24368 [[Image:Foobar.jpg|200x200px]]
24369 !!end
24370
24371 !! test
24372 Image: Modifying size of an image (2)
24373 !! options
24374 parsoid={
24375 "modes": ["wt2wt"],
24376 "changes": [
24377 ["img[height]", "attr", "height", "100"],
24378 ["img[width]", "attr", "width", "500"]
24379 ]
24380 }
24381 !! wikitext
24382 [[Image:Foobar.jpg|230x230px]]
24383 !! wikitext/edited
24384 [[Image:Foobar.jpg|500x500px]]
24385 !!end
24386
24387 # Change in size is ignored so long as class='mw-default-size'
24388 !! test
24389 Image: Modifying size of an image (3)
24390 !! options
24391 parsoid={
24392 "modes": ["wt2wt"],
24393 "changes": [
24394 ["figure[class]", "removeClass", "mw-default-size"],
24395 ["figure img", "attr", "height", "19"],
24396 ["figure img", "attr", "width", "170"]
24397 ]
24398 }
24399 !! wikitext
24400 [[Image:Foobar.jpg|thumb]]
24401 !! wikitext/edited
24402 [[Image:Foobar.jpg|thumb|170x170px]]
24403 !!end
24404
24405 !! test
24406 Image: Modifying alignment of an image (bug 48665)
24407 !! options
24408 parsoid={
24409 "modes": ["wt2wt"],
24410 "changes": [
24411 ["figure[class]", "removeClass", "mw-halign-right"],
24412 ["figure[class]", "addClass", "mw-halign-left"]
24413 ]
24414 }
24415 !! wikitext
24416 [[Image:Foobar.jpg|thumb|caption|right]]
24417 !! wikitext/edited
24418 [[Image:Foobar.jpg|thumb|caption|left]]
24419 !! end
24420
24421 !! test
24422 Image: Modifying mw-default-size of an frameless image (bug 62805)
24423 !! options
24424 parsoid={
24425 "modes": ["wt2wt"],
24426 "changes": [
24427 ["figure.mw-default-size", "removeClass", "mw-default-size"]
24428 ]
24429 }
24430 !! wikitext
24431 [[Image:Foobar.jpg|frameless|right]]
24432 !! wikitext/edited
24433 [[Image:Foobar.jpg|frameless|right|220x220px]]
24434 !! end
24435
24436 !! test
24437 Image: Modifying valign of an image (bug 49221)
24438 !! options
24439 parsoid={
24440 "modes": ["wt2wt"],
24441 "changes": [
24442 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
24443 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
24444 ]
24445 }
24446 !! wikitext
24447 [[File:Foobar.jpg|20px|middle]]
24448 !! wikitext/edited
24449 [[File:Foobar.jpg|20px|text-top]]
24450 !! end
24451
24452 !! test
24453 Image: Modifying alt attribute of an image (bug 56400)
24454 !! options
24455 parsoid={
24456 "modes": ["wt2wt"],
24457 "changes": [
24458 ["img[alt]", "attr", "alt", "some alternate edited text"]
24459 ]
24460 }
24461 !! wikitext
24462 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
24463 !! wikitext/edited
24464 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
24465 !!end
24466
24467 !! test
24468 Image: Modifying caption of an image
24469 !! options
24470 parsoid={
24471 "modes": ["wt2wt"],
24472 "changes": [
24473 ["figcaption", "text", "new caption"]
24474 ]
24475 }
24476 !! wikitext
24477 [[Image:Foobar.jpg|thumb|original caption]]
24478 !! wikitext/edited
24479 [[Image:Foobar.jpg|thumb|new caption]]
24480 !!end
24481
24482 !! test
24483 Image: empty alt attribute (bug 48924)
24484 !! options
24485 parsoid
24486 !! wikitext
24487 [[File:Foobar.jpg|thumb|alt=|bar]]
24488 !! html
24489 <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>
24490 !! end
24491
24492 !! test
24493 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
24494 !! options
24495 parsoid=html2wt
24496 language=ar
24497 disabled
24498 !! html/parsoid
24499 <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>
24500 !! wikitext
24501 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
24502 !! end
24503
24504 !! test
24505 Image: Block level image should have \n before and after
24506 !! wikitext
24507 123
24508 [[File:Foobar.jpg|right|thumb|150x150px]]
24509 456
24510 !! html/parsoid
24511 <p>123</p>
24512 <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>
24513 <p>456</p>
24514 !!end
24515
24516 !! test
24517 Image: New block level image should have \n before and after (existing content)
24518 !! wikitext
24519 123
24520 [[File:Foobar.jpg|right|thumb|150x150px]]
24521 456
24522 !! html/parsoid
24523 <p>123</p>
24524 <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>
24525 <p>456</p>
24526 !!end
24527
24528 !! test
24529 Image: upright option (parsoid)
24530 !! wikitext
24531 [[File:Foobar.jpg|thumb|upright|caption]]
24532 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
24533 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
24534 !! html/parsoid
24535 <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>
24536 <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>
24537 <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>
24538 !!end
24539
24540 !! test
24541 Image: upright option is ignored on inline and frame images (parsoid)
24542 !! wikitext
24543 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
24544 !! html/parsoid
24545 <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>
24546 !!end
24547
24548 !! test
24549 Image: from basic HTML (1)
24550 !! options
24551 parsoid=html2wt
24552 !! html/parsoid
24553 <span typeof="mw:Image">
24554 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24555 </span>
24556 !! wikitext
24557 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24558 !! end
24559
24560 !! test
24561 Image: from basic HTML (2)
24562 !! options
24563 parsoid=html2wt
24564 !! html/parsoid
24565 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24566 !! wikitext
24567 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24568 !! end
24569
24570 !! test
24571 Image: from basic HTML (3)
24572 !! options
24573 parsoid=html2wt
24574 !! html/parsoid
24575 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
24576 !! wikitext
24577 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
24578 !! end
24579
24580 !! test
24581 Image: from basic HTML (4)
24582 !! options
24583 parsoid=html2wt
24584 !! html/parsoid
24585 <img src="./File:Foobar.jpg">
24586 !! wikitext
24587 [[File:Foobar.jpg|link=]]
24588 !! end
24589
24590 !! test
24591 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
24592 !! options
24593 parsoid=html2wt
24594 !! html/parsoid
24595 <ul>
24596 <li><p>foo</p></li>
24597 </ul>
24598 !! wikitext
24599 * foo
24600 !! end
24601
24602 !! test
24603 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
24604 !! options
24605 parsoid=html2wt
24606 !! html/parsoid
24607 <ul> <li>foo</li></ul>
24608 !! wikitext
24609 * foo
24610 !! end
24611
24612 !! test
24613 Don't strip leading whitespace when handling indent-pre suppressing tags
24614 !! options
24615 parsoid=html2wt
24616 !! html/parsoid
24617 <table>
24618 <tr><td> indented row</td></tr>
24619 </table>
24620 <blockquote><p>
24621 <b>This is very bold of you!</b>
24622 </p>
24623 <table><tr><td>
24624 indented cell (no pre-wrapping!)
24625 </td></tr></table>
24626 </blockquote>
24627 <p>foo</p>
24628 <div>bar</div>
24629 !! wikitext
24630 {|
24631 | indented row
24632 |}
24633 <blockquote>
24634 '''This is very bold of you!'''
24635
24636 {|
24637 |
24638 indented cell (no pre-wrapping!)
24639 |}
24640 </blockquote>
24641 foo
24642 <div>bar</div>
24643 !! end
24644
24645 !! test
24646 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
24647 !! options
24648 parsoid=html2wt
24649 !! html/parsoid
24650 <p>foo</p>
24651 <span>bar</span>
24652
24653 <span>foo2
24654 </span>bar2
24655
24656 <div>foo</div>
24657 <span>bar</span>
24658
24659 <div>
24660 <span>foo</span>
24661 </div>
24662 !! wikitext
24663 foo
24664 <nowiki> </nowiki><span>bar</span>
24665
24666 <span>foo2
24667 <nowiki> </nowiki></span>bar2
24668
24669 <div>foo</div>
24670 <nowiki> </nowiki><span>bar</span>
24671
24672 <div>
24673 <nowiki> </nowiki><span>foo</span>
24674 </div>
24675 !! end
24676
24677 !! test
24678 Lists: Dont insert newlines in a serialized list item.
24679 !! options
24680 parsoid=html2wt
24681 !! html/parsoid
24682 <ul><li>a<br>b</li><li>c</li></ul>
24683 !! wikitext
24684 * a<br>b
24685 * c
24686 !! end
24687
24688 !! test
24689 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
24690 !! options
24691 parsoid={
24692 "modes": ["html2wt"],
24693 "scrubWikitext": false
24694 }
24695 !! html/parsoid
24696 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
24697 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
24698
24699 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
24700 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
24701
24702 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
24703
24704 <h2><meta property="mw:PageProp/toc" /> ok</h2>
24705 !! wikitext
24706 == hello there [[Category:A1]] ==
24707
24708 == [[Category:A2]] hi pal ==
24709
24710 == <!--foo--> [[Category:A3]] how goes it ==
24711
24712 == it goes well [[Category:A4]] <!--bar--> ==
24713
24714 ==howdy [[Category:A5]] ==
24715
24716 == __TOC__ ok ==
24717 !! end
24718
24719 !! test
24720 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
24721 !! options
24722 parsoid={
24723 "modes": ["html2wt"],
24724 "scrubWikitext": true
24725 }
24726 !! html/parsoid
24727 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
24728 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
24729
24730 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
24731 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
24732
24733 <h2><meta property="mw:PageProp/toc" /> ok</h2>
24734 !! wikitext
24735 == hello there ==
24736 [[Category:A1]]
24737 [[Category:A2]]
24738
24739 == hi pal ==
24740
24741 <!--foo--> [[Category:A3]]
24742
24743 == how goes it ==
24744
24745 == it goes well ==
24746 [[Category:A4]] <!--bar-->
24747
24748 __TOC__
24749
24750 == ok ==
24751 !! end
24752
24753 !! test
24754 Headings: Don't hoist metas that come from templates
24755 !! options
24756 parsoid={
24757 "modes": ["html2wt"],
24758 "scrubWikitext": true
24759 }
24760 !! html/parsoid
24761 <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>
24762 !! wikitext
24763 == {{echo|foo [[Category:Foo]]}} ==
24764 !! end
24765
24766 !! test
24767 Headings: Category in ref isn't hoisted
24768 !! options
24769 parsoid={
24770 "modes": ["html2wt"],
24771 "scrubWikitext": true
24772 }
24773 !! html/parsoid
24774 <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>
24775
24776 <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>
24777 !! wikitext
24778 == foo <ref>bar
24779 [[Category:Baz]] </ref> ==
24780
24781 <references />
24782 !! end
24783
24784 !! test
24785 Parsoid: Serialize positional parameters with = in them as named parameter
24786 !! options
24787 parsoid=html2wt
24788 !! html/parsoid
24789 <p about="#mwt1" typeof="mw:Transclusion"
24790 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
24791
24792 <p about="#mwt1" typeof="mw:Transclusion"
24793 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
24794
24795 <!--Orig params with data-parsoid has heuristics for handling = chars-->
24796 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
24797 <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>
24798 !! wikitext
24799 {{echo|1 = f=oo}}
24800
24801 {{echo|1 = f=oo|2 = bar}}
24802
24803 <!--Orig params with data-parsoid has heuristics for handling = chars-->
24804 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
24805 {{echo|<nowiki>f=oo</nowiki>|bar}}
24806 !! end
24807
24808 !! test
24809 Parsoid: Serialize positional parameters with = in extlink as named parameter
24810 !! options
24811 parsoid=html2wt
24812 !! html/parsoid
24813 <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>
24814 !! wikitext
24815 {{echo|1 = http://stuff?is=ok}}
24816 !! end
24817
24818 !! test
24819 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
24820 !! options
24821 parsoid=html2wt
24822 !! html/parsoid
24823 <div>a<p>b</p></div>
24824 <div>a
24825 <p>b</p></div>
24826 <div>
24827 a
24828 <p>b</p></div>
24829 !! wikitext
24830 <div>a
24831 b
24832 </div>
24833 <div>a
24834 b
24835 </div>
24836 <div>
24837 a
24838
24839 b
24840 </div>
24841 !! end
24842
24843 !! test
24844 Substrings resembling wikitext in hrefs should not get nowiki escapes
24845 !! options
24846 parsoid=html2wt
24847 !! html/parsoid
24848 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
24849 !! wikitext
24850 [[Foo''bar''baz]]
24851 !! end
24852
24853 !! test
24854 Enforce single-line context in the serializer
24855 !! options
24856 parsoid=html2wt
24857 !! html/parsoid
24858 <h2>testing
24859 123</h2>
24860
24861 <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">
24862 </span><span about="#mwt1">you</span> </h2>
24863
24864 <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>
24865
24866 <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
24867 there</span></li></ol>
24868
24869 <ul><li>asd
24870 sdf</li></ul>
24871
24872 <ul><li>foo
24873 bar
24874 baz</li>
24875 <li>foo <b>bar</b>
24876 baz</li></ul>
24877
24878 <dl><dt>hi
24879 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
24880 ho</dd></dl>
24881
24882 <dl><dd> <table>
24883 <tbody><tr><td> ha
24884 ha
24885 ha</td></tr>
24886 </tbody></table></dd></dl>
24887 !! wikitext
24888 == testing 123 ==
24889
24890 == hi {{bogus|there
24891 you}} ==
24892
24893 == foo <ref>hello
24894 there</ref> ==
24895
24896 <references />
24897
24898 * asd sdf
24899
24900 * foo bar baz
24901 * foo '''bar''' baz
24902
24903 ; hi ho : hi ho
24904
24905 : {|
24906 | ha
24907 ha
24908 ha
24909 |}
24910 !! end
24911
24912 !! test
24913 Serialize new placeholder space without spans
24914 !! options
24915 parsoid=html2wt
24916 !! html/parsoid
24917 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
24918
24919 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
24920
24921 <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>
24922 !! wikitext
24923 foo : bar
24924
24925 foo : bar
24926
24927 <ref>foo : bar</ref>ok
24928 !! end
24929
24930
24931 #-----------------------
24932 # Tag minimization tests
24933 #-----------------------
24934
24935 !! test
24936 1. I/B quote minimization: wikitext-only tags should be combined
24937 !! options
24938 parsoid=html2wt
24939 !! html/parsoid
24940 <p><i>A</i><i>B</i></p>
24941 <p><b>A</b><b>B</b></p>
24942 <p><i>A</i><b><i>B</i></b></p>
24943 <p><b>A</b><i><b>B</b></i></p>
24944 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
24945 <p><i><b>A</b></i><i><b>B</b></i></p>
24946 <p><i><b>A</b></i><b><i>B</i></b></p>
24947 <p><b><i>A</i></b><i><b>B</b></i></p>
24948 !! wikitext
24949 ''AB''
24950
24951 '''AB'''
24952
24953 ''A'''B'''''
24954
24955 '''A''B'''''
24956
24957 '''A''BC''D'''
24958
24959 '''''AB'''''
24960
24961 '''''AB'''''
24962
24963 '''''AB'''''
24964 !! end
24965
24966 !! test
24967 2. I/B quote minimization: wikitext and html tags should not be combined
24968 !! options
24969 parsoid=html2wt
24970 !! html/parsoid
24971 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
24972 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
24973 !! wikitext
24974 ''A''<i>B</i>
24975
24976 ''A''<nowiki/>'''<i>B</i>'''
24977 !! end
24978
24979 !! test
24980 3. I/B quote minimization: templated content stops minimization
24981 !! options
24982 parsoid=html2wt
24983 !! html/parsoid
24984 <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>
24985 <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>
24986 !! wikitext
24987 ''A''{{echo|''B''}}
24988
24989 ''A''{{echo|'''''B'''''}}
24990 !! end
24991
24992 !! test
24993 4. I/B quote minimization: new content should be mimimized with adjacent old content
24994 !! options
24995 parsoid=html2wt
24996 !! html/parsoid
24997 <p><i>A</i><i>B</i></p>
24998 <p><b>A</b><b>B</b></p>
24999 <p><i>A</i><b><i>B</i></b></p>
25000 !! wikitext
25001 ''AB''
25002
25003 '''AB'''
25004
25005 ''A'''B'''''
25006 !! end
25007
25008 !! test
25009 5a. Merge adjacent quote nodes if they've been edited
25010 !! options
25011 parsoid={
25012 "modes": ["wt2wt", "selser"],
25013 "changes": [
25014 ["p", "contents", "remove", ":contains('b')"]
25015 ]
25016 }
25017 !! wikitext
25018 ''a''b''c''
25019 !! wikitext/edited
25020 ''ac''
25021 !! end
25022
25023 !! test
25024 5b. Merge adjacent quote nodes if they've been edited
25025 !! options
25026 parsoid={
25027 "modes": ["wt2wt", "selser"],
25028 "changes": [
25029 ["#x", "remove"]
25030 ]
25031 }
25032 !! wikitext
25033 ''a''<span id="x">b</span>''c''
25034 !! wikitext/edited
25035 ''ac''
25036 !! end
25037
25038 !! test
25039 1. Merge adjacent link nodes as long as at least one element is new
25040 !! options
25041 parsoid={
25042 "modes": ["html2wt"],
25043 "scrubWikitext": true
25044 }
25045 !! html/parsoid
25046 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25047 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25048 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
25049 !! wikitext
25050 [[Football]]
25051 [[Football]]
25052 [[Football|Foot]][[Football|ball]]
25053 !! end
25054
25055 !! test
25056 2. Merge adjacent link nodes and enable additional normalizations
25057 !! options
25058 parsoid={
25059 "modes": ["html2wt"],
25060 "scrubWikitext": true
25061 }
25062 !! html/parsoid
25063 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
25064 !! wikitext
25065 [[Football|''Football'']]
25066 !! end
25067
25068 !! test
25069 3. Don't merge adjacent link nodes if scrubWikitext is false
25070 !! options
25071 parsoid={
25072 "modes": ["html2wt"],
25073 "scrubWikitext": false
25074 }
25075 !! html/parsoid
25076 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25077 !! wikitext
25078 [[Football|Foot]][[Football|ball]]
25079 !! end
25080
25081 #------------------------------
25082 # End of tag minimization tests
25083 #------------------------------
25084
25085 !!test
25086 Bug 54262: New entities
25087 !! options
25088 parsoid=html2wt
25089 !! html/parsoid
25090 <span typeof="mw:Entity">&nbsp;</span>
25091 !! wikitext
25092 &nbsp;
25093 !! end
25094
25095 ## Note that there is no wikitext output for 'unknownproperty' ##
25096 ## Unknown magic words are silently dropped ##
25097
25098 !! test
25099 Magic words
25100 !! options
25101 parsoid=html2wt
25102 !! html/parsoid
25103 <meta property='mw:PageProp/toc' />
25104 <meta property='mw:PageProp/notoc' />
25105 <meta property='mw:PageProp/forcetoc' />
25106 <meta property='mw:PageProp/index' />
25107 <meta property='mw:PageProp/noindex' />
25108 <meta property='mw:PageProp/nogallery' />
25109 <meta property='mw:PageProp/noeditsection' />
25110 <meta property='mw:PageProp/notitleconvert' />
25111 <meta property='mw:PageProp/nocontentconvert' />
25112 <meta property='mw:PageProp/unknownproperty' />
25113 !! wikitext
25114 __TOC__
25115 __NOTOC__
25116 __FORCETOC__
25117 __INDEX__
25118 __NOINDEX__
25119 __NOGALLERY__
25120 __NOEDITSECTION__
25121 __NOTITLECONVERT__
25122 __NOCONTENTCONVERT__
25123 !! end
25124
25125 !! test
25126 Consecutive <pre>s should not get merged
25127 !! options
25128 parsoid=html2wt,html2html
25129 !! html/parsoid
25130 <pre>a</pre><pre>b</pre>
25131
25132 <pre>c
25133 </pre><pre>
25134 d</pre>
25135
25136 <pre>e
25137
25138 </pre><pre>
25139
25140 f</pre>
25141 !! wikitext
25142 a
25143
25144 b
25145
25146 c
25147
25148 d
25149
25150 e
25151
25152
25153
25154 f
25155 !! end
25156
25157 !! test
25158 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
25159 !! options
25160 parsoid=html2wt
25161 !! html/parsoid
25162 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
25163 !! wikitext
25164 [[Special:BookSources/1234567890|ISBN 1234567895]]
25165 !! end
25166
25167 !! test
25168 Edited RFC links not serializable as RFC links should serialize as extlinks
25169 !! options
25170 parsoid=html2wt
25171 !! html/parsoid
25172 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
25173 !! wikitext
25174 [//tools.ietf.org/html/rfc123 New RFC]
25175 !! end
25176
25177 !! test
25178 Edited PMID links not serializable as PMID links should serialize as extlinks
25179 !! options
25180 parsoid=html2wt
25181 !! html/parsoid
25182 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
25183 !! wikitext
25184 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
25185 !! end
25186
25187 !! test
25188 WTS of autolinks with trailing/surrounding context
25189 !! options
25190 parsoid=html2wt
25191 !! html/parsoid
25192 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
25193 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
25194 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
25195 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
25196 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
25197 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
25198 !! wikitext
25199 http://cscott.net<nowiki/>'''foo'''
25200
25201 http://cscott.net<b>foo</b>
25202
25203 '''http://cscott.net<nowiki/>'''
25204
25205 '''http://cscott.net '''
25206
25207 '''http://cscott.net<nowiki/>x'''
25208
25209 http://cscott.net<nowiki/>x
25210 !! end
25211
25212 !! test
25213 WTS of autolinks with nowikis (round-trip)
25214 !! wikitext
25215 x<nowiki/>http://cscott.net<nowiki/>x
25216 !! html/parsoid
25217 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
25218 !! end
25219
25220 # this is the "easy" test because it leaves in place all the
25221 # data-parsoid information indicating this is an autolink
25222 !! test
25223 WTS of autolinks with escapes (editing)
25224 !! options
25225 parsoid={
25226 "modes": ["wt2wt"],
25227 "changes": [
25228 [ "meta", "remove" ]
25229 ]
25230 }
25231 !! wikitext
25232 x<nowiki/>http://cscott.net<nowiki/>x
25233 !! wikitext/edited
25234 x<nowiki/>http://cscott.net<nowiki/>x
25235 !! end
25236
25237 !! test
25238 WTS of edited autolink-like text (T103364)
25239 !! options
25240 parsoid={
25241 "modes": ["wt2wt"],
25242 "changes": [
25243 [ "span[typeof]", "removeAttr", "typeof" ]
25244 ]
25245 }
25246 !! wikitext
25247 Not a link: <nowiki>http://example.com</nowiki>.
25248 !! wikitext/edited
25249 Not a link: <span><nowiki>http://example.com</nowiki></span>.
25250 !! end
25251
25252 !! test
25253 WTS of newly-authored autolink-like text (T103364)
25254 !! options
25255 parsoid=html2wt
25256 !! html/parsoid
25257 <p>http://example.com is not a link.</p>
25258 !! wikitext
25259 <nowiki>http://example.com is not a link.</nowiki>
25260 !! end
25261
25262 !! test
25263 WTS of autolink-like text after an autolink (T108563)
25264 !! options
25265 parsoid=html2wt
25266 !! html/parsoid
25267 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
25268 !! wikitext
25269 http://example.com<nowiki> http://example.com is not a link.</nowiki>
25270 !! end
25271
25272 !! test
25273 Magic links inside links (not autolinked)
25274 !! wikitext
25275 [[Foo|http://example.com]]
25276 [[Foo|RFC 1234]]
25277 [[Foo|PMID 1234]]
25278 [[Foo|ISBN 123456789x]]
25279
25280 [http://foo.com http://example.com]
25281 [http://foo.com RFC 1234]
25282 [http://foo.com PMID 1234]
25283 [http://foo.com ISBN 123456789x]
25284 !! html+tidy
25285 <p><a href="/wiki/Foo" title="Foo">http://example.com</a> <a href="/wiki/Foo" title="Foo">RFC 1234</a> <a href="/wiki/Foo" title="Foo">PMID 1234</a> <a href="/wiki/Foo" title="Foo">ISBN 123456789x</a></p>
25286 <p><a rel="nofollow" class="external text" href="http://foo.com">http://example.com</a> <a rel="nofollow" class="external text" href="http://foo.com">RFC 1234</a> <a rel="nofollow" class="external text" href="http://foo.com">PMID 1234</a> <a rel="nofollow" class="external text" href="http://foo.com">ISBN 123456789x</a></p>
25287 !! html/parsoid
25288 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
25289 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
25290 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
25291 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
25292
25293 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
25294 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
25295 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
25296 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
25297 !! end
25298
25299 !! test
25300 Magic links inside image captions (autolinked)
25301 !! wikitext
25302 [[File:Foobar.jpg|thumb|http://example.com]]
25303 [[File:Foobar.jpg|thumb|RFC 1234]]
25304 [[File:Foobar.jpg|thumb|PMID 1234]]
25305 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
25306 !! html+tidy
25307 <div class="thumb tright">
25308 <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>
25309 <div class="thumbcaption">
25310 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25311 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
25312 </div>
25313 </div>
25314 <div class="thumb tright">
25315 <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>
25316 <div class="thumbcaption">
25317 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25318 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
25319 </div>
25320 </div>
25321 <div class="thumb tright">
25322 <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>
25323 <div class="thumbcaption">
25324 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25325 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
25326 </div>
25327 </div>
25328 <div class="thumb tright">
25329 <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>
25330 <div class="thumbcaption">
25331 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25332 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
25333 </div>
25334 </div>
25335 !! html/parsoid
25336 <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>
25337 <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="//tools.ietf.org/html/rfc1234" rel="mw:ExtLink">RFC 1234</a></figcaption></figure>
25338 <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="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></figcaption></figure>
25339 <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/123456789X" rel="mw:WikiLink">ISBN 123456789x</a></figcaption></figure>
25340 !! end
25341
25342 !! test
25343 WTS of magic word text (T109371)
25344 !! options
25345 parsoid=html2wt
25346 !! html/parsoid
25347 <p>RFC 1234</p>
25348 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
25349 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
25350 !! wikitext
25351 <nowiki>RFC 1234</nowiki>
25352
25353 [http://foo.com RFC 1234]
25354
25355 [[Foo|RFC 1234]]
25356 !! end
25357
25358 !! test
25359 Edited Redirect link should emit a non-piped wikitext link
25360 !! options
25361 parsoid=html2wt
25362 !! html/parsoid
25363 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
25364 !! wikitext
25365 #REDIRECT [[Bar]]
25366 !! end
25367
25368 !! test
25369 T75121: Infer extension name from typeOf if data-mw is not present
25370 !! options
25371 parsoid=html2wt
25372 !! html/parsoid
25373 <div typeOf="mw:Extension/foo"></div>
25374 !! wikitext
25375 <foo />
25376 !! end
25377
25378 # Note that the <p> wrapping isn't present in PHP parser output
25379 # The important thing for this test is that P-wrapping doesn't
25380 # interfere with the <nowiki> protection for leading - in <td>
25381 # (which isn't necessary for <th>).
25382 !! test
25383 T88318: p-wrapped dash in table.
25384 !! options
25385 parsoid=html2wt,wt2wt
25386 !! html/parsoid
25387 <table><tbody>
25388 <tr><th><p>-</p></th><th><p>- </p></th></tr>
25389 <tr><td><p>-</p></td><td><p>- </p></td></tr>
25390 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
25391 </tbody></table>
25392 !! wikitext
25393 {|
25394 !-
25395 !-
25396 |-
25397 |<nowiki>-</nowiki>
25398 |<nowiki>- </nowiki>
25399 |-
25400 |<small>-</small>
25401 |<br>
25402 -
25403 |<br>
25404 -
25405 |}
25406 !! html/php+tidy
25407 <table>
25408 <tr>
25409 <th>-</th>
25410 <th>-</th>
25411 </tr>
25412 <tr>
25413 <td>-</td>
25414 <td>-</td>
25415 </tr>
25416 <tr>
25417 <td><small>-</small></td>
25418 <td><br />
25419 <p>-</p>
25420 </td>
25421 <td><br />
25422 <p>-</p>
25423 </td>
25424 </tr>
25425 </table>
25426 !! end
25427
25428 !! test
25429 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
25430 !! options
25431 parsoid=html2wt
25432 !! html/parsoid
25433 <table id='mwAb'>
25434 <td id='mwAc'>foo</td>
25435 <td id='serialize-this'>bar</td>
25436 </table>
25437 !! wikitext
25438 {|
25439 |foo
25440 | id="serialize-this" |bar
25441 |}
25442 !! end
25443
25444 !! test
25445 Parsoid-like element ids should not be serialized to wikitext unless shadowed
25446 !! options
25447 parsoid=html2wt
25448 !! html/parsoid
25449 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
25450 !! wikitext
25451 <div id="hello">ok</div>
25452 !! end
25453
25454 !! test
25455 WTS change modes
25456 !! options
25457 parsoid={
25458 "modes": ["wt2wt"],
25459 "changes": [
25460 [ "#xyz", "before", "<b>before</b> stuff " ],
25461 [ "#xyz", "after", " stuff <i>after</i>" ],
25462 [ "#xyz", "html", "x <b>y</b> z" ]
25463 ]
25464 }
25465 !! wikitext
25466 <span id="xyz">hello</span>
25467 !! wikitext/edited
25468 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
25469 !! end
25470
25471 !! test
25472 Never serialize a-tag as html, regardless of what data-parsoid has to say
25473 !! options
25474 parsoid=html2wt
25475 !! html/parsoid
25476 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
25477 !! wikitext
25478 [[Foo]]
25479 !! end
25480
25481 ## SSS FIXME: This is broken output nevertheless.
25482 ## What might be a reasonable non-broken output for this?
25483 ## This is an edge case unlikely to be seen in production
25484 ## that I am not wasting more time on this right now.
25485 !! test
25486 Never serialize a-tag as html, no matter what attributes it has
25487 !! options
25488 parsoid=html2wt
25489 !! html/parsoid
25490 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
25491 !! wikitext
25492 [http://boo.org http://boohoo.org]
25493 !! end
25494
25495 # Misnested is an indication that selser can reuse the source but these have
25496 # shown to sneak through on occasion. See T101768.
25497 # The original wikitext here is: [http://test.com [[one]] two three]
25498 !! test
25499 Strip span tags added to mark as misnested
25500 !! options
25501 parsoid=html2wt
25502 !! html/parsoid
25503 <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>
25504 !! wikitext
25505 [http://test.com][[one]] two three
25506 !! end
25507
25508 # --------------------------------------------
25509 # Tests spec'ing wikitext serialization norms |
25510 # --------------------------------------------
25511
25512 !! test
25513 Lists: Add space after bullets
25514 !! options
25515 parsoid=html2wt
25516 !! html/parsoid
25517 <ul>
25518 <li>foo</li>
25519 <li> bar</li>
25520 <li><span> baz</span></li>
25521 </ul>
25522 !! wikitext
25523 * foo
25524 * bar
25525 * <span> baz</span>
25526 !! end
25527
25528 !! test
25529 1. Headings: Add space before/after == (T53744)
25530 !! options
25531 parsoid=html2wt
25532 !! html/parsoid
25533 <h2>foo</h2>
25534 <h2> bar</h2>
25535 <h2>baz </h2>
25536 <h2><span> baz</span></h2>
25537 !! wikitext
25538 == foo ==
25539
25540 == bar ==
25541
25542 == baz ==
25543
25544 == <span> baz</span> ==
25545 !! end
25546
25547 !! test
25548 2. Headings: Add space before/after == even after hoisted content
25549 !! options
25550 parsoid={
25551 "modes": ["html2wt"],
25552 "scrubWikitext": true
25553 }
25554 !! html/parsoid
25555 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
25556 !! wikitext
25557 [[Category:A2]]
25558
25559 == ok ==
25560 !! end
25561
25562 !! test
25563 1. Headings: suppress newly created empty headings
25564 !! options
25565 parsoid={
25566 "modes": ["html2wt"],
25567 "scrubWikitext": true
25568 }
25569 !! html/parsoid
25570 <h2></h2>
25571 !! wikitext
25572 !! end
25573
25574 !! test
25575 2. Headings: don't suppress empty headings if scrubWikitext is false
25576 !! options
25577 parsoid=html2wt
25578 !! html/parsoid
25579 <h2></h2>
25580 !! wikitext
25581 ==<nowiki/>==
25582 !! end
25583
25584 !! test
25585 3. Headings: suppress empty headings on edits
25586 !! options
25587 parsoid={
25588 "modes": ["selser"],
25589 "scrubWikitext": true,
25590 "changes": [
25591 [ "#x", "remove"]
25592 ]
25593 }
25594 !! wikitext
25595 ==<span id="x">foo</span>==
25596 !! wikitext/edited
25597 !! end
25598
25599 !! test
25600 1. WT Quote Tags: suppress newly created empty style tags
25601 !! options
25602 parsoid={
25603 "modes": ["html2wt"],
25604 "scrubWikitext": true
25605 }
25606 !! html/parsoid
25607 <i></i><b></b>
25608 !! wikitext
25609 !! end
25610
25611 !! test
25612 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
25613 !! options
25614 parsoid=html2wt
25615 !! html/parsoid
25616 <i></i><b></b>
25617 !! wikitext
25618 ''<nowiki/>'''''<nowiki/>'''
25619 !! end
25620
25621 !! test
25622 3. WT Quote Tags: suppress empty style tags on edits
25623 !! options
25624 parsoid={
25625 "modes": ["selser"],
25626 "scrubWikitext": true,
25627 "changes": [
25628 [ "#x", "remove"]
25629 ]
25630 }
25631 !! wikitext
25632 '''<span id="x">foo</span>'''
25633 !! wikitext/edited
25634 !! end
25635
25636 !! test
25637 1. Anchors: suppress newly created empty anchors
25638 !! options
25639 parsoid={
25640 "modes": ["html2wt"],
25641 "scrubWikitext": true
25642 }
25643 !! html/parsoid
25644 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
25645 !! wikitext
25646 !! end
25647
25648 !! test
25649 2. Anchors: don't suppress empty anchors if scrubWikitext is false
25650 !! options
25651 parsoid={
25652 "modes": ["html2wt"],
25653 "scrubWikitext": false
25654 }
25655 !! html/parsoid
25656 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
25657 !! wikitext
25658 [[Test|<nowiki/>]]
25659 !! end
25660
25661 !! test
25662 3. Anchors: suppress empty anchors on edits
25663 !! options
25664 parsoid={
25665 "modes": ["selser"],
25666 "scrubWikitext": true,
25667 "changes": [
25668 [ "#x", "remove"]
25669 ]
25670 }
25671 !! wikitext
25672 [[Test|<span id="x">foo</span>]]
25673 !! wikitext/edited
25674 !! end
25675
25676 !! test
25677 3a. Anchors: do not suppress numbered extlinks
25678 !! options
25679 parsoid={
25680 "modes": ["wt2wt"],
25681 "scrubWikitext": true
25682 }
25683 !! wikitext
25684 [http://foo.com]
25685 !! html/parsoid
25686 <a rel="mw:ExtLink" href="http://foo.com"></a>
25687 !! end
25688
25689 !! test
25690 3b. Anchors: do not suppress numbered extlinks
25691 !! options
25692 parsoid={
25693 "modes": ["wt2wt"],
25694 "scrubWikitext": true,
25695 "changes": [
25696 [ "#x", "remove"]
25697 ]
25698 }
25699 !! wikitext
25700 [http://foo.com <span id="x">foo</span>]
25701 !! wikitext/edited
25702 [http://foo.com]
25703 !! end
25704
25705 !!test
25706 Normalizations should be restricted to edited content
25707 !!options
25708 parsoid={
25709 "modes": ["selser"],
25710 "scrubWikitext": true,
25711 "changes": [
25712 [ "h1", "before", "<i></i>"]
25713 ]
25714 }
25715 !!wikitext
25716 a
25717 = =
25718 b
25719 !!wikitext/edited
25720 a
25721 = =
25722 b
25723 !!end
25724
25725 !! test
25726 1. Multiple normalizations (html2wt)
25727 !! options
25728 parsoid={
25729 "modes": ["html2wt"],
25730 "scrubWikitext": true
25731 }
25732 !! html
25733 <h2><i></i></h2>
25734 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
25735 </a><b><i></i></b>x</p>
25736 !! wikitext
25737
25738 [[foo]]
25739 x
25740
25741 !! end
25742
25743 !! test
25744 2. Multiple normalizations (selser)
25745 !! options
25746 parsoid={
25747 "modes": ["selser"],
25748 "scrubWikitext": true,
25749 "changes": [
25750 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
25751 ]
25752 }
25753 !! wikitext
25754 <span id="x">foo</span>
25755 !! wikitext/edited
25756 <span id="x">foo</span>
25757
25758 x
25759 !! end
25760
25761 !! test
25762 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
25763 !! options
25764 parsoid={
25765 "modes": ["html2wt"],
25766 "scrubWikitext": true
25767 }
25768 !! html/parsoid
25769 <p> hi</p>
25770 <p> hello</p>
25771 !! wikitext
25772 hi
25773
25774 hello
25775 !! end
25776
25777 !! test
25778 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
25779 !! options
25780 parsoid=html2wt
25781 !! html/parsoid
25782 <p> hi</p>
25783 <p> hello</p>
25784 !! wikitext
25785 <nowiki> </nowiki>hi
25786
25787 <nowiki> </nowiki> hello
25788 !! end
25789
25790 !! test
25791 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
25792 !! options
25793 parsoid={
25794 "modes": ["html2wt"],
25795 "scrubWikitext": true
25796 }
25797 !! html/parsoid
25798 <p>Foo
25799 bar
25800 baz</p>
25801
25802 <table><tr><td>Foo
25803 bar
25804 baz bang</td></tr></table>
25805
25806 <p><!--boo--> foo
25807 bar</p>
25808
25809 <p> foo
25810 bar<span>boo</span></p>
25811 !! wikitext
25812 Foo
25813 bar
25814 baz
25815
25816 {|
25817 |Foo
25818 bar
25819 baz bang
25820 |}
25821
25822 <!--boo-->foo
25823 bar
25824
25825 foo
25826 bar<span>boo</span>
25827 !! end
25828
25829 !! test
25830 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
25831 !! options
25832 parsoid={
25833 "modes": ["selser"],
25834 "scrubWikitext": true,
25835 "changes": [
25836 [ "p", "html", " a\n b" ]
25837 ]
25838 }
25839 !! wikitext
25840 xyz
25841 !! wikitext/edited
25842 a
25843 b
25844 !! end
25845
25846 !! test
25847 1. New links that end in spaces
25848 !! options
25849 parsoid={
25850 "modes": ["html2wt"],
25851 "scrubWikitext": false
25852 }
25853 !! html/parsoid
25854 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
25855 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
25856 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
25857 !! wikitext
25858 [[Berlin ]]<nowiki/>is the capital of Germany.
25859
25860 [[Foo ]]'''bar'''
25861
25862 [[Boston ]] is a city.
25863 !! end
25864
25865 !! test
25866 2. New links that end in spaces
25867 !! options
25868 parsoid={
25869 "modes": ["html2wt"],
25870 "scrubWikitext": true
25871 }
25872 !! html/parsoid
25873 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
25874 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
25875 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
25876 !! wikitext
25877 [[Berlin]] is the capital of Germany.
25878
25879 [[Foo]] '''bar'''
25880
25881 [[Boston]] is a city.
25882 !! end
25883
25884 !! test
25885 1. Table cells with escapable prefixes
25886 !! options
25887 parsoid={
25888 "modes": ["html2wt"],
25889 "scrubWikitext": false
25890 }
25891 !! html
25892 <table>
25893 <tr><td>a</td></tr>
25894 <tr><td>-</td></tr>
25895 <tr><td>+</td></tr>
25896 </table>
25897 !! wikitext
25898 {|
25899 |a
25900 |-
25901 |<nowiki>-</nowiki>
25902 |-
25903 |<nowiki>+</nowiki>
25904 |}
25905 !! end
25906
25907 !! test
25908 2. Table cells with escapable prefixes
25909 !! options
25910 parsoid={
25911 "modes": ["html2wt"],
25912 "scrubWikitext": true
25913 }
25914 !! html
25915 <table>
25916 <tr><td>a</td></tr>
25917 <tr><td>-</td></tr>
25918 <tr><td>+</td></tr>
25919 </table>
25920 !! wikitext
25921 {|
25922 |a
25923 |-
25924 | -
25925 |-
25926 | +
25927 |}
25928 !! end
25929
25930 !! test
25931 3a. Table cells with escapable prefixes after edits
25932 !! options
25933 parsoid={
25934 "modes": ["selser"],
25935 "scrubWikitext": true,
25936 "changes": [
25937 [ "table tbody tr:first-child td:first-child", "remove"]
25938 ]
25939 }
25940 !! wikitext
25941 {|
25942 |a||-
25943 |}
25944 !! wikitext/edited
25945 {|
25946 | -
25947 |}
25948 !! end
25949
25950 !! test
25951 3b. Table cells with escapable prefixes after edits
25952 !! options
25953 parsoid={
25954 "modes": ["selser"],
25955 "scrubWikitext": true,
25956 "changes": [
25957 [ "table tbody tr:first-child td:first-child", "html", "-" ],
25958 [ "#x", "remove" ]
25959 ]
25960 }
25961 !! wikitext
25962 {|
25963 |pqr
25964 |<span id="x">foo</span>+
25965 |}
25966 !! wikitext/edited
25967 {|
25968 | -
25969 | +
25970 |}
25971 !! end
25972
25973 # FIXME: This test will fail because
25974 # normalization doesn't realize that the id attribute
25975 # will eliminate the escapable scenario
25976 !! test
25977 4a. Table cells without escapable prefixes after edits
25978 !! options
25979 parsoid={
25980 "modes": ["selser"],
25981 "scrubWikitext": true,
25982 "changes": [
25983 [ "#x", "html", "-" ]
25984 ]
25985 }
25986 !! wikitext
25987 {|
25988 | id="x" |abcd
25989 |}
25990 !! wikitext/edited
25991 {|
25992 | id="x" |-
25993 |}
25994 !! end
25995
25996 ## This tests normalizer's ability to discriminate between
25997 ## cells having identical content.
25998 !! test
25999 4b. Table cells without escapable prefixes after edits
26000 !! options
26001 parsoid={
26002 "modes": ["selser"],
26003 "scrubWikitext": true,
26004 "changes": [
26005 [ "td", "html", "-" ]
26006 ]
26007 }
26008 !! wikitext
26009 {|
26010 |a||b
26011 |}
26012 !! wikitext/edited
26013 {|
26014 | -||-
26015 |}
26016 !! end
26017
26018 ## This tests normalizer's ability to not be tripped by
26019 ## comments (and whitespace)
26020 !! test
26021 4c. Table cells without escapable prefixes after edits
26022 !! options
26023 parsoid={
26024 "modes": ["selser"],
26025 "scrubWikitext": true,
26026 "changes": [
26027 [ "table tbody tr td:first-child", "remove" ]
26028 ]
26029 }
26030 !! wikitext
26031 {|
26032 |-
26033 <!--foo--> |a||-
26034 |}
26035 !! wikitext/edited
26036 {|
26037 |-
26038 <!--foo--> | -
26039 |}
26040 !! end
26041
26042 ## This tests normalizer's ability to handle HTML cells
26043 !! test
26044 4d. Table cells without escapable prefixes after edits
26045 !! options
26046 parsoid={
26047 "modes": ["selser"],
26048 "scrubWikitext": true,
26049 "changes": [
26050 [ "td", "html", "-" ]
26051 ]
26052 }
26053 !! wikitext
26054 <table>
26055 <tr><td>a</td></tr>
26056 </table>
26057 !! wikitext/edited
26058 <table>
26059 <tr><td>-</td></tr>
26060 </table>
26061 !! end
26062
26063 !! test
26064 Escape nowiki DOM elements
26065 !! options
26066 parsoid=html2wt
26067 !! html/parsoid
26068 <nowiki><i>foo</i></nowiki>
26069 !! wikitext
26070 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
26071 !! end
26072
26073 # ---------------------------------------------------
26074 # End of tests spec'ing wikitext serialization norms |
26075 # ---------------------------------------------------
26076
26077 # -----------------------------------------------------------------
26078 # End of section for Parsoid-only html2wt tests for serialization
26079 # of new content
26080 # -----------------------------------------------------------------
26081
26082 # -----------------------------------------------------------------
26083 # The following section of tests are primarily to spec behavior of
26084 # the selective serializer. All these tests have manual selser
26085 # changes. The automated selser changes for all tests handle the
26086 # wide variation of changes, but these tests here capture specs
26087 # deterministically.
26088 # ----------------------------------------------------------------
26089
26090 ## T90517
26091 !! test
26092 Selser: New comments should not be lost
26093 !! options
26094 parsoid={
26095 "modes": ["selser"],
26096 "changes": [
26097 [ "#a", "after", "<!--c1-->" ],
26098 [ "#b", "before", "<!--c2-->" ]
26099 ]
26100 }
26101 !! wikitext
26102 <span id="a">a</span>
26103
26104 <span id="b">b</span>
26105 !! wikitext/edited
26106 <span id="a">a</span><!--c1-->
26107
26108 <!--c2--><span id="b">b</span>
26109 !! end
26110
26111 ## T89383
26112 !! test
26113 Selser: Check for validity of DSR before using it
26114 !! options
26115 parsoid={
26116 "modes": ["selser"],
26117 "changes": [
26118 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
26119 ]
26120 }
26121 !! wikitext
26122 <span id="a">a</span>
26123 !! wikitext/edited
26124 {{DISPLAYTITLE:foo}}
26125 <span id="a">a</span>
26126 !! end
26127
26128 !! test
26129 1. DOMDiff: Changes to <ref> content should be looked up using id
26130 !! options
26131 parsoid={
26132 "modes": ["selser"],
26133 "changes": [
26134 ["#X", "after", "bar"],
26135 ["#Y", "after", "baz"]
26136 ]
26137 }
26138 !! wikitext
26139 X <ref><span id="X">foo</span></ref>
26140 Y <ref name="a" />
26141 <references>
26142 <ref name="a"><span id="Y">foo</span></ref>
26143 </references>
26144 !! wikitext/edited
26145 X <ref><span id="X">foo</span>bar</ref>
26146 Y <ref name="a" />
26147 <references>
26148 <ref name="a"><span id="Y">foo</span>baz</ref>
26149 </references>
26150 !! end
26151
26152 !! test
26153 2. DOMDiff: Changes to <ref> content should be looked up using id
26154 !! options
26155 parsoid={
26156 "modes": ["selser"],
26157 "changes": [
26158 ["#Z", "after", "bar"]
26159 ]
26160 }
26161 !! wikitext
26162 A <ref>foo bar for a</ref>
26163 B <ref group="X" name="b" />
26164
26165 <references />
26166
26167 <references group="X">
26168 <ref name="b"><span id="Z">foo</span></ref>
26169 </references>
26170 !! wikitext/edited
26171 A <ref>foo bar for a</ref>
26172 B <ref group="X" name="b" />
26173
26174 <references />
26175
26176 <references group="X">
26177 <ref name="b"><span id="Z">foo</span>bar</ref>
26178 </references>
26179 !! end