Merge "Finish stash uploads with upload dialog"
[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
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> and <pre> preference (first one wins)
2270 !! wikitext
2271 <pre>
2272 <nowiki>
2273 </pre>
2274 </nowiki>
2275 </pre>
2276
2277 <nowiki>
2278 <pre>
2279 <nowiki>
2280 </pre>
2281 </nowiki>
2282 </pre>
2283
2284 !! html/php
2285 <pre>
2286 &lt;nowiki&gt;
2287 </pre>
2288 <p>&lt;/nowiki&gt;
2289 &lt;/pre&gt;
2290 </p><p>
2291 &lt;pre&gt;
2292 &lt;nowiki&gt;
2293 &lt;/pre&gt;
2294
2295 &lt;/pre&gt;
2296 </p>
2297 !! html/parsoid
2298 <pre data-parsoid='{"stx":"html","strippedNL":true}'>&lt;nowiki>
2299 </pre>
2300 <p><span typeof="mw:Placeholder" data-parsoid='{"src":"&lt;/nowiki>"}'>&lt;/nowiki></span>
2301 &lt;/pre></p>
2302
2303 <p><span typeof="mw:Nowiki">
2304 &lt;pre>
2305 &lt;nowiki>
2306 &lt;/pre>
2307 </span>
2308 &lt;/pre></p>
2309 !! end
2310
2311 !! test
2312 </pre> inside nowiki
2313 !! wikitext
2314 <nowiki></pre></nowiki>
2315 !! html
2316 <p>&lt;/pre&gt;
2317 </p>
2318 !! end
2319
2320 # Parsoid doesn't strip empty tags, like Tidy does.
2321 !! test
2322 Empty pre; pre inside other HTML tags (bug 54946)
2323 !! options
2324 parsoid=wt2html,wt2wt
2325 !! wikitext
2326 a
2327
2328 <div><pre>
2329 foo
2330 </pre></div>
2331 <pre></pre>
2332 !! html/php
2333 <p>a
2334 </p>
2335 <div><pre>
2336 foo
2337 </pre></div>
2338 <pre></pre>
2339
2340 !! html/php+tidy
2341 <p>a</p>
2342 <div>
2343 <pre>
2344 foo
2345 </pre></div>
2346 !! html/parsoid
2347 <p>a</p>
2348
2349 <div><pre>foo
2350 </pre></div>
2351 <pre></pre>
2352 !! end
2353
2354 !! test
2355 HTML pre followed by indent-pre
2356 !! wikitext
2357 <pre>foo</pre>
2358 bar
2359 !! html
2360 <pre>foo</pre>
2361 <pre>bar
2362 </pre>
2363 !! end
2364
2365 # Note that tidy removes the empty <p> tags from the start and end.
2366 # Parsoid does not, by design.
2367 !!test
2368 Block tag pre
2369 !! wikitext
2370 <p><pre>foo</pre></p>
2371 !! html/php+tidy
2372 <pre>
2373 foo
2374 </pre>
2375 !! html/parsoid
2376 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2377 !!end
2378
2379 !!test
2380 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2381 !! wikitext
2382 {{echo|}}
2383 !! html
2384
2385 !!end
2386
2387 !!test
2388 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2389 !! wikitext
2390 {{echo|
2391 foo}}
2392 !! html
2393 <p>foo
2394 </p>
2395 !!end
2396
2397 !! test
2398 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2399 !! wikitext
2400 {{echo|a
2401 b}}
2402 !! html
2403 <pre>a
2404 </pre>
2405 <p>b
2406 </p>
2407 !!end
2408
2409 !! test
2410 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2411 !! wikitext
2412 {{echo|a
2413 b
2414 c
2415 d
2416 e
2417 }}
2418 !! html
2419 <pre>a
2420 </pre>
2421 <p>b
2422 c
2423 </p>
2424 <pre>d
2425 </pre>
2426 <p>e
2427 </p>
2428 !!end
2429
2430 !!test
2431 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2432 !! wikitext
2433 {{echo| foo}}
2434
2435 {{echo| foo}}{{echo| bar}}
2436
2437 {{echo| foo}}
2438 {{echo| bar}}
2439
2440 {{echo|<!--cmt--> foo}}
2441
2442 <!--cmt-->{{echo| foo}}
2443
2444 {{echo|{{echo| }}bar}}
2445 !! html
2446 <pre>foo
2447 </pre>
2448 <pre>foo bar
2449 </pre>
2450 <pre>foo
2451 bar
2452 </pre>
2453 <pre>foo
2454 </pre>
2455 <pre>foo
2456 </pre>
2457 <pre>bar
2458 </pre>
2459 !!end
2460
2461 !! test
2462 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2463 !! wikitext
2464 {{echo| }}a
2465
2466 {{echo|
2467 }}a
2468
2469 {{echo|
2470 b}}
2471
2472 {{echo|a
2473 }}b
2474
2475 {{echo|a
2476 }} b
2477 !! html
2478 <pre>a
2479 </pre>
2480 <p><br />
2481 </p>
2482 <pre>a
2483 </pre>
2484 <p><br />
2485 </p>
2486 <pre>b
2487 </pre>
2488 <p>a
2489 </p>
2490 <pre>b
2491 </pre>
2492 <p>a
2493 </p>
2494 <pre>b
2495 </pre>
2496 !!end
2497
2498 !! test
2499 Pres with newline attributes
2500 !! wikitext
2501 <pre class="one
2502 two">hi</pre>
2503 !! html/php
2504 <pre class="one two">hi</pre>
2505
2506 !! html/parsoid
2507 <pre class="one
2508 two" data-parsoid='{"stx":"html"}'>hi</pre>
2509 !! end
2510
2511 !! test
2512 Things that look like <pre> tags aren't treated as such
2513 !! wikitext
2514 Barack Obama <President> of the United States
2515 <President></President>
2516 !! html
2517 <p>Barack Obama &lt;President&gt; of the United States
2518 &lt;President&gt;&lt;/President&gt;
2519 </p>
2520 !! end
2521
2522 !! test
2523 Handle broken pre-like tags (bug 64025)
2524 !! options
2525 parsoid=wt2html
2526 !! wikitext
2527 {{echo|<pre <pre>x</pre>}}
2528
2529 <table><pre </table>
2530 !! html/php
2531 <pre>x</pre>
2532 <table>&lt;pre </table>
2533
2534 !! html/php+tidy
2535 <pre>
2536 x
2537 </pre>
2538 <p>&lt;pre</p>
2539 !! html/parsoid
2540 <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>
2541
2542
2543 <p>&lt;pre </p>
2544
2545 <table></table>
2546 !! end
2547
2548 !! test
2549 Parsoid: handle pre with space after attribute
2550 !! options
2551 parsoid=wt2html
2552 !! wikitext
2553 <pre style="width:50%;" >{{echo|foo}}</pre>
2554 !! html/php
2555 <pre style="width:50%;">{{echo|foo}}</pre>
2556
2557 !! html/parsoid
2558 <pre style="width:50%;">{{echo|foo}}</pre>
2559 !! end
2560
2561 # TODO / maybe: fix wt2wt for this
2562 !! test
2563 Parsoid: Don't paragraph-wrap fosterable content
2564 !! options
2565 parsoid=wt2html
2566 !! wikitext
2567 {|
2568 <td></td>
2569 <td></td>
2570
2571
2572
2573 |}
2574 !! html
2575 <table>
2576
2577 <tbody>
2578 <tr>
2579 <td></td>
2580
2581 <td></td></tr>
2582
2583
2584
2585 </tbody></table>
2586 !! end
2587
2588 !! test
2589 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2590 !! options
2591 parsoid=wt2html
2592 !! wikitext
2593 {|
2594 <td>
2595 <td>
2596 </td>
2597
2598
2599
2600 |}
2601 !! html
2602 <table>
2603
2604 <tbody>
2605 <tr>
2606 <td></td>
2607
2608 <td>
2609 </td></tr>
2610
2611
2612
2613 </tbody></table>
2614 !! end
2615
2616
2617 #--------------------------------------------------------------------
2618 # Transclusion parameter whitespace stripping tests
2619 # Behavior is different for positional and named parameters
2620 #--------------------------------------------------------------------
2621 !! test
2622 Templates: Strip leading and trailing whitespace from named-param values
2623 !! wikitext
2624 {{echo|1= a }}
2625
2626 {{echo|1= {{echo|b}} }}
2627
2628 {{echo| 1 =
2629 c }}
2630
2631 {{echo| 1 =
2632 * d
2633 }}
2634 !! html
2635 <p>a
2636 </p><p>b
2637 </p><p>c
2638 </p>
2639 <ul><li> d</li></ul>
2640
2641 !! end
2642
2643 !! test
2644 Templates: Don't strip whitespace from positional-param values
2645 !! wikitext
2646 {{echo|a }}
2647
2648 {{echo|{{echo|b}} }}
2649
2650 {{echo| c
2651 }}
2652
2653 {{echo| {{echo|d}}
2654 }}
2655
2656 {{echo|
2657 e}}
2658
2659 {{echo|
2660 * f}}
2661
2662 {{echo|
2663 }}g
2664 !! html
2665 <p>a
2666 </p><p>b
2667 </p>
2668 <pre>c
2669 </pre>
2670 <p><br />
2671 </p>
2672 <pre>d
2673 </pre>
2674 <p><br />
2675 </p>
2676 <pre>e
2677 </pre>
2678 <p><br />
2679 </p>
2680 <ul><li> f</li></ul>
2681 <p><br />
2682 </p>
2683 <pre>g
2684 </pre>
2685 !! end
2686
2687 !! test
2688 Templates: Handle empty comment-and-ws-only lines correctly
2689 !! wikitext
2690 {{echo|foo
2691 <!--should be ignored-->
2692 <!--should be ignored as well-->
2693 bar}}
2694 !! html
2695 <p>foo
2696 bar
2697 </p>
2698 !! end
2699
2700 !! test
2701 Templates: Handle comments in the target
2702 !! wikitext
2703 {{echo
2704 <!-- should be ignored -->
2705 |foo}}
2706
2707 {{echo<!-- should be ignored -->
2708 |foo}}
2709
2710 {{echo<!-- should be ignored -->|foo}}
2711
2712 {{<!-- should be ignored -->echo|foo}}
2713 !!html/parsoid
2714 <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>
2715
2716 <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>
2717
2718 <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>
2719
2720 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2721 !!end
2722
2723 !! test
2724 Templates: Handle comments in parameter names (bug 67657)
2725 !! wikitext
2726 {{echo|1
2727 <!-- should be ignored -->
2728 =foo}}
2729
2730 {{echo|
2731 <!-- should be ignored -->
2732 1 = foo}}
2733
2734 {{echo|1<!-- should be ignored -->=foo}}
2735
2736 {{echo|<!-- should be ignored -->1=foo}}
2737 !!html/parsoid
2738 <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>
2739
2740 <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>
2741
2742 <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>
2743
2744 <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>
2745 !!end
2746
2747 !! test
2748 Templates: Other wikitext in parameter names (bug 67657)
2749 !! wikitext
2750 {{echo|''1''=foo}}
2751 !!html/parsoid
2752 <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>
2753 !!html/php
2754 <p>{{{1}}}
2755 </p>
2756 !!end
2757
2758 #--------------------------------------------------------------------
2759 # Transclusion parameter escaping tests
2760 #--------------------------------------------------------------------
2761 !! test
2762 Templates: Parsoid parameter escaping test 1
2763 !! wikitext
2764 {{echo|[foo]|{{echo|[bar]}}}}
2765 !! html/php+tidy
2766 <p>[foo]</p>
2767 !! html/parsoid
2768 <p about="#mwt1" typeof="mw:Transclusion"
2769 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2770 !! end
2771
2772 !! test
2773 Parsoid: Pipes in external links in template parameter
2774 !! wikitext
2775 {{echo|[{{echo|http://example.com}} link]}}
2776 !! html/php+tidy
2777 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2778 !! html/parsoid
2779 <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>
2780 !! end
2781
2782 !! test
2783 Parsoid: pipe in transclusion parameter
2784 !! wikitext
2785 {{echo|http://foo.com/a&#124;b}}
2786 !! html/php+tidy
2787 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2788 !! html/parsoid
2789 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2790 typeof="mw:Transclusion"
2791 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>
2792 !! end
2793
2794 !! test
2795 Parsoid: Pipe in external link target and content in template parameter
2796 !! options
2797 parsoid=html2wt,wt2wt
2798 !! wikitext
2799 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2800 !! html/php+tidy
2801 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2802 !! html/parsoid
2803 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2804 typeof="mw:Transclusion"
2805 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2806 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2807 !! end
2808
2809 !! test
2810 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2811 !! options
2812 parsoid
2813 !! wikitext
2814 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2815 !! html
2816 <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>
2817 !! end
2818
2819 !! test
2820 Templates: Don't escape already nowiki-escaped text in template parameters
2821 !! options
2822 parsoid=html2wt,wt2wt
2823 !! wikitext
2824 {{echo|foo<nowiki>|</nowiki>bar}}
2825 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2826 {{echo|<nowiki></nowiki>}}
2827 !! html/php+tidy
2828 <p>foo|bar &lt;div&gt;</p>
2829 !! html/parsoid
2830 <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>
2831 <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>
2832 <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>
2833 </p>
2834 !! end
2835
2836 ## Bug 52824
2837 !! test
2838 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2839 !! options
2840 parsoid=html2wt,wt2wt
2841 !! wikitext
2842 {{echo|{{echo|1=bar}}}}
2843 !! html/php+tidy
2844 <p>bar</p>
2845 !! html/parsoid
2846 <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>
2847 !! end
2848
2849 ## Bug 56733
2850 !! test
2851 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2852 !! wikitext
2853 {{echo|a : b}}
2854 !! html/php+tidy
2855 <p>a&#160;: b</p>
2856 !! html/parsoid
2857 <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>
2858 !! end
2859
2860 ## Bug T73412
2861 !! test
2862 Templates: Preserve blank parameter names
2863 !! wikitext
2864 {{echo|=foo}}
2865 !! html/php+tidy
2866 <p>{{{1}}}</p>
2867 !! html/parsoid
2868 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2869 !! end
2870
2871 !! test
2872 Templates: Preserve blank parameter names in other positions
2873 !! wikitext
2874 {{blank_param|bar|=foo}}
2875 !! html/php+tidy
2876 <p>bar foo</p>
2877 !! html/parsoid
2878 <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
2879 foo</p>
2880 !! end
2881
2882 ###
2883 ### Parsoid-centric tests for testing RT edge cases for pre
2884 ###
2885
2886 !!test
2887 1a. Indent-Pre and Comments
2888 !! wikitext
2889 a
2890 <!--a-->
2891 c
2892 !! html
2893 <pre>a
2894 </pre>
2895 <p>c
2896 </p>
2897 !!end
2898
2899 !!test
2900 1b. Indent-Pre and Comments
2901 !! wikitext
2902 a
2903 <!--a-->
2904 c
2905 !! html
2906 <pre>a
2907 </pre>
2908 <p>c
2909 </p>
2910 !!end
2911
2912 !!test
2913 1c. Indent-Pre and Comments
2914 !! wikitext
2915 <!--a--> a
2916
2917 <!--a--> a
2918 !! html
2919 <pre> a
2920 </pre>
2921 <pre> a
2922 </pre>
2923 !!end
2924
2925 !!test
2926 1d. Indent-Pre and Comments
2927 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2928 !! wikitext
2929 <!--a--> a
2930
2931 <!--b-->b
2932 !! html
2933 <pre>a
2934 </pre>
2935 <pre>b
2936 </pre>
2937 !!end
2938
2939 !!test
2940 2a. Indent-Pre and tables
2941 !! wikitext
2942 {|
2943 |-
2944 !h1!!h2
2945 |foo||bar
2946 |}
2947 !! html
2948 <table>
2949
2950 <tr>
2951 <th>h1</th>
2952 <th>h2
2953 </th>
2954 <td>foo</td>
2955 <td>bar
2956 </td></tr></table>
2957
2958 !!end
2959
2960 !!test
2961 2b. Indent-Pre and tables
2962 !! wikitext
2963 {|
2964 |-
2965 |foo
2966 |}
2967 !! html
2968 <table>
2969
2970 <tr>
2971 <td>foo
2972 </td></tr></table>
2973
2974 !!end
2975
2976 !!test
2977 2c. Indent-Pre and tables (bug 42252)
2978 !! wikitext
2979 {|
2980 |+ foo
2981 ! | bar
2982 |}
2983 !! html
2984 <table>
2985 <caption> foo
2986 </caption>
2987 <tr>
2988 <th> bar
2989 </th></tr></table>
2990
2991 !!end
2992
2993 !!test
2994 2d. Indent-Pre and tables
2995 !! wikitext
2996 a
2997 {|
2998 | b
2999 |}
3000 !! html/php
3001 <pre>a
3002 </pre>
3003 <table>
3004 <tr>
3005 <td> b
3006 </td></tr></table>
3007
3008 !! html/parsoid
3009 <pre>a</pre>
3010 <table>
3011 <tbody><tr><td> b</td></tr>
3012 </tbody></table>
3013 !!end
3014
3015 !!test
3016 2e. Indent-Pre and table-line syntax
3017 !! wikitext
3018 a
3019 | b
3020 | c
3021 !! html/php
3022 <pre>a
3023 | b
3024 | c
3025 </pre>
3026 !!end
3027
3028 !!test
3029 2f. Indent-pre started by table-line syntax
3030 !! wikitext
3031 a
3032 | b
3033 | c
3034 !! html/php
3035 <p>a
3036 </p>
3037 <pre>| b
3038 | c
3039 </pre>
3040 !! html/parsoid
3041 <p>a</p>
3042 <pre>
3043 | b
3044 | c</pre>
3045 !!end
3046
3047 !!test
3048 3a. Indent-Pre and block tags (single-line html)
3049 !! wikitext
3050 a <p> foo </p>
3051 b <div> foo </div>
3052 c <blockquote> foo </blockquote>
3053 <span> foo </span>
3054 !! html
3055 a <p> foo </p>
3056 b <div> foo </div>
3057 c <blockquote> foo </blockquote>
3058 <pre><span> foo </span>
3059 </pre>
3060 !! html/parsoid
3061 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3062 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3063 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3064 <pre><span> foo </span>
3065 </pre>
3066 !! html+tidy
3067 <p>a</p>
3068 <p>foo</p>
3069 <p>b</p>
3070 <div>foo</div>
3071 <p>c</p>
3072 <blockquote>
3073 <p>foo</p>
3074 </blockquote>
3075 <pre>
3076 <span> foo </span>
3077 </pre>
3078 !! end
3079
3080 !!test
3081 3b. Indent-Pre and block tags (multi-line html)
3082 !! wikitext
3083 a <span>foo</span>
3084 b <div> foo </div>
3085 !! html
3086 <pre>a <span>foo</span>
3087 </pre>
3088 b <div> foo </div>
3089
3090 !! html/parsoid
3091 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3092 b <div data-parsoid='{"stx":"html"}'> foo </div>
3093 !! html+tidy
3094 <pre>
3095 a <span>foo</span>
3096 </pre>
3097 <p>b</p>
3098 <div>foo</div>
3099 !!end
3100
3101 !!test
3102 3c. Indent-Pre and block tags (pre-content on separate line)
3103 !! wikitext
3104 <p>
3105 foo
3106 </p>
3107
3108 <div>
3109 foo
3110 </div>
3111
3112 <center>
3113 foo
3114 </center>
3115
3116 <blockquote>
3117 foo
3118 </blockquote>
3119
3120 <blockquote>
3121 <pre>
3122 foo
3123 </pre>
3124 </blockquote>
3125
3126 <table><tr><td>
3127 foo
3128 </td></tr></table>
3129
3130 <ul><li>
3131 foo
3132 </li></ul>
3133
3134 !! html
3135 <p>
3136 foo
3137 </p>
3138 <div>
3139 <pre>foo
3140 </pre>
3141 </div>
3142 <center>
3143 <pre>foo
3144 </pre>
3145 </center>
3146 <blockquote>
3147 <p> foo
3148 </p>
3149 </blockquote>
3150 <blockquote>
3151 <pre>
3152 foo
3153 </pre>
3154 </blockquote>
3155 <table><tr><td>
3156 <pre>foo
3157 </pre>
3158 </td></tr></table>
3159 <ul><li>
3160 foo
3161 </li></ul>
3162
3163 !!end
3164
3165 !!test
3166 4. Indent-Pre and extension tags
3167 !! wikitext
3168 a <gallery>
3169 File:foobar.jpg
3170 </gallery>
3171 !! html
3172 a <ul class="gallery mw-gallery-traditional">
3173 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
3174 <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>
3175 <div class="gallerytext">
3176 </div>
3177 </div></li>
3178 </ul>
3179
3180 !! html+tidy
3181 <p>a</p>
3182 <ul class="gallery mw-gallery-traditional">
3183 <li class="gallerybox" style="width: 155px">
3184 <div style="width: 155px">
3185 <div class="thumb" style="width: 150px;">
3186 <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>
3187 </div>
3188 <div class="gallerytext"></div>
3189 </div>
3190 </li>
3191 </ul>
3192 !!end
3193
3194 !! test
3195 Table wikitext syntax outside wiki-tables
3196 !! wikitext
3197 a
3198 ! not a table heading
3199 |- not a table row
3200 | not a table cell
3201 | class="foo bar" | baz
3202 b
3203 |}
3204 |-
3205 c
3206 !! html
3207 <p>a
3208 ! not a table heading
3209 |- not a table row
3210 | not a table cell
3211 | class="foo bar" | baz
3212 b
3213 |}
3214 |-
3215 c
3216 </p>
3217 !! end
3218
3219 !!test
3220 Render paragraphs when indent-pre is suppressed in blocklevels
3221 !! wikitext
3222 <blockquote>
3223 foo
3224
3225 bar
3226 </blockquote>
3227 !! html
3228 <blockquote>
3229 <p> foo
3230 </p><p> bar
3231 </p>
3232 </blockquote>
3233
3234 !!end
3235
3236 !!test
3237 4. Multiple spaces at start-of-line
3238 !! wikitext
3239 <p> foo </p>
3240 foo
3241 {|
3242 |foo
3243 |}
3244 !! html
3245 <p> foo </p>
3246 <pre> foo
3247 </pre>
3248 <table>
3249 <tr>
3250 <td>foo
3251 </td></tr></table>
3252
3253 !!end
3254
3255 ## NOTE: the leading white-space chars on empty line are significant
3256 !! test
3257 5a. White-space in indent-pre
3258 !! wikitext
3259 a<br />
3260
3261 b
3262 !! html
3263 <pre>a<br />
3264
3265 b
3266 </pre>
3267 !! end
3268
3269 ## NOTE: the leading white-space chars on empty line are significant
3270 !! test
3271 5b. White-space in indent-pre
3272 !! wikitext
3273 a
3274
3275 b
3276
3277
3278 c
3279 !! html
3280 <pre>a
3281
3282 b
3283
3284
3285 c
3286 </pre>
3287 !! end
3288
3289 !! test
3290 5c. White-space in indent-pre
3291 !! wikitext
3292 ''a''
3293 ''b''
3294 ''c''
3295 !! html
3296 <pre><i>a</i>
3297 <i>b</i>
3298 <i>c</i>
3299 </pre>
3300 !! end
3301
3302 !! test
3303 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3304 !! wikitext
3305 a
3306
3307 <!-- continue -->
3308 b
3309
3310 c
3311
3312 d
3313 !! html
3314 <pre>a
3315
3316 b
3317 </pre>
3318 <pre>c
3319
3320 </pre>
3321 <p>d
3322 </p>
3323 !! end
3324
3325 !! test
3326 7a. Indent-pre and category links
3327 !! options
3328 parsoid=wt2html,wt2wt
3329 !! wikitext
3330 [[Category:foo]] <!-- No pre-wrapping -->
3331 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3332 !! html/php+tidy
3333 !! html/parsoid
3334 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3335 <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 -->
3336 !! end
3337
3338 ## We used to, but no longer wt2wt this test since the default serializer
3339 ## will normalize all categories to serialize on their own line.
3340 ## This wikitext usage is going to be fairly uncommon in production and
3341 ## selser will take care of preserving formatting in those scenarios.
3342 !! test
3343 7b. Indent-pre and category links
3344 !! options
3345 parsoid=wt2html
3346 !! wikitext
3347 [[Category:foo]] a
3348 [[Category:foo]] {{echo|b}}
3349 !! html/parsoid
3350 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3351 <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>
3352 !! end
3353
3354 !! test
3355 Indent-Pre: Newlines in comments shouldn't affect sol state
3356 !! wikitext
3357 a <!--
3358 foo
3359 --> b
3360 !! html/php+tidy
3361 <p>a b</p>
3362 !! html/parsoid
3363 <p>a <!--
3364 foo
3365 --> b</p>
3366 !! end
3367
3368 ###
3369 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3370 ###
3371
3372 !!test
3373 HTML-pre: 1. embedded newlines
3374 !! wikitext
3375 <pre>foo</pre>
3376
3377 <pre>
3378 foo
3379 </pre>
3380
3381 <pre>
3382
3383 foo
3384 </pre>
3385
3386 <pre>
3387
3388
3389 foo
3390 </pre>
3391 !! html/php+tidy
3392 <pre>
3393 foo
3394 </pre>
3395 <pre>
3396 foo
3397 </pre>
3398 <pre>
3399
3400 foo
3401 </pre>
3402 <pre>
3403
3404
3405 foo
3406 </pre>
3407 !! html/parsoid
3408 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3409
3410 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3411 foo
3412 </pre>
3413
3414 <pre data-parsoid='{"stx":"html"}'>
3415
3416 foo
3417 </pre>
3418
3419 <pre data-parsoid='{"stx":"html"}'>
3420
3421
3422 foo
3423 </pre>
3424 !!end
3425
3426 !! test
3427 HTML-pre: big spaces
3428 !! wikitext
3429 <pre>
3430
3431
3432
3433
3434 haha
3435
3436
3437
3438
3439 haha
3440
3441
3442
3443
3444 </pre>
3445 !! html/php+tidy
3446 <pre>
3447
3448
3449
3450
3451 haha
3452
3453
3454
3455
3456 haha
3457
3458
3459
3460
3461 </pre>
3462 !! html/parsoid
3463 <pre data-parsoid='{"stx":"html"}'>
3464
3465
3466
3467
3468 haha
3469
3470
3471
3472
3473 haha
3474
3475
3476
3477
3478 </pre>
3479 !! end
3480
3481 !!test
3482 HTML-pre: 2: indented text
3483 !! wikitext
3484 <pre>
3485 foo
3486 </pre>
3487 !! html
3488 <pre>
3489 foo
3490 </pre>
3491
3492 !!end
3493
3494 !!test
3495 HTML-pre: 3: other wikitext
3496 !! wikitext
3497 <pre>
3498 * foo
3499 # bar
3500 = no-h =
3501 '' no-italic ''
3502 [[ NoLink ]]
3503 </pre>
3504 !! html/php
3505 <pre>
3506 * foo
3507 # bar
3508 = no-h =
3509 '' no-italic ''
3510 [[ NoLink ]]
3511 </pre>
3512
3513 !! html/parsoid
3514 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3515 # bar
3516 = no-h =
3517 '' no-italic ''
3518 [[ NoLink ]]
3519 </pre>
3520 !!end
3521
3522 ###
3523 ### Definition lists
3524 ###
3525 !! test
3526 Simple definition
3527 !! wikitext
3528 ; name : Definition
3529 !! html
3530 <dl><dt> name&#160;</dt>
3531 <dd> Definition</dd></dl>
3532
3533 !! end
3534
3535 !! test
3536 Definition list for indentation only
3537 !! wikitext
3538 : Indented text
3539 !! html
3540 <dl><dd> Indented text</dd></dl>
3541
3542 !! end
3543
3544 !! test
3545 Definition list with no space
3546 !! wikitext
3547 ;name:Definition
3548 !! html
3549 <dl><dt>name</dt>
3550 <dd>Definition</dd></dl>
3551
3552 !!end
3553
3554 !! test
3555 Definition list with URL link
3556 !! wikitext
3557 ; http://example.com/ : definition
3558 !! html
3559 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3560 <dd> definition</dd></dl>
3561
3562 !! end
3563
3564 !! test
3565 Definition list with bracketed URL link
3566 !! wikitext
3567 ;[http://www.example.com/ Example]:Something about it
3568 !! html
3569 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3570 <dd>Something about it</dd></dl>
3571
3572 !! end
3573
3574 !! test
3575 Definition list with wikilink containing colon
3576 !! wikitext
3577 ; [[Help:FAQ]]: The least-read page on Wikipedia
3578 !! html
3579 <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>
3580 <dd> The least-read page on Wikipedia</dd></dl>
3581
3582 !! end
3583
3584 # At Brion's and JeLuF's insistence... :)
3585 !! test
3586 Definition list with news link containing colon
3587 !! wikitext
3588 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3589 !! html/php
3590 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3591 <dd> This isn't even a real newsgroup!</dd></dl>
3592
3593 !! html/parsoid
3594 <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>
3595 !! end
3596
3597 !! test
3598 Malformed definition list with colon
3599 !! wikitext
3600 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3601 !! html
3602 <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>
3603
3604 !! end
3605
3606 !! test
3607 Definition lists: colon in external link text
3608 !! wikitext
3609 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3610 !! html
3611 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3612 <dd> OK, I made that up</dd></dl>
3613
3614 !! end
3615
3616 !! test
3617 Definition lists: colon in HTML attribute
3618 !! wikitext
3619 ;<b style="display: inline">bold</b>
3620 !! html
3621 <dl><dt><b style="display: inline">bold</b></dt></dl>
3622
3623 !! end
3624
3625 !! test
3626 Definition lists: self-closed tag
3627 !! wikitext
3628 ;one<br/>two : two-line fun
3629 !! html
3630 <dl><dt>one<br />two&#160;</dt>
3631 <dd> two-line fun</dd></dl>
3632
3633 !! end
3634
3635 !! test
3636 Bug 11748: Literal closing tags
3637 !! wikitext
3638 <dl>
3639 <dt>test 1</dt>
3640 <dd>test test test test test</dd>
3641 <dt>test 2</dt>
3642 <dd>test test test test test</dd>
3643 </dl>
3644 !! html
3645 <dl>
3646 <dt>test 1</dt>
3647 <dd>test test test test test</dd>
3648 <dt>test 2</dt>
3649 <dd>test test test test test</dd>
3650 </dl>
3651
3652 !! end
3653
3654 !! test
3655 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3656 !! wikitext
3657 <ul><li>
3658 ; term : description
3659 * unordered
3660 </li></ul>
3661 !! html
3662 <ul><li>
3663 <dl><dt> term&#160;</dt>
3664 <dd> description</dd></dl>
3665 <ul><li> unordered</li></ul>
3666 </li></ul>
3667
3668 !! end
3669
3670 !! test
3671
3672 Definition list with empty definition and following paragraph
3673 !! wikitext
3674 ; term:
3675 Paragraph text
3676 !! html
3677 <dl><dt> term</dt>
3678 <dd></dd></dl>
3679 <p>Paragraph text
3680 </p>
3681 !! end
3682
3683 !! test
3684 Nested definition lists using html syntax
3685 !! wikitext
3686 <dl><dt>x</dt>
3687 <dd>a</dd>
3688 <dd>b</dd></dl>
3689
3690 !! end
3691
3692 !! test
3693 Definition Lists: No nesting: Multiple dd's
3694 !! wikitext
3695 ;x
3696 :a
3697 :b
3698 !! html
3699 <dl><dt>x</dt>
3700 <dd>a</dd>
3701 <dd>b</dd></dl>
3702
3703 !! end
3704
3705 !! test
3706 Definition Lists: Indentation: Regular
3707 !! wikitext
3708 :i1
3709 ::i2
3710 :::i3
3711 !! html
3712 <dl><dd>i1
3713 <dl><dd>i2
3714 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3715
3716 !! end
3717
3718 !! test
3719 Definition Lists: Indentation: Missing 1st level
3720 !! wikitext
3721 ::i2
3722 :::i3
3723 !! html
3724 <dl><dd><dl><dd>i2
3725 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3726
3727 !! end
3728
3729 !! test
3730 Definition Lists: Indentation: Multi-level indent
3731 !! wikitext
3732 :::i3
3733 !! html
3734 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3735
3736 !! end
3737
3738 !! test
3739 Definition Lists: Hacky use to indent tables
3740 !! wikitext
3741 ::{|
3742 |foo
3743 |bar
3744 |}
3745 this text
3746 should be left alone
3747 !! html
3748 <dl><dd><dl><dd><table>
3749 <tr>
3750 <td>foo
3751 </td>
3752 <td>bar
3753 </td></tr></table></dd></dl></dd></dl>
3754 <p>this text
3755 should be left alone
3756 </p>
3757 !! end
3758
3759 !! test
3760 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3761 !! wikitext
3762 <!-- foo -->
3763 ::{|
3764 |foo
3765 |bar
3766 |}<!-- bar -->
3767 this text
3768 should be left alone
3769 !! html/parsoid
3770 <!-- foo -->
3771 <dl><dd><dl><dd><table><tr>
3772 <td>foo</td>
3773 <td>bar</td>
3774 </tr></table><!-- bar --></dd></dl></dd></dl>
3775 <p>this text
3776 should be left alone</p>
3777 !! end
3778
3779 !! test
3780 Definition Lists: Hacky use to indent tables, with comment before table
3781 !! wikitext
3782 ::<!-- foo -->{|
3783 |foo
3784 |}
3785 !! html/parsoid
3786 <dl><dd><dl><dd><!-- foo --><table><tr>
3787 <td>foo</td>
3788 </tr></table></dd></dl></dd></dl>
3789 !! end
3790
3791 # The trailing whitespace in this test is to catch a regression in
3792 # Parsoid after T54473.
3793 !! test
3794 Definition Lists: Hacky use to indent tables (WS-insensitive)
3795 !! wikitext
3796 : {|
3797 |a
3798 |}
3799 !! html/php
3800 <dl><dd><table>
3801 <tr>
3802 <td>a
3803 </td></tr></table></dd></dl>
3804
3805 !! html/parsoid
3806 <dl><dd> <table>
3807 <tbody><tr><td>a</td></tr>
3808 </tbody></table> </dd></dl>
3809 !! end
3810
3811 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3812 ## as an empty dt item. It also ignores all but the last ";" when followed
3813 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3814 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3815 ## ";"s.
3816 ##
3817 ## Ex: ";;t2 ::d2" is transformed into:
3818 ##
3819 ## <dl>
3820 ## <dt>t2 </dt>
3821 ## <dd>
3822 ## <dl>
3823 ## <dt></dt>
3824 ## <dd>d2</dd>
3825 ## </dl>
3826 ## </dd>
3827 ## </dl>
3828 ##
3829 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3830 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3831 ##
3832 ## <dl>
3833 ## <dt>
3834 ## <dl>
3835 ## <dt>t2 </dt>
3836 ## <dd>:d2</dd>
3837 ## </dl>
3838 ## </dt>
3839 ## </dl>
3840 ##
3841 ## All Parsoid only definition list tests have this difference.
3842 ##
3843 ## See also: https://phabricator.wikimedia.org/T8569
3844 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3845
3846 !! test
3847 Table / list interaction: indented table with lists in table contents
3848 !! wikitext
3849 :{|
3850 |-
3851 | a
3852 * b
3853 |-
3854 | c
3855 * d
3856 |}
3857 !! html
3858 <dl><dd><table>
3859
3860 <tr>
3861 <td> a
3862 <ul><li> b</li></ul>
3863 </td></tr>
3864 <tr>
3865 <td> c
3866 <ul><li> d</li></ul>
3867 </td></tr></table></dd></dl>
3868
3869 !! end
3870
3871 !!test
3872 Table / list interaction: lists nested in tables nested in indented lists
3873 !! wikitext
3874 :{|
3875 |
3876 :a
3877 :b
3878 |
3879 *c
3880 *d
3881 |}
3882
3883 *e
3884 *f
3885 !! html
3886 <dl><dd><table>
3887 <tr>
3888 <td>
3889 <dl><dd>a</dd>
3890 <dd>b</dd></dl>
3891 </td>
3892 <td>
3893 <ul><li>c</li>
3894 <li>d</li></ul>
3895 </td></tr></table></dd></dl>
3896 <ul><li>e</li>
3897 <li>f</li></ul>
3898
3899 !!end
3900
3901 !! test
3902 Definition Lists: Nesting: Multi-level (Parsoid only)
3903 !! options
3904 parsoid
3905 !! wikitext
3906 ;t1 :d1
3907 ;;t2 ::d2
3908 ;;;t3 :::d3
3909 !! html
3910 <dl>
3911 <dt>t1 </dt>
3912 <dd>d1</dd>
3913 <dt>
3914 <dl>
3915 <dt>t2 </dt>
3916 <dd>:d2</dd>
3917 <dt>
3918 <dl>
3919 <dt>t3 </dt>
3920 <dd>::d3</dd>
3921 </dl>
3922 </dt>
3923 </dl>
3924 </dt>
3925 </dl>
3926
3927
3928 !! end
3929
3930
3931 !! test
3932 Definition Lists: Nesting: Test 2 (Parsoid only)
3933 !! wikitext
3934 ;t1
3935 ::d2
3936 !! html/php+tidy
3937 <dl>
3938 <dt>t1</dt>
3939 <dd>
3940 <dl>
3941 <dd>d2</dd>
3942 </dl>
3943 </dd>
3944 </dl>
3945 !! html/parsoid
3946 <dl>
3947 <dt>t1</dt>
3948 <dd>
3949 <dl>
3950 <dd>d2</dd>
3951 </dl>
3952 </dd>
3953 </dl>
3954
3955 !! end
3956
3957
3958 !! test
3959 Definition Lists: Nesting: Test 3 (Parsoid only)
3960 !! wikitext
3961 :;t1
3962 ::::d2
3963 !! html/php+tidy
3964 <dl>
3965 <dd>
3966 <dl>
3967 <dt>t1</dt>
3968 <dd>
3969 <dl>
3970 <dd>
3971 <dl>
3972 <dd>d2</dd>
3973 </dl>
3974 </dd>
3975 </dl>
3976 </dd>
3977 </dl>
3978 </dd>
3979 </dl>
3980 !! html/parsoid
3981 <dl>
3982 <dd>
3983 <dl>
3984 <dt>t1</dt>
3985 <dd>
3986 <dl>
3987 <dd>
3988 <dl>
3989 <dd>d2</dd>
3990 </dl>
3991 </dd>
3992 </dl>
3993 </dd>
3994 </dl>
3995 </dd>
3996 </dl>
3997
3998 !! end
3999
4000
4001 !! test
4002 Definition Lists: Nesting: Test 4
4003 !! wikitext
4004 ::;t3
4005 :::d3
4006 !! html
4007 <dl><dd><dl><dd><dl><dt>t3</dt>
4008 <dd>d3</dd></dl></dd></dl></dd></dl>
4009
4010 !! end
4011
4012
4013 ## The Parsoid team believes the following three test exposes a
4014 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4015 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4016 ## It also exposes a "misfeature" in tidy, which doesn't like
4017 ## <dl> tags with a single <dt> child; it converts the <dt> into
4018 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4019 !! test
4020 Definition Lists: Mixed Lists: Test 1
4021 !! wikitext
4022 :;* foo
4023 ::* bar
4024 :; baz
4025 !! html/php
4026 <dl><dd><dl><dt><ul><li> foo</li>
4027 <li> bar</li></ul></dt></dl>
4028 <dl><dt> baz</dt></dl></dd></dl>
4029
4030 !! html/php+tidy
4031 <dl>
4032 <dd>
4033 <dl>
4034 <dd>
4035 <ul>
4036 <li>foo</li>
4037 <li>bar</li>
4038 </ul>
4039 </dd>
4040 </dl>
4041 <dl>
4042 <dt>baz</dt>
4043 </dl>
4044 </dd>
4045 </dl>
4046 !! html/parsoid
4047 <dl>
4048 <dd><dl>
4049 <dt><ul>
4050 <li> foo
4051 </li>
4052 </ul></dt>
4053 <dd><ul>
4054 <li> bar
4055 </li>
4056 </ul></dd>
4057 <dt> baz</dt>
4058 </dl></dd>
4059 </dl>
4060 !! end
4061
4062 !! test
4063 Definition Lists: Mixed Lists: Test 2
4064 !! wikitext
4065 *: d1
4066 *: d2
4067 !! html
4068 <ul><li><dl><dd> d1</dd>
4069 <dd> d2</dd></dl></li></ul>
4070
4071 !! end
4072
4073
4074 !! test
4075 Definition Lists: Mixed Lists: Test 3
4076 !! wikitext
4077 *::: d1
4078 *::: d2
4079 !! html
4080 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4081 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4082
4083 !! end
4084
4085
4086 !! test
4087 Definition Lists: Mixed Lists: Test 4
4088 !! wikitext
4089 *;d1 :d2
4090 *;d3 :d4
4091 !! html
4092 <ul><li><dl><dt>d1&#160;</dt>
4093 <dd>d2</dd>
4094 <dt>d3&#160;</dt>
4095 <dd>d4</dd></dl></li></ul>
4096
4097 !! end
4098
4099
4100 !! test
4101 Definition Lists: Mixed Lists: Test 5
4102 !! wikitext
4103 *:d1
4104 *:: d2
4105 !! html
4106 <ul><li><dl><dd>d1
4107 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4108
4109 !! end
4110
4111
4112 !! test
4113 Definition Lists: Mixed Lists: Test 6
4114 !! wikitext
4115 #*:d1
4116 #*::: d3
4117 !! html
4118 <ol><li><ul><li><dl><dd>d1
4119 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4120
4121 !! end
4122
4123
4124 !! test
4125 Definition Lists: Mixed Lists: Test 7
4126 !! wikitext
4127 :* d1
4128 :* d2
4129 !! html
4130 <dl><dd><ul><li> d1</li>
4131 <li> d2</li></ul></dd></dl>
4132
4133 !! end
4134
4135
4136 !! test
4137 Definition Lists: Mixed Lists: Test 8
4138 !! wikitext
4139 :* d1
4140 ::* d2
4141 !! html
4142 <dl><dd><ul><li> d1</li></ul>
4143 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4144
4145 !! end
4146
4147
4148 !! test
4149 Definition Lists: Mixed Lists: Test 9
4150 !! wikitext
4151 *;foo :bar
4152 !! html
4153 <ul><li><dl><dt>foo&#160;</dt>
4154 <dd>bar</dd></dl></li></ul>
4155
4156 !! end
4157
4158
4159 !! test
4160 Definition Lists: Mixed Lists: Test 10
4161 !! wikitext
4162 *#;foo :bar
4163 !! html
4164 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4165 <dd>bar</dd></dl></li></ol></li></ul>
4166
4167 !! end
4168
4169 # The Parsoid team disagrees with the PHP parser's seemingly-random
4170 # rules regarding dd/dt on the next two tests. Parsoid is more
4171 # consistent, and recognizes the shared nesting and keeps the
4172 # still-open tags around until the nesting is complete.
4173 # (And tidy again converts <dt> to <dd> before 'bar'.)
4174
4175 !! test
4176 Definition Lists: Mixed Lists: Test 11
4177 !! wikitext
4178 *#*#;*;;foo :bar
4179 *#*#;boo :baz
4180 !! html/php
4181 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4182 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4183 <dl><dt>boo&#160;</dt>
4184 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4185
4186 !! html/php+tidy
4187 <ul>
4188 <li>
4189 <ol>
4190 <li>
4191 <ul>
4192 <li>
4193 <ol>
4194 <li>
4195 <dl>
4196 <dt>foo&#160;</dt>
4197 <dd>
4198 <ul>
4199 <li>
4200 <dl>
4201 <dd>
4202 <dl>
4203 <dt>bar</dt>
4204 </dl>
4205 </dd>
4206 </dl>
4207 </li>
4208 </ul>
4209 </dd>
4210 </dl>
4211 <dl>
4212 <dt>boo&#160;</dt>
4213 <dd>baz</dd>
4214 </dl>
4215 </li>
4216 </ol>
4217 </li>
4218 </ul>
4219 </li>
4220 </ol>
4221 </li>
4222 </ul>
4223 !! html/parsoid
4224 <ul>
4225 <li>
4226 <ol>
4227 <li>
4228 <ul>
4229 <li>
4230 <ol>
4231 <li>
4232 <dl>
4233 <dt>
4234 <ul>
4235 <li>
4236 <dl>
4237 <dt>
4238 <dl>
4239 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4240 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4241 </dl></dt>
4242 </dl></li>
4243 </ul></dt>
4244 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4245 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4246 </dl></li>
4247 </ol></li>
4248 </ul></li>
4249 </ol></li>
4250 </ul>
4251 !! end
4252
4253
4254 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4255 # From whitelist:
4256 # * The test is wrong, there are two colons where there should be :;
4257 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4258 !! test
4259 Definition Lists: Weird Ones: Test 1
4260 !! wikitext
4261 *#;*::;; foo : bar (who uses this?)
4262 !! html/php
4263 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4264 <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>
4265
4266 !! html/php+tidy
4267 <ul>
4268 <li>
4269 <ol>
4270 <li>
4271 <dl>
4272 <dt>foo&#160;</dt>
4273 <dd>
4274 <ul>
4275 <li>
4276 <dl>
4277 <dd>
4278 <dl>
4279 <dd>
4280 <dl>
4281 <dd>
4282 <dl>
4283 <dt>bar (who uses this?)</dt>
4284 </dl>
4285 </dd>
4286 </dl>
4287 </dd>
4288 </dl>
4289 </dd>
4290 </dl>
4291 </li>
4292 </ul>
4293 </dd>
4294 </dl>
4295 </li>
4296 </ol>
4297 </li>
4298 </ul>
4299 !! html/parsoid
4300 <ul>
4301 <li>
4302 <ol>
4303 <li>
4304 <dl>
4305 <dt>
4306 <ul>
4307 <li>
4308 <dl>
4309 <dd>
4310 <dl>
4311 <dd>
4312 <dl>
4313 <dt>
4314 <dl>
4315 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4316 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4317 </dl></dt>
4318 </dl></dd>
4319 </dl></dd>
4320 </dl></li>
4321 </ul></dt>
4322 </dl></li>
4323 </ol></li>
4324 </ul>
4325 !! end
4326
4327 !! test
4328 Definition Lists: colons occurring in tags
4329 !! wikitext
4330 ;a:b
4331 ;'''a:b'''
4332 ;<i>a:b</i>
4333 ;<span>a:b</span>
4334 ;<div>a:b</div>
4335 ;<div>a
4336 :b</div>
4337 ;{{echo|a:b}}
4338 ;{{echo|''a:b''}}
4339 ;;;''a:b''
4340 !! html+tidy
4341 <dl>
4342 <dt>a</dt>
4343 <dd>b</dd>
4344 <dt><b>a:b</b></dt>
4345 <dt><i>a:b</i></dt>
4346 <dt><span>a:b</span></dt>
4347 <dd>
4348 <div>a:b</div>
4349 </dd>
4350 <dd>
4351 <div>a
4352 <dl>
4353 <dd>b</dd>
4354 </dl>
4355 </div>
4356 </dd>
4357 <dt>a</dt>
4358 <dd>b</dd>
4359 <dt><i>a:b</i></dt>
4360 </dl>
4361 <dl>
4362 <dd>
4363 <dl>
4364 <dd>
4365 <dl>
4366 <dt><i>a:b</i></dt>
4367 </dl>
4368 </dd>
4369 </dl>
4370 </dd>
4371 </dl>
4372 !! html/parsoid
4373 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4374 <dt><b>a:b</b></dt>
4375 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4376 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4377 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4378 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4379 <dd>b</dd>
4380 <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>
4381 <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>
4382 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4383 !! end
4384
4385 !! test
4386 Definition Lists: colons and tables 1
4387 !! wikitext
4388 :{|
4389 | x
4390 |}
4391 :{|
4392 | y
4393 |}
4394 !! html
4395 <dl><dd><table>
4396 <tr>
4397 <td> x
4398 </td></tr></table></dd></dl>
4399 <dl><dd><table>
4400 <tr>
4401 <td> y
4402 </td></tr></table></dd></dl>
4403
4404 !! end
4405
4406 # Parsoid's output (as documented below) differs from php's in this case.
4407 # This is probably a bug. If we fixup parsoid to match php's output, the
4408 # above test should pass and the below test case can be removed. It is
4409 # unclear which output is more desirable.
4410
4411 !! test
4412 Definition Lists: colons and tables 2
4413 !! wikitext
4414 :{|
4415 | x
4416 |}
4417 :{|
4418 | y
4419 |}
4420 !! html/parsoid
4421 <dl><dd><table>
4422 <tr>
4423 <td> x
4424 </td></tr></table></dd>
4425 <dd><table>
4426 <tr>
4427 <td> y
4428 </td></tr></table></dd></dl>
4429 !! end
4430
4431 !! test
4432 Definition Lists: template interaction
4433 !! wikitext
4434 ::{{definition_list}}
4435
4436 :one
4437 ::{{definition_list}}
4438 :::two
4439 :::three
4440 ::four
4441 !! html/parsoid
4442 <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">
4443 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4444
4445 <dl><dd data-parsoid='{}'>one
4446 <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">
4447 </span><dd about="#mwt2">two
4448 <dl><dd>two</dd>
4449 <dd>three</dd></dl></dd>
4450 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4451 !! end
4452
4453
4454 ###
4455 ### External links
4456 ###
4457 !! test
4458 External links: non-bracketed
4459 !! wikitext
4460 Non-bracketed: http://example.com
4461 !! html
4462 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4463 </p>
4464 !! end
4465
4466 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4467 !! test
4468 External links: numbered
4469 !! wikitext
4470 Numbered: [http://example.com]
4471 Numbered: [http://example.net]
4472 Numbered: [http://example.com]
4473 !! html/php
4474 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4475 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4476 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4477 </p>
4478 !! html/parsoid
4479 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4480 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4481 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4482 !!end
4483
4484 !! test
4485 External links: specified text
4486 !! wikitext
4487 Specified text: [http://example.com link]
4488 !! html
4489 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4490 </p>
4491 !!end
4492
4493 !! test
4494 External links: trail
4495 !! wikitext
4496 Linktrails should not work for external links: [http://example.com link]s
4497 !! html
4498 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4499 </p>
4500 !! end
4501
4502 !! test
4503 External links: dollar sign in URL
4504 !! wikitext
4505 http://example.com/1$2345
4506 !! html
4507 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4508 </p>
4509 !! end
4510
4511 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4512 !! test
4513 External links: dollar sign in URL (autonumber)
4514 !! wikitext
4515 [http://example.com/1$2345]
4516 !! html/php
4517 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4518 </p>
4519 !! html/parsoid
4520 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4521 !!end
4522
4523 !! test
4524 External links: open square bracket forbidden in URL (bug 4377)
4525 !! options
4526 parsoid=wt2html,wt2wt,html2html
4527 !! wikitext
4528 http://example.com/1[2345
4529 !! html/php
4530 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4531 </p>
4532 !! html/parsoid
4533 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4534 !! end
4535
4536 !! test
4537 External links: open square bracket forbidden in URL (named) (bug 4377)
4538 !! options
4539 parsoid=wt2html,html2html
4540 !! wikitext
4541 [http://example.com/1[2345]
4542 !! html/php
4543 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4544 </p>
4545 !! html/parsoid
4546 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4547 !!end
4548
4549 # parsoid adds a space before the link name
4550 !! test
4551 External links: open square bracket forbidden in URL (named) (bug 4377)
4552 Parsoid variant.
4553 !! wikitext
4554 [http://example.com/1 [2345]
4555 !! html
4556 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4557 </p>
4558 !!end
4559
4560 !! test
4561 External links: nowiki in URL link text (bug 6230)
4562 !! wikitext
4563 [http://example.com/ <nowiki>''example site''</nowiki>]
4564 !! html
4565 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4566 </p>
4567 !! end
4568
4569 !! test
4570 External links: newline forbidden in text (bug 6230 regression check)
4571 !! wikitext
4572 [http://example.com/ first
4573 second]
4574 !! html
4575 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4576 second]
4577 </p>
4578 !!end
4579
4580 !! test
4581 External links: Pipe char between url and text
4582 !! wikitext
4583 [http://example.com | link]
4584 !! html
4585 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4586 </p>
4587 !!end
4588
4589 !! test
4590 External links: protocol-relative URL in brackets
4591 !! wikitext
4592 [//example.com/ Test]
4593 !! html
4594 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4595 </p>
4596 !! end
4597
4598 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4599 !! test
4600 External links: protocol-relative URL in brackets without text
4601 !! wikitext
4602 [//example.com]
4603 !! html/php
4604 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4605 </p>
4606 !! html/parsoid
4607 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4608 !! end
4609
4610 !! test
4611 External links: protocol-relative URL in free text is left alone
4612 !! wikitext
4613 //example.com/Foo
4614 !! html
4615 <p>//example.com/Foo
4616 </p>
4617 !!end
4618
4619 !! test
4620 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4621 !! wikitext
4622 foo//example.com/Foo
4623 !! html
4624 <p>foo//example.com/Foo
4625 </p>
4626 !! end
4627
4628 !! test
4629 External links: with no contents
4630 !! wikitext
4631 [http://en.wikipedia.org/wiki/Foo]
4632
4633 [[wikipedia:Foo|Bar]]
4634
4635 [[wikipedia:Foo|<span>Bar</span>]]
4636 !! html/php
4637 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4638 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4639 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4640 </p>
4641 !! html/parsoid
4642 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4643 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4644 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4645 !! end
4646
4647 !! test
4648 External links: Free with trailing punctuation
4649 !! wikitext
4650 http://example.com,
4651 http://example.com;
4652 http://example.com\
4653 http://example.com.
4654 http://example.com:
4655 http://example.com!
4656 http://example.com?
4657 http://example.com)
4658 http://example.com/url_with_(brackets)
4659 (http://example.com/url_without_brackets)
4660 http://example.com/url_with_entity&amp;
4661 http://example.com/url_with_entity&#x26;
4662 http://example.com/url_with_entity&#038;
4663 http://example.com/url_with_entity&nbsp;
4664 http://example.com/url_with_entity&#xA0;
4665 http://example.com/url_with_entity&#160;
4666 http://example.com/url_with_entity&lt;
4667 http://example.com/url_with_entity&#x3C;
4668 http://example.com/url_with_entity&#60;
4669 !! html/php
4670 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4671 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4672 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4673 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4674 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4675 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4676 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4677 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4678 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4679 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4680 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4681 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4682 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4683 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4684 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4685 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4686 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4687 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4688 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4689 </p>
4690 !! html/parsoid
4691 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4692 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4693 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4694 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4695 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4696 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4697 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4698 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4699 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4700 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4701 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4702 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4703 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4704 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>
4705 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>
4706 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>
4707 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>
4708 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x3C;","srcContent":"&lt;"}'>&lt;</span>
4709 <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>
4710 !! end
4711
4712 !! test
4713 External links: tricky Parsoid html2html case
4714 !! options
4715 parsoid=wt2html,wt2wt,html2html
4716 !! wikitext
4717 http://example.com/url_with_entity&amp;amp;
4718 !! html/php
4719 <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>;
4720 </p>
4721 !! html/parsoid
4722 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4723 !! end
4724
4725 !! test
4726 External links: Free with trailing quotes (T113666)
4727 !! wikitext
4728 '''News:''' Stuff here
4729
4730 news:'a'b''c''d e
4731 !! html/php
4732 <p><b>News:</b> Stuff here
4733 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4734 </p>
4735 !! html/parsoid
4736 <p><b>News:</b> Stuff here</p>
4737 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4738 !! end
4739
4740 !! test
4741 External links: Lone protocols are never linked (T105697)
4742 !! wikitext
4743 http://
4744 http://;
4745 (http://)
4746 bitcoin:
4747 bitcoin:;
4748 (bitcoin:)
4749 !! html
4750 <p>http://
4751 http://;
4752 (http://)
4753 bitcoin:
4754 bitcoin:;
4755 (bitcoin:)
4756 </p>
4757 !! end
4758
4759 !! test
4760 External links: No preceding word characters allowed (bug 65278)
4761 !! wikitext
4762 NOPEhttp://example.com
4763 N0http://example.com
4764 ok:http://example.com
4765 ok-http://example.com
4766 !! html
4767 <p>NOPEhttp://example.com
4768 N0http://example.com
4769 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4770 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4771 </p>
4772 !! end
4773
4774 !! test
4775 External image
4776 !! wikitext
4777 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4778 !! html
4779 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4780 </p>
4781 !! end
4782
4783 !! test
4784 External image from https
4785 !! wikitext
4786 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4787 !! html
4788 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4789 </p>
4790 !! end
4791
4792 !! test
4793 External image (when not allowed)
4794 !! options
4795 wgAllowExternalImages=0
4796 !! wikitext
4797 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4798 !! html
4799 <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>
4800 </p>
4801 !! end
4802
4803 !! test
4804 Link to non-http image, no img tag
4805 !! wikitext
4806 Link to non-http image, no img tag: ftp://example.com/test.jpg
4807 !! html
4808 <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>
4809 </p>
4810 !! end
4811
4812 !! test
4813 External links: terminating separator
4814 !! wikitext
4815 Terminating separator: http://example.com/thing,
4816 !! html
4817 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4818 </p>
4819 !! end
4820
4821 !! test
4822 External links: intervening separator
4823 !! wikitext
4824 Intervening separator: http://example.com/1,2,3
4825 !! html
4826 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4827 </p>
4828 !! end
4829
4830 !! test
4831 External links: old bug with URL in query
4832 !! wikitext
4833 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4834 !! html
4835 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4836 </p>
4837 !! end
4838
4839 !! test
4840 External links: old URL-in-URL bug, mixed protocols
4841 !! wikitext
4842 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4843 !! html
4844 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4845 </p>
4846 !!end
4847
4848 !! test
4849 External links: URL in text
4850 !! wikitext
4851 URL in text: [http://example.com http://example.com]
4852 !! html
4853 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4854 </p>
4855 !! end
4856
4857 !! test
4858 External links: Clickable images
4859 !! wikitext
4860 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4861 !! html/php
4862 <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>
4863 </p>
4864 !! html/parsoid
4865 <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>
4866 !! end
4867
4868 !! test
4869 External links: raw ampersand
4870 !! wikitext
4871 Old &amp; use: http://x&y
4872 !! html
4873 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4874 </p>
4875 !! end
4876
4877 !! test
4878 External links: encoded ampersand
4879 !! wikitext
4880 Old &amp; use: http://x&amp;y
4881 !! html/php
4882 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4883 </p>
4884 !! html/parsoid
4885 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4886 !! end
4887
4888 !! test
4889 External links: encoded equals (bug 6102)
4890 !! wikitext
4891 http://example.com/?foo&#61;bar
4892 !! html/php
4893 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4894 </p>
4895 !! html/parsoid
4896 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4897 !! end
4898
4899 ##
4900 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4901 ## does it number them. As discussed in bug 53505, we can identify
4902 ## autonumbered links via CSS.
4903 ##
4904
4905 !! test
4906 External links: [raw ampersand]
4907 !! wikitext
4908 Old &amp; use: [http://x&y]
4909 !! html/php
4910 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4911 </p>
4912 !! html/parsoid
4913 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4914 !! end
4915
4916 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4917 # mode will return the [raw ampersand] wikitext
4918 !! test
4919 External links: [encoded ampersand]
4920 !! options
4921 parsoid=wt2html,wt2wt,html2html
4922 !! wikitext
4923 Old &amp; use: [http://x&amp;y]
4924 !! html/php
4925 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4926 </p>
4927 !! html/parsoid
4928 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4929 !! end
4930
4931 !! test
4932 External links: [raw equals]
4933 !! wikitext
4934 [http://example.com/?foo=bar]
4935 !! html/php
4936 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4937 </p>
4938 !! html/parsoid
4939 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4940 !! end
4941
4942 # note that parsoid html is identical to [raw equals] case; so html2wt
4943 # mode will return the [raw equals] wikitext
4944 !! test
4945 External links: [encoded equals] (bug 6102)
4946 !! options
4947 parsoid=wt2html,wt2wt,html2html
4948 !! wikitext
4949 [http://example.com/?foo&#61;bar]
4950 !! html/php
4951 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4952 </p>
4953 !! html/parsoid
4954 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4955 !! end
4956
4957 # xxx parsoid strips the IDN character, so the round-trip tests will
4958 # obviously fail and are disabled. --cscott
4959 !! test
4960 External links: [IDN ignored character reference in hostname; strip it right off]
4961 !! options
4962 parsoid=wt2html,wt2wt,html2html
4963 !! wikitext
4964 [http://e&zwnj;xample.com/]
4965 !! html/php
4966 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4967 </p>
4968 !! html/parsoid
4969 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4970 !! end
4971
4972 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4973 # Where an external link could easily circumvent the sanitization of the text of
4974 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4975 # test demands a higher standard. That's a bit strange.
4976 #
4977 # Example:
4978 #
4979 # http://e‌xample.com -> [http://example.com|http://example.com]
4980 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4981 #
4982 # The first example is sanitized, but the second is not. Any security benefits
4983 # from this production are trivial to circumvent. Either remove this test and
4984 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4985 # the test accordingly.
4986 #
4987 # All our love,
4988 # The Parsoid team.
4989 # xxx parsoid strips the IDN character, so the round-trip tests will
4990 # obviously fail and are disabled. --cscott
4991 !! test
4992 External links: IDN ignored character reference in hostname; strip it right off
4993 !! options
4994 parsoid=wt2html,html2html
4995 !! wikitext
4996 http://e&zwnj;xample.com/
4997 !! html/php
4998 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4999 </p>
5000 !! html/parsoid
5001 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
5002 !! end
5003
5004 !! test
5005 External links: www.jpeg.org (bug 554)
5006 !! wikitext
5007 http://www.jpeg.org
5008 !! html
5009 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5010 </p>
5011 !! end
5012
5013 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
5014 !! test
5015 External links: URL within URL (original bug 2)
5016 !! wikitext
5017 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5018 !! html/php
5019 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5020 </p>
5021 !! html/parsoid
5022 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5023 !! end
5024
5025 !! test
5026 BUG 361: URL inside bracketed URL
5027 !! wikitext
5028 [http://www.example.com/foo http://www.example.com/bar]
5029 !! html
5030 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5031 </p>
5032 !! end
5033
5034 !! test
5035 BUG 361: URL within URL, not bracketed
5036 !! wikitext
5037 http://www.example.com/foo?=http://www.example.com/bar
5038 !! html
5039 <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>
5040 </p>
5041 !! end
5042
5043 !! test
5044 BUG 289: ">"-token in URL-tail
5045 !! wikitext
5046 http://www.example.com/<hello>
5047 !! html
5048 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5049 </p>
5050 !!end
5051
5052 !! test
5053 BUG 289: literal ">"-token in URL-tail
5054 !! wikitext
5055 http://www.example.com/<b>html</b>
5056 !! html/php
5057 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5058 </p>
5059 !! html/parsoid
5060 <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>
5061 !! end
5062
5063 !! test
5064 BUG 289: ">"-token in bracketed URL
5065 !! wikitext
5066 [http://www.example.com/<hello> stuff]
5067 !! html
5068 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5069 </p>
5070 !!end
5071
5072 !! test
5073 BUG 289: literal ">"-token in bracketed URL
5074 !! wikitext
5075 [http://www.example.com/<b>html</b> stuff]
5076 !! html
5077 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5078 </p>
5079 !!end
5080
5081 !! test
5082 BUG 289: literal double quote at end of URL
5083 !! wikitext
5084 http://www.example.com/"hello"
5085 !! html
5086 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5087 </p>
5088 !!end
5089
5090 !! test
5091 BUG 289: literal double quote in bracketed URL
5092 !! wikitext
5093 [http://www.example.com/"hello" stuff]
5094 !! html
5095 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5096 </p>
5097 !!end
5098
5099 !! test
5100 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5101 !! wikitext
5102 [http://www.example.com test]
5103 !! html
5104 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5105 </p>
5106 !! end
5107
5108 !! test
5109 External links: link text with spaces
5110 !! wikitext
5111 [http://www.example.com a b c]
5112 [http://www.example.com ''a'' ''b'']
5113 !! html
5114 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5115 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5116 </p>
5117 !! end
5118
5119 !! test
5120 External links: wiki links within external link (Bug 3695)
5121 !! options
5122 parsoid=wt2html,html2html
5123 !! wikitext
5124 [http://example.com [[wikilink]] embedded in ext link]
5125 !! html/php
5126 <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>
5127 </p>
5128 !! html/parsoid
5129 <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>
5130 !! end
5131
5132 !! test
5133 BUG 787: Links with one slash after the url protocol are invalid
5134 !! wikitext
5135 http:/example.com
5136
5137 [http:/example.com title]
5138 !! html
5139 <p>http:/example.com
5140 </p><p>[http:/example.com title]
5141 </p>
5142 !! end
5143
5144 !! test
5145 Bracketed external links with template-generated invalid target
5146 !! wikitext
5147 [{{echo|http:/example.com}} title]
5148 !! html
5149 <p>[http:/example.com title]
5150 </p>
5151 !! end
5152
5153 !! test
5154 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5155 !! wikitext
5156 ''[http://example.com text'']
5157 [http://example.com '''text]'''
5158 ''Something [http://example.com in italic'']
5159 ''Something [http://example.com mixed''''', even bold]'''
5160 '''''Now [http://example.com both''''']
5161 !! html
5162 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5163 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5164 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5165 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5166 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5167 </p>
5168 !! end
5169
5170
5171 !! test
5172 Bug 4781: %26 in URL
5173 !! wikitext
5174 http://www.example.com/?title=AT%26T
5175 !! html/php
5176 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5177 </p>
5178 !! html/parsoid
5179 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5180 !! end
5181
5182 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5183 # % is actually legal in HTML5. Any change in output would need testing though.
5184 !! test
5185 Bug 4781, 5267: %25 in URL
5186 !! wikitext
5187 http://www.example.com/?title=100%25_Bran
5188 !! html/php
5189 <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>
5190 </p>
5191 !! html/parsoid
5192 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5193 !! end
5194
5195 !! test
5196 Bug 4781, 5267: %28, %29 in URL
5197 !! wikitext
5198 http://www.example.com/?title=Ben-Hur_%281959_film%29
5199 !! html/php
5200 <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>
5201 </p>
5202 !! html/parsoid
5203 <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>
5204 !! end
5205
5206
5207 !! test
5208 Bug 4781: %26 in autonumber URL
5209 !! wikitext
5210 [http://www.example.com/?title=AT%26T]
5211 !! html/php
5212 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5213 </p>
5214 !! html/parsoid
5215 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5216 !! end
5217
5218 !! test
5219 Bug 4781, 5267: %26 in autonumber URL
5220 !! wikitext
5221 [http://www.example.com/?title=100%25_Bran]
5222 !! html/php
5223 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5224 </p>
5225 !! html/parsoid
5226 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5227 !! end
5228
5229 !! test
5230 Bug 4781, 5267: %28, %29 in autonumber URL
5231 !! wikitext
5232 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5233 !! html/php
5234 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5235 </p>
5236 !! html/parsoid
5237 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5238 !! end
5239
5240
5241 !! test
5242 Bug 4781: %26 in bracketed URL
5243 !! wikitext
5244 [http://www.example.com/?title=AT%26T link]
5245 !! html/php
5246 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5247 </p>
5248 !! html/parsoid
5249 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5250 !! end
5251
5252 !! test
5253 Bug 4781, 5267: %25 in bracketed URL
5254 !! wikitext
5255 [http://www.example.com/?title=100%25_Bran link]
5256 !! html
5257 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5258 </p>
5259 !! end
5260
5261 !! test
5262 Bug 4781, 5267: %28, %29 in bracketed URL
5263 !! wikitext
5264 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5265 !! html/php
5266 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5267 </p>
5268 !! html/parsoid
5269 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5270 !! end
5271
5272 !! test
5273 External link containing a period in the anchor. (bug 63947)
5274 !! wikitext
5275 [//foo.org/bar#baz. bang]
5276
5277 [//foo.org/bar. bang]
5278 !! html/php
5279 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5280 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5281 </p>
5282 !! html/parsoid
5283 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5284 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5285 !! end
5286
5287 !! test
5288 External link containing a single quote. (bug 63947)
5289 !! wikitext
5290 [//foo.org/bar'baz]
5291
5292 [//foo.org/bar'baz bang]
5293 !! html/php
5294 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5295 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5296 </p>
5297 !! html/parsoid
5298 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5299 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5300 !! end
5301
5302 !! test
5303 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5304 !! wikitext
5305 Some [http://example.com/ pretty ''italics'' and stuff]!
5306 !! html
5307 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5308 </p>
5309 !! end
5310
5311 !! test
5312 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5313 !! wikitext
5314 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5315 !! html
5316 <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>
5317 </p>
5318 !! end
5319
5320 !! test
5321 External link containing double-single-quotes with no space separating the url from text in italics
5322 !! wikitext
5323 [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]].]
5324 !! html/php
5325 <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>
5326 </p>
5327 !! html/php+tidy
5328 <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>
5329 !! html/parsoid
5330 <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>
5331 !! end
5332
5333 !! test
5334 External link with comments in link text
5335 !! wikitext
5336 [http://www.google.com Google <!-- comment -->]
5337 !! html/php
5338 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5339 </p>
5340 !! html/parsoid
5341 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5342 !! end
5343
5344 !! test
5345 External link to bare IPv4 address
5346 !! wikitext
5347 [http://192.168.0.1 Link]
5348 !! html/php
5349 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5350 </p>
5351 !! html/parsoid
5352 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5353 !! end
5354
5355 !! test
5356 URL-encoding in URL functions (single parameter)
5357 !! wikitext
5358 {{localurl:Some page|amp=&}}
5359 !! html
5360 <p>/index.php?title=Some_page&amp;amp=&amp;
5361 </p>
5362 !! end
5363
5364 !! test
5365 URL-encoding in URL functions (multiple parameters)
5366 !! wikitext
5367 {{localurl:Some page|q=?&amp=&}}
5368 !! html
5369 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5370 </p>
5371 !! end
5372
5373 !! test
5374 Brackets in urls
5375 !! wikitext
5376 http://example.com/index.php?foozoid%5B%5D=bar
5377
5378 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5379 !! html/php
5380 <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>
5381 </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>
5382 </p>
5383 !! html/parsoid
5384 <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>
5385
5386 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5387 !! end
5388
5389 !! test
5390 IPv6 urls, autolink format (T23261)
5391 !! wikitext
5392 http://[2404:130:0:1000::187:2]/index.php
5393
5394 Examples from RFC 2373, section 2.2:
5395 * http://[1080::8:800:200C:417A]/unicast
5396 * http://[FF01::101]/multicast
5397 * http://[::1]/loopback
5398 * http://[::]/unspecified
5399 * http://[::13.1.68.3]/ipv4compat
5400 * http://[::FFFF:129.144.52.38]/ipv4compat
5401
5402 Examples from RFC 2732, section 2:
5403 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5404 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5405 * http://[3ffe:2a00:100:7031::1]
5406 * http://[1080::8:800:200C:417A]/foo
5407 * http://[::192.9.5.5]/ipng
5408 * http://[::FFFF:129.144.52.38]:80/index.html
5409 * http://[2010:836B:4179::836B:4179]
5410
5411 !! html/php
5412 <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>
5413 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5414 </p>
5415 <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>
5416 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5417 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5418 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5419 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5420 <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>
5421 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5422 </p>
5423 <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>
5424 <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>
5425 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5426 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5427 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5428 <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>
5429 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5430
5431 !! html/parsoid
5432 <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>
5433
5434 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5435 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5436 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5437 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5438 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5439 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5440 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5441
5442 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5443 <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>
5444 <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>
5445 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5446 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5447 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5448 <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>
5449 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5450 !! end
5451
5452 !! test
5453 IPv6 urls, bracketed format (T23261)
5454 !! wikitext
5455 [http://[2404:130:0:1000::187:2]/index.php test]
5456
5457 Examples from RFC 2373, section 2.2:
5458 * [http://[1080::8:800:200C:417A] unicast]
5459 * [http://[FF01::101] multicast]
5460 * [http://[::1]/ loopback]
5461 * [http://[::] unspecified]
5462 * [http://[::13.1.68.3] ipv4compat]
5463 * [http://[::FFFF:129.144.52.38] ipv4compat]
5464
5465 Examples from RFC 2732, section 2:
5466 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5467 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5468 * [http://[3ffe:2a00:100:7031::1] 3]
5469 * [http://[1080::8:800:200C:417A]/foo 4]
5470 * [http://[::192.9.5.5]/ipng 5]
5471 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5472 * [http://[2010:836B:4179::836B:4179] 7]
5473
5474 !! html/php
5475 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5476 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5477 </p>
5478 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5479 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5480 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5481 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5482 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5483 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5484 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5485 </p>
5486 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5487 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5488 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5489 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5490 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5491 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5492 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5493
5494 !! html/parsoid
5495 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5496
5497 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5498 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5499 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5500 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5501 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5502 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5503 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5504
5505 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5506 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5507 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5508 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5509 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5510 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5511 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5512 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5513 !! end
5514
5515 !! test
5516 Non-extlinks in brackets
5517 !! wikitext
5518 [foo]
5519 [foo bar]
5520 [foo ''bar'']
5521 [fool's] errand
5522 [fool's errand]
5523 [{{echo|foo}}]
5524 [{{echo|foo}} bar]
5525 [{{echo|foo}} ''bar'']
5526 [{{echo|foo}}l's] errand
5527 [{{echo|foo}}l's errand]
5528 [url={{echo|foo}}]
5529 [url=http://example.com]
5530 [http:// bare protocols don't count]
5531 !! html/php
5532 <p>[foo]
5533 [foo bar]
5534 [foo <i>bar</i>]
5535 [fool's] errand
5536 [fool's errand]
5537 [foo]
5538 [foo bar]
5539 [foo <i>bar</i>]
5540 [fool's] errand
5541 [fool's errand]
5542 [url=foo]
5543 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5544 [http:// bare protocols don't count]
5545 </p>
5546 !! html/parsoid
5547 <p>[foo]
5548 [foo bar]
5549 [foo <i>bar</i>]
5550 [fool's] errand
5551 [fool's errand]
5552 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5553 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5554 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5555 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5556 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5557 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5558 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5559 [http:// bare protocols don't count]</p>
5560 !! end
5561
5562 !! test
5563 Percent encoding in external links
5564 !! wikitext
5565 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5566 !! html/php
5567 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5568 </p>
5569 !! html/parsoid
5570 <p><a rel="mw:ExtLink"
5571 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5572 !! end
5573
5574 !! test
5575 Use url link syntax for links where the content is equal the link target
5576 !! wikitext
5577 http://example.com
5578 !! html/php
5579 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5580 </p>
5581 !! html/parsoid
5582 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5583 !! end
5584
5585 !! test
5586 Parenthesis in external links, especially URL links
5587 !! wikitext
5588 http://example.com)
5589
5590 http://example.com/test)
5591
5592 http://example.com/(test)
5593
5594 http://example.com/((test)
5595
5596 (http://example.com/(test))
5597
5598 (http://example.com/(test)))))
5599
5600 http://example.com/a)b
5601
5602 [http://example.com) foo]
5603 !! html/php
5604 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5605 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5606 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5607 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5608 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5609 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5610 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5611 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5612 </p>
5613 !! html/parsoid
5614 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5615 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5616 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5617 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5618 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5619 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5620 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5621 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5622 !! end
5623
5624 !! test
5625 Parenthesis in external links, w/ transclusion or comment
5626 !! wikitext
5627 (http://example.com/{{echo|hi}})
5628
5629 (http://example.com<!-- hi -->)
5630 !! html/php
5631 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5632 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5633 </p>
5634 !! html/parsoid
5635 <p>(<a typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;}]],&amp;quot;dsr&amp;quot;:[20,31,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;hi&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
5636
5637 <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>
5638 !! end
5639
5640 !! test
5641 Serialize <a> tags with invalid link targets as plain text
5642 !! options
5643 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5644 !! html/parsoid
5645 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5646 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5647 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5648 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5649 !! wikitext
5650 text
5651 <nowiki>*</nowiki>text
5652 <nowiki>[[foo]]</nowiki>
5653 <nowiki>*a [[foo]]</nowiki>
5654 !! end
5655
5656 !! test
5657 mw:ExtLink -vs- mw:WikiLink (T94723)
5658 !! options
5659 parsoid=html2wt
5660 !! html/parsoid
5661 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"},"dsr":[0,11,6,2]}'>Bar</a>
5662 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5663 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5664 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5665 <p>
5666 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5667 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5668 </p>
5669 !! wikitext
5670 [[Foo|Bar]]
5671 [[Foo|Bar]]
5672 [[wikipedia:Foo|Bar]]
5673 [[wikipedia:Foo|Bar]]
5674
5675 [[wikipedia:European_Robin|European Robin]]
5676 [[wikipedia:European_Robin|European Robin]]
5677 !! end
5678
5679 !! test
5680 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5681 !! options
5682 parsoid=wt2wt
5683 !! wikitext
5684 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5685 !! html/parsoid
5686 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5687 !! end
5688
5689
5690 ###
5691 ### Quotes
5692 ###
5693
5694 !! test
5695 Quotes
5696 !! wikitext
5697 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5698
5699 Normal text. '''''Bold italic text.''''' Normal text.
5700 !! html
5701 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5702 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5703 </p>
5704 !! end
5705
5706
5707 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5708 # parser strips. The wikitext contains just the first half of the bold
5709 # quote pair.
5710 !! test
5711 Unclosed and unmatched quotes
5712 !! wikitext
5713 '''''Bold italic text '''with bold deactivated''' in between.'''''
5714
5715 '''''Bold italic text ''with italic deactivated'' in between.'''''
5716
5717 '''Bold text..
5718
5719 ..spanning two paragraphs (should not work).'''
5720
5721 '''Bold tag left open
5722
5723 ''Italic tag left open
5724
5725 Normal text.
5726
5727 <!-- Unmatching number of opening, closing tags: -->
5728 '''This year''''s election ''should'' beat '''last year''''s.
5729
5730 ''Tom'''s car is bigger than ''Susan'''s.
5731
5732 Plain ''italic'''s plain
5733 !! html/php
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).
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><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5742 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5743 </p><p>Plain <i>italic'</i>s plain
5744 </p>
5745 !! html/parsoid
5746 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5747 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5748 </p><p><b>Bold text..</b>
5749 </p><p>..spanning two paragraphs (should not work).<b></b>
5750 </p><p><b>Bold tag left open</b>
5751 </p><p><i>Italic tag left open</i>
5752 </p><p>Normal text.
5753 </p>
5754 <!-- Unmatching number of opening, closing tags: -->
5755 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5756 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5757 </p><p>Plain <i>italic'</i>s plain
5758 </p>
5759 !! end
5760
5761 ###
5762 ### Tables
5763 ###
5764 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5765 ###
5766
5767 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5768 # is the bare minimum required by the spec, see:
5769 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5770 # Parsoid team replies: empty table tags are legal in HTML5
5771 !! test
5772 A table with no data.
5773 !! options
5774 parsoid=wt2html
5775 !! wikitext
5776 {||}
5777 !! html/php
5778
5779 !! html/parsoid
5780 <table></table>
5781
5782 !! end
5783
5784 !! test
5785 A table with stray table end tags on start tag line (wt2html)
5786 !! options
5787 parsoid=wt2html
5788 !! wikitext
5789 {|style="color: red;"|}
5790
5791 {|style="color: red;" |}
5792 |foo
5793 |}
5794
5795 {|style="color: red;"|} id="foo"
5796 |foo
5797 |}
5798
5799 {|style="color: red;" |} id="foo"
5800 |foo
5801 |}
5802 !! html
5803 <table style="color: red;"></table>
5804
5805 <table style="color: red;">
5806 <tbody><tr>
5807 <td>foo</td>
5808 </tr></tbody>
5809 </table>
5810
5811 <table style="color: red;" id="foo">
5812 <tbody><tr>
5813 <td>foo</td>
5814 </tr></tbody>
5815 </table>
5816
5817 <table style="color: red;" id="foo">
5818 <tbody><tr>
5819 <td>foo</td>
5820 </tr></tbody>
5821 </table>
5822
5823 !! end
5824
5825 !! test
5826 A table with no data (take 2)
5827 !! wikitext
5828 {|
5829 |}
5830 !! html/parsoid
5831 <table></table>
5832 !! end
5833
5834 # A table with nothing but a caption is invalid XHTML, we might want to render
5835 # this as <p>caption</p>
5836 # Parsoid team replies: table with only a caption is legal in HTML5
5837 !! test
5838 A table with nothing but a caption
5839 !! wikitext
5840 {|
5841 |+ caption
5842 |}
5843 !! html/php
5844 <table>
5845 <caption> caption
5846 </caption><tr><td></td></tr></table>
5847
5848 !! html/parsoid
5849 <table><caption> caption</caption></table>
5850 !! end
5851
5852 !! test
5853 A table with caption with default-spaced attributes and a table row
5854 !! wikitext
5855 {|
5856 |+ style="color: red;" | caption1
5857 |-
5858 | foo
5859 |}
5860 !! html
5861 <table>
5862 <caption style="color: red;"> caption1
5863 </caption>
5864 <tr>
5865 <td> foo
5866 </td></tr></table>
5867
5868 !! end
5869
5870 !! test
5871 A table with captions with non-default spaced attributes and a table row
5872 !! wikitext
5873 {|
5874 |+style="color: red;"|caption2
5875 |+ style="color: red;"| caption3
5876 |-
5877 | foo
5878 |}
5879 !! html
5880 <table>
5881 <caption style="color: red;">caption2
5882 </caption>
5883 <caption style="color: red;"> caption3
5884 </caption>
5885 <tr>
5886 <td> foo
5887 </td></tr></table>
5888
5889 !! end
5890
5891 !! test
5892 Table td-cell syntax variations
5893 !! wikitext
5894 {|
5895 | foo bar foo | baz
5896 | foo bar foo || baz
5897 | style='color:red;' | baz
5898 | style='color:red;' || baz
5899 |}
5900 !! html
5901 <table>
5902 <tr>
5903 <td> baz
5904 </td>
5905 <td> foo bar foo </td>
5906 <td> baz
5907 </td>
5908 <td style="color:red;"> baz
5909 </td>
5910 <td> style='color:red;' </td>
5911 <td> baz
5912 </td></tr></table>
5913
5914 !! end
5915
5916 !! test
5917 Simple table
5918 !! wikitext
5919 {|
5920 | 1 || 2
5921 |-
5922 | 3 || 4
5923 |}
5924 !! html
5925 <table>
5926 <tr>
5927 <td> 1 </td>
5928 <td> 2
5929 </td></tr>
5930 <tr>
5931 <td> 3 </td>
5932 <td> 4
5933 </td></tr></table>
5934
5935 !! end
5936
5937 !! test
5938 Simple table but with multiple dashes for row wikitext
5939 !! wikitext
5940 {|
5941 | foo
5942 |-----
5943 | bar
5944 |}
5945 !! html
5946 <table>
5947 <tr>
5948 <td> foo
5949 </td></tr>
5950 <tr>
5951 <td> bar
5952 </td></tr></table>
5953
5954 !! end
5955
5956 !! test
5957 Multiplication table
5958 !! wikitext
5959 {| border="1" cellpadding="2"
5960 |+Multiplication table
5961 |-
5962 ! &times; !! 1 !! 2 !! 3
5963 |-
5964 ! 1
5965 | 1 || 2 || 3
5966 |-
5967 ! 2
5968 | 2 || 4 || 6
5969 |-
5970 ! 3
5971 | 3 || 6 || 9
5972 |-
5973 ! 4
5974 | 4 || 8 || 12
5975 |-
5976 ! 5
5977 | 5 || 10 || 15
5978 |}
5979 !! html
5980 <table border="1" cellpadding="2">
5981 <caption>Multiplication table
5982 </caption>
5983 <tr>
5984 <th> &#215; </th>
5985 <th> 1 </th>
5986 <th> 2 </th>
5987 <th> 3
5988 </th></tr>
5989 <tr>
5990 <th> 1
5991 </th>
5992 <td> 1 </td>
5993 <td> 2 </td>
5994 <td> 3
5995 </td></tr>
5996 <tr>
5997 <th> 2
5998 </th>
5999 <td> 2 </td>
6000 <td> 4 </td>
6001 <td> 6
6002 </td></tr>
6003 <tr>
6004 <th> 3
6005 </th>
6006 <td> 3 </td>
6007 <td> 6 </td>
6008 <td> 9
6009 </td></tr>
6010 <tr>
6011 <th> 4
6012 </th>
6013 <td> 4 </td>
6014 <td> 8 </td>
6015 <td> 12
6016 </td></tr>
6017 <tr>
6018 <th> 5
6019 </th>
6020 <td> 5 </td>
6021 <td> 10 </td>
6022 <td> 15
6023 </td></tr></table>
6024
6025 !! end
6026
6027 !! test
6028 Accept "||" in table headings
6029 !! wikitext
6030 {|
6031 !h1 || h2
6032 |}
6033 !! html
6034 <table>
6035 <tr>
6036 <th>h1 </th>
6037 <th> h2
6038 </th></tr></table>
6039
6040 !! end
6041
6042 !! test
6043 Accept "!!" in table data
6044 !! wikitext
6045 {|
6046 | Foo!! ||
6047 |}
6048 !! html
6049 <table>
6050 <tr>
6051 <td> Foo!! </td>
6052 <td>
6053 </td></tr></table>
6054
6055 !! html/parsoid
6056 <table>
6057 <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>
6058 </tbody></table>
6059 !! end
6060
6061 !! test
6062 Accept "||" in indented table headings
6063 !! wikitext
6064 :{|
6065 !h1 || h2
6066 |}
6067 !! html
6068 <dl><dd><table>
6069 <tr>
6070 <th>h1 </th>
6071 <th> h2
6072 </th></tr></table></dd></dl>
6073
6074 !! end
6075
6076 !! test
6077 Accept "!!" in templates
6078 !! wikitext
6079 {|
6080 !a {{echo|b!!c}}
6081 |}
6082 !! html/php
6083 <table>
6084 <tr>
6085 <th>a b</th>
6086 <th>c
6087 </th></tr></table>
6088
6089 !! html/parsoid
6090 <table>
6091 <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>
6092 !! end
6093
6094 !! test
6095 Accept "!!" in table headings after newline
6096 !! wikitext
6097 {|
6098 !a
6099 b!!c
6100 |}
6101 !! html/php
6102 <table>
6103 <tr>
6104 <th>a
6105 <p>b!!c
6106 </p>
6107 </th></tr></table>
6108
6109 !! html/parsoid
6110 <table>
6111 <tbody><tr><th>a
6112 <p>b!!c</p></th></tr>
6113 </tbody></table>
6114 !! end
6115
6116 !! test
6117 Accept "!!" in table data of mixed wikitext / html syntax
6118 !! wikitext
6119 {|
6120 !a
6121 <tr><td>b!!c</td></tr>
6122 |}
6123 !! html+tidy
6124 <table>
6125 <tr>
6126 <th>a</th>
6127 </tr>
6128 <tr>
6129 <td>b!!c</td>
6130 </tr>
6131 </table>
6132 !! html/parsoid
6133 <table>
6134 <tbody><tr><th>a</th></tr>
6135 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6136 </tbody></table>
6137 !! end
6138
6139 !! test
6140 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6141 !! wikitext
6142 {|
6143 !| h1
6144 || a
6145 |}
6146 !! html
6147 <table>
6148 <tr>
6149 <th> h1
6150 </th>
6151 <td> a
6152 </td></tr></table>
6153
6154 !! end
6155
6156 !!test
6157 Accept "| !" at start of line in tables (ignore !-attribute)
6158 !! wikitext
6159 {|
6160 |-
6161 | !style="color:red" | bar
6162 |}
6163 !! html
6164 <table>
6165
6166 <tr>
6167 <td> bar
6168 </td></tr></table>
6169
6170 !!end
6171
6172 !!test
6173 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 +/-
6174 !! wikitext
6175 {|
6176 |-
6177 |style='color:red;'|+1
6178 |style='color:blue;'|-1
6179 |-
6180 | 1 || 2 || 3
6181 | 1 ||+2 ||-3
6182 |-
6183 | +1
6184 | -1
6185 |}
6186 !! html
6187 <table>
6188
6189 <tr>
6190 <td style="color:red;">+1
6191 </td>
6192 <td style="color:blue;">-1
6193 </td></tr>
6194 <tr>
6195 <td> 1 </td>
6196 <td> 2 </td>
6197 <td> 3
6198 </td>
6199 <td> 1 </td>
6200 <td>+2 </td>
6201 <td>-3
6202 </td></tr>
6203 <tr>
6204 <td> +1
6205 </td>
6206 <td> -1
6207 </td></tr></table>
6208
6209 !!end
6210
6211 !! test
6212 Table rowspan
6213 !! wikitext
6214 {| border=1
6215 | Cell 1, row 1
6216 |rowspan=2| Cell 2, row 1 (and 2)
6217 | Cell 3, row 1
6218 |-
6219 | Cell 1, row 2
6220 | Cell 3, row 2
6221 |}
6222 !! html
6223 <table border="1">
6224 <tr>
6225 <td> Cell 1, row 1
6226 </td>
6227 <td rowspan="2"> Cell 2, row 1 (and 2)
6228 </td>
6229 <td> Cell 3, row 1
6230 </td></tr>
6231 <tr>
6232 <td> Cell 1, row 2
6233 </td>
6234 <td> Cell 3, row 2
6235 </td></tr></table>
6236
6237 !! end
6238
6239 !! test
6240 Nested table
6241 !! wikitext
6242 {| border=1
6243 | &alpha;
6244 |
6245 {| bgcolor=#ABCDEF border=2
6246 |nested
6247 |-
6248 |table
6249 |}
6250 |the original table again
6251 |}
6252 !! html
6253 <table border="1">
6254 <tr>
6255 <td> &#945;
6256 </td>
6257 <td>
6258 <table bgcolor="#ABCDEF" border="2">
6259 <tr>
6260 <td>nested
6261 </td></tr>
6262 <tr>
6263 <td>table
6264 </td></tr></table>
6265 </td>
6266 <td>the original table again
6267 </td></tr></table>
6268
6269 !! end
6270
6271 !! test
6272 Invalid attributes in table cell (bug 1830)
6273 !! wikitext
6274 {|
6275 |Cell:|broken
6276 |}
6277 !! html
6278 <table>
6279 <tr>
6280 <td>broken
6281 </td></tr></table>
6282
6283 !! end
6284
6285 !! test
6286 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6287 !! wikitext
6288 {|
6289 | title="foo" |bar
6290 | title="foo<nowiki>|</nowiki>" |bar
6291 | title="foo<nowiki>|</nowiki>" bar
6292 |}
6293 !! html/php
6294 <table>
6295 <tr>
6296 <td title="foo">bar
6297 </td>
6298 <td title="foo&#124;">bar
6299 </td>
6300 <td> title="foo|" bar
6301 </td></tr></table>
6302
6303 !! html/parsoid
6304 <table>
6305 <tbody><tr><td title="foo">bar</td>
6306 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6307 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6308 </tbody></table>
6309 !! end
6310
6311 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6312 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6313 # *2wt modes will fail.
6314 !! test
6315 Table security: embedded pipes
6316 !! options
6317 parsoid=wt2html,html2html
6318 !! wikitext
6319 {|
6320 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6321 !! html/php
6322 <table>
6323 <tr>
6324 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6325 <td>]" onmouseover="alert(document.cookie)"&gt;test
6326 </td>
6327 </tr>
6328 </table>
6329
6330 !! html/parsoid
6331 <table><tbody>
6332 <tr>
6333 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6334 !! end
6335
6336 !! test
6337 Element attributes with double ! should not be broken up by <th>
6338 !! wikitext
6339 {|
6340 ! hi <div class="!!">ha</div> ho
6341 |}
6342 !! html/php
6343 <table>
6344 <tr>
6345 <th> hi <div class="!!">ha</div> ho
6346 </th></tr></table>
6347
6348 !! html/parsoid
6349 <table>
6350 <tbody><tr><th> hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6351 </tbody></table>
6352 !! end
6353
6354 !! test
6355 ! and || in element attributes should not be parsed as <th>/<td>
6356 !! wikitext
6357 {|
6358 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6359 |}
6360 !! html/php
6361 <table>
6362 <tr>
6363 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6364 </td></tr></table>
6365
6366 !! html/parsoid
6367 <table>
6368 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6369 </tbody></table>
6370 !! end
6371
6372 # FIXME: The output seems broken. Filed as T110268.
6373 !! test
6374 ! and || in td attributes should not be parsed as <th>/<td>
6375 !! options
6376 parsoid=wt2html
6377 !! wikitext
6378 {|
6379 | style="color: red !important;" data-contrived="put this here ||" | foo
6380 |}
6381 !! html/php
6382 <table>
6383 <tr>
6384 <td> style="color: red !important;" data-contrived="put this here </td>
6385 <td> foo
6386 </td></tr></table>
6387
6388 !! html/parsoid
6389 <table>
6390 <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>
6391 </tbody></table>
6392 !! end
6393
6394 !! test
6395 Break on | in element attribute in template
6396 !! options
6397 parsoid=wt2html,html2html
6398 !! wikitext
6399 {{echo|1=<div class="hi|ho">ha</div>}}
6400 !! html/php
6401 <p>ho"&gt;ha&lt;/div&gt;
6402 </p>
6403 !! html/parsoid
6404 <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>
6405 !! end
6406
6407 !! test
6408 Indented table markup mixed with indented pre content (proposed in bug 6200)
6409 !! wikitext
6410 <table>
6411 <tr>
6412 <td>
6413 Text that should be rendered preformatted
6414 </td>
6415 </tr>
6416 </table>
6417 !! html
6418 <table>
6419 <tr>
6420 <td>
6421 <pre>Text that should be rendered preformatted
6422 </pre>
6423 </td>
6424 </tr>
6425 </table>
6426
6427 !! end
6428
6429 !! test
6430 1. Template-generated table cell attributes and cell content
6431 !! wikitext
6432 {|
6433 |{{table_attribs}}
6434 | {{table_attribs}}
6435 || {{table_attribs_5}}
6436 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6437 |align=center {{table_attribs}}
6438 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6439 |}
6440 !! html
6441 <table>
6442 <tr>
6443 <td style="color:red;">Foo
6444 </td>
6445 <td style="color:red;">Foo
6446 </td>
6447 <td> style="color:red;"</td>
6448 <td>Bar
6449 </td>
6450 <td style="color:red;">Foo
6451 </td>
6452 <td align="center" style="color:red;">Foo
6453 </td>
6454 <td align="center" style="color:red;">Foo
6455 </td></tr></table>
6456
6457 !! end
6458
6459 !! test
6460 2. Template-generated table cell attributes and cell content
6461 !! wikitext
6462 {|
6463 |{{table_attribs_2}}
6464 |}
6465 !! html/php
6466 <table>
6467 <tr>
6468 <td style="color:red;">Foo
6469 </td>
6470 <td>Bar</td>
6471 <td>Baz
6472 </td></tr></table>
6473
6474 !! html/parsoid
6475 <table>
6476 <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>
6477 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6478 </tbody></table>
6479 !! end
6480
6481 !! test
6482 3. Template-generated table cell attributes and cell content
6483 !! wikitext
6484 {|
6485 !align=center {{table_header_cells}}
6486 |-
6487 |align=center {{table_cells}}
6488 |}
6489 !! html/php
6490 <table>
6491 <tr>
6492 <th align="center" style="color:red;">Foo</th>
6493 <th style="color:red;"><i>Bar</i></th>
6494 <th style="color:brown;"><i>Foo</i> and Baz
6495 </th></tr>
6496 <tr>
6497 <td align="center" style="color:red;">Foo</td>
6498 <td style="color:red;"><i>Bar</i></td>
6499 <td style="color:brown;"><i>Foo</i> and Baz
6500 </td></tr></table>
6501
6502 !! html/parsoid
6503 <table>
6504 <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>
6505 <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>
6506 </tbody></table>
6507 !! end
6508
6509 !! test
6510 4. Template-generated table cell attributes and cell content inside a templated table
6511 !! wikitext
6512 {{tbl-start}}
6513 !align=center {{table_header_cells}}
6514 |-
6515 |align=center {{table_cells}}
6516 {{tbl-end}}
6517 !! html/php
6518 <table>
6519 <tr>
6520 <th align="center" style="color:red;">Foo</th>
6521 <th style="color:red;"><i>Bar</i></th>
6522 <th style="color:brown;"><i>Foo</i> and Baz
6523 </th></tr>
6524 <tr>
6525 <td align="center" style="color:red;">Foo</td>
6526 <td style="color:red;"><i>Bar</i></td>
6527 <td style="color:brown;"><i>Foo</i> and Baz
6528 </td></tr></table>
6529
6530 !! html/parsoid
6531 <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}}]}'>
6532 <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>
6533 <tr>
6534 <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>
6535 </tbody></table>
6536 !! end
6537
6538 ## Edge case fix to prevent future regressions
6539 !! test
6540 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6541 !! wikitext
6542 {|
6543 |{{table_attribs_7}}
6544 |}
6545 <references />
6546 !! html/parsoid
6547 <table>
6548 <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>
6549 </tbody></table>
6550 <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>
6551 !! end
6552
6553 !! test
6554 Table with row followed by newlines and table heading
6555 !! wikitext
6556 {|
6557 |-
6558
6559 ! foo
6560 |}
6561 !! html
6562 <table>
6563
6564
6565 <tr>
6566 <th> foo
6567 </th></tr></table>
6568
6569 !! end
6570
6571 !! test
6572 Table with empty line following the start tag
6573 !! wikitext
6574 {|
6575
6576 |-
6577 | foo
6578 |}
6579 !! html
6580 <table>
6581
6582
6583 <tr>
6584 <td> foo
6585 </td></tr></table>
6586
6587 !! end
6588
6589 !! test
6590 Table attributes with empty value
6591 !! options
6592 parsoid=wt2html,html2html
6593 !! wikitext
6594 {|
6595 | style=| hello
6596 |}
6597 !! html/php
6598 <table>
6599 <tr>
6600 <td style=""> hello
6601 </td></tr></table>
6602
6603 !! html/parsoid
6604 <table>
6605 <tbody><tr><td style=""> hello</td></tr>
6606 </tbody></table>
6607 !! end
6608
6609 !! test
6610 Wikitext table with a lot of comments
6611 !! wikitext
6612 {|
6613 <!-- c0 -->
6614 | foo
6615 <!-- c1 -->
6616 |-<!-- c2 -->
6617 <!-- c3 -->
6618 |<!-- c4 -->
6619 <!-- c5 -->
6620 |}
6621 !! html
6622 <table>
6623 <tr>
6624 <td> foo
6625 </td></tr>
6626 <tr>
6627 <td>
6628 </td></tr></table>
6629
6630 !! end
6631
6632 !! test
6633 Wikitext table comments represented in parsoid dom
6634 !! wikitext
6635 {|<!--c1--><!--c2-->
6636 |-<!--c3-->
6637 | x
6638 |}
6639 !! html/php+tidy
6640 <table>
6641 <tr>
6642 <td>x</td>
6643 </tr>
6644 </table>
6645 !! html/parsoid
6646 <table><!--c1--><!--c2-->
6647 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6648 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6649 </tbody></table>
6650 !! end
6651
6652 !! test
6653 Wikitext table with double-line table cell
6654 !! wikitext
6655 {|
6656 |a
6657 b
6658 |}
6659 !! html
6660 <table>
6661 <tr>
6662 <td>a
6663 <p>b
6664 </p>
6665 </td></tr></table>
6666
6667 !! end
6668
6669 !! test
6670 Table cell with a single comment
6671 !! wikitext
6672 {|
6673 | <!-- c1 -->
6674 | a
6675 |}
6676 !! html
6677 <table>
6678 <tr>
6679 <td>
6680 </td>
6681 <td> a
6682 </td></tr></table>
6683
6684 !! end
6685
6686 !! test
6687 Table-cell after a comment-only-empty-line
6688 !! wikitext
6689 {|
6690 |a
6691 <!--c1-->
6692 <!--c2-->| b
6693 |}
6694 !! html
6695 <table>
6696 <tr>
6697 <td>a
6698 </td>
6699 <td> b
6700 </td></tr></table>
6701
6702 !! html/parsoid
6703 <table>
6704 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6705 <!--c1-->
6706 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6707 </tbody></table>
6708
6709 !! end
6710
6711 !! test
6712 Build table with {{!}}
6713 !! wikitext
6714 {{{!}} class="wikitable"
6715 ! header
6716 ! second header
6717 {{!}}- style="color:red;"
6718 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6719 {{!}}}
6720 !! html
6721 <table class="wikitable">
6722 <tr>
6723 <th> header
6724 </th>
6725 <th> second header
6726 </th></tr>
6727 <tr style="color:red;">
6728 <td> data </td>
6729 <td style="color:red;"> second data
6730 </td></tr></table>
6731
6732 !! end
6733
6734 !! test
6735 Build table with pipe as data
6736 !! wikitext
6737 {| class="wikitable"
6738 ! header
6739 ! second header
6740 |- style="color:red;"
6741 | data || style="color:red;" | second data
6742 |-
6743 | style="color:red;" | data with | || style="color:red;" | second data with |
6744 |-
6745 || data with | ||| second data with |
6746 |}
6747 !! html
6748 <table class="wikitable">
6749 <tr>
6750 <th> header
6751 </th>
6752 <th> second header
6753 </th></tr>
6754 <tr style="color:red;">
6755 <td> data </td>
6756 <td style="color:red;"> second data
6757 </td></tr>
6758 <tr>
6759 <td style="color:red;"> data with | </td>
6760 <td style="color:red;"> second data with |
6761 </td></tr>
6762 <tr>
6763 <td> data with | </td>
6764 <td> second data with |
6765 </td></tr></table>
6766
6767 !! end
6768
6769 !! test
6770 Build table with wikilink
6771 !! wikitext
6772 {| class="wikitable"
6773 ! header || second header
6774 |- style="color:red;"
6775 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6776 |-
6777 | data || second data [[Main Page|link|text with pipe]]
6778 |}
6779 !! html
6780 <table class="wikitable">
6781 <tr>
6782 <th> header </th>
6783 <th> second header
6784 </th></tr>
6785 <tr style="color:red;">
6786 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6787 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6788 </td></tr>
6789 <tr>
6790 <td> data </td>
6791 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6792 </td></tr></table>
6793
6794 !! end
6795
6796 # The expected HTML structure in this test is debatable. The PHP parser does
6797 # not parse this kind of table at all. The main focus for Parsoid is on
6798 # round-tripping, so this output is ok for now. TODO: revisit!
6799 !! test
6800 Wikitext table with html-syntax row
6801 !! wikitext
6802 {|
6803 |-
6804 <td>foo</td>
6805 |}
6806 !! html/parsoid
6807 <table>
6808 <tbody>
6809 <tr>
6810 <td>foo</td></tr></tbody></table>
6811 !! end
6812
6813 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6814 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6815 ## PHP parser, which tidy then compounds by fostering the content
6816 ## entirely out of the table. Parsoid recognizes the table context
6817 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6818 ## depends on PHP's treatment of broken table markup!
6819 !! test
6820 Implicit <td> after a |-
6821 !! options
6822 parsoid=wt2html,html2html
6823 !! wikitext
6824 {|
6825 |-
6826 a
6827 |}
6828 !! html/php
6829 <table>
6830
6831 a
6832 </table>
6833
6834 !! html/php+tidy
6835 <p>a</p>
6836 !! html/parsoid
6837 <table>
6838 <tr><td>a</td></tr>
6839 </table>
6840 !! end
6841
6842 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6843 !! test
6844 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6845 !! options
6846 parsoid=wt2html,html2html
6847 !! wikitext
6848 {|
6849 |-
6850 |
6851 a
6852 |-
6853 b
6854 |}
6855 !! html/php
6856 <table>
6857
6858 <tr>
6859 <td>
6860 <pre>a
6861 </pre>
6862 </td></tr>
6863 b
6864 </table>
6865
6866 !! html/php+tidy
6867 <p>b</p>
6868 <table>
6869 <tr>
6870 <td>
6871 <pre>
6872 a
6873 </pre></td>
6874 </tr>
6875 </table>
6876 !! html/parsoid
6877 <table>
6878 <tbody>
6879 <tr><td><pre>a</pre></td></tr>
6880 <tr><td> b</td></tr>
6881 </tbody>
6882 </table>
6883 !! end
6884
6885 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6886 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6887 !! test
6888 Lists should be recognized in an implicit <td> context
6889 !! options
6890 parsoid=wt2html,html2html
6891 !! wikitext
6892 {|
6893 |-
6894 *a
6895 |}
6896 !! html/php
6897 <table>
6898
6899 <ul><li>a</li></ul>
6900 </table>
6901
6902 !! html/php+tidy
6903 <ul>
6904 <li>a</li>
6905 </ul>
6906 !! html/parsoid
6907 <table>
6908 <tr>
6909 <td><ul>
6910 <li>a</li>
6911 </ul></td>
6912 </tr>
6913 </table>
6914 !! end
6915
6916 !! test
6917 Table cells not properly parsed in an implicit-td context
6918 !! wikitext
6919 {|
6920 |-
6921 {{table_attribs_4}} || a || b
6922 |}
6923 !! html/php+tidy
6924 <table>
6925 <tr>
6926 <td style="background-color:#DC241f;" width="10px"></td>
6927 <td>a</td>
6928 <td>b</td>
6929 </tr>
6930 </table>
6931 !! html/parsoid
6932 <table>
6933 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6934 <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>
6935 </tbody></table>
6936 !! end
6937
6938 !! test
6939 Parsoid: Round-trip tables directly followed by content (bug 51219)
6940 !! options
6941 parsoid=wt2html,wt2wt
6942 !! wikitext
6943 {|
6944 |foo
6945 |} bar
6946
6947 {|
6948 |baz
6949 |}<b>quux</b>
6950 !! html+tidy
6951 <table>
6952 <tr>
6953 <td>foo</td>
6954 </tr>
6955 </table>
6956 <p>bar</p>
6957 <table>
6958 <tr>
6959 <td>baz</td>
6960 </tr>
6961 </table>
6962 <p><b>quux</b></p>
6963 !! end
6964
6965 !! test
6966 Parsoid: Default to a newline after tables in new content (bug 51219)
6967 !! options
6968 parsoid=html2wt
6969 !! html/parsoid
6970 <table><tbody>
6971 <tr><td>foo</td></tr></tbody></table> bar
6972 <table><tbody>
6973 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6974 !! wikitext
6975 {|
6976 |foo
6977 |}
6978 <nowiki> </nowiki>bar
6979 {|
6980 |baz
6981 |}
6982 '''quux'''
6983 !! end
6984
6985 !! test
6986 Parsoid: newline inducing block nodes don't suppress <nowiki>
6987 !! options
6988 parsoid=html2wt
6989 !! html/parsoid
6990 a<h1>foo</h1>
6991 !! wikitext
6992 <nowiki> </nowiki>a
6993
6994 = foo =
6995 !! end
6996
6997 !! test
6998 Parsoid: Row-syntax table headings followed by comment & table cells
6999 !! options
7000 parsoid=wt2html,wt2wt
7001 !! wikitext
7002 {|
7003 ! foo || bar
7004 <!-- foo --> || baz || quux
7005 |}
7006 !! html/php
7007 <table>
7008 <tr>
7009 <th> foo </th>
7010 <th> bar
7011 </th>
7012 <td> baz </td>
7013 <td> quux
7014 </td></tr></table>
7015
7016 !! html/parsoid
7017 <table>
7018 <tbody><tr><th> foo </th><th> bar
7019 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7020 </tbody></table>
7021 !! end
7022
7023 !!test
7024 Parsoid: Recover better from broken table attributes
7025 !!options
7026 parsoid=wt2html
7027 !!wikitext
7028 {| class="foo
7029 | class="bar" |
7030 foo
7031 |}
7032 !!html/php+tidy
7033 <table class="foo">
7034 <tr>
7035 <td class="bar">
7036 <p>foo</p>
7037 </td>
7038 </tr>
7039 </table>
7040 !!html/parsoid
7041 <table class="foo">
7042 <tr>
7043 <td class="bar">
7044 <p>foo</p></td></tr>
7045 </tbody></table>
7046 !!end
7047
7048 !! test
7049 Tables: Digest broken attributes on table and tr tag
7050 !! options
7051 parsoid=wt2html
7052 !! wikitext
7053 {| || |} ++
7054 |- || || ++ --
7055 |- > [
7056 |}
7057 !! html
7058 <table>
7059 <tbody>
7060 <tr></tr>
7061 <tr></tr>
7062 </tbody></table>
7063 !! end
7064
7065 !! test
7066 Strip unsupported table tags
7067 !! options
7068 parsoid=html2wt
7069 !! html/parsoid
7070 <table>
7071 <thead>
7072 <tr>
7073 <th>Month</th>
7074 <th>Savings</th>
7075 </tr>
7076 </thead>
7077 <tbody>
7078 <tr>
7079 <td>January</td>
7080 <td>$100</td>
7081 </tr>
7082 <tr>
7083 <td>February</td>
7084 <td>$80</td>
7085 </tr>
7086 </tbody>
7087 <tfoot>
7088 <tr>
7089 <td>Sum</td>
7090 <td>$180</td>
7091 </tr>
7092 </tfoot>
7093 </table>
7094 !! wikitext
7095 {|
7096
7097 !Month
7098 !Savings
7099
7100 |January
7101 |$100
7102
7103 |-
7104 |February
7105 |$80
7106
7107 |Sum
7108 |$180
7109
7110 |}
7111 !! end
7112
7113 !!test
7114 Testing serialization after deletion of table cells
7115 !!options
7116 parsoid={
7117 "modes": ["wt2wt", "selser"],
7118 "changes": [
7119 ["#x", "remove"]
7120 ]
7121 }
7122 !!wikitext
7123 {|
7124 !h1 !!h2 !!h3
7125 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7126 |}
7127 !! wikitext/edited
7128 {|
7129 !h1 !!h2 !!h3
7130 |c2 |||c3
7131 |}
7132 !!end
7133
7134 ###
7135 ### Internal links
7136 ###
7137 !! test
7138 Plain link, capitalized
7139 !! wikitext
7140 [[Main Page]]
7141 !! html
7142 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7143 </p>
7144 !! end
7145
7146 !! test
7147 Plain link, uncapitalized
7148 !! wikitext
7149 [[main Page]]
7150 !! html
7151 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7152 </p>
7153 !! end
7154
7155 !! test
7156 Piped link
7157 !! wikitext
7158 [[Main Page|The Main Page]]
7159 !! html
7160 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7161 </p>
7162 !! end
7163
7164 !! test
7165 Piped link with comment in link text
7166 !! wikitext
7167 [[Main Page|The Main<!--front--> Page]]
7168 !! html
7169 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7170 </p>
7171 !! end
7172
7173 !! test
7174 Piped link with multiple pipe characters in link text
7175 !! wikitext
7176 [[Main Page||The|Main|Page|]]
7177 !! html/php
7178 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7179 </p>
7180 !! html/parsoid
7181 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7182 !! end
7183
7184 !! test
7185 Piped link with no link text
7186 !! wikitext
7187 [[Thomas Bek (bishop of St David's)|]]
7188 !! html/php
7189 <p>[[Thomas Bek (bishop of St David's)|]]
7190 </p>
7191 !! html/parsoid
7192 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7193 !! end
7194
7195 !! test
7196 Broken link
7197 !! wikitext
7198 [[Zigzagzogzagzig]]
7199 !! html
7200 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7201 </p>
7202 !! end
7203
7204 !! test
7205 Broken link with fragment
7206 !! wikitext
7207 [[Zigzagzogzagzig#zug]]
7208 !! html
7209 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7210 </p>
7211 !! end
7212
7213 !! test
7214 Special page link with fragment
7215 !! wikitext
7216 [[Special:Version#anchor]]
7217 !! html
7218 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7219 </p>
7220 !! end
7221
7222 !! test
7223 Nonexistent special page link with fragment
7224 !! wikitext
7225 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7226 !! html
7227 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7228 </p>
7229 !! end
7230
7231 !! test
7232 Link with prefix
7233 !! wikitext
7234 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7235 !! html
7236 <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>
7237 </p>
7238 !! end
7239
7240 !! test
7241 Link with suffix
7242 !! wikitext
7243 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7244 !! html
7245 <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>!!!
7246 </p>
7247 !! end
7248
7249 !! article
7250 prefixed article
7251 !! text
7252 Some text
7253 !! endarticle
7254
7255 !! test
7256 Bug 43661: Piped links with identical prefixes
7257 !! wikitext
7258 [[prefixed article|prefixed articles with spaces]]
7259
7260 [[prefixed article|prefixed articlesaoeu]]
7261
7262 [[Main Page|Main Page test]]
7263 !! html
7264 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7265 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7266 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7267 </p>
7268 !! end
7269
7270
7271 !! test
7272 Link with HTML entity in suffix / tail
7273 !! wikitext
7274 [[Main Page]]&quot;, [[Main Page]]&#97;
7275 !! html/php
7276 <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;
7277 </p>
7278 !! html/parsoid
7279 <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>
7280 !! end
7281
7282 !! test
7283 Link with 3 brackets
7284 !! wikitext
7285 [[[Main Page]]]
7286 Foo [[[Main Page]]]
7287 !! html
7288 <p>[[[Main Page]]]
7289 Foo [[[Main Page]]]
7290 </p>
7291 !! end
7292
7293 !! test
7294 Link with 4 brackets
7295 !! wikitext
7296 [[[[Main Page]]]]
7297 !! html
7298 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7299 </p>
7300 !! end
7301
7302 !! test
7303 Piped link with 3 brackets
7304 !! wikitext
7305 [[[main page|the main page]]]
7306 !! html
7307 <p>[[[main page|the main page]]]
7308 </p>
7309 !! end
7310
7311 !! test
7312 Piped link with extlink-like text
7313 !! wikitext
7314 [[Main Page|[bar]]]
7315 [[Main Page|This is a [bar]]]
7316 !! html/php
7317 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7318 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7319 </p>
7320 !! html/parsoid
7321 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7322 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7323 !! end
7324
7325 !! test
7326 Link with multiple pipes
7327 !! wikitext
7328 [[Main Page|The|Main|Page]]
7329 !! html
7330 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7331 </p>
7332 !! end
7333
7334 # Note that parsoid does not munge anchor text; all non-space
7335 # characters are valid in HTML5 ids.
7336 !! test
7337 Anchor containing a #. (bug 63430)
7338 !! wikitext
7339 [[Main Page#And#Link]]
7340 !! html/php
7341 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7342 </p>
7343 !! html/parsoid
7344 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
7345 !! end
7346
7347 !! test
7348 Link to namespaces
7349 !! wikitext
7350 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7351 !! html
7352 <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>
7353 </p>
7354 !! end
7355
7356 !! test
7357 Link with space in namespace
7358 !! wikitext
7359 [[User talk:Foo bar]]
7360 !! html
7361 <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>
7362 </p>
7363 !! end
7364
7365 !! article
7366 MemoryAlpha:AlphaTest
7367 !! text
7368 This is an article in the MemoryAlpha namespace
7369 (which shadows the memoryalpha interwiki link).
7370 !! endarticle
7371
7372 !! test
7373 Namespace takes precedence over interwiki link (bug 51680)
7374 !! wikitext
7375 [[MemoryAlpha:AlphaTest]]
7376 !! html
7377 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7378 </p>
7379 !! end
7380
7381 # The previous test doesn't work correctly in html2*, due to not recognizing the
7382 # link as an internal one. This one checks for the correct behavior.
7383 !! test
7384 Link to namespace preferred over interwiki with correct rel attribute
7385 !! options
7386 parsoid=html2wt,html2html
7387 !! html/parsoid
7388 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7389 !! wikitext
7390 [[MemoryAlpha:AlphaTest]]
7391 !! end
7392
7393 !! test
7394 Piped link to namespace
7395 !! wikitext
7396 [[Meta:Disclaimers|The disclaimers]]
7397 !! html
7398 <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>
7399 </p>
7400 !! end
7401
7402 !! test
7403 Link containing }
7404 !! wikitext
7405 [[Usually caused by a typo (oops}]]
7406 !! html
7407 <p>[[Usually caused by a typo (oops}]]
7408 </p>
7409 !! end
7410
7411 !! article
7412 7% Solution
7413 !! text
7414 Just a test of an article title containing a percent.
7415 !! endarticle
7416
7417 !! test
7418 Link containing % (not as a hex sequence)
7419 !! wikitext
7420 [[7% Solution]]
7421 !! html/php
7422 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7423 </p>
7424 !! html/parsoid
7425 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7426 !! end
7427
7428 # note that the parsoid HTML is identical to the previous test output,
7429 # so the previous test ensures that the html2wt mode will generate the
7430 # "not as a hex sequence" wikitext.
7431 !! test
7432 Link containing % as a single hex sequence interpreted to char
7433 !! options
7434 parsoid=wt2wt,wt2html,html2html
7435 !! wikitext
7436 [[7%25 Solution]]
7437 !! html/php
7438 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7439 </p>
7440 !! html/parsoid
7441 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7442 !!end
7443
7444 !! test
7445 Link containing % as a double hex sequence interpreted to hex sequence
7446 !! wikitext
7447 [[7%2525 Solution]]
7448 !! html
7449 <p>[[7%2525 Solution]]
7450 </p>
7451 !!end
7452
7453 # note that parsoid does not munge anchor text; all non-space
7454 # characters are valid in HTML5 anchors.
7455 !! test
7456 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7457 Example for such a section: == < ==
7458 !! wikitext
7459 [[%23%3c]][[%23%3e]]
7460 !! html/php
7461 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7462 </p>
7463 !! html/parsoid
7464 <p><a rel="mw:WikiLink" href="./Main%20Page#%3C" title="Main Page">#&lt;</a><a rel="mw:WikiLink" href="./Main%20Page#%3E" title="Main Page">#></a></p>
7465 !! end
7466
7467 !! test
7468 Link containing "<#" and ">#" as a hex sequences
7469 !! wikitext
7470 [[%3c%23]][[%3e%23]]
7471 !! html
7472 <p>[[%3c%23]][[%3e%23]]
7473 </p>
7474 !! end
7475
7476 !! test
7477 Link containing an equals sign
7478 !! wikitext
7479 [[Special:BookSources/isbn=4-00-026157-6]]
7480 !! html/php
7481 <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>
7482 </p>
7483 !! html/parsoid
7484 <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>
7485 !! end
7486
7487 !! article
7488 Foo~bar
7489 !! text
7490 Just a test of an article title containing a tilde.
7491 !! endarticle
7492
7493 # note that links containing signatures, like [[Foo~~~~]], are
7494 # massaged by the pre-save transform (PST) and so the tildes are never
7495 # seen by the parser.
7496 !! test
7497 Link containing a tilde
7498 !! wikitext
7499 [[Foo~bar]]
7500 !! html/php
7501 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7502 </p>
7503 !! html/parsoid
7504 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7505 !! end
7506
7507 !! test
7508 Link containing double-single-quotes '' (bug 4598)
7509 !! wikitext
7510 [[Lista d''e paise d''o munno]]
7511 !! html/php
7512 <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>
7513 </p>
7514 !! html/parsoid
7515 <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>
7516 !! end
7517
7518 !! test
7519 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7520 !! wikitext
7521 Some [[Link|pretty ''italics'' and stuff]]!
7522 !! html/php
7523 <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>!
7524 </p>
7525 !! html/parsoid
7526 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7527 !! end
7528
7529 !! test
7530 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7531 !! wikitext
7532 ''Some [[Link|pretty ''italics'' and stuff]]!''
7533 !! html
7534 <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>
7535 </p>
7536 !! end
7537
7538 !! test
7539 Link with double quotes in title part (literal) and alternate part (interpreted)
7540 !! wikitext
7541 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7542
7543 [[''Pentecoste'']]
7544
7545 [[''Pentecoste''|Pentecoste]]
7546
7547 [[''Pentecoste''|''Pentecoste'']]
7548 !! html/php
7549 <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>
7550 </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>
7551 </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>
7552 </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>
7553 </p>
7554 !! html/parsoid
7555 <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>
7556 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7557 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7558 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7559 !! end
7560
7561 !! test
7562 Broken image links with HTML captions (bug 39700)
7563 !! wikitext
7564 [[File:Nonexistent|<script></script>]]
7565 [[File:Nonexistent|100x100px|<script></script>]]
7566 [[File:Nonexistent|&lt;]]
7567 [[File:Nonexistent|a<i>b</i>c]]
7568 !! html/php
7569 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7570 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7571 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7572 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7573 </p>
7574 !! html/parsoid
7575 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;script&amp;gt;&amp;lt;/script&amp;gt;"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span>
7576 <span typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;script&amp;gt;&amp;lt;/script&amp;gt;"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="100" width="100"/></a></span>
7577 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=\"{&amp;quot;src&amp;quot;:&amp;quot;&amp;amp;lt;&amp;quot;,&amp;quot;srcContent&amp;quot;:&amp;quot;&lt;&amp;quot;,&amp;quot;dsr&amp;quot;:[107,111,null,null]}\">&amp;lt;&lt;/span>"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span>
7578 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"a&lt;i data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[134,142,3,4]}\">b&lt;/i>c"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span></p>
7579 !! end
7580
7581 !! test
7582 Plain link to URL
7583 !! wikitext
7584 [[http://www.example.com]]
7585 !! html/php
7586 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7587 </p>
7588 !! html/parsoid
7589 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7590 !! end
7591
7592 !! test
7593 Plain link to URL with link text
7594 !! wikitext
7595 [[http://www.example.com Link text]]
7596 !! html
7597 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7598 </p>
7599 !! end
7600
7601 !! test
7602 Plain link to protocol-relative URL
7603 !! wikitext
7604 [[//www.example.com]]
7605 !! html/php
7606 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7607 </p>
7608 !! html/parsoid
7609 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7610 !! end
7611
7612 !! test
7613 Plain link to protocol-relative URL with link text
7614 !! wikitext
7615 [[//www.example.com Link text]]
7616 !! html
7617 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7618 </p>
7619 !! end
7620
7621 !! test
7622 Plain link to page with question mark in title
7623 !! wikitext
7624 [[A?b]]
7625
7626 [[A?b|Baz]]
7627 !! html
7628 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7629 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7630 </p>
7631 !! end
7632
7633
7634 # I'm fairly sure the expected result here is wrong.
7635 # We want these to be URL links, not pseudo-pages with URLs for titles....
7636 # However the current output is also pretty screwy.
7637 #
7638 # ----
7639 # I'm changing it to match the current output--it arguably makes more
7640 # sense in the light of the test above. Old expected result was:
7641 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7642 #</p>
7643 # But I think this test is bordering on "garbage in, garbage out" anyway.
7644 # -- wtm
7645 !! test
7646 Piped link to URL
7647 !! wikitext
7648 Piped link to URL: [[http://www.example.com|an example URL]]
7649 !! html/php
7650 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7651 </p>
7652 !! html/parsoid
7653 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7654 !! end
7655
7656 !! test
7657 BUG 2: [[page|http://url/]] should link to page, not http://url/
7658 !! wikitext
7659 [[Main Page|http://url/]]
7660 !! html/php
7661 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7662 </p>
7663 !! html/parsoid
7664 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7665 !! end
7666
7667 # Parsoid does not mark self-links, by design.
7668 !! test
7669 BUG 337: Escaped self-links should be bold
7670 !! options
7671 title=[[Bug462]]
7672 !! wikitext
7673 [[Bu&#103;462]] [[Bug462]]
7674 !! html/php
7675 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7676 </p>
7677 !! html/php+tidy
7678 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7679 !! html/parsoid
7680 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7681 !! end
7682
7683 !! test
7684 Self-link to section should not be bold
7685 !! options
7686 title=[[Main Page]]
7687 !! wikitext
7688 [[Main Page#section]]
7689 !! html
7690 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7691 </p>
7692 !! end
7693
7694 !! article
7695 00
7696 !! text
7697 This is 00.
7698 !! endarticle
7699
7700 !!test
7701 Self-link to numeric title
7702 !!options
7703 title=[[0]]
7704 !! wikitext
7705 [[0]]
7706 !! html
7707 <p><strong class="selflink">0</strong>
7708 </p>
7709 !!end
7710
7711 !!test
7712 Link to numeric-equivalent title
7713 !!options
7714 title=[[0]]
7715 !! wikitext
7716 [[00]]
7717 !! html
7718 <p><a href="/wiki/00" title="00">00</a>
7719 </p>
7720 !!end
7721
7722 !! test
7723 <nowiki> inside a link
7724 !! wikitext
7725 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7726 !! html
7727 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7728 </p>
7729 !! end
7730
7731 !! test
7732 Non-breaking spaces in title
7733 !! wikitext
7734 [[&nbsp; Main &nbsp; Page &nbsp;]]
7735 !! html
7736 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7737 </p>
7738 !!end
7739
7740 !! test
7741 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7742 !! options
7743 language=ca
7744 !! wikitext
7745 '''[[Main Page]]'''
7746 !! html
7747 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7748 </p>
7749 !! end
7750
7751 !! test
7752 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7753 !! options
7754 language=ca
7755 !! wikitext
7756 ''[[Main Page]]''
7757 !! html
7758 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7759 </p>
7760 !! end
7761
7762 !! test
7763 Internal link with en linktrail: no apostrophes (bug 27473)
7764 !! options
7765 language=en
7766 !! wikitext
7767 [[Something]]'nice
7768 !! html
7769 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
7770 </p>
7771 !! end
7772
7773 !! test
7774 Internal link with ca linktrail with apostrophes (bug 27473)
7775 !! options
7776 language=ca
7777 !! wikitext
7778 [[Something]]'nice
7779 !! html
7780 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
7781 </p>
7782 !! end
7783
7784 !! test
7785 Internal link with kaa linktrail with apostrophes (bug 27473)
7786 !! options
7787 language=kaa
7788 !! wikitext
7789 [[Something]]'nice
7790 !! html
7791 <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>
7792 </p>
7793 !! end
7794
7795 !! test
7796 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
7797 !! wikitext
7798 [[User:Foo/Test/63636:Bar|Test]]
7799 !! html/php
7800 <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>
7801 </p>
7802 !! html/parsoid
7803 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
7804 !! end
7805
7806 !! test
7807 Purely hash wikilink
7808 !! options
7809 title=[[User:test/123]]
7810 !! wikitext
7811 [[#a|b]]
7812 !! html/php
7813 <p><a href="#a">b</a>
7814 </p>
7815 !! html/parsoid
7816 <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>
7817 !! end
7818
7819 !! test
7820 1. Interaction of linktrail and template encapsulation
7821 !! options
7822 parsoid
7823 !! wikitext
7824 {{echo|[[Foo]]}}l
7825 !! html
7826 <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>
7827 !! end
7828
7829 !! test
7830 2. Interaction of linktrail and template encapsulation
7831 !! options
7832 parsoid
7833 !! wikitext
7834 {{echo|Some [[Fool]]}}s
7835 !! html
7836 <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>
7837 !! end
7838
7839 !! test
7840 3. Interaction of linktrail and template encapsulation
7841 !! options
7842 parsoid
7843 !! wikitext
7844 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
7845 !! html
7846 <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>
7847 !! end
7848
7849 !! article
7850 Söfnuður
7851 !! text
7852 Test.
7853 !! endarticle
7854
7855 !! test
7856 Internal link with is link prefix
7857 !! options
7858 language=is
7859 !! wikitext
7860 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
7861 !! html
7862 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
7863 </p>
7864 !! end
7865
7866 !! article
7867 Mótmælendatrú
7868 !! text
7869 Test.
7870 !! endarticle
7871
7872 !! test
7873 Internal link with is link trail and link prefix
7874 !! options
7875 language=is
7876 !! wikitext
7877 [[mótmælendatrú|xxx]]ar
7878 [[mótmælendatrú]]ar
7879 mótmælenda[[söfnuður]]
7880 mótmælenda[[söfnuður|söfnuðir]]
7881 mótmælenda[[söfnuður|söfnuðir]]xxx
7882 !! html
7883 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
7884 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
7885 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
7886 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
7887 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
7888 </p>
7889 !! end
7890
7891 !! test
7892 Parsoid link trail escaping
7893 !! options
7894 parsoid=html2wt,html2html
7895 !! html/parsoid
7896 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
7897 !! wikitext
7898 [[apple]]<nowiki/>s
7899 !! end
7900
7901 !! test
7902 Parsoid link prefix escaping
7903 !! options
7904 language=is
7905 parsoid=html2wt,html2html
7906 !! html/parsoid
7907 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
7908 !! wikitext
7909 Aðrir mótmælenda<nowiki/>[[söfnuður]]
7910 !! end
7911
7912 !! test
7913 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
7914 !! wikitext
7915 [[Foo| bar]]
7916
7917 [[Foo| ''bar'']]
7918
7919 [http://wp.org foo]
7920
7921 [http://wp.org ''foo'']
7922 !! html
7923 <p><a href="/wiki/Foo" title="Foo"> bar</a>
7924 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
7925 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
7926 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
7927 </p>
7928 !! end
7929
7930 !! test
7931 Parsoid: Scoped parsing should handle mixed transclusions and plain text
7932 !! options
7933 parsoid
7934 !! wikitext
7935 [[Foo|{{echo|a}} b {{echo|c}}]]
7936 !! html
7937 <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>
7938 !! end
7939
7940 !! test
7941 Link with angle bracket after anchor
7942 !! wikitext
7943 [[Foo#<bar>]]
7944 !! html/php
7945 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
7946 </p>
7947 !! html/parsoid
7948 <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>
7949 !! end
7950
7951 ###
7952 ### Interwiki links (see maintenance/interwiki.sql)
7953 ###
7954
7955 !! test
7956 Inline interwiki link
7957 !! options
7958 parsoid=wt2html,wt2wt,html2html
7959 !! wikitext
7960 [[MeatBall:SoftSecurity]]
7961 !! html/php
7962 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
7963 </p>
7964 !! html/parsoid
7965 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
7966 !! end
7967
7968 !! test
7969 Inline interwiki link with empty title (bug 2372)
7970 !! options
7971 parsoid=wt2html,wt2wt,html2html
7972 !! wikitext
7973 [[MeatBall:]]
7974 !! html/php
7975 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
7976 </p>
7977 !! html/parsoid
7978 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
7979 !! end
7980
7981 !! test
7982 Interwiki link encoding conversion (bug 1636)
7983 !! wikitext
7984 *[[Wikipedia:ro:Olteni&#0355;a]]
7985 *[[Wikipedia:ro:Olteni&#355;a]]
7986 !! html
7987 <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>
7988 <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>
7989
7990 !! html+tidy
7991 <ul>
7992 <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>
7993 <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>
7994 </ul>
7995 !! end
7996
7997 !! test
7998 Interwiki link with fragment (bug 2130)
7999 !! wikitext
8000 [[MeatBall:SoftSecurity#foo]]
8001 !! html
8002 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8003 </p>
8004 !! end
8005
8006 # Ideally the wikipedia: prefix here should be proto-relative too
8007 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8008 # define the 'en' prefix, and originally the test used 'wikipedia',
8009 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8010 # article.
8011 !! test
8012 Different interwiki prefixes mapping to the same URL
8013 !! wikitext
8014 [[:en:Foo]]
8015
8016 [[:en:Foo|Foo]]
8017
8018 [[wikipedia:Foo]]
8019
8020 [[:wikipedia:Foo|Foo]]
8021
8022 [[wikipedia:en:Foo]]
8023
8024 [[:wikipedia:en:Foo]]
8025
8026 [[ wikiPEdia :Foo]]
8027 !! html/parsoid
8028 <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>
8029
8030 <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>
8031
8032 <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>
8033
8034 <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>
8035
8036 <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>
8037
8038 <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>
8039
8040 <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>
8041 !! end
8042
8043 !! test
8044 Interwiki links that cannot be represented in wiki syntax
8045 !! wikitext
8046 [[meatball:ok]]
8047 [[meatball:ok#foo|ok with fragment]]
8048 [[meatball:ok_as_well?|ok ending with ? mark]]
8049 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8050 [http://de.wikipedia.org/wiki/#foo is just fragment]
8051
8052 !! html/php
8053 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8054 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8055 <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>
8056 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8057 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8058 </p>
8059 !! html/parsoid
8060 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8061 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8062 <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>
8063 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8064 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8065 !! end
8066
8067 !! test
8068 Interwiki links: trail
8069 !! wikitext
8070 [[wikipedia:Foo|Ba]]r
8071 !! html/php
8072 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8073 </p>
8074 !! html/parsoid
8075 <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>
8076 !! end
8077
8078 !! test
8079 Local interwiki link
8080 !! options
8081 parsoid=wt2html,wt2wt,html2html
8082 !! wikitext
8083 [[local:Template:Foo]]
8084 !! html/php
8085 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8086 </p>
8087 !! html/parsoid
8088 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8089 !! end
8090
8091 # Parsoid does not mark self-links, by design.
8092 !! test
8093 Local interwiki link: self-link to current page
8094 !! options
8095 title=[[Main Page]]
8096 parsoid=wt2html,wt2wt,html2html
8097 !! wikitext
8098 [[local:Main Page]]
8099 !! html/php
8100 <p><strong class="selflink">local:Main Page</strong>
8101 </p>
8102 !! html/parsoid
8103 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8104 !! end
8105
8106 !! test
8107 Local interwiki link: prefix only (bug 64167)
8108 !! options
8109 parsoid=wt2html,wt2wt,html2html
8110 !! wikitext
8111 [[local:]]
8112 !! html/php
8113 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8114 </p>
8115 !! html/parsoid
8116 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8117 !! end
8118
8119 !! test
8120 Local interwiki link: with additional interwiki prefix (bug 61357)
8121 !! options
8122 parsoid=wt2html,wt2wt,html2html
8123 !! wikitext
8124 [[local:meatball:Hello]]
8125 !! html/php
8126 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8127 </p>
8128 !! html/parsoid
8129 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8130 !! end
8131
8132 !! test
8133 Multiple local interwiki link prefixes
8134 !! wikitext
8135 [[local:local:local:local:mi:local:Foo]]
8136 !! options
8137 parsoid=wt2html,wt2wt,html2html
8138 !! html/php
8139 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8140 </p>
8141 !! html/parsoid
8142 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8143 !! end
8144
8145 ###
8146 ### Interlanguage links
8147 ### Language links (so that searching for '### language' matches..)
8148 ###
8149
8150 !! test
8151 Interlanguage link
8152 !! options
8153 parsoid=wt2html,wt2wt,html2html
8154 !! wikitext
8155 Blah blah blah
8156 [[zh:Chinese]]
8157 !! html/php
8158 <p>Blah blah blah
8159 </p>
8160 !! html/parsoid
8161 <p>Blah blah blah</p>
8162 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8163 !! end
8164
8165 !! test
8166 Interlanguage link with spacing
8167 !! options
8168 parsoid=wt2html,wt2wt,html2html
8169 !! wikitext
8170 Blah blah blah
8171 [[ zh : Chinese ]]
8172 !! html/php
8173 <p>Blah blah blah
8174 </p>
8175 !! html/parsoid
8176 <p>Blah blah blah</p>
8177 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8178 !! end
8179
8180 !! test
8181 Double interlanguage link
8182 !! options
8183 parsoid=wt2html,wt2wt,html2html
8184 !! wikitext
8185 Blah blah blah
8186 [[es:Spanish]]
8187 [[zh:Chinese]]
8188 !! html/php
8189 <p>Blah blah blah
8190 </p>
8191 !! html/parsoid
8192 <p>Blah blah blah</p>
8193 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8194 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8195 !! end
8196
8197 !! test
8198 Interlanguage link variations
8199 !! options
8200 parsoid=wt2html,wt2wt,html2html
8201 !! wikitext
8202 Blah blah blah
8203 [[ es :Spanish]]
8204 [[ ZH :Chinese]]
8205 [[es:Foo_bar]]
8206 !! html/php
8207 <p>Blah blah blah
8208 </p>
8209 !! html/parsoid
8210 <p>Blah blah blah</p>
8211 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8212 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8213 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8214 !! end
8215
8216 !! test
8217 Space and question mark encoding in interlanguage links (T95473)
8218 !! options
8219 parsoid=wt2html,wt2wt,html2html
8220 !! wikitext
8221 Blah blah blah
8222 [[es:Foo bar?]]
8223 !! html/php
8224 <p>Blah blah blah
8225 </p>
8226 !! html/parsoid
8227 <p>Blah blah blah</p>
8228 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8229 !! end
8230
8231 !! test
8232 Interlanguage link, with prefix links
8233 !! options
8234 language=ln
8235 !! wikitext
8236 Blah blah blah
8237 [[zh:Chinese]]
8238 !! html/php
8239 <p>Blah blah blah
8240 </p>
8241 !! html/parsoid
8242 <p>Blah blah blah</p>
8243 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8244 !! end
8245
8246 !! test
8247 Double interlanguage link, with prefix links (bug 8897)
8248 !! options
8249 language=ln
8250 !! wikitext
8251 Blah blah blah
8252 [[es:Spanish]]
8253 [[zh:Chinese]]
8254 !! html/php
8255 <p>Blah blah blah
8256 </p>
8257 !! html/parsoid
8258 <p>Blah blah blah</p>
8259 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8260 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8261 !! end
8262
8263 !! test
8264 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8265 !! wikitext
8266 Blah blah blah
8267 [[mul:Article]]
8268 !! html/php
8269 <p>Blah blah blah
8270 </p>
8271 !! html/parsoid
8272 <p>Blah blah blah</p>
8273 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8274 !! end
8275
8276 !! test
8277 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8278 !! options
8279 language=ln
8280 !! wikitext
8281 [[WW&nbsp;II]]
8282 !! html
8283 <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>
8284 </p>
8285 !! end
8286
8287 !! test
8288 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8289 !! options
8290 parsoid=html2wt
8291 !! html/parsoid
8292 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8293 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8294 !! wikitext
8295 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8296
8297 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
8298 !! end
8299
8300 !! test
8301 Parsoid: handle constructor well
8302 !! wikitext
8303 [[constructor]]
8304
8305 [[constructor:foo]]
8306 !! html/php
8307 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8308 </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>
8309 </p>
8310 !! html/parsoid
8311 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid="{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;./Constructor&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;constructor&quot;}}">constructor</a></p>
8312
8313 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid="{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;./Foo&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;constructor:foo&quot;}}">constructor:foo</a></p>
8314 !! end
8315
8316 !! article
8317 ko:
8318 !! text
8319 Test.
8320 !! endarticle
8321
8322 # Note that `ko` isn't a known interlanguage prefix
8323 !! test
8324 Parsoid: recognize interlanguage links without a target page
8325 !! options
8326 ill
8327 !! wikitext
8328 [[es:]]
8329
8330 [[ko:]]
8331 !! html/php
8332 es:
8333 !! html/parsoid
8334 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8335
8336 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8337 !! end
8338
8339 # Note that `ko` isn't a known interwiki prefix
8340 !! test
8341 Parsoid: recognize interwiki links without a target page
8342 !! options
8343 parsoid=wt2html,wt2wt,html2html
8344 !! wikitext
8345 [[:es:]]
8346
8347 [[:ko:]]
8348 !! html/php
8349 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8350 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8351 </p>
8352 !! html/parsoid
8353 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8354 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8355 !! end
8356
8357 !! test
8358 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8359 !! wikitext
8360 [[mi:Foo]]
8361 !! html/php
8362 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8363 </p>
8364 !! html/parsoid
8365 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8366 !! end
8367
8368 !! test
8369 Interlanguage link with preceding local interwiki link (bug 68085)
8370 !! options
8371 parsoid=wt2html,wt2wt,html2html
8372 !! wikitext
8373 Blah blah blah
8374 [[local:es:Spanish]]
8375 !! html/php
8376 <p>Blah blah blah
8377 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8378 </p>
8379 !! html/parsoid
8380 <p>Blah blah blah
8381 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8382 !! end
8383
8384 !! test
8385 Looks like an interlanguage link, but is actually a local interwiki
8386 !! options
8387 parsoid=wt2html,wt2wt,html2html
8388 !! wikitext
8389 Blah blah blah
8390 [[mi:Template:Foo]]
8391 !! html/php
8392 <p>Blah blah blah
8393 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8394 </p>
8395 !! html/parsoid
8396 <p>Blah blah blah
8397 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8398 !! end
8399
8400 ###
8401 ### Redirects, Parsoid-only
8402 ###
8403
8404 !! test
8405 1. Simple redirect to page
8406 !! wikitext
8407 #REDIRECT [[Main Page]]
8408 !! html/parsoid
8409 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8410 !! end
8411
8412 !! test
8413 2. Other redirect variants
8414 !! wikitext
8415 #REDIRECT [[Main_Page]]
8416 !! html/parsoid
8417 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8418 !! end
8419
8420 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8421 # This tests the Parsoid bail-out code.
8422 !! test
8423 3. Other redirect variants
8424 !! wikitext
8425 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8426 !! html/parsoid
8427 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8428 !! end
8429
8430 !! test
8431 4. Redirect to a templated destination
8432 !! wikitext
8433 #REDIRECT [[{{echo|Foo}}bar]]
8434 !! html/parsoid
8435 <link typeof="mw:ExpandedAttrs" rel="mw:PageProp/redirect" href="./Foobar" data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;}]],&amp;quot;dsr&amp;quot;:[12,24,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;Foo&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">Foo&lt;/span>bar"}]]}'/>
8436 !! end
8437
8438 !! test
8439 Empty redirect
8440 !! options
8441 parsoid=wt2html,wt2wt
8442 !! wikitext
8443 #REDIRECT [[]]
8444 !! html/parsoid
8445 <ol>
8446 <li>REDIRECT [[]]</li></ol>
8447 !! end
8448
8449 !! test
8450 Optional colon in #REDIRECT
8451 !! options
8452 # the colon is archaic syntax. we support it for wt2html, but we
8453 # don't care that it roundtrips back to the modern syntax.
8454 parsoid=wt2html,html2html
8455 !! wikitext
8456 #REDIRECT:[[Main Page]]
8457 !! html/parsoid
8458 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8459 !! end
8460
8461 !! test
8462 Whitespace in #REDIRECT with optional colon
8463 !! options
8464 # the colon and gratuitous whitespace is archaic syntax. we support
8465 # it for wt2html, but we don't care that it roundtrips back to the
8466 # modern syntax (without extra whitespace)
8467 parsoid=wt2html,html2html
8468 !! wikitext
8469
8470 #REDIRECT
8471 :
8472 [[Main Page]]
8473 !! html/parsoid
8474 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8475 !! end
8476
8477 !! test
8478 Piped link in #REDIRECT
8479 !! options
8480 # content after piped link is ignored. we support this syntax,
8481 # but don't care that the piped link is lost when we roundtrip this.
8482 parsoid=wt2html
8483 !! wikitext
8484 #REDIRECT [[Main Page|bar]]
8485 !! html/parsoid
8486 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8487 !! end
8488
8489 !! test
8490 Redirect to category (T104502)
8491 !! options
8492 parsoid=wt2html,wt2wt
8493 !! wikitext
8494 #REDIRECT [[Category:Foo]]
8495 !! html/parsoid
8496 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8497 !! end
8498
8499 !! test
8500 Redirect to category with URL encoding (T104502)
8501 !! options
8502 parsoid=wt2html
8503 !! wikitext
8504 #REDIRECT [[Category%3AFoo]]
8505 !! html/parsoid
8506 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8507 !! end
8508
8509 !! test
8510 Redirect to category page
8511 !! wikitext
8512 #REDIRECT [[:Category:Foo]]
8513 !! html/parsoid
8514 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8515 !! end
8516
8517 !! test
8518 Redirect to image page (1)
8519 !! wikitext
8520 #REDIRECT [[File:Wiki.png]]
8521 !! html/parsoid
8522 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8523 !! end
8524
8525 !! test
8526 Redirect to image page (2)
8527 !! wikitext
8528 #REDIRECT [[Image:Wiki.png]]
8529 !! html/parsoid
8530 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8531 !! end
8532
8533 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8534 # Next test confirms this.
8535 !! test
8536 Redirect to language (1) (T104918)
8537 !! options
8538 parsoid=wt2html,wt2wt,html2html
8539 !! wikitext
8540 #REDIRECT [[en:File:Wiki.png]]
8541 !! html/parsoid
8542 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8543 !! end
8544
8545 !! test
8546 Redirect to language (2) (T104918)
8547 !! wikitext
8548 #REDIRECT [[:en:File:Wiki.png]]
8549 !! html/parsoid
8550 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8551 !! end
8552
8553 !! test
8554 Redirect to interwiki (T104918)
8555 !! wikitext
8556 #REDIRECT [[meatball:File:Wiki.png]]
8557 !! html/parsoid
8558 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8559 !! end
8560
8561 !! test
8562 Non-English #REDIRECT
8563 !! options
8564 language=is
8565 !! wikitext
8566 #TILVÍSUN [[Main Page]]
8567 !! html/parsoid
8568 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8569 !! end
8570
8571 !! test
8572 Redirect syntax under text isn't considered a redirect
8573 !! wikitext
8574 some text
8575 #redirect [[Main Page]]
8576 !! html/parsoid
8577 <p>some text</p>
8578 <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>
8579 !! end
8580
8581 # FIXME: Should hoist the redirect to the top of the page and ensure there
8582 # is only one.
8583 !! test
8584 New redirect
8585 !! options
8586 parsoid=html2wt
8587 !! html/parsoid
8588 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8589 !! wikitext
8590 Foo
8591 #REDIRECT [[Foo]]
8592 !! end
8593
8594 ##
8595 ## XHTML tidiness
8596 ###
8597
8598 !! test
8599 <br> to <br />
8600 !! wikitext
8601 1<br>2<br />3
8602 !! html
8603 <p>1<br />2<br />3
8604 </p>
8605 !! end
8606
8607 !! test
8608 Broken br tag sanitization
8609 !! wikitext
8610 </br>
8611 !! html/php
8612 <p>&lt;/br&gt;
8613 </p>
8614 !! end
8615
8616 # TODO: Fix html2html mode (bug 51055)!
8617 !! test
8618 Parsoid: Broken br tag recognition
8619 !! options
8620 parsoid=wt2html
8621 !! wikitext
8622 </br>
8623
8624 <br/ >
8625 !! html+tidy
8626 <p><br /></p>
8627 <p><br /></p>
8628 !! end
8629
8630 !! test
8631 Incorrecly removing closing slashes from correctly formed XHTML
8632 !! wikitext
8633 <br style="clear:both;" />
8634 !! html
8635 <p><br style="clear:both;" />
8636 </p>
8637 !! end
8638
8639 !! test
8640 Failing to transform badly formed HTML into correct XHTML
8641 !! wikitext
8642 <br style="clear: left;">
8643 <br style="clear: right;">
8644 <br style="clear: both;">
8645 !! html
8646 <p><br style="clear: left;" />
8647 <br style="clear: right;" />
8648 <br style="clear: both;" />
8649 </p>
8650 !!end
8651
8652 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8653 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8654 !! test
8655 Handling html with a div self-closing tag
8656 !! wikitext
8657 <div title />
8658 <div title/>
8659 <div title/ >
8660 <div title=bar />
8661 <div title=bar/>
8662 <div title=bar/ >
8663 !! html/php
8664 <p>&lt;div title /&gt;
8665 &lt;div title/&gt;
8666 </p>
8667 <div>
8668 <p>&lt;div title=bar /&gt;
8669 &lt;div title=bar/&gt;
8670 </p>
8671 <div title="bar/"></div>
8672 </div>
8673
8674 !! html/parsoid
8675 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8676 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8677 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
8678 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8679 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8680 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
8681 !! end
8682
8683 !! test
8684 Handling html with a br self-closing tag
8685 !! wikitext
8686 <br title />
8687 <br title/>
8688 <br title/ >
8689 <br title=bar />
8690 <br title=bar/>
8691 <br title=bar/ >
8692 !! html/php
8693 <p><br title="" />
8694 <br title="" />
8695 <br />
8696 <br title="bar" />
8697 <br title="bar" />
8698 <br title="bar/" />
8699 </p>
8700 !! html/parsoid
8701 <p><br title="" />
8702 <br title="" />
8703 <br title="" />
8704 <br title="bar" />
8705 <br title="bar" />
8706 <br title="bar/" />
8707 </p>
8708 !! end
8709
8710 !! test
8711 Horizontal ruler (should it add that extra space?)
8712 !! wikitext
8713 <hr>
8714 <hr >
8715 foo <hr
8716 > bar
8717 !! html+tidy
8718 <hr />
8719 <hr />
8720 <p>foo</p>
8721 <hr />
8722 <p>bar</p>
8723 !! end
8724
8725 !! test
8726 Horizontal ruler -- 4+ dashes render hr
8727 !! wikitext
8728 ----
8729 !! html
8730 <hr />
8731
8732 !! end
8733
8734 !! test
8735 Horizontal ruler -- eats additional dashes on the same line
8736 !! wikitext
8737 ---------
8738 !! html
8739 <hr />
8740
8741 !! end
8742
8743 !! test
8744 Horizontal ruler -- does not collapse dashes on consecutive lines
8745 !! wikitext
8746 ----
8747 ----
8748 !! html
8749 <hr />
8750 <hr />
8751
8752 !! end
8753
8754 !! test
8755 Horizontal ruler -- <4 dashes render as plain text
8756 !! wikitext
8757 ---
8758 !! html
8759 <p>---
8760 </p>
8761 !! end
8762
8763 !! test
8764 Horizontal ruler -- Supports content following dashes on same line
8765 !! wikitext
8766 ---- Foo
8767 !! html
8768 <hr /> Foo
8769
8770 !! html+tidy
8771 <hr />
8772 <p>Foo</p>
8773 !! end
8774
8775 ###
8776 ### Block-level elements
8777 ###
8778 !! test
8779 Common list
8780 !! wikitext
8781 *Common list
8782 * item 2
8783 *item 3
8784 !! html
8785 <ul><li>Common list</li>
8786 <li> item 2</li>
8787 <li>item 3</li></ul>
8788
8789 !! end
8790
8791 !! test
8792 Numbered list
8793 !! wikitext
8794 #Numbered list
8795 #item 2
8796 # item 3
8797 !! html
8798 <ol><li>Numbered list</li>
8799 <li>item 2</li>
8800 <li> item 3</li></ol>
8801
8802 !! end
8803
8804 !! test
8805 Mixed list
8806 !! wikitext
8807 *Mixed list
8808 *# with numbers
8809 ** and bullets
8810 *# and numbers
8811 *bullets again
8812 **bullet level 2
8813 ***bullet level 3
8814 ***#Number on level 4
8815 **bullet level 2
8816 **#Number on level 3
8817 **#Number on level 3
8818 *#number level 2
8819 *Level 1
8820 *** Level 3
8821 #** Level 3, but ordered
8822 !! html
8823 <ul><li>Mixed list
8824 <ol><li> with numbers</li></ol>
8825 <ul><li> and bullets</li></ul>
8826 <ol><li> and numbers</li></ol></li>
8827 <li>bullets again
8828 <ul><li>bullet level 2
8829 <ul><li>bullet level 3
8830 <ol><li>Number on level 4</li></ol></li></ul></li>
8831 <li>bullet level 2
8832 <ol><li>Number on level 3</li>
8833 <li>Number on level 3</li></ol></li></ul>
8834 <ol><li>number level 2</li></ol></li>
8835 <li>Level 1
8836 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
8837 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
8838
8839 !! end
8840
8841 !! test
8842 1. Nested mixed wikitext and html list
8843 !! wikitext
8844 * hi
8845 * <ul><li>ho</li></ul>
8846 * hi
8847 ** ho
8848 !! html/php
8849 <ul><li> hi</li>
8850 <li> <ul><li>ho</li></ul></li>
8851 <li> hi
8852 <ul><li> ho</li></ul></li></ul>
8853
8854 !! html/parsoid
8855 <ul><li> hi</li>
8856 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
8857 <li> hi
8858 <ul><li> ho</li></ul></li></ul>
8859 !! end
8860
8861 !! test
8862 2. Nested mixed wikitext and html list (incompatible)
8863 !! wikitext
8864 ; hi
8865 : {{echo|<li>ho</li>}}
8866 !! html/php
8867 <dl><dt> hi</dt>
8868 <dd> <li>ho</li></dd></dl>
8869
8870 !! html/parsoid
8871 <dl><dt> hi</dt>
8872 <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>
8873 !! end
8874
8875 !! test
8876 Nested lists 1
8877 !! wikitext
8878 *foo
8879 **bar
8880 !! html
8881 <ul><li>foo
8882 <ul><li>bar</li></ul></li></ul>
8883
8884 !! end
8885
8886 !! test
8887 Nested lists 2
8888 !! wikitext
8889 **foo
8890 *bar
8891 !! html
8892 <ul><li><ul><li>foo</li></ul></li>
8893 <li>bar</li></ul>
8894
8895 !! end
8896
8897 !! test
8898 Nested lists 3 (first element empty)
8899 !! wikitext
8900 *
8901 **bar
8902 !! html
8903 <ul><li>
8904 <ul><li>bar</li></ul></li></ul>
8905
8906 !! end
8907
8908 !! test
8909 Nested lists 4 (first element empty)
8910 !! wikitext
8911 **
8912 *bar
8913 !! html
8914 <ul><li><ul><li></li></ul></li>
8915 <li>bar</li></ul>
8916
8917 !! end
8918
8919 !! test
8920 Nested lists 5 (both elements empty)
8921 !! wikitext
8922 **
8923 *
8924 !! html
8925 <ul><li><ul><li></li></ul></li>
8926 <li></li></ul>
8927
8928 !! end
8929
8930 !! test
8931 Nested lists 6 (both elements empty)
8932 !! wikitext
8933 *
8934 **
8935 !! html
8936 <ul><li>
8937 <ul><li></li></ul></li></ul>
8938
8939 !! end
8940
8941 !! test
8942 Nested lists 7 (skip initial nesting levels)
8943 !! wikitext
8944 *** foo
8945 !! html
8946 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
8947
8948 !! end
8949
8950 !! test
8951 Nested lists 8 (multiple nesting transitions)
8952 !! wikitext
8953 * foo
8954 *** bar
8955 ** baz
8956 * boo
8957 !! html
8958 <ul><li> foo
8959 <ul><li><ul><li> bar</li></ul></li>
8960 <li> baz</li></ul></li>
8961 <li> boo</li></ul>
8962
8963 !! end
8964
8965 !! test
8966 Nested lists 9 (extension interaction)
8967 !! options
8968 parsoid
8969 !! wikitext
8970 *<references />
8971 !! html/parsoid
8972 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
8973 !! end
8974
8975 !! test
8976 1. Lists with start-of-line-transparent tokens before bullets: Comments
8977 !! wikitext
8978 *foo
8979 *<!--cmt-->bar
8980 <!--cmt-->*baz
8981 !! html
8982 <ul><li>foo</li>
8983 <li>bar</li>
8984 <li>baz</li></ul>
8985
8986 !! end
8987
8988 !! test
8989 2. Lists with start-of-line-transparent tokens before bullets: Template close
8990 !! wikitext
8991 *foo {{echo|bar
8992 }}*baz
8993 !! html
8994 <ul><li>foo bar</li>
8995 <li>baz</li></ul>
8996
8997 !! end
8998
8999 !! test
9000 List items are not parsed correctly following a <pre> block (bug 785)
9001 !! wikitext
9002 * <pre>foo</pre>
9003 * <pre>bar</pre>
9004 * zar
9005 !! html/php
9006 <ul><li> <pre>foo</pre></li>
9007 <li> <pre>bar</pre></li>
9008 <li> zar</li></ul>
9009
9010 !! html/parsoid
9011 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
9012 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
9013 <li> zar</li></ul>
9014 !! end
9015
9016 !! test
9017 List items from template
9018 !! wikitext
9019
9020 {{inner list}}
9021 * item 2
9022
9023 * item 0
9024 {{inner list}}
9025 * item 2
9026
9027 * item 0
9028 * notSOL{{inner list}}
9029 * item 2
9030 !! html
9031 <ul><li> item 1</li>
9032 <li> item 2</li></ul>
9033 <ul><li> item 0</li>
9034 <li> item 1</li>
9035 <li> item 2</li></ul>
9036 <ul><li> item 0</li>
9037 <li> notSOL</li>
9038 <li> item 1</li>
9039 <li> item 2</li></ul>
9040
9041 !! end
9042
9043 !! test
9044 List interrupted by empty line or heading
9045 !! wikitext
9046 * foo
9047
9048 ** bar
9049 == A heading ==
9050 * Another list item
9051 !! html
9052 <ul><li> foo</li></ul>
9053 <ul><li><ul><li> bar</li></ul></li></ul>
9054 <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>
9055 <ul><li> Another list item</li></ul>
9056
9057 !!end
9058
9059 !!test
9060 Multiple list tags generated by templates
9061 !! wikitext
9062 {{echo|<li>}}a
9063 {{echo|<li>}}b
9064 {{echo|<li>}}c
9065 !! html
9066 <li>a
9067 <li>b
9068 <li>c</li>
9069 </li>
9070 </li>
9071
9072 !! html+tidy
9073 <ul>
9074 <li>a</li>
9075 <li>b</li>
9076 <li>c</li>
9077 </ul>
9078 !!end
9079
9080 !!test
9081 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9082 !! wikitext
9083 *a
9084 <!--This line will NOT split the list-->
9085 *b
9086 <!--This line will NOT split the list either-->
9087 *c
9088 <!--foo--> <!----> <!--This line NOT split the list either-->
9089 *d
9090 !! html
9091 <ul><li>a</li>
9092 <li>b</li>
9093 <li>c</li>
9094 <li>d</li></ul>
9095
9096 !!end
9097
9098 !!test
9099 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9100 !! wikitext
9101 *a
9102 <!--This line will NOT split the list-->
9103 *b
9104 <!--This line will NOT split the list either-->
9105 *c
9106 <!--foo--> <!----> <!--This line NOT split the list
9107 either-->
9108 *d
9109 !! html
9110 <ul><li>a</li>
9111 <li>b</li>
9112 <li>c</li>
9113 <li>d</li></ul>
9114
9115 !!end
9116
9117 !!test
9118 Test the li-hack
9119 (The PHP parser relies on Tidy for the hack)
9120 !!options
9121 parsoid=wt2html,wt2wt
9122 !! wikitext
9123 * foo
9124 * <li>li-hack
9125 * {{echo|<li>templated li-hack}}
9126 * <!--foo--> <li> unsupported li-hack with preceding comments
9127
9128 <ul>
9129 <li><li>not a li-hack
9130 </li>
9131 </ul>
9132 !! html+tidy
9133 <ul>
9134 <li>foo</li>
9135 <li>li-hack</li>
9136 <li>templated li-hack</li>
9137 <li>unsupported li-hack with preceding comments</li>
9138 </ul>
9139 <ul>
9140 <li>not a li-hack</li>
9141 </ul>
9142 !!end
9143
9144 !! test
9145 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9146 !! options
9147 parsoid
9148 !! wikitext
9149 # foo
9150 ## bar
9151 * foo
9152 ** bar
9153 : foo
9154 :: bar
9155 !! html
9156 <ol>
9157 <li> foo<ol>
9158 <li> bar</li>
9159 </ol></li>
9160 </ol><ul>
9161 <li> foo<ul>
9162 <li> bar</li>
9163 </ul></li>
9164 </ul><dl>
9165 <dd> foo<dl>
9166 <dd> bar</dd>
9167 </dl></dd>
9168 </dl>
9169 !! end
9170
9171 !! test
9172 Parsoid: Test of whitespace serialization with Templated bullets
9173 !! options
9174 parsoid
9175 !! wikitext
9176 * {{bullet}}
9177 !! html
9178 <ul>
9179 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9180 </ul>
9181 !! end
9182
9183 # ------------------------------------------------------------------------
9184 # The next set of tests are about Parsoid's ability to handle badly nested
9185 # tags (parse, minimize scope of fixup, and roundtrip back)
9186 # ------------------------------------------------------------------------
9187
9188 !! test
9189 Unbalanced closing block tags break a list
9190 (php parser relies on Tidy to fix up)
9191 !! wikitext
9192 <div>
9193 *a</div><div>
9194 *b</div>
9195 !! html+tidy
9196 <div>
9197 <ul>
9198 <li>a</li>
9199 </ul>
9200 </div>
9201 <div>
9202 <ul>
9203 <li>b</li>
9204 </ul>
9205 </div>
9206 !! end
9207
9208 # Parsoid fails this test, but it might be tricky to support properly.
9209 # See bug 68395.
9210 !! test
9211 Unbalanced closing non-block tags don't break a list
9212 (php parser relies on Tidy to fix up)
9213 !! wikitext
9214 <span>
9215 *a</span><span>
9216 *b</span>
9217 !! html/php+tidy
9218 <ul>
9219 <li><span>a</span></li>
9220 <li><span>b</span></li>
9221 </ul>
9222 !! html/parsoid
9223 <span>
9224 <ul>
9225 <li>a<span></span>
9226 </li>
9227 <li>b
9228 </li>
9229 </ul>
9230 </span>
9231 !! end
9232
9233 !! test
9234 Unclosed formatting tags that straddle lists are closed and reopened
9235 (php parser relies on Tidy to fix up)
9236 !! options
9237 parsoid=wt2html,wt2wt,html2html
9238 !! wikitext
9239 # <s> a
9240 # b </s>
9241 !! html/php+tidy
9242 <ol>
9243 <li><s>a</s></li>
9244 <li><s>b</s></li>
9245 </ol>
9246 !! html/parsoid
9247 <ol><li> <s> a</s></li>
9248 <li><s> b </s></li></ol>
9249 !! end
9250
9251 # See bug 68395.
9252 !!test
9253 1. List embedded in a formatting tag
9254 !! wikitext
9255 <small>
9256 * foo
9257 </small>
9258 !! html/php+tidy
9259 <ul>
9260 <li><small>foo</small></li>
9261 </ul>
9262 !! html/parsoid
9263 <small>
9264 <ul>
9265 <li> foo</li>
9266 </ul>
9267 </small>
9268 !!end
9269
9270 ## Ugly Parsoid output here
9271 ## Not sure what the right output is.
9272 !!test
9273 2. List embedded in a formatting tag
9274 !! wikitext
9275 <small>
9276 *a
9277 *b</small>
9278 !! html/php+tidy
9279 <ul>
9280 <li><small>a</small></li>
9281 <li><small>b</small></li>
9282 </ul>
9283 !! html/parsoid
9284 <small></small>
9285 <ul><small>
9286 <li>a</li>
9287 </small>
9288 <li><small>b</small></li>
9289 </ul>
9290 !!end
9291
9292 # Ugly Parsoid and PHP parser output here
9293 # Not sure if we want to make this a test!
9294 #
9295 ## !!test
9296 ## 3. Unclosed formatting tags in list elements
9297 ## !! wikitext
9298 ## *<small>a
9299 ## *<small>b
9300 ## !! html/php+tidy
9301 ## <ul>
9302 ## <li><small>a</small></li>
9303 ## <li><small><small>b</small></small></li>
9304 ## </ul>
9305 ## !! html/parsoid
9306 ## <ul>
9307 ## <li><small>a</small></li>
9308 ## <small>
9309 ## <li><small>b</small></li>
9310 ## </small></ul>
9311 ## !!end
9312
9313 # This is a bug in the PHP parser + tidy combination.
9314 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9315 # and then fostered out of the table by tidy.)
9316 # We believe the Parsoid output to be correct.
9317 !! test
9318 Table with missing opening <tr> tag
9319 !! options
9320 parsoid=wt2html,wt2wt
9321 !! wikitext
9322 <table>
9323 <td>foo</td>
9324 </tr>
9325 </table>
9326 !! html+tidy
9327 <table>
9328 <tr>
9329 <td>foo</td>
9330 </tr>
9331 </table>
9332 !! end
9333
9334 ###
9335 ### Magic Words
9336 ###
9337
9338 # Note that the current date is hard-coded as
9339 # 1970-01-01T00:02:03Z (a Thursday)
9340 # when running parser tests. The timezone is also fixed to GMT, so
9341 # local date will be identical to current date.
9342
9343 !! test
9344 Magic Word: {{CURRENTDAY}}
9345 !! wikitext
9346 {{CURRENTDAY}}
9347 !! html
9348 <p>1
9349 </p>
9350 !! end
9351
9352 !! test
9353 Magic Word: {{CURRENTDAY2}}
9354 !! wikitext
9355 {{CURRENTDAY2}}
9356 !! html
9357 <p>01
9358 </p>
9359 !! end
9360
9361 !! test
9362 Magic Word: {{CURRENTDAYNAME}}
9363 !! wikitext
9364 {{CURRENTDAYNAME}}
9365 !! html
9366 <p>Thursday
9367 </p>
9368 !! end
9369
9370 !! test
9371 Magic Word: {{CURRENTDOW}}
9372 !! wikitext
9373 {{CURRENTDOW}}
9374 !! html
9375 <p>4
9376 </p>
9377 !! end
9378
9379 !! test
9380 Magic Word: {{CURRENTMONTH}}
9381 !! wikitext
9382 {{CURRENTMONTH}}
9383 !! html
9384 <p>01
9385 </p>
9386 !! end
9387
9388 !! test
9389 Magic Word: {{CURRENTMONTH1}}
9390 !! wikitext
9391 {{CURRENTMONTH1}}
9392 !! html
9393 <p>1
9394 </p>
9395 !! end
9396
9397 !! test
9398 Magic Word: {{CURRENTMONTHABBREV}}
9399 !! wikitext
9400 {{CURRENTMONTHABBREV}}
9401 !! html
9402 <p>Jan
9403 </p>
9404 !! end
9405
9406 !! test
9407 Magic Word: {{CURRENTMONTHNAME}}
9408 !! wikitext
9409 {{CURRENTMONTHNAME}}
9410 !! html
9411 <p>January
9412 </p>
9413 !! end
9414
9415 !! test
9416 Magic Word: {{CURRENTMONTHNAMEGEN}}
9417 !! wikitext
9418 {{CURRENTMONTHNAMEGEN}}
9419 !! html
9420 <p>January
9421 </p>
9422 !! end
9423
9424 !! test
9425 Magic Word: {{CURRENTTIME}}
9426 !! wikitext
9427 {{CURRENTTIME}}
9428 !! html
9429 <p>00:02
9430 </p>
9431 !! end
9432
9433 !! test
9434 Magic Word: {{CURRENTHOUR}}
9435 !! wikitext
9436 {{CURRENTHOUR}}
9437 !! html
9438 <p>00
9439 </p>
9440 !! end
9441
9442 !! test
9443 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9444 !! wikitext
9445 {{CURRENTWEEK}}
9446 !! html
9447 <p>1
9448 </p>
9449 !! end
9450
9451 !! test
9452 Magic Word: {{CURRENTYEAR}}
9453 !! wikitext
9454 {{CURRENTYEAR}}
9455 !! html
9456 <p>1970
9457 </p>
9458 !! end
9459
9460 !! test
9461 Magic Word: {{CURRENTTIMESTAMP}}
9462 !! wikitext
9463 {{CURRENTTIMESTAMP}}
9464 !! html
9465 <p>19700101000203
9466 </p>
9467 !! end
9468
9469 !! test
9470 Magic Words LOCAL (UTC)
9471 !! wikitext
9472 * {{LOCALMONTH}}
9473 * {{LOCALMONTH1}}
9474 * {{LOCALMONTHNAME}}
9475 * {{LOCALMONTHNAMEGEN}}
9476 * {{LOCALMONTHABBREV}}
9477 * {{LOCALDAY}}
9478 * {{LOCALDAY2}}
9479 * {{LOCALDAYNAME}}
9480 * {{LOCALYEAR}}
9481 * {{LOCALTIME}}
9482 * {{LOCALHOUR}}
9483 * {{LOCALWEEK}}
9484 * {{LOCALDOW}}
9485 * {{LOCALTIMESTAMP}}
9486 !! html
9487 <ul><li> 01</li>
9488 <li> 1</li>
9489 <li> January</li>
9490 <li> January</li>
9491 <li> Jan</li>
9492 <li> 1</li>
9493 <li> 01</li>
9494 <li> Thursday</li>
9495 <li> 1970</li>
9496 <li> 00:02</li>
9497 <li> 00</li>
9498 <li> 1</li>
9499 <li> 4</li>
9500 <li> 19700101000203</li></ul>
9501
9502 !! end
9503
9504 !! test
9505 Magic Word: {{FULLPAGENAME}}
9506 !! options
9507 title=[[User:Ævar Arnfjörð Bjarmason]]
9508 !! wikitext
9509 {{FULLPAGENAME}}
9510 !! html
9511 <p>User:Ævar Arnfjörð Bjarmason
9512 </p>
9513 !! end
9514
9515 !! test
9516 Magic Word: {{FULLPAGENAMEE}}
9517 !! options
9518 title=[[User:Ævar Arnfjörð Bjarmason]]
9519 !! wikitext
9520 {{FULLPAGENAMEE}}
9521 !! html
9522 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9523 </p>
9524 !! end
9525
9526 !! test
9527 Magic Word: {{TALKSPACE}}
9528 !! options
9529 title=[[User:Ævar Arnfjörð Bjarmason]]
9530 !! wikitext
9531 {{TALKSPACE}}
9532 !! html
9533 <p>User talk
9534 </p>
9535 !! end
9536
9537 !! test
9538 Magic Word: {{TALKSPACE}}, same namespace
9539 !! options
9540 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9541 !! wikitext
9542 {{TALKSPACE}}
9543 !! html
9544 <p>User talk
9545 </p>
9546 !! end
9547
9548 !! test
9549 Magic Word: {{TALKSPACE}}, main namespace
9550 !! options
9551 title=[[Parser Test]]
9552 !! wikitext
9553 {{TALKSPACE}}
9554 !! html
9555 <p>Talk
9556 </p>
9557 !! end
9558
9559 !! test
9560 Magic Word: {{TALKSPACEE}}
9561 !! options
9562 title=[[User:Ævar Arnfjörð Bjarmason]]
9563 !! wikitext
9564 {{TALKSPACEE}}
9565 !! html
9566 <p>User_talk
9567 </p>
9568 !! end
9569
9570 !! test
9571 Magic Word: {{SUBJECTSPACE}}
9572 !! options
9573 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9574 !! wikitext
9575 {{SUBJECTSPACE}}
9576 !! html
9577 <p>User
9578 </p>
9579 !! end
9580
9581 !! test
9582 Magic Word: {{SUBJECTSPACE}}, same namespace
9583 !! options
9584 title=[[User:Ævar Arnfjörð Bjarmason]]
9585 !! wikitext
9586 {{SUBJECTSPACE}}
9587 !! html
9588 <p>User
9589 </p>
9590 !! end
9591
9592 !! test
9593 Magic Word: {{SUBJECTSPACE}}, main namespace
9594 !! options
9595 title=[[Parser Test]]
9596 !! wikitext
9597 {{SUBJECTSPACE}}
9598 !! html
9599
9600 !! end
9601
9602 !! test
9603 Magic Word: {{SUBJECTSPACEE}}
9604 !! options
9605 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9606 !! wikitext
9607 {{SUBJECTSPACEE}}
9608 !! html
9609 <p>User
9610 </p>
9611 !! end
9612
9613 !! test
9614 Magic Word: {{NAMESPACE}}
9615 !! options
9616 title=[[User:Ævar Arnfjörð Bjarmason]]
9617 !! wikitext
9618 {{NAMESPACE}}
9619 !! html
9620 <p>User
9621 </p>
9622 !! end
9623
9624 !! test
9625 Magic Word: {{NAMESPACEE}}
9626 !! options
9627 title=[[User:Ævar Arnfjörð Bjarmason]]
9628 !! wikitext
9629 {{NAMESPACEE}}
9630 !! html
9631 <p>User
9632 </p>
9633 !! end
9634
9635 !! test
9636 Magic Word: {{NAMESPACENUMBER}}
9637 !! options
9638 title=[[User:Ævar Arnfjörð Bjarmason]]
9639 !! wikitext
9640 {{NAMESPACENUMBER}}
9641 !! html
9642 <p>2
9643 </p>
9644 !! end
9645
9646 !! test
9647 Magic Word: {{SUBPAGENAME}}
9648 !! options
9649 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9650 !! wikitext
9651 {{SUBPAGENAME}}
9652 !! html
9653 <p>sub ö
9654 </p>
9655 !! end
9656
9657 !! test
9658 Magic Word: {{SUBPAGENAMEE}}
9659 !! options
9660 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9661 !! wikitext
9662 {{SUBPAGENAMEE}}
9663 !! html
9664 <p>sub_%C3%B6
9665 </p>
9666 !! end
9667
9668 !! test
9669 Magic Word: {{ROOTPAGENAME}}
9670 !! options
9671 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9672 !! wikitext
9673 {{ROOTPAGENAME}}
9674 !! html
9675 <p>Ævar Arnfjörð Bjarmason
9676 </p>
9677 !! end
9678
9679 !! test
9680 Magic Word: {{ROOTPAGENAMEE}}
9681 !! options
9682 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9683 !! wikitext
9684 {{ROOTPAGENAMEE}}
9685 !! html
9686 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9687 </p>
9688 !! end
9689
9690 !! test
9691 Magic Word: {{BASEPAGENAME}}
9692 !! options
9693 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9694 !! wikitext
9695 {{BASEPAGENAME}}
9696 !! html
9697 <p>Ævar Arnfjörð Bjarmason
9698 </p>
9699 !! end
9700
9701 !! test
9702 Magic Word: {{BASEPAGENAMEE}}
9703 !! options
9704 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9705 !! wikitext
9706 {{BASEPAGENAMEE}}
9707 !! html
9708 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9709 </p>
9710 !! end
9711
9712 !! test
9713 Magic Word: {{TALKPAGENAME}}
9714 !! options
9715 title=[[User:Ævar Arnfjörð Bjarmason]]
9716 !! wikitext
9717 {{TALKPAGENAME}}
9718 !! html
9719 <p>User talk:Ævar Arnfjörð Bjarmason
9720 </p>
9721 !! end
9722
9723 !! test
9724 Magic Word: {{TALKPAGENAMEE}}
9725 !! options
9726 title=[[User:Ævar Arnfjörð Bjarmason]]
9727 !! wikitext
9728 {{TALKPAGENAMEE}}
9729 !! html
9730 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9731 </p>
9732 !! end
9733
9734 !! test
9735 Magic Word: {{SUBJECTPAGENAME}}
9736 !! options
9737 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9738 !! wikitext
9739 {{SUBJECTPAGENAME}}
9740 !! html
9741 <p>User:Ævar Arnfjörð Bjarmason
9742 </p>
9743 !! end
9744
9745 !! test
9746 Magic Word: {{SUBJECTPAGENAMEE}}
9747 !! options
9748 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9749 !! wikitext
9750 {{SUBJECTPAGENAMEE}}
9751 !! html
9752 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9753 </p>
9754 !! end
9755
9756 !! test
9757 Magic Word: {{NUMBEROFFILES}}
9758 !! wikitext
9759 {{NUMBEROFFILES}}
9760 !! html
9761 <p>6
9762 </p>
9763 !! end
9764
9765 !! test
9766 Magic Word: {{PAGENAME}}
9767 !! options
9768 title=[[User:Ævar Arnfjörð Bjarmason]]
9769 !! wikitext
9770 {{PAGENAME}}
9771 !! html
9772 <p>Ævar Arnfjörð Bjarmason
9773 </p>
9774 !! end
9775
9776 !! test
9777 Magic Word: {{PAGENAME}} with metacharacters
9778 !! options
9779 title=[['foo & bar = baz']]
9780 !! wikitext
9781 ''{{PAGENAME}}''
9782 !! html/php
9783 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
9784 </p>
9785 !! html+tidy
9786 <p><i>'foo &amp; bar = baz'</i></p>
9787 !! end
9788
9789 !! test
9790 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
9791 !! options
9792 title=[[*RFC 1234 http://example.com/]]
9793 !! wikitext
9794 {{PAGENAME}}
9795 !! html/php
9796 <p>&#42;RFC&#32;1234 http&#58;//example.com/
9797 </p>
9798 !! html+tidy
9799 <p>*RFC 1234 http://example.com/</p>
9800 !! end
9801
9802 !! test
9803 Magic Word: {{PAGENAMEE}}
9804 !! options
9805 title=[[User:Ævar Arnfjörð Bjarmason]]
9806 !! wikitext
9807 {{PAGENAMEE}}
9808 !! html
9809 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9810 </p>
9811 !! end
9812
9813 !! test
9814 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
9815 !! options
9816 title=[[*RFC 1234 http://example.com/]]
9817 !! wikitext
9818 {{PAGENAMEE}}
9819 !! html/php
9820 <p>&#42;RFC_1234_http&#58;//example.com/
9821 </p>
9822 !! html+tidy
9823 <p>*RFC_1234_http://example.com/</p>
9824 !! end
9825
9826 !! test
9827 Magic Word: {{REVISIONID}}
9828 !! wikitext
9829 {{REVISIONID}}
9830 !! html
9831 <p>1337
9832 </p>
9833 !! end
9834
9835 !! test
9836 Magic Word: {{SCRIPTPATH}}
9837 !! wikitext
9838 {{SCRIPTPATH}}
9839 !! html
9840
9841 !! end
9842
9843 !! test
9844 Magic Word: {{STYLEPATH}}
9845 !! wikitext
9846 {{STYLEPATH}}
9847 !! html
9848 <p>/skins
9849 </p>
9850 !! end
9851
9852 !! test
9853 Magic Word: {{SERVER}}
9854 !! wikitext
9855 {{SERVER}}
9856 !! html
9857 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9858 </p>
9859 !! end
9860
9861 !! test
9862 Magic Word: {{SERVERNAME}}
9863 !! wikitext
9864 {{SERVERNAME}}
9865 !! html
9866 <p>example.org
9867 </p>
9868 !! end
9869
9870 !! test
9871 Magic Word: {{SITENAME}}
9872 !! wikitext
9873 {{SITENAME}}
9874 !! html
9875 <p>MediaWiki
9876 </p>
9877 !! end
9878
9879 !! test
9880 Case-sensitive magic words, when cased differently, should just be template transclusions
9881 !! wikitext
9882 {{CurrentMonth}}
9883 {{currentday}}
9884 {{cURreNTweEK}}
9885 {{currentHour}}
9886 !! html
9887 <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>
9888 <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>
9889 <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>
9890 <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>
9891 </p>
9892 !! end
9893
9894 !! test
9895 Case-insensitive magic words should still work with weird casing.
9896 !! wikitext
9897 {{sErVeRNaMe}}
9898 {{LCFirst:AOEU}}
9899 {{ucFIRST:aoeu}}
9900 {{SERver}}
9901 !! html
9902 <p>example.org
9903 aOEU
9904 Aoeu
9905 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9906 </p>
9907 !! end
9908
9909 # From plwiki:PLOS_ONE
9910 !! test
9911 Parsoid: Page property magic word with magic word contents
9912 !! wikitext
9913 {{DISPLAYTITLE:''{{PAGENAME}}''}}
9914 !! html/parsoid
9915 <meta property="mw:PageProp/displaytitle" content="Main Page" about="#mwt2" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;i data-parsoid=\"{&amp;quot;dsr&amp;quot;:[15,31,2,2]}\">&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[]],&amp;quot;dsr&amp;quot;:[17,29,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;PAGENAME&amp;quot;,&amp;quot;function&amp;quot;:&amp;quot;pagename&amp;quot;},&amp;quot;params&amp;quot;:{},&amp;quot;i&amp;quot;:0}}]}\">Main Page&lt;/span>&lt;/i>"}]]}'/>
9916 !! end
9917
9918 !! test
9919 Parsoid: Template-generated DISPLAYTITLE
9920 !! wikitext
9921 {{{{echo|DISPLAYTITLE}}:Foo}}
9922 !! html/parsoid
9923 <meta property="mw:PageProp/displaytitle" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[0,29,null,null],"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DISPLAYTITLE}}:Foo"},"params":{},"i":0}}]}'/>
9924 !! end
9925
9926 !! test
9927 Namespace 1 {{ns:1}}
9928 !! wikitext
9929 {{ns:1}}
9930 !! html
9931 <p>Talk
9932 </p>
9933 !! end
9934
9935 !! test
9936 Namespace 1 {{ns:01}}
9937 !! wikitext
9938 {{ns:01}}
9939 !! html
9940 <p>Talk
9941 </p>
9942 !! end
9943
9944 !! test
9945 Namespace 0 {{ns:0}} (bug 4783)
9946 !! wikitext
9947 {{ns:0}}
9948 !! html
9949
9950 !! end
9951
9952 !! test
9953 Namespace 0 {{ns:00}} (bug 4783)
9954 !! wikitext
9955 {{ns:00}}
9956 !! html
9957
9958 !! end
9959
9960 !! test
9961 Namespace -1 {{ns:-1}}
9962 !! wikitext
9963 {{ns:-1}}
9964 !! html
9965 <p>Special
9966 </p>
9967 !! end
9968
9969 !! test
9970 Namespace User {{ns:User}}
9971 !! wikitext
9972 {{ns:User}}
9973 !! html
9974 <p>User
9975 </p>
9976 !! end
9977
9978 !! test
9979 Namespace User talk {{ns:User_talk}}
9980 !! wikitext
9981 {{ns:User_talk}}
9982 !! html
9983 <p>User talk
9984 </p>
9985 !! end
9986
9987 !! test
9988 Namespace User talk {{ns:uSeR tAlK}}
9989 !! wikitext
9990 {{ns:uSeR tAlK}}
9991 !! html
9992 <p>User talk
9993 </p>
9994 !! end
9995
9996 !! test
9997 Namespace File {{ns:File}}
9998 !! wikitext
9999 {{ns:File}}
10000 !! html
10001 <p>File
10002 </p>
10003 !! end
10004
10005 !! test
10006 Namespace File {{ns:Image}}
10007 !! wikitext
10008 {{ns:Image}}
10009 !! html
10010 <p>File
10011 </p>
10012 !! end
10013
10014 !! test
10015 Namespace (lang=de) Benutzer {{ns:User}}
10016 !! options
10017 language=de
10018 !! wikitext
10019 {{ns:User}}
10020 !! html
10021 <p>Benutzer
10022 </p>
10023 !! end
10024
10025 !! test
10026 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10027 !! options
10028 language=de
10029 !! wikitext
10030 {{ns:3}}
10031 !! html
10032 <p>Benutzer Diskussion
10033 </p>
10034 !! end
10035
10036
10037 !! test
10038 Urlencode
10039 !! wikitext
10040 {{urlencode:hi world?!}}
10041 {{urlencode:hi world?!|WIKI}}
10042 {{urlencode:hi world?!|PATH}}
10043 {{urlencode:hi world?!|QUERY}}
10044 !! html
10045 <p>hi+world%3F%21
10046 hi_world%3F!
10047 hi%20world%3F%21
10048 hi+world%3F%21
10049 </p>
10050 !! end
10051
10052 !! test
10053 Magic Word: prioritize type info over data-parsoid
10054 !! options
10055 parsoid=html2wt
10056 !! html/parsoid
10057 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10058 !! wikitext
10059 __FORCETOC__
10060 !! end
10061
10062 !! test
10063 Magic Word: serialize on separate line (parsoid)
10064 !! options
10065 parsoid=wt2wt,html2wt
10066 !! wikitext
10067 foo
10068 __NOTOC__
10069 bar
10070 !! html/parsoid
10071 foo<meta property="mw:PageProp/notoc"/>bar
10072 !! end
10073
10074 !! test
10075 Magic Word: rt non-english wikis
10076 !! options
10077 parsoid=wt2wt
10078 language=de
10079 !! wikitext
10080 __NOEDITSECTION__
10081 !! html/parsoid
10082 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10083 !! end
10084
10085 !!test
10086 __proto__ is treated as normal wikitext (T105997)
10087 !!wikitext
10088 __proto__
10089 !!html
10090 <p>__proto__
10091 </p>
10092 !!end
10093
10094 ###
10095 ### Magic links
10096 ###
10097 !! test
10098 Magic links: internal link to RFC (bug 479)
10099 !! wikitext
10100 [[RFC 123]]
10101 !! html/php
10102 <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>
10103 </p>
10104 !! html/parsoid
10105 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10106 !! end
10107
10108 !! test
10109 Magic links: RFC (bug 479)
10110 !! wikitext
10111 RFC 822
10112 !! html/php
10113 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10114 </p>
10115 !! html/parsoid
10116 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10117 !! end
10118
10119 !! test
10120 Magic links: RFC (bug 65278)
10121 !! wikitext
10122 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10123 !! html/php
10124 <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.
10125 </p>
10126 !! html/parsoid
10127 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10128 !! end
10129
10130 !! test
10131 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
10132 !! wikitext
10133 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10134 RFC
10135 822
10136 !! html/php
10137 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10138 RFC
10139 822
10140 </p>
10141 !! html/parsoid
10142 <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>
10143 RFC
10144 822</p>
10145 !! end
10146
10147 !! test
10148 Magic links: ISBN (bug 1937)
10149 !! wikitext
10150 ISBN 0-306-40615-2
10151 !! html/php
10152 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10153 </p>
10154 !! html/parsoid
10155 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10156 !! end
10157
10158 !! test
10159 Magic links: ISBN (bug 65278)
10160 !! wikitext
10161 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10162 !! html/php
10163 <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.
10164 </p>
10165 !! html/parsoid
10166 <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>
10167 !! end
10168
10169 !! test
10170 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10171 !! wikitext
10172 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10173 ISBN
10174 9780316098113
10175 ISBN 978
10176 0316098113
10177 !! html/php
10178 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10179 ISBN
10180 9780316098113
10181 ISBN 978
10182 0316098113
10183 </p>
10184 !! html/parsoid
10185 <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>
10186 ISBN
10187 9780316098113
10188 ISBN 978
10189 0316098113</p>
10190 !! end
10191
10192 !! test
10193 Magic links: PMID incorrectly converts space to underscore
10194 !! wikitext
10195 PMID 1234
10196 !! html/php
10197 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10198 </p>
10199 !! html/parsoid
10200 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10201 !! end
10202
10203 !! test
10204 Magic links: PMID (bug 65278)
10205 !! wikitext
10206 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10207 !! html/php
10208 <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.
10209 </p>
10210 !! html/parsoid
10211 <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>
10212 !! end
10213
10214 !! test
10215 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10216 !! wikitext
10217 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10218 PMID
10219 1234
10220 !! html/php
10221 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10222 PMID
10223 1234
10224 </p>
10225 !! html/parsoid
10226 <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>
10227 PMID
10228 1234</p>
10229 !! end
10230
10231 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10232 # since these are ExtLinkText, not MagicLinkText
10233 !! test
10234 Magic links: use appropriate serialization for "almost" magic links.
10235 !! wikitext
10236 X[[Special:BookSources/0978739256|foo]]
10237
10238 X[//tools.ietf.org/html/rfc1234 foo]
10239 !! html/php
10240 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10241 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10242 </p>
10243 !! html/parsoid
10244 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10245 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10246 !! end
10247
10248 ###
10249 ### Templates
10250 ####
10251
10252 !! test
10253 Nonexistent template
10254 !! wikitext
10255 {{thistemplatedoesnotexist}}
10256 !! html
10257 <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>
10258 </p>
10259 !! end
10260
10261 !! test
10262 Template with invalid target containing tags
10263 !! wikitext
10264 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10265 !! html
10266 <p>{{a<b>b</b>|foo|a=b|a = b}}
10267 </p>
10268 !! end
10269
10270 !! test
10271 Template with invalid target containing unclosed tag
10272 !! wikitext
10273 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10274 !! html
10275 <p>{{a<b>|foo|a=b|a = b}}</b>
10276 </p>
10277 !! end
10278
10279 !! test
10280 Template with invalid target containing wikilink
10281 !! wikitext
10282 {{[[Main Page]]}}
10283 !! html/php
10284 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10285 </p>
10286 !! html/parsoid
10287 <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>
10288 !! end
10289
10290 !! test
10291 Template with just whitespace in it, bug #68421
10292 !! wikitext
10293 {{echo|{{ }}}}
10294 !! html/parsoid
10295 <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>
10296 !! end
10297
10298 !! article
10299 Template:test
10300 !! text
10301 This is a test template
10302 !! endarticle
10303
10304 !! test
10305 Simple template
10306 !! wikitext
10307 {{test}}
10308 !! html
10309 <p>This is a test template
10310 </p>
10311 !! end
10312
10313 !! test
10314 Template with explicit namespace
10315 !! wikitext
10316 {{Template:test}}
10317 !! html
10318 <p>This is a test template
10319 </p>
10320 !! end
10321
10322
10323 !! article
10324 Template:paramtest
10325 !! text
10326 This is a test template with parameter {{{param}}}
10327 !! endarticle
10328
10329 !! test
10330 Template parameter
10331 !! wikitext
10332 {{paramtest|param=foo}}
10333 !! html
10334 <p>This is a test template with parameter foo
10335 </p>
10336 !! end
10337
10338 !! article
10339 Template:paramtestnum
10340 !! text
10341 [[{{{1}}}|{{{2}}}]]
10342 !! endarticle
10343
10344 !! test
10345 Template unnamed parameter
10346 !! wikitext
10347 {{paramtestnum|Main Page|the main page}}
10348 !! html
10349 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10350 </p>
10351 !! end
10352
10353 !! article
10354 Template:templatesimple
10355 !! text
10356 (test)
10357 !! endarticle
10358
10359 !! article
10360 Template:templateredirect
10361 !! text
10362 #redirect [[Template:templatesimple]]
10363 !! endarticle
10364
10365 !! article
10366 Template:templateasargtestnum
10367 !! text
10368 {{{{{1}}}}}
10369 !! endarticle
10370
10371 !! article
10372 Template:templateasargtest
10373 !! text
10374 {{template{{{templ}}}}}
10375 !! endarticle
10376
10377 !! article
10378 Template:templateasargtest2
10379 !! text
10380 {{{{{templ}}}}}
10381 !! endarticle
10382
10383 !! test
10384 Template with template name as unnamed argument
10385 !! wikitext
10386 {{templateasargtestnum|templatesimple}}
10387 !! html
10388 <p>(test)
10389 </p>
10390 !! end
10391
10392 !! test
10393 Template with template name as argument
10394 !! wikitext
10395 {{templateasargtest|templ=simple}}
10396 !! html
10397 <p>(test)
10398 </p>
10399 !! end
10400
10401 !! test
10402 Template with template name as argument (2)
10403 !! wikitext
10404 {{templateasargtest2|templ=templatesimple}}
10405 !! html
10406 <p>(test)
10407 </p>
10408 !! end
10409
10410 !! article
10411 Template:templateasargtestdefault
10412 !! text
10413 {{{{{templ|templatesimple}}}}}
10414 !! endarticle
10415
10416 !! article
10417 Template:templa
10418 !! text
10419 '''templ'''
10420 !! endarticle
10421
10422 !! test
10423 Template with default value
10424 !! wikitext
10425 {{templateasargtestdefault}}
10426 !! html
10427 <p>(test)
10428 </p>
10429 !! end
10430
10431 !! test
10432 Template with default value (value set)
10433 !! wikitext
10434 {{templateasargtestdefault|templ=templa}}
10435 !! html
10436 <p><b>templ</b>
10437 </p>
10438 !! end
10439
10440 !! test
10441 Template redirect
10442 !! wikitext
10443 {{templateredirect}}
10444 !! html/php
10445 <p>(test)
10446 </p>
10447 !! html/parsoid
10448 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10449 !! end
10450
10451 !! test
10452 Template with argument in separate line
10453 !! wikitext
10454 {{ templateasargtest |
10455 templ = simple }}
10456 !! html
10457 <p>(test)
10458 </p>
10459 !! end
10460
10461 !! test
10462 Template with complex template as argument
10463 !! wikitext
10464 {{paramtest|
10465 param ={{ templateasargtest |
10466 templ = simple }}}}
10467 !! html
10468 <p>This is a test template with parameter (test)
10469 </p>
10470 !! end
10471
10472 !! test
10473 Template with thumb image (with link in description)
10474 !! wikitext
10475 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10476 !! html/php
10477 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>
10478
10479 !! html+tidy
10480 <p>This is a test template with parameter</p>
10481 <div class="thumb tright">
10482 <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>
10483 <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>
10484 </div>
10485 </div>
10486 !! html/parsoid
10487 <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>
10488 !! end
10489
10490 !! article
10491 Template:complextemplate
10492 !! text
10493 {{{1}}} {{paramtest|
10494 param ={{{param}}}}}
10495 !! endarticle
10496
10497 !! test
10498 Template with complex arguments
10499 !! wikitext
10500 {{complextemplate|
10501 param ={{ templateasargtest |
10502 templ = simple }}|[[Template:complextemplate|link]]}}
10503 !! html
10504 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10505 </p>
10506 !! end
10507
10508 !! test
10509 BUG 553: link with two variables in a piped link
10510 !! wikitext
10511 {|
10512 |[[{{{1}}}|{{{2}}}]]
10513 |}
10514 !! html/php
10515 <table>
10516 <tr>
10517 <td>[[{{{1}}}|{{{2}}}]]
10518 </td></tr></table>
10519
10520 !! html/parsoid
10521 <table>
10522 <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>
10523 !! end
10524
10525 # See: T2553
10526 !! test
10527 Abort table cell attribute parsing on wikilink
10528 !! wikitext
10529 {|
10530 | testing [[one|two]] | three || four
10531 | testing one two | three || four
10532 | testing="[[one|two]]" | three || four
10533 |}
10534 !! html/php
10535 <table>
10536 <tr>
10537 <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>
10538 <td> four
10539 </td>
10540 <td> three </td>
10541 <td> four
10542 </td>
10543 <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>
10544 <td> four
10545 </td></tr></table>
10546
10547 !! html/parsoid
10548 <table>
10549 <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>
10550 <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>
10551 <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>
10552 </tbody></table>
10553 !! end
10554
10555 !! test
10556 Don't abort table cell attribute parsing if wikilink is found in template arg
10557 !! wikitext
10558 {|
10559 | Test {{#tag:ref|One two "[[three]]" four}}
10560 |}
10561 !! html/parsoid
10562 <table>
10563 <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>
10564 </tbody></table>
10565 !! end
10566
10567 !! test
10568 Magic variable as template parameter
10569 !! wikitext
10570 {{paramtest|param={{SITENAME}}}}
10571 !! html
10572 <p>This is a test template with parameter MediaWiki
10573 </p>
10574 !! end
10575
10576 !! article
10577 Template:linktest
10578 !! text
10579 [[{{{param}}}|link]]
10580 !! endarticle
10581
10582 !! test
10583 Template parameter as link source
10584 !! wikitext
10585 {{linktest|param=Main Page}}
10586 !! html
10587 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10588 </p>
10589 !! end
10590
10591 !!article
10592 Template:paramtest2
10593 !! text
10594 including another template, {{paramtest|param={{{arg}}}}}
10595 !! endarticle
10596
10597 !! test
10598 Template passing argument to another template
10599 !! wikitext
10600 {{paramtest2|arg='hmm'}}
10601 !! html
10602 <p>including another template, This is a test template with parameter 'hmm'
10603 </p>
10604 !! end
10605
10606 !! article
10607 Template:Linktest2
10608 !! text
10609 Main Page
10610 !! endarticle
10611
10612 !! test
10613 Template as link source
10614 !! wikitext
10615 [[{{linktest2}}]]
10616
10617 [[{{linktest2}}|Main Page]]
10618
10619 [[{{linktest2}}]]Page
10620 !! html
10621 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10622 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10623 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10624 </p>
10625 !! end
10626
10627
10628 !! article
10629 Template:loop1
10630 !! text
10631 {{loop2}}
10632 !! endarticle
10633
10634 !! article
10635 Template:loop2
10636 !! text
10637 {{loop1}}
10638 !! endarticle
10639
10640 !! test
10641 Template infinite loop
10642 !! wikitext
10643 {{loop1}}
10644 !! html
10645 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10646 </p>
10647 !! end
10648
10649 !! test
10650 Template from main namespace
10651 !! wikitext
10652 {{:Main Page}}
10653 !! html
10654 <p>blah blah
10655 </p>
10656 !! end
10657
10658 !! article
10659 Template:table
10660 !! text
10661 {|
10662 | 1 || 2
10663 |-
10664 | 3 || 4
10665 |}
10666 !! endarticle
10667
10668 !! test
10669 BUG 529: Template with table, not included at beginning of line
10670 !! wikitext
10671 foo {{table}}
10672 !! html
10673 <p>foo
10674 </p>
10675 <table>
10676 <tr>
10677 <td> 1 </td>
10678 <td> 2
10679 </td></tr>
10680 <tr>
10681 <td> 3 </td>
10682 <td> 4
10683 </td></tr></table>
10684
10685 !! end
10686
10687 !! test
10688 BUG 523: Template shouldn't eat newline (or add an extra one before table)
10689 !! wikitext
10690 foo
10691 {{table}}
10692 !! html
10693 <p>foo
10694 </p>
10695 <table>
10696 <tr>
10697 <td> 1 </td>
10698 <td> 2
10699 </td></tr>
10700 <tr>
10701 <td> 3 </td>
10702 <td> 4
10703 </td></tr></table>
10704
10705 !! end
10706
10707 !! test
10708 BUG 41: Template parameters shown as broken links
10709 !! wikitext
10710 {{{parameter}}}
10711 !! html
10712 <p>{{{parameter}}}
10713 </p>
10714 !! end
10715
10716 !! test
10717 Template with targets containing wikilinks
10718 !! wikitext
10719 {{[[foo]]}}
10720
10721 {{[[{{echo|foo}}]]}}
10722
10723 {{{{echo|[[foo}}]]}}
10724 !! html
10725 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10726 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10727 </p><p>{{[[foo}}]]
10728 </p>
10729 !! end
10730
10731 !! article
10732 Template:''
10733 !! text
10734 bar
10735 !! endarticle
10736
10737 !! test
10738 Templates: Double quotes as template target
10739 !! wikitext
10740 foo {{''}} baz
10741 !! html/php
10742 <p>foo bar baz
10743 </p>
10744 !! html/parsoid
10745 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
10746 </p>
10747 !! end
10748
10749 ## This test is about making sure Parsoid's data-mw is well formed in the
10750 ## face of multiple templates with intersecting and overlapping ranges. The
10751 ## wikitext itself is wretched.
10752 !! test
10753 Templates with intersecting and overlapping ranges
10754 !! wikitext
10755 {|{{echo|
10756 <p>ha</p>}}
10757 {|{{echo|
10758 <p>ho</p>}}
10759 {{echo|{{!}}hi}}
10760 |}
10761 !! html/php+tidy
10762 <p>ha</p>
10763 <p>ho</p>
10764 <table>
10765 <tr>
10766 <td></td>
10767 </tr>
10768 <tr>
10769 <td>hi</td>
10770 </tr>
10771 </table>
10772 <table>
10773 <tr>
10774 <td></td>
10775 </tr>
10776 </table>
10777 !! html/parsoid
10778 <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":""}]]}'>
10779
10780 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
10781
10782 <tbody><tr><td>hi</td></tr>
10783 </tbody></table>
10784 !! end
10785
10786 !! article
10787 Template:MSGNW test
10788 !! text
10789 ''None'' of '''this''' should be
10790 * interpreted
10791 but rather passed unmodified
10792 {{test}}
10793 <gallery>
10794 File:Foobar.jpg
10795 </gallery>
10796 <!-- comment -->
10797 !! endarticle
10798
10799 # hmm, fix this or just deprecate msgnw and document its behavior?
10800 !! test
10801 msgnw keyword
10802 !! wikitext
10803 {{msgnw:MSGNW test}}
10804 !! html/php
10805 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
10806 &#42; interpreted
10807 &#32;but rather passed unmodified
10808 &#123;&#123;test&#125;&#125;
10809 &#60;gallery&#62;
10810 File:Foobar.jpg
10811 &#60;/gallery&#62;
10812 &#60;!-- comment --&#62;
10813 </p>
10814 !! end
10815
10816 !! test
10817 int keyword
10818 !! wikitext
10819 {{int:youhavenewmessages|lots of money|not!}}
10820 !! html
10821 <p>You have lots of money (not!).
10822 </p>
10823 !! end
10824
10825 !! test
10826 int keyword - non-existing message
10827 !! wikitext
10828 {{int:var}}
10829 !! html
10830 <p>&lt;var&gt;
10831 </p>
10832 !! end
10833
10834 !! article
10835 Template:Includes
10836 !! text
10837 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10838 !! endarticle
10839
10840 !! test
10841 <includeonly> and <noinclude> being included
10842 !! wikitext
10843 {{Includes}}
10844 !! html
10845 <p>Foobar
10846 </p>
10847 !! end
10848
10849 !! article
10850 Template:Includes2
10851 !! text
10852 <onlyinclude>Foo</onlyinclude>bar
10853 !! endarticle
10854
10855 !! test
10856 <onlyinclude> being included
10857 !! wikitext
10858 {{Includes2}}
10859 !! html
10860 <p>Foo
10861 </p>
10862 !! end
10863
10864
10865 !! article
10866 Template:Includes3
10867 !! text
10868 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
10869 !! endarticle
10870
10871 !! test
10872 <onlyinclude> and <includeonly> being included
10873 !! wikitext
10874 {{Includes3}}
10875 !! html
10876 <p>Foo
10877 </p>
10878 !! end
10879
10880 !! test
10881 <includeonly> and <noinclude> on a page
10882 !! wikitext
10883 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10884 !! html
10885 <p>Foozar
10886 </p>
10887 !! end
10888
10889 !! test
10890 Un-closed <noinclude>
10891 !! wikitext
10892 <noinclude>
10893 !! html
10894 !! end
10895
10896 !! test
10897 <onlyinclude> on a page
10898 !! wikitext
10899 <onlyinclude>Foo</onlyinclude>bar
10900 !! html
10901 <p>Foobar
10902 </p>
10903 !! end
10904
10905 !! test
10906 Un-closed <onlyinclude>
10907 !! wikitext
10908 <onlyinclude>
10909 !! html
10910 !! end
10911
10912 !!test
10913 Self-closed noinclude, includeonly, onlyinclude tags
10914 !! wikitext
10915 <noinclude />
10916 <includeonly />
10917 <onlyinclude />
10918 !! html
10919 <p><br />
10920 </p>
10921 !!end
10922
10923 !!test
10924 Unbalanced includeonly and noinclude tags
10925 !! wikitext
10926 {|
10927 |a</noinclude>
10928 |b</noinclude></noinclude>
10929 |c</noinclude></includeonly>
10930 |d</includeonly></includeonly>
10931 |}
10932 !! html
10933 <table>
10934 <tr>
10935 <td>a
10936 </td>
10937 <td>b
10938 </td>
10939 <td>c&lt;/includeonly&gt;
10940 </td>
10941 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
10942 </td></tr></table>
10943
10944 !!end
10945
10946 !! article
10947 Template:Includeonly section
10948 !! text
10949 <includeonly>
10950 ==Includeonly section==
10951 </includeonly>
10952 ==Section T-1==
10953 !!endarticle
10954
10955 !! test
10956 Bug 6563: Edit link generation for section shown by <includeonly>
10957 !! wikitext
10958 {{includeonly section}}
10959 !! html
10960 <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>
10961 <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>
10962
10963 !! end
10964
10965 # Uses same input as the contents of [[Template:Includeonly section]]
10966 !! test
10967 Bug 6563: Section extraction for section shown by <includeonly>
10968 !! options
10969 section=T-2
10970 !! wikitext
10971 <includeonly>
10972 ==Includeonly section==
10973 </includeonly>
10974 ==Section T-2==
10975 !! html
10976 ==Section T-2==
10977 !! end
10978
10979 !! test
10980 Bug 6563: Edit link generation for section suppressed by <includeonly>
10981 !! wikitext
10982 <includeonly>
10983 ==Includeonly section==
10984 </includeonly>
10985 ==Section 1==
10986 !! html
10987 <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>
10988
10989 !! end
10990
10991 !! test
10992 Bug 6563: Section extraction for section suppressed by <includeonly>
10993 !! options
10994 section=1
10995 !! wikitext
10996 <includeonly>
10997 ==Includeonly section==
10998 </includeonly>
10999 ==Section 1==
11000 !! html
11001 ==Section 1==
11002 !! end
11003
11004 !! test
11005 Un-closed <includeonly>
11006 !! wikitext
11007 <includeonly>
11008 !! html/php
11009 !! html/parsoid
11010 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11011 !! end
11012
11013 ## We used to, but no longer wt2wt this test since the default serializer
11014 ## will normalize the include directives to serialize on their own line.
11015 ## Selser will take care of preserving formatting in scenarios where they
11016 ## intermingled with other wikitext.
11017 !! test
11018 Includes and comments at SOL
11019 !! options
11020 parsoid=wt2html,html2html
11021 !! wikitext
11022 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11023
11024 <noinclude>
11025 some
11026 </noinclude>* stuff
11027 * here
11028
11029 <includeonly>can have stuff</includeonly>=== here ===
11030
11031 !! html/php
11032 <h2><span class="mw-headline" id="hu">hu</span></h2>
11033 <p>some
11034 </p>
11035 <ul><li> stuff</li>
11036 <li> here</li></ul>
11037 <h3><span class="mw-headline" id="here">here</span></h3>
11038
11039 !! html/parsoid
11040 <!-- 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>
11041
11042 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11043 <p>some</p>
11044 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11045 <li> here</li></ul>
11046
11047 <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>
11048
11049 !! end
11050
11051 # TODO: test with DOM fragment reuse!
11052 !! test
11053 Parsoid: DOM fragment reuse
11054 !! options
11055 parsoid=wt2wt,wt2html
11056 !! wikitext
11057 a{{echo|b<table></table>c}}d
11058
11059 a{{echo|b
11060 <table></table>
11061 c}}d
11062
11063 {{echo|a
11064
11065 <table></table>
11066
11067 b}}
11068 !! html
11069 <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>
11070
11071 <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">
11072 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11073 </span><p about="#mwt2">cd</p>
11074
11075 <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">
11076
11077 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11078
11079 </span><p about="#mwt3">b</p>
11080 !! end
11081
11082 !! test
11083 Parsoid: Merge double tds (T52603)
11084 !! options
11085 parsoid
11086 !! wikitext
11087 {|
11088 |{{echo|{{!}} foo}}
11089 |}
11090 !! html
11091 <table><tbody>
11092 <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>
11093 </tbody></table>
11094 !! end
11095
11096 !! test
11097 Parsoid: Merge double tds in nested transclusion content (T52603)
11098 !! options
11099 parsoid
11100 !! wikitext
11101 {{echo|<div>}}
11102 {|
11103 |{{echo|{{!}} foo}}
11104 |}
11105 {{echo|</div>}}
11106 !! html
11107 <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}}]}'>
11108 <table><tbody>
11109 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11110 </tbody></table>
11111 </div>
11112 !! end
11113
11114 ###
11115 ### <includeonly> and <noinclude> in attributes
11116 ###
11117 !!test
11118 0. includeonly around the entire attribute
11119 !! wikitext
11120 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11121 !! html
11122 <p><span id="v2">bar</span>
11123 </p>
11124 !!end
11125
11126 !!test
11127 1. includeonly in html attr key
11128 !! wikitext
11129 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11130 !! html
11131 <p><span id="foo">bar</span>
11132 </p>
11133 !!end
11134
11135 !!test
11136 2. includeonly in html attr value
11137 !! wikitext
11138 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11139 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11140 !! html
11141 <p><span id="v1">bar</span>
11142 <span id="v1">bar</span>
11143 </p>
11144 !!end
11145
11146 !!test
11147 3. includeonly in part of an attr value
11148 !! wikitext
11149 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11150 !! html
11151 <p><span style="color:red;">bar</span>
11152 </p>
11153 !!end
11154
11155 !!test
11156 4. includeonly in table attributes
11157 !! wikitext
11158 {|
11159 |- <noinclude>
11160 |-
11161 |a
11162 </noinclude>
11163 |- <includeonly>
11164 |-
11165 |b
11166 </includeonly>
11167 |}
11168 !! html
11169 <table>
11170
11171
11172 <tr>
11173 <td>a
11174 </td></tr>
11175 </table>
11176
11177 !!end
11178
11179 ###
11180 ### Token Stream Patcher tests
11181 ###
11182 ### These tests won't always pass wt2wt and other modes because
11183 ### on serialization, the table will be output on a new line.
11184 ### For now, we are blacklisting them, and using this to test selser.
11185 ###
11186
11187 !!test
11188 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11189 !!options
11190 parsoid=wt2html,wt2wt
11191 !!wikitext
11192 {{echo|}}{| width = '100%'
11193 |foo
11194 |}
11195 !!html/parsoid
11196 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11197 <tbody><tr><td>foo</td></tr>
11198 </tbody></table>
11199 !!end
11200
11201 ## We used to, but no longer wt2wt this test since the default serializer
11202 ## will normalize the include directives to serialize on their own line.
11203 ## Selser will take care of preserving formatting in scenarios where they
11204 ## intermingled with other wikitext.
11205 !!test
11206 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11207 !!options
11208 parsoid=wt2html
11209 !!wikitext
11210 <includeonly>a</includeonly>{| {{{b}}}
11211 |c
11212 |}
11213 !!html/parsoid
11214 <meta typeof="mw:Includes/IncludeOnly"/><meta typeof="mw:Includes/IncludeOnly/End"/><table about="#mwt2" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"{{{b}}}","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[31,38,null,null],&amp;quot;src&amp;quot;:&amp;quot;{{{b}}}&amp;quot;}\">{{{b}}}&lt;/span>"},{"html":""}]]}' data-parsoid='{"a":{"{{{b}}}":null},"sa":{"{{{b}}}":""}}'>
11215 <tbody><tr><td>c</td></tr>
11216 </tbody></table>
11217
11218 !!end
11219
11220 ###
11221 ### Testing parsing of templates where a template arg
11222 ### has the same name as the template itself.
11223 ###
11224
11225 !! article
11226 Template:quote
11227 !! text
11228 {{{quote|{{{1}}}}}}
11229 !! endarticle
11230
11231 !!test
11232 Templates: Template Name/Arg clash: 1. Use of positional param
11233 !! wikitext
11234 {{quote|foo}}
11235 !! html
11236 <p>foo
11237 </p>
11238 !!end
11239
11240 !!test
11241 Templates: Template Name/Arg clash: 2. Use of named param
11242 !! wikitext
11243 {{quote|quote=foo}}
11244 !! html
11245 <p>foo
11246 </p>
11247 !!end
11248
11249 !!test
11250 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11251 !! wikitext
11252 {{quote|quote}}
11253 !! html
11254 <p>quote
11255 </p>
11256 !!end
11257
11258 ###
11259 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11260 ###
11261
11262 !!test
11263 Templates: 1. Simple use
11264 !! wikitext
11265 {{echo|Foo}}
11266 !! html
11267 <p>Foo
11268 </p>
11269 !!end
11270
11271 !!test
11272 Templates: 2. Inside a block tag
11273 !! wikitext
11274 <div>{{echo|Foo}}</div>
11275 <blockquote>{{echo|Foo}}</blockquote>
11276 !! html
11277 <div>Foo</div>
11278 <blockquote>Foo</blockquote>
11279
11280 !! html+tidy
11281 <div>Foo</div>
11282 <blockquote>
11283 <p>Foo</p>
11284 </blockquote>
11285 !!end
11286
11287 !!test
11288 Templates: P-wrapping: 1a. Templates on consecutive lines
11289 !! wikitext
11290 {{echo|Foo}}
11291 {{echo|bar}}
11292 !! html
11293 <p>Foo
11294 bar
11295 </p>
11296 !!end
11297
11298 !!test
11299 Templates: P-wrapping: 1b. Templates on consecutive lines
11300 !! wikitext
11301 Foo
11302
11303 {{echo|bar}}
11304 {{echo|baz}}
11305 !! html
11306 <p>Foo
11307 </p><p>bar
11308 baz
11309 </p>
11310 !!end
11311
11312 !!test
11313 Templates: P-wrapping: 1c. Templates on consecutive lines
11314 !! wikitext
11315 {{echo|Foo}}
11316 {{echo|bar}} <div>baz</div>
11317 !! html
11318 <p>Foo
11319 </p>
11320 bar <div>baz</div>
11321
11322 !! html+tidy
11323 <p>Foo</p>
11324 <p>bar</p>
11325 <div>baz</div>
11326 !! end
11327
11328 !!test
11329 Templates: P-wrapping: 1d. Template preceded by comment-only line
11330 !!options
11331 parsoid
11332 !! wikitext
11333 <!-- foo -->
11334 {{echo|Bar}}
11335 !! html
11336 <!-- foo -->
11337
11338 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11339 !!end
11340
11341 !!test
11342 Templates: Inline Text: 1. Multiple template uses
11343 !! wikitext
11344 {{echo|Foo}}bar{{echo|baz}}
11345 !! html
11346 <p>Foobarbaz
11347 </p>
11348 !!end
11349
11350 !!test
11351 Templates: Inline Text: 2. Back-to-back template uses
11352 !! wikitext
11353 {{echo|Foo}}{{echo|bar}}
11354 !! html
11355 <p>Foobar
11356 </p>
11357 !!end
11358
11359 !!test
11360 Templates: Block Tags: 1. Multiple template uses
11361 !! wikitext
11362 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11363 !! html
11364 <div>Foo</div><div>bar</div><div>baz</div>
11365
11366 !!end
11367
11368 !!test
11369 Templates: Block Tags: 2. Back-to-back template uses
11370 !! wikitext
11371 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11372 !! html
11373 <div>Foo</div><div>bar</div>
11374
11375 !!end
11376
11377 # This is an edge case relating to paragraph wrapping.
11378 !!test
11379 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11380 !! wikitext
11381 {{echo|a
11382 b</p>}}
11383 !! html/parsoid
11384 <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
11385 b</p>
11386 !!end
11387
11388 !!test
11389 Templates: Links: 1. Simple example
11390 !! wikitext
11391 {{echo|[[Foo|bar]]}}
11392 !! html
11393 <p><a href="/wiki/Foo" title="Foo">bar</a>
11394 </p>
11395 !!end
11396
11397 !!test
11398 Templates: Links: 2. Generation of link href
11399 !! wikitext
11400 [[{{echo|Foo}}|bar]]
11401 !! html
11402 <p><a href="/wiki/Foo" title="Foo">bar</a>
11403 </p>
11404 !!end
11405
11406 !!test
11407 Templates: Links: 3. Generation of part of a link href
11408 !! wikitext
11409 [[Fo{{echo|o}}|bar]]
11410
11411 [[Foo{{echo|bar}}]]
11412
11413 [[Foo{{echo|bar}}baz]]
11414
11415 [[Foo{{echo|bar}}|bar]]
11416
11417 [[:Foo{{echo|bar}}]]
11418
11419 [[:Foo{{echo|bar}}|bar]]
11420 !! html
11421 <p><a href="/wiki/Foo" title="Foo">bar</a>
11422 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11423 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11424 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11425 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11426 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11427 </p>
11428 !!end
11429
11430 !!test
11431 Templates: Links: 4. Multiple templates generating link href
11432 !! wikitext
11433 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11434 !! html
11435 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11436 </p>
11437 !!end
11438
11439 !!test
11440 Templates: Links: 5. Generation of link text
11441 !! wikitext
11442 [[Foo|{{echo|bar}}]]
11443 !! html
11444 <p><a href="/wiki/Foo" title="Foo">bar</a>
11445 </p>
11446 !!end
11447
11448 !!test
11449 Templates: Links: 5. Nested templates (only outermost template should be marked)
11450 !! wikitext
11451 {{echo|[[{{echo|Foo}}|bar]]}}
11452 !! html
11453 <p><a href="/wiki/Foo" title="Foo">bar</a>
11454 </p>
11455 !!end
11456
11457 !!test
11458 Templates: HTML Tag: 1. Generation of HTML attr. key
11459 !! wikitext
11460 <div {{echo|style}}="color:red;">foo</div>
11461 !! html
11462 <div style="color:red;">foo</div>
11463
11464 !!end
11465
11466 !!test
11467 Templates: HTML Tag: 2. Generation of HTML attr. value
11468 !! wikitext
11469 <div style={{echo|'color:red;'}}>foo</div>
11470 !! html
11471 <div style="color:red;">foo</div>
11472
11473 !!end
11474
11475 !!test
11476 Templates: HTML Tag: 3. Generation of HTML attr key and value
11477 !! wikitext
11478 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11479 !! html
11480 <div style="color:red;">foo</div>
11481
11482 !!end
11483
11484 !!test
11485 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11486 !! wikitext
11487 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11488 !! html
11489 <div title="This is a long title with just one piece templated">foo</div>
11490
11491 !!end
11492
11493 !!test
11494 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11495 !! wikitext
11496 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11497 !! html
11498 <div title="This is a long title with just one piece templated">foo</div>
11499
11500 !!end
11501
11502 !!test
11503 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11504 !! wikitext
11505 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11506 !! html
11507 <div title="This is a long title with just one piece templated">foo</div>
11508
11509 !!end
11510
11511 # SSS FIXME: While it is great we added support for all this,
11512 # do we want to make this part of the spec? Maybe we want to
11513 # deprecate this kind of usage in the future?
11514 !!test
11515 Templates: HTML Tag: 7. Generation of partial attribute key string
11516 !! wikitext
11517 <div st{{echo|yle}}="color:red;">foo</div>
11518 !! html
11519 <div style="color:red;">foo</div>
11520
11521 !!end
11522
11523 !! test
11524 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11525 !! wikitext
11526 <div {{echo|1=id="v1"}}>bar</div>
11527 !! html
11528 <div id="v1">bar</div>
11529
11530 !!end
11531
11532 !! test
11533 Templates: HTML Tag: 9. Multiple template-generated attributes
11534 !! wikitext
11535 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11536 !! html
11537 <div id="v1" title="foo">bar</div>
11538
11539 !!end
11540
11541 !! test
11542 Templates: Support for templates generating attributes and content
11543 !! wikitext
11544 {| {{mixed_attr_content_template}}
11545 |-
11546 |bar
11547 |}
11548 !! html/php
11549 <table style="color:red;" title="T48811">
11550
11551 <tr>
11552 <td>foo
11553 </td></tr>
11554 <tr>
11555 <td>bar
11556 </td></tr></table>
11557
11558 !! html/parsoid
11559 <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|}"]}'>
11560 <tbody><tr>
11561 <td>foo</td></tr>
11562 <tr>
11563 <td>bar</td></tr>
11564 </tbody></table>
11565 !!end
11566
11567 !! test
11568 1. Entities and nowikis inside templated attributes should be handled correctly
11569 !! wikitext
11570 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11571 !! html/php
11572 <div style="background:#f9f9f9;">foo</div>
11573
11574 !! html/parsoid
11575 <div style="background:#f9f9f9;" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html"}' data-mw='{"attribs":[[{"txt":"style","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;}]],&amp;quot;dsr&amp;quot;:[5,49,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;style{{=}}\\&amp;quot;background:&amp;amp;#35;f9f9f9;\\&amp;quot;&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">style&lt;/span>&lt;span typeof=\"mw:Nowiki\" about=\"#mwt1\" data-parsoid=\"{}\">=&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">\"background:&lt;/span>&lt;span typeof=\"mw:Entity\" about=\"#mwt1\" data-parsoid=\"{&amp;quot;src&amp;quot;:&amp;quot;&amp;amp;#35;&amp;quot;,&amp;quot;srcContent&amp;quot;:&amp;quot;#&amp;quot;}\">#&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">f9f9f9;\"&lt;/span>"},{"html":""}]]}'>foo</div>
11576 !! end
11577
11578 !! test
11579 2. Entities and nowikis inside templated attributes should be handled correctly
11580 !! wikitext
11581 {|
11582 |{{table_attribs_3}}
11583 |}
11584 !! html/php
11585 <table>
11586 <tr>
11587 <td style="background:#f9f9f9;">Foo
11588 </td></tr></table>
11589
11590 !! html/parsoid
11591 <table>
11592 <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>
11593 </tbody></table>
11594 !! end
11595
11596 !! test
11597 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11598 !! wikitext
11599 {{tbl-start}}
11600 |{{table_attribs_3}}
11601 {{tbl-end}}
11602 !! html/php
11603 <table>
11604 <tr>
11605 <td style="background:#f9f9f9;">Foo
11606 </td></tr></table>
11607
11608 !! html/parsoid
11609 <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}}]}'>
11610 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11611 </tbody></table>
11612 !! end
11613
11614 # T107622
11615 !! test
11616 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11617 !! wikitext
11618 {|
11619 | {{table_attribs_6}} hi
11620 |}
11621 !! html/php
11622 <table>
11623 <tr>
11624 <td style="background: red;"> hi
11625 </td></tr></table>
11626
11627 !! html/parsoid
11628 <table>
11629 <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>
11630 </tbody></table>
11631 !! end
11632
11633 !!test
11634 Templates: HTML Tables: 1. Generating start of a HTML table
11635 !! wikitext
11636 {{echo|<table><tr><td>foo</td>}}</tr></table>
11637 !! html
11638 <table><tr><td>foo</td></tr></table>
11639
11640 !!end
11641
11642 !!test
11643 Templates: HTML Tables: 2a. Generating middle of a HTML table
11644 !! wikitext
11645 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11646 !! html
11647 <table><tr><td>foo</td></tr></table>
11648
11649 !!end
11650
11651 !!test
11652 Templates: HTML Tables: 2b. Generating middle of a HTML table
11653 !! wikitext
11654 <table>{{echo|<tr><td>foo</td></tr>}}</table>
11655 !! html
11656 <table><tr><td>foo</td></tr></table>
11657
11658 !!end
11659
11660 !!test
11661 Templates: HTML Tables: 3. Generating end of a HTML table
11662 !! wikitext
11663 <table><tr>{{echo|<td>foo</td></tr></table>}}
11664 !! html
11665 <table><tr><td>foo</td></tr></table>
11666
11667 !!end
11668
11669 !!test
11670 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
11671 !! wikitext
11672 {{echo|<table>}}<tr><td>foo</td></tr></table>
11673 !! html
11674 <table><tr><td>foo</td></tr></table>
11675
11676 !!end
11677
11678 !!test
11679 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
11680 !! wikitext
11681 <table>{{echo|<tr>}}<td>foo</td></tr></table>
11682 !! html
11683 <table><tr><td>foo</td></tr></table>
11684
11685 !!end
11686
11687 !!test
11688 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
11689 !! wikitext
11690 <table><tr>{{echo|<td>}}foo</td></tr></table>
11691 !! html
11692 <table><tr><td>foo</td></tr></table>
11693
11694 !!end
11695
11696 !!test
11697 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
11698 !! wikitext
11699 <table><tr><td>foo{{echo|</td>}}</tr></table>
11700 !! html
11701 <table><tr><td>foo</td></tr></table>
11702
11703 !!end
11704
11705 !!test
11706 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
11707 !! wikitext
11708 <table><tr><td>foo</td>{{echo|</tr>}}</table>
11709 !! html
11710 <table><tr><td>foo</td></tr></table>
11711
11712 !!end
11713
11714 !!test
11715 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
11716 !! wikitext
11717 <table><tr><td>foo</td></tr>{{echo|</table>}}
11718 !! html
11719 <table><tr><td>foo</td></tr></table>
11720
11721 !!end
11722
11723 !!test
11724 Templates: HTML Tables: 5. Proper fostering of categories from inside
11725 !!options
11726 parsoid=wt2html,wt2wt
11727 !! wikitext
11728 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
11729 <!--Two categories (Bug 50330)-->
11730 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
11731 !! html
11732 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
11733 <!--Two categories (Bug 50330)-->
11734 <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>
11735 !!end
11736
11737 !!test
11738 Templates: Wiki Tables: 1a. Fostering of entire template content
11739 !! wikitext
11740 {|
11741 {{echo|a}}
11742 |}
11743 !! html
11744 <table>
11745 a
11746 <tr><td></td></tr></table>
11747
11748 !! html+tidy
11749 <p>a</p>
11750 <table>
11751 <tr>
11752 <td></td>
11753 </tr>
11754 </table>
11755 !! end
11756
11757 !!test
11758 Templates: Wiki Tables: 1b. Fostering of entire template content
11759 !! wikitext
11760 {|
11761 {{echo|<div>}}
11762 foo
11763 {{echo|</div>}}
11764 |}
11765 !! html
11766 <table>
11767 <div>
11768 <p>foo
11769 </p>
11770 </div>
11771 <tr><td></td></tr></table>
11772
11773 !! html+tidy
11774 <div>
11775 <p>foo</p>
11776 </div>
11777 <table>
11778 <tr>
11779 <td></td>
11780 </tr>
11781 </table>
11782 !! end
11783
11784 !!test
11785 Templates: Wiki Tables: 2. Fostering of partial template content
11786 !! wikitext
11787 {|
11788 {{echo|a
11789 <div>b</div>}}
11790 |}
11791 !! html
11792 <table>
11793 a
11794 <div>b</div>
11795 <tr><td></td></tr></table>
11796
11797 !! html+tidy
11798 <p>a</p>
11799 <div>b</div>
11800 <table>
11801 <tr>
11802 <td></td>
11803 </tr>
11804 </table>
11805 !! end
11806
11807 !!test
11808 Templates: Wiki Tables: 3. td-content via multiple templates
11809 !! wikitext
11810 {|
11811 {{echo|{{pipe}}a}}{{echo|b}}
11812 |}
11813 !! html
11814 <table>
11815 <tr>
11816 <td>ab
11817 </td></tr></table>
11818
11819 !!end
11820
11821 !!test
11822 Templates: Wiki Tables: 4. Templated tags, no content
11823 !! wikitext
11824 {{tbl-start}}
11825 {{tbl-end}}
11826 !! html
11827 <table>
11828 <tr><td></td></tr></table>
11829
11830 !!end
11831
11832 !!test
11833 Templates: Wiki Tables: 5. Templated tags, regular td-tags
11834 !! wikitext
11835 {{tbl-start}}
11836 |foo
11837 {{tbl-end}}
11838 !! html
11839 <table>
11840 <tr>
11841 <td>foo
11842 </td></tr></table>
11843
11844 !!end
11845
11846 !!test
11847 Templates: Wiki Tables: 6. Templated tags, templated td-tags
11848 !! wikitext
11849 {{tbl-start}}
11850 {{!}}foo
11851 {{tbl-end}}
11852 !! html
11853 <table>
11854 <tr>
11855 <td>foo
11856 </td></tr></table>
11857
11858 !!end
11859
11860 ## This test case is very specific to Parsoid's internals
11861 ## and is hence only tested for Parsoid's code. Parsoid uses
11862 ## a <meta> marker tag for <ref> tags and they are expanded
11863 ## much later. We are verifying that this <meta> tag usage
11864 ## doesn't prevent foster parenting.
11865 !!test
11866 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
11867 !!wikitext
11868 {{PartialTable}}<ref>foo</ref>
11869 |}
11870
11871 <references />
11872 !!html/parsoid
11873 <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">
11874 <tbody>
11875 </tbody></table>
11876
11877 <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>
11878 !!end
11879
11880 !! test
11881 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
11882 !! wikitext
11883 {{echo|
11884 {{{!}}
11885 {{!}}-}}
11886 <onlyinclude>
11887 |foo
11888 </onlyinclude>
11889 {{!}}}
11890 !! html/parsoid
11891 <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{{!}}}"]}'>
11892 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
11893 <tbody><tr>
11894
11895 <td>foo
11896 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
11897 </tbody></table>
11898 !! end
11899
11900 !!test
11901 Templates: Lists: Multi-line list-items via templates
11902 !! wikitext
11903 *{{echo|a {{nonexistent|
11904 unused}}}}
11905 *{{echo|b {{nonexistent|
11906 unused}}}}
11907 !! html
11908 <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>
11909 <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>
11910
11911 !!end
11912
11913 !!test
11914 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
11915 !! wikitext
11916 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
11917 !! html
11918 <p><i>ab</i>c<i>d</i>e
11919 </p>
11920 !!end
11921
11922 !!test
11923 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
11924 (PHP parser generates misnested html)
11925 !! wikitext
11926 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
11927 !! html/parsoid
11928 <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>
11929 !!end
11930
11931 !!test
11932 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
11933 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
11934 !! options
11935 parsoid=wt2html,wt2wt
11936 !! wikitext
11937 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
11938 !! html
11939 <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>
11940 <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>
11941 <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>
11942 !!end
11943
11944 !!test
11945 Templates: Ugly nesting: 4. Divs opened/closed across templates
11946 !! wikitext
11947 a<div>b{{echo|c</div>d}}e
11948 !! html
11949 a<div>bc</div>de
11950
11951 !! html+tidy
11952 <p>a</p>
11953 <div>bc</div>
11954 <p>de</p>
11955 !! end
11956
11957 !!test
11958 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
11959 (Parsoid-centric)
11960 !! options
11961 parsoid
11962 !! wikitext
11963 {|
11964 |{{echo|foo</table>}}
11965 |bar
11966 |}
11967 !! html
11968 <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|}"]}'>
11969
11970 <tbody>
11971 <tr>
11972 <td>foo</td></tr></tbody></table><span about="#mwt1">
11973 </span><span about="#mwt1">|bar</span><span about="#mwt1">
11974 |}</span>
11975 !!end
11976
11977 !!test
11978 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
11979 (Parsoid-centric)
11980 !! options
11981 parsoid
11982 !! wikitext
11983 <table>
11984 <tr>
11985 <td>
11986 <table>
11987 <tr>
11988 <td>1. {{echo|foo </table>}}</td>
11989 <td> bar </td>
11990 <td>2. {{echo|baz </table>}}</td>
11991 </tr>
11992 <tr>
11993 <td>abc</td>
11994 </tr>
11995 </table>
11996 </td>
11997 </tr>
11998 <tr>
11999 <td>xyz</td>
12000 </tr>
12001 </table>
12002 !! html
12003 <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>"]}'>
12004 <tbody><tr>
12005 <td>
12006 <table>
12007 <tbody><tr>
12008 <td>1. foo </td></tr></tbody></table></td>
12009 <td> bar </td>
12010 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
12011 </span><span about="#mwt2">
12012 </span><span about="#mwt2">
12013 </span><span about="#mwt2">abc</span><span about="#mwt2">
12014 </span><span about="#mwt2">
12015 </span><span about="#mwt2">
12016 </span><span about="#mwt2">
12017 </span><span about="#mwt2">
12018 </span><span about="#mwt2">
12019 </span><span about="#mwt2">xyz</span><span about="#mwt2">
12020 </span><span about="#mwt2">
12021 </span>
12022 !!end
12023
12024 !! test
12025 Templates: Ugly templates: 3. newline-only template parameter
12026 !! wikitext
12027 foo {{echo|
12028 }}
12029 !! html
12030 <p>foo
12031 </p>
12032 !! end
12033
12034 # This looks like a bug: a single newline triggers p/br for some reason.
12035 !! test
12036 Templates: Ugly templates: 4. newline-only template parameter inconsistency
12037 !! wikitext
12038 {{echo|
12039 }}
12040 !! html
12041 <p><br />
12042 </p>
12043 !! end
12044
12045 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
12046 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12047 !! test
12048 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12049 !! wikitext
12050 {{echo|<table>}}
12051 {{echo|<div>foo}}
12052 {{echo|</table>}}
12053 !! html/parsoid
12054 <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
12055 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12056 </table>
12057 !! end
12058
12059 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
12060 # that are "identical" and generate nesting cycles in the algorithm
12061 !! test
12062 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12063 !! wikitext
12064 {{echo|<table><tr><td><table>}}
12065 {{echo|<div>}}
12066 {{echo|</div>}}
12067 !! html/parsoid
12068 <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"}'>
12069 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12070 </table></td></tr></tbody></table>
12071 !! end
12072
12073 !! test
12074 Templates: Parameters substituted at the top-level
12075 !! wikitext
12076 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12077 !! html/php
12078 <p><i>who</i> me? <b>never!</b>
12079 </p>
12080 !! html/parsoid
12081 <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>
12082 !! end
12083
12084 !!test
12085 Parser Functions: 1. Simple example
12086 !! wikitext
12087 {{uc:foo}}
12088 !! html
12089 <p>FOO
12090 </p>
12091 !!end
12092
12093 !!test
12094 Parser Functions: 2. Nested use (only outermost should be marked up)
12095 !! wikitext
12096 {{uc:{{lc:FOO}}}}
12097 !! html
12098 <p>FOO
12099 </p>
12100 !!end
12101
12102 ###
12103 ### Pre-save transform tests
12104 ###
12105 !! test
12106 pre-save transform: subst:
12107 !! options
12108 pst
12109 !! wikitext
12110 {{subst:test}}
12111 !! html/php
12112 This is a test template
12113 !! end
12114
12115 !! test
12116 pre-save transform: normal template
12117 !! options
12118 pst
12119 !! wikitext
12120 {{test}}
12121 !! html/php
12122 {{test}}
12123 !! end
12124
12125 !! test
12126 pre-save transform: nonexistent template
12127 !! options
12128 pst
12129 !! wikitext
12130 {{thistemplatedoesnotexist}}
12131 !! html/php
12132 {{thistemplatedoesnotexist}}
12133 !! end
12134
12135 !! test
12136 pre-save transform: subst magic variables
12137 !! options
12138 pst
12139 !! wikitext
12140 {{subst:SITENAME}}
12141 !! html/php
12142 MediaWiki
12143 !! end
12144
12145 # This is bug 89, which I fixed. -- wtm
12146 !! test
12147 pre-save transform: subst: templates with parameters
12148 !! options
12149 pst
12150 !! wikitext
12151 {{subst:paramtest|param="something else"}}
12152 !! html/php
12153 This is a test template with parameter "something else"
12154 !! end
12155
12156 !! article
12157 Template:nowikitest
12158 !! text
12159 <nowiki>'''not wiki'''</nowiki>
12160 !! endarticle
12161
12162 !! test
12163 pre-save transform: nowiki in subst (bug 1188)
12164 !! options
12165 pst
12166 !! wikitext
12167 {{subst:nowikitest}}
12168 !! html/php
12169 <nowiki>'''not wiki'''</nowiki>
12170 !! end
12171
12172 !! article
12173 Template:commenttest
12174 !! text
12175 This template has <!-- a comment --> in it.
12176 !! endarticle
12177
12178 !! test
12179 pre-save transform: comment in subst (bug 1936)
12180 !! options
12181 pst
12182 !! wikitext
12183 {{subst:commenttest}}
12184 !! html/php
12185 This template has <!-- a comment --> in it.
12186 !! end
12187
12188 !! test
12189 pre-save transform: unclosed tag
12190 !! options
12191 pst
12192 !! wikitext
12193 <nowiki>'''not wiki'''
12194 !! html/php
12195 <nowiki>'''not wiki'''
12196 !! end
12197
12198 !! test
12199 pre-save transform: mixed tag case
12200 !! options
12201 pst
12202 !! wikitext
12203 <NOwiki>'''not wiki'''</noWIKI>
12204 !! html/php
12205 <NOwiki>'''not wiki'''</noWIKI>
12206 !! end
12207
12208 !! test
12209 pre-save transform: unclosed comment in <nowiki>
12210 !! options
12211 pst
12212 !! wikitext
12213 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12214 !! html/php
12215 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12216 !!end
12217
12218 # Leading @ in this template definition works around a limitation
12219 # in parsoid's parserTests which otherwise strips the <span> from the
12220 # result (confusing it for a template wrapper)
12221 !! article
12222 Template:dangerous
12223 !!text
12224 @<span onmouseover="alert('crap')">Oh no</span>
12225 !!endarticle
12226
12227 !!test
12228 (confirming safety of fix for subst bug 1936)
12229 !! wikitext
12230 {{Template:dangerous}}
12231 !! html
12232 <p>@<span>Oh no</span>
12233 </p>
12234 !! end
12235
12236 !! test
12237 pre-save transform: comment containing gallery (bug 5024)
12238 !! options
12239 pst
12240 !! wikitext
12241 <!-- <gallery>data</gallery> -->
12242 !! html/php
12243 <!-- <gallery>data</gallery> -->
12244 !!end
12245
12246 !! test
12247 pre-save transform: comment containing extension
12248 !! options
12249 pst
12250 !! wikitext
12251 <!-- <tag>data</tag> -->
12252 !! html/php
12253 <!-- <tag>data</tag> -->
12254 !!end
12255
12256 !! test
12257 pre-save transform: comment containing nowiki
12258 !! options
12259 pst
12260 !! wikitext
12261 <!-- <nowiki>data</nowiki> -->
12262 !! html/php
12263 <!-- <nowiki>data</nowiki> -->
12264 !!end
12265
12266 !! test
12267 pre-save transform: <noinclude> in subst (bug 3298)
12268 !! options
12269 pst
12270 !! wikitext
12271 {{subst:Includes}}
12272 !! html/php
12273 Foobar
12274 !! end
12275
12276 !! test
12277 pre-save transform: <onlyinclude> in subst (bug 3298)
12278 !! options
12279 pst
12280 !! wikitext
12281 {{subst:Includes2}}
12282 !! html/php
12283 Foo
12284 !! end
12285
12286 !! article
12287 Template:SubstTest
12288 !!text
12289 {{<includeonly>subst:</includeonly>Includes}}
12290 !! endarticle
12291
12292 !! article
12293 Template:SafeSubstTest
12294 !! text
12295 {{<includeonly>safesubst:</includeonly>Includes}}
12296 !! endarticle
12297
12298 !! test
12299 bug 22297: safesubst: works during PST
12300 !! options
12301 pst
12302 !! wikitext
12303 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12304 !! html/php
12305 FoobarFoobar
12306 !! end
12307
12308 !! test
12309 bug 22297: safesubst: works during normal parse
12310 !! wikitext
12311 {{SafeSubstTest}}
12312 !! html
12313 <p>Foobar
12314 </p>
12315 !! end
12316
12317 !! test
12318 subst: does not work during normal parse
12319 !! wikitext
12320 {{SubstTest}}
12321 !! html
12322 <p>{{subst:Includes}}
12323 </p>
12324 !! end
12325
12326 !! test
12327 pre-save transform: context links ("pipe trick")
12328 !! options
12329 pst
12330 !! wikitext
12331 [[Article (context)|]]
12332 [[Bar:Article|]]
12333 [[:Bar:Article|]]
12334 [[Bar:Article (context)|]]
12335 [[:Bar:Article (context)|]]
12336 [[|Article]]
12337 [[|Article (context)]]
12338 [[Bar:X (Y) Z|]]
12339 [[:Bar:X (Y) Z|]]
12340 !! html/php
12341 [[Article (context)|Article]]
12342 [[Bar:Article|Article]]
12343 [[:Bar:Article|Article]]
12344 [[Bar:Article (context)|Article]]
12345 [[:Bar:Article (context)|Article]]
12346 [[Article]]
12347 [[Article (context)]]
12348 [[Bar:X (Y) Z|X (Y) Z]]
12349 [[:Bar:X (Y) Z|X (Y) Z]]
12350 !! end
12351
12352 !! test
12353 pre-save transform: context links ("pipe trick") with interwiki prefix
12354 !! options
12355 pst
12356 !! wikitext
12357 [[interwiki:Article|]]
12358 [[:interwiki:Article|]]
12359 [[interwiki:Bar:Article|]]
12360 [[:interwiki:Bar:Article|]]
12361 !! html/php
12362 [[interwiki:Article|Article]]
12363 [[:interwiki:Article|Article]]
12364 [[interwiki:Bar:Article|Bar:Article]]
12365 [[:interwiki:Bar:Article|Bar:Article]]
12366 !! end
12367
12368 !! test
12369 pre-save transform: context links ("pipe trick") with parens in title
12370 !! options
12371 pst title=[[Somearticle (context)]]
12372 !! wikitext
12373 [[|Article]]
12374 !! html/php
12375 [[Article (context)|Article]]
12376 !! end
12377
12378 !! test
12379 pre-save transform: context links ("pipe trick") with comma in title
12380 !! options
12381 pst title=[[Someplace, Somewhere]]
12382 !! wikitext
12383 [[|Otherplace]]
12384 [[Otherplace, Elsewhere|]]
12385 [[Otherplace, Elsewhere, Anywhere|]]
12386 !! html/php
12387 [[Otherplace, Somewhere|Otherplace]]
12388 [[Otherplace, Elsewhere|Otherplace]]
12389 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12390 !! end
12391
12392 !! test
12393 pre-save transform: context links ("pipe trick") with parens and comma
12394 !! options
12395 pst title=[[Someplace (IGNORED), Somewhere]]
12396 !! wikitext
12397 [[|Otherplace]]
12398 [[Otherplace (place), Elsewhere|]]
12399 !! html/php
12400 [[Otherplace, Somewhere|Otherplace]]
12401 [[Otherplace (place), Elsewhere|Otherplace]]
12402 !! end
12403
12404 !! test
12405 pre-save transform: context links ("pipe trick") with comma and parens
12406 !! options
12407 pst title=[[Who, me? (context)]]
12408 !! wikitext
12409 [[|Yes, you.]]
12410 [[Me, Myself, and I (1937 song)|]]
12411 !! html/php
12412 [[Yes, you. (context)|Yes, you.]]
12413 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12414 !! end
12415
12416 !! test
12417 pre-save transform: context links ("pipe trick") with namespace
12418 !! options
12419 pst title=[[Ns:Somearticle]]
12420 !! wikitext
12421 [[|Article]]
12422 !! html/php
12423 [[Ns:Article|Article]]
12424 !! end
12425
12426 !! test
12427 pre-save transform: context links ("pipe trick") with namespace and parens
12428 !! options
12429 pst title=[[Ns:Somearticle (context)]]
12430 !! wikitext
12431 [[|Article]]
12432 !! html/php
12433 [[Ns:Article (context)|Article]]
12434 !! end
12435
12436 !! test
12437 pre-save transform: context links ("pipe trick") with namespace and comma
12438 !! options
12439 pst title=[[Ns:Somearticle, Context, Whatever]]
12440 !! wikitext
12441 [[|Article]]
12442 !! html/php
12443 [[Ns:Article, Context, Whatever|Article]]
12444 !! end
12445
12446 !! test
12447 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12448 !! options
12449 pst title=[[Ns:Somearticle, Context (context)]]
12450 !! wikitext
12451 [[|Article]]
12452 !! html/php
12453 [[Ns:Article (context)|Article]]
12454 !! end
12455
12456 !! test
12457 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12458 !! options
12459 pst title=[[Ns:Somearticle (IGNORED), Context]]
12460 !! wikitext
12461 [[|Article]]
12462 !! html/php
12463 [[Ns:Article, Context|Article]]
12464 !! end
12465
12466 !! test
12467 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12468 !! options
12469 pst
12470 !! wikitext
12471 [[Article(context)|]]
12472 [[Bar:Article(context)|]]
12473 [[:Bar:Article(context)|]]
12474 [[|Article(context)]]
12475 [[Bar:X(Y)Z|]]
12476 [[:Bar:X(Y)Z|]]
12477 !! html/php
12478 [[Article(context)|Article]]
12479 [[Bar:Article(context)|Article]]
12480 [[:Bar:Article(context)|Article]]
12481 [[Article(context)]]
12482 [[Bar:X(Y)Z|X(Y)Z]]
12483 [[:Bar:X(Y)Z|X(Y)Z]]
12484 !! end
12485
12486 !! test
12487 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12488 !! options
12489 pst
12490 !! wikitext
12491 [[Article (context)|]]
12492 [[Bar:Article (context)|]]
12493 [[:Bar:Article (context)|]]
12494 [[|Article (context)]]
12495 [[Bar:X (Y) Z|]]
12496 [[:Bar:X (Y) Z|]]
12497 !! html/php
12498 [[Article (context)|Article]]
12499 [[Bar:Article (context)|Article]]
12500 [[:Bar:Article (context)|Article]]
12501 [[Article (context)]]
12502 [[Bar:X (Y) Z|X (Y) Z]]
12503 [[:Bar:X (Y) Z|X (Y) Z]]
12504 !! end
12505
12506 !! test
12507 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12508 !! options
12509 pst
12510 !! wikitext
12511 [[Article(context)|]]
12512 [[Bar:Article(context)|]]
12513 [[:Bar:Article(context)|]]
12514 [[|Article(context)]]
12515 [[Bar:X(Y)Z|]]
12516 [[:Bar:X(Y)Z|]]
12517 !! html/php
12518 [[Article(context)|Article]]
12519 [[Bar:Article(context)|Article]]
12520 [[:Bar:Article(context)|Article]]
12521 [[Article(context)]]
12522 [[Bar:X(Y)Z|X(Y)Z]]
12523 [[:Bar:X(Y)Z|X(Y)Z]]
12524 !! end
12525
12526 !! test
12527 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12528 !! options
12529 pst
12530 !! wikitext
12531 [[Article (context), context|]]
12532 [[Article (context),context|]]
12533 [[Bar:Article (context), context|]]
12534 [[Bar:Article (context),context|]]
12535 [[:Bar:Article (context), context|]]
12536 [[:Bar:Article (context),context|]]
12537 !! html/php
12538 [[Article (context), context|Article]]
12539 [[Article (context),context|Article]]
12540 [[Bar:Article (context), context|Article]]
12541 [[Bar:Article (context),context|Article]]
12542 [[:Bar:Article (context), context|Article]]
12543 [[:Bar:Article (context),context|Article]]
12544 !! end
12545
12546 !! test
12547 pre-save transform: trim trailing empty lines
12548 !! options
12549 pst
12550 !! wikitext
12551 Empty lines are trimmed
12552
12553
12554
12555
12556 !! html/php
12557 Empty lines are trimmed
12558 !! end
12559
12560 !! test
12561 pre-save transform: Signature expansion
12562 !! options
12563 pst
12564 !! wikitext
12565 * ~~~
12566 * <noinclude>~~~</noinclude>
12567 * <includeonly>~~~</includeonly>
12568 * <onlyinclude>~~~</onlyinclude>
12569 !! html/php
12570 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12571 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12572 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12573 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12574 !! end
12575
12576
12577 !! test
12578 pre-save transform: Signature expansion in nowiki tags (bug 93)
12579 !! options
12580 pst disabled
12581 !! wikitext
12582 Shall not expand:
12583
12584 <nowiki>~~~~</nowiki>
12585
12586 <includeonly><nowiki>~~~~</nowiki></includeonly>
12587
12588 <noinclude><nowiki>~~~~</nowiki></noinclude>
12589
12590 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12591
12592 {{subst:Foo}} shall be converted to FOO
12593
12594 As well as inside noinclude/onlyinclude
12595 <noinclude>{{subst:Foo}}</noinclude>
12596 <onlyinclude>{{subst:Foo}}</onlyinclude>
12597
12598 But not inside includeonly
12599 <includeonly>{{subst:Foo}}</includeonly>
12600 !! html/php
12601 Shall not expand:
12602
12603 <nowiki>~~~~</nowiki>
12604
12605 <includeonly><nowiki>~~~~</nowiki></includeonly>
12606
12607 <noinclude><nowiki>~~~~</nowiki></noinclude>
12608
12609 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12610
12611 FOO shall be converted to FOO
12612
12613 As well as inside noinclude/onlyinclude
12614 <noinclude>FOO</noinclude>
12615 <onlyinclude>FOO</onlyinclude>
12616
12617 But not inside includeonly
12618 <includeonly>{{subst:Foo}}</includeonly>
12619 !! end
12620
12621 !! test
12622 Parsoid: Recognize nowiki with trailing space in tags
12623 !! options
12624 parsoid=wt2html
12625 !! wikitext
12626 <nowiki ><div>[[foo]]</nowiki >
12627
12628 a<nowiki / >b
12629
12630 c<nowiki />d
12631
12632 e<nowiki/ >f
12633 !! html
12634 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12635 <p>ab</p>
12636 <p>cd</p>
12637 <p>ef</p>
12638 !! end
12639
12640 !! test
12641 Parsoid: Recognize nowiki with odd capitalization
12642 !! options
12643 parsoid=wt2html
12644 !! wikitext
12645 <noWikI ><div>[[foo]]</Nowiki >
12646 !! html
12647 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12648 !! end
12649
12650
12651 !! test
12652 Parsoid: Escape nowiki with trailing space in tags
12653 !! options
12654 parsoid=html2wt
12655 !! html/parsoid
12656 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12657 <p>a&lt;nowiki /&gt;b</p>
12658 <p>c&lt;nowiki/ &gt;d</p>
12659 !! wikitext
12660 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12661
12662 a&lt;nowiki /&gt;b
12663
12664 c&lt;nowiki/ &gt;d
12665 !! end
12666
12667 !! test
12668 Parsoid: Escape weird noWikI capitalizations
12669 !! options
12670 parsoid=html2wt
12671 !! html/parsoid
12672 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
12673 !! wikitext
12674 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
12675 !! end
12676
12677 ###
12678 ### Message transform tests
12679 ###
12680 !! test
12681 message transform: magic variables
12682 !! options
12683 msg
12684 !! wikitext
12685 {{SITENAME}}
12686 !! html
12687 MediaWiki
12688 !! end
12689
12690 !! test
12691 message transform: should not transform wiki markup
12692 !! options
12693 msg
12694 !! wikitext
12695 ''test''
12696 !! html
12697 ''test''
12698 !! end
12699
12700 !! test
12701 message transform: <noinclude> in transcluded template (bug 4926)
12702 !! options
12703 msg
12704 !! wikitext
12705 {{Includes}}
12706 !! html
12707 Foobar
12708 !! end
12709
12710 !! test
12711 message transform: <onlyinclude> in transcluded template (bug 4926)
12712 !! options
12713 msg
12714 !! wikitext
12715 {{Includes2}}
12716 !! html
12717 Foo
12718 !! end
12719
12720 !! test
12721 {{#special:}} page name, known
12722 !! options
12723 msg
12724 !! wikitext
12725 {{#special:Recentchanges}}
12726 !! html
12727 Special:RecentChanges
12728 !! end
12729
12730 !! test
12731 {{#special:}} page name with subpage, known
12732 !! options
12733 msg
12734 !! wikitext
12735 {{#special:Recentchanges/param}}
12736 !! html
12737 Special:RecentChanges/param
12738 !! end
12739
12740 !! test
12741 {{#special:}} page name, unknown
12742 !! options
12743 msg
12744 !! wikitext
12745 {{#special:foobar nonexistent}}
12746 !! html
12747 Special:Foobar nonexistent
12748 !! end
12749
12750 !! test
12751 {{#speciale:}} page name, known
12752 !! options
12753 msg
12754 !! wikitext
12755 {{#speciale:Recentchanges}}
12756 !! html
12757 Special:RecentChanges
12758 !! end
12759
12760 !! test
12761 {{#speciale:}} page name with subpage, known
12762 !! options
12763 msg
12764 !! wikitext
12765 {{#speciale:Recentchanges/param}}
12766 !! html
12767 Special:RecentChanges/param
12768 !! end
12769
12770 !! test
12771 {{#speciale:}} page name, unknown
12772 !! options
12773 msg
12774 !! wikitext
12775 {{#speciale:foobar nonexistent}}
12776 !! html
12777 Special:Foobar_nonexistent
12778 !! end
12779
12780 ###
12781 ### Images
12782 ###
12783 ### For Parsoid-specific tests, see
12784 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12785
12786 !! test
12787 Simple image
12788 !! options
12789 parsoid=wt2html,wt2wt,html2html
12790 !! wikitext
12791 [[Image:foobar.jpg]]
12792 !! html/php
12793 <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>
12794 </p>
12795 !! html/parsoid
12796 <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>
12797 !! end
12798
12799 !! test
12800 Simple image (using File: namespace, now canonical)
12801 !! wikitext
12802 [[File:Foobar.jpg]]
12803 !! html/php
12804 <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>
12805 </p>
12806 !! html/parsoid
12807 <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>
12808 !! end
12809
12810 !! test
12811 Right-aligned image
12812 !! wikitext
12813 [[File:Foobar.jpg|right]]
12814 !! html/php
12815 <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>
12816
12817 !! html/parsoid
12818 <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>
12819 !! end
12820
12821 !! test
12822 Image with caption
12823 !! wikitext
12824 [[File:Foobar.jpg|right|Caption text]]
12825 !! html/php
12826 <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>
12827
12828 !! html/parsoid
12829 <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>
12830 !! end
12831
12832 !! test
12833 Image with caption, bug 53312 #1
12834 !! wikitext
12835 [[File:Foobar.jpg|right|Caption page stuff]]
12836 !! html/php
12837 <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>
12838
12839 !! html/parsoid
12840 <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>
12841 !! end
12842
12843 !! test
12844 Image with caption, bug 53312 #2
12845 !! wikitext
12846 [[File:Foobar.jpg|right|Caption page=]]
12847 !! html/php
12848 <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>
12849
12850 !! html/parsoid
12851 <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>
12852 !! end
12853
12854 !! test
12855 Image with caption, bug 53312 #3
12856 !! wikitext
12857 [[File:Foobar.jpg|right|Caption page=stuff]]
12858 !! html/php
12859 <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>
12860
12861 !! html/parsoid
12862 <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>
12863 !! end
12864
12865 !! test
12866 Allow empty links in image captions (Bug 60753)
12867 !! options
12868 thumbsize=220
12869 !! wikitext
12870 [[File:Foobar.jpg|thumb|Caption [[Link1]]
12871 [[]]
12872 [[Link2]]
12873 ]]
12874 !! html/php
12875 <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>
12876
12877 !! html/parsoid
12878 <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>
12879 [[]]
12880 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
12881 </figcaption></figure>
12882 !! end
12883
12884 !! test
12885 Titles in unlinked images (T23454)
12886 !! wikitext
12887 [[File:Foobar.jpg|link=|stuff]]
12888 !! html/php
12889 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
12890 </p>
12891 !! end
12892
12893 !! test
12894 Link with empty target
12895 !! wikitext
12896 [[]]
12897 !! html
12898 <p>[[]]
12899 </p>
12900 !! end
12901
12902 !! test
12903 Image with link trail
12904 !! wikitext
12905 Linktrails should not work for images: [[File:Foobar.jpg]]s
12906 !! html/php
12907 <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
12908 </p>
12909 !! html/parsoid
12910 <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>
12911 !! end
12912
12913 !! test
12914 Image with empty attribute
12915 !! options
12916 parsoid=wt2html,wt2wt,html2html
12917 !! wikitext
12918 [[File:Foobar.jpg|right||Caption text]]
12919 !! html/php
12920 <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>
12921
12922 !! html/parsoid
12923 <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>
12924 !! end
12925
12926 !! test
12927 1. Block image with individual attributes from templates
12928 !! wikitext
12929 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
12930 !! html/php
12931 <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>
12932
12933 !! html/parsoid
12934 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;}]],&amp;quot;dsr&amp;quot;:[24,38,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
12935 !! end
12936
12937 !! test
12938 2. Block Image with individual attributes from templates
12939 !! wikitext
12940 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
12941 !! html/php
12942 <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>
12943
12944 !! html/parsoid
12945 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt3" data-mw='{"attribs":[["thumbnail",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;}]],&amp;quot;dsr&amp;quot;:[18,32,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;thumb&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">thumb&lt;/span>"}],["width",{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;}]],&amp;quot;dsr&amp;quot;:[33,47,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
12946 !! end
12947
12948 !! test
12949 3. Inline image with individual attributes from templates
12950 !! wikitext
12951 [[File:Foobar.jpg|{{echo|50px}}]]
12952 !! html/php
12953 <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>
12954 </p>
12955 !! html/parsoid
12956 <p><span typeof="mw:Image mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"width","ak":"{{echo|50px}}"}]}' data-mw='{"attribs":[["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;}]],&amp;quot;dsr&amp;quot;:[18,31,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;50px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">50px&lt;/span>"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
12957 !! end
12958
12959 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
12960 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
12961 !! test
12962 Image with multiple attributes from the same template
12963 !! wikitext
12964 [[File:Foobar.jpg|{{image_attribs}}]]
12965 !! html/php
12966 <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>
12967
12968 !! html/parsoid
12969 <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>
12970 !! end
12971
12972 !! test
12973 Image with link tails
12974 !! options
12975 thumbsize=220
12976 !! wikitext
12977 123[[File:Foobar.jpg]]456
12978 123[[File:Foobar.jpg|right]]456
12979 123[[File:Foobar.jpg|thumb]]456
12980 !! html/php
12981 <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
12982 </p>
12983 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
12984 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
12985
12986 !! html/php+tidy
12987 <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>
12988 <p>123</p>
12989 <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>
12990 <p>456 123</p>
12991 <div class="thumb tright">
12992 <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>
12993 <div class="thumbcaption">
12994 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
12995 </div>
12996 </div>
12997 </div>
12998 <p>456</p>
12999 !! html/parsoid
13000 <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>
13001 <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>
13002 <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>
13003 !! end
13004
13005 !! test
13006 Image with multiple captions -- only last one is accepted
13007 !! wikitext
13008 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
13009 !! html/php
13010 <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>
13011
13012 !! html/parsoid
13013 <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>
13014 !! end
13015
13016 !! test
13017 Image with multiple widths -- use last
13018 !! wikitext
13019 [[File:Foobar.jpg|200px|300px|caption]]
13020 !! html/php
13021 <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>
13022 </p>
13023 !! html/parsoid
13024 <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>
13025 !! end
13026
13027 !! test
13028 Image with multiple alignments -- use first (bug 48664)
13029 !! options
13030 thumbsize=220
13031 !! wikitext
13032 [[File:Foobar.jpg|thumb|left|right|center|caption]]
13033
13034 [[File:Foobar.jpg|middle|text-top|caption]]
13035 !! html/php
13036 <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>
13037 <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>
13038 </p>
13039 !! html/parsoid
13040 <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>
13041 <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>
13042 !! end
13043
13044 !! test
13045 Image with width attribute at different positions
13046 !! wikitext
13047 [[File:Foobar.jpg|200px|right|Caption]]
13048 [[File:Foobar.jpg|right|200px|Caption]]
13049 [[File:Foobar.jpg|right|Caption|200px]]
13050 !! html/php
13051 <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>
13052 <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>
13053 <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>
13054
13055 !! html/parsoid
13056 <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>
13057 <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>
13058 <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>
13059 !! end
13060
13061 # a sad bit of backward-compatibility
13062 !! test
13063 Image with size specified with pxpx (bug 13500, 51628)
13064 !! options
13065 parsoid=wt2html,wt2wt,html2html
13066 !! wikitext
13067 [[File:Foobar.jpg|20pxpx]]
13068 [[File:Foobar.jpg|200x20pxpx]]
13069 !! html/php
13070 <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>
13071 <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>
13072 </p>
13073 !! html/parsoid
13074 <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>
13075 !! end
13076
13077 !! test
13078 Image with link parameter, wiki target
13079 !! wikitext
13080 [[File:Foobar.jpg|link=Main Page]]
13081 !! html/php
13082 <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>
13083 </p>
13084 !! html/parsoid
13085 <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>
13086 !! end
13087
13088 # parsoid bug 49293 (part 1)
13089 !! test
13090 Image with link parameter, URL target
13091 !! wikitext
13092 [[File:Foobar.jpg|link=http://example.com/]]
13093 !! html/php
13094 <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>
13095 </p>
13096 !! html/parsoid
13097 <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>
13098 !! end
13099
13100 # parsoid bug 49293 (part 2)
13101 !! test
13102 Image with link parameter, protocol-less URL target
13103 !! wikitext
13104 [[File:Foobar.jpg|link=//example.com/]]
13105 !! html/php
13106 <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>
13107 </p>
13108 !! html/parsoid
13109 <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>
13110 !! end
13111
13112 !! test
13113 Escaping non-block captions (T107435)
13114 !! options
13115 parsoid={
13116 "modes": ["wt2wt"],
13117 "changes": [
13118 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13119 ]
13120 }
13121 !! wikitext
13122 [[Image:Foobar.jpg|caption]]
13123 !! wikitext/edited
13124 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13125 !! end
13126
13127 # wgExternalLinkTarget not supported by Parsoid
13128 !! test
13129 Image with link parameter, wgExternalLinkTarget
13130 !! wikitext
13131 [[Image:foobar.jpg|link=http://example.com/]]
13132 !! config
13133 wgExternalLinkTarget='foobar'
13134 !! html/php
13135 <p><a href="http://example.com/" target="foobar" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13136 </p>
13137 !! end
13138
13139 !! test
13140 Image with link parameter, wgNoFollowLinks set to false
13141 !! wikitext
13142 [[Image:foobar.jpg|link=http://example.com/]]
13143 !! config
13144 wgNoFollowLinks=false
13145 !! html
13146 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13147 </p>
13148 !! end
13149
13150 !! test
13151 Image with link parameter, wgNoFollowDomainExceptions
13152 !! wikitext
13153 [[Image:foobar.jpg|link=http://example.com/]]
13154 !! config
13155 wgNoFollowDomainExceptions='example.com'
13156 !! html
13157 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13158 </p>
13159 !! end
13160
13161 # wgExternalLinkTarget not supported by Parsoid
13162 !! test
13163 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13164 !! wikitext
13165 [[Image:foobar.jpg|link=http://example.com/|Title]]
13166 !! config
13167 wgExternalLinkTarget='foobar'
13168 !! html/php
13169 <p><a href="http://example.com/" title="Title" target="foobar" rel="nofollow"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13170 </p>
13171 !! end
13172
13173 !! test
13174 Image with empty link parameter
13175 !! wikitext
13176 [[File:Foobar.jpg|link=]]
13177 !! html/php
13178 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13179 </p>
13180 !! html/parsoid
13181 <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>
13182 !! end
13183
13184 !! test
13185 Image with link parameter (wiki target) and unnamed parameter
13186 !! wikitext
13187 [[File:Foobar.jpg|link=Main_Page|Title]]
13188 !! html/php
13189 <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>
13190 </p>
13191 !! html/parsoid
13192 <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>
13193 !! end
13194
13195 !! test
13196 Image with link parameter (URL target) and unnamed parameter
13197 !! wikitext
13198 [[File:Foobar.jpg|link=http://example.com/|Title]]
13199 !! html/php
13200 <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>
13201 </p>
13202 !! html/parsoid
13203 <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>
13204 !! end
13205
13206 !! test
13207 Thumbnail image with link parameter
13208 !! options
13209 thumbsize=220
13210 parsoid=wt2html,wt2wt,html2html
13211 !! wikitext
13212 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13213 !! html/php
13214 <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>
13215
13216 !! html/parsoid
13217 <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>
13218 !! end
13219
13220 !! test
13221 Manually-specified thumbnail image
13222 !! options
13223 thumbsize=220
13224 !! wikitext
13225 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13226 !! html/php
13227 <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>
13228
13229 !! html/parsoid
13230 <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>
13231 !! end
13232
13233 !! test
13234 Manually-specified thumbnail image with explicit link to wiki page
13235 !! options
13236 thumbsize=220
13237 parsoid=wt2html,wt2wt,html2html
13238 !! wikitext
13239 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13240 !! html/php
13241 <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>
13242
13243 !! html/parsoid
13244 <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>
13245 !! end
13246
13247 !! test
13248 Manually-specified thumbnail image with explicit link to url
13249 !! options
13250 thumbsize=220
13251 parsoid=wt2html,wt2wt,html2html
13252 !! wikitext
13253 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13254 !! html/php
13255 <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>
13256
13257 !! html/parsoid
13258 <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>
13259 !! end
13260
13261 !! test
13262 Manually-specified thumbnail image with explicit no link
13263 !! options
13264 thumbsize=220
13265 parsoid=wt2html,wt2wt,html2html
13266 !! wikitext
13267 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13268 !! html/php
13269 <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>
13270
13271 !! html/parsoid
13272 <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>
13273 !! end
13274
13275 !! test
13276 Manually-specified thumbnail image with explicit link and alt text
13277 !! options
13278 thumbsize=220
13279 parsoid=wt2html,wt2wt,html2html
13280 !! wikitext
13281 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13282 !! html/php
13283 <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>
13284
13285 !! html/parsoid
13286 <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>
13287 !! end
13288
13289 !! test
13290 Image with frame and link
13291 !! options
13292 parsoid=wt2html,wt2wt,html2html
13293 !! wikitext
13294 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13295 !! html/php
13296 <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>
13297
13298 !! html/parsoid
13299 <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>
13300 !! end
13301
13302 !! test
13303 Image with frame and link and explicit alt
13304 !! options
13305 parsoid=wt2html,wt2wt,html2html
13306 !! wikitext
13307 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13308 !! html/php
13309 <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>
13310
13311 !! html/parsoid
13312 <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>
13313 !! end
13314
13315 !! test
13316 Image with wiki markup in implicit alt
13317 !! wikitext
13318 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13319
13320 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13321 !! html/php
13322 <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>
13323 </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>
13324 </p>
13325 !! html/parsoid
13326 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"testing &lt;b data-parsoid=\"{&amp;quot;dsr&amp;quot;:[27,37,3,3]}\">bold&lt;/b> in alt"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"Image:Foobar.jpg"}}'/></a></span></p>
13327 <p><span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img alt="testing bold in alt" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"alt":"testing bold in alt","resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"alt":"alt=testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt","resource":"Image:Foobar.jpg"}}'/></a></span></p>
13328 !! end
13329
13330 !! test
13331 Alt image option should handle most kinds of wikitext without barfing
13332 !! wikitext
13333 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13334 !! html/php
13335 <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>
13336
13337 !! html/parsoid
13338 <figure class="mw-default-size" typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"This is the image caption"},{"ck":"alt","ak":"alt=This is a [[link]] and a {{echo|&#39;&#39;bold template&#39;&#39;}}."}]}' data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["alt",{"html":"alt=This is a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;simple&amp;quot;,&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;./Link&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;link&amp;quot;},&amp;quot;dsr&amp;quot;:[65,73,2,2]}\">link&lt;/a> and a &lt;i about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[80,106,null,null],&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;}]]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;&#39;&#39;bold template&#39;&#39;&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">bold template&lt;/i>."}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img alt="This is a link and a bold template." resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"alt":"This is a link and a bold template.","resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"alt":"alt=This is a [[link]] and a {{echo|&#39;&#39;bold template&#39;&#39;}}.","resource":"Image:Foobar.jpg"}}'/></a><figcaption>This is the image caption</figcaption></figure>
13339 !! end
13340
13341 ###################
13342 # Conflicting image format options.
13343 # First option specified should 'win'.
13344 # All three cases in each test should be identical.
13345
13346 !! test
13347 Image with 'frameless' first.
13348 !! options
13349 parsoid=wt2html,wt2wt,html2html
13350 !! wikitext
13351 [[File:Foobar.jpg|frameless|caption]]
13352
13353 [[File:Foobar.jpg|frameless|frame|caption]]
13354
13355 [[File:Foobar.jpg|frameless|thumb|caption]]
13356 !! html/php
13357 <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>
13358 </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>
13359 </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>
13360 </p>
13361 !! html/parsoid
13362 <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>
13363 <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>
13364 <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>
13365 !! end
13366
13367 !! test
13368 Image with 'frame' first.
13369 !! options
13370 parsoid=wt2html,wt2wt,html2html
13371 !! wikitext
13372 [[File:Foobar.jpg|frame|caption]]
13373 [[File:Foobar.jpg|frame|frameless|caption]]
13374 [[File:Foobar.jpg|frame|thumb|caption]]
13375 !! html/php
13376 <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>
13377 <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>
13378 <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>
13379
13380 !! html/parsoid
13381 <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>
13382 <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>
13383 <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>
13384 !! end
13385
13386 !! test
13387 Image with 'thumb' first.
13388 !! options
13389 parsoid=wt2html,wt2wt,html2html
13390 !! wikitext
13391 [[File:Foobar.jpg|thumb|caption]]
13392 [[File:Foobar.jpg|thumb|frameless|caption]]
13393 [[File:Foobar.jpg|thumb|frame|caption]]
13394 !! html/php
13395 <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>
13396 <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>
13397 <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>
13398
13399 !! html/parsoid
13400 <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>
13401 <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>
13402 <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>
13403 !! end
13404
13405 ###################
13406 # Image sizing.
13407 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13408 # and https://phabricator.wikimedia.org/T64258
13409 # Foobar has actual size of 1941x220
13410 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13411 # a scalable format.
13412 # 2. Framed images always ignore size options; always render at default size.
13413 # 3. "Unspecified format" and border are the only types which can be
13414 # enlarged.
13415
13416 !! test
13417 Image: "unspecified format" and border enlarge
13418 !! options
13419 parsoid=wt2html,wt2wt,html2html
13420 !! wikitext
13421 [[File:Foobar.jpg|2000px]]
13422
13423 [[File:Foobar.jpg|border|2000px]]
13424 !! html/php
13425 <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>
13426 </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>
13427 </p>
13428 !! html/parsoid
13429 <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>
13430 <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>
13431 !! end
13432
13433 !! test
13434 Image: "unspecified format" and border reduce
13435 !! options
13436 parsoid=wt2html,wt2wt,html2html
13437 !! wikitext
13438 [[File:Foobar.jpg|1000px]]
13439
13440 [[File:Foobar.jpg|border|1000px]]
13441 !! html/php
13442 <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>
13443 </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>
13444 </p>
13445 !! html/parsoid
13446 <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>
13447 <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>
13448 !! end
13449
13450 !! test
13451 Image: thumbs reduce
13452 !! options
13453 parsoid=wt2html,wt2wt,html2html
13454 !! wikitext
13455 [[File:Foobar.jpg|thumb|50px]]
13456 !! html/php
13457 <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>
13458
13459 !! html/parsoid
13460 <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>
13461 !! end
13462
13463 !! test
13464 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13465 !! options
13466 parsoid=wt2html,wt2wt,html2html
13467 !! wikitext
13468 [[File:Foobar.jpg|thumb|2000px]]
13469
13470 [[File:Foobar.svg|thumb|2000px]]
13471 !! html/php
13472 <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>
13473 <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>
13474
13475 !! html/parsoid
13476 <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>
13477 <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>
13478 !! end
13479
13480 !! test
13481 Image: frameless can reduce in size
13482 !! options
13483 parsoid=wt2html,wt2wt,html2html
13484 !! wikitext
13485 [[File:Foobar.jpg|frameless|50px]]
13486 !! html/php
13487 <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>
13488 </p>
13489 !! html/parsoid
13490 <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>
13491 !! end
13492
13493 !! test
13494 Image: bitmap frameless can't be enlarged past original size, but vector can
13495 !! options
13496 parsoid=wt2html,wt2wt,html2html
13497 !! wikitext
13498 [[File:Foobar.jpg|frameless|2000px]]
13499
13500 [[File:Foobar.svg|frameless|2000px]]
13501 !! html/php
13502 <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>
13503 </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>
13504 </p>
13505 !! html/parsoid
13506 <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>
13507 <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>
13508 !! end
13509
13510 !! test
13511 Image: framed images are always unscaled.
13512 !! options
13513 parsoid=wt2html,wt2wt,html2html
13514 !! wikitext
13515 [[File:Foobar.jpg|frame]]
13516
13517 [[File:Foobar.jpg|frame|50px]]
13518
13519 [[File:Foobar.jpg|frame|50x50px]]
13520
13521 [[File:Foobar.jpg|frame|2000px]]
13522 !! html/php
13523 <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>
13524 <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>
13525 <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>
13526 <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>
13527
13528 !! html/parsoid
13529 <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>
13530 <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>
13531 <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>
13532 <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>
13533 !! end
13534
13535 ###################
13536
13537 !! test
13538 Link to image page- image page normally doesn't exists, hence edit link
13539 Add test with existing image page
13540 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13541 !! wikitext
13542 [[:Image:test]]
13543 !! html
13544 <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>
13545 </p>
13546 !! end
13547
13548 !! test
13549 bug 18784 Link to non-existent image page with caption should use caption as link text
13550 !! wikitext
13551 [[:Image:test|caption]]
13552 !! html
13553 <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>
13554 </p>
13555 !! end
13556
13557 !! test
13558 Frameless image caption with a free URL
13559 !! wikitext
13560 [[File:Foobar.jpg|http://example.com]]
13561 !! html/php
13562 <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>
13563 </p>
13564 !! html/parsoid
13565 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&lt;a rel=\"mw:ExtLink\" href=\"http://example.com\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;url&amp;quot;,&amp;quot;dsr&amp;quot;:[18,36,0,0]}\">http://example.com&lt;/a>"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13566 !! end
13567
13568 !! test
13569 Thumbnail image caption with a free URL
13570 !! options
13571 thumbsize=220
13572 !! wikitext
13573 [[File:Foobar.jpg|thumb|http://example.com]]
13574 !! html/php
13575 <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>
13576
13577 !! html/parsoid
13578 <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>
13579 !! end
13580
13581 !! test
13582 Thumbnail image caption with a free URL and explicit alt
13583 !! options
13584 thumbsize=220
13585 parsoid=wt2html,wt2wt,html2html
13586 !! wikitext
13587 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13588 !! html/php
13589 <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>
13590
13591 !! html/parsoid
13592 <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>
13593 !! end
13594
13595 !! test
13596 SVG thumbnails with no language set
13597 !! options
13598 !! wikitext
13599 [[File:Foobar.svg|thumb|caption]]
13600 !! html/php
13601 <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>
13602
13603 !! html/parsoid
13604 <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>
13605 !! end
13606
13607 !! test
13608 SVG thumbnails with language de
13609 !! options
13610 parsoid=wt2html,wt2wt,html2html
13611 !! wikitext
13612 [[File:Foobar.svg|thumb|caption|lang=de]]
13613 !! html/php
13614 <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>
13615
13616 !! html/parsoid
13617 <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>
13618 !! end
13619
13620 !! test
13621 SVG thumbnails with invalid language code
13622 !! options
13623 parsoid=wt2html,wt2wt,html2html
13624 !! wikitext
13625 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
13626 !! html/php
13627 <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>
13628
13629 !! html/parsoid
13630 <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>
13631 !! end
13632
13633 !! test
13634 BUG 1887: A ISBN with a thumbnail
13635 !! wikitext
13636 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
13637 !! html/php
13638 <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>
13639
13640 !! html/parsoid
13641 <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>
13642 !! end
13643
13644 !! test
13645 BUG 1887: A RFC with a thumbnail
13646 !! wikitext
13647 [[File:Foobar.jpg|thumb|This is RFC 12354]]
13648 !! html/php
13649 <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>
13650
13651 !! html/parsoid
13652 <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>
13653 !! end
13654
13655 !! test
13656 BUG 1887: A mailto link with a thumbnail
13657 !! wikitext
13658 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
13659 !! html/php
13660 <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>
13661
13662 !! html/parsoid
13663 <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>
13664 !! end
13665
13666 # Pending resolution to bug 368
13667 !! test
13668 BUG 648: Frameless image caption with a link
13669 !! wikitext
13670 [[File:Foobar.jpg|text with a [[link]] in it]]
13671 !! html/php
13672 <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>
13673 </p>
13674 !! html/parsoid
13675 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;simple&amp;quot;,&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;./Link&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;link&amp;quot;},&amp;quot;dsr&amp;quot;:[30,38,2,2]}\">link&lt;/a> in it"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13676 !! end
13677
13678 !! test
13679 BUG 648: Frameless image caption with a link (suffix)
13680 !! wikitext
13681 [[File:Foobar.jpg|text with a [[link]]foo in it]]
13682 !! html/php
13683 <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>
13684 </p>
13685 !! html/parsoid
13686 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;simple&amp;quot;,&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;./Link&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;link&amp;quot;},&amp;quot;dsr&amp;quot;:[30,41,2,5],&amp;quot;tail&amp;quot;:&amp;quot;foo&amp;quot;}\">linkfoo&lt;/a> in it"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13687 !! end
13688
13689 !! test
13690 BUG 648: Frameless image caption with an interwiki link
13691 !! wikitext
13692 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
13693 !! html/php
13694 <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>
13695 </p>
13696 !! html/parsoid
13697 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a &lt;a rel=\"mw:ExtLink\" href=\"http://www.usemod.com/cgi-bin/mb.pl?Link\" title=\"meatball:Link\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;simple&amp;quot;,&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;http://www.usemod.com/cgi-bin/mb.pl?Link&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;MeatBall:Link&amp;quot;},&amp;quot;isIW&amp;quot;:true,&amp;quot;dsr&amp;quot;:[30,47,2,2]}\">MeatBall:Link&lt;/a> in it"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13698 !! end
13699
13700 !! test
13701 BUG 648: Frameless image caption with a piped interwiki link
13702 !! wikitext
13703 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
13704 !! html/php
13705 <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>
13706 </p>
13707 !! html/parsoid
13708 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a &lt;a rel=\"mw:ExtLink\" href=\"http://www.usemod.com/cgi-bin/mb.pl?Link\" title=\"meatball:Link\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;piped&amp;quot;,&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;http://www.usemod.com/cgi-bin/mb.pl?Link&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;MeatBall:Link&amp;quot;},&amp;quot;isIW&amp;quot;:true,&amp;quot;dsr&amp;quot;:[30,52,16,2]}\">link&lt;/a> in it"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13709 !! end
13710
13711 !! test
13712 T107474: Frameless image caption with <nowiki>
13713 !! wikitext
13714 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
13715 !! html/parsoid
13716 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&lt;span typeof=\"mw:Nowiki\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[18,75,8,9]}\">text with a [[MeatBall:Link|link]] in it&lt;/span>"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13717 !! end
13718
13719 !! test
13720 Escape HTML special chars in image alt text
13721 !! wikitext
13722 [[File:Foobar.jpg|& < > "]]
13723 !! html/php
13724 <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>
13725 </p>
13726 !! html/parsoid
13727 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&amp;amp; &amp;lt; &amp;gt; \""}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13728 !! end
13729
13730 !! test
13731 BUG 499: Alt text should have &#1234;, not &amp;1234;
13732 !! wikitext
13733 [[File:Foobar.jpg|&#9792;]]
13734 !! html/php
13735 <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>
13736 </p>
13737 !! html/parsoid
13738 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=\"{&amp;quot;src&amp;quot;:&amp;quot;&amp;amp;#9792;&amp;quot;,&amp;quot;srcContent&amp;quot;:&amp;quot;♀&amp;quot;,&amp;quot;dsr&amp;quot;:[18,25,null,null]}\">♀&lt;/span>"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13739 !! end
13740
13741 !! test
13742 Broken image caption with link
13743 !! options
13744 parsoid=wt2html,wt2wt,html2html
13745 !! wikitext
13746 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
13747 !! html/php
13748 <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.
13749 </p>
13750 !! html/parsoid
13751 <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>
13752 !! end
13753
13754 !! test
13755 Image caption containing another image
13756 !! wikitext
13757 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
13758 !! html/php
13759 <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>
13760
13761 !! html/parsoid
13762 <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>
13763 !! end
13764
13765 !! test
13766 Image: caption containing a newline
13767 !! wikitext
13768 [[File:Foobar.jpg|This
13769 *is some text]]
13770 !! html/php
13771 <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>
13772 </p>
13773 !! html/parsoid
13774 <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>
13775 !!end
13776
13777 !!test
13778 Image: caption containing leading space
13779 (The leading space should not trigger nowiki escaping in wt2wt mode)
13780 !! wikitext
13781 [[File:Foobar.jpg|thumb| bar]]
13782 !! html/php
13783 <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>
13784
13785 !! html/parsoid
13786 <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>
13787 !!end
13788
13789 !! test
13790 Image: caption containing a table
13791 !! options
13792 parsoid=wt2html,wt2wt,html2html
13793 !! wikitext
13794 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
13795 {|
13796 ! Foo !! Bar
13797 |-
13798 | Foo1 || Bar1
13799 |}
13800 and some more text.]]
13801 !! html/php
13802 <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>
13803
13804 !! html/parsoid
13805 <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
13806 <table>
13807 <tbody>
13808 <tr><th>Foo </th><th>Bar</th></tr>
13809 <tr>
13810 <td>Foo1 </td>
13811 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
13812 !! end
13813
13814 !! test
13815 Bug 3090: External links other than http: in image captions
13816 !! wikitext
13817 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
13818 !! html/php
13819 <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>
13820
13821 !! html/parsoid
13822 <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>
13823 !! end
13824
13825 !! test
13826 Custom class
13827 !! options
13828 parsoid=wt2html,wt2wt,html2html
13829 !! wikitext
13830 [[Image:foobar.jpg|a|class=b]]
13831 !! html/php
13832 <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>
13833 </p>
13834 !! html/parsoid
13835 <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>
13836 !! end
13837
13838 !! test
13839 Localized image handling (1).
13840 !! options
13841 parsoid=wt2html,wt2wt,html2html
13842 language=es
13843 !! wikitext
13844 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
13845 !! html/php
13846 <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>
13847
13848 !! html/parsoid
13849 <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>
13850 !! end
13851
13852 !! test
13853 Localized image handling (2).
13854 !! options
13855 thumbsize=220
13856 parsoid=wt2html,wt2wt,html2html
13857 language=es
13858 !! wikitext
13859 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
13860 !! html/php
13861 <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>
13862
13863 !! html/parsoid
13864 <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>
13865 !! end
13866
13867 !! test
13868 Localized image handling (3).
13869 !! options
13870 language=fa
13871 parsoid=html2wt
13872 !! html/parsoid
13873 <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>
13874 !! wikitext
13875 [[File:Foobar.jpg|بندانگشتی]]
13876 !! end
13877
13878 !! test
13879 "border", "frameless" and "class" attributes on an image.
13880 !! options
13881 thumbsize=220
13882 parsoid=wt2html,wt2wt,html2html
13883 !! wikitext
13884 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
13885 !! html/php
13886 <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>
13887 </p>
13888 !! html/parsoid
13889 <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>
13890 !! end
13891
13892 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
13893 !! test
13894 Invalid image attributes (bug 62500)
13895 !! options
13896 thumbsize=220
13897 parsoid=wt2html,wt2wt,html2html
13898 !! wikitext
13899 [[File:Foobar.jpg|thumb|float|left|caption]]
13900
13901 [[File:Foobar.jpg|thumb|righ|caption]]
13902
13903 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
13904 !! html/php
13905 <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>
13906 <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>
13907 <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>
13908
13909 !! html/parsoid
13910 <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>
13911 <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>
13912 <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>
13913 !! end
13914
13915 !! article
13916 File:Barfoo.jpg
13917 !! text
13918 #REDIRECT [[File:Barfoo.jpg]]
13919 !! endarticle
13920
13921 # FIXME: Parsoid should run this test -- but we'd need to teach the
13922 # mockAPI about the redirected Barfoo.jpg image.
13923 !! test
13924 Redirected image
13925 !! wikitext
13926 [[Image:Barfoo.jpg]]
13927 !! html/php
13928 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
13929 </p>
13930 !! end
13931
13932 !! test
13933 Missing image with uploads disabled
13934 !! options
13935 wgEnableUploads=0
13936 !! wikitext
13937 [[File:Foobaz.jpg]]
13938 !! html/php
13939 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
13940 </p>
13941 !! html/parsoid
13942 <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>
13943 !! end
13944
13945 # Parsoid-specific testing for images
13946 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13947 # Currently imperfect due to a flaw in the Parsoid testrunner
13948 # Work in progress
13949 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
13950 # image tests.
13951
13952 !! test
13953 Parsoid-specific image handling - simple image with size and middle alignment
13954 !! wikitext
13955 [[File:Foobar.jpg|middle|50px]]
13956 !! html/parsoid
13957 <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>
13958 !! end
13959
13960 !! test
13961 Parsoid-specific image handling - simple image with size, middle alignment,
13962 non-standard namespace alias
13963 !! options
13964 parsoid=wt2wt,wt2html,html2html
13965 !! wikitext
13966 [[Image:Foobar.jpg|middle|50px]]
13967 !! html/parsoid
13968 <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>
13969 !! end
13970
13971 !! test
13972 Parsoid-specific image handling - simple image with size and middle alignment
13973 (existing content)
13974 !! wikitext
13975 [[File:Foobar.jpg|50px|middle]]
13976 !! html/parsoid
13977 <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>
13978 !! end
13979
13980 !! test
13981 Parsoid-specific image handling - simple image with size and middle alignment
13982 and non-standard namespace name
13983 !! options
13984 parsoid=wt2html,wt2wt,html2html
13985 !! wikitext
13986 [[Image:Foobar.jpg|50px|middle]]
13987 !! html/parsoid
13988 <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>
13989 !! end
13990
13991 !! test
13992 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
13993 !! wikitext
13994 [[File:Foobar.jpg|500x10px|baseline|caption]]
13995 !! html/parsoid
13996 <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>
13997 !! end
13998
13999 !! test
14000 Parsoid-specific image handling - simple image with border and size spec
14001 !! wikitext
14002 [[File:Foobar.jpg|50px|border|caption]]
14003 !! html/parsoid
14004 <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>
14005 !! end
14006
14007 !! test
14008 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14009 !! wikitext
14010 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
14011 !! html/parsoid
14012 <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>
14013 !! end
14014
14015 !! test
14016 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14017 (existing content)
14018 !! wikitext
14019 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
14020 !! html/parsoid
14021 <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>
14022 !! end
14023
14024 !! test
14025 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
14026 !! wikitext
14027 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
14028 !! html/parsoid
14029 <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>
14030 !! end
14031
14032 !! test
14033 Parsoid-specific image handling - thumbnail with specific size, halign,
14034 valign, and caption (existing content)
14035 !! wikitext
14036 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
14037 !! html/parsoid
14038 <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>
14039 !! end
14040
14041 !! test
14042 Parsoid-specific image handling - framed image with specific size and caption
14043 (size is ignored)
14044 !! options
14045 parsoid=wt2html,wt2wt,html2html
14046 !! wikitext
14047 [[File:Foobar.jpg|frame|500x50px|caption]]
14048 !! html/parsoid
14049 <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>
14050 !! end
14051
14052 !! test
14053 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14054 (size is ignored)
14055 !! options
14056 parsoid=wt2html,wt2wt,html2html
14057 !! wikitext
14058 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14059 !! html/parsoid
14060 <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>
14061 !! end
14062
14063 !! test
14064 Parsoid-specific image handling - frameless image with specific size, border, and caption
14065 !! wikitext
14066 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14067 !! html/parsoid
14068 <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>
14069 !! end
14070
14071 !! test
14072 Parsoid-specific image handling - simple image with a formatted caption
14073 !! wikitext
14074 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14075 !! html/parsoid
14076 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&lt;table data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[18,81,7,8]}\">&lt;tbody data-parsoid=\"{&amp;quot;dsr&amp;quot;:[25,73,0,0]}\">&lt;tr data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[25,54,4,5]}\">&lt;td data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[29,39,4,5]}\">a&lt;/td>&lt;td data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[39,49,4,5]}\">b&lt;/td>&lt;/tr>&lt;tr data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[54,73,4,5]}\">&lt;td data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[58,68,4,5]}\">c&lt;/td>&lt;/tr>&lt;/tbody>&lt;/table>"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
14077 !! end
14078
14079 !! test
14080 Parsoid-specific image handling - caption with a template in it
14081 !! wikitext
14082 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14083 !! html/parsoid
14084 <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>
14085 !! end
14086
14087 !! test
14088 Parsoid-specific image handling - caption with unbalanced tags in it
14089 !! options
14090 parsoid=wt2html,wt2wt,html2html
14091 !! wikitext
14092 foo
14093 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14094 bar
14095 !! html/parsoid
14096 <p>foo</p>
14097 <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>
14098 <p>bar</p>
14099 !! end
14100
14101 !! test
14102 Parsoid-specific image handling - empty caption (1)
14103 !! options
14104 parsoid=wt2html,wt2wt
14105 !! wikitext
14106 [[File:Foobar.jpg|thumb|]]
14107 !! html/parsoid
14108 <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>
14109 !! end
14110
14111 # empty captions don't get serialized unless we're in the "round trip" case
14112 !! test
14113 Parsoid-specific image handling - empty caption (2)
14114 !! options
14115 parsoid=html2wt
14116 !! html/parsoid
14117 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14118 <a href="./File:Foobar.jpg">
14119 <img resource="./File:Foobar.jpg"
14120 src="//example.com/images/3/3a/Foobar.jpg"
14121 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14122 height="25" width="220"/>
14123 </a>
14124 <figcaption></figcaption>
14125 </figure>
14126 !! wikitext
14127 [[File:Foobar.jpg|thumb]]
14128 !! end
14129
14130 !! test
14131 Parsoid-specific image handling - whitespace caption
14132 !! wikitext
14133 [[File:Foobar.jpg|thumb| ]]
14134 !! html/parsoid
14135 <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>
14136 !! end
14137
14138 !! test
14139 Parsoid-specific image handling - lang option
14140 !! wikitext
14141 foo
14142 [[File:Foobar.svg|lang=de|caption]]
14143 bar
14144 !! html/parsoid
14145 <p>foo
14146 <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>
14147 bar</p>
14148 !! end
14149
14150 ## Edge case bugs in Parsoid from T93580
14151 !! test
14152 T93580: 1. Templated <ref> inside block images
14153 !! wikitext
14154 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14155
14156 <references />
14157 !! html/parsoid
14158 <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>
14159
14160 <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>
14161 !! end
14162
14163 !! test
14164 T93580: 2. <ref> inside inline images
14165 !! wikitext
14166 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14167
14168 <references />
14169 !! html/parsoid
14170 <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=\"{&amp;quot;dsr&amp;quot;:[64,78,5,6]}\" data-mw=\"{&amp;quot;name&amp;quot;:&amp;quot;ref&amp;quot;,&amp;quot;body&amp;quot;:{&amp;quot;id&amp;quot;:&amp;quot;mw-reference-text-cite_note-1&amp;quot;},&amp;quot;attrs&amp;quot;:{}}\">&lt;a href=\"#cite_note-1\" style=\"counter-reset: mw-Ref 1;\">&lt;span class=\"mw-reflink-text\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=\"{&amp;quot;group&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;content&amp;quot;:&amp;quot;foo&amp;quot;,&amp;quot;hasRefInRef&amp;quot;:false,&amp;quot;dsr&amp;quot;:[64,78,5,6],&amp;quot;tmp&amp;quot;:{}}\" data-mw=\"{}\">"}'><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>
14171
14172 <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>
14173 !! end
14174
14175 !! test
14176 T93580: 3. Templated <ref> inside inline images
14177 !! wikitext
14178 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14179
14180 <references />
14181 !! html/parsoid
14182 <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=\"{&amp;quot;dsr&amp;quot;:[64,96,null,null],&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;}]]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;&lt;ref>{{echo|foo}}&lt;/ref>&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">&lt;a href=\"#cite_note-1\" style=\"counter-reset: mw-Ref 1;\">&lt;span class=\"mw-reflink-text\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Transclusion mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=\"{&amp;quot;group&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;content&amp;quot;:&amp;quot;foo&amp;quot;,&amp;quot;hasRefInRef&amp;quot;:false,&amp;quot;dsr&amp;quot;:[64,96,null,null],&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;}]],&amp;quot;tmp&amp;quot;:{}}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;&lt;ref>{{echo|foo}}&lt;/ref>&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">"}'><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>
14183
14184 <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>
14185 !! end
14186
14187 ###
14188 ### Subpages
14189 ###
14190 !! article
14191 Subpage test/subpage
14192 !! text
14193 foo
14194 !! endarticle
14195
14196 !! test
14197 Subpage link
14198 !! options
14199 subpage title=[[Subpage test]]
14200 !! wikitext
14201 [[/subpage]]
14202 !! html
14203 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14204 </p>
14205 !! end
14206
14207 !! test
14208 Subpage noslash link
14209 !! options
14210 subpage title=[[Subpage test]]
14211 !! wikitext
14212 [[/subpage/]]
14213 !! html
14214 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14215 </p>
14216 !! end
14217
14218 !! article
14219 Subpage test/1/2/subpage
14220 !! text
14221 blah
14222 !! endarticle
14223
14224 !! test
14225 Relative subpage noslash link
14226 !! options
14227 parsoid=wt2wt,wt2html,html2html
14228 subpage title=[[Subpage test/1/2/3/4]]
14229 !! wikitext
14230 [[../../subpage/]]
14231
14232 [[../../subpage]]
14233 !! html/php
14234 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14235 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14236 </p>
14237 !! html/parsoid
14238 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14239 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14240 !! end
14241
14242 !! test
14243 Parsoid: dot-slash prefixed wikilinks
14244 !! wikitext
14245 [[./foo]]
14246
14247 [[././bar]]
14248
14249 [[././baz/]]
14250 !! html/php
14251 <p>[[./foo]]
14252 </p><p>[[././bar]]
14253 </p><p>[[././baz/]]
14254 </p>
14255 !! html/parsoid
14256 <p>[[./foo]]
14257 </p><p>[[././bar]]
14258 </p><p>[[././baz/]]
14259 </p>
14260 !! end
14261
14262 !! test
14263 Render invalid page names as plain text (bug 51090)
14264 !! wikitext
14265 [[./../foo|bar]]
14266 [[foo�|bar]]
14267 [[foo/.|bar]]
14268 [[foo/..|bar]]
14269 [[foo~~~bar]]
14270 [[foo>bar]]
14271 [[foo[bar]]
14272 [[.]]
14273 [[..]]
14274 [[foo././bar]]
14275
14276 [[{{echo|./../foo}}|bar]]
14277 [[{{echo|foo/.}}|bar]]
14278 [[{{echo|foo/..}}|bar]]
14279 [[{{echo|foo~~~~bar}}]]
14280 [[{{echo|foo>bar}}]]
14281 [[{{echo|foo././bar}}]]
14282 [[{{echo|foo{bar}}]]
14283 [[{{echo|foo}bar}}]]
14284 [[{{echo|foo[bar}}]]
14285 [[{{echo|foo]bar}}]]
14286 [[{{echo|foo<bar}}]]
14287 !!html/php
14288 <p>[[./../foo|bar]]
14289 [[foo�|bar]]
14290 [[foo/.|bar]]
14291 [[foo/..|bar]]
14292 [[foo~~~bar]]
14293 [[foo&gt;bar]]
14294 [[foo[bar]]
14295 [[.]]
14296 [[..]]
14297 [[foo././bar]]
14298 </p><p>[[./../foo|bar]]
14299 [[foo/.|bar]]
14300 [[foo/..|bar]]
14301 [[foo~~~~bar]]
14302 [[foo&gt;bar]]
14303 [[foo././bar]]
14304 [[foo{bar]]
14305 [[foo}bar]]
14306 [[foo[bar]]
14307 [[foo]bar]]
14308 [[foo&lt;bar]]
14309 </p>
14310 !!html/parsoid
14311 <p>[[./../foo|bar]]
14312 [[foo�|bar]]
14313 [[foo/.|bar]]
14314 [[foo/..|bar]]
14315 [[foo~~~bar]]
14316 [[foo>bar]]
14317 [[foo[bar]]
14318 [[.]]
14319 [[..]]
14320 [[foo././bar]]</p>
14321
14322 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14323 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14324 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14325 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14326 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14327 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14328 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14329 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14330 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14331 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14332 [[<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>
14333 !!end
14334
14335 !! test
14336 Disabled subpages
14337 !! wikitext
14338 [[/subpage]]
14339 !! html
14340 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14341 </p>
14342 !! end
14343
14344 !! test
14345 BUG 561: {{/Subpage}}
14346 !! options
14347 subpage title=[[Page]]
14348 !! wikitext
14349 {{/Subpage}}
14350 !! html
14351 <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>
14352 </p>
14353 !! end
14354
14355 ###
14356 ### Categories
14357 ###
14358 !! article
14359 Category:MediaWiki User's Guide
14360 !! text
14361 blah
14362 !! endarticle
14363
14364 !! test
14365 Link to category
14366 !! wikitext
14367 [[:Category:MediaWiki User's Guide]]
14368 !! html
14369 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14370 </p>
14371 !! end
14372
14373 !! test
14374 Simple category
14375 !! options
14376 cat
14377 !! wikitext
14378 [[Category:MediaWiki User's Guide]]
14379 !! html
14380 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14381 !! end
14382
14383 !! test
14384 PAGESINCATEGORY invalid title fatal (r33546 fix)
14385 !! wikitext
14386 {{PAGESINCATEGORY:<bogus>}}
14387 !! html
14388 <p>0
14389 </p>
14390 !! end
14391
14392 !! test
14393 Category with different sort key
14394 !! options
14395 cat
14396 !! wikitext
14397 [[Category:MediaWiki User's Guide|Foo]]
14398 !! html
14399 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14400 !! end
14401
14402 !! test
14403 Category with identical sort key
14404 !! options
14405 cat
14406 !! wikitext
14407 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14408 !! html
14409 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14410 !! end
14411
14412 !! test
14413 Category with empty sort key
14414 !! options
14415 cat
14416 pst
14417 !! wikitext
14418 [[Category:MediaWiki User's Guide|]]
14419 !! html/php
14420 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14421 !! end
14422
14423 !! test
14424 Category with empty sort key and parentheses
14425 !! options
14426 cat
14427 pst
14428 !! wikitext
14429 [[Category:Foo (bar)|]]
14430 !! html/php
14431 [[Category:Foo (bar)|Foo]]
14432 !! end
14433
14434 ## We used to, but no longer wt2wt this test since the default serializer
14435 ## will normalize all categories to serialize on their own line.
14436 ## This wikitext usage is going to be fairly uncommon in production and
14437 ## selser will take care of preserving formatting in those scenarios.
14438 !! test
14439 Category with link tail
14440 !! options
14441 cat
14442 pst
14443 parsoid=wt2html
14444 !! wikitext
14445 123[[Category:Foo]]456
14446 !! html/php
14447 123[[Category:Foo]]456
14448 !! html/parsoid
14449 <p>123<link rel="mw:PageProp/Category" href="Category:Foo"/>456</p>
14450 !! end
14451
14452 !! test
14453 Category with template
14454 !! options
14455 cat
14456 pst
14457 !! wikitext
14458 [[Category:{{echo|Foo}}]]
14459 !! html/php
14460 [[Category:{{echo|Foo}}]]
14461 !! end
14462
14463 !! test
14464 Category with template in sort key
14465 !! options
14466 cat
14467 pst
14468 !! wikitext
14469 [[Category:Foo|{{echo|Bar}}]]
14470 !! html/php
14471 [[Category:Foo|{{echo|Bar}}]]
14472 !! end
14473
14474 !! test
14475 Category with template in sort key and title
14476 !! options
14477 cat
14478 pst
14479 !! wikitext
14480 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14481 !! html/php
14482 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14483 !! end
14484
14485 ## We used to, but no longer wt2wt this test since the default serializer
14486 ## will normalize all categories to serialize on their own line.
14487 ## This wikitext usage is going to be fairly uncommon in production and
14488 ## selser will take care of preserving formatting in those scenarios.
14489 !! test
14490 Category / paragraph interactions
14491 !! options
14492 parsoid=wt2html
14493 !! wikitext
14494 Foo [[Category:Baz]] Bar
14495
14496 Foo [[Category:Baz]]
14497 Bar
14498
14499 Foo
14500 [[Category:Baz]]
14501 Bar
14502
14503 Foo
14504 [[Category:Baz]] Bar
14505
14506 Foo
14507 [[Category:Baz]]
14508 [[Category:Baz]]
14509 [[Category:Baz]]
14510 Bar
14511
14512 [[Category:Baz]]
14513 [[Category:Baz]]
14514 [[Category:Baz]]
14515
14516 [[Category:Baz]]
14517 {{echo|[[Category:Baz]]}}
14518 [[Category:Baz]]
14519 !! html/php
14520 <p>Foo Bar
14521 </p><p>Foo
14522 Bar
14523 </p><p>Foo
14524 Bar
14525 </p><p>Foo Bar
14526 </p><p>Foo
14527 Bar
14528 </p>
14529 !! html/parsoid
14530 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14531 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14532 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14533 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14534 <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>
14535 <link rel="mw:PageProp/Category" href="Category:Baz"/>
14536 !! end
14537
14538 ## We used to, but no longer wt2wt this test since the default serializer
14539 ## will normalize all categories to serialize on their own line.
14540 ## This wikitext usage is going to be fairly uncommon in production and
14541 ## selser will take care of preserving formatting in those scenarios.
14542 ##
14543 ## The whitespace on the empty line is part of the test. Please do not delete
14544 !! test
14545 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14546 !! options
14547 parsoid=wt2html
14548 !! wikitext
14549 This
14550
14551 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14552
14553 {{echo|[[Category:Foo]] and so should this!}}
14554 !! html/php
14555 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14556 </p>
14557 !! html/parsoid
14558 <p>This
14559
14560 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14561
14562 <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>
14563 !! end
14564
14565 ## Parsoid will not try to wt2wt this while preserving newlines because
14566 ## it suppresses excess newlines within list items -- and we don't want to
14567 ## introduce a special case just for categories, which is, in reality somewhat
14568 ## odd behavior -- categories are unlikely to be used in list items like this
14569 ## in top-level pages and are only likely to show up in template-generated
14570 ## list items where this RT-ing is a non-issue.
14571 ##
14572 ## The whitespace on the empty line is part of the test. Please do not delete
14573 !! test
14574 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14575 !! options
14576 parsoid=wt2html
14577 !! wikitext
14578 * This
14579
14580 [[Category:Foo]] and this should be part of the same list item
14581 * So should this
14582
14583 {{echo|[[Category:Foo]] and this should be part of the same list item}}
14584 !! html
14585 <ul><li>This and this should be part of the same list item</li>
14586 <li>So should this and this should be part of the same list item</li></ul>
14587 !! html/parsoid
14588 <ul>
14589 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
14590 <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>
14591 </ul>
14592 !! end
14593
14594 ## Newlines and categories that follow the last item of a list
14595 ## are treated differently because this (list followed by categories)
14596 ## is an extremely common pattern on wikis.
14597 !! test
14598 3. Categories and newlines: newline suppression for last list item should RT properly
14599 !! wikitext
14600 * a
14601 * b
14602
14603 [[Category:Foo]]
14604
14605 [[Category:Bar]]
14606 [[Category:Baz]]
14607 !! html/parsoid
14608 <ul><li> a</li>
14609 <li> b</li></ul>
14610
14611 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14612
14613 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14614 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14615 !! end
14616
14617 !! test
14618 4. Categories and newlines: newline suppression for last list item should RT properly
14619 !! wikitext
14620 * a
14621 **** b
14622
14623 [[Category:Foo]]
14624 !! html/parsoid
14625 <ul><li> a
14626 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
14627
14628 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14629 !! end
14630
14631 ## only wt2html for this to make sure the algo only applies to the rightmost path
14632 !! test
14633 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
14634 !! options
14635 parsoid=wt2html
14636 !! wikitext
14637 * a
14638 ** b
14639 [[Category:Foo]]
14640 * c
14641 ** d
14642 [[Category:Foo]]
14643 !! html/parsoid
14644 <ul><li> a
14645 <ul><li> b
14646 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
14647 <li> c
14648 <ul><li> d</li></ul></li></ul>
14649 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14650 !! end
14651
14652 ## We used to, but no longer wt2wt this test since the default serializer
14653 ## will normalize all categories to serialize on their own line.
14654 ## This wikitext usage is going to be fairly uncommon in production and
14655 ## selser will take care of preserving formatting in those scenarios.
14656 !! test
14657 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
14658 !! options
14659 parsoid=wt2html
14660 !! wikitext
14661 * a [[Category:Foo]]
14662 !! html/parsoid
14663 <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>
14664 !! end
14665
14666 # This test also demonstrates because of newline+category tunneling
14667 # through the list hander, template wrapping doesn't expand to the
14668 # containing list when the list item swallows the category.
14669 !! test
14670 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
14671 !! wikitext
14672 * {{echo|a
14673 [[Category:Foo]]}}
14674 !! html/parsoid
14675 <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
14676 </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>
14677 !! end
14678
14679 !! test
14680 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
14681 !! wikitext
14682 * a
14683
14684 {{echo|[[Category:Foo]]
14685 [[Category:Bar]]}}
14686 [[Category:Baz]]
14687 !! html/parsoid
14688 <ul><li> a</li></ul>
14689
14690 <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">
14691 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14692 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14693 !! end
14694
14695 !! test
14696 Parsoid: Serialize link to category page with colon escape
14697 !! options
14698 parsoid
14699 !! wikitext
14700
14701 [[:Category:Foo]]
14702 [[:Category:Foo|Bar]]
14703 !! html
14704 <p>
14705 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
14706 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
14707 </p>
14708 !! end
14709
14710 # We used to, but no longer wt2wt this test since the default serializer
14711 # will normalize all categories to serialize on their own line.
14712 # This wikitext usage is going to be fairly uncommon in production and
14713 # selser will take care of preventing whitespace insertion if this
14714 # occurs in an article.
14715 #
14716 # html2html disabled for the same reason (whitespace insertion between
14717 # x and y).
14718 #
14719 # html2wt disabled because it localizes the "Category" namespace.
14720 !! test
14721 Link prefix/suffixes aren't applied to category links
14722 !! options
14723 parsoid=wt2html
14724 language=is
14725 !! wikitext
14726 x[[Category:Foo]]y
14727 !! html/php
14728 <p>xy
14729 </p>
14730 !! html/parsoid
14731 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
14732 !! end
14733
14734 !! test
14735 Parsoid: Serialize link to file page with colon escape
14736 !! options
14737 parsoid
14738 !! wikitext
14739
14740 [[:File:Foo.png]]
14741 [[:File:Foo.png|Bar]]
14742 !! html
14743 <p>
14744 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
14745 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
14746 </p>
14747 !! end
14748
14749 !! test
14750 Parsoid: Serialize a genuine category link without colon escape
14751 !! options
14752 parsoid
14753 !! wikitext
14754 [[Category:Foo]]
14755 [[Category:Foo|Bar]]
14756 !! html
14757 <link rel="mw:PageProp/Category" href="./Category:Foo">
14758 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
14759 !! end
14760
14761 !! test
14762 Normalize hrefs properly before testing for invalid link targets (bug 70894)
14763 !! options
14764 parsoid=html2wt
14765 !! html/parsoid
14766 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
14767 !! wikitext
14768 [[Category:Toxine bactérienne]]
14769 !! end
14770
14771 !! test
14772 Parsoid: Defaultsort
14773 !! wikitext
14774 {{DEFAULTSORT:Foo}}
14775 !! html/parsoid
14776 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
14777 !! end
14778
14779 !! test
14780 Parsoid: Defaultsort (template-generated)
14781 !! wikitext
14782 {{{{echo|DEFAULTSORT}}:Foo}}
14783 !! html/parsoid
14784 <meta property="mw:PageProp/categorydefaultsort" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[0,28,null,null],"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DEFAULTSORT}}:Foo"},"params":{},"i":0}}]}'/>
14785 !! end
14786
14787 ###
14788 ### Inter-language links
14789 ###
14790 !! test
14791 Interlanguage links
14792 !! options
14793 ill
14794 !! wikitext
14795 [[es:Alimento]]
14796 [[fr:Nourriture]]
14797 [[zh:食品]]
14798 !! html/php
14799 es:Alimento fr:Nourriture zh:食品
14800 !! html/parsoid
14801 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
14802 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
14803 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
14804 !! end
14805
14806 !! test
14807 Duplicate interlanguage links (bug 24502)
14808 !! options
14809 ill
14810 !! wikitext
14811 [[es:1]]
14812 [[es:2]]
14813 [[fr:1]]
14814 [[fr:2]]
14815 !! html/php
14816 es:1 fr:1
14817 !! html/parsoid
14818 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
14819 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
14820 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
14821 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
14822 !! end
14823
14824 ###
14825 ### Sections
14826 ###
14827 !! test
14828 Basic section headings
14829 !! wikitext
14830 == Headline 1 ==
14831 Some text
14832
14833 ==Headline 2==
14834 More
14835 ===Smaller headline===
14836 Blah blah
14837 !! html
14838 <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>
14839 <p>Some text
14840 </p>
14841 <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>
14842 <p>More
14843 </p>
14844 <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>
14845 <p>Blah blah
14846 </p>
14847 !! end
14848
14849 !! test
14850 Section headings with TOC
14851 !! wikitext
14852 == Headline 1 ==
14853 === Subheadline 1 ===
14854 ===== Skipping a level =====
14855 ====== Skipping a level ======
14856
14857 == Headline 2 ==
14858 Some text
14859 ===Another headline===
14860 !! html
14861 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14862 <ul>
14863 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
14864 <ul>
14865 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
14866 <ul>
14867 <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>
14868 <ul>
14869 <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>
14870 </ul>
14871 </li>
14872 </ul>
14873 </li>
14874 </ul>
14875 </li>
14876 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
14877 <ul>
14878 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
14879 </ul>
14880 </li>
14881 </ul>
14882 </div>
14883
14884 <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>
14885 <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>
14886 <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>
14887 <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>
14888 <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>
14889 <p>Some text
14890 </p>
14891 <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>
14892
14893 !! end
14894
14895 !! test
14896 TOC anchors don't collide
14897 !! wikitext
14898 __FORCETOC__
14899 == Headline 2 ==
14900 == Headline ==
14901 == Headline 2 ==
14902 == Headline ==
14903 !! html/php
14904 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14905 <ul>
14906 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
14907 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
14908 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
14909 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
14910 </ul>
14911 </div>
14912
14913 <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>
14914 <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>
14915 <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>
14916 <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>
14917
14918 !! end
14919
14920 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
14921 !! test
14922 Handling of sections up to level 6 and beyond
14923 !! wikitext
14924 = Level 1 Heading=
14925 == Level 2 Heading==
14926 === Level 3 Heading===
14927 ==== Level 4 Heading====
14928 ===== Level 5 Heading=====
14929 ====== Level 6 Heading======
14930 ======= Level 7 Heading=======
14931 ======== Level 8 Heading========
14932 ========= Level 9 Heading=========
14933 ========== Level 10 Heading==========
14934 !! html
14935 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14936 <ul>
14937 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
14938 <ul>
14939 <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>
14940 <ul>
14941 <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>
14942 <ul>
14943 <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>
14944 <ul>
14945 <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>
14946 <ul>
14947 <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>
14948 <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>
14949 <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>
14950 <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>
14951 <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>
14952 </ul>
14953 </li>
14954 </ul>
14955 </li>
14956 </ul>
14957 </li>
14958 </ul>
14959 </li>
14960 </ul>
14961 </li>
14962 </ul>
14963 </div>
14964
14965 <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>
14966 <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>
14967 <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>
14968 <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>
14969 <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>
14970 <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>
14971 <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>
14972 <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>
14973 <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>
14974 <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>
14975
14976 !! end
14977
14978 !! test
14979 TOC regression (T11764)
14980 !! wikitext
14981 == title 1 ==
14982 === title 1.1 ===
14983 ==== title 1.1.1 ====
14984 === title 1.2 ===
14985 == title 2 ==
14986 === title 2.1 ===
14987 !! html
14988 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14989 <ul>
14990 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14991 <ul>
14992 <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>
14993 <ul>
14994 <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>
14995 </ul>
14996 </li>
14997 <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>
14998 </ul>
14999 </li>
15000 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15001 <ul>
15002 <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>
15003 </ul>
15004 </li>
15005 </ul>
15006 </div>
15007
15008 <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>
15009 <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>
15010 <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>
15011 <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>
15012 <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>
15013 <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>
15014
15015 !! end
15016
15017 !! test
15018 TOC for heading containing <span id="..."></span> (T96153)
15019 !! wikitext
15020 __FORCETOC__
15021 ==<span id="old-anchor"></span>New title==
15022 !! html/php
15023 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15024 <ul>
15025 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
15026 </ul>
15027 </div>
15028
15029 <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>
15030
15031 !! end
15032
15033 !! test
15034 TOC with wgMaxTocLevel=3 (bug 6204)
15035 !! options
15036 wgMaxTocLevel=3
15037 !! wikitext
15038 == title 1 ==
15039 === title 1.1 ===
15040 ==== title 1.1.1 ====
15041 === title 1.2 ===
15042 == title 2 ==
15043 === title 2.1 ===
15044 !! html
15045 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15046 <ul>
15047 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15048 <ul>
15049 <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>
15050 <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>
15051 </ul>
15052 </li>
15053 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15054 <ul>
15055 <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>
15056 </ul>
15057 </li>
15058 </ul>
15059 </div>
15060
15061 <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>
15062 <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>
15063 <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>
15064 <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>
15065 <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>
15066 <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>
15067
15068 !! end
15069
15070 !! test
15071 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
15072 !! options
15073 wgMaxTocLevel=3
15074 !! wikitext
15075 ==Section 1==
15076 ===Section 1.1===
15077 ====Section 1.1.1====
15078 ====Section 1.1.1.1====
15079 ==Section 2==
15080 !! html
15081 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15082 <ul>
15083 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15084 <ul>
15085 <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>
15086 </ul>
15087 </li>
15088 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15089 </ul>
15090 </div>
15091
15092 <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>
15093 <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>
15094 <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>
15095 <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>
15096 <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>
15097
15098 !! end
15099
15100
15101 !! test
15102 Resolving duplicate section names
15103 !! wikitext
15104 == Foo bar ==
15105 == Foo bar ==
15106 !! html
15107 <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>
15108 <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>
15109
15110 !! end
15111
15112 !! test
15113 Resolving duplicate section names with differing case (bug 10721)
15114 !! wikitext
15115 == Foo bar ==
15116 == Foo Bar ==
15117 !! html
15118 <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>
15119 <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>
15120
15121 !! end
15122
15123 !! article
15124 Template:sections
15125 !! text
15126 ===Section 1===
15127 ==Section 2==
15128 !! endarticle
15129
15130 !! test
15131 Template with sections, __NOTOC__
15132 !! wikitext
15133 __NOTOC__
15134 ==Section 0==
15135 {{sections}}
15136 ==Section 4==
15137 !! html
15138 <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>
15139 <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>
15140 <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>
15141 <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>
15142
15143 !! end
15144
15145 !! test
15146 __NOEDITSECTION__ keyword
15147 !! wikitext
15148 __NOEDITSECTION__
15149 ==Section 1==
15150 ==Section 2==
15151 !! html
15152 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15153 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15154
15155 !! end
15156
15157 !! test
15158 Link inside a section heading
15159 !! wikitext
15160 ==Section with a [[Main Page|link]] in it==
15161 !! html
15162 <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>
15163
15164 !! end
15165
15166 !! test
15167 TOC regression (T14077)
15168 !! wikitext
15169 __TOC__
15170 == title 1 ==
15171 === title 1.1 ===
15172 == title 2 ==
15173 !! html
15174 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15175 <ul>
15176 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15177 <ul>
15178 <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>
15179 </ul>
15180 </li>
15181 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15182 </ul>
15183 </div>
15184
15185 <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>
15186 <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>
15187 <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>
15188
15189 !! end
15190
15191 !! test
15192 BUG 1219 URL next to image (good)
15193 !! wikitext
15194 http://example.com [[File:Foobar.jpg]]
15195 !! html/php
15196 <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>
15197 </p>
15198 !! html/parsoid
15199 <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>
15200 !!end
15201
15202 !! test
15203 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
15204 !! wikitext
15205 ===
15206 The line above must have a trailing space!
15207 === <!--
15208 --> <!-- -->
15209 But just in case it doesn't...
15210 !! html
15211 <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>
15212 <p>The line above must have a trailing space!
15213 </p>
15214 <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>
15215 <p>But just in case it doesn't...
15216 </p>
15217 !! end
15218
15219 !! test
15220 Header with special characters (bug 25462)
15221 !! wikitext
15222 The tooltips shall not show entities to the user (ie. be double escaped)
15223
15224 == text > text ==
15225 section 1
15226
15227 == text < text ==
15228 section 2
15229
15230 == text & text ==
15231 section 3
15232
15233 == text ' text ==
15234 section 4
15235
15236 == text " text ==
15237 section 5
15238 !! html
15239 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15240 </p>
15241 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15242 <ul>
15243 <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>
15244 <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>
15245 <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>
15246 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15247 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15248 </ul>
15249 </div>
15250
15251 <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>
15252 <p>section 1
15253 </p>
15254 <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>
15255 <p>section 2
15256 </p>
15257 <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>
15258 <p>section 3
15259 </p>
15260 <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>
15261 <p>section 4
15262 </p>
15263 <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>
15264 <p>section 5
15265 </p>
15266 !! end
15267
15268 !! test
15269 Header with space, plus and underscore as entity
15270 !! wikitext
15271 Id should not contain + for spaces
15272
15273 == Space between Text ==
15274 section 1
15275
15276 == Space-Entity&#32;between&#32;Text ==
15277 section 2
15278
15279 == Plus+between+Text ==
15280 section 3
15281
15282 == Plus-Entity&#43;between&#43;Text ==
15283 section 4
15284
15285 == Underscore_between_Text ==
15286 section 5
15287
15288 == Underscore-Entity&#95;between&#95;Text ==
15289 section 6
15290
15291 [[#Space between Text]]
15292 [[#Space-Entity&#32;between&#32;Text]]
15293 [[#Plus+between+Text]]
15294 [[#Plus-Entity&#43;between&#43;Text]]
15295 [[#Underscore_between_Text]]
15296 [[#Underscore-Entity&#95;between&#95;Text]]
15297 !! html
15298 <p>Id should not contain + for spaces
15299 </p>
15300 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15301 <ul>
15302 <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>
15303 <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>
15304 <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>
15305 <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>
15306 <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>
15307 <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>
15308 </ul>
15309 </div>
15310
15311 <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>
15312 <p>section 1
15313 </p>
15314 <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>
15315 <p>section 2
15316 </p>
15317 <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>
15318 <p>section 3
15319 </p>
15320 <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>
15321 <p>section 4
15322 </p>
15323 <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>
15324 <p>section 5
15325 </p>
15326 <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>
15327 <p>section 6
15328 </p><p><a href="#Space_between_Text">#Space between Text</a>
15329 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15330 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15331 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15332 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15333 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15334 </p>
15335 !! end
15336
15337 !! test
15338 Headers with excess '=' characters
15339 (Are similar tests necessary beyond the 1st level?)
15340 !! wikitext
15341 =foo==
15342 ==foo=
15343 =''italic'' heading==
15344 ==''italic'' heading=
15345 !! html
15346 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15347 <ul>
15348 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15349 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15350 <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>
15351 <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>
15352 </ul>
15353 </div>
15354
15355 <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>
15356 <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>
15357 <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>
15358 <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>
15359
15360 !! end
15361
15362 !! test
15363 HTML headers vs TOC (bug 23393)
15364 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15365 !! wikitext
15366 <h1>Header 1</h1>
15367 == Header 1.1 ==
15368 == Header 1.2 ==
15369
15370 <h1>Header 2
15371 </h1>
15372 == Header 2.1 ==
15373 == Header 2.2 ==
15374 __NOEDITSECTION__
15375 !! html
15376 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15377 <ul>
15378 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15379 <ul>
15380 <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>
15381 <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>
15382 </ul>
15383 </li>
15384 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15385 <ul>
15386 <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>
15387 <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>
15388 </ul>
15389 </li>
15390 </ul>
15391 </div>
15392
15393 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15394 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15395 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15396 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15397 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15398 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15399
15400 !! end
15401
15402 !! test
15403 Single-line or multiline-comments can follow headings
15404 !! options
15405 parsoid=wt2html,wt2wt
15406 !! wikitext
15407 ==foo==<!---->
15408 ==bar==<!--c1-->
15409 ==baz==<!--
15410 c2
15411 c3-->
15412 !! html
15413 <h2><span class="mw-headline" id="foo">foo</span></h2>
15414 <h2><span class="mw-headline" id="bar">bar</span></h2>
15415 <h2><span class="mw-headline" id="baz">baz</span></h2>
15416
15417 !! end
15418
15419 !! test
15420 BUG 1219 URL next to image (broken)
15421 !! wikitext
15422 http://example.com[[File:Foobar.jpg]]
15423 !! html/php
15424 <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>
15425 </p>
15426 !! html/parsoid
15427 <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>
15428 !!end
15429
15430 !! test
15431 Bug 1186 news: in the middle of text
15432 !! wikitext
15433 http://en.wikinews.org/wiki/Wikinews:Workplace
15434 !! html
15435 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15436 </p>
15437 !!end
15438
15439
15440 !! test
15441 Namespaced link must have a title
15442 !! wikitext
15443 [[Project:]]
15444 !! html
15445 <p>[[Project:]]
15446 </p>
15447 !!end
15448
15449 !! test
15450 Namespaced link must have a title (bad fragment version)
15451 !! wikitext
15452 [[Project:#fragment]]
15453 !! html
15454 <p>[[Project:#fragment]]
15455 </p>
15456 !!end
15457
15458
15459 ###
15460 ### HTML tags and HTML attributes
15461 ###
15462
15463 !! test
15464 div with no attributes
15465 !! wikitext
15466 <div>HTML rocks</div>
15467 !! html
15468 <div>HTML rocks</div>
15469
15470 !! end
15471
15472 !! test
15473 div with double-quoted attribute
15474 !! wikitext
15475 <div id="rock">HTML rocks</div>
15476 !! html
15477 <div id="rock">HTML rocks</div>
15478
15479 !! end
15480
15481 !! test
15482 div with single-quoted attribute
15483 !! wikitext
15484 <div id='rock'>HTML rocks</div>
15485 !! html
15486 <div id="rock">HTML rocks</div>
15487
15488 !! end
15489
15490 !! test
15491 div with unquoted attribute
15492 !! wikitext
15493 <div id=rock>HTML rocks</div>
15494 !! html
15495 <div id="rock">HTML rocks</div>
15496
15497 !! end
15498
15499 !! test
15500 div with illegal double attributes
15501 !! wikitext
15502 <div id="a" id="b">HTML rocks</div>
15503 !! html
15504 <div id="b">HTML rocks</div>
15505
15506 !!end
15507
15508 !! test
15509 div with empty attribute value, space before equals
15510 !! options
15511 parsoid=wt2html,html2html
15512 !! wikitext
15513 <div class =>HTML rocks</div>
15514 !! html/php
15515 <div class="">HTML rocks</div>
15516
15517 !! html/parsoid
15518 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15519 !! end
15520
15521 !! test
15522 div with multiple empty attribute values
15523 !! options
15524 parsoid=wt2html,html2html
15525 !! wikitext
15526 <div id= title=>HTML rocks</div>
15527 !! html/php
15528 <div id="title.3D">HTML rocks</div>
15529
15530 !! html/parsoid
15531 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15532 !! end
15533
15534 !! test
15535 table with multiple empty attribute values
15536 !! options
15537 parsoid=wt2html,html2html
15538 !! wikitext
15539 {| title= id=
15540 | hi
15541 |}
15542 !! html/php
15543 <table title="id=">
15544 <tr>
15545 <td> hi
15546 </td></tr></table>
15547
15548 !! html/parsoid
15549 <table title="id=">
15550 <tbody><tr><td> hi</td></tr>
15551 </tbody></table>
15552 !! end
15553
15554 !! test
15555 div with braces in attribute value
15556 !! wikitext
15557 <div title="{}">Foo</div>
15558 !! html/php
15559 <div title="&#123;}">Foo</div>
15560
15561 !! html/parsoid
15562 <div title="{}">Foo</div>
15563 !! end
15564
15565 !! test
15566 div with empty attribute value, no space before equals
15567 !! options
15568 parsoid=wt2html,html2html
15569 !! wikitext
15570 <div class=>HTML rocks</div>
15571 !! html/php
15572 <div class="">HTML rocks</div>
15573
15574 !! html/parsoid
15575 <div class="">HTML rocks</div>
15576 !! end
15577
15578 !! test
15579 HTML multiple attributes correction
15580 !! wikitext
15581 <p class="error" class="awesome">Awesome!</p>
15582 !! html
15583 <p class="awesome">Awesome!</p>
15584
15585 !!end
15586
15587 !! test
15588 Table multiple attributes correction
15589 !! wikitext
15590 {|
15591 !+ class="error" class="awesome"| status
15592 |}
15593 !! html
15594 <table>
15595 <tr>
15596 <th class="awesome"> status
15597 </th></tr></table>
15598
15599 !!end
15600
15601 !! test
15602 DIV IN UPPERCASE
15603 !! wikitext
15604 <DIV ID="x">HTML ROCKS</DIV>
15605 !! html
15606 <div id="x">HTML ROCKS</div>
15607
15608 !!end
15609
15610 !! test
15611 Non-ASCII pseudo-tags are rendered as text
15612 !! wikitext
15613 <khyô>
15614 !! html
15615 <p>&lt;khyô&gt;
15616 </p>
15617 !! end
15618
15619 !! test
15620 Pseudo-tag with URL 'name' renders as url link
15621 !! wikitext
15622 <http://example.com/>
15623 !! html
15624 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
15625 </p>
15626 !! end
15627
15628 !! test
15629 text with amp in the middle of nowhere
15630 !! wikitext
15631 Remember AT&T?
15632 !! html
15633 <p>Remember AT&amp;T?
15634 </p>
15635 !! end
15636
15637 !! test
15638 text with character entity: eacute
15639 !! wikitext
15640 I always thought &eacute; was a cute letter.
15641 !! html
15642 <p>I always thought &#233; was a cute letter.
15643 </p>
15644 !! html+tidy
15645 <p>I always thought é was a cute letter.</p>
15646 !! end
15647
15648 !! test
15649 text with entity-escaped character entity-like string: eacute
15650 !! wikitext
15651 I always thought &amp;eacute; was a cute letter.
15652 !! html
15653 <p>I always thought &amp;eacute; was a cute letter.
15654 </p>
15655 !! end
15656
15657 !! test
15658 text with undefined character entity: xacute
15659 !! wikitext
15660 I always thought &xacute; was a cute letter.
15661 !! html
15662 <p>I always thought &amp;xacute; was a cute letter.
15663 </p>
15664 !! end
15665
15666 !! test
15667 HTML5 tags
15668 !! wikitext
15669 <data value="5">five</data>
15670 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15671 <mark>This highlighted text</mark>
15672 !! html
15673 <p><data value="5">five</data>
15674 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15675 <mark>This highlighted text</mark>
15676 </p>
15677 !! end
15678
15679 !! test
15680 HTML tag with leading space is parsed as text
15681 !! wikitext
15682 < div>foo< /div>
15683 !! html
15684 <p>&lt; div&gt;foo&lt; /div&gt;
15685 </p>
15686 !! end
15687
15688 ###
15689 ### Nesting tests (see bug 41545, 50604, 51081)
15690 ###
15691
15692 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
15693 # Note that html2wt is considerably more difficult if we use <b> in
15694 # the test case, instead of <big>
15695 !! test
15696 Ensure that HTML adoption agency algorithm is properly implemented.
15697 !! wikitext
15698 <big>X<big>Y</big>Z</big>
15699 !! html
15700 <p><big>X<big>Y</big>Z</big>
15701 </p>
15702 !! end
15703
15704 # This was bug 41545 in the PHP parser.
15705 # Note that tidy doesn't handle this correctly.
15706 !! test
15707 Nesting of <kbd>
15708 !! wikitext
15709 <kbd>X<kbd>Y</kbd>Z</kbd>
15710 !! html
15711 <p><kbd>X<kbd>Y</kbd>Z</kbd>
15712 </p>
15713 !! end
15714
15715 # The following cases were bug 51081 in the PHP parser.
15716 # Note that there are some other nestable tags (b, i, etc) which are
15717 # not covered; see bug 51081 for discussion.
15718
15719 # Note that tidy doesn't handle this correctly.
15720 !! test
15721 Nesting of <em>
15722 !! wikitext
15723 <em>X<em>Y</em>Z</em>
15724 !! html
15725 <p><em>X<em>Y</em>Z</em>
15726 </p>
15727 !! end
15728
15729 # Note that tidy doesn't handle this correctly.
15730 !! test
15731 Nesting of <strong>
15732 !! wikitext
15733 <strong>X<strong>Y</strong>Z</strong>
15734 !! html
15735 <p><strong>X<strong>Y</strong>Z</strong>
15736 </p>
15737 !! end
15738
15739 !! test
15740 Nesting of <q>
15741 !! wikitext
15742 <q>X<q>Y</q>Z</q>
15743 !! html+tidy
15744 <p><q>X<q>Y</q>Z</q></p>
15745 !! end
15746
15747 # Note that tidy doesn't handle this correctly.
15748 !! test
15749 Nesting of <ruby>
15750 !! wikitext
15751 <ruby>X<ruby>Y</ruby>Z</ruby>
15752 !! html
15753 <p><ruby>X<ruby>Y</ruby>Z</ruby>
15754 </p>
15755 !! end
15756
15757 # Note that tidy doesn't handle this correctly.
15758 !! test
15759 Nesting of <bdo>
15760 !! wikitext
15761 <bdo>X<bdo>Y</bdo>Z</bdo>
15762 !! html
15763 <p><bdo>X<bdo>Y</bdo>Z</bdo>
15764 </p>
15765 !! end
15766
15767
15768 ###
15769 ### Media links
15770 ###
15771
15772 !! test
15773 Media link
15774 !! wikitext
15775 [[Media:Foobar.jpg]]
15776 !! html
15777 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
15778 </p>
15779 !! end
15780
15781 !! test
15782 Media link with text
15783 !! wikitext
15784 [[Media:Foobar.jpg|A neat file to look at]]
15785 !! html
15786 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
15787 </p>
15788 !! end
15789
15790 # FIXME: this is still bad HTML tag nesting
15791 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
15792 !! test
15793 Media link with nasty text
15794 !! wikitext
15795 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
15796 !! html
15797 <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>
15798
15799 !! html+tidy
15800 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
15801 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
15802 !! end
15803
15804 !! test
15805 Media link to nonexistent file (bug 1702)
15806 !! wikitext
15807 [[Media:No such.jpg]]
15808 !! html
15809 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
15810 </p>
15811 !! end
15812
15813 !! test
15814 Image link to nonexistent file (bug 1850 - good)
15815 !! wikitext
15816 [[File:No_such.jpg]]
15817 !! html/php
15818 <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>
15819 </p>
15820 !! html/parsoid
15821 <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>
15822 !! end
15823
15824 !! test
15825 :Image link to nonexistent file (bug 1850 - bad)
15826 !! wikitext
15827 [[:Image:No such.jpg]]
15828 !! html/php
15829 <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>
15830 </p>
15831 !! html/parsoid
15832 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
15833 !! end
15834
15835
15836
15837 !! test
15838 Character reference normalization in link text (bug 1938)
15839 !! wikitext
15840 [[Main Page|this&that]]
15841 !! html
15842 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
15843 </p>
15844 !!end
15845
15846 !! article
15847 אַ
15848 !! text
15849 Test for unicode normalization
15850
15851 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
15852 !! endarticle
15853
15854 !! test
15855 (bug 19451) Links should refer to the normalized form.
15856 !! wikitext
15857 [[&#xFB2E;]]
15858 [[&#x5d0;&#x5b7;]]
15859 [[&#x5d0;ַ]]
15860 [[א&#x5b7;]]
15861 [[אַ]]
15862 !! html
15863 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
15864 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
15865 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
15866 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
15867 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
15868 </p>
15869 !! end
15870
15871 !! test
15872 Empty attribute crash test (bug 2067)
15873 !! wikitext
15874 <font color="">foo</font>
15875 !! html
15876 <p><font color="">foo</font>
15877 </p>
15878 !! end
15879
15880 !! test
15881 Empty attribute crash test single-quotes (bug 2067)
15882 !! wikitext
15883 <font color=''>foo</font>
15884 !! html
15885 <p><font color="">foo</font>
15886 </p>
15887 !! end
15888
15889 !! test
15890 Attribute test: equals, then nothing
15891 !! options
15892 parsoid=wt2html,html2html
15893 !! wikitext
15894 <font color=>foo</font>
15895 !! html/php
15896 <p><font color="">foo</font>
15897 </p>
15898 !! html/parsoid
15899 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
15900 !! end
15901
15902 !! test
15903 Attribute test: unquoted value
15904 !! options
15905 parsoid=wt2html,html2html
15906 !! wikitext
15907 <font color=x>foo</font>
15908 !! html/php
15909 <p><font color="x">foo</font>
15910 </p>
15911 !! html/parsoid
15912 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
15913 !! end
15914
15915 !! test
15916 Attribute test: unquoted but illegal value (hash)
15917 !! wikitext
15918 <font color=#x>foo</font>
15919 !! html
15920 <p><font color="#x">foo</font>
15921 </p>
15922 !! end
15923
15924 # Parsoid does not serialize to empty attribute syntax,
15925 # so wt2wt and html2wt cases are skipped
15926 !! test
15927 Attribute test: no value (T54330)
15928 !! options
15929 parsoid=wt2html,html2html
15930 !! wikitext
15931 <font color>foo</font>
15932 !! html/php
15933 <p><font color="">foo</font>
15934 </p>
15935 !! html/parsoid
15936 <p><font color="">foo</font></p>
15937 !! end
15938
15939 !! test
15940 Bug 2095: link with three closing brackets
15941 !! wikitext
15942 [[Main Page]]]
15943 !! html/php
15944 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
15945 </p>
15946 !! html/parsoid
15947 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
15948 !! end
15949
15950 !! test
15951 Bug 2095: link with pipe and three closing brackets
15952 !! wikitext
15953 [[Main Page|link]]]
15954 !! html/php
15955 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
15956 </p>
15957 !! html/parsoid
15958 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
15959 !! end
15960
15961 !! test
15962 Bug 2095: link with pipe and three closing brackets, version 2
15963 !! wikitext
15964 [[Main Page|[http://example.com/]]]
15965 !! html/php
15966 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
15967 </p>
15968 !! html/parsoid
15969 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
15970 !! end
15971
15972
15973 ###
15974 ### Safety
15975 ###
15976
15977 !! article
15978 Template:Dangerous attribute
15979 !! text
15980 " onmouseover="alert(document.cookie)
15981 !! endarticle
15982
15983 !! article
15984 Template:Dangerous style attribute
15985 !! text
15986 border-size: expression(alert(document.cookie))
15987 !! endarticle
15988
15989 !! article
15990 Template:Div style
15991 !! text
15992 <div style="float: right; {{{1}}}">Magic div</div>
15993 !! endarticle
15994
15995 !! test
15996 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
15997 !! wikitext
15998 <div title="{{test}}"></div>
15999 !! html
16000 <div title="This is a test template"></div>
16001
16002 !! end
16003
16004 # Parsoid has enough context to handle this case
16005 !! test
16006 Bug 2304: HTML attribute safety (dangerous template; 2309)
16007 !! wikitext
16008 <div title="{{dangerous attribute}}"></div>
16009 !! html/php
16010 <div title=""></div>
16011
16012 !! html/parsoid
16013 <div title='" onmouseover="alert(document.cookie)' about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"title":"\" onmouseover=\"alert(document.cookie)"},"sa":{"title":"{{dangerous attribute}}"}}' data-mw='{"attribs":[[{"txt":"title"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[]],&amp;quot;dsr&amp;quot;:[12,35,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;dangerous attribute&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Dangerous_attribute&amp;quot;},&amp;quot;params&amp;quot;:{},&amp;quot;i&amp;quot;:0}}]}\">\" onmouseover=\"alert(document.cookie)&lt;/span>"}]]}'></div>
16014 !! end
16015
16016 !! test
16017 Bug 2304: HTML attribute safety (dangerous style template; 2309)
16018 !! wikitext
16019 <div style="{{dangerous style attribute}}"></div>
16020 !! html
16021 <div style="/* insecure input */"></div>
16022
16023 !! end
16024
16025 !! test
16026 Bug 2304: HTML attribute safety (safe parameter; 2309)
16027 !! wikitext
16028 {{div style|width: 200px}}
16029 !! html
16030 <div style="float: right; width: 200px">Magic div</div>
16031
16032 !! end
16033
16034 !! test
16035 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
16036 !! wikitext
16037 {{div style|width: expression(alert(document.cookie))}}
16038 !! html
16039 <div style="/* insecure input */">Magic div</div>
16040
16041 !! end
16042
16043 !! test
16044 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
16045 !! wikitext
16046 {{div style|"><script>alert(document.cookie)</script>}}
16047 !! html
16048 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16049
16050 !! end
16051
16052 !! test
16053 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
16054 !! wikitext
16055 {{div style|" ><script>alert(document.cookie)</script>}}
16056 !! html
16057 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16058
16059 !! end
16060
16061 !! test
16062 Bug 2304: HTML attribute safety (link)
16063 !! wikitext
16064 <div title="[[Main Page]]"></div>
16065 !! html
16066 <div title="&#91;&#91;Main Page]]"></div>
16067
16068 !! end
16069
16070 !! test
16071 Bug 2304: HTML attribute safety (italics)
16072 !! wikitext
16073 <div title="''foobar''"></div>
16074 !! html
16075 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16076
16077 !! end
16078
16079 !! test
16080 Bug 2304: HTML attribute safety (bold)
16081 !! wikitext
16082 <div title="'''foobar'''"></div>
16083 !! html
16084 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16085
16086 !! end
16087
16088
16089 !! test
16090 Bug 2304: HTML attribute safety (ISBN)
16091 !! wikitext
16092 <div title="ISBN 1234567890"></div>
16093 !! html
16094 <div title="&#73;SBN 1234567890"></div>
16095
16096 !! end
16097
16098 !! test
16099 Bug 2304: HTML attribute safety (RFC)
16100 !! wikitext
16101 <div title="RFC 1234"></div>
16102 !! html
16103 <div title="&#82;FC 1234"></div>
16104
16105 !! end
16106
16107 !! test
16108 Bug 2304: HTML attribute safety (PMID)
16109 !! wikitext
16110 <div title="PMID 1234567890"></div>
16111 !! html
16112 <div title="&#80;MID 1234567890"></div>
16113
16114 !! end
16115
16116 !! test
16117 Bug 2304: HTML attribute safety (web link)
16118 !! wikitext
16119 <div title="http://example.com/"></div>
16120 !! html
16121 <div title="http&#58;//example.com/"></div>
16122
16123 !! end
16124
16125 !! test
16126 Bug 2304: HTML attribute safety (named web link)
16127 !! wikitext
16128 <div title="[http://example.com/ link]"></div>
16129 !! html
16130 <div title="&#91;http&#58;//example.com/ link]"></div>
16131
16132 !! end
16133
16134 !! test
16135 Bug 3244: HTML attribute safety (extension; safe)
16136 !! wikitext
16137 <div style="<nowiki>background:blue</nowiki>"></div>
16138 !! html
16139 <div style="background:blue"></div>
16140
16141 !! end
16142
16143 !! test
16144 Bug 3244: HTML attribute safety (extension; unsafe)
16145 !! wikitext
16146 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16147 !! html
16148 <div style="/* insecure input */"></div>
16149
16150 !! end
16151
16152 # More MSIE fun discovered by Tom Gilder
16153
16154 !! test
16155 MSIE CSS safety test: spurious slash
16156 !! wikitext
16157 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16158 !! html
16159 <div style="/* insecure input */">evil</div>
16160
16161 !! end
16162
16163 !! test
16164 MSIE CSS safety test: hex code
16165 !! wikitext
16166 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16167 !! html
16168 <div style="/* insecure input */">evil</div>
16169
16170 !! end
16171
16172 !! test
16173 MSIE CSS safety test: comment in url
16174 !! wikitext
16175 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16176 !! html
16177 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16178
16179 !! end
16180
16181 !! test
16182 MSIE CSS safety test: comment in expression
16183 !! wikitext
16184 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16185 !! html
16186 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16187
16188 !! end
16189
16190 !! test
16191 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
16192 !! wikitext
16193 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16194 !! html
16195 <p style="/* invalid control char */">A</p>
16196
16197 !! end
16198
16199 !! test
16200 MSIE 6 CSS safety test: Fullwidth (bug 55332)
16201 !! wikitext
16202 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16203 <div style="top:EXPRESSION(alert())">B</div>
16204 !! html
16205 <p style="/* insecure input */">A</p>
16206 <div style="/* insecure input */">B</div>
16207
16208 !! end
16209
16210 !! test
16211 MSIE 6 CSS safety test: IPA extensions (bug 55332)
16212 !! wikitext
16213 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16214 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16215 !! html
16216 <div style="/* insecure input */">A</div>
16217 <p style="/* insecure input */">B</p>
16218
16219 !! end
16220
16221 !! test
16222 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16223 !! wikitext
16224 <div style="background-image:url⁽javascript:alert())">A</div>
16225 <div style="background-image:url₍javascript:alert())">B</div>
16226 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16227 !! html
16228 <div style="/* insecure input */">A</div>
16229 <div style="/* insecure input */">B</div>
16230 <p style="/* insecure input */">C</p>
16231
16232 !! end
16233
16234 # FIXME: Parsoid fails to sanitize this! See T58846.
16235 !! test
16236 Opera -o-link CSS
16237 !! wikitext
16238 <div
16239 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;"
16240 style="-o-link:attr(title);-o-link-source:current">X</div>
16241 !! html
16242 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16243
16244 !! end
16245
16246 !! test
16247 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16248 !! wikitext
16249 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16250 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16251 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16252 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16253 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16254 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16255 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16256 !! html
16257 <p style="/* insecure input */">A</p>
16258 <p style="/* insecure input */">B</p>
16259 <p style="/* insecure input */">C</p>
16260 <p style="/* insecure input */">D</p>
16261 <p style="/* insecure input */">E</p>
16262 <p style="/* insecure input */">F</p>
16263 <p style="/* insecure input */">G</p>
16264
16265 !! end
16266
16267 !! test
16268 Table attribute legitimate extension
16269 !! wikitext
16270 {|
16271 !+ style="<nowiki>color:blue</nowiki>"| status
16272 |}
16273 !! html
16274 <table>
16275 <tr>
16276 <th style="color:blue"> status
16277 </th></tr></table>
16278
16279 !!end
16280
16281 !! test
16282 Table attribute safety
16283 !! wikitext
16284 {|
16285 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16286 |}
16287 !! html
16288 <table>
16289 <tr>
16290 <th style="/* insecure input */"> status
16291 </th></tr></table>
16292
16293 !! end
16294
16295 !! test
16296 CSS line continuation 1
16297 !! wikitext
16298 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16299 !! html
16300 <div style="/* insecure input */"></div>
16301
16302 !! end
16303
16304 !! test
16305 CSS line continuation 2
16306 !! wikitext
16307 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16308 !! html
16309 <div style="/* invalid control char */"></div>
16310
16311 !! end
16312
16313 !! article
16314 Template:Identity
16315 !! text
16316 {{{1}}}
16317 !! endarticle
16318
16319 !! test
16320 Expansion of multi-line templates in attribute values (bug 6255)
16321 !! wikitext
16322 <div style="background: {{identity|#00FF00}}">-</div>
16323 !! html
16324 <div style="background: #00FF00">-</div>
16325
16326 !! end
16327
16328
16329 !! test
16330 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16331 !! wikitext
16332 <div style="background:
16333 #00FF00">-</div>
16334 !! html/php
16335 <div style="background: #00FF00">-</div>
16336
16337 !! html/parsoid
16338 <div style="background:
16339 #00FF00">-</div>
16340 !! end
16341
16342 !! test
16343 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16344 !! wikitext
16345 <div style="background: &#10;#00FF00">-</div>
16346 !! html
16347 <div style="background: &#10;#00FF00">-</div>
16348
16349 !! end
16350
16351 !! test
16352 evil <math>-wiki-tags without Extension:Math enabled
16353 !! wikitext
16354 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
16355 !! html+tidy
16356 <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>
16357 !! end
16358
16359 ###
16360 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16361 ###
16362 !! test
16363 Parser hook: empty input
16364 !! wikitext
16365 <tag></tag>
16366 !! html/php
16367 <pre>
16368 ''
16369 array (
16370 )
16371 </pre>
16372
16373 !! html/parsoid
16374 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16375 !! end
16376
16377 ## Don't expect parsoid to rt this form.
16378 !! test
16379 Parser hook: empty input using terminated empty elements
16380 !! options
16381 parsoid=wt2html,html2html
16382 !! wikitext
16383 <tag/>
16384 !! html/php
16385 <pre>
16386 NULL
16387 array (
16388 )
16389 </pre>
16390
16391 !! html/parsoid
16392 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16393 !! end
16394
16395 !! test
16396 Parser hook: empty input using terminated empty elements (space before)
16397 !! wikitext
16398 <tag />
16399 !! html/php
16400 <pre>
16401 NULL
16402 array (
16403 )
16404 </pre>
16405
16406 !! html/parsoid
16407 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16408 !! end
16409
16410 !! test
16411 Parser hook: basic input
16412 !! wikitext
16413 <tag>input</tag>
16414 !! html/php
16415 <pre>
16416 'input'
16417 array (
16418 )
16419 </pre>
16420
16421 !! html/parsoid
16422 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16423 !! end
16424
16425 ## Don't expect parsoid to rt this form.
16426 !! test
16427 Parser hook: case insensitive
16428 !! options
16429 parsoid=wt2html,html2html
16430 !! wikitext
16431 <TAG>input</TAG>
16432 !! html/php
16433 <pre>
16434 'input'
16435 array (
16436 )
16437 </pre>
16438
16439 !! html/parsoid
16440 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16441 !! end
16442
16443 ## Don't expect parsoid to rt this form.
16444 !! test
16445 Parser hook: case insensitive, redux
16446 !! options
16447 parsoid=wt2html,html2html
16448 !! wikitext
16449 <TaG>input</TAg>
16450 !! html/php
16451 <pre>
16452 'input'
16453 array (
16454 )
16455 </pre>
16456
16457 !! html/parsoid
16458 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16459 !! end
16460
16461 !! test
16462 Parser hook: nested tags
16463 !! wikitext
16464 <tag><tag></tag></tag>
16465 !! html/php
16466 <pre>
16467 '<tag>'
16468 array (
16469 )
16470 </pre>&lt;/tag&gt;
16471
16472 !! html/parsoid
16473 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
16474 !! end
16475
16476 !! test
16477 Parser hook: basic arguments
16478 !! wikitext
16479 <tag width="200" height="100" depth="50" square=""></tag>
16480 !! html/php
16481 <pre>
16482 ''
16483 array (
16484 'width' => '200',
16485 'height' => '100',
16486 'depth' => '50',
16487 'square' => '',
16488 )
16489 </pre>
16490
16491 !! html/parsoid
16492 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16493 !! end
16494
16495 ## Don't expect parsoid to rt this form.
16496 !! test
16497 Parser hook: basic arguments, variations
16498 !! options
16499 parsoid=wt2html,html2html
16500 !! wikitext
16501 <tag width=200 height = "100" depth = '50' square></tag>
16502 !! html/php
16503 <pre>
16504 ''
16505 array (
16506 'width' => '200',
16507 'height' => '100',
16508 'depth' => '50',
16509 'square' => '',
16510 )
16511 </pre>
16512
16513 !! html/parsoid
16514 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16515 !! end
16516
16517 !! test
16518 Parser hook: argument containing a forward slash (bug 5344)
16519 !! wikitext
16520 <tag filename="/tmp/bla"></tag>
16521 !! html/php
16522 <pre>
16523 ''
16524 array (
16525 'filename' => '/tmp/bla',
16526 )
16527 </pre>
16528
16529 !! html/parsoid
16530 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16531 !! end
16532
16533 ## Don't expect parsoid to rt this form.
16534 !! test
16535 Parser hook: empty input using terminated empty elements (bug 2374)
16536 !! options
16537 parsoid=wt2html,html2html
16538 !! wikitext
16539 <tag foo=bar/>text
16540 !! html/php
16541 <pre>
16542 NULL
16543 array (
16544 'foo' => 'bar',
16545 )
16546 </pre>text
16547
16548 !! html/parsoid
16549 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
16550 !! end
16551
16552 # </tag> should be output literally since there is no matching tag that begins it
16553 !! test
16554 Parser hook: basic arguments using terminated empty elements (bug 2374)
16555 !! wikitext
16556 <tag width=200 height = "100" depth = '50' square/>
16557 other stuff
16558 </tag>
16559 !! html/php
16560 <pre>
16561 NULL
16562 array (
16563 'width' => '200',
16564 'height' => '100',
16565 'depth' => '50',
16566 'square' => '',
16567 )
16568 </pre>
16569 <p>other stuff
16570 &lt;/tag&gt;
16571 </p>
16572 !! end
16573
16574 ###
16575 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
16576 ###
16577
16578 !! test
16579 Parser hook: static parser hook not inside a comment
16580 !! wikitext
16581 <statictag>hello, world</statictag>
16582
16583 <statictag action="flush" />
16584 !! html/php
16585 <p><br />
16586 hello, world
16587 </p>
16588 !! html/parsoid
16589 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
16590 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
16591 !! end
16592
16593 !! test
16594 Parser hook: static parser hook inside a comment
16595 !! wikitext
16596 <!-- <statictag>hello, world</statictag> -->
16597 <statictag action="flush" />
16598 !! html/php
16599 <p><br />
16600 </p>
16601 !! html/parsoid
16602 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
16603 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
16604 !! end
16605
16606 # Nested template calls; this case was broken by Parser.php rev 1.506,
16607 # since reverted.
16608
16609 !! article
16610 Template:One-parameter
16611 !! text
16612 (My parameter is: {{{1}}})
16613 !! endarticle
16614
16615 !! article
16616 Template:Map-one-parameter
16617 !! text
16618 {{{{{1}}}|{{{2}}}}}
16619 !! endarticle
16620
16621 !! test
16622 Nested template calls
16623 !! wikitext
16624 {{Map-one-parameter|One-parameter|param}}
16625 !! html
16626 <p>(My parameter is: param)
16627 </p>
16628 !! end
16629
16630
16631 ###
16632 ### Sanitizer
16633 ###
16634
16635 # HTML+Tidy effectively strips out the empty tags completely
16636 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
16637 # which Tidy would have done for the PHP parser had there been content inside it.
16638 !! test
16639 Sanitizer: Closing of open tags
16640 !! wikitext
16641 <s></s><table></table>
16642 !! html
16643 <s></s><table></table>
16644
16645 !! html/parsoid
16646 <p><s></s></p><table></table>
16647 !! end
16648
16649 !! test
16650 Sanitizer: Closing of open but not closed tags
16651 !! wikitext
16652 <s>foo
16653 !! html
16654 <p><s>foo</s>
16655 </p>
16656 !! end
16657
16658 !! test
16659 Sanitizer: Closing of closed but not open tags
16660 !! options
16661 parsoid=wt2html
16662 !! wikitext
16663 </s>
16664 !! html/php+tidy
16665 !! html/parsoid
16666 !! end
16667
16668 !! test
16669 Sanitizer: Closing of closed but not open table tags
16670 !! options
16671 parsoid=wt2html
16672 !! wikitext
16673 Table not started</td></tr></table>
16674 !! html/php+tidy
16675 <p>Table not started</p>
16676 !! html/parsoid
16677 <p>Table not started</p>
16678 !! end
16679
16680 !! test
16681 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
16682 !! wikitext
16683 <span id="æ: v">byte</span>[[#æ: v|backlink]]
16684 !! html
16685 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
16686 </p>
16687 !! end
16688
16689 # In HTML5, the restrictions are that id must contain at least one character,
16690 # and must not contain any space characters.
16691 !! test
16692 Sanitizer: Validating the contents of the id attribute (bug 4515)
16693 !! options
16694 disabled
16695 !! wikitext
16696 <br id="" /><br id="a space" />
16697 !! html
16698 Something ...
16699 !! end
16700
16701 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
16702 !! test
16703 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
16704 !! options
16705 disabled
16706 !! wikitext
16707 <br id="foo" /><br id="foo" />
16708 !! html
16709 Something need to be done. foo-2 ?
16710 !! end
16711
16712 !! test
16713 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
16714 !! wikitext
16715 <div itemscope>
16716 <meta itemprop="hello" content="world">
16717 <meta http-equiv="refresh" content="5">
16718 <meta itemprop="hello" http-equiv="refresh" content="5">
16719 <link itemprop="hello" href="{{SERVER}}">
16720 <link rel="stylesheet" href="{{SERVER}}">
16721 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
16722 </div>
16723 !! html
16724 <div itemscope="">
16725 <p> <meta itemprop="hello" content="world" />
16726 &lt;meta http-equiv="refresh" content="5"&gt;
16727 <meta itemprop="hello" content="5" />
16728 </p>
16729 <link itemprop="hello" href="http&#58;//example.org" />
16730 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
16731 <link itemprop="hello" href="http&#58;//example.org" />
16732 </div>
16733
16734 !! end
16735
16736 !! test
16737 Language converter: output gets cut off unexpectedly (bug 5757)
16738 !! options
16739 language=zh
16740 !! wikitext
16741 this bit is safe: }-
16742
16743 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
16744
16745 then we get cut off here: }-
16746
16747 all additional text is vanished
16748 !! html
16749 <p>this bit is safe: }-
16750 </p><p>but if we add a conversion instance: xxx
16751 </p><p>then we get cut off here: }-
16752 </p><p>all additional text is vanished
16753 </p>
16754 !! end
16755
16756 !! test
16757 Self closed html pairs (bug 5487)
16758 !! options
16759 !! wikitext
16760 <center><font id="bug" />Centered text</center>
16761 <div><font id="bug2" />In div text</div>
16762 !! html
16763 <center>&lt;font id="bug" /&gt;Centered text</center>
16764 <div>&lt;font id="bug2" /&gt;In div text</div>
16765
16766 !! end
16767
16768 #
16769 #
16770 #
16771
16772 !! test
16773 Punctuation: nbsp before exclamation
16774 !! wikitext
16775 C'est grave !
16776 !! html
16777 <p>C'est grave&#160;!
16778 </p>
16779 !! end
16780
16781 !! test
16782 Punctuation: CSS !important (bug 11874)
16783 !! wikitext
16784 <div style="width:50% !important">important</div>
16785 !! html
16786 <div style="width:50% !important">important</div>
16787
16788 !!end
16789
16790 !! test
16791 Punctuation: CSS ! important (bug 11874; with space after)
16792 !! wikitext
16793 <div style="width:50% ! important">important</div>
16794 !! html
16795 <div style="width:50% ! important">important</div>
16796
16797 !!end
16798
16799 !! test
16800 HTML bullet list, closed tags (bug 5497)
16801 !! wikitext
16802 <ul>
16803 <li>One</li>
16804 <li>Two</li>
16805 </ul>
16806 !! html/php
16807 <ul>
16808 <li>One</li>
16809 <li>Two</li>
16810 </ul>
16811
16812 !! html/parsoid
16813 <ul data-parsoid='{"stx":"html"}'>
16814 <li data-parsoid='{"stx":"html"}'>One</li>
16815 <li data-parsoid='{"stx":"html"}'>Two</li>
16816 </ul>
16817
16818 !! end
16819
16820 !! test
16821 HTML bullet list, unclosed tags (bug 5497)
16822 !! wikitext
16823 <ul>
16824 <li>One
16825 <li>Two
16826 </ul>
16827 !! html/php+tidy
16828 <ul>
16829 <li>One</li>
16830 <li>Two</li>
16831 </ul>
16832 !! html/parsoid
16833 <ul data-parsoid='{"stx":"html"}'>
16834 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16835 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16836 </ul>
16837
16838 !! end
16839
16840 !! test
16841 HTML ordered list, closed tags (bug 5497)
16842 !! wikitext
16843 <ol>
16844 <li>One</li>
16845 <li>Two</li>
16846 </ol>
16847 !! html/php
16848 <ol>
16849 <li>One</li>
16850 <li>Two</li>
16851 </ol>
16852
16853 !! html/parsoid
16854 <ol data-parsoid='{"stx":"html"}'>
16855 <li data-parsoid='{"stx":"html"}'>One</li>
16856 <li data-parsoid='{"stx":"html"}'>Two</li>
16857 </ol>
16858
16859 !! end
16860
16861 !! test
16862 HTML ordered list, unclosed tags (bug 5497)
16863 !! options
16864 !! wikitext
16865 <ol>
16866 <li>One
16867 <li>Two
16868 </ol>
16869 !! html/php+tidy
16870 <ol>
16871 <li>One</li>
16872 <li>Two</li>
16873 </ol>
16874 !! html/parsoid
16875 <ol data-parsoid='{"stx":"html"}'>
16876 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16877 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16878 </ol>
16879
16880 !! end
16881
16882 !! test
16883 HTML nested bullet list, closed tags (bug 5497)
16884 !! wikitext
16885 <ul>
16886 <li>One</li>
16887 <li>Two:
16888 <ul>
16889 <li>Sub-one</li>
16890 <li>Sub-two</li>
16891 </ul>
16892 </li>
16893 </ul>
16894 !! html
16895 <ul>
16896 <li>One</li>
16897 <li>Two:
16898 <ul>
16899 <li>Sub-one</li>
16900 <li>Sub-two</li>
16901 </ul>
16902 </li>
16903 </ul>
16904
16905 !! end
16906
16907 !! test
16908 HTML nested bullet list, open tags (bug 5497)
16909 !! wikitext
16910 <ul>
16911 <li>One
16912 <li>Two:
16913 <ul>
16914 <li>Sub-one
16915 <li>Sub-two
16916 </ul>
16917 </ul>
16918 !! html/php+tidy
16919 <ul>
16920 <li>One</li>
16921 <li>Two:
16922 <ul>
16923 <li>Sub-one</li>
16924 <li>Sub-two</li>
16925 </ul>
16926 </li>
16927 </ul>
16928 !! html/parsoid
16929 <ul>
16930 <li>One
16931 </li>
16932 <li>Two:
16933 <ul>
16934 <li>Sub-one
16935 </li>
16936 <li>Sub-two
16937 </li>
16938 </ul>
16939 </li>
16940 </ul>
16941
16942 !! end
16943
16944 !! test
16945 HTML nested ordered list, closed tags (bug 5497)
16946 !! wikitext
16947 <ol>
16948 <li>One</li>
16949 <li>Two:
16950 <ol>
16951 <li>Sub-one</li>
16952 <li>Sub-two</li>
16953 </ol>
16954 </li>
16955 </ol>
16956 !! html
16957 <ol>
16958 <li>One</li>
16959 <li>Two:
16960 <ol>
16961 <li>Sub-one</li>
16962 <li>Sub-two</li>
16963 </ol>
16964 </li>
16965 </ol>
16966
16967 !! end
16968
16969 !! test
16970 HTML nested ordered list, open tags (bug 5497)
16971 !! wikitext
16972 <ol>
16973 <li>One
16974 <li>Two:
16975 <ol>
16976 <li>Sub-one
16977 <li>Sub-two
16978 </ol>
16979 </ol>
16980 !! html/php
16981 <ol>
16982 <li>One
16983 <li>Two:
16984 <ol>
16985 <li>Sub-one
16986 <li>Sub-two
16987 </ol>
16988 </ol>
16989
16990 !! html/parsoid
16991 <ol>
16992 <li>One
16993 </li>
16994 <li>Two:
16995 <ol>
16996 <li>Sub-one
16997 </li>
16998 <li>Sub-two
16999 </li>
17000 </ol>
17001 </li>
17002 </ol>
17003
17004 !! end
17005
17006 !! test
17007 HTML ordered list item with parameters oddity
17008 !! wikitext
17009 <ol><li id="fragment">One</li>
17010 </ol>
17011 !! html
17012 <ol><li id="fragment">One</li>
17013 </ol>
17014
17015 !! end
17016
17017 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
17018 !!test
17019 bug 5918: autonumbering
17020 !! wikitext
17021 [http://first/] [http://second] [ftp://ftp]
17022
17023 ftp://inlineftp
17024
17025 [mailto:enclosed@mail.tld With target]
17026
17027 [mailto:enclosed@mail.tld]
17028
17029 mailto:inline@mail.tld
17030 !! html/php
17031 <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>
17032 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
17033 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
17034 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
17035 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
17036 </p>
17037 !! html/parsoid
17038 <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>
17039 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
17040 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
17041 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
17042 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
17043 !! end
17044
17045
17046 #
17047 # Security and HTML correctness
17048 # From Nick Jenkins' fuzz testing
17049 #
17050
17051 !! test
17052 Fuzz testing: Parser13
17053 !! wikitext
17054 {|
17055 | http://a|
17056 !! html
17057 <table>
17058 <tr>
17059 <td>
17060 </td>
17061 </tr>
17062 </table>
17063
17064 !! end
17065
17066 !! test
17067 Fuzz testing: Parser14
17068 !! wikitext
17069 == onmouseover= ==
17070 http://__TOC__
17071 !! html
17072 <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>
17073 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17074 <ul>
17075 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17076 </ul>
17077 </div>
17078
17079
17080 !! html+tidy
17081 <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>
17082 <p>http://</p>
17083 <div id="toc" class="toc">
17084 <div id="toctitle">
17085 <h2>Contents</h2>
17086 </div>
17087 <ul>
17088 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17089 </ul>
17090 </div>
17091 <p></p>
17092 !! end
17093
17094 !! test
17095 Fuzz testing: Parser14-table
17096 !! options
17097 parsoid=wt2html,html2html
17098 !! wikitext
17099 ==a==
17100 {| STYLE=__TOC__
17101 !! html
17102 <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>
17103 <table style="&#95;_TOC&#95;_">
17104 <tr><td></td></tr>
17105 </table>
17106
17107 !! html+tidy
17108 <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>
17109 <table style="__TOC__">
17110 <tr>
17111 <td></td>
17112 </tr>
17113 </table>
17114 !! html/parsoid
17115 <h2>a</h2>
17116 <table style="__TOC__"></table>
17117 !! end
17118
17119 # Known to produce bogus xml (extra </td>)
17120 !! test
17121 Fuzz testing: Parser16
17122 !! wikitext
17123 {|
17124 !https://||||||
17125 !! html
17126 <table>
17127 <tr>
17128 <th>https://</th>
17129 <th></th>
17130 <th></th>
17131 <th>
17132 </td>
17133 </tr>
17134 </table>
17135
17136 !! html+tidy
17137 <table>
17138 <tr>
17139 <th>https://</th>
17140 <th></th>
17141 <th></th>
17142 <th></th>
17143 </tr>
17144 </table>
17145 !! end
17146
17147 !! test
17148 Fuzz testing: Parser21
17149 !! wikitext
17150 {|
17151 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17152 |
17153 !! html
17154 <table>
17155 <tr>
17156 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17157 </th>
17158 <td>
17159 </td>
17160 </tr>
17161 </table>
17162
17163 !! end
17164
17165 !! test
17166 Fuzz testing: Parser22
17167 !! wikitext
17168 http://===r:::https://b
17169
17170 {|
17171 !! html
17172 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17173 </p>
17174 <table>
17175 <tr><td></td></tr>
17176 </table>
17177
17178 !! end
17179
17180 # Known to produce bad XML for now
17181 !! test
17182 Fuzz testing: Parser24
17183 !! wikitext
17184 {|
17185 {{{|
17186 <u CLASS=
17187 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17188 <br style="onmouseover='alert(document.cookie);' " />
17189
17190 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17191 |
17192 !! html
17193 <table>
17194 {{{|
17195 <u class="&#124;">}}}} &gt;
17196 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17197
17198 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17199 <tr>
17200 <td></u>
17201 </td>
17202 </tr>
17203 </table>
17204
17205 !! end
17206
17207 # Note: the current result listed for this is not what the original one was,
17208 # but the original bug was JavaScript injection, which is fixed in any case.
17209 # It's not clear that the original result listed was any more correct than the
17210 # current one. Original result:
17211 # <p>{{{|
17212 # </p>
17213 # <li class="&#124;&#124;">
17214 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17215 !!test
17216 Fuzz testing: Parser25 (bug 6055)
17217 !! wikitext
17218 {{{
17219 |
17220 <LI CLASS=||
17221 >
17222 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17223 !! html
17224 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17225 </p>
17226 !! end
17227
17228 !!test
17229 Fuzz testing: URL adjacent extension (with space, clean)
17230 !! wikitext
17231 http://example.com <nowiki>junk</nowiki>
17232 !! html/php
17233 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17234 </p>
17235 !! html/parsoid
17236 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17237 !! end
17238
17239 !!test
17240 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17241 !! wikitext
17242 http://example.com<nowiki>junk</nowiki>
17243 !! html/php
17244 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17245 </p>
17246 !! html/parsoid
17247 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17248 !! end
17249
17250 !!test
17251 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17252 !! wikitext
17253 http://example.com<pre>junk</pre>
17254 !! html/php
17255 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17256
17257 !! html/php+tidy
17258 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17259 <pre>
17260 junk
17261 </pre>
17262 !! html/parsoid
17263 <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>
17264 !!end
17265
17266 !!test
17267 Fuzz testing: image with bogus manual thumbnail
17268 !! wikitext
17269 [[Image:foobar.jpg|thumbnail= ]]
17270 !! html/php
17271 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17272
17273 !! html/parsoid
17274 <figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"manualthumb","ak":"thumbnail= "}],"dsr":[0,32,2,2]}' data-mw='{"errors":[{"key":"missing-thumbnail","message":"This thumbnail does not exist.","params":{"name":""}}],"thumb":""}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{},"dsr":[2,30,null,null]}'><img resource="./File:Foobar.jpg" src="./Special:FilePath/" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"220"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure>
17275 !!end
17276
17277 !! test
17278 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17279 !! wikitext
17280 <pre dir="&#10;"></pre>
17281 !! html
17282 <pre dir="&#10;"></pre>
17283
17284 !! end
17285
17286 !! test
17287 Parsing optional HTML elements (Bug 6171)
17288 !! options
17289 !! wikitext
17290 <table>
17291 <tr>
17292 <td> Some tabular data</td>
17293 <td> More tabular data ...
17294 <td> And yet som tabular data</td>
17295 </tr>
17296 </table>
17297 !! html
17298 <table>
17299 <tr>
17300 <td> Some tabular data</td>
17301 <td> More tabular data ...
17302 </td><td> And yet som tabular data</td>
17303 </tr>
17304 </table>
17305
17306 !! end
17307
17308 !! test
17309 Correct handling of <td>, <tr> (Bug 6171)
17310 !! options
17311 !! wikitext
17312 <table>
17313 <tr>
17314 <td> Some tabular data</td>
17315 <td> More tabular data ...</td>
17316 <td> And yet som tabular data</td>
17317 </tr>
17318 </table>
17319 !! html
17320 <table>
17321 <tr>
17322 <td> Some tabular data</td>
17323 <td> More tabular data ...</td>
17324 <td> And yet som tabular data</td>
17325 </tr>
17326 </table>
17327
17328 !! end
17329
17330
17331 !! test
17332 Parsing crashing regression (fr:JavaScript)
17333 !! wikitext
17334 </body></x>
17335 !! html
17336 <p>&lt;/body&gt;&lt;/x&gt;
17337 </p>
17338 !! end
17339
17340 !! test
17341 Inline wiki vs wiki block nesting
17342 !! wikitext
17343 '''Bold paragraph
17344
17345 New wiki paragraph
17346 !! html
17347 <p><b>Bold paragraph</b>
17348 </p><p>New wiki paragraph
17349 </p>
17350 !! end
17351
17352 # FIXME: The current php output is documented
17353 # and desired output is the parsoid target.
17354 !! test
17355 Inline HTML vs wiki block nesting
17356 !! wikitext
17357 <b>Bold paragraph
17358
17359 New wiki paragraph
17360 !! html/php
17361 <p><b>Bold paragraph
17362 </p><p>New wiki paragraph</b>
17363 </p>
17364 !! html/parsoid
17365 <p><b>Bold paragraph</b>
17366 </p><p>New wiki paragraph
17367 </p>
17368 !! end
17369
17370 # Original result was this:
17371 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
17372 # </p>
17373 # While that might be marginally more intuitive, maybe, the six-apostrophe
17374 # construct is clearly pathological and the result stated here (which is what
17375 # the parser actually does) is about as reasonable as anything.
17376 !!test
17377 Mixing markup for italics and bold
17378 !! options
17379 !! wikitext
17380 '''bold''''''bold''bolditalics'''''
17381 !! html
17382 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
17383 </p>
17384 !! end
17385
17386
17387 !! article
17388 Xyzzyx
17389 !! text
17390 Article for special page transclusion test
17391 !! endarticle
17392
17393 !! test
17394 Special page transclusion
17395 !! options
17396 !! wikitext
17397 {{Special:Prefixindex/Xyzzyx}}
17398 !! html
17399 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17400 </ul>
17401
17402 !! end
17403
17404 !! test
17405 Special page transclusion twice (bug 5021)
17406 !! options
17407 !! wikitext
17408 {{Special:Prefixindex/Xyzzyx}}
17409 {{Special:Prefixindex/Xyzzyx}}
17410 !! html
17411 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17412 </ul>
17413 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17414 </ul>
17415
17416 !! end
17417
17418 !! test
17419 Transclusion of default MediaWiki message
17420 !! wikitext
17421 {{MediaWiki:Mainpage}}
17422 !! html
17423 <p>Main Page
17424 </p>
17425 !! end
17426
17427 !! test
17428 Transclusion of nonexistent MediaWiki message
17429 !! wikitext
17430 {{MediaWiki:Mainpagexxx}}
17431 !! html
17432 <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>
17433 </p>
17434 !! end
17435
17436 !! test
17437 Transclusion of MediaWiki message with underscore
17438 !! wikitext
17439 {{MediaWiki:history_short}}
17440 !! html
17441 <p>History
17442 </p>
17443 !! end
17444
17445 !! test
17446 Transclusion of MediaWiki message with space
17447 !! wikitext
17448 {{MediaWiki:history short}}
17449 !! html
17450 <p>History
17451 </p>
17452 !! end
17453
17454 !! test
17455 Invalid header with following text
17456 !! wikitext
17457 = x = y
17458 !! html
17459 <p>= x = y
17460 </p>
17461 !! end
17462
17463
17464 !! test
17465 Section extraction test (section 0)
17466 !! options
17467 section=0
17468 !! wikitext
17469 start
17470 ==a==
17471 ===aa===
17472 ====aaa====
17473 ==b==
17474 ===ba===
17475 ===bb===
17476 ====bba====
17477 ===bc===
17478 ==c==
17479 ===ca===
17480 !! html/php
17481 start
17482 !! end
17483
17484 !! test
17485 Section extraction test (section 1)
17486 !! options
17487 section=1
17488 !! wikitext
17489 start
17490 ==a==
17491 ===aa===
17492 ====aaa====
17493 ==b==
17494 ===ba===
17495 ===bb===
17496 ====bba====
17497 ===bc===
17498 ==c==
17499 ===ca===
17500 !! html/php
17501 ==a==
17502 ===aa===
17503 ====aaa====
17504 !! end
17505
17506 !! test
17507 Section extraction test (section 2)
17508 !! options
17509 section=2
17510 !! wikitext
17511 start
17512 ==a==
17513 ===aa===
17514 ====aaa====
17515 ==b==
17516 ===ba===
17517 ===bb===
17518 ====bba====
17519 ===bc===
17520 ==c==
17521 ===ca===
17522 !! html/php
17523 ===aa===
17524 ====aaa====
17525 !! end
17526
17527 !! test
17528 Section extraction test (section 3)
17529 !! options
17530 section=3
17531 !! wikitext
17532 start
17533 ==a==
17534 ===aa===
17535 ====aaa====
17536 ==b==
17537 ===ba===
17538 ===bb===
17539 ====bba====
17540 ===bc===
17541 ==c==
17542 ===ca===
17543 !! html/php
17544 ====aaa====
17545 !! end
17546
17547 !! test
17548 Section extraction test (section 4)
17549 !! options
17550 section=4
17551 !! wikitext
17552 start
17553 ==a==
17554 ===aa===
17555 ====aaa====
17556 ==b==
17557 ===ba===
17558 ===bb===
17559 ====bba====
17560 ===bc===
17561 ==c==
17562 ===ca===
17563 !! html/php
17564 ==b==
17565 ===ba===
17566 ===bb===
17567 ====bba====
17568 ===bc===
17569 !! end
17570
17571 !! test
17572 Section extraction test (section 5)
17573 !! options
17574 section=5
17575 !! wikitext
17576 start
17577 ==a==
17578 ===aa===
17579 ====aaa====
17580 ==b==
17581 ===ba===
17582 ===bb===
17583 ====bba====
17584 ===bc===
17585 ==c==
17586 ===ca===
17587 !! html/php
17588 ===ba===
17589 !! end
17590
17591 !! test
17592 Section extraction test (section 6)
17593 !! options
17594 section=6
17595 !! wikitext
17596 start
17597 ==a==
17598 ===aa===
17599 ====aaa====
17600 ==b==
17601 ===ba===
17602 ===bb===
17603 ====bba====
17604 ===bc===
17605 ==c==
17606 ===ca===
17607 !! html/php
17608 ===bb===
17609 ====bba====
17610 !! end
17611
17612 !! test
17613 Section extraction test (section 7)
17614 !! options
17615 section=7
17616 !! wikitext
17617 start
17618 ==a==
17619 ===aa===
17620 ====aaa====
17621 ==b==
17622 ===ba===
17623 ===bb===
17624 ====bba====
17625 ===bc===
17626 ==c==
17627 ===ca===
17628 !! html/php
17629 ====bba====
17630 !! end
17631
17632 !! test
17633 Section extraction test (section 8)
17634 !! options
17635 section=8
17636 !! wikitext
17637 start
17638 ==a==
17639 ===aa===
17640 ====aaa====
17641 ==b==
17642 ===ba===
17643 ===bb===
17644 ====bba====
17645 ===bc===
17646 ==c==
17647 ===ca===
17648 !! html/php
17649 ===bc===
17650 !! end
17651
17652 !! test
17653 Section extraction test (section 9)
17654 !! options
17655 section=9
17656 !! wikitext
17657 start
17658 ==a==
17659 ===aa===
17660 ====aaa====
17661 ==b==
17662 ===ba===
17663 ===bb===
17664 ====bba====
17665 ===bc===
17666 ==c==
17667 ===ca===
17668 !! html/php
17669 ==c==
17670 ===ca===
17671 !! end
17672
17673 !! test
17674 Section extraction test (section 10)
17675 !! options
17676 section=10
17677 !! wikitext
17678 start
17679 ==a==
17680 ===aa===
17681 ====aaa====
17682 ==b==
17683 ===ba===
17684 ===bb===
17685 ====bba====
17686 ===bc===
17687 ==c==
17688 ===ca===
17689 !! html/php
17690 ===ca===
17691 !! end
17692
17693 !! test
17694 Section extraction test (nonexistent section 11)
17695 !! options
17696 section=11
17697 !! wikitext
17698 start
17699 ==a==
17700 ===aa===
17701 ====aaa====
17702 ==b==
17703 ===ba===
17704 ===bb===
17705 ====bba====
17706 ===bc===
17707 ==c==
17708 ===ca===
17709 !! html/php
17710 !! end
17711
17712 !! test
17713 Section extraction test with bogus heading (section 1)
17714 !! options
17715 section=1
17716 !! wikitext
17717 ==a==
17718 ==bogus== not a legal section
17719 ==b==
17720 !! html/php
17721 ==a==
17722 ==bogus== not a legal section
17723 !! end
17724
17725 !! test
17726 Section extraction test with bogus heading (section 2)
17727 !! options
17728 section=2
17729 !! wikitext
17730 ==a==
17731 ==bogus== not a legal section
17732 ==b==
17733 !! html/php
17734 ==b==
17735 !! end
17736
17737 !! test
17738 Section extraction test with comment after heading (section 1)
17739 !! options
17740 section=1
17741 !! wikitext
17742 ==a==
17743 ==b== <!-- -->
17744 ==c==
17745 !! html/php
17746 ==a==
17747 !! end
17748
17749 !! test
17750 Section extraction test with comment after heading (section 2)
17751 !! options
17752 section=2
17753 !! wikitext
17754 ==a==
17755 ==b== <!-- -->
17756 ==c==
17757 !! html/php
17758 ==b== <!-- -->
17759 !! end
17760
17761 !! test
17762 Section extraction test with bogus <nowiki> heading (section 1)
17763 !! options
17764 section=1
17765 !! wikitext
17766 ==a==
17767 ==bogus== <nowiki>not a legal section</nowiki>
17768 ==b==
17769 !! html/php
17770 ==a==
17771 ==bogus== <nowiki>not a legal section</nowiki>
17772 !! end
17773
17774 !! test
17775 Section extraction test with bogus <nowiki> heading (section 2)
17776 !! options
17777 section=2
17778 !! wikitext
17779 ==a==
17780 ==bogus== <nowiki>not a legal section</nowiki>
17781 ==b==
17782 !! html/php
17783 ==b==
17784 !! end
17785
17786 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
17787 # instead of respecting commented sections
17788 !! test
17789 Section extraction prefixed by comment (section 1)
17790 !! options
17791 section=1
17792 !! wikitext
17793 <!-- -->==sec1==
17794 ==sec2==
17795 !! html/php
17796 ==sec2==
17797 !!end
17798
17799 !! test
17800 Section extraction prefixed by comment (section 2)
17801 !! options
17802 section=2
17803 !! wikitext
17804 <!-- -->==sec1==
17805 ==sec2==
17806 !! html/php
17807
17808 !!end
17809
17810 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
17811 # instead of respecting HTML-style headings
17812 !! test
17813 Section extraction, mixed wiki and html (section 1)
17814 !! options
17815 section=1
17816 !! wikitext
17817 <h2>unmarked</h2>
17818 unmarked
17819 ==1==
17820 one
17821 ==2==
17822 two
17823 !! html/php
17824 ==1==
17825 one
17826 !! end
17827
17828 !! test
17829 Section extraction, mixed wiki and html (section 2)
17830 !! options
17831 section=2
17832 !! wikitext
17833 <h2>unmarked</h2>
17834 unmarked
17835 ==1==
17836 one
17837 ==2==
17838 two
17839 !! html/php
17840 ==2==
17841 two
17842 !! end
17843
17844
17845 # Formerly testing for bug 3342
17846 !! test
17847 Section extraction, heading surrounded by <noinclude>
17848 !! options
17849 section=1
17850 !! wikitext
17851 <noinclude>==unmarked==</noinclude>
17852 ==marked==
17853 !! html/php
17854 ==marked==
17855 !!end
17856
17857 # Test behavior of bug 19910
17858 !! test
17859 Sectiion with all-equals
17860 !! options
17861 section=2
17862 !! wikitext
17863 ===
17864 The line above must have a trailing space
17865 === <!--
17866 --> <!-- -->
17867 But just in case it doesn't...
17868 !! html/php
17869 === <!--
17870 --> <!-- -->
17871 But just in case it doesn't...
17872 !! end
17873
17874 !! test
17875 Section replacement test (section 0)
17876 !! options
17877 replace=0,"xxx"
17878 !! wikitext
17879 start
17880 ==a==
17881 ===aa===
17882 ====aaa====
17883 ==b==
17884 ===ba===
17885 ===bb===
17886 ====bba====
17887 ===bc===
17888 ==c==
17889 ===ca===
17890 !! html/php
17891 xxx
17892
17893 ==a==
17894 ===aa===
17895 ====aaa====
17896 ==b==
17897 ===ba===
17898 ===bb===
17899 ====bba====
17900 ===bc===
17901 ==c==
17902 ===ca===
17903 !! end
17904
17905 !! test
17906 Section replacement test (section 1)
17907 !! options
17908 replace=1,"xxx"
17909 !! wikitext
17910 start
17911 ==a==
17912 ===aa===
17913 ====aaa====
17914 ==b==
17915 ===ba===
17916 ===bb===
17917 ====bba====
17918 ===bc===
17919 ==c==
17920 ===ca===
17921 !! html/php
17922 start
17923 xxx
17924
17925 ==b==
17926 ===ba===
17927 ===bb===
17928 ====bba====
17929 ===bc===
17930 ==c==
17931 ===ca===
17932 !! end
17933
17934 !! test
17935 Section replacement test (section 2)
17936 !! options
17937 replace=2,"xxx"
17938 !! wikitext
17939 start
17940 ==a==
17941 ===aa===
17942 ====aaa====
17943 ==b==
17944 ===ba===
17945 ===bb===
17946 ====bba====
17947 ===bc===
17948 ==c==
17949 ===ca===
17950 !! html/php
17951 start
17952 ==a==
17953 xxx
17954
17955 ==b==
17956 ===ba===
17957 ===bb===
17958 ====bba====
17959 ===bc===
17960 ==c==
17961 ===ca===
17962 !! end
17963
17964 !! test
17965 Section replacement test (section 3)
17966 !! options
17967 replace=3,"xxx"
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 start
17982 ==a==
17983 ===aa===
17984 xxx
17985
17986 ==b==
17987 ===ba===
17988 ===bb===
17989 ====bba====
17990 ===bc===
17991 ==c==
17992 ===ca===
17993 !! end
17994
17995 !! test
17996 Section replacement test (section 4)
17997 !! options
17998 replace=4,"xxx"
17999 !! wikitext
18000 start
18001 ==a==
18002 ===aa===
18003 ====aaa====
18004 ==b==
18005 ===ba===
18006 ===bb===
18007 ====bba====
18008 ===bc===
18009 ==c==
18010 ===ca===
18011 !! html/php
18012 start
18013 ==a==
18014 ===aa===
18015 ====aaa====
18016 xxx
18017
18018 ==c==
18019 ===ca===
18020 !! end
18021
18022 !! test
18023 Section replacement test (section 5)
18024 !! options
18025 replace=5,"xxx"
18026 !! wikitext
18027 start
18028 ==a==
18029 ===aa===
18030 ====aaa====
18031 ==b==
18032 ===ba===
18033 ===bb===
18034 ====bba====
18035 ===bc===
18036 ==c==
18037 ===ca===
18038 !! html/php
18039 start
18040 ==a==
18041 ===aa===
18042 ====aaa====
18043 ==b==
18044 xxx
18045
18046 ===bb===
18047 ====bba====
18048 ===bc===
18049 ==c==
18050 ===ca===
18051 !! end
18052
18053 !! test
18054 Section replacement test (section 6)
18055 !! options
18056 replace=6,"xxx"
18057 !! wikitext
18058 start
18059 ==a==
18060 ===aa===
18061 ====aaa====
18062 ==b==
18063 ===ba===
18064 ===bb===
18065 ====bba====
18066 ===bc===
18067 ==c==
18068 ===ca===
18069 !! html/php
18070 start
18071 ==a==
18072 ===aa===
18073 ====aaa====
18074 ==b==
18075 ===ba===
18076 xxx
18077
18078 ===bc===
18079 ==c==
18080 ===ca===
18081 !! end
18082
18083 !! test
18084 Section replacement test (section 7)
18085 !! options
18086 replace=7,"xxx"
18087 !! wikitext
18088 start
18089 ==a==
18090 ===aa===
18091 ====aaa====
18092 ==b==
18093 ===ba===
18094 ===bb===
18095 ====bba====
18096 ===bc===
18097 ==c==
18098 ===ca===
18099 !! html/php
18100 start
18101 ==a==
18102 ===aa===
18103 ====aaa====
18104 ==b==
18105 ===ba===
18106 ===bb===
18107 xxx
18108
18109 ===bc===
18110 ==c==
18111 ===ca===
18112 !! end
18113
18114 !! test
18115 Section replacement test (section 8)
18116 !! options
18117 replace=8,"xxx"
18118 !! wikitext
18119 start
18120 ==a==
18121 ===aa===
18122 ====aaa====
18123 ==b==
18124 ===ba===
18125 ===bb===
18126 ====bba====
18127 ===bc===
18128 ==c==
18129 ===ca===
18130 !! html/php
18131 start
18132 ==a==
18133 ===aa===
18134 ====aaa====
18135 ==b==
18136 ===ba===
18137 ===bb===
18138 ====bba====
18139 xxx
18140
18141 ==c==
18142 ===ca===
18143 !!end
18144
18145 !! test
18146 Section replacement test (section 9)
18147 !! options
18148 replace=9,"xxx"
18149 !! wikitext
18150 start
18151 ==a==
18152 ===aa===
18153 ====aaa====
18154 ==b==
18155 ===ba===
18156 ===bb===
18157 ====bba====
18158 ===bc===
18159 ==c==
18160 ===ca===
18161 !! html/php
18162 start
18163 ==a==
18164 ===aa===
18165 ====aaa====
18166 ==b==
18167 ===ba===
18168 ===bb===
18169 ====bba====
18170 ===bc===
18171 xxx
18172 !! end
18173
18174 !! test
18175 Section replacement test (section 10)
18176 !! options
18177 replace=10,"xxx"
18178 !! wikitext
18179 start
18180 ==a==
18181 ===aa===
18182 ====aaa====
18183 ==b==
18184 ===ba===
18185 ===bb===
18186 ====bba====
18187 ===bc===
18188 ==c==
18189 ===ca===
18190 !! html/php
18191 start
18192 ==a==
18193 ===aa===
18194 ====aaa====
18195 ==b==
18196 ===ba===
18197 ===bb===
18198 ====bba====
18199 ===bc===
18200 ==c==
18201 xxx
18202 !! end
18203
18204 !! test
18205 Section replacement test with initial whitespace (bug 13728)
18206 !! options
18207 replace=2,"xxx"
18208 !! wikitext
18209 Preformatted initial line
18210 ==a==
18211 ===a===
18212 !! html/php
18213 Preformatted initial line
18214 ==a==
18215 xxx
18216 !! end
18217
18218
18219 !! test
18220 Section extraction, heading followed by pre with 20 spaces (bug 6398)
18221 !! options
18222 section=1
18223 !! wikitext
18224 ==a==
18225 a
18226 !! html/php
18227 ==a==
18228 a
18229 !! end
18230
18231 !! test
18232 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
18233 !! options
18234 section=1
18235 !! wikitext
18236 ==a==
18237 a
18238 !! html/php
18239 ==a==
18240 a
18241 !! end
18242
18243
18244 !! test
18245 Section extraction, <pre> around bogus header (bug 10309)
18246 !! options
18247 section=2
18248 !! wikitext
18249 == Section One ==
18250 <pre>
18251 =======
18252 </pre>
18253
18254 == Section Two ==
18255 stuff
18256 !! html/php
18257 == Section Two ==
18258 stuff
18259 !! end
18260
18261 !! test
18262 Section replacement, <pre> around bogus header (bug 10309)
18263 !! options
18264 replace=2,"xxx"
18265 !! wikitext
18266 == Section One ==
18267 <pre>
18268 =======
18269 </pre>
18270
18271 == Section Two ==
18272 stuff
18273 !! html/php
18274 == Section One ==
18275 <pre>
18276 =======
18277 </pre>
18278
18279 xxx
18280 !! end
18281
18282
18283 !! test
18284 Handling of &#x0A; in URLs
18285 !! wikitext
18286 ** irc://&#x0A;a
18287 !! html/php
18288 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18289
18290 !! html/parsoid
18291 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
18292 a">irc://
18293 a</a></li></ul></li></ul>
18294 !! end
18295
18296 !! test
18297 Handling of %0A in URLs
18298 !! wikitext
18299 ** irc://%0Aa
18300 !! html/php
18301 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18302
18303 !! html/parsoid
18304 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18305 !! end
18306
18307
18308 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18309 !! test
18310 5 quotes, code coverage +1 line
18311 !! options
18312 parsoid=wt2html
18313 !! wikitext
18314 '''''
18315 !! html/php
18316 !! html/parsoid
18317 <p><b><i></i></b></p>
18318 !! end
18319
18320 # same html as previous, but wikitext adjusted to match parsoid html2wt
18321 # note that wt2html and html2html will put the <i> before the <b>
18322 !! test
18323 5 quotes, code coverage +1 line w/ nowiki (1)
18324 !! options
18325 parsoid=wt2wt,html2wt
18326 !! wikitext
18327 '''''<nowiki/>'''''
18328 !! html/php
18329 <p><i></i>
18330 </p>
18331 !! html/parsoid
18332 <p><b><i></i></b></p>
18333 !! end
18334
18335 # same as previous, just swapping the <i> and <b>
18336 !! test
18337 5 quotes, code coverage +1 line w/ nowiki (2)
18338 !! wikitext
18339 '''''<nowiki/>'''''
18340 !! html/php
18341 <p><i></i>
18342 </p>
18343 !! html/parsoid
18344 <p><i><b></b></i></p>
18345 !! end
18346
18347 !! test
18348 Special:Search page linking.
18349 !! wikitext
18350 {{Special:search}}
18351 !! html
18352 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18353 </p>
18354 !! end
18355
18356 !! test
18357 {{!}} is a magic word
18358 !! wikitext
18359 {{!}} is a magic word there and {{!}} is still a magic word here
18360 | is not a magic word here but {{!}} is still a magic word here
18361 !! html/php
18362 <p>| is a magic word there and | is still a magic word here
18363 | is not a magic word here but | is still a magic word here
18364 </p>
18365 !! html/parsoid
18366 <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
18367 | 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>
18368
18369 !! end
18370
18371 !! test
18372 Say the magic word
18373 !! options
18374 title=[[Parser test]]
18375 !! wikitext
18376 * {{PAGENAME}}
18377 * {{PAGENAMEE}}
18378 * {{FULLPAGENAME}}
18379 * {{FULLPAGENAMEE}}
18380 * {{BASEPAGENAME}}
18381 * {{BASEPAGENAMEE}}
18382 * {{SUBPAGENAME}}
18383 * {{SUBPAGENAMEE}}
18384 * {{ROOTPAGENAME}}
18385 * {{ROOTPAGENAMEE}}
18386 * {{TALKPAGENAME}}
18387 * {{TALKPAGENAMEE}}
18388 * {{SUBJECTPAGENAME}}
18389 * {{SUBJECTPAGENAMEE}}
18390 * {{NAMESPACEE}}
18391 * {{NAMESPACE}}
18392 * {{NAMESPACENUMBER}}
18393 * {{TALKSPACE}}
18394 * {{TALKSPACEE}}
18395 * {{SUBJECTSPACE}}
18396 * {{SUBJECTSPACEE}}
18397 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18398 !! html
18399 <ul><li> Parser test</li>
18400 <li> Parser_test</li>
18401 <li> Parser test</li>
18402 <li> Parser_test</li>
18403 <li> Parser test</li>
18404 <li> Parser_test</li>
18405 <li> Parser test</li>
18406 <li> Parser_test</li>
18407 <li> Parser test</li>
18408 <li> Parser_test</li>
18409 <li> Talk:Parser test</li>
18410 <li> Talk:Parser_test</li>
18411 <li> Parser test</li>
18412 <li> Parser_test</li>
18413 <li> </li>
18414 <li> </li>
18415 <li> 0</li>
18416 <li> Talk</li>
18417 <li> Talk</li>
18418 <li> </li>
18419 <li> </li>
18420 <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>
18421
18422 !! end
18423 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18424
18425 !! test
18426 Gallery
18427 !! wikitext
18428 <gallery>
18429 image1.png |
18430 image2.gif|||||
18431
18432 image3|
18433 image4 |300px| centre
18434 image5.svg| http://///////
18435 [[x|xx]]]]
18436 * image6
18437 </gallery>
18438 !! html
18439 <ul class="gallery mw-gallery-traditional">
18440 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18441 <div class="thumb" style="height: 150px;">Image1.png</div>
18442 <div class="gallerytext">
18443 </div>
18444 </div></li>
18445 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18446 <div class="thumb" style="height: 150px;">Image2.gif</div>
18447 <div class="gallerytext">
18448 </div>
18449 </div></li>
18450 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18451 <div class="thumb" style="height: 150px;">Image3</div>
18452 <div class="gallerytext">
18453 </div>
18454 </div></li>
18455 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18456 <div class="thumb" style="height: 150px;">Image4</div>
18457 <div class="gallerytext">
18458 <pre>centre
18459 </pre>
18460 </div>
18461 </div></li>
18462 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18463 <div class="thumb" style="height: 150px;">Image5.svg</div>
18464 <div class="gallerytext">
18465 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
18466 </p>
18467 </div>
18468 </div></li>
18469 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18470 <div class="thumb" style="height: 150px;">* image6</div>
18471 <div class="gallerytext">
18472 </div>
18473 </div></li>
18474 </ul>
18475
18476 !! end
18477
18478 !! test
18479 Gallery (with options)
18480 !! wikitext
18481 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
18482 File:Nonexistent.jpg|caption
18483 File:Nonexistent.jpg
18484 image:foobar.jpg|some '''caption''' [[Main Page]]
18485 image:foobar.jpg
18486 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
18487 </gallery>
18488 !! html
18489 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
18490 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
18491 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18492 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18493 <div class="gallerytext">
18494 <p>caption
18495 </p>
18496 </div>
18497 </div></li>
18498 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18499 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18500 <div class="gallerytext">
18501 </div>
18502 </div></li>
18503 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18504 <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>
18505 <div class="gallerytext">
18506 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18507 </p>
18508 </div>
18509 </div></li>
18510 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18511 <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>
18512 <div class="gallerytext">
18513 </div>
18514 </div></li>
18515 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18516 <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>
18517 <div class="gallerytext">
18518 <p>blabla.
18519 </p>
18520 </div>
18521 </div></li>
18522 </ul>
18523
18524 !! end
18525
18526 !! test
18527 Gallery with link that has fragment
18528 !! wikitext
18529 <gallery>
18530 image:foobar.jpg|link=Main_Page
18531 image:foobar.jpg|link=Main_Page#section
18532 image:foobar.jpg|link=Main Page#section|caption
18533 </gallery>
18534 !! html
18535 <ul class="gallery mw-gallery-traditional">
18536 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18537 <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>
18538 <div class="gallerytext">
18539 </div>
18540 </div></li>
18541 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18542 <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>
18543 <div class="gallerytext">
18544 </div>
18545 </div></li>
18546 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18547 <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>
18548 <div class="gallerytext">
18549 <p>caption
18550 </p>
18551 </div>
18552 </div></li>
18553 </ul>
18554
18555 !! end
18556
18557 !! test
18558 Gallery with wikitext inside caption
18559 !! wikitext
18560 <gallery>
18561 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
18562 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
18563 </gallery>
18564 !! html
18565 <ul class="gallery mw-gallery-traditional">
18566 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18567 <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>
18568 <div class="gallerytext">
18569 <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>
18570 </p>
18571 </div>
18572 </div></li>
18573 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18574 <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>
18575 <div class="gallerytext">
18576 <p>This is a test template
18577 </p>
18578 </div>
18579 </div></li>
18580 </ul>
18581
18582 !! end
18583
18584 !! test
18585 gallery (with showfilename option)
18586 !! wikitext
18587 <gallery showfilename>
18588 File:Nonexistent.jpg|caption
18589 File:Nonexistent.jpg
18590 image:foobar.jpg|some '''caption''' [[Main Page]]
18591 File:Foobar.jpg
18592 </gallery>
18593 !! html
18594 <ul class="gallery mw-gallery-traditional">
18595 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18596 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18597 <div class="gallerytext">
18598 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18599 caption
18600 </p>
18601 </div>
18602 </div></li>
18603 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18604 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18605 <div class="gallerytext">
18606 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18607 </p>
18608 </div>
18609 </div></li>
18610 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18611 <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>
18612 <div class="gallerytext">
18613 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18614 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18615 </p>
18616 </div>
18617 </div></li>
18618 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18619 <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>
18620 <div class="gallerytext">
18621 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18622 </p>
18623 </div>
18624 </div></li>
18625 </ul>
18626
18627 !! end
18628
18629 !! test
18630 Gallery (with namespace-less filenames)
18631 !! wikitext
18632 <gallery>
18633 File:Nonexistent.jpg
18634 Nonexistent.jpg
18635 image:foobar.jpg
18636 foobar.jpg
18637 </gallery>
18638 !! html
18639 <ul class="gallery mw-gallery-traditional">
18640 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18641 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18642 <div class="gallerytext">
18643 </div>
18644 </div></li>
18645 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18646 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18647 <div class="gallerytext">
18648 </div>
18649 </div></li>
18650 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18651 <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>
18652 <div class="gallerytext">
18653 </div>
18654 </div></li>
18655 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18656 <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>
18657 <div class="gallerytext">
18658 </div>
18659 </div></li>
18660 </ul>
18661
18662 !! end
18663
18664 !! test
18665 HTML Hex character encoding (spells the word "JavaScript")
18666 !! options
18667 parsoid=wt2html,wt2wt,html2html
18668 !! wikitext
18669 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
18670 !! html/php
18671 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
18672 </p>
18673 !! html/php+tidy
18674 <p>JavaScript</p>
18675 !! html/parsoid
18676 <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>
18677 !! end
18678
18679 !! test
18680 HTML Hex character encoding bogus encoding (bug 26437 regression check)
18681 !! wikitext
18682 &#xsee;&#XSEE;
18683 !! html/php
18684 <p>&amp;#xsee;&amp;#XSEE;
18685 </p>
18686 !! html/parsoid
18687 <p>&amp;#xsee;&amp;#XSEE;</p>
18688 !! end
18689
18690 !! test
18691 HTML Hex character encoding mixed case
18692 !! options
18693 parsoid=wt2html,wt2wt,html2html
18694 !! wikitext
18695 &#xEE;&#Xee;
18696 !! html/php
18697 <p>&#xee;&#xee;
18698 </p>
18699 !! html/php+tidy
18700 <p>îî</p>
18701 !! html/parsoid
18702 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
18703 !! end
18704
18705 # See: http://www.w3.org/TR/html5/syntax.html#character-references
18706 # Note that U+000C (form feed) is not a valid XML character, so
18707 # it is banned even though allowed in HTML5.
18708 !! test
18709 Illegal character references (T106578)
18710 !! wikitext
18711 ; Null: &#00;
18712 ; FF: &#xC;
18713 ; CR: &#xD;
18714 ; Control (low): &#8;
18715 ; Control (high): &#x7F; &#x9F;
18716 ; Surrogate: &#xD83D;&#xDCA9;
18717 ; This is an okay astral character: &#x1F4A9;
18718 !! html+tidy
18719 <dl>
18720 <dt>Null</dt>
18721 <dd>&amp;#00;</dd>
18722 <dt>FF</dt>
18723 <dd>&amp;#xC;</dd>
18724 <dt>CR</dt>
18725 <dd>&amp;#xD;</dd>
18726 <dt>Control (low)</dt>
18727 <dd>&amp;#8;</dd>
18728 <dt>Control (high)</dt>
18729 <dd>&amp;#x7F; &amp;#x9F;</dd>
18730 <dt>Surrogate</dt>
18731 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
18732 <dt>This is an okay astral character</dt>
18733 <dd>💩</dd>
18734 </dl>
18735 !! end
18736
18737 !! test
18738 __FORCETOC__ override
18739 !! wikitext
18740 __NEWSECTIONLINK__
18741 __FORCETOC__
18742 !! html/php
18743 <p><br />
18744 </p>
18745 !! end
18746
18747 !! test
18748 ISBN code coverage
18749 !! wikitext
18750 ISBN 978-0-1234-56&#x20;789
18751 !! html
18752 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
18753 </p>
18754 !! html+tidy
18755 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
18756 !! html/parsoid
18757 <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>
18758 !! end
18759
18760 !! test
18761 ISBN followed by 5 spaces
18762 !! wikitext
18763 ISBN
18764 !! html
18765 <p>ISBN
18766 </p>
18767 !! end
18768
18769 !! test
18770 Double ISBN
18771 !! wikitext
18772 ISBN ISBN 1234567890
18773 !! html/php
18774 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18775 </p>
18776 !! html/parsoid
18777 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
18778 !! end
18779
18780 # Uppercase X and lowercase x as well
18781 !! test
18782 ISBN with an X
18783 !! wikitext
18784 ISBN 3-462-04561-X
18785 ISBN 3-462-04561-x
18786 ISBN 080442957X
18787 ISBN 080442957x
18788 ISBN 978080442957X
18789 ISBN 978080442957x
18790 !! html/php
18791 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
18792 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
18793 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
18794 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
18795 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
18796 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
18797 </p>
18798 !! html/parsoid
18799 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
18800 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
18801 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
18802 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
18803 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
18804 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
18805 !! end
18806
18807 !! test
18808 ISBN with empty prefix (parsoid test)
18809 !! wikitext
18810 ISBN 1234567890
18811 !! html/php
18812 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18813 </p>
18814 !! html/parsoid
18815 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
18816 !! end
18817
18818 !! test
18819 Bug 22905: <abbr> followed by ISBN followed by </a>
18820 !! wikitext
18821 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
18822 !! html/php
18823 <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>
18824 </p>
18825 !! html/parsoid
18826 <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>
18827 !! end
18828
18829 !! test
18830 Double RFC
18831 !! wikitext
18832 RFC RFC 1234
18833 !! html
18834 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
18835 </p>
18836 !! end
18837
18838 !! test
18839 Double RFC with a wiki link
18840 !! wikitext
18841 RFC [[RFC 1234]]
18842 !! html
18843 <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>
18844 </p>
18845 !! end
18846
18847 !! test
18848 RFC code coverage
18849 !! wikitext
18850 RFC 983&#x20;987
18851 !! html
18852 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
18853 </p>
18854 !! html+tidy
18855 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
18856 !! end
18857
18858 !! test
18859 Centre-aligned image
18860 !! wikitext
18861 [[Image:foobar.jpg|centre]]
18862 !! html
18863 <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>
18864
18865 !!end
18866
18867 !! test
18868 None-aligned image
18869 !! wikitext
18870 [[Image:foobar.jpg|none]]
18871 !! html
18872 <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>
18873
18874 !!end
18875
18876 !! test
18877 Width + Height sized image (using px) (height is ignored)
18878 !! wikitext
18879 [[Image:foobar.jpg|640x480px]]
18880 !! html
18881 <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>
18882 </p>
18883 !!end
18884
18885 !! test
18886 Width-sized image (using px, no following whitespace)
18887 !! wikitext
18888 [[Image:foobar.jpg|640px]]
18889 !! html
18890 <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>
18891 </p>
18892 !!end
18893
18894 !! test
18895 Width-sized image (using px, with following whitespace - test regression from r39467)
18896 !! wikitext
18897 [[Image:foobar.jpg|640px ]]
18898 !! html
18899 <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>
18900 </p>
18901 !!end
18902
18903 !! test
18904 Width-sized image (using px, with preceding whitespace - test regression from r39467)
18905 !! wikitext
18906 [[Image:foobar.jpg| 640px]]
18907 !! html
18908 <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>
18909 </p>
18910 !!end
18911
18912 !! test
18913 Image with page parameter
18914 !! options
18915 djvu
18916 !! wikitext
18917 [[File:LoremIpsum.djvu|page=2]]
18918 !! html/php
18919 <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>
18920 </p>
18921 !! html/parsoid
18922 <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>
18923 !! end
18924
18925 !! test
18926 Another italics / bold test
18927 !! wikitext
18928 ''' ''x'
18929 !! html
18930 <pre>'<i> </i>x'
18931 </pre>
18932 !!end
18933
18934 # FIXME: The php output seems broken. It's interleaving some open/close tags.
18935 !! test
18936 dt/dd/dl test
18937 !! wikitext
18938 :;;;::
18939 !! html/php
18940 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
18941
18942 !! html/parsoid
18943 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
18944
18945 !!end
18946
18947
18948 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
18949 !! test
18950 Images with the "|" character in the comment
18951 !! wikitext
18952 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
18953 !! html/php
18954 <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>
18955
18956 !! html/parsoid
18957 <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>
18958 !! end
18959
18960 !! test
18961 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
18962 !! wikitext
18963 <html><script>alert(1);</script></html>
18964 !! html
18965 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
18966 </p>
18967 !! end
18968
18969 !! test
18970 HTML with raw HTML ($wgRawHtml==true)
18971 !! options
18972 wgRawHtml=1
18973 !! wikitext
18974 <html><script>alert(1);</script></html>
18975 !! html
18976 <p><script>alert(1);</script>
18977 </p>
18978 !! end
18979
18980 !! test
18981 Parents of subpages, one level up
18982 !! options
18983 subpage title=[[Subpage test/L1/L2/L3]]
18984 !! wikitext
18985 [[../|L2]]
18986 !! html
18987 <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>
18988 </p>
18989 !! end
18990
18991
18992 !! test
18993 Parents of subpages, one level up, not named
18994 !! options
18995 subpage title=[[Subpage test/L1/L2/L3]]
18996 !! wikitext
18997 [[../]]
18998 !! html
18999 <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>
19000 </p>
19001 !! end
19002
19003
19004
19005 !! test
19006 Parents of subpages, two levels up
19007 !! options
19008 subpage title=[[Subpage test/L1/L2/L3]]
19009 !! wikitext
19010 [[../../|L1]]2
19011
19012 [[../../|L1]]l
19013 !! html
19014 <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
19015 </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>
19016 </p>
19017 !! end
19018
19019 !! test
19020 Parents of subpages, two levels up, without trailing slash or name.
19021 !! options
19022 subpage title=[[Subpage test/L1/L2/L3]]
19023 !! wikitext
19024 [[../..]]
19025 !! html
19026 <p>[[../..]]
19027 </p>
19028 !! end
19029
19030 !! test
19031 Parents of subpages, two levels up, with lots of extra trailing slashes.
19032 !! options
19033 subpage title=[[Subpage test/L1/L2/L3]]
19034 !! wikitext
19035 [[../../////]]
19036 !! html
19037 <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>
19038 </p>
19039 !! end
19040
19041 !! article
19042 Subpage test/L1/L2/L3Sibling
19043 !! text
19044 Sibling article
19045 !! endarticle
19046
19047 !! test
19048 Transclusion of a sibling page (one level up)
19049 !! options
19050 subpage title=[[Subpage test/L1/L2/L3]]
19051 !! wikitext
19052 {{../L3Sibling}}
19053 !! html
19054 <p>Sibling article
19055 </p>
19056 !! end
19057
19058 !! test
19059 Transclusion of a child page
19060 !! options
19061 subpage title=[[Subpage test/L1/L2]]
19062 !! wikitext
19063 {{/L3Sibling}}
19064 !! html
19065 <p>Sibling article
19066 </p>
19067 !! end
19068
19069 !! test
19070 Non-transclusion because of too many up levels
19071 !! options
19072 subpage title=[[Subpage test/L1/L2/L3]]
19073 !! wikitext
19074 {{../../../../More than parent}}
19075 !! html
19076 <p>{{../../../../More than parent}}
19077 </p>
19078 !! end
19079
19080 !! test
19081 Definition list code coverage
19082 !! wikitext
19083 ; title : def
19084 ; title : def
19085 ;title: def
19086 !! html/php
19087 <dl><dt> title &#160;</dt>
19088 <dd> def</dd>
19089 <dt> title&#160;</dt>
19090 <dd> def</dd>
19091 <dt>title</dt>
19092 <dd> def</dd></dl>
19093
19094 !! html/parsoid
19095 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19096 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19097 <dt>title</dt><dd> def</dd></dl>
19098 !! end
19099
19100 !! test
19101 Don't fall for the self-closing div
19102 !! wikitext
19103 <div>hello world</div/>
19104 !! html
19105 <div>hello world</div>
19106
19107 !! end
19108
19109 !! test
19110 MSGNW magic word
19111 !! wikitext
19112 {{MSGNW:msg}}
19113 !! html/php
19114 <p>&#91;&#91;:Template:Msg&#93;&#93;
19115 </p>
19116 !! end
19117
19118 !! test
19119 RAW magic word
19120 !! wikitext
19121 {{RAW:QUERTY}}
19122 !! html
19123 <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>
19124 </p>
19125 !! end
19126
19127 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
19128 !! test
19129 Always escape literal '>' in output, not just after '<'
19130 !! wikitext
19131 ><>
19132 !! html
19133 <p>&gt;&lt;&gt;
19134 </p>
19135 !! end
19136
19137 !! test
19138 Template caching
19139 !! wikitext
19140 {{Test}}
19141 {{Test}}
19142 !! html
19143 <p>This is a test template
19144 This is a test template
19145 </p>
19146 !! end
19147
19148
19149 !! article
19150 MediaWiki:Fake
19151 !! text
19152 ==header==
19153 !! endarticle
19154
19155 !! test
19156 Inclusion of !userCanEdit() content
19157 !! wikitext
19158 {{MediaWiki:Fake}}
19159 !! html
19160 <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>
19161
19162 !! end
19163
19164
19165 !! test
19166 Out-of-order TOC heading levels
19167 !! wikitext
19168 ==2==
19169 ======6======
19170 ===3===
19171 =1=
19172 =====5=====
19173 ==2==
19174 !! html
19175 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19176 <ul>
19177 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
19178 <ul>
19179 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
19180 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
19181 </ul>
19182 </li>
19183 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
19184 <ul>
19185 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
19186 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
19187 </ul>
19188 </li>
19189 </ul>
19190 </div>
19191
19192 <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>
19193 <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>
19194 <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>
19195 <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>
19196 <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>
19197 <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>
19198
19199 !! end
19200
19201
19202 !! test
19203 ISBN with a dummy number
19204 !! wikitext
19205 ISBN ---
19206 !! html
19207 <p>ISBN ---
19208 </p>
19209 !! end
19210
19211
19212 !! test
19213 ISBN with space-delimited number
19214 !! wikitext
19215 ISBN 92 9017 032 8
19216 !! html
19217 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
19218 </p>
19219 !! end
19220
19221
19222 !! test
19223 ISBN with multiple spaces, no number
19224 !! wikitext
19225 ISBN foo
19226 !! html
19227 <p>ISBN foo
19228 </p>
19229 !! end
19230
19231
19232 !! test
19233 ISBN length
19234 !! wikitext
19235 ISBN 123456789
19236
19237 ISBN 1234567890
19238
19239 ISBN 12345678901
19240 !! html
19241 <p>ISBN 123456789
19242 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19243 </p><p>ISBN 12345678901
19244 </p>
19245 !! end
19246
19247
19248 !! test
19249 ISBN with trailing year (bug 8110)
19250 !! wikitext
19251 ISBN 1-234-56789-0 - 2006
19252
19253 ISBN 1 234 56789 0 - 2006
19254 !! html
19255 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
19256 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
19257 </p>
19258 !! end
19259
19260
19261 !! test
19262 anchorencode
19263 !! wikitext
19264 {{anchorencode:foo bar©#%n}}
19265 !! html
19266 <p>foo_bar.C2.A9.23.25n
19267 </p>
19268 !! end
19269
19270 !! test
19271 anchorencode trims spaces
19272 !! wikitext
19273 {{anchorencode: __pretty__please__}}
19274 !! html
19275 <p>pretty_please
19276 </p>
19277 !! end
19278
19279 !! test
19280 anchorencode deals with links
19281 !! wikitext
19282 {{anchorencode: [[hello|world]] [[hi]]}}
19283 !! html
19284 <p>world_hi
19285 </p>
19286 !! end
19287
19288 !! test
19289 anchorencode deals with templates
19290 !! wikitext
19291 {{anchorencode: {{Foo}} }}
19292 !! html
19293 <p>FOO
19294 </p>
19295 !! end
19296
19297 !! test
19298 anchorencode encodes like the TOC generator: (bug 18431)
19299 !! wikitext
19300 === _ +:.3A%3A&&amp;]] ===
19301 {{anchorencode: _ +:.3A%3A&&amp;]] }}
19302 __NOEDITSECTION__
19303 !! html
19304 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
19305 <p>.2B:.3A.253A.26.26.5D.5D
19306 </p>
19307 !! end
19308
19309 !! test
19310 Bug 6200: blockquotes and paragraph formatting
19311 !! wikitext
19312 <blockquote>
19313 foo
19314 </blockquote>
19315
19316 bar
19317
19318 baz
19319 !! html
19320 <blockquote>
19321 <p>foo
19322 </p>
19323 </blockquote>
19324 <p>bar
19325 </p>
19326 <pre>baz
19327 </pre>
19328 !! end
19329
19330 !! test
19331 Bug 8293: Use of center tag ruins paragraph formatting
19332 !! wikitext
19333 <center>
19334 foo
19335 </center>
19336
19337 bar
19338
19339 baz
19340 !! html
19341 <center>
19342 <p>foo
19343 </p>
19344 </center>
19345 <p>bar
19346 </p>
19347 <pre>baz
19348 </pre>
19349 !! end
19350
19351 !!test
19352 Parsing of overlapping (improperly nested) inline html tags
19353 !! wikitext
19354 <span><s>x</span></s>
19355 !! html/php
19356 <p><span><s>x&lt;/span&gt;</s></span>
19357 </p>
19358 !! html/parsoid
19359 <p><span><s>x</s></span>
19360 </p>
19361 !!end
19362
19363 ###
19364 ### Language variants related tests
19365 ###
19366 !! test
19367 Self-link in language variants
19368 !! options
19369 title=[[Dunav]] language=sr
19370 !! wikitext
19371 Both [[Dunav]] and [[Дунав]] are names for this river.
19372 !! html
19373 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
19374 </p>
19375 !!end
19376
19377 !! article
19378 Дуна
19379 !! text
19380 content
19381 !! endarticle
19382
19383 !! test
19384 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
19385 !! options
19386 title=[[Duna]] language=sr
19387 !! wikitext
19388 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
19389 !! html
19390 <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.
19391 </p>
19392 !! end
19393
19394 !! test
19395 Link to a section of a variant of this title shouldn't be parsed as self-link
19396 !! options
19397 title=[[Duna]] language=sr
19398 !! wikitext
19399 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
19400 !! html
19401 <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.
19402 </p>
19403 !! end
19404
19405 !! test
19406 Link to pages in language variants
19407 !! options
19408 language=sr
19409 !! wikitext
19410 Main Page can be written as [[Маин Паге]]
19411 !! html
19412 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
19413 </p>
19414 !!end
19415
19416
19417 !! test
19418 Multiple links to pages in language variants
19419 !! options
19420 language=sr
19421 !! wikitext
19422 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
19423 !! html
19424 <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>.
19425 </p>
19426 !!end
19427
19428
19429 !! test
19430 Simple template in language variants
19431 !! options
19432 language=sr
19433 !! wikitext
19434 {{тест}}
19435 !! html
19436 <p>This is a test template
19437 </p>
19438 !! end
19439
19440
19441 !! test
19442 Template with explicit namespace in language variants
19443 !! options
19444 language=sr
19445 !! wikitext
19446 {{Template:тест}}
19447 !! html
19448 <p>This is a test template
19449 </p>
19450 !! end
19451
19452
19453 !! test
19454 Basic test for template parameter in language variants
19455 !! options
19456 language=sr
19457 !! wikitext
19458 {{парамтест|param=foo}}
19459 !! html
19460 <p>This is a test template with parameter foo
19461 </p>
19462 !! end
19463
19464
19465 !! test
19466 Simple category in language variants
19467 !! options
19468 language=sr cat
19469 !! wikitext
19470 [[Category:МедиаWики Усер'с Гуиде]]
19471 !! html
19472 <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>
19473 !! end
19474
19475
19476 !! article
19477 Category:分类
19478 !! text
19479 blah
19480 !! endarticle
19481
19482 !! article
19483 Category:分類
19484 !! text
19485 blah
19486 !! endarticle
19487
19488 ## We used to, but no longer wt2wt this test since the default serializer
19489 ## will normalize all categories to serialize on their own line.
19490 ## This wikitext usage is going to be fairly uncommon in production and
19491 ## selser will take care of preserving formatting in those scenarios.
19492 !! test
19493 Don't convert blue categorylinks to another variant (bug 33210)
19494 !! options
19495 cat
19496 language=zh
19497 parsoid=wt2html
19498 !! wikitext
19499 [[A]][[Category:分类]]
19500 !! html/php
19501 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
19502 !! html/parsoid
19503 <p><a rel="mw:WikiLink" href="A" title="A">A</a></p>
19504 <link rel="mw:PageProp/Category" href="Category:分类"/>
19505 !! end
19506
19507 !! test
19508 Stripping -{}- tags (language variants)
19509 !! options
19510 language=sr
19511 !! wikitext
19512 Latin proverb: -{Ne nuntium necare}-
19513 !! html
19514 <p>Latin proverb: Ne nuntium necare
19515 </p>
19516 !! end
19517
19518
19519 !! test
19520 Prevent conversion with -{}- tags (language variants)
19521 !! options
19522 language=sr variant=sr-ec
19523 !! wikitext
19524 Latinski: -{Ne nuntium necare}-
19525 !! html
19526 <p>Латински: Ne nuntium necare
19527 </p>
19528 !! end
19529
19530
19531 !! test
19532 Prevent conversion of text with -{}- tags (language variants)
19533 !! options
19534 language=sr variant=sr-ec
19535 !! wikitext
19536 Latinski: -{Ne nuntium necare}-
19537 !! html
19538 <p>Латински: Ne nuntium necare
19539 </p>
19540 !! end
19541
19542
19543 !! test
19544 Prevent conversion of links with -{}- tags (language variants)
19545 !! options
19546 language=sr variant=sr-ec
19547 !! wikitext
19548 -{[[Main Page]]}-
19549 !! html
19550 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19551 </p>
19552 !! end
19553
19554
19555 !! test
19556 -{}- tags within headlines (within html for parserConvert())
19557 !! options
19558 language=sr variant=sr-ec
19559 !! wikitext
19560 == -{Naslov}- ==
19561 !! html
19562 <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>
19563
19564 !! end
19565
19566
19567 !! test
19568 Explicit definition of language variant alternatives
19569 !! options
19570 language=zh variant=zh-tw
19571 !! wikitext
19572 -{zh:China;zh-tw:Taiwan}-, not China
19573 !! html
19574 <p>Taiwan, not China
19575 </p>
19576 !! end
19577
19578
19579 !! test
19580 Conversion around HTML tags
19581 !! options
19582 language=sr variant=sr-ec
19583 !! wikitext
19584 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
19585 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
19586 !! html
19587 <p>
19588 <span title="ЛаCтин">ски</span>
19589 </p>
19590 !! end
19591
19592
19593 !! test
19594 Explicit session-wise language variant mapping (A flag and - flag)
19595 !! options
19596 language=zh variant=zh-tw
19597 !! wikitext
19598 Taiwan is not China.
19599 But -{A|zh:China;zh-tw:Taiwan}- is China,
19600 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
19601 and -{China}- is China.
19602 !! html
19603 <p>Taiwan is not China.
19604 But Taiwan is Taiwan,
19605 (This should be stripped!)
19606 and China is China.
19607 </p>
19608 !! end
19609
19610 !! test
19611 Explicit session-wise language variant mapping (H flag for hide)
19612 !! options
19613 language=zh variant=zh-tw
19614 !! wikitext
19615 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
19616 Taiwan is China.
19617 !! html
19618 <p>(This should be stripped!)
19619 Taiwan is Taiwan.
19620 </p>
19621 !! end
19622
19623 !! test
19624 Adding explicit conversion rule for title (T flag)
19625 !! options
19626 language=zh variant=zh-tw showtitle
19627 !! wikitext
19628 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19629 !! html
19630 Taiwan
19631 <p>Should be stripped!
19632 </p>
19633 !! end
19634
19635 !! test
19636 Testing that changing the language variant here in the tests actually works
19637 !! options
19638 language=zh variant=zh showtitle
19639 !! wikitext
19640 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19641 !! html
19642 China
19643 <p>Should be stripped!
19644 </p>
19645 !! end
19646
19647 !! test
19648 Recursive conversion of alt and title attrs shouldn't clear converter state
19649 !! options
19650 language=zh variant=zh-cn showtitle
19651 !! wikitext
19652 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
19653 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
19654 !! html
19655 China
19656 <p>
19657 Should be stripped<span title="Exclamation">!</span>
19658 </p>
19659 !! end
19660
19661 !! test
19662 Bug 24072: more test on conversion rule for title
19663 !! options
19664 language=zh variant=zh-tw showtitle
19665 !! wikitext
19666 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19667 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
19668 !! html
19669 Taiwan
19670 <p>This should be stripped!
19671 This won't take interferes with the title rule.
19672 </p>
19673 !! end
19674
19675 !! test
19676 Partly disable title conversion if variant == main language code
19677 !! options
19678 language=zh variant=zh title=[[ZH]] showtitle
19679 !! wikitext
19680 -{T|zh-cn:CN;zh-tw:TW}-
19681 !! html
19682 ZH
19683 <p>
19684 </p>
19685 !! end
19686
19687 !! test
19688 Partly disable title conversion if variant == main language code, more
19689 !! options
19690 language=zh variant=zh title=[[ZH]] showtitle
19691 !! wikitext
19692 -{T|TW}-
19693 !! html
19694 ZH
19695 <p>
19696 </p>
19697 !! end
19698
19699 !! test
19700 Raw output of variant escape tags (R flag)
19701 !! options
19702 language=zh variant=zh-tw
19703 !! wikitext
19704 Raw: -{R|zh:China;zh-tw:Taiwan}-
19705 !! html
19706 <p>Raw: zh:China;zh-tw:Taiwan
19707 </p>
19708 !! end
19709
19710 !! test
19711 Strings evaluating false shouldn't be ignored by Language converter (T51072)
19712 !! options
19713 language=zh variant=zh-cn
19714 !! input
19715 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
19716 !! result
19717 <p>0
19718 </p>
19719 !! end
19720
19721 !! test
19722 Conversion rules from [numeric-only string] to [something else] (T48634)
19723 !! options
19724 language=zh variant=zh-cn
19725 !! input
19726 -{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
19727 !! result
19728 <p>D12345EE12345
19729 </p>
19730 !! end
19731
19732 !! test
19733 Bidirectional converter rule entries with an empty value should be ignored (T53551)
19734 !! options
19735 language=zh variant=zh-cn
19736 !! input
19737 -{H|zh-cn:foo;zh-tw:;}-foobar
19738 !! result
19739 <p>foobar
19740 </p>
19741 !! end
19742
19743 !! test
19744 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
19745 !! options
19746 language=zh variant=zh-cn
19747 !! input
19748 -{H|=>zh-cn:foo;}-foobar
19749 !! result
19750 <p>foobar
19751 </p>
19752 !! end
19753
19754 !! test
19755 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
19756 !! options
19757 language=zh variant=zh-cn
19758 !! input
19759 -{H|}-foobar
19760 !! result
19761 <p>foobar
19762 </p>
19763 !! end
19764
19765 !! test
19766 Nested using of manual convert syntax
19767 !! options
19768 language=zh variant=zh-hk
19769 !! wikitext
19770 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
19771 !! html
19772 <p>Nested: Hello Hong Kong!
19773 </p>
19774 !! end
19775
19776 !! test
19777 Proper conversion of text in external links
19778 !! options
19779 language=sr variant=sr-ec
19780 !! wikitext
19781 http://www.google.com
19782 gopher://www.google.com
19783 [http://www.google.com http://www.google.com]
19784 [gopher://www.google.com gopher://www.google.com]
19785 [https://www.google.com irc://www.google.com]
19786 [ftp://www.google.com www.google.com/ftp://dir]
19787 [//www.google.com www.google.com]
19788 !! html
19789 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19790 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19791 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19792 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19793 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
19794 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
19795 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
19796 </p>
19797 !! end
19798
19799 !! test
19800 Do not convert roman numbers to language variants
19801 !! options
19802 language=sr variant=sr-ec
19803 !! wikitext
19804 Fridrih IV je car.
19805 !! html
19806 <p>Фридрих IV је цар.
19807 </p>
19808 !! end
19809
19810 !! test
19811 Unclosed language converter markup "-{"
19812 !! options
19813 language=sr
19814 !! wikitext
19815 -{T|hello
19816 !! html
19817 <p>-{T|hello
19818 </p>
19819 !! end
19820
19821 !! test
19822 Don't convert raw rule "-{R|=&gt;}-" to "=>"
19823 !! options
19824 language=sr
19825 !! wikitext
19826 -{R|=&gt;}-
19827 !! html
19828 <p>=&gt;
19829 </p>
19830 !!end
19831
19832 !! test
19833 Don't break link parsing if language converter markup is in the caption.
19834 !! options
19835 language=sr variant=sr-ec
19836 !! wikitext
19837 [[Main Page|-{R|main page}-]]
19838 !! html
19839 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
19840 </p>
19841 !! end
19842
19843 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19844 !! test
19845 Don't break image parsing if language converter markup is in the caption.
19846 !! options
19847 language=sr
19848 !! wikitext
19849 [[File:Foobar.jpg|-{R|caption}-]]
19850 !! html/parsoid
19851 <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>
19852 </p>
19853 !! end
19854
19855 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19856 !! test
19857 Don't break list handling if language converter markup is in the item.
19858 !! options
19859 language=zh variant=zh-cn
19860 !! wikitext
19861 ;-{zh-cn:AAA;zh-tw:BBB}-
19862 !! html/php
19863 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
19864
19865 !! html/parsoid
19866 <dl><dt>AAA
19867 </dt></dl>
19868 !! end
19869
19870 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19871 !! test
19872 Don't break table handling if language converter markup is in the cell.
19873 !! options
19874 language=sr variant=sr-ec
19875 !! wikitext
19876 {|
19877 |-
19878 | -{R|B}-
19879 |}
19880 !! html/php
19881 <table>
19882
19883 <tr>
19884 <td>Б}-
19885 </td></tr></table>
19886
19887 !! html/parsoid
19888 <table>
19889
19890 <tr>
19891 <td> B
19892 </td></tr></table>
19893
19894 !! end
19895
19896 !! test
19897 Bug 529: Uncovered bullet
19898 !! wikitext
19899 * Foo {{bullet}}
19900 !! html
19901 <ul><li> Foo </li>
19902 <li> Bar</li></ul>
19903
19904 !! end
19905
19906 # Plain MediaWiki does not remove empty lists, but tidy actually does.
19907 # Templates in Wikipedia rely on this behavior, as tidy has always been
19908 # enabled there. These tests are normally run *without* tidy, so specify the
19909 # full output here.
19910 # To test realistic parsing behavior, apply a tidy-like transformation to both
19911 # the expected output and your parser's output.
19912 !! test
19913 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
19914 !! wikitext
19915 ******* Foo {{bullet}}
19916 !! html
19917 <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>
19918 <li> Bar</li></ul>
19919
19920 !! end
19921
19922 !! test
19923 Bug 529: Uncovered table already at line-start
19924 !! wikitext
19925 x
19926
19927 {{table}}
19928 y
19929 !! html
19930 <p>x
19931 </p>
19932 <table>
19933 <tr>
19934 <td> 1 </td>
19935 <td> 2
19936 </td></tr>
19937 <tr>
19938 <td> 3 </td>
19939 <td> 4
19940 </td></tr></table>
19941 <p>y
19942 </p>
19943 !! end
19944
19945 !! test
19946 Bug 529: Uncovered bullet in parser function result
19947 !! wikitext
19948 * Foo {{lc:{{bullet}} }}
19949 !! html
19950 <ul><li> Foo </li>
19951 <li> bar</li></ul>
19952
19953 !! end
19954
19955 !! test
19956 Bug 5678: Double-parsed template argument
19957 !! wikitext
19958 {{lc:{{{1}}}|hello}}
19959 !! html
19960 <p>{{{1}}}
19961 </p>
19962 !! end
19963
19964 !! test
19965 Bug 5678: Double-parsed template invocation
19966 !! wikitext
19967 {{lc:{{paramtest {{!}} param = hello }} }}
19968 !! html
19969 <p>{{paramtest | param = hello }}
19970 </p>
19971 !! end
19972
19973 !! test
19974 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
19975 !! options
19976 language=cs
19977 title=[[Main Page]]
19978 !! wikitext
19979 {{PRVNÍVELKÉ:ěščř}}
19980 {{prvnívelké:ěščř}}
19981 {{PRVNÍMALÉ:ěščř}}
19982 {{prvnímalé:ěščř}}
19983 {{MALÁ:ěščř}}
19984 {{malá:ěščř}}
19985 {{VELKÁ:ěščř}}
19986 {{velká:ěščř}}
19987 !! html
19988 <p>Ěščř
19989 Ěščř
19990 ěščř
19991 ěščř
19992 ěščř
19993 ěščř
19994 ĚŠČŘ
19995 ĚŠČŘ
19996 </p>
19997 !! end
19998
19999 !! test
20000 Morwen/13: Unclosed link followed by heading
20001 !! wikitext
20002 [[link
20003 ==heading==
20004 !! html
20005 <p>[[link
20006 </p>
20007 <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>
20008
20009 !! end
20010
20011 !! test
20012 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
20013 !! wikitext
20014 {{foo|
20015 =heading=
20016 !! html
20017 <p>{{foo|
20018 </p>
20019 <h1><span class="mw-headline" id="heading">heading</span></h1>
20020
20021 !! end
20022
20023 !! test
20024 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
20025 !! wikitext
20026 {{foo|
20027 ==heading==
20028 !! html
20029 <p>{{foo|
20030 </p>
20031 <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>
20032
20033 !! end
20034
20035 !! test
20036 Tildes in comments
20037 !! options
20038 pst
20039 !! wikitext
20040 <!-- ~~~~ -->
20041 !! html/php
20042 <!-- ~~~~ -->
20043 !! end
20044
20045 !! test
20046 Paragraphs inside divs (no extra line breaks)
20047 !! wikitext
20048 <div>Line one
20049
20050 Line two</div>
20051 !! html
20052 <div>Line one
20053 Line two</div>
20054
20055 !! end
20056
20057 !! test
20058 Paragraphs inside divs (extra line break on open)
20059 !! wikitext
20060 <div>
20061 Line one
20062
20063 Line two</div>
20064 !! html
20065 <div>
20066 <p>Line one
20067 </p>
20068 Line two</div>
20069
20070 !! end
20071
20072 !! test
20073 Paragraphs inside divs (extra line break on close)
20074 !! wikitext
20075 <div>Line one
20076
20077 Line two
20078 </div>
20079 !! html
20080 <div>Line one
20081 <p>Line two
20082 </p>
20083 </div>
20084
20085 !! end
20086
20087 !! test
20088 Paragraphs inside divs (extra line break on open and close)
20089 !! wikitext
20090 <div>
20091 Line one
20092
20093 Line two
20094 </div>
20095 !! html
20096 <div>
20097 <p>Line one
20098 </p><p>Line two
20099 </p>
20100 </div>
20101
20102 !! end
20103
20104 !! test
20105 Nesting tags, paragraphs on lines which begin with <div>
20106 !! wikitext
20107 <div></div><strong>A
20108 B</strong>
20109 !! html/php+tidy
20110 <p><strong>A</strong></p>
20111 <p><strong>B</strong></p>
20112 !! html/parsoid
20113 <div></div>
20114 <p><strong>A
20115 B</strong>
20116 </p>
20117 !! end
20118
20119 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
20120 !! test
20121 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
20122 !! wikitext
20123 <blockquote>Line one
20124
20125 Line two</blockquote>
20126 !! html
20127 <blockquote>Line one
20128 Line two</blockquote>
20129
20130 !! html+tidy
20131 <blockquote>
20132 <p>Line one Line two</p>
20133 </blockquote>
20134 !! end
20135
20136 !! test
20137 Bug 6200: paragraphs inside blockquotes (extra line break on open)
20138 !! wikitext
20139 <blockquote>
20140 Line one
20141
20142 Line two</blockquote>
20143 !! html
20144 <blockquote>
20145 <p>Line one
20146 </p>
20147 Line two</blockquote>
20148
20149 !! html+tidy
20150 <blockquote>
20151 <p>Line one</p>
20152 Line two</blockquote>
20153 !! end
20154
20155 !! test
20156 Bug 6200: paragraphs inside blockquotes (extra line break on close)
20157 !! wikitext
20158 <blockquote>Line one
20159
20160 Line two
20161 </blockquote>
20162 !! html
20163 <blockquote>Line one
20164 <p>Line two
20165 </p>
20166 </blockquote>
20167
20168 !! html+tidy
20169 <blockquote>
20170 <p>Line one</p>
20171 <p>Line two</p>
20172 </blockquote>
20173 !! end
20174
20175 !! test
20176 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
20177 !! wikitext
20178 <blockquote>
20179 Line one
20180
20181 Line two
20182 </blockquote>
20183 !! html
20184 <blockquote>
20185 <p>Line one
20186 </p><p>Line two
20187 </p>
20188 </blockquote>
20189
20190 !! html+tidy
20191 <blockquote>
20192 <p>Line one</p>
20193 <p>Line two</p>
20194 </blockquote>
20195 !! end
20196
20197 !! test
20198 Paragraphs inside blockquotes/divs (no extra line breaks)
20199 !! wikitext
20200 <blockquote><div>Line one
20201
20202 Line two</div></blockquote>
20203 !! html
20204 <blockquote><div>Line one
20205 Line two</div></blockquote>
20206
20207 !! end
20208
20209 !! test
20210 Paragraphs inside blockquotes/divs (extra line break on open)
20211 !! wikitext
20212 <blockquote><div>
20213 Line one
20214
20215 Line two</div></blockquote>
20216 !! html
20217 <blockquote><div>
20218 <p>Line one
20219 </p>
20220 Line two</div></blockquote>
20221
20222 !! end
20223
20224 !! test
20225 Paragraphs inside blockquotes/divs (extra line break on close)
20226 !! wikitext
20227 <blockquote><div>Line one
20228
20229 Line two
20230 </div></blockquote>
20231 !! html
20232 <blockquote><div>Line one
20233 <p>Line two
20234 </p>
20235 </div></blockquote>
20236
20237 !! end
20238
20239 !! test
20240 Paragraphs inside blockquotes/divs (extra line break on open and close)
20241 !! wikitext
20242 <blockquote><div>
20243 Line one
20244
20245 Line two
20246 </div></blockquote>
20247 !! html
20248 <blockquote><div>
20249 <p>Line one
20250 </p><p>Line two
20251 </p>
20252 </div></blockquote>
20253
20254 !! end
20255
20256 !! test
20257 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
20258 !! options
20259 wgLinkHolderBatchSize=0
20260 !! wikitext
20261 [[meatball:1]]
20262 [[meatball:2]]
20263 [[meatball:3]]
20264 !! html
20265 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
20266 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
20267 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
20268 </p>
20269 !! end
20270
20271 !! test
20272 Free external link invading image caption
20273 !! wikitext
20274 [[Image:Foobar.jpg|thumb|http://x|hello]]
20275 !! html
20276 <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>
20277
20278 !! end
20279
20280 !! test
20281 Bug 15196: localised external link numbers
20282 !! options
20283 language=fa
20284 !! wikitext
20285 [http://en.wikipedia.org/]
20286 !! html/php
20287 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
20288 </p>
20289 !! html/parsoid
20290 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
20291 !! end
20292
20293 !! test
20294 Multibyte character in padleft
20295 !! wikitext
20296 {{padleft:-Hello|7|Æ}}
20297 !! html
20298 <p>Æ-Hello
20299 </p>
20300 !! end
20301
20302 !! test
20303 Multibyte character in padright
20304 !! wikitext
20305 {{padright:Hello-|7|Æ}}
20306 !! html
20307 <p>Hello-Æ
20308 </p>
20309 !! end
20310
20311 !!test
20312 formatdate parser function
20313 !! wikitext
20314 {{#formatdate:2009-03-24}}
20315 !! html
20316 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
20317 </p>
20318 !! end
20319
20320 !!test
20321 formatdate parser function, with default format
20322 !! wikitext
20323 {{#formatdate:2009-03-24|mdy}}
20324 !! html
20325 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
20326 </p>
20327 !! end
20328
20329 !! test
20330 Spacing of numbers in formatted dates
20331 !! wikitext
20332 {{#formatdate:January 15}}
20333 !! html
20334 <p><span class="mw-formatted-date" title="01-15">January 15</span>
20335 </p>
20336 !! end
20337
20338 !! test
20339 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
20340 !! options
20341 language=nl title=[[MediaWiki:Common.css]]
20342 !! wikitext
20343 {{#formatdate:2009-03-24|dmy}}
20344 !! html
20345 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
20346 </p>
20347 !! end
20348
20349 #
20350 #
20351 #
20352
20353 #
20354 # Edit comments
20355 #
20356
20357 !! test
20358 Edit comment with link
20359 !! options
20360 comment
20361 !! wikitext
20362 I like the [[Main Page]] a lot
20363 !! html/php
20364 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
20365 !!end
20366
20367 !! test
20368 Edit comment with link and link text
20369 !! options
20370 comment
20371 !! wikitext
20372 I like the [[Main Page|best pages]] a lot
20373 !! html/php
20374 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20375 !!end
20376
20377 !! test
20378 Edit comment with link and link text with suffix
20379 !! options
20380 comment
20381 !! wikitext
20382 I like the [[Main Page|best page]]s a lot
20383 !! html/php
20384 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20385 !!end
20386
20387 !! test
20388 Edit comment with section link (non-local, eg in history list)
20389 !! options
20390 comment title=[[Main Page]]
20391 !! wikitext
20392 /* External links */ removed bogus entries
20393 !! html/php
20394 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20395 !!end
20396
20397 !! test
20398 Edit comment with section link and text before it (non-local, eg in history list)
20399 !! options
20400 comment title=[[Main Page]]
20401 !! wikitext
20402 pre-comment text /* External links */ removed bogus entries
20403 !! html/php
20404 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>
20405 !!end
20406
20407 !! test
20408 Edit comment with section link (local, eg in diff view)
20409 !! options
20410 comment local title=[[Main Page]]
20411 !! wikitext
20412 /* External links */ removed bogus entries
20413 !! html/php
20414 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20415 !!end
20416
20417 !! test
20418 Edit comment with subpage link (bug 14080)
20419 !! options
20420 comment
20421 subpage
20422 title=[[Subpage test]]
20423 !! wikitext
20424 Poked at a [[/subpage]] here...
20425 !! html/php
20426 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
20427 !!end
20428
20429 !! test
20430 Edit comment with subpage link and link text (bug 14080)
20431 !! options
20432 comment
20433 subpage
20434 title=[[Subpage test]]
20435 !! wikitext
20436 Poked at a [[/subpage|neat little page]] here...
20437 !! html/php
20438 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
20439 !!end
20440
20441 !! test
20442 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
20443 !! options
20444 comment
20445 title=[[Subpage test]]
20446 !! wikitext
20447 Poked at a [[/subpage]] here...
20448 !! html/php
20449 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...
20450 !!end
20451
20452 !! test
20453 Edit comment with bare anchor link (local, as on diff)
20454 !! options
20455 comment
20456 local
20457 title=[[Main Page]]
20458 !! wikitext
20459 [[#section]]
20460 !! html/php
20461 <a href="#section">#section</a>
20462 !! end
20463
20464 !! test
20465 Edit comment with bare anchor link (non-local, as on history)
20466 !! options
20467 comment
20468 title=[[Main Page]]
20469 !! wikitext
20470 [[#section]]
20471 !! html/php
20472 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
20473 !! end
20474
20475 !! test
20476 Anchor starting with underscore
20477 !! options
20478 title=[[Foo]]
20479 !! wikitext
20480 [[#_ref|One]]
20481 !! html/php
20482 <p><a href="#_ref">One</a>
20483 </p>
20484 !! html/parsoid
20485 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
20486 !! end
20487
20488 !! test
20489 Id starting with underscore
20490 !! wikitext
20491 <div id="_ref"></div>
20492 !! html/*
20493 <div id="_ref"></div>
20494
20495 !! end
20496
20497 !! test
20498 Space normalisation on autocomment (bug 22784)
20499 !! options
20500 comment
20501 title=[[Main Page]]
20502 !! wikitext
20503 /* __hello__world__ */
20504 !! html/php
20505 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
20506 !! end
20507
20508 !! test
20509 percent-encoding and + signs in comments (Bug 26410)
20510 !! options
20511 comment
20512 !! wikitext
20513 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
20514 !! html/php
20515 <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>
20516 !! end
20517
20518 # Parsoid doesn't support this yet: see bug 73581
20519 # but it *should* omit the 'src' attribute if the image is bad.
20520 # PHP side of tests was disabled in
20521 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
20522 # because of issues in the PHP parserTests infrastructure
20523 # (but the output below is indeed what the PHP side emits)
20524 !! test
20525 Bad images - basic functionality
20526 !! wikitext
20527 [[File:Bad.jpg]]
20528 !! DISABLED/html/php
20529 !! html/parsoid
20530 <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>
20531 !! end
20532
20533 !! test
20534 Bad images - bug 16039: text after bad image disappears
20535 !! wikitext
20536 Foo bar
20537 [[File:Bad.jpg]]
20538 Bar foo
20539 !! DISABLED/html/php
20540 <p>Foo bar
20541 </p><p>Bar foo
20542 </p>
20543 !! html/parsoid
20544 <p>Foo bar
20545 <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>
20546 Bar foo</p>
20547 !! end
20548
20549 !! test
20550 Verify that displaytitle works (bug #22501) no displaytitle
20551 !! options
20552 showtitle
20553 !! config
20554 wgAllowDisplayTitle=true
20555 wgRestrictDisplayTitle=false
20556 !! wikitext
20557 this is not the the title
20558 !! html/php
20559 Parser test
20560 <p>this is not the the title
20561 </p>
20562 !! end
20563
20564 !! test
20565 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
20566 !! options
20567 showtitle
20568 title=[[Screen]]
20569 !! config
20570 wgAllowDisplayTitle=true
20571 wgRestrictDisplayTitle=false
20572 !! wikitext
20573 this is not the the title
20574 {{DISPLAYTITLE:whatever}}
20575 !! html/php
20576 whatever
20577 <p>this is not the the title
20578 </p>
20579 !! end
20580
20581 !! test
20582 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
20583 !! options
20584 showtitle
20585 title=[[Screen]]
20586 !! config
20587 wgAllowDisplayTitle=true
20588 wgRestrictDisplayTitle=true
20589 !! wikitext
20590 this is not the the title
20591 {{DISPLAYTITLE:whatever}}
20592 !! html/php
20593 Screen
20594 <p>this is not the the title
20595 </p>
20596 !! end
20597
20598 !! test
20599 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
20600 !! options
20601 showtitle
20602 title=[[Screen]]
20603 !! config
20604 wgAllowDisplayTitle=true
20605 wgRestrictDisplayTitle=true
20606 !! wikitext
20607 this is not the the title
20608 {{DISPLAYTITLE:screen}}
20609 !! html/php
20610 screen
20611 <p>this is not the the title
20612 </p>
20613 !! end
20614
20615 !! test
20616 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
20617 !! options
20618 showtitle
20619 title=[[Screen]]
20620 !! config
20621 wgAllowDisplayTitle=false
20622 !! wikitext
20623 this is not the the title
20624 {{DISPLAYTITLE:screen}}
20625 !! html/php
20626 Screen
20627 <p>this is not the the title
20628 <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>
20629 </p>
20630 !! end
20631
20632 !! test
20633 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
20634 !! options
20635 showtitle
20636 title=[[Screen]]
20637 !! config
20638 wgAllowDisplayTitle=false
20639 !! wikitext
20640 this is not the the title
20641 !! html/php
20642 Screen
20643 <p>this is not the the title
20644 </p>
20645 !! end
20646
20647 !! test
20648 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
20649 !! options
20650 showtitle
20651 title=[[Screen]]
20652 !! config
20653 wgAllowDisplayTitle=true
20654 wgRestrictDisplayTitle=true
20655 !! wikitext
20656 this is not the the title
20657 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
20658 !! html/php
20659 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
20660 <p>this is not the the title
20661 </p>
20662 !! end
20663
20664 !! test
20665 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
20666 !! options
20667 showtitle
20668 title=[[Screen]]
20669 !! config
20670 wgAllowDisplayTitle=true
20671 wgRestrictDisplayTitle=true
20672 !! wikitext
20673 this is not the the title
20674 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
20675 !! html/php
20676 <span style="color: red;">s</span>creen
20677 <p>this is not the the title
20678 </p>
20679 !! end
20680
20681 !! test
20682 Page status indicators: Empty name is invalid
20683 !! options
20684 showindicators
20685 !! wikitext
20686 <indicator name=" "></indicator>
20687 <indicator></indicator>
20688 !! html
20689 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20690 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20691 </p>
20692 !! end
20693
20694 !! test
20695 Page status indicators: Weird syntaxes that are okay
20696 !! options
20697 showindicators
20698 !! wikitext
20699 <indicator name="empty" />
20700 <indicator name="name"></indicator>
20701 !! html
20702 empty=
20703 name=
20704 <p><br />
20705 </p>
20706 !! end
20707
20708 !! test
20709 Page status indicators: Torture test
20710 !! options
20711 showindicators
20712 !! wikitext
20713 <indicator name="01">hello world</indicator>
20714 <indicator name="02">[[Main Page]]</indicator>
20715 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
20716 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
20717 <indicator name="05">* foo
20718 * bar</indicator>
20719 <indicator name="06"><nowiki>foo</nowiki></indicator>
20720 <indicator name="07"> Preformatted</indicator>
20721 <indicator name="08"><div>Broken tag</indicator>
20722 <indicator name="09">{| class=wikitable
20723 | cell
20724 |}</indicator>
20725 <indicator name="10">Two
20726
20727 paragraphs</indicator>
20728 !! html
20729 01=hello world
20730 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20731 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" />
20732 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>
20733 05=<ul><li> foo</li>
20734 <li> bar</li></ul>
20735
20736 06=foo
20737 07=<pre>Preformatted
20738 </pre>
20739 08=<div>Broken tag</div>
20740
20741 09=<table class="wikitable">
20742 <tr>
20743 <td> cell
20744 </td></tr></table>
20745
20746 10=<p>Two
20747 </p><p>paragraphs
20748 </p>
20749 <p><br />
20750 </p><p><br />
20751 </p><p><br />
20752 </p><p><br />
20753 </p><p><br />
20754 </p>
20755 !! end
20756
20757 !! test
20758 preload: check <noinclude> and <includeonly>
20759 !! options
20760 preload
20761 !! wikitext
20762 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
20763 !! html/php
20764 Hello kind world.
20765 !! end
20766
20767 !! test
20768 preload: check <onlyinclude>
20769 !! options
20770 preload
20771 !! wikitext
20772 Goodbye <onlyinclude>Hello world</onlyinclude>
20773 !! html/php
20774 Hello world
20775 !! end
20776
20777 !! test
20778 preload: can pass tags through if we want to
20779 !! options
20780 preload
20781 !! wikitext
20782 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
20783 !! html/php
20784 <includeonly>Hello world</includeonly>
20785 !! end
20786
20787 !! test
20788 preload: check that it doesn't try to do tricks
20789 !! options
20790 preload
20791 !! wikitext
20792 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20793 !! html/php
20794 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20795 !! end
20796
20797 !! test
20798 Play a bit with r67090 and bug 3158
20799 !! wikitext
20800 <div style="width:50% !important">&nbsp;</div>
20801 <div style="width:50%&nbsp;!important">&nbsp;</div>
20802 <div style="width:50%&#160;!important">&nbsp;</div>
20803 <div style="border : solid;">&nbsp;</div>
20804 !! html/php
20805 <div style="width:50% !important">&#160;</div>
20806 <div style="width:50% !important">&#160;</div>
20807 <div style="width:50% !important">&#160;</div>
20808 <div style="border&#160;: solid;">&#160;</div>
20809
20810 !! html/parsoid
20811 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20812 <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>
20813 <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>
20814 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20815
20816 !! end
20817
20818 !! test
20819 HTML5 data attributes
20820 !! wikitext
20821 <span data-foo="bar">Baz</span>
20822 <p data-abc-def_hij="">Quuz</p>
20823 !! html/php
20824 <p><span data-foo="bar">Baz</span>
20825 </p>
20826 <p data-abc-def_hij="">Quuz</p>
20827
20828 !! html/parsoid
20829 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
20830 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
20831 !! end
20832
20833 !! test
20834 Strip reserved data attributes
20835 !! wikitext
20836 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
20837 !! html/php
20838 <div data-ok="fred">d</div>
20839
20840 !! html/parsoid
20841 <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>
20842 !! end
20843
20844 !! test
20845 percent-encoding and + signs in internal links (Bug 26410)
20846 !! wikitext
20847 [[User:+%]] [[Page+title%]]
20848 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
20849 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
20850 [[%33%45]] [[%33%45+]]
20851 !! html/php
20852 <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>
20853 <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>
20854 <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>
20855 <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>
20856 </p>
20857 !! html/parsoid
20858 <p><a rel="mw:WikiLink" href="./User:+%25" title="User:+%">User:+%</a> <a rel="mw:WikiLink" href="Page+title%25" title="Page+title%">Page+title%</a>
20859 <a rel="mw:WikiLink" href="%25+" title="%+">%+</a> <a rel="mw:WikiLink" href="%25+" title="%+">%20</a> <a rel="mw:WikiLink" href="%25+" title="%+">%+ </a> <a rel="mw:WikiLink" href="%25+r" title="%+r">%+r</a>
20860 <a rel="mw:WikiLink" href="%25" title="%">%</a> <a rel="mw:WikiLink" href="+" title="+">+</a> <span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"bogus","ak":"foo"},{"ck":"caption","ak":"[[bar]]"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;a rel=\"mw:WikiLink\" href=\"./Bar\" title=\"Bar\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;simple&amp;quot;,&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;./Bar&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;bar&amp;quot;},&amp;quot;dsr&amp;quot;:[94,101,2,2]}\">bar&lt;/a>"}'><a href="./File:%25+abc9"><img resource="./File:%25+abc9" src="./Special:FilePath/%25+abc9" height="220" width="220" data-parsoid='{"a":{"resource":"./File:%25+abc9","height":"220","width":"220"},"sa":{"resource":"File:%+abc%39"}}'/></a></span>
20861 <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>
20862 !! end
20863
20864 !! test
20865 Special characters in embedded file links (bug 27679)
20866 !! wikitext
20867 [[File:Contains & ampersand.jpg]]
20868 [[File:Does not exist.jpg|Title with & ampersand]]
20869 !! html/php
20870 <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>
20871 <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>
20872 </p>
20873 !! html/parsoid
20874 <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>
20875 <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>
20876 !! end
20877
20878 !! test
20879 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
20880 !! wikitext
20881 Text&apos;s been normalized?
20882 !! html
20883 <p>Text&#39;s been normalized?
20884 </p>
20885 !! end
20886
20887 !! test
20888 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
20889 !! wikitext
20890 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
20891 !! html
20892 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
20893 </p>
20894 !! end
20895
20896 !! test
20897 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
20898 !! wikitext
20899 [http://www.example.org/ ideograms]
20900 !! html
20901 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
20902 </p>
20903 !! end
20904
20905 !! test
20906 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
20907 !! wikitext
20908 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
20909 !! html
20910 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
20911 </p>
20912 !! end
20913
20914 !! article
20915 Mediawiki:loop1
20916 !! text
20917 {{Identical|A}}
20918 !! endarticle
20919
20920 !! article
20921 Mediawiki:loop2
20922 !! text
20923 {{Identical|B}}
20924 !! endarticle
20925
20926 !! article
20927 Template:Identical
20928 !! text
20929 {{int:loop1}}
20930 {{int:loop2}}
20931 !! endarticle
20932
20933 !! test
20934 Bug 31098 Template which includes system messages which includes the template
20935 !! wikitext
20936 {{Identical}}
20937 !! html
20938 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20939 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20940 </p>
20941 !! end
20942
20943 !! test
20944 Bug31490 Turkish: ucfirst 'blah'
20945 !! options
20946 language=tr
20947 !! wikitext
20948 {{ucfirst:blah}}
20949 !! html
20950 <p>Blah
20951 </p>
20952 !! end
20953
20954 !! test
20955 Bug31490 Turkish: ucfirst 'ix'
20956 !! options
20957 language=tr
20958 !! wikitext
20959 {{ucfirst:ix}}
20960 !! html
20961 <p>İx
20962 </p>
20963 !! end
20964
20965 !! test
20966 Bug31490 Turkish: lcfirst 'BLAH'
20967 !! options
20968 language=tr
20969 !! wikitext
20970 {{lcfirst:BLAH}}
20971 !! html
20972 <p>bLAH
20973 </p>
20974 !! end
20975
20976 !! test
20977 Bug31490 Turkish: ucfırst (with a dotless i)
20978 !! options
20979 language=tr
20980 !! wikitext
20981 {{ucfırst:blah}}
20982 !! html
20983 <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>
20984 </p>
20985 !! end
20986
20987 !! test
20988 Bug31490 ucfırst (with a dotless i) with English language
20989 !! options
20990 language=en
20991 !! wikitext
20992 {{ucfırst:blah}}
20993 !! html
20994 <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>
20995 </p>
20996 !! end
20997
20998 !! test
20999 Bug 26375: TOC with italics
21000 !! options
21001 title=[[Main Page]]
21002 !! wikitext
21003 __TOC__
21004 == ''Lost'' episodes ==
21005 !! html
21006 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21007 <ul>
21008 <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>
21009 </ul>
21010 </div>
21011
21012 <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>
21013
21014 !! end
21015
21016 !! test
21017 Bug 26375: TOC with bold
21018 !! options
21019 title=[[Main Page]]
21020 !! wikitext
21021 __TOC__
21022 == '''should be bold''' then normal text ==
21023 !! html
21024 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21025 <ul>
21026 <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>
21027 </ul>
21028 </div>
21029
21030 <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>
21031
21032 !! end
21033
21034 !! test
21035 Bug 33845: Headings become cursive in TOC when they contain an image
21036 !! options
21037 title=[[Main Page]]
21038 !! wikitext
21039 __TOC__
21040 == Image [[Image:foobar.jpg]] ==
21041 !! html
21042 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21043 <ul>
21044 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
21045 </ul>
21046 </div>
21047
21048 <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>
21049
21050 !! end
21051
21052 !! test
21053 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
21054 !! options
21055 title=[[Main Page]]
21056 !! wikitext
21057 __TOC__
21058 == <blockquote>Quote</blockquote> ==
21059 !! html
21060 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21061 <ul>
21062 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21063 </ul>
21064 </div>
21065
21066 <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>
21067
21068 !! html+tidy
21069 <p></p>
21070 <div id="toc" class="toc">
21071 <div id="toctitle">
21072 <h2>Contents</h2>
21073 </div>
21074 <ul>
21075 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21076 </ul>
21077 </div>
21078 <p></p>
21079 <h2><span class="mw-headline" id="Quote"></span></h2>
21080 <blockquote>
21081 <p><span class="mw-headline" id="Quote">Quote</span></p>
21082 </blockquote>
21083 <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>
21084 !! end
21085
21086 !! test
21087 Unclosed tags in TOC
21088 !! options
21089 title=[[Main Page]]
21090 !! wikitext
21091 __TOC__
21092 == Proof: 2 < 3 ==
21093 <small>Hanc marginis exiguitas non caperet.</small>
21094 QED
21095 !! html
21096 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21097 <ul>
21098 <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>
21099 </ul>
21100 </div>
21101
21102 <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>
21103 <p><small>Hanc marginis exiguitas non caperet.</small>
21104 QED
21105 </p>
21106 !! end
21107
21108 !! test
21109 Multiple tags in TOC
21110 !! wikitext
21111 __TOC__
21112 == <i>Foo</i> <b>Bar</b> ==
21113
21114 == <i>Foo</i> <blockquote>Bar</blockquote> ==
21115 !! html
21116 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21117 <ul>
21118 <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>
21119 <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>
21120 </ul>
21121 </div>
21122
21123 <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>
21124 <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>
21125
21126 !! html+tidy
21127 <p></p>
21128 <div id="toc" class="toc">
21129 <div id="toctitle">
21130 <h2>Contents</h2>
21131 </div>
21132 <ul>
21133 <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>
21134 <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>
21135 </ul>
21136 </div>
21137 <p></p>
21138 <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>
21139 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
21140 <blockquote>
21141 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
21142 </blockquote>
21143 <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>
21144 !! end
21145
21146 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
21147 # html5 tag parsing.
21148 !! test
21149 Tags with parameters in TOC
21150 !! options
21151 parsoid=wt2html
21152 !! wikitext
21153 __TOC__
21154 == <sup class="in-h2">Hello</sup> ==
21155
21156 == <sup class="a > b">Evilbye</sup> ==
21157 !! html/php
21158 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21159 <ul>
21160 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
21161 <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>
21162 </ul>
21163 </div>
21164
21165 <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>
21166 <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>
21167
21168 !! html/parsoid
21169 <meta property="mw:PageProp/toc" />
21170 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
21171
21172 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
21173 !! end
21174
21175 !! test
21176 span tags with directionality in TOC
21177 !! wikitext
21178 __TOC__
21179 == <span dir="ltr">C++</span> ==
21180
21181 == <span dir="rtl">זבנג!</span> ==
21182
21183 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
21184
21185 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
21186
21187 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
21188 !! html
21189 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21190 <ul>
21191 <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>
21192 <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>
21193 <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>
21194 <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>
21195 <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>
21196 </ul>
21197 </div>
21198
21199 <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>
21200 <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>
21201 <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>
21202 <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>
21203 <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>
21204
21205 !! end
21206
21207 !! test
21208 Bug 72884: bdi element in ToC
21209 !! wikitext
21210 __TOC__
21211 == <bdi>test</bdi> ==
21212 !! html
21213 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21214 <ul>
21215 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
21216 </ul>
21217 </div>
21218
21219 <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>
21220
21221 !! end
21222
21223 # Note that the html output does not have the <p></p>, but the
21224 # html+tidy output *does*. This is because the empty <p></p> is
21225 # removed by the sanitizer, but only when tidy is *not* enabled (!).
21226 !! test
21227 Empty <p> tag in TOC, removed by Sanitizer (T92892)
21228 !! wikitext
21229 __TOC__
21230 == x ==
21231 !! html
21232 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21233 <ul>
21234 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21235 </ul>
21236 </div>
21237
21238 <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>
21239
21240 !! html+tidy
21241 <p></p>
21242 <div id="toc" class="toc">
21243 <div id="toctitle">
21244 <h2>Contents</h2>
21245 </div>
21246 <ul>
21247 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21248 </ul>
21249 </div>
21250 <p></p>
21251 <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>
21252 !! end
21253
21254 !! article
21255 MediaWiki:Bug32057
21256 !! text
21257 == {{int:headline_sample}} ==
21258 !! endarticle
21259
21260 !! test
21261 Bug 32057: Title needed when expanding <h> nodes.
21262 !! options
21263 title=[[Main Page]]
21264 !! wikitext
21265 {{int:Bug32057}}
21266 !! html
21267 <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>
21268
21269 !! end
21270
21271 !! test
21272 Strip marker in urlencode
21273 !! wikitext
21274 {{urlencode:x<nowiki/>y}}
21275 {{urlencode:x<nowiki/>y|wiki}}
21276 {{urlencode:x<nowiki/>y|path}}
21277 {{urlencode:x<pre id="one">two</pre>y}}
21278 !! html
21279 <p>xy
21280 xy
21281 xy
21282 xy
21283 </p>
21284 !! end
21285
21286 !! test
21287 Strip marker in lc
21288 !! wikitext
21289 {{lc:x<nowiki/>y}}
21290 !! html
21291 <p>xy
21292 </p>
21293 !! end
21294
21295 !! test
21296 Strip marker in uc
21297 !! wikitext
21298 {{uc:x<nowiki/>y}}
21299 !! html
21300 <p>XY
21301 </p>
21302 !! end
21303
21304 !! test
21305 Strip marker in formatNum
21306 !! wikitext
21307 {{formatnum:1<nowiki/>2}}
21308 {{formatnum:1<nowiki/>2|R}}
21309 !! html
21310 <p>12
21311 12
21312 </p>
21313 !! end
21314
21315 !! test
21316 Check noCommafy in formatNum
21317 !! options
21318 language=be-tarask
21319 !! wikitext
21320 {{formatnum:123456.78}}
21321 {{formatnum:123456.78|NOSEP}}
21322 !! html
21323 <p>123 456,78
21324 123456.78
21325 </p>
21326 !! end
21327
21328 !! test
21329 Wrong option for formatNum (bug 56199)
21330 !! wikitext
21331 {{formatnum:1,234.56|Random}}
21332 {{formatnum:1,234.56|EVERYTHING}}
21333 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
21334 !! html
21335 <p>1,234.56
21336 1,234.56
21337 1,234.56
21338 </p>
21339 !! end
21340
21341 !! test
21342 Strip marker in grammar
21343 !! options
21344 language=fi
21345 !! wikitext
21346 {{grammar:elative|foo<nowiki/>bar}}
21347 !! html
21348 <p>foobarista
21349 </p>
21350 !! end
21351
21352 !! test
21353 Strip marker in padleft
21354 !! wikitext
21355 {{padleft:|2|x<nowiki/>y}}
21356 !! html
21357 <p>xy
21358 </p>
21359 !! end
21360
21361 !! test
21362 Strip marker in padright
21363 !! wikitext
21364 {{padright:|2|x<nowiki/>y}}
21365 !! html
21366 <p>xy
21367 </p>
21368 !! end
21369
21370 !! test
21371 Strip marker in anchorencode
21372 !! wikitext
21373 {{anchorencode:x<nowiki/>y}}
21374 !! html
21375 <p>xy
21376 </p>
21377 !! end
21378
21379 !! test
21380 nowiki inside link inside heading (bug 18295)
21381 !! wikitext
21382 ==[[foo|x<nowiki>y</nowiki>z]]==
21383 !! html
21384 <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>
21385
21386 !! end
21387
21388 !! test
21389 new support for bdi element (bug 31817)
21390 !! wikitext
21391 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21392 !! html
21393 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21394
21395 !!end
21396
21397 !! test
21398 Ignore pipe between table row attributes
21399 !! wikitext
21400 {|
21401 | quux
21402 |- id=foo | style='color: red'
21403 | bar
21404 |}
21405 !! html
21406 <table>
21407 <tr>
21408 <td> quux
21409 </td></tr>
21410 <tr id="foo" style="color: red">
21411 <td> bar
21412 </td></tr></table>
21413
21414 !! end
21415
21416 !!test
21417 Gallery override link with WikiLink (bug 34852)
21418 !! wikitext
21419 <gallery>
21420 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
21421 </gallery>
21422 !! html
21423 <ul class="gallery mw-gallery-traditional">
21424 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21425 <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>
21426 <div class="gallerytext">
21427 <p>caption
21428 </p>
21429 </div>
21430 </div></li>
21431 </ul>
21432
21433 !! end
21434
21435 !!test
21436 Gallery override link with absolute external link (bug 34852)
21437 !! wikitext
21438 <gallery>
21439 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21440 </gallery>
21441 !! html
21442 <ul class="gallery mw-gallery-traditional">
21443 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21444 <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>
21445 <div class="gallerytext">
21446 <p>caption
21447 </p>
21448 </div>
21449 </div></li>
21450 </ul>
21451
21452 !! end
21453
21454 !!test
21455 Gallery override link with malicious javascript (bug 34852)
21456 !! wikitext
21457 <gallery>
21458 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21459 </gallery>
21460 !! html
21461 <ul class="gallery mw-gallery-traditional">
21462 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21463 <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>
21464 <div class="gallerytext">
21465 <p>caption
21466 </p>
21467 </div>
21468 </div></li>
21469 </ul>
21470
21471 !! end
21472
21473 !!test
21474 Gallery with invalid title as link (bug 43964)
21475 !! wikitext
21476 <gallery>
21477 File:foobar.jpg|link=<
21478 </gallery>
21479 !! html
21480 <ul class="gallery mw-gallery-traditional">
21481 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21482 <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>
21483 <div class="gallerytext">
21484 </div>
21485 </div></li>
21486 </ul>
21487
21488 !! end
21489
21490 !!test
21491 Language parser function
21492 !! wikitext
21493 {{#language:ar}}
21494 !! html
21495 <p>العربية
21496 </p>
21497 !! end
21498
21499 !!test
21500 Padleft and padright as substr
21501 !! wikitext
21502 {{padleft:|3|abcde}}
21503 {{padright:|3|abcde}}
21504 !! html
21505 <p>abc
21506 abc
21507 </p>
21508 !! end
21509
21510 !!test
21511 Special parser function
21512 !! wikitext
21513 {{#special:RandomPage}}
21514 {{#special:BaDtItLe}}
21515 {{#special:Foobar}}
21516 !! html
21517 <p>Special:Random
21518 Special:Badtitle
21519 Special:Foobar
21520 </p>
21521 !! end
21522
21523 !!test
21524 Bug 34939 - Case insensitive link parsing ([HttP://])
21525 !! wikitext
21526 [HttP://MediaWiki.Org/]
21527 !! html/php
21528 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
21529 </p>
21530 !! html/parsoid
21531 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
21532 !! end
21533
21534 !!test
21535 Bug 34939 - Case insensitive link parsing ([HttP:// title])
21536 !! wikitext
21537 [HttP://MediaWiki.Org/ MediaWiki]
21538 !! html
21539 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
21540 </p>
21541 !! end
21542
21543 !!test
21544 Bug 34939 - Case insensitive link parsing (HttP://)
21545 !! wikitext
21546 HttP://MediaWiki.Org/
21547 !! html/php
21548 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
21549 </p>
21550 !! html/parsoid
21551 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
21552 !! end
21553
21554 !!test
21555 Disable TOC
21556 !! options
21557 notoc
21558 !! wikitext
21559 Lead
21560 == Section 1 ==
21561 == Section 2 ==
21562 == Section 3 ==
21563 == Section 4 ==
21564 == Section 5 ==
21565 !! html
21566 <p>Lead
21567 </p>
21568
21569 <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>
21570 <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>
21571 <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>
21572 <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>
21573 <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>
21574
21575 !! end
21576
21577
21578 ###
21579 ### Parsoid-specific tests
21580 ### Parsoid-PHP parser incompatibilities
21581 ###
21582 !!test
21583 1. SOL-sensitive wikitext tokens as template-args
21584 !!options
21585 parsoid=wt2html,wt2wt
21586 !! wikitext
21587 {{echo|*a}}
21588 {{echo|#a}}
21589 {{echo|:a}}
21590 !! html
21591 <span about="#mwt1" typeof="mw:Transclusion">
21592 </span><ul about="#mwt1"><li>a</li>
21593 </ul>
21594 <span about="#mwt2" typeof="mw:Transclusion">
21595 </span><ol about="#mwt2"><li>a</li>
21596 </ol>
21597 <span about="#mwt3" typeof="mw:Transclusion">
21598 </span><dl about="#mwt3"><dd>a</dd>
21599 </dl>
21600 !!end
21601
21602 #### -----------------------------------------------------------------
21603 #### Parsoid-specific functionality tests
21604 #### -----------------------------------------------------------------
21605
21606 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
21607 # We know wt2wt will fail, but we expect selser to pass.
21608 # Due to the nature of our testing, wt2wt and selser tests will enter the
21609 # blacklist and we'll catch selser regressions based on changes to the
21610 # blacklist entries for selser tests.
21611 !! test
21612 1. Bad treebuilder fixup of formatting elt is cleaned up
21613 !! options
21614 parsoid=wt2html,wt2wt
21615 !! wikitext
21616 {|
21617 |
21618 <small>
21619 [[Image:Foobar.jpg|right|Test]]
21620 </small>
21621 |}
21622 !! html/parsoid
21623 <table>
21624 <tbody><tr><td>
21625 <small>
21626 <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>
21627 </small>
21628 </td></tr>
21629 </tbody></table>
21630 !! end
21631
21632 !! test
21633 2. Bad treebuilder fixup of formatting elt is cleaned up
21634 !! options
21635 parsoid=wt2html,wt2wt
21636 !! wikitext
21637 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
21638
21639 <small>[[Image:Foobar.jpg|right|300px]]</small>
21640 !! html/parsoid
21641
21642 <p><b>foo</b></p>
21643 <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>
21644 <p><b>bar</b></p>
21645 <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>
21646 !! end
21647
21648 !! test
21649 3. Bad treebuilder fixup of formatting elt is cleaned up
21650 !! options
21651 parsoid=wt2html,wt2wt
21652 !! wikitext
21653 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
21654 !! html/parsoid
21655 <p><small><b>foo</b></small></p>
21656 <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>
21657 <p><small><b>bar</b></small></p>
21658 !! end
21659
21660 !! test
21661 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
21662 !! options
21663 parsoid=wt2html,wt2wt
21664 !! wikitext
21665 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
21666 !! html/parsoid
21667 <p><b><small></small></b></p>
21668 <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>
21669 <p></p>
21670 !! end
21671
21672 #### ----------------------------------------------------------------
21673 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
21674 #### tags. Parsoid's output for these tags differs from that of the
21675 #### PHP parser.
21676 #### ----------------------------------------------------------------
21677
21678 !!test
21679 Ref: 1. ref-location should be replaced with an index span
21680 !! wikitext
21681 A <ref>foo</ref>
21682 B <ref name="x">foo</ref>
21683 C <ref name="y" />
21684 <references />
21685 !! html/parsoid
21686 <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>
21687 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>
21688 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>
21689 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21690 <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>
21691 <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>
21692 <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>
21693 </ol>
21694 !!end
21695
21696 !!test
21697 Ref: 2. ref-tags with identical names should all get the same index
21698 !! wikitext
21699 A <ref name="x">foo</ref>
21700 B <ref name="x" />
21701 <references />
21702 !! html/parsoid
21703 <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>
21704 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>
21705 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21706 <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>
21707 </ol>
21708 !!end
21709
21710 !!test
21711 Ref: 3. spaces in ref-names should be ignored
21712 !! wikitext
21713 A <ref name="x">foo</ref>
21714 B <ref name=" x " />
21715 C <ref name= x />
21716 <references />
21717 !! html/parsoid
21718 <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>
21719 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>
21720 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>
21721 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21722 <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>
21723 </ol>
21724 !!end
21725
21726 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
21727 !!test
21728 Ref: 4. 'constructor' should be accepted as a valid ref-name
21729 !! wikitext
21730 A <ref name="constructor">foo</ref>
21731 <references />
21732 !! html/parsoid
21733 <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>
21734 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21735 <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>
21736 </ol>
21737 !!end
21738
21739 !!test
21740 Ref: 5. body should accept generic wikitext
21741 !! wikitext
21742 A <ref>
21743 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
21744 </ref>
21745
21746 <references />
21747 !! html/parsoid
21748 <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>
21749
21750 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21751 <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>
21752 </span></li>
21753 </ol>
21754 !!end
21755
21756 !!test
21757 Ref: 6. indent-pres should not be output in ref-body
21758 !! wikitext
21759 A <ref>
21760 foo
21761 bar
21762 baz
21763 </ref>
21764
21765 <references />
21766 !! html/parsoid
21767 <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>
21768
21769 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21770 <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
21771 bar
21772 baz
21773 </span></li>
21774 </ol>
21775 !!end
21776
21777 !!test
21778 Ref: 7. No p-wrapping in ref-body
21779 !! wikitext
21780 A <ref>
21781 foo
21782
21783 bar
21784
21785
21786 baz
21787
21788
21789
21790 booz
21791 </ref>
21792
21793 <references />
21794 !! html/parsoid
21795 <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>
21796
21797 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21798 <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
21799
21800 bar
21801
21802
21803 baz
21804
21805
21806
21807 booz
21808 </span></li>
21809 </ol>
21810 !!end
21811
21812 !!test
21813 Ref: 8. transclusion wikitext has lower precedence
21814 !! wikitext
21815 A <ref> foo {{echo|</ref> B C}}
21816
21817 <references />
21818 !! html/parsoid
21819 <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>
21820 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21821 <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>
21822 </ol>
21823 !!end
21824
21825 !!test
21826 Ref: 9. unclosed comments should not leak out of ref-body
21827 !! wikitext
21828 A <ref> foo <!--</ref> B C
21829 <references />
21830 !! html/parsoid
21831 <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>
21832 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21833 <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>
21834 </ol>
21835 !!end
21836
21837 !!test
21838 Ref: 10. Unclosed HTML tags should not leak out of ref-body
21839 !! wikitext
21840 A <ref> <b> foo </ref> B C
21841
21842 <references />
21843 !! html/parsoid
21844 <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>
21845
21846
21847 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21848 <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>
21849 </ol>
21850 !!end
21851
21852 !!test
21853 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
21854 !! wikitext
21855 A <ref>foo</ref> B
21856 C <ref>bar</ref> D
21857 <references />
21858 !! html/parsoid
21859 <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
21860 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>
21861 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21862 <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>
21863 <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>
21864 </ol>
21865 !!end
21866
21867 !!test
21868 Ref: 12. ref-tags act as trailing newline migration barrier
21869 !! wikitext
21870 <!--the newline at the end of this line moves out of the p tag-->a
21871
21872 b<!--the newline at the end of this line stays inside the p tag--> <ref />
21873 <ref />
21874
21875 c
21876 <references />
21877 !! html/parsoid
21878 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
21879
21880
21881 <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>
21882 <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>
21883
21884 <p>c</p>
21885 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21886 <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>
21887 <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>
21888 !!end
21889
21890 !!test
21891 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
21892 !! wikitext
21893 <ref>foo</ref> A
21894 <ref>bar
21895 </ref> B
21896 <references />
21897 !! html/parsoid
21898 <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
21899 <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>
21900 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21901 <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>
21902 <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
21903 </span></li>
21904 </ol>
21905 !!end
21906
21907 !!test
21908 Ref: 14. A nested ref-tag should be emitted as plain text
21909 !! wikitext
21910 <ref>foo <ref>bar</ref> baz</ref>
21911
21912 <references />
21913 !! html/parsoid
21914 <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>
21915 </p>
21916 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21917 <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>
21918 </ol>
21919 !!end
21920
21921 !!test
21922 Ref: 15. ref-tags with identical names should get identical indexes
21923 !! wikitext
21924 A1 <ref name="a">foo</ref> A2 <ref name="a" />
21925 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
21926
21927 <references />
21928 !! html/parsoid
21929 <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>
21930 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>
21931
21932 <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>
21933 </ol>
21934 !!end
21935
21936 ## We don't bother wt2wt-ing non-standard whitespace
21937 !!test
21938 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
21939 !!options
21940 parsoid=wt2html
21941 !! wikitext
21942 A <ref >foo</ref >
21943
21944 <references />
21945 !! html/parsoid
21946 <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>
21947 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21948 <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>
21949 !!end
21950
21951 !!test
21952 Ref: 17. Generate valid HTML5 id/about attributes
21953 !!wikitext
21954 <ref name="a b">foo</ref>
21955
21956 <references />
21957 !!html/parsoid
21958 <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>
21959 </p>
21960
21961 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21962 <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>
21963 </ol>
21964 !!end
21965
21966 !!test
21967 Ref: 18. T58916: Extension attributes should be parsed as plain text
21968 !!wikitext
21969 <ref name="{{echo|a}}">foo</ref>
21970
21971 <references />
21972 !!html/parsoid
21973 <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>
21974 </p>
21975
21976 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21977 <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>
21978 </ol>
21979 !!end
21980
21981 !!test
21982 Ref: 19. ref-tags with identical name encodings should get identical indexes
21983 !! wikitext
21984 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
21985
21986 <references />
21987 !! html/parsoid
21988 <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>
21989 </p>
21990 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21991 <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>
21992 </ol>
21993 !!end
21994
21995 !!test
21996 Ref: 20. ref-tags with identical names but different content should keep it
21997 !! wikitext
21998 A <ref name="foo">Foo one</ref>
21999 B <ref name="foo">Foo two</ref>
22000 C <ref name="foo" />
22001
22002 <references />
22003 !! html/parsoid
22004 <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>
22005 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>
22006 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>
22007
22008 <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>
22009 </ol>
22010 !!end
22011
22012 !!test
22013 References: 1. references tag without any refs should be handled properly
22014 !! wikitext
22015 <references />
22016 !! html/parsoid
22017 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22018 !!end
22019
22020 !!test
22021 References: 2. references tag with group only outputs references from that group
22022 !! wikitext
22023 A <ref group="a">foo</ref>
22024 B <ref group="b">bar</ref>
22025 C <ref>baz</ref>
22026
22027 <references group="a" />
22028 <references />
22029 <references group="b" />
22030 !! html/parsoid
22031 <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>
22032 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>
22033 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>
22034
22035 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
22036 <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>
22037 </ol>
22038 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
22039 <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>
22040 </ol>
22041 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
22042 <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>
22043 </ol>
22044 !!end
22045
22046 !!test
22047 References: 3. ref list should be cleared after processing references
22048 !! wikitext
22049 A <ref>foo</ref>
22050
22051 <references />
22052
22053 B <ref>bar</ref>
22054
22055 <references />
22056 !! html/parsoid
22057 <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>
22058
22059 <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>
22060 </ol>
22061
22062 <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>
22063
22064 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22065 <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>
22066 </ol>
22067 !!end
22068
22069 !!test
22070 References: 4. only referenced group should be cleared after processing references
22071 !! wikitext
22072 A <ref group="a">afoo</ref>
22073 B <ref>bfoo</ref>
22074
22075 <references group="a" />
22076
22077 C <ref>cfoo</ref>
22078
22079 <references />
22080 !! html/parsoid
22081 <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>
22082 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>
22083
22084 <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>
22085 </ol>
22086
22087 <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>
22088
22089 <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>
22090 </ol>
22091 !!end
22092
22093 ## Don't expect this to rt since we're dropping content
22094 !! test
22095 References: 5. ref tags in references should be processed while ignoring all other content
22096 !! options
22097 parsoid=wt2html,html2html
22098 !! wikitext
22099 A <ref name="a" />
22100 B <ref name="b">bar</ref>
22101
22102 <references>
22103 <ref name="a">foo</ref>
22104 This should just get lost.
22105 </references>
22106 !! html/parsoid
22107 <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>
22108 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>
22109
22110
22111 <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;\">&lt;span class=\"mw-reflink-text\">[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>
22112 </ol>
22113 !! end
22114
22115 !! test
22116 References: 6. <references /> from a transclusion
22117 !! wikitext
22118 <ref>Foo</ref> {{echo|<references />}}
22119 !! html/parsoid
22120 <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>
22121 </ol>
22122 !! end
22123
22124 !! test
22125 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
22126 !! wikitext
22127 A <ref>foo bar for a</ref>
22128 B <ref group="X" name="b" />
22129
22130 <references />
22131
22132 <references group="X">
22133 <ref name="b">foo</ref>
22134 </references>
22135 !! html/parsoid
22136 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
22137 B <span about="#mwt4" class="mw-ref" id="cite_ref-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>
22138 </p>
22139
22140 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22141 <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>
22142 </ol>
22143
22144 <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\">&lt;span class=\"mw-reflink-text\">[X 1]&lt;/span>&lt;/a>&lt;/span>\n"}}'>
22145 <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>
22146 </ol>
22147 !! end
22148
22149 !! test
22150 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
22151 !! wikitext
22152 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
22153 <references />
22154 !! html/parsoid
22155 <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>
22156 <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>
22157 </ol>
22158 !!end
22159
22160 # This test only works in wt2html now as the <references /> are always generated
22161 # unless selser is active. Once T72722 is fixed, we should add a changes test
22162 # here to ensure that unrelated changes don't add the new <references />
22163 # when selser is active.
22164 !! test
22165 References: 9. Generate missing references list at the end
22166 !! wikitext
22167 A <ref>foo</ref>
22168 B <ref group="inexistent">bar</ref>
22169 !! html/parsoid
22170 <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>
22171 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'>
22172 <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>
22173 </ol>
22174 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"},"autoGenerated":true}'>
22175 <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>
22176 </ol>
22177 !! end
22178
22179 !! test
22180 References: 10. New <references/> shouldn't be added for unrelated edits.
22181 !! options
22182 parsoid={
22183 "modes": ["selser"],
22184 "changes": [["#x", "remove"]],
22185 "selser": "noauto"
22186 }
22187 !! wikitext
22188 Unrelated text<span id="x"> that's going to disappear</span>.
22189 A <ref>foo</ref>
22190 !! wikitext/edited
22191 Unrelated text.
22192 A <ref>foo</ref>
22193 !!end
22194
22195 !! test
22196 Entities in ref name
22197 !! wikitext
22198 <ref name="test &amp; me">hi</ref>
22199 <references />
22200 !! html/parsoid
22201 <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>
22202 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22203 <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>
22204 </ol>
22205 !! end
22206
22207 # This test is wt2html only because we're permitting the serializer to produce
22208 # dirty diffs, normalizing the unclosed references to the self-closed version.
22209 !! test
22210 Generate references for unclosed references tag
22211 !! options
22212 parsoid=wt2html
22213 !! wikitext
22214 a<ref>foo</ref>
22215
22216 <references>
22217 !! html/parsoid
22218 <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>
22219 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22220 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
22221 !! end
22222
22223 !! test
22224 New reference serializes on its own line
22225 !! options
22226 parsoid=wt2wt,html2wt
22227 !! wikitext
22228 foo
22229 <references />
22230 !! html/parsoid
22231 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22232 !! end
22233
22234 #### ----------------------------------------------------------------
22235 #### Parsoid-only testing of Parsoid's impl of LST
22236 #### Not implemented yet, see
22237 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
22238 #### ----------------------------------------------------------------
22239
22240 !! test
22241 LST Sections: 1. Simple section start and end
22242 !! options
22243 parsoid={ "suppressErrors": true }
22244 !! wikitext
22245 <section begin="2011-05-16" />
22246 <section end="2014-04-10 (MW 1.23wmf22)" />
22247 !! html/parsoid
22248 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
22249 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
22250 !! end
22251
22252 #--------- Test stripping of empty nodes in template content ----------
22253 !!test
22254 Empty LI and TR nodes should be stripped from template content
22255 !!wikitext
22256 {{EmptyLITest}}
22257 {{EmptyTRTest}}
22258 !!html/parsoid
22259 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
22260 <li>a</li>
22261 <li>b</li>
22262 </ul>
22263 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
22264 <tbody>
22265 <tr>
22266 <td>foo</td>
22267 </tr>
22268 <tr>
22269 <td>bar</td>
22270 </tr>
22271 </tbody>
22272 </table>
22273 !!end
22274
22275 !!test
22276 Empty LI and TR nodes should not be stripped from top-level content
22277 !!wikitext
22278 * a
22279 *
22280 * b
22281 {|
22282 |-
22283 |-
22284 |foo
22285 |}
22286 !!html/parsoid
22287 <ul>
22288 <li> a</li>
22289 <li></li>
22290 <li> b</li>
22291 </ul>
22292 <table>
22293 <tbody>
22294 <tr></tr>
22295 <tr>
22296 <td>foo</td>
22297 </tr>
22298 </tbody>
22299 </table>
22300 !!end
22301
22302 !!test
22303 Empty TR nodes should not be stripped if they have any attributes set
22304 !!wikitext
22305 {{EmptyTRWithHTMLAttrTest}}
22306 !!html/parsoid
22307 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
22308 <tr align="center"></tr>
22309 <tr><td>foo</td></tr>
22310 <tr align="center"></tr>
22311 <tr><td>bar</td></tr>
22312 </table>
22313 !!end
22314
22315 #### ----------------------------------------------------------------
22316 #### The following section of tests are primarily to test
22317 #### wikitext escaping capabilities of Parsoid. Given that
22318 #### escaping can be done any number of ways, the wikitext (input)
22319 #### is always adjusted to reflect how Parsoid adds nowiki
22320 #### escape tags.
22321 ####
22322 #### We are marking several tests as parsoid-only since the
22323 #### HTML in the result section is different from what the
22324 #### PHP parser generates for it.
22325 #### ----------------------------------------------------------------
22326
22327
22328 #### --------------- Headings ---------------
22329 #### 0. Unnested
22330 #### 1. Nested inside html <h1>=foo=</h1>
22331 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
22332 #### 3. Nested inside html with wikitext split by html tags
22333 #### 4. No escape needed
22334 #### 5. Empty headings <h1></h1>
22335 #### 6. Heading chars in SOL context
22336 #### ----------------------------------------
22337 !! test
22338 Headings: 0. Unnested
22339 !! options
22340 parsoid=html2wt
22341 !! html/parsoid
22342 <p>=foo=</p>
22343
22344 <p> =foo=
22345 <!--cmt-->
22346 =foo=</p>
22347
22348 <p>=foo<i>a</i>=</p>
22349 !! wikitext
22350 <nowiki>=foo=</nowiki>
22351
22352 <nowiki> </nowiki>=foo=
22353 <!--cmt-->
22354 <nowiki>=foo=</nowiki>
22355
22356 =foo''a''<nowiki>=</nowiki>
22357 !!end
22358
22359 # New headings and existing headings are handled differently
22360 !! test
22361 Headings: 1. Nested inside html
22362 !! options
22363 parsoid=html2wt
22364 !! html/parsoid
22365 <h1>=foo=</h1>
22366 <h2>=foo=</h2>
22367 <h3>=foo=</h3>
22368
22369 <h1 data-parsoid=''>=foo=</h1>
22370 <h2 data-parsoid=''>=foo=</h2>
22371 <h3 data-parsoid=''>=foo=</h3>
22372 <h4 data-parsoid=''>=foo=</h4>
22373 <h5 data-parsoid=''>=foo=</h5>
22374 <h6 data-parsoid=''>=foo=</h6>
22375 !! wikitext
22376 = =foo= =
22377
22378 == =foo= ==
22379
22380 === =foo= ===
22381
22382 =<nowiki>=foo=</nowiki>=
22383 ==<nowiki>=foo=</nowiki>==
22384 ===<nowiki>=foo=</nowiki>===
22385 ====<nowiki>=foo=</nowiki>====
22386 =====<nowiki>=foo=</nowiki>=====
22387 ======<nowiki>=foo=</nowiki>======
22388
22389 !!end
22390
22391 !! test
22392 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
22393 !! options
22394 parsoid=html2wt
22395 !! html/parsoid
22396 <h1>foo</h1>*bar
22397 <h1>foo</h1>=bar
22398 <h1>foo</h1>=bar=
22399 !! wikitext
22400 = foo =
22401 <nowiki>*</nowiki>bar
22402
22403 = foo =
22404 =bar
22405
22406 = foo =
22407 <nowiki>=bar=</nowiki>
22408 !!end
22409
22410 !! test
22411 Headings: 3. Nested inside html with wikitext split by html tags
22412 !! options
22413 parsoid=html2wt
22414 !! html/parsoid
22415 <h1>=<b>bold</b>foo=</h1>
22416 !! wikitext
22417 = ='''bold'''foo= =
22418 !!end
22419
22420 !! test
22421 Headings: 4a. No escaping needed (testing just h1 and h2)
22422 !! options
22423 parsoid=html2wt
22424 !! html/parsoid
22425 <h1>=foo</h1>
22426 <h1>foo=</h1>
22427 <h1> =foo= </h1>
22428 <h1>=foo= bar</h1>
22429 <h2>=foo</h2>
22430 <h2>foo=</h2>
22431 <h1>=</h1>
22432 <h1><i>=</i>foo=</h1>
22433 !! wikitext
22434 = =foo =
22435
22436 = foo= =
22437
22438 = =foo= =
22439
22440 = =foo= bar =
22441
22442 == =foo ==
22443
22444 == foo= ==
22445
22446 = = =
22447
22448 = ''=''foo= =
22449 !!end
22450
22451 !! test
22452 Headings: 4b. No escaping needed (inside p-tags)
22453 !! options
22454 parsoid=html2wt
22455 !! html/parsoid
22456 <p>===
22457 =foo= x
22458 =foo= <s></s>
22459 </p>
22460 !! wikitext
22461 ===
22462 =foo= x
22463 =foo= <s></s>
22464 !!end
22465
22466 !! test
22467 Headings: 5. Empty headings
22468 !! options
22469 parsoid=html2wt
22470 !! html/parsoid
22471 <h1 data-parsoid='{}'></h1>
22472
22473 <h2 data-parsoid='{}'></h2>
22474
22475 <h3 data-parsoid='{}'></h3>
22476
22477 <h4 data-parsoid='{}'></h4>
22478
22479 <h5 data-parsoid='{}'></h5>
22480
22481 <h6 data-parsoid='{}'></h6>
22482 !! wikitext
22483 =<nowiki/>=
22484
22485 ==<nowiki/>==
22486
22487 ===<nowiki/>===
22488
22489 ====<nowiki/>====
22490
22491 =====<nowiki/>=====
22492
22493 ======<nowiki/>======
22494 !!end
22495
22496 !! test
22497 Headings: 6a. Heading chars in SOL context (with trailing spaces)
22498 !! options
22499 parsoid=html2wt
22500 !! html/parsoid
22501 <p>=a=</p>
22502
22503 <p>=a=</p>
22504
22505 <p>=a=</p>
22506 !! wikitext
22507 <nowiki>=a=</nowiki>
22508
22509 <nowiki>=a=</nowiki>
22510
22511 <nowiki>=a=</nowiki>
22512 !!end
22513
22514 !! test
22515 Headings: 6b. Heading chars in SOL context (with trailing newlines)
22516 !! options
22517 parsoid=html2wt
22518 !! html/parsoid
22519 <p>=a=
22520 b</p>
22521
22522 <p>=a=
22523 b</p>
22524
22525 <p>=a=
22526 b</p>
22527 !! wikitext
22528 <nowiki>=a=</nowiki>
22529 b
22530
22531 <nowiki>=a=</nowiki>
22532 b
22533
22534 <nowiki>=a=</nowiki>
22535 b
22536 !!end
22537
22538 !! test
22539 Headings: 6c. Heading chars in SOL context (leading newline break)
22540 !! options
22541 parsoid=html2wt
22542 !! html/parsoid
22543 <p>a
22544 =b=</p>
22545 !! wikitext
22546 a
22547 <nowiki>=b=</nowiki>
22548 !!end
22549
22550 !! test
22551 Headings: 6d. Heading chars in SOL context (with interspersed comments)
22552 !! options
22553 parsoid=html2wt
22554 !! html/parsoid
22555 <!--c0--><p>=a=</p>
22556
22557 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
22558 !! wikitext
22559 <!--c0--><nowiki>=a=</nowiki>
22560
22561 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
22562 !!end
22563
22564 !! test
22565 Headings: 6d. Heading chars in SOL context (No escaping needed)
22566 !! options
22567 parsoid=html2wt
22568 !! html/parsoid
22569 =a=<div>b</div>
22570 !! wikitext
22571 =a=<div>b</div>
22572 !!end
22573
22574 !! test
22575 Headings: 7. Insert a newline between new content and headings
22576 !! options
22577 parsoid=html2wt
22578 !! html/parsoid
22579 <h2>NEW</h2>
22580 <p>new</p>
22581 <h2 data-parsoid='{}'>A</h2>
22582 <p data-parsoid='{}'>a</p>
22583 !! wikitext
22584 == NEW ==
22585 new
22586
22587 ==A==
22588 a
22589
22590 !! end
22591
22592 #### --------------- Lists ---------------
22593 #### 0. Outside nests (*foo, etc.)
22594 #### 1. Nested inside html <ul><li>*foo</li></ul>
22595 #### 2. Inside definition lists
22596 #### 3. Only bullets at start should be escaped
22597 #### 4. No escapes needed
22598 #### 5. No unnecessary escapes
22599 #### 6. Escape bullets in SOL position
22600 #### 7. Escape bullets in a multi-line context
22601 #### ----------------------------------------
22602
22603 !! test
22604 Lists: 0. Outside nests
22605 !! options
22606 parsoid=html2wt
22607 !! html/parsoid
22608 <p>*foo</p>
22609
22610 <p>#foo</p>
22611
22612 <p>;Foo:bar</p>
22613 !! wikitext
22614 <nowiki>*</nowiki>foo
22615
22616 <nowiki>#</nowiki>foo
22617
22618 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
22619 !!end
22620
22621 ## Making these next 3 tests Parsoid-only since they are html2wt tests
22622 ## to test wikitext escaping, and insignificant whitespace diffs
22623 ## cause PHP parser tests to barf
22624 !! test
22625 Lists: 1. Nested inside html (No unnecessary escapes)
22626 !! options
22627 parsoid=html2wt
22628 !! html/parsoid
22629 <ul>
22630 <li>*foo</li>
22631 <li>#foo</li>
22632 <li>:foo</li>
22633 <li>;foo</li>
22634 <li data-parsoid='{}'>*foo</li>
22635 <li data-parsoid='{}'>#foo</li>
22636 <li data-parsoid='{}'>:foo</li>
22637 <li data-parsoid='{}'>;foo</li>
22638 </ul>
22639
22640 <ol>
22641 <li>*foo</li>
22642 <li>#foo</li>
22643 <li>:foo</li>
22644 <li>;foo</li>
22645 <li data-parsoid='{}'>*foo</li>
22646 <li data-parsoid='{}'>#foo</li>
22647 <li data-parsoid='{}'>:foo</li>
22648 <li data-parsoid='{}'>;foo</li>
22649 </ol>
22650 !! wikitext
22651 * *foo
22652 * #foo
22653 * :foo
22654 * ;foo
22655 *<nowiki>*foo</nowiki>
22656 *<nowiki>#foo</nowiki>
22657 *<nowiki>:foo</nowiki>
22658 *<nowiki>;foo</nowiki>
22659
22660 # *foo
22661 # #foo
22662 # :foo
22663 # ;foo
22664 #<nowiki>*foo</nowiki>
22665 #<nowiki>#foo</nowiki>
22666 #<nowiki>:foo</nowiki>
22667 #<nowiki>;foo</nowiki>
22668 !!end
22669
22670 !! test
22671 Lists: 2. Inside definition lists
22672 !! options
22673 parsoid=html2wt
22674 !! html/parsoid
22675 <dl><dt>;foo</dt></dl>
22676 <dl><dt>:foo</dt></dl>
22677 <dl><dt>:foo</dt>
22678 <dd>bar</dd></dl>
22679 <dl><dd>:foo</dd></dl>
22680 !! wikitext
22681 ; ;foo
22682
22683 ; <nowiki>:foo</nowiki>
22684
22685 ; <nowiki>:foo</nowiki>
22686 : bar
22687
22688 : :foo
22689 !!end
22690
22691 !! test
22692 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
22693 !! options
22694 parsoid=html2wt
22695 !! html/parsoid
22696 <ul>
22697 <li>*foo*bar</li>
22698 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
22699 </ul>
22700 !! wikitext
22701 * *foo*bar
22702 *<nowiki>*foo</nowiki>''it''*bar
22703 !!end
22704
22705 !! test
22706 Lists: 4. No escapes needed
22707 !! options
22708 parsoid=html2wt
22709 !! html/parsoid
22710 <ul>
22711 <li>foo*bar
22712 </li>
22713 </ul>
22714 <ul>
22715 <li><i>foo</i>*bar
22716 </li>
22717 </ul>
22718 <ul>
22719 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
22720 </li>
22721 </ul>
22722 <ul>
22723 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
22724 </li>
22725 </ul>
22726 !! wikitext
22727 *foo*bar
22728
22729 *''foo''*bar
22730
22731 *[[Foo]]: bar
22732
22733 *[[Foo]]*bar
22734 !!end
22735
22736 !! test
22737 Lists: 5. No unnecessary escapes
22738 !! options
22739 parsoid=html2wt
22740 !! html/parsoid
22741 <ul><li> bar <span>[[foo]]</span></li></ul>
22742 <ul><li> =bar <span>[[foo]]</span></li></ul>
22743 <ul><li> [[bar <span>[[foo]]</span></li></ul>
22744 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
22745 <ul><li> =bar <span>foo]]</span>=</li></ul>
22746 <ul><li> <s></s>: a</li></ul>
22747 <ul><li> <i>* foo</i></li></ul>
22748
22749 !! wikitext
22750 * bar <span><nowiki>[[foo]]</nowiki></span>
22751
22752 * =bar <span><nowiki>[[foo]]</nowiki></span>
22753
22754 * [[bar <span><nowiki>[[foo]]</nowiki></span>
22755
22756 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
22757
22758 * =bar <span>foo]]</span>=
22759
22760 * <s></s>: a
22761
22762 * ''* foo''
22763 !!end
22764
22765 !! test
22766 Lists: 6. Escape bullets in SOL position
22767 !! options
22768 parsoid=html2wt
22769 !! html/parsoid
22770 <p><!--cmt-->*foo</p>
22771 !! wikitext
22772 <!--cmt--><nowiki>*</nowiki>foo
22773 !!end
22774
22775 !! test
22776 Lists: 7. Escape bullets in a multi-line context
22777 !! options
22778 parsoid=html2wt
22779 !! html/parsoid
22780 <p>a
22781 *b
22782 </p>
22783 !! wikitext
22784 a
22785 <nowiki>*</nowiki>b
22786 !!end
22787
22788 !! test
22789 Lists: 8. Escape colons only if not present in tags
22790 !! options
22791 parsoid=html2wt
22792 !! html/parsoid
22793 <dl><dt>a:b<i>c:d</i></dt></dl>
22794 !! wikitext
22795 ; <nowiki>a:b</nowiki>''c:d''
22796 !! end
22797
22798 #### --------------- HRs ---------------
22799 #### 1. Single line
22800 #### -----------------------------------
22801
22802 !! test
22803 HRs: 1. Single line
22804 !! options
22805 parsoid=html2wt
22806 !! html/parsoid
22807 <hr />----
22808 <hr />=foo=
22809 <hr />*foo
22810 !! wikitext
22811 ----<nowiki>----</nowiki>
22812 ----=foo=
22813 ----*foo
22814 !! end
22815
22816 #### --------------- Tables ---------------
22817 #### 1a. Simple example
22818 #### 1b. No escaping needed (!foo)
22819 #### 1c. No escaping needed (|foo)
22820 #### 1d. No escaping needed (|}foo)
22821 ####
22822 #### 2a. Nested in td (<td>foo|bar</td>)
22823 #### 2b. Nested in td (<td>foo||bar</td>)
22824 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
22825 ####
22826 #### 3a. Nested in th (<th>foo!bar</th>)
22827 #### 3b. Nested in th (<th>foo!!bar</th>)
22828 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
22829 ####
22830 #### 4a. Escape -
22831 #### 4b. Escape +
22832 #### 4c. No escaping needed
22833 #### --------------------------------------
22834
22835 !! test
22836 Tables: 1a. Simple example
22837 !! options
22838 parsoid=html2wt
22839 !! html/parsoid
22840 <p>{|
22841 |}
22842 </p>
22843 !! wikitext
22844 <nowiki>{|</nowiki>
22845 |}
22846 !! end
22847
22848 !! test
22849 Tables: 1b. No escaping needed
22850 !! options
22851 parsoid=html2wt
22852 !! html/parsoid
22853 <p>!foo
22854 </p>
22855 !! wikitext
22856 !foo
22857 !! end
22858
22859 !! test
22860 Tables: 1c. No escaping needed
22861 !! options
22862 parsoid=html2wt
22863 !! html/parsoid
22864 <p>|foo
22865 </p>
22866 !! wikitext
22867 |foo
22868 !! end
22869
22870 !! test
22871 Tables: 1d. No escaping needed
22872 !! options
22873 parsoid=html2wt
22874 !! html/parsoid
22875 <p>|}foo
22876 </p>
22877 !! wikitext
22878 |}foo
22879 !! end
22880
22881 !! test
22882 Tables: 2a. Nested in td
22883 !! options
22884 parsoid=html2wt
22885 !! html/parsoid
22886 <table><tbody><tr>
22887 <td>foo|bar</td></tr>
22888 <tr><td>x<div>a|b</div></td>
22889 </tbody></table>
22890 !! wikitext
22891 {|
22892 |<nowiki>foo|bar</nowiki>
22893 |-
22894 |x<div><nowiki>a|b</nowiki></div>
22895 |}
22896 !! html/php+tidy
22897 <table>
22898 <tr>
22899 <td>foo|bar</td>
22900 </tr>
22901 <tr>
22902 <td>x
22903 <div>a|b</div>
22904 </td>
22905 </tr>
22906 </table>
22907 !! end
22908
22909 !! test
22910 Tables: 2b. Nested in td
22911 !! options
22912 parsoid=html2wt
22913 !! html/parsoid
22914 <table><tbody><tr>
22915 <td>foo||bar</td>
22916 <td>a<i>b||c</i></td>
22917 <td>a<i><div>b||c</div></i></td>
22918 </tr></tbody></table>
22919 !! wikitext
22920 {|
22921 |<nowiki>foo||bar</nowiki>
22922 |a''<nowiki>b||c</nowiki>''
22923 |a''<div><nowiki>b||c</nowiki></div>''
22924 |}
22925 !! html/php
22926 <table>
22927 <tr>
22928 <td>foo||bar
22929 </td>
22930 <td>a<i>b||c</i>
22931 </td>
22932 <td>a<i><div>b||c</div></i>
22933 </td></tr></table>
22934
22935 !! end
22936
22937 !! test
22938 Tables: 2c. Nested in td -- no escaping needed
22939 !! options
22940 parsoid=html2wt
22941 !! html/*
22942 <table>
22943
22944 <tr>
22945 <td>foo!!bar
22946 </td></tr></table>
22947
22948 !! wikitext
22949 {|
22950
22951 |foo!!bar
22952 |}
22953 !! end
22954
22955 !! test
22956 Tables: 3a. Nested in th
22957 !! options
22958 parsoid=html2wt
22959 !! html/*
22960 <table>
22961
22962 <tr>
22963 <th>foo!bar
22964 </th></tr></table>
22965
22966 !! wikitext
22967 {|
22968
22969 !foo!bar
22970 |}
22971 !! end
22972
22973 !! test
22974 Tables: 3b. Nested in th
22975 !! options
22976 parsoid=html2wt
22977 !! html/parsoid
22978 <table><tbody>
22979 <tr><th>foo!!bar</th>
22980 <th><i>foo|bar</i></th>
22981 <th><i>foo!!bar</i></th>
22982 <th><i><span>foo!!bar</span></i></th>
22983 </tr></tbody></table>
22984 !! wikitext
22985 {|
22986 !<nowiki>foo!!bar</nowiki>
22987 !''<nowiki>foo|bar</nowiki>''
22988 !''<nowiki>foo!!bar</nowiki>''
22989 !''<span><nowiki>foo!!bar</nowiki></span>''
22990 |}
22991 !! html/php
22992 <table>
22993 <tr>
22994 <th>foo!!bar
22995 </th>
22996 <th><i>foo|bar</i>
22997 </th>
22998 <th><i>foo!!bar</i>
22999 </th>
23000 <th><i><span>foo!!bar</span></i>
23001 </th></tr></table>
23002
23003 !! end
23004
23005 !! test
23006 Tables: 3c. Nested in th
23007 !! options
23008 parsoid=html2wt
23009 !! html/parsoid
23010 <table><tbody>
23011 <tr><th>foo||bar</th>
23012 <th><span typeof="mw:Nowiki">foo||bar</span></th>
23013 </tr></tbody></table>
23014 !! wikitext
23015 {|
23016 !<nowiki>foo||bar</nowiki>
23017 !<nowiki>foo||bar</nowiki>
23018 |}
23019 !! html/php
23020 <table>
23021 <tr>
23022 <th>foo||bar
23023 </th>
23024 <th>foo||bar
23025 </th></tr></table>
23026
23027 !! end
23028
23029 !! test
23030 Tables: 4a. Escape -
23031 !! options
23032 parsoid=html2wt
23033 !! html/*
23034 <table>
23035
23036 <tr>
23037 <th>-bar
23038 </th></tr>
23039 <tr>
23040 <td>-bar
23041 </td></tr></table>
23042
23043 !! wikitext
23044 {|
23045
23046 !-bar
23047
23048 |-
23049 |<nowiki>-bar</nowiki>
23050 |}
23051 !! end
23052
23053 !! test
23054 Tables: 4b. Escape +
23055 !! options
23056 parsoid=html2wt
23057 !! html/*
23058 <table>
23059
23060 <tr>
23061 <th>+bar
23062 </th></tr>
23063 <tr>
23064 <td>+bar
23065 </td></tr></table>
23066
23067 !! wikitext
23068 {|
23069
23070 !+bar
23071
23072 |-
23073 |<nowiki>+bar</nowiki>
23074 |}
23075 !! end
23076
23077 !! test
23078 Tables: 4c. No escaping needed
23079 !! options
23080 parsoid=html2wt
23081 !! html/parsoid
23082 <table><tbody>
23083 <tr><td>foo-bar</td><td>foo+bar</td></tr>
23084 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
23085 <tr><td>foo
23086 <p>bar|baz
23087 +bar
23088 -bar</p></td></tr>
23089 <tr><td>x
23090 <div>a|b</div></td>
23091 </tbody></table>
23092 !! wikitext
23093 {|
23094 |foo-bar
23095 |foo+bar
23096 |-
23097 |''foo''-bar
23098 |''foo''+bar
23099 |-
23100 |foo
23101 bar|baz
23102 +bar
23103 -bar
23104 |-
23105 |x
23106 <div>a|b</div>
23107 |}
23108 !! html/php
23109 <table>
23110 <tr>
23111 <td>foo-bar
23112 </td>
23113 <td>foo+bar
23114 </td></tr>
23115 <tr>
23116 <td><i>foo</i>-bar
23117 </td>
23118 <td><i>foo</i>+bar
23119 </td></tr>
23120 <tr>
23121 <td>foo
23122 <p>bar|baz
23123 +bar
23124 -bar
23125 </p>
23126 </td></tr>
23127 <tr>
23128 <td>x
23129 <div>a|b</div>
23130 </td></tr></table>
23131
23132 !! end
23133
23134 !! test
23135 Tables: 4d. No escaping needed
23136 !! options
23137 parsoid=html2wt
23138 !! html/parsoid
23139 <table>
23140 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
23141 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
23142 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
23143 </tbody></table>
23144 !! wikitext
23145 {|
23146 |[[Foo]]-bar
23147 ||+1
23148 ||-2
23149 |}
23150 !! html/php
23151 <table>
23152 <tr>
23153 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
23154 </td>
23155 <td>+1
23156 </td>
23157 <td>-2
23158 </td></tr></table>
23159
23160 !! end
23161
23162 !! test
23163 T97430: Don't emit empty nowiki pairs around marker meta tags
23164 !! options
23165 parsoid=html2wt
23166 !! html/parsoid
23167 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23168 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
23169 !! wikitext
23170 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23171 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
23172 !! end
23173
23174 !! test
23175 Unclosed xmlish element in table line shouldn't eat end delimiters
23176 !! options
23177 parsoid=html2wt
23178 !! html/parsoid
23179 <table>
23180 <tbody><tr><td> &lt;foo</td>
23181 <td> bar></td></tr>
23182 </tbody></table>
23183 !! wikitext
23184 {|
23185 | <foo
23186 | bar>
23187 |}
23188 !! html/php
23189 <table>
23190 <tr>
23191 <td> &lt;foo
23192 </td>
23193 <td> bar&gt;
23194 </td></tr></table>
23195
23196 !! end
23197
23198 #### --------------- Links ----------------
23199 #### 1. Quote marks in link text
23200 #### 2. Wikilinks: Escapes needed
23201 #### 3. Wikilinks: No escapes needed
23202 #### 4. Extlinks: Escapes needed
23203 #### 5. Extlinks: No escapes needed
23204 #### --------------------------------------
23205 !! test
23206 Links 1. WikiLinks: No escapes needed
23207 !! options
23208 parsoid=html2wt
23209 !! html/parsoid
23210 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
23211 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
23212 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
23213 !! wikitext
23214 [[Foo|Foo''boo'']]
23215 [[Foo|[Foobar]]]
23216 [[Foo|x [Foobar] x]]
23217 !! html/php
23218 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
23219 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
23220 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
23221 </p>
23222 !! end
23223
23224 !! test
23225 Links 2. WikiLinks: Escapes needed
23226 !! options
23227 parsoid=html2wt
23228 !! html/parsoid
23229 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
23230 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
23231 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
23232 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
23233 <a href="Foo" rel="mw:WikiLink">|Bar</a>
23234 <a href="Foo" rel="mw:WikiLink">]]bar</a>
23235 <a href="Foo" rel="mw:WikiLink">[[bar</a>
23236 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
23237 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
23238 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
23239 !! wikitext
23240 [[Foo|<nowiki>Foobar]</nowiki>]]
23241 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
23242 [[Foo|<nowiki>[[Bar]]</nowiki>]]
23243 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
23244 [[Foo|<nowiki>|Bar</nowiki>]]
23245 [[Foo|<nowiki>]]bar</nowiki>]]
23246 [[Foo|<nowiki>[[bar</nowiki>]]
23247 [[Foo|<nowiki>x [[ y</nowiki>]]
23248 [[Foo|<nowiki>x ]] y</nowiki>]]
23249 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
23250 !! html/php
23251 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
23252 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
23253 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
23254 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
23255 <a href="/wiki/Foo" title="Foo">|Bar</a>
23256 <a href="/wiki/Foo" title="Foo">]]bar</a>
23257 <a href="/wiki/Foo" title="Foo">[[bar</a>
23258 <a href="/wiki/Foo" title="Foo">x [[ y</a>
23259 <a href="/wiki/Foo" title="Foo">x ]] y</a>
23260 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
23261 </p>
23262 !! end
23263
23264 !! test
23265 Links 3. WikiLinks: No escapes needed
23266 !! options
23267 parsoid=html2wt
23268 !! html/parsoid
23269 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
23270 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
23271 !! wikitext
23272 [[Foo|[Foobar]]
23273 [[Foo|foo|bar]]
23274 !! html/php
23275 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
23276 <a href="/wiki/Foo" title="Foo">foo|bar</a>
23277 </p>
23278 !! end
23279
23280 !! test
23281 Links 4. ExtLinks: Escapes needed
23282 !! options
23283 parsoid=html2wt
23284 !! html/parsoid
23285 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
23286 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
23287 <p>[http://google.com]</p>
23288 <p>[http://google.com google]</p>
23289 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
23290 <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>
23291 !! wikitext
23292 [http://google.com <nowiki>[google]</nowiki>]
23293 [http://google.com <nowiki>google]</nowiki>]
23294
23295 <nowiki>[http://google.com]</nowiki>
23296
23297 <nowiki>[http://google.com google]</nowiki>
23298
23299 [http://google.com<nowiki>]</nowiki>
23300
23301 [{{echo|http://google.com}}<nowiki>]</nowiki>
23302 !! html/php
23303 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
23304 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
23305 </p><p>[http://google.com]
23306 </p><p>[http://google.com google]
23307 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23308 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23309 </p>
23310 !! end
23311
23312 !! test
23313 Links 5. ExtLinks: No escapes needed
23314 !! options
23315 parsoid=html2wt
23316 !! html/parsoid
23317 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
23318 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
23319 !! wikitext
23320 [http://google.com [google]
23321
23322 [[http://google.com]]
23323 !! html/php
23324 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
23325 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
23326 </p>
23327 !! end
23328
23329 !! test
23330 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
23331 !! options
23332 parsoid=html2wt
23333 !! html/parsoid
23334 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
23335 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
23336 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
23337 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
23338 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
23339 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
23340 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23341 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
23342 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23343 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
23344 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
23345 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
23346 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
23347 </p>
23348 !! wikitext
23349 x<nowiki/>http://example.com<nowiki/>y
23350 http://example.com<nowiki/>?x
23351 http://example.com<nowiki/>&x
23352 http://example.com<nowiki/>'x
23353 http://example.com<nowiki/>,x
23354 http://example.com<nowiki/>.x
23355 http://example.com<nowiki/>;x
23356 http://example.com<nowiki/>:x
23357 http://example.com<nowiki/>;x
23358 http://example.com<nowiki/>!x
23359 http://example.com<nowiki/>=x
23360 http://example.com<nowiki/>(x)
23361 http://example.com(x<nowiki/>)
23362 !! end
23363
23364 !! test
23365 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23366 !! options
23367 parsoid=html2wt
23368 !! html/parsoid
23369 <p>x
23370 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
23371 y
23372 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
23373 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
23374 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
23375 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
23376 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
23377 </p>
23378 !! wikitext
23379 x
23380 http://example.com
23381 y
23382 "http://example.com"
23383 (http://example.com)
23384 (http://example.com) foo
23385 http://example.com,
23386 http://example.com, foo
23387 !! html/php
23388 <p>x
23389 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
23390 y
23391 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
23392 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
23393 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
23394 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
23395 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
23396 </p>
23397 !! end
23398
23399 !! test
23400 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23401 !! options
23402 parsoid=html2wt
23403 !! html/parsoid
23404 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
23405 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
23406 !! wikitext
23407 http://example.com.,;:!?\
23408 -http://example.com:
23409 !! html/php
23410 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
23411 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
23412 </p>
23413 !! end
23414
23415 !! test
23416 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
23417 !! options
23418 parsoid=html2wt
23419 !! html/parsoid
23420 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
23421 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
23422 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
23423 !! wikitext
23424 RFC 123<nowiki/>4
23425 RFC 123<nowiki/>y
23426 X<nowiki/>RFC 123<nowiki/>y
23427 !! end
23428
23429 !! test
23430 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
23431 !! options
23432 parsoid=html2wt
23433 !! html/parsoid
23434 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
23435 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
23436 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
23437 </p>
23438 !! wikitext
23439 RFC 123?foo
23440 RFC 123&foo
23441 -RFC 123-
23442 !! html/php
23443 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
23444 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
23445 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
23446 </p>
23447 !! end
23448
23449 !! test
23450 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
23451 !! options
23452 parsoid=html2wt
23453 !! html/parsoid
23454 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
23455 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23456 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23457 !! wikitext
23458 PMID 123<nowiki/>4
23459 PMID 123<nowiki/>y
23460 X<nowiki/>PMID 123<nowiki/>y
23461 !! end
23462
23463 !! test
23464 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
23465 !! options
23466 parsoid=html2wt
23467 !! html/parsoid
23468 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
23469 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
23470 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
23471 </p>
23472 !! wikitext
23473 PMID 123?foo
23474 PMID 123&foo
23475 -PMID 123-
23476 !! html/php
23477 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
23478 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
23479 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
23480 </p>
23481 !! end
23482
23483 !! test
23484 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
23485 !! options
23486 parsoid=html2wt
23487 !! html/parsoid
23488 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
23489 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
23490 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
23491 </p>
23492 !! wikitext
23493 ISBN 1234567890<nowiki/>1
23494 ISBN 1234567890<nowiki/>x
23495 a<nowiki/>ISBN 1234567890<nowiki/>b
23496 !! end
23497
23498 !! test
23499 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
23500 !! options
23501 parsoid=html2wt
23502 !! html/parsoid
23503 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
23504 !! wikitext
23505 -ISBN 1234567890's
23506 !! html/php
23507 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
23508 </p>
23509 !! end
23510
23511 !! test
23512 Links 14. Protect link-like plain text. (Parsoid bug T78425)
23513 !! options
23514 parsoid=html2wt
23515 !! html/*
23516 <p>this is not a link: http://example.com
23517 </p>
23518 !! wikitext
23519 this is not a link: <nowiki>http://example.com</nowiki>
23520 !! end
23521
23522 !! test
23523 Links 15. Link trails can't become link prefixes.
23524 !! options
23525 language=is
23526 parsoid=html2wt
23527 !! html/parsoid
23528 <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>
23529 !! wikitext
23530 [[Söfnuður]]-[[00]]
23531 !! html/php
23532 <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>
23533 </p>
23534 !! end
23535
23536 #### --------------- Quotes ---------------
23537 #### 1. Quotes inside <b> and <i>
23538 #### 2. Link fragments separated by <i> and <b> tags
23539 #### 3. Link fragments inside <i> and <b>
23540 #### 4. No escaping needed
23541 #### --------------------------------------
23542 !! test
23543 1a. Quotes inside <b> and <i>
23544 !! options
23545 parsoid=html2wt
23546 !! html/*
23547 <p><i>'foo'</i>
23548 <i>''foo''</i>
23549 <i>'''foo'''</i>
23550 <i>foo</i>'s
23551 <b>'foo'</b>
23552 <b>''foo''</b>
23553 <b>'''foo'''</b>
23554 <b>foo'<i>bar'</i>baz</b>
23555 <b>foo</b>'s
23556 '<i>foo</i>
23557 <i>foo</i>'
23558 <i>foo'</i>'
23559 '<i>foo</i>'
23560 '<b>foo</b>
23561 <b>foo</b>'
23562 '<b>foo</b>'
23563 <i>fools'<span> errand</span></i>
23564 <i><span>fool</span>'s errand</i>
23565 '<i>foo</i> bar '<i>baz</i>
23566 a|!*#-:;+-~[]{}b'<i>x</i>
23567 </p>
23568 !! wikitext
23569 ''<nowiki/>'foo'''
23570 ''<nowiki>''foo''</nowiki>''
23571 ''<nowiki>'''foo'''</nowiki>''
23572 ''foo''<nowiki/>'s
23573 '''<nowiki/>'foo''''
23574 '''<nowiki>''foo''</nowiki>'''
23575 '''<nowiki>'''foo'''</nowiki>'''
23576 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
23577 '''foo'''<nowiki/>'s
23578 '''foo''
23579 ''foo''<nowiki/>'
23580 ''foo'''<nowiki/>'
23581 '''foo''<nowiki/>'
23582 ''''foo'''
23583 '''foo'''<nowiki/>'
23584 ''''foo'''<nowiki/>'
23585 ''fools'<span> errand</span>''
23586 ''<span>fool</span>'s errand''
23587 '<nowiki/>''foo'' bar '''baz''
23588 a|!*#-:;+-~[]{}b'''x''
23589 !! end
23590
23591 !! test
23592 1b. Quotes inside <b> and <i> with other tags on same line
23593 !! options
23594 parsoid=html2wt
23595 !! html/parsoid
23596 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23597 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23598 <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>
23599 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
23600 '<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>
23601 '<i>foo</i> <div title="name">test</div>
23602 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
23603 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
23604 <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>
23605 </ol>
23606 !! wikitext
23607 '''a'' foo ''[[bar]]''
23608 ''a''' foo ''[[bar]]''
23609 ''a''' foo '''{{echo|[[bar]]}}'''
23610 [[foo]] x'''[[bar]]''
23611 '''foo'' <ref>test</ref>
23612 '''foo'' <div title="name">test</div>
23613 '''foo'' and <br> bar
23614 <references />
23615 !! end
23616
23617 !! test
23618 2. Link fragments separated by <i> and <b> tags
23619 !! options
23620 parsoid=html2wt
23621 !! html/parsoid
23622 <p>[[<i>foo</i>hello]]</p>
23623 <p>[[<b>foo</b>hello]]</p>
23624 !! wikitext
23625 [[''foo''<nowiki>hello]]</nowiki>
23626
23627 [['''foo'''<nowiki>hello]]</nowiki>
23628 !! end
23629
23630 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
23631 # this is one of the shortcomings of this format
23632 !! test
23633 3. Link fragments inside <i> and <b>
23634 !! options
23635 parsoid=html2wt
23636 !! html/parsoid
23637 <p><i>[[foo</i>]]</p>
23638 <p><b>[[foo</b>]]</p>
23639 !! wikitext
23640 ''[[foo''<nowiki>]]</nowiki>
23641
23642 '''[[foo'''<nowiki>]]</nowiki>
23643 !! end
23644
23645 !! test
23646 4. No escaping needed
23647 !! options
23648 options=html2wt
23649 !! html/parsoid
23650 <p>'<span><i>bar</i></span>'
23651 '<span><b>bar</b></span>'
23652 'a:b'foo
23653 </p>
23654 !! wikitext
23655 '<span>''bar''</span>'
23656 '<span>'''bar'''</span>'
23657 'a:b'foo
23658 !! end
23659
23660 #### ----------- Paragraphs ---------------
23661 #### 1. No unnecessary escapes
23662 #### --------------------------------------
23663
23664 !! test
23665 1. No unnecessary escapes
23666 !! options
23667 parsoid=html2wt
23668 !! html/parsoid
23669 <p>bar <span>[[foo]]</span>
23670 </p><p>=bar <span>[[foo]]</span>
23671 </p><p>[[bar <span>[[foo]]</span>
23672 </p><p>]]bar <span>[[foo]]</span>
23673 </p><p>=bar <span>foo]]</span>=
23674 </p>
23675 !! wikitext
23676 bar <span><nowiki>[[foo]]</nowiki></span>
23677
23678 =bar <span><nowiki>[[foo]]</nowiki></span>
23679
23680 [[bar <span><nowiki>[[foo]]</nowiki></span>
23681
23682 ]]bar <span><nowiki>[[foo]]</nowiki></span>
23683
23684 =bar <span>foo]]</span><nowiki>=</nowiki>
23685 !!end
23686
23687 #### ----------------------- PRE --------------------------
23688 #### 1. Leading whitespace in SOL context should be escaped
23689 #### ------------------------------------------------------
23690 !! test
23691 1. Leading whitespace in SOL context should be escaped
23692 !! options
23693 parsoid=html2wt
23694 !! html/parsoid
23695 <p> a</p>
23696
23697 <p> a</p>
23698
23699 <p> a(tab)</p>
23700
23701 <p> a
23702 <!--cmt-->
23703 a</p>
23704
23705 <p>a
23706 b</p>
23707
23708 <p>a
23709 b</p>
23710
23711 <p>a
23712 b</p>
23713 !! wikitext
23714 <nowiki> </nowiki>a
23715
23716 <nowiki> </nowiki> a
23717
23718 a(tab)
23719
23720 <nowiki> </nowiki> a
23721 <!--cmt-->
23722 <nowiki> </nowiki>a
23723
23724 a
23725 <nowiki> </nowiki>b
23726
23727 a
23728 b
23729
23730 a
23731 b
23732 !! html/php
23733 <p> a
23734 </p><p> a
23735 </p><p> a(tab)
23736 </p><p> a
23737 a
23738 </p><p>a
23739 b
23740 </p><p>a
23741 b
23742 </p><p>a
23743 b
23744 </p>
23745 !! end
23746
23747 !! test
23748 2. Leading whitespace in non-indent-pre contexts should not be escaped
23749 !! options
23750 parsoid=htm2wt
23751 !! html/parsoid
23752 <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>
23753 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23754 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><i data-parsoid='{"dsr":[9,14,2,2]}'>a</i>
23755 b</span></li>
23756 </ol>
23757 !! wikitext
23758 foo <ref>''a''
23759 b</ref>
23760 <references />
23761 !! end
23762
23763 !! test
23764 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
23765 !! options
23766 parsoid=html2wt
23767 !! html/parsoid
23768 <blockquote>
23769 <p>
23770 a
23771 <span>b</span>
23772 c</p>
23773 </blockquote>
23774 !! wikitext
23775 <blockquote>
23776 a
23777 <span>b</span>
23778 c
23779 </blockquote>
23780 !! end
23781
23782 !! test
23783 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
23784 !! options
23785 options=html2wt
23786 !! html/parsoid
23787 <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>
23788 !! wikitext
23789 [[File:Foobar.jpg|thumb|caption]]
23790 !! end
23791
23792 !! test
23793 5. Nowiki escaping should account for indent-pres
23794 !! options
23795 parsoid=html2wt
23796 !! html/parsoid
23797 <pre>==foo==</pre>
23798 !! wikitext
23799 ==foo==
23800 !! end
23801
23802 !!test
23803 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
23804 !! options
23805 parsoid=html2wt
23806 !! html/parsoid
23807 <pre>
23808 * foo
23809 * bar
23810 </pre>
23811 !! wikitext
23812 * foo
23813 * bar
23814 !! end
23815
23816 #### --------------- Behavior Switches --------------------
23817
23818 !! test
23819 1. Valid behavior switches should be escaped
23820 !! options
23821 parsoid=html2wt
23822 !! html/parsoid
23823 __TOC__
23824 <i>__TOC__</i>
23825 !! wikitext
23826 <nowiki>__TOC__</nowiki>
23827 ''<nowiki>__TOC__</nowiki>''
23828 !! end
23829
23830 !! test
23831 2. Invalid behavior switches should not be escaped
23832 !! options
23833 parsoid=html2wt
23834 !! html/parsoid
23835 __TOO__
23836 __|__
23837 !! wikitext
23838 __TOO__
23839 __|__
23840 !! end
23841
23842 # We use indent-pre as an indirect way to test for sol-transparent behavior.
23843 !! test
23844 Behavior switches should be SOL-transparent
23845 !! options
23846 parsoid=html2wt
23847 !! html/parsoid
23848 <meta property="mw:PageProp/toc" />
23849
23850 <!-- this one's bogus -->
23851 <pre>__TOO__</pre>
23852
23853 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
23854
23855 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
23856 !! wikitext
23857 __TOC__
23858
23859 <!-- this one's bogus -->
23860 __TOO__
23861
23862 __TOC__ foo
23863
23864 __TOC__
23865 bar
23866 !! end
23867
23868 #### --------------- HTML tags ---------------
23869 #### 1. a tags
23870 #### 2. other tags
23871 #### 3. multi-line html tag
23872 #### 4. extension tags
23873 #### -----------------------------------------
23874 !! test
23875 1. a tags
23876 !! options
23877 parsoid=html2wt
23878 !! html/parsoid
23879 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
23880 !! wikitext
23881 <a href="http://google.com">google</a>
23882 !! end
23883
23884 !! test
23885 2. other tags
23886 !! options
23887 parsoid=html2wt
23888 !! html/parsoid
23889 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
23890 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
23891 <li> &lt;td&gt;</li></ul>
23892
23893 !! wikitext
23894 * <nowiki><div>foo</div></nowiki>
23895 * <nowiki><div style="color:red">foo</div></nowiki>
23896 * <nowiki><td></nowiki>
23897 !! end
23898
23899 !! test
23900 3. multi-line html tag
23901 !! options
23902 parsoid=html2wt
23903 !! html/parsoid
23904 <p>&lt;div
23905 &gt;foo&lt;/div
23906 &gt;
23907 </p>
23908 !! wikitext
23909 <nowiki><div
23910 >foo</div
23911 ></nowiki>
23912 !! end
23913
23914 !! test
23915 4. extension tags
23916 !! options
23917 parsoid=html2wt
23918 !! html/parsoid
23919 <p>&lt;ref&gt;foo&lt;/ref&gt;
23920 </p><p>&lt;ref&gt;bar
23921 </p><p>baz&lt;/ref&gt;
23922 </p>
23923 !! wikitext
23924 <nowiki><ref>foo</ref></nowiki>
23925
23926 <nowiki><ref>bar</nowiki>
23927
23928 baz<nowiki></ref></nowiki>
23929 !! end
23930
23931 #### --------------- Others ---------------
23932 !! test
23933 Escaping nowikis
23934 !! options
23935 parsoid=html2wt
23936 !! html/parsoid
23937 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
23938 </p>
23939 !! wikitext
23940 &lt;nowiki&gt;foo&lt;/nowiki&gt;
23941 !! end
23942
23943 ## The quote-char in the input is necessary for triggering the bug
23944 !! test
23945 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
23946 !! options
23947 parsoid=html2wt
23948 !! html/parsoid
23949 <p>foo's bar :</p>
23950 !! wikitext
23951 foo's bar :
23952 !! end
23953
23954 #----------- End of wikitext escaping tests --------------
23955
23956 !! test
23957
23958 Tag-like HTML structures are passed through as text
23959 !! wikitext
23960 <x y>
23961
23962 <x.y>
23963
23964 <x-y>
23965
23966 1>2
23967
23968 x<y
23969
23970 a>b
23971
23972 1<d e>f
23973 !! html
23974 <p>&lt;x y&gt;
23975 </p><p>&lt;x.y&gt;
23976 </p><p>&lt;x-y&gt;
23977 </p><p>1&gt;2
23978 </p><p>x&lt;y
23979 </p><p>a&gt;b
23980 </p><p>1&lt;d e&gt;f
23981 </p>
23982 !! end
23983
23984 !! test
23985 HTML tag with necessary entities in attributes
23986 !! wikitext
23987 <span title="&amp;amp;">foo</span>
23988 !! html
23989 <p><span title="&amp;amp;">foo</span>
23990 </p>
23991 !! end
23992
23993 !! test
23994 HTML tag with 'unnecessary' entity encoding in attributes
23995 !! wikitext
23996 <span title="&amp;">foo</span>
23997 !! html
23998 <p><span title="&amp;">foo</span>
23999 </p>
24000 !! end
24001
24002 !! test
24003 HTML tag with broken attribute value quoting
24004 !! options
24005 parsoid=wt2html,html2html
24006 !! wikitext
24007 <span title="Hello world>Foo</span>
24008 !! html/php
24009 <p><span title="Hello world">Foo</span>
24010 </p>
24011 !! html/parsoid
24012 <p><span title="Hello world">Foo</span></p>
24013 !! end
24014
24015 !! test
24016 Self-closed tag with broken attribute value quoting
24017 !! options
24018 parsoid=wt2html,html2html
24019 !! wikitext
24020 <div title="Hello world />Foo
24021 !! html/php+tidy
24022 <div title="Hello world"></div>
24023 <p>Foo</p>
24024 !! html/parsoid
24025 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
24026 !! end
24027
24028 !! test
24029 Table with broken attribute value quoting
24030 !! options
24031 parsoid=wt2html,html2html
24032 !! wikitext
24033 {|
24034 | title="Hello world|Foo
24035 |}
24036 !! html/php
24037 <table>
24038 <tr>
24039 <td title="Hello world">Foo
24040 </td></tr></table>
24041
24042 !! html/parsoid
24043 <table>
24044 <tr>
24045 <td title="Hello world">Foo
24046 </td></tr></table>
24047
24048 !! end
24049
24050 !! test
24051 Table with broken attribute value quoting on consecutive lines
24052 !! options
24053 parsoid=wt2html,html2html
24054 !! wikitext
24055 {|
24056 | title="Hello world|Foo
24057 | style="color:red|Bar
24058 |}
24059 !! html/php
24060 <table>
24061 <tr>
24062 <td title="Hello world">Foo
24063 </td>
24064 <td style="color:red">Bar
24065 </td></tr></table>
24066
24067 !! html/parsoid
24068 <table><tbody>
24069 <tr>
24070 <td title="Hello world">Foo
24071 </td><td style="color: red">Bar
24072 </td></tr></tbody></table>
24073
24074 !! end
24075
24076 !!test
24077 Accept empty td cell attribute
24078 !! wikitext
24079 {|
24080 | align="center" | foo || |
24081 |}
24082 !! html
24083 <table>
24084 <tr>
24085 <td align="center"> foo </td>
24086 <td>
24087 </td></tr></table>
24088
24089 !!end
24090
24091 !!test
24092 Non-empty attributes in th-cells
24093 !! wikitext
24094 {|
24095 ! Foo !! style="color: red" | Bar
24096 |}
24097 !! html
24098 <table>
24099 <tr>
24100 <th> Foo </th>
24101 <th style="color: red"> Bar
24102 </th></tr></table>
24103
24104 !!end
24105
24106 !!test
24107 Accept empty attributes in th-cells
24108 !! wikitext
24109 {|
24110 !| foo !!| bar
24111 |}
24112 !! html
24113 <table>
24114 <tr>
24115 <th> foo </th>
24116 <th> bar
24117 </th></tr></table>
24118
24119 !!end
24120
24121 !!test
24122 Empty table rows go away
24123 !! wikitext
24124 {|
24125 | Hello
24126 | there
24127 |- class="foo"
24128 |-
24129 |}
24130 !! html
24131 <table>
24132 <tr>
24133 <td> Hello
24134 </td>
24135 <td> there
24136 </td></tr>
24137
24138 </table>
24139
24140 !! end
24141
24142 ###
24143 ### Parsoid-centric tests for testing RTing of inter-element separators
24144 ### Edge cases not tested by existing parser tests and specific to
24145 ### Parsoid-specific serialization strategies.
24146 ###
24147
24148 !!test
24149 RT-ed inter-element separators should be valid separators
24150 !! wikitext
24151 {|
24152 |- [[foo]]
24153 |}
24154 !! html/php
24155 <table>
24156
24157 </table>
24158
24159 !! html/parsoid
24160 <table>
24161 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
24162 </tbody></table>
24163 !!end
24164
24165 # Parsoid-only since PHP parser relies on Tidy for correct output
24166 !!test
24167 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
24168 !!options
24169 parsoid
24170 !! wikitext
24171 {|
24172 |<small>foo
24173 bar
24174 |}
24175
24176 {|
24177 |<small>foo<small>
24178 |}
24179 !! html
24180 <table>
24181 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
24182 <p>bar</p></small></td></tr>
24183 </tbody></table>
24184
24185 <table>
24186 <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>
24187 </tbody></table>
24188 !!end
24189
24190 # Note that the "style" attribute is really a template parameter here.
24191 # The = would have to be {{=}} if you wanted the literal.
24192 !!test
24193 Empty TD followed by TD with tpl-generated attribute
24194 !! wikitext
24195 {|
24196 |-
24197 |
24198 |{{echo|style='color:red'}}|foo
24199 |}
24200 !! html
24201 <table>
24202
24203 <tr>
24204 <td>
24205 </td>
24206 <td>foo
24207 </td></tr></table>
24208
24209 !!end
24210
24211 !!test
24212 Indented table with an empty td
24213 !! wikitext
24214 {|
24215 |-
24216 |
24217 |foo
24218 |}
24219 !! html
24220 <table>
24221
24222 <tr>
24223 <td>
24224 </td>
24225 <td>foo
24226 </td></tr></table>
24227
24228 !!end
24229
24230 ## We have some newline diffs RT-ing this edge case
24231 ## and it is not important enough -- we seem to be emitting
24232 ## at most 2 newlines after a </tr> and this is unrelated to
24233 ## the issue from T85627 that this is testing.
24234 !!test
24235 Indented table with blank lines in between (T85627)
24236 !! options
24237 parsoid=wt2html
24238 !! wikitext
24239 {|
24240 |foo
24241
24242
24243 |}
24244 !! html
24245 <table>
24246
24247 <tr>
24248 <td>foo
24249 </td></tr></table>
24250
24251 !!end
24252
24253 !!test
24254 Indented block & table
24255 !! wikitext
24256 <div>foo</div>
24257 {|
24258 |foo
24259 |}
24260 !! html/php
24261 <div>foo</div>
24262 <table>
24263 <tr>
24264 <td>foo
24265 </td></tr></table>
24266
24267 !! html/parsoid
24268 <div data-parsoid='{"stx":"html"}'>foo</div>
24269 <table><tbody>
24270 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
24271 </tbody></table>
24272 !!end
24273
24274 !! test
24275 Indent and comment before table row
24276 !! wikitext
24277 {|
24278 <!--hi-->|-
24279 | there
24280 |}
24281 !! html/php
24282 <table>
24283
24284 <tr>
24285 <td> there
24286 </td></tr></table>
24287
24288 !! html/parsoid
24289 <table>
24290 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
24291 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
24292 </tbody></table>
24293 !! end
24294
24295 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
24296 !!test
24297 Empty TR followed by a template-generated TR
24298 !!options
24299 parsoid
24300 !! wikitext
24301 {|
24302 |-
24303 {{echo|<tr><td>foo</td></tr>}}
24304 |}
24305 !! html
24306 <table>
24307 <tbody>
24308 <tr></tr>
24309 <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}}]}'>
24310 <td>foo</td></tr>
24311 </tbody></table>
24312 !!end
24313
24314 ## PHP and parsoid output differ for this, and since this is primarily
24315 ## for testing Parsoid's serializer, marking this Parsoid only
24316 !!test
24317 Empty TR followed by mixed-ws-comment line should RT correctly
24318 !!options
24319 parsoid
24320 !! wikitext
24321 {|
24322 |-
24323 <!--c-->
24324 |-
24325 <!--c--> <!--d-->
24326 |}
24327 !! html
24328 <table>
24329 <tbody>
24330 <tr></tr>
24331 <!--c-->
24332 <tr>
24333 <!--c--> </tr><!--d-->
24334 </tbody></table>
24335
24336 !!end
24337
24338 !!test
24339 Multi-line image caption generated by templates with/without trailing newlines
24340 !! wikitext
24341 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
24342 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
24343 !! html/parsoid
24344 <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>
24345 <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>
24346 !!end
24347
24348 !! test
24349 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
24350 !! options
24351 parsoid=html2wt
24352 !! html/parsoid
24353 <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>
24354
24355 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
24356 !! wikitext
24357 <includeonly>foo</includeonly>
24358 new para
24359
24360 [[Category:Foo]]
24361
24362 = new heading =
24363 !! end
24364
24365 ## PHP emits broken html for this, and since this is primarily
24366 ## a Parsoid serializer test, marking this Parsoid only
24367 !!test
24368 Improperly nested inline or quotes tags with whitespace in between
24369 !! wikitext
24370 <span> <s>x</span> </s>
24371 ''' ''x''' ''
24372 !! html/parsoid
24373 <p><span> <s>x</s></span><s> </s>
24374 <b> <i>x</i></b><i> </i>
24375 </p>
24376 !!end
24377
24378 !!test
24379 Encapsulate protected attributes from wt
24380 !! wikitext
24381 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
24382 !! html/parsoid
24383 <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>
24384 </body>
24385 !!end
24386
24387 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
24388 ## Having nested or stray pre tags results in the attempt to add duplicates,
24389 ## causing an assertion fail. This test tries to prevent that situation.
24390 !!test
24391 Ensure ParagraphWrapper can deal with stray closing pre tags
24392 !!options
24393 parsoid=wt2html
24394 !! wikitext
24395 plain text</pre>
24396 !! html/parsoid
24397 plain text
24398 !!end
24399
24400 !!test
24401 1. Ensure fostered text content is wrapped in element nodes
24402 !!options
24403 parsoid=wt2html
24404 !! wikitext
24405 <table>hi</table><table>ho</table>
24406 !! html/parsoid
24407 <p>hi</p>
24408 <table></table>
24409 <p>ho</p>
24410 <table></table>
24411 !!end
24412
24413 !!test
24414 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
24415 !!options
24416 parsoid=wt2html,wt2wt
24417 !! wikitext
24418 <table>
24419 <tr> || ||
24420 <td> a
24421 </table>
24422 !! html/parsoid
24423 <p> || ||
24424 </p><table>
24425 <tbody><tr><td> a</td></tr>
24426 </tbody></table>
24427 !!end
24428
24429 !!test
24430 Encapsulation properly handles null DSR information from foster box
24431 !!options
24432 parsoid=wt2html,wt2wt
24433 !! wikitext
24434 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
24435 !! html/parsoid
24436 <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>
24437 !!end
24438
24439 !!test
24440 1. Encapsulate foster-parented transclusion content
24441 !!options
24442 parsoid=wt2wt,wt2html
24443 !! wikitext
24444 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
24445 !! html/parsoid
24446 <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>
24447 <tbody>
24448 <tr>
24449 <td>bar</td>
24450 </tr>
24451 </tbody>
24452 </table>
24453 !!end
24454
24455 !!test
24456 2. Encapsulate foster-parented transclusion content
24457 !!options
24458 parsoid=wt2wt,wt2html
24459 !! wikitext
24460 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
24461 !! html/parsoid
24462 <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>
24463 <table>
24464 <tbody>
24465 <tr>
24466 <td>bar</td>
24467 </tr>
24468 </tbody>
24469 </table>
24470 !!end
24471
24472 !!test
24473 3. Encapsulate foster-parented transclusion content
24474 !!options
24475 parsoid=wt2wt,wt2html
24476 !! wikitext
24477 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24478 !! html/parsoid
24479 <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;]}">
24480 <p>foo</p>
24481 </div>
24482 <table>
24483 <tbody>
24484 <tr>
24485 <td>bar</td>
24486 </tr>
24487 </tbody>
24488 </table>
24489 !!end
24490
24491 !!test
24492 4. Encapsulate foster-parented transclusion content
24493 !!options
24494 parsoid=wt2wt,wt2html
24495 !! wikitext
24496 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24497 !! html/parsoid
24498 <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;]}">
24499 <p>foo</p>
24500 </div>
24501 <table>
24502 <tbody>
24503 <tr>
24504 <td>bar</td>
24505 </tr>
24506 </tbody>
24507 </table>
24508 !!end
24509
24510 !!test
24511 5. Encapsulate foster-parented transclusion content
24512 !!options
24513 parsoid=wt2wt,wt2html
24514 !! wikitext
24515 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
24516 !! html/parsoid
24517 <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>
24518 <table>
24519 <tbody>
24520 <tr>
24521 <td>
24522 <div>
24523 <p>foo</p>
24524 </div>
24525 </td>
24526 </tr>
24527 </tbody>
24528 </table>
24529 !!end
24530
24531 !!test
24532 6. Encapsulate foster-parented transclusion content
24533 !!options
24534 parsoid=wt2wt,wt2html
24535 !! wikitext
24536 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
24537 !! html/parsoid
24538 <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>
24539 <table>
24540 <tbody>
24541 <tr>
24542 <td>
24543 <div>
24544 <p>foo</p>
24545 </div>
24546 </td>
24547 </tr>
24548 </tbody>
24549 </table>
24550 <p>ok</p>
24551 !!end
24552
24553 !!test
24554 7. Encapsulate foster-parented transclusion content
24555 !!options
24556 parsoid=wt2wt,wt2html
24557 !! wikitext
24558 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
24559 !! html/parsoid
24560 <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>
24561 <table>
24562 <tbody>
24563 <tr>
24564 <td>bar</td>
24565 </tr>
24566 </tbody>
24567 </table>
24568 !!end
24569
24570 # Note that the wt is broken on purpose: the = should be {{=}} if you
24571 # don't want it to be a template parameter key.
24572 !!test
24573 8. Encapsulate foster-parented transclusion content
24574 !!options
24575 parsoid=wt2wt,wt2html
24576 !! wikitext
24577 {{echo|a
24578 }}{|{{echo|style='color:red'}}
24579 |-
24580 |b
24581 |}
24582 !! html/parsoid
24583 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
24584 <span> </span>
24585 <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>
24586 <table>
24587 <tbody>
24588 <tr>
24589 <td>b</td>
24590 </tr>
24591 </tbody>
24592 </table>
24593 !!end
24594
24595 !!test
24596 9. Encapsulate foster-parented transclusion content
24597 !!options
24598 parsoid=wt2wt,wt2html
24599 !! wikitext
24600 <table>{{echo|hi</table>hello}}
24601 !! html/parsoid
24602 <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>
24603 !!end
24604
24605 !!test
24606 Table in fosterable position
24607 !!options
24608 parsoid=wt2html
24609 !! wikitext
24610 {{OpenTable}}
24611 <div>
24612 {|
24613 |}
24614 </div>
24615 |}
24616 !! html/parsoid
24617 <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">
24618 </span>
24619 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
24620
24621 <table>
24622 </table>
24623 !!end
24624
24625 # Parsoid only for bug 64747
24626 !! test
24627 Properly encapsulate empty-content transclusions in fosterable positions
24628 !! wikitext
24629 <table>
24630 {{#if:|
24631 <td>foo</td>
24632 }}
24633 </table>
24634 !! html/parsoid
24635 <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"}]]}'>
24636
24637 </table>
24638 !! end
24639
24640 !! test
24641 Always encapsulate foster box when template range is expanded to table
24642 !! options
24643 parsoid=wt2wt
24644 !! wikitext
24645 {|
24646 hello
24647 {{OpenTable}}
24648 |}
24649 !! html/parsoid
24650
24651 !! end
24652
24653 !! test
24654 T115289: Unclosed table
24655 !! wikitext
24656 {{echo|<table>}}<!--c-->[[Category:Two]]
24657 !! html/parsoid
24658 <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>
24659 !! end
24660
24661 !! test
24662 T115289: Don't migrate newlines out of tables with fostered content
24663 !! wikitext
24664 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
24665 !! html/parsoid
24666 <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,"dsr":[0,53,7,0]}'><tbody><tr><td></td></tr><tr><!--c--></tr></tbody></table>
24667 !! end
24668
24669 !! test
24670 T73074: More fostering fun
24671 !! wikitext
24672 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
24673 !! html/parsoid
24674 <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>
24675 !! end
24676
24677 !!test
24678 Support <object> element with .data attribute
24679 !!options
24680 parsoid=html2wt
24681 !! html/parsoid
24682 <object data="test.swf"></object>
24683 !! wikitext
24684 <object data="test.swf"></object>
24685 !!end
24686
24687 !! test
24688 Don't block XML namespace declaration
24689 !! wikitext
24690 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24691 !! html/php
24692 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24693 </p>
24694 !! html/parsoid
24695 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
24696 !! end
24697
24698 # -----------------------------------------------------------------
24699 # The following section of tests are primarily to spec requirements
24700 # around serialization of new/edited content.
24701 #
24702 # All these tests are marked Parsoid html2wt and html2html only
24703 # ----------------------------------------------------------------
24704
24705 # 'mi' is a localinterwiki prefix as well as a language
24706 !! test
24707 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
24708 !! options
24709 parsoid=html2wt
24710 !! html/parsoid
24711 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
24712 !! wikitext
24713 [[Foo]]
24714 !! end
24715
24716 # See T93839
24717 !! test
24718 New wikilinks should be serialized properly
24719 !! options
24720 parsoid=html2wt
24721 !! html/parsoid
24722 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
24723 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
24724 !! wikitext
24725 [[Foo]]
24726 [[Foo]]
24727 !! end
24728
24729 !! test
24730 New wiki links (href variations)
24731 !! options
24732 parsoid=html2wt
24733 !! html/parsoid
24734 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24735 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
24736 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
24737 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
24738 !! wikitext
24739 [[Foo_bar]]
24740 [[Foo_bar]]
24741 [[Foo_bar]]
24742 [[Toxine bactérienne]]
24743 !! end
24744
24745 !! test
24746 New wiki links (content string variations)
24747 !! options
24748 parsoid=html2wt
24749 !! html/parsoid
24750 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24751 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
24752 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
24753 !! wikitext
24754 [[Foo_bar]]
24755 [[Foo bar]]
24756 [[Foo_bar|./Foo_bar]]
24757 !! end
24758
24759 !! test
24760 New category links (href variations)
24761 !! options
24762 parsoid=html2wt
24763 !! html/parsoid
24764 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
24765 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
24766 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
24767 !! wikitext
24768 [[Category:Toxine bactérienne]]
24769 [[Category:Toxine bactérienne]]
24770 [[Category:Toxine bactérienne]]
24771 !! end
24772
24773 !! test
24774 New sol transparent links don't need indent-pre nowiki protection
24775 !! options
24776 parsoid=html2wt
24777 language=de
24778 !! html/parsoid
24779 <link rel="mw:PageProp/redirect" href="./Main_Page">
24780 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
24781 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
24782 !! wikitext
24783 #WEITERLEITUNG [[Main Page]]
24784 <!-- this is good --> [[Category:Good]]
24785 <!-- this is great --> [[Kategorie:Great]]
24786 !! end
24787
24788 !! test
24789 New interlanguage links (href variations)
24790 !! options
24791 parsoid=html2wt
24792 !! html/parsoid
24793 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
24794 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
24795 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
24796 !! wikitext
24797 [[es:Toxine bactérienne]]
24798 [[es:Toxine_bactérienne]]
24799 [[es:Toxine_bactérienne]]
24800 !! end
24801
24802 !! test
24803 Image: Modifying size of an image (1)
24804 !! options
24805 parsoid={
24806 "modes": ["wt2wt"],
24807 "changes": [
24808 ["img[height]", "attr", "height", "22"],
24809 ["img[width]", "attr", "width", "200"]
24810 ]
24811 }
24812 !! wikitext
24813 [[Image:Foobar.jpg|230x230px]]
24814 !! wikitext/edited
24815 [[Image:Foobar.jpg|200x200px]]
24816 !!end
24817
24818 !! test
24819 Image: Modifying size of an image (2)
24820 !! options
24821 parsoid={
24822 "modes": ["wt2wt"],
24823 "changes": [
24824 ["img[height]", "attr", "height", "100"],
24825 ["img[width]", "attr", "width", "500"]
24826 ]
24827 }
24828 !! wikitext
24829 [[Image:Foobar.jpg|230x230px]]
24830 !! wikitext/edited
24831 [[Image:Foobar.jpg|500x500px]]
24832 !!end
24833
24834 # Change in size is ignored so long as class='mw-default-size'
24835 !! test
24836 Image: Modifying size of an image (3)
24837 !! options
24838 parsoid={
24839 "modes": ["wt2wt"],
24840 "changes": [
24841 ["figure[class]", "removeClass", "mw-default-size"],
24842 ["figure img", "attr", "height", "19"],
24843 ["figure img", "attr", "width", "170"]
24844 ]
24845 }
24846 !! wikitext
24847 [[Image:Foobar.jpg|thumb]]
24848 !! wikitext/edited
24849 [[Image:Foobar.jpg|thumb|170x170px]]
24850 !!end
24851
24852 !! test
24853 Image: Modifying alignment of an image (bug 48665)
24854 !! options
24855 parsoid={
24856 "modes": ["wt2wt"],
24857 "changes": [
24858 ["figure[class]", "removeClass", "mw-halign-right"],
24859 ["figure[class]", "addClass", "mw-halign-left"]
24860 ]
24861 }
24862 !! wikitext
24863 [[Image:Foobar.jpg|thumb|caption|right]]
24864 !! wikitext/edited
24865 [[Image:Foobar.jpg|thumb|caption|left]]
24866 !! end
24867
24868 !! test
24869 Image: Modifying mw-default-size of an frameless image (bug 62805)
24870 !! options
24871 parsoid={
24872 "modes": ["wt2wt"],
24873 "changes": [
24874 ["figure.mw-default-size", "removeClass", "mw-default-size"]
24875 ]
24876 }
24877 !! wikitext
24878 [[Image:Foobar.jpg|frameless|right]]
24879 !! wikitext/edited
24880 [[Image:Foobar.jpg|frameless|right|220x220px]]
24881 !! end
24882
24883 !! test
24884 Image: Modifying valign of an image (bug 49221)
24885 !! options
24886 parsoid={
24887 "modes": ["wt2wt"],
24888 "changes": [
24889 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
24890 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
24891 ]
24892 }
24893 !! wikitext
24894 [[File:Foobar.jpg|20px|middle]]
24895 !! wikitext/edited
24896 [[File:Foobar.jpg|20px|text-top]]
24897 !! end
24898
24899 !! test
24900 Image: Modifying alt attribute of an image (bug 56400)
24901 !! options
24902 parsoid={
24903 "modes": ["wt2wt"],
24904 "changes": [
24905 ["img[alt]", "attr", "alt", "some alternate edited text"]
24906 ]
24907 }
24908 !! wikitext
24909 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
24910 !! wikitext/edited
24911 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
24912 !!end
24913
24914 !! test
24915 Image: Modifying caption of an image
24916 !! options
24917 parsoid={
24918 "modes": ["wt2wt"],
24919 "changes": [
24920 ["figcaption", "text", "new caption"]
24921 ]
24922 }
24923 !! wikitext
24924 [[Image:Foobar.jpg|thumb|original caption]]
24925 !! wikitext/edited
24926 [[Image:Foobar.jpg|thumb|new caption]]
24927 !!end
24928
24929 !! test
24930 Image: empty alt attribute (bug 48924)
24931 !! options
24932 parsoid
24933 !! wikitext
24934 [[File:Foobar.jpg|thumb|alt=|bar]]
24935 !! html
24936 <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>
24937 !! end
24938
24939 !! test
24940 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
24941 !! options
24942 parsoid=html2wt
24943 language=ar
24944 disabled
24945 !! html/parsoid
24946 <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>
24947 !! wikitext
24948 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
24949 !! end
24950
24951 !! test
24952 Image: Block level image should have \n before and after
24953 !! wikitext
24954 123
24955 [[File:Foobar.jpg|right|thumb|150x150px]]
24956 456
24957 !! html/parsoid
24958 <p>123</p>
24959 <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>
24960 <p>456</p>
24961 !!end
24962
24963 !! test
24964 Image: New block level image should have \n before and after (existing content)
24965 !! wikitext
24966 123
24967 [[File:Foobar.jpg|right|thumb|150x150px]]
24968 456
24969 !! html/parsoid
24970 <p>123</p>
24971 <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>
24972 <p>456</p>
24973 !!end
24974
24975 !! test
24976 Image: upright option (parsoid)
24977 !! wikitext
24978 [[File:Foobar.jpg|thumb|upright|caption]]
24979 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
24980 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
24981 !! html/parsoid
24982 <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>
24983 <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>
24984 <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>
24985 !!end
24986
24987 !! test
24988 Image: upright option is ignored on inline and frame images (parsoid)
24989 !! wikitext
24990 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
24991 !! html/parsoid
24992 <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>
24993 !!end
24994
24995 !! test
24996 Image: from basic HTML (1)
24997 !! options
24998 parsoid=html2wt
24999 !! html/parsoid
25000 <span typeof="mw:Image">
25001 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25002 </span>
25003 !! wikitext
25004 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25005 !! end
25006
25007 !! test
25008 Image: from basic HTML (2)
25009 !! options
25010 parsoid=html2wt
25011 !! html/parsoid
25012 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25013 !! wikitext
25014 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25015 !! end
25016
25017 !! test
25018 Image: from basic HTML (3)
25019 !! options
25020 parsoid=html2wt
25021 !! html/parsoid
25022 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
25023 !! wikitext
25024 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
25025 !! end
25026
25027 !! test
25028 Image: from basic HTML (4)
25029 !! options
25030 parsoid=html2wt
25031 !! html/parsoid
25032 <img src="./File:Foobar.jpg">
25033 !! wikitext
25034 [[File:Foobar.jpg|link=]]
25035 !! end
25036
25037 !! test
25038 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
25039 !! options
25040 parsoid=html2wt
25041 !! html/parsoid
25042 <ul>
25043 <li><p>foo</p></li>
25044 </ul>
25045 !! wikitext
25046 * foo
25047 !! end
25048
25049 !! test
25050 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
25051 !! options
25052 parsoid=html2wt
25053 !! html/parsoid
25054 <ul> <li>foo</li></ul>
25055 !! wikitext
25056 * foo
25057 !! end
25058
25059 !! test
25060 Don't strip leading whitespace when handling indent-pre suppressing tags
25061 !! options
25062 parsoid=html2wt
25063 !! html/parsoid
25064 <table>
25065 <tr><td> indented row</td></tr>
25066 </table>
25067 <blockquote><p>
25068 <b>This is very bold of you!</b>
25069 </p>
25070 <table><tr><td>
25071 indented cell (no pre-wrapping!)
25072 </td></tr></table>
25073 </blockquote>
25074 <p>foo</p>
25075 <div>bar</div>
25076 !! wikitext
25077 {|
25078 | indented row
25079 |}
25080 <blockquote>
25081 '''This is very bold of you!'''
25082
25083 {|
25084 |
25085 indented cell (no pre-wrapping!)
25086 |}
25087 </blockquote>
25088 foo
25089 <div>bar</div>
25090 !! end
25091
25092 !! test
25093 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
25094 !! options
25095 parsoid=html2wt
25096 !! html/parsoid
25097 <p>foo</p>
25098 <span>bar</span>
25099
25100 <span>foo2
25101 </span>bar2
25102
25103 <div>foo</div>
25104 <span>bar</span>
25105
25106 <div>
25107 <span>foo</span>
25108 </div>
25109 !! wikitext
25110 foo
25111
25112 <span>bar</span>
25113
25114 <span>foo2
25115 <nowiki> </nowiki></span>bar2
25116
25117 <div>foo</div>
25118 <nowiki> </nowiki><span>bar</span>
25119
25120 <div>
25121 <nowiki> </nowiki><span>foo</span>
25122 </div>
25123 !! end
25124
25125 !! test
25126 Lists: Dont insert newlines in a serialized list item.
25127 !! options
25128 parsoid=html2wt
25129 !! html/parsoid
25130 <ul><li>a<br>b</li><li>c</li></ul>
25131 !! wikitext
25132 * a<br>b
25133 * c
25134 !! end
25135
25136 !! test
25137 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
25138 !! options
25139 parsoid={
25140 "modes": ["html2wt"],
25141 "scrubWikitext": false
25142 }
25143 !! html/parsoid
25144 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25145 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25146
25147 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25148 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25149
25150 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
25151
25152 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25153 !! wikitext
25154 == hello there [[Category:A1]] ==
25155
25156 == [[Category:A2]] hi pal ==
25157
25158 == <!--foo--> [[Category:A3]] how goes it ==
25159
25160 == it goes well [[Category:A4]] <!--bar--> ==
25161
25162 ==howdy [[Category:A5]]==
25163
25164 == __TOC__ ok ==
25165 !! end
25166
25167 !! test
25168 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
25169 !! options
25170 parsoid={
25171 "modes": ["html2wt"],
25172 "scrubWikitext": true
25173 }
25174 !! html/parsoid
25175 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25176 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25177
25178 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25179 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25180
25181 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25182 !! wikitext
25183 == hello there ==
25184 [[Category:A1]]
25185 [[Category:A2]]
25186
25187 == hi pal ==
25188
25189 <!--foo--> [[Category:A3]]
25190
25191 == how goes it ==
25192
25193 == it goes well ==
25194 [[Category:A4]] <!--bar-->
25195
25196 __TOC__
25197
25198 == ok ==
25199 !! end
25200
25201 !! test
25202 Headings: Don't hoist metas that come from templates
25203 !! options
25204 parsoid={
25205 "modes": ["html2wt"],
25206 "scrubWikitext": true
25207 }
25208 !! html/parsoid
25209 <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>
25210 !! wikitext
25211 == {{echo|foo [[Category:Foo]]}} ==
25212 !! end
25213
25214 !! test
25215 Headings: Category in ref isn't hoisted
25216 !! options
25217 parsoid={
25218 "modes": ["html2wt"],
25219 "scrubWikitext": true
25220 }
25221 !! html/parsoid
25222 <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>
25223
25224 <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>
25225 !! wikitext
25226 == foo <ref>bar
25227 [[Category:Baz]] </ref> ==
25228
25229 <references />
25230 !! end
25231
25232 !! test
25233 Parsoid: Serialize positional parameters with = in them as named parameter
25234 !! options
25235 parsoid=html2wt
25236 !! html/parsoid
25237 <p about="#mwt1" typeof="mw:Transclusion"
25238 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
25239
25240 <p about="#mwt1" typeof="mw:Transclusion"
25241 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
25242
25243 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25244 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25245 <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>
25246 !! wikitext
25247 {{echo|1=f=oo}}
25248
25249 {{echo|1=f=oo|2=bar}}
25250
25251 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25252 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25253 {{echo|<nowiki>f=oo</nowiki>|bar}}
25254 !! end
25255
25256 !! test
25257 Parsoid: Serialize positional parameters with = in extlink as named parameter
25258 !! options
25259 parsoid=html2wt
25260 !! html/parsoid
25261 <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>
25262 !! wikitext
25263 {{echo|1=http://stuff?is=ok}}
25264 !! end
25265
25266 !! test
25267 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
25268 !! options
25269 parsoid=html2wt
25270 !! html/parsoid
25271 <div>a<p>b</p></div>
25272 <div>a
25273 <p>b</p></div>
25274 <div>
25275 a
25276 <p>b</p></div>
25277 !! wikitext
25278 <div>a
25279 b
25280 </div>
25281 <div>a
25282 b
25283 </div>
25284 <div>
25285 a
25286
25287 b
25288 </div>
25289 !! end
25290
25291 !! test
25292 Substrings resembling wikitext in hrefs should not get nowiki escapes
25293 !! options
25294 parsoid=html2wt
25295 !! html/parsoid
25296 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
25297 !! wikitext
25298 [[Foo''bar''baz]]
25299 !! end
25300
25301 !! test
25302 Enforce single-line context in the serializer
25303 !! options
25304 parsoid=html2wt
25305 !! html/parsoid
25306 <h2>testing
25307 123</h2>
25308
25309 <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">
25310 </span><span about="#mwt1">you</span> </h2>
25311
25312 <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>
25313
25314 <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
25315 there</span></li></ol>
25316
25317 <ul><li>asd
25318 sdf</li></ul>
25319
25320 <ul><li>foo
25321 bar
25322 baz</li>
25323 <li>foo <b>bar</b>
25324 baz</li></ul>
25325
25326 <dl><dt>hi
25327 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
25328 ho</dd></dl>
25329
25330 <dl><dd> <table>
25331 <tbody><tr><td> ha
25332 ha
25333 ha</td></tr>
25334 </tbody></table></dd></dl>
25335 !! wikitext
25336 == testing 123 ==
25337
25338 == hi {{bogus|there
25339 you}} ==
25340
25341 == foo <ref>hello
25342 there</ref> ==
25343
25344 <references />
25345
25346 * asd sdf
25347
25348 * foo bar baz
25349 * foo '''bar''' baz
25350
25351 ; hi ho : hi ho
25352
25353 : {|
25354 | ha
25355 ha
25356 ha
25357 |}
25358 !! end
25359
25360 !! test
25361 Serialize new placeholder space without spans
25362 !! options
25363 parsoid=html2wt
25364 !! html/parsoid
25365 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
25366
25367 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
25368
25369 <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>
25370 !! wikitext
25371 foo : bar
25372
25373 foo : bar
25374
25375 <ref>foo : bar</ref>ok
25376 !! end
25377
25378
25379 #-----------------------
25380 # Tag minimization tests
25381 #-----------------------
25382
25383 !! test
25384 1. I/B quote minimization: wikitext-only tags should be combined
25385 !! options
25386 parsoid=html2wt
25387 !! html/parsoid
25388 <p><i>A</i><i>B</i></p>
25389 <p><b>A</b><b>B</b></p>
25390 <p><i>A</i><b><i>B</i></b></p>
25391 <p><b>A</b><i><b>B</b></i></p>
25392 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
25393 <p><i><b>A</b></i><i><b>B</b></i></p>
25394 <p><i><b>A</b></i><b><i>B</i></b></p>
25395 <p><b><i>A</i></b><i><b>B</b></i></p>
25396 !! wikitext
25397 ''AB''
25398
25399 '''AB'''
25400
25401 ''A'''B'''''
25402
25403 '''A''B'''''
25404
25405 '''A''BC''D'''
25406
25407 '''''AB'''''
25408
25409 '''''AB'''''
25410
25411 '''''AB'''''
25412 !! end
25413
25414 !! test
25415 2. I/B quote minimization: wikitext and html tags should not be combined
25416 !! options
25417 parsoid=html2wt
25418 !! html/parsoid
25419 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
25420 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
25421 !! wikitext
25422 ''A''<i>B</i>
25423
25424 ''A''<nowiki/>'''<i>B</i>'''
25425 !! end
25426
25427 !! test
25428 3. I/B quote minimization: templated content stops minimization
25429 !! options
25430 parsoid=html2wt
25431 !! html/parsoid
25432 <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>
25433 <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>
25434 !! wikitext
25435 ''A''{{echo|''B''}}
25436
25437 ''A''{{echo|'''''B'''''}}
25438 !! end
25439
25440 !! test
25441 4. I/B quote minimization: new content should be mimimized with adjacent old content
25442 !! options
25443 parsoid=html2wt
25444 !! html/parsoid
25445 <p><i>A</i><i>B</i></p>
25446 <p><b>A</b><b>B</b></p>
25447 <p><i>A</i><b><i>B</i></b></p>
25448 !! wikitext
25449 ''AB''
25450
25451 '''AB'''
25452
25453 ''A'''B'''''
25454 !! end
25455
25456 !! test
25457 5a. Merge adjacent quote nodes if they've been edited
25458 !! options
25459 parsoid={
25460 "modes": ["wt2wt", "selser"],
25461 "changes": [
25462 ["p", "contents", "remove", ":contains('b')"]
25463 ]
25464 }
25465 !! wikitext
25466 ''a''b''c''
25467 !! wikitext/edited
25468 ''ac''
25469 !! end
25470
25471 !! test
25472 5b. Merge adjacent quote nodes if they've been edited
25473 !! options
25474 parsoid={
25475 "modes": ["wt2wt", "selser"],
25476 "changes": [
25477 ["#x", "remove"]
25478 ]
25479 }
25480 !! wikitext
25481 ''a''<span id="x">b</span>''c''
25482 !! wikitext/edited
25483 ''ac''
25484 !! end
25485
25486 !! test
25487 1. Merge adjacent link nodes as long as at least one element is new
25488 !! options
25489 parsoid={
25490 "modes": ["html2wt"],
25491 "scrubWikitext": true
25492 }
25493 !! html/parsoid
25494 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25495 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25496 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
25497 !! wikitext
25498 [[Football]]
25499 [[Football]]
25500 [[Football|Foot]][[Football|ball]]
25501 !! end
25502
25503 !! test
25504 2. Merge adjacent link nodes and enable additional normalizations
25505 !! options
25506 parsoid={
25507 "modes": ["html2wt"],
25508 "scrubWikitext": true
25509 }
25510 !! html/parsoid
25511 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
25512 !! wikitext
25513 [[Football|''Football'']]
25514 !! end
25515
25516 !! test
25517 3. Don't merge adjacent link nodes if scrubWikitext is false
25518 !! options
25519 parsoid={
25520 "modes": ["html2wt"],
25521 "scrubWikitext": false
25522 }
25523 !! html/parsoid
25524 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25525 !! wikitext
25526 [[Football|Foot]][[Football|ball]]
25527 !! end
25528
25529 #------------------------------
25530 # End of tag minimization tests
25531 #------------------------------
25532
25533 !!test
25534 Bug 54262: New entities
25535 !! options
25536 parsoid=html2wt
25537 !! html/parsoid
25538 <span typeof="mw:Entity">&nbsp;</span>
25539 !! wikitext
25540 &nbsp;
25541 !! end
25542
25543 ## Note that there is no wikitext output for 'unknownproperty' ##
25544 ## Unknown magic words are silently dropped ##
25545
25546 !! test
25547 Magic words
25548 !! options
25549 parsoid=html2wt
25550 !! html/parsoid
25551 <meta property='mw:PageProp/toc' />
25552 <meta property='mw:PageProp/notoc' />
25553 <meta property='mw:PageProp/forcetoc' />
25554 <meta property='mw:PageProp/index' />
25555 <meta property='mw:PageProp/noindex' />
25556 <meta property='mw:PageProp/nogallery' />
25557 <meta property='mw:PageProp/noeditsection' />
25558 <meta property='mw:PageProp/notitleconvert' />
25559 <meta property='mw:PageProp/nocontentconvert' />
25560 <meta property='mw:PageProp/unknownproperty' />
25561 !! wikitext
25562 __TOC__
25563 __NOTOC__
25564 __FORCETOC__
25565 __INDEX__
25566 __NOINDEX__
25567 __NOGALLERY__
25568 __NOEDITSECTION__
25569 __NOTITLECONVERT__
25570 __NOCONTENTCONVERT__
25571 !! end
25572
25573 !! test
25574 Consecutive <pre>s should not get merged
25575 !! options
25576 parsoid=html2wt,html2html
25577 !! html/parsoid
25578 <pre>a</pre><pre>b</pre>
25579
25580 <pre>c
25581 </pre><pre>
25582 d</pre>
25583
25584 <pre>e
25585
25586 </pre><pre>
25587
25588 f</pre>
25589 !! wikitext
25590 a
25591
25592 b
25593
25594 c
25595
25596 d
25597
25598 e
25599
25600
25601
25602 f
25603 !! end
25604
25605 !! test
25606 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
25607 !! options
25608 parsoid=html2wt
25609 !! html/parsoid
25610 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
25611 !! wikitext
25612 [[Special:BookSources/1234567890|ISBN 1234567895]]
25613 !! end
25614
25615 !! test
25616 Edited RFC links not serializable as RFC links should serialize as extlinks
25617 !! options
25618 parsoid=html2wt
25619 !! html/parsoid
25620 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
25621 !! wikitext
25622 [//tools.ietf.org/html/rfc123 New RFC]
25623 !! end
25624
25625 !! test
25626 Edited PMID links not serializable as PMID links should serialize as extlinks
25627 !! options
25628 parsoid=html2wt
25629 !! html/parsoid
25630 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
25631 !! wikitext
25632 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
25633 !! end
25634
25635 !! test
25636 WTS of autolinks with trailing/surrounding context
25637 !! options
25638 parsoid=html2wt
25639 !! html/parsoid
25640 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
25641 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
25642 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
25643 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
25644 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
25645 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
25646 !! wikitext
25647 http://cscott.net'''foo'''
25648
25649 http://cscott.net<b>foo</b>
25650
25651 '''http://cscott.net'''
25652
25653 '''http://cscott.net '''
25654
25655 '''http://cscott.net<nowiki/>x'''
25656
25657 http://cscott.net<nowiki/>x
25658 !! end
25659
25660 !! test
25661 WTS of autolinks with nowikis (round-trip)
25662 !! wikitext
25663 x<nowiki/>http://cscott.net<nowiki/>x
25664 !! html/parsoid
25665 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
25666 !! end
25667
25668 # this is the "easy" test because it leaves in place all the
25669 # data-parsoid information indicating this is an autolink
25670 !! test
25671 WTS of autolinks with escapes (editing)
25672 !! options
25673 parsoid={
25674 "modes": ["wt2wt"],
25675 "changes": [
25676 [ "meta", "remove" ]
25677 ]
25678 }
25679 !! wikitext
25680 x<nowiki/>http://cscott.net<nowiki/>x
25681 !! wikitext/edited
25682 x<nowiki/>http://cscott.net<nowiki/>x
25683 !! end
25684
25685 !! test
25686 WTS of edited autolink-like text (T103364)
25687 !! options
25688 parsoid={
25689 "modes": ["wt2wt"],
25690 "changes": [
25691 [ "span[typeof]", "removeAttr", "typeof" ]
25692 ]
25693 }
25694 !! wikitext
25695 Not a link: <nowiki>http://example.com</nowiki>.
25696 !! wikitext/edited
25697 Not a link: <span><nowiki>http://example.com</nowiki></span>.
25698 !! end
25699
25700 !! test
25701 WTS of newly-authored autolink-like text (T103364)
25702 !! options
25703 parsoid=html2wt
25704 !! html/parsoid
25705 <p>http://example.com is not a link.</p>
25706 !! wikitext
25707 <nowiki>http://example.com</nowiki> is not a link.
25708 !! end
25709
25710 !! test
25711 WTS of autolink-like text after an autolink (T108563)
25712 !! options
25713 parsoid=html2wt
25714 !! html/parsoid
25715 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
25716 !! wikitext
25717 http://example.com <nowiki>http://example.com</nowiki> is not a link.
25718 !! end
25719
25720 !! test
25721 Magic links inside links (not autolinked)
25722 !! wikitext
25723 [[Foo|http://example.com]]
25724 [[Foo|RFC 1234]]
25725 [[Foo|PMID 1234]]
25726 [[Foo|ISBN 123456789x]]
25727
25728 [http://foo.com http://example.com]
25729 [http://foo.com RFC 1234]
25730 [http://foo.com PMID 1234]
25731 [http://foo.com ISBN 123456789x]
25732 !! html+tidy
25733 <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>
25734 <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>
25735 !! html/parsoid
25736 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
25737 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
25738 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
25739 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
25740
25741 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
25742 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
25743 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
25744 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
25745 !! end
25746
25747 !! test
25748 Magic links inside image captions (autolinked)
25749 !! wikitext
25750 [[File:Foobar.jpg|thumb|http://example.com]]
25751 [[File:Foobar.jpg|thumb|RFC 1234]]
25752 [[File:Foobar.jpg|thumb|PMID 1234]]
25753 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
25754 !! html+tidy
25755 <div class="thumb tright">
25756 <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>
25757 <div class="thumbcaption">
25758 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25759 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
25760 </div>
25761 </div>
25762 <div class="thumb tright">
25763 <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>
25764 <div class="thumbcaption">
25765 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25766 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
25767 </div>
25768 </div>
25769 <div class="thumb tright">
25770 <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>
25771 <div class="thumbcaption">
25772 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25773 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
25774 </div>
25775 </div>
25776 <div class="thumb tright">
25777 <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>
25778 <div class="thumbcaption">
25779 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25780 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
25781 </div>
25782 </div>
25783 !! html/parsoid
25784 <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>
25785 <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>
25786 <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>
25787 <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>
25788 !! end
25789
25790 !! test
25791 WTS of magic word text (T109371)
25792 !! options
25793 parsoid=html2wt
25794 !! html/parsoid
25795 <p>RFC 1234</p>
25796 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
25797 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
25798 !! wikitext
25799 <nowiki>RFC 1234</nowiki>
25800
25801 [http://foo.com RFC 1234]
25802
25803 [[Foo|RFC 1234]]
25804 !! end
25805
25806 !! test
25807 Edited Redirect link should emit a non-piped wikitext link
25808 !! options
25809 parsoid=html2wt
25810 !! html/parsoid
25811 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
25812 !! wikitext
25813 #REDIRECT [[Bar]]
25814 !! end
25815
25816 !! test
25817 T75121: Infer extension name from typeOf if data-mw is not present
25818 !! options
25819 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25820 !! html/parsoid
25821 <div typeOf="mw:Extension/foo"></div>
25822 !! wikitext
25823 <foo />
25824 !! end
25825
25826 # Note that the <p> wrapping isn't present in PHP parser output
25827 # The important thing for this test is that P-wrapping doesn't
25828 # interfere with the <nowiki> protection for leading - in <td>
25829 # (which isn't necessary for <th>).
25830 !! test
25831 T88318: p-wrapped dash in table.
25832 !! options
25833 parsoid=html2wt,wt2wt
25834 !! html/parsoid
25835 <table><tbody>
25836 <tr><th><p>-</p></th><th><p>- </p></th></tr>
25837 <tr><td><p>-</p></td><td><p>- </p></td></tr>
25838 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
25839 </tbody></table>
25840 !! wikitext
25841 {|
25842 !-
25843 !-
25844 |-
25845 |<nowiki>-</nowiki>
25846 |<nowiki>- </nowiki>
25847 |-
25848 |<small>-</small>
25849 |<br>
25850 -
25851 |<br>
25852 -
25853 |}
25854 !! html/php+tidy
25855 <table>
25856 <tr>
25857 <th>-</th>
25858 <th>-</th>
25859 </tr>
25860 <tr>
25861 <td>-</td>
25862 <td>-</td>
25863 </tr>
25864 <tr>
25865 <td><small>-</small></td>
25866 <td><br />
25867 <p>-</p>
25868 </td>
25869 <td><br />
25870 <p>-</p>
25871 </td>
25872 </tr>
25873 </table>
25874 !! end
25875
25876 !! test
25877 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
25878 !! options
25879 parsoid=html2wt
25880 !! html/parsoid
25881 <table id='mwAb'>
25882 <td id='mwAc'>foo</td>
25883 <td id='serialize-this'>bar</td>
25884 </table>
25885 !! wikitext
25886 {|
25887 |foo
25888 | id="serialize-this" |bar
25889 |}
25890 !! end
25891
25892 !! test
25893 Parsoid-like element ids should not be serialized to wikitext unless shadowed
25894 !! options
25895 parsoid=html2wt
25896 !! html/parsoid
25897 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
25898 !! wikitext
25899 <div id="hello">ok</div>
25900 !! end
25901
25902 !! test
25903 WTS change modes
25904 !! options
25905 parsoid={
25906 "modes": ["wt2wt"],
25907 "changes": [
25908 [ "#xyz", "before", "<b>before</b> stuff " ],
25909 [ "#xyz", "after", " stuff <i>after</i>" ],
25910 [ "#xyz", "html", "x <b>y</b> z" ]
25911 ]
25912 }
25913 !! wikitext
25914 <span id="xyz">hello</span>
25915 !! wikitext/edited
25916 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
25917 !! end
25918
25919 !! test
25920 Never serialize a-tag as html, regardless of what data-parsoid has to say
25921 !! options
25922 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25923 !! html/parsoid
25924 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
25925 !! wikitext
25926 [[Foo]]
25927 !! end
25928
25929 ## SSS FIXME: This is broken output nevertheless.
25930 ## What might be a reasonable non-broken output for this?
25931 ## This is an edge case unlikely to be seen in production
25932 ## that I am not wasting more time on this right now.
25933 !! test
25934 Never serialize a-tag as html, no matter what attributes it has
25935 !! options
25936 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25937 !! html/parsoid
25938 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
25939 !! wikitext
25940 [http://boo.org http://boohoo.org]
25941 !! end
25942
25943 # Misnested is an indication that selser can reuse the source but these have
25944 # shown to sneak through on occasion. See T101768.
25945 # The original wikitext here is: [http://test.com [[one]] two three]
25946 !! test
25947 Strip span tags added to mark misnested links
25948 !! options
25949 parsoid=html2wt
25950 !! html/parsoid
25951 <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>
25952 !! wikitext
25953 [http://test.com][[one]] two three
25954 !! end
25955
25956 !! test
25957 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
25958 !! options
25959 parsoid=html2wt
25960 !! html/parsoid
25961 <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|}"]}'>
25962 <tbody><tr><td>d
25963 </td></tr>
25964 </tbody></table>
25965 !! wikitext
25966 {{echo|a}}
25967 {|{{echo|c
25968 {{!}}d
25969 }}
25970 |}
25971 !! end
25972
25973 ## This test verifies the presence and computation of this attribute indirectly
25974 ## by making an edit and ensuring that the serialization is correct (which it would be
25975 ## only if firstWikitextNode is properly set).
25976 !! test
25977 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
25978 !! options
25979 parsoid= {
25980 "modes": ["wt2wt"],
25981 "changes": [
25982 [ "div#x", "remove" ],
25983 [ "div", "before", "<div>new</div>" ]
25984 ]
25985 }
25986 !! wikitext
25987 <div id="x">foo</div>
25988 {|
25989 {{echo|<div>boo</div>
25990 {{!}}b}}
25991 |c
25992 |}
25993 !! wikitext/edited
25994
25995 <div>new</div>
25996 {|
25997 {{echo|<div>boo</div>
25998 {{!}}b}}
25999 |c
26000 |}
26001 !! end
26002
26003 # --------------------------------------------
26004 # Tests spec'ing wikitext serialization norms |
26005 # --------------------------------------------
26006
26007 !! test
26008 1. Categories should always be serialized on their own line
26009 !! options
26010 parsoid=html2wt
26011 !! html/parsoid
26012 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
26013 !! wikitext
26014 foo
26015 [[Category:Foo]]
26016 bar
26017 !! end
26018
26019 !! test
26020 2. Categories that are part of templates should not introduce a line break
26021 !! wikitext
26022 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
26023 !! html/parsoid
26024 <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>
26025 !! end
26026
26027 # Careful while editing these next 2 tests. There are \u200f characters
26028 # before and after the <link> tags in the HTML and following some
26029 # of the categories in wikitext
26030 # Do not remove these characters in edits.
26031 #
26032 # As part of the serialization, these bidi characters will get stripped.
26033 !! test
26034 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
26035 !! options
26036 parsoid={
26037 "modes": ["html2wt"],
26038 "scrubWikitext": true
26039 }
26040 !! html/parsoid
26041 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
26042 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
26043 !! wikitext
26044 [[קטגוריה:טקסים]]
26045 [[קטגוריה: שיטות משפט]]
26046 !! end
26047
26048 !! test
26049 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
26050 !! options
26051 parsoid={
26052 "modes": ["html2wt"],
26053 "scrubWikitext": true
26054 }
26055 !! html/parsoid
26056 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
26057 !! wikitext
26058 [[קטגוריה:טקסים]]
26059 ‏y
26060 !! end
26061
26062 !! test
26063 Lists: Add space after bullets
26064 !! options
26065 parsoid=html2wt
26066 !! html/parsoid
26067 <ul>
26068 <li>foo</li>
26069 <li> bar</li>
26070 <li><span> baz</span></li>
26071 </ul>
26072 !! wikitext
26073 * foo
26074 * bar
26075 * <span> baz</span>
26076 !! end
26077
26078 !! test
26079 1. Headings: Add space before/after == (T53744)
26080 !! options
26081 parsoid=html2wt
26082 !! html/parsoid
26083 <h2>foo</h2>
26084 <h2> bar</h2>
26085 <h2>baz </h2>
26086 <h2><span> baz</span></h2>
26087 !! wikitext
26088 == foo ==
26089
26090 == bar ==
26091
26092 == baz ==
26093
26094 == <span> baz</span> ==
26095 !! end
26096
26097 !! test
26098 2. Headings: Add space before/after == even after hoisted content
26099 !! options
26100 parsoid={
26101 "modes": ["html2wt"],
26102 "scrubWikitext": true
26103 }
26104 !! html/parsoid
26105 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
26106 !! wikitext
26107 [[Category:A2]]
26108
26109 == ok ==
26110 !! end
26111
26112 !! test
26113 1. Headings: suppress newly created empty headings
26114 !! options
26115 parsoid={
26116 "modes": ["html2wt"],
26117 "scrubWikitext": true
26118 }
26119 !! html/parsoid
26120 <h2></h2>
26121 !! wikitext
26122 !! end
26123
26124 !! test
26125 2. Headings: don't suppress empty headings if scrubWikitext is false
26126 !! options
26127 parsoid=html2wt
26128 !! html/parsoid
26129 <h2></h2>
26130 !! wikitext
26131 ==<nowiki/>==
26132 !! end
26133
26134 !! test
26135 3. Headings: suppress empty headings on edits
26136 !! options
26137 parsoid={
26138 "modes": ["selser"],
26139 "scrubWikitext": true,
26140 "changes": [
26141 [ "#x", "remove"]
26142 ]
26143 }
26144 !! wikitext
26145 ==<span id="x">foo</span>==
26146 !! wikitext/edited
26147 !! end
26148
26149 !! test
26150 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
26151 !! options
26152 parsoid={
26153 "modes": ["html2wt"],
26154 "scrubWikitext": true
26155 }
26156 !! html/parsoid
26157 <h2>foo<br/>bar</h2>
26158 <h2>foo <span><br/>bar</span> baz</h2>
26159 !! wikitext
26160 == foo bar ==
26161
26162 == foo <span> bar</span> baz ==
26163 !! end
26164
26165 !! test
26166 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
26167 !! options
26168 parsoid={
26169 "modes": ["html2wt"],
26170 "scrubWikitext": false
26171 }
26172 !! html/parsoid
26173 <h2>foo<br/>bar</h2>
26174 !! wikitext
26175 == foo<br> bar ==
26176 !! end
26177
26178 !! test
26179 1. WT Quote Tags: suppress newly created empty style tags
26180 !! options
26181 parsoid={
26182 "modes": ["html2wt"],
26183 "scrubWikitext": true
26184 }
26185 !! html/parsoid
26186 <i></i><b></b>
26187 !! wikitext
26188 !! end
26189
26190 !! test
26191 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
26192 !! options
26193 parsoid=html2wt
26194 !! html/parsoid
26195 <i></i><b></b>
26196 !! wikitext
26197 ''<nowiki/>'''''<nowiki/>'''
26198 !! end
26199
26200 !! test
26201 3. WT Quote Tags: suppress empty style tags on edits
26202 !! options
26203 parsoid={
26204 "modes": ["selser"],
26205 "scrubWikitext": true,
26206 "changes": [
26207 [ "#x", "remove"]
26208 ]
26209 }
26210 !! wikitext
26211 '''<span id="x">foo</span>'''
26212 !! wikitext/edited
26213 !! end
26214
26215 !! test
26216 1. Anchors: suppress newly created empty anchors
26217 !! options
26218 parsoid={
26219 "modes": ["html2wt"],
26220 "scrubWikitext": true
26221 }
26222 !! html/parsoid
26223 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26224 !! wikitext
26225 !! end
26226
26227 !! test
26228 2. Anchors: don't suppress empty anchors if scrubWikitext is false
26229 !! options
26230 parsoid={
26231 "modes": ["html2wt"],
26232 "scrubWikitext": false
26233 }
26234 !! html/parsoid
26235 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26236 !! wikitext
26237 [[Test|<nowiki/>]]
26238 !! end
26239
26240 !! test
26241 3. Anchors: suppress empty anchors on edits
26242 !! options
26243 parsoid={
26244 "modes": ["selser"],
26245 "scrubWikitext": true,
26246 "changes": [
26247 [ "#x", "remove"]
26248 ]
26249 }
26250 !! wikitext
26251 [[Test|<span id="x">foo</span>]]
26252 !! wikitext/edited
26253 !! end
26254
26255 !! test
26256 3a. Anchors: do not suppress numbered extlinks
26257 !! options
26258 parsoid={
26259 "modes": ["wt2wt"],
26260 "scrubWikitext": true
26261 }
26262 !! wikitext
26263 [http://foo.com]
26264 !! html/parsoid
26265 <a rel="mw:ExtLink" href="http://foo.com"></a>
26266 !! end
26267
26268 !! test
26269 3b. Anchors: do not suppress numbered extlinks
26270 !! options
26271 parsoid={
26272 "modes": ["wt2wt"],
26273 "scrubWikitext": true,
26274 "changes": [
26275 [ "#x", "remove"]
26276 ]
26277 }
26278 !! wikitext
26279 [http://foo.com <span id="x">foo</span>]
26280 !! wikitext/edited
26281 [http://foo.com]
26282 !! end
26283
26284 !!test
26285 Normalizations should be restricted to edited content
26286 !!options
26287 parsoid={
26288 "modes": ["selser"],
26289 "scrubWikitext": true,
26290 "changes": [
26291 [ "h1", "before", "<i></i>"]
26292 ]
26293 }
26294 !!wikitext
26295 a
26296 = =
26297 b
26298 !!wikitext/edited
26299 a
26300 = =
26301 b
26302 !!end
26303
26304 !! test
26305 1. Multiple normalizations (html2wt)
26306 !! options
26307 parsoid={
26308 "modes": ["html2wt"],
26309 "scrubWikitext": true
26310 }
26311 !! html
26312 <h2><i></i></h2>
26313 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
26314 </a><b><i></i></b>x</p>
26315 !! wikitext
26316
26317 [[foo]]
26318 x
26319
26320 !! end
26321
26322 !! test
26323 2. Multiple normalizations (selser)
26324 !! options
26325 parsoid={
26326 "modes": ["selser"],
26327 "scrubWikitext": true,
26328 "changes": [
26329 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
26330 ]
26331 }
26332 !! wikitext
26333 <span id="x">foo</span>
26334 !! wikitext/edited
26335 <span id="x">foo</span>
26336
26337 x
26338 !! end
26339
26340 !! test
26341 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
26342 !! options
26343 parsoid={
26344 "modes": ["html2wt"],
26345 "scrubWikitext": true
26346 }
26347 !! html/parsoid
26348 <p> hi</p>
26349 <p> hello</p>
26350 !! wikitext
26351 hi
26352
26353 hello
26354 !! end
26355
26356 !! test
26357 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
26358 !! options
26359 parsoid=html2wt
26360 !! html/parsoid
26361 <p> hi</p>
26362 <p> hello</p>
26363 !! wikitext
26364 <nowiki> </nowiki>hi
26365
26366 <nowiki> </nowiki> hello
26367 !! end
26368
26369 !! test
26370 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
26371 !! options
26372 parsoid={
26373 "modes": ["html2wt"],
26374 "scrubWikitext": true
26375 }
26376 !! html/parsoid
26377 <p>Foo
26378 bar
26379 baz</p>
26380
26381 <table><tr><td>Foo
26382 bar
26383 baz bang</td></tr></table>
26384
26385 <p><!--boo--> foo
26386 bar</p>
26387
26388 <p> foo
26389 bar<span>boo</span></p>
26390 !! wikitext
26391 Foo
26392 bar
26393 baz
26394
26395 {|
26396 |Foo
26397 bar
26398 baz bang
26399 |}
26400
26401 <!--boo-->foo
26402 bar
26403
26404 foo
26405 bar<span>boo</span>
26406 !! end
26407
26408 !! test
26409 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
26410 !! options
26411 parsoid={
26412 "modes": ["selser"],
26413 "scrubWikitext": true,
26414 "changes": [
26415 [ "p", "html", " a\n b" ]
26416 ]
26417 }
26418 !! wikitext
26419 xyz
26420 !! wikitext/edited
26421 a
26422 b
26423 !! end
26424
26425 !! test
26426 1. New links that end in spaces
26427 !! options
26428 parsoid={
26429 "modes": ["html2wt"],
26430 "scrubWikitext": false
26431 }
26432 !! html/parsoid
26433 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26434 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26435 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26436 !! wikitext
26437 [[Berlin ]]<nowiki/>is the capital of Germany.
26438
26439 [[Foo ]]'''bar'''
26440
26441 [[Boston ]] is a city.
26442 !! end
26443
26444 !! test
26445 2. New links that end in spaces
26446 !! options
26447 parsoid={
26448 "modes": ["html2wt"],
26449 "scrubWikitext": true
26450 }
26451 !! html/parsoid
26452 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26453 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26454 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26455 !! wikitext
26456 [[Berlin]] is the capital of Germany.
26457
26458 [[Foo]] '''bar'''
26459
26460 [[Boston]] is a city.
26461 !! end
26462
26463 !! test
26464 1. Table cells with escapable prefixes
26465 !! options
26466 parsoid={
26467 "modes": ["html2wt"],
26468 "scrubWikitext": false
26469 }
26470 !! html
26471 <table>
26472 <tr><td>a</td></tr>
26473 <tr><td>-</td></tr>
26474 <tr><td>+</td></tr>
26475 </table>
26476 !! wikitext
26477 {|
26478 |a
26479 |-
26480 |<nowiki>-</nowiki>
26481 |-
26482 |<nowiki>+</nowiki>
26483 |}
26484 !! end
26485
26486 !! test
26487 2. Table cells with escapable prefixes
26488 !! options
26489 parsoid={
26490 "modes": ["html2wt"],
26491 "scrubWikitext": true
26492 }
26493 !! html
26494 <table>
26495 <tr><td>a</td></tr>
26496 <tr><td>-</td></tr>
26497 <tr><td>+</td></tr>
26498 </table>
26499 !! wikitext
26500 {|
26501 |a
26502 |-
26503 | -
26504 |-
26505 | +
26506 |}
26507 !! end
26508
26509 !! test
26510 3a. Table cells with escapable prefixes after edits
26511 !! options
26512 parsoid={
26513 "modes": ["selser"],
26514 "scrubWikitext": true,
26515 "changes": [
26516 [ "table tbody tr:first-child td:first-child", "remove"]
26517 ]
26518 }
26519 !! wikitext
26520 {|
26521 |a||-
26522 |}
26523 !! wikitext/edited
26524 {|
26525 | -
26526 |}
26527 !! end
26528
26529 !! test
26530 3b. Table cells with escapable prefixes after edits
26531 !! options
26532 parsoid={
26533 "modes": ["selser"],
26534 "scrubWikitext": true,
26535 "changes": [
26536 [ "table tbody tr:first-child td:first-child", "html", "-" ],
26537 [ "#x", "remove" ]
26538 ]
26539 }
26540 !! wikitext
26541 {|
26542 |pqr
26543 |<span id="x">foo</span>+
26544 |}
26545 !! wikitext/edited
26546 {|
26547 | -
26548 | +
26549 |}
26550 !! end
26551
26552 # FIXME: This test will fail because
26553 # normalization doesn't realize that the id attribute
26554 # will eliminate the escapable scenario
26555 !! test
26556 4a. Table cells without escapable prefixes after edits
26557 !! options
26558 parsoid={
26559 "modes": ["selser"],
26560 "scrubWikitext": true,
26561 "changes": [
26562 [ "#x", "html", "-" ]
26563 ]
26564 }
26565 !! wikitext
26566 {|
26567 | id="x" |abcd
26568 |}
26569 !! wikitext/edited
26570 {|
26571 | id="x" |-
26572 |}
26573 !! end
26574
26575 ## This tests normalizer's ability to discriminate between
26576 ## cells having identical content.
26577 !! test
26578 4b. Table cells without escapable prefixes after edits
26579 !! options
26580 parsoid={
26581 "modes": ["selser"],
26582 "scrubWikitext": true,
26583 "changes": [
26584 [ "td", "html", "-" ]
26585 ]
26586 }
26587 !! wikitext
26588 {|
26589 |a||b
26590 |}
26591 !! wikitext/edited
26592 {|
26593 | -||-
26594 |}
26595 !! end
26596
26597 ## This tests normalizer's ability to not be tripped by
26598 ## comments (and whitespace)
26599 !! test
26600 4c. Table cells without escapable prefixes after edits
26601 !! options
26602 parsoid={
26603 "modes": ["selser"],
26604 "scrubWikitext": true,
26605 "changes": [
26606 [ "table tbody tr td:first-child", "remove" ]
26607 ]
26608 }
26609 !! wikitext
26610 {|
26611 |-
26612 <!--foo--> |a||-
26613 |}
26614 !! wikitext/edited
26615 {|
26616 |-
26617 <!--foo--> | -
26618 |}
26619 !! end
26620
26621 ## This tests normalizer's ability to handle HTML cells
26622 !! test
26623 4d. Table cells without escapable prefixes after edits
26624 !! options
26625 parsoid={
26626 "modes": ["selser"],
26627 "scrubWikitext": true,
26628 "changes": [
26629 [ "td", "html", "-" ]
26630 ]
26631 }
26632 !! wikitext
26633 <table>
26634 <tr><td>a</td></tr>
26635 </table>
26636 !! wikitext/edited
26637 <table>
26638 <tr><td>-</td></tr>
26639 </table>
26640 !! end
26641
26642 ## T111151 Remove font elements without attributes
26643 !! test
26644 5a. font tags without attributes should be dropped in scrubWikitext mode
26645 !! options
26646 parsoid={
26647 "modes": ["html2wt"],
26648 "scrubWikitext": true
26649 }
26650 !! html
26651 <font>foo</font>
26652 <font><font>bar</font></font>
26653 <font class="x">boo</font>
26654 !! wikitext
26655 foo
26656 bar
26657 <font class="x">boo</font>
26658 !! end
26659
26660 !! test
26661 5b. font tags should not be dropped without scrubWikitext being enabled
26662 !! options
26663 parsoid={
26664 "modes": ["html2wt"],
26665 "scrubWikitext": false
26666 }
26667 !! html
26668 <font>foo</font>
26669 !! wikitext
26670 <font>foo</font>
26671 !! end
26672
26673 !! test
26674 Escape nowiki DOM elements
26675 !! options
26676 parsoid=html2wt
26677 !! html/parsoid
26678 <nowiki><i>foo</i></nowiki>
26679 !! wikitext
26680 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
26681 !! end
26682
26683 # This is meant to be an interim fix while we go about figuring out
26684 # how to not introduce these trailing <nowiki/>s in the first place.
26685 !! test
26686 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
26687 !! options
26688 parsoid=html2wt
26689 !! html/parsoid
26690 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
26691 y</p>
26692 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[0,23,null,null],"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>
26693 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[0,24,null,null],"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>
26694 !! wikitext
26695 x
26696 y
26697
26698 {{echo|
26699 1 = <nowiki/>}}
26700
26701 {{echo|
26702 1 = <nowiki/>
26703 }}
26704 !! end
26705
26706 # ---------------------------------------------------
26707 # End of tests spec'ing wikitext serialization norms |
26708 # ---------------------------------------------------
26709
26710 # T104032
26711 !! test
26712 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
26713 !! options
26714 parsoid=html2wt
26715 !! html/parsoid
26716 a<p>b</p>
26717 <b>c</b><p>d</p>
26718 <table><tr>
26719 <td>a<p>b</p></td>
26720 <td><b>c</b><p>d</p></td>
26721 </tr></table>
26722 !! wikitext
26723 a
26724
26725 b
26726
26727 '''c'''
26728
26729 d
26730 {|
26731 |a
26732 b
26733 |'''c'''
26734 d
26735 |}
26736 !! end
26737
26738 # -----------------------------------------------------------------
26739 # End of section for Parsoid-only html2wt tests for serialization
26740 # of new content
26741 # -----------------------------------------------------------------
26742
26743 # -----------------------------------------------------------------
26744 # The following section of tests are primarily to spec behavior of
26745 # the selective serializer. All these tests have manual selser
26746 # changes. The automated selser changes for all tests handle the
26747 # wide variation of changes, but these tests here capture specs
26748 # deterministically.
26749 # ----------------------------------------------------------------
26750
26751 ## T90517
26752 !! test
26753 Selser: New comments should not be lost
26754 !! options
26755 parsoid={
26756 "modes": ["selser"],
26757 "changes": [
26758 [ "#a", "after", "<!--c1-->" ],
26759 [ "#b", "before", "<!--c2-->" ]
26760 ]
26761 }
26762 !! wikitext
26763 <span id="a">a</span>
26764
26765 <span id="b">b</span>
26766 !! wikitext/edited
26767 <span id="a">a</span><!--c1-->
26768
26769 <!--c2--><span id="b">b</span>
26770 !! end
26771
26772 ## T89383
26773 !! test
26774 Selser: Check for validity of DSR before using it
26775 !! options
26776 parsoid={
26777 "modes": ["selser"],
26778 "changes": [
26779 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
26780 ]
26781 }
26782 !! wikitext
26783 <span id="a">a</span>
26784 !! wikitext/edited
26785 {{DISPLAYTITLE:foo}}
26786 <span id="a">a</span>
26787 !! end
26788
26789 !! test
26790 1. DOMDiff: Changes to <ref> content should be looked up using id
26791 !! options
26792 parsoid={
26793 "modes": ["selser"],
26794 "changes": [
26795 ["#X", "after", "bar"],
26796 ["#Y", "after", "baz"]
26797 ]
26798 }
26799 !! wikitext
26800 X <ref><span id="X">foo</span></ref>
26801 Y <ref name="a" />
26802 <references>
26803 <ref name="a"><span id="Y">foo</span></ref>
26804 </references>
26805 !! wikitext/edited
26806 X <ref><span id="X">foo</span>bar</ref>
26807 Y <ref name="a" />
26808 <references>
26809 <ref name="a"><span id="Y">foo</span>baz</ref>
26810 </references>
26811 !! end
26812
26813 !! test
26814 2. DOMDiff: Changes to <ref> content should be looked up using id
26815 !! options
26816 parsoid={
26817 "modes": ["selser"],
26818 "changes": [
26819 ["#Z", "after", "bar"]
26820 ]
26821 }
26822 !! wikitext
26823 A <ref>foo bar for a</ref>
26824 B <ref group="X" name="b" />
26825
26826 <references />
26827
26828 <references group="X">
26829 <ref name="b"><span id="Z">foo</span></ref>
26830 </references>
26831 !! wikitext/edited
26832 A <ref>foo bar for a</ref>
26833 B <ref group="X" name="b" />
26834
26835 <references />
26836
26837 <references group="X">
26838 <ref name="b"><span id="Z">foo</span>bar</ref>
26839 </references>
26840 !! end
26841
26842 !! test
26843 Empty LI (T49673)
26844 !! wikitext
26845 * a
26846 *
26847 *
26848 * b
26849 !! html/php+tidy
26850 <ul>
26851 <li>a</li>
26852 <li class="mw-empty-li"></li>
26853 <li class="mw-empty-li"></li>
26854 <li>b</li>
26855 </ul>
26856 !! end