3e9fef88269f585e0994a4581d9409ea710fb466
[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 #
40 # For testing purposes, temporary articles can created:
41 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
42 # where '/' denotes a newline.
43
44 # This is the standard article assumed to exist.
45 !! article
46 Main Page
47 !! text
48 blah blah
49 !! endarticle
50
51 !!article
52 Foo
53 !!text
54 FOO
55 !!endarticle
56
57 !!article
58 Template:Foo
59 !!text
60 FOO
61 !!endarticle
62
63 !! article
64 Template:Blank
65 !! text
66 !! endarticle
67
68 !! article
69 Template:pipe
70 !! text
71 |
72 !! endarticle
73
74 !! article
75 Template:=
76 !! text
77 <nowiki>=</nowiki>
78 !! endarticle
79
80 !!article
81 MediaWiki:bad image list
82 !!text
83 * [[File:Bad.jpg]] except [[Nasty page]]
84 !!endarticle
85
86 !! article
87 Template:inner list
88 !! text
89 * item 1
90 !! endarticle
91
92 !! article
93 Template:tbl-start
94 !! text
95 {|
96 !! endarticle
97
98 !! article
99 Template:tbl-end
100 !! text
101 |}
102 !! endarticle
103
104 !! article
105 Template:echo
106 !! text
107 {{{1}}}
108 !! endarticle
109
110 !! article
111 Template:echo_with_span
112 !! text
113 <span>{{{1}}}</span>
114 !! endarticle
115
116 !! article
117 Template:echo_with_div
118 !! text
119 <div>{{{1}}}</div>
120 !! endarticle
121
122 !! article
123 Template:blank_param
124 !! text
125 {{{1}}}
126 {{{}}}
127 !! endarticle
128
129 !! article
130 Template:table_attribs
131 !! text
132 <noinclude>
133 |</noinclude>style="color:red;"|Foo
134 !! endarticle
135
136 !! article
137 Template:table_attribs_2
138 !! text
139 <noinclude>
140 |</noinclude>style="color:red;"|Foo
141 |Bar||Baz
142 !! endarticle
143
144 !! article
145 Template:table_attribs_3
146 !! text
147 <noinclude>
148 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
149 !! endarticle
150
151 !! article
152 Template:table_attribs_4
153 !! text
154 | style="background-color:#DC241f;" width="10px" |
155 !! endarticle
156
157 !! article
158 Template:table_attribs_5
159 !! text
160 <noinclude>
161 |</noinclude>style="color:red;"||Bar
162 !! endarticle
163
164 !! article
165 Template:table_attribs_6
166 !! text
167 style="background: <nowiki>
168
169
170 red;</nowiki>" |
171 !! endarticle
172
173 !! article
174 Template:table_attribs_7
175 !! text
176 <noinclude>
177 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
178 !! endarticle
179
180 !! article
181 Template:table_header_cells
182 !! text
183 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
184 !! endarticle
185
186 !! article
187 Template:table_cells
188 !! text
189 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
190 !! endarticle
191
192 !! article
193 Template:PartialTable
194 !! text
195 {|
196 |-
197 !! endarticle
198
199 !! article
200 Template:image_attribs
201 !! text
202 <noinclude>
203 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
204 !! endarticle
205
206 ## See T48811 for details
207 !! article
208 Template:mixed_attr_content_template
209 !! text
210 style="color:red;" title="T48811"
211 |-
212 |foo
213 !! endarticle
214
215 !! article
216 Template:definition_list
217 !! text
218 one
219 ::two
220 !! endarticle
221
222 !! article
223 A?b
224 !! text
225 Weirdo titles!
226 !! endarticle
227
228 !!article
229 Template:Bullet
230 !!text
231 * Bar
232 !!endarticle
233
234 !!article
235 Template:OpenTable
236 !!text
237 {|
238 !!endarticle
239
240 !!article
241 Template:EmptyLITest
242 !!text
243 *a
244 *
245 *
246 *b
247 !!endarticle
248
249 !!article
250 Template:EmptyTRTest
251 !!text
252 {|
253 |-
254 |-
255 |foo
256 |-
257 |-
258 |bar
259 |}
260 !!endarticle
261
262 !!article
263 Template:EmptyTRWithHTMLAttrTest
264 !!text
265 <table>
266 <tr align="center"></tr>
267 <tr><td>foo</td></tr>
268 <tr align="center"></tr>
269 <tr><td>bar</td></tr>
270 </table>
271 !!endarticle
272
273 ###
274 ### Basic tests
275 ###
276 !! test
277 Blank input
278 !! wikitext
279 !! html
280 !! end
281
282
283 !! test
284 Simple paragraph
285 !! wikitext
286 This is a simple paragraph.
287 !! html
288 <p>This is a simple paragraph.
289 </p>
290 !! end
291
292 !! test
293 Paragraphs with extra newline spacing
294 !! wikitext
295 foo
296
297 bar
298
299
300 baz
301
302
303
304 booz
305 !! html
306 <p>foo
307 </p><p>bar
308 </p><p><br />
309 baz
310 </p><p><br />
311 </p><p>booz
312 </p>
313 !! end
314
315 !! test
316 Paragraphs with newline spacing with comment lines in between
317 !! wikitext
318 ----
319 a
320 <!--foo-->
321 b
322 ----
323 a
324 <!--foo--><!--More than 1 comment, still stripped-->
325 b
326 ----
327 a
328 <!--foo--> <!----> <!-- bar -->
329 b
330 ----
331 a
332 <!--foo-->
333
334 b
335 ----
336 a
337
338 <!--foo-->
339 b
340 ----
341 a
342 <!--foo-->
343
344
345 b
346 ----
347 a
348
349
350 <!--foo-->
351 b
352 ----
353 !! html
354 <hr />
355 <p>a
356 b
357 </p>
358 <hr />
359 <p>a
360 b
361 </p>
362 <hr />
363 <p>a
364 b
365 </p>
366 <hr />
367 <p>a
368 </p><p>b
369 </p>
370 <hr />
371 <p>a
372 </p><p>b
373 </p>
374 <hr />
375 <p>a
376 </p><p><br />
377 b
378 </p>
379 <hr />
380 <p>a
381 </p><p><br />
382 b
383 </p>
384 <hr />
385
386 !! end
387
388 !! test
389 Paragraphs with newline spacing with non-empty white-space lines in between
390 !! wikitext
391 ----
392 a
393
394 b
395 ----
396 a
397
398
399 b
400 ----
401 !! html
402 <hr />
403 <p>a
404 </p><p>b
405 </p>
406 <hr />
407 <p>a
408 </p><p><br />
409 b
410 </p>
411 <hr />
412
413 !! end
414
415 !! test
416 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
417 !! wikitext
418 ----
419 a
420 <!--foo-->
421 b
422 ----
423 a
424 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
425 b
426 ----
427 a
428
429 <!--foo-->
430 <!--bar-->
431 b
432 ----
433 a
434
435 <!--foo-->
436 <!--bar-->
437
438 b
439 ----
440 !! html
441 <hr />
442 <p>a
443 b
444 </p>
445 <hr />
446 <p>a
447 b
448 </p>
449 <hr />
450 <p>a
451 </p><p>b
452 </p>
453 <hr />
454 <p>a
455 </p><p><br />
456 b
457 </p>
458 <hr />
459
460 !! end
461
462 !! test
463 Extra newlines: More paragraphs with indented comment
464 !! wikitext
465 a
466
467 <!--boo-->
468
469 b
470 !! html
471 <p>a
472 </p><p><br />
473 b
474 </p>
475 !!end
476
477 !! test
478 Extra newlines followed by heading
479 !! wikitext
480 a
481
482
483
484 =b=
485 [[a]]
486
487
488 =b=
489 !! html
490 <p>a
491 </p><p><br />
492 </p>
493 <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>
494 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
495 </p><p><br />
496 </p>
497 <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>
498
499 !! end
500
501 !! test
502 Extra newlines between heading and content are swallowed
503 !! wikitext
504 =b=
505
506
507
508 [[a]]
509 !! html
510 <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>
511 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
512 </p>
513 !! end
514
515 !! test
516 Parsing an URL
517 !! wikitext
518 http://fr.wikipedia.org/wiki/🍺
519 <!-- EasterEgg we love beer, better be able be able to link to it -->
520 !! html
521 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
522 </p>
523 !! end
524
525 # Note that the html+tidy output removes the spaces after the <li>,
526 # which is a bug (http://sourceforge.net/p/tidy/bugs/945/, etc).
527 # This is an issue for all tests with lists. We intentionally do
528 # *not* add html+tidy clauses for these, as we don't want to
529 # document/test the broken behavior. (Parsoid matches the non-tidy
530 # output in these cases.)
531
532 !! test
533 Simple list
534 !! wikitext
535 * Item 1
536 * Item 2
537 !! html
538 <ul><li> Item 1</li>
539 <li> Item 2</li></ul>
540
541 !! end
542
543 !! test
544 Italics and bold
545 !! wikitext
546 * plain
547 * plain''italic''plain
548 * plain''italic''plain''italic''plain
549 * plain'''bold'''plain
550 * plain'''bold'''plain'''bold'''plain
551 * plain''italic''plain'''bold'''plain
552 * plain'''bold'''plain''italic''plain
553 * plain''italic'''bold-italic'''italic''plain
554 * plain'''bold''bold-italic''bold'''plain
555 * plain'''''bold-italic'''italic''plain
556 * plain'''''bold-italic''bold'''plain
557 * plain''italic'''bold-italic'''''plain
558 * plain'''bold''bold-italic'''''plain
559 * plain l'''italic''plain
560 * plain l''''bold''' plain
561 !! html
562 <ul><li> plain</li>
563 <li> plain<i>italic</i>plain</li>
564 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
565 <li> plain<b>bold</b>plain</li>
566 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
567 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
568 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
569 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
570 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
571 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
572 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
573 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
574 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
575 <li> plain l'<i>italic</i>plain</li>
576 <li> plain l'<b>bold</b> plain</li></ul>
577
578 !! end
579
580 # this example taken from the [[simple:Moon]] article (bug 47326)
581 !! test
582 Italics and possessives (1)
583 !! wikitext
584 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
585 !! html
586 <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
587 </p>
588 !! end
589
590 # this example taken from [[en:Flaming Pie]] (bug 49926)
591 !! test
592 Italics and possessives (2)
593 !! wikitext
594 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
595 !! html
596 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
597 </p>
598 !! end
599
600 # this example taken from [[en:Dictionary]] (bug 49926)
601 !! test
602 Italics and possessives (3)
603 !! wikitext
604 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''.
605 !! html
606 <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>.
607 </p>
608 !! end
609
610
611 ###
612 ### 2-quote opening sequence tests
613 ###
614 !! test
615 Italics and bold: 2-quote opening sequence: (2,2)
616 !! wikitext
617 ''foo''
618 !! html
619 <p><i>foo</i>
620 </p>
621 !!end
622
623 !! test
624 Italics and bold: 2-quote opening sequence: (2,3)
625 !! wikitext
626 ''foo'''
627 !! html/*
628 <p><i>foo'</i>
629 </p>
630 !!end
631
632 !! test
633 Italics and bold: 2-quote opening sequence: (2,4)
634 !! options
635 parsoid=wt2html
636 !! wikitext
637 ''foo''''
638 !! html/*
639 <p><i>foo''</i>
640 </p>
641 !!end
642
643 # same html as previous, but wikitext adjusted to match parsoid html2wt
644 !! test
645 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
646 !! wikitext
647 ''foo<nowiki>''</nowiki>''
648 !! html
649 <p><i>foo''</i>
650 </p>
651 !! end
652
653 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
654 !! test
655 Italics and bold: 2-quote opening sequence: (2,5)
656 !! options
657 parsoid=wt2html
658 !! wikitext
659 ''foo'''''
660 !! html/php
661 <p><i>foo</i>
662 </p>
663 !! html/parsoid
664 <p><i>foo</i><b></b>
665 </p>
666 !!end
667
668 # same html as previous, but wikitext adjusted to match parsoid html2wt
669 !! test
670 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
671 !! wikitext
672 ''foo'''''<nowiki/>'''
673 !! html/php
674 <p><i>foo</i>
675 </p>
676 !! html/parsoid
677 <p><i>foo</i><b></b>
678 </p>
679 !! end
680
681
682 ###
683 ### 3-quote opening sequence tests
684 ###
685
686 !! test
687 Italics and bold: 3-quote opening sequence: (3,2)
688 !! wikitext
689 '''foo''
690 !! html/*
691 <p>'<i>foo</i>
692 </p>
693 !!end
694
695 !! test
696 Italics and bold: 3-quote opening sequence: (3,3)
697 !! wikitext
698 '''foo'''
699 !! html
700 <p><b>foo</b>
701 </p>
702 !!end
703
704 !! test
705 Italics and bold: 3-quote opening sequence: (3,4)
706 !! wikitext
707 '''foo''''
708 !! html/*
709 <p><b>foo'</b>
710 </p>
711 !!end
712
713 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
714 !! test
715 Italics and bold: 3-quote opening sequence: (3,5)
716 !! options
717 parsoid=wt2html
718 !! wikitext
719 '''foo'''''
720 !! html/php
721 <p><b>foo</b>
722 </p>
723 !! html/parsoid
724 <p><b>foo</b><i></i>
725 </p>
726 !!end
727
728 # same html as previous, but wikitext adjusted to match parsoid html2wt
729 !! test
730 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
731 !! wikitext
732 '''foo'''''<nowiki/>''
733 !! html/php
734 <p><b>foo</b>
735 </p>
736 !! html/parsoid
737 <p><b>foo</b><i></i>
738 </p>
739 !! end
740
741
742 ###
743 ### 4-quote opening sequence tests
744 ###
745
746 !! test
747 Italics and bold: 4-quote opening sequence: (4,2)
748 !! options
749 parsoid=wt2html
750 !! wikitext
751 ''''foo''
752 !! html/*
753 <p>''<i>foo</i>
754 </p>
755 !!end
756
757 # same html as previous, but wikitext adjusted to match parsoid html2wt
758 !! test
759 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
760 !! wikitext
761 <nowiki>''</nowiki>''foo''
762 !! html
763 <p>''<i>foo</i>
764 </p>
765 !! end
766
767 !! test
768 Italics and bold: 4-quote opening sequence: (4,3)
769 !! wikitext
770 ''''foo'''
771 !! html/*
772 <p>'<b>foo</b>
773 </p>
774 !!end
775
776 !! test
777 Italics and bold: 4-quote opening sequence: (4,4)
778 !! options
779 parsoid=wt2html
780 !! wikitext
781 ''''foo''''
782 !! html/*
783 <p>'<b>foo'</b>
784 </p>
785 !!end
786
787 # same html as previous, but wikitext adjusted to match parsoid html2wt
788 !! test
789 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
790 !! wikitext
791 '<nowiki/>'''foo''''
792 !! html
793 <p>'<b>foo'</b>
794 </p>
795 !! end
796
797 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
798 !! test
799 Italics and bold: 4-quote opening sequence: (4,5)
800 !! options
801 parsoid=wt2html
802 !! wikitext
803 ''''foo'''''
804 !! html/php
805 <p>'<b>foo</b>
806 </p>
807 !! html/parsoid
808 <p>'<b>foo</b><i></i>
809 </p>
810 !!end
811
812 # same html as previous, but wikitext adjusted to match parsoid html2wt
813 !! test
814 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
815 !! wikitext
816 '<nowiki/>'''foo'''''<nowiki/>''
817 !! html/php
818 <p>'<b>foo</b>
819 </p>
820 !! html/parsoid
821 <p>'<b>foo</b><i></i>
822 </p>
823 !! end
824
825
826 ###
827 ### 5-quote opening sequence tests
828 ###
829
830 !! test
831 Italics and bold: 5-quote opening sequence: (5,2)
832 !! options
833 parsoid=wt2html
834 !! wikitext
835 '''''foo''
836 !! html/*
837 <p><b><i>foo</i></b>
838 </p>
839 !!end
840
841 # same html as previous, but wikitext adjusted to match parsoid html2wt
842 !! test
843 Italics and bold: 5-quote opening sequence: (5,2+3)
844 !! wikitext
845 '''''foo'''''
846 !! html/*
847 <p><i><b>foo</b></i>
848 </p>
849 !! end
850
851 !! test
852 Italics and bold: 5-quote opening sequence: (5,3)
853 !! options
854 parsoid=wt2html
855 !! wikitext
856 '''''foo'''
857 !! html/*
858 <p><i><b>foo</b></i>
859 </p>
860 !!end
861
862 # same html as previous, but wikitext adjusted to match parsoid html2wt
863 !! test
864 Italics and bold: 5-quote opening sequence: (5,3+2)
865 !! wikitext
866 '''''foo'''''
867 !! html
868 <p><i><b>foo</b></i>
869 </p>
870 !! end
871
872 !! test
873 Italics and bold: 5-quote opening sequence: (5,4)
874 !! options
875 parsoid=wt2html
876 !! wikitext
877 '''''foo''''
878 !! html/*
879 <p><i><b>foo'</b></i>
880 </p>
881 !!end
882
883 !! test
884 Italics and bold: 5-quote opening sequence: (5,5)
885 !! wikitext
886 '''''foo'''''
887 !! html
888 <p><i><b>foo</b></i>
889 </p>
890 !!end
891
892 !! test
893 Italics and bold: 5-quote opening sequence: (5,6)
894 !! wikitext
895 '''''foo''''''
896 !! html/*
897 <p><i><b>foo'</b></i>
898 </p>
899 !! end
900
901 ###
902 ### multiple quote sequences in a line
903 ###
904 !! test
905 Italics and bold: multiple quote sequences: (2,4,2)
906 !! options
907 parsoid=wt2html
908 !! wikitext
909 ''foo''''bar''
910 !! html/*
911 <p><i>foo'<b>bar</b></i>
912 </p>
913 !!end
914
915
916 # same html as previous, but wikitext adjusted to match parsoid html2wt
917 !! test
918 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
919 !! wikitext
920 ''foo'<nowiki/>'''bar'''''
921 !! html
922 <p><i>foo'<b>bar</b></i>
923 </p>
924 !! end
925
926
927 !! test
928 Italics and bold: multiple quote sequences: (2,4,3)
929 !! options
930 parsoid=wt2html
931 !! wikitext
932 ''foo''''bar'''
933 !! html/*
934 <p><i>foo'<b>bar</b></i>
935 </p>
936 !!end
937
938
939 # same html as previous, but wikitext adjusted to match parsoid html2wt
940 !! test
941 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
942 !! wikitext
943 ''foo'<nowiki/>'''bar'''''
944 !! html
945 <p><i>foo'<b>bar</b></i>
946 </p>
947 !! end
948
949
950 !! test
951 Italics and bold: multiple quote sequences: (2,4,4)
952 !! options
953 parsoid=wt2html
954 !! wikitext
955 ''foo''''bar''''
956 !! html/*
957 <p><i>foo'<b>bar'</b></i>
958 </p>
959 !!end
960
961
962 # same html as previous, but wikitext adjusted to match parsoid html2wt
963 !! test
964 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
965 !! wikitext
966 ''foo'<nowiki/>'''bar'<nowiki/>'''''
967 !! html
968 <p><i>foo'<b>bar'</b></i>
969 </p>
970 !! end
971
972
973 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
974 !! test
975 Italics and bold: multiple quote sequences: (3,4,2)
976 !! options
977 parsoid=wt2html
978 !! wikitext
979 '''foo''''bar''
980 !! html/php
981 <p><b>foo'</b>bar
982 </p>
983 !! html/parsoid
984 <p><b>foo'</b>bar<i></i>
985 </p>
986 !!end
987
988 # same html as previous, but wikitext adjusted to match parsoid html2wt
989 !! test
990 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
991 !! options
992 parsoid
993 !! wikitext
994 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
995 !! html/php
996 <p><b>foo'</b>bar
997 </p>
998 !! html/parsoid
999 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
1000 </p>
1001 !! end
1002
1003
1004 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1005 !! test
1006 Italics and bold: multiple quote sequences: (3,4,3)
1007 !! options
1008 parsoid=wt2html
1009 !! wikitext
1010 '''foo''''bar'''
1011 !! html/php
1012 <p><b>foo'</b>bar
1013 </p>
1014 !! html/parsoid
1015 <p><b>foo'</b>bar<b></b>
1016 </p>
1017 !!end
1018
1019 # same html as previous, but wikitext adjusted to match parsoid html2wt
1020 !! test
1021 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1022 !! wikitext
1023 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
1024 !! html/php
1025 <p><b>foo'</b>bar
1026 </p>
1027 !! html/parsoid
1028 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
1029 </p>
1030 !! end
1031
1032 ###
1033 ### other quote tests
1034 ###
1035 !! test
1036 Italics and bold: other quote tests: (2,3,5)
1037 !! wikitext
1038 ''this is about '''foo's family'''''
1039 !! html
1040 <p><i>this is about <b>foo's family</b></i>
1041 </p>
1042 !!end
1043
1044
1045 !! test
1046 Italics and bold: other quote tests: (2,(3,3),2)
1047 !! wikitext
1048 ''this is about '''foo's''' family''
1049 !! html
1050 <p><i>this is about <b>foo's</b> family</i>
1051 </p>
1052 !!end
1053
1054
1055 !! test
1056 Italics and bold: other quote tests: (3,2,3,2)
1057 !! options
1058 parsoid=wt2html
1059 !! wikitext
1060 '''this is about ''foo'''s family''
1061 !! html/*
1062 <p><b>this is about <i>foo</i></b><i>s family</i>
1063 </p>
1064 !!end
1065
1066
1067 # same html as previous, but wikitext adjusted to match parsoid html2wt
1068 !! test
1069 Italics and bold: other quote tests: (3,2,3+2+2,2)
1070 !! wikitext
1071 '''this is about ''foo'''''<nowiki/>''s family''
1072 !! html
1073 <p><b>this is about <i>foo</i></b><i>s family</i>
1074 </p>
1075 !! end
1076
1077
1078 !! test
1079 Italics and bold: other quote tests: (3,2,3,3)
1080 !! wikitext
1081 '''this is about ''foo'''s family'''
1082 !! html/*
1083 <p>'<i>this is about </i>foo<b>s family</b>
1084 </p>
1085 !!end
1086
1087
1088 !! test
1089 Italics and bold: other quote tests: (3,(2,2),3)
1090 !! wikitext
1091 '''this is about ''foo's'' family'''
1092 !! html
1093 <p><b>this is about <i>foo's</i> family</b>
1094 </p>
1095 !!end
1096
1097
1098 !! test
1099 Italicized possessive
1100 !! wikitext
1101 The ''[[Main Page]]'''s talk page.
1102 !! html/php
1103 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1104 </p>
1105 !! html/parsoid
1106 <p>The <i><a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1107 !! end
1108
1109 !! test
1110 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1111 (Requires tidy for PHP parser output to be fixed up)
1112 !! options
1113 parsoid=wt2html,wt2wt
1114 !! wikitext
1115 {|
1116 !''a!!''b
1117 |''a||''b
1118 |}
1119 !! html/php+tidy
1120 <table>
1121 <tr>
1122 <th><i>a</i></th>
1123 <th><i>b</i></th>
1124 <td><i>a</i></td>
1125 <td><i>b</i></td>
1126 </tr>
1127 </table>
1128 !! html/parsoid
1129 <table>
1130 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1131 <td><i>a</i></td><td><i>b</i></td></tr>
1132 </tbody></table>
1133 !! end
1134
1135 ###
1136 ### Non-html5 tags
1137 ###
1138
1139 !! test
1140 Non-html5 tags should be accepted
1141 !! wikitext
1142 <center>''foo''</center>
1143 <big>''foo''</big>
1144 <font>''foo''</font>
1145 <strike>''foo''</strike>
1146 <tt>''foo''</tt>
1147 !! html
1148 <center><i>foo</i></center>
1149 <p><big><i>foo</i></big>
1150 <font><i>foo</i></font>
1151 <strike><i>foo</i></strike>
1152 <tt><i>foo</i></tt>
1153 </p>
1154 !! end
1155
1156 !! test
1157 <wbr> is valid wikitext (bug 52468)
1158 !! wikitext
1159 <wbr>
1160 !! html
1161 <p><wbr />
1162 </p>
1163 !! end
1164
1165 # <strike> is HTML4, <s> is HTML4/5.
1166 !! test
1167 <s> or <strike> for strikethrough
1168 !! wikitext
1169 <strike>strike</strike>
1170
1171 <s>s</s>
1172 !! html
1173 <p><strike>strike</strike>
1174 </p><p><s>s</s>
1175 </p>
1176 !! end
1177
1178 ## a not permitted
1179 ## i,b,br omitted
1180 !! test
1181 Text-level semantic html elements in wikitext
1182 !! wikitext
1183 <em>text</em>
1184 <strong>text</strong>
1185 <small>text</small>
1186 <s>text</s>
1187 <cite>text</cite>
1188 <q>text</q>
1189 <dfn>text</dfn>
1190 <abbr>text</abbr>
1191 <data>text</data>
1192 <time>text</time>
1193 <code>text</code>
1194 <var>text</var>
1195 <samp>text</samp>
1196 <kbd>text</kbd>
1197 <sub>text</sub>
1198 <u>text</u>
1199 <mark>text</mark>
1200 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1201 <bdi>text</bdi>
1202 <bdo>text</bdo>
1203 <span>text</span>
1204 <wbr />
1205 !! html
1206 <p><em>text</em>
1207 <strong>text</strong>
1208 <small>text</small>
1209 <s>text</s>
1210 <cite>text</cite>
1211 <q>text</q>
1212 <dfn>text</dfn>
1213 <abbr>text</abbr>
1214 <data>text</data>
1215 <time>text</time>
1216 <code>text</code>
1217 <var>text</var>
1218 <samp>text</samp>
1219 <kbd>text</kbd>
1220 <sub>text</sub>
1221 <u>text</u>
1222 <mark>text</mark>
1223 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1224 <bdi>text</bdi>
1225 <bdo>text</bdo>
1226 <span>text</span>
1227 <wbr />
1228 </p>
1229 !! end
1230
1231 # test cases taken from
1232 # http://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1233 !! test
1234 Ruby markup (W3C-style)
1235 !! wikitext
1236 ; Mono-ruby for individual base characters
1237 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1238 ; Group ruby
1239 : <ruby>今日<rt>きょう</rt></ruby>
1240 ; Jukugo ruby
1241 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1242 ; Inline ruby
1243 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1244 ; Double-sided ruby
1245 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1246 <ruby>
1247 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1248 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1249 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1250 </ruby>
1251 !! html
1252 <dl><dt> Mono-ruby for individual base characters</dt>
1253 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1254 <dt> Group ruby</dt>
1255 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1256 <dt> Jukugo ruby</dt>
1257 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1258 <dt> Inline ruby</dt>
1259 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1260 <dt> Double-sided ruby</dt>
1261 <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>
1262 <p><ruby>
1263 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1264 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1265 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1266 </ruby>
1267 </p>
1268 !! end
1269
1270 # The next two test different paths in the sanitizer.
1271 !! test
1272 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1273 !! wikitext
1274 <blockquote|>a</blockquote>
1275
1276 <b→> doesn't terminate </b→>
1277
1278 <bä> doesn't terminate </bä>
1279
1280 <boo> doesn't terminate </boo>
1281
1282 <s.foo> doesn't terminate </s.foo>
1283
1284 <sub-ID#1>
1285 !! html
1286 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1287 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1288 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1289 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1290 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1291 </p><p>&lt;sub-ID#1&gt;
1292 </p>
1293 !! end
1294
1295 # There is a tidy bug here: http://sourceforge.net/p/tidy/bugs/946/
1296 # If the non-word-character tag made it through the sanitizer, tidy
1297 # would munge it up.
1298 !! test
1299 Non-word characters don't terminate tag names + tidy
1300 !! wikitext
1301 <blockquote|>a</blockquote>
1302
1303 <b→> doesn't terminate </b→>
1304
1305 <bä> doesn't terminate </bä>
1306
1307 <boo> doesn't terminate </boo>
1308
1309 <s.foo> doesn't terminate </s.foo>
1310
1311 <sub-ID#1>
1312 !! html+tidy
1313 <p>&lt;blockquote|&gt;a</p>
1314 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1315 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1316 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1317 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1318 <p>&lt;sub-ID#1&gt;</p>
1319 !! end
1320
1321 ###
1322 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1323 ### This checks that HTML5 tags (with non-word characters in the tag
1324 ### name) make it safely through the parser -- the Sanitizer will
1325 ### munge them later, as it should.
1326 ###
1327 !! test
1328 Non-word characters are valid in extension tags (T19663)
1329 !! wikitext
1330 <tåg>tåg</tåg>
1331 !! html/php
1332 <pre>
1333 'tåg'
1334 array (
1335 )
1336 </pre>
1337
1338 !! html/parsoid
1339 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1340 !! end
1341
1342 !! test
1343 Isolated close tags should be treated as literal text (bug 52760)
1344 !! options
1345 parsoid=wt2html
1346 !! wikitext
1347 </b>
1348
1349 <s.foo>s</s>
1350 !! html/php+tidy
1351 <p>&lt;s.foo&gt;s</p>
1352 !! html/parsoid
1353 <p>&lt;s.foo&gt;s</p>
1354 !! end
1355
1356 ###
1357 ### Special characters
1358 ###
1359
1360 !! test
1361 Bare pipe character (bug 52363)
1362 !! wikitext
1363 |
1364 !! html
1365 <p>|
1366 </p>
1367 !! end
1368
1369 !! test
1370 Bare pipe character from a template (bug 52363)
1371 !! wikitext
1372 {{pipe}}
1373 !! html
1374 <p>|
1375 </p>
1376 !! end
1377
1378 ###
1379 ### <nowiki> test cases
1380 ###
1381
1382 !! test
1383 <nowiki> unordered list
1384 !! wikitext
1385 <nowiki>* This is not an unordered list item.</nowiki>
1386 !! html/php
1387 <p>* This is not an unordered list item.
1388 </p>
1389 !! html/parsoid
1390 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1391 !! end
1392
1393 !! test
1394 <nowiki> spacing
1395 !! wikitext
1396 <nowiki>Lorem ipsum dolor
1397
1398 sed abit.
1399 sed nullum.
1400
1401 :and a colon
1402 </nowiki>
1403 !! html/php
1404 <p>Lorem ipsum dolor
1405
1406 sed abit.
1407 sed nullum.
1408
1409 :and a colon
1410
1411 </p>
1412 !! html/parsoid
1413 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1414
1415 sed abit.
1416 sed nullum.
1417
1418 :and a colon
1419 </span></p>
1420 !! end
1421
1422 !! test
1423 nowiki 3
1424 !! wikitext
1425 :There is not nowiki.
1426 :There is <nowiki>nowiki</nowiki>.
1427
1428 #There is not nowiki.
1429 #There is <nowiki>nowiki</nowiki>.
1430
1431 *There is not nowiki.
1432 *There is <nowiki>nowiki</nowiki>.
1433 !! html/php
1434 <dl><dd>There is not nowiki.</dd>
1435 <dd>There is nowiki.</dd></dl>
1436 <ol><li>There is not nowiki.</li>
1437 <li>There is nowiki.</li></ol>
1438 <ul><li>There is not nowiki.</li>
1439 <li>There is nowiki.</li></ul>
1440
1441 !! html/parsoid
1442 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1443 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1444
1445 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1446 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1447
1448 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1449 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1450 !! end
1451
1452 !! test
1453 Entities inside <nowiki>
1454 !! wikitext
1455 <nowiki>&lt;</nowiki>
1456 !! html
1457 <p>&lt;
1458 </p>
1459 !! end
1460
1461 !! test
1462 Entities inside template parameters
1463 !! wikitext
1464 {{echo|&ndash;}}
1465 !! html/php+tidy
1466 <p>–</p>
1467 !! html/parsoid
1468 <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>
1469 !! end
1470
1471 !! test
1472 Properly escape nowiki when combined with other wiki markup
1473 !! options
1474 parsoid=html2wt
1475 !! html/parsoid
1476 <p>* &lt;/nowiki&gt; tag</p>
1477 !! wikitext
1478 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1479 !! end
1480
1481 !! test
1482 T93824: Put escaped HTML tags inside nowiki
1483 !! options
1484 parsoid=html2wt
1485 !! html/parsoid
1486 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1487 !! wikitext
1488 <nowiki><h2>foo</h2></nowiki>
1489 !! end
1490
1491 !! test
1492 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1493 !! options
1494 parsoid=html2wt
1495 !! html/parsoid
1496 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1497 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1498 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1499 !! wikitext
1500 This text: L'[[Foo]]
1501 This text: L<nowiki>''</nowiki>[[Foo]]
1502 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1503 !! end
1504
1505 # This test fails because wikitext whitespace is not normalized before comparing.
1506 !! test
1507 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1508 !! options
1509 parsoid=html2wt
1510 !! html/parsoid
1511 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1512 </p>
1513 !! wikitext
1514 This text : L<nowiki>''</nowiki>[[Foo]]
1515 !! end
1516
1517 # This test and the next one are html2wt only as they test that incorrect wikitext
1518 # passed in template arguments gets escaped or wrapped in nowikis where required.
1519 !! test
1520 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1521 !! options
1522 parsoid=html2wt
1523 !! html/parsoid
1524 <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>
1525 <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>
1526 !! wikitext
1527 {{echo|foo{{!}}bar}}
1528 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1529 !! end
1530
1531 !! test
1532 T53961: Output correct nowikis in template arguments
1533 !! options
1534 parsoid=html2wt
1535 !! html/parsoid
1536 <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>
1537 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }} b&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></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="#mwt3"></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 | {{ ]]&quot;}},&quot;i&quot;:0}}]}" about="#mwt4"></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="#mwt5"></span></p>
1541 !! wikitext
1542 {{echo|a [ b}}
1543 {{echo|<nowiki>a }} b</nowiki>}}
1544 {{echo|<nowiki>a [[ b</nowiki>}}
1545 {{echo|<nowiki>a | {{ ]]</nowiki>}}
1546 {{echo|a <nowiki>}</nowiki>}}
1547 !! end
1548
1549 !! test
1550 Cases where "!!" needs nowiki protection
1551 !! options
1552 parsoid=html2wt
1553 !! html/parsoid
1554 <table>
1555 <tr><th>this needs protection !! here</th></tr>
1556 </table>
1557
1558 <table>
1559 <tr><th>this does not need
1560 protection !! here</th></tr>
1561 </table>
1562 !! wikitext
1563 {|
1564 !<nowiki>this needs protection !! here</nowiki>
1565 |}
1566
1567 {|
1568 !this does not need
1569 protection !! here
1570 |}
1571 !! end
1572
1573 ###
1574 ### Comments
1575 ###
1576 !! test
1577 Comments and Indent-Pre
1578 !! wikitext
1579 <!-- comment 1 --> asdf
1580
1581 <!-- comment 1 --> asdf
1582 <!-- comment 2 -->
1583
1584 <!-- comment 1 --> asdf
1585 <!-- comment 2 -->xyz
1586
1587 <!-- comment 1 --> asdf
1588 <!-- comment 2 --> xyz
1589 !! html
1590 <pre>asdf
1591 </pre>
1592 <pre>asdf
1593 </pre>
1594 <pre>asdf
1595 </pre>
1596 <p>xyz
1597 </p>
1598 <pre>asdf
1599 xyz
1600 </pre>
1601 !! end
1602
1603 !! test
1604 Comment test 2a
1605 !! wikitext
1606 asdf
1607 <!-- comment 1 -->
1608 jkl
1609 !! html
1610 <p>asdf
1611 jkl
1612 </p>
1613 !! end
1614
1615 !! test
1616 Comment test 2b
1617 !! wikitext
1618 asdf
1619 <!-- comment 1 -->
1620
1621 jkl
1622 !! html
1623 <p>asdf
1624 </p><p>jkl
1625 </p>
1626 !! end
1627
1628 !! test
1629 Comment test 3
1630 !! wikitext
1631 asdf
1632 <!-- comment 1 -->
1633 <!-- comment 2 -->
1634 jkl
1635 !! html
1636 <p>asdf
1637 jkl
1638 </p>
1639 !! end
1640
1641 !! test
1642 Comment test 4
1643 !! wikitext
1644 asdf<!-- comment 1 -->jkl
1645 !! html
1646 <p>asdfjkl
1647 </p>
1648 !! end
1649
1650 !! test
1651 Comment spacing
1652 !! wikitext
1653 a
1654 <!-- foo --> b <!-- bar -->
1655 c
1656 !! html
1657 <p>a
1658 </p>
1659 <pre> b
1660 </pre>
1661 <p>c
1662 </p>
1663 !! end
1664
1665 !! test
1666 Comment whitespace
1667 !! wikitext
1668 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1669 !! html
1670
1671 !! end
1672
1673 !! test
1674 Comment semantics and delimiters
1675 !! wikitext
1676 <!-- --><!----><!-----><!------>
1677 !! html/php
1678
1679 !! html/parsoid
1680 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1681 !! end
1682
1683 !! test
1684 Comment semantics and delimiters, redux
1685 !! wikitext
1686 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1687 -- foo -- funky huh? ... -->
1688 !! html/php
1689
1690 !! html/parsoid
1691 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1692 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1693 !! end
1694
1695 !! test
1696 Comment semantics and delimiters: directors cut
1697 !! wikitext
1698 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1699 everything starting with < followed by !-- until the first -- and > we see,
1700 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1701 -->-->
1702 !! html/php
1703 <p>--&gt;
1704 </p>
1705 !! html/parsoid
1706 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1707 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1708 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1709 --><p>--></p>
1710 !! end
1711
1712 !! test
1713 Comment semantics: nesting
1714 !! wikitext
1715 <!--<!-- no, we're not going to do anything fancy here -->-->
1716 !! html/php
1717 <p>--&gt;
1718 </p>
1719 !! html/parsoid
1720 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1721 !! end
1722
1723 # Parsoid closes the unclosed comment, even if it means a slight
1724 # round-trip diff.
1725 !! test
1726 Comment semantics: unclosed comment at end
1727 !! options
1728 parsoid=wt2html,html2html
1729 !! wikitext
1730 <!--This comment will run out to the end of the document
1731 !! html/php
1732
1733 !! html/parsoid
1734 <!--This comment will run out to the end of the document-->
1735 !! end
1736
1737 !! test
1738 Comment semantics: normalize comments to play nice with XML and browsers
1739 !! wikitext
1740 <!-- Browsers --!> think this is closed -->
1741 <!--> This would normally be text -->
1742 <!---> As would this -->
1743 <!-- XML doesn't like trailing dashes -------->
1744 <!-- Nor doubled hyphens -- anywhere in the data -->
1745 But this is not a comment.
1746 !! html/php
1747 <p>But this is not a comment.
1748 </p>
1749 !! html/parsoid
1750 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1751 <!--&#x3E; This would normally be text -->
1752 <!--&#x2D;&#x3E; As would this -->
1753 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1754 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1755 <p>But this is not a comment.</p>
1756 !! end
1757
1758 !! test
1759 Comment semantics: round-trip even text which contains encoded -->
1760 !! wikitext
1761 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1762 !! html/parsoid
1763 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1764 !! end
1765
1766 !! test
1767 Comment in template title
1768 !! wikitext
1769 {{f<!---->oo}}
1770 !! html
1771 <p>FOO
1772 </p>
1773 !! end
1774
1775 !! test
1776 Comment on its own line post-expand
1777 !! wikitext
1778 a
1779 {{blank}}<!---->
1780 b
1781 !! html
1782 <p>a
1783 </p><p>b
1784 </p>
1785 !! end
1786
1787 !! test
1788 Comment on its own line post-expand with non-significant whitespace
1789 !! wikitext
1790 a
1791 {{blank}} <!---->
1792 b
1793 !! html
1794 <p>a
1795 </p><p>b
1796 </p>
1797 !! end
1798
1799 !! test
1800 Multiple comments should still parse as SOL-transparent
1801 !! options
1802 parsoid=wt2html,wt2wt
1803 !! wikitext
1804 <!--c1-->*a
1805 <!--c2--><!--c3--><!--c4-->*b
1806 !! html/php
1807 <ul><li>a</li>
1808 <li>b</li></ul>
1809
1810 !! html/parsoid
1811 <!--c1--><ul>
1812 <li>a
1813 </li>
1814 <!--c2--><!--c3--><!--c4-->
1815 <li>b
1816 </li>
1817 </ul>
1818 !! end
1819
1820 ###
1821 ### paragraph wrapping tests
1822 ###
1823 !! test
1824 No block tags
1825 !! wikitext
1826 a
1827
1828 b
1829 !! html
1830 <p>a
1831 </p><p>b
1832 </p>
1833 !! end
1834
1835 !! test
1836 Block tag on one line (<div>)
1837 !! wikitext
1838 a <div>foo</div>
1839
1840 b
1841 !! html
1842 a <div>foo</div>
1843 <p>b
1844 </p>
1845 !! html+tidy
1846 <p>a</p>
1847 <div>foo</div>
1848 <p>b</p>
1849 !! end
1850
1851 !! test
1852 Block tag on one line (<blockquote>)
1853 !! wikitext
1854 a <blockquote>foo</blockquote>
1855
1856 b
1857 !! html
1858 a <blockquote>foo</blockquote>
1859 <p>b
1860 </p>
1861 !! html+tidy
1862 <p>a</p>
1863 <blockquote>
1864 <p>foo</p>
1865 </blockquote>
1866 <p>b</p>
1867 !! end
1868
1869 !! test
1870 Block tag on both lines (<div>)
1871 !! wikitext
1872 a <div>foo</div>
1873
1874 b <div>foo</div>
1875 !! html
1876 a <div>foo</div>
1877 b <div>foo</div>
1878
1879 !! html+tidy
1880 <p>a</p>
1881 <div>foo</div>
1882 <p>b</p>
1883 <div>foo</div>
1884 !! end
1885
1886 !! test
1887 Block tag on both lines (<blockquote>)
1888 !! wikitext
1889 a <blockquote>foo</blockquote>
1890
1891 b <blockquote>foo</blockquote>
1892 !! html
1893 a <blockquote>foo</blockquote>
1894 b <blockquote>foo</blockquote>
1895
1896 !! html+tidy
1897 <p>a</p>
1898 <blockquote>
1899 <p>foo</p>
1900 </blockquote>
1901 <p>b</p>
1902 <blockquote>
1903 <p>foo</p>
1904 </blockquote>
1905 !! end
1906
1907 !! test
1908 Multiple lines without block tags
1909 !! wikitext
1910 <div>foo</div> a
1911 b
1912 c
1913 d<!--foo--> e
1914 x <div>foo</div> z
1915 !! html
1916 <div>foo</div> a
1917 <p>b
1918 c
1919 d e
1920 </p>
1921 x <div>foo</div> z
1922
1923 !! html+tidy
1924 <div>foo</div>
1925 <p>a</p>
1926 <p>b c d e</p>
1927 <p>x</p>
1928 <div>foo</div>
1929 <p>z</p>
1930 !! end
1931
1932 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1933 # So, we have a separate section for Parsoid. We don't want
1934 # to mimic this stripping behavior in Parsoid. It affects
1935 # editing experience and also requires us to maintain additional
1936 # info for RT-ing.
1937 !! test
1938 Empty lines between lines with block tags
1939 !! wikitext
1940 <div></div>
1941
1942
1943 <div></div>a
1944
1945 b
1946 <div>a</div>b
1947
1948 <div>b</div>d
1949
1950
1951 <div>e</div>
1952 !! html
1953 <div></div>
1954 <p><br />
1955 </p>
1956 <div></div>a
1957 <p>b
1958 </p>
1959 <div>a</div>b
1960 <div>b</div>d
1961 <p><br />
1962 </p>
1963 <div>e</div>
1964
1965 !! html+tidy
1966 <p><br /></p>
1967 <p>a</p>
1968 <p>b</p>
1969 <div>a</div>
1970 <p>b</p>
1971 <div>b</div>
1972 <p>d</p>
1973 <p><br /></p>
1974 <div>e</div>
1975 !! html/parsoid
1976 <div data-parsoid='{"stx":"html"}'></div>
1977
1978 <p><br /></p>
1979 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1980
1981 <p>b</p>
1982 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1983
1984 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1985
1986 <p><br /></p>
1987 <div data-parsoid='{"stx":"html"}'>e</div>
1988 !! end
1989
1990 ## PHP parser emits output which is broken
1991 !! test
1992 Unclosed HTML p-tags should be handled properly
1993 !! wikitext
1994 <div><p>foo</div>
1995 a
1996
1997 b
1998 !! html/php+tidy
1999 <div>
2000 <p>foo</p>
2001 </div>
2002 <p>a</p>
2003 <p>b</p>
2004 !! html/parsoid
2005 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2006 <p>a</p>
2007 <p>b</p>
2008 !! end
2009
2010 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2011 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2012 ## them for now.
2013 !! test
2014 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2015 !! options
2016 parsoid=wt2html
2017 !! wikitext
2018 a [[Category:A1]] [[Category:A2]]
2019 [[Category:A3]]
2020 [[Category:A4]]
2021 !! html/parsoid
2022 <p>a</p>
2023 <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"/>
2024 !! end
2025
2026 !! test
2027 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2028 !! options
2029 parsoid=wt2html
2030 !! wikitext
2031 [[Category:A1]]a
2032 !! html/parsoid
2033 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2034 !! end
2035
2036 ###
2037 ### Preformatted text
2038 ###
2039 !! test
2040 Preformatted text
2041 !! wikitext
2042 This is some
2043 Preformatted text
2044 With ''italic''
2045 And '''bold'''
2046 And a [[Main Page|link]]
2047 !! html
2048 <pre>This is some
2049 Preformatted text
2050 With <i>italic</i>
2051 And <b>bold</b>
2052 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2053 </pre>
2054 !! end
2055
2056 !! test
2057 Tabs don't trigger preformatted text
2058 !! wikitext
2059 This is not
2060 preformatted text.
2061 This is preformatted text.
2062 So is this.
2063 !! html/php
2064 <p> This is not
2065 preformatted text.
2066 </p>
2067 <pre>This is preformatted text.
2068 So is this.
2069 </pre>
2070 !! html/parsoid
2071 <p> This is not
2072 preformatted text.</p>
2073 <pre>This is preformatted text.
2074 So is this.</pre>
2075 !! end
2076
2077 !! test
2078 Space before tab needs nowiki pre protection
2079 !! options
2080 parsoid=html2wt
2081 !! html/parsoid
2082 <p> a</p>
2083 !! wikitext
2084 <nowiki> </nowiki> a
2085 !! end
2086
2087 !! test
2088 Ident preformatting with inline content
2089 !! wikitext
2090 a
2091 ''b''
2092 !! html
2093 <pre>a
2094 <i>b</i>
2095 </pre>
2096 !! end
2097
2098 !! test
2099 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2100 !! wikitext
2101 <pre><nowiki>
2102 <b>
2103 <cite>
2104 <em>
2105 </nowiki></pre>
2106 !! html
2107 <pre>
2108 &lt;b&gt;
2109 &lt;cite&gt;
2110 &lt;em&gt;
2111 </pre>
2112
2113 !! end
2114
2115 !! test
2116 Regression with preformatted in <center>
2117 !! wikitext
2118 <center>
2119 Blah
2120 </center>
2121 !! html
2122 <center>
2123 <pre>Blah
2124 </pre>
2125 </center>
2126
2127 !! end
2128
2129 !! test
2130 Bug 52763: Preformatted in <blockquote>
2131 !! wikitext
2132 <blockquote>
2133 Blah
2134 {|
2135 |
2136 indented cell (no pre-wrapping!)
2137 |}
2138 </blockquote>
2139 !! html
2140 <blockquote>
2141 <p> Blah
2142 </p>
2143 <table>
2144 <tr>
2145 <td>
2146 <p> indented cell (no pre-wrapping!)
2147 </p>
2148 </td></tr></table>
2149 </blockquote>
2150
2151 !! end
2152
2153 !! test
2154 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2155 !! wikitext
2156 <blockquote>
2157 Foo
2158
2159 Bar
2160 </blockquote>
2161 !! html
2162 <blockquote>
2163 <p>Foo
2164 </p><p>Bar
2165 </p>
2166 </blockquote>
2167
2168 !! end
2169
2170 !! test
2171 Bug 15491: <ins>/<del> in blockquote
2172 !! wikitext
2173 <blockquote>
2174 Foo <del>bar</del> <ins>baz</ins> quux
2175 </blockquote>
2176 !! html
2177 <blockquote>
2178 <p>Foo <del>bar</del> <ins>baz</ins> quux
2179 </p>
2180 </blockquote>
2181
2182 !! end
2183
2184 # Note that the p-wrapping is newline sensitive, which could be
2185 # considered a bug: tidy will wrap only the 'Foo' in the example
2186 # below in a <p> tag. (see comment 23-25 of bug #6200)
2187 !! test
2188 Bug 15491: <ins>/<del> in blockquote (2)
2189 !! wikitext
2190 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2191 </blockquote>
2192 !! html
2193 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2194 </blockquote>
2195
2196 !! html+tidy
2197 <blockquote>
2198 <p>Foo</p>
2199 <del>bar</del> <ins>baz</ins> quux</blockquote>
2200 !! end
2201
2202 !! test
2203 <pre> with attributes (bug 3202)
2204 !! wikitext
2205 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2206 !! html
2207 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2208
2209 !! end
2210
2211 !! test
2212 <pre> with width attribute (bug 3202)
2213 !! wikitext
2214 <pre width="8">Narrow screen goodies</pre>
2215 !! html
2216 <pre width="8">Narrow screen goodies</pre>
2217
2218 !! end
2219
2220 !! test
2221 <pre> with forbidden attribute (bug 3202)
2222 !! wikitext
2223 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2224 !! html
2225 <pre width="8">Narrow screen goodies</pre>
2226
2227 !! end
2228
2229 !! test
2230 Entities inside <pre>
2231 !! wikitext
2232 <pre>&lt;</pre>
2233 !! html
2234 <pre>&lt;</pre>
2235
2236 !! end
2237
2238 !! test
2239 <pre> with forbidden attribute values (bug 3202)
2240 !! wikitext
2241 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2242 !! html
2243 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2244
2245 !! end
2246
2247 !! test
2248 <nowiki> inside <pre> (bug 13238)
2249 !! wikitext
2250 <pre>
2251 <nowiki>
2252 </pre>
2253 <pre>
2254 <nowiki></nowiki>
2255 </pre>
2256 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2257 !! html
2258 <pre>
2259 &lt;nowiki&gt;
2260 </pre>
2261 <pre>
2262
2263 </pre>
2264 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2265
2266 !! end
2267
2268 !! test
2269 <nowiki> inside of #tag:pre
2270 !! wikitext
2271 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2272 !! html/php
2273 <pre>Foo &#8594;bar</pre>
2274
2275 !! html/parsoid
2276 <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>
2277 !! end
2278
2279 !! test
2280 <nowiki> and <pre> preference (first one wins)
2281 !! wikitext
2282 <pre>
2283 <nowiki>
2284 </pre>
2285 </nowiki>
2286 </pre>
2287
2288 <nowiki>
2289 <pre>
2290 <nowiki>
2291 </pre>
2292 </nowiki>
2293 </pre>
2294
2295 !! html/php
2296 <pre>
2297 &lt;nowiki&gt;
2298 </pre>
2299 <p>&lt;/nowiki&gt;
2300 &lt;/pre&gt;
2301 </p><p>
2302 &lt;pre&gt;
2303 &lt;nowiki&gt;
2304 &lt;/pre&gt;
2305
2306 &lt;/pre&gt;
2307 </p>
2308 !! html/parsoid
2309 <pre data-parsoid='{"stx":"html","strippedNL":true}'>&lt;nowiki>
2310 </pre>
2311 <p><span typeof="mw:Placeholder" data-parsoid='{"src":"&lt;/nowiki>"}'>&lt;/nowiki></span>
2312 &lt;/pre></p>
2313
2314 <p><span typeof="mw:Nowiki">
2315 &lt;pre>
2316 &lt;nowiki>
2317 &lt;/pre>
2318 </span>
2319 &lt;/pre></p>
2320 !! end
2321
2322 !! test
2323 </pre> inside nowiki
2324 !! wikitext
2325 <nowiki></pre></nowiki>
2326 !! html
2327 <p>&lt;/pre&gt;
2328 </p>
2329 !! end
2330
2331 # Parsoid doesn't strip empty tags, like Tidy does.
2332 !! test
2333 Empty pre; pre inside other HTML tags (bug 54946)
2334 !! options
2335 parsoid=wt2html,wt2wt
2336 !! wikitext
2337 a
2338
2339 <div><pre>
2340 foo
2341 </pre></div>
2342 <pre></pre>
2343 !! html/php
2344 <p>a
2345 </p>
2346 <div><pre>
2347 foo
2348 </pre></div>
2349 <pre></pre>
2350
2351 !! html/php+tidy
2352 <p>a</p>
2353 <div>
2354 <pre>
2355 foo
2356 </pre></div>
2357 !! html/parsoid
2358 <p>a</p>
2359
2360 <div><pre>foo
2361 </pre></div>
2362 <pre></pre>
2363 !! end
2364
2365 !! test
2366 HTML pre followed by indent-pre
2367 !! wikitext
2368 <pre>foo</pre>
2369 bar
2370 !! html
2371 <pre>foo</pre>
2372 <pre>bar
2373 </pre>
2374 !! end
2375
2376 # Note that tidy removes the empty <p> tags from the start and end.
2377 # Parsoid does not, by design.
2378 !!test
2379 Block tag pre
2380 !! wikitext
2381 <p><pre>foo</pre></p>
2382 !! html/php+tidy
2383 <pre>
2384 foo
2385 </pre>
2386 !! html/parsoid
2387 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2388 !!end
2389
2390 !!test
2391 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2392 !! wikitext
2393 {{echo|}}
2394 !! html
2395
2396 !!end
2397
2398 !!test
2399 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2400 !! wikitext
2401 {{echo|
2402 foo}}
2403 !! html
2404 <p>foo
2405 </p>
2406 !!end
2407
2408 !! test
2409 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2410 !! wikitext
2411 {{echo|a
2412 b}}
2413 !! html
2414 <pre>a
2415 </pre>
2416 <p>b
2417 </p>
2418 !!end
2419
2420 !! test
2421 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2422 !! wikitext
2423 {{echo|a
2424 b
2425 c
2426 d
2427 e
2428 }}
2429 !! html
2430 <pre>a
2431 </pre>
2432 <p>b
2433 c
2434 </p>
2435 <pre>d
2436 </pre>
2437 <p>e
2438 </p>
2439 !!end
2440
2441 !!test
2442 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2443 !! wikitext
2444 {{echo| foo}}
2445
2446 {{echo| foo}}{{echo| bar}}
2447
2448 {{echo| foo}}
2449 {{echo| bar}}
2450
2451 {{echo|<!--cmt--> foo}}
2452
2453 <!--cmt-->{{echo| foo}}
2454
2455 {{echo|{{echo| }}bar}}
2456 !! html
2457 <pre>foo
2458 </pre>
2459 <pre>foo bar
2460 </pre>
2461 <pre>foo
2462 bar
2463 </pre>
2464 <pre>foo
2465 </pre>
2466 <pre>foo
2467 </pre>
2468 <pre>bar
2469 </pre>
2470 !!end
2471
2472 !! test
2473 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2474 !! wikitext
2475 {{echo| }}a
2476
2477 {{echo|
2478 }}a
2479
2480 {{echo|
2481 b}}
2482
2483 {{echo|a
2484 }}b
2485
2486 {{echo|a
2487 }} b
2488 !! html
2489 <pre>a
2490 </pre>
2491 <p><br />
2492 </p>
2493 <pre>a
2494 </pre>
2495 <p><br />
2496 </p>
2497 <pre>b
2498 </pre>
2499 <p>a
2500 </p>
2501 <pre>b
2502 </pre>
2503 <p>a
2504 </p>
2505 <pre>b
2506 </pre>
2507 !!end
2508
2509 !! test
2510 Pres with newline attributes
2511 !! wikitext
2512 <pre class="one
2513 two">hi</pre>
2514 !! html/php
2515 <pre class="one two">hi</pre>
2516
2517 !! html/parsoid
2518 <pre class="one
2519 two" data-parsoid='{"stx":"html"}'>hi</pre>
2520 !! end
2521
2522 !! test
2523 Things that look like <pre> tags aren't treated as such
2524 !! wikitext
2525 Barack Obama <President> of the United States
2526 <President></President>
2527 !! html
2528 <p>Barack Obama &lt;President&gt; of the United States
2529 &lt;President&gt;&lt;/President&gt;
2530 </p>
2531 !! end
2532
2533 !! test
2534 Handle broken pre-like tags (bug 64025)
2535 !! options
2536 parsoid=wt2html
2537 !! wikitext
2538 {{echo|<pre <pre>x</pre>}}
2539
2540 <table><pre </table>
2541 !! html/php
2542 <pre>x</pre>
2543 <table>&lt;pre </table>
2544
2545 !! html/php+tidy
2546 <pre>
2547 x
2548 </pre>
2549 <p>&lt;pre</p>
2550 !! html/parsoid
2551 <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>
2552
2553
2554 <p>&lt;pre </p>
2555
2556 <table></table>
2557 !! end
2558
2559 !! test
2560 Parsoid: handle pre with space after attribute
2561 !! options
2562 parsoid=wt2html
2563 !! wikitext
2564 <pre style="width:50%;" >{{echo|foo}}</pre>
2565 !! html/php
2566 <pre style="width:50%;">{{echo|foo}}</pre>
2567
2568 !! html/parsoid
2569 <pre style="width:50%;">{{echo|foo}}</pre>
2570 !! end
2571
2572 # TODO / maybe: fix wt2wt for this
2573 !! test
2574 Parsoid: Don't paragraph-wrap fosterable content
2575 !! options
2576 parsoid=wt2html
2577 !! wikitext
2578 {|
2579 <td></td>
2580 <td></td>
2581
2582
2583
2584 |}
2585 !! html
2586 <table>
2587
2588 <tbody>
2589 <tr>
2590 <td></td>
2591
2592 <td></td></tr>
2593
2594
2595
2596 </tbody></table>
2597 !! end
2598
2599 !! test
2600 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2601 !! options
2602 parsoid=wt2html
2603 !! wikitext
2604 {|
2605 <td>
2606 <td>
2607 </td>
2608
2609
2610
2611 |}
2612 !! html
2613 <table>
2614
2615 <tbody>
2616 <tr>
2617 <td></td>
2618
2619 <td>
2620 </td></tr>
2621
2622
2623
2624 </tbody></table>
2625 !! end
2626
2627
2628 #--------------------------------------------------------------------
2629 # Transclusion parameter whitespace stripping tests
2630 # Behavior is different for positional and named parameters
2631 #--------------------------------------------------------------------
2632 !! test
2633 Templates: Strip leading and trailing whitespace from named-param values
2634 !! wikitext
2635 {{echo|1= a }}
2636
2637 {{echo|1= {{echo|b}} }}
2638
2639 {{echo| 1 =
2640 c }}
2641
2642 {{echo| 1 =
2643 * d
2644 }}
2645 !! html
2646 <p>a
2647 </p><p>b
2648 </p><p>c
2649 </p>
2650 <ul><li> d</li></ul>
2651
2652 !! end
2653
2654 !! test
2655 Templates: Don't strip whitespace from positional-param values
2656 !! wikitext
2657 {{echo|a }}
2658
2659 {{echo|{{echo|b}} }}
2660
2661 {{echo| c
2662 }}
2663
2664 {{echo| {{echo|d}}
2665 }}
2666
2667 {{echo|
2668 e}}
2669
2670 {{echo|
2671 * f}}
2672
2673 {{echo|
2674 }}g
2675 !! html
2676 <p>a
2677 </p><p>b
2678 </p>
2679 <pre>c
2680 </pre>
2681 <p><br />
2682 </p>
2683 <pre>d
2684 </pre>
2685 <p><br />
2686 </p>
2687 <pre>e
2688 </pre>
2689 <p><br />
2690 </p>
2691 <ul><li> f</li></ul>
2692 <p><br />
2693 </p>
2694 <pre>g
2695 </pre>
2696 !! end
2697
2698 !! test
2699 Templates: Handle empty comment-and-ws-only lines correctly
2700 !! wikitext
2701 {{echo|foo
2702 <!--should be ignored-->
2703 <!--should be ignored as well-->
2704 bar}}
2705 !! html
2706 <p>foo
2707 bar
2708 </p>
2709 !! end
2710
2711 !! test
2712 Templates: Handle comments in the target
2713 !! wikitext
2714 {{echo
2715 <!-- should be ignored -->
2716 |foo}}
2717
2718 {{echo<!-- should be ignored -->
2719 |foo}}
2720
2721 {{echo<!-- should be ignored -->|foo}}
2722
2723 {{<!-- should be ignored -->echo|foo}}
2724 !!html/parsoid
2725 <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>
2726
2727 <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>
2728
2729 <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>
2730
2731 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2732 !!end
2733
2734 !! test
2735 Templates: Handle comments in parameter names (bug 67657)
2736 !! wikitext
2737 {{echo|1
2738 <!-- should be ignored -->
2739 =foo}}
2740
2741 {{echo|
2742 <!-- should be ignored -->
2743 1 = foo}}
2744
2745 {{echo|1<!-- should be ignored -->=foo}}
2746
2747 {{echo|<!-- should be ignored -->1=foo}}
2748 !!html/parsoid
2749 <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>
2750
2751 <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>
2752
2753 <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>
2754
2755 <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>
2756 !!end
2757
2758 !! test
2759 Templates: Other wikitext in parameter names (bug 67657)
2760 !! wikitext
2761 {{echo|''1''=foo}}
2762 !!html/parsoid
2763 <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>
2764 !!html/php
2765 <p>{{{1}}}
2766 </p>
2767 !!end
2768
2769 #--------------------------------------------------------------------
2770 # Transclusion parameter escaping tests
2771 #--------------------------------------------------------------------
2772 !! test
2773 Templates: Parsoid parameter escaping test 1
2774 !! wikitext
2775 {{echo|[foo]|{{echo|[bar]}}}}
2776 !! html/php+tidy
2777 <p>[foo]</p>
2778 !! html/parsoid
2779 <p about="#mwt1" typeof="mw:Transclusion"
2780 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2781 !! end
2782
2783 !! test
2784 Parsoid: Pipes in external links in template parameter
2785 !! wikitext
2786 {{echo|[{{echo|http://example.com}} link]}}
2787 !! html/php+tidy
2788 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2789 !! html/parsoid
2790 <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>
2791 !! end
2792
2793 !! test
2794 Parsoid: pipe in transclusion parameter
2795 !! wikitext
2796 {{echo|http://foo.com/a&#124;b}}
2797 !! html/php+tidy
2798 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2799 !! html/parsoid
2800 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2801 typeof="mw:Transclusion"
2802 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>
2803 !! end
2804
2805 !! test
2806 Parsoid: Pipe in external link target and content in template parameter
2807 !! options
2808 parsoid=html2wt,wt2wt
2809 !! wikitext
2810 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2811 !! html/php+tidy
2812 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2813 !! html/parsoid
2814 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2815 typeof="mw:Transclusion"
2816 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2817 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2818 !! end
2819
2820 !! test
2821 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2822 !! options
2823 parsoid
2824 !! wikitext
2825 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2826 !! html
2827 <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>
2828 !! end
2829
2830 !! test
2831 Templates: Don't escape already nowiki-escaped text in template parameters
2832 !! options
2833 parsoid=html2wt,wt2wt
2834 !! wikitext
2835 {{echo|foo<nowiki>|</nowiki>bar}}
2836 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2837 {{echo|<nowiki></nowiki>}}
2838 !! html/php+tidy
2839 <p>foo|bar &lt;div&gt;</p>
2840 !! html/parsoid
2841 <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>
2842 <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>
2843 <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>
2844 </p>
2845 !! end
2846
2847 ## Bug 52824
2848 !! test
2849 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2850 !! options
2851 parsoid=html2wt,wt2wt
2852 !! wikitext
2853 {{echo|{{echo|1=bar}}}}
2854 !! html/php+tidy
2855 <p>bar</p>
2856 !! html/parsoid
2857 <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>
2858 !! end
2859
2860 ## Bug 56733
2861 !! test
2862 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2863 !! wikitext
2864 {{echo|a : b}}
2865 !! html/php+tidy
2866 <p>a&#160;: b</p>
2867 !! html/parsoid
2868 <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>
2869 !! end
2870
2871 ## Bug T73412
2872 !! test
2873 Templates: Preserve blank parameter names
2874 !! wikitext
2875 {{echo|=foo}}
2876 !! html/php+tidy
2877 <p>{{{1}}}</p>
2878 !! html/parsoid
2879 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2880 !! end
2881
2882 !! test
2883 Templates: Preserve blank parameter names in other positions
2884 !! wikitext
2885 {{blank_param|bar|=foo}}
2886 !! html/php+tidy
2887 <p>bar foo</p>
2888 !! html/parsoid
2889 <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
2890 foo</p>
2891 !! end
2892
2893 ###
2894 ### Parsoid-centric tests for testing RT edge cases for pre
2895 ###
2896
2897 !!test
2898 1a. Indent-Pre and Comments
2899 !! wikitext
2900 a
2901 <!--a-->
2902 c
2903 !! html
2904 <pre>a
2905 </pre>
2906 <p>c
2907 </p>
2908 !!end
2909
2910 !!test
2911 1b. Indent-Pre and Comments
2912 !! wikitext
2913 a
2914 <!--a-->
2915 c
2916 !! html
2917 <pre>a
2918 </pre>
2919 <p>c
2920 </p>
2921 !!end
2922
2923 !!test
2924 1c. Indent-Pre and Comments
2925 !! wikitext
2926 <!--a--> a
2927
2928 <!--a--> a
2929 !! html
2930 <pre> a
2931 </pre>
2932 <pre> a
2933 </pre>
2934 !!end
2935
2936 !!test
2937 1d. Indent-Pre and Comments
2938 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2939 !! wikitext
2940 <!--a--> a
2941
2942 <!--b-->b
2943 !! html
2944 <pre>a
2945 </pre>
2946 <pre>b
2947 </pre>
2948 !!end
2949
2950 !!test
2951 2a. Indent-Pre and tables
2952 !! wikitext
2953 {|
2954 |-
2955 !h1!!h2
2956 |foo||bar
2957 |}
2958 !! html
2959 <table>
2960
2961 <tr>
2962 <th>h1</th>
2963 <th>h2
2964 </th>
2965 <td>foo</td>
2966 <td>bar
2967 </td></tr></table>
2968
2969 !!end
2970
2971 !!test
2972 2b. Indent-Pre and tables
2973 !! wikitext
2974 {|
2975 |-
2976 |foo
2977 |}
2978 !! html
2979 <table>
2980
2981 <tr>
2982 <td>foo
2983 </td></tr></table>
2984
2985 !!end
2986
2987 !!test
2988 2c. Indent-Pre and tables (bug 42252)
2989 !! wikitext
2990 {|
2991 |+ foo
2992 ! | bar
2993 |}
2994 !! html
2995 <table>
2996 <caption> foo
2997 </caption>
2998 <tr>
2999 <th> bar
3000 </th></tr></table>
3001
3002 !!end
3003
3004 !!test
3005 2d. Indent-Pre and tables
3006 !! wikitext
3007 a
3008 {|
3009 | b
3010 |}
3011 !! html/php
3012 <pre>a
3013 </pre>
3014 <table>
3015 <tr>
3016 <td> b
3017 </td></tr></table>
3018
3019 !! html/parsoid
3020 <pre>a</pre>
3021 <table>
3022 <tbody><tr><td> b</td></tr>
3023 </tbody></table>
3024 !!end
3025
3026 !!test
3027 2e. Indent-Pre and table-line syntax
3028 !! wikitext
3029 a
3030 | b
3031 | c
3032 !! html/php
3033 <pre>a
3034 | b
3035 | c
3036 </pre>
3037 !!end
3038
3039 !!test
3040 2f. Indent-pre started by table-line syntax
3041 !! wikitext
3042 a
3043 | b
3044 | c
3045 !! html/php
3046 <p>a
3047 </p>
3048 <pre>| b
3049 | c
3050 </pre>
3051 !! html/parsoid
3052 <p>a</p>
3053 <pre>
3054 | b
3055 | c</pre>
3056 !!end
3057
3058 !!test
3059 3a. Indent-Pre and block tags (single-line html)
3060 !! wikitext
3061 a <p> foo </p>
3062 b <div> foo </div>
3063 c <blockquote> foo </blockquote>
3064 <span> foo </span>
3065 !! html
3066 a <p> foo </p>
3067 b <div> foo </div>
3068 c <blockquote> foo </blockquote>
3069 <pre><span> foo </span>
3070 </pre>
3071 !! html/parsoid
3072 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3073 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3074 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3075 <pre><span> foo </span>
3076 </pre>
3077 !! html+tidy
3078 <p>a</p>
3079 <p>foo</p>
3080 <p>b</p>
3081 <div>foo</div>
3082 <p>c</p>
3083 <blockquote>
3084 <p>foo</p>
3085 </blockquote>
3086 <pre>
3087 <span> foo </span>
3088 </pre>
3089 !! end
3090
3091 !!test
3092 3b. Indent-Pre and block tags (multi-line html)
3093 !! wikitext
3094 a <span>foo</span>
3095 b <div> foo </div>
3096 !! html
3097 <pre>a <span>foo</span>
3098 </pre>
3099 b <div> foo </div>
3100
3101 !! html/parsoid
3102 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3103 b <div data-parsoid='{"stx":"html"}'> foo </div>
3104 !! html+tidy
3105 <pre>
3106 a <span>foo</span>
3107 </pre>
3108 <p>b</p>
3109 <div>foo</div>
3110 !!end
3111
3112 !!test
3113 3c. Indent-Pre and block tags (pre-content on separate line)
3114 !! wikitext
3115 <p>
3116 foo
3117 </p>
3118
3119 <div>
3120 foo
3121 </div>
3122
3123 <center>
3124 foo
3125 </center>
3126
3127 <blockquote>
3128 foo
3129 </blockquote>
3130
3131 <blockquote>
3132 <pre>
3133 foo
3134 </pre>
3135 </blockquote>
3136
3137 <table><tr><td>
3138 foo
3139 </td></tr></table>
3140
3141 <ul><li>
3142 foo
3143 </li></ul>
3144
3145 !! html
3146 <p>
3147 foo
3148 </p>
3149 <div>
3150 <pre>foo
3151 </pre>
3152 </div>
3153 <center>
3154 <pre>foo
3155 </pre>
3156 </center>
3157 <blockquote>
3158 <p> foo
3159 </p>
3160 </blockquote>
3161 <blockquote>
3162 <pre>
3163 foo
3164 </pre>
3165 </blockquote>
3166 <table><tr><td>
3167 <pre>foo
3168 </pre>
3169 </td></tr></table>
3170 <ul><li>
3171 foo
3172 </li></ul>
3173
3174 !!end
3175
3176 !! test
3177 4. Indent-Pre and extension tags
3178 !! wikitext
3179 a <tag />
3180 !! html/php
3181 a <pre>
3182 NULL
3183 array (
3184 )
3185 </pre>
3186
3187 !! html/parsoid
3188 a <pre typeof="mw:Extension/tag" about="#mwt2" data-parsoid='{}' data-mw='{"name":"tag","attrs":{},"body":null}'></pre>
3189 !! end
3190
3191 !!test
3192 Render paragraphs when indent-pre is suppressed in blocklevels
3193 !! wikitext
3194 <blockquote>
3195 foo
3196
3197 bar
3198 </blockquote>
3199 !! html
3200 <blockquote>
3201 <p> foo
3202 </p><p> bar
3203 </p>
3204 </blockquote>
3205
3206 !!end
3207
3208 !!test
3209 4. Multiple spaces at start-of-line
3210 !! wikitext
3211 <p> foo </p>
3212 foo
3213 {|
3214 |foo
3215 |}
3216 !! html
3217 <p> foo </p>
3218 <pre> foo
3219 </pre>
3220 <table>
3221 <tr>
3222 <td>foo
3223 </td></tr></table>
3224
3225 !!end
3226
3227 ## NOTE: the leading white-space chars on empty line are significant
3228 !! test
3229 5a. White-space in indent-pre
3230 !! wikitext
3231 a<br />
3232
3233 b
3234 !! html
3235 <pre>a<br />
3236
3237 b
3238 </pre>
3239 !! end
3240
3241 ## NOTE: the leading white-space chars on empty line are significant
3242 !! test
3243 5b. White-space in indent-pre
3244 !! wikitext
3245 a
3246
3247 b
3248
3249
3250 c
3251 !! html
3252 <pre>a
3253
3254 b
3255
3256
3257 c
3258 </pre>
3259 !! end
3260
3261 !! test
3262 5c. White-space in indent-pre
3263 !! wikitext
3264 ''a''
3265 ''b''
3266 ''c''
3267 !! html
3268 <pre><i>a</i>
3269 <i>b</i>
3270 <i>c</i>
3271 </pre>
3272 !! end
3273
3274 !! test
3275 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3276 !! wikitext
3277 a
3278
3279 <!-- continue -->
3280 b
3281
3282 c
3283
3284 d
3285 !! html
3286 <pre>a
3287
3288 b
3289 </pre>
3290 <pre>c
3291
3292 </pre>
3293 <p>d
3294 </p>
3295 !! end
3296
3297 !! test
3298 7a. Indent-pre and category links
3299 !! options
3300 parsoid=wt2html,wt2wt
3301 !! wikitext
3302 [[Category:foo]] <!-- No pre-wrapping -->
3303 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3304 !! html/php+tidy
3305 !! html/parsoid
3306 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3307 <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 -->
3308 !! end
3309
3310 ## We used to, but no longer wt2wt this test since the default serializer
3311 ## will normalize all categories to serialize on their own line.
3312 ## This wikitext usage is going to be fairly uncommon in production and
3313 ## selser will take care of preserving formatting in those scenarios.
3314 !! test
3315 7b. Indent-pre and category links
3316 !! options
3317 parsoid=wt2html
3318 !! wikitext
3319 [[Category:foo]] a
3320 [[Category:foo]] {{echo|b}}
3321 !! html/parsoid
3322 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3323 <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>
3324 !! end
3325
3326 !! test
3327 Indent-Pre: Newlines in comments shouldn't affect sol state
3328 !! wikitext
3329 a <!--
3330 foo
3331 --> b
3332 !! html/php+tidy
3333 <p>a b</p>
3334 !! html/parsoid
3335 <p>a <!--
3336 foo
3337 --> b</p>
3338 !! end
3339
3340 ###
3341 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3342 ###
3343
3344 !!test
3345 HTML-pre: 1. embedded newlines
3346 !! wikitext
3347 <pre>foo</pre>
3348
3349 <pre>
3350 foo
3351 </pre>
3352
3353 <pre>
3354
3355 foo
3356 </pre>
3357
3358 <pre>
3359
3360
3361 foo
3362 </pre>
3363 !! html/php+tidy
3364 <pre>
3365 foo
3366 </pre>
3367 <pre>
3368 foo
3369 </pre>
3370 <pre>
3371
3372 foo
3373 </pre>
3374 <pre>
3375
3376
3377 foo
3378 </pre>
3379 !! html/parsoid
3380 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3381
3382 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3383 foo
3384 </pre>
3385
3386 <pre data-parsoid='{"stx":"html"}'>
3387
3388 foo
3389 </pre>
3390
3391 <pre data-parsoid='{"stx":"html"}'>
3392
3393
3394 foo
3395 </pre>
3396 !!end
3397
3398 !! test
3399 HTML-pre: big spaces
3400 !! wikitext
3401 <pre>
3402
3403
3404
3405
3406 haha
3407
3408
3409
3410
3411 haha
3412
3413
3414
3415
3416 </pre>
3417 !! html/php+tidy
3418 <pre>
3419
3420
3421
3422
3423 haha
3424
3425
3426
3427
3428 haha
3429
3430
3431
3432
3433 </pre>
3434 !! html/parsoid
3435 <pre data-parsoid='{"stx":"html"}'>
3436
3437
3438
3439
3440 haha
3441
3442
3443
3444
3445 haha
3446
3447
3448
3449
3450 </pre>
3451 !! end
3452
3453 !!test
3454 HTML-pre: 2: indented text
3455 !! wikitext
3456 <pre>
3457 foo
3458 </pre>
3459 !! html
3460 <pre>
3461 foo
3462 </pre>
3463
3464 !!end
3465
3466 !!test
3467 HTML-pre: 3: other wikitext
3468 !! wikitext
3469 <pre>
3470 * foo
3471 # bar
3472 = no-h =
3473 '' no-italic ''
3474 [[ NoLink ]]
3475 </pre>
3476 !! html/php
3477 <pre>
3478 * foo
3479 # bar
3480 = no-h =
3481 '' no-italic ''
3482 [[ NoLink ]]
3483 </pre>
3484
3485 !! html/parsoid
3486 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3487 # bar
3488 = no-h =
3489 '' no-italic ''
3490 [[ NoLink ]]
3491 </pre>
3492 !!end
3493
3494 ###
3495 ### Definition lists
3496 ###
3497 !! test
3498 Simple definition
3499 !! wikitext
3500 ; name : Definition
3501 !! html
3502 <dl><dt> name&#160;</dt>
3503 <dd> Definition</dd></dl>
3504
3505 !! end
3506
3507 !! test
3508 Definition list for indentation only
3509 !! wikitext
3510 : Indented text
3511 !! html
3512 <dl><dd> Indented text</dd></dl>
3513
3514 !! end
3515
3516 !! test
3517 Definition list with no space
3518 !! wikitext
3519 ;name:Definition
3520 !! html
3521 <dl><dt>name</dt>
3522 <dd>Definition</dd></dl>
3523
3524 !!end
3525
3526 !! test
3527 Definition list with URL link
3528 !! wikitext
3529 ; http://example.com/ : definition
3530 !! html
3531 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3532 <dd> definition</dd></dl>
3533
3534 !! end
3535
3536 !! test
3537 Definition list with bracketed URL link
3538 !! wikitext
3539 ;[http://www.example.com/ Example]:Something about it
3540 !! html
3541 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3542 <dd>Something about it</dd></dl>
3543
3544 !! end
3545
3546 !! test
3547 Definition list with wikilink containing colon
3548 !! wikitext
3549 ; [[Help:FAQ]]: The least-read page on Wikipedia
3550 !! html
3551 <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>
3552 <dd> The least-read page on Wikipedia</dd></dl>
3553
3554 !! end
3555
3556 # At Brion's and JeLuF's insistence... :)
3557 !! test
3558 Definition list with news link containing colon
3559 !! wikitext
3560 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3561 !! html/php
3562 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3563 <dd> This isn't even a real newsgroup!</dd></dl>
3564
3565 !! html/parsoid
3566 <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>
3567 !! end
3568
3569 !! test
3570 Malformed definition list with colon
3571 !! wikitext
3572 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3573 !! html
3574 <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>
3575
3576 !! end
3577
3578 !! test
3579 Definition lists: colon in external link text
3580 !! wikitext
3581 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3582 !! html
3583 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3584 <dd> OK, I made that up</dd></dl>
3585
3586 !! end
3587
3588 !! test
3589 Definition lists: colon in HTML attribute
3590 !! wikitext
3591 ;<b style="display: inline">bold</b>
3592 !! html
3593 <dl><dt><b style="display: inline">bold</b></dt></dl>
3594
3595 !! end
3596
3597 !! test
3598 Definition lists: self-closed tag
3599 !! wikitext
3600 ;one<br/>two : two-line fun
3601 !! html
3602 <dl><dt>one<br />two&#160;</dt>
3603 <dd> two-line fun</dd></dl>
3604
3605 !! end
3606
3607 !! test
3608 Bug 11748: Literal closing tags
3609 !! wikitext
3610 <dl>
3611 <dt>test 1</dt>
3612 <dd>test test test test test</dd>
3613 <dt>test 2</dt>
3614 <dd>test test test test test</dd>
3615 </dl>
3616 !! html
3617 <dl>
3618 <dt>test 1</dt>
3619 <dd>test test test test test</dd>
3620 <dt>test 2</dt>
3621 <dd>test test test test test</dd>
3622 </dl>
3623
3624 !! end
3625
3626 !! test
3627 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3628 !! wikitext
3629 <ul><li>
3630 ; term : description
3631 * unordered
3632 </li></ul>
3633 !! html
3634 <ul><li>
3635 <dl><dt> term&#160;</dt>
3636 <dd> description</dd></dl>
3637 <ul><li> unordered</li></ul>
3638 </li></ul>
3639
3640 !! end
3641
3642 !! test
3643
3644 Definition list with empty definition and following paragraph
3645 !! wikitext
3646 ; term:
3647 Paragraph text
3648 !! html
3649 <dl><dt> term</dt>
3650 <dd></dd></dl>
3651 <p>Paragraph text
3652 </p>
3653 !! end
3654
3655 !! test
3656 Nested definition lists using html syntax
3657 !! wikitext
3658 <dl><dt>x</dt>
3659 <dd>a</dd>
3660 <dd>b</dd></dl>
3661
3662 !! end
3663
3664 !! test
3665 Definition Lists: No nesting: Multiple dd's
3666 !! wikitext
3667 ;x
3668 :a
3669 :b
3670 !! html
3671 <dl><dt>x</dt>
3672 <dd>a</dd>
3673 <dd>b</dd></dl>
3674
3675 !! end
3676
3677 !! test
3678 Definition Lists: Indentation: Regular
3679 !! wikitext
3680 :i1
3681 ::i2
3682 :::i3
3683 !! html
3684 <dl><dd>i1
3685 <dl><dd>i2
3686 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3687
3688 !! end
3689
3690 !! test
3691 Definition Lists: Indentation: Missing 1st level
3692 !! wikitext
3693 ::i2
3694 :::i3
3695 !! html
3696 <dl><dd><dl><dd>i2
3697 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3698
3699 !! end
3700
3701 !! test
3702 Definition Lists: Indentation: Multi-level indent
3703 !! wikitext
3704 :::i3
3705 !! html
3706 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3707
3708 !! end
3709
3710 !! test
3711 Definition Lists: Hacky use to indent tables
3712 !! wikitext
3713 ::{|
3714 |foo
3715 |bar
3716 |}
3717 this text
3718 should be left alone
3719 !! html
3720 <dl><dd><dl><dd><table>
3721 <tr>
3722 <td>foo
3723 </td>
3724 <td>bar
3725 </td></tr></table></dd></dl></dd></dl>
3726 <p>this text
3727 should be left alone
3728 </p>
3729 !! end
3730
3731 !! test
3732 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3733 !! wikitext
3734 <!-- foo -->
3735 ::{|
3736 |foo
3737 |bar
3738 |}<!-- bar -->
3739 this text
3740 should be left alone
3741 !! html/parsoid
3742 <!-- foo -->
3743 <dl><dd><dl><dd><table><tr>
3744 <td>foo</td>
3745 <td>bar</td>
3746 </tr></table><!-- bar --></dd></dl></dd></dl>
3747 <p>this text
3748 should be left alone</p>
3749 !! end
3750
3751 !! test
3752 Definition Lists: Hacky use to indent tables, with comment before table
3753 !! wikitext
3754 ::<!-- foo -->{|
3755 |foo
3756 |}
3757 !! html/parsoid
3758 <dl><dd><dl><dd><!-- foo --><table><tr>
3759 <td>foo</td>
3760 </tr></table></dd></dl></dd></dl>
3761 !! end
3762
3763 # The trailing whitespace in this test is to catch a regression in
3764 # Parsoid after T54473.
3765 !! test
3766 Definition Lists: Hacky use to indent tables (WS-insensitive)
3767 !! wikitext
3768 : {|
3769 |a
3770 |}
3771 !! html/php
3772 <dl><dd><table>
3773 <tr>
3774 <td>a
3775 </td></tr></table></dd></dl>
3776
3777 !! html/parsoid
3778 <dl><dd> <table>
3779 <tbody><tr><td>a</td></tr>
3780 </tbody></table> </dd></dl>
3781 !! end
3782
3783 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3784 ## as an empty dt item. It also ignores all but the last ";" when followed
3785 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3786 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3787 ## ";"s.
3788 ##
3789 ## Ex: ";;t2 ::d2" is transformed into:
3790 ##
3791 ## <dl>
3792 ## <dt>t2 </dt>
3793 ## <dd>
3794 ## <dl>
3795 ## <dt></dt>
3796 ## <dd>d2</dd>
3797 ## </dl>
3798 ## </dd>
3799 ## </dl>
3800 ##
3801 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3802 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3803 ##
3804 ## <dl>
3805 ## <dt>
3806 ## <dl>
3807 ## <dt>t2 </dt>
3808 ## <dd>:d2</dd>
3809 ## </dl>
3810 ## </dt>
3811 ## </dl>
3812 ##
3813 ## All Parsoid only definition list tests have this difference.
3814 ##
3815 ## See also: https://phabricator.wikimedia.org/T8569
3816 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3817
3818 !! test
3819 Table / list interaction: indented table with lists in table contents
3820 !! wikitext
3821 :{|
3822 |-
3823 | a
3824 * b
3825 |-
3826 | c
3827 * d
3828 |}
3829 !! html
3830 <dl><dd><table>
3831
3832 <tr>
3833 <td> a
3834 <ul><li> b</li></ul>
3835 </td></tr>
3836 <tr>
3837 <td> c
3838 <ul><li> d</li></ul>
3839 </td></tr></table></dd></dl>
3840
3841 !! end
3842
3843 !!test
3844 Table / list interaction: lists nested in tables nested in indented lists
3845 !! wikitext
3846 :{|
3847 |
3848 :a
3849 :b
3850 |
3851 *c
3852 *d
3853 |}
3854
3855 *e
3856 *f
3857 !! html
3858 <dl><dd><table>
3859 <tr>
3860 <td>
3861 <dl><dd>a</dd>
3862 <dd>b</dd></dl>
3863 </td>
3864 <td>
3865 <ul><li>c</li>
3866 <li>d</li></ul>
3867 </td></tr></table></dd></dl>
3868 <ul><li>e</li>
3869 <li>f</li></ul>
3870
3871 !!end
3872
3873 !! test
3874 Definition Lists: Nesting: Multi-level (Parsoid only)
3875 !! options
3876 parsoid
3877 !! wikitext
3878 ;t1 :d1
3879 ;;t2 ::d2
3880 ;;;t3 :::d3
3881 !! html
3882 <dl>
3883 <dt>t1 </dt>
3884 <dd>d1</dd>
3885 <dt>
3886 <dl>
3887 <dt>t2 </dt>
3888 <dd>:d2</dd>
3889 <dt>
3890 <dl>
3891 <dt>t3 </dt>
3892 <dd>::d3</dd>
3893 </dl>
3894 </dt>
3895 </dl>
3896 </dt>
3897 </dl>
3898
3899
3900 !! end
3901
3902
3903 !! test
3904 Definition Lists: Nesting: Test 2 (Parsoid only)
3905 !! wikitext
3906 ;t1
3907 ::d2
3908 !! html/php+tidy
3909 <dl>
3910 <dt>t1</dt>
3911 <dd>
3912 <dl>
3913 <dd>d2</dd>
3914 </dl>
3915 </dd>
3916 </dl>
3917 !! html/parsoid
3918 <dl>
3919 <dt>t1</dt>
3920 <dd>
3921 <dl>
3922 <dd>d2</dd>
3923 </dl>
3924 </dd>
3925 </dl>
3926
3927 !! end
3928
3929
3930 !! test
3931 Definition Lists: Nesting: Test 3 (Parsoid only)
3932 !! wikitext
3933 :;t1
3934 ::::d2
3935 !! html/php+tidy
3936 <dl>
3937 <dd>
3938 <dl>
3939 <dt>t1</dt>
3940 <dd>
3941 <dl>
3942 <dd>
3943 <dl>
3944 <dd>d2</dd>
3945 </dl>
3946 </dd>
3947 </dl>
3948 </dd>
3949 </dl>
3950 </dd>
3951 </dl>
3952 !! html/parsoid
3953 <dl>
3954 <dd>
3955 <dl>
3956 <dt>t1</dt>
3957 <dd>
3958 <dl>
3959 <dd>
3960 <dl>
3961 <dd>d2</dd>
3962 </dl>
3963 </dd>
3964 </dl>
3965 </dd>
3966 </dl>
3967 </dd>
3968 </dl>
3969
3970 !! end
3971
3972
3973 !! test
3974 Definition Lists: Nesting: Test 4
3975 !! wikitext
3976 ::;t3
3977 :::d3
3978 !! html
3979 <dl><dd><dl><dd><dl><dt>t3</dt>
3980 <dd>d3</dd></dl></dd></dl></dd></dl>
3981
3982 !! end
3983
3984
3985 ## The Parsoid team believes the following three test exposes a
3986 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
3987 ## wrong to close the <dl> after the <dt> containing the <ul>.)
3988 ## It also exposes a "misfeature" in tidy, which doesn't like
3989 ## <dl> tags with a single <dt> child; it converts the <dt> into
3990 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
3991 !! test
3992 Definition Lists: Mixed Lists: Test 1
3993 !! wikitext
3994 :;* foo
3995 ::* bar
3996 :; baz
3997 !! html/php
3998 <dl><dd><dl><dt><ul><li> foo</li>
3999 <li> bar</li></ul></dt></dl>
4000 <dl><dt> baz</dt></dl></dd></dl>
4001
4002 !! html/php+tidy
4003 <dl>
4004 <dd>
4005 <dl>
4006 <dd>
4007 <ul>
4008 <li>foo</li>
4009 <li>bar</li>
4010 </ul>
4011 </dd>
4012 </dl>
4013 <dl>
4014 <dt>baz</dt>
4015 </dl>
4016 </dd>
4017 </dl>
4018 !! html/parsoid
4019 <dl>
4020 <dd><dl>
4021 <dt><ul>
4022 <li> foo
4023 </li>
4024 </ul></dt>
4025 <dd><ul>
4026 <li> bar
4027 </li>
4028 </ul></dd>
4029 <dt> baz</dt>
4030 </dl></dd>
4031 </dl>
4032 !! end
4033
4034 !! test
4035 Definition Lists: Mixed Lists: Test 2
4036 !! wikitext
4037 *: d1
4038 *: d2
4039 !! html
4040 <ul><li><dl><dd> d1</dd>
4041 <dd> d2</dd></dl></li></ul>
4042
4043 !! end
4044
4045
4046 !! test
4047 Definition Lists: Mixed Lists: Test 3
4048 !! wikitext
4049 *::: d1
4050 *::: d2
4051 !! html
4052 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4053 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4054
4055 !! end
4056
4057
4058 !! test
4059 Definition Lists: Mixed Lists: Test 4
4060 !! wikitext
4061 *;d1 :d2
4062 *;d3 :d4
4063 !! html
4064 <ul><li><dl><dt>d1&#160;</dt>
4065 <dd>d2</dd>
4066 <dt>d3&#160;</dt>
4067 <dd>d4</dd></dl></li></ul>
4068
4069 !! end
4070
4071
4072 !! test
4073 Definition Lists: Mixed Lists: Test 5
4074 !! wikitext
4075 *:d1
4076 *:: d2
4077 !! html
4078 <ul><li><dl><dd>d1
4079 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4080
4081 !! end
4082
4083
4084 !! test
4085 Definition Lists: Mixed Lists: Test 6
4086 !! wikitext
4087 #*:d1
4088 #*::: d3
4089 !! html
4090 <ol><li><ul><li><dl><dd>d1
4091 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4092
4093 !! end
4094
4095
4096 !! test
4097 Definition Lists: Mixed Lists: Test 7
4098 !! wikitext
4099 :* d1
4100 :* d2
4101 !! html
4102 <dl><dd><ul><li> d1</li>
4103 <li> d2</li></ul></dd></dl>
4104
4105 !! end
4106
4107
4108 !! test
4109 Definition Lists: Mixed Lists: Test 8
4110 !! wikitext
4111 :* d1
4112 ::* d2
4113 !! html
4114 <dl><dd><ul><li> d1</li></ul>
4115 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4116
4117 !! end
4118
4119
4120 !! test
4121 Definition Lists: Mixed Lists: Test 9
4122 !! wikitext
4123 *;foo :bar
4124 !! html
4125 <ul><li><dl><dt>foo&#160;</dt>
4126 <dd>bar</dd></dl></li></ul>
4127
4128 !! end
4129
4130
4131 !! test
4132 Definition Lists: Mixed Lists: Test 10
4133 !! wikitext
4134 *#;foo :bar
4135 !! html
4136 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4137 <dd>bar</dd></dl></li></ol></li></ul>
4138
4139 !! end
4140
4141 # The Parsoid team disagrees with the PHP parser's seemingly-random
4142 # rules regarding dd/dt on the next two tests. Parsoid is more
4143 # consistent, and recognizes the shared nesting and keeps the
4144 # still-open tags around until the nesting is complete.
4145 # (And tidy again converts <dt> to <dd> before 'bar'.)
4146
4147 !! test
4148 Definition Lists: Mixed Lists: Test 11
4149 !! wikitext
4150 *#*#;*;;foo :bar
4151 *#*#;boo :baz
4152 !! html/php
4153 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4154 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4155 <dl><dt>boo&#160;</dt>
4156 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4157
4158 !! html/php+tidy
4159 <ul>
4160 <li>
4161 <ol>
4162 <li>
4163 <ul>
4164 <li>
4165 <ol>
4166 <li>
4167 <dl>
4168 <dt>foo&#160;</dt>
4169 <dd>
4170 <ul>
4171 <li>
4172 <dl>
4173 <dd>
4174 <dl>
4175 <dt>bar</dt>
4176 </dl>
4177 </dd>
4178 </dl>
4179 </li>
4180 </ul>
4181 </dd>
4182 </dl>
4183 <dl>
4184 <dt>boo&#160;</dt>
4185 <dd>baz</dd>
4186 </dl>
4187 </li>
4188 </ol>
4189 </li>
4190 </ul>
4191 </li>
4192 </ol>
4193 </li>
4194 </ul>
4195 !! html/parsoid
4196 <ul>
4197 <li>
4198 <ol>
4199 <li>
4200 <ul>
4201 <li>
4202 <ol>
4203 <li>
4204 <dl>
4205 <dt>
4206 <ul>
4207 <li>
4208 <dl>
4209 <dt>
4210 <dl>
4211 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4212 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4213 </dl></dt>
4214 </dl></li>
4215 </ul></dt>
4216 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4217 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4218 </dl></li>
4219 </ol></li>
4220 </ul></li>
4221 </ol></li>
4222 </ul>
4223 !! end
4224
4225
4226 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4227 # From whitelist:
4228 # * The test is wrong, there are two colons where there should be :;
4229 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4230 !! test
4231 Definition Lists: Weird Ones: Test 1
4232 !! wikitext
4233 *#;*::;; foo : bar (who uses this?)
4234 !! html/php
4235 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4236 <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>
4237
4238 !! html/php+tidy
4239 <ul>
4240 <li>
4241 <ol>
4242 <li>
4243 <dl>
4244 <dt>foo&#160;</dt>
4245 <dd>
4246 <ul>
4247 <li>
4248 <dl>
4249 <dd>
4250 <dl>
4251 <dd>
4252 <dl>
4253 <dd>
4254 <dl>
4255 <dt>bar (who uses this?)</dt>
4256 </dl>
4257 </dd>
4258 </dl>
4259 </dd>
4260 </dl>
4261 </dd>
4262 </dl>
4263 </li>
4264 </ul>
4265 </dd>
4266 </dl>
4267 </li>
4268 </ol>
4269 </li>
4270 </ul>
4271 !! html/parsoid
4272 <ul>
4273 <li>
4274 <ol>
4275 <li>
4276 <dl>
4277 <dt>
4278 <ul>
4279 <li>
4280 <dl>
4281 <dd>
4282 <dl>
4283 <dd>
4284 <dl>
4285 <dt>
4286 <dl>
4287 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4288 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4289 </dl></dt>
4290 </dl></dd>
4291 </dl></dd>
4292 </dl></li>
4293 </ul></dt>
4294 </dl></li>
4295 </ol></li>
4296 </ul>
4297 !! end
4298
4299 !! test
4300 Definition Lists: colons occurring in tags
4301 !! wikitext
4302 ;a:b
4303 ;'''a:b'''
4304 ;<i>a:b</i>
4305 ;<span>a:b</span>
4306 ;<div>a:b</div>
4307 ;<div>a
4308 :b</div>
4309 ;{{echo|a:b}}
4310 ;{{echo|''a:b''}}
4311 ;;;''a:b''
4312 !! html+tidy
4313 <dl>
4314 <dt>a</dt>
4315 <dd>b</dd>
4316 <dt><b>a:b</b></dt>
4317 <dt><i>a:b</i></dt>
4318 <dt><span>a:b</span></dt>
4319 <dd>
4320 <div>a:b</div>
4321 </dd>
4322 <dd>
4323 <div>a
4324 <dl>
4325 <dd>b</dd>
4326 </dl>
4327 </div>
4328 </dd>
4329 <dt>a</dt>
4330 <dd>b</dd>
4331 <dt><i>a:b</i></dt>
4332 </dl>
4333 <dl>
4334 <dd>
4335 <dl>
4336 <dd>
4337 <dl>
4338 <dt><i>a:b</i></dt>
4339 </dl>
4340 </dd>
4341 </dl>
4342 </dd>
4343 </dl>
4344 !! html/parsoid
4345 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4346 <dt><b>a:b</b></dt>
4347 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4348 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4349 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4350 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4351 <dd>b</dd>
4352 <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>
4353 <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>
4354 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4355 !! end
4356
4357 !! test
4358 Definition Lists: colons and tables 1
4359 !! wikitext
4360 :{|
4361 | x
4362 |}
4363 :{|
4364 | y
4365 |}
4366 !! html
4367 <dl><dd><table>
4368 <tr>
4369 <td> x
4370 </td></tr></table></dd></dl>
4371 <dl><dd><table>
4372 <tr>
4373 <td> y
4374 </td></tr></table></dd></dl>
4375
4376 !! end
4377
4378 # Parsoid's output (as documented below) differs from php's in this case.
4379 # This is probably a bug. If we fixup parsoid to match php's output, the
4380 # above test should pass and the below test case can be removed. It is
4381 # unclear which output is more desirable.
4382
4383 !! test
4384 Definition Lists: colons and tables 2
4385 !! wikitext
4386 :{|
4387 | x
4388 |}
4389 :{|
4390 | y
4391 |}
4392 !! html/parsoid
4393 <dl><dd><table>
4394 <tr>
4395 <td> x
4396 </td></tr></table></dd>
4397 <dd><table>
4398 <tr>
4399 <td> y
4400 </td></tr></table></dd></dl>
4401 !! end
4402
4403 !! test
4404 Definition Lists: template interaction
4405 !! wikitext
4406 ::{{definition_list}}
4407
4408 :one
4409 ::{{definition_list}}
4410 :::two
4411 :::three
4412 ::four
4413 !! html/parsoid
4414 <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">
4415 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4416
4417 <dl><dd data-parsoid='{}'>one
4418 <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">
4419 </span><dd about="#mwt2">two
4420 <dl><dd>two</dd>
4421 <dd>three</dd></dl></dd>
4422 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4423 !! end
4424
4425
4426 ###
4427 ### External links
4428 ###
4429 !! test
4430 External links: non-bracketed
4431 !! wikitext
4432 Non-bracketed: http://example.com
4433 !! html
4434 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4435 </p>
4436 !! end
4437
4438 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4439 !! test
4440 External links: numbered
4441 !! wikitext
4442 Numbered: [http://example.com]
4443 Numbered: [http://example.net]
4444 Numbered: [http://example.com]
4445 !! html/php
4446 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4447 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4448 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4449 </p>
4450 !! html/parsoid
4451 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4452 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4453 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4454 !!end
4455
4456 !! test
4457 External links: specified text
4458 !! wikitext
4459 Specified text: [http://example.com link]
4460 !! html
4461 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4462 </p>
4463 !!end
4464
4465 !! test
4466 External links: trail
4467 !! wikitext
4468 Linktrails should not work for external links: [http://example.com link]s
4469 !! html
4470 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4471 </p>
4472 !! end
4473
4474 !! test
4475 External links: dollar sign in URL
4476 !! wikitext
4477 http://example.com/1$2345
4478 !! html
4479 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4480 </p>
4481 !! end
4482
4483 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4484 !! test
4485 External links: dollar sign in URL (autonumber)
4486 !! wikitext
4487 [http://example.com/1$2345]
4488 !! html/php
4489 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4490 </p>
4491 !! html/parsoid
4492 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4493 !!end
4494
4495 !! test
4496 External links: open square bracket forbidden in URL (bug 4377)
4497 !! options
4498 parsoid=wt2html,wt2wt,html2html
4499 !! wikitext
4500 http://example.com/1[2345
4501 !! html/php
4502 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4503 </p>
4504 !! html/parsoid
4505 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4506 !! end
4507
4508 !! test
4509 External links: open square bracket forbidden in URL (named) (bug 4377)
4510 !! options
4511 parsoid=wt2html,html2html
4512 !! wikitext
4513 [http://example.com/1[2345]
4514 !! html/php
4515 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4516 </p>
4517 !! html/parsoid
4518 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4519 !!end
4520
4521 # parsoid adds a space before the link name
4522 !! test
4523 External links: open square bracket forbidden in URL (named) (bug 4377)
4524 Parsoid variant.
4525 !! wikitext
4526 [http://example.com/1 [2345]
4527 !! html
4528 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4529 </p>
4530 !!end
4531
4532 !! test
4533 External links: nowiki in URL link text (bug 6230)
4534 !! wikitext
4535 [http://example.com/ <nowiki>''example site''</nowiki>]
4536 !! html
4537 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4538 </p>
4539 !! end
4540
4541 !! test
4542 External links: newline forbidden in text (bug 6230 regression check)
4543 !! wikitext
4544 [http://example.com/ first
4545 second]
4546 !! html
4547 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4548 second]
4549 </p>
4550 !!end
4551
4552 !! test
4553 External links: Pipe char between url and text
4554 !! wikitext
4555 [http://example.com | link]
4556 !! html
4557 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4558 </p>
4559 !!end
4560
4561 !! test
4562 External links: protocol-relative URL in brackets
4563 !! wikitext
4564 [//example.com/ Test]
4565 !! html
4566 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4567 </p>
4568 !! end
4569
4570 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4571 !! test
4572 External links: protocol-relative URL in brackets without text
4573 !! wikitext
4574 [//example.com]
4575 !! html/php
4576 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4577 </p>
4578 !! html/parsoid
4579 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4580 !! end
4581
4582 !! test
4583 External links: protocol-relative URL in free text is left alone
4584 !! wikitext
4585 //example.com/Foo
4586 !! html
4587 <p>//example.com/Foo
4588 </p>
4589 !!end
4590
4591 !! test
4592 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4593 !! wikitext
4594 foo//example.com/Foo
4595 !! html
4596 <p>foo//example.com/Foo
4597 </p>
4598 !! end
4599
4600 !! test
4601 External links: with no contents
4602 !! wikitext
4603 [http://en.wikipedia.org/wiki/Foo]
4604
4605 [[wikipedia:Foo|Bar]]
4606
4607 [[wikipedia:Foo|<span>Bar</span>]]
4608 !! html/php
4609 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4610 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4611 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4612 </p>
4613 !! html/parsoid
4614 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4615 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4616 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4617 !! end
4618
4619 !! test
4620 External links: Free with trailing punctuation
4621 !! wikitext
4622 http://example.com,
4623 http://example.com;
4624 http://example.com\
4625 http://example.com.
4626 http://example.com:
4627 http://example.com!
4628 http://example.com?
4629 http://example.com)
4630 http://example.com/url_with_(brackets)
4631 (http://example.com/url_without_brackets)
4632 http://example.com/url_with_entity&amp;
4633 http://example.com/url_with_entity&#x26;
4634 http://example.com/url_with_entity&#038;
4635 http://example.com/url_with_entity&nbsp;
4636 http://example.com/url_with_entity&#xA0;
4637 http://example.com/url_with_entity&#160;
4638 http://example.com/url_with_entity&lt;
4639 http://example.com/url_with_entity&#x3C;
4640 http://example.com/url_with_entity&#60;
4641 !! html/php
4642 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4643 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4644 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4645 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4646 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4647 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4648 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4649 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4650 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4651 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4652 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4653 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4654 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4655 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4656 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4657 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4658 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4659 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4660 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4661 </p>
4662 !! html/parsoid
4663 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4664 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4665 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4666 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4667 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4668 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4669 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4670 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4671 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4672 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4673 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4674 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4675 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4676 <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>
4677 <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>
4678 <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>
4679 <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>
4680 <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>
4681 <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>
4682 !! end
4683
4684 !! test
4685 External links: tricky Parsoid html2html case
4686 !! options
4687 parsoid=wt2html,wt2wt,html2html
4688 !! wikitext
4689 http://example.com/url_with_entity&amp;amp;
4690 !! html/php
4691 <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>;
4692 </p>
4693 !! html/parsoid
4694 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4695 !! end
4696
4697 !! test
4698 External links: Free with trailing quotes (T113666)
4699 !! wikitext
4700 '''News:''' Stuff here
4701
4702 news:'a'b''c''d e
4703 !! html/php
4704 <p><b>News:</b> Stuff here
4705 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4706 </p>
4707 !! html/parsoid
4708 <p><b>News:</b> Stuff here</p>
4709 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4710 !! end
4711
4712 !! test
4713 External links: Lone protocols are never linked (T105697)
4714 !! wikitext
4715 http://
4716 http://;
4717 (http://)
4718 bitcoin:
4719 bitcoin:;
4720 (bitcoin:)
4721 !! html
4722 <p>http://
4723 http://;
4724 (http://)
4725 bitcoin:
4726 bitcoin:;
4727 (bitcoin:)
4728 </p>
4729 !! end
4730
4731 !! test
4732 External links: No preceding word characters allowed (bug 65278)
4733 !! wikitext
4734 NOPEhttp://example.com
4735 N0http://example.com
4736 ok:http://example.com
4737 ok-http://example.com
4738 !! html
4739 <p>NOPEhttp://example.com
4740 N0http://example.com
4741 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4742 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4743 </p>
4744 !! end
4745
4746 !! test
4747 External links: nofollow domain exception
4748 !! wikitext
4749 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
4750 !! html
4751 <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>.
4752 </p>
4753 !!end
4754
4755 !! test
4756 External image
4757 !! wikitext
4758 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4759 !! html
4760 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4761 </p>
4762 !! end
4763
4764 !! test
4765 External image from https
4766 !! wikitext
4767 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4768 !! html
4769 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4770 </p>
4771 !! end
4772
4773 !! test
4774 External image (when not allowed)
4775 !! options
4776 wgAllowExternalImages=0
4777 !! wikitext
4778 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4779 !! html
4780 <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>
4781 </p>
4782 !! end
4783
4784 !! test
4785 Link to non-http image, no img tag
4786 !! wikitext
4787 Link to non-http image, no img tag: ftp://example.com/test.jpg
4788 !! html
4789 <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>
4790 </p>
4791 !! end
4792
4793 !! test
4794 External links: terminating separator
4795 !! wikitext
4796 Terminating separator: http://example.com/thing,
4797 !! html
4798 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4799 </p>
4800 !! end
4801
4802 !! test
4803 External links: intervening separator
4804 !! wikitext
4805 Intervening separator: http://example.com/1,2,3
4806 !! html
4807 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4808 </p>
4809 !! end
4810
4811 !! test
4812 External links: old bug with URL in query
4813 !! wikitext
4814 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4815 !! html
4816 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4817 </p>
4818 !! end
4819
4820 !! test
4821 External links: old URL-in-URL bug, mixed protocols
4822 !! wikitext
4823 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4824 !! html
4825 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4826 </p>
4827 !!end
4828
4829 # Since Parsoid is starting to emit canonical wikitext for links,
4830 # [http://example.com http://example.com] will not RT back to that
4831 # form anymore.
4832 !! test
4833 External links: URL in text
4834 !! options
4835 parsoid=wt2html
4836 !! wikitext
4837 URL in text: [http://example.com http://example.com]
4838 !! html/php
4839 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4840 </p>
4841 !! html/parsoid
4842 <p>URL in text: <a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4843 !! end
4844
4845 !! test
4846 External links: Clickable images
4847 !! wikitext
4848 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4849 !! html/php
4850 <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>
4851 </p>
4852 !! html/parsoid
4853 <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>
4854 !! end
4855
4856 !! test
4857 External links: raw ampersand
4858 !! wikitext
4859 Old &amp; use: http://x&y
4860 !! html
4861 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4862 </p>
4863 !! end
4864
4865 !! test
4866 External links: encoded ampersand
4867 !! wikitext
4868 Old &amp; use: http://x&amp;y
4869 !! html/php
4870 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4871 </p>
4872 !! html/parsoid
4873 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4874 !! end
4875
4876 !! test
4877 External links: encoded equals (bug 6102)
4878 !! wikitext
4879 http://example.com/?foo&#61;bar
4880 !! html/php
4881 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4882 </p>
4883 !! html/parsoid
4884 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4885 !! end
4886
4887 ##
4888 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4889 ## does it number them. As discussed in bug 53505, we can identify
4890 ## autonumbered links via CSS.
4891 ##
4892
4893 !! test
4894 External links: [raw ampersand]
4895 !! wikitext
4896 Old &amp; use: [http://x&y]
4897 !! html/php
4898 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4899 </p>
4900 !! html/parsoid
4901 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4902 !! end
4903
4904 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4905 # mode will return the [raw ampersand] wikitext
4906 !! test
4907 External links: [encoded ampersand]
4908 !! options
4909 parsoid=wt2html,wt2wt,html2html
4910 !! wikitext
4911 Old &amp; use: [http://x&amp;y]
4912 !! html/php
4913 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4914 </p>
4915 !! html/parsoid
4916 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4917 !! end
4918
4919 !! test
4920 External links: [raw equals]
4921 !! wikitext
4922 [http://example.com/?foo=bar]
4923 !! html/php
4924 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4925 </p>
4926 !! html/parsoid
4927 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4928 !! end
4929
4930 # note that parsoid html is identical to [raw equals] case; so html2wt
4931 # mode will return the [raw equals] wikitext
4932 !! test
4933 External links: [encoded equals] (bug 6102)
4934 !! options
4935 parsoid=wt2html,wt2wt,html2html
4936 !! wikitext
4937 [http://example.com/?foo&#61;bar]
4938 !! html/php
4939 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4940 </p>
4941 !! html/parsoid
4942 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4943 !! end
4944
4945 # xxx parsoid strips the IDN character, so the round-trip tests will
4946 # obviously fail and are disabled. --cscott
4947 !! test
4948 External links: [IDN ignored character reference in hostname; strip it right off]
4949 !! options
4950 parsoid=wt2html,wt2wt,html2html
4951 !! wikitext
4952 [http://e&zwnj;xample.com/]
4953 !! html/php
4954 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4955 </p>
4956 !! html/parsoid
4957 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4958 !! end
4959
4960 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4961 # Where an external link could easily circumvent the sanitization of the text of
4962 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4963 # test demands a higher standard. That's a bit strange.
4964 #
4965 # Example:
4966 #
4967 # http://e‌xample.com -> [http://example.com|http://example.com]
4968 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4969 #
4970 # The first example is sanitized, but the second is not. Any security benefits
4971 # from this production are trivial to circumvent. Either remove this test and
4972 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4973 # the test accordingly.
4974 #
4975 # All our love,
4976 # The Parsoid team.
4977 # xxx parsoid strips the IDN character, so the round-trip tests will
4978 # obviously fail and are disabled. --cscott
4979 !! test
4980 External links: IDN ignored character reference in hostname; strip it right off
4981 !! options
4982 parsoid=wt2html,html2html
4983 !! wikitext
4984 http://e&zwnj;xample.com/
4985 !! html/php
4986 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4987 </p>
4988 !! html/parsoid
4989 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4990 !! end
4991
4992 !! test
4993 External links: www.jpeg.org (bug 554)
4994 !! wikitext
4995 http://www.jpeg.org
4996 !! html
4997 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
4998 </p>
4999 !! end
5000
5001 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
5002 !! test
5003 External links: URL within URL (original bug 2)
5004 !! wikitext
5005 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5006 !! html/php
5007 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5008 </p>
5009 !! html/parsoid
5010 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5011 !! end
5012
5013 !! test
5014 BUG 361: URL inside bracketed URL
5015 !! wikitext
5016 [http://www.example.com/foo http://www.example.com/bar]
5017 !! html
5018 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5019 </p>
5020 !! end
5021
5022 !! test
5023 BUG 361: URL within URL, not bracketed
5024 !! wikitext
5025 http://www.example.com/foo?=http://www.example.com/bar
5026 !! html
5027 <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>
5028 </p>
5029 !! end
5030
5031 !! test
5032 BUG 289: ">"-token in URL-tail
5033 !! wikitext
5034 http://www.example.com/<hello>
5035 !! html
5036 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5037 </p>
5038 !!end
5039
5040 !! test
5041 BUG 289: literal ">"-token in URL-tail
5042 !! wikitext
5043 http://www.example.com/<b>html</b>
5044 !! html/php
5045 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5046 </p>
5047 !! html/parsoid
5048 <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>
5049 !! end
5050
5051 !! test
5052 BUG 289: ">"-token in bracketed URL
5053 !! wikitext
5054 [http://www.example.com/<hello> stuff]
5055 !! html
5056 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5057 </p>
5058 !!end
5059
5060 !! test
5061 BUG 289: literal ">"-token in bracketed URL
5062 !! wikitext
5063 [http://www.example.com/<b>html</b> stuff]
5064 !! html
5065 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5066 </p>
5067 !!end
5068
5069 !! test
5070 BUG 289: literal double quote at end of URL
5071 !! wikitext
5072 http://www.example.com/"hello"
5073 !! html
5074 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5075 </p>
5076 !!end
5077
5078 !! test
5079 BUG 289: literal double quote 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/">"hello" stuff</a>
5084 </p>
5085 !!end
5086
5087 !! test
5088 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5089 !! wikitext
5090 [http://www.example.com test]
5091 !! html
5092 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5093 </p>
5094 !! end
5095
5096 !! test
5097 External links: link text with spaces
5098 !! wikitext
5099 [http://www.example.com a b c]
5100 [http://www.example.com ''a'' ''b'']
5101 !! html
5102 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5103 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5104 </p>
5105 !! end
5106
5107 !! test
5108 External links: wiki links within external link (Bug 3695)
5109 !! options
5110 parsoid=wt2html,html2html
5111 !! wikitext
5112 [http://example.com [[wikilink]] embedded in ext link]
5113 !! html/php
5114 <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>
5115 </p>
5116 !! html/parsoid
5117 <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>
5118 !! end
5119
5120 !! test
5121 BUG 787: Links with one slash after the url protocol are invalid
5122 !! wikitext
5123 http:/example.com
5124
5125 [http:/example.com title]
5126 !! html
5127 <p>http:/example.com
5128 </p><p>[http:/example.com title]
5129 </p>
5130 !! end
5131
5132 !! test
5133 Bracketed external links with template-generated invalid target
5134 !! wikitext
5135 [{{echo|http:/example.com}} title]
5136 !! html
5137 <p>[http:/example.com title]
5138 </p>
5139 !! end
5140
5141 !! test
5142 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5143 !! wikitext
5144 ''[http://example.com text'']
5145 [http://example.com '''text]'''
5146 ''Something [http://example.com in italic'']
5147 ''Something [http://example.com mixed''''', even bold]'''
5148 '''''Now [http://example.com both''''']
5149 !! html
5150 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5151 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5152 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5153 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5154 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5155 </p>
5156 !! end
5157
5158
5159 !! test
5160 Bug 4781: %26 in URL
5161 !! wikitext
5162 http://www.example.com/?title=AT%26T
5163 !! html/php
5164 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5165 </p>
5166 !! html/parsoid
5167 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5168 !! end
5169
5170 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5171 # % is actually legal in HTML5. Any change in output would need testing though.
5172 !! test
5173 Bug 4781, 5267: %25 in URL
5174 !! wikitext
5175 http://www.example.com/?title=100%25_Bran
5176 !! html/php
5177 <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>
5178 </p>
5179 !! html/parsoid
5180 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5181 !! end
5182
5183 !! test
5184 Bug 4781, 5267: %28, %29 in URL
5185 !! wikitext
5186 http://www.example.com/?title=Ben-Hur_%281959_film%29
5187 !! html/php
5188 <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>
5189 </p>
5190 !! html/parsoid
5191 <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>
5192 !! end
5193
5194
5195 !! test
5196 Bug 4781: %26 in autonumber URL
5197 !! wikitext
5198 [http://www.example.com/?title=AT%26T]
5199 !! html/php
5200 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5201 </p>
5202 !! html/parsoid
5203 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5204 !! end
5205
5206 !! test
5207 Bug 4781, 5267: %26 in autonumber URL
5208 !! wikitext
5209 [http://www.example.com/?title=100%25_Bran]
5210 !! html/php
5211 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5212 </p>
5213 !! html/parsoid
5214 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5215 !! end
5216
5217 !! test
5218 Bug 4781, 5267: %28, %29 in autonumber URL
5219 !! wikitext
5220 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5221 !! html/php
5222 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5223 </p>
5224 !! html/parsoid
5225 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5226 !! end
5227
5228
5229 !! test
5230 Bug 4781: %26 in bracketed URL
5231 !! wikitext
5232 [http://www.example.com/?title=AT%26T link]
5233 !! html/php
5234 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5235 </p>
5236 !! html/parsoid
5237 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5238 !! end
5239
5240 !! test
5241 Bug 4781, 5267: %25 in bracketed URL
5242 !! wikitext
5243 [http://www.example.com/?title=100%25_Bran link]
5244 !! html
5245 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5246 </p>
5247 !! end
5248
5249 !! test
5250 Bug 4781, 5267: %28, %29 in bracketed URL
5251 !! wikitext
5252 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5253 !! html/php
5254 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5255 </p>
5256 !! html/parsoid
5257 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5258 !! end
5259
5260 !! test
5261 External link containing a period in the anchor. (bug 63947)
5262 !! wikitext
5263 [//foo.org/bar#baz. bang]
5264
5265 [//foo.org/bar. bang]
5266 !! html/php
5267 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5268 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5269 </p>
5270 !! html/parsoid
5271 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5272 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5273 !! end
5274
5275 !! test
5276 External link containing a single quote. (bug 63947)
5277 !! wikitext
5278 [//foo.org/bar'baz]
5279
5280 [//foo.org/bar'baz bang]
5281 !! html/php
5282 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5283 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5284 </p>
5285 !! html/parsoid
5286 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5287 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5288 !! end
5289
5290 !! test
5291 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5292 !! wikitext
5293 Some [http://example.com/ pretty ''italics'' and stuff]!
5294 !! html
5295 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5296 </p>
5297 !! end
5298
5299 !! test
5300 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5301 !! wikitext
5302 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5303 !! html
5304 <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>
5305 </p>
5306 !! end
5307
5308 !! test
5309 External link containing double-single-quotes with no space separating the url from text in italics
5310 !! wikitext
5311 [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]].]
5312 !! html/php
5313 <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>
5314 </p>
5315 !! html/php+tidy
5316 <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>
5317 !! html/parsoid
5318 <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>
5319 !! end
5320
5321 !! test
5322 External link with comments in link text
5323 !! wikitext
5324 [http://www.google.com Google <!-- comment -->]
5325 !! html/php
5326 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5327 </p>
5328 !! html/parsoid
5329 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5330 !! end
5331
5332 !! test
5333 External link to bare IPv4 address
5334 !! wikitext
5335 [http://192.168.0.1 Link]
5336 !! html/php
5337 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5338 </p>
5339 !! html/parsoid
5340 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5341 !! end
5342
5343 !! test
5344 URL-encoding in URL functions (single parameter)
5345 !! wikitext
5346 {{localurl:Some page|amp=&}}
5347 !! html
5348 <p>/index.php?title=Some_page&amp;amp=&amp;
5349 </p>
5350 !! end
5351
5352 !! test
5353 URL-encoding in URL functions (multiple parameters)
5354 !! wikitext
5355 {{localurl:Some page|q=?&amp=&}}
5356 !! html
5357 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5358 </p>
5359 !! end
5360
5361 !! test
5362 Brackets in urls
5363 !! wikitext
5364 http://example.com/index.php?foozoid%5B%5D=bar
5365
5366 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5367 !! html/php
5368 <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>
5369 </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>
5370 </p>
5371 !! html/parsoid
5372 <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>
5373
5374 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5375 !! end
5376
5377 !! test
5378 IPv6 urls, autolink format (T23261)
5379 !! wikitext
5380 http://[2404:130:0:1000::187:2]/index.php
5381
5382 Examples from RFC 2373, section 2.2:
5383 * http://[1080::8:800:200C:417A]/unicast
5384 * http://[FF01::101]/multicast
5385 * http://[::1]/loopback
5386 * http://[::]/unspecified
5387 * http://[::13.1.68.3]/ipv4compat
5388 * http://[::FFFF:129.144.52.38]/ipv4compat
5389
5390 Examples from RFC 2732, section 2:
5391 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5392 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5393 * http://[3ffe:2a00:100:7031::1]
5394 * http://[1080::8:800:200C:417A]/foo
5395 * http://[::192.9.5.5]/ipng
5396 * http://[::FFFF:129.144.52.38]:80/index.html
5397 * http://[2010:836B:4179::836B:4179]
5398
5399 !! html/php
5400 <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>
5401 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5402 </p>
5403 <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>
5404 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5405 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5406 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5407 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5408 <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>
5409 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5410 </p>
5411 <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>
5412 <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>
5413 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5414 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5415 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5416 <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>
5417 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5418
5419 !! html/parsoid
5420 <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>
5421
5422 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5423 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5424 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5425 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5426 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5427 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5428 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5429
5430 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5431 <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>
5432 <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>
5433 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5434 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5435 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5436 <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>
5437 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5438 !! end
5439
5440 !! test
5441 IPv6 urls, bracketed format (T23261)
5442 !! wikitext
5443 [http://[2404:130:0:1000::187:2]/index.php test]
5444
5445 Examples from RFC 2373, section 2.2:
5446 * [http://[1080::8:800:200C:417A] unicast]
5447 * [http://[FF01::101] multicast]
5448 * [http://[::1]/ loopback]
5449 * [http://[::] unspecified]
5450 * [http://[::13.1.68.3] ipv4compat]
5451 * [http://[::FFFF:129.144.52.38] ipv4compat]
5452
5453 Examples from RFC 2732, section 2:
5454 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5455 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5456 * [http://[3ffe:2a00:100:7031::1] 3]
5457 * [http://[1080::8:800:200C:417A]/foo 4]
5458 * [http://[::192.9.5.5]/ipng 5]
5459 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5460 * [http://[2010:836B:4179::836B:4179] 7]
5461
5462 !! html/php
5463 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5464 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5465 </p>
5466 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5467 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5468 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5469 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5470 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5471 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5472 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5473 </p>
5474 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5475 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5476 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5477 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5478 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5479 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5480 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5481
5482 !! html/parsoid
5483 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5484
5485 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5486 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5487 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5488 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5489 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5490 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5491 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5492
5493 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5494 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5495 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5496 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5497 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5498 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5499 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5500 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5501 !! end
5502
5503 !! test
5504 Non-extlinks in brackets
5505 !! wikitext
5506 [foo]
5507 [foo bar]
5508 [foo ''bar'']
5509 [fool's] errand
5510 [fool's errand]
5511 [{{echo|foo}}]
5512 [{{echo|foo}} bar]
5513 [{{echo|foo}} ''bar'']
5514 [{{echo|foo}}l's] errand
5515 [{{echo|foo}}l's errand]
5516 [url={{echo|foo}}]
5517 [url=http://example.com]
5518 [http:// bare protocols don't count]
5519 !! html/php
5520 <p>[foo]
5521 [foo bar]
5522 [foo <i>bar</i>]
5523 [fool's] errand
5524 [fool's errand]
5525 [foo]
5526 [foo bar]
5527 [foo <i>bar</i>]
5528 [fool's] errand
5529 [fool's errand]
5530 [url=foo]
5531 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5532 [http:// bare protocols don't count]
5533 </p>
5534 !! html/parsoid
5535 <p>[foo]
5536 [foo bar]
5537 [foo <i>bar</i>]
5538 [fool's] errand
5539 [fool's errand]
5540 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5541 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5542 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5543 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5544 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5545 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5546 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5547 [http:// bare protocols don't count]</p>
5548 !! end
5549
5550 !! test
5551 Percent encoding in external links
5552 !! wikitext
5553 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5554 !! html/php
5555 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5556 </p>
5557 !! html/parsoid
5558 <p><a rel="mw:ExtLink"
5559 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5560 !! end
5561
5562 !! test
5563 Use url link syntax for links where the content is equal the link target
5564 !! wikitext
5565 http://example.com
5566 !! html/php
5567 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5568 </p>
5569 !! html/parsoid
5570 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5571 !! end
5572
5573 !! test
5574 Parenthesis in external links, especially URL links
5575 !! wikitext
5576 http://example.com)
5577
5578 http://example.com/test)
5579
5580 http://example.com/(test)
5581
5582 http://example.com/((test)
5583
5584 (http://example.com/(test))
5585
5586 (http://example.com/(test)))))
5587
5588 http://example.com/a)b
5589
5590 [http://example.com) foo]
5591 !! html/php
5592 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5593 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5594 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5595 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5596 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5597 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5598 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5599 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5600 </p>
5601 !! html/parsoid
5602 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5603 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5604 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5605 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5606 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5607 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5608 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5609 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5610 !! end
5611
5612 !! test
5613 Parenthesis in external links, w/ transclusion or comment
5614 !! wikitext
5615 (http://example.com/{{echo|hi}})
5616
5617 (http://example.com<!-- hi -->)
5618 !! html/php
5619 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5620 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5621 </p>
5622 !! html/parsoid
5623 <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>
5624
5625 <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>
5626 !! end
5627
5628 !! test
5629 Serialize <a> tags with invalid link targets as plain text
5630 !! options
5631 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5632 !! html/parsoid
5633 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5634 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5635 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5636 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5637 !! wikitext
5638 text
5639 <nowiki>*</nowiki>text
5640 <nowiki>[[foo]]</nowiki>
5641 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5642 !! end
5643
5644 !! test
5645 mw:ExtLink -vs- mw:WikiLink (T94723)
5646 !! options
5647 parsoid=html2wt
5648 !! html/parsoid
5649 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5650 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5651 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5652 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5653 <p>
5654 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5655 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5656 </p>
5657 !! wikitext
5658 [[Foo|Bar]]
5659 [[Foo|Bar]]
5660 [[wikipedia:Foo|Bar]]
5661 [[wikipedia:Foo|Bar]]
5662
5663 [[wikipedia:European_Robin|European Robin]]
5664 [[wikipedia:European_Robin|European Robin]]
5665 !! end
5666
5667 !! test
5668 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5669 !! options
5670 parsoid=wt2wt
5671 !! wikitext
5672 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5673 !! html/parsoid
5674 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5675 !! end
5676
5677
5678 ###
5679 ### Quotes
5680 ###
5681
5682 !! test
5683 Quotes
5684 !! wikitext
5685 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5686
5687 Normal text. '''''Bold italic text.''''' Normal text.
5688 !! html
5689 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5690 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5691 </p>
5692 !! end
5693
5694
5695 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5696 # parser strips. The wikitext contains just the first half of the bold
5697 # quote pair.
5698 !! test
5699 Unclosed and unmatched quotes
5700 !! wikitext
5701 '''''Bold italic text '''with bold deactivated''' in between.'''''
5702
5703 '''''Bold italic text ''with italic deactivated'' in between.'''''
5704
5705 '''Bold text..
5706
5707 ..spanning two paragraphs (should not work).'''
5708
5709 '''Bold tag left open
5710
5711 ''Italic tag left open
5712
5713 Normal text.
5714
5715 <!-- Unmatching number of opening, closing tags: -->
5716 '''This year''''s election ''should'' beat '''last year''''s.
5717
5718 ''Tom'''s car is bigger than ''Susan'''s.
5719
5720 Plain ''italic'''s plain
5721 !! html/php
5722 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5723 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5724 </p><p><b>Bold text..</b>
5725 </p><p>..spanning two paragraphs (should not work).
5726 </p><p><b>Bold tag left open</b>
5727 </p><p><i>Italic tag left open</i>
5728 </p><p>Normal text.
5729 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5730 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5731 </p><p>Plain <i>italic'</i>s plain
5732 </p>
5733 !! html/parsoid
5734 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5735 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5736 </p><p><b>Bold text..</b>
5737 </p><p>..spanning two paragraphs (should not work).<b></b>
5738 </p><p><b>Bold tag left open</b>
5739 </p><p><i>Italic tag left open</i>
5740 </p><p>Normal text.
5741 </p>
5742 <!-- Unmatching number of opening, closing tags: -->
5743 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5744 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5745 </p><p>Plain <i>italic'</i>s plain
5746 </p>
5747 !! end
5748
5749 ###
5750 ### Tables
5751 ###
5752 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5753 ###
5754
5755 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5756 # is the bare minimum required by the spec, see:
5757 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5758 # Parsoid team replies: empty table tags are legal in HTML5
5759 !! test
5760 A table with no data.
5761 !! options
5762 parsoid=wt2html
5763 !! wikitext
5764 {||}
5765 !! html/php
5766
5767 !! html/parsoid
5768 <table></table>
5769
5770 !! end
5771
5772 !! test
5773 A table with stray table end tags on start tag line (wt2html)
5774 !! options
5775 parsoid=wt2html
5776 !! wikitext
5777 {|style="color: red;"|}
5778
5779 {|style="color: red;" |}
5780 |foo
5781 |}
5782
5783 {|style="color: red;"|} id="foo"
5784 |foo
5785 |}
5786
5787 {|style="color: red;" |} id="foo"
5788 |foo
5789 |}
5790 !! html
5791 <table style="color: red;"></table>
5792
5793 <table style="color: red;">
5794 <tbody><tr>
5795 <td>foo</td>
5796 </tr></tbody>
5797 </table>
5798
5799 <table style="color: red;" id="foo">
5800 <tbody><tr>
5801 <td>foo</td>
5802 </tr></tbody>
5803 </table>
5804
5805 <table style="color: red;" id="foo">
5806 <tbody><tr>
5807 <td>foo</td>
5808 </tr></tbody>
5809 </table>
5810
5811 !! end
5812
5813 !! test
5814 A table with no data (take 2)
5815 !! wikitext
5816 {|
5817 |}
5818 !! html/parsoid
5819 <table></table>
5820 !! end
5821
5822 # A table with nothing but a caption is invalid XHTML, we might want to render
5823 # this as <p>caption</p>
5824 # Parsoid team replies: table with only a caption is legal in HTML5
5825 !! test
5826 A table with nothing but a caption
5827 !! wikitext
5828 {|
5829 |+ caption
5830 |}
5831 !! html/php
5832 <table>
5833 <caption> caption
5834 </caption><tr><td></td></tr></table>
5835
5836 !! html/parsoid
5837 <table><caption> caption</caption></table>
5838 !! end
5839
5840 !! test
5841 A table with caption with default-spaced attributes and a table row
5842 !! wikitext
5843 {|
5844 |+ style="color: red;" | caption1
5845 |-
5846 | foo
5847 |}
5848 !! html
5849 <table>
5850 <caption style="color: red;"> caption1
5851 </caption>
5852 <tr>
5853 <td> foo
5854 </td></tr></table>
5855
5856 !! end
5857
5858 !! test
5859 A table with captions with non-default spaced attributes and a table row
5860 !! wikitext
5861 {|
5862 |+style="color: red;"|caption2
5863 |+ style="color: red;"| caption3
5864 |-
5865 | foo
5866 |}
5867 !! html
5868 <table>
5869 <caption style="color: red;">caption2
5870 </caption>
5871 <caption style="color: red;"> caption3
5872 </caption>
5873 <tr>
5874 <td> foo
5875 </td></tr></table>
5876
5877 !! end
5878
5879 !! test
5880 Table td-cell syntax variations
5881 !! wikitext
5882 {|
5883 | foo bar foo | baz
5884 | foo bar foo || baz
5885 | style='color:red;' | baz
5886 | style='color:red;' || baz
5887 |}
5888 !! html
5889 <table>
5890 <tr>
5891 <td> baz
5892 </td>
5893 <td> foo bar foo </td>
5894 <td> baz
5895 </td>
5896 <td style="color:red;"> baz
5897 </td>
5898 <td> style='color:red;' </td>
5899 <td> baz
5900 </td></tr></table>
5901
5902 !! end
5903
5904 !! test
5905 Simple table
5906 !! wikitext
5907 {|
5908 | 1 || 2
5909 |-
5910 | 3 || 4
5911 |}
5912 !! html
5913 <table>
5914 <tr>
5915 <td> 1 </td>
5916 <td> 2
5917 </td></tr>
5918 <tr>
5919 <td> 3 </td>
5920 <td> 4
5921 </td></tr></table>
5922
5923 !! end
5924
5925 !! test
5926 Simple table but with multiple dashes for row wikitext
5927 !! wikitext
5928 {|
5929 | foo
5930 |-----
5931 | bar
5932 |}
5933 !! html
5934 <table>
5935 <tr>
5936 <td> foo
5937 </td></tr>
5938 <tr>
5939 <td> bar
5940 </td></tr></table>
5941
5942 !! end
5943
5944 !! test
5945 Multiplication table
5946 !! wikitext
5947 {| border="1" cellpadding="2"
5948 |+Multiplication table
5949 |-
5950 ! &times; !! 1 !! 2 !! 3
5951 |-
5952 ! 1
5953 | 1 || 2 || 3
5954 |-
5955 ! 2
5956 | 2 || 4 || 6
5957 |-
5958 ! 3
5959 | 3 || 6 || 9
5960 |-
5961 ! 4
5962 | 4 || 8 || 12
5963 |-
5964 ! 5
5965 | 5 || 10 || 15
5966 |}
5967 !! html
5968 <table border="1" cellpadding="2">
5969 <caption>Multiplication table
5970 </caption>
5971 <tr>
5972 <th> &#215; </th>
5973 <th> 1 </th>
5974 <th> 2 </th>
5975 <th> 3
5976 </th></tr>
5977 <tr>
5978 <th> 1
5979 </th>
5980 <td> 1 </td>
5981 <td> 2 </td>
5982 <td> 3
5983 </td></tr>
5984 <tr>
5985 <th> 2
5986 </th>
5987 <td> 2 </td>
5988 <td> 4 </td>
5989 <td> 6
5990 </td></tr>
5991 <tr>
5992 <th> 3
5993 </th>
5994 <td> 3 </td>
5995 <td> 6 </td>
5996 <td> 9
5997 </td></tr>
5998 <tr>
5999 <th> 4
6000 </th>
6001 <td> 4 </td>
6002 <td> 8 </td>
6003 <td> 12
6004 </td></tr>
6005 <tr>
6006 <th> 5
6007 </th>
6008 <td> 5 </td>
6009 <td> 10 </td>
6010 <td> 15
6011 </td></tr></table>
6012
6013 !! end
6014
6015 !! test
6016 Accept "||" in table headings
6017 !! wikitext
6018 {|
6019 !h1 || h2
6020 |}
6021 !! html
6022 <table>
6023 <tr>
6024 <th>h1 </th>
6025 <th> h2
6026 </th></tr></table>
6027
6028 !! end
6029
6030 !! test
6031 Accept "!!" in table data
6032 !! wikitext
6033 {|
6034 | Foo!! ||
6035 |}
6036 !! html
6037 <table>
6038 <tr>
6039 <td> Foo!! </td>
6040 <td>
6041 </td></tr></table>
6042
6043 !! html/parsoid
6044 <table>
6045 <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>
6046 </tbody></table>
6047 !! end
6048
6049 !! test
6050 Accept "||" in indented table headings
6051 !! wikitext
6052 :{|
6053 !h1 || h2
6054 |}
6055 !! html
6056 <dl><dd><table>
6057 <tr>
6058 <th>h1 </th>
6059 <th> h2
6060 </th></tr></table></dd></dl>
6061
6062 !! end
6063
6064 !! test
6065 Accept "!!" in templates
6066 !! wikitext
6067 {|
6068 !a {{echo|b!!c}}
6069 |}
6070 !! html/php
6071 <table>
6072 <tr>
6073 <th>a b</th>
6074 <th>c
6075 </th></tr></table>
6076
6077 !! html/parsoid
6078 <table>
6079 <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>
6080 !! end
6081
6082 !! test
6083 Accept "!!" in table headings after newline
6084 !! wikitext
6085 {|
6086 !a
6087 b!!c
6088 |}
6089 !! html/php
6090 <table>
6091 <tr>
6092 <th>a
6093 <p>b!!c
6094 </p>
6095 </th></tr></table>
6096
6097 !! html/parsoid
6098 <table>
6099 <tbody><tr><th>a
6100 <p>b!!c</p></th></tr>
6101 </tbody></table>
6102 !! end
6103
6104 !! test
6105 Accept "!!" in table data of mixed wikitext / html syntax
6106 !! wikitext
6107 {|
6108 !a
6109 <tr><td>b!!c</td></tr>
6110 |}
6111 !! html+tidy
6112 <table>
6113 <tr>
6114 <th>a</th>
6115 </tr>
6116 <tr>
6117 <td>b!!c</td>
6118 </tr>
6119 </table>
6120 !! html/parsoid
6121 <table>
6122 <tbody><tr><th>a</th></tr>
6123 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6124 </tbody></table>
6125 !! end
6126
6127 !! test
6128 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6129 !! wikitext
6130 {|
6131 !| h1
6132 || a
6133 |}
6134 !! html
6135 <table>
6136 <tr>
6137 <th> h1
6138 </th>
6139 <td> a
6140 </td></tr></table>
6141
6142 !! end
6143
6144 !!test
6145 Accept "| !" at start of line in tables (ignore !-attribute)
6146 !! wikitext
6147 {|
6148 |-
6149 | !style="color:red" | bar
6150 |}
6151 !! html
6152 <table>
6153
6154 <tr>
6155 <td> bar
6156 </td></tr></table>
6157
6158 !!end
6159
6160 !!test
6161 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 +/-
6162 !! wikitext
6163 {|
6164 |-
6165 |style='color:red;'|+1
6166 |style='color:blue;'|-1
6167 |-
6168 | 1 || 2 || 3
6169 | 1 ||+2 ||-3
6170 |-
6171 | +1
6172 | -1
6173 |}
6174 !! html
6175 <table>
6176
6177 <tr>
6178 <td style="color:red;">+1
6179 </td>
6180 <td style="color:blue;">-1
6181 </td></tr>
6182 <tr>
6183 <td> 1 </td>
6184 <td> 2 </td>
6185 <td> 3
6186 </td>
6187 <td> 1 </td>
6188 <td>+2 </td>
6189 <td>-3
6190 </td></tr>
6191 <tr>
6192 <td> +1
6193 </td>
6194 <td> -1
6195 </td></tr></table>
6196
6197 !!end
6198
6199 !! test
6200 Table rowspan
6201 !! wikitext
6202 {| border=1
6203 | Cell 1, row 1
6204 |rowspan=2| Cell 2, row 1 (and 2)
6205 | Cell 3, row 1
6206 |-
6207 | Cell 1, row 2
6208 | Cell 3, row 2
6209 |}
6210 !! html
6211 <table border="1">
6212 <tr>
6213 <td> Cell 1, row 1
6214 </td>
6215 <td rowspan="2"> Cell 2, row 1 (and 2)
6216 </td>
6217 <td> Cell 3, row 1
6218 </td></tr>
6219 <tr>
6220 <td> Cell 1, row 2
6221 </td>
6222 <td> Cell 3, row 2
6223 </td></tr></table>
6224
6225 !! end
6226
6227 !! test
6228 Nested table
6229 !! wikitext
6230 {| border=1
6231 | &alpha;
6232 |
6233 {| bgcolor=#ABCDEF border=2
6234 |nested
6235 |-
6236 |table
6237 |}
6238 |the original table again
6239 |}
6240 !! html
6241 <table border="1">
6242 <tr>
6243 <td> &#945;
6244 </td>
6245 <td>
6246 <table bgcolor="#ABCDEF" border="2">
6247 <tr>
6248 <td>nested
6249 </td></tr>
6250 <tr>
6251 <td>table
6252 </td></tr></table>
6253 </td>
6254 <td>the original table again
6255 </td></tr></table>
6256
6257 !! end
6258
6259 !! test
6260 Invalid attributes in table cell (bug 1830)
6261 !! wikitext
6262 {|
6263 |Cell:|broken
6264 |}
6265 !! html
6266 <table>
6267 <tr>
6268 <td>broken
6269 </td></tr></table>
6270
6271 !! end
6272
6273 !! test
6274 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6275 !! wikitext
6276 {|
6277 | title="foo" |bar
6278 | title="foo<nowiki>|</nowiki>" |bar
6279 | title="foo<nowiki>|</nowiki>" bar
6280 |}
6281 !! html/php
6282 <table>
6283 <tr>
6284 <td title="foo">bar
6285 </td>
6286 <td title="foo&#124;">bar
6287 </td>
6288 <td> title="foo|" bar
6289 </td></tr></table>
6290
6291 !! html/parsoid
6292 <table>
6293 <tbody><tr><td title="foo">bar</td>
6294 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6295 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6296 </tbody></table>
6297 !! end
6298
6299 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6300 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6301 # *2wt modes will fail.
6302 !! test
6303 Table security: embedded pipes
6304 !! options
6305 parsoid=wt2html,html2html
6306 !! wikitext
6307 {|
6308 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6309 !! html/php
6310 <table>
6311 <tr>
6312 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6313 <td>]" onmouseover="alert(document.cookie)"&gt;test
6314 </td>
6315 </tr>
6316 </table>
6317
6318 !! html/parsoid
6319 <table><tbody>
6320 <tr>
6321 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6322 !! end
6323
6324 !! test
6325 Element attributes with double ! should not be broken up by <th>
6326 !! wikitext
6327 {|
6328 ! hi <div class="!!">ha</div> ho
6329 |}
6330 !! html/php
6331 <table>
6332 <tr>
6333 <th> hi <div class="!!">ha</div> ho
6334 </th></tr></table>
6335
6336 !! html/parsoid
6337 <table>
6338 <tbody><tr><th> hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6339 </tbody></table>
6340 !! end
6341
6342 !! test
6343 ! and || in element attributes should not be parsed as <th>/<td>
6344 !! wikitext
6345 {|
6346 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6347 |}
6348 !! html/php
6349 <table>
6350 <tr>
6351 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6352 </td></tr></table>
6353
6354 !! html/parsoid
6355 <table>
6356 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6357 </tbody></table>
6358 !! end
6359
6360 # FIXME: The output seems broken. Filed as T110268.
6361 !! test
6362 ! and || in td attributes should not be parsed as <th>/<td>
6363 !! options
6364 parsoid=wt2html
6365 !! wikitext
6366 {|
6367 | style="color: red !important;" data-contrived="put this here ||" | foo
6368 |}
6369 !! html/php
6370 <table>
6371 <tr>
6372 <td> style="color: red !important;" data-contrived="put this here </td>
6373 <td> foo
6374 </td></tr></table>
6375
6376 !! html/parsoid
6377 <table>
6378 <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>
6379 </tbody></table>
6380 !! end
6381
6382 !! test
6383 Break on | in element attribute in template
6384 !! options
6385 parsoid=wt2html,html2html
6386 !! wikitext
6387 {{echo|1=<div class="hi|ho">ha</div>}}
6388 !! html/php
6389 <p>ho"&gt;ha&lt;/div&gt;
6390 </p>
6391 !! html/parsoid
6392 <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>
6393 !! end
6394
6395 !! test
6396 Indented table markup mixed with indented pre content (proposed in bug 6200)
6397 !! wikitext
6398 <table>
6399 <tr>
6400 <td>
6401 Text that should be rendered preformatted
6402 </td>
6403 </tr>
6404 </table>
6405 !! html
6406 <table>
6407 <tr>
6408 <td>
6409 <pre>Text that should be rendered preformatted
6410 </pre>
6411 </td>
6412 </tr>
6413 </table>
6414
6415 !! end
6416
6417 !! test
6418 1. Template-generated table cell attributes and cell content
6419 !! wikitext
6420 {|
6421 |{{table_attribs}}
6422 | {{table_attribs}}
6423 || {{table_attribs_5}}
6424 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6425 |align=center {{table_attribs}}
6426 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6427 |}
6428 !! html
6429 <table>
6430 <tr>
6431 <td style="color:red;">Foo
6432 </td>
6433 <td style="color:red;">Foo
6434 </td>
6435 <td> style="color:red;"</td>
6436 <td>Bar
6437 </td>
6438 <td style="color:red;">Foo
6439 </td>
6440 <td align="center" style="color:red;">Foo
6441 </td>
6442 <td align="center" style="color:red;">Foo
6443 </td></tr></table>
6444
6445 !! end
6446
6447 !! test
6448 2. Template-generated table cell attributes and cell content
6449 !! wikitext
6450 {|
6451 |{{table_attribs_2}}
6452 |}
6453 !! html/php
6454 <table>
6455 <tr>
6456 <td style="color:red;">Foo
6457 </td>
6458 <td>Bar</td>
6459 <td>Baz
6460 </td></tr></table>
6461
6462 !! html/parsoid
6463 <table>
6464 <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>
6465 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6466 </tbody></table>
6467 !! end
6468
6469 !! test
6470 3. Template-generated table cell attributes and cell content
6471 !! wikitext
6472 {|
6473 !align=center {{table_header_cells}}
6474 |-
6475 |align=center {{table_cells}}
6476 |}
6477 !! html/php
6478 <table>
6479 <tr>
6480 <th align="center" style="color:red;">Foo</th>
6481 <th style="color:red;"><i>Bar</i></th>
6482 <th style="color:brown;"><i>Foo</i> and Baz
6483 </th></tr>
6484 <tr>
6485 <td align="center" style="color:red;">Foo</td>
6486 <td style="color:red;"><i>Bar</i></td>
6487 <td style="color:brown;"><i>Foo</i> and Baz
6488 </td></tr></table>
6489
6490 !! html/parsoid
6491 <table>
6492 <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>
6493 <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>
6494 </tbody></table>
6495 !! end
6496
6497 !! test
6498 4. Template-generated table cell attributes and cell content inside a templated table
6499 !! wikitext
6500 {{tbl-start}}
6501 !align=center {{table_header_cells}}
6502 |-
6503 |align=center {{table_cells}}
6504 {{tbl-end}}
6505 !! html/php
6506 <table>
6507 <tr>
6508 <th align="center" style="color:red;">Foo</th>
6509 <th style="color:red;"><i>Bar</i></th>
6510 <th style="color:brown;"><i>Foo</i> and Baz
6511 </th></tr>
6512 <tr>
6513 <td align="center" style="color:red;">Foo</td>
6514 <td style="color:red;"><i>Bar</i></td>
6515 <td style="color:brown;"><i>Foo</i> and Baz
6516 </td></tr></table>
6517
6518 !! html/parsoid
6519 <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}}]}'>
6520 <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>
6521 <tr>
6522 <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>
6523 </tbody></table>
6524 !! end
6525
6526 ## Edge case fix to prevent future regressions
6527 !! test
6528 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6529 !! wikitext
6530 {|
6531 |{{table_attribs_7}}
6532 |}
6533 <references />
6534 !! html/parsoid
6535 <table>
6536 <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>
6537 </tbody></table>
6538 <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>
6539 !! end
6540
6541 !! test
6542 Table with row followed by newlines and table heading
6543 !! options
6544 parsoid=wt2html,html2html
6545 !! wikitext
6546 {|
6547 |-
6548
6549 ! foo
6550 |}
6551 !! html/*
6552 <table>
6553
6554
6555 <tr>
6556 <th> foo
6557 </th></tr></table>
6558
6559 !! end
6560
6561 !! test
6562 Table with empty line following the start tag
6563 !! options
6564 parsoid=wt2html,html2html
6565 !! wikitext
6566 {|
6567
6568 |-
6569 | foo
6570 |}
6571 !! html/*
6572 <table>
6573
6574
6575 <tr>
6576 <td> foo
6577 </td></tr></table>
6578
6579 !! end
6580
6581 !! test
6582 Table attributes with empty value
6583 !! options
6584 parsoid=wt2html,html2html
6585 !! wikitext
6586 {|
6587 | style=| hello
6588 |}
6589 !! html/php
6590 <table>
6591 <tr>
6592 <td style=""> hello
6593 </td></tr></table>
6594
6595 !! html/parsoid
6596 <table>
6597 <tbody><tr><td style=""> hello</td></tr>
6598 </tbody></table>
6599 !! end
6600
6601 !! test
6602 Wikitext table with a lot of comments
6603 !! wikitext
6604 {|
6605 <!-- c0 -->
6606 | foo
6607 <!-- c1 -->
6608 |-<!-- c2 -->
6609 <!-- c3 -->
6610 |<!-- c4 -->
6611 <!-- c5 -->
6612 |}
6613 !! html
6614 <table>
6615 <tr>
6616 <td> foo
6617 </td></tr>
6618 <tr>
6619 <td>
6620 </td></tr></table>
6621
6622 !! end
6623
6624 !! test
6625 Wikitext table comments represented in parsoid dom
6626 !! wikitext
6627 {|<!--c1--><!--c2-->
6628 |-<!--c3-->
6629 | x
6630 |}
6631 !! html/php+tidy
6632 <table>
6633 <tr>
6634 <td>x</td>
6635 </tr>
6636 </table>
6637 !! html/parsoid
6638 <table><!--c1--><!--c2-->
6639 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6640 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6641 </tbody></table>
6642 !! end
6643
6644 !! test
6645 Wikitext table with double-line table cell
6646 !! wikitext
6647 {|
6648 |a
6649 b
6650 |}
6651 !! html
6652 <table>
6653 <tr>
6654 <td>a
6655 <p>b
6656 </p>
6657 </td></tr></table>
6658
6659 !! end
6660
6661 !! test
6662 Table cell with a single comment
6663 !! wikitext
6664 {|
6665 | <!-- c1 -->
6666 | a
6667 |}
6668 !! html
6669 <table>
6670 <tr>
6671 <td>
6672 </td>
6673 <td> a
6674 </td></tr></table>
6675
6676 !! end
6677
6678 !! test
6679 Table-cell after a comment-only-empty-line
6680 !! wikitext
6681 {|
6682 |a
6683 <!--c1-->
6684 <!--c2-->| b
6685 |}
6686 !! html
6687 <table>
6688 <tr>
6689 <td>a
6690 </td>
6691 <td> b
6692 </td></tr></table>
6693
6694 !! html/parsoid
6695 <table>
6696 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6697 <!--c1-->
6698 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6699 </tbody></table>
6700
6701 !! end
6702
6703 !! test
6704 Build table with {{!}}
6705 !! wikitext
6706 {{{!}} class="wikitable"
6707 ! header
6708 ! second header
6709 {{!}}- style="color:red;"
6710 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6711 {{!}}}
6712 !! html
6713 <table class="wikitable">
6714 <tr>
6715 <th> header
6716 </th>
6717 <th> second header
6718 </th></tr>
6719 <tr style="color:red;">
6720 <td> data </td>
6721 <td style="color:red;"> second data
6722 </td></tr></table>
6723
6724 !! end
6725
6726 !! test
6727 Build table with pipe as data
6728 !! wikitext
6729 {| class="wikitable"
6730 ! header
6731 ! second header
6732 |- style="color:red;"
6733 | data || style="color:red;" | second data
6734 |-
6735 | style="color:red;" | data with | || style="color:red;" | second data with |
6736 |-
6737 || data with | ||| second data with |
6738 |}
6739 !! html
6740 <table class="wikitable">
6741 <tr>
6742 <th> header
6743 </th>
6744 <th> second header
6745 </th></tr>
6746 <tr style="color:red;">
6747 <td> data </td>
6748 <td style="color:red;"> second data
6749 </td></tr>
6750 <tr>
6751 <td style="color:red;"> data with | </td>
6752 <td style="color:red;"> second data with |
6753 </td></tr>
6754 <tr>
6755 <td> data with | </td>
6756 <td> second data with |
6757 </td></tr></table>
6758
6759 !! end
6760
6761 !! test
6762 Build table with wikilink
6763 !! wikitext
6764 {| class="wikitable"
6765 ! header || second header
6766 |- style="color:red;"
6767 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6768 |-
6769 | data || second data [[Main Page|link|text with pipe]]
6770 |}
6771 !! html
6772 <table class="wikitable">
6773 <tr>
6774 <th> header </th>
6775 <th> second header
6776 </th></tr>
6777 <tr style="color:red;">
6778 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6779 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6780 </td></tr>
6781 <tr>
6782 <td> data </td>
6783 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6784 </td></tr></table>
6785
6786 !! end
6787
6788 # The expected HTML structure in this test is debatable. The PHP parser does
6789 # not parse this kind of table at all. The main focus for Parsoid is on
6790 # round-tripping, so this output is ok for now. TODO: revisit!
6791 !! test
6792 Wikitext table with html-syntax row
6793 !! wikitext
6794 {|
6795 |-
6796 <td>foo</td>
6797 |}
6798 !! html/parsoid
6799 <table>
6800 <tbody>
6801 <tr>
6802 <td>foo</td></tr></tbody></table>
6803 !! end
6804
6805 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6806 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6807 ## PHP parser, which tidy then compounds by fostering the content
6808 ## entirely out of the table. Parsoid recognizes the table context
6809 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6810 ## depends on PHP's treatment of broken table markup!
6811 !! test
6812 Implicit <td> after a |-
6813 !! options
6814 parsoid=wt2html,html2html
6815 !! wikitext
6816 {|
6817 |-
6818 a
6819 |}
6820 !! html/php
6821 <table>
6822
6823 a
6824 </table>
6825
6826 !! html/php+tidy
6827 <p>a</p>
6828 !! html/parsoid
6829 <table>
6830 <tr><td>a</td></tr>
6831 </table>
6832 !! end
6833
6834 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6835 !! test
6836 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6837 !! options
6838 parsoid=wt2html,html2html
6839 !! wikitext
6840 {|
6841 |-
6842 |
6843 a
6844 |-
6845 b
6846 |}
6847 !! html/php
6848 <table>
6849
6850 <tr>
6851 <td>
6852 <pre>a
6853 </pre>
6854 </td></tr>
6855 b
6856 </table>
6857
6858 !! html/php+tidy
6859 <p>b</p>
6860 <table>
6861 <tr>
6862 <td>
6863 <pre>
6864 a
6865 </pre></td>
6866 </tr>
6867 </table>
6868 !! html/parsoid
6869 <table>
6870 <tbody>
6871 <tr><td><pre>a</pre></td></tr>
6872 <tr><td> b</td></tr>
6873 </tbody>
6874 </table>
6875 !! end
6876
6877 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6878 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6879 !! test
6880 Lists should be recognized in an implicit <td> context
6881 !! options
6882 parsoid=wt2html,html2html
6883 !! wikitext
6884 {|
6885 |-
6886 *a
6887 |}
6888 !! html/php
6889 <table>
6890
6891 <ul><li>a</li></ul>
6892 </table>
6893
6894 !! html/php+tidy
6895 <ul>
6896 <li>a</li>
6897 </ul>
6898 !! html/parsoid
6899 <table>
6900 <tr>
6901 <td><ul>
6902 <li>a</li>
6903 </ul></td>
6904 </tr>
6905 </table>
6906 !! end
6907
6908 !! test
6909 Table cells not properly parsed in an implicit-td context
6910 !! wikitext
6911 {|
6912 |-
6913 {{table_attribs_4}} || a || b
6914 |}
6915 !! html/php+tidy
6916 <table>
6917 <tr>
6918 <td style="background-color:#DC241f;" width="10px"></td>
6919 <td>a</td>
6920 <td>b</td>
6921 </tr>
6922 </table>
6923 !! html/parsoid
6924 <table>
6925 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6926 <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>
6927 </tbody></table>
6928 !! end
6929
6930 !! test
6931 Parsoid: Round-trip tables directly followed by content (bug 51219)
6932 !! options
6933 parsoid=wt2html,wt2wt
6934 !! wikitext
6935 {|
6936 |foo
6937 |} bar
6938
6939 {|
6940 |baz
6941 |}<b>quux</b>
6942 !! html+tidy
6943 <table>
6944 <tr>
6945 <td>foo</td>
6946 </tr>
6947 </table>
6948 <p>bar</p>
6949 <table>
6950 <tr>
6951 <td>baz</td>
6952 </tr>
6953 </table>
6954 <p><b>quux</b></p>
6955 !! end
6956
6957 !! test
6958 Parsoid: Default to a newline after tables in new content (bug 51219)
6959 !! options
6960 parsoid=html2wt
6961 !! html/parsoid
6962 <table><tbody>
6963 <tr><td>foo</td></tr></tbody></table> bar
6964 <table><tbody>
6965 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6966 !! wikitext
6967 {|
6968 |foo
6969 |}
6970 <nowiki> </nowiki>bar
6971 {|
6972 |baz
6973 |}
6974 '''quux'''
6975 !! end
6976
6977 !! test
6978 Parsoid: newline inducing block nodes don't suppress <nowiki>
6979 !! options
6980 parsoid=html2wt
6981 !! html/parsoid
6982 a<h1>foo</h1>
6983 !! wikitext
6984 <nowiki> </nowiki>a
6985
6986 = foo =
6987 !! end
6988
6989 !! test
6990 Parsoid: Row-syntax table headings followed by comment & table cells
6991 !! options
6992 parsoid=wt2html,wt2wt
6993 !! wikitext
6994 {|
6995 ! foo || bar
6996 <!-- foo --> || baz || quux
6997 |}
6998 !! html/php
6999 <table>
7000 <tr>
7001 <th> foo </th>
7002 <th> bar
7003 </th>
7004 <td> baz </td>
7005 <td> quux
7006 </td></tr></table>
7007
7008 !! html/parsoid
7009 <table>
7010 <tbody><tr><th> foo </th><th> bar
7011 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7012 </tbody></table>
7013 !! end
7014
7015 !!test
7016 Parsoid: Recover better from broken table attributes
7017 !!options
7018 parsoid=wt2html
7019 !!wikitext
7020 {| class="foo
7021 | class="bar" |
7022 foo
7023 |}
7024 !!html/php+tidy
7025 <table class="foo">
7026 <tr>
7027 <td class="bar">
7028 <p>foo</p>
7029 </td>
7030 </tr>
7031 </table>
7032 !!html/parsoid
7033 <table class="foo">
7034 <tr>
7035 <td class="bar">
7036 <p>foo</p></td></tr>
7037 </tbody></table>
7038 !!end
7039
7040 !! test
7041 Tables: Digest broken attributes on table and tr tag
7042 !! options
7043 parsoid=wt2html
7044 !! wikitext
7045 {| || |} ++
7046 |- || || ++ --
7047 |- > [
7048 |}
7049 !! html
7050 <table>
7051 <tbody>
7052 <tr></tr>
7053 <tr></tr>
7054 </tbody></table>
7055 !! end
7056
7057 # T137406: Whitespace in the HTML
7058 !! test
7059 1. Generate correct wikitext for tables with thead/tbody/tfoot
7060 !! options
7061 parsoid=html2wt
7062 !! html/parsoid
7063 <table>
7064 <caption>Test</caption>
7065 <thead>
7066 <tr>
7067 <th>Month</th>
7068 <th>Savings</th>
7069 </tr>
7070 </thead>
7071 <tbody>
7072 <tr>
7073 <td>January</td>
7074 <td>$100</td>
7075 </tr>
7076 <tr>
7077 <td>February</td>
7078 <td>$80</td>
7079 </tr>
7080 </tbody>
7081 <tfoot>
7082 <tr>
7083 <td>Sum</td>
7084 <td>$180</td>
7085 </tr>
7086 </tfoot>
7087 </table>
7088 !! wikitext
7089 {|
7090 |+Test
7091 !Month
7092 !Savings
7093 |-
7094 |January
7095 |$100
7096 |-
7097 |February
7098 |$80
7099 |-
7100 |Sum
7101 |$180
7102 |}
7103 !! html/php+tidy
7104 <table>
7105 <caption>Test</caption>
7106 <tr>
7107 <th>Month</th>
7108 <th>Savings</th>
7109 </tr>
7110 <tr>
7111 <td>January</td>
7112 <td>$100</td>
7113 </tr>
7114 <tr>
7115 <td>February</td>
7116 <td>$80</td>
7117 </tr>
7118 <tr>
7119 <td>Sum</td>
7120 <td>$180</td>
7121 </tr>
7122 </table>
7123 !! end
7124
7125 # T137406: No whitespace in the HTML
7126 !! test
7127 2. Generate correct wikitext for tables with thead/tbody/tfoot
7128 !! options
7129 parsoid=html2wt
7130 !! html/parsoid
7131 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7132 !! wikitext
7133 {|
7134 !heading
7135 |-
7136 |foo
7137 |}
7138 !! end
7139
7140 !! test
7141 Testing serialization after deletion in references
7142 !! options
7143 parsoid={
7144 "modes": ["wt2wt"],
7145 "changes": [
7146 ["#x", "remove"]
7147 ]
7148 }
7149 !! wikitext
7150 hi <ref><div id="x">ho</div></ref>
7151
7152 <references />
7153 !! wikitext/edited
7154 hi <ref></ref>
7155
7156 <references />
7157 !! end
7158
7159 !!test
7160 Testing serialization after deletion of table cells
7161 !!options
7162 parsoid={
7163 "modes": ["wt2wt", "selser"],
7164 "changes": [
7165 ["#x", "remove"]
7166 ]
7167 }
7168 !!wikitext
7169 {|
7170 !h1 !!h2 !!h3
7171 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7172 |}
7173 !! wikitext/edited
7174 {|
7175 !h1 !!h2 !!h3
7176 |c2 |||c3
7177 |}
7178 !!end
7179
7180 !! test
7181 Testing selser after addition of new row before first row (T125419)
7182 !! options
7183 parsoid={
7184 "modes": ["wt2wt", "selser"],
7185 "changes": [
7186 [ "tr", "before", "<tr><td>X</td></tr>" ]
7187 ]
7188 }
7189 !! wikitext
7190 {|
7191 |a
7192 |}
7193 !! wikitext/edited
7194 {|
7195 |X
7196 |-
7197 |a
7198 |}
7199 !! end
7200
7201 !! test
7202 Serialize new table rows in a HTML table using HTML tags
7203 !! options
7204 parsoid={
7205 "modes": ["wt2wt", "selser"],
7206 "changes": [
7207 [ "tr", "before", "<tr><td>X</td></tr>" ]
7208 ]
7209 }
7210 !! wikitext
7211 <table><tr><td>a</td></tr></table>
7212 !! wikitext/edited
7213 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
7214 !! end
7215
7216 !! test
7217 Serialize new table cells in a HTML row using HTML tags
7218 !! options
7219 parsoid={
7220 "modes": ["wt2wt", "selser"],
7221 "changes": [
7222 [ "td", "before", "<td>X</td>" ]
7223 ]
7224 }
7225 !! wikitext
7226 <table><tr><td>a</td></tr></table>
7227 !! wikitext/edited
7228 <table><tr><td>X</td><td>a</td></tr></table>
7229 !! end
7230
7231 !! test
7232 Wikitext tables can be nested inside HTML tables
7233 !! options
7234 parsoid=html2wt
7235 !! html
7236 <table data-parsoid='{"stx":"html"}'>
7237 <tr><td>
7238 <table>
7239 <tr><td>foo</td></tr>
7240 </table>
7241 </td></tr>
7242 </table>
7243 !! wikitext
7244 <table>
7245 <tr><td>
7246 {|
7247 |foo
7248 |}
7249 </td></tr>
7250 </table>
7251 !! end
7252
7253 !! test
7254 Serialize wikitext list items as HTML list items when embedded in a HTML list
7255 !! options
7256 parsoid=html2wt
7257 !! html
7258 <ul data-parsoid='{"stx": "html"}'>
7259 <li data-parsoid='{}'>a</li>
7260 <li>b</li>
7261 </ul>
7262 !! wikitext
7263 <ul>
7264 <li>a</li>
7265 <li>b</li>
7266 </ul>
7267 !! end
7268
7269 # SSS FIXME: Is this actually a good thing given the
7270 # odd nested list output that is generated by MW?
7271 # <ul><li>foo<ul>..</ul></li></ul> instead of
7272 # <ul><li>foo</li><ul>..</ul></ul>
7273 !! test
7274 Wikitext lists can be nested inside HTML lists
7275 !! options
7276 parsoid=html2wt
7277 !! html
7278 <ul data-parsoid='{"stx": "html"}'>
7279 <li data-parsoid='{"stx": "html"}'>a
7280 <ul><li>b</li></ul>
7281 </li>
7282 </ul>
7283
7284 <ul data-parsoid='{"stx": "html"}'>
7285 <li>x
7286 <ul><li>y</li></ul>
7287 </li>
7288 </ul>
7289 !! wikitext
7290 <ul>
7291 <li>a
7292 * b
7293 </li>
7294 </ul>
7295
7296 <ul>
7297 <li>x
7298 * y
7299 </li>
7300 </ul>
7301 !! end
7302
7303 ###
7304 ### Internal links
7305 ###
7306 !! test
7307 Plain link, capitalized
7308 !! wikitext
7309 [[Main Page]]
7310 !! html
7311 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7312 </p>
7313 !! end
7314
7315 !! test
7316 Plain link, uncapitalized
7317 !! wikitext
7318 [[main Page]]
7319 !! html
7320 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7321 </p>
7322 !! end
7323
7324 !! test
7325 Piped link
7326 !! wikitext
7327 [[Main Page|The Main Page]]
7328 !! html
7329 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7330 </p>
7331 !! end
7332
7333 !! test
7334 Piped link with comment in link text
7335 !! wikitext
7336 [[Main Page|The Main<!--front--> Page]]
7337 !! html
7338 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7339 </p>
7340 !! end
7341
7342 !! test
7343 Piped link with multiple pipe characters in link text
7344 !! wikitext
7345 [[Main Page||The|Main|Page|]]
7346 !! html/php
7347 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7348 </p>
7349 !! html/parsoid
7350 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7351 !! end
7352
7353 !! test
7354 Piped link with no link text
7355 !! wikitext
7356 [[Thomas Bek (bishop of St David's)|]]
7357 !! html/php
7358 <p>[[Thomas Bek (bishop of St David's)|]]
7359 </p>
7360 !! html/parsoid
7361 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7362 !! end
7363
7364 !! test
7365 Broken link
7366 !! wikitext
7367 [[Zigzagzogzagzig]]
7368 !! html
7369 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7370 </p>
7371 !! end
7372
7373 !! test
7374 Broken link with fragment
7375 !! wikitext
7376 [[Zigzagzogzagzig#zug]]
7377 !! html
7378 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7379 </p>
7380 !! end
7381
7382 !! test
7383 Special page link with fragment
7384 !! wikitext
7385 [[Special:Version#anchor]]
7386 !! html
7387 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7388 </p>
7389 !! end
7390
7391 !! test
7392 Nonexistent special page link with fragment
7393 !! wikitext
7394 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7395 !! html
7396 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7397 </p>
7398 !! end
7399
7400 !! test
7401 Link with prefix
7402 !! wikitext
7403 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7404 !! html
7405 <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>
7406 </p>
7407 !! end
7408
7409 !! test
7410 Link with suffix
7411 !! wikitext
7412 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7413 !! html
7414 <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>!!!
7415 </p>
7416 !! end
7417
7418 !! article
7419 prefixed article
7420 !! text
7421 Some text
7422 !! endarticle
7423
7424 !! test
7425 Bug 43661: Piped links with identical prefixes
7426 !! wikitext
7427 [[prefixed article|prefixed articles with spaces]]
7428
7429 [[prefixed article|prefixed articlesaoeu]]
7430
7431 [[Main Page|Main Page test]]
7432 !! html
7433 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7434 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7435 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7436 </p>
7437 !! end
7438
7439
7440 !! test
7441 Link with HTML entity in suffix / tail
7442 !! wikitext
7443 [[Main Page]]&quot;, [[Main Page]]&#97;
7444 !! html/php
7445 <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;
7446 </p>
7447 !! html/parsoid
7448 <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>
7449 !! end
7450
7451 !! test
7452 Link with 3 brackets
7453 !! wikitext
7454 [[[Main Page]]]
7455 Foo [[[Main Page]]]
7456 !! html
7457 <p>[[[Main Page]]]
7458 Foo [[[Main Page]]]
7459 </p>
7460 !! end
7461
7462 !! test
7463 Link with 4 brackets
7464 !! wikitext
7465 [[[[Main Page]]]]
7466 !! html
7467 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7468 </p>
7469 !! end
7470
7471 !! test
7472 Piped link with 3 brackets
7473 !! wikitext
7474 [[[main page|the main page]]]
7475 !! html
7476 <p>[[[main page|the main page]]]
7477 </p>
7478 !! end
7479
7480 !! test
7481 Piped link with extlink-like text
7482 !! wikitext
7483 [[Main Page|[bar]]]
7484 [[Main Page|This is a [bar]]]
7485 !! html/php
7486 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7487 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7488 </p>
7489 !! html/parsoid
7490 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7491 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7492 !! end
7493
7494 !! test
7495 Link with multiple pipes
7496 !! wikitext
7497 [[Main Page|The|Main|Page]]
7498 !! html
7499 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7500 </p>
7501 !! end
7502
7503 # Note that parsoid does not munge anchor text; all non-space
7504 # characters are valid in HTML5 ids.
7505 !! test
7506 Anchor containing a #. (bug 63430)
7507 !! wikitext
7508 [[Main Page#And#Link]]
7509 !! html/php
7510 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7511 </p>
7512 !! html/parsoid
7513 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
7514 !! end
7515
7516 !! test
7517 Link to namespaces
7518 !! wikitext
7519 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7520 !! html
7521 <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>
7522 </p>
7523 !! end
7524
7525 !! test
7526 Link with space in namespace
7527 !! wikitext
7528 [[User talk:Foo bar]]
7529 !! html
7530 <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>
7531 </p>
7532 !! end
7533
7534 !! article
7535 MemoryAlpha:AlphaTest
7536 !! text
7537 This is an article in the MemoryAlpha namespace
7538 (which shadows the memoryalpha interwiki link).
7539 !! endarticle
7540
7541 !! test
7542 Namespace takes precedence over interwiki link (bug 51680)
7543 !! wikitext
7544 [[MemoryAlpha:AlphaTest]]
7545 !! html
7546 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7547 </p>
7548 !! end
7549
7550 # The previous test doesn't work correctly in html2*, due to not recognizing the
7551 # link as an internal one. This one checks for the correct behavior.
7552 !! test
7553 Link to namespace preferred over interwiki with correct rel attribute
7554 !! options
7555 parsoid=html2wt,html2html
7556 !! html/parsoid
7557 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7558 !! wikitext
7559 [[MemoryAlpha:AlphaTest]]
7560 !! end
7561
7562 !! test
7563 Piped link to namespace
7564 !! wikitext
7565 [[Meta:Disclaimers|The disclaimers]]
7566 !! html
7567 <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>
7568 </p>
7569 !! end
7570
7571 !! test
7572 Link containing }
7573 !! wikitext
7574 [[Usually caused by a typo (oops}]]
7575 !! html
7576 <p>[[Usually caused by a typo (oops}]]
7577 </p>
7578 !! end
7579
7580 !! article
7581 7% Solution
7582 !! text
7583 Just a test of an article title containing a percent.
7584 !! endarticle
7585
7586 !! test
7587 Link containing % (not as a hex sequence)
7588 !! wikitext
7589 [[7% Solution]]
7590 [[7% Solution|7%25 Solution]]
7591 !! html/php
7592 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7593 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7594 </p>
7595 !! html/parsoid
7596 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7597 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7598 !! end
7599
7600 # note that the parsoid HTML is identical to the previous test output,
7601 # so the previous test ensures that the html2wt mode will generate the
7602 # "not as a hex sequence" wikitext.
7603 !! test
7604 Link containing % as a single hex sequence interpreted to char
7605 !! options
7606 parsoid=wt2wt,wt2html,html2html
7607 !! wikitext
7608 [[7%25 Solution]]
7609 [[7%25 Solution|7%25 Solution]]
7610 !! html/php
7611 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7612 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7613 </p>
7614 !! html/parsoid
7615 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7616 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7617 !!end
7618
7619 !! test
7620 Link containing % as a double hex sequence interpreted to hex sequence
7621 !! wikitext
7622 [[7%2525 Solution]]
7623 !! html
7624 <p>[[7%2525 Solution]]
7625 </p>
7626 !!end
7627
7628 # note that parsoid does not munge anchor text; all non-space
7629 # characters are valid in HTML5 anchors.
7630 !! test
7631 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7632 Example for such a section: == < ==
7633 !! wikitext
7634 [[%23%3c]][[%23%3e]]
7635 !! html/php
7636 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7637 </p>
7638 !! html/parsoid
7639 <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>
7640 !! end
7641
7642 !! test
7643 Link containing "<#" and ">#" as a hex sequences
7644 !! wikitext
7645 [[%3c%23]][[%3e%23]]
7646 !! html
7647 <p>[[%3c%23]][[%3e%23]]
7648 </p>
7649 !! end
7650
7651 !! test
7652 Link containing an equals sign
7653 !! wikitext
7654 [[Special:BookSources/isbn=4-00-026157-6]]
7655 !! html/php
7656 <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>
7657 </p>
7658 !! html/parsoid
7659 <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>
7660 !! end
7661
7662 !! article
7663 Foo~bar
7664 !! text
7665 Just a test of an article title containing a tilde.
7666 !! endarticle
7667
7668 # note that links containing signatures, like [[Foo~~~~]], are
7669 # massaged by the pre-save transform (PST) and so the tildes are never
7670 # seen by the parser.
7671 !! test
7672 Link containing a tilde
7673 !! wikitext
7674 [[Foo~bar]]
7675 !! html/php
7676 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7677 </p>
7678 !! html/parsoid
7679 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7680 !! end
7681
7682 !! test
7683 Link containing double-single-quotes '' (bug 4598)
7684 !! wikitext
7685 [[Lista d''e paise d''o munno]]
7686 !! html/php
7687 <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>
7688 </p>
7689 !! html/parsoid
7690 <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>
7691 !! end
7692
7693 !! test
7694 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7695 !! wikitext
7696 Some [[Link|pretty ''italics'' and stuff]]!
7697 !! html/php
7698 <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>!
7699 </p>
7700 !! html/parsoid
7701 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7702 !! end
7703
7704 !! test
7705 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7706 !! wikitext
7707 ''Some [[Link|pretty ''italics'' and stuff]]!''
7708 !! html
7709 <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>
7710 </p>
7711 !! end
7712
7713 !! test
7714 Link with double quotes in title part (literal) and alternate part (interpreted)
7715 !! wikitext
7716 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7717
7718 [[''Pentecoste'']]
7719
7720 [[''Pentecoste''|Pentecoste]]
7721
7722 [[''Pentecoste''|''Pentecoste'']]
7723 !! html/php
7724 <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>
7725 </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>
7726 </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>
7727 </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>
7728 </p>
7729 !! html/parsoid
7730 <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>
7731 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7732 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7733 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7734 !! end
7735
7736 !! test
7737 Broken image links with HTML captions (bug 39700)
7738 !! wikitext
7739 [[File:Nonexistent|<script></script>]]
7740 [[File:Nonexistent|100x100px|<script></script>]]
7741 [[File:Nonexistent|&lt;]]
7742 [[File:Nonexistent|a<i>b</i>c]]
7743 !! html/php
7744 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7745 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7746 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7747 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7748 </p>
7749 !! html/parsoid
7750 <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>
7751 <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>
7752 <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>
7753 <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>
7754 !! end
7755
7756 !! test
7757 Plain link to URL
7758 !! wikitext
7759 [[http://www.example.com]]
7760 !! html/php
7761 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7762 </p>
7763 !! html/parsoid
7764 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7765 !! end
7766
7767 !! test
7768 Plain link to URL with link text
7769 !! wikitext
7770 [[http://www.example.com Link text]]
7771 !! html
7772 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7773 </p>
7774 !! end
7775
7776 !! test
7777 Plain link to protocol-relative URL
7778 !! wikitext
7779 [[//www.example.com]]
7780 !! html/php
7781 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7782 </p>
7783 !! html/parsoid
7784 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7785 !! end
7786
7787 !! test
7788 Plain link to protocol-relative URL with link text
7789 !! wikitext
7790 [[//www.example.com Link text]]
7791 !! html
7792 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7793 </p>
7794 !! end
7795
7796 !! test
7797 Plain link to page with question mark in title
7798 !! wikitext
7799 [[A?b]]
7800
7801 [[A?b|Baz]]
7802 !! html
7803 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7804 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7805 </p>
7806 !! end
7807
7808
7809 # I'm fairly sure the expected result here is wrong.
7810 # We want these to be URL links, not pseudo-pages with URLs for titles....
7811 # However the current output is also pretty screwy.
7812 #
7813 # ----
7814 # I'm changing it to match the current output--it arguably makes more
7815 # sense in the light of the test above. Old expected result was:
7816 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7817 #</p>
7818 # But I think this test is bordering on "garbage in, garbage out" anyway.
7819 # -- wtm
7820 !! test
7821 Piped link to URL
7822 !! wikitext
7823 Piped link to URL: [[http://www.example.com|an example URL]]
7824 !! html/php
7825 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7826 </p>
7827 !! html/parsoid
7828 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7829 !! end
7830
7831 !! test
7832 BUG 2: [[page|http://url/]] should link to page, not http://url/
7833 !! wikitext
7834 [[Main Page|http://url/]]
7835 !! html/php
7836 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7837 </p>
7838 !! html/parsoid
7839 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7840 !! end
7841
7842 # Parsoid does not mark self-links, by design.
7843 !! test
7844 BUG 337: Escaped self-links should be bold
7845 !! options
7846 title=[[Bug462]]
7847 !! wikitext
7848 [[Bu&#103;462]] [[Bug462]]
7849 !! html/php
7850 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7851 </p>
7852 !! html/php+tidy
7853 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7854 !! html/parsoid
7855 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7856 !! end
7857
7858 !! test
7859 Self-link to section should not be bold
7860 !! options
7861 title=[[Main Page]]
7862 !! wikitext
7863 [[Main Page#section]]
7864 !! html
7865 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7866 </p>
7867 !! end
7868
7869 !! article
7870 00
7871 !! text
7872 This is 00.
7873 !! endarticle
7874
7875 !!test
7876 Self-link to numeric title
7877 !!options
7878 title=[[0]]
7879 !! wikitext
7880 [[0]]
7881 !! html
7882 <p><strong class="selflink">0</strong>
7883 </p>
7884 !!end
7885
7886 !!test
7887 Link to numeric-equivalent title
7888 !!options
7889 title=[[0]]
7890 !! wikitext
7891 [[00]]
7892 !! html
7893 <p><a href="/wiki/00" title="00">00</a>
7894 </p>
7895 !!end
7896
7897 !! test
7898 <nowiki> inside a link
7899 !! wikitext
7900 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7901 !! html
7902 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7903 </p>
7904 !! end
7905
7906 !! test
7907 Non-breaking spaces in title
7908 !! wikitext
7909 [[&nbsp; Main &nbsp; Page &nbsp;]]
7910 !! html
7911 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7912 </p>
7913 !!end
7914
7915 !! test
7916 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7917 !! options
7918 language=ca
7919 !! wikitext
7920 '''[[Main Page]]'''
7921 !! html
7922 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7923 </p>
7924 !! end
7925
7926 !! test
7927 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7928 !! options
7929 language=ca
7930 !! wikitext
7931 ''[[Main Page]]''
7932 !! html
7933 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7934 </p>
7935 !! end
7936
7937 !! test
7938 Internal link with en linktrail: no apostrophes (bug 27473)
7939 !! options
7940 language=en
7941 !! wikitext
7942 [[Something]]'nice
7943 !! html
7944 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
7945 </p>
7946 !! end
7947
7948 !! test
7949 Internal link with ca linktrail with apostrophes (bug 27473)
7950 !! options
7951 language=ca
7952 !! wikitext
7953 [[Something]]'nice
7954 !! html
7955 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
7956 </p>
7957 !! end
7958
7959 !! test
7960 Internal link with kaa linktrail with apostrophes (bug 27473)
7961 !! options
7962 language=kaa
7963 !! wikitext
7964 [[Something]]'nice
7965 !! html
7966 <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>
7967 </p>
7968 !! end
7969
7970 !! test
7971 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
7972 !! wikitext
7973 [[User:Foo/Test/63636:Bar|Test]]
7974 !! html/php
7975 <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>
7976 </p>
7977 !! html/parsoid
7978 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
7979 !! end
7980
7981 ## Mainly a sanity check for Parsoid
7982 !! test
7983 Handle title parsing for subpages
7984 !! options
7985 title=[[/123123]]
7986 !! wikitext
7987 123
7988 !! html/parsoid
7989 <p>123</p>
7990 !! end
7991
7992 ## FIXME: Add a working php section here
7993 !! test
7994 Link to a subpage from a namespace other than main
7995 !! options
7996 title=[[User:test]]
7997 !! wikitext
7998 [[/123]]
7999 !! html/parsoid
8000 <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>
8001 !! end
8002
8003 !! test
8004 Purely hash wikilink
8005 !! options
8006 title=[[User:test/123]]
8007 !! wikitext
8008 [[#a|b]]
8009 !! html/php
8010 <p><a href="#a">b</a>
8011 </p>
8012 !! html/parsoid
8013 <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>
8014 !! end
8015
8016 !! test
8017 1. Interaction of linktrail and template encapsulation
8018 !! options
8019 parsoid
8020 !! wikitext
8021 {{echo|[[Foo]]}}l
8022 !! html
8023 <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>
8024 !! end
8025
8026 !! test
8027 2. Interaction of linktrail and template encapsulation
8028 !! options
8029 parsoid
8030 !! wikitext
8031 {{echo|Some [[Fool]]}}s
8032 !! html
8033 <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>
8034 !! end
8035
8036 !! test
8037 3. Interaction of linktrail and template encapsulation
8038 !! options
8039 parsoid
8040 !! wikitext
8041 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8042 !! html
8043 <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>
8044 !! end
8045
8046 !! article
8047 Söfnuður
8048 !! text
8049 Test.
8050 !! endarticle
8051
8052 !! test
8053 Internal link with is link prefix
8054 !! options
8055 language=is
8056 !! wikitext
8057 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8058 !! html
8059 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8060 </p>
8061 !! end
8062
8063 !! article
8064 Mótmælendatrú
8065 !! text
8066 Test.
8067 !! endarticle
8068
8069 !! test
8070 Internal link with is link trail and link prefix
8071 !! options
8072 language=is
8073 !! wikitext
8074 [[mótmælendatrú|xxx]]ar
8075 [[mótmælendatrú]]ar
8076 mótmælenda[[söfnuður]]
8077 mótmælenda[[söfnuður|söfnuðir]]
8078 mótmælenda[[söfnuður|söfnuðir]]xxx
8079 !! html
8080 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8081 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8082 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8083 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8084 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8085 </p>
8086 !! end
8087
8088 !! test
8089 Parsoid link trail escaping
8090 !! options
8091 parsoid=html2wt,html2html
8092 !! html/parsoid
8093 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
8094 !! wikitext
8095 [[apple]]<nowiki/>s
8096 !! end
8097
8098 !! test
8099 Parsoid link prefix escaping
8100 !! options
8101 language=is
8102 parsoid=html2wt,html2html
8103 !! html/parsoid
8104 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
8105 !! wikitext
8106 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8107 !! end
8108
8109 !! test
8110 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8111 !! wikitext
8112 [[Foo| bar]]
8113
8114 [[Foo| ''bar'']]
8115
8116 [http://wp.org foo]
8117
8118 [http://wp.org ''foo'']
8119 !! html
8120 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8121 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8122 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8123 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8124 </p>
8125 !! end
8126
8127 !! test
8128 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8129 !! options
8130 parsoid
8131 !! wikitext
8132 [[Foo|{{echo|a}} b {{echo|c}}]]
8133 !! html
8134 <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>
8135 !! end
8136
8137 !! test
8138 Link with angle bracket after anchor
8139 !! wikitext
8140 [[Foo#<bar>]]
8141 !! html/php
8142 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8143 </p>
8144 !! html/parsoid
8145 <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>
8146 !! end
8147
8148 ###
8149 ### Interwiki links (see maintenance/interwiki.sql)
8150 ###
8151
8152 !! test
8153 Inline interwiki link
8154 !! options
8155 parsoid=wt2html,wt2wt,html2html
8156 !! wikitext
8157 [[MeatBall:SoftSecurity]]
8158 !! html/php
8159 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8160 </p>
8161 !! html/parsoid
8162 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8163 !! end
8164
8165 !! test
8166 Inline interwiki link with empty title (bug 2372)
8167 !! options
8168 parsoid=wt2html,wt2wt,html2html
8169 !! wikitext
8170 [[MeatBall:]]
8171 !! html/php
8172 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8173 </p>
8174 !! html/parsoid
8175 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8176 !! end
8177
8178 !! test
8179 Interwiki link encoding conversion (bug 1636)
8180 !! wikitext
8181 *[[Wikipedia:ro:Olteni&#0355;a]]
8182 *[[Wikipedia:ro:Olteni&#355;a]]
8183 !! html
8184 <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>
8185 <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>
8186
8187 !! html+tidy
8188 <ul>
8189 <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>
8190 <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>
8191 </ul>
8192 !! end
8193
8194 !! test
8195 Interwiki link with fragment (bug 2130)
8196 !! wikitext
8197 [[MeatBall:SoftSecurity#foo]]
8198 !! html
8199 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8200 </p>
8201 !! end
8202
8203 # Ideally the wikipedia: prefix here should be proto-relative too
8204 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8205 # define the 'en' prefix, and originally the test used 'wikipedia',
8206 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8207 # article.
8208 !! test
8209 Different interwiki prefixes mapping to the same URL
8210 !! wikitext
8211 [[:en:Foo]]
8212
8213 [[:en:Foo|Foo]]
8214
8215 [[wikipedia:Foo]]
8216
8217 [[:wikipedia:Foo|Foo]]
8218
8219 [[wikipedia:en:Foo]]
8220
8221 [[:wikipedia:en:Foo]]
8222
8223 [[ wikiPEdia :Foo]]
8224 !! html/parsoid
8225 <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>
8226
8227 <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>
8228
8229 <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>
8230
8231 <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>
8232
8233 <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>
8234
8235 <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>
8236
8237 <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>
8238 !! end
8239
8240 !! test
8241 Interwiki links that cannot be represented in wiki syntax
8242 !! wikitext
8243 [[meatball:ok]]
8244 [[meatball:ok#foo|ok with fragment]]
8245 [[meatball:ok_as_well?|ok ending with ? mark]]
8246 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8247 [http://de.wikipedia.org/wiki/#foo is just fragment]
8248
8249 !! html/php
8250 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8251 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8252 <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>
8253 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8254 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8255 </p>
8256 !! html/parsoid
8257 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8258 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8259 <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>
8260 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8261 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8262 !! end
8263
8264 !! test
8265 Interwiki links: trail
8266 !! wikitext
8267 [[wikipedia:Foo|Ba]]r
8268 !! html/php
8269 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8270 </p>
8271 !! html/parsoid
8272 <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>
8273 !! end
8274
8275 !! test
8276 Local interwiki link
8277 !! options
8278 parsoid=wt2html,wt2wt,html2html
8279 !! wikitext
8280 [[local:Template:Foo]]
8281 !! html/php
8282 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8283 </p>
8284 !! html/parsoid
8285 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8286 !! end
8287
8288 # Parsoid does not mark self-links, by design.
8289 !! test
8290 Local interwiki link: self-link to current page
8291 !! options
8292 title=[[Main Page]]
8293 parsoid=wt2html,wt2wt,html2html
8294 !! wikitext
8295 [[local:Main Page]]
8296 !! html/php
8297 <p><strong class="selflink">local:Main Page</strong>
8298 </p>
8299 !! html/parsoid
8300 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8301 !! end
8302
8303 !! test
8304 Local interwiki link: prefix only (bug 64167)
8305 !! options
8306 parsoid=wt2html,wt2wt,html2html
8307 !! wikitext
8308 [[local:]]
8309 !! html/php
8310 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8311 </p>
8312 !! html/parsoid
8313 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8314 !! end
8315
8316 !! test
8317 Local interwiki link: with additional interwiki prefix (bug 61357)
8318 !! options
8319 parsoid=wt2html,wt2wt,html2html
8320 !! wikitext
8321 [[local:meatball:Hello]]
8322 !! html/php
8323 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8324 </p>
8325 !! html/parsoid
8326 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8327 !! end
8328
8329 !! test
8330 Multiple local interwiki link prefixes
8331 !! wikitext
8332 [[local:local:local:local:mi:local:Foo]]
8333 !! options
8334 parsoid=wt2html,wt2wt,html2html
8335 !! html/php
8336 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8337 </p>
8338 !! html/parsoid
8339 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8340 !! end
8341
8342 ###
8343 ### Interlanguage links
8344 ### Language links (so that searching for '### language' matches..)
8345 ###
8346
8347 !! test
8348 Interlanguage link
8349 !! wikitext
8350 Blah blah blah
8351 [[zh:Chinese]]
8352 !! html/php
8353 <p>Blah blah blah
8354 </p>
8355 !! html/parsoid
8356 <p>Blah blah blah</p>
8357 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8358 !! end
8359
8360 ## parsoid html2wt will lose the space variations
8361 !! test
8362 Interlanguage link with spacing
8363 !! options
8364 parsoid=wt2html,wt2wt,html2html
8365 !! wikitext
8366 Blah blah blah
8367 [[ zh : Chinese ]]
8368 !! html/php
8369 <p>Blah blah blah
8370 </p>
8371 !! html/parsoid
8372 <p>Blah blah blah</p>
8373 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8374 !! end
8375
8376 !! test
8377 Double interlanguage link
8378 !! wikitext
8379 Blah blah blah
8380 [[es:Spanish]]
8381 [[zh:Chinese]]
8382 !! html/php
8383 <p>Blah blah blah
8384 </p>
8385 !! html/parsoid
8386 <p>Blah blah blah</p>
8387 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8388 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8389 !! end
8390
8391 ## parsoid html2wt will lose the space variations
8392 !! test
8393 Interlanguage link variations
8394 !! options
8395 parsoid=wt2html,wt2wt,html2html
8396 !! wikitext
8397 Blah blah blah
8398 [[ es :Spanish]]
8399 [[ ZH :Chinese]]
8400 [[es:Foo_bar]]
8401 !! html/php
8402 <p>Blah blah blah
8403 </p>
8404 !! html/parsoid
8405 <p>Blah blah blah</p>
8406 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8407 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8408 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8409 !! end
8410
8411 ## parsoid html2wt will normalize the space to _
8412 !! test
8413 Space and question mark encoding in interlanguage links (T95473)
8414 !! options
8415 parsoid=wt2html,wt2wt,html2html
8416 !! wikitext
8417 Blah blah blah
8418 [[es:Foo bar?]]
8419 !! html/php
8420 <p>Blah blah blah
8421 </p>
8422 !! html/parsoid
8423 <p>Blah blah blah</p>
8424 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8425 !! end
8426
8427 !! test
8428 Interlanguage link, with prefix links
8429 !! options
8430 language=ln
8431 !! wikitext
8432 Blah blah blah
8433 [[zh:Chinese]]
8434 !! html/php
8435 <p>Blah blah blah
8436 </p>
8437 !! html/parsoid
8438 <p>Blah blah blah</p>
8439 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8440 !! end
8441
8442 !! test
8443 Double interlanguage link, with prefix links (bug 8897)
8444 !! options
8445 language=ln
8446 !! wikitext
8447 Blah blah blah
8448 [[es:Spanish]]
8449 [[zh:Chinese]]
8450 !! html/php
8451 <p>Blah blah blah
8452 </p>
8453 !! html/parsoid
8454 <p>Blah blah blah</p>
8455 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8456 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8457 !! end
8458
8459 !! test
8460 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8461 !! wikitext
8462 Blah blah blah
8463 [[mul:Article]]
8464 !! html/php
8465 <p>Blah blah blah
8466 </p>
8467 !! html/parsoid
8468 <p>Blah blah blah</p>
8469 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8470 !! end
8471
8472 ## PHP parser tests script needs an update
8473 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8474 !! test
8475 Language links render as inline links if $wgInterwikiMagic=false
8476 !! options
8477 wgInterwikiMagic=false
8478 parsoid=wt2html,wt2wt,html2html
8479 !! wikitext
8480 Blah blah blah
8481 [[zh:Chinese]]
8482 !! html/parsoid
8483 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8484 !! end
8485
8486 ## PHP parser tests script needs an update
8487 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8488 !! test
8489 Language links render as inline links in the Talk namespace
8490 !! options
8491 title=Talk:Foo
8492 parsoid=wt2html,wt2wt,html2html
8493 !! wikitext
8494 Blah blah blah
8495 [[zh:Chinese]]
8496 !! html/parsoid
8497 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8498 !! end
8499
8500 !! test
8501 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8502 !! options
8503 language=ln
8504 !! wikitext
8505 [[WW&nbsp;II]]
8506 !! html
8507 <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>
8508 </p>
8509 !! end
8510
8511 !! test
8512 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8513 !! options
8514 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
8515 !! html/parsoid
8516 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8517 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8518 !! wikitext
8519 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8520
8521 He&amp;nbsp;llo He&amp;nbsp;llo
8522 !! html/php
8523 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
8524 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
8525 </p>
8526 !! end
8527
8528 # html2wt will fail because of title normalization without data-parsoid
8529 !! test
8530 Parsoid: handle constructor well
8531 !! options
8532 parsoid=wt2html,wt2wt
8533 !! wikitext
8534 [[constructor]]
8535
8536 [[constructor:foo]]
8537 !! html/php
8538 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8539 </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>
8540 </p>
8541 !! html/parsoid
8542 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
8543
8544 <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>
8545 !! end
8546
8547 !! article
8548 ko:
8549 !! text
8550 Test.
8551 !! endarticle
8552
8553 # Note that `ko` isn't a known interlanguage prefix
8554 !! test
8555 Parsoid: recognize interlanguage links without a target page
8556 !! options
8557 ill
8558 !! wikitext
8559 [[es:]]
8560
8561 [[ko:]]
8562 !! html/php
8563 es:
8564 !! html/parsoid
8565 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8566
8567 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8568 !! end
8569
8570 # Note that `ko` isn't a known interwiki prefix
8571 !! test
8572 Parsoid: recognize interwiki links without a target page
8573 !! options
8574 parsoid=wt2html,wt2wt,html2html
8575 !! wikitext
8576 [[:es:]]
8577
8578 [[:ko:]]
8579 !! html/php
8580 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8581 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8582 </p>
8583 !! html/parsoid
8584 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8585 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8586 !! end
8587
8588 !! test
8589 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8590 !! wikitext
8591 [[mi:Foo]]
8592 !! html/php
8593 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8594 </p>
8595 !! html/parsoid
8596 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8597 !! end
8598
8599 !! test
8600 Interlanguage link with preceding local interwiki link (bug 68085)
8601 !! options
8602 parsoid=wt2html,wt2wt,html2html
8603 !! wikitext
8604 Blah blah blah
8605 [[local:es:Spanish]]
8606 !! html/php
8607 <p>Blah blah blah
8608 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8609 </p>
8610 !! html/parsoid
8611 <p>Blah blah blah
8612 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8613 !! end
8614
8615 !! test
8616 Looks like an interlanguage link, but is actually a local interwiki
8617 !! options
8618 parsoid=wt2html,wt2wt,html2html
8619 !! wikitext
8620 Blah blah blah
8621 [[mi:Template:Foo]]
8622 !! html/php
8623 <p>Blah blah blah
8624 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8625 </p>
8626 !! html/parsoid
8627 <p>Blah blah blah
8628 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8629 !! end
8630
8631 ###
8632 ### Redirects, Parsoid-only
8633 ###
8634
8635 !! test
8636 1. Simple redirect to page
8637 !! wikitext
8638 #REDIRECT [[Main Page]]
8639 !! html/parsoid
8640 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8641 !! end
8642
8643 !! test
8644 2. Other redirect variants
8645 !! wikitext
8646 #REDIRECT [[Main_Page]]
8647 !! html/parsoid
8648 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8649 !! end
8650
8651 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8652 # This tests the Parsoid bail-out code.
8653 !! test
8654 3. Other redirect variants
8655 !! wikitext
8656 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8657 !! html/parsoid
8658 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8659 !! end
8660
8661 !! test
8662 4. Redirect to a templated destination
8663 !! wikitext
8664 #REDIRECT [[{{echo|Foo}}bar]]
8665 !! html/parsoid
8666 <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"}]]}'/>
8667 !! end
8668
8669 !! test
8670 Empty redirect
8671 !! options
8672 parsoid=wt2html,wt2wt
8673 !! wikitext
8674 #REDIRECT [[]]
8675 !! html/parsoid
8676 <ol>
8677 <li>REDIRECT [[]]</li></ol>
8678 !! end
8679
8680 !! test
8681 Optional colon in #REDIRECT
8682 !! options
8683 # the colon is archaic syntax. we support it for wt2html, but we
8684 # don't care that it roundtrips back to the modern syntax.
8685 parsoid=wt2html,html2html
8686 !! wikitext
8687 #REDIRECT:[[Main Page]]
8688 !! html/parsoid
8689 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8690 !! end
8691
8692 !! test
8693 Whitespace in #REDIRECT with optional colon
8694 !! options
8695 # the colon and gratuitous whitespace is archaic syntax. we support
8696 # it for wt2html, but we don't care that it roundtrips back to the
8697 # modern syntax (without extra whitespace)
8698 parsoid=wt2html,html2html
8699 !! wikitext
8700
8701 #REDIRECT
8702 :
8703 [[Main Page]]
8704 !! html/parsoid
8705 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8706 !! end
8707
8708 !! test
8709 Piped link in #REDIRECT
8710 !! options
8711 # content after piped link is ignored. we support this syntax,
8712 # but don't care that the piped link is lost when we roundtrip this.
8713 parsoid=wt2html
8714 !! wikitext
8715 #REDIRECT [[Main Page|bar]]
8716 !! html/parsoid
8717 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8718 !! end
8719
8720 !! test
8721 Redirect to category (T104502)
8722 !! options
8723 parsoid=wt2html,wt2wt
8724 !! wikitext
8725 #REDIRECT [[Category:Foo]]
8726 !! html/parsoid
8727 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8728 !! end
8729
8730 !! test
8731 Redirect to category with URL encoding (T104502)
8732 !! options
8733 parsoid=wt2html
8734 !! wikitext
8735 #REDIRECT [[Category%3AFoo]]
8736 !! html/parsoid
8737 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8738 !! end
8739
8740 !! test
8741 Redirect to category page
8742 !! wikitext
8743 #REDIRECT [[:Category:Foo]]
8744 !! html/parsoid
8745 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8746 !! end
8747
8748 !! test
8749 Redirect to image page (1)
8750 !! wikitext
8751 #REDIRECT [[File:Wiki.png]]
8752 !! html/parsoid
8753 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8754 !! end
8755
8756 !! test
8757 Redirect to image page (2)
8758 !! wikitext
8759 #REDIRECT [[Image:Wiki.png]]
8760 !! html/parsoid
8761 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8762 !! end
8763
8764 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8765 # Next test confirms this.
8766 !! test
8767 Redirect to language (1) (T104918)
8768 !! options
8769 parsoid=wt2html,wt2wt,html2html
8770 !! wikitext
8771 #REDIRECT [[en:File:Wiki.png]]
8772 !! html/parsoid
8773 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8774 !! end
8775
8776 !! test
8777 Redirect to language (2) (T104918)
8778 !! wikitext
8779 #REDIRECT [[:en:File:Wiki.png]]
8780 !! html/parsoid
8781 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8782 !! end
8783
8784 !! test
8785 Redirect to interwiki (T104918)
8786 !! wikitext
8787 #REDIRECT [[meatball:File:Wiki.png]]
8788 !! html/parsoid
8789 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8790 !! end
8791
8792 !! test
8793 Non-English #REDIRECT
8794 !! options
8795 language=is
8796 !! wikitext
8797 #TILVÍSUN [[Main Page]]
8798 !! html/parsoid
8799 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8800 !! end
8801
8802 !! test
8803 Redirect syntax under text isn't considered a redirect
8804 !! wikitext
8805 some text
8806 #redirect [[Main Page]]
8807 !! html/parsoid
8808 <p>some text</p>
8809 <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>
8810 !! end
8811
8812 # FIXME: Should hoist the redirect to the top of the page and ensure there
8813 # is only one.
8814 !! test
8815 New redirect
8816 !! options
8817 parsoid=html2wt
8818 !! html/parsoid
8819 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8820 !! wikitext
8821 Foo
8822 #REDIRECT [[Foo]]
8823 !! end
8824
8825 ##
8826 ## XHTML tidiness
8827 ###
8828
8829 !! test
8830 <br> to <br />
8831 !! wikitext
8832 1<br>2<br />3
8833 !! html
8834 <p>1<br />2<br />3
8835 </p>
8836 !! end
8837
8838 !! test
8839 Broken br tag sanitization
8840 !! wikitext
8841 </br>
8842 !! html/php
8843 <p>&lt;/br&gt;
8844 </p>
8845 !! end
8846
8847 # TODO: Fix html2html mode (bug 51055)!
8848 !! test
8849 Parsoid: Broken br tag recognition
8850 !! options
8851 parsoid=wt2html
8852 !! wikitext
8853 </br>
8854
8855 <br/ >
8856 !! html+tidy
8857 <p><br /></p>
8858 <p><br /></p>
8859 !! end
8860
8861 !! test
8862 Incorrecly removing closing slashes from correctly formed XHTML
8863 !! wikitext
8864 <br style="clear:both;" />
8865 !! html
8866 <p><br style="clear:both;" />
8867 </p>
8868 !! end
8869
8870 !! test
8871 Failing to transform badly formed HTML into correct XHTML
8872 !! wikitext
8873 <br style="clear: left;">
8874 <br style="clear: right;">
8875 <br style="clear: both;">
8876 !! html
8877 <p><br style="clear: left;" />
8878 <br style="clear: right;" />
8879 <br style="clear: both;" />
8880 </p>
8881 !!end
8882
8883 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8884 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8885 !! test
8886 Handling html with a div self-closing tag
8887 !! wikitext
8888 <div title />
8889 <div title/>
8890 <div title/ >
8891 <div title=bar />
8892 <div title=bar/>
8893 <div title=bar/ >
8894 !! html/php
8895 <p>&lt;div title /&gt;
8896 &lt;div title/&gt;
8897 </p>
8898 <div>
8899 <p>&lt;div title=bar /&gt;
8900 &lt;div title=bar/&gt;
8901 </p>
8902 <div title="bar/"></div>
8903 </div>
8904
8905 !! html/parsoid
8906 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8907 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8908 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
8909 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8910 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8911 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
8912 !! end
8913
8914 !! test
8915 Handling html with a br self-closing tag
8916 !! wikitext
8917 <br title />
8918 <br title/>
8919 <br title/ >
8920 <br title=bar />
8921 <br title=bar/>
8922 <br title=bar/ >
8923 !! html/php
8924 <p><br title="" />
8925 <br title="" />
8926 <br />
8927 <br title="bar" />
8928 <br title="bar" />
8929 <br title="bar/" />
8930 </p>
8931 !! html/parsoid
8932 <p><br title="" />
8933 <br title="" />
8934 <br title="" />
8935 <br title="bar" />
8936 <br title="bar" />
8937 <br title="bar/" />
8938 </p>
8939 !! end
8940
8941 !! test
8942 Horizontal ruler (should it add that extra space?)
8943 !! wikitext
8944 <hr>
8945 <hr >
8946 foo <hr
8947 > bar
8948 !! html+tidy
8949 <hr />
8950 <hr />
8951 <p>foo</p>
8952 <hr />
8953 <p>bar</p>
8954 !! end
8955
8956 !! test
8957 Horizontal ruler -- 4+ dashes render hr
8958 !! wikitext
8959 ----
8960 !! html
8961 <hr />
8962
8963 !! end
8964
8965 !! test
8966 Horizontal ruler -- eats additional dashes on the same line
8967 !! wikitext
8968 ---------
8969 !! html
8970 <hr />
8971
8972 !! end
8973
8974 !! test
8975 Horizontal ruler -- does not collapse dashes on consecutive lines
8976 !! wikitext
8977 ----
8978 ----
8979 !! html
8980 <hr />
8981 <hr />
8982
8983 !! end
8984
8985 !! test
8986 Horizontal ruler -- <4 dashes render as plain text
8987 !! wikitext
8988 ---
8989 !! html
8990 <p>---
8991 </p>
8992 !! end
8993
8994 !! test
8995 Horizontal ruler -- Supports content following dashes on same line
8996 !! wikitext
8997 ---- Foo
8998 !! html
8999 <hr /> Foo
9000
9001 !! html+tidy
9002 <hr />
9003 <p>Foo</p>
9004 !! end
9005
9006 ###
9007 ### Block-level elements
9008 ###
9009 !! test
9010 Common list
9011 !! wikitext
9012 *Common list
9013 * item 2
9014 *item 3
9015 !! html
9016 <ul><li>Common list</li>
9017 <li> item 2</li>
9018 <li>item 3</li></ul>
9019
9020 !! end
9021
9022 !! test
9023 Numbered list
9024 !! wikitext
9025 #Numbered list
9026 #item 2
9027 # item 3
9028 !! html
9029 <ol><li>Numbered list</li>
9030 <li>item 2</li>
9031 <li> item 3</li></ol>
9032
9033 !! end
9034
9035 !! test
9036 Mixed list
9037 !! wikitext
9038 *Mixed list
9039 *# with numbers
9040 ** and bullets
9041 *# and numbers
9042 *bullets again
9043 **bullet level 2
9044 ***bullet level 3
9045 ***#Number on level 4
9046 **bullet level 2
9047 **#Number on level 3
9048 **#Number on level 3
9049 *#number level 2
9050 *Level 1
9051 *** Level 3
9052 #** Level 3, but ordered
9053 !! html
9054 <ul><li>Mixed list
9055 <ol><li> with numbers</li></ol>
9056 <ul><li> and bullets</li></ul>
9057 <ol><li> and numbers</li></ol></li>
9058 <li>bullets again
9059 <ul><li>bullet level 2
9060 <ul><li>bullet level 3
9061 <ol><li>Number on level 4</li></ol></li></ul></li>
9062 <li>bullet level 2
9063 <ol><li>Number on level 3</li>
9064 <li>Number on level 3</li></ol></li></ul>
9065 <ol><li>number level 2</li></ol></li>
9066 <li>Level 1
9067 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
9068 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
9069
9070 !! end
9071
9072 !! test
9073 1. Nested mixed wikitext and html list
9074 !! wikitext
9075 * hi
9076 * <ul><li>ho</li></ul>
9077 * hi
9078 ** ho
9079 !! html/php
9080 <ul><li> hi</li>
9081 <li> <ul><li>ho</li></ul></li>
9082 <li> hi
9083 <ul><li> ho</li></ul></li></ul>
9084
9085 !! html/parsoid
9086 <ul><li> hi</li>
9087 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9088 <li> hi
9089 <ul><li> ho</li></ul></li></ul>
9090 !! end
9091
9092 !! test
9093 2. Nested mixed wikitext and html list (incompatible)
9094 !! wikitext
9095 ; hi
9096 : {{echo|<li>ho</li>}}
9097 !! html/php
9098 <dl><dt> hi</dt>
9099 <dd> <li>ho</li></dd></dl>
9100
9101 !! html/parsoid
9102 <dl><dt> hi</dt>
9103 <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>
9104 !! end
9105
9106 !! test
9107 Nested lists 1
9108 !! wikitext
9109 *foo
9110 **bar
9111 !! html
9112 <ul><li>foo
9113 <ul><li>bar</li></ul></li></ul>
9114
9115 !! end
9116
9117 !! test
9118 Nested lists 2
9119 !! wikitext
9120 **foo
9121 *bar
9122 !! html
9123 <ul><li><ul><li>foo</li></ul></li>
9124 <li>bar</li></ul>
9125
9126 !! end
9127
9128 !! test
9129 Nested lists 3 (first element empty)
9130 !! wikitext
9131 *
9132 **bar
9133 !! html
9134 <ul><li>
9135 <ul><li>bar</li></ul></li></ul>
9136
9137 !! end
9138
9139 !! test
9140 Nested lists 4 (first element empty)
9141 !! wikitext
9142 **
9143 *bar
9144 !! html
9145 <ul><li><ul><li></li></ul></li>
9146 <li>bar</li></ul>
9147
9148 !! end
9149
9150 !! test
9151 Nested lists 5 (both elements empty)
9152 !! wikitext
9153 **
9154 *
9155 !! html
9156 <ul><li><ul><li></li></ul></li>
9157 <li></li></ul>
9158
9159 !! end
9160
9161 !! test
9162 Nested lists 6 (both elements empty)
9163 !! wikitext
9164 *
9165 **
9166 !! html
9167 <ul><li>
9168 <ul><li></li></ul></li></ul>
9169
9170 !! end
9171
9172 !! test
9173 Nested lists 7 (skip initial nesting levels)
9174 !! wikitext
9175 *** foo
9176 !! html
9177 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
9178
9179 !! end
9180
9181 !! test
9182 Nested lists 8 (multiple nesting transitions)
9183 !! wikitext
9184 * foo
9185 *** bar
9186 ** baz
9187 * boo
9188 !! html
9189 <ul><li> foo
9190 <ul><li><ul><li> bar</li></ul></li>
9191 <li> baz</li></ul></li>
9192 <li> boo</li></ul>
9193
9194 !! end
9195
9196 !! test
9197 Nested lists 9 (extension interaction)
9198 !! options
9199 parsoid
9200 !! wikitext
9201 *<references />
9202 !! html/parsoid
9203 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9204 !! end
9205
9206 !! test
9207 1. Lists with start-of-line-transparent tokens before bullets: Comments
9208 !! wikitext
9209 *foo
9210 *<!--cmt-->bar
9211 <!--cmt-->*baz
9212 !! html
9213 <ul><li>foo</li>
9214 <li>bar</li>
9215 <li>baz</li></ul>
9216
9217 !! end
9218
9219 !! test
9220 2. Lists with start-of-line-transparent tokens before bullets: Template close
9221 !! wikitext
9222 *foo {{echo|bar
9223 }}*baz
9224 !! html
9225 <ul><li>foo bar</li>
9226 <li>baz</li></ul>
9227
9228 !! end
9229
9230 !! test
9231 List items are not parsed correctly following a <pre> block (bug 785)
9232 !! wikitext
9233 * <pre>foo</pre>
9234 * <pre>bar</pre>
9235 * zar
9236 !! html/php
9237 <ul><li> <pre>foo</pre></li>
9238 <li> <pre>bar</pre></li>
9239 <li> zar</li></ul>
9240
9241 !! html/parsoid
9242 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
9243 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
9244 <li> zar</li></ul>
9245 !! end
9246
9247 !! test
9248 List items from template
9249 !! wikitext
9250
9251 {{inner list}}
9252 * item 2
9253
9254 * item 0
9255 {{inner list}}
9256 * item 2
9257
9258 * item 0
9259 * notSOL{{inner list}}
9260 * item 2
9261 !! html
9262 <ul><li> item 1</li>
9263 <li> item 2</li></ul>
9264 <ul><li> item 0</li>
9265 <li> item 1</li>
9266 <li> item 2</li></ul>
9267 <ul><li> item 0</li>
9268 <li> notSOL</li>
9269 <li> item 1</li>
9270 <li> item 2</li></ul>
9271
9272 !! end
9273
9274 !! test
9275 List interrupted by empty line or heading
9276 !! wikitext
9277 * foo
9278
9279 ** bar
9280 == A heading ==
9281 * Another list item
9282 !! html
9283 <ul><li> foo</li></ul>
9284 <ul><li><ul><li> bar</li></ul></li></ul>
9285 <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>
9286 <ul><li> Another list item</li></ul>
9287
9288 !!end
9289
9290 !!test
9291 Multiple list tags generated by templates
9292 !! wikitext
9293 {{echo|<li>}}a
9294 {{echo|<li>}}b
9295 {{echo|<li>}}c
9296 !! html
9297 <li>a
9298 <li>b
9299 <li>c</li>
9300 </li>
9301 </li>
9302
9303 !! html+tidy
9304 <ul>
9305 <li>a</li>
9306 <li>b</li>
9307 <li>c</li>
9308 </ul>
9309 !!end
9310
9311 !!test
9312 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9313 !! wikitext
9314 *a
9315 <!--This line will NOT split the list-->
9316 *b
9317 <!--This line will NOT split the list either-->
9318 *c
9319 <!--foo--> <!----> <!--This line NOT split the list either-->
9320 *d
9321 !! html
9322 <ul><li>a</li>
9323 <li>b</li>
9324 <li>c</li>
9325 <li>d</li></ul>
9326
9327 !!end
9328
9329 !!test
9330 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9331 !! wikitext
9332 *a
9333 <!--This line will NOT split the list-->
9334 *b
9335 <!--This line will NOT split the list either-->
9336 *c
9337 <!--foo--> <!----> <!--This line NOT split the list
9338 either-->
9339 *d
9340 !! html
9341 <ul><li>a</li>
9342 <li>b</li>
9343 <li>c</li>
9344 <li>d</li></ul>
9345
9346 !!end
9347
9348 !!test
9349 Test the li-hack
9350 (The PHP parser relies on Tidy for the hack)
9351 !!options
9352 parsoid=wt2html,wt2wt
9353 !! wikitext
9354 * foo
9355 * <li>li-hack
9356 * {{echo|<li>templated li-hack}}
9357 * <!--foo--> <li> unsupported li-hack with preceding comments
9358
9359 <ul>
9360 <li><li>not a li-hack
9361 </li>
9362 </ul>
9363 !! html+tidy
9364 <ul>
9365 <li>foo</li>
9366 <li>li-hack</li>
9367 <li>templated li-hack</li>
9368 <li>unsupported li-hack with preceding comments</li>
9369 </ul>
9370 <ul>
9371 <li>not a li-hack</li>
9372 </ul>
9373 !!end
9374
9375 !! test
9376 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9377 !! options
9378 parsoid
9379 !! wikitext
9380 # foo
9381 ## bar
9382 * foo
9383 ** bar
9384 : foo
9385 :: bar
9386 !! html
9387 <ol>
9388 <li> foo<ol>
9389 <li> bar</li>
9390 </ol></li>
9391 </ol><ul>
9392 <li> foo<ul>
9393 <li> bar</li>
9394 </ul></li>
9395 </ul><dl>
9396 <dd> foo<dl>
9397 <dd> bar</dd>
9398 </dl></dd>
9399 </dl>
9400 !! end
9401
9402 !! test
9403 Parsoid: Test of whitespace serialization with Templated bullets
9404 !! options
9405 parsoid
9406 !! wikitext
9407 * {{bullet}}
9408 !! html
9409 <ul>
9410 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9411 </ul>
9412 !! end
9413
9414 # ------------------------------------------------------------------------
9415 # The next set of tests are about Parsoid's ability to handle badly nested
9416 # tags (parse, minimize scope of fixup, and roundtrip back)
9417 # ------------------------------------------------------------------------
9418
9419 !! test
9420 Unbalanced closing block tags break a list
9421 (php parser relies on Tidy to fix up)
9422 !! wikitext
9423 <div>
9424 *a</div><div>
9425 *b</div>
9426 !! html+tidy
9427 <div>
9428 <ul>
9429 <li>a</li>
9430 </ul>
9431 </div>
9432 <div>
9433 <ul>
9434 <li>b</li>
9435 </ul>
9436 </div>
9437 !! end
9438
9439 # Parsoid fails this test, but it might be tricky to support properly.
9440 # See bug 68395.
9441 !! test
9442 Unbalanced closing non-block tags don't break a list
9443 (php parser relies on Tidy to fix up)
9444 !! wikitext
9445 <span>
9446 *a</span><span>
9447 *b</span>
9448 !! html/php+tidy
9449 <ul>
9450 <li><span>a</span></li>
9451 <li><span>b</span></li>
9452 </ul>
9453 !! html/parsoid
9454 <span>
9455 <ul>
9456 <li>a<span></span>
9457 </li>
9458 <li>b
9459 </li>
9460 </ul>
9461 </span>
9462 !! end
9463
9464 !! test
9465 Unclosed formatting tags that straddle lists are closed and reopened
9466 (php parser relies on Tidy to fix up)
9467 !! options
9468 parsoid=wt2html,wt2wt,html2html
9469 !! wikitext
9470 # <s> a
9471 # b </s>
9472 !! html/php+tidy
9473 <ol>
9474 <li><s>a</s></li>
9475 <li><s>b</s></li>
9476 </ol>
9477 !! html/parsoid
9478 <ol><li> <s> a</s></li>
9479 <li><s> b </s></li></ol>
9480 !! end
9481
9482 # See bug 68395.
9483 !!test
9484 1. List embedded in a formatting tag
9485 !! wikitext
9486 <small>
9487 * foo
9488 </small>
9489 !! html/php+tidy
9490 <ul>
9491 <li><small>foo</small></li>
9492 </ul>
9493 !! html/parsoid
9494 <small>
9495 <ul>
9496 <li> foo</li>
9497 </ul>
9498 </small>
9499 !!end
9500
9501 ## Ugly Parsoid output here
9502 ## Not sure what the right output is.
9503 !!test
9504 2. List embedded in a formatting tag
9505 !! wikitext
9506 <small>
9507 *a
9508 *b</small>
9509 !! html/php+tidy
9510 <ul>
9511 <li><small>a</small></li>
9512 <li><small>b</small></li>
9513 </ul>
9514 !! html/parsoid
9515 <small></small>
9516 <ul><small>
9517 <li>a</li>
9518 </small>
9519 <li><small>b</small></li>
9520 </ul>
9521 !!end
9522
9523 # Ugly Parsoid and PHP parser output here
9524 # Not sure if we want to make this a test!
9525 #
9526 ## !!test
9527 ## 3. Unclosed formatting tags in list elements
9528 ## !! wikitext
9529 ## *<small>a
9530 ## *<small>b
9531 ## !! html/php+tidy
9532 ## <ul>
9533 ## <li><small>a</small></li>
9534 ## <li><small><small>b</small></small></li>
9535 ## </ul>
9536 ## !! html/parsoid
9537 ## <ul>
9538 ## <li><small>a</small></li>
9539 ## <small>
9540 ## <li><small>b</small></li>
9541 ## </small></ul>
9542 ## !!end
9543
9544 # This is a bug in the PHP parser + tidy combination.
9545 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9546 # and then fostered out of the table by tidy.)
9547 # We believe the Parsoid output to be correct.
9548 !! test
9549 Table with missing opening <tr> tag
9550 !! options
9551 parsoid=wt2html,wt2wt
9552 !! wikitext
9553 <table>
9554 <td>foo</td>
9555 </tr>
9556 </table>
9557 !! html+tidy
9558 <table>
9559 <tr>
9560 <td>foo</td>
9561 </tr>
9562 </table>
9563 !! end
9564
9565 ###
9566 ### Magic Words
9567 ###
9568
9569 # Note that the current date is hard-coded as
9570 # 1970-01-01T00:02:03Z (a Thursday)
9571 # when running parser tests. The timezone is also fixed to GMT, so
9572 # local date will be identical to current date.
9573
9574 !! test
9575 Magic Word: {{CURRENTDAY}}
9576 !! wikitext
9577 {{CURRENTDAY}}
9578 !! html
9579 <p>1
9580 </p>
9581 !! end
9582
9583 !! test
9584 Magic Word: {{CURRENTDAY2}}
9585 !! wikitext
9586 {{CURRENTDAY2}}
9587 !! html
9588 <p>01
9589 </p>
9590 !! end
9591
9592 !! test
9593 Magic Word: {{CURRENTDAYNAME}}
9594 !! wikitext
9595 {{CURRENTDAYNAME}}
9596 !! html
9597 <p>Thursday
9598 </p>
9599 !! end
9600
9601 !! test
9602 Magic Word: {{CURRENTDOW}}
9603 !! wikitext
9604 {{CURRENTDOW}}
9605 !! html
9606 <p>4
9607 </p>
9608 !! end
9609
9610 !! test
9611 Magic Word: {{CURRENTMONTH}}
9612 !! wikitext
9613 {{CURRENTMONTH}}
9614 !! html
9615 <p>01
9616 </p>
9617 !! end
9618
9619 !! test
9620 Magic Word: {{CURRENTMONTH1}}
9621 !! wikitext
9622 {{CURRENTMONTH1}}
9623 !! html
9624 <p>1
9625 </p>
9626 !! end
9627
9628 !! test
9629 Magic Word: {{CURRENTMONTHABBREV}}
9630 !! wikitext
9631 {{CURRENTMONTHABBREV}}
9632 !! html
9633 <p>Jan
9634 </p>
9635 !! end
9636
9637 !! test
9638 Magic Word: {{CURRENTMONTHNAME}}
9639 !! wikitext
9640 {{CURRENTMONTHNAME}}
9641 !! html
9642 <p>January
9643 </p>
9644 !! end
9645
9646 !! test
9647 Magic Word: {{CURRENTMONTHNAMEGEN}}
9648 !! wikitext
9649 {{CURRENTMONTHNAMEGEN}}
9650 !! html
9651 <p>January
9652 </p>
9653 !! end
9654
9655 !! test
9656 Magic Word: {{CURRENTTIME}}
9657 !! wikitext
9658 {{CURRENTTIME}}
9659 !! html
9660 <p>00:02
9661 </p>
9662 !! end
9663
9664 !! test
9665 Magic Word: {{CURRENTHOUR}}
9666 !! wikitext
9667 {{CURRENTHOUR}}
9668 !! html
9669 <p>00
9670 </p>
9671 !! end
9672
9673 !! test
9674 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9675 !! wikitext
9676 {{CURRENTWEEK}}
9677 !! html
9678 <p>1
9679 </p>
9680 !! end
9681
9682 !! test
9683 Magic Word: {{CURRENTYEAR}}
9684 !! wikitext
9685 {{CURRENTYEAR}}
9686 !! html
9687 <p>1970
9688 </p>
9689 !! end
9690
9691 !! test
9692 Magic Word: {{CURRENTTIMESTAMP}}
9693 !! wikitext
9694 {{CURRENTTIMESTAMP}}
9695 !! html
9696 <p>19700101000203
9697 </p>
9698 !! end
9699
9700 !! test
9701 Magic Words LOCAL (UTC)
9702 !! wikitext
9703 * {{LOCALMONTH}}
9704 * {{LOCALMONTH1}}
9705 * {{LOCALMONTHNAME}}
9706 * {{LOCALMONTHNAMEGEN}}
9707 * {{LOCALMONTHABBREV}}
9708 * {{LOCALDAY}}
9709 * {{LOCALDAY2}}
9710 * {{LOCALDAYNAME}}
9711 * {{LOCALYEAR}}
9712 * {{LOCALTIME}}
9713 * {{LOCALHOUR}}
9714 * {{LOCALWEEK}}
9715 * {{LOCALDOW}}
9716 * {{LOCALTIMESTAMP}}
9717 !! html
9718 <ul><li> 01</li>
9719 <li> 1</li>
9720 <li> January</li>
9721 <li> January</li>
9722 <li> Jan</li>
9723 <li> 1</li>
9724 <li> 01</li>
9725 <li> Thursday</li>
9726 <li> 1970</li>
9727 <li> 00:02</li>
9728 <li> 00</li>
9729 <li> 1</li>
9730 <li> 4</li>
9731 <li> 19700101000203</li></ul>
9732
9733 !! end
9734
9735 !! test
9736 Magic Word: {{FULLPAGENAME}}
9737 !! options
9738 title=[[User:Ævar Arnfjörð Bjarmason]]
9739 !! wikitext
9740 {{FULLPAGENAME}}
9741 !! html
9742 <p>User:Ævar Arnfjörð Bjarmason
9743 </p>
9744 !! end
9745
9746 !! test
9747 Magic Word: {{FULLPAGENAMEE}}
9748 !! options
9749 title=[[User:Ævar Arnfjörð Bjarmason]]
9750 !! wikitext
9751 {{FULLPAGENAMEE}}
9752 !! html
9753 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9754 </p>
9755 !! end
9756
9757 !! test
9758 Magic Word: {{TALKSPACE}}
9759 !! options
9760 title=[[User:Ævar Arnfjörð Bjarmason]]
9761 !! wikitext
9762 {{TALKSPACE}}
9763 !! html
9764 <p>User talk
9765 </p>
9766 !! end
9767
9768 !! test
9769 Magic Word: {{TALKSPACE}}, same namespace
9770 !! options
9771 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9772 !! wikitext
9773 {{TALKSPACE}}
9774 !! html
9775 <p>User talk
9776 </p>
9777 !! end
9778
9779 !! test
9780 Magic Word: {{TALKSPACE}}, main namespace
9781 !! options
9782 title=[[Parser Test]]
9783 !! wikitext
9784 {{TALKSPACE}}
9785 !! html
9786 <p>Talk
9787 </p>
9788 !! end
9789
9790 !! test
9791 Magic Word: {{TALKSPACEE}}
9792 !! options
9793 title=[[User:Ævar Arnfjörð Bjarmason]]
9794 !! wikitext
9795 {{TALKSPACEE}}
9796 !! html
9797 <p>User_talk
9798 </p>
9799 !! end
9800
9801 !! test
9802 Magic Word: {{SUBJECTSPACE}}
9803 !! options
9804 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9805 !! wikitext
9806 {{SUBJECTSPACE}}
9807 !! html
9808 <p>User
9809 </p>
9810 !! end
9811
9812 !! test
9813 Magic Word: {{SUBJECTSPACE}}, same namespace
9814 !! options
9815 title=[[User:Ævar Arnfjörð Bjarmason]]
9816 !! wikitext
9817 {{SUBJECTSPACE}}
9818 !! html
9819 <p>User
9820 </p>
9821 !! end
9822
9823 !! test
9824 Magic Word: {{SUBJECTSPACE}}, main namespace
9825 !! options
9826 title=[[Parser Test]]
9827 !! wikitext
9828 {{SUBJECTSPACE}}
9829 !! html
9830
9831 !! end
9832
9833 !! test
9834 Magic Word: {{SUBJECTSPACEE}}
9835 !! options
9836 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9837 !! wikitext
9838 {{SUBJECTSPACEE}}
9839 !! html
9840 <p>User
9841 </p>
9842 !! end
9843
9844 !! test
9845 Magic Word: {{NAMESPACE}}
9846 !! options
9847 title=[[User:Ævar Arnfjörð Bjarmason]]
9848 !! wikitext
9849 {{NAMESPACE}}
9850 !! html
9851 <p>User
9852 </p>
9853 !! end
9854
9855 !! test
9856 Magic Word: {{NAMESPACEE}}
9857 !! options
9858 title=[[User:Ævar Arnfjörð Bjarmason]]
9859 !! wikitext
9860 {{NAMESPACEE}}
9861 !! html
9862 <p>User
9863 </p>
9864 !! end
9865
9866 !! test
9867 Magic Word: {{NAMESPACENUMBER}}
9868 !! options
9869 title=[[User:Ævar Arnfjörð Bjarmason]]
9870 !! wikitext
9871 {{NAMESPACENUMBER}}
9872 !! html
9873 <p>2
9874 </p>
9875 !! end
9876
9877 !! test
9878 Magic Word: {{SUBPAGENAME}}
9879 !! options
9880 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9881 !! wikitext
9882 {{SUBPAGENAME}}
9883 !! html
9884 <p>sub ö
9885 </p>
9886 !! end
9887
9888 !! test
9889 Magic Word: {{SUBPAGENAMEE}}
9890 !! options
9891 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9892 !! wikitext
9893 {{SUBPAGENAMEE}}
9894 !! html
9895 <p>sub_%C3%B6
9896 </p>
9897 !! end
9898
9899 !! test
9900 Magic Word: {{ROOTPAGENAME}}
9901 !! options
9902 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9903 !! wikitext
9904 {{ROOTPAGENAME}}
9905 !! html
9906 <p>Ævar Arnfjörð Bjarmason
9907 </p>
9908 !! end
9909
9910 !! test
9911 Magic Word: {{ROOTPAGENAMEE}}
9912 !! options
9913 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9914 !! wikitext
9915 {{ROOTPAGENAMEE}}
9916 !! html
9917 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9918 </p>
9919 !! end
9920
9921 !! test
9922 Magic Word: {{BASEPAGENAME}}
9923 !! options
9924 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9925 !! wikitext
9926 {{BASEPAGENAME}}
9927 !! html
9928 <p>Ævar Arnfjörð Bjarmason
9929 </p>
9930 !! end
9931
9932 !! test
9933 Magic Word: {{BASEPAGENAMEE}}
9934 !! options
9935 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9936 !! wikitext
9937 {{BASEPAGENAMEE}}
9938 !! html
9939 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9940 </p>
9941 !! end
9942
9943 !! test
9944 Magic Word: {{TALKPAGENAME}}
9945 !! options
9946 title=[[User:Ævar Arnfjörð Bjarmason]]
9947 !! wikitext
9948 {{TALKPAGENAME}}
9949 !! html
9950 <p>User talk:Ævar Arnfjörð Bjarmason
9951 </p>
9952 !! end
9953
9954 !! test
9955 Magic Word: {{TALKPAGENAMEE}}
9956 !! options
9957 title=[[User:Ævar Arnfjörð Bjarmason]]
9958 !! wikitext
9959 {{TALKPAGENAMEE}}
9960 !! html
9961 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9962 </p>
9963 !! end
9964
9965 !! test
9966 Magic Word: {{SUBJECTPAGENAME}}
9967 !! options
9968 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9969 !! wikitext
9970 {{SUBJECTPAGENAME}}
9971 !! html
9972 <p>User:Ævar Arnfjörð Bjarmason
9973 </p>
9974 !! end
9975
9976 !! test
9977 Magic Word: {{SUBJECTPAGENAMEE}}
9978 !! options
9979 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9980 !! wikitext
9981 {{SUBJECTPAGENAMEE}}
9982 !! html
9983 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9984 </p>
9985 !! end
9986
9987 !! test
9988 Magic Word: {{NUMBEROFFILES}}
9989 !! wikitext
9990 {{NUMBEROFFILES}}
9991 !! html
9992 <p>7
9993 </p>
9994 !! end
9995
9996 !! test
9997 Magic Word: {{PAGENAME}}
9998 !! options
9999 title=[[User:Ævar Arnfjörð Bjarmason]]
10000 !! wikitext
10001 {{PAGENAME}}
10002 !! html
10003 <p>Ævar Arnfjörð Bjarmason
10004 </p>
10005 !! end
10006
10007 !! test
10008 Magic Word: {{PAGENAME}} with metacharacters
10009 !! options
10010 title=[['foo & bar = baz']]
10011 !! wikitext
10012 ''{{PAGENAME}}''
10013 !! html/php
10014 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10015 </p>
10016 !! html+tidy
10017 <p><i>'foo &amp; bar = baz'</i></p>
10018 !! end
10019
10020 !! test
10021 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
10022 !! options
10023 title=[[*RFC 1234 http://example.com/]]
10024 !! wikitext
10025 {{PAGENAME}}
10026 !! html/php
10027 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10028 </p>
10029 !! html+tidy
10030 <p>*RFC 1234 http://example.com/</p>
10031 !! end
10032
10033 !! test
10034 Magic Word: {{PAGENAMEE}}
10035 !! options
10036 title=[[User:Ævar Arnfjörð Bjarmason]]
10037 !! wikitext
10038 {{PAGENAMEE}}
10039 !! html
10040 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10041 </p>
10042 !! end
10043
10044 !! test
10045 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
10046 !! options
10047 title=[[*RFC 1234 http://example.com/]]
10048 !! wikitext
10049 {{PAGENAMEE}}
10050 !! html/php
10051 <p>&#42;RFC_1234_http&#58;//example.com/
10052 </p>
10053 !! html+tidy
10054 <p>*RFC_1234_http://example.com/</p>
10055 !! end
10056
10057 !! test
10058 Magic Word: {{REVISIONID}}
10059 !! wikitext
10060 {{REVISIONID}}
10061 !! html
10062 <p>1337
10063 </p>
10064 !! end
10065
10066 !! test
10067 Magic Word: {{SCRIPTPATH}}
10068 !! wikitext
10069 {{SCRIPTPATH}}
10070 !! html
10071
10072 !! end
10073
10074 !! test
10075 Magic Word: {{STYLEPATH}}
10076 !! wikitext
10077 {{STYLEPATH}}
10078 !! html
10079 <p>/skins
10080 </p>
10081 !! end
10082
10083 !! test
10084 Magic Word: {{SERVER}}
10085 !! wikitext
10086 {{SERVER}}
10087 !! html
10088 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10089 </p>
10090 !! end
10091
10092 !! test
10093 Magic Word: {{SERVERNAME}}
10094 !! wikitext
10095 {{SERVERNAME}}
10096 !! html
10097 <p>example.org
10098 </p>
10099 !! end
10100
10101 !! test
10102 Magic Word: {{SITENAME}}
10103 !! wikitext
10104 {{SITENAME}}
10105 !! html
10106 <p>MediaWiki
10107 </p>
10108 !! end
10109
10110 !! test
10111 Case-sensitive magic words, when cased differently, should just be template transclusions
10112 !! wikitext
10113 {{CurrentMonth}}
10114 {{currentday}}
10115 {{cURreNTweEK}}
10116 {{currentHour}}
10117 !! html
10118 <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>
10119 <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>
10120 <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>
10121 <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>
10122 </p>
10123 !! end
10124
10125 !! test
10126 Case-insensitive magic words should still work with weird casing.
10127 !! wikitext
10128 {{sErVeRNaMe}}
10129 {{LCFirst:AOEU}}
10130 {{ucFIRST:aoeu}}
10131 {{SERver}}
10132 !! html
10133 <p>example.org
10134 aOEU
10135 Aoeu
10136 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10137 </p>
10138 !! end
10139
10140 # From plwiki:PLOS_ONE
10141 !! test
10142 Parsoid: Page property magic word with magic word contents
10143 !! wikitext
10144 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10145 !! html/parsoid
10146 <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>"}]]}'/>
10147 !! end
10148
10149 !! test
10150 Parsoid: Template-generated DISPLAYTITLE
10151 !! wikitext
10152 {{{{echo|DISPLAYTITLE}}:Foo}}
10153 !! html/parsoid
10154 <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}}]}'/>
10155 !! end
10156
10157 !! test
10158 Namespace 1 {{ns:1}}
10159 !! wikitext
10160 {{ns:1}}
10161 !! html
10162 <p>Talk
10163 </p>
10164 !! end
10165
10166 !! test
10167 Namespace 1 {{ns:01}}
10168 !! wikitext
10169 {{ns:01}}
10170 !! html
10171 <p>Talk
10172 </p>
10173 !! end
10174
10175 !! test
10176 Namespace 0 {{ns:0}} (bug 4783)
10177 !! wikitext
10178 {{ns:0}}
10179 !! html
10180
10181 !! end
10182
10183 !! test
10184 Namespace 0 {{ns:00}} (bug 4783)
10185 !! wikitext
10186 {{ns:00}}
10187 !! html
10188
10189 !! end
10190
10191 !! test
10192 Namespace -1 {{ns:-1}}
10193 !! wikitext
10194 {{ns:-1}}
10195 !! html
10196 <p>Special
10197 </p>
10198 !! end
10199
10200 !! test
10201 Namespace User {{ns:User}}
10202 !! wikitext
10203 {{ns:User}}
10204 !! html
10205 <p>User
10206 </p>
10207 !! end
10208
10209 !! test
10210 Namespace User talk {{ns:User_talk}}
10211 !! wikitext
10212 {{ns:User_talk}}
10213 !! html
10214 <p>User talk
10215 </p>
10216 !! end
10217
10218 !! test
10219 Namespace User talk {{ns:uSeR tAlK}}
10220 !! wikitext
10221 {{ns:uSeR tAlK}}
10222 !! html
10223 <p>User talk
10224 </p>
10225 !! end
10226
10227 !! test
10228 Namespace File {{ns:File}}
10229 !! wikitext
10230 {{ns:File}}
10231 !! html
10232 <p>File
10233 </p>
10234 !! end
10235
10236 !! test
10237 Namespace File {{ns:Image}}
10238 !! wikitext
10239 {{ns:Image}}
10240 !! html
10241 <p>File
10242 </p>
10243 !! end
10244
10245 !! test
10246 Namespace (lang=de) Benutzer {{ns:User}}
10247 !! options
10248 language=de
10249 !! wikitext
10250 {{ns:User}}
10251 !! html
10252 <p>Benutzer
10253 </p>
10254 !! end
10255
10256 !! test
10257 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10258 !! options
10259 language=de
10260 !! wikitext
10261 {{ns:3}}
10262 !! html
10263 <p>Benutzer Diskussion
10264 </p>
10265 !! end
10266
10267
10268 !! test
10269 Urlencode
10270 !! wikitext
10271 {{urlencode:hi world?!}}
10272 {{urlencode:hi world?!|WIKI}}
10273 {{urlencode:hi world?!|PATH}}
10274 {{urlencode:hi world?!|QUERY}}
10275 !! html
10276 <p>hi+world%3F%21
10277 hi_world%3F!
10278 hi%20world%3F%21
10279 hi+world%3F%21
10280 </p>
10281 !! end
10282
10283 !! test
10284 Magic Word: prioritize type info over data-parsoid
10285 !! options
10286 parsoid=html2wt
10287 !! html/parsoid
10288 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10289 !! wikitext
10290 __FORCETOC__
10291 !! end
10292
10293 !! test
10294 Magic Word: serialize on separate line (parsoid)
10295 !! options
10296 parsoid=wt2wt,html2wt
10297 !! wikitext
10298 foo
10299 __NOTOC__
10300 bar
10301 !! html/parsoid
10302 foo<meta property="mw:PageProp/notoc"/>bar
10303 !! end
10304
10305 !! test
10306 Magic Word: rt non-english wikis
10307 !! options
10308 parsoid=wt2wt
10309 language=de
10310 !! wikitext
10311 __NOEDITSECTION__
10312 !! html/parsoid
10313 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10314 !! end
10315
10316 !!test
10317 __proto__ is treated as normal wikitext (T105997)
10318 !!wikitext
10319 __proto__
10320 !!html
10321 <p>__proto__
10322 </p>
10323 !!end
10324
10325 ###
10326 ### Magic links
10327 ###
10328 !! test
10329 Magic links: internal link to RFC (bug 479)
10330 !! wikitext
10331 [[RFC 123]]
10332 !! html/php
10333 <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>
10334 </p>
10335 !! html/parsoid
10336 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10337 !! end
10338
10339 !! test
10340 Magic links: RFC (bug 479)
10341 !! wikitext
10342 RFC 822
10343 !! html/php
10344 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10345 </p>
10346 !! html/parsoid
10347 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10348 !! end
10349
10350 !! test
10351 Magic links: RFC (bug 65278)
10352 !! wikitext
10353 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10354 !! html/php
10355 <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.
10356 </p>
10357 !! html/parsoid
10358 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10359 !! end
10360
10361 !! test
10362 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
10363 !! wikitext
10364 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10365 RFC
10366 822
10367 !! html/php
10368 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10369 RFC
10370 822
10371 </p>
10372 !! html/parsoid
10373 <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>
10374 RFC
10375 822</p>
10376 !! end
10377
10378 !! test
10379 Magic links: ISBN (bug 1937)
10380 !! wikitext
10381 ISBN 0-306-40615-2
10382 !! html/php
10383 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10384 </p>
10385 !! html/parsoid
10386 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10387 !! end
10388
10389 !! test
10390 Magic links: ISBN (bug 65278)
10391 !! wikitext
10392 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10393 !! html/php
10394 <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.
10395 </p>
10396 !! html/parsoid
10397 <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>
10398 !! end
10399
10400 !! test
10401 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10402 !! wikitext
10403 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10404 ISBN
10405 9780316098113
10406 ISBN 978
10407 0316098113
10408 !! html/php
10409 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10410 ISBN
10411 9780316098113
10412 ISBN 978
10413 0316098113
10414 </p>
10415 !! html/parsoid
10416 <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>
10417 ISBN
10418 9780316098113
10419 ISBN 978
10420 0316098113</p>
10421 !! end
10422
10423 !! test
10424 Magic links: PMID incorrectly converts space to underscore
10425 !! wikitext
10426 PMID 1234
10427 !! html/php
10428 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10429 </p>
10430 !! html/parsoid
10431 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10432 !! end
10433
10434 !! test
10435 Magic links: PMID (bug 65278)
10436 !! wikitext
10437 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10438 !! html/php
10439 <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.
10440 </p>
10441 !! html/parsoid
10442 <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>
10443 !! end
10444
10445 !! test
10446 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10447 !! wikitext
10448 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10449 PMID
10450 1234
10451 !! html/php
10452 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10453 PMID
10454 1234
10455 </p>
10456 !! html/parsoid
10457 <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>
10458 PMID
10459 1234</p>
10460 !! end
10461
10462 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10463 # since these are ExtLinkText, not MagicLinkText
10464 !! test
10465 Magic links: use appropriate serialization for "almost" magic links.
10466 !! wikitext
10467 X[[Special:BookSources/0978739256|foo]]
10468
10469 X[//tools.ietf.org/html/rfc1234 foo]
10470 !! html/php
10471 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10472 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10473 </p>
10474 !! html/parsoid
10475 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10476 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10477 !! end
10478
10479 ###
10480 ### Templates
10481 ####
10482
10483 !! test
10484 Nonexistent template
10485 !! wikitext
10486 {{thistemplatedoesnotexist}}
10487 !! html
10488 <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>
10489 </p>
10490 !! end
10491
10492 !! test
10493 Template with invalid target containing tags
10494 !! wikitext
10495 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10496 !! html
10497 <p>{{a<b>b</b>|foo|a=b|a = b}}
10498 </p>
10499 !! end
10500
10501 !! test
10502 Template with invalid target containing unclosed tag
10503 !! wikitext
10504 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10505 !! html
10506 <p>{{a<b>|foo|a=b|a = b}}</b>
10507 </p>
10508 !! end
10509
10510 !! test
10511 Template with invalid target containing wikilink
10512 !! wikitext
10513 {{[[Main Page]]}}
10514 !! html/php
10515 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10516 </p>
10517 !! html/parsoid
10518 <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>
10519 !! end
10520
10521 !! test
10522 Template with just whitespace in it, bug #68421
10523 !! wikitext
10524 {{echo|{{ }}}}
10525 !! html/parsoid
10526 <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>
10527 !! end
10528
10529 !! article
10530 Template:test
10531 !! text
10532 This is a test template
10533 !! endarticle
10534
10535 !! test
10536 Simple template
10537 !! wikitext
10538 {{test}}
10539 !! html
10540 <p>This is a test template
10541 </p>
10542 !! end
10543
10544 !! test
10545 Template with explicit namespace
10546 !! wikitext
10547 {{Template:test}}
10548 !! html
10549 <p>This is a test template
10550 </p>
10551 !! end
10552
10553
10554 !! article
10555 Template:paramtest
10556 !! text
10557 This is a test template with parameter {{{param}}}
10558 !! endarticle
10559
10560 !! test
10561 Template parameter
10562 !! wikitext
10563 {{paramtest|param=foo}}
10564 !! html
10565 <p>This is a test template with parameter foo
10566 </p>
10567 !! end
10568
10569 !! article
10570 Template:paramtestnum
10571 !! text
10572 [[{{{1}}}|{{{2}}}]]
10573 !! endarticle
10574
10575 !! test
10576 Template unnamed parameter
10577 !! wikitext
10578 {{paramtestnum|Main Page|the main page}}
10579 !! html
10580 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10581 </p>
10582 !! end
10583
10584 !! article
10585 Template:templatesimple
10586 !! text
10587 (test)
10588 !! endarticle
10589
10590 !! article
10591 Template:templateredirect
10592 !! text
10593 #redirect [[Template:templatesimple]]
10594 !! endarticle
10595
10596 !! article
10597 Template:templateasargtestnum
10598 !! text
10599 {{{{{1}}}}}
10600 !! endarticle
10601
10602 !! article
10603 Template:templateasargtest
10604 !! text
10605 {{template{{{templ}}}}}
10606 !! endarticle
10607
10608 !! article
10609 Template:templateasargtest2
10610 !! text
10611 {{{{{templ}}}}}
10612 !! endarticle
10613
10614 !! test
10615 Template with template name as unnamed argument
10616 !! wikitext
10617 {{templateasargtestnum|templatesimple}}
10618 !! html
10619 <p>(test)
10620 </p>
10621 !! end
10622
10623 !! test
10624 Template with template name as argument
10625 !! wikitext
10626 {{templateasargtest|templ=simple}}
10627 !! html
10628 <p>(test)
10629 </p>
10630 !! end
10631
10632 !! test
10633 Template with template name as argument (2)
10634 !! wikitext
10635 {{templateasargtest2|templ=templatesimple}}
10636 !! html
10637 <p>(test)
10638 </p>
10639 !! end
10640
10641 !! article
10642 Template:templateasargtestdefault
10643 !! text
10644 {{{{{templ|templatesimple}}}}}
10645 !! endarticle
10646
10647 !! article
10648 Template:templa
10649 !! text
10650 '''templ'''
10651 !! endarticle
10652
10653 !! test
10654 Template with default value
10655 !! wikitext
10656 {{templateasargtestdefault}}
10657 !! html
10658 <p>(test)
10659 </p>
10660 !! end
10661
10662 !! test
10663 Template with default value (value set)
10664 !! wikitext
10665 {{templateasargtestdefault|templ=templa}}
10666 !! html
10667 <p><b>templ</b>
10668 </p>
10669 !! end
10670
10671 !! test
10672 Template redirect
10673 !! wikitext
10674 {{templateredirect}}
10675 !! html/php
10676 <p>(test)
10677 </p>
10678 !! html/parsoid
10679 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10680 !! end
10681
10682 !! test
10683 Template with argument in separate line
10684 !! wikitext
10685 {{ templateasargtest |
10686 templ = simple }}
10687 !! html
10688 <p>(test)
10689 </p>
10690 !! end
10691
10692 !! test
10693 Template with complex template as argument
10694 !! wikitext
10695 {{paramtest|
10696 param ={{ templateasargtest |
10697 templ = simple }}}}
10698 !! html
10699 <p>This is a test template with parameter (test)
10700 </p>
10701 !! end
10702
10703 !! test
10704 Template with thumb image (with link in description)
10705 !! wikitext
10706 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10707 !! html/php
10708 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>
10709
10710 !! html+tidy
10711 <p>This is a test template with parameter</p>
10712 <div class="thumb tright">
10713 <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>
10714 <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>
10715 </div>
10716 </div>
10717 !! html/parsoid
10718 <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>
10719 !! end
10720
10721 !! article
10722 Template:complextemplate
10723 !! text
10724 {{{1}}} {{paramtest|
10725 param ={{{param}}}}}
10726 !! endarticle
10727
10728 !! test
10729 Template with complex arguments
10730 !! wikitext
10731 {{complextemplate|
10732 param ={{ templateasargtest |
10733 templ = simple }}|[[Template:complextemplate|link]]}}
10734 !! html
10735 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10736 </p>
10737 !! end
10738
10739 !! test
10740 BUG 553: link with two variables in a piped link
10741 !! wikitext
10742 {|
10743 |[[{{{1}}}|{{{2}}}]]
10744 |}
10745 !! html/php
10746 <table>
10747 <tr>
10748 <td>[[{{{1}}}|{{{2}}}]]
10749 </td></tr></table>
10750
10751 !! html/parsoid
10752 <table>
10753 <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>
10754 !! end
10755
10756 # See: T2553
10757 !! test
10758 Abort table cell attribute parsing on wikilink
10759 !! wikitext
10760 {|
10761 | testing [[one|two]] | three || four
10762 | testing one two | three || four
10763 | testing="[[one|two]]" | three || four
10764 |}
10765 !! html/php
10766 <table>
10767 <tr>
10768 <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>
10769 <td> four
10770 </td>
10771 <td> three </td>
10772 <td> four
10773 </td>
10774 <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>
10775 <td> four
10776 </td></tr></table>
10777
10778 !! html/parsoid
10779 <table>
10780 <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>
10781 <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>
10782 <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>
10783 </tbody></table>
10784 !! end
10785
10786 !! test
10787 Don't abort table cell attribute parsing if wikilink is found in template arg
10788 !! wikitext
10789 {|
10790 | Test {{#tag:ref|One two "[[three]]" four}}
10791 |}
10792 !! html/parsoid
10793 <table>
10794 <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>
10795 </tbody></table>
10796 !! end
10797
10798 !! test
10799 Magic variable as template parameter
10800 !! wikitext
10801 {{paramtest|param={{SITENAME}}}}
10802 !! html
10803 <p>This is a test template with parameter MediaWiki
10804 </p>
10805 !! end
10806
10807 !! article
10808 Template:linktest
10809 !! text
10810 [[{{{param}}}|link]]
10811 !! endarticle
10812
10813 !! test
10814 Template parameter as link source
10815 !! wikitext
10816 {{linktest|param=Main Page}}
10817 !! html
10818 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10819 </p>
10820 !! end
10821
10822 !!article
10823 Template:paramtest2
10824 !! text
10825 including another template, {{paramtest|param={{{arg}}}}}
10826 !! endarticle
10827
10828 !! test
10829 Template passing argument to another template
10830 !! wikitext
10831 {{paramtest2|arg='hmm'}}
10832 !! html
10833 <p>including another template, This is a test template with parameter 'hmm'
10834 </p>
10835 !! end
10836
10837 !! article
10838 Template:Linktest2
10839 !! text
10840 Main Page
10841 !! endarticle
10842
10843 !! test
10844 Template as link source
10845 !! wikitext
10846 [[{{linktest2}}]]
10847
10848 [[{{linktest2}}|Main Page]]
10849
10850 [[{{linktest2}}]]Page
10851 !! html
10852 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10853 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10854 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10855 </p>
10856 !! end
10857
10858
10859 !! article
10860 Template:loop1
10861 !! text
10862 {{loop2}}
10863 !! endarticle
10864
10865 !! article
10866 Template:loop2
10867 !! text
10868 {{loop1}}
10869 !! endarticle
10870
10871 !! test
10872 Template infinite loop
10873 !! wikitext
10874 {{loop1}}
10875 !! html
10876 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10877 </p>
10878 !! end
10879
10880 !! test
10881 Template from main namespace
10882 !! wikitext
10883 {{:Main Page}}
10884 !! html
10885 <p>blah blah
10886 </p>
10887 !! end
10888
10889 !! article
10890 Template:table
10891 !! text
10892 {|
10893 | 1 || 2
10894 |-
10895 | 3 || 4
10896 |}
10897 !! endarticle
10898
10899 !! test
10900 BUG 529: Template with table, not included at beginning of line
10901 !! wikitext
10902 foo {{table}}
10903 !! html
10904 <p>foo
10905 </p>
10906 <table>
10907 <tr>
10908 <td> 1 </td>
10909 <td> 2
10910 </td></tr>
10911 <tr>
10912 <td> 3 </td>
10913 <td> 4
10914 </td></tr></table>
10915
10916 !! end
10917
10918 !! test
10919 BUG 523: Template shouldn't eat newline (or add an extra one before table)
10920 !! wikitext
10921 foo
10922 {{table}}
10923 !! html
10924 <p>foo
10925 </p>
10926 <table>
10927 <tr>
10928 <td> 1 </td>
10929 <td> 2
10930 </td></tr>
10931 <tr>
10932 <td> 3 </td>
10933 <td> 4
10934 </td></tr></table>
10935
10936 !! end
10937
10938 !! test
10939 BUG 41: Template parameters shown as broken links
10940 !! wikitext
10941 {{{parameter}}}
10942 !! html
10943 <p>{{{parameter}}}
10944 </p>
10945 !! end
10946
10947 !! test
10948 Template with targets containing wikilinks
10949 !! wikitext
10950 {{[[foo]]}}
10951
10952 {{[[{{echo|foo}}]]}}
10953
10954 {{{{echo|[[foo}}]]}}
10955 !! html
10956 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10957 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10958 </p><p>{{[[foo}}]]
10959 </p>
10960 !! end
10961
10962 !! article
10963 Template:''
10964 !! text
10965 bar
10966 !! endarticle
10967
10968 !! test
10969 Templates: Double quotes as template target
10970 !! wikitext
10971 foo {{''}} baz
10972 !! html/php
10973 <p>foo bar baz
10974 </p>
10975 !! html/parsoid
10976 <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
10977 </p>
10978 !! end
10979
10980 ## This test is about making sure Parsoid's data-mw is well formed in the
10981 ## face of multiple templates with intersecting and overlapping ranges. The
10982 ## wikitext itself is wretched.
10983 !! test
10984 Templates with intersecting and overlapping ranges
10985 !! wikitext
10986 {|{{echo|
10987 <p>ha</p>}}
10988 {|{{echo|
10989 <p>ho</p>}}
10990 {{echo|{{!}}hi}}
10991 |}
10992 !! html/php+tidy
10993 <p>ha</p>
10994 <p>ho</p>
10995 <table>
10996 <tr>
10997 <td></td>
10998 </tr>
10999 <tr>
11000 <td>hi</td>
11001 </tr>
11002 </table>
11003 <table>
11004 <tr>
11005 <td></td>
11006 </tr>
11007 </table>
11008 !! html/parsoid
11009 <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":""}]]}'>
11010
11011 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11012
11013 <tbody><tr><td>hi</td></tr>
11014 </tbody></table>
11015 !! end
11016
11017 !! article
11018 Template:MSGNW test
11019 !! text
11020 ''None'' of '''this''' should be
11021 * interpreted
11022 but rather passed unmodified
11023 {{test}}
11024 <gallery>
11025 File:Foobar.jpg
11026 </gallery>
11027 <!-- comment -->
11028 !! endarticle
11029
11030 # hmm, fix this or just deprecate msgnw and document its behavior?
11031 !! test
11032 msgnw keyword
11033 !! wikitext
11034 {{msgnw:MSGNW test}}
11035 !! html/php
11036 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11037 &#42; interpreted
11038 &#32;but rather passed unmodified
11039 &#123;&#123;test&#125;&#125;
11040 &#60;gallery&#62;
11041 File:Foobar.jpg
11042 &#60;/gallery&#62;
11043 &#60;!-- comment --&#62;
11044 </p>
11045 !! end
11046
11047 !! test
11048 int keyword
11049 !! wikitext
11050 {{int:youhavenewmessages|lots of money|not!}}
11051 !! html
11052 <p>You have lots of money (not!).
11053 </p>
11054 !! end
11055
11056 !! test
11057 int keyword - non-existing message
11058 !! wikitext
11059 {{int:var}}
11060 !! html
11061 <p>⧼var⧽
11062 </p>
11063 !! end
11064
11065 !! article
11066 Template:Includes
11067 !! text
11068 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11069 !! endarticle
11070
11071 !! test
11072 <includeonly> and <noinclude> being included
11073 !! wikitext
11074 {{Includes}}
11075 !! html
11076 <p>Foobar
11077 </p>
11078 !! end
11079
11080 !! article
11081 Template:Includes2
11082 !! text
11083 <onlyinclude>Foo</onlyinclude>bar
11084 !! endarticle
11085
11086 !! test
11087 <onlyinclude> being included
11088 !! wikitext
11089 {{Includes2}}
11090 !! html
11091 <p>Foo
11092 </p>
11093 !! end
11094
11095
11096 !! article
11097 Template:Includes3
11098 !! text
11099 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11100 !! endarticle
11101
11102 !! test
11103 <onlyinclude> and <includeonly> being included
11104 !! wikitext
11105 {{Includes3}}
11106 !! html
11107 <p>Foo
11108 </p>
11109 !! end
11110
11111 !! test
11112 <includeonly> and <noinclude> on a page
11113 !! wikitext
11114 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11115 !! html
11116 <p>Foozar
11117 </p>
11118 !! end
11119
11120 !! test
11121 Un-closed <noinclude>
11122 !! wikitext
11123 <noinclude>
11124 !! html
11125 !! end
11126
11127 !! test
11128 <onlyinclude> on a page
11129 !! wikitext
11130 <onlyinclude>Foo</onlyinclude>bar
11131 !! html
11132 <p>Foobar
11133 </p>
11134 !! end
11135
11136 !! test
11137 Un-closed <onlyinclude>
11138 !! wikitext
11139 <onlyinclude>
11140 !! html
11141 !! end
11142
11143 !!test
11144 Self-closed noinclude, includeonly, onlyinclude tags
11145 !! wikitext
11146 <noinclude />
11147 <includeonly />
11148 <onlyinclude />
11149 !! html
11150 <p><br />
11151 </p>
11152 !!end
11153
11154 !!test
11155 Unbalanced includeonly and noinclude tags
11156 !! wikitext
11157 {|
11158 |a</noinclude>
11159 |b</noinclude></noinclude>
11160 |c</noinclude></includeonly>
11161 |d</includeonly></includeonly>
11162 |}
11163 !! html
11164 <table>
11165 <tr>
11166 <td>a
11167 </td>
11168 <td>b
11169 </td>
11170 <td>c&lt;/includeonly&gt;
11171 </td>
11172 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11173 </td></tr></table>
11174
11175 !!end
11176
11177 !! article
11178 Template:Includeonly section
11179 !! text
11180 <includeonly>
11181 ==Includeonly section==
11182 </includeonly>
11183 ==Section T-1==
11184 !!endarticle
11185
11186 !! test
11187 Bug 6563: Edit link generation for section shown by <includeonly>
11188 !! wikitext
11189 {{includeonly section}}
11190 !! html
11191 <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>
11192 <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>
11193
11194 !! end
11195
11196 # Uses same input as the contents of [[Template:Includeonly section]]
11197 !! test
11198 Bug 6563: Section extraction for section shown by <includeonly>
11199 !! options
11200 section=T-2
11201 !! wikitext
11202 <includeonly>
11203 ==Includeonly section==
11204 </includeonly>
11205 ==Section T-2==
11206 !! html
11207 ==Section T-2==
11208 !! end
11209
11210 !! test
11211 Bug 6563: Edit link generation for section suppressed by <includeonly>
11212 !! wikitext
11213 <includeonly>
11214 ==Includeonly section==
11215 </includeonly>
11216 ==Section 1==
11217 !! html
11218 <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>
11219
11220 !! end
11221
11222 !! test
11223 Bug 6563: Section extraction for section suppressed by <includeonly>
11224 !! options
11225 section=1
11226 !! wikitext
11227 <includeonly>
11228 ==Includeonly section==
11229 </includeonly>
11230 ==Section 1==
11231 !! html
11232 ==Section 1==
11233 !! end
11234
11235 !! test
11236 Un-closed <includeonly>
11237 !! wikitext
11238 <includeonly>
11239 !! html/php
11240 !! html/parsoid
11241 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11242 !! end
11243
11244 ## We used to, but no longer wt2wt this test since the default serializer
11245 ## will normalize the include directives to serialize on their own line.
11246 ## Selser will take care of preserving formatting in scenarios where they
11247 ## intermingled with other wikitext.
11248 !! test
11249 Includes and comments at SOL
11250 !! options
11251 parsoid=wt2html,html2html
11252 !! wikitext
11253 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11254
11255 <noinclude>
11256 some
11257 </noinclude>* stuff
11258 * here
11259
11260 <includeonly>can have stuff</includeonly>=== here ===
11261
11262 !! html/php
11263 <h2><span class="mw-headline" id="hu">hu</span></h2>
11264 <p>some
11265 </p>
11266 <ul><li> stuff</li>
11267 <li> here</li></ul>
11268 <h3><span class="mw-headline" id="here">here</span></h3>
11269
11270 !! html/parsoid
11271 <!-- 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>
11272
11273 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11274 <p>some</p>
11275 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11276 <li> here</li></ul>
11277
11278 <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>
11279
11280 !! end
11281
11282 # TODO: test with DOM fragment reuse!
11283 !! test
11284 Parsoid: DOM fragment reuse
11285 !! options
11286 parsoid=wt2wt,wt2html
11287 !! wikitext
11288 a{{echo|b<table></table>c}}d
11289
11290 a{{echo|b
11291 <table></table>
11292 c}}d
11293
11294 {{echo|a
11295
11296 <table></table>
11297
11298 b}}
11299 !! html
11300 <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>
11301
11302 <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">
11303 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11304 </span><p about="#mwt2">cd</p>
11305
11306 <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">
11307
11308 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11309
11310 </span><p about="#mwt3">b</p>
11311 !! end
11312
11313 !! test
11314 Parsoid: Merge double tds (T52603)
11315 !! options
11316 parsoid
11317 !! wikitext
11318 {|
11319 |{{echo|{{!}} foo}}
11320 |}
11321 !! html
11322 <table><tbody>
11323 <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>
11324 </tbody></table>
11325 !! end
11326
11327 !! test
11328 Parsoid: Merge double tds in nested transclusion content (T52603)
11329 !! options
11330 parsoid
11331 !! wikitext
11332 {{echo|<div>}}
11333 {|
11334 |{{echo|{{!}} foo}}
11335 |}
11336 {{echo|</div>}}
11337 !! html
11338 <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}}]}'>
11339 <table><tbody>
11340 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11341 </tbody></table>
11342 </div>
11343 !! end
11344
11345 ###
11346 ### <includeonly> and <noinclude> in attributes
11347 ###
11348 !!test
11349 0. includeonly around the entire attribute
11350 !! wikitext
11351 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11352 !! html
11353 <p><span id="v2">bar</span>
11354 </p>
11355 !!end
11356
11357 !!test
11358 1. includeonly in html attr key
11359 !! wikitext
11360 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11361 !! html
11362 <p><span id="foo">bar</span>
11363 </p>
11364 !!end
11365
11366 !!test
11367 2. includeonly in html attr value
11368 !! wikitext
11369 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11370 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11371 !! html
11372 <p><span id="v1">bar</span>
11373 <span id="v1">bar</span>
11374 </p>
11375 !!end
11376
11377 !!test
11378 3. includeonly in part of an attr value
11379 !! wikitext
11380 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11381 !! html
11382 <p><span style="color:red;">bar</span>
11383 </p>
11384 !!end
11385
11386 !!test
11387 4. includeonly in table attributes
11388 !! wikitext
11389 {|
11390 |- <noinclude>
11391 |-
11392 |a
11393 </noinclude>
11394 |- <includeonly>
11395 |-
11396 |b
11397 </includeonly>
11398 |}
11399 !! html
11400 <table>
11401
11402
11403 <tr>
11404 <td>a
11405 </td></tr>
11406 </table>
11407
11408 !!end
11409
11410 ###
11411 ### Token Stream Patcher tests
11412 ###
11413 ### These tests won't always pass wt2wt and other modes because
11414 ### on serialization, the table will be output on a new line.
11415 ### For now, we are blacklisting them, and using this to test selser.
11416 ###
11417
11418 !!test
11419 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11420 !!options
11421 parsoid=wt2html,wt2wt
11422 !!wikitext
11423 {{echo|}}{| width = '100%'
11424 |foo
11425 |}
11426 !!html/parsoid
11427 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11428 <tbody><tr><td>foo</td></tr>
11429 </tbody></table>
11430 !!end
11431
11432 ## We used to, but no longer wt2wt this test since the default serializer
11433 ## will normalize the include directives to serialize on their own line.
11434 ## Selser will take care of preserving formatting in scenarios where they
11435 ## intermingled with other wikitext.
11436 !!test
11437 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11438 !!options
11439 parsoid=wt2html
11440 !!wikitext
11441 <includeonly>a</includeonly>{| {{{b}}}
11442 |c
11443 |}
11444 !!html/parsoid
11445 <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":""}]]}'>
11446 <tbody><tr><td>c</td></tr>
11447 </tbody></table>
11448 !!end
11449
11450 !! test
11451 Table wikitext syntax outside wiki-tables
11452 !! wikitext
11453 a
11454 |+ not a caption
11455 ! not a table heading
11456 |- not a table row
11457 | not a table cell
11458 | class="foo bar" | baz
11459 b
11460 |}
11461 |-
11462 c
11463 !! html
11464 <p>a
11465 |+ not a caption
11466 ! not a table heading
11467 |- not a table row
11468 | not a table cell
11469 | class="foo bar" | baz
11470 b
11471 |}
11472 |-
11473 c
11474 </p>
11475 !! end
11476
11477 ###
11478 ### Testing parsing of templates where a template arg
11479 ### has the same name as the template itself.
11480 ###
11481
11482 !! article
11483 Template:quote
11484 !! text
11485 {{{quote|{{{1}}}}}}
11486 !! endarticle
11487
11488 !!test
11489 Templates: Template Name/Arg clash: 1. Use of positional param
11490 !! wikitext
11491 {{quote|foo}}
11492 !! html
11493 <p>foo
11494 </p>
11495 !!end
11496
11497 !!test
11498 Templates: Template Name/Arg clash: 2. Use of named param
11499 !! wikitext
11500 {{quote|quote=foo}}
11501 !! html
11502 <p>foo
11503 </p>
11504 !!end
11505
11506 !!test
11507 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11508 !! wikitext
11509 {{quote|quote}}
11510 !! html
11511 <p>quote
11512 </p>
11513 !!end
11514
11515 ###
11516 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11517 ###
11518
11519 !!test
11520 Templates: 1. Simple use
11521 !! wikitext
11522 {{echo|Foo}}
11523 !! html
11524 <p>Foo
11525 </p>
11526 !!end
11527
11528 !!test
11529 Templates: 2. Inside a block tag
11530 !! wikitext
11531 <div>{{echo|Foo}}</div>
11532 <blockquote>{{echo|Foo}}</blockquote>
11533 !! html
11534 <div>Foo</div>
11535 <blockquote>Foo</blockquote>
11536
11537 !! html+tidy
11538 <div>Foo</div>
11539 <blockquote>
11540 <p>Foo</p>
11541 </blockquote>
11542 !!end
11543
11544 !!test
11545 Templates: P-wrapping: 1a. Templates on consecutive lines
11546 !! wikitext
11547 {{echo|Foo}}
11548 {{echo|bar}}
11549 !! html
11550 <p>Foo
11551 bar
11552 </p>
11553 !!end
11554
11555 !!test
11556 Templates: P-wrapping: 1b. Templates on consecutive lines
11557 !! wikitext
11558 Foo
11559
11560 {{echo|bar}}
11561 {{echo|baz}}
11562 !! html
11563 <p>Foo
11564 </p><p>bar
11565 baz
11566 </p>
11567 !!end
11568
11569 !!test
11570 Templates: P-wrapping: 1c. Templates on consecutive lines
11571 !! wikitext
11572 {{echo|Foo}}
11573 {{echo|bar}} <div>baz</div>
11574 !! html
11575 <p>Foo
11576 </p>
11577 bar <div>baz</div>
11578
11579 !! html+tidy
11580 <p>Foo</p>
11581 <p>bar</p>
11582 <div>baz</div>
11583 !! end
11584
11585 !!test
11586 Templates: P-wrapping: 1d. Template preceded by comment-only line
11587 !!options
11588 parsoid
11589 !! wikitext
11590 <!-- foo -->
11591 {{echo|Bar}}
11592 !! html
11593 <!-- foo -->
11594
11595 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11596 !!end
11597
11598 !!test
11599 Templates: Inline Text: 1. Multiple template uses
11600 !! wikitext
11601 {{echo|Foo}}bar{{echo|baz}}
11602 !! html
11603 <p>Foobarbaz
11604 </p>
11605 !!end
11606
11607 !!test
11608 Templates: Inline Text: 2. Back-to-back template uses
11609 !! wikitext
11610 {{echo|Foo}}{{echo|bar}}
11611 !! html
11612 <p>Foobar
11613 </p>
11614 !!end
11615
11616 !!test
11617 Templates: Block Tags: 1. Multiple template uses
11618 !! wikitext
11619 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11620 !! html
11621 <div>Foo</div><div>bar</div><div>baz</div>
11622
11623 !!end
11624
11625 !!test
11626 Templates: Block Tags: 2. Back-to-back template uses
11627 !! wikitext
11628 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11629 !! html
11630 <div>Foo</div><div>bar</div>
11631
11632 !!end
11633
11634 # This is an edge case relating to paragraph wrapping.
11635 !!test
11636 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11637 !! wikitext
11638 {{echo|a
11639 b</p>}}
11640 !! html/parsoid
11641 <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
11642 b</p>
11643 !!end
11644
11645 !!test
11646 Templates: Links: 1. Simple example
11647 !! wikitext
11648 {{echo|[[Foo|bar]]}}
11649 !! html
11650 <p><a href="/wiki/Foo" title="Foo">bar</a>
11651 </p>
11652 !!end
11653
11654 !!test
11655 Templates: Links: 2. Generation of link href
11656 !! wikitext
11657 [[{{echo|Foo}}|bar]]
11658 !! html
11659 <p><a href="/wiki/Foo" title="Foo">bar</a>
11660 </p>
11661 !!end
11662
11663 !!test
11664 Templates: Links: 3. Generation of part of a link href
11665 !! wikitext
11666 [[Fo{{echo|o}}|bar]]
11667
11668 [[Foo{{echo|bar}}]]
11669
11670 [[Foo{{echo|bar}}baz]]
11671
11672 [[Foo{{echo|bar}}|bar]]
11673
11674 [[:Foo{{echo|bar}}]]
11675
11676 [[:Foo{{echo|bar}}|bar]]
11677 !! html
11678 <p><a href="/wiki/Foo" title="Foo">bar</a>
11679 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11680 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11681 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11682 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11683 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11684 </p>
11685 !!end
11686
11687 !!test
11688 Templates: Links: 4. Multiple templates generating link href
11689 !! wikitext
11690 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11691 !! html
11692 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11693 </p>
11694 !!end
11695
11696 !!test
11697 Templates: Links: 5. Generation of link text
11698 !! wikitext
11699 [[Foo|{{echo|bar}}]]
11700 !! html
11701 <p><a href="/wiki/Foo" title="Foo">bar</a>
11702 </p>
11703 !!end
11704
11705 !!test
11706 Templates: Links: 5. Nested templates (only outermost template should be marked)
11707 !! wikitext
11708 {{echo|[[{{echo|Foo}}|bar]]}}
11709 !! html
11710 <p><a href="/wiki/Foo" title="Foo">bar</a>
11711 </p>
11712 !!end
11713
11714 !!test
11715 Templates: HTML Tag: 1. Generation of HTML attr. key
11716 !! wikitext
11717 <div {{echo|style}}="color:red;">foo</div>
11718 !! html
11719 <div style="color:red;">foo</div>
11720
11721 !!end
11722
11723 !!test
11724 Templates: HTML Tag: 2. Generation of HTML attr. value
11725 !! wikitext
11726 <div style={{echo|'color:red;'}}>foo</div>
11727 !! html
11728 <div style="color:red;">foo</div>
11729
11730 !!end
11731
11732 !!test
11733 Templates: HTML Tag: 3. Generation of HTML attr key and value
11734 !! wikitext
11735 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11736 !! html
11737 <div style="color:red;">foo</div>
11738
11739 !!end
11740
11741 !!test
11742 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11743 !! wikitext
11744 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11745 !! html
11746 <div title="This is a long title with just one piece templated">foo</div>
11747
11748 !!end
11749
11750 !!test
11751 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11752 !! wikitext
11753 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11754 !! html
11755 <div title="This is a long title with just one piece templated">foo</div>
11756
11757 !!end
11758
11759 !!test
11760 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11761 !! wikitext
11762 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11763 !! html
11764 <div title="This is a long title with just one piece templated">foo</div>
11765
11766 !!end
11767
11768 # SSS FIXME: While it is great we added support for all this,
11769 # do we want to make this part of the spec? Maybe we want to
11770 # deprecate this kind of usage in the future?
11771 !!test
11772 Templates: HTML Tag: 7. Generation of partial attribute key string
11773 !! wikitext
11774 <div st{{echo|yle}}="color:red;">foo</div>
11775 !! html
11776 <div style="color:red;">foo</div>
11777
11778 !!end
11779
11780 !! test
11781 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11782 !! wikitext
11783 <div {{echo|1=id="v1"}}>bar</div>
11784 !! html
11785 <div id="v1">bar</div>
11786
11787 !!end
11788
11789 !! test
11790 Templates: HTML Tag: 9. Multiple template-generated attributes
11791 !! wikitext
11792 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11793 !! html
11794 <div id="v1" title="foo">bar</div>
11795
11796 !!end
11797
11798 !! test
11799 Templates: Support for templates generating attributes and content
11800 !! wikitext
11801 {| {{mixed_attr_content_template}}
11802 |-
11803 |bar
11804 |}
11805 !! html/php
11806 <table style="color:red;" title="T48811">
11807
11808 <tr>
11809 <td>foo
11810 </td></tr>
11811 <tr>
11812 <td>bar
11813 </td></tr></table>
11814
11815 !! html/parsoid
11816 <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|}"]}'>
11817 <tbody><tr>
11818 <td>foo</td></tr>
11819 <tr>
11820 <td>bar</td></tr>
11821 </tbody></table>
11822 !!end
11823
11824 !! test
11825 1. Entities and nowikis inside templated attributes should be handled correctly
11826 !! wikitext
11827 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11828 !! html/php
11829 <div style="background:#f9f9f9;">foo</div>
11830
11831 !! html/parsoid
11832 <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>
11833 !! end
11834
11835 !! test
11836 2. Entities and nowikis inside templated attributes should be handled correctly
11837 !! wikitext
11838 {|
11839 |{{table_attribs_3}}
11840 |}
11841 !! html/php
11842 <table>
11843 <tr>
11844 <td style="background:#f9f9f9;">Foo
11845 </td></tr></table>
11846
11847 !! html/parsoid
11848 <table>
11849 <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>
11850 </tbody></table>
11851 !! end
11852
11853 !! test
11854 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11855 !! wikitext
11856 {{tbl-start}}
11857 |{{table_attribs_3}}
11858 {{tbl-end}}
11859 !! html/php
11860 <table>
11861 <tr>
11862 <td style="background:#f9f9f9;">Foo
11863 </td></tr></table>
11864
11865 !! html/parsoid
11866 <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}}]}'>
11867 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11868 </tbody></table>
11869 !! end
11870
11871 # T107622
11872 !! test
11873 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11874 !! wikitext
11875 {|
11876 | {{table_attribs_6}} hi
11877 |}
11878 !! html/php
11879 <table>
11880 <tr>
11881 <td style="background: red;"> hi
11882 </td></tr></table>
11883
11884 !! html/parsoid
11885 <table>
11886 <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>
11887 </tbody></table>
11888 !! end
11889
11890 !!test
11891 Templates: HTML Tables: 1. Generating start of a HTML table
11892 !! wikitext
11893 {{echo|<table><tr><td>foo</td>}}</tr></table>
11894 !! html
11895 <table><tr><td>foo</td></tr></table>
11896
11897 !!end
11898
11899 !!test
11900 Templates: HTML Tables: 2a. Generating middle of a HTML table
11901 !! wikitext
11902 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11903 !! html
11904 <table><tr><td>foo</td></tr></table>
11905
11906 !!end
11907
11908 !!test
11909 Templates: HTML Tables: 2b. Generating middle of a HTML table
11910 !! wikitext
11911 <table>{{echo|<tr><td>foo</td></tr>}}</table>
11912 !! html
11913 <table><tr><td>foo</td></tr></table>
11914
11915 !!end
11916
11917 !!test
11918 Templates: HTML Tables: 3. Generating end of a HTML table
11919 !! wikitext
11920 <table><tr>{{echo|<td>foo</td></tr></table>}}
11921 !! html
11922 <table><tr><td>foo</td></tr></table>
11923
11924 !!end
11925
11926 !!test
11927 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
11928 !! wikitext
11929 {{echo|<table>}}<tr><td>foo</td></tr></table>
11930 !! html
11931 <table><tr><td>foo</td></tr></table>
11932
11933 !!end
11934
11935 !!test
11936 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
11937 !! wikitext
11938 <table>{{echo|<tr>}}<td>foo</td></tr></table>
11939 !! html
11940 <table><tr><td>foo</td></tr></table>
11941
11942 !!end
11943
11944 !!test
11945 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
11946 !! wikitext
11947 <table><tr>{{echo|<td>}}foo</td></tr></table>
11948 !! html
11949 <table><tr><td>foo</td></tr></table>
11950
11951 !!end
11952
11953 !!test
11954 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
11955 !! wikitext
11956 <table><tr><td>foo{{echo|</td>}}</tr></table>
11957 !! html
11958 <table><tr><td>foo</td></tr></table>
11959
11960 !!end
11961
11962 !!test
11963 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
11964 !! wikitext
11965 <table><tr><td>foo</td>{{echo|</tr>}}</table>
11966 !! html
11967 <table><tr><td>foo</td></tr></table>
11968
11969 !!end
11970
11971 !!test
11972 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
11973 !! wikitext
11974 <table><tr><td>foo</td></tr>{{echo|</table>}}
11975 !! html
11976 <table><tr><td>foo</td></tr></table>
11977
11978 !!end
11979
11980 !!test
11981 Templates: HTML Tables: 5. Proper fostering of categories from inside
11982 !!options
11983 parsoid=wt2html,wt2wt
11984 !! wikitext
11985 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
11986 <!--Two categories (Bug 50330)-->
11987 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
11988 !! html
11989 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
11990 <!--Two categories (Bug 50330)-->
11991 <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>
11992 !!end
11993
11994 !!test
11995 Templates: Wiki Tables: 1a. Fostering of entire template content
11996 !! wikitext
11997 {|
11998 {{echo|a}}
11999 |}
12000 !! html
12001 <table>
12002 a
12003 <tr><td></td></tr></table>
12004
12005 !! html+tidy
12006 <p>a</p>
12007 <table>
12008 <tr>
12009 <td></td>
12010 </tr>
12011 </table>
12012 !! end
12013
12014 !!test
12015 Templates: Wiki Tables: 1b. Fostering of entire template content
12016 !! wikitext
12017 {|
12018 {{echo|<div>}}
12019 foo
12020 {{echo|</div>}}
12021 |}
12022 !! html
12023 <table>
12024 <div>
12025 <p>foo
12026 </p>
12027 </div>
12028 <tr><td></td></tr></table>
12029
12030 !! html+tidy
12031 <div>
12032 <p>foo</p>
12033 </div>
12034 <table>
12035 <tr>
12036 <td></td>
12037 </tr>
12038 </table>
12039 !! end
12040
12041 !!test
12042 Templates: Wiki Tables: 2. Fostering of partial template content
12043 !! wikitext
12044 {|
12045 {{echo|a
12046 <div>b</div>}}
12047 |}
12048 !! html
12049 <table>
12050 a
12051 <div>b</div>
12052 <tr><td></td></tr></table>
12053
12054 !! html+tidy
12055 <p>a</p>
12056 <div>b</div>
12057 <table>
12058 <tr>
12059 <td></td>
12060 </tr>
12061 </table>
12062 !! end
12063
12064 !!test
12065 Templates: Wiki Tables: 3. td-content via multiple templates
12066 !! wikitext
12067 {|
12068 {{echo|{{pipe}}a}}{{echo|b}}
12069 |}
12070 !! html
12071 <table>
12072 <tr>
12073 <td>ab
12074 </td></tr></table>
12075
12076 !!end
12077
12078 !!test
12079 Templates: Wiki Tables: 4. Templated tags, no content
12080 !! wikitext
12081 {{tbl-start}}
12082 {{tbl-end}}
12083 !! html
12084 <table>
12085 <tr><td></td></tr></table>
12086
12087 !!end
12088
12089 !!test
12090 Templates: Wiki Tables: 5. Templated tags, regular td-tags
12091 !! wikitext
12092 {{tbl-start}}
12093 |foo
12094 {{tbl-end}}
12095 !! html
12096 <table>
12097 <tr>
12098 <td>foo
12099 </td></tr></table>
12100
12101 !!end
12102
12103 !!test
12104 Templates: Wiki Tables: 6. Templated tags, templated td-tags
12105 !! wikitext
12106 {{tbl-start}}
12107 {{!}}foo
12108 {{tbl-end}}
12109 !! html
12110 <table>
12111 <tr>
12112 <td>foo
12113 </td></tr></table>
12114
12115 !!end
12116
12117 ## This test case is very specific to Parsoid's internals
12118 ## and is hence only tested for Parsoid's code. Parsoid uses
12119 ## a <meta> marker tag for <ref> tags and they are expanded
12120 ## much later. We are verifying that this <meta> tag usage
12121 ## doesn't prevent foster parenting.
12122 !!test
12123 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
12124 !!wikitext
12125 {{PartialTable}}<ref>foo</ref>
12126 |}
12127
12128 <references />
12129 !!html/parsoid
12130 <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">
12131 <tbody>
12132 </tbody></table>
12133
12134 <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>
12135 !!end
12136
12137 !! test
12138 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
12139 !! wikitext
12140 {{echo|
12141 {{{!}}
12142 {{!}}-}}
12143 <onlyinclude>
12144 |foo
12145 </onlyinclude>
12146 {{!}}}
12147 !! html/parsoid
12148 <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{{!}}}"]}'>
12149 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
12150 <tbody><tr>
12151
12152 <td>foo
12153 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
12154 </tbody></table>
12155 !! end
12156
12157 !!test
12158 Templates: Lists: Multi-line list-items via templates
12159 !! wikitext
12160 *{{echo|a {{nonexistent|
12161 unused}}}}
12162 *{{echo|b {{nonexistent|
12163 unused}}}}
12164 !! html
12165 <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>
12166 <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>
12167
12168 !!end
12169
12170 !!test
12171 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
12172 !! wikitext
12173 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
12174 !! html
12175 <p><i>ab</i>c<i>d</i>e
12176 </p>
12177 !!end
12178
12179 !!test
12180 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
12181 (PHP parser generates misnested html)
12182 !! wikitext
12183 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
12184 !! html/parsoid
12185 <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>
12186 !!end
12187
12188 !!test
12189 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
12190 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
12191 !! options
12192 parsoid=wt2html,wt2wt
12193 !! wikitext
12194 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
12195 !! html
12196 <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>
12197 <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>
12198 <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>
12199 !!end
12200
12201 !!test
12202 Templates: Ugly nesting: 4. Divs opened/closed across templates
12203 !! wikitext
12204 a<div>b{{echo|c</div>d}}e
12205 !! html
12206 a<div>bc</div>de
12207
12208 !! html+tidy
12209 <p>a</p>
12210 <div>bc</div>
12211 <p>de</p>
12212 !! end
12213
12214 !!test
12215 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
12216 (Parsoid-centric)
12217 !! options
12218 parsoid
12219 !! wikitext
12220 {|
12221 |{{echo|foo</table>}}
12222 |bar
12223 |}
12224 !! html
12225 <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|}"]}'>
12226
12227 <tbody>
12228 <tr>
12229 <td>foo</td></tr></tbody></table><span about="#mwt1">
12230 </span><span about="#mwt1">|bar</span><span about="#mwt1">
12231 |}</span>
12232 !!end
12233
12234 !!test
12235 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
12236 (Parsoid-centric)
12237 !! options
12238 parsoid
12239 !! wikitext
12240 <table>
12241 <tr>
12242 <td>
12243 <table>
12244 <tr>
12245 <td>1. {{echo|foo </table>}}</td>
12246 <td> bar </td>
12247 <td>2. {{echo|baz </table>}}</td>
12248 </tr>
12249 <tr>
12250 <td>abc</td>
12251 </tr>
12252 </table>
12253 </td>
12254 </tr>
12255 <tr>
12256 <td>xyz</td>
12257 </tr>
12258 </table>
12259 !! html
12260 <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>"]}'>
12261 <tbody><tr>
12262 <td>
12263 <table>
12264 <tbody><tr>
12265 <td>1. foo </td></tr></tbody></table></td>
12266 <td> bar </td>
12267 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
12268 </span><span about="#mwt2">
12269 </span><span about="#mwt2">
12270 </span><span about="#mwt2">abc</span><span about="#mwt2">
12271 </span><span about="#mwt2">
12272 </span><span about="#mwt2">
12273 </span><span about="#mwt2">
12274 </span><span about="#mwt2">
12275 </span><span about="#mwt2">
12276 </span><span about="#mwt2">xyz</span><span about="#mwt2">
12277 </span><span about="#mwt2">
12278 </span>
12279 !!end
12280
12281 !! test
12282 Templates: Ugly templates: 3. newline-only template parameter
12283 !! wikitext
12284 foo {{echo|
12285 }}
12286 !! html
12287 <p>foo
12288 </p>
12289 !! end
12290
12291 # This looks like a bug: a single newline triggers p/br for some reason.
12292 !! test
12293 Templates: Ugly templates: 4. newline-only template parameter inconsistency
12294 !! wikitext
12295 {{echo|
12296 }}
12297 !! html
12298 <p><br />
12299 </p>
12300 !! end
12301
12302 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
12303 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12304 !! test
12305 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12306 !! wikitext
12307 {{echo|<table>}}
12308 {{echo|<div>foo}}
12309 {{echo|</table>}}
12310 !! html/parsoid
12311 <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
12312 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12313 </table>
12314 !! end
12315
12316 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
12317 # that are "identical" and generate nesting cycles in the algorithm
12318 !! test
12319 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12320 !! wikitext
12321 {{echo|<table><tr><td><table>}}
12322 {{echo|<div>}}
12323 {{echo|</div>}}
12324 !! html/parsoid
12325 <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"}'>
12326 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12327 </table></td></tr></tbody></table>
12328 !! end
12329
12330 !! test
12331 Templates: Parameters substituted at the top-level
12332 !! wikitext
12333 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12334 !! html/php
12335 <p><i>who</i> me? <b>never!</b>
12336 </p>
12337 !! html/parsoid
12338 <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>
12339 !! end
12340
12341 !!test
12342 Parser Functions: 1. Simple example
12343 !! wikitext
12344 {{uc:foo}}
12345 !! html
12346 <p>FOO
12347 </p>
12348 !!end
12349
12350 !!test
12351 Parser Functions: 2. Nested use (only outermost should be marked up)
12352 !! wikitext
12353 {{uc:{{lc:FOO}}}}
12354 !! html
12355 <p>FOO
12356 </p>
12357 !!end
12358
12359 ###
12360 ### Pre-save transform tests
12361 ###
12362 !! test
12363 pre-save transform: subst:
12364 !! options
12365 pst
12366 !! wikitext
12367 {{subst:test}}
12368 !! html/php
12369 This is a test template
12370 !! end
12371
12372 !! test
12373 pre-save transform: normal template
12374 !! options
12375 pst
12376 !! wikitext
12377 {{test}}
12378 !! html/php
12379 {{test}}
12380 !! end
12381
12382 !! test
12383 pre-save transform: nonexistent template
12384 !! options
12385 pst
12386 !! wikitext
12387 {{thistemplatedoesnotexist}}
12388 !! html/php
12389 {{thistemplatedoesnotexist}}
12390 !! end
12391
12392 !! test
12393 pre-save transform: subst magic variables
12394 !! options
12395 pst
12396 !! wikitext
12397 {{subst:SITENAME}}
12398 !! html/php
12399 MediaWiki
12400 !! end
12401
12402 # This is bug 89, which I fixed. -- wtm
12403 !! test
12404 pre-save transform: subst: templates with parameters
12405 !! options
12406 pst
12407 !! wikitext
12408 {{subst:paramtest|param="something else"}}
12409 !! html/php
12410 This is a test template with parameter "something else"
12411 !! end
12412
12413 !! article
12414 Template:nowikitest
12415 !! text
12416 <nowiki>'''not wiki'''</nowiki>
12417 !! endarticle
12418
12419 !! test
12420 pre-save transform: nowiki in subst (bug 1188)
12421 !! options
12422 pst
12423 !! wikitext
12424 {{subst:nowikitest}}
12425 !! html/php
12426 <nowiki>'''not wiki'''</nowiki>
12427 !! end
12428
12429 !! article
12430 Template:commenttest
12431 !! text
12432 This template has <!-- a comment --> in it.
12433 !! endarticle
12434
12435 !! test
12436 pre-save transform: comment in subst (bug 1936)
12437 !! options
12438 pst
12439 !! wikitext
12440 {{subst:commenttest}}
12441 !! html/php
12442 This template has <!-- a comment --> in it.
12443 !! end
12444
12445 !! test
12446 pre-save transform: unclosed tag
12447 !! options
12448 pst
12449 !! wikitext
12450 <nowiki>'''not wiki'''
12451 !! html/php
12452 <nowiki>'''not wiki'''
12453 !! end
12454
12455 !! test
12456 pre-save transform: mixed tag case
12457 !! options
12458 pst
12459 !! wikitext
12460 <NOwiki>'''not wiki'''</noWIKI>
12461 !! html/php
12462 <NOwiki>'''not wiki'''</noWIKI>
12463 !! end
12464
12465 !! test
12466 pre-save transform: unclosed comment in <nowiki>
12467 !! options
12468 pst
12469 !! wikitext
12470 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12471 !! html/php
12472 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12473 !!end
12474
12475 # Leading @ in this template definition works around a limitation
12476 # in parsoid's parserTests which otherwise strips the <span> from the
12477 # result (confusing it for a template wrapper)
12478 !! article
12479 Template:dangerous
12480 !!text
12481 @<span onmouseover="alert('crap')">Oh no</span>
12482 !!endarticle
12483
12484 !!test
12485 (confirming safety of fix for subst bug 1936)
12486 !! wikitext
12487 {{Template:dangerous}}
12488 !! html
12489 <p>@<span>Oh no</span>
12490 </p>
12491 !! end
12492
12493 !! test
12494 pre-save transform: comment containing gallery (bug 5024)
12495 !! options
12496 pst
12497 !! wikitext
12498 <!-- <gallery>data</gallery> -->
12499 !! html/php
12500 <!-- <gallery>data</gallery> -->
12501 !!end
12502
12503 !! test
12504 pre-save transform: comment containing extension
12505 !! options
12506 pst
12507 !! wikitext
12508 <!-- <tag>data</tag> -->
12509 !! html/php
12510 <!-- <tag>data</tag> -->
12511 !!end
12512
12513 !! test
12514 pre-save transform: comment containing nowiki
12515 !! options
12516 pst
12517 !! wikitext
12518 <!-- <nowiki>data</nowiki> -->
12519 !! html/php
12520 <!-- <nowiki>data</nowiki> -->
12521 !!end
12522
12523 !! test
12524 pre-save transform: <noinclude> in subst (bug 3298)
12525 !! options
12526 pst
12527 !! wikitext
12528 {{subst:Includes}}
12529 !! html/php
12530 Foobar
12531 !! end
12532
12533 !! test
12534 pre-save transform: <onlyinclude> in subst (bug 3298)
12535 !! options
12536 pst
12537 !! wikitext
12538 {{subst:Includes2}}
12539 !! html/php
12540 Foo
12541 !! end
12542
12543 !! article
12544 Template:SubstTest
12545 !!text
12546 {{<includeonly>subst:</includeonly>Includes}}
12547 !! endarticle
12548
12549 !! article
12550 Template:SafeSubstTest
12551 !! text
12552 {{<includeonly>safesubst:</includeonly>Includes}}
12553 !! endarticle
12554
12555 !! test
12556 bug 22297: safesubst: works during PST
12557 !! options
12558 pst
12559 !! wikitext
12560 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12561 !! html/php
12562 FoobarFoobar
12563 !! end
12564
12565 !! test
12566 bug 22297: safesubst: works during normal parse
12567 !! wikitext
12568 {{SafeSubstTest}}
12569 !! html
12570 <p>Foobar
12571 </p>
12572 !! end
12573
12574 !! test
12575 subst: does not work during normal parse
12576 !! wikitext
12577 {{SubstTest}}
12578 !! html
12579 <p>{{subst:Includes}}
12580 </p>
12581 !! end
12582
12583 !! test
12584 pre-save transform: context links ("pipe trick")
12585 !! options
12586 pst
12587 !! wikitext
12588 [[Article (context)|]]
12589 [[Bar:Article|]]
12590 [[:Bar:Article|]]
12591 [[Bar:Article (context)|]]
12592 [[:Bar:Article (context)|]]
12593 [[|Article]]
12594 [[|Article (context)]]
12595 [[Bar:X (Y) Z|]]
12596 [[:Bar:X (Y) Z|]]
12597 !! html/php
12598 [[Article (context)|Article]]
12599 [[Bar:Article|Article]]
12600 [[:Bar:Article|Article]]
12601 [[Bar:Article (context)|Article]]
12602 [[:Bar:Article (context)|Article]]
12603 [[Article]]
12604 [[Article (context)]]
12605 [[Bar:X (Y) Z|X (Y) Z]]
12606 [[:Bar:X (Y) Z|X (Y) Z]]
12607 !! end
12608
12609 !! test
12610 pre-save transform: context links ("pipe trick") with interwiki prefix
12611 !! options
12612 pst
12613 !! wikitext
12614 [[interwiki:Article|]]
12615 [[:interwiki:Article|]]
12616 [[interwiki:Bar:Article|]]
12617 [[:interwiki:Bar:Article|]]
12618 !! html/php
12619 [[interwiki:Article|Article]]
12620 [[:interwiki:Article|Article]]
12621 [[interwiki:Bar:Article|Bar:Article]]
12622 [[:interwiki:Bar:Article|Bar:Article]]
12623 !! end
12624
12625 !! test
12626 pre-save transform: context links ("pipe trick") with parens in title
12627 !! options
12628 pst title=[[Somearticle (context)]]
12629 !! wikitext
12630 [[|Article]]
12631 !! html/php
12632 [[Article (context)|Article]]
12633 !! end
12634
12635 !! test
12636 pre-save transform: context links ("pipe trick") with comma in title
12637 !! options
12638 pst title=[[Someplace, Somewhere]]
12639 !! wikitext
12640 [[|Otherplace]]
12641 [[Otherplace, Elsewhere|]]
12642 [[Otherplace, Elsewhere, Anywhere|]]
12643 !! html/php
12644 [[Otherplace, Somewhere|Otherplace]]
12645 [[Otherplace, Elsewhere|Otherplace]]
12646 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12647 !! end
12648
12649 !! test
12650 pre-save transform: context links ("pipe trick") with parens and comma
12651 !! options
12652 pst title=[[Someplace (IGNORED), Somewhere]]
12653 !! wikitext
12654 [[|Otherplace]]
12655 [[Otherplace (place), Elsewhere|]]
12656 !! html/php
12657 [[Otherplace, Somewhere|Otherplace]]
12658 [[Otherplace (place), Elsewhere|Otherplace]]
12659 !! end
12660
12661 !! test
12662 pre-save transform: context links ("pipe trick") with comma and parens
12663 !! options
12664 pst title=[[Who, me? (context)]]
12665 !! wikitext
12666 [[|Yes, you.]]
12667 [[Me, Myself, and I (1937 song)|]]
12668 !! html/php
12669 [[Yes, you. (context)|Yes, you.]]
12670 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12671 !! end
12672
12673 !! test
12674 pre-save transform: context links ("pipe trick") with namespace
12675 !! options
12676 pst title=[[Ns:Somearticle]]
12677 !! wikitext
12678 [[|Article]]
12679 !! html/php
12680 [[Ns:Article|Article]]
12681 !! end
12682
12683 !! test
12684 pre-save transform: context links ("pipe trick") with namespace and parens
12685 !! options
12686 pst title=[[Ns:Somearticle (context)]]
12687 !! wikitext
12688 [[|Article]]
12689 !! html/php
12690 [[Ns:Article (context)|Article]]
12691 !! end
12692
12693 !! test
12694 pre-save transform: context links ("pipe trick") with namespace and comma
12695 !! options
12696 pst title=[[Ns:Somearticle, Context, Whatever]]
12697 !! wikitext
12698 [[|Article]]
12699 !! html/php
12700 [[Ns:Article, Context, Whatever|Article]]
12701 !! end
12702
12703 !! test
12704 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12705 !! options
12706 pst title=[[Ns:Somearticle, Context (context)]]
12707 !! wikitext
12708 [[|Article]]
12709 !! html/php
12710 [[Ns:Article (context)|Article]]
12711 !! end
12712
12713 !! test
12714 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12715 !! options
12716 pst title=[[Ns:Somearticle (IGNORED), Context]]
12717 !! wikitext
12718 [[|Article]]
12719 !! html/php
12720 [[Ns:Article, Context|Article]]
12721 !! end
12722
12723 !! test
12724 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12725 !! options
12726 pst
12727 !! wikitext
12728 [[Article(context)|]]
12729 [[Bar:Article(context)|]]
12730 [[:Bar:Article(context)|]]
12731 [[|Article(context)]]
12732 [[Bar:X(Y)Z|]]
12733 [[:Bar:X(Y)Z|]]
12734 !! html/php
12735 [[Article(context)|Article]]
12736 [[Bar:Article(context)|Article]]
12737 [[:Bar:Article(context)|Article]]
12738 [[Article(context)]]
12739 [[Bar:X(Y)Z|X(Y)Z]]
12740 [[:Bar:X(Y)Z|X(Y)Z]]
12741 !! end
12742
12743 !! test
12744 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12745 !! options
12746 pst
12747 !! wikitext
12748 [[Article (context)|]]
12749 [[Bar:Article (context)|]]
12750 [[:Bar:Article (context)|]]
12751 [[|Article (context)]]
12752 [[Bar:X (Y) Z|]]
12753 [[:Bar:X (Y) Z|]]
12754 !! html/php
12755 [[Article (context)|Article]]
12756 [[Bar:Article (context)|Article]]
12757 [[:Bar:Article (context)|Article]]
12758 [[Article (context)]]
12759 [[Bar:X (Y) Z|X (Y) Z]]
12760 [[:Bar:X (Y) Z|X (Y) Z]]
12761 !! end
12762
12763 !! test
12764 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12765 !! options
12766 pst
12767 !! wikitext
12768 [[Article(context)|]]
12769 [[Bar:Article(context)|]]
12770 [[:Bar:Article(context)|]]
12771 [[|Article(context)]]
12772 [[Bar:X(Y)Z|]]
12773 [[:Bar:X(Y)Z|]]
12774 !! html/php
12775 [[Article(context)|Article]]
12776 [[Bar:Article(context)|Article]]
12777 [[:Bar:Article(context)|Article]]
12778 [[Article(context)]]
12779 [[Bar:X(Y)Z|X(Y)Z]]
12780 [[:Bar:X(Y)Z|X(Y)Z]]
12781 !! end
12782
12783 !! test
12784 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12785 !! options
12786 pst
12787 !! wikitext
12788 [[Article (context), context|]]
12789 [[Article (context),context|]]
12790 [[Bar:Article (context), context|]]
12791 [[Bar:Article (context),context|]]
12792 [[:Bar:Article (context), context|]]
12793 [[:Bar:Article (context),context|]]
12794 !! html/php
12795 [[Article (context), context|Article]]
12796 [[Article (context),context|Article]]
12797 [[Bar:Article (context), context|Article]]
12798 [[Bar:Article (context),context|Article]]
12799 [[:Bar:Article (context), context|Article]]
12800 [[:Bar:Article (context),context|Article]]
12801 !! end
12802
12803 !! test
12804 pre-save transform: trim trailing empty lines
12805 !! options
12806 pst
12807 !! wikitext
12808 Empty lines are trimmed
12809
12810
12811
12812
12813 !! html/php
12814 Empty lines are trimmed
12815 !! end
12816
12817 !! test
12818 pre-save transform: Signature expansion
12819 !! options
12820 pst
12821 !! wikitext
12822 * ~~~
12823 * <noinclude>~~~</noinclude>
12824 * <includeonly>~~~</includeonly>
12825 * <onlyinclude>~~~</onlyinclude>
12826 !! html/php
12827 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12828 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12829 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12830 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12831 !! end
12832
12833
12834 !! test
12835 pre-save transform: Signature expansion in nowiki tags (bug 93)
12836 !! options
12837 pst disabled
12838 !! wikitext
12839 Shall not expand:
12840
12841 <nowiki>~~~~</nowiki>
12842
12843 <includeonly><nowiki>~~~~</nowiki></includeonly>
12844
12845 <noinclude><nowiki>~~~~</nowiki></noinclude>
12846
12847 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12848
12849 {{subst:Foo}} shall be converted to FOO
12850
12851 As well as inside noinclude/onlyinclude
12852 <noinclude>{{subst:Foo}}</noinclude>
12853 <onlyinclude>{{subst:Foo}}</onlyinclude>
12854
12855 But not inside includeonly
12856 <includeonly>{{subst:Foo}}</includeonly>
12857 !! html/php
12858 Shall not expand:
12859
12860 <nowiki>~~~~</nowiki>
12861
12862 <includeonly><nowiki>~~~~</nowiki></includeonly>
12863
12864 <noinclude><nowiki>~~~~</nowiki></noinclude>
12865
12866 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12867
12868 FOO shall be converted to FOO
12869
12870 As well as inside noinclude/onlyinclude
12871 <noinclude>FOO</noinclude>
12872 <onlyinclude>FOO</onlyinclude>
12873
12874 But not inside includeonly
12875 <includeonly>{{subst:Foo}}</includeonly>
12876 !! end
12877
12878 !! test
12879 Parsoid: Recognize nowiki with trailing space in tags
12880 !! options
12881 parsoid=wt2html
12882 !! wikitext
12883 <nowiki ><div>[[foo]]</nowiki >
12884
12885 a<nowiki / >b
12886
12887 c<nowiki />d
12888
12889 e<nowiki/ >f
12890 !! html
12891 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12892 <p>ab</p>
12893 <p>cd</p>
12894 <p>ef</p>
12895 !! end
12896
12897 !! test
12898 Parsoid: Recognize nowiki with odd capitalization
12899 !! options
12900 parsoid=wt2html
12901 !! wikitext
12902 <noWikI ><div>[[foo]]</Nowiki >
12903 !! html
12904 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12905 !! end
12906
12907
12908 !! test
12909 Parsoid: Escape nowiki with trailing space in tags
12910 !! options
12911 parsoid=html2wt
12912 !! html/parsoid
12913 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12914 <p>a&lt;nowiki /&gt;b</p>
12915 <p>c&lt;nowiki/ &gt;d</p>
12916 !! wikitext
12917 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12918
12919 a&lt;nowiki /&gt;b
12920
12921 c&lt;nowiki/ &gt;d
12922 !! end
12923
12924 !! test
12925 Parsoid: Escape weird noWikI capitalizations
12926 !! options
12927 parsoid=html2wt
12928 !! html/parsoid
12929 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
12930 !! wikitext
12931 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
12932 !! end
12933
12934 ###
12935 ### Message transform tests
12936 ###
12937 !! test
12938 message transform: magic variables
12939 !! options
12940 msg
12941 !! wikitext
12942 {{SITENAME}}
12943 !! html
12944 MediaWiki
12945 !! end
12946
12947 !! test
12948 message transform: should not transform wiki markup
12949 !! options
12950 msg
12951 !! wikitext
12952 ''test''
12953 !! html
12954 ''test''
12955 !! end
12956
12957 !! test
12958 message transform: <noinclude> in transcluded template (bug 4926)
12959 !! options
12960 msg
12961 !! wikitext
12962 {{Includes}}
12963 !! html
12964 Foobar
12965 !! end
12966
12967 !! test
12968 message transform: <onlyinclude> in transcluded template (bug 4926)
12969 !! options
12970 msg
12971 !! wikitext
12972 {{Includes2}}
12973 !! html
12974 Foo
12975 !! end
12976
12977 !! test
12978 {{#special:}} page name, known
12979 !! options
12980 msg
12981 !! wikitext
12982 {{#special:Recentchanges}}
12983 !! html
12984 Special:RecentChanges
12985 !! end
12986
12987 !! test
12988 {{#special:}} page name with subpage, known
12989 !! options
12990 msg
12991 !! wikitext
12992 {{#special:Recentchanges/param}}
12993 !! html
12994 Special:RecentChanges/param
12995 !! end
12996
12997 !! test
12998 {{#special:}} page name, unknown
12999 !! options
13000 msg
13001 !! wikitext
13002 {{#special:foobar nonexistent}}
13003 !! html
13004 Special:Foobar nonexistent
13005 !! end
13006
13007 !! test
13008 {{#speciale:}} page name, known
13009 !! options
13010 msg
13011 !! wikitext
13012 {{#speciale:Recentchanges}}
13013 !! html
13014 Special:RecentChanges
13015 !! end
13016
13017 !! test
13018 {{#speciale:}} page name with subpage, known
13019 !! options
13020 msg
13021 !! wikitext
13022 {{#speciale:Recentchanges/param}}
13023 !! html
13024 Special:RecentChanges/param
13025 !! end
13026
13027 !! test
13028 {{#speciale:}} page name, unknown
13029 !! options
13030 msg
13031 !! wikitext
13032 {{#speciale:foobar nonexistent}}
13033 !! html
13034 Special:Foobar_nonexistent
13035 !! end
13036
13037 ###
13038 ### Images
13039 ###
13040 ### For Parsoid-specific tests, see
13041 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13042
13043 !! test
13044 Simple image
13045 !! options
13046 parsoid=wt2html,wt2wt,html2html
13047 !! wikitext
13048 [[Image:foobar.jpg]]
13049 !! html/php
13050 <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>
13051 </p>
13052 !! html/parsoid
13053 <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>
13054 !! end
13055
13056 !! test
13057 Simple image (using File: namespace, now canonical)
13058 !! wikitext
13059 [[File:Foobar.jpg]]
13060 !! html/php
13061 <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>
13062 </p>
13063 !! html/parsoid
13064 <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>
13065 !! end
13066
13067 !! test
13068 Right-aligned image
13069 !! wikitext
13070 [[File:Foobar.jpg|right]]
13071 !! html/php
13072 <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>
13073
13074 !! html/parsoid
13075 <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>
13076 !! end
13077
13078 !! test
13079 Image with caption
13080 !! wikitext
13081 [[File:Foobar.jpg|right|Caption text]]
13082 !! html/php
13083 <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>
13084
13085 !! html/parsoid
13086 <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>
13087 !! end
13088
13089 !! test
13090 Image with caption, bug 53312 #1
13091 !! wikitext
13092 [[File:Foobar.jpg|right|Caption page stuff]]
13093 !! html/php
13094 <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>
13095
13096 !! html/parsoid
13097 <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>
13098 !! end
13099
13100 !! test
13101 Image with caption, bug 53312 #2
13102 !! wikitext
13103 [[File:Foobar.jpg|right|Caption page=]]
13104 !! html/php
13105 <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>
13106
13107 !! html/parsoid
13108 <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>
13109 !! end
13110
13111 !! test
13112 Image with caption, bug 53312 #3
13113 !! wikitext
13114 [[File:Foobar.jpg|right|Caption page=stuff]]
13115 !! html/php
13116 <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>
13117
13118 !! html/parsoid
13119 <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>
13120 !! end
13121
13122 !! test
13123 Allow empty links in image captions (Bug 60753)
13124 !! options
13125 thumbsize=220
13126 !! wikitext
13127 [[File:Foobar.jpg|thumb|Caption [[Link1]]
13128 [[]]
13129 [[Link2]]
13130 ]]
13131 !! html/php
13132 <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>
13133
13134 !! html/parsoid
13135 <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>
13136 [[]]
13137 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
13138 </figcaption></figure>
13139 !! end
13140
13141 !! test
13142 Titles in unlinked images (T23454)
13143 !! wikitext
13144 [[File:Foobar.jpg|link=|stuff]]
13145 !! html/php
13146 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
13147 </p>
13148 !! end
13149
13150 !! test
13151 Link with empty target
13152 !! wikitext
13153 [[]]
13154 !! html
13155 <p>[[]]
13156 </p>
13157 !! end
13158
13159 !! test
13160 Image with link trail
13161 !! wikitext
13162 Linktrails should not work for images: [[File:Foobar.jpg]]s
13163 !! html/php
13164 <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
13165 </p>
13166 !! html/parsoid
13167 <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>
13168 !! end
13169
13170 !! test
13171 Image with empty attribute
13172 !! options
13173 parsoid=wt2html,wt2wt,html2html
13174 !! wikitext
13175 [[File:Foobar.jpg|right||Caption text]]
13176 !! html/php
13177 <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>
13178
13179 !! html/parsoid
13180 <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>
13181 !! end
13182
13183 !! test
13184 1. Block image with individual attributes from templates
13185 !! wikitext
13186 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
13187 !! html/php
13188 <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>
13189
13190 !! html/parsoid
13191 <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>
13192 !! end
13193
13194 !! test
13195 2. Block Image with individual attributes from templates
13196 !! wikitext
13197 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
13198 !! html/php
13199 <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>
13200
13201 !! html/parsoid
13202 <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>
13203 !! end
13204
13205 !! test
13206 3. Inline image with individual attributes from templates
13207 !! wikitext
13208 [[File:Foobar.jpg|{{echo|50px}}]]
13209 !! html/php
13210 <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>
13211 </p>
13212 !! html/parsoid
13213 <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>
13214 !! end
13215
13216 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
13217 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
13218 !! test
13219 Image with multiple attributes from the same template
13220 !! wikitext
13221 [[File:Foobar.jpg|{{image_attribs}}]]
13222 !! html/php
13223 <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>
13224
13225 !! html/parsoid
13226 <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>
13227 !! end
13228
13229 !! test
13230 Image with link tails
13231 !! options
13232 thumbsize=220
13233 !! wikitext
13234 123[[File:Foobar.jpg]]456
13235 123[[File:Foobar.jpg|right]]456
13236 123[[File:Foobar.jpg|thumb]]456
13237 !! html/php
13238 <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
13239 </p>
13240 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
13241 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
13242
13243 !! html/php+tidy
13244 <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>
13245 <p>123</p>
13246 <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>
13247 <p>456 123</p>
13248 <div class="thumb tright">
13249 <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>
13250 <div class="thumbcaption">
13251 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
13252 </div>
13253 </div>
13254 </div>
13255 <p>456</p>
13256 !! html/parsoid
13257 <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>
13258 <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>
13259 <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>
13260 !! end
13261
13262 !! test
13263 Image with multiple captions -- only last one is accepted
13264 !! wikitext
13265 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
13266 !! html/php
13267 <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>
13268
13269 !! html/parsoid
13270 <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>
13271 !! end
13272
13273 !! test
13274 Image with multiple widths -- use last
13275 !! wikitext
13276 [[File:Foobar.jpg|200px|300px|caption]]
13277 !! html/php
13278 <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>
13279 </p>
13280 !! html/parsoid
13281 <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>
13282 !! end
13283
13284 !! test
13285 Image with multiple alignments -- use first (bug 48664)
13286 !! options
13287 thumbsize=220
13288 !! wikitext
13289 [[File:Foobar.jpg|thumb|left|right|center|caption]]
13290
13291 [[File:Foobar.jpg|middle|text-top|caption]]
13292 !! html/php
13293 <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>
13294 <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>
13295 </p>
13296 !! html/parsoid
13297 <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>
13298 <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>
13299 !! end
13300
13301 !! test
13302 Image with width attribute at different positions
13303 !! wikitext
13304 [[File:Foobar.jpg|200px|right|Caption]]
13305 [[File:Foobar.jpg|right|200px|Caption]]
13306 [[File:Foobar.jpg|right|Caption|200px]]
13307 !! html/php
13308 <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>
13309 <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>
13310 <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>
13311
13312 !! html/parsoid
13313 <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>
13314 <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>
13315 <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>
13316 !! end
13317
13318 # a sad bit of backward-compatibility
13319 !! test
13320 Image with size specified with pxpx (bug 13500, 51628)
13321 !! options
13322 parsoid=wt2html,wt2wt,html2html
13323 !! wikitext
13324 [[File:Foobar.jpg|20pxpx]]
13325 [[File:Foobar.jpg|200x20pxpx]]
13326 !! html/php
13327 <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>
13328 <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>
13329 </p>
13330 !! html/parsoid
13331 <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>
13332 !! end
13333
13334 !! test
13335 Image with link parameter, wiki target
13336 !! wikitext
13337 [[File:Foobar.jpg|link=Main Page]]
13338 !! html/php
13339 <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>
13340 </p>
13341 !! html/parsoid
13342 <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>
13343 !! end
13344
13345 # parsoid bug 49293 (part 1)
13346 !! test
13347 Image with link parameter, URL target
13348 !! wikitext
13349 [[File:Foobar.jpg|link=http://example.com/]]
13350 !! html/php
13351 <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>
13352 </p>
13353 !! html/parsoid
13354 <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>
13355 !! end
13356
13357 # parsoid bug 49293 (part 2)
13358 !! test
13359 Image with link parameter, protocol-less URL target
13360 !! wikitext
13361 [[File:Foobar.jpg|link=//example.com/]]
13362 !! html/php
13363 <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>
13364 </p>
13365 !! html/parsoid
13366 <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>
13367 !! end
13368
13369 !! test
13370 Escaping non-block captions (T107435)
13371 !! options
13372 parsoid={
13373 "modes": ["wt2wt"],
13374 "changes": [
13375 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13376 ]
13377 }
13378 !! wikitext
13379 [[Image:Foobar.jpg|caption]]
13380 !! wikitext/edited
13381 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13382 !! end
13383
13384 # wgExternalLinkTarget not supported by Parsoid
13385 !! test
13386 Image with link parameter, wgExternalLinkTarget
13387 !! wikitext
13388 [[Image:foobar.jpg|link=http://example.com/]]
13389 !! config
13390 wgExternalLinkTarget='foobar'
13391 !! html/php
13392 <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>
13393 </p>
13394 !! end
13395
13396 !! test
13397 Image with link parameter, wgNoFollowLinks set to false
13398 !! wikitext
13399 [[Image:foobar.jpg|link=http://example.com/]]
13400 !! config
13401 wgNoFollowLinks=false
13402 !! html
13403 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13404 </p>
13405 !! end
13406
13407 !! test
13408 Image with link parameter, wgNoFollowDomainExceptions
13409 !! wikitext
13410 [[Image:foobar.jpg|link=http://example.com/]]
13411 !! config
13412 wgNoFollowDomainExceptions='example.com'
13413 !! html
13414 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13415 </p>
13416 !! end
13417
13418 # wgExternalLinkTarget not supported by Parsoid
13419 !! test
13420 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13421 !! wikitext
13422 [[Image:foobar.jpg|link=http://example.com/|Title]]
13423 !! config
13424 wgExternalLinkTarget='foobar'
13425 !! html/php
13426 <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>
13427 </p>
13428 !! end
13429
13430 !! test
13431 Image with empty link parameter
13432 !! wikitext
13433 [[File:Foobar.jpg|link=]]
13434 !! html/php
13435 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13436 </p>
13437 !! html/parsoid
13438 <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>
13439 !! end
13440
13441 !! test
13442 Image with link parameter (wiki target) and unnamed parameter
13443 !! wikitext
13444 [[File:Foobar.jpg|link=Main_Page|Title]]
13445 !! html/php
13446 <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>
13447 </p>
13448 !! html/parsoid
13449 <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>
13450 !! end
13451
13452 !! test
13453 Image with link parameter (URL target) and unnamed parameter
13454 !! wikitext
13455 [[File:Foobar.jpg|link=http://example.com/|Title]]
13456 !! html/php
13457 <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>
13458 </p>
13459 !! html/parsoid
13460 <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>
13461 !! end
13462
13463 !! test
13464 Thumbnail image with link parameter
13465 !! options
13466 thumbsize=220
13467 parsoid=wt2html,wt2wt,html2html
13468 !! wikitext
13469 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13470 !! html/php
13471 <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>
13472
13473 !! html/parsoid
13474 <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>
13475 !! end
13476
13477 !! test
13478 Manually-specified thumbnail image
13479 !! options
13480 thumbsize=220
13481 !! wikitext
13482 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13483 !! html/php
13484 <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>
13485
13486 !! html/parsoid
13487 <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>
13488 !! end
13489
13490 !! test
13491 Manually-specified thumbnail image with explicit link to wiki page
13492 !! options
13493 thumbsize=220
13494 parsoid=wt2html,wt2wt,html2html
13495 !! wikitext
13496 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13497 !! html/php
13498 <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>
13499
13500 !! html/parsoid
13501 <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>
13502 !! end
13503
13504 !! test
13505 Manually-specified thumbnail image with explicit link to url
13506 !! options
13507 thumbsize=220
13508 parsoid=wt2html,wt2wt,html2html
13509 !! wikitext
13510 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13511 !! html/php
13512 <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>
13513
13514 !! html/parsoid
13515 <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>
13516 !! end
13517
13518 !! test
13519 Manually-specified thumbnail image with explicit no link
13520 !! options
13521 thumbsize=220
13522 parsoid=wt2html,wt2wt,html2html
13523 !! wikitext
13524 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13525 !! html/php
13526 <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>
13527
13528 !! html/parsoid
13529 <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>
13530 !! end
13531
13532 !! test
13533 Manually-specified thumbnail image with explicit link and alt text
13534 !! options
13535 thumbsize=220
13536 parsoid=wt2html,wt2wt,html2html
13537 !! wikitext
13538 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13539 !! html/php
13540 <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>
13541
13542 !! html/parsoid
13543 <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>
13544 !! end
13545
13546 !! test
13547 Image with frame and link
13548 !! options
13549 parsoid=wt2html,wt2wt,html2html
13550 !! wikitext
13551 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13552 !! html/php
13553 <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>
13554
13555 !! html/parsoid
13556 <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>
13557 !! end
13558
13559 !! test
13560 Image with frame and link and explicit alt
13561 !! options
13562 parsoid=wt2html,wt2wt,html2html
13563 !! wikitext
13564 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13565 !! html/php
13566 <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>
13567
13568 !! html/parsoid
13569 <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>
13570 !! end
13571
13572 !! test
13573 Image with wiki markup in implicit alt
13574 !! wikitext
13575 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13576
13577 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13578 !! html/php
13579 <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>
13580 </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>
13581 </p>
13582 !! html/parsoid
13583 <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>
13584
13585 <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>
13586 !! end
13587
13588 !! test
13589 Alt image option should handle most kinds of wikitext without barfing
13590 !! wikitext
13591 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13592 !! html/php
13593 <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>
13594
13595 !! html/parsoid
13596 <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>
13597 !! end
13598
13599 ###################
13600 # Conflicting image format options.
13601 # First option specified should 'win'.
13602 # All three cases in each test should be identical.
13603
13604 !! test
13605 Image with 'frameless' first.
13606 !! options
13607 parsoid=wt2html,wt2wt,html2html
13608 !! wikitext
13609 [[File:Foobar.jpg|frameless|caption]]
13610
13611 [[File:Foobar.jpg|frameless|frame|caption]]
13612
13613 [[File:Foobar.jpg|frameless|thumb|caption]]
13614 !! html/php
13615 <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>
13616 </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>
13617 </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>
13618 </p>
13619 !! html/parsoid
13620 <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>
13621 <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>
13622 <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>
13623 !! end
13624
13625 !! test
13626 Image with 'frame' first.
13627 !! options
13628 parsoid=wt2html,wt2wt,html2html
13629 !! wikitext
13630 [[File:Foobar.jpg|frame|caption]]
13631 [[File:Foobar.jpg|frame|frameless|caption]]
13632 [[File:Foobar.jpg|frame|thumb|caption]]
13633 !! html/php
13634 <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>
13635 <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>
13636 <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>
13637
13638 !! html/parsoid
13639 <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>
13640 <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>
13641 <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>
13642 !! end
13643
13644 !! test
13645 Image with 'thumb' first.
13646 !! options
13647 parsoid=wt2html,wt2wt,html2html
13648 !! wikitext
13649 [[File:Foobar.jpg|thumb|caption]]
13650 [[File:Foobar.jpg|thumb|frameless|caption]]
13651 [[File:Foobar.jpg|thumb|frame|caption]]
13652 !! html/php
13653 <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>
13654 <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>
13655 <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>
13656
13657 !! html/parsoid
13658 <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>
13659 <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>
13660 <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>
13661 !! end
13662
13663 ###################
13664 # Image sizing.
13665 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13666 # and https://phabricator.wikimedia.org/T64258
13667 # Foobar has actual size of 1941x220
13668 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13669 # a scalable format.
13670 # 2. Framed images always ignore size options; always render at default size.
13671 # 3. "Unspecified format" and border are the only types which can be
13672 # enlarged.
13673
13674 !! test
13675 Image: "unspecified format" and border enlarge
13676 !! options
13677 parsoid=wt2html,wt2wt,html2html
13678 !! wikitext
13679 [[File:Foobar.jpg|2000px]]
13680
13681 [[File:Foobar.jpg|border|2000px]]
13682 !! html/php
13683 <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>
13684 </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>
13685 </p>
13686 !! html/parsoid
13687 <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>
13688 <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>
13689 !! end
13690
13691 !! test
13692 Image: "unspecified format" and border reduce
13693 !! options
13694 parsoid=wt2html,wt2wt,html2html
13695 !! wikitext
13696 [[File:Foobar.jpg|1000px]]
13697
13698 [[File:Foobar.jpg|border|1000px]]
13699 !! html/php
13700 <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>
13701 </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>
13702 </p>
13703 !! html/parsoid
13704 <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>
13705 <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>
13706 !! end
13707
13708 !! test
13709 Image: thumbs reduce
13710 !! options
13711 parsoid=wt2html,wt2wt,html2html
13712 !! wikitext
13713 [[File:Foobar.jpg|thumb|50px]]
13714 !! html/php
13715 <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>
13716
13717 !! html/parsoid
13718 <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>
13719 !! end
13720
13721 !! test
13722 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13723 !! options
13724 parsoid=wt2html,wt2wt,html2html
13725 !! wikitext
13726 [[File:Foobar.jpg|thumb|2000px]]
13727
13728 [[File:Foobar.svg|thumb|2000px]]
13729 !! html/php
13730 <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>
13731 <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>
13732
13733 !! html/parsoid
13734 <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>
13735 <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>
13736 !! end
13737
13738 !! test
13739 Image: frameless can reduce in size
13740 !! options
13741 parsoid=wt2html,wt2wt,html2html
13742 !! wikitext
13743 [[File:Foobar.jpg|frameless|50px]]
13744 !! html/php
13745 <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>
13746 </p>
13747 !! html/parsoid
13748 <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>
13749 !! end
13750
13751 !! test
13752 Image: bitmap frameless can't be enlarged past original size, but vector can
13753 !! options
13754 parsoid=wt2html,wt2wt,html2html
13755 !! wikitext
13756 [[File:Foobar.jpg|frameless|2000px]]
13757
13758 [[File:Foobar.svg|frameless|2000px]]
13759 !! html/php
13760 <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>
13761 </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>
13762 </p>
13763 !! html/parsoid
13764 <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>
13765 <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>
13766 !! end
13767
13768 !! test
13769 Image: framed images are always unscaled.
13770 !! options
13771 parsoid=wt2html,wt2wt,html2html
13772 !! wikitext
13773 [[File:Foobar.jpg|frame]]
13774
13775 [[File:Foobar.jpg|frame|50px]]
13776
13777 [[File:Foobar.jpg|frame|50x50px]]
13778
13779 [[File:Foobar.jpg|frame|2000px]]
13780 !! html/php
13781 <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>
13782 <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>
13783 <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>
13784 <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>
13785
13786 !! html/parsoid
13787 <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>
13788 <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>
13789 <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>
13790 <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>
13791 !! end
13792
13793 ###################
13794
13795 !! test
13796 Link to image page- image page normally doesn't exists, hence edit link
13797 Add test with existing image page
13798 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13799 !! wikitext
13800 [[:Image:test]]
13801 !! html
13802 <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>
13803 </p>
13804 !! end
13805
13806 !! test
13807 bug 18784 Link to non-existent image page with caption should use caption as link text
13808 !! wikitext
13809 [[:Image:test|caption]]
13810 !! html
13811 <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>
13812 </p>
13813 !! end
13814
13815 !! test
13816 Frameless image caption with a free URL
13817 !! wikitext
13818 [[File:Foobar.jpg|http://example.com]]
13819 !! html/php
13820 <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>
13821 </p>
13822 !! html/parsoid
13823 <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>
13824 !! end
13825
13826 !! test
13827 Thumbnail image caption with a free URL
13828 !! options
13829 thumbsize=220
13830 !! wikitext
13831 [[File:Foobar.jpg|thumb|http://example.com]]
13832 !! html/php
13833 <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>
13834
13835 !! html/parsoid
13836 <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>
13837 !! end
13838
13839 !! test
13840 Thumbnail image caption with a free URL and explicit alt
13841 !! options
13842 thumbsize=220
13843 parsoid=wt2html,wt2wt,html2html
13844 !! wikitext
13845 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13846 !! html/php
13847 <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>
13848
13849 !! html/parsoid
13850 <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>
13851 !! end
13852
13853 !! test
13854 SVG thumbnails with no language set
13855 !! options
13856 !! wikitext
13857 [[File:Foobar.svg|thumb|caption]]
13858 !! html/php
13859 <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>
13860
13861 !! html/parsoid
13862 <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>
13863 !! end
13864
13865 !! test
13866 SVG thumbnails with language de
13867 !! options
13868 parsoid=wt2html,wt2wt,html2html
13869 !! wikitext
13870 [[File:Foobar.svg|thumb|caption|lang=de]]
13871 !! html/php
13872 <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>
13873
13874 !! html/parsoid
13875 <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>
13876 !! end
13877
13878 !! test
13879 SVG thumbnails with invalid language code
13880 !! options
13881 parsoid=wt2html,wt2wt,html2html
13882 !! wikitext
13883 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
13884 !! html/php
13885 <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>
13886
13887 !! html/parsoid
13888 <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>
13889 !! end
13890
13891 !! test
13892 BUG 1887: A ISBN with a thumbnail
13893 !! wikitext
13894 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
13895 !! html/php
13896 <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>
13897
13898 !! html/parsoid
13899 <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>
13900 !! end
13901
13902 !! test
13903 BUG 1887: A RFC with a thumbnail
13904 !! wikitext
13905 [[File:Foobar.jpg|thumb|This is RFC 12354]]
13906 !! html/php
13907 <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>
13908
13909 !! html/parsoid
13910 <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>
13911 !! end
13912
13913 !! test
13914 BUG 1887: A mailto link with a thumbnail
13915 !! wikitext
13916 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
13917 !! html/php
13918 <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>
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>Please <a rel="mw:ExtLink" href="mailto:nobody@example.com">mailto:nobody@example.com</a></figcaption></figure>
13922 !! end
13923
13924 # Pending resolution to bug 368
13925 !! test
13926 BUG 648: Frameless image caption with a link
13927 !! wikitext
13928 [[File:Foobar.jpg|text with a [[link]] in it]]
13929 !! html/php
13930 <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>
13931 </p>
13932 !! html/parsoid
13933 <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>
13934 !! end
13935
13936 !! test
13937 BUG 648: Frameless image caption with a link (suffix)
13938 !! wikitext
13939 [[File:Foobar.jpg|text with a [[link]]foo in it]]
13940 !! html/php
13941 <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>
13942 </p>
13943 !! html/parsoid
13944 <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>
13945 !! end
13946
13947 !! test
13948 BUG 648: Frameless image caption with an interwiki link
13949 !! wikitext
13950 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
13951 !! html/php
13952 <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>
13953 </p>
13954 !! html/parsoid
13955 <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>
13956 !! end
13957
13958 !! test
13959 BUG 648: Frameless image caption with a piped interwiki link
13960 !! wikitext
13961 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
13962 !! html/php
13963 <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>
13964 </p>
13965 !! html/parsoid
13966 <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>
13967 !! end
13968
13969 !! test
13970 T107474: Frameless image caption with <nowiki>
13971 !! wikitext
13972 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
13973 !! html/parsoid
13974 <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>
13975 !! end
13976
13977 !! test
13978 Escape HTML special chars in image alt text
13979 !! wikitext
13980 [[File:Foobar.jpg|& < > "]]
13981 !! html/php
13982 <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>
13983 </p>
13984 !! html/parsoid
13985 <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>
13986 !! end
13987
13988 !! test
13989 Entities in file name and attributes
13990 !! wikitext
13991 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
13992 !! html/php
13993 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
13994 </p>
13995 !! html/parsoid
13996 <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>
13997 !! end
13998
13999 !! test
14000 BUG 499: Alt text should have &#1234;, not &amp;1234;
14001 !! wikitext
14002 [[File:Foobar.jpg|&#9792;]]
14003 !! html/php
14004 <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>
14005 </p>
14006 !! html/parsoid
14007 <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>
14008 !! end
14009
14010 !! test
14011 Broken image caption with link
14012 !! options
14013 parsoid=wt2html,wt2wt,html2html
14014 !! wikitext
14015 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
14016 !! html/php
14017 <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.
14018 </p>
14019 !! html/parsoid
14020 <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>
14021 !! end
14022
14023 !! test
14024 Image caption containing another image
14025 !! wikitext
14026 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
14027 !! html/php
14028 <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>
14029
14030 !! html/parsoid
14031 <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>
14032 !! end
14033
14034 !! test
14035 Image: caption containing a newline
14036 !! wikitext
14037 [[File:Foobar.jpg|This
14038 *is some text]]
14039 !! html/php
14040 <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>
14041 </p>
14042 !! html/parsoid
14043 <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>
14044 !!end
14045
14046 !!test
14047 Image: caption containing leading space
14048 (The leading space should not trigger nowiki escaping in wt2wt mode)
14049 !! wikitext
14050 [[File:Foobar.jpg|thumb| bar]]
14051 !! html/php
14052 <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>
14053
14054 !! html/parsoid
14055 <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>
14056 !!end
14057
14058 !! test
14059 Image: caption containing a table
14060 !! options
14061 parsoid=wt2html,wt2wt,html2html
14062 !! wikitext
14063 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
14064 {|
14065 ! Foo !! Bar
14066 |-
14067 | Foo1 || Bar1
14068 |}
14069 and some more text.]]
14070 !! html/php
14071 <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>
14072
14073 !! html/parsoid
14074 <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
14075 <table>
14076 <tbody>
14077 <tr><th>Foo </th><th>Bar</th></tr>
14078 <tr>
14079 <td>Foo1 </td>
14080 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
14081 !! end
14082
14083 !! test
14084 Bug 3090: External links other than http: in image captions
14085 !! wikitext
14086 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
14087 !! html/php
14088 <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>
14089
14090 !! html/parsoid
14091 <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>
14092 !! end
14093
14094 !! test
14095 Custom class
14096 !! options
14097 parsoid=wt2html,wt2wt,html2html
14098 !! wikitext
14099 [[Image:foobar.jpg|a|class=b]]
14100 !! html/php
14101 <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>
14102 </p>
14103 !! html/parsoid
14104 <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>
14105 !! end
14106
14107 !! test
14108 Localized image handling (1).
14109 !! options
14110 parsoid=wt2html,wt2wt,html2html
14111 language=es
14112 !! wikitext
14113 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
14114 !! html/php
14115 <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>
14116
14117 !! html/parsoid
14118 <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>
14119 !! end
14120
14121 !! test
14122 Localized image handling (2).
14123 !! options
14124 thumbsize=220
14125 parsoid=wt2html,wt2wt,html2html
14126 language=es
14127 !! wikitext
14128 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
14129 !! html/php
14130 <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>
14131
14132 !! html/parsoid
14133 <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>
14134 !! end
14135
14136 !! test
14137 Localized image handling (3).
14138 !! options
14139 language=fa
14140 parsoid=html2wt
14141 !! html/parsoid
14142 <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>
14143 !! wikitext
14144 [[File:Foobar.jpg|بندانگشتی]]
14145 !! end
14146
14147 !! test
14148 "border", "frameless" and "class" attributes on an image.
14149 !! options
14150 thumbsize=220
14151 parsoid=wt2html,wt2wt,html2html
14152 !! wikitext
14153 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
14154 !! html/php
14155 <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>
14156 </p>
14157 !! html/parsoid
14158 <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>
14159 !! end
14160
14161 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
14162 !! test
14163 Invalid image attributes (bug 62500)
14164 !! options
14165 thumbsize=220
14166 parsoid=wt2html,wt2wt,html2html
14167 !! wikitext
14168 [[File:Foobar.jpg|thumb|float|left|caption]]
14169
14170 [[File:Foobar.jpg|thumb|righ|caption]]
14171
14172 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
14173 !! html/php
14174 <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>
14175 <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>
14176 <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>
14177
14178 !! html/parsoid
14179 <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>
14180 <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>
14181 <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>
14182 !! end
14183
14184 !! article
14185 File:Barfoo.jpg
14186 !! text
14187 #REDIRECT [[File:Barfoo.jpg]]
14188 !! endarticle
14189
14190 # FIXME: Parsoid should run this test -- but we'd need to teach the
14191 # mockAPI about the redirected Barfoo.jpg image.
14192 !! test
14193 Redirected image
14194 !! wikitext
14195 [[Image:Barfoo.jpg]]
14196 !! html/php
14197 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
14198 </p>
14199 !! end
14200
14201 !! test
14202 Missing image with uploads disabled
14203 !! options
14204 wgEnableUploads=0
14205 !! wikitext
14206 [[File:Foobaz.jpg]]
14207 !! html/php
14208 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
14209 </p>
14210 !! html/parsoid
14211 <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>
14212 !! end
14213
14214 # Parsoid-specific testing for images
14215 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14216 # Currently imperfect due to a flaw in the Parsoid testrunner
14217 # Work in progress
14218 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
14219 # image tests.
14220
14221 !! test
14222 Parsoid-specific image handling - simple image with size and middle alignment
14223 !! wikitext
14224 [[File:Foobar.jpg|middle|50px]]
14225 !! html/parsoid
14226 <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>
14227 !! end
14228
14229 !! test
14230 Parsoid-specific image handling - simple image with size, middle alignment,
14231 non-standard namespace alias
14232 !! options
14233 parsoid=wt2wt,wt2html,html2html
14234 !! wikitext
14235 [[Image:Foobar.jpg|middle|50px]]
14236 !! html/parsoid
14237 <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>
14238 !! end
14239
14240 !! test
14241 Parsoid-specific image handling - simple image with size and middle alignment
14242 (existing content)
14243 !! wikitext
14244 [[File:Foobar.jpg|50px|middle]]
14245 !! html/parsoid
14246 <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>
14247 !! end
14248
14249 !! test
14250 Parsoid-specific image handling - simple image with size and middle alignment
14251 and non-standard namespace name
14252 !! options
14253 parsoid=wt2html,wt2wt,html2html
14254 !! wikitext
14255 [[Image:Foobar.jpg|50px|middle]]
14256 !! html/parsoid
14257 <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>
14258 !! end
14259
14260 !! test
14261 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
14262 !! wikitext
14263 [[File:Foobar.jpg|500x10px|baseline|caption]]
14264 !! html/parsoid
14265 <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>
14266 !! end
14267
14268 !! test
14269 Parsoid-specific image handling - simple image with border and size spec
14270 !! wikitext
14271 [[File:Foobar.jpg|50px|border|caption]]
14272 !! html/parsoid
14273 <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>
14274 !! end
14275
14276 !! test
14277 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14278 !! wikitext
14279 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
14280 !! html/parsoid
14281 <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>
14282 !! end
14283
14284 !! test
14285 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14286 (existing content)
14287 !! wikitext
14288 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
14289 !! html/parsoid
14290 <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>
14291 !! end
14292
14293 !! test
14294 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
14295 !! wikitext
14296 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
14297 !! html/parsoid
14298 <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>
14299 !! end
14300
14301 !! test
14302 Parsoid-specific image handling - thumbnail with specific size, halign,
14303 valign, and caption (existing content)
14304 !! wikitext
14305 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
14306 !! html/parsoid
14307 <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>
14308 !! end
14309
14310 !! test
14311 Parsoid-specific image handling - framed image with specific size and caption
14312 (size is ignored)
14313 !! options
14314 parsoid=wt2html,wt2wt,html2html
14315 !! wikitext
14316 [[File:Foobar.jpg|frame|500x50px|caption]]
14317 !! html/parsoid
14318 <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>
14319 !! end
14320
14321 !! test
14322 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14323 (size is ignored)
14324 !! options
14325 parsoid=wt2html,wt2wt,html2html
14326 !! wikitext
14327 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14328 !! html/parsoid
14329 <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>
14330 !! end
14331
14332 !! test
14333 Parsoid-specific image handling - frameless image with specific size, border, and caption
14334 !! wikitext
14335 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14336 !! html/parsoid
14337 <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>
14338 !! end
14339
14340 !! test
14341 Parsoid-specific image handling - simple image with a formatted caption
14342 !! wikitext
14343 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14344 !! html/parsoid
14345 <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>
14346 !! end
14347
14348 !! test
14349 Parsoid-specific image handling - caption with a template in it
14350 !! wikitext
14351 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14352 !! html/parsoid
14353 <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>
14354 !! end
14355
14356 !! test
14357 Parsoid-specific image handling - caption with unbalanced tags in it
14358 !! options
14359 parsoid=wt2html,wt2wt,html2html
14360 !! wikitext
14361 foo
14362 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14363 bar
14364 !! html/parsoid
14365 <p>foo</p>
14366 <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>
14367 <p>bar</p>
14368 !! end
14369
14370 !! test
14371 Parsoid-specific image handling - empty caption (1)
14372 !! options
14373 parsoid=wt2html,wt2wt
14374 !! wikitext
14375 [[File:Foobar.jpg|thumb|]]
14376 !! html/parsoid
14377 <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>
14378 !! end
14379
14380 # empty captions don't get serialized unless we're in the "round trip" case
14381 !! test
14382 Parsoid-specific image handling - empty caption (2)
14383 !! options
14384 parsoid=html2wt
14385 !! html/parsoid
14386 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14387 <a href="./File:Foobar.jpg">
14388 <img resource="./File:Foobar.jpg"
14389 src="//example.com/images/3/3a/Foobar.jpg"
14390 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14391 height="25" width="220"/>
14392 </a>
14393 <figcaption></figcaption>
14394 </figure>
14395 !! wikitext
14396 [[File:Foobar.jpg|thumb]]
14397 !! end
14398
14399 !! test
14400 Parsoid-specific image handling - whitespace caption
14401 !! wikitext
14402 [[File:Foobar.jpg|thumb| ]]
14403 !! html/parsoid
14404 <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>
14405 !! end
14406
14407 !! test
14408 Parsoid-specific image handling - lang option
14409 !! wikitext
14410 foo
14411 [[File:Foobar.svg|lang=de|caption]]
14412 bar
14413 !! html/parsoid
14414 <p>foo
14415 <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>
14416 bar</p>
14417 !! end
14418
14419 ## Edge case bugs in Parsoid from T93580
14420 !! test
14421 T93580: 1. Templated <ref> inside block images
14422 !! wikitext
14423 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14424
14425 <references />
14426 !! html/parsoid
14427 <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>
14428
14429 <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>
14430 !! end
14431
14432 !! test
14433 T93580: 2. <ref> inside inline images
14434 !! wikitext
14435 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14436
14437 <references />
14438 !! html/parsoid
14439 <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>
14440
14441 <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>
14442 !! end
14443
14444 !! test
14445 T93580: 3. Templated <ref> inside inline images
14446 !! wikitext
14447 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14448
14449 <references />
14450 !! html/parsoid
14451 <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>
14452
14453 <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>
14454 !! end
14455
14456 ###
14457 ### Subpages
14458 ###
14459 !! article
14460 Subpage test/subpage
14461 !! text
14462 foo
14463 !! endarticle
14464
14465 !! test
14466 Subpage link
14467 !! options
14468 subpage title=[[Subpage test]]
14469 !! wikitext
14470 [[/subpage]]
14471 !! html
14472 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14473 </p>
14474 !! end
14475
14476 !! test
14477 Subpage noslash link
14478 !! options
14479 subpage title=[[Subpage test]]
14480 !! wikitext
14481 [[/subpage/]]
14482 !! html
14483 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14484 </p>
14485 !! end
14486
14487 !! article
14488 Subpage test/1/2/subpage
14489 !! text
14490 blah
14491 !! endarticle
14492
14493 !! test
14494 Relative subpage noslash link
14495 !! options
14496 parsoid=wt2wt,wt2html,html2html
14497 subpage title=[[Subpage test/1/2/3/4]]
14498 !! wikitext
14499 [[../../subpage/]]
14500
14501 [[../../subpage]]
14502 !! html/php
14503 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14504 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14505 </p>
14506 !! html/parsoid
14507 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14508 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14509 !! end
14510
14511 !! test
14512 Parsoid: dot-slash prefixed wikilinks
14513 !! wikitext
14514 [[./foo]]
14515
14516 [[././bar]]
14517
14518 [[././baz/]]
14519 !! html/php
14520 <p>[[./foo]]
14521 </p><p>[[././bar]]
14522 </p><p>[[././baz/]]
14523 </p>
14524 !! html/parsoid
14525 <p>[[./foo]]
14526 </p><p>[[././bar]]
14527 </p><p>[[././baz/]]
14528 </p>
14529 !! end
14530
14531 !! test
14532 Render invalid page names as plain text (bug 51090)
14533 !! wikitext
14534 [[./../foo|bar]]
14535 [[foo�|bar]]
14536 [[foo/.|bar]]
14537 [[foo/..|bar]]
14538 [[foo~~~bar]]
14539 [[foo>bar]]
14540 [[foo[bar]]
14541 [[.]]
14542 [[..]]
14543 [[foo././bar]]
14544
14545 [[{{echo|./../foo}}|bar]]
14546 [[{{echo|foo/.}}|bar]]
14547 [[{{echo|foo/..}}|bar]]
14548 [[{{echo|foo~~~~bar}}]]
14549 [[{{echo|foo>bar}}]]
14550 [[{{echo|foo././bar}}]]
14551 [[{{echo|foo{bar}}]]
14552 [[{{echo|foo}bar}}]]
14553 [[{{echo|foo[bar}}]]
14554 [[{{echo|foo]bar}}]]
14555 [[{{echo|foo<bar}}]]
14556 !!html/php
14557 <p>[[./../foo|bar]]
14558 [[foo�|bar]]
14559 [[foo/.|bar]]
14560 [[foo/..|bar]]
14561 [[foo~~~bar]]
14562 [[foo&gt;bar]]
14563 [[foo[bar]]
14564 [[.]]
14565 [[..]]
14566 [[foo././bar]]
14567 </p><p>[[./../foo|bar]]
14568 [[foo/.|bar]]
14569 [[foo/..|bar]]
14570 [[foo~~~~bar]]
14571 [[foo&gt;bar]]
14572 [[foo././bar]]
14573 [[foo{bar]]
14574 [[foo}bar]]
14575 [[foo[bar]]
14576 [[foo]bar]]
14577 [[foo&lt;bar]]
14578 </p>
14579 !!html/parsoid
14580 <p>[[./../foo|bar]]
14581 [[foo�|bar]]
14582 [[foo/.|bar]]
14583 [[foo/..|bar]]
14584 [[foo~~~bar]]
14585 [[foo>bar]]
14586 [[foo[bar]]
14587 [[.]]
14588 [[..]]
14589 [[foo././bar]]</p>
14590
14591 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14592 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14593 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14594 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14595 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14596 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14597 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14598 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14599 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14600 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14601 [[<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>
14602 !!end
14603
14604 !! test
14605 Disabled subpages
14606 !! wikitext
14607 [[/subpage]]
14608 !! html
14609 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14610 </p>
14611 !! end
14612
14613 !! test
14614 BUG 561: {{/Subpage}}
14615 !! options
14616 subpage title=[[Page]]
14617 !! wikitext
14618 {{/Subpage}}
14619 !! html
14620 <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>
14621 </p>
14622 !! end
14623
14624 ###
14625 ### Categories
14626 ###
14627 !! article
14628 Category:MediaWiki User's Guide
14629 !! text
14630 blah
14631 !! endarticle
14632
14633 !! test
14634 Link to category
14635 !! wikitext
14636 [[:Category:MediaWiki User's Guide]]
14637 !! html
14638 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14639 </p>
14640 !! end
14641
14642 !! test
14643 Simple category
14644 !! options
14645 cat
14646 !! wikitext
14647 [[Category:MediaWiki User's Guide]]
14648 !! html
14649 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14650 !! end
14651
14652 !! test
14653 PAGESINCATEGORY invalid title fatal (r33546 fix)
14654 !! wikitext
14655 {{PAGESINCATEGORY:<bogus>}}
14656 !! html
14657 <p>0
14658 </p>
14659 !! end
14660
14661 !! test
14662 Category with different sort key
14663 !! options
14664 cat
14665 !! wikitext
14666 [[Category:MediaWiki User's Guide|Foo]]
14667 !! html
14668 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14669 !! end
14670
14671 !! test
14672 Category with identical sort key
14673 !! options
14674 cat
14675 !! wikitext
14676 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14677 !! html
14678 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14679 !! end
14680
14681 !! test
14682 Category with empty sort key
14683 !! options
14684 cat
14685 pst
14686 !! wikitext
14687 [[Category:MediaWiki User's Guide|]]
14688 !! html/php
14689 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14690 !! end
14691
14692 !! test
14693 Category with empty sort key and parentheses
14694 !! options
14695 cat
14696 pst
14697 !! wikitext
14698 [[Category:Foo (bar)|]]
14699 !! html/php
14700 [[Category:Foo (bar)|Foo]]
14701 !! end
14702
14703 ## We used to, but no longer wt2wt this test since the default serializer
14704 ## will normalize all categories to serialize on their own line.
14705 ## This wikitext usage is going to be fairly uncommon in production and
14706 ## selser will take care of preserving formatting in those scenarios.
14707 !! test
14708 Category with link tail
14709 !! options
14710 cat
14711 pst
14712 parsoid=wt2html
14713 !! wikitext
14714 123[[Category:Foo]]456
14715 !! html/php
14716 123[[Category:Foo]]456
14717 !! html/parsoid
14718 <p>123<link rel="mw:PageProp/Category" href="Category:Foo"/>456</p>
14719 !! end
14720
14721 !! test
14722 Category with template
14723 !! options
14724 cat
14725 pst
14726 !! wikitext
14727 [[Category:{{echo|Foo}}]]
14728 !! html/php
14729 [[Category:{{echo|Foo}}]]
14730 !! end
14731
14732 !! test
14733 Category with template in sort key
14734 !! options
14735 cat
14736 pst
14737 !! wikitext
14738 [[Category:Foo|{{echo|Bar}}]]
14739 !! html/php
14740 [[Category:Foo|{{echo|Bar}}]]
14741 !! end
14742
14743 !! test
14744 Category with template in sort key and title
14745 !! options
14746 cat
14747 pst
14748 !! wikitext
14749 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14750 !! html/php
14751 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14752 !! end
14753
14754 ## We used to, but no longer wt2wt this test since the default serializer
14755 ## will normalize all categories to serialize on their own line.
14756 ## This wikitext usage is going to be fairly uncommon in production and
14757 ## selser will take care of preserving formatting in those scenarios.
14758 !! test
14759 Category / paragraph interactions
14760 !! options
14761 parsoid=wt2html
14762 !! wikitext
14763 Foo [[Category:Baz]] Bar
14764
14765 Foo [[Category:Baz]]
14766 Bar
14767
14768 Foo
14769 [[Category:Baz]]
14770 Bar
14771
14772 Foo
14773 [[Category:Baz]] Bar
14774
14775 Foo
14776 [[Category:Baz]]
14777 [[Category:Baz]]
14778 [[Category:Baz]]
14779 Bar
14780
14781 [[Category:Baz]]
14782 [[Category:Baz]]
14783 [[Category:Baz]]
14784
14785 [[Category:Baz]]
14786 {{echo|[[Category:Baz]]}}
14787 [[Category:Baz]]
14788 !! html/php
14789 <p>Foo Bar
14790 </p><p>Foo
14791 Bar
14792 </p><p>Foo
14793 Bar
14794 </p><p>Foo Bar
14795 </p><p>Foo
14796 Bar
14797 </p>
14798 !! html/parsoid
14799 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14800 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14801 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14802 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14803 <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>
14804 <link rel="mw:PageProp/Category" href="Category:Baz"/>
14805 !! end
14806
14807 ## We used to, but no longer wt2wt this test since the default serializer
14808 ## will normalize all categories to serialize on their own line.
14809 ## This wikitext usage is going to be fairly uncommon in production and
14810 ## selser will take care of preserving formatting in those scenarios.
14811 ##
14812 ## The whitespace on the empty line is part of the test. Please do not delete
14813 !! test
14814 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14815 !! options
14816 parsoid=wt2html
14817 !! wikitext
14818 This
14819
14820 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14821
14822 {{echo|[[Category:Foo]] and so should this!}}
14823 !! html/php
14824 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14825 </p>
14826 !! html/parsoid
14827 <p>This
14828
14829 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14830
14831 <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>
14832 !! end
14833
14834 ## Parsoid will not try to wt2wt this while preserving newlines because
14835 ## it suppresses excess newlines within list items -- and we don't want to
14836 ## introduce a special case just for categories, which is, in reality somewhat
14837 ## odd behavior -- categories are unlikely to be used in list items like this
14838 ## in top-level pages and are only likely to show up in template-generated
14839 ## list items where this RT-ing is a non-issue.
14840 ##
14841 ## The whitespace on the empty line is part of the test. Please do not delete
14842 !! test
14843 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14844 !! options
14845 parsoid=wt2html
14846 !! wikitext
14847 * This
14848
14849 [[Category:Foo]] and this should be part of the same list item
14850 * So should this
14851
14852 {{echo|[[Category:Foo]] and this should be part of the same list item}}
14853 !! html
14854 <ul><li>This and this should be part of the same list item</li>
14855 <li>So should this and this should be part of the same list item</li></ul>
14856 !! html/parsoid
14857 <ul>
14858 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
14859 <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>
14860 </ul>
14861 !! end
14862
14863 ## Newlines and categories that follow the last item of a list
14864 ## are treated differently because this (list followed by categories)
14865 ## is an extremely common pattern on wikis.
14866 !! test
14867 3. Categories and newlines: newline suppression for last list item should RT properly
14868 !! wikitext
14869 * a
14870 * b
14871
14872 [[Category:Foo]]
14873
14874 [[Category:Bar]]
14875 [[Category:Baz]]
14876 !! html/parsoid
14877 <ul><li> a</li>
14878 <li> b</li></ul>
14879
14880 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14881
14882 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14883 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14884 !! end
14885
14886 !! test
14887 4. Categories and newlines: newline suppression for last list item should RT properly
14888 !! wikitext
14889 * a
14890 **** b
14891
14892 [[Category:Foo]]
14893 !! html/parsoid
14894 <ul><li> a
14895 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
14896
14897 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14898 !! end
14899
14900 ## only wt2html for this to make sure the algo only applies to the rightmost path
14901 !! test
14902 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
14903 !! options
14904 parsoid=wt2html
14905 !! wikitext
14906 * a
14907 ** b
14908 [[Category:Foo]]
14909 * c
14910 ** d
14911 [[Category:Foo]]
14912 !! html/parsoid
14913 <ul><li> a
14914 <ul><li> b
14915 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
14916 <li> c
14917 <ul><li> d</li></ul></li></ul>
14918 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14919 !! end
14920
14921 ## We used to, but no longer wt2wt this test since the default serializer
14922 ## will normalize all categories to serialize on their own line.
14923 ## This wikitext usage is going to be fairly uncommon in production and
14924 ## selser will take care of preserving formatting in those scenarios.
14925 !! test
14926 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
14927 !! options
14928 parsoid=wt2html
14929 !! wikitext
14930 * a [[Category:Foo]]
14931 !! html/parsoid
14932 <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>
14933 !! end
14934
14935 # This test also demonstrates because of newline+category tunneling
14936 # through the list hander, template wrapping doesn't expand to the
14937 # containing list when the list item swallows the category.
14938 !! test
14939 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
14940 !! wikitext
14941 * {{echo|a
14942 [[Category:Foo]]}}
14943 !! html/parsoid
14944 <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
14945 </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>
14946 !! end
14947
14948 !! test
14949 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
14950 !! wikitext
14951 * a
14952
14953 {{echo|[[Category:Foo]]
14954 [[Category:Bar]]}}
14955 [[Category:Baz]]
14956 !! html/parsoid
14957 <ul><li> a</li></ul>
14958
14959 <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">
14960 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14961 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14962 !! end
14963
14964 !! test
14965 Category links with multiple namespaces
14966 !! wikitext
14967 [[Category:Project:Foo]]
14968 !! html/parsoid
14969 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
14970 !! end
14971
14972 !! test
14973 Parsoid: Serialize link to category page with colon escape
14974 !! options
14975 parsoid
14976 !! wikitext
14977
14978 [[:Category:Foo]]
14979 [[:Category:Foo|Bar]]
14980 !! html
14981 <p>
14982 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
14983 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
14984 </p>
14985 !! end
14986
14987 # We used to, but no longer wt2wt this test since the default serializer
14988 # will normalize all categories to serialize on their own line.
14989 # This wikitext usage is going to be fairly uncommon in production and
14990 # selser will take care of preventing whitespace insertion if this
14991 # occurs in an article.
14992 #
14993 # html2html disabled for the same reason (whitespace insertion between
14994 # x and y).
14995 #
14996 # html2wt disabled because it localizes the "Category" namespace.
14997 !! test
14998 Link prefix/suffixes aren't applied to category links
14999 !! options
15000 parsoid=wt2html
15001 language=is
15002 !! wikitext
15003 x[[Category:Foo]]y
15004 !! html/php
15005 <p>xy
15006 </p>
15007 !! html/parsoid
15008 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
15009 !! end
15010
15011 !! test
15012 Parsoid: Serialize link to file page with colon escape
15013 !! options
15014 parsoid
15015 !! wikitext
15016
15017 [[:File:Foo.png]]
15018 [[:File:Foo.png|Bar]]
15019 !! html
15020 <p>
15021 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
15022 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
15023 </p>
15024 !! end
15025
15026 !! test
15027 Parsoid: Serialize a genuine category link without colon escape
15028 !! options
15029 parsoid
15030 !! wikitext
15031 [[Category:Foo]]
15032 [[Category:Foo|Bar]]
15033 !! html
15034 <link rel="mw:PageProp/Category" href="./Category:Foo">
15035 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
15036 !! end
15037
15038 !! test
15039 Normalize hrefs properly before testing for invalid link targets (bug 70894)
15040 !! options
15041 parsoid=html2wt
15042 !! html/parsoid
15043 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
15044 !! wikitext
15045 [[Category:Toxine bactérienne]]
15046 !! end
15047
15048 !! test
15049 Parsoid: Defaultsort
15050 !! wikitext
15051 {{DEFAULTSORT:Foo}}
15052 !! html/parsoid
15053 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
15054 !! end
15055
15056 !! test
15057 Parsoid: Defaultsort (template-generated)
15058 !! wikitext
15059 {{{{echo|DEFAULTSORT}}:Foo}}
15060 !! html/parsoid
15061 <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}}]}'/>
15062 !! end
15063
15064 ###
15065 ### Inter-language links
15066 ###
15067 !! test
15068 Interlanguage links
15069 !! options
15070 ill
15071 !! wikitext
15072 [[es:Alimento]]
15073 [[fr:Nourriture]]
15074 [[zh:食品]]
15075 !! html/php
15076 es:Alimento fr:Nourriture zh:食品
15077 !! html/parsoid
15078 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
15079 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
15080 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
15081 !! end
15082
15083 !! test
15084 Duplicate interlanguage links (bug 24502)
15085 !! options
15086 ill
15087 !! wikitext
15088 [[es:1]]
15089 [[es:2]]
15090 [[fr:1]]
15091 [[fr:2]]
15092 !! html/php
15093 es:1 fr:1
15094 !! html/parsoid
15095 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
15096 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
15097 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
15098 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
15099 !! end
15100
15101 ###
15102 ### Sections
15103 ###
15104 !! test
15105 Basic section headings
15106 !! wikitext
15107 == Headline 1 ==
15108 Some text
15109
15110 ==Headline 2==
15111 More
15112 ===Smaller headline===
15113 Blah blah
15114 !! html
15115 <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>
15116 <p>Some text
15117 </p>
15118 <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>
15119 <p>More
15120 </p>
15121 <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>
15122 <p>Blah blah
15123 </p>
15124 !! end
15125
15126 !! test
15127 Section headings with TOC
15128 !! wikitext
15129 == Headline 1 ==
15130 === Subheadline 1 ===
15131 ===== Skipping a level =====
15132 ====== Skipping a level ======
15133
15134 == Headline 2 ==
15135 Some text
15136 ===Another headline===
15137 !! html
15138 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15139 <ul>
15140 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
15141 <ul>
15142 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
15143 <ul>
15144 <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>
15145 <ul>
15146 <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>
15147 </ul>
15148 </li>
15149 </ul>
15150 </li>
15151 </ul>
15152 </li>
15153 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
15154 <ul>
15155 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
15156 </ul>
15157 </li>
15158 </ul>
15159 </div>
15160
15161 <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>
15162 <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>
15163 <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>
15164 <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>
15165 <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>
15166 <p>Some text
15167 </p>
15168 <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>
15169
15170 !! end
15171
15172 !! test
15173 TOC anchors don't collide
15174 !! wikitext
15175 __FORCETOC__
15176 == Headline 2 ==
15177 == Headline ==
15178 == Headline 2 ==
15179 == Headline ==
15180 !! html/php
15181 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15182 <ul>
15183 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
15184 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
15185 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
15186 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
15187 </ul>
15188 </div>
15189
15190 <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>
15191 <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>
15192 <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>
15193 <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>
15194
15195 !! end
15196
15197 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
15198 !! test
15199 Handling of sections up to level 6 and beyond
15200 !! wikitext
15201 = Level 1 Heading=
15202 == Level 2 Heading==
15203 === Level 3 Heading===
15204 ==== Level 4 Heading====
15205 ===== Level 5 Heading=====
15206 ====== Level 6 Heading======
15207 ======= Level 7 Heading=======
15208 ======== Level 8 Heading========
15209 ========= Level 9 Heading=========
15210 ========== Level 10 Heading==========
15211 !! html
15212 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15213 <ul>
15214 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
15215 <ul>
15216 <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>
15217 <ul>
15218 <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>
15219 <ul>
15220 <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>
15221 <ul>
15222 <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>
15223 <ul>
15224 <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>
15225 <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>
15226 <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>
15227 <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>
15228 <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>
15229 </ul>
15230 </li>
15231 </ul>
15232 </li>
15233 </ul>
15234 </li>
15235 </ul>
15236 </li>
15237 </ul>
15238 </li>
15239 </ul>
15240 </div>
15241
15242 <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>
15243 <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>
15244 <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>
15245 <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>
15246 <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>
15247 <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>
15248 <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>
15249 <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>
15250 <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>
15251 <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>
15252
15253 !! end
15254
15255 !! test
15256 TOC regression (T11764)
15257 !! wikitext
15258 == title 1 ==
15259 === title 1.1 ===
15260 ==== title 1.1.1 ====
15261 === title 1.2 ===
15262 == title 2 ==
15263 === title 2.1 ===
15264 !! html
15265 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15266 <ul>
15267 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15268 <ul>
15269 <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>
15270 <ul>
15271 <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>
15272 </ul>
15273 </li>
15274 <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>
15275 </ul>
15276 </li>
15277 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15278 <ul>
15279 <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>
15280 </ul>
15281 </li>
15282 </ul>
15283 </div>
15284
15285 <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>
15286 <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>
15287 <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>
15288 <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>
15289 <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>
15290 <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>
15291
15292 !! end
15293
15294 !! test
15295 TOC for heading containing <span id="..."></span> (T96153)
15296 !! wikitext
15297 __FORCETOC__
15298 ==<span id="old-anchor"></span>New title==
15299 !! html/php
15300 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15301 <ul>
15302 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
15303 </ul>
15304 </div>
15305
15306 <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>
15307
15308 !! end
15309
15310 !! test
15311 TOC with wgMaxTocLevel=3 (bug 6204)
15312 !! options
15313 wgMaxTocLevel=3
15314 !! wikitext
15315 == title 1 ==
15316 === title 1.1 ===
15317 ==== title 1.1.1 ====
15318 === title 1.2 ===
15319 == title 2 ==
15320 === title 2.1 ===
15321 !! html
15322 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15323 <ul>
15324 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15325 <ul>
15326 <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>
15327 <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>
15328 </ul>
15329 </li>
15330 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15331 <ul>
15332 <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>
15333 </ul>
15334 </li>
15335 </ul>
15336 </div>
15337
15338 <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>
15339 <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>
15340 <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>
15341 <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>
15342 <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>
15343 <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>
15344
15345 !! end
15346
15347 !! test
15348 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
15349 !! options
15350 wgMaxTocLevel=3
15351 !! wikitext
15352 ==Section 1==
15353 ===Section 1.1===
15354 ====Section 1.1.1====
15355 ====Section 1.1.1.1====
15356 ==Section 2==
15357 !! html
15358 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15359 <ul>
15360 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15361 <ul>
15362 <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>
15363 </ul>
15364 </li>
15365 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15366 </ul>
15367 </div>
15368
15369 <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>
15370 <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>
15371 <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>
15372 <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>
15373 <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>
15374
15375 !! end
15376
15377
15378 !! test
15379 Resolving duplicate section names
15380 !! wikitext
15381 == Foo bar ==
15382 == Foo bar ==
15383 !! html
15384 <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>
15385 <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>
15386
15387 !! end
15388
15389 !! test
15390 Resolving duplicate section names with differing case (bug 10721)
15391 !! wikitext
15392 == Foo bar ==
15393 == Foo Bar ==
15394 !! html
15395 <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>
15396 <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>
15397
15398 !! end
15399
15400 !! article
15401 Template:sections
15402 !! text
15403 ===Section 1===
15404 ==Section 2==
15405 !! endarticle
15406
15407 !! test
15408 Template with sections, __NOTOC__
15409 !! wikitext
15410 __NOTOC__
15411 ==Section 0==
15412 {{sections}}
15413 ==Section 4==
15414 !! html
15415 <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>
15416 <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>
15417 <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>
15418 <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>
15419
15420 !! end
15421
15422 !! test
15423 __NOEDITSECTION__ keyword
15424 !! wikitext
15425 __NOEDITSECTION__
15426 ==Section 1==
15427 ==Section 2==
15428 !! html
15429 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15430 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15431
15432 !! end
15433
15434 !! test
15435 Link inside a section heading
15436 !! wikitext
15437 ==Section with a [[Main Page|link]] in it==
15438 !! html
15439 <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>
15440
15441 !! end
15442
15443 !! test
15444 TOC regression (T14077)
15445 !! wikitext
15446 __TOC__
15447 == title 1 ==
15448 === title 1.1 ===
15449 == title 2 ==
15450 !! html
15451 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15452 <ul>
15453 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15454 <ul>
15455 <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>
15456 </ul>
15457 </li>
15458 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15459 </ul>
15460 </div>
15461
15462 <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>
15463 <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>
15464 <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>
15465
15466 !! end
15467
15468 !! test
15469 BUG 1219 URL next to image (good)
15470 !! wikitext
15471 http://example.com [[File:Foobar.jpg]]
15472 !! html/php
15473 <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>
15474 </p>
15475 !! html/parsoid
15476 <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>
15477 !!end
15478
15479 !! test
15480 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
15481 !! wikitext
15482 ===
15483 The line above must have a trailing space!
15484 === <!--
15485 --> <!-- -->
15486 But just in case it doesn't...
15487 !! html
15488 <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>
15489 <p>The line above must have a trailing space!
15490 </p>
15491 <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>
15492 <p>But just in case it doesn't...
15493 </p>
15494 !! end
15495
15496 !! test
15497 Header with special characters (bug 25462)
15498 !! wikitext
15499 The tooltips shall not show entities to the user (ie. be double escaped)
15500
15501 == text > text ==
15502 section 1
15503
15504 == text < text ==
15505 section 2
15506
15507 == text & text ==
15508 section 3
15509
15510 == text ' text ==
15511 section 4
15512
15513 == text " text ==
15514 section 5
15515 !! html
15516 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15517 </p>
15518 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15519 <ul>
15520 <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>
15521 <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>
15522 <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>
15523 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15524 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15525 </ul>
15526 </div>
15527
15528 <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>
15529 <p>section 1
15530 </p>
15531 <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>
15532 <p>section 2
15533 </p>
15534 <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>
15535 <p>section 3
15536 </p>
15537 <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>
15538 <p>section 4
15539 </p>
15540 <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>
15541 <p>section 5
15542 </p>
15543 !! end
15544
15545 !! test
15546 Header with space, plus and underscore as entity
15547 !! wikitext
15548 Id should not contain + for spaces
15549
15550 == Space between Text ==
15551 section 1
15552
15553 == Space-Entity&#32;between&#32;Text ==
15554 section 2
15555
15556 == Plus+between+Text ==
15557 section 3
15558
15559 == Plus-Entity&#43;between&#43;Text ==
15560 section 4
15561
15562 == Underscore_between_Text ==
15563 section 5
15564
15565 == Underscore-Entity&#95;between&#95;Text ==
15566 section 6
15567
15568 [[#Space between Text]]
15569 [[#Space-Entity&#32;between&#32;Text]]
15570 [[#Plus+between+Text]]
15571 [[#Plus-Entity&#43;between&#43;Text]]
15572 [[#Underscore_between_Text]]
15573 [[#Underscore-Entity&#95;between&#95;Text]]
15574 !! html
15575 <p>Id should not contain + for spaces
15576 </p>
15577 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15578 <ul>
15579 <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>
15580 <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>
15581 <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>
15582 <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>
15583 <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>
15584 <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>
15585 </ul>
15586 </div>
15587
15588 <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>
15589 <p>section 1
15590 </p>
15591 <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>
15592 <p>section 2
15593 </p>
15594 <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>
15595 <p>section 3
15596 </p>
15597 <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>
15598 <p>section 4
15599 </p>
15600 <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>
15601 <p>section 5
15602 </p>
15603 <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>
15604 <p>section 6
15605 </p><p><a href="#Space_between_Text">#Space between Text</a>
15606 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15607 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15608 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15609 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15610 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15611 </p>
15612 !! end
15613
15614 !! test
15615 Headers with excess '=' characters
15616 (Are similar tests necessary beyond the 1st level?)
15617 !! wikitext
15618 =foo==
15619 ==foo=
15620 =''italic'' heading==
15621 ==''italic'' heading=
15622 !! html
15623 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15624 <ul>
15625 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15626 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15627 <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>
15628 <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>
15629 </ul>
15630 </div>
15631
15632 <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>
15633 <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>
15634 <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>
15635 <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>
15636
15637 !! end
15638
15639 !! test
15640 HTML headers vs TOC (bug 23393)
15641 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15642 !! wikitext
15643 <h1>Header 1</h1>
15644 == Header 1.1 ==
15645 == Header 1.2 ==
15646
15647 <h1>Header 2
15648 </h1>
15649 == Header 2.1 ==
15650 == Header 2.2 ==
15651 __NOEDITSECTION__
15652 !! html
15653 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15654 <ul>
15655 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15656 <ul>
15657 <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>
15658 <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>
15659 </ul>
15660 </li>
15661 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15662 <ul>
15663 <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>
15664 <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>
15665 </ul>
15666 </li>
15667 </ul>
15668 </div>
15669
15670 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15671 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15672 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15673 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15674 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15675 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15676
15677 !! end
15678
15679 !! test
15680 Single-line or multiline-comments can follow headings
15681 !! options
15682 parsoid=wt2html,wt2wt
15683 !! wikitext
15684 ==foo==<!---->
15685 ==bar==<!--c1-->
15686 ==baz==<!--
15687 c2
15688 c3-->
15689 !! html
15690 <h2><span class="mw-headline" id="foo">foo</span></h2>
15691 <h2><span class="mw-headline" id="bar">bar</span></h2>
15692 <h2><span class="mw-headline" id="baz">baz</span></h2>
15693
15694 !! end
15695
15696 !! test
15697 BUG 1219 URL next to image (broken)
15698 !! wikitext
15699 http://example.com[[File:Foobar.jpg]]
15700 !! html/php
15701 <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>
15702 </p>
15703 !! html/parsoid
15704 <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>
15705 !!end
15706
15707 !! test
15708 Bug 1186 news: in the middle of text
15709 !! wikitext
15710 http://en.wikinews.org/wiki/Wikinews:Workplace
15711 !! html
15712 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15713 </p>
15714 !!end
15715
15716
15717 !! test
15718 Namespaced link must have a title
15719 !! wikitext
15720 [[Project:]]
15721 !! html
15722 <p>[[Project:]]
15723 </p>
15724 !!end
15725
15726 !! test
15727 Namespaced link must have a title (bad fragment version)
15728 !! wikitext
15729 [[Project:#fragment]]
15730 !! html
15731 <p>[[Project:#fragment]]
15732 </p>
15733 !!end
15734
15735
15736 ###
15737 ### HTML tags and HTML attributes
15738 ###
15739
15740 !! test
15741 div with no attributes
15742 !! wikitext
15743 <div>HTML rocks</div>
15744 !! html
15745 <div>HTML rocks</div>
15746
15747 !! end
15748
15749 !! test
15750 div with double-quoted attribute
15751 !! wikitext
15752 <div id="rock">HTML rocks</div>
15753 !! html
15754 <div id="rock">HTML rocks</div>
15755
15756 !! end
15757
15758 !! test
15759 div with single-quoted attribute
15760 !! wikitext
15761 <div id='rock'>HTML rocks</div>
15762 !! html
15763 <div id="rock">HTML rocks</div>
15764
15765 !! end
15766
15767 !! test
15768 div with unquoted attribute
15769 !! wikitext
15770 <div id=rock>HTML rocks</div>
15771 !! html
15772 <div id="rock">HTML rocks</div>
15773
15774 !! end
15775
15776 !! test
15777 div with illegal double attributes
15778 !! wikitext
15779 <div id="a" id="b">HTML rocks</div>
15780 !! html
15781 <div id="b">HTML rocks</div>
15782
15783 !!end
15784
15785 !! test
15786 div with empty attribute value, space before equals
15787 !! options
15788 parsoid=wt2html,html2html
15789 !! wikitext
15790 <div class =>HTML rocks</div>
15791 !! html/php
15792 <div class="">HTML rocks</div>
15793
15794 !! html/parsoid
15795 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15796 !! end
15797
15798 !! test
15799 div with multiple empty attribute values
15800 !! options
15801 parsoid=wt2html,html2html
15802 !! wikitext
15803 <div id= title=>HTML rocks</div>
15804 !! html/php
15805 <div id="title.3D">HTML rocks</div>
15806
15807 !! html/parsoid
15808 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15809 !! end
15810
15811 !! test
15812 table with multiple empty attribute values
15813 !! options
15814 parsoid=wt2html,html2html
15815 !! wikitext
15816 {| title= id=
15817 | hi
15818 |}
15819 !! html/php
15820 <table title="id=">
15821 <tr>
15822 <td> hi
15823 </td></tr></table>
15824
15825 !! html/parsoid
15826 <table title="id=">
15827 <tbody><tr><td> hi</td></tr>
15828 </tbody></table>
15829 !! end
15830
15831 !! test
15832 div with braces in attribute value
15833 !! wikitext
15834 <div title="{}">Foo</div>
15835 !! html/php
15836 <div title="&#123;}">Foo</div>
15837
15838 !! html/parsoid
15839 <div title="{}">Foo</div>
15840 !! end
15841
15842 !! test
15843 div with empty attribute value, no space before equals
15844 !! options
15845 parsoid=wt2html,html2html
15846 !! wikitext
15847 <div class=>HTML rocks</div>
15848 !! html/php
15849 <div class="">HTML rocks</div>
15850
15851 !! html/parsoid
15852 <div class="">HTML rocks</div>
15853 !! end
15854
15855 !! test
15856 HTML multiple attributes correction
15857 !! wikitext
15858 <p class="error" class="awesome">Awesome!</p>
15859 !! html
15860 <p class="awesome">Awesome!</p>
15861
15862 !!end
15863
15864 !! test
15865 Table multiple attributes correction
15866 !! wikitext
15867 {|
15868 !+ class="error" class="awesome"| status
15869 |}
15870 !! html
15871 <table>
15872 <tr>
15873 <th class="awesome"> status
15874 </th></tr></table>
15875
15876 !!end
15877
15878 !! test
15879 DIV IN UPPERCASE
15880 !! wikitext
15881 <DIV ID="x">HTML ROCKS</DIV>
15882 !! html
15883 <div id="x">HTML ROCKS</div>
15884
15885 !!end
15886
15887 !! test
15888 Non-ASCII pseudo-tags are rendered as text
15889 !! wikitext
15890 <khyô>
15891 !! html
15892 <p>&lt;khyô&gt;
15893 </p>
15894 !! end
15895
15896 !! test
15897 Pseudo-tag with URL 'name' renders as url link
15898 !! wikitext
15899 <http://example.com/>
15900 !! html
15901 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
15902 </p>
15903 !! end
15904
15905 !! test
15906 text with amp in the middle of nowhere
15907 !! wikitext
15908 Remember AT&T?
15909 !! html
15910 <p>Remember AT&amp;T?
15911 </p>
15912 !! end
15913
15914 !! test
15915 text with character entity: eacute
15916 !! wikitext
15917 I always thought &eacute; was a cute letter.
15918 !! html
15919 <p>I always thought &#233; was a cute letter.
15920 </p>
15921 !! html+tidy
15922 <p>I always thought é was a cute letter.</p>
15923 !! end
15924
15925 !! test
15926 text with entity-escaped character entity-like string: eacute
15927 !! wikitext
15928 I always thought &amp;eacute; was a cute letter.
15929 !! html
15930 <p>I always thought &amp;eacute; was a cute letter.
15931 </p>
15932 !! end
15933
15934 !! test
15935 text with undefined character entity: xacute
15936 !! wikitext
15937 I always thought &xacute; was a cute letter.
15938 !! html
15939 <p>I always thought &amp;xacute; was a cute letter.
15940 </p>
15941 !! end
15942
15943 !! test
15944 HTML5 tags
15945 !! wikitext
15946 <data value="5">five</data>
15947 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15948 <mark>This highlighted text</mark>
15949 !! html
15950 <p><data value="5">five</data>
15951 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15952 <mark>This highlighted text</mark>
15953 </p>
15954 !! end
15955
15956 !! test
15957 HTML tag with leading space is parsed as text
15958 !! wikitext
15959 < div>foo< /div>
15960 !! html
15961 <p>&lt; div&gt;foo&lt; /div&gt;
15962 </p>
15963 !! end
15964
15965 ###
15966 ### Nesting tests (see bug 41545, 50604, 51081)
15967 ###
15968
15969 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
15970 # Note that html2wt is considerably more difficult if we use <b> in
15971 # the test case, instead of <big>
15972 !! test
15973 Ensure that HTML adoption agency algorithm is properly implemented.
15974 !! wikitext
15975 <big>X<big>Y</big>Z</big>
15976 !! html
15977 <p><big>X<big>Y</big>Z</big>
15978 </p>
15979 !! end
15980
15981 # This was bug 41545 in the PHP parser.
15982 # Note that tidy doesn't handle this correctly.
15983 !! test
15984 Nesting of <kbd>
15985 !! wikitext
15986 <kbd>X<kbd>Y</kbd>Z</kbd>
15987 !! html
15988 <p><kbd>X<kbd>Y</kbd>Z</kbd>
15989 </p>
15990 !! end
15991
15992 # The following cases were bug 51081 in the PHP parser.
15993 # Note that there are some other nestable tags (b, i, etc) which are
15994 # not covered; see bug 51081 for discussion.
15995
15996 # Note that tidy doesn't handle this correctly.
15997 !! test
15998 Nesting of <em>
15999 !! wikitext
16000 <em>X<em>Y</em>Z</em>
16001 !! html
16002 <p><em>X<em>Y</em>Z</em>
16003 </p>
16004 !! end
16005
16006 # Note that tidy doesn't handle this correctly.
16007 !! test
16008 Nesting of <strong>
16009 !! wikitext
16010 <strong>X<strong>Y</strong>Z</strong>
16011 !! html
16012 <p><strong>X<strong>Y</strong>Z</strong>
16013 </p>
16014 !! end
16015
16016 !! test
16017 Nesting of <q>
16018 !! wikitext
16019 <q>X<q>Y</q>Z</q>
16020 !! html+tidy
16021 <p><q>X<q>Y</q>Z</q></p>
16022 !! end
16023
16024 # Note that tidy doesn't handle this correctly.
16025 !! test
16026 Nesting of <ruby>
16027 !! wikitext
16028 <ruby>X<ruby>Y</ruby>Z</ruby>
16029 !! html
16030 <p><ruby>X<ruby>Y</ruby>Z</ruby>
16031 </p>
16032 !! end
16033
16034 # Note that tidy doesn't handle this correctly.
16035 !! test
16036 Nesting of <bdo>
16037 !! wikitext
16038 <bdo>X<bdo>Y</bdo>Z</bdo>
16039 !! html
16040 <p><bdo>X<bdo>Y</bdo>Z</bdo>
16041 </p>
16042 !! end
16043
16044
16045 ###
16046 ### Media links
16047 ###
16048
16049 !! test
16050 Media link
16051 !! wikitext
16052 [[Media:Foobar.jpg]]
16053 !! html
16054 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
16055 </p>
16056 !! end
16057
16058 !! test
16059 Media link with text
16060 !! wikitext
16061 [[Media:Foobar.jpg|A neat file to look at]]
16062 !! html
16063 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
16064 </p>
16065 !! end
16066
16067 # FIXME: this is still bad HTML tag nesting
16068 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
16069 !! test
16070 Media link with nasty text
16071 !! wikitext
16072 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
16073 !! html
16074 <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>
16075
16076 !! html+tidy
16077 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
16078 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
16079 !! end
16080
16081 !! test
16082 Media link to nonexistent file (bug 1702)
16083 !! wikitext
16084 [[Media:No such.jpg]]
16085 !! html
16086 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
16087 </p>
16088 !! end
16089
16090 !! test
16091 Image link to nonexistent file (bug 1850 - good)
16092 !! wikitext
16093 [[File:No_such.jpg]]
16094 !! html/php
16095 <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>
16096 </p>
16097 !! html/parsoid
16098 <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>
16099 !! end
16100
16101 !! test
16102 :Image link to nonexistent file (bug 1850 - bad)
16103 !! wikitext
16104 [[:Image:No such.jpg]]
16105 !! html/php
16106 <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>
16107 </p>
16108 !! html/parsoid
16109 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
16110 !! end
16111
16112
16113
16114 !! test
16115 Character reference normalization in link text (bug 1938)
16116 !! wikitext
16117 [[Main Page|this&that]]
16118 !! html
16119 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
16120 </p>
16121 !!end
16122
16123 !! article
16124 אַ
16125 !! text
16126 Test for unicode normalization
16127
16128 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
16129 !! endarticle
16130
16131 !! test
16132 (bug 19451) Links should refer to the normalized form.
16133 !! wikitext
16134 [[&#xFB2E;]]
16135 [[&#x5d0;&#x5b7;]]
16136 [[&#x5d0;ַ]]
16137 [[א&#x5b7;]]
16138 [[אַ]]
16139 !! html
16140 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
16141 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
16142 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
16143 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
16144 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
16145 </p>
16146 !! end
16147
16148 !! test
16149 Empty attribute crash test (bug 2067)
16150 !! wikitext
16151 <font color="">foo</font>
16152 !! html
16153 <p><font color="">foo</font>
16154 </p>
16155 !! end
16156
16157 !! test
16158 Empty attribute crash test single-quotes (bug 2067)
16159 !! wikitext
16160 <font color=''>foo</font>
16161 !! html
16162 <p><font color="">foo</font>
16163 </p>
16164 !! end
16165
16166 !! test
16167 Attribute test: equals, then nothing
16168 !! options
16169 parsoid=wt2html,html2html
16170 !! wikitext
16171 <font color=>foo</font>
16172 !! html/php
16173 <p><font color="">foo</font>
16174 </p>
16175 !! html/parsoid
16176 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
16177 !! end
16178
16179 !! test
16180 Attribute test: unquoted value
16181 !! options
16182 parsoid=wt2html,html2html
16183 !! wikitext
16184 <font color=x>foo</font>
16185 !! html/php
16186 <p><font color="x">foo</font>
16187 </p>
16188 !! html/parsoid
16189 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
16190 !! end
16191
16192 !! test
16193 Attribute test: unquoted but illegal value (hash)
16194 !! wikitext
16195 <font color=#x>foo</font>
16196 !! html
16197 <p><font color="#x">foo</font>
16198 </p>
16199 !! end
16200
16201 # Parsoid does not serialize to empty attribute syntax,
16202 # so wt2wt and html2wt cases are skipped
16203 !! test
16204 Attribute test: no value (T54330)
16205 !! options
16206 parsoid=wt2html,html2html
16207 !! wikitext
16208 <font color>foo</font>
16209 !! html/php
16210 <p><font color="">foo</font>
16211 </p>
16212 !! html/parsoid
16213 <p><font color="">foo</font></p>
16214 !! end
16215
16216 !! test
16217 Bug 2095: link with three closing brackets
16218 !! wikitext
16219 [[Main Page]]]
16220 !! html/php
16221 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
16222 </p>
16223 !! html/parsoid
16224 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
16225 !! end
16226
16227 !! test
16228 Bug 2095: link with pipe and three closing brackets
16229 !! wikitext
16230 [[Main Page|link]]]
16231 !! html/php
16232 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
16233 </p>
16234 !! html/parsoid
16235 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
16236 !! end
16237
16238 !! test
16239 Bug 2095: link with pipe and three closing brackets, version 2
16240 !! wikitext
16241 [[Main Page|[http://example.com/]]]
16242 !! html/php
16243 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
16244 </p>
16245 !! html/parsoid
16246 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
16247 !! end
16248
16249
16250 ###
16251 ### Safety
16252 ###
16253
16254 !! article
16255 Template:Dangerous attribute
16256 !! text
16257 " onmouseover="alert(document.cookie)
16258 !! endarticle
16259
16260 !! article
16261 Template:Dangerous style attribute
16262 !! text
16263 border-size: expression(alert(document.cookie))
16264 !! endarticle
16265
16266 !! article
16267 Template:Div style
16268 !! text
16269 <div style="float: right; {{{1}}}">Magic div</div>
16270 !! endarticle
16271
16272 !! test
16273 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
16274 !! wikitext
16275 <div title="{{test}}"></div>
16276 !! html
16277 <div title="This is a test template"></div>
16278
16279 !! end
16280
16281 # Parsoid has enough context to handle this case
16282 !! test
16283 Bug 2304: HTML attribute safety (dangerous template; 2309)
16284 !! wikitext
16285 <div title="{{dangerous attribute}}"></div>
16286 !! html/php
16287 <div title=""></div>
16288
16289 !! html/parsoid
16290 <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>
16291 !! end
16292
16293 !! test
16294 Bug 2304: HTML attribute safety (dangerous style template; 2309)
16295 !! wikitext
16296 <div style="{{dangerous style attribute}}"></div>
16297 !! html
16298 <div style="/* insecure input */"></div>
16299
16300 !! end
16301
16302 !! test
16303 Bug 2304: HTML attribute safety (safe parameter; 2309)
16304 !! wikitext
16305 {{div style|width: 200px}}
16306 !! html
16307 <div style="float: right; width: 200px">Magic div</div>
16308
16309 !! end
16310
16311 !! test
16312 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
16313 !! wikitext
16314 {{div style|width: expression(alert(document.cookie))}}
16315 !! html
16316 <div style="/* insecure input */">Magic div</div>
16317
16318 !! end
16319
16320 !! test
16321 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
16322 !! wikitext
16323 {{div style|"><script>alert(document.cookie)</script>}}
16324 !! html
16325 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16326
16327 !! end
16328
16329 !! test
16330 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
16331 !! wikitext
16332 {{div style|" ><script>alert(document.cookie)</script>}}
16333 !! html
16334 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16335
16336 !! end
16337
16338 !! test
16339 Bug 2304: HTML attribute safety (link)
16340 !! wikitext
16341 <div title="[[Main Page]]"></div>
16342 !! html
16343 <div title="&#91;&#91;Main Page]]"></div>
16344
16345 !! end
16346
16347 !! test
16348 Bug 2304: HTML attribute safety (italics)
16349 !! wikitext
16350 <div title="''foobar''"></div>
16351 !! html
16352 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16353
16354 !! end
16355
16356 !! test
16357 Bug 2304: HTML attribute safety (bold)
16358 !! wikitext
16359 <div title="'''foobar'''"></div>
16360 !! html
16361 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16362
16363 !! end
16364
16365
16366 !! test
16367 Bug 2304: HTML attribute safety (ISBN)
16368 !! wikitext
16369 <div title="ISBN 1234567890"></div>
16370 !! html
16371 <div title="&#73;SBN 1234567890"></div>
16372
16373 !! end
16374
16375 !! test
16376 Bug 2304: HTML attribute safety (RFC)
16377 !! wikitext
16378 <div title="RFC 1234"></div>
16379 !! html
16380 <div title="&#82;FC 1234"></div>
16381
16382 !! end
16383
16384 !! test
16385 Bug 2304: HTML attribute safety (PMID)
16386 !! wikitext
16387 <div title="PMID 1234567890"></div>
16388 !! html
16389 <div title="&#80;MID 1234567890"></div>
16390
16391 !! end
16392
16393 !! test
16394 Bug 2304: HTML attribute safety (web link)
16395 !! wikitext
16396 <div title="http://example.com/"></div>
16397 !! html
16398 <div title="http&#58;//example.com/"></div>
16399
16400 !! end
16401
16402 !! test
16403 Bug 2304: HTML attribute safety (named web link)
16404 !! wikitext
16405 <div title="[http://example.com/ link]"></div>
16406 !! html
16407 <div title="&#91;http&#58;//example.com/ link]"></div>
16408
16409 !! end
16410
16411 !! test
16412 Bug 3244: HTML attribute safety (extension; safe)
16413 !! wikitext
16414 <div style="<nowiki>background:blue</nowiki>"></div>
16415 !! html
16416 <div style="background:blue"></div>
16417
16418 !! end
16419
16420 !! test
16421 Bug 3244: HTML attribute safety (extension; unsafe)
16422 !! wikitext
16423 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16424 !! html
16425 <div style="/* insecure input */"></div>
16426
16427 !! end
16428
16429 # More MSIE fun discovered by Tom Gilder
16430
16431 !! test
16432 MSIE CSS safety test: spurious slash
16433 !! wikitext
16434 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16435 !! html
16436 <div style="/* insecure input */">evil</div>
16437
16438 !! end
16439
16440 !! test
16441 MSIE CSS safety test: hex code
16442 !! wikitext
16443 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16444 !! html
16445 <div style="/* insecure input */">evil</div>
16446
16447 !! end
16448
16449 !! test
16450 MSIE CSS safety test: comment in url
16451 !! wikitext
16452 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16453 !! html
16454 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16455
16456 !! end
16457
16458 !! test
16459 MSIE CSS safety test: comment in expression
16460 !! wikitext
16461 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16462 !! html
16463 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16464
16465 !! end
16466
16467 !! test
16468 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
16469 !! wikitext
16470 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16471 !! html
16472 <p style="/* invalid control char */">A</p>
16473
16474 !! end
16475
16476 !! test
16477 MSIE 6 CSS safety test: Fullwidth (bug 55332)
16478 !! wikitext
16479 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16480 <div style="top:EXPRESSION(alert())">B</div>
16481 !! html
16482 <p style="/* insecure input */">A</p>
16483 <div style="/* insecure input */">B</div>
16484
16485 !! end
16486
16487 !! test
16488 MSIE 6 CSS safety test: IPA extensions (bug 55332)
16489 !! wikitext
16490 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16491 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16492 !! html
16493 <div style="/* insecure input */">A</div>
16494 <p style="/* insecure input */">B</p>
16495
16496 !! end
16497
16498 !! test
16499 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16500 !! wikitext
16501 <div style="background-image:url⁽javascript:alert())">A</div>
16502 <div style="background-image:url₍javascript:alert())">B</div>
16503 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16504 !! html
16505 <div style="/* insecure input */">A</div>
16506 <div style="/* insecure input */">B</div>
16507 <p style="/* insecure input */">C</p>
16508
16509 !! end
16510
16511 # FIXME: Parsoid fails to sanitize this! See T58846.
16512 !! test
16513 Opera -o-link CSS
16514 !! wikitext
16515 <div
16516 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;"
16517 style="-o-link:attr(title);-o-link-source:current">X</div>
16518 !! html
16519 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16520
16521 !! end
16522
16523 !! test
16524 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16525 !! wikitext
16526 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16527 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16528 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16529 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16530 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16531 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16532 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16533 !! html
16534 <p style="/* insecure input */">A</p>
16535 <p style="/* insecure input */">B</p>
16536 <p style="/* insecure input */">C</p>
16537 <p style="/* insecure input */">D</p>
16538 <p style="/* insecure input */">E</p>
16539 <p style="/* insecure input */">F</p>
16540 <p style="/* insecure input */">G</p>
16541
16542 !! end
16543
16544 !! test
16545 Table attribute legitimate extension
16546 !! wikitext
16547 {|
16548 !+ style="<nowiki>color:blue</nowiki>"| status
16549 |}
16550 !! html
16551 <table>
16552 <tr>
16553 <th style="color:blue"> status
16554 </th></tr></table>
16555
16556 !!end
16557
16558 !! test
16559 Table attribute safety
16560 !! wikitext
16561 {|
16562 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16563 |}
16564 !! html
16565 <table>
16566 <tr>
16567 <th style="/* insecure input */"> status
16568 </th></tr></table>
16569
16570 !! end
16571
16572 !! test
16573 CSS line continuation 1
16574 !! wikitext
16575 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16576 !! html
16577 <div style="/* insecure input */"></div>
16578
16579 !! end
16580
16581 !! test
16582 CSS line continuation 2
16583 !! wikitext
16584 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16585 !! html
16586 <div style="/* invalid control char */"></div>
16587
16588 !! end
16589
16590 !! article
16591 Template:Identity
16592 !! text
16593 {{{1}}}
16594 !! endarticle
16595
16596 !! test
16597 Expansion of multi-line templates in attribute values (bug 6255)
16598 !! wikitext
16599 <div style="background: {{identity|#00FF00}}">-</div>
16600 !! html
16601 <div style="background: #00FF00">-</div>
16602
16603 !! end
16604
16605
16606 !! test
16607 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16608 !! wikitext
16609 <div style="background:
16610 #00FF00">-</div>
16611 !! html/php
16612 <div style="background: #00FF00">-</div>
16613
16614 !! html/parsoid
16615 <div style="background:
16616 #00FF00">-</div>
16617 !! end
16618
16619 !! test
16620 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16621 !! wikitext
16622 <div style="background: &#10;#00FF00">-</div>
16623 !! html
16624 <div style="background: &#10;#00FF00">-</div>
16625
16626 !! end
16627
16628 !! test
16629 evil <math>-wiki-tags without Extension:Math enabled
16630 !! wikitext
16631 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
16632 !! html+tidy
16633 <p>&lt;math&gt;&lt;img src="some evil external link"&gt;&lt;script&gt;some_evil_javascript();&lt;/script&gt;&lt;/math&gt;</p>
16634 !! end
16635
16636 ###
16637 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16638 ###
16639 !! test
16640 Parser hook: empty input
16641 !! wikitext
16642 <tag></tag>
16643 !! html/php
16644 <pre>
16645 ''
16646 array (
16647 )
16648 </pre>
16649
16650 !! html/parsoid
16651 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16652 !! end
16653
16654 ## Don't expect parsoid to rt this form.
16655 !! test
16656 Parser hook: empty input using terminated empty elements
16657 !! options
16658 parsoid=wt2html,html2html
16659 !! wikitext
16660 <tag/>
16661 !! html/php
16662 <pre>
16663 NULL
16664 array (
16665 )
16666 </pre>
16667
16668 !! html/parsoid
16669 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16670 !! end
16671
16672 !! test
16673 Parser hook: empty input using terminated empty elements (space before)
16674 !! wikitext
16675 <tag />
16676 !! html/php
16677 <pre>
16678 NULL
16679 array (
16680 )
16681 </pre>
16682
16683 !! html/parsoid
16684 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16685 !! end
16686
16687 !! test
16688 Parser hook: basic input
16689 !! wikitext
16690 <tag>input</tag>
16691 !! html/php
16692 <pre>
16693 'input'
16694 array (
16695 )
16696 </pre>
16697
16698 !! html/parsoid
16699 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16700 !! end
16701
16702 ## Don't expect parsoid to rt this form.
16703 !! test
16704 Parser hook: case insensitive
16705 !! options
16706 parsoid=wt2html,html2html
16707 !! wikitext
16708 <TAG>input</TAG>
16709 !! html/php
16710 <pre>
16711 'input'
16712 array (
16713 )
16714 </pre>
16715
16716 !! html/parsoid
16717 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16718 !! end
16719
16720 ## Don't expect parsoid to rt this form.
16721 !! test
16722 Parser hook: case insensitive, redux
16723 !! options
16724 parsoid=wt2html,html2html
16725 !! wikitext
16726 <TaG>input</TAg>
16727 !! html/php
16728 <pre>
16729 'input'
16730 array (
16731 )
16732 </pre>
16733
16734 !! html/parsoid
16735 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16736 !! end
16737
16738 !! test
16739 Parser hook: nested tags
16740 !! wikitext
16741 <tag><tag></tag></tag>
16742 !! html/php
16743 <pre>
16744 '<tag>'
16745 array (
16746 )
16747 </pre>&lt;/tag&gt;
16748
16749 !! html/parsoid
16750 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
16751 !! end
16752
16753 !! test
16754 Parser hook: basic arguments
16755 !! wikitext
16756 <tag width="200" height="100" depth="50" square=""></tag>
16757 !! html/php
16758 <pre>
16759 ''
16760 array (
16761 'width' => '200',
16762 'height' => '100',
16763 'depth' => '50',
16764 'square' => '',
16765 )
16766 </pre>
16767
16768 !! html/parsoid
16769 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16770 !! end
16771
16772 ## Don't expect parsoid to rt this form.
16773 !! test
16774 Parser hook: basic arguments, variations
16775 !! options
16776 parsoid=wt2html,html2html
16777 !! wikitext
16778 <tag width=200 height = "100" depth = '50' square></tag>
16779 !! html/php
16780 <pre>
16781 ''
16782 array (
16783 'width' => '200',
16784 'height' => '100',
16785 'depth' => '50',
16786 'square' => '',
16787 )
16788 </pre>
16789
16790 !! html/parsoid
16791 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16792 !! end
16793
16794 !! test
16795 Parser hook: argument containing a forward slash (bug 5344)
16796 !! wikitext
16797 <tag filename="/tmp/bla"></tag>
16798 !! html/php
16799 <pre>
16800 ''
16801 array (
16802 'filename' => '/tmp/bla',
16803 )
16804 </pre>
16805
16806 !! html/parsoid
16807 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16808 !! end
16809
16810 ## Don't expect parsoid to rt this form.
16811 !! test
16812 Parser hook: empty input using terminated empty elements (bug 2374)
16813 !! options
16814 parsoid=wt2html,html2html
16815 !! wikitext
16816 <tag foo=bar/>text
16817 !! html/php
16818 <pre>
16819 NULL
16820 array (
16821 'foo' => 'bar',
16822 )
16823 </pre>text
16824
16825 !! html/parsoid
16826 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
16827 !! end
16828
16829 ## </tag> should be output literally since there is no matching tag that begins it
16830 ## Don't expect parsoid to rt this form.
16831 !! test
16832 Parser hook: basic arguments using terminated empty elements (bug 2374)
16833 !! options
16834 parsoid=wt2html
16835 !! wikitext
16836 <tag width=200 height = "100" depth = '50' square/>
16837 other stuff
16838 </tag>
16839 !! html/php
16840 <pre>
16841 NULL
16842 array (
16843 'width' => '200',
16844 'height' => '100',
16845 'depth' => '50',
16846 'square' => '',
16847 )
16848 </pre>
16849 <p>other stuff
16850 &lt;/tag&gt;
16851 </p>
16852 !! html/parsoid
16853 <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
16854 &lt;/tag></p>
16855 !! end
16856
16857 ## Don't expect parsoid to rt this form.
16858 !! test
16859 Parser hook: Don't allow unclosed extension tags
16860 !! options
16861 parsoid=wt2html
16862 !! wikitext
16863 test <tag>123
16864
16865 this is a '''test'''
16866 !! html/php
16867 <p>test &lt;tag&gt;123
16868 </p><p>this is a <b>test</b>
16869 </p>
16870 !! html/parsoid
16871 <p>test &lt;tag>123</p>
16872
16873 <p>this is a <b>test</b></p>
16874 !! end
16875
16876 ###
16877 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
16878 ###
16879
16880 !! test
16881 Parser hook: static parser hook not inside a comment
16882 !! wikitext
16883 <statictag>hello, world</statictag>
16884
16885 <statictag action="flush" />
16886 !! html/php
16887 <p><br />
16888 hello, world
16889 </p>
16890 !! html/parsoid
16891 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
16892 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
16893 !! end
16894
16895 !! test
16896 Parser hook: static parser hook inside a comment
16897 !! wikitext
16898 <!-- <statictag>hello, world</statictag> -->
16899 <statictag action="flush" />
16900 !! html/php
16901 <p><br />
16902 </p>
16903 !! html/parsoid
16904 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
16905 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
16906 !! end
16907
16908 # Nested template calls; this case was broken by Parser.php rev 1.506,
16909 # since reverted.
16910
16911 !! article
16912 Template:One-parameter
16913 !! text
16914 (My parameter is: {{{1}}})
16915 !! endarticle
16916
16917 !! article
16918 Template:Map-one-parameter
16919 !! text
16920 {{{{{1}}}|{{{2}}}}}
16921 !! endarticle
16922
16923 !! test
16924 Nested template calls
16925 !! wikitext
16926 {{Map-one-parameter|One-parameter|param}}
16927 !! html
16928 <p>(My parameter is: param)
16929 </p>
16930 !! end
16931
16932
16933 ###
16934 ### Sanitizer
16935 ###
16936
16937 # HTML+Tidy effectively strips out the empty tags completely
16938 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
16939 # which Tidy would have done for the PHP parser had there been content inside it.
16940 !! test
16941 Sanitizer: Closing of open tags
16942 !! wikitext
16943 <s></s><table></table>
16944 !! html
16945 <s></s><table></table>
16946
16947 !! html/parsoid
16948 <p><s></s></p><table></table>
16949 !! end
16950
16951 !! test
16952 Sanitizer: Closing of open but not closed tags
16953 !! wikitext
16954 <s>foo
16955 !! html
16956 <p><s>foo</s>
16957 </p>
16958 !! end
16959
16960 !! test
16961 Sanitizer: Closing of closed but not open tags
16962 !! options
16963 parsoid=wt2html
16964 !! wikitext
16965 </s>
16966 !! html/php+tidy
16967 !! html/parsoid
16968 !! end
16969
16970 !! test
16971 Sanitizer: Closing of closed but not open table tags
16972 !! options
16973 parsoid=wt2html
16974 !! wikitext
16975 Table not started</td></tr></table>
16976 !! html/php+tidy
16977 <p>Table not started</p>
16978 !! html/parsoid
16979 <p>Table not started</p>
16980 !! end
16981
16982 !! test
16983 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
16984 !! wikitext
16985 <span id="æ: v">byte</span>[[#æ: v|backlink]]
16986 !! html
16987 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
16988 </p>
16989 !! end
16990
16991 # In HTML5, the restrictions are that id must contain at least one character,
16992 # and must not contain any space characters.
16993 !! test
16994 Sanitizer: Validating the contents of the id attribute (bug 4515)
16995 !! options
16996 disabled
16997 !! wikitext
16998 <br id="" /><br id="a space" />
16999 !! html
17000 Something ...
17001 !! end
17002
17003 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
17004 !! test
17005 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
17006 !! options
17007 disabled
17008 !! wikitext
17009 <br id="foo" /><br id="foo" />
17010 !! html
17011 Something need to be done. foo-2 ?
17012 !! end
17013
17014 !! test
17015 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
17016 !! wikitext
17017 <div itemscope>
17018 <meta itemprop="hello" content="world">
17019 <meta http-equiv="refresh" content="5">
17020 <meta itemprop="hello" http-equiv="refresh" content="5">
17021 <link itemprop="hello" href="{{SERVER}}">
17022 <link rel="stylesheet" href="{{SERVER}}">
17023 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
17024 </div>
17025 !! html
17026 <div itemscope="">
17027 <p> <meta itemprop="hello" content="world" />
17028 &lt;meta http-equiv="refresh" content="5"&gt;
17029 <meta itemprop="hello" content="5" />
17030 </p>
17031 <link itemprop="hello" href="http&#58;//example.org" />
17032 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
17033 <link itemprop="hello" href="http&#58;//example.org" />
17034 </div>
17035
17036 !! end
17037
17038 !! test
17039 Language converter: output gets cut off unexpectedly (bug 5757)
17040 !! options
17041 language=zh
17042 !! wikitext
17043 this bit is safe: }-
17044
17045 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
17046
17047 then we get cut off here: }-
17048
17049 all additional text is vanished
17050 !! html
17051 <p>this bit is safe: }-
17052 </p><p>but if we add a conversion instance: xxx
17053 </p><p>then we get cut off here: }-
17054 </p><p>all additional text is vanished
17055 </p>
17056 !! end
17057
17058 !! test
17059 Self closed html pairs (bug 5487)
17060 !! options
17061 !! wikitext
17062 <center><font id="bug" />Centered text</center>
17063 <div><font id="bug2" />In div text</div>
17064 !! html
17065 <center>&lt;font id="bug" /&gt;Centered text</center>
17066 <div>&lt;font id="bug2" /&gt;In div text</div>
17067
17068 !! end
17069
17070 #
17071 #
17072 #
17073
17074 !! test
17075 Punctuation: nbsp before exclamation
17076 !! wikitext
17077 C'est grave !
17078 !! html
17079 <p>C'est grave&#160;!
17080 </p>
17081 !! end
17082
17083 !! test
17084 Punctuation: CSS !important (bug 11874)
17085 !! wikitext
17086 <div style="width:50% !important">important</div>
17087 !! html
17088 <div style="width:50% !important">important</div>
17089
17090 !!end
17091
17092 !! test
17093 Punctuation: CSS ! important (bug 11874; with space after)
17094 !! wikitext
17095 <div style="width:50% ! important">important</div>
17096 !! html
17097 <div style="width:50% ! important">important</div>
17098
17099 !!end
17100
17101 !! test
17102 HTML bullet list, closed tags (bug 5497)
17103 !! wikitext
17104 <ul>
17105 <li>One</li>
17106 <li>Two</li>
17107 </ul>
17108 !! html/php
17109 <ul>
17110 <li>One</li>
17111 <li>Two</li>
17112 </ul>
17113
17114 !! html/parsoid
17115 <ul data-parsoid='{"stx":"html"}'>
17116 <li data-parsoid='{"stx":"html"}'>One</li>
17117 <li data-parsoid='{"stx":"html"}'>Two</li>
17118 </ul>
17119
17120 !! end
17121
17122 !! test
17123 HTML bullet list, unclosed tags (bug 5497)
17124 !! wikitext
17125 <ul>
17126 <li>One
17127 <li>Two
17128 </ul>
17129 !! html/php+tidy
17130 <ul>
17131 <li>One</li>
17132 <li>Two</li>
17133 </ul>
17134 !! html/parsoid
17135 <ul data-parsoid='{"stx":"html"}'>
17136 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17137 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17138 </ul>
17139
17140 !! end
17141
17142 !! test
17143 HTML ordered list, closed tags (bug 5497)
17144 !! wikitext
17145 <ol>
17146 <li>One</li>
17147 <li>Two</li>
17148 </ol>
17149 !! html/php
17150 <ol>
17151 <li>One</li>
17152 <li>Two</li>
17153 </ol>
17154
17155 !! html/parsoid
17156 <ol data-parsoid='{"stx":"html"}'>
17157 <li data-parsoid='{"stx":"html"}'>One</li>
17158 <li data-parsoid='{"stx":"html"}'>Two</li>
17159 </ol>
17160
17161 !! end
17162
17163 !! test
17164 HTML ordered list, unclosed tags (bug 5497)
17165 !! options
17166 !! wikitext
17167 <ol>
17168 <li>One
17169 <li>Two
17170 </ol>
17171 !! html/php+tidy
17172 <ol>
17173 <li>One</li>
17174 <li>Two</li>
17175 </ol>
17176 !! html/parsoid
17177 <ol data-parsoid='{"stx":"html"}'>
17178 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17179 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17180 </ol>
17181
17182 !! end
17183
17184 !! test
17185 HTML nested bullet list, closed tags (bug 5497)
17186 !! wikitext
17187 <ul>
17188 <li>One</li>
17189 <li>Two:
17190 <ul>
17191 <li>Sub-one</li>
17192 <li>Sub-two</li>
17193 </ul>
17194 </li>
17195 </ul>
17196 !! html/php
17197 <ul>
17198 <li>One</li>
17199 <li>Two:
17200 <ul>
17201 <li>Sub-one</li>
17202 <li>Sub-two</li>
17203 </ul>
17204 </li>
17205 </ul>
17206
17207 !! html/parsoid
17208 <ul data-parsoid='{"stx":"html"}'>
17209 <li data-parsoid='{"stx":"html"}'>One</li>
17210 <li data-parsoid='{"stx":"html"}'>Two:
17211 <ul data-parsoid='{"stx":"html"}'>
17212 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
17213 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
17214 </ul>
17215 </li>
17216 </ul>
17217 !! end
17218
17219 !! test
17220 HTML nested bullet list, open tags (bug 5497)
17221 !! wikitext
17222 <ul>
17223 <li>One
17224 <li>Two:
17225 <ul>
17226 <li>Sub-one
17227 <li>Sub-two
17228 </ul>
17229 </ul>
17230 !! html/php+tidy
17231 <ul>
17232 <li>One</li>
17233 <li>Two:
17234 <ul>
17235 <li>Sub-one</li>
17236 <li>Sub-two</li>
17237 </ul>
17238 </li>
17239 </ul>
17240 !! html/parsoid
17241 <ul>
17242 <li>One
17243 </li>
17244 <li>Two:
17245 <ul>
17246 <li>Sub-one
17247 </li>
17248 <li>Sub-two
17249 </li>
17250 </ul>
17251 </li>
17252 </ul>
17253
17254 !! end
17255
17256 !! test
17257 HTML nested ordered list, closed tags (bug 5497)
17258 !! wikitext
17259 <ol>
17260 <li>One</li>
17261 <li>Two:
17262 <ol>
17263 <li>Sub-one</li>
17264 <li>Sub-two</li>
17265 </ol>
17266 </li>
17267 </ol>
17268 !! html
17269 <ol>
17270 <li>One</li>
17271 <li>Two:
17272 <ol>
17273 <li>Sub-one</li>
17274 <li>Sub-two</li>
17275 </ol>
17276 </li>
17277 </ol>
17278
17279 !! end
17280
17281 !! test
17282 HTML nested ordered list, open tags (bug 5497)
17283 !! wikitext
17284 <ol>
17285 <li>One
17286 <li>Two:
17287 <ol>
17288 <li>Sub-one
17289 <li>Sub-two
17290 </ol>
17291 </ol>
17292 !! html/php
17293 <ol>
17294 <li>One
17295 <li>Two:
17296 <ol>
17297 <li>Sub-one
17298 <li>Sub-two
17299 </ol>
17300 </ol>
17301
17302 !! html/parsoid
17303 <ol>
17304 <li>One
17305 </li>
17306 <li>Two:
17307 <ol>
17308 <li>Sub-one
17309 </li>
17310 <li>Sub-two
17311 </li>
17312 </ol>
17313 </li>
17314 </ol>
17315
17316 !! end
17317
17318 !! test
17319 HTML ordered list item with parameters oddity
17320 !! wikitext
17321 <ol><li id="fragment">One</li>
17322 </ol>
17323 !! html
17324 <ol><li id="fragment">One</li>
17325 </ol>
17326
17327 !! end
17328
17329 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
17330 !!test
17331 bug 5918: autonumbering
17332 !! wikitext
17333 [http://first/] [http://second] [ftp://ftp]
17334
17335 ftp://inlineftp
17336
17337 [mailto:enclosed@mail.tld With target]
17338
17339 [mailto:enclosed@mail.tld]
17340
17341 mailto:inline@mail.tld
17342 !! html/php
17343 <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>
17344 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
17345 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
17346 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
17347 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
17348 </p>
17349 !! html/parsoid
17350 <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>
17351 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
17352 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
17353 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
17354 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
17355 !! end
17356
17357
17358 #
17359 # Security and HTML correctness
17360 # From Nick Jenkins' fuzz testing
17361 #
17362
17363 !! test
17364 Fuzz testing: Parser13
17365 !! wikitext
17366 {|
17367 | http://a|
17368 !! html
17369 <table>
17370 <tr>
17371 <td>
17372 </td>
17373 </tr>
17374 </table>
17375
17376 !! end
17377
17378 !! test
17379 Fuzz testing: Parser14
17380 !! wikitext
17381 == onmouseover= ==
17382 http://__TOC__
17383 !! html
17384 <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>
17385 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17386 <ul>
17387 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17388 </ul>
17389 </div>
17390
17391
17392 !! html+tidy
17393 <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>
17394 <p>http://</p>
17395 <div id="toc" class="toc">
17396 <div id="toctitle">
17397 <h2>Contents</h2>
17398 </div>
17399 <ul>
17400 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17401 </ul>
17402 </div>
17403 <p></p>
17404 !! end
17405
17406 !! test
17407 Fuzz testing: Parser14-table
17408 !! options
17409 parsoid=wt2html,html2html
17410 !! wikitext
17411 ==a==
17412 {| STYLE=__TOC__
17413 !! html
17414 <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>
17415 <table style="&#95;_TOC&#95;_">
17416 <tr><td></td></tr>
17417 </table>
17418
17419 !! html+tidy
17420 <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>
17421 <table style="__TOC__">
17422 <tr>
17423 <td></td>
17424 </tr>
17425 </table>
17426 !! html/parsoid
17427 <h2>a</h2>
17428 <table style="__TOC__"></table>
17429 !! end
17430
17431 # Known to produce bogus xml (extra </td>)
17432 !! test
17433 Fuzz testing: Parser16
17434 !! wikitext
17435 {|
17436 !https://||||||
17437 !! html
17438 <table>
17439 <tr>
17440 <th>https://</th>
17441 <th></th>
17442 <th></th>
17443 <th>
17444 </td>
17445 </tr>
17446 </table>
17447
17448 !! html+tidy
17449 <table>
17450 <tr>
17451 <th>https://</th>
17452 <th></th>
17453 <th></th>
17454 <th></th>
17455 </tr>
17456 </table>
17457 !! end
17458
17459 !! test
17460 Fuzz testing: Parser21
17461 !! wikitext
17462 {|
17463 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17464 |
17465 !! html
17466 <table>
17467 <tr>
17468 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17469 </th>
17470 <td>
17471 </td>
17472 </tr>
17473 </table>
17474
17475 !! end
17476
17477 !! test
17478 Fuzz testing: Parser22
17479 !! wikitext
17480 http://===r:::https://b
17481
17482 {|
17483 !! html
17484 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17485 </p>
17486 <table>
17487 <tr><td></td></tr>
17488 </table>
17489
17490 !! end
17491
17492 # Known to produce bad XML for now
17493 !! test
17494 Fuzz testing: Parser24
17495 !! wikitext
17496 {|
17497 {{{|
17498 <u CLASS=
17499 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17500 <br style="onmouseover='alert(document.cookie);' " />
17501
17502 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17503 |
17504 !! html
17505 <table>
17506 {{{|
17507 <u class="&#124;">}}}} &gt;
17508 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17509
17510 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17511 <tr>
17512 <td></u>
17513 </td>
17514 </tr>
17515 </table>
17516
17517 !! end
17518
17519 # Note: the current result listed for this is not what the original one was,
17520 # but the original bug was JavaScript injection, which is fixed in any case.
17521 # It's not clear that the original result listed was any more correct than the
17522 # current one. Original result:
17523 # <p>{{{|
17524 # </p>
17525 # <li class="&#124;&#124;">
17526 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17527 !!test
17528 Fuzz testing: Parser25 (bug 6055)
17529 !! wikitext
17530 {{{
17531 |
17532 <LI CLASS=||
17533 >
17534 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17535 !! html
17536 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17537 </p>
17538 !! end
17539
17540 !!test
17541 Fuzz testing: URL adjacent extension (with space, clean)
17542 !! wikitext
17543 http://example.com <nowiki>junk</nowiki>
17544 !! html/php
17545 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17546 </p>
17547 !! html/parsoid
17548 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17549 !! end
17550
17551 !!test
17552 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17553 !! wikitext
17554 http://example.com<nowiki>junk</nowiki>
17555 !! html/php
17556 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17557 </p>
17558 !! html/parsoid
17559 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17560 !! end
17561
17562 !!test
17563 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17564 !! wikitext
17565 http://example.com<pre>junk</pre>
17566 !! html/php
17567 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17568
17569 !! html/php+tidy
17570 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17571 <pre>
17572 junk
17573 </pre>
17574 !! html/parsoid
17575 <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>
17576 !!end
17577
17578 !!test
17579 Fuzz testing: image with bogus manual thumbnail
17580 !! wikitext
17581 [[Image:foobar.jpg|thumbnail= ]]
17582 !! html/php
17583 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17584
17585 !! html/parsoid
17586 <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>
17587 !!end
17588
17589 !! test
17590 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17591 !! wikitext
17592 <pre dir="&#10;"></pre>
17593 !! html
17594 <pre dir="&#10;"></pre>
17595
17596 !! end
17597
17598 !! test
17599 Parsing optional HTML elements (Bug 6171)
17600 !! options
17601 !! wikitext
17602 <table>
17603 <tr>
17604 <td> Some tabular data</td>
17605 <td> More tabular data ...
17606 <td> And yet som tabular data</td>
17607 </tr>
17608 </table>
17609 !! html
17610 <table>
17611 <tr>
17612 <td> Some tabular data</td>
17613 <td> More tabular data ...
17614 </td><td> And yet som tabular data</td>
17615 </tr>
17616 </table>
17617
17618 !! end
17619
17620 !! test
17621 Correct handling of <td>, <tr> (Bug 6171)
17622 !! options
17623 !! wikitext
17624 <table>
17625 <tr>
17626 <td> Some tabular data</td>
17627 <td> More tabular data ...</td>
17628 <td> And yet som tabular data</td>
17629 </tr>
17630 </table>
17631 !! html
17632 <table>
17633 <tr>
17634 <td> Some tabular data</td>
17635 <td> More tabular data ...</td>
17636 <td> And yet som tabular data</td>
17637 </tr>
17638 </table>
17639
17640 !! end
17641
17642
17643 !! test
17644 Parsing crashing regression (fr:JavaScript)
17645 !! wikitext
17646 </body></x>
17647 !! html
17648 <p>&lt;/body&gt;&lt;/x&gt;
17649 </p>
17650 !! end
17651
17652 !! test
17653 Inline wiki vs wiki block nesting
17654 !! wikitext
17655 '''Bold paragraph
17656
17657 New wiki paragraph
17658 !! html
17659 <p><b>Bold paragraph</b>
17660 </p><p>New wiki paragraph
17661 </p>
17662 !! end
17663
17664 # FIXME: The current php output is documented
17665 # and desired output is the parsoid target.
17666 !! test
17667 Inline HTML vs wiki block nesting
17668 !! wikitext
17669 <b>Bold paragraph
17670
17671 New wiki paragraph
17672 !! html/php
17673 <p><b>Bold paragraph
17674 </p><p>New wiki paragraph</b>
17675 </p>
17676 !! html/parsoid
17677 <p><b>Bold paragraph</b>
17678 </p><p>New wiki paragraph
17679 </p>
17680 !! end
17681
17682 # Original result was this:
17683 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
17684 # </p>
17685 # While that might be marginally more intuitive, maybe, the six-apostrophe
17686 # construct is clearly pathological and the result stated here (which is what
17687 # the parser actually does) is about as reasonable as anything.
17688 !!test
17689 Mixing markup for italics and bold
17690 !! options
17691 !! wikitext
17692 '''bold''''''bold''bolditalics'''''
17693 !! html
17694 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
17695 </p>
17696 !! end
17697
17698
17699 !! article
17700 Xyzzyx
17701 !! text
17702 Article for special page transclusion test
17703 !! endarticle
17704
17705 !! test
17706 Special page transclusion
17707 !! options
17708 !! wikitext
17709 {{Special:Prefixindex/Xyzzyx}}
17710 !! html
17711 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17712 </ul>
17713
17714 !! end
17715
17716 !! test
17717 Special page transclusion twice (bug 5021)
17718 !! options
17719 !! wikitext
17720 {{Special:Prefixindex/Xyzzyx}}
17721 {{Special:Prefixindex/Xyzzyx}}
17722 !! html
17723 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17724 </ul>
17725 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17726 </ul>
17727
17728 !! end
17729
17730 !! test
17731 Transclusion of default MediaWiki message
17732 !! wikitext
17733 {{MediaWiki:Mainpage}}
17734 !! html
17735 <p>Main Page
17736 </p>
17737 !! end
17738
17739 !! test
17740 Transclusion of nonexistent MediaWiki message
17741 !! wikitext
17742 {{MediaWiki:Mainpagexxx}}
17743 !! html
17744 <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>
17745 </p>
17746 !! end
17747
17748 !! test
17749 Transclusion of MediaWiki message with underscore
17750 !! wikitext
17751 {{MediaWiki:history_short}}
17752 !! html
17753 <p>History
17754 </p>
17755 !! end
17756
17757 !! test
17758 Transclusion of MediaWiki message with space
17759 !! wikitext
17760 {{MediaWiki:history short}}
17761 !! html
17762 <p>History
17763 </p>
17764 !! end
17765
17766 !! test
17767 Invalid header with following text
17768 !! wikitext
17769 = x = y
17770 !! html
17771 <p>= x = y
17772 </p>
17773 !! end
17774
17775
17776 !! test
17777 Section extraction test (section 0)
17778 !! options
17779 section=0
17780 !! wikitext
17781 start
17782 ==a==
17783 ===aa===
17784 ====aaa====
17785 ==b==
17786 ===ba===
17787 ===bb===
17788 ====bba====
17789 ===bc===
17790 ==c==
17791 ===ca===
17792 !! html/php
17793 start
17794 !! end
17795
17796 !! test
17797 Section extraction test (section 1)
17798 !! options
17799 section=1
17800 !! wikitext
17801 start
17802 ==a==
17803 ===aa===
17804 ====aaa====
17805 ==b==
17806 ===ba===
17807 ===bb===
17808 ====bba====
17809 ===bc===
17810 ==c==
17811 ===ca===
17812 !! html/php
17813 ==a==
17814 ===aa===
17815 ====aaa====
17816 !! end
17817
17818 !! test
17819 Section extraction test (section 2)
17820 !! options
17821 section=2
17822 !! wikitext
17823 start
17824 ==a==
17825 ===aa===
17826 ====aaa====
17827 ==b==
17828 ===ba===
17829 ===bb===
17830 ====bba====
17831 ===bc===
17832 ==c==
17833 ===ca===
17834 !! html/php
17835 ===aa===
17836 ====aaa====
17837 !! end
17838
17839 !! test
17840 Section extraction test (section 3)
17841 !! options
17842 section=3
17843 !! wikitext
17844 start
17845 ==a==
17846 ===aa===
17847 ====aaa====
17848 ==b==
17849 ===ba===
17850 ===bb===
17851 ====bba====
17852 ===bc===
17853 ==c==
17854 ===ca===
17855 !! html/php
17856 ====aaa====
17857 !! end
17858
17859 !! test
17860 Section extraction test (section 4)
17861 !! options
17862 section=4
17863 !! wikitext
17864 start
17865 ==a==
17866 ===aa===
17867 ====aaa====
17868 ==b==
17869 ===ba===
17870 ===bb===
17871 ====bba====
17872 ===bc===
17873 ==c==
17874 ===ca===
17875 !! html/php
17876 ==b==
17877 ===ba===
17878 ===bb===
17879 ====bba====
17880 ===bc===
17881 !! end
17882
17883 !! test
17884 Section extraction test (section 5)
17885 !! options
17886 section=5
17887 !! wikitext
17888 start
17889 ==a==
17890 ===aa===
17891 ====aaa====
17892 ==b==
17893 ===ba===
17894 ===bb===
17895 ====bba====
17896 ===bc===
17897 ==c==
17898 ===ca===
17899 !! html/php
17900 ===ba===
17901 !! end
17902
17903 !! test
17904 Section extraction test (section 6)
17905 !! options
17906 section=6
17907 !! wikitext
17908 start
17909 ==a==
17910 ===aa===
17911 ====aaa====
17912 ==b==
17913 ===ba===
17914 ===bb===
17915 ====bba====
17916 ===bc===
17917 ==c==
17918 ===ca===
17919 !! html/php
17920 ===bb===
17921 ====bba====
17922 !! end
17923
17924 !! test
17925 Section extraction test (section 7)
17926 !! options
17927 section=7
17928 !! wikitext
17929 start
17930 ==a==
17931 ===aa===
17932 ====aaa====
17933 ==b==
17934 ===ba===
17935 ===bb===
17936 ====bba====
17937 ===bc===
17938 ==c==
17939 ===ca===
17940 !! html/php
17941 ====bba====
17942 !! end
17943
17944 !! test
17945 Section extraction test (section 8)
17946 !! options
17947 section=8
17948 !! wikitext
17949 start
17950 ==a==
17951 ===aa===
17952 ====aaa====
17953 ==b==
17954 ===ba===
17955 ===bb===
17956 ====bba====
17957 ===bc===
17958 ==c==
17959 ===ca===
17960 !! html/php
17961 ===bc===
17962 !! end
17963
17964 !! test
17965 Section extraction test (section 9)
17966 !! options
17967 section=9
17968 !! wikitext
17969 start
17970 ==a==
17971 ===aa===
17972 ====aaa====
17973 ==b==
17974 ===ba===
17975 ===bb===
17976 ====bba====
17977 ===bc===
17978 ==c==
17979 ===ca===
17980 !! html/php
17981 ==c==
17982 ===ca===
17983 !! end
17984
17985 !! test
17986 Section extraction test (section 10)
17987 !! options
17988 section=10
17989 !! wikitext
17990 start
17991 ==a==
17992 ===aa===
17993 ====aaa====
17994 ==b==
17995 ===ba===
17996 ===bb===
17997 ====bba====
17998 ===bc===
17999 ==c==
18000 ===ca===
18001 !! html/php
18002 ===ca===
18003 !! end
18004
18005 !! test
18006 Section extraction test (nonexistent section 11)
18007 !! options
18008 section=11
18009 !! wikitext
18010 start
18011 ==a==
18012 ===aa===
18013 ====aaa====
18014 ==b==
18015 ===ba===
18016 ===bb===
18017 ====bba====
18018 ===bc===
18019 ==c==
18020 ===ca===
18021 !! html/php
18022 !! end
18023
18024 !! test
18025 Section extraction test with bogus heading (section 1)
18026 !! options
18027 section=1
18028 !! wikitext
18029 ==a==
18030 ==bogus== not a legal section
18031 ==b==
18032 !! html/php
18033 ==a==
18034 ==bogus== not a legal section
18035 !! end
18036
18037 !! test
18038 Section extraction test with bogus heading (section 2)
18039 !! options
18040 section=2
18041 !! wikitext
18042 ==a==
18043 ==bogus== not a legal section
18044 ==b==
18045 !! html/php
18046 ==b==
18047 !! end
18048
18049 !! test
18050 Section extraction test with comment after heading (section 1)
18051 !! options
18052 section=1
18053 !! wikitext
18054 ==a==
18055 ==b== <!-- -->
18056 ==c==
18057 !! html/php
18058 ==a==
18059 !! end
18060
18061 !! test
18062 Section extraction test with comment after heading (section 2)
18063 !! options
18064 section=2
18065 !! wikitext
18066 ==a==
18067 ==b== <!-- -->
18068 ==c==
18069 !! html/php
18070 ==b== <!-- -->
18071 !! end
18072
18073 !! test
18074 Section extraction test with bogus <nowiki> heading (section 1)
18075 !! options
18076 section=1
18077 !! wikitext
18078 ==a==
18079 ==bogus== <nowiki>not a legal section</nowiki>
18080 ==b==
18081 !! html/php
18082 ==a==
18083 ==bogus== <nowiki>not a legal section</nowiki>
18084 !! end
18085
18086 !! test
18087 Section extraction test with bogus <nowiki> heading (section 2)
18088 !! options
18089 section=2
18090 !! wikitext
18091 ==a==
18092 ==bogus== <nowiki>not a legal section</nowiki>
18093 ==b==
18094 !! html/php
18095 ==b==
18096 !! end
18097
18098 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
18099 # instead of respecting commented sections
18100 !! test
18101 Section extraction prefixed by comment (section 1)
18102 !! options
18103 section=1
18104 !! wikitext
18105 <!-- -->==sec1==
18106 ==sec2==
18107 !! html/php
18108 ==sec2==
18109 !!end
18110
18111 !! test
18112 Section extraction prefixed by comment (section 2)
18113 !! options
18114 section=2
18115 !! wikitext
18116 <!-- -->==sec1==
18117 ==sec2==
18118 !! html/php
18119
18120 !!end
18121
18122 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
18123 # instead of respecting HTML-style headings
18124 !! test
18125 Section extraction, mixed wiki and html (section 1)
18126 !! options
18127 section=1
18128 !! wikitext
18129 <h2>unmarked</h2>
18130 unmarked
18131 ==1==
18132 one
18133 ==2==
18134 two
18135 !! html/php
18136 ==1==
18137 one
18138 !! end
18139
18140 !! test
18141 Section extraction, mixed wiki and html (section 2)
18142 !! options
18143 section=2
18144 !! wikitext
18145 <h2>unmarked</h2>
18146 unmarked
18147 ==1==
18148 one
18149 ==2==
18150 two
18151 !! html/php
18152 ==2==
18153 two
18154 !! end
18155
18156
18157 # Formerly testing for bug 3342
18158 !! test
18159 Section extraction, heading surrounded by <noinclude>
18160 !! options
18161 section=1
18162 !! wikitext
18163 <noinclude>==unmarked==</noinclude>
18164 ==marked==
18165 !! html/php
18166 ==marked==
18167 !!end
18168
18169 # Test behavior of bug 19910
18170 !! test
18171 Sectiion with all-equals
18172 !! options
18173 section=2
18174 !! wikitext
18175 ===
18176 The line above must have a trailing space
18177 === <!--
18178 --> <!-- -->
18179 But just in case it doesn't...
18180 !! html/php
18181 === <!--
18182 --> <!-- -->
18183 But just in case it doesn't...
18184 !! end
18185
18186 !! test
18187 Section replacement test (section 0)
18188 !! options
18189 replace=0,"xxx"
18190 !! wikitext
18191 start
18192 ==a==
18193 ===aa===
18194 ====aaa====
18195 ==b==
18196 ===ba===
18197 ===bb===
18198 ====bba====
18199 ===bc===
18200 ==c==
18201 ===ca===
18202 !! html/php
18203 xxx
18204
18205 ==a==
18206 ===aa===
18207 ====aaa====
18208 ==b==
18209 ===ba===
18210 ===bb===
18211 ====bba====
18212 ===bc===
18213 ==c==
18214 ===ca===
18215 !! end
18216
18217 !! test
18218 Section replacement test (section 1)
18219 !! options
18220 replace=1,"xxx"
18221 !! wikitext
18222 start
18223 ==a==
18224 ===aa===
18225 ====aaa====
18226 ==b==
18227 ===ba===
18228 ===bb===
18229 ====bba====
18230 ===bc===
18231 ==c==
18232 ===ca===
18233 !! html/php
18234 start
18235 xxx
18236
18237 ==b==
18238 ===ba===
18239 ===bb===
18240 ====bba====
18241 ===bc===
18242 ==c==
18243 ===ca===
18244 !! end
18245
18246 !! test
18247 Section replacement test (section 2)
18248 !! options
18249 replace=2,"xxx"
18250 !! wikitext
18251 start
18252 ==a==
18253 ===aa===
18254 ====aaa====
18255 ==b==
18256 ===ba===
18257 ===bb===
18258 ====bba====
18259 ===bc===
18260 ==c==
18261 ===ca===
18262 !! html/php
18263 start
18264 ==a==
18265 xxx
18266
18267 ==b==
18268 ===ba===
18269 ===bb===
18270 ====bba====
18271 ===bc===
18272 ==c==
18273 ===ca===
18274 !! end
18275
18276 !! test
18277 Section replacement test (section 3)
18278 !! options
18279 replace=3,"xxx"
18280 !! wikitext
18281 start
18282 ==a==
18283 ===aa===
18284 ====aaa====
18285 ==b==
18286 ===ba===
18287 ===bb===
18288 ====bba====
18289 ===bc===
18290 ==c==
18291 ===ca===
18292 !! html/php
18293 start
18294 ==a==
18295 ===aa===
18296 xxx
18297
18298 ==b==
18299 ===ba===
18300 ===bb===
18301 ====bba====
18302 ===bc===
18303 ==c==
18304 ===ca===
18305 !! end
18306
18307 !! test
18308 Section replacement test (section 4)
18309 !! options
18310 replace=4,"xxx"
18311 !! wikitext
18312 start
18313 ==a==
18314 ===aa===
18315 ====aaa====
18316 ==b==
18317 ===ba===
18318 ===bb===
18319 ====bba====
18320 ===bc===
18321 ==c==
18322 ===ca===
18323 !! html/php
18324 start
18325 ==a==
18326 ===aa===
18327 ====aaa====
18328 xxx
18329
18330 ==c==
18331 ===ca===
18332 !! end
18333
18334 !! test
18335 Section replacement test (section 5)
18336 !! options
18337 replace=5,"xxx"
18338 !! wikitext
18339 start
18340 ==a==
18341 ===aa===
18342 ====aaa====
18343 ==b==
18344 ===ba===
18345 ===bb===
18346 ====bba====
18347 ===bc===
18348 ==c==
18349 ===ca===
18350 !! html/php
18351 start
18352 ==a==
18353 ===aa===
18354 ====aaa====
18355 ==b==
18356 xxx
18357
18358 ===bb===
18359 ====bba====
18360 ===bc===
18361 ==c==
18362 ===ca===
18363 !! end
18364
18365 !! test
18366 Section replacement test (section 6)
18367 !! options
18368 replace=6,"xxx"
18369 !! wikitext
18370 start
18371 ==a==
18372 ===aa===
18373 ====aaa====
18374 ==b==
18375 ===ba===
18376 ===bb===
18377 ====bba====
18378 ===bc===
18379 ==c==
18380 ===ca===
18381 !! html/php
18382 start
18383 ==a==
18384 ===aa===
18385 ====aaa====
18386 ==b==
18387 ===ba===
18388 xxx
18389
18390 ===bc===
18391 ==c==
18392 ===ca===
18393 !! end
18394
18395 !! test
18396 Section replacement test (section 7)
18397 !! options
18398 replace=7,"xxx"
18399 !! wikitext
18400 start
18401 ==a==
18402 ===aa===
18403 ====aaa====
18404 ==b==
18405 ===ba===
18406 ===bb===
18407 ====bba====
18408 ===bc===
18409 ==c==
18410 ===ca===
18411 !! html/php
18412 start
18413 ==a==
18414 ===aa===
18415 ====aaa====
18416 ==b==
18417 ===ba===
18418 ===bb===
18419 xxx
18420
18421 ===bc===
18422 ==c==
18423 ===ca===
18424 !! end
18425
18426 !! test
18427 Section replacement test (section 8)
18428 !! options
18429 replace=8,"xxx"
18430 !! wikitext
18431 start
18432 ==a==
18433 ===aa===
18434 ====aaa====
18435 ==b==
18436 ===ba===
18437 ===bb===
18438 ====bba====
18439 ===bc===
18440 ==c==
18441 ===ca===
18442 !! html/php
18443 start
18444 ==a==
18445 ===aa===
18446 ====aaa====
18447 ==b==
18448 ===ba===
18449 ===bb===
18450 ====bba====
18451 xxx
18452
18453 ==c==
18454 ===ca===
18455 !!end
18456
18457 !! test
18458 Section replacement test (section 9)
18459 !! options
18460 replace=9,"xxx"
18461 !! wikitext
18462 start
18463 ==a==
18464 ===aa===
18465 ====aaa====
18466 ==b==
18467 ===ba===
18468 ===bb===
18469 ====bba====
18470 ===bc===
18471 ==c==
18472 ===ca===
18473 !! html/php
18474 start
18475 ==a==
18476 ===aa===
18477 ====aaa====
18478 ==b==
18479 ===ba===
18480 ===bb===
18481 ====bba====
18482 ===bc===
18483 xxx
18484 !! end
18485
18486 !! test
18487 Section replacement test (section 10)
18488 !! options
18489 replace=10,"xxx"
18490 !! wikitext
18491 start
18492 ==a==
18493 ===aa===
18494 ====aaa====
18495 ==b==
18496 ===ba===
18497 ===bb===
18498 ====bba====
18499 ===bc===
18500 ==c==
18501 ===ca===
18502 !! html/php
18503 start
18504 ==a==
18505 ===aa===
18506 ====aaa====
18507 ==b==
18508 ===ba===
18509 ===bb===
18510 ====bba====
18511 ===bc===
18512 ==c==
18513 xxx
18514 !! end
18515
18516 !! test
18517 Section replacement test with initial whitespace (bug 13728)
18518 !! options
18519 replace=2,"xxx"
18520 !! wikitext
18521 Preformatted initial line
18522 ==a==
18523 ===a===
18524 !! html/php
18525 Preformatted initial line
18526 ==a==
18527 xxx
18528 !! end
18529
18530
18531 !! test
18532 Section extraction, heading followed by pre with 20 spaces (bug 6398)
18533 !! options
18534 section=1
18535 !! wikitext
18536 ==a==
18537 a
18538 !! html/php
18539 ==a==
18540 a
18541 !! end
18542
18543 !! test
18544 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
18545 !! options
18546 section=1
18547 !! wikitext
18548 ==a==
18549 a
18550 !! html/php
18551 ==a==
18552 a
18553 !! end
18554
18555
18556 !! test
18557 Section extraction, <pre> around bogus header (bug 10309)
18558 !! options
18559 section=2
18560 !! wikitext
18561 == Section One ==
18562 <pre>
18563 =======
18564 </pre>
18565
18566 == Section Two ==
18567 stuff
18568 !! html/php
18569 == Section Two ==
18570 stuff
18571 !! end
18572
18573 !! test
18574 Section replacement, <pre> around bogus header (bug 10309)
18575 !! options
18576 replace=2,"xxx"
18577 !! wikitext
18578 == Section One ==
18579 <pre>
18580 =======
18581 </pre>
18582
18583 == Section Two ==
18584 stuff
18585 !! html/php
18586 == Section One ==
18587 <pre>
18588 =======
18589 </pre>
18590
18591 xxx
18592 !! end
18593
18594
18595 !! test
18596 Handling of &#x0A; in URLs
18597 !! wikitext
18598 ** irc://&#x0A;a
18599 !! html/php
18600 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18601
18602 !! html/parsoid
18603 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
18604 a">irc://
18605 a</a></li></ul></li></ul>
18606 !! end
18607
18608 !! test
18609 Handling of %0A in URLs
18610 !! wikitext
18611 ** irc://%0Aa
18612 !! html/php
18613 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18614
18615 !! html/parsoid
18616 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18617 !! end
18618
18619
18620 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18621 !! test
18622 5 quotes, code coverage +1 line
18623 !! options
18624 parsoid=wt2html
18625 !! wikitext
18626 '''''
18627 !! html/php
18628 !! html/parsoid
18629 <p><b><i></i></b></p>
18630 !! end
18631
18632 # same html as previous, but wikitext adjusted to match parsoid html2wt
18633 # note that wt2html and html2html will put the <i> before the <b>
18634 !! test
18635 5 quotes, code coverage +1 line w/ nowiki (1)
18636 !! options
18637 parsoid=wt2wt,html2wt
18638 !! wikitext
18639 '''''<nowiki/>'''''
18640 !! html/php
18641 <p><i></i>
18642 </p>
18643 !! html/parsoid
18644 <p><b><i></i></b></p>
18645 !! end
18646
18647 # same as previous, just swapping the <i> and <b>
18648 !! test
18649 5 quotes, code coverage +1 line w/ nowiki (2)
18650 !! wikitext
18651 '''''<nowiki/>'''''
18652 !! html/php
18653 <p><i></i>
18654 </p>
18655 !! html/parsoid
18656 <p><i><b></b></i></p>
18657 !! end
18658
18659 !! test
18660 Special:Search page linking.
18661 !! wikitext
18662 {{Special:search}}
18663 !! html
18664 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18665 </p>
18666 !! end
18667
18668 !! test
18669 {{!}} is a magic word
18670 !! wikitext
18671 {{!}} is a magic word there and {{!}} is still a magic word here
18672 | is not a magic word here but {{!}} is still a magic word here
18673 !! html/php
18674 <p>| is a magic word there and | is still a magic word here
18675 | is not a magic word here but | is still a magic word here
18676 </p>
18677 !! html/parsoid
18678 <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
18679 | 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>
18680
18681 !! end
18682
18683 !! test
18684 Say the magic word
18685 !! options
18686 title=[[Parser test]]
18687 !! wikitext
18688 * {{PAGENAME}}
18689 * {{PAGENAMEE}}
18690 * {{FULLPAGENAME}}
18691 * {{FULLPAGENAMEE}}
18692 * {{BASEPAGENAME}}
18693 * {{BASEPAGENAMEE}}
18694 * {{SUBPAGENAME}}
18695 * {{SUBPAGENAMEE}}
18696 * {{ROOTPAGENAME}}
18697 * {{ROOTPAGENAMEE}}
18698 * {{TALKPAGENAME}}
18699 * {{TALKPAGENAMEE}}
18700 * {{SUBJECTPAGENAME}}
18701 * {{SUBJECTPAGENAMEE}}
18702 * {{NAMESPACEE}}
18703 * {{NAMESPACE}}
18704 * {{NAMESPACENUMBER}}
18705 * {{TALKSPACE}}
18706 * {{TALKSPACEE}}
18707 * {{SUBJECTSPACE}}
18708 * {{SUBJECTSPACEE}}
18709 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18710 !! html
18711 <ul><li> Parser test</li>
18712 <li> Parser_test</li>
18713 <li> Parser test</li>
18714 <li> Parser_test</li>
18715 <li> Parser test</li>
18716 <li> Parser_test</li>
18717 <li> Parser test</li>
18718 <li> Parser_test</li>
18719 <li> Parser test</li>
18720 <li> Parser_test</li>
18721 <li> Talk:Parser test</li>
18722 <li> Talk:Parser_test</li>
18723 <li> Parser test</li>
18724 <li> Parser_test</li>
18725 <li> </li>
18726 <li> </li>
18727 <li> 0</li>
18728 <li> Talk</li>
18729 <li> Talk</li>
18730 <li> </li>
18731 <li> </li>
18732 <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>
18733
18734 !! end
18735 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18736
18737 !! test
18738 Gallery
18739 !! wikitext
18740 <gallery>
18741 image1.png |
18742 image2.gif|||||
18743
18744 image3|
18745 image4 |300px| centre
18746 image5.svg| http://///////
18747 [[x|xx]]]]
18748 * image6
18749 </gallery>
18750 !! html
18751 <ul class="gallery mw-gallery-traditional">
18752 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18753 <div class="thumb" style="height: 150px;">Image1.png</div>
18754 <div class="gallerytext">
18755 </div>
18756 </div></li>
18757 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18758 <div class="thumb" style="height: 150px;">Image2.gif</div>
18759 <div class="gallerytext">
18760 </div>
18761 </div></li>
18762 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18763 <div class="thumb" style="height: 150px;">Image3</div>
18764 <div class="gallerytext">
18765 </div>
18766 </div></li>
18767 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18768 <div class="thumb" style="height: 150px;">Image4</div>
18769 <div class="gallerytext">
18770 <pre>centre
18771 </pre>
18772 </div>
18773 </div></li>
18774 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18775 <div class="thumb" style="height: 150px;">Image5.svg</div>
18776 <div class="gallerytext">
18777 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
18778 </p>
18779 </div>
18780 </div></li>
18781 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18782 <div class="thumb" style="height: 150px;">* image6</div>
18783 <div class="gallerytext">
18784 </div>
18785 </div></li>
18786 </ul>
18787
18788 !! end
18789
18790 !! test
18791 Gallery (with options)
18792 !! wikitext
18793 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
18794 File:Nonexistent.jpg|caption
18795 File:Nonexistent.jpg
18796 image:foobar.jpg|some '''caption''' [[Main Page]]
18797 image:foobar.jpg
18798 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
18799 </gallery>
18800 !! html
18801 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
18802 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
18803 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18804 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18805 <div class="gallerytext">
18806 <p>caption
18807 </p>
18808 </div>
18809 </div></li>
18810 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18811 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18812 <div class="gallerytext">
18813 </div>
18814 </div></li>
18815 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18816 <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>
18817 <div class="gallerytext">
18818 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18819 </p>
18820 </div>
18821 </div></li>
18822 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18823 <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>
18824 <div class="gallerytext">
18825 </div>
18826 </div></li>
18827 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18828 <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>
18829 <div class="gallerytext">
18830 <p>blabla.
18831 </p>
18832 </div>
18833 </div></li>
18834 </ul>
18835
18836 !! end
18837
18838 !! test
18839 Gallery with link that has fragment
18840 !! wikitext
18841 <gallery>
18842 image:foobar.jpg|link=Main_Page
18843 image:foobar.jpg|link=Main_Page#section
18844 image:foobar.jpg|link=Main Page#section|caption
18845 </gallery>
18846 !! html
18847 <ul class="gallery mw-gallery-traditional">
18848 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18849 <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>
18850 <div class="gallerytext">
18851 </div>
18852 </div></li>
18853 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18854 <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>
18855 <div class="gallerytext">
18856 </div>
18857 </div></li>
18858 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18859 <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>
18860 <div class="gallerytext">
18861 <p>caption
18862 </p>
18863 </div>
18864 </div></li>
18865 </ul>
18866
18867 !! end
18868
18869 !! test
18870 Gallery with wikitext inside caption
18871 !! wikitext
18872 <gallery>
18873 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
18874 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
18875 </gallery>
18876 !! html
18877 <ul class="gallery mw-gallery-traditional">
18878 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18879 <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>
18880 <div class="gallerytext">
18881 <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>
18882 </p>
18883 </div>
18884 </div></li>
18885 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18886 <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>
18887 <div class="gallerytext">
18888 <p>This is a test template
18889 </p>
18890 </div>
18891 </div></li>
18892 </ul>
18893
18894 !! end
18895
18896 !! test
18897 gallery (with showfilename option)
18898 !! wikitext
18899 <gallery showfilename>
18900 File:Nonexistent.jpg|caption
18901 File:Nonexistent.jpg
18902 image:foobar.jpg|some '''caption''' [[Main Page]]
18903 File:Foobar.jpg
18904 </gallery>
18905 !! html
18906 <ul class="gallery mw-gallery-traditional">
18907 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18908 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18909 <div class="gallerytext">
18910 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
18911 caption
18912 </p>
18913 </div>
18914 </div></li>
18915 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18916 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18917 <div class="gallerytext">
18918 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
18919 </p>
18920 </div>
18921 </div></li>
18922 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18923 <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>
18924 <div class="gallerytext">
18925 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
18926 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18927 </p>
18928 </div>
18929 </div></li>
18930 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18931 <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>
18932 <div class="gallerytext">
18933 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
18934 </p>
18935 </div>
18936 </div></li>
18937 </ul>
18938
18939 !! end
18940
18941 !! test
18942 Gallery (with namespace-less filenames)
18943 !! wikitext
18944 <gallery>
18945 File:Nonexistent.jpg
18946 Nonexistent.jpg
18947 image:foobar.jpg
18948 foobar.jpg
18949 </gallery>
18950 !! html
18951 <ul class="gallery mw-gallery-traditional">
18952 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18953 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18954 <div class="gallerytext">
18955 </div>
18956 </div></li>
18957 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18958 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18959 <div class="gallerytext">
18960 </div>
18961 </div></li>
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="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>
18964 <div class="gallerytext">
18965 </div>
18966 </div></li>
18967 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18968 <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>
18969 <div class="gallerytext">
18970 </div>
18971 </div></li>
18972 </ul>
18973
18974 !! end
18975
18976 !! test
18977 HTML Hex character encoding (spells the word "JavaScript")
18978 !! options
18979 parsoid=wt2html,wt2wt,html2html
18980 !! wikitext
18981 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
18982 !! html/php
18983 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
18984 </p>
18985 !! html/php+tidy
18986 <p>JavaScript</p>
18987 !! html/parsoid
18988 <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>
18989 !! end
18990
18991 !! test
18992 HTML Hex character encoding bogus encoding (bug 26437 regression check)
18993 !! wikitext
18994 &#xsee;&#XSEE;
18995 !! html/php
18996 <p>&amp;#xsee;&amp;#XSEE;
18997 </p>
18998 !! html/parsoid
18999 <p>&amp;#xsee;&amp;#XSEE;</p>
19000 !! end
19001
19002 !! test
19003 HTML Hex character encoding mixed case
19004 !! options
19005 parsoid=wt2html,wt2wt,html2html
19006 !! wikitext
19007 &#xEE;&#Xee;
19008 !! html/php
19009 <p>&#xee;&#xee;
19010 </p>
19011 !! html/php+tidy
19012 <p>îî</p>
19013 !! html/parsoid
19014 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
19015 !! end
19016
19017 # See: http://www.w3.org/TR/html5/syntax.html#character-references
19018 # Note that U+000C (form feed) is not a valid XML character, so
19019 # it is banned even though allowed in HTML5.
19020 !! test
19021 Illegal character references (T106578)
19022 !! wikitext
19023 ; Null: &#00;
19024 ; FF: &#xC;
19025 ; CR: &#xD;
19026 ; Control (low): &#8;
19027 ; Control (high): &#x7F; &#x9F;
19028 ; Surrogate: &#xD83D;&#xDCA9;
19029 ; This is an okay astral character: &#x1F4A9;
19030 !! html+tidy
19031 <dl>
19032 <dt>Null</dt>
19033 <dd>&amp;#00;</dd>
19034 <dt>FF</dt>
19035 <dd>&amp;#xC;</dd>
19036 <dt>CR</dt>
19037 <dd>&amp;#xD;</dd>
19038 <dt>Control (low)</dt>
19039 <dd>&amp;#8;</dd>
19040 <dt>Control (high)</dt>
19041 <dd>&amp;#x7F; &amp;#x9F;</dd>
19042 <dt>Surrogate</dt>
19043 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
19044 <dt>This is an okay astral character</dt>
19045 <dd>💩</dd>
19046 </dl>
19047 !! end
19048
19049 !! test
19050 __FORCETOC__ override
19051 !! wikitext
19052 __NEWSECTIONLINK__
19053 __FORCETOC__
19054 !! html/php
19055 <p><br />
19056 </p>
19057 !! end
19058
19059 !! test
19060 ISBN code coverage
19061 !! wikitext
19062 ISBN 978-0-1234-56&#x20;789
19063 !! html
19064 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
19065 </p>
19066 !! html+tidy
19067 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
19068 !! html/parsoid
19069 <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>
19070 !! end
19071
19072 !! test
19073 ISBN followed by 5 spaces
19074 !! wikitext
19075 ISBN
19076 !! html
19077 <p>ISBN
19078 </p>
19079 !! end
19080
19081 !! test
19082 Double ISBN
19083 !! wikitext
19084 ISBN ISBN 1234567890
19085 !! html/php
19086 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19087 </p>
19088 !! html/parsoid
19089 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
19090 !! end
19091
19092 # Uppercase X and lowercase x as well
19093 !! test
19094 ISBN with an X
19095 !! wikitext
19096 ISBN 3-462-04561-X
19097 ISBN 3-462-04561-x
19098 ISBN 080442957X
19099 ISBN 080442957x
19100 ISBN 978080442957X
19101 ISBN 978080442957x
19102 !! html/php
19103 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
19104 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
19105 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
19106 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
19107 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
19108 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
19109 </p>
19110 !! html/parsoid
19111 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
19112 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
19113 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
19114 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
19115 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
19116 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
19117 !! end
19118
19119 !! test
19120 ISBN with empty prefix (parsoid test)
19121 !! wikitext
19122 ISBN 1234567890
19123 !! html/php
19124 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19125 </p>
19126 !! html/parsoid
19127 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
19128 !! end
19129
19130 !! test
19131 Bug 22905: <abbr> followed by ISBN followed by </a>
19132 !! wikitext
19133 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
19134 !! html/php
19135 <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>
19136 </p>
19137 !! html/parsoid
19138 <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>
19139 !! end
19140
19141 !! test
19142 Double RFC
19143 !! wikitext
19144 RFC RFC 1234
19145 !! html
19146 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
19147 </p>
19148 !! end
19149
19150 !! test
19151 Double RFC with a wiki link
19152 !! wikitext
19153 RFC [[RFC 1234]]
19154 !! html
19155 <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>
19156 </p>
19157 !! end
19158
19159 !! test
19160 RFC code coverage
19161 !! wikitext
19162 RFC 983&#x20;987
19163 !! html
19164 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
19165 </p>
19166 !! html+tidy
19167 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
19168 !! end
19169
19170 !! test
19171 Centre-aligned image
19172 !! wikitext
19173 [[Image:foobar.jpg|centre]]
19174 !! html
19175 <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>
19176
19177 !!end
19178
19179 !! test
19180 None-aligned image
19181 !! wikitext
19182 [[Image:foobar.jpg|none]]
19183 !! html
19184 <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>
19185
19186 !!end
19187
19188 !! test
19189 Width + Height sized image (using px) (height is ignored)
19190 !! wikitext
19191 [[Image:foobar.jpg|640x480px]]
19192 !! html
19193 <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>
19194 </p>
19195 !!end
19196
19197 !! test
19198 Width-sized image (using px, no following whitespace)
19199 !! wikitext
19200 [[Image:foobar.jpg|640px]]
19201 !! html
19202 <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>
19203 </p>
19204 !!end
19205
19206 !! test
19207 Width-sized image (using px, with following whitespace - test regression from r39467)
19208 !! wikitext
19209 [[Image:foobar.jpg|640px ]]
19210 !! html
19211 <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>
19212 </p>
19213 !!end
19214
19215 !! test
19216 Width-sized image (using px, with preceding whitespace - test regression from r39467)
19217 !! wikitext
19218 [[Image:foobar.jpg| 640px]]
19219 !! html
19220 <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>
19221 </p>
19222 !!end
19223
19224 !! test
19225 Image with page parameter
19226 !! options
19227 djvu
19228 !! wikitext
19229 [[File:LoremIpsum.djvu|page=2]]
19230 !! html/php
19231 <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>
19232 </p>
19233 !! html/parsoid
19234 <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>
19235 !! end
19236
19237 !! test
19238 Another italics / bold test
19239 !! wikitext
19240 ''' ''x'
19241 !! html
19242 <pre>'<i> </i>x'
19243 </pre>
19244 !!end
19245
19246 # FIXME: The php output seems broken. It's interleaving some open/close tags.
19247 !! test
19248 dt/dd/dl test
19249 !! wikitext
19250 :;;;::
19251 !! html/php
19252 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
19253
19254 !! html/parsoid
19255 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
19256
19257 !!end
19258
19259
19260 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
19261 !! test
19262 Images with the "|" character in the comment
19263 !! wikitext
19264 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
19265 !! html/php
19266 <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>
19267
19268 !! html/parsoid
19269 <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>
19270 !! end
19271
19272 !! test
19273 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
19274 !! wikitext
19275 <html><script>alert(1);</script></html>
19276 !! html
19277 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
19278 </p>
19279 !! end
19280
19281 !! test
19282 HTML with raw HTML ($wgRawHtml==true)
19283 !! options
19284 wgRawHtml=1
19285 !! wikitext
19286 <html><script>alert(1);</script></html>
19287 !! html
19288 <p><script>alert(1);</script>
19289 </p>
19290 !! end
19291
19292 !! test
19293 Parents of subpages, one level up
19294 !! options
19295 subpage title=[[Subpage test/L1/L2/L3]]
19296 !! wikitext
19297 [[../|L2]]
19298 !! html
19299 <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>
19300 </p>
19301 !! end
19302
19303
19304 !! test
19305 Parents of subpages, one level up, not named
19306 !! options
19307 subpage title=[[Subpage test/L1/L2/L3]]
19308 !! wikitext
19309 [[../]]
19310 !! html
19311 <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>
19312 </p>
19313 !! end
19314
19315
19316
19317 !! test
19318 Parents of subpages, two levels up
19319 !! options
19320 subpage title=[[Subpage test/L1/L2/L3]]
19321 !! wikitext
19322 [[../../|L1]]2
19323
19324 [[../../|L1]]l
19325 !! html
19326 <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
19327 </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>
19328 </p>
19329 !! end
19330
19331 !! test
19332 Parents of subpages, two levels up, without trailing slash or name.
19333 !! options
19334 subpage title=[[Subpage test/L1/L2/L3]]
19335 !! wikitext
19336 [[../..]]
19337 !! html
19338 <p>[[../..]]
19339 </p>
19340 !! end
19341
19342 !! test
19343 Parents of subpages, two levels up, with lots of extra trailing slashes.
19344 !! options
19345 subpage title=[[Subpage test/L1/L2/L3]]
19346 !! wikitext
19347 [[../../////]]
19348 !! html
19349 <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>
19350 </p>
19351 !! end
19352
19353 !! article
19354 Subpage test/L1/L2/L3Sibling
19355 !! text
19356 Sibling article
19357 !! endarticle
19358
19359 !! test
19360 Transclusion of a sibling page (one level up)
19361 !! options
19362 subpage title=[[Subpage test/L1/L2/L3]]
19363 !! wikitext
19364 {{../L3Sibling}}
19365 !! html
19366 <p>Sibling article
19367 </p>
19368 !! end
19369
19370 !! test
19371 Transclusion of a child page
19372 !! options
19373 subpage title=[[Subpage test/L1/L2]]
19374 !! wikitext
19375 {{/L3Sibling}}
19376 !! html
19377 <p>Sibling article
19378 </p>
19379 !! end
19380
19381 # This is wt2html only in Parsoid because we add <nowiki>
19382 # because of {{..}} and we don't expect to fix that to
19383 # eliminate the nowikis selective for {{..}} markup.
19384 !! test
19385 Non-transclusion because of too many up levels
19386 !! options
19387 subpage title=[[Subpage test/L1/L2/L3]]
19388 parsoid=wt2html
19389 !! wikitext
19390 {{../../../../More than parent}}
19391 !! html
19392 <p>{{../../../../More than parent}}
19393 </p>
19394 !! end
19395
19396 !! test
19397 Definition list code coverage
19398 !! wikitext
19399 ; title : def
19400 ; title : def
19401 ;title: def
19402 !! html/php
19403 <dl><dt> title &#160;</dt>
19404 <dd> def</dd>
19405 <dt> title&#160;</dt>
19406 <dd> def</dd>
19407 <dt>title</dt>
19408 <dd> def</dd></dl>
19409
19410 !! html/parsoid
19411 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19412 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19413 <dt>title</dt><dd> def</dd></dl>
19414 !! end
19415
19416 !! test
19417 Don't fall for the self-closing div
19418 !! wikitext
19419 <div>hello world</div/>
19420 !! html
19421 <div>hello world</div>
19422
19423 !! end
19424
19425 !! test
19426 MSGNW magic word
19427 !! wikitext
19428 {{MSGNW:msg}}
19429 !! html/php
19430 <p>&#91;&#91;:Template:Msg&#93;&#93;
19431 </p>
19432 !! end
19433
19434 !! test
19435 RAW magic word
19436 !! wikitext
19437 {{RAW:QUERTY}}
19438 !! html
19439 <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>
19440 </p>
19441 !! end
19442
19443 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
19444 !! test
19445 Always escape literal '>' in output, not just after '<'
19446 !! wikitext
19447 ><>
19448 !! html
19449 <p>&gt;&lt;&gt;
19450 </p>
19451 !! end
19452
19453 !! test
19454 Template caching
19455 !! wikitext
19456 {{Test}}
19457 {{Test}}
19458 !! html
19459 <p>This is a test template
19460 This is a test template
19461 </p>
19462 !! end
19463
19464
19465 !! article
19466 MediaWiki:Fake
19467 !! text
19468 ==header==
19469 !! endarticle
19470
19471 !! test
19472 Inclusion of !userCanEdit() content
19473 !! wikitext
19474 {{MediaWiki:Fake}}
19475 !! html
19476 <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>
19477
19478 !! end
19479
19480
19481 !! test
19482 Out-of-order TOC heading levels
19483 !! wikitext
19484 ==2==
19485 ======6======
19486 ===3===
19487 =1=
19488 =====5=====
19489 ==2==
19490 !! html
19491 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19492 <ul>
19493 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
19494 <ul>
19495 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
19496 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
19497 </ul>
19498 </li>
19499 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
19500 <ul>
19501 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
19502 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
19503 </ul>
19504 </li>
19505 </ul>
19506 </div>
19507
19508 <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>
19509 <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>
19510 <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>
19511 <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>
19512 <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>
19513 <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>
19514
19515 !! end
19516
19517
19518 !! test
19519 ISBN with a dummy number
19520 !! wikitext
19521 ISBN ---
19522 !! html
19523 <p>ISBN ---
19524 </p>
19525 !! end
19526
19527
19528 !! test
19529 ISBN with space-delimited number
19530 !! wikitext
19531 ISBN 92 9017 032 8
19532 !! html
19533 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
19534 </p>
19535 !! end
19536
19537
19538 !! test
19539 ISBN with multiple spaces, no number
19540 !! wikitext
19541 ISBN foo
19542 !! html
19543 <p>ISBN foo
19544 </p>
19545 !! end
19546
19547
19548 !! test
19549 ISBN length
19550 !! wikitext
19551 ISBN 123456789
19552
19553 ISBN 1234567890
19554
19555 ISBN 12345678901
19556 !! html
19557 <p>ISBN 123456789
19558 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19559 </p><p>ISBN 12345678901
19560 </p>
19561 !! end
19562
19563
19564 !! test
19565 ISBN with trailing year (bug 8110)
19566 !! wikitext
19567 ISBN 1-234-56789-0 - 2006
19568
19569 ISBN 1 234 56789 0 - 2006
19570 !! html
19571 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
19572 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
19573 </p>
19574 !! end
19575
19576
19577 !! test
19578 anchorencode
19579 !! wikitext
19580 {{anchorencode:foo bar©#%n}}
19581 !! html
19582 <p>foo_bar.C2.A9.23.25n
19583 </p>
19584 !! end
19585
19586 !! test
19587 anchorencode trims spaces
19588 !! wikitext
19589 {{anchorencode: __pretty__please__}}
19590 !! html
19591 <p>pretty_please
19592 </p>
19593 !! end
19594
19595 !! test
19596 anchorencode deals with links
19597 !! wikitext
19598 {{anchorencode: [[hello|world]] [[hi]]}}
19599 !! html
19600 <p>world_hi
19601 </p>
19602 !! end
19603
19604 !! test
19605 anchorencode deals with templates
19606 !! wikitext
19607 {{anchorencode: {{Foo}} }}
19608 !! html
19609 <p>FOO
19610 </p>
19611 !! end
19612
19613 !! test
19614 anchorencode encodes like the TOC generator: (bug 18431)
19615 !! wikitext
19616 === _ +:.3A%3A&&amp;]] ===
19617 {{anchorencode: _ +:.3A%3A&&amp;]] }}
19618 __NOEDITSECTION__
19619 !! html
19620 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
19621 <p>.2B:.3A.253A.26.26.5D.5D
19622 </p>
19623 !! end
19624
19625 !! test
19626 Bug 6200: blockquotes and paragraph formatting
19627 !! wikitext
19628 <blockquote>
19629 foo
19630 </blockquote>
19631
19632 bar
19633
19634 baz
19635 !! html
19636 <blockquote>
19637 <p>foo
19638 </p>
19639 </blockquote>
19640 <p>bar
19641 </p>
19642 <pre>baz
19643 </pre>
19644 !! end
19645
19646 !! test
19647 Bug 8293: Use of center tag ruins paragraph formatting
19648 !! wikitext
19649 <center>
19650 foo
19651 </center>
19652
19653 bar
19654
19655 baz
19656 !! html
19657 <center>
19658 <p>foo
19659 </p>
19660 </center>
19661 <p>bar
19662 </p>
19663 <pre>baz
19664 </pre>
19665 !! end
19666
19667 !!test
19668 Parsing of overlapping (improperly nested) inline html tags
19669 !! wikitext
19670 <span><s>x</span></s>
19671 !! html/php
19672 <p><span><s>x&lt;/span&gt;</s></span>
19673 </p>
19674 !! html/parsoid
19675 <p><span><s>x</s></span>
19676 </p>
19677 !!end
19678
19679 ###
19680 ### Language variants related tests
19681 ###
19682 !! test
19683 Self-link in language variants
19684 !! options
19685 title=[[Dunav]] language=sr
19686 !! wikitext
19687 Both [[Dunav]] and [[Дунав]] are names for this river.
19688 !! html
19689 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
19690 </p>
19691 !!end
19692
19693 !! article
19694 Дуна
19695 !! text
19696 content
19697 !! endarticle
19698
19699 !! test
19700 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
19701 !! options
19702 title=[[Duna]] language=sr
19703 !! wikitext
19704 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
19705 !! html
19706 <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.
19707 </p>
19708 !! end
19709
19710 !! test
19711 Link to a section of a variant of this title shouldn't be parsed as self-link
19712 !! options
19713 title=[[Duna]] language=sr
19714 !! wikitext
19715 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
19716 !! html
19717 <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.
19718 </p>
19719 !! end
19720
19721 !! test
19722 Link to pages in language variants
19723 !! options
19724 language=sr
19725 !! wikitext
19726 Main Page can be written as [[Маин Паге]]
19727 !! html
19728 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
19729 </p>
19730 !!end
19731
19732
19733 !! test
19734 Multiple links to pages in language variants
19735 !! options
19736 language=sr
19737 !! wikitext
19738 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
19739 !! html
19740 <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>.
19741 </p>
19742 !!end
19743
19744
19745 !! test
19746 Simple template in language variants
19747 !! options
19748 language=sr
19749 !! wikitext
19750 {{тест}}
19751 !! html
19752 <p>This is a test template
19753 </p>
19754 !! end
19755
19756
19757 !! test
19758 Template with explicit namespace in language variants
19759 !! options
19760 language=sr
19761 !! wikitext
19762 {{Template:тест}}
19763 !! html
19764 <p>This is a test template
19765 </p>
19766 !! end
19767
19768
19769 !! test
19770 Basic test for template parameter in language variants
19771 !! options
19772 language=sr
19773 !! wikitext
19774 {{парамтест|param=foo}}
19775 !! html
19776 <p>This is a test template with parameter foo
19777 </p>
19778 !! end
19779
19780
19781 !! test
19782 Simple category in language variants
19783 !! options
19784 language=sr cat
19785 !! wikitext
19786 [[Category:МедиаWики Усер'с Гуиде]]
19787 !! html
19788 <a href="/wiki/%D0%9A%D0%B0%D1%82%D0%B5%D0%B3%D0%BE%D1%80%D0%B8%D1%98%D0%B0:MediaWiki_User%27s_Guide" title="Категорија:MediaWiki User's Guide">MediaWiki User's Guide</a>
19789 !! end
19790
19791
19792 !! article
19793 Category:分类
19794 !! text
19795 blah
19796 !! endarticle
19797
19798 !! article
19799 Category:分類
19800 !! text
19801 blah
19802 !! endarticle
19803
19804 ## We used to, but no longer wt2wt this test since the default serializer
19805 ## will normalize all categories to serialize on their own line.
19806 ## This wikitext usage is going to be fairly uncommon in production and
19807 ## selser will take care of preserving formatting in those scenarios.
19808 !! test
19809 Don't convert blue categorylinks to another variant (bug 33210)
19810 !! options
19811 cat
19812 language=zh
19813 parsoid=wt2html
19814 !! wikitext
19815 [[A]][[Category:分类]]
19816 !! html/php
19817 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
19818 !! html/parsoid
19819 <p><a rel="mw:WikiLink" href="A" title="A">A</a></p>
19820 <link rel="mw:PageProp/Category" href="Category:分类"/>
19821 !! end
19822
19823 !! test
19824 Stripping -{}- tags (language variants)
19825 !! options
19826 language=sr
19827 !! wikitext
19828 Latin proverb: -{Ne nuntium necare}-
19829 !! html
19830 <p>Latin proverb: Ne nuntium necare
19831 </p>
19832 !! end
19833
19834
19835 !! test
19836 Prevent conversion with -{}- tags (language variants)
19837 !! options
19838 language=sr variant=sr-ec
19839 !! wikitext
19840 Latinski: -{Ne nuntium necare}-
19841 !! html
19842 <p>Латински: Ne nuntium necare
19843 </p>
19844 !! end
19845
19846
19847 !! test
19848 Prevent conversion of text with -{}- tags (language variants)
19849 !! options
19850 language=sr variant=sr-ec
19851 !! wikitext
19852 Latinski: -{Ne nuntium necare}-
19853 !! html
19854 <p>Латински: Ne nuntium necare
19855 </p>
19856 !! end
19857
19858
19859 !! test
19860 Prevent conversion of links with -{}- tags (language variants)
19861 !! options
19862 language=sr variant=sr-ec
19863 !! wikitext
19864 -{[[Main Page]]}-
19865 !! html
19866 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19867 </p>
19868 !! end
19869
19870
19871 !! test
19872 -{}- tags within headlines (within html for parserConvert())
19873 !! options
19874 language=sr variant=sr-ec
19875 !! wikitext
19876 == -{Naslov}- ==
19877 !! html
19878 <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>
19879
19880 !! end
19881
19882
19883 !! test
19884 Explicit definition of language variant alternatives
19885 !! options
19886 language=zh variant=zh-tw
19887 !! wikitext
19888 -{zh:China;zh-tw:Taiwan}-, not China
19889 !! html
19890 <p>Taiwan, not China
19891 </p>
19892 !! end
19893
19894
19895 !! test
19896 Conversion around HTML tags
19897 !! options
19898 language=sr variant=sr-ec
19899 !! wikitext
19900 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
19901 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
19902 !! html
19903 <p>
19904 <span title="ЛаCтин">ски</span>
19905 </p>
19906 !! end
19907
19908
19909 !! test
19910 Explicit session-wise language variant mapping (A flag and - flag)
19911 !! options
19912 language=zh variant=zh-tw
19913 !! wikitext
19914 Taiwan is not China.
19915 But -{A|zh:China;zh-tw:Taiwan}- is China,
19916 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
19917 and -{China}- is China.
19918 !! html
19919 <p>Taiwan is not China.
19920 But Taiwan is Taiwan,
19921 (This should be stripped!)
19922 and China is China.
19923 </p>
19924 !! end
19925
19926 !! test
19927 Explicit session-wise language variant mapping (H flag for hide)
19928 !! options
19929 language=zh variant=zh-tw
19930 !! wikitext
19931 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
19932 Taiwan is China.
19933 !! html
19934 <p>(This should be stripped!)
19935 Taiwan is Taiwan.
19936 </p>
19937 !! end
19938
19939 !! test
19940 Adding explicit conversion rule for title (T flag)
19941 !! options
19942 language=zh variant=zh-tw showtitle
19943 !! wikitext
19944 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19945 !! html
19946 Taiwan
19947 <p>Should be stripped!
19948 </p>
19949 !! end
19950
19951 !! test
19952 Testing that changing the language variant here in the tests actually works
19953 !! options
19954 language=zh variant=zh showtitle
19955 !! wikitext
19956 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19957 !! html
19958 China
19959 <p>Should be stripped!
19960 </p>
19961 !! end
19962
19963 !! test
19964 Recursive conversion of alt and title attrs shouldn't clear converter state
19965 !! options
19966 language=zh variant=zh-cn showtitle
19967 !! wikitext
19968 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
19969 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
19970 !! html
19971 China
19972 <p>
19973 Should be stripped<span title="Exclamation">!</span>
19974 </p>
19975 !! end
19976
19977 !! test
19978 Bug 24072: more test on conversion rule for title
19979 !! options
19980 language=zh variant=zh-tw showtitle
19981 !! wikitext
19982 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19983 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
19984 !! html
19985 Taiwan
19986 <p>This should be stripped!
19987 This won't take interferes with the title rule.
19988 </p>
19989 !! end
19990
19991 !! test
19992 Partly disable title conversion if variant == main language code
19993 !! options
19994 language=zh variant=zh title=[[ZH]] showtitle
19995 !! wikitext
19996 -{T|zh-cn:CN;zh-tw:TW}-
19997 !! html
19998 ZH
19999 <p>
20000 </p>
20001 !! end
20002
20003 !! test
20004 Partly disable title conversion if variant == main language code, more
20005 !! options
20006 language=zh variant=zh title=[[ZH]] showtitle
20007 !! wikitext
20008 -{T|TW}-
20009 !! html
20010 ZH
20011 <p>
20012 </p>
20013 !! end
20014
20015 !! test
20016 Raw output of variant escape tags (R flag)
20017 !! options
20018 language=zh variant=zh-tw
20019 !! wikitext
20020 Raw: -{R|zh:China;zh-tw:Taiwan}-
20021 !! html
20022 <p>Raw: zh:China;zh-tw:Taiwan
20023 </p>
20024 !! end
20025
20026 !! test
20027 Strings evaluating false shouldn't be ignored by Language converter (T51072)
20028 !! options
20029 language=zh variant=zh-cn
20030 !! input
20031 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
20032 !! result
20033 <p>0
20034 </p>
20035 !! end
20036
20037 !! test
20038 Conversion rules from [numeric-only string] to [something else] (T48634)
20039 !! options
20040 language=zh variant=zh-cn
20041 !! input
20042 -{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
20043 !! result
20044 <p>D12345EE12345
20045 </p>
20046 !! end
20047
20048 !! test
20049 Bidirectional converter rule entries with an empty value should be ignored (T53551)
20050 !! options
20051 language=zh variant=zh-cn
20052 !! input
20053 -{H|zh-cn:foo;zh-tw:;}-foobar
20054 !! result
20055 <p>foobar
20056 </p>
20057 !! end
20058
20059 !! test
20060 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
20061 !! options
20062 language=zh variant=zh-cn
20063 !! input
20064 -{H|=>zh-cn:foo;}-foobar
20065 !! result
20066 <p>foobar
20067 </p>
20068 !! end
20069
20070 !! test
20071 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
20072 !! options
20073 language=zh variant=zh-cn
20074 !! input
20075 -{H|}-foobar
20076 !! result
20077 <p>foobar
20078 </p>
20079 !! end
20080
20081 !! test
20082 Nested using of manual convert syntax
20083 !! options
20084 language=zh variant=zh-hk
20085 !! wikitext
20086 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
20087 !! html
20088 <p>Nested: Hello Hong Kong!
20089 </p>
20090 !! end
20091
20092 # Since Parsoid is starting to emit canonical wikitext for links,
20093 # [http://example.com http://example.com] will not RT back to that
20094 # form anymore.
20095 !! test
20096 Proper conversion of text in external links
20097 !! options
20098 language=sr variant=sr-ec
20099 parsoid=wt2html
20100 !! wikitext
20101 http://www.google.com
20102 gopher://www.google.com
20103 [http://www.google.com http://www.google.com]
20104 [gopher://www.google.com gopher://www.google.com]
20105 [https://www.google.com irc://www.google.com]
20106 [ftp://www.google.com www.google.com/ftp://dir]
20107 [//www.google.com www.google.com]
20108 !! html/php
20109 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20110 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20111 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20112 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20113 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
20114 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20115 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
20116 </p>
20117 !! html/parsoid
20118 <p><a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20119 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20120 <a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20121 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20122 <a rel="mw:ExtLink" href="https://www.google.com">irc://www.google.com</a>
20123 <a rel="mw:ExtLink" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20124 <a rel="mw:ExtLink" href="//www.google.com">www.гоогле.цом</a></p>
20125 !! end
20126
20127 !! test
20128 Do not convert roman numbers to language variants
20129 !! options
20130 language=sr variant=sr-ec
20131 !! wikitext
20132 Fridrih IV je car.
20133 !! html
20134 <p>Фридрих IV је цар.
20135 </p>
20136 !! end
20137
20138 !! test
20139 Unclosed language converter markup "-{"
20140 !! options
20141 language=sr
20142 !! wikitext
20143 -{T|hello
20144 !! html
20145 <p>-{T|hello
20146 </p>
20147 !! end
20148
20149 !! test
20150 Don't convert raw rule "-{R|=&gt;}-" to "=>"
20151 !! options
20152 language=sr
20153 !! wikitext
20154 -{R|=&gt;}-
20155 !! html
20156 <p>=&gt;
20157 </p>
20158 !!end
20159
20160 !! test
20161 Don't break link parsing if language converter markup is in the caption.
20162 !! options
20163 language=sr variant=sr-ec
20164 !! wikitext
20165 [[Main Page|-{R|main page}-]]
20166 !! html
20167 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
20168 </p>
20169 !! end
20170
20171 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20172 !! test
20173 Don't break image parsing if language converter markup is in the caption.
20174 !! options
20175 language=sr
20176 !! wikitext
20177 [[File:Foobar.jpg|-{R|caption}-]]
20178 !! html/parsoid
20179 <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>
20180 </p>
20181 !! end
20182
20183 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20184 !! test
20185 Don't break list handling if language converter markup is in the item.
20186 !! options
20187 language=zh variant=zh-cn
20188 !! wikitext
20189 ;-{zh-cn:AAA;zh-tw:BBB}-
20190 !! html/php
20191 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
20192
20193 !! html/parsoid
20194 <dl><dt>AAA
20195 </dt></dl>
20196 !! end
20197
20198 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20199 !! test
20200 Don't break table handling if language converter markup is in the cell.
20201 !! options
20202 language=sr variant=sr-ec
20203 !! wikitext
20204 {|
20205 |-
20206 | -{R|B}-
20207 |}
20208 !! html/php
20209 <table>
20210
20211 <tr>
20212 <td>Б}-
20213 </td></tr></table>
20214
20215 !! html/parsoid
20216 <table>
20217
20218 <tr>
20219 <td> B
20220 </td></tr></table>
20221
20222 !! end
20223
20224 !! test
20225 Bug 529: Uncovered bullet
20226 !! wikitext
20227 * Foo {{bullet}}
20228 !! html
20229 <ul><li> Foo </li>
20230 <li> Bar</li></ul>
20231
20232 !! end
20233
20234 # Plain MediaWiki does not remove empty lists, but tidy actually does.
20235 # Templates in Wikipedia rely on this behavior, as tidy has always been
20236 # enabled there. These tests are normally run *without* tidy, so specify the
20237 # full output here.
20238 # To test realistic parsing behavior, apply a tidy-like transformation to both
20239 # the expected output and your parser's output.
20240 !! test
20241 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
20242 !! wikitext
20243 ******* Foo {{bullet}}
20244 !! html
20245 <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>
20246 <li> Bar</li></ul>
20247
20248 !! end
20249
20250 !! test
20251 Bug 529: Uncovered table already at line-start
20252 !! wikitext
20253 x
20254
20255 {{table}}
20256 y
20257 !! html
20258 <p>x
20259 </p>
20260 <table>
20261 <tr>
20262 <td> 1 </td>
20263 <td> 2
20264 </td></tr>
20265 <tr>
20266 <td> 3 </td>
20267 <td> 4
20268 </td></tr></table>
20269 <p>y
20270 </p>
20271 !! end
20272
20273 !! test
20274 Bug 529: Uncovered bullet in parser function result
20275 !! wikitext
20276 * Foo {{lc:{{bullet}} }}
20277 !! html
20278 <ul><li> Foo </li>
20279 <li> bar</li></ul>
20280
20281 !! end
20282
20283 !! test
20284 Bug 5678: Double-parsed template argument
20285 !! wikitext
20286 {{lc:{{{1}}}|hello}}
20287 !! html
20288 <p>{{{1}}}
20289 </p>
20290 !! end
20291
20292 !! test
20293 Bug 5678: Double-parsed template invocation
20294 !! wikitext
20295 {{lc:{{paramtest {{!}} param = hello }} }}
20296 !! html
20297 <p>{{paramtest | param = hello }}
20298 </p>
20299 !! end
20300
20301 !! test
20302 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
20303 !! options
20304 language=cs
20305 title=[[Main Page]]
20306 !! wikitext
20307 {{PRVNÍVELKÉ:ěščř}}
20308 {{prvnívelké:ěščř}}
20309 {{PRVNÍMALÉ:ěščř}}
20310 {{prvnímalé:ěščř}}
20311 {{MALÁ:ěščř}}
20312 {{malá:ěščř}}
20313 {{VELKÁ:ěščř}}
20314 {{velká:ěščř}}
20315 !! html
20316 <p>Ěščř
20317 Ěščř
20318 ěščř
20319 ěščř
20320 ěščř
20321 ěščř
20322 ĚŠČŘ
20323 ĚŠČŘ
20324 </p>
20325 !! end
20326
20327 !! test
20328 Morwen/13: Unclosed link followed by heading
20329 !! wikitext
20330 [[link
20331 ==heading==
20332 !! html
20333 <p>[[link
20334 </p>
20335 <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>
20336
20337 !! end
20338
20339 !! test
20340 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
20341 !! wikitext
20342 {{foo|
20343 =heading=
20344 !! html
20345 <p>{{foo|
20346 </p>
20347 <h1><span class="mw-headline" id="heading">heading</span></h1>
20348
20349 !! end
20350
20351 !! test
20352 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
20353 !! wikitext
20354 {{foo|
20355 ==heading==
20356 !! html
20357 <p>{{foo|
20358 </p>
20359 <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>
20360
20361 !! end
20362
20363 !! test
20364 Tildes in comments
20365 !! options
20366 pst
20367 !! wikitext
20368 <!-- ~~~~ -->
20369 !! html/php
20370 <!-- ~~~~ -->
20371 !! end
20372
20373 !! test
20374 Paragraphs inside divs (no extra line breaks)
20375 !! wikitext
20376 <div>Line one
20377
20378 Line two</div>
20379 !! html
20380 <div>Line one
20381 Line two</div>
20382
20383 !! end
20384
20385 !! test
20386 Paragraphs inside divs (extra line break on open)
20387 !! wikitext
20388 <div>
20389 Line one
20390
20391 Line two</div>
20392 !! html
20393 <div>
20394 <p>Line one
20395 </p>
20396 Line two</div>
20397
20398 !! end
20399
20400 !! test
20401 Paragraphs inside divs (extra line break on close)
20402 !! wikitext
20403 <div>Line one
20404
20405 Line two
20406 </div>
20407 !! html
20408 <div>Line one
20409 <p>Line two
20410 </p>
20411 </div>
20412
20413 !! end
20414
20415 !! test
20416 Paragraphs inside divs (extra line break on open and close)
20417 !! wikitext
20418 <div>
20419 Line one
20420
20421 Line two
20422 </div>
20423 !! html
20424 <div>
20425 <p>Line one
20426 </p><p>Line two
20427 </p>
20428 </div>
20429
20430 !! end
20431
20432 !! test
20433 Nesting tags, paragraphs on lines which begin with <div>
20434 !! wikitext
20435 <div></div><strong>A
20436 B</strong>
20437 !! html/php+tidy
20438 <p><strong>A</strong></p>
20439 <p><strong>B</strong></p>
20440 !! html/parsoid
20441 <div></div>
20442 <p><strong>A
20443 B</strong>
20444 </p>
20445 !! end
20446
20447 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
20448 !! test
20449 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
20450 !! wikitext
20451 <blockquote>Line one
20452
20453 Line two</blockquote>
20454 !! html
20455 <blockquote>Line one
20456 Line two</blockquote>
20457
20458 !! html+tidy
20459 <blockquote>
20460 <p>Line one Line two</p>
20461 </blockquote>
20462 !! end
20463
20464 !! test
20465 Bug 6200: paragraphs inside blockquotes (extra line break on open)
20466 !! wikitext
20467 <blockquote>
20468 Line one
20469
20470 Line two</blockquote>
20471 !! html
20472 <blockquote>
20473 <p>Line one
20474 </p>
20475 Line two</blockquote>
20476
20477 !! html+tidy
20478 <blockquote>
20479 <p>Line one</p>
20480 Line two</blockquote>
20481 !! end
20482
20483 !! test
20484 Bug 6200: paragraphs inside blockquotes (extra line break on close)
20485 !! wikitext
20486 <blockquote>Line one
20487
20488 Line two
20489 </blockquote>
20490 !! html
20491 <blockquote>Line one
20492 <p>Line two
20493 </p>
20494 </blockquote>
20495
20496 !! html+tidy
20497 <blockquote>
20498 <p>Line one</p>
20499 <p>Line two</p>
20500 </blockquote>
20501 !! end
20502
20503 !! test
20504 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
20505 !! wikitext
20506 <blockquote>
20507 Line one
20508
20509 Line two
20510 </blockquote>
20511 !! html
20512 <blockquote>
20513 <p>Line one
20514 </p><p>Line two
20515 </p>
20516 </blockquote>
20517
20518 !! html+tidy
20519 <blockquote>
20520 <p>Line one</p>
20521 <p>Line two</p>
20522 </blockquote>
20523 !! end
20524
20525 !! test
20526 Paragraphs inside blockquotes/divs (no extra line breaks)
20527 !! wikitext
20528 <blockquote><div>Line one
20529
20530 Line two</div></blockquote>
20531 !! html
20532 <blockquote><div>Line one
20533 Line two</div></blockquote>
20534
20535 !! end
20536
20537 !! test
20538 Paragraphs inside blockquotes/divs (extra line break on open)
20539 !! wikitext
20540 <blockquote><div>
20541 Line one
20542
20543 Line two</div></blockquote>
20544 !! html
20545 <blockquote><div>
20546 <p>Line one
20547 </p>
20548 Line two</div></blockquote>
20549
20550 !! end
20551
20552 !! test
20553 Paragraphs inside blockquotes/divs (extra line break on close)
20554 !! wikitext
20555 <blockquote><div>Line one
20556
20557 Line two
20558 </div></blockquote>
20559 !! html
20560 <blockquote><div>Line one
20561 <p>Line two
20562 </p>
20563 </div></blockquote>
20564
20565 !! end
20566
20567 !! test
20568 Paragraphs inside blockquotes/divs (extra line break on open and close)
20569 !! wikitext
20570 <blockquote><div>
20571 Line one
20572
20573 Line two
20574 </div></blockquote>
20575 !! html
20576 <blockquote><div>
20577 <p>Line one
20578 </p><p>Line two
20579 </p>
20580 </div></blockquote>
20581
20582 !! end
20583
20584 !! test
20585 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
20586 !! options
20587 wgLinkHolderBatchSize=0
20588 !! wikitext
20589 [[meatball:1]]
20590 [[meatball:2]]
20591 [[meatball:3]]
20592 !! html
20593 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
20594 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
20595 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
20596 </p>
20597 !! end
20598
20599 !! test
20600 Free external link invading image caption
20601 !! wikitext
20602 [[Image:Foobar.jpg|thumb|http://x|hello]]
20603 !! html
20604 <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>
20605
20606 !! end
20607
20608 !! test
20609 Bug 15196: localised external link numbers
20610 !! options
20611 language=fa
20612 !! wikitext
20613 [http://en.wikipedia.org/]
20614 !! html/php
20615 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
20616 </p>
20617 !! html/parsoid
20618 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
20619 !! end
20620
20621 !! test
20622 Multibyte character in padleft
20623 !! wikitext
20624 {{padleft:-Hello|7|Æ}}
20625 !! html
20626 <p>Æ-Hello
20627 </p>
20628 !! end
20629
20630 !! test
20631 Multibyte character in padright
20632 !! wikitext
20633 {{padright:Hello-|7|Æ}}
20634 !! html
20635 <p>Hello-Æ
20636 </p>
20637 !! end
20638
20639 !!test
20640 formatdate parser function
20641 !! wikitext
20642 {{#formatdate:2009-03-24}}
20643 !! html
20644 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
20645 </p>
20646 !! end
20647
20648 !!test
20649 formatdate parser function, with default format
20650 !! wikitext
20651 {{#formatdate:2009-03-24|mdy}}
20652 !! html
20653 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
20654 </p>
20655 !! end
20656
20657 !! test
20658 Spacing of numbers in formatted dates
20659 !! wikitext
20660 {{#formatdate:January 15}}
20661 !! html
20662 <p><span class="mw-formatted-date" title="01-15">January 15</span>
20663 </p>
20664 !! end
20665
20666 !! test
20667 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
20668 !! options
20669 language=nl title=[[MediaWiki:Common.css]]
20670 !! wikitext
20671 {{#formatdate:2009-03-24|dmy}}
20672 !! html
20673 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
20674 </p>
20675 !! end
20676
20677 #
20678 #
20679 #
20680
20681 #
20682 # Edit comments
20683 #
20684
20685 !! test
20686 Edit comment with link
20687 !! options
20688 comment
20689 !! wikitext
20690 I like the [[Main Page]] a lot
20691 !! html/php
20692 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
20693 !!end
20694
20695 !! test
20696 Edit comment with link and link text
20697 !! options
20698 comment
20699 !! wikitext
20700 I like the [[Main Page|best pages]] a lot
20701 !! html/php
20702 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20703 !!end
20704
20705 !! test
20706 Edit comment with link and link text with suffix
20707 !! options
20708 comment
20709 !! wikitext
20710 I like the [[Main Page|best page]]s a lot
20711 !! html/php
20712 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20713 !!end
20714
20715 !! test
20716 Edit comment with section link (non-local, eg in history list)
20717 !! options
20718 comment title=[[Main Page]]
20719 !! wikitext
20720 /* External links */ removed bogus entries
20721 !! html/php
20722 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20723 !!end
20724
20725 !! test
20726 Edit comment with section link and text before it (non-local, eg in history list)
20727 !! options
20728 comment title=[[Main Page]]
20729 !! wikitext
20730 pre-comment text /* External links */ removed bogus entries
20731 !! html/php
20732 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>
20733 !!end
20734
20735 !! test
20736 Edit comment with section link (local, eg in diff view)
20737 !! options
20738 comment local title=[[Main Page]]
20739 !! wikitext
20740 /* External links */ removed bogus entries
20741 !! html/php
20742 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20743 !!end
20744
20745 !! test
20746 Edit comment with subpage link (bug 14080)
20747 !! options
20748 comment
20749 subpage
20750 title=[[Subpage test]]
20751 !! wikitext
20752 Poked at a [[/subpage]] here...
20753 !! html/php
20754 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
20755 !!end
20756
20757 !! test
20758 Edit comment with subpage link and link text (bug 14080)
20759 !! options
20760 comment
20761 subpage
20762 title=[[Subpage test]]
20763 !! wikitext
20764 Poked at a [[/subpage|neat little page]] here...
20765 !! html/php
20766 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
20767 !!end
20768
20769 !! test
20770 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
20771 !! options
20772 comment
20773 title=[[Subpage test]]
20774 !! wikitext
20775 Poked at a [[/subpage]] here...
20776 !! html/php
20777 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...
20778 !!end
20779
20780 !! test
20781 Edit comment with bare anchor link (local, as on diff)
20782 !! options
20783 comment
20784 local
20785 title=[[Main Page]]
20786 !! wikitext
20787 [[#section]]
20788 !! html/php
20789 <a href="#section">#section</a>
20790 !! end
20791
20792 !! test
20793 Edit comment with bare anchor link (non-local, as on history)
20794 !! options
20795 comment
20796 title=[[Main Page]]
20797 !! wikitext
20798 [[#section]]
20799 !! html/php
20800 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
20801 !! end
20802
20803 !! test
20804 Anchor starting with underscore
20805 !! options
20806 title=[[Foo]]
20807 !! wikitext
20808 [[#_ref|One]]
20809 !! html/php
20810 <p><a href="#_ref">One</a>
20811 </p>
20812 !! html/parsoid
20813 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
20814 !! end
20815
20816 !! test
20817 Id starting with underscore
20818 !! wikitext
20819 <div id="_ref"></div>
20820 !! html/*
20821 <div id="_ref"></div>
20822
20823 !! end
20824
20825 !! test
20826 Space normalisation on autocomment (bug 22784)
20827 !! options
20828 comment
20829 title=[[Main Page]]
20830 !! wikitext
20831 /* __hello__world__ */
20832 !! html/php
20833 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
20834 !! end
20835
20836 !! test
20837 percent-encoding and + signs in comments (Bug 26410)
20838 !! options
20839 comment
20840 !! wikitext
20841 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
20842 !! html/php
20843 <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>
20844 !! end
20845
20846 # Parsoid doesn't support this yet: see bug 73581
20847 # but it *should* omit the 'src' attribute if the image is bad.
20848 # PHP side of tests was disabled in
20849 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
20850 # because of issues in the PHP parserTests infrastructure
20851 # (but the output below is indeed what the PHP side emits)
20852 !! test
20853 Bad images - basic functionality
20854 !! wikitext
20855 [[File:Bad.jpg]]
20856 !! DISABLED/html/php
20857 !! html/parsoid
20858 <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>
20859 !! end
20860
20861 !! test
20862 Bad images - bug 16039: text after bad image disappears
20863 !! wikitext
20864 Foo bar
20865 [[File:Bad.jpg]]
20866 Bar foo
20867 !! DISABLED/html/php
20868 <p>Foo bar
20869 </p><p>Bar foo
20870 </p>
20871 !! html/parsoid
20872 <p>Foo bar
20873 <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>
20874 Bar foo</p>
20875 !! end
20876
20877 !! test
20878 Verify that displaytitle works (bug #22501) no displaytitle
20879 !! options
20880 showtitle
20881 !! config
20882 wgAllowDisplayTitle=true
20883 wgRestrictDisplayTitle=false
20884 !! wikitext
20885 this is not the the title
20886 !! html/php
20887 Parser test
20888 <p>this is not the the title
20889 </p>
20890 !! end
20891
20892 !! test
20893 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
20894 !! options
20895 showtitle
20896 title=[[Screen]]
20897 !! config
20898 wgAllowDisplayTitle=true
20899 wgRestrictDisplayTitle=false
20900 !! wikitext
20901 this is not the the title
20902 {{DISPLAYTITLE:whatever}}
20903 !! html/php
20904 whatever
20905 <p>this is not the the title
20906 </p>
20907 !! end
20908
20909 !! test
20910 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
20911 !! options
20912 showtitle
20913 title=[[Screen]]
20914 !! config
20915 wgAllowDisplayTitle=true
20916 wgRestrictDisplayTitle=true
20917 !! wikitext
20918 this is not the the title
20919 {{DISPLAYTITLE:whatever}}
20920 !! html/php
20921 Screen
20922 <p>this is not the the title
20923 </p>
20924 !! end
20925
20926 !! test
20927 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
20928 !! options
20929 showtitle
20930 title=[[Screen]]
20931 !! config
20932 wgAllowDisplayTitle=true
20933 wgRestrictDisplayTitle=true
20934 !! wikitext
20935 this is not the the title
20936 {{DISPLAYTITLE:screen}}
20937 !! html/php
20938 screen
20939 <p>this is not the the title
20940 </p>
20941 !! end
20942
20943 !! test
20944 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
20945 !! options
20946 showtitle
20947 title=[[Screen]]
20948 !! config
20949 wgAllowDisplayTitle=false
20950 !! wikitext
20951 this is not the the title
20952 {{DISPLAYTITLE:screen}}
20953 !! html/php
20954 Screen
20955 <p>this is not the the title
20956 <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>
20957 </p>
20958 !! end
20959
20960 !! test
20961 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
20962 !! options
20963 showtitle
20964 title=[[Screen]]
20965 !! config
20966 wgAllowDisplayTitle=false
20967 !! wikitext
20968 this is not the the title
20969 !! html/php
20970 Screen
20971 <p>this is not the the title
20972 </p>
20973 !! end
20974
20975 !! test
20976 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
20977 !! options
20978 showtitle
20979 title=[[Screen]]
20980 !! config
20981 wgAllowDisplayTitle=true
20982 wgRestrictDisplayTitle=true
20983 !! wikitext
20984 this is not the the title
20985 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
20986 !! html/php
20987 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
20988 <p>this is not the the title
20989 </p>
20990 !! end
20991
20992 !! test
20993 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
20994 !! options
20995 showtitle
20996 title=[[Screen]]
20997 !! config
20998 wgAllowDisplayTitle=true
20999 wgRestrictDisplayTitle=true
21000 !! wikitext
21001 this is not the the title
21002 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
21003 !! html/php
21004 <span style="color: red;">s</span>creen
21005 <p>this is not the the title
21006 </p>
21007 !! end
21008
21009 !! test
21010 Page status indicators: Empty name is invalid
21011 !! options
21012 showindicators
21013 !! wikitext
21014 <indicator name=" "></indicator>
21015 <indicator></indicator>
21016 !! html
21017 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21018 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21019 </p>
21020 !! end
21021
21022 !! test
21023 Page status indicators: Weird syntaxes that are okay
21024 !! options
21025 showindicators
21026 !! wikitext
21027 <indicator name="empty" />
21028 <indicator name="name"></indicator>
21029 !! html
21030 empty=
21031 name=
21032 <p><br />
21033 </p>
21034 !! end
21035
21036 !! test
21037 Page status indicators: Torture test
21038 !! options
21039 showindicators
21040 !! wikitext
21041 <indicator name="01">hello world</indicator>
21042 <indicator name="02">[[Main Page]]</indicator>
21043 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
21044 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
21045 <indicator name="05">* foo
21046 * bar</indicator>
21047 <indicator name="06"><nowiki>foo</nowiki></indicator>
21048 <indicator name="07"> Preformatted</indicator>
21049 <indicator name="08"><div>Broken tag</indicator>
21050 <indicator name="09">{| class=wikitable
21051 | cell
21052 |}</indicator>
21053 <indicator name="10">Two
21054
21055 paragraphs</indicator>
21056 !! html
21057 01=hello world
21058 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21059 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" />
21060 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>
21061 05=<ul><li> foo</li>
21062 <li> bar</li></ul>
21063
21064 06=foo
21065 07=<pre>Preformatted
21066 </pre>
21067 08=<div>Broken tag</div>
21068
21069 09=<table class="wikitable">
21070 <tr>
21071 <td> cell
21072 </td></tr></table>
21073
21074 10=<p>Two
21075 </p><p>paragraphs
21076 </p>
21077 <p><br />
21078 </p><p><br />
21079 </p><p><br />
21080 </p><p><br />
21081 </p><p><br />
21082 </p>
21083 !! end
21084
21085 !! test
21086 preload: check <noinclude> and <includeonly>
21087 !! options
21088 preload
21089 !! wikitext
21090 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
21091 !! html/php
21092 Hello kind world.
21093 !! end
21094
21095 !! test
21096 preload: check <onlyinclude>
21097 !! options
21098 preload
21099 !! wikitext
21100 Goodbye <onlyinclude>Hello world</onlyinclude>
21101 !! html/php
21102 Hello world
21103 !! end
21104
21105 !! test
21106 preload: can pass tags through if we want to
21107 !! options
21108 preload
21109 !! wikitext
21110 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
21111 !! html/php
21112 <includeonly>Hello world</includeonly>
21113 !! end
21114
21115 !! test
21116 preload: check that it doesn't try to do tricks
21117 !! options
21118 preload
21119 !! wikitext
21120 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21121 !! html/php
21122 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21123 !! end
21124
21125 !! test
21126 Play a bit with r67090 and bug 3158
21127 !! wikitext
21128 <div style="width:50% !important">&nbsp;</div>
21129 <div style="width:50%&nbsp;!important">&nbsp;</div>
21130 <div style="width:50%&#160;!important">&nbsp;</div>
21131 <div style="border : solid;">&nbsp;</div>
21132 !! html/php
21133 <div style="width:50% !important">&#160;</div>
21134 <div style="width:50% !important">&#160;</div>
21135 <div style="width:50% !important">&#160;</div>
21136 <div style="border&#160;: solid;">&#160;</div>
21137
21138 !! html/parsoid
21139 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21140 <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>
21141 <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>
21142 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21143
21144 !! end
21145
21146 !! test
21147 HTML5 data attributes
21148 !! wikitext
21149 <span data-foo="bar">Baz</span>
21150 <p data-abc-def_hij="">Quuz</p>
21151 !! html/php
21152 <p><span data-foo="bar">Baz</span>
21153 </p>
21154 <p data-abc-def_hij="">Quuz</p>
21155
21156 !! html/parsoid
21157 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
21158 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
21159 !! end
21160
21161 !! test
21162 Strip reserved data attributes
21163 !! wikitext
21164 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
21165 !! html/php
21166 <div data-ok="fred">d</div>
21167
21168 !! html/parsoid
21169 <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>
21170 !! end
21171
21172 !! test
21173 percent-encoding and + signs in internal links (Bug 26410)
21174 !! wikitext
21175 [[User:+%]] [[Page+title%]]
21176 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
21177 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
21178 [[%33%45]] [[%33%45+]]
21179 !! html/php
21180 <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>
21181 <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>
21182 <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>
21183 <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>
21184 </p>
21185 !! html/parsoid
21186 <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>
21187 <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>
21188 <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>
21189 <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>
21190 !! end
21191
21192 !! test
21193 Special characters in embedded file links (bug 27679)
21194 !! wikitext
21195 [[File:Contains & ampersand.jpg]]
21196 [[File:Does not exist.jpg|Title with & ampersand]]
21197 !! html/php
21198 <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>
21199 <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>
21200 </p>
21201 !! html/parsoid
21202 <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>
21203 <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>
21204 !! end
21205
21206 !! test
21207 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
21208 !! wikitext
21209 Text&apos;s been normalized?
21210 !! html
21211 <p>Text&#39;s been normalized?
21212 </p>
21213 !! end
21214
21215 !! test
21216 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
21217 !! wikitext
21218 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
21219 !! html
21220 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
21221 </p>
21222 !! end
21223
21224 !! test
21225 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
21226 !! wikitext
21227 [http://www.example.org/ ideograms]
21228 !! html
21229 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
21230 </p>
21231 !! end
21232
21233 !! test
21234 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
21235 !! wikitext
21236 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
21237 !! html
21238 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
21239 </p>
21240 !! end
21241
21242 !! article
21243 Mediawiki:loop1
21244 !! text
21245 {{Identical|A}}
21246 !! endarticle
21247
21248 !! article
21249 Mediawiki:loop2
21250 !! text
21251 {{Identical|B}}
21252 !! endarticle
21253
21254 !! article
21255 Template:Identical
21256 !! text
21257 {{int:loop1}}
21258 {{int:loop2}}
21259 !! endarticle
21260
21261 !! test
21262 Bug 31098 Template which includes system messages which includes the template
21263 !! wikitext
21264 {{Identical}}
21265 !! html
21266 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21267 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21268 </p>
21269 !! end
21270
21271 !! test
21272 Bug31490 Turkish: ucfirst 'blah'
21273 !! options
21274 language=tr
21275 !! wikitext
21276 {{ucfirst:blah}}
21277 !! html
21278 <p>Blah
21279 </p>
21280 !! end
21281
21282 !! test
21283 Bug31490 Turkish: ucfirst 'ix'
21284 !! options
21285 language=tr
21286 !! wikitext
21287 {{ucfirst:ix}}
21288 !! html
21289 <p>İx
21290 </p>
21291 !! end
21292
21293 !! test
21294 Bug31490 Turkish: lcfirst 'BLAH'
21295 !! options
21296 language=tr
21297 !! wikitext
21298 {{lcfirst:BLAH}}
21299 !! html
21300 <p>bLAH
21301 </p>
21302 !! end
21303
21304 !! test
21305 Bug31490 Turkish: ucfırst (with a dotless i)
21306 !! options
21307 language=tr
21308 !! wikitext
21309 {{ucfırst:blah}}
21310 !! html
21311 <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>
21312 </p>
21313 !! end
21314
21315 !! test
21316 Bug31490 ucfırst (with a dotless i) with English language
21317 !! options
21318 language=en
21319 !! wikitext
21320 {{ucfırst:blah}}
21321 !! html
21322 <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>
21323 </p>
21324 !! end
21325
21326 !! test
21327 Bug 26375: TOC with italics
21328 !! options
21329 title=[[Main Page]]
21330 !! wikitext
21331 __TOC__
21332 == ''Lost'' episodes ==
21333 !! html
21334 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21335 <ul>
21336 <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>
21337 </ul>
21338 </div>
21339
21340 <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>
21341
21342 !! end
21343
21344 !! test
21345 Bug 26375: TOC with bold
21346 !! options
21347 title=[[Main Page]]
21348 !! wikitext
21349 __TOC__
21350 == '''should be bold''' then normal text ==
21351 !! html
21352 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21353 <ul>
21354 <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>
21355 </ul>
21356 </div>
21357
21358 <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>
21359
21360 !! end
21361
21362 !! test
21363 Bug 33845: Headings become cursive in TOC when they contain an image
21364 !! options
21365 title=[[Main Page]]
21366 !! wikitext
21367 __TOC__
21368 == Image [[Image:foobar.jpg]] ==
21369 !! html
21370 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21371 <ul>
21372 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
21373 </ul>
21374 </div>
21375
21376 <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>
21377
21378 !! end
21379
21380 !! test
21381 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
21382 !! options
21383 title=[[Main Page]]
21384 !! wikitext
21385 __TOC__
21386 == <blockquote>Quote</blockquote> ==
21387 !! html
21388 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21389 <ul>
21390 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21391 </ul>
21392 </div>
21393
21394 <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>
21395
21396 !! html+tidy
21397 <p></p>
21398 <div id="toc" class="toc">
21399 <div id="toctitle">
21400 <h2>Contents</h2>
21401 </div>
21402 <ul>
21403 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21404 </ul>
21405 </div>
21406 <p></p>
21407 <h2><span class="mw-headline" id="Quote"></span></h2>
21408 <blockquote>
21409 <p><span class="mw-headline" id="Quote">Quote</span></p>
21410 </blockquote>
21411 <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>
21412 !! end
21413
21414 !! test
21415 Unclosed tags in TOC
21416 !! options
21417 title=[[Main Page]]
21418 !! wikitext
21419 __TOC__
21420 == Proof: 2 < 3 ==
21421 <small>Hanc marginis exiguitas non caperet.</small>
21422 QED
21423 !! html
21424 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21425 <ul>
21426 <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>
21427 </ul>
21428 </div>
21429
21430 <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>
21431 <p><small>Hanc marginis exiguitas non caperet.</small>
21432 QED
21433 </p>
21434 !! end
21435
21436 !! test
21437 Multiple tags in TOC
21438 !! wikitext
21439 __TOC__
21440 == <i>Foo</i> <b>Bar</b> ==
21441
21442 == <i>Foo</i> <blockquote>Bar</blockquote> ==
21443 !! html
21444 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21445 <ul>
21446 <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>
21447 <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>
21448 </ul>
21449 </div>
21450
21451 <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>
21452 <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>
21453
21454 !! html+tidy
21455 <p></p>
21456 <div id="toc" class="toc">
21457 <div id="toctitle">
21458 <h2>Contents</h2>
21459 </div>
21460 <ul>
21461 <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>
21462 <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>
21463 </ul>
21464 </div>
21465 <p></p>
21466 <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>
21467 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
21468 <blockquote>
21469 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
21470 </blockquote>
21471 <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>
21472 !! end
21473
21474 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
21475 # html5 tag parsing.
21476 !! test
21477 Tags with parameters in TOC
21478 !! options
21479 parsoid=wt2html
21480 !! wikitext
21481 __TOC__
21482 == <sup class="in-h2">Hello</sup> ==
21483
21484 == <sup class="a > b">Evilbye</sup> ==
21485 !! html/php
21486 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21487 <ul>
21488 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
21489 <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>
21490 </ul>
21491 </div>
21492
21493 <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>
21494 <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>
21495
21496 !! html/parsoid
21497 <meta property="mw:PageProp/toc" />
21498 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
21499
21500 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
21501 !! end
21502
21503 !! test
21504 span tags with directionality in TOC
21505 !! wikitext
21506 __TOC__
21507 == <span dir="ltr">C++</span> ==
21508
21509 == <span dir="rtl">זבנג!</span> ==
21510
21511 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
21512
21513 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
21514
21515 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
21516 !! html
21517 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21518 <ul>
21519 <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>
21520 <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>
21521 <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>
21522 <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>
21523 <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>
21524 </ul>
21525 </div>
21526
21527 <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>
21528 <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>
21529 <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>
21530 <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>
21531 <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>
21532
21533 !! end
21534
21535 !! test
21536 Bug 72884: bdi element in ToC
21537 !! wikitext
21538 __TOC__
21539 == <bdi>test</bdi> ==
21540 !! html
21541 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21542 <ul>
21543 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
21544 </ul>
21545 </div>
21546
21547 <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>
21548
21549 !! end
21550
21551 # Note that the html output does not have the <p></p>, but the
21552 # html+tidy output *does*. This is because the empty <p></p> is
21553 # removed by the sanitizer, but only when tidy is *not* enabled (!).
21554 !! test
21555 Empty <p> tag in TOC, removed by Sanitizer (T92892)
21556 !! wikitext
21557 __TOC__
21558 == x ==
21559 !! html
21560 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21561 <ul>
21562 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21563 </ul>
21564 </div>
21565
21566 <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>
21567
21568 !! html+tidy
21569 <p></p>
21570 <div id="toc" class="toc">
21571 <div id="toctitle">
21572 <h2>Contents</h2>
21573 </div>
21574 <ul>
21575 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21576 </ul>
21577 </div>
21578 <p></p>
21579 <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>
21580 !! end
21581
21582 !! article
21583 MediaWiki:Bug32057
21584 !! text
21585 == {{int:headline_sample}} ==
21586 !! endarticle
21587
21588 !! test
21589 Bug 32057: Title needed when expanding <h> nodes.
21590 !! options
21591 title=[[Main Page]]
21592 !! wikitext
21593 {{int:Bug32057}}
21594 !! html
21595 <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>
21596
21597 !! end
21598
21599 !! test
21600 Strip marker in urlencode
21601 !! wikitext
21602 {{urlencode:x<nowiki/>y}}
21603 {{urlencode:x<nowiki/>y|wiki}}
21604 {{urlencode:x<nowiki/>y|path}}
21605 {{urlencode:x<pre id="one">two</pre>y}}
21606 !! html
21607 <p>xy
21608 xy
21609 xy
21610 xy
21611 </p>
21612 !! end
21613
21614 !! test
21615 Strip marker in lc
21616 !! wikitext
21617 {{lc:x<nowiki/>y}}
21618 !! html
21619 <p>xy
21620 </p>
21621 !! end
21622
21623 !! test
21624 Strip marker in uc
21625 !! wikitext
21626 {{uc:x<nowiki/>y}}
21627 !! html
21628 <p>XY
21629 </p>
21630 !! end
21631
21632 !! test
21633 Strip marker in formatNum
21634 !! wikitext
21635 {{formatnum:1<nowiki/>2}}
21636 {{formatnum:1<nowiki/>2|R}}
21637 !! html
21638 <p>12
21639 12
21640 </p>
21641 !! end
21642
21643 !! test
21644 Check noCommafy in formatNum
21645 !! options
21646 language=be-tarask
21647 !! wikitext
21648 {{formatnum:123456.78}}
21649 {{formatnum:123456.78|NOSEP}}
21650 !! html
21651 <p>123 456,78
21652 123456.78
21653 </p>
21654 !! end
21655
21656 !! test
21657 Wrong option for formatNum (bug 56199)
21658 !! wikitext
21659 {{formatnum:1,234.56|Random}}
21660 {{formatnum:1,234.56|EVERYTHING}}
21661 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
21662 !! html
21663 <p>1,234.56
21664 1,234.56
21665 1,234.56
21666 </p>
21667 !! end
21668
21669 !! test
21670 Strip marker in grammar
21671 !! options
21672 language=fi
21673 !! wikitext
21674 {{grammar:elative|foo<nowiki/>bar}}
21675 !! html
21676 <p>foobarista
21677 </p>
21678 !! end
21679
21680 !! test
21681 Strip marker in padleft
21682 !! wikitext
21683 {{padleft:|2|x<nowiki/>y}}
21684 !! html
21685 <p>xy
21686 </p>
21687 !! end
21688
21689 !! test
21690 Strip marker in padright
21691 !! wikitext
21692 {{padright:|2|x<nowiki/>y}}
21693 !! html
21694 <p>xy
21695 </p>
21696 !! end
21697
21698 !! test
21699 Strip marker in anchorencode
21700 !! wikitext
21701 {{anchorencode:x<nowiki/>y}}
21702 !! html
21703 <p>xy
21704 </p>
21705 !! end
21706
21707 !! test
21708 nowiki inside link inside heading (bug 18295)
21709 !! wikitext
21710 ==[[foo|x<nowiki>y</nowiki>z]]==
21711 !! html
21712 <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>
21713
21714 !! end
21715
21716 !! test
21717 new support for bdi element (bug 31817)
21718 !! wikitext
21719 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21720 !! html
21721 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21722
21723 !!end
21724
21725 !! test
21726 Ignore pipe between table row attributes
21727 !! wikitext
21728 {|
21729 | quux
21730 |- id=foo | style='color: red'
21731 | bar
21732 |}
21733 !! html
21734 <table>
21735 <tr>
21736 <td> quux
21737 </td></tr>
21738 <tr id="foo" style="color: red">
21739 <td> bar
21740 </td></tr></table>
21741
21742 !! end
21743
21744 !!test
21745 Gallery override link with WikiLink (bug 34852)
21746 !! wikitext
21747 <gallery>
21748 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
21749 </gallery>
21750 !! html
21751 <ul class="gallery mw-gallery-traditional">
21752 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21753 <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>
21754 <div class="gallerytext">
21755 <p>caption
21756 </p>
21757 </div>
21758 </div></li>
21759 </ul>
21760
21761 !! end
21762
21763 !!test
21764 Gallery override link with absolute external link (bug 34852)
21765 !! wikitext
21766 <gallery>
21767 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21768 </gallery>
21769 !! html
21770 <ul class="gallery mw-gallery-traditional">
21771 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21772 <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>
21773 <div class="gallerytext">
21774 <p>caption
21775 </p>
21776 </div>
21777 </div></li>
21778 </ul>
21779
21780 !! end
21781
21782 !!test
21783 Gallery override link with malicious javascript (bug 34852)
21784 !! wikitext
21785 <gallery>
21786 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21787 </gallery>
21788 !! html
21789 <ul class="gallery mw-gallery-traditional">
21790 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21791 <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>
21792 <div class="gallerytext">
21793 <p>caption
21794 </p>
21795 </div>
21796 </div></li>
21797 </ul>
21798
21799 !! end
21800
21801 !!test
21802 Gallery with invalid title as link (bug 43964)
21803 !! wikitext
21804 <gallery>
21805 File:foobar.jpg|link=<
21806 </gallery>
21807 !! html
21808 <ul class="gallery mw-gallery-traditional">
21809 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21810 <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>
21811 <div class="gallerytext">
21812 </div>
21813 </div></li>
21814 </ul>
21815
21816 !! end
21817
21818 !!test
21819 Language parser function
21820 !! wikitext
21821 {{#language:ar}}
21822 !! html
21823 <p>العربية
21824 </p>
21825 !! end
21826
21827 !!test
21828 Padleft and padright as substr
21829 !! wikitext
21830 {{padleft:|3|abcde}}
21831 {{padright:|3|abcde}}
21832 !! html
21833 <p>abc
21834 abc
21835 </p>
21836 !! end
21837
21838 !!test
21839 Special parser function
21840 !! wikitext
21841 {{#special:RandomPage}}
21842 {{#special:BaDtItLe}}
21843 {{#special:Foobar}}
21844 !! html
21845 <p>Special:Random
21846 Special:Badtitle
21847 Special:Foobar
21848 </p>
21849 !! end
21850
21851 !!test
21852 Bug 34939 - Case insensitive link parsing ([HttP://])
21853 !! wikitext
21854 [HttP://MediaWiki.Org/]
21855 !! html/php
21856 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
21857 </p>
21858 !! html/parsoid
21859 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
21860 !! end
21861
21862 !!test
21863 Bug 34939 - Case insensitive link parsing ([HttP:// title])
21864 !! wikitext
21865 [HttP://MediaWiki.Org/ MediaWiki]
21866 !! html
21867 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
21868 </p>
21869 !! end
21870
21871 !!test
21872 Bug 34939 - Case insensitive link parsing (HttP://)
21873 !! wikitext
21874 HttP://MediaWiki.Org/
21875 !! html/php
21876 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
21877 </p>
21878 !! html/parsoid
21879 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
21880 !! end
21881
21882 !!test
21883 Disable TOC
21884 !! options
21885 notoc
21886 !! wikitext
21887 Lead
21888 == Section 1 ==
21889 == Section 2 ==
21890 == Section 3 ==
21891 == Section 4 ==
21892 == Section 5 ==
21893 !! html
21894 <p>Lead
21895 </p>
21896
21897 <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>
21898 <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>
21899 <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>
21900 <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>
21901 <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>
21902
21903 !! end
21904
21905
21906 ###
21907 ### Parsoid-specific tests
21908 ### Parsoid-PHP parser incompatibilities
21909 ###
21910 !!test
21911 1. SOL-sensitive wikitext tokens as template-args
21912 !!options
21913 parsoid=wt2html,wt2wt
21914 !! wikitext
21915 {{echo|*a}}
21916 {{echo|#a}}
21917 {{echo|:a}}
21918 !! html
21919 <span about="#mwt1" typeof="mw:Transclusion">
21920 </span><ul about="#mwt1"><li>a</li>
21921 </ul>
21922 <span about="#mwt2" typeof="mw:Transclusion">
21923 </span><ol about="#mwt2"><li>a</li>
21924 </ol>
21925 <span about="#mwt3" typeof="mw:Transclusion">
21926 </span><dl about="#mwt3"><dd>a</dd>
21927 </dl>
21928 !!end
21929
21930 #### -----------------------------------------------------------------
21931 #### Parsoid-specific functionality tests
21932 #### -----------------------------------------------------------------
21933
21934 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
21935 # We know wt2wt will fail, but we expect selser to pass.
21936 # Due to the nature of our testing, wt2wt and selser tests will enter the
21937 # blacklist and we'll catch selser regressions based on changes to the
21938 # blacklist entries for selser tests.
21939 !! test
21940 1. Bad treebuilder fixup of formatting elt is cleaned up
21941 !! options
21942 parsoid=wt2html,wt2wt
21943 !! wikitext
21944 {|
21945 |
21946 <small>
21947 [[Image:Foobar.jpg|right|Test]]
21948 </small>
21949 |}
21950 !! html/parsoid
21951 <table>
21952 <tbody><tr><td>
21953 <small>
21954 <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>
21955 </small>
21956 </td></tr>
21957 </tbody></table>
21958 !! end
21959
21960 !! test
21961 2. Bad treebuilder fixup of formatting elt is cleaned up
21962 !! options
21963 parsoid=wt2html,wt2wt
21964 !! wikitext
21965 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
21966
21967 <small>[[Image:Foobar.jpg|right|300px]]</small>
21968 !! html/parsoid
21969
21970 <p><b>foo</b></p>
21971 <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>
21972 <p><b>bar</b></p>
21973 <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>
21974 !! end
21975
21976 !! test
21977 3. Bad treebuilder fixup of formatting elt is cleaned up
21978 !! options
21979 parsoid=wt2html,wt2wt
21980 !! wikitext
21981 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
21982 !! html/parsoid
21983 <p><small><b>foo</b></small></p>
21984 <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>
21985 <p><small><b>bar</b></small></p>
21986 !! end
21987
21988 !! test
21989 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
21990 !! options
21991 parsoid=wt2html,wt2wt
21992 !! wikitext
21993 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
21994 !! html/parsoid
21995 <p><b><small></small></b></p>
21996 <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>
21997 <p></p>
21998 !! end
21999
22000 #### ----------------------------------------------------------------
22001 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
22002 #### tags. Parsoid's output for these tags differs from that of the
22003 #### PHP parser.
22004 #### ----------------------------------------------------------------
22005
22006 !!test
22007 Ref: 1. ref-location should be replaced with an index span
22008 !! wikitext
22009 A <ref>foo</ref>
22010 B <ref name="x">foo</ref>
22011 C <ref name="y" />
22012 <references />
22013 !! html/parsoid
22014 <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>
22015 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>
22016 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>
22017 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22018 <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>
22019 <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>
22020 <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>
22021 </ol>
22022 !!end
22023
22024 !!test
22025 Ref: 2. ref-tags with identical names should all get the same index
22026 !! wikitext
22027 A <ref name="x">foo</ref>
22028 B <ref name="x" />
22029 <references />
22030 !! html/parsoid
22031 <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>
22032 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>
22033 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22034 <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>
22035 </ol>
22036 !!end
22037
22038 !!test
22039 Ref: 3. spaces in ref-names should be ignored
22040 !! wikitext
22041 A <ref name="x">foo</ref>
22042 B <ref name=" x " />
22043 C <ref name= x />
22044 <references />
22045 !! html/parsoid
22046 <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>
22047 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>
22048 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>
22049 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22050 <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>
22051 </ol>
22052 !!end
22053
22054 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
22055 !!test
22056 Ref: 4. 'constructor' should be accepted as a valid ref-name
22057 !! wikitext
22058 A <ref name="constructor">foo</ref>
22059 <references />
22060 !! html/parsoid
22061 <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>
22062 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22063 <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>
22064 </ol>
22065 !!end
22066
22067 !!test
22068 Ref: 5. body should accept generic wikitext
22069 !! wikitext
22070 A <ref>
22071 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
22072 </ref>
22073
22074 <references />
22075 !! html/parsoid
22076 <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>
22077
22078 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22079 <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>
22080 </span></li>
22081 </ol>
22082 !!end
22083
22084 !!test
22085 Ref: 6. indent-pres should not be output in ref-body
22086 !! wikitext
22087 A <ref>
22088 foo
22089 bar
22090 baz
22091 </ref>
22092
22093 <references />
22094 !! html/parsoid
22095 <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>
22096
22097 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22098 <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
22099 bar
22100 baz
22101 </span></li>
22102 </ol>
22103 !!end
22104
22105 !!test
22106 Ref: 7. No p-wrapping in ref-body
22107 !! wikitext
22108 A <ref>
22109 foo
22110
22111 bar
22112
22113
22114 baz
22115
22116
22117
22118 booz
22119 </ref>
22120
22121 <references />
22122 !! html/parsoid
22123 <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>
22124
22125 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22126 <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
22127
22128 bar
22129
22130
22131 baz
22132
22133
22134
22135 booz
22136 </span></li>
22137 </ol>
22138 !!end
22139
22140 !!test
22141 Ref: 8. transclusion wikitext has lower precedence
22142 !! wikitext
22143 A <ref> foo {{echo|</ref> B C}}
22144
22145 <references />
22146 !! html/parsoid
22147 <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>
22148 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22149 <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>
22150 </ol>
22151 !!end
22152
22153 !!test
22154 Ref: 9. unclosed comments should not leak out of ref-body
22155 !! wikitext
22156 A <ref> foo <!--</ref> B C
22157 <references />
22158 !! html/parsoid
22159 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B C</p>
22160 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22161 <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>
22162 </ol>
22163 !!end
22164
22165 !!test
22166 Ref: 10. Unclosed HTML tags should not leak out of ref-body
22167 !! wikitext
22168 A <ref> <b> foo </ref> B C
22169
22170 <references />
22171 !! html/parsoid
22172 <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>
22173
22174
22175 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22176 <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>
22177 </ol>
22178 !!end
22179
22180 !!test
22181 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
22182 !! wikitext
22183 A <ref>foo</ref> B
22184 C <ref>bar</ref> D
22185 <references />
22186 !! html/parsoid
22187 <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
22188 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>
22189 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22190 <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>
22191 <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>
22192 </ol>
22193 !!end
22194
22195 !!test
22196 Ref: 12. ref-tags act as trailing newline migration barrier
22197 !! wikitext
22198 <!--the newline at the end of this line moves out of the p tag-->a
22199
22200 b<!--the newline at the end of this line stays inside the p tag--> <ref />
22201 <ref />
22202
22203 c
22204 <references />
22205 !! html/parsoid
22206 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
22207
22208
22209 <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>
22210 <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>
22211
22212 <p>c</p>
22213 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22214 <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>
22215 <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>
22216 !!end
22217
22218 !!test
22219 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
22220 !! wikitext
22221 <ref>foo</ref> A
22222 <ref>bar
22223 </ref> B
22224 <references />
22225 !! html/parsoid
22226 <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
22227 <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>
22228 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22229 <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>
22230 <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
22231 </span></li>
22232 </ol>
22233 !!end
22234
22235 !!test
22236 Ref: 14. A nested ref-tag should be emitted as plain text
22237 !! wikitext
22238 <ref>foo <ref>bar</ref> baz</ref>
22239
22240 <references />
22241 !! html/parsoid
22242 <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>
22243 </p>
22244 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22245 <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>
22246 </ol>
22247 !!end
22248
22249 !!test
22250 Ref: 15. ref-tags with identical names should get identical indexes
22251 !! wikitext
22252 A1 <ref name="a">foo</ref> A2 <ref name="a" />
22253 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
22254
22255 <references />
22256 !! html/parsoid
22257 <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>
22258 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>
22259
22260 <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>
22261 </ol>
22262 !!end
22263
22264 ## We don't bother wt2wt-ing non-standard whitespace
22265 !!test
22266 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
22267 !!options
22268 parsoid=wt2html
22269 !! wikitext
22270 A <ref >foo</ref >
22271
22272 <references />
22273 !! html/parsoid
22274 <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>
22275 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22276 <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>
22277 !!end
22278
22279 !!test
22280 Ref: 17. Generate valid HTML5 id/about attributes
22281 !!wikitext
22282 <ref name="a b">foo</ref>
22283
22284 <references />
22285 !!html/parsoid
22286 <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>
22287 </p>
22288
22289 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22290 <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>
22291 </ol>
22292 !!end
22293
22294 !!test
22295 Ref: 18. T58916: Extension attributes should be parsed as plain text
22296 !!wikitext
22297 <ref name="{{echo|a}}">foo</ref>
22298
22299 <references />
22300 !!html/parsoid
22301 <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>
22302 </p>
22303
22304 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22305 <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>
22306 </ol>
22307 !!end
22308
22309 !!test
22310 Ref: 19. ref-tags with identical name encodings should get identical indexes
22311 !! wikitext
22312 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
22313
22314 <references />
22315 !! html/parsoid
22316 <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>
22317 </p>
22318 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22319 <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>
22320 </ol>
22321 !!end
22322
22323 !!test
22324 Ref: 20. ref-tags with identical names but different content should keep it
22325 !! wikitext
22326 A <ref name="foo">Foo one</ref>
22327 B <ref name="foo">Foo two</ref>
22328 C <ref name="foo" />
22329
22330 <references />
22331 !! html/parsoid
22332 <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>
22333 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>
22334 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>
22335
22336 <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>
22337 </ol>
22338 !!end
22339
22340 !!test
22341 References: 1. references tag without any refs should be handled properly
22342 !! wikitext
22343 <references />
22344 !! html/parsoid
22345 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22346 !!end
22347
22348 !!test
22349 References: 2. references tag with group only outputs references from that group
22350 !! wikitext
22351 A <ref group="a">foo</ref>
22352 B <ref group="b">bar</ref>
22353 C <ref>baz</ref>
22354
22355 <references group="a" />
22356 <references />
22357 <references group="b" />
22358 !! html/parsoid
22359 <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>
22360 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>
22361 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>
22362
22363 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
22364 <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>
22365 </ol>
22366 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
22367 <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>
22368 </ol>
22369 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
22370 <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>
22371 </ol>
22372 !!end
22373
22374 !!test
22375 References: 3. ref list should be cleared after processing references
22376 !! wikitext
22377 A <ref>foo</ref>
22378
22379 <references />
22380
22381 B <ref>bar</ref>
22382
22383 <references />
22384 !! html/parsoid
22385 <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>
22386
22387 <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>
22388 </ol>
22389
22390 <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>
22391
22392 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22393 <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>
22394 </ol>
22395 !!end
22396
22397 !!test
22398 References: 4. only referenced group should be cleared after processing references
22399 !! wikitext
22400 A <ref group="a">afoo</ref>
22401 B <ref>bfoo</ref>
22402
22403 <references group="a" />
22404
22405 C <ref>cfoo</ref>
22406
22407 <references />
22408 !! html/parsoid
22409 <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>
22410 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>
22411
22412 <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>
22413 </ol>
22414
22415 <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>
22416
22417 <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>
22418 </ol>
22419 !!end
22420
22421 ## Don't expect this to rt since we're dropping content
22422 !! test
22423 References: 5. ref tags in references should be processed while ignoring all other content
22424 !! options
22425 parsoid=wt2html,html2html
22426 !! wikitext
22427 A <ref name="a" />
22428 B <ref name="b">bar</ref>
22429
22430 <references>
22431 <ref name="a">foo</ref>
22432 This should just get lost.
22433 </references>
22434 !! html/parsoid
22435 <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>
22436 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>
22437
22438
22439 <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>
22440 </ol>
22441 !! end
22442
22443 !! test
22444 References: 6. <references /> from a transclusion
22445 !! wikitext
22446 <ref>Foo</ref> {{echo|<references />}}
22447 !! html/parsoid
22448 <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>
22449 </ol>
22450 !! end
22451
22452 !! test
22453 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
22454 !! wikitext
22455 A <ref>foo bar for a</ref>
22456 B <ref group="X" name="b" />
22457
22458 <references />
22459
22460 <references group="X">
22461 <ref name="b">foo</ref>
22462 </references>
22463 !! html/parsoid
22464 <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>
22465 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>
22466 </p>
22467
22468 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22469 <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>
22470 </ol>
22471
22472 <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"}}'>
22473 <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>
22474 </ol>
22475 !! end
22476
22477 !! test
22478 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
22479 !! wikitext
22480 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
22481 <references />
22482 !! html/parsoid
22483 <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>
22484 <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>
22485 </ol>
22486 !!end
22487
22488 # This test only works in wt2html now as the <references /> are always generated
22489 # unless selser is active. Once T72722 is fixed, we should add a changes test
22490 # here to ensure that unrelated changes don't add the new <references />
22491 # when selser is active.
22492 !! test
22493 References: 9. Generate missing references list at the end
22494 !! wikitext
22495 A <ref>foo</ref>
22496 B <ref group="inexistent">bar</ref>
22497 !! html/parsoid
22498 <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>
22499 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'>
22500 <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>
22501 </ol>
22502 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"},"autoGenerated":true}'>
22503 <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>
22504 </ol>
22505 !! end
22506
22507 !! test
22508 References: 10. New <references/> shouldn't be added for unrelated edits.
22509 !! options
22510 parsoid={
22511 "modes": ["selser"],
22512 "changes": [["#x", "remove"]],
22513 "selser": "noauto"
22514 }
22515 !! wikitext
22516 Unrelated text<span id="x"> that's going to disappear</span>.
22517 A <ref>foo</ref>
22518 !! wikitext/edited
22519 Unrelated text.
22520 A <ref>foo</ref>
22521 !!end
22522
22523 !! test
22524 Entities in ref name
22525 !! wikitext
22526 <ref name="test &amp; me">hi</ref>
22527 <references />
22528 !! html/parsoid
22529 <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>
22530 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22531 <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>
22532 </ol>
22533 !! end
22534
22535 ## The output here may look funny, but it's what the php parser will do. The
22536 ## unclosed references tag becomes escaped text, and then a new references
22537 ## tag is auto-generated. The test is wt2html only because it roundtrips with
22538 ## nowiki tags, and the auto-generated references tag is only dropped in
22539 ## rtTestMode.
22540 !! test
22541 Generate references for unclosed references tag
22542 !! options
22543 parsoid=wt2html
22544 !! wikitext
22545 a<ref>foo</ref>
22546
22547 <references>
22548 !! html/parsoid
22549 <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>
22550
22551 <p>&lt;references></p>
22552 <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>
22553 !! end
22554
22555 !! test
22556 New reference serializes on its own line
22557 !! options
22558 parsoid=wt2wt,html2wt
22559 !! wikitext
22560 foo
22561 <references />
22562 !! html/parsoid
22563 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22564 !! end
22565
22566 #### ----------------------------------------------------------------
22567 #### Parsoid-only testing of Parsoid's impl of LST
22568 #### Not implemented yet, see
22569 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
22570 #### ----------------------------------------------------------------
22571
22572 !! test
22573 LST Sections: 1. Simple section start and end
22574 !! options
22575 parsoid={ "suppressErrors": true }
22576 !! wikitext
22577 <section begin="2011-05-16" />
22578 <section end="2014-04-10 (MW 1.23wmf22)" />
22579 !! html/parsoid
22580 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
22581 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
22582 !! end
22583
22584 #--------- Test stripping of empty nodes in template content ----------
22585 !!test
22586 Empty LI and TR nodes should be stripped from template content
22587 !!wikitext
22588 {{EmptyLITest}}
22589 {{EmptyTRTest}}
22590 !!html/parsoid
22591 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
22592 <li>a</li>
22593 <li>b</li>
22594 </ul>
22595 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
22596 <tbody>
22597 <tr>
22598 <td>foo</td>
22599 </tr>
22600 <tr>
22601 <td>bar</td>
22602 </tr>
22603 </tbody>
22604 </table>
22605 !!end
22606
22607 !!test
22608 Empty LI and TR nodes should not be stripped from top-level content
22609 !!wikitext
22610 * a
22611 *
22612 * b
22613 {|
22614 |-
22615 |-
22616 |foo
22617 |}
22618 !!html/parsoid
22619 <ul>
22620 <li> a</li>
22621 <li></li>
22622 <li> b</li>
22623 </ul>
22624 <table>
22625 <tbody>
22626 <tr></tr>
22627 <tr>
22628 <td>foo</td>
22629 </tr>
22630 </tbody>
22631 </table>
22632 !!end
22633
22634 !!test
22635 Empty TR nodes should not be stripped if they have any attributes set
22636 !!wikitext
22637 {{EmptyTRWithHTMLAttrTest}}
22638 !!html/parsoid
22639 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
22640 <tr align="center"></tr>
22641 <tr><td>foo</td></tr>
22642 <tr align="center"></tr>
22643 <tr><td>bar</td></tr>
22644 </table>
22645 !!end
22646
22647 #### ----------------------------------------------------------------
22648 #### The following section of tests are primarily to test
22649 #### wikitext escaping capabilities of Parsoid. Given that
22650 #### escaping can be done any number of ways, the wikitext (input)
22651 #### is always adjusted to reflect how Parsoid adds nowiki
22652 #### escape tags.
22653 ####
22654 #### We are marking several tests as parsoid-only since the
22655 #### HTML in the result section is different from what the
22656 #### PHP parser generates for it.
22657 #### ----------------------------------------------------------------
22658
22659
22660 #### --------------- Headings ---------------
22661 #### 0. Unnested
22662 #### 1. Nested inside html <h1>=foo=</h1>
22663 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
22664 #### 3. Nested inside html with wikitext split by html tags
22665 #### 4. No escape needed
22666 #### 5. Empty headings <h1></h1>
22667 #### 6. Heading chars in SOL context
22668 #### ----------------------------------------
22669 !! test
22670 Headings: 0. Unnested
22671 !! options
22672 parsoid=html2wt
22673 !! html/parsoid
22674 <p>=foo=</p>
22675
22676 <p> =foo=
22677 <!--cmt-->
22678 =foo=</p>
22679
22680 <p>=foo<i>a</i>=</p>
22681 !! wikitext
22682 <nowiki>=foo=</nowiki>
22683
22684 <nowiki> </nowiki>=foo=
22685 <!--cmt-->
22686 <nowiki>=foo=</nowiki>
22687
22688 =foo''a''<nowiki>=</nowiki>
22689 !!end
22690
22691 # New headings and existing headings are handled differently
22692 !! test
22693 Headings: 1. Nested inside html
22694 !! options
22695 parsoid=html2wt
22696 !! html/parsoid
22697 <h1>=foo=</h1>
22698 <h2>=foo=</h2>
22699 <h3>=foo=</h3>
22700
22701 <h1 data-parsoid=''>=foo=</h1>
22702 <h2 data-parsoid=''>=foo=</h2>
22703 <h3 data-parsoid=''>=foo=</h3>
22704 <h4 data-parsoid=''>=foo=</h4>
22705 <h5 data-parsoid=''>=foo=</h5>
22706 <h6 data-parsoid=''>=foo=</h6>
22707 !! wikitext
22708 = =foo= =
22709
22710 == =foo= ==
22711
22712 === =foo= ===
22713
22714 =<nowiki>=foo=</nowiki>=
22715 ==<nowiki>=foo=</nowiki>==
22716 ===<nowiki>=foo=</nowiki>===
22717 ====<nowiki>=foo=</nowiki>====
22718 =====<nowiki>=foo=</nowiki>=====
22719 ======<nowiki>=foo=</nowiki>======
22720
22721 !!end
22722
22723 !! test
22724 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
22725 !! options
22726 parsoid=html2wt
22727 !! html/parsoid
22728 <h1>foo</h1>*bar
22729 <h1>foo</h1>=bar
22730 <h1>foo</h1>=bar=
22731 !! wikitext
22732 = foo =
22733 <nowiki>*</nowiki>bar
22734
22735 = foo =
22736 =bar
22737
22738 = foo =
22739 <nowiki>=bar=</nowiki>
22740 !!end
22741
22742 !! test
22743 Headings: 3. Nested inside html with wikitext split by html tags
22744 !! options
22745 parsoid=html2wt
22746 !! html/parsoid
22747 <h1>=<b>bold</b>foo=</h1>
22748 !! wikitext
22749 = ='''bold'''foo= =
22750 !!end
22751
22752 !! test
22753 Headings: 4a. No escaping needed (testing just h1 and h2)
22754 !! options
22755 parsoid=html2wt
22756 !! html/parsoid
22757 <h1>=foo</h1>
22758 <h1>foo=</h1>
22759 <h1> =foo= </h1>
22760 <h1>=foo= bar</h1>
22761 <h2>=foo</h2>
22762 <h2>foo=</h2>
22763 <h1>=</h1>
22764 <h1><i>=</i>foo=</h1>
22765 !! wikitext
22766 = =foo =
22767
22768 = foo= =
22769
22770 = =foo= =
22771
22772 = =foo= bar =
22773
22774 == =foo ==
22775
22776 == foo= ==
22777
22778 = = =
22779
22780 = ''=''foo= =
22781 !!end
22782
22783 !! test
22784 Headings: 4b. No escaping needed (inside p-tags)
22785 !! options
22786 parsoid=html2wt
22787 !! html/parsoid
22788 <p>===
22789 =foo= x
22790 =foo= <s></s>
22791 </p>
22792 !! wikitext
22793 ===
22794 =foo= x
22795 =foo= <s></s>
22796 !!end
22797
22798 !! test
22799 Headings: 5. Empty headings
22800 !! options
22801 parsoid=html2wt
22802 !! html/parsoid
22803 <h1 data-parsoid='{}'></h1>
22804
22805 <h2 data-parsoid='{}'></h2>
22806
22807 <h3 data-parsoid='{}'></h3>
22808
22809 <h4 data-parsoid='{}'></h4>
22810
22811 <h5 data-parsoid='{}'></h5>
22812
22813 <h6 data-parsoid='{}'></h6>
22814 !! wikitext
22815 =<nowiki/>=
22816
22817 ==<nowiki/>==
22818
22819 ===<nowiki/>===
22820
22821 ====<nowiki/>====
22822
22823 =====<nowiki/>=====
22824
22825 ======<nowiki/>======
22826 !!end
22827
22828 !! test
22829 Headings: 6a. Heading chars in SOL context (with trailing spaces)
22830 !! options
22831 parsoid=html2wt
22832 !! html/parsoid
22833 <p>=a=</p>
22834
22835 <p>=a=</p>
22836
22837 <p>=a=</p>
22838 !! wikitext
22839 <nowiki>=a=</nowiki>
22840
22841 <nowiki>=a=</nowiki>
22842
22843 <nowiki>=a=</nowiki>
22844 !!end
22845
22846 !! test
22847 Headings: 6b. Heading chars in SOL context (with trailing newlines)
22848 !! options
22849 parsoid=html2wt
22850 !! html/parsoid
22851 <p>=a=
22852 b</p>
22853
22854 <p>=a=
22855 b</p>
22856
22857 <p>=a=
22858 b</p>
22859 !! wikitext
22860 <nowiki>=a=</nowiki>
22861 b
22862
22863 <nowiki>=a=</nowiki>
22864 b
22865
22866 <nowiki>=a=</nowiki>
22867 b
22868 !!end
22869
22870 !! test
22871 Headings: 6c. Heading chars in SOL context (leading newline break)
22872 !! options
22873 parsoid=html2wt
22874 !! html/parsoid
22875 <p>a
22876 =b=</p>
22877 !! wikitext
22878 a
22879 <nowiki>=b=</nowiki>
22880 !!end
22881
22882 !! test
22883 Headings: 6d. Heading chars in SOL context (with interspersed comments)
22884 !! options
22885 parsoid=html2wt
22886 !! html/parsoid
22887 <!--c0--><p>=a=</p>
22888
22889 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
22890 !! wikitext
22891 <!--c0--><nowiki>=a=</nowiki>
22892
22893 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
22894 !!end
22895
22896 !! test
22897 Headings: 6d. Heading chars in SOL context (No escaping needed)
22898 !! options
22899 parsoid=html2wt
22900 !! html/parsoid
22901 =a=<div>b</div>
22902 !! wikitext
22903 =a=<div>b</div>
22904 !!end
22905
22906 !! test
22907 Headings: 7. Insert a newline between new content and headings
22908 !! options
22909 parsoid=html2wt
22910 !! html/parsoid
22911 <h2>NEW</h2>
22912 <p>new</p>
22913 <h2 data-parsoid='{}'>A</h2>
22914 <p data-parsoid='{}'>a</p>
22915 !! wikitext
22916 == NEW ==
22917 new
22918
22919 ==A==
22920 a
22921
22922 !! end
22923
22924 #### --------------- Lists ---------------
22925 #### 0. Outside nests (*foo, etc.)
22926 #### 1. Nested inside html <ul><li>*foo</li></ul>
22927 #### 2. Inside definition lists
22928 #### 3. Only bullets at start should be escaped
22929 #### 4. No escapes needed
22930 #### 5. No unnecessary escapes
22931 #### 6. Escape bullets in SOL position
22932 #### 7. Escape bullets in a multi-line context
22933 #### ----------------------------------------
22934
22935 !! test
22936 Lists: 0. Outside nests
22937 !! options
22938 parsoid=html2wt
22939 !! html/parsoid
22940 <p>*foo</p>
22941
22942 <p>#foo</p>
22943
22944 <p>;Foo:bar</p>
22945 !! wikitext
22946 <nowiki>*</nowiki>foo
22947
22948 <nowiki>#</nowiki>foo
22949
22950 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
22951 !!end
22952
22953 ## Making these next 3 tests Parsoid-only since they are html2wt tests
22954 ## to test wikitext escaping, and insignificant whitespace diffs
22955 ## cause PHP parser tests to barf
22956 !! test
22957 Lists: 1. Nested inside html (No unnecessary escapes)
22958 !! options
22959 parsoid=html2wt
22960 !! html/parsoid
22961 <ul>
22962 <li>*foo</li>
22963 <li>#foo</li>
22964 <li>:foo</li>
22965 <li>;foo</li>
22966 <li data-parsoid='{}'>*foo</li>
22967 <li data-parsoid='{}'>#foo</li>
22968 <li data-parsoid='{}'>:foo</li>
22969 <li data-parsoid='{}'>;foo</li>
22970 </ul>
22971
22972 <ol>
22973 <li>*foo</li>
22974 <li>#foo</li>
22975 <li>:foo</li>
22976 <li>;foo</li>
22977 <li data-parsoid='{}'>*foo</li>
22978 <li data-parsoid='{}'>#foo</li>
22979 <li data-parsoid='{}'>:foo</li>
22980 <li data-parsoid='{}'>;foo</li>
22981 </ol>
22982 !! wikitext
22983 * *foo
22984 * #foo
22985 * :foo
22986 * ;foo
22987 *<nowiki>*foo</nowiki>
22988 *<nowiki>#foo</nowiki>
22989 *<nowiki>:foo</nowiki>
22990 *<nowiki>;foo</nowiki>
22991
22992 # *foo
22993 # #foo
22994 # :foo
22995 # ;foo
22996 #<nowiki>*foo</nowiki>
22997 #<nowiki>#foo</nowiki>
22998 #<nowiki>:foo</nowiki>
22999 #<nowiki>;foo</nowiki>
23000 !!end
23001
23002 !! test
23003 Lists: 2. Inside definition lists
23004 !! options
23005 parsoid=html2wt
23006 !! html/parsoid
23007 <dl><dt>;foo</dt></dl>
23008 <dl><dt>:foo</dt></dl>
23009 <dl><dt>:foo</dt>
23010 <dd>bar</dd></dl>
23011 <dl><dd>:foo</dd></dl>
23012 !! wikitext
23013 ; ;foo
23014
23015 ; <nowiki>:foo</nowiki>
23016
23017 ; <nowiki>:foo</nowiki>
23018 : bar
23019
23020 : :foo
23021 !!end
23022
23023 !! test
23024 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
23025 !! options
23026 parsoid=html2wt
23027 !! html/parsoid
23028 <ul>
23029 <li>*foo*bar</li>
23030 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
23031 </ul>
23032 !! wikitext
23033 * *foo*bar
23034 *<nowiki>*foo</nowiki>''it''*bar
23035 !!end
23036
23037 !! test
23038 Lists: 4. No escapes needed
23039 !! options
23040 parsoid=html2wt
23041 !! html/parsoid
23042 <ul>
23043 <li>foo*bar
23044 </li>
23045 </ul>
23046 <ul>
23047 <li><i>foo</i>*bar
23048 </li>
23049 </ul>
23050 <ul>
23051 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
23052 </li>
23053 </ul>
23054 <ul>
23055 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
23056 </li>
23057 </ul>
23058 !! wikitext
23059 *foo*bar
23060
23061 *''foo''*bar
23062
23063 *[[Foo]]: bar
23064
23065 *[[Foo]]*bar
23066 !!end
23067
23068 !! test
23069 Lists: 5. No unnecessary escapes
23070 !! options
23071 parsoid=html2wt
23072 !! html/parsoid
23073 <ul><li> bar <span>[[foo]]</span></li></ul>
23074 <ul><li> =bar <span>[[foo]]</span></li></ul>
23075 <ul><li> [[bar <span>[[foo]]</span></li></ul>
23076 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
23077 <ul><li> =bar <span>foo]]</span>=</li></ul>
23078 <ul><li> <s></s>: a</li></ul>
23079 <ul><li> <i>* foo</i></li></ul>
23080
23081 !! wikitext
23082 * bar <span><nowiki>[[foo]]</nowiki></span>
23083
23084 * =bar <span><nowiki>[[foo]]</nowiki></span>
23085
23086 * [[bar <span><nowiki>[[foo]]</nowiki></span>
23087
23088 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
23089
23090 * =bar <span>foo]]</span>=
23091
23092 * <s></s>: a
23093
23094 * ''* foo''
23095 !!end
23096
23097 !! test
23098 Lists: 6. Escape bullets in SOL position
23099 !! options
23100 parsoid=html2wt
23101 !! html/parsoid
23102 <p><!--cmt-->*foo</p>
23103 !! wikitext
23104 <!--cmt--><nowiki>*</nowiki>foo
23105 !!end
23106
23107 !! test
23108 Lists: 7. Escape bullets in a multi-line context
23109 !! options
23110 parsoid=html2wt
23111 !! html/parsoid
23112 <p>a
23113 *b
23114 </p>
23115 !! wikitext
23116 a
23117 <nowiki>*</nowiki>b
23118 !!end
23119
23120 !! test
23121 Lists: 8. Escape colons only if not present in tags
23122 !! options
23123 parsoid=html2wt
23124 !! html/parsoid
23125 <dl><dt>a:b<i>c:d</i></dt></dl>
23126 !! wikitext
23127 ; <nowiki>a:b</nowiki>''c:d''
23128 !! end
23129
23130 #### --------------- HRs ---------------
23131 #### 1. Single line
23132 #### -----------------------------------
23133
23134 !! test
23135 HRs: 1. Single line
23136 !! options
23137 parsoid=html2wt
23138 !! html/parsoid
23139 <hr />----
23140 <hr />=foo=
23141 <hr />*foo
23142 !! wikitext
23143 ----<nowiki>----</nowiki>
23144 ----=foo=
23145 ----*foo
23146 !! end
23147
23148 #### --------------- Tables ---------------
23149 #### 1a. Simple example
23150 #### 1b. No escaping needed (!foo)
23151 #### 1c. No escaping needed (|foo)
23152 #### 1d. No escaping needed (|}foo)
23153 ####
23154 #### 2a. Nested in td (<td>foo|bar</td>)
23155 #### 2b. Nested in td (<td>foo||bar</td>)
23156 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
23157 ####
23158 #### 3a. Nested in th (<th>foo!bar</th>)
23159 #### 3b. Nested in th (<th>foo!!bar</th>)
23160 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
23161 ####
23162 #### 4a. Escape -
23163 #### 4b. Escape +
23164 #### 4c. No escaping needed
23165 #### --------------------------------------
23166
23167 !! test
23168 Tables: 1a. Simple example
23169 !! options
23170 parsoid=html2wt
23171 !! html/parsoid
23172 <p>{|
23173 |}
23174 </p>
23175 !! wikitext
23176 <nowiki>{|</nowiki>
23177 |}
23178 !! end
23179
23180 !! test
23181 Tables: 1b. No escaping needed
23182 !! options
23183 parsoid=html2wt
23184 !! html/parsoid
23185 <p>!foo
23186 </p>
23187 !! wikitext
23188 !foo
23189 !! end
23190
23191 !! test
23192 Tables: 1c. No escaping needed
23193 !! options
23194 parsoid=html2wt
23195 !! html/parsoid
23196 <p>|foo
23197 </p>
23198 !! wikitext
23199 |foo
23200 !! end
23201
23202 !! test
23203 Tables: 1d. No escaping needed
23204 !! options
23205 parsoid=html2wt
23206 !! html/parsoid
23207 <p>|}foo
23208 </p>
23209 !! wikitext
23210 |}foo
23211 !! end
23212
23213 !! test
23214 Tables: 2a. Nested in td
23215 !! options
23216 parsoid=html2wt
23217 !! html/parsoid
23218 <table><tbody><tr>
23219 <td>foo|bar</td></tr>
23220 <tr><td>x<div>a|b</div></td>
23221 </tbody></table>
23222 !! wikitext
23223 {|
23224 |<nowiki>foo|bar</nowiki>
23225 |-
23226 |x<div><nowiki>a|b</nowiki></div>
23227 |}
23228 !! html/php+tidy
23229 <table>
23230 <tr>
23231 <td>foo|bar</td>
23232 </tr>
23233 <tr>
23234 <td>x
23235 <div>a|b</div>
23236 </td>
23237 </tr>
23238 </table>
23239 !! end
23240
23241 !! test
23242 Tables: 2b. Nested in td
23243 !! options
23244 parsoid=html2wt
23245 !! html/parsoid
23246 <table><tbody><tr>
23247 <td>foo||bar</td>
23248 <td>a<i>b||c</i></td>
23249 <td>a<i><div>b||c</div></i></td>
23250 </tr></tbody></table>
23251 !! wikitext
23252 {|
23253 |<nowiki>foo||bar</nowiki>
23254 |a''<nowiki>b||c</nowiki>''
23255 |a''<div><nowiki>b||c</nowiki></div>''
23256 |}
23257 !! html/php
23258 <table>
23259 <tr>
23260 <td>foo||bar
23261 </td>
23262 <td>a<i>b||c</i>
23263 </td>
23264 <td>a<i><div>b||c</div></i>
23265 </td></tr></table>
23266
23267 !! end
23268
23269 !! test
23270 Tables: 2c. Nested in td -- no escaping needed
23271 !! options
23272 parsoid=html2wt
23273 !! html/*
23274 <table>
23275 <tr>
23276 <td>foo!!bar
23277 </td></tr></table>
23278
23279 !! wikitext
23280 {|
23281 |foo!!bar
23282 |}
23283 !! end
23284
23285 !! test
23286 Tables: 3a. Nested in th
23287 !! options
23288 parsoid=html2wt
23289 !! html/*
23290 <table>
23291 <tr>
23292 <th>foo!bar
23293 </th></tr></table>
23294
23295 !! wikitext
23296 {|
23297 !foo!bar
23298 |}
23299 !! end
23300
23301 !! test
23302 Tables: 3b. Nested in th
23303 !! options
23304 parsoid=html2wt
23305 !! html/parsoid
23306 <table><tbody>
23307 <tr><th>foo!!bar</th>
23308 <th><i>foo|bar</i></th>
23309 <th><i>foo!!bar</i></th>
23310 <th><i><span>foo!!bar</span></i></th>
23311 </tr></tbody></table>
23312 !! wikitext
23313 {|
23314 !<nowiki>foo!!bar</nowiki>
23315 !''<nowiki>foo|bar</nowiki>''
23316 !''<nowiki>foo!!bar</nowiki>''
23317 !''<span><nowiki>foo!!bar</nowiki></span>''
23318 |}
23319 !! html/php
23320 <table>
23321 <tr>
23322 <th>foo!!bar
23323 </th>
23324 <th><i>foo|bar</i>
23325 </th>
23326 <th><i>foo!!bar</i>
23327 </th>
23328 <th><i><span>foo!!bar</span></i>
23329 </th></tr></table>
23330
23331 !! end
23332
23333 !! test
23334 Tables: 3c. Nested in th
23335 !! options
23336 parsoid=html2wt
23337 !! html/parsoid
23338 <table><tbody>
23339 <tr><th>foo||bar</th>
23340 <th><span typeof="mw:Nowiki">foo||bar</span></th>
23341 </tr></tbody></table>
23342 !! wikitext
23343 {|
23344 !<nowiki>foo||bar</nowiki>
23345 !<nowiki>foo||bar</nowiki>
23346 |}
23347 !! html/php
23348 <table>
23349 <tr>
23350 <th>foo||bar
23351 </th>
23352 <th>foo||bar
23353 </th></tr></table>
23354
23355 !! end
23356
23357 !! test
23358 Tables: 4a. Escape -
23359 !! options
23360 parsoid=html2wt
23361 !! html/*
23362 <table>
23363 <tr>
23364 <th>-bar
23365 </th></tr>
23366 <tr>
23367 <td>-bar
23368 </td></tr></table>
23369
23370 !! wikitext
23371 {|
23372 !-bar
23373 |-
23374 |<nowiki>-bar</nowiki>
23375 |}
23376 !! end
23377
23378 !! test
23379 Tables: 4b. Escape +
23380 !! options
23381 parsoid=html2wt
23382 !! html/*
23383 <table>
23384 <tr>
23385 <th>+bar
23386 </th></tr>
23387 <tr>
23388 <td>+bar
23389 </td></tr></table>
23390
23391 !! wikitext
23392 {|
23393 !+bar
23394 |-
23395 |<nowiki>+bar</nowiki>
23396 |}
23397 !! end
23398
23399 !! test
23400 Tables: 4c. No escaping needed
23401 !! options
23402 parsoid=html2wt
23403 !! html/parsoid
23404 <table><tbody>
23405 <tr><td>foo-bar</td><td>foo+bar</td></tr>
23406 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
23407 <tr><td>foo
23408 <p>bar|baz
23409 +bar
23410 -bar</p></td></tr>
23411 <tr><td>x
23412 <div>a|b</div></td>
23413 </tbody></table>
23414 !! wikitext
23415 {|
23416 |foo-bar
23417 |foo+bar
23418 |-
23419 |''foo''-bar
23420 |''foo''+bar
23421 |-
23422 |foo
23423 bar|baz
23424 +bar
23425 -bar
23426 |-
23427 |x
23428 <div>a|b</div>
23429 |}
23430 !! html/php
23431 <table>
23432 <tr>
23433 <td>foo-bar
23434 </td>
23435 <td>foo+bar
23436 </td></tr>
23437 <tr>
23438 <td><i>foo</i>-bar
23439 </td>
23440 <td><i>foo</i>+bar
23441 </td></tr>
23442 <tr>
23443 <td>foo
23444 <p>bar|baz
23445 +bar
23446 -bar
23447 </p>
23448 </td></tr>
23449 <tr>
23450 <td>x
23451 <div>a|b</div>
23452 </td></tr></table>
23453
23454 !! end
23455
23456 !! test
23457 Tables: 4d. No escaping needed
23458 !! options
23459 parsoid=html2wt
23460 !! html/parsoid
23461 <table>
23462 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
23463 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
23464 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
23465 </tbody></table>
23466 !! wikitext
23467 {|
23468 |[[Foo]]-bar
23469 ||+1
23470 ||-2
23471 |}
23472 !! html/php
23473 <table>
23474 <tr>
23475 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
23476 </td>
23477 <td>+1
23478 </td>
23479 <td>-2
23480 </td></tr></table>
23481
23482 !! end
23483
23484 !! test
23485 T97430: Don't emit empty nowiki pairs around marker meta tags
23486 !! options
23487 parsoid=html2wt
23488 !! html/parsoid
23489 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23490 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
23491 !! wikitext
23492 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23493 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
23494 !! end
23495
23496 !! test
23497 Unclosed xmlish element in table line shouldn't eat end delimiters
23498 !! options
23499 parsoid=html2wt
23500 !! html/parsoid
23501 <table>
23502 <tbody><tr><td> &lt;foo</td>
23503 <td> bar></td></tr>
23504 </tbody></table>
23505 !! wikitext
23506 {|
23507 | <foo
23508 | bar>
23509 |}
23510 !! html/php
23511 <table>
23512 <tr>
23513 <td> &lt;foo
23514 </td>
23515 <td> bar&gt;
23516 </td></tr></table>
23517
23518 !! end
23519
23520 #### --------------- Links ----------------
23521 #### 1. Quote marks in link text
23522 #### 2. Wikilinks: Escapes needed
23523 #### 3. Wikilinks: No escapes needed
23524 #### 4. Extlinks: Escapes needed
23525 #### 5. Extlinks: No escapes needed
23526 #### --------------------------------------
23527 !! test
23528 Links 1. WikiLinks: No escapes needed
23529 !! options
23530 parsoid=html2wt
23531 !! html/parsoid
23532 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
23533 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
23534 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
23535 !! wikitext
23536 [[Foo|Foo''boo'']]
23537 [[Foo|[Foobar]]]
23538 [[Foo|x [Foobar] x]]
23539 !! html/php
23540 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
23541 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
23542 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
23543 </p>
23544 !! end
23545
23546 !! test
23547 Links 2. WikiLinks: Escapes needed
23548 !! options
23549 parsoid=html2wt
23550 !! html/parsoid
23551 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
23552 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
23553 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
23554 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
23555 <a href="Foo" rel="mw:WikiLink">|Bar</a>
23556 <a href="Foo" rel="mw:WikiLink">]]bar</a>
23557 <a href="Foo" rel="mw:WikiLink">[[bar</a>
23558 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
23559 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
23560 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
23561 !! wikitext
23562 [[Foo|<nowiki>Foobar]</nowiki>]]
23563 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
23564 [[Foo|<nowiki>[[Bar]]</nowiki>]]
23565 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
23566 [[Foo|<nowiki>|Bar</nowiki>]]
23567 [[Foo|<nowiki>]]bar</nowiki>]]
23568 [[Foo|<nowiki>[[bar</nowiki>]]
23569 [[Foo|<nowiki>x [[ y</nowiki>]]
23570 [[Foo|<nowiki>x ]] y</nowiki>]]
23571 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
23572 !! html/php
23573 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
23574 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
23575 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
23576 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
23577 <a href="/wiki/Foo" title="Foo">|Bar</a>
23578 <a href="/wiki/Foo" title="Foo">]]bar</a>
23579 <a href="/wiki/Foo" title="Foo">[[bar</a>
23580 <a href="/wiki/Foo" title="Foo">x [[ y</a>
23581 <a href="/wiki/Foo" title="Foo">x ]] y</a>
23582 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
23583 </p>
23584 !! end
23585
23586 !! test
23587 Links 3. WikiLinks: No escapes needed
23588 !! options
23589 parsoid=html2wt
23590 !! html/parsoid
23591 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
23592 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
23593 !! wikitext
23594 [[Foo|[Foobar]]
23595 [[Foo|foo|bar]]
23596 !! html/php
23597 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
23598 <a href="/wiki/Foo" title="Foo">foo|bar</a>
23599 </p>
23600 !! end
23601
23602 !! test
23603 Links 4. ExtLinks: Escapes needed
23604 !! options
23605 parsoid=html2wt
23606 !! html/parsoid
23607 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
23608 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
23609 <p>[http://google.com]</p>
23610 <p>[http://google.com google]</p>
23611 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
23612 <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>
23613 !! wikitext
23614 [http://google.com <nowiki>[google]</nowiki>]
23615 [http://google.com <nowiki>google]</nowiki>]
23616
23617 <nowiki>[http://google.com]</nowiki>
23618
23619 <nowiki>[http://google.com google]</nowiki>
23620
23621 [http://google.com<nowiki>]</nowiki>
23622
23623 [{{echo|http://google.com}}<nowiki>]</nowiki>
23624 !! html/php
23625 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
23626 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
23627 </p><p>[http://google.com]
23628 </p><p>[http://google.com google]
23629 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23630 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23631 </p>
23632 !! end
23633
23634 !! test
23635 Links 5. ExtLinks: No escapes needed
23636 !! options
23637 parsoid=html2wt
23638 !! html/parsoid
23639 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
23640 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
23641 !! wikitext
23642 [http://google.com [google]
23643
23644 [[http://google.com]]
23645 !! html/php
23646 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
23647 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
23648 </p>
23649 !! end
23650
23651 !! test
23652 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
23653 !! options
23654 parsoid=html2wt
23655 !! html/parsoid
23656 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
23657 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
23658 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
23659 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
23660 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
23661 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
23662 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23663 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
23664 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23665 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
23666 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
23667 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
23668 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
23669 </p>
23670 !! wikitext
23671 x<nowiki/>http://example.com<nowiki/>y
23672 http://example.com<nowiki/>?x
23673 http://example.com<nowiki/>&x
23674 http://example.com<nowiki/>'x
23675 http://example.com<nowiki/>,x
23676 http://example.com<nowiki/>.x
23677 http://example.com<nowiki/>;x
23678 http://example.com<nowiki/>:x
23679 http://example.com<nowiki/>;x
23680 http://example.com<nowiki/>!x
23681 http://example.com<nowiki/>=x
23682 http://example.com<nowiki/>(x)
23683 http://example.com(x<nowiki/>)
23684 !! end
23685
23686 !! test
23687 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23688 !! options
23689 parsoid=html2wt
23690 !! html/parsoid
23691 <p>x
23692 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
23693 y
23694 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
23695 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
23696 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
23697 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
23698 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
23699 </p>
23700 !! wikitext
23701 x
23702 http://example.com
23703 y
23704 "http://example.com"
23705 (http://example.com)
23706 (http://example.com) foo
23707 http://example.com,
23708 http://example.com, foo
23709 !! html/php
23710 <p>x
23711 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
23712 y
23713 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
23714 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
23715 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
23716 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
23717 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
23718 </p>
23719 !! end
23720
23721 !! test
23722 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23723 !! options
23724 parsoid=html2wt
23725 !! html/parsoid
23726 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
23727 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
23728 !! wikitext
23729 http://example.com.,;:!?\
23730 -http://example.com:
23731 !! html/php
23732 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
23733 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
23734 </p>
23735 !! end
23736
23737 !! test
23738 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
23739 !! options
23740 parsoid=html2wt
23741 !! html/parsoid
23742 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
23743 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
23744 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
23745 !! wikitext
23746 RFC 123<nowiki/>4
23747 RFC 123<nowiki/>y
23748 X<nowiki/>RFC 123<nowiki/>y
23749 !! end
23750
23751 !! test
23752 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
23753 !! options
23754 parsoid=html2wt
23755 !! html/parsoid
23756 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
23757 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
23758 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
23759 </p>
23760 !! wikitext
23761 RFC 123?foo
23762 RFC 123&foo
23763 -RFC 123-
23764 !! html/php
23765 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
23766 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
23767 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
23768 </p>
23769 !! end
23770
23771 !! test
23772 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
23773 !! options
23774 parsoid=html2wt
23775 !! html/parsoid
23776 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
23777 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23778 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23779 !! wikitext
23780 PMID 123<nowiki/>4
23781 PMID 123<nowiki/>y
23782 X<nowiki/>PMID 123<nowiki/>y
23783 !! end
23784
23785 !! test
23786 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
23787 !! options
23788 parsoid=html2wt
23789 !! html/parsoid
23790 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
23791 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
23792 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
23793 </p>
23794 !! wikitext
23795 PMID 123?foo
23796 PMID 123&foo
23797 -PMID 123-
23798 !! html/php
23799 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
23800 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
23801 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
23802 </p>
23803 !! end
23804
23805 !! test
23806 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
23807 !! options
23808 parsoid=html2wt
23809 !! html/parsoid
23810 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
23811 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
23812 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
23813 </p>
23814 !! wikitext
23815 ISBN 1234567890<nowiki/>1
23816 ISBN 1234567890<nowiki/>x
23817 a<nowiki/>ISBN 1234567890<nowiki/>b
23818 !! end
23819
23820 !! test
23821 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
23822 !! options
23823 parsoid=html2wt
23824 !! html/parsoid
23825 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
23826 !! wikitext
23827 -ISBN 1234567890's
23828 !! html/php
23829 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
23830 </p>
23831 !! end
23832
23833 !! test
23834 Links 14. Protect link-like plain text. (Parsoid bug T78425)
23835 !! options
23836 parsoid=html2wt
23837 !! html/*
23838 <p>this is not a link: http://example.com
23839 </p>
23840 !! wikitext
23841 this is not a link: <nowiki>http://example.com</nowiki>
23842 !! end
23843
23844 !! test
23845 Links 15. Link trails can't become link prefixes.
23846 !! options
23847 language=is
23848 parsoid=html2wt
23849 !! html/parsoid
23850 <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>
23851 !! wikitext
23852 [[Söfnuður]]-[[00]]
23853 !! html/php
23854 <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>
23855 </p>
23856 !! end
23857
23858 #### --------------- Quotes ---------------
23859 #### 1. Quotes inside <b> and <i>
23860 #### 2. Link fragments separated by <i> and <b> tags
23861 #### 3. Link fragments inside <i> and <b>
23862 #### 4. No escaping needed
23863 #### --------------------------------------
23864 !! test
23865 1a. Quotes inside <b> and <i>
23866 !! options
23867 parsoid=html2wt
23868 !! html/*
23869 <p><i>'foo'</i>
23870 <i>''foo''</i>
23871 <i>'''foo'''</i>
23872 <i>foo</i>'s
23873 <b>'foo'</b>
23874 <b>''foo''</b>
23875 <b>'''foo'''</b>
23876 <b>foo'<i>bar'</i>baz</b>
23877 <b>foo</b>'s
23878 '<i>foo</i>
23879 <i>foo</i>'
23880 <i>foo'</i>'
23881 '<i>foo</i>'
23882 '<b>foo</b>
23883 <b>foo</b>'
23884 '<b>foo</b>'
23885 <i>fools'<span> errand</span></i>
23886 <i><span>fool</span>'s errand</i>
23887 '<i>foo</i> bar '<i>baz</i>
23888 a|!*#-:;+-~[]{}b'<i>x</i>
23889 </p>
23890 !! wikitext
23891 ''<nowiki/>'foo'''
23892 ''<nowiki>''foo''</nowiki>''
23893 ''<nowiki>'''foo'''</nowiki>''
23894 ''foo''<nowiki/>'s
23895 '''<nowiki/>'foo''''
23896 '''<nowiki>''foo''</nowiki>'''
23897 '''<nowiki>'''foo'''</nowiki>'''
23898 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
23899 '''foo'''<nowiki/>'s
23900 '''foo''
23901 ''foo''<nowiki/>'
23902 ''foo'''<nowiki/>'
23903 '''foo''<nowiki/>'
23904 ''''foo'''
23905 '''foo'''<nowiki/>'
23906 ''''foo'''<nowiki/>'
23907 ''fools'<span> errand</span>''
23908 ''<span>fool</span>'s errand''
23909 '<nowiki/>''foo'' bar '''baz''
23910 a|!*#-:;+-~[]{}b'''x''
23911 !! end
23912
23913 !! test
23914 1b. Quotes inside <b> and <i> with other tags on same line
23915 !! options
23916 parsoid=html2wt
23917 !! html/parsoid
23918 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23919 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23920 <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>
23921 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
23922 '<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>
23923 '<i>foo</i> <div title="name">test</div>
23924 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
23925 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
23926 <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>
23927 </ol>
23928 !! wikitext
23929 '''a'' foo ''[[bar]]''
23930 ''a''' foo ''[[bar]]''
23931 ''a''' foo '''{{echo|[[bar]]}}'''
23932 [[foo]] x'''[[bar]]''
23933 '''foo'' <ref>test</ref>
23934 '''foo'' <div title="name">test</div>
23935 '''foo'' and <br> bar
23936 <references />
23937 !! end
23938
23939 !! test
23940 2. Link fragments separated by <i> and <b> tags
23941 !! options
23942 parsoid=html2wt
23943 !! html/parsoid
23944 <p>[[<i>foo</i>hello]]</p>
23945 <p>[[<b>foo</b>hello]]</p>
23946 !! wikitext
23947 [[''foo''<nowiki>hello]]</nowiki>
23948
23949 [['''foo'''<nowiki>hello]]</nowiki>
23950 !! end
23951
23952 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
23953 # this is one of the shortcomings of this format
23954 !! test
23955 3. Link fragments inside <i> and <b>
23956 !! options
23957 parsoid=html2wt
23958 !! html/parsoid
23959 <p><i>[[foo</i>]]</p>
23960 <p><b>[[foo</b>]]</p>
23961 !! wikitext
23962 ''[[foo''<nowiki>]]</nowiki>
23963
23964 '''[[foo'''<nowiki>]]</nowiki>
23965 !! end
23966
23967 !! test
23968 4. No escaping needed
23969 !! options
23970 options=html2wt
23971 !! html/parsoid
23972 <p>'<span><i>bar</i></span>'
23973 '<span><b>bar</b></span>'
23974 'a:b'foo
23975 </p>
23976 !! wikitext
23977 '<span>''bar''</span>'
23978 '<span>'''bar'''</span>'
23979 'a:b'foo
23980 !! end
23981
23982 #### ----------- Paragraphs ---------------
23983 #### 1. No unnecessary escapes
23984 #### --------------------------------------
23985
23986 !! test
23987 1. No unnecessary escapes
23988 !! options
23989 parsoid=html2wt
23990 !! html/parsoid
23991 <p>bar <span>[[foo]]</span>
23992 </p><p>=bar <span>[[foo]]</span>
23993 </p><p>[[bar <span>[[foo]]</span>
23994 </p><p>]]bar <span>[[foo]]</span>
23995 </p><p>=bar <span>foo]]</span>=
23996 </p>
23997 !! wikitext
23998 bar <span><nowiki>[[foo]]</nowiki></span>
23999
24000 =bar <span><nowiki>[[foo]]</nowiki></span>
24001
24002 [[bar <span><nowiki>[[foo]]</nowiki></span>
24003
24004 ]]bar <span><nowiki>[[foo]]</nowiki></span>
24005
24006 =bar <span>foo]]</span><nowiki>=</nowiki>
24007 !!end
24008
24009 #### ----------------------- PRE --------------------------
24010 #### 1. Leading whitespace in SOL context should be escaped
24011 #### ------------------------------------------------------
24012 !! test
24013 1. Leading whitespace in SOL context should be escaped
24014 !! options
24015 parsoid=html2wt
24016 !! html/parsoid
24017 <p> a</p>
24018
24019 <p> a</p>
24020
24021 <p> a(tab)</p>
24022
24023 <p> a
24024 <!--cmt-->
24025 a</p>
24026
24027 <p>a
24028 b</p>
24029
24030 <p>a
24031 b</p>
24032
24033 <p>a
24034 b</p>
24035 !! wikitext
24036 <nowiki> </nowiki>a
24037
24038 <nowiki> </nowiki> a
24039
24040 a(tab)
24041
24042 <nowiki> </nowiki> a
24043 <!--cmt-->
24044 <nowiki> </nowiki>a
24045
24046 a
24047 <nowiki> </nowiki>b
24048
24049 a
24050 b
24051
24052 a
24053 b
24054 !! html/php
24055 <p> a
24056 </p><p> a
24057 </p><p> a(tab)
24058 </p><p> a
24059 a
24060 </p><p>a
24061 b
24062 </p><p>a
24063 b
24064 </p><p>a
24065 b
24066 </p>
24067 !! end
24068
24069 !! test
24070 2. Leading whitespace in non-indent-pre contexts should not be escaped
24071 !! options
24072 parsoid=html2wt
24073 !! html/parsoid
24074 <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>
24075 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
24076 <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>
24077 b</span></li>
24078 </ol>
24079 !! wikitext
24080 foo <ref>''a''
24081 b</ref>
24082 <references />
24083 !! end
24084
24085 !! test
24086 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
24087 !! options
24088 parsoid=html2wt
24089 !! html/parsoid
24090 <blockquote>
24091 <p>
24092 a
24093 <span>b</span>
24094 c</p>
24095 </blockquote>
24096 !! wikitext
24097 <blockquote>
24098 a
24099 <span>b</span>
24100 c
24101 </blockquote>
24102 !! end
24103
24104 !! test
24105 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
24106 !! options
24107 options=html2wt
24108 !! html/parsoid
24109 <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>
24110 !! wikitext
24111 [[File:Foobar.jpg|thumb|caption]]
24112 !! end
24113
24114 !! test
24115 5. Nowiki escaping should account for indent-pres
24116 !! options
24117 parsoid=html2wt
24118 !! html/parsoid
24119 <pre>==foo==</pre>
24120 !! wikitext
24121 ==foo==
24122 !! end
24123
24124 !!test
24125 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
24126 !! options
24127 parsoid=html2wt
24128 !! html/parsoid
24129 <pre>
24130 * foo
24131 * bar
24132 </pre>
24133 !! wikitext
24134 * foo
24135 * bar
24136 !! end
24137
24138 #### --------------- Behavior Switches --------------------
24139
24140 !! test
24141 1. Valid behavior switches should be escaped
24142 !! options
24143 parsoid=html2wt
24144 !! html/parsoid
24145 __TOC__
24146 <i>__TOC__</i>
24147 !! wikitext
24148 <nowiki>__TOC__</nowiki>
24149 ''<nowiki>__TOC__</nowiki>''
24150 !! end
24151
24152 !! test
24153 2. Invalid behavior switches should not be escaped
24154 !! options
24155 parsoid=html2wt
24156 !! html/parsoid
24157 __TOO__
24158 __|__
24159 !! wikitext
24160 __TOO__
24161 __|__
24162 !! end
24163
24164 # We use indent-pre as an indirect way to test for sol-transparent behavior.
24165 !! test
24166 Behavior switches should be SOL-transparent
24167 !! options
24168 parsoid=html2wt
24169 !! html/parsoid
24170 <meta property="mw:PageProp/toc" />
24171
24172 <!-- this one's bogus -->
24173 <pre>__TOO__</pre>
24174
24175 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
24176
24177 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
24178 !! wikitext
24179 __TOC__
24180
24181 <!-- this one's bogus -->
24182 __TOO__
24183
24184 __TOC__ foo
24185
24186 __TOC__
24187 bar
24188 !! end
24189
24190 #### --------------- HTML tags ---------------
24191 #### 1. a tags
24192 #### 2. other tags
24193 #### 3. multi-line html tag
24194 #### 4. extension tags
24195 #### -----------------------------------------
24196 !! test
24197 1. a tags
24198 !! options
24199 parsoid=html2wt
24200 !! html/parsoid
24201 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
24202 !! wikitext
24203 <a href="http://google.com">google</a>
24204 !! end
24205
24206 !! test
24207 2. other tags
24208 !! options
24209 parsoid=html2wt
24210 !! html/parsoid
24211 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
24212 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
24213 <li> &lt;td&gt;</li></ul>
24214
24215 !! wikitext
24216 * <nowiki><div>foo</div></nowiki>
24217 * <nowiki><div style="color:red">foo</div></nowiki>
24218 * <nowiki><td></nowiki>
24219 !! end
24220
24221 !! test
24222 3. multi-line html tag
24223 !! options
24224 parsoid=html2wt
24225 !! html/parsoid
24226 <p>&lt;div
24227 &gt;foo&lt;/div
24228 &gt;
24229 </p>
24230 !! wikitext
24231 <nowiki><div
24232 >foo</div
24233 ></nowiki>
24234 !! end
24235
24236 !! test
24237 4. extension tags
24238 !! options
24239 parsoid=html2wt
24240 !! html/parsoid
24241 <p>&lt;ref&gt;foo&lt;/ref&gt;
24242 </p><p>&lt;ref&gt;bar
24243 </p><p>baz&lt;/ref&gt;
24244 </p>
24245 !! wikitext
24246 <nowiki><ref>foo</ref></nowiki>
24247
24248 <nowiki><ref>bar</nowiki>
24249
24250 baz<nowiki></ref></nowiki>
24251 !! end
24252
24253 #### --------------- Others ---------------
24254 !! test
24255 Escaping nowikis
24256 !! options
24257 parsoid=html2wt
24258 !! html/parsoid
24259 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
24260 </p>
24261 !! wikitext
24262 &lt;nowiki&gt;foo&lt;/nowiki&gt;
24263 !! end
24264
24265 ## The quote-char in the input is necessary for triggering the bug
24266 !! test
24267 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
24268 !! options
24269 parsoid=html2wt
24270 !! html/parsoid
24271 <p>foo's bar :</p>
24272 !! wikitext
24273 foo's bar :
24274 !! end
24275
24276 #----------- End of wikitext escaping tests --------------
24277
24278 !! test
24279
24280 Tag-like HTML structures are passed through as text
24281 !! wikitext
24282 <x y>
24283
24284 <x.y>
24285
24286 <x-y>
24287
24288 1>2
24289
24290 x<y
24291
24292 a>b
24293
24294 1<d e>f
24295 !! html
24296 <p>&lt;x y&gt;
24297 </p><p>&lt;x.y&gt;
24298 </p><p>&lt;x-y&gt;
24299 </p><p>1&gt;2
24300 </p><p>x&lt;y
24301 </p><p>a&gt;b
24302 </p><p>1&lt;d e&gt;f
24303 </p>
24304 !! end
24305
24306 !! test
24307 HTML tag with necessary entities in attributes
24308 !! wikitext
24309 <span title="&amp;amp;">foo</span>
24310 !! html
24311 <p><span title="&amp;amp;">foo</span>
24312 </p>
24313 !! end
24314
24315 !! test
24316 HTML tag with 'unnecessary' entity encoding in attributes
24317 !! wikitext
24318 <span title="&amp;">foo</span>
24319 !! html
24320 <p><span title="&amp;">foo</span>
24321 </p>
24322 !! end
24323
24324 !! test
24325 HTML tag with broken attribute value quoting
24326 !! options
24327 parsoid=wt2html,html2html
24328 !! wikitext
24329 <span title="Hello world>Foo</span>
24330 !! html/php
24331 <p><span title="Hello world">Foo</span>
24332 </p>
24333 !! html/parsoid
24334 <p><span title="Hello world">Foo</span></p>
24335 !! end
24336
24337 !! test
24338 Self-closed tag with broken attribute value quoting
24339 !! options
24340 parsoid=wt2html,html2html
24341 !! wikitext
24342 <div title="Hello world />Foo
24343 !! html/php+tidy
24344 <div title="Hello world"></div>
24345 <p>Foo</p>
24346 !! html/parsoid
24347 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
24348 !! end
24349
24350 !! test
24351 Table with broken attribute value quoting
24352 !! options
24353 parsoid=wt2html,html2html
24354 !! wikitext
24355 {|
24356 | title="Hello world|Foo
24357 |}
24358 !! html/php
24359 <table>
24360 <tr>
24361 <td title="Hello world">Foo
24362 </td></tr></table>
24363
24364 !! html/parsoid
24365 <table>
24366 <tr>
24367 <td title="Hello world">Foo
24368 </td></tr></table>
24369
24370 !! end
24371
24372 !! test
24373 Table with broken attribute value quoting on consecutive lines
24374 !! options
24375 parsoid=wt2html,html2html
24376 !! wikitext
24377 {|
24378 | title="Hello world|Foo
24379 | style="color:red|Bar
24380 |}
24381 !! html/php
24382 <table>
24383 <tr>
24384 <td title="Hello world">Foo
24385 </td>
24386 <td style="color:red">Bar
24387 </td></tr></table>
24388
24389 !! html/parsoid
24390 <table><tbody>
24391 <tr>
24392 <td title="Hello world">Foo
24393 </td><td style="color: red">Bar
24394 </td></tr></tbody></table>
24395
24396 !! end
24397
24398 !!test
24399 Accept empty td cell attribute
24400 !! wikitext
24401 {|
24402 | align="center" | foo || |
24403 |}
24404 !! html
24405 <table>
24406 <tr>
24407 <td align="center"> foo </td>
24408 <td>
24409 </td></tr></table>
24410
24411 !!end
24412
24413 !!test
24414 Non-empty attributes in th-cells
24415 !! wikitext
24416 {|
24417 ! Foo !! style="color: red" | Bar
24418 |}
24419 !! html
24420 <table>
24421 <tr>
24422 <th> Foo </th>
24423 <th style="color: red"> Bar
24424 </th></tr></table>
24425
24426 !!end
24427
24428 !!test
24429 Accept empty attributes in th-cells
24430 !! wikitext
24431 {|
24432 !| foo !!| bar
24433 |}
24434 !! html
24435 <table>
24436 <tr>
24437 <th> foo </th>
24438 <th> bar
24439 </th></tr></table>
24440
24441 !!end
24442
24443 !!test
24444 Empty table rows go away
24445 !! wikitext
24446 {|
24447 | Hello
24448 | there
24449 |- class="foo"
24450 |-
24451 |}
24452 !! html
24453 <table>
24454 <tr>
24455 <td> Hello
24456 </td>
24457 <td> there
24458 </td></tr>
24459
24460 </table>
24461
24462 !! end
24463
24464 ###
24465 ### Parsoid-centric tests for testing RTing of inter-element separators
24466 ### Edge cases not tested by existing parser tests and specific to
24467 ### Parsoid-specific serialization strategies.
24468 ###
24469
24470 !!test
24471 RT-ed inter-element separators should be valid separators
24472 !! wikitext
24473 {|
24474 |- [[foo]]
24475 |}
24476 !! html/php
24477 <table>
24478
24479 </table>
24480
24481 !! html/parsoid
24482 <table>
24483 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
24484 </tbody></table>
24485 !!end
24486
24487 # Parsoid-only since PHP parser relies on Tidy for correct output
24488 !!test
24489 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
24490 !!options
24491 parsoid
24492 !! wikitext
24493 {|
24494 |<small>foo
24495 bar
24496 |}
24497
24498 {|
24499 |<small>foo<small>
24500 |}
24501 !! html
24502 <table>
24503 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
24504 <p>bar</p></small></td></tr>
24505 </tbody></table>
24506
24507 <table>
24508 <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>
24509 </tbody></table>
24510 !!end
24511
24512 # Note that the "style" attribute is really a template parameter here.
24513 # The = would have to be {{=}} if you wanted the literal.
24514 !!test
24515 Empty TD followed by TD with tpl-generated attribute
24516 !! wikitext
24517 {|
24518 |-
24519 |
24520 |{{echo|style='color:red'}}|foo
24521 |}
24522 !! html
24523 <table>
24524
24525 <tr>
24526 <td>
24527 </td>
24528 <td>foo
24529 </td></tr></table>
24530
24531 !!end
24532
24533 !!test
24534 Indented table with an empty td
24535 !! wikitext
24536 {|
24537 |-
24538 |
24539 |foo
24540 |}
24541 !! html
24542 <table>
24543
24544 <tr>
24545 <td>
24546 </td>
24547 <td>foo
24548 </td></tr></table>
24549
24550 !!end
24551
24552 ## We have some newline diffs RT-ing this edge case
24553 ## and it is not important enough -- we seem to be emitting
24554 ## at most 2 newlines after a </tr> and this is unrelated to
24555 ## the issue from T85627 that this is testing.
24556 !!test
24557 Indented table with blank lines in between (T85627)
24558 !! options
24559 parsoid=wt2html
24560 !! wikitext
24561 {|
24562 |foo
24563
24564
24565 |}
24566 !! html
24567 <table>
24568
24569 <tr>
24570 <td>foo
24571 </td></tr></table>
24572
24573 !!end
24574
24575 !!test
24576 Indented block & table
24577 !! wikitext
24578 <div>foo</div>
24579 {|
24580 |foo
24581 |}
24582 !! html/php
24583 <div>foo</div>
24584 <table>
24585 <tr>
24586 <td>foo
24587 </td></tr></table>
24588
24589 !! html/parsoid
24590 <div data-parsoid='{"stx":"html"}'>foo</div>
24591 <table><tbody>
24592 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
24593 </tbody></table>
24594 !!end
24595
24596 !! test
24597 Indent and comment before table row
24598 !! wikitext
24599 {|
24600 <!--hi-->|-
24601 | there
24602 |}
24603 !! html/php
24604 <table>
24605
24606 <tr>
24607 <td> there
24608 </td></tr></table>
24609
24610 !! html/parsoid
24611 <table>
24612 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
24613 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
24614 </tbody></table>
24615 !! end
24616
24617 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
24618 !!test
24619 Empty TR followed by a template-generated TR
24620 !!options
24621 parsoid
24622 !! wikitext
24623 {|
24624 |-
24625 {{echo|<tr><td>foo</td></tr>}}
24626 |}
24627 !! html
24628 <table>
24629 <tbody>
24630 <tr></tr>
24631 <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}}]}'>
24632 <td>foo</td></tr>
24633 </tbody></table>
24634 !!end
24635
24636 ## PHP and parsoid output differ for this, and since this is primarily
24637 ## for testing Parsoid's serializer, marking this Parsoid only
24638 !!test
24639 Empty TR followed by mixed-ws-comment line should RT correctly
24640 !!options
24641 parsoid
24642 !! wikitext
24643 {|
24644 |-
24645 <!--c-->
24646 |-
24647 <!--c--> <!--d-->
24648 |}
24649 !! html
24650 <table>
24651 <tbody>
24652 <tr></tr>
24653 <!--c-->
24654 <tr>
24655 <!--c--> </tr><!--d-->
24656 </tbody></table>
24657
24658 !!end
24659
24660 !!test
24661 Multi-line image caption generated by templates with/without trailing newlines
24662 !! wikitext
24663 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
24664 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
24665 !! html/parsoid
24666 <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>
24667 <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>
24668 !!end
24669
24670 !! test
24671 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
24672 !! options
24673 parsoid=html2wt
24674 !! html/parsoid
24675 <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>
24676
24677 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
24678 !! wikitext
24679 <includeonly>foo</includeonly>
24680 new para
24681
24682 [[Category:Foo]]
24683
24684 = new heading =
24685 !! end
24686
24687 ## PHP emits broken html for this, and since this is primarily
24688 ## a Parsoid serializer test, marking this Parsoid only
24689 !!test
24690 Improperly nested inline or quotes tags with whitespace in between
24691 !! wikitext
24692 <span> <s>x</span> </s>
24693 ''' ''x''' ''
24694 !! html/parsoid
24695 <p><span> <s>x</s></span><s> </s>
24696 <b> <i>x</i></b><i> </i>
24697 </p>
24698 !!end
24699
24700 !!test
24701 Encapsulate protected attributes from wt
24702 !! wikitext
24703 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
24704 !! html/parsoid
24705 <body><div data-x-typeof="mw:placeholder stuff" data-x-data-mw="whoo" data-x-data-parsoid="weird" data-x-data-parsoid-other="no" data-x-about="time" data-x-rel="mw:true">foo</div>
24706 </body>
24707 !!end
24708
24709 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
24710 ## Having nested or stray pre tags results in the attempt to add duplicates,
24711 ## causing an assertion fail. This test tries to prevent that situation.
24712 !!test
24713 Ensure ParagraphWrapper can deal with stray closing pre tags
24714 !!options
24715 parsoid=wt2html
24716 !! wikitext
24717 plain text</pre>
24718 !! html/parsoid
24719 plain text
24720 !!end
24721
24722 !!test
24723 1. Ensure fostered text content is wrapped in element nodes
24724 !!options
24725 parsoid=wt2html
24726 !! wikitext
24727 <table>hi</table><table>ho</table>
24728 !! html/parsoid
24729 <p>hi</p>
24730 <table></table>
24731 <p>ho</p>
24732 <table></table>
24733 !!end
24734
24735 !!test
24736 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
24737 !!options
24738 parsoid=wt2html,wt2wt
24739 !! wikitext
24740 <table>
24741 <tr> || ||
24742 <td> a
24743 </table>
24744 !! html/parsoid
24745 <p> || ||
24746 </p><table>
24747 <tbody><tr><td> a</td></tr>
24748 </tbody></table>
24749 !!end
24750
24751 !!test
24752 Encapsulation properly handles null DSR information from foster box
24753 !!options
24754 parsoid=wt2html,wt2wt
24755 !! wikitext
24756 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
24757 !! html/parsoid
24758 <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>
24759 !!end
24760
24761 !!test
24762 1. Encapsulate foster-parented transclusion content
24763 !!options
24764 parsoid=wt2wt,wt2html
24765 !! wikitext
24766 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
24767 !! html/parsoid
24768 <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>
24769 <tbody>
24770 <tr>
24771 <td>bar</td>
24772 </tr>
24773 </tbody>
24774 </table>
24775 !!end
24776
24777 !!test
24778 2. Encapsulate foster-parented transclusion content
24779 !!options
24780 parsoid=wt2wt,wt2html
24781 !! wikitext
24782 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
24783 !! html/parsoid
24784 <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>
24785 <table>
24786 <tbody>
24787 <tr>
24788 <td>bar</td>
24789 </tr>
24790 </tbody>
24791 </table>
24792 !!end
24793
24794 !!test
24795 3. Encapsulate foster-parented transclusion content
24796 !!options
24797 parsoid=wt2wt,wt2html
24798 !! wikitext
24799 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24800 !! html/parsoid
24801 <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;]}">
24802 <p>foo</p>
24803 </div>
24804 <table>
24805 <tbody>
24806 <tr>
24807 <td>bar</td>
24808 </tr>
24809 </tbody>
24810 </table>
24811 !!end
24812
24813 !!test
24814 4. Encapsulate foster-parented transclusion content
24815 !!options
24816 parsoid=wt2wt,wt2html
24817 !! wikitext
24818 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24819 !! html/parsoid
24820 <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;]}">
24821 <p>foo</p>
24822 </div>
24823 <table>
24824 <tbody>
24825 <tr>
24826 <td>bar</td>
24827 </tr>
24828 </tbody>
24829 </table>
24830 !!end
24831
24832 !!test
24833 5. Encapsulate foster-parented transclusion content
24834 !!options
24835 parsoid=wt2wt,wt2html
24836 !! wikitext
24837 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
24838 !! html/parsoid
24839 <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>
24840 <table>
24841 <tbody>
24842 <tr>
24843 <td>
24844 <div>
24845 <p>foo</p>
24846 </div>
24847 </td>
24848 </tr>
24849 </tbody>
24850 </table>
24851 !!end
24852
24853 !!test
24854 6. Encapsulate foster-parented transclusion content
24855 !!options
24856 parsoid=wt2wt,wt2html
24857 !! wikitext
24858 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
24859 !! html/parsoid
24860 <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>
24861 <table>
24862 <tbody>
24863 <tr>
24864 <td>
24865 <div>
24866 <p>foo</p>
24867 </div>
24868 </td>
24869 </tr>
24870 </tbody>
24871 </table>
24872 <p>ok</p>
24873 !!end
24874
24875 !!test
24876 7. Encapsulate foster-parented transclusion content
24877 !!options
24878 parsoid=wt2wt,wt2html
24879 !! wikitext
24880 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
24881 !! html/parsoid
24882 <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>
24883 <table>
24884 <tbody>
24885 <tr>
24886 <td>bar</td>
24887 </tr>
24888 </tbody>
24889 </table>
24890 !!end
24891
24892 # Note that the wt is broken on purpose: the = should be {{=}} if you
24893 # don't want it to be a template parameter key.
24894 !!test
24895 8. Encapsulate foster-parented transclusion content
24896 !!options
24897 parsoid=wt2wt,wt2html
24898 !! wikitext
24899 {{echo|a
24900 }}{|{{echo|style='color:red'}}
24901 |-
24902 |b
24903 |}
24904 !! html/parsoid
24905 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
24906 <span> </span>
24907 <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>
24908 <table>
24909 <tbody>
24910 <tr>
24911 <td>b</td>
24912 </tr>
24913 </tbody>
24914 </table>
24915 !!end
24916
24917 !!test
24918 9. Encapsulate foster-parented transclusion content
24919 !!options
24920 parsoid=wt2wt,wt2html
24921 !! wikitext
24922 <table>{{echo|hi</table>hello}}
24923 !! html/parsoid
24924 <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>
24925 !!end
24926
24927 !!test
24928 Table in fosterable position
24929 !!options
24930 parsoid=wt2html
24931 !! wikitext
24932 {{OpenTable}}
24933 <div>
24934 {|
24935 |}
24936 </div>
24937 |}
24938 !! html/parsoid
24939 <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">
24940 </span>
24941 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
24942
24943 <table>
24944 </table>
24945 !!end
24946
24947 # Parsoid only for bug 64747
24948 !! test
24949 Properly encapsulate empty-content transclusions in fosterable positions
24950 !! wikitext
24951 <table>
24952 {{#if:|
24953 <td>foo</td>
24954 }}
24955 </table>
24956 !! html/parsoid
24957 <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"}]]}'>
24958
24959 </table>
24960 !! end
24961
24962 !! test
24963 Always encapsulate foster box when template range is expanded to table
24964 !! options
24965 parsoid=wt2wt
24966 !! wikitext
24967 {|
24968 hello
24969 {{OpenTable}}
24970 |}
24971 !! html/parsoid
24972
24973 !! end
24974
24975 !! test
24976 T115289: Unclosed table
24977 !! wikitext
24978 {{echo|<table>}}<!--c-->[[Category:Two]]
24979 !! html/parsoid
24980 <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>
24981 !! end
24982
24983 !! test
24984 T115289: Don't migrate newlines out of tables with fostered content
24985 !! wikitext
24986 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
24987 !! html/parsoid
24988 <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>
24989 !! end
24990
24991 !! test
24992 T73074: More fostering fun
24993 !! wikitext
24994 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
24995 !! html/parsoid
24996 <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>
24997 !! end
24998
24999 !!test
25000 Support <object> element with .data attribute
25001 !!options
25002 parsoid=html2wt
25003 !! html/parsoid
25004 <object data="test.swf"></object>
25005 !! wikitext
25006 <object data="test.swf"></object>
25007 !!end
25008
25009 !! test
25010 Don't block XML namespace declaration
25011 !! wikitext
25012 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25013 !! html/php
25014 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25015 </p>
25016 !! html/parsoid
25017 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
25018 !! end
25019
25020 # -----------------------------------------------------------------
25021 # The following section of tests are primarily to spec requirements
25022 # around Parsoid's serialization (old, new, edited content)
25023 #
25024 # All these tests are marked Parsoid html2wt and html2html only
25025 # ----------------------------------------------------------------
25026
25027 !! test
25028 Ignore rel attribute in a-tags during serialization to url-links
25029 !! options
25030 parsoid=html2wt
25031 !! html/parsoid
25032 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
25033 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
25034 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
25035 !! wikitext
25036 http://en.wikipedia.org/wiki/Foobar
25037 http://en.wikipedia.org/wiki/Foobar
25038 http://en.wikipedia.org/wiki/Foobar
25039 !! end
25040
25041 # 'mi' is a localinterwiki prefix as well as a language
25042 !! test
25043 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
25044 !! options
25045 parsoid=html2wt
25046 !! html/parsoid
25047 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
25048 !! wikitext
25049 [[Foo]]
25050 !! end
25051
25052 # See T93839
25053 !! test
25054 New wikilinks should be serialized properly
25055 !! options
25056 parsoid=html2wt
25057 !! html/parsoid
25058 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
25059 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
25060 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
25061 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
25062 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
25063 !! wikitext
25064 [[Foo]]
25065 [[Foo]]
25066 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
25067 http://en.wikipedia.org/wiki/Foo
25068 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
25069 !! end
25070
25071 !! test
25072 New wiki links (href variations)
25073 !! options
25074 parsoid=html2wt
25075 !! html/parsoid
25076 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25077 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
25078 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
25079 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
25080 !! wikitext
25081 [[Foo_bar]]
25082 [[Foo_bar]]
25083 [[Foo_bar]]
25084 [[Toxine bactérienne]]
25085 !! end
25086
25087 !! test
25088 New wiki links (content string variations)
25089 !! options
25090 parsoid=html2wt
25091 !! html/parsoid
25092 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25093 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
25094 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
25095 !! wikitext
25096 [[Foo_bar]]
25097 [[Foo bar]]
25098 [[Foo_bar|./Foo_bar]]
25099 !! end
25100
25101 !! test
25102 New category links (href variations)
25103 !! options
25104 parsoid=html2wt
25105 !! html/parsoid
25106 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
25107 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
25108 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
25109 !! wikitext
25110 [[Category:Toxine bactérienne]]
25111 [[Category:Toxine bactérienne]]
25112 [[Category:Toxine bactérienne]]
25113 !! end
25114
25115 !! test
25116 New sol transparent links don't need indent-pre nowiki protection
25117 !! options
25118 parsoid=html2wt
25119 language=de
25120 !! html/parsoid
25121 <link rel="mw:PageProp/redirect" href="./Main_Page">
25122 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
25123 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
25124 !! wikitext
25125 #WEITERLEITUNG [[Main Page]]
25126 <!-- this is good --> [[Category:Good]]
25127 <!-- this is great --> [[Kategorie:Great]]
25128 !! end
25129
25130 !! test
25131 New interlanguage links (href variations)
25132 !! options
25133 parsoid=html2wt
25134 !! html/parsoid
25135 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
25136 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
25137 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
25138 !! wikitext
25139 [[es:Toxine bactérienne]]
25140 [[es:Toxine_bactérienne]]
25141 [[es:Toxine_bactérienne]]
25142 !! end
25143
25144 !! test
25145 Image: Modifying size of an image (1)
25146 !! options
25147 parsoid={
25148 "modes": ["wt2wt"],
25149 "changes": [
25150 ["img[height]", "attr", "height", "22"],
25151 ["img[width]", "attr", "width", "200"]
25152 ]
25153 }
25154 !! wikitext
25155 [[Image:Foobar.jpg|230x230px]]
25156 !! wikitext/edited
25157 [[Image:Foobar.jpg|200x200px]]
25158 !!end
25159
25160 !! test
25161 Image: Modifying size of an image (2)
25162 !! options
25163 parsoid={
25164 "modes": ["wt2wt"],
25165 "changes": [
25166 ["img[height]", "attr", "height", "100"],
25167 ["img[width]", "attr", "width", "500"]
25168 ]
25169 }
25170 !! wikitext
25171 [[Image:Foobar.jpg|230x230px]]
25172 !! wikitext/edited
25173 [[Image:Foobar.jpg|500x500px]]
25174 !!end
25175
25176 # Change in size is ignored so long as class='mw-default-size'
25177 !! test
25178 Image: Modifying size of an image (3)
25179 !! options
25180 parsoid={
25181 "modes": ["wt2wt"],
25182 "changes": [
25183 ["figure[class]", "removeClass", "mw-default-size"],
25184 ["figure img", "attr", "height", "19"],
25185 ["figure img", "attr", "width", "170"]
25186 ]
25187 }
25188 !! wikitext
25189 [[Image:Foobar.jpg|thumb]]
25190 !! wikitext/edited
25191 [[Image:Foobar.jpg|thumb|170x170px]]
25192 !!end
25193
25194 !! test
25195 Image: Modifying alignment of an image (bug 48665)
25196 !! options
25197 parsoid={
25198 "modes": ["wt2wt"],
25199 "changes": [
25200 ["figure[class]", "removeClass", "mw-halign-right"],
25201 ["figure[class]", "addClass", "mw-halign-left"]
25202 ]
25203 }
25204 !! wikitext
25205 [[Image:Foobar.jpg|thumb|caption|right]]
25206 !! wikitext/edited
25207 [[Image:Foobar.jpg|thumb|caption|left]]
25208 !! end
25209
25210 !! test
25211 Image: Modifying mw-default-size of an frameless image (bug 62805)
25212 !! options
25213 parsoid={
25214 "modes": ["wt2wt"],
25215 "changes": [
25216 ["figure.mw-default-size", "removeClass", "mw-default-size"]
25217 ]
25218 }
25219 !! wikitext
25220 [[Image:Foobar.jpg|frameless|right]]
25221 !! wikitext/edited
25222 [[Image:Foobar.jpg|frameless|right|220x220px]]
25223 !! end
25224
25225 !! test
25226 Image: Modifying valign of an image (bug 49221)
25227 !! options
25228 parsoid={
25229 "modes": ["wt2wt"],
25230 "changes": [
25231 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
25232 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
25233 ]
25234 }
25235 !! wikitext
25236 [[File:Foobar.jpg|20px|middle]]
25237 !! wikitext/edited
25238 [[File:Foobar.jpg|20px|text-top]]
25239 !! end
25240
25241 !! test
25242 Image: Modifying alt attribute of an image (bug 56400)
25243 !! options
25244 parsoid={
25245 "modes": ["wt2wt"],
25246 "changes": [
25247 ["img[alt]", "attr", "alt", "some alternate edited text"]
25248 ]
25249 }
25250 !! wikitext
25251 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
25252 !! wikitext/edited
25253 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
25254 !!end
25255
25256 !! test
25257 Image: Modifying caption of an image
25258 !! options
25259 parsoid={
25260 "modes": ["wt2wt"],
25261 "changes": [
25262 ["figcaption", "text", "new caption"]
25263 ]
25264 }
25265 !! wikitext
25266 [[Image:Foobar.jpg|thumb|original caption]]
25267 !! wikitext/edited
25268 [[Image:Foobar.jpg|thumb|new caption]]
25269 !!end
25270
25271 !! test
25272 Image: empty alt attribute (bug 48924)
25273 !! options
25274 parsoid
25275 !! wikitext
25276 [[File:Foobar.jpg|thumb|alt=|bar]]
25277 !! html
25278 <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>
25279 !! end
25280
25281 !! test
25282 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
25283 !! options
25284 parsoid=html2wt
25285 language=ar
25286 disabled
25287 !! html/parsoid
25288 <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>
25289 !! wikitext
25290 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
25291 !! end
25292
25293 !! test
25294 Image: Block level image should have \n before and after
25295 !! wikitext
25296 123
25297 [[File:Foobar.jpg|right|thumb|150x150px]]
25298 456
25299 !! html/parsoid
25300 <p>123</p>
25301 <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>
25302 <p>456</p>
25303 !!end
25304
25305 !! test
25306 Image: New block level image should have \n before and after (existing content)
25307 !! wikitext
25308 123
25309 [[File:Foobar.jpg|right|thumb|150x150px]]
25310 456
25311 !! html/parsoid
25312 <p>123</p>
25313 <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>
25314 <p>456</p>
25315 !!end
25316
25317 !! test
25318 Image: upright option (parsoid)
25319 !! wikitext
25320 [[File:Foobar.jpg|thumb|upright|caption]]
25321 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
25322 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
25323 !! html/parsoid
25324 <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>
25325 <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>
25326 <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>
25327 !!end
25328
25329 !! test
25330 Image: upright option is ignored on inline and frame images (parsoid)
25331 !! wikitext
25332 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
25333 !! html/parsoid
25334 <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>
25335 !!end
25336
25337 !! test
25338 Image: from basic HTML (1)
25339 !! options
25340 parsoid=html2wt
25341 !! html/parsoid
25342 <span typeof="mw:Image">
25343 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25344 </span>
25345 !! wikitext
25346 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25347 !! end
25348
25349 !! test
25350 Image: from basic HTML (2)
25351 !! options
25352 parsoid=html2wt
25353 !! html/parsoid
25354 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25355 !! wikitext
25356 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25357 !! end
25358
25359 !! test
25360 Image: from basic HTML (3)
25361 !! options
25362 parsoid=html2wt
25363 !! html/parsoid
25364 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
25365 !! wikitext
25366 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
25367 !! end
25368
25369 !! test
25370 Image: from basic HTML (4)
25371 !! options
25372 parsoid=html2wt
25373 !! html/parsoid
25374 <img src="./File:Foobar.jpg">
25375 !! wikitext
25376 [[File:Foobar.jpg|link=]]
25377 !! end
25378
25379 !! test
25380 Image: Invalid title as link
25381 !! wikitext
25382 [[File:Foobar.jpg|link=<]]
25383 !! html/php
25384 <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>
25385 </p>
25386 !! html/parsoid
25387 <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>
25388 !! end
25389
25390 !! test
25391 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
25392 !! options
25393 parsoid=html2wt
25394 !! html/parsoid
25395 <ul>
25396 <li><p>foo</p></li>
25397 </ul>
25398 !! wikitext
25399 * foo
25400 !! end
25401
25402 !! test
25403 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
25404 !! options
25405 parsoid=html2wt
25406 !! html/parsoid
25407 <ul> <li>foo</li></ul>
25408 !! wikitext
25409 * foo
25410 !! end
25411
25412 !! test
25413 Don't strip leading whitespace when handling indent-pre suppressing tags
25414 !! options
25415 parsoid=html2wt
25416 !! html/parsoid
25417 <table>
25418 <tr><td> indented row</td></tr>
25419 </table>
25420 <blockquote><p>
25421 <b>This is very bold of you!</b>
25422 </p>
25423 <table><tr><td>
25424 indented cell (no pre-wrapping!)
25425 </td></tr></table>
25426 </blockquote>
25427 <p>foo</p>
25428 <div>bar</div>
25429 !! wikitext
25430 {|
25431 | indented row
25432 |}
25433 <blockquote>
25434 '''This is very bold of you!'''
25435
25436 {|
25437 |
25438 indented cell (no pre-wrapping!)
25439 |}
25440 </blockquote>
25441 foo
25442 <div>bar</div>
25443 !! end
25444
25445 !! test
25446 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
25447 !! options
25448 parsoid=html2wt
25449 !! html/parsoid
25450 <p>foo</p>
25451 <span>bar</span>
25452
25453 <span>foo2
25454 </span>bar2
25455
25456 <div>foo</div>
25457 <span>bar</span>
25458
25459 <div>
25460 <span>foo</span>
25461 </div>
25462 !! wikitext
25463 foo
25464
25465 <span>bar</span>
25466
25467 <span>foo2
25468 <nowiki> </nowiki></span>bar2
25469
25470 <div>foo</div>
25471 <nowiki> </nowiki><span>bar</span>
25472
25473 <div>
25474 <nowiki> </nowiki><span>foo</span>
25475 </div>
25476 !! end
25477
25478 !! test
25479 Lists: Dont insert newlines in a serialized list item.
25480 !! options
25481 parsoid=html2wt
25482 !! html/parsoid
25483 <ul><li>a<br>b</li><li>c</li></ul>
25484 !! wikitext
25485 * a<br>b
25486 * c
25487 !! end
25488
25489 !! test
25490 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
25491 !! options
25492 parsoid={
25493 "modes": ["html2wt"],
25494 "scrubWikitext": false
25495 }
25496 !! html/parsoid
25497 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25498 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25499
25500 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25501 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25502
25503 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
25504
25505 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25506 !! wikitext
25507 == hello there [[Category:A1]] ==
25508
25509 == [[Category:A2]] hi pal ==
25510
25511 == <!--foo--> [[Category:A3]] how goes it ==
25512
25513 == it goes well [[Category:A4]] <!--bar--> ==
25514
25515 ==howdy [[Category:A5]]==
25516
25517 == __TOC__ ok ==
25518 !! end
25519
25520 !! test
25521 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
25522 !! options
25523 parsoid={
25524 "modes": ["html2wt"],
25525 "scrubWikitext": true
25526 }
25527 !! html/parsoid
25528 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25529 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25530
25531 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25532 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25533
25534 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25535 !! wikitext
25536 == hello there ==
25537 [[Category:A1]]
25538 [[Category:A2]]
25539
25540 == hi pal ==
25541
25542 <!--foo--> [[Category:A3]]
25543
25544 == how goes it ==
25545
25546 == it goes well ==
25547 [[Category:A4]] <!--bar-->
25548
25549 __TOC__
25550
25551 == ok ==
25552 !! end
25553
25554 !! test
25555 Headings: Don't hoist metas that come from templates
25556 !! options
25557 parsoid={
25558 "modes": ["html2wt"],
25559 "scrubWikitext": true
25560 }
25561 !! html/parsoid
25562 <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>
25563 !! wikitext
25564 == {{echo|foo [[Category:Foo]]}} ==
25565 !! end
25566
25567 !! test
25568 Headings: Category in ref isn't hoisted
25569 !! options
25570 parsoid={
25571 "modes": ["html2wt"],
25572 "scrubWikitext": true
25573 }
25574 !! html/parsoid
25575 <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>
25576
25577 <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>
25578 !! wikitext
25579 == foo <ref>bar
25580 [[Category:Baz]] </ref> ==
25581
25582 <references />
25583 !! end
25584
25585 !! test
25586 Parsoid: Serialize positional parameters with = in them as named parameter
25587 !! options
25588 parsoid=html2wt
25589 !! html/parsoid
25590 <p about="#mwt1" typeof="mw:Transclusion"
25591 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
25592
25593 <p about="#mwt1" typeof="mw:Transclusion"
25594 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
25595
25596 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25597 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25598 <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>
25599 !! wikitext
25600 {{echo|1=f=oo}}
25601
25602 {{echo|1=f=oo|2=bar}}
25603
25604 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25605 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25606 {{echo|<nowiki>f=oo</nowiki>|bar}}
25607 !! end
25608
25609 !! test
25610 Parsoid: Serialize positional parameters with = in extlink as named parameter
25611 !! options
25612 parsoid=html2wt
25613 !! html/parsoid
25614 <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>
25615 !! wikitext
25616 {{echo|1=http://stuff?is=ok}}
25617 !! end
25618
25619 !! test
25620 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
25621 !! options
25622 parsoid=html2wt
25623 !! html/parsoid
25624 <div>a<p>b</p></div>
25625 <div>a
25626 <p>b</p></div>
25627 <div>
25628 a
25629 <p>b</p></div>
25630 !! wikitext
25631 <div>a
25632 b
25633 </div>
25634 <div>a
25635 b
25636 </div>
25637 <div>
25638 a
25639
25640 b
25641 </div>
25642 !! end
25643
25644 !! test
25645 Substrings resembling wikitext in hrefs should not get nowiki escapes
25646 !! options
25647 parsoid=html2wt
25648 !! html/parsoid
25649 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
25650 !! wikitext
25651 [[Foo''bar''baz]]
25652 !! end
25653
25654 !! test
25655 Enforce single-line context in the serializer
25656 !! options
25657 parsoid=html2wt
25658 !! html/parsoid
25659 <h2>testing
25660 123</h2>
25661
25662 <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">
25663 </span><span about="#mwt1">you</span> </h2>
25664
25665 <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>
25666
25667 <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
25668 there</span></li></ol>
25669
25670 <ul><li>asd
25671 sdf</li></ul>
25672
25673 <ul><li>foo
25674 bar
25675 baz</li>
25676 <li>foo <b>bar</b>
25677 baz</li></ul>
25678
25679 <dl><dt>hi
25680 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
25681 ho</dd></dl>
25682
25683 <dl><dd> <table>
25684 <tbody><tr><td> ha
25685 ha
25686 ha</td></tr>
25687 </tbody></table></dd></dl>
25688 !! wikitext
25689 == testing 123 ==
25690
25691 == hi {{bogus|there
25692 you}} ==
25693
25694 == foo <ref>hello
25695 there</ref> ==
25696
25697 <references />
25698
25699 * asd sdf
25700
25701 * foo bar baz
25702 * foo '''bar''' baz
25703
25704 ; hi ho : hi ho
25705
25706 : {|
25707 | ha
25708 ha
25709 ha
25710 |}
25711 !! end
25712
25713 !! test
25714 Serialize new placeholder space without spans
25715 !! options
25716 parsoid=html2wt
25717 !! html/parsoid
25718 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
25719
25720 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
25721
25722 <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>
25723 !! wikitext
25724 foo : bar
25725
25726 foo : bar
25727
25728 <ref>foo : bar</ref>ok
25729 !! end
25730
25731
25732 #-----------------------
25733 # Tag minimization tests
25734 #-----------------------
25735
25736 !! test
25737 1. I/B quote minimization: wikitext-only tags should be combined
25738 !! options
25739 parsoid=html2wt
25740 !! html/parsoid
25741 <p><i>A</i><i>B</i></p>
25742 <p><b>A</b><b>B</b></p>
25743 <p><i>A</i><b><i>B</i></b></p>
25744 <p><b>A</b><i><b>B</b></i></p>
25745 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
25746 <p><i><b>A</b></i><i><b>B</b></i></p>
25747 <p><i><b>A</b></i><b><i>B</i></b></p>
25748 <p><b><i>A</i></b><i><b>B</b></i></p>
25749 !! wikitext
25750 ''AB''
25751
25752 '''AB'''
25753
25754 ''A'''B'''''
25755
25756 '''A''B'''''
25757
25758 '''A''BC''D'''
25759
25760 '''''AB'''''
25761
25762 '''''AB'''''
25763
25764 '''''AB'''''
25765 !! end
25766
25767 !! test
25768 2. I/B quote minimization: wikitext and html tags should not be combined
25769 !! options
25770 parsoid=html2wt
25771 !! html/parsoid
25772 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
25773 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
25774 !! wikitext
25775 ''A''<i>B</i>
25776
25777 ''A''<nowiki/>'''<i>B</i>'''
25778 !! end
25779
25780 !! test
25781 3. I/B quote minimization: templated content stops minimization
25782 !! options
25783 parsoid=html2wt
25784 !! html/parsoid
25785 <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>
25786 <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>
25787 !! wikitext
25788 ''A''{{echo|''B''}}
25789
25790 ''A''{{echo|'''''B'''''}}
25791 !! end
25792
25793 !! test
25794 4. I/B quote minimization: new content should be mimimized with adjacent old content
25795 !! options
25796 parsoid=html2wt
25797 !! html/parsoid
25798 <p><i>A</i><i>B</i></p>
25799 <p><b>A</b><b>B</b></p>
25800 <p><i>A</i><b><i>B</i></b></p>
25801 !! wikitext
25802 ''AB''
25803
25804 '''AB'''
25805
25806 ''A'''B'''''
25807 !! end
25808
25809 !! test
25810 5a. Merge adjacent quote nodes if they've been edited
25811 !! options
25812 parsoid={
25813 "modes": ["wt2wt", "selser"],
25814 "changes": [
25815 ["p", "contents", "remove", ":contains('b')"]
25816 ]
25817 }
25818 !! wikitext
25819 ''a''b''c''
25820 !! wikitext/edited
25821 ''ac''
25822 !! end
25823
25824 !! test
25825 5b. Merge adjacent quote nodes if they've been edited
25826 !! options
25827 parsoid={
25828 "modes": ["wt2wt", "selser"],
25829 "changes": [
25830 ["#x", "remove"]
25831 ]
25832 }
25833 !! wikitext
25834 ''a''<span id="x">b</span>''c''
25835 !! wikitext/edited
25836 ''ac''
25837 !! end
25838
25839 !! test
25840 1. Merge adjacent link nodes as long as at least one element is new
25841 !! options
25842 parsoid={
25843 "modes": ["html2wt"],
25844 "scrubWikitext": true
25845 }
25846 !! html/parsoid
25847 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25848 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25849 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
25850 !! wikitext
25851 [[Football]]
25852 [[Football]]
25853 [[Football|Foot]][[Football|ball]]
25854 !! end
25855
25856 !! test
25857 2. Merge adjacent link nodes and enable additional normalizations
25858 !! options
25859 parsoid={
25860 "modes": ["html2wt"],
25861 "scrubWikitext": true
25862 }
25863 !! html/parsoid
25864 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
25865 !! wikitext
25866 [[Football|''Football'']]
25867 !! end
25868
25869 !! test
25870 3. Don't merge adjacent link nodes if scrubWikitext is false
25871 !! options
25872 parsoid={
25873 "modes": ["html2wt"],
25874 "scrubWikitext": false
25875 }
25876 !! html/parsoid
25877 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25878 !! wikitext
25879 [[Football|Foot]][[Football|ball]]
25880 !! end
25881
25882 #------------------------------
25883 # End of tag minimization tests
25884 #------------------------------
25885
25886 !!test
25887 Bug 54262: New entities
25888 !! options
25889 parsoid=html2wt
25890 !! html/parsoid
25891 <span typeof="mw:Entity">&nbsp;</span>
25892 !! wikitext
25893 &nbsp;
25894 !! end
25895
25896 ## Note that there is no wikitext output for 'unknownproperty' ##
25897 ## Unknown magic words are silently dropped ##
25898
25899 !! test
25900 Magic words
25901 !! options
25902 parsoid=html2wt
25903 !! html/parsoid
25904 <meta property='mw:PageProp/toc' />
25905 <meta property='mw:PageProp/notoc' />
25906 <meta property='mw:PageProp/forcetoc' />
25907 <meta property='mw:PageProp/index' />
25908 <meta property='mw:PageProp/noindex' />
25909 <meta property='mw:PageProp/nogallery' />
25910 <meta property='mw:PageProp/noeditsection' />
25911 <meta property='mw:PageProp/notitleconvert' />
25912 <meta property='mw:PageProp/nocontentconvert' />
25913 <meta property='mw:PageProp/unknownproperty' />
25914 !! wikitext
25915 __TOC__
25916 __NOTOC__
25917 __FORCETOC__
25918 __INDEX__
25919 __NOINDEX__
25920 __NOGALLERY__
25921 __NOEDITSECTION__
25922 __NOTITLECONVERT__
25923 __NOCONTENTCONVERT__
25924 !! end
25925
25926 !! test
25927 Consecutive <pre>s should not get merged
25928 !! options
25929 parsoid=html2wt,html2html
25930 !! html/parsoid
25931 <pre>a</pre><pre>b</pre>
25932
25933 <pre>c
25934 </pre><pre>
25935 d</pre>
25936
25937 <pre>e
25938
25939 </pre><pre>
25940
25941 f</pre>
25942 !! wikitext
25943 a
25944
25945 b
25946
25947 c
25948
25949 d
25950
25951 e
25952
25953
25954
25955 f
25956 !! end
25957
25958 !! test
25959 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
25960 !! options
25961 parsoid=html2wt
25962 !! html/parsoid
25963 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
25964 !! wikitext
25965 [[Special:BookSources/1234567890|ISBN 1234567895]]
25966 !! end
25967
25968 !! test
25969 Edited RFC links not serializable as RFC links should serialize as extlinks
25970 !! options
25971 parsoid=html2wt
25972 !! html/parsoid
25973 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
25974 !! wikitext
25975 [//tools.ietf.org/html/rfc123 New RFC]
25976 !! end
25977
25978 !! test
25979 Edited PMID links not serializable as PMID links should serialize as extlinks
25980 !! options
25981 parsoid=html2wt
25982 !! html/parsoid
25983 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
25984 !! wikitext
25985 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
25986 !! end
25987
25988 !! test
25989 WTS of autolinks with trailing/surrounding context
25990 !! options
25991 parsoid=html2wt
25992 !! html/parsoid
25993 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
25994 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
25995 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
25996 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
25997 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
25998 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
25999 !! wikitext
26000 http://cscott.net'''foo'''
26001
26002 http://cscott.net<b>foo</b>
26003
26004 '''http://cscott.net'''
26005
26006 '''http://cscott.net '''
26007
26008 '''http://cscott.net<nowiki/>x'''
26009
26010 http://cscott.net<nowiki/>x
26011 !! end
26012
26013 !! test
26014 WTS of autolinks with nowikis (round-trip)
26015 !! wikitext
26016 x<nowiki/>http://cscott.net<nowiki/>x
26017 !! html/parsoid
26018 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
26019 !! end
26020
26021 # this is the "easy" test because it leaves in place all the
26022 # data-parsoid information indicating this is an autolink
26023 !! test
26024 WTS of autolinks with escapes (editing)
26025 !! options
26026 parsoid={
26027 "modes": ["wt2wt"],
26028 "changes": [
26029 [ "meta", "remove" ]
26030 ]
26031 }
26032 !! wikitext
26033 x<nowiki/>http://cscott.net<nowiki/>x
26034 !! wikitext/edited
26035 x<nowiki/>http://cscott.net<nowiki/>x
26036 !! end
26037
26038 !! test
26039 WTS of edited autolink-like text (T103364)
26040 !! options
26041 parsoid={
26042 "modes": ["wt2wt"],
26043 "changes": [
26044 [ "span[typeof]", "removeAttr", "typeof" ]
26045 ]
26046 }
26047 !! wikitext
26048 Not a link: <nowiki>http://example.com</nowiki>.
26049 !! wikitext/edited
26050 Not a link: <span><nowiki>http://example.com</nowiki></span>.
26051 !! end
26052
26053 !! test
26054 WTS of newly-authored autolink-like text (T103364)
26055 !! options
26056 parsoid=html2wt
26057 !! html/parsoid
26058 <p>http://example.com is not a link.</p>
26059 !! wikitext
26060 <nowiki>http://example.com</nowiki> is not a link.
26061 !! end
26062
26063 !! test
26064 WTS of autolink-like text after an autolink (T108563)
26065 !! options
26066 parsoid=html2wt
26067 !! html/parsoid
26068 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
26069 !! wikitext
26070 http://example.com <nowiki>http://example.com</nowiki> is not a link.
26071 !! end
26072
26073 !! test
26074 Magic links inside links (not autolinked)
26075 !! wikitext
26076 [[Foo|http://example.com]]
26077 [[Foo|RFC 1234]]
26078 [[Foo|PMID 1234]]
26079 [[Foo|ISBN 123456789x]]
26080
26081 [http://foo.com http://example.com]
26082 [http://foo.com RFC 1234]
26083 [http://foo.com PMID 1234]
26084 [http://foo.com ISBN 123456789x]
26085 !! html+tidy
26086 <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>
26087 <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>
26088 !! html/parsoid
26089 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
26090 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
26091 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
26092 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
26093
26094 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
26095 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
26096 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
26097 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
26098 !! end
26099
26100 !! test
26101 Magic links inside image captions (autolinked)
26102 !! wikitext
26103 [[File:Foobar.jpg|thumb|http://example.com]]
26104 [[File:Foobar.jpg|thumb|RFC 1234]]
26105 [[File:Foobar.jpg|thumb|PMID 1234]]
26106 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
26107 !! html+tidy
26108 <div class="thumb tright">
26109 <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>
26110 <div class="thumbcaption">
26111 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26112 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
26113 </div>
26114 </div>
26115 <div class="thumb tright">
26116 <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>
26117 <div class="thumbcaption">
26118 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26119 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
26120 </div>
26121 </div>
26122 <div class="thumb tright">
26123 <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>
26124 <div class="thumbcaption">
26125 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26126 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
26127 </div>
26128 </div>
26129 <div class="thumb tright">
26130 <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>
26131 <div class="thumbcaption">
26132 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26133 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
26134 </div>
26135 </div>
26136 !! html/parsoid
26137 <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>
26138 <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>
26139 <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>
26140 <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>
26141 !! end
26142
26143 !! test
26144 WTS of magic word text (T109371)
26145 !! options
26146 parsoid=html2wt
26147 !! html/parsoid
26148 <p>RFC 1234</p>
26149 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
26150 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
26151 !! wikitext
26152 <nowiki>RFC 1234</nowiki>
26153
26154 [http://foo.com RFC 1234]
26155
26156 [[Foo|RFC 1234]]
26157 !! end
26158
26159 !! test
26160 Edited Redirect link should emit a non-piped wikitext link
26161 !! options
26162 parsoid=html2wt
26163 !! html/parsoid
26164 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
26165 !! wikitext
26166 #REDIRECT [[Bar]]
26167 !! end
26168
26169 !! test
26170 T75121: Infer extension name from typeOf if data-mw is not present
26171 !! options
26172 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26173 !! html/parsoid
26174 <div typeOf="mw:Extension/foo"></div>
26175 !! wikitext
26176 <foo />
26177 !! end
26178
26179 # Note that the <p> wrapping isn't present in PHP parser output
26180 # The important thing for this test is that P-wrapping doesn't
26181 # interfere with the <nowiki> protection for leading - in <td>
26182 # (which isn't necessary for <th>).
26183 !! test
26184 T88318: p-wrapped dash in table.
26185 !! options
26186 parsoid=html2wt,wt2wt
26187 !! html/parsoid
26188 <table><tbody>
26189 <tr><th><p>-</p></th><th><p>- </p></th></tr>
26190 <tr><td><p>-</p></td><td><p>- </p></td></tr>
26191 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
26192 </tbody></table>
26193 !! wikitext
26194 {|
26195 !-
26196 !-
26197 |-
26198 |<nowiki>-</nowiki>
26199 |<nowiki>- </nowiki>
26200 |-
26201 |<small>-</small>
26202 |<br>
26203 -
26204 |<br>
26205 -
26206 |}
26207 !! html/php+tidy
26208 <table>
26209 <tr>
26210 <th>-</th>
26211 <th>-</th>
26212 </tr>
26213 <tr>
26214 <td>-</td>
26215 <td>-</td>
26216 </tr>
26217 <tr>
26218 <td><small>-</small></td>
26219 <td><br />
26220 <p>-</p>
26221 </td>
26222 <td><br />
26223 <p>-</p>
26224 </td>
26225 </tr>
26226 </table>
26227 !! end
26228
26229 !! test
26230 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
26231 !! options
26232 parsoid=html2wt
26233 !! html/parsoid
26234 <table id='mwAb'>
26235 <td id='mwAc'>foo</td>
26236 <td id='serialize-this'>bar</td>
26237 </table>
26238 !! wikitext
26239 {|
26240 |foo
26241 | id="serialize-this" |bar
26242 |}
26243 !! end
26244
26245 !! test
26246 Parsoid-like element ids should not be serialized to wikitext unless shadowed
26247 !! options
26248 parsoid=html2wt
26249 !! html/parsoid
26250 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
26251 !! wikitext
26252 <div id="hello">ok</div>
26253 !! end
26254
26255 !! test
26256 WTS change modes
26257 !! options
26258 parsoid={
26259 "modes": ["wt2wt"],
26260 "changes": [
26261 [ "#xyz", "before", "<b>before</b> stuff " ],
26262 [ "#xyz", "after", " stuff <i>after</i>" ],
26263 [ "#xyz", "html", "x <b>y</b> z" ]
26264 ]
26265 }
26266 !! wikitext
26267 <span id="xyz">hello</span>
26268 !! wikitext/edited
26269 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
26270 !! end
26271
26272 !! test
26273 Never serialize a-tag as html, regardless of what data-parsoid has to say
26274 !! options
26275 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26276 !! html/parsoid
26277 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
26278 !! wikitext
26279 [[Foo]]
26280 !! end
26281
26282 ## SSS FIXME: This is broken output nevertheless.
26283 ## What might be a reasonable non-broken output for this?
26284 ## This is an edge case unlikely to be seen in production
26285 ## that I am not wasting more time on this right now.
26286 !! test
26287 Never serialize a-tag as html, no matter what attributes it has
26288 !! options
26289 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26290 !! html/parsoid
26291 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
26292 !! wikitext
26293 [http://boo.org http://boohoo.org]
26294 !! end
26295
26296 # Misnested is an indication that selser can reuse the source but these have
26297 # shown to sneak through on occasion. See T101768.
26298 # The original wikitext here is: [http://test.com [[one]] two three]
26299 !! test
26300 Strip span tags added to mark misnested links
26301 !! options
26302 parsoid=html2wt
26303 !! html/parsoid
26304 <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>
26305 !! wikitext
26306 [http://test.com][[one]] two three
26307 !! end
26308
26309 !! test
26310 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
26311 !! options
26312 parsoid=html2wt
26313 !! html/parsoid
26314 <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|}"]}'>
26315 <tbody><tr><td>d
26316 </td></tr>
26317 </tbody></table>
26318 !! wikitext
26319 {{echo|a}}
26320 {|{{echo|c
26321 {{!}}d
26322 }}
26323 |}
26324 !! end
26325
26326 ## This test verifies the presence and computation of this attribute indirectly
26327 ## by making an edit and ensuring that the serialization is correct (which it would be
26328 ## only if firstWikitextNode is properly set).
26329 !! test
26330 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
26331 !! options
26332 parsoid= {
26333 "modes": ["wt2wt"],
26334 "changes": [
26335 [ "div#x", "remove" ],
26336 [ "div", "before", "<div>new</div>" ]
26337 ]
26338 }
26339 !! wikitext
26340 <div id="x">foo</div>
26341 {|
26342 {{echo|<div>boo</div>
26343 {{!}}b}}
26344 |c
26345 |}
26346 !! wikitext/edited
26347
26348 <div>new</div>
26349 {|
26350 {{echo|<div>boo</div>
26351 {{!}}b}}
26352 |c
26353 |}
26354 !! end
26355
26356 # --------------------------------------------
26357 # Tests spec'ing wikitext serialization norms |
26358 # --------------------------------------------
26359
26360 !! test
26361 1. Categories should always be serialized on their own line
26362 !! options
26363 parsoid=html2wt
26364 !! html/parsoid
26365 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
26366 !! wikitext
26367 foo
26368 [[Category:Foo]]
26369 bar
26370 !! end
26371
26372 !! test
26373 2. Categories that are part of templates should not introduce a line break
26374 !! wikitext
26375 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
26376 !! html/parsoid
26377 <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>
26378 !! end
26379
26380 # Careful while editing these next 2 tests. There are \u200f characters
26381 # before and after the <link> tags in the HTML and following some
26382 # of the categories in wikitext
26383 # Do not remove these characters in edits.
26384 #
26385 # As part of the serialization, these bidi characters will get stripped.
26386 !! test
26387 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
26388 !! options
26389 parsoid={
26390 "modes": ["html2wt"],
26391 "scrubWikitext": true
26392 }
26393 !! html/parsoid
26394 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
26395 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
26396 !! wikitext
26397 [[קטגוריה:טקסים]]
26398 [[קטגוריה: שיטות משפט]]
26399 !! end
26400
26401 !! test
26402 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
26403 !! options
26404 parsoid={
26405 "modes": ["html2wt"],
26406 "scrubWikitext": true
26407 }
26408 !! html/parsoid
26409 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
26410 !! wikitext
26411 [[קטגוריה:טקסים]]
26412 ‏y
26413 !! end
26414
26415 !! test
26416 Lists: Add space after bullets
26417 !! options
26418 parsoid=html2wt
26419 !! html/parsoid
26420 <ul>
26421 <li>foo</li>
26422 <li> bar</li>
26423 <li><span> baz</span></li>
26424 </ul>
26425 !! wikitext
26426 * foo
26427 * bar
26428 * <span> baz</span>
26429 !! end
26430
26431 !! test
26432 1. Headings: Add space before/after == (T53744)
26433 !! options
26434 parsoid=html2wt
26435 !! html/parsoid
26436 <h2>foo</h2>
26437 <h2> bar</h2>
26438 <h2>baz </h2>
26439 <h2><span> baz</span></h2>
26440 !! wikitext
26441 == foo ==
26442
26443 == bar ==
26444
26445 == baz ==
26446
26447 == <span> baz</span> ==
26448 !! end
26449
26450 !! test
26451 2. Headings: Add space before/after == even after hoisted content
26452 !! options
26453 parsoid={
26454 "modes": ["html2wt"],
26455 "scrubWikitext": true
26456 }
26457 !! html/parsoid
26458 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
26459 !! wikitext
26460 [[Category:A2]]
26461
26462 == ok ==
26463 !! end
26464
26465 !! test
26466 1. Headings: suppress newly created empty headings
26467 !! options
26468 parsoid={
26469 "modes": ["html2wt"],
26470 "scrubWikitext": true
26471 }
26472 !! html/parsoid
26473 <h2></h2>
26474 !! wikitext
26475 !! end
26476
26477 !! test
26478 2. Headings: don't suppress empty headings if scrubWikitext is false
26479 !! options
26480 parsoid=html2wt
26481 !! html/parsoid
26482 <h2></h2>
26483 !! wikitext
26484 ==<nowiki/>==
26485 !! end
26486
26487 !! test
26488 3. Headings: suppress empty headings on edits
26489 !! options
26490 parsoid={
26491 "modes": ["selser"],
26492 "scrubWikitext": true,
26493 "changes": [
26494 [ "#x", "remove"]
26495 ]
26496 }
26497 !! wikitext
26498 ==<span id="x">foo</span>==
26499 !! wikitext/edited
26500 !! end
26501
26502 !! test
26503 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
26504 !! options
26505 parsoid={
26506 "modes": ["html2wt"],
26507 "scrubWikitext": true
26508 }
26509 !! html/parsoid
26510 <h2>foo<br/>bar</h2>
26511 <h2>foo <span><br/>bar</span> baz</h2>
26512 !! wikitext
26513 == foo bar ==
26514
26515 == foo <span> bar</span> baz ==
26516 !! end
26517
26518 !! test
26519 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
26520 !! options
26521 parsoid={
26522 "modes": ["html2wt"],
26523 "scrubWikitext": false
26524 }
26525 !! html/parsoid
26526 <h2>foo<br/>bar</h2>
26527 !! wikitext
26528 == foo<br> bar ==
26529 !! end
26530
26531 !! test
26532 1. WT Quote Tags: suppress newly created empty style tags
26533 !! options
26534 parsoid={
26535 "modes": ["html2wt"],
26536 "scrubWikitext": true
26537 }
26538 !! html/parsoid
26539 <i></i><b></b>
26540 !! wikitext
26541 !! end
26542
26543 !! test
26544 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
26545 !! options
26546 parsoid=html2wt
26547 !! html/parsoid
26548 <i></i><b></b>
26549 !! wikitext
26550 ''<nowiki/>'''''<nowiki/>'''
26551 !! end
26552
26553 !! test
26554 3. WT Quote Tags: suppress empty style tags on edits
26555 !! options
26556 parsoid={
26557 "modes": ["selser"],
26558 "scrubWikitext": true,
26559 "changes": [
26560 [ "#x", "remove"]
26561 ]
26562 }
26563 !! wikitext
26564 '''<span id="x">foo</span>'''
26565 !! wikitext/edited
26566 !! end
26567
26568 !! test
26569 1. Anchors: suppress newly created empty anchors
26570 !! options
26571 parsoid={
26572 "modes": ["html2wt"],
26573 "scrubWikitext": true
26574 }
26575 !! html/parsoid
26576 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26577 !! wikitext
26578 !! end
26579
26580 !! test
26581 2. Anchors: don't suppress empty anchors if scrubWikitext is false
26582 !! options
26583 parsoid={
26584 "modes": ["html2wt"],
26585 "scrubWikitext": false
26586 }
26587 !! html/parsoid
26588 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26589 !! wikitext
26590 [[Test|<nowiki/>]]
26591 !! end
26592
26593 !! test
26594 3. Anchors: suppress empty anchors on edits
26595 !! options
26596 parsoid={
26597 "modes": ["selser"],
26598 "scrubWikitext": true,
26599 "changes": [
26600 [ "#x", "remove"]
26601 ]
26602 }
26603 !! wikitext
26604 [[Test|<span id="x">foo</span>]]
26605 !! wikitext/edited
26606 !! end
26607
26608 !! test
26609 3a. Anchors: do not suppress numbered extlinks
26610 !! options
26611 parsoid={
26612 "modes": ["wt2wt"],
26613 "scrubWikitext": true
26614 }
26615 !! wikitext
26616 [http://foo.com]
26617 !! html/parsoid
26618 <a rel="mw:ExtLink" href="http://foo.com"></a>
26619 !! end
26620
26621 !! test
26622 3b. Anchors: do not suppress numbered extlinks
26623 !! options
26624 parsoid={
26625 "modes": ["wt2wt"],
26626 "scrubWikitext": true,
26627 "changes": [
26628 [ "#x", "remove"]
26629 ]
26630 }
26631 !! wikitext
26632 [http://foo.com <span id="x">foo</span>]
26633 !! wikitext/edited
26634 [http://foo.com]
26635 !! end
26636
26637 !!test
26638 Normalizations should be restricted to edited content
26639 !!options
26640 parsoid={
26641 "modes": ["selser"],
26642 "scrubWikitext": true,
26643 "changes": [
26644 [ "h1", "before", "<i></i>"]
26645 ]
26646 }
26647 !!wikitext
26648 a
26649 = =
26650 b
26651 !!wikitext/edited
26652 a
26653 = =
26654 b
26655 !!end
26656
26657 !! test
26658 1. Multiple normalizations (html2wt)
26659 !! options
26660 parsoid={
26661 "modes": ["html2wt"],
26662 "scrubWikitext": true
26663 }
26664 !! html
26665 <h2><i></i></h2>
26666 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
26667 </a><b><i></i></b>x</p>
26668 !! wikitext
26669
26670 [[foo]]
26671 x
26672
26673 !! end
26674
26675 !! test
26676 2. Multiple normalizations (selser)
26677 !! options
26678 parsoid={
26679 "modes": ["selser"],
26680 "scrubWikitext": true,
26681 "changes": [
26682 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
26683 ]
26684 }
26685 !! wikitext
26686 <span id="x">foo</span>
26687 !! wikitext/edited
26688 <span id="x">foo</span>
26689
26690 x
26691 !! end
26692
26693 !! test
26694 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
26695 !! options
26696 parsoid={
26697 "modes": ["html2wt"],
26698 "scrubWikitext": true
26699 }
26700 !! html/parsoid
26701 <p> hi</p>
26702 <p> hello</p>
26703 !! wikitext
26704 hi
26705
26706 hello
26707 !! end
26708
26709 !! test
26710 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
26711 !! options
26712 parsoid=html2wt
26713 !! html/parsoid
26714 <p> hi</p>
26715 <p> hello</p>
26716 !! wikitext
26717 <nowiki> </nowiki>hi
26718
26719 <nowiki> </nowiki> hello
26720 !! end
26721
26722 !! test
26723 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
26724 !! options
26725 parsoid={
26726 "modes": ["html2wt"],
26727 "scrubWikitext": true
26728 }
26729 !! html/parsoid
26730 <p>Foo
26731 bar
26732 baz</p>
26733
26734 <table><tr><td>Foo
26735 bar
26736 baz bang</td></tr></table>
26737
26738 <p><!--boo--> foo
26739 bar</p>
26740
26741 <p> foo
26742 bar<span>boo</span></p>
26743 !! wikitext
26744 Foo
26745 bar
26746 baz
26747
26748 {|
26749 |Foo
26750 bar
26751 baz bang
26752 |}
26753
26754 <!--boo-->foo
26755 bar
26756
26757 foo
26758 bar<span>boo</span>
26759 !! end
26760
26761 !! test
26762 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
26763 !! options
26764 parsoid={
26765 "modes": ["selser"],
26766 "scrubWikitext": true,
26767 "changes": [
26768 [ "p", "html", " a\n b" ]
26769 ]
26770 }
26771 !! wikitext
26772 xyz
26773 !! wikitext/edited
26774 a
26775 b
26776 !! end
26777
26778 !! test
26779 1. New links that end in spaces
26780 !! options
26781 parsoid={
26782 "modes": ["html2wt"],
26783 "scrubWikitext": false
26784 }
26785 !! html/parsoid
26786 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26787 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26788 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26789 !! wikitext
26790 [[Berlin ]]<nowiki/>is the capital of Germany.
26791
26792 [[Foo ]]'''bar'''
26793
26794 [[Boston ]] is a city.
26795 !! end
26796
26797 !! test
26798 2. New links that end in spaces
26799 !! options
26800 parsoid={
26801 "modes": ["html2wt"],
26802 "scrubWikitext": true
26803 }
26804 !! html/parsoid
26805 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26806 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26807 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26808 !! wikitext
26809 [[Berlin]] is the capital of Germany.
26810
26811 [[Foo]] '''bar'''
26812
26813 [[Boston]] is a city.
26814 !! end
26815
26816 !! test
26817 1. Table cells with escapable prefixes
26818 !! options
26819 parsoid={
26820 "modes": ["html2wt"],
26821 "scrubWikitext": false
26822 }
26823 !! html
26824 <table>
26825 <tr><td>a</td></tr>
26826 <tr><td>-</td></tr>
26827 <tr><td>+</td></tr>
26828 </table>
26829 !! wikitext
26830 {|
26831 |a
26832 |-
26833 |<nowiki>-</nowiki>
26834 |-
26835 |<nowiki>+</nowiki>
26836 |}
26837 !! end
26838
26839 !! test
26840 2. Table cells with escapable prefixes
26841 !! options
26842 parsoid={
26843 "modes": ["html2wt"],
26844 "scrubWikitext": true
26845 }
26846 !! html
26847 <table>
26848 <tr><td>a</td></tr>
26849 <tr><td>-</td></tr>
26850 <tr><td>+</td></tr>
26851 </table>
26852 !! wikitext
26853 {|
26854 |a
26855 |-
26856 | -
26857 |-
26858 | +
26859 |}
26860 !! end
26861
26862 !! test
26863 3a. Table cells with escapable prefixes after edits
26864 !! options
26865 parsoid={
26866 "modes": ["selser"],
26867 "scrubWikitext": true,
26868 "changes": [
26869 [ "table tbody tr:first-child td:first-child", "remove"]
26870 ]
26871 }
26872 !! wikitext
26873 {|
26874 |a||-
26875 |}
26876 !! wikitext/edited
26877 {|
26878 | -
26879 |}
26880 !! end
26881
26882 !! test
26883 3b. Table cells with escapable prefixes after edits
26884 !! options
26885 parsoid={
26886 "modes": ["selser"],
26887 "scrubWikitext": true,
26888 "changes": [
26889 [ "table tbody tr:first-child td:first-child", "html", "-" ],
26890 [ "#x", "remove" ]
26891 ]
26892 }
26893 !! wikitext
26894 {|
26895 |pqr
26896 |<span id="x">foo</span>+
26897 |}
26898 !! wikitext/edited
26899 {|
26900 | -
26901 | +
26902 |}
26903 !! end
26904
26905 # FIXME: This test will fail because
26906 # normalization doesn't realize that the id attribute
26907 # will eliminate the escapable scenario
26908 !! test
26909 4a. Table cells without escapable prefixes after edits
26910 !! options
26911 parsoid={
26912 "modes": ["selser"],
26913 "scrubWikitext": true,
26914 "changes": [
26915 [ "#x", "html", "-" ]
26916 ]
26917 }
26918 !! wikitext
26919 {|
26920 | id="x" |abcd
26921 |}
26922 !! wikitext/edited
26923 {|
26924 | id="x" |-
26925 |}
26926 !! end
26927
26928 ## This tests normalizer's ability to discriminate between
26929 ## cells having identical content.
26930 !! test
26931 4b. Table cells without escapable prefixes after edits
26932 !! options
26933 parsoid={
26934 "modes": ["selser"],
26935 "scrubWikitext": true,
26936 "changes": [
26937 [ "td", "html", "-" ]
26938 ]
26939 }
26940 !! wikitext
26941 {|
26942 |a||b
26943 |}
26944 !! wikitext/edited
26945 {|
26946 | -||-
26947 |}
26948 !! end
26949
26950 ## This tests normalizer's ability to not be tripped by
26951 ## comments (and whitespace)
26952 !! test
26953 4c. Table cells without escapable prefixes after edits
26954 !! options
26955 parsoid={
26956 "modes": ["selser"],
26957 "scrubWikitext": true,
26958 "changes": [
26959 [ "table tbody tr td:first-child", "remove" ]
26960 ]
26961 }
26962 !! wikitext
26963 {|
26964 |-
26965 <!--foo--> |a||-
26966 |}
26967 !! wikitext/edited
26968 {|
26969 |-
26970 <!--foo--> | -
26971 |}
26972 !! end
26973
26974 ## This tests normalizer's ability to handle HTML cells
26975 !! test
26976 4d. Table cells without escapable prefixes after edits
26977 !! options
26978 parsoid={
26979 "modes": ["selser"],
26980 "scrubWikitext": true,
26981 "changes": [
26982 [ "td", "html", "-" ]
26983 ]
26984 }
26985 !! wikitext
26986 <table>
26987 <tr><td>a</td></tr>
26988 </table>
26989 !! wikitext/edited
26990 <table>
26991 <tr><td>-</td></tr>
26992 </table>
26993 !! end
26994
26995 ## T111151 Remove font elements without attributes
26996 !! test
26997 5a. font tags without attributes should be dropped in scrubWikitext mode
26998 !! options
26999 parsoid={
27000 "modes": ["html2wt"],
27001 "scrubWikitext": true
27002 }
27003 !! html
27004 <font>foo</font>
27005 <font><font>bar</font></font>
27006 <font class="x">boo</font>
27007 !! wikitext
27008 foo
27009 bar
27010 <font class="x">boo</font>
27011 !! end
27012
27013 !! test
27014 5b. font tags should not be dropped without scrubWikitext being enabled
27015 !! options
27016 parsoid={
27017 "modes": ["html2wt"],
27018 "scrubWikitext": false
27019 }
27020 !! html
27021 <font>foo</font>
27022 !! wikitext
27023 <font>foo</font>
27024 !! end
27025
27026 !! test
27027 Escape nowiki DOM elements
27028 !! options
27029 parsoid=html2wt
27030 !! html/parsoid
27031 <nowiki><i>foo</i></nowiki>
27032 !! wikitext
27033 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
27034 !! end
27035
27036 # This is meant to be an interim fix while we go about figuring out
27037 # how to not introduce these trailing <nowiki/>s in the first place.
27038 !! test
27039 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
27040 !! options
27041 parsoid=html2wt
27042 !! html/parsoid
27043 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
27044 y</p>
27045 <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>
27046 <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>
27047 !! wikitext
27048 x
27049 y
27050
27051 {{echo|
27052 1 = <nowiki/>}}
27053
27054 {{echo|
27055 1 = <nowiki/>
27056 }}
27057 !! end
27058
27059 # ---------------------------------------------------
27060 # End of tests spec'ing wikitext serialization norms |
27061 # ---------------------------------------------------
27062
27063 # T104032
27064 !! test
27065 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
27066 !! options
27067 parsoid=html2wt
27068 !! html/parsoid
27069 a<p>b</p>
27070 <b>c</b><p>d</p>
27071 <table><tr>
27072 <td>a<p>b</p></td>
27073 <td><b>c</b><p>d</p></td>
27074 </tr></table>
27075 !! wikitext
27076 a
27077
27078 b
27079
27080 '''c'''
27081
27082 d
27083 {|
27084 |a
27085 b
27086 |'''c'''
27087 d
27088 |}
27089 !! end
27090
27091 # -----------------------------------------------------------------
27092 # End of section for Parsoid-only html2wt tests for serialization
27093 # of new content
27094 # -----------------------------------------------------------------
27095
27096 # -----------------------------------------------------------------
27097 # The following section of tests are primarily to spec behavior of
27098 # the selective serializer. All these tests have manual selser
27099 # changes. The automated selser changes for all tests handle the
27100 # wide variation of changes, but these tests here capture specs
27101 # deterministically.
27102 # ----------------------------------------------------------------
27103
27104 ## T90517
27105 !! test
27106 Selser: New comments should not be lost
27107 !! options
27108 parsoid={
27109 "modes": ["selser"],
27110 "changes": [
27111 [ "#a", "after", "<!--c1-->" ],
27112 [ "#b", "before", "<!--c2-->" ]
27113 ]
27114 }
27115 !! wikitext
27116 <span id="a">a</span>
27117
27118 <span id="b">b</span>
27119 !! wikitext/edited
27120 <span id="a">a</span><!--c1-->
27121
27122 <!--c2--><span id="b">b</span>
27123 !! end
27124
27125 ## T89383
27126 !! test
27127 Selser: Check for validity of DSR before using it
27128 !! options
27129 parsoid={
27130 "modes": ["selser"],
27131 "changes": [
27132 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
27133 ]
27134 }
27135 !! wikitext
27136 <span id="a">a</span>
27137 !! wikitext/edited
27138 {{DISPLAYTITLE:foo}}
27139 <span id="a">a</span>
27140 !! end
27141
27142 !! test
27143 1. DOMDiff: Changes to <ref> content should be looked up using id
27144 !! options
27145 parsoid={
27146 "modes": ["selser"],
27147 "changes": [
27148 ["#X", "after", "bar"],
27149 ["#Y", "after", "baz"]
27150 ]
27151 }
27152 !! wikitext
27153 X <ref><span id="X">foo</span></ref>
27154 Y <ref name="a" />
27155 <references>
27156 <ref name="a"><span id="Y">foo</span></ref>
27157 </references>
27158 !! wikitext/edited
27159 X <ref><span id="X">foo</span>bar</ref>
27160 Y <ref name="a" />
27161 <references>
27162 <ref name="a"><span id="Y">foo</span>baz</ref>
27163 </references>
27164 !! end
27165
27166 !! test
27167 2. DOMDiff: Changes to <ref> content should be looked up using id
27168 !! options
27169 parsoid={
27170 "modes": ["selser"],
27171 "changes": [
27172 ["#Z", "after", "bar"]
27173 ]
27174 }
27175 !! wikitext
27176 A <ref>foo bar for a</ref>
27177 B <ref group="X" name="b" />
27178
27179 <references />
27180
27181 <references group="X">
27182 <ref name="b"><span id="Z">foo</span></ref>
27183 </references>
27184 !! wikitext/edited
27185 A <ref>foo bar for a</ref>
27186 B <ref group="X" name="b" />
27187
27188 <references />
27189
27190 <references group="X">
27191 <ref name="b"><span id="Z">foo</span>bar</ref>
27192 </references>
27193 !! end
27194
27195 !! test
27196 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
27197 !! options
27198 parsoid={
27199 "modes": ["selser"],
27200 "changes": [
27201 [ "div:first-child", "text", "bar" ]
27202 ]
27203 }
27204 !! wikitext
27205 <div style="{{1x|color:red;}}%">foo</div>
27206 !! wikitext/edited
27207 <div style="{{1x|color:red;}}%">bar</div>
27208 !! end
27209
27210 !! test
27211 Empty LI (T49673)
27212 !! wikitext
27213 * a
27214 *
27215 *
27216 * b
27217 !! html/php+tidy
27218 <ul>
27219 <li>a</li>
27220 <li class="mw-empty-elt"></li>
27221 <li class="mw-empty-elt"></li>
27222 <li>b</li>
27223 </ul>
27224 !! end
27225
27226 !! test
27227 Thumbnail output
27228 !! wikitext
27229 [[File:Thumb.png|thumb]]
27230 !! html/php+tidy
27231 <div class="thumb tright">
27232 <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>
27233 <div class="thumbcaption">
27234 <div class="magnify"><a href="/wiki/File:Thumb.png" class="internal" title="Enlarge"></a></div>
27235 </div>
27236 </div>
27237 </div>
27238 !! end
27239
27240 !! test
27241 unclosed internal link XSS (T137264)
27242 !! wikitext
27243 [[#%3Cscript%3Ealert(1)%3C/script%3E|
27244 !! html
27245 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
27246 </p>
27247 !! end