Merge "Migrate move protect log to new log system"
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well-formedness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # parsoid parsoid-specific options (not run by PHP parser unless
25 # the test includes an html/php section)
26 # php php-only test (not run by the parsoid parser unless
27 # the test includes an html/parsoid section)
28 # showtitle make the first line the title
29 # showindicators make the first lines the page status indicators
30 # comment run through Linker::formatComment() instead of main parser
31 # local format section links in edit comment text as local links
32 # notoc disable table of contents
33 # thumbsize=NNN set the default thumb size to NNNpx for this test
34 #
35 # You can also set the following parser properties via test options:
36 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
37 # wgLinkHolderBatchSize, wgRawHtml
38 #
39 # For testing purposes, temporary articles can created:
40 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
41 # where '/' denotes a newline.
42
43 # This is the standard article assumed to exist.
44 !! article
45 Main Page
46 !! text
47 blah blah
48 !! endarticle
49
50 !!article
51 Foo
52 !!text
53 FOO
54 !!endarticle
55
56 !!article
57 Template:Foo
58 !!text
59 FOO
60 !!endarticle
61
62 !! article
63 Template:Blank
64 !! text
65 !! endarticle
66
67 !! article
68 Template:pipe
69 !! text
70 |
71 !! endarticle
72
73 !! article
74 Template:=
75 !! text
76 <nowiki>=</nowiki>
77 !! endarticle
78
79 !!article
80 MediaWiki:bad image list
81 !!text
82 * [[File:Bad.jpg]] except [[Nasty page]]
83 !!endarticle
84
85 !! article
86 Template:inner list
87 !! text
88 * item 1
89 !! endarticle
90
91 !! article
92 Template:tbl-start
93 !! text
94 {|
95 !! endarticle
96
97 !! article
98 Template:tbl-end
99 !! text
100 |}
101 !! endarticle
102
103 !! article
104 Template:echo
105 !! text
106 {{{1}}}
107 !! endarticle
108
109 !! article
110 Template:echo_with_span
111 !! text
112 <span>{{{1}}}</span>
113 !! endarticle
114
115 !! article
116 Template:echo_with_div
117 !! text
118 <div>{{{1}}}</div>
119 !! endarticle
120
121 !! article
122 Template:blank_param
123 !! text
124 {{{1}}}
125 {{{}}}
126 !! endarticle
127
128 !! article
129 Template:table_attribs
130 !! text
131 <noinclude>
132 |</noinclude>style="color:red;"|Foo
133 !! endarticle
134
135 !! article
136 Template:table_attribs_2
137 !! text
138 <noinclude>
139 |</noinclude>style="color:red;"|Foo
140 |Bar||Baz
141 !! endarticle
142
143 !! article
144 Template:table_attribs_3
145 !! text
146 <noinclude>
147 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
148 !! endarticle
149
150 !! article
151 Template:table_attribs_4
152 !! text
153 | style="background-color:#DC241f;" width="10px" |
154 !! endarticle
155
156 !! article
157 Template:table_attribs_5
158 !! text
159 <noinclude>
160 |</noinclude>style="color:red;"||Bar
161 !! endarticle
162
163 !! article
164 Template:table_attribs_6
165 !! text
166 style="background: <nowiki>
167
168
169 red;</nowiki>" |
170 !! endarticle
171
172 !! article
173 Template:table_attribs_7
174 !! text
175 <noinclude>
176 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
177 !! endarticle
178
179 !! article
180 Template:table_header_cells
181 !! text
182 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
183 !! endarticle
184
185 !! article
186 Template:table_cells
187 !! text
188 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
189 !! endarticle
190
191 !! article
192 Template:PartialTable
193 !! text
194 {|
195 |-
196 !! endarticle
197
198 !! article
199 Template:image_attribs
200 !! text
201 <noinclude>
202 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
203 !! endarticle
204
205 ## See T48811 for details
206 !! article
207 Template:mixed_attr_content_template
208 !! text
209 style="color:red;" title="T48811"
210 |-
211 |foo
212 !! endarticle
213
214 !! article
215 Template:definition_list
216 !! text
217 one
218 ::two
219 !! endarticle
220
221 !! article
222 A?b
223 !! text
224 Weirdo titles!
225 !! endarticle
226
227 !!article
228 Template:Bullet
229 !!text
230 * Bar
231 !!endarticle
232
233 !!article
234 Template:OpenTable
235 !!text
236 {|
237 !!endarticle
238
239 !!article
240 Template:EmptyLITest
241 !!text
242 *a
243 *
244 *
245 *b
246 !!endarticle
247
248 !!article
249 Template:EmptyTRTest
250 !!text
251 {|
252 |-
253 |-
254 |foo
255 |-
256 |-
257 |bar
258 |}
259 !!endarticle
260
261 !!article
262 Template:EmptyTRWithHTMLAttrTest
263 !!text
264 <table>
265 <tr align="center"></tr>
266 <tr><td>foo</td></tr>
267 <tr align="center"></tr>
268 <tr><td>bar</td></tr>
269 </table>
270 !!endarticle
271
272 ###
273 ### Basic tests
274 ###
275 !! test
276 Blank input
277 !! wikitext
278 !! html
279 !! end
280
281
282 !! test
283 Simple paragraph
284 !! wikitext
285 This is a simple paragraph.
286 !! html
287 <p>This is a simple paragraph.
288 </p>
289 !! end
290
291 !! test
292 Paragraphs with extra newline spacing
293 !! wikitext
294 foo
295
296 bar
297
298
299 baz
300
301
302
303 booz
304 !! html
305 <p>foo
306 </p><p>bar
307 </p><p><br />
308 baz
309 </p><p><br />
310 </p><p>booz
311 </p>
312 !! end
313
314 !! test
315 Paragraphs with newline spacing with comment lines in between
316 !! wikitext
317 ----
318 a
319 <!--foo-->
320 b
321 ----
322 a
323 <!--foo--><!--More than 1 comment, still stripped-->
324 b
325 ----
326 a
327 <!--foo--> <!----> <!-- bar -->
328 b
329 ----
330 a
331 <!--foo-->
332
333 b
334 ----
335 a
336
337 <!--foo-->
338 b
339 ----
340 a
341 <!--foo-->
342
343
344 b
345 ----
346 a
347
348
349 <!--foo-->
350 b
351 ----
352 !! html
353 <hr />
354 <p>a
355 b
356 </p>
357 <hr />
358 <p>a
359 b
360 </p>
361 <hr />
362 <p>a
363 b
364 </p>
365 <hr />
366 <p>a
367 </p><p>b
368 </p>
369 <hr />
370 <p>a
371 </p><p>b
372 </p>
373 <hr />
374 <p>a
375 </p><p><br />
376 b
377 </p>
378 <hr />
379 <p>a
380 </p><p><br />
381 b
382 </p>
383 <hr />
384
385 !! end
386
387 !! test
388 Paragraphs with newline spacing with non-empty white-space lines in between
389 !! wikitext
390 ----
391 a
392
393 b
394 ----
395 a
396
397
398 b
399 ----
400 !! html
401 <hr />
402 <p>a
403 </p><p>b
404 </p>
405 <hr />
406 <p>a
407 </p><p><br />
408 b
409 </p>
410 <hr />
411
412 !! end
413
414 !! test
415 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
416 !! wikitext
417 ----
418 a
419 <!--foo-->
420 b
421 ----
422 a
423 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
424 b
425 ----
426 a
427
428 <!--foo-->
429 <!--bar-->
430 b
431 ----
432 a
433
434 <!--foo-->
435 <!--bar-->
436
437 b
438 ----
439 !! html
440 <hr />
441 <p>a
442 b
443 </p>
444 <hr />
445 <p>a
446 b
447 </p>
448 <hr />
449 <p>a
450 </p><p>b
451 </p>
452 <hr />
453 <p>a
454 </p><p><br />
455 b
456 </p>
457 <hr />
458
459 !! end
460
461 !! test
462 Extra newlines: More paragraphs with indented comment
463 !! wikitext
464 a
465
466 <!--boo-->
467
468 b
469 !! html
470 <p>a
471 </p><p><br />
472 b
473 </p>
474 !!end
475
476 !! test
477 Extra newlines followed by heading
478 !! wikitext
479 a
480
481
482
483 =b=
484 [[a]]
485
486
487 =b=
488 !! html
489 <p>a
490 </p><p><br />
491 </p>
492 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
493 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
494 </p><p><br />
495 </p>
496 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
497
498 !! end
499
500 !! test
501 Extra newlines between heading and content are swallowed
502 !! wikitext
503 =b=
504
505
506
507 [[a]]
508 !! html
509 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
510 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
511 </p>
512 !! end
513
514 !! test
515 Parsing an URL
516 !! wikitext
517 http://fr.wikipedia.org/wiki/🍺
518 <!-- EasterEgg we love beer, better be able be able to link to it -->
519 !! html
520 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
521 </p>
522 !! end
523
524 # Note that the html+tidy output removes the spaces after the <li>,
525 # which is a bug (http://sourceforge.net/p/tidy/bugs/945/, etc).
526 # This is an issue for all tests with lists. We intentionally do
527 # *not* add html+tidy clauses for these, as we don't want to
528 # document/test the broken behavior. (Parsoid matches the non-tidy
529 # output in these cases.)
530
531 !! test
532 Simple list
533 !! wikitext
534 * Item 1
535 * Item 2
536 !! html
537 <ul><li> Item 1</li>
538 <li> Item 2</li></ul>
539
540 !! end
541
542 !! test
543 Italics and bold
544 !! wikitext
545 * plain
546 * plain''italic''plain
547 * plain''italic''plain''italic''plain
548 * plain'''bold'''plain
549 * plain'''bold'''plain'''bold'''plain
550 * plain''italic''plain'''bold'''plain
551 * plain'''bold'''plain''italic''plain
552 * plain''italic'''bold-italic'''italic''plain
553 * plain'''bold''bold-italic''bold'''plain
554 * plain'''''bold-italic'''italic''plain
555 * plain'''''bold-italic''bold'''plain
556 * plain''italic'''bold-italic'''''plain
557 * plain'''bold''bold-italic'''''plain
558 * plain l'''italic''plain
559 * plain l''''bold''' plain
560 !! html
561 <ul><li> plain</li>
562 <li> plain<i>italic</i>plain</li>
563 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
564 <li> plain<b>bold</b>plain</li>
565 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
566 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
567 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
568 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
569 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
570 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
571 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
572 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
573 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
574 <li> plain l'<i>italic</i>plain</li>
575 <li> plain l'<b>bold</b> plain</li></ul>
576
577 !! end
578
579 # this example taken from the [[simple:Moon]] article (bug 47326)
580 !! test
581 Italics and possessives (1)
582 !! wikitext
583 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
584 !! html
585 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
586 </p>
587 !! end
588
589 # this example taken from [[en:Flaming Pie]] (bug 49926)
590 !! test
591 Italics and possessives (2)
592 !! wikitext
593 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
594 !! html
595 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
596 </p>
597 !! end
598
599 # this example taken from [[en:Dictionary]] (bug 49926)
600 !! test
601 Italics and possessives (3)
602 !! wikitext
603 The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[[Accademia della Crusca]]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''.
604 !! html
605 <p>The first monolingual dictionary written in a Romance language was <i>Sebastián Covarrubias'</i> <i>Tesoro de la lengua castellana o española</i>, published in 1611 in Madrid. In 1612 the first edition of the <i>Vocabolario dell'<a href="/index.php?title=Accademia_della_Crusca&amp;action=edit&amp;redlink=1" class="new" title="Accademia della Crusca (page does not exist)">Accademia della Crusca</a></i>, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the <i>Dictionnaire Universel</i>.
606 </p>
607 !! end
608
609
610 ###
611 ### 2-quote opening sequence tests
612 ###
613 !! test
614 Italics and bold: 2-quote opening sequence: (2,2)
615 !! wikitext
616 ''foo''
617 !! html
618 <p><i>foo</i>
619 </p>
620 !!end
621
622 !! test
623 Italics and bold: 2-quote opening sequence: (2,3)
624 !! wikitext
625 ''foo'''
626 !! html/*
627 <p><i>foo'</i>
628 </p>
629 !!end
630
631 !! test
632 Italics and bold: 2-quote opening sequence: (2,4)
633 !! options
634 parsoid=wt2html
635 !! wikitext
636 ''foo''''
637 !! html/*
638 <p><i>foo''</i>
639 </p>
640 !!end
641
642 # same html as previous, but wikitext adjusted to match parsoid html2wt
643 !! test
644 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
645 !! wikitext
646 ''foo<nowiki>''</nowiki>''
647 !! html
648 <p><i>foo''</i>
649 </p>
650 !! end
651
652 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
653 !! test
654 Italics and bold: 2-quote opening sequence: (2,5)
655 !! options
656 parsoid=wt2html
657 !! wikitext
658 ''foo'''''
659 !! html/php
660 <p><i>foo</i>
661 </p>
662 !! html/parsoid
663 <p><i>foo</i><b></b>
664 </p>
665 !!end
666
667 # same html as previous, but wikitext adjusted to match parsoid html2wt
668 !! test
669 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
670 !! wikitext
671 ''foo'''''<nowiki/>'''
672 !! html/php
673 <p><i>foo</i>
674 </p>
675 !! html/parsoid
676 <p><i>foo</i><b></b>
677 </p>
678 !! end
679
680
681 ###
682 ### 3-quote opening sequence tests
683 ###
684
685 !! test
686 Italics and bold: 3-quote opening sequence: (3,2)
687 !! wikitext
688 '''foo''
689 !! html/*
690 <p>'<i>foo</i>
691 </p>
692 !!end
693
694 !! test
695 Italics and bold: 3-quote opening sequence: (3,3)
696 !! wikitext
697 '''foo'''
698 !! html
699 <p><b>foo</b>
700 </p>
701 !!end
702
703 !! test
704 Italics and bold: 3-quote opening sequence: (3,4)
705 !! wikitext
706 '''foo''''
707 !! html/*
708 <p><b>foo'</b>
709 </p>
710 !!end
711
712 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
713 !! test
714 Italics and bold: 3-quote opening sequence: (3,5)
715 !! options
716 parsoid=wt2html
717 !! wikitext
718 '''foo'''''
719 !! html/php
720 <p><b>foo</b>
721 </p>
722 !! html/parsoid
723 <p><b>foo</b><i></i>
724 </p>
725 !!end
726
727 # same html as previous, but wikitext adjusted to match parsoid html2wt
728 !! test
729 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
730 !! wikitext
731 '''foo'''''<nowiki/>''
732 !! html/php
733 <p><b>foo</b>
734 </p>
735 !! html/parsoid
736 <p><b>foo</b><i></i>
737 </p>
738 !! end
739
740
741 ###
742 ### 4-quote opening sequence tests
743 ###
744
745 !! test
746 Italics and bold: 4-quote opening sequence: (4,2)
747 !! options
748 parsoid=wt2html
749 !! wikitext
750 ''''foo''
751 !! html/*
752 <p>''<i>foo</i>
753 </p>
754 !!end
755
756 # same html as previous, but wikitext adjusted to match parsoid html2wt
757 !! test
758 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
759 !! wikitext
760 <nowiki>''</nowiki>''foo''
761 !! html
762 <p>''<i>foo</i>
763 </p>
764 !! end
765
766 !! test
767 Italics and bold: 4-quote opening sequence: (4,3)
768 !! wikitext
769 ''''foo'''
770 !! html/*
771 <p>'<b>foo</b>
772 </p>
773 !!end
774
775 !! test
776 Italics and bold: 4-quote opening sequence: (4,4)
777 !! options
778 parsoid=wt2html
779 !! wikitext
780 ''''foo''''
781 !! html/*
782 <p>'<b>foo'</b>
783 </p>
784 !!end
785
786 # same html as previous, but wikitext adjusted to match parsoid html2wt
787 !! test
788 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
789 !! wikitext
790 '<nowiki/>'''foo''''
791 !! html
792 <p>'<b>foo'</b>
793 </p>
794 !! end
795
796 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
797 !! test
798 Italics and bold: 4-quote opening sequence: (4,5)
799 !! options
800 parsoid=wt2html
801 !! wikitext
802 ''''foo'''''
803 !! html/php
804 <p>'<b>foo</b>
805 </p>
806 !! html/parsoid
807 <p>'<b>foo</b><i></i>
808 </p>
809 !!end
810
811 # same html as previous, but wikitext adjusted to match parsoid html2wt
812 !! test
813 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
814 !! wikitext
815 '<nowiki/>'''foo'''''<nowiki/>''
816 !! html/php
817 <p>'<b>foo</b>
818 </p>
819 !! html/parsoid
820 <p>'<b>foo</b><i></i>
821 </p>
822 !! end
823
824
825 ###
826 ### 5-quote opening sequence tests
827 ###
828
829 !! test
830 Italics and bold: 5-quote opening sequence: (5,2)
831 !! options
832 parsoid=wt2html
833 !! wikitext
834 '''''foo''
835 !! html/*
836 <p><b><i>foo</i></b>
837 </p>
838 !!end
839
840 # same html as previous, but wikitext adjusted to match parsoid html2wt
841 !! test
842 Italics and bold: 5-quote opening sequence: (5,2+3)
843 !! wikitext
844 '''''foo'''''
845 !! html/*
846 <p><i><b>foo</b></i>
847 </p>
848 !! end
849
850 !! test
851 Italics and bold: 5-quote opening sequence: (5,3)
852 !! options
853 parsoid=wt2html
854 !! wikitext
855 '''''foo'''
856 !! html/*
857 <p><i><b>foo</b></i>
858 </p>
859 !!end
860
861 # same html as previous, but wikitext adjusted to match parsoid html2wt
862 !! test
863 Italics and bold: 5-quote opening sequence: (5,3+2)
864 !! wikitext
865 '''''foo'''''
866 !! html
867 <p><i><b>foo</b></i>
868 </p>
869 !! end
870
871 !! test
872 Italics and bold: 5-quote opening sequence: (5,4)
873 !! options
874 parsoid=wt2html
875 !! wikitext
876 '''''foo''''
877 !! html/*
878 <p><i><b>foo'</b></i>
879 </p>
880 !!end
881
882 !! test
883 Italics and bold: 5-quote opening sequence: (5,5)
884 !! wikitext
885 '''''foo'''''
886 !! html
887 <p><i><b>foo</b></i>
888 </p>
889 !!end
890
891 !! test
892 Italics and bold: 5-quote opening sequence: (5,6)
893 !! wikitext
894 '''''foo''''''
895 !! html/*
896 <p><i><b>foo'</b></i>
897 </p>
898 !! end
899
900 ###
901 ### multiple quote sequences in a line
902 ###
903 !! test
904 Italics and bold: multiple quote sequences: (2,4,2)
905 !! options
906 parsoid=wt2html
907 !! wikitext
908 ''foo''''bar''
909 !! html/*
910 <p><i>foo'<b>bar</b></i>
911 </p>
912 !!end
913
914
915 # same html as previous, but wikitext adjusted to match parsoid html2wt
916 !! test
917 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
918 !! wikitext
919 ''foo'<nowiki/>'''bar'''''
920 !! html
921 <p><i>foo'<b>bar</b></i>
922 </p>
923 !! end
924
925
926 !! test
927 Italics and bold: multiple quote sequences: (2,4,3)
928 !! options
929 parsoid=wt2html
930 !! wikitext
931 ''foo''''bar'''
932 !! html/*
933 <p><i>foo'<b>bar</b></i>
934 </p>
935 !!end
936
937
938 # same html as previous, but wikitext adjusted to match parsoid html2wt
939 !! test
940 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
941 !! wikitext
942 ''foo'<nowiki/>'''bar'''''
943 !! html
944 <p><i>foo'<b>bar</b></i>
945 </p>
946 !! end
947
948
949 !! test
950 Italics and bold: multiple quote sequences: (2,4,4)
951 !! options
952 parsoid=wt2html
953 !! wikitext
954 ''foo''''bar''''
955 !! html/*
956 <p><i>foo'<b>bar'</b></i>
957 </p>
958 !!end
959
960
961 # same html as previous, but wikitext adjusted to match parsoid html2wt
962 !! test
963 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
964 !! wikitext
965 ''foo'<nowiki/>'''bar'<nowiki/>'''''
966 !! html
967 <p><i>foo'<b>bar'</b></i>
968 </p>
969 !! end
970
971
972 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
973 !! test
974 Italics and bold: multiple quote sequences: (3,4,2)
975 !! options
976 parsoid=wt2html
977 !! wikitext
978 '''foo''''bar''
979 !! html/php
980 <p><b>foo'</b>bar
981 </p>
982 !! html/parsoid
983 <p><b>foo'</b>bar<i></i>
984 </p>
985 !!end
986
987 # same html as previous, but wikitext adjusted to match parsoid html2wt
988 !! test
989 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
990 !! options
991 parsoid
992 !! wikitext
993 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
994 !! html/php
995 <p><b>foo'</b>bar
996 </p>
997 !! html/parsoid
998 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
999 </p>
1000 !! end
1001
1002
1003 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1004 !! test
1005 Italics and bold: multiple quote sequences: (3,4,3)
1006 !! options
1007 parsoid=wt2html
1008 !! wikitext
1009 '''foo''''bar'''
1010 !! html/php
1011 <p><b>foo'</b>bar
1012 </p>
1013 !! html/parsoid
1014 <p><b>foo'</b>bar<b></b>
1015 </p>
1016 !!end
1017
1018 # same html as previous, but wikitext adjusted to match parsoid html2wt
1019 !! test
1020 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1021 !! wikitext
1022 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
1023 !! html/php
1024 <p><b>foo'</b>bar
1025 </p>
1026 !! html/parsoid
1027 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
1028 </p>
1029 !! end
1030
1031 ###
1032 ### other quote tests
1033 ###
1034 !! test
1035 Italics and bold: other quote tests: (2,3,5)
1036 !! wikitext
1037 ''this is about '''foo's family'''''
1038 !! html
1039 <p><i>this is about <b>foo's family</b></i>
1040 </p>
1041 !!end
1042
1043
1044 !! test
1045 Italics and bold: other quote tests: (2,(3,3),2)
1046 !! wikitext
1047 ''this is about '''foo's''' family''
1048 !! html
1049 <p><i>this is about <b>foo's</b> family</i>
1050 </p>
1051 !!end
1052
1053
1054 !! test
1055 Italics and bold: other quote tests: (3,2,3,2)
1056 !! options
1057 parsoid=wt2html
1058 !! wikitext
1059 '''this is about ''foo'''s family''
1060 !! html/*
1061 <p><b>this is about <i>foo</i></b><i>s family</i>
1062 </p>
1063 !!end
1064
1065
1066 # same html as previous, but wikitext adjusted to match parsoid html2wt
1067 !! test
1068 Italics and bold: other quote tests: (3,2,3+2+2,2)
1069 !! wikitext
1070 '''this is about ''foo'''''<nowiki/>''s family''
1071 !! html
1072 <p><b>this is about <i>foo</i></b><i>s family</i>
1073 </p>
1074 !! end
1075
1076
1077 !! test
1078 Italics and bold: other quote tests: (3,2,3,3)
1079 !! wikitext
1080 '''this is about ''foo'''s family'''
1081 !! html/*
1082 <p>'<i>this is about </i>foo<b>s family</b>
1083 </p>
1084 !!end
1085
1086
1087 !! test
1088 Italics and bold: other quote tests: (3,(2,2),3)
1089 !! wikitext
1090 '''this is about ''foo's'' family'''
1091 !! html
1092 <p><b>this is about <i>foo's</i> family</b>
1093 </p>
1094 !!end
1095
1096
1097 !! test
1098 Italicized possessive
1099 !! wikitext
1100 The ''[[Main Page]]'''s talk page.
1101 !! html/php
1102 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1103 </p>
1104 !! html/parsoid
1105 <p>The <i><a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1106 !! end
1107
1108 !! test
1109 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1110 (Requires tidy for PHP parser output to be fixed up)
1111 !! options
1112 parsoid=wt2html,wt2wt
1113 !! wikitext
1114 {|
1115 !''a!!''b
1116 |''a||''b
1117 |}
1118 !! html/php+tidy
1119 <table>
1120 <tr>
1121 <th><i>a</i></th>
1122 <th><i>b</i></th>
1123 <td><i>a</i></td>
1124 <td><i>b</i></td>
1125 </tr>
1126 </table>
1127 !! html/parsoid
1128 <table>
1129 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1130 <td><i>a</i></td><td><i>b</i></td></tr>
1131 </tbody></table>
1132 !! end
1133
1134 ###
1135 ### Non-html5 tags
1136 ###
1137
1138 !! test
1139 Non-html5 tags should be accepted
1140 !! wikitext
1141 <center>''foo''</center>
1142 <big>''foo''</big>
1143 <font>''foo''</font>
1144 <strike>''foo''</strike>
1145 <tt>''foo''</tt>
1146 !! html
1147 <center><i>foo</i></center>
1148 <p><big><i>foo</i></big>
1149 <font><i>foo</i></font>
1150 <strike><i>foo</i></strike>
1151 <tt><i>foo</i></tt>
1152 </p>
1153 !! end
1154
1155 !! test
1156 <wbr> is valid wikitext (bug 52468)
1157 !! wikitext
1158 <wbr>
1159 !! html
1160 <p><wbr />
1161 </p>
1162 !! end
1163
1164 # <strike> is HTML4, <s> is HTML4/5.
1165 !! test
1166 <s> or <strike> for strikethrough
1167 !! wikitext
1168 <strike>strike</strike>
1169
1170 <s>s</s>
1171 !! html
1172 <p><strike>strike</strike>
1173 </p><p><s>s</s>
1174 </p>
1175 !! end
1176
1177 ## a not permitted
1178 ## i,b,br omitted
1179 !! test
1180 Text-level semantic html elements in wikitext
1181 !! wikitext
1182 <em>text</em>
1183 <strong>text</strong>
1184 <small>text</small>
1185 <s>text</s>
1186 <cite>text</cite>
1187 <q>text</q>
1188 <dfn>text</dfn>
1189 <abbr>text</abbr>
1190 <data>text</data>
1191 <time>text</time>
1192 <code>text</code>
1193 <var>text</var>
1194 <samp>text</samp>
1195 <kbd>text</kbd>
1196 <sub>text</sub>
1197 <u>text</u>
1198 <mark>text</mark>
1199 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1200 <bdi>text</bdi>
1201 <bdo>text</bdo>
1202 <span>text</span>
1203 <wbr />
1204 !! html
1205 <p><em>text</em>
1206 <strong>text</strong>
1207 <small>text</small>
1208 <s>text</s>
1209 <cite>text</cite>
1210 <q>text</q>
1211 <dfn>text</dfn>
1212 <abbr>text</abbr>
1213 <data>text</data>
1214 <time>text</time>
1215 <code>text</code>
1216 <var>text</var>
1217 <samp>text</samp>
1218 <kbd>text</kbd>
1219 <sub>text</sub>
1220 <u>text</u>
1221 <mark>text</mark>
1222 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1223 <bdi>text</bdi>
1224 <bdo>text</bdo>
1225 <span>text</span>
1226 <wbr />
1227 </p>
1228 !! end
1229
1230 # test cases taken from
1231 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1232 !! test
1233 Ruby markup (W3C-style)
1234 !! wikitext
1235 ; Mono-ruby for individual base characters
1236 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1237 ; Group ruby
1238 : <ruby>今日<rt>きょう</rt></ruby>
1239 ; Jukugo ruby
1240 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1241 ; Inline ruby
1242 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1243 ; Double-sided ruby
1244 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1245 <ruby>
1246 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1247 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1248 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1249 </ruby>
1250 !! html
1251 <dl><dt> Mono-ruby for individual base characters</dt>
1252 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1253 <dt> Group ruby</dt>
1254 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1255 <dt> Jukugo ruby</dt>
1256 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1257 <dt> Inline ruby</dt>
1258 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1259 <dt> Double-sided ruby</dt>
1260 <dd> <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby></dd></dl>
1261 <p><ruby>
1262 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1263 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1264 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1265 </ruby>
1266 </p>
1267 !! end
1268
1269 # The next two test different paths in the sanitizer.
1270 !! test
1271 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1272 !! wikitext
1273 <blockquote|>a</blockquote>
1274
1275 <b→> doesn't terminate </b→>
1276
1277 <bä> doesn't terminate </bä>
1278
1279 <boo> doesn't terminate </boo>
1280
1281 <s.foo> doesn't terminate </s.foo>
1282
1283 <sub-ID#1>
1284 !! html
1285 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1286 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1287 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1288 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1289 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1290 </p><p>&lt;sub-ID#1&gt;
1291 </p>
1292 !! end
1293
1294 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1295 # If the non-word-character tag made it through the sanitizer, tidy
1296 # would munge it up.
1297 !! test
1298 Non-word characters don't terminate tag names + tidy
1299 !! wikitext
1300 <blockquote|>a</blockquote>
1301
1302 <b→> doesn't terminate </b→>
1303
1304 <bä> doesn't terminate </bä>
1305
1306 <boo> doesn't terminate </boo>
1307
1308 <s.foo> doesn't terminate </s.foo>
1309
1310 <sub-ID#1>
1311 !! html+tidy
1312 <p>&lt;blockquote|&gt;a</p>
1313 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1314 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1315 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1316 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1317 <p>&lt;sub-ID#1&gt;</p>
1318 !! end
1319
1320 ###
1321 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1322 ### This checks that HTML5 tags (with non-word characters in the tag
1323 ### name) make it safely through the parser -- the Sanitizer will
1324 ### munge them later, as it should.
1325 ###
1326 !! test
1327 Non-word characters are valid in extension tags (T19663)
1328 !! wikitext
1329 <tåg>tåg</tåg>
1330 !! html/php
1331 <pre>
1332 'tåg'
1333 array (
1334 )
1335 </pre>
1336
1337 !! end
1338
1339 !! test
1340 Isolated close tags should be treated as literal text (bug 52760)
1341 !! options
1342 parsoid=wt2html
1343 !! wikitext
1344 </b>
1345
1346 <s.foo>s</s>
1347 !! html/php+tidy
1348 <p>&lt;s.foo&gt;s</p>
1349 !! html/parsoid
1350 <p>&lt;s.foo&gt;s</p>
1351 !! end
1352
1353 ###
1354 ### Special characters
1355 ###
1356
1357 !! test
1358 Bare pipe character (bug 52363)
1359 !! wikitext
1360 |
1361 !! html
1362 <p>|
1363 </p>
1364 !! end
1365
1366 !! test
1367 Bare pipe character from a template (bug 52363)
1368 !! wikitext
1369 {{pipe}}
1370 !! html
1371 <p>|
1372 </p>
1373 !! end
1374
1375 ###
1376 ### <nowiki> test cases
1377 ###
1378
1379 !! test
1380 <nowiki> unordered list
1381 !! wikitext
1382 <nowiki>* This is not an unordered list item.</nowiki>
1383 !! html/php
1384 <p>* This is not an unordered list item.
1385 </p>
1386 !! html/parsoid
1387 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1388 !! end
1389
1390 !! test
1391 <nowiki> spacing
1392 !! wikitext
1393 <nowiki>Lorem ipsum dolor
1394
1395 sed abit.
1396 sed nullum.
1397
1398 :and a colon
1399 </nowiki>
1400 !! html/php
1401 <p>Lorem ipsum dolor
1402
1403 sed abit.
1404 sed nullum.
1405
1406 :and a colon
1407
1408 </p>
1409 !! html/parsoid
1410 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1411
1412 sed abit.
1413 sed nullum.
1414
1415 :and a colon
1416 </span></p>
1417 !! end
1418
1419 !! test
1420 nowiki 3
1421 !! wikitext
1422 :There is not nowiki.
1423 :There is <nowiki>nowiki</nowiki>.
1424
1425 #There is not nowiki.
1426 #There is <nowiki>nowiki</nowiki>.
1427
1428 *There is not nowiki.
1429 *There is <nowiki>nowiki</nowiki>.
1430 !! html/php
1431 <dl><dd>There is not nowiki.</dd>
1432 <dd>There is nowiki.</dd></dl>
1433 <ol><li>There is not nowiki.</li>
1434 <li>There is nowiki.</li></ol>
1435 <ul><li>There is not nowiki.</li>
1436 <li>There is nowiki.</li></ul>
1437
1438 !! html/parsoid
1439 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1440 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1441
1442 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1443 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1444
1445 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1446 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1447 !! end
1448
1449 !! test
1450 Entities inside <nowiki>
1451 !! wikitext
1452 <nowiki>&lt;</nowiki>
1453 !! html
1454 <p>&lt;
1455 </p>
1456 !! end
1457
1458 !! test
1459 Entities inside template parameters
1460 !! wikitext
1461 {{echo|&ndash;}}
1462 !! html/php+tidy
1463 <p>–</p>
1464 !! html/parsoid
1465 <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}}]}'>&ndash;</span></p>
1466 !! end
1467
1468 !! test
1469 Properly escape nowiki when combined with other wiki markup
1470 !! options
1471 parsoid=html2wt
1472 !! html/parsoid
1473 <p>* &lt;/nowiki&gt; tag</p>
1474 !! wikitext
1475 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1476 !! end
1477
1478 !! test
1479 T93824: Put escaped HTML tags inside nowiki
1480 !! options
1481 parsoid=html2wt
1482 !! html/parsoid
1483 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1484 !! wikitext
1485 <nowiki><h2>foo</h2></nowiki>
1486 !! end
1487
1488 !! test
1489 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1490 !! options
1491 parsoid=html2wt
1492 !! html/parsoid
1493 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1494 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1495 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1496 !! wikitext
1497 This text: L'[[Foo]]
1498 This text: L<nowiki>''</nowiki>[[Foo]]
1499 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1500 !! end
1501
1502 # This test fails because wikitext whitespace is not normalized before comparing.
1503 !! test
1504 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1505 !! options
1506 parsoid=html2wt
1507 !! html/parsoid
1508 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1509 </p>
1510 !! wikitext
1511 This text : L<nowiki>''</nowiki>[[Foo]]
1512 !! end
1513
1514 # This test and the next one are html2wt only as they test that incorrect wikitext
1515 # passed in template arguments gets escaped or wrapped in nowikis where required.
1516 !! test
1517 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1518 !! options
1519 parsoid=html2wt
1520 !! html/parsoid
1521 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1522 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar |[[&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></p>
1523 !! wikitext
1524 {{echo|foo{{!}}bar}}
1525 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1526 !! end
1527
1528 !! test
1529 T53961: Output correct nowikis in template arguments
1530 !! options
1531 parsoid=html2wt
1532 !! html/parsoid
1533 <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
1534 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }} b&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></span>
1535 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [[ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt3"></span>
1536 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a | {{ ]]&quot;}},&quot;i&quot;:0}}]}" about="#mwt4"></span>
1537 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }&quot;}},&quot;i&quot;:0}}]}" about="#mwt5"></span></p>
1538 !! wikitext
1539 {{echo|a [ b}}
1540 {{echo|a <nowiki>}}</nowiki> b}}
1541 {{echo|<nowiki>a [[ b</nowiki>}}
1542 {{echo|a {{!}} <nowiki>{{ ]]</nowiki>}}
1543 {{echo|a <nowiki>}</nowiki>}}
1544 !! end
1545
1546 !! test
1547 Cases where "!!" needs nowiki protection
1548 !! options
1549 parsoid=html2wt
1550 !! html/parsoid
1551 <table>
1552 <tr><th>this needs protection !! here</th></tr>
1553 </table>
1554
1555 <table>
1556 <tr><th>this does not need
1557 protection !! here</th></tr>
1558 </table>
1559 !! wikitext
1560 {|
1561 !<nowiki>this needs protection !! here</nowiki>
1562 |}
1563
1564 {|
1565 !this does not need
1566 protection !! here
1567 |}
1568 !! end
1569
1570 ###
1571 ### Comments
1572 ###
1573 !! test
1574 Comments and Indent-Pre
1575 !! wikitext
1576 <!-- comment 1 --> asdf
1577
1578 <!-- comment 1 --> asdf
1579 <!-- comment 2 -->
1580
1581 <!-- comment 1 --> asdf
1582 <!-- comment 2 -->xyz
1583
1584 <!-- comment 1 --> asdf
1585 <!-- comment 2 --> xyz
1586 !! html
1587 <pre>asdf
1588 </pre>
1589 <pre>asdf
1590 </pre>
1591 <pre>asdf
1592 </pre>
1593 <p>xyz
1594 </p>
1595 <pre>asdf
1596 xyz
1597 </pre>
1598 !! end
1599
1600 !! test
1601 Comment test 2a
1602 !! wikitext
1603 asdf
1604 <!-- comment 1 -->
1605 jkl
1606 !! html
1607 <p>asdf
1608 jkl
1609 </p>
1610 !! end
1611
1612 !! test
1613 Comment test 2b
1614 !! wikitext
1615 asdf
1616 <!-- comment 1 -->
1617
1618 jkl
1619 !! html
1620 <p>asdf
1621 </p><p>jkl
1622 </p>
1623 !! end
1624
1625 !! test
1626 Comment test 3
1627 !! wikitext
1628 asdf
1629 <!-- comment 1 -->
1630 <!-- comment 2 -->
1631 jkl
1632 !! html
1633 <p>asdf
1634 jkl
1635 </p>
1636 !! end
1637
1638 !! test
1639 Comment test 4
1640 !! wikitext
1641 asdf<!-- comment 1 -->jkl
1642 !! html
1643 <p>asdfjkl
1644 </p>
1645 !! end
1646
1647 !! test
1648 Comment spacing
1649 !! wikitext
1650 a
1651 <!-- foo --> b <!-- bar -->
1652 c
1653 !! html
1654 <p>a
1655 </p>
1656 <pre> b
1657 </pre>
1658 <p>c
1659 </p>
1660 !! end
1661
1662 !! test
1663 Comment whitespace
1664 !! wikitext
1665 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1666 !! html
1667
1668 !! end
1669
1670 !! test
1671 Comment semantics and delimiters
1672 !! wikitext
1673 <!-- --><!----><!-----><!------>
1674 !! html/php
1675
1676 !! html/parsoid
1677 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1678 !! end
1679
1680 !! test
1681 Comment semantics and delimiters, redux
1682 !! wikitext
1683 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1684 -- foo -- funky huh? ... -->
1685 !! html/php
1686
1687 !! html/parsoid
1688 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1689 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1690 !! end
1691
1692 !! test
1693 Comment semantics and delimiters: directors cut
1694 !! wikitext
1695 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1696 everything starting with < followed by !-- until the first -- and > we see,
1697 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1698 -->-->
1699 !! html/php
1700 <p>--&gt;
1701 </p>
1702 !! html/parsoid
1703 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1704 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1705 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1706 --><p>--></p>
1707 !! end
1708
1709 !! test
1710 Comment semantics: nesting
1711 !! wikitext
1712 <!--<!-- no, we're not going to do anything fancy here -->-->
1713 !! html/php
1714 <p>--&gt;
1715 </p>
1716 !! html/parsoid
1717 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1718 !! end
1719
1720 # Parsoid closes the unclosed comment, even if it means a slight
1721 # round-trip diff.
1722 !! test
1723 Comment semantics: unclosed comment at end
1724 !! options
1725 parsoid=wt2html,html2html
1726 !! wikitext
1727 <!--This comment will run out to the end of the document
1728 !! html/php
1729
1730 !! html/parsoid
1731 <!--This comment will run out to the end of the document-->
1732 !! end
1733
1734 !! test
1735 Comment semantics: normalize comments to play nice with XML and browsers
1736 !! wikitext
1737 <!-- Browsers --!> think this is closed -->
1738 <!--> This would normally be text -->
1739 <!---> As would this -->
1740 <!-- XML doesn't like trailing dashes -------->
1741 <!-- Nor doubled hyphens -- anywhere in the data -->
1742 But this is not a comment.
1743 !! html/php
1744 <p>But this is not a comment.
1745 </p>
1746 !! html/parsoid
1747 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1748 <!--&#x3E; This would normally be text -->
1749 <!--&#x2D;&#x3E; As would this -->
1750 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1751 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1752 <p>But this is not a comment.</p>
1753 !! end
1754
1755 !! test
1756 Comment semantics: round-trip even text which contains encoded -->
1757 !! wikitext
1758 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1759 !! html/parsoid
1760 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1761 !! end
1762
1763 !! test
1764 Comment in template title
1765 !! wikitext
1766 {{f<!---->oo}}
1767 !! html
1768 <p>FOO
1769 </p>
1770 !! end
1771
1772 !! test
1773 Comment on its own line post-expand
1774 !! wikitext
1775 a
1776 {{blank}}<!---->
1777 b
1778 !! html
1779 <p>a
1780 </p><p>b
1781 </p>
1782 !! end
1783
1784 !! test
1785 Comment on its own line post-expand with non-significant whitespace
1786 !! wikitext
1787 a
1788 {{blank}} <!---->
1789 b
1790 !! html
1791 <p>a
1792 </p><p>b
1793 </p>
1794 !! end
1795
1796 !! test
1797 Multiple comments should still parse as SOL-transparent
1798 !! options
1799 parsoid=wt2html,wt2wt
1800 !! wikitext
1801 <!--c1-->*a
1802 <!--c2--><!--c3--><!--c4-->*b
1803 !! html/php
1804 <ul><li>a</li>
1805 <li>b</li></ul>
1806
1807 !! html/parsoid
1808 <!--c1--><ul>
1809 <li>a
1810 </li>
1811 <!--c2--><!--c3--><!--c4-->
1812 <li>b
1813 </li>
1814 </ul>
1815 !! end
1816
1817 ###
1818 ### paragraph wrapping tests
1819 ###
1820 !! test
1821 No block tags
1822 !! wikitext
1823 a
1824
1825 b
1826 !! html
1827 <p>a
1828 </p><p>b
1829 </p>
1830 !! end
1831
1832 !! test
1833 Block tag on one line (<div>)
1834 !! wikitext
1835 a <div>foo</div>
1836
1837 b
1838 !! html
1839 a <div>foo</div>
1840 <p>b
1841 </p>
1842 !! html+tidy
1843 <p>a</p>
1844 <div>foo</div>
1845 <p>b</p>
1846 !! end
1847
1848 !! test
1849 Block tag on one line (<blockquote>)
1850 !! wikitext
1851 a <blockquote>foo</blockquote>
1852
1853 b
1854 !! html
1855 a <blockquote>foo</blockquote>
1856 <p>b
1857 </p>
1858 !! html+tidy
1859 <p>a</p>
1860 <blockquote>
1861 <p>foo</p>
1862 </blockquote>
1863 <p>b</p>
1864 !! end
1865
1866 !! test
1867 Block tag on both lines (<div>)
1868 !! wikitext
1869 a <div>foo</div>
1870
1871 b <div>foo</div>
1872 !! html
1873 a <div>foo</div>
1874 b <div>foo</div>
1875
1876 !! html+tidy
1877 <p>a</p>
1878 <div>foo</div>
1879 <p>b</p>
1880 <div>foo</div>
1881 !! end
1882
1883 !! test
1884 Block tag on both lines (<blockquote>)
1885 !! wikitext
1886 a <blockquote>foo</blockquote>
1887
1888 b <blockquote>foo</blockquote>
1889 !! html
1890 a <blockquote>foo</blockquote>
1891 b <blockquote>foo</blockquote>
1892
1893 !! html+tidy
1894 <p>a</p>
1895 <blockquote>
1896 <p>foo</p>
1897 </blockquote>
1898 <p>b</p>
1899 <blockquote>
1900 <p>foo</p>
1901 </blockquote>
1902 !! end
1903
1904 !! test
1905 Multiple lines without block tags
1906 !! wikitext
1907 <div>foo</div> a
1908 b
1909 c
1910 d<!--foo--> e
1911 x <div>foo</div> z
1912 !! html
1913 <div>foo</div> a
1914 <p>b
1915 c
1916 d e
1917 </p>
1918 x <div>foo</div> z
1919
1920 !! html+tidy
1921 <div>foo</div>
1922 <p>a</p>
1923 <p>b c d e</p>
1924 <p>x</p>
1925 <div>foo</div>
1926 <p>z</p>
1927 !! end
1928
1929 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1930 # So, we have a separate section for Parsoid. We don't want
1931 # to mimic this stripping behavior in Parsoid. It affects
1932 # editing experience and also requires us to maintain additional
1933 # info for RT-ing.
1934 !! test
1935 Empty lines between lines with block tags
1936 !! wikitext
1937 <div></div>
1938
1939
1940 <div></div>a
1941
1942 b
1943 <div>a</div>b
1944
1945 <div>b</div>d
1946
1947
1948 <div>e</div>
1949 !! html
1950 <div></div>
1951 <p><br />
1952 </p>
1953 <div></div>a
1954 <p>b
1955 </p>
1956 <div>a</div>b
1957 <div>b</div>d
1958 <p><br />
1959 </p>
1960 <div>e</div>
1961
1962 !! html+tidy
1963 <p><br /></p>
1964 <p>a</p>
1965 <p>b</p>
1966 <div>a</div>
1967 <p>b</p>
1968 <div>b</div>
1969 <p>d</p>
1970 <p><br /></p>
1971 <div>e</div>
1972 !! html/parsoid
1973 <div data-parsoid='{"stx":"html"}'></div>
1974
1975 <p><br /></p>
1976 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1977
1978 <p>b</p>
1979 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1980
1981 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1982
1983 <p><br /></p>
1984 <div data-parsoid='{"stx":"html"}'>e</div>
1985 !! end
1986
1987 ## PHP parser emits output which is broken
1988 !! test
1989 Unclosed HTML p-tags should be handled properly
1990 !! wikitext
1991 <div><p>foo</div>
1992 a
1993
1994 b
1995 !! html/php+tidy
1996 <div>
1997 <p>foo</p>
1998 </div>
1999 <p>a</p>
2000 <p>b</p>
2001 !! html/parsoid
2002 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2003 <p>a</p>
2004 <p>b</p>
2005 !! end
2006
2007 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2008 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2009 ## them for now.
2010 !! test
2011 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2012 !! options
2013 parsoid=wt2html
2014 !! wikitext
2015 a [[Category:A1]] [[Category:A2]]
2016 [[Category:A3]]
2017 [[Category:A4]]
2018 !! html/parsoid
2019 <p>a</p>
2020 <link rel="mw:PageProp/Category" href="./Category:A1"/> <link rel="mw:PageProp/Category" href="./Category:A2"/> <link rel="mw:PageProp/Category" href="./Category:A3"/> <link rel="mw:PageProp/Category" href="./Category:A4"/>
2021 !! end
2022
2023 !! test
2024 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2025 !! options
2026 parsoid=wt2html
2027 !! wikitext
2028 [[Category:A1]]a
2029 !! html/parsoid
2030 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2031 !! end
2032
2033 ###
2034 ### Preformatted text
2035 ###
2036 !! test
2037 Preformatted text
2038 !! wikitext
2039 This is some
2040 Preformatted text
2041 With ''italic''
2042 And '''bold'''
2043 And a [[Main Page|link]]
2044 !! html
2045 <pre>This is some
2046 Preformatted text
2047 With <i>italic</i>
2048 And <b>bold</b>
2049 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2050 </pre>
2051 !! end
2052
2053 !! test
2054 Tabs don't trigger preformatted text
2055 !! wikitext
2056 This is not
2057 preformatted text.
2058 This is preformatted text.
2059 So is this.
2060 !! html
2061 <p> This is not
2062 preformatted text.
2063 </p>
2064 <pre>This is preformatted text.
2065 So is this.
2066 </pre>
2067 !! end
2068
2069 !! test
2070 Ident preformatting with inline content
2071 !! wikitext
2072 a
2073 ''b''
2074 !! html
2075 <pre>a
2076 <i>b</i>
2077 </pre>
2078 !! end
2079
2080 !! test
2081 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2082 !! wikitext
2083 <pre><nowiki>
2084 <b>
2085 <cite>
2086 <em>
2087 </nowiki></pre>
2088 !! html
2089 <pre>
2090 &lt;b&gt;
2091 &lt;cite&gt;
2092 &lt;em&gt;
2093 </pre>
2094
2095 !! end
2096
2097 !! test
2098 Regression with preformatted in <center>
2099 !! wikitext
2100 <center>
2101 Blah
2102 </center>
2103 !! html
2104 <center>
2105 <pre>Blah
2106 </pre>
2107 </center>
2108
2109 !! end
2110
2111 !! test
2112 Bug 52763: Preformatted in <blockquote>
2113 !! wikitext
2114 <blockquote>
2115 Blah
2116 {|
2117 |
2118 indented cell (no pre-wrapping!)
2119 |}
2120 </blockquote>
2121 !! html
2122 <blockquote>
2123 <p> Blah
2124 </p>
2125 <table>
2126 <tr>
2127 <td>
2128 <p> indented cell (no pre-wrapping!)
2129 </p>
2130 </td></tr></table>
2131 </blockquote>
2132
2133 !! end
2134
2135 !! test
2136 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2137 !! wikitext
2138 <blockquote>
2139 Foo
2140
2141 Bar
2142 </blockquote>
2143 !! html
2144 <blockquote>
2145 <p>Foo
2146 </p><p>Bar
2147 </p>
2148 </blockquote>
2149
2150 !! end
2151
2152 !! test
2153 Bug 15491: <ins>/<del> in blockquote
2154 !! wikitext
2155 <blockquote>
2156 Foo <del>bar</del> <ins>baz</ins> quux
2157 </blockquote>
2158 !! html
2159 <blockquote>
2160 <p>Foo <del>bar</del> <ins>baz</ins> quux
2161 </p>
2162 </blockquote>
2163
2164 !! end
2165
2166 # Note that the p-wrapping is newline sensitive, which could be
2167 # considered a bug: tidy will wrap only the 'Foo' in the example
2168 # below in a <p> tag. (see comment 23-25 of bug #6200)
2169 !! test
2170 Bug 15491: <ins>/<del> in blockquote (2)
2171 !! wikitext
2172 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2173 </blockquote>
2174 !! html
2175 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2176 </blockquote>
2177
2178 !! html+tidy
2179 <blockquote>
2180 <p>Foo</p>
2181 <del>bar</del> <ins>baz</ins> quux</blockquote>
2182 !! end
2183
2184 !! test
2185 <pre> with attributes (bug 3202)
2186 !! wikitext
2187 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2188 !! html
2189 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2190
2191 !! end
2192
2193 !! test
2194 <pre> with width attribute (bug 3202)
2195 !! wikitext
2196 <pre width="8">Narrow screen goodies</pre>
2197 !! html
2198 <pre width="8">Narrow screen goodies</pre>
2199
2200 !! end
2201
2202 !! test
2203 <pre> with forbidden attribute (bug 3202)
2204 !! wikitext
2205 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2206 !! html
2207 <pre width="8">Narrow screen goodies</pre>
2208
2209 !! end
2210
2211 !! test
2212 Entities inside <pre>
2213 !! wikitext
2214 <pre>&lt;</pre>
2215 !! html
2216 <pre>&lt;</pre>
2217
2218 !! end
2219
2220 !! test
2221 <pre> with forbidden attribute values (bug 3202)
2222 !! wikitext
2223 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2224 !! html
2225 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2226
2227 !! end
2228
2229 !! test
2230 <nowiki> inside <pre> (bug 13238)
2231 !! wikitext
2232 <pre>
2233 <nowiki>
2234 </pre>
2235 <pre>
2236 <nowiki></nowiki>
2237 </pre>
2238 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2239 !! html
2240 <pre>
2241 &lt;nowiki&gt;
2242 </pre>
2243 <pre>
2244
2245 </pre>
2246 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2247
2248 !! end
2249
2250 !! test
2251 <nowiki> and <pre> preference (first one wins)
2252 !! wikitext
2253 <pre>
2254 <nowiki>
2255 </pre>
2256 </nowiki>
2257 </pre>
2258
2259 <nowiki>
2260 <pre>
2261 <nowiki>
2262 </pre>
2263 </nowiki>
2264 </pre>
2265
2266 !! html/php
2267 <pre>
2268 &lt;nowiki&gt;
2269 </pre>
2270 <p>&lt;/nowiki&gt;
2271 &lt;/pre&gt;
2272 </p><p>
2273 &lt;pre&gt;
2274 &lt;nowiki&gt;
2275 &lt;/pre&gt;
2276
2277 &lt;/pre&gt;
2278 </p>
2279 !! html/parsoid
2280 <pre data-parsoid='{"stx":"html","strippedNL":true}'>&lt;nowiki>
2281 </pre>
2282 <p><span typeof="mw:Placeholder" data-parsoid='{"src":"&lt;/nowiki>"}'>&lt;/nowiki></span>
2283 &lt;/pre></p>
2284
2285 <p><span typeof="mw:Nowiki">
2286 &lt;pre>
2287 &lt;nowiki>
2288 &lt;/pre>
2289 </span>
2290 &lt;/pre></p>
2291 !! end
2292
2293 !! test
2294 </pre> inside nowiki
2295 !! wikitext
2296 <nowiki></pre></nowiki>
2297 !! html
2298 <p>&lt;/pre&gt;
2299 </p>
2300 !! end
2301
2302 # Parsoid doesn't strip empty tags, like Tidy does.
2303 !! test
2304 Empty pre; pre inside other HTML tags (bug 54946)
2305 !! options
2306 parsoid=wt2html,wt2wt
2307 !! wikitext
2308 a
2309
2310 <div><pre>
2311 foo
2312 </pre></div>
2313 <pre></pre>
2314 !! html/php
2315 <p>a
2316 </p>
2317 <div><pre>
2318 foo
2319 </pre></div>
2320 <pre></pre>
2321
2322 !! html/php+tidy
2323 <p>a</p>
2324 <div>
2325 <pre>
2326 foo
2327 </pre></div>
2328 !! html/parsoid
2329 <p>a</p>
2330
2331 <div><pre>foo
2332 </pre></div>
2333 <pre></pre>
2334 !! end
2335
2336 !! test
2337 HTML pre followed by indent-pre
2338 !! wikitext
2339 <pre>foo</pre>
2340 bar
2341 !! html
2342 <pre>foo</pre>
2343 <pre>bar
2344 </pre>
2345 !! end
2346
2347 # Note that tidy removes the empty <p> tags from the start and end.
2348 # Parsoid does not, by design.
2349 !!test
2350 Block tag pre
2351 !! wikitext
2352 <p><pre>foo</pre></p>
2353 !! html/php+tidy
2354 <pre>
2355 foo
2356 </pre>
2357 !! html/parsoid
2358 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2359 !!end
2360
2361 !!test
2362 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2363 !! wikitext
2364 {{echo|}}
2365 !! html
2366
2367 !!end
2368
2369 !!test
2370 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2371 !! wikitext
2372 {{echo|
2373 foo}}
2374 !! html
2375 <p>foo
2376 </p>
2377 !!end
2378
2379 !! test
2380 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2381 !! wikitext
2382 {{echo|a
2383 b}}
2384 !! html
2385 <pre>a
2386 </pre>
2387 <p>b
2388 </p>
2389 !!end
2390
2391 !! test
2392 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2393 !! wikitext
2394 {{echo|a
2395 b
2396 c
2397 d
2398 e
2399 }}
2400 !! html
2401 <pre>a
2402 </pre>
2403 <p>b
2404 c
2405 </p>
2406 <pre>d
2407 </pre>
2408 <p>e
2409 </p>
2410 !!end
2411
2412 !!test
2413 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2414 !! wikitext
2415 {{echo| foo}}
2416
2417 {{echo| foo}}{{echo| bar}}
2418
2419 {{echo| foo}}
2420 {{echo| bar}}
2421
2422 {{echo|<!--cmt--> foo}}
2423
2424 <!--cmt-->{{echo| foo}}
2425
2426 {{echo|{{echo| }}bar}}
2427 !! html
2428 <pre>foo
2429 </pre>
2430 <pre>foo bar
2431 </pre>
2432 <pre>foo
2433 bar
2434 </pre>
2435 <pre>foo
2436 </pre>
2437 <pre>foo
2438 </pre>
2439 <pre>bar
2440 </pre>
2441 !!end
2442
2443 !! test
2444 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2445 !! wikitext
2446 {{echo| }}a
2447
2448 {{echo|
2449 }}a
2450
2451 {{echo|
2452 b}}
2453
2454 {{echo|a
2455 }}b
2456
2457 {{echo|a
2458 }} b
2459 !! html
2460 <pre>a
2461 </pre>
2462 <p><br />
2463 </p>
2464 <pre>a
2465 </pre>
2466 <p><br />
2467 </p>
2468 <pre>b
2469 </pre>
2470 <p>a
2471 </p>
2472 <pre>b
2473 </pre>
2474 <p>a
2475 </p>
2476 <pre>b
2477 </pre>
2478 !!end
2479
2480 !! test
2481 Pres with newline attributes
2482 !! wikitext
2483 <pre class="one
2484 two">hi</pre>
2485 !! html/php
2486 <pre class="one two">hi</pre>
2487
2488 !! html/parsoid
2489 <pre class="one
2490 two" data-parsoid='{"stx":"html"}'>hi</pre>
2491 !! end
2492
2493 !! test
2494 Things that look like <pre> tags aren't treated as such
2495 !! wikitext
2496 Barack Obama <President> of the United States
2497 <President></President>
2498 !! html
2499 <p>Barack Obama &lt;President&gt; of the United States
2500 &lt;President&gt;&lt;/President&gt;
2501 </p>
2502 !! end
2503
2504 ## PHP parser discards the "<pre " string
2505 !! test
2506 Handle broken pre-like tags (bug 64025)
2507 !! options
2508 parsoid=wt2html
2509 !! wikitext
2510 {{echo|<pre <pre>x</pre>}}
2511
2512 <table><pre </table>
2513 !! html/php
2514 <pre>x</pre>
2515 <table><pre></pre></table>
2516
2517 !! html/parsoid
2518 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"a":{"&lt;pre":null},"sa":{"&lt;pre":""},"stx":"html","pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
2519
2520
2521 <p>&lt;pre </p>
2522
2523 <table></table>
2524 !! end
2525
2526 !! test
2527 Parsoid: handle pre with space after attribute
2528 !! options
2529 parsoid=wt2html
2530 !! wikitext
2531 <pre style="width:50%;" >{{echo|foo}}</pre>
2532 !! html/php
2533 <pre style="width:50%;">{{echo|foo}}</pre>
2534
2535 !! html/parsoid
2536 <pre style="width:50%;">{{echo|foo}}</pre>
2537 !! end
2538
2539 # TODO / maybe: fix wt2wt for this
2540 !! test
2541 Parsoid: Don't paragraph-wrap fosterable content
2542 !! options
2543 parsoid=wt2html
2544 !! wikitext
2545 {|
2546 <td></td>
2547 <td></td>
2548
2549
2550
2551 |}
2552 !! html
2553 <table>
2554
2555 <tbody>
2556 <tr>
2557 <td></td>
2558
2559 <td></td></tr>
2560
2561
2562
2563 </tbody></table>
2564 !! end
2565
2566 !! test
2567 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2568 !! options
2569 parsoid=wt2html
2570 !! wikitext
2571 {|
2572 <td>
2573 <td>
2574 </td>
2575
2576
2577
2578 |}
2579 !! html
2580 <table>
2581
2582 <tbody>
2583 <tr>
2584 <td></td>
2585
2586 <td>
2587 </td></tr>
2588
2589
2590
2591 </tbody></table>
2592 !! end
2593
2594
2595 #--------------------------------------------------------------------
2596 # Transclusion parameter whitespace stripping tests
2597 # Behavior is different for positional and named parameters
2598 #--------------------------------------------------------------------
2599 !! test
2600 Templates: Strip leading and trailing whitespace from named-param values
2601 !! wikitext
2602 {{echo|1= a }}
2603
2604 {{echo|1= {{echo|b}} }}
2605
2606 {{echo| 1 =
2607 c }}
2608
2609 {{echo| 1 =
2610 * d
2611 }}
2612 !! html
2613 <p>a
2614 </p><p>b
2615 </p><p>c
2616 </p>
2617 <ul><li> d</li></ul>
2618
2619 !! end
2620
2621 !! test
2622 Templates: Don't strip whitespace from positional-param values
2623 !! wikitext
2624 {{echo|a }}
2625
2626 {{echo|{{echo|b}} }}
2627
2628 {{echo| c
2629 }}
2630
2631 {{echo| {{echo|d}}
2632 }}
2633
2634 {{echo|
2635 e}}
2636
2637 {{echo|
2638 * f}}
2639
2640 {{echo|
2641 }}g
2642 !! html
2643 <p>a
2644 </p><p>b
2645 </p>
2646 <pre>c
2647 </pre>
2648 <p><br />
2649 </p>
2650 <pre>d
2651 </pre>
2652 <p><br />
2653 </p>
2654 <pre>e
2655 </pre>
2656 <p><br />
2657 </p>
2658 <ul><li> f</li></ul>
2659 <p><br />
2660 </p>
2661 <pre>g
2662 </pre>
2663 !! end
2664
2665 !! test
2666 Templates: Handle empty comment-and-ws-only lines correctly
2667 !! wikitext
2668 {{echo|foo
2669 <!--should be ignored-->
2670 <!--should be ignored as well-->
2671 bar}}
2672 !! html
2673 <p>foo
2674 bar
2675 </p>
2676 !! end
2677
2678 !! test
2679 Templates: Handle comments in the target
2680 !! wikitext
2681 {{echo
2682 <!-- should be ignored -->
2683 |foo}}
2684
2685 {{echo<!-- should be ignored -->
2686 |foo}}
2687
2688 {{echo<!-- should be ignored -->|foo}}
2689
2690 {{<!-- should be ignored -->echo|foo}}
2691 !!html/parsoid
2692 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2693
2694 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2695
2696 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2697
2698 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2699 !!end
2700
2701 !! test
2702 Templates: Handle comments in parameter names (bug 67657)
2703 !! wikitext
2704 {{echo|1
2705 <!-- should be ignored -->
2706 =foo}}
2707
2708 {{echo|
2709 <!-- should be ignored -->
2710 1 = foo}}
2711
2712 {{echo|1<!-- should be ignored --> = foo}}
2713
2714 {{echo|<!-- should be ignored -->1 = foo}}
2715 !!html/parsoid
2716 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1\n&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2717
2718 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->\n1"}}},"i":0}}]}'>foo</p>
2719
2720 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2721
2722 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->1"}}},"i":0}}]}'>foo</p>
2723 !!end
2724
2725 !! test
2726 Templates: Other wikitext in parameter names (bug 67657)
2727 !! wikitext
2728 {{echo|''1''=foo}}
2729 !!html/parsoid
2730 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"&#39;&#39;1&#39;&#39;":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2731 !!html/php
2732 <p>{{{1}}}
2733 </p>
2734 !!end
2735
2736 #--------------------------------------------------------------------
2737 # Transclusion parameter escaping tests
2738 #--------------------------------------------------------------------
2739 !! test
2740 Templates: Parsoid parameter escaping test 1
2741 !! wikitext
2742 {{echo|[foo]|{{echo|[bar]}}}}
2743 !! html/php+tidy
2744 <p>[foo]</p>
2745 !! html/parsoid
2746 <p about="#mwt1" typeof="mw:Transclusion"
2747 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2748 !! end
2749
2750 !! test
2751 Parsoid: Pipes in external links in template parameter
2752 !! wikitext
2753 {{echo|[{{echo|http://example.com}} link]}}
2754 !! html/php+tidy
2755 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2756 !! html/parsoid
2757 <p><a rel="mw:ExtLink" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{echo|http://example.com}} link]"}},"i":0}}]}'>link</a></p>
2758 !! end
2759
2760 !! test
2761 Parsoid: pipe in transclusion parameter
2762 !! wikitext
2763 {{echo|http://foo.com/a&#124;b}}
2764 !! html/php+tidy
2765 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2766 !! html/parsoid
2767 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2768 typeof="mw:Transclusion"
2769 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a|b</a></p>
2770 !! end
2771
2772 !! test
2773 Parsoid: Pipe in external link target and content in template parameter
2774 !! options
2775 parsoid=html2wt,wt2wt
2776 !! wikitext
2777 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2778 !! html/php+tidy
2779 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2780 !! html/parsoid
2781 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2782 typeof="mw:Transclusion"
2783 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2784 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2785 !! end
2786
2787 !! test
2788 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2789 !! options
2790 parsoid
2791 !! wikitext
2792 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2793 !! html
2794 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]"}},"i":0}}]}'>[Main Page bar]</p>
2795 !! end
2796
2797 !! test
2798 Templates: Don't escape already nowiki-escaped text in template parameters
2799 !! options
2800 parsoid=html2wt,wt2wt
2801 !! wikitext
2802 {{echo|foo<nowiki>|</nowiki>bar}}
2803 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2804 {{echo|<nowiki></nowiki>}}
2805 !! html/php+tidy
2806 <p>foo|bar &lt;div&gt;</p>
2807 !! html/parsoid
2808 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}}]}'}'>foo</span><span typeof="mw:Nowiki" about="#mwt1">|</span><span about="#mwt1">bar</span>
2809 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki>&amp;lt;div&amp;gt;</nowiki>"}},"i":0}}]}'><span typeof="mw:Entity">&lt;</span>div<span typeof="mw:Entity">&gt;</span></span>
2810 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}}]}'></span>
2811 </p>
2812 !! end
2813
2814 ## Bug 52824
2815 !! test
2816 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2817 !! options
2818 parsoid=html2wt,wt2wt
2819 !! wikitext
2820 {{echo|{{echo|1=bar}}}}
2821 !! html/php+tidy
2822 <p>bar</p>
2823 !! html/parsoid
2824 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{echo|1=bar}}"}},"i":0}}]}'>bar</p>
2825 !! end
2826
2827 ## Bug 56733
2828 !! test
2829 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2830 !! wikitext
2831 {{echo|a : b}}
2832 !! html/php+tidy
2833 <p>a&#160;: b</p>
2834 !! html/parsoid
2835 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a : b"}},"i":0}}]}'>a<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"isDisplayHack":true}'> </span>: b</p>
2836 !! end
2837
2838 ## Bug T73412
2839 !! test
2840 Templates: Preserve blank parameter names
2841 !! wikitext
2842 {{echo|=foo}}
2843 !! html/php+tidy
2844 <p>{{{1}}}</p>
2845 !! html/parsoid
2846 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2847 !! end
2848
2849 !! test
2850 Templates: Preserve blank parameter names in other positions
2851 !! wikitext
2852 {{blank_param|bar|=foo}}
2853 !! html/php+tidy
2854 <p>bar foo</p>
2855 !! html/parsoid
2856 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]},{"k":"","named":true,"spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"blank_param","href":"./Template:Blank_param"},"params":{"1":{"wt":"bar"},"":{"wt":"foo"}},"i":0}}]}'>bar
2857 foo</p>
2858 !! end
2859
2860 ###
2861 ### Parsoid-centric tests for testing RT edge cases for pre
2862 ###
2863
2864 !!test
2865 1a. Indent-Pre and Comments
2866 !! wikitext
2867 a
2868 <!--a-->
2869 c
2870 !! html
2871 <pre>a
2872 </pre>
2873 <p>c
2874 </p>
2875 !!end
2876
2877 !!test
2878 1b. Indent-Pre and Comments
2879 !! wikitext
2880 a
2881 <!--a-->
2882 c
2883 !! html
2884 <pre>a
2885 </pre>
2886 <p>c
2887 </p>
2888 !!end
2889
2890 !!test
2891 1c. Indent-Pre and Comments
2892 !! wikitext
2893 <!--a--> a
2894
2895 <!--a--> a
2896 !! html
2897 <pre> a
2898 </pre>
2899 <pre> a
2900 </pre>
2901 !!end
2902
2903 !!test
2904 1d. Indent-Pre and Comments
2905 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2906 !! wikitext
2907 <!--a--> a
2908
2909 <!--b-->b
2910 !! html
2911 <pre>a
2912 </pre>
2913 <pre>b
2914 </pre>
2915 !!end
2916
2917 !!test
2918 2a. Indent-Pre and tables
2919 !! wikitext
2920 {|
2921 |-
2922 !h1!!h2
2923 |foo||bar
2924 |}
2925 !! html
2926 <table>
2927
2928 <tr>
2929 <th>h1</th>
2930 <th>h2
2931 </th>
2932 <td>foo</td>
2933 <td>bar
2934 </td></tr></table>
2935
2936 !!end
2937
2938 !!test
2939 2b. Indent-Pre and tables
2940 !! wikitext
2941 {|
2942 |-
2943 |foo
2944 |}
2945 !! html
2946 <table>
2947
2948 <tr>
2949 <td>foo
2950 </td></tr></table>
2951
2952 !!end
2953
2954 !!test
2955 2c. Indent-Pre and tables (bug 42252)
2956 !! wikitext
2957 {|
2958 |+ foo
2959 ! | bar
2960 |}
2961 !! html
2962 <table>
2963 <caption> foo
2964 </caption>
2965 <tr>
2966 <th> bar
2967 </th></tr></table>
2968
2969 !!end
2970
2971 !!test
2972 2d. Indent-Pre and tables
2973 !! wikitext
2974 a
2975 {|
2976 | b
2977 |}
2978 !! html/php
2979 <pre>a
2980 </pre>
2981 <table>
2982 <tr>
2983 <td> b
2984 </td></tr></table>
2985
2986 !! html/parsoid
2987 <pre>a</pre>
2988 <table>
2989 <tbody><tr><td> b</td></tr>
2990 </tbody></table>
2991 !!end
2992
2993 !!test
2994 2e. Indent-Pre and table-line syntax
2995 !! wikitext
2996 a
2997 | b
2998 | c
2999 !! html/php
3000 <pre>a
3001 | b
3002 | c
3003 </pre>
3004 !!end
3005
3006 !!test
3007 2f. Indent-pre started by table-line syntax
3008 !! wikitext
3009 a
3010 | b
3011 | c
3012 !! html/php
3013 <p>a
3014 </p>
3015 <pre>| b
3016 | c
3017 </pre>
3018 !! html/parsoid
3019 <p>a</p>
3020 <pre>
3021 | b
3022 | c</pre>
3023 !!end
3024
3025 !!test
3026 3a. Indent-Pre and block tags (single-line html)
3027 !! wikitext
3028 a <p> foo </p>
3029 b <div> foo </div>
3030 c <blockquote> foo </blockquote>
3031 <span> foo </span>
3032 !! html
3033 a <p> foo </p>
3034 b <div> foo </div>
3035 c <blockquote> foo </blockquote>
3036 <pre><span> foo </span>
3037 </pre>
3038 !! html/parsoid
3039 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3040 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3041 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3042 <pre><span> foo </span>
3043 </pre>
3044 !! html+tidy
3045 <p>a</p>
3046 <p>foo</p>
3047 <p>b</p>
3048 <div>foo</div>
3049 <p>c</p>
3050 <blockquote>
3051 <p>foo</p>
3052 </blockquote>
3053 <pre>
3054 <span> foo </span>
3055 </pre>
3056 !! end
3057
3058 !!test
3059 3b. Indent-Pre and block tags (multi-line html)
3060 !! wikitext
3061 a <span>foo</span>
3062 b <div> foo </div>
3063 !! html
3064 <pre>a <span>foo</span>
3065 </pre>
3066 b <div> foo </div>
3067
3068 !! html/parsoid
3069 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3070 b <div data-parsoid='{"stx":"html"}'> foo </div>
3071 !! html+tidy
3072 <pre>
3073 a <span>foo</span>
3074 </pre>
3075 <p>b</p>
3076 <div>foo</div>
3077 !!end
3078
3079 !!test
3080 3c. Indent-Pre and block tags (pre-content on separate line)
3081 !! wikitext
3082 <p>
3083 foo
3084 </p>
3085
3086 <div>
3087 foo
3088 </div>
3089
3090 <center>
3091 foo
3092 </center>
3093
3094 <blockquote>
3095 foo
3096 </blockquote>
3097
3098 <blockquote>
3099 <pre>
3100 foo
3101 </pre>
3102 </blockquote>
3103
3104 <table><tr><td>
3105 foo
3106 </td></tr></table>
3107
3108 <ul><li>
3109 foo
3110 </li></ul>
3111
3112 !! html
3113 <p>
3114 foo
3115 </p>
3116 <div>
3117 <pre>foo
3118 </pre>
3119 </div>
3120 <center>
3121 <pre>foo
3122 </pre>
3123 </center>
3124 <blockquote>
3125 <p> foo
3126 </p>
3127 </blockquote>
3128 <blockquote>
3129 <pre>
3130 foo
3131 </pre>
3132 </blockquote>
3133 <table><tr><td>
3134 <pre>foo
3135 </pre>
3136 </td></tr></table>
3137 <ul><li>
3138 foo
3139 </li></ul>
3140
3141 !!end
3142
3143 !!test
3144 4. Indent-Pre and extension tags
3145 !! wikitext
3146 a <gallery>
3147 File:foobar.jpg
3148 </gallery>
3149 !! html
3150 a <ul class="gallery mw-gallery-traditional">
3151 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
3152 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
3153 <div class="gallerytext">
3154 </div>
3155 </div></li>
3156 </ul>
3157
3158 !! html+tidy
3159 <p>a</p>
3160 <ul class="gallery mw-gallery-traditional">
3161 <li class="gallerybox" style="width: 155px">
3162 <div style="width: 155px">
3163 <div class="thumb" style="width: 150px;">
3164 <div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div>
3165 </div>
3166 <div class="gallerytext"></div>
3167 </div>
3168 </li>
3169 </ul>
3170 !!end
3171
3172 !! test
3173 Table wikitext syntax outside wiki-tables
3174 !! wikitext
3175 a
3176 ! not a table heading
3177 |- not a table row
3178 | not a table cell
3179 | class="foo bar" | baz
3180 b
3181 |}
3182 |-
3183 c
3184 !! html
3185 <p>a
3186 ! not a table heading
3187 |- not a table row
3188 | not a table cell
3189 | class="foo bar" | baz
3190 b
3191 |}
3192 |-
3193 c
3194 </p>
3195 !! end
3196
3197 !!test
3198 Render paragraphs when indent-pre is suppressed in blocklevels
3199 !! wikitext
3200 <blockquote>
3201 foo
3202
3203 bar
3204 </blockquote>
3205 !! html
3206 <blockquote>
3207 <p> foo
3208 </p><p> bar
3209 </p>
3210 </blockquote>
3211
3212 !!end
3213
3214 !!test
3215 4. Multiple spaces at start-of-line
3216 !! wikitext
3217 <p> foo </p>
3218 foo
3219 {|
3220 |foo
3221 |}
3222 !! html
3223 <p> foo </p>
3224 <pre> foo
3225 </pre>
3226 <table>
3227 <tr>
3228 <td>foo
3229 </td></tr></table>
3230
3231 !!end
3232
3233 ## NOTE: the leading white-space chars on empty line are significant
3234 !! test
3235 5a. White-space in indent-pre
3236 !! wikitext
3237 a<br />
3238
3239 b
3240 !! html
3241 <pre>a<br />
3242
3243 b
3244 </pre>
3245 !! end
3246
3247 ## NOTE: the leading white-space chars on empty line are significant
3248 !! test
3249 5b. White-space in indent-pre
3250 !! wikitext
3251 a
3252
3253 b
3254
3255
3256 c
3257 !! html
3258 <pre>a
3259
3260 b
3261
3262
3263 c
3264 </pre>
3265 !! end
3266
3267 !! test
3268 5c. White-space in indent-pre
3269 !! wikitext
3270 ''a''
3271 ''b''
3272 ''c''
3273 !! html
3274 <pre><i>a</i>
3275 <i>b</i>
3276 <i>c</i>
3277 </pre>
3278 !! end
3279
3280 !! test
3281 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3282 !! wikitext
3283 a
3284
3285 <!-- continue -->
3286 b
3287
3288 c
3289
3290 d
3291 !! html
3292 <pre>a
3293
3294 b
3295 </pre>
3296 <pre>c
3297
3298 </pre>
3299 <p>d
3300 </p>
3301 !! end
3302
3303 !! test
3304 7a. Indent-pre and category links
3305 !! options
3306 parsoid=wt2html,wt2wt
3307 !! wikitext
3308 [[Category:foo]] <!-- No pre-wrapping -->
3309 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3310 !! html/php+tidy
3311 !! html/parsoid
3312 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3313 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre&#x2D;wrapping -->
3314 !! end
3315
3316 !! test
3317 7b. Indent-pre and category links
3318 !! options
3319 parsoid=wt2html,wt2wt
3320 !! wikitext
3321 [[Category:foo]] a
3322 [[Category:foo]] {{echo|b}}
3323 !! html
3324 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3325 <link rel="mw:PageProp/Category" href="./Category:Foo"> <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b"}},"i":0}}]}'>b</span></pre>
3326 !! end
3327
3328 !! test
3329 Indent-Pre: Newlines in comments shouldn't affect sol state
3330 !! wikitext
3331 a <!--
3332 foo
3333 --> b
3334 !! html/php+tidy
3335 <p>a b</p>
3336 !! html/parsoid
3337 <p>a <!--
3338 foo
3339 --> b</p>
3340 !! end
3341
3342 ###
3343 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3344 ###
3345
3346 !!test
3347 HTML-pre: 1. embedded newlines
3348 !! wikitext
3349 <pre>foo</pre>
3350
3351 <pre>
3352 foo
3353 </pre>
3354
3355 <pre>
3356
3357 foo
3358 </pre>
3359
3360 <pre>
3361
3362
3363 foo
3364 </pre>
3365 !! html/php+tidy
3366 <pre>
3367 foo
3368 </pre>
3369 <pre>
3370 foo
3371 </pre>
3372 <pre>
3373
3374 foo
3375 </pre>
3376 <pre>
3377
3378
3379 foo
3380 </pre>
3381 !! html/parsoid
3382 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3383
3384 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3385 foo
3386 </pre>
3387
3388 <pre data-parsoid='{"stx":"html"}'>
3389
3390 foo
3391 </pre>
3392
3393 <pre data-parsoid='{"stx":"html"}'>
3394
3395
3396 foo
3397 </pre>
3398 !!end
3399
3400 !! test
3401 HTML-pre: big spaces
3402 !! wikitext
3403 <pre>
3404
3405
3406
3407
3408 haha
3409
3410
3411
3412
3413 haha
3414
3415
3416
3417
3418 </pre>
3419 !! html/php+tidy
3420 <pre>
3421
3422
3423
3424
3425 haha
3426
3427
3428
3429
3430 haha
3431
3432
3433
3434
3435 </pre>
3436 !! html/parsoid
3437 <pre data-parsoid='{"stx":"html"}'>
3438
3439
3440
3441
3442 haha
3443
3444
3445
3446
3447 haha
3448
3449
3450
3451
3452 </pre>
3453 !! end
3454
3455 !!test
3456 HTML-pre: 2: indented text
3457 !! wikitext
3458 <pre>
3459 foo
3460 </pre>
3461 !! html
3462 <pre>
3463 foo
3464 </pre>
3465
3466 !!end
3467
3468 !!test
3469 HTML-pre: 3: other wikitext
3470 !! wikitext
3471 <pre>
3472 * foo
3473 # bar
3474 = no-h =
3475 '' no-italic ''
3476 [[ NoLink ]]
3477 </pre>
3478 !! html/php
3479 <pre>
3480 * foo
3481 # bar
3482 = no-h =
3483 '' no-italic ''
3484 [[ NoLink ]]
3485 </pre>
3486
3487 !! html/parsoid
3488 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3489 # bar
3490 = no-h =
3491 '' no-italic ''
3492 [[ NoLink ]]
3493 </pre>
3494 !!end
3495
3496 ###
3497 ### Definition lists
3498 ###
3499 !! test
3500 Simple definition
3501 !! wikitext
3502 ; name : Definition
3503 !! html
3504 <dl><dt> name&#160;</dt>
3505 <dd> Definition</dd></dl>
3506
3507 !! end
3508
3509 !! test
3510 Definition list for indentation only
3511 !! wikitext
3512 : Indented text
3513 !! html
3514 <dl><dd> Indented text</dd></dl>
3515
3516 !! end
3517
3518 !! test
3519 Definition list with no space
3520 !! wikitext
3521 ;name:Definition
3522 !! html
3523 <dl><dt>name</dt>
3524 <dd>Definition</dd></dl>
3525
3526 !!end
3527
3528 !! test
3529 Definition list with URL link
3530 !! wikitext
3531 ; http://example.com/ : definition
3532 !! html
3533 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3534 <dd> definition</dd></dl>
3535
3536 !! end
3537
3538 !! test
3539 Definition list with bracketed URL link
3540 !! wikitext
3541 ;[http://www.example.com/ Example]:Something about it
3542 !! html
3543 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3544 <dd>Something about it</dd></dl>
3545
3546 !! end
3547
3548 !! test
3549 Definition list with wikilink containing colon
3550 !! wikitext
3551 ; [[Help:FAQ]]: The least-read page on Wikipedia
3552 !! html
3553 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt>
3554 <dd> The least-read page on Wikipedia</dd></dl>
3555
3556 !! end
3557
3558 # At Brion's and JeLuF's insistence... :)
3559 !! test
3560 Definition list with news link containing colon
3561 !! wikitext
3562 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3563 !! html/php
3564 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3565 <dd> This isn't even a real newsgroup!</dd></dl>
3566
3567 !! html/parsoid
3568 <dl><dt> <a rel="mw:ExtLink" href="news:alt.wikipedia.rox" data-parsoid='{"stx":"url"}'>news:alt.wikipedia.rox</a></dt><dd data-parsoid='{"stx":"row"}'> This isn't even a real newsgroup!</dd></dl>
3569 !! end
3570
3571 !! test
3572 Malformed definition list with colon
3573 !! wikitext
3574 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3575 !! html
3576 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop</dt></dl>
3577
3578 !! end
3579
3580 !! test
3581 Definition lists: colon in external link text
3582 !! wikitext
3583 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3584 !! html
3585 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3586 <dd> OK, I made that up</dd></dl>
3587
3588 !! end
3589
3590 !! test
3591 Definition lists: colon in HTML attribute
3592 !! wikitext
3593 ;<b style="display: inline">bold</b>
3594 !! html
3595 <dl><dt><b style="display: inline">bold</b></dt></dl>
3596
3597 !! end
3598
3599 !! test
3600 Definition lists: self-closed tag
3601 !! wikitext
3602 ;one<br/>two : two-line fun
3603 !! html
3604 <dl><dt>one<br />two&#160;</dt>
3605 <dd> two-line fun</dd></dl>
3606
3607 !! end
3608
3609 !! test
3610 Bug 11748: Literal closing tags
3611 !! wikitext
3612 <dl>
3613 <dt>test 1</dt>
3614 <dd>test test test test test</dd>
3615 <dt>test 2</dt>
3616 <dd>test test test test test</dd>
3617 </dl>
3618 !! html
3619 <dl>
3620 <dt>test 1</dt>
3621 <dd>test test test test test</dd>
3622 <dt>test 2</dt>
3623 <dd>test test test test test</dd>
3624 </dl>
3625
3626 !! end
3627
3628 !! test
3629 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3630 !! wikitext
3631 <ul><li>
3632 ; term : description
3633 * unordered
3634 </li></ul>
3635 !! html
3636 <ul><li>
3637 <dl><dt> term&#160;</dt>
3638 <dd> description</dd></dl>
3639 <ul><li> unordered</li></ul>
3640 </li></ul>
3641
3642 !! end
3643
3644 !! test
3645
3646 Definition list with empty definition and following paragraph
3647 !! wikitext
3648 ; term:
3649 Paragraph text
3650 !! html
3651 <dl><dt> term</dt>
3652 <dd></dd></dl>
3653 <p>Paragraph text
3654 </p>
3655 !! end
3656
3657 !! test
3658 Nested definition lists using html syntax
3659 !! wikitext
3660 <dl><dt>x</dt>
3661 <dd>a</dd>
3662 <dd>b</dd></dl>
3663
3664 !! end
3665
3666 !! test
3667 Definition Lists: No nesting: Multiple dd's
3668 !! wikitext
3669 ;x
3670 :a
3671 :b
3672 !! html
3673 <dl><dt>x</dt>
3674 <dd>a</dd>
3675 <dd>b</dd></dl>
3676
3677 !! end
3678
3679 !! test
3680 Definition Lists: Indentation: Regular
3681 !! wikitext
3682 :i1
3683 ::i2
3684 :::i3
3685 !! html
3686 <dl><dd>i1
3687 <dl><dd>i2
3688 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3689
3690 !! end
3691
3692 !! test
3693 Definition Lists: Indentation: Missing 1st level
3694 !! wikitext
3695 ::i2
3696 :::i3
3697 !! html
3698 <dl><dd><dl><dd>i2
3699 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3700
3701 !! end
3702
3703 !! test
3704 Definition Lists: Indentation: Multi-level indent
3705 !! wikitext
3706 :::i3
3707 !! html
3708 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3709
3710 !! end
3711
3712 !! test
3713 Definition Lists: Hacky use to indent tables
3714 !! wikitext
3715 ::{|
3716 |foo
3717 |bar
3718 |}
3719 this text
3720 should be left alone
3721 !! html
3722 <dl><dd><dl><dd><table>
3723 <tr>
3724 <td>foo
3725 </td>
3726 <td>bar
3727 </td></tr></table></dd></dl></dd></dl>
3728 <p>this text
3729 should be left alone
3730 </p>
3731 !! end
3732
3733 !! test
3734 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3735 !! wikitext
3736 <!-- foo -->
3737 ::{|
3738 |foo
3739 |bar
3740 |}<!-- bar -->
3741 this text
3742 should be left alone
3743 !! html/parsoid
3744 <!-- foo -->
3745 <dl><dd><dl><dd><table><tr>
3746 <td>foo</td>
3747 <td>bar</td>
3748 </tr></table><!-- bar --></dd></dl></dd></dl>
3749 <p>this text
3750 should be left alone</p>
3751 !! end
3752
3753 !! test
3754 Definition Lists: Hacky use to indent tables, with comment before table
3755 !! wikitext
3756 ::<!-- foo -->{|
3757 |foo
3758 |}
3759 !! html/parsoid
3760 <dl><dd><dl><dd><!-- foo --><table><tr>
3761 <td>foo</td>
3762 </tr></table></dd></dl></dd></dl>
3763 !! end
3764
3765 # The trailing whitespace in this test is to catch a regression in
3766 # Parsoid after T54473.
3767 !! test
3768 Definition Lists: Hacky use to indent tables (WS-insensitive)
3769 !! wikitext
3770 : {|
3771 |a
3772 |}
3773 !! html/php
3774 <dl><dd><table>
3775 <tr>
3776 <td>a
3777 </td></tr></table></dd></dl>
3778
3779 !! html/parsoid
3780 <dl><dd> <table>
3781 <tbody><tr><td>a</td></tr>
3782 </tbody></table> </dd></dl>
3783 !! end
3784
3785 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3786 ## as an empty dt item. It also ignores all but the last ";" when followed
3787 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3788 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3789 ## ";"s.
3790 ##
3791 ## Ex: ";;t2 ::d2" is transformed into:
3792 ##
3793 ## <dl>
3794 ## <dt>t2 </dt>
3795 ## <dd>
3796 ## <dl>
3797 ## <dt></dt>
3798 ## <dd>d2</dd>
3799 ## </dl>
3800 ## </dd>
3801 ## </dl>
3802 ##
3803 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3804 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3805 ##
3806 ## <dl>
3807 ## <dt>
3808 ## <dl>
3809 ## <dt>t2 </dt>
3810 ## <dd>:d2</dd>
3811 ## </dl>
3812 ## </dt>
3813 ## </dl>
3814 ##
3815 ## All Parsoid only definition list tests have this difference.
3816 ##
3817 ## See also: https://phabricator.wikimedia.org/T8569
3818 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3819
3820 !! test
3821 Table / list interaction: indented table with lists in table contents
3822 !! wikitext
3823 :{|
3824 |-
3825 | a
3826 * b
3827 |-
3828 | c
3829 * d
3830 |}
3831 !! html
3832 <dl><dd><table>
3833
3834 <tr>
3835 <td> a
3836 <ul><li> b</li></ul>
3837 </td></tr>
3838 <tr>
3839 <td> c
3840 <ul><li> d</li></ul>
3841 </td></tr></table></dd></dl>
3842
3843 !! end
3844
3845 !!test
3846 Table / list interaction: lists nested in tables nested in indented lists
3847 !! wikitext
3848 :{|
3849 |
3850 :a
3851 :b
3852 |
3853 *c
3854 *d
3855 |}
3856
3857 *e
3858 *f
3859 !! html
3860 <dl><dd><table>
3861 <tr>
3862 <td>
3863 <dl><dd>a</dd>
3864 <dd>b</dd></dl>
3865 </td>
3866 <td>
3867 <ul><li>c</li>
3868 <li>d</li></ul>
3869 </td></tr></table></dd></dl>
3870 <ul><li>e</li>
3871 <li>f</li></ul>
3872
3873 !!end
3874
3875 !! test
3876 Definition Lists: Nesting: Multi-level (Parsoid only)
3877 !! options
3878 parsoid
3879 !! wikitext
3880 ;t1 :d1
3881 ;;t2 ::d2
3882 ;;;t3 :::d3
3883 !! html
3884 <dl>
3885 <dt>t1 </dt>
3886 <dd>d1</dd>
3887 <dt>
3888 <dl>
3889 <dt>t2 </dt>
3890 <dd>:d2</dd>
3891 <dt>
3892 <dl>
3893 <dt>t3 </dt>
3894 <dd>::d3</dd>
3895 </dl>
3896 </dt>
3897 </dl>
3898 </dt>
3899 </dl>
3900
3901
3902 !! end
3903
3904
3905 !! test
3906 Definition Lists: Nesting: Test 2 (Parsoid only)
3907 !! wikitext
3908 ;t1
3909 ::d2
3910 !! html/php+tidy
3911 <dl>
3912 <dt>t1</dt>
3913 <dd>
3914 <dl>
3915 <dd>d2</dd>
3916 </dl>
3917 </dd>
3918 </dl>
3919 !! html/parsoid
3920 <dl>
3921 <dt>t1</dt>
3922 <dd>
3923 <dl>
3924 <dd>d2</dd>
3925 </dl>
3926 </dd>
3927 </dl>
3928
3929 !! end
3930
3931
3932 !! test
3933 Definition Lists: Nesting: Test 3 (Parsoid only)
3934 !! wikitext
3935 :;t1
3936 ::::d2
3937 !! html/php+tidy
3938 <dl>
3939 <dd>
3940 <dl>
3941 <dt>t1</dt>
3942 <dd>
3943 <dl>
3944 <dd>
3945 <dl>
3946 <dd>d2</dd>
3947 </dl>
3948 </dd>
3949 </dl>
3950 </dd>
3951 </dl>
3952 </dd>
3953 </dl>
3954 !! html/parsoid
3955 <dl>
3956 <dd>
3957 <dl>
3958 <dt>t1</dt>
3959 <dd>
3960 <dl>
3961 <dd>
3962 <dl>
3963 <dd>d2</dd>
3964 </dl>
3965 </dd>
3966 </dl>
3967 </dd>
3968 </dl>
3969 </dd>
3970 </dl>
3971
3972 !! end
3973
3974
3975 !! test
3976 Definition Lists: Nesting: Test 4
3977 !! wikitext
3978 ::;t3
3979 :::d3
3980 !! html
3981 <dl><dd><dl><dd><dl><dt>t3</dt>
3982 <dd>d3</dd></dl></dd></dl></dd></dl>
3983
3984 !! end
3985
3986
3987 ## The Parsoid team believes the following three test exposes a
3988 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
3989 ## wrong to close the <dl> after the <dt> containing the <ul>.)
3990 ## It also exposes a "misfeature" in tidy, which doesn't like
3991 ## <dl> tags with a single <dt> child; it converts the <dt> into
3992 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
3993 !! test
3994 Definition Lists: Mixed Lists: Test 1
3995 !! wikitext
3996 :;* foo
3997 ::* bar
3998 :; baz
3999 !! html/php
4000 <dl><dd><dl><dt><ul><li> foo</li>
4001 <li> bar</li></ul></dt></dl>
4002 <dl><dt> baz</dt></dl></dd></dl>
4003
4004 !! html/php+tidy
4005 <dl>
4006 <dd>
4007 <dl>
4008 <dd>
4009 <ul>
4010 <li>foo</li>
4011 <li>bar</li>
4012 </ul>
4013 </dd>
4014 </dl>
4015 <dl>
4016 <dt>baz</dt>
4017 </dl>
4018 </dd>
4019 </dl>
4020 !! html/parsoid
4021 <dl>
4022 <dd><dl>
4023 <dt><ul>
4024 <li> foo
4025 </li>
4026 </ul></dt>
4027 <dd><ul>
4028 <li> bar
4029 </li>
4030 </ul></dd>
4031 <dt> baz</dt>
4032 </dl></dd>
4033 </dl>
4034 !! end
4035
4036 !! test
4037 Definition Lists: Mixed Lists: Test 2
4038 !! wikitext
4039 *: d1
4040 *: d2
4041 !! html
4042 <ul><li><dl><dd> d1</dd>
4043 <dd> d2</dd></dl></li></ul>
4044
4045 !! end
4046
4047
4048 !! test
4049 Definition Lists: Mixed Lists: Test 3
4050 !! wikitext
4051 *::: d1
4052 *::: d2
4053 !! html
4054 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4055 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4056
4057 !! end
4058
4059
4060 !! test
4061 Definition Lists: Mixed Lists: Test 4
4062 !! wikitext
4063 *;d1 :d2
4064 *;d3 :d4
4065 !! html
4066 <ul><li><dl><dt>d1&#160;</dt>
4067 <dd>d2</dd>
4068 <dt>d3&#160;</dt>
4069 <dd>d4</dd></dl></li></ul>
4070
4071 !! end
4072
4073
4074 !! test
4075 Definition Lists: Mixed Lists: Test 5
4076 !! wikitext
4077 *:d1
4078 *:: d2
4079 !! html
4080 <ul><li><dl><dd>d1
4081 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4082
4083 !! end
4084
4085
4086 !! test
4087 Definition Lists: Mixed Lists: Test 6
4088 !! wikitext
4089 #*:d1
4090 #*::: d3
4091 !! html
4092 <ol><li><ul><li><dl><dd>d1
4093 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4094
4095 !! end
4096
4097
4098 !! test
4099 Definition Lists: Mixed Lists: Test 7
4100 !! wikitext
4101 :* d1
4102 :* d2
4103 !! html
4104 <dl><dd><ul><li> d1</li>
4105 <li> d2</li></ul></dd></dl>
4106
4107 !! end
4108
4109
4110 !! test
4111 Definition Lists: Mixed Lists: Test 8
4112 !! wikitext
4113 :* d1
4114 ::* d2
4115 !! html
4116 <dl><dd><ul><li> d1</li></ul>
4117 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4118
4119 !! end
4120
4121
4122 !! test
4123 Definition Lists: Mixed Lists: Test 9
4124 !! wikitext
4125 *;foo :bar
4126 !! html
4127 <ul><li><dl><dt>foo&#160;</dt>
4128 <dd>bar</dd></dl></li></ul>
4129
4130 !! end
4131
4132
4133 !! test
4134 Definition Lists: Mixed Lists: Test 10
4135 !! wikitext
4136 *#;foo :bar
4137 !! html
4138 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4139 <dd>bar</dd></dl></li></ol></li></ul>
4140
4141 !! end
4142
4143 # The Parsoid team disagrees with the PHP parser's seemingly-random
4144 # rules regarding dd/dt on the next two tests. Parsoid is more
4145 # consistent, and recognizes the shared nesting and keeps the
4146 # still-open tags around until the nesting is complete.
4147 # (And tidy again converts <dt> to <dd> before 'bar'.)
4148
4149 !! test
4150 Definition Lists: Mixed Lists: Test 11
4151 !! wikitext
4152 *#*#;*;;foo :bar
4153 *#*#;boo :baz
4154 !! html/php
4155 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4156 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4157 <dl><dt>boo&#160;</dt>
4158 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4159
4160 !! html/php+tidy
4161 <ul>
4162 <li>
4163 <ol>
4164 <li>
4165 <ul>
4166 <li>
4167 <ol>
4168 <li>
4169 <dl>
4170 <dt>foo&#160;</dt>
4171 <dd>
4172 <ul>
4173 <li>
4174 <dl>
4175 <dd>
4176 <dl>
4177 <dt>bar</dt>
4178 </dl>
4179 </dd>
4180 </dl>
4181 </li>
4182 </ul>
4183 </dd>
4184 </dl>
4185 <dl>
4186 <dt>boo&#160;</dt>
4187 <dd>baz</dd>
4188 </dl>
4189 </li>
4190 </ol>
4191 </li>
4192 </ul>
4193 </li>
4194 </ol>
4195 </li>
4196 </ul>
4197 !! html/parsoid
4198 <ul>
4199 <li>
4200 <ol>
4201 <li>
4202 <ul>
4203 <li>
4204 <ol>
4205 <li>
4206 <dl>
4207 <dt>
4208 <ul>
4209 <li>
4210 <dl>
4211 <dt>
4212 <dl>
4213 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4214 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4215 </dl></dt>
4216 </dl></li>
4217 </ul></dt>
4218 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4219 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4220 </dl></li>
4221 </ol></li>
4222 </ul></li>
4223 </ol></li>
4224 </ul>
4225 !! end
4226
4227
4228 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4229 # From whitelist:
4230 # * The test is wrong, there are two colons where there should be :;
4231 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4232 !! test
4233 Definition Lists: Weird Ones: Test 1
4234 !! wikitext
4235 *#;*::;; foo : bar (who uses this?)
4236 !! html/php
4237 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4238 <dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)</dt></dl></dd></dl></dd></dl></dd></dl></li></ul></dd></dl></li></ol></li></ul>
4239
4240 !! html/php+tidy
4241 <ul>
4242 <li>
4243 <ol>
4244 <li>
4245 <dl>
4246 <dt>foo&#160;</dt>
4247 <dd>
4248 <ul>
4249 <li>
4250 <dl>
4251 <dd>
4252 <dl>
4253 <dd>
4254 <dl>
4255 <dd>
4256 <dl>
4257 <dt>bar (who uses this?)</dt>
4258 </dl>
4259 </dd>
4260 </dl>
4261 </dd>
4262 </dl>
4263 </dd>
4264 </dl>
4265 </li>
4266 </ul>
4267 </dd>
4268 </dl>
4269 </li>
4270 </ol>
4271 </li>
4272 </ul>
4273 !! html/parsoid
4274 <ul>
4275 <li>
4276 <ol>
4277 <li>
4278 <dl>
4279 <dt>
4280 <ul>
4281 <li>
4282 <dl>
4283 <dd>
4284 <dl>
4285 <dd>
4286 <dl>
4287 <dt>
4288 <dl>
4289 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4290 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4291 </dl></dt>
4292 </dl></dd>
4293 </dl></dd>
4294 </dl></li>
4295 </ul></dt>
4296 </dl></li>
4297 </ol></li>
4298 </ul>
4299 !! end
4300
4301 !! test
4302 Definition Lists: colons occurring in tags
4303 !! wikitext
4304 ;a:b
4305 ;'''a:b'''
4306 ;<i>a:b</i>
4307 ;<span>a:b</span>
4308 ;<div>a:b</div>
4309 ;<div>a
4310 :b</div>
4311 ;{{echo|a:b}}
4312 ;{{echo|''a:b''}}
4313 ;;;''a:b''
4314 !! html+tidy
4315 <dl>
4316 <dt>a</dt>
4317 <dd>b</dd>
4318 <dt><b>a:b</b></dt>
4319 <dt><i>a:b</i></dt>
4320 <dt><span>a:b</span></dt>
4321 <dd>
4322 <div>a:b</div>
4323 </dd>
4324 <dd>
4325 <div>a
4326 <dl>
4327 <dd>b</dd>
4328 </dl>
4329 </div>
4330 </dd>
4331 <dt>a</dt>
4332 <dd>b</dd>
4333 <dt><i>a:b</i></dt>
4334 </dl>
4335 <dl>
4336 <dd>
4337 <dl>
4338 <dd>
4339 <dl>
4340 <dt><i>a:b</i></dt>
4341 </dl>
4342 </dd>
4343 </dl>
4344 </dd>
4345 </dl>
4346 !! html/parsoid
4347 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4348 <dt><b>a:b</b></dt>
4349 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4350 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4351 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4352 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4353 <dd>b</dd>
4354 <dt><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a:b"}},"i":0}}]}'>a:b</span></dt>
4355 <dt><i about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;a:b&#39;&#39;"}},"i":0}}]}'>a:b</i>
4356 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4357 !! end
4358
4359 !! test
4360 Definition Lists: colons and tables 1
4361 !! wikitext
4362 :{|
4363 | x
4364 |}
4365 :{|
4366 | y
4367 |}
4368 !! html
4369 <dl><dd><table>
4370 <tr>
4371 <td> x
4372 </td></tr></table></dd></dl>
4373 <dl><dd><table>
4374 <tr>
4375 <td> y
4376 </td></tr></table></dd></dl>
4377
4378 !! end
4379
4380 # Parsoid's output (as documented below) differs from php's in this case.
4381 # This is probably a bug. If we fixup parsoid to match php's output, the
4382 # above test should pass and the below test case can be removed. It is
4383 # unclear which output is more desirable.
4384
4385 !! test
4386 Definition Lists: colons and tables 2
4387 !! wikitext
4388 :{|
4389 | x
4390 |}
4391 :{|
4392 | y
4393 |}
4394 !! html/parsoid
4395 <dl><dd><table>
4396 <tr>
4397 <td> x
4398 </td></tr></table></dd>
4399 <dd><table>
4400 <tr>
4401 <td> y
4402 </td></tr></table></dd></dl>
4403 !! end
4404
4405 !! test
4406 Definition Lists: template interaction
4407 !! wikitext
4408 ::{{definition_list}}
4409
4410 :one
4411 ::{{definition_list}}
4412 :::two
4413 :::three
4414 ::four
4415 !! html/parsoid
4416 <dl><dd><dl data-parsoid='{}'><dd about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[":",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}}]}'>one</dd><span about="#mwt1">
4417 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4418
4419 <dl><dd data-parsoid='{}'>one
4420 <dl><dd about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":["::",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}},"\n:::two\n:::three"]}'>one</dd><span about="#mwt2">
4421 </span><dd about="#mwt2">two
4422 <dl><dd>two</dd>
4423 <dd>three</dd></dl></dd>
4424 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4425 !! end
4426
4427
4428 ###
4429 ### External links
4430 ###
4431 !! test
4432 External links: non-bracketed
4433 !! wikitext
4434 Non-bracketed: http://example.com
4435 !! html
4436 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4437 </p>
4438 !! end
4439
4440 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4441 !! test
4442 External links: numbered
4443 !! wikitext
4444 Numbered: [http://example.com]
4445 Numbered: [http://example.net]
4446 Numbered: [http://example.com]
4447 !! html/php
4448 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4449 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4450 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4451 </p>
4452 !! html/parsoid
4453 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4454 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4455 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4456 !!end
4457
4458 !! test
4459 External links: specified text
4460 !! wikitext
4461 Specified text: [http://example.com link]
4462 !! html
4463 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4464 </p>
4465 !!end
4466
4467 !! test
4468 External links: trail
4469 !! wikitext
4470 Linktrails should not work for external links: [http://example.com link]s
4471 !! html
4472 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4473 </p>
4474 !! end
4475
4476 !! test
4477 External links: dollar sign in URL
4478 !! wikitext
4479 http://example.com/1$2345
4480 !! html
4481 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4482 </p>
4483 !! end
4484
4485 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4486 !! test
4487 External links: dollar sign in URL (autonumber)
4488 !! wikitext
4489 [http://example.com/1$2345]
4490 !! html/php
4491 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4492 </p>
4493 !! html/parsoid
4494 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4495 !!end
4496
4497 !! test
4498 External links: open square bracket forbidden in URL (bug 4377)
4499 !! options
4500 parsoid=wt2html,wt2wt,html2html
4501 !! wikitext
4502 http://example.com/1[2345
4503 !! html/php
4504 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4505 </p>
4506 !! html/parsoid
4507 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4508 !! end
4509
4510 !! test
4511 External links: open square bracket forbidden in URL (named) (bug 4377)
4512 !! options
4513 parsoid=wt2html,html2html
4514 !! wikitext
4515 [http://example.com/1[2345]
4516 !! html/php
4517 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4518 </p>
4519 !! html/parsoid
4520 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4521 !!end
4522
4523 # parsoid adds a space before the link name
4524 !! test
4525 External links: open square bracket forbidden in URL (named) (bug 4377)
4526 Parsoid variant.
4527 !! wikitext
4528 [http://example.com/1 [2345]
4529 !! html
4530 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4531 </p>
4532 !!end
4533
4534 !! test
4535 External links: nowiki in URL link text (bug 6230)
4536 !! wikitext
4537 [http://example.com/ <nowiki>''example site''</nowiki>]
4538 !! html
4539 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4540 </p>
4541 !! end
4542
4543 !! test
4544 External links: newline forbidden in text (bug 6230 regression check)
4545 !! wikitext
4546 [http://example.com/ first
4547 second]
4548 !! html
4549 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4550 second]
4551 </p>
4552 !!end
4553
4554 !! test
4555 External links: Pipe char between url and text
4556 !! wikitext
4557 [http://example.com | link]
4558 !! html
4559 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4560 </p>
4561 !!end
4562
4563 !! test
4564 External links: protocol-relative URL in brackets
4565 !! wikitext
4566 [//example.com/ Test]
4567 !! html
4568 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4569 </p>
4570 !! end
4571
4572 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4573 !! test
4574 External links: protocol-relative URL in brackets without text
4575 !! wikitext
4576 [//example.com]
4577 !! html/php
4578 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4579 </p>
4580 !! html/parsoid
4581 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4582 !! end
4583
4584 !! test
4585 External links: protocol-relative URL in free text is left alone
4586 !! wikitext
4587 //example.com/Foo
4588 !! html
4589 <p>//example.com/Foo
4590 </p>
4591 !!end
4592
4593 !! test
4594 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4595 !! wikitext
4596 foo//example.com/Foo
4597 !! html
4598 <p>foo//example.com/Foo
4599 </p>
4600 !! end
4601
4602 !! test
4603 External links: with no contents
4604 !! wikitext
4605 [http://en.wikipedia.org/wiki/Foo]
4606
4607 [[wikipedia:Foo|Bar]]
4608
4609 [[wikipedia:Foo|<span>Bar</span>]]
4610 !! html/php
4611 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4612 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4613 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4614 </p>
4615 !! html/parsoid
4616 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4617 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4618 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4619 !! end
4620
4621 !! test
4622 External links: Free with trailing punctuation
4623 !! wikitext
4624 http://example.com,
4625 http://example.com;
4626 http://example.com\
4627 http://example.com.
4628 http://example.com:
4629 http://example.com!
4630 http://example.com?
4631 http://example.com)
4632 http://example.com/url_with_(brackets)
4633 (http://example.com/url_without_brackets)
4634 http://example.com/url_with_entity&nbsp;
4635 http://example.com/url_with_entity&#xA0;
4636 http://example.com/url_with_entity&#160;
4637 http://example.com/url_with_entity&lt;
4638 http://example.com/url_with_entity&#x3C;
4639 http://example.com/url_with_entity&#60;
4640 !! html/php
4641 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4642 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4643 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4644 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4645 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4646 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4647 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4648 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4649 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4650 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4651 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4652 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4653 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4654 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4655 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4656 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity%3C">http://example.com/url_with_entity%3C</a>
4657 </p>
4658 !! html/parsoid
4659 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4660 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4661 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4662 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4663 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4664 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4665 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4666 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4667 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4668 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4669 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4670 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4671 <a rel="mw:ExtLink" href="http://example.com/url_with_entity ">http://example.com/url_with_entity </a>
4672 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity">&lt;</span>
4673 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a>
4674 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&lt;">http://example.com/url_with_entity&lt;</a></p>
4675 !! end
4676
4677 !! test
4678 External links: Lone protocols are never linked (T105697)
4679 !! wikitext
4680 http://
4681 http://;
4682 (http://)
4683 bitcoin:
4684 bitcoin:;
4685 (bitcoin:)
4686 !! html
4687 <p>http://
4688 http://;
4689 (http://)
4690 bitcoin:
4691 bitcoin:;
4692 (bitcoin:)
4693 </p>
4694 !! end
4695
4696 !! test
4697 External links: No preceding word characters allowed (bug 65278)
4698 !! wikitext
4699 NOPEhttp://example.com
4700 N0http://example.com
4701 ok:http://example.com
4702 ok-http://example.com
4703 !! html
4704 <p>NOPEhttp://example.com
4705 N0http://example.com
4706 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4707 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4708 </p>
4709 !! end
4710
4711 !! test
4712 External image
4713 !! wikitext
4714 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4715 !! html
4716 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4717 </p>
4718 !! end
4719
4720 !! test
4721 External image from https
4722 !! wikitext
4723 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4724 !! html
4725 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4726 </p>
4727 !! end
4728
4729 !! test
4730 External image (when not allowed)
4731 !! options
4732 wgAllowExternalImages=0
4733 !! wikitext
4734 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4735 !! html
4736 <p>External image: <a rel="nofollow" class="external free" href="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png">http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png</a>
4737 </p>
4738 !! end
4739
4740 !! test
4741 Link to non-http image, no img tag
4742 !! wikitext
4743 Link to non-http image, no img tag: ftp://example.com/test.jpg
4744 !! html
4745 <p>Link to non-http image, no img tag: <a rel="nofollow" class="external free" href="ftp://example.com/test.jpg">ftp://example.com/test.jpg</a>
4746 </p>
4747 !! end
4748
4749 !! test
4750 External links: terminating separator
4751 !! wikitext
4752 Terminating separator: http://example.com/thing,
4753 !! html
4754 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4755 </p>
4756 !! end
4757
4758 !! test
4759 External links: intervening separator
4760 !! wikitext
4761 Intervening separator: http://example.com/1,2,3
4762 !! html
4763 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4764 </p>
4765 !! end
4766
4767 !! test
4768 External links: old bug with URL in query
4769 !! wikitext
4770 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4771 !! html
4772 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4773 </p>
4774 !! end
4775
4776 !! test
4777 External links: old URL-in-URL bug, mixed protocols
4778 !! wikitext
4779 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4780 !! html
4781 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4782 </p>
4783 !!end
4784
4785 !! test
4786 External links: URL in text
4787 !! wikitext
4788 URL in text: [http://example.com http://example.com]
4789 !! html
4790 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4791 </p>
4792 !! end
4793
4794 !! test
4795 External links: Clickable images
4796 !! wikitext
4797 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4798 !! html/php
4799 <p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a>
4800 </p>
4801 !! html/parsoid
4802 <p>ja-style clickable images: <a rel="mw:ExtLink" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" data-parsoid='{"type":"extlink"}'/></a></p>
4803 !! end
4804
4805 !! test
4806 External links: raw ampersand
4807 !! wikitext
4808 Old &amp; use: http://x&y
4809 !! html
4810 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4811 </p>
4812 !! end
4813
4814 !! test
4815 External links: encoded ampersand
4816 !! wikitext
4817 Old &amp; use: http://x&amp;y
4818 !! html/php
4819 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4820 </p>
4821 !! html/parsoid
4822 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4823 !! end
4824
4825 !! test
4826 External links: encoded equals (bug 6102)
4827 !! wikitext
4828 http://example.com/?foo&#61;bar
4829 !! html/php
4830 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4831 </p>
4832 !! html/parsoid
4833 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4834 !! end
4835
4836 ##
4837 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4838 ## does it number them. As discussed in bug 53505, we can identify
4839 ## autonumbered links via CSS.
4840 ##
4841
4842 !! test
4843 External links: [raw ampersand]
4844 !! wikitext
4845 Old &amp; use: [http://x&y]
4846 !! html/php
4847 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4848 </p>
4849 !! html/parsoid
4850 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4851 !! end
4852
4853 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4854 # mode will return the [raw ampersand] wikitext
4855 !! test
4856 External links: [encoded ampersand]
4857 !! options
4858 parsoid=wt2html,wt2wt,html2html
4859 !! wikitext
4860 Old &amp; use: [http://x&amp;y]
4861 !! html/php
4862 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4863 </p>
4864 !! html/parsoid
4865 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4866 !! end
4867
4868 !! test
4869 External links: [raw equals]
4870 !! wikitext
4871 [http://example.com/?foo=bar]
4872 !! html/php
4873 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4874 </p>
4875 !! html/parsoid
4876 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4877 !! end
4878
4879 # note that parsoid html is identical to [raw equals] case; so html2wt
4880 # mode will return the [raw equals] wikitext
4881 !! test
4882 External links: [encoded equals] (bug 6102)
4883 !! options
4884 parsoid=wt2html,wt2wt,html2html
4885 !! wikitext
4886 [http://example.com/?foo&#61;bar]
4887 !! html/php
4888 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4889 </p>
4890 !! html/parsoid
4891 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4892 !! end
4893
4894 # xxx parsoid strips the IDN character, so the round-trip tests will
4895 # obviously fail and are disabled. --cscott
4896 !! test
4897 External links: [IDN ignored character reference in hostname; strip it right off]
4898 !! options
4899 parsoid=wt2html,wt2wt,html2html
4900 !! wikitext
4901 [http://e&zwnj;xample.com/]
4902 !! html/php
4903 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4904 </p>
4905 !! html/parsoid
4906 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4907 !! end
4908
4909 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4910 # Where an external link could easily circumvent the sanitization of the text of
4911 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4912 # test demands a higher standard. That's a bit strange.
4913 #
4914 # Example:
4915 #
4916 # http://e‌xample.com -> [http://example.com|http://example.com]
4917 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4918 #
4919 # The first example is sanitized, but the second is not. Any security benefits
4920 # from this production are trivial to circumvent. Either remove this test and
4921 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4922 # the test accordingly.
4923 #
4924 # All our love,
4925 # The Parsoid team.
4926 # xxx parsoid strips the IDN character, so the round-trip tests will
4927 # obviously fail and are disabled. --cscott
4928 !! test
4929 External links: IDN ignored character reference in hostname; strip it right off
4930 !! options
4931 parsoid=wt2html,html2html
4932 !! wikitext
4933 http://e&zwnj;xample.com/
4934 !! html/php
4935 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4936 </p>
4937 !! html/parsoid
4938 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4939 !! end
4940
4941 !! test
4942 External links: www.jpeg.org (bug 554)
4943 !! wikitext
4944 http://www.jpeg.org
4945 !! html
4946 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4947 </p>
4948 !! end
4949
4950 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4951 !! test
4952 External links: URL within URL (original bug 2)
4953 !! wikitext
4954 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
4955 !! html/php
4956 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
4957 </p>
4958 !! html/parsoid
4959 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
4960 !! end
4961
4962 !! test
4963 BUG 361: URL inside bracketed URL
4964 !! wikitext
4965 [http://www.example.com/foo http://www.example.com/bar]
4966 !! html
4967 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
4968 </p>
4969 !! end
4970
4971 !! test
4972 BUG 361: URL within URL, not bracketed
4973 !! wikitext
4974 http://www.example.com/foo?=http://www.example.com/bar
4975 !! html
4976 <p><a rel="nofollow" class="external free" href="http://www.example.com/foo?=http://www.example.com/bar">http://www.example.com/foo?=http://www.example.com/bar</a>
4977 </p>
4978 !! end
4979
4980 !! test
4981 BUG 289: ">"-token in URL-tail
4982 !! wikitext
4983 http://www.example.com/<hello>
4984 !! html
4985 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
4986 </p>
4987 !!end
4988
4989 !! test
4990 BUG 289: literal ">"-token in URL-tail
4991 !! wikitext
4992 http://www.example.com/<b>html</b>
4993 !! html/php
4994 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
4995 </p>
4996 !! html/parsoid
4997 <p><a rel="mw:ExtLink" href="http://www.example.com/" data-parsoid='{"stx":"url"}'>http://www.example.com/</a><b data-parsoid='{"stx":"html"}'>html</b></p>
4998 !! end
4999
5000 !! test
5001 BUG 289: ">"-token in bracketed URL
5002 !! wikitext
5003 [http://www.example.com/<hello> stuff]
5004 !! html
5005 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5006 </p>
5007 !!end
5008
5009 !! test
5010 BUG 289: literal ">"-token in bracketed URL
5011 !! wikitext
5012 [http://www.example.com/<b>html</b> stuff]
5013 !! html
5014 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5015 </p>
5016 !!end
5017
5018 !! test
5019 BUG 289: literal double quote at end of URL
5020 !! wikitext
5021 http://www.example.com/"hello"
5022 !! html
5023 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5024 </p>
5025 !!end
5026
5027 !! test
5028 BUG 289: literal double quote in bracketed URL
5029 !! wikitext
5030 [http://www.example.com/"hello" stuff]
5031 !! html
5032 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5033 </p>
5034 !!end
5035
5036 !! test
5037 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5038 !! wikitext
5039 [http://www.example.com test]
5040 !! html
5041 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5042 </p>
5043 !! end
5044
5045 !! test
5046 External links: link text with spaces
5047 !! wikitext
5048 [http://www.example.com a b c]
5049 [http://www.example.com ''a'' ''b'']
5050 !! html
5051 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5052 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5053 </p>
5054 !! end
5055
5056 !! test
5057 External links: wiki links within external link (Bug 3695)
5058 !! wikitext
5059 [http://example.com [[wikilink]] embedded in ext link]
5060 !! html/php
5061 <p><a rel="nofollow" class="external text" href="http://example.com"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
5062 </p>
5063 !! html/parsoid
5064 <p><a rel="mw:ExtLink" href="http://example.com"></a><a rel="mw:WikiLink" href="./Wikilink" title="Wikilink">wikilink</a><span> embedded in ext link</span></p>
5065 !! end
5066
5067 !! test
5068 BUG 787: Links with one slash after the url protocol are invalid
5069 !! wikitext
5070 http:/example.com
5071
5072 [http:/example.com title]
5073 !! html
5074 <p>http:/example.com
5075 </p><p>[http:/example.com title]
5076 </p>
5077 !! end
5078
5079 !! test
5080 Bracketed external links with template-generated invalid target
5081 !! wikitext
5082 [{{echo|http:/example.com}} title]
5083 !! html
5084 <p>[http:/example.com title]
5085 </p>
5086 !! end
5087
5088 !! test
5089 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5090 !! wikitext
5091 ''[http://example.com text'']
5092 [http://example.com '''text]'''
5093 ''Something [http://example.com in italic'']
5094 ''Something [http://example.com mixed''''', even bold]'''
5095 '''''Now [http://example.com both''''']
5096 !! html
5097 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5098 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5099 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5100 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5101 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5102 </p>
5103 !! end
5104
5105
5106 !! test
5107 Bug 4781: %26 in URL
5108 !! wikitext
5109 http://www.example.com/?title=AT%26T
5110 !! html/php
5111 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5112 </p>
5113 !! html/parsoid
5114 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5115 !! end
5116
5117 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5118 # % is actually legal in HTML5. Any change in output would need testing though.
5119 !! test
5120 Bug 4781, 5267: %25 in URL
5121 !! wikitext
5122 http://www.example.com/?title=100%25_Bran
5123 !! html/php
5124 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a>
5125 </p>
5126 !! html/parsoid
5127 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5128 !! end
5129
5130 !! test
5131 Bug 4781, 5267: %28, %29 in URL
5132 !! wikitext
5133 http://www.example.com/?title=Ben-Hur_%281959_film%29
5134 !! html/php
5135 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
5136 </p>
5137 !! html/parsoid
5138 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a></p>
5139 !! end
5140
5141
5142 !! test
5143 Bug 4781: %26 in autonumber URL
5144 !! wikitext
5145 [http://www.example.com/?title=AT%26T]
5146 !! html/php
5147 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5148 </p>
5149 !! html/parsoid
5150 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5151 !! end
5152
5153 !! test
5154 Bug 4781, 5267: %26 in autonumber URL
5155 !! wikitext
5156 [http://www.example.com/?title=100%25_Bran]
5157 !! html/php
5158 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5159 </p>
5160 !! html/parsoid
5161 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5162 !! end
5163
5164 !! test
5165 Bug 4781, 5267: %28, %29 in autonumber URL
5166 !! wikitext
5167 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5168 !! html/php
5169 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5170 </p>
5171 !! html/parsoid
5172 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5173 !! end
5174
5175
5176 !! test
5177 Bug 4781: %26 in bracketed URL
5178 !! wikitext
5179 [http://www.example.com/?title=AT%26T link]
5180 !! html/php
5181 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5182 </p>
5183 !! html/parsoid
5184 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5185 !! end
5186
5187 !! test
5188 Bug 4781, 5267: %25 in bracketed URL
5189 !! wikitext
5190 [http://www.example.com/?title=100%25_Bran link]
5191 !! html
5192 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5193 </p>
5194 !! end
5195
5196 !! test
5197 Bug 4781, 5267: %28, %29 in bracketed URL
5198 !! wikitext
5199 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5200 !! html/php
5201 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5202 </p>
5203 !! html/parsoid
5204 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5205 !! end
5206
5207 !! test
5208 External link containing a period in the anchor. (bug 63947)
5209 !! wikitext
5210 [//foo.org/bar#baz. bang]
5211
5212 [//foo.org/bar. bang]
5213 !! html/php
5214 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5215 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5216 </p>
5217 !! html/parsoid
5218 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5219 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5220 !! end
5221
5222 !! test
5223 External link containing a single quote. (bug 63947)
5224 !! wikitext
5225 [//foo.org/bar'baz]
5226
5227 [//foo.org/bar'baz bang]
5228 !! html/php
5229 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5230 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5231 </p>
5232 !! html/parsoid
5233 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5234 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5235 !! end
5236
5237
5238 !! test
5239 External link containing a period in the anchor. (bug 63947)
5240 !! wikitext
5241 [//foo.org/bar#baz. bang]
5242
5243 [//foo.org/bar. bang]
5244 !! html/php
5245 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5246 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5247 </p>
5248 !! html/parsoid
5249 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5250 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5251 !! end
5252
5253 !! test
5254 External link containing a single quote. (bug 63947)
5255 !! wikitext
5256 [//foo.org/bar'baz]
5257
5258 [//foo.org/bar'baz bang]
5259 !! html/php
5260 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5261 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5262 </p>
5263 !! html/parsoid
5264 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5265 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5266 !! end
5267
5268
5269 !! test
5270 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5271 !! wikitext
5272 Some [http://example.com/ pretty ''italics'' and stuff]!
5273 !! html
5274 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5275 </p>
5276 !! end
5277
5278 !! test
5279 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5280 !! wikitext
5281 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5282 !! html
5283 <p><i>Some </i><a rel="nofollow" class="external text" href="http://example.com/"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
5284 </p>
5285 !! end
5286
5287 !! test
5288 External link containing double-single-quotes with no space separating the url from text in italics
5289 !! wikitext
5290 [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
5291 !! html/php
5292 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</a>
5293 </p>
5294 !! html/php+tidy
5295 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de</a> <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</p>
5296 !! html/parsoid
5297 <p><a rel="mw:ExtLink" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de </a><a rel="mw:WikiLink" href="./Museo_Picasso_(París)" title="Museo Picasso (París)">Museo Picasso</a><span>.</span></p>
5298 !! end
5299
5300 !! test
5301 External link with comments in link text
5302 !! wikitext
5303 [http://www.google.com Google <!-- comment -->]
5304 !! html
5305 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5306 </p>
5307 !! end
5308
5309 !! test
5310 URL-encoding in URL functions (single parameter)
5311 !! wikitext
5312 {{localurl:Some page|amp=&}}
5313 !! html
5314 <p>/index.php?title=Some_page&amp;amp=&amp;
5315 </p>
5316 !! end
5317
5318 !! test
5319 URL-encoding in URL functions (multiple parameters)
5320 !! wikitext
5321 {{localurl:Some page|q=?&amp=&}}
5322 !! html
5323 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5324 </p>
5325 !! end
5326
5327 !! test
5328 Brackets in urls
5329 !! wikitext
5330 http://example.com/index.php?foozoid%5B%5D=bar
5331
5332 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5333 !! html/php
5334 <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
5335 </p><p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
5336 </p>
5337 !! html/parsoid
5338 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a></p>
5339
5340 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5341 !! end
5342
5343 !! test
5344 IPv6 urls, autolink format (T23261)
5345 !! wikitext
5346 http://[2404:130:0:1000::187:2]/index.php
5347
5348 Examples from RFC2373, section 2.2:
5349 * http://[1080::8:800:200C:417A]/unicast
5350 * http://[FF01::101]/multicast
5351 * http://[::1]/loopback
5352 * http://[::]/unspecified
5353 * http://[::13.1.68.3]/ipv4compat
5354 * http://[::FFFF:129.144.52.38]/ipv4compat
5355
5356 Examples from RFC 2732, section 2:
5357 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5358 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5359 * http://[3ffe:2a00:100:7031::1]
5360 * http://[1080::8:800:200C:417A]/foo
5361 * http://[::192.9.5.5]/ipng
5362 * http://[::FFFF:129.144.52.38]:80/index.html
5363 * http://[2010:836B:4179::836B:4179]
5364
5365 !! html
5366 <p><a rel="nofollow" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a>
5367 </p><p>Examples from RFC2373, section 2.2:
5368 </p>
5369 <ul><li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5370 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5371 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5372 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5373 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5374 <li> <a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5375 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5376 </p>
5377 <ul><li> <a rel="nofollow" class="external free" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5378 <li> <a rel="nofollow" class="external free" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5379 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5380 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5381 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5382 <li> <a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5383 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5384
5385 !! end
5386
5387 !! test
5388 IPv6 urls, bracketed format (T23261)
5389 !! wikitext
5390 [http://[2404:130:0:1000::187:2]/index.php test]
5391
5392 Examples from RFC2373, section 2.2:
5393 * [http://[1080::8:800:200C:417A] unicast]
5394 * [http://[FF01::101] multicast]
5395 * [http://[::1]/ loopback]
5396 * [http://[::] unspecified]
5397 * [http://[::13.1.68.3] ipv4compat]
5398 * [http://[::FFFF:129.144.52.38] ipv4compat]
5399
5400 Examples from RFC 2732, section 2:
5401 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5402 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5403 * [http://[3ffe:2a00:100:7031::1] 3]
5404 * [http://[1080::8:800:200C:417A]/foo 4]
5405 * [http://[::192.9.5.5]/ipng 5]
5406 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5407 * [http://[2010:836B:4179::836B:4179] 7]
5408
5409 !! html
5410 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5411 </p><p>Examples from RFC2373, section 2.2:
5412 </p>
5413 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5414 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5415 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5416 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5417 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5418 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5419 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5420 </p>
5421 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5422 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5423 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5424 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5425 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5426 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5427 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5428
5429 !! end
5430
5431 !! test
5432 Non-extlinks in brackets
5433 !! wikitext
5434 [foo]
5435 [foo bar]
5436 [foo ''bar'']
5437 [fool's] errand
5438 [fool's errand]
5439 [{{echo|foo}}]
5440 [{{echo|foo}} bar]
5441 [{{echo|foo}} ''bar'']
5442 [{{echo|foo}}l's] errand
5443 [{{echo|foo}}l's errand]
5444 [url={{echo|foo}}]
5445 [url=http://example.com]
5446 !! html
5447 <p>[foo]
5448 [foo bar]
5449 [foo <i>bar</i>]
5450 [fool's] errand
5451 [fool's errand]
5452 [foo]
5453 [foo bar]
5454 [foo <i>bar</i>]
5455 [fool's] errand
5456 [fool's errand]
5457 [url=foo]
5458 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5459 </p>
5460 !! end
5461
5462 !! test
5463 Percent encoding in external links
5464 !! wikitext
5465 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5466 !! html/php
5467 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5468 </p>
5469 !! html/parsoid
5470 <p><a rel="mw:ExtLink"
5471 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5472 !! end
5473
5474 !! test
5475 Use url link syntax for links where the content is equal the link target
5476 !! wikitext
5477 http://example.com
5478 !! html/php
5479 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5480 </p>
5481 !! html/parsoid
5482 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5483 !! end
5484
5485 !! test
5486 Parenthesis in external links, especially URL links
5487 !! wikitext
5488 http://example.com)
5489
5490 http://example.com/test)
5491
5492 http://example.com/(test)
5493
5494 http://example.com/((test)
5495
5496 (http://example.com/(test))
5497
5498 (http://example.com/(test)))))
5499
5500 http://example.com/a)b
5501
5502 [http://example.com) foo]
5503 !! html/php
5504 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5505 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5506 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5507 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5508 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5509 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5510 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5511 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5512 </p>
5513 !! html/parsoid
5514 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5515 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5516 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5517 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5518 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5519 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5520 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5521 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5522 !! end
5523
5524 !! test
5525 Parenthesis in external links, w/ transclusion or comment
5526 !! wikitext
5527 (http://example.com/{{echo|hi}})
5528
5529 (http://example.com<!-- hi -->)
5530 !! html/php
5531 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5532 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5533 </p>
5534 !! html/parsoid
5535 <p>(<a typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[20,31,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;hi&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
5536
5537 <p>(<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url","a":{"href":"http://example.com"},"sa":{"href":"http://example.com&lt;!-- hi -->"}}'>http://example.com</a>)</p>
5538 !! end
5539
5540 !! test
5541 Serialize <a> tags with invalid link targets as plain text
5542 !! options
5543 parsoid=html2wt
5544 !! html/parsoid
5545 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5546 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5547 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5548 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5549 !! wikitext
5550 text
5551 <nowiki>*</nowiki>text
5552 <nowiki>[[foo]]</nowiki>
5553 <nowiki>*a [[foo]]</nowiki>
5554 !! end
5555
5556 !! test
5557 mw:ExtLink -vs- mw:WikiLink (T94723)
5558 !! options
5559 parsoid=html2wt
5560 !! html/parsoid
5561 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"},"dsr":[0,11,6,2]}'>Bar</a>
5562 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5563 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5564 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5565 <p>
5566 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5567 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5568 </p>
5569 !! wikitext
5570 [[Foo|Bar]]
5571 [[Foo|Bar]]
5572 [[wikipedia:Foo|Bar]]
5573 [[wikipedia:Foo|Bar]]
5574
5575 [[wikipedia:European_Robin|European Robin]]
5576 [[wikipedia:European_Robin|European Robin]]
5577 !! end
5578
5579 !! test
5580 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5581 !! options
5582 parsoid=wt2wt
5583 !! wikitext
5584 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5585 !! html/parsoid
5586 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5587 !! end
5588
5589
5590 ###
5591 ### Quotes
5592 ###
5593
5594 !! test
5595 Quotes
5596 !! wikitext
5597 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5598
5599 Normal text. '''''Bold italic text.''''' Normal text.
5600 !! html
5601 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5602 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5603 </p>
5604 !! end
5605
5606
5607 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5608 # parser strips. The wikitext contains just the first half of the bold
5609 # quote pair.
5610 !! test
5611 Unclosed and unmatched quotes
5612 !! wikitext
5613 '''''Bold italic text '''with bold deactivated''' in between.'''''
5614
5615 '''''Bold italic text ''with italic deactivated'' in between.'''''
5616
5617 '''Bold text..
5618
5619 ..spanning two paragraphs (should not work).'''
5620
5621 '''Bold tag left open
5622
5623 ''Italic tag left open
5624
5625 Normal text.
5626
5627 <!-- Unmatching number of opening, closing tags: -->
5628 '''This year''''s election ''should'' beat '''last year''''s.
5629
5630 ''Tom'''s car is bigger than ''Susan'''s.
5631
5632 Plain ''italic'''s plain
5633 !! html/php
5634 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5635 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5636 </p><p><b>Bold text..</b>
5637 </p><p>..spanning two paragraphs (should not work).
5638 </p><p><b>Bold tag left open</b>
5639 </p><p><i>Italic tag left open</i>
5640 </p><p>Normal text.
5641 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5642 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5643 </p><p>Plain <i>italic'</i>s plain
5644 </p>
5645 !! html/parsoid
5646 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5647 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5648 </p><p><b>Bold text..</b>
5649 </p><p>..spanning two paragraphs (should not work).<b></b>
5650 </p><p><b>Bold tag left open</b>
5651 </p><p><i>Italic tag left open</i>
5652 </p><p>Normal text.
5653 </p>
5654 <!-- Unmatching number of opening, closing tags: -->
5655 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5656 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5657 </p><p>Plain <i>italic'</i>s plain
5658 </p>
5659 !! end
5660
5661 ###
5662 ### Tables
5663 ###
5664 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5665 ###
5666
5667 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5668 # is the bare minimum required by the spec, see:
5669 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5670 # Parsoid team replies: empty table tags are legal in HTML5
5671 !! test
5672 A table with no data.
5673 !! options
5674 parsoid=wt2html
5675 !! wikitext
5676 {||}
5677 !! html/php
5678
5679 !! html/parsoid
5680 <table></table>
5681
5682 !! end
5683
5684 !! test
5685 A table with stray table end tags on start tag line (wt2html)
5686 !! options
5687 parsoid=wt2html
5688 !! wikitext
5689 {|style="color: red;"|}
5690
5691 {|style="color: red;" |}
5692 |foo
5693 |}
5694
5695 {|style="color: red;"|} id="foo"
5696 |foo
5697 |}
5698
5699 {|style="color: red;" |} id="foo"
5700 |foo
5701 |}
5702 !! html
5703 <table style="color: red;"></table>
5704
5705 <table style="color: red;">
5706 <tbody><tr>
5707 <td>foo</td>
5708 </tr></tbody>
5709 </table>
5710
5711 <table style="color: red;" id="foo">
5712 <tbody><tr>
5713 <td>foo</td>
5714 </tr></tbody>
5715 </table>
5716
5717 <table style="color: red;" id="foo">
5718 <tbody><tr>
5719 <td>foo</td>
5720 </tr></tbody>
5721 </table>
5722
5723 !! end
5724
5725 !! test
5726 A table with no data (take 2)
5727 !! wikitext
5728 {|
5729 |}
5730 !! html/parsoid
5731 <table></table>
5732 !! end
5733
5734 # A table with nothing but a caption is invalid XHTML, we might want to render
5735 # this as <p>caption</p>
5736 # Parsoid team replies: table with only a caption is legal in HTML5
5737 !! test
5738 A table with nothing but a caption
5739 !! wikitext
5740 {|
5741 |+ caption
5742 |}
5743 !! html/php
5744 <table>
5745 <caption> caption
5746 </caption><tr><td></td></tr></table>
5747
5748 !! html/parsoid
5749 <table><caption> caption</caption></table>
5750 !! end
5751
5752 !! test
5753 A table with caption with default-spaced attributes and a table row
5754 !! wikitext
5755 {|
5756 |+ style="color: red;" | caption1
5757 |-
5758 | foo
5759 |}
5760 !! html
5761 <table>
5762 <caption style="color: red;"> caption1
5763 </caption>
5764 <tr>
5765 <td> foo
5766 </td></tr></table>
5767
5768 !! end
5769
5770 !! test
5771 A table with captions with non-default spaced attributes and a table row
5772 !! wikitext
5773 {|
5774 |+style="color: red;"|caption2
5775 |+ style="color: red;"| caption3
5776 |-
5777 | foo
5778 |}
5779 !! html
5780 <table>
5781 <caption style="color: red;">caption2
5782 </caption>
5783 <caption style="color: red;"> caption3
5784 </caption>
5785 <tr>
5786 <td> foo
5787 </td></tr></table>
5788
5789 !! end
5790
5791 !! test
5792 Table td-cell syntax variations
5793 !! wikitext
5794 {|
5795 | foo bar foo | baz
5796 | foo bar foo || baz
5797 | style='color:red;' | baz
5798 | style='color:red;' || baz
5799 |}
5800 !! html
5801 <table>
5802 <tr>
5803 <td> baz
5804 </td>
5805 <td> foo bar foo </td>
5806 <td> baz
5807 </td>
5808 <td style="color:red;"> baz
5809 </td>
5810 <td> style='color:red;' </td>
5811 <td> baz
5812 </td></tr></table>
5813
5814 !! end
5815
5816 !! test
5817 Simple table
5818 !! wikitext
5819 {|
5820 | 1 || 2
5821 |-
5822 | 3 || 4
5823 |}
5824 !! html
5825 <table>
5826 <tr>
5827 <td> 1 </td>
5828 <td> 2
5829 </td></tr>
5830 <tr>
5831 <td> 3 </td>
5832 <td> 4
5833 </td></tr></table>
5834
5835 !! end
5836
5837 !! test
5838 Simple table but with multiple dashes for row wikitext
5839 !! wikitext
5840 {|
5841 | foo
5842 |-----
5843 | bar
5844 |}
5845 !! html
5846 <table>
5847 <tr>
5848 <td> foo
5849 </td></tr>
5850 <tr>
5851 <td> bar
5852 </td></tr></table>
5853
5854 !! end
5855
5856 !! test
5857 Multiplication table
5858 !! wikitext
5859 {| border="1" cellpadding="2"
5860 |+Multiplication table
5861 |-
5862 ! &times; !! 1 !! 2 !! 3
5863 |-
5864 ! 1
5865 | 1 || 2 || 3
5866 |-
5867 ! 2
5868 | 2 || 4 || 6
5869 |-
5870 ! 3
5871 | 3 || 6 || 9
5872 |-
5873 ! 4
5874 | 4 || 8 || 12
5875 |-
5876 ! 5
5877 | 5 || 10 || 15
5878 |}
5879 !! html
5880 <table border="1" cellpadding="2">
5881 <caption>Multiplication table
5882 </caption>
5883 <tr>
5884 <th> &#215; </th>
5885 <th> 1 </th>
5886 <th> 2 </th>
5887 <th> 3
5888 </th></tr>
5889 <tr>
5890 <th> 1
5891 </th>
5892 <td> 1 </td>
5893 <td> 2 </td>
5894 <td> 3
5895 </td></tr>
5896 <tr>
5897 <th> 2
5898 </th>
5899 <td> 2 </td>
5900 <td> 4 </td>
5901 <td> 6
5902 </td></tr>
5903 <tr>
5904 <th> 3
5905 </th>
5906 <td> 3 </td>
5907 <td> 6 </td>
5908 <td> 9
5909 </td></tr>
5910 <tr>
5911 <th> 4
5912 </th>
5913 <td> 4 </td>
5914 <td> 8 </td>
5915 <td> 12
5916 </td></tr>
5917 <tr>
5918 <th> 5
5919 </th>
5920 <td> 5 </td>
5921 <td> 10 </td>
5922 <td> 15
5923 </td></tr></table>
5924
5925 !! end
5926
5927 !! test
5928 Accept "||" in table headings
5929 !! wikitext
5930 {|
5931 !h1 || h2
5932 |}
5933 !! html
5934 <table>
5935 <tr>
5936 <th>h1 </th>
5937 <th> h2
5938 </th></tr></table>
5939
5940 !! end
5941
5942 !! test
5943 Accept "!!" in table data
5944 !! wikitext
5945 {|
5946 | Foo!! ||
5947 |}
5948 !! html
5949 <table>
5950 <tr>
5951 <td> Foo!! </td>
5952 <td>
5953 </td></tr></table>
5954
5955 !! html/parsoid
5956 <table>
5957 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'></td></tr>
5958 </tbody></table>
5959 !! end
5960
5961 !! test
5962 Accept "||" in indented table headings
5963 !! wikitext
5964 :{|
5965 !h1 || h2
5966 |}
5967 !! html
5968 <dl><dd><table>
5969 <tr>
5970 <th>h1 </th>
5971 <th> h2
5972 </th></tr></table></dd></dl>
5973
5974 !! end
5975
5976 !! test
5977 Accept "!!" in templates
5978 !! wikitext
5979 {|
5980 !a {{echo|b!!c}}
5981 |}
5982 !! html/php
5983 <table>
5984 <tr>
5985 <th>a b</th>
5986 <th>c
5987 </th></tr></table>
5988
5989 !! html/parsoid
5990 <table>
5991 <tbody><tr><th typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":["!a ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b!!c"}},"i":0}}]}'>a b</th><th about="#mwt1">c</th></tr>
5992 !! end
5993
5994 !! test
5995 Accept "!!" in table headings after newline
5996 !! wikitext
5997 {|
5998 !a
5999 b!!c
6000 |}
6001 !! html/php
6002 <table>
6003 <tr>
6004 <th>a
6005 <p>b!!c
6006 </p>
6007 </th></tr></table>
6008
6009 !! html/parsoid
6010 <table>
6011 <tbody><tr><th>a
6012 <p>b!!c</p></th></tr>
6013 </tbody></table>
6014 !! end
6015
6016 !! test
6017 Accept "!!" in table data of mixed wikitext / html syntax
6018 !! wikitext
6019 {|
6020 !a
6021 <tr><td>b!!c</td></tr>
6022 |}
6023 !! html+tidy
6024 <table>
6025 <tr>
6026 <th>a</th>
6027 </tr>
6028 <tr>
6029 <td>b!!c</td>
6030 </tr>
6031 </table>
6032 !! html/parsoid
6033 <table>
6034 <tbody><tr><th>a</th></tr>
6035 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6036 </tbody></table>
6037 !! end
6038
6039 !! test
6040 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6041 !! wikitext
6042 {|
6043 !| h1
6044 || a
6045 |}
6046 !! html
6047 <table>
6048 <tr>
6049 <th> h1
6050 </th>
6051 <td> a
6052 </td></tr></table>
6053
6054 !! end
6055
6056 !!test
6057 Accept "| !" at start of line in tables (ignore !-attribute)
6058 !! wikitext
6059 {|
6060 |-
6061 | !style="color:red" | bar
6062 |}
6063 !! html
6064 <table>
6065
6066 <tr>
6067 <td> bar
6068 </td></tr></table>
6069
6070 !!end
6071
6072 !!test
6073 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
6074 !! wikitext
6075 {|
6076 |-
6077 |style='color:red;'|+1
6078 |style='color:blue;'|-1
6079 |-
6080 | 1 || 2 || 3
6081 | 1 ||+2 ||-3
6082 |-
6083 | +1
6084 | -1
6085 |}
6086 !! html
6087 <table>
6088
6089 <tr>
6090 <td style="color:red;">+1
6091 </td>
6092 <td style="color:blue;">-1
6093 </td></tr>
6094 <tr>
6095 <td> 1 </td>
6096 <td> 2 </td>
6097 <td> 3
6098 </td>
6099 <td> 1 </td>
6100 <td>+2 </td>
6101 <td>-3
6102 </td></tr>
6103 <tr>
6104 <td> +1
6105 </td>
6106 <td> -1
6107 </td></tr></table>
6108
6109 !!end
6110
6111 !! test
6112 Table rowspan
6113 !! wikitext
6114 {| border=1
6115 | Cell 1, row 1
6116 |rowspan=2| Cell 2, row 1 (and 2)
6117 | Cell 3, row 1
6118 |-
6119 | Cell 1, row 2
6120 | Cell 3, row 2
6121 |}
6122 !! html
6123 <table border="1">
6124 <tr>
6125 <td> Cell 1, row 1
6126 </td>
6127 <td rowspan="2"> Cell 2, row 1 (and 2)
6128 </td>
6129 <td> Cell 3, row 1
6130 </td></tr>
6131 <tr>
6132 <td> Cell 1, row 2
6133 </td>
6134 <td> Cell 3, row 2
6135 </td></tr></table>
6136
6137 !! end
6138
6139 !! test
6140 Nested table
6141 !! wikitext
6142 {| border=1
6143 | &alpha;
6144 |
6145 {| bgcolor=#ABCDEF border=2
6146 |nested
6147 |-
6148 |table
6149 |}
6150 |the original table again
6151 |}
6152 !! html
6153 <table border="1">
6154 <tr>
6155 <td> &#945;
6156 </td>
6157 <td>
6158 <table bgcolor="#ABCDEF" border="2">
6159 <tr>
6160 <td>nested
6161 </td></tr>
6162 <tr>
6163 <td>table
6164 </td></tr></table>
6165 </td>
6166 <td>the original table again
6167 </td></tr></table>
6168
6169 !! end
6170
6171 !! test
6172 Invalid attributes in table cell (bug 1830)
6173 !! wikitext
6174 {|
6175 |Cell:|broken
6176 |}
6177 !! html
6178 <table>
6179 <tr>
6180 <td>broken
6181 </td></tr></table>
6182
6183 !! end
6184
6185 !! test
6186 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6187 !! wikitext
6188 {|
6189 | title="foo" |bar
6190 | title="foo<nowiki>|</nowiki>" |bar
6191 | title="foo<nowiki>|</nowiki>" bar
6192 |}
6193 !! html
6194 <table>
6195 <tr>
6196 <td title="foo">bar
6197 </td>
6198 <td title="foo&#124;">bar
6199 </td>
6200 <td> title="foo|" bar
6201 </td></tr></table>
6202
6203 !! end
6204
6205 # The "|}" to close the table is missing from the input, so parsoid's
6206 # *2wt modes will fail.
6207 !! test
6208 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
6209 !! options
6210 parsoid=wt2html,html2html
6211 !! wikitext
6212 {|
6213 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6214 !! html/php
6215 <table>
6216 <tr>
6217 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6218 <td>]" onmouseover="alert(document.cookie)"&gt;test
6219 </td>
6220 </tr>
6221 </table>
6222
6223 !! html/parsoid
6224 <table><tbody>
6225 <tr>
6226 <td><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6227 !! end
6228
6229 # FIXME: The php output is broken.
6230 !! test
6231 ! and || in td attributes should not be parsed as <th>/<td>
6232 !! wikitext
6233 {|
6234 | style="color: red !important;" data-contrived="put this here ||" | foo
6235 |}
6236 !! html/php
6237 <table>
6238 <tr>
6239 <td> style="color: red !important;" data-contrived="put this here </td>
6240 <td> foo
6241 </td></tr></table>
6242
6243 !! html/parsoid
6244 <table>
6245 <tbody><tr><td style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"autoInsertedEnd":true}'> foo</td></tr>
6246 </tbody></table>
6247 !! end
6248
6249 !! test
6250 Indented table markup mixed with indented pre content (proposed in bug 6200)
6251 !! wikitext
6252 <table>
6253 <tr>
6254 <td>
6255 Text that should be rendered preformatted
6256 </td>
6257 </tr>
6258 </table>
6259 !! html
6260 <table>
6261 <tr>
6262 <td>
6263 <pre>Text that should be rendered preformatted
6264 </pre>
6265 </td>
6266 </tr>
6267 </table>
6268
6269 !! end
6270
6271 !! test
6272 1. Template-generated table cell attributes and cell content
6273 !! wikitext
6274 {|
6275 |{{table_attribs}}
6276 | {{table_attribs}}
6277 || {{table_attribs_5}}
6278 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6279 |align=center {{table_attribs}}
6280 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6281 |}
6282 !! html
6283 <table>
6284 <tr>
6285 <td style="color:red;">Foo
6286 </td>
6287 <td style="color:red;">Foo
6288 </td>
6289 <td> style="color:red;"</td>
6290 <td>Bar
6291 </td>
6292 <td style="color:red;">Foo
6293 </td>
6294 <td align="center" style="color:red;">Foo
6295 </td>
6296 <td align="center" style="color:red;">Foo
6297 </td></tr></table>
6298
6299 !! end
6300
6301 !! test
6302 2. Template-generated table cell attributes and cell content
6303 !! wikitext
6304 {|
6305 |{{table_attribs_2}}
6306 |}
6307 !! html/php
6308 <table>
6309 <tr>
6310 <td style="color:red;">Foo
6311 </td>
6312 <td>Bar</td>
6313 <td>Baz
6314 </td></tr></table>
6315
6316 !! html/parsoid
6317 <table>
6318 <tbody><tr><td about="#mwt1" typeof="mw:Transclusion" style="color:red;" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_2","href":"./Template:Table_attribs_2"},"params":{},"i":0}}]}'>Foo</td>
6319 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6320 </tbody></table>
6321 !! end
6322
6323 !! test
6324 3. Template-generated table cell attributes and cell content
6325 !! wikitext
6326 {|
6327 !align=center {{table_header_cells}}
6328 |-
6329 |align=center {{table_cells}}
6330 |}
6331 !! html/php
6332 <table>
6333 <tr>
6334 <th align="center" style="color:red;">Foo</th>
6335 <th style="color:red;"><i>Bar</i></th>
6336 <th style="color:brown;"><i>Foo</i> and Baz
6337 </th></tr>
6338 <tr>
6339 <td align="center" style="color:red;">Foo</td>
6340 <td style="color:red;"><i>Bar</i></td>
6341 <td style="color:brown;"><i>Foo</i> and Baz
6342 </td></tr></table>
6343
6344 !! html/parsoid
6345 <table>
6346 <tbody><tr><th align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":0}}]}'>Foo</th><th about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></th><th about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</th></tr><tr>
6347 <td align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":0}}]}'>Foo</td><td about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></td><td about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</td></tr>
6348 </tbody></table>
6349 !! end
6350
6351 !! test
6352 4. Template-generated table cell attributes and cell content inside a templated table
6353 !! wikitext
6354 {{tbl-start}}
6355 !align=center {{table_header_cells}}
6356 |-
6357 |align=center {{table_cells}}
6358 {{tbl-end}}
6359 !! html/php
6360 <table>
6361 <tr>
6362 <th align="center" style="color:red;">Foo</th>
6363 <th style="color:red;"><i>Bar</i></th>
6364 <th style="color:brown;"><i>Foo</i> and Baz
6365 </th></tr>
6366 <tr>
6367 <td align="center" style="color:red;">Foo</td>
6368 <td style="color:red;"><i>Bar</i></td>
6369 <td style="color:brown;"><i>Foo</i> and Baz
6370 </td></tr></table>
6371
6372 !! html/parsoid
6373 <table about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[],[],[],[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"tbl-start","href":"./Template:Tbl-start"},"params":{},"i":0}},"\n!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":1}},"\n|-\n|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":2}},"\n",{"template":{"target":{"wt":"tbl-end","href":"./Template:Tbl-end"},"params":{},"i":3}}]}'>
6374 <tbody><tr><th align="center" style="color:red;">Foo</th><th style="color:red;"><i>Bar</i></th><th style="color:brown;"><i>Foo</i> and Baz</th></tr>
6375 <tr>
6376 <td align="center" style="color:red;">Foo</td><td style="color:red;"><i>Bar</i></td><td style="color:brown;"><i>Foo</i> and Baz</td></tr>
6377 </tbody></table>
6378 !! end
6379
6380 ## Edge case fix to prevent future regressions
6381 !! test
6382 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6383 !! wikitext
6384 {|
6385 |{{table_attribs_7}}
6386 |}
6387 <references />
6388 !! html/parsoid
6389 <table>
6390 <tbody><tr><td style="background:#f9f9f9;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_7","href":"./Template:Table_attribs_7"},"params":{},"i":0}}]}'>Foo<span class="mw-ref" id="cite_ref-1" rel="dc:references" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></td></tr>
6391 </tbody></table>
6392 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
6393 !! end
6394
6395 !! test
6396 Table with row followed by newlines and table heading
6397 !! wikitext
6398 {|
6399 |-
6400
6401 ! foo
6402 |}
6403 !! html
6404 <table>
6405
6406
6407 <tr>
6408 <th> foo
6409 </th></tr></table>
6410
6411 !! end
6412
6413 !! test
6414 Table with empty line following the start tag
6415 !! wikitext
6416 {|
6417
6418 |-
6419 | foo
6420 |}
6421 !! html
6422 <table>
6423
6424
6425 <tr>
6426 <td> foo
6427 </td></tr></table>
6428
6429 !! end
6430
6431 # FIXME: Preserve the attribute properly (with an empty string as value) in
6432 # the PHP parser. Parsoid implements the behavior below.
6433 !! test
6434 Table attributes with empty value
6435 !! wikitext
6436 {|
6437 | style=| hello
6438 |}
6439 !! html/parsoid
6440 <table>
6441 <tbody>
6442 <tr>
6443 <td style=""> hello
6444 </td></tr></tbody></table>
6445
6446 !! end
6447
6448 !! test
6449 Wikitext table with a lot of comments
6450 !! wikitext
6451 {|
6452 <!-- c0 -->
6453 | foo
6454 <!-- c1 -->
6455 |-<!-- c2 -->
6456 <!-- c3 -->
6457 |<!-- c4 -->
6458 <!-- c5 -->
6459 |}
6460 !! html
6461 <table>
6462 <tr>
6463 <td> foo
6464 </td></tr>
6465 <tr>
6466 <td>
6467 </td></tr></table>
6468
6469 !! end
6470
6471 !! test
6472 Wikitext table comments represented in parsoid dom
6473 !! wikitext
6474 {|<!--c1--><!--c2-->
6475 |-<!--c3-->
6476 | x
6477 |}
6478 !! html/php+tidy
6479 <table>
6480 <tr>
6481 <td>x</td>
6482 </tr>
6483 </table>
6484 !! html/parsoid
6485 <table><!--c1--><!--c2-->
6486 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6487 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6488 </tbody></table>
6489 !! end
6490
6491 !! test
6492 Wikitext table with double-line table cell
6493 !! wikitext
6494 {|
6495 |a
6496 b
6497 |}
6498 !! html
6499 <table>
6500 <tr>
6501 <td>a
6502 <p>b
6503 </p>
6504 </td></tr></table>
6505
6506 !! end
6507
6508 !! test
6509 Table cell with a single comment
6510 !! wikitext
6511 {|
6512 | <!-- c1 -->
6513 | a
6514 |}
6515 !! html
6516 <table>
6517 <tr>
6518 <td>
6519 </td>
6520 <td> a
6521 </td></tr></table>
6522
6523 !! end
6524
6525 !! test
6526 Table-cell after a comment-only-empty-line
6527 !! wikitext
6528 {|
6529 |a
6530 <!--c1-->
6531 <!--c2-->| b
6532 |}
6533 !! html
6534 <table>
6535 <tr>
6536 <td>a
6537 </td>
6538 <td> b
6539 </td></tr></table>
6540
6541 !! html/parsoid
6542 <table>
6543 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6544 <!--c1-->
6545 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6546 </tbody></table>
6547
6548 !! end
6549
6550 !! test
6551 Build table with {{!}}
6552 !! wikitext
6553 {{{!}} class="wikitable"
6554 ! header
6555 ! second header
6556 {{!}}- style="color:red;"
6557 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6558 {{!}}}
6559 !! html
6560 <table class="wikitable">
6561 <tr>
6562 <th> header
6563 </th>
6564 <th> second header
6565 </th></tr>
6566 <tr style="color:red;">
6567 <td> data </td>
6568 <td style="color:red;"> second data
6569 </td></tr></table>
6570
6571 !! end
6572
6573 !! test
6574 Build table with pipe as data
6575 !! wikitext
6576 {| class="wikitable"
6577 ! header
6578 ! second header
6579 |- style="color:red;"
6580 | data || style="color:red;" | second data
6581 |-
6582 | style="color:red;" | data with | || style="color:red;" | second data with |
6583 |-
6584 || data with | ||| second data with |
6585 |}
6586 !! html
6587 <table class="wikitable">
6588 <tr>
6589 <th> header
6590 </th>
6591 <th> second header
6592 </th></tr>
6593 <tr style="color:red;">
6594 <td> data </td>
6595 <td style="color:red;"> second data
6596 </td></tr>
6597 <tr>
6598 <td style="color:red;"> data with | </td>
6599 <td style="color:red;"> second data with |
6600 </td></tr>
6601 <tr>
6602 <td> data with | </td>
6603 <td> second data with |
6604 </td></tr></table>
6605
6606 !! end
6607
6608 !! test
6609 Build table with wikilink
6610 !! wikitext
6611 {| class="wikitable"
6612 ! header || second header
6613 |- style="color:red;"
6614 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6615 |-
6616 | data || second data [[Main Page|link|text with pipe]]
6617 |}
6618 !! html
6619 <table class="wikitable">
6620 <tr>
6621 <th> header </th>
6622 <th> second header
6623 </th></tr>
6624 <tr style="color:red;">
6625 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6626 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6627 </td></tr>
6628 <tr>
6629 <td> data </td>
6630 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6631 </td></tr></table>
6632
6633 !! end
6634
6635 # The expected HTML structure in this test is debatable. The PHP parser does
6636 # not parse this kind of table at all. The main focus for Parsoid is on
6637 # round-tripping, so this output is ok for now. TODO: revisit!
6638 !! test
6639 Wikitext table with html-syntax row
6640 !! wikitext
6641 {|
6642 |-
6643 <td>foo</td>
6644 |}
6645 !! html/parsoid
6646 <table>
6647 <tbody>
6648 <tr>
6649 <td>foo</td></tr></tbody></table>
6650 !! end
6651
6652 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6653 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6654 ## PHP parser, which tidy then compounds by fostering the content
6655 ## entirely out of the table. Parsoid recognizes the table context
6656 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6657 ## depends on PHP's treatment of broken table markup!
6658 !! test
6659 Implicit <td> after a |-
6660 !! options
6661 parsoid=wt2html,html2html
6662 !! wikitext
6663 {|
6664 |-
6665 a
6666 |}
6667 !! html/php
6668 <table>
6669
6670 a
6671 </table>
6672
6673 !! html/php+tidy
6674 <p>a</p>
6675 !! html/parsoid
6676 <table>
6677 <tr><td>a</td></tr>
6678 </table>
6679 !! end
6680
6681 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6682 !! test
6683 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6684 !! options
6685 parsoid=wt2html,html2html
6686 !! wikitext
6687 {|
6688 |-
6689 |
6690 a
6691 |-
6692 b
6693 |}
6694 !! html/php
6695 <table>
6696
6697 <tr>
6698 <td>
6699 <pre>a
6700 </pre>
6701 </td></tr>
6702 b
6703 </table>
6704
6705 !! html/php+tidy
6706 <p>b</p>
6707 <table>
6708 <tr>
6709 <td>
6710 <pre>
6711 a
6712 </pre></td>
6713 </tr>
6714 </table>
6715 !! html/parsoid
6716 <table>
6717 <tbody>
6718 <tr><td><pre>a</pre></td></tr>
6719 <tr><td> b</td></tr>
6720 </tbody>
6721 </table>
6722 !! end
6723
6724 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6725 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6726 !! test
6727 Lists should be recognized in an implicit <td> context
6728 !! options
6729 parsoid=wt2html,html2html
6730 !! wikitext
6731 {|
6732 |-
6733 *a
6734 |}
6735 !! html/php
6736 <table>
6737
6738 <ul><li>a</li></ul>
6739 </table>
6740
6741 !! html/php+tidy
6742 <ul>
6743 <li>a</li>
6744 </ul>
6745 !! html/parsoid
6746 <table>
6747 <tr>
6748 <td><ul>
6749 <li>a</li>
6750 </ul></td>
6751 </tr>
6752 </table>
6753 !! end
6754
6755 !! test
6756 Table cells not properly parsed in an implicit-td context
6757 !! wikitext
6758 {|
6759 |-
6760 {{table_attribs_4}} || a || b
6761 |}
6762 !! html/php+tidy
6763 <table>
6764 <tr>
6765 <td style="background-color:#DC241f;" width="10px"></td>
6766 <td>a</td>
6767 <td>b</td>
6768 </tr>
6769 </table>
6770 !! html/parsoid
6771 <table>
6772 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6773 <td style="background-color:#DC241f;" width="10px" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":["",{"template":{"target":{"wt":"table_attribs_4","href":"./Template:Table_attribs_4"},"params":{},"i":0}}," "]}'> </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> a </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> b</td></tr>
6774 </tbody></table>
6775 !! end
6776
6777 !! test
6778 Parsoid: Round-trip tables directly followed by content (bug 51219)
6779 !! options
6780 parsoid=wt2html,wt2wt
6781 !! wikitext
6782 {|
6783 |foo
6784 |} bar
6785
6786 {|
6787 |baz
6788 |}<b>quux</b>
6789 !! html+tidy
6790 <table>
6791 <tr>
6792 <td>foo</td>
6793 </tr>
6794 </table>
6795 <p>bar</p>
6796 <table>
6797 <tr>
6798 <td>baz</td>
6799 </tr>
6800 </table>
6801 <p><b>quux</b></p>
6802 !! end
6803
6804 !! test
6805 Parsoid: Default to a newline after tables in new content (bug 51219)
6806 !! options
6807 parsoid=html2wt
6808 !! html/parsoid
6809 <table><tbody>
6810 <tr><td>foo</td></tr></tbody></table> bar
6811 <table><tbody>
6812 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6813 !! wikitext
6814 {|
6815 |foo
6816 |}
6817 <nowiki> </nowiki>bar
6818 {|
6819 |baz
6820 |}
6821 '''quux'''
6822 !! end
6823
6824 !! test
6825 Parsoid: newline inducing block nodes don't suppress <nowiki>
6826 !! options
6827 parsoid=html2wt
6828 !! html/parsoid
6829 a<h1>foo</h1>
6830 !! wikitext
6831 <nowiki> </nowiki>a
6832
6833 = foo =
6834 !! end
6835
6836 !! test
6837 Parsoid: Row-syntax table headings followed by comment & table cells
6838 !! options
6839 parsoid=wt2html,wt2wt
6840 !! wikitext
6841 {|
6842 ! foo || bar
6843 <!-- foo --> || baz || quux
6844 |}
6845 !! html/php
6846 <table>
6847 <tr>
6848 <th> foo </th>
6849 <th> bar
6850 </th>
6851 <td> baz </td>
6852 <td> quux
6853 </td></tr></table>
6854
6855 !! html/parsoid
6856 <table>
6857 <tbody><tr><th> foo </th><th> bar
6858 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
6859 </tbody></table>
6860 !! end
6861
6862
6863 # PHP throws away the (semi-broken) "foo" class here; Parsoid
6864 # preserves it.
6865 !!test
6866 Parsoid: Recover better from broken table attributes
6867 !!options
6868 parsoid=wt2html
6869 !!wikitext
6870 {| class="foo
6871 | class="bar" |
6872 foo
6873 |}
6874 !!html/php+tidy
6875 <table>
6876 <tr>
6877 <td class="bar">
6878 <p>foo</p>
6879 </td>
6880 </tr>
6881 </table>
6882 !!html/parsoid
6883 <table class="foo">
6884 <tr>
6885 <td class="bar">
6886 <p>foo</p></td></tr>
6887 </tbody></table>
6888 !!end
6889
6890 !! test
6891 Strip unsupported table tags
6892 !! options
6893 parsoid=html2wt
6894 !! html/parsoid
6895 <table>
6896 <thead>
6897 <tr>
6898 <th>Month</th>
6899 <th>Savings</th>
6900 </tr>
6901 </thead>
6902 <tbody>
6903 <tr>
6904 <td>January</td>
6905 <td>$100</td>
6906 </tr>
6907 <tr>
6908 <td>February</td>
6909 <td>$80</td>
6910 </tr>
6911 </tbody>
6912 <tfoot>
6913 <tr>
6914 <td>Sum</td>
6915 <td>$180</td>
6916 </tr>
6917 </tfoot>
6918 </table>
6919 !! wikitext
6920 {|
6921
6922 !Month
6923 !Savings
6924
6925 |January
6926 |$100
6927
6928 |-
6929 |February
6930 |$80
6931
6932 |Sum
6933 |$180
6934
6935 |}
6936 !! end
6937
6938 !!test
6939 Testing serialization after deletion of table cells
6940 !!options
6941 parsoid={
6942 "modes": ["wt2wt", "selser"],
6943 "changes": [
6944 ["#x", "remove"]
6945 ]
6946 }
6947 !!wikitext
6948 {|
6949 !h1 !!h2 !!h3
6950 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
6951 |}
6952 !! wikitext/edited
6953 {|
6954 !h1 !!h2 !!h3
6955 |c2 |||c3
6956 |}
6957 !!end
6958
6959 ###
6960 ### Internal links
6961 ###
6962 !! test
6963 Plain link, capitalized
6964 !! wikitext
6965 [[Main Page]]
6966 !! html
6967 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
6968 </p>
6969 !! end
6970
6971 !! test
6972 Plain link, uncapitalized
6973 !! wikitext
6974 [[main Page]]
6975 !! html
6976 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
6977 </p>
6978 !! end
6979
6980 !! test
6981 Piped link
6982 !! wikitext
6983 [[Main Page|The Main Page]]
6984 !! html
6985 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6986 </p>
6987 !! end
6988
6989 !! test
6990 Piped link with comment in link text
6991 !! wikitext
6992 [[Main Page|The Main<!--front--> Page]]
6993 !! html
6994 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
6995 </p>
6996 !! end
6997
6998 !! test
6999 Piped link with multiple pipe characters in link text
7000 !! wikitext
7001 [[Main Page||The|Main|Page|]]
7002 !! html/php
7003 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7004 </p>
7005 !! html/parsoid
7006 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7007 !! end
7008
7009 !! test
7010 Broken link
7011 !! wikitext
7012 [[Zigzagzogzagzig]]
7013 !! html
7014 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7015 </p>
7016 !! end
7017
7018 !! test
7019 Broken link with fragment
7020 !! wikitext
7021 [[Zigzagzogzagzig#zug]]
7022 !! html
7023 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7024 </p>
7025 !! end
7026
7027 !! test
7028 Special page link with fragment
7029 !! wikitext
7030 [[Special:Version#anchor]]
7031 !! html
7032 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7033 </p>
7034 !! end
7035
7036 !! test
7037 Nonexistent special page link with fragment
7038 !! wikitext
7039 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7040 !! html
7041 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7042 </p>
7043 !! end
7044
7045 !! test
7046 Link with prefix
7047 !! wikitext
7048 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7049 !! html
7050 <p>xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a>, xxx<a href="/wiki/Main_Page" title="Main Page">Main Page</a>, Xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a> XXX<a href="/wiki/Main_Page" title="Main Page">main Page</a>, XXX<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7051 </p>
7052 !! end
7053
7054 !! test
7055 Link with suffix
7056 !! wikitext
7057 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7058 !! html
7059 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>!!!
7060 </p>
7061 !! end
7062
7063 !! article
7064 prefixed article
7065 !! text
7066 Some text
7067 !! endarticle
7068
7069 !! test
7070 Bug 43661: Piped links with identical prefixes
7071 !! wikitext
7072 [[prefixed article|prefixed articles with spaces]]
7073
7074 [[prefixed article|prefixed articlesaoeu]]
7075
7076 [[Main Page|Main Page test]]
7077 !! html
7078 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7079 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7080 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7081 </p>
7082 !! end
7083
7084
7085 !! test
7086 Link with HTML entity in suffix / tail
7087 !! wikitext
7088 [[Main Page]]&quot;, [[Main Page]]&#97;
7089 !! html/php
7090 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>&quot;, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>&#97;
7091 </p>
7092 !! html/parsoid
7093 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;quot;","srcContent":"\""}'>"</span>, <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#97;","srcContent":"a"}'>a</span></p>
7094 !! end
7095
7096 !! test
7097 Link with 3 brackets
7098 !! wikitext
7099 [[[Main Page]]]
7100 !! html
7101 <p>[[[Main Page]]]
7102 </p>
7103 !! end
7104
7105 !! test
7106 Link with 4 brackets
7107 !! wikitext
7108 [[[[Main Page]]]]
7109 !! html
7110 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7111 </p>
7112 !! end
7113
7114 !! test
7115 Piped link with 3 brackets
7116 !! wikitext
7117 [[[main page|the main page]]]
7118 !! html
7119 <p>[[[main page|the main page]]]
7120 </p>
7121 !! end
7122
7123 !! test
7124 Piped link with extlink-like text
7125 !! wikitext
7126 [[Main Page|[bar]]]
7127 [[Main Page|This is a [bar]]]
7128 !! html/php
7129 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7130 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7131 </p>
7132 !! html/parsoid
7133 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7134 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7135 !! end
7136
7137 !! test
7138 Link with multiple pipes
7139 !! wikitext
7140 [[Main Page|The|Main|Page]]
7141 !! html
7142 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7143 </p>
7144 !! end
7145
7146 # Note that parsoid does not munge anchor text; all non-space
7147 # characters are valid in HTML5 ids.
7148 !! test
7149 Anchor containing a #. (bug 63430)
7150 !! wikitext
7151 [[Main Page#And#Link]]
7152 !! html/php
7153 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7154 </p>
7155 !! html/parsoid
7156 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
7157 !! end
7158
7159 !! test
7160 Link to namespaces
7161 !! wikitext
7162 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7163 !! html
7164 <p><a href="/index.php?title=Talk:Parser_testing&amp;action=edit&amp;redlink=1" class="new" title="Talk:Parser testing (page does not exist)">Talk:Parser testing</a>, <a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">Meta:Disclaimers</a>
7165 </p>
7166 !! end
7167
7168 !! test
7169 Link with space in namespace
7170 !! wikitext
7171 [[User talk:Foo bar]]
7172 !! html
7173 <p><a href="/index.php?title=User_talk:Foo_bar&amp;action=edit&amp;redlink=1" class="new" title="User talk:Foo bar (page does not exist)">User talk:Foo bar</a>
7174 </p>
7175 !! end
7176
7177 !! article
7178 MemoryAlpha:AlphaTest
7179 !! text
7180 This is an article in the MemoryAlpha namespace
7181 (which shadows the memoryalpha interwiki link).
7182 !! endarticle
7183
7184 !! test
7185 Namespace takes precedence over interwiki link (bug 51680)
7186 !! wikitext
7187 [[MemoryAlpha:AlphaTest]]
7188 !! html
7189 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7190 </p>
7191 !! end
7192
7193 # The previous test doesn't work correctly in html2*, due to not recognizing the
7194 # link as an internal one. This one checks for the correct behavior.
7195 !! test
7196 Link to namespace preferred over interwiki with correct rel attribute
7197 !! options
7198 parsoid=html2wt,html2html
7199 !! html/parsoid
7200 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7201 !! wikitext
7202 [[MemoryAlpha:AlphaTest]]
7203 !! end
7204
7205 !! test
7206 Piped link to namespace
7207 !! wikitext
7208 [[Meta:Disclaimers|The disclaimers]]
7209 !! html
7210 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">The disclaimers</a>
7211 </p>
7212 !! end
7213
7214 !! test
7215 Link containing }
7216 !! wikitext
7217 [[Usually caused by a typo (oops}]]
7218 !! html
7219 <p>[[Usually caused by a typo (oops}]]
7220 </p>
7221 !! end
7222
7223 !! article
7224 7% Solution
7225 !! text
7226 Just a test of an article title containing a percent.
7227 !! endarticle
7228
7229 !! test
7230 Link containing % (not as a hex sequence)
7231 !! wikitext
7232 [[7% Solution]]
7233 !! html/php
7234 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7235 </p>
7236 !! html/parsoid
7237 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7238 !! end
7239
7240 # note that the parsoid HTML is identical to the previous test output,
7241 # so the previous test ensures that the html2wt mode will generate the
7242 # "not as a hex sequence" wikitext.
7243 !! test
7244 Link containing % as a single hex sequence interpreted to char
7245 !! options
7246 parsoid=wt2wt,wt2html,html2html
7247 !! wikitext
7248 [[7%25 Solution]]
7249 !! html/php
7250 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7251 </p>
7252 !! html/parsoid
7253 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7254 !!end
7255
7256 !! test
7257 Link containing % as a double hex sequence interpreted to hex sequence
7258 !! wikitext
7259 [[7%2525 Solution]]
7260 !! html
7261 <p>[[7%2525 Solution]]
7262 </p>
7263 !!end
7264
7265 # note that parsoid does not munge anchor text; all non-space
7266 # characters are valid in HTML5 anchors.
7267 !! test
7268 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7269 Example for such a section: == < ==
7270 !! wikitext
7271 [[%23%3c]][[%23%3e]]
7272 !! html/php
7273 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7274 </p>
7275 !! html/parsoid
7276 <p><a rel="mw:WikiLink" href="./Main%20Page#%3C" title="Main Page">#&lt;</a><a rel="mw:WikiLink" href="./Main%20Page#%3E" title="Main Page">#></a></p>
7277 !! end
7278
7279 !! test
7280 Link containing "<#" and ">#" as a hex sequences
7281 !! wikitext
7282 [[%3c%23]][[%3e%23]]
7283 !! html
7284 <p>[[%3c%23]][[%3e%23]]
7285 </p>
7286 !! end
7287
7288 !! test
7289 Link containing an equals sign
7290 !! wikitext
7291 [[Special:BookSources/isbn=4-00-026157-6]]
7292 !! html/php
7293 <p><a href="/wiki/Special:BookSources/isbn%3D4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a>
7294 </p>
7295 !! html/parsoid
7296 <p><a rel="mw:WikiLink" href="./Special:BookSources/isbn=4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a></p>
7297 !! end
7298
7299 !! article
7300 Foo~bar
7301 !! text
7302 Just a test of an article title containing a tilde.
7303 !! endarticle
7304
7305 # note that links containing signatures, like [[Foo~~~~]], are
7306 # massaged by the pre-save transform (PST) and so the tildes are never
7307 # seen by the parser.
7308 !! test
7309 Link containing a tilde
7310 !! wikitext
7311 [[Foo~bar]]
7312 !! html/php
7313 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7314 </p>
7315 !! html/parsoid
7316 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7317 !! end
7318
7319 !! test
7320 Link containing double-single-quotes '' (bug 4598)
7321 !! wikitext
7322 [[Lista d''e paise d''o munno]]
7323 !! html/php
7324 <p><a href="/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&amp;action=edit&amp;redlink=1" class="new" title="Lista d''e paise d''o munno (page does not exist)">Lista d''e paise d''o munno</a>
7325 </p>
7326 !! html/parsoid
7327 <p><a rel="mw:WikiLink" href="./Lista_d''e_paise_d''o_munno" title="Lista d''e paise d''o munno">Lista d''e paise d''o munno</a></p>
7328 !! end
7329
7330 !! test
7331 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7332 !! wikitext
7333 Some [[Link|pretty ''italics'' and stuff]]!
7334 !! html/php
7335 <p>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!
7336 </p>
7337 !! html/parsoid
7338 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7339 !! end
7340
7341 !! test
7342 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7343 !! wikitext
7344 ''Some [[Link|pretty ''italics'' and stuff]]!''
7345 !! html
7346 <p><i>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!</i>
7347 </p>
7348 !! end
7349
7350 !! test
7351 Link with double quotes in title part (literal) and alternate part (interpreted)
7352 !! wikitext
7353 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7354
7355 [[''Pentecoste'']]
7356
7357 [[''Pentecoste''|Pentecoste]]
7358
7359 [[''Pentecoste''|''Pentecoste'']]
7360 !! html/php
7361 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Denys_Savchenko_%27%27Pentecoste%27%27.jpg" class="new" title="File:Denys Savchenko &#39;&#39;Pentecoste&#39;&#39;.jpg">File:Denys Savchenko <i>Pentecoste</i>.jpg</a>
7362 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">''Pentecoste''</a>
7363 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">Pentecoste</a>
7364 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)"><i>Pentecoste</i></a>
7365 </p>
7366 !! html/parsoid
7367 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Denys_Savchenko_''Pentecoste''.jpg"><img resource="./File:Denys_Savchenko_''Pentecoste''.jpg" src="./Special:FilePath/Denys_Savchenko_''Pentecoste''.jpg" height="220" width="220"/></a></span></p>
7368 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7369 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7370 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7371 !! end
7372
7373 !! test
7374 Broken image links with HTML captions (bug 39700)
7375 !! wikitext
7376 [[File:Nonexistent|<script></script>]]
7377 [[File:Nonexistent|100x100px|<script></script>]]
7378 [[File:Nonexistent|&lt;]]
7379 [[File:Nonexistent|a<i>b</i>c]]
7380 !! html/php
7381 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7382 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7383 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7384 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7385 </p>
7386 !! html/parsoid
7387 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;script&amp;gt;&amp;lt;/script&amp;gt;"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span>
7388 <span typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;script&amp;gt;&amp;lt;/script&amp;gt;"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="100" width="100"/></a></span>
7389 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=\"{&amp;quot;src&amp;quot;:&amp;quot;&amp;amp;lt;&amp;quot;,&amp;quot;srcContent&amp;quot;:&amp;quot;&lt;&amp;quot;,&amp;quot;dsr&amp;quot;:[107,111,null,null]}\">&amp;lt;&lt;/span>"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span>
7390 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"a&lt;i data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[134,142,3,4]}\">b&lt;/i>c"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span></p>
7391 !! end
7392
7393 !! test
7394 Plain link to URL
7395 !! wikitext
7396 [[http://www.example.com]]
7397 !! html/php
7398 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7399 </p>
7400 !! html/parsoid
7401 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7402 !! end
7403
7404 !! test
7405 Plain link to URL with link text
7406 !! wikitext
7407 [[http://www.example.com Link text]]
7408 !! html
7409 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7410 </p>
7411 !! end
7412
7413 !! test
7414 Plain link to protocol-relative URL
7415 !! wikitext
7416 [[//www.example.com]]
7417 !! html/php
7418 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7419 </p>
7420 !! html/parsoid
7421 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7422 !! end
7423
7424 !! test
7425 Plain link to protocol-relative URL with link text
7426 !! wikitext
7427 [[//www.example.com Link text]]
7428 !! html
7429 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7430 </p>
7431 !! end
7432
7433 !! test
7434 Plain link to page with question mark in title
7435 !! wikitext
7436 [[A?b]]
7437
7438 [[A?b|Baz]]
7439 !! html
7440 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7441 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7442 </p>
7443 !! end
7444
7445
7446 # I'm fairly sure the expected result here is wrong.
7447 # We want these to be URL links, not pseudo-pages with URLs for titles....
7448 # However the current output is also pretty screwy.
7449 #
7450 # ----
7451 # I'm changing it to match the current output--it arguably makes more
7452 # sense in the light of the test above. Old expected result was:
7453 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7454 #</p>
7455 # But I think this test is bordering on "garbage in, garbage out" anyway.
7456 # -- wtm
7457 !! test
7458 Piped link to URL
7459 !! wikitext
7460 Piped link to URL: [[http://www.example.com|an example URL]]
7461 !! html/php
7462 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7463 </p>
7464 !! html/parsoid
7465 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7466 !! end
7467
7468 !! test
7469 BUG 2: [[page|http://url/]] should link to page, not http://url/
7470 !! wikitext
7471 [[Main Page|http://url/]]
7472 !! html/php
7473 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7474 </p>
7475 !! html/parsoid
7476 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7477 !! end
7478
7479 # Parsoid does not mark self-links, by design.
7480 !! test
7481 BUG 337: Escaped self-links should be bold
7482 !! options
7483 title=[[Bug462]]
7484 !! wikitext
7485 [[Bu&#103;462]] [[Bug462]]
7486 !! html/php
7487 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7488 </p>
7489 !! html/php+tidy
7490 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7491 !! html/parsoid
7492 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7493 !! end
7494
7495 !! test
7496 Self-link to section should not be bold
7497 !! options
7498 title=[[Main Page]]
7499 !! wikitext
7500 [[Main Page#section]]
7501 !! html
7502 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7503 </p>
7504 !! end
7505
7506 !! article
7507 00
7508 !! text
7509 This is 00.
7510 !! endarticle
7511
7512 !!test
7513 Self-link to numeric title
7514 !!options
7515 title=[[0]]
7516 !! wikitext
7517 [[0]]
7518 !! html
7519 <p><strong class="selflink">0</strong>
7520 </p>
7521 !!end
7522
7523 !!test
7524 Link to numeric-equivalent title
7525 !!options
7526 title=[[0]]
7527 !! wikitext
7528 [[00]]
7529 !! html
7530 <p><a href="/wiki/00" title="00">00</a>
7531 </p>
7532 !!end
7533
7534 !! test
7535 <nowiki> inside a link
7536 !! wikitext
7537 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7538 !! html
7539 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7540 </p>
7541 !! end
7542
7543 !! test
7544 Non-breaking spaces in title
7545 !! wikitext
7546 [[&nbsp; Main &nbsp; Page &nbsp;]]
7547 !! html
7548 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7549 </p>
7550 !!end
7551
7552 !! test
7553 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7554 !! options
7555 language=ca
7556 !! wikitext
7557 '''[[Main Page]]'''
7558 !! html
7559 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7560 </p>
7561 !! end
7562
7563 !! test
7564 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7565 !! options
7566 language=ca
7567 !! wikitext
7568 ''[[Main Page]]''
7569 !! html
7570 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7571 </p>
7572 !! end
7573
7574 !! test
7575 Internal link with en linktrail: no apostrophes (bug 27473)
7576 !! options
7577 language=en
7578 !! wikitext
7579 [[Something]]'nice
7580 !! html
7581 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
7582 </p>
7583 !! end
7584
7585 !! test
7586 Internal link with ca linktrail with apostrophes (bug 27473)
7587 !! options
7588 language=ca
7589 !! wikitext
7590 [[Something]]'nice
7591 !! html
7592 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
7593 </p>
7594 !! end
7595
7596 !! test
7597 Internal link with kaa linktrail with apostrophes (bug 27473)
7598 !! options
7599 language=kaa
7600 !! wikitext
7601 [[Something]]'nice
7602 !! html
7603 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (bet ele jaratılmag'an)">Something'nice</a>
7604 </p>
7605 !! end
7606
7607 !! test
7608 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
7609 !! wikitext
7610 [[User:Foo/Test/63636:Bar|Test]]
7611 !! html/php
7612 <p><a href="/index.php?title=User:Foo/Test/63636:Bar&amp;action=edit&amp;redlink=1" class="new" title="User:Foo/Test/63636:Bar (page does not exist)">Test</a>
7613 </p>
7614 !! html/parsoid
7615 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
7616 !! end
7617
7618 !! test
7619 Purely hash wikilink
7620 !! options
7621 title=[[User:test/123]]
7622 !! wikitext
7623 [[#a|b]]
7624 !! html/php
7625 <p><a href="#a">b</a>
7626 </p>
7627 !! html/parsoid
7628 <p><a rel="mw:WikiLink" href="./User:Test/123#a" data-parsoid='{"stx":"piped","a":{"href":"./User:Test/123#a"},"sa":{"href":"#a"}}'>b</a></p>
7629 !! end
7630
7631 !! test
7632 1. Interaction of linktrail and template encapsulation
7633 !! options
7634 parsoid
7635 !! wikitext
7636 {{echo|[[Foo]]}}l
7637 !! html
7638 <p><a rel="mw:WikiLink" href="Foo" title="Foo" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Foo]]"}},"i":0}},"l"]}'>Fool</a></p>
7639 !! end
7640
7641 !! test
7642 2. Interaction of linktrail and template encapsulation
7643 !! options
7644 parsoid
7645 !! wikitext
7646 {{echo|Some [[Fool]]}}s
7647 !! html
7648 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]"}},"i":0}},"s"]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>Some </span><a rel="mw:WikiLink" href="./Fool" title="Fool" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a></p>
7649 !! end
7650
7651 !! test
7652 3. Interaction of linktrail and template encapsulation
7653 !! options
7654 parsoid
7655 !! wikitext
7656 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
7657 !! html
7658 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]s are &#39;&#39;&#39;bold and foolish&#39;&#39;&#39;"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>Some <a rel="mw:WikiLink" href="./Fool" title="Fool" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a> are <b>bold and foolish</b></p>
7659 !! end
7660
7661 !! article
7662 Söfnuður
7663 !! text
7664 Test.
7665 !! endarticle
7666
7667 !! test
7668 Internal link with is link prefix
7669 !! options
7670 language=is
7671 !! wikitext
7672 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
7673 !! html
7674 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
7675 </p>
7676 !! end
7677
7678 !! article
7679 Mótmælendatrú
7680 !! text
7681 Test.
7682 !! endarticle
7683
7684 !! test
7685 Internal link with is link trail and link prefix
7686 !! options
7687 language=is
7688 !! wikitext
7689 [[mótmælendatrú|xxx]]ar
7690 [[mótmælendatrú]]ar
7691 mótmælenda[[söfnuður]]
7692 mótmælenda[[söfnuður|söfnuðir]]
7693 mótmælenda[[söfnuður|söfnuðir]]xxx
7694 !! html
7695 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
7696 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
7697 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
7698 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
7699 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
7700 </p>
7701 !! end
7702
7703 !! test
7704 Parsoid link trail escaping
7705 !! options
7706 parsoid=html2wt,html2html
7707 !! html/parsoid
7708 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
7709 !! wikitext
7710 [[apple]]<nowiki/>s
7711 !! end
7712
7713 !! test
7714 Parsoid link prefix escaping
7715 !! options
7716 language=is
7717 parsoid=html2wt,html2html
7718 !! html/parsoid
7719 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
7720 !! wikitext
7721 Aðrir mótmælenda<nowiki/>[[söfnuður]]
7722 !! end
7723
7724 !! test
7725 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
7726 !! wikitext
7727 [[Foo| bar]]
7728
7729 [[Foo| ''bar'']]
7730
7731 [http://wp.org foo]
7732
7733 [http://wp.org ''foo'']
7734 !! html
7735 <p><a href="/wiki/Foo" title="Foo"> bar</a>
7736 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
7737 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
7738 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
7739 </p>
7740 !! end
7741
7742 !! test
7743 Parsoid: Scoped parsing should handle mixed transclusions and plain text
7744 !! options
7745 parsoid
7746 !! wikitext
7747 [[Foo|{{echo|a}} b {{echo|c}}]]
7748 !! html
7749 <p><a rel="mw:WikiLink" href="Foo" title="Foo"><span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}}]}'>a</span> b <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"c"}},"i":0}}]}'>c</span></a></p>
7750 !! end
7751
7752 !! test
7753 Link with angle bracket after anchor
7754 !! wikitext
7755 [[Foo#<bar>]]
7756 !! html/php
7757 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
7758 </p>
7759 !! html/parsoid
7760 <p><a rel="mw:WikiLink" href="./Foo#%3Cbar%3E" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo#%3Cbar%3E"},"sa":{"href":"Foo#&lt;bar>"}}'>Foo#&lt;bar></a></p>
7761 !! end
7762
7763 ###
7764 ### Interwiki links (see maintenance/interwiki.sql)
7765 ###
7766
7767 !! test
7768 Inline interwiki link
7769 !! options
7770 parsoid=wt2html,wt2wt,html2html
7771 !! wikitext
7772 [[MeatBall:SoftSecurity]]
7773 !! html/php
7774 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
7775 </p>
7776 !! html/parsoid
7777 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
7778 !! end
7779
7780 !! test
7781 Inline interwiki link with empty title (bug 2372)
7782 !! options
7783 parsoid=wt2html,wt2wt,html2html
7784 !! wikitext
7785 [[MeatBall:]]
7786 !! html/php
7787 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
7788 </p>
7789 !! html/parsoid
7790 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
7791 !! end
7792
7793 !! test
7794 Interwiki link encoding conversion (bug 1636)
7795 !! wikitext
7796 *[[Wikipedia:ro:Olteni&#0355;a]]
7797 *[[Wikipedia:ro:Olteni&#355;a]]
7798 !! html
7799 <ul><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a></li>
7800 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a></li></ul>
7801
7802 !! html+tidy
7803 <ul>
7804 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
7805 <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
7806 </ul>
7807 !! end
7808
7809 !! test
7810 Interwiki link with fragment (bug 2130)
7811 !! wikitext
7812 [[MeatBall:SoftSecurity#foo]]
7813 !! html
7814 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
7815 </p>
7816 !! end
7817
7818 # Ideally the wikipedia: prefix here should be proto-relative too
7819 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
7820 # define the 'en' prefix, and originally the test used 'wikipedia',
7821 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
7822 # article.
7823 !! test
7824 Different interwiki prefixes mapping to the same URL
7825 !! wikitext
7826 [[:en:Foo]]
7827
7828 [[:en:Foo|Foo]]
7829
7830 [[wikipedia:Foo]]
7831
7832 [[:wikipedia:Foo|Foo]]
7833
7834 [[wikipedia:en:Foo]]
7835
7836 [[:wikipedia:en:Foo]]
7837
7838 [[ wikiPEdia :Foo]]
7839 !! html/parsoid
7840 <p><a rel="mw:ExtLink" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}' title="en:Foo">en:Foo</a></p>
7841
7842 <p><a rel="mw:ExtLink" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}' title="en:Foo">Foo</a></p>
7843
7844 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true}' title="wikipedia:Foo">wikipedia:Foo</a></p>
7845
7846 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":":wikipedia:Foo"},"isIW":true}' title="wikipedia:Foo">Foo</a></p>
7847
7848 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":"wikipedia:en:Foo"},"isIW":true}' title="wikipedia:en:Foo">wikipedia:en:Foo</a></p>
7849
7850 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":":wikipedia:en:Foo"},"isIW":true}' title="wikipedia:en:Foo">wikipedia:en:Foo</a></p>
7851
7852 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":" wikiPEdia :Foo"},"isIW":true}' title="wikipedia:Foo"> wikiPEdia :Foo</a></p>
7853 !! end
7854
7855 !! test
7856 Interwiki links that cannot be represented in wiki syntax
7857 !! wikitext
7858 [[meatball:ok]]
7859 [[meatball:ok#foo|ok with fragment]]
7860 [[meatball:ok_as_well?|ok ending with ? mark]]
7861 [http://de.wikipedia.org/wiki/Foo?action=history has query]
7862 [http://de.wikipedia.org/wiki/#foo is just fragment]
7863
7864 !! html/php
7865 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
7866 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
7867 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well%3F" class="extiw" title="meatball:ok as well?">ok ending with ? mark</a>
7868 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7869 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
7870 </p>
7871 !! html/parsoid
7872 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
7873 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
7874 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well?" title="meatball:ok as well?">ok ending with ? mark</a>
7875 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
7876 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
7877 !! end
7878
7879 !! test
7880 Interwiki links: trail
7881 !! wikitext
7882 [[wikipedia:Foo|Ba]]r
7883 !! html/php
7884 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
7885 </p>
7886 !! html/parsoid
7887 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true,"tail":"r"}' title="wikipedia:Foo">Bar</a></p>
7888 !! end
7889
7890 !! test
7891 Local interwiki link
7892 !! options
7893 parsoid=wt2html,wt2wt,html2html
7894 !! wikitext
7895 [[local:Template:Foo]]
7896 !! html/php
7897 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
7898 </p>
7899 !! html/parsoid
7900 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
7901 !! end
7902
7903 # Parsoid does not mark self-links, by design.
7904 !! test
7905 Local interwiki link: self-link to current page
7906 !! options
7907 title=[[Main Page]]
7908 parsoid=wt2html,wt2wt,html2html
7909 !! wikitext
7910 [[local:Main Page]]
7911 !! html/php
7912 <p><strong class="selflink">local:Main Page</strong>
7913 </p>
7914 !! html/parsoid
7915 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
7916 !! end
7917
7918 !! test
7919 Local interwiki link: prefix only (bug 64167)
7920 !! options
7921 parsoid=wt2html,wt2wt,html2html
7922 !! wikitext
7923 [[local:]]
7924 !! html/php
7925 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
7926 </p>
7927 !! html/parsoid
7928 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
7929 !! end
7930
7931 !! test
7932 Local interwiki link: with additional interwiki prefix (bug 61357)
7933 !! options
7934 parsoid=wt2html,wt2wt,html2html
7935 !! wikitext
7936 [[local:meatball:Hello]]
7937 !! html/php
7938 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
7939 </p>
7940 !! html/parsoid
7941 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
7942 !! end
7943
7944 !! test
7945 Multiple local interwiki link prefixes
7946 !! wikitext
7947 [[local:local:local:local:mi:local:Foo]]
7948 !! options
7949 parsoid=wt2html,wt2wt,html2html
7950 !! html/php
7951 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
7952 </p>
7953 !! html/parsoid
7954 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
7955 !! end
7956
7957 ###
7958 ### Interlanguage links
7959 ### Language links (so that searching for '### language' matches..)
7960 ###
7961
7962 !! test
7963 Interlanguage link
7964 !! options
7965 parsoid=wt2html,wt2wt,html2html
7966 !! wikitext
7967 Blah blah blah
7968 [[zh:Chinese]]
7969 !! html/php
7970 <p>Blah blah blah
7971 </p>
7972 !! html/parsoid
7973 <p>Blah blah blah</p>
7974 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7975 !! end
7976
7977 !! test
7978 Interlanguage link with spacing
7979 !! options
7980 parsoid=wt2html,wt2wt,html2html
7981 !! wikitext
7982 Blah blah blah
7983 [[ zh : Chinese ]]
7984 !! html/php
7985 <p>Blah blah blah
7986 </p>
7987 !! html/parsoid
7988 <p>Blah blah blah</p>
7989 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
7990 !! end
7991
7992 !! test
7993 Double interlanguage link
7994 !! options
7995 parsoid=wt2html,wt2wt,html2html
7996 !! wikitext
7997 Blah blah blah
7998 [[es:Spanish]]
7999 [[zh:Chinese]]
8000 !! html/php
8001 <p>Blah blah blah
8002 </p>
8003 !! html/parsoid
8004 <p>Blah blah blah</p>
8005 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8006 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8007 !! end
8008
8009 !! test
8010 Interlanguage link variations
8011 !! options
8012 parsoid=wt2html,wt2wt,html2html
8013 !! wikitext
8014 Blah blah blah
8015 [[ es :Spanish]]
8016 [[ ZH :Chinese]]
8017 [[es:Foo_bar]]
8018 !! html/php
8019 <p>Blah blah blah
8020 </p>
8021 !! html/parsoid
8022 <p>Blah blah blah</p>
8023 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8024 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8025 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8026 !! end
8027
8028 !! test
8029 Space and question mark encoding in interlanguage links (T95473)
8030 !! options
8031 parsoid=wt2html,wt2wt,html2html
8032 !! wikitext
8033 Blah blah blah
8034 [[es:Foo bar?]]
8035 !! html/php
8036 <p>Blah blah blah
8037 </p>
8038 !! html/parsoid
8039 <p>Blah blah blah</p>
8040 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8041 !! end
8042
8043 !! test
8044 Interlanguage link, with prefix links
8045 !! options
8046 language=ln
8047 !! wikitext
8048 Blah blah blah
8049 [[zh:Chinese]]
8050 !! html/php
8051 <p>Blah blah blah
8052 </p>
8053 !! html/parsoid
8054 <p>Blah blah blah</p>
8055 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8056 !! end
8057
8058 !! test
8059 Double interlanguage link, with prefix links (bug 8897)
8060 !! options
8061 language=ln
8062 !! wikitext
8063 Blah blah blah
8064 [[es:Spanish]]
8065 [[zh:Chinese]]
8066 !! html/php
8067 <p>Blah blah blah
8068 </p>
8069 !! html/parsoid
8070 <p>Blah blah blah</p>
8071 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8072 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8073 !! end
8074
8075 !! test
8076 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8077 !! wikitext
8078 Blah blah blah
8079 [[mul:Article]]
8080 !! html/php
8081 <p>Blah blah blah
8082 </p>
8083 !! html/parsoid
8084 <p>Blah blah blah</p>
8085 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8086 !! end
8087
8088 !! test
8089 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8090 !! options
8091 language=ln
8092 !! wikitext
8093 [[WW&nbsp;II]]
8094 !! html
8095 <p><a href="/index.php?title=WW_II&amp;action=edit&amp;redlink=1" class="new" title="WW II (lonkásá ezalí tɛ̂)">WW&#160;II</a>
8096 </p>
8097 !! end
8098
8099 !! test
8100 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8101 !! options
8102 parsoid=html2wt
8103 !! html/parsoid
8104 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8105 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8106 !! wikitext
8107 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8108
8109 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
8110 !! end
8111
8112 !! test
8113 Parsoid: handle constructor well
8114 !! wikitext
8115 [[constructor]]
8116
8117 [[constructor:foo]]
8118 !! html/php
8119 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8120 </p><p><a href="/index.php?title=Constructor:foo&amp;action=edit&amp;redlink=1" class="new" title="Constructor:foo (page does not exist)">constructor:foo</a>
8121 </p>
8122 !! html/parsoid
8123 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid="{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;./Constructor&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;constructor&quot;}}">constructor</a></p>
8124
8125 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid="{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;./Foo&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;constructor:foo&quot;}}">constructor:foo</a></p>
8126 !! end
8127
8128 !! article
8129 ko:
8130 !! text
8131 Test.
8132 !! endarticle
8133
8134 # Note that `ko` isn't a known interlanguage prefix
8135 !! test
8136 Parsoid: recognize interlanguage links without a target page
8137 !! options
8138 ill
8139 !! wikitext
8140 [[es:]]
8141
8142 [[ko:]]
8143 !! html/php
8144 es:
8145 !! html/parsoid
8146 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8147
8148 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8149 !! end
8150
8151 # Note that `ko` isn't a known interwiki prefix
8152 !! test
8153 Parsoid: recognize interwiki links without a target page
8154 !! options
8155 parsoid=wt2html,wt2wt,html2html
8156 !! wikitext
8157 [[:es:]]
8158
8159 [[:ko:]]
8160 !! html/php
8161 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8162 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8163 </p>
8164 !! html/parsoid
8165 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8166 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8167 !! end
8168
8169 !! test
8170 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8171 !! wikitext
8172 [[mi:Foo]]
8173 !! html/php
8174 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8175 </p>
8176 !! html/parsoid
8177 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8178 !! end
8179
8180 !! test
8181 Interlanguage link with preceding local interwiki link (bug 68085)
8182 !! options
8183 parsoid=wt2html,wt2wt,html2html
8184 !! wikitext
8185 Blah blah blah
8186 [[local:es:Spanish]]
8187 !! html/php
8188 <p>Blah blah blah
8189 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8190 </p>
8191 !! html/parsoid
8192 <p>Blah blah blah
8193 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8194 !! end
8195
8196 !! test
8197 Looks like an interlanguage link, but is actually a local interwiki
8198 !! options
8199 parsoid=wt2html,wt2wt,html2html
8200 !! wikitext
8201 Blah blah blah
8202 [[mi:Template:Foo]]
8203 !! html/php
8204 <p>Blah blah blah
8205 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8206 </p>
8207 !! html/parsoid
8208 <p>Blah blah blah
8209 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8210 !! end
8211
8212 ###
8213 ### Redirects, Parsoid-only
8214 ###
8215
8216 !! test
8217 1. Simple redirect to page
8218 !! wikitext
8219 #REDIRECT [[Main Page]]
8220 !! html/parsoid
8221 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8222 !! end
8223
8224 !! test
8225 2. Other redirect variants
8226 !! wikitext
8227 #REDIRECT [[Main_Page]]
8228 !! html/parsoid
8229 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8230 !! end
8231
8232 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8233 # This tests the Parsoid bail-out code.
8234 !! test
8235 3. Other redirect variants
8236 !! wikitext
8237 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8238 !! html/parsoid
8239 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8240 !! end
8241
8242 !! test
8243 4. Redirect to a templated destination
8244 !! wikitext
8245 #REDIRECT [[{{echo|Foo}}bar]]
8246 !! html/parsoid
8247 <link typeof="mw:ExpandedAttrs" rel="mw:PageProp/redirect" href="./Foobar" data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[12,24,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;Foo&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">Foo&lt;/span>bar"}]]}'/>
8248 !! end
8249
8250 !! test
8251 Empty redirect
8252 !! options
8253 parsoid=wt2html,wt2wt
8254 !! wikitext
8255 #REDIRECT [[]]
8256 !! html/parsoid
8257 <ol>
8258 <li>REDIRECT [[]]</li></ol>
8259 !! end
8260
8261 !! test
8262 Optional colon in #REDIRECT
8263 !! options
8264 # the colon is archaic syntax. we support it for wt2html, but we
8265 # don't care that it roundtrips back to the modern syntax.
8266 parsoid=wt2html,html2html
8267 !! wikitext
8268 #REDIRECT:[[Main Page]]
8269 !! html/parsoid
8270 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8271 !! end
8272
8273 !! test
8274 Whitespace in #REDIRECT with optional colon
8275 !! options
8276 # the colon and gratuitous whitespace is archaic syntax. we support
8277 # it for wt2html, but we don't care that it roundtrips back to the
8278 # modern syntax (without extra whitespace)
8279 parsoid=wt2html,html2html
8280 !! wikitext
8281
8282 #REDIRECT
8283 :
8284 [[Main Page]]
8285 !! html/parsoid
8286 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8287 !! end
8288
8289 !! test
8290 Piped link in #REDIRECT
8291 !! options
8292 # content after piped link is ignored. we support this syntax,
8293 # but don't care that the piped link is lost when we roundtrip this.
8294 parsoid=wt2html
8295 !! wikitext
8296 #REDIRECT [[Main Page|bar]]
8297 !! html/parsoid
8298 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8299 !! end
8300
8301 !! test
8302 Redirect to category (T104502)
8303 !! options
8304 parsoid=wt2html,wt2wt
8305 !! wikitext
8306 #REDIRECT [[Category:Foo]]
8307 !! html/parsoid
8308 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8309 !! end
8310
8311 !! test
8312 Redirect to category with URL encoding (T104502)
8313 !! options
8314 parsoid=wt2html
8315 !! wikitext
8316 #REDIRECT [[Category%3AFoo]]
8317 !! html/parsoid
8318 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8319 !! end
8320
8321 !! test
8322 Redirect to category page
8323 !! wikitext
8324 #REDIRECT [[:Category:Foo]]
8325 !! html/parsoid
8326 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8327 !! end
8328
8329 !! test
8330 Redirect to image page (1)
8331 !! wikitext
8332 #REDIRECT [[File:Wiki.png]]
8333 !! html/parsoid
8334 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8335 !! end
8336
8337 !! test
8338 Redirect to image page (2)
8339 !! wikitext
8340 #REDIRECT [[Image:Wiki.png]]
8341 !! html/parsoid
8342 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8343 !! end
8344
8345 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8346 # Next test confirms this.
8347 !! test
8348 Redirect to language (1) (T104918)
8349 !! options
8350 parsoid=wt2html,wt2wt,html2html
8351 !! wikitext
8352 #REDIRECT [[en:File:Wiki.png]]
8353 !! html/parsoid
8354 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8355 !! end
8356
8357 !! test
8358 Redirect to language (2) (T104918)
8359 !! wikitext
8360 #REDIRECT [[:en:File:Wiki.png]]
8361 !! html/parsoid
8362 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8363 !! end
8364
8365 !! test
8366 Redirect to interwiki (T104918)
8367 !! wikitext
8368 #REDIRECT [[meatball:File:Wiki.png]]
8369 !! html/parsoid
8370 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8371 !! end
8372
8373 !! test
8374 Non-English #REDIRECT
8375 !! options
8376 language=is
8377 !! wikitext
8378 #TILVÍSUN [[Main Page]]
8379 !! html/parsoid
8380 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8381 !! end
8382
8383 !! test
8384 Redirect syntax under text isn't considered a redirect
8385 !! wikitext
8386 some text
8387 #redirect [[Main Page]]
8388 !! html/parsoid
8389 <p>some text</p>
8390 <ol data-parsoid='{}'><li data-parsoid='{}'>redirect <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'>Main Page</a></li></ol>
8391 !! end
8392
8393 # FIXME: Should hoist the redirect to the top of the page and ensure there
8394 # is only one.
8395 !! test
8396 New redirect
8397 !! options
8398 parsoid=html2wt
8399 !! html/parsoid
8400 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8401 !! wikitext
8402 Foo
8403 #REDIRECT [[Foo]]
8404 !! end
8405
8406 ##
8407 ## XHTML tidiness
8408 ###
8409
8410 !! test
8411 <br> to <br />
8412 !! wikitext
8413 1<br>2<br />3
8414 !! html
8415 <p>1<br />2<br />3
8416 </p>
8417 !! end
8418
8419 !! test
8420 Broken br tag sanitization
8421 !! wikitext
8422 </br>
8423 !! html/php
8424 <p>&lt;/br&gt;
8425 </p>
8426 !! end
8427
8428 # TODO: Fix html2html mode (bug 51055)!
8429 !! test
8430 Parsoid: Broken br tag recognition
8431 !! options
8432 parsoid=wt2html
8433 !! wikitext
8434 </br>
8435
8436 <br/ >
8437 !! html+tidy
8438 <p><br /></p>
8439 <p><br /></p>
8440 !! end
8441
8442 !! test
8443 Incorrecly removing closing slashes from correctly formed XHTML
8444 !! wikitext
8445 <br style="clear:both;" />
8446 !! html
8447 <p><br style="clear:both;" />
8448 </p>
8449 !! end
8450
8451 !! test
8452 Failing to transform badly formed HTML into correct XHTML
8453 !! wikitext
8454 <br style="clear: left;">
8455 <br style="clear: right;">
8456 <br style="clear: both;">
8457 !! html
8458 <p><br style="clear: left;" />
8459 <br style="clear: right;" />
8460 <br style="clear: both;" />
8461 </p>
8462 !!end
8463
8464 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8465 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8466 !! test
8467 Handling html with a div self-closing tag
8468 !! wikitext
8469 <div title />
8470 <div title/>
8471 <div title/ >
8472 <div title=bar />
8473 <div title=bar/>
8474 <div title=bar/ >
8475 !! html/php
8476 <p>&lt;div title /&gt;
8477 &lt;div title/&gt;
8478 </p>
8479 <div>
8480 <p>&lt;div title=bar /&gt;
8481 &lt;div title=bar/&gt;
8482 </p>
8483 <div title="bar/"></div>
8484 </div>
8485
8486 !! html/parsoid
8487 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8488 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8489 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
8490 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8491 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8492 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
8493 !! end
8494
8495 !! test
8496 Handling html with a br self-closing tag
8497 !! wikitext
8498 <br title />
8499 <br title/>
8500 <br title/ >
8501 <br title=bar />
8502 <br title=bar/>
8503 <br title=bar/ >
8504 !! html/php
8505 <p><br title="" />
8506 <br title="" />
8507 <br />
8508 <br title="bar" />
8509 <br title="bar" />
8510 <br title="bar/" />
8511 </p>
8512 !! html/parsoid
8513 <p><br title="" />
8514 <br title="" />
8515 <br title="" />
8516 <br title="bar" />
8517 <br title="bar" />
8518 <br title="bar/" />
8519 </p>
8520 !! end
8521
8522 !! test
8523 Horizontal ruler (should it add that extra space?)
8524 !! wikitext
8525 <hr>
8526 <hr >
8527 foo <hr
8528 > bar
8529 !! html+tidy
8530 <hr />
8531 <hr />
8532 <p>foo</p>
8533 <hr />
8534 <p>bar</p>
8535 !! end
8536
8537 !! test
8538 Horizontal ruler -- 4+ dashes render hr
8539 !! wikitext
8540 ----
8541 !! html
8542 <hr />
8543
8544 !! end
8545
8546 !! test
8547 Horizontal ruler -- eats additional dashes on the same line
8548 !! wikitext
8549 ---------
8550 !! html
8551 <hr />
8552
8553 !! end
8554
8555 !! test
8556 Horizontal ruler -- does not collapse dashes on consecutive lines
8557 !! wikitext
8558 ----
8559 ----
8560 !! html
8561 <hr />
8562 <hr />
8563
8564 !! end
8565
8566 !! test
8567 Horizontal ruler -- <4 dashes render as plain text
8568 !! wikitext
8569 ---
8570 !! html
8571 <p>---
8572 </p>
8573 !! end
8574
8575 !! test
8576 Horizontal ruler -- Supports content following dashes on same line
8577 !! wikitext
8578 ---- Foo
8579 !! html
8580 <hr /> Foo
8581
8582 !! html+tidy
8583 <hr />
8584 <p>Foo</p>
8585 !! end
8586
8587 ###
8588 ### Block-level elements
8589 ###
8590 !! test
8591 Common list
8592 !! wikitext
8593 *Common list
8594 * item 2
8595 *item 3
8596 !! html
8597 <ul><li>Common list</li>
8598 <li> item 2</li>
8599 <li>item 3</li></ul>
8600
8601 !! end
8602
8603 !! test
8604 Numbered list
8605 !! wikitext
8606 #Numbered list
8607 #item 2
8608 # item 3
8609 !! html
8610 <ol><li>Numbered list</li>
8611 <li>item 2</li>
8612 <li> item 3</li></ol>
8613
8614 !! end
8615
8616 !! test
8617 Mixed list
8618 !! wikitext
8619 *Mixed list
8620 *# with numbers
8621 ** and bullets
8622 *# and numbers
8623 *bullets again
8624 **bullet level 2
8625 ***bullet level 3
8626 ***#Number on level 4
8627 **bullet level 2
8628 **#Number on level 3
8629 **#Number on level 3
8630 *#number level 2
8631 *Level 1
8632 *** Level 3
8633 #** Level 3, but ordered
8634 !! html
8635 <ul><li>Mixed list
8636 <ol><li> with numbers</li></ol>
8637 <ul><li> and bullets</li></ul>
8638 <ol><li> and numbers</li></ol></li>
8639 <li>bullets again
8640 <ul><li>bullet level 2
8641 <ul><li>bullet level 3
8642 <ol><li>Number on level 4</li></ol></li></ul></li>
8643 <li>bullet level 2
8644 <ol><li>Number on level 3</li>
8645 <li>Number on level 3</li></ol></li></ul>
8646 <ol><li>number level 2</li></ol></li>
8647 <li>Level 1
8648 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
8649 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
8650
8651 !! end
8652
8653 !! test
8654 Nested lists 1
8655 !! wikitext
8656 *foo
8657 **bar
8658 !! html
8659 <ul><li>foo
8660 <ul><li>bar</li></ul></li></ul>
8661
8662 !! end
8663
8664 !! test
8665 Nested lists 2
8666 !! wikitext
8667 **foo
8668 *bar
8669 !! html
8670 <ul><li><ul><li>foo</li></ul></li>
8671 <li>bar</li></ul>
8672
8673 !! end
8674
8675 !! test
8676 Nested lists 3 (first element empty)
8677 !! wikitext
8678 *
8679 **bar
8680 !! html
8681 <ul><li>
8682 <ul><li>bar</li></ul></li></ul>
8683
8684 !! end
8685
8686 !! test
8687 Nested lists 4 (first element empty)
8688 !! wikitext
8689 **
8690 *bar
8691 !! html
8692 <ul><li><ul><li></li></ul></li>
8693 <li>bar</li></ul>
8694
8695 !! end
8696
8697 !! test
8698 Nested lists 5 (both elements empty)
8699 !! wikitext
8700 **
8701 *
8702 !! html
8703 <ul><li><ul><li></li></ul></li>
8704 <li></li></ul>
8705
8706 !! end
8707
8708 !! test
8709 Nested lists 6 (both elements empty)
8710 !! wikitext
8711 *
8712 **
8713 !! html
8714 <ul><li>
8715 <ul><li></li></ul></li></ul>
8716
8717 !! end
8718
8719 !! test
8720 Nested lists 7 (skip initial nesting levels)
8721 !! wikitext
8722 *** foo
8723 !! html
8724 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
8725
8726 !! end
8727
8728 !! test
8729 Nested lists 8 (multiple nesting transitions)
8730 !! wikitext
8731 * foo
8732 *** bar
8733 ** baz
8734 * boo
8735 !! html
8736 <ul><li> foo
8737 <ul><li><ul><li> bar</li></ul></li>
8738 <li> baz</li></ul></li>
8739 <li> boo</li></ul>
8740
8741 !! end
8742
8743 !! test
8744 Nested lists 9 (extension interaction)
8745 !! options
8746 parsoid
8747 !! wikitext
8748 *<references />
8749 !! html/parsoid
8750 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
8751 !! end
8752
8753 !! test
8754 1. Lists with start-of-line-transparent tokens before bullets: Comments
8755 !! wikitext
8756 *foo
8757 *<!--cmt-->bar
8758 <!--cmt-->*baz
8759 !! html
8760 <ul><li>foo</li>
8761 <li>bar</li>
8762 <li>baz</li></ul>
8763
8764 !! end
8765
8766 !! test
8767 2. Lists with start-of-line-transparent tokens before bullets: Template close
8768 !! wikitext
8769 *foo {{echo|bar
8770 }}*baz
8771 !! html
8772 <ul><li>foo bar</li>
8773 <li>baz</li></ul>
8774
8775 !! end
8776
8777 !! test
8778 List items are not parsed correctly following a <pre> block (bug 785)
8779 !! wikitext
8780 * <pre>foo</pre>
8781 * <pre>bar</pre>
8782 * zar
8783 !! html/php
8784 <ul><li> <pre>foo</pre></li>
8785 <li> <pre>bar</pre></li>
8786 <li> zar</li></ul>
8787
8788 !! html/parsoid
8789 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
8790 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
8791 <li> zar</li></ul>
8792 !! end
8793
8794 !! test
8795 List items from template
8796 !! wikitext
8797
8798 {{inner list}}
8799 * item 2
8800
8801 * item 0
8802 {{inner list}}
8803 * item 2
8804
8805 * item 0
8806 * notSOL{{inner list}}
8807 * item 2
8808 !! html
8809 <ul><li> item 1</li>
8810 <li> item 2</li></ul>
8811 <ul><li> item 0</li>
8812 <li> item 1</li>
8813 <li> item 2</li></ul>
8814 <ul><li> item 0</li>
8815 <li> notSOL</li>
8816 <li> item 1</li>
8817 <li> item 2</li></ul>
8818
8819 !! end
8820
8821 !! test
8822 List interrupted by empty line or heading
8823 !! wikitext
8824 * foo
8825
8826 ** bar
8827 == A heading ==
8828 * Another list item
8829 !! html
8830 <ul><li> foo</li></ul>
8831 <ul><li><ul><li> bar</li></ul></li></ul>
8832 <h2><span class="mw-headline" id="A_heading">A heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
8833 <ul><li> Another list item</li></ul>
8834
8835 !!end
8836
8837 !!test
8838 Multiple list tags generated by templates
8839 !! wikitext
8840 {{echo|<li>}}a
8841 {{echo|<li>}}b
8842 {{echo|<li>}}c
8843 !! html
8844 <li>a
8845 <li>b
8846 <li>c</li>
8847 </li>
8848 </li>
8849
8850 !! html+tidy
8851 <ul>
8852 <li>a</li>
8853 <li>b</li>
8854 <li>c</li>
8855 </ul>
8856 !!end
8857
8858 !!test
8859 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
8860 !! wikitext
8861 *a
8862 <!--This line will NOT split the list-->
8863 *b
8864 <!--This line will NOT split the list either-->
8865 *c
8866 <!--foo--> <!----> <!--This line NOT split the list either-->
8867 *d
8868 !! html
8869 <ul><li>a</li>
8870 <li>b</li>
8871 <li>c</li>
8872 <li>d</li></ul>
8873
8874 !!end
8875
8876 !!test
8877 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
8878 !! wikitext
8879 *a
8880 <!--This line will NOT split the list-->
8881 *b
8882 <!--This line will NOT split the list either-->
8883 *c
8884 <!--foo--> <!----> <!--This line NOT split the list
8885 either-->
8886 *d
8887 !! html
8888 <ul><li>a</li>
8889 <li>b</li>
8890 <li>c</li>
8891 <li>d</li></ul>
8892
8893 !!end
8894
8895 !!test
8896 Test the li-hack
8897 (The PHP parser relies on Tidy for the hack)
8898 !!options
8899 parsoid=wt2html,wt2wt
8900 !! wikitext
8901 * foo
8902 * <li>li-hack
8903 * {{echo|<li>templated li-hack}}
8904 * <!--foo--> <li> unsupported li-hack with preceding comments
8905
8906 <ul>
8907 <li><li>not a li-hack
8908 </li>
8909 </ul>
8910 !! html+tidy
8911 <ul>
8912 <li>foo</li>
8913 <li>li-hack</li>
8914 <li>templated li-hack</li>
8915 <li>unsupported li-hack with preceding comments</li>
8916 </ul>
8917 <ul>
8918 <li>not a li-hack</li>
8919 </ul>
8920 !!end
8921
8922 !! test
8923 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
8924 !! options
8925 parsoid
8926 !! wikitext
8927 # foo
8928 ## bar
8929 * foo
8930 ** bar
8931 : foo
8932 :: bar
8933 !! html
8934 <ol>
8935 <li> foo<ol>
8936 <li> bar</li>
8937 </ol></li>
8938 </ol><ul>
8939 <li> foo<ul>
8940 <li> bar</li>
8941 </ul></li>
8942 </ul><dl>
8943 <dd> foo<dl>
8944 <dd> bar</dd>
8945 </dl></dd>
8946 </dl>
8947 !! end
8948
8949 !! test
8950 Parsoid: Test of whitespace serialization with Templated bullets
8951 !! options
8952 parsoid
8953 !! wikitext
8954 * {{bullet}}
8955 !! html
8956 <ul>
8957 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
8958 </ul>
8959 !! end
8960
8961 # ------------------------------------------------------------------------
8962 # The next set of tests are about Parsoid's ability to handle badly nested
8963 # tags (parse, minimize scope of fixup, and roundtrip back)
8964 # ------------------------------------------------------------------------
8965
8966 !! test
8967 Unbalanced closing block tags break a list
8968 (php parser relies on Tidy to fix up)
8969 !! wikitext
8970 <div>
8971 *a</div><div>
8972 *b</div>
8973 !! html+tidy
8974 <div>
8975 <ul>
8976 <li>a</li>
8977 </ul>
8978 </div>
8979 <div>
8980 <ul>
8981 <li>b</li>
8982 </ul>
8983 </div>
8984 !! end
8985
8986 # Parsoid fails this test, but it might be tricky to support properly.
8987 # See bug 68395.
8988 !! test
8989 Unbalanced closing non-block tags don't break a list
8990 (php parser relies on Tidy to fix up)
8991 !! wikitext
8992 <span>
8993 *a</span><span>
8994 *b</span>
8995 !! html/php+tidy
8996 <ul>
8997 <li><span>a</span></li>
8998 <li><span>b</span></li>
8999 </ul>
9000 !! html/parsoid
9001 <span>
9002 <ul>
9003 <li>a<span></span>
9004 </li>
9005 <li>b
9006 </li>
9007 </ul>
9008 </span>
9009 !! end
9010
9011 !! test
9012 Unclosed formatting tags that straddle lists are closed and reopened
9013 (php parser relies on Tidy to fix up)
9014 !! options
9015 parsoid=wt2html,wt2wt,html2html
9016 !! wikitext
9017 # <s> a
9018 # b </s>
9019 !! html/php+tidy
9020 <ol>
9021 <li><s>a</s></li>
9022 <li><s>b</s></li>
9023 </ol>
9024 !! html/parsoid
9025 <ol><li> <s> a</s></li>
9026 <li><s> b </s></li></ol>
9027 !! end
9028
9029 # See bug 68395.
9030 !!test
9031 1. List embedded in a formatting tag
9032 !! wikitext
9033 <small>
9034 * foo
9035 </small>
9036 !! html/php+tidy
9037 <ul>
9038 <li><small>foo</small></li>
9039 </ul>
9040 !! html/parsoid
9041 <small>
9042 <ul>
9043 <li> foo</li>
9044 </ul>
9045 </small>
9046 !!end
9047
9048 ## Ugly Parsoid output here
9049 ## Not sure what the right output is.
9050 !!test
9051 2. List embedded in a formatting tag
9052 !! wikitext
9053 <small>
9054 *a
9055 *b</small>
9056 !! html/php+tidy
9057 <ul>
9058 <li><small>a</small></li>
9059 <li><small>b</small></li>
9060 </ul>
9061 !! html/parsoid
9062 <small></small>
9063 <ul><small>
9064 <li>a</li>
9065 </small>
9066 <li><small>b</small></li>
9067 </ul>
9068 !!end
9069
9070 # Ugly Parsoid and PHP parser output here
9071 # Not sure if we want to make this a test!
9072 #
9073 ## !!test
9074 ## 3. Unclosed formatting tags in list elements
9075 ## !! wikitext
9076 ## *<small>a
9077 ## *<small>b
9078 ## !! html/php+tidy
9079 ## <ul>
9080 ## <li><small>a</small></li>
9081 ## <li><small><small>b</small></small></li>
9082 ## </ul>
9083 ## !! html/parsoid
9084 ## <ul>
9085 ## <li><small>a</small></li>
9086 ## <small>
9087 ## <li><small>b</small></li>
9088 ## </small></ul>
9089 ## !!end
9090
9091 # This is a bug in the PHP parser + tidy combination.
9092 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9093 # and then fostered out of the table by tidy.)
9094 # We believe the Parsoid output to be correct.
9095 !! test
9096 Table with missing opening <tr> tag
9097 !! options
9098 parsoid=wt2html,wt2wt
9099 !! wikitext
9100 <table>
9101 <td>foo</td>
9102 </tr>
9103 </table>
9104 !! html+tidy
9105 <table>
9106 <tr>
9107 <td>foo</td>
9108 </tr>
9109 </table>
9110 !! end
9111
9112 ###
9113 ### Magic Words
9114 ###
9115
9116 # Note that the current date is hard-coded as
9117 # 1970-01-01T00:02:03Z (a Thursday)
9118 # when running parser tests. The timezone is also fixed to GMT, so
9119 # local date will be identical to current date.
9120
9121 !! test
9122 Magic Word: {{CURRENTDAY}}
9123 !! wikitext
9124 {{CURRENTDAY}}
9125 !! html
9126 <p>1
9127 </p>
9128 !! end
9129
9130 !! test
9131 Magic Word: {{CURRENTDAY2}}
9132 !! wikitext
9133 {{CURRENTDAY2}}
9134 !! html
9135 <p>01
9136 </p>
9137 !! end
9138
9139 !! test
9140 Magic Word: {{CURRENTDAYNAME}}
9141 !! wikitext
9142 {{CURRENTDAYNAME}}
9143 !! html
9144 <p>Thursday
9145 </p>
9146 !! end
9147
9148 !! test
9149 Magic Word: {{CURRENTDOW}}
9150 !! wikitext
9151 {{CURRENTDOW}}
9152 !! html
9153 <p>4
9154 </p>
9155 !! end
9156
9157 !! test
9158 Magic Word: {{CURRENTMONTH}}
9159 !! wikitext
9160 {{CURRENTMONTH}}
9161 !! html
9162 <p>01
9163 </p>
9164 !! end
9165
9166 !! test
9167 Magic Word: {{CURRENTMONTH1}}
9168 !! wikitext
9169 {{CURRENTMONTH1}}
9170 !! html
9171 <p>1
9172 </p>
9173 !! end
9174
9175 !! test
9176 Magic Word: {{CURRENTMONTHABBREV}}
9177 !! wikitext
9178 {{CURRENTMONTHABBREV}}
9179 !! html
9180 <p>Jan
9181 </p>
9182 !! end
9183
9184 !! test
9185 Magic Word: {{CURRENTMONTHNAME}}
9186 !! wikitext
9187 {{CURRENTMONTHNAME}}
9188 !! html
9189 <p>January
9190 </p>
9191 !! end
9192
9193 !! test
9194 Magic Word: {{CURRENTMONTHNAMEGEN}}
9195 !! wikitext
9196 {{CURRENTMONTHNAMEGEN}}
9197 !! html
9198 <p>January
9199 </p>
9200 !! end
9201
9202 !! test
9203 Magic Word: {{CURRENTTIME}}
9204 !! wikitext
9205 {{CURRENTTIME}}
9206 !! html
9207 <p>00:02
9208 </p>
9209 !! end
9210
9211 !! test
9212 Magic Word: {{CURRENTHOUR}}
9213 !! wikitext
9214 {{CURRENTHOUR}}
9215 !! html
9216 <p>00
9217 </p>
9218 !! end
9219
9220 !! test
9221 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9222 !! wikitext
9223 {{CURRENTWEEK}}
9224 !! html
9225 <p>1
9226 </p>
9227 !! end
9228
9229 !! test
9230 Magic Word: {{CURRENTYEAR}}
9231 !! wikitext
9232 {{CURRENTYEAR}}
9233 !! html
9234 <p>1970
9235 </p>
9236 !! end
9237
9238 !! test
9239 Magic Word: {{CURRENTTIMESTAMP}}
9240 !! wikitext
9241 {{CURRENTTIMESTAMP}}
9242 !! html
9243 <p>19700101000203
9244 </p>
9245 !! end
9246
9247 !! test
9248 Magic Words LOCAL (UTC)
9249 !! wikitext
9250 * {{LOCALMONTH}}
9251 * {{LOCALMONTH1}}
9252 * {{LOCALMONTHNAME}}
9253 * {{LOCALMONTHNAMEGEN}}
9254 * {{LOCALMONTHABBREV}}
9255 * {{LOCALDAY}}
9256 * {{LOCALDAY2}}
9257 * {{LOCALDAYNAME}}
9258 * {{LOCALYEAR}}
9259 * {{LOCALTIME}}
9260 * {{LOCALHOUR}}
9261 * {{LOCALWEEK}}
9262 * {{LOCALDOW}}
9263 * {{LOCALTIMESTAMP}}
9264 !! html
9265 <ul><li> 01</li>
9266 <li> 1</li>
9267 <li> January</li>
9268 <li> January</li>
9269 <li> Jan</li>
9270 <li> 1</li>
9271 <li> 01</li>
9272 <li> Thursday</li>
9273 <li> 1970</li>
9274 <li> 00:02</li>
9275 <li> 00</li>
9276 <li> 1</li>
9277 <li> 4</li>
9278 <li> 19700101000203</li></ul>
9279
9280 !! end
9281
9282 !! test
9283 Magic Word: {{FULLPAGENAME}}
9284 !! options
9285 title=[[User:Ævar Arnfjörð Bjarmason]]
9286 !! wikitext
9287 {{FULLPAGENAME}}
9288 !! html
9289 <p>User:Ævar Arnfjörð Bjarmason
9290 </p>
9291 !! end
9292
9293 !! test
9294 Magic Word: {{FULLPAGENAMEE}}
9295 !! options
9296 title=[[User:Ævar Arnfjörð Bjarmason]]
9297 !! wikitext
9298 {{FULLPAGENAMEE}}
9299 !! html
9300 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9301 </p>
9302 !! end
9303
9304 !! test
9305 Magic Word: {{TALKSPACE}}
9306 !! options
9307 title=[[User:Ævar Arnfjörð Bjarmason]]
9308 !! wikitext
9309 {{TALKSPACE}}
9310 !! html
9311 <p>User talk
9312 </p>
9313 !! end
9314
9315 !! test
9316 Magic Word: {{TALKSPACE}}, same namespace
9317 !! options
9318 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9319 !! wikitext
9320 {{TALKSPACE}}
9321 !! html
9322 <p>User talk
9323 </p>
9324 !! end
9325
9326 !! test
9327 Magic Word: {{TALKSPACE}}, main namespace
9328 !! options
9329 title=[[Parser Test]]
9330 !! wikitext
9331 {{TALKSPACE}}
9332 !! html
9333 <p>Talk
9334 </p>
9335 !! end
9336
9337 !! test
9338 Magic Word: {{TALKSPACEE}}
9339 !! options
9340 title=[[User:Ævar Arnfjörð Bjarmason]]
9341 !! wikitext
9342 {{TALKSPACEE}}
9343 !! html
9344 <p>User_talk
9345 </p>
9346 !! end
9347
9348 !! test
9349 Magic Word: {{SUBJECTSPACE}}
9350 !! options
9351 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9352 !! wikitext
9353 {{SUBJECTSPACE}}
9354 !! html
9355 <p>User
9356 </p>
9357 !! end
9358
9359 !! test
9360 Magic Word: {{SUBJECTSPACE}}, same namespace
9361 !! options
9362 title=[[User:Ævar Arnfjörð Bjarmason]]
9363 !! wikitext
9364 {{SUBJECTSPACE}}
9365 !! html
9366 <p>User
9367 </p>
9368 !! end
9369
9370 !! test
9371 Magic Word: {{SUBJECTSPACE}}, main namespace
9372 !! options
9373 title=[[Parser Test]]
9374 !! wikitext
9375 {{SUBJECTSPACE}}
9376 !! html
9377
9378 !! end
9379
9380 !! test
9381 Magic Word: {{SUBJECTSPACEE}}
9382 !! options
9383 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9384 !! wikitext
9385 {{SUBJECTSPACEE}}
9386 !! html
9387 <p>User
9388 </p>
9389 !! end
9390
9391 !! test
9392 Magic Word: {{NAMESPACE}}
9393 !! options
9394 title=[[User:Ævar Arnfjörð Bjarmason]]
9395 !! wikitext
9396 {{NAMESPACE}}
9397 !! html
9398 <p>User
9399 </p>
9400 !! end
9401
9402 !! test
9403 Magic Word: {{NAMESPACEE}}
9404 !! options
9405 title=[[User:Ævar Arnfjörð Bjarmason]]
9406 !! wikitext
9407 {{NAMESPACEE}}
9408 !! html
9409 <p>User
9410 </p>
9411 !! end
9412
9413 !! test
9414 Magic Word: {{NAMESPACENUMBER}}
9415 !! options
9416 title=[[User:Ævar Arnfjörð Bjarmason]]
9417 !! wikitext
9418 {{NAMESPACENUMBER}}
9419 !! html
9420 <p>2
9421 </p>
9422 !! end
9423
9424 !! test
9425 Magic Word: {{SUBPAGENAME}}
9426 !! options
9427 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9428 !! wikitext
9429 {{SUBPAGENAME}}
9430 !! html
9431 <p>sub ö
9432 </p>
9433 !! end
9434
9435 !! test
9436 Magic Word: {{SUBPAGENAMEE}}
9437 !! options
9438 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9439 !! wikitext
9440 {{SUBPAGENAMEE}}
9441 !! html
9442 <p>sub_%C3%B6
9443 </p>
9444 !! end
9445
9446 !! test
9447 Magic Word: {{ROOTPAGENAME}}
9448 !! options
9449 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9450 !! wikitext
9451 {{ROOTPAGENAME}}
9452 !! html
9453 <p>Ævar Arnfjörð Bjarmason
9454 </p>
9455 !! end
9456
9457 !! test
9458 Magic Word: {{ROOTPAGENAMEE}}
9459 !! options
9460 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9461 !! wikitext
9462 {{ROOTPAGENAMEE}}
9463 !! html
9464 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9465 </p>
9466 !! end
9467
9468 !! test
9469 Magic Word: {{BASEPAGENAME}}
9470 !! options
9471 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9472 !! wikitext
9473 {{BASEPAGENAME}}
9474 !! html
9475 <p>Ævar Arnfjörð Bjarmason
9476 </p>
9477 !! end
9478
9479 !! test
9480 Magic Word: {{BASEPAGENAMEE}}
9481 !! options
9482 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9483 !! wikitext
9484 {{BASEPAGENAMEE}}
9485 !! html
9486 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9487 </p>
9488 !! end
9489
9490 !! test
9491 Magic Word: {{TALKPAGENAME}}
9492 !! options
9493 title=[[User:Ævar Arnfjörð Bjarmason]]
9494 !! wikitext
9495 {{TALKPAGENAME}}
9496 !! html
9497 <p>User talk:Ævar Arnfjörð Bjarmason
9498 </p>
9499 !! end
9500
9501 !! test
9502 Magic Word: {{TALKPAGENAMEE}}
9503 !! options
9504 title=[[User:Ævar Arnfjörð Bjarmason]]
9505 !! wikitext
9506 {{TALKPAGENAMEE}}
9507 !! html
9508 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9509 </p>
9510 !! end
9511
9512 !! test
9513 Magic Word: {{SUBJECTPAGENAME}}
9514 !! options
9515 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9516 !! wikitext
9517 {{SUBJECTPAGENAME}}
9518 !! html
9519 <p>User:Ævar Arnfjörð Bjarmason
9520 </p>
9521 !! end
9522
9523 !! test
9524 Magic Word: {{SUBJECTPAGENAMEE}}
9525 !! options
9526 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9527 !! wikitext
9528 {{SUBJECTPAGENAMEE}}
9529 !! html
9530 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9531 </p>
9532 !! end
9533
9534 !! test
9535 Magic Word: {{NUMBEROFFILES}}
9536 !! wikitext
9537 {{NUMBEROFFILES}}
9538 !! html
9539 <p>5
9540 </p>
9541 !! end
9542
9543 !! test
9544 Magic Word: {{PAGENAME}}
9545 !! options
9546 title=[[User:Ævar Arnfjörð Bjarmason]]
9547 !! wikitext
9548 {{PAGENAME}}
9549 !! html
9550 <p>Ævar Arnfjörð Bjarmason
9551 </p>
9552 !! end
9553
9554 !! test
9555 Magic Word: {{PAGENAME}} with metacharacters
9556 !! options
9557 title=[['foo & bar = baz']]
9558 !! wikitext
9559 ''{{PAGENAME}}''
9560 !! html/php
9561 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
9562 </p>
9563 !! html+tidy
9564 <p><i>'foo &amp; bar = baz'</i></p>
9565 !! end
9566
9567 !! test
9568 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
9569 !! options
9570 title=[[*RFC 1234 http://example.com/]]
9571 !! wikitext
9572 {{PAGENAME}}
9573 !! html/php
9574 <p>&#42;RFC&#32;1234 http&#58;//example.com/
9575 </p>
9576 !! html+tidy
9577 <p>*RFC 1234 http://example.com/</p>
9578 !! end
9579
9580 !! test
9581 Magic Word: {{PAGENAMEE}}
9582 !! options
9583 title=[[User:Ævar Arnfjörð Bjarmason]]
9584 !! wikitext
9585 {{PAGENAMEE}}
9586 !! html
9587 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9588 </p>
9589 !! end
9590
9591 !! test
9592 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
9593 !! options
9594 title=[[*RFC 1234 http://example.com/]]
9595 !! wikitext
9596 {{PAGENAMEE}}
9597 !! html/php
9598 <p>&#42;RFC_1234_http&#58;//example.com/
9599 </p>
9600 !! html+tidy
9601 <p>*RFC_1234_http://example.com/</p>
9602 !! end
9603
9604 !! test
9605 Magic Word: {{REVISIONID}}
9606 !! wikitext
9607 {{REVISIONID}}
9608 !! html
9609 <p>1337
9610 </p>
9611 !! end
9612
9613 !! test
9614 Magic Word: {{SCRIPTPATH}}
9615 !! wikitext
9616 {{SCRIPTPATH}}
9617 !! html
9618 <p>/
9619 </p>
9620 !! end
9621
9622 !! test
9623 Magic Word: {{STYLEPATH}}
9624 !! wikitext
9625 {{STYLEPATH}}
9626 !! html
9627 <p>/skins
9628 </p>
9629 !! end
9630
9631 !! test
9632 Magic Word: {{SERVER}}
9633 !! wikitext
9634 {{SERVER}}
9635 !! html
9636 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9637 </p>
9638 !! end
9639
9640 !! test
9641 Magic Word: {{SERVERNAME}}
9642 !! wikitext
9643 {{SERVERNAME}}
9644 !! html
9645 <p>example.org
9646 </p>
9647 !! end
9648
9649 !! test
9650 Magic Word: {{SITENAME}}
9651 !! wikitext
9652 {{SITENAME}}
9653 !! html
9654 <p>MediaWiki
9655 </p>
9656 !! end
9657
9658 !! test
9659 Case-sensitive magic words, when cased differently, should just be template transclusions
9660 !! wikitext
9661 {{CurrentMonth}}
9662 {{currentday}}
9663 {{cURreNTweEK}}
9664 {{currentHour}}
9665 !! html
9666 <p><a href="/index.php?title=Template:CurrentMonth&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentMonth (page does not exist)">Template:CurrentMonth</a>
9667 <a href="/index.php?title=Template:Currentday&amp;action=edit&amp;redlink=1" class="new" title="Template:Currentday (page does not exist)">Template:Currentday</a>
9668 <a href="/index.php?title=Template:CURreNTweEK&amp;action=edit&amp;redlink=1" class="new" title="Template:CURreNTweEK (page does not exist)">Template:CURreNTweEK</a>
9669 <a href="/index.php?title=Template:CurrentHour&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentHour (page does not exist)">Template:CurrentHour</a>
9670 </p>
9671 !! end
9672
9673 !! test
9674 Case-insensitive magic words should still work with weird casing.
9675 !! wikitext
9676 {{sErVeRNaMe}}
9677 {{LCFirst:AOEU}}
9678 {{ucFIRST:aoeu}}
9679 {{SERver}}
9680 !! html
9681 <p>example.org
9682 aOEU
9683 Aoeu
9684 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9685 </p>
9686 !! end
9687
9688 # From plwiki:PLOS_ONE
9689 !! test
9690 Parsoid: Page property magic word with magic word contents
9691 !! wikitext
9692 {{DISPLAYTITLE:''{{PAGENAME}}''}}
9693 !! html/parsoid
9694 <meta property="mw:PageProp/displaytitle" content="Main Page" about="#mwt2" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;i data-parsoid=\"{&amp;quot;dsr&amp;quot;:[15,31,2,2]}\">&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[]],&amp;quot;dsr&amp;quot;:[17,29,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;PAGENAME&amp;quot;,&amp;quot;function&amp;quot;:&amp;quot;pagename&amp;quot;},&amp;quot;params&amp;quot;:{},&amp;quot;i&amp;quot;:0}}]}\">Main Page&lt;/span>&lt;/i>"}]]}'/>
9695 !! end
9696
9697 !! test
9698 Parsoid: Template-generated DISPLAYTITLE
9699 !! wikitext
9700 {{{{echo|DISPLAYTITLE}}:Foo}}
9701 !! html/parsoid
9702 <meta property="mw:PageProp/displaytitle" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[0,29,null,null],"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DISPLAYTITLE}}:Foo"},"params":{},"i":0}}]}'/>
9703 !! end
9704
9705 !! test
9706 Namespace 1 {{ns:1}}
9707 !! wikitext
9708 {{ns:1}}
9709 !! html
9710 <p>Talk
9711 </p>
9712 !! end
9713
9714 !! test
9715 Namespace 1 {{ns:01}}
9716 !! wikitext
9717 {{ns:01}}
9718 !! html
9719 <p>Talk
9720 </p>
9721 !! end
9722
9723 !! test
9724 Namespace 0 {{ns:0}} (bug 4783)
9725 !! wikitext
9726 {{ns:0}}
9727 !! html
9728
9729 !! end
9730
9731 !! test
9732 Namespace 0 {{ns:00}} (bug 4783)
9733 !! wikitext
9734 {{ns:00}}
9735 !! html
9736
9737 !! end
9738
9739 !! test
9740 Namespace -1 {{ns:-1}}
9741 !! wikitext
9742 {{ns:-1}}
9743 !! html
9744 <p>Special
9745 </p>
9746 !! end
9747
9748 !! test
9749 Namespace User {{ns:User}}
9750 !! wikitext
9751 {{ns:User}}
9752 !! html
9753 <p>User
9754 </p>
9755 !! end
9756
9757 !! test
9758 Namespace User talk {{ns:User_talk}}
9759 !! wikitext
9760 {{ns:User_talk}}
9761 !! html
9762 <p>User talk
9763 </p>
9764 !! end
9765
9766 !! test
9767 Namespace User talk {{ns:uSeR tAlK}}
9768 !! wikitext
9769 {{ns:uSeR tAlK}}
9770 !! html
9771 <p>User talk
9772 </p>
9773 !! end
9774
9775 !! test
9776 Namespace File {{ns:File}}
9777 !! wikitext
9778 {{ns:File}}
9779 !! html
9780 <p>File
9781 </p>
9782 !! end
9783
9784 !! test
9785 Namespace File {{ns:Image}}
9786 !! wikitext
9787 {{ns:Image}}
9788 !! html
9789 <p>File
9790 </p>
9791 !! end
9792
9793 !! test
9794 Namespace (lang=de) Benutzer {{ns:User}}
9795 !! options
9796 language=de
9797 !! wikitext
9798 {{ns:User}}
9799 !! html
9800 <p>Benutzer
9801 </p>
9802 !! end
9803
9804 !! test
9805 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
9806 !! options
9807 language=de
9808 !! wikitext
9809 {{ns:3}}
9810 !! html
9811 <p>Benutzer Diskussion
9812 </p>
9813 !! end
9814
9815
9816 !! test
9817 Urlencode
9818 !! wikitext
9819 {{urlencode:hi world?!}}
9820 {{urlencode:hi world?!|WIKI}}
9821 {{urlencode:hi world?!|PATH}}
9822 {{urlencode:hi world?!|QUERY}}
9823 !! html
9824 <p>hi+world%3F%21
9825 hi_world%3F!
9826 hi%20world%3F%21
9827 hi+world%3F%21
9828 </p>
9829 !! end
9830
9831 !! test
9832 Magic Word: prioritize type info over data-parsoid
9833 !! options
9834 parsoid=html2wt
9835 !! html/parsoid
9836 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
9837 !! wikitext
9838 __FORCETOC__
9839 !! end
9840
9841 !! test
9842 Magic Word: serialize on separate line (parsoid)
9843 !! options
9844 parsoid=wt2wt,html2wt
9845 !! wikitext
9846 foo
9847 __NOTOC__
9848 bar
9849 !! html/parsoid
9850 foo<meta property="mw:PageProp/notoc"/>bar
9851 !! end
9852
9853 !! test
9854 Magic Word: rt non-english wikis
9855 !! options
9856 parsoid=wt2wt
9857 language=de
9858 !! wikitext
9859 __NOEDITSECTION__
9860 !! html/parsoid
9861 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
9862 !! end
9863
9864 !!test
9865 __proto__ is treated as normal wikitext (T105997)
9866 !!wikitext
9867 __proto__
9868 !!html
9869 <p>__proto__
9870 </p>
9871 !!end
9872
9873 ###
9874 ### Magic links
9875 ###
9876 !! test
9877 Magic links: internal link to RFC (bug 479)
9878 !! wikitext
9879 [[RFC 123]]
9880 !! html
9881 <p><a href="/index.php?title=RFC_123&amp;action=edit&amp;redlink=1" class="new" title="RFC 123 (page does not exist)">RFC 123</a>
9882 </p>
9883 !! end
9884
9885 !! test
9886 Magic links: RFC (bug 479)
9887 !! wikitext
9888 RFC 822
9889 !! html
9890 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9891 </p>
9892 !! end
9893
9894 !! test
9895 Magic links: RFC (bug 65278)
9896 !! wikitext
9897 This is RFC 822 but thisRFC 822 is not RFC 822linked.
9898 !! html
9899 <p>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a> but thisRFC 822 is not RFC 822linked.
9900 </p>
9901 !! end
9902
9903 !! test
9904 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
9905 !! wikitext
9906 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
9907 RFC
9908 822
9909 !! html
9910 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
9911 RFC
9912 822
9913 </p>
9914 !! end
9915
9916 !! test
9917 Magic links: ISBN (bug 1937)
9918 !! wikitext
9919 ISBN 0-306-40615-2
9920 !! html
9921 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
9922 </p>
9923 !! end
9924
9925 !! test
9926 Magic links: ISBN (bug 65278)
9927 !! wikitext
9928 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
9929 !! html/php
9930 <p>This is <a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
9931 </p>
9932 !! html/parsoid
9933 <p>This is <a href="./Special:BookSources/9780316098113" rel="mw:ExtLink">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.</p>
9934 !! end
9935
9936 !! test
9937 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
9938 !! wikitext
9939 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
9940 ISBN
9941 9780316098113
9942 ISBN 978
9943 0316098113
9944 !! html
9945 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
9946 ISBN
9947 9780316098113
9948 ISBN 978
9949 0316098113
9950 </p>
9951 !! end
9952
9953 !! test
9954 Magic links: PMID incorrectly converts space to underscore
9955 !! wikitext
9956 PMID 1234
9957 !! html
9958 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9959 </p>
9960 !! end
9961
9962 !! test
9963 Magic links: PMID (bug 65278)
9964 !! wikitext
9965 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
9966 !! html
9967 <p>This is <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.
9968 </p>
9969 !! end
9970
9971 !! test
9972 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
9973 !! wikitext
9974 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
9975 PMID
9976 1234
9977 !! html
9978 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
9979 PMID
9980 1234
9981 </p>
9982 !! end
9983
9984 ###
9985 ### Templates
9986 ####
9987
9988 !! test
9989 Nonexistent template
9990 !! wikitext
9991 {{thistemplatedoesnotexist}}
9992 !! html
9993 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit&amp;redlink=1" class="new" title="Template:Thistemplatedoesnotexist (page does not exist)">Template:Thistemplatedoesnotexist</a>
9994 </p>
9995 !! end
9996
9997 !! test
9998 Template with invalid target containing tags
9999 !! wikitext
10000 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10001 !! html
10002 <p>{{a<b>b</b>|foo|a=b|a = b}}
10003 </p>
10004 !! end
10005
10006 !! test
10007 Template with invalid target containing unclosed tag
10008 !! wikitext
10009 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10010 !! html
10011 <p>{{a<b>|foo|a=b|a = b}}</b>
10012 </p>
10013 !! end
10014
10015 !! test
10016 Template with invalid target containing wikilink
10017 !! wikitext
10018 {{[[Main Page]]}}
10019 !! html/php
10020 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10021 </p>
10022 !! html/parsoid
10023 <p><span typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"[[Main Page]]"},"params":{},"i":0}}]}'>{{</span><a rel="mw:WikiLink" href="./Main_Page" about="#mwt1">Main Page</a><span about="#mwt1">}}</span></p>
10024 !! end
10025
10026 !! test
10027 Template with just whitespace in it, bug #68421
10028 !! wikitext
10029 {{echo|{{ }}}}
10030 !! html/parsoid
10031 <p><span typeof="mw:Transclusion mw:Nowiki" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{ }}"}},"i":0}}]}'>{{ }}</span></p>
10032 !! end
10033
10034 !! article
10035 Template:test
10036 !! text
10037 This is a test template
10038 !! endarticle
10039
10040 !! test
10041 Simple template
10042 !! wikitext
10043 {{test}}
10044 !! html
10045 <p>This is a test template
10046 </p>
10047 !! end
10048
10049 !! test
10050 Template with explicit namespace
10051 !! wikitext
10052 {{Template:test}}
10053 !! html
10054 <p>This is a test template
10055 </p>
10056 !! end
10057
10058
10059 !! article
10060 Template:paramtest
10061 !! text
10062 This is a test template with parameter {{{param}}}
10063 !! endarticle
10064
10065 !! test
10066 Template parameter
10067 !! wikitext
10068 {{paramtest|param=foo}}
10069 !! html
10070 <p>This is a test template with parameter foo
10071 </p>
10072 !! end
10073
10074 !! article
10075 Template:paramtestnum
10076 !! text
10077 [[{{{1}}}|{{{2}}}]]
10078 !! endarticle
10079
10080 !! test
10081 Template unnamed parameter
10082 !! wikitext
10083 {{paramtestnum|Main Page|the main page}}
10084 !! html
10085 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10086 </p>
10087 !! end
10088
10089 !! article
10090 Template:templatesimple
10091 !! text
10092 (test)
10093 !! endarticle
10094
10095 !! article
10096 Template:templateredirect
10097 !! text
10098 #redirect [[Template:templatesimple]]
10099 !! endarticle
10100
10101 !! article
10102 Template:templateasargtestnum
10103 !! text
10104 {{{{{1}}}}}
10105 !! endarticle
10106
10107 !! article
10108 Template:templateasargtest
10109 !! text
10110 {{template{{{templ}}}}}
10111 !! endarticle
10112
10113 !! article
10114 Template:templateasargtest2
10115 !! text
10116 {{{{{templ}}}}}
10117 !! endarticle
10118
10119 !! test
10120 Template with template name as unnamed argument
10121 !! wikitext
10122 {{templateasargtestnum|templatesimple}}
10123 !! html
10124 <p>(test)
10125 </p>
10126 !! end
10127
10128 !! test
10129 Template with template name as argument
10130 !! wikitext
10131 {{templateasargtest|templ=simple}}
10132 !! html
10133 <p>(test)
10134 </p>
10135 !! end
10136
10137 !! test
10138 Template with template name as argument (2)
10139 !! wikitext
10140 {{templateasargtest2|templ=templatesimple}}
10141 !! html
10142 <p>(test)
10143 </p>
10144 !! end
10145
10146 !! article
10147 Template:templateasargtestdefault
10148 !! text
10149 {{{{{templ|templatesimple}}}}}
10150 !! endarticle
10151
10152 !! article
10153 Template:templa
10154 !! text
10155 '''templ'''
10156 !! endarticle
10157
10158 !! test
10159 Template with default value
10160 !! wikitext
10161 {{templateasargtestdefault}}
10162 !! html
10163 <p>(test)
10164 </p>
10165 !! end
10166
10167 !! test
10168 Template with default value (value set)
10169 !! wikitext
10170 {{templateasargtestdefault|templ=templa}}
10171 !! html
10172 <p><b>templ</b>
10173 </p>
10174 !! end
10175
10176 !! test
10177 Template redirect
10178 !! wikitext
10179 {{templateredirect}}
10180 !! html/php
10181 <p>(test)
10182 </p>
10183 !! html/parsoid
10184 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10185 !! end
10186
10187 !! test
10188 Template with argument in separate line
10189 !! wikitext
10190 {{ templateasargtest |
10191 templ = simple }}
10192 !! html
10193 <p>(test)
10194 </p>
10195 !! end
10196
10197 !! test
10198 Template with complex template as argument
10199 !! wikitext
10200 {{paramtest|
10201 param ={{ templateasargtest |
10202 templ = simple }}}}
10203 !! html
10204 <p>This is a test template with parameter (test)
10205 </p>
10206 !! end
10207
10208 !! test
10209 Template with thumb image (with link in description)
10210 !! wikitext
10211 {{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10212 !! html/php
10213 This is a test template with parameter <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a> <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">caption</a></div></div></div>
10214
10215 !! html+tidy
10216 <p>This is a test template with parameter</p>
10217 <div class="thumb tright">
10218 <div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a>
10219 <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">caption</a></div>
10220 </div>
10221 </div>
10222 !! html/parsoid
10223 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"paramtest","href":"./Template:Paramtest"},"params":{"param":{"wt":"[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]"}},"i":0}}]}'>This is a test template with parameter </p><figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" about="#mwt1" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Noimage.png" ><img resource="./File:Noimage.png" src="./Special:FilePath/Noimage.png" height="220" width="220"/></a><figcaption><a rel="mw:WikiLink" href="./No_link" title="No link">link</a> <a rel="mw:WikiLink" href="./No_link" title="No link">caption</a></figcaption></figure>
10224 !! end
10225
10226 !! article
10227 Template:complextemplate
10228 !! text
10229 {{{1}}} {{paramtest|
10230 param ={{{param}}}}}
10231 !! endarticle
10232
10233 !! test
10234 Template with complex arguments
10235 !! wikitext
10236 {{complextemplate|
10237 param ={{ templateasargtest |
10238 templ = simple }}|[[Template:complextemplate|link]]}}
10239 !! html
10240 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10241 </p>
10242 !! end
10243
10244 !! test
10245 BUG 553: link with two variables in a piped link
10246 !! wikitext
10247 {|
10248 |[[{{{1}}}|{{{2}}}]]
10249 |}
10250 !! html
10251 <table>
10252 <tr>
10253 <td>[[{{{1}}}|{{{2}}}]]
10254 </td></tr></table>
10255
10256 !! end
10257
10258 !! test
10259 Magic variable as template parameter
10260 !! wikitext
10261 {{paramtest|param={{SITENAME}}}}
10262 !! html
10263 <p>This is a test template with parameter MediaWiki
10264 </p>
10265 !! end
10266
10267 !! article
10268 Template:linktest
10269 !! text
10270 [[{{{param}}}|link]]
10271 !! endarticle
10272
10273 !! test
10274 Template parameter as link source
10275 !! wikitext
10276 {{linktest|param=Main Page}}
10277 !! html
10278 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10279 </p>
10280 !! end
10281
10282 !!article
10283 Template:paramtest2
10284 !! text
10285 including another template, {{paramtest|param={{{arg}}}}}
10286 !! endarticle
10287
10288 !! test
10289 Template passing argument to another template
10290 !! wikitext
10291 {{paramtest2|arg='hmm'}}
10292 !! html
10293 <p>including another template, This is a test template with parameter 'hmm'
10294 </p>
10295 !! end
10296
10297 !! article
10298 Template:Linktest2
10299 !! text
10300 Main Page
10301 !! endarticle
10302
10303 !! test
10304 Template as link source
10305 !! wikitext
10306 [[{{linktest2}}]]
10307
10308 [[{{linktest2}}|Main Page]]
10309
10310 [[{{linktest2}}]]Page
10311 !! html
10312 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10313 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10314 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10315 </p>
10316 !! end
10317
10318
10319 !! article
10320 Template:loop1
10321 !! text
10322 {{loop2}}
10323 !! endarticle
10324
10325 !! article
10326 Template:loop2
10327 !! text
10328 {{loop1}}
10329 !! endarticle
10330
10331 !! test
10332 Template infinite loop
10333 !! wikitext
10334 {{loop1}}
10335 !! html
10336 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10337 </p>
10338 !! end
10339
10340 !! test
10341 Template from main namespace
10342 !! wikitext
10343 {{:Main Page}}
10344 !! html
10345 <p>blah blah
10346 </p>
10347 !! end
10348
10349 !! article
10350 Template:table
10351 !! text
10352 {|
10353 | 1 || 2
10354 |-
10355 | 3 || 4
10356 |}
10357 !! endarticle
10358
10359 !! test
10360 BUG 529: Template with table, not included at beginning of line
10361 !! wikitext
10362 foo {{table}}
10363 !! html
10364 <p>foo
10365 </p>
10366 <table>
10367 <tr>
10368 <td> 1 </td>
10369 <td> 2
10370 </td></tr>
10371 <tr>
10372 <td> 3 </td>
10373 <td> 4
10374 </td></tr></table>
10375
10376 !! end
10377
10378 !! test
10379 BUG 523: Template shouldn't eat newline (or add an extra one before table)
10380 !! wikitext
10381 foo
10382 {{table}}
10383 !! html
10384 <p>foo
10385 </p>
10386 <table>
10387 <tr>
10388 <td> 1 </td>
10389 <td> 2
10390 </td></tr>
10391 <tr>
10392 <td> 3 </td>
10393 <td> 4
10394 </td></tr></table>
10395
10396 !! end
10397
10398 !! test
10399 BUG 41: Template parameters shown as broken links
10400 !! wikitext
10401 {{{parameter}}}
10402 !! html
10403 <p>{{{parameter}}}
10404 </p>
10405 !! end
10406
10407 !! test
10408 Template with targets containing wikilinks
10409 !! wikitext
10410 {{[[foo]]}}
10411
10412 {{[[{{echo|foo}}]]}}
10413
10414 {{{{echo|[[foo}}]]}}
10415 !! html
10416 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10417 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10418 </p><p>{{[[foo}}]]
10419 </p>
10420 !! end
10421
10422 !! article
10423 Template:''
10424 !! text
10425 bar
10426 !! endarticle
10427
10428 !! test
10429 Templates: Double quotes as template target
10430 !! wikitext
10431 foo {{''}} baz
10432 !! html/php
10433 <p>foo bar baz
10434 </p>
10435 !! html/parsoid
10436 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
10437 </p>
10438 !! end
10439
10440 !! article
10441 Template:MSGNW test
10442 !! text
10443 ''None'' of '''this''' should be
10444 * interpreted
10445 but rather passed unmodified
10446 {{test}}
10447 <gallery>
10448 File:Foobar.jpg
10449 </gallery>
10450 <!-- comment -->
10451 !! endarticle
10452
10453 # hmm, fix this or just deprecate msgnw and document its behavior?
10454 !! test
10455 msgnw keyword
10456 !! wikitext
10457 {{msgnw:MSGNW test}}
10458 !! html/php
10459 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
10460 &#42; interpreted
10461 &#32;but rather passed unmodified
10462 &#123;&#123;test&#125;&#125;
10463 &#60;gallery&#62;
10464 File:Foobar.jpg
10465 &#60;/gallery&#62;
10466 &#60;!-- comment --&#62;
10467 </p>
10468 !! end
10469
10470 !! test
10471 int keyword
10472 !! wikitext
10473 {{int:youhavenewmessages|lots of money|not!}}
10474 !! html
10475 <p>You have lots of money (not!).
10476 </p>
10477 !! end
10478
10479 !! article
10480 Template:Includes
10481 !! text
10482 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10483 !! endarticle
10484
10485 !! test
10486 <includeonly> and <noinclude> being included
10487 !! wikitext
10488 {{Includes}}
10489 !! html
10490 <p>Foobar
10491 </p>
10492 !! end
10493
10494 !! article
10495 Template:Includes2
10496 !! text
10497 <onlyinclude>Foo</onlyinclude>bar
10498 !! endarticle
10499
10500 !! test
10501 <onlyinclude> being included
10502 !! wikitext
10503 {{Includes2}}
10504 !! html
10505 <p>Foo
10506 </p>
10507 !! end
10508
10509
10510 !! article
10511 Template:Includes3
10512 !! text
10513 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
10514 !! endarticle
10515
10516 !! test
10517 <onlyinclude> and <includeonly> being included
10518 !! wikitext
10519 {{Includes3}}
10520 !! html
10521 <p>Foo
10522 </p>
10523 !! end
10524
10525 !! test
10526 <includeonly> and <noinclude> on a page
10527 !! wikitext
10528 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10529 !! html
10530 <p>Foozar
10531 </p>
10532 !! end
10533
10534 !! test
10535 Un-closed <noinclude>
10536 !! wikitext
10537 <noinclude>
10538 !! html
10539 !! end
10540
10541 !! test
10542 <onlyinclude> on a page
10543 !! wikitext
10544 <onlyinclude>Foo</onlyinclude>bar
10545 !! html
10546 <p>Foobar
10547 </p>
10548 !! end
10549
10550 !! test
10551 Un-closed <onlyinclude>
10552 !! wikitext
10553 <onlyinclude>
10554 !! html
10555 !! end
10556
10557 !!test
10558 Self-closed noinclude, includeonly, onlyinclude tags
10559 !! wikitext
10560 <noinclude />
10561 <includeonly />
10562 <onlyinclude />
10563 !! html
10564 <p><br />
10565 </p>
10566 !!end
10567
10568 !!test
10569 Unbalanced includeonly and noinclude tags
10570 !! wikitext
10571 {|
10572 |a</noinclude>
10573 |b</noinclude></noinclude>
10574 |c</noinclude></includeonly>
10575 |d</includeonly></includeonly>
10576 |}
10577 !! html
10578 <table>
10579 <tr>
10580 <td>a
10581 </td>
10582 <td>b
10583 </td>
10584 <td>c&lt;/includeonly&gt;
10585 </td>
10586 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
10587 </td></tr></table>
10588
10589 !!end
10590
10591 !! article
10592 Template:Includeonly section
10593 !! text
10594 <includeonly>
10595 ==Includeonly section==
10596 </includeonly>
10597 ==Section T-1==
10598 !!endarticle
10599
10600 !! test
10601 Bug 6563: Edit link generation for section shown by <includeonly>
10602 !! wikitext
10603 {{includeonly section}}
10604 !! html
10605 <h2><span class="mw-headline" id="Includeonly_section">Includeonly section</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-1" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
10606 <h2><span class="mw-headline" id="Section_T-1">Section T-1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-2" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
10607
10608 !! end
10609
10610 # Uses same input as the contents of [[Template:Includeonly section]]
10611 !! test
10612 Bug 6563: Section extraction for section shown by <includeonly>
10613 !! options
10614 section=T-2
10615 !! wikitext
10616 <includeonly>
10617 ==Includeonly section==
10618 </includeonly>
10619 ==Section T-2==
10620 !! html
10621 ==Section T-2==
10622 !! end
10623
10624 !! test
10625 Bug 6563: Edit link generation for section suppressed by <includeonly>
10626 !! wikitext
10627 <includeonly>
10628 ==Includeonly section==
10629 </includeonly>
10630 ==Section 1==
10631 !! html
10632 <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
10633
10634 !! end
10635
10636 !! test
10637 Bug 6563: Section extraction for section suppressed by <includeonly>
10638 !! options
10639 section=1
10640 !! wikitext
10641 <includeonly>
10642 ==Includeonly section==
10643 </includeonly>
10644 ==Section 1==
10645 !! html
10646 ==Section 1==
10647 !! end
10648
10649 !! test
10650 Un-closed <includeonly>
10651 !! wikitext
10652 <includeonly>
10653 !! html
10654 !! end
10655
10656 !! test
10657 Includes and comments at SOL
10658 !! wikitext
10659 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
10660
10661 <noinclude>
10662 some
10663 </noinclude>* stuff
10664 * here
10665
10666 <includeonly>can have stuff</includeonly>=== here ===
10667
10668 !! html/php
10669 <h2><span class="mw-headline" id="hu">hu</span></h2>
10670 <p>some
10671 </p>
10672 <ul><li> stuff</li>
10673 <li> here</li></ul>
10674 <h3><span class="mw-headline" id="here">here</span></h3>
10675
10676 !! html/parsoid
10677 <!-- comment --><meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/><!-- comment --><meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><!-- comment --><h2> hu </h2>
10678
10679 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
10680 <p>some</p>
10681 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
10682 <li> here</li></ul>
10683
10684 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>can have stuff&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><h3> here </h3>
10685
10686 !! end
10687
10688 # TODO: test with DOM fragment reuse!
10689 !! test
10690 Parsoid: DOM fragment reuse
10691 !! options
10692 parsoid=wt2wt,wt2html
10693 !! wikitext
10694 a{{echo|b<table></table>c}}d
10695
10696 a{{echo|b
10697 <table></table>
10698 c}}d
10699
10700 {{echo|a
10701
10702 <table></table>
10703
10704 b}}
10705 !! html
10706 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b&lt;table>&lt;/table>c"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>ab</p><table about="#mwt1" data-parsoid='{"stx":"html"}'></table><p about="#mwt1">cd</p>
10707
10708 <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b\n&lt;table>&lt;/table>\nc"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>ab</p><span about="#mwt2">
10709 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
10710 </span><p about="#mwt2">cd</p>
10711
10712 <p about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n\n&lt;table>&lt;/table>\n\nb"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}'>a</p><span about="#mwt3">
10713
10714 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
10715
10716 </span><p about="#mwt3">b</p>
10717 !! end
10718
10719 !! test
10720 Parsoid: Merge double tds (T52603)
10721 !! options
10722 parsoid
10723 !! wikitext
10724 {|
10725 |{{echo|{{!}} foo}}
10726 |}
10727 !! html
10728 <table><tbody>
10729 <tr><td about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}} foo"}},"i":0}}]}'> foo</td></tr>
10730 </tbody></table>
10731 !! end
10732
10733 !! test
10734 Parsoid: Merge double tds in nested transclusion content (T52603)
10735 !! options
10736 parsoid
10737 !! wikitext
10738 {{echo|<div>}}
10739 {|
10740 |{{echo|{{!}} foo}}
10741 |}
10742 {{echo|</div>}}
10743 !! html
10744 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<div>"}},"i":0}},"\n{|\n|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}} foo"}},"i":1}},"\n|}\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"</div>"}},"i":2}}]}'>
10745 <table><tbody>
10746 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
10747 </tbody></table>
10748 </div>
10749 !! end
10750
10751 ###
10752 ### <includeonly> and <noinclude> in attributes
10753 ###
10754 !!test
10755 0. includeonly around the entire attribute
10756 !! wikitext
10757 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
10758 !! html
10759 <p><span id="v2">bar</span>
10760 </p>
10761 !!end
10762
10763 !!test
10764 1. includeonly in html attr key
10765 !! wikitext
10766 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
10767 !! html
10768 <p><span id="foo">bar</span>
10769 </p>
10770 !!end
10771
10772 !!test
10773 2. includeonly in html attr value
10774 !! wikitext
10775 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
10776 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
10777 !! html
10778 <p><span id="v1">bar</span>
10779 <span id="v1">bar</span>
10780 </p>
10781 !!end
10782
10783 !!test
10784 3. includeonly in part of an attr value
10785 !! wikitext
10786 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
10787 !! html
10788 <p><span style="color:red;">bar</span>
10789 </p>
10790 !!end
10791
10792 !!test
10793 4. includeonly in table attributes
10794 !! wikitext
10795 {|
10796 |- <noinclude>
10797 |-
10798 |a
10799 </noinclude>
10800 |- <includeonly>
10801 |-
10802 |b
10803 </includeonly>
10804 |}
10805 !! html
10806 <table>
10807
10808
10809 <tr>
10810 <td>a
10811 </td></tr>
10812 </table>
10813
10814 !!end
10815
10816 ###
10817 ### Token Stream Patcher tests
10818 ###
10819 ### These tests won't always pass wt2wt and other modes because
10820 ### on serialization, the table will be output on a new line.
10821 ### For now, we are blacklisting them, and using this to test selser.
10822 ###
10823
10824 !!test
10825 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
10826 !!options
10827 parsoid=wt2html,wt2wt
10828 !!wikitext
10829 {{echo|}}{| width = '100%'
10830 |foo
10831 |}
10832 !!html/parsoid
10833 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
10834 <tbody><tr><td>foo</td></tr>
10835 </tbody></table>
10836 !!end
10837
10838 !!test
10839 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
10840 !!options
10841 parsoid=wt2html,wt2wt
10842 !!wikitext
10843 <includeonly>a</includeonly>{| {{{b}}}
10844 |c
10845 |}
10846 !!html/parsoid
10847 <meta typeof="mw:Includes/IncludeOnly"/><meta typeof="mw:Includes/IncludeOnly/End"/><table about="#mwt2" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"{{{b}}}","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[31,38,null,null],&amp;quot;src&amp;quot;:&amp;quot;{{{b}}}&amp;quot;}\">{{{b}}}&lt;/span>"},{"html":""}]]}' data-parsoid='{"a":{"{{{b}}}":null},"sa":{"{{{b}}}":""}}'>
10848 <tbody><tr><td>c</td></tr>
10849 </tbody></table>
10850
10851 !!end
10852
10853 ###
10854 ### Testing parsing of templates where a template arg
10855 ### has the same name as the template itself.
10856 ###
10857
10858 !! article
10859 Template:quote
10860 !! text
10861 {{{quote|{{{1}}}}}}
10862 !! endarticle
10863
10864 !!test
10865 Templates: Template Name/Arg clash: 1. Use of positional param
10866 !! wikitext
10867 {{quote|foo}}
10868 !! html
10869 <p>foo
10870 </p>
10871 !!end
10872
10873 !!test
10874 Templates: Template Name/Arg clash: 2. Use of named param
10875 !! wikitext
10876 {{quote|quote=foo}}
10877 !! html
10878 <p>foo
10879 </p>
10880 !!end
10881
10882 !!test
10883 Templates: Template Name/Arg clash: 3. Use of named param with empty input
10884 !! wikitext
10885 {{quote|quote}}
10886 !! html
10887 <p>quote
10888 </p>
10889 !!end
10890
10891 ###
10892 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
10893 ###
10894
10895 !!test
10896 Templates: 1. Simple use
10897 !! wikitext
10898 {{echo|Foo}}
10899 !! html
10900 <p>Foo
10901 </p>
10902 !!end
10903
10904 !!test
10905 Templates: 2. Inside a block tag
10906 !! wikitext
10907 <div>{{echo|Foo}}</div>
10908 <blockquote>{{echo|Foo}}</blockquote>
10909 !! html
10910 <div>Foo</div>
10911 <blockquote>Foo</blockquote>
10912
10913 !! html+tidy
10914 <div>Foo</div>
10915 <blockquote>
10916 <p>Foo</p>
10917 </blockquote>
10918 !!end
10919
10920 !!test
10921 Templates: P-wrapping: 1a. Templates on consecutive lines
10922 !! wikitext
10923 {{echo|Foo}}
10924 {{echo|bar}}
10925 !! html
10926 <p>Foo
10927 bar
10928 </p>
10929 !!end
10930
10931 !!test
10932 Templates: P-wrapping: 1b. Templates on consecutive lines
10933 !! wikitext
10934 Foo
10935
10936 {{echo|bar}}
10937 {{echo|baz}}
10938 !! html
10939 <p>Foo
10940 </p><p>bar
10941 baz
10942 </p>
10943 !!end
10944
10945 !!test
10946 Templates: P-wrapping: 1c. Templates on consecutive lines
10947 !! wikitext
10948 {{echo|Foo}}
10949 {{echo|bar}} <div>baz</div>
10950 !! html
10951 <p>Foo
10952 </p>
10953 bar <div>baz</div>
10954
10955 !! html+tidy
10956 <p>Foo</p>
10957 <p>bar</p>
10958 <div>baz</div>
10959 !! end
10960
10961 !!test
10962 Templates: P-wrapping: 1d. Template preceded by comment-only line
10963 !!options
10964 parsoid
10965 !! wikitext
10966 <!-- foo -->
10967 {{echo|Bar}}
10968 !! html
10969 <!-- foo -->
10970
10971 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
10972 !!end
10973
10974 !!test
10975 Templates: Inline Text: 1. Multiple template uses
10976 !! wikitext
10977 {{echo|Foo}}bar{{echo|baz}}
10978 !! html
10979 <p>Foobarbaz
10980 </p>
10981 !!end
10982
10983 !!test
10984 Templates: Inline Text: 2. Back-to-back template uses
10985 !! wikitext
10986 {{echo|Foo}}{{echo|bar}}
10987 !! html
10988 <p>Foobar
10989 </p>
10990 !!end
10991
10992 !!test
10993 Templates: Block Tags: 1. Multiple template uses
10994 !! wikitext
10995 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
10996 !! html
10997 <div>Foo</div><div>bar</div><div>baz</div>
10998
10999 !!end
11000
11001 !!test
11002 Templates: Block Tags: 2. Back-to-back template uses
11003 !! wikitext
11004 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11005 !! html
11006 <div>Foo</div><div>bar</div>
11007
11008 !!end
11009
11010 # This is an edge case relating to paragraph wrapping.
11011 !!test
11012 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11013 !! wikitext
11014 {{echo|a
11015 b</p>}}
11016 !! html/parsoid
11017 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\nb&lt;/p>"}},"i":0}}]}'>a
11018 b</p>
11019 !!end
11020
11021 !!test
11022 Templates: Links: 1. Simple example
11023 !! wikitext
11024 {{echo|[[Foo|bar]]}}
11025 !! html
11026 <p><a href="/wiki/Foo" title="Foo">bar</a>
11027 </p>
11028 !!end
11029
11030 !!test
11031 Templates: Links: 2. Generation of link href
11032 !! wikitext
11033 [[{{echo|Foo}}|bar]]
11034 !! html
11035 <p><a href="/wiki/Foo" title="Foo">bar</a>
11036 </p>
11037 !!end
11038
11039 !!test
11040 Templates: Links: 3. Generation of part of a link href
11041 !! wikitext
11042 [[Fo{{echo|o}}|bar]]
11043
11044 [[Foo{{echo|bar}}]]
11045
11046 [[Foo{{echo|bar}}baz]]
11047
11048 [[Foo{{echo|bar}}|bar]]
11049
11050 [[:Foo{{echo|bar}}]]
11051
11052 [[:Foo{{echo|bar}}|bar]]
11053 !! html
11054 <p><a href="/wiki/Foo" title="Foo">bar</a>
11055 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11056 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11057 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11058 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11059 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11060 </p>
11061 !!end
11062
11063 !!test
11064 Templates: Links: 4. Multiple templates generating link href
11065 !! wikitext
11066 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11067 !! html
11068 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11069 </p>
11070 !!end
11071
11072 !!test
11073 Templates: Links: 5. Generation of link text
11074 !! wikitext
11075 [[Foo|{{echo|bar}}]]
11076 !! html
11077 <p><a href="/wiki/Foo" title="Foo">bar</a>
11078 </p>
11079 !!end
11080
11081 !!test
11082 Templates: Links: 5. Nested templates (only outermost template should be marked)
11083 !! wikitext
11084 {{echo|[[{{echo|Foo}}|bar]]}}
11085 !! html
11086 <p><a href="/wiki/Foo" title="Foo">bar</a>
11087 </p>
11088 !!end
11089
11090 !!test
11091 Templates: HTML Tag: 1. Generation of HTML attr. key
11092 !! wikitext
11093 <div {{echo|style}}="color:red;">foo</div>
11094 !! html
11095 <div style="color:red;">foo</div>
11096
11097 !!end
11098
11099 !!test
11100 Templates: HTML Tag: 2. Generation of HTML attr. value
11101 !! wikitext
11102 <div style={{echo|'color:red;'}}>foo</div>
11103 !! html
11104 <div style="color:red;">foo</div>
11105
11106 !!end
11107
11108 !!test
11109 Templates: HTML Tag: 3. Generation of HTML attr key and value
11110 !! wikitext
11111 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11112 !! html
11113 <div style="color:red;">foo</div>
11114
11115 !!end
11116
11117 !!test
11118 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11119 !! wikitext
11120 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11121 !! html
11122 <div title="This is a long title with just one piece templated">foo</div>
11123
11124 !!end
11125
11126 !!test
11127 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11128 !! wikitext
11129 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11130 !! html
11131 <div title="This is a long title with just one piece templated">foo</div>
11132
11133 !!end
11134
11135 !!test
11136 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11137 !! wikitext
11138 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11139 !! html
11140 <div title="This is a long title with just one piece templated">foo</div>
11141
11142 !!end
11143
11144 # SSS FIXME: While it is great we added support for all this,
11145 # do we want to make this part of the spec? Maybe we want to
11146 # deprecate this kind of usage in the future?
11147 !!test
11148 Templates: HTML Tag: 7. Generation of partial attribute key string
11149 !! wikitext
11150 <div st{{echo|yle}}="color:red;">foo</div>
11151 !! html
11152 <div style="color:red;">foo</div>
11153
11154 !!end
11155
11156 !! test
11157 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11158 !! wikitext
11159 <div {{echo|1=id="v1"}}>bar</div>
11160 !! html
11161 <div id="v1">bar</div>
11162
11163 !!end
11164
11165 !! test
11166 Templates: HTML Tag: 9. Multiple template-generated attributes
11167 !! wikitext
11168 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11169 !! html
11170 <div id="v1" title="foo">bar</div>
11171
11172 !!end
11173
11174 !! test
11175 Templates: Support for templates generating attributes and content
11176 !! wikitext
11177 {| {{mixed_attr_content_template}}
11178 |-
11179 |bar
11180 |}
11181 !! html/php
11182 <table style="color:red;" title="T48811">
11183
11184 <tr>
11185 <td>foo
11186 </td></tr>
11187 <tr>
11188 <td>bar
11189 </td></tr></table>
11190
11191 !! html/parsoid
11192 <table style="color:red;" title="T48811" about="#mwt1" typeof="mw:Transclusion mw:ExpandedAttrs" data-mw='{"parts":["{| ",{"template":{"target":{"wt":"mixed_attr_content_template","href":"./Template:Mixed_attr_content_template"},"params":{},"i":0}},"\n|-\n|bar\n|}"]}'>
11193 <tbody><tr>
11194 <td>foo</td></tr>
11195 <tr>
11196 <td>bar</td></tr>
11197 </tbody></table>
11198 !!end
11199
11200 !! test
11201 1. Entities and nowikis inside templated attributes should be handled correctly
11202 !! wikitext
11203 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11204 !! html/php
11205 <div style="background:#f9f9f9;">foo</div>
11206
11207 !! html/parsoid
11208 <div style="background:#f9f9f9;" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html"}' data-mw='{"attribs":[[{"txt":"style","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[5,49,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;style{{=}}\\&amp;quot;background:&amp;amp;#35;f9f9f9;\\&amp;quot;&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">style&lt;/span>&lt;span typeof=\"mw:Nowiki\" about=\"#mwt1\" data-parsoid=\"{}\">=&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">\"background:&lt;/span>&lt;span typeof=\"mw:Entity\" about=\"#mwt1\" data-parsoid=\"{&amp;quot;src&amp;quot;:&amp;quot;&amp;amp;#35;&amp;quot;,&amp;quot;srcContent&amp;quot;:&amp;quot;#&amp;quot;}\">#&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">f9f9f9;\"&lt;/span>"},{"html":""}]]}'>foo</div>
11209 !! end
11210
11211 !! test
11212 2. Entities and nowikis inside templated attributes should be handled correctly
11213 !! wikitext
11214 {|
11215 |{{table_attribs_3}}
11216 |}
11217 !! html/php
11218 <table>
11219 <tr>
11220 <td style="background:#f9f9f9;">Foo
11221 </td></tr></table>
11222
11223 !! html/parsoid
11224 <table>
11225 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td style="background:#f9f9f9;" typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_3","href":"./Template:Table_attribs_3"},"params":{},"i":0}}]}'>Foo</td></tr>
11226 </tbody></table>
11227 !! end
11228
11229 !! test
11230 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11231 !! wikitext
11232 {{tbl-start}}
11233 |{{table_attribs_3}}
11234 {{tbl-end}}
11235 !! html/php
11236 <table>
11237 <tr>
11238 <td style="background:#f9f9f9;">Foo
11239 </td></tr></table>
11240
11241 !! html/parsoid
11242 <table about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[],[],[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"tbl-start","href":"./Template:Tbl-start"},"params":{},"i":0}},"\n|",{"template":{"target":{"wt":"table_attribs_3","href":"./Template:Table_attribs_3"},"params":{},"i":1}},"\n",{"template":{"target":{"wt":"tbl-end","href":"./Template:Tbl-end"},"params":{},"i":2}}]}'>
11243 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11244 </tbody></table>
11245 !! end
11246
11247 # T107622
11248 !! test
11249 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11250 !! wikitext
11251 {|
11252 | {{table_attribs_6}} hi
11253 |}
11254 !! html/php
11255 <table>
11256 <tr>
11257 <td style="background: red;"> hi
11258 </td></tr></table>
11259
11260 !! html/parsoid
11261 <table>
11262 <tbody><tr><td style="background: red;" typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":["| ",{"template":{"target":{"wt":"table_attribs_6","href":"./Template:Table_attribs_6"},"params":{},"i":0}}," hi"]}'> hi</td></tr>
11263 </tbody></table>
11264 !! end
11265
11266 !!test
11267 Templates: HTML Tables: 1. Generating start of a HTML table
11268 !! wikitext
11269 {{echo|<table><tr><td>foo</td>}}</tr></table>
11270 !! html
11271 <table><tr><td>foo</td></tr></table>
11272
11273 !!end
11274
11275 !!test
11276 Templates: HTML Tables: 2a. Generating middle of a HTML table
11277 !! wikitext
11278 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11279 !! html
11280 <table><tr><td>foo</td></tr></table>
11281
11282 !!end
11283
11284 !!test
11285 Templates: HTML Tables: 2b. Generating middle of a HTML table
11286 !! wikitext
11287 <table>{{echo|<tr><td>foo</td></tr>}}</table>
11288 !! html
11289 <table><tr><td>foo</td></tr></table>
11290
11291 !!end
11292
11293 !!test
11294 Templates: HTML Tables: 3. Generating end of a HTML table
11295 !! wikitext
11296 <table><tr>{{echo|<td>foo</td></tr></table>}}
11297 !! html
11298 <table><tr><td>foo</td></tr></table>
11299
11300 !!end
11301
11302 !!test
11303 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
11304 !! wikitext
11305 {{echo|<table>}}<tr><td>foo</td></tr></table>
11306 !! html
11307 <table><tr><td>foo</td></tr></table>
11308
11309 !!end
11310
11311 !!test
11312 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
11313 !! wikitext
11314 <table>{{echo|<tr>}}<td>foo</td></tr></table>
11315 !! html
11316 <table><tr><td>foo</td></tr></table>
11317
11318 !!end
11319
11320 !!test
11321 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
11322 !! wikitext
11323 <table><tr>{{echo|<td>}}foo</td></tr></table>
11324 !! html
11325 <table><tr><td>foo</td></tr></table>
11326
11327 !!end
11328
11329 !!test
11330 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
11331 !! wikitext
11332 <table><tr><td>foo{{echo|</td>}}</tr></table>
11333 !! html
11334 <table><tr><td>foo</td></tr></table>
11335
11336 !!end
11337
11338 !!test
11339 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
11340 !! wikitext
11341 <table><tr><td>foo</td>{{echo|</tr>}}</table>
11342 !! html
11343 <table><tr><td>foo</td></tr></table>
11344
11345 !!end
11346
11347 !!test
11348 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
11349 !! wikitext
11350 <table><tr><td>foo</td></tr>{{echo|</table>}}
11351 !! html
11352 <table><tr><td>foo</td></tr></table>
11353
11354 !!end
11355
11356 !!test
11357 Templates: HTML Tables: 5. Proper fostering of categories from inside
11358 !!options
11359 parsoid=wt2html,wt2wt
11360 !! wikitext
11361 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
11362 <!--Two categories (Bug 50330)-->
11363 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
11364 !! html
11365 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
11366 <!--Two categories (Bug 50330)-->
11367 <link rel="mw:PageProp/Category" href="./Category:Bar1"><link rel="mw:PageProp/Category" href="./Category:Bar2"><table><tbody><tr><td>foo</td></tr></tbody></table>
11368 !!end
11369
11370 !!test
11371 Templates: Wiki Tables: 1a. Fostering of entire template content
11372 !! wikitext
11373 {|
11374 {{echo|a}}
11375 |}
11376 !! html
11377 <table>
11378 a
11379 <tr><td></td></tr></table>
11380
11381 !! html+tidy
11382 <p>a</p>
11383 <table>
11384 <tr>
11385 <td></td>
11386 </tr>
11387 </table>
11388 !! end
11389
11390 !!test
11391 Templates: Wiki Tables: 1b. Fostering of entire template content
11392 !! wikitext
11393 {|
11394 {{echo|<div>}}
11395 foo
11396 {{echo|</div>}}
11397 |}
11398 !! html
11399 <table>
11400 <div>
11401 <p>foo
11402 </p>
11403 </div>
11404 <tr><td></td></tr></table>
11405
11406 !! html+tidy
11407 <div>
11408 <p>foo</p>
11409 </div>
11410 <table>
11411 <tr>
11412 <td></td>
11413 </tr>
11414 </table>
11415 !! end
11416
11417 !!test
11418 Templates: Wiki Tables: 2. Fostering of partial template content
11419 !! wikitext
11420 {|
11421 {{echo|a
11422 <div>b</div>}}
11423 |}
11424 !! html
11425 <table>
11426 a
11427 <div>b</div>
11428 <tr><td></td></tr></table>
11429
11430 !! html+tidy
11431 <p>a</p>
11432 <div>b</div>
11433 <table>
11434 <tr>
11435 <td></td>
11436 </tr>
11437 </table>
11438 !! end
11439
11440 !!test
11441 Templates: Wiki Tables: 3. td-content via multiple templates
11442 !! wikitext
11443 {|
11444 {{echo|{{pipe}}a}}{{echo|b}}
11445 |}
11446 !! html
11447 <table>
11448 <tr>
11449 <td>ab
11450 </td></tr></table>
11451
11452 !!end
11453
11454 !!test
11455 Templates: Wiki Tables: 4. Templated tags, no content
11456 !! wikitext
11457 {{tbl-start}}
11458 {{tbl-end}}
11459 !! html
11460 <table>
11461 <tr><td></td></tr></table>
11462
11463 !!end
11464
11465 !!test
11466 Templates: Wiki Tables: 5. Templated tags, regular td-tags
11467 !! wikitext
11468 {{tbl-start}}
11469 |foo
11470 {{tbl-end}}
11471 !! html
11472 <table>
11473 <tr>
11474 <td>foo
11475 </td></tr></table>
11476
11477 !!end
11478
11479 !!test
11480 Templates: Wiki Tables: 6. Templated tags, templated td-tags
11481 !! wikitext
11482 {{tbl-start}}
11483 {{!}}foo
11484 {{tbl-end}}
11485 !! html
11486 <table>
11487 <tr>
11488 <td>foo
11489 </td></tr></table>
11490
11491 !!end
11492
11493 ## This test case is very specific to Parsoid's internals
11494 ## and is hence only tested for Parsoid's code. Parsoid uses
11495 ## a <meta> marker tag for <ref> tags and they are expanded
11496 ## much later. We are verifying that this <meta> tag usage
11497 ## doesn't prevent foster parenting.
11498 !!test
11499 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
11500 !!wikitext
11501 {{PartialTable}}<ref>foo</ref>
11502 |}
11503
11504 <references />
11505 !!html/parsoid
11506 <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"PartialTable","href":"./Template:PartialTable"},"params":{},"i":0}},"&lt;ref>foo&lt;/ref>\n|}"]}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span><table about="#mwt2">
11507 <tbody>
11508 </tbody></table>
11509
11510 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
11511 !!end
11512
11513 !! test
11514 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
11515 !! wikitext
11516 {{echo|
11517 {{{!}}
11518 {{!}}-}}
11519 <onlyinclude>
11520 |foo
11521 </onlyinclude>
11522 {{!}}}
11523 !! html/parsoid
11524 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n{{{!}}\n{{!}}-"}},"i":0}},"\n&lt;onlyinclude>\n|foo\n&lt;/onlyinclude>\n{{!}}}"]}'>
11525 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
11526 <tbody><tr>
11527
11528 <td>foo
11529 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
11530 </tbody></table>
11531 !! end
11532
11533 !!test
11534 Templates: Lists: Multi-line list-items via templates
11535 !! wikitext
11536 *{{echo|a {{nonexistent|
11537 unused}}}}
11538 *{{echo|b {{nonexistent|
11539 unused}}}}
11540 !! html
11541 <ul><li>a <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a></li>
11542 <li>b <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a></li></ul>
11543
11544 !!end
11545
11546 !!test
11547 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
11548 !! wikitext
11549 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
11550 !! html
11551 <p><i>ab</i>c<i>d</i>e
11552 </p>
11553 !!end
11554
11555 !!test
11556 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
11557 (PHP parser generates misnested html)
11558 !! wikitext
11559 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
11560 !! html/parsoid
11561 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_span&quot;,&quot;href&quot;:&quot;./Template:Echo_with_span&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''a&quot;}},&quot;i&quot;:0}}]}"><i>a</i></span><i about="#mwt2" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_span&quot;,&quot;href&quot;:&quot;./Template:Echo_with_span&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;b''c''d&quot;}},&quot;i&quot;:0}},{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_span&quot;,&quot;href&quot;:&quot;./Template:Echo_with_span&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''e&quot;}},&quot;i&quot;:1}}]}"><span>b</span></i><span about="#mwt2">c</span><i about="#mwt2">d<span></span></i><span about="#mwt2">e</span></p>
11562 !!end
11563
11564 !!test
11565 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
11566 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
11567 !! options
11568 parsoid=wt2html,wt2wt
11569 !! wikitext
11570 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
11571 !! html
11572 <div about="#mwt1" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_div&quot;,&quot;href&quot;:&quot;./Template:Echo_with_div&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''a&quot;}},&quot;i&quot;:0}}]}"><i>a</i></div>
11573 <div about="#mwt2" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_div&quot;,&quot;href&quot;:&quot;./Template:Echo_with_div&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;b''c''d&quot;}},&quot;i&quot;:0}}]}"><i>b</i>c<i>d</i></div>
11574 <div about="#mwt3" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_div&quot;,&quot;href&quot;:&quot;./Template:Echo_with_div&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''e&quot;}},&quot;i&quot;:0}}]}">e</div>
11575 !!end
11576
11577 !!test
11578 Templates: Ugly nesting: 4. Divs opened/closed across templates
11579 !! wikitext
11580 a<div>b{{echo|c</div>d}}e
11581 !! html
11582 a<div>bc</div>de
11583
11584 !! html+tidy
11585 <p>a</p>
11586 <div>bc</div>
11587 <p>de</p>
11588 !! end
11589
11590 !!test
11591 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
11592 (Parsoid-centric)
11593 !! options
11594 parsoid
11595 !! wikitext
11596 {|
11597 |{{echo|foo</table>}}
11598 |bar
11599 |}
11600 !! html
11601 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["{|\n|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo</table>"}},"i":0}},"\n|bar\n|}"]}'>
11602
11603 <tbody>
11604 <tr>
11605 <td>foo</td></tr></tbody></table><span about="#mwt1">
11606 </span><span about="#mwt1">|bar</span><span about="#mwt1">
11607 |}</span>
11608 !!end
11609
11610 !!test
11611 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
11612 (Parsoid-centric)
11613 !! options
11614 parsoid
11615 !! wikitext
11616 <table>
11617 <tr>
11618 <td>
11619 <table>
11620 <tr>
11621 <td>1. {{echo|foo </table>}}</td>
11622 <td> bar </td>
11623 <td>2. {{echo|baz </table>}}</td>
11624 </tr>
11625 <tr>
11626 <td>abc</td>
11627 </tr>
11628 </table>
11629 </td>
11630 </tr>
11631 <tr>
11632 <td>xyz</td>
11633 </tr>
11634 </table>
11635 !! html
11636 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["<table>\n <tr>\n <td>\n <table>\n <tr>\n <td>1. ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo </table>"}},"i":0}},"</td>\n <td> bar </td>\n <td>2. ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"baz </table>"}},"i":1}},"</td>\n </tr>\n <tr>\n <td>abc</td>\n </tr>\n </table>\n </td>\n </tr>\n <tr>\n <td>xyz</td>\n </tr>\n</table>"]}'>
11637 <tbody><tr>
11638 <td>
11639 <table>
11640 <tbody><tr>
11641 <td>1. foo </td></tr></tbody></table></td>
11642 <td> bar </td>
11643 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
11644 </span><span about="#mwt2">
11645 </span><span about="#mwt2">
11646 </span><span about="#mwt2">abc</span><span about="#mwt2">
11647 </span><span about="#mwt2">
11648 </span><span about="#mwt2">
11649 </span><span about="#mwt2">
11650 </span><span about="#mwt2">
11651 </span><span about="#mwt2">
11652 </span><span about="#mwt2">xyz</span><span about="#mwt2">
11653 </span><span about="#mwt2">
11654 </span>
11655 !!end
11656
11657 !! test
11658 Templates: Ugly templates: 3. newline-only template parameter
11659 !! wikitext
11660 foo {{echo|
11661 }}
11662 !! html
11663 <p>foo
11664 </p>
11665 !! end
11666
11667 # This looks like a bug: a single newline triggers p/br for some reason.
11668 !! test
11669 Templates: Ugly templates: 4. newline-only template parameter inconsistency
11670 !! wikitext
11671 {{echo|
11672 }}
11673 !! html
11674 <p><br />
11675 </p>
11676 !! end
11677
11678 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
11679 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
11680 !! test
11681 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
11682 !! wikitext
11683 {{echo|<table>}}
11684 {{echo|<div>foo}}
11685 {{echo|</table>}}
11686 !! html/parsoid
11687 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;table>"}},"i":0}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div>foo"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;/table>"}},"i":2}}]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}]]}'>foo
11688 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11689 </table>
11690 !! end
11691
11692 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
11693 # that are "identical" and generate nesting cycles in the algorithm
11694 !! test
11695 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
11696 !! wikitext
11697 {{echo|<table><tr><td><table>}}
11698 {{echo|<div>}}
11699 {{echo|</div>}}
11700 !! html/parsoid
11701 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;table>&lt;tr>&lt;td>&lt;table>"}},"i":0}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div>"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;/div>"}},"i":2}}]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}]]}'><tbody><tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>
11702 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11703 </table></td></tr></tbody></table>
11704 !! end
11705
11706 !!test
11707 Parser Functions: 1. Simple example
11708 !! wikitext
11709 {{uc:foo}}
11710 !! html
11711 <p>FOO
11712 </p>
11713 !!end
11714
11715 !!test
11716 Parser Functions: 2. Nested use (only outermost should be marked up)
11717 !! wikitext
11718 {{uc:{{lc:FOO}}}}
11719 !! html
11720 <p>FOO
11721 </p>
11722 !!end
11723
11724 ###
11725 ### Pre-save transform tests
11726 ###
11727 !! test
11728 pre-save transform: subst:
11729 !! options
11730 pst
11731 !! wikitext
11732 {{subst:test}}
11733 !! html/php
11734 This is a test template
11735 !! end
11736
11737 !! test
11738 pre-save transform: normal template
11739 !! options
11740 pst
11741 !! wikitext
11742 {{test}}
11743 !! html/php
11744 {{test}}
11745 !! end
11746
11747 !! test
11748 pre-save transform: nonexistent template
11749 !! options
11750 pst
11751 !! wikitext
11752 {{thistemplatedoesnotexist}}
11753 !! html/php
11754 {{thistemplatedoesnotexist}}
11755 !! end
11756
11757 !! test
11758 pre-save transform: subst magic variables
11759 !! options
11760 pst
11761 !! wikitext
11762 {{subst:SITENAME}}
11763 !! html/php
11764 MediaWiki
11765 !! end
11766
11767 # This is bug 89, which I fixed. -- wtm
11768 !! test
11769 pre-save transform: subst: templates with parameters
11770 !! options
11771 pst
11772 !! wikitext
11773 {{subst:paramtest|param="something else"}}
11774 !! html/php
11775 This is a test template with parameter "something else"
11776 !! end
11777
11778 !! article
11779 Template:nowikitest
11780 !! text
11781 <nowiki>'''not wiki'''</nowiki>
11782 !! endarticle
11783
11784 !! test
11785 pre-save transform: nowiki in subst (bug 1188)
11786 !! options
11787 pst
11788 !! wikitext
11789 {{subst:nowikitest}}
11790 !! html/php
11791 <nowiki>'''not wiki'''</nowiki>
11792 !! end
11793
11794 !! article
11795 Template:commenttest
11796 !! text
11797 This template has <!-- a comment --> in it.
11798 !! endarticle
11799
11800 !! test
11801 pre-save transform: comment in subst (bug 1936)
11802 !! options
11803 pst
11804 !! wikitext
11805 {{subst:commenttest}}
11806 !! html/php
11807 This template has <!-- a comment --> in it.
11808 !! end
11809
11810 !! test
11811 pre-save transform: unclosed tag
11812 !! options
11813 pst noxml
11814 !! wikitext
11815 <nowiki>'''not wiki'''
11816 !! html/php
11817 <nowiki>'''not wiki'''
11818 !! end
11819
11820 !! test
11821 pre-save transform: mixed tag case
11822 !! options
11823 pst noxml
11824 !! wikitext
11825 <NOwiki>'''not wiki'''</noWIKI>
11826 !! html/php
11827 <NOwiki>'''not wiki'''</noWIKI>
11828 !! end
11829
11830 !! test
11831 pre-save transform: unclosed comment in <nowiki>
11832 !! options
11833 pst noxml
11834 !! wikitext
11835 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
11836 !! html/php
11837 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
11838 !!end
11839
11840 # Leading @ in this template definition works around a limitation
11841 # in parsoid's parserTests which otherwise strips the <span> from the
11842 # result (confusing it for a template wrapper)
11843 !! article
11844 Template:dangerous
11845 !!text
11846 @<span onmouseover="alert('crap')">Oh no</span>
11847 !!endarticle
11848
11849 !!test
11850 (confirming safety of fix for subst bug 1936)
11851 !! wikitext
11852 {{Template:dangerous}}
11853 !! html
11854 <p>@<span>Oh no</span>
11855 </p>
11856 !! end
11857
11858 !! test
11859 pre-save transform: comment containing gallery (bug 5024)
11860 !! options
11861 pst
11862 !! wikitext
11863 <!-- <gallery>data</gallery> -->
11864 !! html/php
11865 <!-- <gallery>data</gallery> -->
11866 !!end
11867
11868 !! test
11869 pre-save transform: comment containing extension
11870 !! options
11871 pst
11872 !! wikitext
11873 <!-- <tag>data</tag> -->
11874 !! html/php
11875 <!-- <tag>data</tag> -->
11876 !!end
11877
11878 !! test
11879 pre-save transform: comment containing nowiki
11880 !! options
11881 pst
11882 !! wikitext
11883 <!-- <nowiki>data</nowiki> -->
11884 !! html/php
11885 <!-- <nowiki>data</nowiki> -->
11886 !!end
11887
11888 !! test
11889 pre-save transform: <noinclude> in subst (bug 3298)
11890 !! options
11891 pst
11892 !! wikitext
11893 {{subst:Includes}}
11894 !! html/php
11895 Foobar
11896 !! end
11897
11898 !! test
11899 pre-save transform: <onlyinclude> in subst (bug 3298)
11900 !! options
11901 pst
11902 !! wikitext
11903 {{subst:Includes2}}
11904 !! html/php
11905 Foo
11906 !! end
11907
11908 !! article
11909 Template:SubstTest
11910 !!text
11911 {{<includeonly>subst:</includeonly>Includes}}
11912 !! endarticle
11913
11914 !! article
11915 Template:SafeSubstTest
11916 !! text
11917 {{<includeonly>safesubst:</includeonly>Includes}}
11918 !! endarticle
11919
11920 !! test
11921 bug 22297: safesubst: works during PST
11922 !! options
11923 pst
11924 !! wikitext
11925 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
11926 !! html/php
11927 FoobarFoobar
11928 !! end
11929
11930 !! test
11931 bug 22297: safesubst: works during normal parse
11932 !! wikitext
11933 {{SafeSubstTest}}
11934 !! html
11935 <p>Foobar
11936 </p>
11937 !! end
11938
11939 !! test
11940 subst: does not work during normal parse
11941 !! wikitext
11942 {{SubstTest}}
11943 !! html
11944 <p>{{subst:Includes}}
11945 </p>
11946 !! end
11947
11948 !! test
11949 pre-save transform: context links ("pipe trick")
11950 !! options
11951 pst
11952 !! wikitext
11953 [[Article (context)|]]
11954 [[Bar:Article|]]
11955 [[:Bar:Article|]]
11956 [[Bar:Article (context)|]]
11957 [[:Bar:Article (context)|]]
11958 [[|Article]]
11959 [[|Article (context)]]
11960 [[Bar:X (Y) Z|]]
11961 [[:Bar:X (Y) Z|]]
11962 !! html/php
11963 [[Article (context)|Article]]
11964 [[Bar:Article|Article]]
11965 [[:Bar:Article|Article]]
11966 [[Bar:Article (context)|Article]]
11967 [[:Bar:Article (context)|Article]]
11968 [[Article]]
11969 [[Article (context)]]
11970 [[Bar:X (Y) Z|X (Y) Z]]
11971 [[:Bar:X (Y) Z|X (Y) Z]]
11972 !! end
11973
11974 !! test
11975 pre-save transform: context links ("pipe trick") with interwiki prefix
11976 !! options
11977 pst
11978 !! wikitext
11979 [[interwiki:Article|]]
11980 [[:interwiki:Article|]]
11981 [[interwiki:Bar:Article|]]
11982 [[:interwiki:Bar:Article|]]
11983 !! html/php
11984 [[interwiki:Article|Article]]
11985 [[:interwiki:Article|Article]]
11986 [[interwiki:Bar:Article|Bar:Article]]
11987 [[:interwiki:Bar:Article|Bar:Article]]
11988 !! end
11989
11990 !! test
11991 pre-save transform: context links ("pipe trick") with parens in title
11992 !! options
11993 pst title=[[Somearticle (context)]]
11994 !! wikitext
11995 [[|Article]]
11996 !! html/php
11997 [[Article (context)|Article]]
11998 !! end
11999
12000 !! test
12001 pre-save transform: context links ("pipe trick") with comma in title
12002 !! options
12003 pst title=[[Someplace, Somewhere]]
12004 !! wikitext
12005 [[|Otherplace]]
12006 [[Otherplace, Elsewhere|]]
12007 [[Otherplace, Elsewhere, Anywhere|]]
12008 !! html/php
12009 [[Otherplace, Somewhere|Otherplace]]
12010 [[Otherplace, Elsewhere|Otherplace]]
12011 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12012 !! end
12013
12014 !! test
12015 pre-save transform: context links ("pipe trick") with parens and comma
12016 !! options
12017 pst title=[[Someplace (IGNORED), Somewhere]]
12018 !! wikitext
12019 [[|Otherplace]]
12020 [[Otherplace (place), Elsewhere|]]
12021 !! html/php
12022 [[Otherplace, Somewhere|Otherplace]]
12023 [[Otherplace (place), Elsewhere|Otherplace]]
12024 !! end
12025
12026 !! test
12027 pre-save transform: context links ("pipe trick") with comma and parens
12028 !! options
12029 pst title=[[Who, me? (context)]]
12030 !! wikitext
12031 [[|Yes, you.]]
12032 [[Me, Myself, and I (1937 song)|]]
12033 !! html/php
12034 [[Yes, you. (context)|Yes, you.]]
12035 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12036 !! end
12037
12038 !! test
12039 pre-save transform: context links ("pipe trick") with namespace
12040 !! options
12041 pst title=[[Ns:Somearticle]]
12042 !! wikitext
12043 [[|Article]]
12044 !! html/php
12045 [[Ns:Article|Article]]
12046 !! end
12047
12048 !! test
12049 pre-save transform: context links ("pipe trick") with namespace and parens
12050 !! options
12051 pst title=[[Ns:Somearticle (context)]]
12052 !! wikitext
12053 [[|Article]]
12054 !! html/php
12055 [[Ns:Article (context)|Article]]
12056 !! end
12057
12058 !! test
12059 pre-save transform: context links ("pipe trick") with namespace and comma
12060 !! options
12061 pst title=[[Ns:Somearticle, Context, Whatever]]
12062 !! wikitext
12063 [[|Article]]
12064 !! html/php
12065 [[Ns:Article, Context, Whatever|Article]]
12066 !! end
12067
12068 !! test
12069 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12070 !! options
12071 pst title=[[Ns:Somearticle, Context (context)]]
12072 !! wikitext
12073 [[|Article]]
12074 !! html/php
12075 [[Ns:Article (context)|Article]]
12076 !! end
12077
12078 !! test
12079 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12080 !! options
12081 pst title=[[Ns:Somearticle (IGNORED), Context]]
12082 !! wikitext
12083 [[|Article]]
12084 !! html/php
12085 [[Ns:Article, Context|Article]]
12086 !! end
12087
12088 !! test
12089 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12090 !! options
12091 pst
12092 !! wikitext
12093 [[Article(context)|]]
12094 [[Bar:Article(context)|]]
12095 [[:Bar:Article(context)|]]
12096 [[|Article(context)]]
12097 [[Bar:X(Y)Z|]]
12098 [[:Bar:X(Y)Z|]]
12099 !! html/php
12100 [[Article(context)|Article]]
12101 [[Bar:Article(context)|Article]]
12102 [[:Bar:Article(context)|Article]]
12103 [[Article(context)]]
12104 [[Bar:X(Y)Z|X(Y)Z]]
12105 [[:Bar:X(Y)Z|X(Y)Z]]
12106 !! end
12107
12108 !! test
12109 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12110 !! options
12111 pst
12112 !! wikitext
12113 [[Article (context)|]]
12114 [[Bar:Article (context)|]]
12115 [[:Bar:Article (context)|]]
12116 [[|Article (context)]]
12117 [[Bar:X (Y) Z|]]
12118 [[:Bar:X (Y) Z|]]
12119 !! html/php
12120 [[Article (context)|Article]]
12121 [[Bar:Article (context)|Article]]
12122 [[:Bar:Article (context)|Article]]
12123 [[Article (context)]]
12124 [[Bar:X (Y) Z|X (Y) Z]]
12125 [[:Bar:X (Y) Z|X (Y) Z]]
12126 !! end
12127
12128 !! test
12129 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12130 !! options
12131 pst
12132 !! wikitext
12133 [[Article(context)|]]
12134 [[Bar:Article(context)|]]
12135 [[:Bar:Article(context)|]]
12136 [[|Article(context)]]
12137 [[Bar:X(Y)Z|]]
12138 [[:Bar:X(Y)Z|]]
12139 !! html/php
12140 [[Article(context)|Article]]
12141 [[Bar:Article(context)|Article]]
12142 [[:Bar:Article(context)|Article]]
12143 [[Article(context)]]
12144 [[Bar:X(Y)Z|X(Y)Z]]
12145 [[:Bar:X(Y)Z|X(Y)Z]]
12146 !! end
12147
12148 !! test
12149 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12150 !! options
12151 pst
12152 !! wikitext
12153 [[Article (context), context|]]
12154 [[Article (context),context|]]
12155 [[Bar:Article (context), context|]]
12156 [[Bar:Article (context),context|]]
12157 [[:Bar:Article (context), context|]]
12158 [[:Bar:Article (context),context|]]
12159 !! html/php
12160 [[Article (context), context|Article]]
12161 [[Article (context),context|Article]]
12162 [[Bar:Article (context), context|Article]]
12163 [[Bar:Article (context),context|Article]]
12164 [[:Bar:Article (context), context|Article]]
12165 [[:Bar:Article (context),context|Article]]
12166 !! end
12167
12168 !! test
12169 pre-save transform: trim trailing empty lines
12170 !! options
12171 pst
12172 !! wikitext
12173 Empty lines are trimmed
12174
12175
12176
12177
12178 !! html/php
12179 Empty lines are trimmed
12180 !! end
12181
12182 !! test
12183 pre-save transform: Signature expansion
12184 !! options
12185 pst
12186 !! wikitext
12187 * ~~~
12188 * <noinclude>~~~</noinclude>
12189 * <includeonly>~~~</includeonly>
12190 * <onlyinclude>~~~</onlyinclude>
12191 !! html/php
12192 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12193 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12194 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12195 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12196 !! end
12197
12198
12199 !! test
12200 pre-save transform: Signature expansion in nowiki tags (bug 93)
12201 !! options
12202 pst disabled
12203 !! wikitext
12204 Shall not expand:
12205
12206 <nowiki>~~~~</nowiki>
12207
12208 <includeonly><nowiki>~~~~</nowiki></includeonly>
12209
12210 <noinclude><nowiki>~~~~</nowiki></noinclude>
12211
12212 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12213
12214 {{subst:Foo}} shall be converted to FOO
12215
12216 As well as inside noinclude/onlyinclude
12217 <noinclude>{{subst:Foo}}</noinclude>
12218 <onlyinclude>{{subst:Foo}}</onlyinclude>
12219
12220 But not inside includeonly
12221 <includeonly>{{subst:Foo}}</includeonly>
12222 !! html/php
12223 Shall not expand:
12224
12225 <nowiki>~~~~</nowiki>
12226
12227 <includeonly><nowiki>~~~~</nowiki></includeonly>
12228
12229 <noinclude><nowiki>~~~~</nowiki></noinclude>
12230
12231 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12232
12233 FOO shall be converted to FOO
12234
12235 As well as inside noinclude/onlyinclude
12236 <noinclude>FOO</noinclude>
12237 <onlyinclude>FOO</onlyinclude>
12238
12239 But not inside includeonly
12240 <includeonly>{{subst:Foo}}</includeonly>
12241 !! end
12242
12243 !! test
12244 Parsoid: Recognize nowiki with trailing space in tags
12245 !! options
12246 parsoid=wt2html
12247 !! wikitext
12248 <nowiki ><div>[[foo]]</nowiki >
12249
12250 a<nowiki / >b
12251
12252 c<nowiki />d
12253
12254 e<nowiki/ >f
12255 !! html
12256 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12257 <p>ab</p>
12258 <p>cd</p>
12259 <p>ef</p>
12260 !! end
12261
12262 !! test
12263 Parsoid: Recognize nowiki with odd capitalization
12264 !! options
12265 parsoid=wt2html
12266 !! wikitext
12267 <noWikI ><div>[[foo]]</Nowiki >
12268 !! html
12269 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12270 !! end
12271
12272
12273 !! test
12274 Parsoid: Escape nowiki with trailing space in tags
12275 !! options
12276 parsoid=html2wt
12277 !! html/parsoid
12278 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12279 <p>a&lt;nowiki /&gt;b</p>
12280 <p>c&lt;nowiki/ &gt;d</p>
12281 !! wikitext
12282 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12283
12284 a&lt;nowiki /&gt;b
12285
12286 c&lt;nowiki/ &gt;d
12287 !! end
12288
12289 !! test
12290 Parsoid: Escape weird noWikI capitalizations
12291 !! options
12292 parsoid=html2wt
12293 !! html/parsoid
12294 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
12295 !! wikitext
12296 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
12297 !! end
12298
12299 ###
12300 ### Message transform tests
12301 ###
12302 !! test
12303 message transform: magic variables
12304 !! options
12305 msg
12306 !! wikitext
12307 {{SITENAME}}
12308 !! html
12309 MediaWiki
12310 !! end
12311
12312 !! test
12313 message transform: should not transform wiki markup
12314 !! options
12315 msg
12316 !! wikitext
12317 ''test''
12318 !! html
12319 ''test''
12320 !! end
12321
12322 !! test
12323 message transform: <noinclude> in transcluded template (bug 4926)
12324 !! options
12325 msg
12326 !! wikitext
12327 {{Includes}}
12328 !! html
12329 Foobar
12330 !! end
12331
12332 !! test
12333 message transform: <onlyinclude> in transcluded template (bug 4926)
12334 !! options
12335 msg
12336 !! wikitext
12337 {{Includes2}}
12338 !! html
12339 Foo
12340 !! end
12341
12342 !! test
12343 {{#special:}} page name, known
12344 !! options
12345 msg
12346 !! wikitext
12347 {{#special:Recentchanges}}
12348 !! html
12349 Special:RecentChanges
12350 !! end
12351
12352 !! test
12353 {{#special:}} page name with subpage, known
12354 !! options
12355 msg
12356 !! wikitext
12357 {{#special:Recentchanges/param}}
12358 !! html
12359 Special:RecentChanges/param
12360 !! end
12361
12362 !! test
12363 {{#special:}} page name, unknown
12364 !! options
12365 msg
12366 !! wikitext
12367 {{#special:foobar nonexistent}}
12368 !! html
12369 Special:Foobar nonexistent
12370 !! end
12371
12372 !! test
12373 {{#speciale:}} page name, known
12374 !! options
12375 msg
12376 !! wikitext
12377 {{#speciale:Recentchanges}}
12378 !! html
12379 Special:RecentChanges
12380 !! end
12381
12382 !! test
12383 {{#speciale:}} page name with subpage, known
12384 !! options
12385 msg
12386 !! wikitext
12387 {{#speciale:Recentchanges/param}}
12388 !! html
12389 Special:RecentChanges/param
12390 !! end
12391
12392 !! test
12393 {{#speciale:}} page name, unknown
12394 !! options
12395 msg
12396 !! wikitext
12397 {{#speciale:foobar nonexistent}}
12398 !! html
12399 Special:Foobar_nonexistent
12400 !! end
12401
12402 ###
12403 ### Images
12404 ###
12405 ### For Parsoid-specific tests, see
12406 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12407
12408 !! test
12409 Simple image
12410 !! options
12411 parsoid=wt2html,wt2wt,html2html
12412 !! wikitext
12413 [[Image:foobar.jpg]]
12414 !! html/php
12415 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12416 </p>
12417 !! html/parsoid
12418 <p><span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12419 !! end
12420
12421 !! test
12422 Simple image (using File: namespace, now canonical)
12423 !! wikitext
12424 [[File:Foobar.jpg]]
12425 !! html/php
12426 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12427 </p>
12428 !! html/parsoid
12429 <p><span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12430 !! end
12431
12432 !! test
12433 Right-aligned image
12434 !! wikitext
12435 [[File:Foobar.jpg|right]]
12436 !! html/php
12437 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
12438
12439 !! html/parsoid
12440 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
12441 !! end
12442
12443 !! test
12444 Image with caption
12445 !! wikitext
12446 [[File:Foobar.jpg|right|Caption text]]
12447 !! html/php
12448 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
12449
12450 !! html/parsoid
12451 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption text</figcaption></figure>
12452 !! end
12453
12454 !! test
12455 Image with caption, bug 53312 #1
12456 !! wikitext
12457 [[File:Foobar.jpg|right|Caption page stuff]]
12458 !! html/php
12459 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption page stuff"><img alt="Caption page stuff" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
12460
12461 !! html/parsoid
12462 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption page stuff</figcaption></figure>
12463 !! end
12464
12465 !! test
12466 Image with caption, bug 53312 #2
12467 !! wikitext
12468 [[File:Foobar.jpg|right|Caption page=]]
12469 !! html/php
12470 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption page="><img alt="Caption page=" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
12471
12472 !! html/parsoid
12473 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption page=</figcaption></figure>
12474 !! end
12475
12476 !! test
12477 Image with caption, bug 53312 #3
12478 !! wikitext
12479 [[File:Foobar.jpg|right|Caption page=stuff]]
12480 !! html/php
12481 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption page=stuff"><img alt="Caption page=stuff" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
12482
12483 !! html/parsoid
12484 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption page=stuff</figcaption></figure>
12485 !! end
12486
12487 !! test
12488 Allow empty links in image captions (Bug 60753)
12489 !! options
12490 thumbsize=220
12491 !! wikitext
12492 [[File:Foobar.jpg|thumb|Caption [[Link1]]
12493 [[]]
12494 [[Link2]]
12495 ]]
12496 !! html/php
12497 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Caption <a href="/index.php?title=Link1&amp;action=edit&amp;redlink=1" class="new" title="Link1 (page does not exist)">Link1</a> [[]] <a href="/index.php?title=Link2&amp;action=edit&amp;redlink=1" class="new" title="Link2 (page does not exist)">Link2</a></div></div></div>
12498
12499 !! html/parsoid
12500 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Caption [[Link1]]\n[[]]\n[[Link2]]\n"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>Caption <a rel="mw:WikiLink" href="./Link1" title="Link1" data-parsoid='{"stx":"simple","a":{"href":"./Link1"},"sa":{"href":"Link1"}}'>Link1</a>
12501 [[]]
12502 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
12503 </figcaption></figure>
12504 !! end
12505
12506 !! test
12507 Titles in unlinked images (T23454)
12508 !! wikitext
12509 [[File:Foobar.jpg|link=|stuff]]
12510 !! html/php
12511 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
12512 </p>
12513 !! end
12514
12515 !! test
12516 Link with empty target
12517 !! wikitext
12518 [[]]
12519 !! html
12520 <p>[[]]
12521 </p>
12522 !! end
12523
12524 !! test
12525 Image with link trail
12526 !! wikitext
12527 Linktrails should not work for images: [[File:Foobar.jpg]]s
12528 !! html/php
12529 <p>Linktrails should not work for images: <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>s
12530 </p>
12531 !! html/parsoid
12532 <p>Linktrails should not work for images: <span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span>s</p>
12533 !! end
12534
12535 !! test
12536 Image with empty attribute
12537 !! options
12538 parsoid=wt2html,wt2wt,html2html
12539 !! wikitext
12540 [[File:Foobar.jpg|right||Caption text]]
12541 !! html/php
12542 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
12543
12544 !! html/parsoid
12545 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption text</figcaption></figure>
12546 !! end
12547
12548 !! test
12549 1. Block image with individual attributes from templates
12550 !! wikitext
12551 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
12552 !! html/php
12553 <div class="thumb tright"><div class="thumbinner" style="width:139px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" width="137" height="16" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/206px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/274px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is a caption</div></div></div>
12554
12555 !! html/parsoid
12556 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[24,38,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
12557 !! end
12558
12559 !! test
12560 2. Block Image with individual attributes from templates
12561 !! wikitext
12562 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
12563 !! html/php
12564 <div class="thumb tright"><div class="thumbinner" style="width:139px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" width="137" height="16" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/206px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/274px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is a caption</div></div></div>
12565
12566 !! html/parsoid
12567 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt3" data-mw='{"attribs":[["thumbnail",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[18,32,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;thumb&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">thumb&lt;/span>"}],["width",{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[33,47,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
12568 !! end
12569
12570 !! test
12571 3. Inline image with individual attributes from templates
12572 !! wikitext
12573 [[File:Foobar.jpg|{{echo|50px}}]]
12574 !! html/php
12575 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" width="50" height="6" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/75px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/100px-Foobar.jpg 2x" /></a>
12576 </p>
12577 !! html/parsoid
12578 <p><span typeof="mw:Image mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"width","ak":"{{echo|50px}}"}]}' data-mw='{"attribs":[["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[18,31,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;50px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">50px&lt;/span>"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
12579 !! end
12580
12581 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
12582 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
12583 !! test
12584 Image with multiple attributes from the same template
12585 !! wikitext
12586 [[File:Foobar.jpg|{{image_attribs}}]]
12587 !! html/php
12588 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
12589
12590 !! html/parsoid
12591 <figure class="mw-default-size mw-halign-right" typeof="mw:Image mw:Placeholder"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption text</figcaption></figure>
12592 !! end
12593
12594 !! test
12595 Image with link tails
12596 !! options
12597 thumbsize=220
12598 !! wikitext
12599 123[[File:Foobar.jpg]]456
12600 123[[File:Foobar.jpg|right]]456
12601 123[[File:Foobar.jpg|thumb]]456
12602 !! html/php
12603 <p>123<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>456
12604 </p>
12605 123<div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>456
12606 123<div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div>456
12607
12608 !! html/php+tidy
12609 <p>123<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>456</p>
12610 <p>123</p>
12611 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
12612 <p>456 123</p>
12613 <div class="thumb tright">
12614 <div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>
12615 <div class="thumbcaption">
12616 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
12617 </div>
12618 </div>
12619 </div>
12620 <p>456</p>
12621 !! html/parsoid
12622 <p>123<span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span>456</p>
12623 <p>123</p><figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure><p>456</p>
12624 <p>123</p><figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></figure><p>456</p>
12625 !! end
12626
12627 !! test
12628 Image with multiple captions -- only last one is accepted
12629 !! wikitext
12630 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
12631 !! html/php
12632 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption3 - accepted"><img alt="Caption3 - accepted" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
12633
12634 !! html/parsoid
12635 <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption3 - accepted</figcaption></figure>
12636 !! end
12637
12638 !! test
12639 Image with multiple widths -- use last
12640 !! wikitext
12641 [[File:Foobar.jpg|200px|300px|caption]]
12642 !! html/php
12643 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" width="300" height="34" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/450px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/600px-Foobar.jpg 2x" /></a>
12644 </p>
12645 !! html/parsoid
12646 <p><span typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a></span></p>
12647 !! end
12648
12649 !! test
12650 Image with multiple alignments -- use first (bug 48664)
12651 !! options
12652 thumbsize=220
12653 !! wikitext
12654 [[File:Foobar.jpg|thumb|left|right|center|caption]]
12655
12656 [[File:Foobar.jpg|middle|text-top|caption]]
12657 !! html/php
12658 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
12659 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" style="vertical-align: middle" /></a>
12660 </p>
12661 !! html/parsoid
12662 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
12663 <p><span class="mw-default-size mw-valign-middle" typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12664 !! end
12665
12666 !! test
12667 Image with width attribute at different positions
12668 !! wikitext
12669 [[File:Foobar.jpg|200px|right|Caption]]
12670 [[File:Foobar.jpg|right|200px|Caption]]
12671 [[File:Foobar.jpg|right|Caption|200px]]
12672 !! html/php
12673 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
12674 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
12675 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
12676
12677 !! html/parsoid
12678 <figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
12679 <figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
12680 <figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
12681 !! end
12682
12683 # a sad bit of backward-compatibility
12684 !! test
12685 Image with size specified with pxpx (bug 13500, 51628)
12686 !! options
12687 parsoid=wt2html,wt2wt,html2html
12688 !! wikitext
12689 [[File:Foobar.jpg|20pxpx]]
12690 [[File:Foobar.jpg|200x20pxpx]]
12691 !! html/php
12692 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" width="20" height="2" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/30px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/40px-Foobar.jpg 2x" /></a>
12693 <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/177px-Foobar.jpg" width="177" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/265px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/353px-Foobar.jpg 2x" /></a>
12694 </p>
12695 !! html/parsoid
12696 <p><span typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="2" width="20"/></a></span> <span typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/177px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="20" width="177"/></a></span></p>
12697 !! end
12698
12699 !! test
12700 Image with link parameter, wiki target
12701 !! wikitext
12702 [[File:Foobar.jpg|link=Main Page]]
12703 !! html/php
12704 <p><a href="/wiki/Main_Page" title="Main Page"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12705 </p>
12706 !! html/parsoid
12707 <p><span class="mw-default-size" typeof="mw:Image"><a href="Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12708 !! end
12709
12710 # parsoid bug 49293 (part 1)
12711 !! test
12712 Image with link parameter, URL target
12713 !! wikitext
12714 [[File:Foobar.jpg|link=http://example.com/]]
12715 !! html/php
12716 <p><a href="http://example.com/" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12717 </p>
12718 !! html/parsoid
12719 <p><span class="mw-default-size" typeof="mw:Image"><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12720 !! end
12721
12722 # parsoid bug 49293 (part 2)
12723 !! test
12724 Image with link parameter, protocol-less URL target
12725 !! wikitext
12726 [[File:Foobar.jpg|link=//example.com/]]
12727 !! html/php
12728 <p><a href="//example.com/" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12729 </p>
12730 !! html/parsoid
12731 <p><span class="mw-default-size" typeof="mw:Image"><a href="//example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12732 !! end
12733
12734 !! test
12735 Escaping non-block captions (T107435)
12736 !! options
12737 parsoid={
12738 "modes": ["wt2wt"],
12739 "changes": [
12740 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
12741 ]
12742 }
12743 !! wikitext
12744 [[Image:Foobar.jpg|caption]]
12745 !! wikitext/edited
12746 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
12747 !! end
12748
12749 !! test
12750 Image with link parameter, wgExternalLinkTarget
12751 !! wikitext
12752 [[Image:foobar.jpg|link=http://example.com/]]
12753 !! config
12754 wgExternalLinkTarget='foobar'
12755 !! html
12756 <p><a href="http://example.com/" target="foobar" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12757 </p>
12758 !! end
12759
12760 !! test
12761 Image with link parameter, wgNoFollowLinks set to false
12762 !! wikitext
12763 [[Image:foobar.jpg|link=http://example.com/]]
12764 !! config
12765 wgNoFollowLinks=false
12766 !! html
12767 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12768 </p>
12769 !! end
12770
12771 !! test
12772 Image with link parameter, wgNoFollowDomainExceptions
12773 !! wikitext
12774 [[Image:foobar.jpg|link=http://example.com/]]
12775 !! config
12776 wgNoFollowDomainExceptions='example.com'
12777 !! html
12778 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12779 </p>
12780 !! end
12781
12782 !! test
12783 Image with link parameter, wgExternalLinkTarget, unnamed parameter
12784 !! wikitext
12785 [[Image:foobar.jpg|link=http://example.com/|Title]]
12786 !! config
12787 wgExternalLinkTarget='foobar'
12788 !! html
12789 <p><a href="http://example.com/" title="Title" target="foobar" rel="nofollow"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12790 </p>
12791 !! end
12792
12793 !! test
12794 Image with empty link parameter
12795 !! wikitext
12796 [[File:Foobar.jpg|link=]]
12797 !! html/php
12798 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
12799 </p>
12800 !! html/parsoid
12801 <p><span class="mw-default-size" typeof="mw:Image"><span><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></span></span></p>
12802 !! end
12803
12804 !! test
12805 Image with link parameter (wiki target) and unnamed parameter
12806 !! wikitext
12807 [[File:Foobar.jpg|link=Main_Page|Title]]
12808 !! html/php
12809 <p><a href="/wiki/Main_Page" title="Title"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12810 </p>
12811 !! html/parsoid
12812 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"Title"}'><a href="Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12813 !! end
12814
12815 !! test
12816 Image with link parameter (URL target) and unnamed parameter
12817 !! wikitext
12818 [[File:Foobar.jpg|link=http://example.com/|Title]]
12819 !! html/php
12820 <p><a href="http://example.com/" title="Title" rel="nofollow"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12821 </p>
12822 !! html/parsoid
12823 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"Title"}'><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
12824 !! end
12825
12826 !! test
12827 Thumbnail image with link parameter
12828 !! options
12829 thumbsize=220
12830 parsoid=wt2html,wt2wt,html2html
12831 !! wikitext
12832 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
12833 !! html/php
12834 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="http://example.com/"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
12835
12836 !! html/parsoid
12837 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>Title</figcaption></figure>
12838 !! end
12839
12840 !! test
12841 Manually-specified thumbnail image
12842 !! options
12843 thumbsize=220
12844 !! wikitext
12845 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
12846 !! html/php
12847 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/File:Foobar.jpg"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
12848
12849 !! html/parsoid
12850 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
12851 !! end
12852
12853 !! test
12854 Manually-specified thumbnail image with explicit link to wiki page
12855 !! options
12856 thumbsize=220
12857 parsoid=wt2html,wt2wt,html2html
12858 !! wikitext
12859 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
12860 !! html/php
12861 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
12862
12863 !! html/parsoid
12864 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
12865 !! end
12866
12867 !! test
12868 Manually-specified thumbnail image with explicit link to url
12869 !! options
12870 thumbsize=220
12871 parsoid=wt2html,wt2wt,html2html
12872 !! wikitext
12873 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
12874 !! html/php
12875 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="http://example.com"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
12876
12877 !! html/parsoid
12878 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="http://example.com"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
12879 !! end
12880
12881 !! test
12882 Manually-specified thumbnail image with explicit no link
12883 !! options
12884 thumbsize=220
12885 parsoid=wt2html,wt2wt,html2html
12886 !! wikitext
12887 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
12888 !! html/php
12889 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
12890
12891 !! html/parsoid
12892 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><span><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></span><figcaption>Title</figcaption></figure>
12893 !! end
12894
12895 !! test
12896 Manually-specified thumbnail image with explicit link and alt text
12897 !! options
12898 thumbsize=220
12899 parsoid=wt2html,wt2wt,html2html
12900 !! wikitext
12901 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
12902 !! html/php
12903 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="alttext" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
12904
12905 !! html/parsoid
12906 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="Main_Page"><img alt="alttext" resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
12907 !! end
12908
12909 !! test
12910 Image with frame and link
12911 !! options
12912 parsoid=wt2html,wt2wt,html2html
12913 !! wikitext
12914 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
12915 !! html/php
12916 <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
12917
12918 !! html/parsoid
12919 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>This is a test image <a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a></figcaption></figure>
12920 !! end
12921
12922 !! test
12923 Image with frame and link and explicit alt
12924 !! options
12925 parsoid=wt2html,wt2wt,html2html
12926 !! wikitext
12927 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
12928 !! html/php
12929 <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Altitude" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
12930
12931 !! html/parsoid
12932 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img alt="Altitude" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>This is a test image <a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a></figcaption></figure>
12933 !! end
12934
12935 !! test
12936 Image with wiki markup in implicit alt
12937 !! wikitext
12938 [[Image:Foobar.jpg|testing '''bold''' in alt]]
12939
12940 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
12941 !! html/php
12942 <p><a href="/wiki/File:Foobar.jpg" class="image" title="testing bold in alt"><img alt="testing bold in alt" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12943 </p><p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="testing bold in alt" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
12944 </p>
12945 !! html/parsoid
12946 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"testing &lt;b data-parsoid=\"{&amp;quot;dsr&amp;quot;:[27,37,3,3]}\">bold&lt;/b> in alt"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"Image:Foobar.jpg"}}'/></a></span></p>
12947 <p><span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img alt="testing bold in alt" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"alt":"testing bold in alt","resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"alt":"alt=testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt","resource":"Image:Foobar.jpg"}}'/></a></span></p>
12948 !! end
12949
12950 !! test
12951 Alt image option should handle most kinds of wikitext without barfing
12952 !! wikitext
12953 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
12954 !! html/php
12955 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="This is a link and a bold template." src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is the image caption</div></div></div>
12956
12957 !! html/parsoid
12958 <figure class="mw-default-size" typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"This is the image caption"},{"ck":"alt","ak":"alt=This is a [[link]] and a {{echo|&#39;&#39;bold template&#39;&#39;}}."}]}' data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["alt",{"html":"alt=This is a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;simple&amp;quot;,&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;./Link&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;link&amp;quot;},&amp;quot;dsr&amp;quot;:[65,73,2,2]}\">link&lt;/a> and a &lt;i about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[80,106,null,null],&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;&#39;&#39;bold template&#39;&#39;&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">bold template&lt;/i>."}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img alt="This is a link and a bold template." resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"alt":"This is a link and a bold template.","resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"alt":"alt=This is a [[link]] and a {{echo|&#39;&#39;bold template&#39;&#39;}}.","resource":"Image:Foobar.jpg"}}'/></a><figcaption>This is the image caption</figcaption></figure>
12959 !! end
12960
12961 ###################
12962 # Conflicting image format options.
12963 # First option specified should 'win'.
12964 # All three cases in each test should be identical.
12965
12966 !! test
12967 Image with 'frameless' first.
12968 !! options
12969 parsoid=wt2html,wt2wt,html2html
12970 !! wikitext
12971 [[File:Foobar.jpg|frameless|caption]]
12972
12973 [[File:Foobar.jpg|frameless|frame|caption]]
12974
12975 [[File:Foobar.jpg|frameless|thumb|caption]]
12976 !! html/php
12977 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
12978 </p><p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
12979 </p><p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
12980 </p>
12981 !! html/parsoid
12982 <p><span class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
12983 <p><span class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
12984 <p><span class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
12985 !! end
12986
12987 !! test
12988 Image with 'frame' first.
12989 !! options
12990 parsoid=wt2html,wt2wt,html2html
12991 !! wikitext
12992 [[File:Foobar.jpg|frame|caption]]
12993 [[File:Foobar.jpg|frame|frameless|caption]]
12994 [[File:Foobar.jpg|frame|thumb|caption]]
12995 !! html/php
12996 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">caption</div></div></div>
12997 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">caption</div></div></div>
12998 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">caption</div></div></div>
12999
13000 !! html/parsoid
13001 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
13002 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
13003 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
13004 !! end
13005
13006 !! test
13007 Image with 'thumb' first.
13008 !! options
13009 parsoid=wt2html,wt2wt,html2html
13010 !! wikitext
13011 [[File:Foobar.jpg|thumb|caption]]
13012 [[File:Foobar.jpg|thumb|frameless|caption]]
13013 [[File:Foobar.jpg|thumb|frame|caption]]
13014 !! html/php
13015 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
13016 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
13017 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
13018
13019 !! html/parsoid
13020 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
13021 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
13022 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
13023 !! end
13024
13025 ###################
13026 # Image sizing.
13027 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13028 # and https://phabricator.wikimedia.org/T64258
13029 # Foobar has actual size of 1941x220
13030 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13031 # a scalable format.
13032 # 2. Framed images always ignore size options; always render at default size.
13033 # 3. "Unspecified format" and border are the only types which can be
13034 # enlarged.
13035
13036 !! test
13037 Image: "unspecified format" and border enlarge
13038 !! options
13039 parsoid=wt2html,wt2wt,html2html
13040 !! wikitext
13041 [[File:Foobar.jpg|2000px]]
13042
13043 [[File:Foobar.jpg|border|2000px]]
13044 !! html/php
13045 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="2000" height="227" /></a>
13046 </p><p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="2000" height="227" class="thumbborder" /></a>
13047 </p>
13048 !! html/parsoid
13049 <p><span typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1941px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="227" width="2000"/></a></span></p>
13050 <p><span class="mw-image-border" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1941px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="227" width="2000"/></a></span></p>
13051 !! end
13052
13053 !! test
13054 Image: "unspecified format" and border reduce
13055 !! options
13056 parsoid=wt2html,wt2wt,html2html
13057 !! wikitext
13058 [[File:Foobar.jpg|1000px]]
13059
13060 [[File:Foobar.jpg|border|1000px]]
13061 !! html/php
13062 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" width="1000" height="113" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/1500px-Foobar.jpg 1.5x, http://example.com/images/3/3a/Foobar.jpg 2x" /></a>
13063 </p><p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" width="1000" height="113" class="thumbborder" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/1500px-Foobar.jpg 1.5x, http://example.com/images/3/3a/Foobar.jpg 2x" /></a>
13064 </p>
13065 !! html/parsoid
13066 <p><span typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="113" width="1000"/></a></span></p>
13067 <p><span class="mw-image-border" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="113" width="1000"/></a></span></p>
13068 !! end
13069
13070 !! test
13071 Image: thumbs reduce
13072 !! options
13073 parsoid=wt2html,wt2wt,html2html
13074 !! wikitext
13075 [[File:Foobar.jpg|thumb|50px]]
13076 !! html/php
13077 <div class="thumb tright"><div class="thumbinner" style="width:52px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" width="50" height="6" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/75px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/100px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div>
13078
13079 !! html/parsoid
13080 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></figure>
13081 !! end
13082
13083 !! test
13084 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13085 !! options
13086 parsoid=wt2html,wt2wt,html2html
13087 !! wikitext
13088 [[File:Foobar.jpg|thumb|2000px]]
13089
13090 [[File:Foobar.svg|thumb|2000px]]
13091 !! html/php
13092 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div>
13093 <div class="thumb tright"><div class="thumbinner" style="width:2002px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="Foobar.svg" src="http://example.com/images/thumb/f/ff/Foobar.svg/2000px-Foobar.svg.png" width="2000" height="1500" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/3000px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/4000px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div></div></div></div>
13094
13095 !! html/parsoid
13096 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1941px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
13097 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/240px-Foobar.svg" data-file-width="240" data-file-height="180" data-file-type="drawing" height="1500" width="2000"/></a></figure>
13098 !! end
13099
13100 !! test
13101 Image: frameless can reduce in size
13102 !! options
13103 parsoid=wt2html,wt2wt,html2html
13104 !! wikitext
13105 [[File:Foobar.jpg|frameless|50px]]
13106 !! html/php
13107 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" width="50" height="6" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/75px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/100px-Foobar.jpg 2x" /></a>
13108 </p>
13109 !! html/parsoid
13110 <p><span typeof="mw:Image/Frameless"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
13111 !! end
13112
13113 !! test
13114 Image: bitmap frameless can't be enlarged past original size, but vector can
13115 !! options
13116 parsoid=wt2html,wt2wt,html2html
13117 !! wikitext
13118 [[File:Foobar.jpg|frameless|2000px]]
13119
13120 [[File:Foobar.svg|frameless|2000px]]
13121 !! html/php
13122 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13123 </p><p><a href="/wiki/File:Foobar.svg" class="image"><img alt="Foobar.svg" src="http://example.com/images/thumb/f/ff/Foobar.svg/2000px-Foobar.svg.png" width="2000" height="1500" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/3000px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/4000px-Foobar.svg.png 2x" /></a>
13124 </p>
13125 !! html/parsoid
13126 <p><span typeof="mw:Image/Frameless"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1941px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13127 <p><span typeof="mw:Image/Frameless"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/240px-Foobar.svg" data-file-width="240" data-file-height="180" data-file-type="drawing" height="1500" width="2000"/></a></span></p>
13128 !! end
13129
13130 !! test
13131 Image: framed images are always unscaled.
13132 !! options
13133 parsoid=wt2html,wt2wt,html2html
13134 !! wikitext
13135 [[File:Foobar.jpg|frame]]
13136
13137 [[File:Foobar.jpg|frame|50px]]
13138
13139 [[File:Foobar.jpg|frame|50x50px]]
13140
13141 [[File:Foobar.jpg|frame|2000px]]
13142 !! html/php
13143 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
13144 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
13145 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
13146 <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
13147
13148 !! html/parsoid
13149 <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
13150 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
13151 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
13152 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
13153 !! end
13154
13155 ###################
13156
13157 !! test
13158 Link to image page- image page normally doesn't exists, hence edit link
13159 Add test with existing image page
13160 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13161 !! wikitext
13162 [[:Image:test]]
13163 !! html
13164 <p><a href="/index.php?title=File:Test&amp;action=edit&amp;redlink=1" class="new" title="File:Test (page does not exist)">Image:test</a>
13165 </p>
13166 !! end
13167
13168 !! test
13169 bug 18784 Link to non-existent image page with caption should use caption as link text
13170 !! wikitext
13171 [[:Image:test|caption]]
13172 !! html
13173 <p><a href="/index.php?title=File:Test&amp;action=edit&amp;redlink=1" class="new" title="File:Test (page does not exist)">caption</a>
13174 </p>
13175 !! end
13176
13177 !! test
13178 Frameless image caption with a free URL
13179 !! wikitext
13180 [[File:Foobar.jpg|http://example.com]]
13181 !! html/php
13182 <p><a href="/wiki/File:Foobar.jpg" class="image" title="http://example.com"><img alt="http://example.com" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13183 </p>
13184 !! html/parsoid
13185 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&lt;a rel=\"mw:ExtLink\" href=\"http://example.com\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;url&amp;quot;,&amp;quot;dsr&amp;quot;:[18,36,0,0]}\">http://example.com&lt;/a>"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13186 !! end
13187
13188 !! test
13189 Thumbnail image caption with a free URL
13190 !! options
13191 thumbsize=220
13192 !! wikitext
13193 [[File:Foobar.jpg|thumb|http://example.com]]
13194 !! html/php
13195 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
13196
13197 !! html/parsoid
13198 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></figcaption></figure>
13199 !! end
13200
13201 !! test
13202 Thumbnail image caption with a free URL and explicit alt
13203 !! options
13204 thumbsize=220
13205 parsoid=wt2html,wt2wt,html2html
13206 !! wikitext
13207 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13208 !! html/php
13209 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Alteration" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
13210
13211 !! html/parsoid
13212 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img alt="Alteration" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></figcaption></figure>
13213 !! end
13214
13215 !! test
13216 SVG thumbnails with no language set
13217 !! options
13218 !! wikitext
13219 [[File:Foobar.svg|thumb|caption]]
13220 !! html/php
13221 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/180px-Foobar.svg.png" width="180" height="135" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
13222
13223 !! html/parsoid
13224 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/220px-Foobar.svg" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>caption</figcaption></figure>
13225 !! end
13226
13227 !! test
13228 SVG thumbnails with language de
13229 !! options
13230 parsoid=wt2html,wt2wt,html2html
13231 !! wikitext
13232 [[File:Foobar.svg|thumb|caption|lang=de]]
13233 !! html/php
13234 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=File:Foobar.svg&amp;lang=de" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/langde-180px-Foobar.svg.png" width="180" height="135" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/langde-270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/langde-360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
13235
13236 !! html/parsoid
13237 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/220px-Foobar.svg" lang="de" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>caption</figcaption></figure>
13238 !! end
13239
13240 !! test
13241 SVG thumbnails with invalid language code
13242 !! options
13243 parsoid=wt2html,wt2wt,html2html
13244 !! wikitext
13245 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
13246 !! html/php
13247 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/180px-Foobar.svg.png" width="180" height="135" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div>lang=invalid.language.code</div></div></div>
13248
13249 !! html/parsoid
13250 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>lang=invalid.language.code</figcaption></figure>
13251 !! end
13252
13253 !! test
13254 BUG 1887: A ISBN with a thumbnail
13255 !! wikitext
13256 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
13257 !! html/php
13258 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a href="/wiki/Special:BookSources/1235467890" class="internal mw-magiclink-isbn">ISBN 1235467890</a></div></div></div>
13259
13260 !! html/parsoid
13261 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="./Special:BookSources/1235467890" rel="mw:ExtLink">ISBN 1235467890</a></figcaption></figure>
13262 !! end
13263
13264 !! test
13265 BUG 1887: A RFC with a thumbnail
13266 !! wikitext
13267 [[File:Foobar.jpg|thumb|This is RFC 12354]]
13268 !! html/php
13269 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
13270
13271 !! html/parsoid
13272 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>This is <a href="//tools.ietf.org/html/rfc12354" rel="mw:ExtLink">RFC 12354</a></figcaption></figure>
13273 !! end
13274
13275 !! test
13276 BUG 1887: A mailto link with a thumbnail
13277 !! wikitext
13278 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
13279 !! html/php
13280 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Please <a rel="nofollow" class="external free" href="mailto:nobody@example.com">mailto:nobody@example.com</a></div></div></div>
13281
13282 !! html/parsoid
13283 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>Please <a rel="mw:ExtLink" href="mailto:nobody@example.com">mailto:nobody@example.com</a></figcaption></figure>
13284 !! end
13285
13286 # Pending resolution to bug 368
13287 !! test
13288 BUG 648: Frameless image caption with a link
13289 !! wikitext
13290 [[File:Foobar.jpg|text with a [[link]] in it]]
13291 !! html/php
13292 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13293 </p>
13294 !! html/parsoid
13295 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;simple&amp;quot;,&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;./Link&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;link&amp;quot;},&amp;quot;dsr&amp;quot;:[30,38,2,2]}\">link&lt;/a> in it"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13296 !! end
13297
13298 !! test
13299 BUG 648: Frameless image caption with a link (suffix)
13300 !! wikitext
13301 [[File:Foobar.jpg|text with a [[link]]foo in it]]
13302 !! html/php
13303 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a linkfoo in it"><img alt="text with a linkfoo in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13304 </p>
13305 !! html/parsoid
13306 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;simple&amp;quot;,&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;./Link&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;link&amp;quot;},&amp;quot;dsr&amp;quot;:[30,41,2,5],&amp;quot;tail&amp;quot;:&amp;quot;foo&amp;quot;}\">linkfoo&lt;/a> in it"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13307 !! end
13308
13309 !! test
13310 BUG 648: Frameless image caption with an interwiki link
13311 !! wikitext
13312 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
13313 !! html/php
13314 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a MeatBall:Link in it"><img alt="text with a MeatBall:Link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13315 </p>
13316 !! html/parsoid
13317 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a &lt;a rel=\"mw:ExtLink\" href=\"http://www.usemod.com/cgi-bin/mb.pl?Link\" title=\"meatball:Link\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;simple&amp;quot;,&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;http://www.usemod.com/cgi-bin/mb.pl?Link&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;MeatBall:Link&amp;quot;},&amp;quot;isIW&amp;quot;:true,&amp;quot;dsr&amp;quot;:[30,47,2,2]}\">MeatBall:Link&lt;/a> in it"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13318 !! end
13319
13320 !! test
13321 BUG 648: Frameless image caption with a piped interwiki link
13322 !! wikitext
13323 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
13324 !! html/php
13325 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13326 </p>
13327 !! html/parsoid
13328 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a &lt;a rel=\"mw:ExtLink\" href=\"http://www.usemod.com/cgi-bin/mb.pl?Link\" title=\"meatball:Link\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;piped&amp;quot;,&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;http://www.usemod.com/cgi-bin/mb.pl?Link&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;MeatBall:Link&amp;quot;},&amp;quot;isIW&amp;quot;:true,&amp;quot;dsr&amp;quot;:[30,52,16,2]}\">link&lt;/a> in it"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13329 !! end
13330
13331 !! test
13332 T107474: Frameless image caption with <nowiki>
13333 !! wikitext
13334 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
13335 !! html/parsoid
13336 <p><span class="mw-default-size" typeof="mw:Image mw:Placeholder" data-mw='{"caption":"&lt;span typeof=\"mw:Nowiki\">text with a [[MeatBall:Link|link]] in it&lt;/span>"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13337 !! end
13338
13339 !! test
13340 Escape HTML special chars in image alt text
13341 !! wikitext
13342 [[File:Foobar.jpg|& < > "]]
13343 !! html/php
13344 <p><a href="/wiki/File:Foobar.jpg" class="image" title="&amp; &lt; &gt; &quot;"><img alt="&amp; &lt; &gt; &quot;" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13345 </p>
13346 !! html/parsoid
13347 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&amp;amp; &amp;lt; &amp;gt; \""}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13348 !! end
13349
13350 !! test
13351 BUG 499: Alt text should have &#1234;, not &amp;1234;
13352 !! wikitext
13353 [[File:Foobar.jpg|&#9792;]]
13354 !! html/php
13355 <p><a href="/wiki/File:Foobar.jpg" class="image" title="♀"><img alt="♀" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13356 </p>
13357 !! html/parsoid
13358 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=\"{&amp;quot;src&amp;quot;:&amp;quot;&amp;amp;#9792;&amp;quot;,&amp;quot;srcContent&amp;quot;:&amp;quot;♀&amp;quot;,&amp;quot;dsr&amp;quot;:[18,25,null,null]}\">♀&lt;/span>"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13359 !! end
13360
13361 !! test
13362 Broken image caption with link
13363 !! options
13364 parsoid=wt2html,wt2wt,html2html
13365 !! wikitext
13366 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
13367 !! html/php
13368 <p>[[Image:Foobar.jpg|thumb|This is a broken caption. But <a href="/wiki/Main_Page" title="Main Page">this</a> is just an ordinary link.
13369 </p>
13370 !! html/parsoid
13371 <p>[[Image:Foobar.jpg|thumb|This is a broken caption. But <a rel="mw:WikiLink" href="Main_Page" title="Main Page">this</a> is just an ordinary link.</p>
13372 !! end
13373
13374 !! test
13375 Image caption containing another image
13376 !! wikitext
13377 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
13378 !! html/php
13379 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is a caption with another <a href="/wiki/File:Thumb.png" class="image" title="image"><img alt="image" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" /></a> inside it!</div></div></div>
13380
13381 !! html/parsoid
13382 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>This is a caption with another <span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"image"}'><a href="./File:Thumb.png"><img resource="./File:Thumb.png" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a></span> inside it!</figcaption></figure>
13383 !! end
13384
13385 !! test
13386 Image: caption containing a newline
13387 !! wikitext
13388 [[File:Foobar.jpg|This
13389 *is some text]]
13390 !! html/php
13391 <p><a href="/wiki/File:Foobar.jpg" class="image" title="This *is some text"><img alt="This *is some text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13392 </p>
13393 !! html/parsoid
13394 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"This\n*is some text"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13395 !!end
13396
13397 !!test
13398 Image: caption containing leading space
13399 (The leading space should not trigger nowiki escaping in wt2wt mode)
13400 !! wikitext
13401 [[File:Foobar.jpg|thumb| bar]]
13402 !! html/php
13403 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>bar</div></div></div>
13404
13405 !! html/parsoid
13406 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption> bar</figcaption></figure>
13407 !!end
13408
13409 !! test
13410 Image: caption containing a table
13411 !! options
13412 parsoid=wt2html,wt2wt,html2html
13413 !! wikitext
13414 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
13415 {|
13416 ! Foo !! Bar
13417 |-
13418 | Foo1 || Bar1
13419 |}
13420 and some more text.]]
13421 !! html/php
13422 <div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is an example image thumbnail caption with a table <table> <tr> <th> Foo </th> <th> Bar </th></tr> <tr> <td> Foo1 </td> <td> Bar1 </td></tr></table> and some more text.</div></div></div>
13423
13424 !! html/parsoid
13425 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>This is an example image thumbnail caption with a table
13426 <table>
13427 <tbody>
13428 <tr><th>Foo </th><th>Bar</th></tr>
13429 <tr>
13430 <td>Foo1 </td>
13431 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
13432 !! end
13433
13434 !! test
13435 Bug 3090: External links other than http: in image captions
13436 !! wikitext
13437 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
13438 !! html/php
13439 <div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This caption has <a rel="nofollow" class="external text" href="irc://example.net">irc</a> and <a rel="nofollow" class="external text" href="https://example.com">Secure</a> ext links in it.</div></div></div>
13440
13441 !! html/parsoid
13442 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>This caption has <a rel="mw:ExtLink" href="irc://example.net">irc</a> and <a rel="mw:ExtLink" href="https://example.com">Secure</a> ext links in it.</figcaption></figure>
13443 !! end
13444
13445 !! test
13446 Custom class
13447 !! options
13448 parsoid=wt2html,wt2wt,html2html
13449 !! wikitext
13450 [[Image:foobar.jpg|a|class=b]]
13451 !! html/php
13452 <p><a href="/wiki/File:Foobar.jpg" class="image" title="a"><img alt="a" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="b" /></a>
13453 </p>
13454 !! html/parsoid
13455 <p><span class="mw-default-size b" typeof="mw:Image" data-mw='{"caption":"a"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13456 !! end
13457
13458 !! test
13459 Localized image handling (1).
13460 !! options
13461 parsoid=wt2html,wt2wt,html2html
13462 language=es
13463 !! wikitext
13464 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
13465 !! html/php
13466 <div class="floatleft"><a href="/wiki/Foo" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
13467
13468 !! html/parsoid
13469 <figure class="mw-default-size mw-halign-left" typeof="mw:Image"><a href="./Foo"><img resource="./Archivo:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
13470 !! end
13471
13472 !! test
13473 Localized image handling (2).
13474 !! options
13475 thumbsize=220
13476 parsoid=wt2html,wt2wt,html2html
13477 language=es
13478 !! wikitext
13479 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
13480 !! html/php
13481 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/Foo" title="Foo"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/Archivo:Foobar.jpg" class="internal" title="Aumentar"></a></div>caption</div></div></div>
13482
13483 !! html/parsoid
13484 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="Foo"><img resource="./Archivo:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
13485 !! end
13486
13487 !! test
13488 "border", "frameless" and "class" attributes on an image.
13489 !! options
13490 thumbsize=220
13491 parsoid=wt2html,wt2wt,html2html
13492 !! wikitext
13493 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
13494 !! html/php
13495 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="extra thumbborder" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>
13496 </p>
13497 !! html/parsoid
13498 <p><span class="mw-default-size mw-image-border extra" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></span></p>
13499 !! end
13500
13501 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
13502 !! test
13503 Invalid image attributes (bug 62500)
13504 !! options
13505 thumbsize=220
13506 parsoid=wt2html,wt2wt,html2html
13507 !! wikitext
13508 [[File:Foobar.jpg|thumb|float|left|caption]]
13509
13510 [[File:Foobar.jpg|thumb|righ|caption]]
13511
13512 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
13513 !! html/php
13514 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
13515 <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
13516 <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
13517
13518 !! html/parsoid
13519 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
13520 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
13521 <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
13522 !! end
13523
13524 !! article
13525 File:Barfoo.jpg
13526 !! text
13527 #REDIRECT [[File:Barfoo.jpg]]
13528 !! endarticle
13529
13530 # FIXME: Parsoid should run this test -- but we'd need to teach the
13531 # mockAPI about the redirected Barfoo.jpg image.
13532 !! test
13533 Redirected image
13534 !! wikitext
13535 [[Image:Barfoo.jpg]]
13536 !! html/php
13537 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
13538 </p>
13539 !! end
13540
13541 !! test
13542 Missing image with uploads disabled
13543 !! options
13544 wgEnableUploads=0
13545 !! wikitext
13546 [[File:Foobaz.jpg]]
13547 !! html/php
13548 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
13549 </p>
13550 !! html/parsoid
13551 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}]}'><a href="./File:Foobaz.jpg"><img resource="./File:Foobaz.jpg" src="./Special:FilePath/Foobaz.jpg" height="220" width="220"/></a></span></p>
13552 !! end
13553
13554 # Parsoid-specific testing for images
13555 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13556 # Currently imperfect due to a flaw in the Parsoid testrunner
13557 # Work in progress
13558 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
13559 # image tests.
13560
13561 !! test
13562 Parsoid-specific image handling - simple image with size and middle alignment
13563 !! wikitext
13564 [[File:Foobar.jpg|middle|50px]]
13565 !! html/parsoid
13566 <p><span class="mw-valign-middle" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
13567 !! end
13568
13569 !! test
13570 Parsoid-specific image handling - simple image with size, middle alignment,
13571 non-standard namespace alias
13572 !! options
13573 parsoid=wt2wt,wt2html,html2html
13574 !! wikitext
13575 [[Image:Foobar.jpg|middle|50px]]
13576 !! html/parsoid
13577 <p><span class="mw-valign-middle" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
13578 !! end
13579
13580 !! test
13581 Parsoid-specific image handling - simple image with size and middle alignment
13582 (existing content)
13583 !! wikitext
13584 [[File:Foobar.jpg|50px|middle]]
13585 !! html/parsoid
13586 <p><span class="mw-valign-middle" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"50px"},{"ck":"middle","ak":"middle"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13587 !! end
13588
13589 !! test
13590 Parsoid-specific image handling - simple image with size and middle alignment
13591 and non-standard namespace name
13592 !! options
13593 parsoid=wt2html,wt2wt,html2html
13594 !! wikitext
13595 [[Image:Foobar.jpg|50px|middle]]
13596 !! html/parsoid
13597 <p><span class="mw-valign-middle" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
13598 !! end
13599
13600 !! test
13601 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
13602 !! wikitext
13603 [[File:Foobar.jpg|500x10px|baseline|caption]]
13604 !! html/parsoid
13605 <p><span class="mw-valign-baseline" typeof="mw:Image" data-mw='{"caption":"caption"}' data-parsoid='{"optList":[{"ck":"width","ak":"500x10px"},{"ck":"baseline","ak":"baseline"},{"ck":"caption","ak":"caption"}],"size":"500x10"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/89px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="10" width="89" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"10","width":"89"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13606 !! end
13607
13608 !! test
13609 Parsoid-specific image handling - simple image with border and size spec
13610 !! wikitext
13611 [[File:Foobar.jpg|50px|border|caption]]
13612 !! html/parsoid
13613 <p><span class="mw-image-border" typeof="mw:Image" data-mw='{"caption":"caption"}' data-parsoid='{"optList":[{"ck":"width","ak":"50px"},{"ck":"border","ak":"border"},{"ck":"caption","ak":"caption"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13614 !! end
13615
13616 !! test
13617 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13618 !! wikitext
13619 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
13620 !! html/parsoid
13621 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption content</figcaption></figure>
13622 !! end
13623
13624 !! test
13625 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13626 (existing content)
13627 !! wikitext
13628 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
13629 !! html/parsoid
13630 <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"left","ak":"left"},{"ck":"baseline","ak":"baseline"},{"ck":"caption","ak":"caption content"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>caption content</figcaption></figure>
13631 !! end
13632
13633 !! test
13634 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
13635 !! wikitext
13636 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
13637 !! html/parsoid
13638 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a><figcaption>caption</figcaption></figure>
13639 !! end
13640
13641 !! test
13642 Parsoid-specific image handling - thumbnail with specific size, halign,
13643 valign, and caption (existing content)
13644 !! wikitext
13645 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
13646 !! html/parsoid
13647 <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"50x50px"},{"ck":"right","ak":"right"},{"ck":"middle","ak":"middle"},{"ck":"caption","ak":"caption"}],"size":"50x50"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>caption</figcaption></figure>
13648 !! end
13649
13650 !! test
13651 Parsoid-specific image handling - framed image with specific size and caption
13652 (size is ignored)
13653 !! options
13654 parsoid=wt2html,wt2wt,html2html
13655 !! wikitext
13656 [[File:Foobar.jpg|frame|500x50px|caption]]
13657 !! html/parsoid
13658 <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
13659 !! end
13660
13661 !! test
13662 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
13663 (size is ignored)
13664 !! options
13665 parsoid=wt2html,wt2wt,html2html
13666 !! wikitext
13667 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
13668 !! html/parsoid
13669 <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
13670 !! end
13671
13672 !! test
13673 Parsoid-specific image handling - frameless image with specific size, border, and caption
13674 !! wikitext
13675 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
13676 !! html/parsoid
13677 <p><span class="mw-image-border" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}' data-parsoid='{"optList":[{"ck":"frameless","ak":"frameless"},{"ck":"width","ak":"442x50px"},{"ck":"border","ak":"border"},{"ck":"caption","ak":"caption"}],"size":"442x50"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="50" width="442" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"50","width":"442"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13678 !! end
13679
13680 !! test
13681 Parsoid-specific image handling - simple image with a formatted caption
13682 !! wikitext
13683 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
13684 !! html/parsoid
13685 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&lt;table data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[18,81,7,8]}\">&lt;tbody data-parsoid=\"{&amp;quot;dsr&amp;quot;:[25,73,0,0]}\">&lt;tr data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[25,54,4,5]}\">&lt;td data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[29,39,4,5]}\">a&lt;/td>&lt;td data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[39,49,4,5]}\">b&lt;/td>&lt;/tr>&lt;tr data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[54,73,4,5]}\">&lt;td data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[58,68,4,5]}\">c&lt;/td>&lt;/tr>&lt;/tbody>&lt;/table>"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13686 !! end
13687
13688 !! test
13689 Parsoid-specific image handling - caption with a template in it
13690 !! wikitext
13691 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
13692 !! html/parsoid
13693 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"></a><figcaption>This caption has a <span about="#mwt1" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;transclusion&quot;}},&quot;i&quot;:0}}]}">transclusion</span> in it.</figcaption></figure>
13694 !! end
13695
13696 !! test
13697 Parsoid-specific image handling - caption with unbalanced tags in it
13698 !! options
13699 parsoid=wt2html,wt2wt,html2html
13700 !! wikitext
13701 foo
13702 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
13703 bar
13704 !! html/parsoid
13705 <p>foo</p>
13706 <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>This caption has a <center>unbalanced tag in it.</center></figcaption></figure>
13707 <p>bar</p>
13708 !! end
13709
13710 !! test
13711 Parsoid-specific image handling - empty caption (1)
13712 !! options
13713 parsoid=wt2html,wt2wt
13714 !! wikitext
13715 [[File:Foobar.jpg|thumb|]]
13716 !! html/parsoid
13717 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption></figcaption></figure>
13718 !! end
13719
13720 # empty captions don't get serialized unless we're in the "round trip" case
13721 !! test
13722 Parsoid-specific image handling - empty caption (2)
13723 !! options
13724 parsoid=html2wt
13725 !! html/parsoid
13726 <figure class="mw-default-size" typeof="mw:Image/Thumb">
13727 <a href="./File:Foobar.jpg">
13728 <img resource="./File:Foobar.jpg"
13729 src="//example.com/images/3/3a/Foobar.jpg"
13730 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
13731 height="25" width="220"/>
13732 </a>
13733 <figcaption></figcaption>
13734 </figure>
13735 !! wikitext
13736 [[File:Foobar.jpg|thumb]]
13737 !! end
13738
13739 !! test
13740 Parsoid-specific image handling - whitespace caption
13741 !! wikitext
13742 [[File:Foobar.jpg|thumb| ]]
13743 !! html/parsoid
13744 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption> </figcaption></figure>
13745 !! end
13746
13747 !! test
13748 Parsoid-specific image handling - lang option
13749 !! wikitext
13750 foo
13751 [[File:Foobar.svg|lang=de|caption]]
13752 bar
13753 !! html/parsoid
13754 <p>foo
13755 <span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" lang="de" data-file-width="240" data-file-height="180" data-file-type="drawing" height="180" width="240"/></a></span>
13756 bar</p>
13757 !! end
13758
13759
13760 ###
13761 ### Subpages
13762 ###
13763 !! article
13764 Subpage test/subpage
13765 !! text
13766 foo
13767 !! endarticle
13768
13769 !! test
13770 Subpage link
13771 !! options
13772 subpage title=[[Subpage test]]
13773 !! wikitext
13774 [[/subpage]]
13775 !! html
13776 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
13777 </p>
13778 !! end
13779
13780 !! test
13781 Subpage noslash link
13782 !! options
13783 subpage title=[[Subpage test]]
13784 !! wikitext
13785 [[/subpage/]]
13786 !! html
13787 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
13788 </p>
13789 !! end
13790
13791 !! article
13792 Subpage test/1/2/subpage
13793 !! text
13794 blah
13795 !! endarticle
13796
13797 !! test
13798 Relative subpage noslash link
13799 !! options
13800 parsoid=wt2wt,wt2html,html2html
13801 subpage title=[[Subpage test/1/2/3/4]]
13802 !! wikitext
13803 [[../../subpage/]]
13804
13805 [[../../subpage]]
13806 !! html/php
13807 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
13808 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
13809 </p>
13810 !! html/parsoid
13811 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
13812 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
13813 !! end
13814
13815 !! test
13816 Parsoid: dot-slash prefixed wikilinks
13817 !! wikitext
13818 [[./foo]]
13819
13820 [[././bar]]
13821
13822 [[././baz/]]
13823 !! html/php
13824 <p>[[./foo]]
13825 </p><p>[[././bar]]
13826 </p><p>[[././baz/]]
13827 </p>
13828 !! html/parsoid
13829 <p>[[./foo]]
13830 </p><p>[[././bar]]
13831 </p><p>[[././baz/]]
13832 </p>
13833 !! end
13834
13835 !! test
13836 Render invalid page names as plain text (bug 51090)
13837 !! wikitext
13838 [[./../foo|bar]]
13839 [[foo�|bar]]
13840 [[foo/.|bar]]
13841 [[foo/..|bar]]
13842 [[foo~~~bar]]
13843 [[foo>bar]]
13844 [[foo[bar]]
13845 [[.]]
13846 [[..]]
13847 [[foo././bar]]
13848
13849 [[{{echo|./../foo}}|bar]]
13850 [[{{echo|foo/.}}|bar]]
13851 [[{{echo|foo/..}}|bar]]
13852 [[{{echo|foo~~~~bar}}]]
13853 [[{{echo|foo>bar}}]]
13854 [[{{echo|foo././bar}}]]
13855 [[{{echo|foo{bar}}]]
13856 [[{{echo|foo}bar}}]]
13857 [[{{echo|foo[bar}}]]
13858 [[{{echo|foo]bar}}]]
13859 [[{{echo|foo<bar}}]]
13860 !!html/php
13861 <p>[[./../foo|bar]]
13862 [[foo�|bar]]
13863 [[foo/.|bar]]
13864 [[foo/..|bar]]
13865 [[foo~~~bar]]
13866 [[foo&gt;bar]]
13867 [[foo[bar]]
13868 [[.]]
13869 [[..]]
13870 [[foo././bar]]
13871 </p><p>[[./../foo|bar]]
13872 [[foo/.|bar]]
13873 [[foo/..|bar]]
13874 [[foo~~~~bar]]
13875 [[foo&gt;bar]]
13876 [[foo././bar]]
13877 [[foo{bar]]
13878 [[foo}bar]]
13879 [[foo[bar]]
13880 [[foo]bar]]
13881 [[foo&lt;bar]]
13882 </p>
13883 !!html/parsoid
13884 <p>[[./../foo|bar]]
13885 [[foo�|bar]]
13886 [[foo/.|bar]]
13887 [[foo/..|bar]]
13888 [[foo~~~bar]]
13889 [[foo>bar]]
13890 [[foo[bar]]
13891 [[.]]
13892 [[..]]
13893 [[foo././bar]]</p>
13894
13895 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
13896 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
13897 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
13898 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
13899 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
13900 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
13901 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
13902 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
13903 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
13904 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
13905 [[<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>
13906 !!end
13907
13908 !! test
13909 Disabled subpages
13910 !! wikitext
13911 [[/subpage]]
13912 !! html
13913 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
13914 </p>
13915 !! end
13916
13917 !! test
13918 BUG 561: {{/Subpage}}
13919 !! options
13920 subpage title=[[Page]]
13921 !! wikitext
13922 {{/Subpage}}
13923 !! html
13924 <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>
13925 </p>
13926 !! end
13927
13928 ###
13929 ### Categories
13930 ###
13931 !! article
13932 Category:MediaWiki User's Guide
13933 !! text
13934 blah
13935 !! endarticle
13936
13937 !! test
13938 Link to category
13939 !! wikitext
13940 [[:Category:MediaWiki User's Guide]]
13941 !! html
13942 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
13943 </p>
13944 !! end
13945
13946 !! test
13947 Simple category
13948 !! options
13949 cat
13950 !! wikitext
13951 [[Category:MediaWiki User's Guide]]
13952 !! html
13953 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13954 !! end
13955
13956 !! test
13957 PAGESINCATEGORY invalid title fatal (r33546 fix)
13958 !! wikitext
13959 {{PAGESINCATEGORY:<bogus>}}
13960 !! html
13961 <p>0
13962 </p>
13963 !! end
13964
13965 !! test
13966 Category with different sort key
13967 !! options
13968 cat
13969 !! wikitext
13970 [[Category:MediaWiki User's Guide|Foo]]
13971 !! html
13972 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13973 !! end
13974
13975 !! test
13976 Category with identical sort key
13977 !! options
13978 cat
13979 !! wikitext
13980 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
13981 !! html
13982 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
13983 !! end
13984
13985 !! test
13986 Category with empty sort key
13987 !! options
13988 cat
13989 pst
13990 !! wikitext
13991 [[Category:MediaWiki User's Guide|]]
13992 !! html
13993 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
13994 !! end
13995
13996 !! test
13997 Category with empty sort key and parentheses
13998 !! options
13999 cat
14000 pst
14001 !! wikitext
14002 [[Category:Foo (bar)|]]
14003 !! html
14004 [[Category:Foo (bar)|Foo]]
14005 !! end
14006
14007 !! test
14008 Category with link tail
14009 !! options
14010 cat
14011 pst
14012 !! wikitext
14013 123[[Category:Foo]]456
14014 !! html
14015 123[[Category:Foo]]456
14016 !! end
14017
14018 !! test
14019 Category with template
14020 !! options
14021 cat
14022 pst
14023 !! wikitext
14024 [[Category:{{echo|Foo}}]]
14025 !! html
14026 [[Category:{{echo|Foo}}]]
14027 !! end
14028
14029 !! test
14030 Category with template in sort key
14031 !! options
14032 cat
14033 pst
14034 !! wikitext
14035 [[Category:Foo|{{echo|Bar}}]]
14036 !! html
14037 [[Category:Foo|{{echo|Bar}}]]
14038 !! end
14039
14040 !! test
14041 Category with template in sort key and title
14042 !! options
14043 cat
14044 pst
14045 !! wikitext
14046 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14047 !! html
14048 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14049 !! end
14050
14051 !! test
14052 Category / paragraph interactions
14053 !! wikitext
14054 Foo [[Category:Baz]] Bar
14055
14056 Foo [[Category:Baz]]
14057 Bar
14058
14059 Foo
14060 [[Category:Baz]]
14061 Bar
14062
14063 Foo
14064 [[Category:Baz]] Bar
14065
14066 Foo
14067 [[Category:Baz]]
14068 [[Category:Baz]]
14069 [[Category:Baz]]
14070 Bar
14071
14072 [[Category:Baz]]
14073 [[Category:Baz]]
14074 [[Category:Baz]]
14075
14076 [[Category:Baz]]
14077 {{echo|[[Category:Baz]]}}
14078 [[Category:Baz]]
14079 !! html
14080 <p>Foo Bar
14081 </p><p>Foo
14082 Bar
14083 </p><p>Foo
14084 Bar
14085 </p><p>Foo Bar
14086 </p><p>Foo
14087 Bar
14088 </p>
14089 !! end
14090
14091 ## The whitespace on the empty line is part of the test. Please do not delete
14092 !! test
14093 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14094 !! options
14095 parsoid=wt2html,wt2wt
14096 !! wikitext
14097 This
14098
14099 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14100
14101 {{echo|[[Category:Foo]] and so should this!}}
14102 !! html
14103 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14104 </p>
14105 !! html/parsoid
14106 <p>This
14107
14108 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14109
14110 <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>
14111 !! end
14112
14113 ## Parsoid will not try to wt2wt this while preserving newlines because
14114 ## it suppresses excess newlines within list items -- and we don't want to
14115 ## introduce a special case just for categories, which is, in reality somewhat
14116 ## odd behavior -- categories are unlikely to be used in list items like this
14117 ## in top-level pages and are only likely to show up in template-generated
14118 ## list items where this RT-ing is a non-issue.
14119 ##
14120 ## The whitespace on the empty line is part of the test. Please do not delete
14121 !! test
14122 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14123 !! options
14124 parsoid=wt2html
14125 !! wikitext
14126 * This
14127
14128 [[Category:Foo]] and this should be part of the same list item
14129 * So should this
14130
14131 {{echo|[[Category:Foo]] and this should be part of the same list item}}
14132 !! html
14133 <ul><li>This and this should be part of the same list item</li>
14134 <li>So should this and this should be part of the same list item</li></ul>
14135 !! html/parsoid
14136 <ul>
14137 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
14138 <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>
14139 </ul>
14140 !! end
14141
14142 ## Newlines and categories that follow the last item of a list
14143 ## are treated differently because this (list followed by categories)
14144 ## is an extremely common pattern on wikis.
14145 !! test
14146 3. Categories and newlines: newline suppression for last list item should RT properly
14147 !! wikitext
14148 * a
14149 * b
14150
14151 [[Category:Foo]]
14152
14153 [[Category:Bar]]
14154 [[Category:Baz]]
14155 !! html/parsoid
14156 <ul><li> a</li>
14157 <li> b</li></ul>
14158
14159 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14160
14161 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14162 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14163 !! end
14164
14165 !! test
14166 4. Categories and newlines: newline suppression for last list item should RT properly
14167 !! wikitext
14168 * a
14169 **** b
14170
14171 [[Category:Foo]]
14172 !! html/parsoid
14173 <ul><li> a
14174 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
14175
14176 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14177 !! end
14178
14179 ## only wt2html for this to make sure the algo only applies to the rightmost path
14180 !! test
14181 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
14182 !! options
14183 parsoid=wt2html
14184 !! wikitext
14185 * a
14186 ** b
14187 [[Category:Foo]]
14188 * c
14189 ** d
14190 [[Category:Foo]]
14191 !! html/parsoid
14192 <ul><li> a
14193 <ul><li> b
14194 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
14195 <li> c
14196 <ul><li> d</li></ul></li></ul>
14197 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14198 !! end
14199
14200 !! test
14201 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
14202 !! wikitext
14203 * a [[Category:Foo]]
14204 !! html/parsoid
14205 <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>
14206 !! end
14207
14208 # This test also demonstrates because of newline+category tunneling
14209 # through the list hander, template wrapping doesn't expand to the
14210 # containing list when the list item swallows the category.
14211 !! test
14212 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
14213 !! wikitext
14214 * {{echo|a
14215 [[Category:Foo]]}}
14216 !! html/parsoid
14217 <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">
14218 </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>
14219 !! end
14220
14221 !! test
14222 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
14223 !! wikitext
14224 * a
14225
14226 {{echo|[[Category:Foo]]
14227 [[Category:Bar]]}}
14228 [[Category:Baz]]
14229 !! html/parsoid
14230 <ul><li> a</li></ul>
14231
14232 <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">
14233 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14234 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14235 !! end
14236
14237 !! test
14238 Parsoid: Serialize link to category page with colon escape
14239 !! options
14240 parsoid
14241 !! wikitext
14242
14243 [[:Category:Foo]]
14244 [[:Category:Foo|Bar]]
14245 !! html
14246 <p>
14247 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
14248 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
14249 </p>
14250 !! end
14251
14252 # html2wt localizes the "Category" namespace.
14253 # XXX the <link> element needs an empty data-parsoid attribute, or
14254 # else the html2html test fails because spaces are inserted.
14255 !! test
14256 Link prefix/suffixes aren't applied to category links
14257 !! options
14258 parsoid=wt2html,wt2wt,html2html
14259 language=is
14260 !! wikitext
14261 x[[Category:Foo]]y
14262 !! html/php
14263 <p>xy
14264 </p>
14265 !! html/parsoid
14266 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
14267 !! end
14268
14269 !! test
14270 Parsoid: Serialize link to file page with colon escape
14271 !! options
14272 parsoid
14273 !! wikitext
14274
14275 [[:File:Foo.png]]
14276 [[:File:Foo.png|Bar]]
14277 !! html
14278 <p>
14279 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
14280 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
14281 </p>
14282 !! end
14283
14284 !! test
14285 Parsoid: Serialize a genuine category link without colon escape
14286 !! options
14287 parsoid
14288 !! wikitext
14289 [[Category:Foo]]
14290 [[Category:Foo|Bar]]
14291 !! html
14292 <link rel="mw:PageProp/Category" href="./Category:Foo">
14293 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
14294 !! end
14295
14296 !! test
14297 Normalize hrefs properly before testing for invalid link targets (bug 70894)
14298 !! options
14299 parsoid=html2wt
14300 !! html/parsoid
14301 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
14302 !! wikitext
14303 [[Category:Toxine bactérienne]]
14304 !! end
14305
14306 !! test
14307 Parsoid: Defaultsort
14308 !! wikitext
14309 {{DEFAULTSORT:Foo}}
14310 !! html/parsoid
14311 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
14312 !! end
14313
14314 !! test
14315 Parsoid: Defaultsort (template-generated)
14316 !! wikitext
14317 {{{{echo|DEFAULTSORT}}:Foo}}
14318 !! html/parsoid
14319 <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}}]}'/>
14320 !! end
14321
14322 ###
14323 ### Inter-language links
14324 ###
14325 !! test
14326 Interlanguage links
14327 !! options
14328 ill
14329 !! wikitext
14330 [[es:Alimento]]
14331 [[fr:Nourriture]]
14332 [[zh:食品]]
14333 !! html/php
14334 es:Alimento fr:Nourriture zh:食品
14335 !! html/parsoid
14336 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
14337 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
14338 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
14339 !! end
14340
14341 !! test
14342 Duplicate interlanguage links (bug 24502)
14343 !! options
14344 ill
14345 !! wikitext
14346 [[es:1]]
14347 [[es:2]]
14348 [[fr:1]]
14349 [[fr:2]]
14350 !! html/php
14351 es:1 fr:1
14352 !! html/parsoid
14353 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
14354 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
14355 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
14356 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
14357 !! end
14358
14359 ###
14360 ### Sections
14361 ###
14362 !! test
14363 Basic section headings
14364 !! wikitext
14365 == Headline 1 ==
14366 Some text
14367
14368 ==Headline 2==
14369 More
14370 ===Smaller headline===
14371 Blah blah
14372 !! html
14373 <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>
14374 <p>Some text
14375 </p>
14376 <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>
14377 <p>More
14378 </p>
14379 <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>
14380 <p>Blah blah
14381 </p>
14382 !! end
14383
14384 !! test
14385 Section headings with TOC
14386 !! wikitext
14387 == Headline 1 ==
14388 === Subheadline 1 ===
14389 ===== Skipping a level =====
14390 ====== Skipping a level ======
14391
14392 == Headline 2 ==
14393 Some text
14394 ===Another headline===
14395 !! html
14396 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14397 <ul>
14398 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
14399 <ul>
14400 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
14401 <ul>
14402 <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>
14403 <ul>
14404 <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>
14405 </ul>
14406 </li>
14407 </ul>
14408 </li>
14409 </ul>
14410 </li>
14411 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
14412 <ul>
14413 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
14414 </ul>
14415 </li>
14416 </ul>
14417 </div>
14418
14419 <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>
14420 <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>
14421 <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>
14422 <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>
14423 <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>
14424 <p>Some text
14425 </p>
14426 <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>
14427
14428 !! end
14429
14430 !! test
14431 TOC anchors don't collide
14432 !! wikitext
14433 __FORCETOC__
14434 == Headline 2 ==
14435 == Headline ==
14436 == Headline 2 ==
14437 == Headline ==
14438 !! html/php
14439 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14440 <ul>
14441 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
14442 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
14443 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
14444 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
14445 </ul>
14446 </div>
14447
14448 <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>
14449 <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>
14450 <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>
14451 <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>
14452
14453 !! end
14454
14455 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
14456 !! test
14457 Handling of sections up to level 6 and beyond
14458 !! wikitext
14459 = Level 1 Heading=
14460 == Level 2 Heading==
14461 === Level 3 Heading===
14462 ==== Level 4 Heading====
14463 ===== Level 5 Heading=====
14464 ====== Level 6 Heading======
14465 ======= Level 7 Heading=======
14466 ======== Level 8 Heading========
14467 ========= Level 9 Heading=========
14468 ========== Level 10 Heading==========
14469 !! html
14470 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14471 <ul>
14472 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
14473 <ul>
14474 <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>
14475 <ul>
14476 <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>
14477 <ul>
14478 <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>
14479 <ul>
14480 <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>
14481 <ul>
14482 <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>
14483 <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>
14484 <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>
14485 <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>
14486 <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>
14487 </ul>
14488 </li>
14489 </ul>
14490 </li>
14491 </ul>
14492 </li>
14493 </ul>
14494 </li>
14495 </ul>
14496 </li>
14497 </ul>
14498 </div>
14499
14500 <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>
14501 <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>
14502 <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>
14503 <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>
14504 <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>
14505 <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>
14506 <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>
14507 <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>
14508 <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>
14509 <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>
14510
14511 !! end
14512
14513 !! test
14514 TOC regression (T11764)
14515 !! wikitext
14516 == title 1 ==
14517 === title 1.1 ===
14518 ==== title 1.1.1 ====
14519 === title 1.2 ===
14520 == title 2 ==
14521 === title 2.1 ===
14522 !! html
14523 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14524 <ul>
14525 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14526 <ul>
14527 <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>
14528 <ul>
14529 <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>
14530 </ul>
14531 </li>
14532 <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>
14533 </ul>
14534 </li>
14535 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14536 <ul>
14537 <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>
14538 </ul>
14539 </li>
14540 </ul>
14541 </div>
14542
14543 <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>
14544 <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>
14545 <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>
14546 <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>
14547 <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>
14548 <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>
14549
14550 !! end
14551
14552 !! test
14553 TOC for heading containing <span id="..."></span> (T96153)
14554 !! wikitext
14555 __FORCETOC__
14556 ==<span id="old-anchor"></span>New title==
14557 !! html/php
14558 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14559 <ul>
14560 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
14561 </ul>
14562 </div>
14563
14564 <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>
14565
14566 !! end
14567
14568 !! test
14569 TOC with wgMaxTocLevel=3 (bug 6204)
14570 !! options
14571 wgMaxTocLevel=3
14572 !! wikitext
14573 == title 1 ==
14574 === title 1.1 ===
14575 ==== title 1.1.1 ====
14576 === title 1.2 ===
14577 == title 2 ==
14578 === title 2.1 ===
14579 !! html
14580 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14581 <ul>
14582 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14583 <ul>
14584 <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>
14585 <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>
14586 </ul>
14587 </li>
14588 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14589 <ul>
14590 <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>
14591 </ul>
14592 </li>
14593 </ul>
14594 </div>
14595
14596 <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>
14597 <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>
14598 <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>
14599 <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>
14600 <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>
14601 <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>
14602
14603 !! end
14604
14605 !! test
14606 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
14607 !! options
14608 wgMaxTocLevel=3
14609 !! wikitext
14610 ==Section 1==
14611 ===Section 1.1===
14612 ====Section 1.1.1====
14613 ====Section 1.1.1.1====
14614 ==Section 2==
14615 !! html
14616 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14617 <ul>
14618 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
14619 <ul>
14620 <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>
14621 </ul>
14622 </li>
14623 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
14624 </ul>
14625 </div>
14626
14627 <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>
14628 <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>
14629 <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>
14630 <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>
14631 <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>
14632
14633 !! end
14634
14635
14636 !! test
14637 Resolving duplicate section names
14638 !! wikitext
14639 == Foo bar ==
14640 == Foo bar ==
14641 !! html
14642 <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>
14643 <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>
14644
14645 !! end
14646
14647 !! test
14648 Resolving duplicate section names with differing case (bug 10721)
14649 !! wikitext
14650 == Foo bar ==
14651 == Foo Bar ==
14652 !! html
14653 <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>
14654 <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>
14655
14656 !! end
14657
14658 !! article
14659 Template:sections
14660 !! text
14661 ===Section 1===
14662 ==Section 2==
14663 !! endarticle
14664
14665 !! test
14666 Template with sections, __NOTOC__
14667 !! wikitext
14668 __NOTOC__
14669 ==Section 0==
14670 {{sections}}
14671 ==Section 4==
14672 !! html
14673 <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>
14674 <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>
14675 <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>
14676 <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>
14677
14678 !! end
14679
14680 !! test
14681 __NOEDITSECTION__ keyword
14682 !! wikitext
14683 __NOEDITSECTION__
14684 ==Section 1==
14685 ==Section 2==
14686 !! html
14687 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
14688 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
14689
14690 !! end
14691
14692 !! test
14693 Link inside a section heading
14694 !! wikitext
14695 ==Section with a [[Main Page|link]] in it==
14696 !! html
14697 <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>
14698
14699 !! end
14700
14701 !! test
14702 TOC regression (T14077)
14703 !! wikitext
14704 __TOC__
14705 == title 1 ==
14706 === title 1.1 ===
14707 == title 2 ==
14708 !! html
14709 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14710 <ul>
14711 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14712 <ul>
14713 <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>
14714 </ul>
14715 </li>
14716 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
14717 </ul>
14718 </div>
14719
14720 <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>
14721 <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>
14722 <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>
14723
14724 !! end
14725
14726 !! test
14727 BUG 1219 URL next to image (good)
14728 !! wikitext
14729 http://example.com [[File:Foobar.jpg]]
14730 !! html/php
14731 <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>
14732 </p>
14733 !! html/parsoid
14734 <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>
14735 !!end
14736
14737 !! test
14738 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
14739 !! wikitext
14740 ===
14741 The line above must have a trailing space!
14742 === <!--
14743 --> <!-- -->
14744 But just in case it doesn't...
14745 !! html
14746 <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>
14747 <p>The line above must have a trailing space!
14748 </p>
14749 <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>
14750 <p>But just in case it doesn't...
14751 </p>
14752 !! end
14753
14754 !! test
14755 Header with special characters (bug 25462)
14756 !! wikitext
14757 The tooltips shall not show entities to the user (ie. be double escaped)
14758
14759 == text > text ==
14760 section 1
14761
14762 == text < text ==
14763 section 2
14764
14765 == text & text ==
14766 section 3
14767
14768 == text ' text ==
14769 section 4
14770
14771 == text " text ==
14772 section 5
14773 !! html
14774 <p>The tooltips shall not show entities to the user (ie. be double escaped)
14775 </p>
14776 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14777 <ul>
14778 <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>
14779 <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>
14780 <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>
14781 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
14782 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
14783 </ul>
14784 </div>
14785
14786 <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>
14787 <p>section 1
14788 </p>
14789 <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>
14790 <p>section 2
14791 </p>
14792 <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>
14793 <p>section 3
14794 </p>
14795 <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>
14796 <p>section 4
14797 </p>
14798 <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>
14799 <p>section 5
14800 </p>
14801 !! end
14802
14803 !! test
14804 Header with space, plus and underscore as entity
14805 !! wikitext
14806 Id should not contain + for spaces
14807
14808 == Space between Text ==
14809 section 1
14810
14811 == Space-Entity&#32;between&#32;Text ==
14812 section 2
14813
14814 == Plus+between+Text ==
14815 section 3
14816
14817 == Plus-Entity&#43;between&#43;Text ==
14818 section 4
14819
14820 == Underscore_between_Text ==
14821 section 5
14822
14823 == Underscore-Entity&#95;between&#95;Text ==
14824 section 6
14825
14826 [[#Space between Text]]
14827 [[#Space-Entity&#32;between&#32;Text]]
14828 [[#Plus+between+Text]]
14829 [[#Plus-Entity&#43;between&#43;Text]]
14830 [[#Underscore_between_Text]]
14831 [[#Underscore-Entity&#95;between&#95;Text]]
14832 !! html
14833 <p>Id should not contain + for spaces
14834 </p>
14835 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14836 <ul>
14837 <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>
14838 <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>
14839 <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>
14840 <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>
14841 <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>
14842 <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>
14843 </ul>
14844 </div>
14845
14846 <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>
14847 <p>section 1
14848 </p>
14849 <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>
14850 <p>section 2
14851 </p>
14852 <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>
14853 <p>section 3
14854 </p>
14855 <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>
14856 <p>section 4
14857 </p>
14858 <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>
14859 <p>section 5
14860 </p>
14861 <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>
14862 <p>section 6
14863 </p><p><a href="#Space_between_Text">#Space between Text</a>
14864 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
14865 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
14866 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
14867 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
14868 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
14869 </p>
14870 !! end
14871
14872 !! test
14873 Headers with excess '=' characters
14874 (Are similar tests necessary beyond the 1st level?)
14875 !! wikitext
14876 =foo==
14877 ==foo=
14878 =''italic'' heading==
14879 ==''italic'' heading=
14880 !! html
14881 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14882 <ul>
14883 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
14884 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
14885 <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>
14886 <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>
14887 </ul>
14888 </div>
14889
14890 <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>
14891 <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>
14892 <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>
14893 <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>
14894
14895 !! end
14896
14897 !! test
14898 HTML headers vs TOC (bug 23393)
14899 (__NOEDITSECTION__ for clearer output, doesn't matter here)
14900 !! wikitext
14901 <h1>Header 1</h1>
14902 == Header 1.1 ==
14903 == Header 1.2 ==
14904
14905 <h1>Header 2
14906 </h1>
14907 == Header 2.1 ==
14908 == Header 2.2 ==
14909 __NOEDITSECTION__
14910 !! html
14911 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14912 <ul>
14913 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
14914 <ul>
14915 <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>
14916 <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>
14917 </ul>
14918 </li>
14919 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
14920 <ul>
14921 <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>
14922 <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>
14923 </ul>
14924 </li>
14925 </ul>
14926 </div>
14927
14928 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
14929 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
14930 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
14931 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
14932 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
14933 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
14934
14935 !! end
14936
14937 !! test
14938 Single-line or multiline-comments can follow headings
14939 !! options
14940 parsoid=wt2html,wt2wt
14941 !! wikitext
14942 ==foo==<!---->
14943 ==bar==<!--c1-->
14944 ==baz==<!--
14945 c2
14946 c3-->
14947 !! html
14948 <h2><span class="mw-headline" id="foo">foo</span></h2>
14949 <h2><span class="mw-headline" id="bar">bar</span></h2>
14950 <h2><span class="mw-headline" id="baz">baz</span></h2>
14951
14952 !! end
14953
14954 !! test
14955 BUG 1219 URL next to image (broken)
14956 !! wikitext
14957 http://example.com[[File:Foobar.jpg]]
14958 !! html/php
14959 <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>
14960 </p>
14961 !! html/parsoid
14962 <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>
14963 !!end
14964
14965 !! test
14966 Bug 1186 news: in the middle of text
14967 !! wikitext
14968 http://en.wikinews.org/wiki/Wikinews:Workplace
14969 !! html
14970 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
14971 </p>
14972 !!end
14973
14974
14975 !! test
14976 Namespaced link must have a title
14977 !! wikitext
14978 [[Project:]]
14979 !! html
14980 <p>[[Project:]]
14981 </p>
14982 !!end
14983
14984 !! test
14985 Namespaced link must have a title (bad fragment version)
14986 !! wikitext
14987 [[Project:#fragment]]
14988 !! html
14989 <p>[[Project:#fragment]]
14990 </p>
14991 !!end
14992
14993
14994 ###
14995 ### HTML tags and HTML attributes
14996 ###
14997
14998 !! test
14999 div with no attributes
15000 !! wikitext
15001 <div>HTML rocks</div>
15002 !! html
15003 <div>HTML rocks</div>
15004
15005 !! end
15006
15007 !! test
15008 div with double-quoted attribute
15009 !! wikitext
15010 <div id="rock">HTML rocks</div>
15011 !! html
15012 <div id="rock">HTML rocks</div>
15013
15014 !! end
15015
15016 !! test
15017 div with single-quoted attribute
15018 !! wikitext
15019 <div id='rock'>HTML rocks</div>
15020 !! html
15021 <div id="rock">HTML rocks</div>
15022
15023 !! end
15024
15025 !! test
15026 div with unquoted attribute
15027 !! wikitext
15028 <div id=rock>HTML rocks</div>
15029 !! html
15030 <div id="rock">HTML rocks</div>
15031
15032 !! end
15033
15034 !! test
15035 div with illegal double attributes
15036 !! wikitext
15037 <div id="a" id="b">HTML rocks</div>
15038 !! html
15039 <div id="b">HTML rocks</div>
15040
15041 !!end
15042
15043 # FIXME: produce empty string instead of "class" in the PHP parser, following
15044 # the HTML5 spec.
15045 !! test
15046 div with empty attribute value, space before equals
15047 !! options
15048 parsoid
15049 !! wikitext
15050 <div class =>HTML rocks</div>
15051 !! html
15052 <div class="">HTML rocks</div>
15053
15054 !! end
15055
15056 !! test
15057 div with multiple empty attribute values
15058 !! options
15059 parsoid
15060 !! wikitext
15061 <div id= title=>HTML rocks</div>
15062 !! html
15063 <div id="" title="">HTML rocks</div>
15064
15065 !! end
15066
15067 !! test
15068 table with multiple empty attribute values
15069 !! options
15070 parsoid
15071 !! wikitext
15072 {| title= id=
15073 | hi
15074 |}
15075 !! html
15076 <table title="" id="">
15077 <tbody><tr><td> hi</td></tr>
15078 </tbody></table>
15079 !! end
15080
15081 !! test
15082 div with braces in attribute value
15083 !! wikitext
15084 <div title="{}">Foo</div>
15085 !! html/php
15086 <div title="&#123;}">Foo</div>
15087
15088 !! html/parsoid
15089 <div title="{}">Foo</div>
15090 !! end
15091
15092 # This it very inconsistent in the PHP parser: it returns
15093 # class="class" if there is a space between the name and the equal sign (see
15094 # 'div with empty attribute value, space before equals'), but strips the
15095 # attribute completely if the space is missing. We hope that not much content
15096 # depends on this, so are implementing the behavior below in Parsoid for
15097 # consistencies' sake.
15098 # FIXME: fix this behavior in the PHP parser?
15099 !! test
15100 div with empty attribute value, no space before equals
15101 !! options
15102 parsoid=wt2html,html2html
15103 !! wikitext
15104 <div class=>HTML rocks</div>
15105 !! html/php
15106 <div>HTML rocks</div>
15107
15108 !! html/parsoid
15109 <div class="">HTML rocks</div>
15110 !! end
15111
15112 !! test
15113 HTML multiple attributes correction
15114 !! wikitext
15115 <p class="error" class="awesome">Awesome!</p>
15116 !! html
15117 <p class="awesome">Awesome!</p>
15118
15119 !!end
15120
15121 !! test
15122 Table multiple attributes correction
15123 !! wikitext
15124 {|
15125 !+ class="error" class="awesome"| status
15126 |}
15127 !! html
15128 <table>
15129 <tr>
15130 <th class="awesome"> status
15131 </th></tr></table>
15132
15133 !!end
15134
15135 !! test
15136 DIV IN UPPERCASE
15137 !! wikitext
15138 <DIV ID="x">HTML ROCKS</DIV>
15139 !! html
15140 <div id="x">HTML ROCKS</div>
15141
15142 !!end
15143
15144 !! test
15145 Non-ASCII pseudo-tags are rendered as text
15146 !! wikitext
15147 <khyô>
15148 !! html
15149 <p>&lt;khyô&gt;
15150 </p>
15151 !! end
15152
15153 !! test
15154 Pseudo-tag with URL 'name' renders as url link
15155 !! wikitext
15156 <http://example.com/>
15157 !! html
15158 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
15159 </p>
15160 !! end
15161
15162 !! test
15163 text with amp in the middle of nowhere
15164 !! wikitext
15165 Remember AT&T?
15166 !! html
15167 <p>Remember AT&amp;T?
15168 </p>
15169 !! end
15170
15171 !! test
15172 text with character entity: eacute
15173 !! wikitext
15174 I always thought &eacute; was a cute letter.
15175 !! html
15176 <p>I always thought &#233; was a cute letter.
15177 </p>
15178 !! html+tidy
15179 <p>I always thought é was a cute letter.</p>
15180 !! end
15181
15182 !! test
15183 text with entity-escaped character entity-like string: eacute
15184 !! wikitext
15185 I always thought &amp;eacute; was a cute letter.
15186 !! html
15187 <p>I always thought &amp;eacute; was a cute letter.
15188 </p>
15189 !! end
15190
15191 !! test
15192 text with undefined character entity: xacute
15193 !! wikitext
15194 I always thought &xacute; was a cute letter.
15195 !! html
15196 <p>I always thought &amp;xacute; was a cute letter.
15197 </p>
15198 !! end
15199
15200 !! test
15201 HTML5 tags
15202 !! wikitext
15203 <data value="5">five</data>
15204 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15205 <mark>This highlighted text</mark>
15206 !! html
15207 <p><data value="5">five</data>
15208 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15209 <mark>This highlighted text</mark>
15210 </p>
15211 !! end
15212
15213 !! test
15214 HTML tag with leading space is parsed as text
15215 !! wikitext
15216 < div>foo< /div>
15217 !! html
15218 <p>&lt; div&gt;foo&lt; /div&gt;
15219 </p>
15220 !! end
15221
15222 ###
15223 ### Nesting tests (see bug 41545, 50604, 51081)
15224 ###
15225
15226 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
15227 # Note that html2wt is considerably more difficult if we use <b> in
15228 # the test case, instead of <big>
15229 !! test
15230 Ensure that HTML adoption agency algorithm is properly implemented.
15231 !! wikitext
15232 <big>X<big>Y</big>Z</big>
15233 !! html
15234 <p><big>X<big>Y</big>Z</big>
15235 </p>
15236 !! end
15237
15238 # This was bug 41545 in the PHP parser.
15239 # Note that tidy doesn't handle this correctly.
15240 !! test
15241 Nesting of <kbd>
15242 !! wikitext
15243 <kbd>X<kbd>Y</kbd>Z</kbd>
15244 !! html
15245 <p><kbd>X<kbd>Y</kbd>Z</kbd>
15246 </p>
15247 !! end
15248
15249 # The following cases were bug 51081 in the PHP parser.
15250 # Note that there are some other nestable tags (b, i, etc) which are
15251 # not covered; see bug 51081 for discussion.
15252
15253 # Note that tidy doesn't handle this correctly.
15254 !! test
15255 Nesting of <em>
15256 !! wikitext
15257 <em>X<em>Y</em>Z</em>
15258 !! html
15259 <p><em>X<em>Y</em>Z</em>
15260 </p>
15261 !! end
15262
15263 # Note that tidy doesn't handle this correctly.
15264 !! test
15265 Nesting of <strong>
15266 !! wikitext
15267 <strong>X<strong>Y</strong>Z</strong>
15268 !! html
15269 <p><strong>X<strong>Y</strong>Z</strong>
15270 </p>
15271 !! end
15272
15273 !! test
15274 Nesting of <q>
15275 !! wikitext
15276 <q>X<q>Y</q>Z</q>
15277 !! html+tidy
15278 <p><q>X<q>Y</q>Z</q></p>
15279 !! end
15280
15281 # Note that tidy doesn't handle this correctly.
15282 !! test
15283 Nesting of <ruby>
15284 !! wikitext
15285 <ruby>X<ruby>Y</ruby>Z</ruby>
15286 !! html
15287 <p><ruby>X<ruby>Y</ruby>Z</ruby>
15288 </p>
15289 !! end
15290
15291 # Note that tidy doesn't handle this correctly.
15292 !! test
15293 Nesting of <bdo>
15294 !! wikitext
15295 <bdo>X<bdo>Y</bdo>Z</bdo>
15296 !! html
15297 <p><bdo>X<bdo>Y</bdo>Z</bdo>
15298 </p>
15299 !! end
15300
15301
15302 ###
15303 ### Media links
15304 ###
15305
15306 !! test
15307 Media link
15308 !! wikitext
15309 [[Media:Foobar.jpg]]
15310 !! html
15311 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
15312 </p>
15313 !! end
15314
15315 !! test
15316 Media link with text
15317 !! wikitext
15318 [[Media:Foobar.jpg|A neat file to look at]]
15319 !! html
15320 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
15321 </p>
15322 !! end
15323
15324 # FIXME: this is still bad HTML tag nesting
15325 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
15326 !! test
15327 Media link with nasty text
15328 !! wikitext
15329 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
15330 !! html
15331 <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>
15332
15333 !! html+tidy
15334 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
15335 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
15336 !! end
15337
15338 !! test
15339 Media link to nonexistent file (bug 1702)
15340 !! wikitext
15341 [[Media:No such.jpg]]
15342 !! html
15343 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
15344 </p>
15345 !! end
15346
15347 !! test
15348 Image link to nonexistent file (bug 1850 - good)
15349 !! wikitext
15350 [[File:No_such.jpg]]
15351 !! html/php
15352 <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>
15353 </p>
15354 !! html/parsoid
15355 <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>
15356 !! end
15357
15358 !! test
15359 :Image link to nonexistent file (bug 1850 - bad)
15360 !! wikitext
15361 [[:Image:No such.jpg]]
15362 !! html/php
15363 <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>
15364 </p>
15365 !! html/parsoid
15366 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
15367 !! end
15368
15369
15370
15371 !! test
15372 Character reference normalization in link text (bug 1938)
15373 !! wikitext
15374 [[Main Page|this&that]]
15375 !! html
15376 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
15377 </p>
15378 !!end
15379
15380 !! article
15381 אַ
15382 !! text
15383 Test for unicode normalization
15384
15385 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
15386 !! endarticle
15387
15388 !! test
15389 (bug 19451) Links should refer to the normalized form.
15390 !! wikitext
15391 [[&#xFB2E;]]
15392 [[&#x5d0;&#x5b7;]]
15393 [[&#x5d0;ַ]]
15394 [[א&#x5b7;]]
15395 [[אַ]]
15396 !! html
15397 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
15398 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
15399 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
15400 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
15401 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
15402 </p>
15403 !! end
15404
15405 !! test
15406 Empty attribute crash test (bug 2067)
15407 !! wikitext
15408 <font color="">foo</font>
15409 !! html
15410 <p><font color="">foo</font>
15411 </p>
15412 !! end
15413
15414 !! test
15415 Empty attribute crash test single-quotes (bug 2067)
15416 !! wikitext
15417 <font color=''>foo</font>
15418 !! html
15419 <p><font color="">foo</font>
15420 </p>
15421 !! end
15422
15423 !! test
15424 Attribute test: equals, then nothing
15425 !! wikitext
15426 <font color=>foo</font>
15427 !! html
15428 <p><font>foo</font>
15429 </p>
15430 !! end
15431
15432 !! test
15433 Attribute test: unquoted value
15434 !! wikitext
15435 <font color=x>foo</font>
15436 !! html
15437 <p><font color="x">foo</font>
15438 </p>
15439 !! end
15440
15441 !! test
15442 Attribute test: unquoted but illegal value (hash)
15443 !! wikitext
15444 <font color=#x>foo</font>
15445 !! html
15446 <p><font color="#x">foo</font>
15447 </p>
15448 !! end
15449
15450 # Parsoid does not serialize to empty attribute syntax,
15451 # so wt2wt and html2wt cases are skipped
15452 !! test
15453 Attribute test: no value (T54330)
15454 !! options
15455 parsoid=wt2html,html2html
15456 !! wikitext
15457 <font color>foo</font>
15458 !! html/php
15459 <p><font color="">foo</font>
15460 </p>
15461 !! html/parsoid
15462 <p><font color="">foo</font></p>
15463 !! end
15464
15465 !! test
15466 Bug 2095: link with three closing brackets
15467 !! wikitext
15468 [[Main Page]]]
15469 !! html/php
15470 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
15471 </p>
15472 !! html/parsoid
15473 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
15474 !! end
15475
15476 !! test
15477 Bug 2095: link with pipe and three closing brackets
15478 !! wikitext
15479 [[Main Page|link]]]
15480 !! html/php
15481 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
15482 </p>
15483 !! html/parsoid
15484 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
15485 !! end
15486
15487 !! test
15488 Bug 2095: link with pipe and three closing brackets, version 2
15489 !! wikitext
15490 [[Main Page|[http://example.com/]]]
15491 !! html/php
15492 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
15493 </p>
15494 !! html/parsoid
15495 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
15496 !! end
15497
15498
15499 ###
15500 ### Safety
15501 ###
15502
15503 !! article
15504 Template:Dangerous attribute
15505 !! text
15506 " onmouseover="alert(document.cookie)
15507 !! endarticle
15508
15509 !! article
15510 Template:Dangerous style attribute
15511 !! text
15512 border-size: expression(alert(document.cookie))
15513 !! endarticle
15514
15515 !! article
15516 Template:Div style
15517 !! text
15518 <div style="float: right; {{{1}}}">Magic div</div>
15519 !! endarticle
15520
15521 !! test
15522 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
15523 !! wikitext
15524 <div title="{{test}}"></div>
15525 !! html
15526 <div title="This is a test template"></div>
15527
15528 !! end
15529
15530 # Parsoid has enough context to handle this case
15531 !! test
15532 Bug 2304: HTML attribute safety (dangerous template; 2309)
15533 !! wikitext
15534 <div title="{{dangerous attribute}}"></div>
15535 !! html/php
15536 <div title=""></div>
15537
15538 !! html/parsoid
15539 <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>
15540 !! end
15541
15542 !! test
15543 Bug 2304: HTML attribute safety (dangerous style template; 2309)
15544 !! wikitext
15545 <div style="{{dangerous style attribute}}"></div>
15546 !! html
15547 <div style="/* insecure input */"></div>
15548
15549 !! end
15550
15551 !! test
15552 Bug 2304: HTML attribute safety (safe parameter; 2309)
15553 !! wikitext
15554 {{div style|width: 200px}}
15555 !! html
15556 <div style="float: right; width: 200px">Magic div</div>
15557
15558 !! end
15559
15560 !! test
15561 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
15562 !! wikitext
15563 {{div style|width: expression(alert(document.cookie))}}
15564 !! html
15565 <div style="/* insecure input */">Magic div</div>
15566
15567 !! end
15568
15569 !! test
15570 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
15571 !! wikitext
15572 {{div style|"><script>alert(document.cookie)</script>}}
15573 !! html
15574 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15575
15576 !! end
15577
15578 !! test
15579 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
15580 !! wikitext
15581 {{div style|" ><script>alert(document.cookie)</script>}}
15582 !! html
15583 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15584
15585 !! end
15586
15587 !! test
15588 Bug 2304: HTML attribute safety (link)
15589 !! wikitext
15590 <div title="[[Main Page]]"></div>
15591 !! html
15592 <div title="&#91;&#91;Main Page]]"></div>
15593
15594 !! end
15595
15596 !! test
15597 Bug 2304: HTML attribute safety (italics)
15598 !! wikitext
15599 <div title="''foobar''"></div>
15600 !! html
15601 <div title="&#39;&#39;foobar&#39;&#39;"></div>
15602
15603 !! end
15604
15605 !! test
15606 Bug 2304: HTML attribute safety (bold)
15607 !! wikitext
15608 <div title="'''foobar'''"></div>
15609 !! html
15610 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
15611
15612 !! end
15613
15614
15615 !! test
15616 Bug 2304: HTML attribute safety (ISBN)
15617 !! wikitext
15618 <div title="ISBN 1234567890"></div>
15619 !! html
15620 <div title="&#73;SBN 1234567890"></div>
15621
15622 !! end
15623
15624 !! test
15625 Bug 2304: HTML attribute safety (RFC)
15626 !! wikitext
15627 <div title="RFC 1234"></div>
15628 !! html
15629 <div title="&#82;FC 1234"></div>
15630
15631 !! end
15632
15633 !! test
15634 Bug 2304: HTML attribute safety (PMID)
15635 !! wikitext
15636 <div title="PMID 1234567890"></div>
15637 !! html
15638 <div title="&#80;MID 1234567890"></div>
15639
15640 !! end
15641
15642 !! test
15643 Bug 2304: HTML attribute safety (web link)
15644 !! wikitext
15645 <div title="http://example.com/"></div>
15646 !! html
15647 <div title="http&#58;//example.com/"></div>
15648
15649 !! end
15650
15651 !! test
15652 Bug 2304: HTML attribute safety (named web link)
15653 !! wikitext
15654 <div title="[http://example.com/ link]"></div>
15655 !! html
15656 <div title="&#91;http&#58;//example.com/ link]"></div>
15657
15658 !! end
15659
15660 !! test
15661 Bug 3244: HTML attribute safety (extension; safe)
15662 !! wikitext
15663 <div style="<nowiki>background:blue</nowiki>"></div>
15664 !! html
15665 <div style="background:blue"></div>
15666
15667 !! end
15668
15669 !! test
15670 Bug 3244: HTML attribute safety (extension; unsafe)
15671 !! wikitext
15672 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
15673 !! html
15674 <div style="/* insecure input */"></div>
15675
15676 !! end
15677
15678 # More MSIE fun discovered by Tom Gilder
15679
15680 !! test
15681 MSIE CSS safety test: spurious slash
15682 !! wikitext
15683 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
15684 !! html
15685 <div style="/* insecure input */">evil</div>
15686
15687 !! end
15688
15689 !! test
15690 MSIE CSS safety test: hex code
15691 !! wikitext
15692 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
15693 !! html
15694 <div style="/* insecure input */">evil</div>
15695
15696 !! end
15697
15698 !! test
15699 MSIE CSS safety test: comment in url
15700 !! wikitext
15701 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
15702 !! html
15703 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
15704
15705 !! end
15706
15707 !! test
15708 MSIE CSS safety test: comment in expression
15709 !! wikitext
15710 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
15711 !! html
15712 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
15713
15714 !! end
15715
15716 !! test
15717 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
15718 !! wikitext
15719 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
15720 !! html
15721 <p style="/* invalid control char */">A</p>
15722
15723 !! end
15724
15725 !! test
15726 MSIE 6 CSS safety test: Fullwidth (bug 55332)
15727 !! wikitext
15728 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
15729 <div style="top:EXPRESSION(alert())">B</div>
15730 !! html
15731 <p style="/* insecure input */">A</p>
15732 <div style="/* insecure input */">B</div>
15733
15734 !! end
15735
15736 !! test
15737 MSIE 6 CSS safety test: IPA extensions (bug 55332)
15738 !! wikitext
15739 <div style="background-image:uʀʟ(javascript:alert())">A</div>
15740 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
15741 !! html
15742 <div style="/* insecure input */">A</div>
15743 <p style="/* insecure input */">B</p>
15744
15745 !! end
15746
15747 !! test
15748 MSIE 6 CSS safety test: sup/sub script (bug 55332)
15749 !! wikitext
15750 <div style="background-image:url⁽javascript:alert())">A</div>
15751 <div style="background-image:url₍javascript:alert())">B</div>
15752 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
15753 !! html
15754 <div style="/* insecure input */">A</div>
15755 <div style="/* insecure input */">B</div>
15756 <p style="/* insecure input */">C</p>
15757
15758 !! end
15759
15760 !! test
15761 Opera -o-link CSS
15762 !! wikitext
15763 <div
15764 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;"
15765 style="-o-link:attr(title);-o-link-source:current">X</div>
15766 !! html
15767 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
15768
15769 !! end
15770
15771 !! test
15772 MSIE 6 CSS safety test: Repetition markers (bug 55332)
15773 !! wikitext
15774 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
15775 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
15776 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
15777 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
15778 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
15779 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
15780 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
15781 !! html
15782 <p style="/* insecure input */">A</p>
15783 <p style="/* insecure input */">B</p>
15784 <p style="/* insecure input */">C</p>
15785 <p style="/* insecure input */">D</p>
15786 <p style="/* insecure input */">E</p>
15787 <p style="/* insecure input */">F</p>
15788 <p style="/* insecure input */">G</p>
15789
15790 !! end
15791
15792 !! test
15793 Table attribute legitimate extension
15794 !! wikitext
15795 {|
15796 !+ style="<nowiki>color:blue</nowiki>"| status
15797 |}
15798 !! html
15799 <table>
15800 <tr>
15801 <th style="color:blue"> status
15802 </th></tr></table>
15803
15804 !!end
15805
15806 !! test
15807 Table attribute safety
15808 !! wikitext
15809 {|
15810 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
15811 |}
15812 !! html
15813 <table>
15814 <tr>
15815 <th style="/* insecure input */"> status
15816 </th></tr></table>
15817
15818 !! end
15819
15820 !! test
15821 CSS line continuation 1
15822 !! wikitext
15823 <div style="background-image: u\&#10;rl(test.jpg);"></div>
15824 !! html
15825 <div style="/* insecure input */"></div>
15826
15827 !! end
15828
15829 !! test
15830 CSS line continuation 2
15831 !! wikitext
15832 <div style="background-image: u\&#13;rl(test.jpg); "></div>
15833 !! html
15834 <div style="/* invalid control char */"></div>
15835
15836 !! end
15837
15838 !! article
15839 Template:Identity
15840 !! text
15841 {{{1}}}
15842 !! endarticle
15843
15844 !! test
15845 Expansion of multi-line templates in attribute values (bug 6255)
15846 !! wikitext
15847 <div style="background: {{identity|#00FF00}}">-</div>
15848 !! html
15849 <div style="background: #00FF00">-</div>
15850
15851 !! end
15852
15853
15854 !! test
15855 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
15856 !! wikitext
15857 <div style="background:
15858 #00FF00">-</div>
15859 !! html/php
15860 <div style="background: #00FF00">-</div>
15861
15862 !! html/parsoid
15863 <div style="background:
15864 #00FF00">-</div>
15865 !! end
15866
15867 !! test
15868 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
15869 !! wikitext
15870 <div style="background: &#10;#00FF00">-</div>
15871 !! html
15872 <div style="background: &#10;#00FF00">-</div>
15873
15874 !! end
15875
15876 !! test
15877 evil <math>-wiki-tags without Extension:Math enabled
15878 !! wikitext
15879 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
15880 !! html+tidy
15881 <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>
15882 !! end
15883
15884 ###
15885 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
15886 ###
15887 !! test
15888 Parser hook: empty input
15889 !! wikitext
15890 <tag></tag>
15891 !! html/php
15892 <pre>
15893 ''
15894 array (
15895 )
15896 </pre>
15897
15898 !! end
15899
15900 !! test
15901 Parser hook: empty input using terminated empty elements
15902 !! wikitext
15903 <tag/>
15904 !! html/php
15905 <pre>
15906 NULL
15907 array (
15908 )
15909 </pre>
15910
15911 !! end
15912
15913 !! test
15914 Parser hook: empty input using terminated empty elements (space before)
15915 !! wikitext
15916 <tag />
15917 !! html/php
15918 <pre>
15919 NULL
15920 array (
15921 )
15922 </pre>
15923
15924 !! end
15925
15926 !! test
15927 Parser hook: basic input
15928 !! wikitext
15929 <tag>input</tag>
15930 !! html/php
15931 <pre>
15932 'input'
15933 array (
15934 )
15935 </pre>
15936
15937 !! end
15938
15939
15940 !! test
15941 Parser hook: case insensitive
15942 !! wikitext
15943 <TAG>input</TAG>
15944 !! html/php
15945 <pre>
15946 'input'
15947 array (
15948 )
15949 </pre>
15950
15951 !! end
15952
15953
15954 !! test
15955 Parser hook: case insensitive, redux
15956 !! wikitext
15957 <TaG>input</TAg>
15958 !! html/php
15959 <pre>
15960 'input'
15961 array (
15962 )
15963 </pre>
15964
15965 !! end
15966
15967 !! test
15968 Parser hook: nested tags
15969 !! options
15970 noxml
15971 !! wikitext
15972 <tag><tag></tag></tag>
15973 !! html/php
15974 <pre>
15975 '<tag>'
15976 array (
15977 )
15978 </pre>&lt;/tag&gt;
15979
15980 !! end
15981
15982 !! test
15983 Parser hook: basic arguments
15984 !! wikitext
15985 <tag width=200 height = "100" depth = '50' square></tag>
15986 !! html/php
15987 <pre>
15988 ''
15989 array (
15990 'width' => '200',
15991 'height' => '100',
15992 'depth' => '50',
15993 'square' => '',
15994 )
15995 </pre>
15996
15997 !! end
15998
15999 !! test
16000 Parser hook: argument containing a forward slash (bug 5344)
16001 !! wikitext
16002 <tag filename='/tmp/bla'></tag>
16003 !! html/php
16004 <pre>
16005 ''
16006 array (
16007 'filename' => '/tmp/bla',
16008 )
16009 </pre>
16010
16011 !! end
16012
16013 !! test
16014 Parser hook: empty input using terminated empty elements (bug 2374)
16015 !! wikitext
16016 <tag foo=bar/>text
16017 !! html/php
16018 <pre>
16019 NULL
16020 array (
16021 'foo' => 'bar',
16022 )
16023 </pre>text
16024
16025 !! end
16026
16027 # </tag> should be output literally since there is no matching tag that begins it
16028 !! test
16029 Parser hook: basic arguments using terminated empty elements (bug 2374)
16030 !! wikitext
16031 <tag width=200 height = "100" depth = '50' square/>
16032 other stuff
16033 </tag>
16034 !! html/php
16035 <pre>
16036 NULL
16037 array (
16038 'width' => '200',
16039 'height' => '100',
16040 'depth' => '50',
16041 'square' => '',
16042 )
16043 </pre>
16044 <p>other stuff
16045 &lt;/tag&gt;
16046 </p>
16047 !! end
16048
16049 ###
16050 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
16051 ###
16052
16053 !! test
16054 Parser hook: static parser hook not inside a comment
16055 !! wikitext
16056 <statictag>hello, world</statictag>
16057 <statictag action=flush/>
16058 !! html/php
16059 <p>hello, world
16060 </p>
16061 !! end
16062
16063
16064 !! test
16065 Parser hook: static parser hook inside a comment
16066 !! wikitext
16067 <!-- <statictag>hello, world</statictag> -->
16068 <statictag action=flush/>
16069 !! html/php
16070 <p><br />
16071 </p>
16072 !! end
16073
16074 # Nested template calls; this case was broken by Parser.php rev 1.506,
16075 # since reverted.
16076
16077 !! article
16078 Template:One-parameter
16079 !! text
16080 (My parameter is: {{{1}}})
16081 !! endarticle
16082
16083 !! article
16084 Template:Map-one-parameter
16085 !! text
16086 {{{{{1}}}|{{{2}}}}}
16087 !! endarticle
16088
16089 !! test
16090 Nested template calls
16091 !! wikitext
16092 {{Map-one-parameter|One-parameter|param}}
16093 !! html
16094 <p>(My parameter is: param)
16095 </p>
16096 !! end
16097
16098
16099 ###
16100 ### Sanitizer
16101 ###
16102
16103 # HTML+Tidy effectively strips out the empty tags completely
16104 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
16105 # which Tidy would have done for the PHP parser had there been content inside it.
16106 !! test
16107 Sanitizer: Closing of open tags
16108 !! wikitext
16109 <s></s><table></table>
16110 !! html
16111 <s></s><table></table>
16112
16113 !! html/parsoid
16114 <p><s></s></p><table></table>
16115 !! end
16116
16117 !! test
16118 Sanitizer: Closing of open but not closed tags
16119 !! wikitext
16120 <s>foo
16121 !! html
16122 <p><s>foo</s>
16123 </p>
16124 !! end
16125
16126 !! test
16127 Sanitizer: Closing of closed but not open tags
16128 !! options
16129 parsoid=wt2html
16130 !! wikitext
16131 </s>
16132 !! html/php+tidy
16133 !! html/parsoid
16134 !! end
16135
16136 !! test
16137 Sanitizer: Closing of closed but not open table tags
16138 !! options
16139 parsoid=wt2html
16140 !! wikitext
16141 Table not started</td></tr></table>
16142 !! html/php+tidy
16143 <p>Table not started</p>
16144 !! html/parsoid
16145 <p>Table not started</p>
16146 !! end
16147
16148 !! test
16149 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
16150 !! wikitext
16151 <span id="æ: v">byte</span>[[#æ: v|backlink]]
16152 !! html
16153 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
16154 </p>
16155 !! end
16156
16157 # In HTML5, the restrictions are that id must contain at least one character,
16158 # and must not contain any space characters.
16159 !! test
16160 Sanitizer: Validating the contents of the id attribute (bug 4515)
16161 !! options
16162 disabled
16163 !! wikitext
16164 <br id="" /><br id="a space" />
16165 !! html
16166 Something ...
16167 !! end
16168
16169 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
16170 !! test
16171 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
16172 !! options
16173 disabled
16174 !! wikitext
16175 <br id="foo" /><br id="foo" />
16176 !! html
16177 Something need to be done. foo-2 ?
16178 !! end
16179
16180 !! test
16181 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
16182 !! wikitext
16183 <div itemscope>
16184 <meta itemprop="hello" content="world">
16185 <meta http-equiv="refresh" content="5">
16186 <meta itemprop="hello" http-equiv="refresh" content="5">
16187 <link itemprop="hello" href="{{SERVER}}">
16188 <link rel="stylesheet" href="{{SERVER}}">
16189 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
16190 </div>
16191 !! html
16192 <div itemscope="">
16193 <p> <meta itemprop="hello" content="world" />
16194 &lt;meta http-equiv="refresh" content="5"&gt;
16195 <meta itemprop="hello" content="5" />
16196 </p>
16197 <link itemprop="hello" href="http&#58;//example.org" />
16198 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
16199 <link itemprop="hello" href="http&#58;//example.org" />
16200 </div>
16201
16202 !! end
16203
16204 !! test
16205 Language converter: output gets cut off unexpectedly (bug 5757)
16206 !! options
16207 language=zh
16208 !! wikitext
16209 this bit is safe: }-
16210
16211 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
16212
16213 then we get cut off here: }-
16214
16215 all additional text is vanished
16216 !! html
16217 <p>this bit is safe: }-
16218 </p><p>but if we add a conversion instance: xxx
16219 </p><p>then we get cut off here: }-
16220 </p><p>all additional text is vanished
16221 </p>
16222 !! end
16223
16224 !! test
16225 Self closed html pairs (bug 5487)
16226 !! options
16227 !! wikitext
16228 <center><font id="bug" />Centered text</center>
16229 <div><font id="bug2" />In div text</div>
16230 !! html
16231 <center>&lt;font id="bug" /&gt;Centered text</center>
16232 <div>&lt;font id="bug2" /&gt;In div text</div>
16233
16234 !! end
16235
16236 #
16237 #
16238 #
16239
16240 !! test
16241 Punctuation: nbsp before exclamation
16242 !! wikitext
16243 C'est grave !
16244 !! html
16245 <p>C'est grave&#160;!
16246 </p>
16247 !! end
16248
16249 !! test
16250 Punctuation: CSS !important (bug 11874)
16251 !! wikitext
16252 <div style="width:50% !important">important</div>
16253 !! html
16254 <div style="width:50% !important">important</div>
16255
16256 !!end
16257
16258 !! test
16259 Punctuation: CSS ! important (bug 11874; with space after)
16260 !! wikitext
16261 <div style="width:50% ! important">important</div>
16262 !! html
16263 <div style="width:50% ! important">important</div>
16264
16265 !!end
16266
16267 !! test
16268 HTML bullet list, closed tags (bug 5497)
16269 !! wikitext
16270 <ul>
16271 <li>One</li>
16272 <li>Two</li>
16273 </ul>
16274 !! html/php
16275 <ul>
16276 <li>One</li>
16277 <li>Two</li>
16278 </ul>
16279
16280 !! html/parsoid
16281 <ul data-parsoid='{"stx":"html"}'>
16282 <li data-parsoid='{"stx":"html"}'>One</li>
16283 <li data-parsoid='{"stx":"html"}'>Two</li>
16284 </ul>
16285
16286 !! end
16287
16288 !! test
16289 HTML bullet list, unclosed tags (bug 5497)
16290 !! wikitext
16291 <ul>
16292 <li>One
16293 <li>Two
16294 </ul>
16295 !! html/php+tidy
16296 <ul>
16297 <li>One</li>
16298 <li>Two</li>
16299 </ul>
16300 !! html/parsoid
16301 <ul data-parsoid='{"stx":"html"}'>
16302 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16303 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16304 </ul>
16305
16306 !! end
16307
16308 !! test
16309 HTML ordered list, closed tags (bug 5497)
16310 !! wikitext
16311 <ol>
16312 <li>One</li>
16313 <li>Two</li>
16314 </ol>
16315 !! html/php
16316 <ol>
16317 <li>One</li>
16318 <li>Two</li>
16319 </ol>
16320
16321 !! html/parsoid
16322 <ol data-parsoid='{"stx":"html"}'>
16323 <li data-parsoid='{"stx":"html"}'>One</li>
16324 <li data-parsoid='{"stx":"html"}'>Two</li>
16325 </ol>
16326
16327 !! end
16328
16329 !! test
16330 HTML ordered list, unclosed tags (bug 5497)
16331 !! options
16332 !! wikitext
16333 <ol>
16334 <li>One
16335 <li>Two
16336 </ol>
16337 !! html/php+tidy
16338 <ol>
16339 <li>One</li>
16340 <li>Two</li>
16341 </ol>
16342 !! html/parsoid
16343 <ol data-parsoid='{"stx":"html"}'>
16344 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16345 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16346 </ol>
16347
16348 !! end
16349
16350 !! test
16351 HTML nested bullet list, closed tags (bug 5497)
16352 !! wikitext
16353 <ul>
16354 <li>One</li>
16355 <li>Two:
16356 <ul>
16357 <li>Sub-one</li>
16358 <li>Sub-two</li>
16359 </ul>
16360 </li>
16361 </ul>
16362 !! html
16363 <ul>
16364 <li>One</li>
16365 <li>Two:
16366 <ul>
16367 <li>Sub-one</li>
16368 <li>Sub-two</li>
16369 </ul>
16370 </li>
16371 </ul>
16372
16373 !! end
16374
16375 !! test
16376 HTML nested bullet list, open tags (bug 5497)
16377 !! wikitext
16378 <ul>
16379 <li>One
16380 <li>Two:
16381 <ul>
16382 <li>Sub-one
16383 <li>Sub-two
16384 </ul>
16385 </ul>
16386 !! html/php+tidy
16387 <ul>
16388 <li>One</li>
16389 <li>Two:
16390 <ul>
16391 <li>Sub-one</li>
16392 <li>Sub-two</li>
16393 </ul>
16394 </li>
16395 </ul>
16396 !! html/parsoid
16397 <ul>
16398 <li>One
16399 </li>
16400 <li>Two:
16401 <ul>
16402 <li>Sub-one
16403 </li>
16404 <li>Sub-two
16405 </li>
16406 </ul>
16407 </li>
16408 </ul>
16409
16410 !! end
16411
16412 !! test
16413 HTML nested ordered list, closed tags (bug 5497)
16414 !! wikitext
16415 <ol>
16416 <li>One</li>
16417 <li>Two:
16418 <ol>
16419 <li>Sub-one</li>
16420 <li>Sub-two</li>
16421 </ol>
16422 </li>
16423 </ol>
16424 !! html
16425 <ol>
16426 <li>One</li>
16427 <li>Two:
16428 <ol>
16429 <li>Sub-one</li>
16430 <li>Sub-two</li>
16431 </ol>
16432 </li>
16433 </ol>
16434
16435 !! end
16436
16437 !! test
16438 HTML nested ordered list, open tags (bug 5497)
16439 !! wikitext
16440 <ol>
16441 <li>One
16442 <li>Two:
16443 <ol>
16444 <li>Sub-one
16445 <li>Sub-two
16446 </ol>
16447 </ol>
16448 !! html/php
16449 <ol>
16450 <li>One
16451 <li>Two:
16452 <ol>
16453 <li>Sub-one
16454 <li>Sub-two
16455 </ol>
16456 </ol>
16457
16458 !! html/parsoid
16459 <ol>
16460 <li>One
16461 </li>
16462 <li>Two:
16463 <ol>
16464 <li>Sub-one
16465 </li>
16466 <li>Sub-two
16467 </li>
16468 </ol>
16469 </li>
16470 </ol>
16471
16472 !! end
16473
16474 !! test
16475 HTML ordered list item with parameters oddity
16476 !! wikitext
16477 <ol><li id="fragment">One</li>
16478 </ol>
16479 !! html
16480 <ol><li id="fragment">One</li>
16481 </ol>
16482
16483 !! end
16484
16485 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
16486 !!test
16487 bug 5918: autonumbering
16488 !! wikitext
16489 [http://first/] [http://second] [ftp://ftp]
16490
16491 ftp://inlineftp
16492
16493 [mailto:enclosed@mail.tld With target]
16494
16495 [mailto:enclosed@mail.tld]
16496
16497 mailto:inline@mail.tld
16498 !! html/php
16499 <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>
16500 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
16501 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
16502 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
16503 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
16504 </p>
16505 !! html/parsoid
16506 <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>
16507 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
16508 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
16509 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
16510 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
16511 !! end
16512
16513
16514 #
16515 # Security and HTML correctness
16516 # From Nick Jenkins' fuzz testing
16517 #
16518
16519 !! test
16520 Fuzz testing: Parser13
16521 !! wikitext
16522 {|
16523 | http://a|
16524 !! html
16525 <table>
16526 <tr>
16527 <td>
16528 </td>
16529 </tr>
16530 </table>
16531
16532 !! end
16533
16534 !! test
16535 Fuzz testing: Parser14
16536 !! wikitext
16537 == onmouseover= ==
16538 http://__TOC__
16539 !! html
16540 <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>
16541 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16542 <ul>
16543 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16544 </ul>
16545 </div>
16546
16547
16548 !! html+tidy
16549 <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>
16550 <p>http://</p>
16551 <div id="toc" class="toc">
16552 <div id="toctitle">
16553 <h2>Contents</h2>
16554 </div>
16555 <ul>
16556 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16557 </ul>
16558 </div>
16559 <p></p>
16560 !! end
16561
16562 !! test
16563 Fuzz testing: Parser14-table
16564 !! wikitext
16565 ==a==
16566 {| STYLE=__TOC__
16567 !! html
16568 <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>
16569 <table style="&#95;_TOC&#95;_">
16570 <tr><td></td></tr>
16571 </table>
16572
16573 !! html+tidy
16574 <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>
16575 <table style="__TOC__">
16576 <tr>
16577 <td></td>
16578 </tr>
16579 </table>
16580 !! end
16581
16582 # Known to produce bogus xml (extra </td>)
16583 !! test
16584 Fuzz testing: Parser16
16585 !! options
16586 noxml
16587 !! wikitext
16588 {|
16589 !https://||||||
16590 !! html
16591 <table>
16592 <tr>
16593 <th>https://</th>
16594 <th></th>
16595 <th></th>
16596 <th>
16597 </td>
16598 </tr>
16599 </table>
16600
16601 !! html+tidy
16602 <table>
16603 <tr>
16604 <th>https://</th>
16605 <th></th>
16606 <th></th>
16607 <th></th>
16608 </tr>
16609 </table>
16610 !! end
16611
16612 !! test
16613 Fuzz testing: Parser21
16614 !! wikitext
16615 {|
16616 ! irc://{{ftp://a" onmouseover="alert('hello world');"
16617 |
16618 !! html
16619 <table>
16620 <tr>
16621 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
16622 </th>
16623 <td>
16624 </td>
16625 </tr>
16626 </table>
16627
16628 !! end
16629
16630 !! test
16631 Fuzz testing: Parser22
16632 !! wikitext
16633 http://===r:::https://b
16634
16635 {|
16636 !! html
16637 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
16638 </p>
16639 <table>
16640 <tr><td></td></tr>
16641 </table>
16642
16643 !! end
16644
16645 # Known to produce bad XML for now
16646 !! test
16647 Fuzz testing: Parser24
16648 !! options
16649 noxml
16650 !! wikitext
16651 {|
16652 {{{|
16653 <u CLASS=
16654 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
16655 <br style="onmouseover='alert(document.cookie);' " />
16656
16657 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
16658 |
16659 !! html
16660 <table>
16661 {{{|
16662 <u class="&#124;">}}}} &gt;
16663 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
16664
16665 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
16666 <tr>
16667 <td></u>
16668 </td>
16669 </tr>
16670 </table>
16671
16672 !! end
16673
16674 # Note: the current result listed for this is not what the original one was,
16675 # but the original bug was JavaScript injection, which is fixed in any case.
16676 # It's not clear that the original result listed was any more correct than the
16677 # current one. Original result:
16678 # <p>{{{|
16679 # </p>
16680 # <li class="&#124;&#124;">
16681 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
16682 !!test
16683 Fuzz testing: Parser25 (bug 6055)
16684 !! wikitext
16685 {{{
16686 |
16687 <LI CLASS=||
16688 >
16689 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
16690 !! html
16691 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
16692 </p>
16693 !! end
16694
16695 !!test
16696 Fuzz testing: URL adjacent extension (with space, clean)
16697 !! wikitext
16698 http://example.com <nowiki>junk</nowiki>
16699 !! html/php
16700 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
16701 </p>
16702 !! html/parsoid
16703 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
16704 !! end
16705
16706 !!test
16707 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
16708 !! wikitext
16709 http://example.com<nowiki>junk</nowiki>
16710 !! html/php
16711 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
16712 </p>
16713 !! html/parsoid
16714 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
16715 !! end
16716
16717 !!test
16718 Fuzz testing: URL adjacent extension (no space, dirty; pre)
16719 !! wikitext
16720 http://example.com<pre>junk</pre>
16721 !! html/php
16722 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
16723
16724 !! html/php+tidy
16725 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
16726 <pre>
16727 junk
16728 </pre>
16729 !! html/parsoid
16730 <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>
16731 !!end
16732
16733 !!test
16734 Fuzz testing: image with bogus manual thumbnail
16735 !! wikitext
16736 [[Image:foobar.jpg|thumbnail= ]]
16737 !! html/php
16738 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
16739
16740 !! html/parsoid
16741 <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>
16742 !!end
16743
16744 !! test
16745 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
16746 !! wikitext
16747 <pre dir="&#10;"></pre>
16748 !! html
16749 <pre dir="&#10;"></pre>
16750
16751 !! end
16752
16753 !! test
16754 Parsing optional HTML elements (Bug 6171)
16755 !! options
16756 !! wikitext
16757 <table>
16758 <tr>
16759 <td> Some tabular data</td>
16760 <td> More tabular data ...
16761 <td> And yet som tabular data</td>
16762 </tr>
16763 </table>
16764 !! html
16765 <table>
16766 <tr>
16767 <td> Some tabular data</td>
16768 <td> More tabular data ...
16769 </td><td> And yet som tabular data</td>
16770 </tr>
16771 </table>
16772
16773 !! end
16774
16775 !! test
16776 Correct handling of <td>, <tr> (Bug 6171)
16777 !! options
16778 !! wikitext
16779 <table>
16780 <tr>
16781 <td> Some tabular data</td>
16782 <td> More tabular data ...</td>
16783 <td> And yet som tabular data</td>
16784 </tr>
16785 </table>
16786 !! html
16787 <table>
16788 <tr>
16789 <td> Some tabular data</td>
16790 <td> More tabular data ...</td>
16791 <td> And yet som tabular data</td>
16792 </tr>
16793 </table>
16794
16795 !! end
16796
16797
16798 !! test
16799 Parsing crashing regression (fr:JavaScript)
16800 !! wikitext
16801 </body></x>
16802 !! html
16803 <p>&lt;/body&gt;&lt;/x&gt;
16804 </p>
16805 !! end
16806
16807 !! test
16808 Inline wiki vs wiki block nesting
16809 !! wikitext
16810 '''Bold paragraph
16811
16812 New wiki paragraph
16813 !! html
16814 <p><b>Bold paragraph</b>
16815 </p><p>New wiki paragraph
16816 </p>
16817 !! end
16818
16819 # FIXME: The current php output is documented
16820 # and desired output is the parsoid target.
16821 !! test
16822 Inline HTML vs wiki block nesting
16823 !! wikitext
16824 <b>Bold paragraph
16825
16826 New wiki paragraph
16827 !! html/php
16828 <p><b>Bold paragraph
16829 </p><p>New wiki paragraph</b>
16830 </p>
16831 !! html/parsoid
16832 <p><b>Bold paragraph</b>
16833 </p><p>New wiki paragraph
16834 </p>
16835 !! end
16836
16837 # Original result was this:
16838 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
16839 # </p>
16840 # While that might be marginally more intuitive, maybe, the six-apostrophe
16841 # construct is clearly pathological and the result stated here (which is what
16842 # the parser actually does) is about as reasonable as anything.
16843 !!test
16844 Mixing markup for italics and bold
16845 !! options
16846 !! wikitext
16847 '''bold''''''bold''bolditalics'''''
16848 !! html
16849 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
16850 </p>
16851 !! end
16852
16853
16854 !! article
16855 Xyzzyx
16856 !! text
16857 Article for special page transclusion test
16858 !! endarticle
16859
16860 !! test
16861 Special page transclusion
16862 !! options
16863 !! wikitext
16864 {{Special:Prefixindex/Xyzzyx}}
16865 !! html
16866 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16867
16868 !! end
16869
16870 !! test
16871 Special page transclusion twice (bug 5021)
16872 !! options
16873 !! wikitext
16874 {{Special:Prefixindex/Xyzzyx}}
16875 {{Special:Prefixindex/Xyzzyx}}
16876 !! html
16877 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16878 <table class="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
16879
16880 !! end
16881
16882 !! test
16883 Transclusion of default MediaWiki message
16884 !! wikitext
16885 {{MediaWiki:Mainpage}}
16886 !! html
16887 <p>Main Page
16888 </p>
16889 !! end
16890
16891 !! test
16892 Transclusion of nonexistent MediaWiki message
16893 !! wikitext
16894 {{MediaWiki:Mainpagexxx}}
16895 !! html
16896 <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>
16897 </p>
16898 !! end
16899
16900 !! test
16901 Transclusion of MediaWiki message with underscore
16902 !! wikitext
16903 {{MediaWiki:history_short}}
16904 !! html
16905 <p>History
16906 </p>
16907 !! end
16908
16909 !! test
16910 Transclusion of MediaWiki message with space
16911 !! wikitext
16912 {{MediaWiki:history short}}
16913 !! html
16914 <p>History
16915 </p>
16916 !! end
16917
16918 !! test
16919 Invalid header with following text
16920 !! wikitext
16921 = x = y
16922 !! html
16923 <p>= x = y
16924 </p>
16925 !! end
16926
16927
16928 !! test
16929 Section extraction test (section 0)
16930 !! options
16931 section=0
16932 !! wikitext
16933 start
16934 ==a==
16935 ===aa===
16936 ====aaa====
16937 ==b==
16938 ===ba===
16939 ===bb===
16940 ====bba====
16941 ===bc===
16942 ==c==
16943 ===ca===
16944 !! html/php
16945 start
16946 !! end
16947
16948 !! test
16949 Section extraction test (section 1)
16950 !! options
16951 section=1
16952 !! wikitext
16953 start
16954 ==a==
16955 ===aa===
16956 ====aaa====
16957 ==b==
16958 ===ba===
16959 ===bb===
16960 ====bba====
16961 ===bc===
16962 ==c==
16963 ===ca===
16964 !! html/php
16965 ==a==
16966 ===aa===
16967 ====aaa====
16968 !! end
16969
16970 !! test
16971 Section extraction test (section 2)
16972 !! options
16973 section=2
16974 !! wikitext
16975 start
16976 ==a==
16977 ===aa===
16978 ====aaa====
16979 ==b==
16980 ===ba===
16981 ===bb===
16982 ====bba====
16983 ===bc===
16984 ==c==
16985 ===ca===
16986 !! html/php
16987 ===aa===
16988 ====aaa====
16989 !! end
16990
16991 !! test
16992 Section extraction test (section 3)
16993 !! options
16994 section=3
16995 !! wikitext
16996 start
16997 ==a==
16998 ===aa===
16999 ====aaa====
17000 ==b==
17001 ===ba===
17002 ===bb===
17003 ====bba====
17004 ===bc===
17005 ==c==
17006 ===ca===
17007 !! html/php
17008 ====aaa====
17009 !! end
17010
17011 !! test
17012 Section extraction test (section 4)
17013 !! options
17014 section=4
17015 !! wikitext
17016 start
17017 ==a==
17018 ===aa===
17019 ====aaa====
17020 ==b==
17021 ===ba===
17022 ===bb===
17023 ====bba====
17024 ===bc===
17025 ==c==
17026 ===ca===
17027 !! html/php
17028 ==b==
17029 ===ba===
17030 ===bb===
17031 ====bba====
17032 ===bc===
17033 !! end
17034
17035 !! test
17036 Section extraction test (section 5)
17037 !! options
17038 section=5
17039 !! wikitext
17040 start
17041 ==a==
17042 ===aa===
17043 ====aaa====
17044 ==b==
17045 ===ba===
17046 ===bb===
17047 ====bba====
17048 ===bc===
17049 ==c==
17050 ===ca===
17051 !! html/php
17052 ===ba===
17053 !! end
17054
17055 !! test
17056 Section extraction test (section 6)
17057 !! options
17058 section=6
17059 !! wikitext
17060 start
17061 ==a==
17062 ===aa===
17063 ====aaa====
17064 ==b==
17065 ===ba===
17066 ===bb===
17067 ====bba====
17068 ===bc===
17069 ==c==
17070 ===ca===
17071 !! html/php
17072 ===bb===
17073 ====bba====
17074 !! end
17075
17076 !! test
17077 Section extraction test (section 7)
17078 !! options
17079 section=7
17080 !! wikitext
17081 start
17082 ==a==
17083 ===aa===
17084 ====aaa====
17085 ==b==
17086 ===ba===
17087 ===bb===
17088 ====bba====
17089 ===bc===
17090 ==c==
17091 ===ca===
17092 !! html/php
17093 ====bba====
17094 !! end
17095
17096 !! test
17097 Section extraction test (section 8)
17098 !! options
17099 section=8
17100 !! wikitext
17101 start
17102 ==a==
17103 ===aa===
17104 ====aaa====
17105 ==b==
17106 ===ba===
17107 ===bb===
17108 ====bba====
17109 ===bc===
17110 ==c==
17111 ===ca===
17112 !! html/php
17113 ===bc===
17114 !! end
17115
17116 !! test
17117 Section extraction test (section 9)
17118 !! options
17119 section=9
17120 !! wikitext
17121 start
17122 ==a==
17123 ===aa===
17124 ====aaa====
17125 ==b==
17126 ===ba===
17127 ===bb===
17128 ====bba====
17129 ===bc===
17130 ==c==
17131 ===ca===
17132 !! html/php
17133 ==c==
17134 ===ca===
17135 !! end
17136
17137 !! test
17138 Section extraction test (section 10)
17139 !! options
17140 section=10
17141 !! wikitext
17142 start
17143 ==a==
17144 ===aa===
17145 ====aaa====
17146 ==b==
17147 ===ba===
17148 ===bb===
17149 ====bba====
17150 ===bc===
17151 ==c==
17152 ===ca===
17153 !! html/php
17154 ===ca===
17155 !! end
17156
17157 !! test
17158 Section extraction test (nonexistent section 11)
17159 !! options
17160 section=11
17161 !! wikitext
17162 start
17163 ==a==
17164 ===aa===
17165 ====aaa====
17166 ==b==
17167 ===ba===
17168 ===bb===
17169 ====bba====
17170 ===bc===
17171 ==c==
17172 ===ca===
17173 !! html/php
17174 !! end
17175
17176 !! test
17177 Section extraction test with bogus heading (section 1)
17178 !! options
17179 section=1
17180 !! wikitext
17181 ==a==
17182 ==bogus== not a legal section
17183 ==b==
17184 !! html/php
17185 ==a==
17186 ==bogus== not a legal section
17187 !! end
17188
17189 !! test
17190 Section extraction test with bogus heading (section 2)
17191 !! options
17192 section=2
17193 !! wikitext
17194 ==a==
17195 ==bogus== not a legal section
17196 ==b==
17197 !! html/php
17198 ==b==
17199 !! end
17200
17201 !! test
17202 Section extraction test with comment after heading (section 1)
17203 !! options
17204 section=1
17205 !! wikitext
17206 ==a==
17207 ==b== <!-- -->
17208 ==c==
17209 !! html/php
17210 ==a==
17211 !! end
17212
17213 !! test
17214 Section extraction test with comment after heading (section 2)
17215 !! options
17216 section=2
17217 !! wikitext
17218 ==a==
17219 ==b== <!-- -->
17220 ==c==
17221 !! html/php
17222 ==b== <!-- -->
17223 !! end
17224
17225 !! test
17226 Section extraction test with bogus <nowiki> heading (section 1)
17227 !! options
17228 section=1
17229 !! wikitext
17230 ==a==
17231 ==bogus== <nowiki>not a legal section</nowiki>
17232 ==b==
17233 !! html/php
17234 ==a==
17235 ==bogus== <nowiki>not a legal section</nowiki>
17236 !! end
17237
17238 !! test
17239 Section extraction test with bogus <nowiki> heading (section 2)
17240 !! options
17241 section=2
17242 !! wikitext
17243 ==a==
17244 ==bogus== <nowiki>not a legal section</nowiki>
17245 ==b==
17246 !! html/php
17247 ==b==
17248 !! end
17249
17250 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
17251 # instead of respecting commented sections
17252 !! test
17253 Section extraction prefixed by comment (section 1)
17254 !! options
17255 section=1
17256 !! wikitext
17257 <!-- -->==sec1==
17258 ==sec2==
17259 !! html/php
17260 ==sec2==
17261 !!end
17262
17263 !! test
17264 Section extraction prefixed by comment (section 2)
17265 !! options
17266 section=2
17267 !! wikitext
17268 <!-- -->==sec1==
17269 ==sec2==
17270 !! html/php
17271
17272 !!end
17273
17274 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
17275 # instead of respecting HTML-style headings
17276 !! test
17277 Section extraction, mixed wiki and html (section 1)
17278 !! options
17279 section=1
17280 !! wikitext
17281 <h2>unmarked</h2>
17282 unmarked
17283 ==1==
17284 one
17285 ==2==
17286 two
17287 !! html/php
17288 ==1==
17289 one
17290 !! end
17291
17292 !! test
17293 Section extraction, mixed wiki and html (section 2)
17294 !! options
17295 section=2
17296 !! wikitext
17297 <h2>unmarked</h2>
17298 unmarked
17299 ==1==
17300 one
17301 ==2==
17302 two
17303 !! html/php
17304 ==2==
17305 two
17306 !! end
17307
17308
17309 # Formerly testing for bug 3342
17310 !! test
17311 Section extraction, heading surrounded by <noinclude>
17312 !! options
17313 section=1
17314 !! wikitext
17315 <noinclude>==unmarked==</noinclude>
17316 ==marked==
17317 !! html/php
17318 ==marked==
17319 !!end
17320
17321 # Test behavior of bug 19910
17322 !! test
17323 Sectiion with all-equals
17324 !! options
17325 section=2
17326 !! wikitext
17327 ===
17328 The line above must have a trailing space
17329 === <!--
17330 --> <!-- -->
17331 But just in case it doesn't...
17332 !! html/php
17333 === <!--
17334 --> <!-- -->
17335 But just in case it doesn't...
17336 !! end
17337
17338 !! test
17339 Section replacement test (section 0)
17340 !! options
17341 replace=0,"xxx"
17342 !! wikitext
17343 start
17344 ==a==
17345 ===aa===
17346 ====aaa====
17347 ==b==
17348 ===ba===
17349 ===bb===
17350 ====bba====
17351 ===bc===
17352 ==c==
17353 ===ca===
17354 !! html/php
17355 xxx
17356
17357 ==a==
17358 ===aa===
17359 ====aaa====
17360 ==b==
17361 ===ba===
17362 ===bb===
17363 ====bba====
17364 ===bc===
17365 ==c==
17366 ===ca===
17367 !! end
17368
17369 !! test
17370 Section replacement test (section 1)
17371 !! options
17372 replace=1,"xxx"
17373 !! wikitext
17374 start
17375 ==a==
17376 ===aa===
17377 ====aaa====
17378 ==b==
17379 ===ba===
17380 ===bb===
17381 ====bba====
17382 ===bc===
17383 ==c==
17384 ===ca===
17385 !! html/php
17386 start
17387 xxx
17388
17389 ==b==
17390 ===ba===
17391 ===bb===
17392 ====bba====
17393 ===bc===
17394 ==c==
17395 ===ca===
17396 !! end
17397
17398 !! test
17399 Section replacement test (section 2)
17400 !! options
17401 replace=2,"xxx"
17402 !! wikitext
17403 start
17404 ==a==
17405 ===aa===
17406 ====aaa====
17407 ==b==
17408 ===ba===
17409 ===bb===
17410 ====bba====
17411 ===bc===
17412 ==c==
17413 ===ca===
17414 !! html/php
17415 start
17416 ==a==
17417 xxx
17418
17419 ==b==
17420 ===ba===
17421 ===bb===
17422 ====bba====
17423 ===bc===
17424 ==c==
17425 ===ca===
17426 !! end
17427
17428 !! test
17429 Section replacement test (section 3)
17430 !! options
17431 replace=3,"xxx"
17432 !! wikitext
17433 start
17434 ==a==
17435 ===aa===
17436 ====aaa====
17437 ==b==
17438 ===ba===
17439 ===bb===
17440 ====bba====
17441 ===bc===
17442 ==c==
17443 ===ca===
17444 !! html/php
17445 start
17446 ==a==
17447 ===aa===
17448 xxx
17449
17450 ==b==
17451 ===ba===
17452 ===bb===
17453 ====bba====
17454 ===bc===
17455 ==c==
17456 ===ca===
17457 !! end
17458
17459 !! test
17460 Section replacement test (section 4)
17461 !! options
17462 replace=4,"xxx"
17463 !! wikitext
17464 start
17465 ==a==
17466 ===aa===
17467 ====aaa====
17468 ==b==
17469 ===ba===
17470 ===bb===
17471 ====bba====
17472 ===bc===
17473 ==c==
17474 ===ca===
17475 !! html/php
17476 start
17477 ==a==
17478 ===aa===
17479 ====aaa====
17480 xxx
17481
17482 ==c==
17483 ===ca===
17484 !! end
17485
17486 !! test
17487 Section replacement test (section 5)
17488 !! options
17489 replace=5,"xxx"
17490 !! wikitext
17491 start
17492 ==a==
17493 ===aa===
17494 ====aaa====
17495 ==b==
17496 ===ba===
17497 ===bb===
17498 ====bba====
17499 ===bc===
17500 ==c==
17501 ===ca===
17502 !! html/php
17503 start
17504 ==a==
17505 ===aa===
17506 ====aaa====
17507 ==b==
17508 xxx
17509
17510 ===bb===
17511 ====bba====
17512 ===bc===
17513 ==c==
17514 ===ca===
17515 !! end
17516
17517 !! test
17518 Section replacement test (section 6)
17519 !! options
17520 replace=6,"xxx"
17521 !! wikitext
17522 start
17523 ==a==
17524 ===aa===
17525 ====aaa====
17526 ==b==
17527 ===ba===
17528 ===bb===
17529 ====bba====
17530 ===bc===
17531 ==c==
17532 ===ca===
17533 !! html/php
17534 start
17535 ==a==
17536 ===aa===
17537 ====aaa====
17538 ==b==
17539 ===ba===
17540 xxx
17541
17542 ===bc===
17543 ==c==
17544 ===ca===
17545 !! end
17546
17547 !! test
17548 Section replacement test (section 7)
17549 !! options
17550 replace=7,"xxx"
17551 !! wikitext
17552 start
17553 ==a==
17554 ===aa===
17555 ====aaa====
17556 ==b==
17557 ===ba===
17558 ===bb===
17559 ====bba====
17560 ===bc===
17561 ==c==
17562 ===ca===
17563 !! html/php
17564 start
17565 ==a==
17566 ===aa===
17567 ====aaa====
17568 ==b==
17569 ===ba===
17570 ===bb===
17571 xxx
17572
17573 ===bc===
17574 ==c==
17575 ===ca===
17576 !! end
17577
17578 !! test
17579 Section replacement test (section 8)
17580 !! options
17581 replace=8,"xxx"
17582 !! wikitext
17583 start
17584 ==a==
17585 ===aa===
17586 ====aaa====
17587 ==b==
17588 ===ba===
17589 ===bb===
17590 ====bba====
17591 ===bc===
17592 ==c==
17593 ===ca===
17594 !! html/php
17595 start
17596 ==a==
17597 ===aa===
17598 ====aaa====
17599 ==b==
17600 ===ba===
17601 ===bb===
17602 ====bba====
17603 xxx
17604
17605 ==c==
17606 ===ca===
17607 !!end
17608
17609 !! test
17610 Section replacement test (section 9)
17611 !! options
17612 replace=9,"xxx"
17613 !! wikitext
17614 start
17615 ==a==
17616 ===aa===
17617 ====aaa====
17618 ==b==
17619 ===ba===
17620 ===bb===
17621 ====bba====
17622 ===bc===
17623 ==c==
17624 ===ca===
17625 !! html/php
17626 start
17627 ==a==
17628 ===aa===
17629 ====aaa====
17630 ==b==
17631 ===ba===
17632 ===bb===
17633 ====bba====
17634 ===bc===
17635 xxx
17636 !! end
17637
17638 !! test
17639 Section replacement test (section 10)
17640 !! options
17641 replace=10,"xxx"
17642 !! wikitext
17643 start
17644 ==a==
17645 ===aa===
17646 ====aaa====
17647 ==b==
17648 ===ba===
17649 ===bb===
17650 ====bba====
17651 ===bc===
17652 ==c==
17653 ===ca===
17654 !! html/php
17655 start
17656 ==a==
17657 ===aa===
17658 ====aaa====
17659 ==b==
17660 ===ba===
17661 ===bb===
17662 ====bba====
17663 ===bc===
17664 ==c==
17665 xxx
17666 !! end
17667
17668 !! test
17669 Section replacement test with initial whitespace (bug 13728)
17670 !! options
17671 replace=2,"xxx"
17672 !! wikitext
17673 Preformatted initial line
17674 ==a==
17675 ===a===
17676 !! html/php
17677 Preformatted initial line
17678 ==a==
17679 xxx
17680 !! end
17681
17682
17683 !! test
17684 Section extraction, heading followed by pre with 20 spaces (bug 6398)
17685 !! options
17686 section=1
17687 !! wikitext
17688 ==a==
17689 a
17690 !! html/php
17691 ==a==
17692 a
17693 !! end
17694
17695 !! test
17696 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
17697 !! options
17698 section=1
17699 !! wikitext
17700 ==a==
17701 a
17702 !! html/php
17703 ==a==
17704 a
17705 !! end
17706
17707
17708 !! test
17709 Section extraction, <pre> around bogus header (bug 10309)
17710 !! options
17711 noxml section=2
17712 !! wikitext
17713 == Section One ==
17714 <pre>
17715 =======
17716 </pre>
17717
17718 == Section Two ==
17719 stuff
17720 !! html/php
17721 == Section Two ==
17722 stuff
17723 !! end
17724
17725 !! test
17726 Section replacement, <pre> around bogus header (bug 10309)
17727 !! options
17728 noxml replace=2,"xxx"
17729 !! wikitext
17730 == Section One ==
17731 <pre>
17732 =======
17733 </pre>
17734
17735 == Section Two ==
17736 stuff
17737 !! html/php
17738 == Section One ==
17739 <pre>
17740 =======
17741 </pre>
17742
17743 xxx
17744 !! end
17745
17746
17747 !! test
17748 Handling of &#x0A; in URLs
17749 !! wikitext
17750 ** irc://&#x0A;a
17751 !! html/php
17752 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17753
17754 !! html/parsoid
17755 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
17756 a">irc://
17757 a</a></li></ul></li></ul>
17758 !! end
17759
17760 !! test
17761 Handling of %0A in URLs
17762 !! wikitext
17763 ** irc://%0Aa
17764 !! html/php
17765 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17766
17767 !! html/parsoid
17768 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
17769 !! end
17770
17771
17772 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
17773 !! test
17774 5 quotes, code coverage +1 line
17775 !! options
17776 parsoid=wt2html
17777 !! wikitext
17778 '''''
17779 !! html/php
17780 !! html/parsoid
17781 <p><b><i></i></b></p>
17782 !! end
17783
17784 # same html as previous, but wikitext adjusted to match parsoid html2wt
17785 # note that wt2html and html2html will put the <i> before the <b>
17786 !! test
17787 5 quotes, code coverage +1 line w/ nowiki (1)
17788 !! options
17789 parsoid=wt2wt,html2wt
17790 !! wikitext
17791 '''''<nowiki/>'''''
17792 !! html/php
17793 <p><i></i>
17794 </p>
17795 !! html/parsoid
17796 <p><b><i></i></b></p>
17797 !! end
17798
17799 # same as previous, just swapping the <i> and <b>
17800 !! test
17801 5 quotes, code coverage +1 line w/ nowiki (2)
17802 !! wikitext
17803 '''''<nowiki/>'''''
17804 !! html/php
17805 <p><i></i>
17806 </p>
17807 !! html/parsoid
17808 <p><i><b></b></i></p>
17809 !! end
17810
17811 !! test
17812 Special:Search page linking.
17813 !! wikitext
17814 {{Special:search}}
17815 !! html
17816 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
17817 </p>
17818 !! end
17819
17820 !! test
17821 {{!}} is a magic word
17822 !! wikitext
17823 {{!}} is a magic word there and {{!}} is still a magic word here
17824 !! html/php
17825 <p>| is a magic word there and | is still a magic word here
17826 </p>
17827 !! html/parsoid
17828 <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>
17829 !! end
17830
17831 !! test
17832 Say the magic word
17833 !! options
17834 title=[[Parser test]]
17835 !! wikitext
17836 * {{PAGENAME}}
17837 * {{PAGENAMEE}}
17838 * {{FULLPAGENAME}}
17839 * {{FULLPAGENAMEE}}
17840 * {{BASEPAGENAME}}
17841 * {{BASEPAGENAMEE}}
17842 * {{SUBPAGENAME}}
17843 * {{SUBPAGENAMEE}}
17844 * {{ROOTPAGENAME}}
17845 * {{ROOTPAGENAMEE}}
17846 * {{TALKPAGENAME}}
17847 * {{TALKPAGENAMEE}}
17848 * {{SUBJECTPAGENAME}}
17849 * {{SUBJECTPAGENAMEE}}
17850 * {{NAMESPACEE}}
17851 * {{NAMESPACE}}
17852 * {{NAMESPACENUMBER}}
17853 * {{TALKSPACE}}
17854 * {{TALKSPACEE}}
17855 * {{SUBJECTSPACE}}
17856 * {{SUBJECTSPACEE}}
17857 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
17858 !! html
17859 <ul><li> Parser test</li>
17860 <li> Parser_test</li>
17861 <li> Parser test</li>
17862 <li> Parser_test</li>
17863 <li> Parser test</li>
17864 <li> Parser_test</li>
17865 <li> Parser test</li>
17866 <li> Parser_test</li>
17867 <li> Parser test</li>
17868 <li> Parser_test</li>
17869 <li> Talk:Parser test</li>
17870 <li> Talk:Parser_test</li>
17871 <li> Parser test</li>
17872 <li> Parser_test</li>
17873 <li> </li>
17874 <li> </li>
17875 <li> 0</li>
17876 <li> Talk</li>
17877 <li> Talk</li>
17878 <li> </li>
17879 <li> </li>
17880 <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>
17881
17882 !! end
17883 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
17884
17885 !! test
17886 Gallery
17887 !! wikitext
17888 <gallery>
17889 image1.png |
17890 image2.gif|||||
17891
17892 image3|
17893 image4 |300px| centre
17894 image5.svg| http://///////
17895 [[x|xx]]]]
17896 * image6
17897 </gallery>
17898 !! html
17899 <ul class="gallery mw-gallery-traditional">
17900 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17901 <div class="thumb" style="height: 150px;">Image1.png</div>
17902 <div class="gallerytext">
17903 </div>
17904 </div></li>
17905 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17906 <div class="thumb" style="height: 150px;">Image2.gif</div>
17907 <div class="gallerytext">
17908 <p>||||
17909 </p>
17910 </div>
17911 </div></li>
17912 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17913 <div class="thumb" style="height: 150px;">Image3</div>
17914 <div class="gallerytext">
17915 </div>
17916 </div></li>
17917 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17918 <div class="thumb" style="height: 150px;">Image4</div>
17919 <div class="gallerytext">
17920 <p>300px| centre
17921 </p>
17922 </div>
17923 </div></li>
17924 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17925 <div class="thumb" style="height: 150px;">Image5.svg</div>
17926 <div class="gallerytext">
17927 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
17928 </p>
17929 </div>
17930 </div></li>
17931 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17932 <div class="thumb" style="height: 150px;">* image6</div>
17933 <div class="gallerytext">
17934 </div>
17935 </div></li>
17936 </ul>
17937
17938 !! end
17939
17940 !! test
17941 Gallery (with options)
17942 !! wikitext
17943 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
17944 File:Nonexistent.jpg|caption
17945 File:Nonexistent.jpg
17946 image:foobar.jpg|some '''caption''' [[Main Page]]
17947 image:foobar.jpg
17948 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
17949 </gallery>
17950 !! html
17951 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
17952 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
17953 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17954 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
17955 <div class="gallerytext">
17956 <p>caption
17957 </p>
17958 </div>
17959 </div></li>
17960 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17961 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
17962 <div class="gallerytext">
17963 </div>
17964 </div></li>
17965 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17966 <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>
17967 <div class="gallerytext">
17968 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
17969 </p>
17970 </div>
17971 </div></li>
17972 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17973 <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>
17974 <div class="gallerytext">
17975 </div>
17976 </div></li>
17977 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
17978 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="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>
17979 <div class="gallerytext">
17980 <p>Blabla|blabla.
17981 </p>
17982 </div>
17983 </div></li>
17984 </ul>
17985
17986 !! end
17987
17988 !! test
17989 Gallery with link that has fragment
17990 !! wikitext
17991 <gallery>
17992 image:foobar.jpg|link=Main_Page
17993 image:foobar.jpg|link=Main_Page#section
17994 image:foobar.jpg|link=Main Page#section|caption
17995 </gallery>
17996 !! html
17997 <ul class="gallery mw-gallery-traditional">
17998 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
17999 <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>
18000 <div class="gallerytext">
18001 </div>
18002 </div></li>
18003 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18004 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/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>
18005 <div class="gallerytext">
18006 </div>
18007 </div></li>
18008 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18009 <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>
18010 <div class="gallerytext">
18011 <p>caption
18012 </p>
18013 </div>
18014 </div></li>
18015 </ul>
18016
18017 !! end
18018
18019 !! test
18020 Gallery with wikitext inside caption
18021 !! wikitext
18022 <gallery>
18023 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
18024 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
18025 </gallery>
18026 !! html
18027 <ul class="gallery mw-gallery-traditional">
18028 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18029 <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>
18030 <div class="gallerytext">
18031 <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>
18032 </p>
18033 </div>
18034 </div></li>
18035 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18036 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="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>
18037 <div class="gallerytext">
18038 <p>This is a test template
18039 </p>
18040 </div>
18041 </div></li>
18042 </ul>
18043
18044 !! end
18045
18046 !! test
18047 gallery (with showfilename option)
18048 !! wikitext
18049 <gallery showfilename>
18050 File:Nonexistent.jpg|caption
18051 File:Nonexistent.jpg
18052 image:foobar.jpg|some '''caption''' [[Main Page]]
18053 File:Foobar.jpg
18054 </gallery>
18055 !! html
18056 <ul class="gallery mw-gallery-traditional">
18057 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18058 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18059 <div class="gallerytext">
18060 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18061 caption
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;">Nonexistent.jpg</div>
18067 <div class="gallerytext">
18068 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18069 </p>
18070 </div>
18071 </div></li>
18072 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18073 <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>
18074 <div class="gallerytext">
18075 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18076 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18077 </p>
18078 </div>
18079 </div></li>
18080 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18081 <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>
18082 <div class="gallerytext">
18083 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18084 </p>
18085 </div>
18086 </div></li>
18087 </ul>
18088
18089 !! end
18090
18091 !! test
18092 Gallery (with namespace-less filenames)
18093 !! wikitext
18094 <gallery>
18095 File:Nonexistent.jpg
18096 Nonexistent.jpg
18097 image:foobar.jpg
18098 foobar.jpg
18099 </gallery>
18100 !! html
18101 <ul class="gallery mw-gallery-traditional">
18102 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18103 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18104 <div class="gallerytext">
18105 </div>
18106 </div></li>
18107 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18108 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18109 <div class="gallerytext">
18110 </div>
18111 </div></li>
18112 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18113 <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>
18114 <div class="gallerytext">
18115 </div>
18116 </div></li>
18117 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18118 <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>
18119 <div class="gallerytext">
18120 </div>
18121 </div></li>
18122 </ul>
18123
18124 !! end
18125
18126 !! test
18127 HTML Hex character encoding (spells the word "JavaScript")
18128 !! options
18129 parsoid=wt2html,wt2wt,html2html
18130 !! wikitext
18131 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
18132 !! html/php
18133 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
18134 </p>
18135 !! html/php+tidy
18136 <p>JavaScript</p>
18137 !! html/parsoid
18138 <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>
18139 !! end
18140
18141 !! test
18142 HTML Hex character encoding bogus encoding (bug 26437 regression check)
18143 !! wikitext
18144 &#xsee;&#XSEE;
18145 !! html/php
18146 <p>&amp;#xsee;&amp;#XSEE;
18147 </p>
18148 !! html/parsoid
18149 <p>&amp;#xsee;&amp;#XSEE;</p>
18150 !! end
18151
18152 !! test
18153 HTML Hex character encoding mixed case
18154 !! options
18155 parsoid=wt2html,wt2wt,html2html
18156 !! wikitext
18157 &#xEE;&#Xee;
18158 !! html/php
18159 <p>&#xee;&#xee;
18160 </p>
18161 !! html/php+tidy
18162 <p>îî</p>
18163 !! html/parsoid
18164 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
18165 !! end
18166
18167 # See: http://www.w3.org/TR/html5/syntax.html#character-references
18168 # Note that U+000C (form feed) is not a valid XML character, so
18169 # it is banned even though allowed in HTML5.
18170 !! test
18171 Illegal character references (T106578)
18172 !! wikitext
18173 ; Null: &#00;
18174 ; FF: &#xC;
18175 ; CR: &#xD;
18176 ; Control (low): &#8;
18177 ; Control (high): &#x7F; &#x9F;
18178 ; Surrogate: &#xD83D;&#xDCA9;
18179 ; This is an okay astral character: &#x1F4A9;
18180 !! html+tidy
18181 <dl>
18182 <dt>Null</dt>
18183 <dd>&amp;#00;</dd>
18184 <dt>FF</dt>
18185 <dd>&amp;#xC;</dd>
18186 <dt>CR</dt>
18187 <dd>&amp;#xD;</dd>
18188 <dt>Control (low)</dt>
18189 <dd>&amp;#8;</dd>
18190 <dt>Control (high)</dt>
18191 <dd>&amp;#x7F; &amp;#x9F;</dd>
18192 <dt>Surrogate</dt>
18193 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
18194 <dt>This is an okay astral character</dt>
18195 <dd>💩</dd>
18196 </dl>
18197 !! end
18198
18199 !! test
18200 __FORCETOC__ override
18201 !! wikitext
18202 __NEWSECTIONLINK__
18203 __FORCETOC__
18204 !! html/php
18205 <p><br />
18206 </p>
18207 !! end
18208
18209 !! test
18210 ISBN code coverage
18211 !! wikitext
18212 ISBN 978-0-1234-56&#x20;789
18213 !! html
18214 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
18215 </p>
18216 !! html+tidy
18217 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
18218 !! html/parsoid
18219 <p><a href="./Special:BookSources/9780123456" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978-0-1234-56</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x20;","srcContent":" "}'> </span>789</p>
18220 !! end
18221
18222 !! test
18223 ISBN followed by 5 spaces
18224 !! wikitext
18225 ISBN
18226 !! html
18227 <p>ISBN
18228 </p>
18229 !! end
18230
18231 !! test
18232 Double ISBN
18233 !! wikitext
18234 ISBN ISBN 1234567890
18235 !! html/php
18236 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18237 </p>
18238 !! html/parsoid
18239 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
18240 !! end
18241
18242 # Uppercase X and lowercase x as well
18243 !! test
18244 ISBN with an X
18245 !! wikitext
18246 ISBN 3-462-04561-X
18247 ISBN 3-462-04561-x
18248 ISBN 080442957X
18249 ISBN 080442957x
18250 ISBN 978080442957X
18251 ISBN 978080442957x
18252 !! html/php
18253 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
18254 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
18255 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
18256 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
18257 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
18258 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
18259 </p>
18260 !! html/parsoid
18261 <p><a href="./Special:BookSources/346204561X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
18262 <a href="./Special:BookSources/346204561X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
18263 <a href="./Special:BookSources/080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
18264 <a href="./Special:BookSources/080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
18265 <a href="./Special:BookSources/978080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
18266 <a href="./Special:BookSources/978080442957X" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
18267 !! end
18268
18269 !! test
18270 ISBN with empty prefix (parsoid test)
18271 !! wikitext
18272 ISBN 1234567890
18273 !! html/php
18274 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18275 </p>
18276 !! html/parsoid
18277 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567890</a></p>
18278 !! end
18279
18280 !! test
18281 Bug 22905: <abbr> followed by ISBN followed by </a>
18282 !! wikitext
18283 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
18284 !! html/php
18285 <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>
18286 </p>
18287 !! html/parsoid
18288 <p><abbr data-parsoid='{"stx":"html"}'>(fr)</abbr> <a href="./Special:BookSources/2753300917" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 2753300917</a> <a rel="mw:ExtLink" href="http://www.example.com">example.com</a></p>
18289 !! end
18290
18291 !! test
18292 Double RFC
18293 !! wikitext
18294 RFC RFC 1234
18295 !! html
18296 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
18297 </p>
18298 !! end
18299
18300 !! test
18301 Double RFC with a wiki link
18302 !! wikitext
18303 RFC [[RFC 1234]]
18304 !! html
18305 <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>
18306 </p>
18307 !! end
18308
18309 !! test
18310 RFC code coverage
18311 !! wikitext
18312 RFC 983&#x20;987
18313 !! html
18314 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
18315 </p>
18316 !! html+tidy
18317 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
18318 !! end
18319
18320 !! test
18321 Centre-aligned image
18322 !! wikitext
18323 [[Image:foobar.jpg|centre]]
18324 !! html
18325 <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>
18326
18327 !!end
18328
18329 !! test
18330 None-aligned image
18331 !! wikitext
18332 [[Image:foobar.jpg|none]]
18333 !! html
18334 <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>
18335
18336 !!end
18337
18338 !! test
18339 Width + Height sized image (using px) (height is ignored)
18340 !! wikitext
18341 [[Image:foobar.jpg|640x480px]]
18342 !! html
18343 <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>
18344 </p>
18345 !!end
18346
18347 !! test
18348 Width-sized image (using px, no following whitespace)
18349 !! wikitext
18350 [[Image:foobar.jpg|640px]]
18351 !! html
18352 <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>
18353 </p>
18354 !!end
18355
18356 !! test
18357 Width-sized image (using px, with following whitespace - test regression from r39467)
18358 !! wikitext
18359 [[Image:foobar.jpg|640px ]]
18360 !! html
18361 <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>
18362 </p>
18363 !!end
18364
18365 !! test
18366 Width-sized image (using px, with preceding whitespace - test regression from r39467)
18367 !! wikitext
18368 [[Image:foobar.jpg| 640px]]
18369 !! html
18370 <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>
18371 </p>
18372 !!end
18373
18374 !! test
18375 Image with page parameter
18376 !! options
18377 djvu
18378 !! wikitext
18379 [[File:LoremIpsum.djvu|page=2]]
18380 !! html/php
18381 <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>
18382 </p>
18383 !! html/parsoid
18384 <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>
18385 !! end
18386
18387 !! test
18388 Another italics / bold test
18389 !! wikitext
18390 ''' ''x'
18391 !! html
18392 <pre>'<i> </i>x'
18393 </pre>
18394 !!end
18395
18396 # FIXME: The php output seems broken. It's interleaving some open/close tags.
18397 !! test
18398 dt/dd/dl test
18399 !! wikitext
18400 :;;;::
18401 !! html/php
18402 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
18403
18404 !! html/parsoid
18405 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
18406
18407 !!end
18408
18409
18410 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
18411 !! test
18412 Images with the "|" character in the comment
18413 !! wikitext
18414 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
18415 !! html/php
18416 <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>
18417
18418 !! html/parsoid
18419 <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>
18420 !! end
18421
18422 !! test
18423 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
18424 !! wikitext
18425 <html><script>alert(1);</script></html>
18426 !! html
18427 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
18428 </p>
18429 !! end
18430
18431 !! test
18432 HTML with raw HTML ($wgRawHtml==true)
18433 !! options
18434 wgRawHtml=1
18435 !! wikitext
18436 <html><script>alert(1);</script></html>
18437 !! html
18438 <p><script>alert(1);</script>
18439 </p>
18440 !! end
18441
18442 !! test
18443 Parents of subpages, one level up
18444 !! options
18445 subpage title=[[Subpage test/L1/L2/L3]]
18446 !! wikitext
18447 [[../|L2]]
18448 !! html
18449 <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>
18450 </p>
18451 !! end
18452
18453
18454 !! test
18455 Parents of subpages, one level up, not named
18456 !! options
18457 subpage title=[[Subpage test/L1/L2/L3]]
18458 !! wikitext
18459 [[../]]
18460 !! html
18461 <p><a href="/index.php?title=Subpage_test/L1/L2&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1/L2 (page does not exist)">Subpage test/L1/L2</a>
18462 </p>
18463 !! end
18464
18465
18466
18467 !! test
18468 Parents of subpages, two levels up
18469 !! options
18470 subpage title=[[Subpage test/L1/L2/L3]]
18471 !! wikitext
18472 [[../../|L1]]2
18473
18474 [[../../|L1]]l
18475 !! html
18476 <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
18477 </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>
18478 </p>
18479 !! end
18480
18481 !! test
18482 Parents of subpages, two levels up, without trailing slash or name.
18483 !! options
18484 subpage title=[[Subpage test/L1/L2/L3]]
18485 !! wikitext
18486 [[../..]]
18487 !! html
18488 <p>[[../..]]
18489 </p>
18490 !! end
18491
18492 !! test
18493 Parents of subpages, two levels up, with lots of extra trailing slashes.
18494 !! options
18495 subpage title=[[Subpage test/L1/L2/L3]]
18496 !! wikitext
18497 [[../../////]]
18498 !! html
18499 <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>
18500 </p>
18501 !! end
18502
18503 !! article
18504 Subpage test/L1/L2/L3Sibling
18505 !! text
18506 Sibling article
18507 !! endarticle
18508
18509 !! test
18510 Transclusion of a sibling page (one level up)
18511 !! options
18512 subpage title=[[Subpage test/L1/L2/L3]]
18513 !! wikitext
18514 {{../L3Sibling}}
18515 !! html
18516 <p>Sibling article
18517 </p>
18518 !! end
18519
18520 !! test
18521 Transclusion of a child page
18522 !! options
18523 subpage title=[[Subpage test/L1/L2]]
18524 !! wikitext
18525 {{/L3Sibling}}
18526 !! html
18527 <p>Sibling article
18528 </p>
18529 !! end
18530
18531 !! test
18532 Non-transclusion because of too many up levels
18533 !! options
18534 subpage title=[[Subpage test/L1/L2/L3]]
18535 !! wikitext
18536 {{../../../../More than parent}}
18537 !! html
18538 <p>{{../../../../More than parent}}
18539 </p>
18540 !! end
18541
18542 !! test
18543 Definition list code coverage
18544 !! wikitext
18545 ; title : def
18546 ; title : def
18547 ;title: def
18548 !! html/php
18549 <dl><dt> title &#160;</dt>
18550 <dd> def</dd>
18551 <dt> title&#160;</dt>
18552 <dd> def</dd>
18553 <dt>title</dt>
18554 <dd> def</dd></dl>
18555
18556 !! html/parsoid
18557 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18558 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18559 <dt>title</dt><dd> def</dd></dl>
18560 !! end
18561
18562 !! test
18563 Don't fall for the self-closing div
18564 !! wikitext
18565 <div>hello world</div/>
18566 !! html
18567 <div>hello world</div>
18568
18569 !! end
18570
18571 !! test
18572 MSGNW magic word
18573 !! wikitext
18574 {{MSGNW:msg}}
18575 !! html/php
18576 <p>&#91;&#91;:Template:Msg&#93;&#93;
18577 </p>
18578 !! end
18579
18580 !! test
18581 RAW magic word
18582 !! wikitext
18583 {{RAW:QUERTY}}
18584 !! html
18585 <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>
18586 </p>
18587 !! end
18588
18589 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
18590 !! test
18591 Always escape literal '>' in output, not just after '<'
18592 !! wikitext
18593 ><>
18594 !! html
18595 <p>&gt;&lt;&gt;
18596 </p>
18597 !! end
18598
18599 !! test
18600 Template caching
18601 !! wikitext
18602 {{Test}}
18603 {{Test}}
18604 !! html
18605 <p>This is a test template
18606 This is a test template
18607 </p>
18608 !! end
18609
18610
18611 !! article
18612 MediaWiki:Fake
18613 !! text
18614 ==header==
18615 !! endarticle
18616
18617 !! test
18618 Inclusion of !userCanEdit() content
18619 !! wikitext
18620 {{MediaWiki:Fake}}
18621 !! html
18622 <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>
18623
18624 !! end
18625
18626
18627 !! test
18628 Out-of-order TOC heading levels
18629 !! wikitext
18630 ==2==
18631 ======6======
18632 ===3===
18633 =1=
18634 =====5=====
18635 ==2==
18636 !! html
18637 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
18638 <ul>
18639 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
18640 <ul>
18641 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
18642 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
18643 </ul>
18644 </li>
18645 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
18646 <ul>
18647 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
18648 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
18649 </ul>
18650 </li>
18651 </ul>
18652 </div>
18653
18654 <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>
18655 <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>
18656 <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>
18657 <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>
18658 <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>
18659 <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>
18660
18661 !! end
18662
18663
18664 !! test
18665 ISBN with a dummy number
18666 !! wikitext
18667 ISBN ---
18668 !! html
18669 <p>ISBN ---
18670 </p>
18671 !! end
18672
18673
18674 !! test
18675 ISBN with space-delimited number
18676 !! wikitext
18677 ISBN 92 9017 032 8
18678 !! html
18679 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
18680 </p>
18681 !! end
18682
18683
18684 !! test
18685 ISBN with multiple spaces, no number
18686 !! wikitext
18687 ISBN foo
18688 !! html
18689 <p>ISBN foo
18690 </p>
18691 !! end
18692
18693
18694 !! test
18695 ISBN length
18696 !! wikitext
18697 ISBN 123456789
18698
18699 ISBN 1234567890
18700
18701 ISBN 12345678901
18702 !! html
18703 <p>ISBN 123456789
18704 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18705 </p><p>ISBN 12345678901
18706 </p>
18707 !! end
18708
18709
18710 !! test
18711 ISBN with trailing year (bug 8110)
18712 !! wikitext
18713 ISBN 1-234-56789-0 - 2006
18714
18715 ISBN 1 234 56789 0 - 2006
18716 !! html
18717 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
18718 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
18719 </p>
18720 !! end
18721
18722
18723 !! test
18724 anchorencode
18725 !! wikitext
18726 {{anchorencode:foo bar©#%n}}
18727 !! html
18728 <p>foo_bar.C2.A9.23.25n
18729 </p>
18730 !! end
18731
18732 !! test
18733 anchorencode trims spaces
18734 !! wikitext
18735 {{anchorencode: __pretty__please__}}
18736 !! html
18737 <p>pretty_please
18738 </p>
18739 !! end
18740
18741 !! test
18742 anchorencode deals with links
18743 !! wikitext
18744 {{anchorencode: [[hello|world]] [[hi]]}}
18745 !! html
18746 <p>world_hi
18747 </p>
18748 !! end
18749
18750 !! test
18751 anchorencode deals with templates
18752 !! wikitext
18753 {{anchorencode: {{Foo}} }}
18754 !! html
18755 <p>FOO
18756 </p>
18757 !! end
18758
18759 !! test
18760 anchorencode encodes like the TOC generator: (bug 18431)
18761 !! wikitext
18762 === _ +:.3A%3A&&amp;]] ===
18763 {{anchorencode: _ +:.3A%3A&&amp;]] }}
18764 __NOEDITSECTION__
18765 !! html
18766 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
18767 <p>.2B:.3A.253A.26.26.5D.5D
18768 </p>
18769 !! end
18770
18771 !! test
18772 Bug 6200: blockquotes and paragraph formatting
18773 !! wikitext
18774 <blockquote>
18775 foo
18776 </blockquote>
18777
18778 bar
18779
18780 baz
18781 !! html
18782 <blockquote>
18783 <p>foo
18784 </p>
18785 </blockquote>
18786 <p>bar
18787 </p>
18788 <pre>baz
18789 </pre>
18790 !! end
18791
18792 !! test
18793 Bug 8293: Use of center tag ruins paragraph formatting
18794 !! wikitext
18795 <center>
18796 foo
18797 </center>
18798
18799 bar
18800
18801 baz
18802 !! html
18803 <center>
18804 <p>foo
18805 </p>
18806 </center>
18807 <p>bar
18808 </p>
18809 <pre>baz
18810 </pre>
18811 !! end
18812
18813 !!test
18814 Parsing of overlapping (improperly nested) inline html tags
18815 !! wikitext
18816 <span><s>x</span></s>
18817 !! html/php
18818 <p><span><s>x&lt;/span&gt;</s></span>
18819 </p>
18820 !! html/parsoid
18821 <p><span><s>x</s></span>
18822 </p>
18823 !!end
18824
18825 ###
18826 ### Language variants related tests
18827 ###
18828 !! test
18829 Self-link in language variants
18830 !! options
18831 title=[[Dunav]] language=sr
18832 !! wikitext
18833 Both [[Dunav]] and [[Дунав]] are names for this river.
18834 !! html
18835 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
18836 </p>
18837 !!end
18838
18839 !! article
18840 Дуна
18841 !! text
18842 content
18843 !! endarticle
18844
18845 !! test
18846 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
18847 !! options
18848 title=[[Duna]] language=sr
18849 !! wikitext
18850 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
18851 !! html
18852 <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.
18853 </p>
18854 !! end
18855
18856 !! test
18857 Link to a section of a variant of this title shouldn't be parsed as self-link
18858 !! options
18859 title=[[Duna]] language=sr
18860 !! wikitext
18861 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
18862 !! html
18863 <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.
18864 </p>
18865 !! end
18866
18867 !! test
18868 Link to pages in language variants
18869 !! options
18870 language=sr
18871 !! wikitext
18872 Main Page can be written as [[Маин Паге]]
18873 !! html
18874 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
18875 </p>
18876 !!end
18877
18878
18879 !! test
18880 Multiple links to pages in language variants
18881 !! options
18882 language=sr
18883 !! wikitext
18884 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
18885 !! html
18886 <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>.
18887 </p>
18888 !!end
18889
18890
18891 !! test
18892 Simple template in language variants
18893 !! options
18894 language=sr
18895 !! wikitext
18896 {{тест}}
18897 !! html
18898 <p>This is a test template
18899 </p>
18900 !! end
18901
18902
18903 !! test
18904 Template with explicit namespace in language variants
18905 !! options
18906 language=sr
18907 !! wikitext
18908 {{Template:тест}}
18909 !! html
18910 <p>This is a test template
18911 </p>
18912 !! end
18913
18914
18915 !! test
18916 Basic test for template parameter in language variants
18917 !! options
18918 language=sr
18919 !! wikitext
18920 {{парамтест|param=foo}}
18921 !! html
18922 <p>This is a test template with parameter foo
18923 </p>
18924 !! end
18925
18926
18927 !! test
18928 Simple category in language variants
18929 !! options
18930 language=sr cat
18931 !! wikitext
18932 [[Category:МедиаWики Усер'с Гуиде]]
18933 !! html
18934 <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>
18935 !! end
18936
18937
18938 !! article
18939 Category:分类
18940 !! text
18941 blah
18942 !! endarticle
18943
18944 !! article
18945 Category:分類
18946 !! text
18947 blah
18948 !! endarticle
18949
18950 !! test
18951 Don't convert blue categorylinks to another variant (bug 33210)
18952 !! options
18953 language=zh cat
18954 !! wikitext
18955 [[A]][[Category:分类]]
18956 !! html
18957 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
18958 !! end
18959
18960
18961 !! test
18962 Stripping -{}- tags (language variants)
18963 !! options
18964 language=sr
18965 !! wikitext
18966 Latin proverb: -{Ne nuntium necare}-
18967 !! html
18968 <p>Latin proverb: Ne nuntium necare
18969 </p>
18970 !! end
18971
18972
18973 !! test
18974 Prevent conversion with -{}- tags (language variants)
18975 !! options
18976 language=sr variant=sr-ec
18977 !! wikitext
18978 Latinski: -{Ne nuntium necare}-
18979 !! html
18980 <p>Латински: Ne nuntium necare
18981 </p>
18982 !! end
18983
18984
18985 !! test
18986 Prevent conversion of text with -{}- tags (language variants)
18987 !! options
18988 language=sr variant=sr-ec
18989 !! wikitext
18990 Latinski: -{Ne nuntium necare}-
18991 !! html
18992 <p>Латински: Ne nuntium necare
18993 </p>
18994 !! end
18995
18996
18997 !! test
18998 Prevent conversion of links with -{}- tags (language variants)
18999 !! options
19000 language=sr variant=sr-ec
19001 !! wikitext
19002 -{[[Main Page]]}-
19003 !! html
19004 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19005 </p>
19006 !! end
19007
19008
19009 !! test
19010 -{}- tags within headlines (within html for parserConvert())
19011 !! options
19012 language=sr variant=sr-ec
19013 !! wikitext
19014 == -{Naslov}- ==
19015 !! html
19016 <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>
19017
19018 !! end
19019
19020
19021 !! test
19022 Explicit definition of language variant alternatives
19023 !! options
19024 language=zh variant=zh-tw
19025 !! wikitext
19026 -{zh:China;zh-tw:Taiwan}-, not China
19027 !! html
19028 <p>Taiwan, not China
19029 </p>
19030 !! end
19031
19032
19033 !! test
19034 Conversion around HTML tags
19035 !! options
19036 language=sr variant=sr-ec
19037 !! wikitext
19038 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
19039 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
19040 !! html
19041 <p>
19042 <span title="ЛаCтин">ски</span>
19043 </p>
19044 !! end
19045
19046
19047 !! test
19048 Explicit session-wise language variant mapping (A flag and - flag)
19049 !! options
19050 language=zh variant=zh-tw
19051 !! wikitext
19052 Taiwan is not China.
19053 But -{A|zh:China;zh-tw:Taiwan}- is China,
19054 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
19055 and -{China}- is China.
19056 !! html
19057 <p>Taiwan is not China.
19058 But Taiwan is Taiwan,
19059 (This should be stripped!)
19060 and China is China.
19061 </p>
19062 !! end
19063
19064 !! test
19065 Explicit session-wise language variant mapping (H flag for hide)
19066 !! options
19067 language=zh variant=zh-tw
19068 !! wikitext
19069 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
19070 Taiwan is China.
19071 !! html
19072 <p>(This should be stripped!)
19073 Taiwan is Taiwan.
19074 </p>
19075 !! end
19076
19077 !! test
19078 Adding explicit conversion rule for title (T flag)
19079 !! options
19080 language=zh variant=zh-tw showtitle
19081 !! wikitext
19082 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19083 !! html
19084 Taiwan
19085 <p>Should be stripped!
19086 </p>
19087 !! end
19088
19089 !! test
19090 Testing that changing the language variant here in the tests actually works
19091 !! options
19092 language=zh variant=zh showtitle
19093 !! wikitext
19094 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19095 !! html
19096 China
19097 <p>Should be stripped!
19098 </p>
19099 !! end
19100
19101 !! test
19102 Recursive conversion of alt and title attrs shouldn't clear converter state
19103 !! options
19104 language=zh variant=zh-cn showtitle
19105 !! wikitext
19106 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
19107 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
19108 !! html
19109 China
19110 <p>
19111 Should be stripped<span title="Exclamation">!</span>
19112 </p>
19113 !! end
19114
19115 !! test
19116 Bug 24072: more test on conversion rule for title
19117 !! options
19118 language=zh variant=zh-tw showtitle
19119 !! wikitext
19120 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19121 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
19122 !! html
19123 Taiwan
19124 <p>This should be stripped!
19125 This won't take interferes with the title rule.
19126 </p>
19127 !! end
19128
19129 !! test
19130 Partly disable title conversion if variant == main language code
19131 !! options
19132 language=zh variant=zh title=[[ZH]] showtitle
19133 !! wikitext
19134 -{T|zh-cn:CN;zh-tw:TW}-
19135 !! html
19136 ZH
19137 <p>
19138 </p>
19139 !! end
19140
19141 !! test
19142 Partly disable title conversion if variant == main language code, more
19143 !! options
19144 language=zh variant=zh title=[[ZH]] showtitle
19145 !! wikitext
19146 -{T|TW}-
19147 !! html
19148 ZH
19149 <p>
19150 </p>
19151 !! end
19152
19153 !! test
19154 Raw output of variant escape tags (R flag)
19155 !! options
19156 language=zh variant=zh-tw
19157 !! wikitext
19158 Raw: -{R|zh:China;zh-tw:Taiwan}-
19159 !! html
19160 <p>Raw: zh:China;zh-tw:Taiwan
19161 </p>
19162 !! end
19163
19164 !! test
19165 Strings evaluating false shouldn't be ignored by Language converter (T51072)
19166 !! options
19167 language=zh variant=zh-cn
19168 !! input
19169 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
19170 !! result
19171 <p>0
19172 </p>
19173 !! end
19174
19175 !! test
19176 Conversion rules from [numeric-only string] to [something else] (T48634)
19177 !! options
19178 language=zh variant=zh-cn
19179 !! input
19180 -{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
19181 !! result
19182 <p>D12345EE12345
19183 </p>
19184 !! end
19185
19186 !! test
19187 Bidirectional converter rule entries with an empty value should be ignored (T53551)
19188 !! options
19189 language=zh variant=zh-cn
19190 !! input
19191 -{H|zh-cn:foo;zh-tw:;}-foobar
19192 !! result
19193 <p>foobar
19194 </p>
19195 !! end
19196
19197 !! test
19198 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
19199 !! options
19200 language=zh variant=zh-cn
19201 !! input
19202 -{H|=>zh-cn:foo;}-foobar
19203 !! result
19204 <p>foobar
19205 </p>
19206 !! end
19207
19208 !! test
19209 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
19210 !! options
19211 language=zh variant=zh-cn
19212 !! input
19213 -{H|}-foobar
19214 !! result
19215 <p>foobar
19216 </p>
19217 !! end
19218
19219 !! test
19220 Nested using of manual convert syntax
19221 !! options
19222 language=zh variant=zh-hk
19223 !! wikitext
19224 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
19225 !! html
19226 <p>Nested: Hello Hong Kong!
19227 </p>
19228 !! end
19229
19230 !! test
19231 Proper conversion of text in external links
19232 !! options
19233 language=sr variant=sr-ec
19234 !! wikitext
19235 http://www.google.com
19236 gopher://www.google.com
19237 [http://www.google.com http://www.google.com]
19238 [gopher://www.google.com gopher://www.google.com]
19239 [https://www.google.com irc://www.google.com]
19240 [ftp://www.google.com www.google.com/ftp://dir]
19241 [//www.google.com www.google.com]
19242 !! html
19243 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19244 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19245 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19246 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19247 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
19248 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
19249 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
19250 </p>
19251 !! end
19252
19253 !! test
19254 Do not convert roman numbers to language variants
19255 !! options
19256 language=sr variant=sr-ec
19257 !! wikitext
19258 Fridrih IV je car.
19259 !! html
19260 <p>Фридрих IV је цар.
19261 </p>
19262 !! end
19263
19264 !! test
19265 Unclosed language converter markup "-{"
19266 !! options
19267 language=sr
19268 !! wikitext
19269 -{T|hello
19270 !! html
19271 <p>-{T|hello
19272 </p>
19273 !! end
19274
19275 !! test
19276 Don't convert raw rule "-{R|=&gt;}-" to "=>"
19277 !! options
19278 language=sr
19279 !! wikitext
19280 -{R|=&gt;}-
19281 !! html
19282 <p>=&gt;
19283 </p>
19284 !!end
19285
19286 !! test
19287 Don't break link parsing if language converter markup is in the caption.
19288 !! options
19289 language=sr variant=sr-ec
19290 !! wikitext
19291 [[Main Page|-{R|main page}-]]
19292 !! html
19293 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
19294 </p>
19295 !! end
19296
19297 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19298 !! test
19299 Don't break image parsing if language converter markup is in the caption.
19300 !! options
19301 language=sr
19302 !! wikitext
19303 [[File:Foobar.jpg|-{R|caption}-]]
19304 !! html/parsoid
19305 <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>
19306 </p>
19307 !! end
19308
19309 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19310 !! test
19311 Don't break list handling if language converter markup is in the item.
19312 !! options
19313 language=zh variant=zh-cn
19314 !! wikitext
19315 ;-{zh-cn:AAA;zh-tw:BBB}-
19316 !! html/php
19317 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
19318
19319 !! html/parsoid
19320 <dl><dt>AAA
19321 </dt></dl>
19322 !! end
19323
19324 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19325 !! test
19326 Don't break table handling if language converter markup is in the cell.
19327 !! options
19328 language=sr variant=sr-ec
19329 !! wikitext
19330 {|
19331 |-
19332 | -{R|B}-
19333 |}
19334 !! html/php
19335 <table>
19336
19337 <tr>
19338 <td>Б}-
19339 </td></tr></table>
19340
19341 !! html/parsoid
19342 <table>
19343
19344 <tr>
19345 <td> B
19346 </td></tr></table>
19347
19348 !! end
19349
19350 !! test
19351 Bug 529: Uncovered bullet
19352 !! wikitext
19353 * Foo {{bullet}}
19354 !! html
19355 <ul><li> Foo </li>
19356 <li> Bar</li></ul>
19357
19358 !! end
19359
19360 # Plain MediaWiki does not remove empty lists, but tidy actually does.
19361 # Templates in Wikipedia rely on this behavior, as tidy has always been
19362 # enabled there. These tests are normally run *without* tidy, so specify the
19363 # full output here.
19364 # To test realistic parsing behavior, apply a tidy-like transformation to both
19365 # the expected output and your parser's output.
19366 !! test
19367 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
19368 !! wikitext
19369 ******* Foo {{bullet}}
19370 !! html
19371 <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>
19372 <li> Bar</li></ul>
19373
19374 !! end
19375
19376 !! test
19377 Bug 529: Uncovered table already at line-start
19378 !! wikitext
19379 x
19380
19381 {{table}}
19382 y
19383 !! html
19384 <p>x
19385 </p>
19386 <table>
19387 <tr>
19388 <td> 1 </td>
19389 <td> 2
19390 </td></tr>
19391 <tr>
19392 <td> 3 </td>
19393 <td> 4
19394 </td></tr></table>
19395 <p>y
19396 </p>
19397 !! end
19398
19399 !! test
19400 Bug 529: Uncovered bullet in parser function result
19401 !! wikitext
19402 * Foo {{lc:{{bullet}} }}
19403 !! html
19404 <ul><li> Foo </li>
19405 <li> bar</li></ul>
19406
19407 !! end
19408
19409 !! test
19410 Bug 5678: Double-parsed template argument
19411 !! wikitext
19412 {{lc:{{{1}}}|hello}}
19413 !! html
19414 <p>{{{1}}}
19415 </p>
19416 !! end
19417
19418 !! test
19419 Bug 5678: Double-parsed template invocation
19420 !! wikitext
19421 {{lc:{{paramtest {{!}} param = hello }} }}
19422 !! html
19423 <p>{{paramtest | param = hello }}
19424 </p>
19425 !! end
19426
19427 !! test
19428 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
19429 !! options
19430 language=cs
19431 title=[[Main Page]]
19432 !! wikitext
19433 {{PRVNÍVELKÉ:ěščř}}
19434 {{prvnívelké:ěščř}}
19435 {{PRVNÍMALÉ:ěščř}}
19436 {{prvnímalé:ěščř}}
19437 {{MALÁ:ěščř}}
19438 {{malá:ěščř}}
19439 {{VELKÁ:ěščř}}
19440 {{velká:ěščř}}
19441 !! html
19442 <p>Ěščř
19443 Ěščř
19444 ěščř
19445 ěščř
19446 ěščř
19447 ěščř
19448 ĚŠČŘ
19449 ĚŠČŘ
19450 </p>
19451 !! end
19452
19453 !! test
19454 Morwen/13: Unclosed link followed by heading
19455 !! wikitext
19456 [[link
19457 ==heading==
19458 !! html
19459 <p>[[link
19460 </p>
19461 <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>
19462
19463 !! end
19464
19465 !! test
19466 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
19467 !! wikitext
19468 {{foo|
19469 =heading=
19470 !! html
19471 <p>{{foo|
19472 </p>
19473 <h1><span class="mw-headline" id="heading">heading</span></h1>
19474
19475 !! end
19476
19477 !! test
19478 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
19479 !! wikitext
19480 {{foo|
19481 ==heading==
19482 !! html
19483 <p>{{foo|
19484 </p>
19485 <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>
19486
19487 !! end
19488
19489 !! test
19490 Tildes in comments
19491 !! options
19492 pst
19493 !! wikitext
19494 <!-- ~~~~ -->
19495 !! html
19496 <!-- ~~~~ -->
19497 !! end
19498
19499 !! test
19500 Paragraphs inside divs (no extra line breaks)
19501 !! wikitext
19502 <div>Line one
19503
19504 Line two</div>
19505 !! html
19506 <div>Line one
19507 Line two</div>
19508
19509 !! end
19510
19511 !! test
19512 Paragraphs inside divs (extra line break on open)
19513 !! wikitext
19514 <div>
19515 Line one
19516
19517 Line two</div>
19518 !! html
19519 <div>
19520 <p>Line one
19521 </p>
19522 Line two</div>
19523
19524 !! end
19525
19526 !! test
19527 Paragraphs inside divs (extra line break on close)
19528 !! wikitext
19529 <div>Line one
19530
19531 Line two
19532 </div>
19533 !! html
19534 <div>Line one
19535 <p>Line two
19536 </p>
19537 </div>
19538
19539 !! end
19540
19541 !! test
19542 Paragraphs inside divs (extra line break on open and close)
19543 !! wikitext
19544 <div>
19545 Line one
19546
19547 Line two
19548 </div>
19549 !! html
19550 <div>
19551 <p>Line one
19552 </p><p>Line two
19553 </p>
19554 </div>
19555
19556 !! end
19557
19558 !! test
19559 Nesting tags, paragraphs on lines which begin with <div>
19560 !! wikitext
19561 <div></div><strong>A
19562 B</strong>
19563 !! html/php+tidy
19564 <p><strong>A</strong></p>
19565 <p><strong>B</strong></p>
19566 !! html/parsoid
19567 <div></div>
19568 <p><strong>A
19569 B</strong>
19570 </p>
19571 !! end
19572
19573 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
19574 !! test
19575 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
19576 !! wikitext
19577 <blockquote>Line one
19578
19579 Line two</blockquote>
19580 !! html
19581 <blockquote>Line one
19582 Line two</blockquote>
19583
19584 !! html+tidy
19585 <blockquote>
19586 <p>Line one Line two</p>
19587 </blockquote>
19588 !! end
19589
19590 !! test
19591 Bug 6200: paragraphs inside blockquotes (extra line break on open)
19592 !! wikitext
19593 <blockquote>
19594 Line one
19595
19596 Line two</blockquote>
19597 !! html
19598 <blockquote>
19599 <p>Line one
19600 </p>
19601 Line two</blockquote>
19602
19603 !! html+tidy
19604 <blockquote>
19605 <p>Line one</p>
19606 Line two</blockquote>
19607 !! end
19608
19609 !! test
19610 Bug 6200: paragraphs inside blockquotes (extra line break on close)
19611 !! wikitext
19612 <blockquote>Line one
19613
19614 Line two
19615 </blockquote>
19616 !! html
19617 <blockquote>Line one
19618 <p>Line two
19619 </p>
19620 </blockquote>
19621
19622 !! html+tidy
19623 <blockquote>
19624 <p>Line one</p>
19625 <p>Line two</p>
19626 </blockquote>
19627 !! end
19628
19629 !! test
19630 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
19631 !! wikitext
19632 <blockquote>
19633 Line one
19634
19635 Line two
19636 </blockquote>
19637 !! html
19638 <blockquote>
19639 <p>Line one
19640 </p><p>Line two
19641 </p>
19642 </blockquote>
19643
19644 !! html+tidy
19645 <blockquote>
19646 <p>Line one</p>
19647 <p>Line two</p>
19648 </blockquote>
19649 !! end
19650
19651 !! test
19652 Paragraphs inside blockquotes/divs (no extra line breaks)
19653 !! wikitext
19654 <blockquote><div>Line one
19655
19656 Line two</div></blockquote>
19657 !! html
19658 <blockquote><div>Line one
19659 Line two</div></blockquote>
19660
19661 !! end
19662
19663 !! test
19664 Paragraphs inside blockquotes/divs (extra line break on open)
19665 !! wikitext
19666 <blockquote><div>
19667 Line one
19668
19669 Line two</div></blockquote>
19670 !! html
19671 <blockquote><div>
19672 <p>Line one
19673 </p>
19674 Line two</div></blockquote>
19675
19676 !! end
19677
19678 !! test
19679 Paragraphs inside blockquotes/divs (extra line break on close)
19680 !! wikitext
19681 <blockquote><div>Line one
19682
19683 Line two
19684 </div></blockquote>
19685 !! html
19686 <blockquote><div>Line one
19687 <p>Line two
19688 </p>
19689 </div></blockquote>
19690
19691 !! end
19692
19693 !! test
19694 Paragraphs inside blockquotes/divs (extra line break on open and close)
19695 !! wikitext
19696 <blockquote><div>
19697 Line one
19698
19699 Line two
19700 </div></blockquote>
19701 !! html
19702 <blockquote><div>
19703 <p>Line one
19704 </p><p>Line two
19705 </p>
19706 </div></blockquote>
19707
19708 !! end
19709
19710 !! test
19711 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
19712 !! options
19713 wgLinkHolderBatchSize=0
19714 !! wikitext
19715 [[meatball:1]]
19716 [[meatball:2]]
19717 [[meatball:3]]
19718 !! html
19719 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
19720 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
19721 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
19722 </p>
19723 !! end
19724
19725 !! test
19726 Free external link invading image caption
19727 !! wikitext
19728 [[Image:Foobar.jpg|thumb|http://x|hello]]
19729 !! html
19730 <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>
19731
19732 !! end
19733
19734 !! test
19735 Bug 15196: localised external link numbers
19736 !! options
19737 language=fa
19738 !! wikitext
19739 [http://en.wikipedia.org/]
19740 !! html/php
19741 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
19742 </p>
19743 !! html/parsoid
19744 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
19745 !! end
19746
19747 !! test
19748 Multibyte character in padleft
19749 !! wikitext
19750 {{padleft:-Hello|7|Æ}}
19751 !! html
19752 <p>Æ-Hello
19753 </p>
19754 !! end
19755
19756 !! test
19757 Multibyte character in padright
19758 !! wikitext
19759 {{padright:Hello-|7|Æ}}
19760 !! html
19761 <p>Hello-Æ
19762 </p>
19763 !! end
19764
19765 !!test
19766 formatdate parser function
19767 !! wikitext
19768 {{#formatdate:2009-03-24}}
19769 !! html
19770 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
19771 </p>
19772 !! end
19773
19774 !!test
19775 formatdate parser function, with default format
19776 !! wikitext
19777 {{#formatdate:2009-03-24|mdy}}
19778 !! html
19779 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
19780 </p>
19781 !! end
19782
19783 !! test
19784 Spacing of numbers in formatted dates
19785 !! wikitext
19786 {{#formatdate:January 15}}
19787 !! html
19788 <p><span class="mw-formatted-date" title="01-15">January 15</span>
19789 </p>
19790 !! end
19791
19792 !! test
19793 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
19794 !! options
19795 language=nl title=[[MediaWiki:Common.css]]
19796 !! wikitext
19797 {{#formatdate:2009-03-24|dmy}}
19798 !! html
19799 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
19800 </p>
19801 !! end
19802
19803 #
19804 #
19805 #
19806
19807 #
19808 # Edit comments
19809 #
19810
19811 !! test
19812 Edit comment with link
19813 !! options
19814 comment
19815 !! wikitext
19816 I like the [[Main Page]] a lot
19817 !! html
19818 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
19819 !!end
19820
19821 !! test
19822 Edit comment with link and link text
19823 !! options
19824 comment
19825 !! wikitext
19826 I like the [[Main Page|best pages]] a lot
19827 !! html
19828 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
19829 !!end
19830
19831 !! test
19832 Edit comment with link and link text with suffix
19833 !! options
19834 comment
19835 !! wikitext
19836 I like the [[Main Page|best page]]s a lot
19837 !! html
19838 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
19839 !!end
19840
19841 !! test
19842 Edit comment with section link (non-local, eg in history list)
19843 !! options
19844 comment title=[[Main Page]]
19845 !! wikitext
19846 /* External links */ removed bogus entries
19847 !! html
19848 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
19849 !!end
19850
19851 !! test
19852 Edit comment with section link and text before it (non-local, eg in history list)
19853 !! options
19854 comment title=[[Main Page]]
19855 !! wikitext
19856 pre-comment text /* External links */ removed bogus entries
19857 !! html
19858 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>
19859 !!end
19860
19861 !! test
19862 Edit comment with section link (local, eg in diff view)
19863 !! options
19864 comment local title=[[Main Page]]
19865 !! wikitext
19866 /* External links */ removed bogus entries
19867 !! html
19868 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
19869 !!end
19870
19871 !! test
19872 Edit comment with subpage link (bug 14080)
19873 !! options
19874 comment
19875 subpage
19876 title=[[Subpage test]]
19877 !! wikitext
19878 Poked at a [[/subpage]] here...
19879 !! html
19880 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
19881 !!end
19882
19883 !! test
19884 Edit comment with subpage link and link text (bug 14080)
19885 !! options
19886 comment
19887 subpage
19888 title=[[Subpage test]]
19889 !! wikitext
19890 Poked at a [[/subpage|neat little page]] here...
19891 !! html
19892 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
19893 !!end
19894
19895 !! test
19896 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
19897 !! options
19898 comment
19899 title=[[Subpage test]]
19900 !! wikitext
19901 Poked at a [[/subpage]] here...
19902 !! html
19903 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...
19904 !!end
19905
19906 !! test
19907 Edit comment with bare anchor link (local, as on diff)
19908 !! options
19909 comment
19910 local
19911 title=[[Main Page]]
19912 !! wikitext
19913 [[#section]]
19914 !! html
19915 <a href="#section">#section</a>
19916 !! end
19917
19918 !! test
19919 Edit comment with bare anchor link (non-local, as on history)
19920 !! options
19921 comment
19922 title=[[Main Page]]
19923 !! wikitext
19924 [[#section]]
19925 !! html
19926 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
19927 !! end
19928
19929 !! test
19930 Anchor starting with underscore
19931 !! wikitext
19932 [[#_ref|One]]
19933 !! html
19934 <p><a href="#_ref">One</a>
19935 </p>
19936 !! end
19937
19938 !! test
19939 Id starting with underscore
19940 !! wikitext
19941 <div id="_ref"></div>
19942 !! html
19943 <div id="_ref"></div>
19944
19945 !! end
19946
19947 !! test
19948 Space normalisation on autocomment (bug 22784)
19949 !! options
19950 comment
19951 title=[[Main Page]]
19952 !! wikitext
19953 /* __hello__world__ */
19954 !! html
19955 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
19956 !! end
19957
19958 !! test
19959 percent-encoding and + signs in comments (Bug 26410)
19960 !! options
19961 comment
19962 !! wikitext
19963 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
19964 !! html/php
19965 <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>
19966 !! end
19967
19968 # Parsoid doesn't support this yet: see bug 73581
19969 # but it *should* omit the 'src' attribute if the image is bad.
19970 # PHP side of tests was disabled in
19971 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
19972 # because of issues in the PHP parserTests infrastructure
19973 # (but the output below is indeed what the PHP side emits)
19974 !! test
19975 Bad images - basic functionality
19976 !! wikitext
19977 [[File:Bad.jpg]]
19978 !! DISABLED/html/php
19979 !! html/parsoid
19980 <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>
19981 !! end
19982
19983 !! test
19984 Bad images - bug 16039: text after bad image disappears
19985 !! wikitext
19986 Foo bar
19987 [[File:Bad.jpg]]
19988 Bar foo
19989 !! DISABLED/html/php
19990 <p>Foo bar
19991 </p><p>Bar foo
19992 </p>
19993 !! html/parsoid
19994 <p>Foo bar
19995 <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>
19996 Bar foo</p>
19997 !! end
19998
19999 !! test
20000 Verify that displaytitle works (bug #22501) no displaytitle
20001 !! options
20002 showtitle
20003 !! config
20004 wgAllowDisplayTitle=true
20005 wgRestrictDisplayTitle=false
20006 !! wikitext
20007 this is not the the title
20008 !! html/php
20009 Parser test
20010 <p>this is not the the title
20011 </p>
20012 !! end
20013
20014 !! test
20015 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
20016 !! options
20017 showtitle
20018 title=[[Screen]]
20019 !! config
20020 wgAllowDisplayTitle=true
20021 wgRestrictDisplayTitle=false
20022 !! wikitext
20023 this is not the the title
20024 {{DISPLAYTITLE:whatever}}
20025 !! html/php
20026 whatever
20027 <p>this is not the the title
20028 </p>
20029 !! end
20030
20031 !! test
20032 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
20033 !! options
20034 showtitle
20035 title=[[Screen]]
20036 !! config
20037 wgAllowDisplayTitle=true
20038 wgRestrictDisplayTitle=true
20039 !! wikitext
20040 this is not the the title
20041 {{DISPLAYTITLE:whatever}}
20042 !! html/php
20043 Screen
20044 <p>this is not the the title
20045 </p>
20046 !! end
20047
20048 !! test
20049 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
20050 !! options
20051 showtitle
20052 title=[[Screen]]
20053 !! config
20054 wgAllowDisplayTitle=true
20055 wgRestrictDisplayTitle=true
20056 !! wikitext
20057 this is not the the title
20058 {{DISPLAYTITLE:screen}}
20059 !! html/php
20060 screen
20061 <p>this is not the the title
20062 </p>
20063 !! end
20064
20065 !! test
20066 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
20067 !! options
20068 showtitle
20069 title=[[Screen]]
20070 !! config
20071 wgAllowDisplayTitle=false
20072 !! wikitext
20073 this is not the the title
20074 {{DISPLAYTITLE:screen}}
20075 !! html/php
20076 Screen
20077 <p>this is not the the title
20078 <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>
20079 </p>
20080 !! end
20081
20082 !! test
20083 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
20084 !! options
20085 showtitle
20086 title=[[Screen]]
20087 !! config
20088 wgAllowDisplayTitle=false
20089 !! wikitext
20090 this is not the the title
20091 !! html/php
20092 Screen
20093 <p>this is not the the title
20094 </p>
20095 !! end
20096
20097 !! test
20098 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
20099 !! options
20100 showtitle
20101 title=[[Screen]]
20102 !! config
20103 wgAllowDisplayTitle=true
20104 wgRestrictDisplayTitle=true
20105 !! wikitext
20106 this is not the the title
20107 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
20108 !! html/php
20109 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
20110 <p>this is not the the title
20111 </p>
20112 !! end
20113
20114 !! test
20115 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
20116 !! options
20117 showtitle
20118 title=[[Screen]]
20119 !! config
20120 wgAllowDisplayTitle=true
20121 wgRestrictDisplayTitle=true
20122 !! wikitext
20123 this is not the the title
20124 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
20125 !! html/php
20126 <span style="color: red;">s</span>creen
20127 <p>this is not the the title
20128 </p>
20129 !! end
20130
20131 !! test
20132 Page status indicators: Empty name is invalid
20133 !! options
20134 showindicators
20135 !! wikitext
20136 <indicator name=" "></indicator>
20137 <indicator></indicator>
20138 !! html
20139 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20140 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20141 </p>
20142 !! end
20143
20144 !! test
20145 Page status indicators: Weird syntaxes that are okay
20146 !! options
20147 showindicators
20148 !! wikitext
20149 <indicator name="empty" />
20150 <indicator name="name"></indicator>
20151 !! html
20152 empty=
20153 name=
20154 <p><br />
20155 </p>
20156 !! end
20157
20158 !! test
20159 Page status indicators: Torture test
20160 !! options
20161 showindicators
20162 !! wikitext
20163 <indicator name="01">hello world</indicator>
20164 <indicator name="02">[[Main Page]]</indicator>
20165 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
20166 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
20167 <indicator name="05">* foo
20168 * bar</indicator>
20169 <indicator name="06"><nowiki>foo</nowiki></indicator>
20170 <indicator name="07"> Preformatted</indicator>
20171 <indicator name="08"><div>Broken tag</indicator>
20172 <indicator name="09">{| class=wikitable
20173 | cell
20174 |}</indicator>
20175 <indicator name="10">Two
20176
20177 paragraphs</indicator>
20178 !! html
20179 01=hello world
20180 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20181 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" />
20182 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>
20183 05=<ul><li> foo</li>
20184 <li> bar</li></ul>
20185
20186 06=foo
20187 07=<pre>Preformatted
20188 </pre>
20189 08=<div>Broken tag</div>
20190
20191 09=<table class="wikitable">
20192 <tr>
20193 <td> cell
20194 </td></tr></table>
20195
20196 10=<p>Two
20197 </p><p>paragraphs
20198 </p>
20199 <p><br />
20200 </p><p><br />
20201 </p><p><br />
20202 </p><p><br />
20203 </p><p><br />
20204 </p>
20205 !! end
20206
20207 !! test
20208 preload: check <noinclude> and <includeonly>
20209 !! options
20210 preload
20211 !! wikitext
20212 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
20213 !! html/php
20214 Hello kind world.
20215 !! end
20216
20217 !! test
20218 preload: check <onlyinclude>
20219 !! options
20220 preload
20221 !! wikitext
20222 Goodbye <onlyinclude>Hello world</onlyinclude>
20223 !! html/php
20224 Hello world
20225 !! end
20226
20227 !! test
20228 preload: can pass tags through if we want to
20229 !! options
20230 preload
20231 !! wikitext
20232 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
20233 !! html/php
20234 <includeonly>Hello world</includeonly>
20235 !! end
20236
20237 !! test
20238 preload: check that it doesn't try to do tricks
20239 !! options
20240 preload
20241 !! wikitext
20242 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20243 !! html/php
20244 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20245 !! end
20246
20247 !! test
20248 Play a bit with r67090 and bug 3158
20249 !! wikitext
20250 <div style="width:50% !important">&nbsp;</div>
20251 <div style="width:50%&nbsp;!important">&nbsp;</div>
20252 <div style="width:50%&#160;!important">&nbsp;</div>
20253 <div style="border : solid;">&nbsp;</div>
20254 !! html/php
20255 <div style="width:50% !important">&#160;</div>
20256 <div style="width:50% !important">&#160;</div>
20257 <div style="width:50% !important">&#160;</div>
20258 <div style="border&#160;: solid;">&#160;</div>
20259
20260 !! html/parsoid
20261 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20262 <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>
20263 <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>
20264 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20265
20266 !! end
20267
20268 !! test
20269 HTML5 data attributes
20270 !! wikitext
20271 <span data-foo="bar">Baz</span>
20272 <p data-abc-def_hij="">Quuz</p>
20273 !! html
20274 <p><span data-foo="bar">Baz</span>
20275 </p>
20276 <p data-abc-def_hij="">Quuz</p>
20277
20278 !! end
20279
20280 !! test
20281 percent-encoding and + signs in internal links (Bug 26410)
20282 !! wikitext
20283 [[User:+%]] [[Page+title%]]
20284 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
20285 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
20286 [[%33%45]] [[%33%45+]]
20287 !! html/php
20288 <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>
20289 <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>
20290 <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>
20291 <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>
20292 </p>
20293 !! html/parsoid
20294 <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>
20295 <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>
20296 <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>
20297 <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>
20298 !! end
20299
20300 !! test
20301 Special characters in embedded file links (bug 27679)
20302 !! wikitext
20303 [[File:Contains & ampersand.jpg]]
20304 [[File:Does not exist.jpg|Title with & ampersand]]
20305 !! html/php
20306 <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>
20307 <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>
20308 </p>
20309 !! html/parsoid
20310 <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>
20311 <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>
20312 !! end
20313
20314 !! test
20315 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
20316 !! wikitext
20317 Text&apos;s been normalized?
20318 !! html
20319 <p>Text&#39;s been normalized?
20320 </p>
20321 !! end
20322
20323 !! test
20324 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
20325 !! wikitext
20326 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
20327 !! html
20328 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
20329 </p>
20330 !! end
20331
20332 !! test
20333 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
20334 !! wikitext
20335 [http://www.example.org/ ideograms]
20336 !! html
20337 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
20338 </p>
20339 !! end
20340
20341 !! test
20342 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
20343 !! wikitext
20344 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
20345 !! html
20346 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
20347 </p>
20348 !! end
20349
20350 !! article
20351 Mediawiki:loop1
20352 !! text
20353 {{Identical|A}}
20354 !! endarticle
20355
20356 !! article
20357 Mediawiki:loop2
20358 !! text
20359 {{Identical|B}}
20360 !! endarticle
20361
20362 !! article
20363 Template:Identical
20364 !! text
20365 {{int:loop1}}
20366 {{int:loop2}}
20367 !! endarticle
20368
20369 !! test
20370 Bug 31098 Template which includes system messages which includes the template
20371 !! wikitext
20372 {{Identical}}
20373 !! html
20374 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20375 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20376 </p>
20377 !! end
20378
20379 !! test
20380 Bug31490 Turkish: ucfirst 'blah'
20381 !! options
20382 language=tr
20383 !! wikitext
20384 {{ucfirst:blah}}
20385 !! html
20386 <p>Blah
20387 </p>
20388 !! end
20389
20390 !! test
20391 Bug31490 Turkish: ucfirst 'ix'
20392 !! options
20393 language=tr
20394 !! wikitext
20395 {{ucfirst:ix}}
20396 !! html
20397 <p>İx
20398 </p>
20399 !! end
20400
20401 !! test
20402 Bug31490 Turkish: lcfirst 'BLAH'
20403 !! options
20404 language=tr
20405 !! wikitext
20406 {{lcfirst:BLAH}}
20407 !! html
20408 <p>bLAH
20409 </p>
20410 !! end
20411
20412 !! test
20413 Bug31490 Turkish: ucfırst (with a dotless i)
20414 !! options
20415 language=tr
20416 !! wikitext
20417 {{ucfırst:blah}}
20418 !! html
20419 <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>
20420 </p>
20421 !! end
20422
20423 !! test
20424 Bug31490 ucfırst (with a dotless i) with English language
20425 !! options
20426 language=en
20427 !! wikitext
20428 {{ucfırst:blah}}
20429 !! html
20430 <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>
20431 </p>
20432 !! end
20433
20434 !! test
20435 Bug 26375: TOC with italics
20436 !! options
20437 title=[[Main Page]]
20438 !! wikitext
20439 __TOC__
20440 == ''Lost'' episodes ==
20441 !! html
20442 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20443 <ul>
20444 <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>
20445 </ul>
20446 </div>
20447
20448 <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>
20449
20450 !! end
20451
20452 !! test
20453 Bug 26375: TOC with bold
20454 !! options
20455 title=[[Main Page]]
20456 !! wikitext
20457 __TOC__
20458 == '''should be bold''' then normal text ==
20459 !! html
20460 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20461 <ul>
20462 <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>
20463 </ul>
20464 </div>
20465
20466 <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>
20467
20468 !! end
20469
20470 !! test
20471 Bug 33845: Headings become cursive in TOC when they contain an image
20472 !! options
20473 title=[[Main Page]]
20474 !! wikitext
20475 __TOC__
20476 == Image [[Image:foobar.jpg]] ==
20477 !! html
20478 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20479 <ul>
20480 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
20481 </ul>
20482 </div>
20483
20484 <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>
20485
20486 !! end
20487
20488 !! test
20489 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
20490 !! options
20491 title=[[Main Page]]
20492 !! wikitext
20493 __TOC__
20494 == <blockquote>Quote</blockquote> ==
20495 !! html
20496 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20497 <ul>
20498 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20499 </ul>
20500 </div>
20501
20502 <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>
20503
20504 !! html+tidy
20505 <p></p>
20506 <div id="toc" class="toc">
20507 <div id="toctitle">
20508 <h2>Contents</h2>
20509 </div>
20510 <ul>
20511 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20512 </ul>
20513 </div>
20514 <p></p>
20515 <h2><span class="mw-headline" id="Quote"></span></h2>
20516 <blockquote>
20517 <p><span class="mw-headline" id="Quote">Quote</span></p>
20518 </blockquote>
20519 <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>
20520 !! end
20521
20522 !! test
20523 Unclosed tags in TOC
20524 !! options
20525 title=[[Main Page]]
20526 !! wikitext
20527 __TOC__
20528 == Proof: 2 < 3 ==
20529 <small>Hanc marginis exiguitas non caperet.</small>
20530 QED
20531 !! html
20532 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20533 <ul>
20534 <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>
20535 </ul>
20536 </div>
20537
20538 <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>
20539 <p><small>Hanc marginis exiguitas non caperet.</small>
20540 QED
20541 </p>
20542 !! end
20543
20544 !! test
20545 Multiple tags in TOC
20546 !! wikitext
20547 __TOC__
20548 == <i>Foo</i> <b>Bar</b> ==
20549
20550 == <i>Foo</i> <blockquote>Bar</blockquote> ==
20551 !! html
20552 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20553 <ul>
20554 <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>
20555 <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>
20556 </ul>
20557 </div>
20558
20559 <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>
20560 <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>
20561
20562 !! html+tidy
20563 <p></p>
20564 <div id="toc" class="toc">
20565 <div id="toctitle">
20566 <h2>Contents</h2>
20567 </div>
20568 <ul>
20569 <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>
20570 <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>
20571 </ul>
20572 </div>
20573 <p></p>
20574 <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>
20575 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
20576 <blockquote>
20577 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
20578 </blockquote>
20579 <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>
20580 !! end
20581
20582 !! test
20583 Tags with parameters in TOC
20584 !! wikitext
20585 __TOC__
20586 == <sup class="in-h2">Hello</sup> ==
20587
20588 == <sup class="a > b">Evilbye</sup> ==
20589 !! html
20590 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20591 <ul>
20592 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
20593 <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>
20594 </ul>
20595 </div>
20596
20597 <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>
20598 <h2><span class="mw-headline" id="b.22.3EEvilbye"><sup> b"&gt;Evilbye</sup></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b&quot;&gt;Evilbye">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
20599
20600 !! end
20601
20602 !! test
20603 span tags with directionality in TOC
20604 !! wikitext
20605 __TOC__
20606 == <span dir="ltr">C++</span> ==
20607
20608 == <span dir="rtl">זבנג!</span> ==
20609
20610 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
20611
20612 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
20613
20614 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
20615 !! html
20616 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20617 <ul>
20618 <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>
20619 <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>
20620 <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>
20621 <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>
20622 <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>
20623 </ul>
20624 </div>
20625
20626 <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>
20627 <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>
20628 <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>
20629 <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>
20630 <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>
20631
20632 !! end
20633
20634 !! test
20635 Bug 72884: bdi element in ToC
20636 !! wikitext
20637 __TOC__
20638 == <bdi>test</bdi> ==
20639 !! html
20640 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20641 <ul>
20642 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
20643 </ul>
20644 </div>
20645
20646 <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>
20647
20648 !! end
20649
20650 # Note that the html output does not have the <p></p>, but the
20651 # html+tidy output *does*. This is because the empty <p></p> is
20652 # removed by the sanitizer, but only when tidy is *not* enabled (!).
20653 !! test
20654 Empty <p> tag in TOC, removed by Sanitizer (T92892)
20655 !! wikitext
20656 __TOC__
20657 == x ==
20658 !! html
20659 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20660 <ul>
20661 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
20662 </ul>
20663 </div>
20664
20665 <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>
20666
20667 !! html+tidy
20668 <p></p>
20669 <div id="toc" class="toc">
20670 <div id="toctitle">
20671 <h2>Contents</h2>
20672 </div>
20673 <ul>
20674 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
20675 </ul>
20676 </div>
20677 <p></p>
20678 <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>
20679 !! end
20680
20681 !! article
20682 MediaWiki:Bug32057
20683 !! text
20684 == {{int:headline_sample}} ==
20685 !! endarticle
20686
20687 !! test
20688 Bug 32057: Title needed when expanding <h> nodes.
20689 !! options
20690 title=[[Main Page]]
20691 !! wikitext
20692 {{int:Bug32057}}
20693 !! html
20694 <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>
20695
20696 !! end
20697
20698 !! test
20699 Strip marker in urlencode
20700 !! wikitext
20701 {{urlencode:x<nowiki/>y}}
20702 {{urlencode:x<nowiki/>y|wiki}}
20703 {{urlencode:x<nowiki/>y|path}}
20704 {{urlencode:x<pre id="one">two</pre>y}}
20705 !! html
20706 <p>xy
20707 xy
20708 xy
20709 xy
20710 </p>
20711 !! end
20712
20713 !! test
20714 Strip marker in lc
20715 !! wikitext
20716 {{lc:x<nowiki/>y}}
20717 !! html
20718 <p>xy
20719 </p>
20720 !! end
20721
20722 !! test
20723 Strip marker in uc
20724 !! wikitext
20725 {{uc:x<nowiki/>y}}
20726 !! html
20727 <p>XY
20728 </p>
20729 !! end
20730
20731 !! test
20732 Strip marker in formatNum
20733 !! wikitext
20734 {{formatnum:1<nowiki/>2}}
20735 {{formatnum:1<nowiki/>2|R}}
20736 !! html
20737 <p>12
20738 12
20739 </p>
20740 !! end
20741
20742 !! test
20743 Check noCommafy in formatNum
20744 !! options
20745 language=be-tarask
20746 !! wikitext
20747 {{formatnum:123456.78}}
20748 {{formatnum:123456.78|NOSEP}}
20749 !! html
20750 <p>123 456,78
20751 123456.78
20752 </p>
20753 !! end
20754
20755 !! test
20756 Wrong option for formatNum (bug 56199)
20757 !! wikitext
20758 {{formatnum:1,234.56|Random}}
20759 {{formatnum:1,234.56|EVERYTHING}}
20760 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
20761 !! html
20762 <p>1,234.56
20763 1,234.56
20764 1,234.56
20765 </p>
20766 !! end
20767
20768 !! test
20769 Strip marker in grammar
20770 !! options
20771 language=fi
20772 !! wikitext
20773 {{grammar:elative|foo<nowiki/>bar}}
20774 !! html
20775 <p>foobarista
20776 </p>
20777 !! end
20778
20779 !! test
20780 Strip marker in padleft
20781 !! wikitext
20782 {{padleft:|2|x<nowiki/>y}}
20783 !! html
20784 <p>xy
20785 </p>
20786 !! end
20787
20788 !! test
20789 Strip marker in padright
20790 !! wikitext
20791 {{padright:|2|x<nowiki/>y}}
20792 !! html
20793 <p>xy
20794 </p>
20795 !! end
20796
20797 !! test
20798 Strip marker in anchorencode
20799 !! wikitext
20800 {{anchorencode:x<nowiki/>y}}
20801 !! html
20802 <p>xy
20803 </p>
20804 !! end
20805
20806 !! test
20807 nowiki inside link inside heading (bug 18295)
20808 !! wikitext
20809 ==[[foo|x<nowiki>y</nowiki>z]]==
20810 !! html
20811 <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>
20812
20813 !! end
20814
20815 !! test
20816 new support for bdi element (bug 31817)
20817 !! wikitext
20818 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
20819 !! html
20820 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
20821
20822 !!end
20823
20824 !! test
20825 Ignore pipe between table row attributes
20826 !! wikitext
20827 {|
20828 | quux
20829 |- id=foo | style='color: red'
20830 | bar
20831 |}
20832 !! html
20833 <table>
20834 <tr>
20835 <td> quux
20836 </td></tr>
20837 <tr id="foo" style="color: red">
20838 <td> bar
20839 </td></tr></table>
20840
20841 !! end
20842
20843 !!test
20844 Gallery override link with WikiLink (bug 34852)
20845 !! wikitext
20846 <gallery>
20847 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
20848 </gallery>
20849 !! html
20850 <ul class="gallery mw-gallery-traditional">
20851 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20852 <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>
20853 <div class="gallerytext">
20854 <p>caption
20855 </p>
20856 </div>
20857 </div></li>
20858 </ul>
20859
20860 !! end
20861
20862 !!test
20863 Gallery override link with absolute external link (bug 34852)
20864 !! wikitext
20865 <gallery>
20866 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
20867 </gallery>
20868 !! html
20869 <ul class="gallery mw-gallery-traditional">
20870 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20871 <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>
20872 <div class="gallerytext">
20873 <p>caption
20874 </p>
20875 </div>
20876 </div></li>
20877 </ul>
20878
20879 !! end
20880
20881 !!test
20882 Gallery override link with malicious javascript (bug 34852)
20883 !! wikitext
20884 <gallery>
20885 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
20886 </gallery>
20887 !! html
20888 <ul class="gallery mw-gallery-traditional">
20889 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20890 <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>
20891 <div class="gallerytext">
20892 <p>caption
20893 </p>
20894 </div>
20895 </div></li>
20896 </ul>
20897
20898 !! end
20899
20900 !!test
20901 Gallery with invalid title as link (bug 43964)
20902 !! wikitext
20903 <gallery>
20904 File:foobar.jpg|link=<
20905 </gallery>
20906 !! html
20907 <ul class="gallery mw-gallery-traditional">
20908 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
20909 <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>
20910 <div class="gallerytext">
20911 </div>
20912 </div></li>
20913 </ul>
20914
20915 !! end
20916
20917 !!test
20918 Language parser function
20919 !! wikitext
20920 {{#language:ar}}
20921 !! html
20922 <p>العربية
20923 </p>
20924 !! end
20925
20926 !!test
20927 Padleft and padright as substr
20928 !! wikitext
20929 {{padleft:|3|abcde}}
20930 {{padright:|3|abcde}}
20931 !! html
20932 <p>abc
20933 abc
20934 </p>
20935 !! end
20936
20937 !!test
20938 Special parser function
20939 !! wikitext
20940 {{#special:RandomPage}}
20941 {{#special:BaDtItLe}}
20942 {{#special:Foobar}}
20943 !! html
20944 <p>Special:Random
20945 Special:Badtitle
20946 Special:Foobar
20947 </p>
20948 !! end
20949
20950 !!test
20951 Bug 34939 - Case insensitive link parsing ([HttP://])
20952 !! wikitext
20953 [HttP://MediaWiki.Org/]
20954 !! html/php
20955 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
20956 </p>
20957 !! html/parsoid
20958 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
20959 !! end
20960
20961 !!test
20962 Bug 34939 - Case insensitive link parsing ([HttP:// title])
20963 !! wikitext
20964 [HttP://MediaWiki.Org/ MediaWiki]
20965 !! html
20966 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
20967 </p>
20968 !! end
20969
20970 !!test
20971 Bug 34939 - Case insensitive link parsing (HttP://)
20972 !! wikitext
20973 HttP://MediaWiki.Org/
20974 !! html/php
20975 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
20976 </p>
20977 !! html/parsoid
20978 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
20979 !! end
20980
20981 !!test
20982 Disable TOC
20983 !! options
20984 notoc
20985 !! wikitext
20986 Lead
20987 == Section 1 ==
20988 == Section 2 ==
20989 == Section 3 ==
20990 == Section 4 ==
20991 == Section 5 ==
20992 !! html
20993 <p>Lead
20994 </p>
20995
20996 <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>
20997 <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>
20998 <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>
20999 <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>
21000 <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>
21001
21002 !! end
21003
21004
21005 ###
21006 ### Parsoid-specific tests
21007 ### Parsoid-PHP parser incompatibilities
21008 ###
21009 !!test
21010 1. SOL-sensitive wikitext tokens as template-args
21011 !!options
21012 parsoid=wt2html,wt2wt
21013 !! wikitext
21014 {{echo|*a}}
21015 {{echo|#a}}
21016 {{echo|:a}}
21017 !! html
21018 <span about="#mwt1" typeof="mw:Transclusion">
21019 </span><ul about="#mwt1"><li>a</li>
21020 </ul>
21021 <span about="#mwt2" typeof="mw:Transclusion">
21022 </span><ol about="#mwt2"><li>a</li>
21023 </ol>
21024 <span about="#mwt3" typeof="mw:Transclusion">
21025 </span><dl about="#mwt3"><dd>a</dd>
21026 </dl>
21027 !!end
21028
21029 #### -----------------------------------------------------------------
21030 #### Parsoid-specific functionality tests
21031 #### -----------------------------------------------------------------
21032
21033 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
21034 # We know wt2wt will fail, but we expect selser to pass.
21035 # Due to the nature of our testing, wt2wt and selser tests will enter the
21036 # blacklist and we'll catch selser regressions based on changes to the
21037 # blacklist entries for selser tests.
21038 !! test
21039 1. Bad treebuilder fixup of formatting elt is cleaned up
21040 !! options
21041 parsoid=wt2html,wt2wt
21042 !! wikitext
21043 {|
21044 |
21045 <small>
21046 [[Image:Foobar.jpg|right|Test]]
21047 </small>
21048 |}
21049 !! html/parsoid
21050 <table>
21051 <tbody><tr><td>
21052 <small>
21053 <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>
21054 </small>
21055 </td></tr>
21056 </tbody></table>
21057 !! end
21058
21059 !! test
21060 2. Bad treebuilder fixup of formatting elt is cleaned up
21061 !! options
21062 parsoid=wt2html,wt2wt
21063 !! wikitext
21064 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
21065
21066 <small>[[Image:Foobar.jpg|right|300px]]</small>
21067 !! html/parsoid
21068
21069 <p><b>foo</b></p>
21070 <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>
21071 <p><b>bar</b></p>
21072 <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>
21073 !! end
21074
21075 !! test
21076 3. Bad treebuilder fixup of formatting elt is cleaned up
21077 !! options
21078 parsoid=wt2html,wt2wt
21079 !! wikitext
21080 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
21081 !! html/parsoid
21082 <p><small><b>foo</b></small></p>
21083 <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>
21084 <p><small><b>bar</b></small></p>
21085 !! end
21086
21087 !! test
21088 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
21089 !! options
21090 parsoid=wt2html,wt2wt
21091 !! wikitext
21092 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
21093 !! html/parsoid
21094 <p><b><small></small></b></p>
21095 <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>
21096 <p></p>
21097 !! end
21098
21099 #### ----------------------------------------------------------------
21100 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
21101 #### tags. Parsoid's output for these tags differs from that of the
21102 #### PHP parser.
21103 #### ----------------------------------------------------------------
21104
21105 !!test
21106 Ref: 1. ref-location should be replaced with an index span
21107 !!options
21108 parsoid
21109 !! wikitext
21110 A <ref>foo</ref>
21111 B <ref name="x">foo</ref>
21112 C <ref name="y" />
21113 <references />
21114 !! html
21115 <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>
21116 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>
21117 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>
21118 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21119 <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>
21120 <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>
21121 <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>
21122 </ol>
21123 !!end
21124
21125 !!test
21126 Ref: 2. ref-tags with identical names should all get the same index
21127 !!options
21128 parsoid
21129 !! wikitext
21130 A <ref name="x">foo</ref>
21131 B <ref name="x" />
21132 <references />
21133 !! html
21134 <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>
21135 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>
21136 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21137 <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>
21138 </ol>
21139 !!end
21140
21141 !!test
21142 Ref: 3. spaces in ref-names should be ignored
21143 !!options
21144 parsoid
21145 !! wikitext
21146 A <ref name="x">foo</ref>
21147 B <ref name=" x " />
21148 C <ref name= x />
21149 <references />
21150 !! html
21151 <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>
21152 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>
21153 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>
21154 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21155 <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>
21156 </ol>
21157 !!end
21158
21159 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
21160 !!test
21161 Ref: 4. 'constructor' should be accepted as a valid ref-name
21162 !!options
21163 parsoid
21164 !! wikitext
21165 A <ref name="constructor">foo</ref>
21166 <references />
21167 !! html
21168 <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>
21169 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21170 <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>
21171 </ol>
21172 !!end
21173
21174 !!test
21175 Ref: 5. body should accept generic wikitext
21176 !!options
21177 parsoid
21178 !! wikitext
21179 A <ref>
21180 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
21181 </ref>
21182
21183 <references />
21184 !! html
21185 <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>
21186
21187 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21188 <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>
21189 </span></li>
21190 </ol>
21191 !!end
21192
21193 !!test
21194 Ref: 6. indent-pres should not be output in ref-body
21195 !!options
21196 parsoid
21197 !! wikitext
21198 A <ref>
21199 foo
21200 bar
21201 baz
21202 </ref>
21203
21204 <references />
21205 !! html
21206 <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>
21207
21208 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21209 <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
21210 bar
21211 baz
21212 </span></li>
21213 </ol>
21214 !!end
21215
21216 !!test
21217 Ref: 7. No p-wrapping in ref-body
21218 !!options
21219 parsoid
21220 !! wikitext
21221 A <ref>
21222 foo
21223
21224 bar
21225
21226
21227 baz
21228
21229
21230
21231 booz
21232 </ref>
21233
21234 <references />
21235 !! html
21236 <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>
21237
21238 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21239 <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
21240
21241 bar
21242
21243
21244 baz
21245
21246
21247
21248 booz
21249 </span></li>
21250 </ol>
21251 !!end
21252
21253 !!test
21254 Ref: 8. transclusion wikitext has lower precedence
21255 !!options
21256 parsoid
21257 !! wikitext
21258 A <ref> foo {{echo|</ref> B C}}
21259
21260 <references />
21261 !! html
21262 <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>
21263 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21264 <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>
21265 </ol>
21266 !!end
21267
21268 !!test
21269 Ref: 9. unclosed comments should not leak out of ref-body
21270 !!options
21271 parsoid
21272 !! wikitext
21273 A <ref> foo <!--</ref> B C
21274 <references />
21275 !! html
21276 <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>
21277 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21278 <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>
21279 </ol>
21280 !!end
21281
21282 !!test
21283 Ref: 10. Unclosed HTML tags should not leak out of ref-body
21284 !!options
21285 parsoid
21286 !! wikitext
21287 A <ref> <b> foo </ref> B C
21288
21289 <references />
21290 !! html
21291 <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>
21292
21293
21294 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21295 <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>
21296 </ol>
21297 !!end
21298
21299 !!test
21300 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
21301 !!options
21302 parsoid
21303 !! wikitext
21304 A <ref>foo</ref> B
21305 C <ref>bar</ref> D
21306 <references />
21307 !! html
21308 <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
21309 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>
21310 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21311 <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>
21312 <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>
21313 </ol>
21314 !!end
21315
21316 !!test
21317 Ref: 12. ref-tags act as trailing newline migration barrier
21318 !! wikitext
21319 <!--the newline at the end of this line moves out of the p tag-->a
21320
21321 b<!--the newline at the end of this line stays inside the p tag--> <ref />
21322 <ref />
21323
21324 c
21325 <references />
21326 !! html/parsoid
21327 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
21328
21329
21330 <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>
21331 <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>
21332
21333 <p>c</p>
21334 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21335 <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>
21336 <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>
21337 !!end
21338
21339 !!test
21340 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
21341 !!options
21342 parsoid
21343 !! wikitext
21344 <ref>foo</ref> A
21345 <ref>bar
21346 </ref> B
21347 <references />
21348 !! html
21349 <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
21350 <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>
21351 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21352 <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>
21353 <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
21354 </span></li>
21355 </ol>
21356 !!end
21357
21358 !!test
21359 Ref: 14. A nested ref-tag should be emitted as plain text
21360 !!options
21361 parsoid
21362 !! wikitext
21363 <ref>foo <ref>bar</ref> baz</ref>
21364
21365 <references />
21366 !! html
21367 <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>
21368 </p>
21369 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21370 <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>
21371 </ol>
21372 !!end
21373
21374 !!test
21375 Ref: 15. ref-tags with identical names should get identical indexes
21376 !!options
21377 parsoid
21378 !! wikitext
21379 A1 <ref name="a">foo</ref> A2 <ref name="a" />
21380 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
21381
21382 <references />
21383 !! html
21384 <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>
21385 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>
21386
21387 <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>
21388 </ol>
21389 !!end
21390
21391 ## We don't bother wt2wt-ing non-standard whitespace
21392 !!test
21393 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
21394 !!options
21395 parsoid=wt2html
21396 !! wikitext
21397 A <ref >foo</ref >
21398
21399 <references />
21400 !! html
21401 <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>
21402 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21403 <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>
21404 !!end
21405
21406 !!test
21407 Ref: 17. Generate valid HTML5 id/about attributes
21408 !!options
21409 parsoid
21410 !!wikitext
21411 <ref name="a b">foo</ref>
21412
21413 <references />
21414 !!html
21415 <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>
21416 </p>
21417
21418 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21419 <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>
21420 </ol>
21421 !!end
21422
21423 !!test
21424 Ref: 18. T58916: Extension attributes should be parsed as plain text
21425 !!options
21426 parsoid
21427 !!wikitext
21428 <ref name="{{echo|a}}">foo</ref>
21429
21430 <references />
21431 !!html
21432 <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>
21433 </p>
21434
21435 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21436 <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>
21437 </ol>
21438 !!end
21439
21440 !!test
21441 Ref: 19. ref-tags with identical name encodings should get identical indexes
21442 !!options
21443 parsoid
21444 !! wikitext
21445 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
21446
21447 <references />
21448 !! html
21449 <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>
21450 </p>
21451 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21452 <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>
21453 </ol>
21454 !!end
21455
21456 !!test
21457 Ref: 20. ref-tags with identical names but different content should keep it
21458 !!options
21459 parsoid
21460 !! wikitext
21461 A <ref name="foo">Foo one</ref>
21462 B <ref name="foo">Foo two</ref>
21463 C <ref name="foo" />
21464
21465 <references />
21466 !! html
21467 <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>
21468 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>
21469 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>
21470
21471 <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>
21472 </ol>
21473 !!end
21474
21475 !!test
21476 References: 1. references tag without any refs should be handled properly
21477 !! wikitext
21478 <references />
21479 !! html/parsoid
21480 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21481 !!end
21482
21483 !!test
21484 References: 2. references tag with group only outputs references from that group
21485 !! wikitext
21486 A <ref group="a">foo</ref>
21487 B <ref group="b">bar</ref>
21488 C <ref>baz</ref>
21489
21490 <references group="a" />
21491 <references />
21492 <references group="b" />
21493 !! html/parsoid
21494 <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>
21495 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>
21496 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>
21497
21498 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
21499 <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>
21500 </ol>
21501 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
21502 <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>
21503 </ol>
21504 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
21505 <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>
21506 </ol>
21507 !!end
21508
21509 !!test
21510 References: 3. ref list should be cleared after processing references
21511 !! wikitext
21512 A <ref>foo</ref>
21513
21514 <references />
21515
21516 B <ref>bar</ref>
21517
21518 <references />
21519 !! html/parsoid
21520 <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>
21521
21522 <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>
21523 </ol>
21524
21525 <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>
21526
21527 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21528 <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>
21529 </ol>
21530 !!end
21531
21532 !!test
21533 References: 4. only referenced group should be cleared after processing references
21534 !! wikitext
21535 A <ref group="a">afoo</ref>
21536 B <ref>bfoo</ref>
21537
21538 <references group="a" />
21539
21540 C <ref>cfoo</ref>
21541
21542 <references />
21543 !! html/parsoid
21544 <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>
21545 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>
21546
21547 <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>
21548 </ol>
21549
21550 <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>
21551
21552 <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>
21553 </ol>
21554 !!end
21555
21556 !!test
21557 References: 5. ref tags in references should be processed while ignoring all other content
21558 !! wikitext
21559 A <ref name="a" />
21560 B <ref name="b">bar</ref>
21561
21562 <references>
21563 <ref name="a">foo</ref>
21564 This should just get lost.
21565 </references>
21566 !! html/parsoid
21567 <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>
21568 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>
21569
21570
21571 <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>
21572 </ol>
21573 !!end
21574
21575 !!test
21576 References: 6. <references /> from a transclusion
21577 !! wikitext
21578 <ref>Foo</ref> {{echo|<references />}}
21579 !! html/parsoid
21580 <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>
21581 </ol>
21582 !!end
21583
21584 !! test
21585 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
21586 !! wikitext
21587 A <ref>foo bar for a</ref>
21588 B <ref group="X" name="b" />
21589
21590 <references />
21591
21592 <references group="X">
21593 <ref name="b">foo</ref>
21594 </references>
21595 !! html/parsoid
21596 <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>
21597 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>
21598 </p>
21599
21600 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21601 <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>
21602 </ol>
21603
21604 <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"}}'>
21605 <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>
21606 </ol>
21607 !! end
21608
21609 !! test
21610 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
21611 !! wikitext
21612 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
21613 <references />
21614 !! html/parsoid
21615 <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>
21616 <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>
21617 </ol>
21618 !!end
21619
21620 # This test only works in wt2html now as the <references /> are always generated
21621 # unless selser is active. Once T72722 is fixed, we should add a changes test
21622 # here to ensure that unrelated changes don't add the new <references /> in
21623 # wt2wt.
21624 !! test
21625 References: 9. Generate missing references list at the end
21626 !! wikitext
21627 A <ref>foo</ref>
21628 B <ref group="inexistent">bar</ref>
21629 !! html/parsoid
21630 <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>
21631 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21632 <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>
21633 </ol>
21634 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
21635 <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>
21636 </ol>
21637 !! end
21638
21639 !! test
21640 References: 10. New <references/> shouldn't be added for unrelated edits.
21641 !! options
21642 parsoid={
21643 "modes": ["selser"],
21644 "changes": [["#x", "remove"]],
21645 "selser": "noauto"
21646 }
21647 !! wikitext
21648 Unrelated text<span id="x"> that's going to disappear</span>.
21649 A <ref>foo</ref>
21650 !! wikitext/edited
21651 Unrelated text.
21652 A <ref>foo</ref>
21653 !!end
21654
21655 !! test
21656 Entities in ref name
21657 !! wikitext
21658 <ref name="test &amp; me">hi</ref>
21659 <references />
21660 !! html/parsoid
21661 <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>
21662 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21663 <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>
21664 </ol>
21665 !! end
21666
21667 # This test is wt2html only because we're permitting the serializer to produce
21668 # dirty diffs, normalizing the unclosed references to the self-closed version.
21669 !! test
21670 Generate references for unclosed references tag
21671 !! options
21672 parsoid=wt2html
21673 !! wikitext
21674 a<ref>foo</ref>
21675
21676 <references>
21677 !! html/parsoid
21678 <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>
21679 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21680 <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>
21681 !! end
21682
21683 !! test
21684 New reference serializes on its own line
21685 !! options
21686 parsoid=wt2wt,html2wt
21687 !! wikitext
21688 foo
21689 <references />
21690 !! html/parsoid
21691 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21692 !! end
21693
21694 #### ----------------------------------------------------------------
21695 #### Parsoid-only testing of Parsoid's impl of LST
21696 #### Not implemented yet, see
21697 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
21698 #### ----------------------------------------------------------------
21699
21700 !!test
21701 LST Sections: 1. Simple section start and end
21702 !! wikitext
21703 <section begin="2011-05-16" />
21704 <section end="2014-04-10 (MW 1.23wmf22)" />
21705 !! html/parsoid
21706 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
21707 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
21708 !! end
21709
21710 #--------- Test stripping of empty nodes in template content ----------
21711 !!test
21712 Empty LI and TR nodes should be stripped from template content
21713 !!wikitext
21714 {{EmptyLITest}}
21715 {{EmptyTRTest}}
21716 !!html/parsoid
21717 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
21718 <li>a</li>
21719 <li>b</li>
21720 </ul>
21721 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
21722 <tbody>
21723 <tr>
21724 <td>foo</td>
21725 </tr>
21726 <tr>
21727 <td>bar</td>
21728 </tr>
21729 </tbody>
21730 </table>
21731 !!end
21732
21733 !!test
21734 Empty LI and TR nodes should not be stripped from top-level content
21735 !!wikitext
21736 * a
21737 *
21738 * b
21739 {|
21740 |-
21741 |-
21742 |foo
21743 |}
21744 !!html/parsoid
21745 <ul>
21746 <li> a</li>
21747 <li></li>
21748 <li> b</li>
21749 </ul>
21750 <table>
21751 <tbody>
21752 <tr></tr>
21753 <tr>
21754 <td>foo</td>
21755 </tr>
21756 </tbody>
21757 </table>
21758 !!end
21759
21760 !!test
21761 Empty TR nodes should not be stripped if they have any attributes set
21762 !!wikitext
21763 {{EmptyTRWithHTMLAttrTest}}
21764 !!html/parsoid
21765 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
21766 <tr align="center"></tr>
21767 <tr><td>foo</td></tr>
21768 <tr align="center"></tr>
21769 <tr><td>bar</td></tr>
21770 </table>
21771 !!end
21772
21773 #### ----------------------------------------------------------------
21774 #### The following section of tests are primarily to test
21775 #### wikitext escaping capabilities of Parsoid. Given that
21776 #### escaping can be done any number of ways, the wikitext (input)
21777 #### is always adjusted to reflect how Parsoid adds nowiki
21778 #### escape tags.
21779 ####
21780 #### We are marking several tests as parsoid-only since the
21781 #### HTML in the result section is different from what the
21782 #### PHP parser generates for it.
21783 #### ----------------------------------------------------------------
21784
21785
21786 #### --------------- Headings ---------------
21787 #### 0. Unnested
21788 #### 1. Nested inside html <h1>=foo=</h1>
21789 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
21790 #### 3. Nested inside html with wikitext split by html tags
21791 #### 4. No escape needed
21792 #### 5. Empty headings <h1></h1>
21793 #### 6. Heading chars in SOL context
21794 #### ----------------------------------------
21795 !! test
21796 Headings: 0. Unnested
21797 !! options
21798 parsoid
21799 !! wikitext
21800 <nowiki>=foo=</nowiki>
21801
21802 <nowiki> =foo= </nowiki>
21803 <!--cmt-->
21804 <nowiki>=foo=</nowiki>
21805
21806 =foo''a''<nowiki>=</nowiki>
21807 !! html
21808 <p><span typeof="mw:Nowiki">=foo=</span></p>
21809
21810 <p><span typeof="mw:Nowiki"> =foo= </span>
21811 <!--cmt-->
21812 <span typeof="mw:Nowiki">=foo=</span></p>
21813
21814 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
21815 !!end
21816
21817 # New headings and existing headings are handled differently
21818 !! test
21819 Headings: 1. Nested inside html
21820 !! options
21821 parsoid=html2wt
21822 !! html/parsoid
21823 <h1>=foo=</h1>
21824 <h2>=foo=</h2>
21825 <h3>=foo=</h3>
21826
21827 <h1 data-parsoid=''>=foo=</h1>
21828 <h2 data-parsoid=''>=foo=</h2>
21829 <h3 data-parsoid=''>=foo=</h3>
21830 <h4 data-parsoid=''>=foo=</h4>
21831 <h5 data-parsoid=''>=foo=</h5>
21832 <h6 data-parsoid=''>=foo=</h6>
21833 !! wikitext
21834 = =foo= =
21835
21836 == =foo= ==
21837
21838 === =foo= ===
21839
21840 =<nowiki>=foo=</nowiki>=
21841 ==<nowiki>=foo=</nowiki>==
21842 ===<nowiki>=foo=</nowiki>===
21843 ====<nowiki>=foo=</nowiki>====
21844 =====<nowiki>=foo=</nowiki>=====
21845 ======<nowiki>=foo=</nowiki>======
21846
21847 !!end
21848
21849 !! test
21850 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
21851 !! options
21852 parsoid=html2wt
21853 !! html/parsoid
21854 <h1>foo</h1>*bar
21855 <h1>foo</h1>=bar
21856 <h1>foo</h1>=bar=
21857 !! wikitext
21858 = foo =
21859 <nowiki>*</nowiki>bar
21860
21861 = foo =
21862 =bar
21863
21864 = foo =
21865 <nowiki>=bar=</nowiki>
21866 !!end
21867
21868 !! test
21869 Headings: 3. Nested inside html with wikitext split by html tags
21870 !! options
21871 parsoid=html2wt,wt2wt
21872 !! wikitext
21873 = ='''bold'''<nowiki>foo=</nowiki> =
21874 !! html/parsoid
21875 <h1>=<b>bold</b>foo=</h1>
21876 !!end
21877
21878 !! test
21879 Headings: 4a. No escaping needed (testing just h1 and h2)
21880 !! wikitext
21881 = =foo =
21882
21883 = foo= =
21884
21885 = =foo= =
21886
21887 = =foo= bar =
21888
21889 == =foo ==
21890
21891 == foo= ==
21892
21893 = = =
21894
21895 = ''=''foo= =
21896 !! html/parsoid
21897 <h1>=foo</h1>
21898 <h1>foo=</h1>
21899 <h1> =foo= </h1>
21900 <h1>=foo= bar</h1>
21901 <h2>=foo</h2>
21902 <h2>foo=</h2>
21903 <h1>=</h1>
21904 <h1><i>=</i>foo=</h1>
21905 !!end
21906
21907 !! test
21908 Headings: 4b. No escaping needed (inside p-tags)
21909 !! options
21910 parsoid=html2wt
21911 !! html/parsoid
21912 <p>===
21913 =foo= x
21914 =foo= <s></s>
21915 </p>
21916 !! wikitext
21917 ===
21918 =foo= x
21919 =foo= <s></s>
21920 !!end
21921
21922 !! test
21923 Headings: 5. Empty headings
21924 !! wikitext
21925 =<nowiki/>=
21926
21927 ==<nowiki/>==
21928
21929 ===<nowiki/>===
21930
21931 ====<nowiki/>====
21932
21933 =====<nowiki/>=====
21934
21935 ======<nowiki/>======
21936 !! html/parsoid
21937 <h1 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h1>
21938
21939 <h2 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h2>
21940
21941 <h3 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h3>
21942
21943 <h4 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h4>
21944
21945 <h5 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h5>
21946
21947 <h6 data-parsoid='{}'><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/></h6>
21948 !!end
21949
21950 !! test
21951 Headings: 6a. Heading chars in SOL context (with trailing spaces)
21952 !! wikitext
21953 <nowiki>=a=</nowiki>
21954
21955 <nowiki>=a=</nowiki>
21956
21957 <nowiki>=a=</nowiki>
21958
21959 <nowiki>=a=</nowiki>
21960 !! html/php
21961 <p>=a=
21962 </p><p>=a=
21963 </p><p>=a=
21964 </p><p>=a=
21965 </p>
21966 !! html/parsoid
21967 <p><span typeof="mw:Nowiki">=a=</span></p>
21968
21969 <p><span typeof="mw:Nowiki">=a=</span></p>
21970
21971 <p><span typeof="mw:Nowiki">=a=</span></p>
21972
21973 <p><span typeof="mw:Nowiki">=a=</span></p>
21974 !!end
21975
21976 !! test
21977 Headings: 6b. Heading chars in SOL context (with trailing newlines)
21978 !! wikitext
21979 <nowiki>=a=
21980 b</nowiki>
21981
21982 <nowiki>=a=
21983 b</nowiki>
21984
21985 <nowiki>=a=
21986 b</nowiki>
21987
21988 <nowiki>=a=
21989 b</nowiki>
21990 !! html/php
21991 <p>=a=
21992 b
21993 </p><p>=a=
21994 b
21995 </p><p>=a=
21996 b
21997 </p><p>=a=
21998 b
21999 </p>
22000 !! html/parsoid
22001 <p><span typeof="mw:Nowiki">=a=
22002 b</span></p>
22003
22004 <p><span typeof="mw:Nowiki">=a=
22005 b</span></p>
22006
22007 <p><span typeof="mw:Nowiki">=a=
22008 b</span></p>
22009
22010 <p><span typeof="mw:Nowiki">=a=
22011 b</span></p>
22012 !!end
22013
22014 !! test
22015 Headings: 6c. Heading chars in SOL context (leading newline break)
22016 !! wikitext
22017 a
22018 <nowiki>=b=</nowiki>
22019 !! html/php
22020 <p>a
22021 =b=
22022 </p>
22023 !! html/parsoid
22024 <p>a
22025 <span typeof="mw:Nowiki">=b=</span>
22026 !!end
22027
22028 !! test
22029 Headings: 6d. Heading chars in SOL context (with interspersed comments)
22030 !! wikitext
22031 <!--c0--><nowiki>=a=</nowiki>
22032
22033 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
22034 !! html/php
22035 <p>=a=
22036 </p><p>=a=
22037 </p>
22038 !! html/parsoid
22039 <!--c0--><p><span typeof="mw:Nowiki">=a=</span></p>
22040
22041 <!--c1--><p><span typeof="mw:Nowiki">=a=</span></p> <!--c2--> <!--c3-->
22042 !!end
22043
22044 !! test
22045 Headings: 6d. Heading chars in SOL context (No escaping needed)
22046 !! options
22047 parsoid=html2wt
22048 !! html/parsoid
22049 =a=<div>b</div>
22050 !! wikitext
22051 =a=<div>b</div>
22052 !!end
22053
22054 !! test
22055 Headings: 7. Insert a newline between new content and headings
22056 !! options
22057 parsoid=html2wt
22058 !! html/parsoid
22059 <h2>NEW</h2>
22060 <p>new</p>
22061 <h2 data-parsoid='{}'>A</h2>
22062 <p data-parsoid='{}'>a</p>
22063 !! wikitext
22064 == NEW ==
22065 new
22066
22067 ==A==
22068 a
22069
22070 !! end
22071
22072 #### --------------- Lists ---------------
22073 #### 0. Outside nests (*foo, etc.)
22074 #### 1. Nested inside html <ul><li>*foo</li></ul>
22075 #### 2. Inside definition lists
22076 #### 3. Only bullets at start should be escaped
22077 #### 4. No escapes needed
22078 #### 5. No unnecessary escapes
22079 #### 6. Escape bullets in SOL position
22080 #### 7. Escape bullets in a multi-line context
22081 #### ----------------------------------------
22082
22083 !! test
22084 Lists: 0. Outside nests
22085 !! wikitext
22086 <nowiki>*</nowiki>foo
22087
22088 <nowiki>#</nowiki>foo
22089
22090 <nowiki>;Foo:</nowiki>bar
22091 !! html/php
22092 <p>*foo
22093 </p><p>#foo
22094 </p><p>;Foo:bar
22095 </p>
22096 !! html/parsoid
22097 <p><span typeof="mw:Nowiki">*</span>foo</p>
22098
22099 <p><span typeof="mw:Nowiki">#</span>foo</p>
22100
22101 <p><span typeof="mw:Nowiki">;Foo:</span>bar</p>
22102 !!end
22103
22104 !! test
22105 Lists: 1. Nested inside html
22106 !! wikitext
22107 *<nowiki>*foo</nowiki>
22108
22109 *<nowiki>#foo</nowiki>
22110
22111 *<nowiki>:foo</nowiki>
22112
22113 *<nowiki>;foo</nowiki>
22114
22115 #<nowiki>*foo</nowiki>
22116
22117 #<nowiki>#foo</nowiki>
22118
22119 #<nowiki>:foo</nowiki>
22120
22121 #<nowiki>;foo</nowiki>
22122 !! html
22123 <ul><li>*foo</li></ul>
22124 <ul><li>#foo</li></ul>
22125 <ul><li>:foo</li></ul>
22126 <ul><li>;foo</li></ul>
22127 <ol><li>*foo</li></ol>
22128 <ol><li>#foo</li></ol>
22129 <ol><li>:foo</li></ol>
22130 <ol><li>;foo</li></ol>
22131
22132 !!end
22133
22134 !! test
22135 Lists: 2. Inside definition lists
22136 !! wikitext
22137 ;<nowiki>;foo</nowiki>
22138
22139 ;<nowiki>:foo</nowiki>
22140
22141 ;<nowiki>:foo</nowiki>
22142 :bar
22143
22144 :<nowiki>:foo</nowiki>
22145 !! html
22146 <dl><dt>;foo</dt></dl>
22147 <dl><dt>:foo</dt></dl>
22148 <dl><dt>:foo</dt>
22149 <dd>bar</dd></dl>
22150 <dl><dd>:foo</dd></dl>
22151
22152 !!end
22153
22154 !! test
22155 Lists: 3. Only bullets at start of text should be escaped
22156 !! wikitext
22157 *<nowiki>*foo*bar</nowiki>
22158
22159 *<nowiki>*foo</nowiki>''it''*bar
22160 !! html
22161 <ul><li>*foo*bar</li></ul>
22162 <ul><li>*foo<i>it</i>*bar</li></ul>
22163
22164 !!end
22165
22166 !! test
22167 Lists: 4. No escapes needed
22168 !! options
22169 parsoid
22170 !! wikitext
22171 *foo*bar
22172
22173 *''foo''*bar
22174
22175 *[[Foo]]: bar
22176
22177 *[[Foo]]*bar
22178 !! html
22179 <ul>
22180 <li>foo*bar
22181 </li>
22182 </ul>
22183 <ul>
22184 <li><i>foo</i>*bar
22185 </li>
22186 </ul>
22187 <ul>
22188 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
22189 </li>
22190 </ul>
22191 <ul>
22192 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
22193 </li>
22194 </ul>
22195 !!end
22196
22197 !! test
22198 Lists: 5. No unnecessary escapes
22199 !! wikitext
22200 * bar <span><nowiki>[[foo]]</nowiki></span>
22201
22202 * =bar <span><nowiki>[[foo]]</nowiki></span>
22203
22204 * [[bar <span><nowiki>[[foo]]</nowiki></span>
22205
22206 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
22207
22208 * =bar <span>foo]]</span>=
22209
22210 * <s></s>: a
22211
22212 * ''* foo''
22213 !! html
22214 <ul><li> bar <span>[[foo]]</span></li></ul>
22215 <ul><li> =bar <span>[[foo]]</span></li></ul>
22216 <ul><li> [[bar <span>[[foo]]</span></li></ul>
22217 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
22218 <ul><li> =bar <span>foo]]</span>=</li></ul>
22219 <ul><li> <s></s>: a</li></ul>
22220 <ul><li> <i>* foo</i></li></ul>
22221
22222 !!end
22223
22224 !! test
22225 Lists: 6. Escape bullets in SOL position
22226 !! options
22227 parsoid=html2wt
22228 !! html/parsoid
22229 <p><!--cmt-->*foo</p>
22230 !! wikitext
22231 <!--cmt--><nowiki>*</nowiki>foo
22232 !!end
22233
22234 !! test
22235 Lists: 7. Escape bullets in a multi-line context
22236 !! wikitext
22237 a
22238 <nowiki>*</nowiki>b
22239 !! html
22240 <p>a
22241 *b
22242 </p>
22243 !!end
22244
22245 !! test
22246 Lists: 8. Escape colons only if not present in tags
22247 !! options
22248 parsoid=html2wt
22249 !! html/parsoid
22250 <dl><dt>a:b<i>c:d</i></dt></dl>
22251 !! wikitext
22252 ; <nowiki>a:b</nowiki>''c:d''
22253 !! end
22254
22255 #### --------------- HRs ---------------
22256 #### 1. Single line
22257 #### -----------------------------------
22258
22259 !! test
22260 HRs: 1. Single line
22261 !! wikitext
22262 ----<nowiki>----</nowiki>
22263 ----=foo=
22264 ----*foo
22265 !! html+tidy
22266 <hr />
22267 <p>----</p>
22268 <hr />
22269 <p>=foo=</p>
22270 <hr />
22271 <p>*foo</p>
22272 !! end
22273
22274 #### --------------- Tables ---------------
22275 #### 1a. Simple example
22276 #### 1b. No escaping needed (!foo)
22277 #### 1c. No escaping needed (|foo)
22278 #### 1d. No escaping needed (|}foo)
22279 ####
22280 #### 2a. Nested in td (<td>foo|bar</td>)
22281 #### 2b. Nested in td (<td>foo||bar</td>)
22282 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
22283 ####
22284 #### 3a. Nested in th (<th>foo!bar</th>)
22285 #### 3b. Nested in th (<th>foo!!bar</th>)
22286 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
22287 ####
22288 #### 4a. Escape -
22289 #### 4b. Escape +
22290 #### 4c. No escaping needed
22291 #### --------------------------------------
22292
22293 !! test
22294 Tables: 1a. Simple example
22295 !! wikitext
22296 <nowiki>{|
22297 |}</nowiki>
22298 !! html
22299 <p>{|
22300 |}
22301 </p>
22302 !! end
22303
22304 !! test
22305 Tables: 1b. No escaping needed
22306 !! wikitext
22307 !foo
22308 !! html
22309 <p>!foo
22310 </p>
22311 !! end
22312
22313 !! test
22314 Tables: 1c. No escaping needed
22315 !! wikitext
22316 |foo
22317 !! html
22318 <p>|foo
22319 </p>
22320 !! end
22321
22322 !! test
22323 Tables: 1d. No escaping needed
22324 !! wikitext
22325 |}foo
22326 !! html
22327 <p>|}foo
22328 </p>
22329 !! end
22330
22331 !! test
22332 Tables: 2a. Nested in td
22333 !! options
22334 parsoid=html2wt
22335 !! html/parsoid
22336 <table><tbody><tr>
22337 <td>foo|bar</td></tr>
22338 <tr><td>x<div>a|b</div></td>
22339 </tbody></table>
22340 !! wikitext
22341 {|
22342 |<nowiki>foo|bar</nowiki>
22343 |-
22344 |x<div><nowiki>a|b</nowiki></div>
22345 |}
22346 !! html/php+tidy
22347 <table>
22348 <tr>
22349 <td>foo|bar</td>
22350 </tr>
22351 <tr>
22352 <td>x
22353 <div>a|b</div>
22354 </td>
22355 </tr>
22356 </table>
22357 !! end
22358
22359 !! test
22360 Tables: 2b. Nested in td
22361 !! options
22362 parsoid=html2wt
22363 !! html/parsoid
22364 <table><tbody><tr>
22365 <td>foo||bar</td>
22366 <td>a<i>b||c</i></td>
22367 <td>a<i><div>b||c</div></i></td>
22368 </tr></tbody></table>
22369 !! wikitext
22370 {|
22371 |<nowiki>foo||bar</nowiki>
22372 |a''<nowiki>b||c</nowiki>''
22373 |a''<div><nowiki>b||c</nowiki></div>''
22374 |}
22375 !! html/php
22376 <table>
22377 <tr>
22378 <td>foo||bar
22379 </td>
22380 <td>a<i>b||c</i>
22381 </td>
22382 <td>a<i><div>b||c</div></i>
22383 </td></tr></table>
22384
22385 !! end
22386
22387 !! test
22388 Tables: 2c. Nested in td -- no escaping needed
22389 !! wikitext
22390 {|
22391
22392 |foo!!bar
22393 |}
22394 !! html/*
22395 <table>
22396
22397 <tr>
22398 <td>foo!!bar
22399 </td></tr></table>
22400
22401 !! end
22402
22403 !! test
22404 Tables: 3a. Nested in th
22405 !! wikitext
22406 {|
22407
22408 !foo!bar
22409 |}
22410 !! html/*
22411 <table>
22412
22413 <tr>
22414 <th>foo!bar
22415 </th></tr></table>
22416
22417 !! end
22418
22419 !! test
22420 Tables: 3b. Nested in th
22421 !! options
22422 parsoid=html2wt
22423 !! html/parsoid
22424 <table><tbody>
22425 <tr><th>foo!!bar</th>
22426 <th><i>foo|bar</i></th>
22427 <th><i>foo!!bar</i></th>
22428 <th><i><span>foo!!bar</span></i></th>
22429 </tr></tbody></table>
22430 !! wikitext
22431 {|
22432 !<nowiki>foo!!bar</nowiki>
22433 !''<nowiki>foo|bar</nowiki>''
22434 !''<nowiki>foo!!bar</nowiki>''
22435 !''<span><nowiki>foo!!bar</nowiki></span>''
22436 |}
22437 !! html/php
22438 <table>
22439 <tr>
22440 <th>foo!!bar
22441 </th>
22442 <th><i>foo|bar</i>
22443 </th>
22444 <th><i>foo!!bar</i>
22445 </th>
22446 <th><i><span>foo!!bar</span></i>
22447 </th></tr></table>
22448
22449 !! end
22450
22451 !! test
22452 Tables: 3c. Nested in th
22453 !! options
22454 parsoid=html2wt
22455 !! html/parsoid
22456 <table><tbody>
22457 <tr><th>foo||bar</th>
22458 <th><span typeof="mw:Nowiki">foo||bar</span></th>
22459 </tr></tbody></table>
22460 !! wikitext
22461 {|
22462 !<nowiki>foo||bar</nowiki>
22463 !<nowiki>foo||bar</nowiki>
22464 |}
22465 !! html/php
22466 <table>
22467 <tr>
22468 <th>foo||bar
22469 </th>
22470 <th>foo||bar
22471 </th></tr></table>
22472
22473 !! end
22474
22475 !! test
22476 Tables: 4a. Escape -
22477 !! options
22478 parsoid=html2wt
22479 !! html/*
22480 <table>
22481
22482 <tr>
22483 <th>-bar
22484 </th></tr>
22485 <tr>
22486 <td>-bar
22487 </td></tr></table>
22488
22489 !! wikitext
22490 {|
22491
22492 !-bar
22493
22494 |-
22495 |<nowiki>-bar</nowiki>
22496 |}
22497 !! end
22498
22499 !! test
22500 Tables: 4b. Escape +
22501 !! options
22502 parsoid=html2wt
22503 !! html/*
22504 <table>
22505
22506 <tr>
22507 <th>+bar
22508 </th></tr>
22509 <tr>
22510 <td>+bar
22511 </td></tr></table>
22512
22513 !! wikitext
22514 {|
22515
22516 !+bar
22517
22518 |-
22519 |<nowiki>+bar</nowiki>
22520 |}
22521 !! end
22522
22523 !! test
22524 Tables: 4c. No escaping needed
22525 !! wikitext
22526 {|
22527 |foo-bar
22528 |foo+bar
22529 |-
22530 |''foo''-bar
22531 |''foo''+bar
22532 |-
22533 |foo
22534 bar|baz
22535 +bar
22536 -bar
22537 |-
22538 |x
22539 <div>a|b</div>
22540 |}
22541 !! html/php
22542 <table>
22543 <tr>
22544 <td>foo-bar
22545 </td>
22546 <td>foo+bar
22547 </td></tr>
22548 <tr>
22549 <td><i>foo</i>-bar
22550 </td>
22551 <td><i>foo</i>+bar
22552 </td></tr>
22553 <tr>
22554 <td>foo
22555 <p>bar|baz
22556 +bar
22557 -bar
22558 </p>
22559 </td></tr>
22560 <tr>
22561 <td>x
22562 <div>a|b</div>
22563 </td></tr></table>
22564
22565 !! html/parsoid
22566 <table><tbody>
22567 <tr><td>foo-bar</td><td>foo+bar</td></tr>
22568 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
22569 <tr><td>foo
22570 <p>bar|baz
22571 +bar
22572 -bar</p></td></tr>
22573 <tr><td>x
22574 <div>a|b</div></td>
22575 </tbody></table>
22576 !! end
22577
22578 !! test
22579 Tables: 4d. No escaping needed
22580 !! wikitext
22581 {|
22582 |[[Foo]]-bar
22583 ||+1
22584 ||-2
22585 |}
22586 !! html/php
22587 <table>
22588 <tr>
22589 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
22590 </td>
22591 <td>+1
22592 </td>
22593 <td>-2
22594 </td></tr></table>
22595
22596 !! html/parsoid
22597 <table>
22598 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
22599 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
22600 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
22601 </tbody></table>
22602 !! end
22603
22604 !! test
22605 Tables: Digest broken attributes on table and tr tag
22606 !! options
22607 parsoid=wt2html
22608 !! wikitext
22609 {| || |} ++
22610 |- || || ++ --
22611 |- > [
22612 |}
22613 !! html
22614 <table>
22615 <tbody>
22616 <tr></tr>
22617 <tr></tr>
22618 </tbody></table>
22619 !! end
22620
22621 !! test
22622 T97430: Don't emit empty nowiki pairs around marker meta tags
22623 !! options
22624 parsoid=html2wt
22625 !! html/parsoid
22626 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
22627 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
22628 !! wikitext
22629 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
22630 <nowiki>|</nowiki>** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
22631 !! end
22632
22633 !! test
22634 Unclosed xmlish element in table line shouldn't eat end delimiters
22635 !! wikitext
22636 {|
22637 | <foo
22638 | bar>
22639 |}
22640 !! html/php
22641 <table>
22642 <tr>
22643 <td> &lt;foo
22644 </td>
22645 <td> bar&gt;
22646 </td></tr></table>
22647
22648 !! html/parsoid
22649 <table>
22650 <tbody><tr><td> &lt;foo</td>
22651 <td> bar></td></tr>
22652 </tbody></table>
22653 !! end
22654
22655 #### --------------- Links ----------------
22656 #### 1. Quote marks in link text
22657 #### 2. Wikilinks: Escapes needed
22658 #### 3. Wikilinks: No escapes needed
22659 #### 4. Extlinks: Escapes needed
22660 #### 5. Extlinks: No escapes needed
22661 #### --------------------------------------
22662 !! test
22663 Links 1. WikiLinks: No escapes needed
22664 !! wikitext
22665 [[Foo|Foo''boo'']]
22666 [[Foo|[Foobar]]]
22667 [[Foo|x [Foobar] x]]
22668 !! html/php
22669 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
22670 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
22671 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
22672 </p>
22673 !! html/parsoid
22674 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
22675 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
22676 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
22677 !! end
22678
22679 !! test
22680 Links 2. WikiLinks: Escapes needed
22681 !! options
22682 parsoid=html2wt
22683 !! html/parsoid
22684 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
22685 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
22686 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
22687 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
22688 <a href="Foo" rel="mw:WikiLink">|Bar</a>
22689 <a href="Foo" rel="mw:WikiLink">]]bar</a>
22690 <a href="Foo" rel="mw:WikiLink">[[bar</a>
22691 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
22692 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
22693 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
22694 !! wikitext
22695 [[Foo|<nowiki>Foobar]</nowiki>]]
22696 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
22697 [[Foo|<nowiki>[[Bar]]</nowiki>]]
22698 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
22699 [[Foo|<nowiki>|Bar</nowiki>]]
22700 [[Foo|<nowiki>]]bar</nowiki>]]
22701 [[Foo|<nowiki>[[bar</nowiki>]]
22702 [[Foo|<nowiki>x [[ y</nowiki>]]
22703 [[Foo|<nowiki>x ]] y</nowiki>]]
22704 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
22705 !! html/php
22706 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
22707 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
22708 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
22709 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
22710 <a href="/wiki/Foo" title="Foo">|Bar</a>
22711 <a href="/wiki/Foo" title="Foo">]]bar</a>
22712 <a href="/wiki/Foo" title="Foo">[[bar</a>
22713 <a href="/wiki/Foo" title="Foo">x [[ y</a>
22714 <a href="/wiki/Foo" title="Foo">x ]] y</a>
22715 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
22716 </p>
22717 !! end
22718
22719 !! test
22720 Links 3. WikiLinks: No escapes needed
22721 !! wikitext
22722 [[Foo|[Foobar]]
22723 [[Foo|foo|bar]]
22724 !! html/php
22725 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
22726 <a href="/wiki/Foo" title="Foo">foo|bar</a>
22727 </p>
22728 !! html/parsoid
22729 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
22730 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
22731 !! end
22732
22733 !! test
22734 Links 4. ExtLinks: Escapes needed
22735 !! options
22736 parsoid=html2wt
22737 !! html/parsoid
22738 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
22739 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
22740 <p>[http://google.com]</p>
22741 <p>[http://google.com google]</p>
22742 !! wikitext
22743 [http://google.com <nowiki>[google]</nowiki>]
22744 [http://google.com <nowiki>google]</nowiki>]
22745
22746 <nowiki>[http://google.com]</nowiki>
22747
22748 <nowiki>[http://google.com google]</nowiki>
22749
22750 !! html/php
22751 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
22752 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
22753 </p><p>[http://google.com]
22754 </p><p>[http://google.com google]
22755 </p>
22756 !! end
22757
22758 !! test
22759 Links 5. ExtLinks: No escapes needed
22760 !! wikitext
22761 [http://google.com [google]
22762 !! html/php
22763 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
22764 </p>
22765 !! html/parsoid
22766 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
22767 !! end
22768
22769 !! test
22770 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
22771 !! html/parsoid
22772 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
22773 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
22774 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
22775 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
22776 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
22777 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
22778 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
22779 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
22780 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
22781 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
22782 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
22783 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
22784 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
22785 </p>
22786 !! wikitext
22787 x<nowiki/>http://example.com<nowiki/>y
22788 http://example.com<nowiki/>?x
22789 http://example.com<nowiki/>&x
22790 http://example.com<nowiki/>'x
22791 http://example.com<nowiki/>,x
22792 http://example.com<nowiki/>.x
22793 http://example.com<nowiki/>;x
22794 http://example.com<nowiki/>:x
22795 http://example.com<nowiki/>;x
22796 http://example.com<nowiki/>!x
22797 http://example.com<nowiki/>=x
22798 http://example.com<nowiki/>(x)
22799 http://example.com(x<nowiki/>)
22800 !! end
22801
22802 !! test
22803 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
22804 !! html/parsoid
22805 <p>x
22806 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
22807 y
22808 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
22809 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
22810 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
22811 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
22812 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
22813 </p>
22814 !! wikitext
22815 x
22816 http://example.com
22817 y
22818 "http://example.com"
22819 (http://example.com)
22820 (http://example.com) foo
22821 http://example.com,
22822 http://example.com, foo
22823 !! html/php
22824 <p>x
22825 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
22826 y
22827 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
22828 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
22829 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
22830 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
22831 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
22832 </p>
22833 !! end
22834
22835 !! test
22836 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
22837 !! html/parsoid
22838 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
22839 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
22840 !! wikitext
22841 http://example.com.,;:!?\
22842 -http://example.com:
22843 !! html/php
22844 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
22845 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
22846 </p>
22847 !! end
22848
22849 !! test
22850 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
22851 !! html/parsoid
22852 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
22853 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
22854 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
22855 !! wikitext
22856 RFC 123<nowiki/>4
22857 RFC 123<nowiki/>y
22858 X<nowiki/>RFC 123<nowiki/>y
22859 !! end
22860
22861 !! test
22862 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
22863 !! html/parsoid
22864 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
22865 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
22866 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
22867 </p>
22868 !! wikitext
22869 RFC 123?foo
22870 RFC 123&foo
22871 -RFC 123-
22872 !! html/php
22873 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
22874 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
22875 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
22876 </p>
22877 !! end
22878
22879 !! test
22880 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
22881 !! html/parsoid
22882 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
22883 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
22884 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
22885 !! wikitext
22886 PMID 123<nowiki/>4
22887 PMID 123<nowiki/>y
22888 X<nowiki/>PMID 123<nowiki/>y
22889 !! end
22890
22891 !! test
22892 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
22893 !! html/parsoid
22894 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
22895 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
22896 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
22897 </p>
22898 !! wikitext
22899 PMID 123?foo
22900 PMID 123&foo
22901 -PMID 123-
22902 !! html/php
22903 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
22904 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
22905 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
22906 </p>
22907 !! end
22908
22909 !! test
22910 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
22911 !! html/parsoid
22912 <p><a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
22913 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
22914 a<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
22915 </p>
22916 !! wikitext
22917 ISBN 1234567890<nowiki/>1
22918 ISBN 1234567890<nowiki/>x
22919 a<nowiki/>ISBN 1234567890<nowiki/>b
22920 !! end
22921
22922 !! test
22923 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
22924 !! html/parsoid
22925 <p>-<a href="./Special:BookSources/1234567890" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
22926 !! wikitext
22927 -ISBN 1234567890's
22928 !! html/php
22929 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
22930 </p>
22931 !! end
22932
22933 !! test
22934 Links 14. Protect link-like plain text. (Parsoid bug T78425)
22935 !! options
22936 parsoid=html2wt
22937 !! html/*
22938 <p>this is not a link: http://example.com
22939 </p>
22940 !! wikitext
22941 <nowiki>this is not a link: http://example.com</nowiki>
22942 !! end
22943
22944 !! test
22945 Links 15. Link trails can't become link prefixes.
22946 !! options
22947 language=is
22948 !! wikitext
22949 [[Söfnuður]]-[[00]]
22950 !! html/php
22951 <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>
22952 </p>
22953 !! html/parsoid
22954 <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>
22955 !! end
22956
22957 #### --------------- Quotes ---------------
22958 #### 1. Quotes inside <b> and <i>
22959 #### 2. Link fragments separated by <i> and <b> tags
22960 #### 3. Link fragments inside <i> and <b>
22961 #### 4. No escaping needed
22962 #### --------------------------------------
22963 !! test
22964 1a. Quotes inside <b> and <i>
22965 !! options
22966 parsoid=html2wt,wt2wt
22967 !! wikitext
22968 ''<nowiki/>'foo'''
22969 ''<nowiki>''foo''</nowiki>''
22970 ''<nowiki>'''foo'''</nowiki>''
22971 ''foo''<nowiki/>'s
22972 '''<nowiki/>'foo''''
22973 '''<nowiki>''foo''</nowiki>'''
22974 '''<nowiki>'''foo'''</nowiki>'''
22975 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
22976 '''foo'''<nowiki/>'s
22977 '''foo''
22978 ''foo''<nowiki/>'
22979 ''foo'''<nowiki/>'
22980 '''foo''<nowiki/>'
22981 ''''foo'''
22982 '''foo'''<nowiki/>'
22983 ''''foo'''<nowiki/>'
22984 ''fools'<span> errand</span>''
22985 ''<span>fool</span>'s errand''
22986 '<nowiki/>''foo'' bar '''baz''
22987 a|!*#-:;+-~[]{}b'''x''
22988 !! html/*
22989 <p><i>'foo'</i>
22990 <i>''foo''</i>
22991 <i>'''foo'''</i>
22992 <i>foo</i>'s
22993 <b>'foo'</b>
22994 <b>''foo''</b>
22995 <b>'''foo'''</b>
22996 <b>foo'<i>bar'</i>baz</b>
22997 <b>foo</b>'s
22998 '<i>foo</i>
22999 <i>foo</i>'
23000 <i>foo'</i>'
23001 '<i>foo</i>'
23002 '<b>foo</b>
23003 <b>foo</b>'
23004 '<b>foo</b>'
23005 <i>fools'<span> errand</span></i>
23006 <i><span>fool</span>'s errand</i>
23007 '<i>foo</i> bar '<i>baz</i>
23008 a|!*#-:;+-~[]{}b'<i>x</i>
23009 </p>
23010 !! end
23011
23012 !! test
23013 1b. Quotes inside <b> and <i> with other tags on same line
23014 !! options
23015 parsoid=html2wt,wt2wt
23016 !! wikitext
23017 '''a'' foo ''[[bar]]''
23018 ''a''' foo ''[[bar]]''
23019 ''a''' foo '''{{echo|[[bar]]}}'''
23020 [[foo]] x'''[[bar]]''
23021 '''foo'' <ref>test</ref>
23022 '''foo'' <div title="name">test</div>
23023 '''foo'' and <br> bar
23024 <references />
23025 !! html
23026 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23027 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23028 <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>
23029 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
23030 '<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>
23031 '<i>foo</i> <div title="name">test</div>
23032 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
23033 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
23034 <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>
23035 </ol>
23036 !! end
23037
23038 !! test
23039 2. Link fragments separated by <i> and <b> tags
23040 !! wikitext
23041 [[''foo''<nowiki>hello]]</nowiki>
23042
23043 [['''foo'''<nowiki>hello]]</nowiki>
23044 !! html
23045 <p>[[<i>foo</i>hello]]
23046 </p><p>[[<b>foo</b>hello]]
23047 </p>
23048 !! end
23049
23050 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
23051 # this is one of the shortcomings of this format
23052 !! test
23053 3. Link fragments inside <i> and <b>
23054 !! wikitext
23055 ''[[foo''<nowiki>]]</nowiki>
23056
23057 '''[[foo'''<nowiki>]]</nowiki>
23058 !! html
23059 <p><i>[[foo</i>]]
23060 </p><p><b>[[foo</b>]]
23061 </p>
23062 !! end
23063
23064 !! test
23065 4. No escaping needed
23066 !! wikitext
23067 '<span>''bar''</span>'
23068 '<span>'''bar'''</span>'
23069 'a:b'foo
23070 !! html
23071 <p>'<span><i>bar</i></span>'
23072 '<span><b>bar</b></span>'
23073 'a:b'foo
23074 </p>
23075 !! end
23076
23077 #### ----------- Paragraphs ---------------
23078 #### 1. No unnecessary escapes
23079 #### --------------------------------------
23080
23081 !! test
23082 1. No unnecessary escapes
23083 !! wikitext
23084 bar <span><nowiki>[[foo]]</nowiki></span>
23085
23086 =bar <span><nowiki>[[foo]]</nowiki></span>
23087
23088 [[bar <span><nowiki>[[foo]]</nowiki></span>
23089
23090 ]]bar <span><nowiki>[[foo]]</nowiki></span>
23091
23092 =bar <span>foo]]</span><nowiki>=</nowiki>
23093 !! html
23094 <p>bar <span>[[foo]]</span>
23095 </p><p>=bar <span>[[foo]]</span>
23096 </p><p>[[bar <span>[[foo]]</span>
23097 </p><p>]]bar <span>[[foo]]</span>
23098 </p><p>=bar <span>foo]]</span>=
23099 </p>
23100 !!end
23101
23102 #### ----------------------- PRE --------------------------
23103 #### 1. Leading whitespace in SOL context should be escaped
23104 #### ------------------------------------------------------
23105 !! test
23106 1. Leading whitespace in SOL context should be escaped
23107 !! options
23108 parsoid
23109 !! wikitext
23110 <nowiki> </nowiki>a
23111
23112 <nowiki> </nowiki> a
23113
23114 <nowiki> </nowiki>a(tab)
23115
23116 <nowiki> </nowiki> a
23117 <!--cmt-->
23118 <nowiki> </nowiki> a
23119
23120 a
23121 <nowiki> </nowiki>b
23122
23123 a
23124 <nowiki> </nowiki>b
23125
23126 a
23127 <nowiki> </nowiki> b
23128 !! html
23129 <p> a</p>
23130 <p> a</p>
23131 <p> a(tab)</p>
23132 <p> a</p>
23133 <p><!--cmt--> a</p>
23134 <p>a
23135 b</p>
23136 <p>a
23137 b</p>
23138 <p>a
23139 b</p>
23140 !! end
23141
23142 !! test
23143 2. Leading whitespace in non-indent-pre contexts should not be escaped
23144 !! options
23145 parsoid
23146 !! wikitext
23147 foo <ref>''a''
23148 b</ref>
23149 <references />
23150 !! html
23151 <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>
23152 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23153 <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>
23154 b</span></li>
23155 </ol>
23156 !! end
23157
23158 !! test
23159 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
23160 !! options
23161 parsoid
23162 !! wikitext
23163 <blockquote>
23164 a
23165 <span>b</span>
23166 c
23167 </blockquote>
23168 !! html
23169 <blockquote>
23170 <p>
23171 a
23172 <span>b</span>
23173 c</p>
23174 </blockquote>
23175 !! end
23176
23177 !! test
23178 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
23179 !! options
23180 parsoid
23181 !! wikitext
23182 [[File:Foobar.jpg|thumb|caption]]
23183 !! html/parsoid
23184 <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>
23185 !! end
23186
23187 !! test
23188 5. Nowiki escaping should account for indent-pres
23189 !! options
23190 parsoid=html2wt
23191 !! html/parsoid
23192 <pre>==foo==</pre>
23193 !! wikitext
23194 ==foo==
23195 !! end
23196
23197 !!test
23198 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
23199 !! options
23200 parsoid
23201 !! wikitext
23202 * foo
23203 * bar
23204 !! html
23205 <pre>
23206 * foo
23207 * bar
23208 </pre>
23209 !! end
23210
23211 #### --------------- Behavior Switches --------------------
23212
23213 !! test
23214 1. Valid behavior switches should be escaped
23215 !! options
23216 parsoid=html2wt
23217 !! html/parsoid
23218 __TOC__
23219 <i>__TOC__</i>
23220 !! wikitext
23221 <nowiki>__TOC__</nowiki>
23222 ''<nowiki>__TOC__</nowiki>''
23223 !! end
23224
23225 !! test
23226 2. Invalid behavior switches should not be escaped
23227 !! options
23228 parsoid=html2wt
23229 !! html/parsoid
23230 __TOO__
23231 __|__
23232 !! wikitext
23233 __TOO__
23234 __|__
23235 !! end
23236
23237 # We use indent-pre as an indirect way to test for sol-transparent behavior.
23238 !! test
23239 Behavior switches should be SOL-transparent
23240 !! wikitext
23241 __TOC__
23242
23243 <!-- this one's bogus -->
23244 __TOO__
23245
23246 __TOC__ foo
23247
23248 __TOC__ bar
23249 !! html/parsoid
23250 <meta property="mw:PageProp/toc" />
23251
23252 <!-- this one's bogus -->
23253 <pre>__TOO__</pre>
23254
23255 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
23256
23257 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
23258 !! end
23259
23260 #### --------------- HTML tags ---------------
23261 #### 1. a tags
23262 #### 2. other tags
23263 #### 3. multi-line html tag
23264 #### 4. extension tags
23265 #### -----------------------------------------
23266 !! test
23267 1. a tags
23268 !! options
23269 parsoid
23270 !! wikitext
23271 <a href="http://google.com">google</a>
23272 !! html
23273 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
23274 !! end
23275
23276 !! test
23277 2. other tags
23278 !! wikitext
23279 * <nowiki><div>foo</div></nowiki>
23280 * <nowiki><div style="color:red">foo</div></nowiki>
23281 * <nowiki><td></nowiki>
23282 !! html
23283 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
23284 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
23285 <li> &lt;td&gt;</li></ul>
23286
23287 !! end
23288
23289 !! test
23290 3. multi-line html tag
23291 !! wikitext
23292 <nowiki><div
23293 >foo</div
23294 ></nowiki>
23295 !! html
23296 <p>&lt;div
23297 &gt;foo&lt;/div
23298 &gt;
23299 </p>
23300 !! end
23301
23302 !! test
23303 4. extension tags
23304 !! wikitext
23305 <nowiki><ref>foo</ref></nowiki>
23306
23307 <nowiki><ref>bar</nowiki>
23308
23309 baz<nowiki></ref></nowiki>
23310 !! html
23311 <p>&lt;ref&gt;foo&lt;/ref&gt;
23312 </p><p>&lt;ref&gt;bar
23313 </p><p>baz&lt;/ref&gt;
23314 </p>
23315 !! end
23316
23317 #### --------------- Others ---------------
23318 !! test
23319 Escaping nowikis
23320 !! wikitext
23321 &lt;nowiki&gt;foo&lt;/nowiki&gt;
23322 !! html
23323 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
23324 </p>
23325 !! end
23326
23327 ## The quote-char in the input is necessary for triggering the bug
23328 !! test
23329 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
23330 !! options
23331 parsoid=wt2wt,html2wt
23332 !! wikitext
23333 foo's bar :
23334 !! html
23335 <p>foo's bar :</p>
23336 !! end
23337
23338 !! test
23339
23340 Tag-like HTML structures are passed through as text
23341 !! wikitext
23342 <x y>
23343
23344 <x.y>
23345
23346 <x-y>
23347
23348 1>2
23349
23350 x<y
23351
23352 a>b
23353
23354 1<d e>f
23355 !! html
23356 <p>&lt;x y&gt;
23357 </p><p>&lt;x.y&gt;
23358 </p><p>&lt;x-y&gt;
23359 </p><p>1&gt;2
23360 </p><p>x&lt;y
23361 </p><p>a&gt;b
23362 </p><p>1&lt;d e&gt;f
23363 </p>
23364 !! end
23365
23366 !! test
23367 HTML tag with necessary entities in attributes
23368 !! wikitext
23369 <span title="&amp;amp;">foo</span>
23370 !! html
23371 <p><span title="&amp;amp;">foo</span>
23372 </p>
23373 !! end
23374
23375 !! test
23376 HTML tag with 'unnecessary' entity encoding in attributes
23377 !! wikitext
23378 <span title="&amp;">foo</span>
23379 !! html
23380 <p><span title="&amp;">foo</span>
23381 </p>
23382 !! end
23383
23384 !! test
23385 HTML tag with broken attribute value quoting
23386 !! wikitext
23387 <span title="Hello world>Foo</span>
23388 !! html/php
23389 <p><span>Foo</span>
23390 </p>
23391 !! html/parsoid
23392 <p><span title="Hello world">Foo</span>
23393 </p>
23394 !! end
23395
23396 !! test
23397 Parsoid-only: HTML tag with broken attribute value quoting
23398 !! options
23399 parsoid
23400 !! wikitext
23401 <span title="Hello world>Foo</span>
23402 !! html
23403 <p><span title="Hello world">Foo</span>
23404 </p>
23405 !! end
23406
23407 !! test
23408 Table with broken attribute value quoting
23409 !! wikitext
23410 {|
23411 | title="Hello world|Foo
23412 |}
23413 !! html/php
23414 <table>
23415 <tr>
23416 <td>Foo
23417 </td></tr></table>
23418
23419 !! html/parsoid
23420 <table>
23421 <tr>
23422 <td title="Hello world">Foo
23423 </td></tr></table>
23424
23425 !! end
23426
23427 !! test
23428 Table with broken attribute value quoting on consecutive lines
23429 !! wikitext
23430 {|
23431 | title="Hello world|Foo
23432 | style="color:red|Bar
23433 |}
23434 !! html/php
23435 <table>
23436 <tr>
23437 <td>Foo
23438 </td>
23439 <td>Bar
23440 </td></tr></table>
23441
23442 !! html/parsoid
23443 <table><tbody>
23444 <tr>
23445 <td title="Hello world">Foo
23446 </td><td style="color: red">Bar
23447 </td></tr></tbody></table>
23448
23449 !! end
23450
23451 !! test
23452 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23453 !! options
23454 parsoid
23455 !! wikitext
23456 {{}}
23457 !! html
23458 {{}}
23459 !! end
23460
23461 !! test
23462 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23463 !! options
23464 parsoid
23465 !! wikitext
23466 }}{{
23467 !! html
23468 }}{{
23469 !! end
23470
23471 !!test
23472 Accept empty td cell attribute
23473 !! wikitext
23474 {|
23475 | align="center" | foo || |
23476 |}
23477 !! html
23478 <table>
23479 <tr>
23480 <td align="center"> foo </td>
23481 <td>
23482 </td></tr></table>
23483
23484 !!end
23485
23486 !!test
23487 Non-empty attributes in th-cells
23488 !! wikitext
23489 {|
23490 ! Foo !! style="color: red" | Bar
23491 |}
23492 !! html
23493 <table>
23494 <tr>
23495 <th> Foo </th>
23496 <th style="color: red"> Bar
23497 </th></tr></table>
23498
23499 !!end
23500
23501 !!test
23502 Accept empty attributes in th-cells
23503 !! wikitext
23504 {|
23505 !| foo !!| bar
23506 |}
23507 !! html
23508 <table>
23509 <tr>
23510 <th> foo </th>
23511 <th> bar
23512 </th></tr></table>
23513
23514 !!end
23515
23516 !!test
23517 Empty table rows go away
23518 !! wikitext
23519 {|
23520 | Hello
23521 | there
23522 |- class="foo"
23523 |-
23524 |}
23525 !! html
23526 <table>
23527 <tr>
23528 <td> Hello
23529 </td>
23530 <td> there
23531 </td></tr>
23532
23533 </table>
23534
23535 !! end
23536
23537 ###
23538 ### Parsoid-centric tests for testing RTing of inter-element separators
23539 ### Edge cases not tested by existing parser tests and specific to
23540 ### Parsoid-specific serialization strategies.
23541 ###
23542
23543 !!test
23544 RT-ed inter-element separators should be valid separators
23545 !! wikitext
23546 {|
23547 |- [[foo]]
23548 |}
23549 !! html
23550 <table>
23551
23552 </table>
23553
23554 !!end
23555
23556 # Parsoid-only since PHP parser relies on Tidy for correct output
23557 !!test
23558 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
23559 !!options
23560 parsoid
23561 !! wikitext
23562 {|
23563 |<small>foo
23564 bar
23565 |}
23566
23567 {|
23568 |<small>foo<small>
23569 |}
23570 !! html
23571 <table>
23572 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
23573 <p>bar</p></small></td></tr>
23574 </tbody></table>
23575
23576 <table>
23577 <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>
23578 </tbody></table>
23579 !!end
23580
23581 # Note that the "style" attribute is really a template parameter here.
23582 # The = would have to be {{=}} if you wanted the literal.
23583 !!test
23584 Empty TD followed by TD with tpl-generated attribute
23585 !! wikitext
23586 {|
23587 |-
23588 |
23589 |{{echo|style='color:red'}}|foo
23590 |}
23591 !! html
23592 <table>
23593
23594 <tr>
23595 <td>
23596 </td>
23597 <td>foo
23598 </td></tr></table>
23599
23600 !!end
23601
23602 !!test
23603 Indented table with an empty td
23604 !! wikitext
23605 {|
23606 |-
23607 |
23608 |foo
23609 |}
23610 !! html
23611 <table>
23612
23613 <tr>
23614 <td>
23615 </td>
23616 <td>foo
23617 </td></tr></table>
23618
23619 !!end
23620
23621 ## We have some newline diffs RT-ing this edge case
23622 ## and it is not important enough -- we seem to be emitting
23623 ## at most 2 newlines after a </tr> and this is unrelated to
23624 ## the issue from T85627 that this is testing.
23625 !!test
23626 Indented table with blank lines in between (T85627)
23627 !! options
23628 parsoid=wt2html
23629 !! wikitext
23630 {|
23631 |foo
23632
23633
23634 |}
23635 !! html
23636 <table>
23637
23638 <tr>
23639 <td>foo
23640 </td></tr></table>
23641
23642 !!end
23643
23644 !!test
23645 Indented block & table
23646 !! wikitext
23647 <div>foo</div>
23648 {|
23649 |foo
23650 |}
23651 !! html/php
23652 <div>foo</div>
23653 <table>
23654 <tr>
23655 <td>foo
23656 </td></tr></table>
23657
23658 !! html/parsoid
23659 <div data-parsoid='{"stx":"html"}'>foo</div>
23660 <table><tbody>
23661 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
23662 </tbody></table>
23663 !!end
23664
23665 !! test
23666 Indent and comment before table row
23667 !! wikitext
23668 {|
23669 <!--hi-->|-
23670 | there
23671 |}
23672 !! html/php
23673 <table>
23674
23675 <tr>
23676 <td> there
23677 </td></tr></table>
23678
23679 !! html/parsoid
23680 <table>
23681 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
23682 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
23683 </tbody></table>
23684 !! end
23685
23686 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
23687 !!test
23688 Empty TR followed by a template-generated TR
23689 !!options
23690 parsoid
23691 !! wikitext
23692 {|
23693 |-
23694 {{echo|<tr><td>foo</td></tr>}}
23695 |}
23696 !! html
23697 <table>
23698 <tbody>
23699 <tr></tr>
23700 <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}}]}'>
23701 <td>foo</td></tr>
23702 </tbody></table>
23703 !!end
23704
23705 ## PHP and parsoid output differ for this, and since this is primarily
23706 ## for testing Parsoid's serializer, marking this Parsoid only
23707 !!test
23708 Empty TR followed by mixed-ws-comment line should RT correctly
23709 !!options
23710 parsoid
23711 !! wikitext
23712 {|
23713 |-
23714 <!--c-->
23715 |-
23716 <!--c--> <!--d-->
23717 |}
23718 !! html
23719 <table>
23720 <tbody>
23721 <tr></tr>
23722 <!--c-->
23723 <tr>
23724 <!--c--> </tr><!--d-->
23725 </tbody></table>
23726
23727 !!end
23728
23729 !!test
23730 Multi-line image caption generated by templates with/without trailing newlines
23731 !! wikitext
23732 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
23733 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
23734 !! html/parsoid
23735 <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>
23736 <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>
23737 !!end
23738
23739 !! test
23740 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
23741 !! options
23742 parsoid=html2wt
23743 !! html/parsoid
23744 <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>
23745
23746 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
23747 !! wikitext
23748 <includeonly>foo</includeonly>
23749 new para
23750
23751 [[Category:Foo]]
23752
23753 = new heading =
23754 !! end
23755
23756 ## PHP emits broken html for this, and since this is primarily
23757 ## a Parsoid serializer test, marking this Parsoid only
23758 !!test
23759 Improperly nested inline or quotes tags with whitespace in between
23760 !! wikitext
23761 <span> <s>x</span> </s>
23762 ''' ''x''' ''
23763 !! html/parsoid
23764 <p><span> <s>x</s></span><s> </s>
23765 <b> <i>x</i></b><i> </i>
23766 </p>
23767 !!end
23768
23769 !!test
23770 Encapsulate protected attributes from wt
23771 !! wikitext
23772 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
23773 !! html/parsoid
23774 <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>
23775 </body>
23776 !!end
23777
23778 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
23779 ## Having nested or stray pre tags results in the attempt to add duplicates,
23780 ## causing an assertion fail. This test tries to prevent that situation.
23781 !!test
23782 Ensure ParagraphWrapper can deal with stray closing pre tags
23783 !!options
23784 parsoid=wt2html
23785 !! wikitext
23786 plain text</pre>
23787 !! html/parsoid
23788 plain text
23789 !!end
23790
23791 !!test
23792 1. Ensure fostered text content is wrapped in element nodes
23793 !!options
23794 parsoid=wt2html
23795 !! wikitext
23796 <table>hi</table><table>ho</table>
23797 !! html/parsoid
23798 <p>hi</p>
23799 <table></table>
23800 <p>ho</p>
23801 <table></table>
23802 !!end
23803
23804 !!test
23805 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
23806 !!options
23807 parsoid=wt2html,wt2wt
23808 !! wikitext
23809 <table>
23810 <tr> || ||
23811 <td> a
23812 </table>
23813 !! html/parsoid
23814 <p> || ||
23815 </p><table>
23816 <tbody><tr><td> a</td></tr>
23817 </tbody></table>
23818 !!end
23819
23820 !!test
23821 Encapsulation properly handles null DSR information from foster box
23822 !!options
23823 parsoid=wt2html,wt2wt
23824 !! wikitext
23825 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
23826 !! html/parsoid
23827 <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>
23828 !!end
23829
23830 !!test
23831 1. Encapsulate foster-parented transclusion content
23832 !!options
23833 parsoid=wt2wt,wt2html
23834 !! wikitext
23835 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
23836 !! html/parsoid
23837 <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>
23838 <tbody>
23839 <tr>
23840 <td>bar</td>
23841 </tr>
23842 </tbody>
23843 </table>
23844 !!end
23845
23846 !!test
23847 2. Encapsulate foster-parented transclusion content
23848 !!options
23849 parsoid=wt2wt,wt2html
23850 !! wikitext
23851 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
23852 !! html/parsoid
23853 <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>
23854 <table>
23855 <tbody>
23856 <tr>
23857 <td>bar</td>
23858 </tr>
23859 </tbody>
23860 </table>
23861 !!end
23862
23863 !!test
23864 3. Encapsulate foster-parented transclusion content
23865 !!options
23866 parsoid=wt2wt,wt2html
23867 !! wikitext
23868 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
23869 !! html/parsoid
23870 <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;]}">
23871 <p>foo</p>
23872 </div>
23873 <table>
23874 <tbody>
23875 <tr>
23876 <td>bar</td>
23877 </tr>
23878 </tbody>
23879 </table>
23880 !!end
23881
23882 !!test
23883 4. Encapsulate foster-parented transclusion content
23884 !!options
23885 parsoid=wt2wt,wt2html
23886 !! wikitext
23887 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
23888 !! html/parsoid
23889 <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;]}">
23890 <p>foo</p>
23891 </div>
23892 <table>
23893 <tbody>
23894 <tr>
23895 <td>bar</td>
23896 </tr>
23897 </tbody>
23898 </table>
23899 !!end
23900
23901 !!test
23902 5. Encapsulate foster-parented transclusion content
23903 !!options
23904 parsoid=wt2wt,wt2html
23905 !! wikitext
23906 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
23907 !! html/parsoid
23908 <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>
23909 <table>
23910 <tbody>
23911 <tr>
23912 <td>
23913 <div>
23914 <p>foo</p>
23915 </div>
23916 </td>
23917 </tr>
23918 </tbody>
23919 </table>
23920 !!end
23921
23922 !!test
23923 6. Encapsulate foster-parented transclusion content
23924 !!options
23925 parsoid=wt2wt,wt2html
23926 !! wikitext
23927 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
23928 !! html/parsoid
23929 <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>
23930 <table>
23931 <tbody>
23932 <tr>
23933 <td>
23934 <div>
23935 <p>foo</p>
23936 </div>
23937 </td>
23938 </tr>
23939 </tbody>
23940 </table>
23941 <p>ok</p>
23942 !!end
23943
23944 !!test
23945 7. Encapsulate foster-parented transclusion content
23946 !!options
23947 parsoid=wt2wt,wt2html
23948 !! wikitext
23949 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
23950 !! html/parsoid
23951 <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>
23952 <table>
23953 <tbody>
23954 <tr>
23955 <td>bar</td>
23956 </tr>
23957 </tbody>
23958 </table>
23959 !!end
23960
23961 # Note that the wt is broken on purpose: the = should be {{=}} if you
23962 # don't want it to be a template parameter key.
23963 !!test
23964 8. Encapsulate foster-parented transclusion content
23965 !!options
23966 parsoid=wt2wt,wt2html
23967 !! wikitext
23968 {{echo|a
23969 }}{|{{echo|style='color:red'}}
23970 |-
23971 |b
23972 |}
23973 !! html/parsoid
23974 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
23975 <span> </span>
23976 <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>
23977 <table>
23978 <tbody>
23979 <tr>
23980 <td>b</td>
23981 </tr>
23982 </tbody>
23983 </table>
23984 !!end
23985
23986 !!test
23987 9. Encapsulate foster-parented transclusion content
23988 !!options
23989 parsoid=wt2wt,wt2html
23990 !! wikitext
23991 <table>{{echo|hi</table>hello}}
23992 !! html/parsoid
23993 <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>
23994 !!end
23995
23996 !!test
23997 Table in fosterable position
23998 !!options
23999 parsoid=wt2html,wt2wt
24000 !! wikitext
24001 {{OpenTable}}
24002 <div>
24003 {|
24004 |}
24005 </div>
24006 |}
24007 !! html/parsoid
24008 <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">
24009 </span>
24010 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
24011
24012 <table>
24013 </table>
24014 !!end
24015
24016 # Parsoid only for bug 64747
24017 !! test
24018 Properly encapsulate empty-content transclusions in fosterable positions
24019 !! wikitext
24020 <table>
24021 {{#if:|
24022 <td>foo</td>
24023 }}
24024 </table>
24025 !! html/parsoid
24026 <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":["","","",""]}]]}'>
24027
24028 </table>
24029 !! end
24030
24031 !!test
24032 Support <object> element with .data attribute
24033 !!options
24034 parsoid=html2wt
24035 !! html/parsoid
24036 <object data="test.swf"></object>
24037 !! wikitext
24038 <object data="test.swf"></object>
24039 !!end
24040
24041 !! test
24042 Don't block XML namespace declaration
24043 !! wikitext
24044 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24045 !! html/php
24046 <p><span>MediaWiki</span>
24047 </p>
24048 !! html/parsoid
24049 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
24050 !! end
24051
24052 # -----------------------------------------------------------------
24053 # The following section of tests are primarily to spec requirements
24054 # around serialization of new/edited content.
24055 #
24056 # All these tests are marked Parsoid html2wt and html2html only
24057 # ----------------------------------------------------------------
24058
24059 # 'mi' is a localinterwiki prefix as well as a language
24060 !! test
24061 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
24062 !! options
24063 parsoid=html2wt
24064 !! html/parsoid
24065 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
24066 !! wikitext
24067 [[Foo]]
24068 !! end
24069
24070 # See T93839
24071 !! test
24072 New wikilinks should be serialized properly
24073 !! options
24074 parsoid=html2wt
24075 !! html/parsoid
24076 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
24077 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
24078 !! wikitext
24079 [[Foo]]
24080 [[Foo]]
24081 !! end
24082
24083 !! test
24084 New wiki links (href variations)
24085 !! options
24086 parsoid=html2wt
24087 !! html/parsoid
24088 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24089 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
24090 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
24091 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
24092 !! wikitext
24093 [[Foo_bar]]
24094 [[Foo_bar]]
24095 [[Foo_bar]]
24096 [[Toxine bactérienne]]
24097 !! end
24098
24099 !! test
24100 New wiki links (content string variations)
24101 !! options
24102 parsoid=html2wt
24103 !! html/parsoid
24104 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24105 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
24106 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
24107 !! wikitext
24108 [[Foo_bar]]
24109 [[Foo bar]]
24110 [[Foo_bar|./Foo_bar]]
24111 !! end
24112
24113 !! test
24114 New category links (href variations)
24115 !! options
24116 parsoid=html2wt
24117 !! html/parsoid
24118 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
24119 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
24120 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
24121 !! wikitext
24122 [[Category:Toxine bactérienne]]
24123 [[Category:Toxine bactérienne]]
24124 [[Category:Toxine bactérienne]]
24125 !! end
24126
24127 !! test
24128 New sol transparent links don't need indent-pre nowiki protection
24129 !! options
24130 parsoid=html2wt
24131 language=de
24132 !! html/parsoid
24133 <link rel="mw:PageProp/redirect" href="./Main_Page">
24134 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
24135 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
24136 !! wikitext
24137 #WEITERLEITUNG [[Main Page]]
24138 <!-- this is good --> [[Category:Good]]
24139 <!-- this is great --> [[Kategorie:Great]]
24140 !! end
24141
24142 !! test
24143 New interlanguage links (href variations)
24144 !! options
24145 parsoid=html2wt
24146 !! html/parsoid
24147 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
24148 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
24149 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
24150 !! wikitext
24151 [[es:Toxine bactérienne]]
24152 [[es:Toxine_bactérienne]]
24153 [[es:Toxine_bactérienne]]
24154 !! end
24155
24156 !! test
24157 Image: Modifying size of an image (1)
24158 !! options
24159 parsoid={
24160 "modes": ["wt2wt"],
24161 "changes": [
24162 ["img[height]", "attr", "height", "22"],
24163 ["img[width]", "attr", "width", "200"]
24164 ]
24165 }
24166 !! wikitext
24167 [[Image:Foobar.jpg|230x230px]]
24168 !! wikitext/edited
24169 [[Image:Foobar.jpg|200x200px]]
24170 !!end
24171
24172 !! test
24173 Image: Modifying size of an image (2)
24174 !! options
24175 parsoid={
24176 "modes": ["wt2wt"],
24177 "changes": [
24178 ["img[height]", "attr", "height", "100"],
24179 ["img[width]", "attr", "width", "500"]
24180 ]
24181 }
24182 !! wikitext
24183 [[Image:Foobar.jpg|230x230px]]
24184 !! wikitext/edited
24185 [[Image:Foobar.jpg|500x500px]]
24186 !!end
24187
24188 # Change in size is ignored so long as class='mw-default-size'
24189 !! test
24190 Image: Modifying size of an image (3)
24191 !! options
24192 parsoid={
24193 "modes": ["wt2wt"],
24194 "changes": [
24195 ["figure[class]", "removeClass", "mw-default-size"],
24196 ["figure img", "attr", "height", "19"],
24197 ["figure img", "attr", "width", "170"]
24198 ]
24199 }
24200 !! wikitext
24201 [[Image:Foobar.jpg|thumb]]
24202 !! wikitext/edited
24203 [[Image:Foobar.jpg|thumb|170x170px]]
24204 !!end
24205
24206 !! test
24207 Image: Modifying alignment of an image (bug 48665)
24208 !! options
24209 parsoid={
24210 "modes": ["wt2wt"],
24211 "changes": [
24212 ["figure[class]", "removeClass", "mw-halign-right"],
24213 ["figure[class]", "addClass", "mw-halign-left"]
24214 ]
24215 }
24216 !! wikitext
24217 [[Image:Foobar.jpg|thumb|caption|right]]
24218 !! wikitext/edited
24219 [[Image:Foobar.jpg|thumb|caption|left]]
24220 !! end
24221
24222 !! test
24223 Image: Modifying mw-default-size of an frameless image (bug 62805)
24224 !! options
24225 parsoid={
24226 "modes": ["wt2wt"],
24227 "changes": [
24228 ["figure.mw-default-size", "removeClass", "mw-default-size"]
24229 ]
24230 }
24231 !! wikitext
24232 [[Image:Foobar.jpg|frameless|right]]
24233 !! wikitext/edited
24234 [[Image:Foobar.jpg|frameless|right|220x220px]]
24235 !! end
24236
24237 !! test
24238 Image: Modifying valign of an image (bug 49221)
24239 !! options
24240 parsoid={
24241 "modes": ["wt2wt"],
24242 "changes": [
24243 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
24244 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
24245 ]
24246 }
24247 !! wikitext
24248 [[File:Foobar.jpg|20px|middle]]
24249 !! wikitext/edited
24250 [[File:Foobar.jpg|20px|text-top]]
24251 !! end
24252
24253 !! test
24254 Image: Modifying alt attribute of an image (bug 56400)
24255 !! options
24256 parsoid={
24257 "modes": ["wt2wt"],
24258 "changes": [
24259 ["img[alt]", "attr", "alt", "some alternate edited text"]
24260 ]
24261 }
24262 !! wikitext
24263 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
24264 !! wikitext/edited
24265 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
24266 !!end
24267
24268 !! test
24269 Image: Modifying caption of an image
24270 !! options
24271 parsoid={
24272 "modes": ["wt2wt"],
24273 "changes": [
24274 ["figcaption", "text", "new caption"]
24275 ]
24276 }
24277 !! wikitext
24278 [[Image:Foobar.jpg|thumb|original caption]]
24279 !! wikitext/edited
24280 [[Image:Foobar.jpg|thumb|new caption]]
24281 !!end
24282
24283 !! test
24284 Image: empty alt attribute (bug 48924)
24285 !! options
24286 parsoid
24287 !! wikitext
24288 [[File:Foobar.jpg|thumb|alt=|bar]]
24289 !! html
24290 <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>
24291 !! end
24292
24293 !! test
24294 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
24295 !! options
24296 parsoid=html2wt
24297 language=ar
24298 disabled
24299 !! html/parsoid
24300 <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>
24301 !! wikitext
24302 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
24303 !! end
24304
24305 !! test
24306 Image: Block level image should have \n before and after
24307 !! wikitext
24308 123
24309 [[File:Foobar.jpg|right|thumb|150x150px]]
24310 456
24311 !! html/parsoid
24312 <p>123</p>
24313 <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>
24314 <p>456</p>
24315 !!end
24316
24317 !! test
24318 Image: New block level image should have \n before and after (existing content)
24319 !! wikitext
24320 123
24321 [[File:Foobar.jpg|right|thumb|150x150px]]
24322 456
24323 !! html/parsoid
24324 <p>123</p>
24325 <figure class="mw-halign-right" typeof="mw:Image/Thumb" 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>
24326 <p>456</p>
24327 !!end
24328
24329 !! test
24330 Image: upright option (parsoid)
24331 !! wikitext
24332 [[File:Foobar.jpg|thumb|upright|caption]]
24333 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
24334 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
24335 !! html/parsoid
24336 <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>
24337 <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>
24338 <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>
24339 !!end
24340
24341 !! test
24342 Image: upright option is ignored on inline and frame images (parsoid)
24343 !! wikitext
24344 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
24345 !! html/parsoid
24346 <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>
24347 !!end
24348
24349 !! test
24350 Image: from basic HTML (1)
24351 !! options
24352 parsoid=html2wt
24353 !! html/parsoid
24354 <span typeof="mw:Image">
24355 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24356 </span>
24357 !! wikitext
24358 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24359 !! end
24360
24361 !! test
24362 Image: from basic HTML (2)
24363 !! options
24364 parsoid=html2wt
24365 !! html/parsoid
24366 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24367 !! wikitext
24368 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24369 !! end
24370
24371 !! test
24372 Image: from basic HTML (3)
24373 !! options
24374 parsoid=html2wt
24375 !! html/parsoid
24376 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
24377 !! wikitext
24378 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
24379 !! end
24380
24381 !! test
24382 Image: from basic HTML (4)
24383 !! options
24384 parsoid=html2wt
24385 !! html/parsoid
24386 <img src="./File:Foobar.jpg">
24387 !! wikitext
24388 [[File:Foobar.jpg|link=]]
24389 !! end
24390
24391 !! test
24392 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
24393 !! options
24394 parsoid=html2wt
24395 !! html/parsoid
24396 <ul>
24397 <li><p>foo</p></li>
24398 </ul>
24399 !! wikitext
24400 * foo
24401 !! end
24402
24403 !! test
24404 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
24405 !! options
24406 parsoid=html2wt
24407 !! html/parsoid
24408 <ul> <li>foo</li></ul>
24409 !! wikitext
24410 * foo
24411 !! end
24412
24413 !! test
24414 Don't strip leading whitespace when handling indent-pre suppressing tags
24415 !! options
24416 parsoid=html2wt
24417 !! html/parsoid
24418 <table>
24419 <tr><td> indented row</td></tr>
24420 </table>
24421 <blockquote><p>
24422 <b>This is very bold of you!</b>
24423 </p>
24424 <table><tr><td>
24425 indented cell (no pre-wrapping!)
24426 </td></tr></table>
24427 </blockquote>
24428 <p>foo</p>
24429 <div>bar</div>
24430 !! wikitext
24431 {|
24432 | indented row
24433 |}
24434 <blockquote>
24435 '''This is very bold of you!'''
24436
24437 {|
24438 |
24439 indented cell (no pre-wrapping!)
24440 |}
24441 </blockquote>
24442 foo
24443 <div>bar</div>
24444 !! end
24445
24446 !! test
24447 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
24448 !! options
24449 parsoid=html2wt
24450 !! html/parsoid
24451 <p>foo</p>
24452 <span>bar</span>
24453
24454 <span>foo2
24455 </span>bar2
24456
24457 <div>foo</div>
24458 <span>bar</span>
24459
24460 <div>
24461 <span>foo</span>
24462 </div>
24463 !! wikitext
24464 foo
24465 <nowiki> </nowiki><span>bar</span>
24466
24467 <span>foo2
24468 <nowiki> </nowiki></span>bar2
24469
24470 <div>foo</div>
24471 <nowiki> </nowiki><span>bar</span>
24472
24473 <div>
24474 <nowiki> </nowiki><span>foo</span>
24475 </div>
24476 !! end
24477
24478 !! test
24479 Lists: Dont insert newlines in a serialized list item.
24480 !! options
24481 parsoid=html2wt
24482 !! html/parsoid
24483 <ul><li>a<br>b</li><li>c</li></ul>
24484 !! wikitext
24485 * a<br>b
24486 * c
24487 !! end
24488
24489 !! test
24490 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
24491 !! options
24492 parsoid={
24493 "modes": ["html2wt"],
24494 "scrubWikitext": false
24495 }
24496 !! html/parsoid
24497 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
24498 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
24499
24500 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
24501 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
24502
24503 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
24504
24505 <h2><meta property="mw:PageProp/toc" /> ok</h2>
24506 !! wikitext
24507 == hello there [[Category:A1]] ==
24508
24509 == [[Category:A2]] hi pal ==
24510
24511 == <!--foo--> [[Category:A3]] how goes it ==
24512
24513 == it goes well [[Category:A4]] <!--bar--> ==
24514
24515 ==howdy [[Category:A5]] ==
24516
24517 == __TOC__ ok ==
24518 !! end
24519
24520 !! test
24521 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
24522 !! options
24523 parsoid={
24524 "modes": ["html2wt"],
24525 "scrubWikitext": true
24526 }
24527 !! html/parsoid
24528 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
24529 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
24530
24531 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
24532 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
24533
24534 <h2><meta property="mw:PageProp/toc" /> ok</h2>
24535 !! wikitext
24536 == hello there ==
24537 [[Category:A1]]
24538 [[Category:A2]]
24539
24540 == hi pal ==
24541
24542 <!--foo--> [[Category:A3]]
24543
24544 == how goes it ==
24545
24546 == it goes well ==
24547 [[Category:A4]] <!--bar-->
24548
24549 __TOC__
24550
24551 == ok ==
24552 !! end
24553
24554 !! test
24555 Headings: Don't hoist metas that come from templates
24556 !! options
24557 parsoid={
24558 "modes": ["html2wt"],
24559 "scrubWikitext": true
24560 }
24561 !! html/parsoid
24562 <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>
24563 !! wikitext
24564 == {{echo|foo [[Category:Foo]]}} ==
24565 !! end
24566
24567 !! test
24568 Headings: Category in ref isn't hoisted
24569 !! options
24570 parsoid={
24571 "modes": ["html2wt"],
24572 "scrubWikitext": true
24573 }
24574 !! html/parsoid
24575 <h2> foo <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> </h2>
24576
24577 <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>
24578 !! wikitext
24579 == foo <ref>bar
24580 [[Category:Baz]] </ref> ==
24581
24582 <references />
24583 !! end
24584
24585 !! test
24586 Parsoid: Serialize positional parameters with = in them as named parameter
24587 !! options
24588 parsoid=html2wt
24589 !! html/parsoid
24590 <p about="#mwt1" typeof="mw:Transclusion"
24591 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
24592
24593 <p about="#mwt1" typeof="mw:Transclusion"
24594 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
24595
24596 <!--Orig params with data-parsoid has heuristics for handling = chars-->
24597 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
24598 <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>
24599 !! wikitext
24600 {{echo|1 = f=oo}}
24601
24602 {{echo|1 = f=oo|2 = bar}}
24603
24604 <!--Orig params with data-parsoid has heuristics for handling = chars-->
24605 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
24606 {{echo|<nowiki>f=oo</nowiki>|bar}}
24607 !! end
24608
24609 !! test
24610 Parsoid: Serialize positional parameters with = in extlink as named parameter
24611 !! options
24612 parsoid=html2wt
24613 !! html/parsoid
24614 <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>
24615 !! wikitext
24616 {{echo|1 = http://stuff?is=ok}}
24617 !! end
24618
24619 !! test
24620 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
24621 !! options
24622 parsoid=html2wt
24623 !! html/parsoid
24624 <div>a<p>b</p></div>
24625 <div>a
24626 <p>b</p></div>
24627 <div>
24628 a
24629 <p>b</p></div>
24630 !! wikitext
24631 <div>a
24632 b
24633 </div>
24634 <div>a
24635 b
24636 </div>
24637 <div>
24638 a
24639
24640 b
24641 </div>
24642 !! end
24643
24644 !! test
24645 Substrings resembling wikitext in hrefs should not get nowiki escapes
24646 !! options
24647 parsoid=html2wt
24648 !! html/parsoid
24649 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
24650 !! wikitext
24651 [[Foo''bar''baz]]
24652 !! end
24653
24654 !! test
24655 Enforce single-line context in the serializer
24656 !! options
24657 parsoid=html2wt
24658 !! html/parsoid
24659 <h2>testing
24660 123</h2>
24661
24662 <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">
24663 </span><span about="#mwt1">you</span> </h2>
24664
24665 <h2> foo <span about="#mwt2" class="reference" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1">[1]</a></span> </h2>
24666
24667 <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
24668 there</span></li></ol>
24669
24670 <ul><li>asd
24671 sdf</li></ul>
24672
24673 <ul><li>foo
24674 bar
24675 baz</li>
24676 <li>foo <b>bar</b>
24677 baz</li></ul>
24678
24679 <dl><dt>hi
24680 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
24681 ho</dd></dl>
24682
24683 <dl><dd> <table>
24684 <tbody><tr><td> ha
24685 ha
24686 ha</td></tr>
24687 </tbody></table></dd></dl>
24688 !! wikitext
24689 == testing 123 ==
24690
24691 == hi {{bogus|there
24692 you}} ==
24693
24694 == foo <ref>hello
24695 there</ref> ==
24696
24697 <references />
24698
24699 * asd sdf
24700
24701 * foo bar baz
24702 * foo '''bar''' baz
24703
24704 ; hi ho : hi ho
24705
24706 : {|
24707 | ha
24708 ha
24709 ha
24710 |}
24711 !! end
24712
24713 !! test
24714 Serialize new placeholder space without spans
24715 !! options
24716 parsoid=html2wt
24717 !! html/parsoid
24718 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
24719
24720 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
24721
24722 <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>
24723 !! wikitext
24724 foo : bar
24725
24726 foo : bar
24727
24728 <ref>foo : bar</ref>ok
24729 !! end
24730
24731
24732 #-----------------------
24733 # Tag minimization tests
24734 #-----------------------
24735
24736 !! test
24737 1. I/B quote minimization: wikitext-only tags should be combined
24738 !! options
24739 parsoid=html2wt
24740 !! html/parsoid
24741 <p><i>A</i><i>B</i></p>
24742 <p><b>A</b><b>B</b></p>
24743 <p><i>A</i><b><i>B</i></b></p>
24744 <p><b>A</b><i><b>B</b></i></p>
24745 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
24746 <p><i><b>A</b></i><i><b>B</b></i></p>
24747 <p><i><b>A</b></i><b><i>B</i></b></p>
24748 <p><b><i>A</i></b><i><b>B</b></i></p>
24749 !! wikitext
24750 ''AB''
24751
24752 '''AB'''
24753
24754 ''A'''B'''''
24755
24756 '''A''B'''''
24757
24758 '''A''BC''D'''
24759
24760 '''''AB'''''
24761
24762 '''''AB'''''
24763
24764 '''''AB'''''
24765 !! end
24766
24767 !! test
24768 2. I/B quote minimization: wikitext and html tags should not be combined
24769 !! options
24770 parsoid=html2wt
24771 !! html/parsoid
24772 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
24773 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
24774 !! wikitext
24775 ''A''<i>B</i>
24776
24777 ''A''<nowiki/>'''<i>B</i>'''
24778 !! end
24779
24780 !! test
24781 3. I/B quote minimization: templated content stops minimization
24782 !! options
24783 parsoid=html2wt
24784 !! html/parsoid
24785 <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>
24786 <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>
24787 !! wikitext
24788 ''A''{{echo|''B''}}
24789
24790 ''A''{{echo|'''''B'''''}}
24791 !! end
24792
24793 !! test
24794 4. I/B quote minimization: new content should be mimimized with adjacent old content
24795 !! options
24796 parsoid=html2wt
24797 !! html/parsoid
24798 <p><i>A</i><i>B</i></p>
24799 <p><b>A</b><b>B</b></p>
24800 <p><i>A</i><b><i>B</i></b></p>
24801 !! wikitext
24802 ''AB''
24803
24804 '''AB'''
24805
24806 ''A'''B'''''
24807 !! end
24808
24809 !! test
24810 5a. Merge adjacent quote nodes if they've been edited
24811 !! options
24812 parsoid={
24813 "modes": ["wt2wt", "selser"],
24814 "changes": [
24815 ["p", "contents", "remove", ":contains('b')"]
24816 ]
24817 }
24818 !! wikitext
24819 ''a''b''c''
24820 !! wikitext/edited
24821 ''ac''
24822 !! end
24823
24824 !! test
24825 5b. Merge adjacent quote nodes if they've been edited
24826 !! options
24827 parsoid={
24828 "modes": ["wt2wt", "selser"],
24829 "changes": [
24830 ["#x", "remove"]
24831 ]
24832 }
24833 !! wikitext
24834 ''a''<span id="x">b</span>''c''
24835 !! wikitext/edited
24836 ''ac''
24837 !! end
24838
24839 !! test
24840 1. Merge adjacent link nodes as long as at least one element is new
24841 !! options
24842 parsoid={
24843 "modes": ["html2wt"],
24844 "scrubWikitext": true
24845 }
24846 !! html/parsoid
24847 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
24848 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
24849 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
24850 !! wikitext
24851 [[Football]]
24852 [[Football]]
24853 [[Football|Foot]][[Football|ball]]
24854 !! end
24855
24856 !! test
24857 2. Merge adjacent link nodes and enable additional normalizations
24858 !! options
24859 parsoid={
24860 "modes": ["html2wt"],
24861 "scrubWikitext": true
24862 }
24863 !! html/parsoid
24864 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
24865 !! wikitext
24866 [[Football|''Football'']]
24867 !! end
24868
24869 !! test
24870 3. Don't merge adjacent link nodes if scrubWikitext is false
24871 !! options
24872 parsoid={
24873 "modes": ["html2wt"],
24874 "scrubWikitext": false
24875 }
24876 !! html/parsoid
24877 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
24878 !! wikitext
24879 [[Football|Foot]][[Football|ball]]
24880 !! end
24881
24882 #------------------------------
24883 # End of tag minimization tests
24884 #------------------------------
24885
24886 !!test
24887 Bug 54262: New entities
24888 !! options
24889 parsoid=html2wt
24890 !! html/parsoid
24891 <span typeof="mw:Entity">&nbsp;</span>
24892 !! wikitext
24893 &nbsp;
24894 !! end
24895
24896 ## Note that there is no wikitext output for 'unknownproperty' ##
24897 ## Unknown magic words are silently dropped ##
24898
24899 !! test
24900 Magic words
24901 !! options
24902 parsoid=html2wt
24903 !! html/parsoid
24904 <meta property='mw:PageProp/toc' />
24905 <meta property='mw:PageProp/notoc' />
24906 <meta property='mw:PageProp/forcetoc' />
24907 <meta property='mw:PageProp/index' />
24908 <meta property='mw:PageProp/noindex' />
24909 <meta property='mw:PageProp/nogallery' />
24910 <meta property='mw:PageProp/noeditsection' />
24911 <meta property='mw:PageProp/notitleconvert' />
24912 <meta property='mw:PageProp/nocontentconvert' />
24913 <meta property='mw:PageProp/unknownproperty' />
24914 !! wikitext
24915 __TOC__
24916 __NOTOC__
24917 __FORCETOC__
24918 __INDEX__
24919 __NOINDEX__
24920 __NOGALLERY__
24921 __NOEDITSECTION__
24922 __NOTITLECONVERT__
24923 __NOCONTENTCONVERT__
24924 !! end
24925
24926 !! test
24927 Consecutive <pre>s should not get merged
24928 !! options
24929 parsoid=html2wt,html2html
24930 !! html/parsoid
24931 <pre>a</pre><pre>b</pre>
24932
24933 <pre>c
24934 </pre><pre>
24935 d</pre>
24936
24937 <pre>e
24938
24939 </pre><pre>
24940
24941 f</pre>
24942 !! wikitext
24943 a
24944
24945 b
24946
24947 c
24948
24949 d
24950
24951 e
24952
24953
24954
24955 f
24956 !! end
24957
24958 !! test
24959 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
24960 !! options
24961 parsoid=html2wt
24962 !! html/parsoid
24963 <a rel="mw:ExtLink" href="./Special:BookSources/1234567890">ISBN 1234567895</a>
24964 !! wikitext
24965 [[Special:BookSources/1234567890|ISBN 1234567895]]
24966 !! end
24967
24968 !! test
24969 Edited RFC links not serializable as RFC links should serialize as extlinks
24970 !! options
24971 parsoid=html2wt
24972 !! html/parsoid
24973 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
24974 !! wikitext
24975 [//tools.ietf.org/html/rfc123 New RFC]
24976 !! end
24977
24978 !! test
24979 Edited PMID links not serializable as PMID links should serialize as extlinks
24980 !! options
24981 parsoid=html2wt
24982 !! html/parsoid
24983 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
24984 !! wikitext
24985 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
24986 !! end
24987
24988 !! test
24989 WTS of autolinks with trailing/surrounding context
24990 !! options
24991 parsoid=html2wt
24992 !! html/parsoid
24993 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
24994 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
24995 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
24996 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
24997 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
24998 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
24999 !! wikitext
25000 http://cscott.net<nowiki/>'''foo'''
25001
25002 http://cscott.net<b>foo</b>
25003
25004 '''http://cscott.net<nowiki/>'''
25005
25006 '''http://cscott.net '''
25007
25008 '''http://cscott.net<nowiki/>x'''
25009
25010 http://cscott.net<nowiki/>x
25011 !! end
25012
25013 !! test
25014 WTS of autolinks with nowikis (round-trip)
25015 !! wikitext
25016 x<nowiki/>http://cscott.net<nowiki/>x
25017 !! html/parsoid
25018 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
25019 !! end
25020
25021 # this is the "easy" test because it leaves in place all the
25022 # data-parsoid information indicating this is an autolink
25023 !! test
25024 WTS of autolinks with escapes (editing)
25025 !! options
25026 parsoid={
25027 "modes": ["wt2wt"],
25028 "changes": [
25029 [ "meta", "remove" ]
25030 ]
25031 }
25032 !! wikitext
25033 x<nowiki/>http://cscott.net<nowiki/>x
25034 !! wikitext/edited
25035 x<nowiki/>http://cscott.net<nowiki/>x
25036 !! end
25037
25038 !! test
25039 WTS of edited autolink-like text (T103364)
25040 !! options
25041 parsoid={
25042 "modes": ["wt2wt"],
25043 "changes": [
25044 [ "span[typeof]", "removeAttr", "typeof" ]
25045 ]
25046 }
25047 !! wikitext
25048 Not a link: <nowiki>http://example.com</nowiki>.
25049 !! wikitext/edited
25050 Not a link: <span><nowiki>http://example.com</nowiki></span>.
25051 !! end
25052
25053 !! test
25054 WTS of newly-authored autolink-like text (T103364)
25055 !! options
25056 parsoid=html2wt
25057 !! html/parsoid
25058 <p>http://example.com is not a link.</p>
25059 !! wikitext
25060 <nowiki>http://example.com is not a link.</nowiki>
25061 !! end
25062
25063 !! test
25064 WTS of autolink-like text after an autolink (T108563)
25065 !! options
25066 parsoid=html2wt
25067 !! html/parsoid
25068 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
25069 !! wikitext
25070 http://example.com<nowiki> http://example.com is not a link.</nowiki>
25071 !! end
25072
25073 !! test
25074 Edited Redirect link should emit a non-piped wikitext link
25075 !! options
25076 parsoid=html2wt
25077 !! html/parsoid
25078 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
25079 !! wikitext
25080 #REDIRECT [[Bar]]
25081 !! end
25082
25083 !! test
25084 T75121: Infer extension name from typeOf if data-mw is not present
25085 !! options
25086 parsoid=html2wt
25087 !! html/parsoid
25088 <div typeOf="mw:Extension/foo"></div>
25089 !! wikitext
25090 <foo />
25091 !! end
25092
25093 # Note that the <p> wrapping isn't present in PHP parser output
25094 # The important thing for this test is that P-wrapping doesn't
25095 # interfere with the <nowiki> protection for leading - in <td>
25096 # (which isn't necessary for <th>).
25097 !! test
25098 T88318: p-wrapped dash in table.
25099 !! options
25100 parsoid=html2wt,wt2wt
25101 !! html/parsoid
25102 <table><tbody>
25103 <tr><th><p>-</p></th><th><p>- </p></th></tr>
25104 <tr><td><p>-</p></td><td><p>- </p></td></tr>
25105 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
25106 </tbody></table>
25107 !! wikitext
25108 {|
25109 !-
25110 !-
25111 |-
25112 |<nowiki>-</nowiki>
25113 |<nowiki>- </nowiki>
25114 |-
25115 |<small>-</small>
25116 |<br>
25117 -
25118 |<br>
25119 -
25120 |}
25121 !! html/php+tidy
25122 <table>
25123 <tr>
25124 <th>-</th>
25125 <th>-</th>
25126 </tr>
25127 <tr>
25128 <td>-</td>
25129 <td>-</td>
25130 </tr>
25131 <tr>
25132 <td><small>-</small></td>
25133 <td><br />
25134 <p>-</p>
25135 </td>
25136 <td><br />
25137 <p>-</p>
25138 </td>
25139 </tr>
25140 </table>
25141 !! end
25142
25143 !! test
25144 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
25145 !! options
25146 parsoid=html2wt
25147 !! html/parsoid
25148 <table id='mwAb'>
25149 <td id='mwAc'>foo</td>
25150 <td id='serialize-this'>bar</td>
25151 </table>
25152 !! wikitext
25153 {|
25154 |foo
25155 | id="serialize-this" |bar
25156 |}
25157 !! end
25158
25159 !! test
25160 Parsoid-like element ids should not be serialized to wikitext unless shadowed
25161 !! options
25162 parsoid=html2wt
25163 !! html/parsoid
25164 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
25165 !! wikitext
25166 <div id="hello">ok</div>
25167 !! end
25168
25169 !! test
25170 WTS change modes
25171 !! options
25172 parsoid={
25173 "modes": ["wt2wt"],
25174 "changes": [
25175 [ "#xyz", "before", "<b>before</b> stuff " ],
25176 [ "#xyz", "after", " stuff <i>after</i>" ],
25177 [ "#xyz", "html", "x <b>y</b> z" ]
25178 ]
25179 }
25180 !! wikitext
25181 <span id="xyz">hello</span>
25182 !! wikitext/edited
25183 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
25184 !! end
25185
25186 !! test
25187 Never serialize a-tag as html, regardless of what data-parsoid has to say
25188 !! options
25189 parsoid=html2wt
25190 !! html/parsoid
25191 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
25192 !! wikitext
25193 [[Foo]]
25194 !! end
25195
25196 ## SSS FIXME: This is broken output nevertheless.
25197 ## What might be a reasonable non-broken output for this?
25198 ## This is an edge case unlikely to be seen in production
25199 ## that I am not wasting more time on this right now.
25200 !! test
25201 Never serialize a-tag as html, no matter what attributes it has
25202 !! options
25203 parsoid=html2wt
25204 !! html/parsoid
25205 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
25206 !! wikitext
25207 [http://boo.org http://boohoo.org]
25208 !! end
25209
25210 # Misnested is an indication that selser can reuse the source but these have
25211 # shown to sneak through on occasion. See T101768.
25212 # The original wikitext here is: [http://test.com [[one]] two three]
25213 !! test
25214 Strip span tags added to mark as misnested
25215 !! options
25216 parsoid=html2wt
25217 !! html/parsoid
25218 <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>
25219 !! wikitext
25220 [http://test.com][[one]] two three
25221 !! end
25222
25223 # --------------------------------------------
25224 # Tests spec'ing wikitext serialization norms |
25225 # --------------------------------------------
25226
25227 !! test
25228 Lists: Add space after bullets
25229 !! options
25230 parsoid=html2wt
25231 !! html/parsoid
25232 <ul>
25233 <li>foo</li>
25234 <li> bar</li>
25235 <li><span> baz</span></li>
25236 </ul>
25237 !! wikitext
25238 * foo
25239 * bar
25240 * <span> baz</span>
25241 !! end
25242
25243 !! test
25244 1. Headings: Add space before/after == (T53744)
25245 !! options
25246 parsoid=html2wt
25247 !! html/parsoid
25248 <h2>foo</h2>
25249 <h2> bar</h2>
25250 <h2>baz </h2>
25251 <h2><span> baz</span></h2>
25252 !! wikitext
25253 == foo ==
25254
25255 == bar ==
25256
25257 == baz ==
25258
25259 == <span> baz</span> ==
25260 !! end
25261
25262 !! test
25263 2. Headings: Add space before/after == even after hoisted content
25264 !! options
25265 parsoid={
25266 "modes": ["html2wt"],
25267 "scrubWikitext": true
25268 }
25269 !! html/parsoid
25270 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
25271 !! wikitext
25272 [[Category:A2]]
25273
25274 == ok ==
25275 !! end
25276
25277 !! test
25278 1. Headings: suppress newly created empty headings
25279 !! options
25280 parsoid={
25281 "modes": ["html2wt"],
25282 "scrubWikitext": true
25283 }
25284 !! html/parsoid
25285 <h2></h2>
25286 !! wikitext
25287 !! end
25288
25289 !! test
25290 2. Headings: don't suppress empty headings if scrubWikitext is false
25291 !! options
25292 parsoid=html2wt
25293 !! html/parsoid
25294 <h2></h2>
25295 !! wikitext
25296 ==<nowiki/>==
25297 !! end
25298
25299 !! test
25300 3. Headings: suppress empty headings on edits
25301 !! options
25302 parsoid={
25303 "modes": ["selser"],
25304 "scrubWikitext": true,
25305 "changes": [
25306 [ "#x", "remove"]
25307 ]
25308 }
25309 !! wikitext
25310 ==<span id="x">foo</span>==
25311 !! wikitext/edited
25312 !! end
25313
25314 !! test
25315 1. WT Quote Tags: suppress newly created empty style tags
25316 !! options
25317 parsoid={
25318 "modes": ["html2wt"],
25319 "scrubWikitext": true
25320 }
25321 !! html/parsoid
25322 <i></i><b></b>
25323 !! wikitext
25324 !! end
25325
25326 !! test
25327 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
25328 !! options
25329 parsoid=html2wt
25330 !! html/parsoid
25331 <i></i><b></b>
25332 !! wikitext
25333 ''<nowiki/>'''''<nowiki/>'''
25334 !! end
25335
25336 !! test
25337 3. WT Quote Tags: suppress empty style tags on edits
25338 !! options
25339 parsoid={
25340 "modes": ["selser"],
25341 "scrubWikitext": true,
25342 "changes": [
25343 [ "#x", "remove"]
25344 ]
25345 }
25346 !! wikitext
25347 '''<span id="x">foo</span>'''
25348 !! wikitext/edited
25349 !! end
25350
25351 !! test
25352 1. Anchors: suppress newly created empty anchors
25353 !! options
25354 parsoid={
25355 "modes": ["html2wt"],
25356 "scrubWikitext": true
25357 }
25358 !! html/parsoid
25359 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
25360 !! wikitext
25361 !! end
25362
25363 !! test
25364 2. Anchors: don't suppress empty anchors if scrubWikitext is false
25365 !! options
25366 parsoid={
25367 "modes": ["html2wt"],
25368 "scrubWikitext": false
25369 }
25370 !! html/parsoid
25371 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
25372 !! wikitext
25373 [[Test|<nowiki/>]]
25374 !! end
25375
25376 !! test
25377 3. Anchors: suppress empty anchors on edits
25378 !! options
25379 parsoid={
25380 "modes": ["selser"],
25381 "scrubWikitext": true,
25382 "changes": [
25383 [ "#x", "remove"]
25384 ]
25385 }
25386 !! wikitext
25387 [[Test|<span id="x">foo</span>]]
25388 !! wikitext/edited
25389 !! end
25390
25391 !! test
25392 3a. Anchors: do not suppress numbered extlinks
25393 !! options
25394 parsoid={
25395 "modes": ["wt2wt"],
25396 "scrubWikitext": true
25397 }
25398 !! wikitext
25399 [http://foo.com]
25400 !! html/parsoid
25401 <a rel="mw:ExtLink" href="http://foo.com"></a>
25402 !! end
25403
25404 !! test
25405 3b. Anchors: do not suppress numbered extlinks
25406 !! options
25407 parsoid={
25408 "modes": ["wt2wt"],
25409 "scrubWikitext": true,
25410 "changes": [
25411 [ "#x", "remove"]
25412 ]
25413 }
25414 !! wikitext
25415 [http://foo.com <span id="x">foo</span>]
25416 !! wikitext/edited
25417 [http://foo.com]
25418 !! end
25419
25420 !!test
25421 Normalizations should be restricted to edited content
25422 !!options
25423 parsoid={
25424 "modes": ["selser"],
25425 "scrubWikitext": true,
25426 "changes": [
25427 [ "h1", "before", "<i></i>"]
25428 ]
25429 }
25430 !!wikitext
25431 a
25432 = =
25433 b
25434 !!wikitext/edited
25435 a
25436 = =
25437 b
25438 !!end
25439
25440 !! test
25441 1. Multiple normalizations (html2wt)
25442 !! options
25443 parsoid={
25444 "modes": ["html2wt"],
25445 "scrubWikitext": true
25446 }
25447 !! html
25448 <h2><i></i></h2>
25449 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
25450 </a><b><i></i></b>x</p>
25451 !! wikitext
25452
25453 [[foo]]
25454 x
25455
25456 !! end
25457
25458 !! test
25459 2. Multiple normalizations (selser)
25460 !! options
25461 parsoid={
25462 "modes": ["selser"],
25463 "scrubWikitext": true,
25464 "changes": [
25465 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
25466 ]
25467 }
25468 !! wikitext
25469 <span id="x">foo</span>
25470 !! wikitext/edited
25471 <span id="x">foo</span>
25472
25473 x
25474 !! end
25475
25476 !! test
25477 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
25478 !! options
25479 parsoid={
25480 "modes": ["html2wt"],
25481 "scrubWikitext": true
25482 }
25483 !! html/parsoid
25484 <p> hi</p>
25485 <p> hello</p>
25486 !! wikitext
25487 hi
25488
25489 hello
25490 !! end
25491
25492 !! test
25493 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
25494 !! options
25495 parsoid=html2wt
25496 !! html/parsoid
25497 <p> hi</p>
25498 <p> hello</p>
25499 !! wikitext
25500 <nowiki> </nowiki>hi
25501
25502 <nowiki> </nowiki> hello
25503 !! end
25504
25505 !! test
25506 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
25507 !! options
25508 parsoid={
25509 "modes": ["html2wt"],
25510 "scrubWikitext": true
25511 }
25512 !! html/parsoid
25513 <p>Foo
25514 bar
25515 baz</p>
25516
25517 <table><tr><td>Foo
25518 bar
25519 baz bang</td></tr></table>
25520
25521 <p><!--boo--> foo
25522 bar</p>
25523
25524 <p> foo
25525 bar<span>boo</span></p>
25526 !! wikitext
25527 Foo
25528 bar
25529 baz
25530
25531 {|
25532 |Foo
25533 bar
25534 baz bang
25535 |}
25536
25537 <!--boo-->foo
25538 bar
25539
25540 foo
25541 bar<span>boo</span>
25542 !! end
25543
25544 !! test
25545 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
25546 !! options
25547 parsoid={
25548 "modes": ["selser"],
25549 "scrubWikitext": true,
25550 "changes": [
25551 [ "p", "html", " a\n b" ]
25552 ]
25553 }
25554 !! wikitext
25555 xyz
25556 !! wikitext/edited
25557 a
25558 b
25559 !! end
25560
25561 !! test
25562 1. New links that end in spaces
25563 !! options
25564 parsoid={
25565 "modes": ["html2wt"],
25566 "scrubWikitext": false
25567 }
25568 !! html/parsoid
25569 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
25570 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
25571 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
25572 !! wikitext
25573 [[Berlin ]]<nowiki/>is the capital of Germany.
25574
25575 [[Foo ]]'''bar'''
25576
25577 [[Boston ]] is a city.
25578 !! end
25579
25580 !! test
25581 2. New links that end in spaces
25582 !! options
25583 parsoid={
25584 "modes": ["html2wt"],
25585 "scrubWikitext": true
25586 }
25587 !! html/parsoid
25588 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
25589 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
25590 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
25591 !! wikitext
25592 [[Berlin]] is the capital of Germany.
25593
25594 [[Foo]] '''bar'''
25595
25596 [[Boston]] is a city.
25597 !! end
25598
25599 !! test
25600 1. Table cells with escapable prefixes
25601 !! options
25602 parsoid={
25603 "modes": ["html2wt"],
25604 "scrubWikitext": false
25605 }
25606 !! html
25607 <table>
25608 <tr><td>a</td></tr>
25609 <tr><td>-</td></tr>
25610 <tr><td>+</td></tr>
25611 </table>
25612 !! wikitext
25613 {|
25614 |a
25615 |-
25616 |<nowiki>-</nowiki>
25617 |-
25618 |<nowiki>+</nowiki>
25619 |}
25620 !! end
25621
25622 !! test
25623 2. Table cells with escapable prefixes
25624 !! options
25625 parsoid={
25626 "modes": ["html2wt"],
25627 "scrubWikitext": true
25628 }
25629 !! html
25630 <table>
25631 <tr><td>a</td></tr>
25632 <tr><td>-</td></tr>
25633 <tr><td>+</td></tr>
25634 </table>
25635 !! wikitext
25636 {|
25637 |a
25638 |-
25639 | -
25640 |-
25641 | +
25642 |}
25643 !! end
25644
25645 !! test
25646 3a. Table cells with escapable prefixes after edits
25647 !! options
25648 parsoid={
25649 "modes": ["selser"],
25650 "scrubWikitext": true,
25651 "changes": [
25652 [ "table tbody tr:first-child td:first-child", "remove"]
25653 ]
25654 }
25655 !! wikitext
25656 {|
25657 |a||-
25658 |}
25659 !! wikitext/edited
25660 {|
25661 | -
25662 |}
25663 !! end
25664
25665 !! test
25666 3b. Table cells with escapable prefixes after edits
25667 !! options
25668 parsoid={
25669 "modes": ["selser"],
25670 "scrubWikitext": true,
25671 "changes": [
25672 [ "table tbody tr:first-child td:first-child", "html", "-" ],
25673 [ "#x", "remove" ]
25674 ]
25675 }
25676 !! wikitext
25677 {|
25678 |pqr
25679 |<span id="x">foo</span>+
25680 |}
25681 !! wikitext/edited
25682 {|
25683 | -
25684 | +
25685 |}
25686 !! end
25687
25688 # FIXME: This test will fail because
25689 # normalization doesn't realize that the id attribute
25690 # will eliminate the escapable scenario
25691 !! test
25692 4a. Table cells without escapable prefixes after edits
25693 !! options
25694 parsoid={
25695 "modes": ["selser"],
25696 "scrubWikitext": true,
25697 "changes": [
25698 [ "#x", "html", "-" ]
25699 ]
25700 }
25701 !! wikitext
25702 {|
25703 | id="x" |abcd
25704 |}
25705 !! wikitext/edited
25706 {|
25707 | id="x" |-
25708 |}
25709 !! end
25710
25711 ## This tests normalizer's ability to discriminate between
25712 ## cells having identical content.
25713 !! test
25714 4b. Table cells without escapable prefixes after edits
25715 !! options
25716 parsoid={
25717 "modes": ["selser"],
25718 "scrubWikitext": true,
25719 "changes": [
25720 [ "td", "html", "-" ]
25721 ]
25722 }
25723 !! wikitext
25724 {|
25725 |a||b
25726 |}
25727 !! wikitext/edited
25728 {|
25729 | -||-
25730 |}
25731 !! end
25732
25733 ## This tests normalizer's ability to not be tripped by
25734 ## comments (and whitespace)
25735 !! test
25736 4c. Table cells without escapable prefixes after edits
25737 !! options
25738 parsoid={
25739 "modes": ["selser"],
25740 "scrubWikitext": true,
25741 "changes": [
25742 [ "table tbody tr td:first-child", "remove" ]
25743 ]
25744 }
25745 !! wikitext
25746 {|
25747 |-
25748 <!--foo--> |a||-
25749 |}
25750 !! wikitext/edited
25751 {|
25752 |-
25753 <!--foo--> | -
25754 |}
25755 !! end
25756
25757 ## This tests normalizer's ability to handle HTML cells
25758 !! test
25759 4d. Table cells without escapable prefixes after edits
25760 !! options
25761 parsoid={
25762 "modes": ["selser"],
25763 "scrubWikitext": true,
25764 "changes": [
25765 [ "td", "html", "-" ]
25766 ]
25767 }
25768 !! wikitext
25769 <table>
25770 <tr><td>a</td></tr>
25771 </table>
25772 !! wikitext/edited
25773 <table>
25774 <tr><td>-</td></tr>
25775 </table>
25776 !! end
25777
25778 # ---------------------------------------------------
25779 # End of tests spec'ing wikitext serialization norms |
25780 # ---------------------------------------------------
25781
25782 # -----------------------------------------------------------------
25783 # End of section for Parsoid-only html2wt tests for serialization
25784 # of new content
25785 # -----------------------------------------------------------------
25786
25787 # -----------------------------------------------------------------
25788 # The following section of tests are primarily to spec behavior of
25789 # the selective serializer. All these tests have manual selser
25790 # changes. The automated selser changes for all tests handle the
25791 # wide variation of changes, but these tests here capture specs
25792 # deterministically.
25793 # ----------------------------------------------------------------
25794
25795 ## T90517
25796 !! test
25797 Selser: New comments should not be lost
25798 !! options
25799 parsoid={
25800 "modes": ["selser"],
25801 "changes": [
25802 [ "#a", "after", "<!--c1-->" ],
25803 [ "#b", "before", "<!--c2-->" ]
25804 ]
25805 }
25806 !! wikitext
25807 <span id="a">a</span>
25808
25809 <span id="b">b</span>
25810 !! wikitext/edited
25811 <span id="a">a</span><!--c1-->
25812
25813 <!--c2--><span id="b">b</span>
25814 !! end
25815
25816 ## T89383
25817 !! test
25818 Selser: Check for validity of DSR before using it
25819 !! options
25820 parsoid={
25821 "modes": ["selser"],
25822 "changes": [
25823 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
25824 ]
25825 }
25826 !! wikitext
25827 <span id="a">a</span>
25828 !! wikitext/edited
25829 {{DISPLAYTITLE:foo}}
25830 <span id="a">a</span>
25831 !! end
25832
25833 !! test
25834 1. DOMDiff: Changes to <ref> content should be looked up using id
25835 !! options
25836 parsoid={
25837 "modes": ["selser"],
25838 "changes": [
25839 ["#X", "after", "bar"],
25840 ["#Y", "after", "baz"]
25841 ]
25842 }
25843 !! wikitext
25844 X <ref><span id="X">foo</span></ref>
25845 Y <ref name="a" />
25846 <references>
25847 <ref name="a"><span id="Y">foo</span></ref>
25848 </references>
25849 !! wikitext/edited
25850 X <ref><span id="X">foo</span>bar</ref>
25851 Y <ref name="a" />
25852 <references>
25853 <ref name="a"><span id="Y">foo</span>baz</ref>
25854 </references>
25855 !! end
25856
25857 !! test
25858 2. DOMDiff: Changes to <ref> content should be looked up using id
25859 !! options
25860 parsoid={
25861 "modes": ["selser"],
25862 "changes": [
25863 ["#Z", "after", "bar"]
25864 ]
25865 }
25866 !! wikitext
25867 A <ref>foo bar for a</ref>
25868 B <ref group="X" name="b" />
25869
25870 <references />
25871
25872 <references group="X">
25873 <ref name="b"><span id="Z">foo</span></ref>
25874 </references>
25875 !! wikitext/edited
25876 A <ref>foo bar for a</ref>
25877 B <ref group="X" name="b" />
25878
25879 <references />
25880
25881 <references group="X">
25882 <ref name="b"><span id="Z">foo</span>bar</ref>
25883 </references>
25884 !! end