Sync up with Parsoid parserTests.
[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/php
14734 cat=MediaWiki_User's_Guide sort=
14735 !! html/parsoid
14736 <link rel="mw:PageProp/Category" href="./Category:MediaWiki_User's_Guide" data-parsoid='{"stx":"simple","a":{"href":"./Category:MediaWiki_User&#39;s_Guide"},"sa":{"href":"Category:MediaWiki User&#39;s Guide"}}'/>
14737 !! end
14738
14739 !! test
14740 PAGESINCATEGORY invalid title fatal (r33546 fix)
14741 !! wikitext
14742 {{PAGESINCATEGORY:<bogus>}}
14743 !! html
14744 <p>0
14745 </p>
14746 !! end
14747
14748 !! test
14749 Category with different sort key
14750 !! options
14751 cat
14752 !! wikitext
14753 [[Category:MediaWiki User's Guide|Foo]]
14754 !! html/php
14755 cat=MediaWiki_User's_Guide sort=Foo
14756 !! html/parsoid
14757 <link rel="mw:PageProp/Category" href="./Category:MediaWiki_User's_Guide#Foo" data-parsoid='{"stx":"piped","a":{"href":"./Category:MediaWiki_User&#39;s_Guide"},"sa":{"href":"Category:MediaWiki User&#39;s Guide"}}'/>
14758 !! end
14759
14760 !! test
14761 Category with identical sort key
14762 !! options
14763 cat
14764 !! wikitext
14765 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14766 !! html/php
14767 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
14768 !! html/parsoid
14769 <link rel="mw:PageProp/Category" href="./Category:MediaWiki_User's_Guide#MediaWiki%20User's%20Guide" data-parsoid='{"stx":"piped","a":{"href":"./Category:MediaWiki_User&#39;s_Guide"},"sa":{"href":"Category:MediaWiki User&#39;s Guide"}}'/>
14770 !! end
14771
14772 !! test
14773 Category with empty sort key
14774 !! options
14775 cat
14776 pst
14777 !! wikitext
14778 [[Category:MediaWiki User's Guide|]]
14779 !! html/php
14780 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14781 !! end
14782
14783 !! test
14784 Category with empty sort key and parentheses
14785 !! options
14786 cat
14787 pst
14788 !! wikitext
14789 [[Category:Foo (bar)|]]
14790 !! html/php
14791 [[Category:Foo (bar)|Foo]]
14792 !! end
14793
14794 !! test
14795 Category with link tail
14796 !! options
14797 cat
14798 pst
14799 !! wikitext
14800 123[[Category:Foo]]456
14801 !! html/php
14802 123[[Category:Foo]]456
14803 !! end
14804
14805 !! test
14806 Category with template
14807 !! options
14808 cat
14809 pst
14810 !! wikitext
14811 [[Category:{{echo|Foo}}]]
14812 !! html/php
14813 [[Category:{{echo|Foo}}]]
14814 !! end
14815
14816 !! test
14817 Category with template in sort key
14818 !! options
14819 cat
14820 pst
14821 !! wikitext
14822 [[Category:Foo|{{echo|Bar}}]]
14823 !! html/php
14824 [[Category:Foo|{{echo|Bar}}]]
14825 !! end
14826
14827 !! test
14828 Category with template in sort key and title
14829 !! options
14830 cat
14831 pst
14832 !! wikitext
14833 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14834 !! html/php
14835 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14836 !! end
14837
14838 ## We used to, but no longer wt2wt this test since the default serializer
14839 ## will normalize all categories to serialize on their own line.
14840 ## This wikitext usage is going to be fairly uncommon in production and
14841 ## selser will take care of preserving formatting in those scenarios.
14842 !! test
14843 Category / paragraph interactions
14844 !! options
14845 parsoid=wt2html
14846 !! wikitext
14847 Foo [[Category:Baz]] Bar
14848
14849 Foo [[Category:Baz]]
14850 Bar
14851
14852 Foo
14853 [[Category:Baz]]
14854 Bar
14855
14856 Foo
14857 [[Category:Baz]] Bar
14858
14859 Foo
14860 [[Category:Baz]]
14861 [[Category:Baz]]
14862 [[Category:Baz]]
14863 Bar
14864
14865 [[Category:Baz]]
14866 [[Category:Baz]]
14867 [[Category:Baz]]
14868
14869 [[Category:Baz]]
14870 {{echo|[[Category:Baz]]}}
14871 [[Category:Baz]]
14872 !! html/php
14873 <p>Foo Bar
14874 </p><p>Foo
14875 Bar
14876 </p><p>Foo
14877 Bar
14878 </p><p>Foo Bar
14879 </p><p>Foo
14880 Bar
14881 </p>
14882 !! html/parsoid
14883 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
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"/> <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>
14888 <link rel="mw:PageProp/Category" href="Category:Baz"/>
14889 !! end
14890
14891 ## We used to, but no longer wt2wt this test since the default serializer
14892 ## will normalize all categories to serialize on their own line.
14893 ## This wikitext usage is going to be fairly uncommon in production and
14894 ## selser will take care of preserving formatting in those scenarios.
14895 ##
14896 ## The whitespace on the empty line is part of the test. Please do not delete
14897 !! test
14898 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14899 !! options
14900 parsoid=wt2html
14901 !! wikitext
14902 This
14903
14904 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14905
14906 {{echo|[[Category:Foo]] and so should this!}}
14907 !! html/php
14908 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14909 </p>
14910 !! html/parsoid
14911 <p>This
14912
14913 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14914
14915 <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>
14916 !! end
14917
14918 ## Parsoid will not try to wt2wt this while preserving newlines because
14919 ## it suppresses excess newlines within list items -- and we don't want to
14920 ## introduce a special case just for categories, which is, in reality somewhat
14921 ## odd behavior -- categories are unlikely to be used in list items like this
14922 ## in top-level pages and are only likely to show up in template-generated
14923 ## list items where this RT-ing is a non-issue.
14924 ##
14925 ## The whitespace on the empty line is part of the test. Please do not delete
14926 !! test
14927 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14928 !! options
14929 parsoid=wt2html
14930 !! wikitext
14931 * This
14932
14933 [[Category:Foo]] and this should be part of the same list item
14934 * So should this
14935
14936 {{echo|[[Category:Foo]] and this should be part of the same list item}}
14937 !! html
14938 <ul><li>This and this should be part of the same list item</li>
14939 <li>So should this and this should be part of the same list item</li></ul>
14940 !! html/parsoid
14941 <ul>
14942 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
14943 <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>
14944 </ul>
14945 !! end
14946
14947 ## Newlines and categories that follow the last item of a list
14948 ## are treated differently because this (list followed by categories)
14949 ## is an extremely common pattern on wikis.
14950 !! test
14951 3. Categories and newlines: newline suppression for last list item should RT properly
14952 !! wikitext
14953 * a
14954 * b
14955
14956 [[Category:Foo]]
14957
14958 [[Category:Bar]]
14959 [[Category:Baz]]
14960 !! html/parsoid
14961 <ul><li> a</li>
14962 <li> b</li></ul>
14963
14964 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14965
14966 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14967 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14968 !! end
14969
14970 !! test
14971 4. Categories and newlines: newline suppression for last list item should RT properly
14972 !! wikitext
14973 * a
14974 **** b
14975
14976 [[Category:Foo]]
14977 !! html/parsoid
14978 <ul><li> a
14979 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
14980
14981 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14982 !! end
14983
14984 ## only wt2html for this to make sure the algo only applies to the rightmost path
14985 !! test
14986 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
14987 !! options
14988 parsoid=wt2html
14989 !! wikitext
14990 * a
14991 ** b
14992 [[Category:Foo]]
14993 * c
14994 ** d
14995 [[Category:Foo]]
14996 !! html/parsoid
14997 <ul><li> a
14998 <ul><li> b
14999 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
15000 <li> c
15001 <ul><li> d</li></ul></li></ul>
15002 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15003 !! end
15004
15005 ## We used to, but no longer wt2wt this test since the default serializer
15006 ## will normalize all categories to serialize on their own line.
15007 ## This wikitext usage is going to be fairly uncommon in production and
15008 ## selser will take care of preserving formatting in those scenarios.
15009 !! test
15010 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
15011 !! options
15012 parsoid=wt2html
15013 !! wikitext
15014 * a [[Category:Foo]]
15015 !! html/parsoid
15016 <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>
15017 !! end
15018
15019 # This test also demonstrates because of newline+category tunneling
15020 # through the list hander, template wrapping doesn't expand to the
15021 # containing list when the list item swallows the category.
15022 !! test
15023 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
15024 !! wikitext
15025 * {{echo|a
15026 [[Category:Foo]]}}
15027 !! html/parsoid
15028 <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
15029 </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>
15030 !! end
15031
15032 !! test
15033 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
15034 !! wikitext
15035 * a
15036
15037 {{echo|[[Category:Foo]]
15038 [[Category:Bar]]}}
15039 [[Category:Baz]]
15040 !! html/parsoid
15041 <ul><li> a</li></ul>
15042
15043 <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">
15044 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15045 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15046 !! end
15047
15048 !! test
15049 Category links with multiple namespaces
15050 !! wikitext
15051 [[Category:Project:Foo]]
15052 !! html/parsoid
15053 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
15054 !! end
15055
15056 !! test
15057 Parsoid: Serialize link to category page with colon escape
15058 !! options
15059 parsoid
15060 !! wikitext
15061
15062 [[:Category:Foo]]
15063 [[:Category:Foo|Bar]]
15064 !! html
15065 <p>
15066 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
15067 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
15068 </p>
15069 !! end
15070
15071 # We used to, but no longer wt2wt this test since the default serializer
15072 # will normalize all categories to serialize on their own line.
15073 # This wikitext usage is going to be fairly uncommon in production and
15074 # selser will take care of preventing whitespace insertion if this
15075 # occurs in an article.
15076 #
15077 # html2html disabled for the same reason (whitespace insertion between
15078 # x and y).
15079 #
15080 # html2wt disabled because it localizes the "Category" namespace.
15081 !! test
15082 Link prefix/suffixes aren't applied to category links
15083 !! options
15084 parsoid=wt2html
15085 language=is
15086 !! wikitext
15087 x[[Category:Foo]]y
15088 !! html/php
15089 <p>xy
15090 </p>
15091 !! html/parsoid
15092 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
15093 !! end
15094
15095 !! test
15096 Parsoid: Serialize link to file page with colon escape
15097 !! options
15098 parsoid
15099 !! wikitext
15100
15101 [[:File:Foo.png]]
15102 [[:File:Foo.png|Bar]]
15103 !! html
15104 <p>
15105 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
15106 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
15107 </p>
15108 !! end
15109
15110 !! test
15111 Parsoid: Serialize a genuine category link without colon escape
15112 !! options
15113 parsoid
15114 !! wikitext
15115 [[Category:Foo]]
15116 [[Category:Foo|Bar]]
15117 !! html
15118 <link rel="mw:PageProp/Category" href="./Category:Foo">
15119 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
15120 !! end
15121
15122 !! test
15123 Normalize hrefs properly before testing for invalid link targets (bug 70894)
15124 !! options
15125 parsoid=html2wt
15126 !! html/parsoid
15127 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
15128 !! wikitext
15129 [[Category:Toxine bactérienne]]
15130 !! end
15131
15132 !! test
15133 Parsoid: Defaultsort
15134 !! wikitext
15135 {{DEFAULTSORT:Foo}}
15136 !! html/parsoid
15137 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
15138 !! end
15139
15140 !! test
15141 Parsoid: Defaultsort (template-generated)
15142 !! wikitext
15143 {{{{echo|DEFAULTSORT}}:Foo}}
15144 !! html/parsoid
15145 <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}}]}'/>
15146 !! end
15147
15148 ###
15149 ### Inter-language links
15150 ###
15151 !! test
15152 Interlanguage links
15153 !! options
15154 ill
15155 !! wikitext
15156 [[es:Alimento]]
15157 [[fr:Nourriture]]
15158 [[zh:食品]]
15159 !! html/php
15160 es:Alimento fr:Nourriture zh:食品
15161 !! html/parsoid
15162 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
15163 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
15164 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
15165 !! end
15166
15167 !! test
15168 Duplicate interlanguage links (bug 24502)
15169 !! options
15170 ill
15171 !! wikitext
15172 [[es:1]]
15173 [[es:2]]
15174 [[fr:1]]
15175 [[fr:2]]
15176 !! html/php
15177 es:1 fr:1
15178 !! html/parsoid
15179 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
15180 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
15181 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
15182 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
15183 !! end
15184
15185 ###
15186 ### Sections
15187 ###
15188 !! test
15189 Basic section headings
15190 !! wikitext
15191 == Headline 1 ==
15192 Some text
15193
15194 ==Headline 2==
15195 More
15196 ===Smaller headline===
15197 Blah blah
15198 !! html
15199 <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>
15200 <p>Some text
15201 </p>
15202 <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>
15203 <p>More
15204 </p>
15205 <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>
15206 <p>Blah blah
15207 </p>
15208 !! end
15209
15210 !! test
15211 Section headings with TOC
15212 !! wikitext
15213 == Headline 1 ==
15214 === Subheadline 1 ===
15215 ===== Skipping a level =====
15216 ====== Skipping a level ======
15217
15218 == Headline 2 ==
15219 Some text
15220 ===Another headline===
15221 !! html
15222 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15223 <ul>
15224 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
15225 <ul>
15226 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
15227 <ul>
15228 <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>
15229 <ul>
15230 <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>
15231 </ul>
15232 </li>
15233 </ul>
15234 </li>
15235 </ul>
15236 </li>
15237 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
15238 <ul>
15239 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
15240 </ul>
15241 </li>
15242 </ul>
15243 </div>
15244
15245 <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>
15246 <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>
15247 <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>
15248 <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>
15249 <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>
15250 <p>Some text
15251 </p>
15252 <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>
15253
15254 !! end
15255
15256 !! test
15257 TOC anchors don't collide
15258 !! wikitext
15259 __FORCETOC__
15260 == Headline 2 ==
15261 == Headline ==
15262 == Headline 2 ==
15263 == Headline ==
15264 !! html/php
15265 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15266 <ul>
15267 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
15268 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
15269 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
15270 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
15271 </ul>
15272 </div>
15273
15274 <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>
15275 <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>
15276 <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>
15277 <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>
15278
15279 !! end
15280
15281 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
15282 !! test
15283 Handling of sections up to level 6 and beyond
15284 !! wikitext
15285 = Level 1 Heading=
15286 == Level 2 Heading==
15287 === Level 3 Heading===
15288 ==== Level 4 Heading====
15289 ===== Level 5 Heading=====
15290 ====== Level 6 Heading======
15291 ======= Level 7 Heading=======
15292 ======== Level 8 Heading========
15293 ========= Level 9 Heading=========
15294 ========== Level 10 Heading==========
15295 !! html
15296 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15297 <ul>
15298 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
15299 <ul>
15300 <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>
15301 <ul>
15302 <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>
15303 <ul>
15304 <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>
15305 <ul>
15306 <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>
15307 <ul>
15308 <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>
15309 <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>
15310 <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>
15311 <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>
15312 <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>
15313 </ul>
15314 </li>
15315 </ul>
15316 </li>
15317 </ul>
15318 </li>
15319 </ul>
15320 </li>
15321 </ul>
15322 </li>
15323 </ul>
15324 </div>
15325
15326 <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>
15327 <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>
15328 <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>
15329 <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>
15330 <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>
15331 <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>
15332 <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>
15333 <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>
15334 <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>
15335 <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>
15336
15337 !! end
15338
15339 !! test
15340 TOC regression (T11764)
15341 !! wikitext
15342 == title 1 ==
15343 === title 1.1 ===
15344 ==== title 1.1.1 ====
15345 === title 1.2 ===
15346 == title 2 ==
15347 === title 2.1 ===
15348 !! html
15349 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15350 <ul>
15351 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15352 <ul>
15353 <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>
15354 <ul>
15355 <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>
15356 </ul>
15357 </li>
15358 <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>
15359 </ul>
15360 </li>
15361 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15362 <ul>
15363 <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>
15364 </ul>
15365 </li>
15366 </ul>
15367 </div>
15368
15369 <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>
15370 <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>
15371 <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>
15372 <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>
15373 <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>
15374 <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>
15375
15376 !! end
15377
15378 !! test
15379 TOC for heading containing <span id="..."></span> (T96153)
15380 !! wikitext
15381 __FORCETOC__
15382 ==<span id="old-anchor"></span>New title==
15383 !! html/php
15384 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15385 <ul>
15386 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
15387 </ul>
15388 </div>
15389
15390 <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>
15391
15392 !! end
15393
15394 !! test
15395 TOC with wgMaxTocLevel=3 (bug 6204)
15396 !! options
15397 wgMaxTocLevel=3
15398 !! wikitext
15399 == title 1 ==
15400 === title 1.1 ===
15401 ==== title 1.1.1 ====
15402 === title 1.2 ===
15403 == title 2 ==
15404 === title 2.1 ===
15405 !! html
15406 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15407 <ul>
15408 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15409 <ul>
15410 <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>
15411 <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>
15412 </ul>
15413 </li>
15414 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15415 <ul>
15416 <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>
15417 </ul>
15418 </li>
15419 </ul>
15420 </div>
15421
15422 <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>
15423 <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>
15424 <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>
15425 <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>
15426 <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>
15427 <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>
15428
15429 !! end
15430
15431 !! test
15432 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
15433 !! options
15434 wgMaxTocLevel=3
15435 !! wikitext
15436 ==Section 1==
15437 ===Section 1.1===
15438 ====Section 1.1.1====
15439 ====Section 1.1.1.1====
15440 ==Section 2==
15441 !! html
15442 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15443 <ul>
15444 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15445 <ul>
15446 <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>
15447 </ul>
15448 </li>
15449 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15450 </ul>
15451 </div>
15452
15453 <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>
15454 <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>
15455 <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>
15456 <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>
15457 <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>
15458
15459 !! end
15460
15461
15462 !! test
15463 Resolving duplicate section names
15464 !! wikitext
15465 == Foo bar ==
15466 == Foo bar ==
15467 !! html
15468 <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>
15469 <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>
15470
15471 !! end
15472
15473 !! test
15474 Resolving duplicate section names with differing case (bug 10721)
15475 !! wikitext
15476 == Foo bar ==
15477 == Foo Bar ==
15478 !! html
15479 <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>
15480 <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>
15481
15482 !! end
15483
15484 !! article
15485 Template:sections
15486 !! text
15487 ===Section 1===
15488 ==Section 2==
15489 !! endarticle
15490
15491 !! test
15492 Template with sections, __NOTOC__
15493 !! wikitext
15494 __NOTOC__
15495 ==Section 0==
15496 {{sections}}
15497 ==Section 4==
15498 !! html
15499 <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>
15500 <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>
15501 <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>
15502 <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>
15503
15504 !! end
15505
15506 !! test
15507 __NOEDITSECTION__ keyword
15508 !! wikitext
15509 __NOEDITSECTION__
15510 ==Section 1==
15511 ==Section 2==
15512 !! html
15513 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15514 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15515
15516 !! end
15517
15518 !! test
15519 Link inside a section heading
15520 !! wikitext
15521 ==Section with a [[Main Page|link]] in it==
15522 !! html
15523 <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>
15524
15525 !! end
15526
15527 !! test
15528 TOC regression (T14077)
15529 !! wikitext
15530 __TOC__
15531 == title 1 ==
15532 === title 1.1 ===
15533 == title 2 ==
15534 !! html
15535 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15536 <ul>
15537 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15538 <ul>
15539 <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>
15540 </ul>
15541 </li>
15542 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15543 </ul>
15544 </div>
15545
15546 <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>
15547 <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>
15548 <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>
15549
15550 !! end
15551
15552 !! test
15553 BUG 1219 URL next to image (good)
15554 !! wikitext
15555 http://example.com [[File:Foobar.jpg]]
15556 !! html/php
15557 <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>
15558 </p>
15559 !! html/parsoid
15560 <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>
15561 !!end
15562
15563 !! test
15564 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
15565 !! wikitext
15566 ===
15567 The line above must have a trailing space!
15568 === <!--
15569 --> <!-- -->
15570 But just in case it doesn't...
15571 !! html
15572 <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>
15573 <p>The line above must have a trailing space!
15574 </p>
15575 <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>
15576 <p>But just in case it doesn't...
15577 </p>
15578 !! end
15579
15580 !! test
15581 Header with special characters (bug 25462)
15582 !! wikitext
15583 The tooltips shall not show entities to the user (ie. be double escaped)
15584
15585 == text > text ==
15586 section 1
15587
15588 == text < text ==
15589 section 2
15590
15591 == text & text ==
15592 section 3
15593
15594 == text ' text ==
15595 section 4
15596
15597 == text " text ==
15598 section 5
15599 !! html
15600 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15601 </p>
15602 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15603 <ul>
15604 <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>
15605 <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>
15606 <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>
15607 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15608 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15609 </ul>
15610 </div>
15611
15612 <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>
15613 <p>section 1
15614 </p>
15615 <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>
15616 <p>section 2
15617 </p>
15618 <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>
15619 <p>section 3
15620 </p>
15621 <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>
15622 <p>section 4
15623 </p>
15624 <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>
15625 <p>section 5
15626 </p>
15627 !! end
15628
15629 !! test
15630 Header with space, plus and underscore as entity
15631 !! wikitext
15632 Id should not contain + for spaces
15633
15634 == Space between Text ==
15635 section 1
15636
15637 == Space-Entity&#32;between&#32;Text ==
15638 section 2
15639
15640 == Plus+between+Text ==
15641 section 3
15642
15643 == Plus-Entity&#43;between&#43;Text ==
15644 section 4
15645
15646 == Underscore_between_Text ==
15647 section 5
15648
15649 == Underscore-Entity&#95;between&#95;Text ==
15650 section 6
15651
15652 [[#Space between Text]]
15653 [[#Space-Entity&#32;between&#32;Text]]
15654 [[#Plus+between+Text]]
15655 [[#Plus-Entity&#43;between&#43;Text]]
15656 [[#Underscore_between_Text]]
15657 [[#Underscore-Entity&#95;between&#95;Text]]
15658 !! html
15659 <p>Id should not contain + for spaces
15660 </p>
15661 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15662 <ul>
15663 <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>
15664 <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>
15665 <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>
15666 <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>
15667 <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>
15668 <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>
15669 </ul>
15670 </div>
15671
15672 <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>
15673 <p>section 1
15674 </p>
15675 <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>
15676 <p>section 2
15677 </p>
15678 <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>
15679 <p>section 3
15680 </p>
15681 <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>
15682 <p>section 4
15683 </p>
15684 <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>
15685 <p>section 5
15686 </p>
15687 <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>
15688 <p>section 6
15689 </p><p><a href="#Space_between_Text">#Space between Text</a>
15690 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15691 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15692 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15693 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15694 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15695 </p>
15696 !! end
15697
15698 !! test
15699 Headers with excess '=' characters
15700 (Are similar tests necessary beyond the 1st level?)
15701 !! wikitext
15702 =foo==
15703 ==foo=
15704 =''italic'' heading==
15705 ==''italic'' heading=
15706 !! html
15707 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15708 <ul>
15709 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15710 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15711 <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>
15712 <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>
15713 </ul>
15714 </div>
15715
15716 <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>
15717 <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>
15718 <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>
15719 <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>
15720
15721 !! end
15722
15723 !! test
15724 HTML headers vs TOC (bug 23393)
15725 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15726 !! wikitext
15727 <h1>Header 1</h1>
15728 == Header 1.1 ==
15729 == Header 1.2 ==
15730
15731 <h1>Header 2
15732 </h1>
15733 == Header 2.1 ==
15734 == Header 2.2 ==
15735 __NOEDITSECTION__
15736 !! html
15737 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15738 <ul>
15739 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15740 <ul>
15741 <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>
15742 <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>
15743 </ul>
15744 </li>
15745 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15746 <ul>
15747 <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>
15748 <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>
15749 </ul>
15750 </li>
15751 </ul>
15752 </div>
15753
15754 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15755 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15756 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15757 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15758 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15759 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15760
15761 !! end
15762
15763 !! test
15764 Single-line or multiline-comments can follow headings
15765 !! options
15766 parsoid=wt2html,wt2wt
15767 !! wikitext
15768 ==foo==<!---->
15769 ==bar==<!--c1-->
15770 ==baz==<!--
15771 c2
15772 c3-->
15773 !! html
15774 <h2><span class="mw-headline" id="foo">foo</span></h2>
15775 <h2><span class="mw-headline" id="bar">bar</span></h2>
15776 <h2><span class="mw-headline" id="baz">baz</span></h2>
15777
15778 !! end
15779
15780 !! test
15781 BUG 1219 URL next to image (broken)
15782 !! wikitext
15783 http://example.com[[File:Foobar.jpg]]
15784 !! html/php
15785 <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>
15786 </p>
15787 !! html/parsoid
15788 <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>
15789 !!end
15790
15791 !! test
15792 Bug 1186 news: in the middle of text
15793 !! wikitext
15794 http://en.wikinews.org/wiki/Wikinews:Workplace
15795 !! html
15796 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15797 </p>
15798 !!end
15799
15800
15801 !! test
15802 Namespaced link must have a title
15803 !! wikitext
15804 [[Project:]]
15805 !! html
15806 <p>[[Project:]]
15807 </p>
15808 !!end
15809
15810 !! test
15811 Namespaced link must have a title (bad fragment version)
15812 !! wikitext
15813 [[Project:#fragment]]
15814 !! html
15815 <p>[[Project:#fragment]]
15816 </p>
15817 !!end
15818
15819
15820 ###
15821 ### HTML tags and HTML attributes
15822 ###
15823
15824 !! test
15825 div with no attributes
15826 !! wikitext
15827 <div>HTML rocks</div>
15828 !! html
15829 <div>HTML rocks</div>
15830
15831 !! end
15832
15833 !! test
15834 div with double-quoted attribute
15835 !! wikitext
15836 <div id="rock">HTML rocks</div>
15837 !! html
15838 <div id="rock">HTML rocks</div>
15839
15840 !! end
15841
15842 !! test
15843 div with single-quoted attribute
15844 !! wikitext
15845 <div id='rock'>HTML rocks</div>
15846 !! html
15847 <div id="rock">HTML rocks</div>
15848
15849 !! end
15850
15851 !! test
15852 div with unquoted attribute
15853 !! wikitext
15854 <div id=rock>HTML rocks</div>
15855 !! html
15856 <div id="rock">HTML rocks</div>
15857
15858 !! end
15859
15860 !! test
15861 div with illegal double attributes
15862 !! wikitext
15863 <div id="a" id="b">HTML rocks</div>
15864 !! html
15865 <div id="b">HTML rocks</div>
15866
15867 !!end
15868
15869 !! test
15870 div with empty attribute value, space before equals
15871 !! options
15872 parsoid=wt2html,html2html
15873 !! wikitext
15874 <div class =>HTML rocks</div>
15875 !! html/php
15876 <div class="">HTML rocks</div>
15877
15878 !! html/parsoid
15879 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15880 !! end
15881
15882 !! test
15883 div with multiple empty attribute values
15884 !! options
15885 parsoid=wt2html,html2html
15886 !! wikitext
15887 <div id= title=>HTML rocks</div>
15888 !! html/php
15889 <div id="title.3D">HTML rocks</div>
15890
15891 !! html/parsoid
15892 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15893 !! end
15894
15895 !! test
15896 table with multiple empty attribute values
15897 !! options
15898 parsoid=wt2html,html2html
15899 !! wikitext
15900 {| title= id=
15901 | hi
15902 |}
15903 !! html/php
15904 <table title="id=">
15905 <tr>
15906 <td> hi
15907 </td></tr></table>
15908
15909 !! html/parsoid
15910 <table title="id=">
15911 <tbody><tr><td> hi</td></tr>
15912 </tbody></table>
15913 !! end
15914
15915 !! test
15916 div with braces in attribute value
15917 !! wikitext
15918 <div title="{}">Foo</div>
15919 !! html/php
15920 <div title="&#123;}">Foo</div>
15921
15922 !! html/parsoid
15923 <div title="{}">Foo</div>
15924 !! end
15925
15926 !! test
15927 div with empty attribute value, no space before equals
15928 !! options
15929 parsoid=wt2html,html2html
15930 !! wikitext
15931 <div class=>HTML rocks</div>
15932 !! html/php
15933 <div class="">HTML rocks</div>
15934
15935 !! html/parsoid
15936 <div class="">HTML rocks</div>
15937 !! end
15938
15939 !! test
15940 HTML multiple attributes correction
15941 !! wikitext
15942 <p class="error" class="awesome">Awesome!</p>
15943 !! html
15944 <p class="awesome">Awesome!</p>
15945
15946 !!end
15947
15948 !! test
15949 Table multiple attributes correction
15950 !! wikitext
15951 {|
15952 !+ class="error" class="awesome"| status
15953 |}
15954 !! html
15955 <table>
15956 <tr>
15957 <th class="awesome"> status
15958 </th></tr></table>
15959
15960 !!end
15961
15962 !! test
15963 DIV IN UPPERCASE
15964 !! wikitext
15965 <DIV ID="x">HTML ROCKS</DIV>
15966 !! html
15967 <div id="x">HTML ROCKS</div>
15968
15969 !!end
15970
15971 !! test
15972 Non-ASCII pseudo-tags are rendered as text
15973 !! wikitext
15974 <khyô>
15975 !! html
15976 <p>&lt;khyô&gt;
15977 </p>
15978 !! end
15979
15980 !! test
15981 Pseudo-tag with URL 'name' renders as url link
15982 !! wikitext
15983 <http://example.com/>
15984 !! html
15985 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
15986 </p>
15987 !! end
15988
15989 !! test
15990 text with amp in the middle of nowhere
15991 !! wikitext
15992 Remember AT&T?
15993 !! html
15994 <p>Remember AT&amp;T?
15995 </p>
15996 !! end
15997
15998 !! test
15999 text with character entity: eacute
16000 !! wikitext
16001 I always thought &eacute; was a cute letter.
16002 !! html
16003 <p>I always thought &#233; was a cute letter.
16004 </p>
16005 !! html+tidy
16006 <p>I always thought é was a cute letter.</p>
16007 !! end
16008
16009 !! test
16010 text with entity-escaped character entity-like string: eacute
16011 !! wikitext
16012 I always thought &amp;eacute; was a cute letter.
16013 !! html
16014 <p>I always thought &amp;eacute; was a cute letter.
16015 </p>
16016 !! end
16017
16018 !! test
16019 text with undefined character entity: xacute
16020 !! wikitext
16021 I always thought &xacute; was a cute letter.
16022 !! html
16023 <p>I always thought &amp;xacute; was a cute letter.
16024 </p>
16025 !! end
16026
16027 !! test
16028 HTML5 tags
16029 !! wikitext
16030 <data value="5">five</data>
16031 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16032 <mark>This highlighted text</mark>
16033 !! html
16034 <p><data value="5">five</data>
16035 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16036 <mark>This highlighted text</mark>
16037 </p>
16038 !! end
16039
16040 !! test
16041 HTML tag with leading space is parsed as text
16042 !! wikitext
16043 < div>foo< /div>
16044 !! html
16045 <p>&lt; div&gt;foo&lt; /div&gt;
16046 </p>
16047 !! end
16048
16049 ###
16050 ### Nesting tests (see bug 41545, 50604, 51081)
16051 ###
16052
16053 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
16054 # Note that html2wt is considerably more difficult if we use <b> in
16055 # the test case, instead of <big>
16056 !! test
16057 Ensure that HTML adoption agency algorithm is properly implemented.
16058 !! wikitext
16059 <big>X<big>Y</big>Z</big>
16060 !! html
16061 <p><big>X<big>Y</big>Z</big>
16062 </p>
16063 !! end
16064
16065 # This was bug 41545 in the PHP parser.
16066 # Note that tidy doesn't handle this correctly.
16067 !! test
16068 Nesting of <kbd>
16069 !! wikitext
16070 <kbd>X<kbd>Y</kbd>Z</kbd>
16071 !! html
16072 <p><kbd>X<kbd>Y</kbd>Z</kbd>
16073 </p>
16074 !! end
16075
16076 # The following cases were bug 51081 in the PHP parser.
16077 # Note that there are some other nestable tags (b, i, etc) which are
16078 # not covered; see bug 51081 for discussion.
16079
16080 # Note that tidy doesn't handle this correctly.
16081 !! test
16082 Nesting of <em>
16083 !! wikitext
16084 <em>X<em>Y</em>Z</em>
16085 !! html
16086 <p><em>X<em>Y</em>Z</em>
16087 </p>
16088 !! end
16089
16090 # Note that tidy doesn't handle this correctly.
16091 !! test
16092 Nesting of <strong>
16093 !! wikitext
16094 <strong>X<strong>Y</strong>Z</strong>
16095 !! html
16096 <p><strong>X<strong>Y</strong>Z</strong>
16097 </p>
16098 !! end
16099
16100 !! test
16101 Nesting of <q>
16102 !! wikitext
16103 <q>X<q>Y</q>Z</q>
16104 !! html+tidy
16105 <p><q>X<q>Y</q>Z</q></p>
16106 !! end
16107
16108 # Note that tidy doesn't handle this correctly.
16109 !! test
16110 Nesting of <ruby>
16111 !! wikitext
16112 <ruby>X<ruby>Y</ruby>Z</ruby>
16113 !! html
16114 <p><ruby>X<ruby>Y</ruby>Z</ruby>
16115 </p>
16116 !! end
16117
16118 # Note that tidy doesn't handle this correctly.
16119 !! test
16120 Nesting of <bdo>
16121 !! wikitext
16122 <bdo>X<bdo>Y</bdo>Z</bdo>
16123 !! html
16124 <p><bdo>X<bdo>Y</bdo>Z</bdo>
16125 </p>
16126 !! end
16127
16128
16129 ###
16130 ### Media links
16131 ###
16132
16133 !! test
16134 Media link
16135 !! wikitext
16136 [[Media:Foobar.jpg]]
16137 !! html
16138 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
16139 </p>
16140 !! end
16141
16142 !! test
16143 Media link with text
16144 !! wikitext
16145 [[Media:Foobar.jpg|A neat file to look at]]
16146 !! html
16147 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
16148 </p>
16149 !! end
16150
16151 # FIXME: this is still bad HTML tag nesting
16152 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
16153 !! test
16154 Media link with nasty text
16155 !! wikitext
16156 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
16157 !! html
16158 <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>
16159
16160 !! html+tidy
16161 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
16162 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
16163 !! end
16164
16165 !! test
16166 Media link to nonexistent file (bug 1702)
16167 !! wikitext
16168 [[Media:No such.jpg]]
16169 !! html
16170 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
16171 </p>
16172 !! end
16173
16174 !! test
16175 Image link to nonexistent file (bug 1850 - good)
16176 !! wikitext
16177 [[File:No_such.jpg]]
16178 !! html/php
16179 <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>
16180 </p>
16181 !! html/parsoid
16182 <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>
16183 !! end
16184
16185 !! test
16186 :Image link to nonexistent file (bug 1850 - bad)
16187 !! wikitext
16188 [[:Image:No such.jpg]]
16189 !! html/php
16190 <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>
16191 </p>
16192 !! html/parsoid
16193 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
16194 !! end
16195
16196
16197
16198 !! test
16199 Character reference normalization in link text (bug 1938)
16200 !! wikitext
16201 [[Main Page|this&that]]
16202 !! html
16203 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
16204 </p>
16205 !!end
16206
16207 !! article
16208 אַ
16209 !! text
16210 Test for unicode normalization
16211
16212 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
16213 !! endarticle
16214
16215 !! test
16216 (bug 19451) Links should refer to the normalized form.
16217 !! wikitext
16218 [[&#xFB2E;]]
16219 [[&#x5d0;&#x5b7;]]
16220 [[&#x5d0;ַ]]
16221 [[א&#x5b7;]]
16222 [[אַ]]
16223 !! html
16224 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
16225 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
16226 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
16227 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
16228 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
16229 </p>
16230 !! end
16231
16232 !! test
16233 Empty attribute crash test (bug 2067)
16234 !! wikitext
16235 <font color="">foo</font>
16236 !! html
16237 <p><font color="">foo</font>
16238 </p>
16239 !! end
16240
16241 !! test
16242 Empty attribute crash test single-quotes (bug 2067)
16243 !! wikitext
16244 <font color=''>foo</font>
16245 !! html
16246 <p><font color="">foo</font>
16247 </p>
16248 !! end
16249
16250 !! test
16251 Attribute test: equals, then nothing
16252 !! options
16253 parsoid=wt2html,html2html
16254 !! wikitext
16255 <font color=>foo</font>
16256 !! html/php
16257 <p><font color="">foo</font>
16258 </p>
16259 !! html/parsoid
16260 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
16261 !! end
16262
16263 !! test
16264 Attribute test: unquoted value
16265 !! options
16266 parsoid=wt2html,html2html
16267 !! wikitext
16268 <font color=x>foo</font>
16269 !! html/php
16270 <p><font color="x">foo</font>
16271 </p>
16272 !! html/parsoid
16273 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
16274 !! end
16275
16276 !! test
16277 Attribute test: unquoted but illegal value (hash)
16278 !! wikitext
16279 <font color=#x>foo</font>
16280 !! html
16281 <p><font color="#x">foo</font>
16282 </p>
16283 !! end
16284
16285 # Parsoid does not serialize to empty attribute syntax,
16286 # so wt2wt and html2wt cases are skipped
16287 !! test
16288 Attribute test: no value (T54330)
16289 !! options
16290 parsoid=wt2html,html2html
16291 !! wikitext
16292 <font color>foo</font>
16293 !! html/php
16294 <p><font color="">foo</font>
16295 </p>
16296 !! html/parsoid
16297 <p><font color="">foo</font></p>
16298 !! end
16299
16300 !! test
16301 Bug 2095: link with three closing brackets
16302 !! wikitext
16303 [[Main Page]]]
16304 !! html/php
16305 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
16306 </p>
16307 !! html/parsoid
16308 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
16309 !! end
16310
16311 !! test
16312 Bug 2095: link with pipe and three closing brackets
16313 !! wikitext
16314 [[Main Page|link]]]
16315 !! html/php
16316 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
16317 </p>
16318 !! html/parsoid
16319 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
16320 !! end
16321
16322 !! test
16323 Bug 2095: link with pipe and three closing brackets, version 2
16324 !! wikitext
16325 [[Main Page|[http://example.com/]]]
16326 !! html/php
16327 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
16328 </p>
16329 !! html/parsoid
16330 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
16331 !! end
16332
16333
16334 ###
16335 ### Safety
16336 ###
16337
16338 !! article
16339 Template:Dangerous attribute
16340 !! text
16341 " onmouseover="alert(document.cookie)
16342 !! endarticle
16343
16344 !! article
16345 Template:Dangerous style attribute
16346 !! text
16347 border-size: expression(alert(document.cookie))
16348 !! endarticle
16349
16350 !! article
16351 Template:Div style
16352 !! text
16353 <div style="float: right; {{{1}}}">Magic div</div>
16354 !! endarticle
16355
16356 !! test
16357 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
16358 !! wikitext
16359 <div title="{{test}}"></div>
16360 !! html
16361 <div title="This is a test template"></div>
16362
16363 !! end
16364
16365 # Parsoid has enough context to handle this case
16366 !! test
16367 Bug 2304: HTML attribute safety (dangerous template; 2309)
16368 !! wikitext
16369 <div title="{{dangerous attribute}}"></div>
16370 !! html/php
16371 <div title=""></div>
16372
16373 !! html/parsoid
16374 <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>
16375 !! end
16376
16377 !! test
16378 Bug 2304: HTML attribute safety (dangerous style template; 2309)
16379 !! wikitext
16380 <div style="{{dangerous style attribute}}"></div>
16381 !! html
16382 <div style="/* insecure input */"></div>
16383
16384 !! end
16385
16386 !! test
16387 Bug 2304: HTML attribute safety (safe parameter; 2309)
16388 !! wikitext
16389 {{div style|width: 200px}}
16390 !! html
16391 <div style="float: right; width: 200px">Magic div</div>
16392
16393 !! end
16394
16395 !! test
16396 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
16397 !! wikitext
16398 {{div style|width: expression(alert(document.cookie))}}
16399 !! html
16400 <div style="/* insecure input */">Magic div</div>
16401
16402 !! end
16403
16404 !! test
16405 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
16406 !! wikitext
16407 {{div style|"><script>alert(document.cookie)</script>}}
16408 !! html
16409 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16410
16411 !! end
16412
16413 !! test
16414 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
16415 !! wikitext
16416 {{div style|" ><script>alert(document.cookie)</script>}}
16417 !! html
16418 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16419
16420 !! end
16421
16422 !! test
16423 Bug 2304: HTML attribute safety (link)
16424 !! wikitext
16425 <div title="[[Main Page]]"></div>
16426 !! html
16427 <div title="&#91;&#91;Main Page]]"></div>
16428
16429 !! end
16430
16431 !! test
16432 Bug 2304: HTML attribute safety (italics)
16433 !! wikitext
16434 <div title="''foobar''"></div>
16435 !! html
16436 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16437
16438 !! end
16439
16440 !! test
16441 Bug 2304: HTML attribute safety (bold)
16442 !! wikitext
16443 <div title="'''foobar'''"></div>
16444 !! html
16445 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16446
16447 !! end
16448
16449
16450 !! test
16451 Bug 2304: HTML attribute safety (ISBN)
16452 !! wikitext
16453 <div title="ISBN 1234567890"></div>
16454 !! html
16455 <div title="&#73;SBN 1234567890"></div>
16456
16457 !! end
16458
16459 !! test
16460 Bug 2304: HTML attribute safety (RFC)
16461 !! wikitext
16462 <div title="RFC 1234"></div>
16463 !! html
16464 <div title="&#82;FC 1234"></div>
16465
16466 !! end
16467
16468 !! test
16469 Bug 2304: HTML attribute safety (PMID)
16470 !! wikitext
16471 <div title="PMID 1234567890"></div>
16472 !! html
16473 <div title="&#80;MID 1234567890"></div>
16474
16475 !! end
16476
16477 !! test
16478 Bug 2304: HTML attribute safety (web link)
16479 !! wikitext
16480 <div title="http://example.com/"></div>
16481 !! html
16482 <div title="http&#58;//example.com/"></div>
16483
16484 !! end
16485
16486 !! test
16487 Bug 2304: HTML attribute safety (named web link)
16488 !! wikitext
16489 <div title="[http://example.com/ link]"></div>
16490 !! html
16491 <div title="&#91;http&#58;//example.com/ link]"></div>
16492
16493 !! end
16494
16495 !! test
16496 Bug 3244: HTML attribute safety (extension; safe)
16497 !! wikitext
16498 <div style="<nowiki>background:blue</nowiki>"></div>
16499 !! html
16500 <div style="background:blue"></div>
16501
16502 !! end
16503
16504 !! test
16505 Bug 3244: HTML attribute safety (extension; unsafe)
16506 !! wikitext
16507 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16508 !! html
16509 <div style="/* insecure input */"></div>
16510
16511 !! end
16512
16513 # More MSIE fun discovered by Tom Gilder
16514
16515 !! test
16516 MSIE CSS safety test: spurious slash
16517 !! wikitext
16518 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16519 !! html
16520 <div style="/* insecure input */">evil</div>
16521
16522 !! end
16523
16524 !! test
16525 MSIE CSS safety test: hex code
16526 !! wikitext
16527 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16528 !! html
16529 <div style="/* insecure input */">evil</div>
16530
16531 !! end
16532
16533 !! test
16534 MSIE CSS safety test: comment in url
16535 !! wikitext
16536 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16537 !! html
16538 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16539
16540 !! end
16541
16542 !! test
16543 MSIE CSS safety test: comment in expression
16544 !! wikitext
16545 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16546 !! html
16547 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16548
16549 !! end
16550
16551 !! test
16552 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
16553 !! wikitext
16554 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16555 !! html
16556 <p style="/* invalid control char */">A</p>
16557
16558 !! end
16559
16560 !! test
16561 MSIE 6 CSS safety test: Fullwidth (bug 55332)
16562 !! wikitext
16563 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16564 <div style="top:EXPRESSION(alert())">B</div>
16565 !! html
16566 <p style="/* insecure input */">A</p>
16567 <div style="/* insecure input */">B</div>
16568
16569 !! end
16570
16571 !! test
16572 MSIE 6 CSS safety test: IPA extensions (bug 55332)
16573 !! wikitext
16574 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16575 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16576 !! html
16577 <div style="/* insecure input */">A</div>
16578 <p style="/* insecure input */">B</p>
16579
16580 !! end
16581
16582 !! test
16583 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16584 !! wikitext
16585 <div style="background-image:url⁽javascript:alert())">A</div>
16586 <div style="background-image:url₍javascript:alert())">B</div>
16587 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16588 !! html
16589 <div style="/* insecure input */">A</div>
16590 <div style="/* insecure input */">B</div>
16591 <p style="/* insecure input */">C</p>
16592
16593 !! end
16594
16595 # FIXME: Parsoid fails to sanitize this! See T58846.
16596 !! test
16597 Opera -o-link CSS
16598 !! wikitext
16599 <div
16600 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;"
16601 style="-o-link:attr(title);-o-link-source:current">X</div>
16602 !! html
16603 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16604
16605 !! end
16606
16607 !! test
16608 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16609 !! wikitext
16610 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16611 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16612 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16613 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16614 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16615 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16616 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16617 !! html
16618 <p style="/* insecure input */">A</p>
16619 <p style="/* insecure input */">B</p>
16620 <p style="/* insecure input */">C</p>
16621 <p style="/* insecure input */">D</p>
16622 <p style="/* insecure input */">E</p>
16623 <p style="/* insecure input */">F</p>
16624 <p style="/* insecure input */">G</p>
16625
16626 !! end
16627
16628 !! test
16629 Table attribute legitimate extension
16630 !! wikitext
16631 {|
16632 !+ style="<nowiki>color:blue</nowiki>"| status
16633 |}
16634 !! html
16635 <table>
16636 <tr>
16637 <th style="color:blue"> status
16638 </th></tr></table>
16639
16640 !!end
16641
16642 !! test
16643 Table attribute safety
16644 !! wikitext
16645 {|
16646 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16647 |}
16648 !! html
16649 <table>
16650 <tr>
16651 <th style="/* insecure input */"> status
16652 </th></tr></table>
16653
16654 !! end
16655
16656 !! test
16657 CSS line continuation 1
16658 !! wikitext
16659 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16660 !! html
16661 <div style="/* insecure input */"></div>
16662
16663 !! end
16664
16665 !! test
16666 CSS line continuation 2
16667 !! wikitext
16668 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16669 !! html
16670 <div style="/* invalid control char */"></div>
16671
16672 !! end
16673
16674 !! article
16675 Template:Identity
16676 !! text
16677 {{{1}}}
16678 !! endarticle
16679
16680 !! test
16681 Expansion of multi-line templates in attribute values (bug 6255)
16682 !! wikitext
16683 <div style="background: {{identity|#00FF00}}">-</div>
16684 !! html
16685 <div style="background: #00FF00">-</div>
16686
16687 !! end
16688
16689
16690 !! test
16691 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16692 !! wikitext
16693 <div style="background:
16694 #00FF00">-</div>
16695 !! html/php
16696 <div style="background: #00FF00">-</div>
16697
16698 !! html/parsoid
16699 <div style="background:
16700 #00FF00">-</div>
16701 !! end
16702
16703 !! test
16704 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16705 !! wikitext
16706 <div style="background: &#10;#00FF00">-</div>
16707 !! html
16708 <div style="background: &#10;#00FF00">-</div>
16709
16710 !! end
16711
16712 !! test
16713 Tags which are hidden from Tidy cannot pass through the Sanitizer
16714 !! wikitext
16715 <mw:toc><script>alert();</script></mw:toc>
16716 !! html+tidy
16717 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;</p>
16718 !! end
16719
16720 ###
16721 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16722 ###
16723 !! test
16724 Parser hook: empty input
16725 !! wikitext
16726 <tag></tag>
16727 !! html/php
16728 <pre>
16729 ''
16730 array (
16731 )
16732 </pre>
16733
16734 !! html/parsoid
16735 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16736 !! end
16737
16738 ## Don't expect parsoid to rt this form.
16739 !! test
16740 Parser hook: empty input using terminated empty elements
16741 !! options
16742 parsoid=wt2html,html2html
16743 !! wikitext
16744 <tag/>
16745 !! html/php
16746 <pre>
16747 NULL
16748 array (
16749 )
16750 </pre>
16751
16752 !! html/parsoid
16753 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16754 !! end
16755
16756 !! test
16757 Parser hook: empty input using terminated empty elements (space before)
16758 !! wikitext
16759 <tag />
16760 !! html/php
16761 <pre>
16762 NULL
16763 array (
16764 )
16765 </pre>
16766
16767 !! html/parsoid
16768 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16769 !! end
16770
16771 !! test
16772 Parser hook: basic input
16773 !! wikitext
16774 <tag>input</tag>
16775 !! html/php
16776 <pre>
16777 'input'
16778 array (
16779 )
16780 </pre>
16781
16782 !! html/parsoid
16783 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16784 !! end
16785
16786 ## Don't expect parsoid to rt this form.
16787 !! test
16788 Parser hook: case insensitive
16789 !! options
16790 parsoid=wt2html,html2html
16791 !! wikitext
16792 <TAG>input</TAG>
16793 !! html/php
16794 <pre>
16795 'input'
16796 array (
16797 )
16798 </pre>
16799
16800 !! html/parsoid
16801 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16802 !! end
16803
16804 ## Don't expect parsoid to rt this form.
16805 !! test
16806 Parser hook: case insensitive, redux
16807 !! options
16808 parsoid=wt2html,html2html
16809 !! wikitext
16810 <TaG>input</TAg>
16811 !! html/php
16812 <pre>
16813 'input'
16814 array (
16815 )
16816 </pre>
16817
16818 !! html/parsoid
16819 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16820 !! end
16821
16822 !! test
16823 Parser hook: nested tags
16824 !! wikitext
16825 <tag><tag></tag></tag>
16826 !! html/php
16827 <pre>
16828 '<tag>'
16829 array (
16830 )
16831 </pre>&lt;/tag&gt;
16832
16833 !! html/parsoid
16834 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
16835 !! end
16836
16837 !! test
16838 Parser hook: basic arguments
16839 !! wikitext
16840 <tag width="200" height="100" depth="50" square=""></tag>
16841 !! html/php
16842 <pre>
16843 ''
16844 array (
16845 'width' => '200',
16846 'height' => '100',
16847 'depth' => '50',
16848 'square' => '',
16849 )
16850 </pre>
16851
16852 !! html/parsoid
16853 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16854 !! end
16855
16856 ## Don't expect parsoid to rt this form.
16857 !! test
16858 Parser hook: basic arguments, variations
16859 !! options
16860 parsoid=wt2html,html2html
16861 !! wikitext
16862 <tag width=200 height = "100" depth = '50' square></tag>
16863 !! html/php
16864 <pre>
16865 ''
16866 array (
16867 'width' => '200',
16868 'height' => '100',
16869 'depth' => '50',
16870 'square' => '',
16871 )
16872 </pre>
16873
16874 !! html/parsoid
16875 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16876 !! end
16877
16878 !! test
16879 Parser hook: argument containing a forward slash (bug 5344)
16880 !! wikitext
16881 <tag filename="/tmp/bla"></tag>
16882 !! html/php
16883 <pre>
16884 ''
16885 array (
16886 'filename' => '/tmp/bla',
16887 )
16888 </pre>
16889
16890 !! html/parsoid
16891 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16892 !! end
16893
16894 ## Don't expect parsoid to rt this form.
16895 !! test
16896 Parser hook: empty input using terminated empty elements (bug 2374)
16897 !! options
16898 parsoid=wt2html,html2html
16899 !! wikitext
16900 <tag foo=bar/>text
16901 !! html/php
16902 <pre>
16903 NULL
16904 array (
16905 'foo' => 'bar',
16906 )
16907 </pre>text
16908
16909 !! html/parsoid
16910 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
16911 !! end
16912
16913 ## </tag> should be output literally since there is no matching tag that begins it
16914 ## Don't expect parsoid to rt this form.
16915 !! test
16916 Parser hook: basic arguments using terminated empty elements (bug 2374)
16917 !! options
16918 parsoid=wt2html
16919 !! wikitext
16920 <tag width=200 height = "100" depth = '50' square/>
16921 other stuff
16922 </tag>
16923 !! html/php
16924 <pre>
16925 NULL
16926 array (
16927 'width' => '200',
16928 'height' => '100',
16929 'depth' => '50',
16930 'square' => '',
16931 )
16932 </pre>
16933 <p>other stuff
16934 &lt;/tag&gt;
16935 </p>
16936 !! html/parsoid
16937 <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
16938 &lt;/tag></p>
16939 !! end
16940
16941 ## Don't expect parsoid to rt this form.
16942 !! test
16943 Parser hook: Don't allow unclosed extension tags
16944 !! options
16945 parsoid=wt2html
16946 !! wikitext
16947 test <tag>123
16948
16949 this is a '''test'''
16950 !! html/php
16951 <p>test &lt;tag&gt;123
16952 </p><p>this is a <b>test</b>
16953 </p>
16954 !! html/parsoid
16955 <p>test &lt;tag>123</p>
16956
16957 <p>this is a <b>test</b></p>
16958 !! end
16959
16960 ###
16961 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
16962 ###
16963
16964 !! test
16965 Parser hook: static parser hook not inside a comment
16966 !! wikitext
16967 <statictag>hello, world</statictag>
16968
16969 <statictag action="flush" />
16970 !! html/php
16971 <p><br />
16972 hello, world
16973 </p>
16974 !! html/parsoid
16975 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
16976 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
16977 !! end
16978
16979 !! test
16980 Parser hook: static parser hook inside a comment
16981 !! wikitext
16982 <!-- <statictag>hello, world</statictag> -->
16983 <statictag action="flush" />
16984 !! html/php
16985 <p><br />
16986 </p>
16987 !! html/parsoid
16988 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
16989 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
16990 !! end
16991
16992 # Nested template calls; this case was broken by Parser.php rev 1.506,
16993 # since reverted.
16994
16995 !! article
16996 Template:One-parameter
16997 !! text
16998 (My parameter is: {{{1}}})
16999 !! endarticle
17000
17001 !! article
17002 Template:Map-one-parameter
17003 !! text
17004 {{{{{1}}}|{{{2}}}}}
17005 !! endarticle
17006
17007 !! test
17008 Nested template calls
17009 !! wikitext
17010 {{Map-one-parameter|One-parameter|param}}
17011 !! html
17012 <p>(My parameter is: param)
17013 </p>
17014 !! end
17015
17016
17017 ###
17018 ### Sanitizer
17019 ###
17020
17021 # HTML+Tidy effectively strips out the empty tags completely
17022 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
17023 # which Tidy would have done for the PHP parser had there been content inside it.
17024 !! test
17025 Sanitizer: Closing of open tags
17026 !! wikitext
17027 <s></s><table></table>
17028 !! html
17029 <s></s><table></table>
17030
17031 !! html/parsoid
17032 <p><s></s></p><table></table>
17033 !! end
17034
17035 !! test
17036 Sanitizer: Closing of open but not closed tags
17037 !! wikitext
17038 <s>foo
17039 !! html
17040 <p><s>foo</s>
17041 </p>
17042 !! end
17043
17044 !! test
17045 Sanitizer: Closing of closed but not open tags
17046 !! options
17047 parsoid=wt2html
17048 !! wikitext
17049 </s>
17050 !! html/php+tidy
17051 !! html/parsoid
17052 !! end
17053
17054 !! test
17055 Sanitizer: Closing of closed but not open table tags
17056 !! options
17057 parsoid=wt2html
17058 !! wikitext
17059 Table not started</td></tr></table>
17060 !! html/php+tidy
17061 <p>Table not started</p>
17062 !! html/parsoid
17063 <p>Table not started</p>
17064 !! end
17065
17066 !! test
17067 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
17068 !! wikitext
17069 <span id="æ: v">byte</span>[[#æ: v|backlink]]
17070 !! html
17071 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
17072 </p>
17073 !! end
17074
17075 # In HTML5, the restrictions are that id must contain at least one character,
17076 # and must not contain any space characters.
17077 !! test
17078 Sanitizer: Validating the contents of the id attribute (bug 4515)
17079 !! options
17080 disabled
17081 !! wikitext
17082 <br id="" /><br id="a space" />
17083 !! html
17084 Something ...
17085 !! end
17086
17087 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
17088 !! test
17089 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
17090 !! options
17091 disabled
17092 !! wikitext
17093 <br id="foo" /><br id="foo" />
17094 !! html
17095 Something need to be done. foo-2 ?
17096 !! end
17097
17098 !! test
17099 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
17100 !! wikitext
17101 <div itemscope>
17102 <meta itemprop="hello" content="world">
17103 <meta http-equiv="refresh" content="5">
17104 <meta itemprop="hello" http-equiv="refresh" content="5">
17105 <link itemprop="hello" href="{{SERVER}}">
17106 <link rel="stylesheet" href="{{SERVER}}">
17107 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
17108 </div>
17109 !! html
17110 <div itemscope="">
17111 <p> <meta itemprop="hello" content="world" />
17112 &lt;meta http-equiv="refresh" content="5"&gt;
17113 <meta itemprop="hello" content="5" />
17114 </p>
17115 <link itemprop="hello" href="http&#58;//example.org" />
17116 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
17117 <link itemprop="hello" href="http&#58;//example.org" />
17118 </div>
17119
17120 !! end
17121
17122 !! test
17123 Language converter: output gets cut off unexpectedly (bug 5757)
17124 !! options
17125 language=zh
17126 !! wikitext
17127 this bit is safe: }-
17128
17129 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
17130
17131 then we get cut off here: }-
17132
17133 all additional text is vanished
17134 !! html
17135 <p>this bit is safe: }-
17136 </p><p>but if we add a conversion instance: xxx
17137 </p><p>then we get cut off here: }-
17138 </p><p>all additional text is vanished
17139 </p>
17140 !! end
17141
17142 !! test
17143 Self closed html pairs (bug 5487)
17144 !! options
17145 !! wikitext
17146 <center><font id="bug" />Centered text</center>
17147 <div><font id="bug2" />In div text</div>
17148 !! html
17149 <center>&lt;font id="bug" /&gt;Centered text</center>
17150 <div>&lt;font id="bug2" /&gt;In div text</div>
17151
17152 !! end
17153
17154 #
17155 #
17156 #
17157
17158 !! test
17159 Punctuation: nbsp before exclamation
17160 !! wikitext
17161 C'est grave !
17162 !! html
17163 <p>C'est grave&#160;!
17164 </p>
17165 !! end
17166
17167 !! test
17168 Punctuation: CSS !important (bug 11874)
17169 !! wikitext
17170 <div style="width:50% !important">important</div>
17171 !! html
17172 <div style="width:50% !important">important</div>
17173
17174 !!end
17175
17176 !! test
17177 Punctuation: CSS ! important (bug 11874; with space after)
17178 !! wikitext
17179 <div style="width:50% ! important">important</div>
17180 !! html
17181 <div style="width:50% ! important">important</div>
17182
17183 !!end
17184
17185 !! test
17186 HTML bullet list, closed tags (bug 5497)
17187 !! wikitext
17188 <ul>
17189 <li>One</li>
17190 <li>Two</li>
17191 </ul>
17192 !! html/php
17193 <ul>
17194 <li>One</li>
17195 <li>Two</li>
17196 </ul>
17197
17198 !! html/parsoid
17199 <ul data-parsoid='{"stx":"html"}'>
17200 <li data-parsoid='{"stx":"html"}'>One</li>
17201 <li data-parsoid='{"stx":"html"}'>Two</li>
17202 </ul>
17203
17204 !! end
17205
17206 !! test
17207 HTML bullet list, unclosed tags (bug 5497)
17208 !! wikitext
17209 <ul>
17210 <li>One
17211 <li>Two
17212 </ul>
17213 !! html/php+tidy
17214 <ul>
17215 <li>One</li>
17216 <li>Two</li>
17217 </ul>
17218 !! html/parsoid
17219 <ul data-parsoid='{"stx":"html"}'>
17220 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17221 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17222 </ul>
17223
17224 !! end
17225
17226 !! test
17227 HTML ordered list, closed tags (bug 5497)
17228 !! wikitext
17229 <ol>
17230 <li>One</li>
17231 <li>Two</li>
17232 </ol>
17233 !! html/php
17234 <ol>
17235 <li>One</li>
17236 <li>Two</li>
17237 </ol>
17238
17239 !! html/parsoid
17240 <ol data-parsoid='{"stx":"html"}'>
17241 <li data-parsoid='{"stx":"html"}'>One</li>
17242 <li data-parsoid='{"stx":"html"}'>Two</li>
17243 </ol>
17244
17245 !! end
17246
17247 !! test
17248 HTML ordered list, unclosed tags (bug 5497)
17249 !! options
17250 !! wikitext
17251 <ol>
17252 <li>One
17253 <li>Two
17254 </ol>
17255 !! html/php+tidy
17256 <ol>
17257 <li>One</li>
17258 <li>Two</li>
17259 </ol>
17260 !! html/parsoid
17261 <ol data-parsoid='{"stx":"html"}'>
17262 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17263 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17264 </ol>
17265
17266 !! end
17267
17268 !! test
17269 HTML nested bullet list, closed tags (bug 5497)
17270 !! wikitext
17271 <ul>
17272 <li>One</li>
17273 <li>Two:
17274 <ul>
17275 <li>Sub-one</li>
17276 <li>Sub-two</li>
17277 </ul>
17278 </li>
17279 </ul>
17280 !! html/php
17281 <ul>
17282 <li>One</li>
17283 <li>Two:
17284 <ul>
17285 <li>Sub-one</li>
17286 <li>Sub-two</li>
17287 </ul>
17288 </li>
17289 </ul>
17290
17291 !! html/parsoid
17292 <ul data-parsoid='{"stx":"html"}'>
17293 <li data-parsoid='{"stx":"html"}'>One</li>
17294 <li data-parsoid='{"stx":"html"}'>Two:
17295 <ul data-parsoid='{"stx":"html"}'>
17296 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
17297 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
17298 </ul>
17299 </li>
17300 </ul>
17301 !! end
17302
17303 !! test
17304 HTML nested bullet list, open tags (bug 5497)
17305 !! wikitext
17306 <ul>
17307 <li>One
17308 <li>Two:
17309 <ul>
17310 <li>Sub-one
17311 <li>Sub-two
17312 </ul>
17313 </ul>
17314 !! html/php+tidy
17315 <ul>
17316 <li>One</li>
17317 <li>Two:
17318 <ul>
17319 <li>Sub-one</li>
17320 <li>Sub-two</li>
17321 </ul>
17322 </li>
17323 </ul>
17324 !! html/parsoid
17325 <ul>
17326 <li>One
17327 </li>
17328 <li>Two:
17329 <ul>
17330 <li>Sub-one
17331 </li>
17332 <li>Sub-two
17333 </li>
17334 </ul>
17335 </li>
17336 </ul>
17337
17338 !! end
17339
17340 !! test
17341 HTML nested ordered list, closed tags (bug 5497)
17342 !! wikitext
17343 <ol>
17344 <li>One</li>
17345 <li>Two:
17346 <ol>
17347 <li>Sub-one</li>
17348 <li>Sub-two</li>
17349 </ol>
17350 </li>
17351 </ol>
17352 !! html
17353 <ol>
17354 <li>One</li>
17355 <li>Two:
17356 <ol>
17357 <li>Sub-one</li>
17358 <li>Sub-two</li>
17359 </ol>
17360 </li>
17361 </ol>
17362
17363 !! end
17364
17365 !! test
17366 HTML nested ordered list, open tags (bug 5497)
17367 !! wikitext
17368 <ol>
17369 <li>One
17370 <li>Two:
17371 <ol>
17372 <li>Sub-one
17373 <li>Sub-two
17374 </ol>
17375 </ol>
17376 !! html/php
17377 <ol>
17378 <li>One
17379 <li>Two:
17380 <ol>
17381 <li>Sub-one
17382 <li>Sub-two
17383 </ol>
17384 </ol>
17385
17386 !! html/parsoid
17387 <ol>
17388 <li>One
17389 </li>
17390 <li>Two:
17391 <ol>
17392 <li>Sub-one
17393 </li>
17394 <li>Sub-two
17395 </li>
17396 </ol>
17397 </li>
17398 </ol>
17399
17400 !! end
17401
17402 !! test
17403 HTML ordered list item with parameters oddity
17404 !! wikitext
17405 <ol><li id="fragment">One</li>
17406 </ol>
17407 !! html
17408 <ol><li id="fragment">One</li>
17409 </ol>
17410
17411 !! end
17412
17413 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
17414 !!test
17415 bug 5918: autonumbering
17416 !! wikitext
17417 [http://first/] [http://second] [ftp://ftp]
17418
17419 ftp://inlineftp
17420
17421 [mailto:enclosed@mail.tld With target]
17422
17423 [mailto:enclosed@mail.tld]
17424
17425 mailto:inline@mail.tld
17426 !! html/php
17427 <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>
17428 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
17429 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
17430 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
17431 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
17432 </p>
17433 !! html/parsoid
17434 <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>
17435 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
17436 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
17437 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
17438 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
17439 !! end
17440
17441
17442 #
17443 # Security and HTML correctness
17444 # From Nick Jenkins' fuzz testing
17445 #
17446
17447 !! test
17448 Fuzz testing: Parser13
17449 !! wikitext
17450 {|
17451 | http://a|
17452 !! html
17453 <table>
17454 <tr>
17455 <td>
17456 </td>
17457 </tr>
17458 </table>
17459
17460 !! end
17461
17462 !! test
17463 Fuzz testing: Parser14
17464 !! wikitext
17465 == onmouseover= ==
17466 http://__TOC__
17467 !! html
17468 <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>
17469 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17470 <ul>
17471 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17472 </ul>
17473 </div>
17474
17475
17476 !! html+tidy
17477 <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>
17478 <p>http://</p>
17479 <div id="toc" class="toc">
17480 <div id="toctitle">
17481 <h2>Contents</h2>
17482 </div>
17483 <ul>
17484 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17485 </ul>
17486 </div>
17487 <p></p>
17488 !! end
17489
17490 !! test
17491 Fuzz testing: Parser14-table
17492 !! options
17493 parsoid=wt2html,html2html
17494 !! wikitext
17495 ==a==
17496 {| STYLE=__TOC__
17497 !! html
17498 <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>
17499 <table style="&#95;_TOC&#95;_">
17500 <tr><td></td></tr>
17501 </table>
17502
17503 !! html+tidy
17504 <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>
17505 <table style="__TOC__">
17506 <tr>
17507 <td></td>
17508 </tr>
17509 </table>
17510 !! html/parsoid
17511 <h2>a</h2>
17512 <table style="__TOC__"></table>
17513 !! end
17514
17515 # Known to produce bogus xml (extra </td>)
17516 !! test
17517 Fuzz testing: Parser16
17518 !! wikitext
17519 {|
17520 !https://||||||
17521 !! html
17522 <table>
17523 <tr>
17524 <th>https://</th>
17525 <th></th>
17526 <th></th>
17527 <th>
17528 </td>
17529 </tr>
17530 </table>
17531
17532 !! html+tidy
17533 <table>
17534 <tr>
17535 <th>https://</th>
17536 <th></th>
17537 <th></th>
17538 <th></th>
17539 </tr>
17540 </table>
17541 !! end
17542
17543 !! test
17544 Fuzz testing: Parser21
17545 !! wikitext
17546 {|
17547 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17548 |
17549 !! html
17550 <table>
17551 <tr>
17552 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17553 </th>
17554 <td>
17555 </td>
17556 </tr>
17557 </table>
17558
17559 !! end
17560
17561 !! test
17562 Fuzz testing: Parser22
17563 !! wikitext
17564 http://===r:::https://b
17565
17566 {|
17567 !! html
17568 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17569 </p>
17570 <table>
17571 <tr><td></td></tr>
17572 </table>
17573
17574 !! end
17575
17576 # Known to produce bad XML for now
17577 !! test
17578 Fuzz testing: Parser24
17579 !! wikitext
17580 {|
17581 {{{|
17582 <u CLASS=
17583 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17584 <br style="onmouseover='alert(document.cookie);' " />
17585
17586 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17587 |
17588 !! html
17589 <table>
17590 {{{|
17591 <u class="&#124;">}}}} &gt;
17592 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17593
17594 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17595 <tr>
17596 <td></u>
17597 </td>
17598 </tr>
17599 </table>
17600
17601 !! end
17602
17603 # Note: the current result listed for this is not what the original one was,
17604 # but the original bug was JavaScript injection, which is fixed in any case.
17605 # It's not clear that the original result listed was any more correct than the
17606 # current one. Original result:
17607 # <p>{{{|
17608 # </p>
17609 # <li class="&#124;&#124;">
17610 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17611 !!test
17612 Fuzz testing: Parser25 (bug 6055)
17613 !! wikitext
17614 {{{
17615 |
17616 <LI CLASS=||
17617 >
17618 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17619 !! html
17620 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17621 </p>
17622 !! end
17623
17624 !!test
17625 Fuzz testing: URL adjacent extension (with space, clean)
17626 !! wikitext
17627 http://example.com <nowiki>junk</nowiki>
17628 !! html/php
17629 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17630 </p>
17631 !! html/parsoid
17632 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17633 !! end
17634
17635 !!test
17636 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17637 !! wikitext
17638 http://example.com<nowiki>junk</nowiki>
17639 !! html/php
17640 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17641 </p>
17642 !! html/parsoid
17643 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17644 !! end
17645
17646 !!test
17647 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17648 !! wikitext
17649 http://example.com<pre>junk</pre>
17650 !! html/php
17651 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17652
17653 !! html/php+tidy
17654 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17655 <pre>
17656 junk
17657 </pre>
17658 !! html/parsoid
17659 <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>
17660 !!end
17661
17662 !!test
17663 Fuzz testing: image with bogus manual thumbnail
17664 !! wikitext
17665 [[Image:foobar.jpg|thumbnail= ]]
17666 !! html/php
17667 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17668
17669 !! html/parsoid
17670 <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>
17671 !!end
17672
17673 !! test
17674 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17675 !! wikitext
17676 <pre dir="&#10;"></pre>
17677 !! html
17678 <pre dir="&#10;"></pre>
17679
17680 !! end
17681
17682 !! test
17683 Parsing optional HTML elements (Bug 6171)
17684 !! options
17685 !! wikitext
17686 <table>
17687 <tr>
17688 <td> Some tabular data</td>
17689 <td> More tabular data ...
17690 <td> And yet som tabular data</td>
17691 </tr>
17692 </table>
17693 !! html
17694 <table>
17695 <tr>
17696 <td> Some tabular data</td>
17697 <td> More tabular data ...
17698 </td><td> And yet som tabular data</td>
17699 </tr>
17700 </table>
17701
17702 !! end
17703
17704 !! test
17705 Correct handling of <td>, <tr> (Bug 6171)
17706 !! options
17707 !! wikitext
17708 <table>
17709 <tr>
17710 <td> Some tabular data</td>
17711 <td> More tabular data ...</td>
17712 <td> And yet som tabular data</td>
17713 </tr>
17714 </table>
17715 !! html
17716 <table>
17717 <tr>
17718 <td> Some tabular data</td>
17719 <td> More tabular data ...</td>
17720 <td> And yet som tabular data</td>
17721 </tr>
17722 </table>
17723
17724 !! end
17725
17726
17727 !! test
17728 Parsing crashing regression (fr:JavaScript)
17729 !! wikitext
17730 </body></x>
17731 !! html
17732 <p>&lt;/body&gt;&lt;/x&gt;
17733 </p>
17734 !! end
17735
17736 !! test
17737 Inline wiki vs wiki block nesting
17738 !! wikitext
17739 '''Bold paragraph
17740
17741 New wiki paragraph
17742 !! html
17743 <p><b>Bold paragraph</b>
17744 </p><p>New wiki paragraph
17745 </p>
17746 !! end
17747
17748 # FIXME: The current php output is documented
17749 # and desired output is the parsoid target.
17750 !! test
17751 Inline HTML vs wiki block nesting
17752 !! wikitext
17753 <b>Bold paragraph
17754
17755 New wiki paragraph
17756 !! html/php
17757 <p><b>Bold paragraph
17758 </p><p>New wiki paragraph</b>
17759 </p>
17760 !! html/parsoid
17761 <p><b>Bold paragraph</b>
17762 </p><p>New wiki paragraph
17763 </p>
17764 !! end
17765
17766 # Original result was this:
17767 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
17768 # </p>
17769 # While that might be marginally more intuitive, maybe, the six-apostrophe
17770 # construct is clearly pathological and the result stated here (which is what
17771 # the parser actually does) is about as reasonable as anything.
17772 !!test
17773 Mixing markup for italics and bold
17774 !! options
17775 !! wikitext
17776 '''bold''''''bold''bolditalics'''''
17777 !! html
17778 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
17779 </p>
17780 !! end
17781
17782
17783 !! article
17784 Xyzzyx
17785 !! text
17786 Article for special page transclusion test
17787 !! endarticle
17788
17789 !! test
17790 Special page transclusion
17791 !! options
17792 !! wikitext
17793 {{Special:Prefixindex/Xyzzyx}}
17794 !! html
17795 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17796 </ul>
17797
17798 !! end
17799
17800 !! test
17801 Special page transclusion twice (bug 5021)
17802 !! options
17803 !! wikitext
17804 {{Special:Prefixindex/Xyzzyx}}
17805 {{Special:Prefixindex/Xyzzyx}}
17806 !! html
17807 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17808 </ul>
17809 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17810 </ul>
17811
17812 !! end
17813
17814 !! test
17815 Transclusion of default MediaWiki message
17816 !! wikitext
17817 {{MediaWiki:Mainpage}}
17818 !! html
17819 <p>Main Page
17820 </p>
17821 !! end
17822
17823 !! test
17824 Transclusion of nonexistent MediaWiki message
17825 !! wikitext
17826 {{MediaWiki:Mainpagexxx}}
17827 !! html
17828 <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>
17829 </p>
17830 !! end
17831
17832 !! test
17833 Transclusion of MediaWiki message with underscore
17834 !! wikitext
17835 {{MediaWiki:history_short}}
17836 !! html
17837 <p>History
17838 </p>
17839 !! end
17840
17841 !! test
17842 Transclusion of MediaWiki message with space
17843 !! wikitext
17844 {{MediaWiki:history short}}
17845 !! html
17846 <p>History
17847 </p>
17848 !! end
17849
17850 !! test
17851 Invalid header with following text
17852 !! wikitext
17853 = x = y
17854 !! html
17855 <p>= x = y
17856 </p>
17857 !! end
17858
17859
17860 !! test
17861 Section extraction test (section 0)
17862 !! options
17863 section=0
17864 !! wikitext
17865 start
17866 ==a==
17867 ===aa===
17868 ====aaa====
17869 ==b==
17870 ===ba===
17871 ===bb===
17872 ====bba====
17873 ===bc===
17874 ==c==
17875 ===ca===
17876 !! html/php
17877 start
17878 !! end
17879
17880 !! test
17881 Section extraction test (section 1)
17882 !! options
17883 section=1
17884 !! wikitext
17885 start
17886 ==a==
17887 ===aa===
17888 ====aaa====
17889 ==b==
17890 ===ba===
17891 ===bb===
17892 ====bba====
17893 ===bc===
17894 ==c==
17895 ===ca===
17896 !! html/php
17897 ==a==
17898 ===aa===
17899 ====aaa====
17900 !! end
17901
17902 !! test
17903 Section extraction test (section 2)
17904 !! options
17905 section=2
17906 !! wikitext
17907 start
17908 ==a==
17909 ===aa===
17910 ====aaa====
17911 ==b==
17912 ===ba===
17913 ===bb===
17914 ====bba====
17915 ===bc===
17916 ==c==
17917 ===ca===
17918 !! html/php
17919 ===aa===
17920 ====aaa====
17921 !! end
17922
17923 !! test
17924 Section extraction test (section 3)
17925 !! options
17926 section=3
17927 !! wikitext
17928 start
17929 ==a==
17930 ===aa===
17931 ====aaa====
17932 ==b==
17933 ===ba===
17934 ===bb===
17935 ====bba====
17936 ===bc===
17937 ==c==
17938 ===ca===
17939 !! html/php
17940 ====aaa====
17941 !! end
17942
17943 !! test
17944 Section extraction test (section 4)
17945 !! options
17946 section=4
17947 !! wikitext
17948 start
17949 ==a==
17950 ===aa===
17951 ====aaa====
17952 ==b==
17953 ===ba===
17954 ===bb===
17955 ====bba====
17956 ===bc===
17957 ==c==
17958 ===ca===
17959 !! html/php
17960 ==b==
17961 ===ba===
17962 ===bb===
17963 ====bba====
17964 ===bc===
17965 !! end
17966
17967 !! test
17968 Section extraction test (section 5)
17969 !! options
17970 section=5
17971 !! wikitext
17972 start
17973 ==a==
17974 ===aa===
17975 ====aaa====
17976 ==b==
17977 ===ba===
17978 ===bb===
17979 ====bba====
17980 ===bc===
17981 ==c==
17982 ===ca===
17983 !! html/php
17984 ===ba===
17985 !! end
17986
17987 !! test
17988 Section extraction test (section 6)
17989 !! options
17990 section=6
17991 !! wikitext
17992 start
17993 ==a==
17994 ===aa===
17995 ====aaa====
17996 ==b==
17997 ===ba===
17998 ===bb===
17999 ====bba====
18000 ===bc===
18001 ==c==
18002 ===ca===
18003 !! html/php
18004 ===bb===
18005 ====bba====
18006 !! end
18007
18008 !! test
18009 Section extraction test (section 7)
18010 !! options
18011 section=7
18012 !! wikitext
18013 start
18014 ==a==
18015 ===aa===
18016 ====aaa====
18017 ==b==
18018 ===ba===
18019 ===bb===
18020 ====bba====
18021 ===bc===
18022 ==c==
18023 ===ca===
18024 !! html/php
18025 ====bba====
18026 !! end
18027
18028 !! test
18029 Section extraction test (section 8)
18030 !! options
18031 section=8
18032 !! wikitext
18033 start
18034 ==a==
18035 ===aa===
18036 ====aaa====
18037 ==b==
18038 ===ba===
18039 ===bb===
18040 ====bba====
18041 ===bc===
18042 ==c==
18043 ===ca===
18044 !! html/php
18045 ===bc===
18046 !! end
18047
18048 !! test
18049 Section extraction test (section 9)
18050 !! options
18051 section=9
18052 !! wikitext
18053 start
18054 ==a==
18055 ===aa===
18056 ====aaa====
18057 ==b==
18058 ===ba===
18059 ===bb===
18060 ====bba====
18061 ===bc===
18062 ==c==
18063 ===ca===
18064 !! html/php
18065 ==c==
18066 ===ca===
18067 !! end
18068
18069 !! test
18070 Section extraction test (section 10)
18071 !! options
18072 section=10
18073 !! wikitext
18074 start
18075 ==a==
18076 ===aa===
18077 ====aaa====
18078 ==b==
18079 ===ba===
18080 ===bb===
18081 ====bba====
18082 ===bc===
18083 ==c==
18084 ===ca===
18085 !! html/php
18086 ===ca===
18087 !! end
18088
18089 !! test
18090 Section extraction test (nonexistent section 11)
18091 !! options
18092 section=11
18093 !! wikitext
18094 start
18095 ==a==
18096 ===aa===
18097 ====aaa====
18098 ==b==
18099 ===ba===
18100 ===bb===
18101 ====bba====
18102 ===bc===
18103 ==c==
18104 ===ca===
18105 !! html/php
18106 !! end
18107
18108 !! test
18109 Section extraction test with bogus heading (section 1)
18110 !! options
18111 section=1
18112 !! wikitext
18113 ==a==
18114 ==bogus== not a legal section
18115 ==b==
18116 !! html/php
18117 ==a==
18118 ==bogus== not a legal section
18119 !! end
18120
18121 !! test
18122 Section extraction test with bogus heading (section 2)
18123 !! options
18124 section=2
18125 !! wikitext
18126 ==a==
18127 ==bogus== not a legal section
18128 ==b==
18129 !! html/php
18130 ==b==
18131 !! end
18132
18133 !! test
18134 Section extraction test with comment after heading (section 1)
18135 !! options
18136 section=1
18137 !! wikitext
18138 ==a==
18139 ==b== <!-- -->
18140 ==c==
18141 !! html/php
18142 ==a==
18143 !! end
18144
18145 !! test
18146 Section extraction test with comment after heading (section 2)
18147 !! options
18148 section=2
18149 !! wikitext
18150 ==a==
18151 ==b== <!-- -->
18152 ==c==
18153 !! html/php
18154 ==b== <!-- -->
18155 !! end
18156
18157 !! test
18158 Section extraction test with bogus <nowiki> heading (section 1)
18159 !! options
18160 section=1
18161 !! wikitext
18162 ==a==
18163 ==bogus== <nowiki>not a legal section</nowiki>
18164 ==b==
18165 !! html/php
18166 ==a==
18167 ==bogus== <nowiki>not a legal section</nowiki>
18168 !! end
18169
18170 !! test
18171 Section extraction test with bogus <nowiki> heading (section 2)
18172 !! options
18173 section=2
18174 !! wikitext
18175 ==a==
18176 ==bogus== <nowiki>not a legal section</nowiki>
18177 ==b==
18178 !! html/php
18179 ==b==
18180 !! end
18181
18182 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
18183 # instead of respecting commented sections
18184 !! test
18185 Section extraction prefixed by comment (section 1)
18186 !! options
18187 section=1
18188 !! wikitext
18189 <!-- -->==sec1==
18190 ==sec2==
18191 !! html/php
18192 ==sec2==
18193 !!end
18194
18195 !! test
18196 Section extraction prefixed by comment (section 2)
18197 !! options
18198 section=2
18199 !! wikitext
18200 <!-- -->==sec1==
18201 ==sec2==
18202 !! html/php
18203
18204 !!end
18205
18206 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
18207 # instead of respecting HTML-style headings
18208 !! test
18209 Section extraction, mixed wiki and html (section 1)
18210 !! options
18211 section=1
18212 !! wikitext
18213 <h2>unmarked</h2>
18214 unmarked
18215 ==1==
18216 one
18217 ==2==
18218 two
18219 !! html/php
18220 ==1==
18221 one
18222 !! end
18223
18224 !! test
18225 Section extraction, mixed wiki and html (section 2)
18226 !! options
18227 section=2
18228 !! wikitext
18229 <h2>unmarked</h2>
18230 unmarked
18231 ==1==
18232 one
18233 ==2==
18234 two
18235 !! html/php
18236 ==2==
18237 two
18238 !! end
18239
18240
18241 # Formerly testing for bug 3342
18242 !! test
18243 Section extraction, heading surrounded by <noinclude>
18244 !! options
18245 section=1
18246 !! wikitext
18247 <noinclude>==unmarked==</noinclude>
18248 ==marked==
18249 !! html/php
18250 ==marked==
18251 !!end
18252
18253 # Test behavior of bug 19910
18254 !! test
18255 Sectiion with all-equals
18256 !! options
18257 section=2
18258 !! wikitext
18259 ===
18260 The line above must have a trailing space
18261 === <!--
18262 --> <!-- -->
18263 But just in case it doesn't...
18264 !! html/php
18265 === <!--
18266 --> <!-- -->
18267 But just in case it doesn't...
18268 !! end
18269
18270 !! test
18271 Section replacement test (section 0)
18272 !! options
18273 replace=0,"xxx"
18274 !! wikitext
18275 start
18276 ==a==
18277 ===aa===
18278 ====aaa====
18279 ==b==
18280 ===ba===
18281 ===bb===
18282 ====bba====
18283 ===bc===
18284 ==c==
18285 ===ca===
18286 !! html/php
18287 xxx
18288
18289 ==a==
18290 ===aa===
18291 ====aaa====
18292 ==b==
18293 ===ba===
18294 ===bb===
18295 ====bba====
18296 ===bc===
18297 ==c==
18298 ===ca===
18299 !! end
18300
18301 !! test
18302 Section replacement test (section 1)
18303 !! options
18304 replace=1,"xxx"
18305 !! wikitext
18306 start
18307 ==a==
18308 ===aa===
18309 ====aaa====
18310 ==b==
18311 ===ba===
18312 ===bb===
18313 ====bba====
18314 ===bc===
18315 ==c==
18316 ===ca===
18317 !! html/php
18318 start
18319 xxx
18320
18321 ==b==
18322 ===ba===
18323 ===bb===
18324 ====bba====
18325 ===bc===
18326 ==c==
18327 ===ca===
18328 !! end
18329
18330 !! test
18331 Section replacement test (section 2)
18332 !! options
18333 replace=2,"xxx"
18334 !! wikitext
18335 start
18336 ==a==
18337 ===aa===
18338 ====aaa====
18339 ==b==
18340 ===ba===
18341 ===bb===
18342 ====bba====
18343 ===bc===
18344 ==c==
18345 ===ca===
18346 !! html/php
18347 start
18348 ==a==
18349 xxx
18350
18351 ==b==
18352 ===ba===
18353 ===bb===
18354 ====bba====
18355 ===bc===
18356 ==c==
18357 ===ca===
18358 !! end
18359
18360 !! test
18361 Section replacement test (section 3)
18362 !! options
18363 replace=3,"xxx"
18364 !! wikitext
18365 start
18366 ==a==
18367 ===aa===
18368 ====aaa====
18369 ==b==
18370 ===ba===
18371 ===bb===
18372 ====bba====
18373 ===bc===
18374 ==c==
18375 ===ca===
18376 !! html/php
18377 start
18378 ==a==
18379 ===aa===
18380 xxx
18381
18382 ==b==
18383 ===ba===
18384 ===bb===
18385 ====bba====
18386 ===bc===
18387 ==c==
18388 ===ca===
18389 !! end
18390
18391 !! test
18392 Section replacement test (section 4)
18393 !! options
18394 replace=4,"xxx"
18395 !! wikitext
18396 start
18397 ==a==
18398 ===aa===
18399 ====aaa====
18400 ==b==
18401 ===ba===
18402 ===bb===
18403 ====bba====
18404 ===bc===
18405 ==c==
18406 ===ca===
18407 !! html/php
18408 start
18409 ==a==
18410 ===aa===
18411 ====aaa====
18412 xxx
18413
18414 ==c==
18415 ===ca===
18416 !! end
18417
18418 !! test
18419 Section replacement test (section 5)
18420 !! options
18421 replace=5,"xxx"
18422 !! wikitext
18423 start
18424 ==a==
18425 ===aa===
18426 ====aaa====
18427 ==b==
18428 ===ba===
18429 ===bb===
18430 ====bba====
18431 ===bc===
18432 ==c==
18433 ===ca===
18434 !! html/php
18435 start
18436 ==a==
18437 ===aa===
18438 ====aaa====
18439 ==b==
18440 xxx
18441
18442 ===bb===
18443 ====bba====
18444 ===bc===
18445 ==c==
18446 ===ca===
18447 !! end
18448
18449 !! test
18450 Section replacement test (section 6)
18451 !! options
18452 replace=6,"xxx"
18453 !! wikitext
18454 start
18455 ==a==
18456 ===aa===
18457 ====aaa====
18458 ==b==
18459 ===ba===
18460 ===bb===
18461 ====bba====
18462 ===bc===
18463 ==c==
18464 ===ca===
18465 !! html/php
18466 start
18467 ==a==
18468 ===aa===
18469 ====aaa====
18470 ==b==
18471 ===ba===
18472 xxx
18473
18474 ===bc===
18475 ==c==
18476 ===ca===
18477 !! end
18478
18479 !! test
18480 Section replacement test (section 7)
18481 !! options
18482 replace=7,"xxx"
18483 !! wikitext
18484 start
18485 ==a==
18486 ===aa===
18487 ====aaa====
18488 ==b==
18489 ===ba===
18490 ===bb===
18491 ====bba====
18492 ===bc===
18493 ==c==
18494 ===ca===
18495 !! html/php
18496 start
18497 ==a==
18498 ===aa===
18499 ====aaa====
18500 ==b==
18501 ===ba===
18502 ===bb===
18503 xxx
18504
18505 ===bc===
18506 ==c==
18507 ===ca===
18508 !! end
18509
18510 !! test
18511 Section replacement test (section 8)
18512 !! options
18513 replace=8,"xxx"
18514 !! wikitext
18515 start
18516 ==a==
18517 ===aa===
18518 ====aaa====
18519 ==b==
18520 ===ba===
18521 ===bb===
18522 ====bba====
18523 ===bc===
18524 ==c==
18525 ===ca===
18526 !! html/php
18527 start
18528 ==a==
18529 ===aa===
18530 ====aaa====
18531 ==b==
18532 ===ba===
18533 ===bb===
18534 ====bba====
18535 xxx
18536
18537 ==c==
18538 ===ca===
18539 !!end
18540
18541 !! test
18542 Section replacement test (section 9)
18543 !! options
18544 replace=9,"xxx"
18545 !! wikitext
18546 start
18547 ==a==
18548 ===aa===
18549 ====aaa====
18550 ==b==
18551 ===ba===
18552 ===bb===
18553 ====bba====
18554 ===bc===
18555 ==c==
18556 ===ca===
18557 !! html/php
18558 start
18559 ==a==
18560 ===aa===
18561 ====aaa====
18562 ==b==
18563 ===ba===
18564 ===bb===
18565 ====bba====
18566 ===bc===
18567 xxx
18568 !! end
18569
18570 !! test
18571 Section replacement test (section 10)
18572 !! options
18573 replace=10,"xxx"
18574 !! wikitext
18575 start
18576 ==a==
18577 ===aa===
18578 ====aaa====
18579 ==b==
18580 ===ba===
18581 ===bb===
18582 ====bba====
18583 ===bc===
18584 ==c==
18585 ===ca===
18586 !! html/php
18587 start
18588 ==a==
18589 ===aa===
18590 ====aaa====
18591 ==b==
18592 ===ba===
18593 ===bb===
18594 ====bba====
18595 ===bc===
18596 ==c==
18597 xxx
18598 !! end
18599
18600 !! test
18601 Section replacement test with initial whitespace (bug 13728)
18602 !! options
18603 replace=2,"xxx"
18604 !! wikitext
18605 Preformatted initial line
18606 ==a==
18607 ===a===
18608 !! html/php
18609 Preformatted initial line
18610 ==a==
18611 xxx
18612 !! end
18613
18614
18615 !! test
18616 Section extraction, heading followed by pre with 20 spaces (bug 6398)
18617 !! options
18618 section=1
18619 !! wikitext
18620 ==a==
18621 a
18622 !! html/php
18623 ==a==
18624 a
18625 !! end
18626
18627 !! test
18628 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
18629 !! options
18630 section=1
18631 !! wikitext
18632 ==a==
18633 a
18634 !! html/php
18635 ==a==
18636 a
18637 !! end
18638
18639
18640 !! test
18641 Section extraction, <pre> around bogus header (bug 10309)
18642 !! options
18643 section=2
18644 !! wikitext
18645 == Section One ==
18646 <pre>
18647 =======
18648 </pre>
18649
18650 == Section Two ==
18651 stuff
18652 !! html/php
18653 == Section Two ==
18654 stuff
18655 !! end
18656
18657 !! test
18658 Section replacement, <pre> around bogus header (bug 10309)
18659 !! options
18660 replace=2,"xxx"
18661 !! wikitext
18662 == Section One ==
18663 <pre>
18664 =======
18665 </pre>
18666
18667 == Section Two ==
18668 stuff
18669 !! html/php
18670 == Section One ==
18671 <pre>
18672 =======
18673 </pre>
18674
18675 xxx
18676 !! end
18677
18678
18679 !! test
18680 Handling of &#x0A; in URLs
18681 !! wikitext
18682 ** irc://&#x0A;a
18683 !! html/php
18684 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18685
18686 !! html/parsoid
18687 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
18688 a">irc://
18689 a</a></li></ul></li></ul>
18690 !! end
18691
18692 !! test
18693 Handling of %0A in URLs
18694 !! wikitext
18695 ** irc://%0Aa
18696 !! html/php
18697 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18698
18699 !! html/parsoid
18700 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18701 !! end
18702
18703
18704 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18705 !! test
18706 5 quotes, code coverage +1 line
18707 !! options
18708 parsoid=wt2html
18709 !! wikitext
18710 '''''
18711 !! html/php
18712 !! html/parsoid
18713 <p><b><i></i></b></p>
18714 !! end
18715
18716 # same html as previous, but wikitext adjusted to match parsoid html2wt
18717 # note that wt2html and html2html will put the <i> before the <b>
18718 !! test
18719 5 quotes, code coverage +1 line w/ nowiki (1)
18720 !! options
18721 parsoid=wt2wt,html2wt
18722 !! wikitext
18723 '''''<nowiki/>'''''
18724 !! html/php
18725 <p><i></i>
18726 </p>
18727 !! html/parsoid
18728 <p><b><i></i></b></p>
18729 !! end
18730
18731 # same as previous, just swapping the <i> and <b>
18732 !! test
18733 5 quotes, code coverage +1 line w/ nowiki (2)
18734 !! wikitext
18735 '''''<nowiki/>'''''
18736 !! html/php
18737 <p><i></i>
18738 </p>
18739 !! html/parsoid
18740 <p><i><b></b></i></p>
18741 !! end
18742
18743 !! test
18744 Special:Search page linking.
18745 !! wikitext
18746 {{Special:search}}
18747 !! html
18748 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18749 </p>
18750 !! end
18751
18752 !! test
18753 {{!}} is a magic word
18754 !! wikitext
18755 {{!}} is a magic word there and {{!}} is still a magic word here
18756 | is not a magic word here but {{!}} is still a magic word here
18757 !! html/php
18758 <p>| is a magic word there and | is still a magic word here
18759 | is not a magic word here but | is still a magic word here
18760 </p>
18761 !! html/parsoid
18762 <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
18763 | 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>
18764
18765 !! end
18766
18767 !! test
18768 Say the magic word
18769 !! options
18770 title=[[Parser test]]
18771 !! wikitext
18772 * {{PAGENAME}}
18773 * {{PAGENAMEE}}
18774 * {{FULLPAGENAME}}
18775 * {{FULLPAGENAMEE}}
18776 * {{BASEPAGENAME}}
18777 * {{BASEPAGENAMEE}}
18778 * {{SUBPAGENAME}}
18779 * {{SUBPAGENAMEE}}
18780 * {{ROOTPAGENAME}}
18781 * {{ROOTPAGENAMEE}}
18782 * {{TALKPAGENAME}}
18783 * {{TALKPAGENAMEE}}
18784 * {{SUBJECTPAGENAME}}
18785 * {{SUBJECTPAGENAMEE}}
18786 * {{NAMESPACEE}}
18787 * {{NAMESPACE}}
18788 * {{NAMESPACENUMBER}}
18789 * {{TALKSPACE}}
18790 * {{TALKSPACEE}}
18791 * {{SUBJECTSPACE}}
18792 * {{SUBJECTSPACEE}}
18793 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18794 !! html
18795 <ul><li> Parser test</li>
18796 <li> Parser_test</li>
18797 <li> Parser test</li>
18798 <li> Parser_test</li>
18799 <li> Parser test</li>
18800 <li> Parser_test</li>
18801 <li> Parser test</li>
18802 <li> Parser_test</li>
18803 <li> Parser test</li>
18804 <li> Parser_test</li>
18805 <li> Talk:Parser test</li>
18806 <li> Talk:Parser_test</li>
18807 <li> Parser test</li>
18808 <li> Parser_test</li>
18809 <li> </li>
18810 <li> </li>
18811 <li> 0</li>
18812 <li> Talk</li>
18813 <li> Talk</li>
18814 <li> </li>
18815 <li> </li>
18816 <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>
18817
18818 !! end
18819 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18820
18821 !! test
18822 Gallery
18823 !! wikitext
18824 <gallery>
18825 image1.png |
18826 image2.gif|||||
18827
18828 image3|
18829 image4 |300px| centre
18830 image5.svg| http://///////
18831 [[x|xx]]]]
18832 * image6
18833 </gallery>
18834 !! html
18835 <ul class="gallery mw-gallery-traditional">
18836 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18837 <div class="thumb" style="height: 150px;">Image1.png</div>
18838 <div class="gallerytext">
18839 </div>
18840 </div></li>
18841 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18842 <div class="thumb" style="height: 150px;">Image2.gif</div>
18843 <div class="gallerytext">
18844 </div>
18845 </div></li>
18846 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18847 <div class="thumb" style="height: 150px;">Image3</div>
18848 <div class="gallerytext">
18849 </div>
18850 </div></li>
18851 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18852 <div class="thumb" style="height: 150px;">Image4</div>
18853 <div class="gallerytext">
18854 <pre>centre
18855 </pre>
18856 </div>
18857 </div></li>
18858 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18859 <div class="thumb" style="height: 150px;">Image5.svg</div>
18860 <div class="gallerytext">
18861 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
18862 </p>
18863 </div>
18864 </div></li>
18865 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18866 <div class="thumb" style="height: 150px;">* image6</div>
18867 <div class="gallerytext">
18868 </div>
18869 </div></li>
18870 </ul>
18871
18872 !! end
18873
18874 !! test
18875 Gallery (with options)
18876 !! wikitext
18877 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
18878 File:Nonexistent.jpg|caption
18879 File:Nonexistent.jpg
18880 image:foobar.jpg|some '''caption''' [[Main Page]]
18881 image:foobar.jpg
18882 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
18883 </gallery>
18884 !! html
18885 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
18886 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
18887 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18888 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18889 <div class="gallerytext">
18890 <p>caption
18891 </p>
18892 </div>
18893 </div></li>
18894 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18895 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18896 <div class="gallerytext">
18897 </div>
18898 </div></li>
18899 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18900 <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>
18901 <div class="gallerytext">
18902 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18903 </p>
18904 </div>
18905 </div></li>
18906 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18907 <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>
18908 <div class="gallerytext">
18909 </div>
18910 </div></li>
18911 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18912 <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>
18913 <div class="gallerytext">
18914 <p>blabla.
18915 </p>
18916 </div>
18917 </div></li>
18918 </ul>
18919
18920 !! end
18921
18922 !! test
18923 Gallery with link that has fragment
18924 !! wikitext
18925 <gallery>
18926 image:foobar.jpg|link=Main_Page
18927 image:foobar.jpg|link=Main_Page#section
18928 image:foobar.jpg|link=Main Page#section|caption
18929 </gallery>
18930 !! html
18931 <ul class="gallery mw-gallery-traditional">
18932 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18933 <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>
18934 <div class="gallerytext">
18935 </div>
18936 </div></li>
18937 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18938 <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>
18939 <div class="gallerytext">
18940 </div>
18941 </div></li>
18942 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18943 <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>
18944 <div class="gallerytext">
18945 <p>caption
18946 </p>
18947 </div>
18948 </div></li>
18949 </ul>
18950
18951 !! end
18952
18953 !! test
18954 Gallery with wikitext inside caption
18955 !! wikitext
18956 <gallery>
18957 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
18958 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
18959 </gallery>
18960 !! html
18961 <ul class="gallery mw-gallery-traditional">
18962 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18963 <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>
18964 <div class="gallerytext">
18965 <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>
18966 </p>
18967 </div>
18968 </div></li>
18969 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18970 <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>
18971 <div class="gallerytext">
18972 <p>This is a test template
18973 </p>
18974 </div>
18975 </div></li>
18976 </ul>
18977
18978 !! end
18979
18980 !! test
18981 gallery (with showfilename option)
18982 !! wikitext
18983 <gallery showfilename>
18984 File:Nonexistent.jpg|caption
18985 File:Nonexistent.jpg
18986 image:foobar.jpg|some '''caption''' [[Main Page]]
18987 File:Foobar.jpg
18988 </gallery>
18989 !! html
18990 <ul class="gallery mw-gallery-traditional">
18991 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18992 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18993 <div class="gallerytext">
18994 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
18995 caption
18996 </p>
18997 </div>
18998 </div></li>
18999 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19000 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19001 <div class="gallerytext">
19002 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19003 </p>
19004 </div>
19005 </div></li>
19006 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19007 <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>
19008 <div class="gallerytext">
19009 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19010 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19011 </p>
19012 </div>
19013 </div></li>
19014 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19015 <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>
19016 <div class="gallerytext">
19017 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19018 </p>
19019 </div>
19020 </div></li>
19021 </ul>
19022
19023 !! end
19024
19025 !! test
19026 Gallery (with namespace-less filenames)
19027 !! wikitext
19028 <gallery>
19029 File:Nonexistent.jpg
19030 Nonexistent.jpg
19031 image:foobar.jpg
19032 foobar.jpg
19033 </gallery>
19034 !! html
19035 <ul class="gallery mw-gallery-traditional">
19036 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19037 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19038 <div class="gallerytext">
19039 </div>
19040 </div></li>
19041 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19042 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19043 <div class="gallerytext">
19044 </div>
19045 </div></li>
19046 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19047 <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>
19048 <div class="gallerytext">
19049 </div>
19050 </div></li>
19051 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19052 <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>
19053 <div class="gallerytext">
19054 </div>
19055 </div></li>
19056 </ul>
19057
19058 !! end
19059
19060 !! test
19061 HTML Hex character encoding (spells the word "JavaScript")
19062 !! options
19063 parsoid=wt2html,wt2wt,html2html
19064 !! wikitext
19065 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
19066 !! html/php
19067 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
19068 </p>
19069 !! html/php+tidy
19070 <p>JavaScript</p>
19071 !! html/parsoid
19072 <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>
19073 !! end
19074
19075 !! test
19076 HTML Hex character encoding bogus encoding (bug 26437 regression check)
19077 !! wikitext
19078 &#xsee;&#XSEE;
19079 !! html/php
19080 <p>&amp;#xsee;&amp;#XSEE;
19081 </p>
19082 !! html/parsoid
19083 <p>&amp;#xsee;&amp;#XSEE;</p>
19084 !! end
19085
19086 !! test
19087 HTML Hex character encoding mixed case
19088 !! options
19089 parsoid=wt2html,wt2wt,html2html
19090 !! wikitext
19091 &#xEE;&#Xee;
19092 !! html/php
19093 <p>&#xee;&#xee;
19094 </p>
19095 !! html/php+tidy
19096 <p>îî</p>
19097 !! html/parsoid
19098 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
19099 !! end
19100
19101 # See: http://www.w3.org/TR/html5/syntax.html#character-references
19102 # Note that U+000C (form feed) is not a valid XML character, so
19103 # it is banned even though allowed in HTML5.
19104 !! test
19105 Illegal character references (T106578)
19106 !! wikitext
19107 ; Null: &#00;
19108 ; FF: &#xC;
19109 ; CR: &#xD;
19110 ; Control (low): &#8;
19111 ; Control (high): &#x7F; &#x9F;
19112 ; Surrogate: &#xD83D;&#xDCA9;
19113 ; This is an okay astral character: &#x1F4A9;
19114 !! html+tidy
19115 <dl>
19116 <dt>Null</dt>
19117 <dd>&amp;#00;</dd>
19118 <dt>FF</dt>
19119 <dd>&amp;#xC;</dd>
19120 <dt>CR</dt>
19121 <dd>&amp;#xD;</dd>
19122 <dt>Control (low)</dt>
19123 <dd>&amp;#8;</dd>
19124 <dt>Control (high)</dt>
19125 <dd>&amp;#x7F; &amp;#x9F;</dd>
19126 <dt>Surrogate</dt>
19127 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
19128 <dt>This is an okay astral character</dt>
19129 <dd>💩</dd>
19130 </dl>
19131 !! end
19132
19133 !! test
19134 __FORCETOC__ override
19135 !! wikitext
19136 __NEWSECTIONLINK__
19137 __FORCETOC__
19138 !! html/php
19139 <p><br />
19140 </p>
19141 !! end
19142
19143 !! test
19144 ISBN code coverage
19145 !! wikitext
19146 ISBN 978-0-1234-56&#x20;789
19147 !! html
19148 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
19149 </p>
19150 !! html+tidy
19151 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
19152 !! html/parsoid
19153 <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>
19154 !! end
19155
19156 !! test
19157 ISBN followed by 5 spaces
19158 !! wikitext
19159 ISBN
19160 !! html
19161 <p>ISBN
19162 </p>
19163 !! end
19164
19165 !! test
19166 Double ISBN
19167 !! wikitext
19168 ISBN ISBN 1234567890
19169 !! html/php
19170 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19171 </p>
19172 !! html/parsoid
19173 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
19174 !! end
19175
19176 # Uppercase X and lowercase x as well
19177 !! test
19178 ISBN with an X
19179 !! wikitext
19180 ISBN 3-462-04561-X
19181 ISBN 3-462-04561-x
19182 ISBN 080442957X
19183 ISBN 080442957x
19184 ISBN 978080442957X
19185 ISBN 978080442957x
19186 !! html/php
19187 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
19188 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
19189 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
19190 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
19191 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
19192 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
19193 </p>
19194 !! html/parsoid
19195 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
19196 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
19197 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
19198 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
19199 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
19200 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
19201 !! end
19202
19203 !! test
19204 ISBN with empty prefix (parsoid test)
19205 !! wikitext
19206 ISBN 1234567890
19207 !! html/php
19208 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19209 </p>
19210 !! html/parsoid
19211 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
19212 !! end
19213
19214 !! test
19215 Bug 22905: <abbr> followed by ISBN followed by </a>
19216 !! wikitext
19217 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
19218 !! html/php
19219 <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>
19220 </p>
19221 !! html/parsoid
19222 <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>
19223 !! end
19224
19225 !! test
19226 Double RFC
19227 !! wikitext
19228 RFC RFC 1234
19229 !! html
19230 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
19231 </p>
19232 !! end
19233
19234 !! test
19235 Double RFC with a wiki link
19236 !! wikitext
19237 RFC [[RFC 1234]]
19238 !! html
19239 <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>
19240 </p>
19241 !! end
19242
19243 !! test
19244 RFC code coverage
19245 !! wikitext
19246 RFC 983&#x20;987
19247 !! html
19248 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
19249 </p>
19250 !! html+tidy
19251 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
19252 !! end
19253
19254 !! test
19255 Centre-aligned image
19256 !! wikitext
19257 [[Image:foobar.jpg|centre]]
19258 !! html
19259 <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>
19260
19261 !!end
19262
19263 !! test
19264 None-aligned image
19265 !! wikitext
19266 [[Image:foobar.jpg|none]]
19267 !! html
19268 <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>
19269
19270 !!end
19271
19272 !! test
19273 Width + Height sized image (using px) (height is ignored)
19274 !! wikitext
19275 [[Image:foobar.jpg|640x480px]]
19276 !! html
19277 <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>
19278 </p>
19279 !!end
19280
19281 !! test
19282 Width-sized image (using px, no following whitespace)
19283 !! wikitext
19284 [[Image:foobar.jpg|640px]]
19285 !! html
19286 <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>
19287 </p>
19288 !!end
19289
19290 !! test
19291 Width-sized image (using px, with following whitespace - test regression from r39467)
19292 !! wikitext
19293 [[Image:foobar.jpg|640px ]]
19294 !! html
19295 <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>
19296 </p>
19297 !!end
19298
19299 !! test
19300 Width-sized image (using px, with preceding whitespace - test regression from r39467)
19301 !! wikitext
19302 [[Image:foobar.jpg| 640px]]
19303 !! html
19304 <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>
19305 </p>
19306 !!end
19307
19308 !! test
19309 Image with page parameter
19310 !! options
19311 djvu
19312 !! wikitext
19313 [[File:LoremIpsum.djvu|page=2]]
19314 !! html/php
19315 <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>
19316 </p>
19317 !! html/parsoid
19318 <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>
19319 !! end
19320
19321 !! test
19322 Another italics / bold test
19323 !! wikitext
19324 ''' ''x'
19325 !! html
19326 <pre>'<i> </i>x'
19327 </pre>
19328 !!end
19329
19330 # FIXME: The php output seems broken. It's interleaving some open/close tags.
19331 !! test
19332 dt/dd/dl test
19333 !! wikitext
19334 :;;;::
19335 !! html/php
19336 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
19337
19338 !! html/parsoid
19339 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
19340
19341 !!end
19342
19343
19344 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
19345 !! test
19346 Images with the "|" character in the comment
19347 !! wikitext
19348 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
19349 !! html/php
19350 <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>
19351
19352 !! html/parsoid
19353 <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>
19354 !! end
19355
19356 !! test
19357 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
19358 !! wikitext
19359 <html><script>alert(1);</script></html>
19360 !! html
19361 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
19362 </p>
19363 !! end
19364
19365 !! test
19366 HTML with raw HTML ($wgRawHtml==true)
19367 !! options
19368 wgRawHtml=1
19369 !! wikitext
19370 <html><script>alert(1);</script></html>
19371 !! html
19372 <p><script>alert(1);</script>
19373 </p>
19374 !! end
19375
19376 !! test
19377 Parents of subpages, one level up
19378 !! options
19379 subpage title=[[Subpage test/L1/L2/L3]]
19380 !! wikitext
19381 [[../|L2]]
19382 !! html
19383 <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>
19384 </p>
19385 !! end
19386
19387
19388 !! test
19389 Parents of subpages, one level up, not named
19390 !! options
19391 subpage title=[[Subpage test/L1/L2/L3]]
19392 !! wikitext
19393 [[../]]
19394 !! html
19395 <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>
19396 </p>
19397 !! end
19398
19399
19400
19401 !! test
19402 Parents of subpages, two levels up
19403 !! options
19404 subpage title=[[Subpage test/L1/L2/L3]]
19405 !! wikitext
19406 [[../../|L1]]2
19407
19408 [[../../|L1]]l
19409 !! html
19410 <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
19411 </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>
19412 </p>
19413 !! end
19414
19415 !! test
19416 Parents of subpages, two levels up, without trailing slash or name.
19417 !! options
19418 subpage title=[[Subpage test/L1/L2/L3]]
19419 !! wikitext
19420 [[../..]]
19421 !! html
19422 <p>[[../..]]
19423 </p>
19424 !! end
19425
19426 !! test
19427 Parents of subpages, two levels up, with lots of extra trailing slashes.
19428 !! options
19429 subpage title=[[Subpage test/L1/L2/L3]]
19430 !! wikitext
19431 [[../../////]]
19432 !! html
19433 <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>
19434 </p>
19435 !! end
19436
19437 !! article
19438 Subpage test/L1/L2/L3Sibling
19439 !! text
19440 Sibling article
19441 !! endarticle
19442
19443 !! test
19444 Transclusion of a sibling page (one level up)
19445 !! options
19446 subpage title=[[Subpage test/L1/L2/L3]]
19447 !! wikitext
19448 {{../L3Sibling}}
19449 !! html
19450 <p>Sibling article
19451 </p>
19452 !! end
19453
19454 !! test
19455 Transclusion of a child page
19456 !! options
19457 subpage title=[[Subpage test/L1/L2]]
19458 !! wikitext
19459 {{/L3Sibling}}
19460 !! html
19461 <p>Sibling article
19462 </p>
19463 !! end
19464
19465 # This is wt2html only in Parsoid because we add <nowiki>
19466 # because of {{..}} and we don't expect to fix that to
19467 # eliminate the nowikis selective for {{..}} markup.
19468 !! test
19469 Non-transclusion because of too many up levels
19470 !! options
19471 subpage title=[[Subpage test/L1/L2/L3]]
19472 parsoid=wt2html
19473 !! wikitext
19474 {{../../../../More than parent}}
19475 !! html/php
19476 <p>{{../../../../More than parent}}
19477 </p>
19478 !! html/parsoid
19479 <p>{{../../../../More than parent}}</p>
19480 !! end
19481
19482 !! test
19483 Definition list code coverage
19484 !! wikitext
19485 ; title : def
19486 ; title : def
19487 ;title: def
19488 !! html/php
19489 <dl><dt> title &#160;</dt>
19490 <dd> def</dd>
19491 <dt> title&#160;</dt>
19492 <dd> def</dd>
19493 <dt>title</dt>
19494 <dd> def</dd></dl>
19495
19496 !! html/parsoid
19497 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19498 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19499 <dt>title</dt><dd> def</dd></dl>
19500 !! end
19501
19502 !! test
19503 Don't fall for the self-closing div
19504 !! wikitext
19505 <div>hello world</div/>
19506 !! html
19507 <div>hello world</div>
19508
19509 !! end
19510
19511 !! test
19512 MSGNW magic word
19513 !! wikitext
19514 {{MSGNW:msg}}
19515 !! html/php
19516 <p>&#91;&#91;:Template:Msg&#93;&#93;
19517 </p>
19518 !! end
19519
19520 !! test
19521 RAW magic word
19522 !! wikitext
19523 {{RAW:QUERTY}}
19524 !! html
19525 <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>
19526 </p>
19527 !! end
19528
19529 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
19530 !! test
19531 Always escape literal '>' in output, not just after '<'
19532 !! wikitext
19533 ><>
19534 !! html
19535 <p>&gt;&lt;&gt;
19536 </p>
19537 !! end
19538
19539 !! test
19540 Template caching
19541 !! wikitext
19542 {{Test}}
19543 {{Test}}
19544 !! html
19545 <p>This is a test template
19546 This is a test template
19547 </p>
19548 !! end
19549
19550
19551 !! article
19552 MediaWiki:Fake
19553 !! text
19554 ==header==
19555 !! endarticle
19556
19557 !! test
19558 Inclusion of !userCanEdit() content
19559 !! wikitext
19560 {{MediaWiki:Fake}}
19561 !! html
19562 <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>
19563
19564 !! end
19565
19566
19567 !! test
19568 Out-of-order TOC heading levels
19569 !! wikitext
19570 ==2==
19571 ======6======
19572 ===3===
19573 =1=
19574 =====5=====
19575 ==2==
19576 !! html
19577 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19578 <ul>
19579 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
19580 <ul>
19581 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
19582 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
19583 </ul>
19584 </li>
19585 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
19586 <ul>
19587 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
19588 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
19589 </ul>
19590 </li>
19591 </ul>
19592 </div>
19593
19594 <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>
19595 <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>
19596 <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>
19597 <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>
19598 <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>
19599 <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>
19600
19601 !! end
19602
19603
19604 !! test
19605 ISBN with a dummy number
19606 !! wikitext
19607 ISBN ---
19608 !! html
19609 <p>ISBN ---
19610 </p>
19611 !! end
19612
19613
19614 !! test
19615 ISBN with space-delimited number
19616 !! wikitext
19617 ISBN 92 9017 032 8
19618 !! html
19619 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
19620 </p>
19621 !! end
19622
19623
19624 !! test
19625 ISBN with multiple spaces, no number
19626 !! wikitext
19627 ISBN foo
19628 !! html
19629 <p>ISBN foo
19630 </p>
19631 !! end
19632
19633
19634 !! test
19635 ISBN length
19636 !! wikitext
19637 ISBN 123456789
19638
19639 ISBN 1234567890
19640
19641 ISBN 12345678901
19642 !! html
19643 <p>ISBN 123456789
19644 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19645 </p><p>ISBN 12345678901
19646 </p>
19647 !! end
19648
19649
19650 !! test
19651 ISBN with trailing year (bug 8110)
19652 !! wikitext
19653 ISBN 1-234-56789-0 - 2006
19654
19655 ISBN 1 234 56789 0 - 2006
19656 !! html
19657 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
19658 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
19659 </p>
19660 !! end
19661
19662
19663 !! test
19664 anchorencode
19665 !! wikitext
19666 {{anchorencode:foo bar©#%n}}
19667 !! html
19668 <p>foo_bar.C2.A9.23.25n
19669 </p>
19670 !! end
19671
19672 !! test
19673 anchorencode trims spaces
19674 !! wikitext
19675 {{anchorencode: __pretty__please__}}
19676 !! html
19677 <p>pretty_please
19678 </p>
19679 !! end
19680
19681 !! test
19682 anchorencode deals with links
19683 !! wikitext
19684 {{anchorencode: [[hello|world]] [[hi]]}}
19685 !! html
19686 <p>world_hi
19687 </p>
19688 !! end
19689
19690 !! test
19691 anchorencode deals with templates
19692 !! wikitext
19693 {{anchorencode: {{Foo}} }}
19694 !! html
19695 <p>FOO
19696 </p>
19697 !! end
19698
19699 !! test
19700 anchorencode encodes like the TOC generator: (bug 18431)
19701 !! wikitext
19702 === _ +:.3A%3A&&amp;]] ===
19703 {{anchorencode: _ +:.3A%3A&&amp;]] }}
19704 __NOEDITSECTION__
19705 !! html
19706 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
19707 <p>.2B:.3A.253A.26.26.5D.5D
19708 </p>
19709 !! end
19710
19711 !! test
19712 Bug 6200: blockquotes and paragraph formatting
19713 !! wikitext
19714 <blockquote>
19715 foo
19716 </blockquote>
19717
19718 bar
19719
19720 baz
19721 !! html
19722 <blockquote>
19723 <p>foo
19724 </p>
19725 </blockquote>
19726 <p>bar
19727 </p>
19728 <pre>baz
19729 </pre>
19730 !! end
19731
19732 !! test
19733 Bug 8293: Use of center tag ruins paragraph formatting
19734 !! wikitext
19735 <center>
19736 foo
19737 </center>
19738
19739 bar
19740
19741 baz
19742 !! html
19743 <center>
19744 <p>foo
19745 </p>
19746 </center>
19747 <p>bar
19748 </p>
19749 <pre>baz
19750 </pre>
19751 !! end
19752
19753 !!test
19754 Parsing of overlapping (improperly nested) inline html tags
19755 !! wikitext
19756 <span><s>x</span></s>
19757 !! html/php
19758 <p><span><s>x&lt;/span&gt;</s></span>
19759 </p>
19760 !! html/parsoid
19761 <p><span><s>x</s></span>
19762 </p>
19763 !!end
19764
19765 ###
19766 ### Language variants related tests
19767 ###
19768 !! test
19769 Self-link in language variants
19770 !! options
19771 title=[[Dunav]] language=sr
19772 !! wikitext
19773 Both [[Dunav]] and [[Дунав]] are names for this river.
19774 !! html
19775 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
19776 </p>
19777 !!end
19778
19779 !! article
19780 Дуна
19781 !! text
19782 content
19783 !! endarticle
19784
19785 !! test
19786 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
19787 !! options
19788 title=[[Duna]] language=sr
19789 !! wikitext
19790 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
19791 !! html
19792 <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.
19793 </p>
19794 !! end
19795
19796 !! test
19797 Link to a section of a variant of this title shouldn't be parsed as self-link
19798 !! options
19799 title=[[Duna]] language=sr
19800 !! wikitext
19801 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
19802 !! html
19803 <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.
19804 </p>
19805 !! end
19806
19807 !! test
19808 Link to pages in language variants
19809 !! options
19810 language=sr
19811 !! wikitext
19812 Main Page can be written as [[Маин Паге]]
19813 !! html
19814 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
19815 </p>
19816 !!end
19817
19818
19819 !! test
19820 Multiple links to pages in language variants
19821 !! options
19822 language=sr
19823 !! wikitext
19824 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
19825 !! html
19826 <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>.
19827 </p>
19828 !!end
19829
19830
19831 !! test
19832 Simple template in language variants
19833 !! options
19834 language=sr
19835 !! wikitext
19836 {{тест}}
19837 !! html
19838 <p>This is a test template
19839 </p>
19840 !! end
19841
19842
19843 !! test
19844 Template with explicit namespace in language variants
19845 !! options
19846 language=sr
19847 !! wikitext
19848 {{Template:тест}}
19849 !! html
19850 <p>This is a test template
19851 </p>
19852 !! end
19853
19854
19855 !! test
19856 Basic test for template parameter in language variants
19857 !! options
19858 language=sr
19859 !! wikitext
19860 {{парамтест|param=foo}}
19861 !! html
19862 <p>This is a test template with parameter foo
19863 </p>
19864 !! end
19865
19866 !! test
19867 Simple category in language variants
19868 !! options
19869 language=sr cat
19870 !! wikitext
19871 [[Category:МедиаWики Усер'с Гуиде]]
19872 !! html/php
19873 cat=МедиаWики_Усер'с_Гуиде sort=
19874 !! html/parsoid
19875 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
19876 !! end
19877
19878 !! article
19879 Category:分类
19880 !! text
19881 blah
19882 !! endarticle
19883
19884 !! article
19885 Category:分類
19886 !! text
19887 blah
19888 !! endarticle
19889
19890 ## We used to, but no longer wt2wt this test since the default serializer
19891 ## will normalize all categories to serialize on their own line.
19892 ## This wikitext usage is going to be fairly uncommon in production and
19893 ## selser will take care of preserving formatting in those scenarios.
19894 !! test
19895 Don't convert blue categorylinks to another variant (bug 33210)
19896 !! options
19897 cat
19898 language=zh
19899 parsoid=wt2html
19900 !! wikitext
19901 [[A]][[Category:分类]]
19902 !! html/php
19903 cat=分类 sort=
19904 !! html/parsoid
19905 <p><a rel="mw:WikiLink" href="A" title="A">A</a></p>
19906 <link rel="mw:PageProp/Category" href="Category:分类"/>
19907 !! end
19908
19909 !! test
19910 Stripping -{}- tags (language variants)
19911 !! options
19912 language=sr
19913 !! wikitext
19914 Latin proverb: -{Ne nuntium necare}-
19915 !! html
19916 <p>Latin proverb: Ne nuntium necare
19917 </p>
19918 !! end
19919
19920
19921 !! test
19922 Prevent conversion with -{}- tags (language variants)
19923 !! options
19924 language=sr variant=sr-ec
19925 !! wikitext
19926 Latinski: -{Ne nuntium necare}-
19927 !! html
19928 <p>Латински: Ne nuntium necare
19929 </p>
19930 !! end
19931
19932
19933 !! test
19934 Prevent conversion of text with -{}- tags (language variants)
19935 !! options
19936 language=sr variant=sr-ec
19937 !! wikitext
19938 Latinski: -{Ne nuntium necare}-
19939 !! html
19940 <p>Латински: Ne nuntium necare
19941 </p>
19942 !! end
19943
19944
19945 !! test
19946 Prevent conversion of links with -{}- tags (language variants)
19947 !! options
19948 language=sr variant=sr-ec
19949 !! wikitext
19950 -{[[Main Page]]}-
19951 !! html
19952 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19953 </p>
19954 !! end
19955
19956
19957 !! test
19958 -{}- tags within headlines (within html for parserConvert())
19959 !! options
19960 language=sr variant=sr-ec
19961 !! wikitext
19962 == -{Naslov}- ==
19963 !! html
19964 <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>
19965
19966 !! end
19967
19968
19969 !! test
19970 Explicit definition of language variant alternatives
19971 !! options
19972 language=zh variant=zh-tw
19973 !! wikitext
19974 -{zh:China;zh-tw:Taiwan}-, not China
19975 !! html
19976 <p>Taiwan, not China
19977 </p>
19978 !! end
19979
19980
19981 !! test
19982 Conversion around HTML tags
19983 !! options
19984 language=sr variant=sr-ec
19985 !! wikitext
19986 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
19987 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
19988 !! html
19989 <p>
19990 <span title="ЛаCтин">ски</span>
19991 </p>
19992 !! end
19993
19994
19995 !! test
19996 Explicit session-wise language variant mapping (A flag and - flag)
19997 !! options
19998 language=zh variant=zh-tw
19999 !! wikitext
20000 Taiwan is not China.
20001 But -{A|zh:China;zh-tw:Taiwan}- is China,
20002 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
20003 and -{China}- is China.
20004 !! html
20005 <p>Taiwan is not China.
20006 But Taiwan is Taiwan,
20007 (This should be stripped!)
20008 and China is China.
20009 </p>
20010 !! end
20011
20012 !! test
20013 Explicit session-wise language variant mapping (H flag for hide)
20014 !! options
20015 language=zh variant=zh-tw
20016 !! wikitext
20017 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
20018 Taiwan is China.
20019 !! html
20020 <p>(This should be stripped!)
20021 Taiwan is Taiwan.
20022 </p>
20023 !! end
20024
20025 !! test
20026 Adding explicit conversion rule for title (T flag)
20027 !! options
20028 language=zh variant=zh-tw showtitle
20029 !! wikitext
20030 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20031 !! html
20032 Taiwan
20033 <p>Should be stripped!
20034 </p>
20035 !! end
20036
20037 !! test
20038 Testing that changing the language variant here in the tests actually works
20039 !! options
20040 language=zh variant=zh showtitle
20041 !! wikitext
20042 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20043 !! html
20044 China
20045 <p>Should be stripped!
20046 </p>
20047 !! end
20048
20049 !! test
20050 Recursive conversion of alt and title attrs shouldn't clear converter state
20051 !! options
20052 language=zh variant=zh-cn showtitle
20053 !! wikitext
20054 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
20055 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
20056 !! html
20057 China
20058 <p>
20059 Should be stripped<span title="Exclamation">!</span>
20060 </p>
20061 !! end
20062
20063 !! test
20064 Bug 24072: more test on conversion rule for title
20065 !! options
20066 language=zh variant=zh-tw showtitle
20067 !! wikitext
20068 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20069 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
20070 !! html
20071 Taiwan
20072 <p>This should be stripped!
20073 This won't take interferes with the title rule.
20074 </p>
20075 !! end
20076
20077 !! test
20078 Partly disable title conversion if variant == main language code
20079 !! options
20080 language=zh variant=zh title=[[ZH]] showtitle
20081 !! wikitext
20082 -{T|zh-cn:CN;zh-tw:TW}-
20083 !! html
20084 ZH
20085 <p>
20086 </p>
20087 !! end
20088
20089 !! test
20090 Partly disable title conversion if variant == main language code, more
20091 !! options
20092 language=zh variant=zh title=[[ZH]] showtitle
20093 !! wikitext
20094 -{T|TW}-
20095 !! html
20096 ZH
20097 <p>
20098 </p>
20099 !! end
20100
20101 !! test
20102 Raw output of variant escape tags (R flag)
20103 !! options
20104 language=zh variant=zh-tw
20105 !! wikitext
20106 Raw: -{R|zh:China;zh-tw:Taiwan}-
20107 !! html
20108 <p>Raw: zh:China;zh-tw:Taiwan
20109 </p>
20110 !! end
20111
20112 !! test
20113 Strings evaluating false shouldn't be ignored by Language converter (T51072)
20114 !! options
20115 language=zh variant=zh-cn
20116 !! input
20117 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
20118 !! result
20119 <p>0
20120 </p>
20121 !! end
20122
20123 !! test
20124 Conversion rules from [numeric-only string] to [something else] (T48634)
20125 !! options
20126 language=zh variant=zh-cn
20127 !! input
20128 -{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
20129 !! result
20130 <p>D12345EE12345
20131 </p>
20132 !! end
20133
20134 !! test
20135 Bidirectional converter rule entries with an empty value should be ignored (T53551)
20136 !! options
20137 language=zh variant=zh-cn
20138 !! input
20139 -{H|zh-cn:foo;zh-tw:;}-foobar
20140 !! result
20141 <p>foobar
20142 </p>
20143 !! end
20144
20145 !! test
20146 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
20147 !! options
20148 language=zh variant=zh-cn
20149 !! input
20150 -{H|=>zh-cn:foo;}-foobar
20151 !! result
20152 <p>foobar
20153 </p>
20154 !! end
20155
20156 !! test
20157 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
20158 !! options
20159 language=zh variant=zh-cn
20160 !! input
20161 -{H|}-foobar
20162 !! result
20163 <p>foobar
20164 </p>
20165 !! end
20166
20167 !! test
20168 Nested using of manual convert syntax
20169 !! options
20170 language=zh variant=zh-hk
20171 !! wikitext
20172 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
20173 !! html
20174 <p>Nested: Hello Hong Kong!
20175 </p>
20176 !! end
20177
20178 # Since Parsoid is starting to emit canonical wikitext for links,
20179 # [http://example.com http://example.com] will not RT back to that
20180 # form anymore.
20181 !! test
20182 Proper conversion of text in external links
20183 !! options
20184 language=sr variant=sr-ec
20185 parsoid=wt2html
20186 !! wikitext
20187 http://www.google.com
20188 gopher://www.google.com
20189 [http://www.google.com http://www.google.com]
20190 [gopher://www.google.com gopher://www.google.com]
20191 [https://www.google.com irc://www.google.com]
20192 [ftp://www.google.com www.google.com/ftp://dir]
20193 [//www.google.com www.google.com]
20194 !! html/php
20195 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20196 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20197 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20198 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20199 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
20200 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20201 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
20202 </p>
20203 !! html/parsoid
20204 <p><a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20205 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20206 <a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20207 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20208 <a rel="mw:ExtLink" href="https://www.google.com">irc://www.google.com</a>
20209 <a rel="mw:ExtLink" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20210 <a rel="mw:ExtLink" href="//www.google.com">www.гоогле.цом</a></p>
20211 !! end
20212
20213 !! test
20214 Do not convert roman numbers to language variants
20215 !! options
20216 language=sr variant=sr-ec
20217 !! wikitext
20218 Fridrih IV je car.
20219 !! html
20220 <p>Фридрих IV је цар.
20221 </p>
20222 !! end
20223
20224 !! test
20225 Unclosed language converter markup "-{"
20226 !! options
20227 language=sr
20228 !! wikitext
20229 -{T|hello
20230 !! html
20231 <p>-{T|hello
20232 </p>
20233 !! end
20234
20235 !! test
20236 Don't convert raw rule "-{R|=&gt;}-" to "=>"
20237 !! options
20238 language=sr
20239 !! wikitext
20240 -{R|=&gt;}-
20241 !! html
20242 <p>=&gt;
20243 </p>
20244 !!end
20245
20246 !! test
20247 Don't break link parsing if language converter markup is in the caption.
20248 !! options
20249 language=sr variant=sr-ec
20250 !! wikitext
20251 [[Main Page|-{R|main page}-]]
20252 !! html
20253 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
20254 </p>
20255 !! end
20256
20257 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20258 !! test
20259 Don't break image parsing if language converter markup is in the caption.
20260 !! options
20261 language=sr
20262 !! wikitext
20263 [[File:Foobar.jpg|-{R|caption}-]]
20264 !! html/parsoid
20265 <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>
20266 </p>
20267 !! end
20268
20269 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20270 !! test
20271 Don't break list handling if language converter markup is in the item.
20272 !! options
20273 language=zh variant=zh-cn
20274 !! wikitext
20275 ;-{zh-cn:AAA;zh-tw:BBB}-
20276 !! html/php
20277 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
20278
20279 !! html/parsoid
20280 <dl><dt>AAA
20281 </dt></dl>
20282 !! end
20283
20284 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20285 !! test
20286 Don't break table handling if language converter markup is in the cell.
20287 !! options
20288 language=sr variant=sr-ec
20289 !! wikitext
20290 {|
20291 |-
20292 | -{R|B}-
20293 |}
20294 !! html/php
20295 <table>
20296
20297 <tr>
20298 <td>Б}-
20299 </td></tr></table>
20300
20301 !! html/parsoid
20302 <table>
20303
20304 <tr>
20305 <td> B
20306 </td></tr></table>
20307
20308 !! end
20309
20310 !! test
20311 Bug 529: Uncovered bullet
20312 !! wikitext
20313 * Foo {{bullet}}
20314 !! html
20315 <ul><li> Foo </li>
20316 <li> Bar</li></ul>
20317
20318 !! end
20319
20320 # Plain MediaWiki does not remove empty lists, but tidy actually does.
20321 # Templates in Wikipedia rely on this behavior, as tidy has always been
20322 # enabled there. These tests are normally run *without* tidy, so specify the
20323 # full output here.
20324 # To test realistic parsing behavior, apply a tidy-like transformation to both
20325 # the expected output and your parser's output.
20326 !! test
20327 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
20328 !! wikitext
20329 ******* Foo {{bullet}}
20330 !! html
20331 <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>
20332 <li> Bar</li></ul>
20333
20334 !! end
20335
20336 !! test
20337 Bug 529: Uncovered table already at line-start
20338 !! wikitext
20339 x
20340
20341 {{table}}
20342 y
20343 !! html
20344 <p>x
20345 </p>
20346 <table>
20347 <tr>
20348 <td> 1 </td>
20349 <td> 2
20350 </td></tr>
20351 <tr>
20352 <td> 3 </td>
20353 <td> 4
20354 </td></tr></table>
20355 <p>y
20356 </p>
20357 !! end
20358
20359 !! test
20360 Bug 529: Uncovered bullet in parser function result
20361 !! wikitext
20362 * Foo {{lc:{{bullet}} }}
20363 !! html
20364 <ul><li> Foo </li>
20365 <li> bar</li></ul>
20366
20367 !! end
20368
20369 !! test
20370 Bug 5678: Double-parsed template argument
20371 !! wikitext
20372 {{lc:{{{1}}}|hello}}
20373 !! html
20374 <p>{{{1}}}
20375 </p>
20376 !! end
20377
20378 !! test
20379 Bug 5678: Double-parsed template invocation
20380 !! wikitext
20381 {{lc:{{paramtest {{!}} param = hello }} }}
20382 !! html
20383 <p>{{paramtest | param = hello }}
20384 </p>
20385 !! end
20386
20387 !! test
20388 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
20389 !! options
20390 language=cs
20391 title=[[Main Page]]
20392 !! wikitext
20393 {{PRVNÍVELKÉ:ěščř}}
20394 {{prvnívelké:ěščř}}
20395 {{PRVNÍMALÉ:ěščř}}
20396 {{prvnímalé:ěščř}}
20397 {{MALÁ:ěščř}}
20398 {{malá:ěščř}}
20399 {{VELKÁ:ěščř}}
20400 {{velká:ěščř}}
20401 !! html
20402 <p>Ěščř
20403 Ěščř
20404 ěščř
20405 ěščř
20406 ěščř
20407 ěščř
20408 ĚŠČŘ
20409 ĚŠČŘ
20410 </p>
20411 !! end
20412
20413 !! test
20414 Morwen/13: Unclosed link followed by heading
20415 !! wikitext
20416 [[link
20417 ==heading==
20418 !! html
20419 <p>[[link
20420 </p>
20421 <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>
20422
20423 !! end
20424
20425 !! test
20426 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
20427 !! wikitext
20428 {{foo|
20429 =heading=
20430 !! html
20431 <p>{{foo|
20432 </p>
20433 <h1><span class="mw-headline" id="heading">heading</span></h1>
20434
20435 !! end
20436
20437 !! test
20438 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
20439 !! wikitext
20440 {{foo|
20441 ==heading==
20442 !! html
20443 <p>{{foo|
20444 </p>
20445 <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>
20446
20447 !! end
20448
20449 !! test
20450 Tildes in comments
20451 !! options
20452 pst
20453 !! wikitext
20454 <!-- ~~~~ -->
20455 !! html/php
20456 <!-- ~~~~ -->
20457 !! end
20458
20459 !! test
20460 Paragraphs inside divs (no extra line breaks)
20461 !! wikitext
20462 <div>Line one
20463
20464 Line two</div>
20465 !! html
20466 <div>Line one
20467 Line two</div>
20468
20469 !! end
20470
20471 !! test
20472 Paragraphs inside divs (extra line break on open)
20473 !! wikitext
20474 <div>
20475 Line one
20476
20477 Line two</div>
20478 !! html
20479 <div>
20480 <p>Line one
20481 </p>
20482 Line two</div>
20483
20484 !! end
20485
20486 !! test
20487 Paragraphs inside divs (extra line break on close)
20488 !! wikitext
20489 <div>Line one
20490
20491 Line two
20492 </div>
20493 !! html
20494 <div>Line one
20495 <p>Line two
20496 </p>
20497 </div>
20498
20499 !! end
20500
20501 !! test
20502 Paragraphs inside divs (extra line break on open and close)
20503 !! wikitext
20504 <div>
20505 Line one
20506
20507 Line two
20508 </div>
20509 !! html
20510 <div>
20511 <p>Line one
20512 </p><p>Line two
20513 </p>
20514 </div>
20515
20516 !! end
20517
20518 !! test
20519 Nesting tags, paragraphs on lines which begin with <div>
20520 !! wikitext
20521 <div></div><strong>A
20522 B</strong>
20523 !! html/php+tidy
20524 <p><strong>A</strong></p>
20525 <p><strong>B</strong></p>
20526 !! html/parsoid
20527 <div></div>
20528 <p><strong>A
20529 B</strong>
20530 </p>
20531 !! end
20532
20533 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
20534 !! test
20535 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
20536 !! wikitext
20537 <blockquote>Line one
20538
20539 Line two</blockquote>
20540 !! html
20541 <blockquote>Line one
20542 Line two</blockquote>
20543
20544 !! html+tidy
20545 <blockquote>
20546 <p>Line one Line two</p>
20547 </blockquote>
20548 !! end
20549
20550 !! test
20551 Bug 6200: paragraphs inside blockquotes (extra line break on open)
20552 !! wikitext
20553 <blockquote>
20554 Line one
20555
20556 Line two</blockquote>
20557 !! html
20558 <blockquote>
20559 <p>Line one
20560 </p>
20561 Line two</blockquote>
20562
20563 !! html+tidy
20564 <blockquote>
20565 <p>Line one</p>
20566 Line two</blockquote>
20567 !! end
20568
20569 !! test
20570 Bug 6200: paragraphs inside blockquotes (extra line break on close)
20571 !! wikitext
20572 <blockquote>Line one
20573
20574 Line two
20575 </blockquote>
20576 !! html
20577 <blockquote>Line one
20578 <p>Line two
20579 </p>
20580 </blockquote>
20581
20582 !! html+tidy
20583 <blockquote>
20584 <p>Line one</p>
20585 <p>Line two</p>
20586 </blockquote>
20587 !! end
20588
20589 !! test
20590 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
20591 !! wikitext
20592 <blockquote>
20593 Line one
20594
20595 Line two
20596 </blockquote>
20597 !! html
20598 <blockquote>
20599 <p>Line one
20600 </p><p>Line two
20601 </p>
20602 </blockquote>
20603
20604 !! html+tidy
20605 <blockquote>
20606 <p>Line one</p>
20607 <p>Line two</p>
20608 </blockquote>
20609 !! end
20610
20611 !! test
20612 Paragraphs inside blockquotes/divs (no extra line breaks)
20613 !! wikitext
20614 <blockquote><div>Line one
20615
20616 Line two</div></blockquote>
20617 !! html
20618 <blockquote><div>Line one
20619 Line two</div></blockquote>
20620
20621 !! end
20622
20623 !! test
20624 Paragraphs inside blockquotes/divs (extra line break on open)
20625 !! wikitext
20626 <blockquote><div>
20627 Line one
20628
20629 Line two</div></blockquote>
20630 !! html
20631 <blockquote><div>
20632 <p>Line one
20633 </p>
20634 Line two</div></blockquote>
20635
20636 !! end
20637
20638 !! test
20639 Paragraphs inside blockquotes/divs (extra line break on close)
20640 !! wikitext
20641 <blockquote><div>Line one
20642
20643 Line two
20644 </div></blockquote>
20645 !! html
20646 <blockquote><div>Line one
20647 <p>Line two
20648 </p>
20649 </div></blockquote>
20650
20651 !! end
20652
20653 !! test
20654 Paragraphs inside blockquotes/divs (extra line break on open and close)
20655 !! wikitext
20656 <blockquote><div>
20657 Line one
20658
20659 Line two
20660 </div></blockquote>
20661 !! html
20662 <blockquote><div>
20663 <p>Line one
20664 </p><p>Line two
20665 </p>
20666 </div></blockquote>
20667
20668 !! end
20669
20670 !! test
20671 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
20672 !! options
20673 wgLinkHolderBatchSize=0
20674 !! wikitext
20675 [[meatball:1]]
20676 [[meatball:2]]
20677 [[meatball:3]]
20678 !! html
20679 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
20680 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
20681 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
20682 </p>
20683 !! end
20684
20685 !! test
20686 Free external link invading image caption
20687 !! wikitext
20688 [[Image:Foobar.jpg|thumb|http://x|hello]]
20689 !! html
20690 <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>
20691
20692 !! end
20693
20694 !! test
20695 Bug 15196: localised external link numbers
20696 !! options
20697 language=fa
20698 !! wikitext
20699 [http://en.wikipedia.org/]
20700 !! html/php
20701 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
20702 </p>
20703 !! html/parsoid
20704 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
20705 !! end
20706
20707 !! test
20708 Multibyte character in padleft
20709 !! wikitext
20710 {{padleft:-Hello|7|Æ}}
20711 !! html
20712 <p>Æ-Hello
20713 </p>
20714 !! end
20715
20716 !! test
20717 Multibyte character in padright
20718 !! wikitext
20719 {{padright:Hello-|7|Æ}}
20720 !! html
20721 <p>Hello-Æ
20722 </p>
20723 !! end
20724
20725 !!test
20726 formatdate parser function
20727 !! wikitext
20728 {{#formatdate:2009-03-24}}
20729 !! html
20730 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
20731 </p>
20732 !! end
20733
20734 !!test
20735 formatdate parser function, with default format
20736 !! wikitext
20737 {{#formatdate:2009-03-24|mdy}}
20738 !! html
20739 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
20740 </p>
20741 !! end
20742
20743 !! test
20744 Spacing of numbers in formatted dates
20745 !! wikitext
20746 {{#formatdate:January 15}}
20747 !! html
20748 <p><span class="mw-formatted-date" title="01-15">January 15</span>
20749 </p>
20750 !! end
20751
20752 !! test
20753 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
20754 !! options
20755 language=nl title=[[MediaWiki:Common.css]]
20756 !! wikitext
20757 {{#formatdate:2009-03-24|dmy}}
20758 !! html
20759 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
20760 </p>
20761 !! end
20762
20763 #
20764 #
20765 #
20766
20767 #
20768 # Edit comments
20769 #
20770
20771 !! test
20772 Edit comment with link
20773 !! options
20774 comment
20775 !! wikitext
20776 I like the [[Main Page]] a lot
20777 !! html/php
20778 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
20779 !!end
20780
20781 !! test
20782 Edit comment with link and link text
20783 !! options
20784 comment
20785 !! wikitext
20786 I like the [[Main Page|best pages]] a lot
20787 !! html/php
20788 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20789 !!end
20790
20791 !! test
20792 Edit comment with link and link text with suffix
20793 !! options
20794 comment
20795 !! wikitext
20796 I like the [[Main Page|best page]]s a lot
20797 !! html/php
20798 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20799 !!end
20800
20801 !! test
20802 Edit comment with section link (non-local, eg in history list)
20803 !! options
20804 comment title=[[Main Page]]
20805 !! wikitext
20806 /* External links */ removed bogus entries
20807 !! html/php
20808 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20809 !!end
20810
20811 !! test
20812 Edit comment with section link and text before it (non-local, eg in history list)
20813 !! options
20814 comment title=[[Main Page]]
20815 !! wikitext
20816 pre-comment text /* External links */ removed bogus entries
20817 !! html/php
20818 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>
20819 !!end
20820
20821 !! test
20822 Edit comment with section link (local, eg in diff view)
20823 !! options
20824 comment local title=[[Main Page]]
20825 !! wikitext
20826 /* External links */ removed bogus entries
20827 !! html/php
20828 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20829 !!end
20830
20831 !! test
20832 Edit comment with subpage link (bug 14080)
20833 !! options
20834 comment
20835 subpage
20836 title=[[Subpage test]]
20837 !! wikitext
20838 Poked at a [[/subpage]] here...
20839 !! html/php
20840 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
20841 !!end
20842
20843 !! test
20844 Edit comment with subpage link and link text (bug 14080)
20845 !! options
20846 comment
20847 subpage
20848 title=[[Subpage test]]
20849 !! wikitext
20850 Poked at a [[/subpage|neat little page]] here...
20851 !! html/php
20852 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
20853 !!end
20854
20855 !! test
20856 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
20857 !! options
20858 comment
20859 title=[[Subpage test]]
20860 !! wikitext
20861 Poked at a [[/subpage]] here...
20862 !! html/php
20863 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...
20864 !!end
20865
20866 !! test
20867 Edit comment with bare anchor link (local, as on diff)
20868 !! options
20869 comment
20870 local
20871 title=[[Main Page]]
20872 !! wikitext
20873 [[#section]]
20874 !! html/php
20875 <a href="#section">#section</a>
20876 !! end
20877
20878 !! test
20879 Edit comment with bare anchor link (non-local, as on history)
20880 !! options
20881 comment
20882 title=[[Main Page]]
20883 !! wikitext
20884 [[#section]]
20885 !! html/php
20886 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
20887 !! end
20888
20889 !! test
20890 Anchor starting with underscore
20891 !! options
20892 title=[[Foo]]
20893 !! wikitext
20894 [[#_ref|One]]
20895 !! html/php
20896 <p><a href="#_ref">One</a>
20897 </p>
20898 !! html/parsoid
20899 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
20900 !! end
20901
20902 !! test
20903 Id starting with underscore
20904 !! wikitext
20905 <div id="_ref"></div>
20906 !! html/*
20907 <div id="_ref"></div>
20908
20909 !! end
20910
20911 !! test
20912 Edit comment with link with more than one pipe (T99346)
20913 !! options
20914 comment
20915 !! wikitext
20916 [[Main Page|Many|pipes]]
20917 !! html
20918 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
20919 !! end
20920
20921 !! test
20922 Complex edit comment with link with more than one pipe (T99346)
20923 !! options
20924 comment
20925 !! wikitext
20926 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
20927 !! html
20928 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;
20929 !! end
20930
20931 !! test
20932 Space normalisation on autocomment (bug 22784)
20933 !! options
20934 comment
20935 title=[[Main Page]]
20936 !! wikitext
20937 /* __hello__world__ */
20938 !! html/php
20939 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
20940 !! end
20941
20942 !! test
20943 percent-encoding and + signs in comments (Bug 26410)
20944 !! options
20945 comment
20946 !! wikitext
20947 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
20948 !! html/php
20949 <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>
20950 !! end
20951
20952 # Parsoid doesn't support this yet: see bug 73581
20953 # but it *should* omit the 'src' attribute if the image is bad.
20954 # PHP side of tests was disabled in
20955 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
20956 # because of issues in the PHP parserTests infrastructure
20957 # (but the output below is indeed what the PHP side emits)
20958 !! test
20959 Bad images - basic functionality
20960 !! wikitext
20961 [[File:Bad.jpg]]
20962 !! DISABLED/html/php
20963 !! html/parsoid
20964 <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>
20965 !! end
20966
20967 !! test
20968 Bad images - bug 16039: text after bad image disappears
20969 !! wikitext
20970 Foo bar
20971 [[File:Bad.jpg]]
20972 Bar foo
20973 !! DISABLED/html/php
20974 <p>Foo bar
20975 </p><p>Bar foo
20976 </p>
20977 !! html/parsoid
20978 <p>Foo bar
20979 <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>
20980 Bar foo</p>
20981 !! end
20982
20983 !! test
20984 Verify that displaytitle works (bug #22501) no displaytitle
20985 !! options
20986 showtitle
20987 !! config
20988 wgAllowDisplayTitle=true
20989 wgRestrictDisplayTitle=false
20990 !! wikitext
20991 this is not the the title
20992 !! html/php
20993 Parser test
20994 <p>this is not the the title
20995 </p>
20996 !! end
20997
20998 !! test
20999 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
21000 !! options
21001 showtitle
21002 title=[[Screen]]
21003 !! config
21004 wgAllowDisplayTitle=true
21005 wgRestrictDisplayTitle=false
21006 !! wikitext
21007 this is not the the title
21008 {{DISPLAYTITLE:whatever}}
21009 !! html/php
21010 whatever
21011 <p>this is not the the title
21012 </p>
21013 !! end
21014
21015 !! test
21016 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
21017 !! options
21018 showtitle
21019 title=[[Screen]]
21020 !! config
21021 wgAllowDisplayTitle=true
21022 wgRestrictDisplayTitle=true
21023 !! wikitext
21024 this is not the the title
21025 {{DISPLAYTITLE:whatever}}
21026 !! html/php
21027 Screen
21028 <p>this is not the the title
21029 </p>
21030 !! end
21031
21032 !! test
21033 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
21034 !! options
21035 showtitle
21036 title=[[Screen]]
21037 !! config
21038 wgAllowDisplayTitle=true
21039 wgRestrictDisplayTitle=true
21040 !! wikitext
21041 this is not the the title
21042 {{DISPLAYTITLE:screen}}
21043 !! html/php
21044 screen
21045 <p>this is not the the title
21046 </p>
21047 !! end
21048
21049 !! test
21050 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
21051 !! options
21052 showtitle
21053 title=[[Screen]]
21054 !! config
21055 wgAllowDisplayTitle=false
21056 !! wikitext
21057 this is not the the title
21058 {{DISPLAYTITLE:screen}}
21059 !! html/php
21060 Screen
21061 <p>this is not the the title
21062 <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>
21063 </p>
21064 !! end
21065
21066 !! test
21067 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
21068 !! options
21069 showtitle
21070 title=[[Screen]]
21071 !! config
21072 wgAllowDisplayTitle=false
21073 !! wikitext
21074 this is not the the title
21075 !! html/php
21076 Screen
21077 <p>this is not the the title
21078 </p>
21079 !! end
21080
21081 !! test
21082 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
21083 !! options
21084 showtitle
21085 title=[[Screen]]
21086 !! config
21087 wgAllowDisplayTitle=true
21088 wgRestrictDisplayTitle=true
21089 !! wikitext
21090 this is not the the title
21091 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
21092 !! html/php
21093 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
21094 <p>this is not the the title
21095 </p>
21096 !! end
21097
21098 !! test
21099 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
21100 !! options
21101 showtitle
21102 title=[[Screen]]
21103 !! config
21104 wgAllowDisplayTitle=true
21105 wgRestrictDisplayTitle=true
21106 !! wikitext
21107 this is not the the title
21108 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
21109 !! html/php
21110 <span style="color: red;">s</span>creen
21111 <p>this is not the the title
21112 </p>
21113 !! end
21114
21115 !! test
21116 Page status indicators: Empty name is invalid
21117 !! options
21118 showindicators
21119 !! wikitext
21120 <indicator name=" "></indicator>
21121 <indicator></indicator>
21122 !! html
21123 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21124 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21125 </p>
21126 !! end
21127
21128 !! test
21129 Page status indicators: Weird syntaxes that are okay
21130 !! options
21131 showindicators
21132 !! wikitext
21133 <indicator name="empty" />
21134 <indicator name="name"></indicator>
21135 !! html
21136 empty=
21137 name=
21138 <p><br />
21139 </p>
21140 !! end
21141
21142 !! test
21143 Page status indicators: Torture test
21144 !! options
21145 showindicators
21146 !! wikitext
21147 <indicator name="01">hello world</indicator>
21148 <indicator name="02">[[Main Page]]</indicator>
21149 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
21150 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
21151 <indicator name="05">* foo
21152 * bar</indicator>
21153 <indicator name="06"><nowiki>foo</nowiki></indicator>
21154 <indicator name="07"> Preformatted</indicator>
21155 <indicator name="08"><div>Broken tag</indicator>
21156 <indicator name="09">{| class=wikitable
21157 | cell
21158 |}</indicator>
21159 <indicator name="10">Two
21160
21161 paragraphs</indicator>
21162 !! html
21163 01=hello world
21164 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21165 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" />
21166 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>
21167 05=<ul><li> foo</li>
21168 <li> bar</li></ul>
21169
21170 06=foo
21171 07=<pre>Preformatted
21172 </pre>
21173 08=<div>Broken tag</div>
21174
21175 09=<table class="wikitable">
21176 <tr>
21177 <td> cell
21178 </td></tr></table>
21179
21180 10=<p>Two
21181 </p><p>paragraphs
21182 </p>
21183 <p><br />
21184 </p><p><br />
21185 </p><p><br />
21186 </p><p><br />
21187 </p><p><br />
21188 </p>
21189 !! end
21190
21191 !! test
21192 preload: check <noinclude> and <includeonly>
21193 !! options
21194 preload
21195 !! wikitext
21196 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
21197 !! html/php
21198 Hello kind world.
21199 !! end
21200
21201 !! test
21202 preload: check <onlyinclude>
21203 !! options
21204 preload
21205 !! wikitext
21206 Goodbye <onlyinclude>Hello world</onlyinclude>
21207 !! html/php
21208 Hello world
21209 !! end
21210
21211 !! test
21212 preload: can pass tags through if we want to
21213 !! options
21214 preload
21215 !! wikitext
21216 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
21217 !! html/php
21218 <includeonly>Hello world</includeonly>
21219 !! end
21220
21221 !! test
21222 preload: check that it doesn't try to do tricks
21223 !! options
21224 preload
21225 !! wikitext
21226 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21227 !! html/php
21228 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21229 !! end
21230
21231 !! test
21232 Play a bit with r67090 and bug 3158
21233 !! wikitext
21234 <div style="width:50% !important">&nbsp;</div>
21235 <div style="width:50%&nbsp;!important">&nbsp;</div>
21236 <div style="width:50%&#160;!important">&nbsp;</div>
21237 <div style="border : solid;">&nbsp;</div>
21238 !! html/php
21239 <div style="width:50% !important">&#160;</div>
21240 <div style="width:50% !important">&#160;</div>
21241 <div style="width:50% !important">&#160;</div>
21242 <div style="border&#160;: solid;">&#160;</div>
21243
21244 !! html/parsoid
21245 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21246 <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>
21247 <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>
21248 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21249
21250 !! end
21251
21252 !! test
21253 HTML5 data attributes
21254 !! wikitext
21255 <span data-foo="bar">Baz</span>
21256 <p data-abc-def_hij="">Quuz</p>
21257 !! html/php
21258 <p><span data-foo="bar">Baz</span>
21259 </p>
21260 <p data-abc-def_hij="">Quuz</p>
21261
21262 !! html/parsoid
21263 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
21264 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
21265 !! end
21266
21267 !! test
21268 Strip reserved data attributes
21269 !! wikitext
21270 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
21271 !! html/php
21272 <div data-ok="fred">d</div>
21273
21274 !! html/parsoid
21275 <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>
21276 !! end
21277
21278 !! test
21279 percent-encoding and + signs in internal links (Bug 26410)
21280 !! wikitext
21281 [[User:+%]] [[Page+title%]]
21282 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
21283 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
21284 [[%33%45]] [[%33%45+]]
21285 !! html/php
21286 <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>
21287 <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>
21288 <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>
21289 <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>
21290 </p>
21291 !! html/parsoid
21292 <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>
21293 <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>
21294 <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>
21295 <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>
21296 !! end
21297
21298 !! test
21299 Special characters in embedded file links (bug 27679)
21300 !! wikitext
21301 [[File:Contains & ampersand.jpg]]
21302 [[File:Does not exist.jpg|Title with & ampersand]]
21303 !! html/php
21304 <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>
21305 <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>
21306 </p>
21307 !! html/parsoid
21308 <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>
21309 <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>
21310 !! end
21311
21312 !! test
21313 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
21314 !! wikitext
21315 Text&apos;s been normalized?
21316 !! html
21317 <p>Text&#39;s been normalized?
21318 </p>
21319 !! end
21320
21321 !! test
21322 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
21323 !! wikitext
21324 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
21325 !! html
21326 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
21327 </p>
21328 !! end
21329
21330 !! test
21331 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
21332 !! wikitext
21333 [http://www.example.org/ ideograms]
21334 !! html
21335 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
21336 </p>
21337 !! end
21338
21339 !! test
21340 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
21341 !! wikitext
21342 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
21343 !! html
21344 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
21345 </p>
21346 !! end
21347
21348 !! article
21349 Mediawiki:loop1
21350 !! text
21351 {{Identical|A}}
21352 !! endarticle
21353
21354 !! article
21355 Mediawiki:loop2
21356 !! text
21357 {{Identical|B}}
21358 !! endarticle
21359
21360 !! article
21361 Template:Identical
21362 !! text
21363 {{int:loop1}}
21364 {{int:loop2}}
21365 !! endarticle
21366
21367 !! test
21368 Bug 31098 Template which includes system messages which includes the template
21369 !! wikitext
21370 {{Identical}}
21371 !! html
21372 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21373 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21374 </p>
21375 !! end
21376
21377 !! test
21378 Bug31490 Turkish: ucfirst 'blah'
21379 !! options
21380 language=tr
21381 !! wikitext
21382 {{ucfirst:blah}}
21383 !! html
21384 <p>Blah
21385 </p>
21386 !! end
21387
21388 !! test
21389 Bug31490 Turkish: ucfirst 'ix'
21390 !! options
21391 language=tr
21392 !! wikitext
21393 {{ucfirst:ix}}
21394 !! html
21395 <p>İx
21396 </p>
21397 !! end
21398
21399 !! test
21400 Bug31490 Turkish: lcfirst 'BLAH'
21401 !! options
21402 language=tr
21403 !! wikitext
21404 {{lcfirst:BLAH}}
21405 !! html
21406 <p>bLAH
21407 </p>
21408 !! end
21409
21410 !! test
21411 Bug31490 Turkish: ucfırst (with a dotless i)
21412 !! options
21413 language=tr
21414 !! wikitext
21415 {{ucfırst:blah}}
21416 !! html
21417 <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>
21418 </p>
21419 !! end
21420
21421 !! test
21422 Bug31490 ucfırst (with a dotless i) with English language
21423 !! options
21424 language=en
21425 !! wikitext
21426 {{ucfırst:blah}}
21427 !! html
21428 <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>
21429 </p>
21430 !! end
21431
21432 !! test
21433 Bug 26375: TOC with italics
21434 !! options
21435 title=[[Main Page]]
21436 !! wikitext
21437 __TOC__
21438 == ''Lost'' episodes ==
21439 !! html
21440 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21441 <ul>
21442 <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>
21443 </ul>
21444 </div>
21445
21446 <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>
21447
21448 !! end
21449
21450 !! test
21451 Bug 26375: TOC with bold
21452 !! options
21453 title=[[Main Page]]
21454 !! wikitext
21455 __TOC__
21456 == '''should be bold''' then normal text ==
21457 !! html
21458 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21459 <ul>
21460 <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>
21461 </ul>
21462 </div>
21463
21464 <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>
21465
21466 !! end
21467
21468 !! test
21469 Bug 33845: Headings become cursive in TOC when they contain an image
21470 !! options
21471 title=[[Main Page]]
21472 !! wikitext
21473 __TOC__
21474 == Image [[Image:foobar.jpg]] ==
21475 !! html
21476 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21477 <ul>
21478 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
21479 </ul>
21480 </div>
21481
21482 <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>
21483
21484 !! end
21485
21486 !! test
21487 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
21488 !! options
21489 title=[[Main Page]]
21490 !! wikitext
21491 __TOC__
21492 == <blockquote>Quote</blockquote> ==
21493 !! html
21494 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21495 <ul>
21496 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21497 </ul>
21498 </div>
21499
21500 <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>
21501
21502 !! html+tidy
21503 <p></p>
21504 <div id="toc" class="toc">
21505 <div id="toctitle">
21506 <h2>Contents</h2>
21507 </div>
21508 <ul>
21509 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21510 </ul>
21511 </div>
21512 <p></p>
21513 <h2><span class="mw-headline" id="Quote"></span></h2>
21514 <blockquote>
21515 <p><span class="mw-headline" id="Quote">Quote</span></p>
21516 </blockquote>
21517 <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>
21518 !! end
21519
21520 !! test
21521 Unclosed tags in TOC
21522 !! options
21523 title=[[Main Page]]
21524 !! wikitext
21525 __TOC__
21526 == Proof: 2 < 3 ==
21527 <small>Hanc marginis exiguitas non caperet.</small>
21528 QED
21529 !! html
21530 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21531 <ul>
21532 <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>
21533 </ul>
21534 </div>
21535
21536 <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>
21537 <p><small>Hanc marginis exiguitas non caperet.</small>
21538 QED
21539 </p>
21540 !! end
21541
21542 !! test
21543 Multiple tags in TOC
21544 !! wikitext
21545 __TOC__
21546 == <i>Foo</i> <b>Bar</b> ==
21547
21548 == <i>Foo</i> <blockquote>Bar</blockquote> ==
21549 !! html
21550 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21551 <ul>
21552 <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>
21553 <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>
21554 </ul>
21555 </div>
21556
21557 <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>
21558 <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>
21559
21560 !! html+tidy
21561 <p></p>
21562 <div id="toc" class="toc">
21563 <div id="toctitle">
21564 <h2>Contents</h2>
21565 </div>
21566 <ul>
21567 <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>
21568 <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>
21569 </ul>
21570 </div>
21571 <p></p>
21572 <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>
21573 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
21574 <blockquote>
21575 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
21576 </blockquote>
21577 <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>
21578 !! end
21579
21580 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
21581 # html5 tag parsing.
21582 !! test
21583 Tags with parameters in TOC
21584 !! options
21585 parsoid=wt2html
21586 !! wikitext
21587 __TOC__
21588 == <sup class="in-h2">Hello</sup> ==
21589
21590 == <sup class="a > b">Evilbye</sup> ==
21591 !! html/php
21592 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21593 <ul>
21594 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
21595 <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>
21596 </ul>
21597 </div>
21598
21599 <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>
21600 <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>
21601
21602 !! html/parsoid
21603 <meta property="mw:PageProp/toc" />
21604 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
21605
21606 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
21607 !! end
21608
21609 !! test
21610 span tags with directionality in TOC
21611 !! wikitext
21612 __TOC__
21613 == <span dir="ltr">C++</span> ==
21614
21615 == <span dir="rtl">זבנג!</span> ==
21616
21617 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
21618
21619 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
21620
21621 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
21622 !! html
21623 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21624 <ul>
21625 <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>
21626 <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>
21627 <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>
21628 <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>
21629 <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>
21630 </ul>
21631 </div>
21632
21633 <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>
21634 <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>
21635 <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>
21636 <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>
21637 <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>
21638
21639 !! end
21640
21641 !! test
21642 Bug 72884: bdi element in ToC
21643 !! wikitext
21644 __TOC__
21645 == <bdi>test</bdi> ==
21646 !! html
21647 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21648 <ul>
21649 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
21650 </ul>
21651 </div>
21652
21653 <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>
21654
21655 !! end
21656
21657 !! test
21658 T35715: s/strike element in ToC
21659 !! wikitext
21660 __TOC__
21661 == <s>test</s> test <strike>test</strike> ==
21662 !! html
21663 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21664 <ul>
21665 <li class="toclevel-1 tocsection-1"><a href="#test_test_test"><span class="tocnumber">1</span> <span class="toctext"><s>test</s> test <strike>test</strike></span></a></li>
21666 </ul>
21667 </div>
21668
21669 <h2><span class="mw-headline" id="test_test_test"><s>test</s> test <strike>test</strike></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 test test">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
21670
21671 !! end
21672
21673 # Note that the html output does not have the <p></p>, but the
21674 # html+tidy output *does*. This is because the empty <p></p> is
21675 # removed by the sanitizer, but only when tidy is *not* enabled (!).
21676 !! test
21677 Empty <p> tag in TOC, removed by Sanitizer (T92892)
21678 !! wikitext
21679 __TOC__
21680 == x ==
21681 !! html
21682 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21683 <ul>
21684 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21685 </ul>
21686 </div>
21687
21688 <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>
21689
21690 !! html+tidy
21691 <p></p>
21692 <div id="toc" class="toc">
21693 <div id="toctitle">
21694 <h2>Contents</h2>
21695 </div>
21696 <ul>
21697 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21698 </ul>
21699 </div>
21700 <p></p>
21701 <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>
21702 !! end
21703
21704 !! article
21705 MediaWiki:Bug32057
21706 !! text
21707 == {{int:headline_sample}} ==
21708 !! endarticle
21709
21710 !! test
21711 Bug 32057: Title needed when expanding <h> nodes.
21712 !! options
21713 title=[[Main Page]]
21714 !! wikitext
21715 {{int:Bug32057}}
21716 !! html
21717 <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>
21718
21719 !! end
21720
21721 !! test
21722 Strip marker in urlencode
21723 !! wikitext
21724 {{urlencode:x<nowiki/>y}}
21725 {{urlencode:x<nowiki/>y|wiki}}
21726 {{urlencode:x<nowiki/>y|path}}
21727 {{urlencode:x<pre id="one">two</pre>y}}
21728 !! html
21729 <p>xy
21730 xy
21731 xy
21732 xy
21733 </p>
21734 !! end
21735
21736 !! test
21737 Strip marker in lc
21738 !! wikitext
21739 {{lc:x<nowiki/>y}}
21740 !! html
21741 <p>xy
21742 </p>
21743 !! end
21744
21745 !! test
21746 Strip marker in uc
21747 !! wikitext
21748 {{uc:x<nowiki/>y}}
21749 !! html
21750 <p>XY
21751 </p>
21752 !! end
21753
21754 !! test
21755 Strip marker in formatNum
21756 !! wikitext
21757 {{formatnum:1<nowiki/>2}}
21758 {{formatnum:1<nowiki/>2|R}}
21759 !! html
21760 <p>12
21761 12
21762 </p>
21763 !! end
21764
21765 !! test
21766 Check noCommafy in formatNum
21767 !! options
21768 language=be-tarask
21769 !! wikitext
21770 {{formatnum:123456.78}}
21771 {{formatnum:123456.78|NOSEP}}
21772 !! html
21773 <p>123 456,78
21774 123456.78
21775 </p>
21776 !! end
21777
21778 !! test
21779 Wrong option for formatNum (bug 56199)
21780 !! wikitext
21781 {{formatnum:1,234.56|Random}}
21782 {{formatnum:1,234.56|EVERYTHING}}
21783 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
21784 !! html
21785 <p>1,234.56
21786 1,234.56
21787 1,234.56
21788 </p>
21789 !! end
21790
21791 !! test
21792 Strip marker in grammar
21793 !! options
21794 language=fi
21795 !! wikitext
21796 {{grammar:elative|foo<nowiki/>bar}}
21797 !! html
21798 <p>foobarista
21799 </p>
21800 !! end
21801
21802 !! test
21803 Strip marker in padleft
21804 !! wikitext
21805 {{padleft:|2|x<nowiki/>y}}
21806 !! html
21807 <p>xy
21808 </p>
21809 !! end
21810
21811 !! test
21812 Strip marker in padright
21813 !! wikitext
21814 {{padright:|2|x<nowiki/>y}}
21815 !! html
21816 <p>xy
21817 </p>
21818 !! end
21819
21820 !! test
21821 Strip marker in anchorencode
21822 !! wikitext
21823 {{anchorencode:x<nowiki/>y}}
21824 !! html
21825 <p>xy
21826 </p>
21827 !! end
21828
21829 !! test
21830 nowiki inside link inside heading (bug 18295)
21831 !! wikitext
21832 ==[[foo|x<nowiki>y</nowiki>z]]==
21833 !! html
21834 <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>
21835
21836 !! end
21837
21838 !! test
21839 new support for bdi element (bug 31817)
21840 !! wikitext
21841 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21842 !! html
21843 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21844
21845 !!end
21846
21847 !! test
21848 Ignore pipe between table row attributes
21849 !! wikitext
21850 {|
21851 | quux
21852 |- id=foo | style='color: red'
21853 | bar
21854 |}
21855 !! html
21856 <table>
21857 <tr>
21858 <td> quux
21859 </td></tr>
21860 <tr id="foo" style="color: red">
21861 <td> bar
21862 </td></tr></table>
21863
21864 !! end
21865
21866 !!test
21867 Gallery override link with WikiLink (bug 34852)
21868 !! wikitext
21869 <gallery>
21870 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
21871 </gallery>
21872 !! html
21873 <ul class="gallery mw-gallery-traditional">
21874 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21875 <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>
21876 <div class="gallerytext">
21877 <p>caption
21878 </p>
21879 </div>
21880 </div></li>
21881 </ul>
21882
21883 !! end
21884
21885 !!test
21886 Gallery override link with absolute external link (bug 34852)
21887 !! wikitext
21888 <gallery>
21889 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21890 </gallery>
21891 !! html
21892 <ul class="gallery mw-gallery-traditional">
21893 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21894 <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>
21895 <div class="gallerytext">
21896 <p>caption
21897 </p>
21898 </div>
21899 </div></li>
21900 </ul>
21901
21902 !! end
21903
21904 !!test
21905 Gallery override link with malicious javascript (bug 34852)
21906 !! wikitext
21907 <gallery>
21908 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21909 </gallery>
21910 !! html
21911 <ul class="gallery mw-gallery-traditional">
21912 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21913 <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>
21914 <div class="gallerytext">
21915 <p>caption
21916 </p>
21917 </div>
21918 </div></li>
21919 </ul>
21920
21921 !! end
21922
21923 !!test
21924 Gallery with invalid title as link (bug 43964)
21925 !! wikitext
21926 <gallery>
21927 File:foobar.jpg|link=<
21928 </gallery>
21929 !! html
21930 <ul class="gallery mw-gallery-traditional">
21931 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21932 <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>
21933 <div class="gallerytext">
21934 </div>
21935 </div></li>
21936 </ul>
21937
21938 !! end
21939
21940 !!test
21941 Language parser function
21942 !! wikitext
21943 {{#language:ar}}
21944 !! html
21945 <p>العربية
21946 </p>
21947 !! end
21948
21949 !!test
21950 Padleft and padright as substr
21951 !! wikitext
21952 {{padleft:|3|abcde}}
21953 {{padright:|3|abcde}}
21954 !! html
21955 <p>abc
21956 abc
21957 </p>
21958 !! end
21959
21960 !!test
21961 Special parser function
21962 !! wikitext
21963 {{#special:RandomPage}}
21964 {{#special:BaDtItLe}}
21965 {{#special:Foobar}}
21966 !! html
21967 <p>Special:Random
21968 Special:Badtitle
21969 Special:Foobar
21970 </p>
21971 !! end
21972
21973 !!test
21974 Bug 34939 - Case insensitive link parsing ([HttP://])
21975 !! wikitext
21976 [HttP://MediaWiki.Org/]
21977 !! html/php
21978 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
21979 </p>
21980 !! html/parsoid
21981 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
21982 !! end
21983
21984 !!test
21985 Bug 34939 - Case insensitive link parsing ([HttP:// title])
21986 !! wikitext
21987 [HttP://MediaWiki.Org/ MediaWiki]
21988 !! html
21989 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
21990 </p>
21991 !! end
21992
21993 !!test
21994 Bug 34939 - Case insensitive link parsing (HttP://)
21995 !! wikitext
21996 HttP://MediaWiki.Org/
21997 !! html/php
21998 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
21999 </p>
22000 !! html/parsoid
22001 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
22002 !! end
22003
22004 !!test
22005 Disable TOC
22006 !! options
22007 notoc
22008 !! wikitext
22009 Lead
22010 == Section 1 ==
22011 == Section 2 ==
22012 == Section 3 ==
22013 == Section 4 ==
22014 == Section 5 ==
22015 !! html
22016 <p>Lead
22017 </p>
22018
22019 <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>
22020 <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>
22021 <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>
22022 <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>
22023 <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>
22024
22025 !! end
22026
22027
22028 ###
22029 ### Parsoid-specific tests
22030 ### Parsoid-PHP parser incompatibilities
22031 ###
22032 !!test
22033 1. SOL-sensitive wikitext tokens as template-args
22034 !!options
22035 parsoid=wt2html,wt2wt
22036 !! wikitext
22037 {{echo|*a}}
22038 {{echo|#a}}
22039 {{echo|:a}}
22040 !! html
22041 <span about="#mwt1" typeof="mw:Transclusion">
22042 </span><ul about="#mwt1"><li>a</li>
22043 </ul>
22044 <span about="#mwt2" typeof="mw:Transclusion">
22045 </span><ol about="#mwt2"><li>a</li>
22046 </ol>
22047 <span about="#mwt3" typeof="mw:Transclusion">
22048 </span><dl about="#mwt3"><dd>a</dd>
22049 </dl>
22050 !!end
22051
22052 #### -----------------------------------------------------------------
22053 #### Parsoid-specific functionality tests
22054 #### -----------------------------------------------------------------
22055
22056 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
22057 # We know wt2wt will fail, but we expect selser to pass.
22058 # Due to the nature of our testing, wt2wt and selser tests will enter the
22059 # blacklist and we'll catch selser regressions based on changes to the
22060 # blacklist entries for selser tests.
22061 !! test
22062 1. Bad treebuilder fixup of formatting elt is cleaned up
22063 !! options
22064 parsoid=wt2html,wt2wt
22065 !! wikitext
22066 {|
22067 |
22068 <small>
22069 [[Image:Foobar.jpg|right|Test]]
22070 </small>
22071 |}
22072 !! html/parsoid
22073 <table>
22074 <tbody><tr><td>
22075 <small>
22076 <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>
22077 </small>
22078 </td></tr>
22079 </tbody></table>
22080 !! end
22081
22082 !! test
22083 2. Bad treebuilder fixup of formatting elt is cleaned up
22084 !! options
22085 parsoid=wt2html,wt2wt
22086 !! wikitext
22087 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
22088
22089 <small>[[Image:Foobar.jpg|right|300px]]</small>
22090 !! html/parsoid
22091
22092 <p><b>foo</b></p>
22093 <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>
22094 <p><b>bar</b></p>
22095 <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>
22096 !! end
22097
22098 !! test
22099 3. Bad treebuilder fixup of formatting elt is cleaned up
22100 !! options
22101 parsoid=wt2html,wt2wt
22102 !! wikitext
22103 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
22104 !! html/parsoid
22105 <p><small><b>foo</b></small></p>
22106 <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>
22107 <p><small><b>bar</b></small></p>
22108 !! end
22109
22110 !! test
22111 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
22112 !! options
22113 parsoid=wt2html,wt2wt
22114 !! wikitext
22115 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
22116 !! html/parsoid
22117 <p><b><small></small></b></p>
22118 <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>
22119 <p></p>
22120 !! end
22121
22122 #### ----------------------------------------------------------------
22123 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
22124 #### tags. Parsoid's output for these tags differs from that of the
22125 #### PHP parser.
22126 #### ----------------------------------------------------------------
22127
22128 !!test
22129 Ref: 1. ref-location should be replaced with an index span
22130 !! wikitext
22131 A <ref>foo</ref>
22132 B <ref name="x">foo</ref>
22133 C <ref name="y" />
22134 <references />
22135 !! html/parsoid
22136 <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>
22137 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>
22138 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>
22139 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22140 <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>
22141 <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>
22142 <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>
22143 </ol>
22144 !!end
22145
22146 !!test
22147 Ref: 2. ref-tags with identical names should all get the same index
22148 !! wikitext
22149 A <ref name="x">foo</ref>
22150 B <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></p>
22155 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22156 <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>
22157 </ol>
22158 !!end
22159
22160 !!test
22161 Ref: 3. spaces in ref-names should be ignored
22162 !! wikitext
22163 A <ref name="x">foo</ref>
22164 B <ref name=" x " />
22165 C <ref name= x />
22166 <references />
22167 !! html/parsoid
22168 <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>
22169 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>
22170 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>
22171 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22172 <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>
22173 </ol>
22174 !!end
22175
22176 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
22177 !!test
22178 Ref: 4. 'constructor' should be accepted as a valid ref-name
22179 !! wikitext
22180 A <ref name="constructor">foo</ref>
22181 <references />
22182 !! html/parsoid
22183 <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>
22184 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22185 <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>
22186 </ol>
22187 !!end
22188
22189 !!test
22190 Ref: 5. body should accept generic wikitext
22191 !! wikitext
22192 A <ref>
22193 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
22194 </ref>
22195
22196 <references />
22197 !! html/parsoid
22198 <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>
22199
22200 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22201 <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>
22202 </span></li>
22203 </ol>
22204 !!end
22205
22206 !!test
22207 Ref: 6. indent-pres should not be output in ref-body
22208 !! wikitext
22209 A <ref>
22210 foo
22211 bar
22212 baz
22213 </ref>
22214
22215 <references />
22216 !! html/parsoid
22217 <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>
22218
22219 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22220 <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
22221 bar
22222 baz
22223 </span></li>
22224 </ol>
22225 !!end
22226
22227 !!test
22228 Ref: 7. No p-wrapping in ref-body
22229 !! wikitext
22230 A <ref>
22231 foo
22232
22233 bar
22234
22235
22236 baz
22237
22238
22239
22240 booz
22241 </ref>
22242
22243 <references />
22244 !! html/parsoid
22245 <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>
22246
22247 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22248 <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
22249
22250 bar
22251
22252
22253 baz
22254
22255
22256
22257 booz
22258 </span></li>
22259 </ol>
22260 !!end
22261
22262 !!test
22263 Ref: 8. transclusion wikitext has lower precedence
22264 !! wikitext
22265 A <ref> foo {{echo|</ref> B C}}
22266
22267 <references />
22268 !! html/parsoid
22269 <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>
22270 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22271 <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>
22272 </ol>
22273 !!end
22274
22275 !!test
22276 Ref: 9. unclosed comments should not leak out of ref-body
22277 !! wikitext
22278 A <ref> foo <!--</ref> B C
22279 <references />
22280 !! html/parsoid
22281 <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>
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">foo <!----></span></li>
22284 </ol>
22285 !!end
22286
22287 !!test
22288 Ref: 10. Unclosed HTML tags should not leak out of ref-body
22289 !! wikitext
22290 A <ref> <b> foo </ref> B C
22291
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 C</p>
22295
22296
22297 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22298 <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>
22299 </ol>
22300 !!end
22301
22302 !!test
22303 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
22304 !! wikitext
22305 A <ref>foo</ref> B
22306 C <ref>bar</ref> D
22307 <references />
22308 !! html/parsoid
22309 <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
22310 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>
22311 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22312 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
22313 <li about="#cite_note-2" id="cite_note-2"><a href="#cite_ref-2" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-2" class="mw-reference-text">bar</span></li>
22314 </ol>
22315 !!end
22316
22317 !!test
22318 Ref: 12. ref-tags act as trailing newline migration barrier
22319 !! wikitext
22320 <!--the newline at the end of this line moves out of the p tag-->a
22321
22322 b<!--the newline at the end of this line stays inside the p tag--> <ref />
22323 <ref />
22324
22325 c
22326 <references />
22327 !! html/parsoid
22328 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
22329
22330
22331 <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>
22332 <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>
22333
22334 <p>c</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"></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"></span></li></ol>
22338 !!end
22339
22340 !!test
22341 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
22342 !! wikitext
22343 <ref>foo</ref> A
22344 <ref>bar
22345 </ref> B
22346 <references />
22347 !! html/parsoid
22348 <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
22349 <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>
22350 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22351 <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>
22352 <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
22353 </span></li>
22354 </ol>
22355 !!end
22356
22357 !!test
22358 Ref: 14. A nested ref-tag should be emitted as plain text
22359 !! wikitext
22360 <ref>foo <ref>bar</ref> baz</ref>
22361
22362 <references />
22363 !! html/parsoid
22364 <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>
22365 </p>
22366 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22367 <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>
22368 </ol>
22369 !!end
22370
22371 !!test
22372 Ref: 15. ref-tags with identical names should get identical indexes
22373 !! wikitext
22374 A1 <ref name="a">foo</ref> A2 <ref name="a" />
22375 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
22376
22377 <references />
22378 !! html/parsoid
22379 <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>
22380 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>
22381
22382 <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>
22383 </ol>
22384 !!end
22385
22386 ## We don't bother wt2wt-ing non-standard whitespace
22387 !!test
22388 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
22389 !!options
22390 parsoid=wt2html
22391 !! wikitext
22392 A <ref >foo</ref >
22393
22394 <references />
22395 !! html/parsoid
22396 <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>
22397 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22398 <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>
22399 !!end
22400
22401 !!test
22402 Ref: 17. Generate valid HTML5 id/about attributes
22403 !!wikitext
22404 <ref name="a b">foo</ref>
22405
22406 <references />
22407 !!html/parsoid
22408 <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>
22409 </p>
22410
22411 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22412 <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>
22413 </ol>
22414 !!end
22415
22416 !!test
22417 Ref: 18. T58916: Extension attributes should be parsed as plain text
22418 !!wikitext
22419 <ref name="{{echo|a}}">foo</ref>
22420
22421 <references />
22422 !!html/parsoid
22423 <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>
22424 </p>
22425
22426 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22427 <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>
22428 </ol>
22429 !!end
22430
22431 !!test
22432 Ref: 19. ref-tags with identical name encodings should get identical indexes
22433 !! wikitext
22434 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
22435
22436 <references />
22437 !! html/parsoid
22438 <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>
22439 </p>
22440 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22441 <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>
22442 </ol>
22443 !!end
22444
22445 !!test
22446 Ref: 20. ref-tags with identical names but different content should keep it
22447 !! wikitext
22448 A <ref name="foo">Foo one</ref>
22449 B <ref name="foo">Foo two</ref>
22450 C <ref name="foo" />
22451
22452 <references />
22453 !! html/parsoid
22454 <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>
22455 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>
22456 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>
22457
22458 <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>
22459 </ol>
22460 !!end
22461
22462 !!test
22463 References: 1. references tag without any refs should be handled properly
22464 !! wikitext
22465 <references />
22466 !! html/parsoid
22467 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22468 !!end
22469
22470 !!test
22471 References: 2. references tag with group only outputs references from that group
22472 !! wikitext
22473 A <ref group="a">foo</ref>
22474 B <ref group="b">bar</ref>
22475 C <ref>baz</ref>
22476
22477 <references group="a" />
22478 <references />
22479 <references group="b" />
22480 !! html/parsoid
22481 <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>
22482 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>
22483 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>
22484
22485 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
22486 <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>
22487 </ol>
22488 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
22489 <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>
22490 </ol>
22491 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
22492 <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>
22493 </ol>
22494 !!end
22495
22496 !!test
22497 References: 3. ref list should be cleared after processing references
22498 !! wikitext
22499 A <ref>foo</ref>
22500
22501 <references />
22502
22503 B <ref>bar</ref>
22504
22505 <references />
22506 !! html/parsoid
22507 <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>
22508
22509 <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>
22510 </ol>
22511
22512 <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>
22513
22514 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22515 <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>
22516 </ol>
22517 !!end
22518
22519 !!test
22520 References: 4. only referenced group should be cleared after processing references
22521 !! wikitext
22522 A <ref group="a">afoo</ref>
22523 B <ref>bfoo</ref>
22524
22525 <references group="a" />
22526
22527 C <ref>cfoo</ref>
22528
22529 <references />
22530 !! html/parsoid
22531 <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>
22532 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>
22533
22534 <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>
22535 </ol>
22536
22537 <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>
22538
22539 <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>
22540 </ol>
22541 !!end
22542
22543 ## Don't expect this to rt since we're dropping content
22544 !! test
22545 References: 5. ref tags in references should be processed while ignoring all other content
22546 !! options
22547 parsoid=wt2html,html2html
22548 !! wikitext
22549 A <ref name="a" />
22550 B <ref name="b">bar</ref>
22551
22552 <references>
22553 <ref name="a">foo</ref>
22554 This should just get lost.
22555 </references>
22556 !! html/parsoid
22557 <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>
22558 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>
22559
22560
22561 <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>
22562 </ol>
22563 !! end
22564
22565 !! test
22566 References: 6. <references /> from a transclusion
22567 !! wikitext
22568 <ref>Foo</ref> {{echo|<references />}}
22569 !! html/parsoid
22570 <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>
22571 </ol>
22572 !! end
22573
22574 !! test
22575 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
22576 !! wikitext
22577 A <ref>foo bar for a</ref>
22578 B <ref group="X" name="b" />
22579
22580 <references />
22581
22582 <references group="X">
22583 <ref name="b">foo</ref>
22584 </references>
22585 !! html/parsoid
22586 <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>
22587 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>
22588 </p>
22589
22590 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22591 <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>
22592 </ol>
22593
22594 <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"}}'>
22595 <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>
22596 </ol>
22597 !! end
22598
22599 !! test
22600 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
22601 !! wikitext
22602 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
22603 <references />
22604 !! html/parsoid
22605 <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>
22606 <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>
22607 </ol>
22608 !!end
22609
22610 # This test only works in wt2html now as the <references /> are always generated
22611 # unless selser is active. Once T72722 is fixed, we should add a changes test
22612 # here to ensure that unrelated changes don't add the new <references />
22613 # when selser is active.
22614 !! test
22615 References: 9. Generate missing references list at the end
22616 !! wikitext
22617 A <ref>foo</ref>
22618 B <ref group="inexistent">bar</ref>
22619 !! html/parsoid
22620 <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>
22621 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'>
22622 <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>
22623 </ol>
22624 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"},"autoGenerated":true}'>
22625 <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>
22626 </ol>
22627 !! end
22628
22629 !! test
22630 References: 10. New <references/> shouldn't be added for unrelated edits.
22631 !! options
22632 parsoid={
22633 "modes": ["selser"],
22634 "changes": [["#x", "remove"]],
22635 "selser": "noauto"
22636 }
22637 !! wikitext
22638 Unrelated text<span id="x"> that's going to disappear</span>.
22639 A <ref>foo</ref>
22640 !! wikitext/edited
22641 Unrelated text.
22642 A <ref>foo</ref>
22643 !!end
22644
22645 !! test
22646 Entities in ref name
22647 !! wikitext
22648 <ref name="test &amp; me">hi</ref>
22649 <references />
22650 !! html/parsoid
22651 <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>
22652 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22653 <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>
22654 </ol>
22655 !! end
22656
22657 ## The output here may look funny, but it's what the php parser will do. The
22658 ## unclosed references tag becomes escaped text, and then a new references
22659 ## tag is auto-generated. The test is wt2html only because it roundtrips with
22660 ## nowiki tags, and the auto-generated references tag is only dropped in
22661 ## rtTestMode.
22662 !! test
22663 Generate references for unclosed references tag
22664 !! options
22665 parsoid=wt2html
22666 !! wikitext
22667 a<ref>foo</ref>
22668
22669 <references>
22670 !! html/parsoid
22671 <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>
22672
22673 <p>&lt;references></p>
22674 <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>
22675 !! end
22676
22677 !! test
22678 New reference serializes on its own line
22679 !! options
22680 parsoid=wt2wt,html2wt
22681 !! wikitext
22682 foo
22683 <references />
22684 !! html/parsoid
22685 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22686 !! end
22687
22688 #### ----------------------------------------------------------------
22689 #### Parsoid-only testing of Parsoid's impl of LST
22690 #### Not implemented yet, see
22691 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
22692 #### ----------------------------------------------------------------
22693
22694 !! test
22695 LST Sections: 1. Simple section start and end
22696 !! options
22697 parsoid={ "suppressErrors": true }
22698 !! wikitext
22699 <section begin="2011-05-16" />
22700 <section end="2014-04-10 (MW 1.23wmf22)" />
22701 !! html/parsoid
22702 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
22703 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
22704 !! end
22705
22706 #--------- Test stripping of empty nodes in template content ----------
22707 !!test
22708 Empty LI and TR nodes should be stripped from template content
22709 !!wikitext
22710 {{EmptyLITest}}
22711 {{EmptyTRTest}}
22712 !!html/parsoid
22713 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
22714 <li>a</li>
22715 <li>b</li>
22716 </ul>
22717 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
22718 <tbody>
22719 <tr>
22720 <td>foo</td>
22721 </tr>
22722 <tr>
22723 <td>bar</td>
22724 </tr>
22725 </tbody>
22726 </table>
22727 !!end
22728
22729 !!test
22730 Empty LI and TR nodes should not be stripped from top-level content
22731 !!wikitext
22732 * a
22733 *
22734 * b
22735 {|
22736 |-
22737 |-
22738 |foo
22739 |}
22740 !!html/parsoid
22741 <ul>
22742 <li> a</li>
22743 <li></li>
22744 <li> b</li>
22745 </ul>
22746 <table>
22747 <tbody>
22748 <tr></tr>
22749 <tr>
22750 <td>foo</td>
22751 </tr>
22752 </tbody>
22753 </table>
22754 !!end
22755
22756 !!test
22757 Empty TR nodes should not be stripped if they have any attributes set
22758 !!wikitext
22759 {{EmptyTRWithHTMLAttrTest}}
22760 !!html/parsoid
22761 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
22762 <tr align="center"></tr>
22763 <tr><td>foo</td></tr>
22764 <tr align="center"></tr>
22765 <tr><td>bar</td></tr>
22766 </table>
22767 !!end
22768
22769 #### ----------------------------------------------------------------
22770 #### The following section of tests are primarily to test
22771 #### wikitext escaping capabilities of Parsoid. Given that
22772 #### escaping can be done any number of ways, the wikitext (input)
22773 #### is always adjusted to reflect how Parsoid adds nowiki
22774 #### escape tags.
22775 ####
22776 #### We are marking several tests as parsoid-only since the
22777 #### HTML in the result section is different from what the
22778 #### PHP parser generates for it.
22779 #### ----------------------------------------------------------------
22780
22781
22782 #### --------------- Headings ---------------
22783 #### 0. Unnested
22784 #### 1. Nested inside html <h1>=foo=</h1>
22785 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
22786 #### 3. Nested inside html with wikitext split by html tags
22787 #### 4. No escape needed
22788 #### 5. Empty headings <h1></h1>
22789 #### 6. Heading chars in SOL context
22790 #### ----------------------------------------
22791 !! test
22792 Headings: 0. Unnested
22793 !! options
22794 parsoid=html2wt
22795 !! html/parsoid
22796 <p>=foo=</p>
22797
22798 <p> =foo=
22799 <!--cmt-->
22800 =foo=</p>
22801
22802 <p>=foo<i>a</i>=</p>
22803 !! wikitext
22804 <nowiki>=foo=</nowiki>
22805
22806 <nowiki> </nowiki>=foo=
22807 <!--cmt-->
22808 <nowiki>=foo=</nowiki>
22809
22810 =foo''a''<nowiki>=</nowiki>
22811 !!end
22812
22813 # New headings and existing headings are handled differently
22814 !! test
22815 Headings: 1. Nested inside html
22816 !! options
22817 parsoid=html2wt
22818 !! html/parsoid
22819 <h1>=foo=</h1>
22820 <h2>=foo=</h2>
22821 <h3>=foo=</h3>
22822
22823 <h1 data-parsoid=''>=foo=</h1>
22824 <h2 data-parsoid=''>=foo=</h2>
22825 <h3 data-parsoid=''>=foo=</h3>
22826 <h4 data-parsoid=''>=foo=</h4>
22827 <h5 data-parsoid=''>=foo=</h5>
22828 <h6 data-parsoid=''>=foo=</h6>
22829 !! wikitext
22830 = =foo= =
22831
22832 == =foo= ==
22833
22834 === =foo= ===
22835
22836 =<nowiki>=foo=</nowiki>=
22837 ==<nowiki>=foo=</nowiki>==
22838 ===<nowiki>=foo=</nowiki>===
22839 ====<nowiki>=foo=</nowiki>====
22840 =====<nowiki>=foo=</nowiki>=====
22841 ======<nowiki>=foo=</nowiki>======
22842
22843 !!end
22844
22845 !! test
22846 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
22847 !! options
22848 parsoid=html2wt
22849 !! html/parsoid
22850 <h1>foo</h1>*bar
22851 <h1>foo</h1>=bar
22852 <h1>foo</h1>=bar=
22853 !! wikitext
22854 = foo =
22855 <nowiki>*</nowiki>bar
22856
22857 = foo =
22858 =bar
22859
22860 = foo =
22861 <nowiki>=bar=</nowiki>
22862 !!end
22863
22864 !! test
22865 Headings: 3. Nested inside html with wikitext split by html tags
22866 !! options
22867 parsoid=html2wt
22868 !! html/parsoid
22869 <h1>=<b>bold</b>foo=</h1>
22870 !! wikitext
22871 = ='''bold'''foo= =
22872 !!end
22873
22874 !! test
22875 Headings: 4a. No escaping needed (testing just h1 and h2)
22876 !! options
22877 parsoid=html2wt
22878 !! html/parsoid
22879 <h1>=foo</h1>
22880 <h1>foo=</h1>
22881 <h1> =foo= </h1>
22882 <h1>=foo= bar</h1>
22883 <h2>=foo</h2>
22884 <h2>foo=</h2>
22885 <h1>=</h1>
22886 <h1><i>=</i>foo=</h1>
22887 !! wikitext
22888 = =foo =
22889
22890 = foo= =
22891
22892 = =foo= =
22893
22894 = =foo= bar =
22895
22896 == =foo ==
22897
22898 == foo= ==
22899
22900 = = =
22901
22902 = ''=''foo= =
22903 !!end
22904
22905 !! test
22906 Headings: 4b. No escaping needed (inside p-tags)
22907 !! options
22908 parsoid=html2wt
22909 !! html/parsoid
22910 <p>===
22911 =foo= x
22912 =foo= <s></s>
22913 </p>
22914 !! wikitext
22915 ===
22916 =foo= x
22917 =foo= <s></s>
22918 !!end
22919
22920 !! test
22921 Headings: 5. Empty headings
22922 !! options
22923 parsoid=html2wt
22924 !! html/parsoid
22925 <h1 data-parsoid='{}'></h1>
22926
22927 <h2 data-parsoid='{}'></h2>
22928
22929 <h3 data-parsoid='{}'></h3>
22930
22931 <h4 data-parsoid='{}'></h4>
22932
22933 <h5 data-parsoid='{}'></h5>
22934
22935 <h6 data-parsoid='{}'></h6>
22936 !! wikitext
22937 =<nowiki/>=
22938
22939 ==<nowiki/>==
22940
22941 ===<nowiki/>===
22942
22943 ====<nowiki/>====
22944
22945 =====<nowiki/>=====
22946
22947 ======<nowiki/>======
22948 !!end
22949
22950 !! test
22951 Headings: 6a. Heading chars in SOL context (with trailing spaces)
22952 !! options
22953 parsoid=html2wt
22954 !! html/parsoid
22955 <p>=a=</p>
22956
22957 <p>=a=</p>
22958
22959 <p>=a=</p>
22960 !! wikitext
22961 <nowiki>=a=</nowiki>
22962
22963 <nowiki>=a=</nowiki>
22964
22965 <nowiki>=a=</nowiki>
22966 !!end
22967
22968 !! test
22969 Headings: 6b. Heading chars in SOL context (with trailing newlines)
22970 !! options
22971 parsoid=html2wt
22972 !! html/parsoid
22973 <p>=a=
22974 b</p>
22975
22976 <p>=a=
22977 b</p>
22978
22979 <p>=a=
22980 b</p>
22981 !! wikitext
22982 <nowiki>=a=</nowiki>
22983 b
22984
22985 <nowiki>=a=</nowiki>
22986 b
22987
22988 <nowiki>=a=</nowiki>
22989 b
22990 !!end
22991
22992 !! test
22993 Headings: 6c. Heading chars in SOL context (leading newline break)
22994 !! options
22995 parsoid=html2wt
22996 !! html/parsoid
22997 <p>a
22998 =b=</p>
22999 !! wikitext
23000 a
23001 <nowiki>=b=</nowiki>
23002 !!end
23003
23004 !! test
23005 Headings: 6d. Heading chars in SOL context (with interspersed comments)
23006 !! options
23007 parsoid=html2wt
23008 !! html/parsoid
23009 <!--c0--><p>=a=</p>
23010
23011 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
23012 !! wikitext
23013 <!--c0--><nowiki>=a=</nowiki>
23014
23015 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
23016 !!end
23017
23018 !! test
23019 Headings: 6d. Heading chars in SOL context (No escaping needed)
23020 !! options
23021 parsoid=html2wt
23022 !! html/parsoid
23023 =a=<div>b</div>
23024 !! wikitext
23025 =a=<div>b</div>
23026 !!end
23027
23028 !! test
23029 Headings: 7. Insert a newline between new content and headings
23030 !! options
23031 parsoid=html2wt
23032 !! html/parsoid
23033 <h2>NEW</h2>
23034 <p>new</p>
23035 <h2 data-parsoid='{}'>A</h2>
23036 <p data-parsoid='{}'>a</p>
23037 !! wikitext
23038 == NEW ==
23039 new
23040
23041 ==A==
23042 a
23043
23044 !! end
23045
23046 #### --------------- Lists ---------------
23047 #### 0. Outside nests (*foo, etc.)
23048 #### 1. Nested inside html <ul><li>*foo</li></ul>
23049 #### 2. Inside definition lists
23050 #### 3. Only bullets at start should be escaped
23051 #### 4. No escapes needed
23052 #### 5. No unnecessary escapes
23053 #### 6. Escape bullets in SOL position
23054 #### 7. Escape bullets in a multi-line context
23055 #### ----------------------------------------
23056
23057 !! test
23058 Lists: 0. Outside nests
23059 !! options
23060 parsoid=html2wt
23061 !! html/parsoid
23062 <p>*foo</p>
23063
23064 <p>#foo</p>
23065
23066 <p>;Foo:bar</p>
23067 !! wikitext
23068 <nowiki>*</nowiki>foo
23069
23070 <nowiki>#</nowiki>foo
23071
23072 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
23073 !!end
23074
23075 ## Making these next 3 tests Parsoid-only since they are html2wt tests
23076 ## to test wikitext escaping, and insignificant whitespace diffs
23077 ## cause PHP parser tests to barf
23078 !! test
23079 Lists: 1. Nested inside html (No unnecessary escapes)
23080 !! options
23081 parsoid=html2wt
23082 !! html/parsoid
23083 <ul>
23084 <li>*foo</li>
23085 <li>#foo</li>
23086 <li>:foo</li>
23087 <li>;foo</li>
23088 <li data-parsoid='{}'>*foo</li>
23089 <li data-parsoid='{}'>#foo</li>
23090 <li data-parsoid='{}'>:foo</li>
23091 <li data-parsoid='{}'>;foo</li>
23092 </ul>
23093
23094 <ol>
23095 <li>*foo</li>
23096 <li>#foo</li>
23097 <li>:foo</li>
23098 <li>;foo</li>
23099 <li data-parsoid='{}'>*foo</li>
23100 <li data-parsoid='{}'>#foo</li>
23101 <li data-parsoid='{}'>:foo</li>
23102 <li data-parsoid='{}'>;foo</li>
23103 </ol>
23104 !! wikitext
23105 * *foo
23106 * #foo
23107 * :foo
23108 * ;foo
23109 *<nowiki>*foo</nowiki>
23110 *<nowiki>#foo</nowiki>
23111 *<nowiki>:foo</nowiki>
23112 *<nowiki>;foo</nowiki>
23113
23114 # *foo
23115 # #foo
23116 # :foo
23117 # ;foo
23118 #<nowiki>*foo</nowiki>
23119 #<nowiki>#foo</nowiki>
23120 #<nowiki>:foo</nowiki>
23121 #<nowiki>;foo</nowiki>
23122 !!end
23123
23124 !! test
23125 Lists: 2. Inside definition lists
23126 !! options
23127 parsoid=html2wt
23128 !! html/parsoid
23129 <dl><dt>;foo</dt></dl>
23130 <dl><dt>:foo</dt></dl>
23131 <dl><dt>:foo</dt>
23132 <dd>bar</dd></dl>
23133 <dl><dd>:foo</dd></dl>
23134 !! wikitext
23135 ; ;foo
23136
23137 ; <nowiki>:foo</nowiki>
23138
23139 ; <nowiki>:foo</nowiki>
23140 : bar
23141
23142 : :foo
23143 !!end
23144
23145 !! test
23146 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
23147 !! options
23148 parsoid=html2wt
23149 !! html/parsoid
23150 <ul>
23151 <li>*foo*bar</li>
23152 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
23153 </ul>
23154 !! wikitext
23155 * *foo*bar
23156 *<nowiki>*foo</nowiki>''it''*bar
23157 !!end
23158
23159 !! test
23160 Lists: 4. No escapes needed
23161 !! options
23162 parsoid=html2wt
23163 !! html/parsoid
23164 <ul>
23165 <li>foo*bar
23166 </li>
23167 </ul>
23168 <ul>
23169 <li><i>foo</i>*bar
23170 </li>
23171 </ul>
23172 <ul>
23173 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
23174 </li>
23175 </ul>
23176 <ul>
23177 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
23178 </li>
23179 </ul>
23180 !! wikitext
23181 *foo*bar
23182
23183 *''foo''*bar
23184
23185 *[[Foo]]: bar
23186
23187 *[[Foo]]*bar
23188 !!end
23189
23190 !! test
23191 Lists: 5. No unnecessary escapes
23192 !! options
23193 parsoid=html2wt
23194 !! html/parsoid
23195 <ul><li> bar <span>[[foo]]</span></li></ul>
23196 <ul><li> =bar <span>[[foo]]</span></li></ul>
23197 <ul><li> [[bar <span>[[foo]]</span></li></ul>
23198 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
23199 <ul><li> =bar <span>foo]]</span>=</li></ul>
23200 <ul><li> <s></s>: a</li></ul>
23201 <ul><li> <i>* foo</i></li></ul>
23202
23203 !! wikitext
23204 * bar <span><nowiki>[[foo]]</nowiki></span>
23205
23206 * =bar <span><nowiki>[[foo]]</nowiki></span>
23207
23208 * [[bar <span><nowiki>[[foo]]</nowiki></span>
23209
23210 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
23211
23212 * =bar <span>foo]]</span>=
23213
23214 * <s></s>: a
23215
23216 * ''* foo''
23217 !!end
23218
23219 !! test
23220 Lists: 6. Escape bullets in SOL position
23221 !! options
23222 parsoid=html2wt
23223 !! html/parsoid
23224 <p><!--cmt-->*foo</p>
23225 !! wikitext
23226 <!--cmt--><nowiki>*</nowiki>foo
23227 !!end
23228
23229 !! test
23230 Lists: 7. Escape bullets in a multi-line context
23231 !! options
23232 parsoid=html2wt
23233 !! html/parsoid
23234 <p>a
23235 *b
23236 </p>
23237 !! wikitext
23238 a
23239 <nowiki>*</nowiki>b
23240 !!end
23241
23242 !! test
23243 Lists: 8. Escape colons only if not present in tags
23244 !! options
23245 parsoid=html2wt
23246 !! html/parsoid
23247 <dl><dt>a:b<i>c:d</i></dt></dl>
23248 !! wikitext
23249 ; <nowiki>a:b</nowiki>''c:d''
23250 !! end
23251
23252 #### --------------- HRs ---------------
23253 #### 1. Single line
23254 #### -----------------------------------
23255
23256 !! test
23257 HRs: 1. Single line
23258 !! options
23259 parsoid=html2wt
23260 !! html/parsoid
23261 <hr />----
23262 <hr />=foo=
23263 <hr />*foo
23264 !! wikitext
23265 ----<nowiki>----</nowiki>
23266 ----=foo=
23267 ----*foo
23268 !! end
23269
23270 #### --------------- Tables ---------------
23271 #### 1a. Simple example
23272 #### 1b. No escaping needed (!foo)
23273 #### 1c. No escaping needed (|foo)
23274 #### 1d. No escaping needed (|}foo)
23275 ####
23276 #### 2a. Nested in td (<td>foo|bar</td>)
23277 #### 2b. Nested in td (<td>foo||bar</td>)
23278 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
23279 ####
23280 #### 3a. Nested in th (<th>foo!bar</th>)
23281 #### 3b. Nested in th (<th>foo!!bar</th>)
23282 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
23283 ####
23284 #### 4a. Escape -
23285 #### 4b. Escape +
23286 #### 4c. No escaping needed
23287 #### --------------------------------------
23288
23289 !! test
23290 Tables: 1a. Simple example
23291 !! options
23292 parsoid=html2wt
23293 !! html/parsoid
23294 <p>{|
23295 |}
23296 </p>
23297 !! wikitext
23298 <nowiki>{|</nowiki>
23299 |}
23300 !! end
23301
23302 !! test
23303 Tables: 1b. No escaping needed
23304 !! options
23305 parsoid=html2wt
23306 !! html/parsoid
23307 <p>!foo
23308 </p>
23309 !! wikitext
23310 !foo
23311 !! end
23312
23313 !! test
23314 Tables: 1c. No escaping needed
23315 !! options
23316 parsoid=html2wt
23317 !! html/parsoid
23318 <p>|foo
23319 </p>
23320 !! wikitext
23321 |foo
23322 !! end
23323
23324 !! test
23325 Tables: 1d. No escaping needed
23326 !! options
23327 parsoid=html2wt
23328 !! html/parsoid
23329 <p>|}foo
23330 </p>
23331 !! wikitext
23332 |}foo
23333 !! end
23334
23335 !! test
23336 Tables: 2a. Nested in td
23337 !! options
23338 parsoid=html2wt
23339 !! html/parsoid
23340 <table><tbody><tr>
23341 <td>foo|bar</td></tr>
23342 <tr><td>x<div>a|b</div></td>
23343 </tbody></table>
23344 !! wikitext
23345 {|
23346 |<nowiki>foo|bar</nowiki>
23347 |-
23348 |x<div><nowiki>a|b</nowiki></div>
23349 |}
23350 !! html/php+tidy
23351 <table>
23352 <tr>
23353 <td>foo|bar</td>
23354 </tr>
23355 <tr>
23356 <td>x
23357 <div>a|b</div>
23358 </td>
23359 </tr>
23360 </table>
23361 !! end
23362
23363 !! test
23364 Tables: 2b. Nested in td
23365 !! options
23366 parsoid=html2wt
23367 !! html/parsoid
23368 <table><tbody><tr>
23369 <td>foo||bar</td>
23370 <td>a<i>b||c</i></td>
23371 <td>a<i><div>b||c</div></i></td>
23372 </tr></tbody></table>
23373 !! wikitext
23374 {|
23375 |<nowiki>foo||bar</nowiki>
23376 |a''<nowiki>b||c</nowiki>''
23377 |a''<div><nowiki>b||c</nowiki></div>''
23378 |}
23379 !! html/php
23380 <table>
23381 <tr>
23382 <td>foo||bar
23383 </td>
23384 <td>a<i>b||c</i>
23385 </td>
23386 <td>a<i><div>b||c</div></i>
23387 </td></tr></table>
23388
23389 !! end
23390
23391 !! test
23392 Tables: 2c. Nested in td -- no escaping needed
23393 !! options
23394 parsoid=html2wt
23395 !! html/*
23396 <table>
23397 <tr>
23398 <td>foo!!bar
23399 </td></tr></table>
23400
23401 !! wikitext
23402 {|
23403 |foo!!bar
23404 |}
23405 !! end
23406
23407 !! test
23408 Tables: 3a. Nested in th
23409 !! options
23410 parsoid=html2wt
23411 !! html/*
23412 <table>
23413 <tr>
23414 <th>foo!bar
23415 </th></tr></table>
23416
23417 !! wikitext
23418 {|
23419 !foo!bar
23420 |}
23421 !! end
23422
23423 !! test
23424 Tables: 3b. Nested in th
23425 !! options
23426 parsoid=html2wt
23427 !! html/parsoid
23428 <table><tbody>
23429 <tr><th>foo!!bar</th>
23430 <th><i>foo|bar</i></th>
23431 <th><i>foo!!bar</i></th>
23432 <th><i><span>foo!!bar</span></i></th>
23433 </tr></tbody></table>
23434 !! wikitext
23435 {|
23436 !<nowiki>foo!!bar</nowiki>
23437 !''<nowiki>foo|bar</nowiki>''
23438 !''<nowiki>foo!!bar</nowiki>''
23439 !''<span><nowiki>foo!!bar</nowiki></span>''
23440 |}
23441 !! html/php
23442 <table>
23443 <tr>
23444 <th>foo!!bar
23445 </th>
23446 <th><i>foo|bar</i>
23447 </th>
23448 <th><i>foo!!bar</i>
23449 </th>
23450 <th><i><span>foo!!bar</span></i>
23451 </th></tr></table>
23452
23453 !! end
23454
23455 !! test
23456 Tables: 3c. Nested in th
23457 !! options
23458 parsoid=html2wt
23459 !! html/parsoid
23460 <table><tbody>
23461 <tr><th>foo||bar</th>
23462 <th><span typeof="mw:Nowiki">foo||bar</span></th>
23463 </tr></tbody></table>
23464 !! wikitext
23465 {|
23466 !<nowiki>foo||bar</nowiki>
23467 !<nowiki>foo||bar</nowiki>
23468 |}
23469 !! html/php
23470 <table>
23471 <tr>
23472 <th>foo||bar
23473 </th>
23474 <th>foo||bar
23475 </th></tr></table>
23476
23477 !! end
23478
23479 !! test
23480 Tables: 4a. Escape -
23481 !! options
23482 parsoid=html2wt
23483 !! html/*
23484 <table>
23485 <tr>
23486 <th>-bar
23487 </th></tr>
23488 <tr>
23489 <td>-bar
23490 </td></tr></table>
23491
23492 !! wikitext
23493 {|
23494 !-bar
23495 |-
23496 |<nowiki>-bar</nowiki>
23497 |}
23498 !! end
23499
23500 !! test
23501 Tables: 4b. Escape +
23502 !! options
23503 parsoid=html2wt
23504 !! html/*
23505 <table>
23506 <tr>
23507 <th>+bar
23508 </th></tr>
23509 <tr>
23510 <td>+bar
23511 </td></tr></table>
23512
23513 !! wikitext
23514 {|
23515 !+bar
23516 |-
23517 |<nowiki>+bar</nowiki>
23518 |}
23519 !! end
23520
23521 !! test
23522 Tables: 4c. No escaping needed
23523 !! options
23524 parsoid=html2wt
23525 !! html/parsoid
23526 <table><tbody>
23527 <tr><td>foo-bar</td><td>foo+bar</td></tr>
23528 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
23529 <tr><td>foo
23530 <p>bar|baz
23531 +bar
23532 -bar</p></td></tr>
23533 <tr><td>x
23534 <div>a|b</div></td>
23535 </tbody></table>
23536 !! wikitext
23537 {|
23538 |foo-bar
23539 |foo+bar
23540 |-
23541 |''foo''-bar
23542 |''foo''+bar
23543 |-
23544 |foo
23545 bar|baz
23546 +bar
23547 -bar
23548 |-
23549 |x
23550 <div>a|b</div>
23551 |}
23552 !! html/php
23553 <table>
23554 <tr>
23555 <td>foo-bar
23556 </td>
23557 <td>foo+bar
23558 </td></tr>
23559 <tr>
23560 <td><i>foo</i>-bar
23561 </td>
23562 <td><i>foo</i>+bar
23563 </td></tr>
23564 <tr>
23565 <td>foo
23566 <p>bar|baz
23567 +bar
23568 -bar
23569 </p>
23570 </td></tr>
23571 <tr>
23572 <td>x
23573 <div>a|b</div>
23574 </td></tr></table>
23575
23576 !! end
23577
23578 !! test
23579 Tables: 4d. No escaping needed
23580 !! options
23581 parsoid=html2wt
23582 !! html/parsoid
23583 <table>
23584 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
23585 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
23586 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
23587 </tbody></table>
23588 !! wikitext
23589 {|
23590 |[[Foo]]-bar
23591 ||+1
23592 ||-2
23593 |}
23594 !! html/php
23595 <table>
23596 <tr>
23597 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
23598 </td>
23599 <td>+1
23600 </td>
23601 <td>-2
23602 </td></tr></table>
23603
23604 !! end
23605
23606 !! test
23607 T97430: Don't emit empty nowiki pairs around marker meta tags
23608 !! options
23609 parsoid=html2wt
23610 !! html/parsoid
23611 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23612 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
23613 !! wikitext
23614 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23615 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
23616 !! end
23617
23618 !! test
23619 Unclosed xmlish element in table line shouldn't eat end delimiters
23620 !! options
23621 parsoid=html2wt
23622 !! html/parsoid
23623 <table>
23624 <tbody><tr><td> &lt;foo</td>
23625 <td> bar></td></tr>
23626 </tbody></table>
23627 !! wikitext
23628 {|
23629 | <foo
23630 | bar>
23631 |}
23632 !! html/php
23633 <table>
23634 <tr>
23635 <td> &lt;foo
23636 </td>
23637 <td> bar&gt;
23638 </td></tr></table>
23639
23640 !! end
23641
23642 #### --------------- Links ----------------
23643 #### 1. Quote marks in link text
23644 #### 2. Wikilinks: Escapes needed
23645 #### 3. Wikilinks: No escapes needed
23646 #### 4. Extlinks: Escapes needed
23647 #### 5. Extlinks: No escapes needed
23648 #### --------------------------------------
23649 !! test
23650 Links 1. WikiLinks: No escapes needed
23651 !! options
23652 parsoid=html2wt
23653 !! html/parsoid
23654 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
23655 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
23656 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
23657 !! wikitext
23658 [[Foo|Foo''boo'']]
23659 [[Foo|[Foobar]]]
23660 [[Foo|x [Foobar] x]]
23661 !! html/php
23662 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
23663 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
23664 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
23665 </p>
23666 !! end
23667
23668 !! test
23669 Links 2. WikiLinks: Escapes needed
23670 !! options
23671 parsoid=html2wt
23672 !! html/parsoid
23673 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
23674 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
23675 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
23676 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
23677 <a href="Foo" rel="mw:WikiLink">|Bar</a>
23678 <a href="Foo" rel="mw:WikiLink">]]bar</a>
23679 <a href="Foo" rel="mw:WikiLink">[[bar</a>
23680 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
23681 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
23682 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
23683 !! wikitext
23684 [[Foo|<nowiki>Foobar]</nowiki>]]
23685 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
23686 [[Foo|<nowiki>[[Bar]]</nowiki>]]
23687 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
23688 [[Foo|<nowiki>|Bar</nowiki>]]
23689 [[Foo|<nowiki>]]bar</nowiki>]]
23690 [[Foo|<nowiki>[[bar</nowiki>]]
23691 [[Foo|<nowiki>x [[ y</nowiki>]]
23692 [[Foo|<nowiki>x ]] y</nowiki>]]
23693 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
23694 !! html/php
23695 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
23696 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
23697 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
23698 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
23699 <a href="/wiki/Foo" title="Foo">|Bar</a>
23700 <a href="/wiki/Foo" title="Foo">]]bar</a>
23701 <a href="/wiki/Foo" title="Foo">[[bar</a>
23702 <a href="/wiki/Foo" title="Foo">x [[ y</a>
23703 <a href="/wiki/Foo" title="Foo">x ]] y</a>
23704 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
23705 </p>
23706 !! end
23707
23708 !! test
23709 Links 3. WikiLinks: No escapes needed
23710 !! options
23711 parsoid=html2wt
23712 !! html/parsoid
23713 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
23714 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
23715 !! wikitext
23716 [[Foo|[Foobar]]
23717 [[Foo|foo|bar]]
23718 !! html/php
23719 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
23720 <a href="/wiki/Foo" title="Foo">foo|bar</a>
23721 </p>
23722 !! end
23723
23724 !! test
23725 Links 4. ExtLinks: Escapes needed
23726 !! options
23727 parsoid=html2wt
23728 !! html/parsoid
23729 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
23730 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
23731 <p>[http://google.com]</p>
23732 <p>[http://google.com google]</p>
23733 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
23734 <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>
23735 !! wikitext
23736 [http://google.com <nowiki>[google]</nowiki>]
23737 [http://google.com <nowiki>google]</nowiki>]
23738
23739 <nowiki>[http://google.com]</nowiki>
23740
23741 <nowiki>[http://google.com google]</nowiki>
23742
23743 [http://google.com<nowiki>]</nowiki>
23744
23745 [{{echo|http://google.com}}<nowiki>]</nowiki>
23746 !! html/php
23747 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
23748 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
23749 </p><p>[http://google.com]
23750 </p><p>[http://google.com google]
23751 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23752 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23753 </p>
23754 !! end
23755
23756 !! test
23757 Links 5. ExtLinks: No escapes needed
23758 !! options
23759 parsoid=html2wt
23760 !! html/parsoid
23761 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
23762 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
23763 !! wikitext
23764 [http://google.com [google]
23765
23766 [[http://google.com]]
23767 !! html/php
23768 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
23769 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
23770 </p>
23771 !! end
23772
23773 !! test
23774 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
23775 !! options
23776 parsoid=html2wt
23777 !! html/parsoid
23778 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
23779 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
23780 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
23781 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
23782 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
23783 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
23784 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23785 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
23786 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23787 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
23788 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
23789 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
23790 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
23791 </p>
23792 !! wikitext
23793 x<nowiki/>http://example.com<nowiki/>y
23794 http://example.com<nowiki/>?x
23795 http://example.com<nowiki/>&x
23796 http://example.com<nowiki/>'x
23797 http://example.com<nowiki/>,x
23798 http://example.com<nowiki/>.x
23799 http://example.com<nowiki/>;x
23800 http://example.com<nowiki/>:x
23801 http://example.com<nowiki/>;x
23802 http://example.com<nowiki/>!x
23803 http://example.com<nowiki/>=x
23804 http://example.com<nowiki/>(x)
23805 http://example.com(x<nowiki/>)
23806 !! end
23807
23808 !! test
23809 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23810 !! options
23811 parsoid=html2wt
23812 !! html/parsoid
23813 <p>x
23814 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
23815 y
23816 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
23817 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
23818 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
23819 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
23820 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
23821 </p>
23822 !! wikitext
23823 x
23824 http://example.com
23825 y
23826 "http://example.com"
23827 (http://example.com)
23828 (http://example.com) foo
23829 http://example.com,
23830 http://example.com, foo
23831 !! html/php
23832 <p>x
23833 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
23834 y
23835 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
23836 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
23837 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
23838 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
23839 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
23840 </p>
23841 !! end
23842
23843 !! test
23844 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23845 !! options
23846 parsoid=html2wt
23847 !! html/parsoid
23848 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
23849 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
23850 !! wikitext
23851 http://example.com.,;:!?\
23852 -http://example.com:
23853 !! html/php
23854 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
23855 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
23856 </p>
23857 !! end
23858
23859 !! test
23860 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
23861 !! options
23862 parsoid=html2wt
23863 !! html/parsoid
23864 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
23865 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
23866 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
23867 !! wikitext
23868 RFC 123<nowiki/>4
23869 RFC 123<nowiki/>y
23870 X<nowiki/>RFC 123<nowiki/>y
23871 !! end
23872
23873 !! test
23874 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
23875 !! options
23876 parsoid=html2wt
23877 !! html/parsoid
23878 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
23879 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
23880 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
23881 </p>
23882 !! wikitext
23883 RFC 123?foo
23884 RFC 123&foo
23885 -RFC 123-
23886 !! html/php
23887 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
23888 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
23889 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
23890 </p>
23891 !! end
23892
23893 !! test
23894 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
23895 !! options
23896 parsoid=html2wt
23897 !! html/parsoid
23898 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
23899 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23900 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23901 !! wikitext
23902 PMID 123<nowiki/>4
23903 PMID 123<nowiki/>y
23904 X<nowiki/>PMID 123<nowiki/>y
23905 !! end
23906
23907 !! test
23908 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
23909 !! options
23910 parsoid=html2wt
23911 !! html/parsoid
23912 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
23913 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
23914 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
23915 </p>
23916 !! wikitext
23917 PMID 123?foo
23918 PMID 123&foo
23919 -PMID 123-
23920 !! html/php
23921 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
23922 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
23923 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
23924 </p>
23925 !! end
23926
23927 !! test
23928 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (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>1
23933 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
23934 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
23935 </p>
23936 !! wikitext
23937 ISBN 1234567890<nowiki/>1
23938 ISBN 1234567890<nowiki/>x
23939 a<nowiki/>ISBN 1234567890<nowiki/>b
23940 !! end
23941
23942 !! test
23943 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
23944 !! options
23945 parsoid=html2wt
23946 !! html/parsoid
23947 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
23948 !! wikitext
23949 -ISBN 1234567890's
23950 !! html/php
23951 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
23952 </p>
23953 !! end
23954
23955 !! test
23956 Links 14. Protect link-like plain text. (Parsoid bug T78425)
23957 !! options
23958 parsoid=html2wt
23959 !! html/*
23960 <p>this is not a link: http://example.com
23961 </p>
23962 !! wikitext
23963 this is not a link: <nowiki>http://example.com</nowiki>
23964 !! end
23965
23966 !! test
23967 Links 15. Link trails can't become link prefixes.
23968 !! options
23969 language=is
23970 parsoid=html2wt
23971 !! html/parsoid
23972 <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>
23973 !! wikitext
23974 [[Söfnuður]]-[[00]]
23975 !! html/php
23976 <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>
23977 </p>
23978 !! end
23979
23980 #### --------------- Quotes ---------------
23981 #### 1. Quotes inside <b> and <i>
23982 #### 2. Link fragments separated by <i> and <b> tags
23983 #### 3. Link fragments inside <i> and <b>
23984 #### 4. No escaping needed
23985 #### --------------------------------------
23986 !! test
23987 1a. Quotes inside <b> and <i>
23988 !! options
23989 parsoid=html2wt
23990 !! html/*
23991 <p><i>'foo'</i>
23992 <i>''foo''</i>
23993 <i>'''foo'''</i>
23994 <i>foo</i>'s
23995 <b>'foo'</b>
23996 <b>''foo''</b>
23997 <b>'''foo'''</b>
23998 <b>foo'<i>bar'</i>baz</b>
23999 <b>foo</b>'s
24000 '<i>foo</i>
24001 <i>foo</i>'
24002 <i>foo'</i>'
24003 '<i>foo</i>'
24004 '<b>foo</b>
24005 <b>foo</b>'
24006 '<b>foo</b>'
24007 <i>fools'<span> errand</span></i>
24008 <i><span>fool</span>'s errand</i>
24009 '<i>foo</i> bar '<i>baz</i>
24010 a|!*#-:;+-~[]{}b'<i>x</i>
24011 </p>
24012 !! wikitext
24013 ''<nowiki/>'foo'''
24014 ''<nowiki>''foo''</nowiki>''
24015 ''<nowiki>'''foo'''</nowiki>''
24016 ''foo''<nowiki/>'s
24017 '''<nowiki/>'foo''''
24018 '''<nowiki>''foo''</nowiki>'''
24019 '''<nowiki>'''foo'''</nowiki>'''
24020 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
24021 '''foo'''<nowiki/>'s
24022 '''foo''
24023 ''foo''<nowiki/>'
24024 ''foo'''<nowiki/>'
24025 '''foo''<nowiki/>'
24026 ''''foo'''
24027 '''foo'''<nowiki/>'
24028 ''''foo'''<nowiki/>'
24029 ''fools'<span> errand</span>''
24030 ''<span>fool</span>'s errand''
24031 '<nowiki/>''foo'' bar '''baz''
24032 a|!*#-:;+-~[]{}b'''x''
24033 !! end
24034
24035 !! test
24036 1b. Quotes inside <b> and <i> with other tags on same line
24037 !! options
24038 parsoid=html2wt
24039 !! html/parsoid
24040 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24041 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24042 <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>
24043 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
24044 '<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>
24045 '<i>foo</i> <div title="name">test</div>
24046 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
24047 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
24048 <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>
24049 </ol>
24050 !! wikitext
24051 '''a'' foo ''[[bar]]''
24052 ''a''' foo ''[[bar]]''
24053 ''a''' foo '''{{echo|[[bar]]}}'''
24054 [[foo]] x'''[[bar]]''
24055 '''foo'' <ref>test</ref>
24056 '''foo'' <div title="name">test</div>
24057 '''foo'' and <br> bar
24058 <references />
24059 !! end
24060
24061 !! test
24062 2. Link fragments separated by <i> and <b> tags
24063 !! options
24064 parsoid=html2wt
24065 !! html/parsoid
24066 <p>[[<i>foo</i>hello]]</p>
24067 <p>[[<b>foo</b>hello]]</p>
24068 !! wikitext
24069 [[''foo''<nowiki>hello]]</nowiki>
24070
24071 [['''foo'''<nowiki>hello]]</nowiki>
24072 !! end
24073
24074 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
24075 # this is one of the shortcomings of this format
24076 !! test
24077 3. Link fragments inside <i> and <b>
24078 !! options
24079 parsoid=html2wt
24080 !! html/parsoid
24081 <p><i>[[foo</i>]]</p>
24082 <p><b>[[foo</b>]]</p>
24083 !! wikitext
24084 ''[[foo''<nowiki>]]</nowiki>
24085
24086 '''[[foo'''<nowiki>]]</nowiki>
24087 !! end
24088
24089 !! test
24090 4. No escaping needed
24091 !! options
24092 options=html2wt
24093 !! html/parsoid
24094 <p>'<span><i>bar</i></span>'
24095 '<span><b>bar</b></span>'
24096 'a:b'foo
24097 </p>
24098 !! wikitext
24099 '<span>''bar''</span>'
24100 '<span>'''bar'''</span>'
24101 'a:b'foo
24102 !! end
24103
24104 #### ----------- Paragraphs ---------------
24105 #### 1. No unnecessary escapes
24106 #### --------------------------------------
24107
24108 !! test
24109 1. No unnecessary escapes
24110 !! options
24111 parsoid=html2wt
24112 !! html/parsoid
24113 <p>bar <span>[[foo]]</span>
24114 </p><p>=bar <span>[[foo]]</span>
24115 </p><p>[[bar <span>[[foo]]</span>
24116 </p><p>]]bar <span>[[foo]]</span>
24117 </p><p>=bar <span>foo]]</span>=
24118 </p>
24119 !! wikitext
24120 bar <span><nowiki>[[foo]]</nowiki></span>
24121
24122 =bar <span><nowiki>[[foo]]</nowiki></span>
24123
24124 [[bar <span><nowiki>[[foo]]</nowiki></span>
24125
24126 ]]bar <span><nowiki>[[foo]]</nowiki></span>
24127
24128 =bar <span>foo]]</span><nowiki>=</nowiki>
24129 !!end
24130
24131 #### ----------------------- PRE --------------------------
24132 #### 1. Leading whitespace in SOL context should be escaped
24133 #### ------------------------------------------------------
24134 !! test
24135 1. Leading whitespace in SOL context should be escaped
24136 !! options
24137 parsoid=html2wt
24138 !! html/parsoid
24139 <p> a</p>
24140
24141 <p> a</p>
24142
24143 <p> a(tab)</p>
24144
24145 <p> a
24146 <!--cmt-->
24147 a</p>
24148
24149 <p>a
24150 b</p>
24151
24152 <p>a
24153 b</p>
24154
24155 <p>a
24156 b</p>
24157 !! wikitext
24158 <nowiki> </nowiki>a
24159
24160 <nowiki> </nowiki> a
24161
24162 a(tab)
24163
24164 <nowiki> </nowiki> a
24165 <!--cmt-->
24166 <nowiki> </nowiki>a
24167
24168 a
24169 <nowiki> </nowiki>b
24170
24171 a
24172 b
24173
24174 a
24175 b
24176 !! html/php
24177 <p> a
24178 </p><p> a
24179 </p><p> a(tab)
24180 </p><p> a
24181 a
24182 </p><p>a
24183 b
24184 </p><p>a
24185 b
24186 </p><p>a
24187 b
24188 </p>
24189 !! end
24190
24191 !! test
24192 2. Leading whitespace in non-indent-pre contexts should not be escaped
24193 !! options
24194 parsoid=html2wt
24195 !! html/parsoid
24196 <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>
24197 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
24198 <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>
24199 b</span></li>
24200 </ol>
24201 !! wikitext
24202 foo <ref>''a''
24203 b</ref>
24204 <references />
24205 !! end
24206
24207 !! test
24208 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
24209 !! options
24210 parsoid=html2wt
24211 !! html/parsoid
24212 <blockquote>
24213 <p>
24214 a
24215 <span>b</span>
24216 c</p>
24217 </blockquote>
24218 !! wikitext
24219 <blockquote>
24220 a
24221 <span>b</span>
24222 c
24223 </blockquote>
24224 !! end
24225
24226 !! test
24227 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
24228 !! options
24229 options=html2wt
24230 !! html/parsoid
24231 <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>
24232 !! wikitext
24233 [[File:Foobar.jpg|thumb|caption]]
24234 !! end
24235
24236 !! test
24237 5. Nowiki escaping should account for indent-pres
24238 !! options
24239 parsoid=html2wt
24240 !! html/parsoid
24241 <pre>==foo==</pre>
24242 !! wikitext
24243 ==foo==
24244 !! end
24245
24246 !!test
24247 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
24248 !! options
24249 parsoid=html2wt
24250 !! html/parsoid
24251 <pre>
24252 * foo
24253 * bar
24254 </pre>
24255 !! wikitext
24256 * foo
24257 * bar
24258 !! end
24259
24260 #### --------------- Behavior Switches --------------------
24261
24262 !! test
24263 1. Valid behavior switches should be escaped
24264 !! options
24265 parsoid=html2wt
24266 !! html/parsoid
24267 __TOC__
24268 <i>__TOC__</i>
24269 !! wikitext
24270 <nowiki>__TOC__</nowiki>
24271 ''<nowiki>__TOC__</nowiki>''
24272 !! end
24273
24274 !! test
24275 2. Invalid behavior switches should not be escaped
24276 !! options
24277 parsoid=html2wt
24278 !! html/parsoid
24279 __TOO__
24280 __|__
24281 !! wikitext
24282 __TOO__
24283 __|__
24284 !! end
24285
24286 # We use indent-pre as an indirect way to test for sol-transparent behavior.
24287 !! test
24288 Behavior switches should be SOL-transparent
24289 !! options
24290 parsoid=html2wt
24291 !! html/parsoid
24292 <meta property="mw:PageProp/toc" />
24293
24294 <!-- this one's bogus -->
24295 <pre>__TOO__</pre>
24296
24297 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
24298
24299 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
24300 !! wikitext
24301 __TOC__
24302
24303 <!-- this one's bogus -->
24304 __TOO__
24305
24306 __TOC__ foo
24307
24308 __TOC__
24309 bar
24310 !! end
24311
24312 #### --------------- HTML tags ---------------
24313 #### 1. a tags
24314 #### 2. other tags
24315 #### 3. multi-line html tag
24316 #### 4. extension tags
24317 #### -----------------------------------------
24318 !! test
24319 1. a tags
24320 !! options
24321 parsoid=html2wt
24322 !! html/parsoid
24323 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
24324 !! wikitext
24325 <a href="http://google.com">google</a>
24326 !! end
24327
24328 !! test
24329 2. other tags
24330 !! options
24331 parsoid=html2wt
24332 !! html/parsoid
24333 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
24334 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
24335 <li> &lt;td&gt;</li></ul>
24336
24337 !! wikitext
24338 * <nowiki><div>foo</div></nowiki>
24339 * <nowiki><div style="color:red">foo</div></nowiki>
24340 * <nowiki><td></nowiki>
24341 !! end
24342
24343 !! test
24344 3. multi-line html tag
24345 !! options
24346 parsoid=html2wt
24347 !! html/parsoid
24348 <p>&lt;div
24349 &gt;foo&lt;/div
24350 &gt;
24351 </p>
24352 !! wikitext
24353 <nowiki><div
24354 >foo</div
24355 ></nowiki>
24356 !! end
24357
24358 !! test
24359 4. extension tags
24360 !! options
24361 parsoid=html2wt
24362 !! html/parsoid
24363 <p>&lt;ref&gt;foo&lt;/ref&gt;
24364 </p><p>&lt;ref&gt;bar
24365 </p><p>baz&lt;/ref&gt;
24366 </p>
24367 !! wikitext
24368 <nowiki><ref>foo</ref></nowiki>
24369
24370 <nowiki><ref>bar</nowiki>
24371
24372 baz<nowiki></ref></nowiki>
24373 !! end
24374
24375 #### --------------- Others ---------------
24376 !! test
24377 Escaping nowikis
24378 !! options
24379 parsoid=html2wt
24380 !! html/parsoid
24381 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
24382 </p>
24383 !! wikitext
24384 &lt;nowiki&gt;foo&lt;/nowiki&gt;
24385 !! end
24386
24387 ## The quote-char in the input is necessary for triggering the bug
24388 !! test
24389 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
24390 !! options
24391 parsoid=html2wt
24392 !! html/parsoid
24393 <p>foo's bar :</p>
24394 !! wikitext
24395 foo's bar :
24396 !! end
24397
24398 #----------- End of wikitext escaping tests --------------
24399
24400 !! test
24401
24402 Tag-like HTML structures are passed through as text
24403 !! wikitext
24404 <x y>
24405
24406 <x.y>
24407
24408 <x-y>
24409
24410 1>2
24411
24412 x<y
24413
24414 a>b
24415
24416 1<d e>f
24417 !! html
24418 <p>&lt;x y&gt;
24419 </p><p>&lt;x.y&gt;
24420 </p><p>&lt;x-y&gt;
24421 </p><p>1&gt;2
24422 </p><p>x&lt;y
24423 </p><p>a&gt;b
24424 </p><p>1&lt;d e&gt;f
24425 </p>
24426 !! end
24427
24428 !! test
24429 HTML tag with necessary entities in attributes
24430 !! wikitext
24431 <span title="&amp;amp;">foo</span>
24432 !! html
24433 <p><span title="&amp;amp;">foo</span>
24434 </p>
24435 !! end
24436
24437 !! test
24438 HTML tag with 'unnecessary' entity encoding in attributes
24439 !! wikitext
24440 <span title="&amp;">foo</span>
24441 !! html
24442 <p><span title="&amp;">foo</span>
24443 </p>
24444 !! end
24445
24446 !! test
24447 HTML tag with broken attribute value quoting
24448 !! options
24449 parsoid=wt2html,html2html
24450 !! wikitext
24451 <span title="Hello world>Foo</span>
24452 !! html/php
24453 <p><span title="Hello world">Foo</span>
24454 </p>
24455 !! html/parsoid
24456 <p><span title="Hello world">Foo</span></p>
24457 !! end
24458
24459 !! test
24460 Self-closed tag with broken attribute value quoting
24461 !! options
24462 parsoid=wt2html,html2html
24463 !! wikitext
24464 <div title="Hello world />Foo
24465 !! html/php+tidy
24466 <div title="Hello world"></div>
24467 <p>Foo</p>
24468 !! html/parsoid
24469 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
24470 !! end
24471
24472 !! test
24473 Table with broken attribute value quoting
24474 !! options
24475 parsoid=wt2html,html2html
24476 !! wikitext
24477 {|
24478 | title="Hello world|Foo
24479 |}
24480 !! html/php
24481 <table>
24482 <tr>
24483 <td title="Hello world">Foo
24484 </td></tr></table>
24485
24486 !! html/parsoid
24487 <table>
24488 <tr>
24489 <td title="Hello world">Foo
24490 </td></tr></table>
24491
24492 !! end
24493
24494 !! test
24495 Table with broken attribute value quoting on consecutive lines
24496 !! options
24497 parsoid=wt2html,html2html
24498 !! wikitext
24499 {|
24500 | title="Hello world|Foo
24501 | style="color:red|Bar
24502 |}
24503 !! html/php
24504 <table>
24505 <tr>
24506 <td title="Hello world">Foo
24507 </td>
24508 <td style="color:red">Bar
24509 </td></tr></table>
24510
24511 !! html/parsoid
24512 <table><tbody>
24513 <tr>
24514 <td title="Hello world">Foo
24515 </td><td style="color: red">Bar
24516 </td></tr></tbody></table>
24517
24518 !! end
24519
24520 !!test
24521 Accept empty td cell attribute
24522 !! wikitext
24523 {|
24524 | align="center" | foo || |
24525 |}
24526 !! html
24527 <table>
24528 <tr>
24529 <td align="center"> foo </td>
24530 <td>
24531 </td></tr></table>
24532
24533 !!end
24534
24535 !!test
24536 Non-empty attributes in th-cells
24537 !! wikitext
24538 {|
24539 ! Foo !! style="color: red" | Bar
24540 |}
24541 !! html
24542 <table>
24543 <tr>
24544 <th> Foo </th>
24545 <th style="color: red"> Bar
24546 </th></tr></table>
24547
24548 !!end
24549
24550 !!test
24551 Accept empty attributes in th-cells
24552 !! wikitext
24553 {|
24554 !| foo !!| bar
24555 |}
24556 !! html
24557 <table>
24558 <tr>
24559 <th> foo </th>
24560 <th> bar
24561 </th></tr></table>
24562
24563 !!end
24564
24565 !!test
24566 Empty table rows go away
24567 !! wikitext
24568 {|
24569 | Hello
24570 | there
24571 |- class="foo"
24572 |-
24573 |}
24574 !! html
24575 <table>
24576 <tr>
24577 <td> Hello
24578 </td>
24579 <td> there
24580 </td></tr>
24581
24582 </table>
24583
24584 !! end
24585
24586 ###
24587 ### Parsoid-centric tests for testing RTing of inter-element separators
24588 ### Edge cases not tested by existing parser tests and specific to
24589 ### Parsoid-specific serialization strategies.
24590 ###
24591
24592 !!test
24593 RT-ed inter-element separators should be valid separators
24594 !! wikitext
24595 {|
24596 |- [[foo]]
24597 |}
24598 !! html/php
24599 <table>
24600
24601 </table>
24602
24603 !! html/parsoid
24604 <table>
24605 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
24606 </tbody></table>
24607 !!end
24608
24609 # Parsoid-only since PHP parser relies on Tidy for correct output
24610 !!test
24611 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
24612 !!options
24613 parsoid
24614 !! wikitext
24615 {|
24616 |<small>foo
24617 bar
24618 |}
24619
24620 {|
24621 |<small>foo<small>
24622 |}
24623 !! html
24624 <table>
24625 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
24626 <p>bar</p></small></td></tr>
24627 </tbody></table>
24628
24629 <table>
24630 <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>
24631 </tbody></table>
24632 !!end
24633
24634 # Note that the "style" attribute is really a template parameter here.
24635 # The = would have to be {{=}} if you wanted the literal.
24636 !!test
24637 Empty TD followed by TD with tpl-generated attribute
24638 !! wikitext
24639 {|
24640 |-
24641 |
24642 |{{echo|style='color:red'}}|foo
24643 |}
24644 !! html
24645 <table>
24646
24647 <tr>
24648 <td>
24649 </td>
24650 <td>foo
24651 </td></tr></table>
24652
24653 !!end
24654
24655 !!test
24656 Indented table with an empty td
24657 !! wikitext
24658 {|
24659 |-
24660 |
24661 |foo
24662 |}
24663 !! html
24664 <table>
24665
24666 <tr>
24667 <td>
24668 </td>
24669 <td>foo
24670 </td></tr></table>
24671
24672 !!end
24673
24674 ## We have some newline diffs RT-ing this edge case
24675 ## and it is not important enough -- we seem to be emitting
24676 ## at most 2 newlines after a </tr> and this is unrelated to
24677 ## the issue from T85627 that this is testing.
24678 !!test
24679 Indented table with blank lines in between (T85627)
24680 !! options
24681 parsoid=wt2html
24682 !! wikitext
24683 {|
24684 |foo
24685
24686
24687 |}
24688 !! html
24689 <table>
24690
24691 <tr>
24692 <td>foo
24693 </td></tr></table>
24694
24695 !!end
24696
24697 !!test
24698 Indented block & table
24699 !! wikitext
24700 <div>foo</div>
24701 {|
24702 |foo
24703 |}
24704 !! html/php
24705 <div>foo</div>
24706 <table>
24707 <tr>
24708 <td>foo
24709 </td></tr></table>
24710
24711 !! html/parsoid
24712 <div data-parsoid='{"stx":"html"}'>foo</div>
24713 <table><tbody>
24714 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
24715 </tbody></table>
24716 !!end
24717
24718 !! test
24719 Indent and comment before table row
24720 !! wikitext
24721 {|
24722 <!--hi-->|-
24723 | there
24724 |}
24725 !! html/php
24726 <table>
24727
24728 <tr>
24729 <td> there
24730 </td></tr></table>
24731
24732 !! html/parsoid
24733 <table>
24734 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
24735 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
24736 </tbody></table>
24737 !! end
24738
24739 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
24740 !!test
24741 Empty TR followed by a template-generated TR
24742 !!options
24743 parsoid
24744 !! wikitext
24745 {|
24746 |-
24747 {{echo|<tr><td>foo</td></tr>}}
24748 |}
24749 !! html
24750 <table>
24751 <tbody>
24752 <tr></tr>
24753 <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}}]}'>
24754 <td>foo</td></tr>
24755 </tbody></table>
24756 !!end
24757
24758 ## PHP and parsoid output differ for this, and since this is primarily
24759 ## for testing Parsoid's serializer, marking this Parsoid only
24760 !!test
24761 Empty TR followed by mixed-ws-comment line should RT correctly
24762 !!options
24763 parsoid
24764 !! wikitext
24765 {|
24766 |-
24767 <!--c-->
24768 |-
24769 <!--c--> <!--d-->
24770 |}
24771 !! html
24772 <table>
24773 <tbody>
24774 <tr></tr>
24775 <!--c-->
24776 <tr>
24777 <!--c--> </tr><!--d-->
24778 </tbody></table>
24779
24780 !!end
24781
24782 !!test
24783 Multi-line image caption generated by templates with/without trailing newlines
24784 !! wikitext
24785 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
24786 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
24787 !! html/parsoid
24788 <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>
24789 <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>
24790 !!end
24791
24792 !! test
24793 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
24794 !! options
24795 parsoid=html2wt
24796 !! html/parsoid
24797 <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>
24798
24799 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
24800 !! wikitext
24801 <includeonly>foo</includeonly>
24802 new para
24803
24804 [[Category:Foo]]
24805
24806 = new heading =
24807 !! end
24808
24809 ## PHP emits broken html for this, and since this is primarily
24810 ## a Parsoid serializer test, marking this Parsoid only
24811 !!test
24812 Improperly nested inline or quotes tags with whitespace in between
24813 !! wikitext
24814 <span> <s>x</span> </s>
24815 ''' ''x''' ''
24816 !! html/parsoid
24817 <p><span> <s>x</s></span><s> </s>
24818 <b> <i>x</i></b><i> </i>
24819 </p>
24820 !!end
24821
24822 !!test
24823 Encapsulate protected attributes from wt
24824 !! wikitext
24825 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
24826
24827 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
24828 | ok
24829 |}
24830 !! html/parsoid
24831 <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>
24832
24833 <table 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">
24834 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
24835 </tbody></table>
24836 !!end
24837
24838 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
24839 ## Having nested or stray pre tags results in the attempt to add duplicates,
24840 ## causing an assertion fail. This test tries to prevent that situation.
24841 !!test
24842 Ensure ParagraphWrapper can deal with stray closing pre tags
24843 !!options
24844 parsoid=wt2html
24845 !! wikitext
24846 plain text</pre>
24847 !! html/parsoid
24848 plain text
24849 !!end
24850
24851 !!test
24852 1. Ensure fostered text content is wrapped in element nodes
24853 !!options
24854 parsoid=wt2html
24855 !! wikitext
24856 <table>hi</table><table>ho</table>
24857 !! html/parsoid
24858 <p>hi</p>
24859 <table></table>
24860 <p>ho</p>
24861 <table></table>
24862 !!end
24863
24864 !!test
24865 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
24866 !!options
24867 parsoid=wt2html,wt2wt
24868 !! wikitext
24869 <table>
24870 <tr> || ||
24871 <td> a
24872 </table>
24873 !! html/parsoid
24874 <p> || ||
24875 </p><table>
24876 <tbody><tr><td> a</td></tr>
24877 </tbody></table>
24878 !!end
24879
24880 !!test
24881 Encapsulation properly handles null DSR information from foster box
24882 !!options
24883 parsoid=wt2html,wt2wt
24884 !! wikitext
24885 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
24886 !! html/parsoid
24887 <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>
24888 !!end
24889
24890 !!test
24891 1. Encapsulate foster-parented transclusion content
24892 !!options
24893 parsoid=wt2wt,wt2html
24894 !! wikitext
24895 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
24896 !! html/parsoid
24897 <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>
24898 <tbody>
24899 <tr>
24900 <td>bar</td>
24901 </tr>
24902 </tbody>
24903 </table>
24904 !!end
24905
24906 !!test
24907 2. Encapsulate foster-parented transclusion content
24908 !!options
24909 parsoid=wt2wt,wt2html
24910 !! wikitext
24911 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
24912 !! html/parsoid
24913 <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>
24914 <table>
24915 <tbody>
24916 <tr>
24917 <td>bar</td>
24918 </tr>
24919 </tbody>
24920 </table>
24921 !!end
24922
24923 !!test
24924 3. Encapsulate foster-parented transclusion content
24925 !!options
24926 parsoid=wt2wt,wt2html
24927 !! wikitext
24928 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24929 !! html/parsoid
24930 <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;]}">
24931 <p>foo</p>
24932 </div>
24933 <table>
24934 <tbody>
24935 <tr>
24936 <td>bar</td>
24937 </tr>
24938 </tbody>
24939 </table>
24940 !!end
24941
24942 !!test
24943 4. Encapsulate foster-parented transclusion content
24944 !!options
24945 parsoid=wt2wt,wt2html
24946 !! wikitext
24947 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24948 !! html/parsoid
24949 <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;]}">
24950 <p>foo</p>
24951 </div>
24952 <table>
24953 <tbody>
24954 <tr>
24955 <td>bar</td>
24956 </tr>
24957 </tbody>
24958 </table>
24959 !!end
24960
24961 !!test
24962 5. Encapsulate foster-parented transclusion content
24963 !!options
24964 parsoid=wt2wt,wt2html
24965 !! wikitext
24966 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
24967 !! html/parsoid
24968 <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>
24969 <table>
24970 <tbody>
24971 <tr>
24972 <td>
24973 <div>
24974 <p>foo</p>
24975 </div>
24976 </td>
24977 </tr>
24978 </tbody>
24979 </table>
24980 !!end
24981
24982 !!test
24983 6. Encapsulate foster-parented transclusion content
24984 !!options
24985 parsoid=wt2wt,wt2html
24986 !! wikitext
24987 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
24988 !! html/parsoid
24989 <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>
24990 <table>
24991 <tbody>
24992 <tr>
24993 <td>
24994 <div>
24995 <p>foo</p>
24996 </div>
24997 </td>
24998 </tr>
24999 </tbody>
25000 </table>
25001 <p>ok</p>
25002 !!end
25003
25004 !!test
25005 7. Encapsulate foster-parented transclusion content
25006 !!options
25007 parsoid=wt2wt,wt2html
25008 !! wikitext
25009 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
25010 !! html/parsoid
25011 <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>
25012 <table>
25013 <tbody>
25014 <tr>
25015 <td>bar</td>
25016 </tr>
25017 </tbody>
25018 </table>
25019 !!end
25020
25021 # Note that the wt is broken on purpose: the = should be {{=}} if you
25022 # don't want it to be a template parameter key.
25023 !!test
25024 8. Encapsulate foster-parented transclusion content
25025 !!options
25026 parsoid=wt2wt,wt2html
25027 !! wikitext
25028 {{echo|a
25029 }}{|{{echo|style='color:red'}}
25030 |-
25031 |b
25032 |}
25033 !! html/parsoid
25034 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
25035 <span> </span>
25036 <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>
25037 <table>
25038 <tbody>
25039 <tr>
25040 <td>b</td>
25041 </tr>
25042 </tbody>
25043 </table>
25044 !!end
25045
25046 !!test
25047 9. Encapsulate foster-parented transclusion content
25048 !!options
25049 parsoid=wt2wt,wt2html
25050 !! wikitext
25051 <table>{{echo|hi</table>hello}}
25052 !! html/parsoid
25053 <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>
25054 !!end
25055
25056 !!test
25057 Table in fosterable position
25058 !!options
25059 parsoid=wt2html
25060 !! wikitext
25061 {{OpenTable}}
25062 <div>
25063 {|
25064 |}
25065 </div>
25066 |}
25067 !! html/parsoid
25068 <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">
25069 </span>
25070 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
25071
25072 <table>
25073 </table>
25074 !!end
25075
25076 # Parsoid only for bug 64747
25077 !! test
25078 Properly encapsulate empty-content transclusions in fosterable positions
25079 !! wikitext
25080 <table>
25081 {{#if:|
25082 <td>foo</td>
25083 }}
25084 </table>
25085 !! html/parsoid
25086 <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"}]]}'>
25087
25088 </table>
25089 !! end
25090
25091 !! test
25092 Always encapsulate foster box when template range is expanded to table
25093 !! options
25094 parsoid=wt2wt
25095 !! wikitext
25096 {|
25097 hello
25098 {{OpenTable}}
25099 |}
25100 !! html/parsoid
25101
25102 !! end
25103
25104 !! test
25105 T115289: Unclosed table
25106 !! wikitext
25107 {{echo|<table>}}<!--c-->[[Category:Two]]
25108 !! html/parsoid
25109 <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>
25110 !! end
25111
25112 !! test
25113 T115289: Don't migrate newlines out of tables with fostered content
25114 !! wikitext
25115 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
25116 !! html/parsoid
25117 <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>
25118 !! end
25119
25120 !! test
25121 T73074: More fostering fun
25122 !! wikitext
25123 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
25124 !! html/parsoid
25125 <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>
25126 !! end
25127
25128 !!test
25129 Support <object> element with .data attribute
25130 !!options
25131 parsoid=html2wt
25132 !! html/parsoid
25133 <object data="test.swf"></object>
25134 !! wikitext
25135 <object data="test.swf"></object>
25136 !!end
25137
25138 !! test
25139 Don't block XML namespace declaration
25140 !! wikitext
25141 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25142 !! html/php
25143 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25144 </p>
25145 !! html/parsoid
25146 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
25147 !! end
25148
25149 # -----------------------------------------------------------------
25150 # The following section of tests are primarily to spec requirements
25151 # around Parsoid's serialization (old, new, edited content)
25152 #
25153 # All these tests are marked Parsoid html2wt and html2html only
25154 # ----------------------------------------------------------------
25155
25156 !! test
25157 Ignore rel attribute in a-tags during serialization to url-links
25158 !! options
25159 parsoid=html2wt
25160 !! html/parsoid
25161 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
25162 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
25163 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
25164 !! wikitext
25165 http://en.wikipedia.org/wiki/Foobar
25166 http://en.wikipedia.org/wiki/Foobar
25167 http://en.wikipedia.org/wiki/Foobar
25168 !! end
25169
25170 # 'mi' is a localinterwiki prefix as well as a language
25171 !! test
25172 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
25173 !! options
25174 parsoid=html2wt
25175 !! html/parsoid
25176 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
25177 !! wikitext
25178 [[Foo]]
25179 !! end
25180
25181 # See T93839
25182 !! test
25183 New wikilinks should be serialized properly
25184 !! options
25185 parsoid=html2wt
25186 !! html/parsoid
25187 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
25188 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
25189 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
25190 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
25191 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
25192 !! wikitext
25193 [[Foo]]
25194 [[Foo]]
25195 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
25196 http://en.wikipedia.org/wiki/Foo
25197 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
25198 !! end
25199
25200 !! test
25201 New wiki links (href variations)
25202 !! options
25203 parsoid=html2wt
25204 !! html/parsoid
25205 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25206 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
25207 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
25208 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
25209 !! wikitext
25210 [[Foo_bar]]
25211 [[Foo_bar]]
25212 [[Foo_bar]]
25213 [[Toxine bactérienne]]
25214 !! end
25215
25216 !! test
25217 New wiki links (content string variations)
25218 !! options
25219 parsoid=html2wt
25220 !! html/parsoid
25221 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25222 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
25223 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
25224 !! wikitext
25225 [[Foo_bar]]
25226 [[Foo bar]]
25227 [[Foo_bar|./Foo_bar]]
25228 !! end
25229
25230 !! test
25231 New category links (href variations)
25232 !! options
25233 parsoid=html2wt
25234 !! html/parsoid
25235 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
25236 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
25237 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
25238 !! wikitext
25239 [[Category:Toxine bactérienne]]
25240 [[Category:Toxine bactérienne]]
25241 [[Category:Toxine bactérienne]]
25242 !! end
25243
25244 !! test
25245 New sol transparent links don't need indent-pre nowiki protection
25246 !! options
25247 parsoid=html2wt
25248 language=de
25249 !! html/parsoid
25250 <link rel="mw:PageProp/redirect" href="./Main_Page">
25251 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
25252 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
25253 !! wikitext
25254 #WEITERLEITUNG [[Main Page]]
25255 <!-- this is good --> [[Category:Good]]
25256 <!-- this is great --> [[Kategorie:Great]]
25257 !! end
25258
25259 !! test
25260 New interlanguage links (href variations)
25261 !! options
25262 parsoid=html2wt
25263 !! html/parsoid
25264 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
25265 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
25266 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
25267 !! wikitext
25268 [[es:Toxine bactérienne]]
25269 [[es:Toxine_bactérienne]]
25270 [[es:Toxine_bactérienne]]
25271 !! end
25272
25273 !! test
25274 Image: Modifying size of an image (1)
25275 !! options
25276 parsoid={
25277 "modes": ["wt2wt"],
25278 "changes": [
25279 ["img[height]", "attr", "height", "22"],
25280 ["img[width]", "attr", "width", "200"]
25281 ]
25282 }
25283 !! wikitext
25284 [[Image:Foobar.jpg|230x230px]]
25285 !! wikitext/edited
25286 [[Image:Foobar.jpg|200x200px]]
25287 !!end
25288
25289 !! test
25290 Image: Modifying size of an image (2)
25291 !! options
25292 parsoid={
25293 "modes": ["wt2wt"],
25294 "changes": [
25295 ["img[height]", "attr", "height", "100"],
25296 ["img[width]", "attr", "width", "500"]
25297 ]
25298 }
25299 !! wikitext
25300 [[Image:Foobar.jpg|230x230px]]
25301 !! wikitext/edited
25302 [[Image:Foobar.jpg|500x500px]]
25303 !!end
25304
25305 # Change in size is ignored so long as class='mw-default-size'
25306 !! test
25307 Image: Modifying size of an image (3)
25308 !! options
25309 parsoid={
25310 "modes": ["wt2wt"],
25311 "changes": [
25312 ["figure[class]", "removeClass", "mw-default-size"],
25313 ["figure img", "attr", "height", "19"],
25314 ["figure img", "attr", "width", "170"]
25315 ]
25316 }
25317 !! wikitext
25318 [[Image:Foobar.jpg|thumb]]
25319 !! wikitext/edited
25320 [[Image:Foobar.jpg|thumb|170x170px]]
25321 !!end
25322
25323 !! test
25324 Image: Modifying alignment of an image (bug 48665)
25325 !! options
25326 parsoid={
25327 "modes": ["wt2wt"],
25328 "changes": [
25329 ["figure[class]", "removeClass", "mw-halign-right"],
25330 ["figure[class]", "addClass", "mw-halign-left"]
25331 ]
25332 }
25333 !! wikitext
25334 [[Image:Foobar.jpg|thumb|caption|right]]
25335 !! wikitext/edited
25336 [[Image:Foobar.jpg|thumb|caption|left]]
25337 !! end
25338
25339 !! test
25340 Image: Modifying mw-default-size of an frameless image (bug 62805)
25341 !! options
25342 parsoid={
25343 "modes": ["wt2wt"],
25344 "changes": [
25345 ["figure.mw-default-size", "removeClass", "mw-default-size"]
25346 ]
25347 }
25348 !! wikitext
25349 [[Image:Foobar.jpg|frameless|right]]
25350 !! wikitext/edited
25351 [[Image:Foobar.jpg|frameless|right|220x220px]]
25352 !! end
25353
25354 !! test
25355 Image: Modifying valign of an image (bug 49221)
25356 !! options
25357 parsoid={
25358 "modes": ["wt2wt"],
25359 "changes": [
25360 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
25361 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
25362 ]
25363 }
25364 !! wikitext
25365 [[File:Foobar.jpg|20px|middle]]
25366 !! wikitext/edited
25367 [[File:Foobar.jpg|20px|text-top]]
25368 !! end
25369
25370 !! test
25371 Image: Modifying alt attribute of an image (bug 56400)
25372 !! options
25373 parsoid={
25374 "modes": ["wt2wt"],
25375 "changes": [
25376 ["img[alt]", "attr", "alt", "some alternate edited text"]
25377 ]
25378 }
25379 !! wikitext
25380 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
25381 !! wikitext/edited
25382 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
25383 !!end
25384
25385 !! test
25386 Image: Modifying caption of an image
25387 !! options
25388 parsoid={
25389 "modes": ["wt2wt"],
25390 "changes": [
25391 ["figcaption", "text", "new caption"]
25392 ]
25393 }
25394 !! wikitext
25395 [[Image:Foobar.jpg|thumb|original caption]]
25396 !! wikitext/edited
25397 [[Image:Foobar.jpg|thumb|new caption]]
25398 !!end
25399
25400 !! test
25401 Image: empty alt attribute (bug 48924)
25402 !! options
25403 parsoid
25404 !! wikitext
25405 [[File:Foobar.jpg|thumb|alt=|bar]]
25406 !! html
25407 <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>
25408 !! end
25409
25410 !! test
25411 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
25412 !! options
25413 parsoid=html2wt
25414 language=ar
25415 disabled
25416 !! html/parsoid
25417 <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>
25418 !! wikitext
25419 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
25420 !! end
25421
25422 !! test
25423 Image: Block level image should have \n before and after
25424 !! wikitext
25425 123
25426 [[File:Foobar.jpg|right|thumb|150x150px]]
25427 456
25428 !! html/parsoid
25429 <p>123</p>
25430 <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>
25431 <p>456</p>
25432 !!end
25433
25434 !! test
25435 Image: New block level image should have \n before and after (existing content)
25436 !! wikitext
25437 123
25438 [[File:Foobar.jpg|right|thumb|150x150px]]
25439 456
25440 !! html/parsoid
25441 <p>123</p>
25442 <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>
25443 <p>456</p>
25444 !!end
25445
25446 !! test
25447 Image: upright option (parsoid)
25448 !! wikitext
25449 [[File:Foobar.jpg|thumb|upright|caption]]
25450 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
25451 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
25452 !! html/parsoid
25453 <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>
25454 <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>
25455 <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>
25456 !!end
25457
25458 !! test
25459 Image: upright option is ignored on inline and frame images (parsoid)
25460 !! wikitext
25461 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
25462 !! html/parsoid
25463 <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>
25464 !!end
25465
25466 !! test
25467 Image: from basic HTML (1)
25468 !! options
25469 parsoid=html2wt
25470 !! html/parsoid
25471 <span typeof="mw:Image">
25472 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25473 </span>
25474 !! wikitext
25475 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25476 !! end
25477
25478 !! test
25479 Image: from basic HTML (2)
25480 !! options
25481 parsoid=html2wt
25482 !! html/parsoid
25483 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25484 !! wikitext
25485 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25486 !! end
25487
25488 !! test
25489 Image: from basic HTML (3)
25490 !! options
25491 parsoid=html2wt
25492 !! html/parsoid
25493 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
25494 !! wikitext
25495 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
25496 !! end
25497
25498 !! test
25499 Image: from basic HTML (4)
25500 !! options
25501 parsoid=html2wt
25502 !! html/parsoid
25503 <img src="./File:Foobar.jpg">
25504 !! wikitext
25505 [[File:Foobar.jpg|link=]]
25506 !! end
25507
25508 !! test
25509 Image: Invalid title as link
25510 !! wikitext
25511 [[File:Foobar.jpg|link=<]]
25512 !! html/php
25513 <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>
25514 </p>
25515 !! html/parsoid
25516 <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>
25517 !! end
25518
25519 !! test
25520 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
25521 !! options
25522 parsoid=html2wt
25523 !! html/parsoid
25524 <ul>
25525 <li><p>foo</p></li>
25526 </ul>
25527 !! wikitext
25528 * foo
25529 !! end
25530
25531 !! test
25532 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
25533 !! options
25534 parsoid=html2wt
25535 !! html/parsoid
25536 <ul> <li>foo</li></ul>
25537 !! wikitext
25538 * foo
25539 !! end
25540
25541 !! test
25542 Don't strip leading whitespace when handling indent-pre suppressing tags
25543 !! options
25544 parsoid=html2wt
25545 !! html/parsoid
25546 <table>
25547 <tr><td> indented row</td></tr>
25548 </table>
25549 <blockquote><p>
25550 <b>This is very bold of you!</b>
25551 </p>
25552 <table><tr><td>
25553 indented cell (no pre-wrapping!)
25554 </td></tr></table>
25555 </blockquote>
25556 <p>foo</p>
25557 <div>bar</div>
25558 !! wikitext
25559 {|
25560 | indented row
25561 |}
25562 <blockquote>
25563 '''This is very bold of you!'''
25564
25565 {|
25566 |
25567 indented cell (no pre-wrapping!)
25568 |}
25569 </blockquote>
25570 foo
25571 <div>bar</div>
25572 !! end
25573
25574 !! test
25575 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
25576 !! options
25577 parsoid=html2wt
25578 !! html/parsoid
25579 <p>foo</p>
25580 <span>bar</span>
25581
25582 <span>foo2
25583 </span>bar2
25584
25585 <div>foo</div>
25586 <span>bar</span>
25587
25588 <div>
25589 <span>foo</span>
25590 </div>
25591 !! wikitext
25592 foo
25593
25594 <span>bar</span>
25595
25596 <span>foo2
25597 <nowiki> </nowiki></span>bar2
25598
25599 <div>foo</div>
25600 <nowiki> </nowiki><span>bar</span>
25601
25602 <div>
25603 <nowiki> </nowiki><span>foo</span>
25604 </div>
25605 !! end
25606
25607 !! test
25608 Lists: Dont insert newlines in a serialized list item.
25609 !! options
25610 parsoid=html2wt
25611 !! html/parsoid
25612 <ul><li>a<br>b</li><li>c</li></ul>
25613 !! wikitext
25614 * a<br>b
25615 * c
25616 !! end
25617
25618 !! test
25619 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
25620 !! options
25621 parsoid={
25622 "modes": ["html2wt"],
25623 "scrubWikitext": false
25624 }
25625 !! html/parsoid
25626 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25627 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25628
25629 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25630 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25631
25632 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
25633
25634 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25635 !! wikitext
25636 == hello there [[Category:A1]] ==
25637
25638 == [[Category:A2]] hi pal ==
25639
25640 == <!--foo--> [[Category:A3]] how goes it ==
25641
25642 == it goes well [[Category:A4]] <!--bar--> ==
25643
25644 ==howdy [[Category:A5]]==
25645
25646 == __TOC__ ok ==
25647 !! end
25648
25649 !! test
25650 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
25651 !! options
25652 parsoid={
25653 "modes": ["html2wt"],
25654 "scrubWikitext": true
25655 }
25656 !! html/parsoid
25657 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25658 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25659
25660 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25661 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25662
25663 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25664 !! wikitext
25665 == hello there ==
25666 [[Category:A1]]
25667 [[Category:A2]]
25668
25669 == hi pal ==
25670
25671 <!--foo--> [[Category:A3]]
25672
25673 == how goes it ==
25674
25675 == it goes well ==
25676 [[Category:A4]] <!--bar-->
25677
25678 __TOC__
25679
25680 == ok ==
25681 !! end
25682
25683 !! test
25684 Headings: Don't hoist metas that come from templates
25685 !! options
25686 parsoid={
25687 "modes": ["html2wt"],
25688 "scrubWikitext": true
25689 }
25690 !! html/parsoid
25691 <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>
25692 !! wikitext
25693 == {{echo|foo [[Category:Foo]]}} ==
25694 !! end
25695
25696 !! test
25697 Headings: Category in ref isn't hoisted
25698 !! options
25699 parsoid={
25700 "modes": ["html2wt"],
25701 "scrubWikitext": true
25702 }
25703 !! html/parsoid
25704 <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>
25705
25706 <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>
25707 !! wikitext
25708 == foo <ref>bar
25709 [[Category:Baz]] </ref> ==
25710
25711 <references />
25712 !! end
25713
25714 !! test
25715 Parsoid: Serialize positional parameters with = in them as named parameter
25716 !! options
25717 parsoid=html2wt
25718 !! html/parsoid
25719 <p about="#mwt1" typeof="mw:Transclusion"
25720 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
25721
25722 <p about="#mwt1" typeof="mw:Transclusion"
25723 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
25724
25725 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25726 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25727 <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>
25728 !! wikitext
25729 {{echo|1=f=oo}}
25730
25731 {{echo|1=f=oo|2=bar}}
25732
25733 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25734 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25735 {{echo|<nowiki>f=oo</nowiki>|bar}}
25736 !! end
25737
25738 !! test
25739 Parsoid: Serialize positional parameters with = in extlink as named parameter
25740 !! options
25741 parsoid=html2wt
25742 !! html/parsoid
25743 <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>
25744 !! wikitext
25745 {{echo|1=http://stuff?is=ok}}
25746 !! end
25747
25748 !! test
25749 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
25750 !! options
25751 parsoid=html2wt
25752 !! html/parsoid
25753 <div>a<p>b</p></div>
25754 <div>a
25755 <p>b</p></div>
25756 <div>
25757 a
25758 <p>b</p></div>
25759 !! wikitext
25760 <div>a
25761 b
25762 </div>
25763 <div>a
25764 b
25765 </div>
25766 <div>
25767 a
25768
25769 b
25770 </div>
25771 !! end
25772
25773 !! test
25774 Substrings resembling wikitext in hrefs should not get nowiki escapes
25775 !! options
25776 parsoid=html2wt
25777 !! html/parsoid
25778 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
25779 !! wikitext
25780 [[Foo''bar''baz]]
25781 !! end
25782
25783 !! test
25784 Enforce single-line context in the serializer
25785 !! options
25786 parsoid=html2wt
25787 !! html/parsoid
25788 <h2>testing
25789 123</h2>
25790
25791 <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">
25792 </span><span about="#mwt1">you</span> </h2>
25793
25794 <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>
25795
25796 <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
25797 there</span></li></ol>
25798
25799 <ul><li>asd
25800 sdf</li></ul>
25801
25802 <ul><li>foo
25803 bar
25804 baz</li>
25805 <li>foo <b>bar</b>
25806 baz</li></ul>
25807
25808 <dl><dt>hi
25809 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
25810 ho</dd></dl>
25811
25812 <dl><dd> <table>
25813 <tbody><tr><td> ha
25814 ha
25815 ha</td></tr>
25816 </tbody></table></dd></dl>
25817 !! wikitext
25818 == testing 123 ==
25819
25820 == hi {{bogus|there
25821 you}} ==
25822
25823 == foo <ref>hello
25824 there</ref> ==
25825
25826 <references />
25827
25828 * asd sdf
25829
25830 * foo bar baz
25831 * foo '''bar''' baz
25832
25833 ; hi ho : hi ho
25834
25835 : {|
25836 | ha
25837 ha
25838 ha
25839 |}
25840 !! end
25841
25842 !! test
25843 Serialize new placeholder space without spans
25844 !! options
25845 parsoid=html2wt
25846 !! html/parsoid
25847 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
25848
25849 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
25850
25851 <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>
25852 !! wikitext
25853 foo : bar
25854
25855 foo : bar
25856
25857 <ref>foo : bar</ref>ok
25858 !! end
25859
25860
25861 #-----------------------
25862 # Tag minimization tests
25863 #-----------------------
25864
25865 !! test
25866 1. I/B quote minimization: wikitext-only tags should be combined
25867 !! options
25868 parsoid=html2wt
25869 !! html/parsoid
25870 <p><i>A</i><i>B</i></p>
25871 <p><b>A</b><b>B</b></p>
25872 <p><i>A</i><b><i>B</i></b></p>
25873 <p><b>A</b><i><b>B</b></i></p>
25874 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
25875 <p><i><b>A</b></i><i><b>B</b></i></p>
25876 <p><i><b>A</b></i><b><i>B</i></b></p>
25877 <p><b><i>A</i></b><i><b>B</b></i></p>
25878 !! wikitext
25879 ''AB''
25880
25881 '''AB'''
25882
25883 ''A'''B'''''
25884
25885 '''A''B'''''
25886
25887 '''A''BC''D'''
25888
25889 '''''AB'''''
25890
25891 '''''AB'''''
25892
25893 '''''AB'''''
25894 !! end
25895
25896 !! test
25897 2. I/B quote minimization: wikitext and html tags should not be combined
25898 !! options
25899 parsoid=html2wt
25900 !! html/parsoid
25901 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
25902 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
25903 !! wikitext
25904 ''A''<i>B</i>
25905
25906 ''A''<nowiki/>'''<i>B</i>'''
25907 !! end
25908
25909 !! test
25910 3. I/B quote minimization: templated content stops minimization
25911 !! options
25912 parsoid=html2wt
25913 !! html/parsoid
25914 <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>
25915 <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>
25916 !! wikitext
25917 ''A''{{echo|''B''}}
25918
25919 ''A''{{echo|'''''B'''''}}
25920 !! end
25921
25922 !! test
25923 4. I/B quote minimization: new content should be mimimized with adjacent old content
25924 !! options
25925 parsoid=html2wt
25926 !! html/parsoid
25927 <p><i>A</i><i>B</i></p>
25928 <p><b>A</b><b>B</b></p>
25929 <p><i>A</i><b><i>B</i></b></p>
25930 !! wikitext
25931 ''AB''
25932
25933 '''AB'''
25934
25935 ''A'''B'''''
25936 !! end
25937
25938 !! test
25939 5a. Merge adjacent quote nodes if they've been edited
25940 !! options
25941 parsoid={
25942 "modes": ["wt2wt", "selser"],
25943 "changes": [
25944 ["p", "contents", "remove", ":contains('b')"]
25945 ]
25946 }
25947 !! wikitext
25948 ''a''b''c''
25949 !! wikitext/edited
25950 ''ac''
25951 !! end
25952
25953 !! test
25954 5b. Merge adjacent quote nodes if they've been edited
25955 !! options
25956 parsoid={
25957 "modes": ["wt2wt", "selser"],
25958 "changes": [
25959 ["#x", "remove"]
25960 ]
25961 }
25962 !! wikitext
25963 ''a''<span id="x">b</span>''c''
25964 !! wikitext/edited
25965 ''ac''
25966 !! end
25967
25968 !! test
25969 1. Merge adjacent link nodes as long as at least one element is new
25970 !! options
25971 parsoid={
25972 "modes": ["html2wt"],
25973 "scrubWikitext": true
25974 }
25975 !! html/parsoid
25976 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25977 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25978 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
25979 !! wikitext
25980 [[Football]]
25981 [[Football]]
25982 [[Football|Foot]][[Football|ball]]
25983 !! end
25984
25985 !! test
25986 2. Merge adjacent link nodes and enable additional normalizations
25987 !! options
25988 parsoid={
25989 "modes": ["html2wt"],
25990 "scrubWikitext": true
25991 }
25992 !! html/parsoid
25993 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
25994 !! wikitext
25995 [[Football|''Football'']]
25996 !! end
25997
25998 !! test
25999 3. Don't merge adjacent link nodes if scrubWikitext is false
26000 !! options
26001 parsoid={
26002 "modes": ["html2wt"],
26003 "scrubWikitext": false
26004 }
26005 !! html/parsoid
26006 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26007 !! wikitext
26008 [[Football|Foot]][[Football|ball]]
26009 !! end
26010
26011 #------------------------------
26012 # End of tag minimization tests
26013 #------------------------------
26014
26015 !!test
26016 Bug 54262: New entities
26017 !! options
26018 parsoid=html2wt
26019 !! html/parsoid
26020 <span typeof="mw:Entity">&nbsp;</span>
26021 !! wikitext
26022 &nbsp;
26023 !! end
26024
26025 ## Note that there is no wikitext output for 'unknownproperty' ##
26026 ## Unknown magic words are silently dropped ##
26027
26028 !! test
26029 Magic words
26030 !! options
26031 parsoid=html2wt
26032 !! html/parsoid
26033 <meta property='mw:PageProp/toc' />
26034 <meta property='mw:PageProp/notoc' />
26035 <meta property='mw:PageProp/forcetoc' />
26036 <meta property='mw:PageProp/index' />
26037 <meta property='mw:PageProp/noindex' />
26038 <meta property='mw:PageProp/nogallery' />
26039 <meta property='mw:PageProp/noeditsection' />
26040 <meta property='mw:PageProp/notitleconvert' />
26041 <meta property='mw:PageProp/nocontentconvert' />
26042 <meta property='mw:PageProp/unknownproperty' />
26043 !! wikitext
26044 __TOC__
26045 __NOTOC__
26046 __FORCETOC__
26047 __INDEX__
26048 __NOINDEX__
26049 __NOGALLERY__
26050 __NOEDITSECTION__
26051 __NOTITLECONVERT__
26052 __NOCONTENTCONVERT__
26053 !! end
26054
26055 !! test
26056 Consecutive <pre>s should not get merged
26057 !! options
26058 parsoid=html2wt,html2html
26059 !! html/parsoid
26060 <pre>a</pre><pre>b</pre>
26061
26062 <pre>c
26063 </pre><pre>
26064 d</pre>
26065
26066 <pre>e
26067
26068 </pre><pre>
26069
26070 f</pre>
26071 !! wikitext
26072 a
26073
26074 b
26075
26076 c
26077
26078 d
26079
26080 e
26081
26082
26083
26084 f
26085 !! end
26086
26087 !! test
26088 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
26089 !! options
26090 parsoid=html2wt
26091 !! html/parsoid
26092 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
26093 !! wikitext
26094 [[Special:BookSources/1234567890|ISBN 1234567895]]
26095 !! end
26096
26097 !! test
26098 Edited RFC links not serializable as RFC links should serialize as extlinks
26099 !! options
26100 parsoid=html2wt
26101 !! html/parsoid
26102 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
26103 !! wikitext
26104 [//tools.ietf.org/html/rfc123 New RFC]
26105 !! end
26106
26107 !! test
26108 Edited PMID links not serializable as PMID links should serialize as extlinks
26109 !! options
26110 parsoid=html2wt
26111 !! html/parsoid
26112 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
26113 !! wikitext
26114 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
26115 !! end
26116
26117 !! test
26118 WTS of autolinks with trailing/surrounding context
26119 !! options
26120 parsoid=html2wt
26121 !! html/parsoid
26122 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
26123 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
26124 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
26125 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
26126 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
26127 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
26128 !! wikitext
26129 http://cscott.net'''foo'''
26130
26131 http://cscott.net<b>foo</b>
26132
26133 '''http://cscott.net'''
26134
26135 '''http://cscott.net '''
26136
26137 '''http://cscott.net<nowiki/>x'''
26138
26139 http://cscott.net<nowiki/>x
26140 !! end
26141
26142 !! test
26143 WTS of autolinks with nowikis (round-trip)
26144 !! wikitext
26145 x<nowiki/>http://cscott.net<nowiki/>x
26146 !! html/parsoid
26147 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
26148 !! end
26149
26150 # this is the "easy" test because it leaves in place all the
26151 # data-parsoid information indicating this is an autolink
26152 !! test
26153 WTS of autolinks with escapes (editing)
26154 !! options
26155 parsoid={
26156 "modes": ["wt2wt"],
26157 "changes": [
26158 [ "meta", "remove" ]
26159 ]
26160 }
26161 !! wikitext
26162 x<nowiki/>http://cscott.net<nowiki/>x
26163 !! wikitext/edited
26164 x<nowiki/>http://cscott.net<nowiki/>x
26165 !! end
26166
26167 !! test
26168 WTS of edited autolink-like text (T103364)
26169 !! options
26170 parsoid={
26171 "modes": ["wt2wt"],
26172 "changes": [
26173 [ "span[typeof]", "removeAttr", "typeof" ]
26174 ]
26175 }
26176 !! wikitext
26177 Not a link: <nowiki>http://example.com</nowiki>.
26178 !! wikitext/edited
26179 Not a link: <span><nowiki>http://example.com</nowiki></span>.
26180 !! end
26181
26182 !! test
26183 WTS of newly-authored autolink-like text (T103364)
26184 !! options
26185 parsoid=html2wt
26186 !! html/parsoid
26187 <p>http://example.com is not a link.</p>
26188 !! wikitext
26189 <nowiki>http://example.com</nowiki> is not a link.
26190 !! end
26191
26192 !! test
26193 WTS of autolink-like text after an autolink (T108563)
26194 !! options
26195 parsoid=html2wt
26196 !! html/parsoid
26197 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
26198 !! wikitext
26199 http://example.com <nowiki>http://example.com</nowiki> is not a link.
26200 !! end
26201
26202 !! test
26203 Magic links inside links (not autolinked)
26204 !! wikitext
26205 [[Foo|http://example.com]]
26206 [[Foo|RFC 1234]]
26207 [[Foo|PMID 1234]]
26208 [[Foo|ISBN 123456789x]]
26209
26210 [http://foo.com http://example.com]
26211 [http://foo.com RFC 1234]
26212 [http://foo.com PMID 1234]
26213 [http://foo.com ISBN 123456789x]
26214 !! html+tidy
26215 <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>
26216 <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>
26217 !! html/parsoid
26218 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
26219 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
26220 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
26221 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
26222
26223 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
26224 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
26225 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
26226 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
26227 !! end
26228
26229 !! test
26230 Magic links inside image captions (autolinked)
26231 !! wikitext
26232 [[File:Foobar.jpg|thumb|http://example.com]]
26233 [[File:Foobar.jpg|thumb|RFC 1234]]
26234 [[File:Foobar.jpg|thumb|PMID 1234]]
26235 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
26236 !! html+tidy
26237 <div class="thumb tright">
26238 <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>
26239 <div class="thumbcaption">
26240 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26241 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
26242 </div>
26243 </div>
26244 <div class="thumb tright">
26245 <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>
26246 <div class="thumbcaption">
26247 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26248 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
26249 </div>
26250 </div>
26251 <div class="thumb tright">
26252 <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>
26253 <div class="thumbcaption">
26254 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26255 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
26256 </div>
26257 </div>
26258 <div class="thumb tright">
26259 <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>
26260 <div class="thumbcaption">
26261 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26262 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
26263 </div>
26264 </div>
26265 !! html/parsoid
26266 <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>
26267 <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>
26268 <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>
26269 <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>
26270 !! end
26271
26272 !! test
26273 WTS of magic word text (T109371)
26274 !! options
26275 parsoid=html2wt
26276 !! html/parsoid
26277 <p>RFC 1234</p>
26278 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
26279 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
26280 !! wikitext
26281 <nowiki>RFC 1234</nowiki>
26282
26283 [http://foo.com RFC 1234]
26284
26285 [[Foo|RFC 1234]]
26286 !! end
26287
26288 !! test
26289 Edited Redirect link should emit a non-piped wikitext link
26290 !! options
26291 parsoid=html2wt
26292 !! html/parsoid
26293 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
26294 !! wikitext
26295 #REDIRECT [[Bar]]
26296 !! end
26297
26298 !! test
26299 T75121: Infer extension name from typeOf if data-mw is not present
26300 !! options
26301 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26302 !! html/parsoid
26303 <div typeOf="mw:Extension/foo"></div>
26304 !! wikitext
26305 <foo />
26306 !! end
26307
26308 # Note that the <p> wrapping isn't present in PHP parser output
26309 # The important thing for this test is that P-wrapping doesn't
26310 # interfere with the <nowiki> protection for leading - in <td>
26311 # (which isn't necessary for <th>).
26312 !! test
26313 T88318: p-wrapped dash in table.
26314 !! options
26315 parsoid=html2wt,wt2wt
26316 !! html/parsoid
26317 <table><tbody>
26318 <tr><th><p>-</p></th><th><p>- </p></th></tr>
26319 <tr><td><p>-</p></td><td><p>- </p></td></tr>
26320 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
26321 </tbody></table>
26322 !! wikitext
26323 {|
26324 !-
26325 !-
26326 |-
26327 |<nowiki>-</nowiki>
26328 |<nowiki>- </nowiki>
26329 |-
26330 |<small>-</small>
26331 |<br>
26332 -
26333 |<br>
26334 -
26335 |}
26336 !! html/php+tidy
26337 <table>
26338 <tr>
26339 <th>-</th>
26340 <th>-</th>
26341 </tr>
26342 <tr>
26343 <td>-</td>
26344 <td>-</td>
26345 </tr>
26346 <tr>
26347 <td><small>-</small></td>
26348 <td><br />
26349 <p>-</p>
26350 </td>
26351 <td><br />
26352 <p>-</p>
26353 </td>
26354 </tr>
26355 </table>
26356 !! end
26357
26358 !! test
26359 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
26360 !! options
26361 parsoid=html2wt
26362 !! html/parsoid
26363 <table id='mwAb'>
26364 <td id='mwAc'>foo</td>
26365 <td id='serialize-this'>bar</td>
26366 </table>
26367 !! wikitext
26368 {|
26369 |foo
26370 | id="serialize-this" |bar
26371 |}
26372 !! end
26373
26374 !! test
26375 Parsoid-like element ids should not be serialized to wikitext unless shadowed
26376 !! options
26377 parsoid=html2wt
26378 !! html/parsoid
26379 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
26380 !! wikitext
26381 <div id="hello">ok</div>
26382 !! end
26383
26384 !! test
26385 WTS change modes
26386 !! options
26387 parsoid={
26388 "modes": ["wt2wt"],
26389 "changes": [
26390 [ "#xyz", "before", "<b>before</b> stuff " ],
26391 [ "#xyz", "after", " stuff <i>after</i>" ],
26392 [ "#xyz", "html", "x <b>y</b> z" ]
26393 ]
26394 }
26395 !! wikitext
26396 <span id="xyz">hello</span>
26397 !! wikitext/edited
26398 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
26399 !! end
26400
26401 !! test
26402 Never serialize a-tag as html, regardless of what data-parsoid has to say
26403 !! options
26404 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26405 !! html/parsoid
26406 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
26407 !! wikitext
26408 [[Foo]]
26409 !! end
26410
26411 ## SSS FIXME: This is broken output nevertheless.
26412 ## What might be a reasonable non-broken output for this?
26413 ## This is an edge case unlikely to be seen in production
26414 ## that I am not wasting more time on this right now.
26415 !! test
26416 Never serialize a-tag as html, no matter what attributes it has
26417 !! options
26418 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26419 !! html/parsoid
26420 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
26421 !! wikitext
26422 [http://boo.org http://boohoo.org]
26423 !! end
26424
26425 # Misnested is an indication that selser can reuse the source but these have
26426 # shown to sneak through on occasion. See T101768.
26427 # The original wikitext here is: [http://test.com [[one]] two three]
26428 !! test
26429 Strip span tags added to mark misnested links
26430 !! options
26431 parsoid=html2wt
26432 !! html/parsoid
26433 <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>
26434 !! wikitext
26435 [http://test.com][[one]] two three
26436 !! end
26437
26438 !! test
26439 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
26440 !! options
26441 parsoid=html2wt
26442 !! html/parsoid
26443 <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|}"]}'>
26444 <tbody><tr><td>d
26445 </td></tr>
26446 </tbody></table>
26447 !! wikitext
26448 {{echo|a}}
26449 {|{{echo|c
26450 {{!}}d
26451 }}
26452 |}
26453 !! end
26454
26455 ## This test verifies the presence and computation of this attribute indirectly
26456 ## by making an edit and ensuring that the serialization is correct (which it would be
26457 ## only if firstWikitextNode is properly set).
26458 !! test
26459 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
26460 !! options
26461 parsoid= {
26462 "modes": ["wt2wt"],
26463 "changes": [
26464 [ "div#x", "remove" ],
26465 [ "div", "before", "<div>new</div>" ]
26466 ]
26467 }
26468 !! wikitext
26469 <div id="x">foo</div>
26470 {|
26471 {{echo|<div>boo</div>
26472 {{!}}b}}
26473 |c
26474 |}
26475 !! wikitext/edited
26476
26477 <div>new</div>
26478 {|
26479 {{echo|<div>boo</div>
26480 {{!}}b}}
26481 |c
26482 |}
26483 !! end
26484
26485 # --------------------------------------------
26486 # Tests spec'ing wikitext serialization norms |
26487 # --------------------------------------------
26488
26489 !! test
26490 1. Categories should always be serialized on their own line
26491 !! options
26492 parsoid=html2wt
26493 !! html/parsoid
26494 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
26495 !! wikitext
26496 foo
26497 [[Category:Foo]]
26498 bar
26499 !! end
26500
26501 !! test
26502 2. Categories that are part of templates should not introduce a line break
26503 !! wikitext
26504 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
26505 !! html/parsoid
26506 <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>
26507 !! end
26508
26509 # Careful while editing these next 2 tests. There are \u200f characters
26510 # before and after the <link> tags in the HTML and following some
26511 # of the categories in wikitext
26512 # Do not remove these characters in edits.
26513 #
26514 # As part of the serialization, these bidi characters will get stripped.
26515 !! test
26516 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
26517 !! options
26518 parsoid={
26519 "modes": ["html2wt"],
26520 "scrubWikitext": true
26521 }
26522 !! html/parsoid
26523 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
26524 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
26525 !! wikitext
26526 [[קטגוריה:טקסים]]
26527 [[קטגוריה: שיטות משפט]]
26528 !! end
26529
26530 !! test
26531 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
26532 !! options
26533 parsoid={
26534 "modes": ["html2wt"],
26535 "scrubWikitext": true
26536 }
26537 !! html/parsoid
26538 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
26539 !! wikitext
26540 [[קטגוריה:טקסים]]
26541 ‏y
26542 !! end
26543
26544 !! test
26545 Lists: Add space after bullets
26546 !! options
26547 parsoid=html2wt
26548 !! html/parsoid
26549 <ul>
26550 <li>foo</li>
26551 <li> bar</li>
26552 <li><span> baz</span></li>
26553 </ul>
26554 !! wikitext
26555 * foo
26556 * bar
26557 * <span> baz</span>
26558 !! end
26559
26560 !! test
26561 1. Headings: Add space before/after == (T53744)
26562 !! options
26563 parsoid=html2wt
26564 !! html/parsoid
26565 <h2>foo</h2>
26566 <h2> bar</h2>
26567 <h2>baz </h2>
26568 <h2><span> baz</span></h2>
26569 !! wikitext
26570 == foo ==
26571
26572 == bar ==
26573
26574 == baz ==
26575
26576 == <span> baz</span> ==
26577 !! end
26578
26579 !! test
26580 2. Headings: Add space before/after == even after hoisted content
26581 !! options
26582 parsoid={
26583 "modes": ["html2wt"],
26584 "scrubWikitext": true
26585 }
26586 !! html/parsoid
26587 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
26588 !! wikitext
26589 [[Category:A2]]
26590
26591 == ok ==
26592 !! end
26593
26594 !! test
26595 1. Headings: suppress newly created empty headings
26596 !! options
26597 parsoid={
26598 "modes": ["html2wt"],
26599 "scrubWikitext": true
26600 }
26601 !! html/parsoid
26602 <h2></h2>
26603 !! wikitext
26604 !! end
26605
26606 !! test
26607 2. Headings: don't suppress empty headings if scrubWikitext is false
26608 !! options
26609 parsoid=html2wt
26610 !! html/parsoid
26611 <h2></h2>
26612 !! wikitext
26613 ==<nowiki/>==
26614 !! end
26615
26616 !! test
26617 3. Headings: suppress empty headings on edits
26618 !! options
26619 parsoid={
26620 "modes": ["selser"],
26621 "scrubWikitext": true,
26622 "changes": [
26623 [ "#x", "remove"]
26624 ]
26625 }
26626 !! wikitext
26627 ==<span id="x">foo</span>==
26628 !! wikitext/edited
26629 !! end
26630
26631 !! test
26632 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
26633 !! options
26634 parsoid={
26635 "modes": ["html2wt"],
26636 "scrubWikitext": true
26637 }
26638 !! html/parsoid
26639 <h2>foo<br/>bar</h2>
26640 <h2>foo <span><br/>bar</span> baz</h2>
26641 !! wikitext
26642 == foo bar ==
26643
26644 == foo <span> bar</span> baz ==
26645 !! end
26646
26647 !! test
26648 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
26649 !! options
26650 parsoid={
26651 "modes": ["html2wt"],
26652 "scrubWikitext": false
26653 }
26654 !! html/parsoid
26655 <h2>foo<br/>bar</h2>
26656 !! wikitext
26657 == foo<br> bar ==
26658 !! end
26659
26660 !! test
26661 1. WT Quote Tags: suppress newly created empty style tags
26662 !! options
26663 parsoid={
26664 "modes": ["html2wt"],
26665 "scrubWikitext": true
26666 }
26667 !! html/parsoid
26668 <i></i><b></b>
26669 !! wikitext
26670 !! end
26671
26672 !! test
26673 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
26674 !! options
26675 parsoid=html2wt
26676 !! html/parsoid
26677 <i></i><b></b>
26678 !! wikitext
26679 ''<nowiki/>'''''<nowiki/>'''
26680 !! end
26681
26682 !! test
26683 3. WT Quote Tags: suppress empty style tags on edits
26684 !! options
26685 parsoid={
26686 "modes": ["selser"],
26687 "scrubWikitext": true,
26688 "changes": [
26689 [ "#x", "remove"]
26690 ]
26691 }
26692 !! wikitext
26693 '''<span id="x">foo</span>'''
26694 !! wikitext/edited
26695 !! end
26696
26697 !! test
26698 1. Anchors: suppress newly created empty anchors
26699 !! options
26700 parsoid={
26701 "modes": ["html2wt"],
26702 "scrubWikitext": true
26703 }
26704 !! html/parsoid
26705 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26706 !! wikitext
26707 !! end
26708
26709 !! test
26710 2. Anchors: don't suppress empty anchors if scrubWikitext is false
26711 !! options
26712 parsoid={
26713 "modes": ["html2wt"],
26714 "scrubWikitext": false
26715 }
26716 !! html/parsoid
26717 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26718 !! wikitext
26719 [[Test|<nowiki/>]]
26720 !! end
26721
26722 !! test
26723 3. Anchors: suppress empty anchors on edits
26724 !! options
26725 parsoid={
26726 "modes": ["selser"],
26727 "scrubWikitext": true,
26728 "changes": [
26729 [ "#x", "remove"]
26730 ]
26731 }
26732 !! wikitext
26733 [[Test|<span id="x">foo</span>]]
26734 !! wikitext/edited
26735 !! end
26736
26737 !! test
26738 3a. Anchors: do not suppress numbered extlinks
26739 !! options
26740 parsoid={
26741 "modes": ["wt2wt"],
26742 "scrubWikitext": true
26743 }
26744 !! wikitext
26745 [http://foo.com]
26746 !! html/parsoid
26747 <a rel="mw:ExtLink" href="http://foo.com"></a>
26748 !! end
26749
26750 !! test
26751 3b. Anchors: do not suppress numbered extlinks
26752 !! options
26753 parsoid={
26754 "modes": ["wt2wt"],
26755 "scrubWikitext": true,
26756 "changes": [
26757 [ "#x", "remove"]
26758 ]
26759 }
26760 !! wikitext
26761 [http://foo.com <span id="x">foo</span>]
26762 !! wikitext/edited
26763 [http://foo.com]
26764 !! end
26765
26766 !!test
26767 Normalizations should be restricted to edited content
26768 !!options
26769 parsoid={
26770 "modes": ["selser"],
26771 "scrubWikitext": true,
26772 "changes": [
26773 [ "h1", "before", "<i></i>"]
26774 ]
26775 }
26776 !!wikitext
26777 a
26778 = =
26779 b
26780 !!wikitext/edited
26781 a
26782 = =
26783 b
26784 !!end
26785
26786 !! test
26787 1. Multiple normalizations (html2wt)
26788 !! options
26789 parsoid={
26790 "modes": ["html2wt"],
26791 "scrubWikitext": true
26792 }
26793 !! html
26794 <h2><i></i></h2>
26795 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
26796 </a><b><i></i></b>x</p>
26797 !! wikitext
26798
26799 [[foo]]
26800 x
26801
26802 !! end
26803
26804 !! test
26805 2. Multiple normalizations (selser)
26806 !! options
26807 parsoid={
26808 "modes": ["selser"],
26809 "scrubWikitext": true,
26810 "changes": [
26811 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
26812 ]
26813 }
26814 !! wikitext
26815 <span id="x">foo</span>
26816 !! wikitext/edited
26817 <span id="x">foo</span>
26818
26819 x
26820 !! end
26821
26822 !! test
26823 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
26824 !! options
26825 parsoid={
26826 "modes": ["html2wt"],
26827 "scrubWikitext": true
26828 }
26829 !! html/parsoid
26830 <p> hi</p>
26831 <p> hello</p>
26832 !! wikitext
26833 hi
26834
26835 hello
26836 !! end
26837
26838 !! test
26839 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
26840 !! options
26841 parsoid=html2wt
26842 !! html/parsoid
26843 <p> hi</p>
26844 <p> hello</p>
26845 !! wikitext
26846 <nowiki> </nowiki>hi
26847
26848 <nowiki> </nowiki> hello
26849 !! end
26850
26851 !! test
26852 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
26853 !! options
26854 parsoid={
26855 "modes": ["html2wt"],
26856 "scrubWikitext": true
26857 }
26858 !! html/parsoid
26859 <p>Foo
26860 bar
26861 baz</p>
26862
26863 <table><tr><td>Foo
26864 bar
26865 baz bang</td></tr></table>
26866
26867 <p><!--boo--> foo
26868 bar</p>
26869
26870 <p> foo
26871 bar<span>boo</span></p>
26872 !! wikitext
26873 Foo
26874 bar
26875 baz
26876
26877 {|
26878 |Foo
26879 bar
26880 baz bang
26881 |}
26882
26883 <!--boo-->foo
26884 bar
26885
26886 foo
26887 bar<span>boo</span>
26888 !! end
26889
26890 !! test
26891 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
26892 !! options
26893 parsoid={
26894 "modes": ["selser"],
26895 "scrubWikitext": true,
26896 "changes": [
26897 [ "p", "html", " a\n b" ]
26898 ]
26899 }
26900 !! wikitext
26901 xyz
26902 !! wikitext/edited
26903 a
26904 b
26905 !! end
26906
26907 !! test
26908 1. New links that end in spaces
26909 !! options
26910 parsoid={
26911 "modes": ["html2wt"],
26912 "scrubWikitext": false
26913 }
26914 !! html/parsoid
26915 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26916 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26917 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26918 !! wikitext
26919 [[Berlin ]]<nowiki/>is the capital of Germany.
26920
26921 [[Foo ]]'''bar'''
26922
26923 [[Boston ]] is a city.
26924 !! end
26925
26926 !! test
26927 2. New links that end in spaces
26928 !! options
26929 parsoid={
26930 "modes": ["html2wt"],
26931 "scrubWikitext": true
26932 }
26933 !! html/parsoid
26934 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26935 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26936 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26937 !! wikitext
26938 [[Berlin]] is the capital of Germany.
26939
26940 [[Foo]] '''bar'''
26941
26942 [[Boston]] is a city.
26943 !! end
26944
26945 !! test
26946 1. Table cells with escapable prefixes
26947 !! options
26948 parsoid={
26949 "modes": ["html2wt"],
26950 "scrubWikitext": false
26951 }
26952 !! html
26953 <table>
26954 <tr><td>a</td></tr>
26955 <tr><td>-</td></tr>
26956 <tr><td>+</td></tr>
26957 </table>
26958 !! wikitext
26959 {|
26960 |a
26961 |-
26962 |<nowiki>-</nowiki>
26963 |-
26964 |<nowiki>+</nowiki>
26965 |}
26966 !! end
26967
26968 !! test
26969 2. Table cells with escapable prefixes
26970 !! options
26971 parsoid={
26972 "modes": ["html2wt"],
26973 "scrubWikitext": true
26974 }
26975 !! html
26976 <table>
26977 <tr><td>a</td></tr>
26978 <tr><td>-</td></tr>
26979 <tr><td>+</td></tr>
26980 </table>
26981 !! wikitext
26982 {|
26983 |a
26984 |-
26985 | -
26986 |-
26987 | +
26988 |}
26989 !! end
26990
26991 !! test
26992 3a. Table cells with escapable prefixes after edits
26993 !! options
26994 parsoid={
26995 "modes": ["selser"],
26996 "scrubWikitext": true,
26997 "changes": [
26998 [ "table tbody tr:first-child td:first-child", "remove"]
26999 ]
27000 }
27001 !! wikitext
27002 {|
27003 |a||-
27004 |}
27005 !! wikitext/edited
27006 {|
27007 | -
27008 |}
27009 !! end
27010
27011 !! test
27012 3b. Table cells with escapable prefixes after edits
27013 !! options
27014 parsoid={
27015 "modes": ["selser"],
27016 "scrubWikitext": true,
27017 "changes": [
27018 [ "table tbody tr:first-child td:first-child", "html", "-" ],
27019 [ "#x", "remove" ]
27020 ]
27021 }
27022 !! wikitext
27023 {|
27024 |pqr
27025 |<span id="x">foo</span>+
27026 |}
27027 !! wikitext/edited
27028 {|
27029 | -
27030 | +
27031 |}
27032 !! end
27033
27034 # FIXME: This test will fail because
27035 # normalization doesn't realize that the id attribute
27036 # will eliminate the escapable scenario
27037 !! test
27038 4a. Table cells without escapable prefixes after edits
27039 !! options
27040 parsoid={
27041 "modes": ["selser"],
27042 "scrubWikitext": true,
27043 "changes": [
27044 [ "#x", "html", "-" ]
27045 ]
27046 }
27047 !! wikitext
27048 {|
27049 | id="x" |abcd
27050 |}
27051 !! wikitext/edited
27052 {|
27053 | id="x" |-
27054 |}
27055 !! end
27056
27057 ## This tests normalizer's ability to discriminate between
27058 ## cells having identical content.
27059 !! test
27060 4b. Table cells without escapable prefixes after edits
27061 !! options
27062 parsoid={
27063 "modes": ["selser"],
27064 "scrubWikitext": true,
27065 "changes": [
27066 [ "td", "html", "-" ]
27067 ]
27068 }
27069 !! wikitext
27070 {|
27071 |a||b
27072 |}
27073 !! wikitext/edited
27074 {|
27075 | -||-
27076 |}
27077 !! end
27078
27079 ## This tests normalizer's ability to not be tripped by
27080 ## comments (and whitespace)
27081 !! test
27082 4c. Table cells without escapable prefixes after edits
27083 !! options
27084 parsoid={
27085 "modes": ["selser"],
27086 "scrubWikitext": true,
27087 "changes": [
27088 [ "table tbody tr td:first-child", "remove" ]
27089 ]
27090 }
27091 !! wikitext
27092 {|
27093 |-
27094 <!--foo--> |a||-
27095 |}
27096 !! wikitext/edited
27097 {|
27098 |-
27099 <!--foo--> | -
27100 |}
27101 !! end
27102
27103 ## This tests normalizer's ability to handle HTML cells
27104 !! test
27105 4d. Table cells without escapable prefixes after edits
27106 !! options
27107 parsoid={
27108 "modes": ["selser"],
27109 "scrubWikitext": true,
27110 "changes": [
27111 [ "td", "html", "-" ]
27112 ]
27113 }
27114 !! wikitext
27115 <table>
27116 <tr><td>a</td></tr>
27117 </table>
27118 !! wikitext/edited
27119 <table>
27120 <tr><td>-</td></tr>
27121 </table>
27122 !! end
27123
27124 ## T111151 Remove font elements without attributes
27125 !! test
27126 5a. font tags without attributes should be dropped in scrubWikitext mode
27127 !! options
27128 parsoid={
27129 "modes": ["html2wt"],
27130 "scrubWikitext": true
27131 }
27132 !! html
27133 <font>foo</font>
27134 <font><font>bar</font></font>
27135 <font class="x">boo</font>
27136 !! wikitext
27137 foo
27138 bar
27139 <font class="x">boo</font>
27140 !! end
27141
27142 !! test
27143 5b. font tags should not be dropped without scrubWikitext being enabled
27144 !! options
27145 parsoid={
27146 "modes": ["html2wt"],
27147 "scrubWikitext": false
27148 }
27149 !! html
27150 <font>foo</font>
27151 !! wikitext
27152 <font>foo</font>
27153 !! end
27154
27155 !! test
27156 Escape nowiki DOM elements
27157 !! options
27158 parsoid=html2wt
27159 !! html/parsoid
27160 <nowiki><i>foo</i></nowiki>
27161 !! wikitext
27162 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
27163 !! end
27164
27165 # This is meant to be an interim fix while we go about figuring out
27166 # how to not introduce these trailing <nowiki/>s in the first place.
27167 !! test
27168 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
27169 !! options
27170 parsoid=html2wt
27171 !! html/parsoid
27172 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
27173 y</p>
27174 <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>
27175 <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>
27176 !! wikitext
27177 x
27178 y
27179
27180 {{echo|
27181 1 = <nowiki/>}}
27182
27183 {{echo|
27184 1 = <nowiki/>
27185 }}
27186 !! end
27187
27188 # ---------------------------------------------------
27189 # End of tests spec'ing wikitext serialization norms |
27190 # ---------------------------------------------------
27191
27192 # T104032
27193 !! test
27194 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
27195 !! options
27196 parsoid=html2wt
27197 !! html/parsoid
27198 a<p>b</p>
27199 <b>c</b><p>d</p>
27200 <table><tr>
27201 <td>a<p>b</p></td>
27202 <td><b>c</b><p>d</p></td>
27203 </tr></table>
27204 !! wikitext
27205 a
27206
27207 b
27208
27209 '''c'''
27210
27211 d
27212 {|
27213 |a
27214 b
27215 |'''c'''
27216 d
27217 |}
27218 !! end
27219
27220 # -----------------------------------------------------------------
27221 # End of section for Parsoid-only html2wt tests for serialization
27222 # of new content
27223 # -----------------------------------------------------------------
27224
27225 # -----------------------------------------------------------------
27226 # The following section of tests are primarily to spec behavior of
27227 # the selective serializer. All these tests have manual selser
27228 # changes. The automated selser changes for all tests handle the
27229 # wide variation of changes, but these tests here capture specs
27230 # deterministically.
27231 # ----------------------------------------------------------------
27232
27233 ## T90517
27234 !! test
27235 Selser: New comments should not be lost
27236 !! options
27237 parsoid={
27238 "modes": ["selser"],
27239 "changes": [
27240 [ "#a", "after", "<!--c1-->" ],
27241 [ "#b", "before", "<!--c2-->" ]
27242 ]
27243 }
27244 !! wikitext
27245 <span id="a">a</span>
27246
27247 <span id="b">b</span>
27248 !! wikitext/edited
27249 <span id="a">a</span><!--c1-->
27250
27251 <!--c2--><span id="b">b</span>
27252 !! end
27253
27254 ## T89383
27255 !! test
27256 Selser: Check for validity of DSR before using it
27257 !! options
27258 parsoid={
27259 "modes": ["selser"],
27260 "changes": [
27261 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
27262 ]
27263 }
27264 !! wikitext
27265 <span id="a">a</span>
27266 !! wikitext/edited
27267 {{DISPLAYTITLE:foo}}
27268 <span id="a">a</span>
27269 !! end
27270
27271 !! test
27272 1. DOMDiff: Changes to <ref> content should be looked up using id
27273 !! options
27274 parsoid={
27275 "modes": ["selser"],
27276 "changes": [
27277 ["#X", "after", "bar"],
27278 ["#Y", "after", "baz"]
27279 ]
27280 }
27281 !! wikitext
27282 X <ref><span id="X">foo</span></ref>
27283 Y <ref name="a" />
27284 <references>
27285 <ref name="a"><span id="Y">foo</span></ref>
27286 </references>
27287 !! wikitext/edited
27288 X <ref><span id="X">foo</span>bar</ref>
27289 Y <ref name="a" />
27290 <references>
27291 <ref name="a"><span id="Y">foo</span>baz</ref>
27292 </references>
27293 !! end
27294
27295 !! test
27296 2. DOMDiff: Changes to <ref> content should be looked up using id
27297 !! options
27298 parsoid={
27299 "modes": ["selser"],
27300 "changes": [
27301 ["#Z", "after", "bar"]
27302 ]
27303 }
27304 !! wikitext
27305 A <ref>foo bar for a</ref>
27306 B <ref group="X" name="b" />
27307
27308 <references />
27309
27310 <references group="X">
27311 <ref name="b"><span id="Z">foo</span></ref>
27312 </references>
27313 !! wikitext/edited
27314 A <ref>foo bar for a</ref>
27315 B <ref group="X" name="b" />
27316
27317 <references />
27318
27319 <references group="X">
27320 <ref name="b"><span id="Z">foo</span>bar</ref>
27321 </references>
27322 !! end
27323
27324 !! test
27325 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
27326 !! options
27327 parsoid={
27328 "modes": ["selser"],
27329 "changes": [
27330 [ "div:first-child", "text", "bar" ]
27331 ]
27332 }
27333 !! wikitext
27334 <div style="{{1x|color:red;}}%">foo</div>
27335 !! wikitext/edited
27336 <div style="{{1x|color:red;}}%">bar</div>
27337 !! end
27338
27339 !! test
27340 Empty LI (T49673)
27341 !! wikitext
27342 * a
27343 *
27344 *
27345 * b
27346 !! html/php+tidy
27347 <ul>
27348 <li>a</li>
27349 <li class="mw-empty-elt"></li>
27350 <li class="mw-empty-elt"></li>
27351 <li>b</li>
27352 </ul>
27353 !! end
27354
27355 !! test
27356 Thumbnail output
27357 !! wikitext
27358 [[File:Thumb.png|thumb]]
27359 !! html/php+tidy
27360 <div class="thumb tright">
27361 <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>
27362 <div class="thumbcaption">
27363 <div class="magnify"><a href="/wiki/File:Thumb.png" class="internal" title="Enlarge"></a></div>
27364 </div>
27365 </div>
27366 </div>
27367 !! end
27368
27369 !! test
27370 unclosed internal link XSS (T137264)
27371 !! wikitext
27372 [[#%3Cscript%3Ealert(1)%3C/script%3E|
27373 !! html/php
27374 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
27375 </p>
27376 !! html/parsoid
27377 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
27378 !! end