Remove test for <math> which fails when Extension:Math is installed
[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 !! html
3685 <dl><dt>x</dt>
3686 <dd>a</dd>
3687 <dd>b</dd></dl>
3688
3689 !! end
3690
3691 !! test
3692 Definition Lists: No nesting: Multiple dd's
3693 !! wikitext
3694 ;x
3695 :a
3696 :b
3697 !! html
3698 <dl><dt>x</dt>
3699 <dd>a</dd>
3700 <dd>b</dd></dl>
3701
3702 !! end
3703
3704 !! test
3705 Definition Lists: Indentation: Regular
3706 !! wikitext
3707 :i1
3708 ::i2
3709 :::i3
3710 !! html
3711 <dl><dd>i1
3712 <dl><dd>i2
3713 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3714
3715 !! end
3716
3717 !! test
3718 Definition Lists: Indentation: Missing 1st level
3719 !! wikitext
3720 ::i2
3721 :::i3
3722 !! html
3723 <dl><dd><dl><dd>i2
3724 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3725
3726 !! end
3727
3728 !! test
3729 Definition Lists: Indentation: Multi-level indent
3730 !! wikitext
3731 :::i3
3732 !! html
3733 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3734
3735 !! end
3736
3737 !! test
3738 Definition Lists: Hacky use to indent tables
3739 !! wikitext
3740 ::{|
3741 |foo
3742 |bar
3743 |}
3744 this text
3745 should be left alone
3746 !! html
3747 <dl><dd><dl><dd><table>
3748 <tr>
3749 <td>foo
3750 </td>
3751 <td>bar
3752 </td></tr></table></dd></dl></dd></dl>
3753 <p>this text
3754 should be left alone
3755 </p>
3756 !! end
3757
3758 !! test
3759 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3760 !! wikitext
3761 <!-- foo -->
3762 ::{|
3763 |foo
3764 |bar
3765 |}<!-- bar -->
3766 this text
3767 should be left alone
3768 !! html/parsoid
3769 <!-- foo -->
3770 <dl><dd><dl><dd><table><tr>
3771 <td>foo</td>
3772 <td>bar</td>
3773 </tr></table><!-- bar --></dd></dl></dd></dl>
3774 <p>this text
3775 should be left alone</p>
3776 !! end
3777
3778 !! test
3779 Definition Lists: Hacky use to indent tables, with comment before table
3780 !! wikitext
3781 ::<!-- foo -->{|
3782 |foo
3783 |}
3784 !! html/parsoid
3785 <dl><dd><dl><dd><!-- foo --><table><tr>
3786 <td>foo</td>
3787 </tr></table></dd></dl></dd></dl>
3788 !! end
3789
3790 # The trailing whitespace in this test is to catch a regression in
3791 # Parsoid after T54473.
3792 !! test
3793 Definition Lists: Hacky use to indent tables (WS-insensitive)
3794 !! wikitext
3795 : {|
3796 |a
3797 |}
3798 !! html/php
3799 <dl><dd><table>
3800 <tr>
3801 <td>a
3802 </td></tr></table></dd></dl>
3803
3804 !! html/parsoid
3805 <dl><dd> <table>
3806 <tbody><tr><td>a</td></tr>
3807 </tbody></table> </dd></dl>
3808 !! end
3809
3810 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3811 ## as an empty dt item. It also ignores all but the last ";" when followed
3812 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3813 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3814 ## ";"s.
3815 ##
3816 ## Ex: ";;t2 ::d2" is transformed into:
3817 ##
3818 ## <dl>
3819 ## <dt>t2 </dt>
3820 ## <dd>
3821 ## <dl>
3822 ## <dt></dt>
3823 ## <dd>d2</dd>
3824 ## </dl>
3825 ## </dd>
3826 ## </dl>
3827 ##
3828 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3829 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3830 ##
3831 ## <dl>
3832 ## <dt>
3833 ## <dl>
3834 ## <dt>t2 </dt>
3835 ## <dd>:d2</dd>
3836 ## </dl>
3837 ## </dt>
3838 ## </dl>
3839 ##
3840 ## All Parsoid only definition list tests have this difference.
3841 ##
3842 ## See also: https://phabricator.wikimedia.org/T8569
3843 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3844
3845 !! test
3846 Table / list interaction: indented table with lists in table contents
3847 !! wikitext
3848 :{|
3849 |-
3850 | a
3851 * b
3852 |-
3853 | c
3854 * d
3855 |}
3856 !! html
3857 <dl><dd><table>
3858
3859 <tr>
3860 <td> a
3861 <ul><li> b</li></ul>
3862 </td></tr>
3863 <tr>
3864 <td> c
3865 <ul><li> d</li></ul>
3866 </td></tr></table></dd></dl>
3867
3868 !! end
3869
3870 !!test
3871 Table / list interaction: lists nested in tables nested in indented lists
3872 !! wikitext
3873 :{|
3874 |
3875 :a
3876 :b
3877 |
3878 *c
3879 *d
3880 |}
3881
3882 *e
3883 *f
3884 !! html
3885 <dl><dd><table>
3886 <tr>
3887 <td>
3888 <dl><dd>a</dd>
3889 <dd>b</dd></dl>
3890 </td>
3891 <td>
3892 <ul><li>c</li>
3893 <li>d</li></ul>
3894 </td></tr></table></dd></dl>
3895 <ul><li>e</li>
3896 <li>f</li></ul>
3897
3898 !!end
3899
3900 !! test
3901 Definition Lists: Nesting: Multi-level (Parsoid only)
3902 !! options
3903 parsoid
3904 !! wikitext
3905 ;t1 :d1
3906 ;;t2 ::d2
3907 ;;;t3 :::d3
3908 !! html
3909 <dl>
3910 <dt>t1 </dt>
3911 <dd>d1</dd>
3912 <dt>
3913 <dl>
3914 <dt>t2 </dt>
3915 <dd>:d2</dd>
3916 <dt>
3917 <dl>
3918 <dt>t3 </dt>
3919 <dd>::d3</dd>
3920 </dl>
3921 </dt>
3922 </dl>
3923 </dt>
3924 </dl>
3925
3926
3927 !! end
3928
3929
3930 !! test
3931 Definition Lists: Nesting: Test 2 (Parsoid only)
3932 !! wikitext
3933 ;t1
3934 ::d2
3935 !! html/php+tidy
3936 <dl>
3937 <dt>t1</dt>
3938 <dd>
3939 <dl>
3940 <dd>d2</dd>
3941 </dl>
3942 </dd>
3943 </dl>
3944 !! html/parsoid
3945 <dl>
3946 <dt>t1</dt>
3947 <dd>
3948 <dl>
3949 <dd>d2</dd>
3950 </dl>
3951 </dd>
3952 </dl>
3953
3954 !! end
3955
3956
3957 !! test
3958 Definition Lists: Nesting: Test 3 (Parsoid only)
3959 !! wikitext
3960 :;t1
3961 ::::d2
3962 !! html/php+tidy
3963 <dl>
3964 <dd>
3965 <dl>
3966 <dt>t1</dt>
3967 <dd>
3968 <dl>
3969 <dd>
3970 <dl>
3971 <dd>d2</dd>
3972 </dl>
3973 </dd>
3974 </dl>
3975 </dd>
3976 </dl>
3977 </dd>
3978 </dl>
3979 !! html/parsoid
3980 <dl>
3981 <dd>
3982 <dl>
3983 <dt>t1</dt>
3984 <dd>
3985 <dl>
3986 <dd>
3987 <dl>
3988 <dd>d2</dd>
3989 </dl>
3990 </dd>
3991 </dl>
3992 </dd>
3993 </dl>
3994 </dd>
3995 </dl>
3996
3997 !! end
3998
3999
4000 !! test
4001 Definition Lists: Nesting: Test 4
4002 !! wikitext
4003 ::;t3
4004 :::d3
4005 !! html
4006 <dl><dd><dl><dd><dl><dt>t3</dt>
4007 <dd>d3</dd></dl></dd></dl></dd></dl>
4008
4009 !! end
4010
4011
4012 ## The Parsoid team believes the following three test exposes a
4013 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4014 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4015 ## It also exposes a "misfeature" in tidy, which doesn't like
4016 ## <dl> tags with a single <dt> child; it converts the <dt> into
4017 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4018 !! test
4019 Definition Lists: Mixed Lists: Test 1
4020 !! wikitext
4021 :;* foo
4022 ::* bar
4023 :; baz
4024 !! html/php
4025 <dl><dd><dl><dt><ul><li> foo</li>
4026 <li> bar</li></ul></dt></dl>
4027 <dl><dt> baz</dt></dl></dd></dl>
4028
4029 !! html/php+tidy
4030 <dl>
4031 <dd>
4032 <dl>
4033 <dd>
4034 <ul>
4035 <li>foo</li>
4036 <li>bar</li>
4037 </ul>
4038 </dd>
4039 </dl>
4040 <dl>
4041 <dt>baz</dt>
4042 </dl>
4043 </dd>
4044 </dl>
4045 !! html/parsoid
4046 <dl>
4047 <dd><dl>
4048 <dt><ul>
4049 <li> foo
4050 </li>
4051 </ul></dt>
4052 <dd><ul>
4053 <li> bar
4054 </li>
4055 </ul></dd>
4056 <dt> baz</dt>
4057 </dl></dd>
4058 </dl>
4059 !! end
4060
4061 !! test
4062 Definition Lists: Mixed Lists: Test 2
4063 !! wikitext
4064 *: d1
4065 *: d2
4066 !! html
4067 <ul><li><dl><dd> d1</dd>
4068 <dd> d2</dd></dl></li></ul>
4069
4070 !! end
4071
4072
4073 !! test
4074 Definition Lists: Mixed Lists: Test 3
4075 !! wikitext
4076 *::: d1
4077 *::: d2
4078 !! html
4079 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4080 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4081
4082 !! end
4083
4084
4085 !! test
4086 Definition Lists: Mixed Lists: Test 4
4087 !! wikitext
4088 *;d1 :d2
4089 *;d3 :d4
4090 !! html
4091 <ul><li><dl><dt>d1&#160;</dt>
4092 <dd>d2</dd>
4093 <dt>d3&#160;</dt>
4094 <dd>d4</dd></dl></li></ul>
4095
4096 !! end
4097
4098
4099 !! test
4100 Definition Lists: Mixed Lists: Test 5
4101 !! wikitext
4102 *:d1
4103 *:: d2
4104 !! html
4105 <ul><li><dl><dd>d1
4106 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4107
4108 !! end
4109
4110
4111 !! test
4112 Definition Lists: Mixed Lists: Test 6
4113 !! wikitext
4114 #*:d1
4115 #*::: d3
4116 !! html
4117 <ol><li><ul><li><dl><dd>d1
4118 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4119
4120 !! end
4121
4122
4123 !! test
4124 Definition Lists: Mixed Lists: Test 7
4125 !! wikitext
4126 :* d1
4127 :* d2
4128 !! html
4129 <dl><dd><ul><li> d1</li>
4130 <li> d2</li></ul></dd></dl>
4131
4132 !! end
4133
4134
4135 !! test
4136 Definition Lists: Mixed Lists: Test 8
4137 !! wikitext
4138 :* d1
4139 ::* d2
4140 !! html
4141 <dl><dd><ul><li> d1</li></ul>
4142 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4143
4144 !! end
4145
4146
4147 !! test
4148 Definition Lists: Mixed Lists: Test 9
4149 !! wikitext
4150 *;foo :bar
4151 !! html
4152 <ul><li><dl><dt>foo&#160;</dt>
4153 <dd>bar</dd></dl></li></ul>
4154
4155 !! end
4156
4157
4158 !! test
4159 Definition Lists: Mixed Lists: Test 10
4160 !! wikitext
4161 *#;foo :bar
4162 !! html
4163 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4164 <dd>bar</dd></dl></li></ol></li></ul>
4165
4166 !! end
4167
4168 # The Parsoid team disagrees with the PHP parser's seemingly-random
4169 # rules regarding dd/dt on the next two tests. Parsoid is more
4170 # consistent, and recognizes the shared nesting and keeps the
4171 # still-open tags around until the nesting is complete.
4172 # (And tidy again converts <dt> to <dd> before 'bar'.)
4173
4174 !! test
4175 Definition Lists: Mixed Lists: Test 11
4176 !! wikitext
4177 *#*#;*;;foo :bar
4178 *#*#;boo :baz
4179 !! html/php
4180 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4181 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4182 <dl><dt>boo&#160;</dt>
4183 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4184
4185 !! html/php+tidy
4186 <ul>
4187 <li>
4188 <ol>
4189 <li>
4190 <ul>
4191 <li>
4192 <ol>
4193 <li>
4194 <dl>
4195 <dt>foo&#160;</dt>
4196 <dd>
4197 <ul>
4198 <li>
4199 <dl>
4200 <dd>
4201 <dl>
4202 <dt>bar</dt>
4203 </dl>
4204 </dd>
4205 </dl>
4206 </li>
4207 </ul>
4208 </dd>
4209 </dl>
4210 <dl>
4211 <dt>boo&#160;</dt>
4212 <dd>baz</dd>
4213 </dl>
4214 </li>
4215 </ol>
4216 </li>
4217 </ul>
4218 </li>
4219 </ol>
4220 </li>
4221 </ul>
4222 !! html/parsoid
4223 <ul>
4224 <li>
4225 <ol>
4226 <li>
4227 <ul>
4228 <li>
4229 <ol>
4230 <li>
4231 <dl>
4232 <dt>
4233 <ul>
4234 <li>
4235 <dl>
4236 <dt>
4237 <dl>
4238 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4239 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4240 </dl></dt>
4241 </dl></li>
4242 </ul></dt>
4243 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4244 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4245 </dl></li>
4246 </ol></li>
4247 </ul></li>
4248 </ol></li>
4249 </ul>
4250 !! end
4251
4252
4253 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4254 # From whitelist:
4255 # * The test is wrong, there are two colons where there should be :;
4256 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4257 !! test
4258 Definition Lists: Weird Ones: Test 1
4259 !! wikitext
4260 *#;*::;; foo : bar (who uses this?)
4261 !! html/php
4262 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4263 <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>
4264
4265 !! html/php+tidy
4266 <ul>
4267 <li>
4268 <ol>
4269 <li>
4270 <dl>
4271 <dt>foo&#160;</dt>
4272 <dd>
4273 <ul>
4274 <li>
4275 <dl>
4276 <dd>
4277 <dl>
4278 <dd>
4279 <dl>
4280 <dd>
4281 <dl>
4282 <dt>bar (who uses this?)</dt>
4283 </dl>
4284 </dd>
4285 </dl>
4286 </dd>
4287 </dl>
4288 </dd>
4289 </dl>
4290 </li>
4291 </ul>
4292 </dd>
4293 </dl>
4294 </li>
4295 </ol>
4296 </li>
4297 </ul>
4298 !! html/parsoid
4299 <ul>
4300 <li>
4301 <ol>
4302 <li>
4303 <dl>
4304 <dt>
4305 <ul>
4306 <li>
4307 <dl>
4308 <dd>
4309 <dl>
4310 <dd>
4311 <dl>
4312 <dt>
4313 <dl>
4314 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4315 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4316 </dl></dt>
4317 </dl></dd>
4318 </dl></dd>
4319 </dl></li>
4320 </ul></dt>
4321 </dl></li>
4322 </ol></li>
4323 </ul>
4324 !! end
4325
4326 !! test
4327 Definition Lists: colons occurring in tags
4328 !! wikitext
4329 ;a:b
4330 ;'''a:b'''
4331 ;<i>a:b</i>
4332 ;<span>a:b</span>
4333 ;<div>a:b</div>
4334 ;<div>a
4335 :b</div>
4336 ;{{echo|a:b}}
4337 ;{{echo|''a:b''}}
4338 ;;;''a:b''
4339 !! html+tidy
4340 <dl>
4341 <dt>a</dt>
4342 <dd>b</dd>
4343 <dt><b>a:b</b></dt>
4344 <dt><i>a:b</i></dt>
4345 <dt><span>a:b</span></dt>
4346 <dd>
4347 <div>a:b</div>
4348 </dd>
4349 <dd>
4350 <div>a
4351 <dl>
4352 <dd>b</dd>
4353 </dl>
4354 </div>
4355 </dd>
4356 <dt>a</dt>
4357 <dd>b</dd>
4358 <dt><i>a:b</i></dt>
4359 </dl>
4360 <dl>
4361 <dd>
4362 <dl>
4363 <dd>
4364 <dl>
4365 <dt><i>a:b</i></dt>
4366 </dl>
4367 </dd>
4368 </dl>
4369 </dd>
4370 </dl>
4371 !! html/parsoid
4372 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4373 <dt><b>a:b</b></dt>
4374 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4375 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4376 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4377 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4378 <dd>b</dd>
4379 <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>
4380 <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>
4381 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4382 !! end
4383
4384 !! test
4385 Definition Lists: colons and tables 1
4386 !! wikitext
4387 :{|
4388 | x
4389 |}
4390 :{|
4391 | y
4392 |}
4393 !! html
4394 <dl><dd><table>
4395 <tr>
4396 <td> x
4397 </td></tr></table></dd></dl>
4398 <dl><dd><table>
4399 <tr>
4400 <td> y
4401 </td></tr></table></dd></dl>
4402
4403 !! end
4404
4405 # Parsoid's output (as documented below) differs from php's in this case.
4406 # This is probably a bug. If we fixup parsoid to match php's output, the
4407 # above test should pass and the below test case can be removed. It is
4408 # unclear which output is more desirable.
4409
4410 !! test
4411 Definition Lists: colons and tables 2
4412 !! wikitext
4413 :{|
4414 | x
4415 |}
4416 :{|
4417 | y
4418 |}
4419 !! html/parsoid
4420 <dl><dd><table>
4421 <tr>
4422 <td> x
4423 </td></tr></table></dd>
4424 <dd><table>
4425 <tr>
4426 <td> y
4427 </td></tr></table></dd></dl>
4428 !! end
4429
4430 !! test
4431 Definition Lists: template interaction
4432 !! wikitext
4433 ::{{definition_list}}
4434
4435 :one
4436 ::{{definition_list}}
4437 :::two
4438 :::three
4439 ::four
4440 !! html/parsoid
4441 <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">
4442 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4443
4444 <dl><dd data-parsoid='{}'>one
4445 <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">
4446 </span><dd about="#mwt2">two
4447 <dl><dd>two</dd>
4448 <dd>three</dd></dl></dd>
4449 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4450 !! end
4451
4452
4453 ###
4454 ### External links
4455 ###
4456 !! test
4457 External links: non-bracketed
4458 !! wikitext
4459 Non-bracketed: http://example.com
4460 !! html
4461 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4462 </p>
4463 !! end
4464
4465 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4466 !! test
4467 External links: numbered
4468 !! wikitext
4469 Numbered: [http://example.com]
4470 Numbered: [http://example.net]
4471 Numbered: [http://example.com]
4472 !! html/php
4473 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4474 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4475 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4476 </p>
4477 !! html/parsoid
4478 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4479 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4480 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4481 !!end
4482
4483 !! test
4484 External links: specified text
4485 !! wikitext
4486 Specified text: [http://example.com link]
4487 !! html
4488 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4489 </p>
4490 !!end
4491
4492 !! test
4493 External links: trail
4494 !! wikitext
4495 Linktrails should not work for external links: [http://example.com link]s
4496 !! html
4497 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4498 </p>
4499 !! end
4500
4501 !! test
4502 External links: dollar sign in URL
4503 !! wikitext
4504 http://example.com/1$2345
4505 !! html
4506 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4507 </p>
4508 !! end
4509
4510 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4511 !! test
4512 External links: dollar sign in URL (autonumber)
4513 !! wikitext
4514 [http://example.com/1$2345]
4515 !! html/php
4516 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4517 </p>
4518 !! html/parsoid
4519 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4520 !!end
4521
4522 !! test
4523 External links: open square bracket forbidden in URL (bug 4377)
4524 !! options
4525 parsoid=wt2html,wt2wt,html2html
4526 !! wikitext
4527 http://example.com/1[2345
4528 !! html/php
4529 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4530 </p>
4531 !! html/parsoid
4532 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4533 !! end
4534
4535 !! test
4536 External links: open square bracket forbidden in URL (named) (bug 4377)
4537 !! options
4538 parsoid=wt2html,html2html
4539 !! wikitext
4540 [http://example.com/1[2345]
4541 !! html/php
4542 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4543 </p>
4544 !! html/parsoid
4545 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4546 !!end
4547
4548 # parsoid adds a space before the link name
4549 !! test
4550 External links: open square bracket forbidden in URL (named) (bug 4377)
4551 Parsoid variant.
4552 !! wikitext
4553 [http://example.com/1 [2345]
4554 !! html
4555 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4556 </p>
4557 !!end
4558
4559 !! test
4560 External links: nowiki in URL link text (bug 6230)
4561 !! wikitext
4562 [http://example.com/ <nowiki>''example site''</nowiki>]
4563 !! html
4564 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4565 </p>
4566 !! end
4567
4568 !! test
4569 External links: newline forbidden in text (bug 6230 regression check)
4570 !! wikitext
4571 [http://example.com/ first
4572 second]
4573 !! html
4574 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4575 second]
4576 </p>
4577 !!end
4578
4579 !! test
4580 External links: Pipe char between url and text
4581 !! wikitext
4582 [http://example.com | link]
4583 !! html
4584 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4585 </p>
4586 !!end
4587
4588 !! test
4589 External links: protocol-relative URL in brackets
4590 !! wikitext
4591 [//example.com/ Test]
4592 !! html
4593 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4594 </p>
4595 !! end
4596
4597 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4598 !! test
4599 External links: protocol-relative URL in brackets without text
4600 !! wikitext
4601 [//example.com]
4602 !! html/php
4603 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4604 </p>
4605 !! html/parsoid
4606 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4607 !! end
4608
4609 !! test
4610 External links: protocol-relative URL in free text is left alone
4611 !! wikitext
4612 //example.com/Foo
4613 !! html
4614 <p>//example.com/Foo
4615 </p>
4616 !!end
4617
4618 !! test
4619 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4620 !! wikitext
4621 foo//example.com/Foo
4622 !! html
4623 <p>foo//example.com/Foo
4624 </p>
4625 !! end
4626
4627 !! test
4628 External links: with no contents
4629 !! wikitext
4630 [http://en.wikipedia.org/wiki/Foo]
4631
4632 [[wikipedia:Foo|Bar]]
4633
4634 [[wikipedia:Foo|<span>Bar</span>]]
4635 !! html/php
4636 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4637 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4638 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4639 </p>
4640 !! html/parsoid
4641 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4642 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4643 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4644 !! end
4645
4646 !! test
4647 External links: Free with trailing punctuation
4648 !! wikitext
4649 http://example.com,
4650 http://example.com;
4651 http://example.com\
4652 http://example.com.
4653 http://example.com:
4654 http://example.com!
4655 http://example.com?
4656 http://example.com)
4657 http://example.com/url_with_(brackets)
4658 (http://example.com/url_without_brackets)
4659 http://example.com/url_with_entity&amp;
4660 http://example.com/url_with_entity&#x26;
4661 http://example.com/url_with_entity&#038;
4662 http://example.com/url_with_entity&nbsp;
4663 http://example.com/url_with_entity&#xA0;
4664 http://example.com/url_with_entity&#160;
4665 http://example.com/url_with_entity&lt;
4666 http://example.com/url_with_entity&#x3C;
4667 http://example.com/url_with_entity&#60;
4668 !! html/php
4669 <p><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">http://example.com</a>:
4674 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4675 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4676 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4677 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4678 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4679 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4680 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4681 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4682 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4683 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4684 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4685 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4686 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4687 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4688 </p>
4689 !! html/parsoid
4690 <p><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">http://example.com</a>:
4695 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4696 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4697 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4698 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4699 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4700 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4701 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4702 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
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;nbsp;","srcContent":" "}'> </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;#xA0;","srcContent":" "}'> </span>
4705 <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>
4706 <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>
4707 <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>
4708 <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>
4709 !! end
4710
4711 !! test
4712 External links: tricky Parsoid html2html case
4713 !! options
4714 parsoid=wt2html,wt2wt,html2html
4715 !! wikitext
4716 http://example.com/url_with_entity&amp;amp;
4717 !! html/php
4718 <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>;
4719 </p>
4720 !! html/parsoid
4721 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4722 !! end
4723
4724 !! test
4725 External links: Free with trailing quotes (T113666)
4726 !! wikitext
4727 '''News:''' Stuff here
4728
4729 news:'a'b''c''d e
4730 !! html/php
4731 <p><b>News:</b> Stuff here
4732 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4733 </p>
4734 !! html/parsoid
4735 <p><b>News:</b> Stuff here</p>
4736 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4737 !! end
4738
4739 !! test
4740 External links: Lone protocols are never linked (T105697)
4741 !! wikitext
4742 http://
4743 http://;
4744 (http://)
4745 bitcoin:
4746 bitcoin:;
4747 (bitcoin:)
4748 !! html
4749 <p>http://
4750 http://;
4751 (http://)
4752 bitcoin:
4753 bitcoin:;
4754 (bitcoin:)
4755 </p>
4756 !! end
4757
4758 !! test
4759 External links: No preceding word characters allowed (bug 65278)
4760 !! wikitext
4761 NOPEhttp://example.com
4762 N0http://example.com
4763 ok:http://example.com
4764 ok-http://example.com
4765 !! html
4766 <p>NOPEhttp://example.com
4767 N0http://example.com
4768 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4769 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4770 </p>
4771 !! end
4772
4773 !! test
4774 External links: nofollow domain exception
4775 !! wikitext
4776 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
4777 !! html
4778 <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>.
4779 </p>
4780 !!end
4781
4782 !! test
4783 External image
4784 !! wikitext
4785 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4786 !! html
4787 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4788 </p>
4789 !! end
4790
4791 !! test
4792 External image from https
4793 !! wikitext
4794 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4795 !! html
4796 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4797 </p>
4798 !! end
4799
4800 !! test
4801 External image (when not allowed)
4802 !! options
4803 wgAllowExternalImages=0
4804 !! wikitext
4805 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4806 !! html
4807 <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>
4808 </p>
4809 !! end
4810
4811 !! test
4812 Link to non-http image, no img tag
4813 !! wikitext
4814 Link to non-http image, no img tag: ftp://example.com/test.jpg
4815 !! html
4816 <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>
4817 </p>
4818 !! end
4819
4820 !! test
4821 External links: terminating separator
4822 !! wikitext
4823 Terminating separator: http://example.com/thing,
4824 !! html
4825 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4826 </p>
4827 !! end
4828
4829 !! test
4830 External links: intervening separator
4831 !! wikitext
4832 Intervening separator: http://example.com/1,2,3
4833 !! html
4834 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4835 </p>
4836 !! end
4837
4838 !! test
4839 External links: old bug with URL in query
4840 !! wikitext
4841 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4842 !! html
4843 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4844 </p>
4845 !! end
4846
4847 !! test
4848 External links: old URL-in-URL bug, mixed protocols
4849 !! wikitext
4850 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4851 !! html
4852 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4853 </p>
4854 !!end
4855
4856 # Since Parsoid is starting to emit canonical wikitext for links,
4857 # [http://example.com http://example.com] will not RT back to that
4858 # form anymore.
4859 !! test
4860 External links: URL in text
4861 !! options
4862 parsoid=wt2html
4863 !! wikitext
4864 URL in text: [http://example.com http://example.com]
4865 !! html/php
4866 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4867 </p>
4868 !! html/parsoid
4869 <p>URL in text: <a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4870 !! end
4871
4872 !! test
4873 External links: Clickable images
4874 !! wikitext
4875 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4876 !! html/php
4877 <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>
4878 </p>
4879 !! html/parsoid
4880 <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>
4881 !! end
4882
4883 !! test
4884 External links: raw ampersand
4885 !! wikitext
4886 Old &amp; use: http://x&y
4887 !! html
4888 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4889 </p>
4890 !! end
4891
4892 !! test
4893 External links: encoded ampersand
4894 !! wikitext
4895 Old &amp; use: http://x&amp;y
4896 !! html/php
4897 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4898 </p>
4899 !! html/parsoid
4900 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4901 !! end
4902
4903 !! test
4904 External links: encoded equals (bug 6102)
4905 !! wikitext
4906 http://example.com/?foo&#61;bar
4907 !! html/php
4908 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4909 </p>
4910 !! html/parsoid
4911 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4912 !! end
4913
4914 ##
4915 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4916 ## does it number them. As discussed in bug 53505, we can identify
4917 ## autonumbered links via CSS.
4918 ##
4919
4920 !! test
4921 External links: [raw ampersand]
4922 !! wikitext
4923 Old &amp; use: [http://x&y]
4924 !! html/php
4925 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4926 </p>
4927 !! html/parsoid
4928 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4929 !! end
4930
4931 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4932 # mode will return the [raw ampersand] wikitext
4933 !! test
4934 External links: [encoded ampersand]
4935 !! options
4936 parsoid=wt2html,wt2wt,html2html
4937 !! wikitext
4938 Old &amp; use: [http://x&amp;y]
4939 !! html/php
4940 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4941 </p>
4942 !! html/parsoid
4943 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4944 !! end
4945
4946 !! test
4947 External links: [raw equals]
4948 !! wikitext
4949 [http://example.com/?foo=bar]
4950 !! html/php
4951 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4952 </p>
4953 !! html/parsoid
4954 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4955 !! end
4956
4957 # note that parsoid html is identical to [raw equals] case; so html2wt
4958 # mode will return the [raw equals] wikitext
4959 !! test
4960 External links: [encoded equals] (bug 6102)
4961 !! options
4962 parsoid=wt2html,wt2wt,html2html
4963 !! wikitext
4964 [http://example.com/?foo&#61;bar]
4965 !! html/php
4966 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4967 </p>
4968 !! html/parsoid
4969 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4970 !! end
4971
4972 # xxx parsoid strips the IDN character, so the round-trip tests will
4973 # obviously fail and are disabled. --cscott
4974 !! test
4975 External links: [IDN ignored character reference in hostname; strip it right off]
4976 !! options
4977 parsoid=wt2html,wt2wt,html2html
4978 !! wikitext
4979 [http://e&zwnj;xample.com/]
4980 !! html/php
4981 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4982 </p>
4983 !! html/parsoid
4984 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4985 !! end
4986
4987 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4988 # Where an external link could easily circumvent the sanitization of the text of
4989 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4990 # test demands a higher standard. That's a bit strange.
4991 #
4992 # Example:
4993 #
4994 # http://e‌xample.com -> [http://example.com|http://example.com]
4995 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4996 #
4997 # The first example is sanitized, but the second is not. Any security benefits
4998 # from this production are trivial to circumvent. Either remove this test and
4999 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5000 # the test accordingly.
5001 #
5002 # All our love,
5003 # The Parsoid team.
5004 # xxx parsoid strips the IDN character, so the round-trip tests will
5005 # obviously fail and are disabled. --cscott
5006 !! test
5007 External links: IDN ignored character reference in hostname; strip it right off
5008 !! options
5009 parsoid=wt2html,html2html
5010 !! wikitext
5011 http://e&zwnj;xample.com/
5012 !! html/php
5013 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5014 </p>
5015 !! html/parsoid
5016 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
5017 !! end
5018
5019 !! test
5020 External links: www.jpeg.org (bug 554)
5021 !! wikitext
5022 http://www.jpeg.org
5023 !! html
5024 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5025 </p>
5026 !! end
5027
5028 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
5029 !! test
5030 External links: URL within URL (original bug 2)
5031 !! wikitext
5032 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5033 !! html/php
5034 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5035 </p>
5036 !! html/parsoid
5037 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5038 !! end
5039
5040 !! test
5041 BUG 361: URL inside bracketed URL
5042 !! wikitext
5043 [http://www.example.com/foo http://www.example.com/bar]
5044 !! html
5045 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5046 </p>
5047 !! end
5048
5049 !! test
5050 BUG 361: URL within URL, not bracketed
5051 !! wikitext
5052 http://www.example.com/foo?=http://www.example.com/bar
5053 !! html
5054 <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>
5055 </p>
5056 !! end
5057
5058 !! test
5059 BUG 289: ">"-token in URL-tail
5060 !! wikitext
5061 http://www.example.com/<hello>
5062 !! html
5063 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5064 </p>
5065 !!end
5066
5067 !! test
5068 BUG 289: literal ">"-token in URL-tail
5069 !! wikitext
5070 http://www.example.com/<b>html</b>
5071 !! html/php
5072 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5073 </p>
5074 !! html/parsoid
5075 <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>
5076 !! end
5077
5078 !! test
5079 BUG 289: ">"-token in bracketed URL
5080 !! wikitext
5081 [http://www.example.com/<hello> stuff]
5082 !! html
5083 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5084 </p>
5085 !!end
5086
5087 !! test
5088 BUG 289: literal ">"-token in bracketed URL
5089 !! wikitext
5090 [http://www.example.com/<b>html</b> stuff]
5091 !! html
5092 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5093 </p>
5094 !!end
5095
5096 !! test
5097 BUG 289: literal double quote at end of URL
5098 !! wikitext
5099 http://www.example.com/"hello"
5100 !! html
5101 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5102 </p>
5103 !!end
5104
5105 !! test
5106 BUG 289: literal double quote in bracketed URL
5107 !! wikitext
5108 [http://www.example.com/"hello" stuff]
5109 !! html
5110 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5111 </p>
5112 !!end
5113
5114 !! test
5115 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5116 !! wikitext
5117 [http://www.example.com test]
5118 !! html
5119 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5120 </p>
5121 !! end
5122
5123 !! test
5124 External links: link text with spaces
5125 !! wikitext
5126 [http://www.example.com a b c]
5127 [http://www.example.com ''a'' ''b'']
5128 !! html
5129 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5130 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5131 </p>
5132 !! end
5133
5134 !! test
5135 External links: wiki links within external link (Bug 3695)
5136 !! options
5137 parsoid=wt2html,html2html
5138 !! wikitext
5139 [http://example.com [[wikilink]] embedded in ext link]
5140 !! html/php
5141 <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>
5142 </p>
5143 !! html/parsoid
5144 <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>
5145 !! end
5146
5147 !! test
5148 BUG 787: Links with one slash after the url protocol are invalid
5149 !! wikitext
5150 http:/example.com
5151
5152 [http:/example.com title]
5153 !! html
5154 <p>http:/example.com
5155 </p><p>[http:/example.com title]
5156 </p>
5157 !! end
5158
5159 !! test
5160 Bracketed external links with template-generated invalid target
5161 !! wikitext
5162 [{{echo|http:/example.com}} title]
5163 !! html
5164 <p>[http:/example.com title]
5165 </p>
5166 !! end
5167
5168 !! test
5169 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5170 !! wikitext
5171 ''[http://example.com text'']
5172 [http://example.com '''text]'''
5173 ''Something [http://example.com in italic'']
5174 ''Something [http://example.com mixed''''', even bold]'''
5175 '''''Now [http://example.com both''''']
5176 !! html
5177 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5178 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5179 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5180 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5181 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5182 </p>
5183 !! end
5184
5185
5186 !! test
5187 Bug 4781: %26 in URL
5188 !! wikitext
5189 http://www.example.com/?title=AT%26T
5190 !! html/php
5191 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5192 </p>
5193 !! html/parsoid
5194 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5195 !! end
5196
5197 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5198 # % is actually legal in HTML5. Any change in output would need testing though.
5199 !! test
5200 Bug 4781, 5267: %25 in URL
5201 !! wikitext
5202 http://www.example.com/?title=100%25_Bran
5203 !! html/php
5204 <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>
5205 </p>
5206 !! html/parsoid
5207 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5208 !! end
5209
5210 !! test
5211 Bug 4781, 5267: %28, %29 in URL
5212 !! wikitext
5213 http://www.example.com/?title=Ben-Hur_%281959_film%29
5214 !! html/php
5215 <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>
5216 </p>
5217 !! html/parsoid
5218 <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>
5219 !! end
5220
5221
5222 !! test
5223 Bug 4781: %26 in autonumber URL
5224 !! wikitext
5225 [http://www.example.com/?title=AT%26T]
5226 !! html/php
5227 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5228 </p>
5229 !! html/parsoid
5230 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5231 !! end
5232
5233 !! test
5234 Bug 4781, 5267: %26 in autonumber URL
5235 !! wikitext
5236 [http://www.example.com/?title=100%25_Bran]
5237 !! html/php
5238 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5239 </p>
5240 !! html/parsoid
5241 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5242 !! end
5243
5244 !! test
5245 Bug 4781, 5267: %28, %29 in autonumber URL
5246 !! wikitext
5247 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5248 !! html/php
5249 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5250 </p>
5251 !! html/parsoid
5252 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5253 !! end
5254
5255
5256 !! test
5257 Bug 4781: %26 in bracketed URL
5258 !! wikitext
5259 [http://www.example.com/?title=AT%26T link]
5260 !! html/php
5261 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5262 </p>
5263 !! html/parsoid
5264 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5265 !! end
5266
5267 !! test
5268 Bug 4781, 5267: %25 in bracketed URL
5269 !! wikitext
5270 [http://www.example.com/?title=100%25_Bran link]
5271 !! html
5272 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5273 </p>
5274 !! end
5275
5276 !! test
5277 Bug 4781, 5267: %28, %29 in bracketed URL
5278 !! wikitext
5279 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5280 !! html/php
5281 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5282 </p>
5283 !! html/parsoid
5284 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5285 !! end
5286
5287 !! test
5288 External link containing a period in the anchor. (bug 63947)
5289 !! wikitext
5290 [//foo.org/bar#baz. bang]
5291
5292 [//foo.org/bar. bang]
5293 !! html/php
5294 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5295 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5296 </p>
5297 !! html/parsoid
5298 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5299 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5300 !! end
5301
5302 !! test
5303 External link containing a single quote. (bug 63947)
5304 !! wikitext
5305 [//foo.org/bar'baz]
5306
5307 [//foo.org/bar'baz bang]
5308 !! html/php
5309 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5310 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5311 </p>
5312 !! html/parsoid
5313 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5314 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5315 !! end
5316
5317 !! test
5318 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5319 !! wikitext
5320 Some [http://example.com/ pretty ''italics'' and stuff]!
5321 !! html
5322 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5323 </p>
5324 !! end
5325
5326 !! test
5327 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5328 !! wikitext
5329 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5330 !! html
5331 <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>
5332 </p>
5333 !! end
5334
5335 !! test
5336 External link containing double-single-quotes with no space separating the url from text in italics
5337 !! wikitext
5338 [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]].]
5339 !! html/php
5340 <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>
5341 </p>
5342 !! html/php+tidy
5343 <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>
5344 !! html/parsoid
5345 <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>
5346 !! end
5347
5348 !! test
5349 External link with comments in link text
5350 !! wikitext
5351 [http://www.google.com Google <!-- comment -->]
5352 !! html/php
5353 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5354 </p>
5355 !! html/parsoid
5356 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5357 !! end
5358
5359 !! test
5360 External link to bare IPv4 address
5361 !! wikitext
5362 [http://192.168.0.1 Link]
5363 !! html/php
5364 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5365 </p>
5366 !! html/parsoid
5367 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5368 !! end
5369
5370 !! test
5371 URL-encoding in URL functions (single parameter)
5372 !! wikitext
5373 {{localurl:Some page|amp=&}}
5374 !! html
5375 <p>/index.php?title=Some_page&amp;amp=&amp;
5376 </p>
5377 !! end
5378
5379 !! test
5380 URL-encoding in URL functions (multiple parameters)
5381 !! wikitext
5382 {{localurl:Some page|q=?&amp=&}}
5383 !! html
5384 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5385 </p>
5386 !! end
5387
5388 !! test
5389 Brackets in urls
5390 !! wikitext
5391 http://example.com/index.php?foozoid%5B%5D=bar
5392
5393 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5394 !! html/php
5395 <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>
5396 </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>
5397 </p>
5398 !! html/parsoid
5399 <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>
5400
5401 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5402 !! end
5403
5404 !! test
5405 IPv6 urls, autolink format (T23261)
5406 !! wikitext
5407 http://[2404:130:0:1000::187:2]/index.php
5408
5409 Examples from RFC 2373, section 2.2:
5410 * http://[1080::8:800:200C:417A]/unicast
5411 * http://[FF01::101]/multicast
5412 * http://[::1]/loopback
5413 * http://[::]/unspecified
5414 * http://[::13.1.68.3]/ipv4compat
5415 * http://[::FFFF:129.144.52.38]/ipv4compat
5416
5417 Examples from RFC 2732, section 2:
5418 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5419 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5420 * http://[3ffe:2a00:100:7031::1]
5421 * http://[1080::8:800:200C:417A]/foo
5422 * http://[::192.9.5.5]/ipng
5423 * http://[::FFFF:129.144.52.38]:80/index.html
5424 * http://[2010:836B:4179::836B:4179]
5425
5426 !! html/php
5427 <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>
5428 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5429 </p>
5430 <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>
5431 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5432 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5433 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5434 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5435 <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>
5436 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5437 </p>
5438 <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>
5439 <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>
5440 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5441 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5442 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5443 <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>
5444 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5445
5446 !! html/parsoid
5447 <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>
5448
5449 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5450 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5451 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5452 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5453 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5454 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5455 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5456
5457 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5458 <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>
5459 <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>
5460 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5461 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5462 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5463 <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>
5464 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5465 !! end
5466
5467 !! test
5468 IPv6 urls, bracketed format (T23261)
5469 !! wikitext
5470 [http://[2404:130:0:1000::187:2]/index.php test]
5471
5472 Examples from RFC 2373, section 2.2:
5473 * [http://[1080::8:800:200C:417A] unicast]
5474 * [http://[FF01::101] multicast]
5475 * [http://[::1]/ loopback]
5476 * [http://[::] unspecified]
5477 * [http://[::13.1.68.3] ipv4compat]
5478 * [http://[::FFFF:129.144.52.38] ipv4compat]
5479
5480 Examples from RFC 2732, section 2:
5481 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5482 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5483 * [http://[3ffe:2a00:100:7031::1] 3]
5484 * [http://[1080::8:800:200C:417A]/foo 4]
5485 * [http://[::192.9.5.5]/ipng 5]
5486 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5487 * [http://[2010:836B:4179::836B:4179] 7]
5488
5489 !! html/php
5490 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5491 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5492 </p>
5493 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5494 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5495 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5496 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5497 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5498 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5499 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5500 </p>
5501 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5502 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5503 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5504 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5505 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5506 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5507 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5508
5509 !! html/parsoid
5510 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5511
5512 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5513 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5514 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5515 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5516 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5517 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5518 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5519
5520 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5521 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5522 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5523 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5524 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5525 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5526 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5527 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5528 !! end
5529
5530 !! test
5531 Non-extlinks in brackets
5532 !! wikitext
5533 [foo]
5534 [foo bar]
5535 [foo ''bar'']
5536 [fool's] errand
5537 [fool's errand]
5538 [{{echo|foo}}]
5539 [{{echo|foo}} bar]
5540 [{{echo|foo}} ''bar'']
5541 [{{echo|foo}}l's] errand
5542 [{{echo|foo}}l's errand]
5543 [url={{echo|foo}}]
5544 [url=http://example.com]
5545 [http:// bare protocols don't count]
5546 !! html/php
5547 <p>[foo]
5548 [foo bar]
5549 [foo <i>bar</i>]
5550 [fool's] errand
5551 [fool's errand]
5552 [foo]
5553 [foo bar]
5554 [foo <i>bar</i>]
5555 [fool's] errand
5556 [fool's errand]
5557 [url=foo]
5558 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5559 [http:// bare protocols don't count]
5560 </p>
5561 !! html/parsoid
5562 <p>[foo]
5563 [foo bar]
5564 [foo <i>bar</i>]
5565 [fool's] errand
5566 [fool's errand]
5567 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5568 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5569 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5570 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5571 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5572 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5573 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5574 [http:// bare protocols don't count]</p>
5575 !! end
5576
5577 !! test
5578 Percent encoding in external links
5579 !! wikitext
5580 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5581 !! html/php
5582 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5583 </p>
5584 !! html/parsoid
5585 <p><a rel="mw:ExtLink"
5586 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5587 !! end
5588
5589 !! test
5590 Use url link syntax for links where the content is equal the link target
5591 !! wikitext
5592 http://example.com
5593 !! html/php
5594 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5595 </p>
5596 !! html/parsoid
5597 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5598 !! end
5599
5600 !! test
5601 Parenthesis in external links, especially URL links
5602 !! wikitext
5603 http://example.com)
5604
5605 http://example.com/test)
5606
5607 http://example.com/(test)
5608
5609 http://example.com/((test)
5610
5611 (http://example.com/(test))
5612
5613 (http://example.com/(test)))))
5614
5615 http://example.com/a)b
5616
5617 [http://example.com) foo]
5618 !! html/php
5619 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</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/(test)">http://example.com/(test)</a>
5622 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5623 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5624 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5625 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5626 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5627 </p>
5628 !! html/parsoid
5629 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</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/(test)">http://example.com/(test)</a></p>
5632 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5633 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5634 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5635 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5636 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5637 !! end
5638
5639 !! test
5640 Parenthesis in external links, w/ transclusion or comment
5641 !! wikitext
5642 (http://example.com/{{echo|hi}})
5643
5644 (http://example.com<!-- hi -->)
5645 !! html/php
5646 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5647 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5648 </p>
5649 !! html/parsoid
5650 <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>
5651
5652 <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>
5653 !! end
5654
5655 !! test
5656 Serialize <a> tags with invalid link targets as plain text
5657 !! options
5658 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5659 !! html/parsoid
5660 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5661 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5662 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5663 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5664 !! wikitext
5665 text
5666 <nowiki>*</nowiki>text
5667 <nowiki>[[foo]]</nowiki>
5668 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5669 !! end
5670
5671 !! test
5672 mw:ExtLink -vs- mw:WikiLink (T94723)
5673 !! options
5674 parsoid=html2wt
5675 !! html/parsoid
5676 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5677 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5678 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5679 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5680 <p>
5681 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5682 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5683 </p>
5684 !! wikitext
5685 [[Foo|Bar]]
5686 [[Foo|Bar]]
5687 [[wikipedia:Foo|Bar]]
5688 [[wikipedia:Foo|Bar]]
5689
5690 [[wikipedia:European_Robin|European Robin]]
5691 [[wikipedia:European_Robin|European Robin]]
5692 !! end
5693
5694 !! test
5695 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5696 !! options
5697 parsoid=wt2wt
5698 !! wikitext
5699 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5700 !! html/parsoid
5701 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5702 !! end
5703
5704
5705 ###
5706 ### Quotes
5707 ###
5708
5709 !! test
5710 Quotes
5711 !! wikitext
5712 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5713
5714 Normal text. '''''Bold italic text.''''' Normal text.
5715 !! html
5716 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5717 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5718 </p>
5719 !! end
5720
5721
5722 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5723 # parser strips. The wikitext contains just the first half of the bold
5724 # quote pair.
5725 !! test
5726 Unclosed and unmatched quotes
5727 !! wikitext
5728 '''''Bold italic text '''with bold deactivated''' in between.'''''
5729
5730 '''''Bold italic text ''with italic deactivated'' in between.'''''
5731
5732 '''Bold text..
5733
5734 ..spanning two paragraphs (should not work).'''
5735
5736 '''Bold tag left open
5737
5738 ''Italic tag left open
5739
5740 Normal text.
5741
5742 <!-- Unmatching number of opening, closing tags: -->
5743 '''This year''''s election ''should'' beat '''last year''''s.
5744
5745 ''Tom'''s car is bigger than ''Susan'''s.
5746
5747 Plain ''italic'''s plain
5748 !! html/php
5749 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5750 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5751 </p><p><b>Bold text..</b>
5752 </p><p>..spanning two paragraphs (should not work).
5753 </p><p><b>Bold tag left open</b>
5754 </p><p><i>Italic tag left open</i>
5755 </p><p>Normal text.
5756 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5757 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5758 </p><p>Plain <i>italic'</i>s plain
5759 </p>
5760 !! html/parsoid
5761 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5762 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5763 </p><p><b>Bold text..</b>
5764 </p><p>..spanning two paragraphs (should not work).<b></b>
5765 </p><p><b>Bold tag left open</b>
5766 </p><p><i>Italic tag left open</i>
5767 </p><p>Normal text.
5768 </p>
5769 <!-- Unmatching number of opening, closing tags: -->
5770 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5771 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5772 </p><p>Plain <i>italic'</i>s plain
5773 </p>
5774 !! end
5775
5776 ###
5777 ### Tables
5778 ###
5779 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5780 ###
5781
5782 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5783 # is the bare minimum required by the spec, see:
5784 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5785 # Parsoid team replies: empty table tags are legal in HTML5
5786 !! test
5787 A table with no data.
5788 !! options
5789 parsoid=wt2html
5790 !! wikitext
5791 {||}
5792 !! html/php
5793
5794 !! html/parsoid
5795 <table></table>
5796
5797 !! end
5798
5799 !! test
5800 A table with stray table end tags on start tag line (wt2html)
5801 !! options
5802 parsoid=wt2html
5803 !! wikitext
5804 {|style="color: red;"|}
5805
5806 {|style="color: red;" |}
5807 |foo
5808 |}
5809
5810 {|style="color: red;"|} id="foo"
5811 |foo
5812 |}
5813
5814 {|style="color: red;" |} id="foo"
5815 |foo
5816 |}
5817 !! html
5818 <table style="color: red;"></table>
5819
5820 <table style="color: red;">
5821 <tbody><tr>
5822 <td>foo</td>
5823 </tr></tbody>
5824 </table>
5825
5826 <table style="color: red;" id="foo">
5827 <tbody><tr>
5828 <td>foo</td>
5829 </tr></tbody>
5830 </table>
5831
5832 <table style="color: red;" id="foo">
5833 <tbody><tr>
5834 <td>foo</td>
5835 </tr></tbody>
5836 </table>
5837
5838 !! end
5839
5840 !! test
5841 A table with no data (take 2)
5842 !! wikitext
5843 {|
5844 |}
5845 !! html/parsoid
5846 <table></table>
5847 !! end
5848
5849 # A table with nothing but a caption is invalid XHTML, we might want to render
5850 # this as <p>caption</p>
5851 # Parsoid team replies: table with only a caption is legal in HTML5
5852 !! test
5853 A table with nothing but a caption
5854 !! wikitext
5855 {|
5856 |+ caption
5857 |}
5858 !! html/php
5859 <table>
5860 <caption> caption
5861 </caption><tr><td></td></tr></table>
5862
5863 !! html/parsoid
5864 <table><caption> caption</caption></table>
5865 !! end
5866
5867 !! test
5868 A table with caption with default-spaced attributes and a table row
5869 !! wikitext
5870 {|
5871 |+ style="color: red;" | caption1
5872 |-
5873 | foo
5874 |}
5875 !! html
5876 <table>
5877 <caption style="color: red;"> caption1
5878 </caption>
5879 <tr>
5880 <td> foo
5881 </td></tr></table>
5882
5883 !! end
5884
5885 !! test
5886 A table with captions with non-default spaced attributes and a table row
5887 !! wikitext
5888 {|
5889 |+style="color: red;"|caption2
5890 |+ style="color: red;"| caption3
5891 |-
5892 | foo
5893 |}
5894 !! html
5895 <table>
5896 <caption style="color: red;">caption2
5897 </caption>
5898 <caption style="color: red;"> caption3
5899 </caption>
5900 <tr>
5901 <td> foo
5902 </td></tr></table>
5903
5904 !! end
5905
5906 !! test
5907 Table td-cell syntax variations
5908 !! wikitext
5909 {|
5910 | foo bar foo | baz
5911 | foo bar foo || baz
5912 | style='color:red;' | baz
5913 | style='color:red;' || baz
5914 |}
5915 !! html
5916 <table>
5917 <tr>
5918 <td> baz
5919 </td>
5920 <td> foo bar foo </td>
5921 <td> baz
5922 </td>
5923 <td style="color:red;"> baz
5924 </td>
5925 <td> style='color:red;' </td>
5926 <td> baz
5927 </td></tr></table>
5928
5929 !! end
5930
5931 !! test
5932 Simple table
5933 !! wikitext
5934 {|
5935 | 1 || 2
5936 |-
5937 | 3 || 4
5938 |}
5939 !! html
5940 <table>
5941 <tr>
5942 <td> 1 </td>
5943 <td> 2
5944 </td></tr>
5945 <tr>
5946 <td> 3 </td>
5947 <td> 4
5948 </td></tr></table>
5949
5950 !! end
5951
5952 !! test
5953 Simple table but with multiple dashes for row wikitext
5954 !! wikitext
5955 {|
5956 | foo
5957 |-----
5958 | bar
5959 |}
5960 !! html
5961 <table>
5962 <tr>
5963 <td> foo
5964 </td></tr>
5965 <tr>
5966 <td> bar
5967 </td></tr></table>
5968
5969 !! end
5970
5971 !! test
5972 Multiplication table
5973 !! wikitext
5974 {| border="1" cellpadding="2"
5975 |+Multiplication table
5976 |-
5977 ! &times; !! 1 !! 2 !! 3
5978 |-
5979 ! 1
5980 | 1 || 2 || 3
5981 |-
5982 ! 2
5983 | 2 || 4 || 6
5984 |-
5985 ! 3
5986 | 3 || 6 || 9
5987 |-
5988 ! 4
5989 | 4 || 8 || 12
5990 |-
5991 ! 5
5992 | 5 || 10 || 15
5993 |}
5994 !! html
5995 <table border="1" cellpadding="2">
5996 <caption>Multiplication table
5997 </caption>
5998 <tr>
5999 <th> &#215; </th>
6000 <th> 1 </th>
6001 <th> 2 </th>
6002 <th> 3
6003 </th></tr>
6004 <tr>
6005 <th> 1
6006 </th>
6007 <td> 1 </td>
6008 <td> 2 </td>
6009 <td> 3
6010 </td></tr>
6011 <tr>
6012 <th> 2
6013 </th>
6014 <td> 2 </td>
6015 <td> 4 </td>
6016 <td> 6
6017 </td></tr>
6018 <tr>
6019 <th> 3
6020 </th>
6021 <td> 3 </td>
6022 <td> 6 </td>
6023 <td> 9
6024 </td></tr>
6025 <tr>
6026 <th> 4
6027 </th>
6028 <td> 4 </td>
6029 <td> 8 </td>
6030 <td> 12
6031 </td></tr>
6032 <tr>
6033 <th> 5
6034 </th>
6035 <td> 5 </td>
6036 <td> 10 </td>
6037 <td> 15
6038 </td></tr></table>
6039
6040 !! end
6041
6042 !! test
6043 Accept "||" in table headings
6044 !! wikitext
6045 {|
6046 !h1 || h2
6047 |}
6048 !! html
6049 <table>
6050 <tr>
6051 <th>h1 </th>
6052 <th> h2
6053 </th></tr></table>
6054
6055 !! end
6056
6057 !! test
6058 Accept "!!" in table data
6059 !! wikitext
6060 {|
6061 | Foo!! ||
6062 |}
6063 !! html
6064 <table>
6065 <tr>
6066 <td> Foo!! </td>
6067 <td>
6068 </td></tr></table>
6069
6070 !! html/parsoid
6071 <table>
6072 <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>
6073 </tbody></table>
6074 !! end
6075
6076 !! test
6077 Accept "||" in indented table headings
6078 !! wikitext
6079 :{|
6080 !h1 || h2
6081 |}
6082 !! html
6083 <dl><dd><table>
6084 <tr>
6085 <th>h1 </th>
6086 <th> h2
6087 </th></tr></table></dd></dl>
6088
6089 !! end
6090
6091 !! test
6092 Accept "!!" in templates
6093 !! wikitext
6094 {|
6095 !a {{echo|b!!c}}
6096 |}
6097 !! html/php
6098 <table>
6099 <tr>
6100 <th>a b</th>
6101 <th>c
6102 </th></tr></table>
6103
6104 !! html/parsoid
6105 <table>
6106 <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>
6107 !! end
6108
6109 !! test
6110 Accept "!!" in table headings after newline
6111 !! wikitext
6112 {|
6113 !a
6114 b!!c
6115 |}
6116 !! html/php
6117 <table>
6118 <tr>
6119 <th>a
6120 <p>b!!c
6121 </p>
6122 </th></tr></table>
6123
6124 !! html/parsoid
6125 <table>
6126 <tbody><tr><th>a
6127 <p>b!!c</p></th></tr>
6128 </tbody></table>
6129 !! end
6130
6131 !! test
6132 Accept "!!" in table data of mixed wikitext / html syntax
6133 !! wikitext
6134 {|
6135 !a
6136 <tr><td>b!!c</td></tr>
6137 |}
6138 !! html+tidy
6139 <table>
6140 <tr>
6141 <th>a</th>
6142 </tr>
6143 <tr>
6144 <td>b!!c</td>
6145 </tr>
6146 </table>
6147 !! html/parsoid
6148 <table>
6149 <tbody><tr><th>a</th></tr>
6150 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6151 </tbody></table>
6152 !! end
6153
6154 !! test
6155 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6156 !! wikitext
6157 {|
6158 !| h1
6159 || a
6160 |}
6161 !! html
6162 <table>
6163 <tr>
6164 <th> h1
6165 </th>
6166 <td> a
6167 </td></tr></table>
6168
6169 !! end
6170
6171 !!test
6172 Accept "| !" at start of line in tables (ignore !-attribute)
6173 !! wikitext
6174 {|
6175 |-
6176 | !style="color:red" | bar
6177 |}
6178 !! html
6179 <table>
6180
6181 <tr>
6182 <td> bar
6183 </td></tr></table>
6184
6185 !!end
6186
6187 !!test
6188 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 +/-
6189 !! wikitext
6190 {|
6191 |-
6192 |style='color:red;'|+1
6193 |style='color:blue;'|-1
6194 |-
6195 | 1 || 2 || 3
6196 | 1 ||+2 ||-3
6197 |-
6198 | +1
6199 | -1
6200 |}
6201 !! html
6202 <table>
6203
6204 <tr>
6205 <td style="color:red;">+1
6206 </td>
6207 <td style="color:blue;">-1
6208 </td></tr>
6209 <tr>
6210 <td> 1 </td>
6211 <td> 2 </td>
6212 <td> 3
6213 </td>
6214 <td> 1 </td>
6215 <td>+2 </td>
6216 <td>-3
6217 </td></tr>
6218 <tr>
6219 <td> +1
6220 </td>
6221 <td> -1
6222 </td></tr></table>
6223
6224 !!end
6225
6226 !! test
6227 Table rowspan
6228 !! wikitext
6229 {| border=1
6230 | Cell 1, row 1
6231 |rowspan=2| Cell 2, row 1 (and 2)
6232 | Cell 3, row 1
6233 |-
6234 | Cell 1, row 2
6235 | Cell 3, row 2
6236 |}
6237 !! html
6238 <table border="1">
6239 <tr>
6240 <td> Cell 1, row 1
6241 </td>
6242 <td rowspan="2"> Cell 2, row 1 (and 2)
6243 </td>
6244 <td> Cell 3, row 1
6245 </td></tr>
6246 <tr>
6247 <td> Cell 1, row 2
6248 </td>
6249 <td> Cell 3, row 2
6250 </td></tr></table>
6251
6252 !! end
6253
6254 !! test
6255 Nested table
6256 !! wikitext
6257 {| border=1
6258 | &alpha;
6259 |
6260 {| bgcolor=#ABCDEF border=2
6261 |nested
6262 |-
6263 |table
6264 |}
6265 |the original table again
6266 |}
6267 !! html
6268 <table border="1">
6269 <tr>
6270 <td> &#945;
6271 </td>
6272 <td>
6273 <table bgcolor="#ABCDEF" border="2">
6274 <tr>
6275 <td>nested
6276 </td></tr>
6277 <tr>
6278 <td>table
6279 </td></tr></table>
6280 </td>
6281 <td>the original table again
6282 </td></tr></table>
6283
6284 !! end
6285
6286 !! test
6287 Invalid attributes in table cell (bug 1830)
6288 !! wikitext
6289 {|
6290 |Cell:|broken
6291 |}
6292 !! html
6293 <table>
6294 <tr>
6295 <td>broken
6296 </td></tr></table>
6297
6298 !! end
6299
6300 !! test
6301 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6302 !! wikitext
6303 {|
6304 | title="foo" |bar
6305 | title="foo<nowiki>|</nowiki>" |bar
6306 | title="foo<nowiki>|</nowiki>" bar
6307 |}
6308 !! html/php
6309 <table>
6310 <tr>
6311 <td title="foo">bar
6312 </td>
6313 <td title="foo&#124;">bar
6314 </td>
6315 <td> title="foo|" bar
6316 </td></tr></table>
6317
6318 !! html/parsoid
6319 <table>
6320 <tbody><tr><td title="foo">bar</td>
6321 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6322 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6323 </tbody></table>
6324 !! end
6325
6326 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6327 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6328 # *2wt modes will fail.
6329 !! test
6330 Table security: embedded pipes
6331 !! options
6332 parsoid=wt2html,html2html
6333 !! wikitext
6334 {|
6335 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6336 !! html/php
6337 <table>
6338 <tr>
6339 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6340 <td>]" onmouseover="alert(document.cookie)"&gt;test
6341 </td>
6342 </tr>
6343 </table>
6344
6345 !! html/parsoid
6346 <table><tbody>
6347 <tr>
6348 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6349 !! end
6350
6351 !! test
6352 Element attributes with double ! should not be broken up by <th>
6353 !! wikitext
6354 {|
6355 ! hi <div class="!!">ha</div> ho
6356 |}
6357 !! html/php
6358 <table>
6359 <tr>
6360 <th> hi <div class="!!">ha</div> ho
6361 </th></tr></table>
6362
6363 !! html/parsoid
6364 <table>
6365 <tbody><tr><th> hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6366 </tbody></table>
6367 !! end
6368
6369 !! test
6370 ! and || in element attributes should not be parsed as <th>/<td>
6371 !! wikitext
6372 {|
6373 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6374 |}
6375 !! html/php
6376 <table>
6377 <tr>
6378 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6379 </td></tr></table>
6380
6381 !! html/parsoid
6382 <table>
6383 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6384 </tbody></table>
6385 !! end
6386
6387 # FIXME: The output seems broken. Filed as T110268.
6388 !! test
6389 ! and || in td attributes should not be parsed as <th>/<td>
6390 !! options
6391 parsoid=wt2html
6392 !! wikitext
6393 {|
6394 | style="color: red !important;" data-contrived="put this here ||" | foo
6395 |}
6396 !! html/php
6397 <table>
6398 <tr>
6399 <td> style="color: red !important;" data-contrived="put this here </td>
6400 <td> foo
6401 </td></tr></table>
6402
6403 !! html/parsoid
6404 <table>
6405 <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>
6406 </tbody></table>
6407 !! end
6408
6409 !! test
6410 Break on | in element attribute in template
6411 !! options
6412 parsoid=wt2html,html2html
6413 !! wikitext
6414 {{echo|1=<div class="hi|ho">ha</div>}}
6415 !! html/php
6416 <p>ho"&gt;ha&lt;/div&gt;
6417 </p>
6418 !! html/parsoid
6419 <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>
6420 !! end
6421
6422 ## We don't support roundtripping of these attributes in Parsoid.
6423 ## Selective serialization takes care of preventing dirty diffs.
6424 ## But, on edits, we dirty-diff the invalid attribute text.
6425 !! test
6426 Invalid text in table attributes should be discarded
6427 !! options
6428 parsoid=wt2html
6429 !! wikitext
6430 {| <span>boo</span> style='border:1px solid black'
6431 | <span>boo</span> style='color:blue' | 1
6432 |<span>boo</span> style='color:blue'| 2
6433 |}
6434 !! html/php
6435 <table style="border:1px solid black">
6436 <tr>
6437 <td style="color:blue"> 1
6438 </td>
6439 <td style="color:blue"> 2
6440 </td></tr></table>
6441
6442 !! html/parsoid
6443 <table style="border:1px solid black">
6444 <tr>
6445 <td style="color:blue"> 1</td>
6446 <td style="color:blue"> 2</td>
6447 </tr>
6448 </table>
6449 !! end
6450
6451 !! test
6452 Invalid text in table attributes should be preserved by selective serializer
6453 !! options
6454 parsoid={
6455 "modes": ["selser"],
6456 "changes": [
6457 ["td:first-child", "text", "abc"],
6458 ["td + td", "text", "xyz"]
6459 ]
6460 }
6461 !! wikitext
6462 {| <span>boo</span> style='border:1px solid black'
6463 | <span>boo</span> style='color:blue' | 1
6464 |<span>boo</span> style='color:blue'| 2
6465 |}
6466 !! wikitext/edited
6467 {| <span>boo</span> style='border:1px solid black'
6468 | <span>boo</span> style='color:blue' |abc
6469 |<span>boo</span> style='color:blue'|xyz
6470 |}
6471 !! end
6472
6473 !! test
6474 1. Template-generated table cell attributes and cell content
6475 !! wikitext
6476 {|
6477 |{{table_attribs}}
6478 | {{table_attribs}}
6479 || {{table_attribs_5}}
6480 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6481 |align=center {{table_attribs}}
6482 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6483 |}
6484 !! html
6485 <table>
6486 <tr>
6487 <td style="color:red;">Foo
6488 </td>
6489 <td style="color:red;">Foo
6490 </td>
6491 <td> style="color:red;"</td>
6492 <td>Bar
6493 </td>
6494 <td style="color:red;">Foo
6495 </td>
6496 <td align="center" style="color:red;">Foo
6497 </td>
6498 <td align="center" style="color:red;">Foo
6499 </td></tr></table>
6500
6501 !! end
6502
6503 !! test
6504 2. Template-generated table cell attributes and cell content
6505 !! wikitext
6506 {|
6507 |{{table_attribs_2}}
6508 |}
6509 !! html/php
6510 <table>
6511 <tr>
6512 <td style="color:red;">Foo
6513 </td>
6514 <td>Bar</td>
6515 <td>Baz
6516 </td></tr></table>
6517
6518 !! html/parsoid
6519 <table>
6520 <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>
6521 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6522 </tbody></table>
6523 !! end
6524
6525 !! test
6526 3. Template-generated table cell attributes and cell content
6527 !! wikitext
6528 {|
6529 !align=center {{table_header_cells}}
6530 |-
6531 |align=center {{table_cells}}
6532 |}
6533 !! html/php
6534 <table>
6535 <tr>
6536 <th align="center" style="color:red;">Foo</th>
6537 <th style="color:red;"><i>Bar</i></th>
6538 <th style="color:brown;"><i>Foo</i> and Baz
6539 </th></tr>
6540 <tr>
6541 <td align="center" style="color:red;">Foo</td>
6542 <td style="color:red;"><i>Bar</i></td>
6543 <td style="color:brown;"><i>Foo</i> and Baz
6544 </td></tr></table>
6545
6546 !! html/parsoid
6547 <table>
6548 <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>
6549 <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>
6550 </tbody></table>
6551 !! end
6552
6553 !! test
6554 4. Template-generated table cell attributes and cell content inside a templated table
6555 !! wikitext
6556 {{tbl-start}}
6557 !align=center {{table_header_cells}}
6558 |-
6559 |align=center {{table_cells}}
6560 {{tbl-end}}
6561 !! html/php
6562 <table>
6563 <tr>
6564 <th align="center" style="color:red;">Foo</th>
6565 <th style="color:red;"><i>Bar</i></th>
6566 <th style="color:brown;"><i>Foo</i> and Baz
6567 </th></tr>
6568 <tr>
6569 <td align="center" style="color:red;">Foo</td>
6570 <td style="color:red;"><i>Bar</i></td>
6571 <td style="color:brown;"><i>Foo</i> and Baz
6572 </td></tr></table>
6573
6574 !! html/parsoid
6575 <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}}]}'>
6576 <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>
6577 <tr>
6578 <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>
6579 </tbody></table>
6580 !! end
6581
6582 ## Edge case fix to prevent future regressions
6583 !! test
6584 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6585 !! wikitext
6586 {|
6587 |{{table_attribs_7}}
6588 |}
6589 <references />
6590 !! html/parsoid
6591 <table>
6592 <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>
6593 </tbody></table>
6594 <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>
6595 !! end
6596
6597 !! test
6598 Table with row followed by newlines and table heading
6599 !! options
6600 parsoid=wt2html,html2html
6601 !! wikitext
6602 {|
6603 |-
6604
6605 ! foo
6606 |}
6607 !! html/*
6608 <table>
6609
6610
6611 <tr>
6612 <th> foo
6613 </th></tr></table>
6614
6615 !! end
6616
6617 !! test
6618 Table with empty line following the start tag
6619 !! options
6620 parsoid=wt2html,html2html
6621 !! wikitext
6622 {|
6623
6624 |-
6625 | foo
6626 |}
6627 !! html/*
6628 <table>
6629
6630
6631 <tr>
6632 <td> foo
6633 </td></tr></table>
6634
6635 !! end
6636
6637 !! test
6638 Table attributes with empty value
6639 !! options
6640 parsoid=wt2html,html2html
6641 !! wikitext
6642 {|
6643 | style=| hello
6644 |}
6645 !! html/php
6646 <table>
6647 <tr>
6648 <td style=""> hello
6649 </td></tr></table>
6650
6651 !! html/parsoid
6652 <table>
6653 <tbody><tr><td style=""> hello</td></tr>
6654 </tbody></table>
6655 !! end
6656
6657 !! test
6658 Wikitext table with a lot of comments
6659 !! wikitext
6660 {|
6661 <!-- c0 -->
6662 | foo
6663 <!-- c1 -->
6664 |-<!-- c2 -->
6665 <!-- c3 -->
6666 |<!-- c4 -->
6667 <!-- c5 -->
6668 |}
6669 !! html
6670 <table>
6671 <tr>
6672 <td> foo
6673 </td></tr>
6674 <tr>
6675 <td>
6676 </td></tr></table>
6677
6678 !! end
6679
6680 !! test
6681 Wikitext table comments represented in parsoid dom
6682 !! wikitext
6683 {|<!--c1--><!--c2-->
6684 |-<!--c3-->
6685 | x
6686 |}
6687 !! html/php+tidy
6688 <table>
6689 <tr>
6690 <td>x</td>
6691 </tr>
6692 </table>
6693 !! html/parsoid
6694 <table><!--c1--><!--c2-->
6695 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6696 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6697 </tbody></table>
6698 !! end
6699
6700 !! test
6701 Wikitext table with double-line table cell
6702 !! wikitext
6703 {|
6704 |a
6705 b
6706 |}
6707 !! html
6708 <table>
6709 <tr>
6710 <td>a
6711 <p>b
6712 </p>
6713 </td></tr></table>
6714
6715 !! end
6716
6717 !! test
6718 Table cell with a single comment
6719 !! wikitext
6720 {|
6721 | <!-- c1 -->
6722 | a
6723 |}
6724 !! html
6725 <table>
6726 <tr>
6727 <td>
6728 </td>
6729 <td> a
6730 </td></tr></table>
6731
6732 !! end
6733
6734 !! test
6735 Table-cell after a comment-only-empty-line
6736 !! wikitext
6737 {|
6738 |a
6739 <!--c1-->
6740 <!--c2-->| b
6741 |}
6742 !! html
6743 <table>
6744 <tr>
6745 <td>a
6746 </td>
6747 <td> b
6748 </td></tr></table>
6749
6750 !! html/parsoid
6751 <table>
6752 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6753 <!--c1-->
6754 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6755 </tbody></table>
6756
6757 !! end
6758
6759 !! test
6760 Build table with {{!}}
6761 !! wikitext
6762 {{{!}} class="wikitable"
6763 ! header
6764 ! second header
6765 {{!}}- style="color:red;"
6766 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6767 {{!}}}
6768 !! html
6769 <table class="wikitable">
6770 <tr>
6771 <th> header
6772 </th>
6773 <th> second header
6774 </th></tr>
6775 <tr style="color:red;">
6776 <td> data </td>
6777 <td style="color:red;"> second data
6778 </td></tr></table>
6779
6780 !! end
6781
6782 !! test
6783 Build table with pipe as data
6784 !! wikitext
6785 {| class="wikitable"
6786 ! header
6787 ! second header
6788 |- style="color:red;"
6789 | data || style="color:red;" | second data
6790 |-
6791 | style="color:red;" | data with | || style="color:red;" | second data with |
6792 |-
6793 || data with | ||| second data with |
6794 |}
6795 !! html
6796 <table class="wikitable">
6797 <tr>
6798 <th> header
6799 </th>
6800 <th> second header
6801 </th></tr>
6802 <tr style="color:red;">
6803 <td> data </td>
6804 <td style="color:red;"> second data
6805 </td></tr>
6806 <tr>
6807 <td style="color:red;"> data with | </td>
6808 <td style="color:red;"> second data with |
6809 </td></tr>
6810 <tr>
6811 <td> data with | </td>
6812 <td> second data with |
6813 </td></tr></table>
6814
6815 !! end
6816
6817 !! test
6818 Build table with wikilink
6819 !! wikitext
6820 {| class="wikitable"
6821 ! header || second header
6822 |- style="color:red;"
6823 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6824 |-
6825 | data || second data [[Main Page|link|text with pipe]]
6826 |}
6827 !! html
6828 <table class="wikitable">
6829 <tr>
6830 <th> header </th>
6831 <th> second header
6832 </th></tr>
6833 <tr style="color:red;">
6834 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6835 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6836 </td></tr>
6837 <tr>
6838 <td> data </td>
6839 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6840 </td></tr></table>
6841
6842 !! end
6843
6844 # The expected HTML structure in this test is debatable. The PHP parser does
6845 # not parse this kind of table at all. The main focus for Parsoid is on
6846 # round-tripping, so this output is ok for now. TODO: revisit!
6847 !! test
6848 Wikitext table with html-syntax row
6849 !! wikitext
6850 {|
6851 |-
6852 <td>foo</td>
6853 |}
6854 !! html/parsoid
6855 <table>
6856 <tbody>
6857 <tr>
6858 <td>foo</td></tr></tbody></table>
6859 !! end
6860
6861 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6862 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6863 ## PHP parser, which tidy then compounds by fostering the content
6864 ## entirely out of the table. Parsoid recognizes the table context
6865 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6866 ## depends on PHP's treatment of broken table markup!
6867 !! test
6868 Implicit <td> after a |-
6869 !! options
6870 parsoid=wt2html,html2html
6871 !! wikitext
6872 {|
6873 |-
6874 a
6875 |}
6876 !! html/php
6877 <table>
6878
6879 a
6880 </table>
6881
6882 !! html/php+tidy
6883 <p>a</p>
6884 !! html/parsoid
6885 <table>
6886 <tr><td>a</td></tr>
6887 </table>
6888 !! end
6889
6890 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6891 !! test
6892 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6893 !! options
6894 parsoid=wt2html,html2html
6895 !! wikitext
6896 {|
6897 |-
6898 |
6899 a
6900 |-
6901 b
6902 |}
6903 !! html/php
6904 <table>
6905
6906 <tr>
6907 <td>
6908 <pre>a
6909 </pre>
6910 </td></tr>
6911 b
6912 </table>
6913
6914 !! html/php+tidy
6915 <p>b</p>
6916 <table>
6917 <tr>
6918 <td>
6919 <pre>
6920 a
6921 </pre></td>
6922 </tr>
6923 </table>
6924 !! html/parsoid
6925 <table>
6926 <tbody>
6927 <tr><td><pre>a</pre></td></tr>
6928 <tr><td> b</td></tr>
6929 </tbody>
6930 </table>
6931 !! end
6932
6933 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6934 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6935 !! test
6936 Lists should be recognized in an implicit <td> context
6937 !! options
6938 parsoid=wt2html,html2html
6939 !! wikitext
6940 {|
6941 |-
6942 *a
6943 |}
6944 !! html/php
6945 <table>
6946
6947 <ul><li>a</li></ul>
6948 </table>
6949
6950 !! html/php+tidy
6951 <ul>
6952 <li>a</li>
6953 </ul>
6954 !! html/parsoid
6955 <table>
6956 <tr>
6957 <td><ul>
6958 <li>a</li>
6959 </ul></td>
6960 </tr>
6961 </table>
6962 !! end
6963
6964 !! test
6965 Table cells not properly parsed in an implicit-td context
6966 !! wikitext
6967 {|
6968 |-
6969 {{table_attribs_4}} || a || b
6970 |}
6971 !! html/php+tidy
6972 <table>
6973 <tr>
6974 <td style="background-color:#DC241f;" width="10px"></td>
6975 <td>a</td>
6976 <td>b</td>
6977 </tr>
6978 </table>
6979 !! html/parsoid
6980 <table>
6981 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6982 <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>
6983 </tbody></table>
6984 !! end
6985
6986 !! test
6987 Parsoid: Round-trip tables directly followed by content (bug 51219)
6988 !! options
6989 parsoid=wt2html,wt2wt
6990 !! wikitext
6991 {|
6992 |foo
6993 |} bar
6994
6995 {|
6996 |baz
6997 |}<b>quux</b>
6998 !! html+tidy
6999 <table>
7000 <tr>
7001 <td>foo</td>
7002 </tr>
7003 </table>
7004 <p>bar</p>
7005 <table>
7006 <tr>
7007 <td>baz</td>
7008 </tr>
7009 </table>
7010 <p><b>quux</b></p>
7011 !! end
7012
7013 !! test
7014 Parsoid: Default to a newline after tables in new content (bug 51219)
7015 !! options
7016 parsoid=html2wt
7017 !! html/parsoid
7018 <table><tbody>
7019 <tr><td>foo</td></tr></tbody></table> bar
7020 <table><tbody>
7021 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7022 !! wikitext
7023 {|
7024 |foo
7025 |}
7026 <nowiki> </nowiki>bar
7027 {|
7028 |baz
7029 |}
7030 '''quux'''
7031 !! end
7032
7033 !! test
7034 Parsoid: newline inducing block nodes don't suppress <nowiki>
7035 !! options
7036 parsoid=html2wt
7037 !! html/parsoid
7038 a<h1>foo</h1>
7039 !! wikitext
7040 <nowiki> </nowiki>a
7041
7042 = foo =
7043 !! end
7044
7045 !! test
7046 Parsoid: Row-syntax table headings followed by comment & table cells
7047 !! options
7048 parsoid=wt2html,wt2wt
7049 !! wikitext
7050 {|
7051 ! foo || bar
7052 <!-- foo --> || baz || quux
7053 |}
7054 !! html/php
7055 <table>
7056 <tr>
7057 <th> foo </th>
7058 <th> bar
7059 </th>
7060 <td> baz </td>
7061 <td> quux
7062 </td></tr></table>
7063
7064 !! html/parsoid
7065 <table>
7066 <tbody><tr><th> foo </th><th> bar
7067 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7068 </tbody></table>
7069 !! end
7070
7071 !!test
7072 Parsoid: Recover better from broken table attributes
7073 !!options
7074 parsoid=wt2html
7075 !!wikitext
7076 {| class="foo
7077 | class="bar" |
7078 foo
7079 |}
7080 !!html/php+tidy
7081 <table class="foo">
7082 <tr>
7083 <td class="bar">
7084 <p>foo</p>
7085 </td>
7086 </tr>
7087 </table>
7088 !!html/parsoid
7089 <table class="foo">
7090 <tr>
7091 <td class="bar">
7092 <p>foo</p></td></tr>
7093 </tbody></table>
7094 !!end
7095
7096 !! test
7097 Tables: Digest broken attributes on table and tr tag
7098 !! options
7099 parsoid=wt2html
7100 !! wikitext
7101 {| || |} ++
7102 |- || || ++ --
7103 |- > [
7104 |}
7105 !! html
7106 <table>
7107 <tbody>
7108 <tr></tr>
7109 <tr></tr>
7110 </tbody></table>
7111 !! end
7112
7113 # T137406: Whitespace in the HTML
7114 !! test
7115 1. Generate correct wikitext for tables with thead/tbody/tfoot
7116 !! options
7117 parsoid=html2wt
7118 !! html/parsoid
7119 <table>
7120 <caption>Test</caption>
7121 <thead>
7122 <tr>
7123 <th>Month</th>
7124 <th>Savings</th>
7125 </tr>
7126 </thead>
7127 <tbody>
7128 <tr>
7129 <td>January</td>
7130 <td>$100</td>
7131 </tr>
7132 <tr>
7133 <td>February</td>
7134 <td>$80</td>
7135 </tr>
7136 </tbody>
7137 <tfoot>
7138 <tr>
7139 <td>Sum</td>
7140 <td>$180</td>
7141 </tr>
7142 </tfoot>
7143 </table>
7144 !! wikitext
7145 {|
7146 |+Test
7147 !Month
7148 !Savings
7149 |-
7150 |January
7151 |$100
7152 |-
7153 |February
7154 |$80
7155 |-
7156 |Sum
7157 |$180
7158 |}
7159 !! html/php+tidy
7160 <table>
7161 <caption>Test</caption>
7162 <tr>
7163 <th>Month</th>
7164 <th>Savings</th>
7165 </tr>
7166 <tr>
7167 <td>January</td>
7168 <td>$100</td>
7169 </tr>
7170 <tr>
7171 <td>February</td>
7172 <td>$80</td>
7173 </tr>
7174 <tr>
7175 <td>Sum</td>
7176 <td>$180</td>
7177 </tr>
7178 </table>
7179 !! end
7180
7181 # T137406: No whitespace in the HTML
7182 !! test
7183 2. Generate correct wikitext for tables with thead/tbody/tfoot
7184 !! options
7185 parsoid=html2wt
7186 !! html/parsoid
7187 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7188 !! wikitext
7189 {|
7190 !heading
7191 |-
7192 |foo
7193 |}
7194 !! end
7195
7196 !! test
7197 Testing serialization after deletion in references
7198 !! options
7199 parsoid={
7200 "modes": ["wt2wt"],
7201 "changes": [
7202 ["#x", "remove"]
7203 ]
7204 }
7205 !! wikitext
7206 hi <ref><div id="x">ho</div></ref>
7207
7208 <references />
7209 !! wikitext/edited
7210 hi <ref></ref>
7211
7212 <references />
7213 !! end
7214
7215 !!test
7216 Testing serialization after deletion of table cells
7217 !!options
7218 parsoid={
7219 "modes": ["wt2wt", "selser"],
7220 "changes": [
7221 ["#x", "remove"]
7222 ]
7223 }
7224 !!wikitext
7225 {|
7226 !h1 !!h2 !!h3
7227 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7228 |}
7229 !! wikitext/edited
7230 {|
7231 !h1 !!h2 !!h3
7232 |c2 |||c3
7233 |}
7234 !!end
7235
7236 !! test
7237 Testing selser after addition of new row before first row (T125419)
7238 !! options
7239 parsoid={
7240 "modes": ["wt2wt", "selser"],
7241 "changes": [
7242 [ "tr", "before", "<tr><td>X</td></tr>" ]
7243 ]
7244 }
7245 !! wikitext
7246 {|
7247 |a
7248 |}
7249 !! wikitext/edited
7250 {|
7251 |X
7252 |-
7253 |a
7254 |}
7255 !! end
7256
7257 !! test
7258 Serialize new table rows in a HTML table using HTML tags
7259 !! options
7260 parsoid={
7261 "modes": ["wt2wt", "selser"],
7262 "changes": [
7263 [ "tr", "before", "<tr><td>X</td></tr>" ]
7264 ]
7265 }
7266 !! wikitext
7267 <table><tr><td>a</td></tr></table>
7268 !! wikitext/edited
7269 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
7270 !! end
7271
7272 !! test
7273 Serialize new table cells in a HTML row using HTML tags
7274 !! options
7275 parsoid={
7276 "modes": ["wt2wt", "selser"],
7277 "changes": [
7278 [ "td", "before", "<td>X</td>" ]
7279 ]
7280 }
7281 !! wikitext
7282 <table><tr><td>a</td></tr></table>
7283 !! wikitext/edited
7284 <table><tr><td>X</td><td>a</td></tr></table>
7285 !! end
7286
7287 !! test
7288 Wikitext tables can be nested inside HTML tables
7289 !! options
7290 parsoid=html2wt
7291 !! html
7292 <table data-parsoid='{"stx":"html"}'>
7293 <tr><td>
7294 <table>
7295 <tr><td>foo</td></tr>
7296 </table>
7297 </td></tr>
7298 </table>
7299 !! wikitext
7300 <table>
7301 <tr><td>
7302 {|
7303 |foo
7304 |}
7305 </td></tr>
7306 </table>
7307 !! end
7308
7309 !! test
7310 Serialize wikitext list items as HTML list items when embedded in a HTML list
7311 !! options
7312 parsoid=html2wt
7313 !! html
7314 <ul data-parsoid='{"stx": "html"}'>
7315 <li data-parsoid='{}'>a</li>
7316 <li>b</li>
7317 </ul>
7318 !! wikitext
7319 <ul>
7320 <li>a</li>
7321 <li>b</li>
7322 </ul>
7323 !! end
7324
7325 # SSS FIXME: Is this actually a good thing given the
7326 # odd nested list output that is generated by MW?
7327 # <ul><li>foo<ul>..</ul></li></ul> instead of
7328 # <ul><li>foo</li><ul>..</ul></ul>
7329 !! test
7330 Wikitext lists can be nested inside HTML lists
7331 !! options
7332 parsoid=html2wt
7333 !! html
7334 <ul data-parsoid='{"stx": "html"}'>
7335 <li data-parsoid='{"stx": "html"}'>a
7336 <ul><li>b</li></ul>
7337 </li>
7338 </ul>
7339
7340 <ul data-parsoid='{"stx": "html"}'>
7341 <li>x
7342 <ul><li>y</li></ul>
7343 </li>
7344 </ul>
7345 !! wikitext
7346 <ul>
7347 <li>a
7348 * b
7349 </li>
7350 </ul>
7351
7352 <ul>
7353 <li>x
7354 * y
7355 </li>
7356 </ul>
7357 !! end
7358
7359 ###
7360 ### Internal links
7361 ###
7362 !! test
7363 Plain link, capitalized
7364 !! wikitext
7365 [[Main Page]]
7366 !! html
7367 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7368 </p>
7369 !! end
7370
7371 !! test
7372 Plain link, uncapitalized
7373 !! wikitext
7374 [[main Page]]
7375 !! html
7376 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7377 </p>
7378 !! end
7379
7380 !! test
7381 Piped link
7382 !! wikitext
7383 [[Main Page|The Main Page]]
7384 !! html
7385 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7386 </p>
7387 !! end
7388
7389 !! test
7390 Piped link with comment in link text
7391 !! wikitext
7392 [[Main Page|The Main<!--front--> Page]]
7393 !! html
7394 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7395 </p>
7396 !! end
7397
7398 !! test
7399 Piped link with multiple pipe characters in link text
7400 !! wikitext
7401 [[Main Page||The|Main|Page|]]
7402 !! html/php
7403 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7404 </p>
7405 !! html/parsoid
7406 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7407 !! end
7408
7409 !! test
7410 Piped link with no link text
7411 !! wikitext
7412 [[Thomas Bek (bishop of St David's)|]]
7413 !! html/php
7414 <p>[[Thomas Bek (bishop of St David's)|]]
7415 </p>
7416 !! html/parsoid
7417 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7418 !! end
7419
7420 !! test
7421 Broken link
7422 !! wikitext
7423 [[Zigzagzogzagzig]]
7424 !! html
7425 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7426 </p>
7427 !! end
7428
7429 !! test
7430 Broken link with fragment
7431 !! wikitext
7432 [[Zigzagzogzagzig#zug]]
7433 !! html
7434 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7435 </p>
7436 !! end
7437
7438 !! test
7439 Special page link with fragment
7440 !! wikitext
7441 [[Special:Version#anchor]]
7442 !! html
7443 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7444 </p>
7445 !! end
7446
7447 !! test
7448 Nonexistent special page link with fragment
7449 !! wikitext
7450 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7451 !! html
7452 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7453 </p>
7454 !! end
7455
7456 !! test
7457 Link with prefix
7458 !! wikitext
7459 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7460 !! html
7461 <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>
7462 </p>
7463 !! end
7464
7465 !! test
7466 Link with suffix
7467 !! wikitext
7468 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7469 !! html
7470 <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>!!!
7471 </p>
7472 !! end
7473
7474 !! article
7475 prefixed article
7476 !! text
7477 Some text
7478 !! endarticle
7479
7480 !! test
7481 Bug 43661: Piped links with identical prefixes
7482 !! wikitext
7483 [[prefixed article|prefixed articles with spaces]]
7484
7485 [[prefixed article|prefixed articlesaoeu]]
7486
7487 [[Main Page|Main Page test]]
7488 !! html
7489 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7490 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7491 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7492 </p>
7493 !! end
7494
7495
7496 !! test
7497 Link with HTML entity in suffix / tail
7498 !! wikitext
7499 [[Main Page]]&quot;, [[Main Page]]&#97;
7500 !! html/php
7501 <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;
7502 </p>
7503 !! html/parsoid
7504 <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>
7505 !! end
7506
7507 !! test
7508 Link with 3 brackets
7509 !! wikitext
7510 [[[Main Page]]]
7511 Foo [[[Main Page]]]
7512 !! html
7513 <p>[[[Main Page]]]
7514 Foo [[[Main Page]]]
7515 </p>
7516 !! end
7517
7518 !! test
7519 Link with 4 brackets
7520 !! wikitext
7521 [[[[Main Page]]]]
7522 !! html
7523 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7524 </p>
7525 !! end
7526
7527 !! test
7528 Piped link with 3 brackets
7529 !! wikitext
7530 [[[main page|the main page]]]
7531 !! html
7532 <p>[[[main page|the main page]]]
7533 </p>
7534 !! end
7535
7536 !! test
7537 Piped link with extlink-like text
7538 !! wikitext
7539 [[Main Page|[bar]]]
7540 [[Main Page|This is a [bar]]]
7541 !! html/php
7542 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7543 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7544 </p>
7545 !! html/parsoid
7546 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7547 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7548 !! end
7549
7550 !! test
7551 Link with multiple pipes
7552 !! wikitext
7553 [[Main Page|The|Main|Page]]
7554 !! html
7555 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7556 </p>
7557 !! end
7558
7559 # Note that parsoid does not munge anchor text; all non-space
7560 # characters are valid in HTML5 ids.
7561 !! test
7562 Anchor containing a #. (bug 63430)
7563 !! wikitext
7564 [[Main Page#And#Link]]
7565 !! html/php
7566 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7567 </p>
7568 !! html/parsoid
7569 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
7570 !! end
7571
7572 !! test
7573 Link to namespaces
7574 !! wikitext
7575 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7576 !! html
7577 <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>
7578 </p>
7579 !! end
7580
7581 !! test
7582 Link with space in namespace
7583 !! wikitext
7584 [[User talk:Foo bar]]
7585 !! html
7586 <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>
7587 </p>
7588 !! end
7589
7590 !! article
7591 MemoryAlpha:AlphaTest
7592 !! text
7593 This is an article in the MemoryAlpha namespace
7594 (which shadows the memoryalpha interwiki link).
7595 !! endarticle
7596
7597 !! test
7598 Namespace takes precedence over interwiki link (bug 51680)
7599 !! wikitext
7600 [[MemoryAlpha:AlphaTest]]
7601 !! html
7602 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7603 </p>
7604 !! end
7605
7606 # The previous test doesn't work correctly in html2*, due to not recognizing the
7607 # link as an internal one. This one checks for the correct behavior.
7608 !! test
7609 Link to namespace preferred over interwiki with correct rel attribute
7610 !! options
7611 parsoid=html2wt,html2html
7612 !! html/parsoid
7613 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7614 !! wikitext
7615 [[MemoryAlpha:AlphaTest]]
7616 !! end
7617
7618 !! test
7619 Piped link to namespace
7620 !! wikitext
7621 [[Meta:Disclaimers|The disclaimers]]
7622 !! html
7623 <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>
7624 </p>
7625 !! end
7626
7627 !! test
7628 Link containing }
7629 !! wikitext
7630 [[Usually caused by a typo (oops}]]
7631 !! html
7632 <p>[[Usually caused by a typo (oops}]]
7633 </p>
7634 !! end
7635
7636 !! article
7637 7% Solution
7638 !! text
7639 Just a test of an article title containing a percent.
7640 !! endarticle
7641
7642 !! test
7643 Link containing % (not as a hex sequence)
7644 !! wikitext
7645 [[7% Solution]]
7646 [[7% Solution|7%25 Solution]]
7647 !! html/php
7648 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7649 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7650 </p>
7651 !! html/parsoid
7652 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7653 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7654 !! end
7655
7656 # note that the parsoid HTML is identical to the previous test output,
7657 # so the previous test ensures that the html2wt mode will generate the
7658 # "not as a hex sequence" wikitext.
7659 !! test
7660 Link containing % as a single hex sequence interpreted to char
7661 !! options
7662 parsoid=wt2wt,wt2html,html2html
7663 !! wikitext
7664 [[7%25 Solution]]
7665 [[7%25 Solution|7%25 Solution]]
7666 !! html/php
7667 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7668 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7669 </p>
7670 !! html/parsoid
7671 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7672 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7673 !!end
7674
7675 !! test
7676 Link containing % as a double hex sequence interpreted to hex sequence
7677 !! wikitext
7678 [[7%2525 Solution]]
7679 !! html
7680 <p>[[7%2525 Solution]]
7681 </p>
7682 !!end
7683
7684 # note that parsoid does not munge anchor text; all non-space
7685 # characters are valid in HTML5 anchors.
7686 !! test
7687 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7688 Example for such a section: == < ==
7689 !! wikitext
7690 [[%23%3c]][[%23%3e]]
7691 !! html/php
7692 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7693 </p>
7694 !! html/parsoid
7695 <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>
7696 !! end
7697
7698 !! test
7699 Link containing "<#" and ">#" as a hex sequences
7700 !! wikitext
7701 [[%3c%23]][[%3e%23]]
7702 !! html
7703 <p>[[%3c%23]][[%3e%23]]
7704 </p>
7705 !! end
7706
7707 !! test
7708 Link containing an equals sign
7709 !! wikitext
7710 [[Special:BookSources/isbn=4-00-026157-6]]
7711 !! html/php
7712 <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>
7713 </p>
7714 !! html/parsoid
7715 <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>
7716 !! end
7717
7718 !! article
7719 Foo~bar
7720 !! text
7721 Just a test of an article title containing a tilde.
7722 !! endarticle
7723
7724 # note that links containing signatures, like [[Foo~~~~]], are
7725 # massaged by the pre-save transform (PST) and so the tildes are never
7726 # seen by the parser.
7727 !! test
7728 Link containing a tilde
7729 !! wikitext
7730 [[Foo~bar]]
7731 !! html/php
7732 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7733 </p>
7734 !! html/parsoid
7735 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7736 !! end
7737
7738 !! test
7739 Link containing double-single-quotes '' (bug 4598)
7740 !! wikitext
7741 [[Lista d''e paise d''o munno]]
7742 !! html/php
7743 <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>
7744 </p>
7745 !! html/parsoid
7746 <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>
7747 !! end
7748
7749 !! test
7750 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7751 !! wikitext
7752 Some [[Link|pretty ''italics'' and stuff]]!
7753 !! html/php
7754 <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>!
7755 </p>
7756 !! html/parsoid
7757 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7758 !! end
7759
7760 !! test
7761 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7762 !! wikitext
7763 ''Some [[Link|pretty ''italics'' and stuff]]!''
7764 !! html
7765 <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>
7766 </p>
7767 !! end
7768
7769 !! test
7770 Link with double quotes in title part (literal) and alternate part (interpreted)
7771 !! wikitext
7772 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7773
7774 [[''Pentecoste'']]
7775
7776 [[''Pentecoste''|Pentecoste]]
7777
7778 [[''Pentecoste''|''Pentecoste'']]
7779 !! html/php
7780 <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>
7781 </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>
7782 </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>
7783 </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>
7784 </p>
7785 !! html/parsoid
7786 <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>
7787 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7788 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7789 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7790 !! end
7791
7792 !! test
7793 Broken image links with HTML captions (bug 39700)
7794 !! wikitext
7795 [[File:Nonexistent|<script></script>]]
7796 [[File:Nonexistent|100x100px|<script></script>]]
7797 [[File:Nonexistent|&lt;]]
7798 [[File:Nonexistent|a<i>b</i>c]]
7799 !! html/php
7800 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7801 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7802 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7803 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7804 </p>
7805 !! html/parsoid
7806 <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>
7807 <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>
7808 <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>
7809 <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>
7810 !! end
7811
7812 !! test
7813 Plain link to URL
7814 !! wikitext
7815 [[http://www.example.com]]
7816 !! html/php
7817 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7818 </p>
7819 !! html/parsoid
7820 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7821 !! end
7822
7823 !! test
7824 Plain link to URL with link text
7825 !! wikitext
7826 [[http://www.example.com Link text]]
7827 !! html
7828 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7829 </p>
7830 !! end
7831
7832 !! test
7833 Plain link to protocol-relative URL
7834 !! wikitext
7835 [[//www.example.com]]
7836 !! html/php
7837 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7838 </p>
7839 !! html/parsoid
7840 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7841 !! end
7842
7843 !! test
7844 Plain link to protocol-relative URL with link text
7845 !! wikitext
7846 [[//www.example.com Link text]]
7847 !! html
7848 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7849 </p>
7850 !! end
7851
7852 !! test
7853 Plain link to page with question mark in title
7854 !! wikitext
7855 [[A?b]]
7856
7857 [[A?b|Baz]]
7858 !! html
7859 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7860 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7861 </p>
7862 !! end
7863
7864
7865 # I'm fairly sure the expected result here is wrong.
7866 # We want these to be URL links, not pseudo-pages with URLs for titles....
7867 # However the current output is also pretty screwy.
7868 #
7869 # ----
7870 # I'm changing it to match the current output--it arguably makes more
7871 # sense in the light of the test above. Old expected result was:
7872 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7873 #</p>
7874 # But I think this test is bordering on "garbage in, garbage out" anyway.
7875 # -- wtm
7876 !! test
7877 Piped link to URL
7878 !! wikitext
7879 Piped link to URL: [[http://www.example.com|an example URL]]
7880 !! html/php
7881 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7882 </p>
7883 !! html/parsoid
7884 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7885 !! end
7886
7887 !! test
7888 BUG 2: [[page|http://url/]] should link to page, not http://url/
7889 !! wikitext
7890 [[Main Page|http://url/]]
7891 !! html/php
7892 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7893 </p>
7894 !! html/parsoid
7895 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7896 !! end
7897
7898 # Parsoid does not mark self-links, by design.
7899 !! test
7900 BUG 337: Escaped self-links should be bold
7901 !! options
7902 title=[[Bug462]]
7903 !! wikitext
7904 [[Bu&#103;462]] [[Bug462]]
7905 !! html/php
7906 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7907 </p>
7908 !! html/php+tidy
7909 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7910 !! html/parsoid
7911 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7912 !! end
7913
7914 !! test
7915 Self-link to section should not be bold
7916 !! options
7917 title=[[Main Page]]
7918 !! wikitext
7919 [[Main Page#section]]
7920 !! html
7921 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7922 </p>
7923 !! end
7924
7925 !! article
7926 00
7927 !! text
7928 This is 00.
7929 !! endarticle
7930
7931 !!test
7932 Self-link to numeric title
7933 !!options
7934 title=[[0]]
7935 !! wikitext
7936 [[0]]
7937 !! html
7938 <p><strong class="selflink">0</strong>
7939 </p>
7940 !!end
7941
7942 !!test
7943 Link to numeric-equivalent title
7944 !!options
7945 title=[[0]]
7946 !! wikitext
7947 [[00]]
7948 !! html
7949 <p><a href="/wiki/00" title="00">00</a>
7950 </p>
7951 !!end
7952
7953 !! test
7954 <nowiki> inside a link
7955 !! wikitext
7956 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7957 !! html
7958 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7959 </p>
7960 !! end
7961
7962 !! test
7963 Non-breaking spaces in title
7964 !! wikitext
7965 [[&nbsp; Main &nbsp; Page &nbsp;]]
7966 !! html
7967 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7968 </p>
7969 !!end
7970
7971 !! test
7972 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7973 !! options
7974 language=ca
7975 !! wikitext
7976 '''[[Main Page]]'''
7977 !! html
7978 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7979 </p>
7980 !! end
7981
7982 !! test
7983 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7984 !! options
7985 language=ca
7986 !! wikitext
7987 ''[[Main Page]]''
7988 !! html
7989 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7990 </p>
7991 !! end
7992
7993 !! test
7994 Internal link with en linktrail: no apostrophes (bug 27473)
7995 !! options
7996 language=en
7997 !! wikitext
7998 [[Something]]'nice
7999 !! html
8000 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8001 </p>
8002 !! end
8003
8004 !! test
8005 Internal link with ca linktrail with apostrophes (bug 27473)
8006 !! options
8007 language=ca
8008 !! wikitext
8009 [[Something]]'nice
8010 !! html
8011 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8012 </p>
8013 !! end
8014
8015 !! test
8016 Internal link with kaa linktrail with apostrophes (bug 27473)
8017 !! options
8018 language=kaa
8019 !! wikitext
8020 [[Something]]'nice
8021 !! html
8022 <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>
8023 </p>
8024 !! end
8025
8026 !! test
8027 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
8028 !! wikitext
8029 [[User:Foo/Test/63636:Bar|Test]]
8030 !! html/php
8031 <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>
8032 </p>
8033 !! html/parsoid
8034 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8035 !! end
8036
8037 ## Mainly a sanity check for Parsoid
8038 !! test
8039 Handle title parsing for subpages
8040 !! options
8041 title=[[/123123]]
8042 !! wikitext
8043 123
8044 !! html/parsoid
8045 <p>123</p>
8046 !! end
8047
8048 ## FIXME: Add a working php section here
8049 !! test
8050 Link to a subpage from a namespace other than main
8051 !! options
8052 title=[[User:test]]
8053 !! wikitext
8054 [[/123]]
8055 !! html/parsoid
8056 <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>
8057 !! end
8058
8059 !! test
8060 Ensure that transclusion titles are not url-decoded
8061 !! options
8062 subpage title=[[Test]]
8063 parsoid=wt2html
8064 !! wikitext
8065 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8066 !! html/php
8067 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8068 </p>
8069 !! html/parsoid
8070 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8071 !! end
8072
8073 !! test
8074 Purely hash wikilink
8075 !! options
8076 title=[[User:test/123]]
8077 !! wikitext
8078 [[#a|b]]
8079 !! html/php
8080 <p><a href="#a">b</a>
8081 </p>
8082 !! html/parsoid
8083 <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>
8084 !! end
8085
8086 !! test
8087 1. Interaction of linktrail and template encapsulation
8088 !! options
8089 parsoid
8090 !! wikitext
8091 {{echo|[[Foo]]}}l
8092 !! html
8093 <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>
8094 !! end
8095
8096 !! test
8097 2. Interaction of linktrail and template encapsulation
8098 !! options
8099 parsoid
8100 !! wikitext
8101 {{echo|Some [[Fool]]}}s
8102 !! html
8103 <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>
8104 !! end
8105
8106 !! test
8107 3. Interaction of linktrail and template encapsulation
8108 !! options
8109 parsoid
8110 !! wikitext
8111 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8112 !! html
8113 <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>
8114 !! end
8115
8116 !! article
8117 Söfnuður
8118 !! text
8119 Test.
8120 !! endarticle
8121
8122 !! test
8123 Internal link with is link prefix
8124 !! options
8125 language=is
8126 !! wikitext
8127 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8128 !! html
8129 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8130 </p>
8131 !! end
8132
8133 !! article
8134 Mótmælendatrú
8135 !! text
8136 Test.
8137 !! endarticle
8138
8139 !! test
8140 Internal link with is link trail and link prefix
8141 !! options
8142 language=is
8143 !! wikitext
8144 [[mótmælendatrú|xxx]]ar
8145 [[mótmælendatrú]]ar
8146 mótmælenda[[söfnuður]]
8147 mótmælenda[[söfnuður|söfnuðir]]
8148 mótmælenda[[söfnuður|söfnuðir]]xxx
8149 !! html
8150 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8151 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8152 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8153 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8154 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8155 </p>
8156 !! end
8157
8158 !! test
8159 Parsoid link trail escaping
8160 !! options
8161 parsoid=html2wt,html2html
8162 !! html/parsoid
8163 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
8164 !! wikitext
8165 [[apple]]<nowiki/>s
8166 !! end
8167
8168 !! test
8169 Parsoid link prefix escaping
8170 !! options
8171 language=is
8172 parsoid=html2wt,html2html
8173 !! html/parsoid
8174 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
8175 !! wikitext
8176 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8177 !! end
8178
8179 !! test
8180 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8181 !! wikitext
8182 [[Foo| bar]]
8183
8184 [[Foo| ''bar'']]
8185
8186 [http://wp.org foo]
8187
8188 [http://wp.org ''foo'']
8189 !! html
8190 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8191 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8192 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8193 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8194 </p>
8195 !! end
8196
8197 !! test
8198 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8199 !! options
8200 parsoid
8201 !! wikitext
8202 [[Foo|{{echo|a}} b {{echo|c}}]]
8203 !! html
8204 <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>
8205 !! end
8206
8207 !! test
8208 Link with angle bracket after anchor
8209 !! wikitext
8210 [[Foo#<bar>]]
8211 !! html/php
8212 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8213 </p>
8214 !! html/parsoid
8215 <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>
8216 !! end
8217
8218 ###
8219 ### Interwiki links (see maintenance/interwiki.sql)
8220 ###
8221
8222 !! test
8223 Inline interwiki link
8224 !! options
8225 parsoid=wt2html,wt2wt,html2html
8226 !! wikitext
8227 [[MeatBall:SoftSecurity]]
8228 !! html/php
8229 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8230 </p>
8231 !! html/parsoid
8232 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8233 !! end
8234
8235 !! test
8236 Inline interwiki link with empty title (bug 2372)
8237 !! options
8238 parsoid=wt2html,wt2wt,html2html
8239 !! wikitext
8240 [[MeatBall:]]
8241 !! html/php
8242 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8243 </p>
8244 !! html/parsoid
8245 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8246 !! end
8247
8248 !! test
8249 Interwiki link encoding conversion (bug 1636)
8250 !! wikitext
8251 *[[Wikipedia:ro:Olteni&#0355;a]]
8252 *[[Wikipedia:ro:Olteni&#355;a]]
8253 !! html
8254 <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>
8255 <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>
8256
8257 !! html+tidy
8258 <ul>
8259 <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>
8260 <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>
8261 </ul>
8262 !! end
8263
8264 !! test
8265 Interwiki link with fragment (bug 2130)
8266 !! wikitext
8267 [[MeatBall:SoftSecurity#foo]]
8268 !! html
8269 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8270 </p>
8271 !! end
8272
8273 # Ideally the wikipedia: prefix here should be proto-relative too
8274 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8275 # define the 'en' prefix, and originally the test used 'wikipedia',
8276 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8277 # article.
8278 !! test
8279 Different interwiki prefixes mapping to the same URL
8280 !! wikitext
8281 [[:en:Foo]]
8282
8283 [[:en:Foo|Foo]]
8284
8285 [[wikipedia:Foo]]
8286
8287 [[:wikipedia:Foo|Foo]]
8288
8289 [[wikipedia:en:Foo]]
8290
8291 [[:wikipedia:en:Foo]]
8292
8293 [[ wikiPEdia :Foo]]
8294 !! html/parsoid
8295 <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>
8296
8297 <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>
8298
8299 <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>
8300
8301 <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>
8302
8303 <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>
8304
8305 <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>
8306
8307 <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>
8308 !! end
8309
8310 !! test
8311 Interwiki links that cannot be represented in wiki syntax
8312 !! wikitext
8313 [[meatball:ok]]
8314 [[meatball:ok#foo|ok with fragment]]
8315 [[meatball:ok_as_well?|ok ending with ? mark]]
8316 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8317 [http://de.wikipedia.org/wiki/#foo is just fragment]
8318
8319 !! html/php
8320 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8321 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8322 <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>
8323 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8324 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8325 </p>
8326 !! html/parsoid
8327 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8328 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8329 <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>
8330 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8331 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8332 !! end
8333
8334 !! test
8335 Interwiki links: trail
8336 !! wikitext
8337 [[wikipedia:Foo|Ba]]r
8338 !! html/php
8339 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8340 </p>
8341 !! html/parsoid
8342 <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>
8343 !! end
8344
8345 !! test
8346 Local interwiki link
8347 !! options
8348 parsoid=wt2html,wt2wt,html2html
8349 !! wikitext
8350 [[local:Template:Foo]]
8351 !! html/php
8352 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8353 </p>
8354 !! html/parsoid
8355 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8356 !! end
8357
8358 # Parsoid does not mark self-links, by design.
8359 !! test
8360 Local interwiki link: self-link to current page
8361 !! options
8362 title=[[Main Page]]
8363 parsoid=wt2html,wt2wt,html2html
8364 !! wikitext
8365 [[local:Main Page]]
8366 !! html/php
8367 <p><strong class="selflink">local:Main Page</strong>
8368 </p>
8369 !! html/parsoid
8370 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8371 !! end
8372
8373 !! test
8374 Local interwiki link: prefix only (bug 64167)
8375 !! options
8376 parsoid=wt2html,wt2wt,html2html
8377 !! wikitext
8378 [[local:]]
8379 !! html/php
8380 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8381 </p>
8382 !! html/parsoid
8383 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8384 !! end
8385
8386 !! test
8387 Local interwiki link: with additional interwiki prefix (bug 61357)
8388 !! options
8389 parsoid=wt2html,wt2wt,html2html
8390 !! wikitext
8391 [[local:meatball:Hello]]
8392 !! html/php
8393 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8394 </p>
8395 !! html/parsoid
8396 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8397 !! end
8398
8399 !! test
8400 Multiple local interwiki link prefixes
8401 !! wikitext
8402 [[local:local:local:local:mi:local:Foo]]
8403 !! options
8404 parsoid=wt2html,wt2wt,html2html
8405 !! html/php
8406 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8407 </p>
8408 !! html/parsoid
8409 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8410 !! end
8411
8412 ###
8413 ### Interlanguage links
8414 ### Language links (so that searching for '### language' matches..)
8415 ###
8416
8417 !! test
8418 Interlanguage link
8419 !! wikitext
8420 Blah blah blah
8421 [[zh:Chinese]]
8422 !! html/php
8423 <p>Blah blah blah
8424 </p>
8425 !! html/parsoid
8426 <p>Blah blah blah</p>
8427 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8428 !! end
8429
8430 ## parsoid html2wt will lose the space variations
8431 !! test
8432 Interlanguage link with spacing
8433 !! options
8434 parsoid=wt2html,wt2wt,html2html
8435 !! wikitext
8436 Blah blah blah
8437 [[ zh : Chinese ]]
8438 !! html/php
8439 <p>Blah blah blah
8440 </p>
8441 !! html/parsoid
8442 <p>Blah blah blah</p>
8443 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8444 !! end
8445
8446 !! test
8447 Double interlanguage link
8448 !! wikitext
8449 Blah blah blah
8450 [[es:Spanish]]
8451 [[zh:Chinese]]
8452 !! html/php
8453 <p>Blah blah blah
8454 </p>
8455 !! html/parsoid
8456 <p>Blah blah blah</p>
8457 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8458 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8459 !! end
8460
8461 ## parsoid html2wt will lose the space variations
8462 !! test
8463 Interlanguage link variations
8464 !! options
8465 parsoid=wt2html,wt2wt,html2html
8466 !! wikitext
8467 Blah blah blah
8468 [[ es :Spanish]]
8469 [[ ZH :Chinese]]
8470 [[es:Foo_bar]]
8471 !! html/php
8472 <p>Blah blah blah
8473 </p>
8474 !! html/parsoid
8475 <p>Blah blah blah</p>
8476 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8477 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8478 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8479 !! end
8480
8481 ## parsoid html2wt will normalize the space to _
8482 !! test
8483 Space and question mark encoding in interlanguage links (T95473)
8484 !! options
8485 parsoid=wt2html,wt2wt,html2html
8486 !! wikitext
8487 Blah blah blah
8488 [[es:Foo bar?]]
8489 !! html/php
8490 <p>Blah blah blah
8491 </p>
8492 !! html/parsoid
8493 <p>Blah blah blah</p>
8494 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8495 !! end
8496
8497 !! test
8498 Interlanguage link, with prefix links
8499 !! options
8500 language=ln
8501 !! wikitext
8502 Blah blah blah
8503 [[zh:Chinese]]
8504 !! html/php
8505 <p>Blah blah blah
8506 </p>
8507 !! html/parsoid
8508 <p>Blah blah blah</p>
8509 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8510 !! end
8511
8512 !! test
8513 Double interlanguage link, with prefix links (bug 8897)
8514 !! options
8515 language=ln
8516 !! wikitext
8517 Blah blah blah
8518 [[es:Spanish]]
8519 [[zh:Chinese]]
8520 !! html/php
8521 <p>Blah blah blah
8522 </p>
8523 !! html/parsoid
8524 <p>Blah blah blah</p>
8525 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8526 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8527 !! end
8528
8529 !! test
8530 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8531 !! wikitext
8532 Blah blah blah
8533 [[mul:Article]]
8534 !! html/php
8535 <p>Blah blah blah
8536 </p>
8537 !! html/parsoid
8538 <p>Blah blah blah</p>
8539 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8540 !! end
8541
8542 ## PHP parser tests script needs an update
8543 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8544 !! test
8545 Language links render as inline links if $wgInterwikiMagic=false
8546 !! options
8547 wgInterwikiMagic=false
8548 parsoid=wt2html,wt2wt,html2html
8549 !! wikitext
8550 Blah blah blah
8551 [[zh:Chinese]]
8552 !! html/parsoid
8553 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8554 !! end
8555
8556 ## PHP parser tests script needs an update
8557 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8558 !! test
8559 Language links render as inline links in the Talk namespace
8560 !! options
8561 title=Talk:Foo
8562 parsoid=wt2html,wt2wt,html2html
8563 !! wikitext
8564 Blah blah blah
8565 [[zh:Chinese]]
8566 !! html/parsoid
8567 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8568 !! end
8569
8570 !! test
8571 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8572 !! options
8573 language=ln
8574 !! wikitext
8575 [[WW&nbsp;II]]
8576 !! html
8577 <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>
8578 </p>
8579 !! end
8580
8581 !! test
8582 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8583 !! options
8584 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
8585 !! html/parsoid
8586 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8587 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8588 !! wikitext
8589 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8590
8591 He&amp;nbsp;llo He&amp;nbsp;llo
8592 !! html/php
8593 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
8594 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
8595 </p>
8596 !! end
8597
8598 # html2wt will fail because of title normalization without data-parsoid
8599 !! test
8600 Parsoid: handle constructor well
8601 !! options
8602 parsoid=wt2html,wt2wt
8603 !! wikitext
8604 [[constructor]]
8605
8606 [[constructor:foo]]
8607 !! html/php
8608 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8609 </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>
8610 </p>
8611 !! html/parsoid
8612 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
8613
8614 <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>
8615 !! end
8616
8617 !! article
8618 ko:
8619 !! text
8620 Test.
8621 !! endarticle
8622
8623 # Note that `ko` isn't a known interlanguage prefix
8624 !! test
8625 Parsoid: recognize interlanguage links without a target page
8626 !! options
8627 ill
8628 !! wikitext
8629 [[es:]]
8630
8631 [[ko:]]
8632 !! html/php
8633 es:
8634 !! html/parsoid
8635 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8636
8637 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8638 !! end
8639
8640 # Note that `ko` isn't a known interwiki prefix
8641 !! test
8642 Parsoid: recognize interwiki links without a target page
8643 !! options
8644 parsoid=wt2html,wt2wt,html2html
8645 !! wikitext
8646 [[:es:]]
8647
8648 [[:ko:]]
8649 !! html/php
8650 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8651 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8652 </p>
8653 !! html/parsoid
8654 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8655 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8656 !! end
8657
8658 !! test
8659 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8660 !! wikitext
8661 [[mi:Foo]]
8662 !! html/php
8663 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8664 </p>
8665 !! html/parsoid
8666 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8667 !! end
8668
8669 !! test
8670 Interlanguage link with preceding local interwiki link (bug 68085)
8671 !! options
8672 parsoid=wt2html,wt2wt,html2html
8673 !! wikitext
8674 Blah blah blah
8675 [[local:es:Spanish]]
8676 !! html/php
8677 <p>Blah blah blah
8678 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8679 </p>
8680 !! html/parsoid
8681 <p>Blah blah blah
8682 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8683 !! end
8684
8685 !! test
8686 Looks like an interlanguage link, but is actually a local interwiki
8687 !! options
8688 parsoid=wt2html,wt2wt,html2html
8689 !! wikitext
8690 Blah blah blah
8691 [[mi:Template:Foo]]
8692 !! html/php
8693 <p>Blah blah blah
8694 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8695 </p>
8696 !! html/parsoid
8697 <p>Blah blah blah
8698 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8699 !! end
8700
8701 ###
8702 ### Redirects, Parsoid-only
8703 ###
8704
8705 !! test
8706 1. Simple redirect to page
8707 !! wikitext
8708 #REDIRECT [[Main Page]]
8709 !! html/parsoid
8710 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8711 !! end
8712
8713 !! test
8714 2. Other redirect variants
8715 !! wikitext
8716 #REDIRECT [[Main_Page]]
8717 !! html/parsoid
8718 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8719 !! end
8720
8721 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8722 # This tests the Parsoid bail-out code.
8723 !! test
8724 3. Other redirect variants
8725 !! wikitext
8726 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8727 !! html/parsoid
8728 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8729 !! end
8730
8731 !! test
8732 4. Redirect to a templated destination
8733 !! wikitext
8734 #REDIRECT [[{{echo|Foo}}bar]]
8735 !! html/parsoid
8736 <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"}]]}'/>
8737 !! end
8738
8739 !! test
8740 Empty redirect
8741 !! options
8742 parsoid=wt2html,wt2wt
8743 !! wikitext
8744 #REDIRECT [[]]
8745 !! html/parsoid
8746 <ol>
8747 <li>REDIRECT [[]]</li></ol>
8748 !! end
8749
8750 !! test
8751 Optional colon in #REDIRECT
8752 !! options
8753 # the colon is archaic syntax. we support it for wt2html, but we
8754 # don't care that it roundtrips back to the modern syntax.
8755 parsoid=wt2html,html2html
8756 !! wikitext
8757 #REDIRECT:[[Main Page]]
8758 !! html/parsoid
8759 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8760 !! end
8761
8762 !! test
8763 Whitespace in #REDIRECT with optional colon
8764 !! options
8765 # the colon and gratuitous whitespace is archaic syntax. we support
8766 # it for wt2html, but we don't care that it roundtrips back to the
8767 # modern syntax (without extra whitespace)
8768 parsoid=wt2html,html2html
8769 !! wikitext
8770
8771 #REDIRECT
8772 :
8773 [[Main Page]]
8774 !! html/parsoid
8775 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8776 !! end
8777
8778 !! test
8779 Piped link in #REDIRECT
8780 !! options
8781 # content after piped link is ignored. we support this syntax,
8782 # but don't care that the piped link is lost when we roundtrip this.
8783 parsoid=wt2html
8784 !! wikitext
8785 #REDIRECT [[Main Page|bar]]
8786 !! html/parsoid
8787 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8788 !! end
8789
8790 !! test
8791 Redirect to category (T104502)
8792 !! options
8793 parsoid=wt2html,wt2wt
8794 !! wikitext
8795 #REDIRECT [[Category:Foo]]
8796 !! html/parsoid
8797 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8798 !! end
8799
8800 !! test
8801 Redirect to category with URL encoding (T104502)
8802 !! options
8803 parsoid=wt2html
8804 !! wikitext
8805 #REDIRECT [[Category%3AFoo]]
8806 !! html/parsoid
8807 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8808 !! end
8809
8810 !! test
8811 Redirect to category page
8812 !! wikitext
8813 #REDIRECT [[:Category:Foo]]
8814 !! html/parsoid
8815 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8816 !! end
8817
8818 !! test
8819 Redirect to image page (1)
8820 !! wikitext
8821 #REDIRECT [[File:Wiki.png]]
8822 !! html/parsoid
8823 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8824 !! end
8825
8826 !! test
8827 Redirect to image page (2)
8828 !! wikitext
8829 #REDIRECT [[Image:Wiki.png]]
8830 !! html/parsoid
8831 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8832 !! end
8833
8834 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8835 # Next test confirms this.
8836 !! test
8837 Redirect to language (1) (T104918)
8838 !! options
8839 parsoid=wt2html,wt2wt,html2html
8840 !! wikitext
8841 #REDIRECT [[en:File:Wiki.png]]
8842 !! html/parsoid
8843 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8844 !! end
8845
8846 !! test
8847 Redirect to language (2) (T104918)
8848 !! wikitext
8849 #REDIRECT [[:en:File:Wiki.png]]
8850 !! html/parsoid
8851 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8852 !! end
8853
8854 !! test
8855 Redirect to interwiki (T104918)
8856 !! wikitext
8857 #REDIRECT [[meatball:File:Wiki.png]]
8858 !! html/parsoid
8859 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8860 !! end
8861
8862 !! test
8863 Non-English #REDIRECT
8864 !! options
8865 language=is
8866 !! wikitext
8867 #TILVÍSUN [[Main Page]]
8868 !! html/parsoid
8869 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8870 !! end
8871
8872 !! test
8873 Redirect syntax under text isn't considered a redirect
8874 !! wikitext
8875 some text
8876 #redirect [[Main Page]]
8877 !! html/parsoid
8878 <p>some text</p>
8879 <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>
8880 !! end
8881
8882 # FIXME: Should hoist the redirect to the top of the page and ensure there
8883 # is only one.
8884 !! test
8885 New redirect
8886 !! options
8887 parsoid=html2wt
8888 !! html/parsoid
8889 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8890 !! wikitext
8891 Foo
8892 #REDIRECT [[Foo]]
8893 !! end
8894
8895 ##
8896 ## XHTML tidiness
8897 ###
8898
8899 !! test
8900 <br> to <br />
8901 !! wikitext
8902 1<br>2<br />3
8903 !! html
8904 <p>1<br />2<br />3
8905 </p>
8906 !! end
8907
8908 !! test
8909 Broken br tag sanitization
8910 !! wikitext
8911 </br>
8912 !! html/php
8913 <p>&lt;/br&gt;
8914 </p>
8915 !! end
8916
8917 # TODO: Fix html2html mode (bug 51055)!
8918 !! test
8919 Parsoid: Broken br tag recognition
8920 !! options
8921 parsoid=wt2html
8922 !! wikitext
8923 </br>
8924
8925 <br/ >
8926 !! html+tidy
8927 <p><br /></p>
8928 <p><br /></p>
8929 !! end
8930
8931 !! test
8932 Incorrecly removing closing slashes from correctly formed XHTML
8933 !! wikitext
8934 <br style="clear:both;" />
8935 !! html
8936 <p><br style="clear:both;" />
8937 </p>
8938 !! end
8939
8940 !! test
8941 Failing to transform badly formed HTML into correct XHTML
8942 !! wikitext
8943 <br style="clear: left;">
8944 <br style="clear: right;">
8945 <br style="clear: both;">
8946 !! html
8947 <p><br style="clear: left;" />
8948 <br style="clear: right;" />
8949 <br style="clear: both;" />
8950 </p>
8951 !!end
8952
8953 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8954 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8955 !! test
8956 Handling html with a div self-closing tag
8957 !! wikitext
8958 <div title />
8959 <div title/>
8960 <div title/ >
8961 <div title=bar />
8962 <div title=bar/>
8963 <div title=bar/ >
8964 !! html/php
8965 <p>&lt;div title /&gt;
8966 &lt;div title/&gt;
8967 </p>
8968 <div>
8969 <p>&lt;div title=bar /&gt;
8970 &lt;div title=bar/&gt;
8971 </p>
8972 <div title="bar/"></div>
8973 </div>
8974
8975 !! html/parsoid
8976 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8977 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8978 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
8979 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8980 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8981 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
8982 !! end
8983
8984 !! test
8985 Handling html with a br self-closing tag
8986 !! wikitext
8987 <br title />
8988 <br title/>
8989 <br title/ >
8990 <br title=bar />
8991 <br title=bar/>
8992 <br title=bar/ >
8993 !! html/php
8994 <p><br title="" />
8995 <br title="" />
8996 <br />
8997 <br title="bar" />
8998 <br title="bar" />
8999 <br title="bar/" />
9000 </p>
9001 !! html/parsoid
9002 <p><br title="" />
9003 <br title="" />
9004 <br title="" />
9005 <br title="bar" />
9006 <br title="bar" />
9007 <br title="bar/" />
9008 </p>
9009 !! end
9010
9011 !! test
9012 Horizontal ruler (should it add that extra space?)
9013 !! wikitext
9014 <hr>
9015 <hr >
9016 foo <hr
9017 > bar
9018 !! html+tidy
9019 <hr />
9020 <hr />
9021 <p>foo</p>
9022 <hr />
9023 <p>bar</p>
9024 !! end
9025
9026 !! test
9027 Horizontal ruler -- 4+ dashes render hr
9028 !! wikitext
9029 ----
9030 !! html
9031 <hr />
9032
9033 !! end
9034
9035 !! test
9036 Horizontal ruler -- eats additional dashes on the same line
9037 !! wikitext
9038 ---------
9039 !! html
9040 <hr />
9041
9042 !! end
9043
9044 !! test
9045 Horizontal ruler -- does not collapse dashes on consecutive lines
9046 !! wikitext
9047 ----
9048 ----
9049 !! html
9050 <hr />
9051 <hr />
9052
9053 !! end
9054
9055 !! test
9056 Horizontal ruler -- <4 dashes render as plain text
9057 !! wikitext
9058 ---
9059 !! html
9060 <p>---
9061 </p>
9062 !! end
9063
9064 !! test
9065 Horizontal ruler -- Supports content following dashes on same line
9066 !! wikitext
9067 ---- Foo
9068 !! html
9069 <hr /> Foo
9070
9071 !! html+tidy
9072 <hr />
9073 <p>Foo</p>
9074 !! end
9075
9076 ###
9077 ### Block-level elements
9078 ###
9079 !! test
9080 Common list
9081 !! wikitext
9082 *Common list
9083 * item 2
9084 *item 3
9085 !! html
9086 <ul><li>Common list</li>
9087 <li> item 2</li>
9088 <li>item 3</li></ul>
9089
9090 !! end
9091
9092 !! test
9093 Numbered list
9094 !! wikitext
9095 #Numbered list
9096 #item 2
9097 # item 3
9098 !! html
9099 <ol><li>Numbered list</li>
9100 <li>item 2</li>
9101 <li> item 3</li></ol>
9102
9103 !! end
9104
9105 !! test
9106 Mixed list
9107 !! wikitext
9108 *Mixed list
9109 *# with numbers
9110 ** and bullets
9111 *# and numbers
9112 *bullets again
9113 **bullet level 2
9114 ***bullet level 3
9115 ***#Number on level 4
9116 **bullet level 2
9117 **#Number on level 3
9118 **#Number on level 3
9119 *#number level 2
9120 *Level 1
9121 *** Level 3
9122 #** Level 3, but ordered
9123 !! html
9124 <ul><li>Mixed list
9125 <ol><li> with numbers</li></ol>
9126 <ul><li> and bullets</li></ul>
9127 <ol><li> and numbers</li></ol></li>
9128 <li>bullets again
9129 <ul><li>bullet level 2
9130 <ul><li>bullet level 3
9131 <ol><li>Number on level 4</li></ol></li></ul></li>
9132 <li>bullet level 2
9133 <ol><li>Number on level 3</li>
9134 <li>Number on level 3</li></ol></li></ul>
9135 <ol><li>number level 2</li></ol></li>
9136 <li>Level 1
9137 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
9138 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
9139
9140 !! end
9141
9142 !! test
9143 1. Nested mixed wikitext and html list
9144 !! wikitext
9145 * hi
9146 * <ul><li>ho</li></ul>
9147 * hi
9148 ** ho
9149 !! html/php
9150 <ul><li> hi</li>
9151 <li> <ul><li>ho</li></ul></li>
9152 <li> hi
9153 <ul><li> ho</li></ul></li></ul>
9154
9155 !! html/parsoid
9156 <ul><li> hi</li>
9157 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9158 <li> hi
9159 <ul><li> ho</li></ul></li></ul>
9160 !! end
9161
9162 !! test
9163 2. Nested mixed wikitext and html list (incompatible)
9164 !! wikitext
9165 ; hi
9166 : {{echo|<li>ho</li>}}
9167 !! html/php
9168 <dl><dt> hi</dt>
9169 <dd> <li>ho</li></dd></dl>
9170
9171 !! html/parsoid
9172 <dl><dt> hi</dt>
9173 <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>
9174 !! end
9175
9176 !! test
9177 Nested lists 1
9178 !! wikitext
9179 *foo
9180 **bar
9181 !! html
9182 <ul><li>foo
9183 <ul><li>bar</li></ul></li></ul>
9184
9185 !! end
9186
9187 !! test
9188 Nested lists 2
9189 !! wikitext
9190 **foo
9191 *bar
9192 !! html
9193 <ul><li><ul><li>foo</li></ul></li>
9194 <li>bar</li></ul>
9195
9196 !! end
9197
9198 !! test
9199 Nested lists 3 (first element empty)
9200 !! wikitext
9201 *
9202 **bar
9203 !! html
9204 <ul><li>
9205 <ul><li>bar</li></ul></li></ul>
9206
9207 !! end
9208
9209 !! test
9210 Nested lists 4 (first element empty)
9211 !! wikitext
9212 **
9213 *bar
9214 !! html
9215 <ul><li><ul><li></li></ul></li>
9216 <li>bar</li></ul>
9217
9218 !! end
9219
9220 !! test
9221 Nested lists 5 (both elements empty)
9222 !! wikitext
9223 **
9224 *
9225 !! html
9226 <ul><li><ul><li></li></ul></li>
9227 <li></li></ul>
9228
9229 !! end
9230
9231 !! test
9232 Nested lists 6 (both elements empty)
9233 !! wikitext
9234 *
9235 **
9236 !! html
9237 <ul><li>
9238 <ul><li></li></ul></li></ul>
9239
9240 !! end
9241
9242 !! test
9243 Nested lists 7 (skip initial nesting levels)
9244 !! wikitext
9245 *** foo
9246 !! html
9247 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
9248
9249 !! end
9250
9251 !! test
9252 Nested lists 8 (multiple nesting transitions)
9253 !! wikitext
9254 * foo
9255 *** bar
9256 ** baz
9257 * boo
9258 !! html
9259 <ul><li> foo
9260 <ul><li><ul><li> bar</li></ul></li>
9261 <li> baz</li></ul></li>
9262 <li> boo</li></ul>
9263
9264 !! end
9265
9266 !! test
9267 Nested lists 9 (extension interaction)
9268 !! options
9269 parsoid
9270 !! wikitext
9271 *<references />
9272 !! html/parsoid
9273 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9274 !! end
9275
9276 !! test
9277 1. Lists with start-of-line-transparent tokens before bullets: Comments
9278 !! wikitext
9279 *foo
9280 *<!--cmt-->bar
9281 <!--cmt-->*baz
9282 !! html
9283 <ul><li>foo</li>
9284 <li>bar</li>
9285 <li>baz</li></ul>
9286
9287 !! end
9288
9289 !! test
9290 2. Lists with start-of-line-transparent tokens before bullets: Template close
9291 !! wikitext
9292 *foo {{echo|bar
9293 }}*baz
9294 !! html
9295 <ul><li>foo bar</li>
9296 <li>baz</li></ul>
9297
9298 !! end
9299
9300 !! test
9301 List items are not parsed correctly following a <pre> block (bug 785)
9302 !! wikitext
9303 * <pre>foo</pre>
9304 * <pre>bar</pre>
9305 * zar
9306 !! html/php
9307 <ul><li> <pre>foo</pre></li>
9308 <li> <pre>bar</pre></li>
9309 <li> zar</li></ul>
9310
9311 !! html/parsoid
9312 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
9313 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
9314 <li> zar</li></ul>
9315 !! end
9316
9317 !! test
9318 List items from template
9319 !! wikitext
9320
9321 {{inner list}}
9322 * item 2
9323
9324 * item 0
9325 {{inner list}}
9326 * item 2
9327
9328 * item 0
9329 * notSOL{{inner list}}
9330 * item 2
9331 !! html
9332 <ul><li> item 1</li>
9333 <li> item 2</li></ul>
9334 <ul><li> item 0</li>
9335 <li> item 1</li>
9336 <li> item 2</li></ul>
9337 <ul><li> item 0</li>
9338 <li> notSOL</li>
9339 <li> item 1</li>
9340 <li> item 2</li></ul>
9341
9342 !! end
9343
9344 !! test
9345 List interrupted by empty line or heading
9346 !! wikitext
9347 * foo
9348
9349 ** bar
9350 == A heading ==
9351 * Another list item
9352 !! html
9353 <ul><li> foo</li></ul>
9354 <ul><li><ul><li> bar</li></ul></li></ul>
9355 <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>
9356 <ul><li> Another list item</li></ul>
9357
9358 !!end
9359
9360 !!test
9361 Multiple list tags generated by templates
9362 !! wikitext
9363 {{echo|<li>}}a
9364 {{echo|<li>}}b
9365 {{echo|<li>}}c
9366 !! html
9367 <li>a
9368 <li>b
9369 <li>c</li>
9370 </li>
9371 </li>
9372
9373 !! html+tidy
9374 <ul>
9375 <li>a</li>
9376 <li>b</li>
9377 <li>c</li>
9378 </ul>
9379 !!end
9380
9381 !!test
9382 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9383 !! wikitext
9384 *a
9385 <!--This line will NOT split the list-->
9386 *b
9387 <!--This line will NOT split the list either-->
9388 *c
9389 <!--foo--> <!----> <!--This line NOT split the list either-->
9390 *d
9391 !! html
9392 <ul><li>a</li>
9393 <li>b</li>
9394 <li>c</li>
9395 <li>d</li></ul>
9396
9397 !!end
9398
9399 !!test
9400 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9401 !! wikitext
9402 *a
9403 <!--This line will NOT split the list-->
9404 *b
9405 <!--This line will NOT split the list either-->
9406 *c
9407 <!--foo--> <!----> <!--This line NOT split the list
9408 either-->
9409 *d
9410 !! html
9411 <ul><li>a</li>
9412 <li>b</li>
9413 <li>c</li>
9414 <li>d</li></ul>
9415
9416 !!end
9417
9418 !!test
9419 Test the li-hack
9420 (The PHP parser relies on Tidy for the hack)
9421 !!options
9422 parsoid=wt2html,wt2wt
9423 !! wikitext
9424 * foo
9425 * <li>li-hack
9426 * {{echo|<li>templated li-hack}}
9427 * <!--foo--> <li> unsupported li-hack with preceding comments
9428
9429 <ul>
9430 <li><li>not a li-hack
9431 </li>
9432 </ul>
9433 !! html+tidy
9434 <ul>
9435 <li>foo</li>
9436 <li>li-hack</li>
9437 <li>templated li-hack</li>
9438 <li>unsupported li-hack with preceding comments</li>
9439 </ul>
9440 <ul>
9441 <li>not a li-hack</li>
9442 </ul>
9443 !!end
9444
9445 !! test
9446 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9447 !! options
9448 parsoid
9449 !! wikitext
9450 # foo
9451 ## bar
9452 * foo
9453 ** bar
9454 : foo
9455 :: bar
9456 !! html
9457 <ol>
9458 <li> foo<ol>
9459 <li> bar</li>
9460 </ol></li>
9461 </ol><ul>
9462 <li> foo<ul>
9463 <li> bar</li>
9464 </ul></li>
9465 </ul><dl>
9466 <dd> foo<dl>
9467 <dd> bar</dd>
9468 </dl></dd>
9469 </dl>
9470 !! end
9471
9472 !! test
9473 Parsoid: Test of whitespace serialization with Templated bullets
9474 !! options
9475 parsoid
9476 !! wikitext
9477 * {{bullet}}
9478 !! html
9479 <ul>
9480 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9481 </ul>
9482 !! end
9483
9484 # ------------------------------------------------------------------------
9485 # The next set of tests are about Parsoid's ability to handle badly nested
9486 # tags (parse, minimize scope of fixup, and roundtrip back)
9487 # ------------------------------------------------------------------------
9488
9489 !! test
9490 Unbalanced closing block tags break a list
9491 (php parser relies on Tidy to fix up)
9492 !! wikitext
9493 <div>
9494 *a</div><div>
9495 *b</div>
9496 !! html+tidy
9497 <div>
9498 <ul>
9499 <li>a</li>
9500 </ul>
9501 </div>
9502 <div>
9503 <ul>
9504 <li>b</li>
9505 </ul>
9506 </div>
9507 !! end
9508
9509 # Parsoid fails this test, but it might be tricky to support properly.
9510 # See bug 68395.
9511 !! test
9512 Unbalanced closing non-block tags don't break a list
9513 (php parser relies on Tidy to fix up)
9514 !! wikitext
9515 <span>
9516 *a</span><span>
9517 *b</span>
9518 !! html/php+tidy
9519 <ul>
9520 <li><span>a</span></li>
9521 <li><span>b</span></li>
9522 </ul>
9523 !! html/parsoid
9524 <span>
9525 <ul>
9526 <li>a<span></span>
9527 </li>
9528 <li>b
9529 </li>
9530 </ul>
9531 </span>
9532 !! end
9533
9534 !! test
9535 Unclosed formatting tags that straddle lists are closed and reopened
9536 (php parser relies on Tidy to fix up)
9537 !! options
9538 parsoid=wt2html,wt2wt,html2html
9539 !! wikitext
9540 # <s> a
9541 # b </s>
9542 !! html/php+tidy
9543 <ol>
9544 <li><s>a</s></li>
9545 <li><s>b</s></li>
9546 </ol>
9547 !! html/parsoid
9548 <ol><li> <s> a</s></li>
9549 <li><s> b </s></li></ol>
9550 !! end
9551
9552 # See bug 68395.
9553 !!test
9554 1. List embedded in a formatting tag
9555 !! wikitext
9556 <small>
9557 * foo
9558 </small>
9559 !! html/php+tidy
9560 <ul>
9561 <li><small>foo</small></li>
9562 </ul>
9563 !! html/parsoid
9564 <small>
9565 <ul>
9566 <li> foo</li>
9567 </ul>
9568 </small>
9569 !!end
9570
9571 ## Ugly Parsoid output here
9572 ## Not sure what the right output is.
9573 !!test
9574 2. List embedded in a formatting tag
9575 !! wikitext
9576 <small>
9577 *a
9578 *b</small>
9579 !! html/php+tidy
9580 <ul>
9581 <li><small>a</small></li>
9582 <li><small>b</small></li>
9583 </ul>
9584 !! html/parsoid
9585 <small></small>
9586 <ul><small>
9587 <li>a</li>
9588 </small>
9589 <li><small>b</small></li>
9590 </ul>
9591 !!end
9592
9593 # Ugly Parsoid and PHP parser output here
9594 # Not sure if we want to make this a test!
9595 #
9596 ## !!test
9597 ## 3. Unclosed formatting tags in list elements
9598 ## !! wikitext
9599 ## *<small>a
9600 ## *<small>b
9601 ## !! html/php+tidy
9602 ## <ul>
9603 ## <li><small>a</small></li>
9604 ## <li><small><small>b</small></small></li>
9605 ## </ul>
9606 ## !! html/parsoid
9607 ## <ul>
9608 ## <li><small>a</small></li>
9609 ## <small>
9610 ## <li><small>b</small></li>
9611 ## </small></ul>
9612 ## !!end
9613
9614 # This is a bug in the PHP parser + tidy combination.
9615 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9616 # and then fostered out of the table by tidy.)
9617 # We believe the Parsoid output to be correct.
9618 !! test
9619 Table with missing opening <tr> tag
9620 !! options
9621 parsoid=wt2html,wt2wt
9622 !! wikitext
9623 <table>
9624 <td>foo</td>
9625 </tr>
9626 </table>
9627 !! html+tidy
9628 <table>
9629 <tr>
9630 <td>foo</td>
9631 </tr>
9632 </table>
9633 !! end
9634
9635 ###
9636 ### Magic Words
9637 ###
9638
9639 # Note that the current date is hard-coded as
9640 # 1970-01-01T00:02:03Z (a Thursday)
9641 # when running parser tests. The timezone is also fixed to GMT, so
9642 # local date will be identical to current date.
9643
9644 !! test
9645 Magic Word: {{CURRENTDAY}}
9646 !! wikitext
9647 {{CURRENTDAY}}
9648 !! html
9649 <p>1
9650 </p>
9651 !! end
9652
9653 !! test
9654 Magic Word: {{CURRENTDAY2}}
9655 !! wikitext
9656 {{CURRENTDAY2}}
9657 !! html
9658 <p>01
9659 </p>
9660 !! end
9661
9662 !! test
9663 Magic Word: {{CURRENTDAYNAME}}
9664 !! wikitext
9665 {{CURRENTDAYNAME}}
9666 !! html
9667 <p>Thursday
9668 </p>
9669 !! end
9670
9671 !! test
9672 Magic Word: {{CURRENTDOW}}
9673 !! wikitext
9674 {{CURRENTDOW}}
9675 !! html
9676 <p>4
9677 </p>
9678 !! end
9679
9680 !! test
9681 Magic Word: {{CURRENTMONTH}}
9682 !! wikitext
9683 {{CURRENTMONTH}}
9684 !! html
9685 <p>01
9686 </p>
9687 !! end
9688
9689 !! test
9690 Magic Word: {{CURRENTMONTH1}}
9691 !! wikitext
9692 {{CURRENTMONTH1}}
9693 !! html
9694 <p>1
9695 </p>
9696 !! end
9697
9698 !! test
9699 Magic Word: {{CURRENTMONTHABBREV}}
9700 !! wikitext
9701 {{CURRENTMONTHABBREV}}
9702 !! html
9703 <p>Jan
9704 </p>
9705 !! end
9706
9707 !! test
9708 Magic Word: {{CURRENTMONTHNAME}}
9709 !! wikitext
9710 {{CURRENTMONTHNAME}}
9711 !! html
9712 <p>January
9713 </p>
9714 !! end
9715
9716 !! test
9717 Magic Word: {{CURRENTMONTHNAMEGEN}}
9718 !! wikitext
9719 {{CURRENTMONTHNAMEGEN}}
9720 !! html
9721 <p>January
9722 </p>
9723 !! end
9724
9725 !! test
9726 Magic Word: {{CURRENTTIME}}
9727 !! wikitext
9728 {{CURRENTTIME}}
9729 !! html
9730 <p>00:02
9731 </p>
9732 !! end
9733
9734 !! test
9735 Magic Word: {{CURRENTHOUR}}
9736 !! wikitext
9737 {{CURRENTHOUR}}
9738 !! html
9739 <p>00
9740 </p>
9741 !! end
9742
9743 !! test
9744 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9745 !! wikitext
9746 {{CURRENTWEEK}}
9747 !! html
9748 <p>1
9749 </p>
9750 !! end
9751
9752 !! test
9753 Magic Word: {{CURRENTYEAR}}
9754 !! wikitext
9755 {{CURRENTYEAR}}
9756 !! html
9757 <p>1970
9758 </p>
9759 !! end
9760
9761 !! test
9762 Magic Word: {{CURRENTTIMESTAMP}}
9763 !! wikitext
9764 {{CURRENTTIMESTAMP}}
9765 !! html
9766 <p>19700101000203
9767 </p>
9768 !! end
9769
9770 !! test
9771 Magic Words LOCAL (UTC)
9772 !! wikitext
9773 * {{LOCALMONTH}}
9774 * {{LOCALMONTH1}}
9775 * {{LOCALMONTHNAME}}
9776 * {{LOCALMONTHNAMEGEN}}
9777 * {{LOCALMONTHABBREV}}
9778 * {{LOCALDAY}}
9779 * {{LOCALDAY2}}
9780 * {{LOCALDAYNAME}}
9781 * {{LOCALYEAR}}
9782 * {{LOCALTIME}}
9783 * {{LOCALHOUR}}
9784 * {{LOCALWEEK}}
9785 * {{LOCALDOW}}
9786 * {{LOCALTIMESTAMP}}
9787 !! html
9788 <ul><li> 01</li>
9789 <li> 1</li>
9790 <li> January</li>
9791 <li> January</li>
9792 <li> Jan</li>
9793 <li> 1</li>
9794 <li> 01</li>
9795 <li> Thursday</li>
9796 <li> 1970</li>
9797 <li> 00:02</li>
9798 <li> 00</li>
9799 <li> 1</li>
9800 <li> 4</li>
9801 <li> 19700101000203</li></ul>
9802
9803 !! end
9804
9805 !! test
9806 Magic Word: {{FULLPAGENAME}}
9807 !! options
9808 title=[[User:Ævar Arnfjörð Bjarmason]]
9809 !! wikitext
9810 {{FULLPAGENAME}}
9811 !! html
9812 <p>User:Ævar Arnfjörð Bjarmason
9813 </p>
9814 !! end
9815
9816 !! test
9817 Magic Word: {{FULLPAGENAMEE}}
9818 !! options
9819 title=[[User:Ævar Arnfjörð Bjarmason]]
9820 !! wikitext
9821 {{FULLPAGENAMEE}}
9822 !! html
9823 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9824 </p>
9825 !! end
9826
9827 !! test
9828 Magic Word: {{TALKSPACE}}
9829 !! options
9830 title=[[User:Ævar Arnfjörð Bjarmason]]
9831 !! wikitext
9832 {{TALKSPACE}}
9833 !! html
9834 <p>User talk
9835 </p>
9836 !! end
9837
9838 !! test
9839 Magic Word: {{TALKSPACE}}, same namespace
9840 !! options
9841 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9842 !! wikitext
9843 {{TALKSPACE}}
9844 !! html
9845 <p>User talk
9846 </p>
9847 !! end
9848
9849 !! test
9850 Magic Word: {{TALKSPACE}}, main namespace
9851 !! options
9852 title=[[Parser Test]]
9853 !! wikitext
9854 {{TALKSPACE}}
9855 !! html
9856 <p>Talk
9857 </p>
9858 !! end
9859
9860 !! test
9861 Magic Word: {{TALKSPACEE}}
9862 !! options
9863 title=[[User:Ævar Arnfjörð Bjarmason]]
9864 !! wikitext
9865 {{TALKSPACEE}}
9866 !! html
9867 <p>User_talk
9868 </p>
9869 !! end
9870
9871 !! test
9872 Magic Word: {{SUBJECTSPACE}}
9873 !! options
9874 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9875 !! wikitext
9876 {{SUBJECTSPACE}}
9877 !! html
9878 <p>User
9879 </p>
9880 !! end
9881
9882 !! test
9883 Magic Word: {{SUBJECTSPACE}}, same namespace
9884 !! options
9885 title=[[User:Ævar Arnfjörð Bjarmason]]
9886 !! wikitext
9887 {{SUBJECTSPACE}}
9888 !! html
9889 <p>User
9890 </p>
9891 !! end
9892
9893 !! test
9894 Magic Word: {{SUBJECTSPACE}}, main namespace
9895 !! options
9896 title=[[Parser Test]]
9897 !! wikitext
9898 {{SUBJECTSPACE}}
9899 !! html
9900
9901 !! end
9902
9903 !! test
9904 Magic Word: {{SUBJECTSPACEE}}
9905 !! options
9906 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9907 !! wikitext
9908 {{SUBJECTSPACEE}}
9909 !! html
9910 <p>User
9911 </p>
9912 !! end
9913
9914 !! test
9915 Magic Word: {{NAMESPACE}}
9916 !! options
9917 title=[[User:Ævar Arnfjörð Bjarmason]]
9918 !! wikitext
9919 {{NAMESPACE}}
9920 !! html
9921 <p>User
9922 </p>
9923 !! end
9924
9925 !! test
9926 Magic Word: {{NAMESPACEE}}
9927 !! options
9928 title=[[User:Ævar Arnfjörð Bjarmason]]
9929 !! wikitext
9930 {{NAMESPACEE}}
9931 !! html
9932 <p>User
9933 </p>
9934 !! end
9935
9936 !! test
9937 Magic Word: {{NAMESPACENUMBER}}
9938 !! options
9939 title=[[User:Ævar Arnfjörð Bjarmason]]
9940 !! wikitext
9941 {{NAMESPACENUMBER}}
9942 !! html
9943 <p>2
9944 </p>
9945 !! end
9946
9947 !! test
9948 Magic Word: {{SUBPAGENAME}}
9949 !! options
9950 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9951 !! wikitext
9952 {{SUBPAGENAME}}
9953 !! html
9954 <p>sub ö
9955 </p>
9956 !! end
9957
9958 !! test
9959 Magic Word: {{SUBPAGENAMEE}}
9960 !! options
9961 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9962 !! wikitext
9963 {{SUBPAGENAMEE}}
9964 !! html
9965 <p>sub_%C3%B6
9966 </p>
9967 !! end
9968
9969 !! test
9970 Magic Word: {{ROOTPAGENAME}}
9971 !! options
9972 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9973 !! wikitext
9974 {{ROOTPAGENAME}}
9975 !! html
9976 <p>Ævar Arnfjörð Bjarmason
9977 </p>
9978 !! end
9979
9980 !! test
9981 Magic Word: {{ROOTPAGENAMEE}}
9982 !! options
9983 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9984 !! wikitext
9985 {{ROOTPAGENAMEE}}
9986 !! html
9987 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9988 </p>
9989 !! end
9990
9991 !! test
9992 Magic Word: {{BASEPAGENAME}}
9993 !! options
9994 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9995 !! wikitext
9996 {{BASEPAGENAME}}
9997 !! html
9998 <p>Ævar Arnfjörð Bjarmason
9999 </p>
10000 !! end
10001
10002 !! test
10003 Magic Word: {{BASEPAGENAMEE}}
10004 !! options
10005 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10006 !! wikitext
10007 {{BASEPAGENAMEE}}
10008 !! html
10009 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10010 </p>
10011 !! end
10012
10013 !! test
10014 Magic Word: {{TALKPAGENAME}}
10015 !! options
10016 title=[[User:Ævar Arnfjörð Bjarmason]]
10017 !! wikitext
10018 {{TALKPAGENAME}}
10019 !! html
10020 <p>User talk:Ævar Arnfjörð Bjarmason
10021 </p>
10022 !! end
10023
10024 !! test
10025 Magic Word: {{TALKPAGENAMEE}}
10026 !! options
10027 title=[[User:Ævar Arnfjörð Bjarmason]]
10028 !! wikitext
10029 {{TALKPAGENAMEE}}
10030 !! html
10031 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10032 </p>
10033 !! end
10034
10035 !! test
10036 Magic Word: {{SUBJECTPAGENAME}}
10037 !! options
10038 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10039 !! wikitext
10040 {{SUBJECTPAGENAME}}
10041 !! html
10042 <p>User:Ævar Arnfjörð Bjarmason
10043 </p>
10044 !! end
10045
10046 !! test
10047 Magic Word: {{SUBJECTPAGENAMEE}}
10048 !! options
10049 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10050 !! wikitext
10051 {{SUBJECTPAGENAMEE}}
10052 !! html
10053 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10054 </p>
10055 !! end
10056
10057 !! test
10058 Magic Word: {{NUMBEROFFILES}}
10059 !! wikitext
10060 {{NUMBEROFFILES}}
10061 !! html
10062 <p>7
10063 </p>
10064 !! end
10065
10066 !! test
10067 Magic Word: {{PAGENAME}}
10068 !! options
10069 title=[[User:Ævar Arnfjörð Bjarmason]]
10070 !! wikitext
10071 {{PAGENAME}}
10072 !! html
10073 <p>Ævar Arnfjörð Bjarmason
10074 </p>
10075 !! end
10076
10077 !! test
10078 Magic Word: {{PAGENAME}} with metacharacters
10079 !! options
10080 title=[['foo & bar = baz']]
10081 !! wikitext
10082 ''{{PAGENAME}}''
10083 !! html/php
10084 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10085 </p>
10086 !! html+tidy
10087 <p><i>'foo &amp; bar = baz'</i></p>
10088 !! end
10089
10090 !! test
10091 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
10092 !! options
10093 title=[[*RFC 1234 http://example.com/]]
10094 !! wikitext
10095 {{PAGENAME}}
10096 !! html/php
10097 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10098 </p>
10099 !! html+tidy
10100 <p>*RFC 1234 http://example.com/</p>
10101 !! end
10102
10103 !! test
10104 Magic Word: {{PAGENAMEE}}
10105 !! options
10106 title=[[User:Ævar Arnfjörð Bjarmason]]
10107 !! wikitext
10108 {{PAGENAMEE}}
10109 !! html
10110 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10111 </p>
10112 !! end
10113
10114 !! test
10115 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
10116 !! options
10117 title=[[*RFC 1234 http://example.com/]]
10118 !! wikitext
10119 {{PAGENAMEE}}
10120 !! html/php
10121 <p>&#42;RFC_1234_http&#58;//example.com/
10122 </p>
10123 !! html+tidy
10124 <p>*RFC_1234_http://example.com/</p>
10125 !! end
10126
10127 !! test
10128 Magic Word: {{REVISIONID}}
10129 !! wikitext
10130 {{REVISIONID}}
10131 !! html
10132 <p>1337
10133 </p>
10134 !! end
10135
10136 !! test
10137 Magic Word: {{SCRIPTPATH}}
10138 !! wikitext
10139 {{SCRIPTPATH}}
10140 !! html
10141
10142 !! end
10143
10144 !! test
10145 Magic Word: {{STYLEPATH}}
10146 !! wikitext
10147 {{STYLEPATH}}
10148 !! html
10149 <p>/skins
10150 </p>
10151 !! end
10152
10153 !! test
10154 Magic Word: {{SERVER}}
10155 !! wikitext
10156 {{SERVER}}
10157 !! html
10158 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10159 </p>
10160 !! end
10161
10162 !! test
10163 Magic Word: {{SERVERNAME}}
10164 !! wikitext
10165 {{SERVERNAME}}
10166 !! html
10167 <p>example.org
10168 </p>
10169 !! end
10170
10171 !! test
10172 Magic Word: {{SITENAME}}
10173 !! wikitext
10174 {{SITENAME}}
10175 !! html
10176 <p>MediaWiki
10177 </p>
10178 !! end
10179
10180 !! test
10181 Case-sensitive magic words, when cased differently, should just be template transclusions
10182 !! wikitext
10183 {{CurrentMonth}}
10184 {{currentday}}
10185 {{cURreNTweEK}}
10186 {{currentHour}}
10187 !! html
10188 <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>
10189 <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>
10190 <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>
10191 <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>
10192 </p>
10193 !! end
10194
10195 !! test
10196 Case-insensitive magic words should still work with weird casing.
10197 !! wikitext
10198 {{sErVeRNaMe}}
10199 {{LCFirst:AOEU}}
10200 {{ucFIRST:aoeu}}
10201 {{SERver}}
10202 !! html
10203 <p>example.org
10204 aOEU
10205 Aoeu
10206 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10207 </p>
10208 !! end
10209
10210 # From plwiki:PLOS_ONE
10211 !! test
10212 Parsoid: Page property magic word with magic word contents
10213 !! wikitext
10214 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10215 !! html/parsoid
10216 <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>"}]]}'/>
10217 !! end
10218
10219 !! test
10220 Parsoid: Template-generated DISPLAYTITLE
10221 !! wikitext
10222 {{{{echo|DISPLAYTITLE}}:Foo}}
10223 !! html/parsoid
10224 <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}}]}'/>
10225 !! end
10226
10227 !! test
10228 Namespace 1 {{ns:1}}
10229 !! wikitext
10230 {{ns:1}}
10231 !! html
10232 <p>Talk
10233 </p>
10234 !! end
10235
10236 !! test
10237 Namespace 1 {{ns:01}}
10238 !! wikitext
10239 {{ns:01}}
10240 !! html
10241 <p>Talk
10242 </p>
10243 !! end
10244
10245 !! test
10246 Namespace 0 {{ns:0}} (bug 4783)
10247 !! wikitext
10248 {{ns:0}}
10249 !! html
10250
10251 !! end
10252
10253 !! test
10254 Namespace 0 {{ns:00}} (bug 4783)
10255 !! wikitext
10256 {{ns:00}}
10257 !! html
10258
10259 !! end
10260
10261 !! test
10262 Namespace -1 {{ns:-1}}
10263 !! wikitext
10264 {{ns:-1}}
10265 !! html
10266 <p>Special
10267 </p>
10268 !! end
10269
10270 !! test
10271 Namespace User {{ns:User}}
10272 !! wikitext
10273 {{ns:User}}
10274 !! html
10275 <p>User
10276 </p>
10277 !! end
10278
10279 !! test
10280 Namespace User talk {{ns:User_talk}}
10281 !! wikitext
10282 {{ns:User_talk}}
10283 !! html
10284 <p>User talk
10285 </p>
10286 !! end
10287
10288 !! test
10289 Namespace User talk {{ns:uSeR tAlK}}
10290 !! wikitext
10291 {{ns:uSeR tAlK}}
10292 !! html
10293 <p>User talk
10294 </p>
10295 !! end
10296
10297 !! test
10298 Namespace File {{ns:File}}
10299 !! wikitext
10300 {{ns:File}}
10301 !! html
10302 <p>File
10303 </p>
10304 !! end
10305
10306 !! test
10307 Namespace File {{ns:Image}}
10308 !! wikitext
10309 {{ns:Image}}
10310 !! html
10311 <p>File
10312 </p>
10313 !! end
10314
10315 !! test
10316 Namespace (lang=de) Benutzer {{ns:User}}
10317 !! options
10318 language=de
10319 !! wikitext
10320 {{ns:User}}
10321 !! html
10322 <p>Benutzer
10323 </p>
10324 !! end
10325
10326 !! test
10327 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10328 !! options
10329 language=de
10330 !! wikitext
10331 {{ns:3}}
10332 !! html
10333 <p>Benutzer Diskussion
10334 </p>
10335 !! end
10336
10337
10338 !! test
10339 Urlencode
10340 !! wikitext
10341 {{urlencode:hi world?!}}
10342 {{urlencode:hi world?!|WIKI}}
10343 {{urlencode:hi world?!|PATH}}
10344 {{urlencode:hi world?!|QUERY}}
10345 !! html
10346 <p>hi+world%3F%21
10347 hi_world%3F!
10348 hi%20world%3F%21
10349 hi+world%3F%21
10350 </p>
10351 !! end
10352
10353 !! test
10354 Magic Word: prioritize type info over data-parsoid
10355 !! options
10356 parsoid=html2wt
10357 !! html/parsoid
10358 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10359 !! wikitext
10360 __FORCETOC__
10361 !! end
10362
10363 !! test
10364 Magic Word: serialize on separate line (parsoid)
10365 !! options
10366 parsoid=wt2wt,html2wt
10367 !! wikitext
10368 foo
10369 __NOTOC__
10370 bar
10371 !! html/parsoid
10372 foo<meta property="mw:PageProp/notoc"/>bar
10373 !! end
10374
10375 !! test
10376 Magic Word: rt non-english wikis
10377 !! options
10378 parsoid=wt2wt
10379 language=de
10380 !! wikitext
10381 __NOEDITSECTION__
10382 !! html/parsoid
10383 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10384 !! end
10385
10386 !!test
10387 __proto__ is treated as normal wikitext (T105997)
10388 !!wikitext
10389 __proto__
10390 !!html
10391 <p>__proto__
10392 </p>
10393 !!end
10394
10395 ###
10396 ### Magic links
10397 ###
10398 !! test
10399 Magic links: internal link to RFC (bug 479)
10400 !! wikitext
10401 [[RFC 123]]
10402 !! html/php
10403 <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>
10404 </p>
10405 !! html/parsoid
10406 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10407 !! end
10408
10409 !! test
10410 Magic links: RFC (bug 479)
10411 !! wikitext
10412 RFC 822
10413 !! html/php
10414 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10415 </p>
10416 !! html/parsoid
10417 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10418 !! end
10419
10420 !! test
10421 Magic links: RFC (bug 65278)
10422 !! wikitext
10423 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10424 !! html/php
10425 <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.
10426 </p>
10427 !! html/parsoid
10428 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10429 !! end
10430
10431 !! test
10432 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
10433 !! wikitext
10434 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10435 RFC
10436 822
10437 !! html/php
10438 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10439 RFC
10440 822
10441 </p>
10442 !! html/parsoid
10443 <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>
10444 RFC
10445 822</p>
10446 !! end
10447
10448 !! test
10449 Magic links: ISBN (bug 1937)
10450 !! wikitext
10451 ISBN 0-306-40615-2
10452 !! html/php
10453 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10454 </p>
10455 !! html/parsoid
10456 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10457 !! end
10458
10459 !! test
10460 Magic links: ISBN (bug 65278)
10461 !! wikitext
10462 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10463 !! html/php
10464 <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.
10465 </p>
10466 !! html/parsoid
10467 <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>
10468 !! end
10469
10470 !! test
10471 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10472 !! wikitext
10473 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10474 ISBN
10475 9780316098113
10476 ISBN 978
10477 0316098113
10478 !! html/php
10479 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10480 ISBN
10481 9780316098113
10482 ISBN 978
10483 0316098113
10484 </p>
10485 !! html/parsoid
10486 <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>
10487 ISBN
10488 9780316098113
10489 ISBN 978
10490 0316098113</p>
10491 !! end
10492
10493 !! test
10494 Magic links: PMID incorrectly converts space to underscore
10495 !! wikitext
10496 PMID 1234
10497 !! html/php
10498 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10499 </p>
10500 !! html/parsoid
10501 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10502 !! end
10503
10504 !! test
10505 Magic links: PMID (bug 65278)
10506 !! wikitext
10507 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10508 !! html/php
10509 <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.
10510 </p>
10511 !! html/parsoid
10512 <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>
10513 !! end
10514
10515 !! test
10516 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10517 !! wikitext
10518 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10519 PMID
10520 1234
10521 !! html/php
10522 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10523 PMID
10524 1234
10525 </p>
10526 !! html/parsoid
10527 <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>
10528 PMID
10529 1234</p>
10530 !! end
10531
10532 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10533 # since these are ExtLinkText, not MagicLinkText
10534 !! test
10535 Magic links: use appropriate serialization for "almost" magic links.
10536 !! wikitext
10537 X[[Special:BookSources/0978739256|foo]]
10538
10539 X[//tools.ietf.org/html/rfc1234 foo]
10540 !! html/php
10541 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10542 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10543 </p>
10544 !! html/parsoid
10545 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10546 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10547 !! end
10548
10549 !! test
10550 Magic links: All disabled (T47942)
10551 !! options
10552 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
10553 !! wikitext
10554 ISBN 0-306-40615-2
10555 PMID 1234
10556 RFC 4321
10557 !! html/php
10558 <p>ISBN 0-306-40615-2
10559 PMID 1234
10560 RFC 4321
10561 </p>
10562 !! end
10563
10564 ###
10565 ### Templates
10566 ####
10567
10568 !! test
10569 Nonexistent template
10570 !! wikitext
10571 {{thistemplatedoesnotexist}}
10572 !! html
10573 <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>
10574 </p>
10575 !! end
10576
10577 !! test
10578 Template with invalid target containing tags
10579 !! wikitext
10580 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10581 !! html
10582 <p>{{a<b>b</b>|foo|a=b|a = b}}
10583 </p>
10584 !! end
10585
10586 !! test
10587 Template with invalid target containing unclosed tag
10588 !! wikitext
10589 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10590 !! html
10591 <p>{{a<b>|foo|a=b|a = b}}</b>
10592 </p>
10593 !! end
10594
10595 !! test
10596 Template with invalid target containing wikilink
10597 !! wikitext
10598 {{[[Main Page]]}}
10599 !! html/php
10600 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10601 </p>
10602 !! html/parsoid
10603 <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>
10604 !! end
10605
10606 !! test
10607 Template with just whitespace in it, bug #68421
10608 !! wikitext
10609 {{echo|{{ }}}}
10610 !! html/parsoid
10611 <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>
10612 !! end
10613
10614 !! article
10615 Template:test
10616 !! text
10617 This is a test template
10618 !! endarticle
10619
10620 !! test
10621 Simple template
10622 !! wikitext
10623 {{test}}
10624 !! html
10625 <p>This is a test template
10626 </p>
10627 !! end
10628
10629 !! test
10630 Template with explicit namespace
10631 !! wikitext
10632 {{Template:test}}
10633 !! html
10634 <p>This is a test template
10635 </p>
10636 !! end
10637
10638
10639 !! article
10640 Template:paramtest
10641 !! text
10642 This is a test template with parameter {{{param}}}
10643 !! endarticle
10644
10645 !! test
10646 Template parameter
10647 !! wikitext
10648 {{paramtest|param=foo}}
10649 !! html
10650 <p>This is a test template with parameter foo
10651 </p>
10652 !! end
10653
10654 !! article
10655 Template:paramtestnum
10656 !! text
10657 [[{{{1}}}|{{{2}}}]]
10658 !! endarticle
10659
10660 !! test
10661 Template unnamed parameter
10662 !! wikitext
10663 {{paramtestnum|Main Page|the main page}}
10664 !! html
10665 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10666 </p>
10667 !! end
10668
10669 !! article
10670 Template:templatesimple
10671 !! text
10672 (test)
10673 !! endarticle
10674
10675 !! article
10676 Template:templateredirect
10677 !! text
10678 #redirect [[Template:templatesimple]]
10679 !! endarticle
10680
10681 !! article
10682 Template:templateasargtestnum
10683 !! text
10684 {{{{{1}}}}}
10685 !! endarticle
10686
10687 !! article
10688 Template:templateasargtest
10689 !! text
10690 {{template{{{templ}}}}}
10691 !! endarticle
10692
10693 !! article
10694 Template:templateasargtest2
10695 !! text
10696 {{{{{templ}}}}}
10697 !! endarticle
10698
10699 !! test
10700 Template with template name as unnamed argument
10701 !! wikitext
10702 {{templateasargtestnum|templatesimple}}
10703 !! html
10704 <p>(test)
10705 </p>
10706 !! end
10707
10708 !! test
10709 Template with template name as argument
10710 !! wikitext
10711 {{templateasargtest|templ=simple}}
10712 !! html
10713 <p>(test)
10714 </p>
10715 !! end
10716
10717 !! test
10718 Template with template name as argument (2)
10719 !! wikitext
10720 {{templateasargtest2|templ=templatesimple}}
10721 !! html
10722 <p>(test)
10723 </p>
10724 !! end
10725
10726 !! article
10727 Template:templateasargtestdefault
10728 !! text
10729 {{{{{templ|templatesimple}}}}}
10730 !! endarticle
10731
10732 !! article
10733 Template:templa
10734 !! text
10735 '''templ'''
10736 !! endarticle
10737
10738 !! test
10739 Template with default value
10740 !! wikitext
10741 {{templateasargtestdefault}}
10742 !! html
10743 <p>(test)
10744 </p>
10745 !! end
10746
10747 !! test
10748 Template with default value (value set)
10749 !! wikitext
10750 {{templateasargtestdefault|templ=templa}}
10751 !! html
10752 <p><b>templ</b>
10753 </p>
10754 !! end
10755
10756 !! test
10757 Template redirect
10758 !! wikitext
10759 {{templateredirect}}
10760 !! html/php
10761 <p>(test)
10762 </p>
10763 !! html/parsoid
10764 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10765 !! end
10766
10767 !! test
10768 Template with argument in separate line
10769 !! wikitext
10770 {{ templateasargtest |
10771 templ = simple }}
10772 !! html
10773 <p>(test)
10774 </p>
10775 !! end
10776
10777 !! test
10778 Template with complex template as argument
10779 !! wikitext
10780 {{paramtest|
10781 param ={{ templateasargtest |
10782 templ = simple }}}}
10783 !! html
10784 <p>This is a test template with parameter (test)
10785 </p>
10786 !! end
10787
10788 !! test
10789 Template with thumb image (with link in description)
10790 !! wikitext
10791 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10792 !! html/php
10793 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>
10794
10795 !! html+tidy
10796 <p>This is a test template with parameter</p>
10797 <div class="thumb tright">
10798 <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>
10799 <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>
10800 </div>
10801 </div>
10802 !! html/parsoid
10803 <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>
10804 !! end
10805
10806 !! article
10807 Template:complextemplate
10808 !! text
10809 {{{1}}} {{paramtest|
10810 param ={{{param}}}}}
10811 !! endarticle
10812
10813 !! test
10814 Template with complex arguments
10815 !! wikitext
10816 {{complextemplate|
10817 param ={{ templateasargtest |
10818 templ = simple }}|[[Template:complextemplate|link]]}}
10819 !! html
10820 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10821 </p>
10822 !! end
10823
10824 !! test
10825 BUG 553: link with two variables in a piped link
10826 !! wikitext
10827 {|
10828 |[[{{{1}}}|{{{2}}}]]
10829 |}
10830 !! html/php
10831 <table>
10832 <tr>
10833 <td>[[{{{1}}}|{{{2}}}]]
10834 </td></tr></table>
10835
10836 !! html/parsoid
10837 <table>
10838 <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>
10839 !! end
10840
10841 # See: T2553
10842 !! test
10843 Abort table cell attribute parsing on wikilink
10844 !! wikitext
10845 {|
10846 | testing [[one|two]] | three || four
10847 | testing one two | three || four
10848 | testing="[[one|two]]" | three || four
10849 |}
10850 !! html/php
10851 <table>
10852 <tr>
10853 <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>
10854 <td> four
10855 </td>
10856 <td> three </td>
10857 <td> four
10858 </td>
10859 <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>
10860 <td> four
10861 </td></tr></table>
10862
10863 !! html/parsoid
10864 <table>
10865 <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>
10866 <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>
10867 <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>
10868 </tbody></table>
10869 !! end
10870
10871 !! test
10872 Don't abort table cell attribute parsing if wikilink is found in template arg
10873 !! wikitext
10874 {|
10875 | Test {{#tag:ref|One two "[[three]]" four}}
10876 |}
10877 !! html/parsoid
10878 <table>
10879 <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>
10880 </tbody></table>
10881 !! end
10882
10883 !! test
10884 Magic variable as template parameter
10885 !! wikitext
10886 {{paramtest|param={{SITENAME}}}}
10887 !! html
10888 <p>This is a test template with parameter MediaWiki
10889 </p>
10890 !! end
10891
10892 !! article
10893 Template:linktest
10894 !! text
10895 [[{{{param}}}|link]]
10896 !! endarticle
10897
10898 !! test
10899 Template parameter as link source
10900 !! wikitext
10901 {{linktest|param=Main Page}}
10902 !! html
10903 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10904 </p>
10905 !! end
10906
10907 !!article
10908 Template:paramtest2
10909 !! text
10910 including another template, {{paramtest|param={{{arg}}}}}
10911 !! endarticle
10912
10913 !! test
10914 Template passing argument to another template
10915 !! wikitext
10916 {{paramtest2|arg='hmm'}}
10917 !! html
10918 <p>including another template, This is a test template with parameter 'hmm'
10919 </p>
10920 !! end
10921
10922 !! article
10923 Template:Linktest2
10924 !! text
10925 Main Page
10926 !! endarticle
10927
10928 !! test
10929 Template as link source
10930 !! wikitext
10931 [[{{linktest2}}]]
10932
10933 [[{{linktest2}}|Main Page]]
10934
10935 [[{{linktest2}}]]Page
10936 !! html
10937 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10938 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10939 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10940 </p>
10941 !! end
10942
10943
10944 !! article
10945 Template:loop1
10946 !! text
10947 {{loop2}}
10948 !! endarticle
10949
10950 !! article
10951 Template:loop2
10952 !! text
10953 {{loop1}}
10954 !! endarticle
10955
10956 !! test
10957 Template infinite loop
10958 !! wikitext
10959 {{loop1}}
10960 !! html
10961 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10962 </p>
10963 !! end
10964
10965 !! test
10966 Template from main namespace
10967 !! wikitext
10968 {{:Main Page}}
10969 !! html
10970 <p>blah blah
10971 </p>
10972 !! end
10973
10974 !! article
10975 Template:table
10976 !! text
10977 {|
10978 | 1 || 2
10979 |-
10980 | 3 || 4
10981 |}
10982 !! endarticle
10983
10984 !! test
10985 BUG 529: Template with table, not included at beginning of line
10986 !! wikitext
10987 foo {{table}}
10988 !! html
10989 <p>foo
10990 </p>
10991 <table>
10992 <tr>
10993 <td> 1 </td>
10994 <td> 2
10995 </td></tr>
10996 <tr>
10997 <td> 3 </td>
10998 <td> 4
10999 </td></tr></table>
11000
11001 !! end
11002
11003 !! test
11004 BUG 523: Template shouldn't eat newline (or add an extra one before table)
11005 !! wikitext
11006 foo
11007 {{table}}
11008 !! html
11009 <p>foo
11010 </p>
11011 <table>
11012 <tr>
11013 <td> 1 </td>
11014 <td> 2
11015 </td></tr>
11016 <tr>
11017 <td> 3 </td>
11018 <td> 4
11019 </td></tr></table>
11020
11021 !! end
11022
11023 !! test
11024 BUG 41: Template parameters shown as broken links
11025 !! wikitext
11026 {{{parameter}}}
11027 !! html
11028 <p>{{{parameter}}}
11029 </p>
11030 !! end
11031
11032 !! test
11033 Template with targets containing wikilinks
11034 !! wikitext
11035 {{[[foo]]}}
11036
11037 {{[[{{echo|foo}}]]}}
11038
11039 {{{{echo|[[foo}}]]}}
11040 !! html
11041 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11042 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11043 </p><p>{{[[foo}}]]
11044 </p>
11045 !! end
11046
11047 !! article
11048 Template:''
11049 !! text
11050 bar
11051 !! endarticle
11052
11053 !! test
11054 Templates: Double quotes as template target
11055 !! wikitext
11056 foo {{''}} baz
11057 !! html/php
11058 <p>foo bar baz
11059 </p>
11060 !! html/parsoid
11061 <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
11062 </p>
11063 !! end
11064
11065 ## This test is about making sure Parsoid's data-mw is well formed in the
11066 ## face of multiple templates with intersecting and overlapping ranges. The
11067 ## wikitext itself is wretched.
11068 !! test
11069 Templates with intersecting and overlapping ranges
11070 !! wikitext
11071 {|{{echo|
11072 <p>ha</p>}}
11073 {|{{echo|
11074 <p>ho</p>}}
11075 {{echo|{{!}}hi}}
11076 |}
11077 !! html/php+tidy
11078 <p>ha</p>
11079 <p>ho</p>
11080 <table>
11081 <tr>
11082 <td></td>
11083 </tr>
11084 <tr>
11085 <td>hi</td>
11086 </tr>
11087 </table>
11088 <table>
11089 <tr>
11090 <td></td>
11091 </tr>
11092 </table>
11093 !! html/parsoid
11094 <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":""}]]}'>
11095
11096 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11097
11098 <tbody><tr><td>hi</td></tr>
11099 </tbody></table>
11100 !! end
11101
11102 !! article
11103 Template:MSGNW test
11104 !! text
11105 ''None'' of '''this''' should be
11106 * interpreted
11107 but rather passed unmodified
11108 {{test}}
11109 <gallery>
11110 File:Foobar.jpg
11111 </gallery>
11112 <!-- comment -->
11113 !! endarticle
11114
11115 # hmm, fix this or just deprecate msgnw and document its behavior?
11116 !! test
11117 msgnw keyword
11118 !! wikitext
11119 {{msgnw:MSGNW test}}
11120 !! html/php
11121 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11122 &#42; interpreted
11123 &#32;but rather passed unmodified
11124 &#123;&#123;test&#125;&#125;
11125 &#60;gallery&#62;
11126 File:Foobar.jpg
11127 &#60;/gallery&#62;
11128 &#60;!-- comment --&#62;
11129 </p>
11130 !! end
11131
11132 !! test
11133 int keyword
11134 !! wikitext
11135 {{int:youhavenewmessages|lots of money|not!}}
11136 !! html
11137 <p>You have lots of money (not!).
11138 </p>
11139 !! end
11140
11141 !! test
11142 int keyword - non-existing message
11143 !! wikitext
11144 {{int:var}}
11145 !! html
11146 <p>⧼var⧽
11147 </p>
11148 !! end
11149
11150 !! article
11151 Template:Includes
11152 !! text
11153 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11154 !! endarticle
11155
11156 !! test
11157 <includeonly> and <noinclude> being included
11158 !! wikitext
11159 {{Includes}}
11160 !! html
11161 <p>Foobar
11162 </p>
11163 !! end
11164
11165 !! article
11166 Template:Includes2
11167 !! text
11168 <onlyinclude>Foo</onlyinclude>bar
11169 !! endarticle
11170
11171 !! test
11172 <onlyinclude> being included
11173 !! wikitext
11174 {{Includes2}}
11175 !! html
11176 <p>Foo
11177 </p>
11178 !! end
11179
11180
11181 !! article
11182 Template:Includes3
11183 !! text
11184 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11185 !! endarticle
11186
11187 !! test
11188 <onlyinclude> and <includeonly> being included
11189 !! wikitext
11190 {{Includes3}}
11191 !! html
11192 <p>Foo
11193 </p>
11194 !! end
11195
11196 !! test
11197 <includeonly> and <noinclude> on a page
11198 !! wikitext
11199 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11200 !! html
11201 <p>Foozar
11202 </p>
11203 !! end
11204
11205 !! test
11206 Un-closed <noinclude>
11207 !! wikitext
11208 <noinclude>
11209 !! html
11210 !! end
11211
11212 !! test
11213 <onlyinclude> on a page
11214 !! wikitext
11215 <onlyinclude>Foo</onlyinclude>bar
11216 !! html
11217 <p>Foobar
11218 </p>
11219 !! end
11220
11221 !! test
11222 Un-closed <onlyinclude>
11223 !! wikitext
11224 <onlyinclude>
11225 !! html
11226 !! end
11227
11228 !!test
11229 Self-closed noinclude, includeonly, onlyinclude tags
11230 !! wikitext
11231 <noinclude />
11232 <includeonly />
11233 <onlyinclude />
11234 !! html
11235 <p><br />
11236 </p>
11237 !!end
11238
11239 !!test
11240 Unbalanced includeonly and noinclude tags
11241 !! wikitext
11242 {|
11243 |a</noinclude>
11244 |b</noinclude></noinclude>
11245 |c</noinclude></includeonly>
11246 |d</includeonly></includeonly>
11247 |}
11248 !! html
11249 <table>
11250 <tr>
11251 <td>a
11252 </td>
11253 <td>b
11254 </td>
11255 <td>c&lt;/includeonly&gt;
11256 </td>
11257 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11258 </td></tr></table>
11259
11260 !!end
11261
11262 !! article
11263 Template:Includeonly section
11264 !! text
11265 <includeonly>
11266 ==Includeonly section==
11267 </includeonly>
11268 ==Section T-1==
11269 !!endarticle
11270
11271 !! test
11272 Bug 6563: Edit link generation for section shown by <includeonly>
11273 !! wikitext
11274 {{includeonly section}}
11275 !! html
11276 <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>
11277 <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>
11278
11279 !! end
11280
11281 # Uses same input as the contents of [[Template:Includeonly section]]
11282 !! test
11283 Bug 6563: Section extraction for section shown by <includeonly>
11284 !! options
11285 section=T-2
11286 !! wikitext
11287 <includeonly>
11288 ==Includeonly section==
11289 </includeonly>
11290 ==Section T-2==
11291 !! html
11292 ==Section T-2==
11293 !! end
11294
11295 !! test
11296 Bug 6563: Edit link generation for section suppressed by <includeonly>
11297 !! wikitext
11298 <includeonly>
11299 ==Includeonly section==
11300 </includeonly>
11301 ==Section 1==
11302 !! html
11303 <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>
11304
11305 !! end
11306
11307 !! test
11308 Bug 6563: Section extraction for section suppressed by <includeonly>
11309 !! options
11310 section=1
11311 !! wikitext
11312 <includeonly>
11313 ==Includeonly section==
11314 </includeonly>
11315 ==Section 1==
11316 !! html
11317 ==Section 1==
11318 !! end
11319
11320 !! test
11321 Un-closed <includeonly>
11322 !! wikitext
11323 <includeonly>
11324 !! html/php
11325 !! html/parsoid
11326 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11327 !! end
11328
11329 ## We used to, but no longer wt2wt this test since the default serializer
11330 ## will normalize the include directives to serialize on their own line.
11331 ## Selser will take care of preserving formatting in scenarios where they
11332 ## intermingled with other wikitext.
11333 !! test
11334 Includes and comments at SOL
11335 !! options
11336 parsoid=wt2html,html2html
11337 !! wikitext
11338 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11339
11340 <noinclude>
11341 some
11342 </noinclude>* stuff
11343 * here
11344
11345 <includeonly>can have stuff</includeonly>=== here ===
11346
11347 !! html/php
11348 <h2><span class="mw-headline" id="hu">hu</span></h2>
11349 <p>some
11350 </p>
11351 <ul><li> stuff</li>
11352 <li> here</li></ul>
11353 <h3><span class="mw-headline" id="here">here</span></h3>
11354
11355 !! html/parsoid
11356 <!-- 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>
11357
11358 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11359 <p>some</p>
11360 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11361 <li> here</li></ul>
11362
11363 <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>
11364
11365 !! end
11366
11367 # TODO: test with DOM fragment reuse!
11368 !! test
11369 Parsoid: DOM fragment reuse
11370 !! options
11371 parsoid=wt2wt,wt2html
11372 !! wikitext
11373 a{{echo|b<table></table>c}}d
11374
11375 a{{echo|b
11376 <table></table>
11377 c}}d
11378
11379 {{echo|a
11380
11381 <table></table>
11382
11383 b}}
11384 !! html
11385 <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>
11386
11387 <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">
11388 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11389 </span><p about="#mwt2">cd</p>
11390
11391 <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">
11392
11393 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11394
11395 </span><p about="#mwt3">b</p>
11396 !! end
11397
11398 !! test
11399 Parsoid: Merge double tds (T52603)
11400 !! options
11401 parsoid
11402 !! wikitext
11403 {|
11404 |{{echo|{{!}} foo}}
11405 |}
11406 !! html
11407 <table><tbody>
11408 <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>
11409 </tbody></table>
11410 !! end
11411
11412 !! test
11413 Parsoid: Merge double tds in nested transclusion content (T52603)
11414 !! options
11415 parsoid
11416 !! wikitext
11417 {{echo|<div>}}
11418 {|
11419 |{{echo|{{!}} foo}}
11420 |}
11421 {{echo|</div>}}
11422 !! html
11423 <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}}]}'>
11424 <table><tbody>
11425 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11426 </tbody></table>
11427 </div>
11428 !! end
11429
11430 ###
11431 ### <includeonly> and <noinclude> in attributes
11432 ###
11433 !!test
11434 0. includeonly around the entire attribute
11435 !! wikitext
11436 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11437 !! html
11438 <p><span id="v2">bar</span>
11439 </p>
11440 !!end
11441
11442 !!test
11443 1. includeonly in html attr key
11444 !! wikitext
11445 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11446 !! html
11447 <p><span id="foo">bar</span>
11448 </p>
11449 !!end
11450
11451 !!test
11452 2. includeonly in html attr value
11453 !! wikitext
11454 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11455 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11456 !! html
11457 <p><span id="v1">bar</span>
11458 <span id="v1">bar</span>
11459 </p>
11460 !!end
11461
11462 !!test
11463 3. includeonly in part of an attr value
11464 !! wikitext
11465 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11466 !! html
11467 <p><span style="color:red;">bar</span>
11468 </p>
11469 !!end
11470
11471 !!test
11472 4. includeonly in table attributes
11473 !! wikitext
11474 {|
11475 |- <noinclude>
11476 |-
11477 |a
11478 </noinclude>
11479 |- <includeonly>
11480 |-
11481 |b
11482 </includeonly>
11483 |}
11484 !! html
11485 <table>
11486
11487
11488 <tr>
11489 <td>a
11490 </td></tr>
11491 </table>
11492
11493 !!end
11494
11495 ###
11496 ### Token Stream Patcher tests
11497 ###
11498 ### These tests won't always pass wt2wt and other modes because
11499 ### on serialization, the table will be output on a new line.
11500 ### For now, we are blacklisting them, and using this to test selser.
11501 ###
11502
11503 !!test
11504 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11505 !!options
11506 parsoid=wt2html,wt2wt
11507 !!wikitext
11508 {{echo|}}{| width = '100%'
11509 |foo
11510 |}
11511 !!html/parsoid
11512 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11513 <tbody><tr><td>foo</td></tr>
11514 </tbody></table>
11515 !!end
11516
11517 ## We used to, but no longer wt2wt this test since the default serializer
11518 ## will normalize the include directives to serialize on their own line.
11519 ## Selser will take care of preserving formatting in scenarios where they
11520 ## intermingled with other wikitext.
11521 !!test
11522 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11523 !!options
11524 parsoid=wt2html
11525 !!wikitext
11526 <includeonly>a</includeonly>{| {{{b}}}
11527 |c
11528 |}
11529 !!html/parsoid
11530 <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":""}]]}'>
11531 <tbody><tr><td>c</td></tr>
11532 </tbody></table>
11533 !!end
11534
11535 !! test
11536 Table wikitext syntax outside wiki-tables
11537 !! wikitext
11538 a
11539 |+ not a caption
11540 ! not a table heading
11541 |- not a table row
11542 | not a table cell
11543 | class="foo bar" | baz
11544 b
11545 |}
11546 |-
11547 c
11548 !! html
11549 <p>a
11550 |+ not a caption
11551 ! not a table heading
11552 |- not a table row
11553 | not a table cell
11554 | class="foo bar" | baz
11555 b
11556 |}
11557 |-
11558 c
11559 </p>
11560 !! end
11561
11562 ###
11563 ### Testing parsing of templates where a template arg
11564 ### has the same name as the template itself.
11565 ###
11566
11567 !! article
11568 Template:quote
11569 !! text
11570 {{{quote|{{{1}}}}}}
11571 !! endarticle
11572
11573 !!test
11574 Templates: Template Name/Arg clash: 1. Use of positional param
11575 !! wikitext
11576 {{quote|foo}}
11577 !! html
11578 <p>foo
11579 </p>
11580 !!end
11581
11582 !!test
11583 Templates: Template Name/Arg clash: 2. Use of named param
11584 !! wikitext
11585 {{quote|quote=foo}}
11586 !! html
11587 <p>foo
11588 </p>
11589 !!end
11590
11591 !!test
11592 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11593 !! wikitext
11594 {{quote|quote}}
11595 !! html
11596 <p>quote
11597 </p>
11598 !!end
11599
11600 ###
11601 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11602 ###
11603
11604 !!test
11605 Templates: 1. Simple use
11606 !! wikitext
11607 {{echo|Foo}}
11608 !! html
11609 <p>Foo
11610 </p>
11611 !!end
11612
11613 !!test
11614 Templates: 2. Inside a block tag
11615 !! wikitext
11616 <div>{{echo|Foo}}</div>
11617 <blockquote>{{echo|Foo}}</blockquote>
11618 !! html
11619 <div>Foo</div>
11620 <blockquote>Foo</blockquote>
11621
11622 !! html+tidy
11623 <div>Foo</div>
11624 <blockquote>
11625 <p>Foo</p>
11626 </blockquote>
11627 !!end
11628
11629 !!test
11630 Templates: P-wrapping: 1a. Templates on consecutive lines
11631 !! wikitext
11632 {{echo|Foo}}
11633 {{echo|bar}}
11634 !! html
11635 <p>Foo
11636 bar
11637 </p>
11638 !!end
11639
11640 !!test
11641 Templates: P-wrapping: 1b. Templates on consecutive lines
11642 !! wikitext
11643 Foo
11644
11645 {{echo|bar}}
11646 {{echo|baz}}
11647 !! html
11648 <p>Foo
11649 </p><p>bar
11650 baz
11651 </p>
11652 !!end
11653
11654 !!test
11655 Templates: P-wrapping: 1c. Templates on consecutive lines
11656 !! wikitext
11657 {{echo|Foo}}
11658 {{echo|bar}} <div>baz</div>
11659 !! html
11660 <p>Foo
11661 </p>
11662 bar <div>baz</div>
11663
11664 !! html+tidy
11665 <p>Foo</p>
11666 <p>bar</p>
11667 <div>baz</div>
11668 !! end
11669
11670 !!test
11671 Templates: P-wrapping: 1d. Template preceded by comment-only line
11672 !!options
11673 parsoid
11674 !! wikitext
11675 <!-- foo -->
11676 {{echo|Bar}}
11677 !! html
11678 <!-- foo -->
11679
11680 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11681 !!end
11682
11683 !!test
11684 Templates: Inline Text: 1. Multiple template uses
11685 !! wikitext
11686 {{echo|Foo}}bar{{echo|baz}}
11687 !! html
11688 <p>Foobarbaz
11689 </p>
11690 !!end
11691
11692 !!test
11693 Templates: Inline Text: 2. Back-to-back template uses
11694 !! wikitext
11695 {{echo|Foo}}{{echo|bar}}
11696 !! html
11697 <p>Foobar
11698 </p>
11699 !!end
11700
11701 !!test
11702 Templates: Block Tags: 1. Multiple template uses
11703 !! wikitext
11704 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11705 !! html
11706 <div>Foo</div><div>bar</div><div>baz</div>
11707
11708 !!end
11709
11710 !!test
11711 Templates: Block Tags: 2. Back-to-back template uses
11712 !! wikitext
11713 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11714 !! html
11715 <div>Foo</div><div>bar</div>
11716
11717 !!end
11718
11719 # This is an edge case relating to paragraph wrapping.
11720 !!test
11721 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11722 !! wikitext
11723 {{echo|a
11724 b</p>}}
11725 !! html/parsoid
11726 <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
11727 b</p>
11728 !!end
11729
11730 !!test
11731 Templates: Links: 1. Simple example
11732 !! wikitext
11733 {{echo|[[Foo|bar]]}}
11734 !! html
11735 <p><a href="/wiki/Foo" title="Foo">bar</a>
11736 </p>
11737 !!end
11738
11739 !!test
11740 Templates: Links: 2. Generation of link href
11741 !! wikitext
11742 [[{{echo|Foo}}|bar]]
11743 !! html
11744 <p><a href="/wiki/Foo" title="Foo">bar</a>
11745 </p>
11746 !!end
11747
11748 !!test
11749 Templates: Links: 3. Generation of part of a link href
11750 !! wikitext
11751 [[Fo{{echo|o}}|bar]]
11752
11753 [[Foo{{echo|bar}}]]
11754
11755 [[Foo{{echo|bar}}baz]]
11756
11757 [[Foo{{echo|bar}}|bar]]
11758
11759 [[:Foo{{echo|bar}}]]
11760
11761 [[:Foo{{echo|bar}}|bar]]
11762 !! html
11763 <p><a href="/wiki/Foo" title="Foo">bar</a>
11764 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11765 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11766 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11767 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11768 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11769 </p>
11770 !!end
11771
11772 !!test
11773 Templates: Links: 4. Multiple templates generating link href
11774 !! wikitext
11775 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11776 !! html
11777 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11778 </p>
11779 !!end
11780
11781 !!test
11782 Templates: Links: 5. Generation of link text
11783 !! wikitext
11784 [[Foo|{{echo|bar}}]]
11785 !! html
11786 <p><a href="/wiki/Foo" title="Foo">bar</a>
11787 </p>
11788 !!end
11789
11790 !!test
11791 Templates: Links: 5. Nested templates (only outermost template should be marked)
11792 !! wikitext
11793 {{echo|[[{{echo|Foo}}|bar]]}}
11794 !! html
11795 <p><a href="/wiki/Foo" title="Foo">bar</a>
11796 </p>
11797 !!end
11798
11799 !!test
11800 Templates: HTML Tag: 1. Generation of HTML attr. key
11801 !! wikitext
11802 <div {{echo|style}}="color:red;">foo</div>
11803 !! html
11804 <div style="color:red;">foo</div>
11805
11806 !!end
11807
11808 !!test
11809 Templates: HTML Tag: 2. Generation of HTML attr. value
11810 !! wikitext
11811 <div style={{echo|'color:red;'}}>foo</div>
11812 !! html
11813 <div style="color:red;">foo</div>
11814
11815 !!end
11816
11817 !!test
11818 Templates: HTML Tag: 3. Generation of HTML attr key and value
11819 !! wikitext
11820 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11821 !! html
11822 <div style="color:red;">foo</div>
11823
11824 !!end
11825
11826 !!test
11827 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11828 !! wikitext
11829 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11830 !! html
11831 <div title="This is a long title with just one piece templated">foo</div>
11832
11833 !!end
11834
11835 !!test
11836 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11837 !! wikitext
11838 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11839 !! html
11840 <div title="This is a long title with just one piece templated">foo</div>
11841
11842 !!end
11843
11844 !!test
11845 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11846 !! wikitext
11847 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11848 !! html
11849 <div title="This is a long title with just one piece templated">foo</div>
11850
11851 !!end
11852
11853 # SSS FIXME: While it is great we added support for all this,
11854 # do we want to make this part of the spec? Maybe we want to
11855 # deprecate this kind of usage in the future?
11856 !!test
11857 Templates: HTML Tag: 7. Generation of partial attribute key string
11858 !! wikitext
11859 <div st{{echo|yle}}="color:red;">foo</div>
11860 !! html
11861 <div style="color:red;">foo</div>
11862
11863 !!end
11864
11865 !! test
11866 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11867 !! wikitext
11868 <div {{echo|1=id="v1"}}>bar</div>
11869 !! html
11870 <div id="v1">bar</div>
11871
11872 !!end
11873
11874 !! test
11875 Templates: HTML Tag: 9. Multiple template-generated attributes
11876 !! wikitext
11877 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11878 !! html
11879 <div id="v1" title="foo">bar</div>
11880
11881 !!end
11882
11883 !! test
11884 Templates: Support for templates generating attributes and content
11885 !! wikitext
11886 {| {{mixed_attr_content_template}}
11887 |-
11888 |bar
11889 |}
11890 !! html/php
11891 <table style="color:red;" title="T48811">
11892
11893 <tr>
11894 <td>foo
11895 </td></tr>
11896 <tr>
11897 <td>bar
11898 </td></tr></table>
11899
11900 !! html/parsoid
11901 <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|}"]}'>
11902 <tbody><tr>
11903 <td>foo</td></tr>
11904 <tr>
11905 <td>bar</td></tr>
11906 </tbody></table>
11907 !!end
11908
11909 !! test
11910 1. Entities and nowikis inside templated attributes should be handled correctly
11911 !! wikitext
11912 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11913 !! html/php
11914 <div style="background:#f9f9f9;">foo</div>
11915
11916 !! html/parsoid
11917 <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>
11918 !! end
11919
11920 !! test
11921 2. Entities and nowikis inside templated attributes should be handled correctly
11922 !! wikitext
11923 {|
11924 |{{table_attribs_3}}
11925 |}
11926 !! html/php
11927 <table>
11928 <tr>
11929 <td style="background:#f9f9f9;">Foo
11930 </td></tr></table>
11931
11932 !! html/parsoid
11933 <table>
11934 <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>
11935 </tbody></table>
11936 !! end
11937
11938 !! test
11939 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11940 !! wikitext
11941 {{tbl-start}}
11942 |{{table_attribs_3}}
11943 {{tbl-end}}
11944 !! html/php
11945 <table>
11946 <tr>
11947 <td style="background:#f9f9f9;">Foo
11948 </td></tr></table>
11949
11950 !! html/parsoid
11951 <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}}]}'>
11952 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11953 </tbody></table>
11954 !! end
11955
11956 # T107622
11957 !! test
11958 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11959 !! wikitext
11960 {|
11961 | {{table_attribs_6}} hi
11962 |}
11963 !! html/php
11964 <table>
11965 <tr>
11966 <td style="background: red;"> hi
11967 </td></tr></table>
11968
11969 !! html/parsoid
11970 <table>
11971 <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>
11972 </tbody></table>
11973 !! end
11974
11975 !!test
11976 Templates: HTML Tables: 1. Generating start of a HTML table
11977 !! wikitext
11978 {{echo|<table><tr><td>foo</td>}}</tr></table>
11979 !! html
11980 <table><tr><td>foo</td></tr></table>
11981
11982 !!end
11983
11984 !!test
11985 Templates: HTML Tables: 2a. Generating middle of a HTML table
11986 !! wikitext
11987 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11988 !! html
11989 <table><tr><td>foo</td></tr></table>
11990
11991 !!end
11992
11993 !!test
11994 Templates: HTML Tables: 2b. Generating middle of a HTML table
11995 !! wikitext
11996 <table>{{echo|<tr><td>foo</td></tr>}}</table>
11997 !! html
11998 <table><tr><td>foo</td></tr></table>
11999
12000 !!end
12001
12002 !!test
12003 Templates: HTML Tables: 3. Generating end of a HTML table
12004 !! wikitext
12005 <table><tr>{{echo|<td>foo</td></tr></table>}}
12006 !! html
12007 <table><tr><td>foo</td></tr></table>
12008
12009 !!end
12010
12011 !!test
12012 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
12013 !! wikitext
12014 {{echo|<table>}}<tr><td>foo</td></tr></table>
12015 !! html
12016 <table><tr><td>foo</td></tr></table>
12017
12018 !!end
12019
12020 !!test
12021 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
12022 !! wikitext
12023 <table>{{echo|<tr>}}<td>foo</td></tr></table>
12024 !! html
12025 <table><tr><td>foo</td></tr></table>
12026
12027 !!end
12028
12029 !!test
12030 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
12031 !! wikitext
12032 <table><tr>{{echo|<td>}}foo</td></tr></table>
12033 !! html
12034 <table><tr><td>foo</td></tr></table>
12035
12036 !!end
12037
12038 !!test
12039 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
12040 !! wikitext
12041 <table><tr><td>foo{{echo|</td>}}</tr></table>
12042 !! html
12043 <table><tr><td>foo</td></tr></table>
12044
12045 !!end
12046
12047 !!test
12048 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
12049 !! wikitext
12050 <table><tr><td>foo</td>{{echo|</tr>}}</table>
12051 !! html
12052 <table><tr><td>foo</td></tr></table>
12053
12054 !!end
12055
12056 !!test
12057 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
12058 !! wikitext
12059 <table><tr><td>foo</td></tr>{{echo|</table>}}
12060 !! html
12061 <table><tr><td>foo</td></tr></table>
12062
12063 !!end
12064
12065 !!test
12066 Templates: HTML Tables: 5. Proper fostering of categories from inside
12067 !!options
12068 parsoid=wt2html,wt2wt
12069 !! wikitext
12070 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
12071 <!--Two categories (Bug 50330)-->
12072 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
12073 !! html
12074 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
12075 <!--Two categories (Bug 50330)-->
12076 <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>
12077 !!end
12078
12079 !!test
12080 Templates: Wiki Tables: 1a. Fostering of entire template content
12081 !! wikitext
12082 {|
12083 {{echo|a}}
12084 |}
12085 !! html
12086 <table>
12087 a
12088 <tr><td></td></tr></table>
12089
12090 !! html+tidy
12091 <p>a</p>
12092 <table>
12093 <tr>
12094 <td></td>
12095 </tr>
12096 </table>
12097 !! end
12098
12099 !!test
12100 Templates: Wiki Tables: 1b. Fostering of entire template content
12101 !! wikitext
12102 {|
12103 {{echo|<div>}}
12104 foo
12105 {{echo|</div>}}
12106 |}
12107 !! html
12108 <table>
12109 <div>
12110 <p>foo
12111 </p>
12112 </div>
12113 <tr><td></td></tr></table>
12114
12115 !! html+tidy
12116 <div>
12117 <p>foo</p>
12118 </div>
12119 <table>
12120 <tr>
12121 <td></td>
12122 </tr>
12123 </table>
12124 !! end
12125
12126 !!test
12127 Templates: Wiki Tables: 2. Fostering of partial template content
12128 !! wikitext
12129 {|
12130 {{echo|a
12131 <div>b</div>}}
12132 |}
12133 !! html
12134 <table>
12135 a
12136 <div>b</div>
12137 <tr><td></td></tr></table>
12138
12139 !! html+tidy
12140 <p>a</p>
12141 <div>b</div>
12142 <table>
12143 <tr>
12144 <td></td>
12145 </tr>
12146 </table>
12147 !! end
12148
12149 !!test
12150 Templates: Wiki Tables: 3. td-content via multiple templates
12151 !! wikitext
12152 {|
12153 {{echo|{{pipe}}a}}{{echo|b}}
12154 |}
12155 !! html
12156 <table>
12157 <tr>
12158 <td>ab
12159 </td></tr></table>
12160
12161 !!end
12162
12163 !!test
12164 Templates: Wiki Tables: 4. Templated tags, no content
12165 !! wikitext
12166 {{tbl-start}}
12167 {{tbl-end}}
12168 !! html
12169 <table>
12170 <tr><td></td></tr></table>
12171
12172 !!end
12173
12174 !!test
12175 Templates: Wiki Tables: 5. Templated tags, regular td-tags
12176 !! wikitext
12177 {{tbl-start}}
12178 |foo
12179 {{tbl-end}}
12180 !! html
12181 <table>
12182 <tr>
12183 <td>foo
12184 </td></tr></table>
12185
12186 !!end
12187
12188 !!test
12189 Templates: Wiki Tables: 6. Templated tags, templated td-tags
12190 !! wikitext
12191 {{tbl-start}}
12192 {{!}}foo
12193 {{tbl-end}}
12194 !! html
12195 <table>
12196 <tr>
12197 <td>foo
12198 </td></tr></table>
12199
12200 !!end
12201
12202 ## This test case is very specific to Parsoid's internals
12203 ## and is hence only tested for Parsoid's code. Parsoid uses
12204 ## a <meta> marker tag for <ref> tags and they are expanded
12205 ## much later. We are verifying that this <meta> tag usage
12206 ## doesn't prevent foster parenting.
12207 !!test
12208 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
12209 !!wikitext
12210 {{PartialTable}}<ref>foo</ref>
12211 |}
12212
12213 <references />
12214 !!html/parsoid
12215 <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">
12216 <tbody>
12217 </tbody></table>
12218
12219 <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>
12220 !!end
12221
12222 !! test
12223 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
12224 !! wikitext
12225 {{echo|
12226 {{{!}}
12227 {{!}}-}}
12228 <onlyinclude>
12229 |foo
12230 </onlyinclude>
12231 {{!}}}
12232 !! html/parsoid
12233 <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{{!}}}"]}'>
12234 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
12235 <tbody><tr>
12236
12237 <td>foo
12238 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
12239 </tbody></table>
12240 !! end
12241
12242 !!test
12243 Templates: Lists: Multi-line list-items via templates
12244 !! wikitext
12245 *{{echo|a {{nonexistent|
12246 unused}}}}
12247 *{{echo|b {{nonexistent|
12248 unused}}}}
12249 !! html
12250 <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>
12251 <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>
12252
12253 !!end
12254
12255 !!test
12256 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
12257 !! wikitext
12258 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
12259 !! html
12260 <p><i>ab</i>c<i>d</i>e
12261 </p>
12262 !!end
12263
12264 !!test
12265 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
12266 (PHP parser generates misnested html)
12267 !! wikitext
12268 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
12269 !! html/parsoid
12270 <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>
12271 !!end
12272
12273 !!test
12274 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
12275 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
12276 !! options
12277 parsoid=wt2html,wt2wt
12278 !! wikitext
12279 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
12280 !! html
12281 <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>
12282 <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>
12283 <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>
12284 !!end
12285
12286 !!test
12287 Templates: Ugly nesting: 4. Divs opened/closed across templates
12288 !! wikitext
12289 a<div>b{{echo|c</div>d}}e
12290 !! html
12291 a<div>bc</div>de
12292
12293 !! html+tidy
12294 <p>a</p>
12295 <div>bc</div>
12296 <p>de</p>
12297 !! end
12298
12299 !!test
12300 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
12301 (Parsoid-centric)
12302 !! options
12303 parsoid
12304 !! wikitext
12305 {|
12306 |{{echo|foo</table>}}
12307 |bar
12308 |}
12309 !! html
12310 <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|}"]}'>
12311
12312 <tbody>
12313 <tr>
12314 <td>foo</td></tr></tbody></table><span about="#mwt1">
12315 </span><span about="#mwt1">|bar</span><span about="#mwt1">
12316 |}</span>
12317 !!end
12318
12319 !!test
12320 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
12321 (Parsoid-centric)
12322 !! options
12323 parsoid
12324 !! wikitext
12325 <table>
12326 <tr>
12327 <td>
12328 <table>
12329 <tr>
12330 <td>1. {{echo|foo </table>}}</td>
12331 <td> bar </td>
12332 <td>2. {{echo|baz </table>}}</td>
12333 </tr>
12334 <tr>
12335 <td>abc</td>
12336 </tr>
12337 </table>
12338 </td>
12339 </tr>
12340 <tr>
12341 <td>xyz</td>
12342 </tr>
12343 </table>
12344 !! html
12345 <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>"]}'>
12346 <tbody><tr>
12347 <td>
12348 <table>
12349 <tbody><tr>
12350 <td>1. foo </td></tr></tbody></table></td>
12351 <td> bar </td>
12352 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
12353 </span><span about="#mwt2">
12354 </span><span about="#mwt2">
12355 </span><span about="#mwt2">abc</span><span about="#mwt2">
12356 </span><span about="#mwt2">
12357 </span><span about="#mwt2">
12358 </span><span about="#mwt2">
12359 </span><span about="#mwt2">
12360 </span><span about="#mwt2">
12361 </span><span about="#mwt2">xyz</span><span about="#mwt2">
12362 </span><span about="#mwt2">
12363 </span>
12364 !!end
12365
12366 !! test
12367 Templates: Ugly templates: 3. newline-only template parameter
12368 !! wikitext
12369 foo {{echo|
12370 }}
12371 !! html
12372 <p>foo
12373 </p>
12374 !! end
12375
12376 # This looks like a bug: a single newline triggers p/br for some reason.
12377 !! test
12378 Templates: Ugly templates: 4. newline-only template parameter inconsistency
12379 !! wikitext
12380 {{echo|
12381 }}
12382 !! html
12383 <p><br />
12384 </p>
12385 !! end
12386
12387 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
12388 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12389 !! test
12390 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12391 !! wikitext
12392 {{echo|<table>}}
12393 {{echo|<div>foo}}
12394 {{echo|</table>}}
12395 !! html/parsoid
12396 <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
12397 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12398 </table>
12399 !! end
12400
12401 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
12402 # that are "identical" and generate nesting cycles in the algorithm
12403 !! test
12404 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12405 !! wikitext
12406 {{echo|<table><tr><td><table>}}
12407 {{echo|<div>}}
12408 {{echo|</div>}}
12409 !! html/parsoid
12410 <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"}'>
12411 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12412 </table></td></tr></tbody></table>
12413 !! end
12414
12415 !! test
12416 Templates: Parameters substituted at the top-level
12417 !! wikitext
12418 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12419 !! html/php
12420 <p><i>who</i> me? <b>never!</b>
12421 </p>
12422 !! html/parsoid
12423 <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>
12424 !! end
12425
12426 !!test
12427 Parser Functions: 1. Simple example
12428 !! wikitext
12429 {{uc:foo}}
12430 !! html
12431 <p>FOO
12432 </p>
12433 !!end
12434
12435 !!test
12436 Parser Functions: 2. Nested use (only outermost should be marked up)
12437 !! wikitext
12438 {{uc:{{lc:FOO}}}}
12439 !! html
12440 <p>FOO
12441 </p>
12442 !!end
12443
12444 ###
12445 ### Pre-save transform tests
12446 ###
12447 !! test
12448 pre-save transform: subst:
12449 !! options
12450 pst
12451 !! wikitext
12452 {{subst:test}}
12453 !! html/php
12454 This is a test template
12455 !! end
12456
12457 !! test
12458 pre-save transform: normal template
12459 !! options
12460 pst
12461 !! wikitext
12462 {{test}}
12463 !! html/php
12464 {{test}}
12465 !! end
12466
12467 !! test
12468 pre-save transform: nonexistent template
12469 !! options
12470 pst
12471 !! wikitext
12472 {{thistemplatedoesnotexist}}
12473 !! html/php
12474 {{thistemplatedoesnotexist}}
12475 !! end
12476
12477 !! test
12478 pre-save transform: subst magic variables
12479 !! options
12480 pst
12481 !! wikitext
12482 {{subst:SITENAME}}
12483 !! html/php
12484 MediaWiki
12485 !! end
12486
12487 # This is bug 89, which I fixed. -- wtm
12488 !! test
12489 pre-save transform: subst: templates with parameters
12490 !! options
12491 pst
12492 !! wikitext
12493 {{subst:paramtest|param="something else"}}
12494 !! html/php
12495 This is a test template with parameter "something else"
12496 !! end
12497
12498 !! article
12499 Template:nowikitest
12500 !! text
12501 <nowiki>'''not wiki'''</nowiki>
12502 !! endarticle
12503
12504 !! test
12505 pre-save transform: nowiki in subst (bug 1188)
12506 !! options
12507 pst
12508 !! wikitext
12509 {{subst:nowikitest}}
12510 !! html/php
12511 <nowiki>'''not wiki'''</nowiki>
12512 !! end
12513
12514 !! article
12515 Template:commenttest
12516 !! text
12517 This template has <!-- a comment --> in it.
12518 !! endarticle
12519
12520 !! test
12521 pre-save transform: comment in subst (bug 1936)
12522 !! options
12523 pst
12524 !! wikitext
12525 {{subst:commenttest}}
12526 !! html/php
12527 This template has <!-- a comment --> in it.
12528 !! end
12529
12530 !! test
12531 pre-save transform: unclosed tag
12532 !! options
12533 pst
12534 !! wikitext
12535 <nowiki>'''not wiki'''
12536 !! html/php
12537 <nowiki>'''not wiki'''
12538 !! end
12539
12540 !! test
12541 pre-save transform: mixed tag case
12542 !! options
12543 pst
12544 !! wikitext
12545 <NOwiki>'''not wiki'''</noWIKI>
12546 !! html/php
12547 <NOwiki>'''not wiki'''</noWIKI>
12548 !! end
12549
12550 !! test
12551 pre-save transform: unclosed comment in <nowiki>
12552 !! options
12553 pst
12554 !! wikitext
12555 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12556 !! html/php
12557 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12558 !!end
12559
12560 # Leading @ in this template definition works around a limitation
12561 # in parsoid's parserTests which otherwise strips the <span> from the
12562 # result (confusing it for a template wrapper)
12563 !! article
12564 Template:dangerous
12565 !!text
12566 @<span onmouseover="alert('crap')">Oh no</span>
12567 !!endarticle
12568
12569 !!test
12570 (confirming safety of fix for subst bug 1936)
12571 !! wikitext
12572 {{Template:dangerous}}
12573 !! html
12574 <p>@<span>Oh no</span>
12575 </p>
12576 !! end
12577
12578 !! test
12579 pre-save transform: comment containing gallery (bug 5024)
12580 !! options
12581 pst
12582 !! wikitext
12583 <!-- <gallery>data</gallery> -->
12584 !! html/php
12585 <!-- <gallery>data</gallery> -->
12586 !!end
12587
12588 !! test
12589 pre-save transform: comment containing extension
12590 !! options
12591 pst
12592 !! wikitext
12593 <!-- <tag>data</tag> -->
12594 !! html/php
12595 <!-- <tag>data</tag> -->
12596 !!end
12597
12598 !! test
12599 pre-save transform: comment containing nowiki
12600 !! options
12601 pst
12602 !! wikitext
12603 <!-- <nowiki>data</nowiki> -->
12604 !! html/php
12605 <!-- <nowiki>data</nowiki> -->
12606 !!end
12607
12608 !! test
12609 pre-save transform: <noinclude> in subst (bug 3298)
12610 !! options
12611 pst
12612 !! wikitext
12613 {{subst:Includes}}
12614 !! html/php
12615 Foobar
12616 !! end
12617
12618 !! test
12619 pre-save transform: <onlyinclude> in subst (bug 3298)
12620 !! options
12621 pst
12622 !! wikitext
12623 {{subst:Includes2}}
12624 !! html/php
12625 Foo
12626 !! end
12627
12628 !! article
12629 Template:SubstTest
12630 !!text
12631 {{<includeonly>subst:</includeonly>Includes}}
12632 !! endarticle
12633
12634 !! article
12635 Template:SafeSubstTest
12636 !! text
12637 {{<includeonly>safesubst:</includeonly>Includes}}
12638 !! endarticle
12639
12640 !! test
12641 bug 22297: safesubst: works during PST
12642 !! options
12643 pst
12644 !! wikitext
12645 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12646 !! html/php
12647 FoobarFoobar
12648 !! end
12649
12650 !! test
12651 bug 22297: safesubst: works during normal parse
12652 !! wikitext
12653 {{SafeSubstTest}}
12654 !! html
12655 <p>Foobar
12656 </p>
12657 !! end
12658
12659 !! test
12660 subst: does not work during normal parse
12661 !! wikitext
12662 {{SubstTest}}
12663 !! html
12664 <p>{{subst:Includes}}
12665 </p>
12666 !! end
12667
12668 !! test
12669 pre-save transform: context links ("pipe trick")
12670 !! options
12671 pst
12672 !! wikitext
12673 [[Article (context)|]]
12674 [[Bar:Article|]]
12675 [[:Bar:Article|]]
12676 [[Bar:Article (context)|]]
12677 [[:Bar:Article (context)|]]
12678 [[|Article]]
12679 [[|Article (context)]]
12680 [[Bar:X (Y) Z|]]
12681 [[:Bar:X (Y) Z|]]
12682 !! html/php
12683 [[Article (context)|Article]]
12684 [[Bar:Article|Article]]
12685 [[:Bar:Article|Article]]
12686 [[Bar:Article (context)|Article]]
12687 [[:Bar:Article (context)|Article]]
12688 [[Article]]
12689 [[Article (context)]]
12690 [[Bar:X (Y) Z|X (Y) Z]]
12691 [[:Bar:X (Y) Z|X (Y) Z]]
12692 !! end
12693
12694 !! test
12695 pre-save transform: context links ("pipe trick") with interwiki prefix
12696 !! options
12697 pst
12698 !! wikitext
12699 [[interwiki:Article|]]
12700 [[:interwiki:Article|]]
12701 [[interwiki:Bar:Article|]]
12702 [[:interwiki:Bar:Article|]]
12703 !! html/php
12704 [[interwiki:Article|Article]]
12705 [[:interwiki:Article|Article]]
12706 [[interwiki:Bar:Article|Bar:Article]]
12707 [[:interwiki:Bar:Article|Bar:Article]]
12708 !! end
12709
12710 !! test
12711 pre-save transform: context links ("pipe trick") with parens in title
12712 !! options
12713 pst title=[[Somearticle (context)]]
12714 !! wikitext
12715 [[|Article]]
12716 !! html/php
12717 [[Article (context)|Article]]
12718 !! end
12719
12720 !! test
12721 pre-save transform: context links ("pipe trick") with comma in title
12722 !! options
12723 pst title=[[Someplace, Somewhere]]
12724 !! wikitext
12725 [[|Otherplace]]
12726 [[Otherplace, Elsewhere|]]
12727 [[Otherplace, Elsewhere, Anywhere|]]
12728 !! html/php
12729 [[Otherplace, Somewhere|Otherplace]]
12730 [[Otherplace, Elsewhere|Otherplace]]
12731 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12732 !! end
12733
12734 !! test
12735 pre-save transform: context links ("pipe trick") with parens and comma
12736 !! options
12737 pst title=[[Someplace (IGNORED), Somewhere]]
12738 !! wikitext
12739 [[|Otherplace]]
12740 [[Otherplace (place), Elsewhere|]]
12741 !! html/php
12742 [[Otherplace, Somewhere|Otherplace]]
12743 [[Otherplace (place), Elsewhere|Otherplace]]
12744 !! end
12745
12746 !! test
12747 pre-save transform: context links ("pipe trick") with comma and parens
12748 !! options
12749 pst title=[[Who, me? (context)]]
12750 !! wikitext
12751 [[|Yes, you.]]
12752 [[Me, Myself, and I (1937 song)|]]
12753 !! html/php
12754 [[Yes, you. (context)|Yes, you.]]
12755 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12756 !! end
12757
12758 !! test
12759 pre-save transform: context links ("pipe trick") with namespace
12760 !! options
12761 pst title=[[Ns:Somearticle]]
12762 !! wikitext
12763 [[|Article]]
12764 !! html/php
12765 [[Ns:Article|Article]]
12766 !! end
12767
12768 !! test
12769 pre-save transform: context links ("pipe trick") with namespace and parens
12770 !! options
12771 pst title=[[Ns:Somearticle (context)]]
12772 !! wikitext
12773 [[|Article]]
12774 !! html/php
12775 [[Ns:Article (context)|Article]]
12776 !! end
12777
12778 !! test
12779 pre-save transform: context links ("pipe trick") with namespace and comma
12780 !! options
12781 pst title=[[Ns:Somearticle, Context, Whatever]]
12782 !! wikitext
12783 [[|Article]]
12784 !! html/php
12785 [[Ns:Article, Context, Whatever|Article]]
12786 !! end
12787
12788 !! test
12789 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12790 !! options
12791 pst title=[[Ns:Somearticle, Context (context)]]
12792 !! wikitext
12793 [[|Article]]
12794 !! html/php
12795 [[Ns:Article (context)|Article]]
12796 !! end
12797
12798 !! test
12799 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12800 !! options
12801 pst title=[[Ns:Somearticle (IGNORED), Context]]
12802 !! wikitext
12803 [[|Article]]
12804 !! html/php
12805 [[Ns:Article, Context|Article]]
12806 !! end
12807
12808 !! test
12809 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12810 !! options
12811 pst
12812 !! wikitext
12813 [[Article(context)|]]
12814 [[Bar:Article(context)|]]
12815 [[:Bar:Article(context)|]]
12816 [[|Article(context)]]
12817 [[Bar:X(Y)Z|]]
12818 [[:Bar:X(Y)Z|]]
12819 !! html/php
12820 [[Article(context)|Article]]
12821 [[Bar:Article(context)|Article]]
12822 [[:Bar:Article(context)|Article]]
12823 [[Article(context)]]
12824 [[Bar:X(Y)Z|X(Y)Z]]
12825 [[:Bar:X(Y)Z|X(Y)Z]]
12826 !! end
12827
12828 !! test
12829 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12830 !! options
12831 pst
12832 !! wikitext
12833 [[Article (context)|]]
12834 [[Bar:Article (context)|]]
12835 [[:Bar:Article (context)|]]
12836 [[|Article (context)]]
12837 [[Bar:X (Y) Z|]]
12838 [[:Bar:X (Y) Z|]]
12839 !! html/php
12840 [[Article (context)|Article]]
12841 [[Bar:Article (context)|Article]]
12842 [[:Bar:Article (context)|Article]]
12843 [[Article (context)]]
12844 [[Bar:X (Y) Z|X (Y) Z]]
12845 [[:Bar:X (Y) Z|X (Y) Z]]
12846 !! end
12847
12848 !! test
12849 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12850 !! options
12851 pst
12852 !! wikitext
12853 [[Article(context)|]]
12854 [[Bar:Article(context)|]]
12855 [[:Bar:Article(context)|]]
12856 [[|Article(context)]]
12857 [[Bar:X(Y)Z|]]
12858 [[:Bar:X(Y)Z|]]
12859 !! html/php
12860 [[Article(context)|Article]]
12861 [[Bar:Article(context)|Article]]
12862 [[:Bar:Article(context)|Article]]
12863 [[Article(context)]]
12864 [[Bar:X(Y)Z|X(Y)Z]]
12865 [[:Bar:X(Y)Z|X(Y)Z]]
12866 !! end
12867
12868 !! test
12869 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12870 !! options
12871 pst
12872 !! wikitext
12873 [[Article (context), context|]]
12874 [[Article (context),context|]]
12875 [[Bar:Article (context), context|]]
12876 [[Bar:Article (context),context|]]
12877 [[:Bar:Article (context), context|]]
12878 [[:Bar:Article (context),context|]]
12879 !! html/php
12880 [[Article (context), context|Article]]
12881 [[Article (context),context|Article]]
12882 [[Bar:Article (context), context|Article]]
12883 [[Bar:Article (context),context|Article]]
12884 [[:Bar:Article (context), context|Article]]
12885 [[:Bar:Article (context),context|Article]]
12886 !! end
12887
12888 !! test
12889 pre-save transform: trim trailing empty lines
12890 !! options
12891 pst
12892 !! wikitext
12893 Empty lines are trimmed
12894
12895
12896
12897
12898 !! html/php
12899 Empty lines are trimmed
12900 !! end
12901
12902 !! test
12903 pre-save transform: Signature expansion
12904 !! options
12905 pst
12906 !! wikitext
12907 * ~~~
12908 * <noinclude>~~~</noinclude>
12909 * <includeonly>~~~</includeonly>
12910 * <onlyinclude>~~~</onlyinclude>
12911 !! html/php
12912 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12913 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12914 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12915 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12916 !! end
12917
12918
12919 !! test
12920 pre-save transform: Signature expansion in nowiki tags (bug 93)
12921 !! options
12922 pst disabled
12923 !! wikitext
12924 Shall not expand:
12925
12926 <nowiki>~~~~</nowiki>
12927
12928 <includeonly><nowiki>~~~~</nowiki></includeonly>
12929
12930 <noinclude><nowiki>~~~~</nowiki></noinclude>
12931
12932 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12933
12934 {{subst:Foo}} shall be converted to FOO
12935
12936 As well as inside noinclude/onlyinclude
12937 <noinclude>{{subst:Foo}}</noinclude>
12938 <onlyinclude>{{subst:Foo}}</onlyinclude>
12939
12940 But not inside includeonly
12941 <includeonly>{{subst:Foo}}</includeonly>
12942 !! html/php
12943 Shall not expand:
12944
12945 <nowiki>~~~~</nowiki>
12946
12947 <includeonly><nowiki>~~~~</nowiki></includeonly>
12948
12949 <noinclude><nowiki>~~~~</nowiki></noinclude>
12950
12951 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12952
12953 FOO shall be converted to FOO
12954
12955 As well as inside noinclude/onlyinclude
12956 <noinclude>FOO</noinclude>
12957 <onlyinclude>FOO</onlyinclude>
12958
12959 But not inside includeonly
12960 <includeonly>{{subst:Foo}}</includeonly>
12961 !! end
12962
12963 !! test
12964 Parsoid: Recognize nowiki with trailing space in tags
12965 !! options
12966 parsoid=wt2html
12967 !! wikitext
12968 <nowiki ><div>[[foo]]</nowiki >
12969
12970 a<nowiki / >b
12971
12972 c<nowiki />d
12973
12974 e<nowiki/ >f
12975 !! html
12976 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12977 <p>ab</p>
12978 <p>cd</p>
12979 <p>ef</p>
12980 !! end
12981
12982 !! test
12983 Parsoid: Recognize nowiki with odd capitalization
12984 !! options
12985 parsoid=wt2html
12986 !! wikitext
12987 <noWikI ><div>[[foo]]</Nowiki >
12988 !! html
12989 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12990 !! end
12991
12992
12993 !! test
12994 Parsoid: Escape nowiki with trailing space in tags
12995 !! options
12996 parsoid=html2wt
12997 !! html/parsoid
12998 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12999 <p>a&lt;nowiki /&gt;b</p>
13000 <p>c&lt;nowiki/ &gt;d</p>
13001 !! wikitext
13002 &lt;nowiki &gt; foo &lt;/nowiki &gt;
13003
13004 a&lt;nowiki /&gt;b
13005
13006 c&lt;nowiki/ &gt;d
13007 !! end
13008
13009 !! test
13010 Parsoid: Escape weird noWikI capitalizations
13011 !! options
13012 parsoid=html2wt
13013 !! html/parsoid
13014 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
13015 !! wikitext
13016 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
13017 !! end
13018
13019 ###
13020 ### Message transform tests
13021 ###
13022 !! test
13023 message transform: magic variables
13024 !! options
13025 msg
13026 !! wikitext
13027 {{SITENAME}}
13028 !! html
13029 MediaWiki
13030 !! end
13031
13032 !! test
13033 message transform: should not transform wiki markup
13034 !! options
13035 msg
13036 !! wikitext
13037 ''test''
13038 !! html
13039 ''test''
13040 !! end
13041
13042 !! test
13043 message transform: <noinclude> in transcluded template (bug 4926)
13044 !! options
13045 msg
13046 !! wikitext
13047 {{Includes}}
13048 !! html
13049 Foobar
13050 !! end
13051
13052 !! test
13053 message transform: <onlyinclude> in transcluded template (bug 4926)
13054 !! options
13055 msg
13056 !! wikitext
13057 {{Includes2}}
13058 !! html
13059 Foo
13060 !! end
13061
13062 !! test
13063 {{#special:}} page name, known
13064 !! options
13065 msg
13066 !! wikitext
13067 {{#special:Recentchanges}}
13068 !! html
13069 Special:RecentChanges
13070 !! end
13071
13072 !! test
13073 {{#special:}} page name with subpage, known
13074 !! options
13075 msg
13076 !! wikitext
13077 {{#special:Recentchanges/param}}
13078 !! html
13079 Special:RecentChanges/param
13080 !! end
13081
13082 !! test
13083 {{#special:}} page name, unknown
13084 !! options
13085 msg
13086 !! wikitext
13087 {{#special:foobar nonexistent}}
13088 !! html
13089 Special:Foobar nonexistent
13090 !! end
13091
13092 !! test
13093 {{#speciale:}} page name, known
13094 !! options
13095 msg
13096 !! wikitext
13097 {{#speciale:Recentchanges}}
13098 !! html
13099 Special:RecentChanges
13100 !! end
13101
13102 !! test
13103 {{#speciale:}} page name with subpage, known
13104 !! options
13105 msg
13106 !! wikitext
13107 {{#speciale:Recentchanges/param}}
13108 !! html
13109 Special:RecentChanges/param
13110 !! end
13111
13112 !! test
13113 {{#speciale:}} page name, unknown
13114 !! options
13115 msg
13116 !! wikitext
13117 {{#speciale:foobar nonexistent}}
13118 !! html
13119 Special:Foobar_nonexistent
13120 !! end
13121
13122 ###
13123 ### Images
13124 ###
13125 ### For Parsoid-specific tests, see
13126 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13127
13128 !! test
13129 Simple image
13130 !! options
13131 parsoid=wt2html,wt2wt,html2html
13132 !! wikitext
13133 [[Image:foobar.jpg]]
13134 !! html/php
13135 <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>
13136 </p>
13137 !! html/parsoid
13138 <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>
13139 !! end
13140
13141 !! test
13142 Simple image (using File: namespace, now canonical)
13143 !! wikitext
13144 [[File:Foobar.jpg]]
13145 !! html/php
13146 <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>
13147 </p>
13148 !! html/parsoid
13149 <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>
13150 !! end
13151
13152 !! test
13153 Right-aligned image
13154 !! wikitext
13155 [[File:Foobar.jpg|right]]
13156 !! html/php
13157 <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>
13158
13159 !! html/parsoid
13160 <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>
13161 !! end
13162
13163 !! test
13164 Image with caption
13165 !! wikitext
13166 [[File:Foobar.jpg|right|Caption text]]
13167 !! html/php
13168 <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>
13169
13170 !! html/parsoid
13171 <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>
13172 !! end
13173
13174 !! test
13175 Image with caption, bug 53312 #1
13176 !! wikitext
13177 [[File:Foobar.jpg|right|Caption page stuff]]
13178 !! html/php
13179 <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>
13180
13181 !! html/parsoid
13182 <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>
13183 !! end
13184
13185 !! test
13186 Image with caption, bug 53312 #2
13187 !! wikitext
13188 [[File:Foobar.jpg|right|Caption page=]]
13189 !! html/php
13190 <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>
13191
13192 !! html/parsoid
13193 <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>
13194 !! end
13195
13196 !! test
13197 Image with caption, bug 53312 #3
13198 !! wikitext
13199 [[File:Foobar.jpg|right|Caption page=stuff]]
13200 !! html/php
13201 <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>
13202
13203 !! html/parsoid
13204 <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>
13205 !! end
13206
13207 !! test
13208 Allow empty links in image captions (Bug 60753)
13209 !! options
13210 thumbsize=220
13211 !! wikitext
13212 [[File:Foobar.jpg|thumb|Caption [[Link1]]
13213 [[]]
13214 [[Link2]]
13215 ]]
13216 !! html/php
13217 <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>
13218
13219 !! html/parsoid
13220 <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>
13221 [[]]
13222 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
13223 </figcaption></figure>
13224 !! end
13225
13226 !! test
13227 Titles in unlinked images (T23454)
13228 !! wikitext
13229 [[File:Foobar.jpg|link=|stuff]]
13230 !! html/php
13231 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
13232 </p>
13233 !! end
13234
13235 !! test
13236 Link with empty target
13237 !! wikitext
13238 [[]]
13239 !! html
13240 <p>[[]]
13241 </p>
13242 !! end
13243
13244 !! test
13245 Image with link trail
13246 !! wikitext
13247 Linktrails should not work for images: [[File:Foobar.jpg]]s
13248 !! html/php
13249 <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
13250 </p>
13251 !! html/parsoid
13252 <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>
13253 !! end
13254
13255 !! test
13256 Image with empty attribute
13257 !! options
13258 parsoid=wt2html,wt2wt,html2html
13259 !! wikitext
13260 [[File:Foobar.jpg|right||Caption text]]
13261 !! html/php
13262 <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>
13263
13264 !! html/parsoid
13265 <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>
13266 !! end
13267
13268 !! test
13269 1. Block image with individual attributes from templates
13270 !! wikitext
13271 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
13272 !! html/php
13273 <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>
13274
13275 !! html/parsoid
13276 <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>
13277 !! end
13278
13279 !! test
13280 2. Block Image with individual attributes from templates
13281 !! wikitext
13282 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
13283 !! html/php
13284 <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>
13285
13286 !! html/parsoid
13287 <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>
13288 !! end
13289
13290 !! test
13291 3. Inline image with individual attributes from templates
13292 !! wikitext
13293 [[File:Foobar.jpg|{{echo|50px}}]]
13294 !! html/php
13295 <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>
13296 </p>
13297 !! html/parsoid
13298 <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>
13299 !! end
13300
13301 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
13302 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
13303 !! test
13304 Image with multiple attributes from the same template
13305 !! wikitext
13306 [[File:Foobar.jpg|{{image_attribs}}]]
13307 !! html/php
13308 <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>
13309
13310 !! html/parsoid
13311 <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>
13312 !! end
13313
13314 !! test
13315 Image with link tails
13316 !! options
13317 thumbsize=220
13318 !! wikitext
13319 123[[File:Foobar.jpg]]456
13320 123[[File:Foobar.jpg|right]]456
13321 123[[File:Foobar.jpg|thumb]]456
13322 !! html/php
13323 <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
13324 </p>
13325 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
13326 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
13327
13328 !! html/php+tidy
13329 <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>
13330 <p>123</p>
13331 <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>
13332 <p>456 123</p>
13333 <div class="thumb tright">
13334 <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>
13335 <div class="thumbcaption">
13336 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
13337 </div>
13338 </div>
13339 </div>
13340 <p>456</p>
13341 !! html/parsoid
13342 <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>
13343 <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>
13344 <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>
13345 !! end
13346
13347 !! test
13348 Image with multiple captions -- only last one is accepted
13349 !! wikitext
13350 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
13351 !! html/php
13352 <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>
13353
13354 !! html/parsoid
13355 <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>
13356 !! end
13357
13358 !! test
13359 Image with multiple widths -- use last
13360 !! wikitext
13361 [[File:Foobar.jpg|200px|300px|caption]]
13362 !! html/php
13363 <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>
13364 </p>
13365 !! html/parsoid
13366 <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>
13367 !! end
13368
13369 !! test
13370 Image with multiple alignments -- use first (bug 48664)
13371 !! options
13372 thumbsize=220
13373 !! wikitext
13374 [[File:Foobar.jpg|thumb|left|right|center|caption]]
13375
13376 [[File:Foobar.jpg|middle|text-top|caption]]
13377 !! html/php
13378 <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>
13379 <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>
13380 </p>
13381 !! html/parsoid
13382 <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>
13383 <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>
13384 !! end
13385
13386 !! test
13387 Image with width attribute at different positions
13388 !! wikitext
13389 [[File:Foobar.jpg|200px|right|Caption]]
13390 [[File:Foobar.jpg|right|200px|Caption]]
13391 [[File:Foobar.jpg|right|Caption|200px]]
13392 !! html/php
13393 <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>
13394 <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>
13395 <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>
13396
13397 !! html/parsoid
13398 <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>
13399 <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>
13400 <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>
13401 !! end
13402
13403 # a sad bit of backward-compatibility
13404 !! test
13405 Image with size specified with pxpx (bug 13500, 51628)
13406 !! options
13407 parsoid=wt2html,wt2wt,html2html
13408 !! wikitext
13409 [[File:Foobar.jpg|20pxpx]]
13410 [[File:Foobar.jpg|200x20pxpx]]
13411 !! html/php
13412 <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>
13413 <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>
13414 </p>
13415 !! html/parsoid
13416 <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>
13417 !! end
13418
13419 !! test
13420 Image with link parameter, wiki target
13421 !! wikitext
13422 [[File:Foobar.jpg|link=Main Page]]
13423 !! html/php
13424 <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>
13425 </p>
13426 !! html/parsoid
13427 <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>
13428 !! end
13429
13430 # parsoid bug 49293 (part 1)
13431 !! test
13432 Image with link parameter, URL target
13433 !! wikitext
13434 [[File:Foobar.jpg|link=http://example.com/]]
13435 !! html/php
13436 <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>
13437 </p>
13438 !! html/parsoid
13439 <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>
13440 !! end
13441
13442 # parsoid bug 49293 (part 2)
13443 !! test
13444 Image with link parameter, protocol-less URL target
13445 !! wikitext
13446 [[File:Foobar.jpg|link=//example.com/]]
13447 !! html/php
13448 <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>
13449 </p>
13450 !! html/parsoid
13451 <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>
13452 !! end
13453
13454 !! test
13455 Escaping non-block captions (T107435)
13456 !! options
13457 parsoid={
13458 "modes": ["wt2wt"],
13459 "changes": [
13460 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13461 ]
13462 }
13463 !! wikitext
13464 [[Image:Foobar.jpg|caption]]
13465 !! wikitext/edited
13466 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13467 !! end
13468
13469 # wgExternalLinkTarget not supported by Parsoid
13470 !! test
13471 Image with link parameter, wgExternalLinkTarget
13472 !! wikitext
13473 [[Image:foobar.jpg|link=http://example.com/]]
13474 !! config
13475 wgExternalLinkTarget='foobar'
13476 !! html/php
13477 <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>
13478 </p>
13479 !! end
13480
13481 !! test
13482 Image with link parameter, wgNoFollowLinks set to false
13483 !! wikitext
13484 [[Image:foobar.jpg|link=http://example.com/]]
13485 !! config
13486 wgNoFollowLinks=false
13487 !! html
13488 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13489 </p>
13490 !! end
13491
13492 !! test
13493 Image with link parameter, wgNoFollowDomainExceptions
13494 !! wikitext
13495 [[Image:foobar.jpg|link=http://example.com/]]
13496 !! config
13497 wgNoFollowDomainExceptions='example.com'
13498 !! html
13499 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13500 </p>
13501 !! end
13502
13503 # wgExternalLinkTarget not supported by Parsoid
13504 !! test
13505 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13506 !! wikitext
13507 [[Image:foobar.jpg|link=http://example.com/|Title]]
13508 !! config
13509 wgExternalLinkTarget='foobar'
13510 !! html/php
13511 <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>
13512 </p>
13513 !! end
13514
13515 !! test
13516 Image with empty link parameter
13517 !! wikitext
13518 [[File:Foobar.jpg|link=]]
13519 !! html/php
13520 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13521 </p>
13522 !! html/parsoid
13523 <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>
13524 !! end
13525
13526 !! test
13527 Image with link parameter (wiki target) and unnamed parameter
13528 !! wikitext
13529 [[File:Foobar.jpg|link=Main_Page|Title]]
13530 !! html/php
13531 <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>
13532 </p>
13533 !! html/parsoid
13534 <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>
13535 !! end
13536
13537 !! test
13538 Image with link parameter (URL target) and unnamed parameter
13539 !! wikitext
13540 [[File:Foobar.jpg|link=http://example.com/|Title]]
13541 !! html/php
13542 <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>
13543 </p>
13544 !! html/parsoid
13545 <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>
13546 !! end
13547
13548 !! test
13549 Thumbnail image with link parameter
13550 !! options
13551 thumbsize=220
13552 parsoid=wt2html,wt2wt,html2html
13553 !! wikitext
13554 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13555 !! html/php
13556 <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>
13557
13558 !! html/parsoid
13559 <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>
13560 !! end
13561
13562 !! test
13563 Manually-specified thumbnail image
13564 !! options
13565 thumbsize=220
13566 !! wikitext
13567 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13568 !! html/php
13569 <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>
13570
13571 !! html/parsoid
13572 <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>
13573 !! end
13574
13575 !! test
13576 Manually-specified thumbnail image with explicit link to wiki page
13577 !! options
13578 thumbsize=220
13579 parsoid=wt2html,wt2wt,html2html
13580 !! wikitext
13581 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13582 !! html/php
13583 <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>
13584
13585 !! html/parsoid
13586 <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>
13587 !! end
13588
13589 !! test
13590 Manually-specified thumbnail image with explicit link to url
13591 !! options
13592 thumbsize=220
13593 parsoid=wt2html,wt2wt,html2html
13594 !! wikitext
13595 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13596 !! html/php
13597 <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>
13598
13599 !! html/parsoid
13600 <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>
13601 !! end
13602
13603 !! test
13604 Manually-specified thumbnail image with explicit no link
13605 !! options
13606 thumbsize=220
13607 parsoid=wt2html,wt2wt,html2html
13608 !! wikitext
13609 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13610 !! html/php
13611 <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>
13612
13613 !! html/parsoid
13614 <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>
13615 !! end
13616
13617 !! test
13618 Manually-specified thumbnail image with explicit link and alt text
13619 !! options
13620 thumbsize=220
13621 parsoid=wt2html,wt2wt,html2html
13622 !! wikitext
13623 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13624 !! html/php
13625 <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>
13626
13627 !! html/parsoid
13628 <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>
13629 !! end
13630
13631 !! test
13632 Image with frame and link
13633 !! options
13634 parsoid=wt2html,wt2wt,html2html
13635 !! wikitext
13636 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13637 !! html/php
13638 <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>
13639
13640 !! html/parsoid
13641 <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>
13642 !! end
13643
13644 !! test
13645 Image with frame and link and explicit alt
13646 !! options
13647 parsoid=wt2html,wt2wt,html2html
13648 !! wikitext
13649 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13650 !! html/php
13651 <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>
13652
13653 !! html/parsoid
13654 <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>
13655 !! end
13656
13657 !! test
13658 Image with wiki markup in implicit alt
13659 !! wikitext
13660 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13661
13662 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13663 !! html/php
13664 <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>
13665 </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>
13666 </p>
13667 !! html/parsoid
13668 <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>
13669
13670 <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>
13671 !! end
13672
13673 !! test
13674 Alt image option should handle most kinds of wikitext without barfing
13675 !! wikitext
13676 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13677 !! html/php
13678 <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>
13679
13680 !! html/parsoid
13681 <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>
13682 !! end
13683
13684 ###################
13685 # Conflicting image format options.
13686 # First option specified should 'win'.
13687 # All three cases in each test should be identical.
13688
13689 !! test
13690 Image with 'frameless' first.
13691 !! options
13692 parsoid=wt2html,wt2wt,html2html
13693 !! wikitext
13694 [[File:Foobar.jpg|frameless|caption]]
13695
13696 [[File:Foobar.jpg|frameless|frame|caption]]
13697
13698 [[File:Foobar.jpg|frameless|thumb|caption]]
13699 !! html/php
13700 <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>
13701 </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>
13702 </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>
13703 </p>
13704 !! html/parsoid
13705 <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>
13706 <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>
13707 <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>
13708 !! end
13709
13710 !! test
13711 Image with 'frame' first.
13712 !! options
13713 parsoid=wt2html,wt2wt,html2html
13714 !! wikitext
13715 [[File:Foobar.jpg|frame|caption]]
13716 [[File:Foobar.jpg|frame|frameless|caption]]
13717 [[File:Foobar.jpg|frame|thumb|caption]]
13718 !! html/php
13719 <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>
13720 <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>
13721 <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>
13722
13723 !! html/parsoid
13724 <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>
13725 <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>
13726 <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>
13727 !! end
13728
13729 !! test
13730 Image with 'thumb' first.
13731 !! options
13732 parsoid=wt2html,wt2wt,html2html
13733 !! wikitext
13734 [[File:Foobar.jpg|thumb|caption]]
13735 [[File:Foobar.jpg|thumb|frameless|caption]]
13736 [[File:Foobar.jpg|thumb|frame|caption]]
13737 !! html/php
13738 <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>
13739 <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>
13740 <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>
13741
13742 !! html/parsoid
13743 <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>
13744 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
13745 <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>
13746 !! end
13747
13748 ###################
13749 # Image sizing.
13750 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13751 # and https://phabricator.wikimedia.org/T64258
13752 # Foobar has actual size of 1941x220
13753 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13754 # a scalable format.
13755 # 2. Framed images always ignore size options; always render at default size.
13756 # 3. "Unspecified format" and border are the only types which can be
13757 # enlarged.
13758
13759 !! test
13760 Image: "unspecified format" and border enlarge
13761 !! options
13762 parsoid=wt2html,wt2wt,html2html
13763 !! wikitext
13764 [[File:Foobar.jpg|2000px]]
13765
13766 [[File:Foobar.jpg|border|2000px]]
13767 !! html/php
13768 <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>
13769 </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>
13770 </p>
13771 !! html/parsoid
13772 <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>
13773 <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>
13774 !! end
13775
13776 !! test
13777 Image: "unspecified format" and border reduce
13778 !! options
13779 parsoid=wt2html,wt2wt,html2html
13780 !! wikitext
13781 [[File:Foobar.jpg|1000px]]
13782
13783 [[File:Foobar.jpg|border|1000px]]
13784 !! html/php
13785 <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>
13786 </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>
13787 </p>
13788 !! html/parsoid
13789 <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>
13790 <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>
13791 !! end
13792
13793 !! test
13794 Image: thumbs reduce
13795 !! options
13796 parsoid=wt2html,wt2wt,html2html
13797 !! wikitext
13798 [[File:Foobar.jpg|thumb|50px]]
13799 !! html/php
13800 <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>
13801
13802 !! html/parsoid
13803 <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>
13804 !! end
13805
13806 !! test
13807 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13808 !! options
13809 parsoid=wt2html,wt2wt,html2html
13810 !! wikitext
13811 [[File:Foobar.jpg|thumb|2000px]]
13812
13813 [[File:Foobar.svg|thumb|2000px]]
13814 !! html/php
13815 <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>
13816 <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>
13817
13818 !! html/parsoid
13819 <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>
13820 <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>
13821 !! end
13822
13823 !! test
13824 Image: frameless can reduce in size
13825 !! options
13826 parsoid=wt2html,wt2wt,html2html
13827 !! wikitext
13828 [[File:Foobar.jpg|frameless|50px]]
13829 !! html/php
13830 <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>
13831 </p>
13832 !! html/parsoid
13833 <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>
13834 !! end
13835
13836 !! test
13837 Image: bitmap frameless can't be enlarged past original size, but vector can
13838 !! options
13839 parsoid=wt2html,wt2wt,html2html
13840 !! wikitext
13841 [[File:Foobar.jpg|frameless|2000px]]
13842
13843 [[File:Foobar.svg|frameless|2000px]]
13844 !! html/php
13845 <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>
13846 </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>
13847 </p>
13848 !! html/parsoid
13849 <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>
13850 <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>
13851 !! end
13852
13853 !! test
13854 Image: framed images are always unscaled.
13855 !! options
13856 parsoid=wt2html,wt2wt,html2html
13857 !! wikitext
13858 [[File:Foobar.jpg|frame]]
13859
13860 [[File:Foobar.jpg|frame|50px]]
13861
13862 [[File:Foobar.jpg|frame|50x50px]]
13863
13864 [[File:Foobar.jpg|frame|2000px]]
13865 !! html/php
13866 <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>
13867 <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>
13868 <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>
13869 <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>
13870
13871 !! html/parsoid
13872 <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>
13873 <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>
13874 <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>
13875 <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>
13876 !! end
13877
13878 ###################
13879
13880 !! test
13881 Link to image page- image page normally doesn't exists, hence edit link
13882 Add test with existing image page
13883 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13884 !! wikitext
13885 [[:Image:test]]
13886 !! html
13887 <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>
13888 </p>
13889 !! end
13890
13891 !! test
13892 bug 18784 Link to non-existent image page with caption should use caption as link text
13893 !! wikitext
13894 [[:Image:test|caption]]
13895 !! html
13896 <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>
13897 </p>
13898 !! end
13899
13900 !! test
13901 Frameless image caption with a free URL
13902 !! wikitext
13903 [[File:Foobar.jpg|http://example.com]]
13904 !! html/php
13905 <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>
13906 </p>
13907 !! html/parsoid
13908 <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>
13909 !! end
13910
13911 !! test
13912 Thumbnail image caption with a free URL
13913 !! options
13914 thumbsize=220
13915 !! wikitext
13916 [[File:Foobar.jpg|thumb|http://example.com]]
13917 !! html/php
13918 <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>
13919
13920 !! html/parsoid
13921 <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>
13922 !! end
13923
13924 !! test
13925 Thumbnail image caption with a free URL and explicit alt
13926 !! options
13927 thumbsize=220
13928 parsoid=wt2html,wt2wt,html2html
13929 !! wikitext
13930 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13931 !! html/php
13932 <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>
13933
13934 !! html/parsoid
13935 <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>
13936 !! end
13937
13938 !! test
13939 SVG thumbnails with no language set
13940 !! options
13941 !! wikitext
13942 [[File:Foobar.svg|thumb|caption]]
13943 !! html/php
13944 <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>
13945
13946 !! html/parsoid
13947 <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>
13948 !! end
13949
13950 !! test
13951 SVG thumbnails with language de
13952 !! options
13953 parsoid=wt2html,wt2wt,html2html
13954 !! wikitext
13955 [[File:Foobar.svg|thumb|caption|lang=de]]
13956 !! html/php
13957 <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>
13958
13959 !! html/parsoid
13960 <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>
13961 !! end
13962
13963 !! test
13964 SVG thumbnails with invalid language code
13965 !! options
13966 parsoid=wt2html,wt2wt,html2html
13967 !! wikitext
13968 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
13969 !! html/php
13970 <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>
13971
13972 !! html/parsoid
13973 <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>
13974 !! end
13975
13976 !! test
13977 BUG 1887: A ISBN with a thumbnail
13978 !! wikitext
13979 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
13980 !! html/php
13981 <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>
13982
13983 !! html/parsoid
13984 <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>
13985 !! end
13986
13987 !! test
13988 BUG 1887: A RFC with a thumbnail
13989 !! wikitext
13990 [[File:Foobar.jpg|thumb|This is RFC 12354]]
13991 !! html/php
13992 <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>
13993
13994 !! html/parsoid
13995 <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>
13996 !! end
13997
13998 !! test
13999 BUG 1887: A mailto link with a thumbnail
14000 !! wikitext
14001 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
14002 !! html/php
14003 <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>
14004
14005 !! html/parsoid
14006 <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>
14007 !! end
14008
14009 # Pending resolution to bug 368
14010 !! test
14011 BUG 648: Frameless image caption with a link
14012 !! wikitext
14013 [[File:Foobar.jpg|text with a [[link]] in it]]
14014 !! html/php
14015 <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>
14016 </p>
14017 !! html/parsoid
14018 <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>
14019 !! end
14020
14021 !! test
14022 BUG 648: Frameless image caption with a link (suffix)
14023 !! wikitext
14024 [[File:Foobar.jpg|text with a [[link]]foo in it]]
14025 !! html/php
14026 <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>
14027 </p>
14028 !! html/parsoid
14029 <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>
14030 !! end
14031
14032 !! test
14033 BUG 648: Frameless image caption with an interwiki link
14034 !! wikitext
14035 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
14036 !! html/php
14037 <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>
14038 </p>
14039 !! html/parsoid
14040 <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>
14041 !! end
14042
14043 !! test
14044 BUG 648: Frameless image caption with a piped interwiki link
14045 !! wikitext
14046 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
14047 !! html/php
14048 <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>
14049 </p>
14050 !! html/parsoid
14051 <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>
14052 !! end
14053
14054 !! test
14055 T107474: Frameless image caption with <nowiki>
14056 !! wikitext
14057 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
14058 !! html/parsoid
14059 <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>
14060 !! end
14061
14062 !! test
14063 Escape HTML special chars in image alt text
14064 !! wikitext
14065 [[File:Foobar.jpg|& < > "]]
14066 !! html/php
14067 <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>
14068 </p>
14069 !! html/parsoid
14070 <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>
14071 !! end
14072
14073 !! test
14074 Entities in file name and attributes
14075 !! wikitext
14076 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
14077 !! html/php
14078 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
14079 </p>
14080 !! html/parsoid
14081 <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>
14082 !! end
14083
14084 !! test
14085 BUG 499: Alt text should have &#1234;, not &amp;1234;
14086 !! wikitext
14087 [[File:Foobar.jpg|&#9792;]]
14088 !! html/php
14089 <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>
14090 </p>
14091 !! html/parsoid
14092 <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>
14093 !! end
14094
14095 !! test
14096 Broken image caption with link
14097 !! options
14098 parsoid=wt2html,wt2wt,html2html
14099 !! wikitext
14100 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
14101 !! html/php
14102 <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.
14103 </p>
14104 !! html/parsoid
14105 <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>
14106 !! end
14107
14108 !! test
14109 Image caption containing another image
14110 !! wikitext
14111 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
14112 !! html/php
14113 <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>
14114
14115 !! html/parsoid
14116 <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>
14117 !! end
14118
14119 !! test
14120 Image: caption containing a newline
14121 !! wikitext
14122 [[File:Foobar.jpg|This
14123 *is some text]]
14124 !! html/php
14125 <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>
14126 </p>
14127 !! html/parsoid
14128 <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>
14129 !!end
14130
14131 !!test
14132 Image: caption containing leading space
14133 (The leading space should not trigger nowiki escaping in wt2wt mode)
14134 !! wikitext
14135 [[File:Foobar.jpg|thumb| bar]]
14136 !! html/php
14137 <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>
14138
14139 !! html/parsoid
14140 <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>
14141 !!end
14142
14143 !! test
14144 Image: caption containing a table
14145 !! options
14146 parsoid=wt2html,wt2wt,html2html
14147 !! wikitext
14148 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
14149 {|
14150 ! Foo !! Bar
14151 |-
14152 | Foo1 || Bar1
14153 |}
14154 and some more text.]]
14155 !! html/php
14156 <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>
14157
14158 !! html/parsoid
14159 <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
14160 <table>
14161 <tbody>
14162 <tr><th>Foo </th><th>Bar</th></tr>
14163 <tr>
14164 <td>Foo1 </td>
14165 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
14166 !! end
14167
14168 !! test
14169 Bug 3090: External links other than http: in image captions
14170 !! wikitext
14171 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
14172 !! html/php
14173 <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>
14174
14175 !! html/parsoid
14176 <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>
14177 !! end
14178
14179 !! test
14180 Custom class
14181 !! options
14182 parsoid=wt2html,wt2wt,html2html
14183 !! wikitext
14184 [[Image:foobar.jpg|a|class=b]]
14185 !! html/php
14186 <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>
14187 </p>
14188 !! html/parsoid
14189 <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>
14190 !! end
14191
14192 !! test
14193 Localized image handling (1).
14194 !! options
14195 parsoid=wt2html,wt2wt,html2html
14196 language=es
14197 !! wikitext
14198 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
14199 !! html/php
14200 <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>
14201
14202 !! html/parsoid
14203 <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>
14204 !! end
14205
14206 !! test
14207 Localized image handling (2).
14208 !! options
14209 thumbsize=220
14210 parsoid=wt2html,wt2wt,html2html
14211 language=es
14212 !! wikitext
14213 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
14214 !! html/php
14215 <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>
14216
14217 !! html/parsoid
14218 <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>
14219 !! end
14220
14221 !! test
14222 Localized image handling (3).
14223 !! options
14224 language=fa
14225 parsoid=html2wt
14226 !! html/parsoid
14227 <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>
14228 !! wikitext
14229 [[File:Foobar.jpg|بندانگشتی]]
14230 !! end
14231
14232 !! test
14233 "border", "frameless" and "class" attributes on an image.
14234 !! options
14235 thumbsize=220
14236 parsoid=wt2html,wt2wt,html2html
14237 !! wikitext
14238 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
14239 !! html/php
14240 <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>
14241 </p>
14242 !! html/parsoid
14243 <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>
14244 !! end
14245
14246 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
14247 !! test
14248 Invalid image attributes (bug 62500)
14249 !! options
14250 thumbsize=220
14251 parsoid=wt2html,wt2wt,html2html
14252 !! wikitext
14253 [[File:Foobar.jpg|thumb|float|left|caption]]
14254
14255 [[File:Foobar.jpg|thumb|righ|caption]]
14256
14257 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
14258 !! html/php
14259 <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>
14260 <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>
14261 <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>
14262
14263 !! html/parsoid
14264 <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>
14265 <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>
14266 <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>
14267 !! end
14268
14269 !! article
14270 File:Barfoo.jpg
14271 !! text
14272 #REDIRECT [[File:Barfoo.jpg]]
14273 !! endarticle
14274
14275 # FIXME: Parsoid should run this test -- but we'd need to teach the
14276 # mockAPI about the redirected Barfoo.jpg image.
14277 !! test
14278 Redirected image
14279 !! wikitext
14280 [[Image:Barfoo.jpg]]
14281 !! html/php
14282 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
14283 </p>
14284 !! end
14285
14286 !! test
14287 Missing image with uploads disabled
14288 !! options
14289 wgEnableUploads=0
14290 !! wikitext
14291 [[File:Foobaz.jpg]]
14292 !! html/php
14293 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
14294 </p>
14295 !! html/parsoid
14296 <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>
14297 !! end
14298
14299 # Parsoid-specific testing for images
14300 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14301 # Currently imperfect due to a flaw in the Parsoid testrunner
14302 # Work in progress
14303 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
14304 # image tests.
14305
14306 !! test
14307 Parsoid-specific image handling - simple image with size and middle alignment
14308 !! wikitext
14309 [[File:Foobar.jpg|middle|50px]]
14310 !! html/parsoid
14311 <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>
14312 !! end
14313
14314 !! test
14315 Parsoid-specific image handling - simple image with size, middle alignment,
14316 non-standard namespace alias
14317 !! options
14318 parsoid=wt2wt,wt2html,html2html
14319 !! wikitext
14320 [[Image:Foobar.jpg|middle|50px]]
14321 !! html/parsoid
14322 <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>
14323 !! end
14324
14325 !! test
14326 Parsoid-specific image handling - simple image with size and middle alignment
14327 (existing content)
14328 !! wikitext
14329 [[File:Foobar.jpg|50px|middle]]
14330 !! html/parsoid
14331 <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>
14332 !! end
14333
14334 !! test
14335 Parsoid-specific image handling - simple image with size and middle alignment
14336 and non-standard namespace name
14337 !! options
14338 parsoid=wt2html,wt2wt,html2html
14339 !! wikitext
14340 [[Image:Foobar.jpg|50px|middle]]
14341 !! html/parsoid
14342 <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>
14343 !! end
14344
14345 !! test
14346 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
14347 !! wikitext
14348 [[File:Foobar.jpg|500x10px|baseline|caption]]
14349 !! html/parsoid
14350 <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>
14351 !! end
14352
14353 !! test
14354 Parsoid-specific image handling - simple image with border and size spec
14355 !! wikitext
14356 [[File:Foobar.jpg|50px|border|caption]]
14357 !! html/parsoid
14358 <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>
14359 !! end
14360
14361 !! test
14362 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14363 !! wikitext
14364 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
14365 !! html/parsoid
14366 <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>
14367 !! end
14368
14369 !! test
14370 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14371 (existing content)
14372 !! wikitext
14373 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
14374 !! html/parsoid
14375 <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>
14376 !! end
14377
14378 !! test
14379 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
14380 !! wikitext
14381 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
14382 !! html/parsoid
14383 <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>
14384 !! end
14385
14386 !! test
14387 Parsoid-specific image handling - thumbnail with specific size, halign,
14388 valign, and caption (existing content)
14389 !! wikitext
14390 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
14391 !! html/parsoid
14392 <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>
14393 !! end
14394
14395 !! test
14396 Parsoid-specific image handling - framed image with specific size and caption
14397 (size is ignored)
14398 !! options
14399 parsoid=wt2html,wt2wt,html2html
14400 !! wikitext
14401 [[File:Foobar.jpg|frame|500x50px|caption]]
14402 !! html/parsoid
14403 <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>
14404 !! end
14405
14406 !! test
14407 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14408 (size is ignored)
14409 !! options
14410 parsoid=wt2html,wt2wt,html2html
14411 !! wikitext
14412 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14413 !! html/parsoid
14414 <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>
14415 !! end
14416
14417 !! test
14418 Parsoid-specific image handling - frameless image with specific size, border, and caption
14419 !! wikitext
14420 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14421 !! html/parsoid
14422 <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>
14423 !! end
14424
14425 !! test
14426 Parsoid-specific image handling - simple image with a formatted caption
14427 !! wikitext
14428 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14429 !! html/parsoid
14430 <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>
14431 !! end
14432
14433 !! test
14434 Parsoid-specific image handling - caption with a template in it
14435 !! wikitext
14436 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14437 !! html/parsoid
14438 <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>
14439 !! end
14440
14441 !! test
14442 Parsoid-specific image handling - caption with unbalanced tags in it
14443 !! options
14444 parsoid=wt2html,wt2wt,html2html
14445 !! wikitext
14446 foo
14447 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14448 bar
14449 !! html/parsoid
14450 <p>foo</p>
14451 <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>
14452 <p>bar</p>
14453 !! end
14454
14455 !! test
14456 Parsoid-specific image handling - empty caption (1)
14457 !! options
14458 parsoid=wt2html,wt2wt
14459 !! wikitext
14460 [[File:Foobar.jpg|thumb|]]
14461 !! html/parsoid
14462 <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>
14463 !! end
14464
14465 # empty captions don't get serialized unless we're in the "round trip" case
14466 !! test
14467 Parsoid-specific image handling - empty caption (2)
14468 !! options
14469 parsoid=html2wt
14470 !! html/parsoid
14471 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14472 <a href="./File:Foobar.jpg">
14473 <img resource="./File:Foobar.jpg"
14474 src="//example.com/images/3/3a/Foobar.jpg"
14475 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14476 height="25" width="220"/>
14477 </a>
14478 <figcaption></figcaption>
14479 </figure>
14480 !! wikitext
14481 [[File:Foobar.jpg|thumb]]
14482 !! end
14483
14484 !! test
14485 Parsoid-specific image handling - whitespace caption
14486 !! wikitext
14487 [[File:Foobar.jpg|thumb| ]]
14488 !! html/parsoid
14489 <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>
14490 !! end
14491
14492 !! test
14493 Parsoid-specific image handling - lang option
14494 !! wikitext
14495 foo
14496 [[File:Foobar.svg|lang=de|caption]]
14497 bar
14498 !! html/parsoid
14499 <p>foo
14500 <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>
14501 bar</p>
14502 !! end
14503
14504 ## Edge case bugs in Parsoid from T93580
14505 !! test
14506 T93580: 1. Templated <ref> inside block images
14507 !! wikitext
14508 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14509
14510 <references />
14511 !! html/parsoid
14512 <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>
14513
14514 <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>
14515 !! end
14516
14517 !! test
14518 T93580: 2. <ref> inside inline images
14519 !! wikitext
14520 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14521
14522 <references />
14523 !! html/parsoid
14524 <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>
14525
14526 <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>
14527 !! end
14528
14529 !! test
14530 T93580: 3. Templated <ref> inside inline images
14531 !! wikitext
14532 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14533
14534 <references />
14535 !! html/parsoid
14536 <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>
14537
14538 <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>
14539 !! end
14540
14541 ###
14542 ### Subpages
14543 ###
14544 !! article
14545 Subpage test/subpage
14546 !! text
14547 foo
14548 !! endarticle
14549
14550 !! test
14551 Subpage link
14552 !! options
14553 subpage title=[[Subpage test]]
14554 !! wikitext
14555 [[/subpage]]
14556 !! html
14557 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14558 </p>
14559 !! end
14560
14561 !! test
14562 Subpage noslash link
14563 !! options
14564 subpage title=[[Subpage test]]
14565 !! wikitext
14566 [[/subpage/]]
14567 !! html
14568 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14569 </p>
14570 !! end
14571
14572 !! article
14573 Subpage test/1/2/subpage
14574 !! text
14575 blah
14576 !! endarticle
14577
14578 !! test
14579 Relative subpage noslash link
14580 !! options
14581 parsoid=wt2wt,wt2html,html2html
14582 subpage title=[[Subpage test/1/2/3/4]]
14583 !! wikitext
14584 [[../../subpage/]]
14585
14586 [[../../subpage]]
14587 !! html/php
14588 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14589 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14590 </p>
14591 !! html/parsoid
14592 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14593 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14594 !! end
14595
14596 !! test
14597 Parsoid: dot-slash prefixed wikilinks
14598 !! wikitext
14599 [[./foo]]
14600
14601 [[././bar]]
14602
14603 [[././baz/]]
14604 !! html/php
14605 <p>[[./foo]]
14606 </p><p>[[././bar]]
14607 </p><p>[[././baz/]]
14608 </p>
14609 !! html/parsoid
14610 <p>[[./foo]]
14611 </p><p>[[././bar]]
14612 </p><p>[[././baz/]]
14613 </p>
14614 !! end
14615
14616 !! test
14617 Render invalid page names as plain text (bug 51090)
14618 !! wikitext
14619 [[./../foo|bar]]
14620 [[foo�|bar]]
14621 [[foo/.|bar]]
14622 [[foo/..|bar]]
14623 [[foo~~~bar]]
14624 [[foo>bar]]
14625 [[foo[bar]]
14626 [[.]]
14627 [[..]]
14628 [[foo././bar]]
14629
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 [[{{echo|foo}bar}}]]
14638 [[{{echo|foo[bar}}]]
14639 [[{{echo|foo]bar}}]]
14640 [[{{echo|foo<bar}}]]
14641 !!html/php
14642 <p>[[./../foo|bar]]
14643 [[foo�|bar]]
14644 [[foo/.|bar]]
14645 [[foo/..|bar]]
14646 [[foo~~~bar]]
14647 [[foo&gt;bar]]
14648 [[foo[bar]]
14649 [[.]]
14650 [[..]]
14651 [[foo././bar]]
14652 </p><p>[[./../foo|bar]]
14653 [[foo/.|bar]]
14654 [[foo/..|bar]]
14655 [[foo~~~~bar]]
14656 [[foo&gt;bar]]
14657 [[foo././bar]]
14658 [[foo{bar]]
14659 [[foo}bar]]
14660 [[foo[bar]]
14661 [[foo]bar]]
14662 [[foo&lt;bar]]
14663 </p>
14664 !!html/parsoid
14665 <p>[[./../foo|bar]]
14666 [[foo�|bar]]
14667 [[foo/.|bar]]
14668 [[foo/..|bar]]
14669 [[foo~~~bar]]
14670 [[foo>bar]]
14671 [[foo[bar]]
14672 [[.]]
14673 [[..]]
14674 [[foo././bar]]</p>
14675
14676 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14677 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14678 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
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{bar"}},"i":0}}]}'>foo{bar</span>]]
14683 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14684 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14685 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14686 [[<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>
14687 !!end
14688
14689 !! test
14690 Disabled subpages
14691 !! wikitext
14692 [[/subpage]]
14693 !! html
14694 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14695 </p>
14696 !! end
14697
14698 !! test
14699 BUG 561: {{/Subpage}}
14700 !! options
14701 subpage title=[[Page]]
14702 !! wikitext
14703 {{/Subpage}}
14704 !! html
14705 <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>
14706 </p>
14707 !! end
14708
14709 ###
14710 ### Categories
14711 ###
14712 !! article
14713 Category:MediaWiki User's Guide
14714 !! text
14715 blah
14716 !! endarticle
14717
14718 !! test
14719 Link to category
14720 !! wikitext
14721 [[:Category:MediaWiki User's Guide]]
14722 !! html
14723 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14724 </p>
14725 !! end
14726
14727 !! test
14728 Simple category
14729 !! options
14730 cat
14731 !! wikitext
14732 [[Category:MediaWiki User's Guide]]
14733 !! html
14734 cat=MediaWiki_User's_Guide sort=
14735 !! end
14736
14737 !! test
14738 PAGESINCATEGORY invalid title fatal (r33546 fix)
14739 !! wikitext
14740 {{PAGESINCATEGORY:<bogus>}}
14741 !! html
14742 <p>0
14743 </p>
14744 !! end
14745
14746 !! test
14747 Category with different sort key
14748 !! options
14749 cat
14750 !! wikitext
14751 [[Category:MediaWiki User's Guide|Foo]]
14752 !! html
14753 cat=MediaWiki_User's_Guide sort=Foo
14754 !! end
14755
14756 !! test
14757 Category with identical sort key
14758 !! options
14759 cat
14760 !! wikitext
14761 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14762 !! html
14763 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
14764 !! end
14765
14766 !! test
14767 Category with empty sort key
14768 !! options
14769 cat
14770 pst
14771 !! wikitext
14772 [[Category:MediaWiki User's Guide|]]
14773 !! html/php
14774 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14775 !! end
14776
14777 !! test
14778 Category with empty sort key and parentheses
14779 !! options
14780 cat
14781 pst
14782 !! wikitext
14783 [[Category:Foo (bar)|]]
14784 !! html/php
14785 [[Category:Foo (bar)|Foo]]
14786 !! end
14787
14788 ## We used to, but no longer wt2wt this test since the default serializer
14789 ## will normalize all categories to serialize on their own line.
14790 ## This wikitext usage is going to be fairly uncommon in production and
14791 ## selser will take care of preserving formatting in those scenarios.
14792 !! test
14793 Category with link tail
14794 !! options
14795 cat
14796 pst
14797 parsoid=wt2html
14798 !! wikitext
14799 123[[Category:Foo]]456
14800 !! html/php
14801 123[[Category:Foo]]456
14802 !! html/parsoid
14803 <p>123<link rel="mw:PageProp/Category" href="Category:Foo"/>456</p>
14804 !! end
14805
14806 !! test
14807 Category with template
14808 !! options
14809 cat
14810 pst
14811 !! wikitext
14812 [[Category:{{echo|Foo}}]]
14813 !! html/php
14814 [[Category:{{echo|Foo}}]]
14815 !! end
14816
14817 !! test
14818 Category with template in sort key
14819 !! options
14820 cat
14821 pst
14822 !! wikitext
14823 [[Category:Foo|{{echo|Bar}}]]
14824 !! html/php
14825 [[Category:Foo|{{echo|Bar}}]]
14826 !! end
14827
14828 !! test
14829 Category with template in sort key and title
14830 !! options
14831 cat
14832 pst
14833 !! wikitext
14834 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14835 !! html/php
14836 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14837 !! end
14838
14839 ## We used to, but no longer wt2wt this test since the default serializer
14840 ## will normalize all categories to serialize on their own line.
14841 ## This wikitext usage is going to be fairly uncommon in production and
14842 ## selser will take care of preserving formatting in those scenarios.
14843 !! test
14844 Category / paragraph interactions
14845 !! options
14846 parsoid=wt2html
14847 !! wikitext
14848 Foo [[Category:Baz]] Bar
14849
14850 Foo [[Category:Baz]]
14851 Bar
14852
14853 Foo
14854 [[Category:Baz]]
14855 Bar
14856
14857 Foo
14858 [[Category:Baz]] Bar
14859
14860 Foo
14861 [[Category:Baz]]
14862 [[Category:Baz]]
14863 [[Category:Baz]]
14864 Bar
14865
14866 [[Category:Baz]]
14867 [[Category:Baz]]
14868 [[Category:Baz]]
14869
14870 [[Category:Baz]]
14871 {{echo|[[Category:Baz]]}}
14872 [[Category:Baz]]
14873 !! html/php
14874 <p>Foo Bar
14875 </p><p>Foo
14876 Bar
14877 </p><p>Foo
14878 Bar
14879 </p><p>Foo Bar
14880 </p><p>Foo
14881 Bar
14882 </p>
14883 !! html/parsoid
14884 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14885 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14886 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14887 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14888 <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>
14889 <link rel="mw:PageProp/Category" href="Category:Baz"/>
14890 !! end
14891
14892 ## We used to, but no longer wt2wt this test since the default serializer
14893 ## will normalize all categories to serialize on their own line.
14894 ## This wikitext usage is going to be fairly uncommon in production and
14895 ## selser will take care of preserving formatting in those scenarios.
14896 ##
14897 ## The whitespace on the empty line is part of the test. Please do not delete
14898 !! test
14899 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14900 !! options
14901 parsoid=wt2html
14902 !! wikitext
14903 This
14904
14905 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14906
14907 {{echo|[[Category:Foo]] and so should this!}}
14908 !! html/php
14909 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14910 </p>
14911 !! html/parsoid
14912 <p>This
14913
14914 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14915
14916 <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>
14917 !! end
14918
14919 ## Parsoid will not try to wt2wt this while preserving newlines because
14920 ## it suppresses excess newlines within list items -- and we don't want to
14921 ## introduce a special case just for categories, which is, in reality somewhat
14922 ## odd behavior -- categories are unlikely to be used in list items like this
14923 ## in top-level pages and are only likely to show up in template-generated
14924 ## list items where this RT-ing is a non-issue.
14925 ##
14926 ## The whitespace on the empty line is part of the test. Please do not delete
14927 !! test
14928 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14929 !! options
14930 parsoid=wt2html
14931 !! wikitext
14932 * This
14933
14934 [[Category:Foo]] and this should be part of the same list item
14935 * So should this
14936
14937 {{echo|[[Category:Foo]] and this should be part of the same list item}}
14938 !! html
14939 <ul><li>This and this should be part of the same list item</li>
14940 <li>So should this and this should be part of the same list item</li></ul>
14941 !! html/parsoid
14942 <ul>
14943 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
14944 <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>
14945 </ul>
14946 !! end
14947
14948 ## Newlines and categories that follow the last item of a list
14949 ## are treated differently because this (list followed by categories)
14950 ## is an extremely common pattern on wikis.
14951 !! test
14952 3. Categories and newlines: newline suppression for last list item should RT properly
14953 !! wikitext
14954 * a
14955 * b
14956
14957 [[Category:Foo]]
14958
14959 [[Category:Bar]]
14960 [[Category:Baz]]
14961 !! html/parsoid
14962 <ul><li> a</li>
14963 <li> b</li></ul>
14964
14965 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14966
14967 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14968 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14969 !! end
14970
14971 !! test
14972 4. Categories and newlines: newline suppression for last list item should RT properly
14973 !! wikitext
14974 * a
14975 **** b
14976
14977 [[Category:Foo]]
14978 !! html/parsoid
14979 <ul><li> a
14980 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
14981
14982 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14983 !! end
14984
14985 ## only wt2html for this to make sure the algo only applies to the rightmost path
14986 !! test
14987 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
14988 !! options
14989 parsoid=wt2html
14990 !! wikitext
14991 * a
14992 ** b
14993 [[Category:Foo]]
14994 * c
14995 ** d
14996 [[Category:Foo]]
14997 !! html/parsoid
14998 <ul><li> a
14999 <ul><li> b
15000 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
15001 <li> c
15002 <ul><li> d</li></ul></li></ul>
15003 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15004 !! end
15005
15006 ## We used to, but no longer wt2wt this test since the default serializer
15007 ## will normalize all categories to serialize on their own line.
15008 ## This wikitext usage is going to be fairly uncommon in production and
15009 ## selser will take care of preserving formatting in those scenarios.
15010 !! test
15011 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
15012 !! options
15013 parsoid=wt2html
15014 !! wikitext
15015 * a [[Category:Foo]]
15016 !! html/parsoid
15017 <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>
15018 !! end
15019
15020 # This test also demonstrates because of newline+category tunneling
15021 # through the list hander, template wrapping doesn't expand to the
15022 # containing list when the list item swallows the category.
15023 !! test
15024 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
15025 !! wikitext
15026 * {{echo|a
15027 [[Category:Foo]]}}
15028 !! html/parsoid
15029 <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
15030 </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>
15031 !! end
15032
15033 !! test
15034 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
15035 !! wikitext
15036 * a
15037
15038 {{echo|[[Category:Foo]]
15039 [[Category:Bar]]}}
15040 [[Category:Baz]]
15041 !! html/parsoid
15042 <ul><li> a</li></ul>
15043
15044 <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">
15045 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15046 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15047 !! end
15048
15049 !! test
15050 Category links with multiple namespaces
15051 !! wikitext
15052 [[Category:Project:Foo]]
15053 !! html/parsoid
15054 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
15055 !! end
15056
15057 !! test
15058 Parsoid: Serialize link to category page with colon escape
15059 !! options
15060 parsoid
15061 !! wikitext
15062
15063 [[:Category:Foo]]
15064 [[:Category:Foo|Bar]]
15065 !! html
15066 <p>
15067 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
15068 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
15069 </p>
15070 !! end
15071
15072 # We used to, but no longer wt2wt this test since the default serializer
15073 # will normalize all categories to serialize on their own line.
15074 # This wikitext usage is going to be fairly uncommon in production and
15075 # selser will take care of preventing whitespace insertion if this
15076 # occurs in an article.
15077 #
15078 # html2html disabled for the same reason (whitespace insertion between
15079 # x and y).
15080 #
15081 # html2wt disabled because it localizes the "Category" namespace.
15082 !! test
15083 Link prefix/suffixes aren't applied to category links
15084 !! options
15085 parsoid=wt2html
15086 language=is
15087 !! wikitext
15088 x[[Category:Foo]]y
15089 !! html/php
15090 <p>xy
15091 </p>
15092 !! html/parsoid
15093 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
15094 !! end
15095
15096 !! test
15097 Parsoid: Serialize link to file page with colon escape
15098 !! options
15099 parsoid
15100 !! wikitext
15101
15102 [[:File:Foo.png]]
15103 [[:File:Foo.png|Bar]]
15104 !! html
15105 <p>
15106 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
15107 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
15108 </p>
15109 !! end
15110
15111 !! test
15112 Parsoid: Serialize a genuine category link without colon escape
15113 !! options
15114 parsoid
15115 !! wikitext
15116 [[Category:Foo]]
15117 [[Category:Foo|Bar]]
15118 !! html
15119 <link rel="mw:PageProp/Category" href="./Category:Foo">
15120 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
15121 !! end
15122
15123 !! test
15124 Normalize hrefs properly before testing for invalid link targets (bug 70894)
15125 !! options
15126 parsoid=html2wt
15127 !! html/parsoid
15128 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
15129 !! wikitext
15130 [[Category:Toxine bactérienne]]
15131 !! end
15132
15133 !! test
15134 Parsoid: Defaultsort
15135 !! wikitext
15136 {{DEFAULTSORT:Foo}}
15137 !! html/parsoid
15138 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
15139 !! end
15140
15141 !! test
15142 Parsoid: Defaultsort (template-generated)
15143 !! wikitext
15144 {{{{echo|DEFAULTSORT}}:Foo}}
15145 !! html/parsoid
15146 <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}}]}'/>
15147 !! end
15148
15149 ###
15150 ### Inter-language links
15151 ###
15152 !! test
15153 Interlanguage links
15154 !! options
15155 ill
15156 !! wikitext
15157 [[es:Alimento]]
15158 [[fr:Nourriture]]
15159 [[zh:食品]]
15160 !! html/php
15161 es:Alimento fr:Nourriture zh:食品
15162 !! html/parsoid
15163 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
15164 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
15165 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
15166 !! end
15167
15168 !! test
15169 Duplicate interlanguage links (bug 24502)
15170 !! options
15171 ill
15172 !! wikitext
15173 [[es:1]]
15174 [[es:2]]
15175 [[fr:1]]
15176 [[fr:2]]
15177 !! html/php
15178 es:1 fr:1
15179 !! html/parsoid
15180 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
15181 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
15182 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
15183 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
15184 !! end
15185
15186 ###
15187 ### Sections
15188 ###
15189 !! test
15190 Basic section headings
15191 !! wikitext
15192 == Headline 1 ==
15193 Some text
15194
15195 ==Headline 2==
15196 More
15197 ===Smaller headline===
15198 Blah blah
15199 !! html
15200 <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>
15201 <p>Some text
15202 </p>
15203 <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>
15204 <p>More
15205 </p>
15206 <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>
15207 <p>Blah blah
15208 </p>
15209 !! end
15210
15211 !! test
15212 Section headings with TOC
15213 !! wikitext
15214 == Headline 1 ==
15215 === Subheadline 1 ===
15216 ===== Skipping a level =====
15217 ====== Skipping a level ======
15218
15219 == Headline 2 ==
15220 Some text
15221 ===Another headline===
15222 !! html
15223 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15224 <ul>
15225 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
15226 <ul>
15227 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
15228 <ul>
15229 <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>
15230 <ul>
15231 <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>
15232 </ul>
15233 </li>
15234 </ul>
15235 </li>
15236 </ul>
15237 </li>
15238 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
15239 <ul>
15240 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
15241 </ul>
15242 </li>
15243 </ul>
15244 </div>
15245
15246 <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>
15247 <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>
15248 <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>
15249 <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>
15250 <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>
15251 <p>Some text
15252 </p>
15253 <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>
15254
15255 !! end
15256
15257 !! test
15258 TOC anchors don't collide
15259 !! wikitext
15260 __FORCETOC__
15261 == Headline 2 ==
15262 == Headline ==
15263 == Headline 2 ==
15264 == Headline ==
15265 !! html/php
15266 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15267 <ul>
15268 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
15269 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
15270 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
15271 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
15272 </ul>
15273 </div>
15274
15275 <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>
15276 <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>
15277 <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>
15278 <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>
15279
15280 !! end
15281
15282 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
15283 !! test
15284 Handling of sections up to level 6 and beyond
15285 !! wikitext
15286 = Level 1 Heading=
15287 == Level 2 Heading==
15288 === Level 3 Heading===
15289 ==== Level 4 Heading====
15290 ===== Level 5 Heading=====
15291 ====== Level 6 Heading======
15292 ======= Level 7 Heading=======
15293 ======== Level 8 Heading========
15294 ========= Level 9 Heading=========
15295 ========== Level 10 Heading==========
15296 !! html
15297 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15298 <ul>
15299 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
15300 <ul>
15301 <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>
15302 <ul>
15303 <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>
15304 <ul>
15305 <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>
15306 <ul>
15307 <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>
15308 <ul>
15309 <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>
15310 <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>
15311 <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>
15312 <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>
15313 <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>
15314 </ul>
15315 </li>
15316 </ul>
15317 </li>
15318 </ul>
15319 </li>
15320 </ul>
15321 </li>
15322 </ul>
15323 </li>
15324 </ul>
15325 </div>
15326
15327 <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>
15328 <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>
15329 <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>
15330 <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>
15331 <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>
15332 <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>
15333 <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>
15334 <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>
15335 <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>
15336 <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>
15337
15338 !! end
15339
15340 !! test
15341 TOC regression (T11764)
15342 !! wikitext
15343 == title 1 ==
15344 === title 1.1 ===
15345 ==== title 1.1.1 ====
15346 === title 1.2 ===
15347 == title 2 ==
15348 === title 2.1 ===
15349 !! html
15350 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15351 <ul>
15352 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15353 <ul>
15354 <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>
15355 <ul>
15356 <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>
15357 </ul>
15358 </li>
15359 <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>
15360 </ul>
15361 </li>
15362 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15363 <ul>
15364 <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>
15365 </ul>
15366 </li>
15367 </ul>
15368 </div>
15369
15370 <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>
15371 <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>
15372 <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>
15373 <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>
15374 <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>
15375 <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>
15376
15377 !! end
15378
15379 !! test
15380 TOC for heading containing <span id="..."></span> (T96153)
15381 !! wikitext
15382 __FORCETOC__
15383 ==<span id="old-anchor"></span>New title==
15384 !! html/php
15385 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15386 <ul>
15387 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
15388 </ul>
15389 </div>
15390
15391 <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>
15392
15393 !! end
15394
15395 !! test
15396 TOC with wgMaxTocLevel=3 (bug 6204)
15397 !! options
15398 wgMaxTocLevel=3
15399 !! wikitext
15400 == title 1 ==
15401 === title 1.1 ===
15402 ==== title 1.1.1 ====
15403 === title 1.2 ===
15404 == title 2 ==
15405 === title 2.1 ===
15406 !! html
15407 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15408 <ul>
15409 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15410 <ul>
15411 <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>
15412 <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>
15413 </ul>
15414 </li>
15415 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15416 <ul>
15417 <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>
15418 </ul>
15419 </li>
15420 </ul>
15421 </div>
15422
15423 <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>
15424 <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>
15425 <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>
15426 <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>
15427 <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>
15428 <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>
15429
15430 !! end
15431
15432 !! test
15433 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
15434 !! options
15435 wgMaxTocLevel=3
15436 !! wikitext
15437 ==Section 1==
15438 ===Section 1.1===
15439 ====Section 1.1.1====
15440 ====Section 1.1.1.1====
15441 ==Section 2==
15442 !! html
15443 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15444 <ul>
15445 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15446 <ul>
15447 <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>
15448 </ul>
15449 </li>
15450 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15451 </ul>
15452 </div>
15453
15454 <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>
15455 <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>
15456 <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>
15457 <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>
15458 <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>
15459
15460 !! end
15461
15462
15463 !! test
15464 Resolving duplicate section names
15465 !! wikitext
15466 == Foo bar ==
15467 == Foo bar ==
15468 !! html
15469 <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>
15470 <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>
15471
15472 !! end
15473
15474 !! test
15475 Resolving duplicate section names with differing case (bug 10721)
15476 !! wikitext
15477 == Foo bar ==
15478 == Foo Bar ==
15479 !! html
15480 <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>
15481 <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>
15482
15483 !! end
15484
15485 !! article
15486 Template:sections
15487 !! text
15488 ===Section 1===
15489 ==Section 2==
15490 !! endarticle
15491
15492 !! test
15493 Template with sections, __NOTOC__
15494 !! wikitext
15495 __NOTOC__
15496 ==Section 0==
15497 {{sections}}
15498 ==Section 4==
15499 !! html
15500 <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>
15501 <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>
15502 <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>
15503 <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>
15504
15505 !! end
15506
15507 !! test
15508 __NOEDITSECTION__ keyword
15509 !! wikitext
15510 __NOEDITSECTION__
15511 ==Section 1==
15512 ==Section 2==
15513 !! html
15514 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15515 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15516
15517 !! end
15518
15519 !! test
15520 Link inside a section heading
15521 !! wikitext
15522 ==Section with a [[Main Page|link]] in it==
15523 !! html
15524 <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>
15525
15526 !! end
15527
15528 !! test
15529 TOC regression (T14077)
15530 !! wikitext
15531 __TOC__
15532 == title 1 ==
15533 === title 1.1 ===
15534 == title 2 ==
15535 !! html
15536 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15537 <ul>
15538 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15539 <ul>
15540 <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>
15541 </ul>
15542 </li>
15543 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15544 </ul>
15545 </div>
15546
15547 <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>
15548 <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>
15549 <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>
15550
15551 !! end
15552
15553 !! test
15554 BUG 1219 URL next to image (good)
15555 !! wikitext
15556 http://example.com [[File:Foobar.jpg]]
15557 !! html/php
15558 <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>
15559 </p>
15560 !! html/parsoid
15561 <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>
15562 !!end
15563
15564 !! test
15565 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
15566 !! wikitext
15567 ===
15568 The line above must have a trailing space!
15569 === <!--
15570 --> <!-- -->
15571 But just in case it doesn't...
15572 !! html
15573 <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>
15574 <p>The line above must have a trailing space!
15575 </p>
15576 <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>
15577 <p>But just in case it doesn't...
15578 </p>
15579 !! end
15580
15581 !! test
15582 Header with special characters (bug 25462)
15583 !! wikitext
15584 The tooltips shall not show entities to the user (ie. be double escaped)
15585
15586 == text > text ==
15587 section 1
15588
15589 == text < text ==
15590 section 2
15591
15592 == text & text ==
15593 section 3
15594
15595 == text ' text ==
15596 section 4
15597
15598 == text " text ==
15599 section 5
15600 !! html
15601 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15602 </p>
15603 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15604 <ul>
15605 <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>
15606 <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>
15607 <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>
15608 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15609 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15610 </ul>
15611 </div>
15612
15613 <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>
15614 <p>section 1
15615 </p>
15616 <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>
15617 <p>section 2
15618 </p>
15619 <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>
15620 <p>section 3
15621 </p>
15622 <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>
15623 <p>section 4
15624 </p>
15625 <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>
15626 <p>section 5
15627 </p>
15628 !! end
15629
15630 !! test
15631 Header with space, plus and underscore as entity
15632 !! wikitext
15633 Id should not contain + for spaces
15634
15635 == Space between Text ==
15636 section 1
15637
15638 == Space-Entity&#32;between&#32;Text ==
15639 section 2
15640
15641 == Plus+between+Text ==
15642 section 3
15643
15644 == Plus-Entity&#43;between&#43;Text ==
15645 section 4
15646
15647 == Underscore_between_Text ==
15648 section 5
15649
15650 == Underscore-Entity&#95;between&#95;Text ==
15651 section 6
15652
15653 [[#Space between Text]]
15654 [[#Space-Entity&#32;between&#32;Text]]
15655 [[#Plus+between+Text]]
15656 [[#Plus-Entity&#43;between&#43;Text]]
15657 [[#Underscore_between_Text]]
15658 [[#Underscore-Entity&#95;between&#95;Text]]
15659 !! html
15660 <p>Id should not contain + for spaces
15661 </p>
15662 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15663 <ul>
15664 <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>
15665 <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>
15666 <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>
15667 <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>
15668 <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>
15669 <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>
15670 </ul>
15671 </div>
15672
15673 <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>
15674 <p>section 1
15675 </p>
15676 <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>
15677 <p>section 2
15678 </p>
15679 <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>
15680 <p>section 3
15681 </p>
15682 <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>
15683 <p>section 4
15684 </p>
15685 <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>
15686 <p>section 5
15687 </p>
15688 <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>
15689 <p>section 6
15690 </p><p><a href="#Space_between_Text">#Space between Text</a>
15691 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15692 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15693 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15694 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15695 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15696 </p>
15697 !! end
15698
15699 !! test
15700 Headers with excess '=' characters
15701 (Are similar tests necessary beyond the 1st level?)
15702 !! wikitext
15703 =foo==
15704 ==foo=
15705 =''italic'' heading==
15706 ==''italic'' heading=
15707 !! html
15708 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15709 <ul>
15710 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15711 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15712 <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>
15713 <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>
15714 </ul>
15715 </div>
15716
15717 <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>
15718 <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>
15719 <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>
15720 <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>
15721
15722 !! end
15723
15724 !! test
15725 HTML headers vs TOC (bug 23393)
15726 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15727 !! wikitext
15728 <h1>Header 1</h1>
15729 == Header 1.1 ==
15730 == Header 1.2 ==
15731
15732 <h1>Header 2
15733 </h1>
15734 == Header 2.1 ==
15735 == Header 2.2 ==
15736 __NOEDITSECTION__
15737 !! html
15738 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15739 <ul>
15740 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15741 <ul>
15742 <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>
15743 <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>
15744 </ul>
15745 </li>
15746 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15747 <ul>
15748 <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>
15749 <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>
15750 </ul>
15751 </li>
15752 </ul>
15753 </div>
15754
15755 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15756 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15757 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15758 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15759 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15760 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15761
15762 !! end
15763
15764 !! test
15765 Single-line or multiline-comments can follow headings
15766 !! options
15767 parsoid=wt2html,wt2wt
15768 !! wikitext
15769 ==foo==<!---->
15770 ==bar==<!--c1-->
15771 ==baz==<!--
15772 c2
15773 c3-->
15774 !! html
15775 <h2><span class="mw-headline" id="foo">foo</span></h2>
15776 <h2><span class="mw-headline" id="bar">bar</span></h2>
15777 <h2><span class="mw-headline" id="baz">baz</span></h2>
15778
15779 !! end
15780
15781 !! test
15782 BUG 1219 URL next to image (broken)
15783 !! wikitext
15784 http://example.com[[File:Foobar.jpg]]
15785 !! html/php
15786 <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>
15787 </p>
15788 !! html/parsoid
15789 <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>
15790 !!end
15791
15792 !! test
15793 Bug 1186 news: in the middle of text
15794 !! wikitext
15795 http://en.wikinews.org/wiki/Wikinews:Workplace
15796 !! html
15797 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15798 </p>
15799 !!end
15800
15801
15802 !! test
15803 Namespaced link must have a title
15804 !! wikitext
15805 [[Project:]]
15806 !! html
15807 <p>[[Project:]]
15808 </p>
15809 !!end
15810
15811 !! test
15812 Namespaced link must have a title (bad fragment version)
15813 !! wikitext
15814 [[Project:#fragment]]
15815 !! html
15816 <p>[[Project:#fragment]]
15817 </p>
15818 !!end
15819
15820
15821 ###
15822 ### HTML tags and HTML attributes
15823 ###
15824
15825 !! test
15826 div with no attributes
15827 !! wikitext
15828 <div>HTML rocks</div>
15829 !! html
15830 <div>HTML rocks</div>
15831
15832 !! end
15833
15834 !! test
15835 div with double-quoted attribute
15836 !! wikitext
15837 <div id="rock">HTML rocks</div>
15838 !! html
15839 <div id="rock">HTML rocks</div>
15840
15841 !! end
15842
15843 !! test
15844 div with single-quoted attribute
15845 !! wikitext
15846 <div id='rock'>HTML rocks</div>
15847 !! html
15848 <div id="rock">HTML rocks</div>
15849
15850 !! end
15851
15852 !! test
15853 div with unquoted attribute
15854 !! wikitext
15855 <div id=rock>HTML rocks</div>
15856 !! html
15857 <div id="rock">HTML rocks</div>
15858
15859 !! end
15860
15861 !! test
15862 div with illegal double attributes
15863 !! wikitext
15864 <div id="a" id="b">HTML rocks</div>
15865 !! html
15866 <div id="b">HTML rocks</div>
15867
15868 !!end
15869
15870 !! test
15871 div with empty attribute value, space before equals
15872 !! options
15873 parsoid=wt2html,html2html
15874 !! wikitext
15875 <div class =>HTML rocks</div>
15876 !! html/php
15877 <div class="">HTML rocks</div>
15878
15879 !! html/parsoid
15880 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15881 !! end
15882
15883 !! test
15884 div with multiple empty attribute values
15885 !! options
15886 parsoid=wt2html,html2html
15887 !! wikitext
15888 <div id= title=>HTML rocks</div>
15889 !! html/php
15890 <div id="title.3D">HTML rocks</div>
15891
15892 !! html/parsoid
15893 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15894 !! end
15895
15896 !! test
15897 table with multiple empty attribute values
15898 !! options
15899 parsoid=wt2html,html2html
15900 !! wikitext
15901 {| title= id=
15902 | hi
15903 |}
15904 !! html/php
15905 <table title="id=">
15906 <tr>
15907 <td> hi
15908 </td></tr></table>
15909
15910 !! html/parsoid
15911 <table title="id=">
15912 <tbody><tr><td> hi</td></tr>
15913 </tbody></table>
15914 !! end
15915
15916 !! test
15917 div with braces in attribute value
15918 !! wikitext
15919 <div title="{}">Foo</div>
15920 !! html/php
15921 <div title="&#123;}">Foo</div>
15922
15923 !! html/parsoid
15924 <div title="{}">Foo</div>
15925 !! end
15926
15927 !! test
15928 div with empty attribute value, no space before equals
15929 !! options
15930 parsoid=wt2html,html2html
15931 !! wikitext
15932 <div class=>HTML rocks</div>
15933 !! html/php
15934 <div class="">HTML rocks</div>
15935
15936 !! html/parsoid
15937 <div class="">HTML rocks</div>
15938 !! end
15939
15940 !! test
15941 HTML multiple attributes correction
15942 !! wikitext
15943 <p class="error" class="awesome">Awesome!</p>
15944 !! html
15945 <p class="awesome">Awesome!</p>
15946
15947 !!end
15948
15949 !! test
15950 Table multiple attributes correction
15951 !! wikitext
15952 {|
15953 !+ class="error" class="awesome"| status
15954 |}
15955 !! html
15956 <table>
15957 <tr>
15958 <th class="awesome"> status
15959 </th></tr></table>
15960
15961 !!end
15962
15963 !! test
15964 DIV IN UPPERCASE
15965 !! wikitext
15966 <DIV ID="x">HTML ROCKS</DIV>
15967 !! html
15968 <div id="x">HTML ROCKS</div>
15969
15970 !!end
15971
15972 !! test
15973 Non-ASCII pseudo-tags are rendered as text
15974 !! wikitext
15975 <khyô>
15976 !! html
15977 <p>&lt;khyô&gt;
15978 </p>
15979 !! end
15980
15981 !! test
15982 Pseudo-tag with URL 'name' renders as url link
15983 !! wikitext
15984 <http://example.com/>
15985 !! html
15986 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
15987 </p>
15988 !! end
15989
15990 !! test
15991 text with amp in the middle of nowhere
15992 !! wikitext
15993 Remember AT&T?
15994 !! html
15995 <p>Remember AT&amp;T?
15996 </p>
15997 !! end
15998
15999 !! test
16000 text with character entity: eacute
16001 !! wikitext
16002 I always thought &eacute; was a cute letter.
16003 !! html
16004 <p>I always thought &#233; was a cute letter.
16005 </p>
16006 !! html+tidy
16007 <p>I always thought é was a cute letter.</p>
16008 !! end
16009
16010 !! test
16011 text with entity-escaped character entity-like string: eacute
16012 !! wikitext
16013 I always thought &amp;eacute; was a cute letter.
16014 !! html
16015 <p>I always thought &amp;eacute; was a cute letter.
16016 </p>
16017 !! end
16018
16019 !! test
16020 text with undefined character entity: xacute
16021 !! wikitext
16022 I always thought &xacute; was a cute letter.
16023 !! html
16024 <p>I always thought &amp;xacute; was a cute letter.
16025 </p>
16026 !! end
16027
16028 !! test
16029 HTML5 tags
16030 !! wikitext
16031 <data value="5">five</data>
16032 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16033 <mark>This highlighted text</mark>
16034 !! html
16035 <p><data value="5">five</data>
16036 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16037 <mark>This highlighted text</mark>
16038 </p>
16039 !! end
16040
16041 !! test
16042 HTML tag with leading space is parsed as text
16043 !! wikitext
16044 < div>foo< /div>
16045 !! html
16046 <p>&lt; div&gt;foo&lt; /div&gt;
16047 </p>
16048 !! end
16049
16050 ###
16051 ### Nesting tests (see bug 41545, 50604, 51081)
16052 ###
16053
16054 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
16055 # Note that html2wt is considerably more difficult if we use <b> in
16056 # the test case, instead of <big>
16057 !! test
16058 Ensure that HTML adoption agency algorithm is properly implemented.
16059 !! wikitext
16060 <big>X<big>Y</big>Z</big>
16061 !! html
16062 <p><big>X<big>Y</big>Z</big>
16063 </p>
16064 !! end
16065
16066 # This was bug 41545 in the PHP parser.
16067 # Note that tidy doesn't handle this correctly.
16068 !! test
16069 Nesting of <kbd>
16070 !! wikitext
16071 <kbd>X<kbd>Y</kbd>Z</kbd>
16072 !! html
16073 <p><kbd>X<kbd>Y</kbd>Z</kbd>
16074 </p>
16075 !! end
16076
16077 # The following cases were bug 51081 in the PHP parser.
16078 # Note that there are some other nestable tags (b, i, etc) which are
16079 # not covered; see bug 51081 for discussion.
16080
16081 # Note that tidy doesn't handle this correctly.
16082 !! test
16083 Nesting of <em>
16084 !! wikitext
16085 <em>X<em>Y</em>Z</em>
16086 !! html
16087 <p><em>X<em>Y</em>Z</em>
16088 </p>
16089 !! end
16090
16091 # Note that tidy doesn't handle this correctly.
16092 !! test
16093 Nesting of <strong>
16094 !! wikitext
16095 <strong>X<strong>Y</strong>Z</strong>
16096 !! html
16097 <p><strong>X<strong>Y</strong>Z</strong>
16098 </p>
16099 !! end
16100
16101 !! test
16102 Nesting of <q>
16103 !! wikitext
16104 <q>X<q>Y</q>Z</q>
16105 !! html+tidy
16106 <p><q>X<q>Y</q>Z</q></p>
16107 !! end
16108
16109 # Note that tidy doesn't handle this correctly.
16110 !! test
16111 Nesting of <ruby>
16112 !! wikitext
16113 <ruby>X<ruby>Y</ruby>Z</ruby>
16114 !! html
16115 <p><ruby>X<ruby>Y</ruby>Z</ruby>
16116 </p>
16117 !! end
16118
16119 # Note that tidy doesn't handle this correctly.
16120 !! test
16121 Nesting of <bdo>
16122 !! wikitext
16123 <bdo>X<bdo>Y</bdo>Z</bdo>
16124 !! html
16125 <p><bdo>X<bdo>Y</bdo>Z</bdo>
16126 </p>
16127 !! end
16128
16129
16130 ###
16131 ### Media links
16132 ###
16133
16134 !! test
16135 Media link
16136 !! wikitext
16137 [[Media:Foobar.jpg]]
16138 !! html
16139 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
16140 </p>
16141 !! end
16142
16143 !! test
16144 Media link with text
16145 !! wikitext
16146 [[Media:Foobar.jpg|A neat file to look at]]
16147 !! html
16148 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
16149 </p>
16150 !! end
16151
16152 # FIXME: this is still bad HTML tag nesting
16153 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
16154 !! test
16155 Media link with nasty text
16156 !! wikitext
16157 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
16158 !! html
16159 <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>
16160
16161 !! html+tidy
16162 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
16163 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
16164 !! end
16165
16166 !! test
16167 Media link to nonexistent file (bug 1702)
16168 !! wikitext
16169 [[Media:No such.jpg]]
16170 !! html
16171 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
16172 </p>
16173 !! end
16174
16175 !! test
16176 Image link to nonexistent file (bug 1850 - good)
16177 !! wikitext
16178 [[File:No_such.jpg]]
16179 !! html/php
16180 <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>
16181 </p>
16182 !! html/parsoid
16183 <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>
16184 !! end
16185
16186 !! test
16187 :Image link to nonexistent file (bug 1850 - bad)
16188 !! wikitext
16189 [[:Image:No such.jpg]]
16190 !! html/php
16191 <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>
16192 </p>
16193 !! html/parsoid
16194 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
16195 !! end
16196
16197
16198
16199 !! test
16200 Character reference normalization in link text (bug 1938)
16201 !! wikitext
16202 [[Main Page|this&that]]
16203 !! html
16204 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
16205 </p>
16206 !!end
16207
16208 !! article
16209 אַ
16210 !! text
16211 Test for unicode normalization
16212
16213 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
16214 !! endarticle
16215
16216 !! test
16217 (bug 19451) Links should refer to the normalized form.
16218 !! wikitext
16219 [[&#xFB2E;]]
16220 [[&#x5d0;&#x5b7;]]
16221 [[&#x5d0;ַ]]
16222 [[א&#x5b7;]]
16223 [[אַ]]
16224 !! html
16225 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
16226 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
16227 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
16228 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
16229 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
16230 </p>
16231 !! end
16232
16233 !! test
16234 Empty attribute crash test (bug 2067)
16235 !! wikitext
16236 <font color="">foo</font>
16237 !! html
16238 <p><font color="">foo</font>
16239 </p>
16240 !! end
16241
16242 !! test
16243 Empty attribute crash test single-quotes (bug 2067)
16244 !! wikitext
16245 <font color=''>foo</font>
16246 !! html
16247 <p><font color="">foo</font>
16248 </p>
16249 !! end
16250
16251 !! test
16252 Attribute test: equals, then nothing
16253 !! options
16254 parsoid=wt2html,html2html
16255 !! wikitext
16256 <font color=>foo</font>
16257 !! html/php
16258 <p><font color="">foo</font>
16259 </p>
16260 !! html/parsoid
16261 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
16262 !! end
16263
16264 !! test
16265 Attribute test: unquoted value
16266 !! options
16267 parsoid=wt2html,html2html
16268 !! wikitext
16269 <font color=x>foo</font>
16270 !! html/php
16271 <p><font color="x">foo</font>
16272 </p>
16273 !! html/parsoid
16274 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
16275 !! end
16276
16277 !! test
16278 Attribute test: unquoted but illegal value (hash)
16279 !! wikitext
16280 <font color=#x>foo</font>
16281 !! html
16282 <p><font color="#x">foo</font>
16283 </p>
16284 !! end
16285
16286 # Parsoid does not serialize to empty attribute syntax,
16287 # so wt2wt and html2wt cases are skipped
16288 !! test
16289 Attribute test: no value (T54330)
16290 !! options
16291 parsoid=wt2html,html2html
16292 !! wikitext
16293 <font color>foo</font>
16294 !! html/php
16295 <p><font color="">foo</font>
16296 </p>
16297 !! html/parsoid
16298 <p><font color="">foo</font></p>
16299 !! end
16300
16301 !! test
16302 Bug 2095: link with three closing brackets
16303 !! wikitext
16304 [[Main Page]]]
16305 !! html/php
16306 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
16307 </p>
16308 !! html/parsoid
16309 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
16310 !! end
16311
16312 !! test
16313 Bug 2095: link with pipe and three closing brackets
16314 !! wikitext
16315 [[Main Page|link]]]
16316 !! html/php
16317 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
16318 </p>
16319 !! html/parsoid
16320 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
16321 !! end
16322
16323 !! test
16324 Bug 2095: link with pipe and three closing brackets, version 2
16325 !! wikitext
16326 [[Main Page|[http://example.com/]]]
16327 !! html/php
16328 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
16329 </p>
16330 !! html/parsoid
16331 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
16332 !! end
16333
16334
16335 ###
16336 ### Safety
16337 ###
16338
16339 !! article
16340 Template:Dangerous attribute
16341 !! text
16342 " onmouseover="alert(document.cookie)
16343 !! endarticle
16344
16345 !! article
16346 Template:Dangerous style attribute
16347 !! text
16348 border-size: expression(alert(document.cookie))
16349 !! endarticle
16350
16351 !! article
16352 Template:Div style
16353 !! text
16354 <div style="float: right; {{{1}}}">Magic div</div>
16355 !! endarticle
16356
16357 !! test
16358 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
16359 !! wikitext
16360 <div title="{{test}}"></div>
16361 !! html
16362 <div title="This is a test template"></div>
16363
16364 !! end
16365
16366 # Parsoid has enough context to handle this case
16367 !! test
16368 Bug 2304: HTML attribute safety (dangerous template; 2309)
16369 !! wikitext
16370 <div title="{{dangerous attribute}}"></div>
16371 !! html/php
16372 <div title=""></div>
16373
16374 !! html/parsoid
16375 <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>
16376 !! end
16377
16378 !! test
16379 Bug 2304: HTML attribute safety (dangerous style template; 2309)
16380 !! wikitext
16381 <div style="{{dangerous style attribute}}"></div>
16382 !! html
16383 <div style="/* insecure input */"></div>
16384
16385 !! end
16386
16387 !! test
16388 Bug 2304: HTML attribute safety (safe parameter; 2309)
16389 !! wikitext
16390 {{div style|width: 200px}}
16391 !! html
16392 <div style="float: right; width: 200px">Magic div</div>
16393
16394 !! end
16395
16396 !! test
16397 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
16398 !! wikitext
16399 {{div style|width: expression(alert(document.cookie))}}
16400 !! html
16401 <div style="/* insecure input */">Magic div</div>
16402
16403 !! end
16404
16405 !! test
16406 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
16407 !! wikitext
16408 {{div style|"><script>alert(document.cookie)</script>}}
16409 !! html
16410 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16411
16412 !! end
16413
16414 !! test
16415 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
16416 !! wikitext
16417 {{div style|" ><script>alert(document.cookie)</script>}}
16418 !! html
16419 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16420
16421 !! end
16422
16423 !! test
16424 Bug 2304: HTML attribute safety (link)
16425 !! wikitext
16426 <div title="[[Main Page]]"></div>
16427 !! html
16428 <div title="&#91;&#91;Main Page]]"></div>
16429
16430 !! end
16431
16432 !! test
16433 Bug 2304: HTML attribute safety (italics)
16434 !! wikitext
16435 <div title="''foobar''"></div>
16436 !! html
16437 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16438
16439 !! end
16440
16441 !! test
16442 Bug 2304: HTML attribute safety (bold)
16443 !! wikitext
16444 <div title="'''foobar'''"></div>
16445 !! html
16446 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16447
16448 !! end
16449
16450
16451 !! test
16452 Bug 2304: HTML attribute safety (ISBN)
16453 !! wikitext
16454 <div title="ISBN 1234567890"></div>
16455 !! html
16456 <div title="&#73;SBN 1234567890"></div>
16457
16458 !! end
16459
16460 !! test
16461 Bug 2304: HTML attribute safety (RFC)
16462 !! wikitext
16463 <div title="RFC 1234"></div>
16464 !! html
16465 <div title="&#82;FC 1234"></div>
16466
16467 !! end
16468
16469 !! test
16470 Bug 2304: HTML attribute safety (PMID)
16471 !! wikitext
16472 <div title="PMID 1234567890"></div>
16473 !! html
16474 <div title="&#80;MID 1234567890"></div>
16475
16476 !! end
16477
16478 !! test
16479 Bug 2304: HTML attribute safety (web link)
16480 !! wikitext
16481 <div title="http://example.com/"></div>
16482 !! html
16483 <div title="http&#58;//example.com/"></div>
16484
16485 !! end
16486
16487 !! test
16488 Bug 2304: HTML attribute safety (named web link)
16489 !! wikitext
16490 <div title="[http://example.com/ link]"></div>
16491 !! html
16492 <div title="&#91;http&#58;//example.com/ link]"></div>
16493
16494 !! end
16495
16496 !! test
16497 Bug 3244: HTML attribute safety (extension; safe)
16498 !! wikitext
16499 <div style="<nowiki>background:blue</nowiki>"></div>
16500 !! html
16501 <div style="background:blue"></div>
16502
16503 !! end
16504
16505 !! test
16506 Bug 3244: HTML attribute safety (extension; unsafe)
16507 !! wikitext
16508 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16509 !! html
16510 <div style="/* insecure input */"></div>
16511
16512 !! end
16513
16514 # More MSIE fun discovered by Tom Gilder
16515
16516 !! test
16517 MSIE CSS safety test: spurious slash
16518 !! wikitext
16519 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16520 !! html
16521 <div style="/* insecure input */">evil</div>
16522
16523 !! end
16524
16525 !! test
16526 MSIE CSS safety test: hex code
16527 !! wikitext
16528 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16529 !! html
16530 <div style="/* insecure input */">evil</div>
16531
16532 !! end
16533
16534 !! test
16535 MSIE CSS safety test: comment in url
16536 !! wikitext
16537 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16538 !! html
16539 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16540
16541 !! end
16542
16543 !! test
16544 MSIE CSS safety test: comment in expression
16545 !! wikitext
16546 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16547 !! html
16548 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16549
16550 !! end
16551
16552 !! test
16553 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
16554 !! wikitext
16555 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16556 !! html
16557 <p style="/* invalid control char */">A</p>
16558
16559 !! end
16560
16561 !! test
16562 MSIE 6 CSS safety test: Fullwidth (bug 55332)
16563 !! wikitext
16564 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16565 <div style="top:EXPRESSION(alert())">B</div>
16566 !! html
16567 <p style="/* insecure input */">A</p>
16568 <div style="/* insecure input */">B</div>
16569
16570 !! end
16571
16572 !! test
16573 MSIE 6 CSS safety test: IPA extensions (bug 55332)
16574 !! wikitext
16575 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16576 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16577 !! html
16578 <div style="/* insecure input */">A</div>
16579 <p style="/* insecure input */">B</p>
16580
16581 !! end
16582
16583 !! test
16584 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16585 !! wikitext
16586 <div style="background-image:url⁽javascript:alert())">A</div>
16587 <div style="background-image:url₍javascript:alert())">B</div>
16588 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16589 !! html
16590 <div style="/* insecure input */">A</div>
16591 <div style="/* insecure input */">B</div>
16592 <p style="/* insecure input */">C</p>
16593
16594 !! end
16595
16596 # FIXME: Parsoid fails to sanitize this! See T58846.
16597 !! test
16598 Opera -o-link CSS
16599 !! wikitext
16600 <div
16601 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;"
16602 style="-o-link:attr(title);-o-link-source:current">X</div>
16603 !! html
16604 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16605
16606 !! end
16607
16608 !! test
16609 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16610 !! wikitext
16611 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16612 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16613 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16614 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16615 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16616 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16617 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16618 !! html
16619 <p style="/* insecure input */">A</p>
16620 <p style="/* insecure input */">B</p>
16621 <p style="/* insecure input */">C</p>
16622 <p style="/* insecure input */">D</p>
16623 <p style="/* insecure input */">E</p>
16624 <p style="/* insecure input */">F</p>
16625 <p style="/* insecure input */">G</p>
16626
16627 !! end
16628
16629 !! test
16630 Table attribute legitimate extension
16631 !! wikitext
16632 {|
16633 !+ style="<nowiki>color:blue</nowiki>"| status
16634 |}
16635 !! html
16636 <table>
16637 <tr>
16638 <th style="color:blue"> status
16639 </th></tr></table>
16640
16641 !!end
16642
16643 !! test
16644 Table attribute safety
16645 !! wikitext
16646 {|
16647 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16648 |}
16649 !! html
16650 <table>
16651 <tr>
16652 <th style="/* insecure input */"> status
16653 </th></tr></table>
16654
16655 !! end
16656
16657 !! test
16658 CSS line continuation 1
16659 !! wikitext
16660 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16661 !! html
16662 <div style="/* insecure input */"></div>
16663
16664 !! end
16665
16666 !! test
16667 CSS line continuation 2
16668 !! wikitext
16669 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16670 !! html
16671 <div style="/* invalid control char */"></div>
16672
16673 !! end
16674
16675 !! article
16676 Template:Identity
16677 !! text
16678 {{{1}}}
16679 !! endarticle
16680
16681 !! test
16682 Expansion of multi-line templates in attribute values (bug 6255)
16683 !! wikitext
16684 <div style="background: {{identity|#00FF00}}">-</div>
16685 !! html
16686 <div style="background: #00FF00">-</div>
16687
16688 !! end
16689
16690
16691 !! test
16692 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16693 !! wikitext
16694 <div style="background:
16695 #00FF00">-</div>
16696 !! html/php
16697 <div style="background: #00FF00">-</div>
16698
16699 !! html/parsoid
16700 <div style="background:
16701 #00FF00">-</div>
16702 !! end
16703
16704 !! test
16705 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16706 !! wikitext
16707 <div style="background: &#10;#00FF00">-</div>
16708 !! html
16709 <div style="background: &#10;#00FF00">-</div>
16710
16711 !! end
16712
16713 !! test
16714 Tags which are hidden from Tidy cannot pass through the Sanitizer
16715 !! wikitext
16716 <mw:toc><script>alert();</script></mw:toc>
16717 !! html+tidy
16718 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;</p>
16719 !! end
16720
16721 ###
16722 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16723 ###
16724 !! test
16725 Parser hook: empty input
16726 !! wikitext
16727 <tag></tag>
16728 !! html/php
16729 <pre>
16730 ''
16731 array (
16732 )
16733 </pre>
16734
16735 !! html/parsoid
16736 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16737 !! end
16738
16739 ## Don't expect parsoid to rt this form.
16740 !! test
16741 Parser hook: empty input using terminated empty elements
16742 !! options
16743 parsoid=wt2html,html2html
16744 !! wikitext
16745 <tag/>
16746 !! html/php
16747 <pre>
16748 NULL
16749 array (
16750 )
16751 </pre>
16752
16753 !! html/parsoid
16754 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16755 !! end
16756
16757 !! test
16758 Parser hook: empty input using terminated empty elements (space before)
16759 !! wikitext
16760 <tag />
16761 !! html/php
16762 <pre>
16763 NULL
16764 array (
16765 )
16766 </pre>
16767
16768 !! html/parsoid
16769 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16770 !! end
16771
16772 !! test
16773 Parser hook: basic input
16774 !! wikitext
16775 <tag>input</tag>
16776 !! html/php
16777 <pre>
16778 'input'
16779 array (
16780 )
16781 </pre>
16782
16783 !! html/parsoid
16784 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16785 !! end
16786
16787 ## Don't expect parsoid to rt this form.
16788 !! test
16789 Parser hook: case insensitive
16790 !! options
16791 parsoid=wt2html,html2html
16792 !! wikitext
16793 <TAG>input</TAG>
16794 !! html/php
16795 <pre>
16796 'input'
16797 array (
16798 )
16799 </pre>
16800
16801 !! html/parsoid
16802 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16803 !! end
16804
16805 ## Don't expect parsoid to rt this form.
16806 !! test
16807 Parser hook: case insensitive, redux
16808 !! options
16809 parsoid=wt2html,html2html
16810 !! wikitext
16811 <TaG>input</TAg>
16812 !! html/php
16813 <pre>
16814 'input'
16815 array (
16816 )
16817 </pre>
16818
16819 !! html/parsoid
16820 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16821 !! end
16822
16823 !! test
16824 Parser hook: nested tags
16825 !! wikitext
16826 <tag><tag></tag></tag>
16827 !! html/php
16828 <pre>
16829 '<tag>'
16830 array (
16831 )
16832 </pre>&lt;/tag&gt;
16833
16834 !! html/parsoid
16835 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
16836 !! end
16837
16838 !! test
16839 Parser hook: basic arguments
16840 !! wikitext
16841 <tag width="200" height="100" depth="50" square=""></tag>
16842 !! html/php
16843 <pre>
16844 ''
16845 array (
16846 'width' => '200',
16847 'height' => '100',
16848 'depth' => '50',
16849 'square' => '',
16850 )
16851 </pre>
16852
16853 !! html/parsoid
16854 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16855 !! end
16856
16857 ## Don't expect parsoid to rt this form.
16858 !! test
16859 Parser hook: basic arguments, variations
16860 !! options
16861 parsoid=wt2html,html2html
16862 !! wikitext
16863 <tag width=200 height = "100" depth = '50' square></tag>
16864 !! html/php
16865 <pre>
16866 ''
16867 array (
16868 'width' => '200',
16869 'height' => '100',
16870 'depth' => '50',
16871 'square' => '',
16872 )
16873 </pre>
16874
16875 !! html/parsoid
16876 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16877 !! end
16878
16879 !! test
16880 Parser hook: argument containing a forward slash (bug 5344)
16881 !! wikitext
16882 <tag filename="/tmp/bla"></tag>
16883 !! html/php
16884 <pre>
16885 ''
16886 array (
16887 'filename' => '/tmp/bla',
16888 )
16889 </pre>
16890
16891 !! html/parsoid
16892 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16893 !! end
16894
16895 ## Don't expect parsoid to rt this form.
16896 !! test
16897 Parser hook: empty input using terminated empty elements (bug 2374)
16898 !! options
16899 parsoid=wt2html,html2html
16900 !! wikitext
16901 <tag foo=bar/>text
16902 !! html/php
16903 <pre>
16904 NULL
16905 array (
16906 'foo' => 'bar',
16907 )
16908 </pre>text
16909
16910 !! html/parsoid
16911 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
16912 !! end
16913
16914 ## </tag> should be output literally since there is no matching tag that begins it
16915 ## Don't expect parsoid to rt this form.
16916 !! test
16917 Parser hook: basic arguments using terminated empty elements (bug 2374)
16918 !! options
16919 parsoid=wt2html
16920 !! wikitext
16921 <tag width=200 height = "100" depth = '50' square/>
16922 other stuff
16923 </tag>
16924 !! html/php
16925 <pre>
16926 NULL
16927 array (
16928 'width' => '200',
16929 'height' => '100',
16930 'depth' => '50',
16931 'square' => '',
16932 )
16933 </pre>
16934 <p>other stuff
16935 &lt;/tag&gt;
16936 </p>
16937 !! html/parsoid
16938 <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
16939 &lt;/tag></p>
16940 !! end
16941
16942 ## Don't expect parsoid to rt this form.
16943 !! test
16944 Parser hook: Don't allow unclosed extension tags
16945 !! options
16946 parsoid=wt2html
16947 !! wikitext
16948 test <tag>123
16949
16950 this is a '''test'''
16951 !! html/php
16952 <p>test &lt;tag&gt;123
16953 </p><p>this is a <b>test</b>
16954 </p>
16955 !! html/parsoid
16956 <p>test &lt;tag>123</p>
16957
16958 <p>this is a <b>test</b></p>
16959 !! end
16960
16961 ###
16962 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
16963 ###
16964
16965 !! test
16966 Parser hook: static parser hook not inside a comment
16967 !! wikitext
16968 <statictag>hello, world</statictag>
16969
16970 <statictag action="flush" />
16971 !! html/php
16972 <p><br />
16973 hello, world
16974 </p>
16975 !! html/parsoid
16976 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
16977 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
16978 !! end
16979
16980 !! test
16981 Parser hook: static parser hook inside a comment
16982 !! wikitext
16983 <!-- <statictag>hello, world</statictag> -->
16984 <statictag action="flush" />
16985 !! html/php
16986 <p><br />
16987 </p>
16988 !! html/parsoid
16989 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
16990 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
16991 !! end
16992
16993 # Nested template calls; this case was broken by Parser.php rev 1.506,
16994 # since reverted.
16995
16996 !! article
16997 Template:One-parameter
16998 !! text
16999 (My parameter is: {{{1}}})
17000 !! endarticle
17001
17002 !! article
17003 Template:Map-one-parameter
17004 !! text
17005 {{{{{1}}}|{{{2}}}}}
17006 !! endarticle
17007
17008 !! test
17009 Nested template calls
17010 !! wikitext
17011 {{Map-one-parameter|One-parameter|param}}
17012 !! html
17013 <p>(My parameter is: param)
17014 </p>
17015 !! end
17016
17017
17018 ###
17019 ### Sanitizer
17020 ###
17021
17022 # HTML+Tidy effectively strips out the empty tags completely
17023 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
17024 # which Tidy would have done for the PHP parser had there been content inside it.
17025 !! test
17026 Sanitizer: Closing of open tags
17027 !! wikitext
17028 <s></s><table></table>
17029 !! html
17030 <s></s><table></table>
17031
17032 !! html/parsoid
17033 <p><s></s></p><table></table>
17034 !! end
17035
17036 !! test
17037 Sanitizer: Closing of open but not closed tags
17038 !! wikitext
17039 <s>foo
17040 !! html
17041 <p><s>foo</s>
17042 </p>
17043 !! end
17044
17045 !! test
17046 Sanitizer: Closing of closed but not open tags
17047 !! options
17048 parsoid=wt2html
17049 !! wikitext
17050 </s>
17051 !! html/php+tidy
17052 !! html/parsoid
17053 !! end
17054
17055 !! test
17056 Sanitizer: Closing of closed but not open table tags
17057 !! options
17058 parsoid=wt2html
17059 !! wikitext
17060 Table not started</td></tr></table>
17061 !! html/php+tidy
17062 <p>Table not started</p>
17063 !! html/parsoid
17064 <p>Table not started</p>
17065 !! end
17066
17067 !! test
17068 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
17069 !! wikitext
17070 <span id="æ: v">byte</span>[[#æ: v|backlink]]
17071 !! html
17072 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
17073 </p>
17074 !! end
17075
17076 # In HTML5, the restrictions are that id must contain at least one character,
17077 # and must not contain any space characters.
17078 !! test
17079 Sanitizer: Validating the contents of the id attribute (bug 4515)
17080 !! options
17081 disabled
17082 !! wikitext
17083 <br id="" /><br id="a space" />
17084 !! html
17085 Something ...
17086 !! end
17087
17088 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
17089 !! test
17090 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
17091 !! options
17092 disabled
17093 !! wikitext
17094 <br id="foo" /><br id="foo" />
17095 !! html
17096 Something need to be done. foo-2 ?
17097 !! end
17098
17099 !! test
17100 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
17101 !! wikitext
17102 <div itemscope>
17103 <meta itemprop="hello" content="world">
17104 <meta http-equiv="refresh" content="5">
17105 <meta itemprop="hello" http-equiv="refresh" content="5">
17106 <link itemprop="hello" href="{{SERVER}}">
17107 <link rel="stylesheet" href="{{SERVER}}">
17108 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
17109 </div>
17110 !! html
17111 <div itemscope="">
17112 <p> <meta itemprop="hello" content="world" />
17113 &lt;meta http-equiv="refresh" content="5"&gt;
17114 <meta itemprop="hello" content="5" />
17115 </p>
17116 <link itemprop="hello" href="http&#58;//example.org" />
17117 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
17118 <link itemprop="hello" href="http&#58;//example.org" />
17119 </div>
17120
17121 !! end
17122
17123 !! test
17124 Language converter: output gets cut off unexpectedly (bug 5757)
17125 !! options
17126 language=zh
17127 !! wikitext
17128 this bit is safe: }-
17129
17130 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
17131
17132 then we get cut off here: }-
17133
17134 all additional text is vanished
17135 !! html
17136 <p>this bit is safe: }-
17137 </p><p>but if we add a conversion instance: xxx
17138 </p><p>then we get cut off here: }-
17139 </p><p>all additional text is vanished
17140 </p>
17141 !! end
17142
17143 !! test
17144 Self closed html pairs (bug 5487)
17145 !! options
17146 !! wikitext
17147 <center><font id="bug" />Centered text</center>
17148 <div><font id="bug2" />In div text</div>
17149 !! html
17150 <center>&lt;font id="bug" /&gt;Centered text</center>
17151 <div>&lt;font id="bug2" /&gt;In div text</div>
17152
17153 !! end
17154
17155 #
17156 #
17157 #
17158
17159 !! test
17160 Punctuation: nbsp before exclamation
17161 !! wikitext
17162 C'est grave !
17163 !! html
17164 <p>C'est grave&#160;!
17165 </p>
17166 !! end
17167
17168 !! test
17169 Punctuation: CSS !important (bug 11874)
17170 !! wikitext
17171 <div style="width:50% !important">important</div>
17172 !! html
17173 <div style="width:50% !important">important</div>
17174
17175 !!end
17176
17177 !! test
17178 Punctuation: CSS ! important (bug 11874; with space after)
17179 !! wikitext
17180 <div style="width:50% ! important">important</div>
17181 !! html
17182 <div style="width:50% ! important">important</div>
17183
17184 !!end
17185
17186 !! test
17187 HTML bullet list, closed tags (bug 5497)
17188 !! wikitext
17189 <ul>
17190 <li>One</li>
17191 <li>Two</li>
17192 </ul>
17193 !! html/php
17194 <ul>
17195 <li>One</li>
17196 <li>Two</li>
17197 </ul>
17198
17199 !! html/parsoid
17200 <ul data-parsoid='{"stx":"html"}'>
17201 <li data-parsoid='{"stx":"html"}'>One</li>
17202 <li data-parsoid='{"stx":"html"}'>Two</li>
17203 </ul>
17204
17205 !! end
17206
17207 !! test
17208 HTML bullet list, unclosed tags (bug 5497)
17209 !! wikitext
17210 <ul>
17211 <li>One
17212 <li>Two
17213 </ul>
17214 !! html/php+tidy
17215 <ul>
17216 <li>One</li>
17217 <li>Two</li>
17218 </ul>
17219 !! html/parsoid
17220 <ul data-parsoid='{"stx":"html"}'>
17221 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17222 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17223 </ul>
17224
17225 !! end
17226
17227 !! test
17228 HTML ordered list, closed tags (bug 5497)
17229 !! wikitext
17230 <ol>
17231 <li>One</li>
17232 <li>Two</li>
17233 </ol>
17234 !! html/php
17235 <ol>
17236 <li>One</li>
17237 <li>Two</li>
17238 </ol>
17239
17240 !! html/parsoid
17241 <ol data-parsoid='{"stx":"html"}'>
17242 <li data-parsoid='{"stx":"html"}'>One</li>
17243 <li data-parsoid='{"stx":"html"}'>Two</li>
17244 </ol>
17245
17246 !! end
17247
17248 !! test
17249 HTML ordered list, unclosed tags (bug 5497)
17250 !! options
17251 !! wikitext
17252 <ol>
17253 <li>One
17254 <li>Two
17255 </ol>
17256 !! html/php+tidy
17257 <ol>
17258 <li>One</li>
17259 <li>Two</li>
17260 </ol>
17261 !! html/parsoid
17262 <ol data-parsoid='{"stx":"html"}'>
17263 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17264 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17265 </ol>
17266
17267 !! end
17268
17269 !! test
17270 HTML nested bullet list, closed tags (bug 5497)
17271 !! wikitext
17272 <ul>
17273 <li>One</li>
17274 <li>Two:
17275 <ul>
17276 <li>Sub-one</li>
17277 <li>Sub-two</li>
17278 </ul>
17279 </li>
17280 </ul>
17281 !! html/php
17282 <ul>
17283 <li>One</li>
17284 <li>Two:
17285 <ul>
17286 <li>Sub-one</li>
17287 <li>Sub-two</li>
17288 </ul>
17289 </li>
17290 </ul>
17291
17292 !! html/parsoid
17293 <ul data-parsoid='{"stx":"html"}'>
17294 <li data-parsoid='{"stx":"html"}'>One</li>
17295 <li data-parsoid='{"stx":"html"}'>Two:
17296 <ul data-parsoid='{"stx":"html"}'>
17297 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
17298 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
17299 </ul>
17300 </li>
17301 </ul>
17302 !! end
17303
17304 !! test
17305 HTML nested bullet list, open tags (bug 5497)
17306 !! wikitext
17307 <ul>
17308 <li>One
17309 <li>Two:
17310 <ul>
17311 <li>Sub-one
17312 <li>Sub-two
17313 </ul>
17314 </ul>
17315 !! html/php+tidy
17316 <ul>
17317 <li>One</li>
17318 <li>Two:
17319 <ul>
17320 <li>Sub-one</li>
17321 <li>Sub-two</li>
17322 </ul>
17323 </li>
17324 </ul>
17325 !! html/parsoid
17326 <ul>
17327 <li>One
17328 </li>
17329 <li>Two:
17330 <ul>
17331 <li>Sub-one
17332 </li>
17333 <li>Sub-two
17334 </li>
17335 </ul>
17336 </li>
17337 </ul>
17338
17339 !! end
17340
17341 !! test
17342 HTML nested ordered list, closed tags (bug 5497)
17343 !! wikitext
17344 <ol>
17345 <li>One</li>
17346 <li>Two:
17347 <ol>
17348 <li>Sub-one</li>
17349 <li>Sub-two</li>
17350 </ol>
17351 </li>
17352 </ol>
17353 !! html
17354 <ol>
17355 <li>One</li>
17356 <li>Two:
17357 <ol>
17358 <li>Sub-one</li>
17359 <li>Sub-two</li>
17360 </ol>
17361 </li>
17362 </ol>
17363
17364 !! end
17365
17366 !! test
17367 HTML nested ordered list, open tags (bug 5497)
17368 !! wikitext
17369 <ol>
17370 <li>One
17371 <li>Two:
17372 <ol>
17373 <li>Sub-one
17374 <li>Sub-two
17375 </ol>
17376 </ol>
17377 !! html/php
17378 <ol>
17379 <li>One
17380 <li>Two:
17381 <ol>
17382 <li>Sub-one
17383 <li>Sub-two
17384 </ol>
17385 </ol>
17386
17387 !! html/parsoid
17388 <ol>
17389 <li>One
17390 </li>
17391 <li>Two:
17392 <ol>
17393 <li>Sub-one
17394 </li>
17395 <li>Sub-two
17396 </li>
17397 </ol>
17398 </li>
17399 </ol>
17400
17401 !! end
17402
17403 !! test
17404 HTML ordered list item with parameters oddity
17405 !! wikitext
17406 <ol><li id="fragment">One</li>
17407 </ol>
17408 !! html
17409 <ol><li id="fragment">One</li>
17410 </ol>
17411
17412 !! end
17413
17414 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
17415 !!test
17416 bug 5918: autonumbering
17417 !! wikitext
17418 [http://first/] [http://second] [ftp://ftp]
17419
17420 ftp://inlineftp
17421
17422 [mailto:enclosed@mail.tld With target]
17423
17424 [mailto:enclosed@mail.tld]
17425
17426 mailto:inline@mail.tld
17427 !! html/php
17428 <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>
17429 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
17430 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
17431 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
17432 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
17433 </p>
17434 !! html/parsoid
17435 <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>
17436 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
17437 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
17438 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
17439 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
17440 !! end
17441
17442
17443 #
17444 # Security and HTML correctness
17445 # From Nick Jenkins' fuzz testing
17446 #
17447
17448 !! test
17449 Fuzz testing: Parser13
17450 !! wikitext
17451 {|
17452 | http://a|
17453 !! html
17454 <table>
17455 <tr>
17456 <td>
17457 </td>
17458 </tr>
17459 </table>
17460
17461 !! end
17462
17463 !! test
17464 Fuzz testing: Parser14
17465 !! wikitext
17466 == onmouseover= ==
17467 http://__TOC__
17468 !! html
17469 <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>
17470 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17471 <ul>
17472 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17473 </ul>
17474 </div>
17475
17476
17477 !! html+tidy
17478 <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>
17479 <p>http://</p>
17480 <div id="toc" class="toc">
17481 <div id="toctitle">
17482 <h2>Contents</h2>
17483 </div>
17484 <ul>
17485 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17486 </ul>
17487 </div>
17488 <p></p>
17489 !! end
17490
17491 !! test
17492 Fuzz testing: Parser14-table
17493 !! options
17494 parsoid=wt2html,html2html
17495 !! wikitext
17496 ==a==
17497 {| STYLE=__TOC__
17498 !! html
17499 <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>
17500 <table style="&#95;_TOC&#95;_">
17501 <tr><td></td></tr>
17502 </table>
17503
17504 !! html+tidy
17505 <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>
17506 <table style="__TOC__">
17507 <tr>
17508 <td></td>
17509 </tr>
17510 </table>
17511 !! html/parsoid
17512 <h2>a</h2>
17513 <table style="__TOC__"></table>
17514 !! end
17515
17516 # Known to produce bogus xml (extra </td>)
17517 !! test
17518 Fuzz testing: Parser16
17519 !! wikitext
17520 {|
17521 !https://||||||
17522 !! html
17523 <table>
17524 <tr>
17525 <th>https://</th>
17526 <th></th>
17527 <th></th>
17528 <th>
17529 </td>
17530 </tr>
17531 </table>
17532
17533 !! html+tidy
17534 <table>
17535 <tr>
17536 <th>https://</th>
17537 <th></th>
17538 <th></th>
17539 <th></th>
17540 </tr>
17541 </table>
17542 !! end
17543
17544 !! test
17545 Fuzz testing: Parser21
17546 !! wikitext
17547 {|
17548 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17549 |
17550 !! html
17551 <table>
17552 <tr>
17553 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17554 </th>
17555 <td>
17556 </td>
17557 </tr>
17558 </table>
17559
17560 !! end
17561
17562 !! test
17563 Fuzz testing: Parser22
17564 !! wikitext
17565 http://===r:::https://b
17566
17567 {|
17568 !! html
17569 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17570 </p>
17571 <table>
17572 <tr><td></td></tr>
17573 </table>
17574
17575 !! end
17576
17577 # Known to produce bad XML for now
17578 !! test
17579 Fuzz testing: Parser24
17580 !! wikitext
17581 {|
17582 {{{|
17583 <u CLASS=
17584 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17585 <br style="onmouseover='alert(document.cookie);' " />
17586
17587 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17588 |
17589 !! html
17590 <table>
17591 {{{|
17592 <u class="&#124;">}}}} &gt;
17593 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17594
17595 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17596 <tr>
17597 <td></u>
17598 </td>
17599 </tr>
17600 </table>
17601
17602 !! end
17603
17604 # Note: the current result listed for this is not what the original one was,
17605 # but the original bug was JavaScript injection, which is fixed in any case.
17606 # It's not clear that the original result listed was any more correct than the
17607 # current one. Original result:
17608 # <p>{{{|
17609 # </p>
17610 # <li class="&#124;&#124;">
17611 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17612 !!test
17613 Fuzz testing: Parser25 (bug 6055)
17614 !! wikitext
17615 {{{
17616 |
17617 <LI CLASS=||
17618 >
17619 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17620 !! html
17621 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17622 </p>
17623 !! end
17624
17625 !!test
17626 Fuzz testing: URL adjacent extension (with space, clean)
17627 !! wikitext
17628 http://example.com <nowiki>junk</nowiki>
17629 !! html/php
17630 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17631 </p>
17632 !! html/parsoid
17633 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17634 !! end
17635
17636 !!test
17637 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17638 !! wikitext
17639 http://example.com<nowiki>junk</nowiki>
17640 !! html/php
17641 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17642 </p>
17643 !! html/parsoid
17644 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17645 !! end
17646
17647 !!test
17648 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17649 !! wikitext
17650 http://example.com<pre>junk</pre>
17651 !! html/php
17652 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17653
17654 !! html/php+tidy
17655 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17656 <pre>
17657 junk
17658 </pre>
17659 !! html/parsoid
17660 <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>
17661 !!end
17662
17663 !!test
17664 Fuzz testing: image with bogus manual thumbnail
17665 !! wikitext
17666 [[Image:foobar.jpg|thumbnail= ]]
17667 !! html/php
17668 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17669
17670 !! html/parsoid
17671 <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>
17672 !!end
17673
17674 !! test
17675 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17676 !! wikitext
17677 <pre dir="&#10;"></pre>
17678 !! html
17679 <pre dir="&#10;"></pre>
17680
17681 !! end
17682
17683 !! test
17684 Parsing optional HTML elements (Bug 6171)
17685 !! options
17686 !! wikitext
17687 <table>
17688 <tr>
17689 <td> Some tabular data</td>
17690 <td> More tabular data ...
17691 <td> And yet som tabular data</td>
17692 </tr>
17693 </table>
17694 !! html
17695 <table>
17696 <tr>
17697 <td> Some tabular data</td>
17698 <td> More tabular data ...
17699 </td><td> And yet som tabular data</td>
17700 </tr>
17701 </table>
17702
17703 !! end
17704
17705 !! test
17706 Correct handling of <td>, <tr> (Bug 6171)
17707 !! options
17708 !! wikitext
17709 <table>
17710 <tr>
17711 <td> Some tabular data</td>
17712 <td> More tabular data ...</td>
17713 <td> And yet som tabular data</td>
17714 </tr>
17715 </table>
17716 !! html
17717 <table>
17718 <tr>
17719 <td> Some tabular data</td>
17720 <td> More tabular data ...</td>
17721 <td> And yet som tabular data</td>
17722 </tr>
17723 </table>
17724
17725 !! end
17726
17727
17728 !! test
17729 Parsing crashing regression (fr:JavaScript)
17730 !! wikitext
17731 </body></x>
17732 !! html
17733 <p>&lt;/body&gt;&lt;/x&gt;
17734 </p>
17735 !! end
17736
17737 !! test
17738 Inline wiki vs wiki block nesting
17739 !! wikitext
17740 '''Bold paragraph
17741
17742 New wiki paragraph
17743 !! html
17744 <p><b>Bold paragraph</b>
17745 </p><p>New wiki paragraph
17746 </p>
17747 !! end
17748
17749 # FIXME: The current php output is documented
17750 # and desired output is the parsoid target.
17751 !! test
17752 Inline HTML vs wiki block nesting
17753 !! wikitext
17754 <b>Bold paragraph
17755
17756 New wiki paragraph
17757 !! html/php
17758 <p><b>Bold paragraph
17759 </p><p>New wiki paragraph</b>
17760 </p>
17761 !! html/parsoid
17762 <p><b>Bold paragraph</b>
17763 </p><p>New wiki paragraph
17764 </p>
17765 !! end
17766
17767 # Original result was this:
17768 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
17769 # </p>
17770 # While that might be marginally more intuitive, maybe, the six-apostrophe
17771 # construct is clearly pathological and the result stated here (which is what
17772 # the parser actually does) is about as reasonable as anything.
17773 !!test
17774 Mixing markup for italics and bold
17775 !! options
17776 !! wikitext
17777 '''bold''''''bold''bolditalics'''''
17778 !! html
17779 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
17780 </p>
17781 !! end
17782
17783
17784 !! article
17785 Xyzzyx
17786 !! text
17787 Article for special page transclusion test
17788 !! endarticle
17789
17790 !! test
17791 Special page transclusion
17792 !! options
17793 !! wikitext
17794 {{Special:Prefixindex/Xyzzyx}}
17795 !! html
17796 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17797 </ul>
17798
17799 !! end
17800
17801 !! test
17802 Special page transclusion twice (bug 5021)
17803 !! options
17804 !! wikitext
17805 {{Special:Prefixindex/Xyzzyx}}
17806 {{Special:Prefixindex/Xyzzyx}}
17807 !! html
17808 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17809 </ul>
17810 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17811 </ul>
17812
17813 !! end
17814
17815 !! test
17816 Transclusion of default MediaWiki message
17817 !! wikitext
17818 {{MediaWiki:Mainpage}}
17819 !! html
17820 <p>Main Page
17821 </p>
17822 !! end
17823
17824 !! test
17825 Transclusion of nonexistent MediaWiki message
17826 !! wikitext
17827 {{MediaWiki:Mainpagexxx}}
17828 !! html
17829 <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>
17830 </p>
17831 !! end
17832
17833 !! test
17834 Transclusion of MediaWiki message with underscore
17835 !! wikitext
17836 {{MediaWiki:history_short}}
17837 !! html
17838 <p>History
17839 </p>
17840 !! end
17841
17842 !! test
17843 Transclusion of MediaWiki message with space
17844 !! wikitext
17845 {{MediaWiki:history short}}
17846 !! html
17847 <p>History
17848 </p>
17849 !! end
17850
17851 !! test
17852 Invalid header with following text
17853 !! wikitext
17854 = x = y
17855 !! html
17856 <p>= x = y
17857 </p>
17858 !! end
17859
17860
17861 !! test
17862 Section extraction test (section 0)
17863 !! options
17864 section=0
17865 !! wikitext
17866 start
17867 ==a==
17868 ===aa===
17869 ====aaa====
17870 ==b==
17871 ===ba===
17872 ===bb===
17873 ====bba====
17874 ===bc===
17875 ==c==
17876 ===ca===
17877 !! html/php
17878 start
17879 !! end
17880
17881 !! test
17882 Section extraction test (section 1)
17883 !! options
17884 section=1
17885 !! wikitext
17886 start
17887 ==a==
17888 ===aa===
17889 ====aaa====
17890 ==b==
17891 ===ba===
17892 ===bb===
17893 ====bba====
17894 ===bc===
17895 ==c==
17896 ===ca===
17897 !! html/php
17898 ==a==
17899 ===aa===
17900 ====aaa====
17901 !! end
17902
17903 !! test
17904 Section extraction test (section 2)
17905 !! options
17906 section=2
17907 !! wikitext
17908 start
17909 ==a==
17910 ===aa===
17911 ====aaa====
17912 ==b==
17913 ===ba===
17914 ===bb===
17915 ====bba====
17916 ===bc===
17917 ==c==
17918 ===ca===
17919 !! html/php
17920 ===aa===
17921 ====aaa====
17922 !! end
17923
17924 !! test
17925 Section extraction test (section 3)
17926 !! options
17927 section=3
17928 !! wikitext
17929 start
17930 ==a==
17931 ===aa===
17932 ====aaa====
17933 ==b==
17934 ===ba===
17935 ===bb===
17936 ====bba====
17937 ===bc===
17938 ==c==
17939 ===ca===
17940 !! html/php
17941 ====aaa====
17942 !! end
17943
17944 !! test
17945 Section extraction test (section 4)
17946 !! options
17947 section=4
17948 !! wikitext
17949 start
17950 ==a==
17951 ===aa===
17952 ====aaa====
17953 ==b==
17954 ===ba===
17955 ===bb===
17956 ====bba====
17957 ===bc===
17958 ==c==
17959 ===ca===
17960 !! html/php
17961 ==b==
17962 ===ba===
17963 ===bb===
17964 ====bba====
17965 ===bc===
17966 !! end
17967
17968 !! test
17969 Section extraction test (section 5)
17970 !! options
17971 section=5
17972 !! wikitext
17973 start
17974 ==a==
17975 ===aa===
17976 ====aaa====
17977 ==b==
17978 ===ba===
17979 ===bb===
17980 ====bba====
17981 ===bc===
17982 ==c==
17983 ===ca===
17984 !! html/php
17985 ===ba===
17986 !! end
17987
17988 !! test
17989 Section extraction test (section 6)
17990 !! options
17991 section=6
17992 !! wikitext
17993 start
17994 ==a==
17995 ===aa===
17996 ====aaa====
17997 ==b==
17998 ===ba===
17999 ===bb===
18000 ====bba====
18001 ===bc===
18002 ==c==
18003 ===ca===
18004 !! html/php
18005 ===bb===
18006 ====bba====
18007 !! end
18008
18009 !! test
18010 Section extraction test (section 7)
18011 !! options
18012 section=7
18013 !! wikitext
18014 start
18015 ==a==
18016 ===aa===
18017 ====aaa====
18018 ==b==
18019 ===ba===
18020 ===bb===
18021 ====bba====
18022 ===bc===
18023 ==c==
18024 ===ca===
18025 !! html/php
18026 ====bba====
18027 !! end
18028
18029 !! test
18030 Section extraction test (section 8)
18031 !! options
18032 section=8
18033 !! wikitext
18034 start
18035 ==a==
18036 ===aa===
18037 ====aaa====
18038 ==b==
18039 ===ba===
18040 ===bb===
18041 ====bba====
18042 ===bc===
18043 ==c==
18044 ===ca===
18045 !! html/php
18046 ===bc===
18047 !! end
18048
18049 !! test
18050 Section extraction test (section 9)
18051 !! options
18052 section=9
18053 !! wikitext
18054 start
18055 ==a==
18056 ===aa===
18057 ====aaa====
18058 ==b==
18059 ===ba===
18060 ===bb===
18061 ====bba====
18062 ===bc===
18063 ==c==
18064 ===ca===
18065 !! html/php
18066 ==c==
18067 ===ca===
18068 !! end
18069
18070 !! test
18071 Section extraction test (section 10)
18072 !! options
18073 section=10
18074 !! wikitext
18075 start
18076 ==a==
18077 ===aa===
18078 ====aaa====
18079 ==b==
18080 ===ba===
18081 ===bb===
18082 ====bba====
18083 ===bc===
18084 ==c==
18085 ===ca===
18086 !! html/php
18087 ===ca===
18088 !! end
18089
18090 !! test
18091 Section extraction test (nonexistent section 11)
18092 !! options
18093 section=11
18094 !! wikitext
18095 start
18096 ==a==
18097 ===aa===
18098 ====aaa====
18099 ==b==
18100 ===ba===
18101 ===bb===
18102 ====bba====
18103 ===bc===
18104 ==c==
18105 ===ca===
18106 !! html/php
18107 !! end
18108
18109 !! test
18110 Section extraction test with bogus heading (section 1)
18111 !! options
18112 section=1
18113 !! wikitext
18114 ==a==
18115 ==bogus== not a legal section
18116 ==b==
18117 !! html/php
18118 ==a==
18119 ==bogus== not a legal section
18120 !! end
18121
18122 !! test
18123 Section extraction test with bogus heading (section 2)
18124 !! options
18125 section=2
18126 !! wikitext
18127 ==a==
18128 ==bogus== not a legal section
18129 ==b==
18130 !! html/php
18131 ==b==
18132 !! end
18133
18134 !! test
18135 Section extraction test with comment after heading (section 1)
18136 !! options
18137 section=1
18138 !! wikitext
18139 ==a==
18140 ==b== <!-- -->
18141 ==c==
18142 !! html/php
18143 ==a==
18144 !! end
18145
18146 !! test
18147 Section extraction test with comment after heading (section 2)
18148 !! options
18149 section=2
18150 !! wikitext
18151 ==a==
18152 ==b== <!-- -->
18153 ==c==
18154 !! html/php
18155 ==b== <!-- -->
18156 !! end
18157
18158 !! test
18159 Section extraction test with bogus <nowiki> heading (section 1)
18160 !! options
18161 section=1
18162 !! wikitext
18163 ==a==
18164 ==bogus== <nowiki>not a legal section</nowiki>
18165 ==b==
18166 !! html/php
18167 ==a==
18168 ==bogus== <nowiki>not a legal section</nowiki>
18169 !! end
18170
18171 !! test
18172 Section extraction test with bogus <nowiki> heading (section 2)
18173 !! options
18174 section=2
18175 !! wikitext
18176 ==a==
18177 ==bogus== <nowiki>not a legal section</nowiki>
18178 ==b==
18179 !! html/php
18180 ==b==
18181 !! end
18182
18183 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
18184 # instead of respecting commented sections
18185 !! test
18186 Section extraction prefixed by comment (section 1)
18187 !! options
18188 section=1
18189 !! wikitext
18190 <!-- -->==sec1==
18191 ==sec2==
18192 !! html/php
18193 ==sec2==
18194 !!end
18195
18196 !! test
18197 Section extraction prefixed by comment (section 2)
18198 !! options
18199 section=2
18200 !! wikitext
18201 <!-- -->==sec1==
18202 ==sec2==
18203 !! html/php
18204
18205 !!end
18206
18207 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
18208 # instead of respecting HTML-style headings
18209 !! test
18210 Section extraction, mixed wiki and html (section 1)
18211 !! options
18212 section=1
18213 !! wikitext
18214 <h2>unmarked</h2>
18215 unmarked
18216 ==1==
18217 one
18218 ==2==
18219 two
18220 !! html/php
18221 ==1==
18222 one
18223 !! end
18224
18225 !! test
18226 Section extraction, mixed wiki and html (section 2)
18227 !! options
18228 section=2
18229 !! wikitext
18230 <h2>unmarked</h2>
18231 unmarked
18232 ==1==
18233 one
18234 ==2==
18235 two
18236 !! html/php
18237 ==2==
18238 two
18239 !! end
18240
18241
18242 # Formerly testing for bug 3342
18243 !! test
18244 Section extraction, heading surrounded by <noinclude>
18245 !! options
18246 section=1
18247 !! wikitext
18248 <noinclude>==unmarked==</noinclude>
18249 ==marked==
18250 !! html/php
18251 ==marked==
18252 !!end
18253
18254 # Test behavior of bug 19910
18255 !! test
18256 Sectiion with all-equals
18257 !! options
18258 section=2
18259 !! wikitext
18260 ===
18261 The line above must have a trailing space
18262 === <!--
18263 --> <!-- -->
18264 But just in case it doesn't...
18265 !! html/php
18266 === <!--
18267 --> <!-- -->
18268 But just in case it doesn't...
18269 !! end
18270
18271 !! test
18272 Section replacement test (section 0)
18273 !! options
18274 replace=0,"xxx"
18275 !! wikitext
18276 start
18277 ==a==
18278 ===aa===
18279 ====aaa====
18280 ==b==
18281 ===ba===
18282 ===bb===
18283 ====bba====
18284 ===bc===
18285 ==c==
18286 ===ca===
18287 !! html/php
18288 xxx
18289
18290 ==a==
18291 ===aa===
18292 ====aaa====
18293 ==b==
18294 ===ba===
18295 ===bb===
18296 ====bba====
18297 ===bc===
18298 ==c==
18299 ===ca===
18300 !! end
18301
18302 !! test
18303 Section replacement test (section 1)
18304 !! options
18305 replace=1,"xxx"
18306 !! wikitext
18307 start
18308 ==a==
18309 ===aa===
18310 ====aaa====
18311 ==b==
18312 ===ba===
18313 ===bb===
18314 ====bba====
18315 ===bc===
18316 ==c==
18317 ===ca===
18318 !! html/php
18319 start
18320 xxx
18321
18322 ==b==
18323 ===ba===
18324 ===bb===
18325 ====bba====
18326 ===bc===
18327 ==c==
18328 ===ca===
18329 !! end
18330
18331 !! test
18332 Section replacement test (section 2)
18333 !! options
18334 replace=2,"xxx"
18335 !! wikitext
18336 start
18337 ==a==
18338 ===aa===
18339 ====aaa====
18340 ==b==
18341 ===ba===
18342 ===bb===
18343 ====bba====
18344 ===bc===
18345 ==c==
18346 ===ca===
18347 !! html/php
18348 start
18349 ==a==
18350 xxx
18351
18352 ==b==
18353 ===ba===
18354 ===bb===
18355 ====bba====
18356 ===bc===
18357 ==c==
18358 ===ca===
18359 !! end
18360
18361 !! test
18362 Section replacement test (section 3)
18363 !! options
18364 replace=3,"xxx"
18365 !! wikitext
18366 start
18367 ==a==
18368 ===aa===
18369 ====aaa====
18370 ==b==
18371 ===ba===
18372 ===bb===
18373 ====bba====
18374 ===bc===
18375 ==c==
18376 ===ca===
18377 !! html/php
18378 start
18379 ==a==
18380 ===aa===
18381 xxx
18382
18383 ==b==
18384 ===ba===
18385 ===bb===
18386 ====bba====
18387 ===bc===
18388 ==c==
18389 ===ca===
18390 !! end
18391
18392 !! test
18393 Section replacement test (section 4)
18394 !! options
18395 replace=4,"xxx"
18396 !! wikitext
18397 start
18398 ==a==
18399 ===aa===
18400 ====aaa====
18401 ==b==
18402 ===ba===
18403 ===bb===
18404 ====bba====
18405 ===bc===
18406 ==c==
18407 ===ca===
18408 !! html/php
18409 start
18410 ==a==
18411 ===aa===
18412 ====aaa====
18413 xxx
18414
18415 ==c==
18416 ===ca===
18417 !! end
18418
18419 !! test
18420 Section replacement test (section 5)
18421 !! options
18422 replace=5,"xxx"
18423 !! wikitext
18424 start
18425 ==a==
18426 ===aa===
18427 ====aaa====
18428 ==b==
18429 ===ba===
18430 ===bb===
18431 ====bba====
18432 ===bc===
18433 ==c==
18434 ===ca===
18435 !! html/php
18436 start
18437 ==a==
18438 ===aa===
18439 ====aaa====
18440 ==b==
18441 xxx
18442
18443 ===bb===
18444 ====bba====
18445 ===bc===
18446 ==c==
18447 ===ca===
18448 !! end
18449
18450 !! test
18451 Section replacement test (section 6)
18452 !! options
18453 replace=6,"xxx"
18454 !! wikitext
18455 start
18456 ==a==
18457 ===aa===
18458 ====aaa====
18459 ==b==
18460 ===ba===
18461 ===bb===
18462 ====bba====
18463 ===bc===
18464 ==c==
18465 ===ca===
18466 !! html/php
18467 start
18468 ==a==
18469 ===aa===
18470 ====aaa====
18471 ==b==
18472 ===ba===
18473 xxx
18474
18475 ===bc===
18476 ==c==
18477 ===ca===
18478 !! end
18479
18480 !! test
18481 Section replacement test (section 7)
18482 !! options
18483 replace=7,"xxx"
18484 !! wikitext
18485 start
18486 ==a==
18487 ===aa===
18488 ====aaa====
18489 ==b==
18490 ===ba===
18491 ===bb===
18492 ====bba====
18493 ===bc===
18494 ==c==
18495 ===ca===
18496 !! html/php
18497 start
18498 ==a==
18499 ===aa===
18500 ====aaa====
18501 ==b==
18502 ===ba===
18503 ===bb===
18504 xxx
18505
18506 ===bc===
18507 ==c==
18508 ===ca===
18509 !! end
18510
18511 !! test
18512 Section replacement test (section 8)
18513 !! options
18514 replace=8,"xxx"
18515 !! wikitext
18516 start
18517 ==a==
18518 ===aa===
18519 ====aaa====
18520 ==b==
18521 ===ba===
18522 ===bb===
18523 ====bba====
18524 ===bc===
18525 ==c==
18526 ===ca===
18527 !! html/php
18528 start
18529 ==a==
18530 ===aa===
18531 ====aaa====
18532 ==b==
18533 ===ba===
18534 ===bb===
18535 ====bba====
18536 xxx
18537
18538 ==c==
18539 ===ca===
18540 !!end
18541
18542 !! test
18543 Section replacement test (section 9)
18544 !! options
18545 replace=9,"xxx"
18546 !! wikitext
18547 start
18548 ==a==
18549 ===aa===
18550 ====aaa====
18551 ==b==
18552 ===ba===
18553 ===bb===
18554 ====bba====
18555 ===bc===
18556 ==c==
18557 ===ca===
18558 !! html/php
18559 start
18560 ==a==
18561 ===aa===
18562 ====aaa====
18563 ==b==
18564 ===ba===
18565 ===bb===
18566 ====bba====
18567 ===bc===
18568 xxx
18569 !! end
18570
18571 !! test
18572 Section replacement test (section 10)
18573 !! options
18574 replace=10,"xxx"
18575 !! wikitext
18576 start
18577 ==a==
18578 ===aa===
18579 ====aaa====
18580 ==b==
18581 ===ba===
18582 ===bb===
18583 ====bba====
18584 ===bc===
18585 ==c==
18586 ===ca===
18587 !! html/php
18588 start
18589 ==a==
18590 ===aa===
18591 ====aaa====
18592 ==b==
18593 ===ba===
18594 ===bb===
18595 ====bba====
18596 ===bc===
18597 ==c==
18598 xxx
18599 !! end
18600
18601 !! test
18602 Section replacement test with initial whitespace (bug 13728)
18603 !! options
18604 replace=2,"xxx"
18605 !! wikitext
18606 Preformatted initial line
18607 ==a==
18608 ===a===
18609 !! html/php
18610 Preformatted initial line
18611 ==a==
18612 xxx
18613 !! end
18614
18615
18616 !! test
18617 Section extraction, heading followed by pre with 20 spaces (bug 6398)
18618 !! options
18619 section=1
18620 !! wikitext
18621 ==a==
18622 a
18623 !! html/php
18624 ==a==
18625 a
18626 !! end
18627
18628 !! test
18629 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
18630 !! options
18631 section=1
18632 !! wikitext
18633 ==a==
18634 a
18635 !! html/php
18636 ==a==
18637 a
18638 !! end
18639
18640
18641 !! test
18642 Section extraction, <pre> around bogus header (bug 10309)
18643 !! options
18644 section=2
18645 !! wikitext
18646 == Section One ==
18647 <pre>
18648 =======
18649 </pre>
18650
18651 == Section Two ==
18652 stuff
18653 !! html/php
18654 == Section Two ==
18655 stuff
18656 !! end
18657
18658 !! test
18659 Section replacement, <pre> around bogus header (bug 10309)
18660 !! options
18661 replace=2,"xxx"
18662 !! wikitext
18663 == Section One ==
18664 <pre>
18665 =======
18666 </pre>
18667
18668 == Section Two ==
18669 stuff
18670 !! html/php
18671 == Section One ==
18672 <pre>
18673 =======
18674 </pre>
18675
18676 xxx
18677 !! end
18678
18679
18680 !! test
18681 Handling of &#x0A; in URLs
18682 !! wikitext
18683 ** irc://&#x0A;a
18684 !! html/php
18685 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18686
18687 !! html/parsoid
18688 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
18689 a">irc://
18690 a</a></li></ul></li></ul>
18691 !! end
18692
18693 !! test
18694 Handling of %0A in URLs
18695 !! wikitext
18696 ** irc://%0Aa
18697 !! html/php
18698 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18699
18700 !! html/parsoid
18701 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18702 !! end
18703
18704
18705 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18706 !! test
18707 5 quotes, code coverage +1 line
18708 !! options
18709 parsoid=wt2html
18710 !! wikitext
18711 '''''
18712 !! html/php
18713 !! html/parsoid
18714 <p><b><i></i></b></p>
18715 !! end
18716
18717 # same html as previous, but wikitext adjusted to match parsoid html2wt
18718 # note that wt2html and html2html will put the <i> before the <b>
18719 !! test
18720 5 quotes, code coverage +1 line w/ nowiki (1)
18721 !! options
18722 parsoid=wt2wt,html2wt
18723 !! wikitext
18724 '''''<nowiki/>'''''
18725 !! html/php
18726 <p><i></i>
18727 </p>
18728 !! html/parsoid
18729 <p><b><i></i></b></p>
18730 !! end
18731
18732 # same as previous, just swapping the <i> and <b>
18733 !! test
18734 5 quotes, code coverage +1 line w/ nowiki (2)
18735 !! wikitext
18736 '''''<nowiki/>'''''
18737 !! html/php
18738 <p><i></i>
18739 </p>
18740 !! html/parsoid
18741 <p><i><b></b></i></p>
18742 !! end
18743
18744 !! test
18745 Special:Search page linking.
18746 !! wikitext
18747 {{Special:search}}
18748 !! html
18749 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18750 </p>
18751 !! end
18752
18753 !! test
18754 {{!}} is a magic word
18755 !! wikitext
18756 {{!}} is a magic word there and {{!}} is still a magic word here
18757 | is not a magic word here but {{!}} is still a magic word here
18758 !! html/php
18759 <p>| is a magic word there and | is still a magic word here
18760 | is not a magic word here but | is still a magic word here
18761 </p>
18762 !! html/parsoid
18763 <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
18764 | 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>
18765
18766 !! end
18767
18768 !! test
18769 Say the magic word
18770 !! options
18771 title=[[Parser test]]
18772 !! wikitext
18773 * {{PAGENAME}}
18774 * {{PAGENAMEE}}
18775 * {{FULLPAGENAME}}
18776 * {{FULLPAGENAMEE}}
18777 * {{BASEPAGENAME}}
18778 * {{BASEPAGENAMEE}}
18779 * {{SUBPAGENAME}}
18780 * {{SUBPAGENAMEE}}
18781 * {{ROOTPAGENAME}}
18782 * {{ROOTPAGENAMEE}}
18783 * {{TALKPAGENAME}}
18784 * {{TALKPAGENAMEE}}
18785 * {{SUBJECTPAGENAME}}
18786 * {{SUBJECTPAGENAMEE}}
18787 * {{NAMESPACEE}}
18788 * {{NAMESPACE}}
18789 * {{NAMESPACENUMBER}}
18790 * {{TALKSPACE}}
18791 * {{TALKSPACEE}}
18792 * {{SUBJECTSPACE}}
18793 * {{SUBJECTSPACEE}}
18794 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18795 !! html
18796 <ul><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> Parser test</li>
18803 <li> Parser_test</li>
18804 <li> Parser test</li>
18805 <li> Parser_test</li>
18806 <li> Talk:Parser test</li>
18807 <li> Talk:Parser_test</li>
18808 <li> Parser test</li>
18809 <li> Parser_test</li>
18810 <li> </li>
18811 <li> </li>
18812 <li> 0</li>
18813 <li> Talk</li>
18814 <li> Talk</li>
18815 <li> </li>
18816 <li> </li>
18817 <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>
18818
18819 !! end
18820 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18821
18822 !! test
18823 Gallery
18824 !! wikitext
18825 <gallery>
18826 image1.png |
18827 image2.gif|||||
18828
18829 image3|
18830 image4 |300px| centre
18831 image5.svg| http://///////
18832 [[x|xx]]]]
18833 * image6
18834 </gallery>
18835 !! html
18836 <ul class="gallery mw-gallery-traditional">
18837 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18838 <div class="thumb" style="height: 150px;">Image1.png</div>
18839 <div class="gallerytext">
18840 </div>
18841 </div></li>
18842 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18843 <div class="thumb" style="height: 150px;">Image2.gif</div>
18844 <div class="gallerytext">
18845 </div>
18846 </div></li>
18847 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18848 <div class="thumb" style="height: 150px;">Image3</div>
18849 <div class="gallerytext">
18850 </div>
18851 </div></li>
18852 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18853 <div class="thumb" style="height: 150px;">Image4</div>
18854 <div class="gallerytext">
18855 <pre>centre
18856 </pre>
18857 </div>
18858 </div></li>
18859 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18860 <div class="thumb" style="height: 150px;">Image5.svg</div>
18861 <div class="gallerytext">
18862 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
18863 </p>
18864 </div>
18865 </div></li>
18866 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18867 <div class="thumb" style="height: 150px;">* image6</div>
18868 <div class="gallerytext">
18869 </div>
18870 </div></li>
18871 </ul>
18872
18873 !! end
18874
18875 !! test
18876 Gallery (with options)
18877 !! wikitext
18878 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
18879 File:Nonexistent.jpg|caption
18880 File:Nonexistent.jpg
18881 image:foobar.jpg|some '''caption''' [[Main Page]]
18882 image:foobar.jpg
18883 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
18884 </gallery>
18885 !! html
18886 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
18887 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
18888 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18889 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18890 <div class="gallerytext">
18891 <p>caption
18892 </p>
18893 </div>
18894 </div></li>
18895 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18896 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18897 <div class="gallerytext">
18898 </div>
18899 </div></li>
18900 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18901 <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>
18902 <div class="gallerytext">
18903 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18904 </p>
18905 </div>
18906 </div></li>
18907 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18908 <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>
18909 <div class="gallerytext">
18910 </div>
18911 </div></li>
18912 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18913 <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>
18914 <div class="gallerytext">
18915 <p>blabla.
18916 </p>
18917 </div>
18918 </div></li>
18919 </ul>
18920
18921 !! end
18922
18923 !! test
18924 Gallery with link that has fragment
18925 !! wikitext
18926 <gallery>
18927 image:foobar.jpg|link=Main_Page
18928 image:foobar.jpg|link=Main_Page#section
18929 image:foobar.jpg|link=Main Page#section|caption
18930 </gallery>
18931 !! html
18932 <ul class="gallery mw-gallery-traditional">
18933 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18934 <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>
18935 <div class="gallerytext">
18936 </div>
18937 </div></li>
18938 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18939 <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>
18940 <div class="gallerytext">
18941 </div>
18942 </div></li>
18943 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18944 <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>
18945 <div class="gallerytext">
18946 <p>caption
18947 </p>
18948 </div>
18949 </div></li>
18950 </ul>
18951
18952 !! end
18953
18954 !! test
18955 Gallery with wikitext inside caption
18956 !! wikitext
18957 <gallery>
18958 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
18959 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
18960 </gallery>
18961 !! html
18962 <ul class="gallery mw-gallery-traditional">
18963 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18964 <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>
18965 <div class="gallerytext">
18966 <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>
18967 </p>
18968 </div>
18969 </div></li>
18970 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18971 <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>
18972 <div class="gallerytext">
18973 <p>This is a test template
18974 </p>
18975 </div>
18976 </div></li>
18977 </ul>
18978
18979 !! end
18980
18981 !! test
18982 gallery (with showfilename option)
18983 !! wikitext
18984 <gallery showfilename>
18985 File:Nonexistent.jpg|caption
18986 File:Nonexistent.jpg
18987 image:foobar.jpg|some '''caption''' [[Main Page]]
18988 File:Foobar.jpg
18989 </gallery>
18990 !! html
18991 <ul class="gallery mw-gallery-traditional">
18992 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18993 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18994 <div class="gallerytext">
18995 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
18996 caption
18997 </p>
18998 </div>
18999 </div></li>
19000 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19001 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19002 <div class="gallerytext">
19003 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19004 </p>
19005 </div>
19006 </div></li>
19007 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19008 <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>
19009 <div class="gallerytext">
19010 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19011 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19012 </p>
19013 </div>
19014 </div></li>
19015 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19016 <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>
19017 <div class="gallerytext">
19018 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19019 </p>
19020 </div>
19021 </div></li>
19022 </ul>
19023
19024 !! end
19025
19026 !! test
19027 Gallery (with namespace-less filenames)
19028 !! wikitext
19029 <gallery>
19030 File:Nonexistent.jpg
19031 Nonexistent.jpg
19032 image:foobar.jpg
19033 foobar.jpg
19034 </gallery>
19035 !! html
19036 <ul class="gallery mw-gallery-traditional">
19037 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19038 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19039 <div class="gallerytext">
19040 </div>
19041 </div></li>
19042 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19043 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19044 <div class="gallerytext">
19045 </div>
19046 </div></li>
19047 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19048 <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>
19049 <div class="gallerytext">
19050 </div>
19051 </div></li>
19052 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19053 <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>
19054 <div class="gallerytext">
19055 </div>
19056 </div></li>
19057 </ul>
19058
19059 !! end
19060
19061 !! test
19062 HTML Hex character encoding (spells the word "JavaScript")
19063 !! options
19064 parsoid=wt2html,wt2wt,html2html
19065 !! wikitext
19066 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
19067 !! html/php
19068 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
19069 </p>
19070 !! html/php+tidy
19071 <p>JavaScript</p>
19072 !! html/parsoid
19073 <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>
19074 !! end
19075
19076 !! test
19077 HTML Hex character encoding bogus encoding (bug 26437 regression check)
19078 !! wikitext
19079 &#xsee;&#XSEE;
19080 !! html/php
19081 <p>&amp;#xsee;&amp;#XSEE;
19082 </p>
19083 !! html/parsoid
19084 <p>&amp;#xsee;&amp;#XSEE;</p>
19085 !! end
19086
19087 !! test
19088 HTML Hex character encoding mixed case
19089 !! options
19090 parsoid=wt2html,wt2wt,html2html
19091 !! wikitext
19092 &#xEE;&#Xee;
19093 !! html/php
19094 <p>&#xee;&#xee;
19095 </p>
19096 !! html/php+tidy
19097 <p>îî</p>
19098 !! html/parsoid
19099 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
19100 !! end
19101
19102 # See: http://www.w3.org/TR/html5/syntax.html#character-references
19103 # Note that U+000C (form feed) is not a valid XML character, so
19104 # it is banned even though allowed in HTML5.
19105 !! test
19106 Illegal character references (T106578)
19107 !! wikitext
19108 ; Null: &#00;
19109 ; FF: &#xC;
19110 ; CR: &#xD;
19111 ; Control (low): &#8;
19112 ; Control (high): &#x7F; &#x9F;
19113 ; Surrogate: &#xD83D;&#xDCA9;
19114 ; This is an okay astral character: &#x1F4A9;
19115 !! html+tidy
19116 <dl>
19117 <dt>Null</dt>
19118 <dd>&amp;#00;</dd>
19119 <dt>FF</dt>
19120 <dd>&amp;#xC;</dd>
19121 <dt>CR</dt>
19122 <dd>&amp;#xD;</dd>
19123 <dt>Control (low)</dt>
19124 <dd>&amp;#8;</dd>
19125 <dt>Control (high)</dt>
19126 <dd>&amp;#x7F; &amp;#x9F;</dd>
19127 <dt>Surrogate</dt>
19128 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
19129 <dt>This is an okay astral character</dt>
19130 <dd>💩</dd>
19131 </dl>
19132 !! end
19133
19134 !! test
19135 __FORCETOC__ override
19136 !! wikitext
19137 __NEWSECTIONLINK__
19138 __FORCETOC__
19139 !! html/php
19140 <p><br />
19141 </p>
19142 !! end
19143
19144 !! test
19145 ISBN code coverage
19146 !! wikitext
19147 ISBN 978-0-1234-56&#x20;789
19148 !! html
19149 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
19150 </p>
19151 !! html+tidy
19152 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
19153 !! html/parsoid
19154 <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>
19155 !! end
19156
19157 !! test
19158 ISBN followed by 5 spaces
19159 !! wikitext
19160 ISBN
19161 !! html
19162 <p>ISBN
19163 </p>
19164 !! end
19165
19166 !! test
19167 Double ISBN
19168 !! wikitext
19169 ISBN ISBN 1234567890
19170 !! html/php
19171 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19172 </p>
19173 !! html/parsoid
19174 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
19175 !! end
19176
19177 # Uppercase X and lowercase x as well
19178 !! test
19179 ISBN with an X
19180 !! wikitext
19181 ISBN 3-462-04561-X
19182 ISBN 3-462-04561-x
19183 ISBN 080442957X
19184 ISBN 080442957x
19185 ISBN 978080442957X
19186 ISBN 978080442957x
19187 !! html/php
19188 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
19189 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
19190 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
19191 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
19192 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
19193 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
19194 </p>
19195 !! html/parsoid
19196 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
19197 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
19198 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
19199 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
19200 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
19201 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
19202 !! end
19203
19204 !! test
19205 ISBN with empty prefix (parsoid test)
19206 !! wikitext
19207 ISBN 1234567890
19208 !! html/php
19209 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19210 </p>
19211 !! html/parsoid
19212 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
19213 !! end
19214
19215 !! test
19216 Bug 22905: <abbr> followed by ISBN followed by </a>
19217 !! wikitext
19218 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
19219 !! html/php
19220 <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>
19221 </p>
19222 !! html/parsoid
19223 <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>
19224 !! end
19225
19226 !! test
19227 Double RFC
19228 !! wikitext
19229 RFC RFC 1234
19230 !! html
19231 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
19232 </p>
19233 !! end
19234
19235 !! test
19236 Double RFC with a wiki link
19237 !! wikitext
19238 RFC [[RFC 1234]]
19239 !! html
19240 <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>
19241 </p>
19242 !! end
19243
19244 !! test
19245 RFC code coverage
19246 !! wikitext
19247 RFC 983&#x20;987
19248 !! html
19249 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
19250 </p>
19251 !! html+tidy
19252 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
19253 !! end
19254
19255 !! test
19256 Centre-aligned image
19257 !! wikitext
19258 [[Image:foobar.jpg|centre]]
19259 !! html
19260 <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>
19261
19262 !!end
19263
19264 !! test
19265 None-aligned image
19266 !! wikitext
19267 [[Image:foobar.jpg|none]]
19268 !! html
19269 <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>
19270
19271 !!end
19272
19273 !! test
19274 Width + Height sized image (using px) (height is ignored)
19275 !! wikitext
19276 [[Image:foobar.jpg|640x480px]]
19277 !! html
19278 <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>
19279 </p>
19280 !!end
19281
19282 !! test
19283 Width-sized image (using px, no following whitespace)
19284 !! wikitext
19285 [[Image:foobar.jpg|640px]]
19286 !! html
19287 <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>
19288 </p>
19289 !!end
19290
19291 !! test
19292 Width-sized image (using px, with following whitespace - test regression from r39467)
19293 !! wikitext
19294 [[Image:foobar.jpg|640px ]]
19295 !! html
19296 <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>
19297 </p>
19298 !!end
19299
19300 !! test
19301 Width-sized image (using px, with preceding whitespace - test regression from r39467)
19302 !! wikitext
19303 [[Image:foobar.jpg| 640px]]
19304 !! html
19305 <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>
19306 </p>
19307 !!end
19308
19309 !! test
19310 Image with page parameter
19311 !! options
19312 djvu
19313 !! wikitext
19314 [[File:LoremIpsum.djvu|page=2]]
19315 !! html/php
19316 <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>
19317 </p>
19318 !! html/parsoid
19319 <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>
19320 !! end
19321
19322 !! test
19323 Another italics / bold test
19324 !! wikitext
19325 ''' ''x'
19326 !! html
19327 <pre>'<i> </i>x'
19328 </pre>
19329 !!end
19330
19331 # FIXME: The php output seems broken. It's interleaving some open/close tags.
19332 !! test
19333 dt/dd/dl test
19334 !! wikitext
19335 :;;;::
19336 !! html/php
19337 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
19338
19339 !! html/parsoid
19340 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
19341
19342 !!end
19343
19344
19345 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
19346 !! test
19347 Images with the "|" character in the comment
19348 !! wikitext
19349 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
19350 !! html/php
19351 <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>
19352
19353 !! html/parsoid
19354 <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>
19355 !! end
19356
19357 !! test
19358 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
19359 !! wikitext
19360 <html><script>alert(1);</script></html>
19361 !! html
19362 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
19363 </p>
19364 !! end
19365
19366 !! test
19367 HTML with raw HTML ($wgRawHtml==true)
19368 !! options
19369 wgRawHtml=1
19370 !! wikitext
19371 <html><script>alert(1);</script></html>
19372 !! html
19373 <p><script>alert(1);</script>
19374 </p>
19375 !! end
19376
19377 !! test
19378 Parents of subpages, one level up
19379 !! options
19380 subpage title=[[Subpage test/L1/L2/L3]]
19381 !! wikitext
19382 [[../|L2]]
19383 !! html
19384 <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>
19385 </p>
19386 !! end
19387
19388
19389 !! test
19390 Parents of subpages, one level up, not named
19391 !! options
19392 subpage title=[[Subpage test/L1/L2/L3]]
19393 !! wikitext
19394 [[../]]
19395 !! html
19396 <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>
19397 </p>
19398 !! end
19399
19400
19401
19402 !! test
19403 Parents of subpages, two levels up
19404 !! options
19405 subpage title=[[Subpage test/L1/L2/L3]]
19406 !! wikitext
19407 [[../../|L1]]2
19408
19409 [[../../|L1]]l
19410 !! html
19411 <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
19412 </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>
19413 </p>
19414 !! end
19415
19416 !! test
19417 Parents of subpages, two levels up, without trailing slash or name.
19418 !! options
19419 subpage title=[[Subpage test/L1/L2/L3]]
19420 !! wikitext
19421 [[../..]]
19422 !! html
19423 <p>[[../..]]
19424 </p>
19425 !! end
19426
19427 !! test
19428 Parents of subpages, two levels up, with lots of extra trailing slashes.
19429 !! options
19430 subpage title=[[Subpage test/L1/L2/L3]]
19431 !! wikitext
19432 [[../../////]]
19433 !! html
19434 <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>
19435 </p>
19436 !! end
19437
19438 !! article
19439 Subpage test/L1/L2/L3Sibling
19440 !! text
19441 Sibling article
19442 !! endarticle
19443
19444 !! test
19445 Transclusion of a sibling page (one level up)
19446 !! options
19447 subpage title=[[Subpage test/L1/L2/L3]]
19448 !! wikitext
19449 {{../L3Sibling}}
19450 !! html
19451 <p>Sibling article
19452 </p>
19453 !! end
19454
19455 !! test
19456 Transclusion of a child page
19457 !! options
19458 subpage title=[[Subpage test/L1/L2]]
19459 !! wikitext
19460 {{/L3Sibling}}
19461 !! html
19462 <p>Sibling article
19463 </p>
19464 !! end
19465
19466 # This is wt2html only in Parsoid because we add <nowiki>
19467 # because of {{..}} and we don't expect to fix that to
19468 # eliminate the nowikis selective for {{..}} markup.
19469 !! test
19470 Non-transclusion because of too many up levels
19471 !! options
19472 subpage title=[[Subpage test/L1/L2/L3]]
19473 parsoid=wt2html
19474 !! wikitext
19475 {{../../../../More than parent}}
19476 !! html/php
19477 <p>{{../../../../More than parent}}
19478 </p>
19479 !! html/parsoid
19480 <p>{{../../../../More than parent}}</p>
19481 !! end
19482
19483 !! test
19484 Definition list code coverage
19485 !! wikitext
19486 ; title : def
19487 ; title : def
19488 ;title: def
19489 !! html/php
19490 <dl><dt> title &#160;</dt>
19491 <dd> def</dd>
19492 <dt> title&#160;</dt>
19493 <dd> def</dd>
19494 <dt>title</dt>
19495 <dd> def</dd></dl>
19496
19497 !! html/parsoid
19498 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19499 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19500 <dt>title</dt><dd> def</dd></dl>
19501 !! end
19502
19503 !! test
19504 Don't fall for the self-closing div
19505 !! wikitext
19506 <div>hello world</div/>
19507 !! html
19508 <div>hello world</div>
19509
19510 !! end
19511
19512 !! test
19513 MSGNW magic word
19514 !! wikitext
19515 {{MSGNW:msg}}
19516 !! html/php
19517 <p>&#91;&#91;:Template:Msg&#93;&#93;
19518 </p>
19519 !! end
19520
19521 !! test
19522 RAW magic word
19523 !! wikitext
19524 {{RAW:QUERTY}}
19525 !! html
19526 <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>
19527 </p>
19528 !! end
19529
19530 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
19531 !! test
19532 Always escape literal '>' in output, not just after '<'
19533 !! wikitext
19534 ><>
19535 !! html
19536 <p>&gt;&lt;&gt;
19537 </p>
19538 !! end
19539
19540 !! test
19541 Template caching
19542 !! wikitext
19543 {{Test}}
19544 {{Test}}
19545 !! html
19546 <p>This is a test template
19547 This is a test template
19548 </p>
19549 !! end
19550
19551
19552 !! article
19553 MediaWiki:Fake
19554 !! text
19555 ==header==
19556 !! endarticle
19557
19558 !! test
19559 Inclusion of !userCanEdit() content
19560 !! wikitext
19561 {{MediaWiki:Fake}}
19562 !! html
19563 <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>
19564
19565 !! end
19566
19567
19568 !! test
19569 Out-of-order TOC heading levels
19570 !! wikitext
19571 ==2==
19572 ======6======
19573 ===3===
19574 =1=
19575 =====5=====
19576 ==2==
19577 !! html
19578 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19579 <ul>
19580 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
19581 <ul>
19582 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
19583 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
19584 </ul>
19585 </li>
19586 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
19587 <ul>
19588 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
19589 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
19590 </ul>
19591 </li>
19592 </ul>
19593 </div>
19594
19595 <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>
19596 <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>
19597 <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>
19598 <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>
19599 <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>
19600 <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>
19601
19602 !! end
19603
19604
19605 !! test
19606 ISBN with a dummy number
19607 !! wikitext
19608 ISBN ---
19609 !! html
19610 <p>ISBN ---
19611 </p>
19612 !! end
19613
19614
19615 !! test
19616 ISBN with space-delimited number
19617 !! wikitext
19618 ISBN 92 9017 032 8
19619 !! html
19620 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
19621 </p>
19622 !! end
19623
19624
19625 !! test
19626 ISBN with multiple spaces, no number
19627 !! wikitext
19628 ISBN foo
19629 !! html
19630 <p>ISBN foo
19631 </p>
19632 !! end
19633
19634
19635 !! test
19636 ISBN length
19637 !! wikitext
19638 ISBN 123456789
19639
19640 ISBN 1234567890
19641
19642 ISBN 12345678901
19643 !! html
19644 <p>ISBN 123456789
19645 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19646 </p><p>ISBN 12345678901
19647 </p>
19648 !! end
19649
19650
19651 !! test
19652 ISBN with trailing year (bug 8110)
19653 !! wikitext
19654 ISBN 1-234-56789-0 - 2006
19655
19656 ISBN 1 234 56789 0 - 2006
19657 !! html
19658 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
19659 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
19660 </p>
19661 !! end
19662
19663
19664 !! test
19665 anchorencode
19666 !! wikitext
19667 {{anchorencode:foo bar©#%n}}
19668 !! html
19669 <p>foo_bar.C2.A9.23.25n
19670 </p>
19671 !! end
19672
19673 !! test
19674 anchorencode trims spaces
19675 !! wikitext
19676 {{anchorencode: __pretty__please__}}
19677 !! html
19678 <p>pretty_please
19679 </p>
19680 !! end
19681
19682 !! test
19683 anchorencode deals with links
19684 !! wikitext
19685 {{anchorencode: [[hello|world]] [[hi]]}}
19686 !! html
19687 <p>world_hi
19688 </p>
19689 !! end
19690
19691 !! test
19692 anchorencode deals with templates
19693 !! wikitext
19694 {{anchorencode: {{Foo}} }}
19695 !! html
19696 <p>FOO
19697 </p>
19698 !! end
19699
19700 !! test
19701 anchorencode encodes like the TOC generator: (bug 18431)
19702 !! wikitext
19703 === _ +:.3A%3A&&amp;]] ===
19704 {{anchorencode: _ +:.3A%3A&&amp;]] }}
19705 __NOEDITSECTION__
19706 !! html
19707 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
19708 <p>.2B:.3A.253A.26.26.5D.5D
19709 </p>
19710 !! end
19711
19712 !! test
19713 Bug 6200: blockquotes and paragraph formatting
19714 !! wikitext
19715 <blockquote>
19716 foo
19717 </blockquote>
19718
19719 bar
19720
19721 baz
19722 !! html
19723 <blockquote>
19724 <p>foo
19725 </p>
19726 </blockquote>
19727 <p>bar
19728 </p>
19729 <pre>baz
19730 </pre>
19731 !! end
19732
19733 !! test
19734 Bug 8293: Use of center tag ruins paragraph formatting
19735 !! wikitext
19736 <center>
19737 foo
19738 </center>
19739
19740 bar
19741
19742 baz
19743 !! html
19744 <center>
19745 <p>foo
19746 </p>
19747 </center>
19748 <p>bar
19749 </p>
19750 <pre>baz
19751 </pre>
19752 !! end
19753
19754 !!test
19755 Parsing of overlapping (improperly nested) inline html tags
19756 !! wikitext
19757 <span><s>x</span></s>
19758 !! html/php
19759 <p><span><s>x&lt;/span&gt;</s></span>
19760 </p>
19761 !! html/parsoid
19762 <p><span><s>x</s></span>
19763 </p>
19764 !!end
19765
19766 ###
19767 ### Language variants related tests
19768 ###
19769 !! test
19770 Self-link in language variants
19771 !! options
19772 title=[[Dunav]] language=sr
19773 !! wikitext
19774 Both [[Dunav]] and [[Дунав]] are names for this river.
19775 !! html
19776 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
19777 </p>
19778 !!end
19779
19780 !! article
19781 Дуна
19782 !! text
19783 content
19784 !! endarticle
19785
19786 !! test
19787 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
19788 !! options
19789 title=[[Duna]] language=sr
19790 !! wikitext
19791 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
19792 !! html
19793 <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.
19794 </p>
19795 !! end
19796
19797 !! test
19798 Link to a section of a variant of this title shouldn't be parsed as self-link
19799 !! options
19800 title=[[Duna]] language=sr
19801 !! wikitext
19802 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
19803 !! html
19804 <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.
19805 </p>
19806 !! end
19807
19808 !! test
19809 Link to pages in language variants
19810 !! options
19811 language=sr
19812 !! wikitext
19813 Main Page can be written as [[Маин Паге]]
19814 !! html
19815 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
19816 </p>
19817 !!end
19818
19819
19820 !! test
19821 Multiple links to pages in language variants
19822 !! options
19823 language=sr
19824 !! wikitext
19825 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
19826 !! html
19827 <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>.
19828 </p>
19829 !!end
19830
19831
19832 !! test
19833 Simple template in language variants
19834 !! options
19835 language=sr
19836 !! wikitext
19837 {{тест}}
19838 !! html
19839 <p>This is a test template
19840 </p>
19841 !! end
19842
19843
19844 !! test
19845 Template with explicit namespace in language variants
19846 !! options
19847 language=sr
19848 !! wikitext
19849 {{Template:тест}}
19850 !! html
19851 <p>This is a test template
19852 </p>
19853 !! end
19854
19855
19856 !! test
19857 Basic test for template parameter in language variants
19858 !! options
19859 language=sr
19860 !! wikitext
19861 {{парамтест|param=foo}}
19862 !! html
19863 <p>This is a test template with parameter foo
19864 </p>
19865 !! end
19866
19867
19868 !! test
19869 Simple category in language variants
19870 !! options
19871 language=sr cat
19872 !! wikitext
19873 [[Category:МедиаWики Усер'с Гуиде]]
19874 !! html
19875 cat=МедиаWики_Усер'с_Гуиде sort=
19876 !! end
19877
19878
19879 !! article
19880 Category:分类
19881 !! text
19882 blah
19883 !! endarticle
19884
19885 !! article
19886 Category:分類
19887 !! text
19888 blah
19889 !! endarticle
19890
19891 ## We used to, but no longer wt2wt this test since the default serializer
19892 ## will normalize all categories to serialize on their own line.
19893 ## This wikitext usage is going to be fairly uncommon in production and
19894 ## selser will take care of preserving formatting in those scenarios.
19895 !! test
19896 Don't convert blue categorylinks to another variant (bug 33210)
19897 !! options
19898 cat
19899 language=zh
19900 parsoid=wt2html
19901 !! wikitext
19902 [[A]][[Category:分类]]
19903 !! html/php
19904 cat=分类 sort=
19905 !! html/parsoid
19906 <p><a rel="mw:WikiLink" href="A" title="A">A</a></p>
19907 <link rel="mw:PageProp/Category" href="Category:分类"/>
19908 !! end
19909
19910 !! test
19911 Stripping -{}- tags (language variants)
19912 !! options
19913 language=sr
19914 !! wikitext
19915 Latin proverb: -{Ne nuntium necare}-
19916 !! html
19917 <p>Latin proverb: Ne nuntium necare
19918 </p>
19919 !! end
19920
19921
19922 !! test
19923 Prevent conversion with -{}- tags (language variants)
19924 !! options
19925 language=sr variant=sr-ec
19926 !! wikitext
19927 Latinski: -{Ne nuntium necare}-
19928 !! html
19929 <p>Латински: Ne nuntium necare
19930 </p>
19931 !! end
19932
19933
19934 !! test
19935 Prevent conversion of text with -{}- tags (language variants)
19936 !! options
19937 language=sr variant=sr-ec
19938 !! wikitext
19939 Latinski: -{Ne nuntium necare}-
19940 !! html
19941 <p>Латински: Ne nuntium necare
19942 </p>
19943 !! end
19944
19945
19946 !! test
19947 Prevent conversion of links with -{}- tags (language variants)
19948 !! options
19949 language=sr variant=sr-ec
19950 !! wikitext
19951 -{[[Main Page]]}-
19952 !! html
19953 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19954 </p>
19955 !! end
19956
19957
19958 !! test
19959 -{}- tags within headlines (within html for parserConvert())
19960 !! options
19961 language=sr variant=sr-ec
19962 !! wikitext
19963 == -{Naslov}- ==
19964 !! html
19965 <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>
19966
19967 !! end
19968
19969
19970 !! test
19971 Explicit definition of language variant alternatives
19972 !! options
19973 language=zh variant=zh-tw
19974 !! wikitext
19975 -{zh:China;zh-tw:Taiwan}-, not China
19976 !! html
19977 <p>Taiwan, not China
19978 </p>
19979 !! end
19980
19981
19982 !! test
19983 Conversion around HTML tags
19984 !! options
19985 language=sr variant=sr-ec
19986 !! wikitext
19987 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
19988 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
19989 !! html
19990 <p>
19991 <span title="ЛаCтин">ски</span>
19992 </p>
19993 !! end
19994
19995
19996 !! test
19997 Explicit session-wise language variant mapping (A flag and - flag)
19998 !! options
19999 language=zh variant=zh-tw
20000 !! wikitext
20001 Taiwan is not China.
20002 But -{A|zh:China;zh-tw:Taiwan}- is China,
20003 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
20004 and -{China}- is China.
20005 !! html
20006 <p>Taiwan is not China.
20007 But Taiwan is Taiwan,
20008 (This should be stripped!)
20009 and China is China.
20010 </p>
20011 !! end
20012
20013 !! test
20014 Explicit session-wise language variant mapping (H flag for hide)
20015 !! options
20016 language=zh variant=zh-tw
20017 !! wikitext
20018 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
20019 Taiwan is China.
20020 !! html
20021 <p>(This should be stripped!)
20022 Taiwan is Taiwan.
20023 </p>
20024 !! end
20025
20026 !! test
20027 Adding explicit conversion rule for title (T flag)
20028 !! options
20029 language=zh variant=zh-tw showtitle
20030 !! wikitext
20031 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20032 !! html
20033 Taiwan
20034 <p>Should be stripped!
20035 </p>
20036 !! end
20037
20038 !! test
20039 Testing that changing the language variant here in the tests actually works
20040 !! options
20041 language=zh variant=zh showtitle
20042 !! wikitext
20043 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20044 !! html
20045 China
20046 <p>Should be stripped!
20047 </p>
20048 !! end
20049
20050 !! test
20051 Recursive conversion of alt and title attrs shouldn't clear converter state
20052 !! options
20053 language=zh variant=zh-cn showtitle
20054 !! wikitext
20055 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
20056 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
20057 !! html
20058 China
20059 <p>
20060 Should be stripped<span title="Exclamation">!</span>
20061 </p>
20062 !! end
20063
20064 !! test
20065 Bug 24072: more test on conversion rule for title
20066 !! options
20067 language=zh variant=zh-tw showtitle
20068 !! wikitext
20069 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20070 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
20071 !! html
20072 Taiwan
20073 <p>This should be stripped!
20074 This won't take interferes with the title rule.
20075 </p>
20076 !! end
20077
20078 !! test
20079 Partly disable title conversion if variant == main language code
20080 !! options
20081 language=zh variant=zh title=[[ZH]] showtitle
20082 !! wikitext
20083 -{T|zh-cn:CN;zh-tw:TW}-
20084 !! html
20085 ZH
20086 <p>
20087 </p>
20088 !! end
20089
20090 !! test
20091 Partly disable title conversion if variant == main language code, more
20092 !! options
20093 language=zh variant=zh title=[[ZH]] showtitle
20094 !! wikitext
20095 -{T|TW}-
20096 !! html
20097 ZH
20098 <p>
20099 </p>
20100 !! end
20101
20102 !! test
20103 Raw output of variant escape tags (R flag)
20104 !! options
20105 language=zh variant=zh-tw
20106 !! wikitext
20107 Raw: -{R|zh:China;zh-tw:Taiwan}-
20108 !! html
20109 <p>Raw: zh:China;zh-tw:Taiwan
20110 </p>
20111 !! end
20112
20113 !! test
20114 Strings evaluating false shouldn't be ignored by Language converter (T51072)
20115 !! options
20116 language=zh variant=zh-cn
20117 !! input
20118 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
20119 !! result
20120 <p>0
20121 </p>
20122 !! end
20123
20124 !! test
20125 Conversion rules from [numeric-only string] to [something else] (T48634)
20126 !! options
20127 language=zh variant=zh-cn
20128 !! input
20129 -{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
20130 !! result
20131 <p>D12345EE12345
20132 </p>
20133 !! end
20134
20135 !! test
20136 Bidirectional converter rule entries with an empty value should be ignored (T53551)
20137 !! options
20138 language=zh variant=zh-cn
20139 !! input
20140 -{H|zh-cn:foo;zh-tw:;}-foobar
20141 !! result
20142 <p>foobar
20143 </p>
20144 !! end
20145
20146 !! test
20147 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
20148 !! options
20149 language=zh variant=zh-cn
20150 !! input
20151 -{H|=>zh-cn:foo;}-foobar
20152 !! result
20153 <p>foobar
20154 </p>
20155 !! end
20156
20157 !! test
20158 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
20159 !! options
20160 language=zh variant=zh-cn
20161 !! input
20162 -{H|}-foobar
20163 !! result
20164 <p>foobar
20165 </p>
20166 !! end
20167
20168 !! test
20169 Nested using of manual convert syntax
20170 !! options
20171 language=zh variant=zh-hk
20172 !! wikitext
20173 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
20174 !! html
20175 <p>Nested: Hello Hong Kong!
20176 </p>
20177 !! end
20178
20179 # Since Parsoid is starting to emit canonical wikitext for links,
20180 # [http://example.com http://example.com] will not RT back to that
20181 # form anymore.
20182 !! test
20183 Proper conversion of text in external links
20184 !! options
20185 language=sr variant=sr-ec
20186 parsoid=wt2html
20187 !! wikitext
20188 http://www.google.com
20189 gopher://www.google.com
20190 [http://www.google.com http://www.google.com]
20191 [gopher://www.google.com gopher://www.google.com]
20192 [https://www.google.com irc://www.google.com]
20193 [ftp://www.google.com www.google.com/ftp://dir]
20194 [//www.google.com www.google.com]
20195 !! html/php
20196 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20197 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20198 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20199 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20200 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
20201 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20202 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
20203 </p>
20204 !! html/parsoid
20205 <p><a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20206 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20207 <a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20208 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20209 <a rel="mw:ExtLink" href="https://www.google.com">irc://www.google.com</a>
20210 <a rel="mw:ExtLink" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20211 <a rel="mw:ExtLink" href="//www.google.com">www.гоогле.цом</a></p>
20212 !! end
20213
20214 !! test
20215 Do not convert roman numbers to language variants
20216 !! options
20217 language=sr variant=sr-ec
20218 !! wikitext
20219 Fridrih IV je car.
20220 !! html
20221 <p>Фридрих IV је цар.
20222 </p>
20223 !! end
20224
20225 !! test
20226 Unclosed language converter markup "-{"
20227 !! options
20228 language=sr
20229 !! wikitext
20230 -{T|hello
20231 !! html
20232 <p>-{T|hello
20233 </p>
20234 !! end
20235
20236 !! test
20237 Don't convert raw rule "-{R|=&gt;}-" to "=>"
20238 !! options
20239 language=sr
20240 !! wikitext
20241 -{R|=&gt;}-
20242 !! html
20243 <p>=&gt;
20244 </p>
20245 !!end
20246
20247 !! test
20248 Don't break link parsing if language converter markup is in the caption.
20249 !! options
20250 language=sr variant=sr-ec
20251 !! wikitext
20252 [[Main Page|-{R|main page}-]]
20253 !! html
20254 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
20255 </p>
20256 !! end
20257
20258 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20259 !! test
20260 Don't break image parsing if language converter markup is in the caption.
20261 !! options
20262 language=sr
20263 !! wikitext
20264 [[File:Foobar.jpg|-{R|caption}-]]
20265 !! html/parsoid
20266 <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>
20267 </p>
20268 !! end
20269
20270 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20271 !! test
20272 Don't break list handling if language converter markup is in the item.
20273 !! options
20274 language=zh variant=zh-cn
20275 !! wikitext
20276 ;-{zh-cn:AAA;zh-tw:BBB}-
20277 !! html/php
20278 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
20279
20280 !! html/parsoid
20281 <dl><dt>AAA
20282 </dt></dl>
20283 !! end
20284
20285 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20286 !! test
20287 Don't break table handling if language converter markup is in the cell.
20288 !! options
20289 language=sr variant=sr-ec
20290 !! wikitext
20291 {|
20292 |-
20293 | -{R|B}-
20294 |}
20295 !! html/php
20296 <table>
20297
20298 <tr>
20299 <td>Б}-
20300 </td></tr></table>
20301
20302 !! html/parsoid
20303 <table>
20304
20305 <tr>
20306 <td> B
20307 </td></tr></table>
20308
20309 !! end
20310
20311 !! test
20312 Bug 529: Uncovered bullet
20313 !! wikitext
20314 * Foo {{bullet}}
20315 !! html
20316 <ul><li> Foo </li>
20317 <li> Bar</li></ul>
20318
20319 !! end
20320
20321 # Plain MediaWiki does not remove empty lists, but tidy actually does.
20322 # Templates in Wikipedia rely on this behavior, as tidy has always been
20323 # enabled there. These tests are normally run *without* tidy, so specify the
20324 # full output here.
20325 # To test realistic parsing behavior, apply a tidy-like transformation to both
20326 # the expected output and your parser's output.
20327 !! test
20328 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
20329 !! wikitext
20330 ******* Foo {{bullet}}
20331 !! html
20332 <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>
20333 <li> Bar</li></ul>
20334
20335 !! end
20336
20337 !! test
20338 Bug 529: Uncovered table already at line-start
20339 !! wikitext
20340 x
20341
20342 {{table}}
20343 y
20344 !! html
20345 <p>x
20346 </p>
20347 <table>
20348 <tr>
20349 <td> 1 </td>
20350 <td> 2
20351 </td></tr>
20352 <tr>
20353 <td> 3 </td>
20354 <td> 4
20355 </td></tr></table>
20356 <p>y
20357 </p>
20358 !! end
20359
20360 !! test
20361 Bug 529: Uncovered bullet in parser function result
20362 !! wikitext
20363 * Foo {{lc:{{bullet}} }}
20364 !! html
20365 <ul><li> Foo </li>
20366 <li> bar</li></ul>
20367
20368 !! end
20369
20370 !! test
20371 Bug 5678: Double-parsed template argument
20372 !! wikitext
20373 {{lc:{{{1}}}|hello}}
20374 !! html
20375 <p>{{{1}}}
20376 </p>
20377 !! end
20378
20379 !! test
20380 Bug 5678: Double-parsed template invocation
20381 !! wikitext
20382 {{lc:{{paramtest {{!}} param = hello }} }}
20383 !! html
20384 <p>{{paramtest | param = hello }}
20385 </p>
20386 !! end
20387
20388 !! test
20389 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
20390 !! options
20391 language=cs
20392 title=[[Main Page]]
20393 !! wikitext
20394 {{PRVNÍVELKÉ:ěščř}}
20395 {{prvnívelké:ěščř}}
20396 {{PRVNÍMALÉ:ěščř}}
20397 {{prvnímalé:ěščř}}
20398 {{MALÁ:ěščř}}
20399 {{malá:ěščř}}
20400 {{VELKÁ:ěščř}}
20401 {{velká:ěščř}}
20402 !! html
20403 <p>Ěščř
20404 Ěščř
20405 ěščř
20406 ěščř
20407 ěščř
20408 ěščř
20409 ĚŠČŘ
20410 ĚŠČŘ
20411 </p>
20412 !! end
20413
20414 !! test
20415 Morwen/13: Unclosed link followed by heading
20416 !! wikitext
20417 [[link
20418 ==heading==
20419 !! html
20420 <p>[[link
20421 </p>
20422 <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>
20423
20424 !! end
20425
20426 !! test
20427 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
20428 !! wikitext
20429 {{foo|
20430 =heading=
20431 !! html
20432 <p>{{foo|
20433 </p>
20434 <h1><span class="mw-headline" id="heading">heading</span></h1>
20435
20436 !! end
20437
20438 !! test
20439 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
20440 !! wikitext
20441 {{foo|
20442 ==heading==
20443 !! html
20444 <p>{{foo|
20445 </p>
20446 <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>
20447
20448 !! end
20449
20450 !! test
20451 Tildes in comments
20452 !! options
20453 pst
20454 !! wikitext
20455 <!-- ~~~~ -->
20456 !! html/php
20457 <!-- ~~~~ -->
20458 !! end
20459
20460 !! test
20461 Paragraphs inside divs (no extra line breaks)
20462 !! wikitext
20463 <div>Line one
20464
20465 Line two</div>
20466 !! html
20467 <div>Line one
20468 Line two</div>
20469
20470 !! end
20471
20472 !! test
20473 Paragraphs inside divs (extra line break on open)
20474 !! wikitext
20475 <div>
20476 Line one
20477
20478 Line two</div>
20479 !! html
20480 <div>
20481 <p>Line one
20482 </p>
20483 Line two</div>
20484
20485 !! end
20486
20487 !! test
20488 Paragraphs inside divs (extra line break on close)
20489 !! wikitext
20490 <div>Line one
20491
20492 Line two
20493 </div>
20494 !! html
20495 <div>Line one
20496 <p>Line two
20497 </p>
20498 </div>
20499
20500 !! end
20501
20502 !! test
20503 Paragraphs inside divs (extra line break on open and close)
20504 !! wikitext
20505 <div>
20506 Line one
20507
20508 Line two
20509 </div>
20510 !! html
20511 <div>
20512 <p>Line one
20513 </p><p>Line two
20514 </p>
20515 </div>
20516
20517 !! end
20518
20519 !! test
20520 Nesting tags, paragraphs on lines which begin with <div>
20521 !! wikitext
20522 <div></div><strong>A
20523 B</strong>
20524 !! html/php+tidy
20525 <p><strong>A</strong></p>
20526 <p><strong>B</strong></p>
20527 !! html/parsoid
20528 <div></div>
20529 <p><strong>A
20530 B</strong>
20531 </p>
20532 !! end
20533
20534 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
20535 !! test
20536 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
20537 !! wikitext
20538 <blockquote>Line one
20539
20540 Line two</blockquote>
20541 !! html
20542 <blockquote>Line one
20543 Line two</blockquote>
20544
20545 !! html+tidy
20546 <blockquote>
20547 <p>Line one Line two</p>
20548 </blockquote>
20549 !! end
20550
20551 !! test
20552 Bug 6200: paragraphs inside blockquotes (extra line break on open)
20553 !! wikitext
20554 <blockquote>
20555 Line one
20556
20557 Line two</blockquote>
20558 !! html
20559 <blockquote>
20560 <p>Line one
20561 </p>
20562 Line two</blockquote>
20563
20564 !! html+tidy
20565 <blockquote>
20566 <p>Line one</p>
20567 Line two</blockquote>
20568 !! end
20569
20570 !! test
20571 Bug 6200: paragraphs inside blockquotes (extra line break on close)
20572 !! wikitext
20573 <blockquote>Line one
20574
20575 Line two
20576 </blockquote>
20577 !! html
20578 <blockquote>Line one
20579 <p>Line two
20580 </p>
20581 </blockquote>
20582
20583 !! html+tidy
20584 <blockquote>
20585 <p>Line one</p>
20586 <p>Line two</p>
20587 </blockquote>
20588 !! end
20589
20590 !! test
20591 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
20592 !! wikitext
20593 <blockquote>
20594 Line one
20595
20596 Line two
20597 </blockquote>
20598 !! html
20599 <blockquote>
20600 <p>Line one
20601 </p><p>Line two
20602 </p>
20603 </blockquote>
20604
20605 !! html+tidy
20606 <blockquote>
20607 <p>Line one</p>
20608 <p>Line two</p>
20609 </blockquote>
20610 !! end
20611
20612 !! test
20613 Paragraphs inside blockquotes/divs (no extra line breaks)
20614 !! wikitext
20615 <blockquote><div>Line one
20616
20617 Line two</div></blockquote>
20618 !! html
20619 <blockquote><div>Line one
20620 Line two</div></blockquote>
20621
20622 !! end
20623
20624 !! test
20625 Paragraphs inside blockquotes/divs (extra line break on open)
20626 !! wikitext
20627 <blockquote><div>
20628 Line one
20629
20630 Line two</div></blockquote>
20631 !! html
20632 <blockquote><div>
20633 <p>Line one
20634 </p>
20635 Line two</div></blockquote>
20636
20637 !! end
20638
20639 !! test
20640 Paragraphs inside blockquotes/divs (extra line break on close)
20641 !! wikitext
20642 <blockquote><div>Line one
20643
20644 Line two
20645 </div></blockquote>
20646 !! html
20647 <blockquote><div>Line one
20648 <p>Line two
20649 </p>
20650 </div></blockquote>
20651
20652 !! end
20653
20654 !! test
20655 Paragraphs inside blockquotes/divs (extra line break on open and close)
20656 !! wikitext
20657 <blockquote><div>
20658 Line one
20659
20660 Line two
20661 </div></blockquote>
20662 !! html
20663 <blockquote><div>
20664 <p>Line one
20665 </p><p>Line two
20666 </p>
20667 </div></blockquote>
20668
20669 !! end
20670
20671 !! test
20672 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
20673 !! options
20674 wgLinkHolderBatchSize=0
20675 !! wikitext
20676 [[meatball:1]]
20677 [[meatball:2]]
20678 [[meatball:3]]
20679 !! html
20680 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
20681 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
20682 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
20683 </p>
20684 !! end
20685
20686 !! test
20687 Free external link invading image caption
20688 !! wikitext
20689 [[Image:Foobar.jpg|thumb|http://x|hello]]
20690 !! html
20691 <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>
20692
20693 !! end
20694
20695 !! test
20696 Bug 15196: localised external link numbers
20697 !! options
20698 language=fa
20699 !! wikitext
20700 [http://en.wikipedia.org/]
20701 !! html/php
20702 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
20703 </p>
20704 !! html/parsoid
20705 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
20706 !! end
20707
20708 !! test
20709 Multibyte character in padleft
20710 !! wikitext
20711 {{padleft:-Hello|7|Æ}}
20712 !! html
20713 <p>Æ-Hello
20714 </p>
20715 !! end
20716
20717 !! test
20718 Multibyte character in padright
20719 !! wikitext
20720 {{padright:Hello-|7|Æ}}
20721 !! html
20722 <p>Hello-Æ
20723 </p>
20724 !! end
20725
20726 !!test
20727 formatdate parser function
20728 !! wikitext
20729 {{#formatdate:2009-03-24}}
20730 !! html
20731 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
20732 </p>
20733 !! end
20734
20735 !!test
20736 formatdate parser function, with default format
20737 !! wikitext
20738 {{#formatdate:2009-03-24|mdy}}
20739 !! html
20740 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
20741 </p>
20742 !! end
20743
20744 !! test
20745 Spacing of numbers in formatted dates
20746 !! wikitext
20747 {{#formatdate:January 15}}
20748 !! html
20749 <p><span class="mw-formatted-date" title="01-15">January 15</span>
20750 </p>
20751 !! end
20752
20753 !! test
20754 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
20755 !! options
20756 language=nl title=[[MediaWiki:Common.css]]
20757 !! wikitext
20758 {{#formatdate:2009-03-24|dmy}}
20759 !! html
20760 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
20761 </p>
20762 !! end
20763
20764 #
20765 #
20766 #
20767
20768 #
20769 # Edit comments
20770 #
20771
20772 !! test
20773 Edit comment with link
20774 !! options
20775 comment
20776 !! wikitext
20777 I like the [[Main Page]] a lot
20778 !! html/php
20779 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
20780 !!end
20781
20782 !! test
20783 Edit comment with link and link text
20784 !! options
20785 comment
20786 !! wikitext
20787 I like the [[Main Page|best pages]] a lot
20788 !! html/php
20789 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20790 !!end
20791
20792 !! test
20793 Edit comment with link and link text with suffix
20794 !! options
20795 comment
20796 !! wikitext
20797 I like the [[Main Page|best page]]s a lot
20798 !! html/php
20799 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20800 !!end
20801
20802 !! test
20803 Edit comment with section link (non-local, eg in history list)
20804 !! options
20805 comment title=[[Main Page]]
20806 !! wikitext
20807 /* External links */ removed bogus entries
20808 !! html/php
20809 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20810 !!end
20811
20812 !! test
20813 Edit comment with section link and text before it (non-local, eg in history list)
20814 !! options
20815 comment title=[[Main Page]]
20816 !! wikitext
20817 pre-comment text /* External links */ removed bogus entries
20818 !! html/php
20819 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>
20820 !!end
20821
20822 !! test
20823 Edit comment with section link (local, eg in diff view)
20824 !! options
20825 comment local title=[[Main Page]]
20826 !! wikitext
20827 /* External links */ removed bogus entries
20828 !! html/php
20829 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20830 !!end
20831
20832 !! test
20833 Edit comment with subpage link (bug 14080)
20834 !! options
20835 comment
20836 subpage
20837 title=[[Subpage test]]
20838 !! wikitext
20839 Poked at a [[/subpage]] here...
20840 !! html/php
20841 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
20842 !!end
20843
20844 !! test
20845 Edit comment with subpage link and link text (bug 14080)
20846 !! options
20847 comment
20848 subpage
20849 title=[[Subpage test]]
20850 !! wikitext
20851 Poked at a [[/subpage|neat little page]] here...
20852 !! html/php
20853 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
20854 !!end
20855
20856 !! test
20857 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
20858 !! options
20859 comment
20860 title=[[Subpage test]]
20861 !! wikitext
20862 Poked at a [[/subpage]] here...
20863 !! html/php
20864 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...
20865 !!end
20866
20867 !! test
20868 Edit comment with bare anchor link (local, as on diff)
20869 !! options
20870 comment
20871 local
20872 title=[[Main Page]]
20873 !! wikitext
20874 [[#section]]
20875 !! html/php
20876 <a href="#section">#section</a>
20877 !! end
20878
20879 !! test
20880 Edit comment with bare anchor link (non-local, as on history)
20881 !! options
20882 comment
20883 title=[[Main Page]]
20884 !! wikitext
20885 [[#section]]
20886 !! html/php
20887 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
20888 !! end
20889
20890 !! test
20891 Anchor starting with underscore
20892 !! options
20893 title=[[Foo]]
20894 !! wikitext
20895 [[#_ref|One]]
20896 !! html/php
20897 <p><a href="#_ref">One</a>
20898 </p>
20899 !! html/parsoid
20900 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
20901 !! end
20902
20903 !! test
20904 Id starting with underscore
20905 !! wikitext
20906 <div id="_ref"></div>
20907 !! html/*
20908 <div id="_ref"></div>
20909
20910 !! end
20911
20912 !! test
20913 Edit comment with link with more than one pipe (T99346)
20914 !! options
20915 comment
20916 !! wikitext
20917 [[Main Page|Many|pipes]]
20918 !! html
20919 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
20920 !! end
20921
20922 !! test
20923 Complex edit comment with link with more than one pipe (T99346)
20924 !! options
20925 comment
20926 !! wikitext
20927 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
20928 !! html
20929 Created page with &quot;&lt;noinclude&gt;<a href="/index.php?title=Category:Requests_for_permissions/Bot&amp;action=edit&amp;redlink=1" class="new" title="Category:Requests for permissions/Bot (page does not exist)">{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}</a>&lt;/noinclude&gt; === <a href="/index.php?title=User:MineoBot&amp;action=edit&amp;redlink=1" class="new" title="User:MineoBot (page does not exist)">User:MineoBot</a> 8=== {{Request for permissions/links|Mineo...&quot;
20930 !! end
20931
20932 !! test
20933 Space normalisation on autocomment (bug 22784)
20934 !! options
20935 comment
20936 title=[[Main Page]]
20937 !! wikitext
20938 /* __hello__world__ */
20939 !! html/php
20940 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
20941 !! end
20942
20943 !! test
20944 percent-encoding and + signs in comments (Bug 26410)
20945 !! options
20946 comment
20947 !! wikitext
20948 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
20949 !! html/php
20950 <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>
20951 !! end
20952
20953 # Parsoid doesn't support this yet: see bug 73581
20954 # but it *should* omit the 'src' attribute if the image is bad.
20955 # PHP side of tests was disabled in
20956 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
20957 # because of issues in the PHP parserTests infrastructure
20958 # (but the output below is indeed what the PHP side emits)
20959 !! test
20960 Bad images - basic functionality
20961 !! wikitext
20962 [[File:Bad.jpg]]
20963 !! DISABLED/html/php
20964 !! html/parsoid
20965 <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>
20966 !! end
20967
20968 !! test
20969 Bad images - bug 16039: text after bad image disappears
20970 !! wikitext
20971 Foo bar
20972 [[File:Bad.jpg]]
20973 Bar foo
20974 !! DISABLED/html/php
20975 <p>Foo bar
20976 </p><p>Bar foo
20977 </p>
20978 !! html/parsoid
20979 <p>Foo bar
20980 <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>
20981 Bar foo</p>
20982 !! end
20983
20984 !! test
20985 Verify that displaytitle works (bug #22501) no displaytitle
20986 !! options
20987 showtitle
20988 !! config
20989 wgAllowDisplayTitle=true
20990 wgRestrictDisplayTitle=false
20991 !! wikitext
20992 this is not the the title
20993 !! html/php
20994 Parser test
20995 <p>this is not the the title
20996 </p>
20997 !! end
20998
20999 !! test
21000 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
21001 !! options
21002 showtitle
21003 title=[[Screen]]
21004 !! config
21005 wgAllowDisplayTitle=true
21006 wgRestrictDisplayTitle=false
21007 !! wikitext
21008 this is not the the title
21009 {{DISPLAYTITLE:whatever}}
21010 !! html/php
21011 whatever
21012 <p>this is not the the title
21013 </p>
21014 !! end
21015
21016 !! test
21017 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
21018 !! options
21019 showtitle
21020 title=[[Screen]]
21021 !! config
21022 wgAllowDisplayTitle=true
21023 wgRestrictDisplayTitle=true
21024 !! wikitext
21025 this is not the the title
21026 {{DISPLAYTITLE:whatever}}
21027 !! html/php
21028 Screen
21029 <p>this is not the the title
21030 </p>
21031 !! end
21032
21033 !! test
21034 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
21035 !! options
21036 showtitle
21037 title=[[Screen]]
21038 !! config
21039 wgAllowDisplayTitle=true
21040 wgRestrictDisplayTitle=true
21041 !! wikitext
21042 this is not the the title
21043 {{DISPLAYTITLE:screen}}
21044 !! html/php
21045 screen
21046 <p>this is not the the title
21047 </p>
21048 !! end
21049
21050 !! test
21051 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
21052 !! options
21053 showtitle
21054 title=[[Screen]]
21055 !! config
21056 wgAllowDisplayTitle=false
21057 !! wikitext
21058 this is not the the title
21059 {{DISPLAYTITLE:screen}}
21060 !! html/php
21061 Screen
21062 <p>this is not the the title
21063 <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>
21064 </p>
21065 !! end
21066
21067 !! test
21068 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
21069 !! options
21070 showtitle
21071 title=[[Screen]]
21072 !! config
21073 wgAllowDisplayTitle=false
21074 !! wikitext
21075 this is not the the title
21076 !! html/php
21077 Screen
21078 <p>this is not the the title
21079 </p>
21080 !! end
21081
21082 !! test
21083 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
21084 !! options
21085 showtitle
21086 title=[[Screen]]
21087 !! config
21088 wgAllowDisplayTitle=true
21089 wgRestrictDisplayTitle=true
21090 !! wikitext
21091 this is not the the title
21092 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
21093 !! html/php
21094 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
21095 <p>this is not the the title
21096 </p>
21097 !! end
21098
21099 !! test
21100 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
21101 !! options
21102 showtitle
21103 title=[[Screen]]
21104 !! config
21105 wgAllowDisplayTitle=true
21106 wgRestrictDisplayTitle=true
21107 !! wikitext
21108 this is not the the title
21109 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
21110 !! html/php
21111 <span style="color: red;">s</span>creen
21112 <p>this is not the the title
21113 </p>
21114 !! end
21115
21116 !! test
21117 Page status indicators: Empty name is invalid
21118 !! options
21119 showindicators
21120 !! wikitext
21121 <indicator name=" "></indicator>
21122 <indicator></indicator>
21123 !! html
21124 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21125 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21126 </p>
21127 !! end
21128
21129 !! test
21130 Page status indicators: Weird syntaxes that are okay
21131 !! options
21132 showindicators
21133 !! wikitext
21134 <indicator name="empty" />
21135 <indicator name="name"></indicator>
21136 !! html
21137 empty=
21138 name=
21139 <p><br />
21140 </p>
21141 !! end
21142
21143 !! test
21144 Page status indicators: Torture test
21145 !! options
21146 showindicators
21147 !! wikitext
21148 <indicator name="01">hello world</indicator>
21149 <indicator name="02">[[Main Page]]</indicator>
21150 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
21151 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
21152 <indicator name="05">* foo
21153 * bar</indicator>
21154 <indicator name="06"><nowiki>foo</nowiki></indicator>
21155 <indicator name="07"> Preformatted</indicator>
21156 <indicator name="08"><div>Broken tag</indicator>
21157 <indicator name="09">{| class=wikitable
21158 | cell
21159 |}</indicator>
21160 <indicator name="10">Two
21161
21162 paragraphs</indicator>
21163 !! html
21164 01=hello world
21165 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21166 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" />
21167 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>
21168 05=<ul><li> foo</li>
21169 <li> bar</li></ul>
21170
21171 06=foo
21172 07=<pre>Preformatted
21173 </pre>
21174 08=<div>Broken tag</div>
21175
21176 09=<table class="wikitable">
21177 <tr>
21178 <td> cell
21179 </td></tr></table>
21180
21181 10=<p>Two
21182 </p><p>paragraphs
21183 </p>
21184 <p><br />
21185 </p><p><br />
21186 </p><p><br />
21187 </p><p><br />
21188 </p><p><br />
21189 </p>
21190 !! end
21191
21192 !! test
21193 preload: check <noinclude> and <includeonly>
21194 !! options
21195 preload
21196 !! wikitext
21197 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
21198 !! html/php
21199 Hello kind world.
21200 !! end
21201
21202 !! test
21203 preload: check <onlyinclude>
21204 !! options
21205 preload
21206 !! wikitext
21207 Goodbye <onlyinclude>Hello world</onlyinclude>
21208 !! html/php
21209 Hello world
21210 !! end
21211
21212 !! test
21213 preload: can pass tags through if we want to
21214 !! options
21215 preload
21216 !! wikitext
21217 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
21218 !! html/php
21219 <includeonly>Hello world</includeonly>
21220 !! end
21221
21222 !! test
21223 preload: check that it doesn't try to do tricks
21224 !! options
21225 preload
21226 !! wikitext
21227 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21228 !! html/php
21229 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21230 !! end
21231
21232 !! test
21233 Play a bit with r67090 and bug 3158
21234 !! wikitext
21235 <div style="width:50% !important">&nbsp;</div>
21236 <div style="width:50%&nbsp;!important">&nbsp;</div>
21237 <div style="width:50%&#160;!important">&nbsp;</div>
21238 <div style="border : solid;">&nbsp;</div>
21239 !! html/php
21240 <div style="width:50% !important">&#160;</div>
21241 <div style="width:50% !important">&#160;</div>
21242 <div style="width:50% !important">&#160;</div>
21243 <div style="border&#160;: solid;">&#160;</div>
21244
21245 !! html/parsoid
21246 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21247 <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>
21248 <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>
21249 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21250
21251 !! end
21252
21253 !! test
21254 HTML5 data attributes
21255 !! wikitext
21256 <span data-foo="bar">Baz</span>
21257 <p data-abc-def_hij="">Quuz</p>
21258 !! html/php
21259 <p><span data-foo="bar">Baz</span>
21260 </p>
21261 <p data-abc-def_hij="">Quuz</p>
21262
21263 !! html/parsoid
21264 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
21265 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
21266 !! end
21267
21268 !! test
21269 Strip reserved data attributes
21270 !! wikitext
21271 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
21272 !! html/php
21273 <div data-ok="fred">d</div>
21274
21275 !! html/parsoid
21276 <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>
21277 !! end
21278
21279 !! test
21280 percent-encoding and + signs in internal links (Bug 26410)
21281 !! wikitext
21282 [[User:+%]] [[Page+title%]]
21283 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
21284 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
21285 [[%33%45]] [[%33%45+]]
21286 !! html/php
21287 <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>
21288 <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>
21289 <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>
21290 <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>
21291 </p>
21292 !! html/parsoid
21293 <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>
21294 <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>
21295 <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>
21296 <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>
21297 !! end
21298
21299 !! test
21300 Special characters in embedded file links (bug 27679)
21301 !! wikitext
21302 [[File:Contains & ampersand.jpg]]
21303 [[File:Does not exist.jpg|Title with & ampersand]]
21304 !! html/php
21305 <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>
21306 <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>
21307 </p>
21308 !! html/parsoid
21309 <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>
21310 <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>
21311 !! end
21312
21313 !! test
21314 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
21315 !! wikitext
21316 Text&apos;s been normalized?
21317 !! html
21318 <p>Text&#39;s been normalized?
21319 </p>
21320 !! end
21321
21322 !! test
21323 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
21324 !! wikitext
21325 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
21326 !! html
21327 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
21328 </p>
21329 !! end
21330
21331 !! test
21332 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
21333 !! wikitext
21334 [http://www.example.org/ ideograms]
21335 !! html
21336 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
21337 </p>
21338 !! end
21339
21340 !! test
21341 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
21342 !! wikitext
21343 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
21344 !! html
21345 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
21346 </p>
21347 !! end
21348
21349 !! article
21350 Mediawiki:loop1
21351 !! text
21352 {{Identical|A}}
21353 !! endarticle
21354
21355 !! article
21356 Mediawiki:loop2
21357 !! text
21358 {{Identical|B}}
21359 !! endarticle
21360
21361 !! article
21362 Template:Identical
21363 !! text
21364 {{int:loop1}}
21365 {{int:loop2}}
21366 !! endarticle
21367
21368 !! test
21369 Bug 31098 Template which includes system messages which includes the template
21370 !! wikitext
21371 {{Identical}}
21372 !! html
21373 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21374 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21375 </p>
21376 !! end
21377
21378 !! test
21379 Bug31490 Turkish: ucfirst 'blah'
21380 !! options
21381 language=tr
21382 !! wikitext
21383 {{ucfirst:blah}}
21384 !! html
21385 <p>Blah
21386 </p>
21387 !! end
21388
21389 !! test
21390 Bug31490 Turkish: ucfirst 'ix'
21391 !! options
21392 language=tr
21393 !! wikitext
21394 {{ucfirst:ix}}
21395 !! html
21396 <p>İx
21397 </p>
21398 !! end
21399
21400 !! test
21401 Bug31490 Turkish: lcfirst 'BLAH'
21402 !! options
21403 language=tr
21404 !! wikitext
21405 {{lcfirst:BLAH}}
21406 !! html
21407 <p>bLAH
21408 </p>
21409 !! end
21410
21411 !! test
21412 Bug31490 Turkish: ucfırst (with a dotless i)
21413 !! options
21414 language=tr
21415 !! wikitext
21416 {{ucfırst:blah}}
21417 !! html
21418 <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>
21419 </p>
21420 !! end
21421
21422 !! test
21423 Bug31490 ucfırst (with a dotless i) with English language
21424 !! options
21425 language=en
21426 !! wikitext
21427 {{ucfırst:blah}}
21428 !! html
21429 <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>
21430 </p>
21431 !! end
21432
21433 !! test
21434 Bug 26375: TOC with italics
21435 !! options
21436 title=[[Main Page]]
21437 !! wikitext
21438 __TOC__
21439 == ''Lost'' episodes ==
21440 !! html
21441 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21442 <ul>
21443 <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>
21444 </ul>
21445 </div>
21446
21447 <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>
21448
21449 !! end
21450
21451 !! test
21452 Bug 26375: TOC with bold
21453 !! options
21454 title=[[Main Page]]
21455 !! wikitext
21456 __TOC__
21457 == '''should be bold''' then normal text ==
21458 !! html
21459 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21460 <ul>
21461 <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>
21462 </ul>
21463 </div>
21464
21465 <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>
21466
21467 !! end
21468
21469 !! test
21470 Bug 33845: Headings become cursive in TOC when they contain an image
21471 !! options
21472 title=[[Main Page]]
21473 !! wikitext
21474 __TOC__
21475 == Image [[Image:foobar.jpg]] ==
21476 !! html
21477 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21478 <ul>
21479 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
21480 </ul>
21481 </div>
21482
21483 <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>
21484
21485 !! end
21486
21487 !! test
21488 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
21489 !! options
21490 title=[[Main Page]]
21491 !! wikitext
21492 __TOC__
21493 == <blockquote>Quote</blockquote> ==
21494 !! html
21495 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21496 <ul>
21497 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21498 </ul>
21499 </div>
21500
21501 <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>
21502
21503 !! html+tidy
21504 <p></p>
21505 <div id="toc" class="toc">
21506 <div id="toctitle">
21507 <h2>Contents</h2>
21508 </div>
21509 <ul>
21510 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21511 </ul>
21512 </div>
21513 <p></p>
21514 <h2><span class="mw-headline" id="Quote"></span></h2>
21515 <blockquote>
21516 <p><span class="mw-headline" id="Quote">Quote</span></p>
21517 </blockquote>
21518 <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>
21519 !! end
21520
21521 !! test
21522 Unclosed tags in TOC
21523 !! options
21524 title=[[Main Page]]
21525 !! wikitext
21526 __TOC__
21527 == Proof: 2 < 3 ==
21528 <small>Hanc marginis exiguitas non caperet.</small>
21529 QED
21530 !! html
21531 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21532 <ul>
21533 <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>
21534 </ul>
21535 </div>
21536
21537 <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>
21538 <p><small>Hanc marginis exiguitas non caperet.</small>
21539 QED
21540 </p>
21541 !! end
21542
21543 !! test
21544 Multiple tags in TOC
21545 !! wikitext
21546 __TOC__
21547 == <i>Foo</i> <b>Bar</b> ==
21548
21549 == <i>Foo</i> <blockquote>Bar</blockquote> ==
21550 !! html
21551 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21552 <ul>
21553 <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>
21554 <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>
21555 </ul>
21556 </div>
21557
21558 <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>
21559 <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>
21560
21561 !! html+tidy
21562 <p></p>
21563 <div id="toc" class="toc">
21564 <div id="toctitle">
21565 <h2>Contents</h2>
21566 </div>
21567 <ul>
21568 <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>
21569 <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>
21570 </ul>
21571 </div>
21572 <p></p>
21573 <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>
21574 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
21575 <blockquote>
21576 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
21577 </blockquote>
21578 <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>
21579 !! end
21580
21581 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
21582 # html5 tag parsing.
21583 !! test
21584 Tags with parameters in TOC
21585 !! options
21586 parsoid=wt2html
21587 !! wikitext
21588 __TOC__
21589 == <sup class="in-h2">Hello</sup> ==
21590
21591 == <sup class="a > b">Evilbye</sup> ==
21592 !! html/php
21593 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21594 <ul>
21595 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
21596 <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>
21597 </ul>
21598 </div>
21599
21600 <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>
21601 <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>
21602
21603 !! html/parsoid
21604 <meta property="mw:PageProp/toc" />
21605 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
21606
21607 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
21608 !! end
21609
21610 !! test
21611 span tags with directionality in TOC
21612 !! wikitext
21613 __TOC__
21614 == <span dir="ltr">C++</span> ==
21615
21616 == <span dir="rtl">זבנג!</span> ==
21617
21618 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
21619
21620 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
21621
21622 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
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="#C.2B.2B"><span class="tocnumber">1</span> <span class="toctext"><span dir="ltr">C++</span></span></a></li>
21627 <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>
21628 <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>
21629 <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>
21630 <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>
21631 </ul>
21632 </div>
21633
21634 <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>
21635 <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>
21636 <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>
21637 <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>
21638 <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>
21639
21640 !! end
21641
21642 !! test
21643 Bug 72884: bdi element in ToC
21644 !! wikitext
21645 __TOC__
21646 == <bdi>test</bdi> ==
21647 !! html
21648 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21649 <ul>
21650 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
21651 </ul>
21652 </div>
21653
21654 <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>
21655
21656 !! end
21657
21658 # Note that the html output does not have the <p></p>, but the
21659 # html+tidy output *does*. This is because the empty <p></p> is
21660 # removed by the sanitizer, but only when tidy is *not* enabled (!).
21661 !! test
21662 Empty <p> tag in TOC, removed by Sanitizer (T92892)
21663 !! wikitext
21664 __TOC__
21665 == x ==
21666 !! html
21667 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21668 <ul>
21669 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21670 </ul>
21671 </div>
21672
21673 <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>
21674
21675 !! html+tidy
21676 <p></p>
21677 <div id="toc" class="toc">
21678 <div id="toctitle">
21679 <h2>Contents</h2>
21680 </div>
21681 <ul>
21682 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21683 </ul>
21684 </div>
21685 <p></p>
21686 <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>
21687 !! end
21688
21689 !! article
21690 MediaWiki:Bug32057
21691 !! text
21692 == {{int:headline_sample}} ==
21693 !! endarticle
21694
21695 !! test
21696 Bug 32057: Title needed when expanding <h> nodes.
21697 !! options
21698 title=[[Main Page]]
21699 !! wikitext
21700 {{int:Bug32057}}
21701 !! html
21702 <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>
21703
21704 !! end
21705
21706 !! test
21707 Strip marker in urlencode
21708 !! wikitext
21709 {{urlencode:x<nowiki/>y}}
21710 {{urlencode:x<nowiki/>y|wiki}}
21711 {{urlencode:x<nowiki/>y|path}}
21712 {{urlencode:x<pre id="one">two</pre>y}}
21713 !! html
21714 <p>xy
21715 xy
21716 xy
21717 xy
21718 </p>
21719 !! end
21720
21721 !! test
21722 Strip marker in lc
21723 !! wikitext
21724 {{lc:x<nowiki/>y}}
21725 !! html
21726 <p>xy
21727 </p>
21728 !! end
21729
21730 !! test
21731 Strip marker in uc
21732 !! wikitext
21733 {{uc:x<nowiki/>y}}
21734 !! html
21735 <p>XY
21736 </p>
21737 !! end
21738
21739 !! test
21740 Strip marker in formatNum
21741 !! wikitext
21742 {{formatnum:1<nowiki/>2}}
21743 {{formatnum:1<nowiki/>2|R}}
21744 !! html
21745 <p>12
21746 12
21747 </p>
21748 !! end
21749
21750 !! test
21751 Check noCommafy in formatNum
21752 !! options
21753 language=be-tarask
21754 !! wikitext
21755 {{formatnum:123456.78}}
21756 {{formatnum:123456.78|NOSEP}}
21757 !! html
21758 <p>123 456,78
21759 123456.78
21760 </p>
21761 !! end
21762
21763 !! test
21764 Wrong option for formatNum (bug 56199)
21765 !! wikitext
21766 {{formatnum:1,234.56|Random}}
21767 {{formatnum:1,234.56|EVERYTHING}}
21768 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
21769 !! html
21770 <p>1,234.56
21771 1,234.56
21772 1,234.56
21773 </p>
21774 !! end
21775
21776 !! test
21777 Strip marker in grammar
21778 !! options
21779 language=fi
21780 !! wikitext
21781 {{grammar:elative|foo<nowiki/>bar}}
21782 !! html
21783 <p>foobarista
21784 </p>
21785 !! end
21786
21787 !! test
21788 Strip marker in padleft
21789 !! wikitext
21790 {{padleft:|2|x<nowiki/>y}}
21791 !! html
21792 <p>xy
21793 </p>
21794 !! end
21795
21796 !! test
21797 Strip marker in padright
21798 !! wikitext
21799 {{padright:|2|x<nowiki/>y}}
21800 !! html
21801 <p>xy
21802 </p>
21803 !! end
21804
21805 !! test
21806 Strip marker in anchorencode
21807 !! wikitext
21808 {{anchorencode:x<nowiki/>y}}
21809 !! html
21810 <p>xy
21811 </p>
21812 !! end
21813
21814 !! test
21815 nowiki inside link inside heading (bug 18295)
21816 !! wikitext
21817 ==[[foo|x<nowiki>y</nowiki>z]]==
21818 !! html
21819 <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>
21820
21821 !! end
21822
21823 !! test
21824 new support for bdi element (bug 31817)
21825 !! wikitext
21826 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21827 !! html
21828 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21829
21830 !!end
21831
21832 !! test
21833 Ignore pipe between table row attributes
21834 !! wikitext
21835 {|
21836 | quux
21837 |- id=foo | style='color: red'
21838 | bar
21839 |}
21840 !! html
21841 <table>
21842 <tr>
21843 <td> quux
21844 </td></tr>
21845 <tr id="foo" style="color: red">
21846 <td> bar
21847 </td></tr></table>
21848
21849 !! end
21850
21851 !!test
21852 Gallery override link with WikiLink (bug 34852)
21853 !! wikitext
21854 <gallery>
21855 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
21856 </gallery>
21857 !! html
21858 <ul class="gallery mw-gallery-traditional">
21859 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21860 <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>
21861 <div class="gallerytext">
21862 <p>caption
21863 </p>
21864 </div>
21865 </div></li>
21866 </ul>
21867
21868 !! end
21869
21870 !!test
21871 Gallery override link with absolute external link (bug 34852)
21872 !! wikitext
21873 <gallery>
21874 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21875 </gallery>
21876 !! html
21877 <ul class="gallery mw-gallery-traditional">
21878 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21879 <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>
21880 <div class="gallerytext">
21881 <p>caption
21882 </p>
21883 </div>
21884 </div></li>
21885 </ul>
21886
21887 !! end
21888
21889 !!test
21890 Gallery override link with malicious javascript (bug 34852)
21891 !! wikitext
21892 <gallery>
21893 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21894 </gallery>
21895 !! html
21896 <ul class="gallery mw-gallery-traditional">
21897 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21898 <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>
21899 <div class="gallerytext">
21900 <p>caption
21901 </p>
21902 </div>
21903 </div></li>
21904 </ul>
21905
21906 !! end
21907
21908 !!test
21909 Gallery with invalid title as link (bug 43964)
21910 !! wikitext
21911 <gallery>
21912 File:foobar.jpg|link=<
21913 </gallery>
21914 !! html
21915 <ul class="gallery mw-gallery-traditional">
21916 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21917 <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>
21918 <div class="gallerytext">
21919 </div>
21920 </div></li>
21921 </ul>
21922
21923 !! end
21924
21925 !!test
21926 Language parser function
21927 !! wikitext
21928 {{#language:ar}}
21929 !! html
21930 <p>العربية
21931 </p>
21932 !! end
21933
21934 !!test
21935 Padleft and padright as substr
21936 !! wikitext
21937 {{padleft:|3|abcde}}
21938 {{padright:|3|abcde}}
21939 !! html
21940 <p>abc
21941 abc
21942 </p>
21943 !! end
21944
21945 !!test
21946 Special parser function
21947 !! wikitext
21948 {{#special:RandomPage}}
21949 {{#special:BaDtItLe}}
21950 {{#special:Foobar}}
21951 !! html
21952 <p>Special:Random
21953 Special:Badtitle
21954 Special:Foobar
21955 </p>
21956 !! end
21957
21958 !!test
21959 Bug 34939 - Case insensitive link parsing ([HttP://])
21960 !! wikitext
21961 [HttP://MediaWiki.Org/]
21962 !! html/php
21963 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
21964 </p>
21965 !! html/parsoid
21966 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
21967 !! end
21968
21969 !!test
21970 Bug 34939 - Case insensitive link parsing ([HttP:// title])
21971 !! wikitext
21972 [HttP://MediaWiki.Org/ MediaWiki]
21973 !! html
21974 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
21975 </p>
21976 !! end
21977
21978 !!test
21979 Bug 34939 - Case insensitive link parsing (HttP://)
21980 !! wikitext
21981 HttP://MediaWiki.Org/
21982 !! html/php
21983 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
21984 </p>
21985 !! html/parsoid
21986 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
21987 !! end
21988
21989 !!test
21990 Disable TOC
21991 !! options
21992 notoc
21993 !! wikitext
21994 Lead
21995 == Section 1 ==
21996 == Section 2 ==
21997 == Section 3 ==
21998 == Section 4 ==
21999 == Section 5 ==
22000 !! html
22001 <p>Lead
22002 </p>
22003
22004 <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>
22005 <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>
22006 <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>
22007 <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>
22008 <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>
22009
22010 !! end
22011
22012
22013 ###
22014 ### Parsoid-specific tests
22015 ### Parsoid-PHP parser incompatibilities
22016 ###
22017 !!test
22018 1. SOL-sensitive wikitext tokens as template-args
22019 !!options
22020 parsoid=wt2html,wt2wt
22021 !! wikitext
22022 {{echo|*a}}
22023 {{echo|#a}}
22024 {{echo|:a}}
22025 !! html
22026 <span about="#mwt1" typeof="mw:Transclusion">
22027 </span><ul about="#mwt1"><li>a</li>
22028 </ul>
22029 <span about="#mwt2" typeof="mw:Transclusion">
22030 </span><ol about="#mwt2"><li>a</li>
22031 </ol>
22032 <span about="#mwt3" typeof="mw:Transclusion">
22033 </span><dl about="#mwt3"><dd>a</dd>
22034 </dl>
22035 !!end
22036
22037 #### -----------------------------------------------------------------
22038 #### Parsoid-specific functionality tests
22039 #### -----------------------------------------------------------------
22040
22041 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
22042 # We know wt2wt will fail, but we expect selser to pass.
22043 # Due to the nature of our testing, wt2wt and selser tests will enter the
22044 # blacklist and we'll catch selser regressions based on changes to the
22045 # blacklist entries for selser tests.
22046 !! test
22047 1. Bad treebuilder fixup of formatting elt is cleaned up
22048 !! options
22049 parsoid=wt2html,wt2wt
22050 !! wikitext
22051 {|
22052 |
22053 <small>
22054 [[Image:Foobar.jpg|right|Test]]
22055 </small>
22056 |}
22057 !! html/parsoid
22058 <table>
22059 <tbody><tr><td>
22060 <small>
22061 <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>
22062 </small>
22063 </td></tr>
22064 </tbody></table>
22065 !! end
22066
22067 !! test
22068 2. Bad treebuilder fixup of formatting elt is cleaned up
22069 !! options
22070 parsoid=wt2html,wt2wt
22071 !! wikitext
22072 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
22073
22074 <small>[[Image:Foobar.jpg|right|300px]]</small>
22075 !! html/parsoid
22076
22077 <p><b>foo</b></p>
22078 <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>
22079 <p><b>bar</b></p>
22080 <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>
22081 !! end
22082
22083 !! test
22084 3. Bad treebuilder fixup of formatting elt is cleaned up
22085 !! options
22086 parsoid=wt2html,wt2wt
22087 !! wikitext
22088 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
22089 !! html/parsoid
22090 <p><small><b>foo</b></small></p>
22091 <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>
22092 <p><small><b>bar</b></small></p>
22093 !! end
22094
22095 !! test
22096 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
22097 !! options
22098 parsoid=wt2html,wt2wt
22099 !! wikitext
22100 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
22101 !! html/parsoid
22102 <p><b><small></small></b></p>
22103 <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>
22104 <p></p>
22105 !! end
22106
22107 #### ----------------------------------------------------------------
22108 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
22109 #### tags. Parsoid's output for these tags differs from that of the
22110 #### PHP parser.
22111 #### ----------------------------------------------------------------
22112
22113 !!test
22114 Ref: 1. ref-location should be replaced with an index span
22115 !! wikitext
22116 A <ref>foo</ref>
22117 B <ref name="x">foo</ref>
22118 C <ref name="y" />
22119 <references />
22120 !! html/parsoid
22121 <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>
22122 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>
22123 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>
22124 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22125 <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>
22126 <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>
22127 <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>
22128 </ol>
22129 !!end
22130
22131 !!test
22132 Ref: 2. ref-tags with identical names should all get the same index
22133 !! wikitext
22134 A <ref name="x">foo</ref>
22135 B <ref name="x" />
22136 <references />
22137 !! html/parsoid
22138 <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>
22139 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>
22140 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22141 <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>
22142 </ol>
22143 !!end
22144
22145 !!test
22146 Ref: 3. spaces in ref-names should be ignored
22147 !! wikitext
22148 A <ref name="x">foo</ref>
22149 B <ref name=" x " />
22150 C <ref name= x />
22151 <references />
22152 !! html/parsoid
22153 <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>
22154 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>
22155 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>
22156 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22157 <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>
22158 </ol>
22159 !!end
22160
22161 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
22162 !!test
22163 Ref: 4. 'constructor' should be accepted as a valid ref-name
22164 !! wikitext
22165 A <ref name="constructor">foo</ref>
22166 <references />
22167 !! html/parsoid
22168 <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>
22169 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22170 <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>
22171 </ol>
22172 !!end
22173
22174 !!test
22175 Ref: 5. body should accept generic wikitext
22176 !! wikitext
22177 A <ref>
22178 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
22179 </ref>
22180
22181 <references />
22182 !! html/parsoid
22183 <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>
22184
22185 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22186 <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>
22187 </span></li>
22188 </ol>
22189 !!end
22190
22191 !!test
22192 Ref: 6. indent-pres should not be output in ref-body
22193 !! wikitext
22194 A <ref>
22195 foo
22196 bar
22197 baz
22198 </ref>
22199
22200 <references />
22201 !! html/parsoid
22202 <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>
22203
22204 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22205 <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
22206 bar
22207 baz
22208 </span></li>
22209 </ol>
22210 !!end
22211
22212 !!test
22213 Ref: 7. No p-wrapping in ref-body
22214 !! wikitext
22215 A <ref>
22216 foo
22217
22218 bar
22219
22220
22221 baz
22222
22223
22224
22225 booz
22226 </ref>
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></p>
22231
22232 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22233 <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
22234
22235 bar
22236
22237
22238 baz
22239
22240
22241
22242 booz
22243 </span></li>
22244 </ol>
22245 !!end
22246
22247 !!test
22248 Ref: 8. transclusion wikitext has lower precedence
22249 !! wikitext
22250 A <ref> foo {{echo|</ref> B C}}
22251
22252 <references />
22253 !! html/parsoid
22254 <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>
22255 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22256 <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>
22257 </ol>
22258 !!end
22259
22260 !!test
22261 Ref: 9. unclosed comments should not leak out of ref-body
22262 !! wikitext
22263 A <ref> foo <!--</ref> B C
22264 <references />
22265 !! html/parsoid
22266 <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>
22267 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22268 <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>
22269 </ol>
22270 !!end
22271
22272 !!test
22273 Ref: 10. Unclosed HTML tags should not leak out of ref-body
22274 !! wikitext
22275 A <ref> <b> foo </ref> B C
22276
22277 <references />
22278 !! html/parsoid
22279 <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>
22280
22281
22282 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22283 <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>
22284 </ol>
22285 !!end
22286
22287 !!test
22288 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
22289 !! wikitext
22290 A <ref>foo</ref> B
22291 C <ref>bar</ref> D
22292 <references />
22293 !! html/parsoid
22294 <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
22295 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>
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">foo</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">bar</span></li>
22299 </ol>
22300 !!end
22301
22302 !!test
22303 Ref: 12. ref-tags act as trailing newline migration barrier
22304 !! wikitext
22305 <!--the newline at the end of this line moves out of the p tag-->a
22306
22307 b<!--the newline at the end of this line stays inside the p tag--> <ref />
22308 <ref />
22309
22310 c
22311 <references />
22312 !! html/parsoid
22313 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
22314
22315
22316 <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>
22317 <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>
22318
22319 <p>c</p>
22320 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22321 <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>
22322 <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>
22323 !!end
22324
22325 !!test
22326 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
22327 !! wikitext
22328 <ref>foo</ref> A
22329 <ref>bar
22330 </ref> B
22331 <references />
22332 !! html/parsoid
22333 <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
22334 <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>
22335 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22336 <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>
22337 <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
22338 </span></li>
22339 </ol>
22340 !!end
22341
22342 !!test
22343 Ref: 14. A nested ref-tag should be emitted as plain text
22344 !! wikitext
22345 <ref>foo <ref>bar</ref> baz</ref>
22346
22347 <references />
22348 !! html/parsoid
22349 <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>
22350 </p>
22351 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22352 <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>
22353 </ol>
22354 !!end
22355
22356 !!test
22357 Ref: 15. ref-tags with identical names should get identical indexes
22358 !! wikitext
22359 A1 <ref name="a">foo</ref> A2 <ref name="a" />
22360 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
22361
22362 <references />
22363 !! html/parsoid
22364 <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>
22365 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>
22366
22367 <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>
22368 </ol>
22369 !!end
22370
22371 ## We don't bother wt2wt-ing non-standard whitespace
22372 !!test
22373 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
22374 !!options
22375 parsoid=wt2html
22376 !! wikitext
22377 A <ref >foo</ref >
22378
22379 <references />
22380 !! html/parsoid
22381 <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>
22382 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22383 <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>
22384 !!end
22385
22386 !!test
22387 Ref: 17. Generate valid HTML5 id/about attributes
22388 !!wikitext
22389 <ref name="a b">foo</ref>
22390
22391 <references />
22392 !!html/parsoid
22393 <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>
22394 </p>
22395
22396 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22397 <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>
22398 </ol>
22399 !!end
22400
22401 !!test
22402 Ref: 18. T58916: Extension attributes should be parsed as plain text
22403 !!wikitext
22404 <ref name="{{echo|a}}">foo</ref>
22405
22406 <references />
22407 !!html/parsoid
22408 <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>
22409 </p>
22410
22411 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22412 <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>
22413 </ol>
22414 !!end
22415
22416 !!test
22417 Ref: 19. ref-tags with identical name encodings should get identical indexes
22418 !! wikitext
22419 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
22420
22421 <references />
22422 !! html/parsoid
22423 <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>
22424 </p>
22425 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22426 <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>
22427 </ol>
22428 !!end
22429
22430 !!test
22431 Ref: 20. ref-tags with identical names but different content should keep it
22432 !! wikitext
22433 A <ref name="foo">Foo one</ref>
22434 B <ref name="foo">Foo two</ref>
22435 C <ref name="foo" />
22436
22437 <references />
22438 !! html/parsoid
22439 <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>
22440 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>
22441 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>
22442
22443 <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>
22444 </ol>
22445 !!end
22446
22447 !!test
22448 References: 1. references tag without any refs should be handled properly
22449 !! wikitext
22450 <references />
22451 !! html/parsoid
22452 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22453 !!end
22454
22455 !!test
22456 References: 2. references tag with group only outputs references from that group
22457 !! wikitext
22458 A <ref group="a">foo</ref>
22459 B <ref group="b">bar</ref>
22460 C <ref>baz</ref>
22461
22462 <references group="a" />
22463 <references />
22464 <references group="b" />
22465 !! html/parsoid
22466 <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>
22467 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>
22468 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>
22469
22470 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
22471 <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>
22472 </ol>
22473 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
22474 <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>
22475 </ol>
22476 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
22477 <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>
22478 </ol>
22479 !!end
22480
22481 !!test
22482 References: 3. ref list should be cleared after processing references
22483 !! wikitext
22484 A <ref>foo</ref>
22485
22486 <references />
22487
22488 B <ref>bar</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":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
22493
22494 <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>
22495 </ol>
22496
22497 <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>
22498
22499 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22500 <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>
22501 </ol>
22502 !!end
22503
22504 !!test
22505 References: 4. only referenced group should be cleared after processing references
22506 !! wikitext
22507 A <ref group="a">afoo</ref>
22508 B <ref>bfoo</ref>
22509
22510 <references group="a" />
22511
22512 C <ref>cfoo</ref>
22513
22514 <references />
22515 !! html/parsoid
22516 <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>
22517 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>
22518
22519 <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>
22520 </ol>
22521
22522 <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>
22523
22524 <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>
22525 </ol>
22526 !!end
22527
22528 ## Don't expect this to rt since we're dropping content
22529 !! test
22530 References: 5. ref tags in references should be processed while ignoring all other content
22531 !! options
22532 parsoid=wt2html,html2html
22533 !! wikitext
22534 A <ref name="a" />
22535 B <ref name="b">bar</ref>
22536
22537 <references>
22538 <ref name="a">foo</ref>
22539 This should just get lost.
22540 </references>
22541 !! html/parsoid
22542 <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>
22543 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>
22544
22545
22546 <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>
22547 </ol>
22548 !! end
22549
22550 !! test
22551 References: 6. <references /> from a transclusion
22552 !! wikitext
22553 <ref>Foo</ref> {{echo|<references />}}
22554 !! html/parsoid
22555 <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>
22556 </ol>
22557 !! end
22558
22559 !! test
22560 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
22561 !! wikitext
22562 A <ref>foo bar for a</ref>
22563 B <ref group="X" name="b" />
22564
22565 <references />
22566
22567 <references group="X">
22568 <ref name="b">foo</ref>
22569 </references>
22570 !! html/parsoid
22571 <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>
22572 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>
22573 </p>
22574
22575 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22576 <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>
22577 </ol>
22578
22579 <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"}}'>
22580 <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>
22581 </ol>
22582 !! end
22583
22584 !! test
22585 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
22586 !! wikitext
22587 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
22588 <references />
22589 !! html/parsoid
22590 <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>
22591 <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>
22592 </ol>
22593 !!end
22594
22595 # This test only works in wt2html now as the <references /> are always generated
22596 # unless selser is active. Once T72722 is fixed, we should add a changes test
22597 # here to ensure that unrelated changes don't add the new <references />
22598 # when selser is active.
22599 !! test
22600 References: 9. Generate missing references list at the end
22601 !! wikitext
22602 A <ref>foo</ref>
22603 B <ref group="inexistent">bar</ref>
22604 !! html/parsoid
22605 <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>
22606 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'>
22607 <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>
22608 </ol>
22609 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"},"autoGenerated":true}'>
22610 <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>
22611 </ol>
22612 !! end
22613
22614 !! test
22615 References: 10. New <references/> shouldn't be added for unrelated edits.
22616 !! options
22617 parsoid={
22618 "modes": ["selser"],
22619 "changes": [["#x", "remove"]],
22620 "selser": "noauto"
22621 }
22622 !! wikitext
22623 Unrelated text<span id="x"> that's going to disappear</span>.
22624 A <ref>foo</ref>
22625 !! wikitext/edited
22626 Unrelated text.
22627 A <ref>foo</ref>
22628 !!end
22629
22630 !! test
22631 Entities in ref name
22632 !! wikitext
22633 <ref name="test &amp; me">hi</ref>
22634 <references />
22635 !! html/parsoid
22636 <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>
22637 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22638 <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>
22639 </ol>
22640 !! end
22641
22642 ## The output here may look funny, but it's what the php parser will do. The
22643 ## unclosed references tag becomes escaped text, and then a new references
22644 ## tag is auto-generated. The test is wt2html only because it roundtrips with
22645 ## nowiki tags, and the auto-generated references tag is only dropped in
22646 ## rtTestMode.
22647 !! test
22648 Generate references for unclosed references tag
22649 !! options
22650 parsoid=wt2html
22651 !! wikitext
22652 a<ref>foo</ref>
22653
22654 <references>
22655 !! html/parsoid
22656 <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>
22657
22658 <p>&lt;references></p>
22659 <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>
22660 !! end
22661
22662 !! test
22663 New reference serializes on its own line
22664 !! options
22665 parsoid=wt2wt,html2wt
22666 !! wikitext
22667 foo
22668 <references />
22669 !! html/parsoid
22670 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22671 !! end
22672
22673 #### ----------------------------------------------------------------
22674 #### Parsoid-only testing of Parsoid's impl of LST
22675 #### Not implemented yet, see
22676 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
22677 #### ----------------------------------------------------------------
22678
22679 !! test
22680 LST Sections: 1. Simple section start and end
22681 !! options
22682 parsoid={ "suppressErrors": true }
22683 !! wikitext
22684 <section begin="2011-05-16" />
22685 <section end="2014-04-10 (MW 1.23wmf22)" />
22686 !! html/parsoid
22687 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
22688 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
22689 !! end
22690
22691 #--------- Test stripping of empty nodes in template content ----------
22692 !!test
22693 Empty LI and TR nodes should be stripped from template content
22694 !!wikitext
22695 {{EmptyLITest}}
22696 {{EmptyTRTest}}
22697 !!html/parsoid
22698 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
22699 <li>a</li>
22700 <li>b</li>
22701 </ul>
22702 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
22703 <tbody>
22704 <tr>
22705 <td>foo</td>
22706 </tr>
22707 <tr>
22708 <td>bar</td>
22709 </tr>
22710 </tbody>
22711 </table>
22712 !!end
22713
22714 !!test
22715 Empty LI and TR nodes should not be stripped from top-level content
22716 !!wikitext
22717 * a
22718 *
22719 * b
22720 {|
22721 |-
22722 |-
22723 |foo
22724 |}
22725 !!html/parsoid
22726 <ul>
22727 <li> a</li>
22728 <li></li>
22729 <li> b</li>
22730 </ul>
22731 <table>
22732 <tbody>
22733 <tr></tr>
22734 <tr>
22735 <td>foo</td>
22736 </tr>
22737 </tbody>
22738 </table>
22739 !!end
22740
22741 !!test
22742 Empty TR nodes should not be stripped if they have any attributes set
22743 !!wikitext
22744 {{EmptyTRWithHTMLAttrTest}}
22745 !!html/parsoid
22746 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
22747 <tr align="center"></tr>
22748 <tr><td>foo</td></tr>
22749 <tr align="center"></tr>
22750 <tr><td>bar</td></tr>
22751 </table>
22752 !!end
22753
22754 #### ----------------------------------------------------------------
22755 #### The following section of tests are primarily to test
22756 #### wikitext escaping capabilities of Parsoid. Given that
22757 #### escaping can be done any number of ways, the wikitext (input)
22758 #### is always adjusted to reflect how Parsoid adds nowiki
22759 #### escape tags.
22760 ####
22761 #### We are marking several tests as parsoid-only since the
22762 #### HTML in the result section is different from what the
22763 #### PHP parser generates for it.
22764 #### ----------------------------------------------------------------
22765
22766
22767 #### --------------- Headings ---------------
22768 #### 0. Unnested
22769 #### 1. Nested inside html <h1>=foo=</h1>
22770 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
22771 #### 3. Nested inside html with wikitext split by html tags
22772 #### 4. No escape needed
22773 #### 5. Empty headings <h1></h1>
22774 #### 6. Heading chars in SOL context
22775 #### ----------------------------------------
22776 !! test
22777 Headings: 0. Unnested
22778 !! options
22779 parsoid=html2wt
22780 !! html/parsoid
22781 <p>=foo=</p>
22782
22783 <p> =foo=
22784 <!--cmt-->
22785 =foo=</p>
22786
22787 <p>=foo<i>a</i>=</p>
22788 !! wikitext
22789 <nowiki>=foo=</nowiki>
22790
22791 <nowiki> </nowiki>=foo=
22792 <!--cmt-->
22793 <nowiki>=foo=</nowiki>
22794
22795 =foo''a''<nowiki>=</nowiki>
22796 !!end
22797
22798 # New headings and existing headings are handled differently
22799 !! test
22800 Headings: 1. Nested inside html
22801 !! options
22802 parsoid=html2wt
22803 !! html/parsoid
22804 <h1>=foo=</h1>
22805 <h2>=foo=</h2>
22806 <h3>=foo=</h3>
22807
22808 <h1 data-parsoid=''>=foo=</h1>
22809 <h2 data-parsoid=''>=foo=</h2>
22810 <h3 data-parsoid=''>=foo=</h3>
22811 <h4 data-parsoid=''>=foo=</h4>
22812 <h5 data-parsoid=''>=foo=</h5>
22813 <h6 data-parsoid=''>=foo=</h6>
22814 !! wikitext
22815 = =foo= =
22816
22817 == =foo= ==
22818
22819 === =foo= ===
22820
22821 =<nowiki>=foo=</nowiki>=
22822 ==<nowiki>=foo=</nowiki>==
22823 ===<nowiki>=foo=</nowiki>===
22824 ====<nowiki>=foo=</nowiki>====
22825 =====<nowiki>=foo=</nowiki>=====
22826 ======<nowiki>=foo=</nowiki>======
22827
22828 !!end
22829
22830 !! test
22831 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
22832 !! options
22833 parsoid=html2wt
22834 !! html/parsoid
22835 <h1>foo</h1>*bar
22836 <h1>foo</h1>=bar
22837 <h1>foo</h1>=bar=
22838 !! wikitext
22839 = foo =
22840 <nowiki>*</nowiki>bar
22841
22842 = foo =
22843 =bar
22844
22845 = foo =
22846 <nowiki>=bar=</nowiki>
22847 !!end
22848
22849 !! test
22850 Headings: 3. Nested inside html with wikitext split by html tags
22851 !! options
22852 parsoid=html2wt
22853 !! html/parsoid
22854 <h1>=<b>bold</b>foo=</h1>
22855 !! wikitext
22856 = ='''bold'''foo= =
22857 !!end
22858
22859 !! test
22860 Headings: 4a. No escaping needed (testing just h1 and h2)
22861 !! options
22862 parsoid=html2wt
22863 !! html/parsoid
22864 <h1>=foo</h1>
22865 <h1>foo=</h1>
22866 <h1> =foo= </h1>
22867 <h1>=foo= bar</h1>
22868 <h2>=foo</h2>
22869 <h2>foo=</h2>
22870 <h1>=</h1>
22871 <h1><i>=</i>foo=</h1>
22872 !! wikitext
22873 = =foo =
22874
22875 = foo= =
22876
22877 = =foo= =
22878
22879 = =foo= bar =
22880
22881 == =foo ==
22882
22883 == foo= ==
22884
22885 = = =
22886
22887 = ''=''foo= =
22888 !!end
22889
22890 !! test
22891 Headings: 4b. No escaping needed (inside p-tags)
22892 !! options
22893 parsoid=html2wt
22894 !! html/parsoid
22895 <p>===
22896 =foo= x
22897 =foo= <s></s>
22898 </p>
22899 !! wikitext
22900 ===
22901 =foo= x
22902 =foo= <s></s>
22903 !!end
22904
22905 !! test
22906 Headings: 5. Empty headings
22907 !! options
22908 parsoid=html2wt
22909 !! html/parsoid
22910 <h1 data-parsoid='{}'></h1>
22911
22912 <h2 data-parsoid='{}'></h2>
22913
22914 <h3 data-parsoid='{}'></h3>
22915
22916 <h4 data-parsoid='{}'></h4>
22917
22918 <h5 data-parsoid='{}'></h5>
22919
22920 <h6 data-parsoid='{}'></h6>
22921 !! wikitext
22922 =<nowiki/>=
22923
22924 ==<nowiki/>==
22925
22926 ===<nowiki/>===
22927
22928 ====<nowiki/>====
22929
22930 =====<nowiki/>=====
22931
22932 ======<nowiki/>======
22933 !!end
22934
22935 !! test
22936 Headings: 6a. Heading chars in SOL context (with trailing spaces)
22937 !! options
22938 parsoid=html2wt
22939 !! html/parsoid
22940 <p>=a=</p>
22941
22942 <p>=a=</p>
22943
22944 <p>=a=</p>
22945 !! wikitext
22946 <nowiki>=a=</nowiki>
22947
22948 <nowiki>=a=</nowiki>
22949
22950 <nowiki>=a=</nowiki>
22951 !!end
22952
22953 !! test
22954 Headings: 6b. Heading chars in SOL context (with trailing newlines)
22955 !! options
22956 parsoid=html2wt
22957 !! html/parsoid
22958 <p>=a=
22959 b</p>
22960
22961 <p>=a=
22962 b</p>
22963
22964 <p>=a=
22965 b</p>
22966 !! wikitext
22967 <nowiki>=a=</nowiki>
22968 b
22969
22970 <nowiki>=a=</nowiki>
22971 b
22972
22973 <nowiki>=a=</nowiki>
22974 b
22975 !!end
22976
22977 !! test
22978 Headings: 6c. Heading chars in SOL context (leading newline break)
22979 !! options
22980 parsoid=html2wt
22981 !! html/parsoid
22982 <p>a
22983 =b=</p>
22984 !! wikitext
22985 a
22986 <nowiki>=b=</nowiki>
22987 !!end
22988
22989 !! test
22990 Headings: 6d. Heading chars in SOL context (with interspersed comments)
22991 !! options
22992 parsoid=html2wt
22993 !! html/parsoid
22994 <!--c0--><p>=a=</p>
22995
22996 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
22997 !! wikitext
22998 <!--c0--><nowiki>=a=</nowiki>
22999
23000 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
23001 !!end
23002
23003 !! test
23004 Headings: 6d. Heading chars in SOL context (No escaping needed)
23005 !! options
23006 parsoid=html2wt
23007 !! html/parsoid
23008 =a=<div>b</div>
23009 !! wikitext
23010 =a=<div>b</div>
23011 !!end
23012
23013 !! test
23014 Headings: 7. Insert a newline between new content and headings
23015 !! options
23016 parsoid=html2wt
23017 !! html/parsoid
23018 <h2>NEW</h2>
23019 <p>new</p>
23020 <h2 data-parsoid='{}'>A</h2>
23021 <p data-parsoid='{}'>a</p>
23022 !! wikitext
23023 == NEW ==
23024 new
23025
23026 ==A==
23027 a
23028
23029 !! end
23030
23031 #### --------------- Lists ---------------
23032 #### 0. Outside nests (*foo, etc.)
23033 #### 1. Nested inside html <ul><li>*foo</li></ul>
23034 #### 2. Inside definition lists
23035 #### 3. Only bullets at start should be escaped
23036 #### 4. No escapes needed
23037 #### 5. No unnecessary escapes
23038 #### 6. Escape bullets in SOL position
23039 #### 7. Escape bullets in a multi-line context
23040 #### ----------------------------------------
23041
23042 !! test
23043 Lists: 0. Outside nests
23044 !! options
23045 parsoid=html2wt
23046 !! html/parsoid
23047 <p>*foo</p>
23048
23049 <p>#foo</p>
23050
23051 <p>;Foo:bar</p>
23052 !! wikitext
23053 <nowiki>*</nowiki>foo
23054
23055 <nowiki>#</nowiki>foo
23056
23057 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
23058 !!end
23059
23060 ## Making these next 3 tests Parsoid-only since they are html2wt tests
23061 ## to test wikitext escaping, and insignificant whitespace diffs
23062 ## cause PHP parser tests to barf
23063 !! test
23064 Lists: 1. Nested inside html (No unnecessary escapes)
23065 !! options
23066 parsoid=html2wt
23067 !! html/parsoid
23068 <ul>
23069 <li>*foo</li>
23070 <li>#foo</li>
23071 <li>:foo</li>
23072 <li>;foo</li>
23073 <li data-parsoid='{}'>*foo</li>
23074 <li data-parsoid='{}'>#foo</li>
23075 <li data-parsoid='{}'>:foo</li>
23076 <li data-parsoid='{}'>;foo</li>
23077 </ul>
23078
23079 <ol>
23080 <li>*foo</li>
23081 <li>#foo</li>
23082 <li>:foo</li>
23083 <li>;foo</li>
23084 <li data-parsoid='{}'>*foo</li>
23085 <li data-parsoid='{}'>#foo</li>
23086 <li data-parsoid='{}'>:foo</li>
23087 <li data-parsoid='{}'>;foo</li>
23088 </ol>
23089 !! wikitext
23090 * *foo
23091 * #foo
23092 * :foo
23093 * ;foo
23094 *<nowiki>*foo</nowiki>
23095 *<nowiki>#foo</nowiki>
23096 *<nowiki>:foo</nowiki>
23097 *<nowiki>;foo</nowiki>
23098
23099 # *foo
23100 # #foo
23101 # :foo
23102 # ;foo
23103 #<nowiki>*foo</nowiki>
23104 #<nowiki>#foo</nowiki>
23105 #<nowiki>:foo</nowiki>
23106 #<nowiki>;foo</nowiki>
23107 !!end
23108
23109 !! test
23110 Lists: 2. Inside definition lists
23111 !! options
23112 parsoid=html2wt
23113 !! html/parsoid
23114 <dl><dt>;foo</dt></dl>
23115 <dl><dt>:foo</dt></dl>
23116 <dl><dt>:foo</dt>
23117 <dd>bar</dd></dl>
23118 <dl><dd>:foo</dd></dl>
23119 !! wikitext
23120 ; ;foo
23121
23122 ; <nowiki>:foo</nowiki>
23123
23124 ; <nowiki>:foo</nowiki>
23125 : bar
23126
23127 : :foo
23128 !!end
23129
23130 !! test
23131 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
23132 !! options
23133 parsoid=html2wt
23134 !! html/parsoid
23135 <ul>
23136 <li>*foo*bar</li>
23137 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
23138 </ul>
23139 !! wikitext
23140 * *foo*bar
23141 *<nowiki>*foo</nowiki>''it''*bar
23142 !!end
23143
23144 !! test
23145 Lists: 4. No escapes needed
23146 !! options
23147 parsoid=html2wt
23148 !! html/parsoid
23149 <ul>
23150 <li>foo*bar
23151 </li>
23152 </ul>
23153 <ul>
23154 <li><i>foo</i>*bar
23155 </li>
23156 </ul>
23157 <ul>
23158 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
23159 </li>
23160 </ul>
23161 <ul>
23162 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
23163 </li>
23164 </ul>
23165 !! wikitext
23166 *foo*bar
23167
23168 *''foo''*bar
23169
23170 *[[Foo]]: bar
23171
23172 *[[Foo]]*bar
23173 !!end
23174
23175 !! test
23176 Lists: 5. No unnecessary escapes
23177 !! options
23178 parsoid=html2wt
23179 !! html/parsoid
23180 <ul><li> bar <span>[[foo]]</span></li></ul>
23181 <ul><li> =bar <span>[[foo]]</span></li></ul>
23182 <ul><li> [[bar <span>[[foo]]</span></li></ul>
23183 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
23184 <ul><li> =bar <span>foo]]</span>=</li></ul>
23185 <ul><li> <s></s>: a</li></ul>
23186 <ul><li> <i>* foo</i></li></ul>
23187
23188 !! wikitext
23189 * bar <span><nowiki>[[foo]]</nowiki></span>
23190
23191 * =bar <span><nowiki>[[foo]]</nowiki></span>
23192
23193 * [[bar <span><nowiki>[[foo]]</nowiki></span>
23194
23195 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
23196
23197 * =bar <span>foo]]</span>=
23198
23199 * <s></s>: a
23200
23201 * ''* foo''
23202 !!end
23203
23204 !! test
23205 Lists: 6. Escape bullets in SOL position
23206 !! options
23207 parsoid=html2wt
23208 !! html/parsoid
23209 <p><!--cmt-->*foo</p>
23210 !! wikitext
23211 <!--cmt--><nowiki>*</nowiki>foo
23212 !!end
23213
23214 !! test
23215 Lists: 7. Escape bullets in a multi-line context
23216 !! options
23217 parsoid=html2wt
23218 !! html/parsoid
23219 <p>a
23220 *b
23221 </p>
23222 !! wikitext
23223 a
23224 <nowiki>*</nowiki>b
23225 !!end
23226
23227 !! test
23228 Lists: 8. Escape colons only if not present in tags
23229 !! options
23230 parsoid=html2wt
23231 !! html/parsoid
23232 <dl><dt>a:b<i>c:d</i></dt></dl>
23233 !! wikitext
23234 ; <nowiki>a:b</nowiki>''c:d''
23235 !! end
23236
23237 #### --------------- HRs ---------------
23238 #### 1. Single line
23239 #### -----------------------------------
23240
23241 !! test
23242 HRs: 1. Single line
23243 !! options
23244 parsoid=html2wt
23245 !! html/parsoid
23246 <hr />----
23247 <hr />=foo=
23248 <hr />*foo
23249 !! wikitext
23250 ----<nowiki>----</nowiki>
23251 ----=foo=
23252 ----*foo
23253 !! end
23254
23255 #### --------------- Tables ---------------
23256 #### 1a. Simple example
23257 #### 1b. No escaping needed (!foo)
23258 #### 1c. No escaping needed (|foo)
23259 #### 1d. No escaping needed (|}foo)
23260 ####
23261 #### 2a. Nested in td (<td>foo|bar</td>)
23262 #### 2b. Nested in td (<td>foo||bar</td>)
23263 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
23264 ####
23265 #### 3a. Nested in th (<th>foo!bar</th>)
23266 #### 3b. Nested in th (<th>foo!!bar</th>)
23267 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
23268 ####
23269 #### 4a. Escape -
23270 #### 4b. Escape +
23271 #### 4c. No escaping needed
23272 #### --------------------------------------
23273
23274 !! test
23275 Tables: 1a. Simple example
23276 !! options
23277 parsoid=html2wt
23278 !! html/parsoid
23279 <p>{|
23280 |}
23281 </p>
23282 !! wikitext
23283 <nowiki>{|</nowiki>
23284 |}
23285 !! end
23286
23287 !! test
23288 Tables: 1b. No escaping needed
23289 !! options
23290 parsoid=html2wt
23291 !! html/parsoid
23292 <p>!foo
23293 </p>
23294 !! wikitext
23295 !foo
23296 !! end
23297
23298 !! test
23299 Tables: 1c. No escaping needed
23300 !! options
23301 parsoid=html2wt
23302 !! html/parsoid
23303 <p>|foo
23304 </p>
23305 !! wikitext
23306 |foo
23307 !! end
23308
23309 !! test
23310 Tables: 1d. No escaping needed
23311 !! options
23312 parsoid=html2wt
23313 !! html/parsoid
23314 <p>|}foo
23315 </p>
23316 !! wikitext
23317 |}foo
23318 !! end
23319
23320 !! test
23321 Tables: 2a. Nested in td
23322 !! options
23323 parsoid=html2wt
23324 !! html/parsoid
23325 <table><tbody><tr>
23326 <td>foo|bar</td></tr>
23327 <tr><td>x<div>a|b</div></td>
23328 </tbody></table>
23329 !! wikitext
23330 {|
23331 |<nowiki>foo|bar</nowiki>
23332 |-
23333 |x<div><nowiki>a|b</nowiki></div>
23334 |}
23335 !! html/php+tidy
23336 <table>
23337 <tr>
23338 <td>foo|bar</td>
23339 </tr>
23340 <tr>
23341 <td>x
23342 <div>a|b</div>
23343 </td>
23344 </tr>
23345 </table>
23346 !! end
23347
23348 !! test
23349 Tables: 2b. Nested in td
23350 !! options
23351 parsoid=html2wt
23352 !! html/parsoid
23353 <table><tbody><tr>
23354 <td>foo||bar</td>
23355 <td>a<i>b||c</i></td>
23356 <td>a<i><div>b||c</div></i></td>
23357 </tr></tbody></table>
23358 !! wikitext
23359 {|
23360 |<nowiki>foo||bar</nowiki>
23361 |a''<nowiki>b||c</nowiki>''
23362 |a''<div><nowiki>b||c</nowiki></div>''
23363 |}
23364 !! html/php
23365 <table>
23366 <tr>
23367 <td>foo||bar
23368 </td>
23369 <td>a<i>b||c</i>
23370 </td>
23371 <td>a<i><div>b||c</div></i>
23372 </td></tr></table>
23373
23374 !! end
23375
23376 !! test
23377 Tables: 2c. Nested in td -- no escaping needed
23378 !! options
23379 parsoid=html2wt
23380 !! html/*
23381 <table>
23382 <tr>
23383 <td>foo!!bar
23384 </td></tr></table>
23385
23386 !! wikitext
23387 {|
23388 |foo!!bar
23389 |}
23390 !! end
23391
23392 !! test
23393 Tables: 3a. Nested in th
23394 !! options
23395 parsoid=html2wt
23396 !! html/*
23397 <table>
23398 <tr>
23399 <th>foo!bar
23400 </th></tr></table>
23401
23402 !! wikitext
23403 {|
23404 !foo!bar
23405 |}
23406 !! end
23407
23408 !! test
23409 Tables: 3b. Nested in th
23410 !! options
23411 parsoid=html2wt
23412 !! html/parsoid
23413 <table><tbody>
23414 <tr><th>foo!!bar</th>
23415 <th><i>foo|bar</i></th>
23416 <th><i>foo!!bar</i></th>
23417 <th><i><span>foo!!bar</span></i></th>
23418 </tr></tbody></table>
23419 !! wikitext
23420 {|
23421 !<nowiki>foo!!bar</nowiki>
23422 !''<nowiki>foo|bar</nowiki>''
23423 !''<nowiki>foo!!bar</nowiki>''
23424 !''<span><nowiki>foo!!bar</nowiki></span>''
23425 |}
23426 !! html/php
23427 <table>
23428 <tr>
23429 <th>foo!!bar
23430 </th>
23431 <th><i>foo|bar</i>
23432 </th>
23433 <th><i>foo!!bar</i>
23434 </th>
23435 <th><i><span>foo!!bar</span></i>
23436 </th></tr></table>
23437
23438 !! end
23439
23440 !! test
23441 Tables: 3c. Nested in th
23442 !! options
23443 parsoid=html2wt
23444 !! html/parsoid
23445 <table><tbody>
23446 <tr><th>foo||bar</th>
23447 <th><span typeof="mw:Nowiki">foo||bar</span></th>
23448 </tr></tbody></table>
23449 !! wikitext
23450 {|
23451 !<nowiki>foo||bar</nowiki>
23452 !<nowiki>foo||bar</nowiki>
23453 |}
23454 !! html/php
23455 <table>
23456 <tr>
23457 <th>foo||bar
23458 </th>
23459 <th>foo||bar
23460 </th></tr></table>
23461
23462 !! end
23463
23464 !! test
23465 Tables: 4a. Escape -
23466 !! options
23467 parsoid=html2wt
23468 !! html/*
23469 <table>
23470 <tr>
23471 <th>-bar
23472 </th></tr>
23473 <tr>
23474 <td>-bar
23475 </td></tr></table>
23476
23477 !! wikitext
23478 {|
23479 !-bar
23480 |-
23481 |<nowiki>-bar</nowiki>
23482 |}
23483 !! end
23484
23485 !! test
23486 Tables: 4b. Escape +
23487 !! options
23488 parsoid=html2wt
23489 !! html/*
23490 <table>
23491 <tr>
23492 <th>+bar
23493 </th></tr>
23494 <tr>
23495 <td>+bar
23496 </td></tr></table>
23497
23498 !! wikitext
23499 {|
23500 !+bar
23501 |-
23502 |<nowiki>+bar</nowiki>
23503 |}
23504 !! end
23505
23506 !! test
23507 Tables: 4c. No escaping needed
23508 !! options
23509 parsoid=html2wt
23510 !! html/parsoid
23511 <table><tbody>
23512 <tr><td>foo-bar</td><td>foo+bar</td></tr>
23513 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
23514 <tr><td>foo
23515 <p>bar|baz
23516 +bar
23517 -bar</p></td></tr>
23518 <tr><td>x
23519 <div>a|b</div></td>
23520 </tbody></table>
23521 !! wikitext
23522 {|
23523 |foo-bar
23524 |foo+bar
23525 |-
23526 |''foo''-bar
23527 |''foo''+bar
23528 |-
23529 |foo
23530 bar|baz
23531 +bar
23532 -bar
23533 |-
23534 |x
23535 <div>a|b</div>
23536 |}
23537 !! html/php
23538 <table>
23539 <tr>
23540 <td>foo-bar
23541 </td>
23542 <td>foo+bar
23543 </td></tr>
23544 <tr>
23545 <td><i>foo</i>-bar
23546 </td>
23547 <td><i>foo</i>+bar
23548 </td></tr>
23549 <tr>
23550 <td>foo
23551 <p>bar|baz
23552 +bar
23553 -bar
23554 </p>
23555 </td></tr>
23556 <tr>
23557 <td>x
23558 <div>a|b</div>
23559 </td></tr></table>
23560
23561 !! end
23562
23563 !! test
23564 Tables: 4d. No escaping needed
23565 !! options
23566 parsoid=html2wt
23567 !! html/parsoid
23568 <table>
23569 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
23570 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
23571 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
23572 </tbody></table>
23573 !! wikitext
23574 {|
23575 |[[Foo]]-bar
23576 ||+1
23577 ||-2
23578 |}
23579 !! html/php
23580 <table>
23581 <tr>
23582 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
23583 </td>
23584 <td>+1
23585 </td>
23586 <td>-2
23587 </td></tr></table>
23588
23589 !! end
23590
23591 !! test
23592 T97430: Don't emit empty nowiki pairs around marker meta tags
23593 !! options
23594 parsoid=html2wt
23595 !! html/parsoid
23596 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23597 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
23598 !! wikitext
23599 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23600 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
23601 !! end
23602
23603 !! test
23604 Unclosed xmlish element in table line shouldn't eat end delimiters
23605 !! options
23606 parsoid=html2wt
23607 !! html/parsoid
23608 <table>
23609 <tbody><tr><td> &lt;foo</td>
23610 <td> bar></td></tr>
23611 </tbody></table>
23612 !! wikitext
23613 {|
23614 | <foo
23615 | bar>
23616 |}
23617 !! html/php
23618 <table>
23619 <tr>
23620 <td> &lt;foo
23621 </td>
23622 <td> bar&gt;
23623 </td></tr></table>
23624
23625 !! end
23626
23627 #### --------------- Links ----------------
23628 #### 1. Quote marks in link text
23629 #### 2. Wikilinks: Escapes needed
23630 #### 3. Wikilinks: No escapes needed
23631 #### 4. Extlinks: Escapes needed
23632 #### 5. Extlinks: No escapes needed
23633 #### --------------------------------------
23634 !! test
23635 Links 1. WikiLinks: No escapes needed
23636 !! options
23637 parsoid=html2wt
23638 !! html/parsoid
23639 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
23640 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
23641 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
23642 !! wikitext
23643 [[Foo|Foo''boo'']]
23644 [[Foo|[Foobar]]]
23645 [[Foo|x [Foobar] x]]
23646 !! html/php
23647 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
23648 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
23649 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
23650 </p>
23651 !! end
23652
23653 !! test
23654 Links 2. WikiLinks: Escapes needed
23655 !! options
23656 parsoid=html2wt
23657 !! html/parsoid
23658 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
23659 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
23660 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
23661 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
23662 <a href="Foo" rel="mw:WikiLink">|Bar</a>
23663 <a href="Foo" rel="mw:WikiLink">]]bar</a>
23664 <a href="Foo" rel="mw:WikiLink">[[bar</a>
23665 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
23666 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
23667 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
23668 !! wikitext
23669 [[Foo|<nowiki>Foobar]</nowiki>]]
23670 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
23671 [[Foo|<nowiki>[[Bar]]</nowiki>]]
23672 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
23673 [[Foo|<nowiki>|Bar</nowiki>]]
23674 [[Foo|<nowiki>]]bar</nowiki>]]
23675 [[Foo|<nowiki>[[bar</nowiki>]]
23676 [[Foo|<nowiki>x [[ y</nowiki>]]
23677 [[Foo|<nowiki>x ]] y</nowiki>]]
23678 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
23679 !! html/php
23680 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
23681 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
23682 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
23683 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
23684 <a href="/wiki/Foo" title="Foo">|Bar</a>
23685 <a href="/wiki/Foo" title="Foo">]]bar</a>
23686 <a href="/wiki/Foo" title="Foo">[[bar</a>
23687 <a href="/wiki/Foo" title="Foo">x [[ y</a>
23688 <a href="/wiki/Foo" title="Foo">x ]] y</a>
23689 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
23690 </p>
23691 !! end
23692
23693 !! test
23694 Links 3. WikiLinks: No escapes needed
23695 !! options
23696 parsoid=html2wt
23697 !! html/parsoid
23698 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
23699 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
23700 !! wikitext
23701 [[Foo|[Foobar]]
23702 [[Foo|foo|bar]]
23703 !! html/php
23704 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
23705 <a href="/wiki/Foo" title="Foo">foo|bar</a>
23706 </p>
23707 !! end
23708
23709 !! test
23710 Links 4. ExtLinks: Escapes needed
23711 !! options
23712 parsoid=html2wt
23713 !! html/parsoid
23714 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
23715 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
23716 <p>[http://google.com]</p>
23717 <p>[http://google.com google]</p>
23718 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
23719 <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>
23720 !! wikitext
23721 [http://google.com <nowiki>[google]</nowiki>]
23722 [http://google.com <nowiki>google]</nowiki>]
23723
23724 <nowiki>[http://google.com]</nowiki>
23725
23726 <nowiki>[http://google.com google]</nowiki>
23727
23728 [http://google.com<nowiki>]</nowiki>
23729
23730 [{{echo|http://google.com}}<nowiki>]</nowiki>
23731 !! html/php
23732 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
23733 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
23734 </p><p>[http://google.com]
23735 </p><p>[http://google.com google]
23736 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23737 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23738 </p>
23739 !! end
23740
23741 !! test
23742 Links 5. ExtLinks: No escapes needed
23743 !! options
23744 parsoid=html2wt
23745 !! html/parsoid
23746 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
23747 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
23748 !! wikitext
23749 [http://google.com [google]
23750
23751 [[http://google.com]]
23752 !! html/php
23753 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
23754 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
23755 </p>
23756 !! end
23757
23758 !! test
23759 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
23760 !! options
23761 parsoid=html2wt
23762 !! html/parsoid
23763 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
23764 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
23765 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
23766 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
23767 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
23768 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
23769 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23770 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
23771 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23772 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
23773 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
23774 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
23775 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
23776 </p>
23777 !! wikitext
23778 x<nowiki/>http://example.com<nowiki/>y
23779 http://example.com<nowiki/>?x
23780 http://example.com<nowiki/>&x
23781 http://example.com<nowiki/>'x
23782 http://example.com<nowiki/>,x
23783 http://example.com<nowiki/>.x
23784 http://example.com<nowiki/>;x
23785 http://example.com<nowiki/>:x
23786 http://example.com<nowiki/>;x
23787 http://example.com<nowiki/>!x
23788 http://example.com<nowiki/>=x
23789 http://example.com<nowiki/>(x)
23790 http://example.com(x<nowiki/>)
23791 !! end
23792
23793 !! test
23794 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23795 !! options
23796 parsoid=html2wt
23797 !! html/parsoid
23798 <p>x
23799 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
23800 y
23801 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
23802 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
23803 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
23804 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
23805 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
23806 </p>
23807 !! wikitext
23808 x
23809 http://example.com
23810 y
23811 "http://example.com"
23812 (http://example.com)
23813 (http://example.com) foo
23814 http://example.com,
23815 http://example.com, foo
23816 !! html/php
23817 <p>x
23818 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
23819 y
23820 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
23821 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
23822 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
23823 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
23824 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
23825 </p>
23826 !! end
23827
23828 !! test
23829 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23830 !! options
23831 parsoid=html2wt
23832 !! html/parsoid
23833 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
23834 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
23835 !! wikitext
23836 http://example.com.,;:!?\
23837 -http://example.com:
23838 !! html/php
23839 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
23840 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
23841 </p>
23842 !! end
23843
23844 !! test
23845 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
23846 !! options
23847 parsoid=html2wt
23848 !! html/parsoid
23849 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
23850 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
23851 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
23852 !! wikitext
23853 RFC 123<nowiki/>4
23854 RFC 123<nowiki/>y
23855 X<nowiki/>RFC 123<nowiki/>y
23856 !! end
23857
23858 !! test
23859 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
23860 !! options
23861 parsoid=html2wt
23862 !! html/parsoid
23863 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
23864 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
23865 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
23866 </p>
23867 !! wikitext
23868 RFC 123?foo
23869 RFC 123&foo
23870 -RFC 123-
23871 !! html/php
23872 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
23873 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
23874 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
23875 </p>
23876 !! end
23877
23878 !! test
23879 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
23880 !! options
23881 parsoid=html2wt
23882 !! html/parsoid
23883 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
23884 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23885 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23886 !! wikitext
23887 PMID 123<nowiki/>4
23888 PMID 123<nowiki/>y
23889 X<nowiki/>PMID 123<nowiki/>y
23890 !! end
23891
23892 !! test
23893 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
23894 !! options
23895 parsoid=html2wt
23896 !! html/parsoid
23897 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
23898 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
23899 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
23900 </p>
23901 !! wikitext
23902 PMID 123?foo
23903 PMID 123&foo
23904 -PMID 123-
23905 !! html/php
23906 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
23907 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
23908 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
23909 </p>
23910 !! end
23911
23912 !! test
23913 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
23914 !! options
23915 parsoid=html2wt
23916 !! html/parsoid
23917 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
23918 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
23919 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
23920 </p>
23921 !! wikitext
23922 ISBN 1234567890<nowiki/>1
23923 ISBN 1234567890<nowiki/>x
23924 a<nowiki/>ISBN 1234567890<nowiki/>b
23925 !! end
23926
23927 !! test
23928 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
23929 !! options
23930 parsoid=html2wt
23931 !! html/parsoid
23932 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
23933 !! wikitext
23934 -ISBN 1234567890's
23935 !! html/php
23936 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
23937 </p>
23938 !! end
23939
23940 !! test
23941 Links 14. Protect link-like plain text. (Parsoid bug T78425)
23942 !! options
23943 parsoid=html2wt
23944 !! html/*
23945 <p>this is not a link: http://example.com
23946 </p>
23947 !! wikitext
23948 this is not a link: <nowiki>http://example.com</nowiki>
23949 !! end
23950
23951 !! test
23952 Links 15. Link trails can't become link prefixes.
23953 !! options
23954 language=is
23955 parsoid=html2wt
23956 !! html/parsoid
23957 <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>
23958 !! wikitext
23959 [[Söfnuður]]-[[00]]
23960 !! html/php
23961 <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>
23962 </p>
23963 !! end
23964
23965 #### --------------- Quotes ---------------
23966 #### 1. Quotes inside <b> and <i>
23967 #### 2. Link fragments separated by <i> and <b> tags
23968 #### 3. Link fragments inside <i> and <b>
23969 #### 4. No escaping needed
23970 #### --------------------------------------
23971 !! test
23972 1a. Quotes inside <b> and <i>
23973 !! options
23974 parsoid=html2wt
23975 !! html/*
23976 <p><i>'foo'</i>
23977 <i>''foo''</i>
23978 <i>'''foo'''</i>
23979 <i>foo</i>'s
23980 <b>'foo'</b>
23981 <b>''foo''</b>
23982 <b>'''foo'''</b>
23983 <b>foo'<i>bar'</i>baz</b>
23984 <b>foo</b>'s
23985 '<i>foo</i>
23986 <i>foo</i>'
23987 <i>foo'</i>'
23988 '<i>foo</i>'
23989 '<b>foo</b>
23990 <b>foo</b>'
23991 '<b>foo</b>'
23992 <i>fools'<span> errand</span></i>
23993 <i><span>fool</span>'s errand</i>
23994 '<i>foo</i> bar '<i>baz</i>
23995 a|!*#-:;+-~[]{}b'<i>x</i>
23996 </p>
23997 !! wikitext
23998 ''<nowiki/>'foo'''
23999 ''<nowiki>''foo''</nowiki>''
24000 ''<nowiki>'''foo'''</nowiki>''
24001 ''foo''<nowiki/>'s
24002 '''<nowiki/>'foo''''
24003 '''<nowiki>''foo''</nowiki>'''
24004 '''<nowiki>'''foo'''</nowiki>'''
24005 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
24006 '''foo'''<nowiki/>'s
24007 '''foo''
24008 ''foo''<nowiki/>'
24009 ''foo'''<nowiki/>'
24010 '''foo''<nowiki/>'
24011 ''''foo'''
24012 '''foo'''<nowiki/>'
24013 ''''foo'''<nowiki/>'
24014 ''fools'<span> errand</span>''
24015 ''<span>fool</span>'s errand''
24016 '<nowiki/>''foo'' bar '''baz''
24017 a|!*#-:;+-~[]{}b'''x''
24018 !! end
24019
24020 !! test
24021 1b. Quotes inside <b> and <i> with other tags on same line
24022 !! options
24023 parsoid=html2wt
24024 !! html/parsoid
24025 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24026 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24027 <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>
24028 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
24029 '<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>
24030 '<i>foo</i> <div title="name">test</div>
24031 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
24032 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
24033 <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>
24034 </ol>
24035 !! wikitext
24036 '''a'' foo ''[[bar]]''
24037 ''a''' foo ''[[bar]]''
24038 ''a''' foo '''{{echo|[[bar]]}}'''
24039 [[foo]] x'''[[bar]]''
24040 '''foo'' <ref>test</ref>
24041 '''foo'' <div title="name">test</div>
24042 '''foo'' and <br> bar
24043 <references />
24044 !! end
24045
24046 !! test
24047 2. Link fragments separated by <i> and <b> tags
24048 !! options
24049 parsoid=html2wt
24050 !! html/parsoid
24051 <p>[[<i>foo</i>hello]]</p>
24052 <p>[[<b>foo</b>hello]]</p>
24053 !! wikitext
24054 [[''foo''<nowiki>hello]]</nowiki>
24055
24056 [['''foo'''<nowiki>hello]]</nowiki>
24057 !! end
24058
24059 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
24060 # this is one of the shortcomings of this format
24061 !! test
24062 3. Link fragments inside <i> and <b>
24063 !! options
24064 parsoid=html2wt
24065 !! html/parsoid
24066 <p><i>[[foo</i>]]</p>
24067 <p><b>[[foo</b>]]</p>
24068 !! wikitext
24069 ''[[foo''<nowiki>]]</nowiki>
24070
24071 '''[[foo'''<nowiki>]]</nowiki>
24072 !! end
24073
24074 !! test
24075 4. No escaping needed
24076 !! options
24077 options=html2wt
24078 !! html/parsoid
24079 <p>'<span><i>bar</i></span>'
24080 '<span><b>bar</b></span>'
24081 'a:b'foo
24082 </p>
24083 !! wikitext
24084 '<span>''bar''</span>'
24085 '<span>'''bar'''</span>'
24086 'a:b'foo
24087 !! end
24088
24089 #### ----------- Paragraphs ---------------
24090 #### 1. No unnecessary escapes
24091 #### --------------------------------------
24092
24093 !! test
24094 1. No unnecessary escapes
24095 !! options
24096 parsoid=html2wt
24097 !! html/parsoid
24098 <p>bar <span>[[foo]]</span>
24099 </p><p>=bar <span>[[foo]]</span>
24100 </p><p>[[bar <span>[[foo]]</span>
24101 </p><p>]]bar <span>[[foo]]</span>
24102 </p><p>=bar <span>foo]]</span>=
24103 </p>
24104 !! wikitext
24105 bar <span><nowiki>[[foo]]</nowiki></span>
24106
24107 =bar <span><nowiki>[[foo]]</nowiki></span>
24108
24109 [[bar <span><nowiki>[[foo]]</nowiki></span>
24110
24111 ]]bar <span><nowiki>[[foo]]</nowiki></span>
24112
24113 =bar <span>foo]]</span><nowiki>=</nowiki>
24114 !!end
24115
24116 #### ----------------------- PRE --------------------------
24117 #### 1. Leading whitespace in SOL context should be escaped
24118 #### ------------------------------------------------------
24119 !! test
24120 1. Leading whitespace in SOL context should be escaped
24121 !! options
24122 parsoid=html2wt
24123 !! html/parsoid
24124 <p> a</p>
24125
24126 <p> a</p>
24127
24128 <p> a(tab)</p>
24129
24130 <p> a
24131 <!--cmt-->
24132 a</p>
24133
24134 <p>a
24135 b</p>
24136
24137 <p>a
24138 b</p>
24139
24140 <p>a
24141 b</p>
24142 !! wikitext
24143 <nowiki> </nowiki>a
24144
24145 <nowiki> </nowiki> a
24146
24147 a(tab)
24148
24149 <nowiki> </nowiki> a
24150 <!--cmt-->
24151 <nowiki> </nowiki>a
24152
24153 a
24154 <nowiki> </nowiki>b
24155
24156 a
24157 b
24158
24159 a
24160 b
24161 !! html/php
24162 <p> a
24163 </p><p> a
24164 </p><p> a(tab)
24165 </p><p> a
24166 a
24167 </p><p>a
24168 b
24169 </p><p>a
24170 b
24171 </p><p>a
24172 b
24173 </p>
24174 !! end
24175
24176 !! test
24177 2. Leading whitespace in non-indent-pre contexts should not be escaped
24178 !! options
24179 parsoid=html2wt
24180 !! html/parsoid
24181 <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>
24182 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
24183 <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>
24184 b</span></li>
24185 </ol>
24186 !! wikitext
24187 foo <ref>''a''
24188 b</ref>
24189 <references />
24190 !! end
24191
24192 !! test
24193 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
24194 !! options
24195 parsoid=html2wt
24196 !! html/parsoid
24197 <blockquote>
24198 <p>
24199 a
24200 <span>b</span>
24201 c</p>
24202 </blockquote>
24203 !! wikitext
24204 <blockquote>
24205 a
24206 <span>b</span>
24207 c
24208 </blockquote>
24209 !! end
24210
24211 !! test
24212 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
24213 !! options
24214 options=html2wt
24215 !! html/parsoid
24216 <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>
24217 !! wikitext
24218 [[File:Foobar.jpg|thumb|caption]]
24219 !! end
24220
24221 !! test
24222 5. Nowiki escaping should account for indent-pres
24223 !! options
24224 parsoid=html2wt
24225 !! html/parsoid
24226 <pre>==foo==</pre>
24227 !! wikitext
24228 ==foo==
24229 !! end
24230
24231 !!test
24232 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
24233 !! options
24234 parsoid=html2wt
24235 !! html/parsoid
24236 <pre>
24237 * foo
24238 * bar
24239 </pre>
24240 !! wikitext
24241 * foo
24242 * bar
24243 !! end
24244
24245 #### --------------- Behavior Switches --------------------
24246
24247 !! test
24248 1. Valid behavior switches should be escaped
24249 !! options
24250 parsoid=html2wt
24251 !! html/parsoid
24252 __TOC__
24253 <i>__TOC__</i>
24254 !! wikitext
24255 <nowiki>__TOC__</nowiki>
24256 ''<nowiki>__TOC__</nowiki>''
24257 !! end
24258
24259 !! test
24260 2. Invalid behavior switches should not be escaped
24261 !! options
24262 parsoid=html2wt
24263 !! html/parsoid
24264 __TOO__
24265 __|__
24266 !! wikitext
24267 __TOO__
24268 __|__
24269 !! end
24270
24271 # We use indent-pre as an indirect way to test for sol-transparent behavior.
24272 !! test
24273 Behavior switches should be SOL-transparent
24274 !! options
24275 parsoid=html2wt
24276 !! html/parsoid
24277 <meta property="mw:PageProp/toc" />
24278
24279 <!-- this one's bogus -->
24280 <pre>__TOO__</pre>
24281
24282 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
24283
24284 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
24285 !! wikitext
24286 __TOC__
24287
24288 <!-- this one's bogus -->
24289 __TOO__
24290
24291 __TOC__ foo
24292
24293 __TOC__
24294 bar
24295 !! end
24296
24297 #### --------------- HTML tags ---------------
24298 #### 1. a tags
24299 #### 2. other tags
24300 #### 3. multi-line html tag
24301 #### 4. extension tags
24302 #### -----------------------------------------
24303 !! test
24304 1. a tags
24305 !! options
24306 parsoid=html2wt
24307 !! html/parsoid
24308 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
24309 !! wikitext
24310 <a href="http://google.com">google</a>
24311 !! end
24312
24313 !! test
24314 2. other tags
24315 !! options
24316 parsoid=html2wt
24317 !! html/parsoid
24318 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
24319 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
24320 <li> &lt;td&gt;</li></ul>
24321
24322 !! wikitext
24323 * <nowiki><div>foo</div></nowiki>
24324 * <nowiki><div style="color:red">foo</div></nowiki>
24325 * <nowiki><td></nowiki>
24326 !! end
24327
24328 !! test
24329 3. multi-line html tag
24330 !! options
24331 parsoid=html2wt
24332 !! html/parsoid
24333 <p>&lt;div
24334 &gt;foo&lt;/div
24335 &gt;
24336 </p>
24337 !! wikitext
24338 <nowiki><div
24339 >foo</div
24340 ></nowiki>
24341 !! end
24342
24343 !! test
24344 4. extension tags
24345 !! options
24346 parsoid=html2wt
24347 !! html/parsoid
24348 <p>&lt;ref&gt;foo&lt;/ref&gt;
24349 </p><p>&lt;ref&gt;bar
24350 </p><p>baz&lt;/ref&gt;
24351 </p>
24352 !! wikitext
24353 <nowiki><ref>foo</ref></nowiki>
24354
24355 <nowiki><ref>bar</nowiki>
24356
24357 baz<nowiki></ref></nowiki>
24358 !! end
24359
24360 #### --------------- Others ---------------
24361 !! test
24362 Escaping nowikis
24363 !! options
24364 parsoid=html2wt
24365 !! html/parsoid
24366 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
24367 </p>
24368 !! wikitext
24369 &lt;nowiki&gt;foo&lt;/nowiki&gt;
24370 !! end
24371
24372 ## The quote-char in the input is necessary for triggering the bug
24373 !! test
24374 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
24375 !! options
24376 parsoid=html2wt
24377 !! html/parsoid
24378 <p>foo's bar :</p>
24379 !! wikitext
24380 foo's bar :
24381 !! end
24382
24383 #----------- End of wikitext escaping tests --------------
24384
24385 !! test
24386
24387 Tag-like HTML structures are passed through as text
24388 !! wikitext
24389 <x y>
24390
24391 <x.y>
24392
24393 <x-y>
24394
24395 1>2
24396
24397 x<y
24398
24399 a>b
24400
24401 1<d e>f
24402 !! html
24403 <p>&lt;x y&gt;
24404 </p><p>&lt;x.y&gt;
24405 </p><p>&lt;x-y&gt;
24406 </p><p>1&gt;2
24407 </p><p>x&lt;y
24408 </p><p>a&gt;b
24409 </p><p>1&lt;d e&gt;f
24410 </p>
24411 !! end
24412
24413 !! test
24414 HTML tag with necessary entities in attributes
24415 !! wikitext
24416 <span title="&amp;amp;">foo</span>
24417 !! html
24418 <p><span title="&amp;amp;">foo</span>
24419 </p>
24420 !! end
24421
24422 !! test
24423 HTML tag with 'unnecessary' entity encoding in attributes
24424 !! wikitext
24425 <span title="&amp;">foo</span>
24426 !! html
24427 <p><span title="&amp;">foo</span>
24428 </p>
24429 !! end
24430
24431 !! test
24432 HTML tag with broken attribute value quoting
24433 !! options
24434 parsoid=wt2html,html2html
24435 !! wikitext
24436 <span title="Hello world>Foo</span>
24437 !! html/php
24438 <p><span title="Hello world">Foo</span>
24439 </p>
24440 !! html/parsoid
24441 <p><span title="Hello world">Foo</span></p>
24442 !! end
24443
24444 !! test
24445 Self-closed tag with broken attribute value quoting
24446 !! options
24447 parsoid=wt2html,html2html
24448 !! wikitext
24449 <div title="Hello world />Foo
24450 !! html/php+tidy
24451 <div title="Hello world"></div>
24452 <p>Foo</p>
24453 !! html/parsoid
24454 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
24455 !! end
24456
24457 !! test
24458 Table with broken attribute value quoting
24459 !! options
24460 parsoid=wt2html,html2html
24461 !! wikitext
24462 {|
24463 | title="Hello world|Foo
24464 |}
24465 !! html/php
24466 <table>
24467 <tr>
24468 <td title="Hello world">Foo
24469 </td></tr></table>
24470
24471 !! html/parsoid
24472 <table>
24473 <tr>
24474 <td title="Hello world">Foo
24475 </td></tr></table>
24476
24477 !! end
24478
24479 !! test
24480 Table with broken attribute value quoting on consecutive lines
24481 !! options
24482 parsoid=wt2html,html2html
24483 !! wikitext
24484 {|
24485 | title="Hello world|Foo
24486 | style="color:red|Bar
24487 |}
24488 !! html/php
24489 <table>
24490 <tr>
24491 <td title="Hello world">Foo
24492 </td>
24493 <td style="color:red">Bar
24494 </td></tr></table>
24495
24496 !! html/parsoid
24497 <table><tbody>
24498 <tr>
24499 <td title="Hello world">Foo
24500 </td><td style="color: red">Bar
24501 </td></tr></tbody></table>
24502
24503 !! end
24504
24505 !!test
24506 Accept empty td cell attribute
24507 !! wikitext
24508 {|
24509 | align="center" | foo || |
24510 |}
24511 !! html
24512 <table>
24513 <tr>
24514 <td align="center"> foo </td>
24515 <td>
24516 </td></tr></table>
24517
24518 !!end
24519
24520 !!test
24521 Non-empty attributes in th-cells
24522 !! wikitext
24523 {|
24524 ! Foo !! style="color: red" | Bar
24525 |}
24526 !! html
24527 <table>
24528 <tr>
24529 <th> Foo </th>
24530 <th style="color: red"> Bar
24531 </th></tr></table>
24532
24533 !!end
24534
24535 !!test
24536 Accept empty attributes in th-cells
24537 !! wikitext
24538 {|
24539 !| foo !!| bar
24540 |}
24541 !! html
24542 <table>
24543 <tr>
24544 <th> foo </th>
24545 <th> bar
24546 </th></tr></table>
24547
24548 !!end
24549
24550 !!test
24551 Empty table rows go away
24552 !! wikitext
24553 {|
24554 | Hello
24555 | there
24556 |- class="foo"
24557 |-
24558 |}
24559 !! html
24560 <table>
24561 <tr>
24562 <td> Hello
24563 </td>
24564 <td> there
24565 </td></tr>
24566
24567 </table>
24568
24569 !! end
24570
24571 ###
24572 ### Parsoid-centric tests for testing RTing of inter-element separators
24573 ### Edge cases not tested by existing parser tests and specific to
24574 ### Parsoid-specific serialization strategies.
24575 ###
24576
24577 !!test
24578 RT-ed inter-element separators should be valid separators
24579 !! wikitext
24580 {|
24581 |- [[foo]]
24582 |}
24583 !! html/php
24584 <table>
24585
24586 </table>
24587
24588 !! html/parsoid
24589 <table>
24590 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
24591 </tbody></table>
24592 !!end
24593
24594 # Parsoid-only since PHP parser relies on Tidy for correct output
24595 !!test
24596 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
24597 !!options
24598 parsoid
24599 !! wikitext
24600 {|
24601 |<small>foo
24602 bar
24603 |}
24604
24605 {|
24606 |<small>foo<small>
24607 |}
24608 !! html
24609 <table>
24610 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
24611 <p>bar</p></small></td></tr>
24612 </tbody></table>
24613
24614 <table>
24615 <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>
24616 </tbody></table>
24617 !!end
24618
24619 # Note that the "style" attribute is really a template parameter here.
24620 # The = would have to be {{=}} if you wanted the literal.
24621 !!test
24622 Empty TD followed by TD with tpl-generated attribute
24623 !! wikitext
24624 {|
24625 |-
24626 |
24627 |{{echo|style='color:red'}}|foo
24628 |}
24629 !! html
24630 <table>
24631
24632 <tr>
24633 <td>
24634 </td>
24635 <td>foo
24636 </td></tr></table>
24637
24638 !!end
24639
24640 !!test
24641 Indented table with an empty td
24642 !! wikitext
24643 {|
24644 |-
24645 |
24646 |foo
24647 |}
24648 !! html
24649 <table>
24650
24651 <tr>
24652 <td>
24653 </td>
24654 <td>foo
24655 </td></tr></table>
24656
24657 !!end
24658
24659 ## We have some newline diffs RT-ing this edge case
24660 ## and it is not important enough -- we seem to be emitting
24661 ## at most 2 newlines after a </tr> and this is unrelated to
24662 ## the issue from T85627 that this is testing.
24663 !!test
24664 Indented table with blank lines in between (T85627)
24665 !! options
24666 parsoid=wt2html
24667 !! wikitext
24668 {|
24669 |foo
24670
24671
24672 |}
24673 !! html
24674 <table>
24675
24676 <tr>
24677 <td>foo
24678 </td></tr></table>
24679
24680 !!end
24681
24682 !!test
24683 Indented block & table
24684 !! wikitext
24685 <div>foo</div>
24686 {|
24687 |foo
24688 |}
24689 !! html/php
24690 <div>foo</div>
24691 <table>
24692 <tr>
24693 <td>foo
24694 </td></tr></table>
24695
24696 !! html/parsoid
24697 <div data-parsoid='{"stx":"html"}'>foo</div>
24698 <table><tbody>
24699 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
24700 </tbody></table>
24701 !!end
24702
24703 !! test
24704 Indent and comment before table row
24705 !! wikitext
24706 {|
24707 <!--hi-->|-
24708 | there
24709 |}
24710 !! html/php
24711 <table>
24712
24713 <tr>
24714 <td> there
24715 </td></tr></table>
24716
24717 !! html/parsoid
24718 <table>
24719 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
24720 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
24721 </tbody></table>
24722 !! end
24723
24724 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
24725 !!test
24726 Empty TR followed by a template-generated TR
24727 !!options
24728 parsoid
24729 !! wikitext
24730 {|
24731 |-
24732 {{echo|<tr><td>foo</td></tr>}}
24733 |}
24734 !! html
24735 <table>
24736 <tbody>
24737 <tr></tr>
24738 <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}}]}'>
24739 <td>foo</td></tr>
24740 </tbody></table>
24741 !!end
24742
24743 ## PHP and parsoid output differ for this, and since this is primarily
24744 ## for testing Parsoid's serializer, marking this Parsoid only
24745 !!test
24746 Empty TR followed by mixed-ws-comment line should RT correctly
24747 !!options
24748 parsoid
24749 !! wikitext
24750 {|
24751 |-
24752 <!--c-->
24753 |-
24754 <!--c--> <!--d-->
24755 |}
24756 !! html
24757 <table>
24758 <tbody>
24759 <tr></tr>
24760 <!--c-->
24761 <tr>
24762 <!--c--> </tr><!--d-->
24763 </tbody></table>
24764
24765 !!end
24766
24767 !!test
24768 Multi-line image caption generated by templates with/without trailing newlines
24769 !! wikitext
24770 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
24771 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
24772 !! html/parsoid
24773 <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>
24774 <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>
24775 !!end
24776
24777 !! test
24778 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
24779 !! options
24780 parsoid=html2wt
24781 !! html/parsoid
24782 <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>
24783
24784 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
24785 !! wikitext
24786 <includeonly>foo</includeonly>
24787 new para
24788
24789 [[Category:Foo]]
24790
24791 = new heading =
24792 !! end
24793
24794 ## PHP emits broken html for this, and since this is primarily
24795 ## a Parsoid serializer test, marking this Parsoid only
24796 !!test
24797 Improperly nested inline or quotes tags with whitespace in between
24798 !! wikitext
24799 <span> <s>x</span> </s>
24800 ''' ''x''' ''
24801 !! html/parsoid
24802 <p><span> <s>x</s></span><s> </s>
24803 <b> <i>x</i></b><i> </i>
24804 </p>
24805 !!end
24806
24807 !!test
24808 Encapsulate protected attributes from wt
24809 !! wikitext
24810 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
24811 !! html/parsoid
24812 <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>
24813 </body>
24814 !!end
24815
24816 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
24817 ## Having nested or stray pre tags results in the attempt to add duplicates,
24818 ## causing an assertion fail. This test tries to prevent that situation.
24819 !!test
24820 Ensure ParagraphWrapper can deal with stray closing pre tags
24821 !!options
24822 parsoid=wt2html
24823 !! wikitext
24824 plain text</pre>
24825 !! html/parsoid
24826 plain text
24827 !!end
24828
24829 !!test
24830 1. Ensure fostered text content is wrapped in element nodes
24831 !!options
24832 parsoid=wt2html
24833 !! wikitext
24834 <table>hi</table><table>ho</table>
24835 !! html/parsoid
24836 <p>hi</p>
24837 <table></table>
24838 <p>ho</p>
24839 <table></table>
24840 !!end
24841
24842 !!test
24843 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
24844 !!options
24845 parsoid=wt2html,wt2wt
24846 !! wikitext
24847 <table>
24848 <tr> || ||
24849 <td> a
24850 </table>
24851 !! html/parsoid
24852 <p> || ||
24853 </p><table>
24854 <tbody><tr><td> a</td></tr>
24855 </tbody></table>
24856 !!end
24857
24858 !!test
24859 Encapsulation properly handles null DSR information from foster box
24860 !!options
24861 parsoid=wt2html,wt2wt
24862 !! wikitext
24863 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
24864 !! html/parsoid
24865 <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>
24866 !!end
24867
24868 !!test
24869 1. Encapsulate foster-parented transclusion content
24870 !!options
24871 parsoid=wt2wt,wt2html
24872 !! wikitext
24873 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
24874 !! html/parsoid
24875 <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>
24876 <tbody>
24877 <tr>
24878 <td>bar</td>
24879 </tr>
24880 </tbody>
24881 </table>
24882 !!end
24883
24884 !!test
24885 2. Encapsulate foster-parented transclusion content
24886 !!options
24887 parsoid=wt2wt,wt2html
24888 !! wikitext
24889 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
24890 !! html/parsoid
24891 <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>
24892 <table>
24893 <tbody>
24894 <tr>
24895 <td>bar</td>
24896 </tr>
24897 </tbody>
24898 </table>
24899 !!end
24900
24901 !!test
24902 3. Encapsulate foster-parented transclusion content
24903 !!options
24904 parsoid=wt2wt,wt2html
24905 !! wikitext
24906 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24907 !! html/parsoid
24908 <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;]}">
24909 <p>foo</p>
24910 </div>
24911 <table>
24912 <tbody>
24913 <tr>
24914 <td>bar</td>
24915 </tr>
24916 </tbody>
24917 </table>
24918 !!end
24919
24920 !!test
24921 4. Encapsulate foster-parented transclusion content
24922 !!options
24923 parsoid=wt2wt,wt2html
24924 !! wikitext
24925 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24926 !! html/parsoid
24927 <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;]}">
24928 <p>foo</p>
24929 </div>
24930 <table>
24931 <tbody>
24932 <tr>
24933 <td>bar</td>
24934 </tr>
24935 </tbody>
24936 </table>
24937 !!end
24938
24939 !!test
24940 5. Encapsulate foster-parented transclusion content
24941 !!options
24942 parsoid=wt2wt,wt2html
24943 !! wikitext
24944 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
24945 !! html/parsoid
24946 <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>
24947 <table>
24948 <tbody>
24949 <tr>
24950 <td>
24951 <div>
24952 <p>foo</p>
24953 </div>
24954 </td>
24955 </tr>
24956 </tbody>
24957 </table>
24958 !!end
24959
24960 !!test
24961 6. Encapsulate foster-parented transclusion content
24962 !!options
24963 parsoid=wt2wt,wt2html
24964 !! wikitext
24965 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
24966 !! html/parsoid
24967 <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>
24968 <table>
24969 <tbody>
24970 <tr>
24971 <td>
24972 <div>
24973 <p>foo</p>
24974 </div>
24975 </td>
24976 </tr>
24977 </tbody>
24978 </table>
24979 <p>ok</p>
24980 !!end
24981
24982 !!test
24983 7. Encapsulate foster-parented transclusion content
24984 !!options
24985 parsoid=wt2wt,wt2html
24986 !! wikitext
24987 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
24988 !! html/parsoid
24989 <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>
24990 <table>
24991 <tbody>
24992 <tr>
24993 <td>bar</td>
24994 </tr>
24995 </tbody>
24996 </table>
24997 !!end
24998
24999 # Note that the wt is broken on purpose: the = should be {{=}} if you
25000 # don't want it to be a template parameter key.
25001 !!test
25002 8. Encapsulate foster-parented transclusion content
25003 !!options
25004 parsoid=wt2wt,wt2html
25005 !! wikitext
25006 {{echo|a
25007 }}{|{{echo|style='color:red'}}
25008 |-
25009 |b
25010 |}
25011 !! html/parsoid
25012 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
25013 <span> </span>
25014 <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>
25015 <table>
25016 <tbody>
25017 <tr>
25018 <td>b</td>
25019 </tr>
25020 </tbody>
25021 </table>
25022 !!end
25023
25024 !!test
25025 9. Encapsulate foster-parented transclusion content
25026 !!options
25027 parsoid=wt2wt,wt2html
25028 !! wikitext
25029 <table>{{echo|hi</table>hello}}
25030 !! html/parsoid
25031 <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>
25032 !!end
25033
25034 !!test
25035 Table in fosterable position
25036 !!options
25037 parsoid=wt2html
25038 !! wikitext
25039 {{OpenTable}}
25040 <div>
25041 {|
25042 |}
25043 </div>
25044 |}
25045 !! html/parsoid
25046 <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">
25047 </span>
25048 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
25049
25050 <table>
25051 </table>
25052 !!end
25053
25054 # Parsoid only for bug 64747
25055 !! test
25056 Properly encapsulate empty-content transclusions in fosterable positions
25057 !! wikitext
25058 <table>
25059 {{#if:|
25060 <td>foo</td>
25061 }}
25062 </table>
25063 !! html/parsoid
25064 <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"}]]}'>
25065
25066 </table>
25067 !! end
25068
25069 !! test
25070 Always encapsulate foster box when template range is expanded to table
25071 !! options
25072 parsoid=wt2wt
25073 !! wikitext
25074 {|
25075 hello
25076 {{OpenTable}}
25077 |}
25078 !! html/parsoid
25079
25080 !! end
25081
25082 !! test
25083 T115289: Unclosed table
25084 !! wikitext
25085 {{echo|<table>}}<!--c-->[[Category:Two]]
25086 !! html/parsoid
25087 <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>
25088 !! end
25089
25090 !! test
25091 T115289: Don't migrate newlines out of tables with fostered content
25092 !! wikitext
25093 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
25094 !! html/parsoid
25095 <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>
25096 !! end
25097
25098 !! test
25099 T73074: More fostering fun
25100 !! wikitext
25101 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
25102 !! html/parsoid
25103 <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>
25104 !! end
25105
25106 !!test
25107 Support <object> element with .data attribute
25108 !!options
25109 parsoid=html2wt
25110 !! html/parsoid
25111 <object data="test.swf"></object>
25112 !! wikitext
25113 <object data="test.swf"></object>
25114 !!end
25115
25116 !! test
25117 Don't block XML namespace declaration
25118 !! wikitext
25119 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25120 !! html/php
25121 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25122 </p>
25123 !! html/parsoid
25124 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
25125 !! end
25126
25127 # -----------------------------------------------------------------
25128 # The following section of tests are primarily to spec requirements
25129 # around Parsoid's serialization (old, new, edited content)
25130 #
25131 # All these tests are marked Parsoid html2wt and html2html only
25132 # ----------------------------------------------------------------
25133
25134 !! test
25135 Ignore rel attribute in a-tags during serialization to url-links
25136 !! options
25137 parsoid=html2wt
25138 !! html/parsoid
25139 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
25140 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
25141 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
25142 !! wikitext
25143 http://en.wikipedia.org/wiki/Foobar
25144 http://en.wikipedia.org/wiki/Foobar
25145 http://en.wikipedia.org/wiki/Foobar
25146 !! end
25147
25148 # 'mi' is a localinterwiki prefix as well as a language
25149 !! test
25150 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
25151 !! options
25152 parsoid=html2wt
25153 !! html/parsoid
25154 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
25155 !! wikitext
25156 [[Foo]]
25157 !! end
25158
25159 # See T93839
25160 !! test
25161 New wikilinks should be serialized properly
25162 !! options
25163 parsoid=html2wt
25164 !! html/parsoid
25165 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
25166 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
25167 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
25168 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
25169 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
25170 !! wikitext
25171 [[Foo]]
25172 [[Foo]]
25173 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
25174 http://en.wikipedia.org/wiki/Foo
25175 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
25176 !! end
25177
25178 !! test
25179 New wiki links (href variations)
25180 !! options
25181 parsoid=html2wt
25182 !! html/parsoid
25183 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25184 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
25185 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
25186 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
25187 !! wikitext
25188 [[Foo_bar]]
25189 [[Foo_bar]]
25190 [[Foo_bar]]
25191 [[Toxine bactérienne]]
25192 !! end
25193
25194 !! test
25195 New wiki links (content string variations)
25196 !! options
25197 parsoid=html2wt
25198 !! html/parsoid
25199 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25200 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
25201 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
25202 !! wikitext
25203 [[Foo_bar]]
25204 [[Foo bar]]
25205 [[Foo_bar|./Foo_bar]]
25206 !! end
25207
25208 !! test
25209 New category links (href variations)
25210 !! options
25211 parsoid=html2wt
25212 !! html/parsoid
25213 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
25214 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
25215 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
25216 !! wikitext
25217 [[Category:Toxine bactérienne]]
25218 [[Category:Toxine bactérienne]]
25219 [[Category:Toxine bactérienne]]
25220 !! end
25221
25222 !! test
25223 New sol transparent links don't need indent-pre nowiki protection
25224 !! options
25225 parsoid=html2wt
25226 language=de
25227 !! html/parsoid
25228 <link rel="mw:PageProp/redirect" href="./Main_Page">
25229 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
25230 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
25231 !! wikitext
25232 #WEITERLEITUNG [[Main Page]]
25233 <!-- this is good --> [[Category:Good]]
25234 <!-- this is great --> [[Kategorie:Great]]
25235 !! end
25236
25237 !! test
25238 New interlanguage links (href variations)
25239 !! options
25240 parsoid=html2wt
25241 !! html/parsoid
25242 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
25243 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
25244 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
25245 !! wikitext
25246 [[es:Toxine bactérienne]]
25247 [[es:Toxine_bactérienne]]
25248 [[es:Toxine_bactérienne]]
25249 !! end
25250
25251 !! test
25252 Image: Modifying size of an image (1)
25253 !! options
25254 parsoid={
25255 "modes": ["wt2wt"],
25256 "changes": [
25257 ["img[height]", "attr", "height", "22"],
25258 ["img[width]", "attr", "width", "200"]
25259 ]
25260 }
25261 !! wikitext
25262 [[Image:Foobar.jpg|230x230px]]
25263 !! wikitext/edited
25264 [[Image:Foobar.jpg|200x200px]]
25265 !!end
25266
25267 !! test
25268 Image: Modifying size of an image (2)
25269 !! options
25270 parsoid={
25271 "modes": ["wt2wt"],
25272 "changes": [
25273 ["img[height]", "attr", "height", "100"],
25274 ["img[width]", "attr", "width", "500"]
25275 ]
25276 }
25277 !! wikitext
25278 [[Image:Foobar.jpg|230x230px]]
25279 !! wikitext/edited
25280 [[Image:Foobar.jpg|500x500px]]
25281 !!end
25282
25283 # Change in size is ignored so long as class='mw-default-size'
25284 !! test
25285 Image: Modifying size of an image (3)
25286 !! options
25287 parsoid={
25288 "modes": ["wt2wt"],
25289 "changes": [
25290 ["figure[class]", "removeClass", "mw-default-size"],
25291 ["figure img", "attr", "height", "19"],
25292 ["figure img", "attr", "width", "170"]
25293 ]
25294 }
25295 !! wikitext
25296 [[Image:Foobar.jpg|thumb]]
25297 !! wikitext/edited
25298 [[Image:Foobar.jpg|thumb|170x170px]]
25299 !!end
25300
25301 !! test
25302 Image: Modifying alignment of an image (bug 48665)
25303 !! options
25304 parsoid={
25305 "modes": ["wt2wt"],
25306 "changes": [
25307 ["figure[class]", "removeClass", "mw-halign-right"],
25308 ["figure[class]", "addClass", "mw-halign-left"]
25309 ]
25310 }
25311 !! wikitext
25312 [[Image:Foobar.jpg|thumb|caption|right]]
25313 !! wikitext/edited
25314 [[Image:Foobar.jpg|thumb|caption|left]]
25315 !! end
25316
25317 !! test
25318 Image: Modifying mw-default-size of an frameless image (bug 62805)
25319 !! options
25320 parsoid={
25321 "modes": ["wt2wt"],
25322 "changes": [
25323 ["figure.mw-default-size", "removeClass", "mw-default-size"]
25324 ]
25325 }
25326 !! wikitext
25327 [[Image:Foobar.jpg|frameless|right]]
25328 !! wikitext/edited
25329 [[Image:Foobar.jpg|frameless|right|220x220px]]
25330 !! end
25331
25332 !! test
25333 Image: Modifying valign of an image (bug 49221)
25334 !! options
25335 parsoid={
25336 "modes": ["wt2wt"],
25337 "changes": [
25338 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
25339 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
25340 ]
25341 }
25342 !! wikitext
25343 [[File:Foobar.jpg|20px|middle]]
25344 !! wikitext/edited
25345 [[File:Foobar.jpg|20px|text-top]]
25346 !! end
25347
25348 !! test
25349 Image: Modifying alt attribute of an image (bug 56400)
25350 !! options
25351 parsoid={
25352 "modes": ["wt2wt"],
25353 "changes": [
25354 ["img[alt]", "attr", "alt", "some alternate edited text"]
25355 ]
25356 }
25357 !! wikitext
25358 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
25359 !! wikitext/edited
25360 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
25361 !!end
25362
25363 !! test
25364 Image: Modifying caption of an image
25365 !! options
25366 parsoid={
25367 "modes": ["wt2wt"],
25368 "changes": [
25369 ["figcaption", "text", "new caption"]
25370 ]
25371 }
25372 !! wikitext
25373 [[Image:Foobar.jpg|thumb|original caption]]
25374 !! wikitext/edited
25375 [[Image:Foobar.jpg|thumb|new caption]]
25376 !!end
25377
25378 !! test
25379 Image: empty alt attribute (bug 48924)
25380 !! options
25381 parsoid
25382 !! wikitext
25383 [[File:Foobar.jpg|thumb|alt=|bar]]
25384 !! html
25385 <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>
25386 !! end
25387
25388 !! test
25389 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
25390 !! options
25391 parsoid=html2wt
25392 language=ar
25393 disabled
25394 !! html/parsoid
25395 <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>
25396 !! wikitext
25397 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
25398 !! end
25399
25400 !! test
25401 Image: Block level image should have \n before and after
25402 !! wikitext
25403 123
25404 [[File:Foobar.jpg|right|thumb|150x150px]]
25405 456
25406 !! html/parsoid
25407 <p>123</p>
25408 <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>
25409 <p>456</p>
25410 !!end
25411
25412 !! test
25413 Image: New block level image should have \n before and after (existing content)
25414 !! wikitext
25415 123
25416 [[File:Foobar.jpg|right|thumb|150x150px]]
25417 456
25418 !! html/parsoid
25419 <p>123</p>
25420 <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>
25421 <p>456</p>
25422 !!end
25423
25424 !! test
25425 Image: upright option (parsoid)
25426 !! wikitext
25427 [[File:Foobar.jpg|thumb|upright|caption]]
25428 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
25429 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
25430 !! html/parsoid
25431 <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>
25432 <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>
25433 <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>
25434 !!end
25435
25436 !! test
25437 Image: upright option is ignored on inline and frame images (parsoid)
25438 !! wikitext
25439 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
25440 !! html/parsoid
25441 <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>
25442 !!end
25443
25444 !! test
25445 Image: from basic HTML (1)
25446 !! options
25447 parsoid=html2wt
25448 !! html/parsoid
25449 <span typeof="mw:Image">
25450 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25451 </span>
25452 !! wikitext
25453 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25454 !! end
25455
25456 !! test
25457 Image: from basic HTML (2)
25458 !! options
25459 parsoid=html2wt
25460 !! html/parsoid
25461 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25462 !! wikitext
25463 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25464 !! end
25465
25466 !! test
25467 Image: from basic HTML (3)
25468 !! options
25469 parsoid=html2wt
25470 !! html/parsoid
25471 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
25472 !! wikitext
25473 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
25474 !! end
25475
25476 !! test
25477 Image: from basic HTML (4)
25478 !! options
25479 parsoid=html2wt
25480 !! html/parsoid
25481 <img src="./File:Foobar.jpg">
25482 !! wikitext
25483 [[File:Foobar.jpg|link=]]
25484 !! end
25485
25486 !! test
25487 Image: Invalid title as link
25488 !! wikitext
25489 [[File:Foobar.jpg|link=<]]
25490 !! html/php
25491 <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>
25492 </p>
25493 !! html/parsoid
25494 <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>
25495 !! end
25496
25497 !! test
25498 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
25499 !! options
25500 parsoid=html2wt
25501 !! html/parsoid
25502 <ul>
25503 <li><p>foo</p></li>
25504 </ul>
25505 !! wikitext
25506 * foo
25507 !! end
25508
25509 !! test
25510 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
25511 !! options
25512 parsoid=html2wt
25513 !! html/parsoid
25514 <ul> <li>foo</li></ul>
25515 !! wikitext
25516 * foo
25517 !! end
25518
25519 !! test
25520 Don't strip leading whitespace when handling indent-pre suppressing tags
25521 !! options
25522 parsoid=html2wt
25523 !! html/parsoid
25524 <table>
25525 <tr><td> indented row</td></tr>
25526 </table>
25527 <blockquote><p>
25528 <b>This is very bold of you!</b>
25529 </p>
25530 <table><tr><td>
25531 indented cell (no pre-wrapping!)
25532 </td></tr></table>
25533 </blockquote>
25534 <p>foo</p>
25535 <div>bar</div>
25536 !! wikitext
25537 {|
25538 | indented row
25539 |}
25540 <blockquote>
25541 '''This is very bold of you!'''
25542
25543 {|
25544 |
25545 indented cell (no pre-wrapping!)
25546 |}
25547 </blockquote>
25548 foo
25549 <div>bar</div>
25550 !! end
25551
25552 !! test
25553 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
25554 !! options
25555 parsoid=html2wt
25556 !! html/parsoid
25557 <p>foo</p>
25558 <span>bar</span>
25559
25560 <span>foo2
25561 </span>bar2
25562
25563 <div>foo</div>
25564 <span>bar</span>
25565
25566 <div>
25567 <span>foo</span>
25568 </div>
25569 !! wikitext
25570 foo
25571
25572 <span>bar</span>
25573
25574 <span>foo2
25575 <nowiki> </nowiki></span>bar2
25576
25577 <div>foo</div>
25578 <nowiki> </nowiki><span>bar</span>
25579
25580 <div>
25581 <nowiki> </nowiki><span>foo</span>
25582 </div>
25583 !! end
25584
25585 !! test
25586 Lists: Dont insert newlines in a serialized list item.
25587 !! options
25588 parsoid=html2wt
25589 !! html/parsoid
25590 <ul><li>a<br>b</li><li>c</li></ul>
25591 !! wikitext
25592 * a<br>b
25593 * c
25594 !! end
25595
25596 !! test
25597 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
25598 !! options
25599 parsoid={
25600 "modes": ["html2wt"],
25601 "scrubWikitext": false
25602 }
25603 !! html/parsoid
25604 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25605 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25606
25607 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25608 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25609
25610 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
25611
25612 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25613 !! wikitext
25614 == hello there [[Category:A1]] ==
25615
25616 == [[Category:A2]] hi pal ==
25617
25618 == <!--foo--> [[Category:A3]] how goes it ==
25619
25620 == it goes well [[Category:A4]] <!--bar--> ==
25621
25622 ==howdy [[Category:A5]]==
25623
25624 == __TOC__ ok ==
25625 !! end
25626
25627 !! test
25628 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
25629 !! options
25630 parsoid={
25631 "modes": ["html2wt"],
25632 "scrubWikitext": true
25633 }
25634 !! html/parsoid
25635 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25636 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25637
25638 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25639 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25640
25641 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25642 !! wikitext
25643 == hello there ==
25644 [[Category:A1]]
25645 [[Category:A2]]
25646
25647 == hi pal ==
25648
25649 <!--foo--> [[Category:A3]]
25650
25651 == how goes it ==
25652
25653 == it goes well ==
25654 [[Category:A4]] <!--bar-->
25655
25656 __TOC__
25657
25658 == ok ==
25659 !! end
25660
25661 !! test
25662 Headings: Don't hoist metas that come from templates
25663 !! options
25664 parsoid={
25665 "modes": ["html2wt"],
25666 "scrubWikitext": true
25667 }
25668 !! html/parsoid
25669 <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>
25670 !! wikitext
25671 == {{echo|foo [[Category:Foo]]}} ==
25672 !! end
25673
25674 !! test
25675 Headings: Category in ref isn't hoisted
25676 !! options
25677 parsoid={
25678 "modes": ["html2wt"],
25679 "scrubWikitext": true
25680 }
25681 !! html/parsoid
25682 <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>
25683
25684 <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>
25685 !! wikitext
25686 == foo <ref>bar
25687 [[Category:Baz]] </ref> ==
25688
25689 <references />
25690 !! end
25691
25692 !! test
25693 Parsoid: Serialize positional parameters with = in them as named parameter
25694 !! options
25695 parsoid=html2wt
25696 !! html/parsoid
25697 <p about="#mwt1" typeof="mw:Transclusion"
25698 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
25699
25700 <p about="#mwt1" typeof="mw:Transclusion"
25701 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
25702
25703 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25704 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25705 <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>
25706 !! wikitext
25707 {{echo|1=f=oo}}
25708
25709 {{echo|1=f=oo|2=bar}}
25710
25711 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25712 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25713 {{echo|<nowiki>f=oo</nowiki>|bar}}
25714 !! end
25715
25716 !! test
25717 Parsoid: Serialize positional parameters with = in extlink as named parameter
25718 !! options
25719 parsoid=html2wt
25720 !! html/parsoid
25721 <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>
25722 !! wikitext
25723 {{echo|1=http://stuff?is=ok}}
25724 !! end
25725
25726 !! test
25727 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
25728 !! options
25729 parsoid=html2wt
25730 !! html/parsoid
25731 <div>a<p>b</p></div>
25732 <div>a
25733 <p>b</p></div>
25734 <div>
25735 a
25736 <p>b</p></div>
25737 !! wikitext
25738 <div>a
25739 b
25740 </div>
25741 <div>a
25742 b
25743 </div>
25744 <div>
25745 a
25746
25747 b
25748 </div>
25749 !! end
25750
25751 !! test
25752 Substrings resembling wikitext in hrefs should not get nowiki escapes
25753 !! options
25754 parsoid=html2wt
25755 !! html/parsoid
25756 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
25757 !! wikitext
25758 [[Foo''bar''baz]]
25759 !! end
25760
25761 !! test
25762 Enforce single-line context in the serializer
25763 !! options
25764 parsoid=html2wt
25765 !! html/parsoid
25766 <h2>testing
25767 123</h2>
25768
25769 <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">
25770 </span><span about="#mwt1">you</span> </h2>
25771
25772 <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>
25773
25774 <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
25775 there</span></li></ol>
25776
25777 <ul><li>asd
25778 sdf</li></ul>
25779
25780 <ul><li>foo
25781 bar
25782 baz</li>
25783 <li>foo <b>bar</b>
25784 baz</li></ul>
25785
25786 <dl><dt>hi
25787 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
25788 ho</dd></dl>
25789
25790 <dl><dd> <table>
25791 <tbody><tr><td> ha
25792 ha
25793 ha</td></tr>
25794 </tbody></table></dd></dl>
25795 !! wikitext
25796 == testing 123 ==
25797
25798 == hi {{bogus|there
25799 you}} ==
25800
25801 == foo <ref>hello
25802 there</ref> ==
25803
25804 <references />
25805
25806 * asd sdf
25807
25808 * foo bar baz
25809 * foo '''bar''' baz
25810
25811 ; hi ho : hi ho
25812
25813 : {|
25814 | ha
25815 ha
25816 ha
25817 |}
25818 !! end
25819
25820 !! test
25821 Serialize new placeholder space without spans
25822 !! options
25823 parsoid=html2wt
25824 !! html/parsoid
25825 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
25826
25827 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
25828
25829 <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>
25830 !! wikitext
25831 foo : bar
25832
25833 foo : bar
25834
25835 <ref>foo : bar</ref>ok
25836 !! end
25837
25838
25839 #-----------------------
25840 # Tag minimization tests
25841 #-----------------------
25842
25843 !! test
25844 1. I/B quote minimization: wikitext-only tags should be combined
25845 !! options
25846 parsoid=html2wt
25847 !! html/parsoid
25848 <p><i>A</i><i>B</i></p>
25849 <p><b>A</b><b>B</b></p>
25850 <p><i>A</i><b><i>B</i></b></p>
25851 <p><b>A</b><i><b>B</b></i></p>
25852 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
25853 <p><i><b>A</b></i><i><b>B</b></i></p>
25854 <p><i><b>A</b></i><b><i>B</i></b></p>
25855 <p><b><i>A</i></b><i><b>B</b></i></p>
25856 !! wikitext
25857 ''AB''
25858
25859 '''AB'''
25860
25861 ''A'''B'''''
25862
25863 '''A''B'''''
25864
25865 '''A''BC''D'''
25866
25867 '''''AB'''''
25868
25869 '''''AB'''''
25870
25871 '''''AB'''''
25872 !! end
25873
25874 !! test
25875 2. I/B quote minimization: wikitext and html tags should not be combined
25876 !! options
25877 parsoid=html2wt
25878 !! html/parsoid
25879 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
25880 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
25881 !! wikitext
25882 ''A''<i>B</i>
25883
25884 ''A''<nowiki/>'''<i>B</i>'''
25885 !! end
25886
25887 !! test
25888 3. I/B quote minimization: templated content stops minimization
25889 !! options
25890 parsoid=html2wt
25891 !! html/parsoid
25892 <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>
25893 <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>
25894 !! wikitext
25895 ''A''{{echo|''B''}}
25896
25897 ''A''{{echo|'''''B'''''}}
25898 !! end
25899
25900 !! test
25901 4. I/B quote minimization: new content should be mimimized with adjacent old content
25902 !! options
25903 parsoid=html2wt
25904 !! html/parsoid
25905 <p><i>A</i><i>B</i></p>
25906 <p><b>A</b><b>B</b></p>
25907 <p><i>A</i><b><i>B</i></b></p>
25908 !! wikitext
25909 ''AB''
25910
25911 '''AB'''
25912
25913 ''A'''B'''''
25914 !! end
25915
25916 !! test
25917 5a. Merge adjacent quote nodes if they've been edited
25918 !! options
25919 parsoid={
25920 "modes": ["wt2wt", "selser"],
25921 "changes": [
25922 ["p", "contents", "remove", ":contains('b')"]
25923 ]
25924 }
25925 !! wikitext
25926 ''a''b''c''
25927 !! wikitext/edited
25928 ''ac''
25929 !! end
25930
25931 !! test
25932 5b. Merge adjacent quote nodes if they've been edited
25933 !! options
25934 parsoid={
25935 "modes": ["wt2wt", "selser"],
25936 "changes": [
25937 ["#x", "remove"]
25938 ]
25939 }
25940 !! wikitext
25941 ''a''<span id="x">b</span>''c''
25942 !! wikitext/edited
25943 ''ac''
25944 !! end
25945
25946 !! test
25947 1. Merge adjacent link nodes as long as at least one element is new
25948 !! options
25949 parsoid={
25950 "modes": ["html2wt"],
25951 "scrubWikitext": true
25952 }
25953 !! html/parsoid
25954 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25955 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25956 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
25957 !! wikitext
25958 [[Football]]
25959 [[Football]]
25960 [[Football|Foot]][[Football|ball]]
25961 !! end
25962
25963 !! test
25964 2. Merge adjacent link nodes and enable additional normalizations
25965 !! options
25966 parsoid={
25967 "modes": ["html2wt"],
25968 "scrubWikitext": true
25969 }
25970 !! html/parsoid
25971 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
25972 !! wikitext
25973 [[Football|''Football'']]
25974 !! end
25975
25976 !! test
25977 3. Don't merge adjacent link nodes if scrubWikitext is false
25978 !! options
25979 parsoid={
25980 "modes": ["html2wt"],
25981 "scrubWikitext": false
25982 }
25983 !! html/parsoid
25984 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25985 !! wikitext
25986 [[Football|Foot]][[Football|ball]]
25987 !! end
25988
25989 #------------------------------
25990 # End of tag minimization tests
25991 #------------------------------
25992
25993 !!test
25994 Bug 54262: New entities
25995 !! options
25996 parsoid=html2wt
25997 !! html/parsoid
25998 <span typeof="mw:Entity">&nbsp;</span>
25999 !! wikitext
26000 &nbsp;
26001 !! end
26002
26003 ## Note that there is no wikitext output for 'unknownproperty' ##
26004 ## Unknown magic words are silently dropped ##
26005
26006 !! test
26007 Magic words
26008 !! options
26009 parsoid=html2wt
26010 !! html/parsoid
26011 <meta property='mw:PageProp/toc' />
26012 <meta property='mw:PageProp/notoc' />
26013 <meta property='mw:PageProp/forcetoc' />
26014 <meta property='mw:PageProp/index' />
26015 <meta property='mw:PageProp/noindex' />
26016 <meta property='mw:PageProp/nogallery' />
26017 <meta property='mw:PageProp/noeditsection' />
26018 <meta property='mw:PageProp/notitleconvert' />
26019 <meta property='mw:PageProp/nocontentconvert' />
26020 <meta property='mw:PageProp/unknownproperty' />
26021 !! wikitext
26022 __TOC__
26023 __NOTOC__
26024 __FORCETOC__
26025 __INDEX__
26026 __NOINDEX__
26027 __NOGALLERY__
26028 __NOEDITSECTION__
26029 __NOTITLECONVERT__
26030 __NOCONTENTCONVERT__
26031 !! end
26032
26033 !! test
26034 Consecutive <pre>s should not get merged
26035 !! options
26036 parsoid=html2wt,html2html
26037 !! html/parsoid
26038 <pre>a</pre><pre>b</pre>
26039
26040 <pre>c
26041 </pre><pre>
26042 d</pre>
26043
26044 <pre>e
26045
26046 </pre><pre>
26047
26048 f</pre>
26049 !! wikitext
26050 a
26051
26052 b
26053
26054 c
26055
26056 d
26057
26058 e
26059
26060
26061
26062 f
26063 !! end
26064
26065 !! test
26066 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
26067 !! options
26068 parsoid=html2wt
26069 !! html/parsoid
26070 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
26071 !! wikitext
26072 [[Special:BookSources/1234567890|ISBN 1234567895]]
26073 !! end
26074
26075 !! test
26076 Edited RFC links not serializable as RFC links should serialize as extlinks
26077 !! options
26078 parsoid=html2wt
26079 !! html/parsoid
26080 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
26081 !! wikitext
26082 [//tools.ietf.org/html/rfc123 New RFC]
26083 !! end
26084
26085 !! test
26086 Edited PMID links not serializable as PMID links should serialize as extlinks
26087 !! options
26088 parsoid=html2wt
26089 !! html/parsoid
26090 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
26091 !! wikitext
26092 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
26093 !! end
26094
26095 !! test
26096 WTS of autolinks with trailing/surrounding context
26097 !! options
26098 parsoid=html2wt
26099 !! html/parsoid
26100 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
26101 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
26102 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
26103 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
26104 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
26105 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
26106 !! wikitext
26107 http://cscott.net'''foo'''
26108
26109 http://cscott.net<b>foo</b>
26110
26111 '''http://cscott.net'''
26112
26113 '''http://cscott.net '''
26114
26115 '''http://cscott.net<nowiki/>x'''
26116
26117 http://cscott.net<nowiki/>x
26118 !! end
26119
26120 !! test
26121 WTS of autolinks with nowikis (round-trip)
26122 !! wikitext
26123 x<nowiki/>http://cscott.net<nowiki/>x
26124 !! html/parsoid
26125 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
26126 !! end
26127
26128 # this is the "easy" test because it leaves in place all the
26129 # data-parsoid information indicating this is an autolink
26130 !! test
26131 WTS of autolinks with escapes (editing)
26132 !! options
26133 parsoid={
26134 "modes": ["wt2wt"],
26135 "changes": [
26136 [ "meta", "remove" ]
26137 ]
26138 }
26139 !! wikitext
26140 x<nowiki/>http://cscott.net<nowiki/>x
26141 !! wikitext/edited
26142 x<nowiki/>http://cscott.net<nowiki/>x
26143 !! end
26144
26145 !! test
26146 WTS of edited autolink-like text (T103364)
26147 !! options
26148 parsoid={
26149 "modes": ["wt2wt"],
26150 "changes": [
26151 [ "span[typeof]", "removeAttr", "typeof" ]
26152 ]
26153 }
26154 !! wikitext
26155 Not a link: <nowiki>http://example.com</nowiki>.
26156 !! wikitext/edited
26157 Not a link: <span><nowiki>http://example.com</nowiki></span>.
26158 !! end
26159
26160 !! test
26161 WTS of newly-authored autolink-like text (T103364)
26162 !! options
26163 parsoid=html2wt
26164 !! html/parsoid
26165 <p>http://example.com is not a link.</p>
26166 !! wikitext
26167 <nowiki>http://example.com</nowiki> is not a link.
26168 !! end
26169
26170 !! test
26171 WTS of autolink-like text after an autolink (T108563)
26172 !! options
26173 parsoid=html2wt
26174 !! html/parsoid
26175 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
26176 !! wikitext
26177 http://example.com <nowiki>http://example.com</nowiki> is not a link.
26178 !! end
26179
26180 !! test
26181 Magic links inside links (not autolinked)
26182 !! wikitext
26183 [[Foo|http://example.com]]
26184 [[Foo|RFC 1234]]
26185 [[Foo|PMID 1234]]
26186 [[Foo|ISBN 123456789x]]
26187
26188 [http://foo.com http://example.com]
26189 [http://foo.com RFC 1234]
26190 [http://foo.com PMID 1234]
26191 [http://foo.com ISBN 123456789x]
26192 !! html+tidy
26193 <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>
26194 <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>
26195 !! html/parsoid
26196 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
26197 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
26198 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
26199 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
26200
26201 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
26202 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
26203 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
26204 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
26205 !! end
26206
26207 !! test
26208 Magic links inside image captions (autolinked)
26209 !! wikitext
26210 [[File:Foobar.jpg|thumb|http://example.com]]
26211 [[File:Foobar.jpg|thumb|RFC 1234]]
26212 [[File:Foobar.jpg|thumb|PMID 1234]]
26213 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
26214 !! html+tidy
26215 <div class="thumb tright">
26216 <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>
26217 <div class="thumbcaption">
26218 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26219 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
26220 </div>
26221 </div>
26222 <div class="thumb tright">
26223 <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>
26224 <div class="thumbcaption">
26225 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26226 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
26227 </div>
26228 </div>
26229 <div class="thumb tright">
26230 <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>
26231 <div class="thumbcaption">
26232 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26233 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
26234 </div>
26235 </div>
26236 <div class="thumb tright">
26237 <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>
26238 <div class="thumbcaption">
26239 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26240 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
26241 </div>
26242 </div>
26243 !! html/parsoid
26244 <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>
26245 <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>
26246 <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>
26247 <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>
26248 !! end
26249
26250 !! test
26251 WTS of magic word text (T109371)
26252 !! options
26253 parsoid=html2wt
26254 !! html/parsoid
26255 <p>RFC 1234</p>
26256 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
26257 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
26258 !! wikitext
26259 <nowiki>RFC 1234</nowiki>
26260
26261 [http://foo.com RFC 1234]
26262
26263 [[Foo|RFC 1234]]
26264 !! end
26265
26266 !! test
26267 Edited Redirect link should emit a non-piped wikitext link
26268 !! options
26269 parsoid=html2wt
26270 !! html/parsoid
26271 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
26272 !! wikitext
26273 #REDIRECT [[Bar]]
26274 !! end
26275
26276 !! test
26277 T75121: Infer extension name from typeOf if data-mw is not present
26278 !! options
26279 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26280 !! html/parsoid
26281 <div typeOf="mw:Extension/foo"></div>
26282 !! wikitext
26283 <foo />
26284 !! end
26285
26286 # Note that the <p> wrapping isn't present in PHP parser output
26287 # The important thing for this test is that P-wrapping doesn't
26288 # interfere with the <nowiki> protection for leading - in <td>
26289 # (which isn't necessary for <th>).
26290 !! test
26291 T88318: p-wrapped dash in table.
26292 !! options
26293 parsoid=html2wt,wt2wt
26294 !! html/parsoid
26295 <table><tbody>
26296 <tr><th><p>-</p></th><th><p>- </p></th></tr>
26297 <tr><td><p>-</p></td><td><p>- </p></td></tr>
26298 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
26299 </tbody></table>
26300 !! wikitext
26301 {|
26302 !-
26303 !-
26304 |-
26305 |<nowiki>-</nowiki>
26306 |<nowiki>- </nowiki>
26307 |-
26308 |<small>-</small>
26309 |<br>
26310 -
26311 |<br>
26312 -
26313 |}
26314 !! html/php+tidy
26315 <table>
26316 <tr>
26317 <th>-</th>
26318 <th>-</th>
26319 </tr>
26320 <tr>
26321 <td>-</td>
26322 <td>-</td>
26323 </tr>
26324 <tr>
26325 <td><small>-</small></td>
26326 <td><br />
26327 <p>-</p>
26328 </td>
26329 <td><br />
26330 <p>-</p>
26331 </td>
26332 </tr>
26333 </table>
26334 !! end
26335
26336 !! test
26337 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
26338 !! options
26339 parsoid=html2wt
26340 !! html/parsoid
26341 <table id='mwAb'>
26342 <td id='mwAc'>foo</td>
26343 <td id='serialize-this'>bar</td>
26344 </table>
26345 !! wikitext
26346 {|
26347 |foo
26348 | id="serialize-this" |bar
26349 |}
26350 !! end
26351
26352 !! test
26353 Parsoid-like element ids should not be serialized to wikitext unless shadowed
26354 !! options
26355 parsoid=html2wt
26356 !! html/parsoid
26357 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
26358 !! wikitext
26359 <div id="hello">ok</div>
26360 !! end
26361
26362 !! test
26363 WTS change modes
26364 !! options
26365 parsoid={
26366 "modes": ["wt2wt"],
26367 "changes": [
26368 [ "#xyz", "before", "<b>before</b> stuff " ],
26369 [ "#xyz", "after", " stuff <i>after</i>" ],
26370 [ "#xyz", "html", "x <b>y</b> z" ]
26371 ]
26372 }
26373 !! wikitext
26374 <span id="xyz">hello</span>
26375 !! wikitext/edited
26376 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
26377 !! end
26378
26379 !! test
26380 Never serialize a-tag as html, regardless of what data-parsoid has to say
26381 !! options
26382 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26383 !! html/parsoid
26384 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
26385 !! wikitext
26386 [[Foo]]
26387 !! end
26388
26389 ## SSS FIXME: This is broken output nevertheless.
26390 ## What might be a reasonable non-broken output for this?
26391 ## This is an edge case unlikely to be seen in production
26392 ## that I am not wasting more time on this right now.
26393 !! test
26394 Never serialize a-tag as html, no matter what attributes it has
26395 !! options
26396 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26397 !! html/parsoid
26398 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
26399 !! wikitext
26400 [http://boo.org http://boohoo.org]
26401 !! end
26402
26403 # Misnested is an indication that selser can reuse the source but these have
26404 # shown to sneak through on occasion. See T101768.
26405 # The original wikitext here is: [http://test.com [[one]] two three]
26406 !! test
26407 Strip span tags added to mark misnested links
26408 !! options
26409 parsoid=html2wt
26410 !! html/parsoid
26411 <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>
26412 !! wikitext
26413 [http://test.com][[one]] two three
26414 !! end
26415
26416 !! test
26417 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
26418 !! options
26419 parsoid=html2wt
26420 !! html/parsoid
26421 <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|}"]}'>
26422 <tbody><tr><td>d
26423 </td></tr>
26424 </tbody></table>
26425 !! wikitext
26426 {{echo|a}}
26427 {|{{echo|c
26428 {{!}}d
26429 }}
26430 |}
26431 !! end
26432
26433 ## This test verifies the presence and computation of this attribute indirectly
26434 ## by making an edit and ensuring that the serialization is correct (which it would be
26435 ## only if firstWikitextNode is properly set).
26436 !! test
26437 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
26438 !! options
26439 parsoid= {
26440 "modes": ["wt2wt"],
26441 "changes": [
26442 [ "div#x", "remove" ],
26443 [ "div", "before", "<div>new</div>" ]
26444 ]
26445 }
26446 !! wikitext
26447 <div id="x">foo</div>
26448 {|
26449 {{echo|<div>boo</div>
26450 {{!}}b}}
26451 |c
26452 |}
26453 !! wikitext/edited
26454
26455 <div>new</div>
26456 {|
26457 {{echo|<div>boo</div>
26458 {{!}}b}}
26459 |c
26460 |}
26461 !! end
26462
26463 # --------------------------------------------
26464 # Tests spec'ing wikitext serialization norms |
26465 # --------------------------------------------
26466
26467 !! test
26468 1. Categories should always be serialized on their own line
26469 !! options
26470 parsoid=html2wt
26471 !! html/parsoid
26472 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
26473 !! wikitext
26474 foo
26475 [[Category:Foo]]
26476 bar
26477 !! end
26478
26479 !! test
26480 2. Categories that are part of templates should not introduce a line break
26481 !! wikitext
26482 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
26483 !! html/parsoid
26484 <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>
26485 !! end
26486
26487 # Careful while editing these next 2 tests. There are \u200f characters
26488 # before and after the <link> tags in the HTML and following some
26489 # of the categories in wikitext
26490 # Do not remove these characters in edits.
26491 #
26492 # As part of the serialization, these bidi characters will get stripped.
26493 !! test
26494 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
26495 !! options
26496 parsoid={
26497 "modes": ["html2wt"],
26498 "scrubWikitext": true
26499 }
26500 !! html/parsoid
26501 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
26502 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
26503 !! wikitext
26504 [[קטגוריה:טקסים]]
26505 [[קטגוריה: שיטות משפט]]
26506 !! end
26507
26508 !! test
26509 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
26510 !! options
26511 parsoid={
26512 "modes": ["html2wt"],
26513 "scrubWikitext": true
26514 }
26515 !! html/parsoid
26516 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
26517 !! wikitext
26518 [[קטגוריה:טקסים]]
26519 ‏y
26520 !! end
26521
26522 !! test
26523 Lists: Add space after bullets
26524 !! options
26525 parsoid=html2wt
26526 !! html/parsoid
26527 <ul>
26528 <li>foo</li>
26529 <li> bar</li>
26530 <li><span> baz</span></li>
26531 </ul>
26532 !! wikitext
26533 * foo
26534 * bar
26535 * <span> baz</span>
26536 !! end
26537
26538 !! test
26539 1. Headings: Add space before/after == (T53744)
26540 !! options
26541 parsoid=html2wt
26542 !! html/parsoid
26543 <h2>foo</h2>
26544 <h2> bar</h2>
26545 <h2>baz </h2>
26546 <h2><span> baz</span></h2>
26547 !! wikitext
26548 == foo ==
26549
26550 == bar ==
26551
26552 == baz ==
26553
26554 == <span> baz</span> ==
26555 !! end
26556
26557 !! test
26558 2. Headings: Add space before/after == even after hoisted content
26559 !! options
26560 parsoid={
26561 "modes": ["html2wt"],
26562 "scrubWikitext": true
26563 }
26564 !! html/parsoid
26565 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
26566 !! wikitext
26567 [[Category:A2]]
26568
26569 == ok ==
26570 !! end
26571
26572 !! test
26573 1. Headings: suppress newly created empty headings
26574 !! options
26575 parsoid={
26576 "modes": ["html2wt"],
26577 "scrubWikitext": true
26578 }
26579 !! html/parsoid
26580 <h2></h2>
26581 !! wikitext
26582 !! end
26583
26584 !! test
26585 2. Headings: don't suppress empty headings if scrubWikitext is false
26586 !! options
26587 parsoid=html2wt
26588 !! html/parsoid
26589 <h2></h2>
26590 !! wikitext
26591 ==<nowiki/>==
26592 !! end
26593
26594 !! test
26595 3. Headings: suppress empty headings on edits
26596 !! options
26597 parsoid={
26598 "modes": ["selser"],
26599 "scrubWikitext": true,
26600 "changes": [
26601 [ "#x", "remove"]
26602 ]
26603 }
26604 !! wikitext
26605 ==<span id="x">foo</span>==
26606 !! wikitext/edited
26607 !! end
26608
26609 !! test
26610 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
26611 !! options
26612 parsoid={
26613 "modes": ["html2wt"],
26614 "scrubWikitext": true
26615 }
26616 !! html/parsoid
26617 <h2>foo<br/>bar</h2>
26618 <h2>foo <span><br/>bar</span> baz</h2>
26619 !! wikitext
26620 == foo bar ==
26621
26622 == foo <span> bar</span> baz ==
26623 !! end
26624
26625 !! test
26626 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
26627 !! options
26628 parsoid={
26629 "modes": ["html2wt"],
26630 "scrubWikitext": false
26631 }
26632 !! html/parsoid
26633 <h2>foo<br/>bar</h2>
26634 !! wikitext
26635 == foo<br> bar ==
26636 !! end
26637
26638 !! test
26639 1. WT Quote Tags: suppress newly created empty style tags
26640 !! options
26641 parsoid={
26642 "modes": ["html2wt"],
26643 "scrubWikitext": true
26644 }
26645 !! html/parsoid
26646 <i></i><b></b>
26647 !! wikitext
26648 !! end
26649
26650 !! test
26651 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
26652 !! options
26653 parsoid=html2wt
26654 !! html/parsoid
26655 <i></i><b></b>
26656 !! wikitext
26657 ''<nowiki/>'''''<nowiki/>'''
26658 !! end
26659
26660 !! test
26661 3. WT Quote Tags: suppress empty style tags on edits
26662 !! options
26663 parsoid={
26664 "modes": ["selser"],
26665 "scrubWikitext": true,
26666 "changes": [
26667 [ "#x", "remove"]
26668 ]
26669 }
26670 !! wikitext
26671 '''<span id="x">foo</span>'''
26672 !! wikitext/edited
26673 !! end
26674
26675 !! test
26676 1. Anchors: suppress newly created empty anchors
26677 !! options
26678 parsoid={
26679 "modes": ["html2wt"],
26680 "scrubWikitext": true
26681 }
26682 !! html/parsoid
26683 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26684 !! wikitext
26685 !! end
26686
26687 !! test
26688 2. Anchors: don't suppress empty anchors if scrubWikitext is false
26689 !! options
26690 parsoid={
26691 "modes": ["html2wt"],
26692 "scrubWikitext": false
26693 }
26694 !! html/parsoid
26695 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26696 !! wikitext
26697 [[Test|<nowiki/>]]
26698 !! end
26699
26700 !! test
26701 3. Anchors: suppress empty anchors on edits
26702 !! options
26703 parsoid={
26704 "modes": ["selser"],
26705 "scrubWikitext": true,
26706 "changes": [
26707 [ "#x", "remove"]
26708 ]
26709 }
26710 !! wikitext
26711 [[Test|<span id="x">foo</span>]]
26712 !! wikitext/edited
26713 !! end
26714
26715 !! test
26716 3a. Anchors: do not suppress numbered extlinks
26717 !! options
26718 parsoid={
26719 "modes": ["wt2wt"],
26720 "scrubWikitext": true
26721 }
26722 !! wikitext
26723 [http://foo.com]
26724 !! html/parsoid
26725 <a rel="mw:ExtLink" href="http://foo.com"></a>
26726 !! end
26727
26728 !! test
26729 3b. Anchors: do not suppress numbered extlinks
26730 !! options
26731 parsoid={
26732 "modes": ["wt2wt"],
26733 "scrubWikitext": true,
26734 "changes": [
26735 [ "#x", "remove"]
26736 ]
26737 }
26738 !! wikitext
26739 [http://foo.com <span id="x">foo</span>]
26740 !! wikitext/edited
26741 [http://foo.com]
26742 !! end
26743
26744 !!test
26745 Normalizations should be restricted to edited content
26746 !!options
26747 parsoid={
26748 "modes": ["selser"],
26749 "scrubWikitext": true,
26750 "changes": [
26751 [ "h1", "before", "<i></i>"]
26752 ]
26753 }
26754 !!wikitext
26755 a
26756 = =
26757 b
26758 !!wikitext/edited
26759 a
26760 = =
26761 b
26762 !!end
26763
26764 !! test
26765 1. Multiple normalizations (html2wt)
26766 !! options
26767 parsoid={
26768 "modes": ["html2wt"],
26769 "scrubWikitext": true
26770 }
26771 !! html
26772 <h2><i></i></h2>
26773 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
26774 </a><b><i></i></b>x</p>
26775 !! wikitext
26776
26777 [[foo]]
26778 x
26779
26780 !! end
26781
26782 !! test
26783 2. Multiple normalizations (selser)
26784 !! options
26785 parsoid={
26786 "modes": ["selser"],
26787 "scrubWikitext": true,
26788 "changes": [
26789 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
26790 ]
26791 }
26792 !! wikitext
26793 <span id="x">foo</span>
26794 !! wikitext/edited
26795 <span id="x">foo</span>
26796
26797 x
26798 !! end
26799
26800 !! test
26801 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
26802 !! options
26803 parsoid={
26804 "modes": ["html2wt"],
26805 "scrubWikitext": true
26806 }
26807 !! html/parsoid
26808 <p> hi</p>
26809 <p> hello</p>
26810 !! wikitext
26811 hi
26812
26813 hello
26814 !! end
26815
26816 !! test
26817 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
26818 !! options
26819 parsoid=html2wt
26820 !! html/parsoid
26821 <p> hi</p>
26822 <p> hello</p>
26823 !! wikitext
26824 <nowiki> </nowiki>hi
26825
26826 <nowiki> </nowiki> hello
26827 !! end
26828
26829 !! test
26830 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
26831 !! options
26832 parsoid={
26833 "modes": ["html2wt"],
26834 "scrubWikitext": true
26835 }
26836 !! html/parsoid
26837 <p>Foo
26838 bar
26839 baz</p>
26840
26841 <table><tr><td>Foo
26842 bar
26843 baz bang</td></tr></table>
26844
26845 <p><!--boo--> foo
26846 bar</p>
26847
26848 <p> foo
26849 bar<span>boo</span></p>
26850 !! wikitext
26851 Foo
26852 bar
26853 baz
26854
26855 {|
26856 |Foo
26857 bar
26858 baz bang
26859 |}
26860
26861 <!--boo-->foo
26862 bar
26863
26864 foo
26865 bar<span>boo</span>
26866 !! end
26867
26868 !! test
26869 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
26870 !! options
26871 parsoid={
26872 "modes": ["selser"],
26873 "scrubWikitext": true,
26874 "changes": [
26875 [ "p", "html", " a\n b" ]
26876 ]
26877 }
26878 !! wikitext
26879 xyz
26880 !! wikitext/edited
26881 a
26882 b
26883 !! end
26884
26885 !! test
26886 1. New links that end in spaces
26887 !! options
26888 parsoid={
26889 "modes": ["html2wt"],
26890 "scrubWikitext": false
26891 }
26892 !! html/parsoid
26893 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26894 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26895 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26896 !! wikitext
26897 [[Berlin ]]<nowiki/>is the capital of Germany.
26898
26899 [[Foo ]]'''bar'''
26900
26901 [[Boston ]] is a city.
26902 !! end
26903
26904 !! test
26905 2. New links that end in spaces
26906 !! options
26907 parsoid={
26908 "modes": ["html2wt"],
26909 "scrubWikitext": true
26910 }
26911 !! html/parsoid
26912 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26913 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26914 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26915 !! wikitext
26916 [[Berlin]] is the capital of Germany.
26917
26918 [[Foo]] '''bar'''
26919
26920 [[Boston]] is a city.
26921 !! end
26922
26923 !! test
26924 1. Table cells with escapable prefixes
26925 !! options
26926 parsoid={
26927 "modes": ["html2wt"],
26928 "scrubWikitext": false
26929 }
26930 !! html
26931 <table>
26932 <tr><td>a</td></tr>
26933 <tr><td>-</td></tr>
26934 <tr><td>+</td></tr>
26935 </table>
26936 !! wikitext
26937 {|
26938 |a
26939 |-
26940 |<nowiki>-</nowiki>
26941 |-
26942 |<nowiki>+</nowiki>
26943 |}
26944 !! end
26945
26946 !! test
26947 2. Table cells with escapable prefixes
26948 !! options
26949 parsoid={
26950 "modes": ["html2wt"],
26951 "scrubWikitext": true
26952 }
26953 !! html
26954 <table>
26955 <tr><td>a</td></tr>
26956 <tr><td>-</td></tr>
26957 <tr><td>+</td></tr>
26958 </table>
26959 !! wikitext
26960 {|
26961 |a
26962 |-
26963 | -
26964 |-
26965 | +
26966 |}
26967 !! end
26968
26969 !! test
26970 3a. Table cells with escapable prefixes after edits
26971 !! options
26972 parsoid={
26973 "modes": ["selser"],
26974 "scrubWikitext": true,
26975 "changes": [
26976 [ "table tbody tr:first-child td:first-child", "remove"]
26977 ]
26978 }
26979 !! wikitext
26980 {|
26981 |a||-
26982 |}
26983 !! wikitext/edited
26984 {|
26985 | -
26986 |}
26987 !! end
26988
26989 !! test
26990 3b. Table cells with escapable prefixes after edits
26991 !! options
26992 parsoid={
26993 "modes": ["selser"],
26994 "scrubWikitext": true,
26995 "changes": [
26996 [ "table tbody tr:first-child td:first-child", "html", "-" ],
26997 [ "#x", "remove" ]
26998 ]
26999 }
27000 !! wikitext
27001 {|
27002 |pqr
27003 |<span id="x">foo</span>+
27004 |}
27005 !! wikitext/edited
27006 {|
27007 | -
27008 | +
27009 |}
27010 !! end
27011
27012 # FIXME: This test will fail because
27013 # normalization doesn't realize that the id attribute
27014 # will eliminate the escapable scenario
27015 !! test
27016 4a. Table cells without escapable prefixes after edits
27017 !! options
27018 parsoid={
27019 "modes": ["selser"],
27020 "scrubWikitext": true,
27021 "changes": [
27022 [ "#x", "html", "-" ]
27023 ]
27024 }
27025 !! wikitext
27026 {|
27027 | id="x" |abcd
27028 |}
27029 !! wikitext/edited
27030 {|
27031 | id="x" |-
27032 |}
27033 !! end
27034
27035 ## This tests normalizer's ability to discriminate between
27036 ## cells having identical content.
27037 !! test
27038 4b. Table cells without escapable prefixes after edits
27039 !! options
27040 parsoid={
27041 "modes": ["selser"],
27042 "scrubWikitext": true,
27043 "changes": [
27044 [ "td", "html", "-" ]
27045 ]
27046 }
27047 !! wikitext
27048 {|
27049 |a||b
27050 |}
27051 !! wikitext/edited
27052 {|
27053 | -||-
27054 |}
27055 !! end
27056
27057 ## This tests normalizer's ability to not be tripped by
27058 ## comments (and whitespace)
27059 !! test
27060 4c. Table cells without escapable prefixes after edits
27061 !! options
27062 parsoid={
27063 "modes": ["selser"],
27064 "scrubWikitext": true,
27065 "changes": [
27066 [ "table tbody tr td:first-child", "remove" ]
27067 ]
27068 }
27069 !! wikitext
27070 {|
27071 |-
27072 <!--foo--> |a||-
27073 |}
27074 !! wikitext/edited
27075 {|
27076 |-
27077 <!--foo--> | -
27078 |}
27079 !! end
27080
27081 ## This tests normalizer's ability to handle HTML cells
27082 !! test
27083 4d. Table cells without escapable prefixes after edits
27084 !! options
27085 parsoid={
27086 "modes": ["selser"],
27087 "scrubWikitext": true,
27088 "changes": [
27089 [ "td", "html", "-" ]
27090 ]
27091 }
27092 !! wikitext
27093 <table>
27094 <tr><td>a</td></tr>
27095 </table>
27096 !! wikitext/edited
27097 <table>
27098 <tr><td>-</td></tr>
27099 </table>
27100 !! end
27101
27102 ## T111151 Remove font elements without attributes
27103 !! test
27104 5a. font tags without attributes should be dropped in scrubWikitext mode
27105 !! options
27106 parsoid={
27107 "modes": ["html2wt"],
27108 "scrubWikitext": true
27109 }
27110 !! html
27111 <font>foo</font>
27112 <font><font>bar</font></font>
27113 <font class="x">boo</font>
27114 !! wikitext
27115 foo
27116 bar
27117 <font class="x">boo</font>
27118 !! end
27119
27120 !! test
27121 5b. font tags should not be dropped without scrubWikitext being enabled
27122 !! options
27123 parsoid={
27124 "modes": ["html2wt"],
27125 "scrubWikitext": false
27126 }
27127 !! html
27128 <font>foo</font>
27129 !! wikitext
27130 <font>foo</font>
27131 !! end
27132
27133 !! test
27134 Escape nowiki DOM elements
27135 !! options
27136 parsoid=html2wt
27137 !! html/parsoid
27138 <nowiki><i>foo</i></nowiki>
27139 !! wikitext
27140 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
27141 !! end
27142
27143 # This is meant to be an interim fix while we go about figuring out
27144 # how to not introduce these trailing <nowiki/>s in the first place.
27145 !! test
27146 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
27147 !! options
27148 parsoid=html2wt
27149 !! html/parsoid
27150 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
27151 y</p>
27152 <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>
27153 <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>
27154 !! wikitext
27155 x
27156 y
27157
27158 {{echo|
27159 1 = <nowiki/>}}
27160
27161 {{echo|
27162 1 = <nowiki/>
27163 }}
27164 !! end
27165
27166 # ---------------------------------------------------
27167 # End of tests spec'ing wikitext serialization norms |
27168 # ---------------------------------------------------
27169
27170 # T104032
27171 !! test
27172 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
27173 !! options
27174 parsoid=html2wt
27175 !! html/parsoid
27176 a<p>b</p>
27177 <b>c</b><p>d</p>
27178 <table><tr>
27179 <td>a<p>b</p></td>
27180 <td><b>c</b><p>d</p></td>
27181 </tr></table>
27182 !! wikitext
27183 a
27184
27185 b
27186
27187 '''c'''
27188
27189 d
27190 {|
27191 |a
27192 b
27193 |'''c'''
27194 d
27195 |}
27196 !! end
27197
27198 # -----------------------------------------------------------------
27199 # End of section for Parsoid-only html2wt tests for serialization
27200 # of new content
27201 # -----------------------------------------------------------------
27202
27203 # -----------------------------------------------------------------
27204 # The following section of tests are primarily to spec behavior of
27205 # the selective serializer. All these tests have manual selser
27206 # changes. The automated selser changes for all tests handle the
27207 # wide variation of changes, but these tests here capture specs
27208 # deterministically.
27209 # ----------------------------------------------------------------
27210
27211 ## T90517
27212 !! test
27213 Selser: New comments should not be lost
27214 !! options
27215 parsoid={
27216 "modes": ["selser"],
27217 "changes": [
27218 [ "#a", "after", "<!--c1-->" ],
27219 [ "#b", "before", "<!--c2-->" ]
27220 ]
27221 }
27222 !! wikitext
27223 <span id="a">a</span>
27224
27225 <span id="b">b</span>
27226 !! wikitext/edited
27227 <span id="a">a</span><!--c1-->
27228
27229 <!--c2--><span id="b">b</span>
27230 !! end
27231
27232 ## T89383
27233 !! test
27234 Selser: Check for validity of DSR before using it
27235 !! options
27236 parsoid={
27237 "modes": ["selser"],
27238 "changes": [
27239 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
27240 ]
27241 }
27242 !! wikitext
27243 <span id="a">a</span>
27244 !! wikitext/edited
27245 {{DISPLAYTITLE:foo}}
27246 <span id="a">a</span>
27247 !! end
27248
27249 !! test
27250 1. DOMDiff: Changes to <ref> content should be looked up using id
27251 !! options
27252 parsoid={
27253 "modes": ["selser"],
27254 "changes": [
27255 ["#X", "after", "bar"],
27256 ["#Y", "after", "baz"]
27257 ]
27258 }
27259 !! wikitext
27260 X <ref><span id="X">foo</span></ref>
27261 Y <ref name="a" />
27262 <references>
27263 <ref name="a"><span id="Y">foo</span></ref>
27264 </references>
27265 !! wikitext/edited
27266 X <ref><span id="X">foo</span>bar</ref>
27267 Y <ref name="a" />
27268 <references>
27269 <ref name="a"><span id="Y">foo</span>baz</ref>
27270 </references>
27271 !! end
27272
27273 !! test
27274 2. DOMDiff: Changes to <ref> content should be looked up using id
27275 !! options
27276 parsoid={
27277 "modes": ["selser"],
27278 "changes": [
27279 ["#Z", "after", "bar"]
27280 ]
27281 }
27282 !! wikitext
27283 A <ref>foo bar for a</ref>
27284 B <ref group="X" name="b" />
27285
27286 <references />
27287
27288 <references group="X">
27289 <ref name="b"><span id="Z">foo</span></ref>
27290 </references>
27291 !! wikitext/edited
27292 A <ref>foo bar for a</ref>
27293 B <ref group="X" name="b" />
27294
27295 <references />
27296
27297 <references group="X">
27298 <ref name="b"><span id="Z">foo</span>bar</ref>
27299 </references>
27300 !! end
27301
27302 !! test
27303 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
27304 !! options
27305 parsoid={
27306 "modes": ["selser"],
27307 "changes": [
27308 [ "div:first-child", "text", "bar" ]
27309 ]
27310 }
27311 !! wikitext
27312 <div style="{{1x|color:red;}}%">foo</div>
27313 !! wikitext/edited
27314 <div style="{{1x|color:red;}}%">bar</div>
27315 !! end
27316
27317 !! test
27318 Empty LI (T49673)
27319 !! wikitext
27320 * a
27321 *
27322 *
27323 * b
27324 !! html/php+tidy
27325 <ul>
27326 <li>a</li>
27327 <li class="mw-empty-elt"></li>
27328 <li class="mw-empty-elt"></li>
27329 <li>b</li>
27330 </ul>
27331 !! end
27332
27333 !! test
27334 Thumbnail output
27335 !! wikitext
27336 [[File:Thumb.png|thumb]]
27337 !! html/php+tidy
27338 <div class="thumb tright">
27339 <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>
27340 <div class="thumbcaption">
27341 <div class="magnify"><a href="/wiki/File:Thumb.png" class="internal" title="Enlarge"></a></div>
27342 </div>
27343 </div>
27344 </div>
27345 !! end
27346
27347 !! test
27348 unclosed internal link XSS (T137264)
27349 !! wikitext
27350 [[#%3Cscript%3Ealert(1)%3C/script%3E|
27351 !! html/php
27352 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
27353 </p>
27354 !! html/parsoid
27355 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
27356 !! end