2c8b163a5fd38fa5a87b28344dc1c361c9816f7e
[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 # (ignored by Parsoid, since it emits <link>s)
18 # ill add inter-language links
19 # (ignored by Parsoid, since it emits <link>s)
20 # subpage enable subpages (disabled by default)
21 # title=[[XXX]] run test using article title XXX
22 # language=XXX set content language to XXX for this test
23 # variant=XXX set the variant of language for this test (eg zh-tw)
24 # disabled do not run test
25 # parsoid parsoid-specific options (not run by PHP parser unless
26 # the test includes an html/php section)
27 # php php-only test (not run by the parsoid parser unless
28 # the test includes an html/parsoid section)
29 # showtitle make the first line the title
30 # showindicators make the first lines the page status indicators
31 # comment run through Linker::formatComment() instead of main parser
32 # local format section links in edit comment text as local links
33 # notoc disable table of contents
34 # thumbsize=NNN set the default thumb size to NNNpx for this test
35 #
36 # You can also set the following parser properties via test options:
37 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
38 # wgLinkHolderBatchSize, wgRawHtml, wgInterwikiMagic,
39 # wgEnableMagicLinks
40 #
41 # For testing purposes, temporary articles can created:
42 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
43 # where '/' denotes a newline.
44
45 # This is the standard article assumed to exist.
46 !! article
47 Main Page
48 !! text
49 blah blah
50 !! endarticle
51
52 !!article
53 Foo
54 !!text
55 FOO
56 !!endarticle
57
58 !!article
59 Template:Foo
60 !!text
61 FOO
62 !!endarticle
63
64 !! article
65 Template:Blank
66 !! text
67 !! endarticle
68
69 !! article
70 Template:pipe
71 !! text
72 |
73 !! endarticle
74
75 !! article
76 Template:=
77 !! text
78 <nowiki>=</nowiki>
79 !! endarticle
80
81 !!article
82 MediaWiki:bad image list
83 !!text
84 * [[File:Bad.jpg]] except [[Nasty page]]
85 !!endarticle
86
87 !! article
88 Template:inner list
89 !! text
90 * item 1
91 !! endarticle
92
93 !! article
94 Template:tbl-start
95 !! text
96 {|
97 !! endarticle
98
99 !! article
100 Template:tbl-end
101 !! text
102 |}
103 !! endarticle
104
105 !! article
106 Template:echo
107 !! text
108 {{{1}}}
109 !! endarticle
110
111 !! article
112 Template:echo_with_span
113 !! text
114 <span>{{{1}}}</span>
115 !! endarticle
116
117 !! article
118 Template:echo_with_div
119 !! text
120 <div>{{{1}}}</div>
121 !! endarticle
122
123 !! article
124 Template:blank_param
125 !! text
126 {{{1}}}
127 {{{}}}
128 !! endarticle
129
130 !! article
131 Template:table_attribs
132 !! text
133 <noinclude>
134 |</noinclude>style="color:red;"|Foo
135 !! endarticle
136
137 !! article
138 Template:table_attribs_2
139 !! text
140 <noinclude>
141 |</noinclude>style="color:red;"|Foo
142 |Bar||Baz
143 !! endarticle
144
145 !! article
146 Template:table_attribs_3
147 !! text
148 <noinclude>
149 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
150 !! endarticle
151
152 !! article
153 Template:table_attribs_4
154 !! text
155 | style="background-color:#DC241f;" width="10px" |
156 !! endarticle
157
158 !! article
159 Template:table_attribs_5
160 !! text
161 <noinclude>
162 |</noinclude>style="color:red;"||Bar
163 !! endarticle
164
165 !! article
166 Template:table_attribs_6
167 !! text
168 style="background: <nowiki>
169
170
171 red;</nowiki>" |
172 !! endarticle
173
174 !! article
175 Template:table_attribs_7
176 !! text
177 <noinclude>
178 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
179 !! endarticle
180
181 !! article
182 Template:table_header_cells
183 !! text
184 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
185 !! endarticle
186
187 !! article
188 Template:table_cells
189 !! text
190 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
191 !! endarticle
192
193 !! article
194 Template:PartialTable
195 !! text
196 {|
197 |-
198 !! endarticle
199
200 !! article
201 Template:image_attribs
202 !! text
203 <noinclude>
204 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
205 !! endarticle
206
207 ## See T48811 for details
208 !! article
209 Template:mixed_attr_content_template
210 !! text
211 style="color:red;" title="T48811"
212 |-
213 |foo
214 !! endarticle
215
216 !! article
217 Template:definition_list
218 !! text
219 one
220 ::two
221 !! endarticle
222
223 !! article
224 A?b
225 !! text
226 Weirdo titles!
227 !! endarticle
228
229 !!article
230 Template:Bullet
231 !!text
232 * Bar
233 !!endarticle
234
235 !!article
236 Template:OpenTable
237 !!text
238 {|
239 !!endarticle
240
241 !!article
242 Template:EmptyLITest
243 !!text
244 *a
245 *
246 *
247 *b
248 !!endarticle
249
250 !!article
251 Template:EmptyTRTest
252 !!text
253 {|
254 |-
255 |-
256 |foo
257 |-
258 |-
259 |bar
260 |}
261 !!endarticle
262
263 !!article
264 Template:EmptyTRWithHTMLAttrTest
265 !!text
266 <table>
267 <tr align="center"></tr>
268 <tr><td>foo</td></tr>
269 <tr align="center"></tr>
270 <tr><td>bar</td></tr>
271 </table>
272 !!endarticle
273
274 ###
275 ### Basic tests
276 ###
277 !! test
278 Blank input
279 !! wikitext
280 !! html
281 !! end
282
283
284 !! test
285 Simple paragraph
286 !! wikitext
287 This is a simple paragraph.
288 !! html
289 <p>This is a simple paragraph.
290 </p>
291 !! end
292
293 !! test
294 Paragraphs with extra newline spacing
295 !! wikitext
296 foo
297
298 bar
299
300
301 baz
302
303
304
305 booz
306 !! html
307 <p>foo
308 </p><p>bar
309 </p><p><br />
310 baz
311 </p><p><br />
312 </p><p>booz
313 </p>
314 !! end
315
316 !! test
317 Paragraphs with newline spacing with comment lines in between
318 !! wikitext
319 ----
320 a
321 <!--foo-->
322 b
323 ----
324 a
325 <!--foo--><!--More than 1 comment, still stripped-->
326 b
327 ----
328 a
329 <!--foo--> <!----> <!-- bar -->
330 b
331 ----
332 a
333 <!--foo-->
334
335 b
336 ----
337 a
338
339 <!--foo-->
340 b
341 ----
342 a
343 <!--foo-->
344
345
346 b
347 ----
348 a
349
350
351 <!--foo-->
352 b
353 ----
354 !! html
355 <hr />
356 <p>a
357 b
358 </p>
359 <hr />
360 <p>a
361 b
362 </p>
363 <hr />
364 <p>a
365 b
366 </p>
367 <hr />
368 <p>a
369 </p><p>b
370 </p>
371 <hr />
372 <p>a
373 </p><p>b
374 </p>
375 <hr />
376 <p>a
377 </p><p><br />
378 b
379 </p>
380 <hr />
381 <p>a
382 </p><p><br />
383 b
384 </p>
385 <hr />
386
387 !! end
388
389 !! test
390 Paragraphs with newline spacing with non-empty white-space lines in between
391 !! wikitext
392 ----
393 a
394
395 b
396 ----
397 a
398
399
400 b
401 ----
402 !! html
403 <hr />
404 <p>a
405 </p><p>b
406 </p>
407 <hr />
408 <p>a
409 </p><p><br />
410 b
411 </p>
412 <hr />
413
414 !! end
415
416 !! test
417 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
418 !! wikitext
419 ----
420 a
421 <!--foo-->
422 b
423 ----
424 a
425 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
426 b
427 ----
428 a
429
430 <!--foo-->
431 <!--bar-->
432 b
433 ----
434 a
435
436 <!--foo-->
437 <!--bar-->
438
439 b
440 ----
441 !! html
442 <hr />
443 <p>a
444 b
445 </p>
446 <hr />
447 <p>a
448 b
449 </p>
450 <hr />
451 <p>a
452 </p><p>b
453 </p>
454 <hr />
455 <p>a
456 </p><p><br />
457 b
458 </p>
459 <hr />
460
461 !! end
462
463 !! test
464 Extra newlines: More paragraphs with indented comment
465 !! wikitext
466 a
467
468 <!--boo-->
469
470 b
471 !! html
472 <p>a
473 </p><p><br />
474 b
475 </p>
476 !!end
477
478 !! test
479 Extra newlines followed by heading
480 !! wikitext
481 a
482
483
484
485 =b=
486 [[a]]
487
488
489 =b=
490 !! html
491 <p>a
492 </p><p><br />
493 </p>
494 <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>
495 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
496 </p><p><br />
497 </p>
498 <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>
499
500 !! end
501
502 !! test
503 Extra newlines between heading and content are swallowed
504 !! wikitext
505 =b=
506
507
508
509 [[a]]
510 !! html
511 <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>
512 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
513 </p>
514 !! end
515
516 !! test
517 Parsing an URL
518 !! wikitext
519 http://fr.wikipedia.org/wiki/🍺
520 <!-- EasterEgg we love beer, better be able be able to link to it -->
521 !! html
522 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
523 </p>
524 !! end
525
526 # Note that the html+tidy output removes the spaces after the <li>,
527 # which is a bug (http://sourceforge.net/p/tidy/bugs/945/, etc).
528 # This is an issue for all tests with lists. We intentionally do
529 # *not* add html+tidy clauses for these, as we don't want to
530 # document/test the broken behavior. (Parsoid matches the non-tidy
531 # output in these cases.)
532
533 !! test
534 Simple list
535 !! wikitext
536 * Item 1
537 * Item 2
538 !! html
539 <ul><li> Item 1</li>
540 <li> Item 2</li></ul>
541
542 !! end
543
544 !! test
545 Italics and bold
546 !! wikitext
547 * plain
548 * plain''italic''plain
549 * plain''italic''plain''italic''plain
550 * plain'''bold'''plain
551 * plain'''bold'''plain'''bold'''plain
552 * plain''italic''plain'''bold'''plain
553 * plain'''bold'''plain''italic''plain
554 * plain''italic'''bold-italic'''italic''plain
555 * plain'''bold''bold-italic''bold'''plain
556 * plain'''''bold-italic'''italic''plain
557 * plain'''''bold-italic''bold'''plain
558 * plain''italic'''bold-italic'''''plain
559 * plain'''bold''bold-italic'''''plain
560 * plain l'''italic''plain
561 * plain l''''bold''' plain
562 !! html
563 <ul><li> plain</li>
564 <li> plain<i>italic</i>plain</li>
565 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
566 <li> plain<b>bold</b>plain</li>
567 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
568 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
569 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
570 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
571 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
572 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
573 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
574 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
575 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
576 <li> plain l'<i>italic</i>plain</li>
577 <li> plain l'<b>bold</b> plain</li></ul>
578
579 !! end
580
581 # this example taken from the [[simple:Moon]] article (bug 47326)
582 !! test
583 Italics and possessives (1)
584 !! wikitext
585 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
586 !! html
587 <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
588 </p>
589 !! end
590
591 # this example taken from [[en:Flaming Pie]] (bug 49926)
592 !! test
593 Italics and possessives (2)
594 !! wikitext
595 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
596 !! html
597 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
598 </p>
599 !! end
600
601 # this example taken from [[en:Dictionary]] (bug 49926)
602 !! test
603 Italics and possessives (3)
604 !! wikitext
605 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''.
606 !! html
607 <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>.
608 </p>
609 !! end
610
611
612 ###
613 ### 2-quote opening sequence tests
614 ###
615 !! test
616 Italics and bold: 2-quote opening sequence: (2,2)
617 !! wikitext
618 ''foo''
619 !! html
620 <p><i>foo</i>
621 </p>
622 !!end
623
624 !! test
625 Italics and bold: 2-quote opening sequence: (2,3)
626 !! wikitext
627 ''foo'''
628 !! html/*
629 <p><i>foo'</i>
630 </p>
631 !!end
632
633 !! test
634 Italics and bold: 2-quote opening sequence: (2,4)
635 !! options
636 parsoid=wt2html
637 !! wikitext
638 ''foo''''
639 !! html/*
640 <p><i>foo''</i>
641 </p>
642 !!end
643
644 # same html as previous, but wikitext adjusted to match parsoid html2wt
645 !! test
646 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
647 !! wikitext
648 ''foo<nowiki>''</nowiki>''
649 !! html
650 <p><i>foo''</i>
651 </p>
652 !! end
653
654 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
655 !! test
656 Italics and bold: 2-quote opening sequence: (2,5)
657 !! options
658 parsoid=wt2html
659 !! wikitext
660 ''foo'''''
661 !! html/php
662 <p><i>foo</i>
663 </p>
664 !! html/parsoid
665 <p><i>foo</i><b></b>
666 </p>
667 !!end
668
669 # same html as previous, but wikitext adjusted to match parsoid html2wt
670 !! test
671 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
672 !! wikitext
673 ''foo'''''<nowiki/>'''
674 !! html/php
675 <p><i>foo</i>
676 </p>
677 !! html/parsoid
678 <p><i>foo</i><b></b>
679 </p>
680 !! end
681
682
683 ###
684 ### 3-quote opening sequence tests
685 ###
686
687 !! test
688 Italics and bold: 3-quote opening sequence: (3,2)
689 !! wikitext
690 '''foo''
691 !! html/*
692 <p>'<i>foo</i>
693 </p>
694 !!end
695
696 !! test
697 Italics and bold: 3-quote opening sequence: (3,3)
698 !! wikitext
699 '''foo'''
700 !! html
701 <p><b>foo</b>
702 </p>
703 !!end
704
705 !! test
706 Italics and bold: 3-quote opening sequence: (3,4)
707 !! wikitext
708 '''foo''''
709 !! html/*
710 <p><b>foo'</b>
711 </p>
712 !!end
713
714 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
715 !! test
716 Italics and bold: 3-quote opening sequence: (3,5)
717 !! options
718 parsoid=wt2html
719 !! wikitext
720 '''foo'''''
721 !! html/php
722 <p><b>foo</b>
723 </p>
724 !! html/parsoid
725 <p><b>foo</b><i></i>
726 </p>
727 !!end
728
729 # same html as previous, but wikitext adjusted to match parsoid html2wt
730 !! test
731 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
732 !! wikitext
733 '''foo'''''<nowiki/>''
734 !! html/php
735 <p><b>foo</b>
736 </p>
737 !! html/parsoid
738 <p><b>foo</b><i></i>
739 </p>
740 !! end
741
742
743 ###
744 ### 4-quote opening sequence tests
745 ###
746
747 !! test
748 Italics and bold: 4-quote opening sequence: (4,2)
749 !! options
750 parsoid=wt2html
751 !! wikitext
752 ''''foo''
753 !! html/*
754 <p>''<i>foo</i>
755 </p>
756 !!end
757
758 # same html as previous, but wikitext adjusted to match parsoid html2wt
759 !! test
760 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
761 !! wikitext
762 <nowiki>''</nowiki>''foo''
763 !! html
764 <p>''<i>foo</i>
765 </p>
766 !! end
767
768 !! test
769 Italics and bold: 4-quote opening sequence: (4,3)
770 !! wikitext
771 ''''foo'''
772 !! html/*
773 <p>'<b>foo</b>
774 </p>
775 !!end
776
777 !! test
778 Italics and bold: 4-quote opening sequence: (4,4)
779 !! options
780 parsoid=wt2html
781 !! wikitext
782 ''''foo''''
783 !! html/*
784 <p>'<b>foo'</b>
785 </p>
786 !!end
787
788 # same html as previous, but wikitext adjusted to match parsoid html2wt
789 !! test
790 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
791 !! wikitext
792 '<nowiki/>'''foo''''
793 !! html
794 <p>'<b>foo'</b>
795 </p>
796 !! end
797
798 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
799 !! test
800 Italics and bold: 4-quote opening sequence: (4,5)
801 !! options
802 parsoid=wt2html
803 !! wikitext
804 ''''foo'''''
805 !! html/php
806 <p>'<b>foo</b>
807 </p>
808 !! html/parsoid
809 <p>'<b>foo</b><i></i>
810 </p>
811 !!end
812
813 # same html as previous, but wikitext adjusted to match parsoid html2wt
814 !! test
815 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
816 !! wikitext
817 '<nowiki/>'''foo'''''<nowiki/>''
818 !! html/php
819 <p>'<b>foo</b>
820 </p>
821 !! html/parsoid
822 <p>'<b>foo</b><i></i>
823 </p>
824 !! end
825
826
827 ###
828 ### 5-quote opening sequence tests
829 ###
830
831 !! test
832 Italics and bold: 5-quote opening sequence: (5,2)
833 !! options
834 parsoid=wt2html
835 !! wikitext
836 '''''foo''
837 !! html/*
838 <p><b><i>foo</i></b>
839 </p>
840 !!end
841
842 # same html as previous, but wikitext adjusted to match parsoid html2wt
843 !! test
844 Italics and bold: 5-quote opening sequence: (5,2+3)
845 !! wikitext
846 '''''foo'''''
847 !! html/*
848 <p><i><b>foo</b></i>
849 </p>
850 !! end
851
852 !! test
853 Italics and bold: 5-quote opening sequence: (5,3)
854 !! options
855 parsoid=wt2html
856 !! wikitext
857 '''''foo'''
858 !! html/*
859 <p><i><b>foo</b></i>
860 </p>
861 !!end
862
863 # same html as previous, but wikitext adjusted to match parsoid html2wt
864 !! test
865 Italics and bold: 5-quote opening sequence: (5,3+2)
866 !! wikitext
867 '''''foo'''''
868 !! html
869 <p><i><b>foo</b></i>
870 </p>
871 !! end
872
873 !! test
874 Italics and bold: 5-quote opening sequence: (5,4)
875 !! options
876 parsoid=wt2html
877 !! wikitext
878 '''''foo''''
879 !! html/*
880 <p><i><b>foo'</b></i>
881 </p>
882 !!end
883
884 !! test
885 Italics and bold: 5-quote opening sequence: (5,5)
886 !! wikitext
887 '''''foo'''''
888 !! html
889 <p><i><b>foo</b></i>
890 </p>
891 !!end
892
893 !! test
894 Italics and bold: 5-quote opening sequence: (5,6)
895 !! wikitext
896 '''''foo''''''
897 !! html/*
898 <p><i><b>foo'</b></i>
899 </p>
900 !! end
901
902 ###
903 ### multiple quote sequences in a line
904 ###
905 !! test
906 Italics and bold: multiple quote sequences: (2,4,2)
907 !! options
908 parsoid=wt2html
909 !! wikitext
910 ''foo''''bar''
911 !! html/*
912 <p><i>foo'<b>bar</b></i>
913 </p>
914 !!end
915
916
917 # same html as previous, but wikitext adjusted to match parsoid html2wt
918 !! test
919 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
920 !! wikitext
921 ''foo'<nowiki/>'''bar'''''
922 !! html
923 <p><i>foo'<b>bar</b></i>
924 </p>
925 !! end
926
927
928 !! test
929 Italics and bold: multiple quote sequences: (2,4,3)
930 !! options
931 parsoid=wt2html
932 !! wikitext
933 ''foo''''bar'''
934 !! html/*
935 <p><i>foo'<b>bar</b></i>
936 </p>
937 !!end
938
939
940 # same html as previous, but wikitext adjusted to match parsoid html2wt
941 !! test
942 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
943 !! wikitext
944 ''foo'<nowiki/>'''bar'''''
945 !! html
946 <p><i>foo'<b>bar</b></i>
947 </p>
948 !! end
949
950
951 !! test
952 Italics and bold: multiple quote sequences: (2,4,4)
953 !! options
954 parsoid=wt2html
955 !! wikitext
956 ''foo''''bar''''
957 !! html/*
958 <p><i>foo'<b>bar'</b></i>
959 </p>
960 !!end
961
962
963 # same html as previous, but wikitext adjusted to match parsoid html2wt
964 !! test
965 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
966 !! wikitext
967 ''foo'<nowiki/>'''bar'<nowiki/>'''''
968 !! html
969 <p><i>foo'<b>bar'</b></i>
970 </p>
971 !! end
972
973
974 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
975 !! test
976 Italics and bold: multiple quote sequences: (3,4,2)
977 !! options
978 parsoid=wt2html
979 !! wikitext
980 '''foo''''bar''
981 !! html/php
982 <p><b>foo'</b>bar
983 </p>
984 !! html/parsoid
985 <p><b>foo'</b>bar<i></i>
986 </p>
987 !!end
988
989 # same html as previous, but wikitext adjusted to match parsoid html2wt
990 !! test
991 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
992 !! options
993 parsoid
994 !! wikitext
995 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
996 !! html/php
997 <p><b>foo'</b>bar
998 </p>
999 !! html/parsoid
1000 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
1001 </p>
1002 !! end
1003
1004
1005 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1006 !! test
1007 Italics and bold: multiple quote sequences: (3,4,3)
1008 !! options
1009 parsoid=wt2html
1010 !! wikitext
1011 '''foo''''bar'''
1012 !! html/php
1013 <p><b>foo'</b>bar
1014 </p>
1015 !! html/parsoid
1016 <p><b>foo'</b>bar<b></b>
1017 </p>
1018 !!end
1019
1020 # same html as previous, but wikitext adjusted to match parsoid html2wt
1021 !! test
1022 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1023 !! wikitext
1024 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
1025 !! html/php
1026 <p><b>foo'</b>bar
1027 </p>
1028 !! html/parsoid
1029 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
1030 </p>
1031 !! end
1032
1033 ###
1034 ### other quote tests
1035 ###
1036 !! test
1037 Italics and bold: other quote tests: (2,3,5)
1038 !! wikitext
1039 ''this is about '''foo's family'''''
1040 !! html
1041 <p><i>this is about <b>foo's family</b></i>
1042 </p>
1043 !!end
1044
1045
1046 !! test
1047 Italics and bold: other quote tests: (2,(3,3),2)
1048 !! wikitext
1049 ''this is about '''foo's''' family''
1050 !! html
1051 <p><i>this is about <b>foo's</b> family</i>
1052 </p>
1053 !!end
1054
1055
1056 !! test
1057 Italics and bold: other quote tests: (3,2,3,2)
1058 !! options
1059 parsoid=wt2html
1060 !! wikitext
1061 '''this is about ''foo'''s family''
1062 !! html/*
1063 <p><b>this is about <i>foo</i></b><i>s family</i>
1064 </p>
1065 !!end
1066
1067
1068 # same html as previous, but wikitext adjusted to match parsoid html2wt
1069 !! test
1070 Italics and bold: other quote tests: (3,2,3+2+2,2)
1071 !! wikitext
1072 '''this is about ''foo'''''<nowiki/>''s family''
1073 !! html
1074 <p><b>this is about <i>foo</i></b><i>s family</i>
1075 </p>
1076 !! end
1077
1078
1079 !! test
1080 Italics and bold: other quote tests: (3,2,3,3)
1081 !! wikitext
1082 '''this is about ''foo'''s family'''
1083 !! html/*
1084 <p>'<i>this is about </i>foo<b>s family</b>
1085 </p>
1086 !!end
1087
1088
1089 !! test
1090 Italics and bold: other quote tests: (3,(2,2),3)
1091 !! wikitext
1092 '''this is about ''foo's'' family'''
1093 !! html
1094 <p><b>this is about <i>foo's</i> family</b>
1095 </p>
1096 !!end
1097
1098
1099 !! test
1100 Italicized possessive
1101 !! wikitext
1102 The ''[[Main Page]]'''s talk page.
1103 !! html/php
1104 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1105 </p>
1106 !! html/parsoid
1107 <p>The <i><a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1108 !! end
1109
1110 !! test
1111 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1112 (Requires tidy for PHP parser output to be fixed up)
1113 !! options
1114 parsoid=wt2html,wt2wt
1115 !! wikitext
1116 {|
1117 !''a!!''b
1118 |''a||''b
1119 |}
1120 !! html/php+tidy
1121 <table>
1122 <tr>
1123 <th><i>a</i></th>
1124 <th><i>b</i></th>
1125 <td><i>a</i></td>
1126 <td><i>b</i></td>
1127 </tr>
1128 </table>
1129 !! html/parsoid
1130 <table>
1131 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1132 <td><i>a</i></td><td><i>b</i></td></tr>
1133 </tbody></table>
1134 !! end
1135
1136 ###
1137 ### Non-html5 tags
1138 ###
1139
1140 !! test
1141 Non-html5 tags should be accepted
1142 !! wikitext
1143 <center>''foo''</center>
1144 <big>''foo''</big>
1145 <font>''foo''</font>
1146 <strike>''foo''</strike>
1147 <tt>''foo''</tt>
1148 !! html
1149 <center><i>foo</i></center>
1150 <p><big><i>foo</i></big>
1151 <font><i>foo</i></font>
1152 <strike><i>foo</i></strike>
1153 <tt><i>foo</i></tt>
1154 </p>
1155 !! end
1156
1157 !! test
1158 <wbr> is valid wikitext (bug 52468)
1159 !! wikitext
1160 <wbr>
1161 !! html
1162 <p><wbr />
1163 </p>
1164 !! end
1165
1166 # <strike> is HTML4, <s> is HTML4/5.
1167 !! test
1168 <s> or <strike> for strikethrough
1169 !! wikitext
1170 <strike>strike</strike>
1171
1172 <s>s</s>
1173 !! html
1174 <p><strike>strike</strike>
1175 </p><p><s>s</s>
1176 </p>
1177 !! end
1178
1179 ## a not permitted
1180 ## i,b,br omitted
1181 !! test
1182 Text-level semantic html elements in wikitext
1183 !! wikitext
1184 <em>text</em>
1185 <strong>text</strong>
1186 <small>text</small>
1187 <s>text</s>
1188 <cite>text</cite>
1189 <q>text</q>
1190 <dfn>text</dfn>
1191 <abbr>text</abbr>
1192 <data>text</data>
1193 <time>text</time>
1194 <code>text</code>
1195 <var>text</var>
1196 <samp>text</samp>
1197 <kbd>text</kbd>
1198 <sub>text</sub>
1199 <u>text</u>
1200 <mark>text</mark>
1201 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1202 <bdi>text</bdi>
1203 <bdo>text</bdo>
1204 <span>text</span>
1205 <wbr />
1206 !! html
1207 <p><em>text</em>
1208 <strong>text</strong>
1209 <small>text</small>
1210 <s>text</s>
1211 <cite>text</cite>
1212 <q>text</q>
1213 <dfn>text</dfn>
1214 <abbr>text</abbr>
1215 <data>text</data>
1216 <time>text</time>
1217 <code>text</code>
1218 <var>text</var>
1219 <samp>text</samp>
1220 <kbd>text</kbd>
1221 <sub>text</sub>
1222 <u>text</u>
1223 <mark>text</mark>
1224 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1225 <bdi>text</bdi>
1226 <bdo>text</bdo>
1227 <span>text</span>
1228 <wbr />
1229 </p>
1230 !! end
1231
1232 # test cases taken from
1233 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1234 !! test
1235 Ruby markup (W3C-style)
1236 !! wikitext
1237 ; Mono-ruby for individual base characters
1238 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1239 ; Group ruby
1240 : <ruby>今日<rt>きょう</rt></ruby>
1241 ; Jukugo ruby
1242 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1243 ; Inline ruby
1244 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1245 ; Double-sided ruby
1246 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1247 <ruby>
1248 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1249 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1250 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1251 </ruby>
1252 !! html
1253 <dl><dt> Mono-ruby for individual base characters</dt>
1254 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1255 <dt> Group ruby</dt>
1256 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1257 <dt> Jukugo ruby</dt>
1258 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1259 <dt> Inline ruby</dt>
1260 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1261 <dt> Double-sided ruby</dt>
1262 <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>
1263 <p><ruby>
1264 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1265 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1266 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1267 </ruby>
1268 </p>
1269 !! end
1270
1271 # The next two test different paths in the sanitizer.
1272 !! test
1273 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1274 !! wikitext
1275 <blockquote|>a</blockquote>
1276
1277 <b→> doesn't terminate </b→>
1278
1279 <bä> doesn't terminate </bä>
1280
1281 <boo> doesn't terminate </boo>
1282
1283 <s.foo> doesn't terminate </s.foo>
1284
1285 <sub-ID#1>
1286 !! html
1287 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1288 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1289 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1290 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1291 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1292 </p><p>&lt;sub-ID#1&gt;
1293 </p>
1294 !! end
1295
1296 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1297 # If the non-word-character tag made it through the sanitizer, tidy
1298 # would munge it up.
1299 !! test
1300 Non-word characters don't terminate tag names + tidy
1301 !! wikitext
1302 <blockquote|>a</blockquote>
1303
1304 <b→> doesn't terminate </b→>
1305
1306 <bä> doesn't terminate </bä>
1307
1308 <boo> doesn't terminate </boo>
1309
1310 <s.foo> doesn't terminate </s.foo>
1311
1312 <sub-ID#1>
1313 !! html+tidy
1314 <p>&lt;blockquote|&gt;a</p>
1315 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1316 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1317 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1318 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1319 <p>&lt;sub-ID#1&gt;</p>
1320 !! end
1321
1322 ###
1323 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1324 ### This checks that HTML5 tags (with non-word characters in the tag
1325 ### name) make it safely through the parser -- the Sanitizer will
1326 ### munge them later, as it should.
1327 ###
1328 !! test
1329 Non-word characters are valid in extension tags (T19663)
1330 !! wikitext
1331 <tåg>tåg</tåg>
1332 !! html/php
1333 <pre>
1334 'tåg'
1335 array (
1336 )
1337 </pre>
1338
1339 !! html/parsoid
1340 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1341 !! end
1342
1343 !! test
1344 Isolated close tags should be treated as literal text (bug 52760)
1345 !! options
1346 parsoid=wt2html
1347 !! wikitext
1348 </b>
1349
1350 <s.foo>s</s>
1351 !! html/php+tidy
1352 <p>&lt;s.foo&gt;s</p>
1353 !! html/parsoid
1354 <p>&lt;s.foo&gt;s</p>
1355 !! end
1356
1357 ###
1358 ### Special characters
1359 ###
1360
1361 !! test
1362 Bare pipe character (bug 52363)
1363 !! wikitext
1364 |
1365 !! html
1366 <p>|
1367 </p>
1368 !! end
1369
1370 !! test
1371 Bare pipe character from a template (bug 52363)
1372 !! wikitext
1373 {{pipe}}
1374 !! html
1375 <p>|
1376 </p>
1377 !! end
1378
1379 ###
1380 ### <nowiki> test cases
1381 ###
1382
1383 !! test
1384 <nowiki> unordered list
1385 !! wikitext
1386 <nowiki>* This is not an unordered list item.</nowiki>
1387 !! html/php
1388 <p>* This is not an unordered list item.
1389 </p>
1390 !! html/parsoid
1391 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1392 !! end
1393
1394 !! test
1395 <nowiki> spacing
1396 !! wikitext
1397 <nowiki>Lorem ipsum dolor
1398
1399 sed abit.
1400 sed nullum.
1401
1402 :and a colon
1403 </nowiki>
1404 !! html/php
1405 <p>Lorem ipsum dolor
1406
1407 sed abit.
1408 sed nullum.
1409
1410 :and a colon
1411
1412 </p>
1413 !! html/parsoid
1414 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1415
1416 sed abit.
1417 sed nullum.
1418
1419 :and a colon
1420 </span></p>
1421 !! end
1422
1423 !! test
1424 nowiki 3
1425 !! wikitext
1426 :There is not nowiki.
1427 :There is <nowiki>nowiki</nowiki>.
1428
1429 #There is not nowiki.
1430 #There is <nowiki>nowiki</nowiki>.
1431
1432 *There is not nowiki.
1433 *There is <nowiki>nowiki</nowiki>.
1434 !! html/php
1435 <dl><dd>There is not nowiki.</dd>
1436 <dd>There is nowiki.</dd></dl>
1437 <ol><li>There is not nowiki.</li>
1438 <li>There is nowiki.</li></ol>
1439 <ul><li>There is not nowiki.</li>
1440 <li>There is nowiki.</li></ul>
1441
1442 !! html/parsoid
1443 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1444 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1445
1446 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1447 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1448
1449 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1450 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1451 !! end
1452
1453 !! test
1454 Entities inside <nowiki>
1455 !! wikitext
1456 <nowiki>&lt;</nowiki>
1457 !! html
1458 <p>&lt;
1459 </p>
1460 !! end
1461
1462 !! test
1463 Entities inside template parameters
1464 !! wikitext
1465 {{echo|&ndash;}}
1466 !! html/php+tidy
1467 <p>–</p>
1468 !! html/parsoid
1469 <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>
1470 !! end
1471
1472 !! test
1473 Properly escape nowiki when combined with other wiki markup
1474 !! options
1475 parsoid=html2wt
1476 !! html/parsoid
1477 <p>* &lt;/nowiki&gt; tag</p>
1478 !! wikitext
1479 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1480 !! end
1481
1482 !! test
1483 T93824: Put escaped HTML tags inside nowiki
1484 !! options
1485 parsoid=html2wt
1486 !! html/parsoid
1487 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1488 !! wikitext
1489 <nowiki><h2>foo</h2></nowiki>
1490 !! end
1491
1492 !! test
1493 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1494 !! options
1495 parsoid=html2wt
1496 !! html/parsoid
1497 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1498 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1499 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1500 !! wikitext
1501 This text: L'[[Foo]]
1502 This text: L<nowiki>''</nowiki>[[Foo]]
1503 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1504 !! end
1505
1506 # This test fails because wikitext whitespace is not normalized before comparing.
1507 !! test
1508 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1509 !! options
1510 parsoid=html2wt
1511 !! html/parsoid
1512 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1513 </p>
1514 !! wikitext
1515 This text : L<nowiki>''</nowiki>[[Foo]]
1516 !! end
1517
1518 # This test and the next one are html2wt only as they test that incorrect wikitext
1519 # passed in template arguments gets escaped or wrapped in nowikis where required.
1520 !! test
1521 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1522 !! options
1523 parsoid=html2wt
1524 !! html/parsoid
1525 <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>
1526 <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>
1527 !! wikitext
1528 {{echo|foo{{!}}bar}}
1529 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1530 !! end
1531
1532 !! test
1533 T53961: Output correct nowikis in template arguments
1534 !! options
1535 parsoid=html2wt
1536 !! html/parsoid
1537 <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>
1538 <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>
1539 <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>
1540 <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>
1541 <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>
1542 !! wikitext
1543 {{echo|a [ b}}
1544 {{echo|<nowiki>a }} b</nowiki>}}
1545 {{echo|<nowiki>a [[ b</nowiki>}}
1546 {{echo|<nowiki>a | {{ ]]</nowiki>}}
1547 {{echo|a <nowiki>}</nowiki>}}
1548 !! end
1549
1550 !! test
1551 Cases where "!!" needs nowiki protection
1552 !! options
1553 parsoid=html2wt
1554 !! html/parsoid
1555 <table>
1556 <tr><th>this needs protection !! here</th></tr>
1557 </table>
1558
1559 <table>
1560 <tr><th>this does not need
1561 protection !! here</th></tr>
1562 </table>
1563 !! wikitext
1564 {|
1565 !<nowiki>this needs protection !! here</nowiki>
1566 |}
1567
1568 {|
1569 !this does not need
1570 protection !! here
1571 |}
1572 !! end
1573
1574 ###
1575 ### Comments
1576 ###
1577 !! test
1578 Comments and Indent-Pre
1579 !! wikitext
1580 <!-- comment 1 --> asdf
1581
1582 <!-- comment 1 --> asdf
1583 <!-- comment 2 -->
1584
1585 <!-- comment 1 --> asdf
1586 <!-- comment 2 -->xyz
1587
1588 <!-- comment 1 --> asdf
1589 <!-- comment 2 --> xyz
1590 !! html
1591 <pre>asdf
1592 </pre>
1593 <pre>asdf
1594 </pre>
1595 <pre>asdf
1596 </pre>
1597 <p>xyz
1598 </p>
1599 <pre>asdf
1600 xyz
1601 </pre>
1602 !! end
1603
1604 !! test
1605 Comment test 2a
1606 !! wikitext
1607 asdf
1608 <!-- comment 1 -->
1609 jkl
1610 !! html
1611 <p>asdf
1612 jkl
1613 </p>
1614 !! end
1615
1616 !! test
1617 Comment test 2b
1618 !! wikitext
1619 asdf
1620 <!-- comment 1 -->
1621
1622 jkl
1623 !! html
1624 <p>asdf
1625 </p><p>jkl
1626 </p>
1627 !! end
1628
1629 !! test
1630 Comment test 3
1631 !! wikitext
1632 asdf
1633 <!-- comment 1 -->
1634 <!-- comment 2 -->
1635 jkl
1636 !! html
1637 <p>asdf
1638 jkl
1639 </p>
1640 !! end
1641
1642 !! test
1643 Comment test 4
1644 !! wikitext
1645 asdf<!-- comment 1 -->jkl
1646 !! html
1647 <p>asdfjkl
1648 </p>
1649 !! end
1650
1651 !! test
1652 Comment spacing
1653 !! wikitext
1654 a
1655 <!-- foo --> b <!-- bar -->
1656 c
1657 !! html
1658 <p>a
1659 </p>
1660 <pre> b
1661 </pre>
1662 <p>c
1663 </p>
1664 !! end
1665
1666 !! test
1667 Comment whitespace
1668 !! wikitext
1669 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1670 !! html
1671
1672 !! end
1673
1674 !! test
1675 Comment semantics and delimiters
1676 !! wikitext
1677 <!-- --><!----><!-----><!------>
1678 !! html/php
1679
1680 !! html/parsoid
1681 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1682 !! end
1683
1684 !! test
1685 Comment semantics and delimiters, redux
1686 !! wikitext
1687 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1688 -- foo -- funky huh? ... -->
1689 !! html/php
1690
1691 !! html/parsoid
1692 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1693 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1694 !! end
1695
1696 !! test
1697 Comment semantics and delimiters: directors cut
1698 !! wikitext
1699 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1700 everything starting with < followed by !-- until the first -- and > we see,
1701 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1702 -->-->
1703 !! html/php
1704 <p>--&gt;
1705 </p>
1706 !! html/parsoid
1707 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1708 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1709 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1710 --><p>--></p>
1711 !! end
1712
1713 !! test
1714 Comment semantics: nesting
1715 !! wikitext
1716 <!--<!-- no, we're not going to do anything fancy here -->-->
1717 !! html/php
1718 <p>--&gt;
1719 </p>
1720 !! html/parsoid
1721 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1722 !! end
1723
1724 # Parsoid closes the unclosed comment, even if it means a slight
1725 # round-trip diff.
1726 !! test
1727 Comment semantics: unclosed comment at end
1728 !! options
1729 parsoid=wt2html,html2html
1730 !! wikitext
1731 <!--This comment will run out to the end of the document
1732 !! html/php
1733
1734 !! html/parsoid
1735 <!--This comment will run out to the end of the document-->
1736 !! end
1737
1738 !! test
1739 Comment semantics: normalize comments to play nice with XML and browsers
1740 !! wikitext
1741 <!-- Browsers --!> think this is closed -->
1742 <!--> This would normally be text -->
1743 <!---> As would this -->
1744 <!-- XML doesn't like trailing dashes -------->
1745 <!-- Nor doubled hyphens -- anywhere in the data -->
1746 But this is not a comment.
1747 !! html/php
1748 <p>But this is not a comment.
1749 </p>
1750 !! html/parsoid
1751 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1752 <!--&#x3E; This would normally be text -->
1753 <!--&#x2D;&#x3E; As would this -->
1754 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1755 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1756 <p>But this is not a comment.</p>
1757 !! end
1758
1759 !! test
1760 Comment semantics: round-trip even text which contains encoded -->
1761 !! wikitext
1762 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1763 !! html/parsoid
1764 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1765 !! end
1766
1767 !! test
1768 Comment in template title
1769 !! wikitext
1770 {{f<!---->oo}}
1771 !! html
1772 <p>FOO
1773 </p>
1774 !! end
1775
1776 !! test
1777 Comment on its own line post-expand
1778 !! wikitext
1779 a
1780 {{blank}}<!---->
1781 b
1782 !! html
1783 <p>a
1784 </p><p>b
1785 </p>
1786 !! end
1787
1788 !! test
1789 Comment on its own line post-expand with non-significant whitespace
1790 !! wikitext
1791 a
1792 {{blank}} <!---->
1793 b
1794 !! html
1795 <p>a
1796 </p><p>b
1797 </p>
1798 !! end
1799
1800 !! test
1801 Multiple comments should still parse as SOL-transparent
1802 !! options
1803 parsoid=wt2html,wt2wt
1804 !! wikitext
1805 <!--c1-->*a
1806 <!--c2--><!--c3--><!--c4-->*b
1807 !! html/php
1808 <ul><li>a</li>
1809 <li>b</li></ul>
1810
1811 !! html/parsoid
1812 <!--c1--><ul>
1813 <li>a
1814 </li>
1815 <!--c2--><!--c3--><!--c4-->
1816 <li>b
1817 </li>
1818 </ul>
1819 !! end
1820
1821 ###
1822 ### paragraph wrapping tests
1823 ###
1824 !! test
1825 No block tags
1826 !! wikitext
1827 a
1828
1829 b
1830 !! html
1831 <p>a
1832 </p><p>b
1833 </p>
1834 !! end
1835
1836 !! test
1837 Block tag on one line (<div>)
1838 !! wikitext
1839 a <div>foo</div>
1840
1841 b
1842 !! html
1843 a <div>foo</div>
1844 <p>b
1845 </p>
1846 !! html+tidy
1847 <p>a</p>
1848 <div>foo</div>
1849 <p>b</p>
1850 !! end
1851
1852 !! test
1853 Block tag on one line (<blockquote>)
1854 !! wikitext
1855 a <blockquote>foo</blockquote>
1856
1857 b
1858 !! html
1859 a <blockquote>foo</blockquote>
1860 <p>b
1861 </p>
1862 !! html+tidy
1863 <p>a</p>
1864 <blockquote>
1865 <p>foo</p>
1866 </blockquote>
1867 <p>b</p>
1868 !! end
1869
1870 !! test
1871 Block tag on both lines (<div>)
1872 !! wikitext
1873 a <div>foo</div>
1874
1875 b <div>foo</div>
1876 !! html
1877 a <div>foo</div>
1878 b <div>foo</div>
1879
1880 !! html+tidy
1881 <p>a</p>
1882 <div>foo</div>
1883 <p>b</p>
1884 <div>foo</div>
1885 !! end
1886
1887 !! test
1888 Block tag on both lines (<blockquote>)
1889 !! wikitext
1890 a <blockquote>foo</blockquote>
1891
1892 b <blockquote>foo</blockquote>
1893 !! html
1894 a <blockquote>foo</blockquote>
1895 b <blockquote>foo</blockquote>
1896
1897 !! html+tidy
1898 <p>a</p>
1899 <blockquote>
1900 <p>foo</p>
1901 </blockquote>
1902 <p>b</p>
1903 <blockquote>
1904 <p>foo</p>
1905 </blockquote>
1906 !! end
1907
1908 !! test
1909 Multiple lines without block tags
1910 !! wikitext
1911 <div>foo</div> a
1912 b
1913 c
1914 d<!--foo--> e
1915 x <div>foo</div> z
1916 !! html
1917 <div>foo</div> a
1918 <p>b
1919 c
1920 d e
1921 </p>
1922 x <div>foo</div> z
1923
1924 !! html+tidy
1925 <div>foo</div>
1926 <p>a</p>
1927 <p>b c d e</p>
1928 <p>x</p>
1929 <div>foo</div>
1930 <p>z</p>
1931 !! end
1932
1933 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1934 # So, we have a separate section for Parsoid. We don't want
1935 # to mimic this stripping behavior in Parsoid. It affects
1936 # editing experience and also requires us to maintain additional
1937 # info for RT-ing.
1938 !! test
1939 Empty lines between lines with block tags
1940 !! wikitext
1941 <div></div>
1942
1943
1944 <div></div>a
1945
1946 b
1947 <div>a</div>b
1948
1949 <div>b</div>d
1950
1951
1952 <div>e</div>
1953 !! html
1954 <div></div>
1955 <p><br />
1956 </p>
1957 <div></div>a
1958 <p>b
1959 </p>
1960 <div>a</div>b
1961 <div>b</div>d
1962 <p><br />
1963 </p>
1964 <div>e</div>
1965
1966 !! html+tidy
1967 <p><br /></p>
1968 <p>a</p>
1969 <p>b</p>
1970 <div>a</div>
1971 <p>b</p>
1972 <div>b</div>
1973 <p>d</p>
1974 <p><br /></p>
1975 <div>e</div>
1976 !! html/parsoid
1977 <div data-parsoid='{"stx":"html"}'></div>
1978
1979 <p><br /></p>
1980 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1981
1982 <p>b</p>
1983 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1984
1985 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1986
1987 <p><br /></p>
1988 <div data-parsoid='{"stx":"html"}'>e</div>
1989 !! end
1990
1991 ## PHP parser emits output which is broken
1992 !! test
1993 Unclosed HTML p-tags should be handled properly
1994 !! wikitext
1995 <div><p>foo</div>
1996 a
1997
1998 b
1999 !! html/php+tidy
2000 <div>
2001 <p>foo</p>
2002 </div>
2003 <p>a</p>
2004 <p>b</p>
2005 !! html/parsoid
2006 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2007 <p>a</p>
2008 <p>b</p>
2009 !! end
2010
2011 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2012 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2013 ## them for now.
2014 !! test
2015 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2016 !! options
2017 parsoid=wt2html
2018 !! wikitext
2019 a [[Category:A1]] [[Category:A2]]
2020 [[Category:A3]]
2021 [[Category:A4]]
2022 !! html/parsoid
2023 <p>a</p>
2024 <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"/>
2025 !! end
2026
2027 !! test
2028 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2029 !! options
2030 parsoid=wt2html
2031 !! wikitext
2032 [[Category:A1]]a
2033 !! html/parsoid
2034 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2035 !! end
2036
2037 ###
2038 ### Preformatted text
2039 ###
2040 !! test
2041 Preformatted text
2042 !! wikitext
2043 This is some
2044 Preformatted text
2045 With ''italic''
2046 And '''bold'''
2047 And a [[Main Page|link]]
2048 !! html
2049 <pre>This is some
2050 Preformatted text
2051 With <i>italic</i>
2052 And <b>bold</b>
2053 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2054 </pre>
2055 !! end
2056
2057 !! test
2058 Tabs don't trigger preformatted text
2059 !! wikitext
2060 This is not
2061 preformatted text.
2062 This is preformatted text.
2063 So is this.
2064 !! html/php
2065 <p> This is not
2066 preformatted text.
2067 </p>
2068 <pre>This is preformatted text.
2069 So is this.
2070 </pre>
2071 !! html/parsoid
2072 <p> This is not
2073 preformatted text.</p>
2074 <pre>This is preformatted text.
2075 So is this.</pre>
2076 !! end
2077
2078 !! test
2079 Space before tab needs nowiki pre protection
2080 !! options
2081 parsoid=html2wt
2082 !! html/parsoid
2083 <p> a</p>
2084 !! wikitext
2085 <nowiki> </nowiki> a
2086 !! end
2087
2088 !! test
2089 Ident preformatting with inline content
2090 !! wikitext
2091 a
2092 ''b''
2093 !! html
2094 <pre>a
2095 <i>b</i>
2096 </pre>
2097 !! end
2098
2099 !! test
2100 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2101 !! wikitext
2102 <pre><nowiki>
2103 <b>
2104 <cite>
2105 <em>
2106 </nowiki></pre>
2107 !! html
2108 <pre>
2109 &lt;b&gt;
2110 &lt;cite&gt;
2111 &lt;em&gt;
2112 </pre>
2113
2114 !! end
2115
2116 !! test
2117 Regression with preformatted in <center>
2118 !! wikitext
2119 <center>
2120 Blah
2121 </center>
2122 !! html
2123 <center>
2124 <pre>Blah
2125 </pre>
2126 </center>
2127
2128 !! end
2129
2130 !! test
2131 Bug 52763: Preformatted in <blockquote>
2132 !! wikitext
2133 <blockquote>
2134 Blah
2135 {|
2136 |
2137 indented cell (no pre-wrapping!)
2138 |}
2139 </blockquote>
2140 !! html
2141 <blockquote>
2142 <p> Blah
2143 </p>
2144 <table>
2145 <tr>
2146 <td>
2147 <p> indented cell (no pre-wrapping!)
2148 </p>
2149 </td></tr></table>
2150 </blockquote>
2151
2152 !! end
2153
2154 !! test
2155 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2156 !! wikitext
2157 <blockquote>
2158 Foo
2159
2160 Bar
2161 </blockquote>
2162 !! html
2163 <blockquote>
2164 <p>Foo
2165 </p><p>Bar
2166 </p>
2167 </blockquote>
2168
2169 !! end
2170
2171 !! test
2172 Bug 15491: <ins>/<del> in blockquote
2173 !! wikitext
2174 <blockquote>
2175 Foo <del>bar</del> <ins>baz</ins> quux
2176 </blockquote>
2177 !! html
2178 <blockquote>
2179 <p>Foo <del>bar</del> <ins>baz</ins> quux
2180 </p>
2181 </blockquote>
2182
2183 !! end
2184
2185 # Note that the p-wrapping is newline sensitive, which could be
2186 # considered a bug: tidy will wrap only the 'Foo' in the example
2187 # below in a <p> tag. (see comment 23-25 of bug #6200)
2188 !! test
2189 Bug 15491: <ins>/<del> in blockquote (2)
2190 !! wikitext
2191 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2192 </blockquote>
2193 !! html
2194 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2195 </blockquote>
2196
2197 !! html+tidy
2198 <blockquote>
2199 <p>Foo</p>
2200 <del>bar</del> <ins>baz</ins> quux</blockquote>
2201 !! end
2202
2203 !! test
2204 <pre> with attributes (bug 3202)
2205 !! wikitext
2206 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2207 !! html
2208 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2209
2210 !! end
2211
2212 !! test
2213 <pre> with width attribute (bug 3202)
2214 !! wikitext
2215 <pre width="8">Narrow screen goodies</pre>
2216 !! html
2217 <pre width="8">Narrow screen goodies</pre>
2218
2219 !! end
2220
2221 !! test
2222 <pre> with forbidden attribute (bug 3202)
2223 !! wikitext
2224 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2225 !! html
2226 <pre width="8">Narrow screen goodies</pre>
2227
2228 !! end
2229
2230 !! test
2231 Entities inside <pre>
2232 !! wikitext
2233 <pre>&lt;</pre>
2234 !! html
2235 <pre>&lt;</pre>
2236
2237 !! end
2238
2239 !! test
2240 <pre> with forbidden attribute values (bug 3202)
2241 !! wikitext
2242 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2243 !! html
2244 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2245
2246 !! end
2247
2248 !! test
2249 <nowiki> inside <pre> (bug 13238)
2250 !! wikitext
2251 <pre>
2252 <nowiki>
2253 </pre>
2254 <pre>
2255 <nowiki></nowiki>
2256 </pre>
2257 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2258 !! html
2259 <pre>
2260 &lt;nowiki&gt;
2261 </pre>
2262 <pre>
2263
2264 </pre>
2265 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2266
2267 !! end
2268
2269 !! test
2270 <nowiki> inside of #tag:pre
2271 !! wikitext
2272 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2273 !! html/php
2274 <pre>Foo &#8594;bar</pre>
2275
2276 !! html/parsoid
2277 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:pre","function":"#tag"},"params":{"1":{"wt":"Foo &lt;nowiki>&amp;rarr;bar&lt;/nowiki>"}},"i":0}}]}'>Foo <span typeof="mw:Entity">→</span>bar</pre>
2278 !! end
2279
2280 !! test
2281 <nowiki> and <pre> preference (first one wins)
2282 !! wikitext
2283 <pre>
2284 <nowiki>
2285 </pre>
2286 </nowiki>
2287 </pre>
2288
2289 <nowiki>
2290 <pre>
2291 <nowiki>
2292 </pre>
2293 </nowiki>
2294 </pre>
2295
2296 !! html/php
2297 <pre>
2298 &lt;nowiki&gt;
2299 </pre>
2300 <p>&lt;/nowiki&gt;
2301 &lt;/pre&gt;
2302 </p><p>
2303 &lt;pre&gt;
2304 &lt;nowiki&gt;
2305 &lt;/pre&gt;
2306
2307 &lt;/pre&gt;
2308 </p>
2309 !! html/parsoid
2310 <pre data-parsoid='{"stx":"html","strippedNL":true}'>&lt;nowiki>
2311 </pre>
2312 <p><span typeof="mw:Placeholder" data-parsoid='{"src":"&lt;/nowiki>"}'>&lt;/nowiki></span>
2313 &lt;/pre></p>
2314
2315 <p><span typeof="mw:Nowiki">
2316 &lt;pre>
2317 &lt;nowiki>
2318 &lt;/pre>
2319 </span>
2320 &lt;/pre></p>
2321 !! end
2322
2323 !! test
2324 </pre> inside nowiki
2325 !! wikitext
2326 <nowiki></pre></nowiki>
2327 !! html
2328 <p>&lt;/pre&gt;
2329 </p>
2330 !! end
2331
2332 # Parsoid doesn't strip empty tags, like Tidy does.
2333 !! test
2334 Empty pre; pre inside other HTML tags (bug 54946)
2335 !! options
2336 parsoid=wt2html,wt2wt
2337 !! wikitext
2338 a
2339
2340 <div><pre>
2341 foo
2342 </pre></div>
2343 <pre></pre>
2344 !! html/php
2345 <p>a
2346 </p>
2347 <div><pre>
2348 foo
2349 </pre></div>
2350 <pre></pre>
2351
2352 !! html/php+tidy
2353 <p>a</p>
2354 <div>
2355 <pre>
2356 foo
2357 </pre></div>
2358 !! html/parsoid
2359 <p>a</p>
2360
2361 <div><pre>foo
2362 </pre></div>
2363 <pre></pre>
2364 !! end
2365
2366 !! test
2367 HTML pre followed by indent-pre
2368 !! wikitext
2369 <pre>foo</pre>
2370 bar
2371 !! html
2372 <pre>foo</pre>
2373 <pre>bar
2374 </pre>
2375 !! end
2376
2377 # Note that tidy removes the empty <p> tags from the start and end.
2378 # Parsoid does not, by design.
2379 !!test
2380 Block tag pre
2381 !! wikitext
2382 <p><pre>foo</pre></p>
2383 !! html/php+tidy
2384 <pre>
2385 foo
2386 </pre>
2387 !! html/parsoid
2388 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2389 !!end
2390
2391 !!test
2392 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2393 !! wikitext
2394 {{echo|}}
2395 !! html
2396
2397 !!end
2398
2399 !!test
2400 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2401 !! wikitext
2402 {{echo|
2403 foo}}
2404 !! html
2405 <p>foo
2406 </p>
2407 !!end
2408
2409 !! test
2410 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2411 !! wikitext
2412 {{echo|a
2413 b}}
2414 !! html
2415 <pre>a
2416 </pre>
2417 <p>b
2418 </p>
2419 !!end
2420
2421 !! test
2422 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2423 !! wikitext
2424 {{echo|a
2425 b
2426 c
2427 d
2428 e
2429 }}
2430 !! html
2431 <pre>a
2432 </pre>
2433 <p>b
2434 c
2435 </p>
2436 <pre>d
2437 </pre>
2438 <p>e
2439 </p>
2440 !!end
2441
2442 !!test
2443 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2444 !! wikitext
2445 {{echo| foo}}
2446
2447 {{echo| foo}}{{echo| bar}}
2448
2449 {{echo| foo}}
2450 {{echo| bar}}
2451
2452 {{echo|<!--cmt--> foo}}
2453
2454 <!--cmt-->{{echo| foo}}
2455
2456 {{echo|{{echo| }}bar}}
2457 !! html
2458 <pre>foo
2459 </pre>
2460 <pre>foo bar
2461 </pre>
2462 <pre>foo
2463 bar
2464 </pre>
2465 <pre>foo
2466 </pre>
2467 <pre>foo
2468 </pre>
2469 <pre>bar
2470 </pre>
2471 !!end
2472
2473 !! test
2474 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2475 !! wikitext
2476 {{echo| }}a
2477
2478 {{echo|
2479 }}a
2480
2481 {{echo|
2482 b}}
2483
2484 {{echo|a
2485 }}b
2486
2487 {{echo|a
2488 }} b
2489 !! html
2490 <pre>a
2491 </pre>
2492 <p><br />
2493 </p>
2494 <pre>a
2495 </pre>
2496 <p><br />
2497 </p>
2498 <pre>b
2499 </pre>
2500 <p>a
2501 </p>
2502 <pre>b
2503 </pre>
2504 <p>a
2505 </p>
2506 <pre>b
2507 </pre>
2508 !!end
2509
2510 !! test
2511 Pres with newline attributes
2512 !! wikitext
2513 <pre class="one
2514 two">hi</pre>
2515 !! html/php
2516 <pre class="one two">hi</pre>
2517
2518 !! html/parsoid
2519 <pre class="one
2520 two" data-parsoid='{"stx":"html"}'>hi</pre>
2521 !! end
2522
2523 !! test
2524 Things that look like <pre> tags aren't treated as such
2525 !! wikitext
2526 Barack Obama <President> of the United States
2527 <President></President>
2528 !! html
2529 <p>Barack Obama &lt;President&gt; of the United States
2530 &lt;President&gt;&lt;/President&gt;
2531 </p>
2532 !! end
2533
2534 !! test
2535 Handle broken pre-like tags (bug 64025)
2536 !! options
2537 parsoid=wt2html
2538 !! wikitext
2539 {{echo|<pre <pre>x</pre>}}
2540
2541 <table><pre </table>
2542 !! html/php
2543 <pre>x</pre>
2544 <table>&lt;pre </table>
2545
2546 !! html/php+tidy
2547 <pre>
2548 x
2549 </pre>
2550 <p>&lt;pre</p>
2551 !! html/parsoid
2552 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"a":{"&lt;pre":null},"sa":{"&lt;pre":""},"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
2553
2554
2555 <p>&lt;pre </p>
2556
2557 <table></table>
2558 !! end
2559
2560 !! test
2561 Parsoid: handle pre with space after attribute
2562 !! options
2563 parsoid=wt2html
2564 !! wikitext
2565 <pre style="width:50%;" >{{echo|foo}}</pre>
2566 !! html/php
2567 <pre style="width:50%;">{{echo|foo}}</pre>
2568
2569 !! html/parsoid
2570 <pre style="width:50%;">{{echo|foo}}</pre>
2571 !! end
2572
2573 # TODO / maybe: fix wt2wt for this
2574 !! test
2575 Parsoid: Don't paragraph-wrap fosterable content
2576 !! options
2577 parsoid=wt2html
2578 !! wikitext
2579 {|
2580 <td></td>
2581 <td></td>
2582
2583
2584
2585 |}
2586 !! html
2587 <table>
2588
2589 <tbody>
2590 <tr>
2591 <td></td>
2592
2593 <td></td></tr>
2594
2595
2596
2597 </tbody></table>
2598 !! end
2599
2600 !! test
2601 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2602 !! options
2603 parsoid=wt2html
2604 !! wikitext
2605 {|
2606 <td>
2607 <td>
2608 </td>
2609
2610
2611
2612 |}
2613 !! html
2614 <table>
2615
2616 <tbody>
2617 <tr>
2618 <td></td>
2619
2620 <td>
2621 </td></tr>
2622
2623
2624
2625 </tbody></table>
2626 !! end
2627
2628
2629 #--------------------------------------------------------------------
2630 # Transclusion parameter whitespace stripping tests
2631 # Behavior is different for positional and named parameters
2632 #--------------------------------------------------------------------
2633 !! test
2634 Templates: Strip leading and trailing whitespace from named-param values
2635 !! wikitext
2636 {{echo|1= a }}
2637
2638 {{echo|1= {{echo|b}} }}
2639
2640 {{echo| 1 =
2641 c }}
2642
2643 {{echo| 1 =
2644 * d
2645 }}
2646 !! html
2647 <p>a
2648 </p><p>b
2649 </p><p>c
2650 </p>
2651 <ul><li> d</li></ul>
2652
2653 !! end
2654
2655 !! test
2656 Templates: Don't strip whitespace from positional-param values
2657 !! wikitext
2658 {{echo|a }}
2659
2660 {{echo|{{echo|b}} }}
2661
2662 {{echo| c
2663 }}
2664
2665 {{echo| {{echo|d}}
2666 }}
2667
2668 {{echo|
2669 e}}
2670
2671 {{echo|
2672 * f}}
2673
2674 {{echo|
2675 }}g
2676 !! html
2677 <p>a
2678 </p><p>b
2679 </p>
2680 <pre>c
2681 </pre>
2682 <p><br />
2683 </p>
2684 <pre>d
2685 </pre>
2686 <p><br />
2687 </p>
2688 <pre>e
2689 </pre>
2690 <p><br />
2691 </p>
2692 <ul><li> f</li></ul>
2693 <p><br />
2694 </p>
2695 <pre>g
2696 </pre>
2697 !! end
2698
2699 !! test
2700 Templates: Handle empty comment-and-ws-only lines correctly
2701 !! wikitext
2702 {{echo|foo
2703 <!--should be ignored-->
2704 <!--should be ignored as well-->
2705 bar}}
2706 !! html
2707 <p>foo
2708 bar
2709 </p>
2710 !! end
2711
2712 !! test
2713 Templates: Handle comments in the target
2714 !! wikitext
2715 {{echo
2716 <!-- should be ignored -->
2717 |foo}}
2718
2719 {{echo<!-- should be ignored -->
2720 |foo}}
2721
2722 {{echo<!-- should be ignored -->|foo}}
2723
2724 {{<!-- should be ignored -->echo|foo}}
2725 !!html/parsoid
2726 <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>
2727
2728 <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>
2729
2730 <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>
2731
2732 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2733 !!end
2734
2735 !! test
2736 Templates: Handle comments in parameter names (bug 67657)
2737 !! wikitext
2738 {{echo|1
2739 <!-- should be ignored -->
2740 =foo}}
2741
2742 {{echo|
2743 <!-- should be ignored -->
2744 1 = foo}}
2745
2746 {{echo|1<!-- should be ignored -->=foo}}
2747
2748 {{echo|<!-- should be ignored -->1=foo}}
2749 !!html/parsoid
2750 <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>
2751
2752 <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>
2753
2754 <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>
2755
2756 <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>
2757 !!end
2758
2759 !! test
2760 Templates: Other wikitext in parameter names (bug 67657)
2761 !! wikitext
2762 {{echo|''1''=foo}}
2763 !!html/parsoid
2764 <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>
2765 !!html/php
2766 <p>{{{1}}}
2767 </p>
2768 !!end
2769
2770 #--------------------------------------------------------------------
2771 # Transclusion parameter escaping tests
2772 #--------------------------------------------------------------------
2773 !! test
2774 Templates: Parsoid parameter escaping test 1
2775 !! wikitext
2776 {{echo|[foo]|{{echo|[bar]}}}}
2777 !! html/php+tidy
2778 <p>[foo]</p>
2779 !! html/parsoid
2780 <p about="#mwt1" typeof="mw:Transclusion"
2781 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2782 !! end
2783
2784 !! test
2785 Parsoid: Pipes in external links in template parameter
2786 !! wikitext
2787 {{echo|[{{echo|http://example.com}} link]}}
2788 !! html/php+tidy
2789 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2790 !! html/parsoid
2791 <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>
2792 !! end
2793
2794 !! test
2795 Parsoid: pipe in transclusion parameter
2796 !! wikitext
2797 {{echo|http://foo.com/a&#124;b}}
2798 !! html/php+tidy
2799 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2800 !! html/parsoid
2801 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2802 typeof="mw:Transclusion"
2803 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>
2804 !! end
2805
2806 !! test
2807 Parsoid: Pipe in external link target and content in template parameter
2808 !! options
2809 parsoid=html2wt,wt2wt
2810 !! wikitext
2811 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2812 !! html/php+tidy
2813 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2814 !! html/parsoid
2815 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2816 typeof="mw:Transclusion"
2817 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2818 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2819 !! end
2820
2821 !! test
2822 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2823 !! options
2824 parsoid
2825 !! wikitext
2826 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2827 !! html
2828 <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>
2829 !! end
2830
2831 !! test
2832 Templates: Don't escape already nowiki-escaped text in template parameters
2833 !! options
2834 parsoid=html2wt,wt2wt
2835 !! wikitext
2836 {{echo|foo<nowiki>|</nowiki>bar}}
2837 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2838 {{echo|<nowiki></nowiki>}}
2839 !! html/php+tidy
2840 <p>foo|bar &lt;div&gt;</p>
2841 !! html/parsoid
2842 <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>
2843 <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>
2844 <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>
2845 </p>
2846 !! end
2847
2848 ## Bug 52824
2849 !! test
2850 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2851 !! options
2852 parsoid=html2wt,wt2wt
2853 !! wikitext
2854 {{echo|{{echo|1=bar}}}}
2855 !! html/php+tidy
2856 <p>bar</p>
2857 !! html/parsoid
2858 <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>
2859 !! end
2860
2861 ## Bug 56733
2862 !! test
2863 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2864 !! wikitext
2865 {{echo|a : b}}
2866 !! html/php+tidy
2867 <p>a&#160;: b</p>
2868 !! html/parsoid
2869 <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>
2870 !! end
2871
2872 ## Bug T73412
2873 !! test
2874 Templates: Preserve blank parameter names
2875 !! wikitext
2876 {{echo|=foo}}
2877 !! html/php+tidy
2878 <p>{{{1}}}</p>
2879 !! html/parsoid
2880 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2881 !! end
2882
2883 !! test
2884 Templates: Preserve blank parameter names in other positions
2885 !! wikitext
2886 {{blank_param|bar|=foo}}
2887 !! html/php+tidy
2888 <p>bar foo</p>
2889 !! html/parsoid
2890 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"blank_param","href":"./Template:Blank_param"},"params":{"1":{"wt":"bar"},"":{"wt":"foo"}},"i":0}}]}'>bar
2891 foo</p>
2892 !! end
2893
2894 ###
2895 ### Parsoid-centric tests for testing RT edge cases for pre
2896 ###
2897
2898 !!test
2899 1a. Indent-Pre and Comments
2900 !! wikitext
2901 a
2902 <!--a-->
2903 c
2904 !! html
2905 <pre>a
2906 </pre>
2907 <p>c
2908 </p>
2909 !!end
2910
2911 !!test
2912 1b. Indent-Pre and Comments
2913 !! wikitext
2914 a
2915 <!--a-->
2916 c
2917 !! html
2918 <pre>a
2919 </pre>
2920 <p>c
2921 </p>
2922 !!end
2923
2924 !!test
2925 1c. Indent-Pre and Comments
2926 !! wikitext
2927 <!--a--> a
2928
2929 <!--a--> a
2930 !! html
2931 <pre> a
2932 </pre>
2933 <pre> a
2934 </pre>
2935 !!end
2936
2937 !!test
2938 1d. Indent-Pre and Comments
2939 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2940 !! wikitext
2941 <!--a--> a
2942
2943 <!--b-->b
2944 !! html
2945 <pre>a
2946 </pre>
2947 <pre>b
2948 </pre>
2949 !!end
2950
2951 !!test
2952 2a. Indent-Pre and tables
2953 !! wikitext
2954 {|
2955 |-
2956 !h1!!h2
2957 |foo||bar
2958 |}
2959 !! html
2960 <table>
2961
2962 <tr>
2963 <th>h1</th>
2964 <th>h2
2965 </th>
2966 <td>foo</td>
2967 <td>bar
2968 </td></tr></table>
2969
2970 !!end
2971
2972 !!test
2973 2b. Indent-Pre and tables
2974 !! wikitext
2975 {|
2976 |-
2977 |foo
2978 |}
2979 !! html
2980 <table>
2981
2982 <tr>
2983 <td>foo
2984 </td></tr></table>
2985
2986 !!end
2987
2988 !!test
2989 2c. Indent-Pre and tables (bug 42252)
2990 !! wikitext
2991 {|
2992 |+ foo
2993 ! | bar
2994 |}
2995 !! html
2996 <table>
2997 <caption> foo
2998 </caption>
2999 <tr>
3000 <th> bar
3001 </th></tr></table>
3002
3003 !!end
3004
3005 !!test
3006 2d. Indent-Pre and tables
3007 !! wikitext
3008 a
3009 {|
3010 | b
3011 |}
3012 !! html/php
3013 <pre>a
3014 </pre>
3015 <table>
3016 <tr>
3017 <td> b
3018 </td></tr></table>
3019
3020 !! html/parsoid
3021 <pre>a</pre>
3022 <table>
3023 <tbody><tr><td> b</td></tr>
3024 </tbody></table>
3025 !!end
3026
3027 !!test
3028 2e. Indent-Pre and table-line syntax
3029 !! wikitext
3030 a
3031 | b
3032 | c
3033 !! html/php
3034 <pre>a
3035 | b
3036 | c
3037 </pre>
3038 !!end
3039
3040 !!test
3041 2f. Indent-pre started by table-line syntax
3042 !! wikitext
3043 a
3044 | b
3045 | c
3046 !! html/php
3047 <p>a
3048 </p>
3049 <pre>| b
3050 | c
3051 </pre>
3052 !! html/parsoid
3053 <p>a</p>
3054 <pre>
3055 | b
3056 | c</pre>
3057 !!end
3058
3059 !! test
3060 2g. Indented table markup mixed with indented pre content (proposed in bug 6200)
3061 !! wikitext
3062 <table>
3063 <tr>
3064 <td>
3065 Text that should be rendered preformatted
3066 </td>
3067 </tr>
3068 </table>
3069 !! html
3070 <table>
3071 <tr>
3072 <td>
3073 <pre>Text that should be rendered preformatted
3074 </pre>
3075 </td>
3076 </tr>
3077 </table>
3078
3079 !! end
3080
3081 !!test
3082 3a. Indent-Pre and block tags (single-line html)
3083 !! wikitext
3084 a <p> foo </p>
3085 b <div> foo </div>
3086 c <blockquote> foo </blockquote>
3087 <span> foo </span>
3088 !! html
3089 a <p> foo </p>
3090 b <div> foo </div>
3091 c <blockquote> foo </blockquote>
3092 <pre><span> foo </span>
3093 </pre>
3094 !! html/parsoid
3095 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3096 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3097 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3098 <pre><span> foo </span>
3099 </pre>
3100 !! html+tidy
3101 <p>a</p>
3102 <p>foo</p>
3103 <p>b</p>
3104 <div>foo</div>
3105 <p>c</p>
3106 <blockquote>
3107 <p>foo</p>
3108 </blockquote>
3109 <pre>
3110 <span> foo </span>
3111 </pre>
3112 !! end
3113
3114 !!test
3115 3b. Indent-Pre and block tags (multi-line html)
3116 !! wikitext
3117 a <span>foo</span>
3118 b <div> foo </div>
3119 !! html
3120 <pre>a <span>foo</span>
3121 </pre>
3122 b <div> foo </div>
3123
3124 !! html/parsoid
3125 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3126 b <div data-parsoid='{"stx":"html"}'> foo </div>
3127 !! html+tidy
3128 <pre>
3129 a <span>foo</span>
3130 </pre>
3131 <p>b</p>
3132 <div>foo</div>
3133 !!end
3134
3135 !!test
3136 3c. Indent-Pre and block tags (pre-content on separate line)
3137 !! wikitext
3138 <p>
3139 foo
3140 </p>
3141
3142 <div>
3143 foo
3144 </div>
3145
3146 <center>
3147 foo
3148 </center>
3149
3150 <blockquote>
3151 foo
3152 </blockquote>
3153
3154 <blockquote>
3155 <pre>
3156 foo
3157 </pre>
3158 </blockquote>
3159
3160 <table><tr><td>
3161 foo
3162 </td></tr></table>
3163
3164 <ul><li>
3165 foo
3166 </li></ul>
3167
3168 !! html
3169 <p>
3170 foo
3171 </p>
3172 <div>
3173 <pre>foo
3174 </pre>
3175 </div>
3176 <center>
3177 <pre>foo
3178 </pre>
3179 </center>
3180 <blockquote>
3181 <p> foo
3182 </p>
3183 </blockquote>
3184 <blockquote>
3185 <pre>
3186 foo
3187 </pre>
3188 </blockquote>
3189 <table><tr><td>
3190 <pre>foo
3191 </pre>
3192 </td></tr></table>
3193 <ul><li>
3194 foo
3195 </li></ul>
3196
3197 !!end
3198
3199 !! test
3200 4. Indent-Pre and extension tags
3201 !! wikitext
3202 a <tag />
3203 !! html/php
3204 a <pre>
3205 NULL
3206 array (
3207 )
3208 </pre>
3209
3210 !! html/parsoid
3211 a <pre typeof="mw:Extension/tag" about="#mwt2" data-parsoid='{}' data-mw='{"name":"tag","attrs":{},"body":null}'></pre>
3212 !! end
3213
3214 !!test
3215 Render paragraphs when indent-pre is suppressed in blocklevels
3216 !! wikitext
3217 <blockquote>
3218 foo
3219
3220 bar
3221 </blockquote>
3222 !! html
3223 <blockquote>
3224 <p> foo
3225 </p><p> bar
3226 </p>
3227 </blockquote>
3228
3229 !!end
3230
3231 !!test
3232 4. Multiple spaces at start-of-line
3233 !! wikitext
3234 <p> foo </p>
3235 foo
3236 {|
3237 |foo
3238 |}
3239 !! html
3240 <p> foo </p>
3241 <pre> foo
3242 </pre>
3243 <table>
3244 <tr>
3245 <td>foo
3246 </td></tr></table>
3247
3248 !!end
3249
3250 ## NOTE: the leading white-space chars on empty line are significant
3251 !! test
3252 5a. White-space in indent-pre
3253 !! wikitext
3254 a<br />
3255
3256 b
3257 !! html
3258 <pre>a<br />
3259
3260 b
3261 </pre>
3262 !! end
3263
3264 ## NOTE: the leading white-space chars on empty line are significant
3265 !! test
3266 5b. White-space in indent-pre
3267 !! wikitext
3268 a
3269
3270 b
3271
3272
3273 c
3274 !! html
3275 <pre>a
3276
3277 b
3278
3279
3280 c
3281 </pre>
3282 !! end
3283
3284 !! test
3285 5c. White-space in indent-pre
3286 !! wikitext
3287 ''a''
3288 ''b''
3289 ''c''
3290 !! html
3291 <pre><i>a</i>
3292 <i>b</i>
3293 <i>c</i>
3294 </pre>
3295 !! end
3296
3297 !! test
3298 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3299 !! wikitext
3300 a
3301
3302 <!-- continue -->
3303 b
3304
3305 c
3306
3307 d
3308 !! html
3309 <pre>a
3310
3311 b
3312 </pre>
3313 <pre>c
3314
3315 </pre>
3316 <p>d
3317 </p>
3318 !! end
3319
3320 !! test
3321 7a. Indent-pre and category links
3322 !! options
3323 parsoid=wt2html,wt2wt
3324 !! wikitext
3325 [[Category:foo]] <!-- No pre-wrapping -->
3326 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3327 !! html/php+tidy
3328 !! html/parsoid
3329 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3330 <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 -->
3331 !! end
3332
3333 ## We used to, but no longer wt2wt this test since the default serializer
3334 ## will normalize all categories to serialize on their own line.
3335 ## This wikitext usage is going to be fairly uncommon in production and
3336 ## selser will take care of preserving formatting in those scenarios.
3337 !! test
3338 7b. Indent-pre and category links
3339 !! options
3340 parsoid=wt2html
3341 !! wikitext
3342 [[Category:foo]] a
3343 [[Category:foo]] {{echo|b}}
3344 !! html/parsoid
3345 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3346 <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>
3347 !! end
3348
3349 !! test
3350 Indent-Pre: Newlines in comments shouldn't affect sol state
3351 !! wikitext
3352 a <!--
3353 foo
3354 --> b
3355 !! html/php+tidy
3356 <p>a b</p>
3357 !! html/parsoid
3358 <p>a <!--
3359 foo
3360 --> b</p>
3361 !! end
3362
3363 ###
3364 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3365 ###
3366
3367 !!test
3368 HTML-pre: 1. embedded newlines
3369 !! wikitext
3370 <pre>foo</pre>
3371
3372 <pre>
3373 foo
3374 </pre>
3375
3376 <pre>
3377
3378 foo
3379 </pre>
3380
3381 <pre>
3382
3383
3384 foo
3385 </pre>
3386 !! html/php+tidy
3387 <pre>
3388 foo
3389 </pre>
3390 <pre>
3391 foo
3392 </pre>
3393 <pre>
3394
3395 foo
3396 </pre>
3397 <pre>
3398
3399
3400 foo
3401 </pre>
3402 !! html/parsoid
3403 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3404
3405 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3406 foo
3407 </pre>
3408
3409 <pre data-parsoid='{"stx":"html"}'>
3410
3411 foo
3412 </pre>
3413
3414 <pre data-parsoid='{"stx":"html"}'>
3415
3416
3417 foo
3418 </pre>
3419 !!end
3420
3421 !! test
3422 HTML-pre: big spaces
3423 !! wikitext
3424 <pre>
3425
3426
3427
3428
3429 haha
3430
3431
3432
3433
3434 haha
3435
3436
3437
3438
3439 </pre>
3440 !! html/php+tidy
3441 <pre>
3442
3443
3444
3445
3446 haha
3447
3448
3449
3450
3451 haha
3452
3453
3454
3455
3456 </pre>
3457 !! html/parsoid
3458 <pre data-parsoid='{"stx":"html"}'>
3459
3460
3461
3462
3463 haha
3464
3465
3466
3467
3468 haha
3469
3470
3471
3472
3473 </pre>
3474 !! end
3475
3476 !!test
3477 HTML-pre: 2: indented text
3478 !! wikitext
3479 <pre>
3480 foo
3481 </pre>
3482 !! html
3483 <pre>
3484 foo
3485 </pre>
3486
3487 !!end
3488
3489 !!test
3490 HTML-pre: 3: other wikitext
3491 !! wikitext
3492 <pre>
3493 * foo
3494 # bar
3495 = no-h =
3496 '' no-italic ''
3497 [[ NoLink ]]
3498 </pre>
3499 !! html/php
3500 <pre>
3501 * foo
3502 # bar
3503 = no-h =
3504 '' no-italic ''
3505 [[ NoLink ]]
3506 </pre>
3507
3508 !! html/parsoid
3509 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3510 # bar
3511 = no-h =
3512 '' no-italic ''
3513 [[ NoLink ]]
3514 </pre>
3515 !!end
3516
3517 ###
3518 ### Definition lists
3519 ###
3520 !! test
3521 Simple definition
3522 !! wikitext
3523 ; name : Definition
3524 !! html
3525 <dl><dt> name&#160;</dt>
3526 <dd> Definition</dd></dl>
3527
3528 !! end
3529
3530 !! test
3531 Definition list for indentation only
3532 !! wikitext
3533 : Indented text
3534 !! html
3535 <dl><dd> Indented text</dd></dl>
3536
3537 !! end
3538
3539 !! test
3540 Definition list with no space
3541 !! wikitext
3542 ;name:Definition
3543 !! html
3544 <dl><dt>name</dt>
3545 <dd>Definition</dd></dl>
3546
3547 !!end
3548
3549 !! test
3550 Definition list with URL link
3551 !! wikitext
3552 ; http://example.com/ : definition
3553 !! html
3554 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3555 <dd> definition</dd></dl>
3556
3557 !! end
3558
3559 !! test
3560 Definition list with bracketed URL link
3561 !! wikitext
3562 ;[http://www.example.com/ Example]:Something about it
3563 !! html
3564 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3565 <dd>Something about it</dd></dl>
3566
3567 !! end
3568
3569 !! test
3570 Definition list with wikilink containing colon
3571 !! wikitext
3572 ; [[Help:FAQ]]: The least-read page on Wikipedia
3573 !! html
3574 <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>
3575 <dd> The least-read page on Wikipedia</dd></dl>
3576
3577 !! end
3578
3579 # At Brion's and JeLuF's insistence... :)
3580 !! test
3581 Definition list with news link containing colon
3582 !! wikitext
3583 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3584 !! html/php
3585 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3586 <dd> This isn't even a real newsgroup!</dd></dl>
3587
3588 !! html/parsoid
3589 <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>
3590 !! end
3591
3592 !! test
3593 Malformed definition list with colon
3594 !! wikitext
3595 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3596 !! html
3597 <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>
3598
3599 !! end
3600
3601 !! test
3602 Definition lists: colon in external link text
3603 !! wikitext
3604 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3605 !! html
3606 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3607 <dd> OK, I made that up</dd></dl>
3608
3609 !! end
3610
3611 !! test
3612 Definition lists: colon in HTML attribute
3613 !! wikitext
3614 ;<b style="display: inline">bold</b>
3615 !! html
3616 <dl><dt><b style="display: inline">bold</b></dt></dl>
3617
3618 !! end
3619
3620 !! test
3621 Definition lists: self-closed tag
3622 !! wikitext
3623 ;one<br/>two : two-line fun
3624 !! html
3625 <dl><dt>one<br />two&#160;</dt>
3626 <dd> two-line fun</dd></dl>
3627
3628 !! end
3629
3630 !! test
3631 Bug 11748: Literal closing tags
3632 !! wikitext
3633 <dl>
3634 <dt>test 1</dt>
3635 <dd>test test test test test</dd>
3636 <dt>test 2</dt>
3637 <dd>test test test test test</dd>
3638 </dl>
3639 !! html
3640 <dl>
3641 <dt>test 1</dt>
3642 <dd>test test test test test</dd>
3643 <dt>test 2</dt>
3644 <dd>test test test test test</dd>
3645 </dl>
3646
3647 !! end
3648
3649 !! test
3650 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3651 !! wikitext
3652 <ul><li>
3653 ; term : description
3654 * unordered
3655 </li></ul>
3656 !! html
3657 <ul><li>
3658 <dl><dt> term&#160;</dt>
3659 <dd> description</dd></dl>
3660 <ul><li> unordered</li></ul>
3661 </li></ul>
3662
3663 !! end
3664
3665 !! test
3666
3667 Definition list with empty definition and following paragraph
3668 !! wikitext
3669 ; term:
3670 Paragraph text
3671 !! html
3672 <dl><dt> term</dt>
3673 <dd></dd></dl>
3674 <p>Paragraph text
3675 </p>
3676 !! end
3677
3678 !! test
3679 Nested definition lists using html syntax
3680 !! wikitext
3681 <dl><dt>x</dt>
3682 <dd>a</dd>
3683 <dd>b</dd></dl>
3684
3685 !! end
3686
3687 !! test
3688 Definition Lists: No nesting: Multiple dd's
3689 !! wikitext
3690 ;x
3691 :a
3692 :b
3693 !! html
3694 <dl><dt>x</dt>
3695 <dd>a</dd>
3696 <dd>b</dd></dl>
3697
3698 !! end
3699
3700 !! test
3701 Definition Lists: Indentation: Regular
3702 !! wikitext
3703 :i1
3704 ::i2
3705 :::i3
3706 !! html
3707 <dl><dd>i1
3708 <dl><dd>i2
3709 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3710
3711 !! end
3712
3713 !! test
3714 Definition Lists: Indentation: Missing 1st level
3715 !! wikitext
3716 ::i2
3717 :::i3
3718 !! html
3719 <dl><dd><dl><dd>i2
3720 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3721
3722 !! end
3723
3724 !! test
3725 Definition Lists: Indentation: Multi-level indent
3726 !! wikitext
3727 :::i3
3728 !! html
3729 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3730
3731 !! end
3732
3733 !! test
3734 Definition Lists: Hacky use to indent tables
3735 !! wikitext
3736 ::{|
3737 |foo
3738 |bar
3739 |}
3740 this text
3741 should be left alone
3742 !! html
3743 <dl><dd><dl><dd><table>
3744 <tr>
3745 <td>foo
3746 </td>
3747 <td>bar
3748 </td></tr></table></dd></dl></dd></dl>
3749 <p>this text
3750 should be left alone
3751 </p>
3752 !! end
3753
3754 !! test
3755 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3756 !! wikitext
3757 <!-- foo -->
3758 ::{|
3759 |foo
3760 |bar
3761 |}<!-- bar -->
3762 this text
3763 should be left alone
3764 !! html/parsoid
3765 <!-- foo -->
3766 <dl><dd><dl><dd><table><tr>
3767 <td>foo</td>
3768 <td>bar</td>
3769 </tr></table><!-- bar --></dd></dl></dd></dl>
3770 <p>this text
3771 should be left alone</p>
3772 !! end
3773
3774 !! test
3775 Definition Lists: Hacky use to indent tables, with comment before table
3776 !! wikitext
3777 ::<!-- foo -->{|
3778 |foo
3779 |}
3780 !! html/parsoid
3781 <dl><dd><dl><dd><!-- foo --><table><tr>
3782 <td>foo</td>
3783 </tr></table></dd></dl></dd></dl>
3784 !! end
3785
3786 # The trailing whitespace in this test is to catch a regression in
3787 # Parsoid after T54473.
3788 !! test
3789 Definition Lists: Hacky use to indent tables (WS-insensitive)
3790 !! wikitext
3791 : {|
3792 |a
3793 |}
3794 !! html/php
3795 <dl><dd><table>
3796 <tr>
3797 <td>a
3798 </td></tr></table></dd></dl>
3799
3800 !! html/parsoid
3801 <dl><dd> <table>
3802 <tbody><tr><td>a</td></tr>
3803 </tbody></table> </dd></dl>
3804 !! end
3805
3806 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3807 ## as an empty dt item. It also ignores all but the last ";" when followed
3808 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3809 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3810 ## ";"s.
3811 ##
3812 ## Ex: ";;t2 ::d2" is transformed into:
3813 ##
3814 ## <dl>
3815 ## <dt>t2 </dt>
3816 ## <dd>
3817 ## <dl>
3818 ## <dt></dt>
3819 ## <dd>d2</dd>
3820 ## </dl>
3821 ## </dd>
3822 ## </dl>
3823 ##
3824 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3825 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3826 ##
3827 ## <dl>
3828 ## <dt>
3829 ## <dl>
3830 ## <dt>t2 </dt>
3831 ## <dd>:d2</dd>
3832 ## </dl>
3833 ## </dt>
3834 ## </dl>
3835 ##
3836 ## All Parsoid only definition list tests have this difference.
3837 ##
3838 ## See also: https://phabricator.wikimedia.org/T8569
3839 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3840
3841 !! test
3842 Table / list interaction: indented table with lists in table contents
3843 !! wikitext
3844 :{|
3845 |-
3846 | a
3847 * b
3848 |-
3849 | c
3850 * d
3851 |}
3852 !! html
3853 <dl><dd><table>
3854
3855 <tr>
3856 <td> a
3857 <ul><li> b</li></ul>
3858 </td></tr>
3859 <tr>
3860 <td> c
3861 <ul><li> d</li></ul>
3862 </td></tr></table></dd></dl>
3863
3864 !! end
3865
3866 !!test
3867 Table / list interaction: lists nested in tables nested in indented lists
3868 !! wikitext
3869 :{|
3870 |
3871 :a
3872 :b
3873 |
3874 *c
3875 *d
3876 |}
3877
3878 *e
3879 *f
3880 !! html
3881 <dl><dd><table>
3882 <tr>
3883 <td>
3884 <dl><dd>a</dd>
3885 <dd>b</dd></dl>
3886 </td>
3887 <td>
3888 <ul><li>c</li>
3889 <li>d</li></ul>
3890 </td></tr></table></dd></dl>
3891 <ul><li>e</li>
3892 <li>f</li></ul>
3893
3894 !!end
3895
3896 !! test
3897 Definition Lists: Nesting: Multi-level (Parsoid only)
3898 !! options
3899 parsoid
3900 !! wikitext
3901 ;t1 :d1
3902 ;;t2 ::d2
3903 ;;;t3 :::d3
3904 !! html
3905 <dl>
3906 <dt>t1 </dt>
3907 <dd>d1</dd>
3908 <dt>
3909 <dl>
3910 <dt>t2 </dt>
3911 <dd>:d2</dd>
3912 <dt>
3913 <dl>
3914 <dt>t3 </dt>
3915 <dd>::d3</dd>
3916 </dl>
3917 </dt>
3918 </dl>
3919 </dt>
3920 </dl>
3921
3922
3923 !! end
3924
3925
3926 !! test
3927 Definition Lists: Nesting: Test 2 (Parsoid only)
3928 !! wikitext
3929 ;t1
3930 ::d2
3931 !! html/php+tidy
3932 <dl>
3933 <dt>t1</dt>
3934 <dd>
3935 <dl>
3936 <dd>d2</dd>
3937 </dl>
3938 </dd>
3939 </dl>
3940 !! html/parsoid
3941 <dl>
3942 <dt>t1</dt>
3943 <dd>
3944 <dl>
3945 <dd>d2</dd>
3946 </dl>
3947 </dd>
3948 </dl>
3949
3950 !! end
3951
3952
3953 !! test
3954 Definition Lists: Nesting: Test 3 (Parsoid only)
3955 !! wikitext
3956 :;t1
3957 ::::d2
3958 !! html/php+tidy
3959 <dl>
3960 <dd>
3961 <dl>
3962 <dt>t1</dt>
3963 <dd>
3964 <dl>
3965 <dd>
3966 <dl>
3967 <dd>d2</dd>
3968 </dl>
3969 </dd>
3970 </dl>
3971 </dd>
3972 </dl>
3973 </dd>
3974 </dl>
3975 !! html/parsoid
3976 <dl>
3977 <dd>
3978 <dl>
3979 <dt>t1</dt>
3980 <dd>
3981 <dl>
3982 <dd>
3983 <dl>
3984 <dd>d2</dd>
3985 </dl>
3986 </dd>
3987 </dl>
3988 </dd>
3989 </dl>
3990 </dd>
3991 </dl>
3992
3993 !! end
3994
3995
3996 !! test
3997 Definition Lists: Nesting: Test 4
3998 !! wikitext
3999 ::;t3
4000 :::d3
4001 !! html
4002 <dl><dd><dl><dd><dl><dt>t3</dt>
4003 <dd>d3</dd></dl></dd></dl></dd></dl>
4004
4005 !! end
4006
4007
4008 ## The Parsoid team believes the following three test exposes a
4009 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4010 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4011 ## It also exposes a "misfeature" in tidy, which doesn't like
4012 ## <dl> tags with a single <dt> child; it converts the <dt> into
4013 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4014 !! test
4015 Definition Lists: Mixed Lists: Test 1
4016 !! wikitext
4017 :;* foo
4018 ::* bar
4019 :; baz
4020 !! html/php
4021 <dl><dd><dl><dt><ul><li> foo</li>
4022 <li> bar</li></ul></dt></dl>
4023 <dl><dt> baz</dt></dl></dd></dl>
4024
4025 !! html/php+tidy
4026 <dl>
4027 <dd>
4028 <dl>
4029 <dd>
4030 <ul>
4031 <li>foo</li>
4032 <li>bar</li>
4033 </ul>
4034 </dd>
4035 </dl>
4036 <dl>
4037 <dt>baz</dt>
4038 </dl>
4039 </dd>
4040 </dl>
4041 !! html/parsoid
4042 <dl>
4043 <dd><dl>
4044 <dt><ul>
4045 <li> foo
4046 </li>
4047 </ul></dt>
4048 <dd><ul>
4049 <li> bar
4050 </li>
4051 </ul></dd>
4052 <dt> baz</dt>
4053 </dl></dd>
4054 </dl>
4055 !! end
4056
4057 !! test
4058 Definition Lists: Mixed Lists: Test 2
4059 !! wikitext
4060 *: d1
4061 *: d2
4062 !! html
4063 <ul><li><dl><dd> d1</dd>
4064 <dd> d2</dd></dl></li></ul>
4065
4066 !! end
4067
4068
4069 !! test
4070 Definition Lists: Mixed Lists: Test 3
4071 !! wikitext
4072 *::: d1
4073 *::: d2
4074 !! html
4075 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4076 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4077
4078 !! end
4079
4080
4081 !! test
4082 Definition Lists: Mixed Lists: Test 4
4083 !! wikitext
4084 *;d1 :d2
4085 *;d3 :d4
4086 !! html
4087 <ul><li><dl><dt>d1&#160;</dt>
4088 <dd>d2</dd>
4089 <dt>d3&#160;</dt>
4090 <dd>d4</dd></dl></li></ul>
4091
4092 !! end
4093
4094
4095 !! test
4096 Definition Lists: Mixed Lists: Test 5
4097 !! wikitext
4098 *:d1
4099 *:: d2
4100 !! html
4101 <ul><li><dl><dd>d1
4102 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4103
4104 !! end
4105
4106
4107 !! test
4108 Definition Lists: Mixed Lists: Test 6
4109 !! wikitext
4110 #*:d1
4111 #*::: d3
4112 !! html
4113 <ol><li><ul><li><dl><dd>d1
4114 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4115
4116 !! end
4117
4118
4119 !! test
4120 Definition Lists: Mixed Lists: Test 7
4121 !! wikitext
4122 :* d1
4123 :* d2
4124 !! html
4125 <dl><dd><ul><li> d1</li>
4126 <li> d2</li></ul></dd></dl>
4127
4128 !! end
4129
4130
4131 !! test
4132 Definition Lists: Mixed Lists: Test 8
4133 !! wikitext
4134 :* d1
4135 ::* d2
4136 !! html
4137 <dl><dd><ul><li> d1</li></ul>
4138 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4139
4140 !! end
4141
4142
4143 !! test
4144 Definition Lists: Mixed Lists: Test 9
4145 !! wikitext
4146 *;foo :bar
4147 !! html
4148 <ul><li><dl><dt>foo&#160;</dt>
4149 <dd>bar</dd></dl></li></ul>
4150
4151 !! end
4152
4153
4154 !! test
4155 Definition Lists: Mixed Lists: Test 10
4156 !! wikitext
4157 *#;foo :bar
4158 !! html
4159 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4160 <dd>bar</dd></dl></li></ol></li></ul>
4161
4162 !! end
4163
4164 # The Parsoid team disagrees with the PHP parser's seemingly-random
4165 # rules regarding dd/dt on the next two tests. Parsoid is more
4166 # consistent, and recognizes the shared nesting and keeps the
4167 # still-open tags around until the nesting is complete.
4168 # (And tidy again converts <dt> to <dd> before 'bar'.)
4169
4170 !! test
4171 Definition Lists: Mixed Lists: Test 11
4172 !! wikitext
4173 *#*#;*;;foo :bar
4174 *#*#;boo :baz
4175 !! html/php
4176 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4177 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4178 <dl><dt>boo&#160;</dt>
4179 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4180
4181 !! html/php+tidy
4182 <ul>
4183 <li>
4184 <ol>
4185 <li>
4186 <ul>
4187 <li>
4188 <ol>
4189 <li>
4190 <dl>
4191 <dt>foo&#160;</dt>
4192 <dd>
4193 <ul>
4194 <li>
4195 <dl>
4196 <dd>
4197 <dl>
4198 <dt>bar</dt>
4199 </dl>
4200 </dd>
4201 </dl>
4202 </li>
4203 </ul>
4204 </dd>
4205 </dl>
4206 <dl>
4207 <dt>boo&#160;</dt>
4208 <dd>baz</dd>
4209 </dl>
4210 </li>
4211 </ol>
4212 </li>
4213 </ul>
4214 </li>
4215 </ol>
4216 </li>
4217 </ul>
4218 !! html/parsoid
4219 <ul>
4220 <li>
4221 <ol>
4222 <li>
4223 <ul>
4224 <li>
4225 <ol>
4226 <li>
4227 <dl>
4228 <dt>
4229 <ul>
4230 <li>
4231 <dl>
4232 <dt>
4233 <dl>
4234 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4235 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4236 </dl></dt>
4237 </dl></li>
4238 </ul></dt>
4239 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4240 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4241 </dl></li>
4242 </ol></li>
4243 </ul></li>
4244 </ol></li>
4245 </ul>
4246 !! end
4247
4248
4249 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4250 # From whitelist:
4251 # * The test is wrong, there are two colons where there should be :;
4252 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4253 !! test
4254 Definition Lists: Weird Ones: Test 1
4255 !! wikitext
4256 *#;*::;; foo : bar (who uses this?)
4257 !! html/php
4258 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4259 <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>
4260
4261 !! html/php+tidy
4262 <ul>
4263 <li>
4264 <ol>
4265 <li>
4266 <dl>
4267 <dt>foo&#160;</dt>
4268 <dd>
4269 <ul>
4270 <li>
4271 <dl>
4272 <dd>
4273 <dl>
4274 <dd>
4275 <dl>
4276 <dd>
4277 <dl>
4278 <dt>bar (who uses this?)</dt>
4279 </dl>
4280 </dd>
4281 </dl>
4282 </dd>
4283 </dl>
4284 </dd>
4285 </dl>
4286 </li>
4287 </ul>
4288 </dd>
4289 </dl>
4290 </li>
4291 </ol>
4292 </li>
4293 </ul>
4294 !! html/parsoid
4295 <ul>
4296 <li>
4297 <ol>
4298 <li>
4299 <dl>
4300 <dt>
4301 <ul>
4302 <li>
4303 <dl>
4304 <dd>
4305 <dl>
4306 <dd>
4307 <dl>
4308 <dt>
4309 <dl>
4310 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4311 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4312 </dl></dt>
4313 </dl></dd>
4314 </dl></dd>
4315 </dl></li>
4316 </ul></dt>
4317 </dl></li>
4318 </ol></li>
4319 </ul>
4320 !! end
4321
4322 !! test
4323 Definition Lists: colons occurring in tags
4324 !! wikitext
4325 ;a:b
4326 ;'''a:b'''
4327 ;<i>a:b</i>
4328 ;<span>a:b</span>
4329 ;<div>a:b</div>
4330 ;<div>a
4331 :b</div>
4332 ;{{echo|a:b}}
4333 ;{{echo|''a:b''}}
4334 ;;;''a:b''
4335 !! html+tidy
4336 <dl>
4337 <dt>a</dt>
4338 <dd>b</dd>
4339 <dt><b>a:b</b></dt>
4340 <dt><i>a:b</i></dt>
4341 <dt><span>a:b</span></dt>
4342 <dd>
4343 <div>a:b</div>
4344 </dd>
4345 <dd>
4346 <div>a
4347 <dl>
4348 <dd>b</dd>
4349 </dl>
4350 </div>
4351 </dd>
4352 <dt>a</dt>
4353 <dd>b</dd>
4354 <dt><i>a:b</i></dt>
4355 </dl>
4356 <dl>
4357 <dd>
4358 <dl>
4359 <dd>
4360 <dl>
4361 <dt><i>a:b</i></dt>
4362 </dl>
4363 </dd>
4364 </dl>
4365 </dd>
4366 </dl>
4367 !! html/parsoid
4368 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4369 <dt><b>a:b</b></dt>
4370 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4371 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4372 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4373 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4374 <dd>b</dd>
4375 <dt><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a:b"}},"i":0}}]}'>a:b</span></dt>
4376 <dt><i about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;a:b&#39;&#39;"}},"i":0}}]}'>a:b</i>
4377 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4378 !! end
4379
4380 !! test
4381 Definition Lists: colons and tables 1
4382 !! wikitext
4383 :{|
4384 | x
4385 |}
4386 :{|
4387 | y
4388 |}
4389 !! html
4390 <dl><dd><table>
4391 <tr>
4392 <td> x
4393 </td></tr></table></dd></dl>
4394 <dl><dd><table>
4395 <tr>
4396 <td> y
4397 </td></tr></table></dd></dl>
4398
4399 !! end
4400
4401 # Parsoid's output (as documented below) differs from php's in this case.
4402 # This is probably a bug. If we fixup parsoid to match php's output, the
4403 # above test should pass and the below test case can be removed. It is
4404 # unclear which output is more desirable.
4405
4406 !! test
4407 Definition Lists: colons and tables 2
4408 !! wikitext
4409 :{|
4410 | x
4411 |}
4412 :{|
4413 | y
4414 |}
4415 !! html/parsoid
4416 <dl><dd><table>
4417 <tr>
4418 <td> x
4419 </td></tr></table></dd>
4420 <dd><table>
4421 <tr>
4422 <td> y
4423 </td></tr></table></dd></dl>
4424 !! end
4425
4426 !! test
4427 Definition Lists: template interaction
4428 !! wikitext
4429 ::{{definition_list}}
4430
4431 :one
4432 ::{{definition_list}}
4433 :::two
4434 :::three
4435 ::four
4436 !! html/parsoid
4437 <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">
4438 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4439
4440 <dl><dd data-parsoid='{}'>one
4441 <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">
4442 </span><dd about="#mwt2">two
4443 <dl><dd>two</dd>
4444 <dd>three</dd></dl></dd>
4445 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4446 !! end
4447
4448
4449 ###
4450 ### External links
4451 ###
4452 !! test
4453 External links: non-bracketed
4454 !! wikitext
4455 Non-bracketed: http://example.com
4456 !! html
4457 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4458 </p>
4459 !! end
4460
4461 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4462 !! test
4463 External links: numbered
4464 !! wikitext
4465 Numbered: [http://example.com]
4466 Numbered: [http://example.net]
4467 Numbered: [http://example.com]
4468 !! html/php
4469 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4470 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4471 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4472 </p>
4473 !! html/parsoid
4474 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4475 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4476 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4477 !!end
4478
4479 !! test
4480 External links: specified text
4481 !! wikitext
4482 Specified text: [http://example.com link]
4483 !! html
4484 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4485 </p>
4486 !!end
4487
4488 !! test
4489 External links: trail
4490 !! wikitext
4491 Linktrails should not work for external links: [http://example.com link]s
4492 !! html
4493 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4494 </p>
4495 !! end
4496
4497 !! test
4498 External links: dollar sign in URL
4499 !! wikitext
4500 http://example.com/1$2345
4501 !! html
4502 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4503 </p>
4504 !! end
4505
4506 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4507 !! test
4508 External links: dollar sign in URL (autonumber)
4509 !! wikitext
4510 [http://example.com/1$2345]
4511 !! html/php
4512 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4513 </p>
4514 !! html/parsoid
4515 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4516 !!end
4517
4518 !! test
4519 External links: open square bracket forbidden in URL (bug 4377)
4520 !! options
4521 parsoid=wt2html,wt2wt,html2html
4522 !! wikitext
4523 http://example.com/1[2345
4524 !! html/php
4525 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4526 </p>
4527 !! html/parsoid
4528 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4529 !! end
4530
4531 !! test
4532 External links: open square bracket forbidden in URL (named) (bug 4377)
4533 !! options
4534 parsoid=wt2html,html2html
4535 !! wikitext
4536 [http://example.com/1[2345]
4537 !! html/php
4538 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4539 </p>
4540 !! html/parsoid
4541 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4542 !!end
4543
4544 # parsoid adds a space before the link name
4545 !! test
4546 External links: open square bracket forbidden in URL (named) (bug 4377)
4547 Parsoid variant.
4548 !! wikitext
4549 [http://example.com/1 [2345]
4550 !! html
4551 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4552 </p>
4553 !!end
4554
4555 !! test
4556 External links: nowiki in URL link text (bug 6230)
4557 !! wikitext
4558 [http://example.com/ <nowiki>''example site''</nowiki>]
4559 !! html
4560 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4561 </p>
4562 !! end
4563
4564 !! test
4565 External links: newline forbidden in text (bug 6230 regression check)
4566 !! wikitext
4567 [http://example.com/ first
4568 second]
4569 !! html
4570 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4571 second]
4572 </p>
4573 !!end
4574
4575 !! test
4576 External links: Pipe char between url and text
4577 !! wikitext
4578 [http://example.com | link]
4579 !! html
4580 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4581 </p>
4582 !!end
4583
4584 !! test
4585 External links: protocol-relative URL in brackets
4586 !! wikitext
4587 [//example.com/ Test]
4588 !! html
4589 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4590 </p>
4591 !! end
4592
4593 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4594 !! test
4595 External links: protocol-relative URL in brackets without text
4596 !! wikitext
4597 [//example.com]
4598 !! html/php
4599 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4600 </p>
4601 !! html/parsoid
4602 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4603 !! end
4604
4605 !! test
4606 External links: protocol-relative URL in free text is left alone
4607 !! wikitext
4608 //example.com/Foo
4609 !! html
4610 <p>//example.com/Foo
4611 </p>
4612 !!end
4613
4614 !! test
4615 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4616 !! wikitext
4617 foo//example.com/Foo
4618 !! html
4619 <p>foo//example.com/Foo
4620 </p>
4621 !! end
4622
4623 !! test
4624 External links: with no contents
4625 !! wikitext
4626 [http://en.wikipedia.org/wiki/Foo]
4627
4628 [[wikipedia:Foo|Bar]]
4629
4630 [[wikipedia:Foo|<span>Bar</span>]]
4631 !! html/php
4632 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4633 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4634 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4635 </p>
4636 !! html/parsoid
4637 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4638 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4639 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4640 !! end
4641
4642 !! test
4643 External links: Free with trailing punctuation
4644 !! wikitext
4645 http://example.com,
4646 http://example.com;
4647 http://example.com\
4648 http://example.com.
4649 http://example.com:
4650 http://example.com!
4651 http://example.com?
4652 http://example.com)
4653 http://example.com/url_with_(brackets)
4654 (http://example.com/url_without_brackets)
4655 http://example.com/url_with_entity&amp;
4656 http://example.com/url_with_entity&#x26;
4657 http://example.com/url_with_entity&#038;
4658 http://example.com/url_with_entity&nbsp;
4659 http://example.com/url_with_entity&#xA0;
4660 http://example.com/url_with_entity&#160;
4661 http://example.com/url_with_entity&lt;
4662 http://example.com/url_with_entity&#x3C;
4663 http://example.com/url_with_entity&#60;
4664 !! html/php
4665 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4666 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4667 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4668 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4669 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4670 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4671 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4672 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4673 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4674 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4675 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4676 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4677 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4678 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4679 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4680 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4681 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4682 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4683 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4684 </p>
4685 !! html/parsoid
4686 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4687 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4688 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4689 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4690 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4691 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4692 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4693 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4694 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4695 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4696 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4697 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4698 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4699 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>
4700 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>
4701 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>
4702 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>
4703 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x3C;","srcContent":"&lt;"}'>&lt;</span>
4704 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#60;","srcContent":"&lt;"}'>&lt;</span></p>
4705 !! end
4706
4707 !! test
4708 External links: tricky Parsoid html2html case
4709 !! options
4710 parsoid=wt2html,wt2wt,html2html
4711 !! wikitext
4712 http://example.com/url_with_entity&amp;amp;
4713 !! html/php
4714 <p><a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;
4715 </p>
4716 !! html/parsoid
4717 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4718 !! end
4719
4720 !! test
4721 External links: Free with trailing quotes (T113666)
4722 !! wikitext
4723 '''News:''' Stuff here
4724
4725 news:'a'b''c''d e
4726 !! html/php
4727 <p><b>News:</b> Stuff here
4728 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4729 </p>
4730 !! html/parsoid
4731 <p><b>News:</b> Stuff here</p>
4732 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4733 !! end
4734
4735 !! test
4736 External links: Lone protocols are never linked (T105697)
4737 !! wikitext
4738 http://
4739 http://;
4740 (http://)
4741 bitcoin:
4742 bitcoin:;
4743 (bitcoin:)
4744 !! html
4745 <p>http://
4746 http://;
4747 (http://)
4748 bitcoin:
4749 bitcoin:;
4750 (bitcoin:)
4751 </p>
4752 !! end
4753
4754 !! test
4755 External links: No preceding word characters allowed (bug 65278)
4756 !! wikitext
4757 NOPEhttp://example.com
4758 N0http://example.com
4759 ok:http://example.com
4760 ok-http://example.com
4761 !! html
4762 <p>NOPEhttp://example.com
4763 N0http://example.com
4764 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4765 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4766 </p>
4767 !! end
4768
4769 !! test
4770 External links: nofollow domain exception
4771 !! wikitext
4772 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
4773 !! html
4774 <p>A <a class="external text" href="https://no-nofollow.org/foobar">link</a>, and another <a rel="nofollow" class="external text" href="https://example.org">link</a>.
4775 </p>
4776 !!end
4777
4778 !! test
4779 External image
4780 !! wikitext
4781 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4782 !! html
4783 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4784 </p>
4785 !! end
4786
4787 !! test
4788 External image from https
4789 !! wikitext
4790 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4791 !! html
4792 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4793 </p>
4794 !! end
4795
4796 !! test
4797 External image (when not allowed)
4798 !! options
4799 wgAllowExternalImages=0
4800 !! wikitext
4801 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4802 !! html
4803 <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>
4804 </p>
4805 !! end
4806
4807 !! test
4808 Link to non-http image, no img tag
4809 !! wikitext
4810 Link to non-http image, no img tag: ftp://example.com/test.jpg
4811 !! html
4812 <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>
4813 </p>
4814 !! end
4815
4816 !! test
4817 External links: terminating separator
4818 !! wikitext
4819 Terminating separator: http://example.com/thing,
4820 !! html
4821 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4822 </p>
4823 !! end
4824
4825 !! test
4826 External links: intervening separator
4827 !! wikitext
4828 Intervening separator: http://example.com/1,2,3
4829 !! html
4830 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4831 </p>
4832 !! end
4833
4834 !! test
4835 External links: old bug with URL in query
4836 !! wikitext
4837 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4838 !! html
4839 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4840 </p>
4841 !! end
4842
4843 !! test
4844 External links: old URL-in-URL bug, mixed protocols
4845 !! wikitext
4846 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4847 !! html
4848 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4849 </p>
4850 !!end
4851
4852 # Since Parsoid is starting to emit canonical wikitext for links,
4853 # [http://example.com http://example.com] will not RT back to that
4854 # form anymore.
4855 !! test
4856 External links: URL in text
4857 !! options
4858 parsoid=wt2html
4859 !! wikitext
4860 URL in text: [http://example.com http://example.com]
4861 !! html/php
4862 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4863 </p>
4864 !! html/parsoid
4865 <p>URL in text: <a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4866 !! end
4867
4868 !! test
4869 External links: Clickable images
4870 !! wikitext
4871 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4872 !! html/php
4873 <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>
4874 </p>
4875 !! html/parsoid
4876 <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>
4877 !! end
4878
4879 !! test
4880 External links: raw ampersand
4881 !! wikitext
4882 Old &amp; use: http://x&y
4883 !! html
4884 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4885 </p>
4886 !! end
4887
4888 !! test
4889 External links: encoded ampersand
4890 !! wikitext
4891 Old &amp; use: http://x&amp;y
4892 !! html/php
4893 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4894 </p>
4895 !! html/parsoid
4896 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4897 !! end
4898
4899 !! test
4900 External links: encoded equals (bug 6102)
4901 !! wikitext
4902 http://example.com/?foo&#61;bar
4903 !! html/php
4904 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4905 </p>
4906 !! html/parsoid
4907 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4908 !! end
4909
4910 ##
4911 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4912 ## does it number them. As discussed in bug 53505, we can identify
4913 ## autonumbered links via CSS.
4914 ##
4915
4916 !! test
4917 External links: [raw ampersand]
4918 !! wikitext
4919 Old &amp; use: [http://x&y]
4920 !! html/php
4921 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4922 </p>
4923 !! html/parsoid
4924 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4925 !! end
4926
4927 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4928 # mode will return the [raw ampersand] wikitext
4929 !! test
4930 External links: [encoded ampersand]
4931 !! options
4932 parsoid=wt2html,wt2wt,html2html
4933 !! wikitext
4934 Old &amp; use: [http://x&amp;y]
4935 !! html/php
4936 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4937 </p>
4938 !! html/parsoid
4939 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4940 !! end
4941
4942 !! test
4943 External links: [raw equals]
4944 !! wikitext
4945 [http://example.com/?foo=bar]
4946 !! html/php
4947 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4948 </p>
4949 !! html/parsoid
4950 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4951 !! end
4952
4953 # note that parsoid html is identical to [raw equals] case; so html2wt
4954 # mode will return the [raw equals] wikitext
4955 !! test
4956 External links: [encoded equals] (bug 6102)
4957 !! options
4958 parsoid=wt2html,wt2wt,html2html
4959 !! wikitext
4960 [http://example.com/?foo&#61;bar]
4961 !! html/php
4962 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4963 </p>
4964 !! html/parsoid
4965 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4966 !! end
4967
4968 # xxx parsoid strips the IDN character, so the round-trip tests will
4969 # obviously fail and are disabled. --cscott
4970 !! test
4971 External links: [IDN ignored character reference in hostname; strip it right off]
4972 !! options
4973 parsoid=wt2html,wt2wt,html2html
4974 !! wikitext
4975 [http://e&zwnj;xample.com/]
4976 !! html/php
4977 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4978 </p>
4979 !! html/parsoid
4980 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4981 !! end
4982
4983 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4984 # Where an external link could easily circumvent the sanitization of the text of
4985 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4986 # test demands a higher standard. That's a bit strange.
4987 #
4988 # Example:
4989 #
4990 # http://e‌xample.com -> [http://example.com|http://example.com]
4991 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4992 #
4993 # The first example is sanitized, but the second is not. Any security benefits
4994 # from this production are trivial to circumvent. Either remove this test and
4995 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4996 # the test accordingly.
4997 #
4998 # All our love,
4999 # The Parsoid team.
5000 # xxx parsoid strips the IDN character, so the round-trip tests will
5001 # obviously fail and are disabled. --cscott
5002 !! test
5003 External links: IDN ignored character reference in hostname; strip it right off
5004 !! options
5005 parsoid=wt2html,html2html
5006 !! wikitext
5007 http://e&zwnj;xample.com/
5008 !! html/php
5009 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5010 </p>
5011 !! html/parsoid
5012 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
5013 !! end
5014
5015 !! test
5016 External links: www.jpeg.org (bug 554)
5017 !! wikitext
5018 http://www.jpeg.org
5019 !! html
5020 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5021 </p>
5022 !! end
5023
5024 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
5025 !! test
5026 External links: URL within URL (original bug 2)
5027 !! wikitext
5028 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5029 !! html/php
5030 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5031 </p>
5032 !! html/parsoid
5033 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5034 !! end
5035
5036 !! test
5037 BUG 361: URL inside bracketed URL
5038 !! wikitext
5039 [http://www.example.com/foo http://www.example.com/bar]
5040 !! html
5041 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5042 </p>
5043 !! end
5044
5045 !! test
5046 BUG 361: URL within URL, not bracketed
5047 !! wikitext
5048 http://www.example.com/foo?=http://www.example.com/bar
5049 !! html
5050 <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>
5051 </p>
5052 !! end
5053
5054 !! test
5055 BUG 289: ">"-token in URL-tail
5056 !! wikitext
5057 http://www.example.com/<hello>
5058 !! html
5059 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5060 </p>
5061 !!end
5062
5063 !! test
5064 BUG 289: literal ">"-token in URL-tail
5065 !! wikitext
5066 http://www.example.com/<b>html</b>
5067 !! html/php
5068 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5069 </p>
5070 !! html/parsoid
5071 <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>
5072 !! end
5073
5074 !! test
5075 BUG 289: ">"-token in bracketed URL
5076 !! wikitext
5077 [http://www.example.com/<hello> stuff]
5078 !! html
5079 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5080 </p>
5081 !!end
5082
5083 !! test
5084 BUG 289: literal ">"-token in bracketed URL
5085 !! wikitext
5086 [http://www.example.com/<b>html</b> stuff]
5087 !! html
5088 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5089 </p>
5090 !!end
5091
5092 !! test
5093 BUG 289: literal double quote at end of URL
5094 !! wikitext
5095 http://www.example.com/"hello"
5096 !! html
5097 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5098 </p>
5099 !!end
5100
5101 !! test
5102 BUG 289: literal double quote in bracketed URL
5103 !! wikitext
5104 [http://www.example.com/"hello" stuff]
5105 !! html
5106 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5107 </p>
5108 !!end
5109
5110 !! test
5111 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5112 !! wikitext
5113 [http://www.example.com test]
5114 !! html
5115 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5116 </p>
5117 !! end
5118
5119 !! test
5120 External links: link text with spaces
5121 !! wikitext
5122 [http://www.example.com a b c]
5123 [http://www.example.com ''a'' ''b'']
5124 !! html
5125 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5126 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5127 </p>
5128 !! end
5129
5130 !! test
5131 External links: wiki links within external link (Bug 3695)
5132 !! options
5133 parsoid=wt2html,html2html
5134 !! wikitext
5135 [http://example.com [[wikilink]] embedded in ext link]
5136 !! html/php
5137 <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>
5138 </p>
5139 !! html/parsoid
5140 <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>
5141 !! end
5142
5143 !! test
5144 BUG 787: Links with one slash after the url protocol are invalid
5145 !! wikitext
5146 http:/example.com
5147
5148 [http:/example.com title]
5149 !! html
5150 <p>http:/example.com
5151 </p><p>[http:/example.com title]
5152 </p>
5153 !! end
5154
5155 !! test
5156 Bracketed external links with template-generated invalid target
5157 !! wikitext
5158 [{{echo|http:/example.com}} title]
5159 !! html
5160 <p>[http:/example.com title]
5161 </p>
5162 !! end
5163
5164 !! test
5165 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5166 !! wikitext
5167 ''[http://example.com text'']
5168 [http://example.com '''text]'''
5169 ''Something [http://example.com in italic'']
5170 ''Something [http://example.com mixed''''', even bold]'''
5171 '''''Now [http://example.com both''''']
5172 !! html
5173 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5174 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5175 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5176 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5177 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5178 </p>
5179 !! end
5180
5181
5182 !! test
5183 Bug 4781: %26 in URL
5184 !! wikitext
5185 http://www.example.com/?title=AT%26T
5186 !! html/php
5187 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5188 </p>
5189 !! html/parsoid
5190 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5191 !! end
5192
5193 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5194 # % is actually legal in HTML5. Any change in output would need testing though.
5195 !! test
5196 Bug 4781, 5267: %25 in URL
5197 !! wikitext
5198 http://www.example.com/?title=100%25_Bran
5199 !! html/php
5200 <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>
5201 </p>
5202 !! html/parsoid
5203 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5204 !! end
5205
5206 !! test
5207 Bug 4781, 5267: %28, %29 in URL
5208 !! wikitext
5209 http://www.example.com/?title=Ben-Hur_%281959_film%29
5210 !! html/php
5211 <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>
5212 </p>
5213 !! html/parsoid
5214 <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>
5215 !! end
5216
5217
5218 !! test
5219 Bug 4781: %26 in autonumber URL
5220 !! wikitext
5221 [http://www.example.com/?title=AT%26T]
5222 !! html/php
5223 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5224 </p>
5225 !! html/parsoid
5226 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5227 !! end
5228
5229 !! test
5230 Bug 4781, 5267: %26 in autonumber URL
5231 !! wikitext
5232 [http://www.example.com/?title=100%25_Bran]
5233 !! html/php
5234 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5235 </p>
5236 !! html/parsoid
5237 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5238 !! end
5239
5240 !! test
5241 Bug 4781, 5267: %28, %29 in autonumber URL
5242 !! wikitext
5243 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5244 !! html/php
5245 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5246 </p>
5247 !! html/parsoid
5248 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5249 !! end
5250
5251
5252 !! test
5253 Bug 4781: %26 in bracketed URL
5254 !! wikitext
5255 [http://www.example.com/?title=AT%26T link]
5256 !! html/php
5257 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5258 </p>
5259 !! html/parsoid
5260 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5261 !! end
5262
5263 !! test
5264 Bug 4781, 5267: %25 in bracketed URL
5265 !! wikitext
5266 [http://www.example.com/?title=100%25_Bran link]
5267 !! html
5268 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5269 </p>
5270 !! end
5271
5272 !! test
5273 Bug 4781, 5267: %28, %29 in bracketed URL
5274 !! wikitext
5275 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5276 !! html/php
5277 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5278 </p>
5279 !! html/parsoid
5280 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5281 !! end
5282
5283 !! test
5284 External link containing a period in the anchor. (bug 63947)
5285 !! wikitext
5286 [//foo.org/bar#baz. bang]
5287
5288 [//foo.org/bar. bang]
5289 !! html/php
5290 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5291 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5292 </p>
5293 !! html/parsoid
5294 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5295 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5296 !! end
5297
5298 !! test
5299 External link containing a single quote. (bug 63947)
5300 !! wikitext
5301 [//foo.org/bar'baz]
5302
5303 [//foo.org/bar'baz bang]
5304 !! html/php
5305 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5306 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5307 </p>
5308 !! html/parsoid
5309 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5310 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5311 !! end
5312
5313 !! test
5314 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5315 !! wikitext
5316 Some [http://example.com/ pretty ''italics'' and stuff]!
5317 !! html
5318 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5319 </p>
5320 !! end
5321
5322 !! test
5323 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5324 !! wikitext
5325 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5326 !! html
5327 <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>
5328 </p>
5329 !! end
5330
5331 !! test
5332 External link containing double-single-quotes with no space separating the url from text in italics
5333 !! wikitext
5334 [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]].]
5335 !! html/php
5336 <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>
5337 </p>
5338 !! html/php+tidy
5339 <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>
5340 !! html/parsoid
5341 <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>
5342 !! end
5343
5344 !! test
5345 External link with comments in link text
5346 !! wikitext
5347 [http://www.google.com Google <!-- comment -->]
5348 !! html/php
5349 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5350 </p>
5351 !! html/parsoid
5352 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5353 !! end
5354
5355 !! test
5356 External link to bare IPv4 address
5357 !! wikitext
5358 [http://192.168.0.1 Link]
5359 !! html/php
5360 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5361 </p>
5362 !! html/parsoid
5363 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5364 !! end
5365
5366 !! test
5367 URL-encoding in URL functions (single parameter)
5368 !! wikitext
5369 {{localurl:Some page|amp=&}}
5370 !! html
5371 <p>/index.php?title=Some_page&amp;amp=&amp;
5372 </p>
5373 !! end
5374
5375 !! test
5376 URL-encoding in URL functions (multiple parameters)
5377 !! wikitext
5378 {{localurl:Some page|q=?&amp=&}}
5379 !! html
5380 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5381 </p>
5382 !! end
5383
5384 !! test
5385 Brackets in urls
5386 !! wikitext
5387 http://example.com/index.php?foozoid%5B%5D=bar
5388
5389 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5390 !! html/php
5391 <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>
5392 </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>
5393 </p>
5394 !! html/parsoid
5395 <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>
5396
5397 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5398 !! end
5399
5400 !! test
5401 IPv6 urls, autolink format (T23261)
5402 !! wikitext
5403 http://[2404:130:0:1000::187:2]/index.php
5404
5405 Examples from RFC 2373, section 2.2:
5406 * http://[1080::8:800:200C:417A]/unicast
5407 * http://[FF01::101]/multicast
5408 * http://[::1]/loopback
5409 * http://[::]/unspecified
5410 * http://[::13.1.68.3]/ipv4compat
5411 * http://[::FFFF:129.144.52.38]/ipv4compat
5412
5413 Examples from RFC 2732, section 2:
5414 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5415 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5416 * http://[3ffe:2a00:100:7031::1]
5417 * http://[1080::8:800:200C:417A]/foo
5418 * http://[::192.9.5.5]/ipng
5419 * http://[::FFFF:129.144.52.38]:80/index.html
5420 * http://[2010:836B:4179::836B:4179]
5421
5422 !! html/php
5423 <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>
5424 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5425 </p>
5426 <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>
5427 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5428 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5429 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5430 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5431 <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>
5432 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5433 </p>
5434 <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>
5435 <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>
5436 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5437 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5438 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5439 <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>
5440 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5441
5442 !! html/parsoid
5443 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a></p>
5444
5445 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5446 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5447 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5448 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5449 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5450 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5451 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5452
5453 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5454 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5455 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5456 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5457 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5458 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5459 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5460 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5461 !! end
5462
5463 !! test
5464 IPv6 urls, bracketed format (T23261)
5465 !! wikitext
5466 [http://[2404:130:0:1000::187:2]/index.php test]
5467
5468 Examples from RFC 2373, section 2.2:
5469 * [http://[1080::8:800:200C:417A] unicast]
5470 * [http://[FF01::101] multicast]
5471 * [http://[::1]/ loopback]
5472 * [http://[::] unspecified]
5473 * [http://[::13.1.68.3] ipv4compat]
5474 * [http://[::FFFF:129.144.52.38] ipv4compat]
5475
5476 Examples from RFC 2732, section 2:
5477 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5478 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5479 * [http://[3ffe:2a00:100:7031::1] 3]
5480 * [http://[1080::8:800:200C:417A]/foo 4]
5481 * [http://[::192.9.5.5]/ipng 5]
5482 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5483 * [http://[2010:836B:4179::836B:4179] 7]
5484
5485 !! html/php
5486 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5487 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5488 </p>
5489 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5490 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5491 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5492 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5493 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5494 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5495 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5496 </p>
5497 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5498 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5499 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5500 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5501 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5502 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5503 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5504
5505 !! html/parsoid
5506 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5507
5508 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5509 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5510 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5511 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5512 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5513 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5514 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5515
5516 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5517 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5518 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5519 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5520 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5521 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5522 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5523 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5524 !! end
5525
5526 !! test
5527 Non-extlinks in brackets
5528 !! wikitext
5529 [foo]
5530 [foo bar]
5531 [foo ''bar'']
5532 [fool's] errand
5533 [fool's errand]
5534 [{{echo|foo}}]
5535 [{{echo|foo}} bar]
5536 [{{echo|foo}} ''bar'']
5537 [{{echo|foo}}l's] errand
5538 [{{echo|foo}}l's errand]
5539 [url={{echo|foo}}]
5540 [url=http://example.com]
5541 [http:// bare protocols don't count]
5542 !! html/php
5543 <p>[foo]
5544 [foo bar]
5545 [foo <i>bar</i>]
5546 [fool's] errand
5547 [fool's errand]
5548 [foo]
5549 [foo bar]
5550 [foo <i>bar</i>]
5551 [fool's] errand
5552 [fool's errand]
5553 [url=foo]
5554 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5555 [http:// bare protocols don't count]
5556 </p>
5557 !! html/parsoid
5558 <p>[foo]
5559 [foo bar]
5560 [foo <i>bar</i>]
5561 [fool's] errand
5562 [fool's errand]
5563 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5564 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5565 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5566 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5567 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5568 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5569 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5570 [http:// bare protocols don't count]</p>
5571 !! end
5572
5573 !! test
5574 Percent encoding in external links
5575 !! wikitext
5576 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5577 !! html/php
5578 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5579 </p>
5580 !! html/parsoid
5581 <p><a rel="mw:ExtLink"
5582 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5583 !! end
5584
5585 !! test
5586 Use url link syntax for links where the content is equal the link target
5587 !! wikitext
5588 http://example.com
5589 !! html/php
5590 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5591 </p>
5592 !! html/parsoid
5593 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5594 !! end
5595
5596 !! test
5597 Parenthesis in external links, especially URL links
5598 !! wikitext
5599 http://example.com)
5600
5601 http://example.com/test)
5602
5603 http://example.com/(test)
5604
5605 http://example.com/((test)
5606
5607 (http://example.com/(test))
5608
5609 (http://example.com/(test)))))
5610
5611 http://example.com/a)b
5612
5613 [http://example.com) foo]
5614 !! html/php
5615 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5616 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5617 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5618 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5619 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5620 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5621 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5622 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5623 </p>
5624 !! html/parsoid
5625 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5626 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5627 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5628 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5629 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5630 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5631 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5632 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5633 !! end
5634
5635 !! test
5636 Parenthesis in external links, w/ transclusion or comment
5637 !! wikitext
5638 (http://example.com/{{echo|hi}})
5639
5640 (http://example.com<!-- hi -->)
5641 !! html/php
5642 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5643 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5644 </p>
5645 !! html/parsoid
5646 <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=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[20,31,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"hi\"}},\"i\":0}}]}&#39;>hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
5647
5648 <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>
5649 !! end
5650
5651 !! test
5652 Serialize <a> tags with invalid link targets as plain text
5653 !! options
5654 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5655 !! html/parsoid
5656 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5657 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5658 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5659 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5660 !! wikitext
5661 text
5662 <nowiki>*</nowiki>text
5663 <nowiki>[[foo]]</nowiki>
5664 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5665 !! end
5666
5667 !! test
5668 mw:ExtLink -vs- mw:WikiLink (T94723)
5669 !! options
5670 parsoid=html2wt
5671 !! html/parsoid
5672 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5673 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5674 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5675 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5676 <p>
5677 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5678 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5679 </p>
5680 !! wikitext
5681 [[Foo|Bar]]
5682 [[Foo|Bar]]
5683 [[wikipedia:Foo|Bar]]
5684 [[wikipedia:Foo|Bar]]
5685
5686 [[wikipedia:European_Robin|European Robin]]
5687 [[wikipedia:European_Robin|European Robin]]
5688 !! end
5689
5690 !! test
5691 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5692 !! options
5693 parsoid=wt2wt
5694 !! wikitext
5695 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5696 !! html/parsoid
5697 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5698 !! end
5699
5700
5701 ###
5702 ### Quotes
5703 ###
5704
5705 !! test
5706 Quotes
5707 !! wikitext
5708 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5709
5710 Normal text. '''''Bold italic text.''''' Normal text.
5711 !! html
5712 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5713 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5714 </p>
5715 !! end
5716
5717
5718 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5719 # parser strips. The wikitext contains just the first half of the bold
5720 # quote pair.
5721 !! test
5722 Unclosed and unmatched quotes
5723 !! wikitext
5724 '''''Bold italic text '''with bold deactivated''' in between.'''''
5725
5726 '''''Bold italic text ''with italic deactivated'' in between.'''''
5727
5728 '''Bold text..
5729
5730 ..spanning two paragraphs (should not work).'''
5731
5732 '''Bold tag left open
5733
5734 ''Italic tag left open
5735
5736 Normal text.
5737
5738 <!-- Unmatching number of opening, closing tags: -->
5739 '''This year''''s election ''should'' beat '''last year''''s.
5740
5741 ''Tom'''s car is bigger than ''Susan'''s.
5742
5743 Plain ''italic'''s plain
5744 !! html/php
5745 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5746 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5747 </p><p><b>Bold text..</b>
5748 </p><p>..spanning two paragraphs (should not work).
5749 </p><p><b>Bold tag left open</b>
5750 </p><p><i>Italic tag left open</i>
5751 </p><p>Normal text.
5752 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5753 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5754 </p><p>Plain <i>italic'</i>s plain
5755 </p>
5756 !! html/parsoid
5757 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5758 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5759 </p><p><b>Bold text..</b>
5760 </p><p>..spanning two paragraphs (should not work).<b></b>
5761 </p><p><b>Bold tag left open</b>
5762 </p><p><i>Italic tag left open</i>
5763 </p><p>Normal text.
5764 </p>
5765 <!-- Unmatching number of opening, closing tags: -->
5766 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5767 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5768 </p><p>Plain <i>italic'</i>s plain
5769 </p>
5770 !! end
5771
5772 ###
5773 ### Tables
5774 ###
5775 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5776 ###
5777
5778 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5779 # is the bare minimum required by the spec, see:
5780 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5781 # Parsoid team replies: empty table tags are legal in HTML5
5782 !! test
5783 A table with no data.
5784 !! options
5785 parsoid=wt2html
5786 !! wikitext
5787 {||}
5788 !! html/php
5789
5790 !! html/parsoid
5791 <table></table>
5792
5793 !! end
5794
5795 !! test
5796 A table with stray table end tags on start tag line (wt2html)
5797 !! options
5798 parsoid=wt2html
5799 !! wikitext
5800 {|style="color: red;"|}
5801
5802 {|style="color: red;" |}
5803 |foo
5804 |}
5805
5806 {|style="color: red;"|} id="foo"
5807 |foo
5808 |}
5809
5810 {|style="color: red;" |} id="foo"
5811 |foo
5812 |}
5813 !! html
5814 <table style="color: red;"></table>
5815
5816 <table style="color: red;">
5817 <tbody><tr>
5818 <td>foo</td>
5819 </tr></tbody>
5820 </table>
5821
5822 <table style="color: red;" id="foo">
5823 <tbody><tr>
5824 <td>foo</td>
5825 </tr></tbody>
5826 </table>
5827
5828 <table style="color: red;" id="foo">
5829 <tbody><tr>
5830 <td>foo</td>
5831 </tr></tbody>
5832 </table>
5833
5834 !! end
5835
5836 !! test
5837 A table with no data (take 2)
5838 !! wikitext
5839 {|
5840 |}
5841 !! html/parsoid
5842 <table></table>
5843 !! end
5844
5845 # A table with nothing but a caption is invalid XHTML, we might want to render
5846 # this as <p>caption</p>
5847 # Parsoid team replies: table with only a caption is legal in HTML5
5848 !! test
5849 A table with nothing but a caption
5850 !! wikitext
5851 {|
5852 |+ caption
5853 |}
5854 !! html/php
5855 <table>
5856 <caption> caption
5857 </caption><tr><td></td></tr></table>
5858
5859 !! html/parsoid
5860 <table><caption> caption</caption></table>
5861 !! end
5862
5863 !! test
5864 A table with caption with default-spaced attributes and a table row
5865 !! wikitext
5866 {|
5867 |+ style="color: red;" | caption1
5868 |-
5869 | foo
5870 |}
5871 !! html
5872 <table>
5873 <caption style="color: red;"> caption1
5874 </caption>
5875 <tr>
5876 <td> foo
5877 </td></tr></table>
5878
5879 !! end
5880
5881 !! test
5882 A table with captions with non-default spaced attributes and a table row
5883 !! wikitext
5884 {|
5885 |+style="color: red;"|caption2
5886 |+ style="color: red;"| caption3
5887 |-
5888 | foo
5889 |}
5890 !! html
5891 <table>
5892 <caption style="color: red;">caption2
5893 </caption>
5894 <caption style="color: red;"> caption3
5895 </caption>
5896 <tr>
5897 <td> foo
5898 </td></tr></table>
5899
5900 !! end
5901
5902 !! test
5903 Table td-cell syntax variations
5904 !! wikitext
5905 {|
5906 | foo bar foo | baz
5907 | foo bar foo || baz
5908 | style='color:red;' | baz
5909 | style='color:red;' || baz
5910 |}
5911 !! html
5912 <table>
5913 <tr>
5914 <td> baz
5915 </td>
5916 <td> foo bar foo </td>
5917 <td> baz
5918 </td>
5919 <td style="color:red;"> baz
5920 </td>
5921 <td> style='color:red;' </td>
5922 <td> baz
5923 </td></tr></table>
5924
5925 !! end
5926
5927 !! test
5928 Simple table
5929 !! wikitext
5930 {|
5931 | 1 || 2
5932 |-
5933 | 3 || 4
5934 |}
5935 !! html
5936 <table>
5937 <tr>
5938 <td> 1 </td>
5939 <td> 2
5940 </td></tr>
5941 <tr>
5942 <td> 3 </td>
5943 <td> 4
5944 </td></tr></table>
5945
5946 !! end
5947
5948 !! test
5949 Simple table but with multiple dashes for row wikitext
5950 !! wikitext
5951 {|
5952 | foo
5953 |-----
5954 | bar
5955 |}
5956 !! html
5957 <table>
5958 <tr>
5959 <td> foo
5960 </td></tr>
5961 <tr>
5962 <td> bar
5963 </td></tr></table>
5964
5965 !! end
5966
5967 !! test
5968 Multiplication table
5969 !! wikitext
5970 {| border="1" cellpadding="2"
5971 |+Multiplication table
5972 |-
5973 ! &times; !! 1 !! 2 !! 3
5974 |-
5975 ! 1
5976 | 1 || 2 || 3
5977 |-
5978 ! 2
5979 | 2 || 4 || 6
5980 |-
5981 ! 3
5982 | 3 || 6 || 9
5983 |-
5984 ! 4
5985 | 4 || 8 || 12
5986 |-
5987 ! 5
5988 | 5 || 10 || 15
5989 |}
5990 !! html
5991 <table border="1" cellpadding="2">
5992 <caption>Multiplication table
5993 </caption>
5994 <tr>
5995 <th> &#215; </th>
5996 <th> 1 </th>
5997 <th> 2 </th>
5998 <th> 3
5999 </th></tr>
6000 <tr>
6001 <th> 1
6002 </th>
6003 <td> 1 </td>
6004 <td> 2 </td>
6005 <td> 3
6006 </td></tr>
6007 <tr>
6008 <th> 2
6009 </th>
6010 <td> 2 </td>
6011 <td> 4 </td>
6012 <td> 6
6013 </td></tr>
6014 <tr>
6015 <th> 3
6016 </th>
6017 <td> 3 </td>
6018 <td> 6 </td>
6019 <td> 9
6020 </td></tr>
6021 <tr>
6022 <th> 4
6023 </th>
6024 <td> 4 </td>
6025 <td> 8 </td>
6026 <td> 12
6027 </td></tr>
6028 <tr>
6029 <th> 5
6030 </th>
6031 <td> 5 </td>
6032 <td> 10 </td>
6033 <td> 15
6034 </td></tr></table>
6035
6036 !! end
6037
6038 !! test
6039 Accept "||" in table headings
6040 !! wikitext
6041 {|
6042 !h1 || h2
6043 |}
6044 !! html
6045 <table>
6046 <tr>
6047 <th>h1 </th>
6048 <th> h2
6049 </th></tr></table>
6050
6051 !! end
6052
6053 !! test
6054 Accept "!!" in table data
6055 !! wikitext
6056 {|
6057 | Foo!! ||
6058 |}
6059 !! html
6060 <table>
6061 <tr>
6062 <td> Foo!! </td>
6063 <td>
6064 </td></tr></table>
6065
6066 !! html/parsoid
6067 <table>
6068 <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>
6069 </tbody></table>
6070 !! end
6071
6072 !! test
6073 Accept "||" in indented table headings
6074 !! wikitext
6075 :{|
6076 !h1 || h2
6077 |}
6078 !! html
6079 <dl><dd><table>
6080 <tr>
6081 <th>h1 </th>
6082 <th> h2
6083 </th></tr></table></dd></dl>
6084
6085 !! end
6086
6087 !! test
6088 Accept "!!" in templates
6089 !! wikitext
6090 {|
6091 !a {{echo|b!!c}}
6092 |}
6093 !! html/php
6094 <table>
6095 <tr>
6096 <th>a b</th>
6097 <th>c
6098 </th></tr></table>
6099
6100 !! html/parsoid
6101 <table>
6102 <tbody><tr><th typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[{"k":"1"}]]}' 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>
6103 !! end
6104
6105 !! test
6106 Accept "!!" in table headings after newline
6107 !! wikitext
6108 {|
6109 !a
6110 b!!c
6111 |}
6112 !! html/php
6113 <table>
6114 <tr>
6115 <th>a
6116 <p>b!!c
6117 </p>
6118 </th></tr></table>
6119
6120 !! html/parsoid
6121 <table>
6122 <tbody><tr><th>a
6123 <p>b!!c</p></th></tr>
6124 </tbody></table>
6125 !! end
6126
6127 !! test
6128 Accept "!!" in table data of mixed wikitext / html syntax
6129 !! wikitext
6130 {|
6131 !a
6132 <tr><td>b!!c</td></tr>
6133 |}
6134 !! html+tidy
6135 <table>
6136 <tr>
6137 <th>a</th>
6138 </tr>
6139 <tr>
6140 <td>b!!c</td>
6141 </tr>
6142 </table>
6143 !! html/parsoid
6144 <table>
6145 <tbody><tr><th>a</th></tr>
6146 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6147 </tbody></table>
6148 !! end
6149
6150 !! test
6151 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6152 !! wikitext
6153 {|
6154 !| h1
6155 || a
6156 |}
6157 !! html
6158 <table>
6159 <tr>
6160 <th> h1
6161 </th>
6162 <td> a
6163 </td></tr></table>
6164
6165 !! end
6166
6167 !!test
6168 Accept "| !" at start of line in tables (ignore !-attribute)
6169 !! wikitext
6170 {|
6171 |-
6172 | !style="color:red" | bar
6173 |}
6174 !! html
6175 <table>
6176
6177 <tr>
6178 <td> bar
6179 </td></tr></table>
6180
6181 !!end
6182
6183 !!test
6184 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 +/-
6185 !! wikitext
6186 {|
6187 |-
6188 |style='color:red;'|+1
6189 |style='color:blue;'|-1
6190 |-
6191 | 1 || 2 || 3
6192 | 1 ||+2 ||-3
6193 |-
6194 | +1
6195 | -1
6196 |}
6197 !! html
6198 <table>
6199
6200 <tr>
6201 <td style="color:red;">+1
6202 </td>
6203 <td style="color:blue;">-1
6204 </td></tr>
6205 <tr>
6206 <td> 1 </td>
6207 <td> 2 </td>
6208 <td> 3
6209 </td>
6210 <td> 1 </td>
6211 <td>+2 </td>
6212 <td>-3
6213 </td></tr>
6214 <tr>
6215 <td> +1
6216 </td>
6217 <td> -1
6218 </td></tr></table>
6219
6220 !!end
6221
6222 !! test
6223 Table rowspan
6224 !! wikitext
6225 {| border=1
6226 | Cell 1, row 1
6227 |rowspan=2| Cell 2, row 1 (and 2)
6228 | Cell 3, row 1
6229 |-
6230 | Cell 1, row 2
6231 | Cell 3, row 2
6232 |}
6233 !! html
6234 <table border="1">
6235 <tr>
6236 <td> Cell 1, row 1
6237 </td>
6238 <td rowspan="2"> Cell 2, row 1 (and 2)
6239 </td>
6240 <td> Cell 3, row 1
6241 </td></tr>
6242 <tr>
6243 <td> Cell 1, row 2
6244 </td>
6245 <td> Cell 3, row 2
6246 </td></tr></table>
6247
6248 !! end
6249
6250 !! test
6251 Nested table
6252 !! wikitext
6253 {| border=1
6254 | &alpha;
6255 |
6256 {| bgcolor=#ABCDEF border=2
6257 |nested
6258 |-
6259 |table
6260 |}
6261 |the original table again
6262 |}
6263 !! html
6264 <table border="1">
6265 <tr>
6266 <td> &#945;
6267 </td>
6268 <td>
6269 <table bgcolor="#ABCDEF" border="2">
6270 <tr>
6271 <td>nested
6272 </td></tr>
6273 <tr>
6274 <td>table
6275 </td></tr></table>
6276 </td>
6277 <td>the original table again
6278 </td></tr></table>
6279
6280 !! end
6281
6282 !! test
6283 Invalid attributes in table cell (bug 1830)
6284 !! wikitext
6285 {|
6286 |Cell:|broken
6287 |}
6288 !! html
6289 <table>
6290 <tr>
6291 <td>broken
6292 </td></tr></table>
6293
6294 !! end
6295
6296 !! test
6297 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6298 !! wikitext
6299 {|
6300 | title="foo" |bar
6301 | title="foo<nowiki>|</nowiki>" |bar
6302 | title="foo<nowiki>|</nowiki>" bar
6303 |}
6304 !! html/php
6305 <table>
6306 <tr>
6307 <td title="foo">bar
6308 </td>
6309 <td title="foo&#124;">bar
6310 </td>
6311 <td> title="foo|" bar
6312 </td></tr></table>
6313
6314 !! html/parsoid
6315 <table>
6316 <tbody><tr><td title="foo">bar</td>
6317 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6318 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6319 </tbody></table>
6320 !! end
6321
6322 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6323 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6324 # *2wt modes will fail.
6325 !! test
6326 Table security: embedded pipes
6327 !! options
6328 parsoid=wt2html,html2html
6329 !! wikitext
6330 {|
6331 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6332 !! html/php
6333 <table>
6334 <tr>
6335 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6336 <td>]" onmouseover="alert(document.cookie)"&gt;test
6337 </td>
6338 </tr>
6339 </table>
6340
6341 !! html/parsoid
6342 <table><tbody>
6343 <tr>
6344 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6345 !! end
6346
6347 !! test
6348 Element attributes with double ! should not be broken up by <th>
6349 !! wikitext
6350 {|
6351 ! hi <div class="!!">ha</div> ho
6352 |}
6353 !! html/php
6354 <table>
6355 <tr>
6356 <th> hi <div class="!!">ha</div> ho
6357 </th></tr></table>
6358
6359 !! html/parsoid
6360 <table>
6361 <tbody><tr><th> hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6362 </tbody></table>
6363 !! end
6364
6365 !! test
6366 ! and || in element attributes should not be parsed as <th>/<td>
6367 !! wikitext
6368 {|
6369 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6370 |}
6371 !! html/php
6372 <table>
6373 <tr>
6374 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6375 </td></tr></table>
6376
6377 !! html/parsoid
6378 <table>
6379 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6380 </tbody></table>
6381 !! end
6382
6383 # FIXME: The output seems broken. Filed as T110268.
6384 !! test
6385 ! and || in td attributes should not be parsed as <th>/<td>
6386 !! options
6387 parsoid=wt2html
6388 !! wikitext
6389 {|
6390 | style="color: red !important;" data-contrived="put this here ||" | foo
6391 |}
6392 !! html/php
6393 <table>
6394 <tr>
6395 <td> style="color: red !important;" data-contrived="put this here </td>
6396 <td> foo
6397 </td></tr></table>
6398
6399 !! html/parsoid
6400 <table>
6401 <tbody><tr><td> style="color: red !important;" data-contrived="put this here </td><td data-parsoid='{"stx_v":"row","a":{"\"":null},"sa":{"\"":""},"autoInsertedEnd":true}'> foo</td></tr>
6402 </tbody></table>
6403 !! end
6404
6405 !! test
6406 Break on | in element attribute in template
6407 !! options
6408 parsoid=wt2html,html2html
6409 !! wikitext
6410 {{echo|1=<div class="hi|ho">ha</div>}}
6411 !! html/php
6412 <p>ho"&gt;ha&lt;/div&gt;
6413 </p>
6414 !! html/parsoid
6415 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"ho\">ha&lt;/div>"}},"i":0}}]}'>ho">ha</span>
6416 !! end
6417
6418 ## We don't support roundtripping of these attributes in Parsoid.
6419 ## Selective serialization takes care of preventing dirty diffs.
6420 ## But, on edits, we dirty-diff the invalid attribute text.
6421 !! test
6422 Invalid text in table attributes should be discarded
6423 !! options
6424 parsoid=wt2html
6425 !! wikitext
6426 {| <span>boo</span> style='border:1px solid black'
6427 | <span>boo</span> style='color:blue' | 1
6428 |<span>boo</span> style='color:blue'| 2
6429 |}
6430 !! html/php
6431 <table style="border:1px solid black">
6432 <tr>
6433 <td style="color:blue"> 1
6434 </td>
6435 <td style="color:blue"> 2
6436 </td></tr></table>
6437
6438 !! html/parsoid
6439 <table style="border:1px solid black">
6440 <tr>
6441 <td style="color:blue"> 1</td>
6442 <td style="color:blue"> 2</td>
6443 </tr>
6444 </table>
6445 !! end
6446
6447 !! test
6448 Invalid text in table attributes should be preserved by selective serializer
6449 !! options
6450 parsoid={
6451 "modes": ["selser"],
6452 "changes": [
6453 ["td:first-child", "text", "abc"],
6454 ["td + td", "text", "xyz"]
6455 ]
6456 }
6457 !! wikitext
6458 {| <span>boo</span> style='border:1px solid black'
6459 | <span>boo</span> style='color:blue' | 1
6460 |<span>boo</span> style='color:blue'| 2
6461 |}
6462 !! wikitext/edited
6463 {| <span>boo</span> style='border:1px solid black'
6464 | <span>boo</span> style='color:blue' |abc
6465 |<span>boo</span> style='color:blue'|xyz
6466 |}
6467 !! end
6468
6469 !! test
6470 1. Template-generated table cell attributes and cell content
6471 !! wikitext
6472 {|
6473 |{{table_attribs}}
6474 | {{table_attribs}}
6475 || {{table_attribs_5}}
6476 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6477 |align=center {{table_attribs}}
6478 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6479 |}
6480 !! html
6481 <table>
6482 <tr>
6483 <td style="color:red;">Foo
6484 </td>
6485 <td style="color:red;">Foo
6486 </td>
6487 <td> style="color:red;"</td>
6488 <td>Bar
6489 </td>
6490 <td style="color:red;">Foo
6491 </td>
6492 <td align="center" style="color:red;">Foo
6493 </td>
6494 <td align="center" style="color:red;">Foo
6495 </td></tr></table>
6496
6497 !! end
6498
6499 !! test
6500 2. Template-generated table cell attributes and cell content
6501 !! wikitext
6502 {|
6503 |{{table_attribs_2}}
6504 |}
6505 !! html/php
6506 <table>
6507 <tr>
6508 <td style="color:red;">Foo
6509 </td>
6510 <td>Bar</td>
6511 <td>Baz
6512 </td></tr></table>
6513
6514 !! html/parsoid
6515 <table>
6516 <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>
6517 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6518 </tbody></table>
6519 !! end
6520
6521 !! test
6522 3. Template-generated table cell attributes and cell content
6523 !! wikitext
6524 {|
6525 !align=center {{table_header_cells}}
6526 |-
6527 |align=center {{table_cells}}
6528 |}
6529 !! html/php
6530 <table>
6531 <tr>
6532 <th align="center" style="color:red;">Foo</th>
6533 <th style="color:red;"><i>Bar</i></th>
6534 <th style="color:brown;"><i>Foo</i> and Baz
6535 </th></tr>
6536 <tr>
6537 <td align="center" style="color:red;">Foo</td>
6538 <td style="color:red;"><i>Bar</i></td>
6539 <td style="color:brown;"><i>Foo</i> and Baz
6540 </td></tr></table>
6541
6542 !! html/parsoid
6543 <table>
6544 <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>
6545 <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>
6546 </tbody></table>
6547 !! end
6548
6549 !! test
6550 4. Template-generated table cell attributes and cell content inside a templated table
6551 !! wikitext
6552 {{tbl-start}}
6553 !align=center {{table_header_cells}}
6554 |-
6555 |align=center {{table_cells}}
6556 {{tbl-end}}
6557 !! html/php
6558 <table>
6559 <tr>
6560 <th align="center" style="color:red;">Foo</th>
6561 <th style="color:red;"><i>Bar</i></th>
6562 <th style="color:brown;"><i>Foo</i> and Baz
6563 </th></tr>
6564 <tr>
6565 <td align="center" style="color:red;">Foo</td>
6566 <td style="color:red;"><i>Bar</i></td>
6567 <td style="color:brown;"><i>Foo</i> and Baz
6568 </td></tr></table>
6569
6570 !! html/parsoid
6571 <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}}]}'>
6572 <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>
6573 <tr>
6574 <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>
6575 </tbody></table>
6576 !! end
6577
6578 ## Edge case fix to prevent future regressions
6579 !! test
6580 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6581 !! wikitext
6582 {|
6583 |{{table_attribs_7}}
6584 |}
6585 <references />
6586 !! html/parsoid
6587 <table>
6588 <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>
6589 </tbody></table>
6590 <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>
6591 !! end
6592
6593 !! test
6594 Table with row followed by newlines and table heading
6595 !! options
6596 parsoid=wt2html,html2html
6597 !! wikitext
6598 {|
6599 |-
6600
6601 ! foo
6602 |}
6603 !! html/*
6604 <table>
6605
6606
6607 <tr>
6608 <th> foo
6609 </th></tr></table>
6610
6611 !! end
6612
6613 !! test
6614 Table with empty line following the start tag
6615 !! options
6616 parsoid=wt2html,html2html
6617 !! wikitext
6618 {|
6619
6620 |-
6621 | foo
6622 |}
6623 !! html/*
6624 <table>
6625
6626
6627 <tr>
6628 <td> foo
6629 </td></tr></table>
6630
6631 !! end
6632
6633 !! test
6634 Table attributes with empty value
6635 !! options
6636 parsoid=wt2html,html2html
6637 !! wikitext
6638 {|
6639 | style=| hello
6640 |}
6641 !! html/php
6642 <table>
6643 <tr>
6644 <td style=""> hello
6645 </td></tr></table>
6646
6647 !! html/parsoid
6648 <table>
6649 <tbody><tr><td style=""> hello</td></tr>
6650 </tbody></table>
6651 !! end
6652
6653 !! test
6654 Wikitext table with a lot of comments
6655 !! wikitext
6656 {|
6657 <!-- c0 -->
6658 | foo
6659 <!-- c1 -->
6660 |-<!-- c2 -->
6661 <!-- c3 -->
6662 |<!-- c4 -->
6663 <!-- c5 -->
6664 |}
6665 !! html
6666 <table>
6667 <tr>
6668 <td> foo
6669 </td></tr>
6670 <tr>
6671 <td>
6672 </td></tr></table>
6673
6674 !! end
6675
6676 !! test
6677 Wikitext table comments represented in parsoid dom
6678 !! wikitext
6679 {|<!--c1--><!--c2-->
6680 |-<!--c3-->
6681 | x
6682 |}
6683 !! html/php+tidy
6684 <table>
6685 <tr>
6686 <td>x</td>
6687 </tr>
6688 </table>
6689 !! html/parsoid
6690 <table><!--c1--><!--c2-->
6691 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6692 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6693 </tbody></table>
6694 !! end
6695
6696 !! test
6697 Wikitext table with double-line table cell
6698 !! wikitext
6699 {|
6700 |a
6701 b
6702 |}
6703 !! html
6704 <table>
6705 <tr>
6706 <td>a
6707 <p>b
6708 </p>
6709 </td></tr></table>
6710
6711 !! end
6712
6713 !! test
6714 Table cell with a single comment
6715 !! wikitext
6716 {|
6717 | <!-- c1 -->
6718 | a
6719 |}
6720 !! html
6721 <table>
6722 <tr>
6723 <td>
6724 </td>
6725 <td> a
6726 </td></tr></table>
6727
6728 !! end
6729
6730 !! test
6731 Table-cell after a comment-only-empty-line
6732 !! wikitext
6733 {|
6734 |a
6735 <!--c1-->
6736 <!--c2-->| b
6737 |}
6738 !! html
6739 <table>
6740 <tr>
6741 <td>a
6742 </td>
6743 <td> b
6744 </td></tr></table>
6745
6746 !! html/parsoid
6747 <table>
6748 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6749 <!--c1-->
6750 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6751 </tbody></table>
6752
6753 !! end
6754
6755 !! test
6756 Build table with {{!}}
6757 !! wikitext
6758 {{{!}} class="wikitable"
6759 ! header
6760 ! second header
6761 {{!}}- style="color:red;"
6762 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6763 {{!}}}
6764 !! html
6765 <table class="wikitable">
6766 <tr>
6767 <th> header
6768 </th>
6769 <th> second header
6770 </th></tr>
6771 <tr style="color:red;">
6772 <td> data </td>
6773 <td style="color:red;"> second data
6774 </td></tr></table>
6775
6776 !! end
6777
6778 !! test
6779 Build table with pipe as data
6780 !! wikitext
6781 {| class="wikitable"
6782 ! header
6783 ! second header
6784 |- style="color:red;"
6785 | data || style="color:red;" | second data
6786 |-
6787 | style="color:red;" | data with | || style="color:red;" | second data with |
6788 |-
6789 || data with | ||| second data with |
6790 |}
6791 !! html
6792 <table class="wikitable">
6793 <tr>
6794 <th> header
6795 </th>
6796 <th> second header
6797 </th></tr>
6798 <tr style="color:red;">
6799 <td> data </td>
6800 <td style="color:red;"> second data
6801 </td></tr>
6802 <tr>
6803 <td style="color:red;"> data with | </td>
6804 <td style="color:red;"> second data with |
6805 </td></tr>
6806 <tr>
6807 <td> data with | </td>
6808 <td> second data with |
6809 </td></tr></table>
6810
6811 !! end
6812
6813 !! test
6814 Build table with wikilink
6815 !! wikitext
6816 {| class="wikitable"
6817 ! header || second header
6818 |- style="color:red;"
6819 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6820 |-
6821 | data || second data [[Main Page|link|text with pipe]]
6822 |}
6823 !! html
6824 <table class="wikitable">
6825 <tr>
6826 <th> header </th>
6827 <th> second header
6828 </th></tr>
6829 <tr style="color:red;">
6830 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6831 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6832 </td></tr>
6833 <tr>
6834 <td> data </td>
6835 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6836 </td></tr></table>
6837
6838 !! end
6839
6840 # The expected HTML structure in this test is debatable. The PHP parser does
6841 # not parse this kind of table at all. The main focus for Parsoid is on
6842 # round-tripping, so this output is ok for now. TODO: revisit!
6843 !! test
6844 Wikitext table with html-syntax row
6845 !! wikitext
6846 {|
6847 |-
6848 <td>foo</td>
6849 |}
6850 !! html/parsoid
6851 <table>
6852 <tbody>
6853 <tr>
6854 <td>foo</td></tr></tbody></table>
6855 !! end
6856
6857 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6858 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6859 ## PHP parser, which tidy then compounds by fostering the content
6860 ## entirely out of the table. Parsoid recognizes the table context
6861 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6862 ## depends on PHP's treatment of broken table markup!
6863 !! test
6864 Implicit <td> after a |-
6865 !! options
6866 parsoid=wt2html,html2html
6867 !! wikitext
6868 {|
6869 |-
6870 a
6871 |}
6872 !! html/php
6873 <table>
6874
6875 a
6876 </table>
6877
6878 !! html/php+tidy
6879 <p>a</p>
6880 !! html/parsoid
6881 <table>
6882 <tr><td>a</td></tr>
6883 </table>
6884 !! end
6885
6886 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6887 !! test
6888 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6889 !! options
6890 parsoid=wt2html,html2html
6891 !! wikitext
6892 {|
6893 |-
6894 |
6895 a
6896 |-
6897 b
6898 |}
6899 !! html/php
6900 <table>
6901
6902 <tr>
6903 <td>
6904 <pre>a
6905 </pre>
6906 </td></tr>
6907 b
6908 </table>
6909
6910 !! html/php+tidy
6911 <p>b</p>
6912 <table>
6913 <tr>
6914 <td>
6915 <pre>
6916 a
6917 </pre></td>
6918 </tr>
6919 </table>
6920 !! html/parsoid
6921 <table>
6922 <tbody>
6923 <tr><td><pre>a</pre></td></tr>
6924 <tr><td> b</td></tr>
6925 </tbody>
6926 </table>
6927 !! end
6928
6929 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6930 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6931 !! test
6932 Lists should be recognized in an implicit <td> context
6933 !! options
6934 parsoid=wt2html,html2html
6935 !! wikitext
6936 {|
6937 |-
6938 *a
6939 |}
6940 !! html/php
6941 <table>
6942
6943 <ul><li>a</li></ul>
6944 </table>
6945
6946 !! html/php+tidy
6947 <ul>
6948 <li>a</li>
6949 </ul>
6950 !! html/parsoid
6951 <table>
6952 <tr>
6953 <td><ul>
6954 <li>a</li>
6955 </ul></td>
6956 </tr>
6957 </table>
6958 !! end
6959
6960 !! test
6961 Table cells not properly parsed in an implicit-td context
6962 !! wikitext
6963 {|
6964 |-
6965 {{table_attribs_4}} || a || b
6966 |}
6967 !! html/php+tidy
6968 <table>
6969 <tr>
6970 <td style="background-color:#DC241f;" width="10px"></td>
6971 <td>a</td>
6972 <td>b</td>
6973 </tr>
6974 </table>
6975 !! html/parsoid
6976 <table>
6977 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6978 <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>
6979 </tbody></table>
6980 !! end
6981
6982 !! test
6983 Parsoid: Round-trip tables directly followed by content (bug 51219)
6984 !! options
6985 parsoid=wt2html,wt2wt
6986 !! wikitext
6987 {|
6988 |foo
6989 |} bar
6990
6991 {|
6992 |baz
6993 |}<b>quux</b>
6994 !! html+tidy
6995 <table>
6996 <tr>
6997 <td>foo</td>
6998 </tr>
6999 </table>
7000 <p>bar</p>
7001 <table>
7002 <tr>
7003 <td>baz</td>
7004 </tr>
7005 </table>
7006 <p><b>quux</b></p>
7007 !! end
7008
7009 !! test
7010 Parsoid: Default to a newline after tables in new content (bug 51219)
7011 !! options
7012 parsoid=html2wt
7013 !! html/parsoid
7014 <table><tbody>
7015 <tr><td>foo</td></tr></tbody></table> bar
7016 <table><tbody>
7017 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7018 !! wikitext
7019 {|
7020 |foo
7021 |}
7022 <nowiki> </nowiki>bar
7023 {|
7024 |baz
7025 |}
7026 '''quux'''
7027 !! end
7028
7029 !! test
7030 Parsoid: newline inducing block nodes don't suppress <nowiki>
7031 !! options
7032 parsoid=html2wt
7033 !! html/parsoid
7034 a<h1>foo</h1>
7035 !! wikitext
7036 <nowiki> </nowiki>a
7037
7038 = foo =
7039 !! end
7040
7041 !! test
7042 Parsoid: Row-syntax table headings followed by comment & table cells
7043 !! options
7044 parsoid=wt2html,wt2wt
7045 !! wikitext
7046 {|
7047 ! foo || bar
7048 <!-- foo --> || baz || quux
7049 |}
7050 !! html/php
7051 <table>
7052 <tr>
7053 <th> foo </th>
7054 <th> bar
7055 </th>
7056 <td> baz </td>
7057 <td> quux
7058 </td></tr></table>
7059
7060 !! html/parsoid
7061 <table>
7062 <tbody><tr><th> foo </th><th> bar
7063 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7064 </tbody></table>
7065 !! end
7066
7067 !!test
7068 Parsoid: Recover better from broken table attributes
7069 !!options
7070 parsoid=wt2html
7071 !!wikitext
7072 {| class="foo
7073 | class="bar" |
7074 foo
7075 |}
7076 !!html/php+tidy
7077 <table class="foo">
7078 <tr>
7079 <td class="bar">
7080 <p>foo</p>
7081 </td>
7082 </tr>
7083 </table>
7084 !!html/parsoid
7085 <table class="foo">
7086 <tr>
7087 <td class="bar">
7088 <p>foo</p></td></tr>
7089 </tbody></table>
7090 !!end
7091
7092 !! test
7093 Tables: Digest broken attributes on table and tr tag
7094 !! options
7095 parsoid=wt2html
7096 !! wikitext
7097 {| || |} ++
7098 |- || || ++ --
7099 |- > [
7100 |}
7101 !! html
7102 <table>
7103 <tbody>
7104 <tr></tr>
7105 <tr></tr>
7106 </tbody></table>
7107 !! end
7108
7109 # T137406: Whitespace in the HTML
7110 !! test
7111 1. Generate correct wikitext for tables with thead/tbody/tfoot
7112 !! options
7113 parsoid=html2wt
7114 !! html/parsoid
7115 <table>
7116 <caption>Test</caption>
7117 <thead>
7118 <tr>
7119 <th>Month</th>
7120 <th>Savings</th>
7121 </tr>
7122 </thead>
7123 <tbody>
7124 <tr>
7125 <td>January</td>
7126 <td>$100</td>
7127 </tr>
7128 <tr>
7129 <td>February</td>
7130 <td>$80</td>
7131 </tr>
7132 </tbody>
7133 <tfoot>
7134 <tr>
7135 <td>Sum</td>
7136 <td>$180</td>
7137 </tr>
7138 </tfoot>
7139 </table>
7140 !! wikitext
7141 {|
7142 |+Test
7143 !Month
7144 !Savings
7145 |-
7146 |January
7147 |$100
7148 |-
7149 |February
7150 |$80
7151 |-
7152 |Sum
7153 |$180
7154 |}
7155 !! html/php+tidy
7156 <table>
7157 <caption>Test</caption>
7158 <tr>
7159 <th>Month</th>
7160 <th>Savings</th>
7161 </tr>
7162 <tr>
7163 <td>January</td>
7164 <td>$100</td>
7165 </tr>
7166 <tr>
7167 <td>February</td>
7168 <td>$80</td>
7169 </tr>
7170 <tr>
7171 <td>Sum</td>
7172 <td>$180</td>
7173 </tr>
7174 </table>
7175 !! end
7176
7177 # T137406: No whitespace in the HTML
7178 !! test
7179 2. Generate correct wikitext for tables with thead/tbody/tfoot
7180 !! options
7181 parsoid=html2wt
7182 !! html/parsoid
7183 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7184 !! wikitext
7185 {|
7186 !heading
7187 |-
7188 |foo
7189 |}
7190 !! end
7191
7192 !! test
7193 Testing serialization after deletion in references
7194 !! options
7195 parsoid={
7196 "modes": ["wt2wt"],
7197 "changes": [
7198 ["#x", "remove"]
7199 ]
7200 }
7201 !! wikitext
7202 hi <ref><div id="x">ho</div></ref>
7203
7204 <references />
7205 !! wikitext/edited
7206 hi <ref></ref>
7207
7208 <references />
7209 !! end
7210
7211 !!test
7212 Testing serialization after deletion of table cells
7213 !!options
7214 parsoid={
7215 "modes": ["wt2wt", "selser"],
7216 "changes": [
7217 ["#x", "remove"]
7218 ]
7219 }
7220 !!wikitext
7221 {|
7222 !h1 !!h2 !!h3
7223 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7224 |}
7225 !! wikitext/edited
7226 {|
7227 !h1 !!h2 !!h3
7228 |c2 |||c3
7229 |}
7230 !!end
7231
7232 !! test
7233 Testing selser after addition of new row before first row (T125419)
7234 !! options
7235 parsoid={
7236 "modes": ["wt2wt", "selser"],
7237 "changes": [
7238 [ "tr", "before", "<tr><td>X</td></tr>" ]
7239 ]
7240 }
7241 !! wikitext
7242 {|
7243 |a
7244 |}
7245 !! wikitext/edited
7246 {|
7247 |X
7248 |-
7249 |a
7250 |}
7251 !! end
7252
7253 !! test
7254 Serialize new table rows in a HTML table using HTML tags
7255 !! options
7256 parsoid={
7257 "modes": ["wt2wt", "selser"],
7258 "changes": [
7259 [ "tr", "before", "<tr><td>X</td></tr>" ]
7260 ]
7261 }
7262 !! wikitext
7263 <table><tr><td>a</td></tr></table>
7264 !! wikitext/edited
7265 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
7266 !! end
7267
7268 !! test
7269 Serialize new table cells in a HTML row using HTML tags
7270 !! options
7271 parsoid={
7272 "modes": ["wt2wt", "selser"],
7273 "changes": [
7274 [ "td", "before", "<td>X</td>" ]
7275 ]
7276 }
7277 !! wikitext
7278 <table><tr><td>a</td></tr></table>
7279 !! wikitext/edited
7280 <table><tr><td>X</td><td>a</td></tr></table>
7281 !! end
7282
7283 !! test
7284 Wikitext tables can be nested inside HTML tables
7285 !! options
7286 parsoid=html2wt
7287 !! html
7288 <table data-parsoid='{"stx":"html"}'>
7289 <tr><td>
7290 <table>
7291 <tr><td>foo</td></tr>
7292 </table>
7293 </td></tr>
7294 </table>
7295 !! wikitext
7296 <table>
7297 <tr><td>
7298 {|
7299 |foo
7300 |}
7301 </td></tr>
7302 </table>
7303 !! end
7304
7305 !! test
7306 Serialize wikitext list items as HTML list items when embedded in a HTML list
7307 !! options
7308 parsoid=html2wt
7309 !! html
7310 <ul data-parsoid='{"stx": "html"}'>
7311 <li data-parsoid='{}'>a</li>
7312 <li>b</li>
7313 </ul>
7314 !! wikitext
7315 <ul>
7316 <li>a</li>
7317 <li>b</li>
7318 </ul>
7319 !! end
7320
7321 # SSS FIXME: Is this actually a good thing given the
7322 # odd nested list output that is generated by MW?
7323 # <ul><li>foo<ul>..</ul></li></ul> instead of
7324 # <ul><li>foo</li><ul>..</ul></ul>
7325 !! test
7326 Wikitext lists can be nested inside HTML lists
7327 !! options
7328 parsoid=html2wt
7329 !! html
7330 <ul data-parsoid='{"stx": "html"}'>
7331 <li data-parsoid='{"stx": "html"}'>a
7332 <ul><li>b</li></ul>
7333 </li>
7334 </ul>
7335
7336 <ul data-parsoid='{"stx": "html"}'>
7337 <li>x
7338 <ul><li>y</li></ul>
7339 </li>
7340 </ul>
7341 !! wikitext
7342 <ul>
7343 <li>a
7344 * b
7345 </li>
7346 </ul>
7347
7348 <ul>
7349 <li>x
7350 * y
7351 </li>
7352 </ul>
7353 !! end
7354
7355 ###
7356 ### Internal links
7357 ###
7358 !! test
7359 Plain link, capitalized
7360 !! wikitext
7361 [[Main Page]]
7362 !! html
7363 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7364 </p>
7365 !! end
7366
7367 !! test
7368 Plain link, uncapitalized
7369 !! wikitext
7370 [[main Page]]
7371 !! html
7372 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7373 </p>
7374 !! end
7375
7376 !! test
7377 Piped link
7378 !! wikitext
7379 [[Main Page|The Main Page]]
7380 !! html
7381 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7382 </p>
7383 !! end
7384
7385 !! test
7386 Piped link with comment in link text
7387 !! wikitext
7388 [[Main Page|The Main<!--front--> Page]]
7389 !! html
7390 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7391 </p>
7392 !! end
7393
7394 !! test
7395 Piped link with multiple pipe characters in link text
7396 !! wikitext
7397 [[Main Page||The|Main|Page|]]
7398 !! html/php
7399 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7400 </p>
7401 !! html/parsoid
7402 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7403 !! end
7404
7405 !! test
7406 Piped link with no link text
7407 !! wikitext
7408 [[Thomas Bek (bishop of St David's)|]]
7409 !! html/php
7410 <p>[[Thomas Bek (bishop of St David's)|]]
7411 </p>
7412 !! html/parsoid
7413 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7414 !! end
7415
7416 !! test
7417 Broken link
7418 !! wikitext
7419 [[Zigzagzogzagzig]]
7420 !! html
7421 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7422 </p>
7423 !! end
7424
7425 !! test
7426 Broken link with fragment
7427 !! wikitext
7428 [[Zigzagzogzagzig#zug]]
7429 !! html
7430 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7431 </p>
7432 !! end
7433
7434 !! test
7435 Special page link with fragment
7436 !! wikitext
7437 [[Special:Version#anchor]]
7438 !! html
7439 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7440 </p>
7441 !! end
7442
7443 !! test
7444 Nonexistent special page link with fragment
7445 !! wikitext
7446 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7447 !! html
7448 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7449 </p>
7450 !! end
7451
7452 !! test
7453 Link with prefix
7454 !! wikitext
7455 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7456 !! html
7457 <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>
7458 </p>
7459 !! end
7460
7461 !! test
7462 Link with suffix
7463 !! wikitext
7464 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7465 !! html
7466 <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>!!!
7467 </p>
7468 !! end
7469
7470 !! article
7471 prefixed article
7472 !! text
7473 Some text
7474 !! endarticle
7475
7476 !! test
7477 Bug 43661: Piped links with identical prefixes
7478 !! wikitext
7479 [[prefixed article|prefixed articles with spaces]]
7480
7481 [[prefixed article|prefixed articlesaoeu]]
7482
7483 [[Main Page|Main Page test]]
7484 !! html
7485 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7486 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7487 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7488 </p>
7489 !! end
7490
7491
7492 !! test
7493 Link with HTML entity in suffix / tail
7494 !! wikitext
7495 [[Main Page]]&quot;, [[Main Page]]&#97;
7496 !! html/php
7497 <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;
7498 </p>
7499 !! html/parsoid
7500 <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>
7501 !! end
7502
7503 !! test
7504 Link with 3 brackets
7505 !! wikitext
7506 [[[Main Page]]]
7507 Foo [[[Main Page]]]
7508 !! html
7509 <p>[[[Main Page]]]
7510 Foo [[[Main Page]]]
7511 </p>
7512 !! end
7513
7514 !! test
7515 Link with 4 brackets
7516 !! wikitext
7517 [[[[Main Page]]]]
7518 !! html
7519 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7520 </p>
7521 !! end
7522
7523 !! test
7524 Piped link with 3 brackets
7525 !! wikitext
7526 [[[main page|the main page]]]
7527 !! html
7528 <p>[[[main page|the main page]]]
7529 </p>
7530 !! end
7531
7532 !! test
7533 Piped link with extlink-like text
7534 !! wikitext
7535 [[Main Page|[bar]]]
7536 [[Main Page|This is a [bar]]]
7537 !! html/php
7538 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7539 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7540 </p>
7541 !! html/parsoid
7542 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7543 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7544 !! end
7545
7546 !! test
7547 Link with multiple pipes
7548 !! wikitext
7549 [[Main Page|The|Main|Page]]
7550 !! html
7551 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7552 </p>
7553 !! end
7554
7555 # Note that parsoid does not munge anchor text; all non-space
7556 # characters are valid in HTML5 ids.
7557 !! test
7558 Anchor containing a #. (bug 63430)
7559 !! wikitext
7560 [[Main Page#And#Link]]
7561 !! html/php
7562 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7563 </p>
7564 !! html/parsoid
7565 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
7566 !! end
7567
7568 !! test
7569 Link to namespaces
7570 !! wikitext
7571 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7572 !! html
7573 <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>
7574 </p>
7575 !! end
7576
7577 !! test
7578 Link with space in namespace
7579 !! wikitext
7580 [[User talk:Foo bar]]
7581 !! html
7582 <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>
7583 </p>
7584 !! end
7585
7586 !! article
7587 MemoryAlpha:AlphaTest
7588 !! text
7589 This is an article in the MemoryAlpha namespace
7590 (which shadows the memoryalpha interwiki link).
7591 !! endarticle
7592
7593 !! test
7594 Namespace takes precedence over interwiki link (bug 51680)
7595 !! wikitext
7596 [[MemoryAlpha:AlphaTest]]
7597 !! html
7598 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7599 </p>
7600 !! end
7601
7602 # The previous test doesn't work correctly in html2*, due to not recognizing the
7603 # link as an internal one. This one checks for the correct behavior.
7604 !! test
7605 Link to namespace preferred over interwiki with correct rel attribute
7606 !! options
7607 parsoid=html2wt,html2html
7608 !! html/parsoid
7609 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7610 !! wikitext
7611 [[MemoryAlpha:AlphaTest]]
7612 !! end
7613
7614 !! test
7615 Piped link to namespace
7616 !! wikitext
7617 [[Meta:Disclaimers|The disclaimers]]
7618 !! html
7619 <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>
7620 </p>
7621 !! end
7622
7623 !! test
7624 Link containing }
7625 !! wikitext
7626 [[Usually caused by a typo (oops}]]
7627 !! html
7628 <p>[[Usually caused by a typo (oops}]]
7629 </p>
7630 !! end
7631
7632 !! article
7633 7% Solution
7634 !! text
7635 Just a test of an article title containing a percent.
7636 !! endarticle
7637
7638 !! test
7639 Link containing % (not as a hex sequence)
7640 !! wikitext
7641 [[7% Solution]]
7642 [[7% Solution|7%25 Solution]]
7643 !! html/php
7644 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7645 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7646 </p>
7647 !! html/parsoid
7648 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7649 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7650 !! end
7651
7652 # note that the parsoid HTML is identical to the previous test output,
7653 # so the previous test ensures that the html2wt mode will generate the
7654 # "not as a hex sequence" wikitext.
7655 !! test
7656 Link containing % as a single hex sequence interpreted to char
7657 !! options
7658 parsoid=wt2wt,wt2html,html2html
7659 !! wikitext
7660 [[7%25 Solution]]
7661 [[7%25 Solution|7%25 Solution]]
7662 !! html/php
7663 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7664 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7665 </p>
7666 !! html/parsoid
7667 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7668 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7669 !!end
7670
7671 !! test
7672 Link containing % as a double hex sequence interpreted to hex sequence
7673 !! wikitext
7674 [[7%2525 Solution]]
7675 !! html
7676 <p>[[7%2525 Solution]]
7677 </p>
7678 !!end
7679
7680 # note that parsoid does not munge anchor text; all non-space
7681 # characters are valid in HTML5 anchors.
7682 !! test
7683 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7684 Example for such a section: == < ==
7685 !! wikitext
7686 [[%23%3c]][[%23%3e]]
7687 !! html/php
7688 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7689 </p>
7690 !! html/parsoid
7691 <p><a rel="mw:WikiLink" href="./Main_Page#%3C" title="Main Page">#&lt;</a><a rel="mw:WikiLink" href="./Main_Page#%3E" title="Main Page">#></a></p>
7692 !! end
7693
7694 !! test
7695 Link containing "<#" and ">#" as a hex sequences
7696 !! wikitext
7697 [[%3c%23]][[%3e%23]]
7698 !! html
7699 <p>[[%3c%23]][[%3e%23]]
7700 </p>
7701 !! end
7702
7703 !! test
7704 Link containing an equals sign
7705 !! wikitext
7706 [[Special:BookSources/isbn=4-00-026157-6]]
7707 !! html/php
7708 <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>
7709 </p>
7710 !! html/parsoid
7711 <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>
7712 !! end
7713
7714 !! article
7715 Foo~bar
7716 !! text
7717 Just a test of an article title containing a tilde.
7718 !! endarticle
7719
7720 # note that links containing signatures, like [[Foo~~~~]], are
7721 # massaged by the pre-save transform (PST) and so the tildes are never
7722 # seen by the parser.
7723 !! test
7724 Link containing a tilde
7725 !! wikitext
7726 [[Foo~bar]]
7727 !! html/php
7728 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7729 </p>
7730 !! html/parsoid
7731 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7732 !! end
7733
7734 !! test
7735 Link containing double-single-quotes '' (bug 4598)
7736 !! wikitext
7737 [[Lista d''e paise d''o munno]]
7738 !! html/php
7739 <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>
7740 </p>
7741 !! html/parsoid
7742 <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>
7743 !! end
7744
7745 !! test
7746 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7747 !! wikitext
7748 Some [[Link|pretty ''italics'' and stuff]]!
7749 !! html/php
7750 <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>!
7751 </p>
7752 !! html/parsoid
7753 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7754 !! end
7755
7756 !! test
7757 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7758 !! wikitext
7759 ''Some [[Link|pretty ''italics'' and stuff]]!''
7760 !! html
7761 <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>
7762 </p>
7763 !! end
7764
7765 !! test
7766 Link with double quotes in title part (literal) and alternate part (interpreted)
7767 !! wikitext
7768 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7769
7770 [[''Pentecoste'']]
7771
7772 [[''Pentecoste''|Pentecoste]]
7773
7774 [[''Pentecoste''|''Pentecoste'']]
7775 !! html/php
7776 <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>
7777 </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>
7778 </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>
7779 </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>
7780 </p>
7781 !! html/parsoid
7782 <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>
7783 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7784 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7785 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7786 !! end
7787
7788 !! test
7789 Broken image links with HTML captions (bug 39700)
7790 !! wikitext
7791 [[File:Nonexistent|<script></script>]]
7792 [[File:Nonexistent|100x100px|<script></script>]]
7793 [[File:Nonexistent|&lt;]]
7794 [[File:Nonexistent|a<i>b</i>c]]
7795 !! html/php
7796 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7797 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7798 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7799 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7800 </p>
7801 !! html/parsoid
7802 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;script>&amp;lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></span>
7803 <span typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"100x100px"},{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;script>&amp;lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="100" width="100" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"100","width":"100"},"sa":{"resource":"File:Nonexistent"}}'/></a></span>
7804 <span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp;lt;"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=&#39;{\"src\":\"&amp;amp;lt;\",\"srcContent\":\"&amp;lt;\",\"dsr\":[107,111,null,null]}&#39;>&amp;lt;&lt;/span>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></span>
7805 <span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"a&lt;i>b&lt;/i>c"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"a&lt;i data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[134,142,3,4]}&#39;>b&lt;/i>c"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></span></p>
7806 !! end
7807
7808 !! test
7809 Plain link to URL
7810 !! wikitext
7811 [[http://www.example.com]]
7812 !! html/php
7813 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7814 </p>
7815 !! html/parsoid
7816 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7817 !! end
7818
7819 !! test
7820 Plain link to URL with link text
7821 !! wikitext
7822 [[http://www.example.com Link text]]
7823 !! html
7824 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7825 </p>
7826 !! end
7827
7828 !! test
7829 Plain link to protocol-relative URL
7830 !! wikitext
7831 [[//www.example.com]]
7832 !! html/php
7833 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7834 </p>
7835 !! html/parsoid
7836 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7837 !! end
7838
7839 !! test
7840 Plain link to protocol-relative URL with link text
7841 !! wikitext
7842 [[//www.example.com Link text]]
7843 !! html
7844 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7845 </p>
7846 !! end
7847
7848 !! test
7849 Plain link to page with question mark in title
7850 !! wikitext
7851 [[A?b]]
7852
7853 [[A?b|Baz]]
7854 !! html
7855 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7856 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7857 </p>
7858 !! end
7859
7860
7861 # I'm fairly sure the expected result here is wrong.
7862 # We want these to be URL links, not pseudo-pages with URLs for titles....
7863 # However the current output is also pretty screwy.
7864 #
7865 # ----
7866 # I'm changing it to match the current output--it arguably makes more
7867 # sense in the light of the test above. Old expected result was:
7868 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7869 #</p>
7870 # But I think this test is bordering on "garbage in, garbage out" anyway.
7871 # -- wtm
7872 !! test
7873 Piped link to URL
7874 !! wikitext
7875 Piped link to URL: [[http://www.example.com|an example URL]]
7876 !! html/php
7877 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7878 </p>
7879 !! html/parsoid
7880 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7881 !! end
7882
7883 !! test
7884 BUG 2: [[page|http://url/]] should link to page, not http://url/
7885 !! wikitext
7886 [[Main Page|http://url/]]
7887 !! html/php
7888 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7889 </p>
7890 !! html/parsoid
7891 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7892 !! end
7893
7894 # Parsoid does not mark self-links, by design.
7895 !! test
7896 BUG 337: Escaped self-links should be bold
7897 !! options
7898 title=[[Bug462]]
7899 !! wikitext
7900 [[Bu&#103;462]] [[Bug462]]
7901 !! html/php
7902 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7903 </p>
7904 !! html/php+tidy
7905 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7906 !! html/parsoid
7907 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7908 !! end
7909
7910 !! test
7911 Self-link to section should not be bold
7912 !! options
7913 title=[[Main Page]]
7914 !! wikitext
7915 [[Main Page#section]]
7916 !! html
7917 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7918 </p>
7919 !! end
7920
7921 !! article
7922 00
7923 !! text
7924 This is 00.
7925 !! endarticle
7926
7927 !!test
7928 Self-link to numeric title
7929 !!options
7930 title=[[0]]
7931 !! wikitext
7932 [[0]]
7933 !! html
7934 <p><strong class="selflink">0</strong>
7935 </p>
7936 !!end
7937
7938 !!test
7939 Link to numeric-equivalent title
7940 !!options
7941 title=[[0]]
7942 !! wikitext
7943 [[00]]
7944 !! html
7945 <p><a href="/wiki/00" title="00">00</a>
7946 </p>
7947 !!end
7948
7949 !! test
7950 <nowiki> inside a link
7951 !! wikitext
7952 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7953 !! html
7954 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7955 </p>
7956 !! end
7957
7958 !! test
7959 Non-breaking spaces in title
7960 !! wikitext
7961 [[&nbsp; Main &nbsp; Page &nbsp;]]
7962 !! html
7963 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7964 </p>
7965 !!end
7966
7967 !! test
7968 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7969 !! options
7970 language=ca
7971 !! wikitext
7972 '''[[Main Page]]'''
7973 !! html
7974 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7975 </p>
7976 !! end
7977
7978 !! test
7979 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7980 !! options
7981 language=ca
7982 !! wikitext
7983 ''[[Main Page]]''
7984 !! html
7985 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7986 </p>
7987 !! end
7988
7989 !! test
7990 Internal link with en linktrail: no apostrophes (bug 27473)
7991 !! options
7992 language=en
7993 !! wikitext
7994 [[Something]]'nice
7995 !! html
7996 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
7997 </p>
7998 !! end
7999
8000 !! test
8001 Internal link with ca linktrail with apostrophes (bug 27473)
8002 !! options
8003 language=ca
8004 !! wikitext
8005 [[Something]]'nice
8006 !! html
8007 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8008 </p>
8009 !! end
8010
8011 !! test
8012 Internal link with kaa linktrail with apostrophes (bug 27473)
8013 !! options
8014 language=kaa
8015 !! wikitext
8016 [[Something]]'nice
8017 !! html
8018 <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>
8019 </p>
8020 !! end
8021
8022 !! test
8023 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
8024 !! wikitext
8025 [[User:Foo/Test/63636:Bar|Test]]
8026 !! html/php
8027 <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>
8028 </p>
8029 !! html/parsoid
8030 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8031 !! end
8032
8033 ## Mainly a sanity check for Parsoid
8034 !! test
8035 Handle title parsing for subpages
8036 !! options
8037 title=[[/123123]]
8038 !! wikitext
8039 123
8040 !! html/parsoid
8041 <p>123</p>
8042 !! end
8043
8044 ## FIXME: Add a working php section here
8045 !! test
8046 Link to a subpage from a namespace other than main
8047 !! options
8048 title=[[User:test]]
8049 !! wikitext
8050 [[/123]]
8051 !! html/parsoid
8052 <p><a rel="mw:WikiLink" href="./User:Test/123" title="User:Test/123" data-parsoid='{"stx":"simple","a":{"href":"./User:Test/123"},"sa":{"href":"/123"}}'>/123</a></p>
8053 !! end
8054
8055 !! test
8056 Ensure that transclusion titles are not url-decoded
8057 !! options
8058 subpage title=[[Test]]
8059 parsoid=wt2html
8060 !! wikitext
8061 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8062 !! html/php
8063 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8064 </p>
8065 !! html/parsoid
8066 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8067 !! end
8068
8069 !! test
8070 Purely hash wikilink
8071 !! options
8072 title=[[User:test/123]]
8073 !! wikitext
8074 [[#a|b]]
8075 !! html/php
8076 <p><a href="#a">b</a>
8077 </p>
8078 !! html/parsoid
8079 <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>
8080 !! end
8081
8082 !! test
8083 1. Interaction of linktrail and template encapsulation
8084 !! options
8085 parsoid
8086 !! wikitext
8087 {{echo|[[Foo]]}}l
8088 !! html
8089 <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>
8090 !! end
8091
8092 !! test
8093 2. Interaction of linktrail and template encapsulation
8094 !! options
8095 parsoid
8096 !! wikitext
8097 {{echo|Some [[Fool]]}}s
8098 !! html
8099 <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"}]]}'>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>
8100 !! end
8101
8102 !! test
8103 3. Interaction of linktrail and template encapsulation
8104 !! options
8105 parsoid
8106 !! wikitext
8107 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8108 !! html
8109 <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"}]]}'>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>
8110 !! end
8111
8112 !! article
8113 Söfnuður
8114 !! text
8115 Test.
8116 !! endarticle
8117
8118 !! test
8119 Internal link with is link prefix
8120 !! options
8121 language=is
8122 !! wikitext
8123 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8124 !! html
8125 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8126 </p>
8127 !! end
8128
8129 !! article
8130 Mótmælendatrú
8131 !! text
8132 Test.
8133 !! endarticle
8134
8135 !! test
8136 Internal link with is link trail and link prefix
8137 !! options
8138 language=is
8139 !! wikitext
8140 [[mótmælendatrú|xxx]]ar
8141 [[mótmælendatrú]]ar
8142 mótmælenda[[söfnuður]]
8143 mótmælenda[[söfnuður|söfnuðir]]
8144 mótmælenda[[söfnuður|söfnuðir]]xxx
8145 !! html
8146 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8147 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8148 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8149 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8150 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8151 </p>
8152 !! end
8153
8154 !! test
8155 Parsoid link trail escaping
8156 !! options
8157 parsoid=html2wt,html2html
8158 !! html/parsoid
8159 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
8160 !! wikitext
8161 [[apple]]<nowiki/>s
8162 !! end
8163
8164 !! test
8165 Parsoid link prefix escaping
8166 !! options
8167 language=is
8168 parsoid=html2wt,html2html
8169 !! html/parsoid
8170 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
8171 !! wikitext
8172 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8173 !! end
8174
8175 !! test
8176 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8177 !! wikitext
8178 [[Foo| bar]]
8179
8180 [[Foo| ''bar'']]
8181
8182 [http://wp.org foo]
8183
8184 [http://wp.org ''foo'']
8185 !! html
8186 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8187 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8188 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8189 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8190 </p>
8191 !! end
8192
8193 !! test
8194 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8195 !! options
8196 parsoid
8197 !! wikitext
8198 [[Foo|{{echo|a}} b {{echo|c}}]]
8199 !! html
8200 <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>
8201 !! end
8202
8203 !! test
8204 Link with angle bracket after anchor
8205 !! wikitext
8206 [[Foo#<bar>]]
8207 !! html/php
8208 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8209 </p>
8210 !! html/parsoid
8211 <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>
8212 !! end
8213
8214 ###
8215 ### Interwiki links (see maintenance/interwiki.sql)
8216 ###
8217
8218 !! test
8219 Inline interwiki link
8220 !! options
8221 parsoid=wt2html,wt2wt,html2html
8222 !! wikitext
8223 [[MeatBall:SoftSecurity]]
8224 !! html/php
8225 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8226 </p>
8227 !! html/parsoid
8228 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8229 !! end
8230
8231 !! test
8232 Inline interwiki link with empty title (bug 2372)
8233 !! options
8234 parsoid=wt2html,wt2wt,html2html
8235 !! wikitext
8236 [[MeatBall:]]
8237 !! html/php
8238 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8239 </p>
8240 !! html/parsoid
8241 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8242 !! end
8243
8244 !! test
8245 Interwiki link encoding conversion (bug 1636)
8246 !! wikitext
8247 *[[Wikipedia:ro:Olteni&#0355;a]]
8248 *[[Wikipedia:ro:Olteni&#355;a]]
8249 !! html
8250 <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>
8251 <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>
8252
8253 !! html+tidy
8254 <ul>
8255 <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>
8256 <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>
8257 </ul>
8258 !! end
8259
8260 !! test
8261 Interwiki link with fragment (bug 2130)
8262 !! wikitext
8263 [[MeatBall:SoftSecurity#foo]]
8264 !! html
8265 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8266 </p>
8267 !! end
8268
8269 # Ideally the wikipedia: prefix here should be proto-relative too
8270 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8271 # define the 'en' prefix, and originally the test used 'wikipedia',
8272 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8273 # article.
8274 !! test
8275 Different interwiki prefixes mapping to the same URL
8276 !! wikitext
8277 [[:en:Foo]]
8278
8279 [[:en:Foo|Foo]]
8280
8281 [[wikipedia:Foo]]
8282
8283 [[:wikipedia:Foo|Foo]]
8284
8285 [[wikipedia:en:Foo]]
8286
8287 [[:wikipedia:en:Foo]]
8288
8289 [[ wikiPEdia :Foo]]
8290 !! html/parsoid
8291 <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>
8292
8293 <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>
8294
8295 <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>
8296
8297 <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>
8298
8299 <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>
8300
8301 <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>
8302
8303 <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>
8304 !! end
8305
8306 !! test
8307 Interwiki links that cannot be represented in wiki syntax
8308 !! wikitext
8309 [[meatball:ok]]
8310 [[meatball:ok#foo|ok with fragment]]
8311 [[meatball:ok_as_well?|ok ending with ? mark]]
8312 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8313 [http://de.wikipedia.org/wiki/#foo is just fragment]
8314
8315 !! html/php
8316 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8317 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8318 <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>
8319 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8320 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8321 </p>
8322 !! html/parsoid
8323 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8324 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8325 <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>
8326 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8327 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8328 !! end
8329
8330 !! test
8331 Interwiki links: trail
8332 !! wikitext
8333 [[wikipedia:Foo|Ba]]r
8334 !! html/php
8335 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8336 </p>
8337 !! html/parsoid
8338 <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>
8339 !! end
8340
8341 !! test
8342 Local interwiki link
8343 !! options
8344 parsoid=wt2html,wt2wt,html2html
8345 !! wikitext
8346 [[local:Template:Foo]]
8347 !! html/php
8348 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8349 </p>
8350 !! html/parsoid
8351 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8352 !! end
8353
8354 # Parsoid does not mark self-links, by design.
8355 !! test
8356 Local interwiki link: self-link to current page
8357 !! options
8358 title=[[Main Page]]
8359 parsoid=wt2html,wt2wt,html2html
8360 !! wikitext
8361 [[local:Main Page]]
8362 !! html/php
8363 <p><strong class="selflink">local:Main Page</strong>
8364 </p>
8365 !! html/parsoid
8366 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8367 !! end
8368
8369 !! test
8370 Local interwiki link: prefix only (bug 64167)
8371 !! options
8372 parsoid=wt2html,wt2wt,html2html
8373 !! wikitext
8374 [[local:]]
8375 !! html/php
8376 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8377 </p>
8378 !! html/parsoid
8379 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8380 !! end
8381
8382 !! test
8383 Local interwiki link: with additional interwiki prefix (bug 61357)
8384 !! options
8385 parsoid=wt2html,wt2wt,html2html
8386 !! wikitext
8387 [[local:meatball:Hello]]
8388 !! html/php
8389 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8390 </p>
8391 !! html/parsoid
8392 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8393 !! end
8394
8395 !! test
8396 Multiple local interwiki link prefixes
8397 !! wikitext
8398 [[local:local:local:local:mi:local:Foo]]
8399 !! options
8400 parsoid=wt2html,wt2wt,html2html
8401 !! html/php
8402 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8403 </p>
8404 !! html/parsoid
8405 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8406 !! end
8407
8408 ###
8409 ### Interlanguage links
8410 ### Language links (so that searching for '### language' matches..)
8411 ###
8412
8413 !! test
8414 Interlanguage link
8415 !! wikitext
8416 Blah blah blah
8417 [[zh:Chinese]]
8418 !! html/php
8419 <p>Blah blah blah
8420 </p>
8421 !! html/parsoid
8422 <p>Blah blah blah</p>
8423 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8424 !! end
8425
8426 ## parsoid html2wt will lose the space variations
8427 !! test
8428 Interlanguage link with spacing
8429 !! options
8430 parsoid=wt2html,wt2wt,html2html
8431 !! wikitext
8432 Blah blah blah
8433 [[ zh : Chinese ]]
8434 !! html/php
8435 <p>Blah blah blah
8436 </p>
8437 !! html/parsoid
8438 <p>Blah blah blah</p>
8439 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8440 !! end
8441
8442 !! test
8443 Double interlanguage link
8444 !! wikitext
8445 Blah blah blah
8446 [[es:Spanish]]
8447 [[zh:Chinese]]
8448 !! html/php
8449 <p>Blah blah blah
8450 </p>
8451 !! html/parsoid
8452 <p>Blah blah blah</p>
8453 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8454 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8455 !! end
8456
8457 ## parsoid html2wt will lose the space variations
8458 !! test
8459 Interlanguage link variations
8460 !! options
8461 parsoid=wt2html,wt2wt,html2html
8462 !! wikitext
8463 Blah blah blah
8464 [[ es :Spanish]]
8465 [[ ZH :Chinese]]
8466 [[es:Foo_bar]]
8467 !! html/php
8468 <p>Blah blah blah
8469 </p>
8470 !! html/parsoid
8471 <p>Blah blah blah</p>
8472 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8473 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8474 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8475 !! end
8476
8477 ## parsoid html2wt will normalize the space to _
8478 !! test
8479 Space and question mark encoding in interlanguage links (T95473)
8480 !! options
8481 parsoid=wt2html,wt2wt,html2html
8482 !! wikitext
8483 Blah blah blah
8484 [[es:Foo bar?]]
8485 !! html/php
8486 <p>Blah blah blah
8487 </p>
8488 !! html/parsoid
8489 <p>Blah blah blah</p>
8490 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8491 !! end
8492
8493 !! test
8494 Interlanguage link, with prefix links
8495 !! options
8496 language=ln
8497 !! wikitext
8498 Blah blah blah
8499 [[zh:Chinese]]
8500 !! html/php
8501 <p>Blah blah blah
8502 </p>
8503 !! html/parsoid
8504 <p>Blah blah blah</p>
8505 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8506 !! end
8507
8508 !! test
8509 Double interlanguage link, with prefix links (bug 8897)
8510 !! options
8511 language=ln
8512 !! wikitext
8513 Blah blah blah
8514 [[es:Spanish]]
8515 [[zh:Chinese]]
8516 !! html/php
8517 <p>Blah blah blah
8518 </p>
8519 !! html/parsoid
8520 <p>Blah blah blah</p>
8521 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8522 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8523 !! end
8524
8525 !! test
8526 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8527 !! wikitext
8528 Blah blah blah
8529 [[mul:Article]]
8530 !! html/php
8531 <p>Blah blah blah
8532 </p>
8533 !! html/parsoid
8534 <p>Blah blah blah</p>
8535 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8536 !! end
8537
8538 ## PHP parser tests script needs an update
8539 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8540 !! test
8541 Language links render as inline links if $wgInterwikiMagic=false
8542 !! options
8543 wgInterwikiMagic=false
8544 parsoid=wt2html,wt2wt,html2html
8545 !! wikitext
8546 Blah blah blah
8547 [[zh:Chinese]]
8548 !! html/parsoid
8549 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8550 !! end
8551
8552 ## PHP parser tests script needs an update
8553 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8554 !! test
8555 Language links render as inline links in the Talk namespace
8556 !! options
8557 title=Talk:Foo
8558 parsoid=wt2html,wt2wt,html2html
8559 !! wikitext
8560 Blah blah blah
8561 [[zh:Chinese]]
8562 !! html/parsoid
8563 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8564 !! end
8565
8566 !! test
8567 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8568 !! options
8569 language=ln
8570 !! wikitext
8571 [[WW&nbsp;II]]
8572 !! html
8573 <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>
8574 </p>
8575 !! end
8576
8577 !! test
8578 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8579 !! options
8580 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
8581 !! html/parsoid
8582 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8583 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8584 !! wikitext
8585 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8586
8587 He&amp;nbsp;llo He&amp;nbsp;llo
8588 !! html/php
8589 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
8590 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
8591 </p>
8592 !! end
8593
8594 # html2wt will fail because of title normalization without data-parsoid
8595 !! test
8596 Parsoid: handle constructor well
8597 !! options
8598 parsoid=wt2html,wt2wt
8599 !! wikitext
8600 [[constructor]]
8601
8602 [[constructor:foo]]
8603 !! html/php
8604 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8605 </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>
8606 </p>
8607 !! html/parsoid
8608 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
8609
8610 <p><a rel="mw:WikiLink" href="./Constructor:foo" title="Constructor:foo" data-parsoid='{"stx":"simple","a":{"href":"./Constructor:foo"},"sa":{"href":"constructor:foo"}}'>constructor:foo</a></p>
8611 !! end
8612
8613 !! article
8614 ko:
8615 !! text
8616 Test.
8617 !! endarticle
8618
8619 # Note that `ko` isn't a known interlanguage prefix
8620 !! test
8621 Parsoid: recognize interlanguage links without a target page
8622 !! options
8623 ill
8624 !! wikitext
8625 [[es:]]
8626
8627 [[ko:]]
8628 !! html/php
8629 es:
8630 !! html/parsoid
8631 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8632
8633 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8634 !! end
8635
8636 # Note that `ko` isn't a known interwiki prefix
8637 !! test
8638 Parsoid: recognize interwiki links without a target page
8639 !! options
8640 parsoid=wt2html,wt2wt,html2html
8641 !! wikitext
8642 [[:es:]]
8643
8644 [[:ko:]]
8645 !! html/php
8646 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8647 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8648 </p>
8649 !! html/parsoid
8650 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8651 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8652 !! end
8653
8654 !! test
8655 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8656 !! wikitext
8657 [[mi:Foo]]
8658 !! html/php
8659 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8660 </p>
8661 !! html/parsoid
8662 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8663 !! end
8664
8665 !! test
8666 Interlanguage link with preceding local interwiki link (bug 68085)
8667 !! options
8668 parsoid=wt2html,wt2wt,html2html
8669 !! wikitext
8670 Blah blah blah
8671 [[local:es:Spanish]]
8672 !! html/php
8673 <p>Blah blah blah
8674 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8675 </p>
8676 !! html/parsoid
8677 <p>Blah blah blah
8678 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8679 !! end
8680
8681 !! test
8682 Looks like an interlanguage link, but is actually a local interwiki
8683 !! options
8684 parsoid=wt2html,wt2wt,html2html
8685 !! wikitext
8686 Blah blah blah
8687 [[mi:Template:Foo]]
8688 !! html/php
8689 <p>Blah blah blah
8690 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8691 </p>
8692 !! html/parsoid
8693 <p>Blah blah blah
8694 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8695 !! end
8696
8697 ###
8698 ### Redirects, Parsoid-only
8699 ###
8700
8701 !! test
8702 1. Simple redirect to page
8703 !! wikitext
8704 #REDIRECT [[Main Page]]
8705 !! html/parsoid
8706 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8707 !! end
8708
8709 !! test
8710 2. Other redirect variants
8711 !! wikitext
8712 #REDIRECT [[Main_Page]]
8713 !! html/parsoid
8714 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8715 !! end
8716
8717 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8718 # This tests the Parsoid bail-out code.
8719 !! test
8720 3. Other redirect variants
8721 !! wikitext
8722 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8723 !! html/parsoid
8724 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8725 !! end
8726
8727 !! test
8728 4. Redirect to a templated destination
8729 !! wikitext
8730 #REDIRECT [[{{echo|Foo}}bar]]
8731 !! html/parsoid
8732 <link about="#mwt2" typeof="mw:ExpandedAttrs" rel="mw:PageProp/redirect" href="./Foobar" data-parsoid='{"a":{"href":"./Foobar"},"sa":{"href":"{{echo|Foo}}bar"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[12,24,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"Foo\"}},\"i\":0}}]}&#39;>Foo&lt;/span>bar"}]]}'/>
8733 !! end
8734
8735 !! test
8736 Empty redirect
8737 !! options
8738 parsoid=wt2html,wt2wt
8739 !! wikitext
8740 #REDIRECT [[]]
8741 !! html/parsoid
8742 <ol>
8743 <li>REDIRECT [[]]</li></ol>
8744 !! end
8745
8746 !! test
8747 Optional colon in #REDIRECT
8748 !! options
8749 # the colon is archaic syntax. we support it for wt2html, but we
8750 # don't care that it roundtrips back to the modern syntax.
8751 parsoid=wt2html,html2html
8752 !! wikitext
8753 #REDIRECT:[[Main Page]]
8754 !! html/parsoid
8755 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8756 !! end
8757
8758 !! test
8759 Whitespace in #REDIRECT with optional colon
8760 !! options
8761 # the colon and gratuitous whitespace is archaic syntax. we support
8762 # it for wt2html, but we don't care that it roundtrips back to the
8763 # modern syntax (without extra whitespace)
8764 parsoid=wt2html,html2html
8765 !! wikitext
8766
8767 #REDIRECT
8768 :
8769 [[Main Page]]
8770 !! html/parsoid
8771 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8772 !! end
8773
8774 !! test
8775 Piped link in #REDIRECT
8776 !! options
8777 # content after piped link is ignored. we support this syntax,
8778 # but don't care that the piped link is lost when we roundtrip this.
8779 parsoid=wt2html
8780 !! wikitext
8781 #REDIRECT [[Main Page|bar]]
8782 !! html/parsoid
8783 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8784 !! end
8785
8786 !! test
8787 Redirect to category (T104502)
8788 !! options
8789 parsoid=wt2html,wt2wt
8790 !! wikitext
8791 #REDIRECT [[Category:Foo]]
8792 !! html/parsoid
8793 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8794 !! end
8795
8796 !! test
8797 Redirect to category with URL encoding (T104502)
8798 !! options
8799 parsoid=wt2html
8800 !! wikitext
8801 #REDIRECT [[Category%3AFoo]]
8802 !! html/parsoid
8803 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8804 !! end
8805
8806 !! test
8807 Redirect to category page
8808 !! wikitext
8809 #REDIRECT [[:Category:Foo]]
8810 !! html/parsoid
8811 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8812 !! end
8813
8814 !! test
8815 Redirect to image page (1)
8816 !! wikitext
8817 #REDIRECT [[File:Wiki.png]]
8818 !! html/parsoid
8819 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8820 !! end
8821
8822 !! test
8823 Redirect to image page (2)
8824 !! wikitext
8825 #REDIRECT [[Image:Wiki.png]]
8826 !! html/parsoid
8827 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8828 !! end
8829
8830 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8831 # Next test confirms this.
8832 !! test
8833 Redirect to language (1) (T104918)
8834 !! options
8835 parsoid=wt2html,wt2wt,html2html
8836 !! wikitext
8837 #REDIRECT [[en:File:Wiki.png]]
8838 !! html/parsoid
8839 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8840 !! end
8841
8842 !! test
8843 Redirect to language (2) (T104918)
8844 !! wikitext
8845 #REDIRECT [[:en:File:Wiki.png]]
8846 !! html/parsoid
8847 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8848 !! end
8849
8850 !! test
8851 Redirect to interwiki (T104918)
8852 !! wikitext
8853 #REDIRECT [[meatball:File:Wiki.png]]
8854 !! html/parsoid
8855 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8856 !! end
8857
8858 !! test
8859 Non-English #REDIRECT
8860 !! options
8861 language=is
8862 !! wikitext
8863 #TILVÍSUN [[Main Page]]
8864 !! html/parsoid
8865 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8866 !! end
8867
8868 !! test
8869 Redirect syntax under text isn't considered a redirect
8870 !! wikitext
8871 some text
8872 #redirect [[Main Page]]
8873 !! html/parsoid
8874 <p>some text</p>
8875 <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>
8876 !! end
8877
8878 # FIXME: Should hoist the redirect to the top of the page and ensure there
8879 # is only one.
8880 !! test
8881 New redirect
8882 !! options
8883 parsoid=html2wt
8884 !! html/parsoid
8885 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8886 !! wikitext
8887 Foo
8888 #REDIRECT [[Foo]]
8889 !! end
8890
8891 ##
8892 ## XHTML tidiness
8893 ###
8894
8895 !! test
8896 <br> to <br />
8897 !! wikitext
8898 1<br>2<br />3
8899 !! html
8900 <p>1<br />2<br />3
8901 </p>
8902 !! end
8903
8904 !! test
8905 Broken br tag sanitization
8906 !! wikitext
8907 </br>
8908 !! html/php
8909 <p>&lt;/br&gt;
8910 </p>
8911 !! end
8912
8913 # TODO: Fix html2html mode (bug 51055)!
8914 !! test
8915 Parsoid: Broken br tag recognition
8916 !! options
8917 parsoid=wt2html
8918 !! wikitext
8919 </br>
8920
8921 <br/ >
8922 !! html+tidy
8923 <p><br /></p>
8924 <p><br /></p>
8925 !! end
8926
8927 !! test
8928 Incorrecly removing closing slashes from correctly formed XHTML
8929 !! wikitext
8930 <br style="clear:both;" />
8931 !! html
8932 <p><br style="clear:both;" />
8933 </p>
8934 !! end
8935
8936 !! test
8937 Failing to transform badly formed HTML into correct XHTML
8938 !! wikitext
8939 <br style="clear: left;">
8940 <br style="clear: right;">
8941 <br style="clear: both;">
8942 !! html
8943 <p><br style="clear: left;" />
8944 <br style="clear: right;" />
8945 <br style="clear: both;" />
8946 </p>
8947 !!end
8948
8949 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8950 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8951 !! test
8952 Handling html with a div self-closing tag
8953 !! wikitext
8954 <div title />
8955 <div title/>
8956 <div title/ >
8957 <div title=bar />
8958 <div title=bar/>
8959 <div title=bar/ >
8960 !! html/php
8961 <p>&lt;div title /&gt;
8962 &lt;div title/&gt;
8963 </p>
8964 <div>
8965 <p>&lt;div title=bar /&gt;
8966 &lt;div title=bar/&gt;
8967 </p>
8968 <div title="bar/"></div>
8969 </div>
8970
8971 !! html/parsoid
8972 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8973 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8974 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
8975 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8976 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8977 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
8978 !! end
8979
8980 !! test
8981 Handling html with a br self-closing tag
8982 !! wikitext
8983 <br title />
8984 <br title/>
8985 <br title/ >
8986 <br title=bar />
8987 <br title=bar/>
8988 <br title=bar/ >
8989 !! html/php
8990 <p><br title="" />
8991 <br title="" />
8992 <br />
8993 <br title="bar" />
8994 <br title="bar" />
8995 <br title="bar/" />
8996 </p>
8997 !! html/parsoid
8998 <p><br title="" />
8999 <br title="" />
9000 <br title="" />
9001 <br title="bar" />
9002 <br title="bar" />
9003 <br title="bar/" />
9004 </p>
9005 !! end
9006
9007 !! test
9008 Horizontal ruler (should it add that extra space?)
9009 !! wikitext
9010 <hr>
9011 <hr >
9012 foo <hr
9013 > bar
9014 !! html+tidy
9015 <hr />
9016 <hr />
9017 <p>foo</p>
9018 <hr />
9019 <p>bar</p>
9020 !! end
9021
9022 !! test
9023 Horizontal ruler -- 4+ dashes render hr
9024 !! wikitext
9025 ----
9026 !! html
9027 <hr />
9028
9029 !! end
9030
9031 !! test
9032 Horizontal ruler -- eats additional dashes on the same line
9033 !! wikitext
9034 ---------
9035 !! html
9036 <hr />
9037
9038 !! end
9039
9040 !! test
9041 Horizontal ruler -- does not collapse dashes on consecutive lines
9042 !! wikitext
9043 ----
9044 ----
9045 !! html
9046 <hr />
9047 <hr />
9048
9049 !! end
9050
9051 !! test
9052 Horizontal ruler -- <4 dashes render as plain text
9053 !! wikitext
9054 ---
9055 !! html
9056 <p>---
9057 </p>
9058 !! end
9059
9060 !! test
9061 Horizontal ruler -- Supports content following dashes on same line
9062 !! wikitext
9063 ---- Foo
9064 !! html
9065 <hr /> Foo
9066
9067 !! html+tidy
9068 <hr />
9069 <p>Foo</p>
9070 !! end
9071
9072 ###
9073 ### Block-level elements
9074 ###
9075 !! test
9076 Common list
9077 !! wikitext
9078 *Common list
9079 * item 2
9080 *item 3
9081 !! html
9082 <ul><li>Common list</li>
9083 <li> item 2</li>
9084 <li>item 3</li></ul>
9085
9086 !! end
9087
9088 !! test
9089 Numbered list
9090 !! wikitext
9091 #Numbered list
9092 #item 2
9093 # item 3
9094 !! html
9095 <ol><li>Numbered list</li>
9096 <li>item 2</li>
9097 <li> item 3</li></ol>
9098
9099 !! end
9100
9101 !! test
9102 Mixed list
9103 !! wikitext
9104 *Mixed list
9105 *# with numbers
9106 ** and bullets
9107 *# and numbers
9108 *bullets again
9109 **bullet level 2
9110 ***bullet level 3
9111 ***#Number on level 4
9112 **bullet level 2
9113 **#Number on level 3
9114 **#Number on level 3
9115 *#number level 2
9116 *Level 1
9117 *** Level 3
9118 #** Level 3, but ordered
9119 !! html
9120 <ul><li>Mixed list
9121 <ol><li> with numbers</li></ol>
9122 <ul><li> and bullets</li></ul>
9123 <ol><li> and numbers</li></ol></li>
9124 <li>bullets again
9125 <ul><li>bullet level 2
9126 <ul><li>bullet level 3
9127 <ol><li>Number on level 4</li></ol></li></ul></li>
9128 <li>bullet level 2
9129 <ol><li>Number on level 3</li>
9130 <li>Number on level 3</li></ol></li></ul>
9131 <ol><li>number level 2</li></ol></li>
9132 <li>Level 1
9133 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
9134 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
9135
9136 !! end
9137
9138 !! test
9139 1. Nested mixed wikitext and html list
9140 !! wikitext
9141 * hi
9142 * <ul><li>ho</li></ul>
9143 * hi
9144 ** ho
9145 !! html/php
9146 <ul><li> hi</li>
9147 <li> <ul><li>ho</li></ul></li>
9148 <li> hi
9149 <ul><li> ho</li></ul></li></ul>
9150
9151 !! html/parsoid
9152 <ul><li> hi</li>
9153 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9154 <li> hi
9155 <ul><li> ho</li></ul></li></ul>
9156 !! end
9157
9158 !! test
9159 2. Nested mixed wikitext and html list (incompatible)
9160 !! wikitext
9161 ; hi
9162 : {{echo|<li>ho</li>}}
9163 !! html/php
9164 <dl><dt> hi</dt>
9165 <dd> <li>ho</li></dd></dl>
9166
9167 !! html/parsoid
9168 <dl><dt> hi</dt>
9169 <dd> <li about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>ho&lt;/li>"}},"i":0}}]}'>ho</li></dd></dl>
9170 !! end
9171
9172 !! test
9173 Nested lists 1
9174 !! wikitext
9175 *foo
9176 **bar
9177 !! html
9178 <ul><li>foo
9179 <ul><li>bar</li></ul></li></ul>
9180
9181 !! end
9182
9183 !! test
9184 Nested lists 2
9185 !! wikitext
9186 **foo
9187 *bar
9188 !! html
9189 <ul><li><ul><li>foo</li></ul></li>
9190 <li>bar</li></ul>
9191
9192 !! end
9193
9194 !! test
9195 Nested lists 3 (first element empty)
9196 !! wikitext
9197 *
9198 **bar
9199 !! html
9200 <ul><li>
9201 <ul><li>bar</li></ul></li></ul>
9202
9203 !! end
9204
9205 !! test
9206 Nested lists 4 (first element empty)
9207 !! wikitext
9208 **
9209 *bar
9210 !! html
9211 <ul><li><ul><li></li></ul></li>
9212 <li>bar</li></ul>
9213
9214 !! end
9215
9216 !! test
9217 Nested lists 5 (both elements empty)
9218 !! wikitext
9219 **
9220 *
9221 !! html
9222 <ul><li><ul><li></li></ul></li>
9223 <li></li></ul>
9224
9225 !! end
9226
9227 !! test
9228 Nested lists 6 (both elements empty)
9229 !! wikitext
9230 *
9231 **
9232 !! html
9233 <ul><li>
9234 <ul><li></li></ul></li></ul>
9235
9236 !! end
9237
9238 !! test
9239 Nested lists 7 (skip initial nesting levels)
9240 !! wikitext
9241 *** foo
9242 !! html
9243 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
9244
9245 !! end
9246
9247 !! test
9248 Nested lists 8 (multiple nesting transitions)
9249 !! wikitext
9250 * foo
9251 *** bar
9252 ** baz
9253 * boo
9254 !! html
9255 <ul><li> foo
9256 <ul><li><ul><li> bar</li></ul></li>
9257 <li> baz</li></ul></li>
9258 <li> boo</li></ul>
9259
9260 !! end
9261
9262 !! test
9263 Nested lists 9 (extension interaction)
9264 !! options
9265 parsoid
9266 !! wikitext
9267 *<references />
9268 !! html/parsoid
9269 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9270 !! end
9271
9272 !! test
9273 1. Lists with start-of-line-transparent tokens before bullets: Comments
9274 !! wikitext
9275 *foo
9276 *<!--cmt-->bar
9277 <!--cmt-->*baz
9278 !! html
9279 <ul><li>foo</li>
9280 <li>bar</li>
9281 <li>baz</li></ul>
9282
9283 !! end
9284
9285 !! test
9286 2. Lists with start-of-line-transparent tokens before bullets: Template close
9287 !! wikitext
9288 *foo {{echo|bar
9289 }}*baz
9290 !! html
9291 <ul><li>foo bar</li>
9292 <li>baz</li></ul>
9293
9294 !! end
9295
9296 !! test
9297 List items are not parsed correctly following a <pre> block (bug 785)
9298 !! wikitext
9299 * <pre>foo</pre>
9300 * <pre>bar</pre>
9301 * zar
9302 !! html/php
9303 <ul><li> <pre>foo</pre></li>
9304 <li> <pre>bar</pre></li>
9305 <li> zar</li></ul>
9306
9307 !! html/parsoid
9308 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
9309 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
9310 <li> zar</li></ul>
9311 !! end
9312
9313 !! test
9314 List items from template
9315 !! wikitext
9316
9317 {{inner list}}
9318 * item 2
9319
9320 * item 0
9321 {{inner list}}
9322 * item 2
9323
9324 * item 0
9325 * notSOL{{inner list}}
9326 * item 2
9327 !! html
9328 <ul><li> item 1</li>
9329 <li> item 2</li></ul>
9330 <ul><li> item 0</li>
9331 <li> item 1</li>
9332 <li> item 2</li></ul>
9333 <ul><li> item 0</li>
9334 <li> notSOL</li>
9335 <li> item 1</li>
9336 <li> item 2</li></ul>
9337
9338 !! end
9339
9340 !! test
9341 List interrupted by empty line or heading
9342 !! wikitext
9343 * foo
9344
9345 ** bar
9346 == A heading ==
9347 * Another list item
9348 !! html
9349 <ul><li> foo</li></ul>
9350 <ul><li><ul><li> bar</li></ul></li></ul>
9351 <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>
9352 <ul><li> Another list item</li></ul>
9353
9354 !!end
9355
9356 !!test
9357 Multiple list tags generated by templates
9358 !! wikitext
9359 {{echo|<li>}}a
9360 {{echo|<li>}}b
9361 {{echo|<li>}}c
9362 !! html
9363 <li>a
9364 <li>b
9365 <li>c</li>
9366 </li>
9367 </li>
9368
9369 !! html+tidy
9370 <ul>
9371 <li>a</li>
9372 <li>b</li>
9373 <li>c</li>
9374 </ul>
9375 !!end
9376
9377 !!test
9378 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9379 !! wikitext
9380 *a
9381 <!--This line will NOT split the list-->
9382 *b
9383 <!--This line will NOT split the list either-->
9384 *c
9385 <!--foo--> <!----> <!--This line NOT split the list either-->
9386 *d
9387 !! html
9388 <ul><li>a</li>
9389 <li>b</li>
9390 <li>c</li>
9391 <li>d</li></ul>
9392
9393 !!end
9394
9395 !!test
9396 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9397 !! wikitext
9398 *a
9399 <!--This line will NOT split the list-->
9400 *b
9401 <!--This line will NOT split the list either-->
9402 *c
9403 <!--foo--> <!----> <!--This line NOT split the list
9404 either-->
9405 *d
9406 !! html
9407 <ul><li>a</li>
9408 <li>b</li>
9409 <li>c</li>
9410 <li>d</li></ul>
9411
9412 !!end
9413
9414 !!test
9415 Test the li-hack
9416 (The PHP parser relies on Tidy for the hack)
9417 !!options
9418 parsoid=wt2html,wt2wt
9419 !! wikitext
9420 * foo
9421 * <li>li-hack
9422 * {{echo|<li>templated li-hack}}
9423 * <!--foo--> <li> unsupported li-hack with preceding comments
9424
9425 <ul>
9426 <li><li>not a li-hack
9427 </li>
9428 </ul>
9429 !! html+tidy
9430 <ul>
9431 <li>foo</li>
9432 <li>li-hack</li>
9433 <li>templated li-hack</li>
9434 <li>unsupported li-hack with preceding comments</li>
9435 </ul>
9436 <ul>
9437 <li>not a li-hack</li>
9438 </ul>
9439 !!end
9440
9441 !! test
9442 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9443 !! options
9444 parsoid
9445 !! wikitext
9446 # foo
9447 ## bar
9448 * foo
9449 ** bar
9450 : foo
9451 :: bar
9452 !! html
9453 <ol>
9454 <li> foo<ol>
9455 <li> bar</li>
9456 </ol></li>
9457 </ol><ul>
9458 <li> foo<ul>
9459 <li> bar</li>
9460 </ul></li>
9461 </ul><dl>
9462 <dd> foo<dl>
9463 <dd> bar</dd>
9464 </dl></dd>
9465 </dl>
9466 !! end
9467
9468 !! test
9469 Parsoid: Test of whitespace serialization with Templated bullets
9470 !! options
9471 parsoid
9472 !! wikitext
9473 * {{bullet}}
9474 !! html
9475 <ul>
9476 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9477 </ul>
9478 !! end
9479
9480 # ------------------------------------------------------------------------
9481 # The next set of tests are about Parsoid's ability to handle badly nested
9482 # tags (parse, minimize scope of fixup, and roundtrip back)
9483 # ------------------------------------------------------------------------
9484
9485 !! test
9486 Unbalanced closing block tags break a list
9487 (php parser relies on Tidy to fix up)
9488 !! wikitext
9489 <div>
9490 *a</div><div>
9491 *b</div>
9492 !! html+tidy
9493 <div>
9494 <ul>
9495 <li>a</li>
9496 </ul>
9497 </div>
9498 <div>
9499 <ul>
9500 <li>b</li>
9501 </ul>
9502 </div>
9503 !! end
9504
9505 # Parsoid fails this test, but it might be tricky to support properly.
9506 # See bug 68395.
9507 !! test
9508 Unbalanced closing non-block tags don't break a list
9509 (php parser relies on Tidy to fix up)
9510 !! wikitext
9511 <span>
9512 *a</span><span>
9513 *b</span>
9514 !! html/php+tidy
9515 <ul>
9516 <li><span>a</span></li>
9517 <li><span>b</span></li>
9518 </ul>
9519 !! html/parsoid
9520 <span>
9521 <ul>
9522 <li>a<span></span>
9523 </li>
9524 <li>b
9525 </li>
9526 </ul>
9527 </span>
9528 !! end
9529
9530 !! test
9531 Unclosed formatting tags that straddle lists are closed and reopened
9532 (php parser relies on Tidy to fix up)
9533 !! options
9534 parsoid=wt2html,wt2wt,html2html
9535 !! wikitext
9536 # <s> a
9537 # b </s>
9538 !! html/php+tidy
9539 <ol>
9540 <li><s>a</s></li>
9541 <li><s>b</s></li>
9542 </ol>
9543 !! html/parsoid
9544 <ol><li> <s> a</s></li>
9545 <li><s> b </s></li></ol>
9546 !! end
9547
9548 # See bug 68395.
9549 !!test
9550 1. List embedded in a formatting tag
9551 !! wikitext
9552 <small>
9553 * foo
9554 </small>
9555 !! html/php+tidy
9556 <ul>
9557 <li><small>foo</small></li>
9558 </ul>
9559 !! html/parsoid
9560 <small>
9561 <ul>
9562 <li> foo</li>
9563 </ul>
9564 </small>
9565 !!end
9566
9567 ## Ugly Parsoid output here
9568 ## Not sure what the right output is.
9569 !!test
9570 2. List embedded in a formatting tag
9571 !! wikitext
9572 <small>
9573 *a
9574 *b</small>
9575 !! html/php+tidy
9576 <ul>
9577 <li><small>a</small></li>
9578 <li><small>b</small></li>
9579 </ul>
9580 !! html/parsoid
9581 <small></small>
9582 <ul><small>
9583 <li>a</li>
9584 </small>
9585 <li><small>b</small></li>
9586 </ul>
9587 !!end
9588
9589 # Ugly Parsoid and PHP parser output here
9590 # Not sure if we want to make this a test!
9591 #
9592 ## !!test
9593 ## 3. Unclosed formatting tags in list elements
9594 ## !! wikitext
9595 ## *<small>a
9596 ## *<small>b
9597 ## !! html/php+tidy
9598 ## <ul>
9599 ## <li><small>a</small></li>
9600 ## <li><small><small>b</small></small></li>
9601 ## </ul>
9602 ## !! html/parsoid
9603 ## <ul>
9604 ## <li><small>a</small></li>
9605 ## <small>
9606 ## <li><small>b</small></li>
9607 ## </small></ul>
9608 ## !!end
9609
9610 # This is a bug in the PHP parser + tidy combination.
9611 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9612 # and then fostered out of the table by tidy.)
9613 # We believe the Parsoid output to be correct.
9614 !! test
9615 Table with missing opening <tr> tag
9616 !! options
9617 parsoid=wt2html,wt2wt
9618 !! wikitext
9619 <table>
9620 <td>foo</td>
9621 </tr>
9622 </table>
9623 !! html+tidy
9624 <table>
9625 <tr>
9626 <td>foo</td>
9627 </tr>
9628 </table>
9629 !! end
9630
9631 ###
9632 ### Magic Words
9633 ###
9634
9635 # Note that the current date is hard-coded as
9636 # 1970-01-01T00:02:03Z (a Thursday)
9637 # when running parser tests. The timezone is also fixed to GMT, so
9638 # local date will be identical to current date.
9639
9640 !! test
9641 Magic Word: {{CURRENTDAY}}
9642 !! wikitext
9643 {{CURRENTDAY}}
9644 !! html
9645 <p>1
9646 </p>
9647 !! end
9648
9649 !! test
9650 Magic Word: {{CURRENTDAY2}}
9651 !! wikitext
9652 {{CURRENTDAY2}}
9653 !! html
9654 <p>01
9655 </p>
9656 !! end
9657
9658 !! test
9659 Magic Word: {{CURRENTDAYNAME}}
9660 !! wikitext
9661 {{CURRENTDAYNAME}}
9662 !! html
9663 <p>Thursday
9664 </p>
9665 !! end
9666
9667 !! test
9668 Magic Word: {{CURRENTDOW}}
9669 !! wikitext
9670 {{CURRENTDOW}}
9671 !! html
9672 <p>4
9673 </p>
9674 !! end
9675
9676 !! test
9677 Magic Word: {{CURRENTMONTH}}
9678 !! wikitext
9679 {{CURRENTMONTH}}
9680 !! html
9681 <p>01
9682 </p>
9683 !! end
9684
9685 !! test
9686 Magic Word: {{CURRENTMONTH1}}
9687 !! wikitext
9688 {{CURRENTMONTH1}}
9689 !! html
9690 <p>1
9691 </p>
9692 !! end
9693
9694 !! test
9695 Magic Word: {{CURRENTMONTHABBREV}}
9696 !! wikitext
9697 {{CURRENTMONTHABBREV}}
9698 !! html
9699 <p>Jan
9700 </p>
9701 !! end
9702
9703 !! test
9704 Magic Word: {{CURRENTMONTHNAME}}
9705 !! wikitext
9706 {{CURRENTMONTHNAME}}
9707 !! html
9708 <p>January
9709 </p>
9710 !! end
9711
9712 !! test
9713 Magic Word: {{CURRENTMONTHNAMEGEN}}
9714 !! wikitext
9715 {{CURRENTMONTHNAMEGEN}}
9716 !! html
9717 <p>January
9718 </p>
9719 !! end
9720
9721 !! test
9722 Magic Word: {{CURRENTTIME}}
9723 !! wikitext
9724 {{CURRENTTIME}}
9725 !! html
9726 <p>00:02
9727 </p>
9728 !! end
9729
9730 !! test
9731 Magic Word: {{CURRENTHOUR}}
9732 !! wikitext
9733 {{CURRENTHOUR}}
9734 !! html
9735 <p>00
9736 </p>
9737 !! end
9738
9739 !! test
9740 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9741 !! wikitext
9742 {{CURRENTWEEK}}
9743 !! html
9744 <p>1
9745 </p>
9746 !! end
9747
9748 !! test
9749 Magic Word: {{CURRENTYEAR}}
9750 !! wikitext
9751 {{CURRENTYEAR}}
9752 !! html
9753 <p>1970
9754 </p>
9755 !! end
9756
9757 !! test
9758 Magic Word: {{CURRENTTIMESTAMP}}
9759 !! wikitext
9760 {{CURRENTTIMESTAMP}}
9761 !! html
9762 <p>19700101000203
9763 </p>
9764 !! end
9765
9766 !! test
9767 Magic Words LOCAL (UTC)
9768 !! wikitext
9769 * {{LOCALMONTH}}
9770 * {{LOCALMONTH1}}
9771 * {{LOCALMONTHNAME}}
9772 * {{LOCALMONTHNAMEGEN}}
9773 * {{LOCALMONTHABBREV}}
9774 * {{LOCALDAY}}
9775 * {{LOCALDAY2}}
9776 * {{LOCALDAYNAME}}
9777 * {{LOCALYEAR}}
9778 * {{LOCALTIME}}
9779 * {{LOCALHOUR}}
9780 * {{LOCALWEEK}}
9781 * {{LOCALDOW}}
9782 * {{LOCALTIMESTAMP}}
9783 !! html
9784 <ul><li> 01</li>
9785 <li> 1</li>
9786 <li> January</li>
9787 <li> January</li>
9788 <li> Jan</li>
9789 <li> 1</li>
9790 <li> 01</li>
9791 <li> Thursday</li>
9792 <li> 1970</li>
9793 <li> 00:02</li>
9794 <li> 00</li>
9795 <li> 1</li>
9796 <li> 4</li>
9797 <li> 19700101000203</li></ul>
9798
9799 !! end
9800
9801 !! test
9802 Magic Word: {{FULLPAGENAME}}
9803 !! options
9804 title=[[User:Ævar Arnfjörð Bjarmason]]
9805 !! wikitext
9806 {{FULLPAGENAME}}
9807 !! html
9808 <p>User:Ævar Arnfjörð Bjarmason
9809 </p>
9810 !! end
9811
9812 !! test
9813 Magic Word: {{FULLPAGENAMEE}}
9814 !! options
9815 title=[[User:Ævar Arnfjörð Bjarmason]]
9816 !! wikitext
9817 {{FULLPAGENAMEE}}
9818 !! html
9819 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9820 </p>
9821 !! end
9822
9823 !! test
9824 Magic Word: {{TALKSPACE}}
9825 !! options
9826 title=[[User:Ævar Arnfjörð Bjarmason]]
9827 !! wikitext
9828 {{TALKSPACE}}
9829 !! html
9830 <p>User talk
9831 </p>
9832 !! end
9833
9834 !! test
9835 Magic Word: {{TALKSPACE}}, same namespace
9836 !! options
9837 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9838 !! wikitext
9839 {{TALKSPACE}}
9840 !! html
9841 <p>User talk
9842 </p>
9843 !! end
9844
9845 !! test
9846 Magic Word: {{TALKSPACE}}, main namespace
9847 !! options
9848 title=[[Parser Test]]
9849 !! wikitext
9850 {{TALKSPACE}}
9851 !! html
9852 <p>Talk
9853 </p>
9854 !! end
9855
9856 !! test
9857 Magic Word: {{TALKSPACEE}}
9858 !! options
9859 title=[[User:Ævar Arnfjörð Bjarmason]]
9860 !! wikitext
9861 {{TALKSPACEE}}
9862 !! html
9863 <p>User_talk
9864 </p>
9865 !! end
9866
9867 !! test
9868 Magic Word: {{SUBJECTSPACE}}
9869 !! options
9870 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9871 !! wikitext
9872 {{SUBJECTSPACE}}
9873 !! html
9874 <p>User
9875 </p>
9876 !! end
9877
9878 !! test
9879 Magic Word: {{SUBJECTSPACE}}, same namespace
9880 !! options
9881 title=[[User:Ævar Arnfjörð Bjarmason]]
9882 !! wikitext
9883 {{SUBJECTSPACE}}
9884 !! html
9885 <p>User
9886 </p>
9887 !! end
9888
9889 !! test
9890 Magic Word: {{SUBJECTSPACE}}, main namespace
9891 !! options
9892 title=[[Parser Test]]
9893 !! wikitext
9894 {{SUBJECTSPACE}}
9895 !! html
9896
9897 !! end
9898
9899 !! test
9900 Magic Word: {{SUBJECTSPACEE}}
9901 !! options
9902 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9903 !! wikitext
9904 {{SUBJECTSPACEE}}
9905 !! html
9906 <p>User
9907 </p>
9908 !! end
9909
9910 !! test
9911 Magic Word: {{NAMESPACE}}
9912 !! options
9913 title=[[User:Ævar Arnfjörð Bjarmason]]
9914 !! wikitext
9915 {{NAMESPACE}}
9916 !! html
9917 <p>User
9918 </p>
9919 !! end
9920
9921 !! test
9922 Magic Word: {{NAMESPACEE}}
9923 !! options
9924 title=[[User:Ævar Arnfjörð Bjarmason]]
9925 !! wikitext
9926 {{NAMESPACEE}}
9927 !! html
9928 <p>User
9929 </p>
9930 !! end
9931
9932 !! test
9933 Magic Word: {{NAMESPACENUMBER}}
9934 !! options
9935 title=[[User:Ævar Arnfjörð Bjarmason]]
9936 !! wikitext
9937 {{NAMESPACENUMBER}}
9938 !! html
9939 <p>2
9940 </p>
9941 !! end
9942
9943 !! test
9944 Magic Word: {{SUBPAGENAME}}
9945 !! options
9946 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9947 !! wikitext
9948 {{SUBPAGENAME}}
9949 !! html
9950 <p>sub ö
9951 </p>
9952 !! end
9953
9954 !! test
9955 Magic Word: {{SUBPAGENAMEE}}
9956 !! options
9957 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9958 !! wikitext
9959 {{SUBPAGENAMEE}}
9960 !! html
9961 <p>sub_%C3%B6
9962 </p>
9963 !! end
9964
9965 !! test
9966 Magic Word: {{ROOTPAGENAME}}
9967 !! options
9968 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9969 !! wikitext
9970 {{ROOTPAGENAME}}
9971 !! html
9972 <p>Ævar Arnfjörð Bjarmason
9973 </p>
9974 !! end
9975
9976 !! test
9977 Magic Word: {{ROOTPAGENAMEE}}
9978 !! options
9979 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9980 !! wikitext
9981 {{ROOTPAGENAMEE}}
9982 !! html
9983 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9984 </p>
9985 !! end
9986
9987 !! test
9988 Magic Word: {{BASEPAGENAME}}
9989 !! options
9990 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9991 !! wikitext
9992 {{BASEPAGENAME}}
9993 !! html
9994 <p>Ævar Arnfjörð Bjarmason
9995 </p>
9996 !! end
9997
9998 !! test
9999 Magic Word: {{BASEPAGENAMEE}}
10000 !! options
10001 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10002 !! wikitext
10003 {{BASEPAGENAMEE}}
10004 !! html
10005 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10006 </p>
10007 !! end
10008
10009 !! test
10010 Magic Word: {{TALKPAGENAME}}
10011 !! options
10012 title=[[User:Ævar Arnfjörð Bjarmason]]
10013 !! wikitext
10014 {{TALKPAGENAME}}
10015 !! html
10016 <p>User talk:Ævar Arnfjörð Bjarmason
10017 </p>
10018 !! end
10019
10020 !! test
10021 Magic Word: {{TALKPAGENAMEE}}
10022 !! options
10023 title=[[User:Ævar Arnfjörð Bjarmason]]
10024 !! wikitext
10025 {{TALKPAGENAMEE}}
10026 !! html
10027 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10028 </p>
10029 !! end
10030
10031 !! test
10032 Magic Word: {{SUBJECTPAGENAME}}
10033 !! options
10034 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10035 !! wikitext
10036 {{SUBJECTPAGENAME}}
10037 !! html
10038 <p>User:Ævar Arnfjörð Bjarmason
10039 </p>
10040 !! end
10041
10042 !! test
10043 Magic Word: {{SUBJECTPAGENAMEE}}
10044 !! options
10045 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10046 !! wikitext
10047 {{SUBJECTPAGENAMEE}}
10048 !! html
10049 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10050 </p>
10051 !! end
10052
10053 !! test
10054 Magic Word: {{NUMBEROFFILES}}
10055 !! wikitext
10056 {{NUMBEROFFILES}}
10057 !! html
10058 <p>7
10059 </p>
10060 !! end
10061
10062 !! test
10063 Magic Word: {{PAGENAME}}
10064 !! options
10065 title=[[User:Ævar Arnfjörð Bjarmason]]
10066 !! wikitext
10067 {{PAGENAME}}
10068 !! html
10069 <p>Ævar Arnfjörð Bjarmason
10070 </p>
10071 !! end
10072
10073 !! test
10074 Magic Word: {{PAGENAME}} with metacharacters
10075 !! options
10076 title=[['foo & bar = baz']]
10077 !! wikitext
10078 ''{{PAGENAME}}''
10079 !! html/php
10080 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10081 </p>
10082 !! html+tidy
10083 <p><i>'foo &amp; bar = baz'</i></p>
10084 !! end
10085
10086 !! test
10087 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
10088 !! options
10089 title=[[*RFC 1234 http://example.com/]]
10090 !! wikitext
10091 {{PAGENAME}}
10092 !! html/php
10093 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10094 </p>
10095 !! html+tidy
10096 <p>*RFC 1234 http://example.com/</p>
10097 !! end
10098
10099 !! test
10100 Magic Word: {{PAGENAMEE}}
10101 !! options
10102 title=[[User:Ævar Arnfjörð Bjarmason]]
10103 !! wikitext
10104 {{PAGENAMEE}}
10105 !! html
10106 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10107 </p>
10108 !! end
10109
10110 !! test
10111 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
10112 !! options
10113 title=[[*RFC 1234 http://example.com/]]
10114 !! wikitext
10115 {{PAGENAMEE}}
10116 !! html/php
10117 <p>&#42;RFC_1234_http&#58;//example.com/
10118 </p>
10119 !! html+tidy
10120 <p>*RFC_1234_http://example.com/</p>
10121 !! end
10122
10123 !! test
10124 Magic Word: {{REVISIONID}}
10125 !! wikitext
10126 {{REVISIONID}}
10127 !! html
10128 <p>1337
10129 </p>
10130 !! end
10131
10132 !! test
10133 Magic Word: {{SCRIPTPATH}}
10134 !! wikitext
10135 {{SCRIPTPATH}}
10136 !! html
10137
10138 !! end
10139
10140 !! test
10141 Magic Word: {{STYLEPATH}}
10142 !! wikitext
10143 {{STYLEPATH}}
10144 !! html
10145 <p>/skins
10146 </p>
10147 !! end
10148
10149 !! test
10150 Magic Word: {{SERVER}}
10151 !! wikitext
10152 {{SERVER}}
10153 !! html
10154 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10155 </p>
10156 !! end
10157
10158 !! test
10159 Magic Word: {{SERVERNAME}}
10160 !! wikitext
10161 {{SERVERNAME}}
10162 !! html
10163 <p>example.org
10164 </p>
10165 !! end
10166
10167 !! test
10168 Magic Word: {{SITENAME}}
10169 !! wikitext
10170 {{SITENAME}}
10171 !! html
10172 <p>MediaWiki
10173 </p>
10174 !! end
10175
10176 !! test
10177 Case-sensitive magic words, when cased differently, should just be template transclusions
10178 !! wikitext
10179 {{CurrentMonth}}
10180 {{currentday}}
10181 {{cURreNTweEK}}
10182 {{currentHour}}
10183 !! html
10184 <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>
10185 <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>
10186 <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>
10187 <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>
10188 </p>
10189 !! end
10190
10191 !! test
10192 Case-insensitive magic words should still work with weird casing.
10193 !! wikitext
10194 {{sErVeRNaMe}}
10195 {{LCFirst:AOEU}}
10196 {{ucFIRST:aoeu}}
10197 {{SERver}}
10198 !! html
10199 <p>example.org
10200 aOEU
10201 Aoeu
10202 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10203 </p>
10204 !! end
10205
10206 # From plwiki:PLOS_ONE
10207 !! test
10208 Parsoid: Page property magic word with magic word contents
10209 !! wikitext
10210 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10211 !! html/parsoid
10212 <meta property="mw:PageProp/displaytitle" content="Main Page" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"src":"{{DISPLAYTITLE:&#39;&#39;{{PAGENAME}}&#39;&#39;}}"}' data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;i data-parsoid=&#39;{\"dsr\":[15,31,2,2]}&#39;>&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[17,29,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"PAGENAME\",\"function\":\"pagename\"},\"params\":{},\"i\":0}}]}&#39;>Main Page&lt;/span>&lt;/i>"}]]}'/>
10213 !! end
10214
10215 !! test
10216 Parsoid: Template-generated DISPLAYTITLE
10217 !! wikitext
10218 {{{{echo|DISPLAYTITLE}}:Foo}}
10219 !! html/parsoid
10220 <meta property="mw:PageProp/displaytitle" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DISPLAYTITLE}}:Foo"},"params":{},"i":0}}]}'/>
10221 !! end
10222
10223 !! test
10224 Namespace 1 {{ns:1}}
10225 !! wikitext
10226 {{ns:1}}
10227 !! html
10228 <p>Talk
10229 </p>
10230 !! end
10231
10232 !! test
10233 Namespace 1 {{ns:01}}
10234 !! wikitext
10235 {{ns:01}}
10236 !! html
10237 <p>Talk
10238 </p>
10239 !! end
10240
10241 !! test
10242 Namespace 0 {{ns:0}} (bug 4783)
10243 !! wikitext
10244 {{ns:0}}
10245 !! html
10246
10247 !! end
10248
10249 !! test
10250 Namespace 0 {{ns:00}} (bug 4783)
10251 !! wikitext
10252 {{ns:00}}
10253 !! html
10254
10255 !! end
10256
10257 !! test
10258 Namespace -1 {{ns:-1}}
10259 !! wikitext
10260 {{ns:-1}}
10261 !! html
10262 <p>Special
10263 </p>
10264 !! end
10265
10266 !! test
10267 Namespace User {{ns:User}}
10268 !! wikitext
10269 {{ns:User}}
10270 !! html
10271 <p>User
10272 </p>
10273 !! end
10274
10275 !! test
10276 Namespace User talk {{ns:User_talk}}
10277 !! wikitext
10278 {{ns:User_talk}}
10279 !! html
10280 <p>User talk
10281 </p>
10282 !! end
10283
10284 !! test
10285 Namespace User talk {{ns:uSeR tAlK}}
10286 !! wikitext
10287 {{ns:uSeR tAlK}}
10288 !! html
10289 <p>User talk
10290 </p>
10291 !! end
10292
10293 !! test
10294 Namespace File {{ns:File}}
10295 !! wikitext
10296 {{ns:File}}
10297 !! html
10298 <p>File
10299 </p>
10300 !! end
10301
10302 !! test
10303 Namespace File {{ns:Image}}
10304 !! wikitext
10305 {{ns:Image}}
10306 !! html
10307 <p>File
10308 </p>
10309 !! end
10310
10311 !! test
10312 Namespace (lang=de) Benutzer {{ns:User}}
10313 !! options
10314 language=de
10315 !! wikitext
10316 {{ns:User}}
10317 !! html
10318 <p>Benutzer
10319 </p>
10320 !! end
10321
10322 !! test
10323 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10324 !! options
10325 language=de
10326 !! wikitext
10327 {{ns:3}}
10328 !! html
10329 <p>Benutzer Diskussion
10330 </p>
10331 !! end
10332
10333
10334 !! test
10335 Urlencode
10336 !! wikitext
10337 {{urlencode:hi world?!}}
10338 {{urlencode:hi world?!|WIKI}}
10339 {{urlencode:hi world?!|PATH}}
10340 {{urlencode:hi world?!|QUERY}}
10341 !! html
10342 <p>hi+world%3F%21
10343 hi_world%3F!
10344 hi%20world%3F%21
10345 hi+world%3F%21
10346 </p>
10347 !! end
10348
10349 !! test
10350 Magic Word: prioritize type info over data-parsoid
10351 !! options
10352 parsoid=html2wt
10353 !! html/parsoid
10354 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10355 !! wikitext
10356 __FORCETOC__
10357 !! end
10358
10359 !! test
10360 Magic Word: serialize on separate line (parsoid)
10361 !! options
10362 parsoid=wt2wt,html2wt
10363 !! wikitext
10364 foo
10365 __NOTOC__
10366 bar
10367 !! html/parsoid
10368 foo<meta property="mw:PageProp/notoc"/>bar
10369 !! end
10370
10371 !! test
10372 Magic Word: rt non-english wikis
10373 !! options
10374 parsoid=wt2wt
10375 language=de
10376 !! wikitext
10377 __NOEDITSECTION__
10378 !! html/parsoid
10379 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10380 !! end
10381
10382 !!test
10383 __proto__ is treated as normal wikitext (T105997)
10384 !!wikitext
10385 __proto__
10386 !!html
10387 <p>__proto__
10388 </p>
10389 !!end
10390
10391 ###
10392 ### Magic links
10393 ###
10394 !! test
10395 Magic links: internal link to RFC (bug 479)
10396 !! wikitext
10397 [[RFC 123]]
10398 !! html/php
10399 <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>
10400 </p>
10401 !! html/parsoid
10402 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10403 !! end
10404
10405 !! test
10406 Magic links: RFC (bug 479)
10407 !! wikitext
10408 RFC 822
10409 !! html/php
10410 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10411 </p>
10412 !! html/parsoid
10413 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10414 !! end
10415
10416 !! test
10417 Magic links: RFC (bug 65278)
10418 !! wikitext
10419 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10420 !! html/php
10421 <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.
10422 </p>
10423 !! html/parsoid
10424 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10425 !! end
10426
10427 !! test
10428 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
10429 !! wikitext
10430 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10431 RFC
10432 822
10433 !! html/php
10434 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10435 RFC
10436 822
10437 </p>
10438 !! html/parsoid
10439 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 822</a>
10440 RFC
10441 822</p>
10442 !! end
10443
10444 !! test
10445 Magic links: ISBN (bug 1937)
10446 !! wikitext
10447 ISBN 0-306-40615-2
10448 !! html/php
10449 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10450 </p>
10451 !! html/parsoid
10452 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10453 !! end
10454
10455 !! test
10456 Magic links: ISBN (bug 65278)
10457 !! wikitext
10458 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10459 !! html/php
10460 <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.
10461 </p>
10462 !! html/parsoid
10463 <p>This is <a href="./Special:BookSources/9780316098113" rel="mw:WikiLink">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.</p>
10464 !! end
10465
10466 !! test
10467 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10468 !! wikitext
10469 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10470 ISBN
10471 9780316098113
10472 ISBN 978
10473 0316098113
10474 !! html/php
10475 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10476 ISBN
10477 9780316098113
10478 ISBN 978
10479 0316098113
10480 </p>
10481 !! html/parsoid
10482 <p><a href="./Special:BookSources/9780316098113" rel="mw:WikiLink">ISBN <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 978<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>0<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>316<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span>09811<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>3</a>
10483 ISBN
10484 9780316098113
10485 ISBN 978
10486 0316098113</p>
10487 !! end
10488
10489 !! test
10490 Magic links: PMID incorrectly converts space to underscore
10491 !! wikitext
10492 PMID 1234
10493 !! html/php
10494 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10495 </p>
10496 !! html/parsoid
10497 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10498 !! end
10499
10500 !! test
10501 Magic links: PMID (bug 65278)
10502 !! wikitext
10503 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10504 !! html/php
10505 <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.
10506 </p>
10507 !! html/parsoid
10508 <p>This is <a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.</p>
10509 !! end
10510
10511 !! test
10512 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10513 !! wikitext
10514 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10515 PMID
10516 1234
10517 !! html/php
10518 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10519 PMID
10520 1234
10521 </p>
10522 !! html/parsoid
10523 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 1234</a>
10524 PMID
10525 1234</p>
10526 !! end
10527
10528 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10529 # since these are ExtLinkText, not MagicLinkText
10530 !! test
10531 Magic links: use appropriate serialization for "almost" magic links.
10532 !! wikitext
10533 X[[Special:BookSources/0978739256|foo]]
10534
10535 X[//tools.ietf.org/html/rfc1234 foo]
10536 !! html/php
10537 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10538 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10539 </p>
10540 !! html/parsoid
10541 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10542 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10543 !! end
10544
10545 !! test
10546 Magic links: All disabled (T47942)
10547 !! options
10548 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
10549 !! wikitext
10550 ISBN 0-306-40615-2
10551 PMID 1234
10552 RFC 4321
10553 !! html/php
10554 <p>ISBN 0-306-40615-2
10555 PMID 1234
10556 RFC 4321
10557 </p>
10558 !! end
10559
10560 ###
10561 ### Templates
10562 ####
10563
10564 !! test
10565 Nonexistent template
10566 !! wikitext
10567 {{thistemplatedoesnotexist}}
10568 !! html
10569 <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>
10570 </p>
10571 !! end
10572
10573 !! test
10574 Template with invalid target containing tags
10575 !! wikitext
10576 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10577 !! html
10578 <p>{{a<b>b</b>|foo|a=b|a = b}}
10579 </p>
10580 !! end
10581
10582 !! test
10583 Template with invalid target containing unclosed tag
10584 !! wikitext
10585 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10586 !! html
10587 <p>{{a<b>|foo|a=b|a = b}}</b>
10588 </p>
10589 !! end
10590
10591 !! test
10592 Template with invalid target containing wikilink
10593 !! wikitext
10594 {{[[Main Page]]}}
10595 !! html/php
10596 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10597 </p>
10598 !! html/parsoid
10599 <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>
10600 !! end
10601
10602 !! test
10603 Template with just whitespace in it, bug #68421
10604 !! wikitext
10605 {{echo|{{ }}}}
10606 !! html/parsoid
10607 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{ }}"}},"i":0}}]}'>{{ }}</p>
10608 !! end
10609
10610 !! article
10611 Template:test
10612 !! text
10613 This is a test template
10614 !! endarticle
10615
10616 !! test
10617 Simple template
10618 !! wikitext
10619 {{test}}
10620 !! html
10621 <p>This is a test template
10622 </p>
10623 !! end
10624
10625 !! test
10626 Template with explicit namespace
10627 !! wikitext
10628 {{Template:test}}
10629 !! html
10630 <p>This is a test template
10631 </p>
10632 !! end
10633
10634
10635 !! article
10636 Template:paramtest
10637 !! text
10638 This is a test template with parameter {{{param}}}
10639 !! endarticle
10640
10641 !! test
10642 Template parameter
10643 !! wikitext
10644 {{paramtest|param=foo}}
10645 !! html
10646 <p>This is a test template with parameter foo
10647 </p>
10648 !! end
10649
10650 !! article
10651 Template:paramtestnum
10652 !! text
10653 [[{{{1}}}|{{{2}}}]]
10654 !! endarticle
10655
10656 !! test
10657 Template unnamed parameter
10658 !! wikitext
10659 {{paramtestnum|Main Page|the main page}}
10660 !! html
10661 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10662 </p>
10663 !! end
10664
10665 !! article
10666 Template:templatesimple
10667 !! text
10668 (test)
10669 !! endarticle
10670
10671 !! article
10672 Template:templateredirect
10673 !! text
10674 #redirect [[Template:templatesimple]]
10675 !! endarticle
10676
10677 !! article
10678 Template:templateasargtestnum
10679 !! text
10680 {{{{{1}}}}}
10681 !! endarticle
10682
10683 !! article
10684 Template:templateasargtest
10685 !! text
10686 {{template{{{templ}}}}}
10687 !! endarticle
10688
10689 !! article
10690 Template:templateasargtest2
10691 !! text
10692 {{{{{templ}}}}}
10693 !! endarticle
10694
10695 !! test
10696 Template with template name as unnamed argument
10697 !! wikitext
10698 {{templateasargtestnum|templatesimple}}
10699 !! html
10700 <p>(test)
10701 </p>
10702 !! end
10703
10704 !! test
10705 Template with template name as argument
10706 !! wikitext
10707 {{templateasargtest|templ=simple}}
10708 !! html
10709 <p>(test)
10710 </p>
10711 !! end
10712
10713 !! test
10714 Template with template name as argument (2)
10715 !! wikitext
10716 {{templateasargtest2|templ=templatesimple}}
10717 !! html
10718 <p>(test)
10719 </p>
10720 !! end
10721
10722 !! article
10723 Template:templateasargtestdefault
10724 !! text
10725 {{{{{templ|templatesimple}}}}}
10726 !! endarticle
10727
10728 !! article
10729 Template:templa
10730 !! text
10731 '''templ'''
10732 !! endarticle
10733
10734 !! test
10735 Template with default value
10736 !! wikitext
10737 {{templateasargtestdefault}}
10738 !! html
10739 <p>(test)
10740 </p>
10741 !! end
10742
10743 !! test
10744 Template with default value (value set)
10745 !! wikitext
10746 {{templateasargtestdefault|templ=templa}}
10747 !! html
10748 <p><b>templ</b>
10749 </p>
10750 !! end
10751
10752 !! test
10753 Template redirect
10754 !! wikitext
10755 {{templateredirect}}
10756 !! html/php
10757 <p>(test)
10758 </p>
10759 !! html/parsoid
10760 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10761 !! end
10762
10763 !! test
10764 Template with argument in separate line
10765 !! wikitext
10766 {{ templateasargtest |
10767 templ = simple }}
10768 !! html
10769 <p>(test)
10770 </p>
10771 !! end
10772
10773 !! test
10774 Template with complex template as argument
10775 !! wikitext
10776 {{paramtest|
10777 param ={{ templateasargtest |
10778 templ = simple }}}}
10779 !! html
10780 <p>This is a test template with parameter (test)
10781 </p>
10782 !! end
10783
10784 !! test
10785 Template with thumb image (with link in description)
10786 !! wikitext
10787 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10788 !! html/php
10789 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>
10790
10791 !! html+tidy
10792 <p>This is a test template with parameter</p>
10793 <div class="thumb tright">
10794 <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>
10795 <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>
10796 </div>
10797 </div>
10798 !! html/parsoid
10799 <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>
10800 !! end
10801
10802 !! article
10803 Template:complextemplate
10804 !! text
10805 {{{1}}} {{paramtest|
10806 param ={{{param}}}}}
10807 !! endarticle
10808
10809 !! test
10810 Template with complex arguments
10811 !! wikitext
10812 {{complextemplate|
10813 param ={{ templateasargtest |
10814 templ = simple }}|[[Template:complextemplate|link]]}}
10815 !! html
10816 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10817 </p>
10818 !! end
10819
10820 !! test
10821 BUG 553: link with two variables in a piped link
10822 !! wikitext
10823 {|
10824 |[[{{{1}}}|{{{2}}}]]
10825 |}
10826 !! html/php
10827 <table>
10828 <tr>
10829 <td>[[{{{1}}}|{{{2}}}]]
10830 </td></tr></table>
10831
10832 !! html/parsoid
10833 <table>
10834 <tbody><tr><td>[[<span about="#mwt5" typeof="mw:Param" data-parsoid='{"src":"{{{1}}}"}'>{{{1}}}</span>|<span about="#mwt2" typeof="mw:Param" data-parsoid='{"src":"{{{2}}}"}'>{{{2}}}</span>]]</td></tr>
10835 !! end
10836
10837 # See: T2553
10838 !! test
10839 Abort table cell attribute parsing on wikilink
10840 !! wikitext
10841 {|
10842 | testing [[one|two]] | three || four
10843 | testing one two | three || four
10844 | testing="[[one|two]]" | three || four
10845 |}
10846 !! html/php
10847 <table>
10848 <tr>
10849 <td> testing <a href="/index.php?title=One&amp;action=edit&amp;redlink=1" class="new" title="One (page does not exist)">two</a> | three </td>
10850 <td> four
10851 </td>
10852 <td> three </td>
10853 <td> four
10854 </td>
10855 <td> testing="<a href="/index.php?title=One&amp;action=edit&amp;redlink=1" class="new" title="One (page does not exist)">two</a>" | three </td>
10856 <td> four
10857 </td></tr></table>
10858
10859 !! html/parsoid
10860 <table>
10861 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> testing <a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"piped","a":{"href":"./One"},"sa":{"href":"one"}}'>two</a> | three </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> four</td>
10862 <td data-parsoid='{"a":{"testing":null,"one":null,"two":null},"sa":{"testing":"","one":"","two":""},"autoInsertedEnd":true}'> three </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> four</td>
10863 <td> testing="<a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"piped","a":{"href":"./One"},"sa":{"href":"one"}}'>two</a>" | three </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'> four</td></tr>
10864 </tbody></table>
10865 !! end
10866
10867 !! test
10868 Don't abort table cell attribute parsing if wikilink is found in template arg
10869 !! wikitext
10870 {|
10871 | Test {{#tag:ref|One two "[[three]]" four}}
10872 |}
10873 !! html/parsoid
10874 <table>
10875 <tbody><tr><td> Test <ref about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:ref","function":"#tag"},"params":{"1":{"wt":"One two \"[[three]]\" four"}},"i":0}}]}'>One two "<a rel="mw:WikiLink" href="./Three" title="Three">three</a>" four</ref></td></tr>
10876 </tbody></table>
10877 !! end
10878
10879 !! test
10880 Magic variable as template parameter
10881 !! wikitext
10882 {{paramtest|param={{SITENAME}}}}
10883 !! html
10884 <p>This is a test template with parameter MediaWiki
10885 </p>
10886 !! end
10887
10888 !! article
10889 Template:linktest
10890 !! text
10891 [[{{{param}}}|link]]
10892 !! endarticle
10893
10894 !! test
10895 Template parameter as link source
10896 !! wikitext
10897 {{linktest|param=Main Page}}
10898 !! html
10899 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10900 </p>
10901 !! end
10902
10903 !!article
10904 Template:paramtest2
10905 !! text
10906 including another template, {{paramtest|param={{{arg}}}}}
10907 !! endarticle
10908
10909 !! test
10910 Template passing argument to another template
10911 !! wikitext
10912 {{paramtest2|arg='hmm'}}
10913 !! html
10914 <p>including another template, This is a test template with parameter 'hmm'
10915 </p>
10916 !! end
10917
10918 !! article
10919 Template:Linktest2
10920 !! text
10921 Main Page
10922 !! endarticle
10923
10924 !! test
10925 Template as link source
10926 !! wikitext
10927 [[{{linktest2}}]]
10928
10929 [[{{linktest2}}|Main Page]]
10930
10931 [[{{linktest2}}]]Page
10932 !! html
10933 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10934 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10935 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10936 </p>
10937 !! end
10938
10939
10940 !! article
10941 Template:loop1
10942 !! text
10943 {{loop2}}
10944 !! endarticle
10945
10946 !! article
10947 Template:loop2
10948 !! text
10949 {{loop1}}
10950 !! endarticle
10951
10952 !! test
10953 Template infinite loop
10954 !! wikitext
10955 {{loop1}}
10956 !! html
10957 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10958 </p>
10959 !! end
10960
10961 !! test
10962 Template from main namespace
10963 !! wikitext
10964 {{:Main Page}}
10965 !! html
10966 <p>blah blah
10967 </p>
10968 !! end
10969
10970 !! article
10971 Template:table
10972 !! text
10973 {|
10974 | 1 || 2
10975 |-
10976 | 3 || 4
10977 |}
10978 !! endarticle
10979
10980 !! test
10981 BUG 529: Template with table, not included at beginning of line
10982 !! wikitext
10983 foo {{table}}
10984 !! html
10985 <p>foo
10986 </p>
10987 <table>
10988 <tr>
10989 <td> 1 </td>
10990 <td> 2
10991 </td></tr>
10992 <tr>
10993 <td> 3 </td>
10994 <td> 4
10995 </td></tr></table>
10996
10997 !! end
10998
10999 !! test
11000 BUG 523: Template shouldn't eat newline (or add an extra one before table)
11001 !! wikitext
11002 foo
11003 {{table}}
11004 !! html
11005 <p>foo
11006 </p>
11007 <table>
11008 <tr>
11009 <td> 1 </td>
11010 <td> 2
11011 </td></tr>
11012 <tr>
11013 <td> 3 </td>
11014 <td> 4
11015 </td></tr></table>
11016
11017 !! end
11018
11019 !! test
11020 BUG 41: Template parameters shown as broken links
11021 !! wikitext
11022 {{{parameter}}}
11023 !! html
11024 <p>{{{parameter}}}
11025 </p>
11026 !! end
11027
11028 !! test
11029 Template with targets containing wikilinks
11030 !! wikitext
11031 {{[[foo]]}}
11032
11033 {{[[{{echo|foo}}]]}}
11034
11035 {{{{echo|[[foo}}]]}}
11036 !! html
11037 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11038 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11039 </p><p>{{[[foo}}]]
11040 </p>
11041 !! end
11042
11043 !! article
11044 Template:''
11045 !! text
11046 bar
11047 !! endarticle
11048
11049 !! test
11050 Templates: Double quotes as template target
11051 !! wikitext
11052 foo {{''}} baz
11053 !! html/php
11054 <p>foo bar baz
11055 </p>
11056 !! html/parsoid
11057 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;","href":"./Template:&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
11058 </p>
11059 !! end
11060
11061 ## This test is about making sure Parsoid's data-mw is well formed in the
11062 ## face of multiple templates with intersecting and overlapping ranges. The
11063 ## wikitext itself is wretched.
11064 !! test
11065 Templates with intersecting and overlapping ranges
11066 !! wikitext
11067 {|{{echo|
11068 <p>ha</p>}}
11069 {|{{echo|
11070 <p>ho</p>}}
11071 {{echo|{{!}}hi}}
11072 |}
11073 !! html/php+tidy
11074 <p>ha</p>
11075 <p>ho</p>
11076 <table>
11077 <tr>
11078 <td></td>
11079 </tr>
11080 <tr>
11081 <td>hi</td>
11082 </tr>
11083 </table>
11084 <table>
11085 <tr>
11086 <td></td>
11087 </tr>
11088 </table>
11089 !! html/parsoid
11090 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]],"firstWikitextNode":"table"}' data-mw='{"parts":["{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n&lt;p>ha&lt;/p>"}},"i":0}},"\n","{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n&lt;p>ho&lt;/p>"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}}hi"}},"i":2}},"\n|}"]}'>ha</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11091
11092 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11093
11094 <tbody><tr><td>hi</td></tr>
11095 </tbody></table>
11096 !! end
11097
11098 !! article
11099 Template:MSGNW test
11100 !! text
11101 ''None'' of '''this''' should be
11102 * interpreted
11103 but rather passed unmodified
11104 {{test}}
11105 <gallery>
11106 File:Foobar.jpg
11107 </gallery>
11108 <!-- comment -->
11109 !! endarticle
11110
11111 # hmm, fix this or just deprecate msgnw and document its behavior?
11112 !! test
11113 msgnw keyword
11114 !! wikitext
11115 {{msgnw:MSGNW test}}
11116 !! html/php
11117 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11118 &#42; interpreted
11119 &#32;but rather passed unmodified
11120 &#123;&#123;test&#125;&#125;
11121 &#60;gallery&#62;
11122 File:Foobar.jpg
11123 &#60;/gallery&#62;
11124 &#60;!-- comment --&#62;
11125 </p>
11126 !! end
11127
11128 !! test
11129 int keyword
11130 !! wikitext
11131 {{int:youhavenewmessages|lots of money|not!}}
11132 !! html
11133 <p>You have lots of money (not!).
11134 </p>
11135 !! end
11136
11137 !! test
11138 int keyword - non-existing message
11139 !! wikitext
11140 {{int:var}}
11141 !! html
11142 <p>⧼var⧽
11143 </p>
11144 !! end
11145
11146 !! article
11147 Template:Includes
11148 !! text
11149 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11150 !! endarticle
11151
11152 !! test
11153 <includeonly> and <noinclude> being included
11154 !! wikitext
11155 {{Includes}}
11156 !! html
11157 <p>Foobar
11158 </p>
11159 !! end
11160
11161 !! article
11162 Template:Includes2
11163 !! text
11164 <onlyinclude>Foo</onlyinclude>bar
11165 !! endarticle
11166
11167 !! test
11168 <onlyinclude> being included
11169 !! wikitext
11170 {{Includes2}}
11171 !! html
11172 <p>Foo
11173 </p>
11174 !! end
11175
11176
11177 !! article
11178 Template:Includes3
11179 !! text
11180 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11181 !! endarticle
11182
11183 !! test
11184 <onlyinclude> and <includeonly> being included
11185 !! wikitext
11186 {{Includes3}}
11187 !! html
11188 <p>Foo
11189 </p>
11190 !! end
11191
11192 !! test
11193 <includeonly> and <noinclude> on a page
11194 !! wikitext
11195 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11196 !! html
11197 <p>Foozar
11198 </p>
11199 !! end
11200
11201 !! test
11202 Un-closed <noinclude>
11203 !! wikitext
11204 <noinclude>
11205 !! html
11206 !! end
11207
11208 !! test
11209 <onlyinclude> on a page
11210 !! wikitext
11211 <onlyinclude>Foo</onlyinclude>bar
11212 !! html
11213 <p>Foobar
11214 </p>
11215 !! end
11216
11217 !! test
11218 Un-closed <onlyinclude>
11219 !! wikitext
11220 <onlyinclude>
11221 !! html
11222 !! end
11223
11224 !!test
11225 Self-closed noinclude, includeonly, onlyinclude tags
11226 !! wikitext
11227 <noinclude />
11228 <includeonly />
11229 <onlyinclude />
11230 !! html
11231 <p><br />
11232 </p>
11233 !!end
11234
11235 !!test
11236 Unbalanced includeonly and noinclude tags
11237 !! wikitext
11238 {|
11239 |a</noinclude>
11240 |b</noinclude></noinclude>
11241 |c</noinclude></includeonly>
11242 |d</includeonly></includeonly>
11243 |}
11244 !! html
11245 <table>
11246 <tr>
11247 <td>a
11248 </td>
11249 <td>b
11250 </td>
11251 <td>c&lt;/includeonly&gt;
11252 </td>
11253 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11254 </td></tr></table>
11255
11256 !!end
11257
11258 !! article
11259 Template:Includeonly section
11260 !! text
11261 <includeonly>
11262 ==Includeonly section==
11263 </includeonly>
11264 ==Section T-1==
11265 !!endarticle
11266
11267 !! test
11268 Bug 6563: Edit link generation for section shown by <includeonly>
11269 !! wikitext
11270 {{includeonly section}}
11271 !! html
11272 <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>
11273 <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>
11274
11275 !! end
11276
11277 # Uses same input as the contents of [[Template:Includeonly section]]
11278 !! test
11279 Bug 6563: Section extraction for section shown by <includeonly>
11280 !! options
11281 section=T-2
11282 !! wikitext
11283 <includeonly>
11284 ==Includeonly section==
11285 </includeonly>
11286 ==Section T-2==
11287 !! html
11288 ==Section T-2==
11289 !! end
11290
11291 !! test
11292 Bug 6563: Edit link generation for section suppressed by <includeonly>
11293 !! wikitext
11294 <includeonly>
11295 ==Includeonly section==
11296 </includeonly>
11297 ==Section 1==
11298 !! html
11299 <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>
11300
11301 !! end
11302
11303 !! test
11304 Bug 6563: Section extraction for section suppressed by <includeonly>
11305 !! options
11306 section=1
11307 !! wikitext
11308 <includeonly>
11309 ==Includeonly section==
11310 </includeonly>
11311 ==Section 1==
11312 !! html
11313 ==Section 1==
11314 !! end
11315
11316 !! test
11317 Un-closed <includeonly>
11318 !! wikitext
11319 <includeonly>
11320 !! html/php
11321 !! html/parsoid
11322 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11323 !! end
11324
11325 ## We used to, but no longer wt2wt this test since the default serializer
11326 ## will normalize the include directives to serialize on their own line.
11327 ## Selser will take care of preserving formatting in scenarios where they
11328 ## intermingled with other wikitext.
11329 !! test
11330 Includes and comments at SOL
11331 !! options
11332 parsoid=wt2html,html2html
11333 !! wikitext
11334 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11335
11336 <noinclude>
11337 some
11338 </noinclude>* stuff
11339 * here
11340
11341 <includeonly>can have stuff</includeonly>=== here ===
11342
11343 !! html/php
11344 <h2><span class="mw-headline" id="hu">hu</span></h2>
11345 <p>some
11346 </p>
11347 <ul><li> stuff</li>
11348 <li> here</li></ul>
11349 <h3><span class="mw-headline" id="here">here</span></h3>
11350
11351 !! html/parsoid
11352 <!-- 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>
11353
11354 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11355 <p>some</p>
11356 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11357 <li> here</li></ul>
11358
11359 <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>
11360
11361 !! end
11362
11363 # TODO: test with DOM fragment reuse!
11364 !! test
11365 Parsoid: DOM fragment reuse
11366 !! options
11367 parsoid=wt2wt,wt2html
11368 !! wikitext
11369 a{{echo|b<table></table>c}}d
11370
11371 a{{echo|b
11372 <table></table>
11373 c}}d
11374
11375 {{echo|a
11376
11377 <table></table>
11378
11379 b}}
11380 !! html
11381 <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"}]]}'>ab</p><table about="#mwt1" data-parsoid='{"stx":"html"}'></table><p about="#mwt1">cd</p>
11382
11383 <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"}]]}'>ab</p><span about="#mwt2">
11384 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11385 </span><p about="#mwt2">cd</p>
11386
11387 <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"}]]}'>a</p><span about="#mwt3">
11388
11389 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11390
11391 </span><p about="#mwt3">b</p>
11392 !! end
11393
11394 !! test
11395 Parsoid: Merge double tds (T52603)
11396 !! options
11397 parsoid
11398 !! wikitext
11399 {|
11400 |{{echo|{{!}} foo}}
11401 |}
11402 !! html
11403 <table><tbody>
11404 <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>
11405 </tbody></table>
11406 !! end
11407
11408 !! test
11409 Parsoid: Merge double tds in nested transclusion content (T52603)
11410 !! options
11411 parsoid
11412 !! wikitext
11413 {{echo|<div>}}
11414 {|
11415 |{{echo|{{!}} foo}}
11416 |}
11417 {{echo|</div>}}
11418 !! html
11419 <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}}]}'>
11420 <table><tbody>
11421 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11422 </tbody></table>
11423 </div>
11424 !! end
11425
11426 ###
11427 ### <includeonly> and <noinclude> in attributes
11428 ###
11429 !!test
11430 0. includeonly around the entire attribute
11431 !! wikitext
11432 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11433 !! html
11434 <p><span id="v2">bar</span>
11435 </p>
11436 !!end
11437
11438 !!test
11439 1. includeonly in html attr key
11440 !! wikitext
11441 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11442 !! html
11443 <p><span id="foo">bar</span>
11444 </p>
11445 !!end
11446
11447 !!test
11448 2. includeonly in html attr value
11449 !! wikitext
11450 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11451 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11452 !! html
11453 <p><span id="v1">bar</span>
11454 <span id="v1">bar</span>
11455 </p>
11456 !!end
11457
11458 !!test
11459 3. includeonly in part of an attr value
11460 !! wikitext
11461 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11462 !! html
11463 <p><span style="color:red;">bar</span>
11464 </p>
11465 !!end
11466
11467 !!test
11468 4. includeonly in table attributes
11469 !! wikitext
11470 {|
11471 |- <noinclude>
11472 |-
11473 |a
11474 </noinclude>
11475 |- <includeonly>
11476 |-
11477 |b
11478 </includeonly>
11479 |}
11480 !! html
11481 <table>
11482
11483
11484 <tr>
11485 <td>a
11486 </td></tr>
11487 </table>
11488
11489 !!end
11490
11491 ###
11492 ### Token Stream Patcher tests
11493 ###
11494 ### These tests won't always pass wt2wt and other modes because
11495 ### on serialization, the table will be output on a new line.
11496 ### For now, we are blacklisting them, and using this to test selser.
11497 ###
11498
11499 !!test
11500 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11501 !!options
11502 parsoid=wt2html,wt2wt
11503 !!wikitext
11504 {{echo|}}{| width = '100%'
11505 |foo
11506 |}
11507 !!html/parsoid
11508 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11509 <tbody><tr><td>foo</td></tr>
11510 </tbody></table>
11511 !!end
11512
11513 ## We used to, but no longer wt2wt this test since the default serializer
11514 ## will normalize the include directives to serialize on their own line.
11515 ## Selser will take care of preserving formatting in scenarios where they
11516 ## intermingled with other wikitext.
11517 !!test
11518 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11519 !!options
11520 parsoid=wt2html
11521 !!wikitext
11522 <includeonly>a</includeonly>{| {{{b}}}
11523 |c
11524 |}
11525 !!html/parsoid
11526 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>a&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><table about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"a":{"{{{b}}}":null},"sa":{"{{{b}}}":""}}' data-mw='{"attribs":[[{"txt":"{{{b}}}","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=&#39;{\"dsr\":[31,38,null,null],\"src\":\"{{{b}}}\"}&#39;>{{{b}}}&lt;/span>"},{"html":""}]]}'>
11527 <tbody><tr><td>c</td></tr>
11528 </tbody></table>
11529 !!end
11530
11531 !! test
11532 Table wikitext syntax outside wiki-tables
11533 !! wikitext
11534 a
11535 |+ not a caption
11536 ! not a table heading
11537 |- not a table row
11538 | not a table cell
11539 | class="foo bar" | baz
11540 b
11541 |}
11542 |-
11543 c
11544 !! html
11545 <p>a
11546 |+ not a caption
11547 ! not a table heading
11548 |- not a table row
11549 | not a table cell
11550 | class="foo bar" | baz
11551 b
11552 |}
11553 |-
11554 c
11555 </p>
11556 !! end
11557
11558 ###
11559 ### Testing parsing of templates where a template arg
11560 ### has the same name as the template itself.
11561 ###
11562
11563 !! article
11564 Template:quote
11565 !! text
11566 {{{quote|{{{1}}}}}}
11567 !! endarticle
11568
11569 !!test
11570 Templates: Template Name/Arg clash: 1. Use of positional param
11571 !! wikitext
11572 {{quote|foo}}
11573 !! html
11574 <p>foo
11575 </p>
11576 !!end
11577
11578 !!test
11579 Templates: Template Name/Arg clash: 2. Use of named param
11580 !! wikitext
11581 {{quote|quote=foo}}
11582 !! html
11583 <p>foo
11584 </p>
11585 !!end
11586
11587 !!test
11588 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11589 !! wikitext
11590 {{quote|quote}}
11591 !! html
11592 <p>quote
11593 </p>
11594 !!end
11595
11596 ###
11597 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11598 ###
11599
11600 !!test
11601 Templates: 1. Simple use
11602 !! wikitext
11603 {{echo|Foo}}
11604 !! html
11605 <p>Foo
11606 </p>
11607 !!end
11608
11609 !!test
11610 Templates: 2. Inside a block tag
11611 !! wikitext
11612 <div>{{echo|Foo}}</div>
11613 <blockquote>{{echo|Foo}}</blockquote>
11614 !! html
11615 <div>Foo</div>
11616 <blockquote>Foo</blockquote>
11617
11618 !! html+tidy
11619 <div>Foo</div>
11620 <blockquote>
11621 <p>Foo</p>
11622 </blockquote>
11623 !!end
11624
11625 !!test
11626 Templates: P-wrapping: 1a. Templates on consecutive lines
11627 !! wikitext
11628 {{echo|Foo}}
11629 {{echo|bar}}
11630 !! html
11631 <p>Foo
11632 bar
11633 </p>
11634 !!end
11635
11636 !!test
11637 Templates: P-wrapping: 1b. Templates on consecutive lines
11638 !! wikitext
11639 Foo
11640
11641 {{echo|bar}}
11642 {{echo|baz}}
11643 !! html
11644 <p>Foo
11645 </p><p>bar
11646 baz
11647 </p>
11648 !!end
11649
11650 !!test
11651 Templates: P-wrapping: 1c. Templates on consecutive lines
11652 !! wikitext
11653 {{echo|Foo}}
11654 {{echo|bar}} <div>baz</div>
11655 !! html
11656 <p>Foo
11657 </p>
11658 bar <div>baz</div>
11659
11660 !! html+tidy
11661 <p>Foo</p>
11662 <p>bar</p>
11663 <div>baz</div>
11664 !! end
11665
11666 !!test
11667 Templates: P-wrapping: 1d. Template preceded by comment-only line
11668 !!options
11669 parsoid
11670 !! wikitext
11671 <!-- foo -->
11672 {{echo|Bar}}
11673 !! html
11674 <!-- foo -->
11675
11676 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11677 !!end
11678
11679 !!test
11680 Templates: Inline Text: 1. Multiple template uses
11681 !! wikitext
11682 {{echo|Foo}}bar{{echo|baz}}
11683 !! html
11684 <p>Foobarbaz
11685 </p>
11686 !!end
11687
11688 !!test
11689 Templates: Inline Text: 2. Back-to-back template uses
11690 !! wikitext
11691 {{echo|Foo}}{{echo|bar}}
11692 !! html
11693 <p>Foobar
11694 </p>
11695 !!end
11696
11697 !!test
11698 Templates: Block Tags: 1. Multiple template uses
11699 !! wikitext
11700 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11701 !! html
11702 <div>Foo</div><div>bar</div><div>baz</div>
11703
11704 !!end
11705
11706 !!test
11707 Templates: Block Tags: 2. Back-to-back template uses
11708 !! wikitext
11709 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11710 !! html
11711 <div>Foo</div><div>bar</div>
11712
11713 !!end
11714
11715 # This is an edge case relating to paragraph wrapping.
11716 !!test
11717 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11718 !! wikitext
11719 {{echo|a
11720 b</p>}}
11721 !! html/parsoid
11722 <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
11723 b</p>
11724 !!end
11725
11726 !!test
11727 Templates: Links: 1. Simple example
11728 !! wikitext
11729 {{echo|[[Foo|bar]]}}
11730 !! html
11731 <p><a href="/wiki/Foo" title="Foo">bar</a>
11732 </p>
11733 !!end
11734
11735 !!test
11736 Templates: Links: 2. Generation of link href
11737 !! wikitext
11738 [[{{echo|Foo}}|bar]]
11739 !! html
11740 <p><a href="/wiki/Foo" title="Foo">bar</a>
11741 </p>
11742 !!end
11743
11744 !!test
11745 Templates: Links: 3. Generation of part of a link href
11746 !! wikitext
11747 [[Fo{{echo|o}}|bar]]
11748
11749 [[Foo{{echo|bar}}]]
11750
11751 [[Foo{{echo|bar}}baz]]
11752
11753 [[Foo{{echo|bar}}|bar]]
11754
11755 [[:Foo{{echo|bar}}]]
11756
11757 [[:Foo{{echo|bar}}|bar]]
11758 !! html
11759 <p><a href="/wiki/Foo" title="Foo">bar</a>
11760 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11761 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11762 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11763 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11764 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11765 </p>
11766 !!end
11767
11768 !!test
11769 Templates: Links: 4. Multiple templates generating link href
11770 !! wikitext
11771 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11772 !! html
11773 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11774 </p>
11775 !!end
11776
11777 !!test
11778 Templates: Links: 5. Generation of link text
11779 !! wikitext
11780 [[Foo|{{echo|bar}}]]
11781 !! html
11782 <p><a href="/wiki/Foo" title="Foo">bar</a>
11783 </p>
11784 !!end
11785
11786 !!test
11787 Templates: Links: 5. Nested templates (only outermost template should be marked)
11788 !! wikitext
11789 {{echo|[[{{echo|Foo}}|bar]]}}
11790 !! html
11791 <p><a href="/wiki/Foo" title="Foo">bar</a>
11792 </p>
11793 !!end
11794
11795 !!test
11796 Templates: HTML Tag: 1. Generation of HTML attr. key
11797 !! wikitext
11798 <div {{echo|style}}="color:red;">foo</div>
11799 !! html
11800 <div style="color:red;">foo</div>
11801
11802 !!end
11803
11804 !!test
11805 Templates: HTML Tag: 2. Generation of HTML attr. value
11806 !! wikitext
11807 <div style={{echo|'color:red;'}}>foo</div>
11808 !! html
11809 <div style="color:red;">foo</div>
11810
11811 !!end
11812
11813 !!test
11814 Templates: HTML Tag: 3. Generation of HTML attr key and value
11815 !! wikitext
11816 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11817 !! html
11818 <div style="color:red;">foo</div>
11819
11820 !!end
11821
11822 !!test
11823 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11824 !! wikitext
11825 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11826 !! html
11827 <div title="This is a long title with just one piece templated">foo</div>
11828
11829 !!end
11830
11831 !!test
11832 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11833 !! wikitext
11834 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11835 !! html
11836 <div title="This is a long title with just one piece templated">foo</div>
11837
11838 !!end
11839
11840 !!test
11841 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11842 !! wikitext
11843 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11844 !! html
11845 <div title="This is a long title with just one piece templated">foo</div>
11846
11847 !!end
11848
11849 # SSS FIXME: While it is great we added support for all this,
11850 # do we want to make this part of the spec? Maybe we want to
11851 # deprecate this kind of usage in the future?
11852 !!test
11853 Templates: HTML Tag: 7. Generation of partial attribute key string
11854 !! wikitext
11855 <div st{{echo|yle}}="color:red;">foo</div>
11856 !! html
11857 <div style="color:red;">foo</div>
11858
11859 !!end
11860
11861 !! test
11862 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11863 !! wikitext
11864 <div {{echo|1=id="v1"}}>bar</div>
11865 !! html
11866 <div id="v1">bar</div>
11867
11868 !!end
11869
11870 !! test
11871 Templates: HTML Tag: 9. Multiple template-generated attributes
11872 !! wikitext
11873 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11874 !! html
11875 <div id="v1" title="foo">bar</div>
11876
11877 !!end
11878
11879 !! test
11880 Templates: Support for templates generating attributes and content
11881 !! wikitext
11882 {| {{mixed_attr_content_template}}
11883 |-
11884 |bar
11885 |}
11886 !! html/php
11887 <table style="color:red;" title="T48811">
11888
11889 <tr>
11890 <td>foo
11891 </td></tr>
11892 <tr>
11893 <td>bar
11894 </td></tr></table>
11895
11896 !! html/parsoid
11897 <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|}"]}'>
11898 <tbody><tr>
11899 <td>foo</td></tr>
11900 <tr>
11901 <td>bar</td></tr>
11902 </tbody></table>
11903 !!end
11904
11905 !! test
11906 1. Entities and nowikis inside templated attributes should be handled correctly
11907 !! wikitext
11908 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11909 !! html/php
11910 <div style="background:#f9f9f9;">foo</div>
11911
11912 !! html/parsoid
11913 <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=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[5,49,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"style{{=}}\\\"background:&amp;amp;#35;f9f9f9;\\\"\"}},\"i\":0}}]}&#39;>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=&#39;{\"src\":\"&amp;amp;#35;\",\"srcContent\":\"#\"}&#39;>#&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">f9f9f9;\"&lt;/span>"},{"html":""}]]}'>foo</div>
11914 !! end
11915
11916 !! test
11917 2. Entities and nowikis inside templated attributes should be handled correctly
11918 !! wikitext
11919 {|
11920 |{{table_attribs_3}}
11921 |}
11922 !! html/php
11923 <table>
11924 <tr>
11925 <td style="background:#f9f9f9;">Foo
11926 </td></tr></table>
11927
11928 !! html/parsoid
11929 <table>
11930 <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>
11931 </tbody></table>
11932 !! end
11933
11934 !! test
11935 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11936 !! wikitext
11937 {{tbl-start}}
11938 |{{table_attribs_3}}
11939 {{tbl-end}}
11940 !! html/php
11941 <table>
11942 <tr>
11943 <td style="background:#f9f9f9;">Foo
11944 </td></tr></table>
11945
11946 !! html/parsoid
11947 <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}}]}'>
11948 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11949 </tbody></table>
11950 !! end
11951
11952 # T107622
11953 !! test
11954 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11955 !! wikitext
11956 {|
11957 | {{table_attribs_6}} hi
11958 |}
11959 !! html/php
11960 <table>
11961 <tr>
11962 <td style="background: red;"> hi
11963 </td></tr></table>
11964
11965 !! html/parsoid
11966 <table>
11967 <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>
11968 </tbody></table>
11969 !! end
11970
11971 !!test
11972 Templates: HTML Tables: 1. Generating start of a HTML table
11973 !! wikitext
11974 {{echo|<table><tr><td>foo</td>}}</tr></table>
11975 !! html
11976 <table><tr><td>foo</td></tr></table>
11977
11978 !!end
11979
11980 !!test
11981 Templates: HTML Tables: 2a. Generating middle of a HTML table
11982 !! wikitext
11983 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11984 !! html
11985 <table><tr><td>foo</td></tr></table>
11986
11987 !!end
11988
11989 !!test
11990 Templates: HTML Tables: 2b. Generating middle of a HTML table
11991 !! wikitext
11992 <table>{{echo|<tr><td>foo</td></tr>}}</table>
11993 !! html
11994 <table><tr><td>foo</td></tr></table>
11995
11996 !!end
11997
11998 !!test
11999 Templates: HTML Tables: 3. Generating end of a HTML table
12000 !! wikitext
12001 <table><tr>{{echo|<td>foo</td></tr></table>}}
12002 !! html
12003 <table><tr><td>foo</td></tr></table>
12004
12005 !!end
12006
12007 !!test
12008 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
12009 !! wikitext
12010 {{echo|<table>}}<tr><td>foo</td></tr></table>
12011 !! html
12012 <table><tr><td>foo</td></tr></table>
12013
12014 !!end
12015
12016 !!test
12017 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
12018 !! wikitext
12019 <table>{{echo|<tr>}}<td>foo</td></tr></table>
12020 !! html
12021 <table><tr><td>foo</td></tr></table>
12022
12023 !!end
12024
12025 !!test
12026 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
12027 !! wikitext
12028 <table><tr>{{echo|<td>}}foo</td></tr></table>
12029 !! html
12030 <table><tr><td>foo</td></tr></table>
12031
12032 !!end
12033
12034 !!test
12035 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
12036 !! wikitext
12037 <table><tr><td>foo{{echo|</td>}}</tr></table>
12038 !! html
12039 <table><tr><td>foo</td></tr></table>
12040
12041 !!end
12042
12043 !!test
12044 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
12045 !! wikitext
12046 <table><tr><td>foo</td>{{echo|</tr>}}</table>
12047 !! html
12048 <table><tr><td>foo</td></tr></table>
12049
12050 !!end
12051
12052 !!test
12053 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
12054 !! wikitext
12055 <table><tr><td>foo</td></tr>{{echo|</table>}}
12056 !! html
12057 <table><tr><td>foo</td></tr></table>
12058
12059 !!end
12060
12061 !!test
12062 Templates: HTML Tables: 5. Proper fostering of categories from inside
12063 !!options
12064 parsoid=wt2html,wt2wt
12065 !! wikitext
12066 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
12067 <!--Two categories (Bug 50330)-->
12068 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
12069 !! html
12070 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
12071 <!--Two categories (Bug 50330)-->
12072 <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>
12073 !!end
12074
12075 !!test
12076 Templates: Wiki Tables: 1a. Fostering of entire template content
12077 !! wikitext
12078 {|
12079 {{echo|a}}
12080 |}
12081 !! html
12082 <table>
12083 a
12084 <tr><td></td></tr></table>
12085
12086 !! html+tidy
12087 <p>a</p>
12088 <table>
12089 <tr>
12090 <td></td>
12091 </tr>
12092 </table>
12093 !! end
12094
12095 !!test
12096 Templates: Wiki Tables: 1b. Fostering of entire template content
12097 !! wikitext
12098 {|
12099 {{echo|<div>}}
12100 foo
12101 {{echo|</div>}}
12102 |}
12103 !! html
12104 <table>
12105 <div>
12106 <p>foo
12107 </p>
12108 </div>
12109 <tr><td></td></tr></table>
12110
12111 !! html+tidy
12112 <div>
12113 <p>foo</p>
12114 </div>
12115 <table>
12116 <tr>
12117 <td></td>
12118 </tr>
12119 </table>
12120 !! end
12121
12122 !!test
12123 Templates: Wiki Tables: 2. Fostering of partial template content
12124 !! wikitext
12125 {|
12126 {{echo|a
12127 <div>b</div>}}
12128 |}
12129 !! html
12130 <table>
12131 a
12132 <div>b</div>
12133 <tr><td></td></tr></table>
12134
12135 !! html+tidy
12136 <p>a</p>
12137 <div>b</div>
12138 <table>
12139 <tr>
12140 <td></td>
12141 </tr>
12142 </table>
12143 !! end
12144
12145 !!test
12146 Templates: Wiki Tables: 3. td-content via multiple templates
12147 !! wikitext
12148 {|
12149 {{echo|{{pipe}}a}}{{echo|b}}
12150 |}
12151 !! html
12152 <table>
12153 <tr>
12154 <td>ab
12155 </td></tr></table>
12156
12157 !!end
12158
12159 !!test
12160 Templates: Wiki Tables: 4. Templated tags, no content
12161 !! wikitext
12162 {{tbl-start}}
12163 {{tbl-end}}
12164 !! html
12165 <table>
12166 <tr><td></td></tr></table>
12167
12168 !!end
12169
12170 !!test
12171 Templates: Wiki Tables: 5. Templated tags, regular td-tags
12172 !! wikitext
12173 {{tbl-start}}
12174 |foo
12175 {{tbl-end}}
12176 !! html
12177 <table>
12178 <tr>
12179 <td>foo
12180 </td></tr></table>
12181
12182 !!end
12183
12184 !!test
12185 Templates: Wiki Tables: 6. Templated tags, templated td-tags
12186 !! wikitext
12187 {{tbl-start}}
12188 {{!}}foo
12189 {{tbl-end}}
12190 !! html
12191 <table>
12192 <tr>
12193 <td>foo
12194 </td></tr></table>
12195
12196 !!end
12197
12198 ## This test case is very specific to Parsoid's internals
12199 ## and is hence only tested for Parsoid's code. Parsoid uses
12200 ## a <meta> marker tag for <ref> tags and they are expanded
12201 ## much later. We are verifying that this <meta> tag usage
12202 ## doesn't prevent foster parenting.
12203 !!test
12204 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
12205 !!wikitext
12206 {{PartialTable}}<ref>foo</ref>
12207 |}
12208
12209 <references />
12210 !!html/parsoid
12211 <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">
12212 <tbody>
12213 </tbody></table>
12214
12215 <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>
12216 !!end
12217
12218 !! test
12219 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
12220 !! wikitext
12221 {{echo|
12222 {{{!}}
12223 {{!}}-}}
12224 <onlyinclude>
12225 |foo
12226 </onlyinclude>
12227 {{!}}}
12228 !! html/parsoid
12229 <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{{!}}}"]}'>
12230 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
12231 <tbody><tr>
12232
12233 <td>foo
12234 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
12235 </tbody></table>
12236 !! end
12237
12238 !!test
12239 Templates: Lists: Multi-line list-items via templates
12240 !! wikitext
12241 *{{echo|a {{nonexistent|
12242 unused}}}}
12243 *{{echo|b {{nonexistent|
12244 unused}}}}
12245 !! html
12246 <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>
12247 <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>
12248
12249 !!end
12250
12251 !!test
12252 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
12253 !! wikitext
12254 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
12255 !! html
12256 <p><i>ab</i>c<i>d</i>e
12257 </p>
12258 !!end
12259
12260 !!test
12261 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
12262 (PHP parser generates misnested html)
12263 !! wikitext
12264 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
12265 !! html/parsoid
12266 <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>
12267 !!end
12268
12269 !!test
12270 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
12271 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
12272 !! options
12273 parsoid=wt2html,wt2wt
12274 !! wikitext
12275 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
12276 !! html
12277 <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>
12278 <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>
12279 <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>
12280 !!end
12281
12282 !!test
12283 Templates: Ugly nesting: 4. Divs opened/closed across templates
12284 !! wikitext
12285 a<div>b{{echo|c</div>d}}e
12286 !! html
12287 a<div>bc</div>de
12288
12289 !! html+tidy
12290 <p>a</p>
12291 <div>bc</div>
12292 <p>de</p>
12293 !! end
12294
12295 !!test
12296 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
12297 (Parsoid-centric)
12298 !! options
12299 parsoid
12300 !! wikitext
12301 {|
12302 |{{echo|foo</table>}}
12303 |bar
12304 |}
12305 !! html
12306 <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|}"]}'>
12307
12308 <tbody>
12309 <tr>
12310 <td>foo</td></tr></tbody></table><span about="#mwt1">
12311 </span><span about="#mwt1">|bar</span><span about="#mwt1">
12312 |}</span>
12313 !!end
12314
12315 !!test
12316 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
12317 (Parsoid-centric)
12318 !! options
12319 parsoid
12320 !! wikitext
12321 <table>
12322 <tr>
12323 <td>
12324 <table>
12325 <tr>
12326 <td>1. {{echo|foo </table>}}</td>
12327 <td> bar </td>
12328 <td>2. {{echo|baz </table>}}</td>
12329 </tr>
12330 <tr>
12331 <td>abc</td>
12332 </tr>
12333 </table>
12334 </td>
12335 </tr>
12336 <tr>
12337 <td>xyz</td>
12338 </tr>
12339 </table>
12340 !! html
12341 <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>"]}'>
12342 <tbody><tr>
12343 <td>
12344 <table>
12345 <tbody><tr>
12346 <td>1. foo </td></tr></tbody></table></td>
12347 <td> bar </td>
12348 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
12349 </span><span about="#mwt2">
12350 </span><span about="#mwt2">
12351 </span><span about="#mwt2">abc</span><span about="#mwt2">
12352 </span><span about="#mwt2">
12353 </span><span about="#mwt2">
12354 </span><span about="#mwt2">
12355 </span><span about="#mwt2">
12356 </span><span about="#mwt2">
12357 </span><span about="#mwt2">xyz</span><span about="#mwt2">
12358 </span><span about="#mwt2">
12359 </span>
12360 !!end
12361
12362 !! test
12363 Templates: Ugly templates: 3. newline-only template parameter
12364 !! wikitext
12365 foo {{echo|
12366 }}
12367 !! html
12368 <p>foo
12369 </p>
12370 !! end
12371
12372 # This looks like a bug: a single newline triggers p/br for some reason.
12373 !! test
12374 Templates: Ugly templates: 4. newline-only template parameter inconsistency
12375 !! wikitext
12376 {{echo|
12377 }}
12378 !! html
12379 <p><br />
12380 </p>
12381 !! end
12382
12383 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
12384 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12385 !! test
12386 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12387 !! wikitext
12388 {{echo|<table>}}
12389 {{echo|<div>foo}}
12390 {{echo|</table>}}
12391 !! html/parsoid
12392 <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"}],[{"k":"1"}],[{"k":"1"}]]}'>foo
12393 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12394 </table>
12395 !! end
12396
12397 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
12398 # that are "identical" and generate nesting cycles in the algorithm
12399 !! test
12400 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12401 !! wikitext
12402 {{echo|<table><tr><td><table>}}
12403 {{echo|<div>}}
12404 {{echo|</div>}}
12405 !! html/parsoid
12406 <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"}],[{"k":"1"}],[{"k":"1"}]]}'><tbody><tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>
12407 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12408 </table></td></tr></tbody></table>
12409 !! end
12410
12411 !! test
12412 Templates: Parameters substituted at the top-level
12413 !! wikitext
12414 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12415 !! html/php
12416 <p><i>who</i> me? <b>never!</b>
12417 </p>
12418 !! html/parsoid
12419 <p about="#mwt2" typeof="mw:Param" data-parsoid="{&quot;src&quot;:&quot;{{{foo|''who'' {{echo|me}}? '''never!'''}}}&quot;}"><i>who</i> me? <b>never!</b></p>
12420 !! end
12421
12422 !!test
12423 Parser Functions: 1. Simple example
12424 !! wikitext
12425 {{uc:foo}}
12426 !! html
12427 <p>FOO
12428 </p>
12429 !!end
12430
12431 !!test
12432 Parser Functions: 2. Nested use (only outermost should be marked up)
12433 !! wikitext
12434 {{uc:{{lc:FOO}}}}
12435 !! html
12436 <p>FOO
12437 </p>
12438 !!end
12439
12440 ###
12441 ### Pre-save transform tests
12442 ###
12443 !! test
12444 pre-save transform: subst:
12445 !! options
12446 pst
12447 !! wikitext
12448 {{subst:test}}
12449 !! html/php
12450 This is a test template
12451 !! end
12452
12453 !! test
12454 pre-save transform: normal template
12455 !! options
12456 pst
12457 !! wikitext
12458 {{test}}
12459 !! html/php
12460 {{test}}
12461 !! end
12462
12463 !! test
12464 pre-save transform: nonexistent template
12465 !! options
12466 pst
12467 !! wikitext
12468 {{thistemplatedoesnotexist}}
12469 !! html/php
12470 {{thistemplatedoesnotexist}}
12471 !! end
12472
12473 !! test
12474 pre-save transform: subst magic variables
12475 !! options
12476 pst
12477 !! wikitext
12478 {{subst:SITENAME}}
12479 !! html/php
12480 MediaWiki
12481 !! end
12482
12483 # This is bug 89, which I fixed. -- wtm
12484 !! test
12485 pre-save transform: subst: templates with parameters
12486 !! options
12487 pst
12488 !! wikitext
12489 {{subst:paramtest|param="something else"}}
12490 !! html/php
12491 This is a test template with parameter "something else"
12492 !! end
12493
12494 !! article
12495 Template:nowikitest
12496 !! text
12497 <nowiki>'''not wiki'''</nowiki>
12498 !! endarticle
12499
12500 !! test
12501 pre-save transform: nowiki in subst (bug 1188)
12502 !! options
12503 pst
12504 !! wikitext
12505 {{subst:nowikitest}}
12506 !! html/php
12507 <nowiki>'''not wiki'''</nowiki>
12508 !! end
12509
12510 !! article
12511 Template:commenttest
12512 !! text
12513 This template has <!-- a comment --> in it.
12514 !! endarticle
12515
12516 !! test
12517 pre-save transform: comment in subst (bug 1936)
12518 !! options
12519 pst
12520 !! wikitext
12521 {{subst:commenttest}}
12522 !! html/php
12523 This template has <!-- a comment --> in it.
12524 !! end
12525
12526 !! test
12527 pre-save transform: unclosed tag
12528 !! options
12529 pst
12530 !! wikitext
12531 <nowiki>'''not wiki'''
12532 !! html/php
12533 <nowiki>'''not wiki'''
12534 !! end
12535
12536 !! test
12537 pre-save transform: mixed tag case
12538 !! options
12539 pst
12540 !! wikitext
12541 <NOwiki>'''not wiki'''</noWIKI>
12542 !! html/php
12543 <NOwiki>'''not wiki'''</noWIKI>
12544 !! end
12545
12546 !! test
12547 pre-save transform: unclosed comment in <nowiki>
12548 !! options
12549 pst
12550 !! wikitext
12551 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12552 !! html/php
12553 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12554 !!end
12555
12556 # Leading @ in this template definition works around a limitation
12557 # in parsoid's parserTests which otherwise strips the <span> from the
12558 # result (confusing it for a template wrapper)
12559 !! article
12560 Template:dangerous
12561 !!text
12562 @<span onmouseover="alert('crap')">Oh no</span>
12563 !!endarticle
12564
12565 !!test
12566 (confirming safety of fix for subst bug 1936)
12567 !! wikitext
12568 {{Template:dangerous}}
12569 !! html
12570 <p>@<span>Oh no</span>
12571 </p>
12572 !! end
12573
12574 !! test
12575 pre-save transform: comment containing gallery (bug 5024)
12576 !! options
12577 pst
12578 !! wikitext
12579 <!-- <gallery>data</gallery> -->
12580 !! html/php
12581 <!-- <gallery>data</gallery> -->
12582 !!end
12583
12584 !! test
12585 pre-save transform: comment containing extension
12586 !! options
12587 pst
12588 !! wikitext
12589 <!-- <tag>data</tag> -->
12590 !! html/php
12591 <!-- <tag>data</tag> -->
12592 !!end
12593
12594 !! test
12595 pre-save transform: comment containing nowiki
12596 !! options
12597 pst
12598 !! wikitext
12599 <!-- <nowiki>data</nowiki> -->
12600 !! html/php
12601 <!-- <nowiki>data</nowiki> -->
12602 !!end
12603
12604 !! test
12605 pre-save transform: <noinclude> in subst (bug 3298)
12606 !! options
12607 pst
12608 !! wikitext
12609 {{subst:Includes}}
12610 !! html/php
12611 Foobar
12612 !! end
12613
12614 !! test
12615 pre-save transform: <onlyinclude> in subst (bug 3298)
12616 !! options
12617 pst
12618 !! wikitext
12619 {{subst:Includes2}}
12620 !! html/php
12621 Foo
12622 !! end
12623
12624 !! article
12625 Template:SubstTest
12626 !!text
12627 {{<includeonly>subst:</includeonly>Includes}}
12628 !! endarticle
12629
12630 !! article
12631 Template:SafeSubstTest
12632 !! text
12633 {{<includeonly>safesubst:</includeonly>Includes}}
12634 !! endarticle
12635
12636 !! test
12637 bug 22297: safesubst: works during PST
12638 !! options
12639 pst
12640 !! wikitext
12641 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12642 !! html/php
12643 FoobarFoobar
12644 !! end
12645
12646 !! test
12647 bug 22297: safesubst: works during normal parse
12648 !! wikitext
12649 {{SafeSubstTest}}
12650 !! html
12651 <p>Foobar
12652 </p>
12653 !! end
12654
12655 !! test
12656 subst: does not work during normal parse
12657 !! wikitext
12658 {{SubstTest}}
12659 !! html
12660 <p>{{subst:Includes}}
12661 </p>
12662 !! end
12663
12664 !! test
12665 pre-save transform: context links ("pipe trick")
12666 !! options
12667 pst
12668 !! wikitext
12669 [[Article (context)|]]
12670 [[Bar:Article|]]
12671 [[:Bar:Article|]]
12672 [[Bar:Article (context)|]]
12673 [[:Bar:Article (context)|]]
12674 [[|Article]]
12675 [[|Article (context)]]
12676 [[Bar:X (Y) Z|]]
12677 [[:Bar:X (Y) Z|]]
12678 !! html/php
12679 [[Article (context)|Article]]
12680 [[Bar:Article|Article]]
12681 [[:Bar:Article|Article]]
12682 [[Bar:Article (context)|Article]]
12683 [[:Bar:Article (context)|Article]]
12684 [[Article]]
12685 [[Article (context)]]
12686 [[Bar:X (Y) Z|X (Y) Z]]
12687 [[:Bar:X (Y) Z|X (Y) Z]]
12688 !! end
12689
12690 !! test
12691 pre-save transform: context links ("pipe trick") with interwiki prefix
12692 !! options
12693 pst
12694 !! wikitext
12695 [[interwiki:Article|]]
12696 [[:interwiki:Article|]]
12697 [[interwiki:Bar:Article|]]
12698 [[:interwiki:Bar:Article|]]
12699 !! html/php
12700 [[interwiki:Article|Article]]
12701 [[:interwiki:Article|Article]]
12702 [[interwiki:Bar:Article|Bar:Article]]
12703 [[:interwiki:Bar:Article|Bar:Article]]
12704 !! end
12705
12706 !! test
12707 pre-save transform: context links ("pipe trick") with parens in title
12708 !! options
12709 pst title=[[Somearticle (context)]]
12710 !! wikitext
12711 [[|Article]]
12712 !! html/php
12713 [[Article (context)|Article]]
12714 !! end
12715
12716 !! test
12717 pre-save transform: context links ("pipe trick") with comma in title
12718 !! options
12719 pst title=[[Someplace, Somewhere]]
12720 !! wikitext
12721 [[|Otherplace]]
12722 [[Otherplace, Elsewhere|]]
12723 [[Otherplace, Elsewhere, Anywhere|]]
12724 !! html/php
12725 [[Otherplace, Somewhere|Otherplace]]
12726 [[Otherplace, Elsewhere|Otherplace]]
12727 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12728 !! end
12729
12730 !! test
12731 pre-save transform: context links ("pipe trick") with parens and comma
12732 !! options
12733 pst title=[[Someplace (IGNORED), Somewhere]]
12734 !! wikitext
12735 [[|Otherplace]]
12736 [[Otherplace (place), Elsewhere|]]
12737 !! html/php
12738 [[Otherplace, Somewhere|Otherplace]]
12739 [[Otherplace (place), Elsewhere|Otherplace]]
12740 !! end
12741
12742 !! test
12743 pre-save transform: context links ("pipe trick") with comma and parens
12744 !! options
12745 pst title=[[Who, me? (context)]]
12746 !! wikitext
12747 [[|Yes, you.]]
12748 [[Me, Myself, and I (1937 song)|]]
12749 !! html/php
12750 [[Yes, you. (context)|Yes, you.]]
12751 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12752 !! end
12753
12754 !! test
12755 pre-save transform: context links ("pipe trick") with namespace
12756 !! options
12757 pst title=[[Ns:Somearticle]]
12758 !! wikitext
12759 [[|Article]]
12760 !! html/php
12761 [[Ns:Article|Article]]
12762 !! end
12763
12764 !! test
12765 pre-save transform: context links ("pipe trick") with namespace and parens
12766 !! options
12767 pst title=[[Ns:Somearticle (context)]]
12768 !! wikitext
12769 [[|Article]]
12770 !! html/php
12771 [[Ns:Article (context)|Article]]
12772 !! end
12773
12774 !! test
12775 pre-save transform: context links ("pipe trick") with namespace and comma
12776 !! options
12777 pst title=[[Ns:Somearticle, Context, Whatever]]
12778 !! wikitext
12779 [[|Article]]
12780 !! html/php
12781 [[Ns:Article, Context, Whatever|Article]]
12782 !! end
12783
12784 !! test
12785 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12786 !! options
12787 pst title=[[Ns:Somearticle, Context (context)]]
12788 !! wikitext
12789 [[|Article]]
12790 !! html/php
12791 [[Ns:Article (context)|Article]]
12792 !! end
12793
12794 !! test
12795 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12796 !! options
12797 pst title=[[Ns:Somearticle (IGNORED), Context]]
12798 !! wikitext
12799 [[|Article]]
12800 !! html/php
12801 [[Ns:Article, Context|Article]]
12802 !! end
12803
12804 !! test
12805 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12806 !! options
12807 pst
12808 !! wikitext
12809 [[Article(context)|]]
12810 [[Bar:Article(context)|]]
12811 [[:Bar:Article(context)|]]
12812 [[|Article(context)]]
12813 [[Bar:X(Y)Z|]]
12814 [[:Bar:X(Y)Z|]]
12815 !! html/php
12816 [[Article(context)|Article]]
12817 [[Bar:Article(context)|Article]]
12818 [[:Bar:Article(context)|Article]]
12819 [[Article(context)]]
12820 [[Bar:X(Y)Z|X(Y)Z]]
12821 [[:Bar:X(Y)Z|X(Y)Z]]
12822 !! end
12823
12824 !! test
12825 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12826 !! options
12827 pst
12828 !! wikitext
12829 [[Article (context)|]]
12830 [[Bar:Article (context)|]]
12831 [[:Bar:Article (context)|]]
12832 [[|Article (context)]]
12833 [[Bar:X (Y) Z|]]
12834 [[:Bar:X (Y) Z|]]
12835 !! html/php
12836 [[Article (context)|Article]]
12837 [[Bar:Article (context)|Article]]
12838 [[:Bar:Article (context)|Article]]
12839 [[Article (context)]]
12840 [[Bar:X (Y) Z|X (Y) Z]]
12841 [[:Bar:X (Y) Z|X (Y) Z]]
12842 !! end
12843
12844 !! test
12845 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12846 !! options
12847 pst
12848 !! wikitext
12849 [[Article(context)|]]
12850 [[Bar:Article(context)|]]
12851 [[:Bar:Article(context)|]]
12852 [[|Article(context)]]
12853 [[Bar:X(Y)Z|]]
12854 [[:Bar:X(Y)Z|]]
12855 !! html/php
12856 [[Article(context)|Article]]
12857 [[Bar:Article(context)|Article]]
12858 [[:Bar:Article(context)|Article]]
12859 [[Article(context)]]
12860 [[Bar:X(Y)Z|X(Y)Z]]
12861 [[:Bar:X(Y)Z|X(Y)Z]]
12862 !! end
12863
12864 !! test
12865 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12866 !! options
12867 pst
12868 !! wikitext
12869 [[Article (context), context|]]
12870 [[Article (context),context|]]
12871 [[Bar:Article (context), context|]]
12872 [[Bar:Article (context),context|]]
12873 [[:Bar:Article (context), context|]]
12874 [[:Bar:Article (context),context|]]
12875 !! html/php
12876 [[Article (context), context|Article]]
12877 [[Article (context),context|Article]]
12878 [[Bar:Article (context), context|Article]]
12879 [[Bar:Article (context),context|Article]]
12880 [[:Bar:Article (context), context|Article]]
12881 [[:Bar:Article (context),context|Article]]
12882 !! end
12883
12884 !! test
12885 pre-save transform: trim trailing empty lines
12886 !! options
12887 pst
12888 !! wikitext
12889 Empty lines are trimmed
12890
12891
12892
12893
12894 !! html/php
12895 Empty lines are trimmed
12896 !! end
12897
12898 !! test
12899 pre-save transform: Signature expansion
12900 !! options
12901 pst
12902 !! wikitext
12903 * ~~~
12904 * <noinclude>~~~</noinclude>
12905 * <includeonly>~~~</includeonly>
12906 * <onlyinclude>~~~</onlyinclude>
12907 !! html/php
12908 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12909 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12910 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12911 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12912 !! end
12913
12914
12915 !! test
12916 pre-save transform: Signature expansion in nowiki tags (bug 93)
12917 !! options
12918 pst disabled
12919 !! wikitext
12920 Shall not expand:
12921
12922 <nowiki>~~~~</nowiki>
12923
12924 <includeonly><nowiki>~~~~</nowiki></includeonly>
12925
12926 <noinclude><nowiki>~~~~</nowiki></noinclude>
12927
12928 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12929
12930 {{subst:Foo}} shall be converted to FOO
12931
12932 As well as inside noinclude/onlyinclude
12933 <noinclude>{{subst:Foo}}</noinclude>
12934 <onlyinclude>{{subst:Foo}}</onlyinclude>
12935
12936 But not inside includeonly
12937 <includeonly>{{subst:Foo}}</includeonly>
12938 !! html/php
12939 Shall not expand:
12940
12941 <nowiki>~~~~</nowiki>
12942
12943 <includeonly><nowiki>~~~~</nowiki></includeonly>
12944
12945 <noinclude><nowiki>~~~~</nowiki></noinclude>
12946
12947 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12948
12949 FOO shall be converted to FOO
12950
12951 As well as inside noinclude/onlyinclude
12952 <noinclude>FOO</noinclude>
12953 <onlyinclude>FOO</onlyinclude>
12954
12955 But not inside includeonly
12956 <includeonly>{{subst:Foo}}</includeonly>
12957 !! end
12958
12959 !! test
12960 Parsoid: Recognize nowiki with trailing space in tags
12961 !! options
12962 parsoid=wt2html
12963 !! wikitext
12964 <nowiki ><div>[[foo]]</nowiki >
12965
12966 a<nowiki / >b
12967
12968 c<nowiki />d
12969
12970 e<nowiki/ >f
12971 !! html
12972 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12973 <p>ab</p>
12974 <p>cd</p>
12975 <p>ef</p>
12976 !! end
12977
12978 !! test
12979 Parsoid: Recognize nowiki with odd capitalization
12980 !! options
12981 parsoid=wt2html
12982 !! wikitext
12983 <noWikI ><div>[[foo]]</Nowiki >
12984 !! html
12985 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12986 !! end
12987
12988
12989 !! test
12990 Parsoid: Escape nowiki with trailing space in tags
12991 !! options
12992 parsoid=html2wt
12993 !! html/parsoid
12994 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12995 <p>a&lt;nowiki /&gt;b</p>
12996 <p>c&lt;nowiki/ &gt;d</p>
12997 !! wikitext
12998 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12999
13000 a&lt;nowiki /&gt;b
13001
13002 c&lt;nowiki/ &gt;d
13003 !! end
13004
13005 !! test
13006 Parsoid: Escape weird noWikI capitalizations
13007 !! options
13008 parsoid=html2wt
13009 !! html/parsoid
13010 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
13011 !! wikitext
13012 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
13013 !! end
13014
13015 ###
13016 ### Message transform tests
13017 ###
13018 !! test
13019 message transform: magic variables
13020 !! options
13021 msg
13022 !! wikitext
13023 {{SITENAME}}
13024 !! html
13025 MediaWiki
13026 !! end
13027
13028 !! test
13029 message transform: should not transform wiki markup
13030 !! options
13031 msg
13032 !! wikitext
13033 ''test''
13034 !! html
13035 ''test''
13036 !! end
13037
13038 !! test
13039 message transform: <noinclude> in transcluded template (bug 4926)
13040 !! options
13041 msg
13042 !! wikitext
13043 {{Includes}}
13044 !! html
13045 Foobar
13046 !! end
13047
13048 !! test
13049 message transform: <onlyinclude> in transcluded template (bug 4926)
13050 !! options
13051 msg
13052 !! wikitext
13053 {{Includes2}}
13054 !! html
13055 Foo
13056 !! end
13057
13058 !! test
13059 {{#special:}} page name, known
13060 !! options
13061 msg
13062 !! wikitext
13063 {{#special:Recentchanges}}
13064 !! html
13065 Special:RecentChanges
13066 !! end
13067
13068 !! test
13069 {{#special:}} page name with subpage, known
13070 !! options
13071 msg
13072 !! wikitext
13073 {{#special:Recentchanges/param}}
13074 !! html
13075 Special:RecentChanges/param
13076 !! end
13077
13078 !! test
13079 {{#special:}} page name, unknown
13080 !! options
13081 msg
13082 !! wikitext
13083 {{#special:foobar nonexistent}}
13084 !! html
13085 Special:Foobar nonexistent
13086 !! end
13087
13088 !! test
13089 {{#speciale:}} page name, known
13090 !! options
13091 msg
13092 !! wikitext
13093 {{#speciale:Recentchanges}}
13094 !! html
13095 Special:RecentChanges
13096 !! end
13097
13098 !! test
13099 {{#speciale:}} page name with subpage, known
13100 !! options
13101 msg
13102 !! wikitext
13103 {{#speciale:Recentchanges/param}}
13104 !! html
13105 Special:RecentChanges/param
13106 !! end
13107
13108 !! test
13109 {{#speciale:}} page name, unknown
13110 !! options
13111 msg
13112 !! wikitext
13113 {{#speciale:foobar nonexistent}}
13114 !! html
13115 Special:Foobar_nonexistent
13116 !! end
13117
13118 ###
13119 ### Images
13120 ###
13121 ### For Parsoid-specific tests, see
13122 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13123
13124 !! test
13125 Simple image
13126 !! options
13127 parsoid=wt2html,wt2wt,html2html
13128 !! wikitext
13129 [[Image:foobar.jpg]]
13130 !! html/php
13131 <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>
13132 </p>
13133 !! html/parsoid
13134 <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>
13135 !! end
13136
13137 !! test
13138 Simple image (using File: namespace, now canonical)
13139 !! wikitext
13140 [[File:Foobar.jpg]]
13141 !! html/php
13142 <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>
13143 </p>
13144 !! html/parsoid
13145 <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>
13146 !! end
13147
13148 !! test
13149 Right-aligned image
13150 !! wikitext
13151 [[File:Foobar.jpg|right]]
13152 !! html/php
13153 <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>
13154
13155 !! html/parsoid
13156 <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>
13157 !! end
13158
13159 !! test
13160 Image with caption
13161 !! wikitext
13162 [[File:Foobar.jpg|right|Caption text]]
13163 !! html/php
13164 <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>
13165
13166 !! html/parsoid
13167 <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>
13168 !! end
13169
13170 !! test
13171 Image with caption, bug 53312 #1
13172 !! wikitext
13173 [[File:Foobar.jpg|right|Caption page stuff]]
13174 !! html/php
13175 <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>
13176
13177 !! html/parsoid
13178 <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>
13179 !! end
13180
13181 !! test
13182 Image with caption, bug 53312 #2
13183 !! wikitext
13184 [[File:Foobar.jpg|right|Caption page=]]
13185 !! html/php
13186 <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>
13187
13188 !! html/parsoid
13189 <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>
13190 !! end
13191
13192 !! test
13193 Image with caption, bug 53312 #3
13194 !! wikitext
13195 [[File:Foobar.jpg|right|Caption page=stuff]]
13196 !! html/php
13197 <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>
13198
13199 !! html/parsoid
13200 <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>
13201 !! end
13202
13203 !! test
13204 Allow empty links in image captions (Bug 60753)
13205 !! options
13206 thumbsize=220
13207 !! wikitext
13208 [[File:Foobar.jpg|thumb|Caption [[Link1]]
13209 [[]]
13210 [[Link2]]
13211 ]]
13212 !! html/php
13213 <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>
13214
13215 !! html/parsoid
13216 <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>
13217 [[]]
13218 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
13219 </figcaption></figure>
13220 !! end
13221
13222 !! test
13223 Titles in unlinked images (T23454)
13224 !! wikitext
13225 [[File:Foobar.jpg|link=|stuff]]
13226 !! html/php
13227 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
13228 </p>
13229 !! end
13230
13231 !! test
13232 Link with empty target
13233 !! wikitext
13234 [[]]
13235 !! html
13236 <p>[[]]
13237 </p>
13238 !! end
13239
13240 !! test
13241 Image with link trail
13242 !! wikitext
13243 Linktrails should not work for images: [[File:Foobar.jpg]]s
13244 !! html/php
13245 <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
13246 </p>
13247 !! html/parsoid
13248 <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>
13249 !! end
13250
13251 !! test
13252 Image with empty attribute
13253 !! options
13254 parsoid=wt2html,wt2wt,html2html
13255 !! wikitext
13256 [[File:Foobar.jpg|right||Caption text]]
13257 !! html/php
13258 <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>
13259
13260 !! html/parsoid
13261 <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>
13262 !! end
13263
13264 !! test
13265 1. Block image with individual attributes from templates
13266 !! wikitext
13267 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
13268 !! html/php
13269 <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>
13270
13271 !! html/parsoid
13272 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"{{echo|137px}}"},{"ck":"caption","ak":"This is a caption"}]}' data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[24,38,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"137px\"}},\"i\":0}}]}&#39;>137px&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/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"16","width":"137"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>This is a caption</figcaption></figure>
13273 !! end
13274
13275 !! test
13276 2. Block Image with individual attributes from templates
13277 !! wikitext
13278 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
13279 !! html/php
13280 <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>
13281
13282 !! html/parsoid
13283 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt3" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"{{echo|thumb}}"},{"ck":"width","ak":"{{echo|137px}}"},{"ck":"caption","ak":"This is a caption"}]}' data-mw='{"attribs":[["thumbnail",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[18,32,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"thumb\"}},\"i\":0}}]}&#39;>thumb&lt;/span>"}],["width",{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[33,47,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"137px\"}},\"i\":0}}]}&#39;>137px&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/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"16","width":"137"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>This is a caption</figcaption></figure>
13284 !! end
13285
13286 !! test
13287 3. Inline image with individual attributes from templates
13288 !! wikitext
13289 [[File:Foobar.jpg|{{echo|50px}}]]
13290 !! html/php
13291 <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>
13292 </p>
13293 !! html/parsoid
13294 <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=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[18,31,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"50px\"}},\"i\":0}}]}&#39;>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" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13295 !! end
13296
13297 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
13298 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
13299 !! test
13300 Image with multiple attributes from the same template
13301 !! wikitext
13302 [[File:Foobar.jpg|{{image_attribs}}]]
13303 !! html/php
13304 <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>
13305
13306 !! html/parsoid
13307 <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>
13308 !! end
13309
13310 !! test
13311 Image with link tails
13312 !! options
13313 thumbsize=220
13314 !! wikitext
13315 123[[File:Foobar.jpg]]456
13316 123[[File:Foobar.jpg|right]]456
13317 123[[File:Foobar.jpg|thumb]]456
13318 !! html/php
13319 <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
13320 </p>
13321 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
13322 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
13323
13324 !! html/php+tidy
13325 <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>
13326 <p>123</p>
13327 <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>
13328 <p>456 123</p>
13329 <div class="thumb tright">
13330 <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>
13331 <div class="thumbcaption">
13332 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
13333 </div>
13334 </div>
13335 </div>
13336 <p>456</p>
13337 !! html/parsoid
13338 <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>
13339 <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>
13340 <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>
13341 !! end
13342
13343 !! test
13344 Image with multiple captions -- only last one is accepted
13345 !! wikitext
13346 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
13347 !! html/php
13348 <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>
13349
13350 !! html/parsoid
13351 <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>
13352 !! end
13353
13354 !! test
13355 Image with multiple widths -- use last
13356 !! wikitext
13357 [[File:Foobar.jpg|200px|300px|caption]]
13358 !! html/php
13359 <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>
13360 </p>
13361 !! html/parsoid
13362 <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>
13363 !! end
13364
13365 !! test
13366 Image with multiple alignments -- use first (bug 48664)
13367 !! options
13368 thumbsize=220
13369 !! wikitext
13370 [[File:Foobar.jpg|thumb|left|right|center|caption]]
13371
13372 [[File:Foobar.jpg|middle|text-top|caption]]
13373 !! html/php
13374 <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>
13375 <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>
13376 </p>
13377 !! html/parsoid
13378 <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>
13379 <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>
13380 !! end
13381
13382 !! test
13383 Image with width attribute at different positions
13384 !! wikitext
13385 [[File:Foobar.jpg|200px|right|Caption]]
13386 [[File:Foobar.jpg|right|200px|Caption]]
13387 [[File:Foobar.jpg|right|Caption|200px]]
13388 !! html/php
13389 <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>
13390 <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>
13391 <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>
13392
13393 !! html/parsoid
13394 <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>
13395 <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>
13396 <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>
13397 !! end
13398
13399 # a sad bit of backward-compatibility
13400 !! test
13401 Image with size specified with pxpx (bug 13500, 51628)
13402 !! options
13403 parsoid=wt2html,wt2wt,html2html
13404 !! wikitext
13405 [[File:Foobar.jpg|20pxpx]]
13406 [[File:Foobar.jpg|200x20pxpx]]
13407 !! html/php
13408 <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>
13409 <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>
13410 </p>
13411 !! html/parsoid
13412 <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>
13413 !! end
13414
13415 !! test
13416 Image with link parameter, wiki target
13417 !! wikitext
13418 [[File:Foobar.jpg|link=Main Page]]
13419 !! html/php
13420 <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>
13421 </p>
13422 !! html/parsoid
13423 <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>
13424 !! end
13425
13426 # parsoid bug 49293 (part 1)
13427 !! test
13428 Image with link parameter, URL target
13429 !! wikitext
13430 [[File:Foobar.jpg|link=http://example.com/]]
13431 !! html/php
13432 <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>
13433 </p>
13434 !! html/parsoid
13435 <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>
13436 !! end
13437
13438 # parsoid bug 49293 (part 2)
13439 !! test
13440 Image with link parameter, protocol-less URL target
13441 !! wikitext
13442 [[File:Foobar.jpg|link=//example.com/]]
13443 !! html/php
13444 <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>
13445 </p>
13446 !! html/parsoid
13447 <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>
13448 !! end
13449
13450 !! test
13451 Escaping non-block captions (T107435)
13452 !! options
13453 parsoid={
13454 "modes": ["wt2wt"],
13455 "changes": [
13456 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13457 ]
13458 }
13459 !! wikitext
13460 [[Image:Foobar.jpg|caption]]
13461 !! wikitext/edited
13462 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13463 !! end
13464
13465 # wgExternalLinkTarget not supported by Parsoid
13466 !! test
13467 Image with link parameter, wgExternalLinkTarget
13468 !! wikitext
13469 [[Image:foobar.jpg|link=http://example.com/]]
13470 !! config
13471 wgExternalLinkTarget='foobar'
13472 !! html/php
13473 <p><a href="http://example.com/" target="foobar" rel="nofollow noreferrer noopener"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13474 </p>
13475 !! end
13476
13477 !! test
13478 Image with link parameter, wgNoFollowLinks set to false
13479 !! wikitext
13480 [[Image:foobar.jpg|link=http://example.com/]]
13481 !! config
13482 wgNoFollowLinks=false
13483 !! html
13484 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13485 </p>
13486 !! end
13487
13488 !! test
13489 Image with link parameter, wgNoFollowDomainExceptions
13490 !! wikitext
13491 [[Image:foobar.jpg|link=http://example.com/]]
13492 !! config
13493 wgNoFollowDomainExceptions='example.com'
13494 !! html
13495 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13496 </p>
13497 !! end
13498
13499 # wgExternalLinkTarget not supported by Parsoid
13500 !! test
13501 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13502 !! wikitext
13503 [[Image:foobar.jpg|link=http://example.com/|Title]]
13504 !! config
13505 wgExternalLinkTarget='foobar'
13506 !! html/php
13507 <p><a href="http://example.com/" title="Title" target="foobar" rel="nofollow noreferrer noopener"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13508 </p>
13509 !! end
13510
13511 !! test
13512 Image with empty link parameter
13513 !! wikitext
13514 [[File:Foobar.jpg|link=]]
13515 !! html/php
13516 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13517 </p>
13518 !! html/parsoid
13519 <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>
13520 !! end
13521
13522 !! test
13523 Image with link parameter (wiki target) and unnamed parameter
13524 !! wikitext
13525 [[File:Foobar.jpg|link=Main_Page|Title]]
13526 !! html/php
13527 <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>
13528 </p>
13529 !! html/parsoid
13530 <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>
13531 !! end
13532
13533 !! test
13534 Image with link parameter (URL target) and unnamed parameter
13535 !! wikitext
13536 [[File:Foobar.jpg|link=http://example.com/|Title]]
13537 !! html/php
13538 <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>
13539 </p>
13540 !! html/parsoid
13541 <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>
13542 !! end
13543
13544 !! test
13545 Thumbnail image with link parameter
13546 !! options
13547 thumbsize=220
13548 parsoid=wt2html,wt2wt,html2html
13549 !! wikitext
13550 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13551 !! html/php
13552 <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>
13553
13554 !! html/parsoid
13555 <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>
13556 !! end
13557
13558 !! test
13559 Manually-specified thumbnail image
13560 !! options
13561 thumbsize=220
13562 !! wikitext
13563 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13564 !! html/php
13565 <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>
13566
13567 !! html/parsoid
13568 <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>
13569 !! end
13570
13571 !! test
13572 Manually-specified thumbnail image with explicit link to wiki page
13573 !! options
13574 thumbsize=220
13575 parsoid=wt2html,wt2wt,html2html
13576 !! wikitext
13577 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13578 !! html/php
13579 <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>
13580
13581 !! html/parsoid
13582 <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>
13583 !! end
13584
13585 !! test
13586 Manually-specified thumbnail image with explicit link to url
13587 !! options
13588 thumbsize=220
13589 parsoid=wt2html,wt2wt,html2html
13590 !! wikitext
13591 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13592 !! html/php
13593 <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>
13594
13595 !! html/parsoid
13596 <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>
13597 !! end
13598
13599 !! test
13600 Manually-specified thumbnail image with explicit no link
13601 !! options
13602 thumbsize=220
13603 parsoid=wt2html,wt2wt,html2html
13604 !! wikitext
13605 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13606 !! html/php
13607 <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>
13608
13609 !! html/parsoid
13610 <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>
13611 !! end
13612
13613 !! test
13614 Manually-specified thumbnail image with explicit link and alt text
13615 !! options
13616 thumbsize=220
13617 parsoid=wt2html,wt2wt,html2html
13618 !! wikitext
13619 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13620 !! html/php
13621 <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>
13622
13623 !! html/parsoid
13624 <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>
13625 !! end
13626
13627 !! test
13628 Image with frame and link
13629 !! options
13630 parsoid=wt2html,wt2wt,html2html
13631 !! wikitext
13632 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13633 !! html/php
13634 <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>
13635
13636 !! html/parsoid
13637 <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>
13638 !! end
13639
13640 !! test
13641 Image with frame and link and explicit alt
13642 !! options
13643 parsoid=wt2html,wt2wt,html2html
13644 !! wikitext
13645 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13646 !! html/php
13647 <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>
13648
13649 !! html/parsoid
13650 <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>
13651 !! end
13652
13653 !! test
13654 Image with wiki markup in implicit alt
13655 !! wikitext
13656 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13657
13658 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13659 !! html/php
13660 <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>
13661 </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>
13662 </p>
13663 !! html/parsoid
13664 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt"}]}' data-mw='{"caption":"testing &lt;b data-parsoid=&#39;{\"dsr\":[27,37,3,3]}&#39;>bold&lt;/b> in alt"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"Image:Foobar.jpg"}}'/></a></span></p>
13665
13666 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"alt","ak":"alt=testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><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>
13667 !! end
13668
13669 !! test
13670 Alt image option should handle most kinds of wikitext without barfing
13671 !! wikitext
13672 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13673 !! html/php
13674 <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>
13675
13676 !! html/parsoid
13677 <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=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[65,73,2,2]}&#39;>link&lt;/a> and a &lt;i about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"dsr\":[80,106,null,null],\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;#39;&amp;#39;bold template&amp;#39;&amp;#39;\"}},\"i\":0}}]}&#39;>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>
13678 !! end
13679
13680 ###################
13681 # Conflicting image format options.
13682 # First option specified should 'win'.
13683 # All three cases in each test should be identical.
13684
13685 !! test
13686 Image with 'frameless' first.
13687 !! options
13688 parsoid=wt2html,wt2wt,html2html
13689 !! wikitext
13690 [[File:Foobar.jpg|frameless|caption]]
13691
13692 [[File:Foobar.jpg|frameless|frame|caption]]
13693
13694 [[File:Foobar.jpg|frameless|thumb|caption]]
13695 !! html/php
13696 <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>
13697 </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>
13698 </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>
13699 </p>
13700 !! html/parsoid
13701 <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>
13702 <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>
13703 <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>
13704 !! end
13705
13706 !! test
13707 Image with 'frame' first.
13708 !! options
13709 parsoid=wt2html,wt2wt,html2html
13710 !! wikitext
13711 [[File:Foobar.jpg|frame|caption]]
13712 [[File:Foobar.jpg|frame|frameless|caption]]
13713 [[File:Foobar.jpg|frame|thumb|caption]]
13714 !! html/php
13715 <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>
13716 <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>
13717 <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>
13718
13719 !! html/parsoid
13720 <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>
13721 <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>
13722 <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>
13723 !! end
13724
13725 !! test
13726 Image with 'thumb' first.
13727 !! options
13728 parsoid=wt2html,wt2wt,html2html
13729 !! wikitext
13730 [[File:Foobar.jpg|thumb|caption]]
13731 [[File:Foobar.jpg|thumb|frameless|caption]]
13732 [[File:Foobar.jpg|thumb|frame|caption]]
13733 !! html/php
13734 <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>
13735 <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>
13736 <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>
13737
13738 !! html/parsoid
13739 <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>
13740 <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>
13741 <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>
13742 !! end
13743
13744 ###################
13745 # Image sizing.
13746 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13747 # and https://phabricator.wikimedia.org/T64258
13748 # Foobar has actual size of 1941x220
13749 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13750 # a scalable format.
13751 # 2. Framed images always ignore size options; always render at default size.
13752 # 3. "Unspecified format" and border are the only types which can be
13753 # enlarged.
13754
13755 !! test
13756 Image: "unspecified format" and border enlarge
13757 !! options
13758 parsoid=wt2html,wt2wt,html2html
13759 !! wikitext
13760 [[File:Foobar.jpg|2000px]]
13761
13762 [[File:Foobar.jpg|border|2000px]]
13763 !! html/php
13764 <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>
13765 </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>
13766 </p>
13767 !! html/parsoid
13768 <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>
13769 <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>
13770 !! end
13771
13772 !! test
13773 Image: "unspecified format" and border reduce
13774 !! options
13775 parsoid=wt2html,wt2wt,html2html
13776 !! wikitext
13777 [[File:Foobar.jpg|1000px]]
13778
13779 [[File:Foobar.jpg|border|1000px]]
13780 !! html/php
13781 <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>
13782 </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>
13783 </p>
13784 !! html/parsoid
13785 <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>
13786 <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>
13787 !! end
13788
13789 !! test
13790 Image: thumbs reduce
13791 !! options
13792 parsoid=wt2html,wt2wt,html2html
13793 !! wikitext
13794 [[File:Foobar.jpg|thumb|50px]]
13795 !! html/php
13796 <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>
13797
13798 !! html/parsoid
13799 <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>
13800 !! end
13801
13802 !! test
13803 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13804 !! options
13805 parsoid=wt2html,wt2wt,html2html
13806 !! wikitext
13807 [[File:Foobar.jpg|thumb|2000px]]
13808
13809 [[File:Foobar.svg|thumb|2000px]]
13810 !! html/php
13811 <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>
13812 <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>
13813
13814 !! html/parsoid
13815 <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>
13816 <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>
13817 !! end
13818
13819 !! test
13820 Image: frameless can reduce in size
13821 !! options
13822 parsoid=wt2html,wt2wt,html2html
13823 !! wikitext
13824 [[File:Foobar.jpg|frameless|50px]]
13825 !! html/php
13826 <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>
13827 </p>
13828 !! html/parsoid
13829 <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>
13830 !! end
13831
13832 !! test
13833 Image: bitmap frameless can't be enlarged past original size, but vector can
13834 !! options
13835 parsoid=wt2html,wt2wt,html2html
13836 !! wikitext
13837 [[File:Foobar.jpg|frameless|2000px]]
13838
13839 [[File:Foobar.svg|frameless|2000px]]
13840 !! html/php
13841 <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>
13842 </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>
13843 </p>
13844 !! html/parsoid
13845 <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>
13846 <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>
13847 !! end
13848
13849 !! test
13850 Image: framed images are always unscaled.
13851 !! options
13852 parsoid=wt2html,wt2wt,html2html
13853 !! wikitext
13854 [[File:Foobar.jpg|frame]]
13855
13856 [[File:Foobar.jpg|frame|50px]]
13857
13858 [[File:Foobar.jpg|frame|50x50px]]
13859
13860 [[File:Foobar.jpg|frame|2000px]]
13861 !! html/php
13862 <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>
13863 <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>
13864 <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>
13865 <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>
13866
13867 !! html/parsoid
13868 <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>
13869 <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>
13870 <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>
13871 <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>
13872 !! end
13873
13874 ###################
13875
13876 !! test
13877 Link to image page- image page normally doesn't exists, hence edit link
13878 Add test with existing image page
13879 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13880 !! wikitext
13881 [[:Image:test]]
13882 !! html
13883 <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>
13884 </p>
13885 !! end
13886
13887 !! test
13888 bug 18784 Link to non-existent image page with caption should use caption as link text
13889 !! wikitext
13890 [[:Image:test|caption]]
13891 !! html
13892 <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>
13893 </p>
13894 !! end
13895
13896 !! test
13897 Frameless image caption with a free URL
13898 !! wikitext
13899 [[File:Foobar.jpg|http://example.com]]
13900 !! html/php
13901 <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>
13902 </p>
13903 !! html/parsoid
13904 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"http://example.com"}]}' data-mw='{"caption":"&lt;a rel=\"mw:ExtLink\" href=\"http://example.com\" data-parsoid=&#39;{\"stx\":\"url\",\"dsr\":[18,36,0,0]}&#39;>http://example.com&lt;/a>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13905 !! end
13906
13907 !! test
13908 Thumbnail image caption with a free URL
13909 !! options
13910 thumbsize=220
13911 !! wikitext
13912 [[File:Foobar.jpg|thumb|http://example.com]]
13913 !! html/php
13914 <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>
13915
13916 !! html/parsoid
13917 <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>
13918 !! end
13919
13920 !! test
13921 Thumbnail image caption with a free URL and explicit alt
13922 !! options
13923 thumbsize=220
13924 parsoid=wt2html,wt2wt,html2html
13925 !! wikitext
13926 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13927 !! html/php
13928 <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>
13929
13930 !! html/parsoid
13931 <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>
13932 !! end
13933
13934 !! test
13935 SVG thumbnails with no language set
13936 !! options
13937 !! wikitext
13938 [[File:Foobar.svg|thumb|caption]]
13939 !! html/php
13940 <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>
13941
13942 !! html/parsoid
13943 <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>
13944 !! end
13945
13946 !! test
13947 SVG thumbnails with language de
13948 !! options
13949 parsoid=wt2html,wt2wt,html2html
13950 !! wikitext
13951 [[File:Foobar.svg|thumb|caption|lang=de]]
13952 !! html/php
13953 <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>
13954
13955 !! html/parsoid
13956 <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>
13957 !! end
13958
13959 !! test
13960 SVG thumbnails with invalid language code
13961 !! options
13962 parsoid=wt2html,wt2wt,html2html
13963 !! wikitext
13964 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
13965 !! html/php
13966 <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>
13967
13968 !! html/parsoid
13969 <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>
13970 !! end
13971
13972 !! test
13973 BUG 1887: A ISBN with a thumbnail
13974 !! wikitext
13975 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
13976 !! html/php
13977 <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>
13978
13979 !! html/parsoid
13980 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="./Special:BookSources/1235467890" rel="mw:WikiLink">ISBN 1235467890</a></figcaption></figure>
13981 !! end
13982
13983 !! test
13984 BUG 1887: A RFC with a thumbnail
13985 !! wikitext
13986 [[File:Foobar.jpg|thumb|This is RFC 12354]]
13987 !! html/php
13988 <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>
13989
13990 !! html/parsoid
13991 <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>
13992 !! end
13993
13994 !! test
13995 BUG 1887: A mailto link with a thumbnail
13996 !! wikitext
13997 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
13998 !! html/php
13999 <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>
14000
14001 !! html/parsoid
14002 <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>
14003 !! end
14004
14005 # Pending resolution to bug 368
14006 !! test
14007 BUG 648: Frameless image caption with a link
14008 !! wikitext
14009 [[File:Foobar.jpg|text with a [[link]] in it]]
14010 !! html/php
14011 <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>
14012 </p>
14013 !! html/parsoid
14014 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[link]] in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[30,38,2,2]}&#39;>link&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14015 !! end
14016
14017 !! test
14018 BUG 648: Frameless image caption with a link (suffix)
14019 !! wikitext
14020 [[File:Foobar.jpg|text with a [[link]]foo in it]]
14021 !! html/php
14022 <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>
14023 </p>
14024 !! html/parsoid
14025 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[link]]foo in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[30,41,2,5],\"tail\":\"foo\"}&#39;>linkfoo&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14026 !! end
14027
14028 !! test
14029 BUG 648: Frameless image caption with an interwiki link
14030 !! wikitext
14031 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
14032 !! html/php
14033 <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>
14034 </p>
14035 !! html/parsoid
14036 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[MeatBall:Link]] in it"}]}' 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=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"http://www.usemod.com/cgi-bin/mb.pl?Link\"},\"sa\":{\"href\":\"MeatBall:Link\"},\"isIW\":true,\"dsr\":[30,47,2,2]}&#39;>MeatBall:Link&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14037 !! end
14038
14039 !! test
14040 BUG 648: Frameless image caption with a piped interwiki link
14041 !! wikitext
14042 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
14043 !! html/php
14044 <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>
14045 </p>
14046 !! html/parsoid
14047 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[MeatBall:Link|link]] in it"}]}' 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=&#39;{\"stx\":\"piped\",\"a\":{\"href\":\"http://www.usemod.com/cgi-bin/mb.pl?Link\"},\"sa\":{\"href\":\"MeatBall:Link\"},\"isIW\":true,\"dsr\":[30,52,16,2]}&#39;>link&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14048 !! end
14049
14050 !! test
14051 T107474: Frameless image caption with <nowiki>
14052 !! wikitext
14053 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
14054 !! html/parsoid
14055 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;nowiki>text with a [[MeatBall:Link|link]] in it&lt;/nowiki>"}]}' data-mw='{"caption":"&lt;span typeof=\"mw:Nowiki\" data-parsoid=&#39;{\"dsr\":[18,75,8,9]}&#39;>text with a [[MeatBall:Link|link]] in it&lt;/span>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14056 !! end
14057
14058 !! test
14059 Escape HTML special chars in image alt text
14060 !! wikitext
14061 [[File:Foobar.jpg|& < > "]]
14062 !! html/php
14063 <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>
14064 </p>
14065 !! html/parsoid
14066 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp; &lt; > \""}]}' data-mw='{"caption":"&amp;amp; &amp;lt; > \""}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14067 !! end
14068
14069 !! test
14070 Entities in file name and attributes
14071 !! wikitext
14072 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
14073 !! html/php
14074 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
14075 </p>
14076 !! html/parsoid
14077 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"bogus","ak":"manualthumb=7%25 solution.gif"},{"ck":"link","ak":"link=7%25 solution"},{"ck":"caption","ak":"[[7%25 solution]]"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;a rel=\"mw:WikiLink\" href=\"./7%25_solution\" title=\"7% solution\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./7%25_solution\"},\"sa\":{\"href\":\"7%25 solution\"},\"dsr\":[74,91,2,2]}&#39;>7% solution&lt;/a>"}'><a href="./7%25_solution" data-parsoid='{"a":{"href":"./7%25_solution"},"sa":{"href":"link=7%25 solution"}}'><img resource="./File:7%25_solution.gif" src="./Special:FilePath/7%25_solution.gif" height="220" width="220" data-parsoid='{"a":{"resource":"./File:7%25_solution.gif","height":"220","width":"220"},"sa":{"resource":"File:7%25 solution.gif"}}'/></a></span></p>
14078 !! end
14079
14080 !! test
14081 BUG 499: Alt text should have &#1234;, not &amp;1234;
14082 !! wikitext
14083 [[File:Foobar.jpg|&#9792;]]
14084 !! html/php
14085 <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>
14086 </p>
14087 !! html/parsoid
14088 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp;#9792;"}]}' data-mw='{"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=&#39;{\"src\":\"&amp;amp;#9792;\",\"srcContent\":\"♀\",\"dsr\":[18,25,null,null]}&#39;>♀&lt;/span>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14089 !! end
14090
14091 !! test
14092 Broken image caption with link
14093 !! options
14094 parsoid=wt2html,wt2wt,html2html
14095 !! wikitext
14096 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
14097 !! html/php
14098 <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.
14099 </p>
14100 !! html/parsoid
14101 <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>
14102 !! end
14103
14104 !! test
14105 Image caption containing another image
14106 !! wikitext
14107 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
14108 !! html/php
14109 <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>
14110
14111 !! html/parsoid
14112 <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>
14113 !! end
14114
14115 !! test
14116 Image: caption containing a newline
14117 !! wikitext
14118 [[File:Foobar.jpg|This
14119 *is some text]]
14120 !! html/php
14121 <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>
14122 </p>
14123 !! html/parsoid
14124 <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>
14125 !!end
14126
14127 !!test
14128 Image: caption containing leading space
14129 (The leading space should not trigger nowiki escaping in wt2wt mode)
14130 !! wikitext
14131 [[File:Foobar.jpg|thumb| bar]]
14132 !! html/php
14133 <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>
14134
14135 !! html/parsoid
14136 <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>
14137 !!end
14138
14139 !! test
14140 Image: caption containing a table
14141 !! options
14142 parsoid=wt2html,wt2wt,html2html
14143 !! wikitext
14144 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
14145 {|
14146 ! Foo !! Bar
14147 |-
14148 | Foo1 || Bar1
14149 |}
14150 and some more text.]]
14151 !! html/php
14152 <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>
14153
14154 !! html/parsoid
14155 <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
14156 <table>
14157 <tbody>
14158 <tr><th>Foo </th><th>Bar</th></tr>
14159 <tr>
14160 <td>Foo1 </td>
14161 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
14162 !! end
14163
14164 !! test
14165 Bug 3090: External links other than http: in image captions
14166 !! wikitext
14167 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
14168 !! html/php
14169 <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>
14170
14171 !! html/parsoid
14172 <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>
14173 !! end
14174
14175 !! test
14176 Custom class
14177 !! options
14178 parsoid=wt2html,wt2wt,html2html
14179 !! wikitext
14180 [[Image:foobar.jpg|a|class=b]]
14181 !! html/php
14182 <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>
14183 </p>
14184 !! html/parsoid
14185 <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>
14186 !! end
14187
14188 !! test
14189 Localized image handling (1).
14190 !! options
14191 parsoid=wt2html,wt2wt,html2html
14192 language=es
14193 !! wikitext
14194 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
14195 !! html/php
14196 <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>
14197
14198 !! html/parsoid
14199 <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>
14200 !! end
14201
14202 !! test
14203 Localized image handling (2).
14204 !! options
14205 thumbsize=220
14206 parsoid=wt2html,wt2wt,html2html
14207 language=es
14208 !! wikitext
14209 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
14210 !! html/php
14211 <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>
14212
14213 !! html/parsoid
14214 <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>
14215 !! end
14216
14217 !! test
14218 Localized image handling (3).
14219 !! options
14220 language=fa
14221 parsoid=html2wt
14222 !! html/parsoid
14223 <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>
14224 !! wikitext
14225 [[File:Foobar.jpg|بندانگشتی]]
14226 !! end
14227
14228 !! test
14229 "border", "frameless" and "class" attributes on an image.
14230 !! options
14231 thumbsize=220
14232 parsoid=wt2html,wt2wt,html2html
14233 !! wikitext
14234 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
14235 !! html/php
14236 <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>
14237 </p>
14238 !! html/parsoid
14239 <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>
14240 !! end
14241
14242 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
14243 !! test
14244 Invalid image attributes (bug 62500)
14245 !! options
14246 thumbsize=220
14247 parsoid=wt2html,wt2wt,html2html
14248 !! wikitext
14249 [[File:Foobar.jpg|thumb|float|left|caption]]
14250
14251 [[File:Foobar.jpg|thumb|righ|caption]]
14252
14253 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
14254 !! html/php
14255 <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>
14256 <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>
14257 <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>
14258
14259 !! html/parsoid
14260 <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>
14261 <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>
14262 <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>
14263 !! end
14264
14265 !! article
14266 File:Barfoo.jpg
14267 !! text
14268 #REDIRECT [[File:Barfoo.jpg]]
14269 !! endarticle
14270
14271 # FIXME: Parsoid should run this test -- but we'd need to teach the
14272 # mockAPI about the redirected Barfoo.jpg image.
14273 !! test
14274 Redirected image
14275 !! wikitext
14276 [[Image:Barfoo.jpg]]
14277 !! html/php
14278 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
14279 </p>
14280 !! end
14281
14282 !! test
14283 Missing image with uploads disabled
14284 !! options
14285 wgEnableUploads=0
14286 !! wikitext
14287 [[File:Foobaz.jpg]]
14288 !! html/php
14289 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
14290 </p>
14291 !! html/parsoid
14292 <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>
14293 !! end
14294
14295 # Parsoid-specific testing for images
14296 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14297 # Currently imperfect due to a flaw in the Parsoid testrunner
14298 # Work in progress
14299 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
14300 # image tests.
14301
14302 !! test
14303 Parsoid-specific image handling - simple image with size and middle alignment
14304 !! wikitext
14305 [[File:Foobar.jpg|middle|50px]]
14306 !! html/parsoid
14307 <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>
14308 !! end
14309
14310 !! test
14311 Parsoid-specific image handling - simple image with size, middle alignment,
14312 non-standard namespace alias
14313 !! options
14314 parsoid=wt2wt,wt2html,html2html
14315 !! wikitext
14316 [[Image:Foobar.jpg|middle|50px]]
14317 !! html/parsoid
14318 <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>
14319 !! end
14320
14321 !! test
14322 Parsoid-specific image handling - simple image with size and middle alignment
14323 (existing content)
14324 !! wikitext
14325 [[File:Foobar.jpg|50px|middle]]
14326 !! html/parsoid
14327 <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>
14328 !! end
14329
14330 !! test
14331 Parsoid-specific image handling - simple image with size and middle alignment
14332 and non-standard namespace name
14333 !! options
14334 parsoid=wt2html,wt2wt,html2html
14335 !! wikitext
14336 [[Image:Foobar.jpg|50px|middle]]
14337 !! html/parsoid
14338 <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>
14339 !! end
14340
14341 !! test
14342 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
14343 !! wikitext
14344 [[File:Foobar.jpg|500x10px|baseline|caption]]
14345 !! html/parsoid
14346 <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>
14347 !! end
14348
14349 !! test
14350 Parsoid-specific image handling - simple image with border and size spec
14351 !! wikitext
14352 [[File:Foobar.jpg|50px|border|caption]]
14353 !! html/parsoid
14354 <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>
14355 !! end
14356
14357 !! test
14358 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14359 !! wikitext
14360 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
14361 !! html/parsoid
14362 <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>
14363 !! end
14364
14365 !! test
14366 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14367 (existing content)
14368 !! wikitext
14369 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
14370 !! html/parsoid
14371 <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>
14372 !! end
14373
14374 !! test
14375 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
14376 !! wikitext
14377 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
14378 !! html/parsoid
14379 <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>
14380 !! end
14381
14382 !! test
14383 Parsoid-specific image handling - thumbnail with specific size, halign,
14384 valign, and caption (existing content)
14385 !! wikitext
14386 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
14387 !! html/parsoid
14388 <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>
14389 !! end
14390
14391 !! test
14392 Parsoid-specific image handling - framed image with specific size and caption
14393 (size is ignored)
14394 !! options
14395 parsoid=wt2html,wt2wt,html2html
14396 !! wikitext
14397 [[File:Foobar.jpg|frame|500x50px|caption]]
14398 !! html/parsoid
14399 <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>
14400 !! end
14401
14402 !! test
14403 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14404 (size is ignored)
14405 !! options
14406 parsoid=wt2html,wt2wt,html2html
14407 !! wikitext
14408 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14409 !! html/parsoid
14410 <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>
14411 !! end
14412
14413 !! test
14414 Parsoid-specific image handling - frameless image with specific size, border, and caption
14415 !! wikitext
14416 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14417 !! html/parsoid
14418 <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>
14419 !! end
14420
14421 !! test
14422 Parsoid-specific image handling - simple image with a formatted caption
14423 !! wikitext
14424 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14425 !! html/parsoid
14426 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;table>&lt;tr>&lt;td>a&lt;/td>&lt;td>b&lt;/td>&lt;/tr>&lt;tr>&lt;td>c&lt;/td>&lt;/tr>&lt;/table>"}]}' data-mw='{"caption":"&lt;table data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[18,81,7,8]}&#39;>&lt;tbody data-parsoid=&#39;{\"dsr\":[25,73,0,0]}&#39;>&lt;tr data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[25,54,4,5]}&#39;>&lt;td data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[29,39,4,5]}&#39;>a&lt;/td>&lt;td data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[39,49,4,5]}&#39;>b&lt;/td>&lt;/tr>&lt;tr data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[54,73,4,5]}&#39;>&lt;td data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[58,68,4,5]}&#39;>c&lt;/td>&lt;/tr>&lt;/tbody>&lt;/table>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14427 !! end
14428
14429 !! test
14430 Parsoid-specific image handling - caption with a template in it
14431 !! wikitext
14432 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14433 !! html/parsoid
14434 <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>
14435 !! end
14436
14437 !! test
14438 Parsoid-specific image handling - caption with unbalanced tags in it
14439 !! options
14440 parsoid=wt2html,wt2wt,html2html
14441 !! wikitext
14442 foo
14443 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14444 bar
14445 !! html/parsoid
14446 <p>foo</p>
14447 <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>
14448 <p>bar</p>
14449 !! end
14450
14451 !! test
14452 Parsoid-specific image handling - empty caption (1)
14453 !! options
14454 parsoid=wt2html,wt2wt
14455 !! wikitext
14456 [[File:Foobar.jpg|thumb|]]
14457 !! html/parsoid
14458 <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>
14459 !! end
14460
14461 # empty captions don't get serialized unless we're in the "round trip" case
14462 !! test
14463 Parsoid-specific image handling - empty caption (2)
14464 !! options
14465 parsoid=html2wt
14466 !! html/parsoid
14467 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14468 <a href="./File:Foobar.jpg">
14469 <img resource="./File:Foobar.jpg"
14470 src="//example.com/images/3/3a/Foobar.jpg"
14471 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14472 height="25" width="220"/>
14473 </a>
14474 <figcaption></figcaption>
14475 </figure>
14476 !! wikitext
14477 [[File:Foobar.jpg|thumb]]
14478 !! end
14479
14480 !! test
14481 Parsoid-specific image handling - whitespace caption
14482 !! wikitext
14483 [[File:Foobar.jpg|thumb| ]]
14484 !! html/parsoid
14485 <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>
14486 !! end
14487
14488 !! test
14489 Parsoid-specific image handling - lang option
14490 !! wikitext
14491 foo
14492 [[File:Foobar.svg|lang=de|caption]]
14493 bar
14494 !! html/parsoid
14495 <p>foo
14496 <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>
14497 bar</p>
14498 !! end
14499
14500 ## Edge case bugs in Parsoid from T93580
14501 !! test
14502 T93580: 1. Templated <ref> inside block images
14503 !! wikitext
14504 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14505
14506 <references />
14507 !! html/parsoid
14508 <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Caption with templated ref: {{echo|&lt;ref>foo&lt;/ref>}}"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>Caption with templated ref: <span about="#mwt5" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;ref>foo&lt;/ref>"}},"i":0}}]}'><a href="#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></figcaption></figure>
14509
14510 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
14511 !! end
14512
14513 !! test
14514 T93580: 2. <ref> inside inline images
14515 !! wikitext
14516 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14517
14518 <references />
14519 !! html/parsoid
14520 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: &lt;ref>foo&lt;/ref>"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;span about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[64,78,5,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-1\"},\"attrs\":{}}&#39;>&lt;a href=\"#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=&#39;{\"group\":\"\",\"name\":\"\",\"content\":\"foo\",\"hasRefInRef\":false,\"dsr\":[64,78,5,6]}&#39;/>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14521
14522 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
14523 !! end
14524
14525 !! test
14526 T93580: 3. Templated <ref> inside inline images
14527 !! wikitext
14528 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14529
14530 <references />
14531 !! html/parsoid
14532 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: {{echo|&lt;ref>{{echo|foo}}&lt;/ref>}}"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;span about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Transclusion mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[64,96,null,null],\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;lt;ref>{{echo|foo}}&amp;lt;/ref>\"}},\"i\":0}}]}&#39;>&lt;a href=\"#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Transclusion mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=&#39;{\"group\":\"\",\"name\":\"\",\"content\":\"foo\",\"hasRefInRef\":false,\"dsr\":[64,96,null,null],\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;lt;ref>{{echo|foo}}&amp;lt;/ref>\"}},\"i\":0}}]}&#39;/>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14533
14534 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
14535 !! end
14536
14537 ###
14538 ### Subpages
14539 ###
14540 !! article
14541 Subpage test/subpage
14542 !! text
14543 foo
14544 !! endarticle
14545
14546 !! test
14547 Subpage link
14548 !! options
14549 subpage title=[[Subpage test]]
14550 !! wikitext
14551 [[/subpage]]
14552 !! html
14553 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14554 </p>
14555 !! end
14556
14557 !! test
14558 Subpage noslash link
14559 !! options
14560 subpage title=[[Subpage test]]
14561 !! wikitext
14562 [[/subpage/]]
14563 !! html
14564 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14565 </p>
14566 !! end
14567
14568 !! article
14569 Subpage test/1/2/subpage
14570 !! text
14571 blah
14572 !! endarticle
14573
14574 !! test
14575 Relative subpage noslash link
14576 !! options
14577 parsoid=wt2wt,wt2html,html2html
14578 subpage title=[[Subpage test/1/2/3/4]]
14579 !! wikitext
14580 [[../../subpage/]]
14581
14582 [[../../subpage]]
14583 !! html/php
14584 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14585 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14586 </p>
14587 !! html/parsoid
14588 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14589 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14590 !! end
14591
14592 !! test
14593 Parsoid: dot-slash prefixed wikilinks
14594 !! wikitext
14595 [[./foo]]
14596
14597 [[././bar]]
14598
14599 [[././baz/]]
14600 !! html/php
14601 <p>[[./foo]]
14602 </p><p>[[././bar]]
14603 </p><p>[[././baz/]]
14604 </p>
14605 !! html/parsoid
14606 <p>[[./foo]]
14607 </p><p>[[././bar]]
14608 </p><p>[[././baz/]]
14609 </p>
14610 !! end
14611
14612 !! test
14613 Render invalid page names as plain text (bug 51090)
14614 !! wikitext
14615 [[./../foo|bar]]
14616 [[foo�|bar]]
14617 [[foo/.|bar]]
14618 [[foo/..|bar]]
14619 [[foo~~~bar]]
14620 [[foo>bar]]
14621 [[foo[bar]]
14622 [[.]]
14623 [[..]]
14624 [[foo././bar]]
14625
14626 [[{{echo|./../foo}}|bar]]
14627 [[{{echo|foo/.}}|bar]]
14628 [[{{echo|foo/..}}|bar]]
14629 [[{{echo|foo~~~~bar}}]]
14630 [[{{echo|foo>bar}}]]
14631 [[{{echo|foo././bar}}]]
14632 [[{{echo|foo{bar}}]]
14633 [[{{echo|foo}bar}}]]
14634 [[{{echo|foo[bar}}]]
14635 [[{{echo|foo]bar}}]]
14636 [[{{echo|foo<bar}}]]
14637 !!html/php
14638 <p>[[./../foo|bar]]
14639 [[foo�|bar]]
14640 [[foo/.|bar]]
14641 [[foo/..|bar]]
14642 [[foo~~~bar]]
14643 [[foo&gt;bar]]
14644 [[foo[bar]]
14645 [[.]]
14646 [[..]]
14647 [[foo././bar]]
14648 </p><p>[[./../foo|bar]]
14649 [[foo/.|bar]]
14650 [[foo/..|bar]]
14651 [[foo~~~~bar]]
14652 [[foo&gt;bar]]
14653 [[foo././bar]]
14654 [[foo{bar]]
14655 [[foo}bar]]
14656 [[foo[bar]]
14657 [[foo]bar]]
14658 [[foo&lt;bar]]
14659 </p>
14660 !!html/parsoid
14661 <p>[[./../foo|bar]]
14662 [[foo�|bar]]
14663 [[foo/.|bar]]
14664 [[foo/..|bar]]
14665 [[foo~~~bar]]
14666 [[foo>bar]]
14667 [[foo[bar]]
14668 [[.]]
14669 [[..]]
14670 [[foo././bar]]</p>
14671
14672 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14673 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14674 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14675 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14676 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14677 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14678 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14679 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14680 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14681 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14682 [[<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>
14683 !!end
14684
14685 !! test
14686 Disabled subpages
14687 !! wikitext
14688 [[/subpage]]
14689 !! html
14690 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14691 </p>
14692 !! end
14693
14694 !! test
14695 BUG 561: {{/Subpage}}
14696 !! options
14697 subpage title=[[Page]]
14698 !! wikitext
14699 {{/Subpage}}
14700 !! html
14701 <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>
14702 </p>
14703 !! end
14704
14705 ###
14706 ### Categories
14707 ###
14708 !! article
14709 Category:MediaWiki User's Guide
14710 !! text
14711 blah
14712 !! endarticle
14713
14714 !! test
14715 Link to category
14716 !! wikitext
14717 [[:Category:MediaWiki User's Guide]]
14718 !! html
14719 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14720 </p>
14721 !! end
14722
14723 !! test
14724 Simple category
14725 !! options
14726 cat
14727 !! wikitext
14728 [[Category:MediaWiki User's Guide]]
14729 !! html
14730 cat=MediaWiki_User's_Guide sort=
14731 !! end
14732
14733 !! test
14734 PAGESINCATEGORY invalid title fatal (r33546 fix)
14735 !! wikitext
14736 {{PAGESINCATEGORY:<bogus>}}
14737 !! html
14738 <p>0
14739 </p>
14740 !! end
14741
14742 !! test
14743 Category with different sort key
14744 !! options
14745 cat
14746 !! wikitext
14747 [[Category:MediaWiki User's Guide|Foo]]
14748 !! html
14749 cat=MediaWiki_User's_Guide sort=Foo
14750 !! end
14751
14752 !! test
14753 Category with identical sort key
14754 !! options
14755 cat
14756 !! wikitext
14757 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14758 !! html
14759 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
14760 !! end
14761
14762 !! test
14763 Category with empty sort key
14764 !! options
14765 cat
14766 pst
14767 !! wikitext
14768 [[Category:MediaWiki User's Guide|]]
14769 !! html/php
14770 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14771 !! end
14772
14773 !! test
14774 Category with empty sort key and parentheses
14775 !! options
14776 cat
14777 pst
14778 !! wikitext
14779 [[Category:Foo (bar)|]]
14780 !! html/php
14781 [[Category:Foo (bar)|Foo]]
14782 !! end
14783
14784 ## We used to, but no longer wt2wt this test since the default serializer
14785 ## will normalize all categories to serialize on their own line.
14786 ## This wikitext usage is going to be fairly uncommon in production and
14787 ## selser will take care of preserving formatting in those scenarios.
14788 !! test
14789 Category with link tail
14790 !! options
14791 cat
14792 pst
14793 parsoid=wt2html
14794 !! wikitext
14795 123[[Category:Foo]]456
14796 !! html/php
14797 123[[Category:Foo]]456
14798 !! html/parsoid
14799 <p>123<link rel="mw:PageProp/Category" href="Category:Foo"/>456</p>
14800 !! end
14801
14802 !! test
14803 Category with template
14804 !! options
14805 cat
14806 pst
14807 !! wikitext
14808 [[Category:{{echo|Foo}}]]
14809 !! html/php
14810 [[Category:{{echo|Foo}}]]
14811 !! end
14812
14813 !! test
14814 Category with template in sort key
14815 !! options
14816 cat
14817 pst
14818 !! wikitext
14819 [[Category:Foo|{{echo|Bar}}]]
14820 !! html/php
14821 [[Category:Foo|{{echo|Bar}}]]
14822 !! end
14823
14824 !! test
14825 Category with template in sort key and title
14826 !! options
14827 cat
14828 pst
14829 !! wikitext
14830 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14831 !! html/php
14832 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14833 !! end
14834
14835 ## We used to, but no longer wt2wt this test since the default serializer
14836 ## will normalize all categories to serialize on their own line.
14837 ## This wikitext usage is going to be fairly uncommon in production and
14838 ## selser will take care of preserving formatting in those scenarios.
14839 !! test
14840 Category / paragraph interactions
14841 !! options
14842 parsoid=wt2html
14843 !! wikitext
14844 Foo [[Category:Baz]] Bar
14845
14846 Foo [[Category:Baz]]
14847 Bar
14848
14849 Foo
14850 [[Category:Baz]]
14851 Bar
14852
14853 Foo
14854 [[Category:Baz]] Bar
14855
14856 Foo
14857 [[Category:Baz]]
14858 [[Category:Baz]]
14859 [[Category:Baz]]
14860 Bar
14861
14862 [[Category:Baz]]
14863 [[Category:Baz]]
14864 [[Category:Baz]]
14865
14866 [[Category:Baz]]
14867 {{echo|[[Category:Baz]]}}
14868 [[Category:Baz]]
14869 !! html/php
14870 <p>Foo Bar
14871 </p><p>Foo
14872 Bar
14873 </p><p>Foo
14874 Bar
14875 </p><p>Foo Bar
14876 </p><p>Foo
14877 Bar
14878 </p>
14879 !! html/parsoid
14880 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14881 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14882 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14883 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14884 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz"/> <link rel="mw:PageProp/Category" href="Category:Baz" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Baz]]"}},"i":0}}]}'/></p>
14885 <link rel="mw:PageProp/Category" href="Category:Baz"/>
14886 !! end
14887
14888 ## We used to, but no longer wt2wt this test since the default serializer
14889 ## will normalize all categories to serialize on their own line.
14890 ## This wikitext usage is going to be fairly uncommon in production and
14891 ## selser will take care of preserving formatting in those scenarios.
14892 ##
14893 ## The whitespace on the empty line is part of the test. Please do not delete
14894 !! test
14895 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14896 !! options
14897 parsoid=wt2html
14898 !! wikitext
14899 This
14900
14901 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14902
14903 {{echo|[[Category:Foo]] and so should this!}}
14904 !! html/php
14905 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14906 </p>
14907 !! html/parsoid
14908 <p>This
14909
14910 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14911
14912 <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>
14913 !! end
14914
14915 ## Parsoid will not try to wt2wt this while preserving newlines because
14916 ## it suppresses excess newlines within list items -- and we don't want to
14917 ## introduce a special case just for categories, which is, in reality somewhat
14918 ## odd behavior -- categories are unlikely to be used in list items like this
14919 ## in top-level pages and are only likely to show up in template-generated
14920 ## list items where this RT-ing is a non-issue.
14921 ##
14922 ## The whitespace on the empty line is part of the test. Please do not delete
14923 !! test
14924 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14925 !! options
14926 parsoid=wt2html
14927 !! wikitext
14928 * This
14929
14930 [[Category:Foo]] and this should be part of the same list item
14931 * So should this
14932
14933 {{echo|[[Category:Foo]] and this should be part of the same list item}}
14934 !! html
14935 <ul><li>This and this should be part of the same list item</li>
14936 <li>So should this and this should be part of the same list item</li></ul>
14937 !! html/parsoid
14938 <ul>
14939 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
14940 <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>
14941 </ul>
14942 !! end
14943
14944 ## Newlines and categories that follow the last item of a list
14945 ## are treated differently because this (list followed by categories)
14946 ## is an extremely common pattern on wikis.
14947 !! test
14948 3. Categories and newlines: newline suppression for last list item should RT properly
14949 !! wikitext
14950 * a
14951 * b
14952
14953 [[Category:Foo]]
14954
14955 [[Category:Bar]]
14956 [[Category:Baz]]
14957 !! html/parsoid
14958 <ul><li> a</li>
14959 <li> b</li></ul>
14960
14961 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14962
14963 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14964 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14965 !! end
14966
14967 !! test
14968 4. Categories and newlines: newline suppression for last list item should RT properly
14969 !! wikitext
14970 * a
14971 **** b
14972
14973 [[Category:Foo]]
14974 !! html/parsoid
14975 <ul><li> a
14976 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
14977
14978 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14979 !! end
14980
14981 ## only wt2html for this to make sure the algo only applies to the rightmost path
14982 !! test
14983 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
14984 !! options
14985 parsoid=wt2html
14986 !! wikitext
14987 * a
14988 ** b
14989 [[Category:Foo]]
14990 * c
14991 ** d
14992 [[Category:Foo]]
14993 !! html/parsoid
14994 <ul><li> a
14995 <ul><li> b
14996 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
14997 <li> c
14998 <ul><li> d</li></ul></li></ul>
14999 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15000 !! end
15001
15002 ## We used to, but no longer wt2wt this test since the default serializer
15003 ## will normalize all categories to serialize on their own line.
15004 ## This wikitext usage is going to be fairly uncommon in production and
15005 ## selser will take care of preserving formatting in those scenarios.
15006 !! test
15007 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
15008 !! options
15009 parsoid=wt2html
15010 !! wikitext
15011 * a [[Category:Foo]]
15012 !! html/parsoid
15013 <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>
15014 !! end
15015
15016 # This test also demonstrates because of newline+category tunneling
15017 # through the list hander, template wrapping doesn't expand to the
15018 # containing list when the list item swallows the category.
15019 !! test
15020 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
15021 !! wikitext
15022 * {{echo|a
15023 [[Category:Foo]]}}
15024 !! html/parsoid
15025 <ul><li> <span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n[[Category:Foo]]"}},"i":0}}]}'>a
15026 </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>
15027 !! end
15028
15029 !! test
15030 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
15031 !! wikitext
15032 * a
15033
15034 {{echo|[[Category:Foo]]
15035 [[Category:Bar]]}}
15036 [[Category:Baz]]
15037 !! html/parsoid
15038 <ul><li> a</li></ul>
15039
15040 <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"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]]\n[[Category:Bar]]"}},"i":0}}]}'/><span about="#mwt1">
15041 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15042 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15043 !! end
15044
15045 !! test
15046 Category links with multiple namespaces
15047 !! wikitext
15048 [[Category:Project:Foo]]
15049 !! html/parsoid
15050 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
15051 !! end
15052
15053 !! test
15054 Parsoid: Serialize link to category page with colon escape
15055 !! options
15056 parsoid
15057 !! wikitext
15058
15059 [[:Category:Foo]]
15060 [[:Category:Foo|Bar]]
15061 !! html
15062 <p>
15063 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
15064 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
15065 </p>
15066 !! end
15067
15068 # We used to, but no longer wt2wt this test since the default serializer
15069 # will normalize all categories to serialize on their own line.
15070 # This wikitext usage is going to be fairly uncommon in production and
15071 # selser will take care of preventing whitespace insertion if this
15072 # occurs in an article.
15073 #
15074 # html2html disabled for the same reason (whitespace insertion between
15075 # x and y).
15076 #
15077 # html2wt disabled because it localizes the "Category" namespace.
15078 !! test
15079 Link prefix/suffixes aren't applied to category links
15080 !! options
15081 parsoid=wt2html
15082 language=is
15083 !! wikitext
15084 x[[Category:Foo]]y
15085 !! html/php
15086 <p>xy
15087 </p>
15088 !! html/parsoid
15089 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
15090 !! end
15091
15092 !! test
15093 Parsoid: Serialize link to file page with colon escape
15094 !! options
15095 parsoid
15096 !! wikitext
15097
15098 [[:File:Foo.png]]
15099 [[:File:Foo.png|Bar]]
15100 !! html
15101 <p>
15102 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
15103 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
15104 </p>
15105 !! end
15106
15107 !! test
15108 Parsoid: Serialize a genuine category link without colon escape
15109 !! options
15110 parsoid
15111 !! wikitext
15112 [[Category:Foo]]
15113 [[Category:Foo|Bar]]
15114 !! html
15115 <link rel="mw:PageProp/Category" href="./Category:Foo">
15116 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
15117 !! end
15118
15119 !! test
15120 Normalize hrefs properly before testing for invalid link targets (bug 70894)
15121 !! options
15122 parsoid=html2wt
15123 !! html/parsoid
15124 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
15125 !! wikitext
15126 [[Category:Toxine bactérienne]]
15127 !! end
15128
15129 !! test
15130 Parsoid: Defaultsort
15131 !! wikitext
15132 {{DEFAULTSORT:Foo}}
15133 !! html/parsoid
15134 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
15135 !! end
15136
15137 !! test
15138 Parsoid: Defaultsort (template-generated)
15139 !! wikitext
15140 {{{{echo|DEFAULTSORT}}:Foo}}
15141 !! html/parsoid
15142 <meta property="mw:PageProp/categorydefaultsort" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DEFAULTSORT}}:Foo"},"params":{},"i":0}}]}'/>
15143 !! end
15144
15145 ###
15146 ### Inter-language links
15147 ###
15148 !! test
15149 Interlanguage links
15150 !! options
15151 ill
15152 !! wikitext
15153 [[es:Alimento]]
15154 [[fr:Nourriture]]
15155 [[zh:食品]]
15156 !! html/php
15157 es:Alimento fr:Nourriture zh:食品
15158 !! html/parsoid
15159 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
15160 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
15161 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
15162 !! end
15163
15164 !! test
15165 Duplicate interlanguage links (bug 24502)
15166 !! options
15167 ill
15168 !! wikitext
15169 [[es:1]]
15170 [[es:2]]
15171 [[fr:1]]
15172 [[fr:2]]
15173 !! html/php
15174 es:1 fr:1
15175 !! html/parsoid
15176 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
15177 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
15178 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
15179 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
15180 !! end
15181
15182 ###
15183 ### Sections
15184 ###
15185 !! test
15186 Basic section headings
15187 !! wikitext
15188 == Headline 1 ==
15189 Some text
15190
15191 ==Headline 2==
15192 More
15193 ===Smaller headline===
15194 Blah blah
15195 !! html
15196 <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>
15197 <p>Some text
15198 </p>
15199 <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>
15200 <p>More
15201 </p>
15202 <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>
15203 <p>Blah blah
15204 </p>
15205 !! end
15206
15207 !! test
15208 Section headings with TOC
15209 !! wikitext
15210 == Headline 1 ==
15211 === Subheadline 1 ===
15212 ===== Skipping a level =====
15213 ====== Skipping a level ======
15214
15215 == Headline 2 ==
15216 Some text
15217 ===Another headline===
15218 !! html
15219 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15220 <ul>
15221 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
15222 <ul>
15223 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
15224 <ul>
15225 <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>
15226 <ul>
15227 <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>
15228 </ul>
15229 </li>
15230 </ul>
15231 </li>
15232 </ul>
15233 </li>
15234 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
15235 <ul>
15236 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
15237 </ul>
15238 </li>
15239 </ul>
15240 </div>
15241
15242 <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>
15243 <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>
15244 <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>
15245 <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>
15246 <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>
15247 <p>Some text
15248 </p>
15249 <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>
15250
15251 !! end
15252
15253 !! test
15254 TOC anchors don't collide
15255 !! wikitext
15256 __FORCETOC__
15257 == Headline 2 ==
15258 == Headline ==
15259 == Headline 2 ==
15260 == Headline ==
15261 !! html/php
15262 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15263 <ul>
15264 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
15265 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
15266 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
15267 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
15268 </ul>
15269 </div>
15270
15271 <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>
15272 <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>
15273 <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>
15274 <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>
15275
15276 !! end
15277
15278 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
15279 !! test
15280 Handling of sections up to level 6 and beyond
15281 !! wikitext
15282 = Level 1 Heading=
15283 == Level 2 Heading==
15284 === Level 3 Heading===
15285 ==== Level 4 Heading====
15286 ===== Level 5 Heading=====
15287 ====== Level 6 Heading======
15288 ======= Level 7 Heading=======
15289 ======== Level 8 Heading========
15290 ========= Level 9 Heading=========
15291 ========== Level 10 Heading==========
15292 !! html
15293 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15294 <ul>
15295 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
15296 <ul>
15297 <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>
15298 <ul>
15299 <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>
15300 <ul>
15301 <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>
15302 <ul>
15303 <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>
15304 <ul>
15305 <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>
15306 <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>
15307 <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>
15308 <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>
15309 <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>
15310 </ul>
15311 </li>
15312 </ul>
15313 </li>
15314 </ul>
15315 </li>
15316 </ul>
15317 </li>
15318 </ul>
15319 </li>
15320 </ul>
15321 </div>
15322
15323 <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>
15324 <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>
15325 <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>
15326 <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>
15327 <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>
15328 <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>
15329 <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>
15330 <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>
15331 <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>
15332 <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>
15333
15334 !! end
15335
15336 !! test
15337 TOC regression (T11764)
15338 !! wikitext
15339 == title 1 ==
15340 === title 1.1 ===
15341 ==== title 1.1.1 ====
15342 === title 1.2 ===
15343 == title 2 ==
15344 === title 2.1 ===
15345 !! html
15346 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15347 <ul>
15348 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15349 <ul>
15350 <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>
15351 <ul>
15352 <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>
15353 </ul>
15354 </li>
15355 <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>
15356 </ul>
15357 </li>
15358 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15359 <ul>
15360 <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>
15361 </ul>
15362 </li>
15363 </ul>
15364 </div>
15365
15366 <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>
15367 <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>
15368 <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>
15369 <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>
15370 <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>
15371 <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>
15372
15373 !! end
15374
15375 !! test
15376 TOC for heading containing <span id="..."></span> (T96153)
15377 !! wikitext
15378 __FORCETOC__
15379 ==<span id="old-anchor"></span>New title==
15380 !! html/php
15381 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15382 <ul>
15383 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
15384 </ul>
15385 </div>
15386
15387 <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>
15388
15389 !! end
15390
15391 !! test
15392 TOC with wgMaxTocLevel=3 (bug 6204)
15393 !! options
15394 wgMaxTocLevel=3
15395 !! wikitext
15396 == title 1 ==
15397 === title 1.1 ===
15398 ==== title 1.1.1 ====
15399 === title 1.2 ===
15400 == title 2 ==
15401 === title 2.1 ===
15402 !! html
15403 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15404 <ul>
15405 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15406 <ul>
15407 <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>
15408 <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>
15409 </ul>
15410 </li>
15411 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15412 <ul>
15413 <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>
15414 </ul>
15415 </li>
15416 </ul>
15417 </div>
15418
15419 <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>
15420 <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>
15421 <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>
15422 <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>
15423 <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>
15424 <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>
15425
15426 !! end
15427
15428 !! test
15429 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
15430 !! options
15431 wgMaxTocLevel=3
15432 !! wikitext
15433 ==Section 1==
15434 ===Section 1.1===
15435 ====Section 1.1.1====
15436 ====Section 1.1.1.1====
15437 ==Section 2==
15438 !! html
15439 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15440 <ul>
15441 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15442 <ul>
15443 <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>
15444 </ul>
15445 </li>
15446 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15447 </ul>
15448 </div>
15449
15450 <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>
15451 <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>
15452 <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>
15453 <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>
15454 <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>
15455
15456 !! end
15457
15458
15459 !! test
15460 Resolving duplicate section names
15461 !! wikitext
15462 == Foo bar ==
15463 == Foo bar ==
15464 !! html
15465 <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>
15466 <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>
15467
15468 !! end
15469
15470 !! test
15471 Resolving duplicate section names with differing case (bug 10721)
15472 !! wikitext
15473 == Foo bar ==
15474 == Foo Bar ==
15475 !! html
15476 <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>
15477 <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>
15478
15479 !! end
15480
15481 !! article
15482 Template:sections
15483 !! text
15484 ===Section 1===
15485 ==Section 2==
15486 !! endarticle
15487
15488 !! test
15489 Template with sections, __NOTOC__
15490 !! wikitext
15491 __NOTOC__
15492 ==Section 0==
15493 {{sections}}
15494 ==Section 4==
15495 !! html
15496 <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>
15497 <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>
15498 <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>
15499 <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>
15500
15501 !! end
15502
15503 !! test
15504 __NOEDITSECTION__ keyword
15505 !! wikitext
15506 __NOEDITSECTION__
15507 ==Section 1==
15508 ==Section 2==
15509 !! html
15510 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15511 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15512
15513 !! end
15514
15515 !! test
15516 Link inside a section heading
15517 !! wikitext
15518 ==Section with a [[Main Page|link]] in it==
15519 !! html
15520 <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>
15521
15522 !! end
15523
15524 !! test
15525 TOC regression (T14077)
15526 !! wikitext
15527 __TOC__
15528 == title 1 ==
15529 === title 1.1 ===
15530 == title 2 ==
15531 !! html
15532 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15533 <ul>
15534 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15535 <ul>
15536 <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>
15537 </ul>
15538 </li>
15539 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15540 </ul>
15541 </div>
15542
15543 <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>
15544 <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>
15545 <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>
15546
15547 !! end
15548
15549 !! test
15550 BUG 1219 URL next to image (good)
15551 !! wikitext
15552 http://example.com [[File:Foobar.jpg]]
15553 !! html/php
15554 <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>
15555 </p>
15556 !! html/parsoid
15557 <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>
15558 !!end
15559
15560 !! test
15561 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
15562 !! wikitext
15563 ===
15564 The line above must have a trailing space!
15565 === <!--
15566 --> <!-- -->
15567 But just in case it doesn't...
15568 !! html
15569 <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>
15570 <p>The line above must have a trailing space!
15571 </p>
15572 <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>
15573 <p>But just in case it doesn't...
15574 </p>
15575 !! end
15576
15577 !! test
15578 Header with special characters (bug 25462)
15579 !! wikitext
15580 The tooltips shall not show entities to the user (ie. be double escaped)
15581
15582 == text > text ==
15583 section 1
15584
15585 == text < text ==
15586 section 2
15587
15588 == text & text ==
15589 section 3
15590
15591 == text ' text ==
15592 section 4
15593
15594 == text " text ==
15595 section 5
15596 !! html
15597 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15598 </p>
15599 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15600 <ul>
15601 <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>
15602 <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>
15603 <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>
15604 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15605 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15606 </ul>
15607 </div>
15608
15609 <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>
15610 <p>section 1
15611 </p>
15612 <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>
15613 <p>section 2
15614 </p>
15615 <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>
15616 <p>section 3
15617 </p>
15618 <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>
15619 <p>section 4
15620 </p>
15621 <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>
15622 <p>section 5
15623 </p>
15624 !! end
15625
15626 !! test
15627 Header with space, plus and underscore as entity
15628 !! wikitext
15629 Id should not contain + for spaces
15630
15631 == Space between Text ==
15632 section 1
15633
15634 == Space-Entity&#32;between&#32;Text ==
15635 section 2
15636
15637 == Plus+between+Text ==
15638 section 3
15639
15640 == Plus-Entity&#43;between&#43;Text ==
15641 section 4
15642
15643 == Underscore_between_Text ==
15644 section 5
15645
15646 == Underscore-Entity&#95;between&#95;Text ==
15647 section 6
15648
15649 [[#Space between Text]]
15650 [[#Space-Entity&#32;between&#32;Text]]
15651 [[#Plus+between+Text]]
15652 [[#Plus-Entity&#43;between&#43;Text]]
15653 [[#Underscore_between_Text]]
15654 [[#Underscore-Entity&#95;between&#95;Text]]
15655 !! html
15656 <p>Id should not contain + for spaces
15657 </p>
15658 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15659 <ul>
15660 <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>
15661 <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>
15662 <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>
15663 <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>
15664 <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>
15665 <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>
15666 </ul>
15667 </div>
15668
15669 <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>
15670 <p>section 1
15671 </p>
15672 <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>
15673 <p>section 2
15674 </p>
15675 <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>
15676 <p>section 3
15677 </p>
15678 <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>
15679 <p>section 4
15680 </p>
15681 <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>
15682 <p>section 5
15683 </p>
15684 <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>
15685 <p>section 6
15686 </p><p><a href="#Space_between_Text">#Space between Text</a>
15687 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15688 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15689 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15690 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15691 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15692 </p>
15693 !! end
15694
15695 !! test
15696 Headers with excess '=' characters
15697 (Are similar tests necessary beyond the 1st level?)
15698 !! wikitext
15699 =foo==
15700 ==foo=
15701 =''italic'' heading==
15702 ==''italic'' heading=
15703 !! html
15704 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15705 <ul>
15706 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15707 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15708 <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>
15709 <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>
15710 </ul>
15711 </div>
15712
15713 <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>
15714 <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>
15715 <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>
15716 <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>
15717
15718 !! end
15719
15720 !! test
15721 HTML headers vs TOC (bug 23393)
15722 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15723 !! wikitext
15724 <h1>Header 1</h1>
15725 == Header 1.1 ==
15726 == Header 1.2 ==
15727
15728 <h1>Header 2
15729 </h1>
15730 == Header 2.1 ==
15731 == Header 2.2 ==
15732 __NOEDITSECTION__
15733 !! html
15734 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15735 <ul>
15736 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15737 <ul>
15738 <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>
15739 <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>
15740 </ul>
15741 </li>
15742 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15743 <ul>
15744 <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>
15745 <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>
15746 </ul>
15747 </li>
15748 </ul>
15749 </div>
15750
15751 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15752 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15753 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15754 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15755 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15756 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15757
15758 !! end
15759
15760 !! test
15761 Single-line or multiline-comments can follow headings
15762 !! options
15763 parsoid=wt2html,wt2wt
15764 !! wikitext
15765 ==foo==<!---->
15766 ==bar==<!--c1-->
15767 ==baz==<!--
15768 c2
15769 c3-->
15770 !! html
15771 <h2><span class="mw-headline" id="foo">foo</span></h2>
15772 <h2><span class="mw-headline" id="bar">bar</span></h2>
15773 <h2><span class="mw-headline" id="baz">baz</span></h2>
15774
15775 !! end
15776
15777 !! test
15778 BUG 1219 URL next to image (broken)
15779 !! wikitext
15780 http://example.com[[File:Foobar.jpg]]
15781 !! html/php
15782 <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>
15783 </p>
15784 !! html/parsoid
15785 <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>
15786 !!end
15787
15788 !! test
15789 Bug 1186 news: in the middle of text
15790 !! wikitext
15791 http://en.wikinews.org/wiki/Wikinews:Workplace
15792 !! html
15793 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15794 </p>
15795 !!end
15796
15797
15798 !! test
15799 Namespaced link must have a title
15800 !! wikitext
15801 [[Project:]]
15802 !! html
15803 <p>[[Project:]]
15804 </p>
15805 !!end
15806
15807 !! test
15808 Namespaced link must have a title (bad fragment version)
15809 !! wikitext
15810 [[Project:#fragment]]
15811 !! html
15812 <p>[[Project:#fragment]]
15813 </p>
15814 !!end
15815
15816
15817 ###
15818 ### HTML tags and HTML attributes
15819 ###
15820
15821 !! test
15822 div with no attributes
15823 !! wikitext
15824 <div>HTML rocks</div>
15825 !! html
15826 <div>HTML rocks</div>
15827
15828 !! end
15829
15830 !! test
15831 div with double-quoted attribute
15832 !! wikitext
15833 <div id="rock">HTML rocks</div>
15834 !! html
15835 <div id="rock">HTML rocks</div>
15836
15837 !! end
15838
15839 !! test
15840 div with single-quoted attribute
15841 !! wikitext
15842 <div id='rock'>HTML rocks</div>
15843 !! html
15844 <div id="rock">HTML rocks</div>
15845
15846 !! end
15847
15848 !! test
15849 div with unquoted attribute
15850 !! wikitext
15851 <div id=rock>HTML rocks</div>
15852 !! html
15853 <div id="rock">HTML rocks</div>
15854
15855 !! end
15856
15857 !! test
15858 div with illegal double attributes
15859 !! wikitext
15860 <div id="a" id="b">HTML rocks</div>
15861 !! html
15862 <div id="b">HTML rocks</div>
15863
15864 !!end
15865
15866 !! test
15867 div with empty attribute value, space before equals
15868 !! options
15869 parsoid=wt2html,html2html
15870 !! wikitext
15871 <div class =>HTML rocks</div>
15872 !! html/php
15873 <div class="">HTML rocks</div>
15874
15875 !! html/parsoid
15876 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15877 !! end
15878
15879 !! test
15880 div with multiple empty attribute values
15881 !! options
15882 parsoid=wt2html,html2html
15883 !! wikitext
15884 <div id= title=>HTML rocks</div>
15885 !! html/php
15886 <div id="title.3D">HTML rocks</div>
15887
15888 !! html/parsoid
15889 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15890 !! end
15891
15892 !! test
15893 table with multiple empty attribute values
15894 !! options
15895 parsoid=wt2html,html2html
15896 !! wikitext
15897 {| title= id=
15898 | hi
15899 |}
15900 !! html/php
15901 <table title="id=">
15902 <tr>
15903 <td> hi
15904 </td></tr></table>
15905
15906 !! html/parsoid
15907 <table title="id=">
15908 <tbody><tr><td> hi</td></tr>
15909 </tbody></table>
15910 !! end
15911
15912 !! test
15913 div with braces in attribute value
15914 !! wikitext
15915 <div title="{}">Foo</div>
15916 !! html/php
15917 <div title="&#123;}">Foo</div>
15918
15919 !! html/parsoid
15920 <div title="{}">Foo</div>
15921 !! end
15922
15923 !! test
15924 div with empty attribute value, no space before equals
15925 !! options
15926 parsoid=wt2html,html2html
15927 !! wikitext
15928 <div class=>HTML rocks</div>
15929 !! html/php
15930 <div class="">HTML rocks</div>
15931
15932 !! html/parsoid
15933 <div class="">HTML rocks</div>
15934 !! end
15935
15936 !! test
15937 HTML multiple attributes correction
15938 !! wikitext
15939 <p class="error" class="awesome">Awesome!</p>
15940 !! html
15941 <p class="awesome">Awesome!</p>
15942
15943 !!end
15944
15945 !! test
15946 Table multiple attributes correction
15947 !! wikitext
15948 {|
15949 !+ class="error" class="awesome"| status
15950 |}
15951 !! html
15952 <table>
15953 <tr>
15954 <th class="awesome"> status
15955 </th></tr></table>
15956
15957 !!end
15958
15959 !! test
15960 DIV IN UPPERCASE
15961 !! wikitext
15962 <DIV ID="x">HTML ROCKS</DIV>
15963 !! html
15964 <div id="x">HTML ROCKS</div>
15965
15966 !!end
15967
15968 !! test
15969 Non-ASCII pseudo-tags are rendered as text
15970 !! wikitext
15971 <khyô>
15972 !! html
15973 <p>&lt;khyô&gt;
15974 </p>
15975 !! end
15976
15977 !! test
15978 Pseudo-tag with URL 'name' renders as url link
15979 !! wikitext
15980 <http://example.com/>
15981 !! html
15982 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
15983 </p>
15984 !! end
15985
15986 !! test
15987 text with amp in the middle of nowhere
15988 !! wikitext
15989 Remember AT&T?
15990 !! html
15991 <p>Remember AT&amp;T?
15992 </p>
15993 !! end
15994
15995 !! test
15996 text with character entity: eacute
15997 !! wikitext
15998 I always thought &eacute; was a cute letter.
15999 !! html
16000 <p>I always thought &#233; was a cute letter.
16001 </p>
16002 !! html+tidy
16003 <p>I always thought é was a cute letter.</p>
16004 !! end
16005
16006 !! test
16007 text with entity-escaped character entity-like string: eacute
16008 !! wikitext
16009 I always thought &amp;eacute; was a cute letter.
16010 !! html
16011 <p>I always thought &amp;eacute; was a cute letter.
16012 </p>
16013 !! end
16014
16015 !! test
16016 text with undefined character entity: xacute
16017 !! wikitext
16018 I always thought &xacute; was a cute letter.
16019 !! html
16020 <p>I always thought &amp;xacute; was a cute letter.
16021 </p>
16022 !! end
16023
16024 !! test
16025 HTML5 tags
16026 !! wikitext
16027 <data value="5">five</data>
16028 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16029 <mark>This highlighted text</mark>
16030 !! html
16031 <p><data value="5">five</data>
16032 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16033 <mark>This highlighted text</mark>
16034 </p>
16035 !! end
16036
16037 !! test
16038 HTML tag with leading space is parsed as text
16039 !! wikitext
16040 < div>foo< /div>
16041 !! html
16042 <p>&lt; div&gt;foo&lt; /div&gt;
16043 </p>
16044 !! end
16045
16046 ###
16047 ### Nesting tests (see bug 41545, 50604, 51081)
16048 ###
16049
16050 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
16051 # Note that html2wt is considerably more difficult if we use <b> in
16052 # the test case, instead of <big>
16053 !! test
16054 Ensure that HTML adoption agency algorithm is properly implemented.
16055 !! wikitext
16056 <big>X<big>Y</big>Z</big>
16057 !! html
16058 <p><big>X<big>Y</big>Z</big>
16059 </p>
16060 !! end
16061
16062 # This was bug 41545 in the PHP parser.
16063 # Note that tidy doesn't handle this correctly.
16064 !! test
16065 Nesting of <kbd>
16066 !! wikitext
16067 <kbd>X<kbd>Y</kbd>Z</kbd>
16068 !! html
16069 <p><kbd>X<kbd>Y</kbd>Z</kbd>
16070 </p>
16071 !! end
16072
16073 # The following cases were bug 51081 in the PHP parser.
16074 # Note that there are some other nestable tags (b, i, etc) which are
16075 # not covered; see bug 51081 for discussion.
16076
16077 # Note that tidy doesn't handle this correctly.
16078 !! test
16079 Nesting of <em>
16080 !! wikitext
16081 <em>X<em>Y</em>Z</em>
16082 !! html
16083 <p><em>X<em>Y</em>Z</em>
16084 </p>
16085 !! end
16086
16087 # Note that tidy doesn't handle this correctly.
16088 !! test
16089 Nesting of <strong>
16090 !! wikitext
16091 <strong>X<strong>Y</strong>Z</strong>
16092 !! html
16093 <p><strong>X<strong>Y</strong>Z</strong>
16094 </p>
16095 !! end
16096
16097 !! test
16098 Nesting of <q>
16099 !! wikitext
16100 <q>X<q>Y</q>Z</q>
16101 !! html+tidy
16102 <p><q>X<q>Y</q>Z</q></p>
16103 !! end
16104
16105 # Note that tidy doesn't handle this correctly.
16106 !! test
16107 Nesting of <ruby>
16108 !! wikitext
16109 <ruby>X<ruby>Y</ruby>Z</ruby>
16110 !! html
16111 <p><ruby>X<ruby>Y</ruby>Z</ruby>
16112 </p>
16113 !! end
16114
16115 # Note that tidy doesn't handle this correctly.
16116 !! test
16117 Nesting of <bdo>
16118 !! wikitext
16119 <bdo>X<bdo>Y</bdo>Z</bdo>
16120 !! html
16121 <p><bdo>X<bdo>Y</bdo>Z</bdo>
16122 </p>
16123 !! end
16124
16125
16126 ###
16127 ### Media links
16128 ###
16129
16130 !! test
16131 Media link
16132 !! wikitext
16133 [[Media:Foobar.jpg]]
16134 !! html
16135 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
16136 </p>
16137 !! end
16138
16139 !! test
16140 Media link with text
16141 !! wikitext
16142 [[Media:Foobar.jpg|A neat file to look at]]
16143 !! html
16144 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
16145 </p>
16146 !! end
16147
16148 # FIXME: this is still bad HTML tag nesting
16149 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
16150 !! test
16151 Media link with nasty text
16152 !! wikitext
16153 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
16154 !! html
16155 <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>
16156
16157 !! html+tidy
16158 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
16159 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
16160 !! end
16161
16162 !! test
16163 Media link to nonexistent file (bug 1702)
16164 !! wikitext
16165 [[Media:No such.jpg]]
16166 !! html
16167 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
16168 </p>
16169 !! end
16170
16171 !! test
16172 Image link to nonexistent file (bug 1850 - good)
16173 !! wikitext
16174 [[File:No_such.jpg]]
16175 !! html/php
16176 <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>
16177 </p>
16178 !! html/parsoid
16179 <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>
16180 !! end
16181
16182 !! test
16183 :Image link to nonexistent file (bug 1850 - bad)
16184 !! wikitext
16185 [[:Image:No such.jpg]]
16186 !! html/php
16187 <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>
16188 </p>
16189 !! html/parsoid
16190 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
16191 !! end
16192
16193
16194
16195 !! test
16196 Character reference normalization in link text (bug 1938)
16197 !! wikitext
16198 [[Main Page|this&that]]
16199 !! html
16200 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
16201 </p>
16202 !!end
16203
16204 !! article
16205 אַ
16206 !! text
16207 Test for unicode normalization
16208
16209 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
16210 !! endarticle
16211
16212 !! test
16213 (bug 19451) Links should refer to the normalized form.
16214 !! wikitext
16215 [[&#xFB2E;]]
16216 [[&#x5d0;&#x5b7;]]
16217 [[&#x5d0;ַ]]
16218 [[א&#x5b7;]]
16219 [[אַ]]
16220 !! html
16221 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
16222 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
16223 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
16224 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
16225 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
16226 </p>
16227 !! end
16228
16229 !! test
16230 Empty attribute crash test (bug 2067)
16231 !! wikitext
16232 <font color="">foo</font>
16233 !! html
16234 <p><font color="">foo</font>
16235 </p>
16236 !! end
16237
16238 !! test
16239 Empty attribute crash test single-quotes (bug 2067)
16240 !! wikitext
16241 <font color=''>foo</font>
16242 !! html
16243 <p><font color="">foo</font>
16244 </p>
16245 !! end
16246
16247 !! test
16248 Attribute test: equals, then nothing
16249 !! options
16250 parsoid=wt2html,html2html
16251 !! wikitext
16252 <font color=>foo</font>
16253 !! html/php
16254 <p><font color="">foo</font>
16255 </p>
16256 !! html/parsoid
16257 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
16258 !! end
16259
16260 !! test
16261 Attribute test: unquoted value
16262 !! options
16263 parsoid=wt2html,html2html
16264 !! wikitext
16265 <font color=x>foo</font>
16266 !! html/php
16267 <p><font color="x">foo</font>
16268 </p>
16269 !! html/parsoid
16270 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
16271 !! end
16272
16273 !! test
16274 Attribute test: unquoted but illegal value (hash)
16275 !! wikitext
16276 <font color=#x>foo</font>
16277 !! html
16278 <p><font color="#x">foo</font>
16279 </p>
16280 !! end
16281
16282 # Parsoid does not serialize to empty attribute syntax,
16283 # so wt2wt and html2wt cases are skipped
16284 !! test
16285 Attribute test: no value (T54330)
16286 !! options
16287 parsoid=wt2html,html2html
16288 !! wikitext
16289 <font color>foo</font>
16290 !! html/php
16291 <p><font color="">foo</font>
16292 </p>
16293 !! html/parsoid
16294 <p><font color="">foo</font></p>
16295 !! end
16296
16297 !! test
16298 Bug 2095: link with three closing brackets
16299 !! wikitext
16300 [[Main Page]]]
16301 !! html/php
16302 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
16303 </p>
16304 !! html/parsoid
16305 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
16306 !! end
16307
16308 !! test
16309 Bug 2095: link with pipe and three closing brackets
16310 !! wikitext
16311 [[Main Page|link]]]
16312 !! html/php
16313 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
16314 </p>
16315 !! html/parsoid
16316 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
16317 !! end
16318
16319 !! test
16320 Bug 2095: link with pipe and three closing brackets, version 2
16321 !! wikitext
16322 [[Main Page|[http://example.com/]]]
16323 !! html/php
16324 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
16325 </p>
16326 !! html/parsoid
16327 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
16328 !! end
16329
16330
16331 ###
16332 ### Safety
16333 ###
16334
16335 !! article
16336 Template:Dangerous attribute
16337 !! text
16338 " onmouseover="alert(document.cookie)
16339 !! endarticle
16340
16341 !! article
16342 Template:Dangerous style attribute
16343 !! text
16344 border-size: expression(alert(document.cookie))
16345 !! endarticle
16346
16347 !! article
16348 Template:Div style
16349 !! text
16350 <div style="float: right; {{{1}}}">Magic div</div>
16351 !! endarticle
16352
16353 !! test
16354 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
16355 !! wikitext
16356 <div title="{{test}}"></div>
16357 !! html
16358 <div title="This is a test template"></div>
16359
16360 !! end
16361
16362 # Parsoid has enough context to handle this case
16363 !! test
16364 Bug 2304: HTML attribute safety (dangerous template; 2309)
16365 !! wikitext
16366 <div title="{{dangerous attribute}}"></div>
16367 !! html/php
16368 <div title=""></div>
16369
16370 !! html/parsoid
16371 <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=&#39;{\"pi\":[[]],\"dsr\":[12,35,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"dangerous attribute\",\"href\":\"./Template:Dangerous_attribute\"},\"params\":{},\"i\":0}}]}&#39;>\" onmouseover=\"alert(document.cookie)&lt;/span>"}]]}'></div>
16372 !! end
16373
16374 !! test
16375 Bug 2304: HTML attribute safety (dangerous style template; 2309)
16376 !! wikitext
16377 <div style="{{dangerous style attribute}}"></div>
16378 !! html
16379 <div style="/* insecure input */"></div>
16380
16381 !! end
16382
16383 !! test
16384 Bug 2304: HTML attribute safety (safe parameter; 2309)
16385 !! wikitext
16386 {{div style|width: 200px}}
16387 !! html
16388 <div style="float: right; width: 200px">Magic div</div>
16389
16390 !! end
16391
16392 !! test
16393 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
16394 !! wikitext
16395 {{div style|width: expression(alert(document.cookie))}}
16396 !! html
16397 <div style="/* insecure input */">Magic div</div>
16398
16399 !! end
16400
16401 !! test
16402 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
16403 !! wikitext
16404 {{div style|"><script>alert(document.cookie)</script>}}
16405 !! html
16406 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16407
16408 !! end
16409
16410 !! test
16411 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
16412 !! wikitext
16413 {{div style|" ><script>alert(document.cookie)</script>}}
16414 !! html
16415 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16416
16417 !! end
16418
16419 !! test
16420 Bug 2304: HTML attribute safety (link)
16421 !! wikitext
16422 <div title="[[Main Page]]"></div>
16423 !! html
16424 <div title="&#91;&#91;Main Page]]"></div>
16425
16426 !! end
16427
16428 !! test
16429 Bug 2304: HTML attribute safety (italics)
16430 !! wikitext
16431 <div title="''foobar''"></div>
16432 !! html
16433 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16434
16435 !! end
16436
16437 !! test
16438 Bug 2304: HTML attribute safety (bold)
16439 !! wikitext
16440 <div title="'''foobar'''"></div>
16441 !! html
16442 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16443
16444 !! end
16445
16446
16447 !! test
16448 Bug 2304: HTML attribute safety (ISBN)
16449 !! wikitext
16450 <div title="ISBN 1234567890"></div>
16451 !! html
16452 <div title="&#73;SBN 1234567890"></div>
16453
16454 !! end
16455
16456 !! test
16457 Bug 2304: HTML attribute safety (RFC)
16458 !! wikitext
16459 <div title="RFC 1234"></div>
16460 !! html
16461 <div title="&#82;FC 1234"></div>
16462
16463 !! end
16464
16465 !! test
16466 Bug 2304: HTML attribute safety (PMID)
16467 !! wikitext
16468 <div title="PMID 1234567890"></div>
16469 !! html
16470 <div title="&#80;MID 1234567890"></div>
16471
16472 !! end
16473
16474 !! test
16475 Bug 2304: HTML attribute safety (web link)
16476 !! wikitext
16477 <div title="http://example.com/"></div>
16478 !! html
16479 <div title="http&#58;//example.com/"></div>
16480
16481 !! end
16482
16483 !! test
16484 Bug 2304: HTML attribute safety (named web link)
16485 !! wikitext
16486 <div title="[http://example.com/ link]"></div>
16487 !! html
16488 <div title="&#91;http&#58;//example.com/ link]"></div>
16489
16490 !! end
16491
16492 !! test
16493 Bug 3244: HTML attribute safety (extension; safe)
16494 !! wikitext
16495 <div style="<nowiki>background:blue</nowiki>"></div>
16496 !! html
16497 <div style="background:blue"></div>
16498
16499 !! end
16500
16501 !! test
16502 Bug 3244: HTML attribute safety (extension; unsafe)
16503 !! wikitext
16504 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16505 !! html
16506 <div style="/* insecure input */"></div>
16507
16508 !! end
16509
16510 # More MSIE fun discovered by Tom Gilder
16511
16512 !! test
16513 MSIE CSS safety test: spurious slash
16514 !! wikitext
16515 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16516 !! html
16517 <div style="/* insecure input */">evil</div>
16518
16519 !! end
16520
16521 !! test
16522 MSIE CSS safety test: hex code
16523 !! wikitext
16524 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16525 !! html
16526 <div style="/* insecure input */">evil</div>
16527
16528 !! end
16529
16530 !! test
16531 MSIE CSS safety test: comment in url
16532 !! wikitext
16533 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16534 !! html
16535 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16536
16537 !! end
16538
16539 !! test
16540 MSIE CSS safety test: comment in expression
16541 !! wikitext
16542 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16543 !! html
16544 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16545
16546 !! end
16547
16548 !! test
16549 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
16550 !! wikitext
16551 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16552 !! html
16553 <p style="/* invalid control char */">A</p>
16554
16555 !! end
16556
16557 !! test
16558 MSIE 6 CSS safety test: Fullwidth (bug 55332)
16559 !! wikitext
16560 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16561 <div style="top:EXPRESSION(alert())">B</div>
16562 !! html
16563 <p style="/* insecure input */">A</p>
16564 <div style="/* insecure input */">B</div>
16565
16566 !! end
16567
16568 !! test
16569 MSIE 6 CSS safety test: IPA extensions (bug 55332)
16570 !! wikitext
16571 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16572 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16573 !! html
16574 <div style="/* insecure input */">A</div>
16575 <p style="/* insecure input */">B</p>
16576
16577 !! end
16578
16579 !! test
16580 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16581 !! wikitext
16582 <div style="background-image:url⁽javascript:alert())">A</div>
16583 <div style="background-image:url₍javascript:alert())">B</div>
16584 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16585 !! html
16586 <div style="/* insecure input */">A</div>
16587 <div style="/* insecure input */">B</div>
16588 <p style="/* insecure input */">C</p>
16589
16590 !! end
16591
16592 # FIXME: Parsoid fails to sanitize this! See T58846.
16593 !! test
16594 Opera -o-link CSS
16595 !! wikitext
16596 <div
16597 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;"
16598 style="-o-link:attr(title);-o-link-source:current">X</div>
16599 !! html
16600 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16601
16602 !! end
16603
16604 !! test
16605 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16606 !! wikitext
16607 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16608 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16609 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16610 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16611 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16612 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16613 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16614 !! html
16615 <p style="/* insecure input */">A</p>
16616 <p style="/* insecure input */">B</p>
16617 <p style="/* insecure input */">C</p>
16618 <p style="/* insecure input */">D</p>
16619 <p style="/* insecure input */">E</p>
16620 <p style="/* insecure input */">F</p>
16621 <p style="/* insecure input */">G</p>
16622
16623 !! end
16624
16625 !! test
16626 Table attribute legitimate extension
16627 !! wikitext
16628 {|
16629 !+ style="<nowiki>color:blue</nowiki>"| status
16630 |}
16631 !! html
16632 <table>
16633 <tr>
16634 <th style="color:blue"> status
16635 </th></tr></table>
16636
16637 !!end
16638
16639 !! test
16640 Table attribute safety
16641 !! wikitext
16642 {|
16643 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16644 |}
16645 !! html
16646 <table>
16647 <tr>
16648 <th style="/* insecure input */"> status
16649 </th></tr></table>
16650
16651 !! end
16652
16653 !! test
16654 CSS line continuation 1
16655 !! wikitext
16656 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16657 !! html
16658 <div style="/* insecure input */"></div>
16659
16660 !! end
16661
16662 !! test
16663 CSS line continuation 2
16664 !! wikitext
16665 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16666 !! html
16667 <div style="/* invalid control char */"></div>
16668
16669 !! end
16670
16671 !! article
16672 Template:Identity
16673 !! text
16674 {{{1}}}
16675 !! endarticle
16676
16677 !! test
16678 Expansion of multi-line templates in attribute values (bug 6255)
16679 !! wikitext
16680 <div style="background: {{identity|#00FF00}}">-</div>
16681 !! html
16682 <div style="background: #00FF00">-</div>
16683
16684 !! end
16685
16686
16687 !! test
16688 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16689 !! wikitext
16690 <div style="background:
16691 #00FF00">-</div>
16692 !! html/php
16693 <div style="background: #00FF00">-</div>
16694
16695 !! html/parsoid
16696 <div style="background:
16697 #00FF00">-</div>
16698 !! end
16699
16700 !! test
16701 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16702 !! wikitext
16703 <div style="background: &#10;#00FF00">-</div>
16704 !! html
16705 <div style="background: &#10;#00FF00">-</div>
16706
16707 !! end
16708
16709 !! test
16710 evil <math>-wiki-tags without Extension:Math enabled
16711 !! wikitext
16712 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
16713 !! html+tidy
16714 <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>
16715 !! end
16716
16717 ###
16718 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16719 ###
16720 !! test
16721 Parser hook: empty input
16722 !! wikitext
16723 <tag></tag>
16724 !! html/php
16725 <pre>
16726 ''
16727 array (
16728 )
16729 </pre>
16730
16731 !! html/parsoid
16732 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16733 !! end
16734
16735 ## Don't expect parsoid to rt this form.
16736 !! test
16737 Parser hook: empty input using terminated empty elements
16738 !! options
16739 parsoid=wt2html,html2html
16740 !! wikitext
16741 <tag/>
16742 !! html/php
16743 <pre>
16744 NULL
16745 array (
16746 )
16747 </pre>
16748
16749 !! html/parsoid
16750 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16751 !! end
16752
16753 !! test
16754 Parser hook: empty input using terminated empty elements (space before)
16755 !! wikitext
16756 <tag />
16757 !! html/php
16758 <pre>
16759 NULL
16760 array (
16761 )
16762 </pre>
16763
16764 !! html/parsoid
16765 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16766 !! end
16767
16768 !! test
16769 Parser hook: basic input
16770 !! wikitext
16771 <tag>input</tag>
16772 !! html/php
16773 <pre>
16774 'input'
16775 array (
16776 )
16777 </pre>
16778
16779 !! html/parsoid
16780 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16781 !! end
16782
16783 ## Don't expect parsoid to rt this form.
16784 !! test
16785 Parser hook: case insensitive
16786 !! options
16787 parsoid=wt2html,html2html
16788 !! wikitext
16789 <TAG>input</TAG>
16790 !! html/php
16791 <pre>
16792 'input'
16793 array (
16794 )
16795 </pre>
16796
16797 !! html/parsoid
16798 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16799 !! end
16800
16801 ## Don't expect parsoid to rt this form.
16802 !! test
16803 Parser hook: case insensitive, redux
16804 !! options
16805 parsoid=wt2html,html2html
16806 !! wikitext
16807 <TaG>input</TAg>
16808 !! html/php
16809 <pre>
16810 'input'
16811 array (
16812 )
16813 </pre>
16814
16815 !! html/parsoid
16816 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16817 !! end
16818
16819 !! test
16820 Parser hook: nested tags
16821 !! wikitext
16822 <tag><tag></tag></tag>
16823 !! html/php
16824 <pre>
16825 '<tag>'
16826 array (
16827 )
16828 </pre>&lt;/tag&gt;
16829
16830 !! html/parsoid
16831 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
16832 !! end
16833
16834 !! test
16835 Parser hook: basic arguments
16836 !! wikitext
16837 <tag width="200" height="100" depth="50" square=""></tag>
16838 !! html/php
16839 <pre>
16840 ''
16841 array (
16842 'width' => '200',
16843 'height' => '100',
16844 'depth' => '50',
16845 'square' => '',
16846 )
16847 </pre>
16848
16849 !! html/parsoid
16850 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16851 !! end
16852
16853 ## Don't expect parsoid to rt this form.
16854 !! test
16855 Parser hook: basic arguments, variations
16856 !! options
16857 parsoid=wt2html,html2html
16858 !! wikitext
16859 <tag width=200 height = "100" depth = '50' square></tag>
16860 !! html/php
16861 <pre>
16862 ''
16863 array (
16864 'width' => '200',
16865 'height' => '100',
16866 'depth' => '50',
16867 'square' => '',
16868 )
16869 </pre>
16870
16871 !! html/parsoid
16872 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16873 !! end
16874
16875 !! test
16876 Parser hook: argument containing a forward slash (bug 5344)
16877 !! wikitext
16878 <tag filename="/tmp/bla"></tag>
16879 !! html/php
16880 <pre>
16881 ''
16882 array (
16883 'filename' => '/tmp/bla',
16884 )
16885 </pre>
16886
16887 !! html/parsoid
16888 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16889 !! end
16890
16891 ## Don't expect parsoid to rt this form.
16892 !! test
16893 Parser hook: empty input using terminated empty elements (bug 2374)
16894 !! options
16895 parsoid=wt2html,html2html
16896 !! wikitext
16897 <tag foo=bar/>text
16898 !! html/php
16899 <pre>
16900 NULL
16901 array (
16902 'foo' => 'bar',
16903 )
16904 </pre>text
16905
16906 !! html/parsoid
16907 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
16908 !! end
16909
16910 ## </tag> should be output literally since there is no matching tag that begins it
16911 ## Don't expect parsoid to rt this form.
16912 !! test
16913 Parser hook: basic arguments using terminated empty elements (bug 2374)
16914 !! options
16915 parsoid=wt2html
16916 !! wikitext
16917 <tag width=200 height = "100" depth = '50' square/>
16918 other stuff
16919 </tag>
16920 !! html/php
16921 <pre>
16922 NULL
16923 array (
16924 'width' => '200',
16925 'height' => '100',
16926 'depth' => '50',
16927 'square' => '',
16928 )
16929 </pre>
16930 <p>other stuff
16931 &lt;/tag&gt;
16932 </p>
16933 !! html/parsoid
16934 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":null}' about="#mwt2"></pre><p>other stuff
16935 &lt;/tag></p>
16936 !! end
16937
16938 ## Don't expect parsoid to rt this form.
16939 !! test
16940 Parser hook: Don't allow unclosed extension tags
16941 !! options
16942 parsoid=wt2html
16943 !! wikitext
16944 test <tag>123
16945
16946 this is a '''test'''
16947 !! html/php
16948 <p>test &lt;tag&gt;123
16949 </p><p>this is a <b>test</b>
16950 </p>
16951 !! html/parsoid
16952 <p>test &lt;tag>123</p>
16953
16954 <p>this is a <b>test</b></p>
16955 !! end
16956
16957 ###
16958 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
16959 ###
16960
16961 !! test
16962 Parser hook: static parser hook not inside a comment
16963 !! wikitext
16964 <statictag>hello, world</statictag>
16965
16966 <statictag action="flush" />
16967 !! html/php
16968 <p><br />
16969 hello, world
16970 </p>
16971 !! html/parsoid
16972 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
16973 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
16974 !! end
16975
16976 !! test
16977 Parser hook: static parser hook inside a comment
16978 !! wikitext
16979 <!-- <statictag>hello, world</statictag> -->
16980 <statictag action="flush" />
16981 !! html/php
16982 <p><br />
16983 </p>
16984 !! html/parsoid
16985 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
16986 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
16987 !! end
16988
16989 # Nested template calls; this case was broken by Parser.php rev 1.506,
16990 # since reverted.
16991
16992 !! article
16993 Template:One-parameter
16994 !! text
16995 (My parameter is: {{{1}}})
16996 !! endarticle
16997
16998 !! article
16999 Template:Map-one-parameter
17000 !! text
17001 {{{{{1}}}|{{{2}}}}}
17002 !! endarticle
17003
17004 !! test
17005 Nested template calls
17006 !! wikitext
17007 {{Map-one-parameter|One-parameter|param}}
17008 !! html
17009 <p>(My parameter is: param)
17010 </p>
17011 !! end
17012
17013
17014 ###
17015 ### Sanitizer
17016 ###
17017
17018 # HTML+Tidy effectively strips out the empty tags completely
17019 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
17020 # which Tidy would have done for the PHP parser had there been content inside it.
17021 !! test
17022 Sanitizer: Closing of open tags
17023 !! wikitext
17024 <s></s><table></table>
17025 !! html
17026 <s></s><table></table>
17027
17028 !! html/parsoid
17029 <p><s></s></p><table></table>
17030 !! end
17031
17032 !! test
17033 Sanitizer: Closing of open but not closed tags
17034 !! wikitext
17035 <s>foo
17036 !! html
17037 <p><s>foo</s>
17038 </p>
17039 !! end
17040
17041 !! test
17042 Sanitizer: Closing of closed but not open tags
17043 !! options
17044 parsoid=wt2html
17045 !! wikitext
17046 </s>
17047 !! html/php+tidy
17048 !! html/parsoid
17049 !! end
17050
17051 !! test
17052 Sanitizer: Closing of closed but not open table tags
17053 !! options
17054 parsoid=wt2html
17055 !! wikitext
17056 Table not started</td></tr></table>
17057 !! html/php+tidy
17058 <p>Table not started</p>
17059 !! html/parsoid
17060 <p>Table not started</p>
17061 !! end
17062
17063 !! test
17064 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
17065 !! wikitext
17066 <span id="æ: v">byte</span>[[#æ: v|backlink]]
17067 !! html
17068 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
17069 </p>
17070 !! end
17071
17072 # In HTML5, the restrictions are that id must contain at least one character,
17073 # and must not contain any space characters.
17074 !! test
17075 Sanitizer: Validating the contents of the id attribute (bug 4515)
17076 !! options
17077 disabled
17078 !! wikitext
17079 <br id="" /><br id="a space" />
17080 !! html
17081 Something ...
17082 !! end
17083
17084 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
17085 !! test
17086 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
17087 !! options
17088 disabled
17089 !! wikitext
17090 <br id="foo" /><br id="foo" />
17091 !! html
17092 Something need to be done. foo-2 ?
17093 !! end
17094
17095 !! test
17096 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
17097 !! wikitext
17098 <div itemscope>
17099 <meta itemprop="hello" content="world">
17100 <meta http-equiv="refresh" content="5">
17101 <meta itemprop="hello" http-equiv="refresh" content="5">
17102 <link itemprop="hello" href="{{SERVER}}">
17103 <link rel="stylesheet" href="{{SERVER}}">
17104 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
17105 </div>
17106 !! html
17107 <div itemscope="">
17108 <p> <meta itemprop="hello" content="world" />
17109 &lt;meta http-equiv="refresh" content="5"&gt;
17110 <meta itemprop="hello" content="5" />
17111 </p>
17112 <link itemprop="hello" href="http&#58;//example.org" />
17113 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
17114 <link itemprop="hello" href="http&#58;//example.org" />
17115 </div>
17116
17117 !! end
17118
17119 !! test
17120 Language converter: output gets cut off unexpectedly (bug 5757)
17121 !! options
17122 language=zh
17123 !! wikitext
17124 this bit is safe: }-
17125
17126 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
17127
17128 then we get cut off here: }-
17129
17130 all additional text is vanished
17131 !! html
17132 <p>this bit is safe: }-
17133 </p><p>but if we add a conversion instance: xxx
17134 </p><p>then we get cut off here: }-
17135 </p><p>all additional text is vanished
17136 </p>
17137 !! end
17138
17139 !! test
17140 Self closed html pairs (bug 5487)
17141 !! options
17142 !! wikitext
17143 <center><font id="bug" />Centered text</center>
17144 <div><font id="bug2" />In div text</div>
17145 !! html
17146 <center>&lt;font id="bug" /&gt;Centered text</center>
17147 <div>&lt;font id="bug2" /&gt;In div text</div>
17148
17149 !! end
17150
17151 #
17152 #
17153 #
17154
17155 !! test
17156 Punctuation: nbsp before exclamation
17157 !! wikitext
17158 C'est grave !
17159 !! html
17160 <p>C'est grave&#160;!
17161 </p>
17162 !! end
17163
17164 !! test
17165 Punctuation: CSS !important (bug 11874)
17166 !! wikitext
17167 <div style="width:50% !important">important</div>
17168 !! html
17169 <div style="width:50% !important">important</div>
17170
17171 !!end
17172
17173 !! test
17174 Punctuation: CSS ! important (bug 11874; with space after)
17175 !! wikitext
17176 <div style="width:50% ! important">important</div>
17177 !! html
17178 <div style="width:50% ! important">important</div>
17179
17180 !!end
17181
17182 !! test
17183 HTML bullet list, closed tags (bug 5497)
17184 !! wikitext
17185 <ul>
17186 <li>One</li>
17187 <li>Two</li>
17188 </ul>
17189 !! html/php
17190 <ul>
17191 <li>One</li>
17192 <li>Two</li>
17193 </ul>
17194
17195 !! html/parsoid
17196 <ul data-parsoid='{"stx":"html"}'>
17197 <li data-parsoid='{"stx":"html"}'>One</li>
17198 <li data-parsoid='{"stx":"html"}'>Two</li>
17199 </ul>
17200
17201 !! end
17202
17203 !! test
17204 HTML bullet list, unclosed tags (bug 5497)
17205 !! wikitext
17206 <ul>
17207 <li>One
17208 <li>Two
17209 </ul>
17210 !! html/php+tidy
17211 <ul>
17212 <li>One</li>
17213 <li>Two</li>
17214 </ul>
17215 !! html/parsoid
17216 <ul data-parsoid='{"stx":"html"}'>
17217 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17218 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17219 </ul>
17220
17221 !! end
17222
17223 !! test
17224 HTML ordered list, closed tags (bug 5497)
17225 !! wikitext
17226 <ol>
17227 <li>One</li>
17228 <li>Two</li>
17229 </ol>
17230 !! html/php
17231 <ol>
17232 <li>One</li>
17233 <li>Two</li>
17234 </ol>
17235
17236 !! html/parsoid
17237 <ol data-parsoid='{"stx":"html"}'>
17238 <li data-parsoid='{"stx":"html"}'>One</li>
17239 <li data-parsoid='{"stx":"html"}'>Two</li>
17240 </ol>
17241
17242 !! end
17243
17244 !! test
17245 HTML ordered list, unclosed tags (bug 5497)
17246 !! options
17247 !! wikitext
17248 <ol>
17249 <li>One
17250 <li>Two
17251 </ol>
17252 !! html/php+tidy
17253 <ol>
17254 <li>One</li>
17255 <li>Two</li>
17256 </ol>
17257 !! html/parsoid
17258 <ol data-parsoid='{"stx":"html"}'>
17259 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17260 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17261 </ol>
17262
17263 !! end
17264
17265 !! test
17266 HTML nested bullet list, closed tags (bug 5497)
17267 !! wikitext
17268 <ul>
17269 <li>One</li>
17270 <li>Two:
17271 <ul>
17272 <li>Sub-one</li>
17273 <li>Sub-two</li>
17274 </ul>
17275 </li>
17276 </ul>
17277 !! html/php
17278 <ul>
17279 <li>One</li>
17280 <li>Two:
17281 <ul>
17282 <li>Sub-one</li>
17283 <li>Sub-two</li>
17284 </ul>
17285 </li>
17286 </ul>
17287
17288 !! html/parsoid
17289 <ul data-parsoid='{"stx":"html"}'>
17290 <li data-parsoid='{"stx":"html"}'>One</li>
17291 <li data-parsoid='{"stx":"html"}'>Two:
17292 <ul data-parsoid='{"stx":"html"}'>
17293 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
17294 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
17295 </ul>
17296 </li>
17297 </ul>
17298 !! end
17299
17300 !! test
17301 HTML nested bullet list, open tags (bug 5497)
17302 !! wikitext
17303 <ul>
17304 <li>One
17305 <li>Two:
17306 <ul>
17307 <li>Sub-one
17308 <li>Sub-two
17309 </ul>
17310 </ul>
17311 !! html/php+tidy
17312 <ul>
17313 <li>One</li>
17314 <li>Two:
17315 <ul>
17316 <li>Sub-one</li>
17317 <li>Sub-two</li>
17318 </ul>
17319 </li>
17320 </ul>
17321 !! html/parsoid
17322 <ul>
17323 <li>One
17324 </li>
17325 <li>Two:
17326 <ul>
17327 <li>Sub-one
17328 </li>
17329 <li>Sub-two
17330 </li>
17331 </ul>
17332 </li>
17333 </ul>
17334
17335 !! end
17336
17337 !! test
17338 HTML nested ordered list, closed tags (bug 5497)
17339 !! wikitext
17340 <ol>
17341 <li>One</li>
17342 <li>Two:
17343 <ol>
17344 <li>Sub-one</li>
17345 <li>Sub-two</li>
17346 </ol>
17347 </li>
17348 </ol>
17349 !! html
17350 <ol>
17351 <li>One</li>
17352 <li>Two:
17353 <ol>
17354 <li>Sub-one</li>
17355 <li>Sub-two</li>
17356 </ol>
17357 </li>
17358 </ol>
17359
17360 !! end
17361
17362 !! test
17363 HTML nested ordered list, open tags (bug 5497)
17364 !! wikitext
17365 <ol>
17366 <li>One
17367 <li>Two:
17368 <ol>
17369 <li>Sub-one
17370 <li>Sub-two
17371 </ol>
17372 </ol>
17373 !! html/php
17374 <ol>
17375 <li>One
17376 <li>Two:
17377 <ol>
17378 <li>Sub-one
17379 <li>Sub-two
17380 </ol>
17381 </ol>
17382
17383 !! html/parsoid
17384 <ol>
17385 <li>One
17386 </li>
17387 <li>Two:
17388 <ol>
17389 <li>Sub-one
17390 </li>
17391 <li>Sub-two
17392 </li>
17393 </ol>
17394 </li>
17395 </ol>
17396
17397 !! end
17398
17399 !! test
17400 HTML ordered list item with parameters oddity
17401 !! wikitext
17402 <ol><li id="fragment">One</li>
17403 </ol>
17404 !! html
17405 <ol><li id="fragment">One</li>
17406 </ol>
17407
17408 !! end
17409
17410 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
17411 !!test
17412 bug 5918: autonumbering
17413 !! wikitext
17414 [http://first/] [http://second] [ftp://ftp]
17415
17416 ftp://inlineftp
17417
17418 [mailto:enclosed@mail.tld With target]
17419
17420 [mailto:enclosed@mail.tld]
17421
17422 mailto:inline@mail.tld
17423 !! html/php
17424 <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>
17425 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
17426 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
17427 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
17428 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
17429 </p>
17430 !! html/parsoid
17431 <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>
17432 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
17433 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
17434 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
17435 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
17436 !! end
17437
17438
17439 #
17440 # Security and HTML correctness
17441 # From Nick Jenkins' fuzz testing
17442 #
17443
17444 !! test
17445 Fuzz testing: Parser13
17446 !! wikitext
17447 {|
17448 | http://a|
17449 !! html
17450 <table>
17451 <tr>
17452 <td>
17453 </td>
17454 </tr>
17455 </table>
17456
17457 !! end
17458
17459 !! test
17460 Fuzz testing: Parser14
17461 !! wikitext
17462 == onmouseover= ==
17463 http://__TOC__
17464 !! html
17465 <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>
17466 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17467 <ul>
17468 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17469 </ul>
17470 </div>
17471
17472
17473 !! html+tidy
17474 <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>
17475 <p>http://</p>
17476 <div id="toc" class="toc">
17477 <div id="toctitle">
17478 <h2>Contents</h2>
17479 </div>
17480 <ul>
17481 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17482 </ul>
17483 </div>
17484 <p></p>
17485 !! end
17486
17487 !! test
17488 Fuzz testing: Parser14-table
17489 !! options
17490 parsoid=wt2html,html2html
17491 !! wikitext
17492 ==a==
17493 {| STYLE=__TOC__
17494 !! html
17495 <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>
17496 <table style="&#95;_TOC&#95;_">
17497 <tr><td></td></tr>
17498 </table>
17499
17500 !! html+tidy
17501 <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>
17502 <table style="__TOC__">
17503 <tr>
17504 <td></td>
17505 </tr>
17506 </table>
17507 !! html/parsoid
17508 <h2>a</h2>
17509 <table style="__TOC__"></table>
17510 !! end
17511
17512 # Known to produce bogus xml (extra </td>)
17513 !! test
17514 Fuzz testing: Parser16
17515 !! wikitext
17516 {|
17517 !https://||||||
17518 !! html
17519 <table>
17520 <tr>
17521 <th>https://</th>
17522 <th></th>
17523 <th></th>
17524 <th>
17525 </td>
17526 </tr>
17527 </table>
17528
17529 !! html+tidy
17530 <table>
17531 <tr>
17532 <th>https://</th>
17533 <th></th>
17534 <th></th>
17535 <th></th>
17536 </tr>
17537 </table>
17538 !! end
17539
17540 !! test
17541 Fuzz testing: Parser21
17542 !! wikitext
17543 {|
17544 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17545 |
17546 !! html
17547 <table>
17548 <tr>
17549 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17550 </th>
17551 <td>
17552 </td>
17553 </tr>
17554 </table>
17555
17556 !! end
17557
17558 !! test
17559 Fuzz testing: Parser22
17560 !! wikitext
17561 http://===r:::https://b
17562
17563 {|
17564 !! html
17565 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17566 </p>
17567 <table>
17568 <tr><td></td></tr>
17569 </table>
17570
17571 !! end
17572
17573 # Known to produce bad XML for now
17574 !! test
17575 Fuzz testing: Parser24
17576 !! wikitext
17577 {|
17578 {{{|
17579 <u CLASS=
17580 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17581 <br style="onmouseover='alert(document.cookie);' " />
17582
17583 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17584 |
17585 !! html
17586 <table>
17587 {{{|
17588 <u class="&#124;">}}}} &gt;
17589 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17590
17591 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17592 <tr>
17593 <td></u>
17594 </td>
17595 </tr>
17596 </table>
17597
17598 !! end
17599
17600 # Note: the current result listed for this is not what the original one was,
17601 # but the original bug was JavaScript injection, which is fixed in any case.
17602 # It's not clear that the original result listed was any more correct than the
17603 # current one. Original result:
17604 # <p>{{{|
17605 # </p>
17606 # <li class="&#124;&#124;">
17607 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17608 !!test
17609 Fuzz testing: Parser25 (bug 6055)
17610 !! wikitext
17611 {{{
17612 |
17613 <LI CLASS=||
17614 >
17615 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17616 !! html
17617 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17618 </p>
17619 !! end
17620
17621 !!test
17622 Fuzz testing: URL adjacent extension (with space, clean)
17623 !! wikitext
17624 http://example.com <nowiki>junk</nowiki>
17625 !! html/php
17626 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17627 </p>
17628 !! html/parsoid
17629 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17630 !! end
17631
17632 !!test
17633 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17634 !! wikitext
17635 http://example.com<nowiki>junk</nowiki>
17636 !! html/php
17637 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17638 </p>
17639 !! html/parsoid
17640 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17641 !! end
17642
17643 !!test
17644 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17645 !! wikitext
17646 http://example.com<pre>junk</pre>
17647 !! html/php
17648 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17649
17650 !! html/php+tidy
17651 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17652 <pre>
17653 junk
17654 </pre>
17655 !! html/parsoid
17656 <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>
17657 !!end
17658
17659 !!test
17660 Fuzz testing: image with bogus manual thumbnail
17661 !! wikitext
17662 [[Image:foobar.jpg|thumbnail= ]]
17663 !! html/php
17664 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17665
17666 !! html/parsoid
17667 <figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"manualthumb","ak":"thumbnail= "}]}' 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":{}}'><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>
17668 !!end
17669
17670 !! test
17671 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17672 !! wikitext
17673 <pre dir="&#10;"></pre>
17674 !! html
17675 <pre dir="&#10;"></pre>
17676
17677 !! end
17678
17679 !! test
17680 Parsing optional HTML elements (Bug 6171)
17681 !! options
17682 !! wikitext
17683 <table>
17684 <tr>
17685 <td> Some tabular data</td>
17686 <td> More tabular data ...
17687 <td> And yet som tabular data</td>
17688 </tr>
17689 </table>
17690 !! html
17691 <table>
17692 <tr>
17693 <td> Some tabular data</td>
17694 <td> More tabular data ...
17695 </td><td> And yet som tabular data</td>
17696 </tr>
17697 </table>
17698
17699 !! end
17700
17701 !! test
17702 Correct handling of <td>, <tr> (Bug 6171)
17703 !! options
17704 !! wikitext
17705 <table>
17706 <tr>
17707 <td> Some tabular data</td>
17708 <td> More tabular data ...</td>
17709 <td> And yet som tabular data</td>
17710 </tr>
17711 </table>
17712 !! html
17713 <table>
17714 <tr>
17715 <td> Some tabular data</td>
17716 <td> More tabular data ...</td>
17717 <td> And yet som tabular data</td>
17718 </tr>
17719 </table>
17720
17721 !! end
17722
17723
17724 !! test
17725 Parsing crashing regression (fr:JavaScript)
17726 !! wikitext
17727 </body></x>
17728 !! html
17729 <p>&lt;/body&gt;&lt;/x&gt;
17730 </p>
17731 !! end
17732
17733 !! test
17734 Inline wiki vs wiki block nesting
17735 !! wikitext
17736 '''Bold paragraph
17737
17738 New wiki paragraph
17739 !! html
17740 <p><b>Bold paragraph</b>
17741 </p><p>New wiki paragraph
17742 </p>
17743 !! end
17744
17745 # FIXME: The current php output is documented
17746 # and desired output is the parsoid target.
17747 !! test
17748 Inline HTML vs wiki block nesting
17749 !! wikitext
17750 <b>Bold paragraph
17751
17752 New wiki paragraph
17753 !! html/php
17754 <p><b>Bold paragraph
17755 </p><p>New wiki paragraph</b>
17756 </p>
17757 !! html/parsoid
17758 <p><b>Bold paragraph</b>
17759 </p><p>New wiki paragraph
17760 </p>
17761 !! end
17762
17763 # Original result was this:
17764 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
17765 # </p>
17766 # While that might be marginally more intuitive, maybe, the six-apostrophe
17767 # construct is clearly pathological and the result stated here (which is what
17768 # the parser actually does) is about as reasonable as anything.
17769 !!test
17770 Mixing markup for italics and bold
17771 !! options
17772 !! wikitext
17773 '''bold''''''bold''bolditalics'''''
17774 !! html
17775 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
17776 </p>
17777 !! end
17778
17779
17780 !! article
17781 Xyzzyx
17782 !! text
17783 Article for special page transclusion test
17784 !! endarticle
17785
17786 !! test
17787 Special page transclusion
17788 !! options
17789 !! wikitext
17790 {{Special:Prefixindex/Xyzzyx}}
17791 !! html
17792 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17793 </ul>
17794
17795 !! end
17796
17797 !! test
17798 Special page transclusion twice (bug 5021)
17799 !! options
17800 !! wikitext
17801 {{Special:Prefixindex/Xyzzyx}}
17802 {{Special:Prefixindex/Xyzzyx}}
17803 !! html
17804 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17805 </ul>
17806 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17807 </ul>
17808
17809 !! end
17810
17811 !! test
17812 Transclusion of default MediaWiki message
17813 !! wikitext
17814 {{MediaWiki:Mainpage}}
17815 !! html
17816 <p>Main Page
17817 </p>
17818 !! end
17819
17820 !! test
17821 Transclusion of nonexistent MediaWiki message
17822 !! wikitext
17823 {{MediaWiki:Mainpagexxx}}
17824 !! html
17825 <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>
17826 </p>
17827 !! end
17828
17829 !! test
17830 Transclusion of MediaWiki message with underscore
17831 !! wikitext
17832 {{MediaWiki:history_short}}
17833 !! html
17834 <p>History
17835 </p>
17836 !! end
17837
17838 !! test
17839 Transclusion of MediaWiki message with space
17840 !! wikitext
17841 {{MediaWiki:history short}}
17842 !! html
17843 <p>History
17844 </p>
17845 !! end
17846
17847 !! test
17848 Invalid header with following text
17849 !! wikitext
17850 = x = y
17851 !! html
17852 <p>= x = y
17853 </p>
17854 !! end
17855
17856
17857 !! test
17858 Section extraction test (section 0)
17859 !! options
17860 section=0
17861 !! wikitext
17862 start
17863 ==a==
17864 ===aa===
17865 ====aaa====
17866 ==b==
17867 ===ba===
17868 ===bb===
17869 ====bba====
17870 ===bc===
17871 ==c==
17872 ===ca===
17873 !! html/php
17874 start
17875 !! end
17876
17877 !! test
17878 Section extraction test (section 1)
17879 !! options
17880 section=1
17881 !! wikitext
17882 start
17883 ==a==
17884 ===aa===
17885 ====aaa====
17886 ==b==
17887 ===ba===
17888 ===bb===
17889 ====bba====
17890 ===bc===
17891 ==c==
17892 ===ca===
17893 !! html/php
17894 ==a==
17895 ===aa===
17896 ====aaa====
17897 !! end
17898
17899 !! test
17900 Section extraction test (section 2)
17901 !! options
17902 section=2
17903 !! wikitext
17904 start
17905 ==a==
17906 ===aa===
17907 ====aaa====
17908 ==b==
17909 ===ba===
17910 ===bb===
17911 ====bba====
17912 ===bc===
17913 ==c==
17914 ===ca===
17915 !! html/php
17916 ===aa===
17917 ====aaa====
17918 !! end
17919
17920 !! test
17921 Section extraction test (section 3)
17922 !! options
17923 section=3
17924 !! wikitext
17925 start
17926 ==a==
17927 ===aa===
17928 ====aaa====
17929 ==b==
17930 ===ba===
17931 ===bb===
17932 ====bba====
17933 ===bc===
17934 ==c==
17935 ===ca===
17936 !! html/php
17937 ====aaa====
17938 !! end
17939
17940 !! test
17941 Section extraction test (section 4)
17942 !! options
17943 section=4
17944 !! wikitext
17945 start
17946 ==a==
17947 ===aa===
17948 ====aaa====
17949 ==b==
17950 ===ba===
17951 ===bb===
17952 ====bba====
17953 ===bc===
17954 ==c==
17955 ===ca===
17956 !! html/php
17957 ==b==
17958 ===ba===
17959 ===bb===
17960 ====bba====
17961 ===bc===
17962 !! end
17963
17964 !! test
17965 Section extraction test (section 5)
17966 !! options
17967 section=5
17968 !! wikitext
17969 start
17970 ==a==
17971 ===aa===
17972 ====aaa====
17973 ==b==
17974 ===ba===
17975 ===bb===
17976 ====bba====
17977 ===bc===
17978 ==c==
17979 ===ca===
17980 !! html/php
17981 ===ba===
17982 !! end
17983
17984 !! test
17985 Section extraction test (section 6)
17986 !! options
17987 section=6
17988 !! wikitext
17989 start
17990 ==a==
17991 ===aa===
17992 ====aaa====
17993 ==b==
17994 ===ba===
17995 ===bb===
17996 ====bba====
17997 ===bc===
17998 ==c==
17999 ===ca===
18000 !! html/php
18001 ===bb===
18002 ====bba====
18003 !! end
18004
18005 !! test
18006 Section extraction test (section 7)
18007 !! options
18008 section=7
18009 !! wikitext
18010 start
18011 ==a==
18012 ===aa===
18013 ====aaa====
18014 ==b==
18015 ===ba===
18016 ===bb===
18017 ====bba====
18018 ===bc===
18019 ==c==
18020 ===ca===
18021 !! html/php
18022 ====bba====
18023 !! end
18024
18025 !! test
18026 Section extraction test (section 8)
18027 !! options
18028 section=8
18029 !! wikitext
18030 start
18031 ==a==
18032 ===aa===
18033 ====aaa====
18034 ==b==
18035 ===ba===
18036 ===bb===
18037 ====bba====
18038 ===bc===
18039 ==c==
18040 ===ca===
18041 !! html/php
18042 ===bc===
18043 !! end
18044
18045 !! test
18046 Section extraction test (section 9)
18047 !! options
18048 section=9
18049 !! wikitext
18050 start
18051 ==a==
18052 ===aa===
18053 ====aaa====
18054 ==b==
18055 ===ba===
18056 ===bb===
18057 ====bba====
18058 ===bc===
18059 ==c==
18060 ===ca===
18061 !! html/php
18062 ==c==
18063 ===ca===
18064 !! end
18065
18066 !! test
18067 Section extraction test (section 10)
18068 !! options
18069 section=10
18070 !! wikitext
18071 start
18072 ==a==
18073 ===aa===
18074 ====aaa====
18075 ==b==
18076 ===ba===
18077 ===bb===
18078 ====bba====
18079 ===bc===
18080 ==c==
18081 ===ca===
18082 !! html/php
18083 ===ca===
18084 !! end
18085
18086 !! test
18087 Section extraction test (nonexistent section 11)
18088 !! options
18089 section=11
18090 !! wikitext
18091 start
18092 ==a==
18093 ===aa===
18094 ====aaa====
18095 ==b==
18096 ===ba===
18097 ===bb===
18098 ====bba====
18099 ===bc===
18100 ==c==
18101 ===ca===
18102 !! html/php
18103 !! end
18104
18105 !! test
18106 Section extraction test with bogus heading (section 1)
18107 !! options
18108 section=1
18109 !! wikitext
18110 ==a==
18111 ==bogus== not a legal section
18112 ==b==
18113 !! html/php
18114 ==a==
18115 ==bogus== not a legal section
18116 !! end
18117
18118 !! test
18119 Section extraction test with bogus heading (section 2)
18120 !! options
18121 section=2
18122 !! wikitext
18123 ==a==
18124 ==bogus== not a legal section
18125 ==b==
18126 !! html/php
18127 ==b==
18128 !! end
18129
18130 !! test
18131 Section extraction test with comment after heading (section 1)
18132 !! options
18133 section=1
18134 !! wikitext
18135 ==a==
18136 ==b== <!-- -->
18137 ==c==
18138 !! html/php
18139 ==a==
18140 !! end
18141
18142 !! test
18143 Section extraction test with comment after heading (section 2)
18144 !! options
18145 section=2
18146 !! wikitext
18147 ==a==
18148 ==b== <!-- -->
18149 ==c==
18150 !! html/php
18151 ==b== <!-- -->
18152 !! end
18153
18154 !! test
18155 Section extraction test with bogus <nowiki> heading (section 1)
18156 !! options
18157 section=1
18158 !! wikitext
18159 ==a==
18160 ==bogus== <nowiki>not a legal section</nowiki>
18161 ==b==
18162 !! html/php
18163 ==a==
18164 ==bogus== <nowiki>not a legal section</nowiki>
18165 !! end
18166
18167 !! test
18168 Section extraction test with bogus <nowiki> heading (section 2)
18169 !! options
18170 section=2
18171 !! wikitext
18172 ==a==
18173 ==bogus== <nowiki>not a legal section</nowiki>
18174 ==b==
18175 !! html/php
18176 ==b==
18177 !! end
18178
18179 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
18180 # instead of respecting commented sections
18181 !! test
18182 Section extraction prefixed by comment (section 1)
18183 !! options
18184 section=1
18185 !! wikitext
18186 <!-- -->==sec1==
18187 ==sec2==
18188 !! html/php
18189 ==sec2==
18190 !!end
18191
18192 !! test
18193 Section extraction prefixed by comment (section 2)
18194 !! options
18195 section=2
18196 !! wikitext
18197 <!-- -->==sec1==
18198 ==sec2==
18199 !! html/php
18200
18201 !!end
18202
18203 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
18204 # instead of respecting HTML-style headings
18205 !! test
18206 Section extraction, mixed wiki and html (section 1)
18207 !! options
18208 section=1
18209 !! wikitext
18210 <h2>unmarked</h2>
18211 unmarked
18212 ==1==
18213 one
18214 ==2==
18215 two
18216 !! html/php
18217 ==1==
18218 one
18219 !! end
18220
18221 !! test
18222 Section extraction, mixed wiki and html (section 2)
18223 !! options
18224 section=2
18225 !! wikitext
18226 <h2>unmarked</h2>
18227 unmarked
18228 ==1==
18229 one
18230 ==2==
18231 two
18232 !! html/php
18233 ==2==
18234 two
18235 !! end
18236
18237
18238 # Formerly testing for bug 3342
18239 !! test
18240 Section extraction, heading surrounded by <noinclude>
18241 !! options
18242 section=1
18243 !! wikitext
18244 <noinclude>==unmarked==</noinclude>
18245 ==marked==
18246 !! html/php
18247 ==marked==
18248 !!end
18249
18250 # Test behavior of bug 19910
18251 !! test
18252 Sectiion with all-equals
18253 !! options
18254 section=2
18255 !! wikitext
18256 ===
18257 The line above must have a trailing space
18258 === <!--
18259 --> <!-- -->
18260 But just in case it doesn't...
18261 !! html/php
18262 === <!--
18263 --> <!-- -->
18264 But just in case it doesn't...
18265 !! end
18266
18267 !! test
18268 Section replacement test (section 0)
18269 !! options
18270 replace=0,"xxx"
18271 !! wikitext
18272 start
18273 ==a==
18274 ===aa===
18275 ====aaa====
18276 ==b==
18277 ===ba===
18278 ===bb===
18279 ====bba====
18280 ===bc===
18281 ==c==
18282 ===ca===
18283 !! html/php
18284 xxx
18285
18286 ==a==
18287 ===aa===
18288 ====aaa====
18289 ==b==
18290 ===ba===
18291 ===bb===
18292 ====bba====
18293 ===bc===
18294 ==c==
18295 ===ca===
18296 !! end
18297
18298 !! test
18299 Section replacement test (section 1)
18300 !! options
18301 replace=1,"xxx"
18302 !! wikitext
18303 start
18304 ==a==
18305 ===aa===
18306 ====aaa====
18307 ==b==
18308 ===ba===
18309 ===bb===
18310 ====bba====
18311 ===bc===
18312 ==c==
18313 ===ca===
18314 !! html/php
18315 start
18316 xxx
18317
18318 ==b==
18319 ===ba===
18320 ===bb===
18321 ====bba====
18322 ===bc===
18323 ==c==
18324 ===ca===
18325 !! end
18326
18327 !! test
18328 Section replacement test (section 2)
18329 !! options
18330 replace=2,"xxx"
18331 !! wikitext
18332 start
18333 ==a==
18334 ===aa===
18335 ====aaa====
18336 ==b==
18337 ===ba===
18338 ===bb===
18339 ====bba====
18340 ===bc===
18341 ==c==
18342 ===ca===
18343 !! html/php
18344 start
18345 ==a==
18346 xxx
18347
18348 ==b==
18349 ===ba===
18350 ===bb===
18351 ====bba====
18352 ===bc===
18353 ==c==
18354 ===ca===
18355 !! end
18356
18357 !! test
18358 Section replacement test (section 3)
18359 !! options
18360 replace=3,"xxx"
18361 !! wikitext
18362 start
18363 ==a==
18364 ===aa===
18365 ====aaa====
18366 ==b==
18367 ===ba===
18368 ===bb===
18369 ====bba====
18370 ===bc===
18371 ==c==
18372 ===ca===
18373 !! html/php
18374 start
18375 ==a==
18376 ===aa===
18377 xxx
18378
18379 ==b==
18380 ===ba===
18381 ===bb===
18382 ====bba====
18383 ===bc===
18384 ==c==
18385 ===ca===
18386 !! end
18387
18388 !! test
18389 Section replacement test (section 4)
18390 !! options
18391 replace=4,"xxx"
18392 !! wikitext
18393 start
18394 ==a==
18395 ===aa===
18396 ====aaa====
18397 ==b==
18398 ===ba===
18399 ===bb===
18400 ====bba====
18401 ===bc===
18402 ==c==
18403 ===ca===
18404 !! html/php
18405 start
18406 ==a==
18407 ===aa===
18408 ====aaa====
18409 xxx
18410
18411 ==c==
18412 ===ca===
18413 !! end
18414
18415 !! test
18416 Section replacement test (section 5)
18417 !! options
18418 replace=5,"xxx"
18419 !! wikitext
18420 start
18421 ==a==
18422 ===aa===
18423 ====aaa====
18424 ==b==
18425 ===ba===
18426 ===bb===
18427 ====bba====
18428 ===bc===
18429 ==c==
18430 ===ca===
18431 !! html/php
18432 start
18433 ==a==
18434 ===aa===
18435 ====aaa====
18436 ==b==
18437 xxx
18438
18439 ===bb===
18440 ====bba====
18441 ===bc===
18442 ==c==
18443 ===ca===
18444 !! end
18445
18446 !! test
18447 Section replacement test (section 6)
18448 !! options
18449 replace=6,"xxx"
18450 !! wikitext
18451 start
18452 ==a==
18453 ===aa===
18454 ====aaa====
18455 ==b==
18456 ===ba===
18457 ===bb===
18458 ====bba====
18459 ===bc===
18460 ==c==
18461 ===ca===
18462 !! html/php
18463 start
18464 ==a==
18465 ===aa===
18466 ====aaa====
18467 ==b==
18468 ===ba===
18469 xxx
18470
18471 ===bc===
18472 ==c==
18473 ===ca===
18474 !! end
18475
18476 !! test
18477 Section replacement test (section 7)
18478 !! options
18479 replace=7,"xxx"
18480 !! wikitext
18481 start
18482 ==a==
18483 ===aa===
18484 ====aaa====
18485 ==b==
18486 ===ba===
18487 ===bb===
18488 ====bba====
18489 ===bc===
18490 ==c==
18491 ===ca===
18492 !! html/php
18493 start
18494 ==a==
18495 ===aa===
18496 ====aaa====
18497 ==b==
18498 ===ba===
18499 ===bb===
18500 xxx
18501
18502 ===bc===
18503 ==c==
18504 ===ca===
18505 !! end
18506
18507 !! test
18508 Section replacement test (section 8)
18509 !! options
18510 replace=8,"xxx"
18511 !! wikitext
18512 start
18513 ==a==
18514 ===aa===
18515 ====aaa====
18516 ==b==
18517 ===ba===
18518 ===bb===
18519 ====bba====
18520 ===bc===
18521 ==c==
18522 ===ca===
18523 !! html/php
18524 start
18525 ==a==
18526 ===aa===
18527 ====aaa====
18528 ==b==
18529 ===ba===
18530 ===bb===
18531 ====bba====
18532 xxx
18533
18534 ==c==
18535 ===ca===
18536 !!end
18537
18538 !! test
18539 Section replacement test (section 9)
18540 !! options
18541 replace=9,"xxx"
18542 !! wikitext
18543 start
18544 ==a==
18545 ===aa===
18546 ====aaa====
18547 ==b==
18548 ===ba===
18549 ===bb===
18550 ====bba====
18551 ===bc===
18552 ==c==
18553 ===ca===
18554 !! html/php
18555 start
18556 ==a==
18557 ===aa===
18558 ====aaa====
18559 ==b==
18560 ===ba===
18561 ===bb===
18562 ====bba====
18563 ===bc===
18564 xxx
18565 !! end
18566
18567 !! test
18568 Section replacement test (section 10)
18569 !! options
18570 replace=10,"xxx"
18571 !! wikitext
18572 start
18573 ==a==
18574 ===aa===
18575 ====aaa====
18576 ==b==
18577 ===ba===
18578 ===bb===
18579 ====bba====
18580 ===bc===
18581 ==c==
18582 ===ca===
18583 !! html/php
18584 start
18585 ==a==
18586 ===aa===
18587 ====aaa====
18588 ==b==
18589 ===ba===
18590 ===bb===
18591 ====bba====
18592 ===bc===
18593 ==c==
18594 xxx
18595 !! end
18596
18597 !! test
18598 Section replacement test with initial whitespace (bug 13728)
18599 !! options
18600 replace=2,"xxx"
18601 !! wikitext
18602 Preformatted initial line
18603 ==a==
18604 ===a===
18605 !! html/php
18606 Preformatted initial line
18607 ==a==
18608 xxx
18609 !! end
18610
18611
18612 !! test
18613 Section extraction, heading followed by pre with 20 spaces (bug 6398)
18614 !! options
18615 section=1
18616 !! wikitext
18617 ==a==
18618 a
18619 !! html/php
18620 ==a==
18621 a
18622 !! end
18623
18624 !! test
18625 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
18626 !! options
18627 section=1
18628 !! wikitext
18629 ==a==
18630 a
18631 !! html/php
18632 ==a==
18633 a
18634 !! end
18635
18636
18637 !! test
18638 Section extraction, <pre> around bogus header (bug 10309)
18639 !! options
18640 section=2
18641 !! wikitext
18642 == Section One ==
18643 <pre>
18644 =======
18645 </pre>
18646
18647 == Section Two ==
18648 stuff
18649 !! html/php
18650 == Section Two ==
18651 stuff
18652 !! end
18653
18654 !! test
18655 Section replacement, <pre> around bogus header (bug 10309)
18656 !! options
18657 replace=2,"xxx"
18658 !! wikitext
18659 == Section One ==
18660 <pre>
18661 =======
18662 </pre>
18663
18664 == Section Two ==
18665 stuff
18666 !! html/php
18667 == Section One ==
18668 <pre>
18669 =======
18670 </pre>
18671
18672 xxx
18673 !! end
18674
18675
18676 !! test
18677 Handling of &#x0A; in URLs
18678 !! wikitext
18679 ** irc://&#x0A;a
18680 !! html/php
18681 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18682
18683 !! html/parsoid
18684 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
18685 a">irc://
18686 a</a></li></ul></li></ul>
18687 !! end
18688
18689 !! test
18690 Handling of %0A in URLs
18691 !! wikitext
18692 ** irc://%0Aa
18693 !! html/php
18694 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18695
18696 !! html/parsoid
18697 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18698 !! end
18699
18700
18701 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18702 !! test
18703 5 quotes, code coverage +1 line
18704 !! options
18705 parsoid=wt2html
18706 !! wikitext
18707 '''''
18708 !! html/php
18709 !! html/parsoid
18710 <p><b><i></i></b></p>
18711 !! end
18712
18713 # same html as previous, but wikitext adjusted to match parsoid html2wt
18714 # note that wt2html and html2html will put the <i> before the <b>
18715 !! test
18716 5 quotes, code coverage +1 line w/ nowiki (1)
18717 !! options
18718 parsoid=wt2wt,html2wt
18719 !! wikitext
18720 '''''<nowiki/>'''''
18721 !! html/php
18722 <p><i></i>
18723 </p>
18724 !! html/parsoid
18725 <p><b><i></i></b></p>
18726 !! end
18727
18728 # same as previous, just swapping the <i> and <b>
18729 !! test
18730 5 quotes, code coverage +1 line w/ nowiki (2)
18731 !! wikitext
18732 '''''<nowiki/>'''''
18733 !! html/php
18734 <p><i></i>
18735 </p>
18736 !! html/parsoid
18737 <p><i><b></b></i></p>
18738 !! end
18739
18740 !! test
18741 Special:Search page linking.
18742 !! wikitext
18743 {{Special:search}}
18744 !! html
18745 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18746 </p>
18747 !! end
18748
18749 !! test
18750 {{!}} is a magic word
18751 !! wikitext
18752 {{!}} is a magic word there and {{!}} is still a magic word here
18753 | is not a magic word here but {{!}} is still a magic word here
18754 !! html/php
18755 <p>| is a magic word there and | is still a magic word here
18756 | is not a magic word here but | is still a magic word here
18757 </p>
18758 !! html/parsoid
18759 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}'>|</span> is a magic word there and <span about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}'>|</span> is still a magic word here
18760 | is not a magic word here but <span about="#mwt3" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"!","href":"./Template:!"},"params":{},"i":0}}]}'>|</span> is still a magic word here</p>
18761
18762 !! end
18763
18764 !! test
18765 Say the magic word
18766 !! options
18767 title=[[Parser test]]
18768 !! wikitext
18769 * {{PAGENAME}}
18770 * {{PAGENAMEE}}
18771 * {{FULLPAGENAME}}
18772 * {{FULLPAGENAMEE}}
18773 * {{BASEPAGENAME}}
18774 * {{BASEPAGENAMEE}}
18775 * {{SUBPAGENAME}}
18776 * {{SUBPAGENAMEE}}
18777 * {{ROOTPAGENAME}}
18778 * {{ROOTPAGENAMEE}}
18779 * {{TALKPAGENAME}}
18780 * {{TALKPAGENAMEE}}
18781 * {{SUBJECTPAGENAME}}
18782 * {{SUBJECTPAGENAMEE}}
18783 * {{NAMESPACEE}}
18784 * {{NAMESPACE}}
18785 * {{NAMESPACENUMBER}}
18786 * {{TALKSPACE}}
18787 * {{TALKSPACEE}}
18788 * {{SUBJECTSPACE}}
18789 * {{SUBJECTSPACEE}}
18790 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18791 !! html
18792 <ul><li> Parser test</li>
18793 <li> Parser_test</li>
18794 <li> Parser test</li>
18795 <li> Parser_test</li>
18796 <li> Parser test</li>
18797 <li> Parser_test</li>
18798 <li> Parser test</li>
18799 <li> Parser_test</li>
18800 <li> Parser test</li>
18801 <li> Parser_test</li>
18802 <li> Talk:Parser test</li>
18803 <li> Talk:Parser_test</li>
18804 <li> Parser test</li>
18805 <li> Parser_test</li>
18806 <li> </li>
18807 <li> </li>
18808 <li> 0</li>
18809 <li> Talk</li>
18810 <li> Talk</li>
18811 <li> </li>
18812 <li> </li>
18813 <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>
18814
18815 !! end
18816 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18817
18818 !! test
18819 Gallery
18820 !! wikitext
18821 <gallery>
18822 image1.png |
18823 image2.gif|||||
18824
18825 image3|
18826 image4 |300px| centre
18827 image5.svg| http://///////
18828 [[x|xx]]]]
18829 * image6
18830 </gallery>
18831 !! html
18832 <ul class="gallery mw-gallery-traditional">
18833 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18834 <div class="thumb" style="height: 150px;">Image1.png</div>
18835 <div class="gallerytext">
18836 </div>
18837 </div></li>
18838 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18839 <div class="thumb" style="height: 150px;">Image2.gif</div>
18840 <div class="gallerytext">
18841 </div>
18842 </div></li>
18843 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18844 <div class="thumb" style="height: 150px;">Image3</div>
18845 <div class="gallerytext">
18846 </div>
18847 </div></li>
18848 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18849 <div class="thumb" style="height: 150px;">Image4</div>
18850 <div class="gallerytext">
18851 <pre>centre
18852 </pre>
18853 </div>
18854 </div></li>
18855 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18856 <div class="thumb" style="height: 150px;">Image5.svg</div>
18857 <div class="gallerytext">
18858 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
18859 </p>
18860 </div>
18861 </div></li>
18862 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18863 <div class="thumb" style="height: 150px;">* image6</div>
18864 <div class="gallerytext">
18865 </div>
18866 </div></li>
18867 </ul>
18868
18869 !! end
18870
18871 !! test
18872 Gallery (with options)
18873 !! wikitext
18874 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
18875 File:Nonexistent.jpg|caption
18876 File:Nonexistent.jpg
18877 image:foobar.jpg|some '''caption''' [[Main Page]]
18878 image:foobar.jpg
18879 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
18880 </gallery>
18881 !! html
18882 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
18883 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
18884 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18885 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18886 <div class="gallerytext">
18887 <p>caption
18888 </p>
18889 </div>
18890 </div></li>
18891 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18892 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18893 <div class="gallerytext">
18894 </div>
18895 </div></li>
18896 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18897 <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>
18898 <div class="gallerytext">
18899 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18900 </p>
18901 </div>
18902 </div></li>
18903 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18904 <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>
18905 <div class="gallerytext">
18906 </div>
18907 </div></li>
18908 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18909 <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>
18910 <div class="gallerytext">
18911 <p>blabla.
18912 </p>
18913 </div>
18914 </div></li>
18915 </ul>
18916
18917 !! end
18918
18919 !! test
18920 Gallery with link that has fragment
18921 !! wikitext
18922 <gallery>
18923 image:foobar.jpg|link=Main_Page
18924 image:foobar.jpg|link=Main_Page#section
18925 image:foobar.jpg|link=Main Page#section|caption
18926 </gallery>
18927 !! html
18928 <ul class="gallery mw-gallery-traditional">
18929 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18930 <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>
18931 <div class="gallerytext">
18932 </div>
18933 </div></li>
18934 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18935 <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>
18936 <div class="gallerytext">
18937 </div>
18938 </div></li>
18939 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18940 <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>
18941 <div class="gallerytext">
18942 <p>caption
18943 </p>
18944 </div>
18945 </div></li>
18946 </ul>
18947
18948 !! end
18949
18950 !! test
18951 Gallery with wikitext inside caption
18952 !! wikitext
18953 <gallery>
18954 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
18955 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
18956 </gallery>
18957 !! html
18958 <ul class="gallery mw-gallery-traditional">
18959 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18960 <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>
18961 <div class="gallerytext">
18962 <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>
18963 </p>
18964 </div>
18965 </div></li>
18966 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18967 <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>
18968 <div class="gallerytext">
18969 <p>This is a test template
18970 </p>
18971 </div>
18972 </div></li>
18973 </ul>
18974
18975 !! end
18976
18977 !! test
18978 gallery (with showfilename option)
18979 !! wikitext
18980 <gallery showfilename>
18981 File:Nonexistent.jpg|caption
18982 File:Nonexistent.jpg
18983 image:foobar.jpg|some '''caption''' [[Main Page]]
18984 File:Foobar.jpg
18985 </gallery>
18986 !! html
18987 <ul class="gallery mw-gallery-traditional">
18988 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18989 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18990 <div class="gallerytext">
18991 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
18992 caption
18993 </p>
18994 </div>
18995 </div></li>
18996 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18997 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18998 <div class="gallerytext">
18999 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19000 </p>
19001 </div>
19002 </div></li>
19003 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19004 <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>
19005 <div class="gallerytext">
19006 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19007 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19008 </p>
19009 </div>
19010 </div></li>
19011 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19012 <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>
19013 <div class="gallerytext">
19014 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19015 </p>
19016 </div>
19017 </div></li>
19018 </ul>
19019
19020 !! end
19021
19022 !! test
19023 Gallery (with namespace-less filenames)
19024 !! wikitext
19025 <gallery>
19026 File:Nonexistent.jpg
19027 Nonexistent.jpg
19028 image:foobar.jpg
19029 foobar.jpg
19030 </gallery>
19031 !! html
19032 <ul class="gallery mw-gallery-traditional">
19033 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19034 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19035 <div class="gallerytext">
19036 </div>
19037 </div></li>
19038 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19039 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19040 <div class="gallerytext">
19041 </div>
19042 </div></li>
19043 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19044 <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>
19045 <div class="gallerytext">
19046 </div>
19047 </div></li>
19048 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19049 <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>
19050 <div class="gallerytext">
19051 </div>
19052 </div></li>
19053 </ul>
19054
19055 !! end
19056
19057 !! test
19058 HTML Hex character encoding (spells the word "JavaScript")
19059 !! options
19060 parsoid=wt2html,wt2wt,html2html
19061 !! wikitext
19062 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
19063 !! html/php
19064 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
19065 </p>
19066 !! html/php+tidy
19067 <p>JavaScript</p>
19068 !! html/parsoid
19069 <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>
19070 !! end
19071
19072 !! test
19073 HTML Hex character encoding bogus encoding (bug 26437 regression check)
19074 !! wikitext
19075 &#xsee;&#XSEE;
19076 !! html/php
19077 <p>&amp;#xsee;&amp;#XSEE;
19078 </p>
19079 !! html/parsoid
19080 <p>&amp;#xsee;&amp;#XSEE;</p>
19081 !! end
19082
19083 !! test
19084 HTML Hex character encoding mixed case
19085 !! options
19086 parsoid=wt2html,wt2wt,html2html
19087 !! wikitext
19088 &#xEE;&#Xee;
19089 !! html/php
19090 <p>&#xee;&#xee;
19091 </p>
19092 !! html/php+tidy
19093 <p>îî</p>
19094 !! html/parsoid
19095 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
19096 !! end
19097
19098 # See: http://www.w3.org/TR/html5/syntax.html#character-references
19099 # Note that U+000C (form feed) is not a valid XML character, so
19100 # it is banned even though allowed in HTML5.
19101 !! test
19102 Illegal character references (T106578)
19103 !! wikitext
19104 ; Null: &#00;
19105 ; FF: &#xC;
19106 ; CR: &#xD;
19107 ; Control (low): &#8;
19108 ; Control (high): &#x7F; &#x9F;
19109 ; Surrogate: &#xD83D;&#xDCA9;
19110 ; This is an okay astral character: &#x1F4A9;
19111 !! html+tidy
19112 <dl>
19113 <dt>Null</dt>
19114 <dd>&amp;#00;</dd>
19115 <dt>FF</dt>
19116 <dd>&amp;#xC;</dd>
19117 <dt>CR</dt>
19118 <dd>&amp;#xD;</dd>
19119 <dt>Control (low)</dt>
19120 <dd>&amp;#8;</dd>
19121 <dt>Control (high)</dt>
19122 <dd>&amp;#x7F; &amp;#x9F;</dd>
19123 <dt>Surrogate</dt>
19124 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
19125 <dt>This is an okay astral character</dt>
19126 <dd>💩</dd>
19127 </dl>
19128 !! end
19129
19130 !! test
19131 __FORCETOC__ override
19132 !! wikitext
19133 __NEWSECTIONLINK__
19134 __FORCETOC__
19135 !! html/php
19136 <p><br />
19137 </p>
19138 !! end
19139
19140 !! test
19141 ISBN code coverage
19142 !! wikitext
19143 ISBN 978-0-1234-56&#x20;789
19144 !! html
19145 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
19146 </p>
19147 !! html+tidy
19148 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
19149 !! html/parsoid
19150 <p><a href="./Special:BookSources/9780123456" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978-0-1234-56</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x20;","srcContent":" "}'> </span>789</p>
19151 !! end
19152
19153 !! test
19154 ISBN followed by 5 spaces
19155 !! wikitext
19156 ISBN
19157 !! html
19158 <p>ISBN
19159 </p>
19160 !! end
19161
19162 !! test
19163 Double ISBN
19164 !! wikitext
19165 ISBN ISBN 1234567890
19166 !! html/php
19167 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19168 </p>
19169 !! html/parsoid
19170 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
19171 !! end
19172
19173 # Uppercase X and lowercase x as well
19174 !! test
19175 ISBN with an X
19176 !! wikitext
19177 ISBN 3-462-04561-X
19178 ISBN 3-462-04561-x
19179 ISBN 080442957X
19180 ISBN 080442957x
19181 ISBN 978080442957X
19182 ISBN 978080442957x
19183 !! html/php
19184 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
19185 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
19186 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
19187 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
19188 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
19189 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
19190 </p>
19191 !! html/parsoid
19192 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
19193 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
19194 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
19195 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
19196 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
19197 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
19198 !! end
19199
19200 !! test
19201 ISBN with empty prefix (parsoid test)
19202 !! wikitext
19203 ISBN 1234567890
19204 !! html/php
19205 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19206 </p>
19207 !! html/parsoid
19208 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
19209 !! end
19210
19211 !! test
19212 Bug 22905: <abbr> followed by ISBN followed by </a>
19213 !! wikitext
19214 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
19215 !! html/php
19216 <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>
19217 </p>
19218 !! html/parsoid
19219 <p><abbr data-parsoid='{"stx":"html"}'>(fr)</abbr> <a href="./Special:BookSources/2753300917" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 2753300917</a> <a rel="mw:ExtLink" href="http://www.example.com">example.com</a></p>
19220 !! end
19221
19222 !! test
19223 Double RFC
19224 !! wikitext
19225 RFC RFC 1234
19226 !! html
19227 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
19228 </p>
19229 !! end
19230
19231 !! test
19232 Double RFC with a wiki link
19233 !! wikitext
19234 RFC [[RFC 1234]]
19235 !! html
19236 <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>
19237 </p>
19238 !! end
19239
19240 !! test
19241 RFC code coverage
19242 !! wikitext
19243 RFC 983&#x20;987
19244 !! html
19245 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
19246 </p>
19247 !! html+tidy
19248 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
19249 !! end
19250
19251 !! test
19252 Centre-aligned image
19253 !! wikitext
19254 [[Image:foobar.jpg|centre]]
19255 !! html
19256 <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>
19257
19258 !!end
19259
19260 !! test
19261 None-aligned image
19262 !! wikitext
19263 [[Image:foobar.jpg|none]]
19264 !! html
19265 <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>
19266
19267 !!end
19268
19269 !! test
19270 Width + Height sized image (using px) (height is ignored)
19271 !! wikitext
19272 [[Image:foobar.jpg|640x480px]]
19273 !! html
19274 <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>
19275 </p>
19276 !!end
19277
19278 !! test
19279 Width-sized image (using px, no following whitespace)
19280 !! wikitext
19281 [[Image:foobar.jpg|640px]]
19282 !! html
19283 <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>
19284 </p>
19285 !!end
19286
19287 !! test
19288 Width-sized image (using px, with following whitespace - test regression from r39467)
19289 !! wikitext
19290 [[Image:foobar.jpg|640px ]]
19291 !! html
19292 <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>
19293 </p>
19294 !!end
19295
19296 !! test
19297 Width-sized image (using px, with preceding whitespace - test regression from r39467)
19298 !! wikitext
19299 [[Image:foobar.jpg| 640px]]
19300 !! html
19301 <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>
19302 </p>
19303 !!end
19304
19305 !! test
19306 Image with page parameter
19307 !! options
19308 djvu
19309 !! wikitext
19310 [[File:LoremIpsum.djvu|page=2]]
19311 !! html/php
19312 <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>
19313 </p>
19314 !! html/parsoid
19315 <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>
19316 !! end
19317
19318 !! test
19319 Another italics / bold test
19320 !! wikitext
19321 ''' ''x'
19322 !! html
19323 <pre>'<i> </i>x'
19324 </pre>
19325 !!end
19326
19327 # FIXME: The php output seems broken. It's interleaving some open/close tags.
19328 !! test
19329 dt/dd/dl test
19330 !! wikitext
19331 :;;;::
19332 !! html/php
19333 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
19334
19335 !! html/parsoid
19336 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
19337
19338 !!end
19339
19340
19341 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
19342 !! test
19343 Images with the "|" character in the comment
19344 !! wikitext
19345 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
19346 !! html/php
19347 <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>
19348
19349 !! html/parsoid
19350 <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>
19351 !! end
19352
19353 !! test
19354 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
19355 !! wikitext
19356 <html><script>alert(1);</script></html>
19357 !! html
19358 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
19359 </p>
19360 !! end
19361
19362 !! test
19363 HTML with raw HTML ($wgRawHtml==true)
19364 !! options
19365 wgRawHtml=1
19366 !! wikitext
19367 <html><script>alert(1);</script></html>
19368 !! html
19369 <p><script>alert(1);</script>
19370 </p>
19371 !! end
19372
19373 !! test
19374 Parents of subpages, one level up
19375 !! options
19376 subpage title=[[Subpage test/L1/L2/L3]]
19377 !! wikitext
19378 [[../|L2]]
19379 !! html
19380 <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>
19381 </p>
19382 !! end
19383
19384
19385 !! test
19386 Parents of subpages, one level up, not named
19387 !! options
19388 subpage title=[[Subpage test/L1/L2/L3]]
19389 !! wikitext
19390 [[../]]
19391 !! html
19392 <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>
19393 </p>
19394 !! end
19395
19396
19397
19398 !! test
19399 Parents of subpages, two levels up
19400 !! options
19401 subpage title=[[Subpage test/L1/L2/L3]]
19402 !! wikitext
19403 [[../../|L1]]2
19404
19405 [[../../|L1]]l
19406 !! html
19407 <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
19408 </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>
19409 </p>
19410 !! end
19411
19412 !! test
19413 Parents of subpages, two levels up, without trailing slash or name.
19414 !! options
19415 subpage title=[[Subpage test/L1/L2/L3]]
19416 !! wikitext
19417 [[../..]]
19418 !! html
19419 <p>[[../..]]
19420 </p>
19421 !! end
19422
19423 !! test
19424 Parents of subpages, two levels up, with lots of extra trailing slashes.
19425 !! options
19426 subpage title=[[Subpage test/L1/L2/L3]]
19427 !! wikitext
19428 [[../../////]]
19429 !! html
19430 <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>
19431 </p>
19432 !! end
19433
19434 !! article
19435 Subpage test/L1/L2/L3Sibling
19436 !! text
19437 Sibling article
19438 !! endarticle
19439
19440 !! test
19441 Transclusion of a sibling page (one level up)
19442 !! options
19443 subpage title=[[Subpage test/L1/L2/L3]]
19444 !! wikitext
19445 {{../L3Sibling}}
19446 !! html
19447 <p>Sibling article
19448 </p>
19449 !! end
19450
19451 !! test
19452 Transclusion of a child page
19453 !! options
19454 subpage title=[[Subpage test/L1/L2]]
19455 !! wikitext
19456 {{/L3Sibling}}
19457 !! html
19458 <p>Sibling article
19459 </p>
19460 !! end
19461
19462 # This is wt2html only in Parsoid because we add <nowiki>
19463 # because of {{..}} and we don't expect to fix that to
19464 # eliminate the nowikis selective for {{..}} markup.
19465 !! test
19466 Non-transclusion because of too many up levels
19467 !! options
19468 subpage title=[[Subpage test/L1/L2/L3]]
19469 parsoid=wt2html
19470 !! wikitext
19471 {{../../../../More than parent}}
19472 !! html/php
19473 <p>{{../../../../More than parent}}
19474 </p>
19475 !! html/parsoid
19476 <p>{{../../../../More than parent}}</p>
19477 !! end
19478
19479 !! test
19480 Definition list code coverage
19481 !! wikitext
19482 ; title : def
19483 ; title : def
19484 ;title: def
19485 !! html/php
19486 <dl><dt> title &#160;</dt>
19487 <dd> def</dd>
19488 <dt> title&#160;</dt>
19489 <dd> def</dd>
19490 <dt>title</dt>
19491 <dd> def</dd></dl>
19492
19493 !! html/parsoid
19494 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19495 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19496 <dt>title</dt><dd> def</dd></dl>
19497 !! end
19498
19499 !! test
19500 Don't fall for the self-closing div
19501 !! wikitext
19502 <div>hello world</div/>
19503 !! html
19504 <div>hello world</div>
19505
19506 !! end
19507
19508 !! test
19509 MSGNW magic word
19510 !! wikitext
19511 {{MSGNW:msg}}
19512 !! html/php
19513 <p>&#91;&#91;:Template:Msg&#93;&#93;
19514 </p>
19515 !! end
19516
19517 !! test
19518 RAW magic word
19519 !! wikitext
19520 {{RAW:QUERTY}}
19521 !! html
19522 <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>
19523 </p>
19524 !! end
19525
19526 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
19527 !! test
19528 Always escape literal '>' in output, not just after '<'
19529 !! wikitext
19530 ><>
19531 !! html
19532 <p>&gt;&lt;&gt;
19533 </p>
19534 !! end
19535
19536 !! test
19537 Template caching
19538 !! wikitext
19539 {{Test}}
19540 {{Test}}
19541 !! html
19542 <p>This is a test template
19543 This is a test template
19544 </p>
19545 !! end
19546
19547
19548 !! article
19549 MediaWiki:Fake
19550 !! text
19551 ==header==
19552 !! endarticle
19553
19554 !! test
19555 Inclusion of !userCanEdit() content
19556 !! wikitext
19557 {{MediaWiki:Fake}}
19558 !! html
19559 <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>
19560
19561 !! end
19562
19563
19564 !! test
19565 Out-of-order TOC heading levels
19566 !! wikitext
19567 ==2==
19568 ======6======
19569 ===3===
19570 =1=
19571 =====5=====
19572 ==2==
19573 !! html
19574 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19575 <ul>
19576 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
19577 <ul>
19578 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
19579 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
19580 </ul>
19581 </li>
19582 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
19583 <ul>
19584 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
19585 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
19586 </ul>
19587 </li>
19588 </ul>
19589 </div>
19590
19591 <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>
19592 <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>
19593 <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>
19594 <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>
19595 <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>
19596 <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>
19597
19598 !! end
19599
19600
19601 !! test
19602 ISBN with a dummy number
19603 !! wikitext
19604 ISBN ---
19605 !! html
19606 <p>ISBN ---
19607 </p>
19608 !! end
19609
19610
19611 !! test
19612 ISBN with space-delimited number
19613 !! wikitext
19614 ISBN 92 9017 032 8
19615 !! html
19616 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
19617 </p>
19618 !! end
19619
19620
19621 !! test
19622 ISBN with multiple spaces, no number
19623 !! wikitext
19624 ISBN foo
19625 !! html
19626 <p>ISBN foo
19627 </p>
19628 !! end
19629
19630
19631 !! test
19632 ISBN length
19633 !! wikitext
19634 ISBN 123456789
19635
19636 ISBN 1234567890
19637
19638 ISBN 12345678901
19639 !! html
19640 <p>ISBN 123456789
19641 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19642 </p><p>ISBN 12345678901
19643 </p>
19644 !! end
19645
19646
19647 !! test
19648 ISBN with trailing year (bug 8110)
19649 !! wikitext
19650 ISBN 1-234-56789-0 - 2006
19651
19652 ISBN 1 234 56789 0 - 2006
19653 !! html
19654 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
19655 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
19656 </p>
19657 !! end
19658
19659
19660 !! test
19661 anchorencode
19662 !! wikitext
19663 {{anchorencode:foo bar©#%n}}
19664 !! html
19665 <p>foo_bar.C2.A9.23.25n
19666 </p>
19667 !! end
19668
19669 !! test
19670 anchorencode trims spaces
19671 !! wikitext
19672 {{anchorencode: __pretty__please__}}
19673 !! html
19674 <p>pretty_please
19675 </p>
19676 !! end
19677
19678 !! test
19679 anchorencode deals with links
19680 !! wikitext
19681 {{anchorencode: [[hello|world]] [[hi]]}}
19682 !! html
19683 <p>world_hi
19684 </p>
19685 !! end
19686
19687 !! test
19688 anchorencode deals with templates
19689 !! wikitext
19690 {{anchorencode: {{Foo}} }}
19691 !! html
19692 <p>FOO
19693 </p>
19694 !! end
19695
19696 !! test
19697 anchorencode encodes like the TOC generator: (bug 18431)
19698 !! wikitext
19699 === _ +:.3A%3A&&amp;]] ===
19700 {{anchorencode: _ +:.3A%3A&&amp;]] }}
19701 __NOEDITSECTION__
19702 !! html
19703 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
19704 <p>.2B:.3A.253A.26.26.5D.5D
19705 </p>
19706 !! end
19707
19708 !! test
19709 Bug 6200: blockquotes and paragraph formatting
19710 !! wikitext
19711 <blockquote>
19712 foo
19713 </blockquote>
19714
19715 bar
19716
19717 baz
19718 !! html
19719 <blockquote>
19720 <p>foo
19721 </p>
19722 </blockquote>
19723 <p>bar
19724 </p>
19725 <pre>baz
19726 </pre>
19727 !! end
19728
19729 !! test
19730 Bug 8293: Use of center tag ruins paragraph formatting
19731 !! wikitext
19732 <center>
19733 foo
19734 </center>
19735
19736 bar
19737
19738 baz
19739 !! html
19740 <center>
19741 <p>foo
19742 </p>
19743 </center>
19744 <p>bar
19745 </p>
19746 <pre>baz
19747 </pre>
19748 !! end
19749
19750 !!test
19751 Parsing of overlapping (improperly nested) inline html tags
19752 !! wikitext
19753 <span><s>x</span></s>
19754 !! html/php
19755 <p><span><s>x&lt;/span&gt;</s></span>
19756 </p>
19757 !! html/parsoid
19758 <p><span><s>x</s></span>
19759 </p>
19760 !!end
19761
19762 ###
19763 ### Language variants related tests
19764 ###
19765 !! test
19766 Self-link in language variants
19767 !! options
19768 title=[[Dunav]] language=sr
19769 !! wikitext
19770 Both [[Dunav]] and [[Дунав]] are names for this river.
19771 !! html
19772 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
19773 </p>
19774 !!end
19775
19776 !! article
19777 Дуна
19778 !! text
19779 content
19780 !! endarticle
19781
19782 !! test
19783 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
19784 !! options
19785 title=[[Duna]] language=sr
19786 !! wikitext
19787 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
19788 !! html
19789 <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.
19790 </p>
19791 !! end
19792
19793 !! test
19794 Link to a section of a variant of this title shouldn't be parsed as self-link
19795 !! options
19796 title=[[Duna]] language=sr
19797 !! wikitext
19798 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
19799 !! html
19800 <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.
19801 </p>
19802 !! end
19803
19804 !! test
19805 Link to pages in language variants
19806 !! options
19807 language=sr
19808 !! wikitext
19809 Main Page can be written as [[Маин Паге]]
19810 !! html
19811 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
19812 </p>
19813 !!end
19814
19815
19816 !! test
19817 Multiple links to pages in language variants
19818 !! options
19819 language=sr
19820 !! wikitext
19821 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
19822 !! html
19823 <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>.
19824 </p>
19825 !!end
19826
19827
19828 !! test
19829 Simple template in language variants
19830 !! options
19831 language=sr
19832 !! wikitext
19833 {{тест}}
19834 !! html
19835 <p>This is a test template
19836 </p>
19837 !! end
19838
19839
19840 !! test
19841 Template with explicit namespace in language variants
19842 !! options
19843 language=sr
19844 !! wikitext
19845 {{Template:тест}}
19846 !! html
19847 <p>This is a test template
19848 </p>
19849 !! end
19850
19851
19852 !! test
19853 Basic test for template parameter in language variants
19854 !! options
19855 language=sr
19856 !! wikitext
19857 {{парамтест|param=foo}}
19858 !! html
19859 <p>This is a test template with parameter foo
19860 </p>
19861 !! end
19862
19863
19864 !! test
19865 Simple category in language variants
19866 !! options
19867 language=sr cat
19868 !! wikitext
19869 [[Category:МедиаWики Усер'с Гуиде]]
19870 !! html
19871 cat=МедиаWики_Усер'с_Гуиде sort=
19872 !! end
19873
19874
19875 !! article
19876 Category:分类
19877 !! text
19878 blah
19879 !! endarticle
19880
19881 !! article
19882 Category:分類
19883 !! text
19884 blah
19885 !! endarticle
19886
19887 ## We used to, but no longer wt2wt this test since the default serializer
19888 ## will normalize all categories to serialize on their own line.
19889 ## This wikitext usage is going to be fairly uncommon in production and
19890 ## selser will take care of preserving formatting in those scenarios.
19891 !! test
19892 Don't convert blue categorylinks to another variant (bug 33210)
19893 !! options
19894 cat
19895 language=zh
19896 parsoid=wt2html
19897 !! wikitext
19898 [[A]][[Category:分类]]
19899 !! html/php
19900 cat=分类 sort=
19901 !! html/parsoid
19902 <p><a rel="mw:WikiLink" href="A" title="A">A</a></p>
19903 <link rel="mw:PageProp/Category" href="Category:分类"/>
19904 !! end
19905
19906 !! test
19907 Stripping -{}- tags (language variants)
19908 !! options
19909 language=sr
19910 !! wikitext
19911 Latin proverb: -{Ne nuntium necare}-
19912 !! html
19913 <p>Latin proverb: Ne nuntium necare
19914 </p>
19915 !! end
19916
19917
19918 !! test
19919 Prevent conversion with -{}- tags (language variants)
19920 !! options
19921 language=sr variant=sr-ec
19922 !! wikitext
19923 Latinski: -{Ne nuntium necare}-
19924 !! html
19925 <p>Латински: Ne nuntium necare
19926 </p>
19927 !! end
19928
19929
19930 !! test
19931 Prevent conversion of text with -{}- tags (language variants)
19932 !! options
19933 language=sr variant=sr-ec
19934 !! wikitext
19935 Latinski: -{Ne nuntium necare}-
19936 !! html
19937 <p>Латински: Ne nuntium necare
19938 </p>
19939 !! end
19940
19941
19942 !! test
19943 Prevent conversion of links with -{}- tags (language variants)
19944 !! options
19945 language=sr variant=sr-ec
19946 !! wikitext
19947 -{[[Main Page]]}-
19948 !! html
19949 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19950 </p>
19951 !! end
19952
19953
19954 !! test
19955 -{}- tags within headlines (within html for parserConvert())
19956 !! options
19957 language=sr variant=sr-ec
19958 !! wikitext
19959 == -{Naslov}- ==
19960 !! html
19961 <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>
19962
19963 !! end
19964
19965
19966 !! test
19967 Explicit definition of language variant alternatives
19968 !! options
19969 language=zh variant=zh-tw
19970 !! wikitext
19971 -{zh:China;zh-tw:Taiwan}-, not China
19972 !! html
19973 <p>Taiwan, not China
19974 </p>
19975 !! end
19976
19977
19978 !! test
19979 Conversion around HTML tags
19980 !! options
19981 language=sr variant=sr-ec
19982 !! wikitext
19983 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
19984 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
19985 !! html
19986 <p>
19987 <span title="ЛаCтин">ски</span>
19988 </p>
19989 !! end
19990
19991
19992 !! test
19993 Explicit session-wise language variant mapping (A flag and - flag)
19994 !! options
19995 language=zh variant=zh-tw
19996 !! wikitext
19997 Taiwan is not China.
19998 But -{A|zh:China;zh-tw:Taiwan}- is China,
19999 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
20000 and -{China}- is China.
20001 !! html
20002 <p>Taiwan is not China.
20003 But Taiwan is Taiwan,
20004 (This should be stripped!)
20005 and China is China.
20006 </p>
20007 !! end
20008
20009 !! test
20010 Explicit session-wise language variant mapping (H flag for hide)
20011 !! options
20012 language=zh variant=zh-tw
20013 !! wikitext
20014 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
20015 Taiwan is China.
20016 !! html
20017 <p>(This should be stripped!)
20018 Taiwan is Taiwan.
20019 </p>
20020 !! end
20021
20022 !! test
20023 Adding explicit conversion rule for title (T flag)
20024 !! options
20025 language=zh variant=zh-tw showtitle
20026 !! wikitext
20027 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20028 !! html
20029 Taiwan
20030 <p>Should be stripped!
20031 </p>
20032 !! end
20033
20034 !! test
20035 Testing that changing the language variant here in the tests actually works
20036 !! options
20037 language=zh variant=zh showtitle
20038 !! wikitext
20039 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20040 !! html
20041 China
20042 <p>Should be stripped!
20043 </p>
20044 !! end
20045
20046 !! test
20047 Recursive conversion of alt and title attrs shouldn't clear converter state
20048 !! options
20049 language=zh variant=zh-cn showtitle
20050 !! wikitext
20051 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
20052 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
20053 !! html
20054 China
20055 <p>
20056 Should be stripped<span title="Exclamation">!</span>
20057 </p>
20058 !! end
20059
20060 !! test
20061 Bug 24072: more test on conversion rule for title
20062 !! options
20063 language=zh variant=zh-tw showtitle
20064 !! wikitext
20065 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20066 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
20067 !! html
20068 Taiwan
20069 <p>This should be stripped!
20070 This won't take interferes with the title rule.
20071 </p>
20072 !! end
20073
20074 !! test
20075 Partly disable title conversion if variant == main language code
20076 !! options
20077 language=zh variant=zh title=[[ZH]] showtitle
20078 !! wikitext
20079 -{T|zh-cn:CN;zh-tw:TW}-
20080 !! html
20081 ZH
20082 <p>
20083 </p>
20084 !! end
20085
20086 !! test
20087 Partly disable title conversion if variant == main language code, more
20088 !! options
20089 language=zh variant=zh title=[[ZH]] showtitle
20090 !! wikitext
20091 -{T|TW}-
20092 !! html
20093 ZH
20094 <p>
20095 </p>
20096 !! end
20097
20098 !! test
20099 Raw output of variant escape tags (R flag)
20100 !! options
20101 language=zh variant=zh-tw
20102 !! wikitext
20103 Raw: -{R|zh:China;zh-tw:Taiwan}-
20104 !! html
20105 <p>Raw: zh:China;zh-tw:Taiwan
20106 </p>
20107 !! end
20108
20109 !! test
20110 Strings evaluating false shouldn't be ignored by Language converter (T51072)
20111 !! options
20112 language=zh variant=zh-cn
20113 !! input
20114 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
20115 !! result
20116 <p>0
20117 </p>
20118 !! end
20119
20120 !! test
20121 Conversion rules from [numeric-only string] to [something else] (T48634)
20122 !! options
20123 language=zh variant=zh-cn
20124 !! input
20125 -{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
20126 !! result
20127 <p>D12345EE12345
20128 </p>
20129 !! end
20130
20131 !! test
20132 Bidirectional converter rule entries with an empty value should be ignored (T53551)
20133 !! options
20134 language=zh variant=zh-cn
20135 !! input
20136 -{H|zh-cn:foo;zh-tw:;}-foobar
20137 !! result
20138 <p>foobar
20139 </p>
20140 !! end
20141
20142 !! test
20143 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
20144 !! options
20145 language=zh variant=zh-cn
20146 !! input
20147 -{H|=>zh-cn:foo;}-foobar
20148 !! result
20149 <p>foobar
20150 </p>
20151 !! end
20152
20153 !! test
20154 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
20155 !! options
20156 language=zh variant=zh-cn
20157 !! input
20158 -{H|}-foobar
20159 !! result
20160 <p>foobar
20161 </p>
20162 !! end
20163
20164 !! test
20165 Nested using of manual convert syntax
20166 !! options
20167 language=zh variant=zh-hk
20168 !! wikitext
20169 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
20170 !! html
20171 <p>Nested: Hello Hong Kong!
20172 </p>
20173 !! end
20174
20175 # Since Parsoid is starting to emit canonical wikitext for links,
20176 # [http://example.com http://example.com] will not RT back to that
20177 # form anymore.
20178 !! test
20179 Proper conversion of text in external links
20180 !! options
20181 language=sr variant=sr-ec
20182 parsoid=wt2html
20183 !! wikitext
20184 http://www.google.com
20185 gopher://www.google.com
20186 [http://www.google.com http://www.google.com]
20187 [gopher://www.google.com gopher://www.google.com]
20188 [https://www.google.com irc://www.google.com]
20189 [ftp://www.google.com www.google.com/ftp://dir]
20190 [//www.google.com www.google.com]
20191 !! html/php
20192 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20193 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20194 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20195 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20196 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
20197 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20198 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
20199 </p>
20200 !! html/parsoid
20201 <p><a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20202 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20203 <a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20204 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20205 <a rel="mw:ExtLink" href="https://www.google.com">irc://www.google.com</a>
20206 <a rel="mw:ExtLink" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20207 <a rel="mw:ExtLink" href="//www.google.com">www.гоогле.цом</a></p>
20208 !! end
20209
20210 !! test
20211 Do not convert roman numbers to language variants
20212 !! options
20213 language=sr variant=sr-ec
20214 !! wikitext
20215 Fridrih IV je car.
20216 !! html
20217 <p>Фридрих IV је цар.
20218 </p>
20219 !! end
20220
20221 !! test
20222 Unclosed language converter markup "-{"
20223 !! options
20224 language=sr
20225 !! wikitext
20226 -{T|hello
20227 !! html
20228 <p>-{T|hello
20229 </p>
20230 !! end
20231
20232 !! test
20233 Don't convert raw rule "-{R|=&gt;}-" to "=>"
20234 !! options
20235 language=sr
20236 !! wikitext
20237 -{R|=&gt;}-
20238 !! html
20239 <p>=&gt;
20240 </p>
20241 !!end
20242
20243 !! test
20244 Don't break link parsing if language converter markup is in the caption.
20245 !! options
20246 language=sr variant=sr-ec
20247 !! wikitext
20248 [[Main Page|-{R|main page}-]]
20249 !! html
20250 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
20251 </p>
20252 !! end
20253
20254 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20255 !! test
20256 Don't break image parsing if language converter markup is in the caption.
20257 !! options
20258 language=sr
20259 !! wikitext
20260 [[File:Foobar.jpg|-{R|caption}-]]
20261 !! html/parsoid
20262 <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>
20263 </p>
20264 !! end
20265
20266 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20267 !! test
20268 Don't break list handling if language converter markup is in the item.
20269 !! options
20270 language=zh variant=zh-cn
20271 !! wikitext
20272 ;-{zh-cn:AAA;zh-tw:BBB}-
20273 !! html/php
20274 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
20275
20276 !! html/parsoid
20277 <dl><dt>AAA
20278 </dt></dl>
20279 !! end
20280
20281 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20282 !! test
20283 Don't break table handling if language converter markup is in the cell.
20284 !! options
20285 language=sr variant=sr-ec
20286 !! wikitext
20287 {|
20288 |-
20289 | -{R|B}-
20290 |}
20291 !! html/php
20292 <table>
20293
20294 <tr>
20295 <td>Б}-
20296 </td></tr></table>
20297
20298 !! html/parsoid
20299 <table>
20300
20301 <tr>
20302 <td> B
20303 </td></tr></table>
20304
20305 !! end
20306
20307 !! test
20308 Bug 529: Uncovered bullet
20309 !! wikitext
20310 * Foo {{bullet}}
20311 !! html
20312 <ul><li> Foo </li>
20313 <li> Bar</li></ul>
20314
20315 !! end
20316
20317 # Plain MediaWiki does not remove empty lists, but tidy actually does.
20318 # Templates in Wikipedia rely on this behavior, as tidy has always been
20319 # enabled there. These tests are normally run *without* tidy, so specify the
20320 # full output here.
20321 # To test realistic parsing behavior, apply a tidy-like transformation to both
20322 # the expected output and your parser's output.
20323 !! test
20324 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
20325 !! wikitext
20326 ******* Foo {{bullet}}
20327 !! html
20328 <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>
20329 <li> Bar</li></ul>
20330
20331 !! end
20332
20333 !! test
20334 Bug 529: Uncovered table already at line-start
20335 !! wikitext
20336 x
20337
20338 {{table}}
20339 y
20340 !! html
20341 <p>x
20342 </p>
20343 <table>
20344 <tr>
20345 <td> 1 </td>
20346 <td> 2
20347 </td></tr>
20348 <tr>
20349 <td> 3 </td>
20350 <td> 4
20351 </td></tr></table>
20352 <p>y
20353 </p>
20354 !! end
20355
20356 !! test
20357 Bug 529: Uncovered bullet in parser function result
20358 !! wikitext
20359 * Foo {{lc:{{bullet}} }}
20360 !! html
20361 <ul><li> Foo </li>
20362 <li> bar</li></ul>
20363
20364 !! end
20365
20366 !! test
20367 Bug 5678: Double-parsed template argument
20368 !! wikitext
20369 {{lc:{{{1}}}|hello}}
20370 !! html
20371 <p>{{{1}}}
20372 </p>
20373 !! end
20374
20375 !! test
20376 Bug 5678: Double-parsed template invocation
20377 !! wikitext
20378 {{lc:{{paramtest {{!}} param = hello }} }}
20379 !! html
20380 <p>{{paramtest | param = hello }}
20381 </p>
20382 !! end
20383
20384 !! test
20385 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
20386 !! options
20387 language=cs
20388 title=[[Main Page]]
20389 !! wikitext
20390 {{PRVNÍVELKÉ:ěščř}}
20391 {{prvnívelké:ěščř}}
20392 {{PRVNÍMALÉ:ěščř}}
20393 {{prvnímalé:ěščř}}
20394 {{MALÁ:ěščř}}
20395 {{malá:ěščř}}
20396 {{VELKÁ:ěščř}}
20397 {{velká:ěščř}}
20398 !! html
20399 <p>Ěščř
20400 Ěščř
20401 ěščř
20402 ěščř
20403 ěščř
20404 ěščř
20405 ĚŠČŘ
20406 ĚŠČŘ
20407 </p>
20408 !! end
20409
20410 !! test
20411 Morwen/13: Unclosed link followed by heading
20412 !! wikitext
20413 [[link
20414 ==heading==
20415 !! html
20416 <p>[[link
20417 </p>
20418 <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>
20419
20420 !! end
20421
20422 !! test
20423 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
20424 !! wikitext
20425 {{foo|
20426 =heading=
20427 !! html
20428 <p>{{foo|
20429 </p>
20430 <h1><span class="mw-headline" id="heading">heading</span></h1>
20431
20432 !! end
20433
20434 !! test
20435 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
20436 !! wikitext
20437 {{foo|
20438 ==heading==
20439 !! html
20440 <p>{{foo|
20441 </p>
20442 <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>
20443
20444 !! end
20445
20446 !! test
20447 Tildes in comments
20448 !! options
20449 pst
20450 !! wikitext
20451 <!-- ~~~~ -->
20452 !! html/php
20453 <!-- ~~~~ -->
20454 !! end
20455
20456 !! test
20457 Paragraphs inside divs (no extra line breaks)
20458 !! wikitext
20459 <div>Line one
20460
20461 Line two</div>
20462 !! html
20463 <div>Line one
20464 Line two</div>
20465
20466 !! end
20467
20468 !! test
20469 Paragraphs inside divs (extra line break on open)
20470 !! wikitext
20471 <div>
20472 Line one
20473
20474 Line two</div>
20475 !! html
20476 <div>
20477 <p>Line one
20478 </p>
20479 Line two</div>
20480
20481 !! end
20482
20483 !! test
20484 Paragraphs inside divs (extra line break on close)
20485 !! wikitext
20486 <div>Line one
20487
20488 Line two
20489 </div>
20490 !! html
20491 <div>Line one
20492 <p>Line two
20493 </p>
20494 </div>
20495
20496 !! end
20497
20498 !! test
20499 Paragraphs inside divs (extra line break on open and close)
20500 !! wikitext
20501 <div>
20502 Line one
20503
20504 Line two
20505 </div>
20506 !! html
20507 <div>
20508 <p>Line one
20509 </p><p>Line two
20510 </p>
20511 </div>
20512
20513 !! end
20514
20515 !! test
20516 Nesting tags, paragraphs on lines which begin with <div>
20517 !! wikitext
20518 <div></div><strong>A
20519 B</strong>
20520 !! html/php+tidy
20521 <p><strong>A</strong></p>
20522 <p><strong>B</strong></p>
20523 !! html/parsoid
20524 <div></div>
20525 <p><strong>A
20526 B</strong>
20527 </p>
20528 !! end
20529
20530 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
20531 !! test
20532 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
20533 !! wikitext
20534 <blockquote>Line one
20535
20536 Line two</blockquote>
20537 !! html
20538 <blockquote>Line one
20539 Line two</blockquote>
20540
20541 !! html+tidy
20542 <blockquote>
20543 <p>Line one Line two</p>
20544 </blockquote>
20545 !! end
20546
20547 !! test
20548 Bug 6200: paragraphs inside blockquotes (extra line break on open)
20549 !! wikitext
20550 <blockquote>
20551 Line one
20552
20553 Line two</blockquote>
20554 !! html
20555 <blockquote>
20556 <p>Line one
20557 </p>
20558 Line two</blockquote>
20559
20560 !! html+tidy
20561 <blockquote>
20562 <p>Line one</p>
20563 Line two</blockquote>
20564 !! end
20565
20566 !! test
20567 Bug 6200: paragraphs inside blockquotes (extra line break on close)
20568 !! wikitext
20569 <blockquote>Line one
20570
20571 Line two
20572 </blockquote>
20573 !! html
20574 <blockquote>Line one
20575 <p>Line two
20576 </p>
20577 </blockquote>
20578
20579 !! html+tidy
20580 <blockquote>
20581 <p>Line one</p>
20582 <p>Line two</p>
20583 </blockquote>
20584 !! end
20585
20586 !! test
20587 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
20588 !! wikitext
20589 <blockquote>
20590 Line one
20591
20592 Line two
20593 </blockquote>
20594 !! html
20595 <blockquote>
20596 <p>Line one
20597 </p><p>Line two
20598 </p>
20599 </blockquote>
20600
20601 !! html+tidy
20602 <blockquote>
20603 <p>Line one</p>
20604 <p>Line two</p>
20605 </blockquote>
20606 !! end
20607
20608 !! test
20609 Paragraphs inside blockquotes/divs (no extra line breaks)
20610 !! wikitext
20611 <blockquote><div>Line one
20612
20613 Line two</div></blockquote>
20614 !! html
20615 <blockquote><div>Line one
20616 Line two</div></blockquote>
20617
20618 !! end
20619
20620 !! test
20621 Paragraphs inside blockquotes/divs (extra line break on open)
20622 !! wikitext
20623 <blockquote><div>
20624 Line one
20625
20626 Line two</div></blockquote>
20627 !! html
20628 <blockquote><div>
20629 <p>Line one
20630 </p>
20631 Line two</div></blockquote>
20632
20633 !! end
20634
20635 !! test
20636 Paragraphs inside blockquotes/divs (extra line break on close)
20637 !! wikitext
20638 <blockquote><div>Line one
20639
20640 Line two
20641 </div></blockquote>
20642 !! html
20643 <blockquote><div>Line one
20644 <p>Line two
20645 </p>
20646 </div></blockquote>
20647
20648 !! end
20649
20650 !! test
20651 Paragraphs inside blockquotes/divs (extra line break on open and close)
20652 !! wikitext
20653 <blockquote><div>
20654 Line one
20655
20656 Line two
20657 </div></blockquote>
20658 !! html
20659 <blockquote><div>
20660 <p>Line one
20661 </p><p>Line two
20662 </p>
20663 </div></blockquote>
20664
20665 !! end
20666
20667 !! test
20668 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
20669 !! options
20670 wgLinkHolderBatchSize=0
20671 !! wikitext
20672 [[meatball:1]]
20673 [[meatball:2]]
20674 [[meatball:3]]
20675 !! html
20676 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
20677 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
20678 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
20679 </p>
20680 !! end
20681
20682 !! test
20683 Free external link invading image caption
20684 !! wikitext
20685 [[Image:Foobar.jpg|thumb|http://x|hello]]
20686 !! html
20687 <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>
20688
20689 !! end
20690
20691 !! test
20692 Bug 15196: localised external link numbers
20693 !! options
20694 language=fa
20695 !! wikitext
20696 [http://en.wikipedia.org/]
20697 !! html/php
20698 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
20699 </p>
20700 !! html/parsoid
20701 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
20702 !! end
20703
20704 !! test
20705 Multibyte character in padleft
20706 !! wikitext
20707 {{padleft:-Hello|7|Æ}}
20708 !! html
20709 <p>Æ-Hello
20710 </p>
20711 !! end
20712
20713 !! test
20714 Multibyte character in padright
20715 !! wikitext
20716 {{padright:Hello-|7|Æ}}
20717 !! html
20718 <p>Hello-Æ
20719 </p>
20720 !! end
20721
20722 !!test
20723 formatdate parser function
20724 !! wikitext
20725 {{#formatdate:2009-03-24}}
20726 !! html
20727 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
20728 </p>
20729 !! end
20730
20731 !!test
20732 formatdate parser function, with default format
20733 !! wikitext
20734 {{#formatdate:2009-03-24|mdy}}
20735 !! html
20736 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
20737 </p>
20738 !! end
20739
20740 !! test
20741 Spacing of numbers in formatted dates
20742 !! wikitext
20743 {{#formatdate:January 15}}
20744 !! html
20745 <p><span class="mw-formatted-date" title="01-15">January 15</span>
20746 </p>
20747 !! end
20748
20749 !! test
20750 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
20751 !! options
20752 language=nl title=[[MediaWiki:Common.css]]
20753 !! wikitext
20754 {{#formatdate:2009-03-24|dmy}}
20755 !! html
20756 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
20757 </p>
20758 !! end
20759
20760 #
20761 #
20762 #
20763
20764 #
20765 # Edit comments
20766 #
20767
20768 !! test
20769 Edit comment with link
20770 !! options
20771 comment
20772 !! wikitext
20773 I like the [[Main Page]] a lot
20774 !! html/php
20775 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
20776 !!end
20777
20778 !! test
20779 Edit comment with link and link text
20780 !! options
20781 comment
20782 !! wikitext
20783 I like the [[Main Page|best pages]] a lot
20784 !! html/php
20785 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20786 !!end
20787
20788 !! test
20789 Edit comment with link and link text with suffix
20790 !! options
20791 comment
20792 !! wikitext
20793 I like the [[Main Page|best page]]s a lot
20794 !! html/php
20795 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20796 !!end
20797
20798 !! test
20799 Edit comment with section link (non-local, eg in history list)
20800 !! options
20801 comment title=[[Main Page]]
20802 !! wikitext
20803 /* External links */ removed bogus entries
20804 !! html/php
20805 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20806 !!end
20807
20808 !! test
20809 Edit comment with section link and text before it (non-local, eg in history list)
20810 !! options
20811 comment title=[[Main Page]]
20812 !! wikitext
20813 pre-comment text /* External links */ removed bogus entries
20814 !! html/php
20815 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>
20816 !!end
20817
20818 !! test
20819 Edit comment with section link (local, eg in diff view)
20820 !! options
20821 comment local title=[[Main Page]]
20822 !! wikitext
20823 /* External links */ removed bogus entries
20824 !! html/php
20825 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20826 !!end
20827
20828 !! test
20829 Edit comment with subpage link (bug 14080)
20830 !! options
20831 comment
20832 subpage
20833 title=[[Subpage test]]
20834 !! wikitext
20835 Poked at a [[/subpage]] here...
20836 !! html/php
20837 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
20838 !!end
20839
20840 !! test
20841 Edit comment with subpage link and link text (bug 14080)
20842 !! options
20843 comment
20844 subpage
20845 title=[[Subpage test]]
20846 !! wikitext
20847 Poked at a [[/subpage|neat little page]] here...
20848 !! html/php
20849 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
20850 !!end
20851
20852 !! test
20853 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
20854 !! options
20855 comment
20856 title=[[Subpage test]]
20857 !! wikitext
20858 Poked at a [[/subpage]] here...
20859 !! html/php
20860 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...
20861 !!end
20862
20863 !! test
20864 Edit comment with bare anchor link (local, as on diff)
20865 !! options
20866 comment
20867 local
20868 title=[[Main Page]]
20869 !! wikitext
20870 [[#section]]
20871 !! html/php
20872 <a href="#section">#section</a>
20873 !! end
20874
20875 !! test
20876 Edit comment with bare anchor link (non-local, as on history)
20877 !! options
20878 comment
20879 title=[[Main Page]]
20880 !! wikitext
20881 [[#section]]
20882 !! html/php
20883 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
20884 !! end
20885
20886 !! test
20887 Anchor starting with underscore
20888 !! options
20889 title=[[Foo]]
20890 !! wikitext
20891 [[#_ref|One]]
20892 !! html/php
20893 <p><a href="#_ref">One</a>
20894 </p>
20895 !! html/parsoid
20896 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
20897 !! end
20898
20899 !! test
20900 Id starting with underscore
20901 !! wikitext
20902 <div id="_ref"></div>
20903 !! html/*
20904 <div id="_ref"></div>
20905
20906 !! end
20907
20908 !! test
20909 Space normalisation on autocomment (bug 22784)
20910 !! options
20911 comment
20912 title=[[Main Page]]
20913 !! wikitext
20914 /* __hello__world__ */
20915 !! html/php
20916 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
20917 !! end
20918
20919 !! test
20920 percent-encoding and + signs in comments (Bug 26410)
20921 !! options
20922 comment
20923 !! wikitext
20924 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
20925 !! html/php
20926 <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>
20927 !! end
20928
20929 # Parsoid doesn't support this yet: see bug 73581
20930 # but it *should* omit the 'src' attribute if the image is bad.
20931 # PHP side of tests was disabled in
20932 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
20933 # because of issues in the PHP parserTests infrastructure
20934 # (but the output below is indeed what the PHP side emits)
20935 !! test
20936 Bad images - basic functionality
20937 !! wikitext
20938 [[File:Bad.jpg]]
20939 !! DISABLED/html/php
20940 !! html/parsoid
20941 <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>
20942 !! end
20943
20944 !! test
20945 Bad images - bug 16039: text after bad image disappears
20946 !! wikitext
20947 Foo bar
20948 [[File:Bad.jpg]]
20949 Bar foo
20950 !! DISABLED/html/php
20951 <p>Foo bar
20952 </p><p>Bar foo
20953 </p>
20954 !! html/parsoid
20955 <p>Foo bar
20956 <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>
20957 Bar foo</p>
20958 !! end
20959
20960 !! test
20961 Verify that displaytitle works (bug #22501) no displaytitle
20962 !! options
20963 showtitle
20964 !! config
20965 wgAllowDisplayTitle=true
20966 wgRestrictDisplayTitle=false
20967 !! wikitext
20968 this is not the the title
20969 !! html/php
20970 Parser test
20971 <p>this is not the the title
20972 </p>
20973 !! end
20974
20975 !! test
20976 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
20977 !! options
20978 showtitle
20979 title=[[Screen]]
20980 !! config
20981 wgAllowDisplayTitle=true
20982 wgRestrictDisplayTitle=false
20983 !! wikitext
20984 this is not the the title
20985 {{DISPLAYTITLE:whatever}}
20986 !! html/php
20987 whatever
20988 <p>this is not the the title
20989 </p>
20990 !! end
20991
20992 !! test
20993 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
20994 !! options
20995 showtitle
20996 title=[[Screen]]
20997 !! config
20998 wgAllowDisplayTitle=true
20999 wgRestrictDisplayTitle=true
21000 !! wikitext
21001 this is not the the title
21002 {{DISPLAYTITLE:whatever}}
21003 !! html/php
21004 Screen
21005 <p>this is not the the title
21006 </p>
21007 !! end
21008
21009 !! test
21010 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
21011 !! options
21012 showtitle
21013 title=[[Screen]]
21014 !! config
21015 wgAllowDisplayTitle=true
21016 wgRestrictDisplayTitle=true
21017 !! wikitext
21018 this is not the the title
21019 {{DISPLAYTITLE:screen}}
21020 !! html/php
21021 screen
21022 <p>this is not the the title
21023 </p>
21024 !! end
21025
21026 !! test
21027 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
21028 !! options
21029 showtitle
21030 title=[[Screen]]
21031 !! config
21032 wgAllowDisplayTitle=false
21033 !! wikitext
21034 this is not the the title
21035 {{DISPLAYTITLE:screen}}
21036 !! html/php
21037 Screen
21038 <p>this is not the the title
21039 <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>
21040 </p>
21041 !! end
21042
21043 !! test
21044 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
21045 !! options
21046 showtitle
21047 title=[[Screen]]
21048 !! config
21049 wgAllowDisplayTitle=false
21050 !! wikitext
21051 this is not the the title
21052 !! html/php
21053 Screen
21054 <p>this is not the the title
21055 </p>
21056 !! end
21057
21058 !! test
21059 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
21060 !! options
21061 showtitle
21062 title=[[Screen]]
21063 !! config
21064 wgAllowDisplayTitle=true
21065 wgRestrictDisplayTitle=true
21066 !! wikitext
21067 this is not the the title
21068 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
21069 !! html/php
21070 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
21071 <p>this is not the the title
21072 </p>
21073 !! end
21074
21075 !! test
21076 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
21077 !! options
21078 showtitle
21079 title=[[Screen]]
21080 !! config
21081 wgAllowDisplayTitle=true
21082 wgRestrictDisplayTitle=true
21083 !! wikitext
21084 this is not the the title
21085 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
21086 !! html/php
21087 <span style="color: red;">s</span>creen
21088 <p>this is not the the title
21089 </p>
21090 !! end
21091
21092 !! test
21093 Page status indicators: Empty name is invalid
21094 !! options
21095 showindicators
21096 !! wikitext
21097 <indicator name=" "></indicator>
21098 <indicator></indicator>
21099 !! html
21100 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21101 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21102 </p>
21103 !! end
21104
21105 !! test
21106 Page status indicators: Weird syntaxes that are okay
21107 !! options
21108 showindicators
21109 !! wikitext
21110 <indicator name="empty" />
21111 <indicator name="name"></indicator>
21112 !! html
21113 empty=
21114 name=
21115 <p><br />
21116 </p>
21117 !! end
21118
21119 !! test
21120 Page status indicators: Torture test
21121 !! options
21122 showindicators
21123 !! wikitext
21124 <indicator name="01">hello world</indicator>
21125 <indicator name="02">[[Main Page]]</indicator>
21126 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
21127 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
21128 <indicator name="05">* foo
21129 * bar</indicator>
21130 <indicator name="06"><nowiki>foo</nowiki></indicator>
21131 <indicator name="07"> Preformatted</indicator>
21132 <indicator name="08"><div>Broken tag</indicator>
21133 <indicator name="09">{| class=wikitable
21134 | cell
21135 |}</indicator>
21136 <indicator name="10">Two
21137
21138 paragraphs</indicator>
21139 !! html
21140 01=hello world
21141 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21142 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" />
21143 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>
21144 05=<ul><li> foo</li>
21145 <li> bar</li></ul>
21146
21147 06=foo
21148 07=<pre>Preformatted
21149 </pre>
21150 08=<div>Broken tag</div>
21151
21152 09=<table class="wikitable">
21153 <tr>
21154 <td> cell
21155 </td></tr></table>
21156
21157 10=<p>Two
21158 </p><p>paragraphs
21159 </p>
21160 <p><br />
21161 </p><p><br />
21162 </p><p><br />
21163 </p><p><br />
21164 </p><p><br />
21165 </p>
21166 !! end
21167
21168 !! test
21169 preload: check <noinclude> and <includeonly>
21170 !! options
21171 preload
21172 !! wikitext
21173 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
21174 !! html/php
21175 Hello kind world.
21176 !! end
21177
21178 !! test
21179 preload: check <onlyinclude>
21180 !! options
21181 preload
21182 !! wikitext
21183 Goodbye <onlyinclude>Hello world</onlyinclude>
21184 !! html/php
21185 Hello world
21186 !! end
21187
21188 !! test
21189 preload: can pass tags through if we want to
21190 !! options
21191 preload
21192 !! wikitext
21193 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
21194 !! html/php
21195 <includeonly>Hello world</includeonly>
21196 !! end
21197
21198 !! test
21199 preload: check that it doesn't try to do tricks
21200 !! options
21201 preload
21202 !! wikitext
21203 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21204 !! html/php
21205 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21206 !! end
21207
21208 !! test
21209 Play a bit with r67090 and bug 3158
21210 !! wikitext
21211 <div style="width:50% !important">&nbsp;</div>
21212 <div style="width:50%&nbsp;!important">&nbsp;</div>
21213 <div style="width:50%&#160;!important">&nbsp;</div>
21214 <div style="border : solid;">&nbsp;</div>
21215 !! html/php
21216 <div style="width:50% !important">&#160;</div>
21217 <div style="width:50% !important">&#160;</div>
21218 <div style="width:50% !important">&#160;</div>
21219 <div style="border&#160;: solid;">&#160;</div>
21220
21221 !! html/parsoid
21222 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21223 <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>
21224 <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>
21225 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21226
21227 !! end
21228
21229 !! test
21230 HTML5 data attributes
21231 !! wikitext
21232 <span data-foo="bar">Baz</span>
21233 <p data-abc-def_hij="">Quuz</p>
21234 !! html/php
21235 <p><span data-foo="bar">Baz</span>
21236 </p>
21237 <p data-abc-def_hij="">Quuz</p>
21238
21239 !! html/parsoid
21240 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
21241 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
21242 !! end
21243
21244 !! test
21245 Strip reserved data attributes
21246 !! wikitext
21247 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
21248 !! html/php
21249 <div data-ok="fred">d</div>
21250
21251 !! html/parsoid
21252 <div data-x-data-mw="foo" data-x-data-parsoid="bar" data-x-data-mw-someext="baz" data-ok="fred" data-parsoid='{"stx":"html","a":{"data-ooui":null,"data-bad:ns":null},"sa":{"data-ooui":"xyzzy","data-bad:ns":"ns"}}'>d</div>
21253 !! end
21254
21255 !! test
21256 percent-encoding and + signs in internal links (Bug 26410)
21257 !! wikitext
21258 [[User:+%]] [[Page+title%]]
21259 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
21260 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
21261 [[%33%45]] [[%33%45+]]
21262 !! html/php
21263 <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>
21264 <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>
21265 <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>
21266 <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>
21267 </p>
21268 !! html/parsoid
21269 <p><a rel="mw:WikiLink" href="./User:+%25" title="User:+%" data-parsoid='{"stx":"simple","a":{"href":"./User:+%25"},"sa":{"href":"User:+%"}}'>User:+%</a> <a rel="mw:WikiLink" href="./Page+title%25" title="Page+title%" data-parsoid='{"stx":"simple","a":{"href":"./Page+title%25"},"sa":{"href":"Page+title%"}}'>Page+title%</a>
21270 <a rel="mw:WikiLink" href="./%25+" title="%+" data-parsoid='{"stx":"simple","a":{"href":"./%25+"},"sa":{"href":"%+"}}'>%+</a> <a rel="mw:WikiLink" href="./%25+" title="%+" data-parsoid='{"stx":"piped","a":{"href":"./%25+"},"sa":{"href":"%+"}}'>%20</a> <a rel="mw:WikiLink" href="./%25+" title="%+" data-parsoid='{"stx":"simple","a":{"href":"./%25+"},"sa":{"href":"%+ "}}'>%+ </a> <a rel="mw:WikiLink" href="./%25+r" title="%+r" data-parsoid='{"stx":"simple","a":{"href":"./%25+r"},"sa":{"href":"%+r"}}'>%+r</a>
21271 <a rel="mw:WikiLink" href="./%25" title="%" data-parsoid='{"stx":"simple","a":{"href":"./%25"},"sa":{"href":"%"}}'>%</a> <a rel="mw:WikiLink" href="./+" title="+" data-parsoid='{"stx":"simple","a":{"href":"./+"},"sa":{"href":"+"}}'>+</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=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Bar\"},\"sa\":{\"href\":\"bar\"},\"dsr\":[94,101,2,2]}&#39;>bar&lt;/a>"}'><a href="./File:%25+abc9" data-parsoid='{"a":{"href":"./File:%25+abc9"},"sa":{}}'><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>
21272 <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>
21273 !! end
21274
21275 !! test
21276 Special characters in embedded file links (bug 27679)
21277 !! wikitext
21278 [[File:Contains & ampersand.jpg]]
21279 [[File:Does not exist.jpg|Title with & ampersand]]
21280 !! html/php
21281 <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>
21282 <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>
21283 </p>
21284 !! html/parsoid
21285 <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>
21286 <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>
21287 !! end
21288
21289 !! test
21290 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
21291 !! wikitext
21292 Text&apos;s been normalized?
21293 !! html
21294 <p>Text&#39;s been normalized?
21295 </p>
21296 !! end
21297
21298 !! test
21299 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
21300 !! wikitext
21301 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
21302 !! html
21303 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
21304 </p>
21305 !! end
21306
21307 !! test
21308 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
21309 !! wikitext
21310 [http://www.example.org/ ideograms]
21311 !! html
21312 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
21313 </p>
21314 !! end
21315
21316 !! test
21317 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
21318 !! wikitext
21319 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
21320 !! html
21321 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
21322 </p>
21323 !! end
21324
21325 !! article
21326 Mediawiki:loop1
21327 !! text
21328 {{Identical|A}}
21329 !! endarticle
21330
21331 !! article
21332 Mediawiki:loop2
21333 !! text
21334 {{Identical|B}}
21335 !! endarticle
21336
21337 !! article
21338 Template:Identical
21339 !! text
21340 {{int:loop1}}
21341 {{int:loop2}}
21342 !! endarticle
21343
21344 !! test
21345 Bug 31098 Template which includes system messages which includes the template
21346 !! wikitext
21347 {{Identical}}
21348 !! html
21349 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21350 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21351 </p>
21352 !! end
21353
21354 !! test
21355 Bug31490 Turkish: ucfirst 'blah'
21356 !! options
21357 language=tr
21358 !! wikitext
21359 {{ucfirst:blah}}
21360 !! html
21361 <p>Blah
21362 </p>
21363 !! end
21364
21365 !! test
21366 Bug31490 Turkish: ucfirst 'ix'
21367 !! options
21368 language=tr
21369 !! wikitext
21370 {{ucfirst:ix}}
21371 !! html
21372 <p>İx
21373 </p>
21374 !! end
21375
21376 !! test
21377 Bug31490 Turkish: lcfirst 'BLAH'
21378 !! options
21379 language=tr
21380 !! wikitext
21381 {{lcfirst:BLAH}}
21382 !! html
21383 <p>bLAH
21384 </p>
21385 !! end
21386
21387 !! test
21388 Bug31490 Turkish: ucfırst (with a dotless i)
21389 !! options
21390 language=tr
21391 !! wikitext
21392 {{ucfırst:blah}}
21393 !! html
21394 <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>
21395 </p>
21396 !! end
21397
21398 !! test
21399 Bug31490 ucfırst (with a dotless i) with English language
21400 !! options
21401 language=en
21402 !! wikitext
21403 {{ucfırst:blah}}
21404 !! html
21405 <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>
21406 </p>
21407 !! end
21408
21409 !! test
21410 Bug 26375: TOC with italics
21411 !! options
21412 title=[[Main Page]]
21413 !! wikitext
21414 __TOC__
21415 == ''Lost'' episodes ==
21416 !! html
21417 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21418 <ul>
21419 <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>
21420 </ul>
21421 </div>
21422
21423 <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>
21424
21425 !! end
21426
21427 !! test
21428 Bug 26375: TOC with bold
21429 !! options
21430 title=[[Main Page]]
21431 !! wikitext
21432 __TOC__
21433 == '''should be bold''' then normal text ==
21434 !! html
21435 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21436 <ul>
21437 <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>
21438 </ul>
21439 </div>
21440
21441 <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>
21442
21443 !! end
21444
21445 !! test
21446 Bug 33845: Headings become cursive in TOC when they contain an image
21447 !! options
21448 title=[[Main Page]]
21449 !! wikitext
21450 __TOC__
21451 == Image [[Image:foobar.jpg]] ==
21452 !! html
21453 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21454 <ul>
21455 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
21456 </ul>
21457 </div>
21458
21459 <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>
21460
21461 !! end
21462
21463 !! test
21464 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
21465 !! options
21466 title=[[Main Page]]
21467 !! wikitext
21468 __TOC__
21469 == <blockquote>Quote</blockquote> ==
21470 !! html
21471 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21472 <ul>
21473 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21474 </ul>
21475 </div>
21476
21477 <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>
21478
21479 !! html+tidy
21480 <p></p>
21481 <div id="toc" class="toc">
21482 <div id="toctitle">
21483 <h2>Contents</h2>
21484 </div>
21485 <ul>
21486 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21487 </ul>
21488 </div>
21489 <p></p>
21490 <h2><span class="mw-headline" id="Quote"></span></h2>
21491 <blockquote>
21492 <p><span class="mw-headline" id="Quote">Quote</span></p>
21493 </blockquote>
21494 <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>
21495 !! end
21496
21497 !! test
21498 Unclosed tags in TOC
21499 !! options
21500 title=[[Main Page]]
21501 !! wikitext
21502 __TOC__
21503 == Proof: 2 < 3 ==
21504 <small>Hanc marginis exiguitas non caperet.</small>
21505 QED
21506 !! html
21507 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21508 <ul>
21509 <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>
21510 </ul>
21511 </div>
21512
21513 <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>
21514 <p><small>Hanc marginis exiguitas non caperet.</small>
21515 QED
21516 </p>
21517 !! end
21518
21519 !! test
21520 Multiple tags in TOC
21521 !! wikitext
21522 __TOC__
21523 == <i>Foo</i> <b>Bar</b> ==
21524
21525 == <i>Foo</i> <blockquote>Bar</blockquote> ==
21526 !! html
21527 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21528 <ul>
21529 <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>
21530 <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>
21531 </ul>
21532 </div>
21533
21534 <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>
21535 <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>
21536
21537 !! html+tidy
21538 <p></p>
21539 <div id="toc" class="toc">
21540 <div id="toctitle">
21541 <h2>Contents</h2>
21542 </div>
21543 <ul>
21544 <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>
21545 <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>
21546 </ul>
21547 </div>
21548 <p></p>
21549 <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>
21550 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
21551 <blockquote>
21552 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
21553 </blockquote>
21554 <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>
21555 !! end
21556
21557 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
21558 # html5 tag parsing.
21559 !! test
21560 Tags with parameters in TOC
21561 !! options
21562 parsoid=wt2html
21563 !! wikitext
21564 __TOC__
21565 == <sup class="in-h2">Hello</sup> ==
21566
21567 == <sup class="a > b">Evilbye</sup> ==
21568 !! html/php
21569 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21570 <ul>
21571 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
21572 <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>
21573 </ul>
21574 </div>
21575
21576 <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>
21577 <h2><span class="mw-headline" id="b.22.3EEvilbye"><sup class="a"> b"&gt;Evilbye</sup></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b&quot;&gt;Evilbye">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
21578
21579 !! html/parsoid
21580 <meta property="mw:PageProp/toc" />
21581 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
21582
21583 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
21584 !! end
21585
21586 !! test
21587 span tags with directionality in TOC
21588 !! wikitext
21589 __TOC__
21590 == <span dir="ltr">C++</span> ==
21591
21592 == <span dir="rtl">זבנג!</span> ==
21593
21594 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
21595
21596 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
21597
21598 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
21599 !! html
21600 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21601 <ul>
21602 <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>
21603 <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>
21604 <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>
21605 <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>
21606 <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>
21607 </ul>
21608 </div>
21609
21610 <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>
21611 <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>
21612 <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>
21613 <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>
21614 <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>
21615
21616 !! end
21617
21618 !! test
21619 Bug 72884: bdi element in ToC
21620 !! wikitext
21621 __TOC__
21622 == <bdi>test</bdi> ==
21623 !! html
21624 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21625 <ul>
21626 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
21627 </ul>
21628 </div>
21629
21630 <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>
21631
21632 !! end
21633
21634 # Note that the html output does not have the <p></p>, but the
21635 # html+tidy output *does*. This is because the empty <p></p> is
21636 # removed by the sanitizer, but only when tidy is *not* enabled (!).
21637 !! test
21638 Empty <p> tag in TOC, removed by Sanitizer (T92892)
21639 !! wikitext
21640 __TOC__
21641 == x ==
21642 !! html
21643 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21644 <ul>
21645 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21646 </ul>
21647 </div>
21648
21649 <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>
21650
21651 !! html+tidy
21652 <p></p>
21653 <div id="toc" class="toc">
21654 <div id="toctitle">
21655 <h2>Contents</h2>
21656 </div>
21657 <ul>
21658 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21659 </ul>
21660 </div>
21661 <p></p>
21662 <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>
21663 !! end
21664
21665 !! article
21666 MediaWiki:Bug32057
21667 !! text
21668 == {{int:headline_sample}} ==
21669 !! endarticle
21670
21671 !! test
21672 Bug 32057: Title needed when expanding <h> nodes.
21673 !! options
21674 title=[[Main Page]]
21675 !! wikitext
21676 {{int:Bug32057}}
21677 !! html
21678 <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>
21679
21680 !! end
21681
21682 !! test
21683 Strip marker in urlencode
21684 !! wikitext
21685 {{urlencode:x<nowiki/>y}}
21686 {{urlencode:x<nowiki/>y|wiki}}
21687 {{urlencode:x<nowiki/>y|path}}
21688 {{urlencode:x<pre id="one">two</pre>y}}
21689 !! html
21690 <p>xy
21691 xy
21692 xy
21693 xy
21694 </p>
21695 !! end
21696
21697 !! test
21698 Strip marker in lc
21699 !! wikitext
21700 {{lc:x<nowiki/>y}}
21701 !! html
21702 <p>xy
21703 </p>
21704 !! end
21705
21706 !! test
21707 Strip marker in uc
21708 !! wikitext
21709 {{uc:x<nowiki/>y}}
21710 !! html
21711 <p>XY
21712 </p>
21713 !! end
21714
21715 !! test
21716 Strip marker in formatNum
21717 !! wikitext
21718 {{formatnum:1<nowiki/>2}}
21719 {{formatnum:1<nowiki/>2|R}}
21720 !! html
21721 <p>12
21722 12
21723 </p>
21724 !! end
21725
21726 !! test
21727 Check noCommafy in formatNum
21728 !! options
21729 language=be-tarask
21730 !! wikitext
21731 {{formatnum:123456.78}}
21732 {{formatnum:123456.78|NOSEP}}
21733 !! html
21734 <p>123 456,78
21735 123456.78
21736 </p>
21737 !! end
21738
21739 !! test
21740 Wrong option for formatNum (bug 56199)
21741 !! wikitext
21742 {{formatnum:1,234.56|Random}}
21743 {{formatnum:1,234.56|EVERYTHING}}
21744 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
21745 !! html
21746 <p>1,234.56
21747 1,234.56
21748 1,234.56
21749 </p>
21750 !! end
21751
21752 !! test
21753 Strip marker in grammar
21754 !! options
21755 language=fi
21756 !! wikitext
21757 {{grammar:elative|foo<nowiki/>bar}}
21758 !! html
21759 <p>foobarista
21760 </p>
21761 !! end
21762
21763 !! test
21764 Strip marker in padleft
21765 !! wikitext
21766 {{padleft:|2|x<nowiki/>y}}
21767 !! html
21768 <p>xy
21769 </p>
21770 !! end
21771
21772 !! test
21773 Strip marker in padright
21774 !! wikitext
21775 {{padright:|2|x<nowiki/>y}}
21776 !! html
21777 <p>xy
21778 </p>
21779 !! end
21780
21781 !! test
21782 Strip marker in anchorencode
21783 !! wikitext
21784 {{anchorencode:x<nowiki/>y}}
21785 !! html
21786 <p>xy
21787 </p>
21788 !! end
21789
21790 !! test
21791 nowiki inside link inside heading (bug 18295)
21792 !! wikitext
21793 ==[[foo|x<nowiki>y</nowiki>z]]==
21794 !! html
21795 <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>
21796
21797 !! end
21798
21799 !! test
21800 new support for bdi element (bug 31817)
21801 !! wikitext
21802 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21803 !! html
21804 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21805
21806 !!end
21807
21808 !! test
21809 Ignore pipe between table row attributes
21810 !! wikitext
21811 {|
21812 | quux
21813 |- id=foo | style='color: red'
21814 | bar
21815 |}
21816 !! html
21817 <table>
21818 <tr>
21819 <td> quux
21820 </td></tr>
21821 <tr id="foo" style="color: red">
21822 <td> bar
21823 </td></tr></table>
21824
21825 !! end
21826
21827 !!test
21828 Gallery override link with WikiLink (bug 34852)
21829 !! wikitext
21830 <gallery>
21831 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
21832 </gallery>
21833 !! html
21834 <ul class="gallery mw-gallery-traditional">
21835 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21836 <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>
21837 <div class="gallerytext">
21838 <p>caption
21839 </p>
21840 </div>
21841 </div></li>
21842 </ul>
21843
21844 !! end
21845
21846 !!test
21847 Gallery override link with absolute external link (bug 34852)
21848 !! wikitext
21849 <gallery>
21850 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21851 </gallery>
21852 !! html
21853 <ul class="gallery mw-gallery-traditional">
21854 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21855 <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>
21856 <div class="gallerytext">
21857 <p>caption
21858 </p>
21859 </div>
21860 </div></li>
21861 </ul>
21862
21863 !! end
21864
21865 !!test
21866 Gallery override link with malicious javascript (bug 34852)
21867 !! wikitext
21868 <gallery>
21869 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21870 </gallery>
21871 !! html
21872 <ul class="gallery mw-gallery-traditional">
21873 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21874 <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>
21875 <div class="gallerytext">
21876 <p>caption
21877 </p>
21878 </div>
21879 </div></li>
21880 </ul>
21881
21882 !! end
21883
21884 !!test
21885 Gallery with invalid title as link (bug 43964)
21886 !! wikitext
21887 <gallery>
21888 File:foobar.jpg|link=<
21889 </gallery>
21890 !! html
21891 <ul class="gallery mw-gallery-traditional">
21892 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21893 <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>
21894 <div class="gallerytext">
21895 </div>
21896 </div></li>
21897 </ul>
21898
21899 !! end
21900
21901 !!test
21902 Language parser function
21903 !! wikitext
21904 {{#language:ar}}
21905 !! html
21906 <p>العربية
21907 </p>
21908 !! end
21909
21910 !!test
21911 Padleft and padright as substr
21912 !! wikitext
21913 {{padleft:|3|abcde}}
21914 {{padright:|3|abcde}}
21915 !! html
21916 <p>abc
21917 abc
21918 </p>
21919 !! end
21920
21921 !!test
21922 Special parser function
21923 !! wikitext
21924 {{#special:RandomPage}}
21925 {{#special:BaDtItLe}}
21926 {{#special:Foobar}}
21927 !! html
21928 <p>Special:Random
21929 Special:Badtitle
21930 Special:Foobar
21931 </p>
21932 !! end
21933
21934 !!test
21935 Bug 34939 - Case insensitive link parsing ([HttP://])
21936 !! wikitext
21937 [HttP://MediaWiki.Org/]
21938 !! html/php
21939 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
21940 </p>
21941 !! html/parsoid
21942 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
21943 !! end
21944
21945 !!test
21946 Bug 34939 - Case insensitive link parsing ([HttP:// title])
21947 !! wikitext
21948 [HttP://MediaWiki.Org/ MediaWiki]
21949 !! html
21950 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
21951 </p>
21952 !! end
21953
21954 !!test
21955 Bug 34939 - Case insensitive link parsing (HttP://)
21956 !! wikitext
21957 HttP://MediaWiki.Org/
21958 !! html/php
21959 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
21960 </p>
21961 !! html/parsoid
21962 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
21963 !! end
21964
21965 !!test
21966 Disable TOC
21967 !! options
21968 notoc
21969 !! wikitext
21970 Lead
21971 == Section 1 ==
21972 == Section 2 ==
21973 == Section 3 ==
21974 == Section 4 ==
21975 == Section 5 ==
21976 !! html
21977 <p>Lead
21978 </p>
21979
21980 <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>
21981 <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>
21982 <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>
21983 <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>
21984 <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>
21985
21986 !! end
21987
21988
21989 ###
21990 ### Parsoid-specific tests
21991 ### Parsoid-PHP parser incompatibilities
21992 ###
21993 !!test
21994 1. SOL-sensitive wikitext tokens as template-args
21995 !!options
21996 parsoid=wt2html,wt2wt
21997 !! wikitext
21998 {{echo|*a}}
21999 {{echo|#a}}
22000 {{echo|:a}}
22001 !! html
22002 <span about="#mwt1" typeof="mw:Transclusion">
22003 </span><ul about="#mwt1"><li>a</li>
22004 </ul>
22005 <span about="#mwt2" typeof="mw:Transclusion">
22006 </span><ol about="#mwt2"><li>a</li>
22007 </ol>
22008 <span about="#mwt3" typeof="mw:Transclusion">
22009 </span><dl about="#mwt3"><dd>a</dd>
22010 </dl>
22011 !!end
22012
22013 #### -----------------------------------------------------------------
22014 #### Parsoid-specific functionality tests
22015 #### -----------------------------------------------------------------
22016
22017 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
22018 # We know wt2wt will fail, but we expect selser to pass.
22019 # Due to the nature of our testing, wt2wt and selser tests will enter the
22020 # blacklist and we'll catch selser regressions based on changes to the
22021 # blacklist entries for selser tests.
22022 !! test
22023 1. Bad treebuilder fixup of formatting elt is cleaned up
22024 !! options
22025 parsoid=wt2html,wt2wt
22026 !! wikitext
22027 {|
22028 |
22029 <small>
22030 [[Image:Foobar.jpg|right|Test]]
22031 </small>
22032 |}
22033 !! html/parsoid
22034 <table>
22035 <tbody><tr><td>
22036 <small>
22037 <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>
22038 </small>
22039 </td></tr>
22040 </tbody></table>
22041 !! end
22042
22043 !! test
22044 2. Bad treebuilder fixup of formatting elt is cleaned up
22045 !! options
22046 parsoid=wt2html,wt2wt
22047 !! wikitext
22048 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
22049
22050 <small>[[Image:Foobar.jpg|right|300px]]</small>
22051 !! html/parsoid
22052
22053 <p><b>foo</b></p>
22054 <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>
22055 <p><b>bar</b></p>
22056 <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>
22057 !! end
22058
22059 !! test
22060 3. Bad treebuilder fixup of formatting elt is cleaned up
22061 !! options
22062 parsoid=wt2html,wt2wt
22063 !! wikitext
22064 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
22065 !! html/parsoid
22066 <p><small><b>foo</b></small></p>
22067 <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>
22068 <p><small><b>bar</b></small></p>
22069 !! end
22070
22071 !! test
22072 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
22073 !! options
22074 parsoid=wt2html,wt2wt
22075 !! wikitext
22076 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
22077 !! html/parsoid
22078 <p><b><small></small></b></p>
22079 <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>
22080 <p></p>
22081 !! end
22082
22083 #### ----------------------------------------------------------------
22084 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
22085 #### tags. Parsoid's output for these tags differs from that of the
22086 #### PHP parser.
22087 #### ----------------------------------------------------------------
22088
22089 !!test
22090 Ref: 1. ref-location should be replaced with an index span
22091 !! wikitext
22092 A <ref>foo</ref>
22093 B <ref name="x">foo</ref>
22094 C <ref name="y" />
22095 <references />
22096 !! html/parsoid
22097 <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>
22098 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>
22099 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>
22100 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22101 <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>
22102 <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>
22103 <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>
22104 </ol>
22105 !!end
22106
22107 !!test
22108 Ref: 2. ref-tags with identical names should all get the same index
22109 !! wikitext
22110 A <ref name="x">foo</ref>
22111 B <ref name="x" />
22112 <references />
22113 !! html/parsoid
22114 <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>
22115 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>
22116 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22117 <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>
22118 </ol>
22119 !!end
22120
22121 !!test
22122 Ref: 3. spaces in ref-names should be ignored
22123 !! wikitext
22124 A <ref name="x">foo</ref>
22125 B <ref name=" x " />
22126 C <ref name= x />
22127 <references />
22128 !! html/parsoid
22129 <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>
22130 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>
22131 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>
22132 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22133 <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>
22134 </ol>
22135 !!end
22136
22137 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
22138 !!test
22139 Ref: 4. 'constructor' should be accepted as a valid ref-name
22140 !! wikitext
22141 A <ref name="constructor">foo</ref>
22142 <references />
22143 !! html/parsoid
22144 <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>
22145 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22146 <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>
22147 </ol>
22148 !!end
22149
22150 !!test
22151 Ref: 5. body should accept generic wikitext
22152 !! wikitext
22153 A <ref>
22154 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
22155 </ref>
22156
22157 <references />
22158 !! html/parsoid
22159 <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>
22160
22161 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22162 <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>
22163 </span></li>
22164 </ol>
22165 !!end
22166
22167 !!test
22168 Ref: 6. indent-pres should not be output in ref-body
22169 !! wikitext
22170 A <ref>
22171 foo
22172 bar
22173 baz
22174 </ref>
22175
22176 <references />
22177 !! html/parsoid
22178 <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>
22179
22180 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22181 <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
22182 bar
22183 baz
22184 </span></li>
22185 </ol>
22186 !!end
22187
22188 !!test
22189 Ref: 7. No p-wrapping in ref-body
22190 !! wikitext
22191 A <ref>
22192 foo
22193
22194 bar
22195
22196
22197 baz
22198
22199
22200
22201 booz
22202 </ref>
22203
22204 <references />
22205 !! html/parsoid
22206 <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>
22207
22208 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22209 <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
22210
22211 bar
22212
22213
22214 baz
22215
22216
22217
22218 booz
22219 </span></li>
22220 </ol>
22221 !!end
22222
22223 !!test
22224 Ref: 8. transclusion wikitext has lower precedence
22225 !! wikitext
22226 A <ref> foo {{echo|</ref> B C}}
22227
22228 <references />
22229 !! html/parsoid
22230 <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>
22231 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22232 <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 {{echo|</span></li>
22233 </ol>
22234 !!end
22235
22236 !!test
22237 Ref: 9. unclosed comments should not leak out of ref-body
22238 !! wikitext
22239 A <ref> foo <!--</ref> B C
22240 <references />
22241 !! html/parsoid
22242 <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>
22243 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22244 <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>
22245 </ol>
22246 !!end
22247
22248 !!test
22249 Ref: 10. Unclosed HTML tags should not leak out of ref-body
22250 !! wikitext
22251 A <ref> <b> foo </ref> B C
22252
22253 <references />
22254 !! html/parsoid
22255 <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>
22256
22257
22258 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22259 <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>
22260 </ol>
22261 !!end
22262
22263 !!test
22264 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
22265 !! wikitext
22266 A <ref>foo</ref> B
22267 C <ref>bar</ref> D
22268 <references />
22269 !! html/parsoid
22270 <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
22271 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>
22272 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22273 <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>
22274 <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>
22275 </ol>
22276 !!end
22277
22278 !!test
22279 Ref: 12. ref-tags act as trailing newline migration barrier
22280 !! wikitext
22281 <!--the newline at the end of this line moves out of the p tag-->a
22282
22283 b<!--the newline at the end of this line stays inside the p tag--> <ref />
22284 <ref />
22285
22286 c
22287 <references />
22288 !! html/parsoid
22289 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
22290
22291
22292 <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>
22293 <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>
22294
22295 <p>c</p>
22296 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22297 <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>
22298 <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>
22299 !!end
22300
22301 !!test
22302 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
22303 !! wikitext
22304 <ref>foo</ref> A
22305 <ref>bar
22306 </ref> B
22307 <references />
22308 !! html/parsoid
22309 <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
22310 <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>
22311 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22312 <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>
22313 <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
22314 </span></li>
22315 </ol>
22316 !!end
22317
22318 !!test
22319 Ref: 14. A nested ref-tag should be emitted as plain text
22320 !! wikitext
22321 <ref>foo <ref>bar</ref> baz</ref>
22322
22323 <references />
22324 !! html/parsoid
22325 <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>
22326 </p>
22327 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22328 <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>
22329 </ol>
22330 !!end
22331
22332 !!test
22333 Ref: 15. ref-tags with identical names should get identical indexes
22334 !! wikitext
22335 A1 <ref name="a">foo</ref> A2 <ref name="a" />
22336 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
22337
22338 <references />
22339 !! html/parsoid
22340 <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>
22341 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>
22342
22343 <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>
22344 </ol>
22345 !!end
22346
22347 ## We don't bother wt2wt-ing non-standard whitespace
22348 !!test
22349 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
22350 !!options
22351 parsoid=wt2html
22352 !! wikitext
22353 A <ref >foo</ref >
22354
22355 <references />
22356 !! html/parsoid
22357 <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>
22358 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22359 <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>
22360 !!end
22361
22362 !!test
22363 Ref: 17. Generate valid HTML5 id/about attributes
22364 !!wikitext
22365 <ref name="a b">foo</ref>
22366
22367 <references />
22368 !!html/parsoid
22369 <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>
22370 </p>
22371
22372 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22373 <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>
22374 </ol>
22375 !!end
22376
22377 !!test
22378 Ref: 18. T58916: Extension attributes should be parsed as plain text
22379 !!wikitext
22380 <ref name="{{echo|a}}">foo</ref>
22381
22382 <references />
22383 !!html/parsoid
22384 <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>
22385 </p>
22386
22387 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22388 <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>
22389 </ol>
22390 !!end
22391
22392 !!test
22393 Ref: 19. ref-tags with identical name encodings should get identical indexes
22394 !! wikitext
22395 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
22396
22397 <references />
22398 !! html/parsoid
22399 <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>
22400 </p>
22401 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22402 <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>
22403 </ol>
22404 !!end
22405
22406 !!test
22407 Ref: 20. ref-tags with identical names but different content should keep it
22408 !! wikitext
22409 A <ref name="foo">Foo one</ref>
22410 B <ref name="foo">Foo two</ref>
22411 C <ref name="foo" />
22412
22413 <references />
22414 !! html/parsoid
22415 <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>
22416 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>
22417 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>
22418
22419 <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>
22420 </ol>
22421 !!end
22422
22423 !!test
22424 References: 1. references tag without any refs should be handled properly
22425 !! wikitext
22426 <references />
22427 !! html/parsoid
22428 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22429 !!end
22430
22431 !!test
22432 References: 2. references tag with group only outputs references from that group
22433 !! wikitext
22434 A <ref group="a">foo</ref>
22435 B <ref group="b">bar</ref>
22436 C <ref>baz</ref>
22437
22438 <references group="a" />
22439 <references />
22440 <references group="b" />
22441 !! html/parsoid
22442 <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>
22443 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>
22444 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>
22445
22446 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
22447 <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>
22448 </ol>
22449 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
22450 <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>
22451 </ol>
22452 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
22453 <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>
22454 </ol>
22455 !!end
22456
22457 !!test
22458 References: 3. ref list should be cleared after processing references
22459 !! wikitext
22460 A <ref>foo</ref>
22461
22462 <references />
22463
22464 B <ref>bar</ref>
22465
22466 <references />
22467 !! html/parsoid
22468 <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>
22469
22470 <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>
22471 </ol>
22472
22473 <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>
22474
22475 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22476 <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>
22477 </ol>
22478 !!end
22479
22480 !!test
22481 References: 4. only referenced group should be cleared after processing references
22482 !! wikitext
22483 A <ref group="a">afoo</ref>
22484 B <ref>bfoo</ref>
22485
22486 <references group="a" />
22487
22488 C <ref>cfoo</ref>
22489
22490 <references />
22491 !! html/parsoid
22492 <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>
22493 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>
22494
22495 <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>
22496 </ol>
22497
22498 <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>
22499
22500 <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>
22501 </ol>
22502 !!end
22503
22504 ## Don't expect this to rt since we're dropping content
22505 !! test
22506 References: 5. ref tags in references should be processed while ignoring all other content
22507 !! options
22508 parsoid=wt2html,html2html
22509 !! wikitext
22510 A <ref name="a" />
22511 B <ref name="b">bar</ref>
22512
22513 <references>
22514 <ref name="a">foo</ref>
22515 This should just get lost.
22516 </references>
22517 !! html/parsoid
22518 <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>
22519 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>
22520
22521
22522 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{},"body":{"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;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/span>\n"}}'><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>
22523 </ol>
22524 !! end
22525
22526 !! test
22527 References: 6. <references /> from a transclusion
22528 !! wikitext
22529 <ref>Foo</ref> {{echo|<references />}}
22530 !! html/parsoid
22531 <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>
22532 </ol>
22533 !! end
22534
22535 !! test
22536 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
22537 !! wikitext
22538 A <ref>foo bar for a</ref>
22539 B <ref group="X" name="b" />
22540
22541 <references />
22542
22543 <references group="X">
22544 <ref name="b">foo</ref>
22545 </references>
22546 !! html/parsoid
22547 <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>
22548 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>
22549 </p>
22550
22551 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22552 <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>
22553 </ol>
22554
22555 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="X" data-mw='{"name":"references","attrs":{"group":"X"},"body":{"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\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[X 1]&lt;/span>&lt;/a>&lt;/span>\n"}}'>
22556 <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>
22557 </ol>
22558 !! end
22559
22560 !! test
22561 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
22562 !! wikitext
22563 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
22564 <references />
22565 !! html/parsoid
22566 <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>
22567 <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>
22568 </ol>
22569 !!end
22570
22571 # This test only works in wt2html now as the <references /> are always generated
22572 # unless selser is active. Once T72722 is fixed, we should add a changes test
22573 # here to ensure that unrelated changes don't add the new <references />
22574 # when selser is active.
22575 !! test
22576 References: 9. Generate missing references list at the end
22577 !! wikitext
22578 A <ref>foo</ref>
22579 B <ref group="inexistent">bar</ref>
22580 !! html/parsoid
22581 <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>
22582 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'>
22583 <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>
22584 </ol>
22585 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"},"autoGenerated":true}'>
22586 <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>
22587 </ol>
22588 !! end
22589
22590 !! test
22591 References: 10. New <references/> shouldn't be added for unrelated edits.
22592 !! options
22593 parsoid={
22594 "modes": ["selser"],
22595 "changes": [["#x", "remove"]],
22596 "selser": "noauto"
22597 }
22598 !! wikitext
22599 Unrelated text<span id="x"> that's going to disappear</span>.
22600 A <ref>foo</ref>
22601 !! wikitext/edited
22602 Unrelated text.
22603 A <ref>foo</ref>
22604 !!end
22605
22606 !! test
22607 Entities in ref name
22608 !! wikitext
22609 <ref name="test &amp; me">hi</ref>
22610 <references />
22611 !! html/parsoid
22612 <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>
22613 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22614 <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>
22615 </ol>
22616 !! end
22617
22618 ## The output here may look funny, but it's what the php parser will do. The
22619 ## unclosed references tag becomes escaped text, and then a new references
22620 ## tag is auto-generated. The test is wt2html only because it roundtrips with
22621 ## nowiki tags, and the auto-generated references tag is only dropped in
22622 ## rtTestMode.
22623 !! test
22624 Generate references for unclosed references tag
22625 !! options
22626 parsoid=wt2html
22627 !! wikitext
22628 a<ref>foo</ref>
22629
22630 <references>
22631 !! html/parsoid
22632 <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" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></p>
22633
22634 <p>&lt;references></p>
22635 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'><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>
22636 !! end
22637
22638 !! test
22639 New reference serializes on its own line
22640 !! options
22641 parsoid=wt2wt,html2wt
22642 !! wikitext
22643 foo
22644 <references />
22645 !! html/parsoid
22646 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22647 !! end
22648
22649 #### ----------------------------------------------------------------
22650 #### Parsoid-only testing of Parsoid's impl of LST
22651 #### Not implemented yet, see
22652 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
22653 #### ----------------------------------------------------------------
22654
22655 !! test
22656 LST Sections: 1. Simple section start and end
22657 !! options
22658 parsoid={ "suppressErrors": true }
22659 !! wikitext
22660 <section begin="2011-05-16" />
22661 <section end="2014-04-10 (MW 1.23wmf22)" />
22662 !! html/parsoid
22663 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
22664 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
22665 !! end
22666
22667 #--------- Test stripping of empty nodes in template content ----------
22668 !!test
22669 Empty LI and TR nodes should be stripped from template content
22670 !!wikitext
22671 {{EmptyLITest}}
22672 {{EmptyTRTest}}
22673 !!html/parsoid
22674 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
22675 <li>a</li>
22676 <li>b</li>
22677 </ul>
22678 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
22679 <tbody>
22680 <tr>
22681 <td>foo</td>
22682 </tr>
22683 <tr>
22684 <td>bar</td>
22685 </tr>
22686 </tbody>
22687 </table>
22688 !!end
22689
22690 !!test
22691 Empty LI and TR nodes should not be stripped from top-level content
22692 !!wikitext
22693 * a
22694 *
22695 * b
22696 {|
22697 |-
22698 |-
22699 |foo
22700 |}
22701 !!html/parsoid
22702 <ul>
22703 <li> a</li>
22704 <li></li>
22705 <li> b</li>
22706 </ul>
22707 <table>
22708 <tbody>
22709 <tr></tr>
22710 <tr>
22711 <td>foo</td>
22712 </tr>
22713 </tbody>
22714 </table>
22715 !!end
22716
22717 !!test
22718 Empty TR nodes should not be stripped if they have any attributes set
22719 !!wikitext
22720 {{EmptyTRWithHTMLAttrTest}}
22721 !!html/parsoid
22722 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
22723 <tr align="center"></tr>
22724 <tr><td>foo</td></tr>
22725 <tr align="center"></tr>
22726 <tr><td>bar</td></tr>
22727 </table>
22728 !!end
22729
22730 #### ----------------------------------------------------------------
22731 #### The following section of tests are primarily to test
22732 #### wikitext escaping capabilities of Parsoid. Given that
22733 #### escaping can be done any number of ways, the wikitext (input)
22734 #### is always adjusted to reflect how Parsoid adds nowiki
22735 #### escape tags.
22736 ####
22737 #### We are marking several tests as parsoid-only since the
22738 #### HTML in the result section is different from what the
22739 #### PHP parser generates for it.
22740 #### ----------------------------------------------------------------
22741
22742
22743 #### --------------- Headings ---------------
22744 #### 0. Unnested
22745 #### 1. Nested inside html <h1>=foo=</h1>
22746 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
22747 #### 3. Nested inside html with wikitext split by html tags
22748 #### 4. No escape needed
22749 #### 5. Empty headings <h1></h1>
22750 #### 6. Heading chars in SOL context
22751 #### ----------------------------------------
22752 !! test
22753 Headings: 0. Unnested
22754 !! options
22755 parsoid=html2wt
22756 !! html/parsoid
22757 <p>=foo=</p>
22758
22759 <p> =foo=
22760 <!--cmt-->
22761 =foo=</p>
22762
22763 <p>=foo<i>a</i>=</p>
22764 !! wikitext
22765 <nowiki>=foo=</nowiki>
22766
22767 <nowiki> </nowiki>=foo=
22768 <!--cmt-->
22769 <nowiki>=foo=</nowiki>
22770
22771 =foo''a''<nowiki>=</nowiki>
22772 !!end
22773
22774 # New headings and existing headings are handled differently
22775 !! test
22776 Headings: 1. Nested inside html
22777 !! options
22778 parsoid=html2wt
22779 !! html/parsoid
22780 <h1>=foo=</h1>
22781 <h2>=foo=</h2>
22782 <h3>=foo=</h3>
22783
22784 <h1 data-parsoid=''>=foo=</h1>
22785 <h2 data-parsoid=''>=foo=</h2>
22786 <h3 data-parsoid=''>=foo=</h3>
22787 <h4 data-parsoid=''>=foo=</h4>
22788 <h5 data-parsoid=''>=foo=</h5>
22789 <h6 data-parsoid=''>=foo=</h6>
22790 !! wikitext
22791 = =foo= =
22792
22793 == =foo= ==
22794
22795 === =foo= ===
22796
22797 =<nowiki>=foo=</nowiki>=
22798 ==<nowiki>=foo=</nowiki>==
22799 ===<nowiki>=foo=</nowiki>===
22800 ====<nowiki>=foo=</nowiki>====
22801 =====<nowiki>=foo=</nowiki>=====
22802 ======<nowiki>=foo=</nowiki>======
22803
22804 !!end
22805
22806 !! test
22807 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
22808 !! options
22809 parsoid=html2wt
22810 !! html/parsoid
22811 <h1>foo</h1>*bar
22812 <h1>foo</h1>=bar
22813 <h1>foo</h1>=bar=
22814 !! wikitext
22815 = foo =
22816 <nowiki>*</nowiki>bar
22817
22818 = foo =
22819 =bar
22820
22821 = foo =
22822 <nowiki>=bar=</nowiki>
22823 !!end
22824
22825 !! test
22826 Headings: 3. Nested inside html with wikitext split by html tags
22827 !! options
22828 parsoid=html2wt
22829 !! html/parsoid
22830 <h1>=<b>bold</b>foo=</h1>
22831 !! wikitext
22832 = ='''bold'''foo= =
22833 !!end
22834
22835 !! test
22836 Headings: 4a. No escaping needed (testing just h1 and h2)
22837 !! options
22838 parsoid=html2wt
22839 !! html/parsoid
22840 <h1>=foo</h1>
22841 <h1>foo=</h1>
22842 <h1> =foo= </h1>
22843 <h1>=foo= bar</h1>
22844 <h2>=foo</h2>
22845 <h2>foo=</h2>
22846 <h1>=</h1>
22847 <h1><i>=</i>foo=</h1>
22848 !! wikitext
22849 = =foo =
22850
22851 = foo= =
22852
22853 = =foo= =
22854
22855 = =foo= bar =
22856
22857 == =foo ==
22858
22859 == foo= ==
22860
22861 = = =
22862
22863 = ''=''foo= =
22864 !!end
22865
22866 !! test
22867 Headings: 4b. No escaping needed (inside p-tags)
22868 !! options
22869 parsoid=html2wt
22870 !! html/parsoid
22871 <p>===
22872 =foo= x
22873 =foo= <s></s>
22874 </p>
22875 !! wikitext
22876 ===
22877 =foo= x
22878 =foo= <s></s>
22879 !!end
22880
22881 !! test
22882 Headings: 5. Empty headings
22883 !! options
22884 parsoid=html2wt
22885 !! html/parsoid
22886 <h1 data-parsoid='{}'></h1>
22887
22888 <h2 data-parsoid='{}'></h2>
22889
22890 <h3 data-parsoid='{}'></h3>
22891
22892 <h4 data-parsoid='{}'></h4>
22893
22894 <h5 data-parsoid='{}'></h5>
22895
22896 <h6 data-parsoid='{}'></h6>
22897 !! wikitext
22898 =<nowiki/>=
22899
22900 ==<nowiki/>==
22901
22902 ===<nowiki/>===
22903
22904 ====<nowiki/>====
22905
22906 =====<nowiki/>=====
22907
22908 ======<nowiki/>======
22909 !!end
22910
22911 !! test
22912 Headings: 6a. Heading chars in SOL context (with trailing spaces)
22913 !! options
22914 parsoid=html2wt
22915 !! html/parsoid
22916 <p>=a=</p>
22917
22918 <p>=a=</p>
22919
22920 <p>=a=</p>
22921 !! wikitext
22922 <nowiki>=a=</nowiki>
22923
22924 <nowiki>=a=</nowiki>
22925
22926 <nowiki>=a=</nowiki>
22927 !!end
22928
22929 !! test
22930 Headings: 6b. Heading chars in SOL context (with trailing newlines)
22931 !! options
22932 parsoid=html2wt
22933 !! html/parsoid
22934 <p>=a=
22935 b</p>
22936
22937 <p>=a=
22938 b</p>
22939
22940 <p>=a=
22941 b</p>
22942 !! wikitext
22943 <nowiki>=a=</nowiki>
22944 b
22945
22946 <nowiki>=a=</nowiki>
22947 b
22948
22949 <nowiki>=a=</nowiki>
22950 b
22951 !!end
22952
22953 !! test
22954 Headings: 6c. Heading chars in SOL context (leading newline break)
22955 !! options
22956 parsoid=html2wt
22957 !! html/parsoid
22958 <p>a
22959 =b=</p>
22960 !! wikitext
22961 a
22962 <nowiki>=b=</nowiki>
22963 !!end
22964
22965 !! test
22966 Headings: 6d. Heading chars in SOL context (with interspersed comments)
22967 !! options
22968 parsoid=html2wt
22969 !! html/parsoid
22970 <!--c0--><p>=a=</p>
22971
22972 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
22973 !! wikitext
22974 <!--c0--><nowiki>=a=</nowiki>
22975
22976 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
22977 !!end
22978
22979 !! test
22980 Headings: 6d. Heading chars in SOL context (No escaping needed)
22981 !! options
22982 parsoid=html2wt
22983 !! html/parsoid
22984 =a=<div>b</div>
22985 !! wikitext
22986 =a=<div>b</div>
22987 !!end
22988
22989 !! test
22990 Headings: 7. Insert a newline between new content and headings
22991 !! options
22992 parsoid=html2wt
22993 !! html/parsoid
22994 <h2>NEW</h2>
22995 <p>new</p>
22996 <h2 data-parsoid='{}'>A</h2>
22997 <p data-parsoid='{}'>a</p>
22998 !! wikitext
22999 == NEW ==
23000 new
23001
23002 ==A==
23003 a
23004
23005 !! end
23006
23007 #### --------------- Lists ---------------
23008 #### 0. Outside nests (*foo, etc.)
23009 #### 1. Nested inside html <ul><li>*foo</li></ul>
23010 #### 2. Inside definition lists
23011 #### 3. Only bullets at start should be escaped
23012 #### 4. No escapes needed
23013 #### 5. No unnecessary escapes
23014 #### 6. Escape bullets in SOL position
23015 #### 7. Escape bullets in a multi-line context
23016 #### ----------------------------------------
23017
23018 !! test
23019 Lists: 0. Outside nests
23020 !! options
23021 parsoid=html2wt
23022 !! html/parsoid
23023 <p>*foo</p>
23024
23025 <p>#foo</p>
23026
23027 <p>;Foo:bar</p>
23028 !! wikitext
23029 <nowiki>*</nowiki>foo
23030
23031 <nowiki>#</nowiki>foo
23032
23033 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
23034 !!end
23035
23036 ## Making these next 3 tests Parsoid-only since they are html2wt tests
23037 ## to test wikitext escaping, and insignificant whitespace diffs
23038 ## cause PHP parser tests to barf
23039 !! test
23040 Lists: 1. Nested inside html (No unnecessary escapes)
23041 !! options
23042 parsoid=html2wt
23043 !! html/parsoid
23044 <ul>
23045 <li>*foo</li>
23046 <li>#foo</li>
23047 <li>:foo</li>
23048 <li>;foo</li>
23049 <li data-parsoid='{}'>*foo</li>
23050 <li data-parsoid='{}'>#foo</li>
23051 <li data-parsoid='{}'>:foo</li>
23052 <li data-parsoid='{}'>;foo</li>
23053 </ul>
23054
23055 <ol>
23056 <li>*foo</li>
23057 <li>#foo</li>
23058 <li>:foo</li>
23059 <li>;foo</li>
23060 <li data-parsoid='{}'>*foo</li>
23061 <li data-parsoid='{}'>#foo</li>
23062 <li data-parsoid='{}'>:foo</li>
23063 <li data-parsoid='{}'>;foo</li>
23064 </ol>
23065 !! wikitext
23066 * *foo
23067 * #foo
23068 * :foo
23069 * ;foo
23070 *<nowiki>*foo</nowiki>
23071 *<nowiki>#foo</nowiki>
23072 *<nowiki>:foo</nowiki>
23073 *<nowiki>;foo</nowiki>
23074
23075 # *foo
23076 # #foo
23077 # :foo
23078 # ;foo
23079 #<nowiki>*foo</nowiki>
23080 #<nowiki>#foo</nowiki>
23081 #<nowiki>:foo</nowiki>
23082 #<nowiki>;foo</nowiki>
23083 !!end
23084
23085 !! test
23086 Lists: 2. Inside definition lists
23087 !! options
23088 parsoid=html2wt
23089 !! html/parsoid
23090 <dl><dt>;foo</dt></dl>
23091 <dl><dt>:foo</dt></dl>
23092 <dl><dt>:foo</dt>
23093 <dd>bar</dd></dl>
23094 <dl><dd>:foo</dd></dl>
23095 !! wikitext
23096 ; ;foo
23097
23098 ; <nowiki>:foo</nowiki>
23099
23100 ; <nowiki>:foo</nowiki>
23101 : bar
23102
23103 : :foo
23104 !!end
23105
23106 !! test
23107 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
23108 !! options
23109 parsoid=html2wt
23110 !! html/parsoid
23111 <ul>
23112 <li>*foo*bar</li>
23113 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
23114 </ul>
23115 !! wikitext
23116 * *foo*bar
23117 *<nowiki>*foo</nowiki>''it''*bar
23118 !!end
23119
23120 !! test
23121 Lists: 4. No escapes needed
23122 !! options
23123 parsoid=html2wt
23124 !! html/parsoid
23125 <ul>
23126 <li>foo*bar
23127 </li>
23128 </ul>
23129 <ul>
23130 <li><i>foo</i>*bar
23131 </li>
23132 </ul>
23133 <ul>
23134 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
23135 </li>
23136 </ul>
23137 <ul>
23138 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
23139 </li>
23140 </ul>
23141 !! wikitext
23142 *foo*bar
23143
23144 *''foo''*bar
23145
23146 *[[Foo]]: bar
23147
23148 *[[Foo]]*bar
23149 !!end
23150
23151 !! test
23152 Lists: 5. No unnecessary escapes
23153 !! options
23154 parsoid=html2wt
23155 !! html/parsoid
23156 <ul><li> bar <span>[[foo]]</span></li></ul>
23157 <ul><li> =bar <span>[[foo]]</span></li></ul>
23158 <ul><li> [[bar <span>[[foo]]</span></li></ul>
23159 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
23160 <ul><li> =bar <span>foo]]</span>=</li></ul>
23161 <ul><li> <s></s>: a</li></ul>
23162 <ul><li> <i>* foo</i></li></ul>
23163
23164 !! wikitext
23165 * bar <span><nowiki>[[foo]]</nowiki></span>
23166
23167 * =bar <span><nowiki>[[foo]]</nowiki></span>
23168
23169 * [[bar <span><nowiki>[[foo]]</nowiki></span>
23170
23171 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
23172
23173 * =bar <span>foo]]</span>=
23174
23175 * <s></s>: a
23176
23177 * ''* foo''
23178 !!end
23179
23180 !! test
23181 Lists: 6. Escape bullets in SOL position
23182 !! options
23183 parsoid=html2wt
23184 !! html/parsoid
23185 <p><!--cmt-->*foo</p>
23186 !! wikitext
23187 <!--cmt--><nowiki>*</nowiki>foo
23188 !!end
23189
23190 !! test
23191 Lists: 7. Escape bullets in a multi-line context
23192 !! options
23193 parsoid=html2wt
23194 !! html/parsoid
23195 <p>a
23196 *b
23197 </p>
23198 !! wikitext
23199 a
23200 <nowiki>*</nowiki>b
23201 !!end
23202
23203 !! test
23204 Lists: 8. Escape colons only if not present in tags
23205 !! options
23206 parsoid=html2wt
23207 !! html/parsoid
23208 <dl><dt>a:b<i>c:d</i></dt></dl>
23209 !! wikitext
23210 ; <nowiki>a:b</nowiki>''c:d''
23211 !! end
23212
23213 #### --------------- HRs ---------------
23214 #### 1. Single line
23215 #### -----------------------------------
23216
23217 !! test
23218 HRs: 1. Single line
23219 !! options
23220 parsoid=html2wt
23221 !! html/parsoid
23222 <hr />----
23223 <hr />=foo=
23224 <hr />*foo
23225 !! wikitext
23226 ----<nowiki>----</nowiki>
23227 ----=foo=
23228 ----*foo
23229 !! end
23230
23231 #### --------------- Tables ---------------
23232 #### 1a. Simple example
23233 #### 1b. No escaping needed (!foo)
23234 #### 1c. No escaping needed (|foo)
23235 #### 1d. No escaping needed (|}foo)
23236 ####
23237 #### 2a. Nested in td (<td>foo|bar</td>)
23238 #### 2b. Nested in td (<td>foo||bar</td>)
23239 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
23240 ####
23241 #### 3a. Nested in th (<th>foo!bar</th>)
23242 #### 3b. Nested in th (<th>foo!!bar</th>)
23243 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
23244 ####
23245 #### 4a. Escape -
23246 #### 4b. Escape +
23247 #### 4c. No escaping needed
23248 #### --------------------------------------
23249
23250 !! test
23251 Tables: 1a. Simple example
23252 !! options
23253 parsoid=html2wt
23254 !! html/parsoid
23255 <p>{|
23256 |}
23257 </p>
23258 !! wikitext
23259 <nowiki>{|</nowiki>
23260 |}
23261 !! end
23262
23263 !! test
23264 Tables: 1b. No escaping needed
23265 !! options
23266 parsoid=html2wt
23267 !! html/parsoid
23268 <p>!foo
23269 </p>
23270 !! wikitext
23271 !foo
23272 !! end
23273
23274 !! test
23275 Tables: 1c. No escaping needed
23276 !! options
23277 parsoid=html2wt
23278 !! html/parsoid
23279 <p>|foo
23280 </p>
23281 !! wikitext
23282 |foo
23283 !! end
23284
23285 !! test
23286 Tables: 1d. No escaping needed
23287 !! options
23288 parsoid=html2wt
23289 !! html/parsoid
23290 <p>|}foo
23291 </p>
23292 !! wikitext
23293 |}foo
23294 !! end
23295
23296 !! test
23297 Tables: 2a. Nested in td
23298 !! options
23299 parsoid=html2wt
23300 !! html/parsoid
23301 <table><tbody><tr>
23302 <td>foo|bar</td></tr>
23303 <tr><td>x<div>a|b</div></td>
23304 </tbody></table>
23305 !! wikitext
23306 {|
23307 |<nowiki>foo|bar</nowiki>
23308 |-
23309 |x<div><nowiki>a|b</nowiki></div>
23310 |}
23311 !! html/php+tidy
23312 <table>
23313 <tr>
23314 <td>foo|bar</td>
23315 </tr>
23316 <tr>
23317 <td>x
23318 <div>a|b</div>
23319 </td>
23320 </tr>
23321 </table>
23322 !! end
23323
23324 !! test
23325 Tables: 2b. Nested in td
23326 !! options
23327 parsoid=html2wt
23328 !! html/parsoid
23329 <table><tbody><tr>
23330 <td>foo||bar</td>
23331 <td>a<i>b||c</i></td>
23332 <td>a<i><div>b||c</div></i></td>
23333 </tr></tbody></table>
23334 !! wikitext
23335 {|
23336 |<nowiki>foo||bar</nowiki>
23337 |a''<nowiki>b||c</nowiki>''
23338 |a''<div><nowiki>b||c</nowiki></div>''
23339 |}
23340 !! html/php
23341 <table>
23342 <tr>
23343 <td>foo||bar
23344 </td>
23345 <td>a<i>b||c</i>
23346 </td>
23347 <td>a<i><div>b||c</div></i>
23348 </td></tr></table>
23349
23350 !! end
23351
23352 !! test
23353 Tables: 2c. Nested in td -- no escaping needed
23354 !! options
23355 parsoid=html2wt
23356 !! html/*
23357 <table>
23358 <tr>
23359 <td>foo!!bar
23360 </td></tr></table>
23361
23362 !! wikitext
23363 {|
23364 |foo!!bar
23365 |}
23366 !! end
23367
23368 !! test
23369 Tables: 3a. Nested in th
23370 !! options
23371 parsoid=html2wt
23372 !! html/*
23373 <table>
23374 <tr>
23375 <th>foo!bar
23376 </th></tr></table>
23377
23378 !! wikitext
23379 {|
23380 !foo!bar
23381 |}
23382 !! end
23383
23384 !! test
23385 Tables: 3b. Nested in th
23386 !! options
23387 parsoid=html2wt
23388 !! html/parsoid
23389 <table><tbody>
23390 <tr><th>foo!!bar</th>
23391 <th><i>foo|bar</i></th>
23392 <th><i>foo!!bar</i></th>
23393 <th><i><span>foo!!bar</span></i></th>
23394 </tr></tbody></table>
23395 !! wikitext
23396 {|
23397 !<nowiki>foo!!bar</nowiki>
23398 !''<nowiki>foo|bar</nowiki>''
23399 !''<nowiki>foo!!bar</nowiki>''
23400 !''<span><nowiki>foo!!bar</nowiki></span>''
23401 |}
23402 !! html/php
23403 <table>
23404 <tr>
23405 <th>foo!!bar
23406 </th>
23407 <th><i>foo|bar</i>
23408 </th>
23409 <th><i>foo!!bar</i>
23410 </th>
23411 <th><i><span>foo!!bar</span></i>
23412 </th></tr></table>
23413
23414 !! end
23415
23416 !! test
23417 Tables: 3c. Nested in th
23418 !! options
23419 parsoid=html2wt
23420 !! html/parsoid
23421 <table><tbody>
23422 <tr><th>foo||bar</th>
23423 <th><span typeof="mw:Nowiki">foo||bar</span></th>
23424 </tr></tbody></table>
23425 !! wikitext
23426 {|
23427 !<nowiki>foo||bar</nowiki>
23428 !<nowiki>foo||bar</nowiki>
23429 |}
23430 !! html/php
23431 <table>
23432 <tr>
23433 <th>foo||bar
23434 </th>
23435 <th>foo||bar
23436 </th></tr></table>
23437
23438 !! end
23439
23440 !! test
23441 Tables: 4a. Escape -
23442 !! options
23443 parsoid=html2wt
23444 !! html/*
23445 <table>
23446 <tr>
23447 <th>-bar
23448 </th></tr>
23449 <tr>
23450 <td>-bar
23451 </td></tr></table>
23452
23453 !! wikitext
23454 {|
23455 !-bar
23456 |-
23457 |<nowiki>-bar</nowiki>
23458 |}
23459 !! end
23460
23461 !! test
23462 Tables: 4b. Escape +
23463 !! options
23464 parsoid=html2wt
23465 !! html/*
23466 <table>
23467 <tr>
23468 <th>+bar
23469 </th></tr>
23470 <tr>
23471 <td>+bar
23472 </td></tr></table>
23473
23474 !! wikitext
23475 {|
23476 !+bar
23477 |-
23478 |<nowiki>+bar</nowiki>
23479 |}
23480 !! end
23481
23482 !! test
23483 Tables: 4c. No escaping needed
23484 !! options
23485 parsoid=html2wt
23486 !! html/parsoid
23487 <table><tbody>
23488 <tr><td>foo-bar</td><td>foo+bar</td></tr>
23489 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
23490 <tr><td>foo
23491 <p>bar|baz
23492 +bar
23493 -bar</p></td></tr>
23494 <tr><td>x
23495 <div>a|b</div></td>
23496 </tbody></table>
23497 !! wikitext
23498 {|
23499 |foo-bar
23500 |foo+bar
23501 |-
23502 |''foo''-bar
23503 |''foo''+bar
23504 |-
23505 |foo
23506 bar|baz
23507 +bar
23508 -bar
23509 |-
23510 |x
23511 <div>a|b</div>
23512 |}
23513 !! html/php
23514 <table>
23515 <tr>
23516 <td>foo-bar
23517 </td>
23518 <td>foo+bar
23519 </td></tr>
23520 <tr>
23521 <td><i>foo</i>-bar
23522 </td>
23523 <td><i>foo</i>+bar
23524 </td></tr>
23525 <tr>
23526 <td>foo
23527 <p>bar|baz
23528 +bar
23529 -bar
23530 </p>
23531 </td></tr>
23532 <tr>
23533 <td>x
23534 <div>a|b</div>
23535 </td></tr></table>
23536
23537 !! end
23538
23539 !! test
23540 Tables: 4d. No escaping needed
23541 !! options
23542 parsoid=html2wt
23543 !! html/parsoid
23544 <table>
23545 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
23546 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
23547 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
23548 </tbody></table>
23549 !! wikitext
23550 {|
23551 |[[Foo]]-bar
23552 ||+1
23553 ||-2
23554 |}
23555 !! html/php
23556 <table>
23557 <tr>
23558 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
23559 </td>
23560 <td>+1
23561 </td>
23562 <td>-2
23563 </td></tr></table>
23564
23565 !! end
23566
23567 !! test
23568 T97430: Don't emit empty nowiki pairs around marker meta tags
23569 !! options
23570 parsoid=html2wt
23571 !! html/parsoid
23572 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23573 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
23574 !! wikitext
23575 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23576 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
23577 !! end
23578
23579 !! test
23580 Unclosed xmlish element in table line shouldn't eat end delimiters
23581 !! options
23582 parsoid=html2wt
23583 !! html/parsoid
23584 <table>
23585 <tbody><tr><td> &lt;foo</td>
23586 <td> bar></td></tr>
23587 </tbody></table>
23588 !! wikitext
23589 {|
23590 | <foo
23591 | bar>
23592 |}
23593 !! html/php
23594 <table>
23595 <tr>
23596 <td> &lt;foo
23597 </td>
23598 <td> bar&gt;
23599 </td></tr></table>
23600
23601 !! end
23602
23603 #### --------------- Links ----------------
23604 #### 1. Quote marks in link text
23605 #### 2. Wikilinks: Escapes needed
23606 #### 3. Wikilinks: No escapes needed
23607 #### 4. Extlinks: Escapes needed
23608 #### 5. Extlinks: No escapes needed
23609 #### --------------------------------------
23610 !! test
23611 Links 1. WikiLinks: No escapes needed
23612 !! options
23613 parsoid=html2wt
23614 !! html/parsoid
23615 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
23616 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
23617 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
23618 !! wikitext
23619 [[Foo|Foo''boo'']]
23620 [[Foo|[Foobar]]]
23621 [[Foo|x [Foobar] x]]
23622 !! html/php
23623 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
23624 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
23625 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
23626 </p>
23627 !! end
23628
23629 !! test
23630 Links 2. WikiLinks: Escapes needed
23631 !! options
23632 parsoid=html2wt
23633 !! html/parsoid
23634 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
23635 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
23636 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
23637 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
23638 <a href="Foo" rel="mw:WikiLink">|Bar</a>
23639 <a href="Foo" rel="mw:WikiLink">]]bar</a>
23640 <a href="Foo" rel="mw:WikiLink">[[bar</a>
23641 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
23642 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
23643 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
23644 !! wikitext
23645 [[Foo|<nowiki>Foobar]</nowiki>]]
23646 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
23647 [[Foo|<nowiki>[[Bar]]</nowiki>]]
23648 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
23649 [[Foo|<nowiki>|Bar</nowiki>]]
23650 [[Foo|<nowiki>]]bar</nowiki>]]
23651 [[Foo|<nowiki>[[bar</nowiki>]]
23652 [[Foo|<nowiki>x [[ y</nowiki>]]
23653 [[Foo|<nowiki>x ]] y</nowiki>]]
23654 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
23655 !! html/php
23656 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
23657 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
23658 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
23659 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
23660 <a href="/wiki/Foo" title="Foo">|Bar</a>
23661 <a href="/wiki/Foo" title="Foo">]]bar</a>
23662 <a href="/wiki/Foo" title="Foo">[[bar</a>
23663 <a href="/wiki/Foo" title="Foo">x [[ y</a>
23664 <a href="/wiki/Foo" title="Foo">x ]] y</a>
23665 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
23666 </p>
23667 !! end
23668
23669 !! test
23670 Links 3. WikiLinks: No escapes needed
23671 !! options
23672 parsoid=html2wt
23673 !! html/parsoid
23674 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
23675 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
23676 !! wikitext
23677 [[Foo|[Foobar]]
23678 [[Foo|foo|bar]]
23679 !! html/php
23680 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
23681 <a href="/wiki/Foo" title="Foo">foo|bar</a>
23682 </p>
23683 !! end
23684
23685 !! test
23686 Links 4. ExtLinks: Escapes needed
23687 !! options
23688 parsoid=html2wt
23689 !! html/parsoid
23690 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
23691 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
23692 <p>[http://google.com]</p>
23693 <p>[http://google.com google]</p>
23694 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
23695 <p>[<a rel="mw:ExtLink" href="http://google.com" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://google.com"}},"i":0}}]}'>http://google.com</a>]</p>
23696 !! wikitext
23697 [http://google.com <nowiki>[google]</nowiki>]
23698 [http://google.com <nowiki>google]</nowiki>]
23699
23700 <nowiki>[http://google.com]</nowiki>
23701
23702 <nowiki>[http://google.com google]</nowiki>
23703
23704 [http://google.com<nowiki>]</nowiki>
23705
23706 [{{echo|http://google.com}}<nowiki>]</nowiki>
23707 !! html/php
23708 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
23709 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
23710 </p><p>[http://google.com]
23711 </p><p>[http://google.com google]
23712 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23713 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23714 </p>
23715 !! end
23716
23717 !! test
23718 Links 5. ExtLinks: No escapes needed
23719 !! options
23720 parsoid=html2wt
23721 !! html/parsoid
23722 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
23723 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
23724 !! wikitext
23725 [http://google.com [google]
23726
23727 [[http://google.com]]
23728 !! html/php
23729 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
23730 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
23731 </p>
23732 !! end
23733
23734 !! test
23735 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
23736 !! options
23737 parsoid=html2wt
23738 !! html/parsoid
23739 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
23740 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
23741 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
23742 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
23743 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
23744 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
23745 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23746 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
23747 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23748 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
23749 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
23750 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
23751 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
23752 </p>
23753 !! wikitext
23754 x<nowiki/>http://example.com<nowiki/>y
23755 http://example.com<nowiki/>?x
23756 http://example.com<nowiki/>&x
23757 http://example.com<nowiki/>'x
23758 http://example.com<nowiki/>,x
23759 http://example.com<nowiki/>.x
23760 http://example.com<nowiki/>;x
23761 http://example.com<nowiki/>:x
23762 http://example.com<nowiki/>;x
23763 http://example.com<nowiki/>!x
23764 http://example.com<nowiki/>=x
23765 http://example.com<nowiki/>(x)
23766 http://example.com(x<nowiki/>)
23767 !! end
23768
23769 !! test
23770 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23771 !! options
23772 parsoid=html2wt
23773 !! html/parsoid
23774 <p>x
23775 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
23776 y
23777 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
23778 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
23779 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
23780 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
23781 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
23782 </p>
23783 !! wikitext
23784 x
23785 http://example.com
23786 y
23787 "http://example.com"
23788 (http://example.com)
23789 (http://example.com) foo
23790 http://example.com,
23791 http://example.com, foo
23792 !! html/php
23793 <p>x
23794 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
23795 y
23796 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
23797 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
23798 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
23799 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
23800 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
23801 </p>
23802 !! end
23803
23804 !! test
23805 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23806 !! options
23807 parsoid=html2wt
23808 !! html/parsoid
23809 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
23810 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
23811 !! wikitext
23812 http://example.com.,;:!?\
23813 -http://example.com:
23814 !! html/php
23815 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
23816 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
23817 </p>
23818 !! end
23819
23820 !! test
23821 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
23822 !! options
23823 parsoid=html2wt
23824 !! html/parsoid
23825 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
23826 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
23827 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
23828 !! wikitext
23829 RFC 123<nowiki/>4
23830 RFC 123<nowiki/>y
23831 X<nowiki/>RFC 123<nowiki/>y
23832 !! end
23833
23834 !! test
23835 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
23836 !! options
23837 parsoid=html2wt
23838 !! html/parsoid
23839 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
23840 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
23841 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
23842 </p>
23843 !! wikitext
23844 RFC 123?foo
23845 RFC 123&foo
23846 -RFC 123-
23847 !! html/php
23848 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
23849 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
23850 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
23851 </p>
23852 !! end
23853
23854 !! test
23855 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
23856 !! options
23857 parsoid=html2wt
23858 !! html/parsoid
23859 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
23860 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23861 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23862 !! wikitext
23863 PMID 123<nowiki/>4
23864 PMID 123<nowiki/>y
23865 X<nowiki/>PMID 123<nowiki/>y
23866 !! end
23867
23868 !! test
23869 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
23870 !! options
23871 parsoid=html2wt
23872 !! html/parsoid
23873 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
23874 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
23875 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
23876 </p>
23877 !! wikitext
23878 PMID 123?foo
23879 PMID 123&foo
23880 -PMID 123-
23881 !! html/php
23882 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
23883 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
23884 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
23885 </p>
23886 !! end
23887
23888 !! test
23889 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
23890 !! options
23891 parsoid=html2wt
23892 !! html/parsoid
23893 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
23894 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
23895 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
23896 </p>
23897 !! wikitext
23898 ISBN 1234567890<nowiki/>1
23899 ISBN 1234567890<nowiki/>x
23900 a<nowiki/>ISBN 1234567890<nowiki/>b
23901 !! end
23902
23903 !! test
23904 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
23905 !! options
23906 parsoid=html2wt
23907 !! html/parsoid
23908 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
23909 !! wikitext
23910 -ISBN 1234567890's
23911 !! html/php
23912 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
23913 </p>
23914 !! end
23915
23916 !! test
23917 Links 14. Protect link-like plain text. (Parsoid bug T78425)
23918 !! options
23919 parsoid=html2wt
23920 !! html/*
23921 <p>this is not a link: http://example.com
23922 </p>
23923 !! wikitext
23924 this is not a link: <nowiki>http://example.com</nowiki>
23925 !! end
23926
23927 !! test
23928 Links 15. Link trails can't become link prefixes.
23929 !! options
23930 language=is
23931 parsoid=html2wt
23932 !! html/parsoid
23933 <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>
23934 !! wikitext
23935 [[Söfnuður]]-[[00]]
23936 !! html/php
23937 <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>
23938 </p>
23939 !! end
23940
23941 #### --------------- Quotes ---------------
23942 #### 1. Quotes inside <b> and <i>
23943 #### 2. Link fragments separated by <i> and <b> tags
23944 #### 3. Link fragments inside <i> and <b>
23945 #### 4. No escaping needed
23946 #### --------------------------------------
23947 !! test
23948 1a. Quotes inside <b> and <i>
23949 !! options
23950 parsoid=html2wt
23951 !! html/*
23952 <p><i>'foo'</i>
23953 <i>''foo''</i>
23954 <i>'''foo'''</i>
23955 <i>foo</i>'s
23956 <b>'foo'</b>
23957 <b>''foo''</b>
23958 <b>'''foo'''</b>
23959 <b>foo'<i>bar'</i>baz</b>
23960 <b>foo</b>'s
23961 '<i>foo</i>
23962 <i>foo</i>'
23963 <i>foo'</i>'
23964 '<i>foo</i>'
23965 '<b>foo</b>
23966 <b>foo</b>'
23967 '<b>foo</b>'
23968 <i>fools'<span> errand</span></i>
23969 <i><span>fool</span>'s errand</i>
23970 '<i>foo</i> bar '<i>baz</i>
23971 a|!*#-:;+-~[]{}b'<i>x</i>
23972 </p>
23973 !! wikitext
23974 ''<nowiki/>'foo'''
23975 ''<nowiki>''foo''</nowiki>''
23976 ''<nowiki>'''foo'''</nowiki>''
23977 ''foo''<nowiki/>'s
23978 '''<nowiki/>'foo''''
23979 '''<nowiki>''foo''</nowiki>'''
23980 '''<nowiki>'''foo'''</nowiki>'''
23981 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
23982 '''foo'''<nowiki/>'s
23983 '''foo''
23984 ''foo''<nowiki/>'
23985 ''foo'''<nowiki/>'
23986 '''foo''<nowiki/>'
23987 ''''foo'''
23988 '''foo'''<nowiki/>'
23989 ''''foo'''<nowiki/>'
23990 ''fools'<span> errand</span>''
23991 ''<span>fool</span>'s errand''
23992 '<nowiki/>''foo'' bar '''baz''
23993 a|!*#-:;+-~[]{}b'''x''
23994 !! end
23995
23996 !! test
23997 1b. Quotes inside <b> and <i> with other tags on same line
23998 !! options
23999 parsoid=html2wt
24000 !! html/parsoid
24001 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24002 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24003 <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>
24004 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
24005 '<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>
24006 '<i>foo</i> <div title="name">test</div>
24007 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
24008 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
24009 <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>
24010 </ol>
24011 !! wikitext
24012 '''a'' foo ''[[bar]]''
24013 ''a''' foo ''[[bar]]''
24014 ''a''' foo '''{{echo|[[bar]]}}'''
24015 [[foo]] x'''[[bar]]''
24016 '''foo'' <ref>test</ref>
24017 '''foo'' <div title="name">test</div>
24018 '''foo'' and <br> bar
24019 <references />
24020 !! end
24021
24022 !! test
24023 2. Link fragments separated by <i> and <b> tags
24024 !! options
24025 parsoid=html2wt
24026 !! html/parsoid
24027 <p>[[<i>foo</i>hello]]</p>
24028 <p>[[<b>foo</b>hello]]</p>
24029 !! wikitext
24030 [[''foo''<nowiki>hello]]</nowiki>
24031
24032 [['''foo'''<nowiki>hello]]</nowiki>
24033 !! end
24034
24035 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
24036 # this is one of the shortcomings of this format
24037 !! test
24038 3. Link fragments inside <i> and <b>
24039 !! options
24040 parsoid=html2wt
24041 !! html/parsoid
24042 <p><i>[[foo</i>]]</p>
24043 <p><b>[[foo</b>]]</p>
24044 !! wikitext
24045 ''[[foo''<nowiki>]]</nowiki>
24046
24047 '''[[foo'''<nowiki>]]</nowiki>
24048 !! end
24049
24050 !! test
24051 4. No escaping needed
24052 !! options
24053 options=html2wt
24054 !! html/parsoid
24055 <p>'<span><i>bar</i></span>'
24056 '<span><b>bar</b></span>'
24057 'a:b'foo
24058 </p>
24059 !! wikitext
24060 '<span>''bar''</span>'
24061 '<span>'''bar'''</span>'
24062 'a:b'foo
24063 !! end
24064
24065 #### ----------- Paragraphs ---------------
24066 #### 1. No unnecessary escapes
24067 #### --------------------------------------
24068
24069 !! test
24070 1. No unnecessary escapes
24071 !! options
24072 parsoid=html2wt
24073 !! html/parsoid
24074 <p>bar <span>[[foo]]</span>
24075 </p><p>=bar <span>[[foo]]</span>
24076 </p><p>[[bar <span>[[foo]]</span>
24077 </p><p>]]bar <span>[[foo]]</span>
24078 </p><p>=bar <span>foo]]</span>=
24079 </p>
24080 !! wikitext
24081 bar <span><nowiki>[[foo]]</nowiki></span>
24082
24083 =bar <span><nowiki>[[foo]]</nowiki></span>
24084
24085 [[bar <span><nowiki>[[foo]]</nowiki></span>
24086
24087 ]]bar <span><nowiki>[[foo]]</nowiki></span>
24088
24089 =bar <span>foo]]</span><nowiki>=</nowiki>
24090 !!end
24091
24092 #### ----------------------- PRE --------------------------
24093 #### 1. Leading whitespace in SOL context should be escaped
24094 #### ------------------------------------------------------
24095 !! test
24096 1. Leading whitespace in SOL context should be escaped
24097 !! options
24098 parsoid=html2wt
24099 !! html/parsoid
24100 <p> a</p>
24101
24102 <p> a</p>
24103
24104 <p> a(tab)</p>
24105
24106 <p> a
24107 <!--cmt-->
24108 a</p>
24109
24110 <p>a
24111 b</p>
24112
24113 <p>a
24114 b</p>
24115
24116 <p>a
24117 b</p>
24118 !! wikitext
24119 <nowiki> </nowiki>a
24120
24121 <nowiki> </nowiki> a
24122
24123 a(tab)
24124
24125 <nowiki> </nowiki> a
24126 <!--cmt-->
24127 <nowiki> </nowiki>a
24128
24129 a
24130 <nowiki> </nowiki>b
24131
24132 a
24133 b
24134
24135 a
24136 b
24137 !! html/php
24138 <p> a
24139 </p><p> a
24140 </p><p> a(tab)
24141 </p><p> a
24142 a
24143 </p><p>a
24144 b
24145 </p><p>a
24146 b
24147 </p><p>a
24148 b
24149 </p>
24150 !! end
24151
24152 !! test
24153 2. Leading whitespace in non-indent-pre contexts should not be escaped
24154 !! options
24155 parsoid=html2wt
24156 !! html/parsoid
24157 <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>
24158 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
24159 <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>a</i>
24160 b</span></li>
24161 </ol>
24162 !! wikitext
24163 foo <ref>''a''
24164 b</ref>
24165 <references />
24166 !! end
24167
24168 !! test
24169 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
24170 !! options
24171 parsoid=html2wt
24172 !! html/parsoid
24173 <blockquote>
24174 <p>
24175 a
24176 <span>b</span>
24177 c</p>
24178 </blockquote>
24179 !! wikitext
24180 <blockquote>
24181 a
24182 <span>b</span>
24183 c
24184 </blockquote>
24185 !! end
24186
24187 !! test
24188 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
24189 !! options
24190 options=html2wt
24191 !! html/parsoid
24192 <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>
24193 !! wikitext
24194 [[File:Foobar.jpg|thumb|caption]]
24195 !! end
24196
24197 !! test
24198 5. Nowiki escaping should account for indent-pres
24199 !! options
24200 parsoid=html2wt
24201 !! html/parsoid
24202 <pre>==foo==</pre>
24203 !! wikitext
24204 ==foo==
24205 !! end
24206
24207 !!test
24208 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
24209 !! options
24210 parsoid=html2wt
24211 !! html/parsoid
24212 <pre>
24213 * foo
24214 * bar
24215 </pre>
24216 !! wikitext
24217 * foo
24218 * bar
24219 !! end
24220
24221 #### --------------- Behavior Switches --------------------
24222
24223 !! test
24224 1. Valid behavior switches should be escaped
24225 !! options
24226 parsoid=html2wt
24227 !! html/parsoid
24228 __TOC__
24229 <i>__TOC__</i>
24230 !! wikitext
24231 <nowiki>__TOC__</nowiki>
24232 ''<nowiki>__TOC__</nowiki>''
24233 !! end
24234
24235 !! test
24236 2. Invalid behavior switches should not be escaped
24237 !! options
24238 parsoid=html2wt
24239 !! html/parsoid
24240 __TOO__
24241 __|__
24242 !! wikitext
24243 __TOO__
24244 __|__
24245 !! end
24246
24247 # We use indent-pre as an indirect way to test for sol-transparent behavior.
24248 !! test
24249 Behavior switches should be SOL-transparent
24250 !! options
24251 parsoid=html2wt
24252 !! html/parsoid
24253 <meta property="mw:PageProp/toc" />
24254
24255 <!-- this one's bogus -->
24256 <pre>__TOO__</pre>
24257
24258 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
24259
24260 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
24261 !! wikitext
24262 __TOC__
24263
24264 <!-- this one's bogus -->
24265 __TOO__
24266
24267 __TOC__ foo
24268
24269 __TOC__
24270 bar
24271 !! end
24272
24273 #### --------------- HTML tags ---------------
24274 #### 1. a tags
24275 #### 2. other tags
24276 #### 3. multi-line html tag
24277 #### 4. extension tags
24278 #### -----------------------------------------
24279 !! test
24280 1. a tags
24281 !! options
24282 parsoid=html2wt
24283 !! html/parsoid
24284 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
24285 !! wikitext
24286 <a href="http://google.com">google</a>
24287 !! end
24288
24289 !! test
24290 2. other tags
24291 !! options
24292 parsoid=html2wt
24293 !! html/parsoid
24294 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
24295 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
24296 <li> &lt;td&gt;</li></ul>
24297
24298 !! wikitext
24299 * <nowiki><div>foo</div></nowiki>
24300 * <nowiki><div style="color:red">foo</div></nowiki>
24301 * <nowiki><td></nowiki>
24302 !! end
24303
24304 !! test
24305 3. multi-line html tag
24306 !! options
24307 parsoid=html2wt
24308 !! html/parsoid
24309 <p>&lt;div
24310 &gt;foo&lt;/div
24311 &gt;
24312 </p>
24313 !! wikitext
24314 <nowiki><div
24315 >foo</div
24316 ></nowiki>
24317 !! end
24318
24319 !! test
24320 4. extension tags
24321 !! options
24322 parsoid=html2wt
24323 !! html/parsoid
24324 <p>&lt;ref&gt;foo&lt;/ref&gt;
24325 </p><p>&lt;ref&gt;bar
24326 </p><p>baz&lt;/ref&gt;
24327 </p>
24328 !! wikitext
24329 <nowiki><ref>foo</ref></nowiki>
24330
24331 <nowiki><ref>bar</nowiki>
24332
24333 baz<nowiki></ref></nowiki>
24334 !! end
24335
24336 #### --------------- Others ---------------
24337 !! test
24338 Escaping nowikis
24339 !! options
24340 parsoid=html2wt
24341 !! html/parsoid
24342 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
24343 </p>
24344 !! wikitext
24345 &lt;nowiki&gt;foo&lt;/nowiki&gt;
24346 !! end
24347
24348 ## The quote-char in the input is necessary for triggering the bug
24349 !! test
24350 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
24351 !! options
24352 parsoid=html2wt
24353 !! html/parsoid
24354 <p>foo's bar :</p>
24355 !! wikitext
24356 foo's bar :
24357 !! end
24358
24359 #----------- End of wikitext escaping tests --------------
24360
24361 !! test
24362
24363 Tag-like HTML structures are passed through as text
24364 !! wikitext
24365 <x y>
24366
24367 <x.y>
24368
24369 <x-y>
24370
24371 1>2
24372
24373 x<y
24374
24375 a>b
24376
24377 1<d e>f
24378 !! html
24379 <p>&lt;x y&gt;
24380 </p><p>&lt;x.y&gt;
24381 </p><p>&lt;x-y&gt;
24382 </p><p>1&gt;2
24383 </p><p>x&lt;y
24384 </p><p>a&gt;b
24385 </p><p>1&lt;d e&gt;f
24386 </p>
24387 !! end
24388
24389 !! test
24390 HTML tag with necessary entities in attributes
24391 !! wikitext
24392 <span title="&amp;amp;">foo</span>
24393 !! html
24394 <p><span title="&amp;amp;">foo</span>
24395 </p>
24396 !! end
24397
24398 !! test
24399 HTML tag with 'unnecessary' entity encoding in attributes
24400 !! wikitext
24401 <span title="&amp;">foo</span>
24402 !! html
24403 <p><span title="&amp;">foo</span>
24404 </p>
24405 !! end
24406
24407 !! test
24408 HTML tag with broken attribute value quoting
24409 !! options
24410 parsoid=wt2html,html2html
24411 !! wikitext
24412 <span title="Hello world>Foo</span>
24413 !! html/php
24414 <p><span title="Hello world">Foo</span>
24415 </p>
24416 !! html/parsoid
24417 <p><span title="Hello world">Foo</span></p>
24418 !! end
24419
24420 !! test
24421 Self-closed tag with broken attribute value quoting
24422 !! options
24423 parsoid=wt2html,html2html
24424 !! wikitext
24425 <div title="Hello world />Foo
24426 !! html/php+tidy
24427 <div title="Hello world"></div>
24428 <p>Foo</p>
24429 !! html/parsoid
24430 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
24431 !! end
24432
24433 !! test
24434 Table with broken attribute value quoting
24435 !! options
24436 parsoid=wt2html,html2html
24437 !! wikitext
24438 {|
24439 | title="Hello world|Foo
24440 |}
24441 !! html/php
24442 <table>
24443 <tr>
24444 <td title="Hello world">Foo
24445 </td></tr></table>
24446
24447 !! html/parsoid
24448 <table>
24449 <tr>
24450 <td title="Hello world">Foo
24451 </td></tr></table>
24452
24453 !! end
24454
24455 !! test
24456 Table with broken attribute value quoting on consecutive lines
24457 !! options
24458 parsoid=wt2html,html2html
24459 !! wikitext
24460 {|
24461 | title="Hello world|Foo
24462 | style="color:red|Bar
24463 |}
24464 !! html/php
24465 <table>
24466 <tr>
24467 <td title="Hello world">Foo
24468 </td>
24469 <td style="color:red">Bar
24470 </td></tr></table>
24471
24472 !! html/parsoid
24473 <table><tbody>
24474 <tr>
24475 <td title="Hello world">Foo
24476 </td><td style="color: red">Bar
24477 </td></tr></tbody></table>
24478
24479 !! end
24480
24481 !!test
24482 Accept empty td cell attribute
24483 !! wikitext
24484 {|
24485 | align="center" | foo || |
24486 |}
24487 !! html
24488 <table>
24489 <tr>
24490 <td align="center"> foo </td>
24491 <td>
24492 </td></tr></table>
24493
24494 !!end
24495
24496 !!test
24497 Non-empty attributes in th-cells
24498 !! wikitext
24499 {|
24500 ! Foo !! style="color: red" | Bar
24501 |}
24502 !! html
24503 <table>
24504 <tr>
24505 <th> Foo </th>
24506 <th style="color: red"> Bar
24507 </th></tr></table>
24508
24509 !!end
24510
24511 !!test
24512 Accept empty attributes in th-cells
24513 !! wikitext
24514 {|
24515 !| foo !!| bar
24516 |}
24517 !! html
24518 <table>
24519 <tr>
24520 <th> foo </th>
24521 <th> bar
24522 </th></tr></table>
24523
24524 !!end
24525
24526 !!test
24527 Empty table rows go away
24528 !! wikitext
24529 {|
24530 | Hello
24531 | there
24532 |- class="foo"
24533 |-
24534 |}
24535 !! html
24536 <table>
24537 <tr>
24538 <td> Hello
24539 </td>
24540 <td> there
24541 </td></tr>
24542
24543 </table>
24544
24545 !! end
24546
24547 ###
24548 ### Parsoid-centric tests for testing RTing of inter-element separators
24549 ### Edge cases not tested by existing parser tests and specific to
24550 ### Parsoid-specific serialization strategies.
24551 ###
24552
24553 !!test
24554 RT-ed inter-element separators should be valid separators
24555 !! wikitext
24556 {|
24557 |- [[foo]]
24558 |}
24559 !! html/php
24560 <table>
24561
24562 </table>
24563
24564 !! html/parsoid
24565 <table>
24566 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
24567 </tbody></table>
24568 !!end
24569
24570 # Parsoid-only since PHP parser relies on Tidy for correct output
24571 !!test
24572 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
24573 !!options
24574 parsoid
24575 !! wikitext
24576 {|
24577 |<small>foo
24578 bar
24579 |}
24580
24581 {|
24582 |<small>foo<small>
24583 |}
24584 !! html
24585 <table>
24586 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
24587 <p>bar</p></small></td></tr>
24588 </tbody></table>
24589
24590 <table>
24591 <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>
24592 </tbody></table>
24593 !!end
24594
24595 # Note that the "style" attribute is really a template parameter here.
24596 # The = would have to be {{=}} if you wanted the literal.
24597 !!test
24598 Empty TD followed by TD with tpl-generated attribute
24599 !! wikitext
24600 {|
24601 |-
24602 |
24603 |{{echo|style='color:red'}}|foo
24604 |}
24605 !! html
24606 <table>
24607
24608 <tr>
24609 <td>
24610 </td>
24611 <td>foo
24612 </td></tr></table>
24613
24614 !!end
24615
24616 !!test
24617 Indented table with an empty td
24618 !! wikitext
24619 {|
24620 |-
24621 |
24622 |foo
24623 |}
24624 !! html
24625 <table>
24626
24627 <tr>
24628 <td>
24629 </td>
24630 <td>foo
24631 </td></tr></table>
24632
24633 !!end
24634
24635 ## We have some newline diffs RT-ing this edge case
24636 ## and it is not important enough -- we seem to be emitting
24637 ## at most 2 newlines after a </tr> and this is unrelated to
24638 ## the issue from T85627 that this is testing.
24639 !!test
24640 Indented table with blank lines in between (T85627)
24641 !! options
24642 parsoid=wt2html
24643 !! wikitext
24644 {|
24645 |foo
24646
24647
24648 |}
24649 !! html
24650 <table>
24651
24652 <tr>
24653 <td>foo
24654 </td></tr></table>
24655
24656 !!end
24657
24658 !!test
24659 Indented block & table
24660 !! wikitext
24661 <div>foo</div>
24662 {|
24663 |foo
24664 |}
24665 !! html/php
24666 <div>foo</div>
24667 <table>
24668 <tr>
24669 <td>foo
24670 </td></tr></table>
24671
24672 !! html/parsoid
24673 <div data-parsoid='{"stx":"html"}'>foo</div>
24674 <table><tbody>
24675 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
24676 </tbody></table>
24677 !!end
24678
24679 !! test
24680 Indent and comment before table row
24681 !! wikitext
24682 {|
24683 <!--hi-->|-
24684 | there
24685 |}
24686 !! html/php
24687 <table>
24688
24689 <tr>
24690 <td> there
24691 </td></tr></table>
24692
24693 !! html/parsoid
24694 <table>
24695 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
24696 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
24697 </tbody></table>
24698 !! end
24699
24700 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
24701 !!test
24702 Empty TR followed by a template-generated TR
24703 !!options
24704 parsoid
24705 !! wikitext
24706 {|
24707 |-
24708 {{echo|<tr><td>foo</td></tr>}}
24709 |}
24710 !! html
24711 <table>
24712 <tbody>
24713 <tr></tr>
24714 <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}}]}'>
24715 <td>foo</td></tr>
24716 </tbody></table>
24717 !!end
24718
24719 ## PHP and parsoid output differ for this, and since this is primarily
24720 ## for testing Parsoid's serializer, marking this Parsoid only
24721 !!test
24722 Empty TR followed by mixed-ws-comment line should RT correctly
24723 !!options
24724 parsoid
24725 !! wikitext
24726 {|
24727 |-
24728 <!--c-->
24729 |-
24730 <!--c--> <!--d-->
24731 |}
24732 !! html
24733 <table>
24734 <tbody>
24735 <tr></tr>
24736 <!--c-->
24737 <tr>
24738 <!--c--> </tr><!--d-->
24739 </tbody></table>
24740
24741 !!end
24742
24743 !!test
24744 Multi-line image caption generated by templates with/without trailing newlines
24745 !! wikitext
24746 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
24747 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
24748 !! html/parsoid
24749 <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>
24750 <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>
24751 !!end
24752
24753 !! test
24754 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
24755 !! options
24756 parsoid=html2wt
24757 !! html/parsoid
24758 <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>
24759
24760 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
24761 !! wikitext
24762 <includeonly>foo</includeonly>
24763 new para
24764
24765 [[Category:Foo]]
24766
24767 = new heading =
24768 !! end
24769
24770 ## PHP emits broken html for this, and since this is primarily
24771 ## a Parsoid serializer test, marking this Parsoid only
24772 !!test
24773 Improperly nested inline or quotes tags with whitespace in between
24774 !! wikitext
24775 <span> <s>x</span> </s>
24776 ''' ''x''' ''
24777 !! html/parsoid
24778 <p><span> <s>x</s></span><s> </s>
24779 <b> <i>x</i></b><i> </i>
24780 </p>
24781 !!end
24782
24783 !!test
24784 Encapsulate protected attributes from wt
24785 !! wikitext
24786 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
24787 !! html/parsoid
24788 <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>
24789 </body>
24790 !!end
24791
24792 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
24793 ## Having nested or stray pre tags results in the attempt to add duplicates,
24794 ## causing an assertion fail. This test tries to prevent that situation.
24795 !!test
24796 Ensure ParagraphWrapper can deal with stray closing pre tags
24797 !!options
24798 parsoid=wt2html
24799 !! wikitext
24800 plain text</pre>
24801 !! html/parsoid
24802 plain text
24803 !!end
24804
24805 !!test
24806 1. Ensure fostered text content is wrapped in element nodes
24807 !!options
24808 parsoid=wt2html
24809 !! wikitext
24810 <table>hi</table><table>ho</table>
24811 !! html/parsoid
24812 <p>hi</p>
24813 <table></table>
24814 <p>ho</p>
24815 <table></table>
24816 !!end
24817
24818 !!test
24819 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
24820 !!options
24821 parsoid=wt2html,wt2wt
24822 !! wikitext
24823 <table>
24824 <tr> || ||
24825 <td> a
24826 </table>
24827 !! html/parsoid
24828 <p> || ||
24829 </p><table>
24830 <tbody><tr><td> a</td></tr>
24831 </tbody></table>
24832 !!end
24833
24834 !!test
24835 Encapsulation properly handles null DSR information from foster box
24836 !!options
24837 parsoid=wt2html,wt2wt
24838 !! wikitext
24839 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
24840 !! html/parsoid
24841 <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>
24842 !!end
24843
24844 !!test
24845 1. Encapsulate foster-parented transclusion content
24846 !!options
24847 parsoid=wt2wt,wt2html
24848 !! wikitext
24849 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
24850 !! html/parsoid
24851 <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>
24852 <tbody>
24853 <tr>
24854 <td>bar</td>
24855 </tr>
24856 </tbody>
24857 </table>
24858 !!end
24859
24860 !!test
24861 2. Encapsulate foster-parented transclusion content
24862 !!options
24863 parsoid=wt2wt,wt2html
24864 !! wikitext
24865 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
24866 !! html/parsoid
24867 <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>
24868 <table>
24869 <tbody>
24870 <tr>
24871 <td>bar</td>
24872 </tr>
24873 </tbody>
24874 </table>
24875 !!end
24876
24877 !!test
24878 3. Encapsulate foster-parented transclusion content
24879 !!options
24880 parsoid=wt2wt,wt2html
24881 !! wikitext
24882 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24883 !! html/parsoid
24884 <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;]}">
24885 <p>foo</p>
24886 </div>
24887 <table>
24888 <tbody>
24889 <tr>
24890 <td>bar</td>
24891 </tr>
24892 </tbody>
24893 </table>
24894 !!end
24895
24896 !!test
24897 4. Encapsulate foster-parented transclusion content
24898 !!options
24899 parsoid=wt2wt,wt2html
24900 !! wikitext
24901 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24902 !! html/parsoid
24903 <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;]}">
24904 <p>foo</p>
24905 </div>
24906 <table>
24907 <tbody>
24908 <tr>
24909 <td>bar</td>
24910 </tr>
24911 </tbody>
24912 </table>
24913 !!end
24914
24915 !!test
24916 5. Encapsulate foster-parented transclusion content
24917 !!options
24918 parsoid=wt2wt,wt2html
24919 !! wikitext
24920 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
24921 !! html/parsoid
24922 <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>
24923 <table>
24924 <tbody>
24925 <tr>
24926 <td>
24927 <div>
24928 <p>foo</p>
24929 </div>
24930 </td>
24931 </tr>
24932 </tbody>
24933 </table>
24934 !!end
24935
24936 !!test
24937 6. Encapsulate foster-parented transclusion content
24938 !!options
24939 parsoid=wt2wt,wt2html
24940 !! wikitext
24941 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
24942 !! html/parsoid
24943 <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>
24944 <table>
24945 <tbody>
24946 <tr>
24947 <td>
24948 <div>
24949 <p>foo</p>
24950 </div>
24951 </td>
24952 </tr>
24953 </tbody>
24954 </table>
24955 <p>ok</p>
24956 !!end
24957
24958 !!test
24959 7. Encapsulate foster-parented transclusion content
24960 !!options
24961 parsoid=wt2wt,wt2html
24962 !! wikitext
24963 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
24964 !! html/parsoid
24965 <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>
24966 <table>
24967 <tbody>
24968 <tr>
24969 <td>bar</td>
24970 </tr>
24971 </tbody>
24972 </table>
24973 !!end
24974
24975 # Note that the wt is broken on purpose: the = should be {{=}} if you
24976 # don't want it to be a template parameter key.
24977 !!test
24978 8. Encapsulate foster-parented transclusion content
24979 !!options
24980 parsoid=wt2wt,wt2html
24981 !! wikitext
24982 {{echo|a
24983 }}{|{{echo|style='color:red'}}
24984 |-
24985 |b
24986 |}
24987 !! html/parsoid
24988 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
24989 <span> </span>
24990 <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>
24991 <table>
24992 <tbody>
24993 <tr>
24994 <td>b</td>
24995 </tr>
24996 </tbody>
24997 </table>
24998 !!end
24999
25000 !!test
25001 9. Encapsulate foster-parented transclusion content
25002 !!options
25003 parsoid=wt2wt,wt2html
25004 !! wikitext
25005 <table>{{echo|hi</table>hello}}
25006 !! html/parsoid
25007 <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"}]]}'>hi</p><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><p about="#mwt2">hello</p>
25008 !!end
25009
25010 !!test
25011 Table in fosterable position
25012 !!options
25013 parsoid=wt2html
25014 !! wikitext
25015 {{OpenTable}}
25016 <div>
25017 {|
25018 |}
25019 </div>
25020 |}
25021 !! html/parsoid
25022 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"OpenTable","href":"./Template:OpenTable"},"params":{},"i":0}},"\n&lt;div>\n"]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[]]}'></div><span about="#mwt1">
25023 </span>
25024 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
25025
25026 <table>
25027 </table>
25028 !!end
25029
25030 # Parsoid only for bug 64747
25031 !! test
25032 Properly encapsulate empty-content transclusions in fosterable positions
25033 !! wikitext
25034 <table>
25035 {{#if:|
25036 <td>foo</td>
25037 }}
25038 </table>
25039 !! html/parsoid
25040 <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"}]]}'>
25041
25042 </table>
25043 !! end
25044
25045 !! test
25046 Always encapsulate foster box when template range is expanded to table
25047 !! options
25048 parsoid=wt2wt
25049 !! wikitext
25050 {|
25051 hello
25052 {{OpenTable}}
25053 |}
25054 !! html/parsoid
25055
25056 !! end
25057
25058 !! test
25059 T115289: Unclosed table
25060 !! wikitext
25061 {{echo|<table>}}<!--c-->[[Category:Two]]
25062 !! html/parsoid
25063 <link rel="mw:PageProp/Category" href="./Category:Two" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"simple","a":{"href":"./Category:Two"},"sa":{"href":"Category:Two"},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;table>"}},"i":0}},"&lt;!--c-->[[Category:Two]]"]}'/><table about="#mwt1" data-parsoid='{"stx":"html","autoInsertedEnd":true}'><!--c--></table>
25064 !! end
25065
25066 !! test
25067 T115289: Don't migrate newlines out of tables with fostered content
25068 !! wikitext
25069 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
25070 !! html/parsoid
25071 <link rel="mw:PageProp/Category" href="./Category:One" about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"stx":"simple","a":{"href":"./Category:One"},"sa":{"href":"Category:One"},"fostered":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":["&lt;table>&lt;td>&lt;/td>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;tr>[[Category:One]]"}},"i":0}},"&lt;!--c-->[[Category:Two]]"]}'/><link rel="mw:PageProp/Category" href="./Category:Two" about="#mwt2"/><table about="#mwt2" data-parsoid='{"stx":"html","autoInsertedEnd":true}'><tbody><tr><td></td></tr><tr><!--c--></tr></tbody></table>
25072 !! end
25073
25074 !! test
25075 T73074: More fostering fun
25076 !! wikitext
25077 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
25078 !! html/parsoid
25079 <link rel="mw:PageProp/Category" href="./Category:Two" data-parsoid='{"stx":"simple","a":{"href":"./Category:Two"},"sa":{"href":"Category:Two"},"fostered":true}'/><table data-parsoid='{"stx":"html","autoInsertedEnd":true}'><tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"stx":"html"}'></td></tr><tr about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;tr>"}},"i":0}},"&lt;!--c-->[[Category:Two]]"]}'><!--c--></tr></tbody></table>
25080 !! end
25081
25082 !!test
25083 Support <object> element with .data attribute
25084 !!options
25085 parsoid=html2wt
25086 !! html/parsoid
25087 <object data="test.swf"></object>
25088 !! wikitext
25089 <object data="test.swf"></object>
25090 !!end
25091
25092 !! test
25093 Don't block XML namespace declaration
25094 !! wikitext
25095 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25096 !! html/php
25097 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25098 </p>
25099 !! html/parsoid
25100 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
25101 !! end
25102
25103 # -----------------------------------------------------------------
25104 # The following section of tests are primarily to spec requirements
25105 # around Parsoid's serialization (old, new, edited content)
25106 #
25107 # All these tests are marked Parsoid html2wt and html2html only
25108 # ----------------------------------------------------------------
25109
25110 !! test
25111 Ignore rel attribute in a-tags during serialization to url-links
25112 !! options
25113 parsoid=html2wt
25114 !! html/parsoid
25115 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
25116 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
25117 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
25118 !! wikitext
25119 http://en.wikipedia.org/wiki/Foobar
25120 http://en.wikipedia.org/wiki/Foobar
25121 http://en.wikipedia.org/wiki/Foobar
25122 !! end
25123
25124 # 'mi' is a localinterwiki prefix as well as a language
25125 !! test
25126 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
25127 !! options
25128 parsoid=html2wt
25129 !! html/parsoid
25130 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
25131 !! wikitext
25132 [[Foo]]
25133 !! end
25134
25135 # See T93839
25136 !! test
25137 New wikilinks should be serialized properly
25138 !! options
25139 parsoid=html2wt
25140 !! html/parsoid
25141 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
25142 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
25143 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
25144 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
25145 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
25146 !! wikitext
25147 [[Foo]]
25148 [[Foo]]
25149 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
25150 http://en.wikipedia.org/wiki/Foo
25151 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
25152 !! end
25153
25154 !! test
25155 New wiki links (href variations)
25156 !! options
25157 parsoid=html2wt
25158 !! html/parsoid
25159 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25160 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
25161 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
25162 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
25163 !! wikitext
25164 [[Foo_bar]]
25165 [[Foo_bar]]
25166 [[Foo_bar]]
25167 [[Toxine bactérienne]]
25168 !! end
25169
25170 !! test
25171 New wiki links (content string variations)
25172 !! options
25173 parsoid=html2wt
25174 !! html/parsoid
25175 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25176 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
25177 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
25178 !! wikitext
25179 [[Foo_bar]]
25180 [[Foo bar]]
25181 [[Foo_bar|./Foo_bar]]
25182 !! end
25183
25184 !! test
25185 New category links (href variations)
25186 !! options
25187 parsoid=html2wt
25188 !! html/parsoid
25189 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
25190 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
25191 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
25192 !! wikitext
25193 [[Category:Toxine bactérienne]]
25194 [[Category:Toxine bactérienne]]
25195 [[Category:Toxine bactérienne]]
25196 !! end
25197
25198 !! test
25199 New sol transparent links don't need indent-pre nowiki protection
25200 !! options
25201 parsoid=html2wt
25202 language=de
25203 !! html/parsoid
25204 <link rel="mw:PageProp/redirect" href="./Main_Page">
25205 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
25206 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
25207 !! wikitext
25208 #WEITERLEITUNG [[Main Page]]
25209 <!-- this is good --> [[Category:Good]]
25210 <!-- this is great --> [[Kategorie:Great]]
25211 !! end
25212
25213 !! test
25214 New interlanguage links (href variations)
25215 !! options
25216 parsoid=html2wt
25217 !! html/parsoid
25218 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
25219 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
25220 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
25221 !! wikitext
25222 [[es:Toxine bactérienne]]
25223 [[es:Toxine_bactérienne]]
25224 [[es:Toxine_bactérienne]]
25225 !! end
25226
25227 !! test
25228 Image: Modifying size of an image (1)
25229 !! options
25230 parsoid={
25231 "modes": ["wt2wt"],
25232 "changes": [
25233 ["img[height]", "attr", "height", "22"],
25234 ["img[width]", "attr", "width", "200"]
25235 ]
25236 }
25237 !! wikitext
25238 [[Image:Foobar.jpg|230x230px]]
25239 !! wikitext/edited
25240 [[Image:Foobar.jpg|200x200px]]
25241 !!end
25242
25243 !! test
25244 Image: Modifying size of an image (2)
25245 !! options
25246 parsoid={
25247 "modes": ["wt2wt"],
25248 "changes": [
25249 ["img[height]", "attr", "height", "100"],
25250 ["img[width]", "attr", "width", "500"]
25251 ]
25252 }
25253 !! wikitext
25254 [[Image:Foobar.jpg|230x230px]]
25255 !! wikitext/edited
25256 [[Image:Foobar.jpg|500x500px]]
25257 !!end
25258
25259 # Change in size is ignored so long as class='mw-default-size'
25260 !! test
25261 Image: Modifying size of an image (3)
25262 !! options
25263 parsoid={
25264 "modes": ["wt2wt"],
25265 "changes": [
25266 ["figure[class]", "removeClass", "mw-default-size"],
25267 ["figure img", "attr", "height", "19"],
25268 ["figure img", "attr", "width", "170"]
25269 ]
25270 }
25271 !! wikitext
25272 [[Image:Foobar.jpg|thumb]]
25273 !! wikitext/edited
25274 [[Image:Foobar.jpg|thumb|170x170px]]
25275 !!end
25276
25277 !! test
25278 Image: Modifying alignment of an image (bug 48665)
25279 !! options
25280 parsoid={
25281 "modes": ["wt2wt"],
25282 "changes": [
25283 ["figure[class]", "removeClass", "mw-halign-right"],
25284 ["figure[class]", "addClass", "mw-halign-left"]
25285 ]
25286 }
25287 !! wikitext
25288 [[Image:Foobar.jpg|thumb|caption|right]]
25289 !! wikitext/edited
25290 [[Image:Foobar.jpg|thumb|caption|left]]
25291 !! end
25292
25293 !! test
25294 Image: Modifying mw-default-size of an frameless image (bug 62805)
25295 !! options
25296 parsoid={
25297 "modes": ["wt2wt"],
25298 "changes": [
25299 ["figure.mw-default-size", "removeClass", "mw-default-size"]
25300 ]
25301 }
25302 !! wikitext
25303 [[Image:Foobar.jpg|frameless|right]]
25304 !! wikitext/edited
25305 [[Image:Foobar.jpg|frameless|right|220x220px]]
25306 !! end
25307
25308 !! test
25309 Image: Modifying valign of an image (bug 49221)
25310 !! options
25311 parsoid={
25312 "modes": ["wt2wt"],
25313 "changes": [
25314 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
25315 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
25316 ]
25317 }
25318 !! wikitext
25319 [[File:Foobar.jpg|20px|middle]]
25320 !! wikitext/edited
25321 [[File:Foobar.jpg|20px|text-top]]
25322 !! end
25323
25324 !! test
25325 Image: Modifying alt attribute of an image (bug 56400)
25326 !! options
25327 parsoid={
25328 "modes": ["wt2wt"],
25329 "changes": [
25330 ["img[alt]", "attr", "alt", "some alternate edited text"]
25331 ]
25332 }
25333 !! wikitext
25334 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
25335 !! wikitext/edited
25336 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
25337 !!end
25338
25339 !! test
25340 Image: Modifying caption of an image
25341 !! options
25342 parsoid={
25343 "modes": ["wt2wt"],
25344 "changes": [
25345 ["figcaption", "text", "new caption"]
25346 ]
25347 }
25348 !! wikitext
25349 [[Image:Foobar.jpg|thumb|original caption]]
25350 !! wikitext/edited
25351 [[Image:Foobar.jpg|thumb|new caption]]
25352 !!end
25353
25354 !! test
25355 Image: empty alt attribute (bug 48924)
25356 !! options
25357 parsoid
25358 !! wikitext
25359 [[File:Foobar.jpg|thumb|alt=|bar]]
25360 !! html
25361 <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>
25362 !! end
25363
25364 !! test
25365 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
25366 !! options
25367 parsoid=html2wt
25368 language=ar
25369 disabled
25370 !! html/parsoid
25371 <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>
25372 !! wikitext
25373 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
25374 !! end
25375
25376 !! test
25377 Image: Block level image should have \n before and after
25378 !! wikitext
25379 123
25380 [[File:Foobar.jpg|right|thumb|150x150px]]
25381 456
25382 !! html/parsoid
25383 <p>123</p>
25384 <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>
25385 <p>456</p>
25386 !!end
25387
25388 !! test
25389 Image: New block level image should have \n before and after (existing content)
25390 !! wikitext
25391 123
25392 [[File:Foobar.jpg|right|thumb|150x150px]]
25393 456
25394 !! html/parsoid
25395 <p>123</p>
25396 <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>
25397 <p>456</p>
25398 !!end
25399
25400 !! test
25401 Image: upright option (parsoid)
25402 !! wikitext
25403 [[File:Foobar.jpg|thumb|upright|caption]]
25404 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
25405 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
25406 !! html/parsoid
25407 <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>
25408 <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>
25409 <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>
25410 !!end
25411
25412 !! test
25413 Image: upright option is ignored on inline and frame images (parsoid)
25414 !! wikitext
25415 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
25416 !! html/parsoid
25417 <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>
25418 !!end
25419
25420 !! test
25421 Image: from basic HTML (1)
25422 !! options
25423 parsoid=html2wt
25424 !! html/parsoid
25425 <span typeof="mw:Image">
25426 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25427 </span>
25428 !! wikitext
25429 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25430 !! end
25431
25432 !! test
25433 Image: from basic HTML (2)
25434 !! options
25435 parsoid=html2wt
25436 !! html/parsoid
25437 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25438 !! wikitext
25439 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25440 !! end
25441
25442 !! test
25443 Image: from basic HTML (3)
25444 !! options
25445 parsoid=html2wt
25446 !! html/parsoid
25447 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
25448 !! wikitext
25449 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
25450 !! end
25451
25452 !! test
25453 Image: from basic HTML (4)
25454 !! options
25455 parsoid=html2wt
25456 !! html/parsoid
25457 <img src="./File:Foobar.jpg">
25458 !! wikitext
25459 [[File:Foobar.jpg|link=]]
25460 !! end
25461
25462 !! test
25463 Image: Invalid title as link
25464 !! wikitext
25465 [[File:Foobar.jpg|link=<]]
25466 !! html/php
25467 <p><a href="/wiki/File:Foobar.jpg" class="image" title="link=&lt;"><img alt="link=&lt;" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
25468 </p>
25469 !! html/parsoid
25470 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"link","ak":"link=&lt;"}]}' data-mw='{"caption":"link=&amp;lt;"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
25471 !! end
25472
25473 !! test
25474 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
25475 !! options
25476 parsoid=html2wt
25477 !! html/parsoid
25478 <ul>
25479 <li><p>foo</p></li>
25480 </ul>
25481 !! wikitext
25482 * foo
25483 !! end
25484
25485 !! test
25486 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
25487 !! options
25488 parsoid=html2wt
25489 !! html/parsoid
25490 <ul> <li>foo</li></ul>
25491 !! wikitext
25492 * foo
25493 !! end
25494
25495 !! test
25496 Don't strip leading whitespace when handling indent-pre suppressing tags
25497 !! options
25498 parsoid=html2wt
25499 !! html/parsoid
25500 <table>
25501 <tr><td> indented row</td></tr>
25502 </table>
25503 <blockquote><p>
25504 <b>This is very bold of you!</b>
25505 </p>
25506 <table><tr><td>
25507 indented cell (no pre-wrapping!)
25508 </td></tr></table>
25509 </blockquote>
25510 <p>foo</p>
25511 <div>bar</div>
25512 !! wikitext
25513 {|
25514 | indented row
25515 |}
25516 <blockquote>
25517 '''This is very bold of you!'''
25518
25519 {|
25520 |
25521 indented cell (no pre-wrapping!)
25522 |}
25523 </blockquote>
25524 foo
25525 <div>bar</div>
25526 !! end
25527
25528 !! test
25529 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
25530 !! options
25531 parsoid=html2wt
25532 !! html/parsoid
25533 <p>foo</p>
25534 <span>bar</span>
25535
25536 <span>foo2
25537 </span>bar2
25538
25539 <div>foo</div>
25540 <span>bar</span>
25541
25542 <div>
25543 <span>foo</span>
25544 </div>
25545 !! wikitext
25546 foo
25547
25548 <span>bar</span>
25549
25550 <span>foo2
25551 <nowiki> </nowiki></span>bar2
25552
25553 <div>foo</div>
25554 <nowiki> </nowiki><span>bar</span>
25555
25556 <div>
25557 <nowiki> </nowiki><span>foo</span>
25558 </div>
25559 !! end
25560
25561 !! test
25562 Lists: Dont insert newlines in a serialized list item.
25563 !! options
25564 parsoid=html2wt
25565 !! html/parsoid
25566 <ul><li>a<br>b</li><li>c</li></ul>
25567 !! wikitext
25568 * a<br>b
25569 * c
25570 !! end
25571
25572 !! test
25573 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
25574 !! options
25575 parsoid={
25576 "modes": ["html2wt"],
25577 "scrubWikitext": false
25578 }
25579 !! html/parsoid
25580 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25581 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25582
25583 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25584 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25585
25586 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
25587
25588 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25589 !! wikitext
25590 == hello there [[Category:A1]] ==
25591
25592 == [[Category:A2]] hi pal ==
25593
25594 == <!--foo--> [[Category:A3]] how goes it ==
25595
25596 == it goes well [[Category:A4]] <!--bar--> ==
25597
25598 ==howdy [[Category:A5]]==
25599
25600 == __TOC__ ok ==
25601 !! end
25602
25603 !! test
25604 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
25605 !! options
25606 parsoid={
25607 "modes": ["html2wt"],
25608 "scrubWikitext": true
25609 }
25610 !! html/parsoid
25611 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25612 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25613
25614 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25615 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25616
25617 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25618 !! wikitext
25619 == hello there ==
25620 [[Category:A1]]
25621 [[Category:A2]]
25622
25623 == hi pal ==
25624
25625 <!--foo--> [[Category:A3]]
25626
25627 == how goes it ==
25628
25629 == it goes well ==
25630 [[Category:A4]] <!--bar-->
25631
25632 __TOC__
25633
25634 == ok ==
25635 !! end
25636
25637 !! test
25638 Headings: Don't hoist metas that come from templates
25639 !! options
25640 parsoid={
25641 "modes": ["html2wt"],
25642 "scrubWikitext": true
25643 }
25644 !! html/parsoid
25645 <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>
25646 !! wikitext
25647 == {{echo|foo [[Category:Foo]]}} ==
25648 !! end
25649
25650 !! test
25651 Headings: Category in ref isn't hoisted
25652 !! options
25653 parsoid={
25654 "modes": ["html2wt"],
25655 "scrubWikitext": true
25656 }
25657 !! html/parsoid
25658 <h2> foo <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> </h2>
25659
25660 <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>
25661 !! wikitext
25662 == foo <ref>bar
25663 [[Category:Baz]] </ref> ==
25664
25665 <references />
25666 !! end
25667
25668 !! test
25669 Parsoid: Serialize positional parameters with = in them as named parameter
25670 !! options
25671 parsoid=html2wt
25672 !! html/parsoid
25673 <p about="#mwt1" typeof="mw:Transclusion"
25674 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
25675
25676 <p about="#mwt1" typeof="mw:Transclusion"
25677 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
25678
25679 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25680 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25681 <p data-parsoid='{"pi":[[{"k":"1"},{"k":"2"}]]}' 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>
25682 !! wikitext
25683 {{echo|1=f=oo}}
25684
25685 {{echo|1=f=oo|2=bar}}
25686
25687 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25688 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25689 {{echo|<nowiki>f=oo</nowiki>|bar}}
25690 !! end
25691
25692 !! test
25693 Parsoid: Serialize positional parameters with = in extlink as named parameter
25694 !! options
25695 parsoid=html2wt
25696 !! html/parsoid
25697 <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>
25698 !! wikitext
25699 {{echo|1=http://stuff?is=ok}}
25700 !! end
25701
25702 !! test
25703 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
25704 !! options
25705 parsoid=html2wt
25706 !! html/parsoid
25707 <div>a<p>b</p></div>
25708 <div>a
25709 <p>b</p></div>
25710 <div>
25711 a
25712 <p>b</p></div>
25713 !! wikitext
25714 <div>a
25715 b
25716 </div>
25717 <div>a
25718 b
25719 </div>
25720 <div>
25721 a
25722
25723 b
25724 </div>
25725 !! end
25726
25727 !! test
25728 Substrings resembling wikitext in hrefs should not get nowiki escapes
25729 !! options
25730 parsoid=html2wt
25731 !! html/parsoid
25732 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
25733 !! wikitext
25734 [[Foo''bar''baz]]
25735 !! end
25736
25737 !! test
25738 Enforce single-line context in the serializer
25739 !! options
25740 parsoid=html2wt
25741 !! html/parsoid
25742 <h2>testing
25743 123</h2>
25744
25745 <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">
25746 </span><span about="#mwt1">you</span> </h2>
25747
25748 <h2> foo <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> </h2>
25749
25750 <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
25751 there</span></li></ol>
25752
25753 <ul><li>asd
25754 sdf</li></ul>
25755
25756 <ul><li>foo
25757 bar
25758 baz</li>
25759 <li>foo <b>bar</b>
25760 baz</li></ul>
25761
25762 <dl><dt>hi
25763 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
25764 ho</dd></dl>
25765
25766 <dl><dd> <table>
25767 <tbody><tr><td> ha
25768 ha
25769 ha</td></tr>
25770 </tbody></table></dd></dl>
25771 !! wikitext
25772 == testing 123 ==
25773
25774 == hi {{bogus|there
25775 you}} ==
25776
25777 == foo <ref>hello
25778 there</ref> ==
25779
25780 <references />
25781
25782 * asd sdf
25783
25784 * foo bar baz
25785 * foo '''bar''' baz
25786
25787 ; hi ho : hi ho
25788
25789 : {|
25790 | ha
25791 ha
25792 ha
25793 |}
25794 !! end
25795
25796 !! test
25797 Serialize new placeholder space without spans
25798 !! options
25799 parsoid=html2wt
25800 !! html/parsoid
25801 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
25802
25803 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
25804
25805 <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>
25806 !! wikitext
25807 foo : bar
25808
25809 foo : bar
25810
25811 <ref>foo : bar</ref>ok
25812 !! end
25813
25814
25815 #-----------------------
25816 # Tag minimization tests
25817 #-----------------------
25818
25819 !! test
25820 1. I/B quote minimization: wikitext-only tags should be combined
25821 !! options
25822 parsoid=html2wt
25823 !! html/parsoid
25824 <p><i>A</i><i>B</i></p>
25825 <p><b>A</b><b>B</b></p>
25826 <p><i>A</i><b><i>B</i></b></p>
25827 <p><b>A</b><i><b>B</b></i></p>
25828 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
25829 <p><i><b>A</b></i><i><b>B</b></i></p>
25830 <p><i><b>A</b></i><b><i>B</i></b></p>
25831 <p><b><i>A</i></b><i><b>B</b></i></p>
25832 !! wikitext
25833 ''AB''
25834
25835 '''AB'''
25836
25837 ''A'''B'''''
25838
25839 '''A''B'''''
25840
25841 '''A''BC''D'''
25842
25843 '''''AB'''''
25844
25845 '''''AB'''''
25846
25847 '''''AB'''''
25848 !! end
25849
25850 !! test
25851 2. I/B quote minimization: wikitext and html tags should not be combined
25852 !! options
25853 parsoid=html2wt
25854 !! html/parsoid
25855 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
25856 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
25857 !! wikitext
25858 ''A''<i>B</i>
25859
25860 ''A''<nowiki/>'''<i>B</i>'''
25861 !! end
25862
25863 !! test
25864 3. I/B quote minimization: templated content stops minimization
25865 !! options
25866 parsoid=html2wt
25867 !! html/parsoid
25868 <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>
25869 <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>
25870 !! wikitext
25871 ''A''{{echo|''B''}}
25872
25873 ''A''{{echo|'''''B'''''}}
25874 !! end
25875
25876 !! test
25877 4. I/B quote minimization: new content should be mimimized with adjacent old content
25878 !! options
25879 parsoid=html2wt
25880 !! html/parsoid
25881 <p><i>A</i><i>B</i></p>
25882 <p><b>A</b><b>B</b></p>
25883 <p><i>A</i><b><i>B</i></b></p>
25884 !! wikitext
25885 ''AB''
25886
25887 '''AB'''
25888
25889 ''A'''B'''''
25890 !! end
25891
25892 !! test
25893 5a. Merge adjacent quote nodes if they've been edited
25894 !! options
25895 parsoid={
25896 "modes": ["wt2wt", "selser"],
25897 "changes": [
25898 ["p", "contents", "remove", ":contains('b')"]
25899 ]
25900 }
25901 !! wikitext
25902 ''a''b''c''
25903 !! wikitext/edited
25904 ''ac''
25905 !! end
25906
25907 !! test
25908 5b. Merge adjacent quote nodes if they've been edited
25909 !! options
25910 parsoid={
25911 "modes": ["wt2wt", "selser"],
25912 "changes": [
25913 ["#x", "remove"]
25914 ]
25915 }
25916 !! wikitext
25917 ''a''<span id="x">b</span>''c''
25918 !! wikitext/edited
25919 ''ac''
25920 !! end
25921
25922 !! test
25923 1. Merge adjacent link nodes as long as at least one element is new
25924 !! options
25925 parsoid={
25926 "modes": ["html2wt"],
25927 "scrubWikitext": true
25928 }
25929 !! html/parsoid
25930 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25931 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25932 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
25933 !! wikitext
25934 [[Football]]
25935 [[Football]]
25936 [[Football|Foot]][[Football|ball]]
25937 !! end
25938
25939 !! test
25940 2. Merge adjacent link nodes and enable additional normalizations
25941 !! options
25942 parsoid={
25943 "modes": ["html2wt"],
25944 "scrubWikitext": true
25945 }
25946 !! html/parsoid
25947 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
25948 !! wikitext
25949 [[Football|''Football'']]
25950 !! end
25951
25952 !! test
25953 3. Don't merge adjacent link nodes if scrubWikitext is false
25954 !! options
25955 parsoid={
25956 "modes": ["html2wt"],
25957 "scrubWikitext": false
25958 }
25959 !! html/parsoid
25960 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25961 !! wikitext
25962 [[Football|Foot]][[Football|ball]]
25963 !! end
25964
25965 #------------------------------
25966 # End of tag minimization tests
25967 #------------------------------
25968
25969 !!test
25970 Bug 54262: New entities
25971 !! options
25972 parsoid=html2wt
25973 !! html/parsoid
25974 <span typeof="mw:Entity">&nbsp;</span>
25975 !! wikitext
25976 &nbsp;
25977 !! end
25978
25979 ## Note that there is no wikitext output for 'unknownproperty' ##
25980 ## Unknown magic words are silently dropped ##
25981
25982 !! test
25983 Magic words
25984 !! options
25985 parsoid=html2wt
25986 !! html/parsoid
25987 <meta property='mw:PageProp/toc' />
25988 <meta property='mw:PageProp/notoc' />
25989 <meta property='mw:PageProp/forcetoc' />
25990 <meta property='mw:PageProp/index' />
25991 <meta property='mw:PageProp/noindex' />
25992 <meta property='mw:PageProp/nogallery' />
25993 <meta property='mw:PageProp/noeditsection' />
25994 <meta property='mw:PageProp/notitleconvert' />
25995 <meta property='mw:PageProp/nocontentconvert' />
25996 <meta property='mw:PageProp/unknownproperty' />
25997 !! wikitext
25998 __TOC__
25999 __NOTOC__
26000 __FORCETOC__
26001 __INDEX__
26002 __NOINDEX__
26003 __NOGALLERY__
26004 __NOEDITSECTION__
26005 __NOTITLECONVERT__
26006 __NOCONTENTCONVERT__
26007 !! end
26008
26009 !! test
26010 Consecutive <pre>s should not get merged
26011 !! options
26012 parsoid=html2wt,html2html
26013 !! html/parsoid
26014 <pre>a</pre><pre>b</pre>
26015
26016 <pre>c
26017 </pre><pre>
26018 d</pre>
26019
26020 <pre>e
26021
26022 </pre><pre>
26023
26024 f</pre>
26025 !! wikitext
26026 a
26027
26028 b
26029
26030 c
26031
26032 d
26033
26034 e
26035
26036
26037
26038 f
26039 !! end
26040
26041 !! test
26042 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
26043 !! options
26044 parsoid=html2wt
26045 !! html/parsoid
26046 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
26047 !! wikitext
26048 [[Special:BookSources/1234567890|ISBN 1234567895]]
26049 !! end
26050
26051 !! test
26052 Edited RFC links not serializable as RFC links should serialize as extlinks
26053 !! options
26054 parsoid=html2wt
26055 !! html/parsoid
26056 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
26057 !! wikitext
26058 [//tools.ietf.org/html/rfc123 New RFC]
26059 !! end
26060
26061 !! test
26062 Edited PMID links not serializable as PMID links should serialize as extlinks
26063 !! options
26064 parsoid=html2wt
26065 !! html/parsoid
26066 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
26067 !! wikitext
26068 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
26069 !! end
26070
26071 !! test
26072 WTS of autolinks with trailing/surrounding context
26073 !! options
26074 parsoid=html2wt
26075 !! html/parsoid
26076 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
26077 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
26078 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
26079 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
26080 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
26081 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
26082 !! wikitext
26083 http://cscott.net'''foo'''
26084
26085 http://cscott.net<b>foo</b>
26086
26087 '''http://cscott.net'''
26088
26089 '''http://cscott.net '''
26090
26091 '''http://cscott.net<nowiki/>x'''
26092
26093 http://cscott.net<nowiki/>x
26094 !! end
26095
26096 !! test
26097 WTS of autolinks with nowikis (round-trip)
26098 !! wikitext
26099 x<nowiki/>http://cscott.net<nowiki/>x
26100 !! html/parsoid
26101 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
26102 !! end
26103
26104 # this is the "easy" test because it leaves in place all the
26105 # data-parsoid information indicating this is an autolink
26106 !! test
26107 WTS of autolinks with escapes (editing)
26108 !! options
26109 parsoid={
26110 "modes": ["wt2wt"],
26111 "changes": [
26112 [ "meta", "remove" ]
26113 ]
26114 }
26115 !! wikitext
26116 x<nowiki/>http://cscott.net<nowiki/>x
26117 !! wikitext/edited
26118 x<nowiki/>http://cscott.net<nowiki/>x
26119 !! end
26120
26121 !! test
26122 WTS of edited autolink-like text (T103364)
26123 !! options
26124 parsoid={
26125 "modes": ["wt2wt"],
26126 "changes": [
26127 [ "span[typeof]", "removeAttr", "typeof" ]
26128 ]
26129 }
26130 !! wikitext
26131 Not a link: <nowiki>http://example.com</nowiki>.
26132 !! wikitext/edited
26133 Not a link: <span><nowiki>http://example.com</nowiki></span>.
26134 !! end
26135
26136 !! test
26137 WTS of newly-authored autolink-like text (T103364)
26138 !! options
26139 parsoid=html2wt
26140 !! html/parsoid
26141 <p>http://example.com is not a link.</p>
26142 !! wikitext
26143 <nowiki>http://example.com</nowiki> is not a link.
26144 !! end
26145
26146 !! test
26147 WTS of autolink-like text after an autolink (T108563)
26148 !! options
26149 parsoid=html2wt
26150 !! html/parsoid
26151 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
26152 !! wikitext
26153 http://example.com <nowiki>http://example.com</nowiki> is not a link.
26154 !! end
26155
26156 !! test
26157 Magic links inside links (not autolinked)
26158 !! wikitext
26159 [[Foo|http://example.com]]
26160 [[Foo|RFC 1234]]
26161 [[Foo|PMID 1234]]
26162 [[Foo|ISBN 123456789x]]
26163
26164 [http://foo.com http://example.com]
26165 [http://foo.com RFC 1234]
26166 [http://foo.com PMID 1234]
26167 [http://foo.com ISBN 123456789x]
26168 !! html+tidy
26169 <p><a href="/wiki/Foo" title="Foo">http://example.com</a> <a href="/wiki/Foo" title="Foo">RFC 1234</a> <a href="/wiki/Foo" title="Foo">PMID 1234</a> <a href="/wiki/Foo" title="Foo">ISBN 123456789x</a></p>
26170 <p><a rel="nofollow" class="external text" href="http://foo.com">http://example.com</a> <a rel="nofollow" class="external text" href="http://foo.com">RFC 1234</a> <a rel="nofollow" class="external text" href="http://foo.com">PMID 1234</a> <a rel="nofollow" class="external text" href="http://foo.com">ISBN 123456789x</a></p>
26171 !! html/parsoid
26172 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
26173 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
26174 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
26175 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
26176
26177 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
26178 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
26179 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
26180 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
26181 !! end
26182
26183 !! test
26184 Magic links inside image captions (autolinked)
26185 !! wikitext
26186 [[File:Foobar.jpg|thumb|http://example.com]]
26187 [[File:Foobar.jpg|thumb|RFC 1234]]
26188 [[File:Foobar.jpg|thumb|PMID 1234]]
26189 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
26190 !! html+tidy
26191 <div class="thumb tright">
26192 <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>
26193 <div class="thumbcaption">
26194 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26195 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
26196 </div>
26197 </div>
26198 <div class="thumb tright">
26199 <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>
26200 <div class="thumbcaption">
26201 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26202 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
26203 </div>
26204 </div>
26205 <div class="thumb tright">
26206 <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>
26207 <div class="thumbcaption">
26208 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26209 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
26210 </div>
26211 </div>
26212 <div class="thumb tright">
26213 <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>
26214 <div class="thumbcaption">
26215 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26216 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
26217 </div>
26218 </div>
26219 !! html/parsoid
26220 <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>
26221 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="//tools.ietf.org/html/rfc1234" rel="mw:ExtLink">RFC 1234</a></figcaption></figure>
26222 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></figcaption></figure>
26223 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="./Special:BookSources/123456789X" rel="mw:WikiLink">ISBN 123456789x</a></figcaption></figure>
26224 !! end
26225
26226 !! test
26227 WTS of magic word text (T109371)
26228 !! options
26229 parsoid=html2wt
26230 !! html/parsoid
26231 <p>RFC 1234</p>
26232 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
26233 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
26234 !! wikitext
26235 <nowiki>RFC 1234</nowiki>
26236
26237 [http://foo.com RFC 1234]
26238
26239 [[Foo|RFC 1234]]
26240 !! end
26241
26242 !! test
26243 Edited Redirect link should emit a non-piped wikitext link
26244 !! options
26245 parsoid=html2wt
26246 !! html/parsoid
26247 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
26248 !! wikitext
26249 #REDIRECT [[Bar]]
26250 !! end
26251
26252 !! test
26253 T75121: Infer extension name from typeOf if data-mw is not present
26254 !! options
26255 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26256 !! html/parsoid
26257 <div typeOf="mw:Extension/foo"></div>
26258 !! wikitext
26259 <foo />
26260 !! end
26261
26262 # Note that the <p> wrapping isn't present in PHP parser output
26263 # The important thing for this test is that P-wrapping doesn't
26264 # interfere with the <nowiki> protection for leading - in <td>
26265 # (which isn't necessary for <th>).
26266 !! test
26267 T88318: p-wrapped dash in table.
26268 !! options
26269 parsoid=html2wt,wt2wt
26270 !! html/parsoid
26271 <table><tbody>
26272 <tr><th><p>-</p></th><th><p>- </p></th></tr>
26273 <tr><td><p>-</p></td><td><p>- </p></td></tr>
26274 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
26275 </tbody></table>
26276 !! wikitext
26277 {|
26278 !-
26279 !-
26280 |-
26281 |<nowiki>-</nowiki>
26282 |<nowiki>- </nowiki>
26283 |-
26284 |<small>-</small>
26285 |<br>
26286 -
26287 |<br>
26288 -
26289 |}
26290 !! html/php+tidy
26291 <table>
26292 <tr>
26293 <th>-</th>
26294 <th>-</th>
26295 </tr>
26296 <tr>
26297 <td>-</td>
26298 <td>-</td>
26299 </tr>
26300 <tr>
26301 <td><small>-</small></td>
26302 <td><br />
26303 <p>-</p>
26304 </td>
26305 <td><br />
26306 <p>-</p>
26307 </td>
26308 </tr>
26309 </table>
26310 !! end
26311
26312 !! test
26313 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
26314 !! options
26315 parsoid=html2wt
26316 !! html/parsoid
26317 <table id='mwAb'>
26318 <td id='mwAc'>foo</td>
26319 <td id='serialize-this'>bar</td>
26320 </table>
26321 !! wikitext
26322 {|
26323 |foo
26324 | id="serialize-this" |bar
26325 |}
26326 !! end
26327
26328 !! test
26329 Parsoid-like element ids should not be serialized to wikitext unless shadowed
26330 !! options
26331 parsoid=html2wt
26332 !! html/parsoid
26333 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
26334 !! wikitext
26335 <div id="hello">ok</div>
26336 !! end
26337
26338 !! test
26339 WTS change modes
26340 !! options
26341 parsoid={
26342 "modes": ["wt2wt"],
26343 "changes": [
26344 [ "#xyz", "before", "<b>before</b> stuff " ],
26345 [ "#xyz", "after", " stuff <i>after</i>" ],
26346 [ "#xyz", "html", "x <b>y</b> z" ]
26347 ]
26348 }
26349 !! wikitext
26350 <span id="xyz">hello</span>
26351 !! wikitext/edited
26352 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
26353 !! end
26354
26355 !! test
26356 Never serialize a-tag as html, regardless of what data-parsoid has to say
26357 !! options
26358 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26359 !! html/parsoid
26360 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
26361 !! wikitext
26362 [[Foo]]
26363 !! end
26364
26365 ## SSS FIXME: This is broken output nevertheless.
26366 ## What might be a reasonable non-broken output for this?
26367 ## This is an edge case unlikely to be seen in production
26368 ## that I am not wasting more time on this right now.
26369 !! test
26370 Never serialize a-tag as html, no matter what attributes it has
26371 !! options
26372 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26373 !! html/parsoid
26374 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
26375 !! wikitext
26376 [http://boo.org http://boohoo.org]
26377 !! end
26378
26379 # Misnested is an indication that selser can reuse the source but these have
26380 # shown to sneak through on occasion. See T101768.
26381 # The original wikitext here is: [http://test.com [[one]] two three]
26382 !! test
26383 Strip span tags added to mark misnested links
26384 !! options
26385 parsoid=html2wt
26386 !! html/parsoid
26387 <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>
26388 !! wikitext
26389 [http://test.com][[one]] two three
26390 !! end
26391
26392 !! test
26393 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
26394 !! options
26395 parsoid=html2wt
26396 !! html/parsoid
26397 <span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}}]}'>a</span><table about="#mwt2" typeof="mw:Transclusion mw:ExpandedAttrs" data-parsoid='{"a":{"{{echo|c\n{{!}}d\n}}":null},"sa":{"{{echo|c\n{{!}}d\n}}":""},"firstWikitextNode":"table","pi":[[{"k":"1"}]]}' data-mw='{"parts":["{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"c\n{{!}}d\n"}},"i":0}},"\n|}"]}'>
26398 <tbody><tr><td>d
26399 </td></tr>
26400 </tbody></table>
26401 !! wikitext
26402 {{echo|a}}
26403 {|{{echo|c
26404 {{!}}d
26405 }}
26406 |}
26407 !! end
26408
26409 ## This test verifies the presence and computation of this attribute indirectly
26410 ## by making an edit and ensuring that the serialization is correct (which it would be
26411 ## only if firstWikitextNode is properly set).
26412 !! test
26413 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
26414 !! options
26415 parsoid= {
26416 "modes": ["wt2wt"],
26417 "changes": [
26418 [ "div#x", "remove" ],
26419 [ "div", "before", "<div>new</div>" ]
26420 ]
26421 }
26422 !! wikitext
26423 <div id="x">foo</div>
26424 {|
26425 {{echo|<div>boo</div>
26426 {{!}}b}}
26427 |c
26428 |}
26429 !! wikitext/edited
26430
26431 <div>new</div>
26432 {|
26433 {{echo|<div>boo</div>
26434 {{!}}b}}
26435 |c
26436 |}
26437 !! end
26438
26439 # --------------------------------------------
26440 # Tests spec'ing wikitext serialization norms |
26441 # --------------------------------------------
26442
26443 !! test
26444 1. Categories should always be serialized on their own line
26445 !! options
26446 parsoid=html2wt
26447 !! html/parsoid
26448 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
26449 !! wikitext
26450 foo
26451 [[Category:Foo]]
26452 bar
26453 !! end
26454
26455 !! test
26456 2. Categories that are part of templates should not introduce a line break
26457 !! wikitext
26458 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
26459 !! html/parsoid
26460 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;span>bar&lt;/span> [[Category:baz]]"}},"i":0}}]}'>bar</span><span about="#mwt1"> </span><link rel="mw:PageProp/Category" href="./Category:Baz" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:baz"}}'/> bar</p>
26461 !! end
26462
26463 # Careful while editing these next 2 tests. There are \u200f characters
26464 # before and after the <link> tags in the HTML and following some
26465 # of the categories in wikitext
26466 # Do not remove these characters in edits.
26467 #
26468 # As part of the serialization, these bidi characters will get stripped.
26469 !! test
26470 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
26471 !! options
26472 parsoid={
26473 "modes": ["html2wt"],
26474 "scrubWikitext": true
26475 }
26476 !! html/parsoid
26477 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
26478 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
26479 !! wikitext
26480 [[קטגוריה:טקסים]]
26481 [[קטגוריה: שיטות משפט]]
26482 !! end
26483
26484 !! test
26485 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
26486 !! options
26487 parsoid={
26488 "modes": ["html2wt"],
26489 "scrubWikitext": true
26490 }
26491 !! html/parsoid
26492 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
26493 !! wikitext
26494 [[קטגוריה:טקסים]]
26495 ‏y
26496 !! end
26497
26498 !! test
26499 Lists: Add space after bullets
26500 !! options
26501 parsoid=html2wt
26502 !! html/parsoid
26503 <ul>
26504 <li>foo</li>
26505 <li> bar</li>
26506 <li><span> baz</span></li>
26507 </ul>
26508 !! wikitext
26509 * foo
26510 * bar
26511 * <span> baz</span>
26512 !! end
26513
26514 !! test
26515 1. Headings: Add space before/after == (T53744)
26516 !! options
26517 parsoid=html2wt
26518 !! html/parsoid
26519 <h2>foo</h2>
26520 <h2> bar</h2>
26521 <h2>baz </h2>
26522 <h2><span> baz</span></h2>
26523 !! wikitext
26524 == foo ==
26525
26526 == bar ==
26527
26528 == baz ==
26529
26530 == <span> baz</span> ==
26531 !! end
26532
26533 !! test
26534 2. Headings: Add space before/after == even after hoisted content
26535 !! options
26536 parsoid={
26537 "modes": ["html2wt"],
26538 "scrubWikitext": true
26539 }
26540 !! html/parsoid
26541 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
26542 !! wikitext
26543 [[Category:A2]]
26544
26545 == ok ==
26546 !! end
26547
26548 !! test
26549 1. Headings: suppress newly created empty headings
26550 !! options
26551 parsoid={
26552 "modes": ["html2wt"],
26553 "scrubWikitext": true
26554 }
26555 !! html/parsoid
26556 <h2></h2>
26557 !! wikitext
26558 !! end
26559
26560 !! test
26561 2. Headings: don't suppress empty headings if scrubWikitext is false
26562 !! options
26563 parsoid=html2wt
26564 !! html/parsoid
26565 <h2></h2>
26566 !! wikitext
26567 ==<nowiki/>==
26568 !! end
26569
26570 !! test
26571 3. Headings: suppress empty headings on edits
26572 !! options
26573 parsoid={
26574 "modes": ["selser"],
26575 "scrubWikitext": true,
26576 "changes": [
26577 [ "#x", "remove"]
26578 ]
26579 }
26580 !! wikitext
26581 ==<span id="x">foo</span>==
26582 !! wikitext/edited
26583 !! end
26584
26585 !! test
26586 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
26587 !! options
26588 parsoid={
26589 "modes": ["html2wt"],
26590 "scrubWikitext": true
26591 }
26592 !! html/parsoid
26593 <h2>foo<br/>bar</h2>
26594 <h2>foo <span><br/>bar</span> baz</h2>
26595 !! wikitext
26596 == foo bar ==
26597
26598 == foo <span> bar</span> baz ==
26599 !! end
26600
26601 !! test
26602 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
26603 !! options
26604 parsoid={
26605 "modes": ["html2wt"],
26606 "scrubWikitext": false
26607 }
26608 !! html/parsoid
26609 <h2>foo<br/>bar</h2>
26610 !! wikitext
26611 == foo<br> bar ==
26612 !! end
26613
26614 !! test
26615 1. WT Quote Tags: suppress newly created empty style tags
26616 !! options
26617 parsoid={
26618 "modes": ["html2wt"],
26619 "scrubWikitext": true
26620 }
26621 !! html/parsoid
26622 <i></i><b></b>
26623 !! wikitext
26624 !! end
26625
26626 !! test
26627 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
26628 !! options
26629 parsoid=html2wt
26630 !! html/parsoid
26631 <i></i><b></b>
26632 !! wikitext
26633 ''<nowiki/>'''''<nowiki/>'''
26634 !! end
26635
26636 !! test
26637 3. WT Quote Tags: suppress empty style tags on edits
26638 !! options
26639 parsoid={
26640 "modes": ["selser"],
26641 "scrubWikitext": true,
26642 "changes": [
26643 [ "#x", "remove"]
26644 ]
26645 }
26646 !! wikitext
26647 '''<span id="x">foo</span>'''
26648 !! wikitext/edited
26649 !! end
26650
26651 !! test
26652 1. Anchors: suppress newly created empty anchors
26653 !! options
26654 parsoid={
26655 "modes": ["html2wt"],
26656 "scrubWikitext": true
26657 }
26658 !! html/parsoid
26659 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26660 !! wikitext
26661 !! end
26662
26663 !! test
26664 2. Anchors: don't suppress empty anchors if scrubWikitext is false
26665 !! options
26666 parsoid={
26667 "modes": ["html2wt"],
26668 "scrubWikitext": false
26669 }
26670 !! html/parsoid
26671 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26672 !! wikitext
26673 [[Test|<nowiki/>]]
26674 !! end
26675
26676 !! test
26677 3. Anchors: suppress empty anchors on edits
26678 !! options
26679 parsoid={
26680 "modes": ["selser"],
26681 "scrubWikitext": true,
26682 "changes": [
26683 [ "#x", "remove"]
26684 ]
26685 }
26686 !! wikitext
26687 [[Test|<span id="x">foo</span>]]
26688 !! wikitext/edited
26689 !! end
26690
26691 !! test
26692 3a. Anchors: do not suppress numbered extlinks
26693 !! options
26694 parsoid={
26695 "modes": ["wt2wt"],
26696 "scrubWikitext": true
26697 }
26698 !! wikitext
26699 [http://foo.com]
26700 !! html/parsoid
26701 <a rel="mw:ExtLink" href="http://foo.com"></a>
26702 !! end
26703
26704 !! test
26705 3b. Anchors: do not suppress numbered extlinks
26706 !! options
26707 parsoid={
26708 "modes": ["wt2wt"],
26709 "scrubWikitext": true,
26710 "changes": [
26711 [ "#x", "remove"]
26712 ]
26713 }
26714 !! wikitext
26715 [http://foo.com <span id="x">foo</span>]
26716 !! wikitext/edited
26717 [http://foo.com]
26718 !! end
26719
26720 !!test
26721 Normalizations should be restricted to edited content
26722 !!options
26723 parsoid={
26724 "modes": ["selser"],
26725 "scrubWikitext": true,
26726 "changes": [
26727 [ "h1", "before", "<i></i>"]
26728 ]
26729 }
26730 !!wikitext
26731 a
26732 = =
26733 b
26734 !!wikitext/edited
26735 a
26736 = =
26737 b
26738 !!end
26739
26740 !! test
26741 1. Multiple normalizations (html2wt)
26742 !! options
26743 parsoid={
26744 "modes": ["html2wt"],
26745 "scrubWikitext": true
26746 }
26747 !! html
26748 <h2><i></i></h2>
26749 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
26750 </a><b><i></i></b>x</p>
26751 !! wikitext
26752
26753 [[foo]]
26754 x
26755
26756 !! end
26757
26758 !! test
26759 2. Multiple normalizations (selser)
26760 !! options
26761 parsoid={
26762 "modes": ["selser"],
26763 "scrubWikitext": true,
26764 "changes": [
26765 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
26766 ]
26767 }
26768 !! wikitext
26769 <span id="x">foo</span>
26770 !! wikitext/edited
26771 <span id="x">foo</span>
26772
26773 x
26774 !! end
26775
26776 !! test
26777 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
26778 !! options
26779 parsoid={
26780 "modes": ["html2wt"],
26781 "scrubWikitext": true
26782 }
26783 !! html/parsoid
26784 <p> hi</p>
26785 <p> hello</p>
26786 !! wikitext
26787 hi
26788
26789 hello
26790 !! end
26791
26792 !! test
26793 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
26794 !! options
26795 parsoid=html2wt
26796 !! html/parsoid
26797 <p> hi</p>
26798 <p> hello</p>
26799 !! wikitext
26800 <nowiki> </nowiki>hi
26801
26802 <nowiki> </nowiki> hello
26803 !! end
26804
26805 !! test
26806 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
26807 !! options
26808 parsoid={
26809 "modes": ["html2wt"],
26810 "scrubWikitext": true
26811 }
26812 !! html/parsoid
26813 <p>Foo
26814 bar
26815 baz</p>
26816
26817 <table><tr><td>Foo
26818 bar
26819 baz bang</td></tr></table>
26820
26821 <p><!--boo--> foo
26822 bar</p>
26823
26824 <p> foo
26825 bar<span>boo</span></p>
26826 !! wikitext
26827 Foo
26828 bar
26829 baz
26830
26831 {|
26832 |Foo
26833 bar
26834 baz bang
26835 |}
26836
26837 <!--boo-->foo
26838 bar
26839
26840 foo
26841 bar<span>boo</span>
26842 !! end
26843
26844 !! test
26845 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
26846 !! options
26847 parsoid={
26848 "modes": ["selser"],
26849 "scrubWikitext": true,
26850 "changes": [
26851 [ "p", "html", " a\n b" ]
26852 ]
26853 }
26854 !! wikitext
26855 xyz
26856 !! wikitext/edited
26857 a
26858 b
26859 !! end
26860
26861 !! test
26862 1. New links that end in spaces
26863 !! options
26864 parsoid={
26865 "modes": ["html2wt"],
26866 "scrubWikitext": false
26867 }
26868 !! html/parsoid
26869 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26870 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26871 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26872 !! wikitext
26873 [[Berlin ]]<nowiki/>is the capital of Germany.
26874
26875 [[Foo ]]'''bar'''
26876
26877 [[Boston ]] is a city.
26878 !! end
26879
26880 !! test
26881 2. New links that end in spaces
26882 !! options
26883 parsoid={
26884 "modes": ["html2wt"],
26885 "scrubWikitext": true
26886 }
26887 !! html/parsoid
26888 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26889 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26890 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26891 !! wikitext
26892 [[Berlin]] is the capital of Germany.
26893
26894 [[Foo]] '''bar'''
26895
26896 [[Boston]] is a city.
26897 !! end
26898
26899 !! test
26900 1. Table cells with escapable prefixes
26901 !! options
26902 parsoid={
26903 "modes": ["html2wt"],
26904 "scrubWikitext": false
26905 }
26906 !! html
26907 <table>
26908 <tr><td>a</td></tr>
26909 <tr><td>-</td></tr>
26910 <tr><td>+</td></tr>
26911 </table>
26912 !! wikitext
26913 {|
26914 |a
26915 |-
26916 |<nowiki>-</nowiki>
26917 |-
26918 |<nowiki>+</nowiki>
26919 |}
26920 !! end
26921
26922 !! test
26923 2. Table cells with escapable prefixes
26924 !! options
26925 parsoid={
26926 "modes": ["html2wt"],
26927 "scrubWikitext": true
26928 }
26929 !! html
26930 <table>
26931 <tr><td>a</td></tr>
26932 <tr><td>-</td></tr>
26933 <tr><td>+</td></tr>
26934 </table>
26935 !! wikitext
26936 {|
26937 |a
26938 |-
26939 | -
26940 |-
26941 | +
26942 |}
26943 !! end
26944
26945 !! test
26946 3a. Table cells with escapable prefixes after edits
26947 !! options
26948 parsoid={
26949 "modes": ["selser"],
26950 "scrubWikitext": true,
26951 "changes": [
26952 [ "table tbody tr:first-child td:first-child", "remove"]
26953 ]
26954 }
26955 !! wikitext
26956 {|
26957 |a||-
26958 |}
26959 !! wikitext/edited
26960 {|
26961 | -
26962 |}
26963 !! end
26964
26965 !! test
26966 3b. Table cells with escapable prefixes after edits
26967 !! options
26968 parsoid={
26969 "modes": ["selser"],
26970 "scrubWikitext": true,
26971 "changes": [
26972 [ "table tbody tr:first-child td:first-child", "html", "-" ],
26973 [ "#x", "remove" ]
26974 ]
26975 }
26976 !! wikitext
26977 {|
26978 |pqr
26979 |<span id="x">foo</span>+
26980 |}
26981 !! wikitext/edited
26982 {|
26983 | -
26984 | +
26985 |}
26986 !! end
26987
26988 # FIXME: This test will fail because
26989 # normalization doesn't realize that the id attribute
26990 # will eliminate the escapable scenario
26991 !! test
26992 4a. Table cells without escapable prefixes after edits
26993 !! options
26994 parsoid={
26995 "modes": ["selser"],
26996 "scrubWikitext": true,
26997 "changes": [
26998 [ "#x", "html", "-" ]
26999 ]
27000 }
27001 !! wikitext
27002 {|
27003 | id="x" |abcd
27004 |}
27005 !! wikitext/edited
27006 {|
27007 | id="x" |-
27008 |}
27009 !! end
27010
27011 ## This tests normalizer's ability to discriminate between
27012 ## cells having identical content.
27013 !! test
27014 4b. Table cells without escapable prefixes after edits
27015 !! options
27016 parsoid={
27017 "modes": ["selser"],
27018 "scrubWikitext": true,
27019 "changes": [
27020 [ "td", "html", "-" ]
27021 ]
27022 }
27023 !! wikitext
27024 {|
27025 |a||b
27026 |}
27027 !! wikitext/edited
27028 {|
27029 | -||-
27030 |}
27031 !! end
27032
27033 ## This tests normalizer's ability to not be tripped by
27034 ## comments (and whitespace)
27035 !! test
27036 4c. Table cells without escapable prefixes after edits
27037 !! options
27038 parsoid={
27039 "modes": ["selser"],
27040 "scrubWikitext": true,
27041 "changes": [
27042 [ "table tbody tr td:first-child", "remove" ]
27043 ]
27044 }
27045 !! wikitext
27046 {|
27047 |-
27048 <!--foo--> |a||-
27049 |}
27050 !! wikitext/edited
27051 {|
27052 |-
27053 <!--foo--> | -
27054 |}
27055 !! end
27056
27057 ## This tests normalizer's ability to handle HTML cells
27058 !! test
27059 4d. Table cells without escapable prefixes after edits
27060 !! options
27061 parsoid={
27062 "modes": ["selser"],
27063 "scrubWikitext": true,
27064 "changes": [
27065 [ "td", "html", "-" ]
27066 ]
27067 }
27068 !! wikitext
27069 <table>
27070 <tr><td>a</td></tr>
27071 </table>
27072 !! wikitext/edited
27073 <table>
27074 <tr><td>-</td></tr>
27075 </table>
27076 !! end
27077
27078 ## T111151 Remove font elements without attributes
27079 !! test
27080 5a. font tags without attributes should be dropped in scrubWikitext mode
27081 !! options
27082 parsoid={
27083 "modes": ["html2wt"],
27084 "scrubWikitext": true
27085 }
27086 !! html
27087 <font>foo</font>
27088 <font><font>bar</font></font>
27089 <font class="x">boo</font>
27090 !! wikitext
27091 foo
27092 bar
27093 <font class="x">boo</font>
27094 !! end
27095
27096 !! test
27097 5b. font tags should not be dropped without scrubWikitext being enabled
27098 !! options
27099 parsoid={
27100 "modes": ["html2wt"],
27101 "scrubWikitext": false
27102 }
27103 !! html
27104 <font>foo</font>
27105 !! wikitext
27106 <font>foo</font>
27107 !! end
27108
27109 !! test
27110 Escape nowiki DOM elements
27111 !! options
27112 parsoid=html2wt
27113 !! html/parsoid
27114 <nowiki><i>foo</i></nowiki>
27115 !! wikitext
27116 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
27117 !! end
27118
27119 # This is meant to be an interim fix while we go about figuring out
27120 # how to not introduce these trailing <nowiki/>s in the first place.
27121 !! test
27122 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
27123 !! options
27124 parsoid=html2wt
27125 !! html/parsoid
27126 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
27127 y</p>
27128 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","named":true,"spc":["\n"," "," ",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;nowiki/>"}},"i":0}}]}'></span></p>
27129 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","named":true,"spc":["\n"," "," ","\n"]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;nowiki/>"}},"i":0}}]}'></span></p>
27130 !! wikitext
27131 x
27132 y
27133
27134 {{echo|
27135 1 = <nowiki/>}}
27136
27137 {{echo|
27138 1 = <nowiki/>
27139 }}
27140 !! end
27141
27142 # ---------------------------------------------------
27143 # End of tests spec'ing wikitext serialization norms |
27144 # ---------------------------------------------------
27145
27146 # T104032
27147 !! test
27148 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
27149 !! options
27150 parsoid=html2wt
27151 !! html/parsoid
27152 a<p>b</p>
27153 <b>c</b><p>d</p>
27154 <table><tr>
27155 <td>a<p>b</p></td>
27156 <td><b>c</b><p>d</p></td>
27157 </tr></table>
27158 !! wikitext
27159 a
27160
27161 b
27162
27163 '''c'''
27164
27165 d
27166 {|
27167 |a
27168 b
27169 |'''c'''
27170 d
27171 |}
27172 !! end
27173
27174 # -----------------------------------------------------------------
27175 # End of section for Parsoid-only html2wt tests for serialization
27176 # of new content
27177 # -----------------------------------------------------------------
27178
27179 # -----------------------------------------------------------------
27180 # The following section of tests are primarily to spec behavior of
27181 # the selective serializer. All these tests have manual selser
27182 # changes. The automated selser changes for all tests handle the
27183 # wide variation of changes, but these tests here capture specs
27184 # deterministically.
27185 # ----------------------------------------------------------------
27186
27187 ## T90517
27188 !! test
27189 Selser: New comments should not be lost
27190 !! options
27191 parsoid={
27192 "modes": ["selser"],
27193 "changes": [
27194 [ "#a", "after", "<!--c1-->" ],
27195 [ "#b", "before", "<!--c2-->" ]
27196 ]
27197 }
27198 !! wikitext
27199 <span id="a">a</span>
27200
27201 <span id="b">b</span>
27202 !! wikitext/edited
27203 <span id="a">a</span><!--c1-->
27204
27205 <!--c2--><span id="b">b</span>
27206 !! end
27207
27208 ## T89383
27209 !! test
27210 Selser: Check for validity of DSR before using it
27211 !! options
27212 parsoid={
27213 "modes": ["selser"],
27214 "changes": [
27215 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
27216 ]
27217 }
27218 !! wikitext
27219 <span id="a">a</span>
27220 !! wikitext/edited
27221 {{DISPLAYTITLE:foo}}
27222 <span id="a">a</span>
27223 !! end
27224
27225 !! test
27226 1. DOMDiff: Changes to <ref> content should be looked up using id
27227 !! options
27228 parsoid={
27229 "modes": ["selser"],
27230 "changes": [
27231 ["#X", "after", "bar"],
27232 ["#Y", "after", "baz"]
27233 ]
27234 }
27235 !! wikitext
27236 X <ref><span id="X">foo</span></ref>
27237 Y <ref name="a" />
27238 <references>
27239 <ref name="a"><span id="Y">foo</span></ref>
27240 </references>
27241 !! wikitext/edited
27242 X <ref><span id="X">foo</span>bar</ref>
27243 Y <ref name="a" />
27244 <references>
27245 <ref name="a"><span id="Y">foo</span>baz</ref>
27246 </references>
27247 !! end
27248
27249 !! test
27250 2. DOMDiff: Changes to <ref> content should be looked up using id
27251 !! options
27252 parsoid={
27253 "modes": ["selser"],
27254 "changes": [
27255 ["#Z", "after", "bar"]
27256 ]
27257 }
27258 !! wikitext
27259 A <ref>foo bar for a</ref>
27260 B <ref group="X" name="b" />
27261
27262 <references />
27263
27264 <references group="X">
27265 <ref name="b"><span id="Z">foo</span></ref>
27266 </references>
27267 !! wikitext/edited
27268 A <ref>foo bar for a</ref>
27269 B <ref group="X" name="b" />
27270
27271 <references />
27272
27273 <references group="X">
27274 <ref name="b"><span id="Z">foo</span>bar</ref>
27275 </references>
27276 !! end
27277
27278 !! test
27279 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
27280 !! options
27281 parsoid={
27282 "modes": ["selser"],
27283 "changes": [
27284 [ "div:first-child", "text", "bar" ]
27285 ]
27286 }
27287 !! wikitext
27288 <div style="{{1x|color:red;}}%">foo</div>
27289 !! wikitext/edited
27290 <div style="{{1x|color:red;}}%">bar</div>
27291 !! end
27292
27293 !! test
27294 Empty LI (T49673)
27295 !! wikitext
27296 * a
27297 *
27298 *
27299 * b
27300 !! html/php+tidy
27301 <ul>
27302 <li>a</li>
27303 <li class="mw-empty-elt"></li>
27304 <li class="mw-empty-elt"></li>
27305 <li>b</li>
27306 </ul>
27307 !! end
27308
27309 !! test
27310 Thumbnail output
27311 !! wikitext
27312 [[File:Thumb.png|thumb]]
27313 !! html/php+tidy
27314 <div class="thumb tright">
27315 <div class="thumbinner" style="width:137px;"><a href="/wiki/File:Thumb.png" class="image"><img alt="Thumb.png" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a>
27316 <div class="thumbcaption">
27317 <div class="magnify"><a href="/wiki/File:Thumb.png" class="internal" title="Enlarge"></a></div>
27318 </div>
27319 </div>
27320 </div>
27321 !! end
27322
27323 !! test
27324 unclosed internal link XSS (T137264)
27325 !! wikitext
27326 [[#%3Cscript%3Ealert(1)%3C/script%3E|
27327 !! html/php
27328 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
27329 </p>
27330 !! html/parsoid
27331 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
27332 !! end