Merge "Throw an exception when the $key argument to hash_hmac is not a string"
[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|a <nowiki>}}</nowiki> b}}
1544 {{echo|<nowiki>a [[ b</nowiki>}}
1545 {{echo|a {{!}} <nowiki>{{ ]]</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 ## PHP parser discards the "<pre " string
2523 !! test
2524 Handle broken pre-like tags (bug 64025)
2525 !! options
2526 parsoid=wt2html
2527 !! wikitext
2528 {{echo|<pre <pre>x</pre>}}
2529
2530 <table><pre </table>
2531 !! html/php
2532 <pre>x</pre>
2533 <table><pre></pre></table>
2534
2535 !! html/parsoid
2536 <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>
2537
2538
2539 <p>&lt;pre </p>
2540
2541 <table></table>
2542 !! end
2543
2544 !! test
2545 Parsoid: handle pre with space after attribute
2546 !! options
2547 parsoid=wt2html
2548 !! wikitext
2549 <pre style="width:50%;" >{{echo|foo}}</pre>
2550 !! html/php
2551 <pre style="width:50%;">{{echo|foo}}</pre>
2552
2553 !! html/parsoid
2554 <pre style="width:50%;">{{echo|foo}}</pre>
2555 !! end
2556
2557 # TODO / maybe: fix wt2wt for this
2558 !! test
2559 Parsoid: Don't paragraph-wrap fosterable content
2560 !! options
2561 parsoid=wt2html
2562 !! wikitext
2563 {|
2564 <td></td>
2565 <td></td>
2566
2567
2568
2569 |}
2570 !! html
2571 <table>
2572
2573 <tbody>
2574 <tr>
2575 <td></td>
2576
2577 <td></td></tr>
2578
2579
2580
2581 </tbody></table>
2582 !! end
2583
2584 !! test
2585 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2586 !! options
2587 parsoid=wt2html
2588 !! wikitext
2589 {|
2590 <td>
2591 <td>
2592 </td>
2593
2594
2595
2596 |}
2597 !! html
2598 <table>
2599
2600 <tbody>
2601 <tr>
2602 <td></td>
2603
2604 <td>
2605 </td></tr>
2606
2607
2608
2609 </tbody></table>
2610 !! end
2611
2612
2613 #--------------------------------------------------------------------
2614 # Transclusion parameter whitespace stripping tests
2615 # Behavior is different for positional and named parameters
2616 #--------------------------------------------------------------------
2617 !! test
2618 Templates: Strip leading and trailing whitespace from named-param values
2619 !! wikitext
2620 {{echo|1= a }}
2621
2622 {{echo|1= {{echo|b}} }}
2623
2624 {{echo| 1 =
2625 c }}
2626
2627 {{echo| 1 =
2628 * d
2629 }}
2630 !! html
2631 <p>a
2632 </p><p>b
2633 </p><p>c
2634 </p>
2635 <ul><li> d</li></ul>
2636
2637 !! end
2638
2639 !! test
2640 Templates: Don't strip whitespace from positional-param values
2641 !! wikitext
2642 {{echo|a }}
2643
2644 {{echo|{{echo|b}} }}
2645
2646 {{echo| c
2647 }}
2648
2649 {{echo| {{echo|d}}
2650 }}
2651
2652 {{echo|
2653 e}}
2654
2655 {{echo|
2656 * f}}
2657
2658 {{echo|
2659 }}g
2660 !! html
2661 <p>a
2662 </p><p>b
2663 </p>
2664 <pre>c
2665 </pre>
2666 <p><br />
2667 </p>
2668 <pre>d
2669 </pre>
2670 <p><br />
2671 </p>
2672 <pre>e
2673 </pre>
2674 <p><br />
2675 </p>
2676 <ul><li> f</li></ul>
2677 <p><br />
2678 </p>
2679 <pre>g
2680 </pre>
2681 !! end
2682
2683 !! test
2684 Templates: Handle empty comment-and-ws-only lines correctly
2685 !! wikitext
2686 {{echo|foo
2687 <!--should be ignored-->
2688 <!--should be ignored as well-->
2689 bar}}
2690 !! html
2691 <p>foo
2692 bar
2693 </p>
2694 !! end
2695
2696 !! test
2697 Templates: Handle comments in the target
2698 !! wikitext
2699 {{echo
2700 <!-- should be ignored -->
2701 |foo}}
2702
2703 {{echo<!-- should be ignored -->
2704 |foo}}
2705
2706 {{echo<!-- should be ignored -->|foo}}
2707
2708 {{<!-- should be ignored -->echo|foo}}
2709 !!html/parsoid
2710 <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>
2711
2712 <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>
2713
2714 <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>
2715
2716 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2717 !!end
2718
2719 !! test
2720 Templates: Handle comments in parameter names (bug 67657)
2721 !! wikitext
2722 {{echo|1
2723 <!-- should be ignored -->
2724 =foo}}
2725
2726 {{echo|
2727 <!-- should be ignored -->
2728 1 = foo}}
2729
2730 {{echo|1<!-- should be ignored -->=foo}}
2731
2732 {{echo|<!-- should be ignored -->1=foo}}
2733 !!html/parsoid
2734 <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>
2735
2736 <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>
2737
2738 <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>
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 -->1"}}},"i":0}}]}'>foo</p>
2741 !!end
2742
2743 !! test
2744 Templates: Other wikitext in parameter names (bug 67657)
2745 !! wikitext
2746 {{echo|''1''=foo}}
2747 !!html/parsoid
2748 <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>
2749 !!html/php
2750 <p>{{{1}}}
2751 </p>
2752 !!end
2753
2754 #--------------------------------------------------------------------
2755 # Transclusion parameter escaping tests
2756 #--------------------------------------------------------------------
2757 !! test
2758 Templates: Parsoid parameter escaping test 1
2759 !! wikitext
2760 {{echo|[foo]|{{echo|[bar]}}}}
2761 !! html/php+tidy
2762 <p>[foo]</p>
2763 !! html/parsoid
2764 <p about="#mwt1" typeof="mw:Transclusion"
2765 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2766 !! end
2767
2768 !! test
2769 Parsoid: Pipes in external links in template parameter
2770 !! wikitext
2771 {{echo|[{{echo|http://example.com}} link]}}
2772 !! html/php+tidy
2773 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2774 !! html/parsoid
2775 <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>
2776 !! end
2777
2778 !! test
2779 Parsoid: pipe in transclusion parameter
2780 !! wikitext
2781 {{echo|http://foo.com/a&#124;b}}
2782 !! html/php+tidy
2783 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2784 !! html/parsoid
2785 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2786 typeof="mw:Transclusion"
2787 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>
2788 !! end
2789
2790 !! test
2791 Parsoid: Pipe in external link target and content in template parameter
2792 !! options
2793 parsoid=html2wt,wt2wt
2794 !! wikitext
2795 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2796 !! html/php+tidy
2797 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2798 !! html/parsoid
2799 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2800 typeof="mw:Transclusion"
2801 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2802 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2803 !! end
2804
2805 !! test
2806 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2807 !! options
2808 parsoid
2809 !! wikitext
2810 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2811 !! html
2812 <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>
2813 !! end
2814
2815 !! test
2816 Templates: Don't escape already nowiki-escaped text in template parameters
2817 !! options
2818 parsoid=html2wt,wt2wt
2819 !! wikitext
2820 {{echo|foo<nowiki>|</nowiki>bar}}
2821 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2822 {{echo|<nowiki></nowiki>}}
2823 !! html/php+tidy
2824 <p>foo|bar &lt;div&gt;</p>
2825 !! html/parsoid
2826 <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>
2827 <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>
2828 <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>
2829 </p>
2830 !! end
2831
2832 ## Bug 52824
2833 !! test
2834 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2835 !! options
2836 parsoid=html2wt,wt2wt
2837 !! wikitext
2838 {{echo|{{echo|1=bar}}}}
2839 !! html/php+tidy
2840 <p>bar</p>
2841 !! html/parsoid
2842 <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>
2843 !! end
2844
2845 ## Bug 56733
2846 !! test
2847 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2848 !! wikitext
2849 {{echo|a : b}}
2850 !! html/php+tidy
2851 <p>a&#160;: b</p>
2852 !! html/parsoid
2853 <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>
2854 !! end
2855
2856 ## Bug T73412
2857 !! test
2858 Templates: Preserve blank parameter names
2859 !! wikitext
2860 {{echo|=foo}}
2861 !! html/php+tidy
2862 <p>{{{1}}}</p>
2863 !! html/parsoid
2864 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2865 !! end
2866
2867 !! test
2868 Templates: Preserve blank parameter names in other positions
2869 !! wikitext
2870 {{blank_param|bar|=foo}}
2871 !! html/php+tidy
2872 <p>bar foo</p>
2873 !! html/parsoid
2874 <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
2875 foo</p>
2876 !! end
2877
2878 ###
2879 ### Parsoid-centric tests for testing RT edge cases for pre
2880 ###
2881
2882 !!test
2883 1a. Indent-Pre and Comments
2884 !! wikitext
2885 a
2886 <!--a-->
2887 c
2888 !! html
2889 <pre>a
2890 </pre>
2891 <p>c
2892 </p>
2893 !!end
2894
2895 !!test
2896 1b. Indent-Pre and Comments
2897 !! wikitext
2898 a
2899 <!--a-->
2900 c
2901 !! html
2902 <pre>a
2903 </pre>
2904 <p>c
2905 </p>
2906 !!end
2907
2908 !!test
2909 1c. Indent-Pre and Comments
2910 !! wikitext
2911 <!--a--> a
2912
2913 <!--a--> a
2914 !! html
2915 <pre> a
2916 </pre>
2917 <pre> a
2918 </pre>
2919 !!end
2920
2921 !!test
2922 1d. Indent-Pre and Comments
2923 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2924 !! wikitext
2925 <!--a--> a
2926
2927 <!--b-->b
2928 !! html
2929 <pre>a
2930 </pre>
2931 <pre>b
2932 </pre>
2933 !!end
2934
2935 !!test
2936 2a. Indent-Pre and tables
2937 !! wikitext
2938 {|
2939 |-
2940 !h1!!h2
2941 |foo||bar
2942 |}
2943 !! html
2944 <table>
2945
2946 <tr>
2947 <th>h1</th>
2948 <th>h2
2949 </th>
2950 <td>foo</td>
2951 <td>bar
2952 </td></tr></table>
2953
2954 !!end
2955
2956 !!test
2957 2b. Indent-Pre and tables
2958 !! wikitext
2959 {|
2960 |-
2961 |foo
2962 |}
2963 !! html
2964 <table>
2965
2966 <tr>
2967 <td>foo
2968 </td></tr></table>
2969
2970 !!end
2971
2972 !!test
2973 2c. Indent-Pre and tables (bug 42252)
2974 !! wikitext
2975 {|
2976 |+ foo
2977 ! | bar
2978 |}
2979 !! html
2980 <table>
2981 <caption> foo
2982 </caption>
2983 <tr>
2984 <th> bar
2985 </th></tr></table>
2986
2987 !!end
2988
2989 !!test
2990 2d. Indent-Pre and tables
2991 !! wikitext
2992 a
2993 {|
2994 | b
2995 |}
2996 !! html/php
2997 <pre>a
2998 </pre>
2999 <table>
3000 <tr>
3001 <td> b
3002 </td></tr></table>
3003
3004 !! html/parsoid
3005 <pre>a</pre>
3006 <table>
3007 <tbody><tr><td> b</td></tr>
3008 </tbody></table>
3009 !!end
3010
3011 !!test
3012 2e. Indent-Pre and table-line syntax
3013 !! wikitext
3014 a
3015 | b
3016 | c
3017 !! html/php
3018 <pre>a
3019 | b
3020 | c
3021 </pre>
3022 !!end
3023
3024 !!test
3025 2f. Indent-pre started by table-line syntax
3026 !! wikitext
3027 a
3028 | b
3029 | c
3030 !! html/php
3031 <p>a
3032 </p>
3033 <pre>| b
3034 | c
3035 </pre>
3036 !! html/parsoid
3037 <p>a</p>
3038 <pre>
3039 | b
3040 | c</pre>
3041 !!end
3042
3043 !!test
3044 3a. Indent-Pre and block tags (single-line html)
3045 !! wikitext
3046 a <p> foo </p>
3047 b <div> foo </div>
3048 c <blockquote> foo </blockquote>
3049 <span> foo </span>
3050 !! html
3051 a <p> foo </p>
3052 b <div> foo </div>
3053 c <blockquote> foo </blockquote>
3054 <pre><span> foo </span>
3055 </pre>
3056 !! html/parsoid
3057 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3058 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3059 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3060 <pre><span> foo </span>
3061 </pre>
3062 !! html+tidy
3063 <p>a</p>
3064 <p>foo</p>
3065 <p>b</p>
3066 <div>foo</div>
3067 <p>c</p>
3068 <blockquote>
3069 <p>foo</p>
3070 </blockquote>
3071 <pre>
3072 <span> foo </span>
3073 </pre>
3074 !! end
3075
3076 !!test
3077 3b. Indent-Pre and block tags (multi-line html)
3078 !! wikitext
3079 a <span>foo</span>
3080 b <div> foo </div>
3081 !! html
3082 <pre>a <span>foo</span>
3083 </pre>
3084 b <div> foo </div>
3085
3086 !! html/parsoid
3087 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3088 b <div data-parsoid='{"stx":"html"}'> foo </div>
3089 !! html+tidy
3090 <pre>
3091 a <span>foo</span>
3092 </pre>
3093 <p>b</p>
3094 <div>foo</div>
3095 !!end
3096
3097 !!test
3098 3c. Indent-Pre and block tags (pre-content on separate line)
3099 !! wikitext
3100 <p>
3101 foo
3102 </p>
3103
3104 <div>
3105 foo
3106 </div>
3107
3108 <center>
3109 foo
3110 </center>
3111
3112 <blockquote>
3113 foo
3114 </blockquote>
3115
3116 <blockquote>
3117 <pre>
3118 foo
3119 </pre>
3120 </blockquote>
3121
3122 <table><tr><td>
3123 foo
3124 </td></tr></table>
3125
3126 <ul><li>
3127 foo
3128 </li></ul>
3129
3130 !! html
3131 <p>
3132 foo
3133 </p>
3134 <div>
3135 <pre>foo
3136 </pre>
3137 </div>
3138 <center>
3139 <pre>foo
3140 </pre>
3141 </center>
3142 <blockquote>
3143 <p> foo
3144 </p>
3145 </blockquote>
3146 <blockquote>
3147 <pre>
3148 foo
3149 </pre>
3150 </blockquote>
3151 <table><tr><td>
3152 <pre>foo
3153 </pre>
3154 </td></tr></table>
3155 <ul><li>
3156 foo
3157 </li></ul>
3158
3159 !!end
3160
3161 !!test
3162 4. Indent-Pre and extension tags
3163 !! wikitext
3164 a <gallery>
3165 File:foobar.jpg
3166 </gallery>
3167 !! html
3168 a <ul class="gallery mw-gallery-traditional">
3169 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
3170 <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>
3171 <div class="gallerytext">
3172 </div>
3173 </div></li>
3174 </ul>
3175
3176 !! html+tidy
3177 <p>a</p>
3178 <ul class="gallery mw-gallery-traditional">
3179 <li class="gallerybox" style="width: 155px">
3180 <div style="width: 155px">
3181 <div class="thumb" style="width: 150px;">
3182 <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>
3183 </div>
3184 <div class="gallerytext"></div>
3185 </div>
3186 </li>
3187 </ul>
3188 !!end
3189
3190 !! test
3191 Table wikitext syntax outside wiki-tables
3192 !! wikitext
3193 a
3194 ! not a table heading
3195 |- not a table row
3196 | not a table cell
3197 | class="foo bar" | baz
3198 b
3199 |}
3200 |-
3201 c
3202 !! html
3203 <p>a
3204 ! not a table heading
3205 |- not a table row
3206 | not a table cell
3207 | class="foo bar" | baz
3208 b
3209 |}
3210 |-
3211 c
3212 </p>
3213 !! end
3214
3215 !!test
3216 Render paragraphs when indent-pre is suppressed in blocklevels
3217 !! wikitext
3218 <blockquote>
3219 foo
3220
3221 bar
3222 </blockquote>
3223 !! html
3224 <blockquote>
3225 <p> foo
3226 </p><p> bar
3227 </p>
3228 </blockquote>
3229
3230 !!end
3231
3232 !!test
3233 4. Multiple spaces at start-of-line
3234 !! wikitext
3235 <p> foo </p>
3236 foo
3237 {|
3238 |foo
3239 |}
3240 !! html
3241 <p> foo </p>
3242 <pre> foo
3243 </pre>
3244 <table>
3245 <tr>
3246 <td>foo
3247 </td></tr></table>
3248
3249 !!end
3250
3251 ## NOTE: the leading white-space chars on empty line are significant
3252 !! test
3253 5a. White-space in indent-pre
3254 !! wikitext
3255 a<br />
3256
3257 b
3258 !! html
3259 <pre>a<br />
3260
3261 b
3262 </pre>
3263 !! end
3264
3265 ## NOTE: the leading white-space chars on empty line are significant
3266 !! test
3267 5b. White-space in indent-pre
3268 !! wikitext
3269 a
3270
3271 b
3272
3273
3274 c
3275 !! html
3276 <pre>a
3277
3278 b
3279
3280
3281 c
3282 </pre>
3283 !! end
3284
3285 !! test
3286 5c. White-space in indent-pre
3287 !! wikitext
3288 ''a''
3289 ''b''
3290 ''c''
3291 !! html
3292 <pre><i>a</i>
3293 <i>b</i>
3294 <i>c</i>
3295 </pre>
3296 !! end
3297
3298 !! test
3299 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3300 !! wikitext
3301 a
3302
3303 <!-- continue -->
3304 b
3305
3306 c
3307
3308 d
3309 !! html
3310 <pre>a
3311
3312 b
3313 </pre>
3314 <pre>c
3315
3316 </pre>
3317 <p>d
3318 </p>
3319 !! end
3320
3321 !! test
3322 7a. Indent-pre and category links
3323 !! options
3324 parsoid=wt2html,wt2wt
3325 !! wikitext
3326 [[Category:foo]] <!-- No pre-wrapping -->
3327 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3328 !! html/php+tidy
3329 !! html/parsoid
3330 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3331 <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 -->
3332 !! end
3333
3334 ## We used to, but no longer wt2wt this test since the default serializer
3335 ## will normalize all categories to serialize on their own line.
3336 ## This wikitext usage is going to be fairly uncommon in production and
3337 ## selser will take care of preserving formatting in those scenarios.
3338 !! test
3339 7b. Indent-pre and category links
3340 !! options
3341 parsoid=wt2html
3342 !! wikitext
3343 [[Category:foo]] a
3344 [[Category:foo]] {{echo|b}}
3345 !! html/parsoid
3346 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3347 <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>
3348 !! end
3349
3350 !! test
3351 Indent-Pre: Newlines in comments shouldn't affect sol state
3352 !! wikitext
3353 a <!--
3354 foo
3355 --> b
3356 !! html/php+tidy
3357 <p>a b</p>
3358 !! html/parsoid
3359 <p>a <!--
3360 foo
3361 --> b</p>
3362 !! end
3363
3364 ###
3365 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3366 ###
3367
3368 !!test
3369 HTML-pre: 1. embedded newlines
3370 !! wikitext
3371 <pre>foo</pre>
3372
3373 <pre>
3374 foo
3375 </pre>
3376
3377 <pre>
3378
3379 foo
3380 </pre>
3381
3382 <pre>
3383
3384
3385 foo
3386 </pre>
3387 !! html/php+tidy
3388 <pre>
3389 foo
3390 </pre>
3391 <pre>
3392 foo
3393 </pre>
3394 <pre>
3395
3396 foo
3397 </pre>
3398 <pre>
3399
3400
3401 foo
3402 </pre>
3403 !! html/parsoid
3404 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3405
3406 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3407 foo
3408 </pre>
3409
3410 <pre data-parsoid='{"stx":"html"}'>
3411
3412 foo
3413 </pre>
3414
3415 <pre data-parsoid='{"stx":"html"}'>
3416
3417
3418 foo
3419 </pre>
3420 !!end
3421
3422 !! test
3423 HTML-pre: big spaces
3424 !! wikitext
3425 <pre>
3426
3427
3428
3429
3430 haha
3431
3432
3433
3434
3435 haha
3436
3437
3438
3439
3440 </pre>
3441 !! html/php+tidy
3442 <pre>
3443
3444
3445
3446
3447 haha
3448
3449
3450
3451
3452 haha
3453
3454
3455
3456
3457 </pre>
3458 !! html/parsoid
3459 <pre data-parsoid='{"stx":"html"}'>
3460
3461
3462
3463
3464 haha
3465
3466
3467
3468
3469 haha
3470
3471
3472
3473
3474 </pre>
3475 !! end
3476
3477 !!test
3478 HTML-pre: 2: indented text
3479 !! wikitext
3480 <pre>
3481 foo
3482 </pre>
3483 !! html
3484 <pre>
3485 foo
3486 </pre>
3487
3488 !!end
3489
3490 !!test
3491 HTML-pre: 3: other wikitext
3492 !! wikitext
3493 <pre>
3494 * foo
3495 # bar
3496 = no-h =
3497 '' no-italic ''
3498 [[ NoLink ]]
3499 </pre>
3500 !! html/php
3501 <pre>
3502 * foo
3503 # bar
3504 = no-h =
3505 '' no-italic ''
3506 [[ NoLink ]]
3507 </pre>
3508
3509 !! html/parsoid
3510 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3511 # bar
3512 = no-h =
3513 '' no-italic ''
3514 [[ NoLink ]]
3515 </pre>
3516 !!end
3517
3518 ###
3519 ### Definition lists
3520 ###
3521 !! test
3522 Simple definition
3523 !! wikitext
3524 ; name : Definition
3525 !! html
3526 <dl><dt> name&#160;</dt>
3527 <dd> Definition</dd></dl>
3528
3529 !! end
3530
3531 !! test
3532 Definition list for indentation only
3533 !! wikitext
3534 : Indented text
3535 !! html
3536 <dl><dd> Indented text</dd></dl>
3537
3538 !! end
3539
3540 !! test
3541 Definition list with no space
3542 !! wikitext
3543 ;name:Definition
3544 !! html
3545 <dl><dt>name</dt>
3546 <dd>Definition</dd></dl>
3547
3548 !!end
3549
3550 !! test
3551 Definition list with URL link
3552 !! wikitext
3553 ; http://example.com/ : definition
3554 !! html
3555 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3556 <dd> definition</dd></dl>
3557
3558 !! end
3559
3560 !! test
3561 Definition list with bracketed URL link
3562 !! wikitext
3563 ;[http://www.example.com/ Example]:Something about it
3564 !! html
3565 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3566 <dd>Something about it</dd></dl>
3567
3568 !! end
3569
3570 !! test
3571 Definition list with wikilink containing colon
3572 !! wikitext
3573 ; [[Help:FAQ]]: The least-read page on Wikipedia
3574 !! html
3575 <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>
3576 <dd> The least-read page on Wikipedia</dd></dl>
3577
3578 !! end
3579
3580 # At Brion's and JeLuF's insistence... :)
3581 !! test
3582 Definition list with news link containing colon
3583 !! wikitext
3584 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3585 !! html/php
3586 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3587 <dd> This isn't even a real newsgroup!</dd></dl>
3588
3589 !! html/parsoid
3590 <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>
3591 !! end
3592
3593 !! test
3594 Malformed definition list with colon
3595 !! wikitext
3596 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3597 !! html
3598 <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>
3599
3600 !! end
3601
3602 !! test
3603 Definition lists: colon in external link text
3604 !! wikitext
3605 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3606 !! html
3607 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3608 <dd> OK, I made that up</dd></dl>
3609
3610 !! end
3611
3612 !! test
3613 Definition lists: colon in HTML attribute
3614 !! wikitext
3615 ;<b style="display: inline">bold</b>
3616 !! html
3617 <dl><dt><b style="display: inline">bold</b></dt></dl>
3618
3619 !! end
3620
3621 !! test
3622 Definition lists: self-closed tag
3623 !! wikitext
3624 ;one<br/>two : two-line fun
3625 !! html
3626 <dl><dt>one<br />two&#160;</dt>
3627 <dd> two-line fun</dd></dl>
3628
3629 !! end
3630
3631 !! test
3632 Bug 11748: Literal closing tags
3633 !! wikitext
3634 <dl>
3635 <dt>test 1</dt>
3636 <dd>test test test test test</dd>
3637 <dt>test 2</dt>
3638 <dd>test test test test test</dd>
3639 </dl>
3640 !! html
3641 <dl>
3642 <dt>test 1</dt>
3643 <dd>test test test test test</dd>
3644 <dt>test 2</dt>
3645 <dd>test test test test test</dd>
3646 </dl>
3647
3648 !! end
3649
3650 !! test
3651 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3652 !! wikitext
3653 <ul><li>
3654 ; term : description
3655 * unordered
3656 </li></ul>
3657 !! html
3658 <ul><li>
3659 <dl><dt> term&#160;</dt>
3660 <dd> description</dd></dl>
3661 <ul><li> unordered</li></ul>
3662 </li></ul>
3663
3664 !! end
3665
3666 !! test
3667
3668 Definition list with empty definition and following paragraph
3669 !! wikitext
3670 ; term:
3671 Paragraph text
3672 !! html
3673 <dl><dt> term</dt>
3674 <dd></dd></dl>
3675 <p>Paragraph text
3676 </p>
3677 !! end
3678
3679 !! test
3680 Nested definition lists using html syntax
3681 !! wikitext
3682 <dl><dt>x</dt>
3683 <dd>a</dd>
3684 <dd>b</dd></dl>
3685
3686 !! end
3687
3688 !! test
3689 Definition Lists: No nesting: Multiple dd's
3690 !! wikitext
3691 ;x
3692 :a
3693 :b
3694 !! html
3695 <dl><dt>x</dt>
3696 <dd>a</dd>
3697 <dd>b</dd></dl>
3698
3699 !! end
3700
3701 !! test
3702 Definition Lists: Indentation: Regular
3703 !! wikitext
3704 :i1
3705 ::i2
3706 :::i3
3707 !! html
3708 <dl><dd>i1
3709 <dl><dd>i2
3710 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3711
3712 !! end
3713
3714 !! test
3715 Definition Lists: Indentation: Missing 1st level
3716 !! wikitext
3717 ::i2
3718 :::i3
3719 !! html
3720 <dl><dd><dl><dd>i2
3721 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3722
3723 !! end
3724
3725 !! test
3726 Definition Lists: Indentation: Multi-level indent
3727 !! wikitext
3728 :::i3
3729 !! html
3730 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3731
3732 !! end
3733
3734 !! test
3735 Definition Lists: Hacky use to indent tables
3736 !! wikitext
3737 ::{|
3738 |foo
3739 |bar
3740 |}
3741 this text
3742 should be left alone
3743 !! html
3744 <dl><dd><dl><dd><table>
3745 <tr>
3746 <td>foo
3747 </td>
3748 <td>bar
3749 </td></tr></table></dd></dl></dd></dl>
3750 <p>this text
3751 should be left alone
3752 </p>
3753 !! end
3754
3755 !! test
3756 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3757 !! wikitext
3758 <!-- foo -->
3759 ::{|
3760 |foo
3761 |bar
3762 |}<!-- bar -->
3763 this text
3764 should be left alone
3765 !! html/parsoid
3766 <!-- foo -->
3767 <dl><dd><dl><dd><table><tr>
3768 <td>foo</td>
3769 <td>bar</td>
3770 </tr></table><!-- bar --></dd></dl></dd></dl>
3771 <p>this text
3772 should be left alone</p>
3773 !! end
3774
3775 !! test
3776 Definition Lists: Hacky use to indent tables, with comment before table
3777 !! wikitext
3778 ::<!-- foo -->{|
3779 |foo
3780 |}
3781 !! html/parsoid
3782 <dl><dd><dl><dd><!-- foo --><table><tr>
3783 <td>foo</td>
3784 </tr></table></dd></dl></dd></dl>
3785 !! end
3786
3787 # The trailing whitespace in this test is to catch a regression in
3788 # Parsoid after T54473.
3789 !! test
3790 Definition Lists: Hacky use to indent tables (WS-insensitive)
3791 !! wikitext
3792 : {|
3793 |a
3794 |}
3795 !! html/php
3796 <dl><dd><table>
3797 <tr>
3798 <td>a
3799 </td></tr></table></dd></dl>
3800
3801 !! html/parsoid
3802 <dl><dd> <table>
3803 <tbody><tr><td>a</td></tr>
3804 </tbody></table> </dd></dl>
3805 !! end
3806
3807 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3808 ## as an empty dt item. It also ignores all but the last ";" when followed
3809 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3810 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3811 ## ";"s.
3812 ##
3813 ## Ex: ";;t2 ::d2" is transformed into:
3814 ##
3815 ## <dl>
3816 ## <dt>t2 </dt>
3817 ## <dd>
3818 ## <dl>
3819 ## <dt></dt>
3820 ## <dd>d2</dd>
3821 ## </dl>
3822 ## </dd>
3823 ## </dl>
3824 ##
3825 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3826 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3827 ##
3828 ## <dl>
3829 ## <dt>
3830 ## <dl>
3831 ## <dt>t2 </dt>
3832 ## <dd>:d2</dd>
3833 ## </dl>
3834 ## </dt>
3835 ## </dl>
3836 ##
3837 ## All Parsoid only definition list tests have this difference.
3838 ##
3839 ## See also: https://phabricator.wikimedia.org/T8569
3840 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3841
3842 !! test
3843 Table / list interaction: indented table with lists in table contents
3844 !! wikitext
3845 :{|
3846 |-
3847 | a
3848 * b
3849 |-
3850 | c
3851 * d
3852 |}
3853 !! html
3854 <dl><dd><table>
3855
3856 <tr>
3857 <td> a
3858 <ul><li> b</li></ul>
3859 </td></tr>
3860 <tr>
3861 <td> c
3862 <ul><li> d</li></ul>
3863 </td></tr></table></dd></dl>
3864
3865 !! end
3866
3867 !!test
3868 Table / list interaction: lists nested in tables nested in indented lists
3869 !! wikitext
3870 :{|
3871 |
3872 :a
3873 :b
3874 |
3875 *c
3876 *d
3877 |}
3878
3879 *e
3880 *f
3881 !! html
3882 <dl><dd><table>
3883 <tr>
3884 <td>
3885 <dl><dd>a</dd>
3886 <dd>b</dd></dl>
3887 </td>
3888 <td>
3889 <ul><li>c</li>
3890 <li>d</li></ul>
3891 </td></tr></table></dd></dl>
3892 <ul><li>e</li>
3893 <li>f</li></ul>
3894
3895 !!end
3896
3897 !! test
3898 Definition Lists: Nesting: Multi-level (Parsoid only)
3899 !! options
3900 parsoid
3901 !! wikitext
3902 ;t1 :d1
3903 ;;t2 ::d2
3904 ;;;t3 :::d3
3905 !! html
3906 <dl>
3907 <dt>t1 </dt>
3908 <dd>d1</dd>
3909 <dt>
3910 <dl>
3911 <dt>t2 </dt>
3912 <dd>:d2</dd>
3913 <dt>
3914 <dl>
3915 <dt>t3 </dt>
3916 <dd>::d3</dd>
3917 </dl>
3918 </dt>
3919 </dl>
3920 </dt>
3921 </dl>
3922
3923
3924 !! end
3925
3926
3927 !! test
3928 Definition Lists: Nesting: Test 2 (Parsoid only)
3929 !! wikitext
3930 ;t1
3931 ::d2
3932 !! html/php+tidy
3933 <dl>
3934 <dt>t1</dt>
3935 <dd>
3936 <dl>
3937 <dd>d2</dd>
3938 </dl>
3939 </dd>
3940 </dl>
3941 !! html/parsoid
3942 <dl>
3943 <dt>t1</dt>
3944 <dd>
3945 <dl>
3946 <dd>d2</dd>
3947 </dl>
3948 </dd>
3949 </dl>
3950
3951 !! end
3952
3953
3954 !! test
3955 Definition Lists: Nesting: Test 3 (Parsoid only)
3956 !! wikitext
3957 :;t1
3958 ::::d2
3959 !! html/php+tidy
3960 <dl>
3961 <dd>
3962 <dl>
3963 <dt>t1</dt>
3964 <dd>
3965 <dl>
3966 <dd>
3967 <dl>
3968 <dd>d2</dd>
3969 </dl>
3970 </dd>
3971 </dl>
3972 </dd>
3973 </dl>
3974 </dd>
3975 </dl>
3976 !! html/parsoid
3977 <dl>
3978 <dd>
3979 <dl>
3980 <dt>t1</dt>
3981 <dd>
3982 <dl>
3983 <dd>
3984 <dl>
3985 <dd>d2</dd>
3986 </dl>
3987 </dd>
3988 </dl>
3989 </dd>
3990 </dl>
3991 </dd>
3992 </dl>
3993
3994 !! end
3995
3996
3997 !! test
3998 Definition Lists: Nesting: Test 4
3999 !! wikitext
4000 ::;t3
4001 :::d3
4002 !! html
4003 <dl><dd><dl><dd><dl><dt>t3</dt>
4004 <dd>d3</dd></dl></dd></dl></dd></dl>
4005
4006 !! end
4007
4008
4009 ## The Parsoid team believes the following three test exposes a
4010 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4011 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4012 ## It also exposes a "misfeature" in tidy, which doesn't like
4013 ## <dl> tags with a single <dt> child; it converts the <dt> into
4014 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4015 !! test
4016 Definition Lists: Mixed Lists: Test 1
4017 !! wikitext
4018 :;* foo
4019 ::* bar
4020 :; baz
4021 !! html/php
4022 <dl><dd><dl><dt><ul><li> foo</li>
4023 <li> bar</li></ul></dt></dl>
4024 <dl><dt> baz</dt></dl></dd></dl>
4025
4026 !! html/php+tidy
4027 <dl>
4028 <dd>
4029 <dl>
4030 <dd>
4031 <ul>
4032 <li>foo</li>
4033 <li>bar</li>
4034 </ul>
4035 </dd>
4036 </dl>
4037 <dl>
4038 <dt>baz</dt>
4039 </dl>
4040 </dd>
4041 </dl>
4042 !! html/parsoid
4043 <dl>
4044 <dd><dl>
4045 <dt><ul>
4046 <li> foo
4047 </li>
4048 </ul></dt>
4049 <dd><ul>
4050 <li> bar
4051 </li>
4052 </ul></dd>
4053 <dt> baz</dt>
4054 </dl></dd>
4055 </dl>
4056 !! end
4057
4058 !! test
4059 Definition Lists: Mixed Lists: Test 2
4060 !! wikitext
4061 *: d1
4062 *: d2
4063 !! html
4064 <ul><li><dl><dd> d1</dd>
4065 <dd> d2</dd></dl></li></ul>
4066
4067 !! end
4068
4069
4070 !! test
4071 Definition Lists: Mixed Lists: Test 3
4072 !! wikitext
4073 *::: d1
4074 *::: d2
4075 !! html
4076 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4077 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4078
4079 !! end
4080
4081
4082 !! test
4083 Definition Lists: Mixed Lists: Test 4
4084 !! wikitext
4085 *;d1 :d2
4086 *;d3 :d4
4087 !! html
4088 <ul><li><dl><dt>d1&#160;</dt>
4089 <dd>d2</dd>
4090 <dt>d3&#160;</dt>
4091 <dd>d4</dd></dl></li></ul>
4092
4093 !! end
4094
4095
4096 !! test
4097 Definition Lists: Mixed Lists: Test 5
4098 !! wikitext
4099 *:d1
4100 *:: d2
4101 !! html
4102 <ul><li><dl><dd>d1
4103 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4104
4105 !! end
4106
4107
4108 !! test
4109 Definition Lists: Mixed Lists: Test 6
4110 !! wikitext
4111 #*:d1
4112 #*::: d3
4113 !! html
4114 <ol><li><ul><li><dl><dd>d1
4115 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4116
4117 !! end
4118
4119
4120 !! test
4121 Definition Lists: Mixed Lists: Test 7
4122 !! wikitext
4123 :* d1
4124 :* d2
4125 !! html
4126 <dl><dd><ul><li> d1</li>
4127 <li> d2</li></ul></dd></dl>
4128
4129 !! end
4130
4131
4132 !! test
4133 Definition Lists: Mixed Lists: Test 8
4134 !! wikitext
4135 :* d1
4136 ::* d2
4137 !! html
4138 <dl><dd><ul><li> d1</li></ul>
4139 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4140
4141 !! end
4142
4143
4144 !! test
4145 Definition Lists: Mixed Lists: Test 9
4146 !! wikitext
4147 *;foo :bar
4148 !! html
4149 <ul><li><dl><dt>foo&#160;</dt>
4150 <dd>bar</dd></dl></li></ul>
4151
4152 !! end
4153
4154
4155 !! test
4156 Definition Lists: Mixed Lists: Test 10
4157 !! wikitext
4158 *#;foo :bar
4159 !! html
4160 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4161 <dd>bar</dd></dl></li></ol></li></ul>
4162
4163 !! end
4164
4165 # The Parsoid team disagrees with the PHP parser's seemingly-random
4166 # rules regarding dd/dt on the next two tests. Parsoid is more
4167 # consistent, and recognizes the shared nesting and keeps the
4168 # still-open tags around until the nesting is complete.
4169 # (And tidy again converts <dt> to <dd> before 'bar'.)
4170
4171 !! test
4172 Definition Lists: Mixed Lists: Test 11
4173 !! wikitext
4174 *#*#;*;;foo :bar
4175 *#*#;boo :baz
4176 !! html/php
4177 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4178 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4179 <dl><dt>boo&#160;</dt>
4180 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4181
4182 !! html/php+tidy
4183 <ul>
4184 <li>
4185 <ol>
4186 <li>
4187 <ul>
4188 <li>
4189 <ol>
4190 <li>
4191 <dl>
4192 <dt>foo&#160;</dt>
4193 <dd>
4194 <ul>
4195 <li>
4196 <dl>
4197 <dd>
4198 <dl>
4199 <dt>bar</dt>
4200 </dl>
4201 </dd>
4202 </dl>
4203 </li>
4204 </ul>
4205 </dd>
4206 </dl>
4207 <dl>
4208 <dt>boo&#160;</dt>
4209 <dd>baz</dd>
4210 </dl>
4211 </li>
4212 </ol>
4213 </li>
4214 </ul>
4215 </li>
4216 </ol>
4217 </li>
4218 </ul>
4219 !! html/parsoid
4220 <ul>
4221 <li>
4222 <ol>
4223 <li>
4224 <ul>
4225 <li>
4226 <ol>
4227 <li>
4228 <dl>
4229 <dt>
4230 <ul>
4231 <li>
4232 <dl>
4233 <dt>
4234 <dl>
4235 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4236 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4237 </dl></dt>
4238 </dl></li>
4239 </ul></dt>
4240 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4241 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4242 </dl></li>
4243 </ol></li>
4244 </ul></li>
4245 </ol></li>
4246 </ul>
4247 !! end
4248
4249
4250 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4251 # From whitelist:
4252 # * The test is wrong, there are two colons where there should be :;
4253 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4254 !! test
4255 Definition Lists: Weird Ones: Test 1
4256 !! wikitext
4257 *#;*::;; foo : bar (who uses this?)
4258 !! html/php
4259 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4260 <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>
4261
4262 !! html/php+tidy
4263 <ul>
4264 <li>
4265 <ol>
4266 <li>
4267 <dl>
4268 <dt>foo&#160;</dt>
4269 <dd>
4270 <ul>
4271 <li>
4272 <dl>
4273 <dd>
4274 <dl>
4275 <dd>
4276 <dl>
4277 <dd>
4278 <dl>
4279 <dt>bar (who uses this?)</dt>
4280 </dl>
4281 </dd>
4282 </dl>
4283 </dd>
4284 </dl>
4285 </dd>
4286 </dl>
4287 </li>
4288 </ul>
4289 </dd>
4290 </dl>
4291 </li>
4292 </ol>
4293 </li>
4294 </ul>
4295 !! html/parsoid
4296 <ul>
4297 <li>
4298 <ol>
4299 <li>
4300 <dl>
4301 <dt>
4302 <ul>
4303 <li>
4304 <dl>
4305 <dd>
4306 <dl>
4307 <dd>
4308 <dl>
4309 <dt>
4310 <dl>
4311 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4312 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4313 </dl></dt>
4314 </dl></dd>
4315 </dl></dd>
4316 </dl></li>
4317 </ul></dt>
4318 </dl></li>
4319 </ol></li>
4320 </ul>
4321 !! end
4322
4323 !! test
4324 Definition Lists: colons occurring in tags
4325 !! wikitext
4326 ;a:b
4327 ;'''a:b'''
4328 ;<i>a:b</i>
4329 ;<span>a:b</span>
4330 ;<div>a:b</div>
4331 ;<div>a
4332 :b</div>
4333 ;{{echo|a:b}}
4334 ;{{echo|''a:b''}}
4335 ;;;''a:b''
4336 !! html+tidy
4337 <dl>
4338 <dt>a</dt>
4339 <dd>b</dd>
4340 <dt><b>a:b</b></dt>
4341 <dt><i>a:b</i></dt>
4342 <dt><span>a:b</span></dt>
4343 <dd>
4344 <div>a:b</div>
4345 </dd>
4346 <dd>
4347 <div>a
4348 <dl>
4349 <dd>b</dd>
4350 </dl>
4351 </div>
4352 </dd>
4353 <dt>a</dt>
4354 <dd>b</dd>
4355 <dt><i>a:b</i></dt>
4356 </dl>
4357 <dl>
4358 <dd>
4359 <dl>
4360 <dd>
4361 <dl>
4362 <dt><i>a:b</i></dt>
4363 </dl>
4364 </dd>
4365 </dl>
4366 </dd>
4367 </dl>
4368 !! html/parsoid
4369 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4370 <dt><b>a:b</b></dt>
4371 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4372 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4373 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4374 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4375 <dd>b</dd>
4376 <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>
4377 <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>
4378 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4379 !! end
4380
4381 !! test
4382 Definition Lists: colons and tables 1
4383 !! wikitext
4384 :{|
4385 | x
4386 |}
4387 :{|
4388 | y
4389 |}
4390 !! html
4391 <dl><dd><table>
4392 <tr>
4393 <td> x
4394 </td></tr></table></dd></dl>
4395 <dl><dd><table>
4396 <tr>
4397 <td> y
4398 </td></tr></table></dd></dl>
4399
4400 !! end
4401
4402 # Parsoid's output (as documented below) differs from php's in this case.
4403 # This is probably a bug. If we fixup parsoid to match php's output, the
4404 # above test should pass and the below test case can be removed. It is
4405 # unclear which output is more desirable.
4406
4407 !! test
4408 Definition Lists: colons and tables 2
4409 !! wikitext
4410 :{|
4411 | x
4412 |}
4413 :{|
4414 | y
4415 |}
4416 !! html/parsoid
4417 <dl><dd><table>
4418 <tr>
4419 <td> x
4420 </td></tr></table></dd>
4421 <dd><table>
4422 <tr>
4423 <td> y
4424 </td></tr></table></dd></dl>
4425 !! end
4426
4427 !! test
4428 Definition Lists: template interaction
4429 !! wikitext
4430 ::{{definition_list}}
4431
4432 :one
4433 ::{{definition_list}}
4434 :::two
4435 :::three
4436 ::four
4437 !! html/parsoid
4438 <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">
4439 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4440
4441 <dl><dd data-parsoid='{}'>one
4442 <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">
4443 </span><dd about="#mwt2">two
4444 <dl><dd>two</dd>
4445 <dd>three</dd></dl></dd>
4446 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4447 !! end
4448
4449
4450 ###
4451 ### External links
4452 ###
4453 !! test
4454 External links: non-bracketed
4455 !! wikitext
4456 Non-bracketed: http://example.com
4457 !! html
4458 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4459 </p>
4460 !! end
4461
4462 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4463 !! test
4464 External links: numbered
4465 !! wikitext
4466 Numbered: [http://example.com]
4467 Numbered: [http://example.net]
4468 Numbered: [http://example.com]
4469 !! html/php
4470 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4471 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4472 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4473 </p>
4474 !! html/parsoid
4475 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4476 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4477 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4478 !!end
4479
4480 !! test
4481 External links: specified text
4482 !! wikitext
4483 Specified text: [http://example.com link]
4484 !! html
4485 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4486 </p>
4487 !!end
4488
4489 !! test
4490 External links: trail
4491 !! wikitext
4492 Linktrails should not work for external links: [http://example.com link]s
4493 !! html
4494 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4495 </p>
4496 !! end
4497
4498 !! test
4499 External links: dollar sign in URL
4500 !! wikitext
4501 http://example.com/1$2345
4502 !! html
4503 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4504 </p>
4505 !! end
4506
4507 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4508 !! test
4509 External links: dollar sign in URL (autonumber)
4510 !! wikitext
4511 [http://example.com/1$2345]
4512 !! html/php
4513 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4514 </p>
4515 !! html/parsoid
4516 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4517 !!end
4518
4519 !! test
4520 External links: open square bracket forbidden in URL (bug 4377)
4521 !! options
4522 parsoid=wt2html,wt2wt,html2html
4523 !! wikitext
4524 http://example.com/1[2345
4525 !! html/php
4526 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4527 </p>
4528 !! html/parsoid
4529 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4530 !! end
4531
4532 !! test
4533 External links: open square bracket forbidden in URL (named) (bug 4377)
4534 !! options
4535 parsoid=wt2html,html2html
4536 !! wikitext
4537 [http://example.com/1[2345]
4538 !! html/php
4539 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4540 </p>
4541 !! html/parsoid
4542 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4543 !!end
4544
4545 # parsoid adds a space before the link name
4546 !! test
4547 External links: open square bracket forbidden in URL (named) (bug 4377)
4548 Parsoid variant.
4549 !! wikitext
4550 [http://example.com/1 [2345]
4551 !! html
4552 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4553 </p>
4554 !!end
4555
4556 !! test
4557 External links: nowiki in URL link text (bug 6230)
4558 !! wikitext
4559 [http://example.com/ <nowiki>''example site''</nowiki>]
4560 !! html
4561 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4562 </p>
4563 !! end
4564
4565 !! test
4566 External links: newline forbidden in text (bug 6230 regression check)
4567 !! wikitext
4568 [http://example.com/ first
4569 second]
4570 !! html
4571 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4572 second]
4573 </p>
4574 !!end
4575
4576 !! test
4577 External links: Pipe char between url and text
4578 !! wikitext
4579 [http://example.com | link]
4580 !! html
4581 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4582 </p>
4583 !!end
4584
4585 !! test
4586 External links: protocol-relative URL in brackets
4587 !! wikitext
4588 [//example.com/ Test]
4589 !! html
4590 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4591 </p>
4592 !! end
4593
4594 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4595 !! test
4596 External links: protocol-relative URL in brackets without text
4597 !! wikitext
4598 [//example.com]
4599 !! html/php
4600 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4601 </p>
4602 !! html/parsoid
4603 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4604 !! end
4605
4606 !! test
4607 External links: protocol-relative URL in free text is left alone
4608 !! wikitext
4609 //example.com/Foo
4610 !! html
4611 <p>//example.com/Foo
4612 </p>
4613 !!end
4614
4615 !! test
4616 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4617 !! wikitext
4618 foo//example.com/Foo
4619 !! html
4620 <p>foo//example.com/Foo
4621 </p>
4622 !! end
4623
4624 !! test
4625 External links: with no contents
4626 !! wikitext
4627 [http://en.wikipedia.org/wiki/Foo]
4628
4629 [[wikipedia:Foo|Bar]]
4630
4631 [[wikipedia:Foo|<span>Bar</span>]]
4632 !! html/php
4633 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4634 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4635 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4636 </p>
4637 !! html/parsoid
4638 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4639 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4640 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4641 !! end
4642
4643 !! test
4644 External links: Free with trailing punctuation
4645 !! wikitext
4646 http://example.com,
4647 http://example.com;
4648 http://example.com\
4649 http://example.com.
4650 http://example.com:
4651 http://example.com!
4652 http://example.com?
4653 http://example.com)
4654 http://example.com/url_with_(brackets)
4655 (http://example.com/url_without_brackets)
4656 http://example.com/url_with_entity&amp;
4657 http://example.com/url_with_entity&#x26;
4658 http://example.com/url_with_entity&#038;
4659 http://example.com/url_with_entity&nbsp;
4660 http://example.com/url_with_entity&#xA0;
4661 http://example.com/url_with_entity&#160;
4662 http://example.com/url_with_entity&lt;
4663 http://example.com/url_with_entity&#x3C;
4664 http://example.com/url_with_entity&#60;
4665 !! html/php
4666 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4667 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4668 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4669 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4670 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4671 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4672 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4673 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4674 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4675 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4676 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4677 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4678 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4679 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4680 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4681 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4682 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4683 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4684 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4685 </p>
4686 !! html/parsoid
4687 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4688 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4689 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4690 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4691 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4692 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4693 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4694 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4695 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4696 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4697 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4698 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4699 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4700 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>
4701 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>
4702 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>
4703 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>
4704 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x3C;","srcContent":"&lt;"}'>&lt;</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;#60;","srcContent":"&lt;"}'>&lt;</span></p>
4706 !! end
4707
4708 !! test
4709 External links: tricky Parsoid html2html case
4710 !! options
4711 parsoid=wt2html,wt2wt,html2html
4712 !! wikitext
4713 http://example.com/url_with_entity&amp;amp;
4714 !! html/php
4715 <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>;
4716 </p>
4717 !! html/parsoid
4718 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4719 !! end
4720
4721 !! test
4722 External links: Free with trailing quotes (T113666)
4723 !! wikitext
4724 '''News:''' Stuff here
4725
4726 news:'a'b''c''d e
4727 !! html/php
4728 <p><b>News:</b> Stuff here
4729 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4730 </p>
4731 !! html/parsoid
4732 <p><b>News:</b> Stuff here</p>
4733 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4734 !! end
4735
4736 !! test
4737 External links: Lone protocols are never linked (T105697)
4738 !! wikitext
4739 http://
4740 http://;
4741 (http://)
4742 bitcoin:
4743 bitcoin:;
4744 (bitcoin:)
4745 !! html
4746 <p>http://
4747 http://;
4748 (http://)
4749 bitcoin:
4750 bitcoin:;
4751 (bitcoin:)
4752 </p>
4753 !! end
4754
4755 !! test
4756 External links: No preceding word characters allowed (bug 65278)
4757 !! wikitext
4758 NOPEhttp://example.com
4759 N0http://example.com
4760 ok:http://example.com
4761 ok-http://example.com
4762 !! html
4763 <p>NOPEhttp://example.com
4764 N0http://example.com
4765 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4766 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4767 </p>
4768 !! end
4769
4770 !! test
4771 External image
4772 !! wikitext
4773 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4774 !! html
4775 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4776 </p>
4777 !! end
4778
4779 !! test
4780 External image from https
4781 !! wikitext
4782 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4783 !! html
4784 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4785 </p>
4786 !! end
4787
4788 !! test
4789 External image (when not allowed)
4790 !! options
4791 wgAllowExternalImages=0
4792 !! wikitext
4793 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4794 !! html
4795 <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>
4796 </p>
4797 !! end
4798
4799 !! test
4800 Link to non-http image, no img tag
4801 !! wikitext
4802 Link to non-http image, no img tag: ftp://example.com/test.jpg
4803 !! html
4804 <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>
4805 </p>
4806 !! end
4807
4808 !! test
4809 External links: terminating separator
4810 !! wikitext
4811 Terminating separator: http://example.com/thing,
4812 !! html
4813 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4814 </p>
4815 !! end
4816
4817 !! test
4818 External links: intervening separator
4819 !! wikitext
4820 Intervening separator: http://example.com/1,2,3
4821 !! html
4822 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4823 </p>
4824 !! end
4825
4826 !! test
4827 External links: old bug with URL in query
4828 !! wikitext
4829 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4830 !! html
4831 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4832 </p>
4833 !! end
4834
4835 !! test
4836 External links: old URL-in-URL bug, mixed protocols
4837 !! wikitext
4838 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4839 !! html
4840 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4841 </p>
4842 !!end
4843
4844 !! test
4845 External links: URL in text
4846 !! wikitext
4847 URL in text: [http://example.com http://example.com]
4848 !! html
4849 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4850 </p>
4851 !! end
4852
4853 !! test
4854 External links: Clickable images
4855 !! wikitext
4856 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4857 !! html/php
4858 <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>
4859 </p>
4860 !! html/parsoid
4861 <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>
4862 !! end
4863
4864 !! test
4865 External links: raw ampersand
4866 !! wikitext
4867 Old &amp; use: http://x&y
4868 !! html
4869 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4870 </p>
4871 !! end
4872
4873 !! test
4874 External links: encoded ampersand
4875 !! wikitext
4876 Old &amp; use: http://x&amp;y
4877 !! html/php
4878 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4879 </p>
4880 !! html/parsoid
4881 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4882 !! end
4883
4884 !! test
4885 External links: encoded equals (bug 6102)
4886 !! wikitext
4887 http://example.com/?foo&#61;bar
4888 !! html/php
4889 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4890 </p>
4891 !! html/parsoid
4892 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4893 !! end
4894
4895 ##
4896 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4897 ## does it number them. As discussed in bug 53505, we can identify
4898 ## autonumbered links via CSS.
4899 ##
4900
4901 !! test
4902 External links: [raw ampersand]
4903 !! wikitext
4904 Old &amp; use: [http://x&y]
4905 !! html/php
4906 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4907 </p>
4908 !! html/parsoid
4909 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4910 !! end
4911
4912 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4913 # mode will return the [raw ampersand] wikitext
4914 !! test
4915 External links: [encoded ampersand]
4916 !! options
4917 parsoid=wt2html,wt2wt,html2html
4918 !! wikitext
4919 Old &amp; use: [http://x&amp;y]
4920 !! html/php
4921 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4922 </p>
4923 !! html/parsoid
4924 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4925 !! end
4926
4927 !! test
4928 External links: [raw equals]
4929 !! wikitext
4930 [http://example.com/?foo=bar]
4931 !! html/php
4932 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4933 </p>
4934 !! html/parsoid
4935 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4936 !! end
4937
4938 # note that parsoid html is identical to [raw equals] case; so html2wt
4939 # mode will return the [raw equals] wikitext
4940 !! test
4941 External links: [encoded equals] (bug 6102)
4942 !! options
4943 parsoid=wt2html,wt2wt,html2html
4944 !! wikitext
4945 [http://example.com/?foo&#61;bar]
4946 !! html/php
4947 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4948 </p>
4949 !! html/parsoid
4950 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4951 !! end
4952
4953 # xxx parsoid strips the IDN character, so the round-trip tests will
4954 # obviously fail and are disabled. --cscott
4955 !! test
4956 External links: [IDN ignored character reference in hostname; strip it right off]
4957 !! options
4958 parsoid=wt2html,wt2wt,html2html
4959 !! wikitext
4960 [http://e&zwnj;xample.com/]
4961 !! html/php
4962 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4963 </p>
4964 !! html/parsoid
4965 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4966 !! end
4967
4968 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4969 # Where an external link could easily circumvent the sanitization of the text of
4970 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4971 # test demands a higher standard. That's a bit strange.
4972 #
4973 # Example:
4974 #
4975 # http://e‌xample.com -> [http://example.com|http://example.com]
4976 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4977 #
4978 # The first example is sanitized, but the second is not. Any security benefits
4979 # from this production are trivial to circumvent. Either remove this test and
4980 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4981 # the test accordingly.
4982 #
4983 # All our love,
4984 # The Parsoid team.
4985 # xxx parsoid strips the IDN character, so the round-trip tests will
4986 # obviously fail and are disabled. --cscott
4987 !! test
4988 External links: IDN ignored character reference in hostname; strip it right off
4989 !! options
4990 parsoid=wt2html,html2html
4991 !! wikitext
4992 http://e&zwnj;xample.com/
4993 !! html/php
4994 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4995 </p>
4996 !! html/parsoid
4997 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4998 !! end
4999
5000 !! test
5001 External links: www.jpeg.org (bug 554)
5002 !! wikitext
5003 http://www.jpeg.org
5004 !! html
5005 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5006 </p>
5007 !! end
5008
5009 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
5010 !! test
5011 External links: URL within URL (original bug 2)
5012 !! wikitext
5013 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5014 !! html/php
5015 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5016 </p>
5017 !! html/parsoid
5018 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5019 !! end
5020
5021 !! test
5022 BUG 361: URL inside bracketed URL
5023 !! wikitext
5024 [http://www.example.com/foo http://www.example.com/bar]
5025 !! html
5026 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5027 </p>
5028 !! end
5029
5030 !! test
5031 BUG 361: URL within URL, not bracketed
5032 !! wikitext
5033 http://www.example.com/foo?=http://www.example.com/bar
5034 !! html
5035 <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>
5036 </p>
5037 !! end
5038
5039 !! test
5040 BUG 289: ">"-token in URL-tail
5041 !! wikitext
5042 http://www.example.com/<hello>
5043 !! html
5044 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5045 </p>
5046 !!end
5047
5048 !! test
5049 BUG 289: literal ">"-token in URL-tail
5050 !! wikitext
5051 http://www.example.com/<b>html</b>
5052 !! html/php
5053 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5054 </p>
5055 !! html/parsoid
5056 <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>
5057 !! end
5058
5059 !! test
5060 BUG 289: ">"-token in bracketed URL
5061 !! wikitext
5062 [http://www.example.com/<hello> stuff]
5063 !! html
5064 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5065 </p>
5066 !!end
5067
5068 !! test
5069 BUG 289: literal ">"-token in bracketed URL
5070 !! wikitext
5071 [http://www.example.com/<b>html</b> stuff]
5072 !! html
5073 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5074 </p>
5075 !!end
5076
5077 !! test
5078 BUG 289: literal double quote at end of URL
5079 !! wikitext
5080 http://www.example.com/"hello"
5081 !! html
5082 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5083 </p>
5084 !!end
5085
5086 !! test
5087 BUG 289: literal double quote in bracketed URL
5088 !! wikitext
5089 [http://www.example.com/"hello" stuff]
5090 !! html
5091 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5092 </p>
5093 !!end
5094
5095 !! test
5096 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5097 !! wikitext
5098 [http://www.example.com test]
5099 !! html
5100 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5101 </p>
5102 !! end
5103
5104 !! test
5105 External links: link text with spaces
5106 !! wikitext
5107 [http://www.example.com a b c]
5108 [http://www.example.com ''a'' ''b'']
5109 !! html
5110 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5111 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5112 </p>
5113 !! end
5114
5115 !! test
5116 External links: wiki links within external link (Bug 3695)
5117 !! options
5118 parsoid=wt2html,html2html
5119 !! wikitext
5120 [http://example.com [[wikilink]] embedded in ext link]
5121 !! html/php
5122 <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>
5123 </p>
5124 !! html/parsoid
5125 <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>
5126 !! end
5127
5128 !! test
5129 BUG 787: Links with one slash after the url protocol are invalid
5130 !! wikitext
5131 http:/example.com
5132
5133 [http:/example.com title]
5134 !! html
5135 <p>http:/example.com
5136 </p><p>[http:/example.com title]
5137 </p>
5138 !! end
5139
5140 !! test
5141 Bracketed external links with template-generated invalid target
5142 !! wikitext
5143 [{{echo|http:/example.com}} title]
5144 !! html
5145 <p>[http:/example.com title]
5146 </p>
5147 !! end
5148
5149 !! test
5150 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5151 !! wikitext
5152 ''[http://example.com text'']
5153 [http://example.com '''text]'''
5154 ''Something [http://example.com in italic'']
5155 ''Something [http://example.com mixed''''', even bold]'''
5156 '''''Now [http://example.com both''''']
5157 !! html
5158 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5159 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5160 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5161 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5162 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5163 </p>
5164 !! end
5165
5166
5167 !! test
5168 Bug 4781: %26 in URL
5169 !! wikitext
5170 http://www.example.com/?title=AT%26T
5171 !! html/php
5172 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5173 </p>
5174 !! html/parsoid
5175 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5176 !! end
5177
5178 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5179 # % is actually legal in HTML5. Any change in output would need testing though.
5180 !! test
5181 Bug 4781, 5267: %25 in URL
5182 !! wikitext
5183 http://www.example.com/?title=100%25_Bran
5184 !! html/php
5185 <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>
5186 </p>
5187 !! html/parsoid
5188 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5189 !! end
5190
5191 !! test
5192 Bug 4781, 5267: %28, %29 in URL
5193 !! wikitext
5194 http://www.example.com/?title=Ben-Hur_%281959_film%29
5195 !! html/php
5196 <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>
5197 </p>
5198 !! html/parsoid
5199 <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>
5200 !! end
5201
5202
5203 !! test
5204 Bug 4781: %26 in autonumber URL
5205 !! wikitext
5206 [http://www.example.com/?title=AT%26T]
5207 !! html/php
5208 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5209 </p>
5210 !! html/parsoid
5211 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5212 !! end
5213
5214 !! test
5215 Bug 4781, 5267: %26 in autonumber URL
5216 !! wikitext
5217 [http://www.example.com/?title=100%25_Bran]
5218 !! html/php
5219 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5220 </p>
5221 !! html/parsoid
5222 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5223 !! end
5224
5225 !! test
5226 Bug 4781, 5267: %28, %29 in autonumber URL
5227 !! wikitext
5228 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5229 !! html/php
5230 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5231 </p>
5232 !! html/parsoid
5233 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5234 !! end
5235
5236
5237 !! test
5238 Bug 4781: %26 in bracketed URL
5239 !! wikitext
5240 [http://www.example.com/?title=AT%26T link]
5241 !! html/php
5242 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5243 </p>
5244 !! html/parsoid
5245 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5246 !! end
5247
5248 !! test
5249 Bug 4781, 5267: %25 in bracketed URL
5250 !! wikitext
5251 [http://www.example.com/?title=100%25_Bran link]
5252 !! html
5253 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5254 </p>
5255 !! end
5256
5257 !! test
5258 Bug 4781, 5267: %28, %29 in bracketed URL
5259 !! wikitext
5260 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5261 !! html/php
5262 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5263 </p>
5264 !! html/parsoid
5265 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5266 !! end
5267
5268 !! test
5269 External link containing a period in the anchor. (bug 63947)
5270 !! wikitext
5271 [//foo.org/bar#baz. bang]
5272
5273 [//foo.org/bar. bang]
5274 !! html/php
5275 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5276 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5277 </p>
5278 !! html/parsoid
5279 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5280 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5281 !! end
5282
5283 !! test
5284 External link containing a single quote. (bug 63947)
5285 !! wikitext
5286 [//foo.org/bar'baz]
5287
5288 [//foo.org/bar'baz bang]
5289 !! html/php
5290 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5291 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5292 </p>
5293 !! html/parsoid
5294 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5295 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5296 !! end
5297
5298 !! test
5299 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5300 !! wikitext
5301 Some [http://example.com/ pretty ''italics'' and stuff]!
5302 !! html
5303 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5304 </p>
5305 !! end
5306
5307 !! test
5308 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5309 !! wikitext
5310 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5311 !! html
5312 <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>
5313 </p>
5314 !! end
5315
5316 !! test
5317 External link containing double-single-quotes with no space separating the url from text in italics
5318 !! wikitext
5319 [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]].]
5320 !! html/php
5321 <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>
5322 </p>
5323 !! html/php+tidy
5324 <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>
5325 !! html/parsoid
5326 <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>
5327 !! end
5328
5329 !! test
5330 External link with comments in link text
5331 !! wikitext
5332 [http://www.google.com Google <!-- comment -->]
5333 !! html/php
5334 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5335 </p>
5336 !! html/parsoid
5337 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5338 !! end
5339
5340 !! test
5341 External link to bare IPv4 address
5342 !! wikitext
5343 [http://192.168.0.1 Link]
5344 !! html/php
5345 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5346 </p>
5347 !! html/parsoid
5348 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5349 !! end
5350
5351 !! test
5352 URL-encoding in URL functions (single parameter)
5353 !! wikitext
5354 {{localurl:Some page|amp=&}}
5355 !! html
5356 <p>/index.php?title=Some_page&amp;amp=&amp;
5357 </p>
5358 !! end
5359
5360 !! test
5361 URL-encoding in URL functions (multiple parameters)
5362 !! wikitext
5363 {{localurl:Some page|q=?&amp=&}}
5364 !! html
5365 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5366 </p>
5367 !! end
5368
5369 !! test
5370 Brackets in urls
5371 !! wikitext
5372 http://example.com/index.php?foozoid%5B%5D=bar
5373
5374 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5375 !! html/php
5376 <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>
5377 </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>
5378 </p>
5379 !! html/parsoid
5380 <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>
5381
5382 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5383 !! end
5384
5385 !! test
5386 IPv6 urls, autolink format (T23261)
5387 !! wikitext
5388 http://[2404:130:0:1000::187:2]/index.php
5389
5390 Examples from RFC 2373, section 2.2:
5391 * http://[1080::8:800:200C:417A]/unicast
5392 * http://[FF01::101]/multicast
5393 * http://[::1]/loopback
5394 * http://[::]/unspecified
5395 * http://[::13.1.68.3]/ipv4compat
5396 * http://[::FFFF:129.144.52.38]/ipv4compat
5397
5398 Examples from RFC 2732, section 2:
5399 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5400 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5401 * http://[3ffe:2a00:100:7031::1]
5402 * http://[1080::8:800:200C:417A]/foo
5403 * http://[::192.9.5.5]/ipng
5404 * http://[::FFFF:129.144.52.38]:80/index.html
5405 * http://[2010:836B:4179::836B:4179]
5406
5407 !! html/php
5408 <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>
5409 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5410 </p>
5411 <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>
5412 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5413 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5414 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5415 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5416 <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>
5417 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5418 </p>
5419 <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>
5420 <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>
5421 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5422 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5423 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5424 <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>
5425 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5426
5427 !! html/parsoid
5428 <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>
5429
5430 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5431 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5432 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5433 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5434 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5435 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5436 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5437
5438 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5439 <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>
5440 <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>
5441 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5442 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5443 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5444 <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>
5445 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5446 !! end
5447
5448 !! test
5449 IPv6 urls, bracketed format (T23261)
5450 !! wikitext
5451 [http://[2404:130:0:1000::187:2]/index.php test]
5452
5453 Examples from RFC 2373, section 2.2:
5454 * [http://[1080::8:800:200C:417A] unicast]
5455 * [http://[FF01::101] multicast]
5456 * [http://[::1]/ loopback]
5457 * [http://[::] unspecified]
5458 * [http://[::13.1.68.3] ipv4compat]
5459 * [http://[::FFFF:129.144.52.38] ipv4compat]
5460
5461 Examples from RFC 2732, section 2:
5462 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5463 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5464 * [http://[3ffe:2a00:100:7031::1] 3]
5465 * [http://[1080::8:800:200C:417A]/foo 4]
5466 * [http://[::192.9.5.5]/ipng 5]
5467 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5468 * [http://[2010:836B:4179::836B:4179] 7]
5469
5470 !! html/php
5471 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5472 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5473 </p>
5474 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5475 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5476 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5477 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5478 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5479 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5480 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5481 </p>
5482 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5483 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5484 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5485 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5486 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5487 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5488 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5489
5490 !! html/parsoid
5491 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5492
5493 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5494 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5495 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5496 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5497 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5498 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5499 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5500
5501 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5502 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5503 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5504 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5505 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5506 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5507 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5508 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5509 !! end
5510
5511 !! test
5512 Non-extlinks in brackets
5513 !! wikitext
5514 [foo]
5515 [foo bar]
5516 [foo ''bar'']
5517 [fool's] errand
5518 [fool's errand]
5519 [{{echo|foo}}]
5520 [{{echo|foo}} bar]
5521 [{{echo|foo}} ''bar'']
5522 [{{echo|foo}}l's] errand
5523 [{{echo|foo}}l's errand]
5524 [url={{echo|foo}}]
5525 [url=http://example.com]
5526 [http:// bare protocols don't count]
5527 !! html/php
5528 <p>[foo]
5529 [foo bar]
5530 [foo <i>bar</i>]
5531 [fool's] errand
5532 [fool's errand]
5533 [foo]
5534 [foo bar]
5535 [foo <i>bar</i>]
5536 [fool's] errand
5537 [fool's errand]
5538 [url=foo]
5539 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5540 [http:// bare protocols don't count]
5541 </p>
5542 !! html/parsoid
5543 <p>[foo]
5544 [foo bar]
5545 [foo <i>bar</i>]
5546 [fool's] errand
5547 [fool's errand]
5548 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5549 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5550 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5551 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5552 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5553 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5554 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5555 [http:// bare protocols don't count]</p>
5556 !! end
5557
5558 !! test
5559 Percent encoding in external links
5560 !! wikitext
5561 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5562 !! html/php
5563 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5564 </p>
5565 !! html/parsoid
5566 <p><a rel="mw:ExtLink"
5567 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5568 !! end
5569
5570 !! test
5571 Use url link syntax for links where the content is equal the link target
5572 !! wikitext
5573 http://example.com
5574 !! html/php
5575 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5576 </p>
5577 !! html/parsoid
5578 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5579 !! end
5580
5581 !! test
5582 Parenthesis in external links, especially URL links
5583 !! wikitext
5584 http://example.com)
5585
5586 http://example.com/test)
5587
5588 http://example.com/(test)
5589
5590 http://example.com/((test)
5591
5592 (http://example.com/(test))
5593
5594 (http://example.com/(test)))))
5595
5596 http://example.com/a)b
5597
5598 [http://example.com) foo]
5599 !! html/php
5600 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5601 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5602 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5603 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5604 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</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/a)b">http://example.com/a)b</a>
5607 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5608 </p>
5609 !! html/parsoid
5610 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5611 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5612 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5613 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5614 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</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/a)b">http://example.com/a)b</a></p>
5617 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5618 !! end
5619
5620 !! test
5621 Parenthesis in external links, w/ transclusion or comment
5622 !! wikitext
5623 (http://example.com/{{echo|hi}})
5624
5625 (http://example.com<!-- hi -->)
5626 !! html/php
5627 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5628 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5629 </p>
5630 !! html/parsoid
5631 <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>
5632
5633 <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>
5634 !! end
5635
5636 !! test
5637 Serialize <a> tags with invalid link targets as plain text
5638 !! options
5639 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5640 !! html/parsoid
5641 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5642 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5643 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5644 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5645 !! wikitext
5646 text
5647 <nowiki>*</nowiki>text
5648 <nowiki>[[foo]]</nowiki>
5649 <nowiki>*a [[foo]]</nowiki>
5650 !! end
5651
5652 !! test
5653 mw:ExtLink -vs- mw:WikiLink (T94723)
5654 !! options
5655 parsoid=html2wt
5656 !! html/parsoid
5657 <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>
5658 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5659 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5660 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5661 <p>
5662 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5663 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5664 </p>
5665 !! wikitext
5666 [[Foo|Bar]]
5667 [[Foo|Bar]]
5668 [[wikipedia:Foo|Bar]]
5669 [[wikipedia:Foo|Bar]]
5670
5671 [[wikipedia:European_Robin|European Robin]]
5672 [[wikipedia:European_Robin|European Robin]]
5673 !! end
5674
5675 !! test
5676 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5677 !! options
5678 parsoid=wt2wt
5679 !! wikitext
5680 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5681 !! html/parsoid
5682 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5683 !! end
5684
5685
5686 ###
5687 ### Quotes
5688 ###
5689
5690 !! test
5691 Quotes
5692 !! wikitext
5693 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5694
5695 Normal text. '''''Bold italic text.''''' Normal text.
5696 !! html
5697 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5698 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5699 </p>
5700 !! end
5701
5702
5703 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5704 # parser strips. The wikitext contains just the first half of the bold
5705 # quote pair.
5706 !! test
5707 Unclosed and unmatched quotes
5708 !! wikitext
5709 '''''Bold italic text '''with bold deactivated''' in between.'''''
5710
5711 '''''Bold italic text ''with italic deactivated'' in between.'''''
5712
5713 '''Bold text..
5714
5715 ..spanning two paragraphs (should not work).'''
5716
5717 '''Bold tag left open
5718
5719 ''Italic tag left open
5720
5721 Normal text.
5722
5723 <!-- Unmatching number of opening, closing tags: -->
5724 '''This year''''s election ''should'' beat '''last year''''s.
5725
5726 ''Tom'''s car is bigger than ''Susan'''s.
5727
5728 Plain ''italic'''s plain
5729 !! html/php
5730 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5731 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5732 </p><p><b>Bold text..</b>
5733 </p><p>..spanning two paragraphs (should not work).
5734 </p><p><b>Bold tag left open</b>
5735 </p><p><i>Italic tag left open</i>
5736 </p><p>Normal text.
5737 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5738 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5739 </p><p>Plain <i>italic'</i>s plain
5740 </p>
5741 !! html/parsoid
5742 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5743 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5744 </p><p><b>Bold text..</b>
5745 </p><p>..spanning two paragraphs (should not work).<b></b>
5746 </p><p><b>Bold tag left open</b>
5747 </p><p><i>Italic tag left open</i>
5748 </p><p>Normal text.
5749 </p>
5750 <!-- Unmatching number of opening, closing tags: -->
5751 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5752 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5753 </p><p>Plain <i>italic'</i>s plain
5754 </p>
5755 !! end
5756
5757 ###
5758 ### Tables
5759 ###
5760 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5761 ###
5762
5763 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5764 # is the bare minimum required by the spec, see:
5765 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5766 # Parsoid team replies: empty table tags are legal in HTML5
5767 !! test
5768 A table with no data.
5769 !! options
5770 parsoid=wt2html
5771 !! wikitext
5772 {||}
5773 !! html/php
5774
5775 !! html/parsoid
5776 <table></table>
5777
5778 !! end
5779
5780 !! test
5781 A table with stray table end tags on start tag line (wt2html)
5782 !! options
5783 parsoid=wt2html
5784 !! wikitext
5785 {|style="color: red;"|}
5786
5787 {|style="color: red;" |}
5788 |foo
5789 |}
5790
5791 {|style="color: red;"|} id="foo"
5792 |foo
5793 |}
5794
5795 {|style="color: red;" |} id="foo"
5796 |foo
5797 |}
5798 !! html
5799 <table style="color: red;"></table>
5800
5801 <table style="color: red;">
5802 <tbody><tr>
5803 <td>foo</td>
5804 </tr></tbody>
5805 </table>
5806
5807 <table style="color: red;" id="foo">
5808 <tbody><tr>
5809 <td>foo</td>
5810 </tr></tbody>
5811 </table>
5812
5813 <table style="color: red;" id="foo">
5814 <tbody><tr>
5815 <td>foo</td>
5816 </tr></tbody>
5817 </table>
5818
5819 !! end
5820
5821 !! test
5822 A table with no data (take 2)
5823 !! wikitext
5824 {|
5825 |}
5826 !! html/parsoid
5827 <table></table>
5828 !! end
5829
5830 # A table with nothing but a caption is invalid XHTML, we might want to render
5831 # this as <p>caption</p>
5832 # Parsoid team replies: table with only a caption is legal in HTML5
5833 !! test
5834 A table with nothing but a caption
5835 !! wikitext
5836 {|
5837 |+ caption
5838 |}
5839 !! html/php
5840 <table>
5841 <caption> caption
5842 </caption><tr><td></td></tr></table>
5843
5844 !! html/parsoid
5845 <table><caption> caption</caption></table>
5846 !! end
5847
5848 !! test
5849 A table with caption with default-spaced attributes and a table row
5850 !! wikitext
5851 {|
5852 |+ style="color: red;" | caption1
5853 |-
5854 | foo
5855 |}
5856 !! html
5857 <table>
5858 <caption style="color: red;"> caption1
5859 </caption>
5860 <tr>
5861 <td> foo
5862 </td></tr></table>
5863
5864 !! end
5865
5866 !! test
5867 A table with captions with non-default spaced attributes and a table row
5868 !! wikitext
5869 {|
5870 |+style="color: red;"|caption2
5871 |+ style="color: red;"| caption3
5872 |-
5873 | foo
5874 |}
5875 !! html
5876 <table>
5877 <caption style="color: red;">caption2
5878 </caption>
5879 <caption style="color: red;"> caption3
5880 </caption>
5881 <tr>
5882 <td> foo
5883 </td></tr></table>
5884
5885 !! end
5886
5887 !! test
5888 Table td-cell syntax variations
5889 !! wikitext
5890 {|
5891 | foo bar foo | baz
5892 | foo bar foo || baz
5893 | style='color:red;' | baz
5894 | style='color:red;' || baz
5895 |}
5896 !! html
5897 <table>
5898 <tr>
5899 <td> baz
5900 </td>
5901 <td> foo bar foo </td>
5902 <td> baz
5903 </td>
5904 <td style="color:red;"> baz
5905 </td>
5906 <td> style='color:red;' </td>
5907 <td> baz
5908 </td></tr></table>
5909
5910 !! end
5911
5912 !! test
5913 Simple table
5914 !! wikitext
5915 {|
5916 | 1 || 2
5917 |-
5918 | 3 || 4
5919 |}
5920 !! html
5921 <table>
5922 <tr>
5923 <td> 1 </td>
5924 <td> 2
5925 </td></tr>
5926 <tr>
5927 <td> 3 </td>
5928 <td> 4
5929 </td></tr></table>
5930
5931 !! end
5932
5933 !! test
5934 Simple table but with multiple dashes for row wikitext
5935 !! wikitext
5936 {|
5937 | foo
5938 |-----
5939 | bar
5940 |}
5941 !! html
5942 <table>
5943 <tr>
5944 <td> foo
5945 </td></tr>
5946 <tr>
5947 <td> bar
5948 </td></tr></table>
5949
5950 !! end
5951
5952 !! test
5953 Multiplication table
5954 !! wikitext
5955 {| border="1" cellpadding="2"
5956 |+Multiplication table
5957 |-
5958 ! &times; !! 1 !! 2 !! 3
5959 |-
5960 ! 1
5961 | 1 || 2 || 3
5962 |-
5963 ! 2
5964 | 2 || 4 || 6
5965 |-
5966 ! 3
5967 | 3 || 6 || 9
5968 |-
5969 ! 4
5970 | 4 || 8 || 12
5971 |-
5972 ! 5
5973 | 5 || 10 || 15
5974 |}
5975 !! html
5976 <table border="1" cellpadding="2">
5977 <caption>Multiplication table
5978 </caption>
5979 <tr>
5980 <th> &#215; </th>
5981 <th> 1 </th>
5982 <th> 2 </th>
5983 <th> 3
5984 </th></tr>
5985 <tr>
5986 <th> 1
5987 </th>
5988 <td> 1 </td>
5989 <td> 2 </td>
5990 <td> 3
5991 </td></tr>
5992 <tr>
5993 <th> 2
5994 </th>
5995 <td> 2 </td>
5996 <td> 4 </td>
5997 <td> 6
5998 </td></tr>
5999 <tr>
6000 <th> 3
6001 </th>
6002 <td> 3 </td>
6003 <td> 6 </td>
6004 <td> 9
6005 </td></tr>
6006 <tr>
6007 <th> 4
6008 </th>
6009 <td> 4 </td>
6010 <td> 8 </td>
6011 <td> 12
6012 </td></tr>
6013 <tr>
6014 <th> 5
6015 </th>
6016 <td> 5 </td>
6017 <td> 10 </td>
6018 <td> 15
6019 </td></tr></table>
6020
6021 !! end
6022
6023 !! test
6024 Accept "||" in table headings
6025 !! wikitext
6026 {|
6027 !h1 || h2
6028 |}
6029 !! html
6030 <table>
6031 <tr>
6032 <th>h1 </th>
6033 <th> h2
6034 </th></tr></table>
6035
6036 !! end
6037
6038 !! test
6039 Accept "!!" in table data
6040 !! wikitext
6041 {|
6042 | Foo!! ||
6043 |}
6044 !! html
6045 <table>
6046 <tr>
6047 <td> Foo!! </td>
6048 <td>
6049 </td></tr></table>
6050
6051 !! html/parsoid
6052 <table>
6053 <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>
6054 </tbody></table>
6055 !! end
6056
6057 !! test
6058 Accept "||" in indented table headings
6059 !! wikitext
6060 :{|
6061 !h1 || h2
6062 |}
6063 !! html
6064 <dl><dd><table>
6065 <tr>
6066 <th>h1 </th>
6067 <th> h2
6068 </th></tr></table></dd></dl>
6069
6070 !! end
6071
6072 !! test
6073 Accept "!!" in templates
6074 !! wikitext
6075 {|
6076 !a {{echo|b!!c}}
6077 |}
6078 !! html/php
6079 <table>
6080 <tr>
6081 <th>a b</th>
6082 <th>c
6083 </th></tr></table>
6084
6085 !! html/parsoid
6086 <table>
6087 <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>
6088 !! end
6089
6090 !! test
6091 Accept "!!" in table headings after newline
6092 !! wikitext
6093 {|
6094 !a
6095 b!!c
6096 |}
6097 !! html/php
6098 <table>
6099 <tr>
6100 <th>a
6101 <p>b!!c
6102 </p>
6103 </th></tr></table>
6104
6105 !! html/parsoid
6106 <table>
6107 <tbody><tr><th>a
6108 <p>b!!c</p></th></tr>
6109 </tbody></table>
6110 !! end
6111
6112 !! test
6113 Accept "!!" in table data of mixed wikitext / html syntax
6114 !! wikitext
6115 {|
6116 !a
6117 <tr><td>b!!c</td></tr>
6118 |}
6119 !! html+tidy
6120 <table>
6121 <tr>
6122 <th>a</th>
6123 </tr>
6124 <tr>
6125 <td>b!!c</td>
6126 </tr>
6127 </table>
6128 !! html/parsoid
6129 <table>
6130 <tbody><tr><th>a</th></tr>
6131 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6132 </tbody></table>
6133 !! end
6134
6135 !! test
6136 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6137 !! wikitext
6138 {|
6139 !| h1
6140 || a
6141 |}
6142 !! html
6143 <table>
6144 <tr>
6145 <th> h1
6146 </th>
6147 <td> a
6148 </td></tr></table>
6149
6150 !! end
6151
6152 !!test
6153 Accept "| !" at start of line in tables (ignore !-attribute)
6154 !! wikitext
6155 {|
6156 |-
6157 | !style="color:red" | bar
6158 |}
6159 !! html
6160 <table>
6161
6162 <tr>
6163 <td> bar
6164 </td></tr></table>
6165
6166 !!end
6167
6168 !!test
6169 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 +/-
6170 !! wikitext
6171 {|
6172 |-
6173 |style='color:red;'|+1
6174 |style='color:blue;'|-1
6175 |-
6176 | 1 || 2 || 3
6177 | 1 ||+2 ||-3
6178 |-
6179 | +1
6180 | -1
6181 |}
6182 !! html
6183 <table>
6184
6185 <tr>
6186 <td style="color:red;">+1
6187 </td>
6188 <td style="color:blue;">-1
6189 </td></tr>
6190 <tr>
6191 <td> 1 </td>
6192 <td> 2 </td>
6193 <td> 3
6194 </td>
6195 <td> 1 </td>
6196 <td>+2 </td>
6197 <td>-3
6198 </td></tr>
6199 <tr>
6200 <td> +1
6201 </td>
6202 <td> -1
6203 </td></tr></table>
6204
6205 !!end
6206
6207 !! test
6208 Table rowspan
6209 !! wikitext
6210 {| border=1
6211 | Cell 1, row 1
6212 |rowspan=2| Cell 2, row 1 (and 2)
6213 | Cell 3, row 1
6214 |-
6215 | Cell 1, row 2
6216 | Cell 3, row 2
6217 |}
6218 !! html
6219 <table border="1">
6220 <tr>
6221 <td> Cell 1, row 1
6222 </td>
6223 <td rowspan="2"> Cell 2, row 1 (and 2)
6224 </td>
6225 <td> Cell 3, row 1
6226 </td></tr>
6227 <tr>
6228 <td> Cell 1, row 2
6229 </td>
6230 <td> Cell 3, row 2
6231 </td></tr></table>
6232
6233 !! end
6234
6235 !! test
6236 Nested table
6237 !! wikitext
6238 {| border=1
6239 | &alpha;
6240 |
6241 {| bgcolor=#ABCDEF border=2
6242 |nested
6243 |-
6244 |table
6245 |}
6246 |the original table again
6247 |}
6248 !! html
6249 <table border="1">
6250 <tr>
6251 <td> &#945;
6252 </td>
6253 <td>
6254 <table bgcolor="#ABCDEF" border="2">
6255 <tr>
6256 <td>nested
6257 </td></tr>
6258 <tr>
6259 <td>table
6260 </td></tr></table>
6261 </td>
6262 <td>the original table again
6263 </td></tr></table>
6264
6265 !! end
6266
6267 !! test
6268 Invalid attributes in table cell (bug 1830)
6269 !! wikitext
6270 {|
6271 |Cell:|broken
6272 |}
6273 !! html
6274 <table>
6275 <tr>
6276 <td>broken
6277 </td></tr></table>
6278
6279 !! end
6280
6281 !! test
6282 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6283 !! wikitext
6284 {|
6285 | title="foo" |bar
6286 | title="foo<nowiki>|</nowiki>" |bar
6287 | title="foo<nowiki>|</nowiki>" bar
6288 |}
6289 !! html/php
6290 <table>
6291 <tr>
6292 <td title="foo">bar
6293 </td>
6294 <td title="foo&#124;">bar
6295 </td>
6296 <td> title="foo|" bar
6297 </td></tr></table>
6298
6299 !! html/parsoid
6300 <table>
6301 <tbody><tr><td title="foo">bar</td>
6302 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6303 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6304 </tbody></table>
6305 !! end
6306
6307 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6308 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6309 # *2wt modes will fail.
6310 !! test
6311 Table security: embedded pipes
6312 !! options
6313 parsoid=wt2html,html2html
6314 !! wikitext
6315 {|
6316 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6317 !! html/php
6318 <table>
6319 <tr>
6320 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6321 <td>]" onmouseover="alert(document.cookie)"&gt;test
6322 </td>
6323 </tr>
6324 </table>
6325
6326 !! html/parsoid
6327 <table><tbody>
6328 <tr>
6329 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6330 !! end
6331
6332 !! test
6333 ! and || in element attributes should not be parsed as <th>/<td>
6334 !! wikitext
6335 {|
6336 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6337 |}
6338 !! html/php
6339 <table>
6340 <tr>
6341 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6342 </td></tr></table>
6343
6344 !! html/parsoid
6345 <table>
6346 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6347 </tbody></table>
6348 !! end
6349
6350 # FIXME: The output seems broken. Filed as T110268.
6351 !! test
6352 ! and || in td attributes should not be parsed as <th>/<td>
6353 !! options
6354 parsoid=wt2html
6355 !! wikitext
6356 {|
6357 | style="color: red !important;" data-contrived="put this here ||" | foo
6358 |}
6359 !! html/php
6360 <table>
6361 <tr>
6362 <td> style="color: red !important;" data-contrived="put this here </td>
6363 <td> foo
6364 </td></tr></table>
6365
6366 !! html/parsoid
6367 <table>
6368 <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>
6369 </tbody></table>
6370 !! end
6371
6372 !! test
6373 Break on | in element attribute in template
6374 !! options
6375 parsoid=wt2html,html2html
6376 !! wikitext
6377 {{echo|1=<div class="hi|ho">ha</div>}}
6378 !! html/php
6379 <p>ho"&gt;ha&lt;/div&gt;
6380 </p>
6381 !! html/parsoid
6382 <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>
6383 !! end
6384
6385 !! test
6386 Indented table markup mixed with indented pre content (proposed in bug 6200)
6387 !! wikitext
6388 <table>
6389 <tr>
6390 <td>
6391 Text that should be rendered preformatted
6392 </td>
6393 </tr>
6394 </table>
6395 !! html
6396 <table>
6397 <tr>
6398 <td>
6399 <pre>Text that should be rendered preformatted
6400 </pre>
6401 </td>
6402 </tr>
6403 </table>
6404
6405 !! end
6406
6407 !! test
6408 1. Template-generated table cell attributes and cell content
6409 !! wikitext
6410 {|
6411 |{{table_attribs}}
6412 | {{table_attribs}}
6413 || {{table_attribs_5}}
6414 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6415 |align=center {{table_attribs}}
6416 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6417 |}
6418 !! html
6419 <table>
6420 <tr>
6421 <td style="color:red;">Foo
6422 </td>
6423 <td style="color:red;">Foo
6424 </td>
6425 <td> style="color:red;"</td>
6426 <td>Bar
6427 </td>
6428 <td style="color:red;">Foo
6429 </td>
6430 <td align="center" style="color:red;">Foo
6431 </td>
6432 <td align="center" style="color:red;">Foo
6433 </td></tr></table>
6434
6435 !! end
6436
6437 !! test
6438 2. Template-generated table cell attributes and cell content
6439 !! wikitext
6440 {|
6441 |{{table_attribs_2}}
6442 |}
6443 !! html/php
6444 <table>
6445 <tr>
6446 <td style="color:red;">Foo
6447 </td>
6448 <td>Bar</td>
6449 <td>Baz
6450 </td></tr></table>
6451
6452 !! html/parsoid
6453 <table>
6454 <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>
6455 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6456 </tbody></table>
6457 !! end
6458
6459 !! test
6460 3. Template-generated table cell attributes and cell content
6461 !! wikitext
6462 {|
6463 !align=center {{table_header_cells}}
6464 |-
6465 |align=center {{table_cells}}
6466 |}
6467 !! html/php
6468 <table>
6469 <tr>
6470 <th align="center" style="color:red;">Foo</th>
6471 <th style="color:red;"><i>Bar</i></th>
6472 <th style="color:brown;"><i>Foo</i> and Baz
6473 </th></tr>
6474 <tr>
6475 <td align="center" style="color:red;">Foo</td>
6476 <td style="color:red;"><i>Bar</i></td>
6477 <td style="color:brown;"><i>Foo</i> and Baz
6478 </td></tr></table>
6479
6480 !! html/parsoid
6481 <table>
6482 <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>
6483 <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>
6484 </tbody></table>
6485 !! end
6486
6487 !! test
6488 4. Template-generated table cell attributes and cell content inside a templated table
6489 !! wikitext
6490 {{tbl-start}}
6491 !align=center {{table_header_cells}}
6492 |-
6493 |align=center {{table_cells}}
6494 {{tbl-end}}
6495 !! html/php
6496 <table>
6497 <tr>
6498 <th align="center" style="color:red;">Foo</th>
6499 <th style="color:red;"><i>Bar</i></th>
6500 <th style="color:brown;"><i>Foo</i> and Baz
6501 </th></tr>
6502 <tr>
6503 <td align="center" style="color:red;">Foo</td>
6504 <td style="color:red;"><i>Bar</i></td>
6505 <td style="color:brown;"><i>Foo</i> and Baz
6506 </td></tr></table>
6507
6508 !! html/parsoid
6509 <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}}]}'>
6510 <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>
6511 <tr>
6512 <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>
6513 </tbody></table>
6514 !! end
6515
6516 ## Edge case fix to prevent future regressions
6517 !! test
6518 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6519 !! wikitext
6520 {|
6521 |{{table_attribs_7}}
6522 |}
6523 <references />
6524 !! html/parsoid
6525 <table>
6526 <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>
6527 </tbody></table>
6528 <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>
6529 !! end
6530
6531 !! test
6532 Table with row followed by newlines and table heading
6533 !! wikitext
6534 {|
6535 |-
6536
6537 ! foo
6538 |}
6539 !! html
6540 <table>
6541
6542
6543 <tr>
6544 <th> foo
6545 </th></tr></table>
6546
6547 !! end
6548
6549 !! test
6550 Table with empty line following the start tag
6551 !! wikitext
6552 {|
6553
6554 |-
6555 | foo
6556 |}
6557 !! html
6558 <table>
6559
6560
6561 <tr>
6562 <td> foo
6563 </td></tr></table>
6564
6565 !! end
6566
6567 !! test
6568 Table attributes with empty value
6569 !! options
6570 parsoid=wt2html,html2html
6571 !! wikitext
6572 {|
6573 | style=| hello
6574 |}
6575 !! html/php
6576 <table>
6577 <tr>
6578 <td style=""> hello
6579 </td></tr></table>
6580
6581 !! html/parsoid
6582 <table>
6583 <tbody><tr><td style=""> hello</td></tr>
6584 </tbody></table>
6585 !! end
6586
6587 !! test
6588 Wikitext table with a lot of comments
6589 !! wikitext
6590 {|
6591 <!-- c0 -->
6592 | foo
6593 <!-- c1 -->
6594 |-<!-- c2 -->
6595 <!-- c3 -->
6596 |<!-- c4 -->
6597 <!-- c5 -->
6598 |}
6599 !! html
6600 <table>
6601 <tr>
6602 <td> foo
6603 </td></tr>
6604 <tr>
6605 <td>
6606 </td></tr></table>
6607
6608 !! end
6609
6610 !! test
6611 Wikitext table comments represented in parsoid dom
6612 !! wikitext
6613 {|<!--c1--><!--c2-->
6614 |-<!--c3-->
6615 | x
6616 |}
6617 !! html/php+tidy
6618 <table>
6619 <tr>
6620 <td>x</td>
6621 </tr>
6622 </table>
6623 !! html/parsoid
6624 <table><!--c1--><!--c2-->
6625 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6626 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6627 </tbody></table>
6628 !! end
6629
6630 !! test
6631 Wikitext table with double-line table cell
6632 !! wikitext
6633 {|
6634 |a
6635 b
6636 |}
6637 !! html
6638 <table>
6639 <tr>
6640 <td>a
6641 <p>b
6642 </p>
6643 </td></tr></table>
6644
6645 !! end
6646
6647 !! test
6648 Table cell with a single comment
6649 !! wikitext
6650 {|
6651 | <!-- c1 -->
6652 | a
6653 |}
6654 !! html
6655 <table>
6656 <tr>
6657 <td>
6658 </td>
6659 <td> a
6660 </td></tr></table>
6661
6662 !! end
6663
6664 !! test
6665 Table-cell after a comment-only-empty-line
6666 !! wikitext
6667 {|
6668 |a
6669 <!--c1-->
6670 <!--c2-->| b
6671 |}
6672 !! html
6673 <table>
6674 <tr>
6675 <td>a
6676 </td>
6677 <td> b
6678 </td></tr></table>
6679
6680 !! html/parsoid
6681 <table>
6682 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6683 <!--c1-->
6684 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6685 </tbody></table>
6686
6687 !! end
6688
6689 !! test
6690 Build table with {{!}}
6691 !! wikitext
6692 {{{!}} class="wikitable"
6693 ! header
6694 ! second header
6695 {{!}}- style="color:red;"
6696 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6697 {{!}}}
6698 !! html
6699 <table class="wikitable">
6700 <tr>
6701 <th> header
6702 </th>
6703 <th> second header
6704 </th></tr>
6705 <tr style="color:red;">
6706 <td> data </td>
6707 <td style="color:red;"> second data
6708 </td></tr></table>
6709
6710 !! end
6711
6712 !! test
6713 Build table with pipe as data
6714 !! wikitext
6715 {| class="wikitable"
6716 ! header
6717 ! second header
6718 |- style="color:red;"
6719 | data || style="color:red;" | second data
6720 |-
6721 | style="color:red;" | data with | || style="color:red;" | second data with |
6722 |-
6723 || data with | ||| second data with |
6724 |}
6725 !! html
6726 <table class="wikitable">
6727 <tr>
6728 <th> header
6729 </th>
6730 <th> second header
6731 </th></tr>
6732 <tr style="color:red;">
6733 <td> data </td>
6734 <td style="color:red;"> second data
6735 </td></tr>
6736 <tr>
6737 <td style="color:red;"> data with | </td>
6738 <td style="color:red;"> second data with |
6739 </td></tr>
6740 <tr>
6741 <td> data with | </td>
6742 <td> second data with |
6743 </td></tr></table>
6744
6745 !! end
6746
6747 !! test
6748 Build table with wikilink
6749 !! wikitext
6750 {| class="wikitable"
6751 ! header || second header
6752 |- style="color:red;"
6753 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6754 |-
6755 | data || second data [[Main Page|link|text with pipe]]
6756 |}
6757 !! html
6758 <table class="wikitable">
6759 <tr>
6760 <th> header </th>
6761 <th> second header
6762 </th></tr>
6763 <tr style="color:red;">
6764 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6765 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6766 </td></tr>
6767 <tr>
6768 <td> data </td>
6769 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6770 </td></tr></table>
6771
6772 !! end
6773
6774 # The expected HTML structure in this test is debatable. The PHP parser does
6775 # not parse this kind of table at all. The main focus for Parsoid is on
6776 # round-tripping, so this output is ok for now. TODO: revisit!
6777 !! test
6778 Wikitext table with html-syntax row
6779 !! wikitext
6780 {|
6781 |-
6782 <td>foo</td>
6783 |}
6784 !! html/parsoid
6785 <table>
6786 <tbody>
6787 <tr>
6788 <td>foo</td></tr></tbody></table>
6789 !! end
6790
6791 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6792 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6793 ## PHP parser, which tidy then compounds by fostering the content
6794 ## entirely out of the table. Parsoid recognizes the table context
6795 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6796 ## depends on PHP's treatment of broken table markup!
6797 !! test
6798 Implicit <td> after a |-
6799 !! options
6800 parsoid=wt2html,html2html
6801 !! wikitext
6802 {|
6803 |-
6804 a
6805 |}
6806 !! html/php
6807 <table>
6808
6809 a
6810 </table>
6811
6812 !! html/php+tidy
6813 <p>a</p>
6814 !! html/parsoid
6815 <table>
6816 <tr><td>a</td></tr>
6817 </table>
6818 !! end
6819
6820 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6821 !! test
6822 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6823 !! options
6824 parsoid=wt2html,html2html
6825 !! wikitext
6826 {|
6827 |-
6828 |
6829 a
6830 |-
6831 b
6832 |}
6833 !! html/php
6834 <table>
6835
6836 <tr>
6837 <td>
6838 <pre>a
6839 </pre>
6840 </td></tr>
6841 b
6842 </table>
6843
6844 !! html/php+tidy
6845 <p>b</p>
6846 <table>
6847 <tr>
6848 <td>
6849 <pre>
6850 a
6851 </pre></td>
6852 </tr>
6853 </table>
6854 !! html/parsoid
6855 <table>
6856 <tbody>
6857 <tr><td><pre>a</pre></td></tr>
6858 <tr><td> b</td></tr>
6859 </tbody>
6860 </table>
6861 !! end
6862
6863 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6864 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6865 !! test
6866 Lists should be recognized in an implicit <td> context
6867 !! options
6868 parsoid=wt2html,html2html
6869 !! wikitext
6870 {|
6871 |-
6872 *a
6873 |}
6874 !! html/php
6875 <table>
6876
6877 <ul><li>a</li></ul>
6878 </table>
6879
6880 !! html/php+tidy
6881 <ul>
6882 <li>a</li>
6883 </ul>
6884 !! html/parsoid
6885 <table>
6886 <tr>
6887 <td><ul>
6888 <li>a</li>
6889 </ul></td>
6890 </tr>
6891 </table>
6892 !! end
6893
6894 !! test
6895 Table cells not properly parsed in an implicit-td context
6896 !! wikitext
6897 {|
6898 |-
6899 {{table_attribs_4}} || a || b
6900 |}
6901 !! html/php+tidy
6902 <table>
6903 <tr>
6904 <td style="background-color:#DC241f;" width="10px"></td>
6905 <td>a</td>
6906 <td>b</td>
6907 </tr>
6908 </table>
6909 !! html/parsoid
6910 <table>
6911 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6912 <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>
6913 </tbody></table>
6914 !! end
6915
6916 !! test
6917 Parsoid: Round-trip tables directly followed by content (bug 51219)
6918 !! options
6919 parsoid=wt2html,wt2wt
6920 !! wikitext
6921 {|
6922 |foo
6923 |} bar
6924
6925 {|
6926 |baz
6927 |}<b>quux</b>
6928 !! html+tidy
6929 <table>
6930 <tr>
6931 <td>foo</td>
6932 </tr>
6933 </table>
6934 <p>bar</p>
6935 <table>
6936 <tr>
6937 <td>baz</td>
6938 </tr>
6939 </table>
6940 <p><b>quux</b></p>
6941 !! end
6942
6943 !! test
6944 Parsoid: Default to a newline after tables in new content (bug 51219)
6945 !! options
6946 parsoid=html2wt
6947 !! html/parsoid
6948 <table><tbody>
6949 <tr><td>foo</td></tr></tbody></table> bar
6950 <table><tbody>
6951 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6952 !! wikitext
6953 {|
6954 |foo
6955 |}
6956 <nowiki> </nowiki>bar
6957 {|
6958 |baz
6959 |}
6960 '''quux'''
6961 !! end
6962
6963 !! test
6964 Parsoid: newline inducing block nodes don't suppress <nowiki>
6965 !! options
6966 parsoid=html2wt
6967 !! html/parsoid
6968 a<h1>foo</h1>
6969 !! wikitext
6970 <nowiki> </nowiki>a
6971
6972 = foo =
6973 !! end
6974
6975 !! test
6976 Parsoid: Row-syntax table headings followed by comment & table cells
6977 !! options
6978 parsoid=wt2html,wt2wt
6979 !! wikitext
6980 {|
6981 ! foo || bar
6982 <!-- foo --> || baz || quux
6983 |}
6984 !! html/php
6985 <table>
6986 <tr>
6987 <th> foo </th>
6988 <th> bar
6989 </th>
6990 <td> baz </td>
6991 <td> quux
6992 </td></tr></table>
6993
6994 !! html/parsoid
6995 <table>
6996 <tbody><tr><th> foo </th><th> bar
6997 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
6998 </tbody></table>
6999 !! end
7000
7001 !!test
7002 Parsoid: Recover better from broken table attributes
7003 !!options
7004 parsoid=wt2html
7005 !!wikitext
7006 {| class="foo
7007 | class="bar" |
7008 foo
7009 |}
7010 !!html/php+tidy
7011 <table class="foo">
7012 <tr>
7013 <td class="bar">
7014 <p>foo</p>
7015 </td>
7016 </tr>
7017 </table>
7018 !!html/parsoid
7019 <table class="foo">
7020 <tr>
7021 <td class="bar">
7022 <p>foo</p></td></tr>
7023 </tbody></table>
7024 !!end
7025
7026 !! test
7027 Tables: Digest broken attributes on table and tr tag
7028 !! options
7029 parsoid=wt2html
7030 !! wikitext
7031 {| || |} ++
7032 |- || || ++ --
7033 |- > [
7034 |}
7035 !! html
7036 <table>
7037 <tbody>
7038 <tr></tr>
7039 <tr></tr>
7040 </tbody></table>
7041 !! end
7042
7043 !! test
7044 Strip unsupported table tags
7045 !! options
7046 parsoid=html2wt
7047 !! html/parsoid
7048 <table>
7049 <thead>
7050 <tr>
7051 <th>Month</th>
7052 <th>Savings</th>
7053 </tr>
7054 </thead>
7055 <tbody>
7056 <tr>
7057 <td>January</td>
7058 <td>$100</td>
7059 </tr>
7060 <tr>
7061 <td>February</td>
7062 <td>$80</td>
7063 </tr>
7064 </tbody>
7065 <tfoot>
7066 <tr>
7067 <td>Sum</td>
7068 <td>$180</td>
7069 </tr>
7070 </tfoot>
7071 </table>
7072 !! wikitext
7073 {|
7074
7075 !Month
7076 !Savings
7077
7078 |January
7079 |$100
7080
7081 |-
7082 |February
7083 |$80
7084
7085 |Sum
7086 |$180
7087
7088 |}
7089 !! end
7090
7091 !!test
7092 Testing serialization after deletion of table cells
7093 !!options
7094 parsoid={
7095 "modes": ["wt2wt", "selser"],
7096 "changes": [
7097 ["#x", "remove"]
7098 ]
7099 }
7100 !!wikitext
7101 {|
7102 !h1 !!h2 !!h3
7103 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7104 |}
7105 !! wikitext/edited
7106 {|
7107 !h1 !!h2 !!h3
7108 |c2 |||c3
7109 |}
7110 !!end
7111
7112 ###
7113 ### Internal links
7114 ###
7115 !! test
7116 Plain link, capitalized
7117 !! wikitext
7118 [[Main Page]]
7119 !! html
7120 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7121 </p>
7122 !! end
7123
7124 !! test
7125 Plain link, uncapitalized
7126 !! wikitext
7127 [[main Page]]
7128 !! html
7129 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7130 </p>
7131 !! end
7132
7133 !! test
7134 Piped link
7135 !! wikitext
7136 [[Main Page|The Main Page]]
7137 !! html
7138 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7139 </p>
7140 !! end
7141
7142 !! test
7143 Piped link with comment in link text
7144 !! wikitext
7145 [[Main Page|The Main<!--front--> Page]]
7146 !! html
7147 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7148 </p>
7149 !! end
7150
7151 !! test
7152 Piped link with multiple pipe characters in link text
7153 !! wikitext
7154 [[Main Page||The|Main|Page|]]
7155 !! html/php
7156 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7157 </p>
7158 !! html/parsoid
7159 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7160 !! end
7161
7162 !! test
7163 Piped link with no link text
7164 !! wikitext
7165 [[Thomas Bek (bishop of St David's)|]]
7166 !! html/php
7167 <p>[[Thomas Bek (bishop of St David's)|]]
7168 </p>
7169 !! html/parsoid
7170 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7171 !! end
7172
7173 !! test
7174 Broken link
7175 !! wikitext
7176 [[Zigzagzogzagzig]]
7177 !! html
7178 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7179 </p>
7180 !! end
7181
7182 !! test
7183 Broken link with fragment
7184 !! wikitext
7185 [[Zigzagzogzagzig#zug]]
7186 !! html
7187 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7188 </p>
7189 !! end
7190
7191 !! test
7192 Special page link with fragment
7193 !! wikitext
7194 [[Special:Version#anchor]]
7195 !! html
7196 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7197 </p>
7198 !! end
7199
7200 !! test
7201 Nonexistent special page link with fragment
7202 !! wikitext
7203 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7204 !! html
7205 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7206 </p>
7207 !! end
7208
7209 !! test
7210 Link with prefix
7211 !! wikitext
7212 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7213 !! html
7214 <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>
7215 </p>
7216 !! end
7217
7218 !! test
7219 Link with suffix
7220 !! wikitext
7221 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7222 !! html
7223 <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>!!!
7224 </p>
7225 !! end
7226
7227 !! article
7228 prefixed article
7229 !! text
7230 Some text
7231 !! endarticle
7232
7233 !! test
7234 Bug 43661: Piped links with identical prefixes
7235 !! wikitext
7236 [[prefixed article|prefixed articles with spaces]]
7237
7238 [[prefixed article|prefixed articlesaoeu]]
7239
7240 [[Main Page|Main Page test]]
7241 !! html
7242 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7243 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7244 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7245 </p>
7246 !! end
7247
7248
7249 !! test
7250 Link with HTML entity in suffix / tail
7251 !! wikitext
7252 [[Main Page]]&quot;, [[Main Page]]&#97;
7253 !! html/php
7254 <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;
7255 </p>
7256 !! html/parsoid
7257 <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>
7258 !! end
7259
7260 !! test
7261 Link with 3 brackets
7262 !! wikitext
7263 [[[Main Page]]]
7264 Foo [[[Main Page]]]
7265 !! html
7266 <p>[[[Main Page]]]
7267 Foo [[[Main Page]]]
7268 </p>
7269 !! end
7270
7271 !! test
7272 Link with 4 brackets
7273 !! wikitext
7274 [[[[Main Page]]]]
7275 !! html
7276 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7277 </p>
7278 !! end
7279
7280 !! test
7281 Piped link with 3 brackets
7282 !! wikitext
7283 [[[main page|the main page]]]
7284 !! html
7285 <p>[[[main page|the main page]]]
7286 </p>
7287 !! end
7288
7289 !! test
7290 Piped link with extlink-like text
7291 !! wikitext
7292 [[Main Page|[bar]]]
7293 [[Main Page|This is a [bar]]]
7294 !! html/php
7295 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7296 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7297 </p>
7298 !! html/parsoid
7299 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7300 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7301 !! end
7302
7303 !! test
7304 Link with multiple pipes
7305 !! wikitext
7306 [[Main Page|The|Main|Page]]
7307 !! html
7308 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7309 </p>
7310 !! end
7311
7312 # Note that parsoid does not munge anchor text; all non-space
7313 # characters are valid in HTML5 ids.
7314 !! test
7315 Anchor containing a #. (bug 63430)
7316 !! wikitext
7317 [[Main Page#And#Link]]
7318 !! html/php
7319 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7320 </p>
7321 !! html/parsoid
7322 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
7323 !! end
7324
7325 !! test
7326 Link to namespaces
7327 !! wikitext
7328 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7329 !! html
7330 <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>
7331 </p>
7332 !! end
7333
7334 !! test
7335 Link with space in namespace
7336 !! wikitext
7337 [[User talk:Foo bar]]
7338 !! html
7339 <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>
7340 </p>
7341 !! end
7342
7343 !! article
7344 MemoryAlpha:AlphaTest
7345 !! text
7346 This is an article in the MemoryAlpha namespace
7347 (which shadows the memoryalpha interwiki link).
7348 !! endarticle
7349
7350 !! test
7351 Namespace takes precedence over interwiki link (bug 51680)
7352 !! wikitext
7353 [[MemoryAlpha:AlphaTest]]
7354 !! html
7355 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7356 </p>
7357 !! end
7358
7359 # The previous test doesn't work correctly in html2*, due to not recognizing the
7360 # link as an internal one. This one checks for the correct behavior.
7361 !! test
7362 Link to namespace preferred over interwiki with correct rel attribute
7363 !! options
7364 parsoid=html2wt,html2html
7365 !! html/parsoid
7366 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7367 !! wikitext
7368 [[MemoryAlpha:AlphaTest]]
7369 !! end
7370
7371 !! test
7372 Piped link to namespace
7373 !! wikitext
7374 [[Meta:Disclaimers|The disclaimers]]
7375 !! html
7376 <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>
7377 </p>
7378 !! end
7379
7380 !! test
7381 Link containing }
7382 !! wikitext
7383 [[Usually caused by a typo (oops}]]
7384 !! html
7385 <p>[[Usually caused by a typo (oops}]]
7386 </p>
7387 !! end
7388
7389 !! article
7390 7% Solution
7391 !! text
7392 Just a test of an article title containing a percent.
7393 !! endarticle
7394
7395 !! test
7396 Link containing % (not as a hex sequence)
7397 !! wikitext
7398 [[7% Solution]]
7399 !! html/php
7400 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7401 </p>
7402 !! html/parsoid
7403 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7404 !! end
7405
7406 # note that the parsoid HTML is identical to the previous test output,
7407 # so the previous test ensures that the html2wt mode will generate the
7408 # "not as a hex sequence" wikitext.
7409 !! test
7410 Link containing % as a single hex sequence interpreted to char
7411 !! options
7412 parsoid=wt2wt,wt2html,html2html
7413 !! wikitext
7414 [[7%25 Solution]]
7415 !! html/php
7416 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7417 </p>
7418 !! html/parsoid
7419 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7420 !!end
7421
7422 !! test
7423 Link containing % as a double hex sequence interpreted to hex sequence
7424 !! wikitext
7425 [[7%2525 Solution]]
7426 !! html
7427 <p>[[7%2525 Solution]]
7428 </p>
7429 !!end
7430
7431 # note that parsoid does not munge anchor text; all non-space
7432 # characters are valid in HTML5 anchors.
7433 !! test
7434 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7435 Example for such a section: == < ==
7436 !! wikitext
7437 [[%23%3c]][[%23%3e]]
7438 !! html/php
7439 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7440 </p>
7441 !! html/parsoid
7442 <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>
7443 !! end
7444
7445 !! test
7446 Link containing "<#" and ">#" as a hex sequences
7447 !! wikitext
7448 [[%3c%23]][[%3e%23]]
7449 !! html
7450 <p>[[%3c%23]][[%3e%23]]
7451 </p>
7452 !! end
7453
7454 !! test
7455 Link containing an equals sign
7456 !! wikitext
7457 [[Special:BookSources/isbn=4-00-026157-6]]
7458 !! html/php
7459 <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>
7460 </p>
7461 !! html/parsoid
7462 <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>
7463 !! end
7464
7465 !! article
7466 Foo~bar
7467 !! text
7468 Just a test of an article title containing a tilde.
7469 !! endarticle
7470
7471 # note that links containing signatures, like [[Foo~~~~]], are
7472 # massaged by the pre-save transform (PST) and so the tildes are never
7473 # seen by the parser.
7474 !! test
7475 Link containing a tilde
7476 !! wikitext
7477 [[Foo~bar]]
7478 !! html/php
7479 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7480 </p>
7481 !! html/parsoid
7482 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7483 !! end
7484
7485 !! test
7486 Link containing double-single-quotes '' (bug 4598)
7487 !! wikitext
7488 [[Lista d''e paise d''o munno]]
7489 !! html/php
7490 <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>
7491 </p>
7492 !! html/parsoid
7493 <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>
7494 !! end
7495
7496 !! test
7497 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7498 !! wikitext
7499 Some [[Link|pretty ''italics'' and stuff]]!
7500 !! html/php
7501 <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>!
7502 </p>
7503 !! html/parsoid
7504 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7505 !! end
7506
7507 !! test
7508 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7509 !! wikitext
7510 ''Some [[Link|pretty ''italics'' and stuff]]!''
7511 !! html
7512 <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>
7513 </p>
7514 !! end
7515
7516 !! test
7517 Link with double quotes in title part (literal) and alternate part (interpreted)
7518 !! wikitext
7519 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7520
7521 [[''Pentecoste'']]
7522
7523 [[''Pentecoste''|Pentecoste]]
7524
7525 [[''Pentecoste''|''Pentecoste'']]
7526 !! html/php
7527 <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>
7528 </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>
7529 </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>
7530 </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>
7531 </p>
7532 !! html/parsoid
7533 <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>
7534 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7535 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7536 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7537 !! end
7538
7539 !! test
7540 Broken image links with HTML captions (bug 39700)
7541 !! wikitext
7542 [[File:Nonexistent|<script></script>]]
7543 [[File:Nonexistent|100x100px|<script></script>]]
7544 [[File:Nonexistent|&lt;]]
7545 [[File:Nonexistent|a<i>b</i>c]]
7546 !! html/php
7547 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7548 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7549 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7550 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7551 </p>
7552 !! html/parsoid
7553 <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>
7554 <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>
7555 <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>
7556 <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>
7557 !! end
7558
7559 !! test
7560 Plain link to URL
7561 !! wikitext
7562 [[http://www.example.com]]
7563 !! html/php
7564 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7565 </p>
7566 !! html/parsoid
7567 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7568 !! end
7569
7570 !! test
7571 Plain link to URL with link text
7572 !! wikitext
7573 [[http://www.example.com Link text]]
7574 !! html
7575 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7576 </p>
7577 !! end
7578
7579 !! test
7580 Plain link to protocol-relative URL
7581 !! wikitext
7582 [[//www.example.com]]
7583 !! html/php
7584 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7585 </p>
7586 !! html/parsoid
7587 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7588 !! end
7589
7590 !! test
7591 Plain link to protocol-relative URL with link text
7592 !! wikitext
7593 [[//www.example.com Link text]]
7594 !! html
7595 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7596 </p>
7597 !! end
7598
7599 !! test
7600 Plain link to page with question mark in title
7601 !! wikitext
7602 [[A?b]]
7603
7604 [[A?b|Baz]]
7605 !! html
7606 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7607 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7608 </p>
7609 !! end
7610
7611
7612 # I'm fairly sure the expected result here is wrong.
7613 # We want these to be URL links, not pseudo-pages with URLs for titles....
7614 # However the current output is also pretty screwy.
7615 #
7616 # ----
7617 # I'm changing it to match the current output--it arguably makes more
7618 # sense in the light of the test above. Old expected result was:
7619 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7620 #</p>
7621 # But I think this test is bordering on "garbage in, garbage out" anyway.
7622 # -- wtm
7623 !! test
7624 Piped link to URL
7625 !! wikitext
7626 Piped link to URL: [[http://www.example.com|an example URL]]
7627 !! html/php
7628 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7629 </p>
7630 !! html/parsoid
7631 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7632 !! end
7633
7634 !! test
7635 BUG 2: [[page|http://url/]] should link to page, not http://url/
7636 !! wikitext
7637 [[Main Page|http://url/]]
7638 !! html/php
7639 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7640 </p>
7641 !! html/parsoid
7642 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7643 !! end
7644
7645 # Parsoid does not mark self-links, by design.
7646 !! test
7647 BUG 337: Escaped self-links should be bold
7648 !! options
7649 title=[[Bug462]]
7650 !! wikitext
7651 [[Bu&#103;462]] [[Bug462]]
7652 !! html/php
7653 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7654 </p>
7655 !! html/php+tidy
7656 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7657 !! html/parsoid
7658 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7659 !! end
7660
7661 !! test
7662 Self-link to section should not be bold
7663 !! options
7664 title=[[Main Page]]
7665 !! wikitext
7666 [[Main Page#section]]
7667 !! html
7668 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7669 </p>
7670 !! end
7671
7672 !! article
7673 00
7674 !! text
7675 This is 00.
7676 !! endarticle
7677
7678 !!test
7679 Self-link to numeric title
7680 !!options
7681 title=[[0]]
7682 !! wikitext
7683 [[0]]
7684 !! html
7685 <p><strong class="selflink">0</strong>
7686 </p>
7687 !!end
7688
7689 !!test
7690 Link to numeric-equivalent title
7691 !!options
7692 title=[[0]]
7693 !! wikitext
7694 [[00]]
7695 !! html
7696 <p><a href="/wiki/00" title="00">00</a>
7697 </p>
7698 !!end
7699
7700 !! test
7701 <nowiki> inside a link
7702 !! wikitext
7703 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7704 !! html
7705 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7706 </p>
7707 !! end
7708
7709 !! test
7710 Non-breaking spaces in title
7711 !! wikitext
7712 [[&nbsp; Main &nbsp; Page &nbsp;]]
7713 !! html
7714 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7715 </p>
7716 !!end
7717
7718 !! test
7719 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7720 !! options
7721 language=ca
7722 !! wikitext
7723 '''[[Main Page]]'''
7724 !! html
7725 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7726 </p>
7727 !! end
7728
7729 !! test
7730 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7731 !! options
7732 language=ca
7733 !! wikitext
7734 ''[[Main Page]]''
7735 !! html
7736 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7737 </p>
7738 !! end
7739
7740 !! test
7741 Internal link with en linktrail: no apostrophes (bug 27473)
7742 !! options
7743 language=en
7744 !! wikitext
7745 [[Something]]'nice
7746 !! html
7747 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
7748 </p>
7749 !! end
7750
7751 !! test
7752 Internal link with ca linktrail with apostrophes (bug 27473)
7753 !! options
7754 language=ca
7755 !! wikitext
7756 [[Something]]'nice
7757 !! html
7758 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
7759 </p>
7760 !! end
7761
7762 !! test
7763 Internal link with kaa linktrail with apostrophes (bug 27473)
7764 !! options
7765 language=kaa
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 (bet ele jaratılmag'an)">Something'nice</a>
7770 </p>
7771 !! end
7772
7773 !! test
7774 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
7775 !! wikitext
7776 [[User:Foo/Test/63636:Bar|Test]]
7777 !! html/php
7778 <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>
7779 </p>
7780 !! html/parsoid
7781 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
7782 !! end
7783
7784 !! test
7785 Purely hash wikilink
7786 !! options
7787 title=[[User:test/123]]
7788 !! wikitext
7789 [[#a|b]]
7790 !! html/php
7791 <p><a href="#a">b</a>
7792 </p>
7793 !! html/parsoid
7794 <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>
7795 !! end
7796
7797 !! test
7798 1. Interaction of linktrail and template encapsulation
7799 !! options
7800 parsoid
7801 !! wikitext
7802 {{echo|[[Foo]]}}l
7803 !! html
7804 <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>
7805 !! end
7806
7807 !! test
7808 2. Interaction of linktrail and template encapsulation
7809 !! options
7810 parsoid
7811 !! wikitext
7812 {{echo|Some [[Fool]]}}s
7813 !! html
7814 <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>
7815 !! end
7816
7817 !! test
7818 3. Interaction of linktrail and template encapsulation
7819 !! options
7820 parsoid
7821 !! wikitext
7822 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
7823 !! html
7824 <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>
7825 !! end
7826
7827 !! article
7828 Söfnuður
7829 !! text
7830 Test.
7831 !! endarticle
7832
7833 !! test
7834 Internal link with is link prefix
7835 !! options
7836 language=is
7837 !! wikitext
7838 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
7839 !! html
7840 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
7841 </p>
7842 !! end
7843
7844 !! article
7845 Mótmælendatrú
7846 !! text
7847 Test.
7848 !! endarticle
7849
7850 !! test
7851 Internal link with is link trail and link prefix
7852 !! options
7853 language=is
7854 !! wikitext
7855 [[mótmælendatrú|xxx]]ar
7856 [[mótmælendatrú]]ar
7857 mótmælenda[[söfnuður]]
7858 mótmælenda[[söfnuður|söfnuðir]]
7859 mótmælenda[[söfnuður|söfnuðir]]xxx
7860 !! html
7861 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
7862 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
7863 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
7864 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
7865 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
7866 </p>
7867 !! end
7868
7869 !! test
7870 Parsoid link trail escaping
7871 !! options
7872 parsoid=html2wt,html2html
7873 !! html/parsoid
7874 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
7875 !! wikitext
7876 [[apple]]<nowiki/>s
7877 !! end
7878
7879 !! test
7880 Parsoid link prefix escaping
7881 !! options
7882 language=is
7883 parsoid=html2wt,html2html
7884 !! html/parsoid
7885 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
7886 !! wikitext
7887 Aðrir mótmælenda<nowiki/>[[söfnuður]]
7888 !! end
7889
7890 !! test
7891 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
7892 !! wikitext
7893 [[Foo| bar]]
7894
7895 [[Foo| ''bar'']]
7896
7897 [http://wp.org foo]
7898
7899 [http://wp.org ''foo'']
7900 !! html
7901 <p><a href="/wiki/Foo" title="Foo"> bar</a>
7902 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
7903 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
7904 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
7905 </p>
7906 !! end
7907
7908 !! test
7909 Parsoid: Scoped parsing should handle mixed transclusions and plain text
7910 !! options
7911 parsoid
7912 !! wikitext
7913 [[Foo|{{echo|a}} b {{echo|c}}]]
7914 !! html
7915 <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>
7916 !! end
7917
7918 !! test
7919 Link with angle bracket after anchor
7920 !! wikitext
7921 [[Foo#<bar>]]
7922 !! html/php
7923 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
7924 </p>
7925 !! html/parsoid
7926 <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>
7927 !! end
7928
7929 ###
7930 ### Interwiki links (see maintenance/interwiki.sql)
7931 ###
7932
7933 !! test
7934 Inline interwiki link
7935 !! options
7936 parsoid=wt2html,wt2wt,html2html
7937 !! wikitext
7938 [[MeatBall:SoftSecurity]]
7939 !! html/php
7940 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
7941 </p>
7942 !! html/parsoid
7943 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
7944 !! end
7945
7946 !! test
7947 Inline interwiki link with empty title (bug 2372)
7948 !! options
7949 parsoid=wt2html,wt2wt,html2html
7950 !! wikitext
7951 [[MeatBall:]]
7952 !! html/php
7953 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
7954 </p>
7955 !! html/parsoid
7956 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
7957 !! end
7958
7959 !! test
7960 Interwiki link encoding conversion (bug 1636)
7961 !! wikitext
7962 *[[Wikipedia:ro:Olteni&#0355;a]]
7963 *[[Wikipedia:ro:Olteni&#355;a]]
7964 !! html
7965 <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>
7966 <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>
7967
7968 !! html+tidy
7969 <ul>
7970 <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>
7971 <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>
7972 </ul>
7973 !! end
7974
7975 !! test
7976 Interwiki link with fragment (bug 2130)
7977 !! wikitext
7978 [[MeatBall:SoftSecurity#foo]]
7979 !! html
7980 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
7981 </p>
7982 !! end
7983
7984 # Ideally the wikipedia: prefix here should be proto-relative too
7985 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
7986 # define the 'en' prefix, and originally the test used 'wikipedia',
7987 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
7988 # article.
7989 !! test
7990 Different interwiki prefixes mapping to the same URL
7991 !! wikitext
7992 [[:en:Foo]]
7993
7994 [[:en:Foo|Foo]]
7995
7996 [[wikipedia:Foo]]
7997
7998 [[:wikipedia:Foo|Foo]]
7999
8000 [[wikipedia:en:Foo]]
8001
8002 [[:wikipedia:en:Foo]]
8003
8004 [[ wikiPEdia :Foo]]
8005 !! html/parsoid
8006 <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>
8007
8008 <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>
8009
8010 <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>
8011
8012 <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>
8013
8014 <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>
8015
8016 <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>
8017
8018 <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>
8019 !! end
8020
8021 !! test
8022 Interwiki links that cannot be represented in wiki syntax
8023 !! wikitext
8024 [[meatball:ok]]
8025 [[meatball:ok#foo|ok with fragment]]
8026 [[meatball:ok_as_well?|ok ending with ? mark]]
8027 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8028 [http://de.wikipedia.org/wiki/#foo is just fragment]
8029
8030 !! html/php
8031 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8032 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8033 <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>
8034 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8035 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8036 </p>
8037 !! html/parsoid
8038 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8039 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8040 <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>
8041 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8042 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8043 !! end
8044
8045 !! test
8046 Interwiki links: trail
8047 !! wikitext
8048 [[wikipedia:Foo|Ba]]r
8049 !! html/php
8050 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8051 </p>
8052 !! html/parsoid
8053 <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>
8054 !! end
8055
8056 !! test
8057 Local interwiki link
8058 !! options
8059 parsoid=wt2html,wt2wt,html2html
8060 !! wikitext
8061 [[local:Template:Foo]]
8062 !! html/php
8063 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8064 </p>
8065 !! html/parsoid
8066 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8067 !! end
8068
8069 # Parsoid does not mark self-links, by design.
8070 !! test
8071 Local interwiki link: self-link to current page
8072 !! options
8073 title=[[Main Page]]
8074 parsoid=wt2html,wt2wt,html2html
8075 !! wikitext
8076 [[local:Main Page]]
8077 !! html/php
8078 <p><strong class="selflink">local:Main Page</strong>
8079 </p>
8080 !! html/parsoid
8081 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8082 !! end
8083
8084 !! test
8085 Local interwiki link: prefix only (bug 64167)
8086 !! options
8087 parsoid=wt2html,wt2wt,html2html
8088 !! wikitext
8089 [[local:]]
8090 !! html/php
8091 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8092 </p>
8093 !! html/parsoid
8094 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8095 !! end
8096
8097 !! test
8098 Local interwiki link: with additional interwiki prefix (bug 61357)
8099 !! options
8100 parsoid=wt2html,wt2wt,html2html
8101 !! wikitext
8102 [[local:meatball:Hello]]
8103 !! html/php
8104 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8105 </p>
8106 !! html/parsoid
8107 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8108 !! end
8109
8110 !! test
8111 Multiple local interwiki link prefixes
8112 !! wikitext
8113 [[local:local:local:local:mi:local:Foo]]
8114 !! options
8115 parsoid=wt2html,wt2wt,html2html
8116 !! html/php
8117 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8118 </p>
8119 !! html/parsoid
8120 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8121 !! end
8122
8123 ###
8124 ### Interlanguage links
8125 ### Language links (so that searching for '### language' matches..)
8126 ###
8127
8128 !! test
8129 Interlanguage link
8130 !! options
8131 parsoid=wt2html,wt2wt,html2html
8132 !! wikitext
8133 Blah blah blah
8134 [[zh:Chinese]]
8135 !! html/php
8136 <p>Blah blah blah
8137 </p>
8138 !! html/parsoid
8139 <p>Blah blah blah</p>
8140 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8141 !! end
8142
8143 !! test
8144 Interlanguage link with spacing
8145 !! options
8146 parsoid=wt2html,wt2wt,html2html
8147 !! wikitext
8148 Blah blah blah
8149 [[ zh : Chinese ]]
8150 !! html/php
8151 <p>Blah blah blah
8152 </p>
8153 !! html/parsoid
8154 <p>Blah blah blah</p>
8155 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8156 !! end
8157
8158 !! test
8159 Double interlanguage link
8160 !! options
8161 parsoid=wt2html,wt2wt,html2html
8162 !! wikitext
8163 Blah blah blah
8164 [[es:Spanish]]
8165 [[zh:Chinese]]
8166 !! html/php
8167 <p>Blah blah blah
8168 </p>
8169 !! html/parsoid
8170 <p>Blah blah blah</p>
8171 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8172 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8173 !! end
8174
8175 !! test
8176 Interlanguage link variations
8177 !! options
8178 parsoid=wt2html,wt2wt,html2html
8179 !! wikitext
8180 Blah blah blah
8181 [[ es :Spanish]]
8182 [[ ZH :Chinese]]
8183 [[es:Foo_bar]]
8184 !! html/php
8185 <p>Blah blah blah
8186 </p>
8187 !! html/parsoid
8188 <p>Blah blah blah</p>
8189 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8190 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8191 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8192 !! end
8193
8194 !! test
8195 Space and question mark encoding in interlanguage links (T95473)
8196 !! options
8197 parsoid=wt2html,wt2wt,html2html
8198 !! wikitext
8199 Blah blah blah
8200 [[es:Foo bar?]]
8201 !! html/php
8202 <p>Blah blah blah
8203 </p>
8204 !! html/parsoid
8205 <p>Blah blah blah</p>
8206 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8207 !! end
8208
8209 !! test
8210 Interlanguage link, with prefix links
8211 !! options
8212 language=ln
8213 !! wikitext
8214 Blah blah blah
8215 [[zh:Chinese]]
8216 !! html/php
8217 <p>Blah blah blah
8218 </p>
8219 !! html/parsoid
8220 <p>Blah blah blah</p>
8221 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8222 !! end
8223
8224 !! test
8225 Double interlanguage link, with prefix links (bug 8897)
8226 !! options
8227 language=ln
8228 !! wikitext
8229 Blah blah blah
8230 [[es:Spanish]]
8231 [[zh:Chinese]]
8232 !! html/php
8233 <p>Blah blah blah
8234 </p>
8235 !! html/parsoid
8236 <p>Blah blah blah</p>
8237 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8238 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8239 !! end
8240
8241 !! test
8242 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8243 !! wikitext
8244 Blah blah blah
8245 [[mul:Article]]
8246 !! html/php
8247 <p>Blah blah blah
8248 </p>
8249 !! html/parsoid
8250 <p>Blah blah blah</p>
8251 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8252 !! end
8253
8254 !! test
8255 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8256 !! options
8257 language=ln
8258 !! wikitext
8259 [[WW&nbsp;II]]
8260 !! html
8261 <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>
8262 </p>
8263 !! end
8264
8265 !! test
8266 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8267 !! options
8268 parsoid=html2wt
8269 !! html/parsoid
8270 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8271 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8272 !! wikitext
8273 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8274
8275 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
8276 !! end
8277
8278 !! test
8279 Parsoid: handle constructor well
8280 !! wikitext
8281 [[constructor]]
8282
8283 [[constructor:foo]]
8284 !! html/php
8285 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8286 </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>
8287 </p>
8288 !! html/parsoid
8289 <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>
8290
8291 <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>
8292 !! end
8293
8294 !! article
8295 ko:
8296 !! text
8297 Test.
8298 !! endarticle
8299
8300 # Note that `ko` isn't a known interlanguage prefix
8301 !! test
8302 Parsoid: recognize interlanguage links without a target page
8303 !! options
8304 ill
8305 !! wikitext
8306 [[es:]]
8307
8308 [[ko:]]
8309 !! html/php
8310 es:
8311 !! html/parsoid
8312 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8313
8314 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8315 !! end
8316
8317 # Note that `ko` isn't a known interwiki prefix
8318 !! test
8319 Parsoid: recognize interwiki links without a target page
8320 !! options
8321 parsoid=wt2html,wt2wt,html2html
8322 !! wikitext
8323 [[:es:]]
8324
8325 [[:ko:]]
8326 !! html/php
8327 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8328 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8329 </p>
8330 !! html/parsoid
8331 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8332 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8333 !! end
8334
8335 !! test
8336 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8337 !! wikitext
8338 [[mi:Foo]]
8339 !! html/php
8340 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8341 </p>
8342 !! html/parsoid
8343 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8344 !! end
8345
8346 !! test
8347 Interlanguage link with preceding local interwiki link (bug 68085)
8348 !! options
8349 parsoid=wt2html,wt2wt,html2html
8350 !! wikitext
8351 Blah blah blah
8352 [[local:es:Spanish]]
8353 !! html/php
8354 <p>Blah blah blah
8355 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8356 </p>
8357 !! html/parsoid
8358 <p>Blah blah blah
8359 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8360 !! end
8361
8362 !! test
8363 Looks like an interlanguage link, but is actually a local interwiki
8364 !! options
8365 parsoid=wt2html,wt2wt,html2html
8366 !! wikitext
8367 Blah blah blah
8368 [[mi:Template:Foo]]
8369 !! html/php
8370 <p>Blah blah blah
8371 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8372 </p>
8373 !! html/parsoid
8374 <p>Blah blah blah
8375 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8376 !! end
8377
8378 ###
8379 ### Redirects, Parsoid-only
8380 ###
8381
8382 !! test
8383 1. Simple redirect to page
8384 !! wikitext
8385 #REDIRECT [[Main Page]]
8386 !! html/parsoid
8387 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8388 !! end
8389
8390 !! test
8391 2. Other redirect variants
8392 !! wikitext
8393 #REDIRECT [[Main_Page]]
8394 !! html/parsoid
8395 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8396 !! end
8397
8398 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8399 # This tests the Parsoid bail-out code.
8400 !! test
8401 3. Other redirect variants
8402 !! wikitext
8403 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8404 !! html/parsoid
8405 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8406 !! end
8407
8408 !! test
8409 4. Redirect to a templated destination
8410 !! wikitext
8411 #REDIRECT [[{{echo|Foo}}bar]]
8412 !! html/parsoid
8413 <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"}]]}'/>
8414 !! end
8415
8416 !! test
8417 Empty redirect
8418 !! options
8419 parsoid=wt2html,wt2wt
8420 !! wikitext
8421 #REDIRECT [[]]
8422 !! html/parsoid
8423 <ol>
8424 <li>REDIRECT [[]]</li></ol>
8425 !! end
8426
8427 !! test
8428 Optional colon in #REDIRECT
8429 !! options
8430 # the colon is archaic syntax. we support it for wt2html, but we
8431 # don't care that it roundtrips back to the modern syntax.
8432 parsoid=wt2html,html2html
8433 !! wikitext
8434 #REDIRECT:[[Main Page]]
8435 !! html/parsoid
8436 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8437 !! end
8438
8439 !! test
8440 Whitespace in #REDIRECT with optional colon
8441 !! options
8442 # the colon and gratuitous whitespace is archaic syntax. we support
8443 # it for wt2html, but we don't care that it roundtrips back to the
8444 # modern syntax (without extra whitespace)
8445 parsoid=wt2html,html2html
8446 !! wikitext
8447
8448 #REDIRECT
8449 :
8450 [[Main Page]]
8451 !! html/parsoid
8452 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8453 !! end
8454
8455 !! test
8456 Piped link in #REDIRECT
8457 !! options
8458 # content after piped link is ignored. we support this syntax,
8459 # but don't care that the piped link is lost when we roundtrip this.
8460 parsoid=wt2html
8461 !! wikitext
8462 #REDIRECT [[Main Page|bar]]
8463 !! html/parsoid
8464 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8465 !! end
8466
8467 !! test
8468 Redirect to category (T104502)
8469 !! options
8470 parsoid=wt2html,wt2wt
8471 !! wikitext
8472 #REDIRECT [[Category:Foo]]
8473 !! html/parsoid
8474 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8475 !! end
8476
8477 !! test
8478 Redirect to category with URL encoding (T104502)
8479 !! options
8480 parsoid=wt2html
8481 !! wikitext
8482 #REDIRECT [[Category%3AFoo]]
8483 !! html/parsoid
8484 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8485 !! end
8486
8487 !! test
8488 Redirect to category page
8489 !! wikitext
8490 #REDIRECT [[:Category:Foo]]
8491 !! html/parsoid
8492 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8493 !! end
8494
8495 !! test
8496 Redirect to image page (1)
8497 !! wikitext
8498 #REDIRECT [[File:Wiki.png]]
8499 !! html/parsoid
8500 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8501 !! end
8502
8503 !! test
8504 Redirect to image page (2)
8505 !! wikitext
8506 #REDIRECT [[Image:Wiki.png]]
8507 !! html/parsoid
8508 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8509 !! end
8510
8511 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8512 # Next test confirms this.
8513 !! test
8514 Redirect to language (1) (T104918)
8515 !! options
8516 parsoid=wt2html,wt2wt,html2html
8517 !! wikitext
8518 #REDIRECT [[en:File:Wiki.png]]
8519 !! html/parsoid
8520 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8521 !! end
8522
8523 !! test
8524 Redirect to language (2) (T104918)
8525 !! wikitext
8526 #REDIRECT [[:en:File:Wiki.png]]
8527 !! html/parsoid
8528 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8529 !! end
8530
8531 !! test
8532 Redirect to interwiki (T104918)
8533 !! wikitext
8534 #REDIRECT [[meatball:File:Wiki.png]]
8535 !! html/parsoid
8536 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8537 !! end
8538
8539 !! test
8540 Non-English #REDIRECT
8541 !! options
8542 language=is
8543 !! wikitext
8544 #TILVÍSUN [[Main Page]]
8545 !! html/parsoid
8546 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8547 !! end
8548
8549 !! test
8550 Redirect syntax under text isn't considered a redirect
8551 !! wikitext
8552 some text
8553 #redirect [[Main Page]]
8554 !! html/parsoid
8555 <p>some text</p>
8556 <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>
8557 !! end
8558
8559 # FIXME: Should hoist the redirect to the top of the page and ensure there
8560 # is only one.
8561 !! test
8562 New redirect
8563 !! options
8564 parsoid=html2wt
8565 !! html/parsoid
8566 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8567 !! wikitext
8568 Foo
8569 #REDIRECT [[Foo]]
8570 !! end
8571
8572 ##
8573 ## XHTML tidiness
8574 ###
8575
8576 !! test
8577 <br> to <br />
8578 !! wikitext
8579 1<br>2<br />3
8580 !! html
8581 <p>1<br />2<br />3
8582 </p>
8583 !! end
8584
8585 !! test
8586 Broken br tag sanitization
8587 !! wikitext
8588 </br>
8589 !! html/php
8590 <p>&lt;/br&gt;
8591 </p>
8592 !! end
8593
8594 # TODO: Fix html2html mode (bug 51055)!
8595 !! test
8596 Parsoid: Broken br tag recognition
8597 !! options
8598 parsoid=wt2html
8599 !! wikitext
8600 </br>
8601
8602 <br/ >
8603 !! html+tidy
8604 <p><br /></p>
8605 <p><br /></p>
8606 !! end
8607
8608 !! test
8609 Incorrecly removing closing slashes from correctly formed XHTML
8610 !! wikitext
8611 <br style="clear:both;" />
8612 !! html
8613 <p><br style="clear:both;" />
8614 </p>
8615 !! end
8616
8617 !! test
8618 Failing to transform badly formed HTML into correct XHTML
8619 !! wikitext
8620 <br style="clear: left;">
8621 <br style="clear: right;">
8622 <br style="clear: both;">
8623 !! html
8624 <p><br style="clear: left;" />
8625 <br style="clear: right;" />
8626 <br style="clear: both;" />
8627 </p>
8628 !!end
8629
8630 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8631 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8632 !! test
8633 Handling html with a div self-closing tag
8634 !! wikitext
8635 <div title />
8636 <div title/>
8637 <div title/ >
8638 <div title=bar />
8639 <div title=bar/>
8640 <div title=bar/ >
8641 !! html/php
8642 <p>&lt;div title /&gt;
8643 &lt;div title/&gt;
8644 </p>
8645 <div>
8646 <p>&lt;div title=bar /&gt;
8647 &lt;div title=bar/&gt;
8648 </p>
8649 <div title="bar/"></div>
8650 </div>
8651
8652 !! html/parsoid
8653 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8654 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8655 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
8656 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8657 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8658 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
8659 !! end
8660
8661 !! test
8662 Handling html with a br self-closing tag
8663 !! wikitext
8664 <br title />
8665 <br title/>
8666 <br title/ >
8667 <br title=bar />
8668 <br title=bar/>
8669 <br title=bar/ >
8670 !! html/php
8671 <p><br title="" />
8672 <br title="" />
8673 <br />
8674 <br title="bar" />
8675 <br title="bar" />
8676 <br title="bar/" />
8677 </p>
8678 !! html/parsoid
8679 <p><br title="" />
8680 <br title="" />
8681 <br title="" />
8682 <br title="bar" />
8683 <br title="bar" />
8684 <br title="bar/" />
8685 </p>
8686 !! end
8687
8688 !! test
8689 Horizontal ruler (should it add that extra space?)
8690 !! wikitext
8691 <hr>
8692 <hr >
8693 foo <hr
8694 > bar
8695 !! html+tidy
8696 <hr />
8697 <hr />
8698 <p>foo</p>
8699 <hr />
8700 <p>bar</p>
8701 !! end
8702
8703 !! test
8704 Horizontal ruler -- 4+ dashes render hr
8705 !! wikitext
8706 ----
8707 !! html
8708 <hr />
8709
8710 !! end
8711
8712 !! test
8713 Horizontal ruler -- eats additional dashes on the same line
8714 !! wikitext
8715 ---------
8716 !! html
8717 <hr />
8718
8719 !! end
8720
8721 !! test
8722 Horizontal ruler -- does not collapse dashes on consecutive lines
8723 !! wikitext
8724 ----
8725 ----
8726 !! html
8727 <hr />
8728 <hr />
8729
8730 !! end
8731
8732 !! test
8733 Horizontal ruler -- <4 dashes render as plain text
8734 !! wikitext
8735 ---
8736 !! html
8737 <p>---
8738 </p>
8739 !! end
8740
8741 !! test
8742 Horizontal ruler -- Supports content following dashes on same line
8743 !! wikitext
8744 ---- Foo
8745 !! html
8746 <hr /> Foo
8747
8748 !! html+tidy
8749 <hr />
8750 <p>Foo</p>
8751 !! end
8752
8753 ###
8754 ### Block-level elements
8755 ###
8756 !! test
8757 Common list
8758 !! wikitext
8759 *Common list
8760 * item 2
8761 *item 3
8762 !! html
8763 <ul><li>Common list</li>
8764 <li> item 2</li>
8765 <li>item 3</li></ul>
8766
8767 !! end
8768
8769 !! test
8770 Numbered list
8771 !! wikitext
8772 #Numbered list
8773 #item 2
8774 # item 3
8775 !! html
8776 <ol><li>Numbered list</li>
8777 <li>item 2</li>
8778 <li> item 3</li></ol>
8779
8780 !! end
8781
8782 !! test
8783 Mixed list
8784 !! wikitext
8785 *Mixed list
8786 *# with numbers
8787 ** and bullets
8788 *# and numbers
8789 *bullets again
8790 **bullet level 2
8791 ***bullet level 3
8792 ***#Number on level 4
8793 **bullet level 2
8794 **#Number on level 3
8795 **#Number on level 3
8796 *#number level 2
8797 *Level 1
8798 *** Level 3
8799 #** Level 3, but ordered
8800 !! html
8801 <ul><li>Mixed list
8802 <ol><li> with numbers</li></ol>
8803 <ul><li> and bullets</li></ul>
8804 <ol><li> and numbers</li></ol></li>
8805 <li>bullets again
8806 <ul><li>bullet level 2
8807 <ul><li>bullet level 3
8808 <ol><li>Number on level 4</li></ol></li></ul></li>
8809 <li>bullet level 2
8810 <ol><li>Number on level 3</li>
8811 <li>Number on level 3</li></ol></li></ul>
8812 <ol><li>number level 2</li></ol></li>
8813 <li>Level 1
8814 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
8815 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
8816
8817 !! end
8818
8819 !! test
8820 1. Nested mixed wikitext and html list
8821 !! wikitext
8822 * hi
8823 * <ul><li>ho</li></ul>
8824 * hi
8825 ** ho
8826 !! html/php
8827 <ul><li> hi</li>
8828 <li> <ul><li>ho</li></ul></li>
8829 <li> hi
8830 <ul><li> ho</li></ul></li></ul>
8831
8832 !! html/parsoid
8833 <ul><li> hi</li>
8834 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
8835 <li> hi
8836 <ul><li> ho</li></ul></li></ul>
8837 !! end
8838
8839 !! test
8840 2. Nested mixed wikitext and html list (incompatible)
8841 !! wikitext
8842 ; hi
8843 : {{echo|<li>ho</li>}}
8844 !! html/php
8845 <dl><dt> hi</dt>
8846 <dd> <li>ho</li></dd></dl>
8847
8848 !! html/parsoid
8849 <dl><dt> hi</dt>
8850 <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>
8851 !! end
8852
8853 !! test
8854 Nested lists 1
8855 !! wikitext
8856 *foo
8857 **bar
8858 !! html
8859 <ul><li>foo
8860 <ul><li>bar</li></ul></li></ul>
8861
8862 !! end
8863
8864 !! test
8865 Nested lists 2
8866 !! wikitext
8867 **foo
8868 *bar
8869 !! html
8870 <ul><li><ul><li>foo</li></ul></li>
8871 <li>bar</li></ul>
8872
8873 !! end
8874
8875 !! test
8876 Nested lists 3 (first element empty)
8877 !! wikitext
8878 *
8879 **bar
8880 !! html
8881 <ul><li>
8882 <ul><li>bar</li></ul></li></ul>
8883
8884 !! end
8885
8886 !! test
8887 Nested lists 4 (first element empty)
8888 !! wikitext
8889 **
8890 *bar
8891 !! html
8892 <ul><li><ul><li></li></ul></li>
8893 <li>bar</li></ul>
8894
8895 !! end
8896
8897 !! test
8898 Nested lists 5 (both elements empty)
8899 !! wikitext
8900 **
8901 *
8902 !! html
8903 <ul><li><ul><li></li></ul></li>
8904 <li></li></ul>
8905
8906 !! end
8907
8908 !! test
8909 Nested lists 6 (both elements empty)
8910 !! wikitext
8911 *
8912 **
8913 !! html
8914 <ul><li>
8915 <ul><li></li></ul></li></ul>
8916
8917 !! end
8918
8919 !! test
8920 Nested lists 7 (skip initial nesting levels)
8921 !! wikitext
8922 *** foo
8923 !! html
8924 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
8925
8926 !! end
8927
8928 !! test
8929 Nested lists 8 (multiple nesting transitions)
8930 !! wikitext
8931 * foo
8932 *** bar
8933 ** baz
8934 * boo
8935 !! html
8936 <ul><li> foo
8937 <ul><li><ul><li> bar</li></ul></li>
8938 <li> baz</li></ul></li>
8939 <li> boo</li></ul>
8940
8941 !! end
8942
8943 !! test
8944 Nested lists 9 (extension interaction)
8945 !! options
8946 parsoid
8947 !! wikitext
8948 *<references />
8949 !! html/parsoid
8950 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
8951 !! end
8952
8953 !! test
8954 1. Lists with start-of-line-transparent tokens before bullets: Comments
8955 !! wikitext
8956 *foo
8957 *<!--cmt-->bar
8958 <!--cmt-->*baz
8959 !! html
8960 <ul><li>foo</li>
8961 <li>bar</li>
8962 <li>baz</li></ul>
8963
8964 !! end
8965
8966 !! test
8967 2. Lists with start-of-line-transparent tokens before bullets: Template close
8968 !! wikitext
8969 *foo {{echo|bar
8970 }}*baz
8971 !! html
8972 <ul><li>foo bar</li>
8973 <li>baz</li></ul>
8974
8975 !! end
8976
8977 !! test
8978 List items are not parsed correctly following a <pre> block (bug 785)
8979 !! wikitext
8980 * <pre>foo</pre>
8981 * <pre>bar</pre>
8982 * zar
8983 !! html/php
8984 <ul><li> <pre>foo</pre></li>
8985 <li> <pre>bar</pre></li>
8986 <li> zar</li></ul>
8987
8988 !! html/parsoid
8989 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
8990 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
8991 <li> zar</li></ul>
8992 !! end
8993
8994 !! test
8995 List items from template
8996 !! wikitext
8997
8998 {{inner list}}
8999 * item 2
9000
9001 * item 0
9002 {{inner list}}
9003 * item 2
9004
9005 * item 0
9006 * notSOL{{inner list}}
9007 * item 2
9008 !! html
9009 <ul><li> item 1</li>
9010 <li> item 2</li></ul>
9011 <ul><li> item 0</li>
9012 <li> item 1</li>
9013 <li> item 2</li></ul>
9014 <ul><li> item 0</li>
9015 <li> notSOL</li>
9016 <li> item 1</li>
9017 <li> item 2</li></ul>
9018
9019 !! end
9020
9021 !! test
9022 List interrupted by empty line or heading
9023 !! wikitext
9024 * foo
9025
9026 ** bar
9027 == A heading ==
9028 * Another list item
9029 !! html
9030 <ul><li> foo</li></ul>
9031 <ul><li><ul><li> bar</li></ul></li></ul>
9032 <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>
9033 <ul><li> Another list item</li></ul>
9034
9035 !!end
9036
9037 !!test
9038 Multiple list tags generated by templates
9039 !! wikitext
9040 {{echo|<li>}}a
9041 {{echo|<li>}}b
9042 {{echo|<li>}}c
9043 !! html
9044 <li>a
9045 <li>b
9046 <li>c</li>
9047 </li>
9048 </li>
9049
9050 !! html+tidy
9051 <ul>
9052 <li>a</li>
9053 <li>b</li>
9054 <li>c</li>
9055 </ul>
9056 !!end
9057
9058 !!test
9059 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9060 !! wikitext
9061 *a
9062 <!--This line will NOT split the list-->
9063 *b
9064 <!--This line will NOT split the list either-->
9065 *c
9066 <!--foo--> <!----> <!--This line NOT split the list either-->
9067 *d
9068 !! html
9069 <ul><li>a</li>
9070 <li>b</li>
9071 <li>c</li>
9072 <li>d</li></ul>
9073
9074 !!end
9075
9076 !!test
9077 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9078 !! wikitext
9079 *a
9080 <!--This line will NOT split the list-->
9081 *b
9082 <!--This line will NOT split the list either-->
9083 *c
9084 <!--foo--> <!----> <!--This line NOT split the list
9085 either-->
9086 *d
9087 !! html
9088 <ul><li>a</li>
9089 <li>b</li>
9090 <li>c</li>
9091 <li>d</li></ul>
9092
9093 !!end
9094
9095 !!test
9096 Test the li-hack
9097 (The PHP parser relies on Tidy for the hack)
9098 !!options
9099 parsoid=wt2html,wt2wt
9100 !! wikitext
9101 * foo
9102 * <li>li-hack
9103 * {{echo|<li>templated li-hack}}
9104 * <!--foo--> <li> unsupported li-hack with preceding comments
9105
9106 <ul>
9107 <li><li>not a li-hack
9108 </li>
9109 </ul>
9110 !! html+tidy
9111 <ul>
9112 <li>foo</li>
9113 <li>li-hack</li>
9114 <li>templated li-hack</li>
9115 <li>unsupported li-hack with preceding comments</li>
9116 </ul>
9117 <ul>
9118 <li>not a li-hack</li>
9119 </ul>
9120 !!end
9121
9122 !! test
9123 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9124 !! options
9125 parsoid
9126 !! wikitext
9127 # foo
9128 ## bar
9129 * foo
9130 ** bar
9131 : foo
9132 :: bar
9133 !! html
9134 <ol>
9135 <li> foo<ol>
9136 <li> bar</li>
9137 </ol></li>
9138 </ol><ul>
9139 <li> foo<ul>
9140 <li> bar</li>
9141 </ul></li>
9142 </ul><dl>
9143 <dd> foo<dl>
9144 <dd> bar</dd>
9145 </dl></dd>
9146 </dl>
9147 !! end
9148
9149 !! test
9150 Parsoid: Test of whitespace serialization with Templated bullets
9151 !! options
9152 parsoid
9153 !! wikitext
9154 * {{bullet}}
9155 !! html
9156 <ul>
9157 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9158 </ul>
9159 !! end
9160
9161 # ------------------------------------------------------------------------
9162 # The next set of tests are about Parsoid's ability to handle badly nested
9163 # tags (parse, minimize scope of fixup, and roundtrip back)
9164 # ------------------------------------------------------------------------
9165
9166 !! test
9167 Unbalanced closing block tags break a list
9168 (php parser relies on Tidy to fix up)
9169 !! wikitext
9170 <div>
9171 *a</div><div>
9172 *b</div>
9173 !! html+tidy
9174 <div>
9175 <ul>
9176 <li>a</li>
9177 </ul>
9178 </div>
9179 <div>
9180 <ul>
9181 <li>b</li>
9182 </ul>
9183 </div>
9184 !! end
9185
9186 # Parsoid fails this test, but it might be tricky to support properly.
9187 # See bug 68395.
9188 !! test
9189 Unbalanced closing non-block tags don't break a list
9190 (php parser relies on Tidy to fix up)
9191 !! wikitext
9192 <span>
9193 *a</span><span>
9194 *b</span>
9195 !! html/php+tidy
9196 <ul>
9197 <li><span>a</span></li>
9198 <li><span>b</span></li>
9199 </ul>
9200 !! html/parsoid
9201 <span>
9202 <ul>
9203 <li>a<span></span>
9204 </li>
9205 <li>b
9206 </li>
9207 </ul>
9208 </span>
9209 !! end
9210
9211 !! test
9212 Unclosed formatting tags that straddle lists are closed and reopened
9213 (php parser relies on Tidy to fix up)
9214 !! options
9215 parsoid=wt2html,wt2wt,html2html
9216 !! wikitext
9217 # <s> a
9218 # b </s>
9219 !! html/php+tidy
9220 <ol>
9221 <li><s>a</s></li>
9222 <li><s>b</s></li>
9223 </ol>
9224 !! html/parsoid
9225 <ol><li> <s> a</s></li>
9226 <li><s> b </s></li></ol>
9227 !! end
9228
9229 # See bug 68395.
9230 !!test
9231 1. List embedded in a formatting tag
9232 !! wikitext
9233 <small>
9234 * foo
9235 </small>
9236 !! html/php+tidy
9237 <ul>
9238 <li><small>foo</small></li>
9239 </ul>
9240 !! html/parsoid
9241 <small>
9242 <ul>
9243 <li> foo</li>
9244 </ul>
9245 </small>
9246 !!end
9247
9248 ## Ugly Parsoid output here
9249 ## Not sure what the right output is.
9250 !!test
9251 2. List embedded in a formatting tag
9252 !! wikitext
9253 <small>
9254 *a
9255 *b</small>
9256 !! html/php+tidy
9257 <ul>
9258 <li><small>a</small></li>
9259 <li><small>b</small></li>
9260 </ul>
9261 !! html/parsoid
9262 <small></small>
9263 <ul><small>
9264 <li>a</li>
9265 </small>
9266 <li><small>b</small></li>
9267 </ul>
9268 !!end
9269
9270 # Ugly Parsoid and PHP parser output here
9271 # Not sure if we want to make this a test!
9272 #
9273 ## !!test
9274 ## 3. Unclosed formatting tags in list elements
9275 ## !! wikitext
9276 ## *<small>a
9277 ## *<small>b
9278 ## !! html/php+tidy
9279 ## <ul>
9280 ## <li><small>a</small></li>
9281 ## <li><small><small>b</small></small></li>
9282 ## </ul>
9283 ## !! html/parsoid
9284 ## <ul>
9285 ## <li><small>a</small></li>
9286 ## <small>
9287 ## <li><small>b</small></li>
9288 ## </small></ul>
9289 ## !!end
9290
9291 # This is a bug in the PHP parser + tidy combination.
9292 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9293 # and then fostered out of the table by tidy.)
9294 # We believe the Parsoid output to be correct.
9295 !! test
9296 Table with missing opening <tr> tag
9297 !! options
9298 parsoid=wt2html,wt2wt
9299 !! wikitext
9300 <table>
9301 <td>foo</td>
9302 </tr>
9303 </table>
9304 !! html+tidy
9305 <table>
9306 <tr>
9307 <td>foo</td>
9308 </tr>
9309 </table>
9310 !! end
9311
9312 ###
9313 ### Magic Words
9314 ###
9315
9316 # Note that the current date is hard-coded as
9317 # 1970-01-01T00:02:03Z (a Thursday)
9318 # when running parser tests. The timezone is also fixed to GMT, so
9319 # local date will be identical to current date.
9320
9321 !! test
9322 Magic Word: {{CURRENTDAY}}
9323 !! wikitext
9324 {{CURRENTDAY}}
9325 !! html
9326 <p>1
9327 </p>
9328 !! end
9329
9330 !! test
9331 Magic Word: {{CURRENTDAY2}}
9332 !! wikitext
9333 {{CURRENTDAY2}}
9334 !! html
9335 <p>01
9336 </p>
9337 !! end
9338
9339 !! test
9340 Magic Word: {{CURRENTDAYNAME}}
9341 !! wikitext
9342 {{CURRENTDAYNAME}}
9343 !! html
9344 <p>Thursday
9345 </p>
9346 !! end
9347
9348 !! test
9349 Magic Word: {{CURRENTDOW}}
9350 !! wikitext
9351 {{CURRENTDOW}}
9352 !! html
9353 <p>4
9354 </p>
9355 !! end
9356
9357 !! test
9358 Magic Word: {{CURRENTMONTH}}
9359 !! wikitext
9360 {{CURRENTMONTH}}
9361 !! html
9362 <p>01
9363 </p>
9364 !! end
9365
9366 !! test
9367 Magic Word: {{CURRENTMONTH1}}
9368 !! wikitext
9369 {{CURRENTMONTH1}}
9370 !! html
9371 <p>1
9372 </p>
9373 !! end
9374
9375 !! test
9376 Magic Word: {{CURRENTMONTHABBREV}}
9377 !! wikitext
9378 {{CURRENTMONTHABBREV}}
9379 !! html
9380 <p>Jan
9381 </p>
9382 !! end
9383
9384 !! test
9385 Magic Word: {{CURRENTMONTHNAME}}
9386 !! wikitext
9387 {{CURRENTMONTHNAME}}
9388 !! html
9389 <p>January
9390 </p>
9391 !! end
9392
9393 !! test
9394 Magic Word: {{CURRENTMONTHNAMEGEN}}
9395 !! wikitext
9396 {{CURRENTMONTHNAMEGEN}}
9397 !! html
9398 <p>January
9399 </p>
9400 !! end
9401
9402 !! test
9403 Magic Word: {{CURRENTTIME}}
9404 !! wikitext
9405 {{CURRENTTIME}}
9406 !! html
9407 <p>00:02
9408 </p>
9409 !! end
9410
9411 !! test
9412 Magic Word: {{CURRENTHOUR}}
9413 !! wikitext
9414 {{CURRENTHOUR}}
9415 !! html
9416 <p>00
9417 </p>
9418 !! end
9419
9420 !! test
9421 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9422 !! wikitext
9423 {{CURRENTWEEK}}
9424 !! html
9425 <p>1
9426 </p>
9427 !! end
9428
9429 !! test
9430 Magic Word: {{CURRENTYEAR}}
9431 !! wikitext
9432 {{CURRENTYEAR}}
9433 !! html
9434 <p>1970
9435 </p>
9436 !! end
9437
9438 !! test
9439 Magic Word: {{CURRENTTIMESTAMP}}
9440 !! wikitext
9441 {{CURRENTTIMESTAMP}}
9442 !! html
9443 <p>19700101000203
9444 </p>
9445 !! end
9446
9447 !! test
9448 Magic Words LOCAL (UTC)
9449 !! wikitext
9450 * {{LOCALMONTH}}
9451 * {{LOCALMONTH1}}
9452 * {{LOCALMONTHNAME}}
9453 * {{LOCALMONTHNAMEGEN}}
9454 * {{LOCALMONTHABBREV}}
9455 * {{LOCALDAY}}
9456 * {{LOCALDAY2}}
9457 * {{LOCALDAYNAME}}
9458 * {{LOCALYEAR}}
9459 * {{LOCALTIME}}
9460 * {{LOCALHOUR}}
9461 * {{LOCALWEEK}}
9462 * {{LOCALDOW}}
9463 * {{LOCALTIMESTAMP}}
9464 !! html
9465 <ul><li> 01</li>
9466 <li> 1</li>
9467 <li> January</li>
9468 <li> January</li>
9469 <li> Jan</li>
9470 <li> 1</li>
9471 <li> 01</li>
9472 <li> Thursday</li>
9473 <li> 1970</li>
9474 <li> 00:02</li>
9475 <li> 00</li>
9476 <li> 1</li>
9477 <li> 4</li>
9478 <li> 19700101000203</li></ul>
9479
9480 !! end
9481
9482 !! test
9483 Magic Word: {{FULLPAGENAME}}
9484 !! options
9485 title=[[User:Ævar Arnfjörð Bjarmason]]
9486 !! wikitext
9487 {{FULLPAGENAME}}
9488 !! html
9489 <p>User:Ævar Arnfjörð Bjarmason
9490 </p>
9491 !! end
9492
9493 !! test
9494 Magic Word: {{FULLPAGENAMEE}}
9495 !! options
9496 title=[[User:Ævar Arnfjörð Bjarmason]]
9497 !! wikitext
9498 {{FULLPAGENAMEE}}
9499 !! html
9500 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9501 </p>
9502 !! end
9503
9504 !! test
9505 Magic Word: {{TALKSPACE}}
9506 !! options
9507 title=[[User:Ævar Arnfjörð Bjarmason]]
9508 !! wikitext
9509 {{TALKSPACE}}
9510 !! html
9511 <p>User talk
9512 </p>
9513 !! end
9514
9515 !! test
9516 Magic Word: {{TALKSPACE}}, same namespace
9517 !! options
9518 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9519 !! wikitext
9520 {{TALKSPACE}}
9521 !! html
9522 <p>User talk
9523 </p>
9524 !! end
9525
9526 !! test
9527 Magic Word: {{TALKSPACE}}, main namespace
9528 !! options
9529 title=[[Parser Test]]
9530 !! wikitext
9531 {{TALKSPACE}}
9532 !! html
9533 <p>Talk
9534 </p>
9535 !! end
9536
9537 !! test
9538 Magic Word: {{TALKSPACEE}}
9539 !! options
9540 title=[[User:Ævar Arnfjörð Bjarmason]]
9541 !! wikitext
9542 {{TALKSPACEE}}
9543 !! html
9544 <p>User_talk
9545 </p>
9546 !! end
9547
9548 !! test
9549 Magic Word: {{SUBJECTSPACE}}
9550 !! options
9551 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9552 !! wikitext
9553 {{SUBJECTSPACE}}
9554 !! html
9555 <p>User
9556 </p>
9557 !! end
9558
9559 !! test
9560 Magic Word: {{SUBJECTSPACE}}, same namespace
9561 !! options
9562 title=[[User:Ævar Arnfjörð Bjarmason]]
9563 !! wikitext
9564 {{SUBJECTSPACE}}
9565 !! html
9566 <p>User
9567 </p>
9568 !! end
9569
9570 !! test
9571 Magic Word: {{SUBJECTSPACE}}, main namespace
9572 !! options
9573 title=[[Parser Test]]
9574 !! wikitext
9575 {{SUBJECTSPACE}}
9576 !! html
9577
9578 !! end
9579
9580 !! test
9581 Magic Word: {{SUBJECTSPACEE}}
9582 !! options
9583 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9584 !! wikitext
9585 {{SUBJECTSPACEE}}
9586 !! html
9587 <p>User
9588 </p>
9589 !! end
9590
9591 !! test
9592 Magic Word: {{NAMESPACE}}
9593 !! options
9594 title=[[User:Ævar Arnfjörð Bjarmason]]
9595 !! wikitext
9596 {{NAMESPACE}}
9597 !! html
9598 <p>User
9599 </p>
9600 !! end
9601
9602 !! test
9603 Magic Word: {{NAMESPACEE}}
9604 !! options
9605 title=[[User:Ævar Arnfjörð Bjarmason]]
9606 !! wikitext
9607 {{NAMESPACEE}}
9608 !! html
9609 <p>User
9610 </p>
9611 !! end
9612
9613 !! test
9614 Magic Word: {{NAMESPACENUMBER}}
9615 !! options
9616 title=[[User:Ævar Arnfjörð Bjarmason]]
9617 !! wikitext
9618 {{NAMESPACENUMBER}}
9619 !! html
9620 <p>2
9621 </p>
9622 !! end
9623
9624 !! test
9625 Magic Word: {{SUBPAGENAME}}
9626 !! options
9627 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9628 !! wikitext
9629 {{SUBPAGENAME}}
9630 !! html
9631 <p>sub ö
9632 </p>
9633 !! end
9634
9635 !! test
9636 Magic Word: {{SUBPAGENAMEE}}
9637 !! options
9638 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9639 !! wikitext
9640 {{SUBPAGENAMEE}}
9641 !! html
9642 <p>sub_%C3%B6
9643 </p>
9644 !! end
9645
9646 !! test
9647 Magic Word: {{ROOTPAGENAME}}
9648 !! options
9649 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9650 !! wikitext
9651 {{ROOTPAGENAME}}
9652 !! html
9653 <p>Ævar Arnfjörð Bjarmason
9654 </p>
9655 !! end
9656
9657 !! test
9658 Magic Word: {{ROOTPAGENAMEE}}
9659 !! options
9660 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9661 !! wikitext
9662 {{ROOTPAGENAMEE}}
9663 !! html
9664 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9665 </p>
9666 !! end
9667
9668 !! test
9669 Magic Word: {{BASEPAGENAME}}
9670 !! options
9671 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9672 !! wikitext
9673 {{BASEPAGENAME}}
9674 !! html
9675 <p>Ævar Arnfjörð Bjarmason
9676 </p>
9677 !! end
9678
9679 !! test
9680 Magic Word: {{BASEPAGENAMEE}}
9681 !! options
9682 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9683 !! wikitext
9684 {{BASEPAGENAMEE}}
9685 !! html
9686 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9687 </p>
9688 !! end
9689
9690 !! test
9691 Magic Word: {{TALKPAGENAME}}
9692 !! options
9693 title=[[User:Ævar Arnfjörð Bjarmason]]
9694 !! wikitext
9695 {{TALKPAGENAME}}
9696 !! html
9697 <p>User talk:Ævar Arnfjörð Bjarmason
9698 </p>
9699 !! end
9700
9701 !! test
9702 Magic Word: {{TALKPAGENAMEE}}
9703 !! options
9704 title=[[User:Ævar Arnfjörð Bjarmason]]
9705 !! wikitext
9706 {{TALKPAGENAMEE}}
9707 !! html
9708 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9709 </p>
9710 !! end
9711
9712 !! test
9713 Magic Word: {{SUBJECTPAGENAME}}
9714 !! options
9715 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9716 !! wikitext
9717 {{SUBJECTPAGENAME}}
9718 !! html
9719 <p>User:Ævar Arnfjörð Bjarmason
9720 </p>
9721 !! end
9722
9723 !! test
9724 Magic Word: {{SUBJECTPAGENAMEE}}
9725 !! options
9726 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9727 !! wikitext
9728 {{SUBJECTPAGENAMEE}}
9729 !! html
9730 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9731 </p>
9732 !! end
9733
9734 !! test
9735 Magic Word: {{NUMBEROFFILES}}
9736 !! wikitext
9737 {{NUMBEROFFILES}}
9738 !! html
9739 <p>6
9740 </p>
9741 !! end
9742
9743 !! test
9744 Magic Word: {{PAGENAME}}
9745 !! options
9746 title=[[User:Ævar Arnfjörð Bjarmason]]
9747 !! wikitext
9748 {{PAGENAME}}
9749 !! html
9750 <p>Ævar Arnfjörð Bjarmason
9751 </p>
9752 !! end
9753
9754 !! test
9755 Magic Word: {{PAGENAME}} with metacharacters
9756 !! options
9757 title=[['foo & bar = baz']]
9758 !! wikitext
9759 ''{{PAGENAME}}''
9760 !! html/php
9761 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
9762 </p>
9763 !! html+tidy
9764 <p><i>'foo &amp; bar = baz'</i></p>
9765 !! end
9766
9767 !! test
9768 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
9769 !! options
9770 title=[[*RFC 1234 http://example.com/]]
9771 !! wikitext
9772 {{PAGENAME}}
9773 !! html/php
9774 <p>&#42;RFC&#32;1234 http&#58;//example.com/
9775 </p>
9776 !! html+tidy
9777 <p>*RFC 1234 http://example.com/</p>
9778 !! end
9779
9780 !! test
9781 Magic Word: {{PAGENAMEE}}
9782 !! options
9783 title=[[User:Ævar Arnfjörð Bjarmason]]
9784 !! wikitext
9785 {{PAGENAMEE}}
9786 !! html
9787 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9788 </p>
9789 !! end
9790
9791 !! test
9792 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
9793 !! options
9794 title=[[*RFC 1234 http://example.com/]]
9795 !! wikitext
9796 {{PAGENAMEE}}
9797 !! html/php
9798 <p>&#42;RFC_1234_http&#58;//example.com/
9799 </p>
9800 !! html+tidy
9801 <p>*RFC_1234_http://example.com/</p>
9802 !! end
9803
9804 !! test
9805 Magic Word: {{REVISIONID}}
9806 !! wikitext
9807 {{REVISIONID}}
9808 !! html
9809 <p>1337
9810 </p>
9811 !! end
9812
9813 !! test
9814 Magic Word: {{SCRIPTPATH}}
9815 !! wikitext
9816 {{SCRIPTPATH}}
9817 !! html
9818
9819 !! end
9820
9821 !! test
9822 Magic Word: {{STYLEPATH}}
9823 !! wikitext
9824 {{STYLEPATH}}
9825 !! html
9826 <p>/skins
9827 </p>
9828 !! end
9829
9830 !! test
9831 Magic Word: {{SERVER}}
9832 !! wikitext
9833 {{SERVER}}
9834 !! html
9835 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9836 </p>
9837 !! end
9838
9839 !! test
9840 Magic Word: {{SERVERNAME}}
9841 !! wikitext
9842 {{SERVERNAME}}
9843 !! html
9844 <p>example.org
9845 </p>
9846 !! end
9847
9848 !! test
9849 Magic Word: {{SITENAME}}
9850 !! wikitext
9851 {{SITENAME}}
9852 !! html
9853 <p>MediaWiki
9854 </p>
9855 !! end
9856
9857 !! test
9858 Case-sensitive magic words, when cased differently, should just be template transclusions
9859 !! wikitext
9860 {{CurrentMonth}}
9861 {{currentday}}
9862 {{cURreNTweEK}}
9863 {{currentHour}}
9864 !! html
9865 <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>
9866 <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>
9867 <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>
9868 <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>
9869 </p>
9870 !! end
9871
9872 !! test
9873 Case-insensitive magic words should still work with weird casing.
9874 !! wikitext
9875 {{sErVeRNaMe}}
9876 {{LCFirst:AOEU}}
9877 {{ucFIRST:aoeu}}
9878 {{SERver}}
9879 !! html
9880 <p>example.org
9881 aOEU
9882 Aoeu
9883 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9884 </p>
9885 !! end
9886
9887 # From plwiki:PLOS_ONE
9888 !! test
9889 Parsoid: Page property magic word with magic word contents
9890 !! wikitext
9891 {{DISPLAYTITLE:''{{PAGENAME}}''}}
9892 !! html/parsoid
9893 <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>"}]]}'/>
9894 !! end
9895
9896 !! test
9897 Parsoid: Template-generated DISPLAYTITLE
9898 !! wikitext
9899 {{{{echo|DISPLAYTITLE}}:Foo}}
9900 !! html/parsoid
9901 <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}}]}'/>
9902 !! end
9903
9904 !! test
9905 Namespace 1 {{ns:1}}
9906 !! wikitext
9907 {{ns:1}}
9908 !! html
9909 <p>Talk
9910 </p>
9911 !! end
9912
9913 !! test
9914 Namespace 1 {{ns:01}}
9915 !! wikitext
9916 {{ns:01}}
9917 !! html
9918 <p>Talk
9919 </p>
9920 !! end
9921
9922 !! test
9923 Namespace 0 {{ns:0}} (bug 4783)
9924 !! wikitext
9925 {{ns:0}}
9926 !! html
9927
9928 !! end
9929
9930 !! test
9931 Namespace 0 {{ns:00}} (bug 4783)
9932 !! wikitext
9933 {{ns:00}}
9934 !! html
9935
9936 !! end
9937
9938 !! test
9939 Namespace -1 {{ns:-1}}
9940 !! wikitext
9941 {{ns:-1}}
9942 !! html
9943 <p>Special
9944 </p>
9945 !! end
9946
9947 !! test
9948 Namespace User {{ns:User}}
9949 !! wikitext
9950 {{ns:User}}
9951 !! html
9952 <p>User
9953 </p>
9954 !! end
9955
9956 !! test
9957 Namespace User talk {{ns:User_talk}}
9958 !! wikitext
9959 {{ns:User_talk}}
9960 !! html
9961 <p>User talk
9962 </p>
9963 !! end
9964
9965 !! test
9966 Namespace User talk {{ns:uSeR tAlK}}
9967 !! wikitext
9968 {{ns:uSeR tAlK}}
9969 !! html
9970 <p>User talk
9971 </p>
9972 !! end
9973
9974 !! test
9975 Namespace File {{ns:File}}
9976 !! wikitext
9977 {{ns:File}}
9978 !! html
9979 <p>File
9980 </p>
9981 !! end
9982
9983 !! test
9984 Namespace File {{ns:Image}}
9985 !! wikitext
9986 {{ns:Image}}
9987 !! html
9988 <p>File
9989 </p>
9990 !! end
9991
9992 !! test
9993 Namespace (lang=de) Benutzer {{ns:User}}
9994 !! options
9995 language=de
9996 !! wikitext
9997 {{ns:User}}
9998 !! html
9999 <p>Benutzer
10000 </p>
10001 !! end
10002
10003 !! test
10004 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10005 !! options
10006 language=de
10007 !! wikitext
10008 {{ns:3}}
10009 !! html
10010 <p>Benutzer Diskussion
10011 </p>
10012 !! end
10013
10014
10015 !! test
10016 Urlencode
10017 !! wikitext
10018 {{urlencode:hi world?!}}
10019 {{urlencode:hi world?!|WIKI}}
10020 {{urlencode:hi world?!|PATH}}
10021 {{urlencode:hi world?!|QUERY}}
10022 !! html
10023 <p>hi+world%3F%21
10024 hi_world%3F!
10025 hi%20world%3F%21
10026 hi+world%3F%21
10027 </p>
10028 !! end
10029
10030 !! test
10031 Magic Word: prioritize type info over data-parsoid
10032 !! options
10033 parsoid=html2wt
10034 !! html/parsoid
10035 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10036 !! wikitext
10037 __FORCETOC__
10038 !! end
10039
10040 !! test
10041 Magic Word: serialize on separate line (parsoid)
10042 !! options
10043 parsoid=wt2wt,html2wt
10044 !! wikitext
10045 foo
10046 __NOTOC__
10047 bar
10048 !! html/parsoid
10049 foo<meta property="mw:PageProp/notoc"/>bar
10050 !! end
10051
10052 !! test
10053 Magic Word: rt non-english wikis
10054 !! options
10055 parsoid=wt2wt
10056 language=de
10057 !! wikitext
10058 __NOEDITSECTION__
10059 !! html/parsoid
10060 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10061 !! end
10062
10063 !!test
10064 __proto__ is treated as normal wikitext (T105997)
10065 !!wikitext
10066 __proto__
10067 !!html
10068 <p>__proto__
10069 </p>
10070 !!end
10071
10072 ###
10073 ### Magic links
10074 ###
10075 !! test
10076 Magic links: internal link to RFC (bug 479)
10077 !! wikitext
10078 [[RFC 123]]
10079 !! html/php
10080 <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>
10081 </p>
10082 !! html/parsoid
10083 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10084 !! end
10085
10086 !! test
10087 Magic links: RFC (bug 479)
10088 !! wikitext
10089 RFC 822
10090 !! html/php
10091 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10092 </p>
10093 !! html/parsoid
10094 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10095 !! end
10096
10097 !! test
10098 Magic links: RFC (bug 65278)
10099 !! wikitext
10100 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10101 !! html/php
10102 <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.
10103 </p>
10104 !! html/parsoid
10105 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10106 !! end
10107
10108 !! test
10109 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
10110 !! wikitext
10111 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10112 RFC
10113 822
10114 !! html/php
10115 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10116 RFC
10117 822
10118 </p>
10119 !! html/parsoid
10120 <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>
10121 RFC
10122 822</p>
10123 !! end
10124
10125 !! test
10126 Magic links: ISBN (bug 1937)
10127 !! wikitext
10128 ISBN 0-306-40615-2
10129 !! html/php
10130 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10131 </p>
10132 !! html/parsoid
10133 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10134 !! end
10135
10136 !! test
10137 Magic links: ISBN (bug 65278)
10138 !! wikitext
10139 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10140 !! html/php
10141 <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.
10142 </p>
10143 !! html/parsoid
10144 <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>
10145 !! end
10146
10147 !! test
10148 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10149 !! wikitext
10150 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10151 ISBN
10152 9780316098113
10153 ISBN 978
10154 0316098113
10155 !! html/php
10156 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10157 ISBN
10158 9780316098113
10159 ISBN 978
10160 0316098113
10161 </p>
10162 !! html/parsoid
10163 <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>
10164 ISBN
10165 9780316098113
10166 ISBN 978
10167 0316098113</p>
10168 !! end
10169
10170 !! test
10171 Magic links: PMID incorrectly converts space to underscore
10172 !! wikitext
10173 PMID 1234
10174 !! html/php
10175 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10176 </p>
10177 !! html/parsoid
10178 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10179 !! end
10180
10181 !! test
10182 Magic links: PMID (bug 65278)
10183 !! wikitext
10184 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10185 !! html/php
10186 <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.
10187 </p>
10188 !! html/parsoid
10189 <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>
10190 !! end
10191
10192 !! test
10193 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10194 !! wikitext
10195 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10196 PMID
10197 1234
10198 !! html/php
10199 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10200 PMID
10201 1234
10202 </p>
10203 !! html/parsoid
10204 <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>
10205 PMID
10206 1234</p>
10207 !! end
10208
10209 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10210 # since these are ExtLinkText, not MagicLinkText
10211 !! test
10212 Magic links: use appropriate serialization for "almost" magic links.
10213 !! wikitext
10214 X[[Special:BookSources/0978739256|foo]]
10215
10216 X[//tools.ietf.org/html/rfc1234 foo]
10217 !! html/php
10218 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10219 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10220 </p>
10221 !! html/parsoid
10222 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10223 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10224 !! end
10225
10226 ###
10227 ### Templates
10228 ####
10229
10230 !! test
10231 Nonexistent template
10232 !! wikitext
10233 {{thistemplatedoesnotexist}}
10234 !! html
10235 <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>
10236 </p>
10237 !! end
10238
10239 !! test
10240 Template with invalid target containing tags
10241 !! wikitext
10242 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10243 !! html
10244 <p>{{a<b>b</b>|foo|a=b|a = b}}
10245 </p>
10246 !! end
10247
10248 !! test
10249 Template with invalid target containing unclosed tag
10250 !! wikitext
10251 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10252 !! html
10253 <p>{{a<b>|foo|a=b|a = b}}</b>
10254 </p>
10255 !! end
10256
10257 !! test
10258 Template with invalid target containing wikilink
10259 !! wikitext
10260 {{[[Main Page]]}}
10261 !! html/php
10262 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10263 </p>
10264 !! html/parsoid
10265 <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>
10266 !! end
10267
10268 !! test
10269 Template with just whitespace in it, bug #68421
10270 !! wikitext
10271 {{echo|{{ }}}}
10272 !! html/parsoid
10273 <p><span typeof="mw:Transclusion mw:Nowiki" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{ }}"}},"i":0}}]}'>{{ }}</span></p>
10274 !! end
10275
10276 !! article
10277 Template:test
10278 !! text
10279 This is a test template
10280 !! endarticle
10281
10282 !! test
10283 Simple template
10284 !! wikitext
10285 {{test}}
10286 !! html
10287 <p>This is a test template
10288 </p>
10289 !! end
10290
10291 !! test
10292 Template with explicit namespace
10293 !! wikitext
10294 {{Template:test}}
10295 !! html
10296 <p>This is a test template
10297 </p>
10298 !! end
10299
10300
10301 !! article
10302 Template:paramtest
10303 !! text
10304 This is a test template with parameter {{{param}}}
10305 !! endarticle
10306
10307 !! test
10308 Template parameter
10309 !! wikitext
10310 {{paramtest|param=foo}}
10311 !! html
10312 <p>This is a test template with parameter foo
10313 </p>
10314 !! end
10315
10316 !! article
10317 Template:paramtestnum
10318 !! text
10319 [[{{{1}}}|{{{2}}}]]
10320 !! endarticle
10321
10322 !! test
10323 Template unnamed parameter
10324 !! wikitext
10325 {{paramtestnum|Main Page|the main page}}
10326 !! html
10327 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10328 </p>
10329 !! end
10330
10331 !! article
10332 Template:templatesimple
10333 !! text
10334 (test)
10335 !! endarticle
10336
10337 !! article
10338 Template:templateredirect
10339 !! text
10340 #redirect [[Template:templatesimple]]
10341 !! endarticle
10342
10343 !! article
10344 Template:templateasargtestnum
10345 !! text
10346 {{{{{1}}}}}
10347 !! endarticle
10348
10349 !! article
10350 Template:templateasargtest
10351 !! text
10352 {{template{{{templ}}}}}
10353 !! endarticle
10354
10355 !! article
10356 Template:templateasargtest2
10357 !! text
10358 {{{{{templ}}}}}
10359 !! endarticle
10360
10361 !! test
10362 Template with template name as unnamed argument
10363 !! wikitext
10364 {{templateasargtestnum|templatesimple}}
10365 !! html
10366 <p>(test)
10367 </p>
10368 !! end
10369
10370 !! test
10371 Template with template name as argument
10372 !! wikitext
10373 {{templateasargtest|templ=simple}}
10374 !! html
10375 <p>(test)
10376 </p>
10377 !! end
10378
10379 !! test
10380 Template with template name as argument (2)
10381 !! wikitext
10382 {{templateasargtest2|templ=templatesimple}}
10383 !! html
10384 <p>(test)
10385 </p>
10386 !! end
10387
10388 !! article
10389 Template:templateasargtestdefault
10390 !! text
10391 {{{{{templ|templatesimple}}}}}
10392 !! endarticle
10393
10394 !! article
10395 Template:templa
10396 !! text
10397 '''templ'''
10398 !! endarticle
10399
10400 !! test
10401 Template with default value
10402 !! wikitext
10403 {{templateasargtestdefault}}
10404 !! html
10405 <p>(test)
10406 </p>
10407 !! end
10408
10409 !! test
10410 Template with default value (value set)
10411 !! wikitext
10412 {{templateasargtestdefault|templ=templa}}
10413 !! html
10414 <p><b>templ</b>
10415 </p>
10416 !! end
10417
10418 !! test
10419 Template redirect
10420 !! wikitext
10421 {{templateredirect}}
10422 !! html/php
10423 <p>(test)
10424 </p>
10425 !! html/parsoid
10426 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10427 !! end
10428
10429 !! test
10430 Template with argument in separate line
10431 !! wikitext
10432 {{ templateasargtest |
10433 templ = simple }}
10434 !! html
10435 <p>(test)
10436 </p>
10437 !! end
10438
10439 !! test
10440 Template with complex template as argument
10441 !! wikitext
10442 {{paramtest|
10443 param ={{ templateasargtest |
10444 templ = simple }}}}
10445 !! html
10446 <p>This is a test template with parameter (test)
10447 </p>
10448 !! end
10449
10450 !! test
10451 Template with thumb image (with link in description)
10452 !! wikitext
10453 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10454 !! html/php
10455 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>
10456
10457 !! html+tidy
10458 <p>This is a test template with parameter</p>
10459 <div class="thumb tright">
10460 <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>
10461 <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>
10462 </div>
10463 </div>
10464 !! html/parsoid
10465 <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>
10466 !! end
10467
10468 !! article
10469 Template:complextemplate
10470 !! text
10471 {{{1}}} {{paramtest|
10472 param ={{{param}}}}}
10473 !! endarticle
10474
10475 !! test
10476 Template with complex arguments
10477 !! wikitext
10478 {{complextemplate|
10479 param ={{ templateasargtest |
10480 templ = simple }}|[[Template:complextemplate|link]]}}
10481 !! html
10482 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10483 </p>
10484 !! end
10485
10486 !! test
10487 BUG 553: link with two variables in a piped link
10488 !! wikitext
10489 {|
10490 |[[{{{1}}}|{{{2}}}]]
10491 |}
10492 !! html/php
10493 <table>
10494 <tr>
10495 <td>[[{{{1}}}|{{{2}}}]]
10496 </td></tr></table>
10497
10498 !! html/parsoid
10499 <table>
10500 <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>
10501 !! end
10502
10503 # See: T2553
10504 !! test
10505 Abort table cell attribute parsing on wikilink
10506 !! wikitext
10507 {|
10508 | testing [[one|two]] | three || four
10509 | testing one two | three || four
10510 | testing="[[one|two]]" | three || four
10511 |}
10512 !! html/php
10513 <table>
10514 <tr>
10515 <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>
10516 <td> four
10517 </td>
10518 <td> three </td>
10519 <td> four
10520 </td>
10521 <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>
10522 <td> four
10523 </td></tr></table>
10524
10525 !! html/parsoid
10526 <table>
10527 <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>
10528 <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>
10529 <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>
10530 </tbody></table>
10531 !! end
10532
10533 !! test
10534 Don't abort table cell attribute parsing if wikilink is found in template arg
10535 !! wikitext
10536 {|
10537 | Test {{#tag:ref|One two "[[three]]" four}}
10538 |}
10539 !! html/parsoid
10540 <table>
10541 <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>
10542 </tbody></table>
10543 !! end
10544
10545 !! test
10546 Magic variable as template parameter
10547 !! wikitext
10548 {{paramtest|param={{SITENAME}}}}
10549 !! html
10550 <p>This is a test template with parameter MediaWiki
10551 </p>
10552 !! end
10553
10554 !! article
10555 Template:linktest
10556 !! text
10557 [[{{{param}}}|link]]
10558 !! endarticle
10559
10560 !! test
10561 Template parameter as link source
10562 !! wikitext
10563 {{linktest|param=Main Page}}
10564 !! html
10565 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10566 </p>
10567 !! end
10568
10569 !!article
10570 Template:paramtest2
10571 !! text
10572 including another template, {{paramtest|param={{{arg}}}}}
10573 !! endarticle
10574
10575 !! test
10576 Template passing argument to another template
10577 !! wikitext
10578 {{paramtest2|arg='hmm'}}
10579 !! html
10580 <p>including another template, This is a test template with parameter 'hmm'
10581 </p>
10582 !! end
10583
10584 !! article
10585 Template:Linktest2
10586 !! text
10587 Main Page
10588 !! endarticle
10589
10590 !! test
10591 Template as link source
10592 !! wikitext
10593 [[{{linktest2}}]]
10594
10595 [[{{linktest2}}|Main Page]]
10596
10597 [[{{linktest2}}]]Page
10598 !! html
10599 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10600 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10601 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10602 </p>
10603 !! end
10604
10605
10606 !! article
10607 Template:loop1
10608 !! text
10609 {{loop2}}
10610 !! endarticle
10611
10612 !! article
10613 Template:loop2
10614 !! text
10615 {{loop1}}
10616 !! endarticle
10617
10618 !! test
10619 Template infinite loop
10620 !! wikitext
10621 {{loop1}}
10622 !! html
10623 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10624 </p>
10625 !! end
10626
10627 !! test
10628 Template from main namespace
10629 !! wikitext
10630 {{:Main Page}}
10631 !! html
10632 <p>blah blah
10633 </p>
10634 !! end
10635
10636 !! article
10637 Template:table
10638 !! text
10639 {|
10640 | 1 || 2
10641 |-
10642 | 3 || 4
10643 |}
10644 !! endarticle
10645
10646 !! test
10647 BUG 529: Template with table, not included at beginning of line
10648 !! wikitext
10649 foo {{table}}
10650 !! html
10651 <p>foo
10652 </p>
10653 <table>
10654 <tr>
10655 <td> 1 </td>
10656 <td> 2
10657 </td></tr>
10658 <tr>
10659 <td> 3 </td>
10660 <td> 4
10661 </td></tr></table>
10662
10663 !! end
10664
10665 !! test
10666 BUG 523: Template shouldn't eat newline (or add an extra one before table)
10667 !! wikitext
10668 foo
10669 {{table}}
10670 !! html
10671 <p>foo
10672 </p>
10673 <table>
10674 <tr>
10675 <td> 1 </td>
10676 <td> 2
10677 </td></tr>
10678 <tr>
10679 <td> 3 </td>
10680 <td> 4
10681 </td></tr></table>
10682
10683 !! end
10684
10685 !! test
10686 BUG 41: Template parameters shown as broken links
10687 !! wikitext
10688 {{{parameter}}}
10689 !! html
10690 <p>{{{parameter}}}
10691 </p>
10692 !! end
10693
10694 !! test
10695 Template with targets containing wikilinks
10696 !! wikitext
10697 {{[[foo]]}}
10698
10699 {{[[{{echo|foo}}]]}}
10700
10701 {{{{echo|[[foo}}]]}}
10702 !! html
10703 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10704 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10705 </p><p>{{[[foo}}]]
10706 </p>
10707 !! end
10708
10709 !! article
10710 Template:''
10711 !! text
10712 bar
10713 !! endarticle
10714
10715 !! test
10716 Templates: Double quotes as template target
10717 !! wikitext
10718 foo {{''}} baz
10719 !! html/php
10720 <p>foo bar baz
10721 </p>
10722 !! html/parsoid
10723 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
10724 </p>
10725 !! end
10726
10727 ## This test is about making sure Parsoid's data-mw is well formed in the
10728 ## face of multiple templates with intersecting and overlapping ranges. The
10729 ## wikitext itself is wretched.
10730 !! test
10731 Templates with intersecting and overlapping ranges
10732 !! wikitext
10733 {|{{echo|
10734 <p>ha</p>}}
10735 {|{{echo|
10736 <p>ho</p>}}
10737 {{echo|{{!}}hi}}
10738 |}
10739 !! html/php+tidy
10740 <p>ha</p>
10741 <p>ho</p>
10742 <table>
10743 <tr>
10744 <td></td>
10745 </tr>
10746 <tr>
10747 <td>hi</td>
10748 </tr>
10749 </table>
10750 <table>
10751 <tr>
10752 <td></td>
10753 </tr>
10754 </table>
10755 !! html/parsoid
10756 <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":""}]]}'>
10757
10758 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
10759
10760 <tbody><tr><td>hi</td></tr>
10761 </tbody></table>
10762 !! end
10763
10764 !! article
10765 Template:MSGNW test
10766 !! text
10767 ''None'' of '''this''' should be
10768 * interpreted
10769 but rather passed unmodified
10770 {{test}}
10771 <gallery>
10772 File:Foobar.jpg
10773 </gallery>
10774 <!-- comment -->
10775 !! endarticle
10776
10777 # hmm, fix this or just deprecate msgnw and document its behavior?
10778 !! test
10779 msgnw keyword
10780 !! wikitext
10781 {{msgnw:MSGNW test}}
10782 !! html/php
10783 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
10784 &#42; interpreted
10785 &#32;but rather passed unmodified
10786 &#123;&#123;test&#125;&#125;
10787 &#60;gallery&#62;
10788 File:Foobar.jpg
10789 &#60;/gallery&#62;
10790 &#60;!-- comment --&#62;
10791 </p>
10792 !! end
10793
10794 !! test
10795 int keyword
10796 !! wikitext
10797 {{int:youhavenewmessages|lots of money|not!}}
10798 !! html
10799 <p>You have lots of money (not!).
10800 </p>
10801 !! end
10802
10803 !! test
10804 int keyword - non-existing message
10805 !! wikitext
10806 {{int:var}}
10807 !! html
10808 <p>&lt;var&gt;
10809 </p>
10810 !! end
10811
10812 !! article
10813 Template:Includes
10814 !! text
10815 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10816 !! endarticle
10817
10818 !! test
10819 <includeonly> and <noinclude> being included
10820 !! wikitext
10821 {{Includes}}
10822 !! html
10823 <p>Foobar
10824 </p>
10825 !! end
10826
10827 !! article
10828 Template:Includes2
10829 !! text
10830 <onlyinclude>Foo</onlyinclude>bar
10831 !! endarticle
10832
10833 !! test
10834 <onlyinclude> being included
10835 !! wikitext
10836 {{Includes2}}
10837 !! html
10838 <p>Foo
10839 </p>
10840 !! end
10841
10842
10843 !! article
10844 Template:Includes3
10845 !! text
10846 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
10847 !! endarticle
10848
10849 !! test
10850 <onlyinclude> and <includeonly> being included
10851 !! wikitext
10852 {{Includes3}}
10853 !! html
10854 <p>Foo
10855 </p>
10856 !! end
10857
10858 !! test
10859 <includeonly> and <noinclude> on a page
10860 !! wikitext
10861 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10862 !! html
10863 <p>Foozar
10864 </p>
10865 !! end
10866
10867 !! test
10868 Un-closed <noinclude>
10869 !! wikitext
10870 <noinclude>
10871 !! html
10872 !! end
10873
10874 !! test
10875 <onlyinclude> on a page
10876 !! wikitext
10877 <onlyinclude>Foo</onlyinclude>bar
10878 !! html
10879 <p>Foobar
10880 </p>
10881 !! end
10882
10883 !! test
10884 Un-closed <onlyinclude>
10885 !! wikitext
10886 <onlyinclude>
10887 !! html
10888 !! end
10889
10890 !!test
10891 Self-closed noinclude, includeonly, onlyinclude tags
10892 !! wikitext
10893 <noinclude />
10894 <includeonly />
10895 <onlyinclude />
10896 !! html
10897 <p><br />
10898 </p>
10899 !!end
10900
10901 !!test
10902 Unbalanced includeonly and noinclude tags
10903 !! wikitext
10904 {|
10905 |a</noinclude>
10906 |b</noinclude></noinclude>
10907 |c</noinclude></includeonly>
10908 |d</includeonly></includeonly>
10909 |}
10910 !! html
10911 <table>
10912 <tr>
10913 <td>a
10914 </td>
10915 <td>b
10916 </td>
10917 <td>c&lt;/includeonly&gt;
10918 </td>
10919 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
10920 </td></tr></table>
10921
10922 !!end
10923
10924 !! article
10925 Template:Includeonly section
10926 !! text
10927 <includeonly>
10928 ==Includeonly section==
10929 </includeonly>
10930 ==Section T-1==
10931 !!endarticle
10932
10933 !! test
10934 Bug 6563: Edit link generation for section shown by <includeonly>
10935 !! wikitext
10936 {{includeonly section}}
10937 !! html
10938 <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>
10939 <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>
10940
10941 !! end
10942
10943 # Uses same input as the contents of [[Template:Includeonly section]]
10944 !! test
10945 Bug 6563: Section extraction for section shown by <includeonly>
10946 !! options
10947 section=T-2
10948 !! wikitext
10949 <includeonly>
10950 ==Includeonly section==
10951 </includeonly>
10952 ==Section T-2==
10953 !! html
10954 ==Section T-2==
10955 !! end
10956
10957 !! test
10958 Bug 6563: Edit link generation for section suppressed by <includeonly>
10959 !! wikitext
10960 <includeonly>
10961 ==Includeonly section==
10962 </includeonly>
10963 ==Section 1==
10964 !! html
10965 <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>
10966
10967 !! end
10968
10969 !! test
10970 Bug 6563: Section extraction for section suppressed by <includeonly>
10971 !! options
10972 section=1
10973 !! wikitext
10974 <includeonly>
10975 ==Includeonly section==
10976 </includeonly>
10977 ==Section 1==
10978 !! html
10979 ==Section 1==
10980 !! end
10981
10982 !! test
10983 Un-closed <includeonly>
10984 !! wikitext
10985 <includeonly>
10986 !! html/php
10987 !! html/parsoid
10988 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
10989 !! end
10990
10991 ## We used to, but no longer wt2wt this test since the default serializer
10992 ## will normalize the include directives to serialize on their own line.
10993 ## Selser will take care of preserving formatting in scenarios where they
10994 ## intermingled with other wikitext.
10995 !! test
10996 Includes and comments at SOL
10997 !! options
10998 parsoid=wt2html,html2html
10999 !! wikitext
11000 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11001
11002 <noinclude>
11003 some
11004 </noinclude>* stuff
11005 * here
11006
11007 <includeonly>can have stuff</includeonly>=== here ===
11008
11009 !! html/php
11010 <h2><span class="mw-headline" id="hu">hu</span></h2>
11011 <p>some
11012 </p>
11013 <ul><li> stuff</li>
11014 <li> here</li></ul>
11015 <h3><span class="mw-headline" id="here">here</span></h3>
11016
11017 !! html/parsoid
11018 <!-- 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>
11019
11020 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11021 <p>some</p>
11022 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11023 <li> here</li></ul>
11024
11025 <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>
11026
11027 !! end
11028
11029 # TODO: test with DOM fragment reuse!
11030 !! test
11031 Parsoid: DOM fragment reuse
11032 !! options
11033 parsoid=wt2wt,wt2html
11034 !! wikitext
11035 a{{echo|b<table></table>c}}d
11036
11037 a{{echo|b
11038 <table></table>
11039 c}}d
11040
11041 {{echo|a
11042
11043 <table></table>
11044
11045 b}}
11046 !! html
11047 <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>
11048
11049 <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">
11050 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11051 </span><p about="#mwt2">cd</p>
11052
11053 <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">
11054
11055 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11056
11057 </span><p about="#mwt3">b</p>
11058 !! end
11059
11060 !! test
11061 Parsoid: Merge double tds (T52603)
11062 !! options
11063 parsoid
11064 !! wikitext
11065 {|
11066 |{{echo|{{!}} foo}}
11067 |}
11068 !! html
11069 <table><tbody>
11070 <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>
11071 </tbody></table>
11072 !! end
11073
11074 !! test
11075 Parsoid: Merge double tds in nested transclusion content (T52603)
11076 !! options
11077 parsoid
11078 !! wikitext
11079 {{echo|<div>}}
11080 {|
11081 |{{echo|{{!}} foo}}
11082 |}
11083 {{echo|</div>}}
11084 !! html
11085 <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}}]}'>
11086 <table><tbody>
11087 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11088 </tbody></table>
11089 </div>
11090 !! end
11091
11092 ###
11093 ### <includeonly> and <noinclude> in attributes
11094 ###
11095 !!test
11096 0. includeonly around the entire attribute
11097 !! wikitext
11098 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11099 !! html
11100 <p><span id="v2">bar</span>
11101 </p>
11102 !!end
11103
11104 !!test
11105 1. includeonly in html attr key
11106 !! wikitext
11107 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11108 !! html
11109 <p><span id="foo">bar</span>
11110 </p>
11111 !!end
11112
11113 !!test
11114 2. includeonly in html attr value
11115 !! wikitext
11116 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11117 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11118 !! html
11119 <p><span id="v1">bar</span>
11120 <span id="v1">bar</span>
11121 </p>
11122 !!end
11123
11124 !!test
11125 3. includeonly in part of an attr value
11126 !! wikitext
11127 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11128 !! html
11129 <p><span style="color:red;">bar</span>
11130 </p>
11131 !!end
11132
11133 !!test
11134 4. includeonly in table attributes
11135 !! wikitext
11136 {|
11137 |- <noinclude>
11138 |-
11139 |a
11140 </noinclude>
11141 |- <includeonly>
11142 |-
11143 |b
11144 </includeonly>
11145 |}
11146 !! html
11147 <table>
11148
11149
11150 <tr>
11151 <td>a
11152 </td></tr>
11153 </table>
11154
11155 !!end
11156
11157 ###
11158 ### Token Stream Patcher tests
11159 ###
11160 ### These tests won't always pass wt2wt and other modes because
11161 ### on serialization, the table will be output on a new line.
11162 ### For now, we are blacklisting them, and using this to test selser.
11163 ###
11164
11165 !!test
11166 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11167 !!options
11168 parsoid=wt2html,wt2wt
11169 !!wikitext
11170 {{echo|}}{| width = '100%'
11171 |foo
11172 |}
11173 !!html/parsoid
11174 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11175 <tbody><tr><td>foo</td></tr>
11176 </tbody></table>
11177 !!end
11178
11179 ## We used to, but no longer wt2wt this test since the default serializer
11180 ## will normalize the include directives to serialize on their own line.
11181 ## Selser will take care of preserving formatting in scenarios where they
11182 ## intermingled with other wikitext.
11183 !!test
11184 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11185 !!options
11186 parsoid=wt2html
11187 !!wikitext
11188 <includeonly>a</includeonly>{| {{{b}}}
11189 |c
11190 |}
11191 !!html/parsoid
11192 <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}}}":""}}'>
11193 <tbody><tr><td>c</td></tr>
11194 </tbody></table>
11195
11196 !!end
11197
11198 ###
11199 ### Testing parsing of templates where a template arg
11200 ### has the same name as the template itself.
11201 ###
11202
11203 !! article
11204 Template:quote
11205 !! text
11206 {{{quote|{{{1}}}}}}
11207 !! endarticle
11208
11209 !!test
11210 Templates: Template Name/Arg clash: 1. Use of positional param
11211 !! wikitext
11212 {{quote|foo}}
11213 !! html
11214 <p>foo
11215 </p>
11216 !!end
11217
11218 !!test
11219 Templates: Template Name/Arg clash: 2. Use of named param
11220 !! wikitext
11221 {{quote|quote=foo}}
11222 !! html
11223 <p>foo
11224 </p>
11225 !!end
11226
11227 !!test
11228 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11229 !! wikitext
11230 {{quote|quote}}
11231 !! html
11232 <p>quote
11233 </p>
11234 !!end
11235
11236 ###
11237 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11238 ###
11239
11240 !!test
11241 Templates: 1. Simple use
11242 !! wikitext
11243 {{echo|Foo}}
11244 !! html
11245 <p>Foo
11246 </p>
11247 !!end
11248
11249 !!test
11250 Templates: 2. Inside a block tag
11251 !! wikitext
11252 <div>{{echo|Foo}}</div>
11253 <blockquote>{{echo|Foo}}</blockquote>
11254 !! html
11255 <div>Foo</div>
11256 <blockquote>Foo</blockquote>
11257
11258 !! html+tidy
11259 <div>Foo</div>
11260 <blockquote>
11261 <p>Foo</p>
11262 </blockquote>
11263 !!end
11264
11265 !!test
11266 Templates: P-wrapping: 1a. Templates on consecutive lines
11267 !! wikitext
11268 {{echo|Foo}}
11269 {{echo|bar}}
11270 !! html
11271 <p>Foo
11272 bar
11273 </p>
11274 !!end
11275
11276 !!test
11277 Templates: P-wrapping: 1b. Templates on consecutive lines
11278 !! wikitext
11279 Foo
11280
11281 {{echo|bar}}
11282 {{echo|baz}}
11283 !! html
11284 <p>Foo
11285 </p><p>bar
11286 baz
11287 </p>
11288 !!end
11289
11290 !!test
11291 Templates: P-wrapping: 1c. Templates on consecutive lines
11292 !! wikitext
11293 {{echo|Foo}}
11294 {{echo|bar}} <div>baz</div>
11295 !! html
11296 <p>Foo
11297 </p>
11298 bar <div>baz</div>
11299
11300 !! html+tidy
11301 <p>Foo</p>
11302 <p>bar</p>
11303 <div>baz</div>
11304 !! end
11305
11306 !!test
11307 Templates: P-wrapping: 1d. Template preceded by comment-only line
11308 !!options
11309 parsoid
11310 !! wikitext
11311 <!-- foo -->
11312 {{echo|Bar}}
11313 !! html
11314 <!-- foo -->
11315
11316 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11317 !!end
11318
11319 !!test
11320 Templates: Inline Text: 1. Multiple template uses
11321 !! wikitext
11322 {{echo|Foo}}bar{{echo|baz}}
11323 !! html
11324 <p>Foobarbaz
11325 </p>
11326 !!end
11327
11328 !!test
11329 Templates: Inline Text: 2. Back-to-back template uses
11330 !! wikitext
11331 {{echo|Foo}}{{echo|bar}}
11332 !! html
11333 <p>Foobar
11334 </p>
11335 !!end
11336
11337 !!test
11338 Templates: Block Tags: 1. Multiple template uses
11339 !! wikitext
11340 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11341 !! html
11342 <div>Foo</div><div>bar</div><div>baz</div>
11343
11344 !!end
11345
11346 !!test
11347 Templates: Block Tags: 2. Back-to-back template uses
11348 !! wikitext
11349 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11350 !! html
11351 <div>Foo</div><div>bar</div>
11352
11353 !!end
11354
11355 # This is an edge case relating to paragraph wrapping.
11356 !!test
11357 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11358 !! wikitext
11359 {{echo|a
11360 b</p>}}
11361 !! html/parsoid
11362 <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
11363 b</p>
11364 !!end
11365
11366 !!test
11367 Templates: Links: 1. Simple example
11368 !! wikitext
11369 {{echo|[[Foo|bar]]}}
11370 !! html
11371 <p><a href="/wiki/Foo" title="Foo">bar</a>
11372 </p>
11373 !!end
11374
11375 !!test
11376 Templates: Links: 2. Generation of link href
11377 !! wikitext
11378 [[{{echo|Foo}}|bar]]
11379 !! html
11380 <p><a href="/wiki/Foo" title="Foo">bar</a>
11381 </p>
11382 !!end
11383
11384 !!test
11385 Templates: Links: 3. Generation of part of a link href
11386 !! wikitext
11387 [[Fo{{echo|o}}|bar]]
11388
11389 [[Foo{{echo|bar}}]]
11390
11391 [[Foo{{echo|bar}}baz]]
11392
11393 [[Foo{{echo|bar}}|bar]]
11394
11395 [[:Foo{{echo|bar}}]]
11396
11397 [[:Foo{{echo|bar}}|bar]]
11398 !! html
11399 <p><a href="/wiki/Foo" title="Foo">bar</a>
11400 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11401 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11402 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11403 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11404 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11405 </p>
11406 !!end
11407
11408 !!test
11409 Templates: Links: 4. Multiple templates generating link href
11410 !! wikitext
11411 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11412 !! html
11413 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11414 </p>
11415 !!end
11416
11417 !!test
11418 Templates: Links: 5. Generation of link text
11419 !! wikitext
11420 [[Foo|{{echo|bar}}]]
11421 !! html
11422 <p><a href="/wiki/Foo" title="Foo">bar</a>
11423 </p>
11424 !!end
11425
11426 !!test
11427 Templates: Links: 5. Nested templates (only outermost template should be marked)
11428 !! wikitext
11429 {{echo|[[{{echo|Foo}}|bar]]}}
11430 !! html
11431 <p><a href="/wiki/Foo" title="Foo">bar</a>
11432 </p>
11433 !!end
11434
11435 !!test
11436 Templates: HTML Tag: 1. Generation of HTML attr. key
11437 !! wikitext
11438 <div {{echo|style}}="color:red;">foo</div>
11439 !! html
11440 <div style="color:red;">foo</div>
11441
11442 !!end
11443
11444 !!test
11445 Templates: HTML Tag: 2. Generation of HTML attr. value
11446 !! wikitext
11447 <div style={{echo|'color:red;'}}>foo</div>
11448 !! html
11449 <div style="color:red;">foo</div>
11450
11451 !!end
11452
11453 !!test
11454 Templates: HTML Tag: 3. Generation of HTML attr key and value
11455 !! wikitext
11456 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11457 !! html
11458 <div style="color:red;">foo</div>
11459
11460 !!end
11461
11462 !!test
11463 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11464 !! wikitext
11465 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11466 !! html
11467 <div title="This is a long title with just one piece templated">foo</div>
11468
11469 !!end
11470
11471 !!test
11472 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11473 !! wikitext
11474 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11475 !! html
11476 <div title="This is a long title with just one piece templated">foo</div>
11477
11478 !!end
11479
11480 !!test
11481 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11482 !! wikitext
11483 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11484 !! html
11485 <div title="This is a long title with just one piece templated">foo</div>
11486
11487 !!end
11488
11489 # SSS FIXME: While it is great we added support for all this,
11490 # do we want to make this part of the spec? Maybe we want to
11491 # deprecate this kind of usage in the future?
11492 !!test
11493 Templates: HTML Tag: 7. Generation of partial attribute key string
11494 !! wikitext
11495 <div st{{echo|yle}}="color:red;">foo</div>
11496 !! html
11497 <div style="color:red;">foo</div>
11498
11499 !!end
11500
11501 !! test
11502 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11503 !! wikitext
11504 <div {{echo|1=id="v1"}}>bar</div>
11505 !! html
11506 <div id="v1">bar</div>
11507
11508 !!end
11509
11510 !! test
11511 Templates: HTML Tag: 9. Multiple template-generated attributes
11512 !! wikitext
11513 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11514 !! html
11515 <div id="v1" title="foo">bar</div>
11516
11517 !!end
11518
11519 !! test
11520 Templates: Support for templates generating attributes and content
11521 !! wikitext
11522 {| {{mixed_attr_content_template}}
11523 |-
11524 |bar
11525 |}
11526 !! html/php
11527 <table style="color:red;" title="T48811">
11528
11529 <tr>
11530 <td>foo
11531 </td></tr>
11532 <tr>
11533 <td>bar
11534 </td></tr></table>
11535
11536 !! html/parsoid
11537 <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|}"]}'>
11538 <tbody><tr>
11539 <td>foo</td></tr>
11540 <tr>
11541 <td>bar</td></tr>
11542 </tbody></table>
11543 !!end
11544
11545 !! test
11546 1. Entities and nowikis inside templated attributes should be handled correctly
11547 !! wikitext
11548 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11549 !! html/php
11550 <div style="background:#f9f9f9;">foo</div>
11551
11552 !! html/parsoid
11553 <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>
11554 !! end
11555
11556 !! test
11557 2. Entities and nowikis inside templated attributes should be handled correctly
11558 !! wikitext
11559 {|
11560 |{{table_attribs_3}}
11561 |}
11562 !! html/php
11563 <table>
11564 <tr>
11565 <td style="background:#f9f9f9;">Foo
11566 </td></tr></table>
11567
11568 !! html/parsoid
11569 <table>
11570 <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>
11571 </tbody></table>
11572 !! end
11573
11574 !! test
11575 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11576 !! wikitext
11577 {{tbl-start}}
11578 |{{table_attribs_3}}
11579 {{tbl-end}}
11580 !! html/php
11581 <table>
11582 <tr>
11583 <td style="background:#f9f9f9;">Foo
11584 </td></tr></table>
11585
11586 !! html/parsoid
11587 <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}}]}'>
11588 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11589 </tbody></table>
11590 !! end
11591
11592 # T107622
11593 !! test
11594 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11595 !! wikitext
11596 {|
11597 | {{table_attribs_6}} hi
11598 |}
11599 !! html/php
11600 <table>
11601 <tr>
11602 <td style="background: red;"> hi
11603 </td></tr></table>
11604
11605 !! html/parsoid
11606 <table>
11607 <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>
11608 </tbody></table>
11609 !! end
11610
11611 !!test
11612 Templates: HTML Tables: 1. Generating start of a HTML table
11613 !! wikitext
11614 {{echo|<table><tr><td>foo</td>}}</tr></table>
11615 !! html
11616 <table><tr><td>foo</td></tr></table>
11617
11618 !!end
11619
11620 !!test
11621 Templates: HTML Tables: 2a. Generating middle of a HTML table
11622 !! wikitext
11623 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11624 !! html
11625 <table><tr><td>foo</td></tr></table>
11626
11627 !!end
11628
11629 !!test
11630 Templates: HTML Tables: 2b. Generating middle of a HTML table
11631 !! wikitext
11632 <table>{{echo|<tr><td>foo</td></tr>}}</table>
11633 !! html
11634 <table><tr><td>foo</td></tr></table>
11635
11636 !!end
11637
11638 !!test
11639 Templates: HTML Tables: 3. Generating end of a HTML table
11640 !! wikitext
11641 <table><tr>{{echo|<td>foo</td></tr></table>}}
11642 !! html
11643 <table><tr><td>foo</td></tr></table>
11644
11645 !!end
11646
11647 !!test
11648 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
11649 !! wikitext
11650 {{echo|<table>}}<tr><td>foo</td></tr></table>
11651 !! html
11652 <table><tr><td>foo</td></tr></table>
11653
11654 !!end
11655
11656 !!test
11657 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
11658 !! wikitext
11659 <table>{{echo|<tr>}}<td>foo</td></tr></table>
11660 !! html
11661 <table><tr><td>foo</td></tr></table>
11662
11663 !!end
11664
11665 !!test
11666 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
11667 !! wikitext
11668 <table><tr>{{echo|<td>}}foo</td></tr></table>
11669 !! html
11670 <table><tr><td>foo</td></tr></table>
11671
11672 !!end
11673
11674 !!test
11675 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
11676 !! wikitext
11677 <table><tr><td>foo{{echo|</td>}}</tr></table>
11678 !! html
11679 <table><tr><td>foo</td></tr></table>
11680
11681 !!end
11682
11683 !!test
11684 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
11685 !! wikitext
11686 <table><tr><td>foo</td>{{echo|</tr>}}</table>
11687 !! html
11688 <table><tr><td>foo</td></tr></table>
11689
11690 !!end
11691
11692 !!test
11693 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
11694 !! wikitext
11695 <table><tr><td>foo</td></tr>{{echo|</table>}}
11696 !! html
11697 <table><tr><td>foo</td></tr></table>
11698
11699 !!end
11700
11701 !!test
11702 Templates: HTML Tables: 5. Proper fostering of categories from inside
11703 !!options
11704 parsoid=wt2html,wt2wt
11705 !! wikitext
11706 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
11707 <!--Two categories (Bug 50330)-->
11708 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
11709 !! html
11710 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
11711 <!--Two categories (Bug 50330)-->
11712 <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>
11713 !!end
11714
11715 !!test
11716 Templates: Wiki Tables: 1a. Fostering of entire template content
11717 !! wikitext
11718 {|
11719 {{echo|a}}
11720 |}
11721 !! html
11722 <table>
11723 a
11724 <tr><td></td></tr></table>
11725
11726 !! html+tidy
11727 <p>a</p>
11728 <table>
11729 <tr>
11730 <td></td>
11731 </tr>
11732 </table>
11733 !! end
11734
11735 !!test
11736 Templates: Wiki Tables: 1b. Fostering of entire template content
11737 !! wikitext
11738 {|
11739 {{echo|<div>}}
11740 foo
11741 {{echo|</div>}}
11742 |}
11743 !! html
11744 <table>
11745 <div>
11746 <p>foo
11747 </p>
11748 </div>
11749 <tr><td></td></tr></table>
11750
11751 !! html+tidy
11752 <div>
11753 <p>foo</p>
11754 </div>
11755 <table>
11756 <tr>
11757 <td></td>
11758 </tr>
11759 </table>
11760 !! end
11761
11762 !!test
11763 Templates: Wiki Tables: 2. Fostering of partial template content
11764 !! wikitext
11765 {|
11766 {{echo|a
11767 <div>b</div>}}
11768 |}
11769 !! html
11770 <table>
11771 a
11772 <div>b</div>
11773 <tr><td></td></tr></table>
11774
11775 !! html+tidy
11776 <p>a</p>
11777 <div>b</div>
11778 <table>
11779 <tr>
11780 <td></td>
11781 </tr>
11782 </table>
11783 !! end
11784
11785 !!test
11786 Templates: Wiki Tables: 3. td-content via multiple templates
11787 !! wikitext
11788 {|
11789 {{echo|{{pipe}}a}}{{echo|b}}
11790 |}
11791 !! html
11792 <table>
11793 <tr>
11794 <td>ab
11795 </td></tr></table>
11796
11797 !!end
11798
11799 !!test
11800 Templates: Wiki Tables: 4. Templated tags, no content
11801 !! wikitext
11802 {{tbl-start}}
11803 {{tbl-end}}
11804 !! html
11805 <table>
11806 <tr><td></td></tr></table>
11807
11808 !!end
11809
11810 !!test
11811 Templates: Wiki Tables: 5. Templated tags, regular td-tags
11812 !! wikitext
11813 {{tbl-start}}
11814 |foo
11815 {{tbl-end}}
11816 !! html
11817 <table>
11818 <tr>
11819 <td>foo
11820 </td></tr></table>
11821
11822 !!end
11823
11824 !!test
11825 Templates: Wiki Tables: 6. Templated tags, templated td-tags
11826 !! wikitext
11827 {{tbl-start}}
11828 {{!}}foo
11829 {{tbl-end}}
11830 !! html
11831 <table>
11832 <tr>
11833 <td>foo
11834 </td></tr></table>
11835
11836 !!end
11837
11838 ## This test case is very specific to Parsoid's internals
11839 ## and is hence only tested for Parsoid's code. Parsoid uses
11840 ## a <meta> marker tag for <ref> tags and they are expanded
11841 ## much later. We are verifying that this <meta> tag usage
11842 ## doesn't prevent foster parenting.
11843 !!test
11844 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
11845 !!wikitext
11846 {{PartialTable}}<ref>foo</ref>
11847 |}
11848
11849 <references />
11850 !!html/parsoid
11851 <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">
11852 <tbody>
11853 </tbody></table>
11854
11855 <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>
11856 !!end
11857
11858 !! test
11859 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
11860 !! wikitext
11861 {{echo|
11862 {{{!}}
11863 {{!}}-}}
11864 <onlyinclude>
11865 |foo
11866 </onlyinclude>
11867 {{!}}}
11868 !! html/parsoid
11869 <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{{!}}}"]}'>
11870 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
11871 <tbody><tr>
11872
11873 <td>foo
11874 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
11875 </tbody></table>
11876 !! end
11877
11878 !!test
11879 Templates: Lists: Multi-line list-items via templates
11880 !! wikitext
11881 *{{echo|a {{nonexistent|
11882 unused}}}}
11883 *{{echo|b {{nonexistent|
11884 unused}}}}
11885 !! html
11886 <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>
11887 <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>
11888
11889 !!end
11890
11891 !!test
11892 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
11893 !! wikitext
11894 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
11895 !! html
11896 <p><i>ab</i>c<i>d</i>e
11897 </p>
11898 !!end
11899
11900 !!test
11901 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
11902 (PHP parser generates misnested html)
11903 !! wikitext
11904 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
11905 !! html/parsoid
11906 <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>
11907 !!end
11908
11909 !!test
11910 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
11911 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
11912 !! options
11913 parsoid=wt2html,wt2wt
11914 !! wikitext
11915 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
11916 !! html
11917 <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>
11918 <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>
11919 <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>
11920 !!end
11921
11922 !!test
11923 Templates: Ugly nesting: 4. Divs opened/closed across templates
11924 !! wikitext
11925 a<div>b{{echo|c</div>d}}e
11926 !! html
11927 a<div>bc</div>de
11928
11929 !! html+tidy
11930 <p>a</p>
11931 <div>bc</div>
11932 <p>de</p>
11933 !! end
11934
11935 !!test
11936 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
11937 (Parsoid-centric)
11938 !! options
11939 parsoid
11940 !! wikitext
11941 {|
11942 |{{echo|foo</table>}}
11943 |bar
11944 |}
11945 !! html
11946 <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|}"]}'>
11947
11948 <tbody>
11949 <tr>
11950 <td>foo</td></tr></tbody></table><span about="#mwt1">
11951 </span><span about="#mwt1">|bar</span><span about="#mwt1">
11952 |}</span>
11953 !!end
11954
11955 !!test
11956 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
11957 (Parsoid-centric)
11958 !! options
11959 parsoid
11960 !! wikitext
11961 <table>
11962 <tr>
11963 <td>
11964 <table>
11965 <tr>
11966 <td>1. {{echo|foo </table>}}</td>
11967 <td> bar </td>
11968 <td>2. {{echo|baz </table>}}</td>
11969 </tr>
11970 <tr>
11971 <td>abc</td>
11972 </tr>
11973 </table>
11974 </td>
11975 </tr>
11976 <tr>
11977 <td>xyz</td>
11978 </tr>
11979 </table>
11980 !! html
11981 <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>"]}'>
11982 <tbody><tr>
11983 <td>
11984 <table>
11985 <tbody><tr>
11986 <td>1. foo </td></tr></tbody></table></td>
11987 <td> bar </td>
11988 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
11989 </span><span about="#mwt2">
11990 </span><span about="#mwt2">
11991 </span><span about="#mwt2">abc</span><span about="#mwt2">
11992 </span><span about="#mwt2">
11993 </span><span about="#mwt2">
11994 </span><span about="#mwt2">
11995 </span><span about="#mwt2">
11996 </span><span about="#mwt2">
11997 </span><span about="#mwt2">xyz</span><span about="#mwt2">
11998 </span><span about="#mwt2">
11999 </span>
12000 !!end
12001
12002 !! test
12003 Templates: Ugly templates: 3. newline-only template parameter
12004 !! wikitext
12005 foo {{echo|
12006 }}
12007 !! html
12008 <p>foo
12009 </p>
12010 !! end
12011
12012 # This looks like a bug: a single newline triggers p/br for some reason.
12013 !! test
12014 Templates: Ugly templates: 4. newline-only template parameter inconsistency
12015 !! wikitext
12016 {{echo|
12017 }}
12018 !! html
12019 <p><br />
12020 </p>
12021 !! end
12022
12023 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
12024 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12025 !! test
12026 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12027 !! wikitext
12028 {{echo|<table>}}
12029 {{echo|<div>foo}}
12030 {{echo|</table>}}
12031 !! html/parsoid
12032 <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
12033 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12034 </table>
12035 !! end
12036
12037 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
12038 # that are "identical" and generate nesting cycles in the algorithm
12039 !! test
12040 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12041 !! wikitext
12042 {{echo|<table><tr><td><table>}}
12043 {{echo|<div>}}
12044 {{echo|</div>}}
12045 !! html/parsoid
12046 <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"}'>
12047 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12048 </table></td></tr></tbody></table>
12049 !! end
12050
12051 !! test
12052 Templates: Parameters substituted at the top-level
12053 !! wikitext
12054 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12055 !! html/php
12056 <p><i>who</i> me? <b>never!</b>
12057 </p>
12058 !! html/parsoid
12059 <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>
12060 !! end
12061
12062 !!test
12063 Parser Functions: 1. Simple example
12064 !! wikitext
12065 {{uc:foo}}
12066 !! html
12067 <p>FOO
12068 </p>
12069 !!end
12070
12071 !!test
12072 Parser Functions: 2. Nested use (only outermost should be marked up)
12073 !! wikitext
12074 {{uc:{{lc:FOO}}}}
12075 !! html
12076 <p>FOO
12077 </p>
12078 !!end
12079
12080 ###
12081 ### Pre-save transform tests
12082 ###
12083 !! test
12084 pre-save transform: subst:
12085 !! options
12086 pst
12087 !! wikitext
12088 {{subst:test}}
12089 !! html/php
12090 This is a test template
12091 !! end
12092
12093 !! test
12094 pre-save transform: normal template
12095 !! options
12096 pst
12097 !! wikitext
12098 {{test}}
12099 !! html/php
12100 {{test}}
12101 !! end
12102
12103 !! test
12104 pre-save transform: nonexistent template
12105 !! options
12106 pst
12107 !! wikitext
12108 {{thistemplatedoesnotexist}}
12109 !! html/php
12110 {{thistemplatedoesnotexist}}
12111 !! end
12112
12113 !! test
12114 pre-save transform: subst magic variables
12115 !! options
12116 pst
12117 !! wikitext
12118 {{subst:SITENAME}}
12119 !! html/php
12120 MediaWiki
12121 !! end
12122
12123 # This is bug 89, which I fixed. -- wtm
12124 !! test
12125 pre-save transform: subst: templates with parameters
12126 !! options
12127 pst
12128 !! wikitext
12129 {{subst:paramtest|param="something else"}}
12130 !! html/php
12131 This is a test template with parameter "something else"
12132 !! end
12133
12134 !! article
12135 Template:nowikitest
12136 !! text
12137 <nowiki>'''not wiki'''</nowiki>
12138 !! endarticle
12139
12140 !! test
12141 pre-save transform: nowiki in subst (bug 1188)
12142 !! options
12143 pst
12144 !! wikitext
12145 {{subst:nowikitest}}
12146 !! html/php
12147 <nowiki>'''not wiki'''</nowiki>
12148 !! end
12149
12150 !! article
12151 Template:commenttest
12152 !! text
12153 This template has <!-- a comment --> in it.
12154 !! endarticle
12155
12156 !! test
12157 pre-save transform: comment in subst (bug 1936)
12158 !! options
12159 pst
12160 !! wikitext
12161 {{subst:commenttest}}
12162 !! html/php
12163 This template has <!-- a comment --> in it.
12164 !! end
12165
12166 !! test
12167 pre-save transform: unclosed tag
12168 !! options
12169 pst
12170 !! wikitext
12171 <nowiki>'''not wiki'''
12172 !! html/php
12173 <nowiki>'''not wiki'''
12174 !! end
12175
12176 !! test
12177 pre-save transform: mixed tag case
12178 !! options
12179 pst
12180 !! wikitext
12181 <NOwiki>'''not wiki'''</noWIKI>
12182 !! html/php
12183 <NOwiki>'''not wiki'''</noWIKI>
12184 !! end
12185
12186 !! test
12187 pre-save transform: unclosed comment in <nowiki>
12188 !! options
12189 pst
12190 !! wikitext
12191 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12192 !! html/php
12193 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12194 !!end
12195
12196 # Leading @ in this template definition works around a limitation
12197 # in parsoid's parserTests which otherwise strips the <span> from the
12198 # result (confusing it for a template wrapper)
12199 !! article
12200 Template:dangerous
12201 !!text
12202 @<span onmouseover="alert('crap')">Oh no</span>
12203 !!endarticle
12204
12205 !!test
12206 (confirming safety of fix for subst bug 1936)
12207 !! wikitext
12208 {{Template:dangerous}}
12209 !! html
12210 <p>@<span>Oh no</span>
12211 </p>
12212 !! end
12213
12214 !! test
12215 pre-save transform: comment containing gallery (bug 5024)
12216 !! options
12217 pst
12218 !! wikitext
12219 <!-- <gallery>data</gallery> -->
12220 !! html/php
12221 <!-- <gallery>data</gallery> -->
12222 !!end
12223
12224 !! test
12225 pre-save transform: comment containing extension
12226 !! options
12227 pst
12228 !! wikitext
12229 <!-- <tag>data</tag> -->
12230 !! html/php
12231 <!-- <tag>data</tag> -->
12232 !!end
12233
12234 !! test
12235 pre-save transform: comment containing nowiki
12236 !! options
12237 pst
12238 !! wikitext
12239 <!-- <nowiki>data</nowiki> -->
12240 !! html/php
12241 <!-- <nowiki>data</nowiki> -->
12242 !!end
12243
12244 !! test
12245 pre-save transform: <noinclude> in subst (bug 3298)
12246 !! options
12247 pst
12248 !! wikitext
12249 {{subst:Includes}}
12250 !! html/php
12251 Foobar
12252 !! end
12253
12254 !! test
12255 pre-save transform: <onlyinclude> in subst (bug 3298)
12256 !! options
12257 pst
12258 !! wikitext
12259 {{subst:Includes2}}
12260 !! html/php
12261 Foo
12262 !! end
12263
12264 !! article
12265 Template:SubstTest
12266 !!text
12267 {{<includeonly>subst:</includeonly>Includes}}
12268 !! endarticle
12269
12270 !! article
12271 Template:SafeSubstTest
12272 !! text
12273 {{<includeonly>safesubst:</includeonly>Includes}}
12274 !! endarticle
12275
12276 !! test
12277 bug 22297: safesubst: works during PST
12278 !! options
12279 pst
12280 !! wikitext
12281 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12282 !! html/php
12283 FoobarFoobar
12284 !! end
12285
12286 !! test
12287 bug 22297: safesubst: works during normal parse
12288 !! wikitext
12289 {{SafeSubstTest}}
12290 !! html
12291 <p>Foobar
12292 </p>
12293 !! end
12294
12295 !! test
12296 subst: does not work during normal parse
12297 !! wikitext
12298 {{SubstTest}}
12299 !! html
12300 <p>{{subst:Includes}}
12301 </p>
12302 !! end
12303
12304 !! test
12305 pre-save transform: context links ("pipe trick")
12306 !! options
12307 pst
12308 !! wikitext
12309 [[Article (context)|]]
12310 [[Bar:Article|]]
12311 [[:Bar:Article|]]
12312 [[Bar:Article (context)|]]
12313 [[:Bar:Article (context)|]]
12314 [[|Article]]
12315 [[|Article (context)]]
12316 [[Bar:X (Y) Z|]]
12317 [[:Bar:X (Y) Z|]]
12318 !! html/php
12319 [[Article (context)|Article]]
12320 [[Bar:Article|Article]]
12321 [[:Bar:Article|Article]]
12322 [[Bar:Article (context)|Article]]
12323 [[:Bar:Article (context)|Article]]
12324 [[Article]]
12325 [[Article (context)]]
12326 [[Bar:X (Y) Z|X (Y) Z]]
12327 [[:Bar:X (Y) Z|X (Y) Z]]
12328 !! end
12329
12330 !! test
12331 pre-save transform: context links ("pipe trick") with interwiki prefix
12332 !! options
12333 pst
12334 !! wikitext
12335 [[interwiki:Article|]]
12336 [[:interwiki:Article|]]
12337 [[interwiki:Bar:Article|]]
12338 [[:interwiki:Bar:Article|]]
12339 !! html/php
12340 [[interwiki:Article|Article]]
12341 [[:interwiki:Article|Article]]
12342 [[interwiki:Bar:Article|Bar:Article]]
12343 [[:interwiki:Bar:Article|Bar:Article]]
12344 !! end
12345
12346 !! test
12347 pre-save transform: context links ("pipe trick") with parens in title
12348 !! options
12349 pst title=[[Somearticle (context)]]
12350 !! wikitext
12351 [[|Article]]
12352 !! html/php
12353 [[Article (context)|Article]]
12354 !! end
12355
12356 !! test
12357 pre-save transform: context links ("pipe trick") with comma in title
12358 !! options
12359 pst title=[[Someplace, Somewhere]]
12360 !! wikitext
12361 [[|Otherplace]]
12362 [[Otherplace, Elsewhere|]]
12363 [[Otherplace, Elsewhere, Anywhere|]]
12364 !! html/php
12365 [[Otherplace, Somewhere|Otherplace]]
12366 [[Otherplace, Elsewhere|Otherplace]]
12367 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12368 !! end
12369
12370 !! test
12371 pre-save transform: context links ("pipe trick") with parens and comma
12372 !! options
12373 pst title=[[Someplace (IGNORED), Somewhere]]
12374 !! wikitext
12375 [[|Otherplace]]
12376 [[Otherplace (place), Elsewhere|]]
12377 !! html/php
12378 [[Otherplace, Somewhere|Otherplace]]
12379 [[Otherplace (place), Elsewhere|Otherplace]]
12380 !! end
12381
12382 !! test
12383 pre-save transform: context links ("pipe trick") with comma and parens
12384 !! options
12385 pst title=[[Who, me? (context)]]
12386 !! wikitext
12387 [[|Yes, you.]]
12388 [[Me, Myself, and I (1937 song)|]]
12389 !! html/php
12390 [[Yes, you. (context)|Yes, you.]]
12391 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12392 !! end
12393
12394 !! test
12395 pre-save transform: context links ("pipe trick") with namespace
12396 !! options
12397 pst title=[[Ns:Somearticle]]
12398 !! wikitext
12399 [[|Article]]
12400 !! html/php
12401 [[Ns:Article|Article]]
12402 !! end
12403
12404 !! test
12405 pre-save transform: context links ("pipe trick") with namespace and parens
12406 !! options
12407 pst title=[[Ns:Somearticle (context)]]
12408 !! wikitext
12409 [[|Article]]
12410 !! html/php
12411 [[Ns:Article (context)|Article]]
12412 !! end
12413
12414 !! test
12415 pre-save transform: context links ("pipe trick") with namespace and comma
12416 !! options
12417 pst title=[[Ns:Somearticle, Context, Whatever]]
12418 !! wikitext
12419 [[|Article]]
12420 !! html/php
12421 [[Ns:Article, Context, Whatever|Article]]
12422 !! end
12423
12424 !! test
12425 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12426 !! options
12427 pst title=[[Ns:Somearticle, Context (context)]]
12428 !! wikitext
12429 [[|Article]]
12430 !! html/php
12431 [[Ns:Article (context)|Article]]
12432 !! end
12433
12434 !! test
12435 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12436 !! options
12437 pst title=[[Ns:Somearticle (IGNORED), Context]]
12438 !! wikitext
12439 [[|Article]]
12440 !! html/php
12441 [[Ns:Article, Context|Article]]
12442 !! end
12443
12444 !! test
12445 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12446 !! options
12447 pst
12448 !! wikitext
12449 [[Article(context)|]]
12450 [[Bar:Article(context)|]]
12451 [[:Bar:Article(context)|]]
12452 [[|Article(context)]]
12453 [[Bar:X(Y)Z|]]
12454 [[:Bar:X(Y)Z|]]
12455 !! html/php
12456 [[Article(context)|Article]]
12457 [[Bar:Article(context)|Article]]
12458 [[:Bar:Article(context)|Article]]
12459 [[Article(context)]]
12460 [[Bar:X(Y)Z|X(Y)Z]]
12461 [[:Bar:X(Y)Z|X(Y)Z]]
12462 !! end
12463
12464 !! test
12465 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12466 !! options
12467 pst
12468 !! wikitext
12469 [[Article (context)|]]
12470 [[Bar:Article (context)|]]
12471 [[:Bar:Article (context)|]]
12472 [[|Article (context)]]
12473 [[Bar:X (Y) Z|]]
12474 [[:Bar:X (Y) Z|]]
12475 !! html/php
12476 [[Article (context)|Article]]
12477 [[Bar:Article (context)|Article]]
12478 [[:Bar:Article (context)|Article]]
12479 [[Article (context)]]
12480 [[Bar:X (Y) Z|X (Y) Z]]
12481 [[:Bar:X (Y) Z|X (Y) Z]]
12482 !! end
12483
12484 !! test
12485 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12486 !! options
12487 pst
12488 !! wikitext
12489 [[Article(context)|]]
12490 [[Bar:Article(context)|]]
12491 [[:Bar:Article(context)|]]
12492 [[|Article(context)]]
12493 [[Bar:X(Y)Z|]]
12494 [[:Bar:X(Y)Z|]]
12495 !! html/php
12496 [[Article(context)|Article]]
12497 [[Bar:Article(context)|Article]]
12498 [[:Bar:Article(context)|Article]]
12499 [[Article(context)]]
12500 [[Bar:X(Y)Z|X(Y)Z]]
12501 [[:Bar:X(Y)Z|X(Y)Z]]
12502 !! end
12503
12504 !! test
12505 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12506 !! options
12507 pst
12508 !! wikitext
12509 [[Article (context), context|]]
12510 [[Article (context),context|]]
12511 [[Bar:Article (context), context|]]
12512 [[Bar:Article (context),context|]]
12513 [[:Bar:Article (context), context|]]
12514 [[:Bar:Article (context),context|]]
12515 !! html/php
12516 [[Article (context), context|Article]]
12517 [[Article (context),context|Article]]
12518 [[Bar:Article (context), context|Article]]
12519 [[Bar:Article (context),context|Article]]
12520 [[:Bar:Article (context), context|Article]]
12521 [[:Bar:Article (context),context|Article]]
12522 !! end
12523
12524 !! test
12525 pre-save transform: trim trailing empty lines
12526 !! options
12527 pst
12528 !! wikitext
12529 Empty lines are trimmed
12530
12531
12532
12533
12534 !! html/php
12535 Empty lines are trimmed
12536 !! end
12537
12538 !! test
12539 pre-save transform: Signature expansion
12540 !! options
12541 pst
12542 !! wikitext
12543 * ~~~
12544 * <noinclude>~~~</noinclude>
12545 * <includeonly>~~~</includeonly>
12546 * <onlyinclude>~~~</onlyinclude>
12547 !! html/php
12548 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12549 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12550 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12551 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12552 !! end
12553
12554
12555 !! test
12556 pre-save transform: Signature expansion in nowiki tags (bug 93)
12557 !! options
12558 pst disabled
12559 !! wikitext
12560 Shall not expand:
12561
12562 <nowiki>~~~~</nowiki>
12563
12564 <includeonly><nowiki>~~~~</nowiki></includeonly>
12565
12566 <noinclude><nowiki>~~~~</nowiki></noinclude>
12567
12568 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12569
12570 {{subst:Foo}} shall be converted to FOO
12571
12572 As well as inside noinclude/onlyinclude
12573 <noinclude>{{subst:Foo}}</noinclude>
12574 <onlyinclude>{{subst:Foo}}</onlyinclude>
12575
12576 But not inside includeonly
12577 <includeonly>{{subst:Foo}}</includeonly>
12578 !! html/php
12579 Shall not expand:
12580
12581 <nowiki>~~~~</nowiki>
12582
12583 <includeonly><nowiki>~~~~</nowiki></includeonly>
12584
12585 <noinclude><nowiki>~~~~</nowiki></noinclude>
12586
12587 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12588
12589 FOO shall be converted to FOO
12590
12591 As well as inside noinclude/onlyinclude
12592 <noinclude>FOO</noinclude>
12593 <onlyinclude>FOO</onlyinclude>
12594
12595 But not inside includeonly
12596 <includeonly>{{subst:Foo}}</includeonly>
12597 !! end
12598
12599 !! test
12600 Parsoid: Recognize nowiki with trailing space in tags
12601 !! options
12602 parsoid=wt2html
12603 !! wikitext
12604 <nowiki ><div>[[foo]]</nowiki >
12605
12606 a<nowiki / >b
12607
12608 c<nowiki />d
12609
12610 e<nowiki/ >f
12611 !! html
12612 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12613 <p>ab</p>
12614 <p>cd</p>
12615 <p>ef</p>
12616 !! end
12617
12618 !! test
12619 Parsoid: Recognize nowiki with odd capitalization
12620 !! options
12621 parsoid=wt2html
12622 !! wikitext
12623 <noWikI ><div>[[foo]]</Nowiki >
12624 !! html
12625 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12626 !! end
12627
12628
12629 !! test
12630 Parsoid: Escape nowiki with trailing space in tags
12631 !! options
12632 parsoid=html2wt
12633 !! html/parsoid
12634 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12635 <p>a&lt;nowiki /&gt;b</p>
12636 <p>c&lt;nowiki/ &gt;d</p>
12637 !! wikitext
12638 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12639
12640 a&lt;nowiki /&gt;b
12641
12642 c&lt;nowiki/ &gt;d
12643 !! end
12644
12645 !! test
12646 Parsoid: Escape weird noWikI capitalizations
12647 !! options
12648 parsoid=html2wt
12649 !! html/parsoid
12650 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
12651 !! wikitext
12652 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
12653 !! end
12654
12655 ###
12656 ### Message transform tests
12657 ###
12658 !! test
12659 message transform: magic variables
12660 !! options
12661 msg
12662 !! wikitext
12663 {{SITENAME}}
12664 !! html
12665 MediaWiki
12666 !! end
12667
12668 !! test
12669 message transform: should not transform wiki markup
12670 !! options
12671 msg
12672 !! wikitext
12673 ''test''
12674 !! html
12675 ''test''
12676 !! end
12677
12678 !! test
12679 message transform: <noinclude> in transcluded template (bug 4926)
12680 !! options
12681 msg
12682 !! wikitext
12683 {{Includes}}
12684 !! html
12685 Foobar
12686 !! end
12687
12688 !! test
12689 message transform: <onlyinclude> in transcluded template (bug 4926)
12690 !! options
12691 msg
12692 !! wikitext
12693 {{Includes2}}
12694 !! html
12695 Foo
12696 !! end
12697
12698 !! test
12699 {{#special:}} page name, known
12700 !! options
12701 msg
12702 !! wikitext
12703 {{#special:Recentchanges}}
12704 !! html
12705 Special:RecentChanges
12706 !! end
12707
12708 !! test
12709 {{#special:}} page name with subpage, known
12710 !! options
12711 msg
12712 !! wikitext
12713 {{#special:Recentchanges/param}}
12714 !! html
12715 Special:RecentChanges/param
12716 !! end
12717
12718 !! test
12719 {{#special:}} page name, unknown
12720 !! options
12721 msg
12722 !! wikitext
12723 {{#special:foobar nonexistent}}
12724 !! html
12725 Special:Foobar nonexistent
12726 !! end
12727
12728 !! test
12729 {{#speciale:}} page name, known
12730 !! options
12731 msg
12732 !! wikitext
12733 {{#speciale:Recentchanges}}
12734 !! html
12735 Special:RecentChanges
12736 !! end
12737
12738 !! test
12739 {{#speciale:}} page name with subpage, known
12740 !! options
12741 msg
12742 !! wikitext
12743 {{#speciale:Recentchanges/param}}
12744 !! html
12745 Special:RecentChanges/param
12746 !! end
12747
12748 !! test
12749 {{#speciale:}} page name, unknown
12750 !! options
12751 msg
12752 !! wikitext
12753 {{#speciale:foobar nonexistent}}
12754 !! html
12755 Special:Foobar_nonexistent
12756 !! end
12757
12758 ###
12759 ### Images
12760 ###
12761 ### For Parsoid-specific tests, see
12762 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12763
12764 !! test
12765 Simple image
12766 !! options
12767 parsoid=wt2html,wt2wt,html2html
12768 !! wikitext
12769 [[Image:foobar.jpg]]
12770 !! html/php
12771 <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>
12772 </p>
12773 !! html/parsoid
12774 <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>
12775 !! end
12776
12777 !! test
12778 Simple image (using File: namespace, now canonical)
12779 !! wikitext
12780 [[File:Foobar.jpg]]
12781 !! html/php
12782 <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>
12783 </p>
12784 !! html/parsoid
12785 <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>
12786 !! end
12787
12788 !! test
12789 Right-aligned image
12790 !! wikitext
12791 [[File:Foobar.jpg|right]]
12792 !! html/php
12793 <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>
12794
12795 !! html/parsoid
12796 <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>
12797 !! end
12798
12799 !! test
12800 Image with caption
12801 !! wikitext
12802 [[File:Foobar.jpg|right|Caption text]]
12803 !! html/php
12804 <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>
12805
12806 !! html/parsoid
12807 <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>
12808 !! end
12809
12810 !! test
12811 Image with caption, bug 53312 #1
12812 !! wikitext
12813 [[File:Foobar.jpg|right|Caption page stuff]]
12814 !! html/php
12815 <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>
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><figcaption>Caption page stuff</figcaption></figure>
12819 !! end
12820
12821 !! test
12822 Image with caption, bug 53312 #2
12823 !! wikitext
12824 [[File:Foobar.jpg|right|Caption page=]]
12825 !! html/php
12826 <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>
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 page=</figcaption></figure>
12830 !! end
12831
12832 !! test
12833 Image with caption, bug 53312 #3
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 Allow empty links in image captions (Bug 60753)
12845 !! options
12846 thumbsize=220
12847 !! wikitext
12848 [[File:Foobar.jpg|thumb|Caption [[Link1]]
12849 [[]]
12850 [[Link2]]
12851 ]]
12852 !! html/php
12853 <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>
12854
12855 !! html/parsoid
12856 <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>
12857 [[]]
12858 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
12859 </figcaption></figure>
12860 !! end
12861
12862 !! test
12863 Titles in unlinked images (T23454)
12864 !! wikitext
12865 [[File:Foobar.jpg|link=|stuff]]
12866 !! html/php
12867 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
12868 </p>
12869 !! end
12870
12871 !! test
12872 Link with empty target
12873 !! wikitext
12874 [[]]
12875 !! html
12876 <p>[[]]
12877 </p>
12878 !! end
12879
12880 !! test
12881 Image with link trail
12882 !! wikitext
12883 Linktrails should not work for images: [[File:Foobar.jpg]]s
12884 !! html/php
12885 <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
12886 </p>
12887 !! html/parsoid
12888 <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>
12889 !! end
12890
12891 !! test
12892 Image with empty attribute
12893 !! options
12894 parsoid=wt2html,wt2wt,html2html
12895 !! wikitext
12896 [[File:Foobar.jpg|right||Caption text]]
12897 !! html/php
12898 <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>
12899
12900 !! html/parsoid
12901 <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>
12902 !! end
12903
12904 !! test
12905 1. Block image with individual attributes from templates
12906 !! wikitext
12907 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
12908 !! html/php
12909 <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>
12910
12911 !! html/parsoid
12912 <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>
12913 !! end
12914
12915 !! test
12916 2. Block Image with individual attributes from templates
12917 !! wikitext
12918 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
12919 !! html/php
12920 <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>
12921
12922 !! html/parsoid
12923 <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>
12924 !! end
12925
12926 !! test
12927 3. Inline image with individual attributes from templates
12928 !! wikitext
12929 [[File:Foobar.jpg|{{echo|50px}}]]
12930 !! html/php
12931 <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>
12932 </p>
12933 !! html/parsoid
12934 <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>
12935 !! end
12936
12937 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
12938 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
12939 !! test
12940 Image with multiple attributes from the same template
12941 !! wikitext
12942 [[File:Foobar.jpg|{{image_attribs}}]]
12943 !! html/php
12944 <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>
12945
12946 !! html/parsoid
12947 <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>
12948 !! end
12949
12950 !! test
12951 Image with link tails
12952 !! options
12953 thumbsize=220
12954 !! wikitext
12955 123[[File:Foobar.jpg]]456
12956 123[[File:Foobar.jpg|right]]456
12957 123[[File:Foobar.jpg|thumb]]456
12958 !! html/php
12959 <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
12960 </p>
12961 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
12962 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
12963
12964 !! html/php+tidy
12965 <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>
12966 <p>123</p>
12967 <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>
12968 <p>456 123</p>
12969 <div class="thumb tright">
12970 <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>
12971 <div class="thumbcaption">
12972 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
12973 </div>
12974 </div>
12975 </div>
12976 <p>456</p>
12977 !! html/parsoid
12978 <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>
12979 <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>
12980 <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>
12981 !! end
12982
12983 !! test
12984 Image with multiple captions -- only last one is accepted
12985 !! wikitext
12986 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
12987 !! html/php
12988 <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>
12989
12990 !! html/parsoid
12991 <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>
12992 !! end
12993
12994 !! test
12995 Image with multiple widths -- use last
12996 !! wikitext
12997 [[File:Foobar.jpg|200px|300px|caption]]
12998 !! html/php
12999 <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>
13000 </p>
13001 !! html/parsoid
13002 <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>
13003 !! end
13004
13005 !! test
13006 Image with multiple alignments -- use first (bug 48664)
13007 !! options
13008 thumbsize=220
13009 !! wikitext
13010 [[File:Foobar.jpg|thumb|left|right|center|caption]]
13011
13012 [[File:Foobar.jpg|middle|text-top|caption]]
13013 !! html/php
13014 <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>
13015 <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>
13016 </p>
13017 !! html/parsoid
13018 <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>
13019 <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>
13020 !! end
13021
13022 !! test
13023 Image with width attribute at different positions
13024 !! wikitext
13025 [[File:Foobar.jpg|200px|right|Caption]]
13026 [[File:Foobar.jpg|right|200px|Caption]]
13027 [[File:Foobar.jpg|right|Caption|200px]]
13028 !! html/php
13029 <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>
13030 <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>
13031 <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>
13032
13033 !! html/parsoid
13034 <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>
13035 <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>
13036 <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>
13037 !! end
13038
13039 # a sad bit of backward-compatibility
13040 !! test
13041 Image with size specified with pxpx (bug 13500, 51628)
13042 !! options
13043 parsoid=wt2html,wt2wt,html2html
13044 !! wikitext
13045 [[File:Foobar.jpg|20pxpx]]
13046 [[File:Foobar.jpg|200x20pxpx]]
13047 !! html/php
13048 <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>
13049 <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>
13050 </p>
13051 !! html/parsoid
13052 <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>
13053 !! end
13054
13055 !! test
13056 Image with link parameter, wiki target
13057 !! wikitext
13058 [[File:Foobar.jpg|link=Main Page]]
13059 !! html/php
13060 <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>
13061 </p>
13062 !! html/parsoid
13063 <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>
13064 !! end
13065
13066 # parsoid bug 49293 (part 1)
13067 !! test
13068 Image with link parameter, URL target
13069 !! wikitext
13070 [[File:Foobar.jpg|link=http://example.com/]]
13071 !! html/php
13072 <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>
13073 </p>
13074 !! html/parsoid
13075 <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>
13076 !! end
13077
13078 # parsoid bug 49293 (part 2)
13079 !! test
13080 Image with link parameter, protocol-less URL target
13081 !! wikitext
13082 [[File:Foobar.jpg|link=//example.com/]]
13083 !! html/php
13084 <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>
13085 </p>
13086 !! html/parsoid
13087 <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>
13088 !! end
13089
13090 !! test
13091 Escaping non-block captions (T107435)
13092 !! options
13093 parsoid={
13094 "modes": ["wt2wt"],
13095 "changes": [
13096 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13097 ]
13098 }
13099 !! wikitext
13100 [[Image:Foobar.jpg|caption]]
13101 !! wikitext/edited
13102 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13103 !! end
13104
13105 # wgExternalLinkTarget not supported by Parsoid
13106 !! test
13107 Image with link parameter, wgExternalLinkTarget
13108 !! wikitext
13109 [[Image:foobar.jpg|link=http://example.com/]]
13110 !! config
13111 wgExternalLinkTarget='foobar'
13112 !! html/php
13113 <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>
13114 </p>
13115 !! end
13116
13117 !! test
13118 Image with link parameter, wgNoFollowLinks set to false
13119 !! wikitext
13120 [[Image:foobar.jpg|link=http://example.com/]]
13121 !! config
13122 wgNoFollowLinks=false
13123 !! html
13124 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13125 </p>
13126 !! end
13127
13128 !! test
13129 Image with link parameter, wgNoFollowDomainExceptions
13130 !! wikitext
13131 [[Image:foobar.jpg|link=http://example.com/]]
13132 !! config
13133 wgNoFollowDomainExceptions='example.com'
13134 !! html
13135 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13136 </p>
13137 !! end
13138
13139 # wgExternalLinkTarget not supported by Parsoid
13140 !! test
13141 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13142 !! wikitext
13143 [[Image:foobar.jpg|link=http://example.com/|Title]]
13144 !! config
13145 wgExternalLinkTarget='foobar'
13146 !! html/php
13147 <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>
13148 </p>
13149 !! end
13150
13151 !! test
13152 Image with empty link parameter
13153 !! wikitext
13154 [[File:Foobar.jpg|link=]]
13155 !! html/php
13156 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13157 </p>
13158 !! html/parsoid
13159 <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>
13160 !! end
13161
13162 !! test
13163 Image with link parameter (wiki target) and unnamed parameter
13164 !! wikitext
13165 [[File:Foobar.jpg|link=Main_Page|Title]]
13166 !! html/php
13167 <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>
13168 </p>
13169 !! html/parsoid
13170 <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>
13171 !! end
13172
13173 !! test
13174 Image with link parameter (URL target) and unnamed parameter
13175 !! wikitext
13176 [[File:Foobar.jpg|link=http://example.com/|Title]]
13177 !! html/php
13178 <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>
13179 </p>
13180 !! html/parsoid
13181 <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>
13182 !! end
13183
13184 !! test
13185 Thumbnail image with link parameter
13186 !! options
13187 thumbsize=220
13188 parsoid=wt2html,wt2wt,html2html
13189 !! wikitext
13190 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13191 !! html/php
13192 <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>
13193
13194 !! html/parsoid
13195 <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>
13196 !! end
13197
13198 !! test
13199 Manually-specified thumbnail image
13200 !! options
13201 thumbsize=220
13202 !! wikitext
13203 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13204 !! html/php
13205 <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>
13206
13207 !! html/parsoid
13208 <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>
13209 !! end
13210
13211 !! test
13212 Manually-specified thumbnail image with explicit link to wiki page
13213 !! options
13214 thumbsize=220
13215 parsoid=wt2html,wt2wt,html2html
13216 !! wikitext
13217 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13218 !! html/php
13219 <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>
13220
13221 !! html/parsoid
13222 <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>
13223 !! end
13224
13225 !! test
13226 Manually-specified thumbnail image with explicit link to url
13227 !! options
13228 thumbsize=220
13229 parsoid=wt2html,wt2wt,html2html
13230 !! wikitext
13231 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13232 !! html/php
13233 <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>
13234
13235 !! html/parsoid
13236 <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>
13237 !! end
13238
13239 !! test
13240 Manually-specified thumbnail image with explicit no link
13241 !! options
13242 thumbsize=220
13243 parsoid=wt2html,wt2wt,html2html
13244 !! wikitext
13245 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13246 !! html/php
13247 <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>
13248
13249 !! html/parsoid
13250 <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>
13251 !! end
13252
13253 !! test
13254 Manually-specified thumbnail image with explicit link and alt text
13255 !! options
13256 thumbsize=220
13257 parsoid=wt2html,wt2wt,html2html
13258 !! wikitext
13259 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13260 !! html/php
13261 <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>
13262
13263 !! html/parsoid
13264 <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>
13265 !! end
13266
13267 !! test
13268 Image with frame and link
13269 !! options
13270 parsoid=wt2html,wt2wt,html2html
13271 !! wikitext
13272 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13273 !! html/php
13274 <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>
13275
13276 !! html/parsoid
13277 <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>
13278 !! end
13279
13280 !! test
13281 Image with frame and link and explicit alt
13282 !! options
13283 parsoid=wt2html,wt2wt,html2html
13284 !! wikitext
13285 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13286 !! html/php
13287 <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>
13288
13289 !! html/parsoid
13290 <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>
13291 !! end
13292
13293 !! test
13294 Image with wiki markup in implicit alt
13295 !! wikitext
13296 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13297
13298 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13299 !! html/php
13300 <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>
13301 </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>
13302 </p>
13303 !! html/parsoid
13304 <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>
13305 <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>
13306 !! end
13307
13308 !! test
13309 Alt image option should handle most kinds of wikitext without barfing
13310 !! wikitext
13311 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13312 !! html/php
13313 <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>
13314
13315 !! html/parsoid
13316 <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>
13317 !! end
13318
13319 ###################
13320 # Conflicting image format options.
13321 # First option specified should 'win'.
13322 # All three cases in each test should be identical.
13323
13324 !! test
13325 Image with 'frameless' first.
13326 !! options
13327 parsoid=wt2html,wt2wt,html2html
13328 !! wikitext
13329 [[File:Foobar.jpg|frameless|caption]]
13330
13331 [[File:Foobar.jpg|frameless|frame|caption]]
13332
13333 [[File:Foobar.jpg|frameless|thumb|caption]]
13334 !! html/php
13335 <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>
13336 </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>
13337 </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>
13338 </p>
13339 !! html/parsoid
13340 <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>
13341 <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>
13342 <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>
13343 !! end
13344
13345 !! test
13346 Image with 'frame' first.
13347 !! options
13348 parsoid=wt2html,wt2wt,html2html
13349 !! wikitext
13350 [[File:Foobar.jpg|frame|caption]]
13351 [[File:Foobar.jpg|frame|frameless|caption]]
13352 [[File:Foobar.jpg|frame|thumb|caption]]
13353 !! html/php
13354 <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>
13355 <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>
13356 <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>
13357
13358 !! html/parsoid
13359 <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>
13360 <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>
13361 <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>
13362 !! end
13363
13364 !! test
13365 Image with 'thumb' first.
13366 !! options
13367 parsoid=wt2html,wt2wt,html2html
13368 !! wikitext
13369 [[File:Foobar.jpg|thumb|caption]]
13370 [[File:Foobar.jpg|thumb|frameless|caption]]
13371 [[File:Foobar.jpg|thumb|frame|caption]]
13372 !! html/php
13373 <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>
13374 <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>
13375 <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>
13376
13377 !! html/parsoid
13378 <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>
13379 <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>
13380 <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>
13381 !! end
13382
13383 ###################
13384 # Image sizing.
13385 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13386 # and https://phabricator.wikimedia.org/T64258
13387 # Foobar has actual size of 1941x220
13388 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13389 # a scalable format.
13390 # 2. Framed images always ignore size options; always render at default size.
13391 # 3. "Unspecified format" and border are the only types which can be
13392 # enlarged.
13393
13394 !! test
13395 Image: "unspecified format" and border enlarge
13396 !! options
13397 parsoid=wt2html,wt2wt,html2html
13398 !! wikitext
13399 [[File:Foobar.jpg|2000px]]
13400
13401 [[File:Foobar.jpg|border|2000px]]
13402 !! html/php
13403 <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>
13404 </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>
13405 </p>
13406 !! html/parsoid
13407 <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>
13408 <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>
13409 !! end
13410
13411 !! test
13412 Image: "unspecified format" and border reduce
13413 !! options
13414 parsoid=wt2html,wt2wt,html2html
13415 !! wikitext
13416 [[File:Foobar.jpg|1000px]]
13417
13418 [[File:Foobar.jpg|border|1000px]]
13419 !! html/php
13420 <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>
13421 </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>
13422 </p>
13423 !! html/parsoid
13424 <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>
13425 <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>
13426 !! end
13427
13428 !! test
13429 Image: thumbs reduce
13430 !! options
13431 parsoid=wt2html,wt2wt,html2html
13432 !! wikitext
13433 [[File:Foobar.jpg|thumb|50px]]
13434 !! html/php
13435 <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>
13436
13437 !! html/parsoid
13438 <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>
13439 !! end
13440
13441 !! test
13442 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13443 !! options
13444 parsoid=wt2html,wt2wt,html2html
13445 !! wikitext
13446 [[File:Foobar.jpg|thumb|2000px]]
13447
13448 [[File:Foobar.svg|thumb|2000px]]
13449 !! html/php
13450 <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>
13451 <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>
13452
13453 !! html/parsoid
13454 <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>
13455 <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>
13456 !! end
13457
13458 !! test
13459 Image: frameless can reduce in size
13460 !! options
13461 parsoid=wt2html,wt2wt,html2html
13462 !! wikitext
13463 [[File:Foobar.jpg|frameless|50px]]
13464 !! html/php
13465 <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>
13466 </p>
13467 !! html/parsoid
13468 <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>
13469 !! end
13470
13471 !! test
13472 Image: bitmap frameless can't be enlarged past original size, but vector can
13473 !! options
13474 parsoid=wt2html,wt2wt,html2html
13475 !! wikitext
13476 [[File:Foobar.jpg|frameless|2000px]]
13477
13478 [[File:Foobar.svg|frameless|2000px]]
13479 !! html/php
13480 <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>
13481 </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>
13482 </p>
13483 !! html/parsoid
13484 <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>
13485 <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>
13486 !! end
13487
13488 !! test
13489 Image: framed images are always unscaled.
13490 !! options
13491 parsoid=wt2html,wt2wt,html2html
13492 !! wikitext
13493 [[File:Foobar.jpg|frame]]
13494
13495 [[File:Foobar.jpg|frame|50px]]
13496
13497 [[File:Foobar.jpg|frame|50x50px]]
13498
13499 [[File:Foobar.jpg|frame|2000px]]
13500 !! html/php
13501 <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>
13502 <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>
13503 <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>
13504 <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>
13505
13506 !! html/parsoid
13507 <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>
13508 <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>
13509 <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>
13510 <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>
13511 !! end
13512
13513 ###################
13514
13515 !! test
13516 Link to image page- image page normally doesn't exists, hence edit link
13517 Add test with existing image page
13518 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13519 !! wikitext
13520 [[:Image:test]]
13521 !! html
13522 <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>
13523 </p>
13524 !! end
13525
13526 !! test
13527 bug 18784 Link to non-existent image page with caption should use caption as link text
13528 !! wikitext
13529 [[:Image:test|caption]]
13530 !! html
13531 <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>
13532 </p>
13533 !! end
13534
13535 !! test
13536 Frameless image caption with a free URL
13537 !! wikitext
13538 [[File:Foobar.jpg|http://example.com]]
13539 !! html/php
13540 <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>
13541 </p>
13542 !! html/parsoid
13543 <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>
13544 !! end
13545
13546 !! test
13547 Thumbnail image caption with a free URL
13548 !! options
13549 thumbsize=220
13550 !! wikitext
13551 [[File:Foobar.jpg|thumb|http://example.com]]
13552 !! html/php
13553 <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>
13554
13555 !! html/parsoid
13556 <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>
13557 !! end
13558
13559 !! test
13560 Thumbnail image caption with a free URL and explicit alt
13561 !! options
13562 thumbsize=220
13563 parsoid=wt2html,wt2wt,html2html
13564 !! wikitext
13565 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13566 !! html/php
13567 <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>
13568
13569 !! html/parsoid
13570 <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>
13571 !! end
13572
13573 !! test
13574 SVG thumbnails with no language set
13575 !! options
13576 !! wikitext
13577 [[File:Foobar.svg|thumb|caption]]
13578 !! html/php
13579 <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>
13580
13581 !! html/parsoid
13582 <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>
13583 !! end
13584
13585 !! test
13586 SVG thumbnails with language de
13587 !! options
13588 parsoid=wt2html,wt2wt,html2html
13589 !! wikitext
13590 [[File:Foobar.svg|thumb|caption|lang=de]]
13591 !! html/php
13592 <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>
13593
13594 !! html/parsoid
13595 <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>
13596 !! end
13597
13598 !! test
13599 SVG thumbnails with invalid language code
13600 !! options
13601 parsoid=wt2html,wt2wt,html2html
13602 !! wikitext
13603 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
13604 !! html/php
13605 <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>
13606
13607 !! html/parsoid
13608 <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>
13609 !! end
13610
13611 !! test
13612 BUG 1887: A ISBN with a thumbnail
13613 !! wikitext
13614 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
13615 !! html/php
13616 <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>
13617
13618 !! html/parsoid
13619 <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>
13620 !! end
13621
13622 !! test
13623 BUG 1887: A RFC with a thumbnail
13624 !! wikitext
13625 [[File:Foobar.jpg|thumb|This is RFC 12354]]
13626 !! html/php
13627 <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>
13628
13629 !! html/parsoid
13630 <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>
13631 !! end
13632
13633 !! test
13634 BUG 1887: A mailto link with a thumbnail
13635 !! wikitext
13636 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
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>Please <a rel="nofollow" class="external free" href="mailto:nobody@example.com">mailto:nobody@example.com</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>Please <a rel="mw:ExtLink" href="mailto:nobody@example.com">mailto:nobody@example.com</a></figcaption></figure>
13642 !! end
13643
13644 # Pending resolution to bug 368
13645 !! test
13646 BUG 648: Frameless image caption with a link
13647 !! wikitext
13648 [[File:Foobar.jpg|text with a [[link]] in it]]
13649 !! html/php
13650 <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>
13651 </p>
13652 !! html/parsoid
13653 <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>
13654 !! end
13655
13656 !! test
13657 BUG 648: Frameless image caption with a link (suffix)
13658 !! wikitext
13659 [[File:Foobar.jpg|text with a [[link]]foo in it]]
13660 !! html/php
13661 <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>
13662 </p>
13663 !! html/parsoid
13664 <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>
13665 !! end
13666
13667 !! test
13668 BUG 648: Frameless image caption with an interwiki link
13669 !! wikitext
13670 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
13671 !! html/php
13672 <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>
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: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>
13676 !! end
13677
13678 !! test
13679 BUG 648: Frameless image caption with a piped interwiki link
13680 !! wikitext
13681 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
13682 !! html/php
13683 <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>
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: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>
13687 !! end
13688
13689 !! test
13690 T107474: Frameless image caption with <nowiki>
13691 !! wikitext
13692 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
13693 !! html/parsoid
13694 <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>
13695 !! end
13696
13697 !! test
13698 Escape HTML special chars in image alt text
13699 !! wikitext
13700 [[File:Foobar.jpg|& < > "]]
13701 !! html/php
13702 <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>
13703 </p>
13704 !! html/parsoid
13705 <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>
13706 !! end
13707
13708 !! test
13709 BUG 499: Alt text should have &#1234;, not &amp;1234;
13710 !! wikitext
13711 [[File:Foobar.jpg|&#9792;]]
13712 !! html/php
13713 <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>
13714 </p>
13715 !! html/parsoid
13716 <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>
13717 !! end
13718
13719 !! test
13720 Broken image caption with link
13721 !! options
13722 parsoid=wt2html,wt2wt,html2html
13723 !! wikitext
13724 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
13725 !! html/php
13726 <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.
13727 </p>
13728 !! html/parsoid
13729 <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>
13730 !! end
13731
13732 !! test
13733 Image caption containing another image
13734 !! wikitext
13735 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
13736 !! html/php
13737 <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>
13738
13739 !! html/parsoid
13740 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>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>
13741 !! end
13742
13743 !! test
13744 Image: caption containing a newline
13745 !! wikitext
13746 [[File:Foobar.jpg|This
13747 *is some text]]
13748 !! html/php
13749 <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>
13750 </p>
13751 !! html/parsoid
13752 <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>
13753 !!end
13754
13755 !!test
13756 Image: caption containing leading space
13757 (The leading space should not trigger nowiki escaping in wt2wt mode)
13758 !! wikitext
13759 [[File:Foobar.jpg|thumb| bar]]
13760 !! html/php
13761 <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>
13762
13763 !! html/parsoid
13764 <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>
13765 !!end
13766
13767 !! test
13768 Image: caption containing a table
13769 !! options
13770 parsoid=wt2html,wt2wt,html2html
13771 !! wikitext
13772 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
13773 {|
13774 ! Foo !! Bar
13775 |-
13776 | Foo1 || Bar1
13777 |}
13778 and some more text.]]
13779 !! html/php
13780 <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>
13781
13782 !! html/parsoid
13783 <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
13784 <table>
13785 <tbody>
13786 <tr><th>Foo </th><th>Bar</th></tr>
13787 <tr>
13788 <td>Foo1 </td>
13789 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
13790 !! end
13791
13792 !! test
13793 Bug 3090: External links other than http: in image captions
13794 !! wikitext
13795 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
13796 !! html/php
13797 <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>
13798
13799 !! html/parsoid
13800 <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>
13801 !! end
13802
13803 !! test
13804 Custom class
13805 !! options
13806 parsoid=wt2html,wt2wt,html2html
13807 !! wikitext
13808 [[Image:foobar.jpg|a|class=b]]
13809 !! html/php
13810 <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>
13811 </p>
13812 !! html/parsoid
13813 <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>
13814 !! end
13815
13816 !! test
13817 Localized image handling (1).
13818 !! options
13819 parsoid=wt2html,wt2wt,html2html
13820 language=es
13821 !! wikitext
13822 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
13823 !! html/php
13824 <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>
13825
13826 !! html/parsoid
13827 <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>
13828 !! end
13829
13830 !! test
13831 Localized image handling (2).
13832 !! options
13833 thumbsize=220
13834 parsoid=wt2html,wt2wt,html2html
13835 language=es
13836 !! wikitext
13837 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
13838 !! html/php
13839 <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>
13840
13841 !! html/parsoid
13842 <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>
13843 !! end
13844
13845 !! test
13846 "border", "frameless" and "class" attributes on an image.
13847 !! options
13848 thumbsize=220
13849 parsoid=wt2html,wt2wt,html2html
13850 !! wikitext
13851 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
13852 !! html/php
13853 <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>
13854 </p>
13855 !! html/parsoid
13856 <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>
13857 !! end
13858
13859 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
13860 !! test
13861 Invalid image attributes (bug 62500)
13862 !! options
13863 thumbsize=220
13864 parsoid=wt2html,wt2wt,html2html
13865 !! wikitext
13866 [[File:Foobar.jpg|thumb|float|left|caption]]
13867
13868 [[File:Foobar.jpg|thumb|righ|caption]]
13869
13870 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
13871 !! html/php
13872 <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>
13873 <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>
13874 <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>
13875
13876 !! html/parsoid
13877 <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>
13878 <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>
13879 <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>
13880 !! end
13881
13882 !! article
13883 File:Barfoo.jpg
13884 !! text
13885 #REDIRECT [[File:Barfoo.jpg]]
13886 !! endarticle
13887
13888 # FIXME: Parsoid should run this test -- but we'd need to teach the
13889 # mockAPI about the redirected Barfoo.jpg image.
13890 !! test
13891 Redirected image
13892 !! wikitext
13893 [[Image:Barfoo.jpg]]
13894 !! html/php
13895 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
13896 </p>
13897 !! end
13898
13899 !! test
13900 Missing image with uploads disabled
13901 !! options
13902 wgEnableUploads=0
13903 !! wikitext
13904 [[File:Foobaz.jpg]]
13905 !! html/php
13906 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
13907 </p>
13908 !! html/parsoid
13909 <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>
13910 !! end
13911
13912 # Parsoid-specific testing for images
13913 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13914 # Currently imperfect due to a flaw in the Parsoid testrunner
13915 # Work in progress
13916 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
13917 # image tests.
13918
13919 !! test
13920 Parsoid-specific image handling - simple image with size and middle alignment
13921 !! wikitext
13922 [[File:Foobar.jpg|middle|50px]]
13923 !! html/parsoid
13924 <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>
13925 !! end
13926
13927 !! test
13928 Parsoid-specific image handling - simple image with size, middle alignment,
13929 non-standard namespace alias
13930 !! options
13931 parsoid=wt2wt,wt2html,html2html
13932 !! wikitext
13933 [[Image:Foobar.jpg|middle|50px]]
13934 !! html/parsoid
13935 <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>
13936 !! end
13937
13938 !! test
13939 Parsoid-specific image handling - simple image with size and middle alignment
13940 (existing content)
13941 !! wikitext
13942 [[File:Foobar.jpg|50px|middle]]
13943 !! html/parsoid
13944 <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>
13945 !! end
13946
13947 !! test
13948 Parsoid-specific image handling - simple image with size and middle alignment
13949 and non-standard namespace name
13950 !! options
13951 parsoid=wt2html,wt2wt,html2html
13952 !! wikitext
13953 [[Image:Foobar.jpg|50px|middle]]
13954 !! html/parsoid
13955 <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>
13956 !! end
13957
13958 !! test
13959 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
13960 !! wikitext
13961 [[File:Foobar.jpg|500x10px|baseline|caption]]
13962 !! html/parsoid
13963 <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>
13964 !! end
13965
13966 !! test
13967 Parsoid-specific image handling - simple image with border and size spec
13968 !! wikitext
13969 [[File:Foobar.jpg|50px|border|caption]]
13970 !! html/parsoid
13971 <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>
13972 !! end
13973
13974 !! test
13975 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13976 !! wikitext
13977 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
13978 !! html/parsoid
13979 <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>
13980 !! end
13981
13982 !! test
13983 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13984 (existing content)
13985 !! wikitext
13986 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
13987 !! html/parsoid
13988 <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>
13989 !! end
13990
13991 !! test
13992 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
13993 !! wikitext
13994 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
13995 !! html/parsoid
13996 <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>
13997 !! end
13998
13999 !! test
14000 Parsoid-specific image handling - thumbnail with specific size, halign,
14001 valign, and caption (existing content)
14002 !! wikitext
14003 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
14004 !! html/parsoid
14005 <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>
14006 !! end
14007
14008 !! test
14009 Parsoid-specific image handling - framed image with specific size and caption
14010 (size is ignored)
14011 !! options
14012 parsoid=wt2html,wt2wt,html2html
14013 !! wikitext
14014 [[File:Foobar.jpg|frame|500x50px|caption]]
14015 !! html/parsoid
14016 <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>
14017 !! end
14018
14019 !! test
14020 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14021 (size is ignored)
14022 !! options
14023 parsoid=wt2html,wt2wt,html2html
14024 !! wikitext
14025 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14026 !! html/parsoid
14027 <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>
14028 !! end
14029
14030 !! test
14031 Parsoid-specific image handling - frameless image with specific size, border, and caption
14032 !! wikitext
14033 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14034 !! html/parsoid
14035 <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>
14036 !! end
14037
14038 !! test
14039 Parsoid-specific image handling - simple image with a formatted caption
14040 !! wikitext
14041 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14042 !! html/parsoid
14043 <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>
14044 !! end
14045
14046 !! test
14047 Parsoid-specific image handling - caption with a template in it
14048 !! wikitext
14049 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14050 !! html/parsoid
14051 <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>
14052 !! end
14053
14054 !! test
14055 Parsoid-specific image handling - caption with unbalanced tags in it
14056 !! options
14057 parsoid=wt2html,wt2wt,html2html
14058 !! wikitext
14059 foo
14060 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14061 bar
14062 !! html/parsoid
14063 <p>foo</p>
14064 <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>
14065 <p>bar</p>
14066 !! end
14067
14068 !! test
14069 Parsoid-specific image handling - empty caption (1)
14070 !! options
14071 parsoid=wt2html,wt2wt
14072 !! wikitext
14073 [[File:Foobar.jpg|thumb|]]
14074 !! html/parsoid
14075 <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>
14076 !! end
14077
14078 # empty captions don't get serialized unless we're in the "round trip" case
14079 !! test
14080 Parsoid-specific image handling - empty caption (2)
14081 !! options
14082 parsoid=html2wt
14083 !! html/parsoid
14084 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14085 <a href="./File:Foobar.jpg">
14086 <img resource="./File:Foobar.jpg"
14087 src="//example.com/images/3/3a/Foobar.jpg"
14088 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14089 height="25" width="220"/>
14090 </a>
14091 <figcaption></figcaption>
14092 </figure>
14093 !! wikitext
14094 [[File:Foobar.jpg|thumb]]
14095 !! end
14096
14097 !! test
14098 Parsoid-specific image handling - whitespace caption
14099 !! wikitext
14100 [[File:Foobar.jpg|thumb| ]]
14101 !! html/parsoid
14102 <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>
14103 !! end
14104
14105 !! test
14106 Parsoid-specific image handling - lang option
14107 !! wikitext
14108 foo
14109 [[File:Foobar.svg|lang=de|caption]]
14110 bar
14111 !! html/parsoid
14112 <p>foo
14113 <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>
14114 bar</p>
14115 !! end
14116
14117 ## Edge case bugs in Parsoid from T93580
14118 !! test
14119 T93580: 1. Templated <ref> inside block images
14120 !! wikitext
14121 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14122
14123 <references />
14124 !! html/parsoid
14125 <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>
14126
14127 <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>
14128 !! end
14129
14130 !! test
14131 T93580: 2. <ref> inside inline images
14132 !! wikitext
14133 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14134
14135 <references />
14136 !! html/parsoid
14137 <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>
14138
14139 <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>
14140 !! end
14141
14142 !! test
14143 T93580: 3. Templated <ref> inside inline images
14144 !! wikitext
14145 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14146
14147 <references />
14148 !! html/parsoid
14149 <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>
14150
14151 <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>
14152 !! end
14153
14154 ###
14155 ### Subpages
14156 ###
14157 !! article
14158 Subpage test/subpage
14159 !! text
14160 foo
14161 !! endarticle
14162
14163 !! test
14164 Subpage link
14165 !! options
14166 subpage title=[[Subpage test]]
14167 !! wikitext
14168 [[/subpage]]
14169 !! html
14170 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14171 </p>
14172 !! end
14173
14174 !! test
14175 Subpage noslash link
14176 !! options
14177 subpage title=[[Subpage test]]
14178 !! wikitext
14179 [[/subpage/]]
14180 !! html
14181 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14182 </p>
14183 !! end
14184
14185 !! article
14186 Subpage test/1/2/subpage
14187 !! text
14188 blah
14189 !! endarticle
14190
14191 !! test
14192 Relative subpage noslash link
14193 !! options
14194 parsoid=wt2wt,wt2html,html2html
14195 subpage title=[[Subpage test/1/2/3/4]]
14196 !! wikitext
14197 [[../../subpage/]]
14198
14199 [[../../subpage]]
14200 !! html/php
14201 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14202 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14203 </p>
14204 !! html/parsoid
14205 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14206 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14207 !! end
14208
14209 !! test
14210 Parsoid: dot-slash prefixed wikilinks
14211 !! wikitext
14212 [[./foo]]
14213
14214 [[././bar]]
14215
14216 [[././baz/]]
14217 !! html/php
14218 <p>[[./foo]]
14219 </p><p>[[././bar]]
14220 </p><p>[[././baz/]]
14221 </p>
14222 !! html/parsoid
14223 <p>[[./foo]]
14224 </p><p>[[././bar]]
14225 </p><p>[[././baz/]]
14226 </p>
14227 !! end
14228
14229 !! test
14230 Render invalid page names as plain text (bug 51090)
14231 !! wikitext
14232 [[./../foo|bar]]
14233 [[foo�|bar]]
14234 [[foo/.|bar]]
14235 [[foo/..|bar]]
14236 [[foo~~~bar]]
14237 [[foo>bar]]
14238 [[foo[bar]]
14239 [[.]]
14240 [[..]]
14241 [[foo././bar]]
14242
14243 [[{{echo|./../foo}}|bar]]
14244 [[{{echo|foo/.}}|bar]]
14245 [[{{echo|foo/..}}|bar]]
14246 [[{{echo|foo~~~~bar}}]]
14247 [[{{echo|foo>bar}}]]
14248 [[{{echo|foo././bar}}]]
14249 [[{{echo|foo{bar}}]]
14250 [[{{echo|foo}bar}}]]
14251 [[{{echo|foo[bar}}]]
14252 [[{{echo|foo]bar}}]]
14253 [[{{echo|foo<bar}}]]
14254 !!html/php
14255 <p>[[./../foo|bar]]
14256 [[foo�|bar]]
14257 [[foo/.|bar]]
14258 [[foo/..|bar]]
14259 [[foo~~~bar]]
14260 [[foo&gt;bar]]
14261 [[foo[bar]]
14262 [[.]]
14263 [[..]]
14264 [[foo././bar]]
14265 </p><p>[[./../foo|bar]]
14266 [[foo/.|bar]]
14267 [[foo/..|bar]]
14268 [[foo~~~~bar]]
14269 [[foo&gt;bar]]
14270 [[foo././bar]]
14271 [[foo{bar]]
14272 [[foo}bar]]
14273 [[foo[bar]]
14274 [[foo]bar]]
14275 [[foo&lt;bar]]
14276 </p>
14277 !!html/parsoid
14278 <p>[[./../foo|bar]]
14279 [[foo�|bar]]
14280 [[foo/.|bar]]
14281 [[foo/..|bar]]
14282 [[foo~~~bar]]
14283 [[foo>bar]]
14284 [[foo[bar]]
14285 [[.]]
14286 [[..]]
14287 [[foo././bar]]</p>
14288
14289 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14290 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14291 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14292 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14293 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14294 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14295 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14296 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14297 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14298 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14299 [[<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>
14300 !!end
14301
14302 !! test
14303 Disabled subpages
14304 !! wikitext
14305 [[/subpage]]
14306 !! html
14307 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14308 </p>
14309 !! end
14310
14311 !! test
14312 BUG 561: {{/Subpage}}
14313 !! options
14314 subpage title=[[Page]]
14315 !! wikitext
14316 {{/Subpage}}
14317 !! html
14318 <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>
14319 </p>
14320 !! end
14321
14322 ###
14323 ### Categories
14324 ###
14325 !! article
14326 Category:MediaWiki User's Guide
14327 !! text
14328 blah
14329 !! endarticle
14330
14331 !! test
14332 Link to category
14333 !! wikitext
14334 [[:Category:MediaWiki User's Guide]]
14335 !! html
14336 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14337 </p>
14338 !! end
14339
14340 !! test
14341 Simple category
14342 !! options
14343 cat
14344 !! wikitext
14345 [[Category:MediaWiki User's Guide]]
14346 !! html
14347 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14348 !! end
14349
14350 !! test
14351 PAGESINCATEGORY invalid title fatal (r33546 fix)
14352 !! wikitext
14353 {{PAGESINCATEGORY:<bogus>}}
14354 !! html
14355 <p>0
14356 </p>
14357 !! end
14358
14359 !! test
14360 Category with different sort key
14361 !! options
14362 cat
14363 !! wikitext
14364 [[Category:MediaWiki User's Guide|Foo]]
14365 !! html
14366 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14367 !! end
14368
14369 !! test
14370 Category with identical sort key
14371 !! options
14372 cat
14373 !! wikitext
14374 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14375 !! html
14376 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14377 !! end
14378
14379 !! test
14380 Category with empty sort key
14381 !! options
14382 cat
14383 pst
14384 !! wikitext
14385 [[Category:MediaWiki User's Guide|]]
14386 !! html/php
14387 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14388 !! end
14389
14390 !! test
14391 Category with empty sort key and parentheses
14392 !! options
14393 cat
14394 pst
14395 !! wikitext
14396 [[Category:Foo (bar)|]]
14397 !! html/php
14398 [[Category:Foo (bar)|Foo]]
14399 !! end
14400
14401 ## We used to, but no longer wt2wt this test since the default serializer
14402 ## will normalize all categories to serialize on their own line.
14403 ## This wikitext usage is going to be fairly uncommon in production and
14404 ## selser will take care of preserving formatting in those scenarios.
14405 !! test
14406 Category with link tail
14407 !! options
14408 cat
14409 pst
14410 parsoid=wt2html
14411 !! wikitext
14412 123[[Category:Foo]]456
14413 !! html/php
14414 123[[Category:Foo]]456
14415 !! html/parsoid
14416 <p>123<link rel="mw:PageProp/Category" href="Category:Foo"/>456</p>
14417 !! end
14418
14419 !! test
14420 Category with template
14421 !! options
14422 cat
14423 pst
14424 !! wikitext
14425 [[Category:{{echo|Foo}}]]
14426 !! html/php
14427 [[Category:{{echo|Foo}}]]
14428 !! end
14429
14430 !! test
14431 Category with template in sort key
14432 !! options
14433 cat
14434 pst
14435 !! wikitext
14436 [[Category:Foo|{{echo|Bar}}]]
14437 !! html/php
14438 [[Category:Foo|{{echo|Bar}}]]
14439 !! end
14440
14441 !! test
14442 Category with template in sort key and title
14443 !! options
14444 cat
14445 pst
14446 !! wikitext
14447 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14448 !! html/php
14449 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14450 !! end
14451
14452 ## We used to, but no longer wt2wt this test since the default serializer
14453 ## will normalize all categories to serialize on their own line.
14454 ## This wikitext usage is going to be fairly uncommon in production and
14455 ## selser will take care of preserving formatting in those scenarios.
14456 !! test
14457 Category / paragraph interactions
14458 !! options
14459 parsoid=wt2html
14460 !! wikitext
14461 Foo [[Category:Baz]] Bar
14462
14463 Foo [[Category:Baz]]
14464 Bar
14465
14466 Foo
14467 [[Category:Baz]]
14468 Bar
14469
14470 Foo
14471 [[Category:Baz]] Bar
14472
14473 Foo
14474 [[Category:Baz]]
14475 [[Category:Baz]]
14476 [[Category:Baz]]
14477 Bar
14478
14479 [[Category:Baz]]
14480 [[Category:Baz]]
14481 [[Category:Baz]]
14482
14483 [[Category:Baz]]
14484 {{echo|[[Category:Baz]]}}
14485 [[Category:Baz]]
14486 !! html/php
14487 <p>Foo Bar
14488 </p><p>Foo
14489 Bar
14490 </p><p>Foo
14491 Bar
14492 </p><p>Foo Bar
14493 </p><p>Foo
14494 Bar
14495 </p>
14496 !! html/parsoid
14497 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14498 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14499 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14500 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14501 <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>
14502 <link rel="mw:PageProp/Category" href="Category:Baz"/>
14503 !! end
14504
14505 ## We used to, but no longer wt2wt this test since the default serializer
14506 ## will normalize all categories to serialize on their own line.
14507 ## This wikitext usage is going to be fairly uncommon in production and
14508 ## selser will take care of preserving formatting in those scenarios.
14509 ##
14510 ## The whitespace on the empty line is part of the test. Please do not delete
14511 !! test
14512 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14513 !! options
14514 parsoid=wt2html
14515 !! wikitext
14516 This
14517
14518 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14519
14520 {{echo|[[Category:Foo]] and so should this!}}
14521 !! html/php
14522 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14523 </p>
14524 !! html/parsoid
14525 <p>This
14526
14527 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14528
14529 <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>
14530 !! end
14531
14532 ## Parsoid will not try to wt2wt this while preserving newlines because
14533 ## it suppresses excess newlines within list items -- and we don't want to
14534 ## introduce a special case just for categories, which is, in reality somewhat
14535 ## odd behavior -- categories are unlikely to be used in list items like this
14536 ## in top-level pages and are only likely to show up in template-generated
14537 ## list items where this RT-ing is a non-issue.
14538 ##
14539 ## The whitespace on the empty line is part of the test. Please do not delete
14540 !! test
14541 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14542 !! options
14543 parsoid=wt2html
14544 !! wikitext
14545 * This
14546
14547 [[Category:Foo]] and this should be part of the same list item
14548 * So should this
14549
14550 {{echo|[[Category:Foo]] and this should be part of the same list item}}
14551 !! html
14552 <ul><li>This and this should be part of the same list item</li>
14553 <li>So should this and this should be part of the same list item</li></ul>
14554 !! html/parsoid
14555 <ul>
14556 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
14557 <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>
14558 </ul>
14559 !! end
14560
14561 ## Newlines and categories that follow the last item of a list
14562 ## are treated differently because this (list followed by categories)
14563 ## is an extremely common pattern on wikis.
14564 !! test
14565 3. Categories and newlines: newline suppression for last list item should RT properly
14566 !! wikitext
14567 * a
14568 * b
14569
14570 [[Category:Foo]]
14571
14572 [[Category:Bar]]
14573 [[Category:Baz]]
14574 !! html/parsoid
14575 <ul><li> a</li>
14576 <li> b</li></ul>
14577
14578 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14579
14580 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14581 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14582 !! end
14583
14584 !! test
14585 4. Categories and newlines: newline suppression for last list item should RT properly
14586 !! wikitext
14587 * a
14588 **** b
14589
14590 [[Category:Foo]]
14591 !! html/parsoid
14592 <ul><li> a
14593 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
14594
14595 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14596 !! end
14597
14598 ## only wt2html for this to make sure the algo only applies to the rightmost path
14599 !! test
14600 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
14601 !! options
14602 parsoid=wt2html
14603 !! wikitext
14604 * a
14605 ** b
14606 [[Category:Foo]]
14607 * c
14608 ** d
14609 [[Category:Foo]]
14610 !! html/parsoid
14611 <ul><li> a
14612 <ul><li> b
14613 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
14614 <li> c
14615 <ul><li> d</li></ul></li></ul>
14616 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14617 !! end
14618
14619 ## We used to, but no longer wt2wt this test since the default serializer
14620 ## will normalize all categories to serialize on their own line.
14621 ## This wikitext usage is going to be fairly uncommon in production and
14622 ## selser will take care of preserving formatting in those scenarios.
14623 !! test
14624 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
14625 !! options
14626 parsoid=wt2html
14627 !! wikitext
14628 * a [[Category:Foo]]
14629 !! html/parsoid
14630 <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>
14631 !! end
14632
14633 # This test also demonstrates because of newline+category tunneling
14634 # through the list hander, template wrapping doesn't expand to the
14635 # containing list when the list item swallows the category.
14636 !! test
14637 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
14638 !! wikitext
14639 * {{echo|a
14640 [[Category:Foo]]}}
14641 !! html/parsoid
14642 <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
14643 </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>
14644 !! end
14645
14646 !! test
14647 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
14648 !! wikitext
14649 * a
14650
14651 {{echo|[[Category:Foo]]
14652 [[Category:Bar]]}}
14653 [[Category:Baz]]
14654 !! html/parsoid
14655 <ul><li> a</li></ul>
14656
14657 <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">
14658 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14659 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14660 !! end
14661
14662 !! test
14663 Parsoid: Serialize link to category page with colon escape
14664 !! options
14665 parsoid
14666 !! wikitext
14667
14668 [[:Category:Foo]]
14669 [[:Category:Foo|Bar]]
14670 !! html
14671 <p>
14672 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
14673 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
14674 </p>
14675 !! end
14676
14677 # We used to, but no longer wt2wt this test since the default serializer
14678 # will normalize all categories to serialize on their own line.
14679 # This wikitext usage is going to be fairly uncommon in production and
14680 # selser will take care of preventing whitespace insertion if this
14681 # occurs in an article.
14682 #
14683 # html2html disabled for the same reason (whitespace insertion between
14684 # x and y).
14685 #
14686 # html2wt disabled because it localizes the "Category" namespace.
14687 !! test
14688 Link prefix/suffixes aren't applied to category links
14689 !! options
14690 parsoid=wt2html
14691 language=is
14692 !! wikitext
14693 x[[Category:Foo]]y
14694 !! html/php
14695 <p>xy
14696 </p>
14697 !! html/parsoid
14698 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
14699 !! end
14700
14701 !! test
14702 Parsoid: Serialize link to file page with colon escape
14703 !! options
14704 parsoid
14705 !! wikitext
14706
14707 [[:File:Foo.png]]
14708 [[:File:Foo.png|Bar]]
14709 !! html
14710 <p>
14711 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
14712 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
14713 </p>
14714 !! end
14715
14716 !! test
14717 Parsoid: Serialize a genuine category link without colon escape
14718 !! options
14719 parsoid
14720 !! wikitext
14721 [[Category:Foo]]
14722 [[Category:Foo|Bar]]
14723 !! html
14724 <link rel="mw:PageProp/Category" href="./Category:Foo">
14725 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
14726 !! end
14727
14728 !! test
14729 Normalize hrefs properly before testing for invalid link targets (bug 70894)
14730 !! options
14731 parsoid=html2wt
14732 !! html/parsoid
14733 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
14734 !! wikitext
14735 [[Category:Toxine bactérienne]]
14736 !! end
14737
14738 !! test
14739 Parsoid: Defaultsort
14740 !! wikitext
14741 {{DEFAULTSORT:Foo}}
14742 !! html/parsoid
14743 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
14744 !! end
14745
14746 !! test
14747 Parsoid: Defaultsort (template-generated)
14748 !! wikitext
14749 {{{{echo|DEFAULTSORT}}:Foo}}
14750 !! html/parsoid
14751 <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}}]}'/>
14752 !! end
14753
14754 ###
14755 ### Inter-language links
14756 ###
14757 !! test
14758 Interlanguage links
14759 !! options
14760 ill
14761 !! wikitext
14762 [[es:Alimento]]
14763 [[fr:Nourriture]]
14764 [[zh:食品]]
14765 !! html/php
14766 es:Alimento fr:Nourriture zh:食品
14767 !! html/parsoid
14768 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
14769 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
14770 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
14771 !! end
14772
14773 !! test
14774 Duplicate interlanguage links (bug 24502)
14775 !! options
14776 ill
14777 !! wikitext
14778 [[es:1]]
14779 [[es:2]]
14780 [[fr:1]]
14781 [[fr:2]]
14782 !! html/php
14783 es:1 fr:1
14784 !! html/parsoid
14785 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
14786 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
14787 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
14788 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
14789 !! end
14790
14791 ###
14792 ### Sections
14793 ###
14794 !! test
14795 Basic section headings
14796 !! wikitext
14797 == Headline 1 ==
14798 Some text
14799
14800 ==Headline 2==
14801 More
14802 ===Smaller headline===
14803 Blah blah
14804 !! html
14805 <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>
14806 <p>Some text
14807 </p>
14808 <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>
14809 <p>More
14810 </p>
14811 <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>
14812 <p>Blah blah
14813 </p>
14814 !! end
14815
14816 !! test
14817 Section headings with TOC
14818 !! wikitext
14819 == Headline 1 ==
14820 === Subheadline 1 ===
14821 ===== Skipping a level =====
14822 ====== Skipping a level ======
14823
14824 == Headline 2 ==
14825 Some text
14826 ===Another headline===
14827 !! html
14828 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14829 <ul>
14830 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
14831 <ul>
14832 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
14833 <ul>
14834 <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>
14835 <ul>
14836 <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>
14837 </ul>
14838 </li>
14839 </ul>
14840 </li>
14841 </ul>
14842 </li>
14843 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
14844 <ul>
14845 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
14846 </ul>
14847 </li>
14848 </ul>
14849 </div>
14850
14851 <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>
14852 <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>
14853 <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>
14854 <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>
14855 <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>
14856 <p>Some text
14857 </p>
14858 <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>
14859
14860 !! end
14861
14862 !! test
14863 TOC anchors don't collide
14864 !! wikitext
14865 __FORCETOC__
14866 == Headline 2 ==
14867 == Headline ==
14868 == Headline 2 ==
14869 == Headline ==
14870 !! html/php
14871 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14872 <ul>
14873 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
14874 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
14875 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
14876 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
14877 </ul>
14878 </div>
14879
14880 <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>
14881 <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>
14882 <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>
14883 <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>
14884
14885 !! end
14886
14887 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
14888 !! test
14889 Handling of sections up to level 6 and beyond
14890 !! wikitext
14891 = Level 1 Heading=
14892 == Level 2 Heading==
14893 === Level 3 Heading===
14894 ==== Level 4 Heading====
14895 ===== Level 5 Heading=====
14896 ====== Level 6 Heading======
14897 ======= Level 7 Heading=======
14898 ======== Level 8 Heading========
14899 ========= Level 9 Heading=========
14900 ========== Level 10 Heading==========
14901 !! html
14902 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14903 <ul>
14904 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
14905 <ul>
14906 <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>
14907 <ul>
14908 <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>
14909 <ul>
14910 <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>
14911 <ul>
14912 <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>
14913 <ul>
14914 <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>
14915 <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>
14916 <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>
14917 <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>
14918 <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>
14919 </ul>
14920 </li>
14921 </ul>
14922 </li>
14923 </ul>
14924 </li>
14925 </ul>
14926 </li>
14927 </ul>
14928 </li>
14929 </ul>
14930 </div>
14931
14932 <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>
14933 <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>
14934 <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>
14935 <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>
14936 <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>
14937 <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>
14938 <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>
14939 <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>
14940 <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>
14941 <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>
14942
14943 !! end
14944
14945 !! test
14946 TOC regression (T11764)
14947 !! wikitext
14948 == title 1 ==
14949 === title 1.1 ===
14950 ==== title 1.1.1 ====
14951 === title 1.2 ===
14952 == title 2 ==
14953 === title 2.1 ===
14954 !! html
14955 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14956 <ul>
14957 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14958 <ul>
14959 <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>
14960 <ul>
14961 <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>
14962 </ul>
14963 </li>
14964 <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>
14965 </ul>
14966 </li>
14967 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14968 <ul>
14969 <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>
14970 </ul>
14971 </li>
14972 </ul>
14973 </div>
14974
14975 <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>
14976 <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>
14977 <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>
14978 <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>
14979 <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>
14980 <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>
14981
14982 !! end
14983
14984 !! test
14985 TOC for heading containing <span id="..."></span> (T96153)
14986 !! wikitext
14987 __FORCETOC__
14988 ==<span id="old-anchor"></span>New title==
14989 !! html/php
14990 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14991 <ul>
14992 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
14993 </ul>
14994 </div>
14995
14996 <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>
14997
14998 !! end
14999
15000 !! test
15001 TOC with wgMaxTocLevel=3 (bug 6204)
15002 !! options
15003 wgMaxTocLevel=3
15004 !! wikitext
15005 == title 1 ==
15006 === title 1.1 ===
15007 ==== title 1.1.1 ====
15008 === title 1.2 ===
15009 == title 2 ==
15010 === title 2.1 ===
15011 !! html
15012 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15013 <ul>
15014 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15015 <ul>
15016 <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>
15017 <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>
15018 </ul>
15019 </li>
15020 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15021 <ul>
15022 <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>
15023 </ul>
15024 </li>
15025 </ul>
15026 </div>
15027
15028 <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>
15029 <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>
15030 <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>
15031 <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>
15032 <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>
15033 <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>
15034
15035 !! end
15036
15037 !! test
15038 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
15039 !! options
15040 wgMaxTocLevel=3
15041 !! wikitext
15042 ==Section 1==
15043 ===Section 1.1===
15044 ====Section 1.1.1====
15045 ====Section 1.1.1.1====
15046 ==Section 2==
15047 !! html
15048 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15049 <ul>
15050 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15051 <ul>
15052 <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>
15053 </ul>
15054 </li>
15055 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15056 </ul>
15057 </div>
15058
15059 <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>
15060 <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>
15061 <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>
15062 <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>
15063 <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>
15064
15065 !! end
15066
15067
15068 !! test
15069 Resolving duplicate section names
15070 !! wikitext
15071 == Foo bar ==
15072 == Foo bar ==
15073 !! html
15074 <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>
15075 <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>
15076
15077 !! end
15078
15079 !! test
15080 Resolving duplicate section names with differing case (bug 10721)
15081 !! wikitext
15082 == Foo bar ==
15083 == Foo Bar ==
15084 !! html
15085 <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>
15086 <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>
15087
15088 !! end
15089
15090 !! article
15091 Template:sections
15092 !! text
15093 ===Section 1===
15094 ==Section 2==
15095 !! endarticle
15096
15097 !! test
15098 Template with sections, __NOTOC__
15099 !! wikitext
15100 __NOTOC__
15101 ==Section 0==
15102 {{sections}}
15103 ==Section 4==
15104 !! html
15105 <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>
15106 <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>
15107 <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>
15108 <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>
15109
15110 !! end
15111
15112 !! test
15113 __NOEDITSECTION__ keyword
15114 !! wikitext
15115 __NOEDITSECTION__
15116 ==Section 1==
15117 ==Section 2==
15118 !! html
15119 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15120 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15121
15122 !! end
15123
15124 !! test
15125 Link inside a section heading
15126 !! wikitext
15127 ==Section with a [[Main Page|link]] in it==
15128 !! html
15129 <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>
15130
15131 !! end
15132
15133 !! test
15134 TOC regression (T14077)
15135 !! wikitext
15136 __TOC__
15137 == title 1 ==
15138 === title 1.1 ===
15139 == title 2 ==
15140 !! html
15141 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15142 <ul>
15143 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15144 <ul>
15145 <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>
15146 </ul>
15147 </li>
15148 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15149 </ul>
15150 </div>
15151
15152 <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>
15153 <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>
15154 <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>
15155
15156 !! end
15157
15158 !! test
15159 BUG 1219 URL next to image (good)
15160 !! wikitext
15161 http://example.com [[File:Foobar.jpg]]
15162 !! html/php
15163 <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>
15164 </p>
15165 !! html/parsoid
15166 <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>
15167 !!end
15168
15169 !! test
15170 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
15171 !! wikitext
15172 ===
15173 The line above must have a trailing space!
15174 === <!--
15175 --> <!-- -->
15176 But just in case it doesn't...
15177 !! html
15178 <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>
15179 <p>The line above must have a trailing space!
15180 </p>
15181 <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>
15182 <p>But just in case it doesn't...
15183 </p>
15184 !! end
15185
15186 !! test
15187 Header with special characters (bug 25462)
15188 !! wikitext
15189 The tooltips shall not show entities to the user (ie. be double escaped)
15190
15191 == text > text ==
15192 section 1
15193
15194 == text < text ==
15195 section 2
15196
15197 == text & text ==
15198 section 3
15199
15200 == text ' text ==
15201 section 4
15202
15203 == text " text ==
15204 section 5
15205 !! html
15206 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15207 </p>
15208 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15209 <ul>
15210 <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>
15211 <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>
15212 <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>
15213 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15214 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15215 </ul>
15216 </div>
15217
15218 <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>
15219 <p>section 1
15220 </p>
15221 <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>
15222 <p>section 2
15223 </p>
15224 <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>
15225 <p>section 3
15226 </p>
15227 <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>
15228 <p>section 4
15229 </p>
15230 <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>
15231 <p>section 5
15232 </p>
15233 !! end
15234
15235 !! test
15236 Header with space, plus and underscore as entity
15237 !! wikitext
15238 Id should not contain + for spaces
15239
15240 == Space between Text ==
15241 section 1
15242
15243 == Space-Entity&#32;between&#32;Text ==
15244 section 2
15245
15246 == Plus+between+Text ==
15247 section 3
15248
15249 == Plus-Entity&#43;between&#43;Text ==
15250 section 4
15251
15252 == Underscore_between_Text ==
15253 section 5
15254
15255 == Underscore-Entity&#95;between&#95;Text ==
15256 section 6
15257
15258 [[#Space between Text]]
15259 [[#Space-Entity&#32;between&#32;Text]]
15260 [[#Plus+between+Text]]
15261 [[#Plus-Entity&#43;between&#43;Text]]
15262 [[#Underscore_between_Text]]
15263 [[#Underscore-Entity&#95;between&#95;Text]]
15264 !! html
15265 <p>Id should not contain + for spaces
15266 </p>
15267 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15268 <ul>
15269 <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>
15270 <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>
15271 <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>
15272 <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>
15273 <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>
15274 <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>
15275 </ul>
15276 </div>
15277
15278 <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>
15279 <p>section 1
15280 </p>
15281 <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>
15282 <p>section 2
15283 </p>
15284 <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>
15285 <p>section 3
15286 </p>
15287 <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>
15288 <p>section 4
15289 </p>
15290 <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>
15291 <p>section 5
15292 </p>
15293 <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>
15294 <p>section 6
15295 </p><p><a href="#Space_between_Text">#Space between Text</a>
15296 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15297 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15298 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15299 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15300 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15301 </p>
15302 !! end
15303
15304 !! test
15305 Headers with excess '=' characters
15306 (Are similar tests necessary beyond the 1st level?)
15307 !! wikitext
15308 =foo==
15309 ==foo=
15310 =''italic'' heading==
15311 ==''italic'' heading=
15312 !! html
15313 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15314 <ul>
15315 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15316 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15317 <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>
15318 <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>
15319 </ul>
15320 </div>
15321
15322 <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>
15323 <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>
15324 <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>
15325 <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>
15326
15327 !! end
15328
15329 !! test
15330 HTML headers vs TOC (bug 23393)
15331 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15332 !! wikitext
15333 <h1>Header 1</h1>
15334 == Header 1.1 ==
15335 == Header 1.2 ==
15336
15337 <h1>Header 2
15338 </h1>
15339 == Header 2.1 ==
15340 == Header 2.2 ==
15341 __NOEDITSECTION__
15342 !! html
15343 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15344 <ul>
15345 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15346 <ul>
15347 <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>
15348 <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>
15349 </ul>
15350 </li>
15351 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15352 <ul>
15353 <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>
15354 <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>
15355 </ul>
15356 </li>
15357 </ul>
15358 </div>
15359
15360 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15361 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15362 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15363 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15364 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15365 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15366
15367 !! end
15368
15369 !! test
15370 Single-line or multiline-comments can follow headings
15371 !! options
15372 parsoid=wt2html,wt2wt
15373 !! wikitext
15374 ==foo==<!---->
15375 ==bar==<!--c1-->
15376 ==baz==<!--
15377 c2
15378 c3-->
15379 !! html
15380 <h2><span class="mw-headline" id="foo">foo</span></h2>
15381 <h2><span class="mw-headline" id="bar">bar</span></h2>
15382 <h2><span class="mw-headline" id="baz">baz</span></h2>
15383
15384 !! end
15385
15386 !! test
15387 BUG 1219 URL next to image (broken)
15388 !! wikitext
15389 http://example.com[[File:Foobar.jpg]]
15390 !! html/php
15391 <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>
15392 </p>
15393 !! html/parsoid
15394 <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>
15395 !!end
15396
15397 !! test
15398 Bug 1186 news: in the middle of text
15399 !! wikitext
15400 http://en.wikinews.org/wiki/Wikinews:Workplace
15401 !! html
15402 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15403 </p>
15404 !!end
15405
15406
15407 !! test
15408 Namespaced link must have a title
15409 !! wikitext
15410 [[Project:]]
15411 !! html
15412 <p>[[Project:]]
15413 </p>
15414 !!end
15415
15416 !! test
15417 Namespaced link must have a title (bad fragment version)
15418 !! wikitext
15419 [[Project:#fragment]]
15420 !! html
15421 <p>[[Project:#fragment]]
15422 </p>
15423 !!end
15424
15425
15426 ###
15427 ### HTML tags and HTML attributes
15428 ###
15429
15430 !! test
15431 div with no attributes
15432 !! wikitext
15433 <div>HTML rocks</div>
15434 !! html
15435 <div>HTML rocks</div>
15436
15437 !! end
15438
15439 !! test
15440 div with double-quoted attribute
15441 !! wikitext
15442 <div id="rock">HTML rocks</div>
15443 !! html
15444 <div id="rock">HTML rocks</div>
15445
15446 !! end
15447
15448 !! test
15449 div with single-quoted attribute
15450 !! wikitext
15451 <div id='rock'>HTML rocks</div>
15452 !! html
15453 <div id="rock">HTML rocks</div>
15454
15455 !! end
15456
15457 !! test
15458 div with unquoted attribute
15459 !! wikitext
15460 <div id=rock>HTML rocks</div>
15461 !! html
15462 <div id="rock">HTML rocks</div>
15463
15464 !! end
15465
15466 !! test
15467 div with illegal double attributes
15468 !! wikitext
15469 <div id="a" id="b">HTML rocks</div>
15470 !! html
15471 <div id="b">HTML rocks</div>
15472
15473 !!end
15474
15475 !! test
15476 div with empty attribute value, space before equals
15477 !! options
15478 parsoid=wt2html,html2html
15479 !! wikitext
15480 <div class =>HTML rocks</div>
15481 !! html/php
15482 <div class="">HTML rocks</div>
15483
15484 !! html/parsoid
15485 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15486 !! end
15487
15488 !! test
15489 div with multiple empty attribute values
15490 !! options
15491 parsoid=wt2html,html2html
15492 !! wikitext
15493 <div id= title=>HTML rocks</div>
15494 !! html/php
15495 <div id="title.3D">HTML rocks</div>
15496
15497 !! html/parsoid
15498 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15499 !! end
15500
15501 !! test
15502 table with multiple empty attribute values
15503 !! options
15504 parsoid=wt2html,html2html
15505 !! wikitext
15506 {| title= id=
15507 | hi
15508 |}
15509 !! html/php
15510 <table title="id=">
15511 <tr>
15512 <td> hi
15513 </td></tr></table>
15514
15515 !! html/parsoid
15516 <table title="id=">
15517 <tbody><tr><td> hi</td></tr>
15518 </tbody></table>
15519 !! end
15520
15521 !! test
15522 div with braces in attribute value
15523 !! wikitext
15524 <div title="{}">Foo</div>
15525 !! html/php
15526 <div title="&#123;}">Foo</div>
15527
15528 !! html/parsoid
15529 <div title="{}">Foo</div>
15530 !! end
15531
15532 !! test
15533 div with empty attribute value, no space before equals
15534 !! options
15535 parsoid=wt2html,html2html
15536 !! wikitext
15537 <div class=>HTML rocks</div>
15538 !! html/php
15539 <div class="">HTML rocks</div>
15540
15541 !! html/parsoid
15542 <div class="">HTML rocks</div>
15543 !! end
15544
15545 !! test
15546 HTML multiple attributes correction
15547 !! wikitext
15548 <p class="error" class="awesome">Awesome!</p>
15549 !! html
15550 <p class="awesome">Awesome!</p>
15551
15552 !!end
15553
15554 !! test
15555 Table multiple attributes correction
15556 !! wikitext
15557 {|
15558 !+ class="error" class="awesome"| status
15559 |}
15560 !! html
15561 <table>
15562 <tr>
15563 <th class="awesome"> status
15564 </th></tr></table>
15565
15566 !!end
15567
15568 !! test
15569 DIV IN UPPERCASE
15570 !! wikitext
15571 <DIV ID="x">HTML ROCKS</DIV>
15572 !! html
15573 <div id="x">HTML ROCKS</div>
15574
15575 !!end
15576
15577 !! test
15578 Non-ASCII pseudo-tags are rendered as text
15579 !! wikitext
15580 <khyô>
15581 !! html
15582 <p>&lt;khyô&gt;
15583 </p>
15584 !! end
15585
15586 !! test
15587 Pseudo-tag with URL 'name' renders as url link
15588 !! wikitext
15589 <http://example.com/>
15590 !! html
15591 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
15592 </p>
15593 !! end
15594
15595 !! test
15596 text with amp in the middle of nowhere
15597 !! wikitext
15598 Remember AT&T?
15599 !! html
15600 <p>Remember AT&amp;T?
15601 </p>
15602 !! end
15603
15604 !! test
15605 text with character entity: eacute
15606 !! wikitext
15607 I always thought &eacute; was a cute letter.
15608 !! html
15609 <p>I always thought &#233; was a cute letter.
15610 </p>
15611 !! html+tidy
15612 <p>I always thought é was a cute letter.</p>
15613 !! end
15614
15615 !! test
15616 text with entity-escaped character entity-like string: eacute
15617 !! wikitext
15618 I always thought &amp;eacute; was a cute letter.
15619 !! html
15620 <p>I always thought &amp;eacute; was a cute letter.
15621 </p>
15622 !! end
15623
15624 !! test
15625 text with undefined character entity: xacute
15626 !! wikitext
15627 I always thought &xacute; was a cute letter.
15628 !! html
15629 <p>I always thought &amp;xacute; was a cute letter.
15630 </p>
15631 !! end
15632
15633 !! test
15634 HTML5 tags
15635 !! wikitext
15636 <data value="5">five</data>
15637 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15638 <mark>This highlighted text</mark>
15639 !! html
15640 <p><data value="5">five</data>
15641 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15642 <mark>This highlighted text</mark>
15643 </p>
15644 !! end
15645
15646 !! test
15647 HTML tag with leading space is parsed as text
15648 !! wikitext
15649 < div>foo< /div>
15650 !! html
15651 <p>&lt; div&gt;foo&lt; /div&gt;
15652 </p>
15653 !! end
15654
15655 ###
15656 ### Nesting tests (see bug 41545, 50604, 51081)
15657 ###
15658
15659 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
15660 # Note that html2wt is considerably more difficult if we use <b> in
15661 # the test case, instead of <big>
15662 !! test
15663 Ensure that HTML adoption agency algorithm is properly implemented.
15664 !! wikitext
15665 <big>X<big>Y</big>Z</big>
15666 !! html
15667 <p><big>X<big>Y</big>Z</big>
15668 </p>
15669 !! end
15670
15671 # This was bug 41545 in the PHP parser.
15672 # Note that tidy doesn't handle this correctly.
15673 !! test
15674 Nesting of <kbd>
15675 !! wikitext
15676 <kbd>X<kbd>Y</kbd>Z</kbd>
15677 !! html
15678 <p><kbd>X<kbd>Y</kbd>Z</kbd>
15679 </p>
15680 !! end
15681
15682 # The following cases were bug 51081 in the PHP parser.
15683 # Note that there are some other nestable tags (b, i, etc) which are
15684 # not covered; see bug 51081 for discussion.
15685
15686 # Note that tidy doesn't handle this correctly.
15687 !! test
15688 Nesting of <em>
15689 !! wikitext
15690 <em>X<em>Y</em>Z</em>
15691 !! html
15692 <p><em>X<em>Y</em>Z</em>
15693 </p>
15694 !! end
15695
15696 # Note that tidy doesn't handle this correctly.
15697 !! test
15698 Nesting of <strong>
15699 !! wikitext
15700 <strong>X<strong>Y</strong>Z</strong>
15701 !! html
15702 <p><strong>X<strong>Y</strong>Z</strong>
15703 </p>
15704 !! end
15705
15706 !! test
15707 Nesting of <q>
15708 !! wikitext
15709 <q>X<q>Y</q>Z</q>
15710 !! html+tidy
15711 <p><q>X<q>Y</q>Z</q></p>
15712 !! end
15713
15714 # Note that tidy doesn't handle this correctly.
15715 !! test
15716 Nesting of <ruby>
15717 !! wikitext
15718 <ruby>X<ruby>Y</ruby>Z</ruby>
15719 !! html
15720 <p><ruby>X<ruby>Y</ruby>Z</ruby>
15721 </p>
15722 !! end
15723
15724 # Note that tidy doesn't handle this correctly.
15725 !! test
15726 Nesting of <bdo>
15727 !! wikitext
15728 <bdo>X<bdo>Y</bdo>Z</bdo>
15729 !! html
15730 <p><bdo>X<bdo>Y</bdo>Z</bdo>
15731 </p>
15732 !! end
15733
15734
15735 ###
15736 ### Media links
15737 ###
15738
15739 !! test
15740 Media link
15741 !! wikitext
15742 [[Media:Foobar.jpg]]
15743 !! html
15744 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
15745 </p>
15746 !! end
15747
15748 !! test
15749 Media link with text
15750 !! wikitext
15751 [[Media:Foobar.jpg|A neat file to look at]]
15752 !! html
15753 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
15754 </p>
15755 !! end
15756
15757 # FIXME: this is still bad HTML tag nesting
15758 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
15759 !! test
15760 Media link with nasty text
15761 !! wikitext
15762 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
15763 !! html
15764 <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>
15765
15766 !! html+tidy
15767 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
15768 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
15769 !! end
15770
15771 !! test
15772 Media link to nonexistent file (bug 1702)
15773 !! wikitext
15774 [[Media:No such.jpg]]
15775 !! html
15776 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
15777 </p>
15778 !! end
15779
15780 !! test
15781 Image link to nonexistent file (bug 1850 - good)
15782 !! wikitext
15783 [[File:No_such.jpg]]
15784 !! html/php
15785 <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>
15786 </p>
15787 !! html/parsoid
15788 <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>
15789 !! end
15790
15791 !! test
15792 :Image link to nonexistent file (bug 1850 - bad)
15793 !! wikitext
15794 [[:Image:No such.jpg]]
15795 !! html/php
15796 <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>
15797 </p>
15798 !! html/parsoid
15799 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
15800 !! end
15801
15802
15803
15804 !! test
15805 Character reference normalization in link text (bug 1938)
15806 !! wikitext
15807 [[Main Page|this&that]]
15808 !! html
15809 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
15810 </p>
15811 !!end
15812
15813 !! article
15814 אַ
15815 !! text
15816 Test for unicode normalization
15817
15818 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
15819 !! endarticle
15820
15821 !! test
15822 (bug 19451) Links should refer to the normalized form.
15823 !! wikitext
15824 [[&#xFB2E;]]
15825 [[&#x5d0;&#x5b7;]]
15826 [[&#x5d0;ַ]]
15827 [[א&#x5b7;]]
15828 [[אַ]]
15829 !! html
15830 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
15831 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
15832 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
15833 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
15834 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
15835 </p>
15836 !! end
15837
15838 !! test
15839 Empty attribute crash test (bug 2067)
15840 !! wikitext
15841 <font color="">foo</font>
15842 !! html
15843 <p><font color="">foo</font>
15844 </p>
15845 !! end
15846
15847 !! test
15848 Empty attribute crash test single-quotes (bug 2067)
15849 !! wikitext
15850 <font color=''>foo</font>
15851 !! html
15852 <p><font color="">foo</font>
15853 </p>
15854 !! end
15855
15856 !! test
15857 Attribute test: equals, then nothing
15858 !! options
15859 parsoid=wt2html,html2html
15860 !! wikitext
15861 <font color=>foo</font>
15862 !! html/php
15863 <p><font color="">foo</font>
15864 </p>
15865 !! html/parsoid
15866 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
15867 !! end
15868
15869 !! test
15870 Attribute test: unquoted value
15871 !! options
15872 parsoid=wt2html,html2html
15873 !! wikitext
15874 <font color=x>foo</font>
15875 !! html/php
15876 <p><font color="x">foo</font>
15877 </p>
15878 !! html/parsoid
15879 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
15880 !! end
15881
15882 !! test
15883 Attribute test: unquoted but illegal value (hash)
15884 !! wikitext
15885 <font color=#x>foo</font>
15886 !! html
15887 <p><font color="#x">foo</font>
15888 </p>
15889 !! end
15890
15891 # Parsoid does not serialize to empty attribute syntax,
15892 # so wt2wt and html2wt cases are skipped
15893 !! test
15894 Attribute test: no value (T54330)
15895 !! options
15896 parsoid=wt2html,html2html
15897 !! wikitext
15898 <font color>foo</font>
15899 !! html/php
15900 <p><font color="">foo</font>
15901 </p>
15902 !! html/parsoid
15903 <p><font color="">foo</font></p>
15904 !! end
15905
15906 !! test
15907 Bug 2095: link with three closing brackets
15908 !! wikitext
15909 [[Main Page]]]
15910 !! html/php
15911 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
15912 </p>
15913 !! html/parsoid
15914 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
15915 !! end
15916
15917 !! test
15918 Bug 2095: link with pipe and three closing brackets
15919 !! wikitext
15920 [[Main Page|link]]]
15921 !! html/php
15922 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
15923 </p>
15924 !! html/parsoid
15925 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
15926 !! end
15927
15928 !! test
15929 Bug 2095: link with pipe and three closing brackets, version 2
15930 !! wikitext
15931 [[Main Page|[http://example.com/]]]
15932 !! html/php
15933 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
15934 </p>
15935 !! html/parsoid
15936 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
15937 !! end
15938
15939
15940 ###
15941 ### Safety
15942 ###
15943
15944 !! article
15945 Template:Dangerous attribute
15946 !! text
15947 " onmouseover="alert(document.cookie)
15948 !! endarticle
15949
15950 !! article
15951 Template:Dangerous style attribute
15952 !! text
15953 border-size: expression(alert(document.cookie))
15954 !! endarticle
15955
15956 !! article
15957 Template:Div style
15958 !! text
15959 <div style="float: right; {{{1}}}">Magic div</div>
15960 !! endarticle
15961
15962 !! test
15963 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
15964 !! wikitext
15965 <div title="{{test}}"></div>
15966 !! html
15967 <div title="This is a test template"></div>
15968
15969 !! end
15970
15971 # Parsoid has enough context to handle this case
15972 !! test
15973 Bug 2304: HTML attribute safety (dangerous template; 2309)
15974 !! wikitext
15975 <div title="{{dangerous attribute}}"></div>
15976 !! html/php
15977 <div title=""></div>
15978
15979 !! html/parsoid
15980 <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>
15981 !! end
15982
15983 !! test
15984 Bug 2304: HTML attribute safety (dangerous style template; 2309)
15985 !! wikitext
15986 <div style="{{dangerous style attribute}}"></div>
15987 !! html
15988 <div style="/* insecure input */"></div>
15989
15990 !! end
15991
15992 !! test
15993 Bug 2304: HTML attribute safety (safe parameter; 2309)
15994 !! wikitext
15995 {{div style|width: 200px}}
15996 !! html
15997 <div style="float: right; width: 200px">Magic div</div>
15998
15999 !! end
16000
16001 !! test
16002 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
16003 !! wikitext
16004 {{div style|width: expression(alert(document.cookie))}}
16005 !! html
16006 <div style="/* insecure input */">Magic div</div>
16007
16008 !! end
16009
16010 !! test
16011 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
16012 !! wikitext
16013 {{div style|"><script>alert(document.cookie)</script>}}
16014 !! html
16015 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16016
16017 !! end
16018
16019 !! test
16020 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
16021 !! wikitext
16022 {{div style|" ><script>alert(document.cookie)</script>}}
16023 !! html
16024 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16025
16026 !! end
16027
16028 !! test
16029 Bug 2304: HTML attribute safety (link)
16030 !! wikitext
16031 <div title="[[Main Page]]"></div>
16032 !! html
16033 <div title="&#91;&#91;Main Page]]"></div>
16034
16035 !! end
16036
16037 !! test
16038 Bug 2304: HTML attribute safety (italics)
16039 !! wikitext
16040 <div title="''foobar''"></div>
16041 !! html
16042 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16043
16044 !! end
16045
16046 !! test
16047 Bug 2304: HTML attribute safety (bold)
16048 !! wikitext
16049 <div title="'''foobar'''"></div>
16050 !! html
16051 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16052
16053 !! end
16054
16055
16056 !! test
16057 Bug 2304: HTML attribute safety (ISBN)
16058 !! wikitext
16059 <div title="ISBN 1234567890"></div>
16060 !! html
16061 <div title="&#73;SBN 1234567890"></div>
16062
16063 !! end
16064
16065 !! test
16066 Bug 2304: HTML attribute safety (RFC)
16067 !! wikitext
16068 <div title="RFC 1234"></div>
16069 !! html
16070 <div title="&#82;FC 1234"></div>
16071
16072 !! end
16073
16074 !! test
16075 Bug 2304: HTML attribute safety (PMID)
16076 !! wikitext
16077 <div title="PMID 1234567890"></div>
16078 !! html
16079 <div title="&#80;MID 1234567890"></div>
16080
16081 !! end
16082
16083 !! test
16084 Bug 2304: HTML attribute safety (web link)
16085 !! wikitext
16086 <div title="http://example.com/"></div>
16087 !! html
16088 <div title="http&#58;//example.com/"></div>
16089
16090 !! end
16091
16092 !! test
16093 Bug 2304: HTML attribute safety (named web link)
16094 !! wikitext
16095 <div title="[http://example.com/ link]"></div>
16096 !! html
16097 <div title="&#91;http&#58;//example.com/ link]"></div>
16098
16099 !! end
16100
16101 !! test
16102 Bug 3244: HTML attribute safety (extension; safe)
16103 !! wikitext
16104 <div style="<nowiki>background:blue</nowiki>"></div>
16105 !! html
16106 <div style="background:blue"></div>
16107
16108 !! end
16109
16110 !! test
16111 Bug 3244: HTML attribute safety (extension; unsafe)
16112 !! wikitext
16113 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16114 !! html
16115 <div style="/* insecure input */"></div>
16116
16117 !! end
16118
16119 # More MSIE fun discovered by Tom Gilder
16120
16121 !! test
16122 MSIE CSS safety test: spurious slash
16123 !! wikitext
16124 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16125 !! html
16126 <div style="/* insecure input */">evil</div>
16127
16128 !! end
16129
16130 !! test
16131 MSIE CSS safety test: hex code
16132 !! wikitext
16133 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16134 !! html
16135 <div style="/* insecure input */">evil</div>
16136
16137 !! end
16138
16139 !! test
16140 MSIE CSS safety test: comment in url
16141 !! wikitext
16142 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16143 !! html
16144 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16145
16146 !! end
16147
16148 !! test
16149 MSIE CSS safety test: comment in expression
16150 !! wikitext
16151 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16152 !! html
16153 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16154
16155 !! end
16156
16157 !! test
16158 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
16159 !! wikitext
16160 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16161 !! html
16162 <p style="/* invalid control char */">A</p>
16163
16164 !! end
16165
16166 !! test
16167 MSIE 6 CSS safety test: Fullwidth (bug 55332)
16168 !! wikitext
16169 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16170 <div style="top:EXPRESSION(alert())">B</div>
16171 !! html
16172 <p style="/* insecure input */">A</p>
16173 <div style="/* insecure input */">B</div>
16174
16175 !! end
16176
16177 !! test
16178 MSIE 6 CSS safety test: IPA extensions (bug 55332)
16179 !! wikitext
16180 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16181 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16182 !! html
16183 <div style="/* insecure input */">A</div>
16184 <p style="/* insecure input */">B</p>
16185
16186 !! end
16187
16188 !! test
16189 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16190 !! wikitext
16191 <div style="background-image:url⁽javascript:alert())">A</div>
16192 <div style="background-image:url₍javascript:alert())">B</div>
16193 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16194 !! html
16195 <div style="/* insecure input */">A</div>
16196 <div style="/* insecure input */">B</div>
16197 <p style="/* insecure input */">C</p>
16198
16199 !! end
16200
16201 # FIXME: Parsoid fails to sanitize this! See T58846.
16202 !! test
16203 Opera -o-link CSS
16204 !! wikitext
16205 <div
16206 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;"
16207 style="-o-link:attr(title);-o-link-source:current">X</div>
16208 !! html
16209 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16210
16211 !! end
16212
16213 !! test
16214 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16215 !! wikitext
16216 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16217 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16218 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16219 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16220 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16221 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16222 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16223 !! html
16224 <p style="/* insecure input */">A</p>
16225 <p style="/* insecure input */">B</p>
16226 <p style="/* insecure input */">C</p>
16227 <p style="/* insecure input */">D</p>
16228 <p style="/* insecure input */">E</p>
16229 <p style="/* insecure input */">F</p>
16230 <p style="/* insecure input */">G</p>
16231
16232 !! end
16233
16234 !! test
16235 Table attribute legitimate extension
16236 !! wikitext
16237 {|
16238 !+ style="<nowiki>color:blue</nowiki>"| status
16239 |}
16240 !! html
16241 <table>
16242 <tr>
16243 <th style="color:blue"> status
16244 </th></tr></table>
16245
16246 !!end
16247
16248 !! test
16249 Table attribute safety
16250 !! wikitext
16251 {|
16252 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16253 |}
16254 !! html
16255 <table>
16256 <tr>
16257 <th style="/* insecure input */"> status
16258 </th></tr></table>
16259
16260 !! end
16261
16262 !! test
16263 CSS line continuation 1
16264 !! wikitext
16265 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16266 !! html
16267 <div style="/* insecure input */"></div>
16268
16269 !! end
16270
16271 !! test
16272 CSS line continuation 2
16273 !! wikitext
16274 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16275 !! html
16276 <div style="/* invalid control char */"></div>
16277
16278 !! end
16279
16280 !! article
16281 Template:Identity
16282 !! text
16283 {{{1}}}
16284 !! endarticle
16285
16286 !! test
16287 Expansion of multi-line templates in attribute values (bug 6255)
16288 !! wikitext
16289 <div style="background: {{identity|#00FF00}}">-</div>
16290 !! html
16291 <div style="background: #00FF00">-</div>
16292
16293 !! end
16294
16295
16296 !! test
16297 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16298 !! wikitext
16299 <div style="background:
16300 #00FF00">-</div>
16301 !! html/php
16302 <div style="background: #00FF00">-</div>
16303
16304 !! html/parsoid
16305 <div style="background:
16306 #00FF00">-</div>
16307 !! end
16308
16309 !! test
16310 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16311 !! wikitext
16312 <div style="background: &#10;#00FF00">-</div>
16313 !! html
16314 <div style="background: &#10;#00FF00">-</div>
16315
16316 !! end
16317
16318 !! test
16319 evil <math>-wiki-tags without Extension:Math enabled
16320 !! wikitext
16321 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
16322 !! html+tidy
16323 <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>
16324 !! end
16325
16326 ###
16327 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16328 ###
16329 !! test
16330 Parser hook: empty input
16331 !! wikitext
16332 <tag></tag>
16333 !! html/php
16334 <pre>
16335 ''
16336 array (
16337 )
16338 </pre>
16339
16340 !! html/parsoid
16341 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16342 !! end
16343
16344 ## Don't expect parsoid to rt this form.
16345 !! test
16346 Parser hook: empty input using terminated empty elements
16347 !! options
16348 parsoid=wt2html,html2html
16349 !! wikitext
16350 <tag/>
16351 !! html/php
16352 <pre>
16353 NULL
16354 array (
16355 )
16356 </pre>
16357
16358 !! html/parsoid
16359 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16360 !! end
16361
16362 !! test
16363 Parser hook: empty input using terminated empty elements (space before)
16364 !! wikitext
16365 <tag />
16366 !! html/php
16367 <pre>
16368 NULL
16369 array (
16370 )
16371 </pre>
16372
16373 !! html/parsoid
16374 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16375 !! end
16376
16377 !! test
16378 Parser hook: basic input
16379 !! wikitext
16380 <tag>input</tag>
16381 !! html/php
16382 <pre>
16383 'input'
16384 array (
16385 )
16386 </pre>
16387
16388 !! html/parsoid
16389 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16390 !! end
16391
16392 ## Don't expect parsoid to rt this form.
16393 !! test
16394 Parser hook: case insensitive
16395 !! options
16396 parsoid=wt2html,html2html
16397 !! wikitext
16398 <TAG>input</TAG>
16399 !! html/php
16400 <pre>
16401 'input'
16402 array (
16403 )
16404 </pre>
16405
16406 !! html/parsoid
16407 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16408 !! end
16409
16410 ## Don't expect parsoid to rt this form.
16411 !! test
16412 Parser hook: case insensitive, redux
16413 !! options
16414 parsoid=wt2html,html2html
16415 !! wikitext
16416 <TaG>input</TAg>
16417 !! html/php
16418 <pre>
16419 'input'
16420 array (
16421 )
16422 </pre>
16423
16424 !! html/parsoid
16425 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16426 !! end
16427
16428 !! test
16429 Parser hook: nested tags
16430 !! wikitext
16431 <tag><tag></tag></tag>
16432 !! html/php
16433 <pre>
16434 '<tag>'
16435 array (
16436 )
16437 </pre>&lt;/tag&gt;
16438
16439 !! html/parsoid
16440 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
16441 !! end
16442
16443 !! test
16444 Parser hook: basic arguments
16445 !! wikitext
16446 <tag width="200" height="100" depth="50" square=""></tag>
16447 !! html/php
16448 <pre>
16449 ''
16450 array (
16451 'width' => '200',
16452 'height' => '100',
16453 'depth' => '50',
16454 'square' => '',
16455 )
16456 </pre>
16457
16458 !! html/parsoid
16459 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16460 !! end
16461
16462 ## Don't expect parsoid to rt this form.
16463 !! test
16464 Parser hook: basic arguments, variations
16465 !! options
16466 parsoid=wt2html,html2html
16467 !! wikitext
16468 <tag width=200 height = "100" depth = '50' square></tag>
16469 !! html/php
16470 <pre>
16471 ''
16472 array (
16473 'width' => '200',
16474 'height' => '100',
16475 'depth' => '50',
16476 'square' => '',
16477 )
16478 </pre>
16479
16480 !! html/parsoid
16481 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16482 !! end
16483
16484 !! test
16485 Parser hook: argument containing a forward slash (bug 5344)
16486 !! wikitext
16487 <tag filename="/tmp/bla"></tag>
16488 !! html/php
16489 <pre>
16490 ''
16491 array (
16492 'filename' => '/tmp/bla',
16493 )
16494 </pre>
16495
16496 !! html/parsoid
16497 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16498 !! end
16499
16500 ## Don't expect parsoid to rt this form.
16501 !! test
16502 Parser hook: empty input using terminated empty elements (bug 2374)
16503 !! options
16504 parsoid=wt2html,html2html
16505 !! wikitext
16506 <tag foo=bar/>text
16507 !! html/php
16508 <pre>
16509 NULL
16510 array (
16511 'foo' => 'bar',
16512 )
16513 </pre>text
16514
16515 !! html/parsoid
16516 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
16517 !! end
16518
16519 # </tag> should be output literally since there is no matching tag that begins it
16520 !! test
16521 Parser hook: basic arguments using terminated empty elements (bug 2374)
16522 !! wikitext
16523 <tag width=200 height = "100" depth = '50' square/>
16524 other stuff
16525 </tag>
16526 !! html/php
16527 <pre>
16528 NULL
16529 array (
16530 'width' => '200',
16531 'height' => '100',
16532 'depth' => '50',
16533 'square' => '',
16534 )
16535 </pre>
16536 <p>other stuff
16537 &lt;/tag&gt;
16538 </p>
16539 !! end
16540
16541 ###
16542 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
16543 ###
16544
16545 !! test
16546 Parser hook: static parser hook not inside a comment
16547 !! wikitext
16548 <statictag>hello, world</statictag>
16549
16550 <statictag action="flush" />
16551 !! html/php
16552 <p><br />
16553 hello, world
16554 </p>
16555 !! html/parsoid
16556 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
16557 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
16558 !! end
16559
16560 !! test
16561 Parser hook: static parser hook inside a comment
16562 !! wikitext
16563 <!-- <statictag>hello, world</statictag> -->
16564 <statictag action="flush" />
16565 !! html/php
16566 <p><br />
16567 </p>
16568 !! html/parsoid
16569 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
16570 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
16571 !! end
16572
16573 # Nested template calls; this case was broken by Parser.php rev 1.506,
16574 # since reverted.
16575
16576 !! article
16577 Template:One-parameter
16578 !! text
16579 (My parameter is: {{{1}}})
16580 !! endarticle
16581
16582 !! article
16583 Template:Map-one-parameter
16584 !! text
16585 {{{{{1}}}|{{{2}}}}}
16586 !! endarticle
16587
16588 !! test
16589 Nested template calls
16590 !! wikitext
16591 {{Map-one-parameter|One-parameter|param}}
16592 !! html
16593 <p>(My parameter is: param)
16594 </p>
16595 !! end
16596
16597
16598 ###
16599 ### Sanitizer
16600 ###
16601
16602 # HTML+Tidy effectively strips out the empty tags completely
16603 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
16604 # which Tidy would have done for the PHP parser had there been content inside it.
16605 !! test
16606 Sanitizer: Closing of open tags
16607 !! wikitext
16608 <s></s><table></table>
16609 !! html
16610 <s></s><table></table>
16611
16612 !! html/parsoid
16613 <p><s></s></p><table></table>
16614 !! end
16615
16616 !! test
16617 Sanitizer: Closing of open but not closed tags
16618 !! wikitext
16619 <s>foo
16620 !! html
16621 <p><s>foo</s>
16622 </p>
16623 !! end
16624
16625 !! test
16626 Sanitizer: Closing of closed but not open tags
16627 !! options
16628 parsoid=wt2html
16629 !! wikitext
16630 </s>
16631 !! html/php+tidy
16632 !! html/parsoid
16633 !! end
16634
16635 !! test
16636 Sanitizer: Closing of closed but not open table tags
16637 !! options
16638 parsoid=wt2html
16639 !! wikitext
16640 Table not started</td></tr></table>
16641 !! html/php+tidy
16642 <p>Table not started</p>
16643 !! html/parsoid
16644 <p>Table not started</p>
16645 !! end
16646
16647 !! test
16648 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
16649 !! wikitext
16650 <span id="æ: v">byte</span>[[#æ: v|backlink]]
16651 !! html
16652 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
16653 </p>
16654 !! end
16655
16656 # In HTML5, the restrictions are that id must contain at least one character,
16657 # and must not contain any space characters.
16658 !! test
16659 Sanitizer: Validating the contents of the id attribute (bug 4515)
16660 !! options
16661 disabled
16662 !! wikitext
16663 <br id="" /><br id="a space" />
16664 !! html
16665 Something ...
16666 !! end
16667
16668 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
16669 !! test
16670 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
16671 !! options
16672 disabled
16673 !! wikitext
16674 <br id="foo" /><br id="foo" />
16675 !! html
16676 Something need to be done. foo-2 ?
16677 !! end
16678
16679 !! test
16680 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
16681 !! wikitext
16682 <div itemscope>
16683 <meta itemprop="hello" content="world">
16684 <meta http-equiv="refresh" content="5">
16685 <meta itemprop="hello" http-equiv="refresh" content="5">
16686 <link itemprop="hello" href="{{SERVER}}">
16687 <link rel="stylesheet" href="{{SERVER}}">
16688 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
16689 </div>
16690 !! html
16691 <div itemscope="">
16692 <p> <meta itemprop="hello" content="world" />
16693 &lt;meta http-equiv="refresh" content="5"&gt;
16694 <meta itemprop="hello" content="5" />
16695 </p>
16696 <link itemprop="hello" href="http&#58;//example.org" />
16697 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
16698 <link itemprop="hello" href="http&#58;//example.org" />
16699 </div>
16700
16701 !! end
16702
16703 !! test
16704 Language converter: output gets cut off unexpectedly (bug 5757)
16705 !! options
16706 language=zh
16707 !! wikitext
16708 this bit is safe: }-
16709
16710 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
16711
16712 then we get cut off here: }-
16713
16714 all additional text is vanished
16715 !! html
16716 <p>this bit is safe: }-
16717 </p><p>but if we add a conversion instance: xxx
16718 </p><p>then we get cut off here: }-
16719 </p><p>all additional text is vanished
16720 </p>
16721 !! end
16722
16723 !! test
16724 Self closed html pairs (bug 5487)
16725 !! options
16726 !! wikitext
16727 <center><font id="bug" />Centered text</center>
16728 <div><font id="bug2" />In div text</div>
16729 !! html
16730 <center>&lt;font id="bug" /&gt;Centered text</center>
16731 <div>&lt;font id="bug2" /&gt;In div text</div>
16732
16733 !! end
16734
16735 #
16736 #
16737 #
16738
16739 !! test
16740 Punctuation: nbsp before exclamation
16741 !! wikitext
16742 C'est grave !
16743 !! html
16744 <p>C'est grave&#160;!
16745 </p>
16746 !! end
16747
16748 !! test
16749 Punctuation: CSS !important (bug 11874)
16750 !! wikitext
16751 <div style="width:50% !important">important</div>
16752 !! html
16753 <div style="width:50% !important">important</div>
16754
16755 !!end
16756
16757 !! test
16758 Punctuation: CSS ! important (bug 11874; with space after)
16759 !! wikitext
16760 <div style="width:50% ! important">important</div>
16761 !! html
16762 <div style="width:50% ! important">important</div>
16763
16764 !!end
16765
16766 !! test
16767 HTML bullet list, closed tags (bug 5497)
16768 !! wikitext
16769 <ul>
16770 <li>One</li>
16771 <li>Two</li>
16772 </ul>
16773 !! html/php
16774 <ul>
16775 <li>One</li>
16776 <li>Two</li>
16777 </ul>
16778
16779 !! html/parsoid
16780 <ul data-parsoid='{"stx":"html"}'>
16781 <li data-parsoid='{"stx":"html"}'>One</li>
16782 <li data-parsoid='{"stx":"html"}'>Two</li>
16783 </ul>
16784
16785 !! end
16786
16787 !! test
16788 HTML bullet list, unclosed tags (bug 5497)
16789 !! wikitext
16790 <ul>
16791 <li>One
16792 <li>Two
16793 </ul>
16794 !! html/php+tidy
16795 <ul>
16796 <li>One</li>
16797 <li>Two</li>
16798 </ul>
16799 !! html/parsoid
16800 <ul data-parsoid='{"stx":"html"}'>
16801 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16802 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16803 </ul>
16804
16805 !! end
16806
16807 !! test
16808 HTML ordered list, closed tags (bug 5497)
16809 !! wikitext
16810 <ol>
16811 <li>One</li>
16812 <li>Two</li>
16813 </ol>
16814 !! html/php
16815 <ol>
16816 <li>One</li>
16817 <li>Two</li>
16818 </ol>
16819
16820 !! html/parsoid
16821 <ol data-parsoid='{"stx":"html"}'>
16822 <li data-parsoid='{"stx":"html"}'>One</li>
16823 <li data-parsoid='{"stx":"html"}'>Two</li>
16824 </ol>
16825
16826 !! end
16827
16828 !! test
16829 HTML ordered list, unclosed tags (bug 5497)
16830 !! options
16831 !! wikitext
16832 <ol>
16833 <li>One
16834 <li>Two
16835 </ol>
16836 !! html/php+tidy
16837 <ol>
16838 <li>One</li>
16839 <li>Two</li>
16840 </ol>
16841 !! html/parsoid
16842 <ol data-parsoid='{"stx":"html"}'>
16843 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16844 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16845 </ol>
16846
16847 !! end
16848
16849 !! test
16850 HTML nested bullet list, closed tags (bug 5497)
16851 !! wikitext
16852 <ul>
16853 <li>One</li>
16854 <li>Two:
16855 <ul>
16856 <li>Sub-one</li>
16857 <li>Sub-two</li>
16858 </ul>
16859 </li>
16860 </ul>
16861 !! html
16862 <ul>
16863 <li>One</li>
16864 <li>Two:
16865 <ul>
16866 <li>Sub-one</li>
16867 <li>Sub-two</li>
16868 </ul>
16869 </li>
16870 </ul>
16871
16872 !! end
16873
16874 !! test
16875 HTML nested bullet list, open tags (bug 5497)
16876 !! wikitext
16877 <ul>
16878 <li>One
16879 <li>Two:
16880 <ul>
16881 <li>Sub-one
16882 <li>Sub-two
16883 </ul>
16884 </ul>
16885 !! html/php+tidy
16886 <ul>
16887 <li>One</li>
16888 <li>Two:
16889 <ul>
16890 <li>Sub-one</li>
16891 <li>Sub-two</li>
16892 </ul>
16893 </li>
16894 </ul>
16895 !! html/parsoid
16896 <ul>
16897 <li>One
16898 </li>
16899 <li>Two:
16900 <ul>
16901 <li>Sub-one
16902 </li>
16903 <li>Sub-two
16904 </li>
16905 </ul>
16906 </li>
16907 </ul>
16908
16909 !! end
16910
16911 !! test
16912 HTML nested ordered list, closed tags (bug 5497)
16913 !! wikitext
16914 <ol>
16915 <li>One</li>
16916 <li>Two:
16917 <ol>
16918 <li>Sub-one</li>
16919 <li>Sub-two</li>
16920 </ol>
16921 </li>
16922 </ol>
16923 !! html
16924 <ol>
16925 <li>One</li>
16926 <li>Two:
16927 <ol>
16928 <li>Sub-one</li>
16929 <li>Sub-two</li>
16930 </ol>
16931 </li>
16932 </ol>
16933
16934 !! end
16935
16936 !! test
16937 HTML nested ordered list, open tags (bug 5497)
16938 !! wikitext
16939 <ol>
16940 <li>One
16941 <li>Two:
16942 <ol>
16943 <li>Sub-one
16944 <li>Sub-two
16945 </ol>
16946 </ol>
16947 !! html/php
16948 <ol>
16949 <li>One
16950 <li>Two:
16951 <ol>
16952 <li>Sub-one
16953 <li>Sub-two
16954 </ol>
16955 </ol>
16956
16957 !! html/parsoid
16958 <ol>
16959 <li>One
16960 </li>
16961 <li>Two:
16962 <ol>
16963 <li>Sub-one
16964 </li>
16965 <li>Sub-two
16966 </li>
16967 </ol>
16968 </li>
16969 </ol>
16970
16971 !! end
16972
16973 !! test
16974 HTML ordered list item with parameters oddity
16975 !! wikitext
16976 <ol><li id="fragment">One</li>
16977 </ol>
16978 !! html
16979 <ol><li id="fragment">One</li>
16980 </ol>
16981
16982 !! end
16983
16984 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
16985 !!test
16986 bug 5918: autonumbering
16987 !! wikitext
16988 [http://first/] [http://second] [ftp://ftp]
16989
16990 ftp://inlineftp
16991
16992 [mailto:enclosed@mail.tld With target]
16993
16994 [mailto:enclosed@mail.tld]
16995
16996 mailto:inline@mail.tld
16997 !! html/php
16998 <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>
16999 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
17000 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
17001 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
17002 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
17003 </p>
17004 !! html/parsoid
17005 <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>
17006 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
17007 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
17008 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
17009 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
17010 !! end
17011
17012
17013 #
17014 # Security and HTML correctness
17015 # From Nick Jenkins' fuzz testing
17016 #
17017
17018 !! test
17019 Fuzz testing: Parser13
17020 !! wikitext
17021 {|
17022 | http://a|
17023 !! html
17024 <table>
17025 <tr>
17026 <td>
17027 </td>
17028 </tr>
17029 </table>
17030
17031 !! end
17032
17033 !! test
17034 Fuzz testing: Parser14
17035 !! wikitext
17036 == onmouseover= ==
17037 http://__TOC__
17038 !! html
17039 <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>
17040 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17041 <ul>
17042 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17043 </ul>
17044 </div>
17045
17046
17047 !! html+tidy
17048 <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>
17049 <p>http://</p>
17050 <div id="toc" class="toc">
17051 <div id="toctitle">
17052 <h2>Contents</h2>
17053 </div>
17054 <ul>
17055 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17056 </ul>
17057 </div>
17058 <p></p>
17059 !! end
17060
17061 !! test
17062 Fuzz testing: Parser14-table
17063 !! options
17064 parsoid=wt2html,html2html
17065 !! wikitext
17066 ==a==
17067 {| STYLE=__TOC__
17068 !! html
17069 <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>
17070 <table style="&#95;_TOC&#95;_">
17071 <tr><td></td></tr>
17072 </table>
17073
17074 !! html+tidy
17075 <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>
17076 <table style="__TOC__">
17077 <tr>
17078 <td></td>
17079 </tr>
17080 </table>
17081 !! html/parsoid
17082 <h2>a</h2>
17083 <table style="__TOC__"></table>
17084 !! end
17085
17086 # Known to produce bogus xml (extra </td>)
17087 !! test
17088 Fuzz testing: Parser16
17089 !! wikitext
17090 {|
17091 !https://||||||
17092 !! html
17093 <table>
17094 <tr>
17095 <th>https://</th>
17096 <th></th>
17097 <th></th>
17098 <th>
17099 </td>
17100 </tr>
17101 </table>
17102
17103 !! html+tidy
17104 <table>
17105 <tr>
17106 <th>https://</th>
17107 <th></th>
17108 <th></th>
17109 <th></th>
17110 </tr>
17111 </table>
17112 !! end
17113
17114 !! test
17115 Fuzz testing: Parser21
17116 !! wikitext
17117 {|
17118 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17119 |
17120 !! html
17121 <table>
17122 <tr>
17123 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17124 </th>
17125 <td>
17126 </td>
17127 </tr>
17128 </table>
17129
17130 !! end
17131
17132 !! test
17133 Fuzz testing: Parser22
17134 !! wikitext
17135 http://===r:::https://b
17136
17137 {|
17138 !! html
17139 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17140 </p>
17141 <table>
17142 <tr><td></td></tr>
17143 </table>
17144
17145 !! end
17146
17147 # Known to produce bad XML for now
17148 !! test
17149 Fuzz testing: Parser24
17150 !! wikitext
17151 {|
17152 {{{|
17153 <u CLASS=
17154 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17155 <br style="onmouseover='alert(document.cookie);' " />
17156
17157 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17158 |
17159 !! html
17160 <table>
17161 {{{|
17162 <u class="&#124;">}}}} &gt;
17163 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17164
17165 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17166 <tr>
17167 <td></u>
17168 </td>
17169 </tr>
17170 </table>
17171
17172 !! end
17173
17174 # Note: the current result listed for this is not what the original one was,
17175 # but the original bug was JavaScript injection, which is fixed in any case.
17176 # It's not clear that the original result listed was any more correct than the
17177 # current one. Original result:
17178 # <p>{{{|
17179 # </p>
17180 # <li class="&#124;&#124;">
17181 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17182 !!test
17183 Fuzz testing: Parser25 (bug 6055)
17184 !! wikitext
17185 {{{
17186 |
17187 <LI CLASS=||
17188 >
17189 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17190 !! html
17191 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17192 </p>
17193 !! end
17194
17195 !!test
17196 Fuzz testing: URL adjacent extension (with space, clean)
17197 !! wikitext
17198 http://example.com <nowiki>junk</nowiki>
17199 !! html/php
17200 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17201 </p>
17202 !! html/parsoid
17203 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17204 !! end
17205
17206 !!test
17207 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17208 !! wikitext
17209 http://example.com<nowiki>junk</nowiki>
17210 !! html/php
17211 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17212 </p>
17213 !! html/parsoid
17214 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17215 !! end
17216
17217 !!test
17218 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17219 !! wikitext
17220 http://example.com<pre>junk</pre>
17221 !! html/php
17222 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17223
17224 !! html/php+tidy
17225 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17226 <pre>
17227 junk
17228 </pre>
17229 !! html/parsoid
17230 <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>
17231 !!end
17232
17233 !!test
17234 Fuzz testing: image with bogus manual thumbnail
17235 !! wikitext
17236 [[Image:foobar.jpg|thumbnail= ]]
17237 !! html/php
17238 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17239
17240 !! html/parsoid
17241 <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>
17242 !!end
17243
17244 !! test
17245 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17246 !! wikitext
17247 <pre dir="&#10;"></pre>
17248 !! html
17249 <pre dir="&#10;"></pre>
17250
17251 !! end
17252
17253 !! test
17254 Parsing optional HTML elements (Bug 6171)
17255 !! options
17256 !! wikitext
17257 <table>
17258 <tr>
17259 <td> Some tabular data</td>
17260 <td> More tabular data ...
17261 <td> And yet som tabular data</td>
17262 </tr>
17263 </table>
17264 !! html
17265 <table>
17266 <tr>
17267 <td> Some tabular data</td>
17268 <td> More tabular data ...
17269 </td><td> And yet som tabular data</td>
17270 </tr>
17271 </table>
17272
17273 !! end
17274
17275 !! test
17276 Correct handling of <td>, <tr> (Bug 6171)
17277 !! options
17278 !! wikitext
17279 <table>
17280 <tr>
17281 <td> Some tabular data</td>
17282 <td> More tabular data ...</td>
17283 <td> And yet som tabular data</td>
17284 </tr>
17285 </table>
17286 !! html
17287 <table>
17288 <tr>
17289 <td> Some tabular data</td>
17290 <td> More tabular data ...</td>
17291 <td> And yet som tabular data</td>
17292 </tr>
17293 </table>
17294
17295 !! end
17296
17297
17298 !! test
17299 Parsing crashing regression (fr:JavaScript)
17300 !! wikitext
17301 </body></x>
17302 !! html
17303 <p>&lt;/body&gt;&lt;/x&gt;
17304 </p>
17305 !! end
17306
17307 !! test
17308 Inline wiki vs wiki block nesting
17309 !! wikitext
17310 '''Bold paragraph
17311
17312 New wiki paragraph
17313 !! html
17314 <p><b>Bold paragraph</b>
17315 </p><p>New wiki paragraph
17316 </p>
17317 !! end
17318
17319 # FIXME: The current php output is documented
17320 # and desired output is the parsoid target.
17321 !! test
17322 Inline HTML vs wiki block nesting
17323 !! wikitext
17324 <b>Bold paragraph
17325
17326 New wiki paragraph
17327 !! html/php
17328 <p><b>Bold paragraph
17329 </p><p>New wiki paragraph</b>
17330 </p>
17331 !! html/parsoid
17332 <p><b>Bold paragraph</b>
17333 </p><p>New wiki paragraph
17334 </p>
17335 !! end
17336
17337 # Original result was this:
17338 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
17339 # </p>
17340 # While that might be marginally more intuitive, maybe, the six-apostrophe
17341 # construct is clearly pathological and the result stated here (which is what
17342 # the parser actually does) is about as reasonable as anything.
17343 !!test
17344 Mixing markup for italics and bold
17345 !! options
17346 !! wikitext
17347 '''bold''''''bold''bolditalics'''''
17348 !! html
17349 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
17350 </p>
17351 !! end
17352
17353
17354 !! article
17355 Xyzzyx
17356 !! text
17357 Article for special page transclusion test
17358 !! endarticle
17359
17360 !! test
17361 Special page transclusion
17362 !! options
17363 !! wikitext
17364 {{Special:Prefixindex/Xyzzyx}}
17365 !! html
17366 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17367 </ul>
17368
17369 !! end
17370
17371 !! test
17372 Special page transclusion twice (bug 5021)
17373 !! options
17374 !! wikitext
17375 {{Special:Prefixindex/Xyzzyx}}
17376 {{Special:Prefixindex/Xyzzyx}}
17377 !! html
17378 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17379 </ul>
17380 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17381 </ul>
17382
17383 !! end
17384
17385 !! test
17386 Transclusion of default MediaWiki message
17387 !! wikitext
17388 {{MediaWiki:Mainpage}}
17389 !! html
17390 <p>Main Page
17391 </p>
17392 !! end
17393
17394 !! test
17395 Transclusion of nonexistent MediaWiki message
17396 !! wikitext
17397 {{MediaWiki:Mainpagexxx}}
17398 !! html
17399 <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>
17400 </p>
17401 !! end
17402
17403 !! test
17404 Transclusion of MediaWiki message with underscore
17405 !! wikitext
17406 {{MediaWiki:history_short}}
17407 !! html
17408 <p>History
17409 </p>
17410 !! end
17411
17412 !! test
17413 Transclusion of MediaWiki message with space
17414 !! wikitext
17415 {{MediaWiki:history short}}
17416 !! html
17417 <p>History
17418 </p>
17419 !! end
17420
17421 !! test
17422 Invalid header with following text
17423 !! wikitext
17424 = x = y
17425 !! html
17426 <p>= x = y
17427 </p>
17428 !! end
17429
17430
17431 !! test
17432 Section extraction test (section 0)
17433 !! options
17434 section=0
17435 !! wikitext
17436 start
17437 ==a==
17438 ===aa===
17439 ====aaa====
17440 ==b==
17441 ===ba===
17442 ===bb===
17443 ====bba====
17444 ===bc===
17445 ==c==
17446 ===ca===
17447 !! html/php
17448 start
17449 !! end
17450
17451 !! test
17452 Section extraction test (section 1)
17453 !! options
17454 section=1
17455 !! wikitext
17456 start
17457 ==a==
17458 ===aa===
17459 ====aaa====
17460 ==b==
17461 ===ba===
17462 ===bb===
17463 ====bba====
17464 ===bc===
17465 ==c==
17466 ===ca===
17467 !! html/php
17468 ==a==
17469 ===aa===
17470 ====aaa====
17471 !! end
17472
17473 !! test
17474 Section extraction test (section 2)
17475 !! options
17476 section=2
17477 !! wikitext
17478 start
17479 ==a==
17480 ===aa===
17481 ====aaa====
17482 ==b==
17483 ===ba===
17484 ===bb===
17485 ====bba====
17486 ===bc===
17487 ==c==
17488 ===ca===
17489 !! html/php
17490 ===aa===
17491 ====aaa====
17492 !! end
17493
17494 !! test
17495 Section extraction test (section 3)
17496 !! options
17497 section=3
17498 !! wikitext
17499 start
17500 ==a==
17501 ===aa===
17502 ====aaa====
17503 ==b==
17504 ===ba===
17505 ===bb===
17506 ====bba====
17507 ===bc===
17508 ==c==
17509 ===ca===
17510 !! html/php
17511 ====aaa====
17512 !! end
17513
17514 !! test
17515 Section extraction test (section 4)
17516 !! options
17517 section=4
17518 !! wikitext
17519 start
17520 ==a==
17521 ===aa===
17522 ====aaa====
17523 ==b==
17524 ===ba===
17525 ===bb===
17526 ====bba====
17527 ===bc===
17528 ==c==
17529 ===ca===
17530 !! html/php
17531 ==b==
17532 ===ba===
17533 ===bb===
17534 ====bba====
17535 ===bc===
17536 !! end
17537
17538 !! test
17539 Section extraction test (section 5)
17540 !! options
17541 section=5
17542 !! wikitext
17543 start
17544 ==a==
17545 ===aa===
17546 ====aaa====
17547 ==b==
17548 ===ba===
17549 ===bb===
17550 ====bba====
17551 ===bc===
17552 ==c==
17553 ===ca===
17554 !! html/php
17555 ===ba===
17556 !! end
17557
17558 !! test
17559 Section extraction test (section 6)
17560 !! options
17561 section=6
17562 !! wikitext
17563 start
17564 ==a==
17565 ===aa===
17566 ====aaa====
17567 ==b==
17568 ===ba===
17569 ===bb===
17570 ====bba====
17571 ===bc===
17572 ==c==
17573 ===ca===
17574 !! html/php
17575 ===bb===
17576 ====bba====
17577 !! end
17578
17579 !! test
17580 Section extraction test (section 7)
17581 !! options
17582 section=7
17583 !! wikitext
17584 start
17585 ==a==
17586 ===aa===
17587 ====aaa====
17588 ==b==
17589 ===ba===
17590 ===bb===
17591 ====bba====
17592 ===bc===
17593 ==c==
17594 ===ca===
17595 !! html/php
17596 ====bba====
17597 !! end
17598
17599 !! test
17600 Section extraction test (section 8)
17601 !! options
17602 section=8
17603 !! wikitext
17604 start
17605 ==a==
17606 ===aa===
17607 ====aaa====
17608 ==b==
17609 ===ba===
17610 ===bb===
17611 ====bba====
17612 ===bc===
17613 ==c==
17614 ===ca===
17615 !! html/php
17616 ===bc===
17617 !! end
17618
17619 !! test
17620 Section extraction test (section 9)
17621 !! options
17622 section=9
17623 !! wikitext
17624 start
17625 ==a==
17626 ===aa===
17627 ====aaa====
17628 ==b==
17629 ===ba===
17630 ===bb===
17631 ====bba====
17632 ===bc===
17633 ==c==
17634 ===ca===
17635 !! html/php
17636 ==c==
17637 ===ca===
17638 !! end
17639
17640 !! test
17641 Section extraction test (section 10)
17642 !! options
17643 section=10
17644 !! wikitext
17645 start
17646 ==a==
17647 ===aa===
17648 ====aaa====
17649 ==b==
17650 ===ba===
17651 ===bb===
17652 ====bba====
17653 ===bc===
17654 ==c==
17655 ===ca===
17656 !! html/php
17657 ===ca===
17658 !! end
17659
17660 !! test
17661 Section extraction test (nonexistent section 11)
17662 !! options
17663 section=11
17664 !! wikitext
17665 start
17666 ==a==
17667 ===aa===
17668 ====aaa====
17669 ==b==
17670 ===ba===
17671 ===bb===
17672 ====bba====
17673 ===bc===
17674 ==c==
17675 ===ca===
17676 !! html/php
17677 !! end
17678
17679 !! test
17680 Section extraction test with bogus heading (section 1)
17681 !! options
17682 section=1
17683 !! wikitext
17684 ==a==
17685 ==bogus== not a legal section
17686 ==b==
17687 !! html/php
17688 ==a==
17689 ==bogus== not a legal section
17690 !! end
17691
17692 !! test
17693 Section extraction test with bogus heading (section 2)
17694 !! options
17695 section=2
17696 !! wikitext
17697 ==a==
17698 ==bogus== not a legal section
17699 ==b==
17700 !! html/php
17701 ==b==
17702 !! end
17703
17704 !! test
17705 Section extraction test with comment after heading (section 1)
17706 !! options
17707 section=1
17708 !! wikitext
17709 ==a==
17710 ==b== <!-- -->
17711 ==c==
17712 !! html/php
17713 ==a==
17714 !! end
17715
17716 !! test
17717 Section extraction test with comment after heading (section 2)
17718 !! options
17719 section=2
17720 !! wikitext
17721 ==a==
17722 ==b== <!-- -->
17723 ==c==
17724 !! html/php
17725 ==b== <!-- -->
17726 !! end
17727
17728 !! test
17729 Section extraction test with bogus <nowiki> heading (section 1)
17730 !! options
17731 section=1
17732 !! wikitext
17733 ==a==
17734 ==bogus== <nowiki>not a legal section</nowiki>
17735 ==b==
17736 !! html/php
17737 ==a==
17738 ==bogus== <nowiki>not a legal section</nowiki>
17739 !! end
17740
17741 !! test
17742 Section extraction test with bogus <nowiki> heading (section 2)
17743 !! options
17744 section=2
17745 !! wikitext
17746 ==a==
17747 ==bogus== <nowiki>not a legal section</nowiki>
17748 ==b==
17749 !! html/php
17750 ==b==
17751 !! end
17752
17753 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
17754 # instead of respecting commented sections
17755 !! test
17756 Section extraction prefixed by comment (section 1)
17757 !! options
17758 section=1
17759 !! wikitext
17760 <!-- -->==sec1==
17761 ==sec2==
17762 !! html/php
17763 ==sec2==
17764 !!end
17765
17766 !! test
17767 Section extraction prefixed by comment (section 2)
17768 !! options
17769 section=2
17770 !! wikitext
17771 <!-- -->==sec1==
17772 ==sec2==
17773 !! html/php
17774
17775 !!end
17776
17777 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
17778 # instead of respecting HTML-style headings
17779 !! test
17780 Section extraction, mixed wiki and html (section 1)
17781 !! options
17782 section=1
17783 !! wikitext
17784 <h2>unmarked</h2>
17785 unmarked
17786 ==1==
17787 one
17788 ==2==
17789 two
17790 !! html/php
17791 ==1==
17792 one
17793 !! end
17794
17795 !! test
17796 Section extraction, mixed wiki and html (section 2)
17797 !! options
17798 section=2
17799 !! wikitext
17800 <h2>unmarked</h2>
17801 unmarked
17802 ==1==
17803 one
17804 ==2==
17805 two
17806 !! html/php
17807 ==2==
17808 two
17809 !! end
17810
17811
17812 # Formerly testing for bug 3342
17813 !! test
17814 Section extraction, heading surrounded by <noinclude>
17815 !! options
17816 section=1
17817 !! wikitext
17818 <noinclude>==unmarked==</noinclude>
17819 ==marked==
17820 !! html/php
17821 ==marked==
17822 !!end
17823
17824 # Test behavior of bug 19910
17825 !! test
17826 Sectiion with all-equals
17827 !! options
17828 section=2
17829 !! wikitext
17830 ===
17831 The line above must have a trailing space
17832 === <!--
17833 --> <!-- -->
17834 But just in case it doesn't...
17835 !! html/php
17836 === <!--
17837 --> <!-- -->
17838 But just in case it doesn't...
17839 !! end
17840
17841 !! test
17842 Section replacement test (section 0)
17843 !! options
17844 replace=0,"xxx"
17845 !! wikitext
17846 start
17847 ==a==
17848 ===aa===
17849 ====aaa====
17850 ==b==
17851 ===ba===
17852 ===bb===
17853 ====bba====
17854 ===bc===
17855 ==c==
17856 ===ca===
17857 !! html/php
17858 xxx
17859
17860 ==a==
17861 ===aa===
17862 ====aaa====
17863 ==b==
17864 ===ba===
17865 ===bb===
17866 ====bba====
17867 ===bc===
17868 ==c==
17869 ===ca===
17870 !! end
17871
17872 !! test
17873 Section replacement test (section 1)
17874 !! options
17875 replace=1,"xxx"
17876 !! wikitext
17877 start
17878 ==a==
17879 ===aa===
17880 ====aaa====
17881 ==b==
17882 ===ba===
17883 ===bb===
17884 ====bba====
17885 ===bc===
17886 ==c==
17887 ===ca===
17888 !! html/php
17889 start
17890 xxx
17891
17892 ==b==
17893 ===ba===
17894 ===bb===
17895 ====bba====
17896 ===bc===
17897 ==c==
17898 ===ca===
17899 !! end
17900
17901 !! test
17902 Section replacement test (section 2)
17903 !! options
17904 replace=2,"xxx"
17905 !! wikitext
17906 start
17907 ==a==
17908 ===aa===
17909 ====aaa====
17910 ==b==
17911 ===ba===
17912 ===bb===
17913 ====bba====
17914 ===bc===
17915 ==c==
17916 ===ca===
17917 !! html/php
17918 start
17919 ==a==
17920 xxx
17921
17922 ==b==
17923 ===ba===
17924 ===bb===
17925 ====bba====
17926 ===bc===
17927 ==c==
17928 ===ca===
17929 !! end
17930
17931 !! test
17932 Section replacement test (section 3)
17933 !! options
17934 replace=3,"xxx"
17935 !! wikitext
17936 start
17937 ==a==
17938 ===aa===
17939 ====aaa====
17940 ==b==
17941 ===ba===
17942 ===bb===
17943 ====bba====
17944 ===bc===
17945 ==c==
17946 ===ca===
17947 !! html/php
17948 start
17949 ==a==
17950 ===aa===
17951 xxx
17952
17953 ==b==
17954 ===ba===
17955 ===bb===
17956 ====bba====
17957 ===bc===
17958 ==c==
17959 ===ca===
17960 !! end
17961
17962 !! test
17963 Section replacement test (section 4)
17964 !! options
17965 replace=4,"xxx"
17966 !! wikitext
17967 start
17968 ==a==
17969 ===aa===
17970 ====aaa====
17971 ==b==
17972 ===ba===
17973 ===bb===
17974 ====bba====
17975 ===bc===
17976 ==c==
17977 ===ca===
17978 !! html/php
17979 start
17980 ==a==
17981 ===aa===
17982 ====aaa====
17983 xxx
17984
17985 ==c==
17986 ===ca===
17987 !! end
17988
17989 !! test
17990 Section replacement test (section 5)
17991 !! options
17992 replace=5,"xxx"
17993 !! wikitext
17994 start
17995 ==a==
17996 ===aa===
17997 ====aaa====
17998 ==b==
17999 ===ba===
18000 ===bb===
18001 ====bba====
18002 ===bc===
18003 ==c==
18004 ===ca===
18005 !! html/php
18006 start
18007 ==a==
18008 ===aa===
18009 ====aaa====
18010 ==b==
18011 xxx
18012
18013 ===bb===
18014 ====bba====
18015 ===bc===
18016 ==c==
18017 ===ca===
18018 !! end
18019
18020 !! test
18021 Section replacement test (section 6)
18022 !! options
18023 replace=6,"xxx"
18024 !! wikitext
18025 start
18026 ==a==
18027 ===aa===
18028 ====aaa====
18029 ==b==
18030 ===ba===
18031 ===bb===
18032 ====bba====
18033 ===bc===
18034 ==c==
18035 ===ca===
18036 !! html/php
18037 start
18038 ==a==
18039 ===aa===
18040 ====aaa====
18041 ==b==
18042 ===ba===
18043 xxx
18044
18045 ===bc===
18046 ==c==
18047 ===ca===
18048 !! end
18049
18050 !! test
18051 Section replacement test (section 7)
18052 !! options
18053 replace=7,"xxx"
18054 !! wikitext
18055 start
18056 ==a==
18057 ===aa===
18058 ====aaa====
18059 ==b==
18060 ===ba===
18061 ===bb===
18062 ====bba====
18063 ===bc===
18064 ==c==
18065 ===ca===
18066 !! html/php
18067 start
18068 ==a==
18069 ===aa===
18070 ====aaa====
18071 ==b==
18072 ===ba===
18073 ===bb===
18074 xxx
18075
18076 ===bc===
18077 ==c==
18078 ===ca===
18079 !! end
18080
18081 !! test
18082 Section replacement test (section 8)
18083 !! options
18084 replace=8,"xxx"
18085 !! wikitext
18086 start
18087 ==a==
18088 ===aa===
18089 ====aaa====
18090 ==b==
18091 ===ba===
18092 ===bb===
18093 ====bba====
18094 ===bc===
18095 ==c==
18096 ===ca===
18097 !! html/php
18098 start
18099 ==a==
18100 ===aa===
18101 ====aaa====
18102 ==b==
18103 ===ba===
18104 ===bb===
18105 ====bba====
18106 xxx
18107
18108 ==c==
18109 ===ca===
18110 !!end
18111
18112 !! test
18113 Section replacement test (section 9)
18114 !! options
18115 replace=9,"xxx"
18116 !! wikitext
18117 start
18118 ==a==
18119 ===aa===
18120 ====aaa====
18121 ==b==
18122 ===ba===
18123 ===bb===
18124 ====bba====
18125 ===bc===
18126 ==c==
18127 ===ca===
18128 !! html/php
18129 start
18130 ==a==
18131 ===aa===
18132 ====aaa====
18133 ==b==
18134 ===ba===
18135 ===bb===
18136 ====bba====
18137 ===bc===
18138 xxx
18139 !! end
18140
18141 !! test
18142 Section replacement test (section 10)
18143 !! options
18144 replace=10,"xxx"
18145 !! wikitext
18146 start
18147 ==a==
18148 ===aa===
18149 ====aaa====
18150 ==b==
18151 ===ba===
18152 ===bb===
18153 ====bba====
18154 ===bc===
18155 ==c==
18156 ===ca===
18157 !! html/php
18158 start
18159 ==a==
18160 ===aa===
18161 ====aaa====
18162 ==b==
18163 ===ba===
18164 ===bb===
18165 ====bba====
18166 ===bc===
18167 ==c==
18168 xxx
18169 !! end
18170
18171 !! test
18172 Section replacement test with initial whitespace (bug 13728)
18173 !! options
18174 replace=2,"xxx"
18175 !! wikitext
18176 Preformatted initial line
18177 ==a==
18178 ===a===
18179 !! html/php
18180 Preformatted initial line
18181 ==a==
18182 xxx
18183 !! end
18184
18185
18186 !! test
18187 Section extraction, heading followed by pre with 20 spaces (bug 6398)
18188 !! options
18189 section=1
18190 !! wikitext
18191 ==a==
18192 a
18193 !! html/php
18194 ==a==
18195 a
18196 !! end
18197
18198 !! test
18199 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
18200 !! options
18201 section=1
18202 !! wikitext
18203 ==a==
18204 a
18205 !! html/php
18206 ==a==
18207 a
18208 !! end
18209
18210
18211 !! test
18212 Section extraction, <pre> around bogus header (bug 10309)
18213 !! options
18214 section=2
18215 !! wikitext
18216 == Section One ==
18217 <pre>
18218 =======
18219 </pre>
18220
18221 == Section Two ==
18222 stuff
18223 !! html/php
18224 == Section Two ==
18225 stuff
18226 !! end
18227
18228 !! test
18229 Section replacement, <pre> around bogus header (bug 10309)
18230 !! options
18231 replace=2,"xxx"
18232 !! wikitext
18233 == Section One ==
18234 <pre>
18235 =======
18236 </pre>
18237
18238 == Section Two ==
18239 stuff
18240 !! html/php
18241 == Section One ==
18242 <pre>
18243 =======
18244 </pre>
18245
18246 xxx
18247 !! end
18248
18249
18250 !! test
18251 Handling of &#x0A; in URLs
18252 !! wikitext
18253 ** irc://&#x0A;a
18254 !! html/php
18255 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18256
18257 !! html/parsoid
18258 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
18259 a">irc://
18260 a</a></li></ul></li></ul>
18261 !! end
18262
18263 !! test
18264 Handling of %0A in URLs
18265 !! wikitext
18266 ** irc://%0Aa
18267 !! html/php
18268 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18269
18270 !! html/parsoid
18271 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18272 !! end
18273
18274
18275 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18276 !! test
18277 5 quotes, code coverage +1 line
18278 !! options
18279 parsoid=wt2html
18280 !! wikitext
18281 '''''
18282 !! html/php
18283 !! html/parsoid
18284 <p><b><i></i></b></p>
18285 !! end
18286
18287 # same html as previous, but wikitext adjusted to match parsoid html2wt
18288 # note that wt2html and html2html will put the <i> before the <b>
18289 !! test
18290 5 quotes, code coverage +1 line w/ nowiki (1)
18291 !! options
18292 parsoid=wt2wt,html2wt
18293 !! wikitext
18294 '''''<nowiki/>'''''
18295 !! html/php
18296 <p><i></i>
18297 </p>
18298 !! html/parsoid
18299 <p><b><i></i></b></p>
18300 !! end
18301
18302 # same as previous, just swapping the <i> and <b>
18303 !! test
18304 5 quotes, code coverage +1 line w/ nowiki (2)
18305 !! wikitext
18306 '''''<nowiki/>'''''
18307 !! html/php
18308 <p><i></i>
18309 </p>
18310 !! html/parsoid
18311 <p><i><b></b></i></p>
18312 !! end
18313
18314 !! test
18315 Special:Search page linking.
18316 !! wikitext
18317 {{Special:search}}
18318 !! html
18319 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18320 </p>
18321 !! end
18322
18323 !! test
18324 {{!}} is a magic word
18325 !! wikitext
18326 {{!}} is a magic word there and {{!}} is still a magic word here
18327 | is not a magic word here but {{!}} is still a magic word here
18328 !! html/php
18329 <p>| is a magic word there and | is still a magic word here
18330 | is not a magic word here but | is still a magic word here
18331 </p>
18332 !! html/parsoid
18333 <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
18334 | 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>
18335
18336 !! end
18337
18338 !! test
18339 Say the magic word
18340 !! options
18341 title=[[Parser test]]
18342 !! wikitext
18343 * {{PAGENAME}}
18344 * {{PAGENAMEE}}
18345 * {{FULLPAGENAME}}
18346 * {{FULLPAGENAMEE}}
18347 * {{BASEPAGENAME}}
18348 * {{BASEPAGENAMEE}}
18349 * {{SUBPAGENAME}}
18350 * {{SUBPAGENAMEE}}
18351 * {{ROOTPAGENAME}}
18352 * {{ROOTPAGENAMEE}}
18353 * {{TALKPAGENAME}}
18354 * {{TALKPAGENAMEE}}
18355 * {{SUBJECTPAGENAME}}
18356 * {{SUBJECTPAGENAMEE}}
18357 * {{NAMESPACEE}}
18358 * {{NAMESPACE}}
18359 * {{NAMESPACENUMBER}}
18360 * {{TALKSPACE}}
18361 * {{TALKSPACEE}}
18362 * {{SUBJECTSPACE}}
18363 * {{SUBJECTSPACEE}}
18364 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18365 !! html
18366 <ul><li> Parser test</li>
18367 <li> Parser_test</li>
18368 <li> Parser test</li>
18369 <li> Parser_test</li>
18370 <li> Parser test</li>
18371 <li> Parser_test</li>
18372 <li> Parser test</li>
18373 <li> Parser_test</li>
18374 <li> Parser test</li>
18375 <li> Parser_test</li>
18376 <li> Talk:Parser test</li>
18377 <li> Talk:Parser_test</li>
18378 <li> Parser test</li>
18379 <li> Parser_test</li>
18380 <li> </li>
18381 <li> </li>
18382 <li> 0</li>
18383 <li> Talk</li>
18384 <li> Talk</li>
18385 <li> </li>
18386 <li> </li>
18387 <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>
18388
18389 !! end
18390 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18391
18392 !! test
18393 Gallery
18394 !! wikitext
18395 <gallery>
18396 image1.png |
18397 image2.gif|||||
18398
18399 image3|
18400 image4 |300px| centre
18401 image5.svg| http://///////
18402 [[x|xx]]]]
18403 * image6
18404 </gallery>
18405 !! html
18406 <ul class="gallery mw-gallery-traditional">
18407 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18408 <div class="thumb" style="height: 150px;">Image1.png</div>
18409 <div class="gallerytext">
18410 </div>
18411 </div></li>
18412 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18413 <div class="thumb" style="height: 150px;">Image2.gif</div>
18414 <div class="gallerytext">
18415 </div>
18416 </div></li>
18417 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18418 <div class="thumb" style="height: 150px;">Image3</div>
18419 <div class="gallerytext">
18420 </div>
18421 </div></li>
18422 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18423 <div class="thumb" style="height: 150px;">Image4</div>
18424 <div class="gallerytext">
18425 <pre>centre
18426 </pre>
18427 </div>
18428 </div></li>
18429 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18430 <div class="thumb" style="height: 150px;">Image5.svg</div>
18431 <div class="gallerytext">
18432 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
18433 </p>
18434 </div>
18435 </div></li>
18436 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18437 <div class="thumb" style="height: 150px;">* image6</div>
18438 <div class="gallerytext">
18439 </div>
18440 </div></li>
18441 </ul>
18442
18443 !! end
18444
18445 !! test
18446 Gallery (with options)
18447 !! wikitext
18448 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
18449 File:Nonexistent.jpg|caption
18450 File:Nonexistent.jpg
18451 image:foobar.jpg|some '''caption''' [[Main Page]]
18452 image:foobar.jpg
18453 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
18454 </gallery>
18455 !! html
18456 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
18457 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
18458 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18459 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18460 <div class="gallerytext">
18461 <p>caption
18462 </p>
18463 </div>
18464 </div></li>
18465 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18466 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18467 <div class="gallerytext">
18468 </div>
18469 </div></li>
18470 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18471 <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>
18472 <div class="gallerytext">
18473 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18474 </p>
18475 </div>
18476 </div></li>
18477 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18478 <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>
18479 <div class="gallerytext">
18480 </div>
18481 </div></li>
18482 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18483 <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>
18484 <div class="gallerytext">
18485 <p>blabla.
18486 </p>
18487 </div>
18488 </div></li>
18489 </ul>
18490
18491 !! end
18492
18493 !! test
18494 Gallery with link that has fragment
18495 !! wikitext
18496 <gallery>
18497 image:foobar.jpg|link=Main_Page
18498 image:foobar.jpg|link=Main_Page#section
18499 image:foobar.jpg|link=Main Page#section|caption
18500 </gallery>
18501 !! html
18502 <ul class="gallery mw-gallery-traditional">
18503 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18504 <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>
18505 <div class="gallerytext">
18506 </div>
18507 </div></li>
18508 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18509 <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>
18510 <div class="gallerytext">
18511 </div>
18512 </div></li>
18513 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18514 <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>
18515 <div class="gallerytext">
18516 <p>caption
18517 </p>
18518 </div>
18519 </div></li>
18520 </ul>
18521
18522 !! end
18523
18524 !! test
18525 Gallery with wikitext inside caption
18526 !! wikitext
18527 <gallery>
18528 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
18529 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
18530 </gallery>
18531 !! html
18532 <ul class="gallery mw-gallery-traditional">
18533 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18534 <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>
18535 <div class="gallerytext">
18536 <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>
18537 </p>
18538 </div>
18539 </div></li>
18540 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18541 <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>
18542 <div class="gallerytext">
18543 <p>This is a test template
18544 </p>
18545 </div>
18546 </div></li>
18547 </ul>
18548
18549 !! end
18550
18551 !! test
18552 gallery (with showfilename option)
18553 !! wikitext
18554 <gallery showfilename>
18555 File:Nonexistent.jpg|caption
18556 File:Nonexistent.jpg
18557 image:foobar.jpg|some '''caption''' [[Main Page]]
18558 File:Foobar.jpg
18559 </gallery>
18560 !! html
18561 <ul class="gallery mw-gallery-traditional">
18562 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18563 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18564 <div class="gallerytext">
18565 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18566 caption
18567 </p>
18568 </div>
18569 </div></li>
18570 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18571 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18572 <div class="gallerytext">
18573 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18574 </p>
18575 </div>
18576 </div></li>
18577 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18578 <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>
18579 <div class="gallerytext">
18580 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18581 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18582 </p>
18583 </div>
18584 </div></li>
18585 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18586 <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>
18587 <div class="gallerytext">
18588 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18589 </p>
18590 </div>
18591 </div></li>
18592 </ul>
18593
18594 !! end
18595
18596 !! test
18597 Gallery (with namespace-less filenames)
18598 !! wikitext
18599 <gallery>
18600 File:Nonexistent.jpg
18601 Nonexistent.jpg
18602 image:foobar.jpg
18603 foobar.jpg
18604 </gallery>
18605 !! html
18606 <ul class="gallery mw-gallery-traditional">
18607 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18608 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18609 <div class="gallerytext">
18610 </div>
18611 </div></li>
18612 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18613 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18614 <div class="gallerytext">
18615 </div>
18616 </div></li>
18617 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18618 <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>
18619 <div class="gallerytext">
18620 </div>
18621 </div></li>
18622 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18623 <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>
18624 <div class="gallerytext">
18625 </div>
18626 </div></li>
18627 </ul>
18628
18629 !! end
18630
18631 !! test
18632 HTML Hex character encoding (spells the word "JavaScript")
18633 !! options
18634 parsoid=wt2html,wt2wt,html2html
18635 !! wikitext
18636 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
18637 !! html/php
18638 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
18639 </p>
18640 !! html/php+tidy
18641 <p>JavaScript</p>
18642 !! html/parsoid
18643 <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>
18644 !! end
18645
18646 !! test
18647 HTML Hex character encoding bogus encoding (bug 26437 regression check)
18648 !! wikitext
18649 &#xsee;&#XSEE;
18650 !! html/php
18651 <p>&amp;#xsee;&amp;#XSEE;
18652 </p>
18653 !! html/parsoid
18654 <p>&amp;#xsee;&amp;#XSEE;</p>
18655 !! end
18656
18657 !! test
18658 HTML Hex character encoding mixed case
18659 !! options
18660 parsoid=wt2html,wt2wt,html2html
18661 !! wikitext
18662 &#xEE;&#Xee;
18663 !! html/php
18664 <p>&#xee;&#xee;
18665 </p>
18666 !! html/php+tidy
18667 <p>îî</p>
18668 !! html/parsoid
18669 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
18670 !! end
18671
18672 # See: http://www.w3.org/TR/html5/syntax.html#character-references
18673 # Note that U+000C (form feed) is not a valid XML character, so
18674 # it is banned even though allowed in HTML5.
18675 !! test
18676 Illegal character references (T106578)
18677 !! wikitext
18678 ; Null: &#00;
18679 ; FF: &#xC;
18680 ; CR: &#xD;
18681 ; Control (low): &#8;
18682 ; Control (high): &#x7F; &#x9F;
18683 ; Surrogate: &#xD83D;&#xDCA9;
18684 ; This is an okay astral character: &#x1F4A9;
18685 !! html+tidy
18686 <dl>
18687 <dt>Null</dt>
18688 <dd>&amp;#00;</dd>
18689 <dt>FF</dt>
18690 <dd>&amp;#xC;</dd>
18691 <dt>CR</dt>
18692 <dd>&amp;#xD;</dd>
18693 <dt>Control (low)</dt>
18694 <dd>&amp;#8;</dd>
18695 <dt>Control (high)</dt>
18696 <dd>&amp;#x7F; &amp;#x9F;</dd>
18697 <dt>Surrogate</dt>
18698 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
18699 <dt>This is an okay astral character</dt>
18700 <dd>💩</dd>
18701 </dl>
18702 !! end
18703
18704 !! test
18705 __FORCETOC__ override
18706 !! wikitext
18707 __NEWSECTIONLINK__
18708 __FORCETOC__
18709 !! html/php
18710 <p><br />
18711 </p>
18712 !! end
18713
18714 !! test
18715 ISBN code coverage
18716 !! wikitext
18717 ISBN 978-0-1234-56&#x20;789
18718 !! html
18719 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
18720 </p>
18721 !! html+tidy
18722 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
18723 !! html/parsoid
18724 <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>
18725 !! end
18726
18727 !! test
18728 ISBN followed by 5 spaces
18729 !! wikitext
18730 ISBN
18731 !! html
18732 <p>ISBN
18733 </p>
18734 !! end
18735
18736 !! test
18737 Double ISBN
18738 !! wikitext
18739 ISBN ISBN 1234567890
18740 !! html/php
18741 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18742 </p>
18743 !! html/parsoid
18744 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
18745 !! end
18746
18747 # Uppercase X and lowercase x as well
18748 !! test
18749 ISBN with an X
18750 !! wikitext
18751 ISBN 3-462-04561-X
18752 ISBN 3-462-04561-x
18753 ISBN 080442957X
18754 ISBN 080442957x
18755 ISBN 978080442957X
18756 ISBN 978080442957x
18757 !! html/php
18758 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
18759 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
18760 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
18761 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
18762 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
18763 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
18764 </p>
18765 !! html/parsoid
18766 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
18767 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
18768 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
18769 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
18770 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
18771 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
18772 !! end
18773
18774 !! test
18775 ISBN with empty prefix (parsoid test)
18776 !! wikitext
18777 ISBN 1234567890
18778 !! html/php
18779 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18780 </p>
18781 !! html/parsoid
18782 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
18783 !! end
18784
18785 !! test
18786 Bug 22905: <abbr> followed by ISBN followed by </a>
18787 !! wikitext
18788 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
18789 !! html/php
18790 <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>
18791 </p>
18792 !! html/parsoid
18793 <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>
18794 !! end
18795
18796 !! test
18797 Double RFC
18798 !! wikitext
18799 RFC RFC 1234
18800 !! html
18801 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
18802 </p>
18803 !! end
18804
18805 !! test
18806 Double RFC with a wiki link
18807 !! wikitext
18808 RFC [[RFC 1234]]
18809 !! html
18810 <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>
18811 </p>
18812 !! end
18813
18814 !! test
18815 RFC code coverage
18816 !! wikitext
18817 RFC 983&#x20;987
18818 !! html
18819 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
18820 </p>
18821 !! html+tidy
18822 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
18823 !! end
18824
18825 !! test
18826 Centre-aligned image
18827 !! wikitext
18828 [[Image:foobar.jpg|centre]]
18829 !! html
18830 <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>
18831
18832 !!end
18833
18834 !! test
18835 None-aligned image
18836 !! wikitext
18837 [[Image:foobar.jpg|none]]
18838 !! html
18839 <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>
18840
18841 !!end
18842
18843 !! test
18844 Width + Height sized image (using px) (height is ignored)
18845 !! wikitext
18846 [[Image:foobar.jpg|640x480px]]
18847 !! html
18848 <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>
18849 </p>
18850 !!end
18851
18852 !! test
18853 Width-sized image (using px, no following whitespace)
18854 !! wikitext
18855 [[Image:foobar.jpg|640px]]
18856 !! html
18857 <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>
18858 </p>
18859 !!end
18860
18861 !! test
18862 Width-sized image (using px, with following whitespace - test regression from r39467)
18863 !! wikitext
18864 [[Image:foobar.jpg|640px ]]
18865 !! html
18866 <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>
18867 </p>
18868 !!end
18869
18870 !! test
18871 Width-sized image (using px, with preceding whitespace - test regression from r39467)
18872 !! wikitext
18873 [[Image:foobar.jpg| 640px]]
18874 !! html
18875 <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>
18876 </p>
18877 !!end
18878
18879 !! test
18880 Image with page parameter
18881 !! options
18882 djvu
18883 !! wikitext
18884 [[File:LoremIpsum.djvu|page=2]]
18885 !! html/php
18886 <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>
18887 </p>
18888 !! html/parsoid
18889 <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>
18890 !! end
18891
18892 !! test
18893 Another italics / bold test
18894 !! wikitext
18895 ''' ''x'
18896 !! html
18897 <pre>'<i> </i>x'
18898 </pre>
18899 !!end
18900
18901 # FIXME: The php output seems broken. It's interleaving some open/close tags.
18902 !! test
18903 dt/dd/dl test
18904 !! wikitext
18905 :;;;::
18906 !! html/php
18907 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
18908
18909 !! html/parsoid
18910 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
18911
18912 !!end
18913
18914
18915 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
18916 !! test
18917 Images with the "|" character in the comment
18918 !! wikitext
18919 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
18920 !! html/php
18921 <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>
18922
18923 !! html/parsoid
18924 <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>
18925 !! end
18926
18927 !! test
18928 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
18929 !! wikitext
18930 <html><script>alert(1);</script></html>
18931 !! html
18932 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
18933 </p>
18934 !! end
18935
18936 !! test
18937 HTML with raw HTML ($wgRawHtml==true)
18938 !! options
18939 wgRawHtml=1
18940 !! wikitext
18941 <html><script>alert(1);</script></html>
18942 !! html
18943 <p><script>alert(1);</script>
18944 </p>
18945 !! end
18946
18947 !! test
18948 Parents of subpages, one level up
18949 !! options
18950 subpage title=[[Subpage test/L1/L2/L3]]
18951 !! wikitext
18952 [[../|L2]]
18953 !! html
18954 <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>
18955 </p>
18956 !! end
18957
18958
18959 !! test
18960 Parents of subpages, one level up, not named
18961 !! options
18962 subpage title=[[Subpage test/L1/L2/L3]]
18963 !! wikitext
18964 [[../]]
18965 !! html
18966 <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>
18967 </p>
18968 !! end
18969
18970
18971
18972 !! test
18973 Parents of subpages, two levels up
18974 !! options
18975 subpage title=[[Subpage test/L1/L2/L3]]
18976 !! wikitext
18977 [[../../|L1]]2
18978
18979 [[../../|L1]]l
18980 !! html
18981 <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
18982 </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>
18983 </p>
18984 !! end
18985
18986 !! test
18987 Parents of subpages, two levels up, without trailing slash or name.
18988 !! options
18989 subpage title=[[Subpage test/L1/L2/L3]]
18990 !! wikitext
18991 [[../..]]
18992 !! html
18993 <p>[[../..]]
18994 </p>
18995 !! end
18996
18997 !! test
18998 Parents of subpages, two levels up, with lots of extra trailing slashes.
18999 !! options
19000 subpage title=[[Subpage test/L1/L2/L3]]
19001 !! wikitext
19002 [[../../////]]
19003 !! html
19004 <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>
19005 </p>
19006 !! end
19007
19008 !! article
19009 Subpage test/L1/L2/L3Sibling
19010 !! text
19011 Sibling article
19012 !! endarticle
19013
19014 !! test
19015 Transclusion of a sibling page (one level up)
19016 !! options
19017 subpage title=[[Subpage test/L1/L2/L3]]
19018 !! wikitext
19019 {{../L3Sibling}}
19020 !! html
19021 <p>Sibling article
19022 </p>
19023 !! end
19024
19025 !! test
19026 Transclusion of a child page
19027 !! options
19028 subpage title=[[Subpage test/L1/L2]]
19029 !! wikitext
19030 {{/L3Sibling}}
19031 !! html
19032 <p>Sibling article
19033 </p>
19034 !! end
19035
19036 !! test
19037 Non-transclusion because of too many up levels
19038 !! options
19039 subpage title=[[Subpage test/L1/L2/L3]]
19040 !! wikitext
19041 {{../../../../More than parent}}
19042 !! html
19043 <p>{{../../../../More than parent}}
19044 </p>
19045 !! end
19046
19047 !! test
19048 Definition list code coverage
19049 !! wikitext
19050 ; title : def
19051 ; title : def
19052 ;title: def
19053 !! html/php
19054 <dl><dt> title &#160;</dt>
19055 <dd> def</dd>
19056 <dt> title&#160;</dt>
19057 <dd> def</dd>
19058 <dt>title</dt>
19059 <dd> def</dd></dl>
19060
19061 !! html/parsoid
19062 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19063 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19064 <dt>title</dt><dd> def</dd></dl>
19065 !! end
19066
19067 !! test
19068 Don't fall for the self-closing div
19069 !! wikitext
19070 <div>hello world</div/>
19071 !! html
19072 <div>hello world</div>
19073
19074 !! end
19075
19076 !! test
19077 MSGNW magic word
19078 !! wikitext
19079 {{MSGNW:msg}}
19080 !! html/php
19081 <p>&#91;&#91;:Template:Msg&#93;&#93;
19082 </p>
19083 !! end
19084
19085 !! test
19086 RAW magic word
19087 !! wikitext
19088 {{RAW:QUERTY}}
19089 !! html
19090 <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>
19091 </p>
19092 !! end
19093
19094 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
19095 !! test
19096 Always escape literal '>' in output, not just after '<'
19097 !! wikitext
19098 ><>
19099 !! html
19100 <p>&gt;&lt;&gt;
19101 </p>
19102 !! end
19103
19104 !! test
19105 Template caching
19106 !! wikitext
19107 {{Test}}
19108 {{Test}}
19109 !! html
19110 <p>This is a test template
19111 This is a test template
19112 </p>
19113 !! end
19114
19115
19116 !! article
19117 MediaWiki:Fake
19118 !! text
19119 ==header==
19120 !! endarticle
19121
19122 !! test
19123 Inclusion of !userCanEdit() content
19124 !! wikitext
19125 {{MediaWiki:Fake}}
19126 !! html
19127 <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>
19128
19129 !! end
19130
19131
19132 !! test
19133 Out-of-order TOC heading levels
19134 !! wikitext
19135 ==2==
19136 ======6======
19137 ===3===
19138 =1=
19139 =====5=====
19140 ==2==
19141 !! html
19142 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19143 <ul>
19144 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
19145 <ul>
19146 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
19147 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
19148 </ul>
19149 </li>
19150 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
19151 <ul>
19152 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
19153 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
19154 </ul>
19155 </li>
19156 </ul>
19157 </div>
19158
19159 <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>
19160 <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>
19161 <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>
19162 <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>
19163 <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>
19164 <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>
19165
19166 !! end
19167
19168
19169 !! test
19170 ISBN with a dummy number
19171 !! wikitext
19172 ISBN ---
19173 !! html
19174 <p>ISBN ---
19175 </p>
19176 !! end
19177
19178
19179 !! test
19180 ISBN with space-delimited number
19181 !! wikitext
19182 ISBN 92 9017 032 8
19183 !! html
19184 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
19185 </p>
19186 !! end
19187
19188
19189 !! test
19190 ISBN with multiple spaces, no number
19191 !! wikitext
19192 ISBN foo
19193 !! html
19194 <p>ISBN foo
19195 </p>
19196 !! end
19197
19198
19199 !! test
19200 ISBN length
19201 !! wikitext
19202 ISBN 123456789
19203
19204 ISBN 1234567890
19205
19206 ISBN 12345678901
19207 !! html
19208 <p>ISBN 123456789
19209 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19210 </p><p>ISBN 12345678901
19211 </p>
19212 !! end
19213
19214
19215 !! test
19216 ISBN with trailing year (bug 8110)
19217 !! wikitext
19218 ISBN 1-234-56789-0 - 2006
19219
19220 ISBN 1 234 56789 0 - 2006
19221 !! html
19222 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
19223 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
19224 </p>
19225 !! end
19226
19227
19228 !! test
19229 anchorencode
19230 !! wikitext
19231 {{anchorencode:foo bar©#%n}}
19232 !! html
19233 <p>foo_bar.C2.A9.23.25n
19234 </p>
19235 !! end
19236
19237 !! test
19238 anchorencode trims spaces
19239 !! wikitext
19240 {{anchorencode: __pretty__please__}}
19241 !! html
19242 <p>pretty_please
19243 </p>
19244 !! end
19245
19246 !! test
19247 anchorencode deals with links
19248 !! wikitext
19249 {{anchorencode: [[hello|world]] [[hi]]}}
19250 !! html
19251 <p>world_hi
19252 </p>
19253 !! end
19254
19255 !! test
19256 anchorencode deals with templates
19257 !! wikitext
19258 {{anchorencode: {{Foo}} }}
19259 !! html
19260 <p>FOO
19261 </p>
19262 !! end
19263
19264 !! test
19265 anchorencode encodes like the TOC generator: (bug 18431)
19266 !! wikitext
19267 === _ +:.3A%3A&&amp;]] ===
19268 {{anchorencode: _ +:.3A%3A&&amp;]] }}
19269 __NOEDITSECTION__
19270 !! html
19271 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
19272 <p>.2B:.3A.253A.26.26.5D.5D
19273 </p>
19274 !! end
19275
19276 !! test
19277 Bug 6200: blockquotes and paragraph formatting
19278 !! wikitext
19279 <blockquote>
19280 foo
19281 </blockquote>
19282
19283 bar
19284
19285 baz
19286 !! html
19287 <blockquote>
19288 <p>foo
19289 </p>
19290 </blockquote>
19291 <p>bar
19292 </p>
19293 <pre>baz
19294 </pre>
19295 !! end
19296
19297 !! test
19298 Bug 8293: Use of center tag ruins paragraph formatting
19299 !! wikitext
19300 <center>
19301 foo
19302 </center>
19303
19304 bar
19305
19306 baz
19307 !! html
19308 <center>
19309 <p>foo
19310 </p>
19311 </center>
19312 <p>bar
19313 </p>
19314 <pre>baz
19315 </pre>
19316 !! end
19317
19318 !!test
19319 Parsing of overlapping (improperly nested) inline html tags
19320 !! wikitext
19321 <span><s>x</span></s>
19322 !! html/php
19323 <p><span><s>x&lt;/span&gt;</s></span>
19324 </p>
19325 !! html/parsoid
19326 <p><span><s>x</s></span>
19327 </p>
19328 !!end
19329
19330 ###
19331 ### Language variants related tests
19332 ###
19333 !! test
19334 Self-link in language variants
19335 !! options
19336 title=[[Dunav]] language=sr
19337 !! wikitext
19338 Both [[Dunav]] and [[Дунав]] are names for this river.
19339 !! html
19340 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
19341 </p>
19342 !!end
19343
19344 !! article
19345 Дуна
19346 !! text
19347 content
19348 !! endarticle
19349
19350 !! test
19351 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
19352 !! options
19353 title=[[Duna]] language=sr
19354 !! wikitext
19355 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
19356 !! html
19357 <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.
19358 </p>
19359 !! end
19360
19361 !! test
19362 Link to a section of a variant of this title shouldn't be parsed as self-link
19363 !! options
19364 title=[[Duna]] language=sr
19365 !! wikitext
19366 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
19367 !! html
19368 <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.
19369 </p>
19370 !! end
19371
19372 !! test
19373 Link to pages in language variants
19374 !! options
19375 language=sr
19376 !! wikitext
19377 Main Page can be written as [[Маин Паге]]
19378 !! html
19379 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
19380 </p>
19381 !!end
19382
19383
19384 !! test
19385 Multiple links to pages in language variants
19386 !! options
19387 language=sr
19388 !! wikitext
19389 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
19390 !! html
19391 <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>.
19392 </p>
19393 !!end
19394
19395
19396 !! test
19397 Simple template in language variants
19398 !! options
19399 language=sr
19400 !! wikitext
19401 {{тест}}
19402 !! html
19403 <p>This is a test template
19404 </p>
19405 !! end
19406
19407
19408 !! test
19409 Template with explicit namespace in language variants
19410 !! options
19411 language=sr
19412 !! wikitext
19413 {{Template:тест}}
19414 !! html
19415 <p>This is a test template
19416 </p>
19417 !! end
19418
19419
19420 !! test
19421 Basic test for template parameter in language variants
19422 !! options
19423 language=sr
19424 !! wikitext
19425 {{парамтест|param=foo}}
19426 !! html
19427 <p>This is a test template with parameter foo
19428 </p>
19429 !! end
19430
19431
19432 !! test
19433 Simple category in language variants
19434 !! options
19435 language=sr cat
19436 !! wikitext
19437 [[Category:МедиаWики Усер'с Гуиде]]
19438 !! html
19439 <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>
19440 !! end
19441
19442
19443 !! article
19444 Category:分类
19445 !! text
19446 blah
19447 !! endarticle
19448
19449 !! article
19450 Category:分類
19451 !! text
19452 blah
19453 !! endarticle
19454
19455 ## We used to, but no longer wt2wt this test since the default serializer
19456 ## will normalize all categories to serialize on their own line.
19457 ## This wikitext usage is going to be fairly uncommon in production and
19458 ## selser will take care of preserving formatting in those scenarios.
19459 !! test
19460 Don't convert blue categorylinks to another variant (bug 33210)
19461 !! options
19462 cat
19463 language=zh
19464 parsoid=wt2html
19465 !! wikitext
19466 [[A]][[Category:分类]]
19467 !! html/php
19468 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
19469 !! html/parsoid
19470 <p><a rel="mw:WikiLink" href="A" title="A">A</a></p>
19471 <link rel="mw:PageProp/Category" href="Category:分类"/>
19472 !! end
19473
19474 !! test
19475 Stripping -{}- tags (language variants)
19476 !! options
19477 language=sr
19478 !! wikitext
19479 Latin proverb: -{Ne nuntium necare}-
19480 !! html
19481 <p>Latin proverb: Ne nuntium necare
19482 </p>
19483 !! end
19484
19485
19486 !! test
19487 Prevent conversion with -{}- tags (language variants)
19488 !! options
19489 language=sr variant=sr-ec
19490 !! wikitext
19491 Latinski: -{Ne nuntium necare}-
19492 !! html
19493 <p>Латински: Ne nuntium necare
19494 </p>
19495 !! end
19496
19497
19498 !! test
19499 Prevent conversion of text with -{}- tags (language variants)
19500 !! options
19501 language=sr variant=sr-ec
19502 !! wikitext
19503 Latinski: -{Ne nuntium necare}-
19504 !! html
19505 <p>Латински: Ne nuntium necare
19506 </p>
19507 !! end
19508
19509
19510 !! test
19511 Prevent conversion of links with -{}- tags (language variants)
19512 !! options
19513 language=sr variant=sr-ec
19514 !! wikitext
19515 -{[[Main Page]]}-
19516 !! html
19517 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19518 </p>
19519 !! end
19520
19521
19522 !! test
19523 -{}- tags within headlines (within html for parserConvert())
19524 !! options
19525 language=sr variant=sr-ec
19526 !! wikitext
19527 == -{Naslov}- ==
19528 !! html
19529 <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>
19530
19531 !! end
19532
19533
19534 !! test
19535 Explicit definition of language variant alternatives
19536 !! options
19537 language=zh variant=zh-tw
19538 !! wikitext
19539 -{zh:China;zh-tw:Taiwan}-, not China
19540 !! html
19541 <p>Taiwan, not China
19542 </p>
19543 !! end
19544
19545
19546 !! test
19547 Conversion around HTML tags
19548 !! options
19549 language=sr variant=sr-ec
19550 !! wikitext
19551 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
19552 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
19553 !! html
19554 <p>
19555 <span title="ЛаCтин">ски</span>
19556 </p>
19557 !! end
19558
19559
19560 !! test
19561 Explicit session-wise language variant mapping (A flag and - flag)
19562 !! options
19563 language=zh variant=zh-tw
19564 !! wikitext
19565 Taiwan is not China.
19566 But -{A|zh:China;zh-tw:Taiwan}- is China,
19567 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
19568 and -{China}- is China.
19569 !! html
19570 <p>Taiwan is not China.
19571 But Taiwan is Taiwan,
19572 (This should be stripped!)
19573 and China is China.
19574 </p>
19575 !! end
19576
19577 !! test
19578 Explicit session-wise language variant mapping (H flag for hide)
19579 !! options
19580 language=zh variant=zh-tw
19581 !! wikitext
19582 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
19583 Taiwan is China.
19584 !! html
19585 <p>(This should be stripped!)
19586 Taiwan is Taiwan.
19587 </p>
19588 !! end
19589
19590 !! test
19591 Adding explicit conversion rule for title (T flag)
19592 !! options
19593 language=zh variant=zh-tw showtitle
19594 !! wikitext
19595 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19596 !! html
19597 Taiwan
19598 <p>Should be stripped!
19599 </p>
19600 !! end
19601
19602 !! test
19603 Testing that changing the language variant here in the tests actually works
19604 !! options
19605 language=zh variant=zh showtitle
19606 !! wikitext
19607 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19608 !! html
19609 China
19610 <p>Should be stripped!
19611 </p>
19612 !! end
19613
19614 !! test
19615 Recursive conversion of alt and title attrs shouldn't clear converter state
19616 !! options
19617 language=zh variant=zh-cn showtitle
19618 !! wikitext
19619 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
19620 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
19621 !! html
19622 China
19623 <p>
19624 Should be stripped<span title="Exclamation">!</span>
19625 </p>
19626 !! end
19627
19628 !! test
19629 Bug 24072: more test on conversion rule for title
19630 !! options
19631 language=zh variant=zh-tw showtitle
19632 !! wikitext
19633 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19634 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
19635 !! html
19636 Taiwan
19637 <p>This should be stripped!
19638 This won't take interferes with the title rule.
19639 </p>
19640 !! end
19641
19642 !! test
19643 Partly disable title conversion if variant == main language code
19644 !! options
19645 language=zh variant=zh title=[[ZH]] showtitle
19646 !! wikitext
19647 -{T|zh-cn:CN;zh-tw:TW}-
19648 !! html
19649 ZH
19650 <p>
19651 </p>
19652 !! end
19653
19654 !! test
19655 Partly disable title conversion if variant == main language code, more
19656 !! options
19657 language=zh variant=zh title=[[ZH]] showtitle
19658 !! wikitext
19659 -{T|TW}-
19660 !! html
19661 ZH
19662 <p>
19663 </p>
19664 !! end
19665
19666 !! test
19667 Raw output of variant escape tags (R flag)
19668 !! options
19669 language=zh variant=zh-tw
19670 !! wikitext
19671 Raw: -{R|zh:China;zh-tw:Taiwan}-
19672 !! html
19673 <p>Raw: zh:China;zh-tw:Taiwan
19674 </p>
19675 !! end
19676
19677 !! test
19678 Strings evaluating false shouldn't be ignored by Language converter (T51072)
19679 !! options
19680 language=zh variant=zh-cn
19681 !! input
19682 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
19683 !! result
19684 <p>0
19685 </p>
19686 !! end
19687
19688 !! test
19689 Conversion rules from [numeric-only string] to [something else] (T48634)
19690 !! options
19691 language=zh variant=zh-cn
19692 !! input
19693 -{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
19694 !! result
19695 <p>D12345EE12345
19696 </p>
19697 !! end
19698
19699 !! test
19700 Bidirectional converter rule entries with an empty value should be ignored (T53551)
19701 !! options
19702 language=zh variant=zh-cn
19703 !! input
19704 -{H|zh-cn:foo;zh-tw:;}-foobar
19705 !! result
19706 <p>foobar
19707 </p>
19708 !! end
19709
19710 !! test
19711 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
19712 !! options
19713 language=zh variant=zh-cn
19714 !! input
19715 -{H|=>zh-cn:foo;}-foobar
19716 !! result
19717 <p>foobar
19718 </p>
19719 !! end
19720
19721 !! test
19722 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
19723 !! options
19724 language=zh variant=zh-cn
19725 !! input
19726 -{H|}-foobar
19727 !! result
19728 <p>foobar
19729 </p>
19730 !! end
19731
19732 !! test
19733 Nested using of manual convert syntax
19734 !! options
19735 language=zh variant=zh-hk
19736 !! wikitext
19737 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
19738 !! html
19739 <p>Nested: Hello Hong Kong!
19740 </p>
19741 !! end
19742
19743 !! test
19744 Proper conversion of text in external links
19745 !! options
19746 language=sr variant=sr-ec
19747 !! wikitext
19748 http://www.google.com
19749 gopher://www.google.com
19750 [http://www.google.com http://www.google.com]
19751 [gopher://www.google.com gopher://www.google.com]
19752 [https://www.google.com irc://www.google.com]
19753 [ftp://www.google.com www.google.com/ftp://dir]
19754 [//www.google.com www.google.com]
19755 !! html
19756 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19757 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19758 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19759 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19760 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
19761 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
19762 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
19763 </p>
19764 !! end
19765
19766 !! test
19767 Do not convert roman numbers to language variants
19768 !! options
19769 language=sr variant=sr-ec
19770 !! wikitext
19771 Fridrih IV je car.
19772 !! html
19773 <p>Фридрих IV је цар.
19774 </p>
19775 !! end
19776
19777 !! test
19778 Unclosed language converter markup "-{"
19779 !! options
19780 language=sr
19781 !! wikitext
19782 -{T|hello
19783 !! html
19784 <p>-{T|hello
19785 </p>
19786 !! end
19787
19788 !! test
19789 Don't convert raw rule "-{R|=&gt;}-" to "=>"
19790 !! options
19791 language=sr
19792 !! wikitext
19793 -{R|=&gt;}-
19794 !! html
19795 <p>=&gt;
19796 </p>
19797 !!end
19798
19799 !! test
19800 Don't break link parsing if language converter markup is in the caption.
19801 !! options
19802 language=sr variant=sr-ec
19803 !! wikitext
19804 [[Main Page|-{R|main page}-]]
19805 !! html
19806 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
19807 </p>
19808 !! end
19809
19810 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19811 !! test
19812 Don't break image parsing if language converter markup is in the caption.
19813 !! options
19814 language=sr
19815 !! wikitext
19816 [[File:Foobar.jpg|-{R|caption}-]]
19817 !! html/parsoid
19818 <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>
19819 </p>
19820 !! end
19821
19822 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19823 !! test
19824 Don't break list handling if language converter markup is in the item.
19825 !! options
19826 language=zh variant=zh-cn
19827 !! wikitext
19828 ;-{zh-cn:AAA;zh-tw:BBB}-
19829 !! html/php
19830 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
19831
19832 !! html/parsoid
19833 <dl><dt>AAA
19834 </dt></dl>
19835 !! end
19836
19837 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19838 !! test
19839 Don't break table handling if language converter markup is in the cell.
19840 !! options
19841 language=sr variant=sr-ec
19842 !! wikitext
19843 {|
19844 |-
19845 | -{R|B}-
19846 |}
19847 !! html/php
19848 <table>
19849
19850 <tr>
19851 <td>Б}-
19852 </td></tr></table>
19853
19854 !! html/parsoid
19855 <table>
19856
19857 <tr>
19858 <td> B
19859 </td></tr></table>
19860
19861 !! end
19862
19863 !! test
19864 Bug 529: Uncovered bullet
19865 !! wikitext
19866 * Foo {{bullet}}
19867 !! html
19868 <ul><li> Foo </li>
19869 <li> Bar</li></ul>
19870
19871 !! end
19872
19873 # Plain MediaWiki does not remove empty lists, but tidy actually does.
19874 # Templates in Wikipedia rely on this behavior, as tidy has always been
19875 # enabled there. These tests are normally run *without* tidy, so specify the
19876 # full output here.
19877 # To test realistic parsing behavior, apply a tidy-like transformation to both
19878 # the expected output and your parser's output.
19879 !! test
19880 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
19881 !! wikitext
19882 ******* Foo {{bullet}}
19883 !! html
19884 <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>
19885 <li> Bar</li></ul>
19886
19887 !! end
19888
19889 !! test
19890 Bug 529: Uncovered table already at line-start
19891 !! wikitext
19892 x
19893
19894 {{table}}
19895 y
19896 !! html
19897 <p>x
19898 </p>
19899 <table>
19900 <tr>
19901 <td> 1 </td>
19902 <td> 2
19903 </td></tr>
19904 <tr>
19905 <td> 3 </td>
19906 <td> 4
19907 </td></tr></table>
19908 <p>y
19909 </p>
19910 !! end
19911
19912 !! test
19913 Bug 529: Uncovered bullet in parser function result
19914 !! wikitext
19915 * Foo {{lc:{{bullet}} }}
19916 !! html
19917 <ul><li> Foo </li>
19918 <li> bar</li></ul>
19919
19920 !! end
19921
19922 !! test
19923 Bug 5678: Double-parsed template argument
19924 !! wikitext
19925 {{lc:{{{1}}}|hello}}
19926 !! html
19927 <p>{{{1}}}
19928 </p>
19929 !! end
19930
19931 !! test
19932 Bug 5678: Double-parsed template invocation
19933 !! wikitext
19934 {{lc:{{paramtest {{!}} param = hello }} }}
19935 !! html
19936 <p>{{paramtest | param = hello }}
19937 </p>
19938 !! end
19939
19940 !! test
19941 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
19942 !! options
19943 language=cs
19944 title=[[Main Page]]
19945 !! wikitext
19946 {{PRVNÍVELKÉ:ěščř}}
19947 {{prvnívelké:ěščř}}
19948 {{PRVNÍMALÉ:ěščř}}
19949 {{prvnímalé:ěščř}}
19950 {{MALÁ:ěščř}}
19951 {{malá:ěščř}}
19952 {{VELKÁ:ěščř}}
19953 {{velká:ěščř}}
19954 !! html
19955 <p>Ěščř
19956 Ěščř
19957 ěščř
19958 ěščř
19959 ěščř
19960 ěščř
19961 ĚŠČŘ
19962 ĚŠČŘ
19963 </p>
19964 !! end
19965
19966 !! test
19967 Morwen/13: Unclosed link followed by heading
19968 !! wikitext
19969 [[link
19970 ==heading==
19971 !! html
19972 <p>[[link
19973 </p>
19974 <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>
19975
19976 !! end
19977
19978 !! test
19979 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
19980 !! wikitext
19981 {{foo|
19982 =heading=
19983 !! html
19984 <p>{{foo|
19985 </p>
19986 <h1><span class="mw-headline" id="heading">heading</span></h1>
19987
19988 !! end
19989
19990 !! test
19991 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
19992 !! wikitext
19993 {{foo|
19994 ==heading==
19995 !! html
19996 <p>{{foo|
19997 </p>
19998 <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>
19999
20000 !! end
20001
20002 !! test
20003 Tildes in comments
20004 !! options
20005 pst
20006 !! wikitext
20007 <!-- ~~~~ -->
20008 !! html/php
20009 <!-- ~~~~ -->
20010 !! end
20011
20012 !! test
20013 Paragraphs inside divs (no extra line breaks)
20014 !! wikitext
20015 <div>Line one
20016
20017 Line two</div>
20018 !! html
20019 <div>Line one
20020 Line two</div>
20021
20022 !! end
20023
20024 !! test
20025 Paragraphs inside divs (extra line break on open)
20026 !! wikitext
20027 <div>
20028 Line one
20029
20030 Line two</div>
20031 !! html
20032 <div>
20033 <p>Line one
20034 </p>
20035 Line two</div>
20036
20037 !! end
20038
20039 !! test
20040 Paragraphs inside divs (extra line break on close)
20041 !! wikitext
20042 <div>Line one
20043
20044 Line two
20045 </div>
20046 !! html
20047 <div>Line one
20048 <p>Line two
20049 </p>
20050 </div>
20051
20052 !! end
20053
20054 !! test
20055 Paragraphs inside divs (extra line break on open and close)
20056 !! wikitext
20057 <div>
20058 Line one
20059
20060 Line two
20061 </div>
20062 !! html
20063 <div>
20064 <p>Line one
20065 </p><p>Line two
20066 </p>
20067 </div>
20068
20069 !! end
20070
20071 !! test
20072 Nesting tags, paragraphs on lines which begin with <div>
20073 !! wikitext
20074 <div></div><strong>A
20075 B</strong>
20076 !! html/php+tidy
20077 <p><strong>A</strong></p>
20078 <p><strong>B</strong></p>
20079 !! html/parsoid
20080 <div></div>
20081 <p><strong>A
20082 B</strong>
20083 </p>
20084 !! end
20085
20086 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
20087 !! test
20088 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
20089 !! wikitext
20090 <blockquote>Line one
20091
20092 Line two</blockquote>
20093 !! html
20094 <blockquote>Line one
20095 Line two</blockquote>
20096
20097 !! html+tidy
20098 <blockquote>
20099 <p>Line one Line two</p>
20100 </blockquote>
20101 !! end
20102
20103 !! test
20104 Bug 6200: paragraphs inside blockquotes (extra line break on open)
20105 !! wikitext
20106 <blockquote>
20107 Line one
20108
20109 Line two</blockquote>
20110 !! html
20111 <blockquote>
20112 <p>Line one
20113 </p>
20114 Line two</blockquote>
20115
20116 !! html+tidy
20117 <blockquote>
20118 <p>Line one</p>
20119 Line two</blockquote>
20120 !! end
20121
20122 !! test
20123 Bug 6200: paragraphs inside blockquotes (extra line break on close)
20124 !! wikitext
20125 <blockquote>Line one
20126
20127 Line two
20128 </blockquote>
20129 !! html
20130 <blockquote>Line one
20131 <p>Line two
20132 </p>
20133 </blockquote>
20134
20135 !! html+tidy
20136 <blockquote>
20137 <p>Line one</p>
20138 <p>Line two</p>
20139 </blockquote>
20140 !! end
20141
20142 !! test
20143 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
20144 !! wikitext
20145 <blockquote>
20146 Line one
20147
20148 Line two
20149 </blockquote>
20150 !! html
20151 <blockquote>
20152 <p>Line one
20153 </p><p>Line two
20154 </p>
20155 </blockquote>
20156
20157 !! html+tidy
20158 <blockquote>
20159 <p>Line one</p>
20160 <p>Line two</p>
20161 </blockquote>
20162 !! end
20163
20164 !! test
20165 Paragraphs inside blockquotes/divs (no extra line breaks)
20166 !! wikitext
20167 <blockquote><div>Line one
20168
20169 Line two</div></blockquote>
20170 !! html
20171 <blockquote><div>Line one
20172 Line two</div></blockquote>
20173
20174 !! end
20175
20176 !! test
20177 Paragraphs inside blockquotes/divs (extra line break on open)
20178 !! wikitext
20179 <blockquote><div>
20180 Line one
20181
20182 Line two</div></blockquote>
20183 !! html
20184 <blockquote><div>
20185 <p>Line one
20186 </p>
20187 Line two</div></blockquote>
20188
20189 !! end
20190
20191 !! test
20192 Paragraphs inside blockquotes/divs (extra line break on close)
20193 !! wikitext
20194 <blockquote><div>Line one
20195
20196 Line two
20197 </div></blockquote>
20198 !! html
20199 <blockquote><div>Line one
20200 <p>Line two
20201 </p>
20202 </div></blockquote>
20203
20204 !! end
20205
20206 !! test
20207 Paragraphs inside blockquotes/divs (extra line break on open and close)
20208 !! wikitext
20209 <blockquote><div>
20210 Line one
20211
20212 Line two
20213 </div></blockquote>
20214 !! html
20215 <blockquote><div>
20216 <p>Line one
20217 </p><p>Line two
20218 </p>
20219 </div></blockquote>
20220
20221 !! end
20222
20223 !! test
20224 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
20225 !! options
20226 wgLinkHolderBatchSize=0
20227 !! wikitext
20228 [[meatball:1]]
20229 [[meatball:2]]
20230 [[meatball:3]]
20231 !! html
20232 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
20233 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
20234 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
20235 </p>
20236 !! end
20237
20238 !! test
20239 Free external link invading image caption
20240 !! wikitext
20241 [[Image:Foobar.jpg|thumb|http://x|hello]]
20242 !! html
20243 <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>
20244
20245 !! end
20246
20247 !! test
20248 Bug 15196: localised external link numbers
20249 !! options
20250 language=fa
20251 !! wikitext
20252 [http://en.wikipedia.org/]
20253 !! html/php
20254 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
20255 </p>
20256 !! html/parsoid
20257 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
20258 !! end
20259
20260 !! test
20261 Multibyte character in padleft
20262 !! wikitext
20263 {{padleft:-Hello|7|Æ}}
20264 !! html
20265 <p>Æ-Hello
20266 </p>
20267 !! end
20268
20269 !! test
20270 Multibyte character in padright
20271 !! wikitext
20272 {{padright:Hello-|7|Æ}}
20273 !! html
20274 <p>Hello-Æ
20275 </p>
20276 !! end
20277
20278 !!test
20279 formatdate parser function
20280 !! wikitext
20281 {{#formatdate:2009-03-24}}
20282 !! html
20283 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
20284 </p>
20285 !! end
20286
20287 !!test
20288 formatdate parser function, with default format
20289 !! wikitext
20290 {{#formatdate:2009-03-24|mdy}}
20291 !! html
20292 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
20293 </p>
20294 !! end
20295
20296 !! test
20297 Spacing of numbers in formatted dates
20298 !! wikitext
20299 {{#formatdate:January 15}}
20300 !! html
20301 <p><span class="mw-formatted-date" title="01-15">January 15</span>
20302 </p>
20303 !! end
20304
20305 !! test
20306 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
20307 !! options
20308 language=nl title=[[MediaWiki:Common.css]]
20309 !! wikitext
20310 {{#formatdate:2009-03-24|dmy}}
20311 !! html
20312 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
20313 </p>
20314 !! end
20315
20316 #
20317 #
20318 #
20319
20320 #
20321 # Edit comments
20322 #
20323
20324 !! test
20325 Edit comment with link
20326 !! options
20327 comment
20328 !! wikitext
20329 I like the [[Main Page]] a lot
20330 !! html/php
20331 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
20332 !!end
20333
20334 !! test
20335 Edit comment with link and link text
20336 !! options
20337 comment
20338 !! wikitext
20339 I like the [[Main Page|best pages]] a lot
20340 !! html/php
20341 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20342 !!end
20343
20344 !! test
20345 Edit comment with link and link text with suffix
20346 !! options
20347 comment
20348 !! wikitext
20349 I like the [[Main Page|best page]]s a lot
20350 !! html/php
20351 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20352 !!end
20353
20354 !! test
20355 Edit comment with section link (non-local, eg in history list)
20356 !! options
20357 comment title=[[Main Page]]
20358 !! wikitext
20359 /* External links */ removed bogus entries
20360 !! html/php
20361 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20362 !!end
20363
20364 !! test
20365 Edit comment with section link and text before it (non-local, eg in history list)
20366 !! options
20367 comment title=[[Main Page]]
20368 !! wikitext
20369 pre-comment text /* External links */ removed bogus entries
20370 !! html/php
20371 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>
20372 !!end
20373
20374 !! test
20375 Edit comment with section link (local, eg in diff view)
20376 !! options
20377 comment local title=[[Main Page]]
20378 !! wikitext
20379 /* External links */ removed bogus entries
20380 !! html/php
20381 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20382 !!end
20383
20384 !! test
20385 Edit comment with subpage link (bug 14080)
20386 !! options
20387 comment
20388 subpage
20389 title=[[Subpage test]]
20390 !! wikitext
20391 Poked at a [[/subpage]] here...
20392 !! html/php
20393 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
20394 !!end
20395
20396 !! test
20397 Edit comment with subpage link and link text (bug 14080)
20398 !! options
20399 comment
20400 subpage
20401 title=[[Subpage test]]
20402 !! wikitext
20403 Poked at a [[/subpage|neat little page]] here...
20404 !! html/php
20405 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
20406 !!end
20407
20408 !! test
20409 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
20410 !! options
20411 comment
20412 title=[[Subpage test]]
20413 !! wikitext
20414 Poked at a [[/subpage]] here...
20415 !! html/php
20416 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...
20417 !!end
20418
20419 !! test
20420 Edit comment with bare anchor link (local, as on diff)
20421 !! options
20422 comment
20423 local
20424 title=[[Main Page]]
20425 !! wikitext
20426 [[#section]]
20427 !! html/php
20428 <a href="#section">#section</a>
20429 !! end
20430
20431 !! test
20432 Edit comment with bare anchor link (non-local, as on history)
20433 !! options
20434 comment
20435 title=[[Main Page]]
20436 !! wikitext
20437 [[#section]]
20438 !! html/php
20439 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
20440 !! end
20441
20442 !! test
20443 Anchor starting with underscore
20444 !! options
20445 title=[[Foo]]
20446 !! wikitext
20447 [[#_ref|One]]
20448 !! html/php
20449 <p><a href="#_ref">One</a>
20450 </p>
20451 !! html/parsoid
20452 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
20453 !! end
20454
20455 !! test
20456 Id starting with underscore
20457 !! wikitext
20458 <div id="_ref"></div>
20459 !! html/*
20460 <div id="_ref"></div>
20461
20462 !! end
20463
20464 !! test
20465 Space normalisation on autocomment (bug 22784)
20466 !! options
20467 comment
20468 title=[[Main Page]]
20469 !! wikitext
20470 /* __hello__world__ */
20471 !! html/php
20472 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
20473 !! end
20474
20475 !! test
20476 percent-encoding and + signs in comments (Bug 26410)
20477 !! options
20478 comment
20479 !! wikitext
20480 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
20481 !! html/php
20482 <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>
20483 !! end
20484
20485 # Parsoid doesn't support this yet: see bug 73581
20486 # but it *should* omit the 'src' attribute if the image is bad.
20487 # PHP side of tests was disabled in
20488 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
20489 # because of issues in the PHP parserTests infrastructure
20490 # (but the output below is indeed what the PHP side emits)
20491 !! test
20492 Bad images - basic functionality
20493 !! wikitext
20494 [[File:Bad.jpg]]
20495 !! DISABLED/html/php
20496 !! html/parsoid
20497 <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>
20498 !! end
20499
20500 !! test
20501 Bad images - bug 16039: text after bad image disappears
20502 !! wikitext
20503 Foo bar
20504 [[File:Bad.jpg]]
20505 Bar foo
20506 !! DISABLED/html/php
20507 <p>Foo bar
20508 </p><p>Bar foo
20509 </p>
20510 !! html/parsoid
20511 <p>Foo bar
20512 <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>
20513 Bar foo</p>
20514 !! end
20515
20516 !! test
20517 Verify that displaytitle works (bug #22501) no displaytitle
20518 !! options
20519 showtitle
20520 !! config
20521 wgAllowDisplayTitle=true
20522 wgRestrictDisplayTitle=false
20523 !! wikitext
20524 this is not the the title
20525 !! html/php
20526 Parser test
20527 <p>this is not the the title
20528 </p>
20529 !! end
20530
20531 !! test
20532 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
20533 !! options
20534 showtitle
20535 title=[[Screen]]
20536 !! config
20537 wgAllowDisplayTitle=true
20538 wgRestrictDisplayTitle=false
20539 !! wikitext
20540 this is not the the title
20541 {{DISPLAYTITLE:whatever}}
20542 !! html/php
20543 whatever
20544 <p>this is not the the title
20545 </p>
20546 !! end
20547
20548 !! test
20549 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
20550 !! options
20551 showtitle
20552 title=[[Screen]]
20553 !! config
20554 wgAllowDisplayTitle=true
20555 wgRestrictDisplayTitle=true
20556 !! wikitext
20557 this is not the the title
20558 {{DISPLAYTITLE:whatever}}
20559 !! html/php
20560 Screen
20561 <p>this is not the the title
20562 </p>
20563 !! end
20564
20565 !! test
20566 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
20567 !! options
20568 showtitle
20569 title=[[Screen]]
20570 !! config
20571 wgAllowDisplayTitle=true
20572 wgRestrictDisplayTitle=true
20573 !! wikitext
20574 this is not the the title
20575 {{DISPLAYTITLE:screen}}
20576 !! html/php
20577 screen
20578 <p>this is not the the title
20579 </p>
20580 !! end
20581
20582 !! test
20583 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
20584 !! options
20585 showtitle
20586 title=[[Screen]]
20587 !! config
20588 wgAllowDisplayTitle=false
20589 !! wikitext
20590 this is not the the title
20591 {{DISPLAYTITLE:screen}}
20592 !! html/php
20593 Screen
20594 <p>this is not the the title
20595 <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>
20596 </p>
20597 !! end
20598
20599 !! test
20600 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
20601 !! options
20602 showtitle
20603 title=[[Screen]]
20604 !! config
20605 wgAllowDisplayTitle=false
20606 !! wikitext
20607 this is not the the title
20608 !! html/php
20609 Screen
20610 <p>this is not the the title
20611 </p>
20612 !! end
20613
20614 !! test
20615 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
20616 !! options
20617 showtitle
20618 title=[[Screen]]
20619 !! config
20620 wgAllowDisplayTitle=true
20621 wgRestrictDisplayTitle=true
20622 !! wikitext
20623 this is not the the title
20624 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
20625 !! html/php
20626 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
20627 <p>this is not the the title
20628 </p>
20629 !! end
20630
20631 !! test
20632 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
20633 !! options
20634 showtitle
20635 title=[[Screen]]
20636 !! config
20637 wgAllowDisplayTitle=true
20638 wgRestrictDisplayTitle=true
20639 !! wikitext
20640 this is not the the title
20641 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
20642 !! html/php
20643 <span style="color: red;">s</span>creen
20644 <p>this is not the the title
20645 </p>
20646 !! end
20647
20648 !! test
20649 Page status indicators: Empty name is invalid
20650 !! options
20651 showindicators
20652 !! wikitext
20653 <indicator name=" "></indicator>
20654 <indicator></indicator>
20655 !! html
20656 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20657 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20658 </p>
20659 !! end
20660
20661 !! test
20662 Page status indicators: Weird syntaxes that are okay
20663 !! options
20664 showindicators
20665 !! wikitext
20666 <indicator name="empty" />
20667 <indicator name="name"></indicator>
20668 !! html
20669 empty=
20670 name=
20671 <p><br />
20672 </p>
20673 !! end
20674
20675 !! test
20676 Page status indicators: Torture test
20677 !! options
20678 showindicators
20679 !! wikitext
20680 <indicator name="01">hello world</indicator>
20681 <indicator name="02">[[Main Page]]</indicator>
20682 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
20683 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
20684 <indicator name="05">* foo
20685 * bar</indicator>
20686 <indicator name="06"><nowiki>foo</nowiki></indicator>
20687 <indicator name="07"> Preformatted</indicator>
20688 <indicator name="08"><div>Broken tag</indicator>
20689 <indicator name="09">{| class=wikitable
20690 | cell
20691 |}</indicator>
20692 <indicator name="10">Two
20693
20694 paragraphs</indicator>
20695 !! html
20696 01=hello world
20697 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20698 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" />
20699 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>
20700 05=<ul><li> foo</li>
20701 <li> bar</li></ul>
20702
20703 06=foo
20704 07=<pre>Preformatted
20705 </pre>
20706 08=<div>Broken tag</div>
20707
20708 09=<table class="wikitable">
20709 <tr>
20710 <td> cell
20711 </td></tr></table>
20712
20713 10=<p>Two
20714 </p><p>paragraphs
20715 </p>
20716 <p><br />
20717 </p><p><br />
20718 </p><p><br />
20719 </p><p><br />
20720 </p><p><br />
20721 </p>
20722 !! end
20723
20724 !! test
20725 preload: check <noinclude> and <includeonly>
20726 !! options
20727 preload
20728 !! wikitext
20729 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
20730 !! html/php
20731 Hello kind world.
20732 !! end
20733
20734 !! test
20735 preload: check <onlyinclude>
20736 !! options
20737 preload
20738 !! wikitext
20739 Goodbye <onlyinclude>Hello world</onlyinclude>
20740 !! html/php
20741 Hello world
20742 !! end
20743
20744 !! test
20745 preload: can pass tags through if we want to
20746 !! options
20747 preload
20748 !! wikitext
20749 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
20750 !! html/php
20751 <includeonly>Hello world</includeonly>
20752 !! end
20753
20754 !! test
20755 preload: check that it doesn't try to do tricks
20756 !! options
20757 preload
20758 !! wikitext
20759 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20760 !! html/php
20761 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20762 !! end
20763
20764 !! test
20765 Play a bit with r67090 and bug 3158
20766 !! wikitext
20767 <div style="width:50% !important">&nbsp;</div>
20768 <div style="width:50%&nbsp;!important">&nbsp;</div>
20769 <div style="width:50%&#160;!important">&nbsp;</div>
20770 <div style="border : solid;">&nbsp;</div>
20771 !! html/php
20772 <div style="width:50% !important">&#160;</div>
20773 <div style="width:50% !important">&#160;</div>
20774 <div style="width:50% !important">&#160;</div>
20775 <div style="border&#160;: solid;">&#160;</div>
20776
20777 !! html/parsoid
20778 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20779 <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>
20780 <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>
20781 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20782
20783 !! end
20784
20785 !! test
20786 HTML5 data attributes
20787 !! wikitext
20788 <span data-foo="bar">Baz</span>
20789 <p data-abc-def_hij="">Quuz</p>
20790 !! html/php
20791 <p><span data-foo="bar">Baz</span>
20792 </p>
20793 <p data-abc-def_hij="">Quuz</p>
20794
20795 !! html/parsoid
20796 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
20797 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
20798 !! end
20799
20800 !! test
20801 Strip reserved data attributes
20802 !! wikitext
20803 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
20804 !! html/php
20805 <div data-ok="fred">d</div>
20806
20807 !! html/parsoid
20808 <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>
20809 !! end
20810
20811 !! test
20812 percent-encoding and + signs in internal links (Bug 26410)
20813 !! wikitext
20814 [[User:+%]] [[Page+title%]]
20815 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
20816 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
20817 [[%33%45]] [[%33%45+]]
20818 !! html/php
20819 <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>
20820 <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>
20821 <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>
20822 <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>
20823 </p>
20824 !! html/parsoid
20825 <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>
20826 <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>
20827 <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>
20828 <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>
20829 !! end
20830
20831 !! test
20832 Special characters in embedded file links (bug 27679)
20833 !! wikitext
20834 [[File:Contains & ampersand.jpg]]
20835 [[File:Does not exist.jpg|Title with & ampersand]]
20836 !! html/php
20837 <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>
20838 <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>
20839 </p>
20840 !! html/parsoid
20841 <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>
20842 <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>
20843 !! end
20844
20845 !! test
20846 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
20847 !! wikitext
20848 Text&apos;s been normalized?
20849 !! html
20850 <p>Text&#39;s been normalized?
20851 </p>
20852 !! end
20853
20854 !! test
20855 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
20856 !! wikitext
20857 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
20858 !! html
20859 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
20860 </p>
20861 !! end
20862
20863 !! test
20864 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
20865 !! wikitext
20866 [http://www.example.org/ ideograms]
20867 !! html
20868 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
20869 </p>
20870 !! end
20871
20872 !! test
20873 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
20874 !! wikitext
20875 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
20876 !! html
20877 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
20878 </p>
20879 !! end
20880
20881 !! article
20882 Mediawiki:loop1
20883 !! text
20884 {{Identical|A}}
20885 !! endarticle
20886
20887 !! article
20888 Mediawiki:loop2
20889 !! text
20890 {{Identical|B}}
20891 !! endarticle
20892
20893 !! article
20894 Template:Identical
20895 !! text
20896 {{int:loop1}}
20897 {{int:loop2}}
20898 !! endarticle
20899
20900 !! test
20901 Bug 31098 Template which includes system messages which includes the template
20902 !! wikitext
20903 {{Identical}}
20904 !! html
20905 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20906 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20907 </p>
20908 !! end
20909
20910 !! test
20911 Bug31490 Turkish: ucfirst 'blah'
20912 !! options
20913 language=tr
20914 !! wikitext
20915 {{ucfirst:blah}}
20916 !! html
20917 <p>Blah
20918 </p>
20919 !! end
20920
20921 !! test
20922 Bug31490 Turkish: ucfirst 'ix'
20923 !! options
20924 language=tr
20925 !! wikitext
20926 {{ucfirst:ix}}
20927 !! html
20928 <p>İx
20929 </p>
20930 !! end
20931
20932 !! test
20933 Bug31490 Turkish: lcfirst 'BLAH'
20934 !! options
20935 language=tr
20936 !! wikitext
20937 {{lcfirst:BLAH}}
20938 !! html
20939 <p>bLAH
20940 </p>
20941 !! end
20942
20943 !! test
20944 Bug31490 Turkish: ucfırst (with a dotless i)
20945 !! options
20946 language=tr
20947 !! wikitext
20948 {{ucfırst:blah}}
20949 !! html
20950 <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>
20951 </p>
20952 !! end
20953
20954 !! test
20955 Bug31490 ucfırst (with a dotless i) with English language
20956 !! options
20957 language=en
20958 !! wikitext
20959 {{ucfırst:blah}}
20960 !! html
20961 <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>
20962 </p>
20963 !! end
20964
20965 !! test
20966 Bug 26375: TOC with italics
20967 !! options
20968 title=[[Main Page]]
20969 !! wikitext
20970 __TOC__
20971 == ''Lost'' episodes ==
20972 !! html
20973 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20974 <ul>
20975 <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>
20976 </ul>
20977 </div>
20978
20979 <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>
20980
20981 !! end
20982
20983 !! test
20984 Bug 26375: TOC with bold
20985 !! options
20986 title=[[Main Page]]
20987 !! wikitext
20988 __TOC__
20989 == '''should be bold''' then normal text ==
20990 !! html
20991 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20992 <ul>
20993 <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>
20994 </ul>
20995 </div>
20996
20997 <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>
20998
20999 !! end
21000
21001 !! test
21002 Bug 33845: Headings become cursive in TOC when they contain an image
21003 !! options
21004 title=[[Main Page]]
21005 !! wikitext
21006 __TOC__
21007 == Image [[Image:foobar.jpg]] ==
21008 !! html
21009 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21010 <ul>
21011 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
21012 </ul>
21013 </div>
21014
21015 <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>
21016
21017 !! end
21018
21019 !! test
21020 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
21021 !! options
21022 title=[[Main Page]]
21023 !! wikitext
21024 __TOC__
21025 == <blockquote>Quote</blockquote> ==
21026 !! html
21027 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21028 <ul>
21029 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21030 </ul>
21031 </div>
21032
21033 <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>
21034
21035 !! html+tidy
21036 <p></p>
21037 <div id="toc" class="toc">
21038 <div id="toctitle">
21039 <h2>Contents</h2>
21040 </div>
21041 <ul>
21042 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21043 </ul>
21044 </div>
21045 <p></p>
21046 <h2><span class="mw-headline" id="Quote"></span></h2>
21047 <blockquote>
21048 <p><span class="mw-headline" id="Quote">Quote</span></p>
21049 </blockquote>
21050 <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>
21051 !! end
21052
21053 !! test
21054 Unclosed tags in TOC
21055 !! options
21056 title=[[Main Page]]
21057 !! wikitext
21058 __TOC__
21059 == Proof: 2 < 3 ==
21060 <small>Hanc marginis exiguitas non caperet.</small>
21061 QED
21062 !! html
21063 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21064 <ul>
21065 <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>
21066 </ul>
21067 </div>
21068
21069 <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>
21070 <p><small>Hanc marginis exiguitas non caperet.</small>
21071 QED
21072 </p>
21073 !! end
21074
21075 !! test
21076 Multiple tags in TOC
21077 !! wikitext
21078 __TOC__
21079 == <i>Foo</i> <b>Bar</b> ==
21080
21081 == <i>Foo</i> <blockquote>Bar</blockquote> ==
21082 !! html
21083 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21084 <ul>
21085 <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>
21086 <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>
21087 </ul>
21088 </div>
21089
21090 <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>
21091 <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>
21092
21093 !! html+tidy
21094 <p></p>
21095 <div id="toc" class="toc">
21096 <div id="toctitle">
21097 <h2>Contents</h2>
21098 </div>
21099 <ul>
21100 <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>
21101 <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>
21102 </ul>
21103 </div>
21104 <p></p>
21105 <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>
21106 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
21107 <blockquote>
21108 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
21109 </blockquote>
21110 <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>
21111 !! end
21112
21113 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
21114 # html5 tag parsing.
21115 !! test
21116 Tags with parameters in TOC
21117 !! options
21118 parsoid=wt2html
21119 !! wikitext
21120 __TOC__
21121 == <sup class="in-h2">Hello</sup> ==
21122
21123 == <sup class="a > b">Evilbye</sup> ==
21124 !! html/php
21125 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21126 <ul>
21127 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
21128 <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>
21129 </ul>
21130 </div>
21131
21132 <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>
21133 <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>
21134
21135 !! html/parsoid
21136 <meta property="mw:PageProp/toc" />
21137 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
21138
21139 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
21140 !! end
21141
21142 !! test
21143 span tags with directionality in TOC
21144 !! wikitext
21145 __TOC__
21146 == <span dir="ltr">C++</span> ==
21147
21148 == <span dir="rtl">זבנג!</span> ==
21149
21150 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
21151
21152 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
21153
21154 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
21155 !! html
21156 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21157 <ul>
21158 <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>
21159 <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>
21160 <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>
21161 <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>
21162 <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>
21163 </ul>
21164 </div>
21165
21166 <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>
21167 <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>
21168 <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>
21169 <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>
21170 <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>
21171
21172 !! end
21173
21174 !! test
21175 Bug 72884: bdi element in ToC
21176 !! wikitext
21177 __TOC__
21178 == <bdi>test</bdi> ==
21179 !! html
21180 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21181 <ul>
21182 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
21183 </ul>
21184 </div>
21185
21186 <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>
21187
21188 !! end
21189
21190 # Note that the html output does not have the <p></p>, but the
21191 # html+tidy output *does*. This is because the empty <p></p> is
21192 # removed by the sanitizer, but only when tidy is *not* enabled (!).
21193 !! test
21194 Empty <p> tag in TOC, removed by Sanitizer (T92892)
21195 !! wikitext
21196 __TOC__
21197 == x ==
21198 !! html
21199 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21200 <ul>
21201 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21202 </ul>
21203 </div>
21204
21205 <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>
21206
21207 !! html+tidy
21208 <p></p>
21209 <div id="toc" class="toc">
21210 <div id="toctitle">
21211 <h2>Contents</h2>
21212 </div>
21213 <ul>
21214 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21215 </ul>
21216 </div>
21217 <p></p>
21218 <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>
21219 !! end
21220
21221 !! article
21222 MediaWiki:Bug32057
21223 !! text
21224 == {{int:headline_sample}} ==
21225 !! endarticle
21226
21227 !! test
21228 Bug 32057: Title needed when expanding <h> nodes.
21229 !! options
21230 title=[[Main Page]]
21231 !! wikitext
21232 {{int:Bug32057}}
21233 !! html
21234 <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>
21235
21236 !! end
21237
21238 !! test
21239 Strip marker in urlencode
21240 !! wikitext
21241 {{urlencode:x<nowiki/>y}}
21242 {{urlencode:x<nowiki/>y|wiki}}
21243 {{urlencode:x<nowiki/>y|path}}
21244 {{urlencode:x<pre id="one">two</pre>y}}
21245 !! html
21246 <p>xy
21247 xy
21248 xy
21249 xy
21250 </p>
21251 !! end
21252
21253 !! test
21254 Strip marker in lc
21255 !! wikitext
21256 {{lc:x<nowiki/>y}}
21257 !! html
21258 <p>xy
21259 </p>
21260 !! end
21261
21262 !! test
21263 Strip marker in uc
21264 !! wikitext
21265 {{uc:x<nowiki/>y}}
21266 !! html
21267 <p>XY
21268 </p>
21269 !! end
21270
21271 !! test
21272 Strip marker in formatNum
21273 !! wikitext
21274 {{formatnum:1<nowiki/>2}}
21275 {{formatnum:1<nowiki/>2|R}}
21276 !! html
21277 <p>12
21278 12
21279 </p>
21280 !! end
21281
21282 !! test
21283 Check noCommafy in formatNum
21284 !! options
21285 language=be-tarask
21286 !! wikitext
21287 {{formatnum:123456.78}}
21288 {{formatnum:123456.78|NOSEP}}
21289 !! html
21290 <p>123 456,78
21291 123456.78
21292 </p>
21293 !! end
21294
21295 !! test
21296 Wrong option for formatNum (bug 56199)
21297 !! wikitext
21298 {{formatnum:1,234.56|Random}}
21299 {{formatnum:1,234.56|EVERYTHING}}
21300 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
21301 !! html
21302 <p>1,234.56
21303 1,234.56
21304 1,234.56
21305 </p>
21306 !! end
21307
21308 !! test
21309 Strip marker in grammar
21310 !! options
21311 language=fi
21312 !! wikitext
21313 {{grammar:elative|foo<nowiki/>bar}}
21314 !! html
21315 <p>foobarista
21316 </p>
21317 !! end
21318
21319 !! test
21320 Strip marker in padleft
21321 !! wikitext
21322 {{padleft:|2|x<nowiki/>y}}
21323 !! html
21324 <p>xy
21325 </p>
21326 !! end
21327
21328 !! test
21329 Strip marker in padright
21330 !! wikitext
21331 {{padright:|2|x<nowiki/>y}}
21332 !! html
21333 <p>xy
21334 </p>
21335 !! end
21336
21337 !! test
21338 Strip marker in anchorencode
21339 !! wikitext
21340 {{anchorencode:x<nowiki/>y}}
21341 !! html
21342 <p>xy
21343 </p>
21344 !! end
21345
21346 !! test
21347 nowiki inside link inside heading (bug 18295)
21348 !! wikitext
21349 ==[[foo|x<nowiki>y</nowiki>z]]==
21350 !! html
21351 <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>
21352
21353 !! end
21354
21355 !! test
21356 new support for bdi element (bug 31817)
21357 !! wikitext
21358 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21359 !! html
21360 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21361
21362 !!end
21363
21364 !! test
21365 Ignore pipe between table row attributes
21366 !! wikitext
21367 {|
21368 | quux
21369 |- id=foo | style='color: red'
21370 | bar
21371 |}
21372 !! html
21373 <table>
21374 <tr>
21375 <td> quux
21376 </td></tr>
21377 <tr id="foo" style="color: red">
21378 <td> bar
21379 </td></tr></table>
21380
21381 !! end
21382
21383 !!test
21384 Gallery override link with WikiLink (bug 34852)
21385 !! wikitext
21386 <gallery>
21387 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
21388 </gallery>
21389 !! html
21390 <ul class="gallery mw-gallery-traditional">
21391 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21392 <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>
21393 <div class="gallerytext">
21394 <p>caption
21395 </p>
21396 </div>
21397 </div></li>
21398 </ul>
21399
21400 !! end
21401
21402 !!test
21403 Gallery override link with absolute external link (bug 34852)
21404 !! wikitext
21405 <gallery>
21406 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21407 </gallery>
21408 !! html
21409 <ul class="gallery mw-gallery-traditional">
21410 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21411 <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>
21412 <div class="gallerytext">
21413 <p>caption
21414 </p>
21415 </div>
21416 </div></li>
21417 </ul>
21418
21419 !! end
21420
21421 !!test
21422 Gallery override link with malicious javascript (bug 34852)
21423 !! wikitext
21424 <gallery>
21425 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21426 </gallery>
21427 !! html
21428 <ul class="gallery mw-gallery-traditional">
21429 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21430 <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>
21431 <div class="gallerytext">
21432 <p>caption
21433 </p>
21434 </div>
21435 </div></li>
21436 </ul>
21437
21438 !! end
21439
21440 !!test
21441 Gallery with invalid title as link (bug 43964)
21442 !! wikitext
21443 <gallery>
21444 File:foobar.jpg|link=<
21445 </gallery>
21446 !! html
21447 <ul class="gallery mw-gallery-traditional">
21448 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21449 <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>
21450 <div class="gallerytext">
21451 </div>
21452 </div></li>
21453 </ul>
21454
21455 !! end
21456
21457 !!test
21458 Language parser function
21459 !! wikitext
21460 {{#language:ar}}
21461 !! html
21462 <p>العربية
21463 </p>
21464 !! end
21465
21466 !!test
21467 Padleft and padright as substr
21468 !! wikitext
21469 {{padleft:|3|abcde}}
21470 {{padright:|3|abcde}}
21471 !! html
21472 <p>abc
21473 abc
21474 </p>
21475 !! end
21476
21477 !!test
21478 Special parser function
21479 !! wikitext
21480 {{#special:RandomPage}}
21481 {{#special:BaDtItLe}}
21482 {{#special:Foobar}}
21483 !! html
21484 <p>Special:Random
21485 Special:Badtitle
21486 Special:Foobar
21487 </p>
21488 !! end
21489
21490 !!test
21491 Bug 34939 - Case insensitive link parsing ([HttP://])
21492 !! wikitext
21493 [HttP://MediaWiki.Org/]
21494 !! html/php
21495 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
21496 </p>
21497 !! html/parsoid
21498 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
21499 !! end
21500
21501 !!test
21502 Bug 34939 - Case insensitive link parsing ([HttP:// title])
21503 !! wikitext
21504 [HttP://MediaWiki.Org/ MediaWiki]
21505 !! html
21506 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
21507 </p>
21508 !! end
21509
21510 !!test
21511 Bug 34939 - Case insensitive link parsing (HttP://)
21512 !! wikitext
21513 HttP://MediaWiki.Org/
21514 !! html/php
21515 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
21516 </p>
21517 !! html/parsoid
21518 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
21519 !! end
21520
21521 !!test
21522 Disable TOC
21523 !! options
21524 notoc
21525 !! wikitext
21526 Lead
21527 == Section 1 ==
21528 == Section 2 ==
21529 == Section 3 ==
21530 == Section 4 ==
21531 == Section 5 ==
21532 !! html
21533 <p>Lead
21534 </p>
21535
21536 <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>
21537 <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>
21538 <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>
21539 <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>
21540 <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>
21541
21542 !! end
21543
21544
21545 ###
21546 ### Parsoid-specific tests
21547 ### Parsoid-PHP parser incompatibilities
21548 ###
21549 !!test
21550 1. SOL-sensitive wikitext tokens as template-args
21551 !!options
21552 parsoid=wt2html,wt2wt
21553 !! wikitext
21554 {{echo|*a}}
21555 {{echo|#a}}
21556 {{echo|:a}}
21557 !! html
21558 <span about="#mwt1" typeof="mw:Transclusion">
21559 </span><ul about="#mwt1"><li>a</li>
21560 </ul>
21561 <span about="#mwt2" typeof="mw:Transclusion">
21562 </span><ol about="#mwt2"><li>a</li>
21563 </ol>
21564 <span about="#mwt3" typeof="mw:Transclusion">
21565 </span><dl about="#mwt3"><dd>a</dd>
21566 </dl>
21567 !!end
21568
21569 #### -----------------------------------------------------------------
21570 #### Parsoid-specific functionality tests
21571 #### -----------------------------------------------------------------
21572
21573 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
21574 # We know wt2wt will fail, but we expect selser to pass.
21575 # Due to the nature of our testing, wt2wt and selser tests will enter the
21576 # blacklist and we'll catch selser regressions based on changes to the
21577 # blacklist entries for selser tests.
21578 !! test
21579 1. Bad treebuilder fixup of formatting elt is cleaned up
21580 !! options
21581 parsoid=wt2html,wt2wt
21582 !! wikitext
21583 {|
21584 |
21585 <small>
21586 [[Image:Foobar.jpg|right|Test]]
21587 </small>
21588 |}
21589 !! html/parsoid
21590 <table>
21591 <tbody><tr><td>
21592 <small>
21593 <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>
21594 </small>
21595 </td></tr>
21596 </tbody></table>
21597 !! end
21598
21599 !! test
21600 2. Bad treebuilder fixup of formatting elt is cleaned up
21601 !! options
21602 parsoid=wt2html,wt2wt
21603 !! wikitext
21604 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
21605
21606 <small>[[Image:Foobar.jpg|right|300px]]</small>
21607 !! html/parsoid
21608
21609 <p><b>foo</b></p>
21610 <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>
21611 <p><b>bar</b></p>
21612 <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>
21613 !! end
21614
21615 !! test
21616 3. Bad treebuilder fixup of formatting elt is cleaned up
21617 !! options
21618 parsoid=wt2html,wt2wt
21619 !! wikitext
21620 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
21621 !! html/parsoid
21622 <p><small><b>foo</b></small></p>
21623 <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>
21624 <p><small><b>bar</b></small></p>
21625 !! end
21626
21627 !! test
21628 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
21629 !! options
21630 parsoid=wt2html,wt2wt
21631 !! wikitext
21632 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
21633 !! html/parsoid
21634 <p><b><small></small></b></p>
21635 <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>
21636 <p></p>
21637 !! end
21638
21639 #### ----------------------------------------------------------------
21640 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
21641 #### tags. Parsoid's output for these tags differs from that of the
21642 #### PHP parser.
21643 #### ----------------------------------------------------------------
21644
21645 !!test
21646 Ref: 1. ref-location should be replaced with an index span
21647 !! wikitext
21648 A <ref>foo</ref>
21649 B <ref name="x">foo</ref>
21650 C <ref name="y" />
21651 <references />
21652 !! html/parsoid
21653 <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>
21654 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>
21655 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>
21656 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21657 <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>
21658 <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>
21659 <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>
21660 </ol>
21661 !!end
21662
21663 !!test
21664 Ref: 2. ref-tags with identical names should all get the same index
21665 !! wikitext
21666 A <ref name="x">foo</ref>
21667 B <ref name="x" />
21668 <references />
21669 !! html/parsoid
21670 <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>
21671 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>
21672 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21673 <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>
21674 </ol>
21675 !!end
21676
21677 !!test
21678 Ref: 3. spaces in ref-names should be ignored
21679 !! wikitext
21680 A <ref name="x">foo</ref>
21681 B <ref name=" x " />
21682 C <ref name= x />
21683 <references />
21684 !! html/parsoid
21685 <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>
21686 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>
21687 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>
21688 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21689 <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>
21690 </ol>
21691 !!end
21692
21693 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
21694 !!test
21695 Ref: 4. 'constructor' should be accepted as a valid ref-name
21696 !! wikitext
21697 A <ref name="constructor">foo</ref>
21698 <references />
21699 !! html/parsoid
21700 <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>
21701 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21702 <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>
21703 </ol>
21704 !!end
21705
21706 !!test
21707 Ref: 5. body should accept generic wikitext
21708 !! wikitext
21709 A <ref>
21710 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
21711 </ref>
21712
21713 <references />
21714 !! html/parsoid
21715 <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>
21716
21717 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21718 <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>
21719 </span></li>
21720 </ol>
21721 !!end
21722
21723 !!test
21724 Ref: 6. indent-pres should not be output in ref-body
21725 !! wikitext
21726 A <ref>
21727 foo
21728 bar
21729 baz
21730 </ref>
21731
21732 <references />
21733 !! html/parsoid
21734 <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>
21735
21736 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21737 <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
21738 bar
21739 baz
21740 </span></li>
21741 </ol>
21742 !!end
21743
21744 !!test
21745 Ref: 7. No p-wrapping in ref-body
21746 !! wikitext
21747 A <ref>
21748 foo
21749
21750 bar
21751
21752
21753 baz
21754
21755
21756
21757 booz
21758 </ref>
21759
21760 <references />
21761 !! html/parsoid
21762 <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>
21763
21764 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21765 <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
21766
21767 bar
21768
21769
21770 baz
21771
21772
21773
21774 booz
21775 </span></li>
21776 </ol>
21777 !!end
21778
21779 !!test
21780 Ref: 8. transclusion wikitext has lower precedence
21781 !! wikitext
21782 A <ref> foo {{echo|</ref> B C}}
21783
21784 <references />
21785 !! html/parsoid
21786 <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<span typeof="mw:Nowiki">}}</span></p>
21787 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21788 <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>
21789 </ol>
21790 !!end
21791
21792 !!test
21793 Ref: 9. unclosed comments should not leak out of ref-body
21794 !! wikitext
21795 A <ref> foo <!--</ref> B C
21796 <references />
21797 !! html/parsoid
21798 <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>
21799 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21800 <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>
21801 </ol>
21802 !!end
21803
21804 !!test
21805 Ref: 10. Unclosed HTML tags should not leak out of ref-body
21806 !! wikitext
21807 A <ref> <b> foo </ref> B C
21808
21809 <references />
21810 !! html/parsoid
21811 <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>
21812
21813
21814 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21815 <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>
21816 </ol>
21817 !!end
21818
21819 !!test
21820 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
21821 !! wikitext
21822 A <ref>foo</ref> B
21823 C <ref>bar</ref> D
21824 <references />
21825 !! html/parsoid
21826 <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
21827 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>
21828 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21829 <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>
21830 <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>
21831 </ol>
21832 !!end
21833
21834 !!test
21835 Ref: 12. ref-tags act as trailing newline migration barrier
21836 !! wikitext
21837 <!--the newline at the end of this line moves out of the p tag-->a
21838
21839 b<!--the newline at the end of this line stays inside the p tag--> <ref />
21840 <ref />
21841
21842 c
21843 <references />
21844 !! html/parsoid
21845 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
21846
21847
21848 <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>
21849 <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>
21850
21851 <p>c</p>
21852 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21853 <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>
21854 <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>
21855 !!end
21856
21857 !!test
21858 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
21859 !! wikitext
21860 <ref>foo</ref> A
21861 <ref>bar
21862 </ref> B
21863 <references />
21864 !! html/parsoid
21865 <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
21866 <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>
21867 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21868 <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>
21869 <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
21870 </span></li>
21871 </ol>
21872 !!end
21873
21874 !!test
21875 Ref: 14. A nested ref-tag should be emitted as plain text
21876 !! wikitext
21877 <ref>foo <ref>bar</ref> baz</ref>
21878
21879 <references />
21880 !! html/parsoid
21881 <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>
21882 </p>
21883 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21884 <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>
21885 </ol>
21886 !!end
21887
21888 !!test
21889 Ref: 15. ref-tags with identical names should get identical indexes
21890 !! wikitext
21891 A1 <ref name="a">foo</ref> A2 <ref name="a" />
21892 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
21893
21894 <references />
21895 !! html/parsoid
21896 <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>
21897 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>
21898
21899 <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>
21900 </ol>
21901 !!end
21902
21903 ## We don't bother wt2wt-ing non-standard whitespace
21904 !!test
21905 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
21906 !!options
21907 parsoid=wt2html
21908 !! wikitext
21909 A <ref >foo</ref >
21910
21911 <references />
21912 !! html/parsoid
21913 <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>
21914 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21915 <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>
21916 !!end
21917
21918 !!test
21919 Ref: 17. Generate valid HTML5 id/about attributes
21920 !!wikitext
21921 <ref name="a b">foo</ref>
21922
21923 <references />
21924 !!html/parsoid
21925 <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>
21926 </p>
21927
21928 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21929 <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>
21930 </ol>
21931 !!end
21932
21933 !!test
21934 Ref: 18. T58916: Extension attributes should be parsed as plain text
21935 !!wikitext
21936 <ref name="{{echo|a}}">foo</ref>
21937
21938 <references />
21939 !!html/parsoid
21940 <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>
21941 </p>
21942
21943 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21944 <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>
21945 </ol>
21946 !!end
21947
21948 !!test
21949 Ref: 19. ref-tags with identical name encodings should get identical indexes
21950 !! wikitext
21951 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
21952
21953 <references />
21954 !! html/parsoid
21955 <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>
21956 </p>
21957 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21958 <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>
21959 </ol>
21960 !!end
21961
21962 !!test
21963 Ref: 20. ref-tags with identical names but different content should keep it
21964 !! wikitext
21965 A <ref name="foo">Foo one</ref>
21966 B <ref name="foo">Foo two</ref>
21967 C <ref name="foo" />
21968
21969 <references />
21970 !! html/parsoid
21971 <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>
21972 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>
21973 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>
21974
21975 <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>
21976 </ol>
21977 !!end
21978
21979 !!test
21980 References: 1. references tag without any refs should be handled properly
21981 !! wikitext
21982 <references />
21983 !! html/parsoid
21984 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21985 !!end
21986
21987 !!test
21988 References: 2. references tag with group only outputs references from that group
21989 !! wikitext
21990 A <ref group="a">foo</ref>
21991 B <ref group="b">bar</ref>
21992 C <ref>baz</ref>
21993
21994 <references group="a" />
21995 <references />
21996 <references group="b" />
21997 !! html/parsoid
21998 <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>
21999 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>
22000 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>
22001
22002 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
22003 <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>
22004 </ol>
22005 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
22006 <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>
22007 </ol>
22008 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
22009 <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>
22010 </ol>
22011 !!end
22012
22013 !!test
22014 References: 3. ref list should be cleared after processing references
22015 !! wikitext
22016 A <ref>foo</ref>
22017
22018 <references />
22019
22020 B <ref>bar</ref>
22021
22022 <references />
22023 !! html/parsoid
22024 <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>
22025
22026 <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>
22027 </ol>
22028
22029 <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>
22030
22031 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22032 <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>
22033 </ol>
22034 !!end
22035
22036 !!test
22037 References: 4. only referenced group should be cleared after processing references
22038 !! wikitext
22039 A <ref group="a">afoo</ref>
22040 B <ref>bfoo</ref>
22041
22042 <references group="a" />
22043
22044 C <ref>cfoo</ref>
22045
22046 <references />
22047 !! html/parsoid
22048 <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>
22049 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>
22050
22051 <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>
22052 </ol>
22053
22054 <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>
22055
22056 <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>
22057 </ol>
22058 !!end
22059
22060 ## Don't expect this to rt since we're dropping content
22061 !! test
22062 References: 5. ref tags in references should be processed while ignoring all other content
22063 !! options
22064 parsoid=wt2html,html2html
22065 !! wikitext
22066 A <ref name="a" />
22067 B <ref name="b">bar</ref>
22068
22069 <references>
22070 <ref name="a">foo</ref>
22071 This should just get lost.
22072 </references>
22073 !! html/parsoid
22074 <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>
22075 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>
22076
22077
22078 <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>
22079 </ol>
22080 !! end
22081
22082 !! test
22083 References: 6. <references /> from a transclusion
22084 !! wikitext
22085 <ref>Foo</ref> {{echo|<references />}}
22086 !! html/parsoid
22087 <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>
22088 </ol>
22089 !! end
22090
22091 !! test
22092 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
22093 !! wikitext
22094 A <ref>foo bar for a</ref>
22095 B <ref group="X" name="b" />
22096
22097 <references />
22098
22099 <references group="X">
22100 <ref name="b">foo</ref>
22101 </references>
22102 !! html/parsoid
22103 <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>
22104 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>
22105 </p>
22106
22107 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22108 <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>
22109 </ol>
22110
22111 <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"}}'>
22112 <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>
22113 </ol>
22114 !! end
22115
22116 !! test
22117 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
22118 !! wikitext
22119 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
22120 <references />
22121 !! html/parsoid
22122 <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>
22123 <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>
22124 </ol>
22125 !!end
22126
22127 # This test only works in wt2html now as the <references /> are always generated
22128 # unless selser is active. Once T72722 is fixed, we should add a changes test
22129 # here to ensure that unrelated changes don't add the new <references /> in
22130 # wt2wt.
22131 !! test
22132 References: 9. Generate missing references list at the end
22133 !! wikitext
22134 A <ref>foo</ref>
22135 B <ref group="inexistent">bar</ref>
22136 !! html/parsoid
22137 <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>
22138 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22139 <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>
22140 </ol>
22141 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
22142 <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>
22143 </ol>
22144 !! end
22145
22146 !! test
22147 References: 10. New <references/> shouldn't be added for unrelated edits.
22148 !! options
22149 parsoid={
22150 "modes": ["selser"],
22151 "changes": [["#x", "remove"]],
22152 "selser": "noauto"
22153 }
22154 !! wikitext
22155 Unrelated text<span id="x"> that's going to disappear</span>.
22156 A <ref>foo</ref>
22157 !! wikitext/edited
22158 Unrelated text.
22159 A <ref>foo</ref>
22160 !!end
22161
22162 !! test
22163 Entities in ref name
22164 !! wikitext
22165 <ref name="test &amp; me">hi</ref>
22166 <references />
22167 !! html/parsoid
22168 <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>
22169 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22170 <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>
22171 </ol>
22172 !! end
22173
22174 # This test is wt2html only because we're permitting the serializer to produce
22175 # dirty diffs, normalizing the unclosed references to the self-closed version.
22176 !! test
22177 Generate references for unclosed references tag
22178 !! options
22179 parsoid=wt2html
22180 !! wikitext
22181 a<ref>foo</ref>
22182
22183 <references>
22184 !! html/parsoid
22185 <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>
22186 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22187 <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>
22188 !! end
22189
22190 !! test
22191 New reference serializes on its own line
22192 !! options
22193 parsoid=wt2wt,html2wt
22194 !! wikitext
22195 foo
22196 <references />
22197 !! html/parsoid
22198 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22199 !! end
22200
22201 #### ----------------------------------------------------------------
22202 #### Parsoid-only testing of Parsoid's impl of LST
22203 #### Not implemented yet, see
22204 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
22205 #### ----------------------------------------------------------------
22206
22207 !! test
22208 LST Sections: 1. Simple section start and end
22209 !! options
22210 parsoid={ "suppressErrors": true }
22211 !! wikitext
22212 <section begin="2011-05-16" />
22213 <section end="2014-04-10 (MW 1.23wmf22)" />
22214 !! html/parsoid
22215 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
22216 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
22217 !! end
22218
22219 #--------- Test stripping of empty nodes in template content ----------
22220 !!test
22221 Empty LI and TR nodes should be stripped from template content
22222 !!wikitext
22223 {{EmptyLITest}}
22224 {{EmptyTRTest}}
22225 !!html/parsoid
22226 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
22227 <li>a</li>
22228 <li>b</li>
22229 </ul>
22230 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
22231 <tbody>
22232 <tr>
22233 <td>foo</td>
22234 </tr>
22235 <tr>
22236 <td>bar</td>
22237 </tr>
22238 </tbody>
22239 </table>
22240 !!end
22241
22242 !!test
22243 Empty LI and TR nodes should not be stripped from top-level content
22244 !!wikitext
22245 * a
22246 *
22247 * b
22248 {|
22249 |-
22250 |-
22251 |foo
22252 |}
22253 !!html/parsoid
22254 <ul>
22255 <li> a</li>
22256 <li></li>
22257 <li> b</li>
22258 </ul>
22259 <table>
22260 <tbody>
22261 <tr></tr>
22262 <tr>
22263 <td>foo</td>
22264 </tr>
22265 </tbody>
22266 </table>
22267 !!end
22268
22269 !!test
22270 Empty TR nodes should not be stripped if they have any attributes set
22271 !!wikitext
22272 {{EmptyTRWithHTMLAttrTest}}
22273 !!html/parsoid
22274 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
22275 <tr align="center"></tr>
22276 <tr><td>foo</td></tr>
22277 <tr align="center"></tr>
22278 <tr><td>bar</td></tr>
22279 </table>
22280 !!end
22281
22282 #### ----------------------------------------------------------------
22283 #### The following section of tests are primarily to test
22284 #### wikitext escaping capabilities of Parsoid. Given that
22285 #### escaping can be done any number of ways, the wikitext (input)
22286 #### is always adjusted to reflect how Parsoid adds nowiki
22287 #### escape tags.
22288 ####
22289 #### We are marking several tests as parsoid-only since the
22290 #### HTML in the result section is different from what the
22291 #### PHP parser generates for it.
22292 #### ----------------------------------------------------------------
22293
22294
22295 #### --------------- Headings ---------------
22296 #### 0. Unnested
22297 #### 1. Nested inside html <h1>=foo=</h1>
22298 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
22299 #### 3. Nested inside html with wikitext split by html tags
22300 #### 4. No escape needed
22301 #### 5. Empty headings <h1></h1>
22302 #### 6. Heading chars in SOL context
22303 #### ----------------------------------------
22304 !! test
22305 Headings: 0. Unnested
22306 !! options
22307 parsoid=html2wt
22308 !! html/parsoid
22309 <p>=foo=</p>
22310
22311 <p> =foo=
22312 <!--cmt-->
22313 =foo=</p>
22314
22315 <p>=foo<i>a</i>=</p>
22316 !! wikitext
22317 <nowiki>=foo=</nowiki>
22318
22319 <nowiki> </nowiki>=foo=
22320 <!--cmt-->
22321 <nowiki>=foo=</nowiki>
22322
22323 =foo''a''<nowiki>=</nowiki>
22324 !!end
22325
22326 # New headings and existing headings are handled differently
22327 !! test
22328 Headings: 1. Nested inside html
22329 !! options
22330 parsoid=html2wt
22331 !! html/parsoid
22332 <h1>=foo=</h1>
22333 <h2>=foo=</h2>
22334 <h3>=foo=</h3>
22335
22336 <h1 data-parsoid=''>=foo=</h1>
22337 <h2 data-parsoid=''>=foo=</h2>
22338 <h3 data-parsoid=''>=foo=</h3>
22339 <h4 data-parsoid=''>=foo=</h4>
22340 <h5 data-parsoid=''>=foo=</h5>
22341 <h6 data-parsoid=''>=foo=</h6>
22342 !! wikitext
22343 = =foo= =
22344
22345 == =foo= ==
22346
22347 === =foo= ===
22348
22349 =<nowiki>=foo=</nowiki>=
22350 ==<nowiki>=foo=</nowiki>==
22351 ===<nowiki>=foo=</nowiki>===
22352 ====<nowiki>=foo=</nowiki>====
22353 =====<nowiki>=foo=</nowiki>=====
22354 ======<nowiki>=foo=</nowiki>======
22355
22356 !!end
22357
22358 !! test
22359 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
22360 !! options
22361 parsoid=html2wt
22362 !! html/parsoid
22363 <h1>foo</h1>*bar
22364 <h1>foo</h1>=bar
22365 <h1>foo</h1>=bar=
22366 !! wikitext
22367 = foo =
22368 <nowiki>*</nowiki>bar
22369
22370 = foo =
22371 =bar
22372
22373 = foo =
22374 <nowiki>=bar=</nowiki>
22375 !!end
22376
22377 !! test
22378 Headings: 3. Nested inside html with wikitext split by html tags
22379 !! options
22380 parsoid=html2wt
22381 !! html/parsoid
22382 <h1>=<b>bold</b>foo=</h1>
22383 !! wikitext
22384 = ='''bold'''foo= =
22385 !!end
22386
22387 !! test
22388 Headings: 4a. No escaping needed (testing just h1 and h2)
22389 !! options
22390 parsoid=html2wt
22391 !! html/parsoid
22392 <h1>=foo</h1>
22393 <h1>foo=</h1>
22394 <h1> =foo= </h1>
22395 <h1>=foo= bar</h1>
22396 <h2>=foo</h2>
22397 <h2>foo=</h2>
22398 <h1>=</h1>
22399 <h1><i>=</i>foo=</h1>
22400 !! wikitext
22401 = =foo =
22402
22403 = foo= =
22404
22405 = =foo= =
22406
22407 = =foo= bar =
22408
22409 == =foo ==
22410
22411 == foo= ==
22412
22413 = = =
22414
22415 = ''=''foo= =
22416 !!end
22417
22418 !! test
22419 Headings: 4b. No escaping needed (inside p-tags)
22420 !! options
22421 parsoid=html2wt
22422 !! html/parsoid
22423 <p>===
22424 =foo= x
22425 =foo= <s></s>
22426 </p>
22427 !! wikitext
22428 ===
22429 =foo= x
22430 =foo= <s></s>
22431 !!end
22432
22433 !! test
22434 Headings: 5. Empty headings
22435 !! options
22436 parsoid=html2wt
22437 !! html/parsoid
22438 <h1 data-parsoid='{}'></h1>
22439
22440 <h2 data-parsoid='{}'></h2>
22441
22442 <h3 data-parsoid='{}'></h3>
22443
22444 <h4 data-parsoid='{}'></h4>
22445
22446 <h5 data-parsoid='{}'></h5>
22447
22448 <h6 data-parsoid='{}'></h6>
22449 !! wikitext
22450 =<nowiki/>=
22451
22452 ==<nowiki/>==
22453
22454 ===<nowiki/>===
22455
22456 ====<nowiki/>====
22457
22458 =====<nowiki/>=====
22459
22460 ======<nowiki/>======
22461 !!end
22462
22463 !! test
22464 Headings: 6a. Heading chars in SOL context (with trailing spaces)
22465 !! options
22466 parsoid=html2wt
22467 !! html/parsoid
22468 <p>=a=</p>
22469
22470 <p>=a=</p>
22471
22472 <p>=a=</p>
22473 !! wikitext
22474 <nowiki>=a=</nowiki>
22475
22476 <nowiki>=a=</nowiki>
22477
22478 <nowiki>=a=</nowiki>
22479 !!end
22480
22481 !! test
22482 Headings: 6b. Heading chars in SOL context (with trailing newlines)
22483 !! options
22484 parsoid=html2wt
22485 !! html/parsoid
22486 <p>=a=
22487 b</p>
22488
22489 <p>=a=
22490 b</p>
22491
22492 <p>=a=
22493 b</p>
22494 !! wikitext
22495 <nowiki>=a=</nowiki>
22496 b
22497
22498 <nowiki>=a=</nowiki>
22499 b
22500
22501 <nowiki>=a=</nowiki>
22502 b
22503 !!end
22504
22505 !! test
22506 Headings: 6c. Heading chars in SOL context (leading newline break)
22507 !! options
22508 parsoid=html2wt
22509 !! html/parsoid
22510 <p>a
22511 =b=</p>
22512 !! wikitext
22513 a
22514 <nowiki>=b=</nowiki>
22515 !!end
22516
22517 !! test
22518 Headings: 6d. Heading chars in SOL context (with interspersed comments)
22519 !! options
22520 parsoid=html2wt
22521 !! html/parsoid
22522 <!--c0--><p>=a=</p>
22523
22524 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
22525 !! wikitext
22526 <!--c0--><nowiki>=a=</nowiki>
22527
22528 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
22529 !!end
22530
22531 !! test
22532 Headings: 6d. Heading chars in SOL context (No escaping needed)
22533 !! options
22534 parsoid=html2wt
22535 !! html/parsoid
22536 =a=<div>b</div>
22537 !! wikitext
22538 =a=<div>b</div>
22539 !!end
22540
22541 !! test
22542 Headings: 7. Insert a newline between new content and headings
22543 !! options
22544 parsoid=html2wt
22545 !! html/parsoid
22546 <h2>NEW</h2>
22547 <p>new</p>
22548 <h2 data-parsoid='{}'>A</h2>
22549 <p data-parsoid='{}'>a</p>
22550 !! wikitext
22551 == NEW ==
22552 new
22553
22554 ==A==
22555 a
22556
22557 !! end
22558
22559 #### --------------- Lists ---------------
22560 #### 0. Outside nests (*foo, etc.)
22561 #### 1. Nested inside html <ul><li>*foo</li></ul>
22562 #### 2. Inside definition lists
22563 #### 3. Only bullets at start should be escaped
22564 #### 4. No escapes needed
22565 #### 5. No unnecessary escapes
22566 #### 6. Escape bullets in SOL position
22567 #### 7. Escape bullets in a multi-line context
22568 #### ----------------------------------------
22569
22570 !! test
22571 Lists: 0. Outside nests
22572 !! options
22573 parsoid=html2wt
22574 !! html/parsoid
22575 <p>*foo</p>
22576
22577 <p>#foo</p>
22578
22579 <p>;Foo:bar</p>
22580 !! wikitext
22581 <nowiki>*</nowiki>foo
22582
22583 <nowiki>#</nowiki>foo
22584
22585 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
22586 !!end
22587
22588 ## Making these next 3 tests Parsoid-only since they are html2wt tests
22589 ## to test wikitext escaping, and insignificant whitespace diffs
22590 ## cause PHP parser tests to barf
22591 !! test
22592 Lists: 1. Nested inside html (No unnecessary escapes)
22593 !! options
22594 parsoid=html2wt
22595 !! html/parsoid
22596 <ul>
22597 <li>*foo</li>
22598 <li>#foo</li>
22599 <li>:foo</li>
22600 <li>;foo</li>
22601 <li data-parsoid='{}'>*foo</li>
22602 <li data-parsoid='{}'>#foo</li>
22603 <li data-parsoid='{}'>:foo</li>
22604 <li data-parsoid='{}'>;foo</li>
22605 </ul>
22606
22607 <ol>
22608 <li>*foo</li>
22609 <li>#foo</li>
22610 <li>:foo</li>
22611 <li>;foo</li>
22612 <li data-parsoid='{}'>*foo</li>
22613 <li data-parsoid='{}'>#foo</li>
22614 <li data-parsoid='{}'>:foo</li>
22615 <li data-parsoid='{}'>;foo</li>
22616 </ol>
22617 !! wikitext
22618 * *foo
22619 * #foo
22620 * :foo
22621 * ;foo
22622 *<nowiki>*foo</nowiki>
22623 *<nowiki>#foo</nowiki>
22624 *<nowiki>:foo</nowiki>
22625 *<nowiki>;foo</nowiki>
22626
22627 # *foo
22628 # #foo
22629 # :foo
22630 # ;foo
22631 #<nowiki>*foo</nowiki>
22632 #<nowiki>#foo</nowiki>
22633 #<nowiki>:foo</nowiki>
22634 #<nowiki>;foo</nowiki>
22635 !!end
22636
22637 !! test
22638 Lists: 2. Inside definition lists
22639 !! options
22640 parsoid=html2wt
22641 !! html/parsoid
22642 <dl><dt>;foo</dt></dl>
22643 <dl><dt>:foo</dt></dl>
22644 <dl><dt>:foo</dt>
22645 <dd>bar</dd></dl>
22646 <dl><dd>:foo</dd></dl>
22647 !! wikitext
22648 ; ;foo
22649
22650 ; <nowiki>:foo</nowiki>
22651
22652 ; <nowiki>:foo</nowiki>
22653 : bar
22654
22655 : :foo
22656 !!end
22657
22658 !! test
22659 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
22660 !! options
22661 parsoid=html2wt
22662 !! html/parsoid
22663 <ul>
22664 <li>*foo*bar</li>
22665 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
22666 </ul>
22667 !! wikitext
22668 * *foo*bar
22669 *<nowiki>*foo</nowiki>''it''*bar
22670 !!end
22671
22672 !! test
22673 Lists: 4. No escapes needed
22674 !! options
22675 parsoid=html2wt
22676 !! html/parsoid
22677 <ul>
22678 <li>foo*bar
22679 </li>
22680 </ul>
22681 <ul>
22682 <li><i>foo</i>*bar
22683 </li>
22684 </ul>
22685 <ul>
22686 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
22687 </li>
22688 </ul>
22689 <ul>
22690 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
22691 </li>
22692 </ul>
22693 !! wikitext
22694 *foo*bar
22695
22696 *''foo''*bar
22697
22698 *[[Foo]]: bar
22699
22700 *[[Foo]]*bar
22701 !!end
22702
22703 !! test
22704 Lists: 5. No unnecessary escapes
22705 !! options
22706 parsoid=html2wt
22707 !! html/parsoid
22708 <ul><li> bar <span>[[foo]]</span></li></ul>
22709 <ul><li> =bar <span>[[foo]]</span></li></ul>
22710 <ul><li> [[bar <span>[[foo]]</span></li></ul>
22711 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
22712 <ul><li> =bar <span>foo]]</span>=</li></ul>
22713 <ul><li> <s></s>: a</li></ul>
22714 <ul><li> <i>* foo</i></li></ul>
22715
22716 !! wikitext
22717 * bar <span><nowiki>[[foo]]</nowiki></span>
22718
22719 * =bar <span><nowiki>[[foo]]</nowiki></span>
22720
22721 * [[bar <span><nowiki>[[foo]]</nowiki></span>
22722
22723 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
22724
22725 * =bar <span>foo]]</span>=
22726
22727 * <s></s>: a
22728
22729 * ''* foo''
22730 !!end
22731
22732 !! test
22733 Lists: 6. Escape bullets in SOL position
22734 !! options
22735 parsoid=html2wt
22736 !! html/parsoid
22737 <p><!--cmt-->*foo</p>
22738 !! wikitext
22739 <!--cmt--><nowiki>*</nowiki>foo
22740 !!end
22741
22742 !! test
22743 Lists: 7. Escape bullets in a multi-line context
22744 !! options
22745 parsoid=html2wt
22746 !! html/parsoid
22747 <p>a
22748 *b
22749 </p>
22750 !! wikitext
22751 a
22752 <nowiki>*</nowiki>b
22753 !!end
22754
22755 !! test
22756 Lists: 8. Escape colons only if not present in tags
22757 !! options
22758 parsoid=html2wt
22759 !! html/parsoid
22760 <dl><dt>a:b<i>c:d</i></dt></dl>
22761 !! wikitext
22762 ; <nowiki>a:b</nowiki>''c:d''
22763 !! end
22764
22765 #### --------------- HRs ---------------
22766 #### 1. Single line
22767 #### -----------------------------------
22768
22769 !! test
22770 HRs: 1. Single line
22771 !! options
22772 parsoid=html2wt
22773 !! html/parsoid
22774 <hr />----
22775 <hr />=foo=
22776 <hr />*foo
22777 !! wikitext
22778 ----<nowiki>----</nowiki>
22779 ----=foo=
22780 ----*foo
22781 !! end
22782
22783 #### --------------- Tables ---------------
22784 #### 1a. Simple example
22785 #### 1b. No escaping needed (!foo)
22786 #### 1c. No escaping needed (|foo)
22787 #### 1d. No escaping needed (|}foo)
22788 ####
22789 #### 2a. Nested in td (<td>foo|bar</td>)
22790 #### 2b. Nested in td (<td>foo||bar</td>)
22791 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
22792 ####
22793 #### 3a. Nested in th (<th>foo!bar</th>)
22794 #### 3b. Nested in th (<th>foo!!bar</th>)
22795 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
22796 ####
22797 #### 4a. Escape -
22798 #### 4b. Escape +
22799 #### 4c. No escaping needed
22800 #### --------------------------------------
22801
22802 !! test
22803 Tables: 1a. Simple example
22804 !! options
22805 parsoid=html2wt
22806 !! html/parsoid
22807 <p>{|
22808 |}
22809 </p>
22810 !! wikitext
22811 <nowiki>{|</nowiki>
22812 |}
22813 !! end
22814
22815 !! test
22816 Tables: 1b. No escaping needed
22817 !! options
22818 parsoid=html2wt
22819 !! html/parsoid
22820 <p>!foo
22821 </p>
22822 !! wikitext
22823 !foo
22824 !! end
22825
22826 !! test
22827 Tables: 1c. No escaping needed
22828 !! options
22829 parsoid=html2wt
22830 !! html/parsoid
22831 <p>|foo
22832 </p>
22833 !! wikitext
22834 |foo
22835 !! end
22836
22837 !! test
22838 Tables: 1d. No escaping needed
22839 !! options
22840 parsoid=html2wt
22841 !! html/parsoid
22842 <p>|}foo
22843 </p>
22844 !! wikitext
22845 |}foo
22846 !! end
22847
22848 !! test
22849 Tables: 2a. Nested in td
22850 !! options
22851 parsoid=html2wt
22852 !! html/parsoid
22853 <table><tbody><tr>
22854 <td>foo|bar</td></tr>
22855 <tr><td>x<div>a|b</div></td>
22856 </tbody></table>
22857 !! wikitext
22858 {|
22859 |<nowiki>foo|bar</nowiki>
22860 |-
22861 |x<div><nowiki>a|b</nowiki></div>
22862 |}
22863 !! html/php+tidy
22864 <table>
22865 <tr>
22866 <td>foo|bar</td>
22867 </tr>
22868 <tr>
22869 <td>x
22870 <div>a|b</div>
22871 </td>
22872 </tr>
22873 </table>
22874 !! end
22875
22876 !! test
22877 Tables: 2b. Nested in td
22878 !! options
22879 parsoid=html2wt
22880 !! html/parsoid
22881 <table><tbody><tr>
22882 <td>foo||bar</td>
22883 <td>a<i>b||c</i></td>
22884 <td>a<i><div>b||c</div></i></td>
22885 </tr></tbody></table>
22886 !! wikitext
22887 {|
22888 |<nowiki>foo||bar</nowiki>
22889 |a''<nowiki>b||c</nowiki>''
22890 |a''<div><nowiki>b||c</nowiki></div>''
22891 |}
22892 !! html/php
22893 <table>
22894 <tr>
22895 <td>foo||bar
22896 </td>
22897 <td>a<i>b||c</i>
22898 </td>
22899 <td>a<i><div>b||c</div></i>
22900 </td></tr></table>
22901
22902 !! end
22903
22904 !! test
22905 Tables: 2c. Nested in td -- no escaping needed
22906 !! options
22907 parsoid=html2wt
22908 !! html/*
22909 <table>
22910
22911 <tr>
22912 <td>foo!!bar
22913 </td></tr></table>
22914
22915 !! wikitext
22916 {|
22917
22918 |foo!!bar
22919 |}
22920 !! end
22921
22922 !! test
22923 Tables: 3a. Nested in th
22924 !! options
22925 parsoid=html2wt
22926 !! html/*
22927 <table>
22928
22929 <tr>
22930 <th>foo!bar
22931 </th></tr></table>
22932
22933 !! wikitext
22934 {|
22935
22936 !foo!bar
22937 |}
22938 !! end
22939
22940 !! test
22941 Tables: 3b. Nested in th
22942 !! options
22943 parsoid=html2wt
22944 !! html/parsoid
22945 <table><tbody>
22946 <tr><th>foo!!bar</th>
22947 <th><i>foo|bar</i></th>
22948 <th><i>foo!!bar</i></th>
22949 <th><i><span>foo!!bar</span></i></th>
22950 </tr></tbody></table>
22951 !! wikitext
22952 {|
22953 !<nowiki>foo!!bar</nowiki>
22954 !''<nowiki>foo|bar</nowiki>''
22955 !''<nowiki>foo!!bar</nowiki>''
22956 !''<span><nowiki>foo!!bar</nowiki></span>''
22957 |}
22958 !! html/php
22959 <table>
22960 <tr>
22961 <th>foo!!bar
22962 </th>
22963 <th><i>foo|bar</i>
22964 </th>
22965 <th><i>foo!!bar</i>
22966 </th>
22967 <th><i><span>foo!!bar</span></i>
22968 </th></tr></table>
22969
22970 !! end
22971
22972 !! test
22973 Tables: 3c. Nested in th
22974 !! options
22975 parsoid=html2wt
22976 !! html/parsoid
22977 <table><tbody>
22978 <tr><th>foo||bar</th>
22979 <th><span typeof="mw:Nowiki">foo||bar</span></th>
22980 </tr></tbody></table>
22981 !! wikitext
22982 {|
22983 !<nowiki>foo||bar</nowiki>
22984 !<nowiki>foo||bar</nowiki>
22985 |}
22986 !! html/php
22987 <table>
22988 <tr>
22989 <th>foo||bar
22990 </th>
22991 <th>foo||bar
22992 </th></tr></table>
22993
22994 !! end
22995
22996 !! test
22997 Tables: 4a. Escape -
22998 !! options
22999 parsoid=html2wt
23000 !! html/*
23001 <table>
23002
23003 <tr>
23004 <th>-bar
23005 </th></tr>
23006 <tr>
23007 <td>-bar
23008 </td></tr></table>
23009
23010 !! wikitext
23011 {|
23012
23013 !-bar
23014
23015 |-
23016 |<nowiki>-bar</nowiki>
23017 |}
23018 !! end
23019
23020 !! test
23021 Tables: 4b. Escape +
23022 !! options
23023 parsoid=html2wt
23024 !! html/*
23025 <table>
23026
23027 <tr>
23028 <th>+bar
23029 </th></tr>
23030 <tr>
23031 <td>+bar
23032 </td></tr></table>
23033
23034 !! wikitext
23035 {|
23036
23037 !+bar
23038
23039 |-
23040 |<nowiki>+bar</nowiki>
23041 |}
23042 !! end
23043
23044 !! test
23045 Tables: 4c. No escaping needed
23046 !! options
23047 parsoid=html2wt
23048 !! html/parsoid
23049 <table><tbody>
23050 <tr><td>foo-bar</td><td>foo+bar</td></tr>
23051 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
23052 <tr><td>foo
23053 <p>bar|baz
23054 +bar
23055 -bar</p></td></tr>
23056 <tr><td>x
23057 <div>a|b</div></td>
23058 </tbody></table>
23059 !! wikitext
23060 {|
23061 |foo-bar
23062 |foo+bar
23063 |-
23064 |''foo''-bar
23065 |''foo''+bar
23066 |-
23067 |foo
23068 bar|baz
23069 +bar
23070 -bar
23071 |-
23072 |x
23073 <div>a|b</div>
23074 |}
23075 !! html/php
23076 <table>
23077 <tr>
23078 <td>foo-bar
23079 </td>
23080 <td>foo+bar
23081 </td></tr>
23082 <tr>
23083 <td><i>foo</i>-bar
23084 </td>
23085 <td><i>foo</i>+bar
23086 </td></tr>
23087 <tr>
23088 <td>foo
23089 <p>bar|baz
23090 +bar
23091 -bar
23092 </p>
23093 </td></tr>
23094 <tr>
23095 <td>x
23096 <div>a|b</div>
23097 </td></tr></table>
23098
23099 !! end
23100
23101 !! test
23102 Tables: 4d. No escaping needed
23103 !! options
23104 parsoid=html2wt
23105 !! html/parsoid
23106 <table>
23107 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
23108 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
23109 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
23110 </tbody></table>
23111 !! wikitext
23112 {|
23113 |[[Foo]]-bar
23114 ||+1
23115 ||-2
23116 |}
23117 !! html/php
23118 <table>
23119 <tr>
23120 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
23121 </td>
23122 <td>+1
23123 </td>
23124 <td>-2
23125 </td></tr></table>
23126
23127 !! end
23128
23129 !! test
23130 T97430: Don't emit empty nowiki pairs around marker meta tags
23131 !! options
23132 parsoid=html2wt
23133 !! html/parsoid
23134 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23135 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
23136 !! wikitext
23137 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23138 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
23139 !! end
23140
23141 !! test
23142 Unclosed xmlish element in table line shouldn't eat end delimiters
23143 !! options
23144 parsoid=html2wt
23145 !! html/parsoid
23146 <table>
23147 <tbody><tr><td> &lt;foo</td>
23148 <td> bar></td></tr>
23149 </tbody></table>
23150 !! wikitext
23151 {|
23152 | <foo
23153 | bar>
23154 |}
23155 !! html/php
23156 <table>
23157 <tr>
23158 <td> &lt;foo
23159 </td>
23160 <td> bar&gt;
23161 </td></tr></table>
23162
23163 !! end
23164
23165 #### --------------- Links ----------------
23166 #### 1. Quote marks in link text
23167 #### 2. Wikilinks: Escapes needed
23168 #### 3. Wikilinks: No escapes needed
23169 #### 4. Extlinks: Escapes needed
23170 #### 5. Extlinks: No escapes needed
23171 #### --------------------------------------
23172 !! test
23173 Links 1. WikiLinks: No escapes needed
23174 !! options
23175 parsoid=html2wt
23176 !! html/parsoid
23177 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
23178 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
23179 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
23180 !! wikitext
23181 [[Foo|Foo''boo'']]
23182 [[Foo|[Foobar]]]
23183 [[Foo|x [Foobar] x]]
23184 !! html/php
23185 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
23186 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
23187 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
23188 </p>
23189 !! end
23190
23191 !! test
23192 Links 2. WikiLinks: Escapes needed
23193 !! options
23194 parsoid=html2wt
23195 !! html/parsoid
23196 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
23197 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
23198 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
23199 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
23200 <a href="Foo" rel="mw:WikiLink">|Bar</a>
23201 <a href="Foo" rel="mw:WikiLink">]]bar</a>
23202 <a href="Foo" rel="mw:WikiLink">[[bar</a>
23203 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
23204 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
23205 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
23206 !! wikitext
23207 [[Foo|<nowiki>Foobar]</nowiki>]]
23208 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
23209 [[Foo|<nowiki>[[Bar]]</nowiki>]]
23210 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
23211 [[Foo|<nowiki>|Bar</nowiki>]]
23212 [[Foo|<nowiki>]]bar</nowiki>]]
23213 [[Foo|<nowiki>[[bar</nowiki>]]
23214 [[Foo|<nowiki>x [[ y</nowiki>]]
23215 [[Foo|<nowiki>x ]] y</nowiki>]]
23216 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
23217 !! html/php
23218 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
23219 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
23220 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
23221 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
23222 <a href="/wiki/Foo" title="Foo">|Bar</a>
23223 <a href="/wiki/Foo" title="Foo">]]bar</a>
23224 <a href="/wiki/Foo" title="Foo">[[bar</a>
23225 <a href="/wiki/Foo" title="Foo">x [[ y</a>
23226 <a href="/wiki/Foo" title="Foo">x ]] y</a>
23227 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
23228 </p>
23229 !! end
23230
23231 !! test
23232 Links 3. WikiLinks: No escapes needed
23233 !! options
23234 parsoid=html2wt
23235 !! html/parsoid
23236 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
23237 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
23238 !! wikitext
23239 [[Foo|[Foobar]]
23240 [[Foo|foo|bar]]
23241 !! html/php
23242 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
23243 <a href="/wiki/Foo" title="Foo">foo|bar</a>
23244 </p>
23245 !! end
23246
23247 !! test
23248 Links 4. ExtLinks: Escapes needed
23249 !! options
23250 parsoid=html2wt
23251 !! html/parsoid
23252 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
23253 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
23254 <p>[http://google.com]</p>
23255 <p>[http://google.com google]</p>
23256 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
23257 <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>
23258 !! wikitext
23259 [http://google.com <nowiki>[google]</nowiki>]
23260 [http://google.com <nowiki>google]</nowiki>]
23261
23262 <nowiki>[http://google.com]</nowiki>
23263
23264 <nowiki>[http://google.com google]</nowiki>
23265
23266 [http://google.com<nowiki>]</nowiki>
23267
23268 [{{echo|http://google.com}}<nowiki>]</nowiki>
23269 !! html/php
23270 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
23271 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
23272 </p><p>[http://google.com]
23273 </p><p>[http://google.com google]
23274 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23275 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23276 </p>
23277 !! end
23278
23279 !! test
23280 Links 5. ExtLinks: No escapes needed
23281 !! options
23282 parsoid=html2wt
23283 !! html/parsoid
23284 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
23285 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
23286 !! wikitext
23287 [http://google.com [google]
23288
23289 [[http://google.com]]
23290 !! html/php
23291 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
23292 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
23293 </p>
23294 !! end
23295
23296 !! test
23297 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
23298 !! options
23299 parsoid=html2wt
23300 !! html/parsoid
23301 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
23302 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
23303 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
23304 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
23305 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
23306 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
23307 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23308 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
23309 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23310 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
23311 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
23312 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
23313 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
23314 </p>
23315 !! wikitext
23316 x<nowiki/>http://example.com<nowiki/>y
23317 http://example.com<nowiki/>?x
23318 http://example.com<nowiki/>&x
23319 http://example.com<nowiki/>'x
23320 http://example.com<nowiki/>,x
23321 http://example.com<nowiki/>.x
23322 http://example.com<nowiki/>;x
23323 http://example.com<nowiki/>:x
23324 http://example.com<nowiki/>;x
23325 http://example.com<nowiki/>!x
23326 http://example.com<nowiki/>=x
23327 http://example.com<nowiki/>(x)
23328 http://example.com(x<nowiki/>)
23329 !! end
23330
23331 !! test
23332 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23333 !! options
23334 parsoid=html2wt
23335 !! html/parsoid
23336 <p>x
23337 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
23338 y
23339 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
23340 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
23341 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
23342 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
23343 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
23344 </p>
23345 !! wikitext
23346 x
23347 http://example.com
23348 y
23349 "http://example.com"
23350 (http://example.com)
23351 (http://example.com) foo
23352 http://example.com,
23353 http://example.com, foo
23354 !! html/php
23355 <p>x
23356 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
23357 y
23358 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
23359 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
23360 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
23361 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
23362 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
23363 </p>
23364 !! end
23365
23366 !! test
23367 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23368 !! options
23369 parsoid=html2wt
23370 !! html/parsoid
23371 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
23372 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
23373 !! wikitext
23374 http://example.com.,;:!?\
23375 -http://example.com:
23376 !! html/php
23377 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
23378 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
23379 </p>
23380 !! end
23381
23382 !! test
23383 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
23384 !! options
23385 parsoid=html2wt
23386 !! html/parsoid
23387 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
23388 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
23389 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
23390 !! wikitext
23391 RFC 123<nowiki/>4
23392 RFC 123<nowiki/>y
23393 X<nowiki/>RFC 123<nowiki/>y
23394 !! end
23395
23396 !! test
23397 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
23398 !! options
23399 parsoid=html2wt
23400 !! html/parsoid
23401 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
23402 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
23403 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
23404 </p>
23405 !! wikitext
23406 RFC 123?foo
23407 RFC 123&foo
23408 -RFC 123-
23409 !! html/php
23410 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
23411 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
23412 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
23413 </p>
23414 !! end
23415
23416 !! test
23417 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
23418 !! options
23419 parsoid=html2wt
23420 !! html/parsoid
23421 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
23422 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23423 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23424 !! wikitext
23425 PMID 123<nowiki/>4
23426 PMID 123<nowiki/>y
23427 X<nowiki/>PMID 123<nowiki/>y
23428 !! end
23429
23430 !! test
23431 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
23432 !! options
23433 parsoid=html2wt
23434 !! html/parsoid
23435 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
23436 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
23437 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
23438 </p>
23439 !! wikitext
23440 PMID 123?foo
23441 PMID 123&foo
23442 -PMID 123-
23443 !! html/php
23444 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
23445 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
23446 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
23447 </p>
23448 !! end
23449
23450 !! test
23451 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
23452 !! options
23453 parsoid=html2wt
23454 !! html/parsoid
23455 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
23456 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
23457 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
23458 </p>
23459 !! wikitext
23460 ISBN 1234567890<nowiki/>1
23461 ISBN 1234567890<nowiki/>x
23462 a<nowiki/>ISBN 1234567890<nowiki/>b
23463 !! end
23464
23465 !! test
23466 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
23467 !! options
23468 parsoid=html2wt
23469 !! html/parsoid
23470 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
23471 !! wikitext
23472 -ISBN 1234567890's
23473 !! html/php
23474 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
23475 </p>
23476 !! end
23477
23478 !! test
23479 Links 14. Protect link-like plain text. (Parsoid bug T78425)
23480 !! options
23481 parsoid=html2wt
23482 !! html/*
23483 <p>this is not a link: http://example.com
23484 </p>
23485 !! wikitext
23486 this is not a link: <nowiki>http://example.com</nowiki>
23487 !! end
23488
23489 !! test
23490 Links 15. Link trails can't become link prefixes.
23491 !! options
23492 language=is
23493 parsoid=html2wt
23494 !! html/parsoid
23495 <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>
23496 !! wikitext
23497 [[Söfnuður]]-[[00]]
23498 !! html/php
23499 <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>
23500 </p>
23501 !! end
23502
23503 #### --------------- Quotes ---------------
23504 #### 1. Quotes inside <b> and <i>
23505 #### 2. Link fragments separated by <i> and <b> tags
23506 #### 3. Link fragments inside <i> and <b>
23507 #### 4. No escaping needed
23508 #### --------------------------------------
23509 !! test
23510 1a. Quotes inside <b> and <i>
23511 !! options
23512 parsoid=html2wt
23513 !! html/*
23514 <p><i>'foo'</i>
23515 <i>''foo''</i>
23516 <i>'''foo'''</i>
23517 <i>foo</i>'s
23518 <b>'foo'</b>
23519 <b>''foo''</b>
23520 <b>'''foo'''</b>
23521 <b>foo'<i>bar'</i>baz</b>
23522 <b>foo</b>'s
23523 '<i>foo</i>
23524 <i>foo</i>'
23525 <i>foo'</i>'
23526 '<i>foo</i>'
23527 '<b>foo</b>
23528 <b>foo</b>'
23529 '<b>foo</b>'
23530 <i>fools'<span> errand</span></i>
23531 <i><span>fool</span>'s errand</i>
23532 '<i>foo</i> bar '<i>baz</i>
23533 a|!*#-:;+-~[]{}b'<i>x</i>
23534 </p>
23535 !! wikitext
23536 ''<nowiki/>'foo'''
23537 ''<nowiki>''foo''</nowiki>''
23538 ''<nowiki>'''foo'''</nowiki>''
23539 ''foo''<nowiki/>'s
23540 '''<nowiki/>'foo''''
23541 '''<nowiki>''foo''</nowiki>'''
23542 '''<nowiki>'''foo'''</nowiki>'''
23543 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
23544 '''foo'''<nowiki/>'s
23545 '''foo''
23546 ''foo''<nowiki/>'
23547 ''foo'''<nowiki/>'
23548 '''foo''<nowiki/>'
23549 ''''foo'''
23550 '''foo'''<nowiki/>'
23551 ''''foo'''<nowiki/>'
23552 ''fools'<span> errand</span>''
23553 ''<span>fool</span>'s errand''
23554 '<nowiki/>''foo'' bar '''baz''
23555 a|!*#-:;+-~[]{}b'''x''
23556 !! end
23557
23558 !! test
23559 1b. Quotes inside <b> and <i> with other tags on same line
23560 !! options
23561 parsoid=html2wt
23562 !! html/parsoid
23563 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23564 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23565 <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>
23566 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
23567 '<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>
23568 '<i>foo</i> <div title="name">test</div>
23569 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
23570 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
23571 <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>
23572 </ol>
23573 !! wikitext
23574 '''a'' foo ''[[bar]]''
23575 ''a''' foo ''[[bar]]''
23576 ''a''' foo '''{{echo|[[bar]]}}'''
23577 [[foo]] x'''[[bar]]''
23578 '''foo'' <ref>test</ref>
23579 '''foo'' <div title="name">test</div>
23580 '''foo'' and <br> bar
23581 <references />
23582 !! end
23583
23584 !! test
23585 2. Link fragments separated by <i> and <b> tags
23586 !! options
23587 parsoid=html2wt
23588 !! html/parsoid
23589 <p>[[<i>foo</i>hello]]</p>
23590 <p>[[<b>foo</b>hello]]</p>
23591 !! wikitext
23592 [[''foo''<nowiki>hello]]</nowiki>
23593
23594 [['''foo'''<nowiki>hello]]</nowiki>
23595 !! end
23596
23597 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
23598 # this is one of the shortcomings of this format
23599 !! test
23600 3. Link fragments inside <i> and <b>
23601 !! options
23602 parsoid=html2wt
23603 !! html/parsoid
23604 <p><i>[[foo</i>]]</p>
23605 <p><b>[[foo</b>]]</p>
23606 !! wikitext
23607 ''[[foo''<nowiki>]]</nowiki>
23608
23609 '''[[foo'''<nowiki>]]</nowiki>
23610 !! end
23611
23612 !! test
23613 4. No escaping needed
23614 !! options
23615 options=html2wt
23616 !! html/parsoid
23617 <p>'<span><i>bar</i></span>'
23618 '<span><b>bar</b></span>'
23619 'a:b'foo
23620 </p>
23621 !! wikitext
23622 '<span>''bar''</span>'
23623 '<span>'''bar'''</span>'
23624 'a:b'foo
23625 !! end
23626
23627 #### ----------- Paragraphs ---------------
23628 #### 1. No unnecessary escapes
23629 #### --------------------------------------
23630
23631 !! test
23632 1. No unnecessary escapes
23633 !! options
23634 parsoid=html2wt
23635 !! html/parsoid
23636 <p>bar <span>[[foo]]</span>
23637 </p><p>=bar <span>[[foo]]</span>
23638 </p><p>[[bar <span>[[foo]]</span>
23639 </p><p>]]bar <span>[[foo]]</span>
23640 </p><p>=bar <span>foo]]</span>=
23641 </p>
23642 !! wikitext
23643 bar <span><nowiki>[[foo]]</nowiki></span>
23644
23645 =bar <span><nowiki>[[foo]]</nowiki></span>
23646
23647 [[bar <span><nowiki>[[foo]]</nowiki></span>
23648
23649 ]]bar <span><nowiki>[[foo]]</nowiki></span>
23650
23651 =bar <span>foo]]</span><nowiki>=</nowiki>
23652 !!end
23653
23654 #### ----------------------- PRE --------------------------
23655 #### 1. Leading whitespace in SOL context should be escaped
23656 #### ------------------------------------------------------
23657 !! test
23658 1. Leading whitespace in SOL context should be escaped
23659 !! options
23660 parsoid=html2wt
23661 !! html/parsoid
23662 <p> a</p>
23663
23664 <p> a</p>
23665
23666 <p> a(tab)</p>
23667
23668 <p> a
23669 <!--cmt-->
23670 a</p>
23671
23672 <p>a
23673 b</p>
23674
23675 <p>a
23676 b</p>
23677
23678 <p>a
23679 b</p>
23680 !! wikitext
23681 <nowiki> </nowiki>a
23682
23683 <nowiki> </nowiki> a
23684
23685 a(tab)
23686
23687 <nowiki> </nowiki> a
23688 <!--cmt-->
23689 <nowiki> </nowiki>a
23690
23691 a
23692 <nowiki> </nowiki>b
23693
23694 a
23695 b
23696
23697 a
23698 b
23699 !! html/php
23700 <p> a
23701 </p><p> a
23702 </p><p> a(tab)
23703 </p><p> a
23704 a
23705 </p><p>a
23706 b
23707 </p><p>a
23708 b
23709 </p><p>a
23710 b
23711 </p>
23712 !! end
23713
23714 !! test
23715 2. Leading whitespace in non-indent-pre contexts should not be escaped
23716 !! options
23717 parsoid=htm2wt
23718 !! html/parsoid
23719 <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>
23720 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23721 <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>
23722 b</span></li>
23723 </ol>
23724 !! wikitext
23725 foo <ref>''a''
23726 b</ref>
23727 <references />
23728 !! end
23729
23730 !! test
23731 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
23732 !! options
23733 parsoid=html2wt
23734 !! html/parsoid
23735 <blockquote>
23736 <p>
23737 a
23738 <span>b</span>
23739 c</p>
23740 </blockquote>
23741 !! wikitext
23742 <blockquote>
23743 a
23744 <span>b</span>
23745 c
23746 </blockquote>
23747 !! end
23748
23749 !! test
23750 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
23751 !! options
23752 options=html2wt
23753 !! html/parsoid
23754 <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>
23755 !! wikitext
23756 [[File:Foobar.jpg|thumb|caption]]
23757 !! end
23758
23759 !! test
23760 5. Nowiki escaping should account for indent-pres
23761 !! options
23762 parsoid=html2wt
23763 !! html/parsoid
23764 <pre>==foo==</pre>
23765 !! wikitext
23766 ==foo==
23767 !! end
23768
23769 !!test
23770 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
23771 !! options
23772 parsoid=html2wt
23773 !! html/parsoid
23774 <pre>
23775 * foo
23776 * bar
23777 </pre>
23778 !! wikitext
23779 * foo
23780 * bar
23781 !! end
23782
23783 #### --------------- Behavior Switches --------------------
23784
23785 !! test
23786 1. Valid behavior switches should be escaped
23787 !! options
23788 parsoid=html2wt
23789 !! html/parsoid
23790 __TOC__
23791 <i>__TOC__</i>
23792 !! wikitext
23793 <nowiki>__TOC__</nowiki>
23794 ''<nowiki>__TOC__</nowiki>''
23795 !! end
23796
23797 !! test
23798 2. Invalid behavior switches should not be escaped
23799 !! options
23800 parsoid=html2wt
23801 !! html/parsoid
23802 __TOO__
23803 __|__
23804 !! wikitext
23805 __TOO__
23806 __|__
23807 !! end
23808
23809 # We use indent-pre as an indirect way to test for sol-transparent behavior.
23810 !! test
23811 Behavior switches should be SOL-transparent
23812 !! options
23813 parsoid=html2wt
23814 !! html/parsoid
23815 <meta property="mw:PageProp/toc" />
23816
23817 <!-- this one's bogus -->
23818 <pre>__TOO__</pre>
23819
23820 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
23821
23822 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
23823 !! wikitext
23824 __TOC__
23825
23826 <!-- this one's bogus -->
23827 __TOO__
23828
23829 __TOC__ foo
23830
23831 __TOC__
23832 bar
23833 !! end
23834
23835 #### --------------- HTML tags ---------------
23836 #### 1. a tags
23837 #### 2. other tags
23838 #### 3. multi-line html tag
23839 #### 4. extension tags
23840 #### -----------------------------------------
23841 !! test
23842 1. a tags
23843 !! options
23844 parsoid=html2wt
23845 !! html/parsoid
23846 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
23847 !! wikitext
23848 <a href="http://google.com">google</a>
23849 !! end
23850
23851 !! test
23852 2. other tags
23853 !! options
23854 parsoid=html2wt
23855 !! html/parsoid
23856 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
23857 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
23858 <li> &lt;td&gt;</li></ul>
23859
23860 !! wikitext
23861 * <nowiki><div>foo</div></nowiki>
23862 * <nowiki><div style="color:red">foo</div></nowiki>
23863 * <nowiki><td></nowiki>
23864 !! end
23865
23866 !! test
23867 3. multi-line html tag
23868 !! options
23869 parsoid=html2wt
23870 !! html/parsoid
23871 <p>&lt;div
23872 &gt;foo&lt;/div
23873 &gt;
23874 </p>
23875 !! wikitext
23876 <nowiki><div
23877 >foo</div
23878 ></nowiki>
23879 !! end
23880
23881 !! test
23882 4. extension tags
23883 !! options
23884 parsoid=html2wt
23885 !! html/parsoid
23886 <p>&lt;ref&gt;foo&lt;/ref&gt;
23887 </p><p>&lt;ref&gt;bar
23888 </p><p>baz&lt;/ref&gt;
23889 </p>
23890 !! wikitext
23891 <nowiki><ref>foo</ref></nowiki>
23892
23893 <nowiki><ref>bar</nowiki>
23894
23895 baz<nowiki></ref></nowiki>
23896 !! end
23897
23898 #### --------------- Others ---------------
23899 !! test
23900 Escaping nowikis
23901 !! options
23902 parsoid=html2wt
23903 !! html/parsoid
23904 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
23905 </p>
23906 !! wikitext
23907 &lt;nowiki&gt;foo&lt;/nowiki&gt;
23908 !! end
23909
23910 ## The quote-char in the input is necessary for triggering the bug
23911 !! test
23912 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
23913 !! options
23914 parsoid=html2wt
23915 !! html/parsoid
23916 <p>foo's bar :</p>
23917 !! wikitext
23918 foo's bar :
23919 !! end
23920
23921 #----------- End of wikitext escaping tests --------------
23922
23923 !! test
23924
23925 Tag-like HTML structures are passed through as text
23926 !! wikitext
23927 <x y>
23928
23929 <x.y>
23930
23931 <x-y>
23932
23933 1>2
23934
23935 x<y
23936
23937 a>b
23938
23939 1<d e>f
23940 !! html
23941 <p>&lt;x y&gt;
23942 </p><p>&lt;x.y&gt;
23943 </p><p>&lt;x-y&gt;
23944 </p><p>1&gt;2
23945 </p><p>x&lt;y
23946 </p><p>a&gt;b
23947 </p><p>1&lt;d e&gt;f
23948 </p>
23949 !! end
23950
23951 !! test
23952 HTML tag with necessary entities in attributes
23953 !! wikitext
23954 <span title="&amp;amp;">foo</span>
23955 !! html
23956 <p><span title="&amp;amp;">foo</span>
23957 </p>
23958 !! end
23959
23960 !! test
23961 HTML tag with 'unnecessary' entity encoding in attributes
23962 !! wikitext
23963 <span title="&amp;">foo</span>
23964 !! html
23965 <p><span title="&amp;">foo</span>
23966 </p>
23967 !! end
23968
23969 !! test
23970 HTML tag with broken attribute value quoting
23971 !! options
23972 parsoid=wt2html,html2html
23973 !! wikitext
23974 <span title="Hello world>Foo</span>
23975 !! html/php
23976 <p><span title="Hello world">Foo</span>
23977 </p>
23978 !! html/parsoid
23979 <p><span title="Hello world">Foo</span></p>
23980 !! end
23981
23982 !! test
23983 Self-closed tag with broken attribute value quoting
23984 !! options
23985 parsoid=wt2html,html2html
23986 !! wikitext
23987 <div title="Hello world />Foo
23988 !! html/php+tidy
23989 <div title="Hello world"></div>
23990 <p>Foo</p>
23991 !! html/parsoid
23992 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
23993 !! end
23994
23995 !! test
23996 Table with broken attribute value quoting
23997 !! options
23998 parsoid=wt2html,html2html
23999 !! wikitext
24000 {|
24001 | title="Hello world|Foo
24002 |}
24003 !! html/php
24004 <table>
24005 <tr>
24006 <td title="Hello world">Foo
24007 </td></tr></table>
24008
24009 !! html/parsoid
24010 <table>
24011 <tr>
24012 <td title="Hello world">Foo
24013 </td></tr></table>
24014
24015 !! end
24016
24017 !! test
24018 Table with broken attribute value quoting on consecutive lines
24019 !! options
24020 parsoid=wt2html,html2html
24021 !! wikitext
24022 {|
24023 | title="Hello world|Foo
24024 | style="color:red|Bar
24025 |}
24026 !! html/php
24027 <table>
24028 <tr>
24029 <td title="Hello world">Foo
24030 </td>
24031 <td style="color:red">Bar
24032 </td></tr></table>
24033
24034 !! html/parsoid
24035 <table><tbody>
24036 <tr>
24037 <td title="Hello world">Foo
24038 </td><td style="color: red">Bar
24039 </td></tr></tbody></table>
24040
24041 !! end
24042
24043 !! test
24044 2. Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
24045 !! options
24046 parsoid
24047 !! wikitext
24048 {{}}
24049 !! html
24050 {{}}
24051 !! end
24052
24053 !! test
24054 1. Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
24055 !! options
24056 parsoid
24057 !! wikitext
24058 }}{{
24059 !! html
24060 }}{{
24061 !! end
24062
24063 !!test
24064 Accept empty td cell attribute
24065 !! wikitext
24066 {|
24067 | align="center" | foo || |
24068 |}
24069 !! html
24070 <table>
24071 <tr>
24072 <td align="center"> foo </td>
24073 <td>
24074 </td></tr></table>
24075
24076 !!end
24077
24078 !!test
24079 Non-empty attributes in th-cells
24080 !! wikitext
24081 {|
24082 ! Foo !! style="color: red" | Bar
24083 |}
24084 !! html
24085 <table>
24086 <tr>
24087 <th> Foo </th>
24088 <th style="color: red"> Bar
24089 </th></tr></table>
24090
24091 !!end
24092
24093 !!test
24094 Accept empty attributes in th-cells
24095 !! wikitext
24096 {|
24097 !| foo !!| bar
24098 |}
24099 !! html
24100 <table>
24101 <tr>
24102 <th> foo </th>
24103 <th> bar
24104 </th></tr></table>
24105
24106 !!end
24107
24108 !!test
24109 Empty table rows go away
24110 !! wikitext
24111 {|
24112 | Hello
24113 | there
24114 |- class="foo"
24115 |-
24116 |}
24117 !! html
24118 <table>
24119 <tr>
24120 <td> Hello
24121 </td>
24122 <td> there
24123 </td></tr>
24124
24125 </table>
24126
24127 !! end
24128
24129 ###
24130 ### Parsoid-centric tests for testing RTing of inter-element separators
24131 ### Edge cases not tested by existing parser tests and specific to
24132 ### Parsoid-specific serialization strategies.
24133 ###
24134
24135 !!test
24136 RT-ed inter-element separators should be valid separators
24137 !! wikitext
24138 {|
24139 |- [[foo]]
24140 |}
24141 !! html/php
24142 <table>
24143
24144 </table>
24145
24146 !! html/parsoid
24147 <table>
24148 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
24149 </tbody></table>
24150 !!end
24151
24152 # Parsoid-only since PHP parser relies on Tidy for correct output
24153 !!test
24154 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
24155 !!options
24156 parsoid
24157 !! wikitext
24158 {|
24159 |<small>foo
24160 bar
24161 |}
24162
24163 {|
24164 |<small>foo<small>
24165 |}
24166 !! html
24167 <table>
24168 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
24169 <p>bar</p></small></td></tr>
24170 </tbody></table>
24171
24172 <table>
24173 <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>
24174 </tbody></table>
24175 !!end
24176
24177 # Note that the "style" attribute is really a template parameter here.
24178 # The = would have to be {{=}} if you wanted the literal.
24179 !!test
24180 Empty TD followed by TD with tpl-generated attribute
24181 !! wikitext
24182 {|
24183 |-
24184 |
24185 |{{echo|style='color:red'}}|foo
24186 |}
24187 !! html
24188 <table>
24189
24190 <tr>
24191 <td>
24192 </td>
24193 <td>foo
24194 </td></tr></table>
24195
24196 !!end
24197
24198 !!test
24199 Indented table with an empty td
24200 !! wikitext
24201 {|
24202 |-
24203 |
24204 |foo
24205 |}
24206 !! html
24207 <table>
24208
24209 <tr>
24210 <td>
24211 </td>
24212 <td>foo
24213 </td></tr></table>
24214
24215 !!end
24216
24217 ## We have some newline diffs RT-ing this edge case
24218 ## and it is not important enough -- we seem to be emitting
24219 ## at most 2 newlines after a </tr> and this is unrelated to
24220 ## the issue from T85627 that this is testing.
24221 !!test
24222 Indented table with blank lines in between (T85627)
24223 !! options
24224 parsoid=wt2html
24225 !! wikitext
24226 {|
24227 |foo
24228
24229
24230 |}
24231 !! html
24232 <table>
24233
24234 <tr>
24235 <td>foo
24236 </td></tr></table>
24237
24238 !!end
24239
24240 !!test
24241 Indented block & table
24242 !! wikitext
24243 <div>foo</div>
24244 {|
24245 |foo
24246 |}
24247 !! html/php
24248 <div>foo</div>
24249 <table>
24250 <tr>
24251 <td>foo
24252 </td></tr></table>
24253
24254 !! html/parsoid
24255 <div data-parsoid='{"stx":"html"}'>foo</div>
24256 <table><tbody>
24257 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
24258 </tbody></table>
24259 !!end
24260
24261 !! test
24262 Indent and comment before table row
24263 !! wikitext
24264 {|
24265 <!--hi-->|-
24266 | there
24267 |}
24268 !! html/php
24269 <table>
24270
24271 <tr>
24272 <td> there
24273 </td></tr></table>
24274
24275 !! html/parsoid
24276 <table>
24277 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
24278 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
24279 </tbody></table>
24280 !! end
24281
24282 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
24283 !!test
24284 Empty TR followed by a template-generated TR
24285 !!options
24286 parsoid
24287 !! wikitext
24288 {|
24289 |-
24290 {{echo|<tr><td>foo</td></tr>}}
24291 |}
24292 !! html
24293 <table>
24294 <tbody>
24295 <tr></tr>
24296 <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}}]}'>
24297 <td>foo</td></tr>
24298 </tbody></table>
24299 !!end
24300
24301 ## PHP and parsoid output differ for this, and since this is primarily
24302 ## for testing Parsoid's serializer, marking this Parsoid only
24303 !!test
24304 Empty TR followed by mixed-ws-comment line should RT correctly
24305 !!options
24306 parsoid
24307 !! wikitext
24308 {|
24309 |-
24310 <!--c-->
24311 |-
24312 <!--c--> <!--d-->
24313 |}
24314 !! html
24315 <table>
24316 <tbody>
24317 <tr></tr>
24318 <!--c-->
24319 <tr>
24320 <!--c--> </tr><!--d-->
24321 </tbody></table>
24322
24323 !!end
24324
24325 !!test
24326 Multi-line image caption generated by templates with/without trailing newlines
24327 !! wikitext
24328 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
24329 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
24330 !! html/parsoid
24331 <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>
24332 <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>
24333 !!end
24334
24335 !! test
24336 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
24337 !! options
24338 parsoid=html2wt
24339 !! html/parsoid
24340 <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>
24341
24342 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
24343 !! wikitext
24344 <includeonly>foo</includeonly>
24345 new para
24346
24347 [[Category:Foo]]
24348
24349 = new heading =
24350 !! end
24351
24352 ## PHP emits broken html for this, and since this is primarily
24353 ## a Parsoid serializer test, marking this Parsoid only
24354 !!test
24355 Improperly nested inline or quotes tags with whitespace in between
24356 !! wikitext
24357 <span> <s>x</span> </s>
24358 ''' ''x''' ''
24359 !! html/parsoid
24360 <p><span> <s>x</s></span><s> </s>
24361 <b> <i>x</i></b><i> </i>
24362 </p>
24363 !!end
24364
24365 !!test
24366 Encapsulate protected attributes from wt
24367 !! wikitext
24368 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
24369 !! html/parsoid
24370 <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>
24371 </body>
24372 !!end
24373
24374 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
24375 ## Having nested or stray pre tags results in the attempt to add duplicates,
24376 ## causing an assertion fail. This test tries to prevent that situation.
24377 !!test
24378 Ensure ParagraphWrapper can deal with stray closing pre tags
24379 !!options
24380 parsoid=wt2html
24381 !! wikitext
24382 plain text</pre>
24383 !! html/parsoid
24384 plain text
24385 !!end
24386
24387 !!test
24388 1. Ensure fostered text content is wrapped in element nodes
24389 !!options
24390 parsoid=wt2html
24391 !! wikitext
24392 <table>hi</table><table>ho</table>
24393 !! html/parsoid
24394 <p>hi</p>
24395 <table></table>
24396 <p>ho</p>
24397 <table></table>
24398 !!end
24399
24400 !!test
24401 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
24402 !!options
24403 parsoid=wt2html,wt2wt
24404 !! wikitext
24405 <table>
24406 <tr> || ||
24407 <td> a
24408 </table>
24409 !! html/parsoid
24410 <p> || ||
24411 </p><table>
24412 <tbody><tr><td> a</td></tr>
24413 </tbody></table>
24414 !!end
24415
24416 !!test
24417 Encapsulation properly handles null DSR information from foster box
24418 !!options
24419 parsoid=wt2html,wt2wt
24420 !! wikitext
24421 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
24422 !! html/parsoid
24423 <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>
24424 !!end
24425
24426 !!test
24427 1. Encapsulate foster-parented transclusion content
24428 !!options
24429 parsoid=wt2wt,wt2html
24430 !! wikitext
24431 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
24432 !! html/parsoid
24433 <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>
24434 <tbody>
24435 <tr>
24436 <td>bar</td>
24437 </tr>
24438 </tbody>
24439 </table>
24440 !!end
24441
24442 !!test
24443 2. Encapsulate foster-parented transclusion content
24444 !!options
24445 parsoid=wt2wt,wt2html
24446 !! wikitext
24447 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
24448 !! html/parsoid
24449 <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>
24450 <table>
24451 <tbody>
24452 <tr>
24453 <td>bar</td>
24454 </tr>
24455 </tbody>
24456 </table>
24457 !!end
24458
24459 !!test
24460 3. Encapsulate foster-parented transclusion content
24461 !!options
24462 parsoid=wt2wt,wt2html
24463 !! wikitext
24464 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24465 !! html/parsoid
24466 <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;]}">
24467 <p>foo</p>
24468 </div>
24469 <table>
24470 <tbody>
24471 <tr>
24472 <td>bar</td>
24473 </tr>
24474 </tbody>
24475 </table>
24476 !!end
24477
24478 !!test
24479 4. Encapsulate foster-parented transclusion content
24480 !!options
24481 parsoid=wt2wt,wt2html
24482 !! wikitext
24483 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24484 !! html/parsoid
24485 <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;]}">
24486 <p>foo</p>
24487 </div>
24488 <table>
24489 <tbody>
24490 <tr>
24491 <td>bar</td>
24492 </tr>
24493 </tbody>
24494 </table>
24495 !!end
24496
24497 !!test
24498 5. Encapsulate foster-parented transclusion content
24499 !!options
24500 parsoid=wt2wt,wt2html
24501 !! wikitext
24502 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
24503 !! html/parsoid
24504 <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>
24505 <table>
24506 <tbody>
24507 <tr>
24508 <td>
24509 <div>
24510 <p>foo</p>
24511 </div>
24512 </td>
24513 </tr>
24514 </tbody>
24515 </table>
24516 !!end
24517
24518 !!test
24519 6. Encapsulate foster-parented transclusion content
24520 !!options
24521 parsoid=wt2wt,wt2html
24522 !! wikitext
24523 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
24524 !! html/parsoid
24525 <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>
24526 <table>
24527 <tbody>
24528 <tr>
24529 <td>
24530 <div>
24531 <p>foo</p>
24532 </div>
24533 </td>
24534 </tr>
24535 </tbody>
24536 </table>
24537 <p>ok</p>
24538 !!end
24539
24540 !!test
24541 7. Encapsulate foster-parented transclusion content
24542 !!options
24543 parsoid=wt2wt,wt2html
24544 !! wikitext
24545 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
24546 !! html/parsoid
24547 <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>
24548 <table>
24549 <tbody>
24550 <tr>
24551 <td>bar</td>
24552 </tr>
24553 </tbody>
24554 </table>
24555 !!end
24556
24557 # Note that the wt is broken on purpose: the = should be {{=}} if you
24558 # don't want it to be a template parameter key.
24559 !!test
24560 8. Encapsulate foster-parented transclusion content
24561 !!options
24562 parsoid=wt2wt,wt2html
24563 !! wikitext
24564 {{echo|a
24565 }}{|{{echo|style='color:red'}}
24566 |-
24567 |b
24568 |}
24569 !! html/parsoid
24570 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
24571 <span> </span>
24572 <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>
24573 <table>
24574 <tbody>
24575 <tr>
24576 <td>b</td>
24577 </tr>
24578 </tbody>
24579 </table>
24580 !!end
24581
24582 !!test
24583 9. Encapsulate foster-parented transclusion content
24584 !!options
24585 parsoid=wt2wt,wt2html
24586 !! wikitext
24587 <table>{{echo|hi</table>hello}}
24588 !! html/parsoid
24589 <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>
24590 !!end
24591
24592 !!test
24593 Table in fosterable position
24594 !!options
24595 parsoid=wt2html
24596 !! wikitext
24597 {{OpenTable}}
24598 <div>
24599 {|
24600 |}
24601 </div>
24602 |}
24603 !! html/parsoid
24604 <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">
24605 </span>
24606 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
24607
24608 <table>
24609 </table>
24610 !!end
24611
24612 # Parsoid only for bug 64747
24613 !! test
24614 Properly encapsulate empty-content transclusions in fosterable positions
24615 !! wikitext
24616 <table>
24617 {{#if:|
24618 <td>foo</td>
24619 }}
24620 </table>
24621 !! html/parsoid
24622 <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"}]]}'>
24623
24624 </table>
24625 !! end
24626
24627 !! test
24628 Always encapsulate foster box when template range is expanded to table
24629 !! options
24630 parsoid=wt2wt
24631 !! wikitext
24632 {|
24633 hello
24634 {{OpenTable}}
24635 |}
24636 !! html/parsoid
24637
24638 !! end
24639
24640 !! test
24641 T115289: Unclosed table
24642 !! wikitext
24643 {{echo|<table>}}<!--c-->[[Category:Two]]
24644 !! html/parsoid
24645 <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>
24646 !! end
24647
24648 !! test
24649 T115289: Don't migrate newlines out of tables with fostered content
24650 !! wikitext
24651 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
24652 !! html/parsoid
24653 <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>
24654 !! end
24655
24656 !! test
24657 T73074: More fostering fun
24658 !! wikitext
24659 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
24660 !! html/parsoid
24661 <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>
24662 !! end
24663
24664 !!test
24665 Support <object> element with .data attribute
24666 !!options
24667 parsoid=html2wt
24668 !! html/parsoid
24669 <object data="test.swf"></object>
24670 !! wikitext
24671 <object data="test.swf"></object>
24672 !!end
24673
24674 !! test
24675 Don't block XML namespace declaration
24676 !! wikitext
24677 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24678 !! html/php
24679 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24680 </p>
24681 !! html/parsoid
24682 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
24683 !! end
24684
24685 # -----------------------------------------------------------------
24686 # The following section of tests are primarily to spec requirements
24687 # around serialization of new/edited content.
24688 #
24689 # All these tests are marked Parsoid html2wt and html2html only
24690 # ----------------------------------------------------------------
24691
24692 # 'mi' is a localinterwiki prefix as well as a language
24693 !! test
24694 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
24695 !! options
24696 parsoid=html2wt
24697 !! html/parsoid
24698 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
24699 !! wikitext
24700 [[Foo]]
24701 !! end
24702
24703 # See T93839
24704 !! test
24705 New wikilinks should be serialized properly
24706 !! options
24707 parsoid=html2wt
24708 !! html/parsoid
24709 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
24710 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
24711 !! wikitext
24712 [[Foo]]
24713 [[Foo]]
24714 !! end
24715
24716 !! test
24717 New wiki links (href variations)
24718 !! options
24719 parsoid=html2wt
24720 !! html/parsoid
24721 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24722 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
24723 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
24724 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
24725 !! wikitext
24726 [[Foo_bar]]
24727 [[Foo_bar]]
24728 [[Foo_bar]]
24729 [[Toxine bactérienne]]
24730 !! end
24731
24732 !! test
24733 New wiki links (content string variations)
24734 !! options
24735 parsoid=html2wt
24736 !! html/parsoid
24737 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24738 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
24739 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
24740 !! wikitext
24741 [[Foo_bar]]
24742 [[Foo bar]]
24743 [[Foo_bar|./Foo_bar]]
24744 !! end
24745
24746 !! test
24747 New category links (href variations)
24748 !! options
24749 parsoid=html2wt
24750 !! html/parsoid
24751 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
24752 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
24753 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
24754 !! wikitext
24755 [[Category:Toxine bactérienne]]
24756 [[Category:Toxine bactérienne]]
24757 [[Category:Toxine bactérienne]]
24758 !! end
24759
24760 !! test
24761 New sol transparent links don't need indent-pre nowiki protection
24762 !! options
24763 parsoid=html2wt
24764 language=de
24765 !! html/parsoid
24766 <link rel="mw:PageProp/redirect" href="./Main_Page">
24767 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
24768 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
24769 !! wikitext
24770 #WEITERLEITUNG [[Main Page]]
24771 <!-- this is good --> [[Category:Good]]
24772 <!-- this is great --> [[Kategorie:Great]]
24773 !! end
24774
24775 !! test
24776 New interlanguage links (href variations)
24777 !! options
24778 parsoid=html2wt
24779 !! html/parsoid
24780 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
24781 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
24782 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
24783 !! wikitext
24784 [[es:Toxine bactérienne]]
24785 [[es:Toxine_bactérienne]]
24786 [[es:Toxine_bactérienne]]
24787 !! end
24788
24789 !! test
24790 Image: Modifying size of an image (1)
24791 !! options
24792 parsoid={
24793 "modes": ["wt2wt"],
24794 "changes": [
24795 ["img[height]", "attr", "height", "22"],
24796 ["img[width]", "attr", "width", "200"]
24797 ]
24798 }
24799 !! wikitext
24800 [[Image:Foobar.jpg|230x230px]]
24801 !! wikitext/edited
24802 [[Image:Foobar.jpg|200x200px]]
24803 !!end
24804
24805 !! test
24806 Image: Modifying size of an image (2)
24807 !! options
24808 parsoid={
24809 "modes": ["wt2wt"],
24810 "changes": [
24811 ["img[height]", "attr", "height", "100"],
24812 ["img[width]", "attr", "width", "500"]
24813 ]
24814 }
24815 !! wikitext
24816 [[Image:Foobar.jpg|230x230px]]
24817 !! wikitext/edited
24818 [[Image:Foobar.jpg|500x500px]]
24819 !!end
24820
24821 # Change in size is ignored so long as class='mw-default-size'
24822 !! test
24823 Image: Modifying size of an image (3)
24824 !! options
24825 parsoid={
24826 "modes": ["wt2wt"],
24827 "changes": [
24828 ["figure[class]", "removeClass", "mw-default-size"],
24829 ["figure img", "attr", "height", "19"],
24830 ["figure img", "attr", "width", "170"]
24831 ]
24832 }
24833 !! wikitext
24834 [[Image:Foobar.jpg|thumb]]
24835 !! wikitext/edited
24836 [[Image:Foobar.jpg|thumb|170x170px]]
24837 !!end
24838
24839 !! test
24840 Image: Modifying alignment of an image (bug 48665)
24841 !! options
24842 parsoid={
24843 "modes": ["wt2wt"],
24844 "changes": [
24845 ["figure[class]", "removeClass", "mw-halign-right"],
24846 ["figure[class]", "addClass", "mw-halign-left"]
24847 ]
24848 }
24849 !! wikitext
24850 [[Image:Foobar.jpg|thumb|caption|right]]
24851 !! wikitext/edited
24852 [[Image:Foobar.jpg|thumb|caption|left]]
24853 !! end
24854
24855 !! test
24856 Image: Modifying mw-default-size of an frameless image (bug 62805)
24857 !! options
24858 parsoid={
24859 "modes": ["wt2wt"],
24860 "changes": [
24861 ["figure.mw-default-size", "removeClass", "mw-default-size"]
24862 ]
24863 }
24864 !! wikitext
24865 [[Image:Foobar.jpg|frameless|right]]
24866 !! wikitext/edited
24867 [[Image:Foobar.jpg|frameless|right|220x220px]]
24868 !! end
24869
24870 !! test
24871 Image: Modifying valign of an image (bug 49221)
24872 !! options
24873 parsoid={
24874 "modes": ["wt2wt"],
24875 "changes": [
24876 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
24877 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
24878 ]
24879 }
24880 !! wikitext
24881 [[File:Foobar.jpg|20px|middle]]
24882 !! wikitext/edited
24883 [[File:Foobar.jpg|20px|text-top]]
24884 !! end
24885
24886 !! test
24887 Image: Modifying alt attribute of an image (bug 56400)
24888 !! options
24889 parsoid={
24890 "modes": ["wt2wt"],
24891 "changes": [
24892 ["img[alt]", "attr", "alt", "some alternate edited text"]
24893 ]
24894 }
24895 !! wikitext
24896 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
24897 !! wikitext/edited
24898 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
24899 !!end
24900
24901 !! test
24902 Image: Modifying caption of an image
24903 !! options
24904 parsoid={
24905 "modes": ["wt2wt"],
24906 "changes": [
24907 ["figcaption", "text", "new caption"]
24908 ]
24909 }
24910 !! wikitext
24911 [[Image:Foobar.jpg|thumb|original caption]]
24912 !! wikitext/edited
24913 [[Image:Foobar.jpg|thumb|new caption]]
24914 !!end
24915
24916 !! test
24917 Image: empty alt attribute (bug 48924)
24918 !! options
24919 parsoid
24920 !! wikitext
24921 [[File:Foobar.jpg|thumb|alt=|bar]]
24922 !! html
24923 <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>
24924 !! end
24925
24926 !! test
24927 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
24928 !! options
24929 parsoid=html2wt
24930 language=ar
24931 disabled
24932 !! html/parsoid
24933 <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>
24934 !! wikitext
24935 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
24936 !! end
24937
24938 !! test
24939 Image: Block level image should have \n before and after
24940 !! wikitext
24941 123
24942 [[File:Foobar.jpg|right|thumb|150x150px]]
24943 456
24944 !! html/parsoid
24945 <p>123</p>
24946 <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>
24947 <p>456</p>
24948 !!end
24949
24950 !! test
24951 Image: New block level image should have \n before and after (existing content)
24952 !! wikitext
24953 123
24954 [[File:Foobar.jpg|right|thumb|150x150px]]
24955 456
24956 !! html/parsoid
24957 <p>123</p>
24958 <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>
24959 <p>456</p>
24960 !!end
24961
24962 !! test
24963 Image: upright option (parsoid)
24964 !! wikitext
24965 [[File:Foobar.jpg|thumb|upright|caption]]
24966 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
24967 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
24968 !! html/parsoid
24969 <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>
24970 <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>
24971 <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>
24972 !!end
24973
24974 !! test
24975 Image: upright option is ignored on inline and frame images (parsoid)
24976 !! wikitext
24977 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
24978 !! html/parsoid
24979 <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>
24980 !!end
24981
24982 !! test
24983 Image: from basic HTML (1)
24984 !! options
24985 parsoid=html2wt
24986 !! html/parsoid
24987 <span typeof="mw:Image">
24988 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24989 </span>
24990 !! wikitext
24991 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24992 !! end
24993
24994 !! test
24995 Image: from basic HTML (2)
24996 !! options
24997 parsoid=html2wt
24998 !! html/parsoid
24999 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25000 !! wikitext
25001 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25002 !! end
25003
25004 !! test
25005 Image: from basic HTML (3)
25006 !! options
25007 parsoid=html2wt
25008 !! html/parsoid
25009 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
25010 !! wikitext
25011 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
25012 !! end
25013
25014 !! test
25015 Image: from basic HTML (4)
25016 !! options
25017 parsoid=html2wt
25018 !! html/parsoid
25019 <img src="./File:Foobar.jpg">
25020 !! wikitext
25021 [[File:Foobar.jpg|link=]]
25022 !! end
25023
25024 !! test
25025 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
25026 !! options
25027 parsoid=html2wt
25028 !! html/parsoid
25029 <ul>
25030 <li><p>foo</p></li>
25031 </ul>
25032 !! wikitext
25033 * foo
25034 !! end
25035
25036 !! test
25037 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
25038 !! options
25039 parsoid=html2wt
25040 !! html/parsoid
25041 <ul> <li>foo</li></ul>
25042 !! wikitext
25043 * foo
25044 !! end
25045
25046 !! test
25047 Don't strip leading whitespace when handling indent-pre suppressing tags
25048 !! options
25049 parsoid=html2wt
25050 !! html/parsoid
25051 <table>
25052 <tr><td> indented row</td></tr>
25053 </table>
25054 <blockquote><p>
25055 <b>This is very bold of you!</b>
25056 </p>
25057 <table><tr><td>
25058 indented cell (no pre-wrapping!)
25059 </td></tr></table>
25060 </blockquote>
25061 <p>foo</p>
25062 <div>bar</div>
25063 !! wikitext
25064 {|
25065 | indented row
25066 |}
25067 <blockquote>
25068 '''This is very bold of you!'''
25069
25070 {|
25071 |
25072 indented cell (no pre-wrapping!)
25073 |}
25074 </blockquote>
25075 foo
25076 <div>bar</div>
25077 !! end
25078
25079 !! test
25080 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
25081 !! options
25082 parsoid=html2wt
25083 !! html/parsoid
25084 <p>foo</p>
25085 <span>bar</span>
25086
25087 <span>foo2
25088 </span>bar2
25089
25090 <div>foo</div>
25091 <span>bar</span>
25092
25093 <div>
25094 <span>foo</span>
25095 </div>
25096 !! wikitext
25097 foo
25098
25099 <span>bar</span>
25100
25101 <span>foo2
25102 <nowiki> </nowiki></span>bar2
25103
25104 <div>foo</div>
25105 <nowiki> </nowiki><span>bar</span>
25106
25107 <div>
25108 <nowiki> </nowiki><span>foo</span>
25109 </div>
25110 !! end
25111
25112 !! test
25113 Lists: Dont insert newlines in a serialized list item.
25114 !! options
25115 parsoid=html2wt
25116 !! html/parsoid
25117 <ul><li>a<br>b</li><li>c</li></ul>
25118 !! wikitext
25119 * a<br>b
25120 * c
25121 !! end
25122
25123 !! test
25124 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
25125 !! options
25126 parsoid={
25127 "modes": ["html2wt"],
25128 "scrubWikitext": false
25129 }
25130 !! html/parsoid
25131 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25132 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25133
25134 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25135 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25136
25137 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
25138
25139 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25140 !! wikitext
25141 == hello there [[Category:A1]] ==
25142
25143 == [[Category:A2]] hi pal ==
25144
25145 == <!--foo--> [[Category:A3]] how goes it ==
25146
25147 == it goes well [[Category:A4]] <!--bar--> ==
25148
25149 ==howdy [[Category:A5]]==
25150
25151 == __TOC__ ok ==
25152 !! end
25153
25154 !! test
25155 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
25156 !! options
25157 parsoid={
25158 "modes": ["html2wt"],
25159 "scrubWikitext": true
25160 }
25161 !! html/parsoid
25162 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25163 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25164
25165 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25166 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25167
25168 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25169 !! wikitext
25170 == hello there ==
25171 [[Category:A1]]
25172 [[Category:A2]]
25173
25174 == hi pal ==
25175
25176 <!--foo--> [[Category:A3]]
25177
25178 == how goes it ==
25179
25180 == it goes well ==
25181 [[Category:A4]] <!--bar-->
25182
25183 __TOC__
25184
25185 == ok ==
25186 !! end
25187
25188 !! test
25189 Headings: Don't hoist metas that come from templates
25190 !! options
25191 parsoid={
25192 "modes": ["html2wt"],
25193 "scrubWikitext": true
25194 }
25195 !! html/parsoid
25196 <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>
25197 !! wikitext
25198 == {{echo|foo [[Category:Foo]]}} ==
25199 !! end
25200
25201 !! test
25202 Headings: Category in ref isn't hoisted
25203 !! options
25204 parsoid={
25205 "modes": ["html2wt"],
25206 "scrubWikitext": true
25207 }
25208 !! html/parsoid
25209 <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>
25210
25211 <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>
25212 !! wikitext
25213 == foo <ref>bar
25214 [[Category:Baz]] </ref> ==
25215
25216 <references />
25217 !! end
25218
25219 !! test
25220 Parsoid: Serialize positional parameters with = in them as named parameter
25221 !! options
25222 parsoid=html2wt
25223 !! html/parsoid
25224 <p about="#mwt1" typeof="mw:Transclusion"
25225 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
25226
25227 <p about="#mwt1" typeof="mw:Transclusion"
25228 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
25229
25230 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25231 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25232 <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>
25233 !! wikitext
25234 {{echo|1=f=oo}}
25235
25236 {{echo|1=f=oo|2=bar}}
25237
25238 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25239 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25240 {{echo|<nowiki>f=oo</nowiki>|bar}}
25241 !! end
25242
25243 !! test
25244 Parsoid: Serialize positional parameters with = in extlink as named parameter
25245 !! options
25246 parsoid=html2wt
25247 !! html/parsoid
25248 <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>
25249 !! wikitext
25250 {{echo|1=http://stuff?is=ok}}
25251 !! end
25252
25253 !! test
25254 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
25255 !! options
25256 parsoid=html2wt
25257 !! html/parsoid
25258 <div>a<p>b</p></div>
25259 <div>a
25260 <p>b</p></div>
25261 <div>
25262 a
25263 <p>b</p></div>
25264 !! wikitext
25265 <div>a
25266 b
25267 </div>
25268 <div>a
25269 b
25270 </div>
25271 <div>
25272 a
25273
25274 b
25275 </div>
25276 !! end
25277
25278 !! test
25279 Substrings resembling wikitext in hrefs should not get nowiki escapes
25280 !! options
25281 parsoid=html2wt
25282 !! html/parsoid
25283 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
25284 !! wikitext
25285 [[Foo''bar''baz]]
25286 !! end
25287
25288 !! test
25289 Enforce single-line context in the serializer
25290 !! options
25291 parsoid=html2wt
25292 !! html/parsoid
25293 <h2>testing
25294 123</h2>
25295
25296 <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">
25297 </span><span about="#mwt1">you</span> </h2>
25298
25299 <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>
25300
25301 <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
25302 there</span></li></ol>
25303
25304 <ul><li>asd
25305 sdf</li></ul>
25306
25307 <ul><li>foo
25308 bar
25309 baz</li>
25310 <li>foo <b>bar</b>
25311 baz</li></ul>
25312
25313 <dl><dt>hi
25314 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
25315 ho</dd></dl>
25316
25317 <dl><dd> <table>
25318 <tbody><tr><td> ha
25319 ha
25320 ha</td></tr>
25321 </tbody></table></dd></dl>
25322 !! wikitext
25323 == testing 123 ==
25324
25325 == hi {{bogus|there
25326 you}} ==
25327
25328 == foo <ref>hello
25329 there</ref> ==
25330
25331 <references />
25332
25333 * asd sdf
25334
25335 * foo bar baz
25336 * foo '''bar''' baz
25337
25338 ; hi ho : hi ho
25339
25340 : {|
25341 | ha
25342 ha
25343 ha
25344 |}
25345 !! end
25346
25347 !! test
25348 Serialize new placeholder space without spans
25349 !! options
25350 parsoid=html2wt
25351 !! html/parsoid
25352 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
25353
25354 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
25355
25356 <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>
25357 !! wikitext
25358 foo : bar
25359
25360 foo : bar
25361
25362 <ref>foo : bar</ref>ok
25363 !! end
25364
25365
25366 #-----------------------
25367 # Tag minimization tests
25368 #-----------------------
25369
25370 !! test
25371 1. I/B quote minimization: wikitext-only tags should be combined
25372 !! options
25373 parsoid=html2wt
25374 !! html/parsoid
25375 <p><i>A</i><i>B</i></p>
25376 <p><b>A</b><b>B</b></p>
25377 <p><i>A</i><b><i>B</i></b></p>
25378 <p><b>A</b><i><b>B</b></i></p>
25379 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
25380 <p><i><b>A</b></i><i><b>B</b></i></p>
25381 <p><i><b>A</b></i><b><i>B</i></b></p>
25382 <p><b><i>A</i></b><i><b>B</b></i></p>
25383 !! wikitext
25384 ''AB''
25385
25386 '''AB'''
25387
25388 ''A'''B'''''
25389
25390 '''A''B'''''
25391
25392 '''A''BC''D'''
25393
25394 '''''AB'''''
25395
25396 '''''AB'''''
25397
25398 '''''AB'''''
25399 !! end
25400
25401 !! test
25402 2. I/B quote minimization: wikitext and html tags should not be combined
25403 !! options
25404 parsoid=html2wt
25405 !! html/parsoid
25406 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
25407 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
25408 !! wikitext
25409 ''A''<i>B</i>
25410
25411 ''A''<nowiki/>'''<i>B</i>'''
25412 !! end
25413
25414 !! test
25415 3. I/B quote minimization: templated content stops minimization
25416 !! options
25417 parsoid=html2wt
25418 !! html/parsoid
25419 <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>
25420 <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>
25421 !! wikitext
25422 ''A''{{echo|''B''}}
25423
25424 ''A''{{echo|'''''B'''''}}
25425 !! end
25426
25427 !! test
25428 4. I/B quote minimization: new content should be mimimized with adjacent old content
25429 !! options
25430 parsoid=html2wt
25431 !! html/parsoid
25432 <p><i>A</i><i>B</i></p>
25433 <p><b>A</b><b>B</b></p>
25434 <p><i>A</i><b><i>B</i></b></p>
25435 !! wikitext
25436 ''AB''
25437
25438 '''AB'''
25439
25440 ''A'''B'''''
25441 !! end
25442
25443 !! test
25444 5a. Merge adjacent quote nodes if they've been edited
25445 !! options
25446 parsoid={
25447 "modes": ["wt2wt", "selser"],
25448 "changes": [
25449 ["p", "contents", "remove", ":contains('b')"]
25450 ]
25451 }
25452 !! wikitext
25453 ''a''b''c''
25454 !! wikitext/edited
25455 ''ac''
25456 !! end
25457
25458 !! test
25459 5b. Merge adjacent quote nodes if they've been edited
25460 !! options
25461 parsoid={
25462 "modes": ["wt2wt", "selser"],
25463 "changes": [
25464 ["#x", "remove"]
25465 ]
25466 }
25467 !! wikitext
25468 ''a''<span id="x">b</span>''c''
25469 !! wikitext/edited
25470 ''ac''
25471 !! end
25472
25473 !! test
25474 1. Merge adjacent link nodes as long as at least one element is new
25475 !! options
25476 parsoid={
25477 "modes": ["html2wt"],
25478 "scrubWikitext": true
25479 }
25480 !! html/parsoid
25481 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25482 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25483 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
25484 !! wikitext
25485 [[Football]]
25486 [[Football]]
25487 [[Football|Foot]][[Football|ball]]
25488 !! end
25489
25490 !! test
25491 2. Merge adjacent link nodes and enable additional normalizations
25492 !! options
25493 parsoid={
25494 "modes": ["html2wt"],
25495 "scrubWikitext": true
25496 }
25497 !! html/parsoid
25498 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
25499 !! wikitext
25500 [[Football|''Football'']]
25501 !! end
25502
25503 !! test
25504 3. Don't merge adjacent link nodes if scrubWikitext is false
25505 !! options
25506 parsoid={
25507 "modes": ["html2wt"],
25508 "scrubWikitext": false
25509 }
25510 !! html/parsoid
25511 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25512 !! wikitext
25513 [[Football|Foot]][[Football|ball]]
25514 !! end
25515
25516 #------------------------------
25517 # End of tag minimization tests
25518 #------------------------------
25519
25520 !!test
25521 Bug 54262: New entities
25522 !! options
25523 parsoid=html2wt
25524 !! html/parsoid
25525 <span typeof="mw:Entity">&nbsp;</span>
25526 !! wikitext
25527 &nbsp;
25528 !! end
25529
25530 ## Note that there is no wikitext output for 'unknownproperty' ##
25531 ## Unknown magic words are silently dropped ##
25532
25533 !! test
25534 Magic words
25535 !! options
25536 parsoid=html2wt
25537 !! html/parsoid
25538 <meta property='mw:PageProp/toc' />
25539 <meta property='mw:PageProp/notoc' />
25540 <meta property='mw:PageProp/forcetoc' />
25541 <meta property='mw:PageProp/index' />
25542 <meta property='mw:PageProp/noindex' />
25543 <meta property='mw:PageProp/nogallery' />
25544 <meta property='mw:PageProp/noeditsection' />
25545 <meta property='mw:PageProp/notitleconvert' />
25546 <meta property='mw:PageProp/nocontentconvert' />
25547 <meta property='mw:PageProp/unknownproperty' />
25548 !! wikitext
25549 __TOC__
25550 __NOTOC__
25551 __FORCETOC__
25552 __INDEX__
25553 __NOINDEX__
25554 __NOGALLERY__
25555 __NOEDITSECTION__
25556 __NOTITLECONVERT__
25557 __NOCONTENTCONVERT__
25558 !! end
25559
25560 !! test
25561 Consecutive <pre>s should not get merged
25562 !! options
25563 parsoid=html2wt,html2html
25564 !! html/parsoid
25565 <pre>a</pre><pre>b</pre>
25566
25567 <pre>c
25568 </pre><pre>
25569 d</pre>
25570
25571 <pre>e
25572
25573 </pre><pre>
25574
25575 f</pre>
25576 !! wikitext
25577 a
25578
25579 b
25580
25581 c
25582
25583 d
25584
25585 e
25586
25587
25588
25589 f
25590 !! end
25591
25592 !! test
25593 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
25594 !! options
25595 parsoid=html2wt
25596 !! html/parsoid
25597 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
25598 !! wikitext
25599 [[Special:BookSources/1234567890|ISBN 1234567895]]
25600 !! end
25601
25602 !! test
25603 Edited RFC links not serializable as RFC links should serialize as extlinks
25604 !! options
25605 parsoid=html2wt
25606 !! html/parsoid
25607 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
25608 !! wikitext
25609 [//tools.ietf.org/html/rfc123 New RFC]
25610 !! end
25611
25612 !! test
25613 Edited PMID links not serializable as PMID links should serialize as extlinks
25614 !! options
25615 parsoid=html2wt
25616 !! html/parsoid
25617 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
25618 !! wikitext
25619 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
25620 !! end
25621
25622 !! test
25623 WTS of autolinks with trailing/surrounding context
25624 !! options
25625 parsoid=html2wt
25626 !! html/parsoid
25627 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
25628 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
25629 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
25630 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
25631 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
25632 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
25633 !! wikitext
25634 http://cscott.net'''foo'''
25635
25636 http://cscott.net<b>foo</b>
25637
25638 '''http://cscott.net'''
25639
25640 '''http://cscott.net '''
25641
25642 '''http://cscott.net<nowiki/>x'''
25643
25644 http://cscott.net<nowiki/>x
25645 !! end
25646
25647 !! test
25648 WTS of autolinks with nowikis (round-trip)
25649 !! wikitext
25650 x<nowiki/>http://cscott.net<nowiki/>x
25651 !! html/parsoid
25652 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
25653 !! end
25654
25655 # this is the "easy" test because it leaves in place all the
25656 # data-parsoid information indicating this is an autolink
25657 !! test
25658 WTS of autolinks with escapes (editing)
25659 !! options
25660 parsoid={
25661 "modes": ["wt2wt"],
25662 "changes": [
25663 [ "meta", "remove" ]
25664 ]
25665 }
25666 !! wikitext
25667 x<nowiki/>http://cscott.net<nowiki/>x
25668 !! wikitext/edited
25669 x<nowiki/>http://cscott.net<nowiki/>x
25670 !! end
25671
25672 !! test
25673 WTS of edited autolink-like text (T103364)
25674 !! options
25675 parsoid={
25676 "modes": ["wt2wt"],
25677 "changes": [
25678 [ "span[typeof]", "removeAttr", "typeof" ]
25679 ]
25680 }
25681 !! wikitext
25682 Not a link: <nowiki>http://example.com</nowiki>.
25683 !! wikitext/edited
25684 Not a link: <span><nowiki>http://example.com</nowiki></span>.
25685 !! end
25686
25687 !! test
25688 WTS of newly-authored autolink-like text (T103364)
25689 !! options
25690 parsoid=html2wt
25691 !! html/parsoid
25692 <p>http://example.com is not a link.</p>
25693 !! wikitext
25694 <nowiki>http://example.com</nowiki> is not a link.
25695 !! end
25696
25697 !! test
25698 WTS of autolink-like text after an autolink (T108563)
25699 !! options
25700 parsoid=html2wt
25701 !! html/parsoid
25702 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
25703 !! wikitext
25704 http://example.com <nowiki>http://example.com</nowiki> is not a link.
25705 !! end
25706
25707 !! test
25708 Magic links inside links (not autolinked)
25709 !! wikitext
25710 [[Foo|http://example.com]]
25711 [[Foo|RFC 1234]]
25712 [[Foo|PMID 1234]]
25713 [[Foo|ISBN 123456789x]]
25714
25715 [http://foo.com http://example.com]
25716 [http://foo.com RFC 1234]
25717 [http://foo.com PMID 1234]
25718 [http://foo.com ISBN 123456789x]
25719 !! html+tidy
25720 <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>
25721 <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>
25722 !! html/parsoid
25723 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
25724 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
25725 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
25726 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
25727
25728 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
25729 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
25730 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
25731 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
25732 !! end
25733
25734 !! test
25735 Magic links inside image captions (autolinked)
25736 !! wikitext
25737 [[File:Foobar.jpg|thumb|http://example.com]]
25738 [[File:Foobar.jpg|thumb|RFC 1234]]
25739 [[File:Foobar.jpg|thumb|PMID 1234]]
25740 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
25741 !! html+tidy
25742 <div class="thumb tright">
25743 <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>
25744 <div class="thumbcaption">
25745 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25746 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
25747 </div>
25748 </div>
25749 <div class="thumb tright">
25750 <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>
25751 <div class="thumbcaption">
25752 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25753 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
25754 </div>
25755 </div>
25756 <div class="thumb tright">
25757 <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>
25758 <div class="thumbcaption">
25759 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25760 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
25761 </div>
25762 </div>
25763 <div class="thumb tright">
25764 <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>
25765 <div class="thumbcaption">
25766 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25767 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
25768 </div>
25769 </div>
25770 !! html/parsoid
25771 <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>
25772 <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>
25773 <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>
25774 <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>
25775 !! end
25776
25777 !! test
25778 WTS of magic word text (T109371)
25779 !! options
25780 parsoid=html2wt
25781 !! html/parsoid
25782 <p>RFC 1234</p>
25783 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
25784 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
25785 !! wikitext
25786 <nowiki>RFC 1234</nowiki>
25787
25788 [http://foo.com RFC 1234]
25789
25790 [[Foo|RFC 1234]]
25791 !! end
25792
25793 !! test
25794 Edited Redirect link should emit a non-piped wikitext link
25795 !! options
25796 parsoid=html2wt
25797 !! html/parsoid
25798 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
25799 !! wikitext
25800 #REDIRECT [[Bar]]
25801 !! end
25802
25803 !! test
25804 T75121: Infer extension name from typeOf if data-mw is not present
25805 !! options
25806 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25807 !! html/parsoid
25808 <div typeOf="mw:Extension/foo"></div>
25809 !! wikitext
25810 <foo />
25811 !! end
25812
25813 # Note that the <p> wrapping isn't present in PHP parser output
25814 # The important thing for this test is that P-wrapping doesn't
25815 # interfere with the <nowiki> protection for leading - in <td>
25816 # (which isn't necessary for <th>).
25817 !! test
25818 T88318: p-wrapped dash in table.
25819 !! options
25820 parsoid=html2wt,wt2wt
25821 !! html/parsoid
25822 <table><tbody>
25823 <tr><th><p>-</p></th><th><p>- </p></th></tr>
25824 <tr><td><p>-</p></td><td><p>- </p></td></tr>
25825 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
25826 </tbody></table>
25827 !! wikitext
25828 {|
25829 !-
25830 !-
25831 |-
25832 |<nowiki>-</nowiki>
25833 |<nowiki>- </nowiki>
25834 |-
25835 |<small>-</small>
25836 |<br>
25837 -
25838 |<br>
25839 -
25840 |}
25841 !! html/php+tidy
25842 <table>
25843 <tr>
25844 <th>-</th>
25845 <th>-</th>
25846 </tr>
25847 <tr>
25848 <td>-</td>
25849 <td>-</td>
25850 </tr>
25851 <tr>
25852 <td><small>-</small></td>
25853 <td><br />
25854 <p>-</p>
25855 </td>
25856 <td><br />
25857 <p>-</p>
25858 </td>
25859 </tr>
25860 </table>
25861 !! end
25862
25863 !! test
25864 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
25865 !! options
25866 parsoid=html2wt
25867 !! html/parsoid
25868 <table id='mwAb'>
25869 <td id='mwAc'>foo</td>
25870 <td id='serialize-this'>bar</td>
25871 </table>
25872 !! wikitext
25873 {|
25874 |foo
25875 | id="serialize-this" |bar
25876 |}
25877 !! end
25878
25879 !! test
25880 Parsoid-like element ids should not be serialized to wikitext unless shadowed
25881 !! options
25882 parsoid=html2wt
25883 !! html/parsoid
25884 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
25885 !! wikitext
25886 <div id="hello">ok</div>
25887 !! end
25888
25889 !! test
25890 WTS change modes
25891 !! options
25892 parsoid={
25893 "modes": ["wt2wt"],
25894 "changes": [
25895 [ "#xyz", "before", "<b>before</b> stuff " ],
25896 [ "#xyz", "after", " stuff <i>after</i>" ],
25897 [ "#xyz", "html", "x <b>y</b> z" ]
25898 ]
25899 }
25900 !! wikitext
25901 <span id="xyz">hello</span>
25902 !! wikitext/edited
25903 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
25904 !! end
25905
25906 !! test
25907 Never serialize a-tag as html, regardless of what data-parsoid has to say
25908 !! options
25909 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25910 !! html/parsoid
25911 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
25912 !! wikitext
25913 [[Foo]]
25914 !! end
25915
25916 ## SSS FIXME: This is broken output nevertheless.
25917 ## What might be a reasonable non-broken output for this?
25918 ## This is an edge case unlikely to be seen in production
25919 ## that I am not wasting more time on this right now.
25920 !! test
25921 Never serialize a-tag as html, no matter what attributes it has
25922 !! options
25923 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25924 !! html/parsoid
25925 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
25926 !! wikitext
25927 [http://boo.org http://boohoo.org]
25928 !! end
25929
25930 # Misnested is an indication that selser can reuse the source but these have
25931 # shown to sneak through on occasion. See T101768.
25932 # The original wikitext here is: [http://test.com [[one]] two three]
25933 !! test
25934 Strip span tags added to mark misnested links
25935 !! options
25936 parsoid=html2wt
25937 !! html/parsoid
25938 <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>
25939 !! wikitext
25940 [http://test.com][[one]] two three
25941 !! end
25942
25943 !! test
25944 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
25945 !! options
25946 parsoid=html2wt
25947 !! html/parsoid
25948 <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|}"]}'>
25949 <tbody><tr><td>d
25950 </td></tr>
25951 </tbody></table>
25952 !! wikitext
25953 {{echo|a}}
25954 {|{{echo|c
25955 {{!}}d
25956 }}
25957 |}
25958 !! end
25959
25960 ## This test verifies the presence and computation of this attribute indirectly
25961 ## by making an edit and ensuring that the serialization is correct (which it would be
25962 ## only if firstWikitextNode is properly set).
25963 !! test
25964 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
25965 !! options
25966 parsoid= {
25967 "modes": ["wt2wt"],
25968 "changes": [
25969 [ "div#x", "remove" ],
25970 [ "div", "before", "<div>new</div>" ]
25971 ]
25972 }
25973 !! wikitext
25974 <div id="x">foo</div>
25975 {|
25976 {{echo|<div>boo</div>
25977 {{!}}b}}
25978 |c
25979 |}
25980 !! wikitext/edited
25981
25982 <div>new</div>
25983 {|
25984 {{echo|<div>boo</div>
25985 {{!}}b}}
25986 |c
25987 |}
25988 !! end
25989
25990 # --------------------------------------------
25991 # Tests spec'ing wikitext serialization norms |
25992 # --------------------------------------------
25993
25994 !! test
25995 1. Categories should always be serialized on their own line
25996 !! options
25997 parsoid=html2wt
25998 !! html/parsoid
25999 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
26000 !! wikitext
26001 foo
26002 [[Category:Foo]]
26003 bar
26004 !! end
26005
26006 !! test
26007 2. Categories that are part of templates should not introduce a line break
26008 !! wikitext
26009 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
26010 !! html/parsoid
26011 <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>
26012 !! end
26013
26014 # Careful while editing these next 2 tests. There are \u200f characters
26015 # before and after the <link> tags in the HTML and following some
26016 # of the categories in wikitext
26017 # Do not remove these characters in edits.
26018 #
26019 # As part of the serialization, these bidi characters will get stripped.
26020 !! test
26021 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
26022 !! options
26023 parsoid={
26024 "modes": ["html2wt"],
26025 "scrubWikitext": true
26026 }
26027 !! html/parsoid
26028 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
26029 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
26030 !! wikitext
26031 [[קטגוריה:טקסים]]
26032 [[קטגוריה: שיטות משפט]]
26033 !! end
26034
26035 !! test
26036 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
26037 !! options
26038 parsoid={
26039 "modes": ["html2wt"],
26040 "scrubWikitext": true
26041 }
26042 !! html/parsoid
26043 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
26044 !! wikitext
26045 [[קטגוריה:טקסים]]
26046 ‏y
26047 !! end
26048
26049 !! test
26050 Lists: Add space after bullets
26051 !! options
26052 parsoid=html2wt
26053 !! html/parsoid
26054 <ul>
26055 <li>foo</li>
26056 <li> bar</li>
26057 <li><span> baz</span></li>
26058 </ul>
26059 !! wikitext
26060 * foo
26061 * bar
26062 * <span> baz</span>
26063 !! end
26064
26065 !! test
26066 1. Headings: Add space before/after == (T53744)
26067 !! options
26068 parsoid=html2wt
26069 !! html/parsoid
26070 <h2>foo</h2>
26071 <h2> bar</h2>
26072 <h2>baz </h2>
26073 <h2><span> baz</span></h2>
26074 !! wikitext
26075 == foo ==
26076
26077 == bar ==
26078
26079 == baz ==
26080
26081 == <span> baz</span> ==
26082 !! end
26083
26084 !! test
26085 2. Headings: Add space before/after == even after hoisted content
26086 !! options
26087 parsoid={
26088 "modes": ["html2wt"],
26089 "scrubWikitext": true
26090 }
26091 !! html/parsoid
26092 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
26093 !! wikitext
26094 [[Category:A2]]
26095
26096 == ok ==
26097 !! end
26098
26099 !! test
26100 1. Headings: suppress newly created empty headings
26101 !! options
26102 parsoid={
26103 "modes": ["html2wt"],
26104 "scrubWikitext": true
26105 }
26106 !! html/parsoid
26107 <h2></h2>
26108 !! wikitext
26109 !! end
26110
26111 !! test
26112 2. Headings: don't suppress empty headings if scrubWikitext is false
26113 !! options
26114 parsoid=html2wt
26115 !! html/parsoid
26116 <h2></h2>
26117 !! wikitext
26118 ==<nowiki/>==
26119 !! end
26120
26121 !! test
26122 3. Headings: suppress empty headings on edits
26123 !! options
26124 parsoid={
26125 "modes": ["selser"],
26126 "scrubWikitext": true,
26127 "changes": [
26128 [ "#x", "remove"]
26129 ]
26130 }
26131 !! wikitext
26132 ==<span id="x">foo</span>==
26133 !! wikitext/edited
26134 !! end
26135
26136 !! test
26137 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
26138 !! options
26139 parsoid={
26140 "modes": ["html2wt"],
26141 "scrubWikitext": true
26142 }
26143 !! html/parsoid
26144 <h2>foo<br/>bar</h2>
26145 <h2>foo <span><br/>bar</span> baz</h2>
26146 !! wikitext
26147 == foo bar ==
26148
26149 == foo <span> bar</span> baz ==
26150 !! end
26151
26152 !! test
26153 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
26154 !! options
26155 parsoid={
26156 "modes": ["html2wt"],
26157 "scrubWikitext": false
26158 }
26159 !! html/parsoid
26160 <h2>foo<br/>bar</h2>
26161 !! wikitext
26162 == foo<br> bar ==
26163 !! end
26164
26165 !! test
26166 1. WT Quote Tags: suppress newly created empty style tags
26167 !! options
26168 parsoid={
26169 "modes": ["html2wt"],
26170 "scrubWikitext": true
26171 }
26172 !! html/parsoid
26173 <i></i><b></b>
26174 !! wikitext
26175 !! end
26176
26177 !! test
26178 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
26179 !! options
26180 parsoid=html2wt
26181 !! html/parsoid
26182 <i></i><b></b>
26183 !! wikitext
26184 ''<nowiki/>'''''<nowiki/>'''
26185 !! end
26186
26187 !! test
26188 3. WT Quote Tags: suppress empty style tags on edits
26189 !! options
26190 parsoid={
26191 "modes": ["selser"],
26192 "scrubWikitext": true,
26193 "changes": [
26194 [ "#x", "remove"]
26195 ]
26196 }
26197 !! wikitext
26198 '''<span id="x">foo</span>'''
26199 !! wikitext/edited
26200 !! end
26201
26202 !! test
26203 1. Anchors: suppress newly created empty anchors
26204 !! options
26205 parsoid={
26206 "modes": ["html2wt"],
26207 "scrubWikitext": true
26208 }
26209 !! html/parsoid
26210 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26211 !! wikitext
26212 !! end
26213
26214 !! test
26215 2. Anchors: don't suppress empty anchors if scrubWikitext is false
26216 !! options
26217 parsoid={
26218 "modes": ["html2wt"],
26219 "scrubWikitext": false
26220 }
26221 !! html/parsoid
26222 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26223 !! wikitext
26224 [[Test|<nowiki/>]]
26225 !! end
26226
26227 !! test
26228 3. Anchors: suppress empty anchors on edits
26229 !! options
26230 parsoid={
26231 "modes": ["selser"],
26232 "scrubWikitext": true,
26233 "changes": [
26234 [ "#x", "remove"]
26235 ]
26236 }
26237 !! wikitext
26238 [[Test|<span id="x">foo</span>]]
26239 !! wikitext/edited
26240 !! end
26241
26242 !! test
26243 3a. Anchors: do not suppress numbered extlinks
26244 !! options
26245 parsoid={
26246 "modes": ["wt2wt"],
26247 "scrubWikitext": true
26248 }
26249 !! wikitext
26250 [http://foo.com]
26251 !! html/parsoid
26252 <a rel="mw:ExtLink" href="http://foo.com"></a>
26253 !! end
26254
26255 !! test
26256 3b. Anchors: do not suppress numbered extlinks
26257 !! options
26258 parsoid={
26259 "modes": ["wt2wt"],
26260 "scrubWikitext": true,
26261 "changes": [
26262 [ "#x", "remove"]
26263 ]
26264 }
26265 !! wikitext
26266 [http://foo.com <span id="x">foo</span>]
26267 !! wikitext/edited
26268 [http://foo.com]
26269 !! end
26270
26271 !!test
26272 Normalizations should be restricted to edited content
26273 !!options
26274 parsoid={
26275 "modes": ["selser"],
26276 "scrubWikitext": true,
26277 "changes": [
26278 [ "h1", "before", "<i></i>"]
26279 ]
26280 }
26281 !!wikitext
26282 a
26283 = =
26284 b
26285 !!wikitext/edited
26286 a
26287 = =
26288 b
26289 !!end
26290
26291 !! test
26292 1. Multiple normalizations (html2wt)
26293 !! options
26294 parsoid={
26295 "modes": ["html2wt"],
26296 "scrubWikitext": true
26297 }
26298 !! html
26299 <h2><i></i></h2>
26300 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
26301 </a><b><i></i></b>x</p>
26302 !! wikitext
26303
26304 [[foo]]
26305 x
26306
26307 !! end
26308
26309 !! test
26310 2. Multiple normalizations (selser)
26311 !! options
26312 parsoid={
26313 "modes": ["selser"],
26314 "scrubWikitext": true,
26315 "changes": [
26316 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
26317 ]
26318 }
26319 !! wikitext
26320 <span id="x">foo</span>
26321 !! wikitext/edited
26322 <span id="x">foo</span>
26323
26324 x
26325 !! end
26326
26327 !! test
26328 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
26329 !! options
26330 parsoid={
26331 "modes": ["html2wt"],
26332 "scrubWikitext": true
26333 }
26334 !! html/parsoid
26335 <p> hi</p>
26336 <p> hello</p>
26337 !! wikitext
26338 hi
26339
26340 hello
26341 !! end
26342
26343 !! test
26344 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
26345 !! options
26346 parsoid=html2wt
26347 !! html/parsoid
26348 <p> hi</p>
26349 <p> hello</p>
26350 !! wikitext
26351 <nowiki> </nowiki>hi
26352
26353 <nowiki> </nowiki> hello
26354 !! end
26355
26356 !! test
26357 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
26358 !! options
26359 parsoid={
26360 "modes": ["html2wt"],
26361 "scrubWikitext": true
26362 }
26363 !! html/parsoid
26364 <p>Foo
26365 bar
26366 baz</p>
26367
26368 <table><tr><td>Foo
26369 bar
26370 baz bang</td></tr></table>
26371
26372 <p><!--boo--> foo
26373 bar</p>
26374
26375 <p> foo
26376 bar<span>boo</span></p>
26377 !! wikitext
26378 Foo
26379 bar
26380 baz
26381
26382 {|
26383 |Foo
26384 bar
26385 baz bang
26386 |}
26387
26388 <!--boo-->foo
26389 bar
26390
26391 foo
26392 bar<span>boo</span>
26393 !! end
26394
26395 !! test
26396 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
26397 !! options
26398 parsoid={
26399 "modes": ["selser"],
26400 "scrubWikitext": true,
26401 "changes": [
26402 [ "p", "html", " a\n b" ]
26403 ]
26404 }
26405 !! wikitext
26406 xyz
26407 !! wikitext/edited
26408 a
26409 b
26410 !! end
26411
26412 !! test
26413 1. New links that end in spaces
26414 !! options
26415 parsoid={
26416 "modes": ["html2wt"],
26417 "scrubWikitext": false
26418 }
26419 !! html/parsoid
26420 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26421 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26422 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26423 !! wikitext
26424 [[Berlin ]]<nowiki/>is the capital of Germany.
26425
26426 [[Foo ]]'''bar'''
26427
26428 [[Boston ]] is a city.
26429 !! end
26430
26431 !! test
26432 2. New links that end in spaces
26433 !! options
26434 parsoid={
26435 "modes": ["html2wt"],
26436 "scrubWikitext": true
26437 }
26438 !! html/parsoid
26439 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26440 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26441 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26442 !! wikitext
26443 [[Berlin]] is the capital of Germany.
26444
26445 [[Foo]] '''bar'''
26446
26447 [[Boston]] is a city.
26448 !! end
26449
26450 !! test
26451 1. Table cells with escapable prefixes
26452 !! options
26453 parsoid={
26454 "modes": ["html2wt"],
26455 "scrubWikitext": false
26456 }
26457 !! html
26458 <table>
26459 <tr><td>a</td></tr>
26460 <tr><td>-</td></tr>
26461 <tr><td>+</td></tr>
26462 </table>
26463 !! wikitext
26464 {|
26465 |a
26466 |-
26467 |<nowiki>-</nowiki>
26468 |-
26469 |<nowiki>+</nowiki>
26470 |}
26471 !! end
26472
26473 !! test
26474 2. Table cells with escapable prefixes
26475 !! options
26476 parsoid={
26477 "modes": ["html2wt"],
26478 "scrubWikitext": true
26479 }
26480 !! html
26481 <table>
26482 <tr><td>a</td></tr>
26483 <tr><td>-</td></tr>
26484 <tr><td>+</td></tr>
26485 </table>
26486 !! wikitext
26487 {|
26488 |a
26489 |-
26490 | -
26491 |-
26492 | +
26493 |}
26494 !! end
26495
26496 !! test
26497 3a. Table cells with escapable prefixes after edits
26498 !! options
26499 parsoid={
26500 "modes": ["selser"],
26501 "scrubWikitext": true,
26502 "changes": [
26503 [ "table tbody tr:first-child td:first-child", "remove"]
26504 ]
26505 }
26506 !! wikitext
26507 {|
26508 |a||-
26509 |}
26510 !! wikitext/edited
26511 {|
26512 | -
26513 |}
26514 !! end
26515
26516 !! test
26517 3b. Table cells with escapable prefixes after edits
26518 !! options
26519 parsoid={
26520 "modes": ["selser"],
26521 "scrubWikitext": true,
26522 "changes": [
26523 [ "table tbody tr:first-child td:first-child", "html", "-" ],
26524 [ "#x", "remove" ]
26525 ]
26526 }
26527 !! wikitext
26528 {|
26529 |pqr
26530 |<span id="x">foo</span>+
26531 |}
26532 !! wikitext/edited
26533 {|
26534 | -
26535 | +
26536 |}
26537 !! end
26538
26539 # FIXME: This test will fail because
26540 # normalization doesn't realize that the id attribute
26541 # will eliminate the escapable scenario
26542 !! test
26543 4a. Table cells without escapable prefixes after edits
26544 !! options
26545 parsoid={
26546 "modes": ["selser"],
26547 "scrubWikitext": true,
26548 "changes": [
26549 [ "#x", "html", "-" ]
26550 ]
26551 }
26552 !! wikitext
26553 {|
26554 | id="x" |abcd
26555 |}
26556 !! wikitext/edited
26557 {|
26558 | id="x" |-
26559 |}
26560 !! end
26561
26562 ## This tests normalizer's ability to discriminate between
26563 ## cells having identical content.
26564 !! test
26565 4b. Table cells without escapable prefixes after edits
26566 !! options
26567 parsoid={
26568 "modes": ["selser"],
26569 "scrubWikitext": true,
26570 "changes": [
26571 [ "td", "html", "-" ]
26572 ]
26573 }
26574 !! wikitext
26575 {|
26576 |a||b
26577 |}
26578 !! wikitext/edited
26579 {|
26580 | -||-
26581 |}
26582 !! end
26583
26584 ## This tests normalizer's ability to not be tripped by
26585 ## comments (and whitespace)
26586 !! test
26587 4c. Table cells without escapable prefixes after edits
26588 !! options
26589 parsoid={
26590 "modes": ["selser"],
26591 "scrubWikitext": true,
26592 "changes": [
26593 [ "table tbody tr td:first-child", "remove" ]
26594 ]
26595 }
26596 !! wikitext
26597 {|
26598 |-
26599 <!--foo--> |a||-
26600 |}
26601 !! wikitext/edited
26602 {|
26603 |-
26604 <!--foo--> | -
26605 |}
26606 !! end
26607
26608 ## This tests normalizer's ability to handle HTML cells
26609 !! test
26610 4d. Table cells without escapable prefixes after edits
26611 !! options
26612 parsoid={
26613 "modes": ["selser"],
26614 "scrubWikitext": true,
26615 "changes": [
26616 [ "td", "html", "-" ]
26617 ]
26618 }
26619 !! wikitext
26620 <table>
26621 <tr><td>a</td></tr>
26622 </table>
26623 !! wikitext/edited
26624 <table>
26625 <tr><td>-</td></tr>
26626 </table>
26627 !! end
26628
26629 ## T111151 Remove font elements without attributes
26630 !! test
26631 5a. font tags without attributes should be dropped in scrubWikitext mode
26632 !! options
26633 parsoid={
26634 "modes": ["html2wt"],
26635 "scrubWikitext": true
26636 }
26637 !! html
26638 <font>foo</font>
26639 <font><font>bar</font></font>
26640 <font class="x">boo</font>
26641 !! wikitext
26642 foo
26643 bar
26644 <font class="x">boo</font>
26645 !! end
26646
26647 !! test
26648 5b. font tags should not be dropped without scrubWikitext being enabled
26649 !! options
26650 parsoid={
26651 "modes": ["html2wt"],
26652 "scrubWikitext": false
26653 }
26654 !! html
26655 <font>foo</font>
26656 !! wikitext
26657 <font>foo</font>
26658 !! end
26659
26660 !! test
26661 Escape nowiki DOM elements
26662 !! options
26663 parsoid=html2wt
26664 !! html/parsoid
26665 <nowiki><i>foo</i></nowiki>
26666 !! wikitext
26667 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
26668 !! end
26669
26670 # This is meant to be an interim fix while we go about figuring out
26671 # how to not introduce these trailing <nowiki/>s in the first place.
26672 !! test
26673 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
26674 !! options
26675 parsoid=html2wt
26676 !! html/parsoid
26677 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
26678 y</p>
26679 <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>
26680 <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>
26681 !! wikitext
26682 x
26683 y
26684
26685 {{echo|
26686 1 = <nowiki/>}}
26687
26688 {{echo|
26689 1 = <nowiki/>
26690 }}
26691 !! end
26692
26693 # ---------------------------------------------------
26694 # End of tests spec'ing wikitext serialization norms |
26695 # ---------------------------------------------------
26696
26697 # T104032
26698 !! test
26699 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
26700 !! options
26701 parsoid=html2wt
26702 !! html/parsoid
26703 a<p>b</p>
26704 <b>c</b><p>d</p>
26705 <table><tr>
26706 <td>a<p>b</p></td>
26707 <td><b>c</b><p>d</p></td>
26708 </tr></table>
26709 !! wikitext
26710 a
26711
26712 b
26713
26714 '''c'''
26715
26716 d
26717 {|
26718 |a
26719 b
26720 |'''c'''
26721 d
26722 |}
26723 !! end
26724
26725 # -----------------------------------------------------------------
26726 # End of section for Parsoid-only html2wt tests for serialization
26727 # of new content
26728 # -----------------------------------------------------------------
26729
26730 # -----------------------------------------------------------------
26731 # The following section of tests are primarily to spec behavior of
26732 # the selective serializer. All these tests have manual selser
26733 # changes. The automated selser changes for all tests handle the
26734 # wide variation of changes, but these tests here capture specs
26735 # deterministically.
26736 # ----------------------------------------------------------------
26737
26738 ## T90517
26739 !! test
26740 Selser: New comments should not be lost
26741 !! options
26742 parsoid={
26743 "modes": ["selser"],
26744 "changes": [
26745 [ "#a", "after", "<!--c1-->" ],
26746 [ "#b", "before", "<!--c2-->" ]
26747 ]
26748 }
26749 !! wikitext
26750 <span id="a">a</span>
26751
26752 <span id="b">b</span>
26753 !! wikitext/edited
26754 <span id="a">a</span><!--c1-->
26755
26756 <!--c2--><span id="b">b</span>
26757 !! end
26758
26759 ## T89383
26760 !! test
26761 Selser: Check for validity of DSR before using it
26762 !! options
26763 parsoid={
26764 "modes": ["selser"],
26765 "changes": [
26766 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
26767 ]
26768 }
26769 !! wikitext
26770 <span id="a">a</span>
26771 !! wikitext/edited
26772 {{DISPLAYTITLE:foo}}
26773 <span id="a">a</span>
26774 !! end
26775
26776 !! test
26777 1. DOMDiff: Changes to <ref> content should be looked up using id
26778 !! options
26779 parsoid={
26780 "modes": ["selser"],
26781 "changes": [
26782 ["#X", "after", "bar"],
26783 ["#Y", "after", "baz"]
26784 ]
26785 }
26786 !! wikitext
26787 X <ref><span id="X">foo</span></ref>
26788 Y <ref name="a" />
26789 <references>
26790 <ref name="a"><span id="Y">foo</span></ref>
26791 </references>
26792 !! wikitext/edited
26793 X <ref><span id="X">foo</span>bar</ref>
26794 Y <ref name="a" />
26795 <references>
26796 <ref name="a"><span id="Y">foo</span>baz</ref>
26797 </references>
26798 !! end
26799
26800 !! test
26801 2. DOMDiff: Changes to <ref> content should be looked up using id
26802 !! options
26803 parsoid={
26804 "modes": ["selser"],
26805 "changes": [
26806 ["#Z", "after", "bar"]
26807 ]
26808 }
26809 !! wikitext
26810 A <ref>foo bar for a</ref>
26811 B <ref group="X" name="b" />
26812
26813 <references />
26814
26815 <references group="X">
26816 <ref name="b"><span id="Z">foo</span></ref>
26817 </references>
26818 !! wikitext/edited
26819 A <ref>foo bar for a</ref>
26820 B <ref group="X" name="b" />
26821
26822 <references />
26823
26824 <references group="X">
26825 <ref name="b"><span id="Z">foo</span>bar</ref>
26826 </references>
26827 !! end
26828
26829 !! test
26830 Empty LI (T49673)
26831 !! wikitext
26832 * a
26833 *
26834 *
26835 * b
26836 !! html/php+tidy
26837 <ul>
26838 <li>a</li>
26839 <li class="mw-empty-li"></li>
26840 <li class="mw-empty-li"></li>
26841 <li>b</li>
26842 </ul>
26843 !! end