Preprocessor: Don't allow unclosed extension tags (matching until end of input)
[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 !! test
2523 Handle broken pre-like tags (bug 64025)
2524 !! options
2525 parsoid=wt2html
2526 !! wikitext
2527 {{echo|<pre <pre>x</pre>}}
2528
2529 <table><pre </table>
2530 !! html/php
2531 <pre>x</pre>
2532 <table>&lt;pre </table>
2533
2534 !! html/php+tidy
2535 <pre>
2536 x
2537 </pre>
2538 <p>&lt;pre</p>
2539 !! html/parsoid
2540 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"a":{"&lt;pre":null},"sa":{"&lt;pre":""},"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
2541
2542
2543 <p>&lt;pre </p>
2544
2545 <table></table>
2546 !! end
2547
2548 !! test
2549 Parsoid: handle pre with space after attribute
2550 !! options
2551 parsoid=wt2html
2552 !! wikitext
2553 <pre style="width:50%;" >{{echo|foo}}</pre>
2554 !! html/php
2555 <pre style="width:50%;">{{echo|foo}}</pre>
2556
2557 !! html/parsoid
2558 <pre style="width:50%;">{{echo|foo}}</pre>
2559 !! end
2560
2561 # TODO / maybe: fix wt2wt for this
2562 !! test
2563 Parsoid: Don't paragraph-wrap fosterable content
2564 !! options
2565 parsoid=wt2html
2566 !! wikitext
2567 {|
2568 <td></td>
2569 <td></td>
2570
2571
2572
2573 |}
2574 !! html
2575 <table>
2576
2577 <tbody>
2578 <tr>
2579 <td></td>
2580
2581 <td></td></tr>
2582
2583
2584
2585 </tbody></table>
2586 !! end
2587
2588 !! test
2589 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2590 !! options
2591 parsoid=wt2html
2592 !! wikitext
2593 {|
2594 <td>
2595 <td>
2596 </td>
2597
2598
2599
2600 |}
2601 !! html
2602 <table>
2603
2604 <tbody>
2605 <tr>
2606 <td></td>
2607
2608 <td>
2609 </td></tr>
2610
2611
2612
2613 </tbody></table>
2614 !! end
2615
2616
2617 #--------------------------------------------------------------------
2618 # Transclusion parameter whitespace stripping tests
2619 # Behavior is different for positional and named parameters
2620 #--------------------------------------------------------------------
2621 !! test
2622 Templates: Strip leading and trailing whitespace from named-param values
2623 !! wikitext
2624 {{echo|1= a }}
2625
2626 {{echo|1= {{echo|b}} }}
2627
2628 {{echo| 1 =
2629 c }}
2630
2631 {{echo| 1 =
2632 * d
2633 }}
2634 !! html
2635 <p>a
2636 </p><p>b
2637 </p><p>c
2638 </p>
2639 <ul><li> d</li></ul>
2640
2641 !! end
2642
2643 !! test
2644 Templates: Don't strip whitespace from positional-param values
2645 !! wikitext
2646 {{echo|a }}
2647
2648 {{echo|{{echo|b}} }}
2649
2650 {{echo| c
2651 }}
2652
2653 {{echo| {{echo|d}}
2654 }}
2655
2656 {{echo|
2657 e}}
2658
2659 {{echo|
2660 * f}}
2661
2662 {{echo|
2663 }}g
2664 !! html
2665 <p>a
2666 </p><p>b
2667 </p>
2668 <pre>c
2669 </pre>
2670 <p><br />
2671 </p>
2672 <pre>d
2673 </pre>
2674 <p><br />
2675 </p>
2676 <pre>e
2677 </pre>
2678 <p><br />
2679 </p>
2680 <ul><li> f</li></ul>
2681 <p><br />
2682 </p>
2683 <pre>g
2684 </pre>
2685 !! end
2686
2687 !! test
2688 Templates: Handle empty comment-and-ws-only lines correctly
2689 !! wikitext
2690 {{echo|foo
2691 <!--should be ignored-->
2692 <!--should be ignored as well-->
2693 bar}}
2694 !! html
2695 <p>foo
2696 bar
2697 </p>
2698 !! end
2699
2700 !! test
2701 Templates: Handle comments in the target
2702 !! wikitext
2703 {{echo
2704 <!-- should be ignored -->
2705 |foo}}
2706
2707 {{echo<!-- should be ignored -->
2708 |foo}}
2709
2710 {{echo<!-- should be ignored -->|foo}}
2711
2712 {{<!-- should be ignored -->echo|foo}}
2713 !!html/parsoid
2714 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2715
2716 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2717
2718 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2719
2720 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2721 !!end
2722
2723 !! test
2724 Templates: Handle comments in parameter names (bug 67657)
2725 !! wikitext
2726 {{echo|1
2727 <!-- should be ignored -->
2728 =foo}}
2729
2730 {{echo|
2731 <!-- should be ignored -->
2732 1 = foo}}
2733
2734 {{echo|1<!-- should be ignored -->=foo}}
2735
2736 {{echo|<!-- should be ignored -->1=foo}}
2737 !!html/parsoid
2738 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1\n&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2739
2740 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->\n1"}}},"i":0}}]}'>foo</p>
2741
2742 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
2743
2744 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->1"}}},"i":0}}]}'>foo</p>
2745 !!end
2746
2747 !! test
2748 Templates: Other wikitext in parameter names (bug 67657)
2749 !! wikitext
2750 {{echo|''1''=foo}}
2751 !!html/parsoid
2752 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"&#39;&#39;1&#39;&#39;":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2753 !!html/php
2754 <p>{{{1}}}
2755 </p>
2756 !!end
2757
2758 #--------------------------------------------------------------------
2759 # Transclusion parameter escaping tests
2760 #--------------------------------------------------------------------
2761 !! test
2762 Templates: Parsoid parameter escaping test 1
2763 !! wikitext
2764 {{echo|[foo]|{{echo|[bar]}}}}
2765 !! html/php+tidy
2766 <p>[foo]</p>
2767 !! html/parsoid
2768 <p about="#mwt1" typeof="mw:Transclusion"
2769 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2770 !! end
2771
2772 !! test
2773 Parsoid: Pipes in external links in template parameter
2774 !! wikitext
2775 {{echo|[{{echo|http://example.com}} link]}}
2776 !! html/php+tidy
2777 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2778 !! html/parsoid
2779 <p><a rel="mw:ExtLink" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{echo|http://example.com}} link]"}},"i":0}}]}'>link</a></p>
2780 !! end
2781
2782 !! test
2783 Parsoid: pipe in transclusion parameter
2784 !! wikitext
2785 {{echo|http://foo.com/a&#124;b}}
2786 !! html/php+tidy
2787 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2788 !! html/parsoid
2789 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2790 typeof="mw:Transclusion"
2791 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a|b</a></p>
2792 !! end
2793
2794 !! test
2795 Parsoid: Pipe in external link target and content in template parameter
2796 !! options
2797 parsoid=html2wt,wt2wt
2798 !! wikitext
2799 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2800 !! html/php+tidy
2801 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2802 !! html/parsoid
2803 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2804 typeof="mw:Transclusion"
2805 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2806 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2807 !! end
2808
2809 !! test
2810 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2811 !! options
2812 parsoid
2813 !! wikitext
2814 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2815 !! html
2816 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]"}},"i":0}}]}'>[Main Page bar]</p>
2817 !! end
2818
2819 !! test
2820 Templates: Don't escape already nowiki-escaped text in template parameters
2821 !! options
2822 parsoid=html2wt,wt2wt
2823 !! wikitext
2824 {{echo|foo<nowiki>|</nowiki>bar}}
2825 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2826 {{echo|<nowiki></nowiki>}}
2827 !! html/php+tidy
2828 <p>foo|bar &lt;div&gt;</p>
2829 !! html/parsoid
2830 <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}}]}'}'>foo</span><span typeof="mw:Nowiki" about="#mwt1">|</span><span about="#mwt1">bar</span>
2831 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki>&amp;lt;div&amp;gt;</nowiki>"}},"i":0}}]}'><span typeof="mw:Entity">&lt;</span>div<span typeof="mw:Entity">&gt;</span></span>
2832 <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}}]}'></span>
2833 </p>
2834 !! end
2835
2836 ## Bug 52824
2837 !! test
2838 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2839 !! options
2840 parsoid=html2wt,wt2wt
2841 !! wikitext
2842 {{echo|{{echo|1=bar}}}}
2843 !! html/php+tidy
2844 <p>bar</p>
2845 !! html/parsoid
2846 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{echo|1=bar}}"}},"i":0}}]}'>bar</p>
2847 !! end
2848
2849 ## Bug 56733
2850 !! test
2851 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2852 !! wikitext
2853 {{echo|a : b}}
2854 !! html/php+tidy
2855 <p>a&#160;: b</p>
2856 !! html/parsoid
2857 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a : b"}},"i":0}}]}'>a<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"isDisplayHack":true}'> </span>: b</p>
2858 !! end
2859
2860 ## Bug T73412
2861 !! test
2862 Templates: Preserve blank parameter names
2863 !! wikitext
2864 {{echo|=foo}}
2865 !! html/php+tidy
2866 <p>{{{1}}}</p>
2867 !! html/parsoid
2868 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2869 !! end
2870
2871 !! test
2872 Templates: Preserve blank parameter names in other positions
2873 !! wikitext
2874 {{blank_param|bar|=foo}}
2875 !! html/php+tidy
2876 <p>bar foo</p>
2877 !! html/parsoid
2878 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"blank_param","href":"./Template:Blank_param"},"params":{"1":{"wt":"bar"},"":{"wt":"foo"}},"i":0}}]}'>bar
2879 foo</p>
2880 !! end
2881
2882 ###
2883 ### Parsoid-centric tests for testing RT edge cases for pre
2884 ###
2885
2886 !!test
2887 1a. Indent-Pre and Comments
2888 !! wikitext
2889 a
2890 <!--a-->
2891 c
2892 !! html
2893 <pre>a
2894 </pre>
2895 <p>c
2896 </p>
2897 !!end
2898
2899 !!test
2900 1b. Indent-Pre and Comments
2901 !! wikitext
2902 a
2903 <!--a-->
2904 c
2905 !! html
2906 <pre>a
2907 </pre>
2908 <p>c
2909 </p>
2910 !!end
2911
2912 !!test
2913 1c. Indent-Pre and Comments
2914 !! wikitext
2915 <!--a--> a
2916
2917 <!--a--> a
2918 !! html
2919 <pre> a
2920 </pre>
2921 <pre> a
2922 </pre>
2923 !!end
2924
2925 !!test
2926 1d. Indent-Pre and Comments
2927 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2928 !! wikitext
2929 <!--a--> a
2930
2931 <!--b-->b
2932 !! html
2933 <pre>a
2934 </pre>
2935 <pre>b
2936 </pre>
2937 !!end
2938
2939 !!test
2940 2a. Indent-Pre and tables
2941 !! wikitext
2942 {|
2943 |-
2944 !h1!!h2
2945 |foo||bar
2946 |}
2947 !! html
2948 <table>
2949
2950 <tr>
2951 <th>h1</th>
2952 <th>h2
2953 </th>
2954 <td>foo</td>
2955 <td>bar
2956 </td></tr></table>
2957
2958 !!end
2959
2960 !!test
2961 2b. Indent-Pre and tables
2962 !! wikitext
2963 {|
2964 |-
2965 |foo
2966 |}
2967 !! html
2968 <table>
2969
2970 <tr>
2971 <td>foo
2972 </td></tr></table>
2973
2974 !!end
2975
2976 !!test
2977 2c. Indent-Pre and tables (bug 42252)
2978 !! wikitext
2979 {|
2980 |+ foo
2981 ! | bar
2982 |}
2983 !! html
2984 <table>
2985 <caption> foo
2986 </caption>
2987 <tr>
2988 <th> bar
2989 </th></tr></table>
2990
2991 !!end
2992
2993 !!test
2994 2d. Indent-Pre and tables
2995 !! wikitext
2996 a
2997 {|
2998 | b
2999 |}
3000 !! html/php
3001 <pre>a
3002 </pre>
3003 <table>
3004 <tr>
3005 <td> b
3006 </td></tr></table>
3007
3008 !! html/parsoid
3009 <pre>a</pre>
3010 <table>
3011 <tbody><tr><td> b</td></tr>
3012 </tbody></table>
3013 !!end
3014
3015 !!test
3016 2e. Indent-Pre and table-line syntax
3017 !! wikitext
3018 a
3019 | b
3020 | c
3021 !! html/php
3022 <pre>a
3023 | b
3024 | c
3025 </pre>
3026 !!end
3027
3028 !!test
3029 2f. Indent-pre started by table-line syntax
3030 !! wikitext
3031 a
3032 | b
3033 | c
3034 !! html/php
3035 <p>a
3036 </p>
3037 <pre>| b
3038 | c
3039 </pre>
3040 !! html/parsoid
3041 <p>a</p>
3042 <pre>
3043 | b
3044 | c</pre>
3045 !!end
3046
3047 !!test
3048 3a. Indent-Pre and block tags (single-line html)
3049 !! wikitext
3050 a <p> foo </p>
3051 b <div> foo </div>
3052 c <blockquote> foo </blockquote>
3053 <span> foo </span>
3054 !! html
3055 a <p> foo </p>
3056 b <div> foo </div>
3057 c <blockquote> foo </blockquote>
3058 <pre><span> foo </span>
3059 </pre>
3060 !! html/parsoid
3061 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3062 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3063 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3064 <pre><span> foo </span>
3065 </pre>
3066 !! html+tidy
3067 <p>a</p>
3068 <p>foo</p>
3069 <p>b</p>
3070 <div>foo</div>
3071 <p>c</p>
3072 <blockquote>
3073 <p>foo</p>
3074 </blockquote>
3075 <pre>
3076 <span> foo </span>
3077 </pre>
3078 !! end
3079
3080 !!test
3081 3b. Indent-Pre and block tags (multi-line html)
3082 !! wikitext
3083 a <span>foo</span>
3084 b <div> foo </div>
3085 !! html
3086 <pre>a <span>foo</span>
3087 </pre>
3088 b <div> foo </div>
3089
3090 !! html/parsoid
3091 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3092 b <div data-parsoid='{"stx":"html"}'> foo </div>
3093 !! html+tidy
3094 <pre>
3095 a <span>foo</span>
3096 </pre>
3097 <p>b</p>
3098 <div>foo</div>
3099 !!end
3100
3101 !!test
3102 3c. Indent-Pre and block tags (pre-content on separate line)
3103 !! wikitext
3104 <p>
3105 foo
3106 </p>
3107
3108 <div>
3109 foo
3110 </div>
3111
3112 <center>
3113 foo
3114 </center>
3115
3116 <blockquote>
3117 foo
3118 </blockquote>
3119
3120 <blockquote>
3121 <pre>
3122 foo
3123 </pre>
3124 </blockquote>
3125
3126 <table><tr><td>
3127 foo
3128 </td></tr></table>
3129
3130 <ul><li>
3131 foo
3132 </li></ul>
3133
3134 !! html
3135 <p>
3136 foo
3137 </p>
3138 <div>
3139 <pre>foo
3140 </pre>
3141 </div>
3142 <center>
3143 <pre>foo
3144 </pre>
3145 </center>
3146 <blockquote>
3147 <p> foo
3148 </p>
3149 </blockquote>
3150 <blockquote>
3151 <pre>
3152 foo
3153 </pre>
3154 </blockquote>
3155 <table><tr><td>
3156 <pre>foo
3157 </pre>
3158 </td></tr></table>
3159 <ul><li>
3160 foo
3161 </li></ul>
3162
3163 !!end
3164
3165 !!test
3166 4. Indent-Pre and extension tags
3167 !! wikitext
3168 a <gallery>
3169 File:foobar.jpg
3170 </gallery>
3171 !! html
3172 a <ul class="gallery mw-gallery-traditional">
3173 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
3174 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
3175 <div class="gallerytext">
3176 </div>
3177 </div></li>
3178 </ul>
3179
3180 !! html+tidy
3181 <p>a</p>
3182 <ul class="gallery mw-gallery-traditional">
3183 <li class="gallerybox" style="width: 155px">
3184 <div style="width: 155px">
3185 <div class="thumb" style="width: 150px;">
3186 <div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div>
3187 </div>
3188 <div class="gallerytext"></div>
3189 </div>
3190 </li>
3191 </ul>
3192 !!end
3193
3194 !! test
3195 Table wikitext syntax outside wiki-tables
3196 !! wikitext
3197 a
3198 ! not a table heading
3199 |- not a table row
3200 | not a table cell
3201 | class="foo bar" | baz
3202 b
3203 |}
3204 |-
3205 c
3206 !! html
3207 <p>a
3208 ! not a table heading
3209 |- not a table row
3210 | not a table cell
3211 | class="foo bar" | baz
3212 b
3213 |}
3214 |-
3215 c
3216 </p>
3217 !! end
3218
3219 !!test
3220 Render paragraphs when indent-pre is suppressed in blocklevels
3221 !! wikitext
3222 <blockquote>
3223 foo
3224
3225 bar
3226 </blockquote>
3227 !! html
3228 <blockquote>
3229 <p> foo
3230 </p><p> bar
3231 </p>
3232 </blockquote>
3233
3234 !!end
3235
3236 !!test
3237 4. Multiple spaces at start-of-line
3238 !! wikitext
3239 <p> foo </p>
3240 foo
3241 {|
3242 |foo
3243 |}
3244 !! html
3245 <p> foo </p>
3246 <pre> foo
3247 </pre>
3248 <table>
3249 <tr>
3250 <td>foo
3251 </td></tr></table>
3252
3253 !!end
3254
3255 ## NOTE: the leading white-space chars on empty line are significant
3256 !! test
3257 5a. White-space in indent-pre
3258 !! wikitext
3259 a<br />
3260
3261 b
3262 !! html
3263 <pre>a<br />
3264
3265 b
3266 </pre>
3267 !! end
3268
3269 ## NOTE: the leading white-space chars on empty line are significant
3270 !! test
3271 5b. White-space in indent-pre
3272 !! wikitext
3273 a
3274
3275 b
3276
3277
3278 c
3279 !! html
3280 <pre>a
3281
3282 b
3283
3284
3285 c
3286 </pre>
3287 !! end
3288
3289 !! test
3290 5c. White-space in indent-pre
3291 !! wikitext
3292 ''a''
3293 ''b''
3294 ''c''
3295 !! html
3296 <pre><i>a</i>
3297 <i>b</i>
3298 <i>c</i>
3299 </pre>
3300 !! end
3301
3302 !! test
3303 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3304 !! wikitext
3305 a
3306
3307 <!-- continue -->
3308 b
3309
3310 c
3311
3312 d
3313 !! html
3314 <pre>a
3315
3316 b
3317 </pre>
3318 <pre>c
3319
3320 </pre>
3321 <p>d
3322 </p>
3323 !! end
3324
3325 !! test
3326 7a. Indent-pre and category links
3327 !! options
3328 parsoid=wt2html,wt2wt
3329 !! wikitext
3330 [[Category:foo]] <!-- No pre-wrapping -->
3331 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3332 !! html/php+tidy
3333 !! html/parsoid
3334 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3335 <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre&#x2D;wrapping -->
3336 !! end
3337
3338 ## We used to, but no longer wt2wt this test since the default serializer
3339 ## will normalize all categories to serialize on their own line.
3340 ## This wikitext usage is going to be fairly uncommon in production and
3341 ## selser will take care of preserving formatting in those scenarios.
3342 !! test
3343 7b. Indent-pre and category links
3344 !! options
3345 parsoid=wt2html
3346 !! wikitext
3347 [[Category:foo]] a
3348 [[Category:foo]] {{echo|b}}
3349 !! html/parsoid
3350 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3351 <link rel="mw:PageProp/Category" href="./Category:Foo"> <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b"}},"i":0}}]}'>b</span></pre>
3352 !! end
3353
3354 !! test
3355 Indent-Pre: Newlines in comments shouldn't affect sol state
3356 !! wikitext
3357 a <!--
3358 foo
3359 --> b
3360 !! html/php+tidy
3361 <p>a b</p>
3362 !! html/parsoid
3363 <p>a <!--
3364 foo
3365 --> b</p>
3366 !! end
3367
3368 ###
3369 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3370 ###
3371
3372 !!test
3373 HTML-pre: 1. embedded newlines
3374 !! wikitext
3375 <pre>foo</pre>
3376
3377 <pre>
3378 foo
3379 </pre>
3380
3381 <pre>
3382
3383 foo
3384 </pre>
3385
3386 <pre>
3387
3388
3389 foo
3390 </pre>
3391 !! html/php+tidy
3392 <pre>
3393 foo
3394 </pre>
3395 <pre>
3396 foo
3397 </pre>
3398 <pre>
3399
3400 foo
3401 </pre>
3402 <pre>
3403
3404
3405 foo
3406 </pre>
3407 !! html/parsoid
3408 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3409
3410 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3411 foo
3412 </pre>
3413
3414 <pre data-parsoid='{"stx":"html"}'>
3415
3416 foo
3417 </pre>
3418
3419 <pre data-parsoid='{"stx":"html"}'>
3420
3421
3422 foo
3423 </pre>
3424 !!end
3425
3426 !! test
3427 HTML-pre: big spaces
3428 !! wikitext
3429 <pre>
3430
3431
3432
3433
3434 haha
3435
3436
3437
3438
3439 haha
3440
3441
3442
3443
3444 </pre>
3445 !! html/php+tidy
3446 <pre>
3447
3448
3449
3450
3451 haha
3452
3453
3454
3455
3456 haha
3457
3458
3459
3460
3461 </pre>
3462 !! html/parsoid
3463 <pre data-parsoid='{"stx":"html"}'>
3464
3465
3466
3467
3468 haha
3469
3470
3471
3472
3473 haha
3474
3475
3476
3477
3478 </pre>
3479 !! end
3480
3481 !!test
3482 HTML-pre: 2: indented text
3483 !! wikitext
3484 <pre>
3485 foo
3486 </pre>
3487 !! html
3488 <pre>
3489 foo
3490 </pre>
3491
3492 !!end
3493
3494 !!test
3495 HTML-pre: 3: other wikitext
3496 !! wikitext
3497 <pre>
3498 * foo
3499 # bar
3500 = no-h =
3501 '' no-italic ''
3502 [[ NoLink ]]
3503 </pre>
3504 !! html/php
3505 <pre>
3506 * foo
3507 # bar
3508 = no-h =
3509 '' no-italic ''
3510 [[ NoLink ]]
3511 </pre>
3512
3513 !! html/parsoid
3514 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3515 # bar
3516 = no-h =
3517 '' no-italic ''
3518 [[ NoLink ]]
3519 </pre>
3520 !!end
3521
3522 ###
3523 ### Definition lists
3524 ###
3525 !! test
3526 Simple definition
3527 !! wikitext
3528 ; name : Definition
3529 !! html
3530 <dl><dt> name&#160;</dt>
3531 <dd> Definition</dd></dl>
3532
3533 !! end
3534
3535 !! test
3536 Definition list for indentation only
3537 !! wikitext
3538 : Indented text
3539 !! html
3540 <dl><dd> Indented text</dd></dl>
3541
3542 !! end
3543
3544 !! test
3545 Definition list with no space
3546 !! wikitext
3547 ;name:Definition
3548 !! html
3549 <dl><dt>name</dt>
3550 <dd>Definition</dd></dl>
3551
3552 !!end
3553
3554 !! test
3555 Definition list with URL link
3556 !! wikitext
3557 ; http://example.com/ : definition
3558 !! html
3559 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3560 <dd> definition</dd></dl>
3561
3562 !! end
3563
3564 !! test
3565 Definition list with bracketed URL link
3566 !! wikitext
3567 ;[http://www.example.com/ Example]:Something about it
3568 !! html
3569 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3570 <dd>Something about it</dd></dl>
3571
3572 !! end
3573
3574 !! test
3575 Definition list with wikilink containing colon
3576 !! wikitext
3577 ; [[Help:FAQ]]: The least-read page on Wikipedia
3578 !! html
3579 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt>
3580 <dd> The least-read page on Wikipedia</dd></dl>
3581
3582 !! end
3583
3584 # At Brion's and JeLuF's insistence... :)
3585 !! test
3586 Definition list with news link containing colon
3587 !! wikitext
3588 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3589 !! html/php
3590 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3591 <dd> This isn't even a real newsgroup!</dd></dl>
3592
3593 !! html/parsoid
3594 <dl><dt> <a rel="mw:ExtLink" href="news:alt.wikipedia.rox" data-parsoid='{"stx":"url"}'>news:alt.wikipedia.rox</a></dt><dd data-parsoid='{"stx":"row"}'> This isn't even a real newsgroup!</dd></dl>
3595 !! end
3596
3597 !! test
3598 Malformed definition list with colon
3599 !! wikitext
3600 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3601 !! html
3602 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop</dt></dl>
3603
3604 !! end
3605
3606 !! test
3607 Definition lists: colon in external link text
3608 !! wikitext
3609 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3610 !! html
3611 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3612 <dd> OK, I made that up</dd></dl>
3613
3614 !! end
3615
3616 !! test
3617 Definition lists: colon in HTML attribute
3618 !! wikitext
3619 ;<b style="display: inline">bold</b>
3620 !! html
3621 <dl><dt><b style="display: inline">bold</b></dt></dl>
3622
3623 !! end
3624
3625 !! test
3626 Definition lists: self-closed tag
3627 !! wikitext
3628 ;one<br/>two : two-line fun
3629 !! html
3630 <dl><dt>one<br />two&#160;</dt>
3631 <dd> two-line fun</dd></dl>
3632
3633 !! end
3634
3635 !! test
3636 Bug 11748: Literal closing tags
3637 !! wikitext
3638 <dl>
3639 <dt>test 1</dt>
3640 <dd>test test test test test</dd>
3641 <dt>test 2</dt>
3642 <dd>test test test test test</dd>
3643 </dl>
3644 !! html
3645 <dl>
3646 <dt>test 1</dt>
3647 <dd>test test test test test</dd>
3648 <dt>test 2</dt>
3649 <dd>test test test test test</dd>
3650 </dl>
3651
3652 !! end
3653
3654 !! test
3655 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3656 !! wikitext
3657 <ul><li>
3658 ; term : description
3659 * unordered
3660 </li></ul>
3661 !! html
3662 <ul><li>
3663 <dl><dt> term&#160;</dt>
3664 <dd> description</dd></dl>
3665 <ul><li> unordered</li></ul>
3666 </li></ul>
3667
3668 !! end
3669
3670 !! test
3671
3672 Definition list with empty definition and following paragraph
3673 !! wikitext
3674 ; term:
3675 Paragraph text
3676 !! html
3677 <dl><dt> term</dt>
3678 <dd></dd></dl>
3679 <p>Paragraph text
3680 </p>
3681 !! end
3682
3683 !! test
3684 Nested definition lists using html syntax
3685 !! wikitext
3686 <dl><dt>x</dt>
3687 <dd>a</dd>
3688 <dd>b</dd></dl>
3689
3690 !! end
3691
3692 !! test
3693 Definition Lists: No nesting: Multiple dd's
3694 !! wikitext
3695 ;x
3696 :a
3697 :b
3698 !! html
3699 <dl><dt>x</dt>
3700 <dd>a</dd>
3701 <dd>b</dd></dl>
3702
3703 !! end
3704
3705 !! test
3706 Definition Lists: Indentation: Regular
3707 !! wikitext
3708 :i1
3709 ::i2
3710 :::i3
3711 !! html
3712 <dl><dd>i1
3713 <dl><dd>i2
3714 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3715
3716 !! end
3717
3718 !! test
3719 Definition Lists: Indentation: Missing 1st level
3720 !! wikitext
3721 ::i2
3722 :::i3
3723 !! html
3724 <dl><dd><dl><dd>i2
3725 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3726
3727 !! end
3728
3729 !! test
3730 Definition Lists: Indentation: Multi-level indent
3731 !! wikitext
3732 :::i3
3733 !! html
3734 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3735
3736 !! end
3737
3738 !! test
3739 Definition Lists: Hacky use to indent tables
3740 !! wikitext
3741 ::{|
3742 |foo
3743 |bar
3744 |}
3745 this text
3746 should be left alone
3747 !! html
3748 <dl><dd><dl><dd><table>
3749 <tr>
3750 <td>foo
3751 </td>
3752 <td>bar
3753 </td></tr></table></dd></dl></dd></dl>
3754 <p>this text
3755 should be left alone
3756 </p>
3757 !! end
3758
3759 !! test
3760 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3761 !! wikitext
3762 <!-- foo -->
3763 ::{|
3764 |foo
3765 |bar
3766 |}<!-- bar -->
3767 this text
3768 should be left alone
3769 !! html/parsoid
3770 <!-- foo -->
3771 <dl><dd><dl><dd><table><tr>
3772 <td>foo</td>
3773 <td>bar</td>
3774 </tr></table><!-- bar --></dd></dl></dd></dl>
3775 <p>this text
3776 should be left alone</p>
3777 !! end
3778
3779 !! test
3780 Definition Lists: Hacky use to indent tables, with comment before table
3781 !! wikitext
3782 ::<!-- foo -->{|
3783 |foo
3784 |}
3785 !! html/parsoid
3786 <dl><dd><dl><dd><!-- foo --><table><tr>
3787 <td>foo</td>
3788 </tr></table></dd></dl></dd></dl>
3789 !! end
3790
3791 # The trailing whitespace in this test is to catch a regression in
3792 # Parsoid after T54473.
3793 !! test
3794 Definition Lists: Hacky use to indent tables (WS-insensitive)
3795 !! wikitext
3796 : {|
3797 |a
3798 |}
3799 !! html/php
3800 <dl><dd><table>
3801 <tr>
3802 <td>a
3803 </td></tr></table></dd></dl>
3804
3805 !! html/parsoid
3806 <dl><dd> <table>
3807 <tbody><tr><td>a</td></tr>
3808 </tbody></table> </dd></dl>
3809 !! end
3810
3811 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3812 ## as an empty dt item. It also ignores all but the last ";" when followed
3813 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3814 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3815 ## ";"s.
3816 ##
3817 ## Ex: ";;t2 ::d2" is transformed into:
3818 ##
3819 ## <dl>
3820 ## <dt>t2 </dt>
3821 ## <dd>
3822 ## <dl>
3823 ## <dt></dt>
3824 ## <dd>d2</dd>
3825 ## </dl>
3826 ## </dd>
3827 ## </dl>
3828 ##
3829 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3830 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3831 ##
3832 ## <dl>
3833 ## <dt>
3834 ## <dl>
3835 ## <dt>t2 </dt>
3836 ## <dd>:d2</dd>
3837 ## </dl>
3838 ## </dt>
3839 ## </dl>
3840 ##
3841 ## All Parsoid only definition list tests have this difference.
3842 ##
3843 ## See also: https://phabricator.wikimedia.org/T8569
3844 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3845
3846 !! test
3847 Table / list interaction: indented table with lists in table contents
3848 !! wikitext
3849 :{|
3850 |-
3851 | a
3852 * b
3853 |-
3854 | c
3855 * d
3856 |}
3857 !! html
3858 <dl><dd><table>
3859
3860 <tr>
3861 <td> a
3862 <ul><li> b</li></ul>
3863 </td></tr>
3864 <tr>
3865 <td> c
3866 <ul><li> d</li></ul>
3867 </td></tr></table></dd></dl>
3868
3869 !! end
3870
3871 !!test
3872 Table / list interaction: lists nested in tables nested in indented lists
3873 !! wikitext
3874 :{|
3875 |
3876 :a
3877 :b
3878 |
3879 *c
3880 *d
3881 |}
3882
3883 *e
3884 *f
3885 !! html
3886 <dl><dd><table>
3887 <tr>
3888 <td>
3889 <dl><dd>a</dd>
3890 <dd>b</dd></dl>
3891 </td>
3892 <td>
3893 <ul><li>c</li>
3894 <li>d</li></ul>
3895 </td></tr></table></dd></dl>
3896 <ul><li>e</li>
3897 <li>f</li></ul>
3898
3899 !!end
3900
3901 !! test
3902 Definition Lists: Nesting: Multi-level (Parsoid only)
3903 !! options
3904 parsoid
3905 !! wikitext
3906 ;t1 :d1
3907 ;;t2 ::d2
3908 ;;;t3 :::d3
3909 !! html
3910 <dl>
3911 <dt>t1 </dt>
3912 <dd>d1</dd>
3913 <dt>
3914 <dl>
3915 <dt>t2 </dt>
3916 <dd>:d2</dd>
3917 <dt>
3918 <dl>
3919 <dt>t3 </dt>
3920 <dd>::d3</dd>
3921 </dl>
3922 </dt>
3923 </dl>
3924 </dt>
3925 </dl>
3926
3927
3928 !! end
3929
3930
3931 !! test
3932 Definition Lists: Nesting: Test 2 (Parsoid only)
3933 !! wikitext
3934 ;t1
3935 ::d2
3936 !! html/php+tidy
3937 <dl>
3938 <dt>t1</dt>
3939 <dd>
3940 <dl>
3941 <dd>d2</dd>
3942 </dl>
3943 </dd>
3944 </dl>
3945 !! html/parsoid
3946 <dl>
3947 <dt>t1</dt>
3948 <dd>
3949 <dl>
3950 <dd>d2</dd>
3951 </dl>
3952 </dd>
3953 </dl>
3954
3955 !! end
3956
3957
3958 !! test
3959 Definition Lists: Nesting: Test 3 (Parsoid only)
3960 !! wikitext
3961 :;t1
3962 ::::d2
3963 !! html/php+tidy
3964 <dl>
3965 <dd>
3966 <dl>
3967 <dt>t1</dt>
3968 <dd>
3969 <dl>
3970 <dd>
3971 <dl>
3972 <dd>d2</dd>
3973 </dl>
3974 </dd>
3975 </dl>
3976 </dd>
3977 </dl>
3978 </dd>
3979 </dl>
3980 !! html/parsoid
3981 <dl>
3982 <dd>
3983 <dl>
3984 <dt>t1</dt>
3985 <dd>
3986 <dl>
3987 <dd>
3988 <dl>
3989 <dd>d2</dd>
3990 </dl>
3991 </dd>
3992 </dl>
3993 </dd>
3994 </dl>
3995 </dd>
3996 </dl>
3997
3998 !! end
3999
4000
4001 !! test
4002 Definition Lists: Nesting: Test 4
4003 !! wikitext
4004 ::;t3
4005 :::d3
4006 !! html
4007 <dl><dd><dl><dd><dl><dt>t3</dt>
4008 <dd>d3</dd></dl></dd></dl></dd></dl>
4009
4010 !! end
4011
4012
4013 ## The Parsoid team believes the following three test exposes a
4014 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4015 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4016 ## It also exposes a "misfeature" in tidy, which doesn't like
4017 ## <dl> tags with a single <dt> child; it converts the <dt> into
4018 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4019 !! test
4020 Definition Lists: Mixed Lists: Test 1
4021 !! wikitext
4022 :;* foo
4023 ::* bar
4024 :; baz
4025 !! html/php
4026 <dl><dd><dl><dt><ul><li> foo</li>
4027 <li> bar</li></ul></dt></dl>
4028 <dl><dt> baz</dt></dl></dd></dl>
4029
4030 !! html/php+tidy
4031 <dl>
4032 <dd>
4033 <dl>
4034 <dd>
4035 <ul>
4036 <li>foo</li>
4037 <li>bar</li>
4038 </ul>
4039 </dd>
4040 </dl>
4041 <dl>
4042 <dt>baz</dt>
4043 </dl>
4044 </dd>
4045 </dl>
4046 !! html/parsoid
4047 <dl>
4048 <dd><dl>
4049 <dt><ul>
4050 <li> foo
4051 </li>
4052 </ul></dt>
4053 <dd><ul>
4054 <li> bar
4055 </li>
4056 </ul></dd>
4057 <dt> baz</dt>
4058 </dl></dd>
4059 </dl>
4060 !! end
4061
4062 !! test
4063 Definition Lists: Mixed Lists: Test 2
4064 !! wikitext
4065 *: d1
4066 *: d2
4067 !! html
4068 <ul><li><dl><dd> d1</dd>
4069 <dd> d2</dd></dl></li></ul>
4070
4071 !! end
4072
4073
4074 !! test
4075 Definition Lists: Mixed Lists: Test 3
4076 !! wikitext
4077 *::: d1
4078 *::: d2
4079 !! html
4080 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4081 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4082
4083 !! end
4084
4085
4086 !! test
4087 Definition Lists: Mixed Lists: Test 4
4088 !! wikitext
4089 *;d1 :d2
4090 *;d3 :d4
4091 !! html
4092 <ul><li><dl><dt>d1&#160;</dt>
4093 <dd>d2</dd>
4094 <dt>d3&#160;</dt>
4095 <dd>d4</dd></dl></li></ul>
4096
4097 !! end
4098
4099
4100 !! test
4101 Definition Lists: Mixed Lists: Test 5
4102 !! wikitext
4103 *:d1
4104 *:: d2
4105 !! html
4106 <ul><li><dl><dd>d1
4107 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4108
4109 !! end
4110
4111
4112 !! test
4113 Definition Lists: Mixed Lists: Test 6
4114 !! wikitext
4115 #*:d1
4116 #*::: d3
4117 !! html
4118 <ol><li><ul><li><dl><dd>d1
4119 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4120
4121 !! end
4122
4123
4124 !! test
4125 Definition Lists: Mixed Lists: Test 7
4126 !! wikitext
4127 :* d1
4128 :* d2
4129 !! html
4130 <dl><dd><ul><li> d1</li>
4131 <li> d2</li></ul></dd></dl>
4132
4133 !! end
4134
4135
4136 !! test
4137 Definition Lists: Mixed Lists: Test 8
4138 !! wikitext
4139 :* d1
4140 ::* d2
4141 !! html
4142 <dl><dd><ul><li> d1</li></ul>
4143 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4144
4145 !! end
4146
4147
4148 !! test
4149 Definition Lists: Mixed Lists: Test 9
4150 !! wikitext
4151 *;foo :bar
4152 !! html
4153 <ul><li><dl><dt>foo&#160;</dt>
4154 <dd>bar</dd></dl></li></ul>
4155
4156 !! end
4157
4158
4159 !! test
4160 Definition Lists: Mixed Lists: Test 10
4161 !! wikitext
4162 *#;foo :bar
4163 !! html
4164 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4165 <dd>bar</dd></dl></li></ol></li></ul>
4166
4167 !! end
4168
4169 # The Parsoid team disagrees with the PHP parser's seemingly-random
4170 # rules regarding dd/dt on the next two tests. Parsoid is more
4171 # consistent, and recognizes the shared nesting and keeps the
4172 # still-open tags around until the nesting is complete.
4173 # (And tidy again converts <dt> to <dd> before 'bar'.)
4174
4175 !! test
4176 Definition Lists: Mixed Lists: Test 11
4177 !! wikitext
4178 *#*#;*;;foo :bar
4179 *#*#;boo :baz
4180 !! html/php
4181 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4182 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4183 <dl><dt>boo&#160;</dt>
4184 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4185
4186 !! html/php+tidy
4187 <ul>
4188 <li>
4189 <ol>
4190 <li>
4191 <ul>
4192 <li>
4193 <ol>
4194 <li>
4195 <dl>
4196 <dt>foo&#160;</dt>
4197 <dd>
4198 <ul>
4199 <li>
4200 <dl>
4201 <dd>
4202 <dl>
4203 <dt>bar</dt>
4204 </dl>
4205 </dd>
4206 </dl>
4207 </li>
4208 </ul>
4209 </dd>
4210 </dl>
4211 <dl>
4212 <dt>boo&#160;</dt>
4213 <dd>baz</dd>
4214 </dl>
4215 </li>
4216 </ol>
4217 </li>
4218 </ul>
4219 </li>
4220 </ol>
4221 </li>
4222 </ul>
4223 !! html/parsoid
4224 <ul>
4225 <li>
4226 <ol>
4227 <li>
4228 <ul>
4229 <li>
4230 <ol>
4231 <li>
4232 <dl>
4233 <dt>
4234 <ul>
4235 <li>
4236 <dl>
4237 <dt>
4238 <dl>
4239 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4240 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4241 </dl></dt>
4242 </dl></li>
4243 </ul></dt>
4244 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4245 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4246 </dl></li>
4247 </ol></li>
4248 </ul></li>
4249 </ol></li>
4250 </ul>
4251 !! end
4252
4253
4254 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4255 # From whitelist:
4256 # * The test is wrong, there are two colons where there should be :;
4257 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4258 !! test
4259 Definition Lists: Weird Ones: Test 1
4260 !! wikitext
4261 *#;*::;; foo : bar (who uses this?)
4262 !! html/php
4263 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4264 <dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)</dt></dl></dd></dl></dd></dl></dd></dl></li></ul></dd></dl></li></ol></li></ul>
4265
4266 !! html/php+tidy
4267 <ul>
4268 <li>
4269 <ol>
4270 <li>
4271 <dl>
4272 <dt>foo&#160;</dt>
4273 <dd>
4274 <ul>
4275 <li>
4276 <dl>
4277 <dd>
4278 <dl>
4279 <dd>
4280 <dl>
4281 <dd>
4282 <dl>
4283 <dt>bar (who uses this?)</dt>
4284 </dl>
4285 </dd>
4286 </dl>
4287 </dd>
4288 </dl>
4289 </dd>
4290 </dl>
4291 </li>
4292 </ul>
4293 </dd>
4294 </dl>
4295 </li>
4296 </ol>
4297 </li>
4298 </ul>
4299 !! html/parsoid
4300 <ul>
4301 <li>
4302 <ol>
4303 <li>
4304 <dl>
4305 <dt>
4306 <ul>
4307 <li>
4308 <dl>
4309 <dd>
4310 <dl>
4311 <dd>
4312 <dl>
4313 <dt>
4314 <dl>
4315 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4316 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4317 </dl></dt>
4318 </dl></dd>
4319 </dl></dd>
4320 </dl></li>
4321 </ul></dt>
4322 </dl></li>
4323 </ol></li>
4324 </ul>
4325 !! end
4326
4327 !! test
4328 Definition Lists: colons occurring in tags
4329 !! wikitext
4330 ;a:b
4331 ;'''a:b'''
4332 ;<i>a:b</i>
4333 ;<span>a:b</span>
4334 ;<div>a:b</div>
4335 ;<div>a
4336 :b</div>
4337 ;{{echo|a:b}}
4338 ;{{echo|''a:b''}}
4339 ;;;''a:b''
4340 !! html+tidy
4341 <dl>
4342 <dt>a</dt>
4343 <dd>b</dd>
4344 <dt><b>a:b</b></dt>
4345 <dt><i>a:b</i></dt>
4346 <dt><span>a:b</span></dt>
4347 <dd>
4348 <div>a:b</div>
4349 </dd>
4350 <dd>
4351 <div>a
4352 <dl>
4353 <dd>b</dd>
4354 </dl>
4355 </div>
4356 </dd>
4357 <dt>a</dt>
4358 <dd>b</dd>
4359 <dt><i>a:b</i></dt>
4360 </dl>
4361 <dl>
4362 <dd>
4363 <dl>
4364 <dd>
4365 <dl>
4366 <dt><i>a:b</i></dt>
4367 </dl>
4368 </dd>
4369 </dl>
4370 </dd>
4371 </dl>
4372 !! html/parsoid
4373 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4374 <dt><b>a:b</b></dt>
4375 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4376 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4377 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4378 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4379 <dd>b</dd>
4380 <dt><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a:b"}},"i":0}}]}'>a:b</span></dt>
4381 <dt><i about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;a:b&#39;&#39;"}},"i":0}}]}'>a:b</i>
4382 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4383 !! end
4384
4385 !! test
4386 Definition Lists: colons and tables 1
4387 !! wikitext
4388 :{|
4389 | x
4390 |}
4391 :{|
4392 | y
4393 |}
4394 !! html
4395 <dl><dd><table>
4396 <tr>
4397 <td> x
4398 </td></tr></table></dd></dl>
4399 <dl><dd><table>
4400 <tr>
4401 <td> y
4402 </td></tr></table></dd></dl>
4403
4404 !! end
4405
4406 # Parsoid's output (as documented below) differs from php's in this case.
4407 # This is probably a bug. If we fixup parsoid to match php's output, the
4408 # above test should pass and the below test case can be removed. It is
4409 # unclear which output is more desirable.
4410
4411 !! test
4412 Definition Lists: colons and tables 2
4413 !! wikitext
4414 :{|
4415 | x
4416 |}
4417 :{|
4418 | y
4419 |}
4420 !! html/parsoid
4421 <dl><dd><table>
4422 <tr>
4423 <td> x
4424 </td></tr></table></dd>
4425 <dd><table>
4426 <tr>
4427 <td> y
4428 </td></tr></table></dd></dl>
4429 !! end
4430
4431 !! test
4432 Definition Lists: template interaction
4433 !! wikitext
4434 ::{{definition_list}}
4435
4436 :one
4437 ::{{definition_list}}
4438 :::two
4439 :::three
4440 ::four
4441 !! html/parsoid
4442 <dl><dd><dl data-parsoid='{}'><dd about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[":",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}}]}'>one</dd><span about="#mwt1">
4443 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4444
4445 <dl><dd data-parsoid='{}'>one
4446 <dl><dd about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":["::",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}},"\n:::two\n:::three"]}'>one</dd><span about="#mwt2">
4447 </span><dd about="#mwt2">two
4448 <dl><dd>two</dd>
4449 <dd>three</dd></dl></dd>
4450 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4451 !! end
4452
4453
4454 ###
4455 ### External links
4456 ###
4457 !! test
4458 External links: non-bracketed
4459 !! wikitext
4460 Non-bracketed: http://example.com
4461 !! html
4462 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4463 </p>
4464 !! end
4465
4466 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4467 !! test
4468 External links: numbered
4469 !! wikitext
4470 Numbered: [http://example.com]
4471 Numbered: [http://example.net]
4472 Numbered: [http://example.com]
4473 !! html/php
4474 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4475 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4476 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4477 </p>
4478 !! html/parsoid
4479 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4480 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4481 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4482 !!end
4483
4484 !! test
4485 External links: specified text
4486 !! wikitext
4487 Specified text: [http://example.com link]
4488 !! html
4489 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4490 </p>
4491 !!end
4492
4493 !! test
4494 External links: trail
4495 !! wikitext
4496 Linktrails should not work for external links: [http://example.com link]s
4497 !! html
4498 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4499 </p>
4500 !! end
4501
4502 !! test
4503 External links: dollar sign in URL
4504 !! wikitext
4505 http://example.com/1$2345
4506 !! html
4507 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4508 </p>
4509 !! end
4510
4511 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4512 !! test
4513 External links: dollar sign in URL (autonumber)
4514 !! wikitext
4515 [http://example.com/1$2345]
4516 !! html/php
4517 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4518 </p>
4519 !! html/parsoid
4520 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4521 !!end
4522
4523 !! test
4524 External links: open square bracket forbidden in URL (bug 4377)
4525 !! options
4526 parsoid=wt2html,wt2wt,html2html
4527 !! wikitext
4528 http://example.com/1[2345
4529 !! html/php
4530 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4531 </p>
4532 !! html/parsoid
4533 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4534 !! end
4535
4536 !! test
4537 External links: open square bracket forbidden in URL (named) (bug 4377)
4538 !! options
4539 parsoid=wt2html,html2html
4540 !! wikitext
4541 [http://example.com/1[2345]
4542 !! html/php
4543 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4544 </p>
4545 !! html/parsoid
4546 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4547 !!end
4548
4549 # parsoid adds a space before the link name
4550 !! test
4551 External links: open square bracket forbidden in URL (named) (bug 4377)
4552 Parsoid variant.
4553 !! wikitext
4554 [http://example.com/1 [2345]
4555 !! html
4556 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4557 </p>
4558 !!end
4559
4560 !! test
4561 External links: nowiki in URL link text (bug 6230)
4562 !! wikitext
4563 [http://example.com/ <nowiki>''example site''</nowiki>]
4564 !! html
4565 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4566 </p>
4567 !! end
4568
4569 !! test
4570 External links: newline forbidden in text (bug 6230 regression check)
4571 !! wikitext
4572 [http://example.com/ first
4573 second]
4574 !! html
4575 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4576 second]
4577 </p>
4578 !!end
4579
4580 !! test
4581 External links: Pipe char between url and text
4582 !! wikitext
4583 [http://example.com | link]
4584 !! html
4585 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4586 </p>
4587 !!end
4588
4589 !! test
4590 External links: protocol-relative URL in brackets
4591 !! wikitext
4592 [//example.com/ Test]
4593 !! html
4594 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4595 </p>
4596 !! end
4597
4598 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4599 !! test
4600 External links: protocol-relative URL in brackets without text
4601 !! wikitext
4602 [//example.com]
4603 !! html/php
4604 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4605 </p>
4606 !! html/parsoid
4607 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4608 !! end
4609
4610 !! test
4611 External links: protocol-relative URL in free text is left alone
4612 !! wikitext
4613 //example.com/Foo
4614 !! html
4615 <p>//example.com/Foo
4616 </p>
4617 !!end
4618
4619 !! test
4620 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4621 !! wikitext
4622 foo//example.com/Foo
4623 !! html
4624 <p>foo//example.com/Foo
4625 </p>
4626 !! end
4627
4628 !! test
4629 External links: with no contents
4630 !! wikitext
4631 [http://en.wikipedia.org/wiki/Foo]
4632
4633 [[wikipedia:Foo|Bar]]
4634
4635 [[wikipedia:Foo|<span>Bar</span>]]
4636 !! html/php
4637 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4638 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4639 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4640 </p>
4641 !! html/parsoid
4642 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4643 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4644 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4645 !! end
4646
4647 !! test
4648 External links: Free with trailing punctuation
4649 !! wikitext
4650 http://example.com,
4651 http://example.com;
4652 http://example.com\
4653 http://example.com.
4654 http://example.com:
4655 http://example.com!
4656 http://example.com?
4657 http://example.com)
4658 http://example.com/url_with_(brackets)
4659 (http://example.com/url_without_brackets)
4660 http://example.com/url_with_entity&amp;
4661 http://example.com/url_with_entity&#x26;
4662 http://example.com/url_with_entity&#038;
4663 http://example.com/url_with_entity&nbsp;
4664 http://example.com/url_with_entity&#xA0;
4665 http://example.com/url_with_entity&#160;
4666 http://example.com/url_with_entity&lt;
4667 http://example.com/url_with_entity&#x3C;
4668 http://example.com/url_with_entity&#60;
4669 !! html/php
4670 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4671 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4672 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4673 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4674 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4675 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4676 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4677 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4678 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4679 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4680 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4681 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4682 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4683 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4684 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4685 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4686 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4687 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4688 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4689 </p>
4690 !! html/parsoid
4691 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4692 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4693 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4694 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4695 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4696 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4697 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4698 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4699 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4700 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4701 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4702 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4703 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4704 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>
4705 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>
4706 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>
4707 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>
4708 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x3C;","srcContent":"&lt;"}'>&lt;</span>
4709 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#60;","srcContent":"&lt;"}'>&lt;</span></p>
4710 !! end
4711
4712 !! test
4713 External links: tricky Parsoid html2html case
4714 !! options
4715 parsoid=wt2html,wt2wt,html2html
4716 !! wikitext
4717 http://example.com/url_with_entity&amp;amp;
4718 !! html/php
4719 <p><a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;
4720 </p>
4721 !! html/parsoid
4722 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4723 !! end
4724
4725 !! test
4726 External links: Free with trailing quotes (T113666)
4727 !! wikitext
4728 '''News:''' Stuff here
4729
4730 news:'a'b''c''d e
4731 !! html/php
4732 <p><b>News:</b> Stuff here
4733 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4734 </p>
4735 !! html/parsoid
4736 <p><b>News:</b> Stuff here</p>
4737 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4738 !! end
4739
4740 !! test
4741 External links: Lone protocols are never linked (T105697)
4742 !! wikitext
4743 http://
4744 http://;
4745 (http://)
4746 bitcoin:
4747 bitcoin:;
4748 (bitcoin:)
4749 !! html
4750 <p>http://
4751 http://;
4752 (http://)
4753 bitcoin:
4754 bitcoin:;
4755 (bitcoin:)
4756 </p>
4757 !! end
4758
4759 !! test
4760 External links: No preceding word characters allowed (bug 65278)
4761 !! wikitext
4762 NOPEhttp://example.com
4763 N0http://example.com
4764 ok:http://example.com
4765 ok-http://example.com
4766 !! html
4767 <p>NOPEhttp://example.com
4768 N0http://example.com
4769 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4770 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4771 </p>
4772 !! end
4773
4774 !! test
4775 External image
4776 !! wikitext
4777 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4778 !! html
4779 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4780 </p>
4781 !! end
4782
4783 !! test
4784 External image from https
4785 !! wikitext
4786 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4787 !! html
4788 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4789 </p>
4790 !! end
4791
4792 !! test
4793 External image (when not allowed)
4794 !! options
4795 wgAllowExternalImages=0
4796 !! wikitext
4797 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4798 !! html
4799 <p>External image: <a rel="nofollow" class="external free" href="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png">http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png</a>
4800 </p>
4801 !! end
4802
4803 !! test
4804 Link to non-http image, no img tag
4805 !! wikitext
4806 Link to non-http image, no img tag: ftp://example.com/test.jpg
4807 !! html
4808 <p>Link to non-http image, no img tag: <a rel="nofollow" class="external free" href="ftp://example.com/test.jpg">ftp://example.com/test.jpg</a>
4809 </p>
4810 !! end
4811
4812 !! test
4813 External links: terminating separator
4814 !! wikitext
4815 Terminating separator: http://example.com/thing,
4816 !! html
4817 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4818 </p>
4819 !! end
4820
4821 !! test
4822 External links: intervening separator
4823 !! wikitext
4824 Intervening separator: http://example.com/1,2,3
4825 !! html
4826 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4827 </p>
4828 !! end
4829
4830 !! test
4831 External links: old bug with URL in query
4832 !! wikitext
4833 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4834 !! html
4835 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4836 </p>
4837 !! end
4838
4839 !! test
4840 External links: old URL-in-URL bug, mixed protocols
4841 !! wikitext
4842 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4843 !! html
4844 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4845 </p>
4846 !!end
4847
4848 !! test
4849 External links: URL in text
4850 !! wikitext
4851 URL in text: [http://example.com http://example.com]
4852 !! html
4853 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4854 </p>
4855 !! end
4856
4857 !! test
4858 External links: Clickable images
4859 !! wikitext
4860 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4861 !! html/php
4862 <p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/></a>
4863 </p>
4864 !! html/parsoid
4865 <p>ja-style clickable images: <a rel="mw:ExtLink" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" data-parsoid='{"type":"extlink"}'/></a></p>
4866 !! end
4867
4868 !! test
4869 External links: raw ampersand
4870 !! wikitext
4871 Old &amp; use: http://x&y
4872 !! html
4873 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4874 </p>
4875 !! end
4876
4877 !! test
4878 External links: encoded ampersand
4879 !! wikitext
4880 Old &amp; use: http://x&amp;y
4881 !! html/php
4882 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4883 </p>
4884 !! html/parsoid
4885 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4886 !! end
4887
4888 !! test
4889 External links: encoded equals (bug 6102)
4890 !! wikitext
4891 http://example.com/?foo&#61;bar
4892 !! html/php
4893 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4894 </p>
4895 !! html/parsoid
4896 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4897 !! end
4898
4899 ##
4900 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4901 ## does it number them. As discussed in bug 53505, we can identify
4902 ## autonumbered links via CSS.
4903 ##
4904
4905 !! test
4906 External links: [raw ampersand]
4907 !! wikitext
4908 Old &amp; use: [http://x&y]
4909 !! html/php
4910 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4911 </p>
4912 !! html/parsoid
4913 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4914 !! end
4915
4916 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4917 # mode will return the [raw ampersand] wikitext
4918 !! test
4919 External links: [encoded ampersand]
4920 !! options
4921 parsoid=wt2html,wt2wt,html2html
4922 !! wikitext
4923 Old &amp; use: [http://x&amp;y]
4924 !! html/php
4925 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4926 </p>
4927 !! html/parsoid
4928 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4929 !! end
4930
4931 !! test
4932 External links: [raw equals]
4933 !! wikitext
4934 [http://example.com/?foo=bar]
4935 !! html/php
4936 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4937 </p>
4938 !! html/parsoid
4939 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4940 !! end
4941
4942 # note that parsoid html is identical to [raw equals] case; so html2wt
4943 # mode will return the [raw equals] wikitext
4944 !! test
4945 External links: [encoded equals] (bug 6102)
4946 !! options
4947 parsoid=wt2html,wt2wt,html2html
4948 !! wikitext
4949 [http://example.com/?foo&#61;bar]
4950 !! html/php
4951 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4952 </p>
4953 !! html/parsoid
4954 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4955 !! end
4956
4957 # xxx parsoid strips the IDN character, so the round-trip tests will
4958 # obviously fail and are disabled. --cscott
4959 !! test
4960 External links: [IDN ignored character reference in hostname; strip it right off]
4961 !! options
4962 parsoid=wt2html,wt2wt,html2html
4963 !! wikitext
4964 [http://e&zwnj;xample.com/]
4965 !! html/php
4966 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4967 </p>
4968 !! html/parsoid
4969 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4970 !! end
4971
4972 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4973 # Where an external link could easily circumvent the sanitization of the text of
4974 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4975 # test demands a higher standard. That's a bit strange.
4976 #
4977 # Example:
4978 #
4979 # http://e‌xample.com -> [http://example.com|http://example.com]
4980 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4981 #
4982 # The first example is sanitized, but the second is not. Any security benefits
4983 # from this production are trivial to circumvent. Either remove this test and
4984 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4985 # the test accordingly.
4986 #
4987 # All our love,
4988 # The Parsoid team.
4989 # xxx parsoid strips the IDN character, so the round-trip tests will
4990 # obviously fail and are disabled. --cscott
4991 !! test
4992 External links: IDN ignored character reference in hostname; strip it right off
4993 !! options
4994 parsoid=wt2html,html2html
4995 !! wikitext
4996 http://e&zwnj;xample.com/
4997 !! html/php
4998 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4999 </p>
5000 !! html/parsoid
5001 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
5002 !! end
5003
5004 !! test
5005 External links: www.jpeg.org (bug 554)
5006 !! wikitext
5007 http://www.jpeg.org
5008 !! html
5009 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5010 </p>
5011 !! end
5012
5013 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
5014 !! test
5015 External links: URL within URL (original bug 2)
5016 !! wikitext
5017 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5018 !! html/php
5019 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5020 </p>
5021 !! html/parsoid
5022 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5023 !! end
5024
5025 !! test
5026 BUG 361: URL inside bracketed URL
5027 !! wikitext
5028 [http://www.example.com/foo http://www.example.com/bar]
5029 !! html
5030 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5031 </p>
5032 !! end
5033
5034 !! test
5035 BUG 361: URL within URL, not bracketed
5036 !! wikitext
5037 http://www.example.com/foo?=http://www.example.com/bar
5038 !! html
5039 <p><a rel="nofollow" class="external free" href="http://www.example.com/foo?=http://www.example.com/bar">http://www.example.com/foo?=http://www.example.com/bar</a>
5040 </p>
5041 !! end
5042
5043 !! test
5044 BUG 289: ">"-token in URL-tail
5045 !! wikitext
5046 http://www.example.com/<hello>
5047 !! html
5048 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5049 </p>
5050 !!end
5051
5052 !! test
5053 BUG 289: literal ">"-token in URL-tail
5054 !! wikitext
5055 http://www.example.com/<b>html</b>
5056 !! html/php
5057 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5058 </p>
5059 !! html/parsoid
5060 <p><a rel="mw:ExtLink" href="http://www.example.com/" data-parsoid='{"stx":"url"}'>http://www.example.com/</a><b data-parsoid='{"stx":"html"}'>html</b></p>
5061 !! end
5062
5063 !! test
5064 BUG 289: ">"-token in bracketed URL
5065 !! wikitext
5066 [http://www.example.com/<hello> stuff]
5067 !! html
5068 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5069 </p>
5070 !!end
5071
5072 !! test
5073 BUG 289: literal ">"-token in bracketed URL
5074 !! wikitext
5075 [http://www.example.com/<b>html</b> stuff]
5076 !! html
5077 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5078 </p>
5079 !!end
5080
5081 !! test
5082 BUG 289: literal double quote at end of URL
5083 !! wikitext
5084 http://www.example.com/"hello"
5085 !! html
5086 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5087 </p>
5088 !!end
5089
5090 !! test
5091 BUG 289: literal double quote in bracketed URL
5092 !! wikitext
5093 [http://www.example.com/"hello" stuff]
5094 !! html
5095 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5096 </p>
5097 !!end
5098
5099 !! test
5100 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5101 !! wikitext
5102 [http://www.example.com test]
5103 !! html
5104 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5105 </p>
5106 !! end
5107
5108 !! test
5109 External links: link text with spaces
5110 !! wikitext
5111 [http://www.example.com a b c]
5112 [http://www.example.com ''a'' ''b'']
5113 !! html
5114 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5115 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5116 </p>
5117 !! end
5118
5119 !! test
5120 External links: wiki links within external link (Bug 3695)
5121 !! options
5122 parsoid=wt2html,html2html
5123 !! wikitext
5124 [http://example.com [[wikilink]] embedded in ext link]
5125 !! html/php
5126 <p><a rel="nofollow" class="external text" href="http://example.com"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
5127 </p>
5128 !! html/parsoid
5129 <p><a rel="mw:ExtLink" href="http://example.com"></a><a rel="mw:WikiLink" href="./Wikilink" title="Wikilink">wikilink</a><span> embedded in ext link</span></p>
5130 !! end
5131
5132 !! test
5133 BUG 787: Links with one slash after the url protocol are invalid
5134 !! wikitext
5135 http:/example.com
5136
5137 [http:/example.com title]
5138 !! html
5139 <p>http:/example.com
5140 </p><p>[http:/example.com title]
5141 </p>
5142 !! end
5143
5144 !! test
5145 Bracketed external links with template-generated invalid target
5146 !! wikitext
5147 [{{echo|http:/example.com}} title]
5148 !! html
5149 <p>[http:/example.com title]
5150 </p>
5151 !! end
5152
5153 !! test
5154 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5155 !! wikitext
5156 ''[http://example.com text'']
5157 [http://example.com '''text]'''
5158 ''Something [http://example.com in italic'']
5159 ''Something [http://example.com mixed''''', even bold]'''
5160 '''''Now [http://example.com both''''']
5161 !! html
5162 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5163 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5164 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5165 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5166 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5167 </p>
5168 !! end
5169
5170
5171 !! test
5172 Bug 4781: %26 in URL
5173 !! wikitext
5174 http://www.example.com/?title=AT%26T
5175 !! html/php
5176 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5177 </p>
5178 !! html/parsoid
5179 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5180 !! end
5181
5182 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5183 # % is actually legal in HTML5. Any change in output would need testing though.
5184 !! test
5185 Bug 4781, 5267: %25 in URL
5186 !! wikitext
5187 http://www.example.com/?title=100%25_Bran
5188 !! html/php
5189 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a>
5190 </p>
5191 !! html/parsoid
5192 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5193 !! end
5194
5195 !! test
5196 Bug 4781, 5267: %28, %29 in URL
5197 !! wikitext
5198 http://www.example.com/?title=Ben-Hur_%281959_film%29
5199 !! html/php
5200 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
5201 </p>
5202 !! html/parsoid
5203 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a></p>
5204 !! end
5205
5206
5207 !! test
5208 Bug 4781: %26 in autonumber URL
5209 !! wikitext
5210 [http://www.example.com/?title=AT%26T]
5211 !! html/php
5212 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5213 </p>
5214 !! html/parsoid
5215 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5216 !! end
5217
5218 !! test
5219 Bug 4781, 5267: %26 in autonumber URL
5220 !! wikitext
5221 [http://www.example.com/?title=100%25_Bran]
5222 !! html/php
5223 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5224 </p>
5225 !! html/parsoid
5226 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5227 !! end
5228
5229 !! test
5230 Bug 4781, 5267: %28, %29 in autonumber URL
5231 !! wikitext
5232 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5233 !! html/php
5234 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5235 </p>
5236 !! html/parsoid
5237 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5238 !! end
5239
5240
5241 !! test
5242 Bug 4781: %26 in bracketed URL
5243 !! wikitext
5244 [http://www.example.com/?title=AT%26T link]
5245 !! html/php
5246 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5247 </p>
5248 !! html/parsoid
5249 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5250 !! end
5251
5252 !! test
5253 Bug 4781, 5267: %25 in bracketed URL
5254 !! wikitext
5255 [http://www.example.com/?title=100%25_Bran link]
5256 !! html
5257 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5258 </p>
5259 !! end
5260
5261 !! test
5262 Bug 4781, 5267: %28, %29 in bracketed URL
5263 !! wikitext
5264 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5265 !! html/php
5266 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5267 </p>
5268 !! html/parsoid
5269 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5270 !! end
5271
5272 !! test
5273 External link containing a period in the anchor. (bug 63947)
5274 !! wikitext
5275 [//foo.org/bar#baz. bang]
5276
5277 [//foo.org/bar. bang]
5278 !! html/php
5279 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5280 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5281 </p>
5282 !! html/parsoid
5283 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5284 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5285 !! end
5286
5287 !! test
5288 External link containing a single quote. (bug 63947)
5289 !! wikitext
5290 [//foo.org/bar'baz]
5291
5292 [//foo.org/bar'baz bang]
5293 !! html/php
5294 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5295 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5296 </p>
5297 !! html/parsoid
5298 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5299 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5300 !! end
5301
5302 !! test
5303 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5304 !! wikitext
5305 Some [http://example.com/ pretty ''italics'' and stuff]!
5306 !! html
5307 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5308 </p>
5309 !! end
5310
5311 !! test
5312 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5313 !! wikitext
5314 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5315 !! html
5316 <p><i>Some </i><a rel="nofollow" class="external text" href="http://example.com/"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
5317 </p>
5318 !! end
5319
5320 !! test
5321 External link containing double-single-quotes with no space separating the url from text in italics
5322 !! wikitext
5323 [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
5324 !! html/php
5325 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</a>
5326 </p>
5327 !! html/php+tidy
5328 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de</a> <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</p>
5329 !! html/parsoid
5330 <p><a rel="mw:ExtLink" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de </a><a rel="mw:WikiLink" href="./Museo_Picasso_(París)" title="Museo Picasso (París)">Museo Picasso</a><span>.</span></p>
5331 !! end
5332
5333 !! test
5334 External link with comments in link text
5335 !! wikitext
5336 [http://www.google.com Google <!-- comment -->]
5337 !! html/php
5338 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5339 </p>
5340 !! html/parsoid
5341 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5342 !! end
5343
5344 !! test
5345 External link to bare IPv4 address
5346 !! wikitext
5347 [http://192.168.0.1 Link]
5348 !! html/php
5349 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5350 </p>
5351 !! html/parsoid
5352 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5353 !! end
5354
5355 !! test
5356 URL-encoding in URL functions (single parameter)
5357 !! wikitext
5358 {{localurl:Some page|amp=&}}
5359 !! html
5360 <p>/index.php?title=Some_page&amp;amp=&amp;
5361 </p>
5362 !! end
5363
5364 !! test
5365 URL-encoding in URL functions (multiple parameters)
5366 !! wikitext
5367 {{localurl:Some page|q=?&amp=&}}
5368 !! html
5369 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5370 </p>
5371 !! end
5372
5373 !! test
5374 Brackets in urls
5375 !! wikitext
5376 http://example.com/index.php?foozoid%5B%5D=bar
5377
5378 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5379 !! html/php
5380 <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
5381 </p><p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
5382 </p>
5383 !! html/parsoid
5384 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a></p>
5385
5386 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5387 !! end
5388
5389 !! test
5390 IPv6 urls, autolink format (T23261)
5391 !! wikitext
5392 http://[2404:130:0:1000::187:2]/index.php
5393
5394 Examples from RFC 2373, section 2.2:
5395 * http://[1080::8:800:200C:417A]/unicast
5396 * http://[FF01::101]/multicast
5397 * http://[::1]/loopback
5398 * http://[::]/unspecified
5399 * http://[::13.1.68.3]/ipv4compat
5400 * http://[::FFFF:129.144.52.38]/ipv4compat
5401
5402 Examples from RFC 2732, section 2:
5403 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5404 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5405 * http://[3ffe:2a00:100:7031::1]
5406 * http://[1080::8:800:200C:417A]/foo
5407 * http://[::192.9.5.5]/ipng
5408 * http://[::FFFF:129.144.52.38]:80/index.html
5409 * http://[2010:836B:4179::836B:4179]
5410
5411 !! html/php
5412 <p><a rel="nofollow" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a>
5413 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5414 </p>
5415 <ul><li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5416 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5417 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5418 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5419 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5420 <li> <a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5421 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5422 </p>
5423 <ul><li> <a rel="nofollow" class="external free" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5424 <li> <a rel="nofollow" class="external free" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5425 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5426 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5427 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5428 <li> <a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5429 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5430
5431 !! html/parsoid
5432 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a></p>
5433
5434 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5435 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5436 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5437 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5438 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5439 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5440 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5441
5442 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5443 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
5444 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
5445 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5446 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5447 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5448 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
5449 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5450 !! end
5451
5452 !! test
5453 IPv6 urls, bracketed format (T23261)
5454 !! wikitext
5455 [http://[2404:130:0:1000::187:2]/index.php test]
5456
5457 Examples from RFC 2373, section 2.2:
5458 * [http://[1080::8:800:200C:417A] unicast]
5459 * [http://[FF01::101] multicast]
5460 * [http://[::1]/ loopback]
5461 * [http://[::] unspecified]
5462 * [http://[::13.1.68.3] ipv4compat]
5463 * [http://[::FFFF:129.144.52.38] ipv4compat]
5464
5465 Examples from RFC 2732, section 2:
5466 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5467 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5468 * [http://[3ffe:2a00:100:7031::1] 3]
5469 * [http://[1080::8:800:200C:417A]/foo 4]
5470 * [http://[::192.9.5.5]/ipng 5]
5471 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5472 * [http://[2010:836B:4179::836B:4179] 7]
5473
5474 !! html/php
5475 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5476 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5477 </p>
5478 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5479 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5480 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5481 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5482 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5483 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5484 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5485 </p>
5486 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5487 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5488 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5489 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5490 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5491 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5492 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5493
5494 !! html/parsoid
5495 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5496
5497 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5498 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5499 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5500 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5501 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5502 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5503 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5504
5505 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5506 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5507 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5508 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5509 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5510 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5511 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5512 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5513 !! end
5514
5515 !! test
5516 Non-extlinks in brackets
5517 !! wikitext
5518 [foo]
5519 [foo bar]
5520 [foo ''bar'']
5521 [fool's] errand
5522 [fool's errand]
5523 [{{echo|foo}}]
5524 [{{echo|foo}} bar]
5525 [{{echo|foo}} ''bar'']
5526 [{{echo|foo}}l's] errand
5527 [{{echo|foo}}l's errand]
5528 [url={{echo|foo}}]
5529 [url=http://example.com]
5530 [http:// bare protocols don't count]
5531 !! html/php
5532 <p>[foo]
5533 [foo bar]
5534 [foo <i>bar</i>]
5535 [fool's] errand
5536 [fool's errand]
5537 [foo]
5538 [foo bar]
5539 [foo <i>bar</i>]
5540 [fool's] errand
5541 [fool's errand]
5542 [url=foo]
5543 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5544 [http:// bare protocols don't count]
5545 </p>
5546 !! html/parsoid
5547 <p>[foo]
5548 [foo bar]
5549 [foo <i>bar</i>]
5550 [fool's] errand
5551 [fool's errand]
5552 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5553 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5554 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5555 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5556 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5557 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5558 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5559 [http:// bare protocols don't count]</p>
5560 !! end
5561
5562 !! test
5563 Percent encoding in external links
5564 !! wikitext
5565 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5566 !! html/php
5567 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5568 </p>
5569 !! html/parsoid
5570 <p><a rel="mw:ExtLink"
5571 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5572 !! end
5573
5574 !! test
5575 Use url link syntax for links where the content is equal the link target
5576 !! wikitext
5577 http://example.com
5578 !! html/php
5579 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5580 </p>
5581 !! html/parsoid
5582 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5583 !! end
5584
5585 !! test
5586 Parenthesis in external links, especially URL links
5587 !! wikitext
5588 http://example.com)
5589
5590 http://example.com/test)
5591
5592 http://example.com/(test)
5593
5594 http://example.com/((test)
5595
5596 (http://example.com/(test))
5597
5598 (http://example.com/(test)))))
5599
5600 http://example.com/a)b
5601
5602 [http://example.com) foo]
5603 !! html/php
5604 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5605 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5606 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5607 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5608 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5609 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5610 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5611 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5612 </p>
5613 !! html/parsoid
5614 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5615 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5616 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5617 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5618 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5619 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5620 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5621 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5622 !! end
5623
5624 !! test
5625 Parenthesis in external links, w/ transclusion or comment
5626 !! wikitext
5627 (http://example.com/{{echo|hi}})
5628
5629 (http://example.com<!-- hi -->)
5630 !! html/php
5631 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5632 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5633 </p>
5634 !! html/parsoid
5635 <p>(<a typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;}]],&amp;quot;dsr&amp;quot;:[20,31,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;hi&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
5636
5637 <p>(<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url","a":{"href":"http://example.com"},"sa":{"href":"http://example.com&lt;!-- hi -->"}}'>http://example.com</a>)</p>
5638 !! end
5639
5640 !! test
5641 Serialize <a> tags with invalid link targets as plain text
5642 !! options
5643 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5644 !! html/parsoid
5645 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5646 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5647 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5648 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5649 !! wikitext
5650 text
5651 <nowiki>*</nowiki>text
5652 <nowiki>[[foo]]</nowiki>
5653 <nowiki>*a [[foo]]</nowiki>
5654 !! end
5655
5656 !! test
5657 mw:ExtLink -vs- mw:WikiLink (T94723)
5658 !! options
5659 parsoid=html2wt
5660 !! html/parsoid
5661 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"},"dsr":[0,11,6,2]}'>Bar</a>
5662 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5663 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5664 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5665 <p>
5666 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5667 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5668 </p>
5669 !! wikitext
5670 [[Foo|Bar]]
5671 [[Foo|Bar]]
5672 [[wikipedia:Foo|Bar]]
5673 [[wikipedia:Foo|Bar]]
5674
5675 [[wikipedia:European_Robin|European Robin]]
5676 [[wikipedia:European_Robin|European Robin]]
5677 !! end
5678
5679 !! test
5680 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5681 !! options
5682 parsoid=wt2wt
5683 !! wikitext
5684 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5685 !! html/parsoid
5686 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5687 !! end
5688
5689
5690 ###
5691 ### Quotes
5692 ###
5693
5694 !! test
5695 Quotes
5696 !! wikitext
5697 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5698
5699 Normal text. '''''Bold italic text.''''' Normal text.
5700 !! html
5701 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5702 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5703 </p>
5704 !! end
5705
5706
5707 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5708 # parser strips. The wikitext contains just the first half of the bold
5709 # quote pair.
5710 !! test
5711 Unclosed and unmatched quotes
5712 !! wikitext
5713 '''''Bold italic text '''with bold deactivated''' in between.'''''
5714
5715 '''''Bold italic text ''with italic deactivated'' in between.'''''
5716
5717 '''Bold text..
5718
5719 ..spanning two paragraphs (should not work).'''
5720
5721 '''Bold tag left open
5722
5723 ''Italic tag left open
5724
5725 Normal text.
5726
5727 <!-- Unmatching number of opening, closing tags: -->
5728 '''This year''''s election ''should'' beat '''last year''''s.
5729
5730 ''Tom'''s car is bigger than ''Susan'''s.
5731
5732 Plain ''italic'''s plain
5733 !! html/php
5734 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5735 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5736 </p><p><b>Bold text..</b>
5737 </p><p>..spanning two paragraphs (should not work).
5738 </p><p><b>Bold tag left open</b>
5739 </p><p><i>Italic tag left open</i>
5740 </p><p>Normal text.
5741 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5742 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5743 </p><p>Plain <i>italic'</i>s plain
5744 </p>
5745 !! html/parsoid
5746 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5747 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5748 </p><p><b>Bold text..</b>
5749 </p><p>..spanning two paragraphs (should not work).<b></b>
5750 </p><p><b>Bold tag left open</b>
5751 </p><p><i>Italic tag left open</i>
5752 </p><p>Normal text.
5753 </p>
5754 <!-- Unmatching number of opening, closing tags: -->
5755 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5756 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5757 </p><p>Plain <i>italic'</i>s plain
5758 </p>
5759 !! end
5760
5761 ###
5762 ### Tables
5763 ###
5764 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5765 ###
5766
5767 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5768 # is the bare minimum required by the spec, see:
5769 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5770 # Parsoid team replies: empty table tags are legal in HTML5
5771 !! test
5772 A table with no data.
5773 !! options
5774 parsoid=wt2html
5775 !! wikitext
5776 {||}
5777 !! html/php
5778
5779 !! html/parsoid
5780 <table></table>
5781
5782 !! end
5783
5784 !! test
5785 A table with stray table end tags on start tag line (wt2html)
5786 !! options
5787 parsoid=wt2html
5788 !! wikitext
5789 {|style="color: red;"|}
5790
5791 {|style="color: red;" |}
5792 |foo
5793 |}
5794
5795 {|style="color: red;"|} id="foo"
5796 |foo
5797 |}
5798
5799 {|style="color: red;" |} id="foo"
5800 |foo
5801 |}
5802 !! html
5803 <table style="color: red;"></table>
5804
5805 <table style="color: red;">
5806 <tbody><tr>
5807 <td>foo</td>
5808 </tr></tbody>
5809 </table>
5810
5811 <table style="color: red;" id="foo">
5812 <tbody><tr>
5813 <td>foo</td>
5814 </tr></tbody>
5815 </table>
5816
5817 <table style="color: red;" id="foo">
5818 <tbody><tr>
5819 <td>foo</td>
5820 </tr></tbody>
5821 </table>
5822
5823 !! end
5824
5825 !! test
5826 A table with no data (take 2)
5827 !! wikitext
5828 {|
5829 |}
5830 !! html/parsoid
5831 <table></table>
5832 !! end
5833
5834 # A table with nothing but a caption is invalid XHTML, we might want to render
5835 # this as <p>caption</p>
5836 # Parsoid team replies: table with only a caption is legal in HTML5
5837 !! test
5838 A table with nothing but a caption
5839 !! wikitext
5840 {|
5841 |+ caption
5842 |}
5843 !! html/php
5844 <table>
5845 <caption> caption
5846 </caption><tr><td></td></tr></table>
5847
5848 !! html/parsoid
5849 <table><caption> caption</caption></table>
5850 !! end
5851
5852 !! test
5853 A table with caption with default-spaced attributes and a table row
5854 !! wikitext
5855 {|
5856 |+ style="color: red;" | caption1
5857 |-
5858 | foo
5859 |}
5860 !! html
5861 <table>
5862 <caption style="color: red;"> caption1
5863 </caption>
5864 <tr>
5865 <td> foo
5866 </td></tr></table>
5867
5868 !! end
5869
5870 !! test
5871 A table with captions with non-default spaced attributes and a table row
5872 !! wikitext
5873 {|
5874 |+style="color: red;"|caption2
5875 |+ style="color: red;"| caption3
5876 |-
5877 | foo
5878 |}
5879 !! html
5880 <table>
5881 <caption style="color: red;">caption2
5882 </caption>
5883 <caption style="color: red;"> caption3
5884 </caption>
5885 <tr>
5886 <td> foo
5887 </td></tr></table>
5888
5889 !! end
5890
5891 !! test
5892 Table td-cell syntax variations
5893 !! wikitext
5894 {|
5895 | foo bar foo | baz
5896 | foo bar foo || baz
5897 | style='color:red;' | baz
5898 | style='color:red;' || baz
5899 |}
5900 !! html
5901 <table>
5902 <tr>
5903 <td> baz
5904 </td>
5905 <td> foo bar foo </td>
5906 <td> baz
5907 </td>
5908 <td style="color:red;"> baz
5909 </td>
5910 <td> style='color:red;' </td>
5911 <td> baz
5912 </td></tr></table>
5913
5914 !! end
5915
5916 !! test
5917 Simple table
5918 !! wikitext
5919 {|
5920 | 1 || 2
5921 |-
5922 | 3 || 4
5923 |}
5924 !! html
5925 <table>
5926 <tr>
5927 <td> 1 </td>
5928 <td> 2
5929 </td></tr>
5930 <tr>
5931 <td> 3 </td>
5932 <td> 4
5933 </td></tr></table>
5934
5935 !! end
5936
5937 !! test
5938 Simple table but with multiple dashes for row wikitext
5939 !! wikitext
5940 {|
5941 | foo
5942 |-----
5943 | bar
5944 |}
5945 !! html
5946 <table>
5947 <tr>
5948 <td> foo
5949 </td></tr>
5950 <tr>
5951 <td> bar
5952 </td></tr></table>
5953
5954 !! end
5955
5956 !! test
5957 Multiplication table
5958 !! wikitext
5959 {| border="1" cellpadding="2"
5960 |+Multiplication table
5961 |-
5962 ! &times; !! 1 !! 2 !! 3
5963 |-
5964 ! 1
5965 | 1 || 2 || 3
5966 |-
5967 ! 2
5968 | 2 || 4 || 6
5969 |-
5970 ! 3
5971 | 3 || 6 || 9
5972 |-
5973 ! 4
5974 | 4 || 8 || 12
5975 |-
5976 ! 5
5977 | 5 || 10 || 15
5978 |}
5979 !! html
5980 <table border="1" cellpadding="2">
5981 <caption>Multiplication table
5982 </caption>
5983 <tr>
5984 <th> &#215; </th>
5985 <th> 1 </th>
5986 <th> 2 </th>
5987 <th> 3
5988 </th></tr>
5989 <tr>
5990 <th> 1
5991 </th>
5992 <td> 1 </td>
5993 <td> 2 </td>
5994 <td> 3
5995 </td></tr>
5996 <tr>
5997 <th> 2
5998 </th>
5999 <td> 2 </td>
6000 <td> 4 </td>
6001 <td> 6
6002 </td></tr>
6003 <tr>
6004 <th> 3
6005 </th>
6006 <td> 3 </td>
6007 <td> 6 </td>
6008 <td> 9
6009 </td></tr>
6010 <tr>
6011 <th> 4
6012 </th>
6013 <td> 4 </td>
6014 <td> 8 </td>
6015 <td> 12
6016 </td></tr>
6017 <tr>
6018 <th> 5
6019 </th>
6020 <td> 5 </td>
6021 <td> 10 </td>
6022 <td> 15
6023 </td></tr></table>
6024
6025 !! end
6026
6027 !! test
6028 Accept "||" in table headings
6029 !! wikitext
6030 {|
6031 !h1 || h2
6032 |}
6033 !! html
6034 <table>
6035 <tr>
6036 <th>h1 </th>
6037 <th> h2
6038 </th></tr></table>
6039
6040 !! end
6041
6042 !! test
6043 Accept "!!" in table data
6044 !! wikitext
6045 {|
6046 | Foo!! ||
6047 |}
6048 !! html
6049 <table>
6050 <tr>
6051 <td> Foo!! </td>
6052 <td>
6053 </td></tr></table>
6054
6055 !! html/parsoid
6056 <table>
6057 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx_v":"row","autoInsertedEnd":true}'></td></tr>
6058 </tbody></table>
6059 !! end
6060
6061 !! test
6062 Accept "||" in indented table headings
6063 !! wikitext
6064 :{|
6065 !h1 || h2
6066 |}
6067 !! html
6068 <dl><dd><table>
6069 <tr>
6070 <th>h1 </th>
6071 <th> h2
6072 </th></tr></table></dd></dl>
6073
6074 !! end
6075
6076 !! test
6077 Accept "!!" in templates
6078 !! wikitext
6079 {|
6080 !a {{echo|b!!c}}
6081 |}
6082 !! html/php
6083 <table>
6084 <tr>
6085 <th>a b</th>
6086 <th>c
6087 </th></tr></table>
6088
6089 !! html/parsoid
6090 <table>
6091 <tbody><tr><th typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":["!a ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b!!c"}},"i":0}}]}'>a b</th><th about="#mwt1">c</th></tr>
6092 !! end
6093
6094 !! test
6095 Accept "!!" in table headings after newline
6096 !! wikitext
6097 {|
6098 !a
6099 b!!c
6100 |}
6101 !! html/php
6102 <table>
6103 <tr>
6104 <th>a
6105 <p>b!!c
6106 </p>
6107 </th></tr></table>
6108
6109 !! html/parsoid
6110 <table>
6111 <tbody><tr><th>a
6112 <p>b!!c</p></th></tr>
6113 </tbody></table>
6114 !! end
6115
6116 !! test
6117 Accept "!!" in table data of mixed wikitext / html syntax
6118 !! wikitext
6119 {|
6120 !a
6121 <tr><td>b!!c</td></tr>
6122 |}
6123 !! html+tidy
6124 <table>
6125 <tr>
6126 <th>a</th>
6127 </tr>
6128 <tr>
6129 <td>b!!c</td>
6130 </tr>
6131 </table>
6132 !! html/parsoid
6133 <table>
6134 <tbody><tr><th>a</th></tr>
6135 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6136 </tbody></table>
6137 !! end
6138
6139 !! test
6140 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6141 !! wikitext
6142 {|
6143 !| h1
6144 || a
6145 |}
6146 !! html
6147 <table>
6148 <tr>
6149 <th> h1
6150 </th>
6151 <td> a
6152 </td></tr></table>
6153
6154 !! end
6155
6156 !!test
6157 Accept "| !" at start of line in tables (ignore !-attribute)
6158 !! wikitext
6159 {|
6160 |-
6161 | !style="color:red" | bar
6162 |}
6163 !! html
6164 <table>
6165
6166 <tr>
6167 <td> bar
6168 </td></tr></table>
6169
6170 !!end
6171
6172 !!test
6173 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
6174 !! wikitext
6175 {|
6176 |-
6177 |style='color:red;'|+1
6178 |style='color:blue;'|-1
6179 |-
6180 | 1 || 2 || 3
6181 | 1 ||+2 ||-3
6182 |-
6183 | +1
6184 | -1
6185 |}
6186 !! html
6187 <table>
6188
6189 <tr>
6190 <td style="color:red;">+1
6191 </td>
6192 <td style="color:blue;">-1
6193 </td></tr>
6194 <tr>
6195 <td> 1 </td>
6196 <td> 2 </td>
6197 <td> 3
6198 </td>
6199 <td> 1 </td>
6200 <td>+2 </td>
6201 <td>-3
6202 </td></tr>
6203 <tr>
6204 <td> +1
6205 </td>
6206 <td> -1
6207 </td></tr></table>
6208
6209 !!end
6210
6211 !! test
6212 Table rowspan
6213 !! wikitext
6214 {| border=1
6215 | Cell 1, row 1
6216 |rowspan=2| Cell 2, row 1 (and 2)
6217 | Cell 3, row 1
6218 |-
6219 | Cell 1, row 2
6220 | Cell 3, row 2
6221 |}
6222 !! html
6223 <table border="1">
6224 <tr>
6225 <td> Cell 1, row 1
6226 </td>
6227 <td rowspan="2"> Cell 2, row 1 (and 2)
6228 </td>
6229 <td> Cell 3, row 1
6230 </td></tr>
6231 <tr>
6232 <td> Cell 1, row 2
6233 </td>
6234 <td> Cell 3, row 2
6235 </td></tr></table>
6236
6237 !! end
6238
6239 !! test
6240 Nested table
6241 !! wikitext
6242 {| border=1
6243 | &alpha;
6244 |
6245 {| bgcolor=#ABCDEF border=2
6246 |nested
6247 |-
6248 |table
6249 |}
6250 |the original table again
6251 |}
6252 !! html
6253 <table border="1">
6254 <tr>
6255 <td> &#945;
6256 </td>
6257 <td>
6258 <table bgcolor="#ABCDEF" border="2">
6259 <tr>
6260 <td>nested
6261 </td></tr>
6262 <tr>
6263 <td>table
6264 </td></tr></table>
6265 </td>
6266 <td>the original table again
6267 </td></tr></table>
6268
6269 !! end
6270
6271 !! test
6272 Invalid attributes in table cell (bug 1830)
6273 !! wikitext
6274 {|
6275 |Cell:|broken
6276 |}
6277 !! html
6278 <table>
6279 <tr>
6280 <td>broken
6281 </td></tr></table>
6282
6283 !! end
6284
6285 !! test
6286 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6287 !! wikitext
6288 {|
6289 | title="foo" |bar
6290 | title="foo<nowiki>|</nowiki>" |bar
6291 | title="foo<nowiki>|</nowiki>" bar
6292 |}
6293 !! html/php
6294 <table>
6295 <tr>
6296 <td title="foo">bar
6297 </td>
6298 <td title="foo&#124;">bar
6299 </td>
6300 <td> title="foo|" bar
6301 </td></tr></table>
6302
6303 !! html/parsoid
6304 <table>
6305 <tbody><tr><td title="foo">bar</td>
6306 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6307 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6308 </tbody></table>
6309 !! end
6310
6311 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6312 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6313 # *2wt modes will fail.
6314 !! test
6315 Table security: embedded pipes
6316 !! options
6317 parsoid=wt2html,html2html
6318 !! wikitext
6319 {|
6320 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6321 !! html/php
6322 <table>
6323 <tr>
6324 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6325 <td>]" onmouseover="alert(document.cookie)"&gt;test
6326 </td>
6327 </tr>
6328 </table>
6329
6330 !! html/parsoid
6331 <table><tbody>
6332 <tr>
6333 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6334 !! end
6335
6336 !! test
6337 ! and || in element attributes should not be parsed as <th>/<td>
6338 !! wikitext
6339 {|
6340 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6341 |}
6342 !! html/php
6343 <table>
6344 <tr>
6345 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6346 </td></tr></table>
6347
6348 !! html/parsoid
6349 <table>
6350 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6351 </tbody></table>
6352 !! end
6353
6354 # FIXME: The output seems broken. Filed as T110268.
6355 !! test
6356 ! and || in td attributes should not be parsed as <th>/<td>
6357 !! options
6358 parsoid=wt2html
6359 !! wikitext
6360 {|
6361 | style="color: red !important;" data-contrived="put this here ||" | foo
6362 |}
6363 !! html/php
6364 <table>
6365 <tr>
6366 <td> style="color: red !important;" data-contrived="put this here </td>
6367 <td> foo
6368 </td></tr></table>
6369
6370 !! html/parsoid
6371 <table>
6372 <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>
6373 </tbody></table>
6374 !! end
6375
6376 !! test
6377 Break on | in element attribute in template
6378 !! options
6379 parsoid=wt2html,html2html
6380 !! wikitext
6381 {{echo|1=<div class="hi|ho">ha</div>}}
6382 !! html/php
6383 <p>ho"&gt;ha&lt;/div&gt;
6384 </p>
6385 !! html/parsoid
6386 <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>
6387 !! end
6388
6389 !! test
6390 Indented table markup mixed with indented pre content (proposed in bug 6200)
6391 !! wikitext
6392 <table>
6393 <tr>
6394 <td>
6395 Text that should be rendered preformatted
6396 </td>
6397 </tr>
6398 </table>
6399 !! html
6400 <table>
6401 <tr>
6402 <td>
6403 <pre>Text that should be rendered preformatted
6404 </pre>
6405 </td>
6406 </tr>
6407 </table>
6408
6409 !! end
6410
6411 !! test
6412 1. Template-generated table cell attributes and cell content
6413 !! wikitext
6414 {|
6415 |{{table_attribs}}
6416 | {{table_attribs}}
6417 || {{table_attribs_5}}
6418 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6419 |align=center {{table_attribs}}
6420 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6421 |}
6422 !! html
6423 <table>
6424 <tr>
6425 <td style="color:red;">Foo
6426 </td>
6427 <td style="color:red;">Foo
6428 </td>
6429 <td> style="color:red;"</td>
6430 <td>Bar
6431 </td>
6432 <td style="color:red;">Foo
6433 </td>
6434 <td align="center" style="color:red;">Foo
6435 </td>
6436 <td align="center" style="color:red;">Foo
6437 </td></tr></table>
6438
6439 !! end
6440
6441 !! test
6442 2. Template-generated table cell attributes and cell content
6443 !! wikitext
6444 {|
6445 |{{table_attribs_2}}
6446 |}
6447 !! html/php
6448 <table>
6449 <tr>
6450 <td style="color:red;">Foo
6451 </td>
6452 <td>Bar</td>
6453 <td>Baz
6454 </td></tr></table>
6455
6456 !! html/parsoid
6457 <table>
6458 <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>
6459 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6460 </tbody></table>
6461 !! end
6462
6463 !! test
6464 3. Template-generated table cell attributes and cell content
6465 !! wikitext
6466 {|
6467 !align=center {{table_header_cells}}
6468 |-
6469 |align=center {{table_cells}}
6470 |}
6471 !! html/php
6472 <table>
6473 <tr>
6474 <th align="center" style="color:red;">Foo</th>
6475 <th style="color:red;"><i>Bar</i></th>
6476 <th style="color:brown;"><i>Foo</i> and Baz
6477 </th></tr>
6478 <tr>
6479 <td align="center" style="color:red;">Foo</td>
6480 <td style="color:red;"><i>Bar</i></td>
6481 <td style="color:brown;"><i>Foo</i> and Baz
6482 </td></tr></table>
6483
6484 !! html/parsoid
6485 <table>
6486 <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>
6487 <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>
6488 </tbody></table>
6489 !! end
6490
6491 !! test
6492 4. Template-generated table cell attributes and cell content inside a templated table
6493 !! wikitext
6494 {{tbl-start}}
6495 !align=center {{table_header_cells}}
6496 |-
6497 |align=center {{table_cells}}
6498 {{tbl-end}}
6499 !! html/php
6500 <table>
6501 <tr>
6502 <th align="center" style="color:red;">Foo</th>
6503 <th style="color:red;"><i>Bar</i></th>
6504 <th style="color:brown;"><i>Foo</i> and Baz
6505 </th></tr>
6506 <tr>
6507 <td align="center" style="color:red;">Foo</td>
6508 <td style="color:red;"><i>Bar</i></td>
6509 <td style="color:brown;"><i>Foo</i> and Baz
6510 </td></tr></table>
6511
6512 !! html/parsoid
6513 <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}}]}'>
6514 <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>
6515 <tr>
6516 <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>
6517 </tbody></table>
6518 !! end
6519
6520 ## Edge case fix to prevent future regressions
6521 !! test
6522 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6523 !! wikitext
6524 {|
6525 |{{table_attribs_7}}
6526 |}
6527 <references />
6528 !! html/parsoid
6529 <table>
6530 <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>
6531 </tbody></table>
6532 <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>
6533 !! end
6534
6535 !! test
6536 Table with row followed by newlines and table heading
6537 !! wikitext
6538 {|
6539 |-
6540
6541 ! foo
6542 |}
6543 !! html
6544 <table>
6545
6546
6547 <tr>
6548 <th> foo
6549 </th></tr></table>
6550
6551 !! end
6552
6553 !! test
6554 Table with empty line following the start tag
6555 !! wikitext
6556 {|
6557
6558 |-
6559 | foo
6560 |}
6561 !! html
6562 <table>
6563
6564
6565 <tr>
6566 <td> foo
6567 </td></tr></table>
6568
6569 !! end
6570
6571 !! test
6572 Table attributes with empty value
6573 !! options
6574 parsoid=wt2html,html2html
6575 !! wikitext
6576 {|
6577 | style=| hello
6578 |}
6579 !! html/php
6580 <table>
6581 <tr>
6582 <td style=""> hello
6583 </td></tr></table>
6584
6585 !! html/parsoid
6586 <table>
6587 <tbody><tr><td style=""> hello</td></tr>
6588 </tbody></table>
6589 !! end
6590
6591 !! test
6592 Wikitext table with a lot of comments
6593 !! wikitext
6594 {|
6595 <!-- c0 -->
6596 | foo
6597 <!-- c1 -->
6598 |-<!-- c2 -->
6599 <!-- c3 -->
6600 |<!-- c4 -->
6601 <!-- c5 -->
6602 |}
6603 !! html
6604 <table>
6605 <tr>
6606 <td> foo
6607 </td></tr>
6608 <tr>
6609 <td>
6610 </td></tr></table>
6611
6612 !! end
6613
6614 !! test
6615 Wikitext table comments represented in parsoid dom
6616 !! wikitext
6617 {|<!--c1--><!--c2-->
6618 |-<!--c3-->
6619 | x
6620 |}
6621 !! html/php+tidy
6622 <table>
6623 <tr>
6624 <td>x</td>
6625 </tr>
6626 </table>
6627 !! html/parsoid
6628 <table><!--c1--><!--c2-->
6629 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6630 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6631 </tbody></table>
6632 !! end
6633
6634 !! test
6635 Wikitext table with double-line table cell
6636 !! wikitext
6637 {|
6638 |a
6639 b
6640 |}
6641 !! html
6642 <table>
6643 <tr>
6644 <td>a
6645 <p>b
6646 </p>
6647 </td></tr></table>
6648
6649 !! end
6650
6651 !! test
6652 Table cell with a single comment
6653 !! wikitext
6654 {|
6655 | <!-- c1 -->
6656 | a
6657 |}
6658 !! html
6659 <table>
6660 <tr>
6661 <td>
6662 </td>
6663 <td> a
6664 </td></tr></table>
6665
6666 !! end
6667
6668 !! test
6669 Table-cell after a comment-only-empty-line
6670 !! wikitext
6671 {|
6672 |a
6673 <!--c1-->
6674 <!--c2-->| b
6675 |}
6676 !! html
6677 <table>
6678 <tr>
6679 <td>a
6680 </td>
6681 <td> b
6682 </td></tr></table>
6683
6684 !! html/parsoid
6685 <table>
6686 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6687 <!--c1-->
6688 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6689 </tbody></table>
6690
6691 !! end
6692
6693 !! test
6694 Build table with {{!}}
6695 !! wikitext
6696 {{{!}} class="wikitable"
6697 ! header
6698 ! second header
6699 {{!}}- style="color:red;"
6700 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6701 {{!}}}
6702 !! html
6703 <table class="wikitable">
6704 <tr>
6705 <th> header
6706 </th>
6707 <th> second header
6708 </th></tr>
6709 <tr style="color:red;">
6710 <td> data </td>
6711 <td style="color:red;"> second data
6712 </td></tr></table>
6713
6714 !! end
6715
6716 !! test
6717 Build table with pipe as data
6718 !! wikitext
6719 {| class="wikitable"
6720 ! header
6721 ! second header
6722 |- style="color:red;"
6723 | data || style="color:red;" | second data
6724 |-
6725 | style="color:red;" | data with | || style="color:red;" | second data with |
6726 |-
6727 || data with | ||| second data with |
6728 |}
6729 !! html
6730 <table class="wikitable">
6731 <tr>
6732 <th> header
6733 </th>
6734 <th> second header
6735 </th></tr>
6736 <tr style="color:red;">
6737 <td> data </td>
6738 <td style="color:red;"> second data
6739 </td></tr>
6740 <tr>
6741 <td style="color:red;"> data with | </td>
6742 <td style="color:red;"> second data with |
6743 </td></tr>
6744 <tr>
6745 <td> data with | </td>
6746 <td> second data with |
6747 </td></tr></table>
6748
6749 !! end
6750
6751 !! test
6752 Build table with wikilink
6753 !! wikitext
6754 {| class="wikitable"
6755 ! header || second header
6756 |- style="color:red;"
6757 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6758 |-
6759 | data || second data [[Main Page|link|text with pipe]]
6760 |}
6761 !! html
6762 <table class="wikitable">
6763 <tr>
6764 <th> header </th>
6765 <th> second header
6766 </th></tr>
6767 <tr style="color:red;">
6768 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6769 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6770 </td></tr>
6771 <tr>
6772 <td> data </td>
6773 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6774 </td></tr></table>
6775
6776 !! end
6777
6778 # The expected HTML structure in this test is debatable. The PHP parser does
6779 # not parse this kind of table at all. The main focus for Parsoid is on
6780 # round-tripping, so this output is ok for now. TODO: revisit!
6781 !! test
6782 Wikitext table with html-syntax row
6783 !! wikitext
6784 {|
6785 |-
6786 <td>foo</td>
6787 |}
6788 !! html/parsoid
6789 <table>
6790 <tbody>
6791 <tr>
6792 <td>foo</td></tr></tbody></table>
6793 !! end
6794
6795 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6796 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6797 ## PHP parser, which tidy then compounds by fostering the content
6798 ## entirely out of the table. Parsoid recognizes the table context
6799 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6800 ## depends on PHP's treatment of broken table markup!
6801 !! test
6802 Implicit <td> after a |-
6803 !! options
6804 parsoid=wt2html,html2html
6805 !! wikitext
6806 {|
6807 |-
6808 a
6809 |}
6810 !! html/php
6811 <table>
6812
6813 a
6814 </table>
6815
6816 !! html/php+tidy
6817 <p>a</p>
6818 !! html/parsoid
6819 <table>
6820 <tr><td>a</td></tr>
6821 </table>
6822 !! end
6823
6824 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6825 !! test
6826 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6827 !! options
6828 parsoid=wt2html,html2html
6829 !! wikitext
6830 {|
6831 |-
6832 |
6833 a
6834 |-
6835 b
6836 |}
6837 !! html/php
6838 <table>
6839
6840 <tr>
6841 <td>
6842 <pre>a
6843 </pre>
6844 </td></tr>
6845 b
6846 </table>
6847
6848 !! html/php+tidy
6849 <p>b</p>
6850 <table>
6851 <tr>
6852 <td>
6853 <pre>
6854 a
6855 </pre></td>
6856 </tr>
6857 </table>
6858 !! html/parsoid
6859 <table>
6860 <tbody>
6861 <tr><td><pre>a</pre></td></tr>
6862 <tr><td> b</td></tr>
6863 </tbody>
6864 </table>
6865 !! end
6866
6867 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6868 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6869 !! test
6870 Lists should be recognized in an implicit <td> context
6871 !! options
6872 parsoid=wt2html,html2html
6873 !! wikitext
6874 {|
6875 |-
6876 *a
6877 |}
6878 !! html/php
6879 <table>
6880
6881 <ul><li>a</li></ul>
6882 </table>
6883
6884 !! html/php+tidy
6885 <ul>
6886 <li>a</li>
6887 </ul>
6888 !! html/parsoid
6889 <table>
6890 <tr>
6891 <td><ul>
6892 <li>a</li>
6893 </ul></td>
6894 </tr>
6895 </table>
6896 !! end
6897
6898 !! test
6899 Table cells not properly parsed in an implicit-td context
6900 !! wikitext
6901 {|
6902 |-
6903 {{table_attribs_4}} || a || b
6904 |}
6905 !! html/php+tidy
6906 <table>
6907 <tr>
6908 <td style="background-color:#DC241f;" width="10px"></td>
6909 <td>a</td>
6910 <td>b</td>
6911 </tr>
6912 </table>
6913 !! html/parsoid
6914 <table>
6915 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6916 <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>
6917 </tbody></table>
6918 !! end
6919
6920 !! test
6921 Parsoid: Round-trip tables directly followed by content (bug 51219)
6922 !! options
6923 parsoid=wt2html,wt2wt
6924 !! wikitext
6925 {|
6926 |foo
6927 |} bar
6928
6929 {|
6930 |baz
6931 |}<b>quux</b>
6932 !! html+tidy
6933 <table>
6934 <tr>
6935 <td>foo</td>
6936 </tr>
6937 </table>
6938 <p>bar</p>
6939 <table>
6940 <tr>
6941 <td>baz</td>
6942 </tr>
6943 </table>
6944 <p><b>quux</b></p>
6945 !! end
6946
6947 !! test
6948 Parsoid: Default to a newline after tables in new content (bug 51219)
6949 !! options
6950 parsoid=html2wt
6951 !! html/parsoid
6952 <table><tbody>
6953 <tr><td>foo</td></tr></tbody></table> bar
6954 <table><tbody>
6955 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6956 !! wikitext
6957 {|
6958 |foo
6959 |}
6960 <nowiki> </nowiki>bar
6961 {|
6962 |baz
6963 |}
6964 '''quux'''
6965 !! end
6966
6967 !! test
6968 Parsoid: newline inducing block nodes don't suppress <nowiki>
6969 !! options
6970 parsoid=html2wt
6971 !! html/parsoid
6972 a<h1>foo</h1>
6973 !! wikitext
6974 <nowiki> </nowiki>a
6975
6976 = foo =
6977 !! end
6978
6979 !! test
6980 Parsoid: Row-syntax table headings followed by comment & table cells
6981 !! options
6982 parsoid=wt2html,wt2wt
6983 !! wikitext
6984 {|
6985 ! foo || bar
6986 <!-- foo --> || baz || quux
6987 |}
6988 !! html/php
6989 <table>
6990 <tr>
6991 <th> foo </th>
6992 <th> bar
6993 </th>
6994 <td> baz </td>
6995 <td> quux
6996 </td></tr></table>
6997
6998 !! html/parsoid
6999 <table>
7000 <tbody><tr><th> foo </th><th> bar
7001 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7002 </tbody></table>
7003 !! end
7004
7005 !!test
7006 Parsoid: Recover better from broken table attributes
7007 !!options
7008 parsoid=wt2html
7009 !!wikitext
7010 {| class="foo
7011 | class="bar" |
7012 foo
7013 |}
7014 !!html/php+tidy
7015 <table class="foo">
7016 <tr>
7017 <td class="bar">
7018 <p>foo</p>
7019 </td>
7020 </tr>
7021 </table>
7022 !!html/parsoid
7023 <table class="foo">
7024 <tr>
7025 <td class="bar">
7026 <p>foo</p></td></tr>
7027 </tbody></table>
7028 !!end
7029
7030 !! test
7031 Tables: Digest broken attributes on table and tr tag
7032 !! options
7033 parsoid=wt2html
7034 !! wikitext
7035 {| || |} ++
7036 |- || || ++ --
7037 |- > [
7038 |}
7039 !! html
7040 <table>
7041 <tbody>
7042 <tr></tr>
7043 <tr></tr>
7044 </tbody></table>
7045 !! end
7046
7047 !! test
7048 Strip unsupported table tags
7049 !! options
7050 parsoid=html2wt
7051 !! html/parsoid
7052 <table>
7053 <thead>
7054 <tr>
7055 <th>Month</th>
7056 <th>Savings</th>
7057 </tr>
7058 </thead>
7059 <tbody>
7060 <tr>
7061 <td>January</td>
7062 <td>$100</td>
7063 </tr>
7064 <tr>
7065 <td>February</td>
7066 <td>$80</td>
7067 </tr>
7068 </tbody>
7069 <tfoot>
7070 <tr>
7071 <td>Sum</td>
7072 <td>$180</td>
7073 </tr>
7074 </tfoot>
7075 </table>
7076 !! wikitext
7077 {|
7078
7079 !Month
7080 !Savings
7081
7082 |January
7083 |$100
7084
7085 |-
7086 |February
7087 |$80
7088
7089 |Sum
7090 |$180
7091
7092 |}
7093 !! end
7094
7095 !!test
7096 Testing serialization after deletion of table cells
7097 !!options
7098 parsoid={
7099 "modes": ["wt2wt", "selser"],
7100 "changes": [
7101 ["#x", "remove"]
7102 ]
7103 }
7104 !!wikitext
7105 {|
7106 !h1 !!h2 !!h3
7107 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7108 |}
7109 !! wikitext/edited
7110 {|
7111 !h1 !!h2 !!h3
7112 |c2 |||c3
7113 |}
7114 !!end
7115
7116 ###
7117 ### Internal links
7118 ###
7119 !! test
7120 Plain link, capitalized
7121 !! wikitext
7122 [[Main Page]]
7123 !! html
7124 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7125 </p>
7126 !! end
7127
7128 !! test
7129 Plain link, uncapitalized
7130 !! wikitext
7131 [[main Page]]
7132 !! html
7133 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7134 </p>
7135 !! end
7136
7137 !! test
7138 Piped link
7139 !! wikitext
7140 [[Main Page|The Main Page]]
7141 !! html
7142 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7143 </p>
7144 !! end
7145
7146 !! test
7147 Piped link with comment in link text
7148 !! wikitext
7149 [[Main Page|The Main<!--front--> Page]]
7150 !! html
7151 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7152 </p>
7153 !! end
7154
7155 !! test
7156 Piped link with multiple pipe characters in link text
7157 !! wikitext
7158 [[Main Page||The|Main|Page|]]
7159 !! html/php
7160 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7161 </p>
7162 !! html/parsoid
7163 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7164 !! end
7165
7166 !! test
7167 Piped link with no link text
7168 !! wikitext
7169 [[Thomas Bek (bishop of St David's)|]]
7170 !! html/php
7171 <p>[[Thomas Bek (bishop of St David's)|]]
7172 </p>
7173 !! html/parsoid
7174 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7175 !! end
7176
7177 !! test
7178 Broken link
7179 !! wikitext
7180 [[Zigzagzogzagzig]]
7181 !! html
7182 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7183 </p>
7184 !! end
7185
7186 !! test
7187 Broken link with fragment
7188 !! wikitext
7189 [[Zigzagzogzagzig#zug]]
7190 !! html
7191 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7192 </p>
7193 !! end
7194
7195 !! test
7196 Special page link with fragment
7197 !! wikitext
7198 [[Special:Version#anchor]]
7199 !! html
7200 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7201 </p>
7202 !! end
7203
7204 !! test
7205 Nonexistent special page link with fragment
7206 !! wikitext
7207 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7208 !! html
7209 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7210 </p>
7211 !! end
7212
7213 !! test
7214 Link with prefix
7215 !! wikitext
7216 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7217 !! html
7218 <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>
7219 </p>
7220 !! end
7221
7222 !! test
7223 Link with suffix
7224 !! wikitext
7225 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7226 !! html
7227 <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>!!!
7228 </p>
7229 !! end
7230
7231 !! article
7232 prefixed article
7233 !! text
7234 Some text
7235 !! endarticle
7236
7237 !! test
7238 Bug 43661: Piped links with identical prefixes
7239 !! wikitext
7240 [[prefixed article|prefixed articles with spaces]]
7241
7242 [[prefixed article|prefixed articlesaoeu]]
7243
7244 [[Main Page|Main Page test]]
7245 !! html
7246 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7247 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7248 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7249 </p>
7250 !! end
7251
7252
7253 !! test
7254 Link with HTML entity in suffix / tail
7255 !! wikitext
7256 [[Main Page]]&quot;, [[Main Page]]&#97;
7257 !! html/php
7258 <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;
7259 </p>
7260 !! html/parsoid
7261 <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>
7262 !! end
7263
7264 !! test
7265 Link with 3 brackets
7266 !! wikitext
7267 [[[Main Page]]]
7268 Foo [[[Main Page]]]
7269 !! html
7270 <p>[[[Main Page]]]
7271 Foo [[[Main Page]]]
7272 </p>
7273 !! end
7274
7275 !! test
7276 Link with 4 brackets
7277 !! wikitext
7278 [[[[Main Page]]]]
7279 !! html
7280 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7281 </p>
7282 !! end
7283
7284 !! test
7285 Piped link with 3 brackets
7286 !! wikitext
7287 [[[main page|the main page]]]
7288 !! html
7289 <p>[[[main page|the main page]]]
7290 </p>
7291 !! end
7292
7293 !! test
7294 Piped link with extlink-like text
7295 !! wikitext
7296 [[Main Page|[bar]]]
7297 [[Main Page|This is a [bar]]]
7298 !! html/php
7299 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7300 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7301 </p>
7302 !! html/parsoid
7303 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7304 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7305 !! end
7306
7307 !! test
7308 Link with multiple pipes
7309 !! wikitext
7310 [[Main Page|The|Main|Page]]
7311 !! html
7312 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7313 </p>
7314 !! end
7315
7316 # Note that parsoid does not munge anchor text; all non-space
7317 # characters are valid in HTML5 ids.
7318 !! test
7319 Anchor containing a #. (bug 63430)
7320 !! wikitext
7321 [[Main Page#And#Link]]
7322 !! html/php
7323 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7324 </p>
7325 !! html/parsoid
7326 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
7327 !! end
7328
7329 !! test
7330 Link to namespaces
7331 !! wikitext
7332 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7333 !! html
7334 <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>
7335 </p>
7336 !! end
7337
7338 !! test
7339 Link with space in namespace
7340 !! wikitext
7341 [[User talk:Foo bar]]
7342 !! html
7343 <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>
7344 </p>
7345 !! end
7346
7347 !! article
7348 MemoryAlpha:AlphaTest
7349 !! text
7350 This is an article in the MemoryAlpha namespace
7351 (which shadows the memoryalpha interwiki link).
7352 !! endarticle
7353
7354 !! test
7355 Namespace takes precedence over interwiki link (bug 51680)
7356 !! wikitext
7357 [[MemoryAlpha:AlphaTest]]
7358 !! html
7359 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7360 </p>
7361 !! end
7362
7363 # The previous test doesn't work correctly in html2*, due to not recognizing the
7364 # link as an internal one. This one checks for the correct behavior.
7365 !! test
7366 Link to namespace preferred over interwiki with correct rel attribute
7367 !! options
7368 parsoid=html2wt,html2html
7369 !! html/parsoid
7370 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7371 !! wikitext
7372 [[MemoryAlpha:AlphaTest]]
7373 !! end
7374
7375 !! test
7376 Piped link to namespace
7377 !! wikitext
7378 [[Meta:Disclaimers|The disclaimers]]
7379 !! html
7380 <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>
7381 </p>
7382 !! end
7383
7384 !! test
7385 Link containing }
7386 !! wikitext
7387 [[Usually caused by a typo (oops}]]
7388 !! html
7389 <p>[[Usually caused by a typo (oops}]]
7390 </p>
7391 !! end
7392
7393 !! article
7394 7% Solution
7395 !! text
7396 Just a test of an article title containing a percent.
7397 !! endarticle
7398
7399 !! test
7400 Link containing % (not as a hex sequence)
7401 !! wikitext
7402 [[7% Solution]]
7403 !! html/php
7404 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7405 </p>
7406 !! html/parsoid
7407 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7408 !! end
7409
7410 # note that the parsoid HTML is identical to the previous test output,
7411 # so the previous test ensures that the html2wt mode will generate the
7412 # "not as a hex sequence" wikitext.
7413 !! test
7414 Link containing % as a single hex sequence interpreted to char
7415 !! options
7416 parsoid=wt2wt,wt2html,html2html
7417 !! wikitext
7418 [[7%25 Solution]]
7419 !! html/php
7420 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7421 </p>
7422 !! html/parsoid
7423 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7424 !!end
7425
7426 !! test
7427 Link containing % as a double hex sequence interpreted to hex sequence
7428 !! wikitext
7429 [[7%2525 Solution]]
7430 !! html
7431 <p>[[7%2525 Solution]]
7432 </p>
7433 !!end
7434
7435 # note that parsoid does not munge anchor text; all non-space
7436 # characters are valid in HTML5 anchors.
7437 !! test
7438 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7439 Example for such a section: == < ==
7440 !! wikitext
7441 [[%23%3c]][[%23%3e]]
7442 !! html/php
7443 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7444 </p>
7445 !! html/parsoid
7446 <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>
7447 !! end
7448
7449 !! test
7450 Link containing "<#" and ">#" as a hex sequences
7451 !! wikitext
7452 [[%3c%23]][[%3e%23]]
7453 !! html
7454 <p>[[%3c%23]][[%3e%23]]
7455 </p>
7456 !! end
7457
7458 !! test
7459 Link containing an equals sign
7460 !! wikitext
7461 [[Special:BookSources/isbn=4-00-026157-6]]
7462 !! html/php
7463 <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>
7464 </p>
7465 !! html/parsoid
7466 <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>
7467 !! end
7468
7469 !! article
7470 Foo~bar
7471 !! text
7472 Just a test of an article title containing a tilde.
7473 !! endarticle
7474
7475 # note that links containing signatures, like [[Foo~~~~]], are
7476 # massaged by the pre-save transform (PST) and so the tildes are never
7477 # seen by the parser.
7478 !! test
7479 Link containing a tilde
7480 !! wikitext
7481 [[Foo~bar]]
7482 !! html/php
7483 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7484 </p>
7485 !! html/parsoid
7486 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7487 !! end
7488
7489 !! test
7490 Link containing double-single-quotes '' (bug 4598)
7491 !! wikitext
7492 [[Lista d''e paise d''o munno]]
7493 !! html/php
7494 <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>
7495 </p>
7496 !! html/parsoid
7497 <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>
7498 !! end
7499
7500 !! test
7501 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7502 !! wikitext
7503 Some [[Link|pretty ''italics'' and stuff]]!
7504 !! html/php
7505 <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>!
7506 </p>
7507 !! html/parsoid
7508 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7509 !! end
7510
7511 !! test
7512 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7513 !! wikitext
7514 ''Some [[Link|pretty ''italics'' and stuff]]!''
7515 !! html
7516 <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>
7517 </p>
7518 !! end
7519
7520 !! test
7521 Link with double quotes in title part (literal) and alternate part (interpreted)
7522 !! wikitext
7523 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7524
7525 [[''Pentecoste'']]
7526
7527 [[''Pentecoste''|Pentecoste]]
7528
7529 [[''Pentecoste''|''Pentecoste'']]
7530 !! html/php
7531 <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>
7532 </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>
7533 </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>
7534 </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>
7535 </p>
7536 !! html/parsoid
7537 <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>
7538 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7539 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7540 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7541 !! end
7542
7543 !! test
7544 Broken image links with HTML captions (bug 39700)
7545 !! wikitext
7546 [[File:Nonexistent|<script></script>]]
7547 [[File:Nonexistent|100x100px|<script></script>]]
7548 [[File:Nonexistent|&lt;]]
7549 [[File:Nonexistent|a<i>b</i>c]]
7550 !! html/php
7551 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7552 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7553 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7554 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7555 </p>
7556 !! html/parsoid
7557 <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>
7558 <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>
7559 <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>
7560 <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>
7561 !! end
7562
7563 !! test
7564 Plain link to URL
7565 !! wikitext
7566 [[http://www.example.com]]
7567 !! html/php
7568 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7569 </p>
7570 !! html/parsoid
7571 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7572 !! end
7573
7574 !! test
7575 Plain link to URL with link text
7576 !! wikitext
7577 [[http://www.example.com Link text]]
7578 !! html
7579 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7580 </p>
7581 !! end
7582
7583 !! test
7584 Plain link to protocol-relative URL
7585 !! wikitext
7586 [[//www.example.com]]
7587 !! html/php
7588 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7589 </p>
7590 !! html/parsoid
7591 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7592 !! end
7593
7594 !! test
7595 Plain link to protocol-relative URL with link text
7596 !! wikitext
7597 [[//www.example.com Link text]]
7598 !! html
7599 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7600 </p>
7601 !! end
7602
7603 !! test
7604 Plain link to page with question mark in title
7605 !! wikitext
7606 [[A?b]]
7607
7608 [[A?b|Baz]]
7609 !! html
7610 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7611 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7612 </p>
7613 !! end
7614
7615
7616 # I'm fairly sure the expected result here is wrong.
7617 # We want these to be URL links, not pseudo-pages with URLs for titles....
7618 # However the current output is also pretty screwy.
7619 #
7620 # ----
7621 # I'm changing it to match the current output--it arguably makes more
7622 # sense in the light of the test above. Old expected result was:
7623 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7624 #</p>
7625 # But I think this test is bordering on "garbage in, garbage out" anyway.
7626 # -- wtm
7627 !! test
7628 Piped link to URL
7629 !! wikitext
7630 Piped link to URL: [[http://www.example.com|an example URL]]
7631 !! html/php
7632 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7633 </p>
7634 !! html/parsoid
7635 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7636 !! end
7637
7638 !! test
7639 BUG 2: [[page|http://url/]] should link to page, not http://url/
7640 !! wikitext
7641 [[Main Page|http://url/]]
7642 !! html/php
7643 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7644 </p>
7645 !! html/parsoid
7646 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7647 !! end
7648
7649 # Parsoid does not mark self-links, by design.
7650 !! test
7651 BUG 337: Escaped self-links should be bold
7652 !! options
7653 title=[[Bug462]]
7654 !! wikitext
7655 [[Bu&#103;462]] [[Bug462]]
7656 !! html/php
7657 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7658 </p>
7659 !! html/php+tidy
7660 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7661 !! html/parsoid
7662 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7663 !! end
7664
7665 !! test
7666 Self-link to section should not be bold
7667 !! options
7668 title=[[Main Page]]
7669 !! wikitext
7670 [[Main Page#section]]
7671 !! html
7672 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7673 </p>
7674 !! end
7675
7676 !! article
7677 00
7678 !! text
7679 This is 00.
7680 !! endarticle
7681
7682 !!test
7683 Self-link to numeric title
7684 !!options
7685 title=[[0]]
7686 !! wikitext
7687 [[0]]
7688 !! html
7689 <p><strong class="selflink">0</strong>
7690 </p>
7691 !!end
7692
7693 !!test
7694 Link to numeric-equivalent title
7695 !!options
7696 title=[[0]]
7697 !! wikitext
7698 [[00]]
7699 !! html
7700 <p><a href="/wiki/00" title="00">00</a>
7701 </p>
7702 !!end
7703
7704 !! test
7705 <nowiki> inside a link
7706 !! wikitext
7707 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7708 !! html
7709 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7710 </p>
7711 !! end
7712
7713 !! test
7714 Non-breaking spaces in title
7715 !! wikitext
7716 [[&nbsp; Main &nbsp; Page &nbsp;]]
7717 !! html
7718 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7719 </p>
7720 !!end
7721
7722 !! test
7723 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7724 !! options
7725 language=ca
7726 !! wikitext
7727 '''[[Main Page]]'''
7728 !! html
7729 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7730 </p>
7731 !! end
7732
7733 !! test
7734 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7735 !! options
7736 language=ca
7737 !! wikitext
7738 ''[[Main Page]]''
7739 !! html
7740 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7741 </p>
7742 !! end
7743
7744 !! test
7745 Internal link with en linktrail: no apostrophes (bug 27473)
7746 !! options
7747 language=en
7748 !! wikitext
7749 [[Something]]'nice
7750 !! html
7751 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
7752 </p>
7753 !! end
7754
7755 !! test
7756 Internal link with ca linktrail with apostrophes (bug 27473)
7757 !! options
7758 language=ca
7759 !! wikitext
7760 [[Something]]'nice
7761 !! html
7762 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
7763 </p>
7764 !! end
7765
7766 !! test
7767 Internal link with kaa linktrail with apostrophes (bug 27473)
7768 !! options
7769 language=kaa
7770 !! wikitext
7771 [[Something]]'nice
7772 !! html
7773 <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>
7774 </p>
7775 !! end
7776
7777 !! test
7778 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
7779 !! wikitext
7780 [[User:Foo/Test/63636:Bar|Test]]
7781 !! html/php
7782 <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>
7783 </p>
7784 !! html/parsoid
7785 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
7786 !! end
7787
7788 !! test
7789 Purely hash wikilink
7790 !! options
7791 title=[[User:test/123]]
7792 !! wikitext
7793 [[#a|b]]
7794 !! html/php
7795 <p><a href="#a">b</a>
7796 </p>
7797 !! html/parsoid
7798 <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>
7799 !! end
7800
7801 !! test
7802 1. Interaction of linktrail and template encapsulation
7803 !! options
7804 parsoid
7805 !! wikitext
7806 {{echo|[[Foo]]}}l
7807 !! html
7808 <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>
7809 !! end
7810
7811 !! test
7812 2. Interaction of linktrail and template encapsulation
7813 !! options
7814 parsoid
7815 !! wikitext
7816 {{echo|Some [[Fool]]}}s
7817 !! html
7818 <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>
7819 !! end
7820
7821 !! test
7822 3. Interaction of linktrail and template encapsulation
7823 !! options
7824 parsoid
7825 !! wikitext
7826 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
7827 !! html
7828 <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>
7829 !! end
7830
7831 !! article
7832 Söfnuður
7833 !! text
7834 Test.
7835 !! endarticle
7836
7837 !! test
7838 Internal link with is link prefix
7839 !! options
7840 language=is
7841 !! wikitext
7842 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
7843 !! html
7844 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
7845 </p>
7846 !! end
7847
7848 !! article
7849 Mótmælendatrú
7850 !! text
7851 Test.
7852 !! endarticle
7853
7854 !! test
7855 Internal link with is link trail and link prefix
7856 !! options
7857 language=is
7858 !! wikitext
7859 [[mótmælendatrú|xxx]]ar
7860 [[mótmælendatrú]]ar
7861 mótmælenda[[söfnuður]]
7862 mótmælenda[[söfnuður|söfnuðir]]
7863 mótmælenda[[söfnuður|söfnuðir]]xxx
7864 !! html
7865 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
7866 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
7867 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
7868 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
7869 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
7870 </p>
7871 !! end
7872
7873 !! test
7874 Parsoid link trail escaping
7875 !! options
7876 parsoid=html2wt,html2html
7877 !! html/parsoid
7878 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
7879 !! wikitext
7880 [[apple]]<nowiki/>s
7881 !! end
7882
7883 !! test
7884 Parsoid link prefix escaping
7885 !! options
7886 language=is
7887 parsoid=html2wt,html2html
7888 !! html/parsoid
7889 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
7890 !! wikitext
7891 Aðrir mótmælenda<nowiki/>[[söfnuður]]
7892 !! end
7893
7894 !! test
7895 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
7896 !! wikitext
7897 [[Foo| bar]]
7898
7899 [[Foo| ''bar'']]
7900
7901 [http://wp.org foo]
7902
7903 [http://wp.org ''foo'']
7904 !! html
7905 <p><a href="/wiki/Foo" title="Foo"> bar</a>
7906 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
7907 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
7908 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
7909 </p>
7910 !! end
7911
7912 !! test
7913 Parsoid: Scoped parsing should handle mixed transclusions and plain text
7914 !! options
7915 parsoid
7916 !! wikitext
7917 [[Foo|{{echo|a}} b {{echo|c}}]]
7918 !! html
7919 <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>
7920 !! end
7921
7922 !! test
7923 Link with angle bracket after anchor
7924 !! wikitext
7925 [[Foo#<bar>]]
7926 !! html/php
7927 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
7928 </p>
7929 !! html/parsoid
7930 <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>
7931 !! end
7932
7933 ###
7934 ### Interwiki links (see maintenance/interwiki.sql)
7935 ###
7936
7937 !! test
7938 Inline interwiki link
7939 !! options
7940 parsoid=wt2html,wt2wt,html2html
7941 !! wikitext
7942 [[MeatBall:SoftSecurity]]
7943 !! html/php
7944 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
7945 </p>
7946 !! html/parsoid
7947 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
7948 !! end
7949
7950 !! test
7951 Inline interwiki link with empty title (bug 2372)
7952 !! options
7953 parsoid=wt2html,wt2wt,html2html
7954 !! wikitext
7955 [[MeatBall:]]
7956 !! html/php
7957 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
7958 </p>
7959 !! html/parsoid
7960 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
7961 !! end
7962
7963 !! test
7964 Interwiki link encoding conversion (bug 1636)
7965 !! wikitext
7966 *[[Wikipedia:ro:Olteni&#0355;a]]
7967 *[[Wikipedia:ro:Olteni&#355;a]]
7968 !! html
7969 <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>
7970 <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>
7971
7972 !! html+tidy
7973 <ul>
7974 <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>
7975 <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>
7976 </ul>
7977 !! end
7978
7979 !! test
7980 Interwiki link with fragment (bug 2130)
7981 !! wikitext
7982 [[MeatBall:SoftSecurity#foo]]
7983 !! html
7984 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
7985 </p>
7986 !! end
7987
7988 # Ideally the wikipedia: prefix here should be proto-relative too
7989 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
7990 # define the 'en' prefix, and originally the test used 'wikipedia',
7991 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
7992 # article.
7993 !! test
7994 Different interwiki prefixes mapping to the same URL
7995 !! wikitext
7996 [[:en:Foo]]
7997
7998 [[:en:Foo|Foo]]
7999
8000 [[wikipedia:Foo]]
8001
8002 [[:wikipedia:Foo|Foo]]
8003
8004 [[wikipedia:en:Foo]]
8005
8006 [[:wikipedia:en:Foo]]
8007
8008 [[ wikiPEdia :Foo]]
8009 !! html/parsoid
8010 <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>
8011
8012 <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>
8013
8014 <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>
8015
8016 <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>
8017
8018 <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>
8019
8020 <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>
8021
8022 <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>
8023 !! end
8024
8025 !! test
8026 Interwiki links that cannot be represented in wiki syntax
8027 !! wikitext
8028 [[meatball:ok]]
8029 [[meatball:ok#foo|ok with fragment]]
8030 [[meatball:ok_as_well?|ok ending with ? mark]]
8031 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8032 [http://de.wikipedia.org/wiki/#foo is just fragment]
8033
8034 !! html/php
8035 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8036 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8037 <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>
8038 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8039 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8040 </p>
8041 !! html/parsoid
8042 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8043 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8044 <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>
8045 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8046 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8047 !! end
8048
8049 !! test
8050 Interwiki links: trail
8051 !! wikitext
8052 [[wikipedia:Foo|Ba]]r
8053 !! html/php
8054 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8055 </p>
8056 !! html/parsoid
8057 <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>
8058 !! end
8059
8060 !! test
8061 Local interwiki link
8062 !! options
8063 parsoid=wt2html,wt2wt,html2html
8064 !! wikitext
8065 [[local:Template:Foo]]
8066 !! html/php
8067 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8068 </p>
8069 !! html/parsoid
8070 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8071 !! end
8072
8073 # Parsoid does not mark self-links, by design.
8074 !! test
8075 Local interwiki link: self-link to current page
8076 !! options
8077 title=[[Main Page]]
8078 parsoid=wt2html,wt2wt,html2html
8079 !! wikitext
8080 [[local:Main Page]]
8081 !! html/php
8082 <p><strong class="selflink">local:Main Page</strong>
8083 </p>
8084 !! html/parsoid
8085 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8086 !! end
8087
8088 !! test
8089 Local interwiki link: prefix only (bug 64167)
8090 !! options
8091 parsoid=wt2html,wt2wt,html2html
8092 !! wikitext
8093 [[local:]]
8094 !! html/php
8095 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8096 </p>
8097 !! html/parsoid
8098 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8099 !! end
8100
8101 !! test
8102 Local interwiki link: with additional interwiki prefix (bug 61357)
8103 !! options
8104 parsoid=wt2html,wt2wt,html2html
8105 !! wikitext
8106 [[local:meatball:Hello]]
8107 !! html/php
8108 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8109 </p>
8110 !! html/parsoid
8111 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8112 !! end
8113
8114 !! test
8115 Multiple local interwiki link prefixes
8116 !! wikitext
8117 [[local:local:local:local:mi:local:Foo]]
8118 !! options
8119 parsoid=wt2html,wt2wt,html2html
8120 !! html/php
8121 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8122 </p>
8123 !! html/parsoid
8124 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8125 !! end
8126
8127 ###
8128 ### Interlanguage links
8129 ### Language links (so that searching for '### language' matches..)
8130 ###
8131
8132 !! test
8133 Interlanguage link
8134 !! options
8135 parsoid=wt2html,wt2wt,html2html
8136 !! wikitext
8137 Blah blah blah
8138 [[zh:Chinese]]
8139 !! html/php
8140 <p>Blah blah blah
8141 </p>
8142 !! html/parsoid
8143 <p>Blah blah blah</p>
8144 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8145 !! end
8146
8147 !! test
8148 Interlanguage link with spacing
8149 !! options
8150 parsoid=wt2html,wt2wt,html2html
8151 !! wikitext
8152 Blah blah blah
8153 [[ zh : Chinese ]]
8154 !! html/php
8155 <p>Blah blah blah
8156 </p>
8157 !! html/parsoid
8158 <p>Blah blah blah</p>
8159 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8160 !! end
8161
8162 !! test
8163 Double interlanguage link
8164 !! options
8165 parsoid=wt2html,wt2wt,html2html
8166 !! wikitext
8167 Blah blah blah
8168 [[es:Spanish]]
8169 [[zh:Chinese]]
8170 !! html/php
8171 <p>Blah blah blah
8172 </p>
8173 !! html/parsoid
8174 <p>Blah blah blah</p>
8175 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8176 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8177 !! end
8178
8179 !! test
8180 Interlanguage link variations
8181 !! options
8182 parsoid=wt2html,wt2wt,html2html
8183 !! wikitext
8184 Blah blah blah
8185 [[ es :Spanish]]
8186 [[ ZH :Chinese]]
8187 [[es:Foo_bar]]
8188 !! html/php
8189 <p>Blah blah blah
8190 </p>
8191 !! html/parsoid
8192 <p>Blah blah blah</p>
8193 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8194 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8195 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8196 !! end
8197
8198 !! test
8199 Space and question mark encoding in interlanguage links (T95473)
8200 !! options
8201 parsoid=wt2html,wt2wt,html2html
8202 !! wikitext
8203 Blah blah blah
8204 [[es:Foo bar?]]
8205 !! html/php
8206 <p>Blah blah blah
8207 </p>
8208 !! html/parsoid
8209 <p>Blah blah blah</p>
8210 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8211 !! end
8212
8213 !! test
8214 Interlanguage link, with prefix links
8215 !! options
8216 language=ln
8217 !! wikitext
8218 Blah blah blah
8219 [[zh:Chinese]]
8220 !! html/php
8221 <p>Blah blah blah
8222 </p>
8223 !! html/parsoid
8224 <p>Blah blah blah</p>
8225 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8226 !! end
8227
8228 !! test
8229 Double interlanguage link, with prefix links (bug 8897)
8230 !! options
8231 language=ln
8232 !! wikitext
8233 Blah blah blah
8234 [[es:Spanish]]
8235 [[zh:Chinese]]
8236 !! html/php
8237 <p>Blah blah blah
8238 </p>
8239 !! html/parsoid
8240 <p>Blah blah blah</p>
8241 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8242 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8243 !! end
8244
8245 !! test
8246 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8247 !! wikitext
8248 Blah blah blah
8249 [[mul:Article]]
8250 !! html/php
8251 <p>Blah blah blah
8252 </p>
8253 !! html/parsoid
8254 <p>Blah blah blah</p>
8255 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8256 !! end
8257
8258 !! test
8259 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8260 !! options
8261 language=ln
8262 !! wikitext
8263 [[WW&nbsp;II]]
8264 !! html
8265 <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>
8266 </p>
8267 !! end
8268
8269 !! test
8270 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8271 !! options
8272 parsoid=html2wt
8273 !! html/parsoid
8274 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8275 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8276 !! wikitext
8277 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8278
8279 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
8280 !! end
8281
8282 !! test
8283 Parsoid: handle constructor well
8284 !! wikitext
8285 [[constructor]]
8286
8287 [[constructor:foo]]
8288 !! html/php
8289 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8290 </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>
8291 </p>
8292 !! html/parsoid
8293 <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>
8294
8295 <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>
8296 !! end
8297
8298 !! article
8299 ko:
8300 !! text
8301 Test.
8302 !! endarticle
8303
8304 # Note that `ko` isn't a known interlanguage prefix
8305 !! test
8306 Parsoid: recognize interlanguage links without a target page
8307 !! options
8308 ill
8309 !! wikitext
8310 [[es:]]
8311
8312 [[ko:]]
8313 !! html/php
8314 es:
8315 !! html/parsoid
8316 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8317
8318 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8319 !! end
8320
8321 # Note that `ko` isn't a known interwiki prefix
8322 !! test
8323 Parsoid: recognize interwiki links without a target page
8324 !! options
8325 parsoid=wt2html,wt2wt,html2html
8326 !! wikitext
8327 [[:es:]]
8328
8329 [[:ko:]]
8330 !! html/php
8331 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8332 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8333 </p>
8334 !! html/parsoid
8335 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8336 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8337 !! end
8338
8339 !! test
8340 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8341 !! wikitext
8342 [[mi:Foo]]
8343 !! html/php
8344 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8345 </p>
8346 !! html/parsoid
8347 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8348 !! end
8349
8350 !! test
8351 Interlanguage link with preceding local interwiki link (bug 68085)
8352 !! options
8353 parsoid=wt2html,wt2wt,html2html
8354 !! wikitext
8355 Blah blah blah
8356 [[local:es:Spanish]]
8357 !! html/php
8358 <p>Blah blah blah
8359 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8360 </p>
8361 !! html/parsoid
8362 <p>Blah blah blah
8363 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8364 !! end
8365
8366 !! test
8367 Looks like an interlanguage link, but is actually a local interwiki
8368 !! options
8369 parsoid=wt2html,wt2wt,html2html
8370 !! wikitext
8371 Blah blah blah
8372 [[mi:Template:Foo]]
8373 !! html/php
8374 <p>Blah blah blah
8375 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8376 </p>
8377 !! html/parsoid
8378 <p>Blah blah blah
8379 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8380 !! end
8381
8382 ###
8383 ### Redirects, Parsoid-only
8384 ###
8385
8386 !! test
8387 1. Simple redirect to page
8388 !! wikitext
8389 #REDIRECT [[Main Page]]
8390 !! html/parsoid
8391 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8392 !! end
8393
8394 !! test
8395 2. Other redirect variants
8396 !! wikitext
8397 #REDIRECT [[Main_Page]]
8398 !! html/parsoid
8399 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8400 !! end
8401
8402 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8403 # This tests the Parsoid bail-out code.
8404 !! test
8405 3. Other redirect variants
8406 !! wikitext
8407 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8408 !! html/parsoid
8409 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8410 !! end
8411
8412 !! test
8413 4. Redirect to a templated destination
8414 !! wikitext
8415 #REDIRECT [[{{echo|Foo}}bar]]
8416 !! html/parsoid
8417 <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"}]]}'/>
8418 !! end
8419
8420 !! test
8421 Empty redirect
8422 !! options
8423 parsoid=wt2html,wt2wt
8424 !! wikitext
8425 #REDIRECT [[]]
8426 !! html/parsoid
8427 <ol>
8428 <li>REDIRECT [[]]</li></ol>
8429 !! end
8430
8431 !! test
8432 Optional colon in #REDIRECT
8433 !! options
8434 # the colon is archaic syntax. we support it for wt2html, but we
8435 # don't care that it roundtrips back to the modern syntax.
8436 parsoid=wt2html,html2html
8437 !! wikitext
8438 #REDIRECT:[[Main Page]]
8439 !! html/parsoid
8440 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8441 !! end
8442
8443 !! test
8444 Whitespace in #REDIRECT with optional colon
8445 !! options
8446 # the colon and gratuitous whitespace is archaic syntax. we support
8447 # it for wt2html, but we don't care that it roundtrips back to the
8448 # modern syntax (without extra whitespace)
8449 parsoid=wt2html,html2html
8450 !! wikitext
8451
8452 #REDIRECT
8453 :
8454 [[Main Page]]
8455 !! html/parsoid
8456 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8457 !! end
8458
8459 !! test
8460 Piped link in #REDIRECT
8461 !! options
8462 # content after piped link is ignored. we support this syntax,
8463 # but don't care that the piped link is lost when we roundtrip this.
8464 parsoid=wt2html
8465 !! wikitext
8466 #REDIRECT [[Main Page|bar]]
8467 !! html/parsoid
8468 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8469 !! end
8470
8471 !! test
8472 Redirect to category (T104502)
8473 !! options
8474 parsoid=wt2html,wt2wt
8475 !! wikitext
8476 #REDIRECT [[Category:Foo]]
8477 !! html/parsoid
8478 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8479 !! end
8480
8481 !! test
8482 Redirect to category with URL encoding (T104502)
8483 !! options
8484 parsoid=wt2html
8485 !! wikitext
8486 #REDIRECT [[Category%3AFoo]]
8487 !! html/parsoid
8488 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8489 !! end
8490
8491 !! test
8492 Redirect to category page
8493 !! wikitext
8494 #REDIRECT [[:Category:Foo]]
8495 !! html/parsoid
8496 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8497 !! end
8498
8499 !! test
8500 Redirect to image page (1)
8501 !! wikitext
8502 #REDIRECT [[File:Wiki.png]]
8503 !! html/parsoid
8504 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8505 !! end
8506
8507 !! test
8508 Redirect to image page (2)
8509 !! wikitext
8510 #REDIRECT [[Image:Wiki.png]]
8511 !! html/parsoid
8512 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8513 !! end
8514
8515 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8516 # Next test confirms this.
8517 !! test
8518 Redirect to language (1) (T104918)
8519 !! options
8520 parsoid=wt2html,wt2wt,html2html
8521 !! wikitext
8522 #REDIRECT [[en:File:Wiki.png]]
8523 !! html/parsoid
8524 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8525 !! end
8526
8527 !! test
8528 Redirect to language (2) (T104918)
8529 !! wikitext
8530 #REDIRECT [[:en:File:Wiki.png]]
8531 !! html/parsoid
8532 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8533 !! end
8534
8535 !! test
8536 Redirect to interwiki (T104918)
8537 !! wikitext
8538 #REDIRECT [[meatball:File:Wiki.png]]
8539 !! html/parsoid
8540 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8541 !! end
8542
8543 !! test
8544 Non-English #REDIRECT
8545 !! options
8546 language=is
8547 !! wikitext
8548 #TILVÍSUN [[Main Page]]
8549 !! html/parsoid
8550 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8551 !! end
8552
8553 !! test
8554 Redirect syntax under text isn't considered a redirect
8555 !! wikitext
8556 some text
8557 #redirect [[Main Page]]
8558 !! html/parsoid
8559 <p>some text</p>
8560 <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>
8561 !! end
8562
8563 # FIXME: Should hoist the redirect to the top of the page and ensure there
8564 # is only one.
8565 !! test
8566 New redirect
8567 !! options
8568 parsoid=html2wt
8569 !! html/parsoid
8570 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8571 !! wikitext
8572 Foo
8573 #REDIRECT [[Foo]]
8574 !! end
8575
8576 ##
8577 ## XHTML tidiness
8578 ###
8579
8580 !! test
8581 <br> to <br />
8582 !! wikitext
8583 1<br>2<br />3
8584 !! html
8585 <p>1<br />2<br />3
8586 </p>
8587 !! end
8588
8589 !! test
8590 Broken br tag sanitization
8591 !! wikitext
8592 </br>
8593 !! html/php
8594 <p>&lt;/br&gt;
8595 </p>
8596 !! end
8597
8598 # TODO: Fix html2html mode (bug 51055)!
8599 !! test
8600 Parsoid: Broken br tag recognition
8601 !! options
8602 parsoid=wt2html
8603 !! wikitext
8604 </br>
8605
8606 <br/ >
8607 !! html+tidy
8608 <p><br /></p>
8609 <p><br /></p>
8610 !! end
8611
8612 !! test
8613 Incorrecly removing closing slashes from correctly formed XHTML
8614 !! wikitext
8615 <br style="clear:both;" />
8616 !! html
8617 <p><br style="clear:both;" />
8618 </p>
8619 !! end
8620
8621 !! test
8622 Failing to transform badly formed HTML into correct XHTML
8623 !! wikitext
8624 <br style="clear: left;">
8625 <br style="clear: right;">
8626 <br style="clear: both;">
8627 !! html
8628 <p><br style="clear: left;" />
8629 <br style="clear: right;" />
8630 <br style="clear: both;" />
8631 </p>
8632 !!end
8633
8634 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8635 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8636 !! test
8637 Handling html with a div self-closing tag
8638 !! wikitext
8639 <div title />
8640 <div title/>
8641 <div title/ >
8642 <div title=bar />
8643 <div title=bar/>
8644 <div title=bar/ >
8645 !! html/php
8646 <p>&lt;div title /&gt;
8647 &lt;div title/&gt;
8648 </p>
8649 <div>
8650 <p>&lt;div title=bar /&gt;
8651 &lt;div title=bar/&gt;
8652 </p>
8653 <div title="bar/"></div>
8654 </div>
8655
8656 !! html/parsoid
8657 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8658 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8659 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
8660 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8661 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8662 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
8663 !! end
8664
8665 !! test
8666 Handling html with a br self-closing tag
8667 !! wikitext
8668 <br title />
8669 <br title/>
8670 <br title/ >
8671 <br title=bar />
8672 <br title=bar/>
8673 <br title=bar/ >
8674 !! html/php
8675 <p><br title="" />
8676 <br title="" />
8677 <br />
8678 <br title="bar" />
8679 <br title="bar" />
8680 <br title="bar/" />
8681 </p>
8682 !! html/parsoid
8683 <p><br title="" />
8684 <br title="" />
8685 <br title="" />
8686 <br title="bar" />
8687 <br title="bar" />
8688 <br title="bar/" />
8689 </p>
8690 !! end
8691
8692 !! test
8693 Horizontal ruler (should it add that extra space?)
8694 !! wikitext
8695 <hr>
8696 <hr >
8697 foo <hr
8698 > bar
8699 !! html+tidy
8700 <hr />
8701 <hr />
8702 <p>foo</p>
8703 <hr />
8704 <p>bar</p>
8705 !! end
8706
8707 !! test
8708 Horizontal ruler -- 4+ dashes render hr
8709 !! wikitext
8710 ----
8711 !! html
8712 <hr />
8713
8714 !! end
8715
8716 !! test
8717 Horizontal ruler -- eats additional dashes on the same line
8718 !! wikitext
8719 ---------
8720 !! html
8721 <hr />
8722
8723 !! end
8724
8725 !! test
8726 Horizontal ruler -- does not collapse dashes on consecutive lines
8727 !! wikitext
8728 ----
8729 ----
8730 !! html
8731 <hr />
8732 <hr />
8733
8734 !! end
8735
8736 !! test
8737 Horizontal ruler -- <4 dashes render as plain text
8738 !! wikitext
8739 ---
8740 !! html
8741 <p>---
8742 </p>
8743 !! end
8744
8745 !! test
8746 Horizontal ruler -- Supports content following dashes on same line
8747 !! wikitext
8748 ---- Foo
8749 !! html
8750 <hr /> Foo
8751
8752 !! html+tidy
8753 <hr />
8754 <p>Foo</p>
8755 !! end
8756
8757 ###
8758 ### Block-level elements
8759 ###
8760 !! test
8761 Common list
8762 !! wikitext
8763 *Common list
8764 * item 2
8765 *item 3
8766 !! html
8767 <ul><li>Common list</li>
8768 <li> item 2</li>
8769 <li>item 3</li></ul>
8770
8771 !! end
8772
8773 !! test
8774 Numbered list
8775 !! wikitext
8776 #Numbered list
8777 #item 2
8778 # item 3
8779 !! html
8780 <ol><li>Numbered list</li>
8781 <li>item 2</li>
8782 <li> item 3</li></ol>
8783
8784 !! end
8785
8786 !! test
8787 Mixed list
8788 !! wikitext
8789 *Mixed list
8790 *# with numbers
8791 ** and bullets
8792 *# and numbers
8793 *bullets again
8794 **bullet level 2
8795 ***bullet level 3
8796 ***#Number on level 4
8797 **bullet level 2
8798 **#Number on level 3
8799 **#Number on level 3
8800 *#number level 2
8801 *Level 1
8802 *** Level 3
8803 #** Level 3, but ordered
8804 !! html
8805 <ul><li>Mixed list
8806 <ol><li> with numbers</li></ol>
8807 <ul><li> and bullets</li></ul>
8808 <ol><li> and numbers</li></ol></li>
8809 <li>bullets again
8810 <ul><li>bullet level 2
8811 <ul><li>bullet level 3
8812 <ol><li>Number on level 4</li></ol></li></ul></li>
8813 <li>bullet level 2
8814 <ol><li>Number on level 3</li>
8815 <li>Number on level 3</li></ol></li></ul>
8816 <ol><li>number level 2</li></ol></li>
8817 <li>Level 1
8818 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
8819 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
8820
8821 !! end
8822
8823 !! test
8824 1. Nested mixed wikitext and html list
8825 !! wikitext
8826 * hi
8827 * <ul><li>ho</li></ul>
8828 * hi
8829 ** ho
8830 !! html/php
8831 <ul><li> hi</li>
8832 <li> <ul><li>ho</li></ul></li>
8833 <li> hi
8834 <ul><li> ho</li></ul></li></ul>
8835
8836 !! html/parsoid
8837 <ul><li> hi</li>
8838 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
8839 <li> hi
8840 <ul><li> ho</li></ul></li></ul>
8841 !! end
8842
8843 !! test
8844 2. Nested mixed wikitext and html list (incompatible)
8845 !! wikitext
8846 ; hi
8847 : {{echo|<li>ho</li>}}
8848 !! html/php
8849 <dl><dt> hi</dt>
8850 <dd> <li>ho</li></dd></dl>
8851
8852 !! html/parsoid
8853 <dl><dt> hi</dt>
8854 <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>
8855 !! end
8856
8857 !! test
8858 Nested lists 1
8859 !! wikitext
8860 *foo
8861 **bar
8862 !! html
8863 <ul><li>foo
8864 <ul><li>bar</li></ul></li></ul>
8865
8866 !! end
8867
8868 !! test
8869 Nested lists 2
8870 !! wikitext
8871 **foo
8872 *bar
8873 !! html
8874 <ul><li><ul><li>foo</li></ul></li>
8875 <li>bar</li></ul>
8876
8877 !! end
8878
8879 !! test
8880 Nested lists 3 (first element empty)
8881 !! wikitext
8882 *
8883 **bar
8884 !! html
8885 <ul><li>
8886 <ul><li>bar</li></ul></li></ul>
8887
8888 !! end
8889
8890 !! test
8891 Nested lists 4 (first element empty)
8892 !! wikitext
8893 **
8894 *bar
8895 !! html
8896 <ul><li><ul><li></li></ul></li>
8897 <li>bar</li></ul>
8898
8899 !! end
8900
8901 !! test
8902 Nested lists 5 (both elements empty)
8903 !! wikitext
8904 **
8905 *
8906 !! html
8907 <ul><li><ul><li></li></ul></li>
8908 <li></li></ul>
8909
8910 !! end
8911
8912 !! test
8913 Nested lists 6 (both elements empty)
8914 !! wikitext
8915 *
8916 **
8917 !! html
8918 <ul><li>
8919 <ul><li></li></ul></li></ul>
8920
8921 !! end
8922
8923 !! test
8924 Nested lists 7 (skip initial nesting levels)
8925 !! wikitext
8926 *** foo
8927 !! html
8928 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
8929
8930 !! end
8931
8932 !! test
8933 Nested lists 8 (multiple nesting transitions)
8934 !! wikitext
8935 * foo
8936 *** bar
8937 ** baz
8938 * boo
8939 !! html
8940 <ul><li> foo
8941 <ul><li><ul><li> bar</li></ul></li>
8942 <li> baz</li></ul></li>
8943 <li> boo</li></ul>
8944
8945 !! end
8946
8947 !! test
8948 Nested lists 9 (extension interaction)
8949 !! options
8950 parsoid
8951 !! wikitext
8952 *<references />
8953 !! html/parsoid
8954 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
8955 !! end
8956
8957 !! test
8958 1. Lists with start-of-line-transparent tokens before bullets: Comments
8959 !! wikitext
8960 *foo
8961 *<!--cmt-->bar
8962 <!--cmt-->*baz
8963 !! html
8964 <ul><li>foo</li>
8965 <li>bar</li>
8966 <li>baz</li></ul>
8967
8968 !! end
8969
8970 !! test
8971 2. Lists with start-of-line-transparent tokens before bullets: Template close
8972 !! wikitext
8973 *foo {{echo|bar
8974 }}*baz
8975 !! html
8976 <ul><li>foo bar</li>
8977 <li>baz</li></ul>
8978
8979 !! end
8980
8981 !! test
8982 List items are not parsed correctly following a <pre> block (bug 785)
8983 !! wikitext
8984 * <pre>foo</pre>
8985 * <pre>bar</pre>
8986 * zar
8987 !! html/php
8988 <ul><li> <pre>foo</pre></li>
8989 <li> <pre>bar</pre></li>
8990 <li> zar</li></ul>
8991
8992 !! html/parsoid
8993 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
8994 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
8995 <li> zar</li></ul>
8996 !! end
8997
8998 !! test
8999 List items from template
9000 !! wikitext
9001
9002 {{inner list}}
9003 * item 2
9004
9005 * item 0
9006 {{inner list}}
9007 * item 2
9008
9009 * item 0
9010 * notSOL{{inner list}}
9011 * item 2
9012 !! html
9013 <ul><li> item 1</li>
9014 <li> item 2</li></ul>
9015 <ul><li> item 0</li>
9016 <li> item 1</li>
9017 <li> item 2</li></ul>
9018 <ul><li> item 0</li>
9019 <li> notSOL</li>
9020 <li> item 1</li>
9021 <li> item 2</li></ul>
9022
9023 !! end
9024
9025 !! test
9026 List interrupted by empty line or heading
9027 !! wikitext
9028 * foo
9029
9030 ** bar
9031 == A heading ==
9032 * Another list item
9033 !! html
9034 <ul><li> foo</li></ul>
9035 <ul><li><ul><li> bar</li></ul></li></ul>
9036 <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>
9037 <ul><li> Another list item</li></ul>
9038
9039 !!end
9040
9041 !!test
9042 Multiple list tags generated by templates
9043 !! wikitext
9044 {{echo|<li>}}a
9045 {{echo|<li>}}b
9046 {{echo|<li>}}c
9047 !! html
9048 <li>a
9049 <li>b
9050 <li>c</li>
9051 </li>
9052 </li>
9053
9054 !! html+tidy
9055 <ul>
9056 <li>a</li>
9057 <li>b</li>
9058 <li>c</li>
9059 </ul>
9060 !!end
9061
9062 !!test
9063 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9064 !! wikitext
9065 *a
9066 <!--This line will NOT split the list-->
9067 *b
9068 <!--This line will NOT split the list either-->
9069 *c
9070 <!--foo--> <!----> <!--This line NOT split the list either-->
9071 *d
9072 !! html
9073 <ul><li>a</li>
9074 <li>b</li>
9075 <li>c</li>
9076 <li>d</li></ul>
9077
9078 !!end
9079
9080 !!test
9081 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9082 !! wikitext
9083 *a
9084 <!--This line will NOT split the list-->
9085 *b
9086 <!--This line will NOT split the list either-->
9087 *c
9088 <!--foo--> <!----> <!--This line NOT split the list
9089 either-->
9090 *d
9091 !! html
9092 <ul><li>a</li>
9093 <li>b</li>
9094 <li>c</li>
9095 <li>d</li></ul>
9096
9097 !!end
9098
9099 !!test
9100 Test the li-hack
9101 (The PHP parser relies on Tidy for the hack)
9102 !!options
9103 parsoid=wt2html,wt2wt
9104 !! wikitext
9105 * foo
9106 * <li>li-hack
9107 * {{echo|<li>templated li-hack}}
9108 * <!--foo--> <li> unsupported li-hack with preceding comments
9109
9110 <ul>
9111 <li><li>not a li-hack
9112 </li>
9113 </ul>
9114 !! html+tidy
9115 <ul>
9116 <li>foo</li>
9117 <li>li-hack</li>
9118 <li>templated li-hack</li>
9119 <li>unsupported li-hack with preceding comments</li>
9120 </ul>
9121 <ul>
9122 <li>not a li-hack</li>
9123 </ul>
9124 !!end
9125
9126 !! test
9127 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9128 !! options
9129 parsoid
9130 !! wikitext
9131 # foo
9132 ## bar
9133 * foo
9134 ** bar
9135 : foo
9136 :: bar
9137 !! html
9138 <ol>
9139 <li> foo<ol>
9140 <li> bar</li>
9141 </ol></li>
9142 </ol><ul>
9143 <li> foo<ul>
9144 <li> bar</li>
9145 </ul></li>
9146 </ul><dl>
9147 <dd> foo<dl>
9148 <dd> bar</dd>
9149 </dl></dd>
9150 </dl>
9151 !! end
9152
9153 !! test
9154 Parsoid: Test of whitespace serialization with Templated bullets
9155 !! options
9156 parsoid
9157 !! wikitext
9158 * {{bullet}}
9159 !! html
9160 <ul>
9161 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9162 </ul>
9163 !! end
9164
9165 # ------------------------------------------------------------------------
9166 # The next set of tests are about Parsoid's ability to handle badly nested
9167 # tags (parse, minimize scope of fixup, and roundtrip back)
9168 # ------------------------------------------------------------------------
9169
9170 !! test
9171 Unbalanced closing block tags break a list
9172 (php parser relies on Tidy to fix up)
9173 !! wikitext
9174 <div>
9175 *a</div><div>
9176 *b</div>
9177 !! html+tidy
9178 <div>
9179 <ul>
9180 <li>a</li>
9181 </ul>
9182 </div>
9183 <div>
9184 <ul>
9185 <li>b</li>
9186 </ul>
9187 </div>
9188 !! end
9189
9190 # Parsoid fails this test, but it might be tricky to support properly.
9191 # See bug 68395.
9192 !! test
9193 Unbalanced closing non-block tags don't break a list
9194 (php parser relies on Tidy to fix up)
9195 !! wikitext
9196 <span>
9197 *a</span><span>
9198 *b</span>
9199 !! html/php+tidy
9200 <ul>
9201 <li><span>a</span></li>
9202 <li><span>b</span></li>
9203 </ul>
9204 !! html/parsoid
9205 <span>
9206 <ul>
9207 <li>a<span></span>
9208 </li>
9209 <li>b
9210 </li>
9211 </ul>
9212 </span>
9213 !! end
9214
9215 !! test
9216 Unclosed formatting tags that straddle lists are closed and reopened
9217 (php parser relies on Tidy to fix up)
9218 !! options
9219 parsoid=wt2html,wt2wt,html2html
9220 !! wikitext
9221 # <s> a
9222 # b </s>
9223 !! html/php+tidy
9224 <ol>
9225 <li><s>a</s></li>
9226 <li><s>b</s></li>
9227 </ol>
9228 !! html/parsoid
9229 <ol><li> <s> a</s></li>
9230 <li><s> b </s></li></ol>
9231 !! end
9232
9233 # See bug 68395.
9234 !!test
9235 1. List embedded in a formatting tag
9236 !! wikitext
9237 <small>
9238 * foo
9239 </small>
9240 !! html/php+tidy
9241 <ul>
9242 <li><small>foo</small></li>
9243 </ul>
9244 !! html/parsoid
9245 <small>
9246 <ul>
9247 <li> foo</li>
9248 </ul>
9249 </small>
9250 !!end
9251
9252 ## Ugly Parsoid output here
9253 ## Not sure what the right output is.
9254 !!test
9255 2. List embedded in a formatting tag
9256 !! wikitext
9257 <small>
9258 *a
9259 *b</small>
9260 !! html/php+tidy
9261 <ul>
9262 <li><small>a</small></li>
9263 <li><small>b</small></li>
9264 </ul>
9265 !! html/parsoid
9266 <small></small>
9267 <ul><small>
9268 <li>a</li>
9269 </small>
9270 <li><small>b</small></li>
9271 </ul>
9272 !!end
9273
9274 # Ugly Parsoid and PHP parser output here
9275 # Not sure if we want to make this a test!
9276 #
9277 ## !!test
9278 ## 3. Unclosed formatting tags in list elements
9279 ## !! wikitext
9280 ## *<small>a
9281 ## *<small>b
9282 ## !! html/php+tidy
9283 ## <ul>
9284 ## <li><small>a</small></li>
9285 ## <li><small><small>b</small></small></li>
9286 ## </ul>
9287 ## !! html/parsoid
9288 ## <ul>
9289 ## <li><small>a</small></li>
9290 ## <small>
9291 ## <li><small>b</small></li>
9292 ## </small></ul>
9293 ## !!end
9294
9295 # This is a bug in the PHP parser + tidy combination.
9296 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9297 # and then fostered out of the table by tidy.)
9298 # We believe the Parsoid output to be correct.
9299 !! test
9300 Table with missing opening <tr> tag
9301 !! options
9302 parsoid=wt2html,wt2wt
9303 !! wikitext
9304 <table>
9305 <td>foo</td>
9306 </tr>
9307 </table>
9308 !! html+tidy
9309 <table>
9310 <tr>
9311 <td>foo</td>
9312 </tr>
9313 </table>
9314 !! end
9315
9316 ###
9317 ### Magic Words
9318 ###
9319
9320 # Note that the current date is hard-coded as
9321 # 1970-01-01T00:02:03Z (a Thursday)
9322 # when running parser tests. The timezone is also fixed to GMT, so
9323 # local date will be identical to current date.
9324
9325 !! test
9326 Magic Word: {{CURRENTDAY}}
9327 !! wikitext
9328 {{CURRENTDAY}}
9329 !! html
9330 <p>1
9331 </p>
9332 !! end
9333
9334 !! test
9335 Magic Word: {{CURRENTDAY2}}
9336 !! wikitext
9337 {{CURRENTDAY2}}
9338 !! html
9339 <p>01
9340 </p>
9341 !! end
9342
9343 !! test
9344 Magic Word: {{CURRENTDAYNAME}}
9345 !! wikitext
9346 {{CURRENTDAYNAME}}
9347 !! html
9348 <p>Thursday
9349 </p>
9350 !! end
9351
9352 !! test
9353 Magic Word: {{CURRENTDOW}}
9354 !! wikitext
9355 {{CURRENTDOW}}
9356 !! html
9357 <p>4
9358 </p>
9359 !! end
9360
9361 !! test
9362 Magic Word: {{CURRENTMONTH}}
9363 !! wikitext
9364 {{CURRENTMONTH}}
9365 !! html
9366 <p>01
9367 </p>
9368 !! end
9369
9370 !! test
9371 Magic Word: {{CURRENTMONTH1}}
9372 !! wikitext
9373 {{CURRENTMONTH1}}
9374 !! html
9375 <p>1
9376 </p>
9377 !! end
9378
9379 !! test
9380 Magic Word: {{CURRENTMONTHABBREV}}
9381 !! wikitext
9382 {{CURRENTMONTHABBREV}}
9383 !! html
9384 <p>Jan
9385 </p>
9386 !! end
9387
9388 !! test
9389 Magic Word: {{CURRENTMONTHNAME}}
9390 !! wikitext
9391 {{CURRENTMONTHNAME}}
9392 !! html
9393 <p>January
9394 </p>
9395 !! end
9396
9397 !! test
9398 Magic Word: {{CURRENTMONTHNAMEGEN}}
9399 !! wikitext
9400 {{CURRENTMONTHNAMEGEN}}
9401 !! html
9402 <p>January
9403 </p>
9404 !! end
9405
9406 !! test
9407 Magic Word: {{CURRENTTIME}}
9408 !! wikitext
9409 {{CURRENTTIME}}
9410 !! html
9411 <p>00:02
9412 </p>
9413 !! end
9414
9415 !! test
9416 Magic Word: {{CURRENTHOUR}}
9417 !! wikitext
9418 {{CURRENTHOUR}}
9419 !! html
9420 <p>00
9421 </p>
9422 !! end
9423
9424 !! test
9425 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9426 !! wikitext
9427 {{CURRENTWEEK}}
9428 !! html
9429 <p>1
9430 </p>
9431 !! end
9432
9433 !! test
9434 Magic Word: {{CURRENTYEAR}}
9435 !! wikitext
9436 {{CURRENTYEAR}}
9437 !! html
9438 <p>1970
9439 </p>
9440 !! end
9441
9442 !! test
9443 Magic Word: {{CURRENTTIMESTAMP}}
9444 !! wikitext
9445 {{CURRENTTIMESTAMP}}
9446 !! html
9447 <p>19700101000203
9448 </p>
9449 !! end
9450
9451 !! test
9452 Magic Words LOCAL (UTC)
9453 !! wikitext
9454 * {{LOCALMONTH}}
9455 * {{LOCALMONTH1}}
9456 * {{LOCALMONTHNAME}}
9457 * {{LOCALMONTHNAMEGEN}}
9458 * {{LOCALMONTHABBREV}}
9459 * {{LOCALDAY}}
9460 * {{LOCALDAY2}}
9461 * {{LOCALDAYNAME}}
9462 * {{LOCALYEAR}}
9463 * {{LOCALTIME}}
9464 * {{LOCALHOUR}}
9465 * {{LOCALWEEK}}
9466 * {{LOCALDOW}}
9467 * {{LOCALTIMESTAMP}}
9468 !! html
9469 <ul><li> 01</li>
9470 <li> 1</li>
9471 <li> January</li>
9472 <li> January</li>
9473 <li> Jan</li>
9474 <li> 1</li>
9475 <li> 01</li>
9476 <li> Thursday</li>
9477 <li> 1970</li>
9478 <li> 00:02</li>
9479 <li> 00</li>
9480 <li> 1</li>
9481 <li> 4</li>
9482 <li> 19700101000203</li></ul>
9483
9484 !! end
9485
9486 !! test
9487 Magic Word: {{FULLPAGENAME}}
9488 !! options
9489 title=[[User:Ævar Arnfjörð Bjarmason]]
9490 !! wikitext
9491 {{FULLPAGENAME}}
9492 !! html
9493 <p>User:Ævar Arnfjörð Bjarmason
9494 </p>
9495 !! end
9496
9497 !! test
9498 Magic Word: {{FULLPAGENAMEE}}
9499 !! options
9500 title=[[User:Ævar Arnfjörð Bjarmason]]
9501 !! wikitext
9502 {{FULLPAGENAMEE}}
9503 !! html
9504 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9505 </p>
9506 !! end
9507
9508 !! test
9509 Magic Word: {{TALKSPACE}}
9510 !! options
9511 title=[[User:Ævar Arnfjörð Bjarmason]]
9512 !! wikitext
9513 {{TALKSPACE}}
9514 !! html
9515 <p>User talk
9516 </p>
9517 !! end
9518
9519 !! test
9520 Magic Word: {{TALKSPACE}}, same namespace
9521 !! options
9522 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9523 !! wikitext
9524 {{TALKSPACE}}
9525 !! html
9526 <p>User talk
9527 </p>
9528 !! end
9529
9530 !! test
9531 Magic Word: {{TALKSPACE}}, main namespace
9532 !! options
9533 title=[[Parser Test]]
9534 !! wikitext
9535 {{TALKSPACE}}
9536 !! html
9537 <p>Talk
9538 </p>
9539 !! end
9540
9541 !! test
9542 Magic Word: {{TALKSPACEE}}
9543 !! options
9544 title=[[User:Ævar Arnfjörð Bjarmason]]
9545 !! wikitext
9546 {{TALKSPACEE}}
9547 !! html
9548 <p>User_talk
9549 </p>
9550 !! end
9551
9552 !! test
9553 Magic Word: {{SUBJECTSPACE}}
9554 !! options
9555 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9556 !! wikitext
9557 {{SUBJECTSPACE}}
9558 !! html
9559 <p>User
9560 </p>
9561 !! end
9562
9563 !! test
9564 Magic Word: {{SUBJECTSPACE}}, same namespace
9565 !! options
9566 title=[[User:Ævar Arnfjörð Bjarmason]]
9567 !! wikitext
9568 {{SUBJECTSPACE}}
9569 !! html
9570 <p>User
9571 </p>
9572 !! end
9573
9574 !! test
9575 Magic Word: {{SUBJECTSPACE}}, main namespace
9576 !! options
9577 title=[[Parser Test]]
9578 !! wikitext
9579 {{SUBJECTSPACE}}
9580 !! html
9581
9582 !! end
9583
9584 !! test
9585 Magic Word: {{SUBJECTSPACEE}}
9586 !! options
9587 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9588 !! wikitext
9589 {{SUBJECTSPACEE}}
9590 !! html
9591 <p>User
9592 </p>
9593 !! end
9594
9595 !! test
9596 Magic Word: {{NAMESPACE}}
9597 !! options
9598 title=[[User:Ævar Arnfjörð Bjarmason]]
9599 !! wikitext
9600 {{NAMESPACE}}
9601 !! html
9602 <p>User
9603 </p>
9604 !! end
9605
9606 !! test
9607 Magic Word: {{NAMESPACEE}}
9608 !! options
9609 title=[[User:Ævar Arnfjörð Bjarmason]]
9610 !! wikitext
9611 {{NAMESPACEE}}
9612 !! html
9613 <p>User
9614 </p>
9615 !! end
9616
9617 !! test
9618 Magic Word: {{NAMESPACENUMBER}}
9619 !! options
9620 title=[[User:Ævar Arnfjörð Bjarmason]]
9621 !! wikitext
9622 {{NAMESPACENUMBER}}
9623 !! html
9624 <p>2
9625 </p>
9626 !! end
9627
9628 !! test
9629 Magic Word: {{SUBPAGENAME}}
9630 !! options
9631 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9632 !! wikitext
9633 {{SUBPAGENAME}}
9634 !! html
9635 <p>sub ö
9636 </p>
9637 !! end
9638
9639 !! test
9640 Magic Word: {{SUBPAGENAMEE}}
9641 !! options
9642 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9643 !! wikitext
9644 {{SUBPAGENAMEE}}
9645 !! html
9646 <p>sub_%C3%B6
9647 </p>
9648 !! end
9649
9650 !! test
9651 Magic Word: {{ROOTPAGENAME}}
9652 !! options
9653 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9654 !! wikitext
9655 {{ROOTPAGENAME}}
9656 !! html
9657 <p>Ævar Arnfjörð Bjarmason
9658 </p>
9659 !! end
9660
9661 !! test
9662 Magic Word: {{ROOTPAGENAMEE}}
9663 !! options
9664 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9665 !! wikitext
9666 {{ROOTPAGENAMEE}}
9667 !! html
9668 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9669 </p>
9670 !! end
9671
9672 !! test
9673 Magic Word: {{BASEPAGENAME}}
9674 !! options
9675 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9676 !! wikitext
9677 {{BASEPAGENAME}}
9678 !! html
9679 <p>Ævar Arnfjörð Bjarmason
9680 </p>
9681 !! end
9682
9683 !! test
9684 Magic Word: {{BASEPAGENAMEE}}
9685 !! options
9686 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9687 !! wikitext
9688 {{BASEPAGENAMEE}}
9689 !! html
9690 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9691 </p>
9692 !! end
9693
9694 !! test
9695 Magic Word: {{TALKPAGENAME}}
9696 !! options
9697 title=[[User:Ævar Arnfjörð Bjarmason]]
9698 !! wikitext
9699 {{TALKPAGENAME}}
9700 !! html
9701 <p>User talk:Ævar Arnfjörð Bjarmason
9702 </p>
9703 !! end
9704
9705 !! test
9706 Magic Word: {{TALKPAGENAMEE}}
9707 !! options
9708 title=[[User:Ævar Arnfjörð Bjarmason]]
9709 !! wikitext
9710 {{TALKPAGENAMEE}}
9711 !! html
9712 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9713 </p>
9714 !! end
9715
9716 !! test
9717 Magic Word: {{SUBJECTPAGENAME}}
9718 !! options
9719 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9720 !! wikitext
9721 {{SUBJECTPAGENAME}}
9722 !! html
9723 <p>User:Ævar Arnfjörð Bjarmason
9724 </p>
9725 !! end
9726
9727 !! test
9728 Magic Word: {{SUBJECTPAGENAMEE}}
9729 !! options
9730 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9731 !! wikitext
9732 {{SUBJECTPAGENAMEE}}
9733 !! html
9734 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9735 </p>
9736 !! end
9737
9738 !! test
9739 Magic Word: {{NUMBEROFFILES}}
9740 !! wikitext
9741 {{NUMBEROFFILES}}
9742 !! html
9743 <p>6
9744 </p>
9745 !! end
9746
9747 !! test
9748 Magic Word: {{PAGENAME}}
9749 !! options
9750 title=[[User:Ævar Arnfjörð Bjarmason]]
9751 !! wikitext
9752 {{PAGENAME}}
9753 !! html
9754 <p>Ævar Arnfjörð Bjarmason
9755 </p>
9756 !! end
9757
9758 !! test
9759 Magic Word: {{PAGENAME}} with metacharacters
9760 !! options
9761 title=[['foo & bar = baz']]
9762 !! wikitext
9763 ''{{PAGENAME}}''
9764 !! html/php
9765 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
9766 </p>
9767 !! html+tidy
9768 <p><i>'foo &amp; bar = baz'</i></p>
9769 !! end
9770
9771 !! test
9772 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
9773 !! options
9774 title=[[*RFC 1234 http://example.com/]]
9775 !! wikitext
9776 {{PAGENAME}}
9777 !! html/php
9778 <p>&#42;RFC&#32;1234 http&#58;//example.com/
9779 </p>
9780 !! html+tidy
9781 <p>*RFC 1234 http://example.com/</p>
9782 !! end
9783
9784 !! test
9785 Magic Word: {{PAGENAMEE}}
9786 !! options
9787 title=[[User:Ævar Arnfjörð Bjarmason]]
9788 !! wikitext
9789 {{PAGENAMEE}}
9790 !! html
9791 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9792 </p>
9793 !! end
9794
9795 !! test
9796 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
9797 !! options
9798 title=[[*RFC 1234 http://example.com/]]
9799 !! wikitext
9800 {{PAGENAMEE}}
9801 !! html/php
9802 <p>&#42;RFC_1234_http&#58;//example.com/
9803 </p>
9804 !! html+tidy
9805 <p>*RFC_1234_http://example.com/</p>
9806 !! end
9807
9808 !! test
9809 Magic Word: {{REVISIONID}}
9810 !! wikitext
9811 {{REVISIONID}}
9812 !! html
9813 <p>1337
9814 </p>
9815 !! end
9816
9817 !! test
9818 Magic Word: {{SCRIPTPATH}}
9819 !! wikitext
9820 {{SCRIPTPATH}}
9821 !! html
9822
9823 !! end
9824
9825 !! test
9826 Magic Word: {{STYLEPATH}}
9827 !! wikitext
9828 {{STYLEPATH}}
9829 !! html
9830 <p>/skins
9831 </p>
9832 !! end
9833
9834 !! test
9835 Magic Word: {{SERVER}}
9836 !! wikitext
9837 {{SERVER}}
9838 !! html
9839 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9840 </p>
9841 !! end
9842
9843 !! test
9844 Magic Word: {{SERVERNAME}}
9845 !! wikitext
9846 {{SERVERNAME}}
9847 !! html
9848 <p>example.org
9849 </p>
9850 !! end
9851
9852 !! test
9853 Magic Word: {{SITENAME}}
9854 !! wikitext
9855 {{SITENAME}}
9856 !! html
9857 <p>MediaWiki
9858 </p>
9859 !! end
9860
9861 !! test
9862 Case-sensitive magic words, when cased differently, should just be template transclusions
9863 !! wikitext
9864 {{CurrentMonth}}
9865 {{currentday}}
9866 {{cURreNTweEK}}
9867 {{currentHour}}
9868 !! html
9869 <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>
9870 <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>
9871 <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>
9872 <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>
9873 </p>
9874 !! end
9875
9876 !! test
9877 Case-insensitive magic words should still work with weird casing.
9878 !! wikitext
9879 {{sErVeRNaMe}}
9880 {{LCFirst:AOEU}}
9881 {{ucFIRST:aoeu}}
9882 {{SERver}}
9883 !! html
9884 <p>example.org
9885 aOEU
9886 Aoeu
9887 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9888 </p>
9889 !! end
9890
9891 # From plwiki:PLOS_ONE
9892 !! test
9893 Parsoid: Page property magic word with magic word contents
9894 !! wikitext
9895 {{DISPLAYTITLE:''{{PAGENAME}}''}}
9896 !! html/parsoid
9897 <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>"}]]}'/>
9898 !! end
9899
9900 !! test
9901 Parsoid: Template-generated DISPLAYTITLE
9902 !! wikitext
9903 {{{{echo|DISPLAYTITLE}}:Foo}}
9904 !! html/parsoid
9905 <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}}]}'/>
9906 !! end
9907
9908 !! test
9909 Namespace 1 {{ns:1}}
9910 !! wikitext
9911 {{ns:1}}
9912 !! html
9913 <p>Talk
9914 </p>
9915 !! end
9916
9917 !! test
9918 Namespace 1 {{ns:01}}
9919 !! wikitext
9920 {{ns:01}}
9921 !! html
9922 <p>Talk
9923 </p>
9924 !! end
9925
9926 !! test
9927 Namespace 0 {{ns:0}} (bug 4783)
9928 !! wikitext
9929 {{ns:0}}
9930 !! html
9931
9932 !! end
9933
9934 !! test
9935 Namespace 0 {{ns:00}} (bug 4783)
9936 !! wikitext
9937 {{ns:00}}
9938 !! html
9939
9940 !! end
9941
9942 !! test
9943 Namespace -1 {{ns:-1}}
9944 !! wikitext
9945 {{ns:-1}}
9946 !! html
9947 <p>Special
9948 </p>
9949 !! end
9950
9951 !! test
9952 Namespace User {{ns:User}}
9953 !! wikitext
9954 {{ns:User}}
9955 !! html
9956 <p>User
9957 </p>
9958 !! end
9959
9960 !! test
9961 Namespace User talk {{ns:User_talk}}
9962 !! wikitext
9963 {{ns:User_talk}}
9964 !! html
9965 <p>User talk
9966 </p>
9967 !! end
9968
9969 !! test
9970 Namespace User talk {{ns:uSeR tAlK}}
9971 !! wikitext
9972 {{ns:uSeR tAlK}}
9973 !! html
9974 <p>User talk
9975 </p>
9976 !! end
9977
9978 !! test
9979 Namespace File {{ns:File}}
9980 !! wikitext
9981 {{ns:File}}
9982 !! html
9983 <p>File
9984 </p>
9985 !! end
9986
9987 !! test
9988 Namespace File {{ns:Image}}
9989 !! wikitext
9990 {{ns:Image}}
9991 !! html
9992 <p>File
9993 </p>
9994 !! end
9995
9996 !! test
9997 Namespace (lang=de) Benutzer {{ns:User}}
9998 !! options
9999 language=de
10000 !! wikitext
10001 {{ns:User}}
10002 !! html
10003 <p>Benutzer
10004 </p>
10005 !! end
10006
10007 !! test
10008 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10009 !! options
10010 language=de
10011 !! wikitext
10012 {{ns:3}}
10013 !! html
10014 <p>Benutzer Diskussion
10015 </p>
10016 !! end
10017
10018
10019 !! test
10020 Urlencode
10021 !! wikitext
10022 {{urlencode:hi world?!}}
10023 {{urlencode:hi world?!|WIKI}}
10024 {{urlencode:hi world?!|PATH}}
10025 {{urlencode:hi world?!|QUERY}}
10026 !! html
10027 <p>hi+world%3F%21
10028 hi_world%3F!
10029 hi%20world%3F%21
10030 hi+world%3F%21
10031 </p>
10032 !! end
10033
10034 !! test
10035 Magic Word: prioritize type info over data-parsoid
10036 !! options
10037 parsoid=html2wt
10038 !! html/parsoid
10039 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10040 !! wikitext
10041 __FORCETOC__
10042 !! end
10043
10044 !! test
10045 Magic Word: serialize on separate line (parsoid)
10046 !! options
10047 parsoid=wt2wt,html2wt
10048 !! wikitext
10049 foo
10050 __NOTOC__
10051 bar
10052 !! html/parsoid
10053 foo<meta property="mw:PageProp/notoc"/>bar
10054 !! end
10055
10056 !! test
10057 Magic Word: rt non-english wikis
10058 !! options
10059 parsoid=wt2wt
10060 language=de
10061 !! wikitext
10062 __NOEDITSECTION__
10063 !! html/parsoid
10064 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10065 !! end
10066
10067 !!test
10068 __proto__ is treated as normal wikitext (T105997)
10069 !!wikitext
10070 __proto__
10071 !!html
10072 <p>__proto__
10073 </p>
10074 !!end
10075
10076 ###
10077 ### Magic links
10078 ###
10079 !! test
10080 Magic links: internal link to RFC (bug 479)
10081 !! wikitext
10082 [[RFC 123]]
10083 !! html/php
10084 <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>
10085 </p>
10086 !! html/parsoid
10087 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10088 !! end
10089
10090 !! test
10091 Magic links: RFC (bug 479)
10092 !! wikitext
10093 RFC 822
10094 !! html/php
10095 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10096 </p>
10097 !! html/parsoid
10098 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10099 !! end
10100
10101 !! test
10102 Magic links: RFC (bug 65278)
10103 !! wikitext
10104 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10105 !! html/php
10106 <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.
10107 </p>
10108 !! html/parsoid
10109 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10110 !! end
10111
10112 !! test
10113 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
10114 !! wikitext
10115 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10116 RFC
10117 822
10118 !! html/php
10119 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10120 RFC
10121 822
10122 </p>
10123 !! html/parsoid
10124 <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>
10125 RFC
10126 822</p>
10127 !! end
10128
10129 !! test
10130 Magic links: ISBN (bug 1937)
10131 !! wikitext
10132 ISBN 0-306-40615-2
10133 !! html/php
10134 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10135 </p>
10136 !! html/parsoid
10137 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10138 !! end
10139
10140 !! test
10141 Magic links: ISBN (bug 65278)
10142 !! wikitext
10143 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10144 !! html/php
10145 <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.
10146 </p>
10147 !! html/parsoid
10148 <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>
10149 !! end
10150
10151 !! test
10152 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10153 !! wikitext
10154 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10155 ISBN
10156 9780316098113
10157 ISBN 978
10158 0316098113
10159 !! html/php
10160 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10161 ISBN
10162 9780316098113
10163 ISBN 978
10164 0316098113
10165 </p>
10166 !! html/parsoid
10167 <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>
10168 ISBN
10169 9780316098113
10170 ISBN 978
10171 0316098113</p>
10172 !! end
10173
10174 !! test
10175 Magic links: PMID incorrectly converts space to underscore
10176 !! wikitext
10177 PMID 1234
10178 !! html/php
10179 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10180 </p>
10181 !! html/parsoid
10182 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10183 !! end
10184
10185 !! test
10186 Magic links: PMID (bug 65278)
10187 !! wikitext
10188 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10189 !! html/php
10190 <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.
10191 </p>
10192 !! html/parsoid
10193 <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>
10194 !! end
10195
10196 !! test
10197 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10198 !! wikitext
10199 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10200 PMID
10201 1234
10202 !! html/php
10203 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10204 PMID
10205 1234
10206 </p>
10207 !! html/parsoid
10208 <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>
10209 PMID
10210 1234</p>
10211 !! end
10212
10213 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10214 # since these are ExtLinkText, not MagicLinkText
10215 !! test
10216 Magic links: use appropriate serialization for "almost" magic links.
10217 !! wikitext
10218 X[[Special:BookSources/0978739256|foo]]
10219
10220 X[//tools.ietf.org/html/rfc1234 foo]
10221 !! html/php
10222 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10223 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10224 </p>
10225 !! html/parsoid
10226 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10227 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10228 !! end
10229
10230 ###
10231 ### Templates
10232 ####
10233
10234 !! test
10235 Nonexistent template
10236 !! wikitext
10237 {{thistemplatedoesnotexist}}
10238 !! html
10239 <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>
10240 </p>
10241 !! end
10242
10243 !! test
10244 Template with invalid target containing tags
10245 !! wikitext
10246 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10247 !! html
10248 <p>{{a<b>b</b>|foo|a=b|a = b}}
10249 </p>
10250 !! end
10251
10252 !! test
10253 Template with invalid target containing unclosed tag
10254 !! wikitext
10255 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10256 !! html
10257 <p>{{a<b>|foo|a=b|a = b}}</b>
10258 </p>
10259 !! end
10260
10261 !! test
10262 Template with invalid target containing wikilink
10263 !! wikitext
10264 {{[[Main Page]]}}
10265 !! html/php
10266 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10267 </p>
10268 !! html/parsoid
10269 <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>
10270 !! end
10271
10272 !! test
10273 Template with just whitespace in it, bug #68421
10274 !! wikitext
10275 {{echo|{{ }}}}
10276 !! html/parsoid
10277 <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>
10278 !! end
10279
10280 !! article
10281 Template:test
10282 !! text
10283 This is a test template
10284 !! endarticle
10285
10286 !! test
10287 Simple template
10288 !! wikitext
10289 {{test}}
10290 !! html
10291 <p>This is a test template
10292 </p>
10293 !! end
10294
10295 !! test
10296 Template with explicit namespace
10297 !! wikitext
10298 {{Template:test}}
10299 !! html
10300 <p>This is a test template
10301 </p>
10302 !! end
10303
10304
10305 !! article
10306 Template:paramtest
10307 !! text
10308 This is a test template with parameter {{{param}}}
10309 !! endarticle
10310
10311 !! test
10312 Template parameter
10313 !! wikitext
10314 {{paramtest|param=foo}}
10315 !! html
10316 <p>This is a test template with parameter foo
10317 </p>
10318 !! end
10319
10320 !! article
10321 Template:paramtestnum
10322 !! text
10323 [[{{{1}}}|{{{2}}}]]
10324 !! endarticle
10325
10326 !! test
10327 Template unnamed parameter
10328 !! wikitext
10329 {{paramtestnum|Main Page|the main page}}
10330 !! html
10331 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10332 </p>
10333 !! end
10334
10335 !! article
10336 Template:templatesimple
10337 !! text
10338 (test)
10339 !! endarticle
10340
10341 !! article
10342 Template:templateredirect
10343 !! text
10344 #redirect [[Template:templatesimple]]
10345 !! endarticle
10346
10347 !! article
10348 Template:templateasargtestnum
10349 !! text
10350 {{{{{1}}}}}
10351 !! endarticle
10352
10353 !! article
10354 Template:templateasargtest
10355 !! text
10356 {{template{{{templ}}}}}
10357 !! endarticle
10358
10359 !! article
10360 Template:templateasargtest2
10361 !! text
10362 {{{{{templ}}}}}
10363 !! endarticle
10364
10365 !! test
10366 Template with template name as unnamed argument
10367 !! wikitext
10368 {{templateasargtestnum|templatesimple}}
10369 !! html
10370 <p>(test)
10371 </p>
10372 !! end
10373
10374 !! test
10375 Template with template name as argument
10376 !! wikitext
10377 {{templateasargtest|templ=simple}}
10378 !! html
10379 <p>(test)
10380 </p>
10381 !! end
10382
10383 !! test
10384 Template with template name as argument (2)
10385 !! wikitext
10386 {{templateasargtest2|templ=templatesimple}}
10387 !! html
10388 <p>(test)
10389 </p>
10390 !! end
10391
10392 !! article
10393 Template:templateasargtestdefault
10394 !! text
10395 {{{{{templ|templatesimple}}}}}
10396 !! endarticle
10397
10398 !! article
10399 Template:templa
10400 !! text
10401 '''templ'''
10402 !! endarticle
10403
10404 !! test
10405 Template with default value
10406 !! wikitext
10407 {{templateasargtestdefault}}
10408 !! html
10409 <p>(test)
10410 </p>
10411 !! end
10412
10413 !! test
10414 Template with default value (value set)
10415 !! wikitext
10416 {{templateasargtestdefault|templ=templa}}
10417 !! html
10418 <p><b>templ</b>
10419 </p>
10420 !! end
10421
10422 !! test
10423 Template redirect
10424 !! wikitext
10425 {{templateredirect}}
10426 !! html/php
10427 <p>(test)
10428 </p>
10429 !! html/parsoid
10430 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10431 !! end
10432
10433 !! test
10434 Template with argument in separate line
10435 !! wikitext
10436 {{ templateasargtest |
10437 templ = simple }}
10438 !! html
10439 <p>(test)
10440 </p>
10441 !! end
10442
10443 !! test
10444 Template with complex template as argument
10445 !! wikitext
10446 {{paramtest|
10447 param ={{ templateasargtest |
10448 templ = simple }}}}
10449 !! html
10450 <p>This is a test template with parameter (test)
10451 </p>
10452 !! end
10453
10454 !! test
10455 Template with thumb image (with link in description)
10456 !! wikitext
10457 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10458 !! html/php
10459 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>
10460
10461 !! html+tidy
10462 <p>This is a test template with parameter</p>
10463 <div class="thumb tright">
10464 <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>
10465 <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>
10466 </div>
10467 </div>
10468 !! html/parsoid
10469 <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>
10470 !! end
10471
10472 !! article
10473 Template:complextemplate
10474 !! text
10475 {{{1}}} {{paramtest|
10476 param ={{{param}}}}}
10477 !! endarticle
10478
10479 !! test
10480 Template with complex arguments
10481 !! wikitext
10482 {{complextemplate|
10483 param ={{ templateasargtest |
10484 templ = simple }}|[[Template:complextemplate|link]]}}
10485 !! html
10486 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10487 </p>
10488 !! end
10489
10490 !! test
10491 BUG 553: link with two variables in a piped link
10492 !! wikitext
10493 {|
10494 |[[{{{1}}}|{{{2}}}]]
10495 |}
10496 !! html/php
10497 <table>
10498 <tr>
10499 <td>[[{{{1}}}|{{{2}}}]]
10500 </td></tr></table>
10501
10502 !! html/parsoid
10503 <table>
10504 <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>
10505 !! end
10506
10507 # See: T2553
10508 !! test
10509 Abort table cell attribute parsing on wikilink
10510 !! wikitext
10511 {|
10512 | testing [[one|two]] | three || four
10513 | testing one two | three || four
10514 | testing="[[one|two]]" | three || four
10515 |}
10516 !! html/php
10517 <table>
10518 <tr>
10519 <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>
10520 <td> four
10521 </td>
10522 <td> three </td>
10523 <td> four
10524 </td>
10525 <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>
10526 <td> four
10527 </td></tr></table>
10528
10529 !! html/parsoid
10530 <table>
10531 <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>
10532 <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>
10533 <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>
10534 </tbody></table>
10535 !! end
10536
10537 !! test
10538 Don't abort table cell attribute parsing if wikilink is found in template arg
10539 !! wikitext
10540 {|
10541 | Test {{#tag:ref|One two "[[three]]" four}}
10542 |}
10543 !! html/parsoid
10544 <table>
10545 <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>
10546 </tbody></table>
10547 !! end
10548
10549 !! test
10550 Magic variable as template parameter
10551 !! wikitext
10552 {{paramtest|param={{SITENAME}}}}
10553 !! html
10554 <p>This is a test template with parameter MediaWiki
10555 </p>
10556 !! end
10557
10558 !! article
10559 Template:linktest
10560 !! text
10561 [[{{{param}}}|link]]
10562 !! endarticle
10563
10564 !! test
10565 Template parameter as link source
10566 !! wikitext
10567 {{linktest|param=Main Page}}
10568 !! html
10569 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10570 </p>
10571 !! end
10572
10573 !!article
10574 Template:paramtest2
10575 !! text
10576 including another template, {{paramtest|param={{{arg}}}}}
10577 !! endarticle
10578
10579 !! test
10580 Template passing argument to another template
10581 !! wikitext
10582 {{paramtest2|arg='hmm'}}
10583 !! html
10584 <p>including another template, This is a test template with parameter 'hmm'
10585 </p>
10586 !! end
10587
10588 !! article
10589 Template:Linktest2
10590 !! text
10591 Main Page
10592 !! endarticle
10593
10594 !! test
10595 Template as link source
10596 !! wikitext
10597 [[{{linktest2}}]]
10598
10599 [[{{linktest2}}|Main Page]]
10600
10601 [[{{linktest2}}]]Page
10602 !! html
10603 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10604 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10605 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10606 </p>
10607 !! end
10608
10609
10610 !! article
10611 Template:loop1
10612 !! text
10613 {{loop2}}
10614 !! endarticle
10615
10616 !! article
10617 Template:loop2
10618 !! text
10619 {{loop1}}
10620 !! endarticle
10621
10622 !! test
10623 Template infinite loop
10624 !! wikitext
10625 {{loop1}}
10626 !! html
10627 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10628 </p>
10629 !! end
10630
10631 !! test
10632 Template from main namespace
10633 !! wikitext
10634 {{:Main Page}}
10635 !! html
10636 <p>blah blah
10637 </p>
10638 !! end
10639
10640 !! article
10641 Template:table
10642 !! text
10643 {|
10644 | 1 || 2
10645 |-
10646 | 3 || 4
10647 |}
10648 !! endarticle
10649
10650 !! test
10651 BUG 529: Template with table, not included at beginning of line
10652 !! wikitext
10653 foo {{table}}
10654 !! html
10655 <p>foo
10656 </p>
10657 <table>
10658 <tr>
10659 <td> 1 </td>
10660 <td> 2
10661 </td></tr>
10662 <tr>
10663 <td> 3 </td>
10664 <td> 4
10665 </td></tr></table>
10666
10667 !! end
10668
10669 !! test
10670 BUG 523: Template shouldn't eat newline (or add an extra one before table)
10671 !! wikitext
10672 foo
10673 {{table}}
10674 !! html
10675 <p>foo
10676 </p>
10677 <table>
10678 <tr>
10679 <td> 1 </td>
10680 <td> 2
10681 </td></tr>
10682 <tr>
10683 <td> 3 </td>
10684 <td> 4
10685 </td></tr></table>
10686
10687 !! end
10688
10689 !! test
10690 BUG 41: Template parameters shown as broken links
10691 !! wikitext
10692 {{{parameter}}}
10693 !! html
10694 <p>{{{parameter}}}
10695 </p>
10696 !! end
10697
10698 !! test
10699 Template with targets containing wikilinks
10700 !! wikitext
10701 {{[[foo]]}}
10702
10703 {{[[{{echo|foo}}]]}}
10704
10705 {{{{echo|[[foo}}]]}}
10706 !! html
10707 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10708 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10709 </p><p>{{[[foo}}]]
10710 </p>
10711 !! end
10712
10713 !! article
10714 Template:''
10715 !! text
10716 bar
10717 !! endarticle
10718
10719 !! test
10720 Templates: Double quotes as template target
10721 !! wikitext
10722 foo {{''}} baz
10723 !! html/php
10724 <p>foo bar baz
10725 </p>
10726 !! html/parsoid
10727 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
10728 </p>
10729 !! end
10730
10731 ## This test is about making sure Parsoid's data-mw is well formed in the
10732 ## face of multiple templates with intersecting and overlapping ranges. The
10733 ## wikitext itself is wretched.
10734 !! test
10735 Templates with intersecting and overlapping ranges
10736 !! wikitext
10737 {|{{echo|
10738 <p>ha</p>}}
10739 {|{{echo|
10740 <p>ho</p>}}
10741 {{echo|{{!}}hi}}
10742 |}
10743 !! html/php+tidy
10744 <p>ha</p>
10745 <p>ho</p>
10746 <table>
10747 <tr>
10748 <td></td>
10749 </tr>
10750 <tr>
10751 <td>hi</td>
10752 </tr>
10753 </table>
10754 <table>
10755 <tr>
10756 <td></td>
10757 </tr>
10758 </table>
10759 !! html/parsoid
10760 <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":""}]]}'>
10761
10762 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
10763
10764 <tbody><tr><td>hi</td></tr>
10765 </tbody></table>
10766 !! end
10767
10768 !! article
10769 Template:MSGNW test
10770 !! text
10771 ''None'' of '''this''' should be
10772 * interpreted
10773 but rather passed unmodified
10774 {{test}}
10775 <gallery>
10776 File:Foobar.jpg
10777 </gallery>
10778 <!-- comment -->
10779 !! endarticle
10780
10781 # hmm, fix this or just deprecate msgnw and document its behavior?
10782 !! test
10783 msgnw keyword
10784 !! wikitext
10785 {{msgnw:MSGNW test}}
10786 !! html/php
10787 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
10788 &#42; interpreted
10789 &#32;but rather passed unmodified
10790 &#123;&#123;test&#125;&#125;
10791 &#60;gallery&#62;
10792 File:Foobar.jpg
10793 &#60;/gallery&#62;
10794 &#60;!-- comment --&#62;
10795 </p>
10796 !! end
10797
10798 !! test
10799 int keyword
10800 !! wikitext
10801 {{int:youhavenewmessages|lots of money|not!}}
10802 !! html
10803 <p>You have lots of money (not!).
10804 </p>
10805 !! end
10806
10807 !! test
10808 int keyword - non-existing message
10809 !! wikitext
10810 {{int:var}}
10811 !! html
10812 <p>&lt;var&gt;
10813 </p>
10814 !! end
10815
10816 !! article
10817 Template:Includes
10818 !! text
10819 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10820 !! endarticle
10821
10822 !! test
10823 <includeonly> and <noinclude> being included
10824 !! wikitext
10825 {{Includes}}
10826 !! html
10827 <p>Foobar
10828 </p>
10829 !! end
10830
10831 !! article
10832 Template:Includes2
10833 !! text
10834 <onlyinclude>Foo</onlyinclude>bar
10835 !! endarticle
10836
10837 !! test
10838 <onlyinclude> being included
10839 !! wikitext
10840 {{Includes2}}
10841 !! html
10842 <p>Foo
10843 </p>
10844 !! end
10845
10846
10847 !! article
10848 Template:Includes3
10849 !! text
10850 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
10851 !! endarticle
10852
10853 !! test
10854 <onlyinclude> and <includeonly> being included
10855 !! wikitext
10856 {{Includes3}}
10857 !! html
10858 <p>Foo
10859 </p>
10860 !! end
10861
10862 !! test
10863 <includeonly> and <noinclude> on a page
10864 !! wikitext
10865 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10866 !! html
10867 <p>Foozar
10868 </p>
10869 !! end
10870
10871 !! test
10872 Un-closed <noinclude>
10873 !! wikitext
10874 <noinclude>
10875 !! html
10876 !! end
10877
10878 !! test
10879 <onlyinclude> on a page
10880 !! wikitext
10881 <onlyinclude>Foo</onlyinclude>bar
10882 !! html
10883 <p>Foobar
10884 </p>
10885 !! end
10886
10887 !! test
10888 Un-closed <onlyinclude>
10889 !! wikitext
10890 <onlyinclude>
10891 !! html
10892 !! end
10893
10894 !!test
10895 Self-closed noinclude, includeonly, onlyinclude tags
10896 !! wikitext
10897 <noinclude />
10898 <includeonly />
10899 <onlyinclude />
10900 !! html
10901 <p><br />
10902 </p>
10903 !!end
10904
10905 !!test
10906 Unbalanced includeonly and noinclude tags
10907 !! wikitext
10908 {|
10909 |a</noinclude>
10910 |b</noinclude></noinclude>
10911 |c</noinclude></includeonly>
10912 |d</includeonly></includeonly>
10913 |}
10914 !! html
10915 <table>
10916 <tr>
10917 <td>a
10918 </td>
10919 <td>b
10920 </td>
10921 <td>c&lt;/includeonly&gt;
10922 </td>
10923 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
10924 </td></tr></table>
10925
10926 !!end
10927
10928 !! article
10929 Template:Includeonly section
10930 !! text
10931 <includeonly>
10932 ==Includeonly section==
10933 </includeonly>
10934 ==Section T-1==
10935 !!endarticle
10936
10937 !! test
10938 Bug 6563: Edit link generation for section shown by <includeonly>
10939 !! wikitext
10940 {{includeonly section}}
10941 !! html
10942 <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>
10943 <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>
10944
10945 !! end
10946
10947 # Uses same input as the contents of [[Template:Includeonly section]]
10948 !! test
10949 Bug 6563: Section extraction for section shown by <includeonly>
10950 !! options
10951 section=T-2
10952 !! wikitext
10953 <includeonly>
10954 ==Includeonly section==
10955 </includeonly>
10956 ==Section T-2==
10957 !! html
10958 ==Section T-2==
10959 !! end
10960
10961 !! test
10962 Bug 6563: Edit link generation for section suppressed by <includeonly>
10963 !! wikitext
10964 <includeonly>
10965 ==Includeonly section==
10966 </includeonly>
10967 ==Section 1==
10968 !! html
10969 <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>
10970
10971 !! end
10972
10973 !! test
10974 Bug 6563: Section extraction for section suppressed by <includeonly>
10975 !! options
10976 section=1
10977 !! wikitext
10978 <includeonly>
10979 ==Includeonly section==
10980 </includeonly>
10981 ==Section 1==
10982 !! html
10983 ==Section 1==
10984 !! end
10985
10986 !! test
10987 Un-closed <includeonly>
10988 !! wikitext
10989 <includeonly>
10990 !! html/php
10991 !! html/parsoid
10992 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
10993 !! end
10994
10995 ## We used to, but no longer wt2wt this test since the default serializer
10996 ## will normalize the include directives to serialize on their own line.
10997 ## Selser will take care of preserving formatting in scenarios where they
10998 ## intermingled with other wikitext.
10999 !! test
11000 Includes and comments at SOL
11001 !! options
11002 parsoid=wt2html,html2html
11003 !! wikitext
11004 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11005
11006 <noinclude>
11007 some
11008 </noinclude>* stuff
11009 * here
11010
11011 <includeonly>can have stuff</includeonly>=== here ===
11012
11013 !! html/php
11014 <h2><span class="mw-headline" id="hu">hu</span></h2>
11015 <p>some
11016 </p>
11017 <ul><li> stuff</li>
11018 <li> here</li></ul>
11019 <h3><span class="mw-headline" id="here">here</span></h3>
11020
11021 !! html/parsoid
11022 <!-- 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>
11023
11024 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11025 <p>some</p>
11026 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11027 <li> here</li></ul>
11028
11029 <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>
11030
11031 !! end
11032
11033 # TODO: test with DOM fragment reuse!
11034 !! test
11035 Parsoid: DOM fragment reuse
11036 !! options
11037 parsoid=wt2wt,wt2html
11038 !! wikitext
11039 a{{echo|b<table></table>c}}d
11040
11041 a{{echo|b
11042 <table></table>
11043 c}}d
11044
11045 {{echo|a
11046
11047 <table></table>
11048
11049 b}}
11050 !! html
11051 <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>
11052
11053 <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">
11054 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11055 </span><p about="#mwt2">cd</p>
11056
11057 <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">
11058
11059 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11060
11061 </span><p about="#mwt3">b</p>
11062 !! end
11063
11064 !! test
11065 Parsoid: Merge double tds (T52603)
11066 !! options
11067 parsoid
11068 !! wikitext
11069 {|
11070 |{{echo|{{!}} foo}}
11071 |}
11072 !! html
11073 <table><tbody>
11074 <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>
11075 </tbody></table>
11076 !! end
11077
11078 !! test
11079 Parsoid: Merge double tds in nested transclusion content (T52603)
11080 !! options
11081 parsoid
11082 !! wikitext
11083 {{echo|<div>}}
11084 {|
11085 |{{echo|{{!}} foo}}
11086 |}
11087 {{echo|</div>}}
11088 !! html
11089 <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}}]}'>
11090 <table><tbody>
11091 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11092 </tbody></table>
11093 </div>
11094 !! end
11095
11096 ###
11097 ### <includeonly> and <noinclude> in attributes
11098 ###
11099 !!test
11100 0. includeonly around the entire attribute
11101 !! wikitext
11102 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11103 !! html
11104 <p><span id="v2">bar</span>
11105 </p>
11106 !!end
11107
11108 !!test
11109 1. includeonly in html attr key
11110 !! wikitext
11111 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11112 !! html
11113 <p><span id="foo">bar</span>
11114 </p>
11115 !!end
11116
11117 !!test
11118 2. includeonly in html attr value
11119 !! wikitext
11120 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11121 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11122 !! html
11123 <p><span id="v1">bar</span>
11124 <span id="v1">bar</span>
11125 </p>
11126 !!end
11127
11128 !!test
11129 3. includeonly in part of an attr value
11130 !! wikitext
11131 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11132 !! html
11133 <p><span style="color:red;">bar</span>
11134 </p>
11135 !!end
11136
11137 !!test
11138 4. includeonly in table attributes
11139 !! wikitext
11140 {|
11141 |- <noinclude>
11142 |-
11143 |a
11144 </noinclude>
11145 |- <includeonly>
11146 |-
11147 |b
11148 </includeonly>
11149 |}
11150 !! html
11151 <table>
11152
11153
11154 <tr>
11155 <td>a
11156 </td></tr>
11157 </table>
11158
11159 !!end
11160
11161 ###
11162 ### Token Stream Patcher tests
11163 ###
11164 ### These tests won't always pass wt2wt and other modes because
11165 ### on serialization, the table will be output on a new line.
11166 ### For now, we are blacklisting them, and using this to test selser.
11167 ###
11168
11169 !!test
11170 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11171 !!options
11172 parsoid=wt2html,wt2wt
11173 !!wikitext
11174 {{echo|}}{| width = '100%'
11175 |foo
11176 |}
11177 !!html/parsoid
11178 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11179 <tbody><tr><td>foo</td></tr>
11180 </tbody></table>
11181 !!end
11182
11183 ## We used to, but no longer wt2wt this test since the default serializer
11184 ## will normalize the include directives to serialize on their own line.
11185 ## Selser will take care of preserving formatting in scenarios where they
11186 ## intermingled with other wikitext.
11187 !!test
11188 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11189 !!options
11190 parsoid=wt2html
11191 !!wikitext
11192 <includeonly>a</includeonly>{| {{{b}}}
11193 |c
11194 |}
11195 !!html/parsoid
11196 <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}}}":""}}'>
11197 <tbody><tr><td>c</td></tr>
11198 </tbody></table>
11199
11200 !!end
11201
11202 ###
11203 ### Testing parsing of templates where a template arg
11204 ### has the same name as the template itself.
11205 ###
11206
11207 !! article
11208 Template:quote
11209 !! text
11210 {{{quote|{{{1}}}}}}
11211 !! endarticle
11212
11213 !!test
11214 Templates: Template Name/Arg clash: 1. Use of positional param
11215 !! wikitext
11216 {{quote|foo}}
11217 !! html
11218 <p>foo
11219 </p>
11220 !!end
11221
11222 !!test
11223 Templates: Template Name/Arg clash: 2. Use of named param
11224 !! wikitext
11225 {{quote|quote=foo}}
11226 !! html
11227 <p>foo
11228 </p>
11229 !!end
11230
11231 !!test
11232 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11233 !! wikitext
11234 {{quote|quote}}
11235 !! html
11236 <p>quote
11237 </p>
11238 !!end
11239
11240 ###
11241 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11242 ###
11243
11244 !!test
11245 Templates: 1. Simple use
11246 !! wikitext
11247 {{echo|Foo}}
11248 !! html
11249 <p>Foo
11250 </p>
11251 !!end
11252
11253 !!test
11254 Templates: 2. Inside a block tag
11255 !! wikitext
11256 <div>{{echo|Foo}}</div>
11257 <blockquote>{{echo|Foo}}</blockquote>
11258 !! html
11259 <div>Foo</div>
11260 <blockquote>Foo</blockquote>
11261
11262 !! html+tidy
11263 <div>Foo</div>
11264 <blockquote>
11265 <p>Foo</p>
11266 </blockquote>
11267 !!end
11268
11269 !!test
11270 Templates: P-wrapping: 1a. Templates on consecutive lines
11271 !! wikitext
11272 {{echo|Foo}}
11273 {{echo|bar}}
11274 !! html
11275 <p>Foo
11276 bar
11277 </p>
11278 !!end
11279
11280 !!test
11281 Templates: P-wrapping: 1b. Templates on consecutive lines
11282 !! wikitext
11283 Foo
11284
11285 {{echo|bar}}
11286 {{echo|baz}}
11287 !! html
11288 <p>Foo
11289 </p><p>bar
11290 baz
11291 </p>
11292 !!end
11293
11294 !!test
11295 Templates: P-wrapping: 1c. Templates on consecutive lines
11296 !! wikitext
11297 {{echo|Foo}}
11298 {{echo|bar}} <div>baz</div>
11299 !! html
11300 <p>Foo
11301 </p>
11302 bar <div>baz</div>
11303
11304 !! html+tidy
11305 <p>Foo</p>
11306 <p>bar</p>
11307 <div>baz</div>
11308 !! end
11309
11310 !!test
11311 Templates: P-wrapping: 1d. Template preceded by comment-only line
11312 !!options
11313 parsoid
11314 !! wikitext
11315 <!-- foo -->
11316 {{echo|Bar}}
11317 !! html
11318 <!-- foo -->
11319
11320 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11321 !!end
11322
11323 !!test
11324 Templates: Inline Text: 1. Multiple template uses
11325 !! wikitext
11326 {{echo|Foo}}bar{{echo|baz}}
11327 !! html
11328 <p>Foobarbaz
11329 </p>
11330 !!end
11331
11332 !!test
11333 Templates: Inline Text: 2. Back-to-back template uses
11334 !! wikitext
11335 {{echo|Foo}}{{echo|bar}}
11336 !! html
11337 <p>Foobar
11338 </p>
11339 !!end
11340
11341 !!test
11342 Templates: Block Tags: 1. Multiple template uses
11343 !! wikitext
11344 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11345 !! html
11346 <div>Foo</div><div>bar</div><div>baz</div>
11347
11348 !!end
11349
11350 !!test
11351 Templates: Block Tags: 2. Back-to-back template uses
11352 !! wikitext
11353 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11354 !! html
11355 <div>Foo</div><div>bar</div>
11356
11357 !!end
11358
11359 # This is an edge case relating to paragraph wrapping.
11360 !!test
11361 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11362 !! wikitext
11363 {{echo|a
11364 b</p>}}
11365 !! html/parsoid
11366 <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
11367 b</p>
11368 !!end
11369
11370 !!test
11371 Templates: Links: 1. Simple example
11372 !! wikitext
11373 {{echo|[[Foo|bar]]}}
11374 !! html
11375 <p><a href="/wiki/Foo" title="Foo">bar</a>
11376 </p>
11377 !!end
11378
11379 !!test
11380 Templates: Links: 2. Generation of link href
11381 !! wikitext
11382 [[{{echo|Foo}}|bar]]
11383 !! html
11384 <p><a href="/wiki/Foo" title="Foo">bar</a>
11385 </p>
11386 !!end
11387
11388 !!test
11389 Templates: Links: 3. Generation of part of a link href
11390 !! wikitext
11391 [[Fo{{echo|o}}|bar]]
11392
11393 [[Foo{{echo|bar}}]]
11394
11395 [[Foo{{echo|bar}}baz]]
11396
11397 [[Foo{{echo|bar}}|bar]]
11398
11399 [[:Foo{{echo|bar}}]]
11400
11401 [[:Foo{{echo|bar}}|bar]]
11402 !! html
11403 <p><a href="/wiki/Foo" title="Foo">bar</a>
11404 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11405 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11406 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11407 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11408 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11409 </p>
11410 !!end
11411
11412 !!test
11413 Templates: Links: 4. Multiple templates generating link href
11414 !! wikitext
11415 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11416 !! html
11417 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11418 </p>
11419 !!end
11420
11421 !!test
11422 Templates: Links: 5. Generation of link text
11423 !! wikitext
11424 [[Foo|{{echo|bar}}]]
11425 !! html
11426 <p><a href="/wiki/Foo" title="Foo">bar</a>
11427 </p>
11428 !!end
11429
11430 !!test
11431 Templates: Links: 5. Nested templates (only outermost template should be marked)
11432 !! wikitext
11433 {{echo|[[{{echo|Foo}}|bar]]}}
11434 !! html
11435 <p><a href="/wiki/Foo" title="Foo">bar</a>
11436 </p>
11437 !!end
11438
11439 !!test
11440 Templates: HTML Tag: 1. Generation of HTML attr. key
11441 !! wikitext
11442 <div {{echo|style}}="color:red;">foo</div>
11443 !! html
11444 <div style="color:red;">foo</div>
11445
11446 !!end
11447
11448 !!test
11449 Templates: HTML Tag: 2. Generation of HTML attr. value
11450 !! wikitext
11451 <div style={{echo|'color:red;'}}>foo</div>
11452 !! html
11453 <div style="color:red;">foo</div>
11454
11455 !!end
11456
11457 !!test
11458 Templates: HTML Tag: 3. Generation of HTML attr key and value
11459 !! wikitext
11460 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11461 !! html
11462 <div style="color:red;">foo</div>
11463
11464 !!end
11465
11466 !!test
11467 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11468 !! wikitext
11469 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11470 !! html
11471 <div title="This is a long title with just one piece templated">foo</div>
11472
11473 !!end
11474
11475 !!test
11476 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11477 !! wikitext
11478 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11479 !! html
11480 <div title="This is a long title with just one piece templated">foo</div>
11481
11482 !!end
11483
11484 !!test
11485 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11486 !! wikitext
11487 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11488 !! html
11489 <div title="This is a long title with just one piece templated">foo</div>
11490
11491 !!end
11492
11493 # SSS FIXME: While it is great we added support for all this,
11494 # do we want to make this part of the spec? Maybe we want to
11495 # deprecate this kind of usage in the future?
11496 !!test
11497 Templates: HTML Tag: 7. Generation of partial attribute key string
11498 !! wikitext
11499 <div st{{echo|yle}}="color:red;">foo</div>
11500 !! html
11501 <div style="color:red;">foo</div>
11502
11503 !!end
11504
11505 !! test
11506 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11507 !! wikitext
11508 <div {{echo|1=id="v1"}}>bar</div>
11509 !! html
11510 <div id="v1">bar</div>
11511
11512 !!end
11513
11514 !! test
11515 Templates: HTML Tag: 9. Multiple template-generated attributes
11516 !! wikitext
11517 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11518 !! html
11519 <div id="v1" title="foo">bar</div>
11520
11521 !!end
11522
11523 !! test
11524 Templates: Support for templates generating attributes and content
11525 !! wikitext
11526 {| {{mixed_attr_content_template}}
11527 |-
11528 |bar
11529 |}
11530 !! html/php
11531 <table style="color:red;" title="T48811">
11532
11533 <tr>
11534 <td>foo
11535 </td></tr>
11536 <tr>
11537 <td>bar
11538 </td></tr></table>
11539
11540 !! html/parsoid
11541 <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|}"]}'>
11542 <tbody><tr>
11543 <td>foo</td></tr>
11544 <tr>
11545 <td>bar</td></tr>
11546 </tbody></table>
11547 !!end
11548
11549 !! test
11550 1. Entities and nowikis inside templated attributes should be handled correctly
11551 !! wikitext
11552 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11553 !! html/php
11554 <div style="background:#f9f9f9;">foo</div>
11555
11556 !! html/parsoid
11557 <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>
11558 !! end
11559
11560 !! test
11561 2. Entities and nowikis inside templated attributes should be handled correctly
11562 !! wikitext
11563 {|
11564 |{{table_attribs_3}}
11565 |}
11566 !! html/php
11567 <table>
11568 <tr>
11569 <td style="background:#f9f9f9;">Foo
11570 </td></tr></table>
11571
11572 !! html/parsoid
11573 <table>
11574 <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>
11575 </tbody></table>
11576 !! end
11577
11578 !! test
11579 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11580 !! wikitext
11581 {{tbl-start}}
11582 |{{table_attribs_3}}
11583 {{tbl-end}}
11584 !! html/php
11585 <table>
11586 <tr>
11587 <td style="background:#f9f9f9;">Foo
11588 </td></tr></table>
11589
11590 !! html/parsoid
11591 <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}}]}'>
11592 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11593 </tbody></table>
11594 !! end
11595
11596 # T107622
11597 !! test
11598 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11599 !! wikitext
11600 {|
11601 | {{table_attribs_6}} hi
11602 |}
11603 !! html/php
11604 <table>
11605 <tr>
11606 <td style="background: red;"> hi
11607 </td></tr></table>
11608
11609 !! html/parsoid
11610 <table>
11611 <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>
11612 </tbody></table>
11613 !! end
11614
11615 !!test
11616 Templates: HTML Tables: 1. Generating start of a HTML table
11617 !! wikitext
11618 {{echo|<table><tr><td>foo</td>}}</tr></table>
11619 !! html
11620 <table><tr><td>foo</td></tr></table>
11621
11622 !!end
11623
11624 !!test
11625 Templates: HTML Tables: 2a. Generating middle of a HTML table
11626 !! wikitext
11627 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11628 !! html
11629 <table><tr><td>foo</td></tr></table>
11630
11631 !!end
11632
11633 !!test
11634 Templates: HTML Tables: 2b. Generating middle of a HTML table
11635 !! wikitext
11636 <table>{{echo|<tr><td>foo</td></tr>}}</table>
11637 !! html
11638 <table><tr><td>foo</td></tr></table>
11639
11640 !!end
11641
11642 !!test
11643 Templates: HTML Tables: 3. Generating end of a HTML table
11644 !! wikitext
11645 <table><tr>{{echo|<td>foo</td></tr></table>}}
11646 !! html
11647 <table><tr><td>foo</td></tr></table>
11648
11649 !!end
11650
11651 !!test
11652 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
11653 !! wikitext
11654 {{echo|<table>}}<tr><td>foo</td></tr></table>
11655 !! html
11656 <table><tr><td>foo</td></tr></table>
11657
11658 !!end
11659
11660 !!test
11661 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
11662 !! wikitext
11663 <table>{{echo|<tr>}}<td>foo</td></tr></table>
11664 !! html
11665 <table><tr><td>foo</td></tr></table>
11666
11667 !!end
11668
11669 !!test
11670 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
11671 !! wikitext
11672 <table><tr>{{echo|<td>}}foo</td></tr></table>
11673 !! html
11674 <table><tr><td>foo</td></tr></table>
11675
11676 !!end
11677
11678 !!test
11679 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
11680 !! wikitext
11681 <table><tr><td>foo{{echo|</td>}}</tr></table>
11682 !! html
11683 <table><tr><td>foo</td></tr></table>
11684
11685 !!end
11686
11687 !!test
11688 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
11689 !! wikitext
11690 <table><tr><td>foo</td>{{echo|</tr>}}</table>
11691 !! html
11692 <table><tr><td>foo</td></tr></table>
11693
11694 !!end
11695
11696 !!test
11697 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
11698 !! wikitext
11699 <table><tr><td>foo</td></tr>{{echo|</table>}}
11700 !! html
11701 <table><tr><td>foo</td></tr></table>
11702
11703 !!end
11704
11705 !!test
11706 Templates: HTML Tables: 5. Proper fostering of categories from inside
11707 !!options
11708 parsoid=wt2html,wt2wt
11709 !! wikitext
11710 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
11711 <!--Two categories (Bug 50330)-->
11712 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
11713 !! html
11714 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
11715 <!--Two categories (Bug 50330)-->
11716 <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>
11717 !!end
11718
11719 !!test
11720 Templates: Wiki Tables: 1a. Fostering of entire template content
11721 !! wikitext
11722 {|
11723 {{echo|a}}
11724 |}
11725 !! html
11726 <table>
11727 a
11728 <tr><td></td></tr></table>
11729
11730 !! html+tidy
11731 <p>a</p>
11732 <table>
11733 <tr>
11734 <td></td>
11735 </tr>
11736 </table>
11737 !! end
11738
11739 !!test
11740 Templates: Wiki Tables: 1b. Fostering of entire template content
11741 !! wikitext
11742 {|
11743 {{echo|<div>}}
11744 foo
11745 {{echo|</div>}}
11746 |}
11747 !! html
11748 <table>
11749 <div>
11750 <p>foo
11751 </p>
11752 </div>
11753 <tr><td></td></tr></table>
11754
11755 !! html+tidy
11756 <div>
11757 <p>foo</p>
11758 </div>
11759 <table>
11760 <tr>
11761 <td></td>
11762 </tr>
11763 </table>
11764 !! end
11765
11766 !!test
11767 Templates: Wiki Tables: 2. Fostering of partial template content
11768 !! wikitext
11769 {|
11770 {{echo|a
11771 <div>b</div>}}
11772 |}
11773 !! html
11774 <table>
11775 a
11776 <div>b</div>
11777 <tr><td></td></tr></table>
11778
11779 !! html+tidy
11780 <p>a</p>
11781 <div>b</div>
11782 <table>
11783 <tr>
11784 <td></td>
11785 </tr>
11786 </table>
11787 !! end
11788
11789 !!test
11790 Templates: Wiki Tables: 3. td-content via multiple templates
11791 !! wikitext
11792 {|
11793 {{echo|{{pipe}}a}}{{echo|b}}
11794 |}
11795 !! html
11796 <table>
11797 <tr>
11798 <td>ab
11799 </td></tr></table>
11800
11801 !!end
11802
11803 !!test
11804 Templates: Wiki Tables: 4. Templated tags, no content
11805 !! wikitext
11806 {{tbl-start}}
11807 {{tbl-end}}
11808 !! html
11809 <table>
11810 <tr><td></td></tr></table>
11811
11812 !!end
11813
11814 !!test
11815 Templates: Wiki Tables: 5. Templated tags, regular td-tags
11816 !! wikitext
11817 {{tbl-start}}
11818 |foo
11819 {{tbl-end}}
11820 !! html
11821 <table>
11822 <tr>
11823 <td>foo
11824 </td></tr></table>
11825
11826 !!end
11827
11828 !!test
11829 Templates: Wiki Tables: 6. Templated tags, templated td-tags
11830 !! wikitext
11831 {{tbl-start}}
11832 {{!}}foo
11833 {{tbl-end}}
11834 !! html
11835 <table>
11836 <tr>
11837 <td>foo
11838 </td></tr></table>
11839
11840 !!end
11841
11842 ## This test case is very specific to Parsoid's internals
11843 ## and is hence only tested for Parsoid's code. Parsoid uses
11844 ## a <meta> marker tag for <ref> tags and they are expanded
11845 ## much later. We are verifying that this <meta> tag usage
11846 ## doesn't prevent foster parenting.
11847 !!test
11848 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
11849 !!wikitext
11850 {{PartialTable}}<ref>foo</ref>
11851 |}
11852
11853 <references />
11854 !!html/parsoid
11855 <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">
11856 <tbody>
11857 </tbody></table>
11858
11859 <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>
11860 !!end
11861
11862 !! test
11863 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
11864 !! wikitext
11865 {{echo|
11866 {{{!}}
11867 {{!}}-}}
11868 <onlyinclude>
11869 |foo
11870 </onlyinclude>
11871 {{!}}}
11872 !! html/parsoid
11873 <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{{!}}}"]}'>
11874 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
11875 <tbody><tr>
11876
11877 <td>foo
11878 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
11879 </tbody></table>
11880 !! end
11881
11882 !!test
11883 Templates: Lists: Multi-line list-items via templates
11884 !! wikitext
11885 *{{echo|a {{nonexistent|
11886 unused}}}}
11887 *{{echo|b {{nonexistent|
11888 unused}}}}
11889 !! html
11890 <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>
11891 <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>
11892
11893 !!end
11894
11895 !!test
11896 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
11897 !! wikitext
11898 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
11899 !! html
11900 <p><i>ab</i>c<i>d</i>e
11901 </p>
11902 !!end
11903
11904 !!test
11905 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
11906 (PHP parser generates misnested html)
11907 !! wikitext
11908 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
11909 !! html/parsoid
11910 <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>
11911 !!end
11912
11913 !!test
11914 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
11915 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
11916 !! options
11917 parsoid=wt2html,wt2wt
11918 !! wikitext
11919 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
11920 !! html
11921 <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>
11922 <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>
11923 <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>
11924 !!end
11925
11926 !!test
11927 Templates: Ugly nesting: 4. Divs opened/closed across templates
11928 !! wikitext
11929 a<div>b{{echo|c</div>d}}e
11930 !! html
11931 a<div>bc</div>de
11932
11933 !! html+tidy
11934 <p>a</p>
11935 <div>bc</div>
11936 <p>de</p>
11937 !! end
11938
11939 !!test
11940 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
11941 (Parsoid-centric)
11942 !! options
11943 parsoid
11944 !! wikitext
11945 {|
11946 |{{echo|foo</table>}}
11947 |bar
11948 |}
11949 !! html
11950 <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|}"]}'>
11951
11952 <tbody>
11953 <tr>
11954 <td>foo</td></tr></tbody></table><span about="#mwt1">
11955 </span><span about="#mwt1">|bar</span><span about="#mwt1">
11956 |}</span>
11957 !!end
11958
11959 !!test
11960 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
11961 (Parsoid-centric)
11962 !! options
11963 parsoid
11964 !! wikitext
11965 <table>
11966 <tr>
11967 <td>
11968 <table>
11969 <tr>
11970 <td>1. {{echo|foo </table>}}</td>
11971 <td> bar </td>
11972 <td>2. {{echo|baz </table>}}</td>
11973 </tr>
11974 <tr>
11975 <td>abc</td>
11976 </tr>
11977 </table>
11978 </td>
11979 </tr>
11980 <tr>
11981 <td>xyz</td>
11982 </tr>
11983 </table>
11984 !! html
11985 <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>"]}'>
11986 <tbody><tr>
11987 <td>
11988 <table>
11989 <tbody><tr>
11990 <td>1. foo </td></tr></tbody></table></td>
11991 <td> bar </td>
11992 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
11993 </span><span about="#mwt2">
11994 </span><span about="#mwt2">
11995 </span><span about="#mwt2">abc</span><span about="#mwt2">
11996 </span><span about="#mwt2">
11997 </span><span about="#mwt2">
11998 </span><span about="#mwt2">
11999 </span><span about="#mwt2">
12000 </span><span about="#mwt2">
12001 </span><span about="#mwt2">xyz</span><span about="#mwt2">
12002 </span><span about="#mwt2">
12003 </span>
12004 !!end
12005
12006 !! test
12007 Templates: Ugly templates: 3. newline-only template parameter
12008 !! wikitext
12009 foo {{echo|
12010 }}
12011 !! html
12012 <p>foo
12013 </p>
12014 !! end
12015
12016 # This looks like a bug: a single newline triggers p/br for some reason.
12017 !! test
12018 Templates: Ugly templates: 4. newline-only template parameter inconsistency
12019 !! wikitext
12020 {{echo|
12021 }}
12022 !! html
12023 <p><br />
12024 </p>
12025 !! end
12026
12027 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
12028 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12029 !! test
12030 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12031 !! wikitext
12032 {{echo|<table>}}
12033 {{echo|<div>foo}}
12034 {{echo|</table>}}
12035 !! html/parsoid
12036 <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
12037 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12038 </table>
12039 !! end
12040
12041 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
12042 # that are "identical" and generate nesting cycles in the algorithm
12043 !! test
12044 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12045 !! wikitext
12046 {{echo|<table><tr><td><table>}}
12047 {{echo|<div>}}
12048 {{echo|</div>}}
12049 !! html/parsoid
12050 <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"}'>
12051 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12052 </table></td></tr></tbody></table>
12053 !! end
12054
12055 !! test
12056 Templates: Parameters substituted at the top-level
12057 !! wikitext
12058 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12059 !! html/php
12060 <p><i>who</i> me? <b>never!</b>
12061 </p>
12062 !! html/parsoid
12063 <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>
12064 !! end
12065
12066 !!test
12067 Parser Functions: 1. Simple example
12068 !! wikitext
12069 {{uc:foo}}
12070 !! html
12071 <p>FOO
12072 </p>
12073 !!end
12074
12075 !!test
12076 Parser Functions: 2. Nested use (only outermost should be marked up)
12077 !! wikitext
12078 {{uc:{{lc:FOO}}}}
12079 !! html
12080 <p>FOO
12081 </p>
12082 !!end
12083
12084 ###
12085 ### Pre-save transform tests
12086 ###
12087 !! test
12088 pre-save transform: subst:
12089 !! options
12090 pst
12091 !! wikitext
12092 {{subst:test}}
12093 !! html/php
12094 This is a test template
12095 !! end
12096
12097 !! test
12098 pre-save transform: normal template
12099 !! options
12100 pst
12101 !! wikitext
12102 {{test}}
12103 !! html/php
12104 {{test}}
12105 !! end
12106
12107 !! test
12108 pre-save transform: nonexistent template
12109 !! options
12110 pst
12111 !! wikitext
12112 {{thistemplatedoesnotexist}}
12113 !! html/php
12114 {{thistemplatedoesnotexist}}
12115 !! end
12116
12117 !! test
12118 pre-save transform: subst magic variables
12119 !! options
12120 pst
12121 !! wikitext
12122 {{subst:SITENAME}}
12123 !! html/php
12124 MediaWiki
12125 !! end
12126
12127 # This is bug 89, which I fixed. -- wtm
12128 !! test
12129 pre-save transform: subst: templates with parameters
12130 !! options
12131 pst
12132 !! wikitext
12133 {{subst:paramtest|param="something else"}}
12134 !! html/php
12135 This is a test template with parameter "something else"
12136 !! end
12137
12138 !! article
12139 Template:nowikitest
12140 !! text
12141 <nowiki>'''not wiki'''</nowiki>
12142 !! endarticle
12143
12144 !! test
12145 pre-save transform: nowiki in subst (bug 1188)
12146 !! options
12147 pst
12148 !! wikitext
12149 {{subst:nowikitest}}
12150 !! html/php
12151 <nowiki>'''not wiki'''</nowiki>
12152 !! end
12153
12154 !! article
12155 Template:commenttest
12156 !! text
12157 This template has <!-- a comment --> in it.
12158 !! endarticle
12159
12160 !! test
12161 pre-save transform: comment in subst (bug 1936)
12162 !! options
12163 pst
12164 !! wikitext
12165 {{subst:commenttest}}
12166 !! html/php
12167 This template has <!-- a comment --> in it.
12168 !! end
12169
12170 !! test
12171 pre-save transform: unclosed tag
12172 !! options
12173 pst
12174 !! wikitext
12175 <nowiki>'''not wiki'''
12176 !! html/php
12177 <nowiki>'''not wiki'''
12178 !! end
12179
12180 !! test
12181 pre-save transform: mixed tag case
12182 !! options
12183 pst
12184 !! wikitext
12185 <NOwiki>'''not wiki'''</noWIKI>
12186 !! html/php
12187 <NOwiki>'''not wiki'''</noWIKI>
12188 !! end
12189
12190 !! test
12191 pre-save transform: unclosed comment in <nowiki>
12192 !! options
12193 pst
12194 !! wikitext
12195 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12196 !! html/php
12197 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12198 !!end
12199
12200 # Leading @ in this template definition works around a limitation
12201 # in parsoid's parserTests which otherwise strips the <span> from the
12202 # result (confusing it for a template wrapper)
12203 !! article
12204 Template:dangerous
12205 !!text
12206 @<span onmouseover="alert('crap')">Oh no</span>
12207 !!endarticle
12208
12209 !!test
12210 (confirming safety of fix for subst bug 1936)
12211 !! wikitext
12212 {{Template:dangerous}}
12213 !! html
12214 <p>@<span>Oh no</span>
12215 </p>
12216 !! end
12217
12218 !! test
12219 pre-save transform: comment containing gallery (bug 5024)
12220 !! options
12221 pst
12222 !! wikitext
12223 <!-- <gallery>data</gallery> -->
12224 !! html/php
12225 <!-- <gallery>data</gallery> -->
12226 !!end
12227
12228 !! test
12229 pre-save transform: comment containing extension
12230 !! options
12231 pst
12232 !! wikitext
12233 <!-- <tag>data</tag> -->
12234 !! html/php
12235 <!-- <tag>data</tag> -->
12236 !!end
12237
12238 !! test
12239 pre-save transform: comment containing nowiki
12240 !! options
12241 pst
12242 !! wikitext
12243 <!-- <nowiki>data</nowiki> -->
12244 !! html/php
12245 <!-- <nowiki>data</nowiki> -->
12246 !!end
12247
12248 !! test
12249 pre-save transform: <noinclude> in subst (bug 3298)
12250 !! options
12251 pst
12252 !! wikitext
12253 {{subst:Includes}}
12254 !! html/php
12255 Foobar
12256 !! end
12257
12258 !! test
12259 pre-save transform: <onlyinclude> in subst (bug 3298)
12260 !! options
12261 pst
12262 !! wikitext
12263 {{subst:Includes2}}
12264 !! html/php
12265 Foo
12266 !! end
12267
12268 !! article
12269 Template:SubstTest
12270 !!text
12271 {{<includeonly>subst:</includeonly>Includes}}
12272 !! endarticle
12273
12274 !! article
12275 Template:SafeSubstTest
12276 !! text
12277 {{<includeonly>safesubst:</includeonly>Includes}}
12278 !! endarticle
12279
12280 !! test
12281 bug 22297: safesubst: works during PST
12282 !! options
12283 pst
12284 !! wikitext
12285 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12286 !! html/php
12287 FoobarFoobar
12288 !! end
12289
12290 !! test
12291 bug 22297: safesubst: works during normal parse
12292 !! wikitext
12293 {{SafeSubstTest}}
12294 !! html
12295 <p>Foobar
12296 </p>
12297 !! end
12298
12299 !! test
12300 subst: does not work during normal parse
12301 !! wikitext
12302 {{SubstTest}}
12303 !! html
12304 <p>{{subst:Includes}}
12305 </p>
12306 !! end
12307
12308 !! test
12309 pre-save transform: context links ("pipe trick")
12310 !! options
12311 pst
12312 !! wikitext
12313 [[Article (context)|]]
12314 [[Bar:Article|]]
12315 [[:Bar:Article|]]
12316 [[Bar:Article (context)|]]
12317 [[:Bar:Article (context)|]]
12318 [[|Article]]
12319 [[|Article (context)]]
12320 [[Bar:X (Y) Z|]]
12321 [[:Bar:X (Y) Z|]]
12322 !! html/php
12323 [[Article (context)|Article]]
12324 [[Bar:Article|Article]]
12325 [[:Bar:Article|Article]]
12326 [[Bar:Article (context)|Article]]
12327 [[:Bar:Article (context)|Article]]
12328 [[Article]]
12329 [[Article (context)]]
12330 [[Bar:X (Y) Z|X (Y) Z]]
12331 [[:Bar:X (Y) Z|X (Y) Z]]
12332 !! end
12333
12334 !! test
12335 pre-save transform: context links ("pipe trick") with interwiki prefix
12336 !! options
12337 pst
12338 !! wikitext
12339 [[interwiki:Article|]]
12340 [[:interwiki:Article|]]
12341 [[interwiki:Bar:Article|]]
12342 [[:interwiki:Bar:Article|]]
12343 !! html/php
12344 [[interwiki:Article|Article]]
12345 [[:interwiki:Article|Article]]
12346 [[interwiki:Bar:Article|Bar:Article]]
12347 [[:interwiki:Bar:Article|Bar:Article]]
12348 !! end
12349
12350 !! test
12351 pre-save transform: context links ("pipe trick") with parens in title
12352 !! options
12353 pst title=[[Somearticle (context)]]
12354 !! wikitext
12355 [[|Article]]
12356 !! html/php
12357 [[Article (context)|Article]]
12358 !! end
12359
12360 !! test
12361 pre-save transform: context links ("pipe trick") with comma in title
12362 !! options
12363 pst title=[[Someplace, Somewhere]]
12364 !! wikitext
12365 [[|Otherplace]]
12366 [[Otherplace, Elsewhere|]]
12367 [[Otherplace, Elsewhere, Anywhere|]]
12368 !! html/php
12369 [[Otherplace, Somewhere|Otherplace]]
12370 [[Otherplace, Elsewhere|Otherplace]]
12371 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12372 !! end
12373
12374 !! test
12375 pre-save transform: context links ("pipe trick") with parens and comma
12376 !! options
12377 pst title=[[Someplace (IGNORED), Somewhere]]
12378 !! wikitext
12379 [[|Otherplace]]
12380 [[Otherplace (place), Elsewhere|]]
12381 !! html/php
12382 [[Otherplace, Somewhere|Otherplace]]
12383 [[Otherplace (place), Elsewhere|Otherplace]]
12384 !! end
12385
12386 !! test
12387 pre-save transform: context links ("pipe trick") with comma and parens
12388 !! options
12389 pst title=[[Who, me? (context)]]
12390 !! wikitext
12391 [[|Yes, you.]]
12392 [[Me, Myself, and I (1937 song)|]]
12393 !! html/php
12394 [[Yes, you. (context)|Yes, you.]]
12395 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12396 !! end
12397
12398 !! test
12399 pre-save transform: context links ("pipe trick") with namespace
12400 !! options
12401 pst title=[[Ns:Somearticle]]
12402 !! wikitext
12403 [[|Article]]
12404 !! html/php
12405 [[Ns:Article|Article]]
12406 !! end
12407
12408 !! test
12409 pre-save transform: context links ("pipe trick") with namespace and parens
12410 !! options
12411 pst title=[[Ns:Somearticle (context)]]
12412 !! wikitext
12413 [[|Article]]
12414 !! html/php
12415 [[Ns:Article (context)|Article]]
12416 !! end
12417
12418 !! test
12419 pre-save transform: context links ("pipe trick") with namespace and comma
12420 !! options
12421 pst title=[[Ns:Somearticle, Context, Whatever]]
12422 !! wikitext
12423 [[|Article]]
12424 !! html/php
12425 [[Ns:Article, Context, Whatever|Article]]
12426 !! end
12427
12428 !! test
12429 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12430 !! options
12431 pst title=[[Ns:Somearticle, Context (context)]]
12432 !! wikitext
12433 [[|Article]]
12434 !! html/php
12435 [[Ns:Article (context)|Article]]
12436 !! end
12437
12438 !! test
12439 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12440 !! options
12441 pst title=[[Ns:Somearticle (IGNORED), Context]]
12442 !! wikitext
12443 [[|Article]]
12444 !! html/php
12445 [[Ns:Article, Context|Article]]
12446 !! end
12447
12448 !! test
12449 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12450 !! options
12451 pst
12452 !! wikitext
12453 [[Article(context)|]]
12454 [[Bar:Article(context)|]]
12455 [[:Bar:Article(context)|]]
12456 [[|Article(context)]]
12457 [[Bar:X(Y)Z|]]
12458 [[:Bar:X(Y)Z|]]
12459 !! html/php
12460 [[Article(context)|Article]]
12461 [[Bar:Article(context)|Article]]
12462 [[:Bar:Article(context)|Article]]
12463 [[Article(context)]]
12464 [[Bar:X(Y)Z|X(Y)Z]]
12465 [[:Bar:X(Y)Z|X(Y)Z]]
12466 !! end
12467
12468 !! test
12469 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12470 !! options
12471 pst
12472 !! wikitext
12473 [[Article (context)|]]
12474 [[Bar:Article (context)|]]
12475 [[:Bar:Article (context)|]]
12476 [[|Article (context)]]
12477 [[Bar:X (Y) Z|]]
12478 [[:Bar:X (Y) Z|]]
12479 !! html/php
12480 [[Article (context)|Article]]
12481 [[Bar:Article (context)|Article]]
12482 [[:Bar:Article (context)|Article]]
12483 [[Article (context)]]
12484 [[Bar:X (Y) Z|X (Y) Z]]
12485 [[:Bar:X (Y) Z|X (Y) Z]]
12486 !! end
12487
12488 !! test
12489 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12490 !! options
12491 pst
12492 !! wikitext
12493 [[Article(context)|]]
12494 [[Bar:Article(context)|]]
12495 [[:Bar:Article(context)|]]
12496 [[|Article(context)]]
12497 [[Bar:X(Y)Z|]]
12498 [[:Bar:X(Y)Z|]]
12499 !! html/php
12500 [[Article(context)|Article]]
12501 [[Bar:Article(context)|Article]]
12502 [[:Bar:Article(context)|Article]]
12503 [[Article(context)]]
12504 [[Bar:X(Y)Z|X(Y)Z]]
12505 [[:Bar:X(Y)Z|X(Y)Z]]
12506 !! end
12507
12508 !! test
12509 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12510 !! options
12511 pst
12512 !! wikitext
12513 [[Article (context), context|]]
12514 [[Article (context),context|]]
12515 [[Bar:Article (context), context|]]
12516 [[Bar:Article (context),context|]]
12517 [[:Bar:Article (context), context|]]
12518 [[:Bar:Article (context),context|]]
12519 !! html/php
12520 [[Article (context), context|Article]]
12521 [[Article (context),context|Article]]
12522 [[Bar:Article (context), context|Article]]
12523 [[Bar:Article (context),context|Article]]
12524 [[:Bar:Article (context), context|Article]]
12525 [[:Bar:Article (context),context|Article]]
12526 !! end
12527
12528 !! test
12529 pre-save transform: trim trailing empty lines
12530 !! options
12531 pst
12532 !! wikitext
12533 Empty lines are trimmed
12534
12535
12536
12537
12538 !! html/php
12539 Empty lines are trimmed
12540 !! end
12541
12542 !! test
12543 pre-save transform: Signature expansion
12544 !! options
12545 pst
12546 !! wikitext
12547 * ~~~
12548 * <noinclude>~~~</noinclude>
12549 * <includeonly>~~~</includeonly>
12550 * <onlyinclude>~~~</onlyinclude>
12551 !! html/php
12552 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12553 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12554 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12555 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12556 !! end
12557
12558
12559 !! test
12560 pre-save transform: Signature expansion in nowiki tags (bug 93)
12561 !! options
12562 pst disabled
12563 !! wikitext
12564 Shall not expand:
12565
12566 <nowiki>~~~~</nowiki>
12567
12568 <includeonly><nowiki>~~~~</nowiki></includeonly>
12569
12570 <noinclude><nowiki>~~~~</nowiki></noinclude>
12571
12572 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12573
12574 {{subst:Foo}} shall be converted to FOO
12575
12576 As well as inside noinclude/onlyinclude
12577 <noinclude>{{subst:Foo}}</noinclude>
12578 <onlyinclude>{{subst:Foo}}</onlyinclude>
12579
12580 But not inside includeonly
12581 <includeonly>{{subst:Foo}}</includeonly>
12582 !! html/php
12583 Shall not expand:
12584
12585 <nowiki>~~~~</nowiki>
12586
12587 <includeonly><nowiki>~~~~</nowiki></includeonly>
12588
12589 <noinclude><nowiki>~~~~</nowiki></noinclude>
12590
12591 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12592
12593 FOO shall be converted to FOO
12594
12595 As well as inside noinclude/onlyinclude
12596 <noinclude>FOO</noinclude>
12597 <onlyinclude>FOO</onlyinclude>
12598
12599 But not inside includeonly
12600 <includeonly>{{subst:Foo}}</includeonly>
12601 !! end
12602
12603 !! test
12604 Parsoid: Recognize nowiki with trailing space in tags
12605 !! options
12606 parsoid=wt2html
12607 !! wikitext
12608 <nowiki ><div>[[foo]]</nowiki >
12609
12610 a<nowiki / >b
12611
12612 c<nowiki />d
12613
12614 e<nowiki/ >f
12615 !! html
12616 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12617 <p>ab</p>
12618 <p>cd</p>
12619 <p>ef</p>
12620 !! end
12621
12622 !! test
12623 Parsoid: Recognize nowiki with odd capitalization
12624 !! options
12625 parsoid=wt2html
12626 !! wikitext
12627 <noWikI ><div>[[foo]]</Nowiki >
12628 !! html
12629 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12630 !! end
12631
12632
12633 !! test
12634 Parsoid: Escape nowiki with trailing space in tags
12635 !! options
12636 parsoid=html2wt
12637 !! html/parsoid
12638 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12639 <p>a&lt;nowiki /&gt;b</p>
12640 <p>c&lt;nowiki/ &gt;d</p>
12641 !! wikitext
12642 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12643
12644 a&lt;nowiki /&gt;b
12645
12646 c&lt;nowiki/ &gt;d
12647 !! end
12648
12649 !! test
12650 Parsoid: Escape weird noWikI capitalizations
12651 !! options
12652 parsoid=html2wt
12653 !! html/parsoid
12654 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
12655 !! wikitext
12656 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
12657 !! end
12658
12659 ###
12660 ### Message transform tests
12661 ###
12662 !! test
12663 message transform: magic variables
12664 !! options
12665 msg
12666 !! wikitext
12667 {{SITENAME}}
12668 !! html
12669 MediaWiki
12670 !! end
12671
12672 !! test
12673 message transform: should not transform wiki markup
12674 !! options
12675 msg
12676 !! wikitext
12677 ''test''
12678 !! html
12679 ''test''
12680 !! end
12681
12682 !! test
12683 message transform: <noinclude> in transcluded template (bug 4926)
12684 !! options
12685 msg
12686 !! wikitext
12687 {{Includes}}
12688 !! html
12689 Foobar
12690 !! end
12691
12692 !! test
12693 message transform: <onlyinclude> in transcluded template (bug 4926)
12694 !! options
12695 msg
12696 !! wikitext
12697 {{Includes2}}
12698 !! html
12699 Foo
12700 !! end
12701
12702 !! test
12703 {{#special:}} page name, known
12704 !! options
12705 msg
12706 !! wikitext
12707 {{#special:Recentchanges}}
12708 !! html
12709 Special:RecentChanges
12710 !! end
12711
12712 !! test
12713 {{#special:}} page name with subpage, known
12714 !! options
12715 msg
12716 !! wikitext
12717 {{#special:Recentchanges/param}}
12718 !! html
12719 Special:RecentChanges/param
12720 !! end
12721
12722 !! test
12723 {{#special:}} page name, unknown
12724 !! options
12725 msg
12726 !! wikitext
12727 {{#special:foobar nonexistent}}
12728 !! html
12729 Special:Foobar nonexistent
12730 !! end
12731
12732 !! test
12733 {{#speciale:}} page name, known
12734 !! options
12735 msg
12736 !! wikitext
12737 {{#speciale:Recentchanges}}
12738 !! html
12739 Special:RecentChanges
12740 !! end
12741
12742 !! test
12743 {{#speciale:}} page name with subpage, known
12744 !! options
12745 msg
12746 !! wikitext
12747 {{#speciale:Recentchanges/param}}
12748 !! html
12749 Special:RecentChanges/param
12750 !! end
12751
12752 !! test
12753 {{#speciale:}} page name, unknown
12754 !! options
12755 msg
12756 !! wikitext
12757 {{#speciale:foobar nonexistent}}
12758 !! html
12759 Special:Foobar_nonexistent
12760 !! end
12761
12762 ###
12763 ### Images
12764 ###
12765 ### For Parsoid-specific tests, see
12766 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12767
12768 !! test
12769 Simple image
12770 !! options
12771 parsoid=wt2html,wt2wt,html2html
12772 !! wikitext
12773 [[Image:foobar.jpg]]
12774 !! html/php
12775 <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>
12776 </p>
12777 !! html/parsoid
12778 <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>
12779 !! end
12780
12781 !! test
12782 Simple image (using File: namespace, now canonical)
12783 !! wikitext
12784 [[File:Foobar.jpg]]
12785 !! html/php
12786 <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>
12787 </p>
12788 !! html/parsoid
12789 <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>
12790 !! end
12791
12792 !! test
12793 Right-aligned image
12794 !! wikitext
12795 [[File:Foobar.jpg|right]]
12796 !! html/php
12797 <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>
12798
12799 !! html/parsoid
12800 <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>
12801 !! end
12802
12803 !! test
12804 Image with caption
12805 !! wikitext
12806 [[File:Foobar.jpg|right|Caption text]]
12807 !! html/php
12808 <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>
12809
12810 !! html/parsoid
12811 <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>
12812 !! end
12813
12814 !! test
12815 Image with caption, bug 53312 #1
12816 !! wikitext
12817 [[File:Foobar.jpg|right|Caption page stuff]]
12818 !! html/php
12819 <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>
12820
12821 !! html/parsoid
12822 <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>
12823 !! end
12824
12825 !! test
12826 Image with caption, bug 53312 #2
12827 !! wikitext
12828 [[File:Foobar.jpg|right|Caption page=]]
12829 !! html/php
12830 <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>
12831
12832 !! html/parsoid
12833 <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>
12834 !! end
12835
12836 !! test
12837 Image with caption, bug 53312 #3
12838 !! wikitext
12839 [[File:Foobar.jpg|right|Caption page=stuff]]
12840 !! html/php
12841 <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>
12842
12843 !! html/parsoid
12844 <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>
12845 !! end
12846
12847 !! test
12848 Allow empty links in image captions (Bug 60753)
12849 !! options
12850 thumbsize=220
12851 !! wikitext
12852 [[File:Foobar.jpg|thumb|Caption [[Link1]]
12853 [[]]
12854 [[Link2]]
12855 ]]
12856 !! html/php
12857 <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>
12858
12859 !! html/parsoid
12860 <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>
12861 [[]]
12862 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
12863 </figcaption></figure>
12864 !! end
12865
12866 !! test
12867 Titles in unlinked images (T23454)
12868 !! wikitext
12869 [[File:Foobar.jpg|link=|stuff]]
12870 !! html/php
12871 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
12872 </p>
12873 !! end
12874
12875 !! test
12876 Link with empty target
12877 !! wikitext
12878 [[]]
12879 !! html
12880 <p>[[]]
12881 </p>
12882 !! end
12883
12884 !! test
12885 Image with link trail
12886 !! wikitext
12887 Linktrails should not work for images: [[File:Foobar.jpg]]s
12888 !! html/php
12889 <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
12890 </p>
12891 !! html/parsoid
12892 <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>
12893 !! end
12894
12895 !! test
12896 Image with empty attribute
12897 !! options
12898 parsoid=wt2html,wt2wt,html2html
12899 !! wikitext
12900 [[File:Foobar.jpg|right||Caption text]]
12901 !! html/php
12902 <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>
12903
12904 !! html/parsoid
12905 <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>
12906 !! end
12907
12908 !! test
12909 1. Block image with individual attributes from templates
12910 !! wikitext
12911 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
12912 !! html/php
12913 <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>
12914
12915 !! html/parsoid
12916 <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>
12917 !! end
12918
12919 !! test
12920 2. Block Image with individual attributes from templates
12921 !! wikitext
12922 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
12923 !! html/php
12924 <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>
12925
12926 !! html/parsoid
12927 <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>
12928 !! end
12929
12930 !! test
12931 3. Inline image with individual attributes from templates
12932 !! wikitext
12933 [[File:Foobar.jpg|{{echo|50px}}]]
12934 !! html/php
12935 <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>
12936 </p>
12937 !! html/parsoid
12938 <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>
12939 !! end
12940
12941 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
12942 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
12943 !! test
12944 Image with multiple attributes from the same template
12945 !! wikitext
12946 [[File:Foobar.jpg|{{image_attribs}}]]
12947 !! html/php
12948 <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>
12949
12950 !! html/parsoid
12951 <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>
12952 !! end
12953
12954 !! test
12955 Image with link tails
12956 !! options
12957 thumbsize=220
12958 !! wikitext
12959 123[[File:Foobar.jpg]]456
12960 123[[File:Foobar.jpg|right]]456
12961 123[[File:Foobar.jpg|thumb]]456
12962 !! html/php
12963 <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
12964 </p>
12965 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
12966 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
12967
12968 !! html/php+tidy
12969 <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>
12970 <p>123</p>
12971 <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>
12972 <p>456 123</p>
12973 <div class="thumb tright">
12974 <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>
12975 <div class="thumbcaption">
12976 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
12977 </div>
12978 </div>
12979 </div>
12980 <p>456</p>
12981 !! html/parsoid
12982 <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>
12983 <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>
12984 <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>
12985 !! end
12986
12987 !! test
12988 Image with multiple captions -- only last one is accepted
12989 !! wikitext
12990 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
12991 !! html/php
12992 <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>
12993
12994 !! html/parsoid
12995 <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>
12996 !! end
12997
12998 !! test
12999 Image with multiple widths -- use last
13000 !! wikitext
13001 [[File:Foobar.jpg|200px|300px|caption]]
13002 !! html/php
13003 <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>
13004 </p>
13005 !! html/parsoid
13006 <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>
13007 !! end
13008
13009 !! test
13010 Image with multiple alignments -- use first (bug 48664)
13011 !! options
13012 thumbsize=220
13013 !! wikitext
13014 [[File:Foobar.jpg|thumb|left|right|center|caption]]
13015
13016 [[File:Foobar.jpg|middle|text-top|caption]]
13017 !! html/php
13018 <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>
13019 <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>
13020 </p>
13021 !! html/parsoid
13022 <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>
13023 <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>
13024 !! end
13025
13026 !! test
13027 Image with width attribute at different positions
13028 !! wikitext
13029 [[File:Foobar.jpg|200px|right|Caption]]
13030 [[File:Foobar.jpg|right|200px|Caption]]
13031 [[File:Foobar.jpg|right|Caption|200px]]
13032 !! html/php
13033 <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>
13034 <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>
13035 <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>
13036
13037 !! html/parsoid
13038 <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>
13039 <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>
13040 <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>
13041 !! end
13042
13043 # a sad bit of backward-compatibility
13044 !! test
13045 Image with size specified with pxpx (bug 13500, 51628)
13046 !! options
13047 parsoid=wt2html,wt2wt,html2html
13048 !! wikitext
13049 [[File:Foobar.jpg|20pxpx]]
13050 [[File:Foobar.jpg|200x20pxpx]]
13051 !! html/php
13052 <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>
13053 <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>
13054 </p>
13055 !! html/parsoid
13056 <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>
13057 !! end
13058
13059 !! test
13060 Image with link parameter, wiki target
13061 !! wikitext
13062 [[File:Foobar.jpg|link=Main Page]]
13063 !! html/php
13064 <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>
13065 </p>
13066 !! html/parsoid
13067 <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>
13068 !! end
13069
13070 # parsoid bug 49293 (part 1)
13071 !! test
13072 Image with link parameter, URL target
13073 !! wikitext
13074 [[File:Foobar.jpg|link=http://example.com/]]
13075 !! html/php
13076 <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>
13077 </p>
13078 !! html/parsoid
13079 <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>
13080 !! end
13081
13082 # parsoid bug 49293 (part 2)
13083 !! test
13084 Image with link parameter, protocol-less URL target
13085 !! wikitext
13086 [[File:Foobar.jpg|link=//example.com/]]
13087 !! html/php
13088 <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>
13089 </p>
13090 !! html/parsoid
13091 <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>
13092 !! end
13093
13094 !! test
13095 Escaping non-block captions (T107435)
13096 !! options
13097 parsoid={
13098 "modes": ["wt2wt"],
13099 "changes": [
13100 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13101 ]
13102 }
13103 !! wikitext
13104 [[Image:Foobar.jpg|caption]]
13105 !! wikitext/edited
13106 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13107 !! end
13108
13109 # wgExternalLinkTarget not supported by Parsoid
13110 !! test
13111 Image with link parameter, wgExternalLinkTarget
13112 !! wikitext
13113 [[Image:foobar.jpg|link=http://example.com/]]
13114 !! config
13115 wgExternalLinkTarget='foobar'
13116 !! html/php
13117 <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>
13118 </p>
13119 !! end
13120
13121 !! test
13122 Image with link parameter, wgNoFollowLinks set to false
13123 !! wikitext
13124 [[Image:foobar.jpg|link=http://example.com/]]
13125 !! config
13126 wgNoFollowLinks=false
13127 !! html
13128 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13129 </p>
13130 !! end
13131
13132 !! test
13133 Image with link parameter, wgNoFollowDomainExceptions
13134 !! wikitext
13135 [[Image:foobar.jpg|link=http://example.com/]]
13136 !! config
13137 wgNoFollowDomainExceptions='example.com'
13138 !! html
13139 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13140 </p>
13141 !! end
13142
13143 # wgExternalLinkTarget not supported by Parsoid
13144 !! test
13145 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13146 !! wikitext
13147 [[Image:foobar.jpg|link=http://example.com/|Title]]
13148 !! config
13149 wgExternalLinkTarget='foobar'
13150 !! html/php
13151 <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>
13152 </p>
13153 !! end
13154
13155 !! test
13156 Image with empty link parameter
13157 !! wikitext
13158 [[File:Foobar.jpg|link=]]
13159 !! html/php
13160 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13161 </p>
13162 !! html/parsoid
13163 <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>
13164 !! end
13165
13166 !! test
13167 Image with link parameter (wiki target) and unnamed parameter
13168 !! wikitext
13169 [[File:Foobar.jpg|link=Main_Page|Title]]
13170 !! html/php
13171 <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>
13172 </p>
13173 !! html/parsoid
13174 <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>
13175 !! end
13176
13177 !! test
13178 Image with link parameter (URL target) and unnamed parameter
13179 !! wikitext
13180 [[File:Foobar.jpg|link=http://example.com/|Title]]
13181 !! html/php
13182 <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>
13183 </p>
13184 !! html/parsoid
13185 <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>
13186 !! end
13187
13188 !! test
13189 Thumbnail image with link parameter
13190 !! options
13191 thumbsize=220
13192 parsoid=wt2html,wt2wt,html2html
13193 !! wikitext
13194 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13195 !! html/php
13196 <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>
13197
13198 !! html/parsoid
13199 <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>
13200 !! end
13201
13202 !! test
13203 Manually-specified thumbnail image
13204 !! options
13205 thumbsize=220
13206 !! wikitext
13207 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13208 !! html/php
13209 <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>
13210
13211 !! html/parsoid
13212 <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>
13213 !! end
13214
13215 !! test
13216 Manually-specified thumbnail image with explicit link to wiki page
13217 !! options
13218 thumbsize=220
13219 parsoid=wt2html,wt2wt,html2html
13220 !! wikitext
13221 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13222 !! html/php
13223 <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>
13224
13225 !! html/parsoid
13226 <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>
13227 !! end
13228
13229 !! test
13230 Manually-specified thumbnail image with explicit link to url
13231 !! options
13232 thumbsize=220
13233 parsoid=wt2html,wt2wt,html2html
13234 !! wikitext
13235 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13236 !! html/php
13237 <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>
13238
13239 !! html/parsoid
13240 <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>
13241 !! end
13242
13243 !! test
13244 Manually-specified thumbnail image with explicit no link
13245 !! options
13246 thumbsize=220
13247 parsoid=wt2html,wt2wt,html2html
13248 !! wikitext
13249 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13250 !! html/php
13251 <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>
13252
13253 !! html/parsoid
13254 <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>
13255 !! end
13256
13257 !! test
13258 Manually-specified thumbnail image with explicit link and alt text
13259 !! options
13260 thumbsize=220
13261 parsoid=wt2html,wt2wt,html2html
13262 !! wikitext
13263 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13264 !! html/php
13265 <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>
13266
13267 !! html/parsoid
13268 <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>
13269 !! end
13270
13271 !! test
13272 Image with frame and link
13273 !! options
13274 parsoid=wt2html,wt2wt,html2html
13275 !! wikitext
13276 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13277 !! html/php
13278 <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>
13279
13280 !! html/parsoid
13281 <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>
13282 !! end
13283
13284 !! test
13285 Image with frame and link and explicit alt
13286 !! options
13287 parsoid=wt2html,wt2wt,html2html
13288 !! wikitext
13289 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13290 !! html/php
13291 <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>
13292
13293 !! html/parsoid
13294 <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>
13295 !! end
13296
13297 !! test
13298 Image with wiki markup in implicit alt
13299 !! wikitext
13300 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13301
13302 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13303 !! html/php
13304 <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>
13305 </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>
13306 </p>
13307 !! html/parsoid
13308 <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>
13309 <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>
13310 !! end
13311
13312 !! test
13313 Alt image option should handle most kinds of wikitext without barfing
13314 !! wikitext
13315 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13316 !! html/php
13317 <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>
13318
13319 !! html/parsoid
13320 <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>
13321 !! end
13322
13323 ###################
13324 # Conflicting image format options.
13325 # First option specified should 'win'.
13326 # All three cases in each test should be identical.
13327
13328 !! test
13329 Image with 'frameless' first.
13330 !! options
13331 parsoid=wt2html,wt2wt,html2html
13332 !! wikitext
13333 [[File:Foobar.jpg|frameless|caption]]
13334
13335 [[File:Foobar.jpg|frameless|frame|caption]]
13336
13337 [[File:Foobar.jpg|frameless|thumb|caption]]
13338 !! html/php
13339 <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>
13340 </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>
13341 </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>
13342 </p>
13343 !! html/parsoid
13344 <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>
13345 <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>
13346 <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>
13347 !! end
13348
13349 !! test
13350 Image with 'frame' first.
13351 !! options
13352 parsoid=wt2html,wt2wt,html2html
13353 !! wikitext
13354 [[File:Foobar.jpg|frame|caption]]
13355 [[File:Foobar.jpg|frame|frameless|caption]]
13356 [[File:Foobar.jpg|frame|thumb|caption]]
13357 !! html/php
13358 <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>
13359 <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>
13360 <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>
13361
13362 !! html/parsoid
13363 <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>
13364 <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>
13365 <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>
13366 !! end
13367
13368 !! test
13369 Image with 'thumb' first.
13370 !! options
13371 parsoid=wt2html,wt2wt,html2html
13372 !! wikitext
13373 [[File:Foobar.jpg|thumb|caption]]
13374 [[File:Foobar.jpg|thumb|frameless|caption]]
13375 [[File:Foobar.jpg|thumb|frame|caption]]
13376 !! html/php
13377 <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>
13378 <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>
13379 <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>
13380
13381 !! html/parsoid
13382 <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>
13383 <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>
13384 <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>
13385 !! end
13386
13387 ###################
13388 # Image sizing.
13389 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13390 # and https://phabricator.wikimedia.org/T64258
13391 # Foobar has actual size of 1941x220
13392 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13393 # a scalable format.
13394 # 2. Framed images always ignore size options; always render at default size.
13395 # 3. "Unspecified format" and border are the only types which can be
13396 # enlarged.
13397
13398 !! test
13399 Image: "unspecified format" and border enlarge
13400 !! options
13401 parsoid=wt2html,wt2wt,html2html
13402 !! wikitext
13403 [[File:Foobar.jpg|2000px]]
13404
13405 [[File:Foobar.jpg|border|2000px]]
13406 !! html/php
13407 <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>
13408 </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>
13409 </p>
13410 !! html/parsoid
13411 <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>
13412 <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>
13413 !! end
13414
13415 !! test
13416 Image: "unspecified format" and border reduce
13417 !! options
13418 parsoid=wt2html,wt2wt,html2html
13419 !! wikitext
13420 [[File:Foobar.jpg|1000px]]
13421
13422 [[File:Foobar.jpg|border|1000px]]
13423 !! html/php
13424 <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>
13425 </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>
13426 </p>
13427 !! html/parsoid
13428 <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>
13429 <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>
13430 !! end
13431
13432 !! test
13433 Image: thumbs reduce
13434 !! options
13435 parsoid=wt2html,wt2wt,html2html
13436 !! wikitext
13437 [[File:Foobar.jpg|thumb|50px]]
13438 !! html/php
13439 <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>
13440
13441 !! html/parsoid
13442 <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>
13443 !! end
13444
13445 !! test
13446 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13447 !! options
13448 parsoid=wt2html,wt2wt,html2html
13449 !! wikitext
13450 [[File:Foobar.jpg|thumb|2000px]]
13451
13452 [[File:Foobar.svg|thumb|2000px]]
13453 !! html/php
13454 <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>
13455 <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>
13456
13457 !! html/parsoid
13458 <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>
13459 <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>
13460 !! end
13461
13462 !! test
13463 Image: frameless can reduce in size
13464 !! options
13465 parsoid=wt2html,wt2wt,html2html
13466 !! wikitext
13467 [[File:Foobar.jpg|frameless|50px]]
13468 !! html/php
13469 <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>
13470 </p>
13471 !! html/parsoid
13472 <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>
13473 !! end
13474
13475 !! test
13476 Image: bitmap frameless can't be enlarged past original size, but vector can
13477 !! options
13478 parsoid=wt2html,wt2wt,html2html
13479 !! wikitext
13480 [[File:Foobar.jpg|frameless|2000px]]
13481
13482 [[File:Foobar.svg|frameless|2000px]]
13483 !! html/php
13484 <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>
13485 </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>
13486 </p>
13487 !! html/parsoid
13488 <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>
13489 <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>
13490 !! end
13491
13492 !! test
13493 Image: framed images are always unscaled.
13494 !! options
13495 parsoid=wt2html,wt2wt,html2html
13496 !! wikitext
13497 [[File:Foobar.jpg|frame]]
13498
13499 [[File:Foobar.jpg|frame|50px]]
13500
13501 [[File:Foobar.jpg|frame|50x50px]]
13502
13503 [[File:Foobar.jpg|frame|2000px]]
13504 !! html/php
13505 <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>
13506 <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>
13507 <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>
13508 <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>
13509
13510 !! html/parsoid
13511 <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>
13512 <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>
13513 <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>
13514 <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>
13515 !! end
13516
13517 ###################
13518
13519 !! test
13520 Link to image page- image page normally doesn't exists, hence edit link
13521 Add test with existing image page
13522 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13523 !! wikitext
13524 [[:Image:test]]
13525 !! html
13526 <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>
13527 </p>
13528 !! end
13529
13530 !! test
13531 bug 18784 Link to non-existent image page with caption should use caption as link text
13532 !! wikitext
13533 [[:Image:test|caption]]
13534 !! html
13535 <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>
13536 </p>
13537 !! end
13538
13539 !! test
13540 Frameless image caption with a free URL
13541 !! wikitext
13542 [[File:Foobar.jpg|http://example.com]]
13543 !! html/php
13544 <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>
13545 </p>
13546 !! html/parsoid
13547 <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>
13548 !! end
13549
13550 !! test
13551 Thumbnail image caption with a free URL
13552 !! options
13553 thumbsize=220
13554 !! wikitext
13555 [[File:Foobar.jpg|thumb|http://example.com]]
13556 !! html/php
13557 <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>
13558
13559 !! html/parsoid
13560 <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>
13561 !! end
13562
13563 !! test
13564 Thumbnail image caption with a free URL and explicit alt
13565 !! options
13566 thumbsize=220
13567 parsoid=wt2html,wt2wt,html2html
13568 !! wikitext
13569 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13570 !! html/php
13571 <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>
13572
13573 !! html/parsoid
13574 <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>
13575 !! end
13576
13577 !! test
13578 SVG thumbnails with no language set
13579 !! options
13580 !! wikitext
13581 [[File:Foobar.svg|thumb|caption]]
13582 !! html/php
13583 <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>
13584
13585 !! html/parsoid
13586 <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>
13587 !! end
13588
13589 !! test
13590 SVG thumbnails with language de
13591 !! options
13592 parsoid=wt2html,wt2wt,html2html
13593 !! wikitext
13594 [[File:Foobar.svg|thumb|caption|lang=de]]
13595 !! html/php
13596 <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>
13597
13598 !! html/parsoid
13599 <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>
13600 !! end
13601
13602 !! test
13603 SVG thumbnails with invalid language code
13604 !! options
13605 parsoid=wt2html,wt2wt,html2html
13606 !! wikitext
13607 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
13608 !! html/php
13609 <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>
13610
13611 !! html/parsoid
13612 <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>
13613 !! end
13614
13615 !! test
13616 BUG 1887: A ISBN with a thumbnail
13617 !! wikitext
13618 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
13619 !! html/php
13620 <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>
13621
13622 !! html/parsoid
13623 <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>
13624 !! end
13625
13626 !! test
13627 BUG 1887: A RFC with a thumbnail
13628 !! wikitext
13629 [[File:Foobar.jpg|thumb|This is RFC 12354]]
13630 !! html/php
13631 <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>
13632
13633 !! html/parsoid
13634 <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>
13635 !! end
13636
13637 !! test
13638 BUG 1887: A mailto link with a thumbnail
13639 !! wikitext
13640 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
13641 !! html/php
13642 <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>
13643
13644 !! html/parsoid
13645 <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>
13646 !! end
13647
13648 # Pending resolution to bug 368
13649 !! test
13650 BUG 648: Frameless image caption with a link
13651 !! wikitext
13652 [[File:Foobar.jpg|text with a [[link]] in it]]
13653 !! html/php
13654 <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>
13655 </p>
13656 !! html/parsoid
13657 <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>
13658 !! end
13659
13660 !! test
13661 BUG 648: Frameless image caption with a link (suffix)
13662 !! wikitext
13663 [[File:Foobar.jpg|text with a [[link]]foo in it]]
13664 !! html/php
13665 <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>
13666 </p>
13667 !! html/parsoid
13668 <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>
13669 !! end
13670
13671 !! test
13672 BUG 648: Frameless image caption with an interwiki link
13673 !! wikitext
13674 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
13675 !! html/php
13676 <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>
13677 </p>
13678 !! html/parsoid
13679 <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>
13680 !! end
13681
13682 !! test
13683 BUG 648: Frameless image caption with a piped interwiki link
13684 !! wikitext
13685 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
13686 !! html/php
13687 <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>
13688 </p>
13689 !! html/parsoid
13690 <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>
13691 !! end
13692
13693 !! test
13694 T107474: Frameless image caption with <nowiki>
13695 !! wikitext
13696 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
13697 !! html/parsoid
13698 <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>
13699 !! end
13700
13701 !! test
13702 Escape HTML special chars in image alt text
13703 !! wikitext
13704 [[File:Foobar.jpg|& < > "]]
13705 !! html/php
13706 <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>
13707 </p>
13708 !! html/parsoid
13709 <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>
13710 !! end
13711
13712 !! test
13713 BUG 499: Alt text should have &#1234;, not &amp;1234;
13714 !! wikitext
13715 [[File:Foobar.jpg|&#9792;]]
13716 !! html/php
13717 <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>
13718 </p>
13719 !! html/parsoid
13720 <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>
13721 !! end
13722
13723 !! test
13724 Broken image caption with link
13725 !! options
13726 parsoid=wt2html,wt2wt,html2html
13727 !! wikitext
13728 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
13729 !! html/php
13730 <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.
13731 </p>
13732 !! html/parsoid
13733 <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>
13734 !! end
13735
13736 !! test
13737 Image caption containing another image
13738 !! wikitext
13739 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
13740 !! html/php
13741 <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>
13742
13743 !! html/parsoid
13744 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>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>
13745 !! end
13746
13747 !! test
13748 Image: caption containing a newline
13749 !! wikitext
13750 [[File:Foobar.jpg|This
13751 *is some text]]
13752 !! html/php
13753 <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>
13754 </p>
13755 !! html/parsoid
13756 <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>
13757 !!end
13758
13759 !!test
13760 Image: caption containing leading space
13761 (The leading space should not trigger nowiki escaping in wt2wt mode)
13762 !! wikitext
13763 [[File:Foobar.jpg|thumb| bar]]
13764 !! html/php
13765 <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>
13766
13767 !! html/parsoid
13768 <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>
13769 !!end
13770
13771 !! test
13772 Image: caption containing a table
13773 !! options
13774 parsoid=wt2html,wt2wt,html2html
13775 !! wikitext
13776 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
13777 {|
13778 ! Foo !! Bar
13779 |-
13780 | Foo1 || Bar1
13781 |}
13782 and some more text.]]
13783 !! html/php
13784 <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>
13785
13786 !! html/parsoid
13787 <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
13788 <table>
13789 <tbody>
13790 <tr><th>Foo </th><th>Bar</th></tr>
13791 <tr>
13792 <td>Foo1 </td>
13793 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
13794 !! end
13795
13796 !! test
13797 Bug 3090: External links other than http: in image captions
13798 !! wikitext
13799 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
13800 !! html/php
13801 <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>
13802
13803 !! html/parsoid
13804 <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>
13805 !! end
13806
13807 !! test
13808 Custom class
13809 !! options
13810 parsoid=wt2html,wt2wt,html2html
13811 !! wikitext
13812 [[Image:foobar.jpg|a|class=b]]
13813 !! html/php
13814 <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>
13815 </p>
13816 !! html/parsoid
13817 <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>
13818 !! end
13819
13820 !! test
13821 Localized image handling (1).
13822 !! options
13823 parsoid=wt2html,wt2wt,html2html
13824 language=es
13825 !! wikitext
13826 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
13827 !! html/php
13828 <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>
13829
13830 !! html/parsoid
13831 <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>
13832 !! end
13833
13834 !! test
13835 Localized image handling (2).
13836 !! options
13837 thumbsize=220
13838 parsoid=wt2html,wt2wt,html2html
13839 language=es
13840 !! wikitext
13841 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
13842 !! html/php
13843 <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>
13844
13845 !! html/parsoid
13846 <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>
13847 !! end
13848
13849 !! test
13850 "border", "frameless" and "class" attributes on an image.
13851 !! options
13852 thumbsize=220
13853 parsoid=wt2html,wt2wt,html2html
13854 !! wikitext
13855 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
13856 !! html/php
13857 <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>
13858 </p>
13859 !! html/parsoid
13860 <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>
13861 !! end
13862
13863 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
13864 !! test
13865 Invalid image attributes (bug 62500)
13866 !! options
13867 thumbsize=220
13868 parsoid=wt2html,wt2wt,html2html
13869 !! wikitext
13870 [[File:Foobar.jpg|thumb|float|left|caption]]
13871
13872 [[File:Foobar.jpg|thumb|righ|caption]]
13873
13874 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
13875 !! html/php
13876 <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>
13877 <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>
13878 <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>
13879
13880 !! html/parsoid
13881 <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>
13882 <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>
13883 <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>
13884 !! end
13885
13886 !! article
13887 File:Barfoo.jpg
13888 !! text
13889 #REDIRECT [[File:Barfoo.jpg]]
13890 !! endarticle
13891
13892 # FIXME: Parsoid should run this test -- but we'd need to teach the
13893 # mockAPI about the redirected Barfoo.jpg image.
13894 !! test
13895 Redirected image
13896 !! wikitext
13897 [[Image:Barfoo.jpg]]
13898 !! html/php
13899 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
13900 </p>
13901 !! end
13902
13903 !! test
13904 Missing image with uploads disabled
13905 !! options
13906 wgEnableUploads=0
13907 !! wikitext
13908 [[File:Foobaz.jpg]]
13909 !! html/php
13910 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
13911 </p>
13912 !! html/parsoid
13913 <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>
13914 !! end
13915
13916 # Parsoid-specific testing for images
13917 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13918 # Currently imperfect due to a flaw in the Parsoid testrunner
13919 # Work in progress
13920 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
13921 # image tests.
13922
13923 !! test
13924 Parsoid-specific image handling - simple image with size and middle alignment
13925 !! wikitext
13926 [[File:Foobar.jpg|middle|50px]]
13927 !! html/parsoid
13928 <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>
13929 !! end
13930
13931 !! test
13932 Parsoid-specific image handling - simple image with size, middle alignment,
13933 non-standard namespace alias
13934 !! options
13935 parsoid=wt2wt,wt2html,html2html
13936 !! wikitext
13937 [[Image:Foobar.jpg|middle|50px]]
13938 !! html/parsoid
13939 <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>
13940 !! end
13941
13942 !! test
13943 Parsoid-specific image handling - simple image with size and middle alignment
13944 (existing content)
13945 !! wikitext
13946 [[File:Foobar.jpg|50px|middle]]
13947 !! html/parsoid
13948 <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>
13949 !! end
13950
13951 !! test
13952 Parsoid-specific image handling - simple image with size and middle alignment
13953 and non-standard namespace name
13954 !! options
13955 parsoid=wt2html,wt2wt,html2html
13956 !! wikitext
13957 [[Image:Foobar.jpg|50px|middle]]
13958 !! html/parsoid
13959 <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>
13960 !! end
13961
13962 !! test
13963 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
13964 !! wikitext
13965 [[File:Foobar.jpg|500x10px|baseline|caption]]
13966 !! html/parsoid
13967 <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>
13968 !! end
13969
13970 !! test
13971 Parsoid-specific image handling - simple image with border and size spec
13972 !! wikitext
13973 [[File:Foobar.jpg|50px|border|caption]]
13974 !! html/parsoid
13975 <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>
13976 !! end
13977
13978 !! test
13979 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13980 !! wikitext
13981 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
13982 !! html/parsoid
13983 <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>
13984 !! end
13985
13986 !! test
13987 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13988 (existing content)
13989 !! wikitext
13990 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
13991 !! html/parsoid
13992 <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>
13993 !! end
13994
13995 !! test
13996 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
13997 !! wikitext
13998 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
13999 !! html/parsoid
14000 <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>
14001 !! end
14002
14003 !! test
14004 Parsoid-specific image handling - thumbnail with specific size, halign,
14005 valign, and caption (existing content)
14006 !! wikitext
14007 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
14008 !! html/parsoid
14009 <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>
14010 !! end
14011
14012 !! test
14013 Parsoid-specific image handling - framed image with specific size and caption
14014 (size is ignored)
14015 !! options
14016 parsoid=wt2html,wt2wt,html2html
14017 !! wikitext
14018 [[File:Foobar.jpg|frame|500x50px|caption]]
14019 !! html/parsoid
14020 <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>
14021 !! end
14022
14023 !! test
14024 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14025 (size is ignored)
14026 !! options
14027 parsoid=wt2html,wt2wt,html2html
14028 !! wikitext
14029 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14030 !! html/parsoid
14031 <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>
14032 !! end
14033
14034 !! test
14035 Parsoid-specific image handling - frameless image with specific size, border, and caption
14036 !! wikitext
14037 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14038 !! html/parsoid
14039 <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>
14040 !! end
14041
14042 !! test
14043 Parsoid-specific image handling - simple image with a formatted caption
14044 !! wikitext
14045 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14046 !! html/parsoid
14047 <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>
14048 !! end
14049
14050 !! test
14051 Parsoid-specific image handling - caption with a template in it
14052 !! wikitext
14053 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14054 !! html/parsoid
14055 <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>
14056 !! end
14057
14058 !! test
14059 Parsoid-specific image handling - caption with unbalanced tags in it
14060 !! options
14061 parsoid=wt2html,wt2wt,html2html
14062 !! wikitext
14063 foo
14064 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14065 bar
14066 !! html/parsoid
14067 <p>foo</p>
14068 <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>
14069 <p>bar</p>
14070 !! end
14071
14072 !! test
14073 Parsoid-specific image handling - empty caption (1)
14074 !! options
14075 parsoid=wt2html,wt2wt
14076 !! wikitext
14077 [[File:Foobar.jpg|thumb|]]
14078 !! html/parsoid
14079 <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>
14080 !! end
14081
14082 # empty captions don't get serialized unless we're in the "round trip" case
14083 !! test
14084 Parsoid-specific image handling - empty caption (2)
14085 !! options
14086 parsoid=html2wt
14087 !! html/parsoid
14088 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14089 <a href="./File:Foobar.jpg">
14090 <img resource="./File:Foobar.jpg"
14091 src="//example.com/images/3/3a/Foobar.jpg"
14092 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14093 height="25" width="220"/>
14094 </a>
14095 <figcaption></figcaption>
14096 </figure>
14097 !! wikitext
14098 [[File:Foobar.jpg|thumb]]
14099 !! end
14100
14101 !! test
14102 Parsoid-specific image handling - whitespace caption
14103 !! wikitext
14104 [[File:Foobar.jpg|thumb| ]]
14105 !! html/parsoid
14106 <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>
14107 !! end
14108
14109 !! test
14110 Parsoid-specific image handling - lang option
14111 !! wikitext
14112 foo
14113 [[File:Foobar.svg|lang=de|caption]]
14114 bar
14115 !! html/parsoid
14116 <p>foo
14117 <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>
14118 bar</p>
14119 !! end
14120
14121 ## Edge case bugs in Parsoid from T93580
14122 !! test
14123 T93580: 1. Templated <ref> inside block images
14124 !! wikitext
14125 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14126
14127 <references />
14128 !! html/parsoid
14129 <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>
14130
14131 <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>
14132 !! end
14133
14134 !! test
14135 T93580: 2. <ref> inside inline images
14136 !! wikitext
14137 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14138
14139 <references />
14140 !! html/parsoid
14141 <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>
14142
14143 <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>
14144 !! end
14145
14146 !! test
14147 T93580: 3. Templated <ref> inside inline images
14148 !! wikitext
14149 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14150
14151 <references />
14152 !! html/parsoid
14153 <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>
14154
14155 <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>
14156 !! end
14157
14158 ###
14159 ### Subpages
14160 ###
14161 !! article
14162 Subpage test/subpage
14163 !! text
14164 foo
14165 !! endarticle
14166
14167 !! test
14168 Subpage link
14169 !! options
14170 subpage title=[[Subpage test]]
14171 !! wikitext
14172 [[/subpage]]
14173 !! html
14174 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14175 </p>
14176 !! end
14177
14178 !! test
14179 Subpage noslash link
14180 !! options
14181 subpage title=[[Subpage test]]
14182 !! wikitext
14183 [[/subpage/]]
14184 !! html
14185 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14186 </p>
14187 !! end
14188
14189 !! article
14190 Subpage test/1/2/subpage
14191 !! text
14192 blah
14193 !! endarticle
14194
14195 !! test
14196 Relative subpage noslash link
14197 !! options
14198 parsoid=wt2wt,wt2html,html2html
14199 subpage title=[[Subpage test/1/2/3/4]]
14200 !! wikitext
14201 [[../../subpage/]]
14202
14203 [[../../subpage]]
14204 !! html/php
14205 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14206 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14207 </p>
14208 !! html/parsoid
14209 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14210 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14211 !! end
14212
14213 !! test
14214 Parsoid: dot-slash prefixed wikilinks
14215 !! wikitext
14216 [[./foo]]
14217
14218 [[././bar]]
14219
14220 [[././baz/]]
14221 !! html/php
14222 <p>[[./foo]]
14223 </p><p>[[././bar]]
14224 </p><p>[[././baz/]]
14225 </p>
14226 !! html/parsoid
14227 <p>[[./foo]]
14228 </p><p>[[././bar]]
14229 </p><p>[[././baz/]]
14230 </p>
14231 !! end
14232
14233 !! test
14234 Render invalid page names as plain text (bug 51090)
14235 !! wikitext
14236 [[./../foo|bar]]
14237 [[foo�|bar]]
14238 [[foo/.|bar]]
14239 [[foo/..|bar]]
14240 [[foo~~~bar]]
14241 [[foo>bar]]
14242 [[foo[bar]]
14243 [[.]]
14244 [[..]]
14245 [[foo././bar]]
14246
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 [[{{echo|foo}bar}}]]
14255 [[{{echo|foo[bar}}]]
14256 [[{{echo|foo]bar}}]]
14257 [[{{echo|foo<bar}}]]
14258 !!html/php
14259 <p>[[./../foo|bar]]
14260 [[foo�|bar]]
14261 [[foo/.|bar]]
14262 [[foo/..|bar]]
14263 [[foo~~~bar]]
14264 [[foo&gt;bar]]
14265 [[foo[bar]]
14266 [[.]]
14267 [[..]]
14268 [[foo././bar]]
14269 </p><p>[[./../foo|bar]]
14270 [[foo/.|bar]]
14271 [[foo/..|bar]]
14272 [[foo~~~~bar]]
14273 [[foo&gt;bar]]
14274 [[foo././bar]]
14275 [[foo{bar]]
14276 [[foo}bar]]
14277 [[foo[bar]]
14278 [[foo]bar]]
14279 [[foo&lt;bar]]
14280 </p>
14281 !!html/parsoid
14282 <p>[[./../foo|bar]]
14283 [[foo�|bar]]
14284 [[foo/.|bar]]
14285 [[foo/..|bar]]
14286 [[foo~~~bar]]
14287 [[foo>bar]]
14288 [[foo[bar]]
14289 [[.]]
14290 [[..]]
14291 [[foo././bar]]</p>
14292
14293 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14294 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14295 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
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{bar"}},"i":0}}]}'>foo{bar</span>]]
14300 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14301 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14302 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14303 [[<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>
14304 !!end
14305
14306 !! test
14307 Disabled subpages
14308 !! wikitext
14309 [[/subpage]]
14310 !! html
14311 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14312 </p>
14313 !! end
14314
14315 !! test
14316 BUG 561: {{/Subpage}}
14317 !! options
14318 subpage title=[[Page]]
14319 !! wikitext
14320 {{/Subpage}}
14321 !! html
14322 <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>
14323 </p>
14324 !! end
14325
14326 ###
14327 ### Categories
14328 ###
14329 !! article
14330 Category:MediaWiki User's Guide
14331 !! text
14332 blah
14333 !! endarticle
14334
14335 !! test
14336 Link to category
14337 !! wikitext
14338 [[:Category:MediaWiki User's Guide]]
14339 !! html
14340 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14341 </p>
14342 !! end
14343
14344 !! test
14345 Simple category
14346 !! options
14347 cat
14348 !! wikitext
14349 [[Category:MediaWiki User's Guide]]
14350 !! html
14351 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14352 !! end
14353
14354 !! test
14355 PAGESINCATEGORY invalid title fatal (r33546 fix)
14356 !! wikitext
14357 {{PAGESINCATEGORY:<bogus>}}
14358 !! html
14359 <p>0
14360 </p>
14361 !! end
14362
14363 !! test
14364 Category with different sort key
14365 !! options
14366 cat
14367 !! wikitext
14368 [[Category:MediaWiki User's Guide|Foo]]
14369 !! html
14370 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14371 !! end
14372
14373 !! test
14374 Category with identical sort key
14375 !! options
14376 cat
14377 !! wikitext
14378 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14379 !! html
14380 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14381 !! end
14382
14383 !! test
14384 Category with empty sort key
14385 !! options
14386 cat
14387 pst
14388 !! wikitext
14389 [[Category:MediaWiki User's Guide|]]
14390 !! html/php
14391 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14392 !! end
14393
14394 !! test
14395 Category with empty sort key and parentheses
14396 !! options
14397 cat
14398 pst
14399 !! wikitext
14400 [[Category:Foo (bar)|]]
14401 !! html/php
14402 [[Category:Foo (bar)|Foo]]
14403 !! end
14404
14405 ## We used to, but no longer wt2wt this test since the default serializer
14406 ## will normalize all categories to serialize on their own line.
14407 ## This wikitext usage is going to be fairly uncommon in production and
14408 ## selser will take care of preserving formatting in those scenarios.
14409 !! test
14410 Category with link tail
14411 !! options
14412 cat
14413 pst
14414 parsoid=wt2html
14415 !! wikitext
14416 123[[Category:Foo]]456
14417 !! html/php
14418 123[[Category:Foo]]456
14419 !! html/parsoid
14420 <p>123<link rel="mw:PageProp/Category" href="Category:Foo"/>456</p>
14421 !! end
14422
14423 !! test
14424 Category with template
14425 !! options
14426 cat
14427 pst
14428 !! wikitext
14429 [[Category:{{echo|Foo}}]]
14430 !! html/php
14431 [[Category:{{echo|Foo}}]]
14432 !! end
14433
14434 !! test
14435 Category with template in sort key
14436 !! options
14437 cat
14438 pst
14439 !! wikitext
14440 [[Category:Foo|{{echo|Bar}}]]
14441 !! html/php
14442 [[Category:Foo|{{echo|Bar}}]]
14443 !! end
14444
14445 !! test
14446 Category with template in sort key and title
14447 !! options
14448 cat
14449 pst
14450 !! wikitext
14451 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14452 !! html/php
14453 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14454 !! end
14455
14456 ## We used to, but no longer wt2wt this test since the default serializer
14457 ## will normalize all categories to serialize on their own line.
14458 ## This wikitext usage is going to be fairly uncommon in production and
14459 ## selser will take care of preserving formatting in those scenarios.
14460 !! test
14461 Category / paragraph interactions
14462 !! options
14463 parsoid=wt2html
14464 !! wikitext
14465 Foo [[Category:Baz]] Bar
14466
14467 Foo [[Category:Baz]]
14468 Bar
14469
14470 Foo
14471 [[Category:Baz]]
14472 Bar
14473
14474 Foo
14475 [[Category:Baz]] Bar
14476
14477 Foo
14478 [[Category:Baz]]
14479 [[Category:Baz]]
14480 [[Category:Baz]]
14481 Bar
14482
14483 [[Category:Baz]]
14484 [[Category:Baz]]
14485 [[Category:Baz]]
14486
14487 [[Category:Baz]]
14488 {{echo|[[Category:Baz]]}}
14489 [[Category:Baz]]
14490 !! html/php
14491 <p>Foo Bar
14492 </p><p>Foo
14493 Bar
14494 </p><p>Foo
14495 Bar
14496 </p><p>Foo Bar
14497 </p><p>Foo
14498 Bar
14499 </p>
14500 !! html/parsoid
14501 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14502 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14503 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14504 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14505 <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>
14506 <link rel="mw:PageProp/Category" href="Category:Baz"/>
14507 !! end
14508
14509 ## We used to, but no longer wt2wt this test since the default serializer
14510 ## will normalize all categories to serialize on their own line.
14511 ## This wikitext usage is going to be fairly uncommon in production and
14512 ## selser will take care of preserving formatting in those scenarios.
14513 ##
14514 ## The whitespace on the empty line is part of the test. Please do not delete
14515 !! test
14516 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14517 !! options
14518 parsoid=wt2html
14519 !! wikitext
14520 This
14521
14522 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14523
14524 {{echo|[[Category:Foo]] and so should this!}}
14525 !! html/php
14526 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14527 </p>
14528 !! html/parsoid
14529 <p>This
14530
14531 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14532
14533 <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>
14534 !! end
14535
14536 ## Parsoid will not try to wt2wt this while preserving newlines because
14537 ## it suppresses excess newlines within list items -- and we don't want to
14538 ## introduce a special case just for categories, which is, in reality somewhat
14539 ## odd behavior -- categories are unlikely to be used in list items like this
14540 ## in top-level pages and are only likely to show up in template-generated
14541 ## list items where this RT-ing is a non-issue.
14542 ##
14543 ## The whitespace on the empty line is part of the test. Please do not delete
14544 !! test
14545 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14546 !! options
14547 parsoid=wt2html
14548 !! wikitext
14549 * This
14550
14551 [[Category:Foo]] and this should be part of the same list item
14552 * So should this
14553
14554 {{echo|[[Category:Foo]] and this should be part of the same list item}}
14555 !! html
14556 <ul><li>This and this should be part of the same list item</li>
14557 <li>So should this and this should be part of the same list item</li></ul>
14558 !! html/parsoid
14559 <ul>
14560 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
14561 <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>
14562 </ul>
14563 !! end
14564
14565 ## Newlines and categories that follow the last item of a list
14566 ## are treated differently because this (list followed by categories)
14567 ## is an extremely common pattern on wikis.
14568 !! test
14569 3. Categories and newlines: newline suppression for last list item should RT properly
14570 !! wikitext
14571 * a
14572 * b
14573
14574 [[Category:Foo]]
14575
14576 [[Category:Bar]]
14577 [[Category:Baz]]
14578 !! html/parsoid
14579 <ul><li> a</li>
14580 <li> b</li></ul>
14581
14582 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14583
14584 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14585 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14586 !! end
14587
14588 !! test
14589 4. Categories and newlines: newline suppression for last list item should RT properly
14590 !! wikitext
14591 * a
14592 **** b
14593
14594 [[Category:Foo]]
14595 !! html/parsoid
14596 <ul><li> a
14597 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
14598
14599 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14600 !! end
14601
14602 ## only wt2html for this to make sure the algo only applies to the rightmost path
14603 !! test
14604 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
14605 !! options
14606 parsoid=wt2html
14607 !! wikitext
14608 * a
14609 ** b
14610 [[Category:Foo]]
14611 * c
14612 ** d
14613 [[Category:Foo]]
14614 !! html/parsoid
14615 <ul><li> a
14616 <ul><li> b
14617 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
14618 <li> c
14619 <ul><li> d</li></ul></li></ul>
14620 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14621 !! end
14622
14623 ## We used to, but no longer wt2wt this test since the default serializer
14624 ## will normalize all categories to serialize on their own line.
14625 ## This wikitext usage is going to be fairly uncommon in production and
14626 ## selser will take care of preserving formatting in those scenarios.
14627 !! test
14628 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
14629 !! options
14630 parsoid=wt2html
14631 !! wikitext
14632 * a [[Category:Foo]]
14633 !! html/parsoid
14634 <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>
14635 !! end
14636
14637 # This test also demonstrates because of newline+category tunneling
14638 # through the list hander, template wrapping doesn't expand to the
14639 # containing list when the list item swallows the category.
14640 !! test
14641 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
14642 !! wikitext
14643 * {{echo|a
14644 [[Category:Foo]]}}
14645 !! html/parsoid
14646 <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
14647 </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>
14648 !! end
14649
14650 !! test
14651 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
14652 !! wikitext
14653 * a
14654
14655 {{echo|[[Category:Foo]]
14656 [[Category:Bar]]}}
14657 [[Category:Baz]]
14658 !! html/parsoid
14659 <ul><li> a</li></ul>
14660
14661 <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">
14662 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14663 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14664 !! end
14665
14666 !! test
14667 Parsoid: Serialize link to category page with colon escape
14668 !! options
14669 parsoid
14670 !! wikitext
14671
14672 [[:Category:Foo]]
14673 [[:Category:Foo|Bar]]
14674 !! html
14675 <p>
14676 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
14677 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
14678 </p>
14679 !! end
14680
14681 # We used to, but no longer wt2wt this test since the default serializer
14682 # will normalize all categories to serialize on their own line.
14683 # This wikitext usage is going to be fairly uncommon in production and
14684 # selser will take care of preventing whitespace insertion if this
14685 # occurs in an article.
14686 #
14687 # html2html disabled for the same reason (whitespace insertion between
14688 # x and y).
14689 #
14690 # html2wt disabled because it localizes the "Category" namespace.
14691 !! test
14692 Link prefix/suffixes aren't applied to category links
14693 !! options
14694 parsoid=wt2html
14695 language=is
14696 !! wikitext
14697 x[[Category:Foo]]y
14698 !! html/php
14699 <p>xy
14700 </p>
14701 !! html/parsoid
14702 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
14703 !! end
14704
14705 !! test
14706 Parsoid: Serialize link to file page with colon escape
14707 !! options
14708 parsoid
14709 !! wikitext
14710
14711 [[:File:Foo.png]]
14712 [[:File:Foo.png|Bar]]
14713 !! html
14714 <p>
14715 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
14716 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
14717 </p>
14718 !! end
14719
14720 !! test
14721 Parsoid: Serialize a genuine category link without colon escape
14722 !! options
14723 parsoid
14724 !! wikitext
14725 [[Category:Foo]]
14726 [[Category:Foo|Bar]]
14727 !! html
14728 <link rel="mw:PageProp/Category" href="./Category:Foo">
14729 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
14730 !! end
14731
14732 !! test
14733 Normalize hrefs properly before testing for invalid link targets (bug 70894)
14734 !! options
14735 parsoid=html2wt
14736 !! html/parsoid
14737 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
14738 !! wikitext
14739 [[Category:Toxine bactérienne]]
14740 !! end
14741
14742 !! test
14743 Parsoid: Defaultsort
14744 !! wikitext
14745 {{DEFAULTSORT:Foo}}
14746 !! html/parsoid
14747 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
14748 !! end
14749
14750 !! test
14751 Parsoid: Defaultsort (template-generated)
14752 !! wikitext
14753 {{{{echo|DEFAULTSORT}}:Foo}}
14754 !! html/parsoid
14755 <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}}]}'/>
14756 !! end
14757
14758 ###
14759 ### Inter-language links
14760 ###
14761 !! test
14762 Interlanguage links
14763 !! options
14764 ill
14765 !! wikitext
14766 [[es:Alimento]]
14767 [[fr:Nourriture]]
14768 [[zh:食品]]
14769 !! html/php
14770 es:Alimento fr:Nourriture zh:食品
14771 !! html/parsoid
14772 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
14773 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
14774 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
14775 !! end
14776
14777 !! test
14778 Duplicate interlanguage links (bug 24502)
14779 !! options
14780 ill
14781 !! wikitext
14782 [[es:1]]
14783 [[es:2]]
14784 [[fr:1]]
14785 [[fr:2]]
14786 !! html/php
14787 es:1 fr:1
14788 !! html/parsoid
14789 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
14790 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
14791 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
14792 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
14793 !! end
14794
14795 ###
14796 ### Sections
14797 ###
14798 !! test
14799 Basic section headings
14800 !! wikitext
14801 == Headline 1 ==
14802 Some text
14803
14804 ==Headline 2==
14805 More
14806 ===Smaller headline===
14807 Blah blah
14808 !! html
14809 <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>
14810 <p>Some text
14811 </p>
14812 <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>
14813 <p>More
14814 </p>
14815 <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>
14816 <p>Blah blah
14817 </p>
14818 !! end
14819
14820 !! test
14821 Section headings with TOC
14822 !! wikitext
14823 == Headline 1 ==
14824 === Subheadline 1 ===
14825 ===== Skipping a level =====
14826 ====== Skipping a level ======
14827
14828 == Headline 2 ==
14829 Some text
14830 ===Another headline===
14831 !! html
14832 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14833 <ul>
14834 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
14835 <ul>
14836 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
14837 <ul>
14838 <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>
14839 <ul>
14840 <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>
14841 </ul>
14842 </li>
14843 </ul>
14844 </li>
14845 </ul>
14846 </li>
14847 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
14848 <ul>
14849 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
14850 </ul>
14851 </li>
14852 </ul>
14853 </div>
14854
14855 <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>
14856 <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>
14857 <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>
14858 <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>
14859 <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>
14860 <p>Some text
14861 </p>
14862 <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>
14863
14864 !! end
14865
14866 !! test
14867 TOC anchors don't collide
14868 !! wikitext
14869 __FORCETOC__
14870 == Headline 2 ==
14871 == Headline ==
14872 == Headline 2 ==
14873 == Headline ==
14874 !! html/php
14875 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14876 <ul>
14877 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
14878 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
14879 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
14880 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
14881 </ul>
14882 </div>
14883
14884 <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>
14885 <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>
14886 <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>
14887 <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>
14888
14889 !! end
14890
14891 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
14892 !! test
14893 Handling of sections up to level 6 and beyond
14894 !! wikitext
14895 = Level 1 Heading=
14896 == Level 2 Heading==
14897 === Level 3 Heading===
14898 ==== Level 4 Heading====
14899 ===== Level 5 Heading=====
14900 ====== Level 6 Heading======
14901 ======= Level 7 Heading=======
14902 ======== Level 8 Heading========
14903 ========= Level 9 Heading=========
14904 ========== Level 10 Heading==========
14905 !! html
14906 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14907 <ul>
14908 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
14909 <ul>
14910 <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>
14911 <ul>
14912 <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>
14913 <ul>
14914 <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>
14915 <ul>
14916 <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>
14917 <ul>
14918 <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>
14919 <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>
14920 <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>
14921 <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>
14922 <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>
14923 </ul>
14924 </li>
14925 </ul>
14926 </li>
14927 </ul>
14928 </li>
14929 </ul>
14930 </li>
14931 </ul>
14932 </li>
14933 </ul>
14934 </div>
14935
14936 <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>
14937 <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>
14938 <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>
14939 <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>
14940 <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>
14941 <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>
14942 <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>
14943 <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>
14944 <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>
14945 <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>
14946
14947 !! end
14948
14949 !! test
14950 TOC regression (T11764)
14951 !! wikitext
14952 == title 1 ==
14953 === title 1.1 ===
14954 ==== title 1.1.1 ====
14955 === title 1.2 ===
14956 == title 2 ==
14957 === title 2.1 ===
14958 !! html
14959 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14960 <ul>
14961 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14962 <ul>
14963 <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>
14964 <ul>
14965 <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>
14966 </ul>
14967 </li>
14968 <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>
14969 </ul>
14970 </li>
14971 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14972 <ul>
14973 <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>
14974 </ul>
14975 </li>
14976 </ul>
14977 </div>
14978
14979 <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>
14980 <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>
14981 <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>
14982 <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>
14983 <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>
14984 <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>
14985
14986 !! end
14987
14988 !! test
14989 TOC for heading containing <span id="..."></span> (T96153)
14990 !! wikitext
14991 __FORCETOC__
14992 ==<span id="old-anchor"></span>New title==
14993 !! html/php
14994 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14995 <ul>
14996 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
14997 </ul>
14998 </div>
14999
15000 <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>
15001
15002 !! end
15003
15004 !! test
15005 TOC with wgMaxTocLevel=3 (bug 6204)
15006 !! options
15007 wgMaxTocLevel=3
15008 !! wikitext
15009 == title 1 ==
15010 === title 1.1 ===
15011 ==== title 1.1.1 ====
15012 === title 1.2 ===
15013 == title 2 ==
15014 === title 2.1 ===
15015 !! html
15016 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15017 <ul>
15018 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15019 <ul>
15020 <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>
15021 <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>
15022 </ul>
15023 </li>
15024 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15025 <ul>
15026 <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>
15027 </ul>
15028 </li>
15029 </ul>
15030 </div>
15031
15032 <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>
15033 <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>
15034 <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>
15035 <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>
15036 <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>
15037 <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>
15038
15039 !! end
15040
15041 !! test
15042 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
15043 !! options
15044 wgMaxTocLevel=3
15045 !! wikitext
15046 ==Section 1==
15047 ===Section 1.1===
15048 ====Section 1.1.1====
15049 ====Section 1.1.1.1====
15050 ==Section 2==
15051 !! html
15052 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15053 <ul>
15054 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15055 <ul>
15056 <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>
15057 </ul>
15058 </li>
15059 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15060 </ul>
15061 </div>
15062
15063 <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>
15064 <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>
15065 <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>
15066 <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>
15067 <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>
15068
15069 !! end
15070
15071
15072 !! test
15073 Resolving duplicate section names
15074 !! wikitext
15075 == Foo bar ==
15076 == Foo bar ==
15077 !! html
15078 <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>
15079 <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>
15080
15081 !! end
15082
15083 !! test
15084 Resolving duplicate section names with differing case (bug 10721)
15085 !! wikitext
15086 == Foo bar ==
15087 == Foo Bar ==
15088 !! html
15089 <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>
15090 <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>
15091
15092 !! end
15093
15094 !! article
15095 Template:sections
15096 !! text
15097 ===Section 1===
15098 ==Section 2==
15099 !! endarticle
15100
15101 !! test
15102 Template with sections, __NOTOC__
15103 !! wikitext
15104 __NOTOC__
15105 ==Section 0==
15106 {{sections}}
15107 ==Section 4==
15108 !! html
15109 <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>
15110 <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>
15111 <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>
15112 <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>
15113
15114 !! end
15115
15116 !! test
15117 __NOEDITSECTION__ keyword
15118 !! wikitext
15119 __NOEDITSECTION__
15120 ==Section 1==
15121 ==Section 2==
15122 !! html
15123 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15124 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15125
15126 !! end
15127
15128 !! test
15129 Link inside a section heading
15130 !! wikitext
15131 ==Section with a [[Main Page|link]] in it==
15132 !! html
15133 <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>
15134
15135 !! end
15136
15137 !! test
15138 TOC regression (T14077)
15139 !! wikitext
15140 __TOC__
15141 == title 1 ==
15142 === title 1.1 ===
15143 == title 2 ==
15144 !! html
15145 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15146 <ul>
15147 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15148 <ul>
15149 <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>
15150 </ul>
15151 </li>
15152 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15153 </ul>
15154 </div>
15155
15156 <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>
15157 <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>
15158 <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>
15159
15160 !! end
15161
15162 !! test
15163 BUG 1219 URL next to image (good)
15164 !! wikitext
15165 http://example.com [[File:Foobar.jpg]]
15166 !! html/php
15167 <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>
15168 </p>
15169 !! html/parsoid
15170 <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>
15171 !!end
15172
15173 !! test
15174 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
15175 !! wikitext
15176 ===
15177 The line above must have a trailing space!
15178 === <!--
15179 --> <!-- -->
15180 But just in case it doesn't...
15181 !! html
15182 <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>
15183 <p>The line above must have a trailing space!
15184 </p>
15185 <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>
15186 <p>But just in case it doesn't...
15187 </p>
15188 !! end
15189
15190 !! test
15191 Header with special characters (bug 25462)
15192 !! wikitext
15193 The tooltips shall not show entities to the user (ie. be double escaped)
15194
15195 == text > text ==
15196 section 1
15197
15198 == text < text ==
15199 section 2
15200
15201 == text & text ==
15202 section 3
15203
15204 == text ' text ==
15205 section 4
15206
15207 == text " text ==
15208 section 5
15209 !! html
15210 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15211 </p>
15212 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15213 <ul>
15214 <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>
15215 <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>
15216 <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>
15217 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15218 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15219 </ul>
15220 </div>
15221
15222 <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>
15223 <p>section 1
15224 </p>
15225 <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>
15226 <p>section 2
15227 </p>
15228 <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>
15229 <p>section 3
15230 </p>
15231 <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>
15232 <p>section 4
15233 </p>
15234 <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>
15235 <p>section 5
15236 </p>
15237 !! end
15238
15239 !! test
15240 Header with space, plus and underscore as entity
15241 !! wikitext
15242 Id should not contain + for spaces
15243
15244 == Space between Text ==
15245 section 1
15246
15247 == Space-Entity&#32;between&#32;Text ==
15248 section 2
15249
15250 == Plus+between+Text ==
15251 section 3
15252
15253 == Plus-Entity&#43;between&#43;Text ==
15254 section 4
15255
15256 == Underscore_between_Text ==
15257 section 5
15258
15259 == Underscore-Entity&#95;between&#95;Text ==
15260 section 6
15261
15262 [[#Space between Text]]
15263 [[#Space-Entity&#32;between&#32;Text]]
15264 [[#Plus+between+Text]]
15265 [[#Plus-Entity&#43;between&#43;Text]]
15266 [[#Underscore_between_Text]]
15267 [[#Underscore-Entity&#95;between&#95;Text]]
15268 !! html
15269 <p>Id should not contain + for spaces
15270 </p>
15271 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15272 <ul>
15273 <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>
15274 <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>
15275 <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>
15276 <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>
15277 <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>
15278 <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>
15279 </ul>
15280 </div>
15281
15282 <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>
15283 <p>section 1
15284 </p>
15285 <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>
15286 <p>section 2
15287 </p>
15288 <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>
15289 <p>section 3
15290 </p>
15291 <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>
15292 <p>section 4
15293 </p>
15294 <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>
15295 <p>section 5
15296 </p>
15297 <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>
15298 <p>section 6
15299 </p><p><a href="#Space_between_Text">#Space between Text</a>
15300 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15301 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15302 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15303 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15304 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15305 </p>
15306 !! end
15307
15308 !! test
15309 Headers with excess '=' characters
15310 (Are similar tests necessary beyond the 1st level?)
15311 !! wikitext
15312 =foo==
15313 ==foo=
15314 =''italic'' heading==
15315 ==''italic'' heading=
15316 !! html
15317 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15318 <ul>
15319 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15320 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15321 <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>
15322 <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>
15323 </ul>
15324 </div>
15325
15326 <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>
15327 <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>
15328 <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>
15329 <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>
15330
15331 !! end
15332
15333 !! test
15334 HTML headers vs TOC (bug 23393)
15335 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15336 !! wikitext
15337 <h1>Header 1</h1>
15338 == Header 1.1 ==
15339 == Header 1.2 ==
15340
15341 <h1>Header 2
15342 </h1>
15343 == Header 2.1 ==
15344 == Header 2.2 ==
15345 __NOEDITSECTION__
15346 !! html
15347 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15348 <ul>
15349 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15350 <ul>
15351 <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>
15352 <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>
15353 </ul>
15354 </li>
15355 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15356 <ul>
15357 <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>
15358 <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>
15359 </ul>
15360 </li>
15361 </ul>
15362 </div>
15363
15364 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15365 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15366 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15367 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15368 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15369 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15370
15371 !! end
15372
15373 !! test
15374 Single-line or multiline-comments can follow headings
15375 !! options
15376 parsoid=wt2html,wt2wt
15377 !! wikitext
15378 ==foo==<!---->
15379 ==bar==<!--c1-->
15380 ==baz==<!--
15381 c2
15382 c3-->
15383 !! html
15384 <h2><span class="mw-headline" id="foo">foo</span></h2>
15385 <h2><span class="mw-headline" id="bar">bar</span></h2>
15386 <h2><span class="mw-headline" id="baz">baz</span></h2>
15387
15388 !! end
15389
15390 !! test
15391 BUG 1219 URL next to image (broken)
15392 !! wikitext
15393 http://example.com[[File:Foobar.jpg]]
15394 !! html/php
15395 <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>
15396 </p>
15397 !! html/parsoid
15398 <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>
15399 !!end
15400
15401 !! test
15402 Bug 1186 news: in the middle of text
15403 !! wikitext
15404 http://en.wikinews.org/wiki/Wikinews:Workplace
15405 !! html
15406 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15407 </p>
15408 !!end
15409
15410
15411 !! test
15412 Namespaced link must have a title
15413 !! wikitext
15414 [[Project:]]
15415 !! html
15416 <p>[[Project:]]
15417 </p>
15418 !!end
15419
15420 !! test
15421 Namespaced link must have a title (bad fragment version)
15422 !! wikitext
15423 [[Project:#fragment]]
15424 !! html
15425 <p>[[Project:#fragment]]
15426 </p>
15427 !!end
15428
15429
15430 ###
15431 ### HTML tags and HTML attributes
15432 ###
15433
15434 !! test
15435 div with no attributes
15436 !! wikitext
15437 <div>HTML rocks</div>
15438 !! html
15439 <div>HTML rocks</div>
15440
15441 !! end
15442
15443 !! test
15444 div with double-quoted attribute
15445 !! wikitext
15446 <div id="rock">HTML rocks</div>
15447 !! html
15448 <div id="rock">HTML rocks</div>
15449
15450 !! end
15451
15452 !! test
15453 div with single-quoted attribute
15454 !! wikitext
15455 <div id='rock'>HTML rocks</div>
15456 !! html
15457 <div id="rock">HTML rocks</div>
15458
15459 !! end
15460
15461 !! test
15462 div with unquoted attribute
15463 !! wikitext
15464 <div id=rock>HTML rocks</div>
15465 !! html
15466 <div id="rock">HTML rocks</div>
15467
15468 !! end
15469
15470 !! test
15471 div with illegal double attributes
15472 !! wikitext
15473 <div id="a" id="b">HTML rocks</div>
15474 !! html
15475 <div id="b">HTML rocks</div>
15476
15477 !!end
15478
15479 !! test
15480 div with empty attribute value, space before equals
15481 !! options
15482 parsoid=wt2html,html2html
15483 !! wikitext
15484 <div class =>HTML rocks</div>
15485 !! html/php
15486 <div class="">HTML rocks</div>
15487
15488 !! html/parsoid
15489 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15490 !! end
15491
15492 !! test
15493 div with multiple empty attribute values
15494 !! options
15495 parsoid=wt2html,html2html
15496 !! wikitext
15497 <div id= title=>HTML rocks</div>
15498 !! html/php
15499 <div id="title.3D">HTML rocks</div>
15500
15501 !! html/parsoid
15502 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15503 !! end
15504
15505 !! test
15506 table with multiple empty attribute values
15507 !! options
15508 parsoid=wt2html,html2html
15509 !! wikitext
15510 {| title= id=
15511 | hi
15512 |}
15513 !! html/php
15514 <table title="id=">
15515 <tr>
15516 <td> hi
15517 </td></tr></table>
15518
15519 !! html/parsoid
15520 <table title="id=">
15521 <tbody><tr><td> hi</td></tr>
15522 </tbody></table>
15523 !! end
15524
15525 !! test
15526 div with braces in attribute value
15527 !! wikitext
15528 <div title="{}">Foo</div>
15529 !! html/php
15530 <div title="&#123;}">Foo</div>
15531
15532 !! html/parsoid
15533 <div title="{}">Foo</div>
15534 !! end
15535
15536 !! test
15537 div with empty attribute value, no space before equals
15538 !! options
15539 parsoid=wt2html,html2html
15540 !! wikitext
15541 <div class=>HTML rocks</div>
15542 !! html/php
15543 <div class="">HTML rocks</div>
15544
15545 !! html/parsoid
15546 <div class="">HTML rocks</div>
15547 !! end
15548
15549 !! test
15550 HTML multiple attributes correction
15551 !! wikitext
15552 <p class="error" class="awesome">Awesome!</p>
15553 !! html
15554 <p class="awesome">Awesome!</p>
15555
15556 !!end
15557
15558 !! test
15559 Table multiple attributes correction
15560 !! wikitext
15561 {|
15562 !+ class="error" class="awesome"| status
15563 |}
15564 !! html
15565 <table>
15566 <tr>
15567 <th class="awesome"> status
15568 </th></tr></table>
15569
15570 !!end
15571
15572 !! test
15573 DIV IN UPPERCASE
15574 !! wikitext
15575 <DIV ID="x">HTML ROCKS</DIV>
15576 !! html
15577 <div id="x">HTML ROCKS</div>
15578
15579 !!end
15580
15581 !! test
15582 Non-ASCII pseudo-tags are rendered as text
15583 !! wikitext
15584 <khyô>
15585 !! html
15586 <p>&lt;khyô&gt;
15587 </p>
15588 !! end
15589
15590 !! test
15591 Pseudo-tag with URL 'name' renders as url link
15592 !! wikitext
15593 <http://example.com/>
15594 !! html
15595 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
15596 </p>
15597 !! end
15598
15599 !! test
15600 text with amp in the middle of nowhere
15601 !! wikitext
15602 Remember AT&T?
15603 !! html
15604 <p>Remember AT&amp;T?
15605 </p>
15606 !! end
15607
15608 !! test
15609 text with character entity: eacute
15610 !! wikitext
15611 I always thought &eacute; was a cute letter.
15612 !! html
15613 <p>I always thought &#233; was a cute letter.
15614 </p>
15615 !! html+tidy
15616 <p>I always thought é was a cute letter.</p>
15617 !! end
15618
15619 !! test
15620 text with entity-escaped character entity-like string: eacute
15621 !! wikitext
15622 I always thought &amp;eacute; was a cute letter.
15623 !! html
15624 <p>I always thought &amp;eacute; was a cute letter.
15625 </p>
15626 !! end
15627
15628 !! test
15629 text with undefined character entity: xacute
15630 !! wikitext
15631 I always thought &xacute; was a cute letter.
15632 !! html
15633 <p>I always thought &amp;xacute; was a cute letter.
15634 </p>
15635 !! end
15636
15637 !! test
15638 HTML5 tags
15639 !! wikitext
15640 <data value="5">five</data>
15641 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15642 <mark>This highlighted text</mark>
15643 !! html
15644 <p><data value="5">five</data>
15645 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15646 <mark>This highlighted text</mark>
15647 </p>
15648 !! end
15649
15650 !! test
15651 HTML tag with leading space is parsed as text
15652 !! wikitext
15653 < div>foo< /div>
15654 !! html
15655 <p>&lt; div&gt;foo&lt; /div&gt;
15656 </p>
15657 !! end
15658
15659 ###
15660 ### Nesting tests (see bug 41545, 50604, 51081)
15661 ###
15662
15663 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
15664 # Note that html2wt is considerably more difficult if we use <b> in
15665 # the test case, instead of <big>
15666 !! test
15667 Ensure that HTML adoption agency algorithm is properly implemented.
15668 !! wikitext
15669 <big>X<big>Y</big>Z</big>
15670 !! html
15671 <p><big>X<big>Y</big>Z</big>
15672 </p>
15673 !! end
15674
15675 # This was bug 41545 in the PHP parser.
15676 # Note that tidy doesn't handle this correctly.
15677 !! test
15678 Nesting of <kbd>
15679 !! wikitext
15680 <kbd>X<kbd>Y</kbd>Z</kbd>
15681 !! html
15682 <p><kbd>X<kbd>Y</kbd>Z</kbd>
15683 </p>
15684 !! end
15685
15686 # The following cases were bug 51081 in the PHP parser.
15687 # Note that there are some other nestable tags (b, i, etc) which are
15688 # not covered; see bug 51081 for discussion.
15689
15690 # Note that tidy doesn't handle this correctly.
15691 !! test
15692 Nesting of <em>
15693 !! wikitext
15694 <em>X<em>Y</em>Z</em>
15695 !! html
15696 <p><em>X<em>Y</em>Z</em>
15697 </p>
15698 !! end
15699
15700 # Note that tidy doesn't handle this correctly.
15701 !! test
15702 Nesting of <strong>
15703 !! wikitext
15704 <strong>X<strong>Y</strong>Z</strong>
15705 !! html
15706 <p><strong>X<strong>Y</strong>Z</strong>
15707 </p>
15708 !! end
15709
15710 !! test
15711 Nesting of <q>
15712 !! wikitext
15713 <q>X<q>Y</q>Z</q>
15714 !! html+tidy
15715 <p><q>X<q>Y</q>Z</q></p>
15716 !! end
15717
15718 # Note that tidy doesn't handle this correctly.
15719 !! test
15720 Nesting of <ruby>
15721 !! wikitext
15722 <ruby>X<ruby>Y</ruby>Z</ruby>
15723 !! html
15724 <p><ruby>X<ruby>Y</ruby>Z</ruby>
15725 </p>
15726 !! end
15727
15728 # Note that tidy doesn't handle this correctly.
15729 !! test
15730 Nesting of <bdo>
15731 !! wikitext
15732 <bdo>X<bdo>Y</bdo>Z</bdo>
15733 !! html
15734 <p><bdo>X<bdo>Y</bdo>Z</bdo>
15735 </p>
15736 !! end
15737
15738
15739 ###
15740 ### Media links
15741 ###
15742
15743 !! test
15744 Media link
15745 !! wikitext
15746 [[Media:Foobar.jpg]]
15747 !! html
15748 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
15749 </p>
15750 !! end
15751
15752 !! test
15753 Media link with text
15754 !! wikitext
15755 [[Media:Foobar.jpg|A neat file to look at]]
15756 !! html
15757 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
15758 </p>
15759 !! end
15760
15761 # FIXME: this is still bad HTML tag nesting
15762 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
15763 !! test
15764 Media link with nasty text
15765 !! wikitext
15766 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
15767 !! html
15768 <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>
15769
15770 !! html+tidy
15771 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
15772 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
15773 !! end
15774
15775 !! test
15776 Media link to nonexistent file (bug 1702)
15777 !! wikitext
15778 [[Media:No such.jpg]]
15779 !! html
15780 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
15781 </p>
15782 !! end
15783
15784 !! test
15785 Image link to nonexistent file (bug 1850 - good)
15786 !! wikitext
15787 [[File:No_such.jpg]]
15788 !! html/php
15789 <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>
15790 </p>
15791 !! html/parsoid
15792 <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>
15793 !! end
15794
15795 !! test
15796 :Image link to nonexistent file (bug 1850 - bad)
15797 !! wikitext
15798 [[:Image:No such.jpg]]
15799 !! html/php
15800 <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>
15801 </p>
15802 !! html/parsoid
15803 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
15804 !! end
15805
15806
15807
15808 !! test
15809 Character reference normalization in link text (bug 1938)
15810 !! wikitext
15811 [[Main Page|this&that]]
15812 !! html
15813 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
15814 </p>
15815 !!end
15816
15817 !! article
15818 אַ
15819 !! text
15820 Test for unicode normalization
15821
15822 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
15823 !! endarticle
15824
15825 !! test
15826 (bug 19451) Links should refer to the normalized form.
15827 !! wikitext
15828 [[&#xFB2E;]]
15829 [[&#x5d0;&#x5b7;]]
15830 [[&#x5d0;ַ]]
15831 [[א&#x5b7;]]
15832 [[אַ]]
15833 !! html
15834 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
15835 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
15836 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
15837 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
15838 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
15839 </p>
15840 !! end
15841
15842 !! test
15843 Empty attribute crash test (bug 2067)
15844 !! wikitext
15845 <font color="">foo</font>
15846 !! html
15847 <p><font color="">foo</font>
15848 </p>
15849 !! end
15850
15851 !! test
15852 Empty attribute crash test single-quotes (bug 2067)
15853 !! wikitext
15854 <font color=''>foo</font>
15855 !! html
15856 <p><font color="">foo</font>
15857 </p>
15858 !! end
15859
15860 !! test
15861 Attribute test: equals, then nothing
15862 !! options
15863 parsoid=wt2html,html2html
15864 !! wikitext
15865 <font color=>foo</font>
15866 !! html/php
15867 <p><font color="">foo</font>
15868 </p>
15869 !! html/parsoid
15870 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
15871 !! end
15872
15873 !! test
15874 Attribute test: unquoted value
15875 !! options
15876 parsoid=wt2html,html2html
15877 !! wikitext
15878 <font color=x>foo</font>
15879 !! html/php
15880 <p><font color="x">foo</font>
15881 </p>
15882 !! html/parsoid
15883 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
15884 !! end
15885
15886 !! test
15887 Attribute test: unquoted but illegal value (hash)
15888 !! wikitext
15889 <font color=#x>foo</font>
15890 !! html
15891 <p><font color="#x">foo</font>
15892 </p>
15893 !! end
15894
15895 # Parsoid does not serialize to empty attribute syntax,
15896 # so wt2wt and html2wt cases are skipped
15897 !! test
15898 Attribute test: no value (T54330)
15899 !! options
15900 parsoid=wt2html,html2html
15901 !! wikitext
15902 <font color>foo</font>
15903 !! html/php
15904 <p><font color="">foo</font>
15905 </p>
15906 !! html/parsoid
15907 <p><font color="">foo</font></p>
15908 !! end
15909
15910 !! test
15911 Bug 2095: link with three closing brackets
15912 !! wikitext
15913 [[Main Page]]]
15914 !! html/php
15915 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
15916 </p>
15917 !! html/parsoid
15918 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
15919 !! end
15920
15921 !! test
15922 Bug 2095: link with pipe and three closing brackets
15923 !! wikitext
15924 [[Main Page|link]]]
15925 !! html/php
15926 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
15927 </p>
15928 !! html/parsoid
15929 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
15930 !! end
15931
15932 !! test
15933 Bug 2095: link with pipe and three closing brackets, version 2
15934 !! wikitext
15935 [[Main Page|[http://example.com/]]]
15936 !! html/php
15937 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
15938 </p>
15939 !! html/parsoid
15940 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
15941 !! end
15942
15943
15944 ###
15945 ### Safety
15946 ###
15947
15948 !! article
15949 Template:Dangerous attribute
15950 !! text
15951 " onmouseover="alert(document.cookie)
15952 !! endarticle
15953
15954 !! article
15955 Template:Dangerous style attribute
15956 !! text
15957 border-size: expression(alert(document.cookie))
15958 !! endarticle
15959
15960 !! article
15961 Template:Div style
15962 !! text
15963 <div style="float: right; {{{1}}}">Magic div</div>
15964 !! endarticle
15965
15966 !! test
15967 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
15968 !! wikitext
15969 <div title="{{test}}"></div>
15970 !! html
15971 <div title="This is a test template"></div>
15972
15973 !! end
15974
15975 # Parsoid has enough context to handle this case
15976 !! test
15977 Bug 2304: HTML attribute safety (dangerous template; 2309)
15978 !! wikitext
15979 <div title="{{dangerous attribute}}"></div>
15980 !! html/php
15981 <div title=""></div>
15982
15983 !! html/parsoid
15984 <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>
15985 !! end
15986
15987 !! test
15988 Bug 2304: HTML attribute safety (dangerous style template; 2309)
15989 !! wikitext
15990 <div style="{{dangerous style attribute}}"></div>
15991 !! html
15992 <div style="/* insecure input */"></div>
15993
15994 !! end
15995
15996 !! test
15997 Bug 2304: HTML attribute safety (safe parameter; 2309)
15998 !! wikitext
15999 {{div style|width: 200px}}
16000 !! html
16001 <div style="float: right; width: 200px">Magic div</div>
16002
16003 !! end
16004
16005 !! test
16006 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
16007 !! wikitext
16008 {{div style|width: expression(alert(document.cookie))}}
16009 !! html
16010 <div style="/* insecure input */">Magic div</div>
16011
16012 !! end
16013
16014 !! test
16015 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
16016 !! wikitext
16017 {{div style|"><script>alert(document.cookie)</script>}}
16018 !! html
16019 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16020
16021 !! end
16022
16023 !! test
16024 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
16025 !! wikitext
16026 {{div style|" ><script>alert(document.cookie)</script>}}
16027 !! html
16028 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16029
16030 !! end
16031
16032 !! test
16033 Bug 2304: HTML attribute safety (link)
16034 !! wikitext
16035 <div title="[[Main Page]]"></div>
16036 !! html
16037 <div title="&#91;&#91;Main Page]]"></div>
16038
16039 !! end
16040
16041 !! test
16042 Bug 2304: HTML attribute safety (italics)
16043 !! wikitext
16044 <div title="''foobar''"></div>
16045 !! html
16046 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16047
16048 !! end
16049
16050 !! test
16051 Bug 2304: HTML attribute safety (bold)
16052 !! wikitext
16053 <div title="'''foobar'''"></div>
16054 !! html
16055 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16056
16057 !! end
16058
16059
16060 !! test
16061 Bug 2304: HTML attribute safety (ISBN)
16062 !! wikitext
16063 <div title="ISBN 1234567890"></div>
16064 !! html
16065 <div title="&#73;SBN 1234567890"></div>
16066
16067 !! end
16068
16069 !! test
16070 Bug 2304: HTML attribute safety (RFC)
16071 !! wikitext
16072 <div title="RFC 1234"></div>
16073 !! html
16074 <div title="&#82;FC 1234"></div>
16075
16076 !! end
16077
16078 !! test
16079 Bug 2304: HTML attribute safety (PMID)
16080 !! wikitext
16081 <div title="PMID 1234567890"></div>
16082 !! html
16083 <div title="&#80;MID 1234567890"></div>
16084
16085 !! end
16086
16087 !! test
16088 Bug 2304: HTML attribute safety (web link)
16089 !! wikitext
16090 <div title="http://example.com/"></div>
16091 !! html
16092 <div title="http&#58;//example.com/"></div>
16093
16094 !! end
16095
16096 !! test
16097 Bug 2304: HTML attribute safety (named web link)
16098 !! wikitext
16099 <div title="[http://example.com/ link]"></div>
16100 !! html
16101 <div title="&#91;http&#58;//example.com/ link]"></div>
16102
16103 !! end
16104
16105 !! test
16106 Bug 3244: HTML attribute safety (extension; safe)
16107 !! wikitext
16108 <div style="<nowiki>background:blue</nowiki>"></div>
16109 !! html
16110 <div style="background:blue"></div>
16111
16112 !! end
16113
16114 !! test
16115 Bug 3244: HTML attribute safety (extension; unsafe)
16116 !! wikitext
16117 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16118 !! html
16119 <div style="/* insecure input */"></div>
16120
16121 !! end
16122
16123 # More MSIE fun discovered by Tom Gilder
16124
16125 !! test
16126 MSIE CSS safety test: spurious slash
16127 !! wikitext
16128 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16129 !! html
16130 <div style="/* insecure input */">evil</div>
16131
16132 !! end
16133
16134 !! test
16135 MSIE CSS safety test: hex code
16136 !! wikitext
16137 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16138 !! html
16139 <div style="/* insecure input */">evil</div>
16140
16141 !! end
16142
16143 !! test
16144 MSIE CSS safety test: comment in url
16145 !! wikitext
16146 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16147 !! html
16148 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16149
16150 !! end
16151
16152 !! test
16153 MSIE CSS safety test: comment in expression
16154 !! wikitext
16155 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16156 !! html
16157 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16158
16159 !! end
16160
16161 !! test
16162 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
16163 !! wikitext
16164 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16165 !! html
16166 <p style="/* invalid control char */">A</p>
16167
16168 !! end
16169
16170 !! test
16171 MSIE 6 CSS safety test: Fullwidth (bug 55332)
16172 !! wikitext
16173 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16174 <div style="top:EXPRESSION(alert())">B</div>
16175 !! html
16176 <p style="/* insecure input */">A</p>
16177 <div style="/* insecure input */">B</div>
16178
16179 !! end
16180
16181 !! test
16182 MSIE 6 CSS safety test: IPA extensions (bug 55332)
16183 !! wikitext
16184 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16185 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16186 !! html
16187 <div style="/* insecure input */">A</div>
16188 <p style="/* insecure input */">B</p>
16189
16190 !! end
16191
16192 !! test
16193 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16194 !! wikitext
16195 <div style="background-image:url⁽javascript:alert())">A</div>
16196 <div style="background-image:url₍javascript:alert())">B</div>
16197 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16198 !! html
16199 <div style="/* insecure input */">A</div>
16200 <div style="/* insecure input */">B</div>
16201 <p style="/* insecure input */">C</p>
16202
16203 !! end
16204
16205 # FIXME: Parsoid fails to sanitize this! See T58846.
16206 !! test
16207 Opera -o-link CSS
16208 !! wikitext
16209 <div
16210 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;"
16211 style="-o-link:attr(title);-o-link-source:current">X</div>
16212 !! html
16213 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16214
16215 !! end
16216
16217 !! test
16218 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16219 !! wikitext
16220 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16221 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16222 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16223 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16224 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16225 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16226 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16227 !! html
16228 <p style="/* insecure input */">A</p>
16229 <p style="/* insecure input */">B</p>
16230 <p style="/* insecure input */">C</p>
16231 <p style="/* insecure input */">D</p>
16232 <p style="/* insecure input */">E</p>
16233 <p style="/* insecure input */">F</p>
16234 <p style="/* insecure input */">G</p>
16235
16236 !! end
16237
16238 !! test
16239 Table attribute legitimate extension
16240 !! wikitext
16241 {|
16242 !+ style="<nowiki>color:blue</nowiki>"| status
16243 |}
16244 !! html
16245 <table>
16246 <tr>
16247 <th style="color:blue"> status
16248 </th></tr></table>
16249
16250 !!end
16251
16252 !! test
16253 Table attribute safety
16254 !! wikitext
16255 {|
16256 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16257 |}
16258 !! html
16259 <table>
16260 <tr>
16261 <th style="/* insecure input */"> status
16262 </th></tr></table>
16263
16264 !! end
16265
16266 !! test
16267 CSS line continuation 1
16268 !! wikitext
16269 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16270 !! html
16271 <div style="/* insecure input */"></div>
16272
16273 !! end
16274
16275 !! test
16276 CSS line continuation 2
16277 !! wikitext
16278 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16279 !! html
16280 <div style="/* invalid control char */"></div>
16281
16282 !! end
16283
16284 !! article
16285 Template:Identity
16286 !! text
16287 {{{1}}}
16288 !! endarticle
16289
16290 !! test
16291 Expansion of multi-line templates in attribute values (bug 6255)
16292 !! wikitext
16293 <div style="background: {{identity|#00FF00}}">-</div>
16294 !! html
16295 <div style="background: #00FF00">-</div>
16296
16297 !! end
16298
16299
16300 !! test
16301 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16302 !! wikitext
16303 <div style="background:
16304 #00FF00">-</div>
16305 !! html/php
16306 <div style="background: #00FF00">-</div>
16307
16308 !! html/parsoid
16309 <div style="background:
16310 #00FF00">-</div>
16311 !! end
16312
16313 !! test
16314 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16315 !! wikitext
16316 <div style="background: &#10;#00FF00">-</div>
16317 !! html
16318 <div style="background: &#10;#00FF00">-</div>
16319
16320 !! end
16321
16322 !! test
16323 evil <math>-wiki-tags without Extension:Math enabled
16324 !! wikitext
16325 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
16326 !! html+tidy
16327 <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>
16328 !! end
16329
16330 ###
16331 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16332 ###
16333 !! test
16334 Parser hook: empty input
16335 !! wikitext
16336 <tag></tag>
16337 !! html/php
16338 <pre>
16339 ''
16340 array (
16341 )
16342 </pre>
16343
16344 !! html/parsoid
16345 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16346 !! end
16347
16348 ## Don't expect parsoid to rt this form.
16349 !! test
16350 Parser hook: empty input using terminated empty elements
16351 !! options
16352 parsoid=wt2html,html2html
16353 !! wikitext
16354 <tag/>
16355 !! html/php
16356 <pre>
16357 NULL
16358 array (
16359 )
16360 </pre>
16361
16362 !! html/parsoid
16363 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16364 !! end
16365
16366 !! test
16367 Parser hook: empty input using terminated empty elements (space before)
16368 !! wikitext
16369 <tag />
16370 !! html/php
16371 <pre>
16372 NULL
16373 array (
16374 )
16375 </pre>
16376
16377 !! html/parsoid
16378 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16379 !! end
16380
16381 !! test
16382 Parser hook: basic input
16383 !! wikitext
16384 <tag>input</tag>
16385 !! html/php
16386 <pre>
16387 'input'
16388 array (
16389 )
16390 </pre>
16391
16392 !! html/parsoid
16393 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16394 !! end
16395
16396 ## Don't expect parsoid to rt this form.
16397 !! test
16398 Parser hook: case insensitive
16399 !! options
16400 parsoid=wt2html,html2html
16401 !! wikitext
16402 <TAG>input</TAG>
16403 !! html/php
16404 <pre>
16405 'input'
16406 array (
16407 )
16408 </pre>
16409
16410 !! html/parsoid
16411 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16412 !! end
16413
16414 ## Don't expect parsoid to rt this form.
16415 !! test
16416 Parser hook: case insensitive, redux
16417 !! options
16418 parsoid=wt2html,html2html
16419 !! wikitext
16420 <TaG>input</TAg>
16421 !! html/php
16422 <pre>
16423 'input'
16424 array (
16425 )
16426 </pre>
16427
16428 !! html/parsoid
16429 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16430 !! end
16431
16432 !! test
16433 Parser hook: nested tags
16434 !! wikitext
16435 <tag><tag></tag></tag>
16436 !! html/php
16437 <pre>
16438 '<tag>'
16439 array (
16440 )
16441 </pre>&lt;/tag&gt;
16442
16443 !! html/parsoid
16444 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
16445 !! end
16446
16447 !! test
16448 Parser hook: basic arguments
16449 !! wikitext
16450 <tag width="200" height="100" depth="50" square=""></tag>
16451 !! html/php
16452 <pre>
16453 ''
16454 array (
16455 'width' => '200',
16456 'height' => '100',
16457 'depth' => '50',
16458 'square' => '',
16459 )
16460 </pre>
16461
16462 !! html/parsoid
16463 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16464 !! end
16465
16466 ## Don't expect parsoid to rt this form.
16467 !! test
16468 Parser hook: basic arguments, variations
16469 !! options
16470 parsoid=wt2html,html2html
16471 !! wikitext
16472 <tag width=200 height = "100" depth = '50' square></tag>
16473 !! html/php
16474 <pre>
16475 ''
16476 array (
16477 'width' => '200',
16478 'height' => '100',
16479 'depth' => '50',
16480 'square' => '',
16481 )
16482 </pre>
16483
16484 !! html/parsoid
16485 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16486 !! end
16487
16488 !! test
16489 Parser hook: argument containing a forward slash (bug 5344)
16490 !! wikitext
16491 <tag filename="/tmp/bla"></tag>
16492 !! html/php
16493 <pre>
16494 ''
16495 array (
16496 'filename' => '/tmp/bla',
16497 )
16498 </pre>
16499
16500 !! html/parsoid
16501 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16502 !! end
16503
16504 ## Don't expect parsoid to rt this form.
16505 !! test
16506 Parser hook: empty input using terminated empty elements (bug 2374)
16507 !! options
16508 parsoid=wt2html,html2html
16509 !! wikitext
16510 <tag foo=bar/>text
16511 !! html/php
16512 <pre>
16513 NULL
16514 array (
16515 'foo' => 'bar',
16516 )
16517 </pre>text
16518
16519 !! html/parsoid
16520 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
16521 !! end
16522
16523 # </tag> should be output literally since there is no matching tag that begins it
16524 !! test
16525 Parser hook: basic arguments using terminated empty elements (bug 2374)
16526 !! wikitext
16527 <tag width=200 height = "100" depth = '50' square/>
16528 other stuff
16529 </tag>
16530 !! html/php
16531 <pre>
16532 NULL
16533 array (
16534 'width' => '200',
16535 'height' => '100',
16536 'depth' => '50',
16537 'square' => '',
16538 )
16539 </pre>
16540 <p>other stuff
16541 &lt;/tag&gt;
16542 </p>
16543 !! end
16544
16545 ###
16546 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
16547 ###
16548
16549 !! test
16550 Parser hook: static parser hook not inside a comment
16551 !! wikitext
16552 <statictag>hello, world</statictag>
16553
16554 <statictag action="flush" />
16555 !! html/php
16556 <p><br />
16557 hello, world
16558 </p>
16559 !! html/parsoid
16560 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
16561 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
16562 !! end
16563
16564 !! test
16565 Parser hook: static parser hook inside a comment
16566 !! wikitext
16567 <!-- <statictag>hello, world</statictag> -->
16568 <statictag action="flush" />
16569 !! html/php
16570 <p><br />
16571 </p>
16572 !! html/parsoid
16573 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
16574 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
16575 !! end
16576
16577 # Nested template calls; this case was broken by Parser.php rev 1.506,
16578 # since reverted.
16579
16580 !! article
16581 Template:One-parameter
16582 !! text
16583 (My parameter is: {{{1}}})
16584 !! endarticle
16585
16586 !! article
16587 Template:Map-one-parameter
16588 !! text
16589 {{{{{1}}}|{{{2}}}}}
16590 !! endarticle
16591
16592 !! test
16593 Nested template calls
16594 !! wikitext
16595 {{Map-one-parameter|One-parameter|param}}
16596 !! html
16597 <p>(My parameter is: param)
16598 </p>
16599 !! end
16600
16601
16602 ###
16603 ### Sanitizer
16604 ###
16605
16606 # HTML+Tidy effectively strips out the empty tags completely
16607 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
16608 # which Tidy would have done for the PHP parser had there been content inside it.
16609 !! test
16610 Sanitizer: Closing of open tags
16611 !! wikitext
16612 <s></s><table></table>
16613 !! html
16614 <s></s><table></table>
16615
16616 !! html/parsoid
16617 <p><s></s></p><table></table>
16618 !! end
16619
16620 !! test
16621 Sanitizer: Closing of open but not closed tags
16622 !! wikitext
16623 <s>foo
16624 !! html
16625 <p><s>foo</s>
16626 </p>
16627 !! end
16628
16629 !! test
16630 Sanitizer: Closing of closed but not open tags
16631 !! options
16632 parsoid=wt2html
16633 !! wikitext
16634 </s>
16635 !! html/php+tidy
16636 !! html/parsoid
16637 !! end
16638
16639 !! test
16640 Sanitizer: Closing of closed but not open table tags
16641 !! options
16642 parsoid=wt2html
16643 !! wikitext
16644 Table not started</td></tr></table>
16645 !! html/php+tidy
16646 <p>Table not started</p>
16647 !! html/parsoid
16648 <p>Table not started</p>
16649 !! end
16650
16651 !! test
16652 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
16653 !! wikitext
16654 <span id="æ: v">byte</span>[[#æ: v|backlink]]
16655 !! html
16656 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
16657 </p>
16658 !! end
16659
16660 # In HTML5, the restrictions are that id must contain at least one character,
16661 # and must not contain any space characters.
16662 !! test
16663 Sanitizer: Validating the contents of the id attribute (bug 4515)
16664 !! options
16665 disabled
16666 !! wikitext
16667 <br id="" /><br id="a space" />
16668 !! html
16669 Something ...
16670 !! end
16671
16672 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
16673 !! test
16674 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
16675 !! options
16676 disabled
16677 !! wikitext
16678 <br id="foo" /><br id="foo" />
16679 !! html
16680 Something need to be done. foo-2 ?
16681 !! end
16682
16683 !! test
16684 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
16685 !! wikitext
16686 <div itemscope>
16687 <meta itemprop="hello" content="world">
16688 <meta http-equiv="refresh" content="5">
16689 <meta itemprop="hello" http-equiv="refresh" content="5">
16690 <link itemprop="hello" href="{{SERVER}}">
16691 <link rel="stylesheet" href="{{SERVER}}">
16692 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
16693 </div>
16694 !! html
16695 <div itemscope="">
16696 <p> <meta itemprop="hello" content="world" />
16697 &lt;meta http-equiv="refresh" content="5"&gt;
16698 <meta itemprop="hello" content="5" />
16699 </p>
16700 <link itemprop="hello" href="http&#58;//example.org" />
16701 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
16702 <link itemprop="hello" href="http&#58;//example.org" />
16703 </div>
16704
16705 !! end
16706
16707 !! test
16708 Language converter: output gets cut off unexpectedly (bug 5757)
16709 !! options
16710 language=zh
16711 !! wikitext
16712 this bit is safe: }-
16713
16714 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
16715
16716 then we get cut off here: }-
16717
16718 all additional text is vanished
16719 !! html
16720 <p>this bit is safe: }-
16721 </p><p>but if we add a conversion instance: xxx
16722 </p><p>then we get cut off here: }-
16723 </p><p>all additional text is vanished
16724 </p>
16725 !! end
16726
16727 !! test
16728 Self closed html pairs (bug 5487)
16729 !! options
16730 !! wikitext
16731 <center><font id="bug" />Centered text</center>
16732 <div><font id="bug2" />In div text</div>
16733 !! html
16734 <center>&lt;font id="bug" /&gt;Centered text</center>
16735 <div>&lt;font id="bug2" /&gt;In div text</div>
16736
16737 !! end
16738
16739 #
16740 #
16741 #
16742
16743 !! test
16744 Punctuation: nbsp before exclamation
16745 !! wikitext
16746 C'est grave !
16747 !! html
16748 <p>C'est grave&#160;!
16749 </p>
16750 !! end
16751
16752 !! test
16753 Punctuation: CSS !important (bug 11874)
16754 !! wikitext
16755 <div style="width:50% !important">important</div>
16756 !! html
16757 <div style="width:50% !important">important</div>
16758
16759 !!end
16760
16761 !! test
16762 Punctuation: CSS ! important (bug 11874; with space after)
16763 !! wikitext
16764 <div style="width:50% ! important">important</div>
16765 !! html
16766 <div style="width:50% ! important">important</div>
16767
16768 !!end
16769
16770 !! test
16771 HTML bullet list, closed tags (bug 5497)
16772 !! wikitext
16773 <ul>
16774 <li>One</li>
16775 <li>Two</li>
16776 </ul>
16777 !! html/php
16778 <ul>
16779 <li>One</li>
16780 <li>Two</li>
16781 </ul>
16782
16783 !! html/parsoid
16784 <ul data-parsoid='{"stx":"html"}'>
16785 <li data-parsoid='{"stx":"html"}'>One</li>
16786 <li data-parsoid='{"stx":"html"}'>Two</li>
16787 </ul>
16788
16789 !! end
16790
16791 !! test
16792 HTML bullet list, unclosed tags (bug 5497)
16793 !! wikitext
16794 <ul>
16795 <li>One
16796 <li>Two
16797 </ul>
16798 !! html/php+tidy
16799 <ul>
16800 <li>One</li>
16801 <li>Two</li>
16802 </ul>
16803 !! html/parsoid
16804 <ul data-parsoid='{"stx":"html"}'>
16805 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16806 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16807 </ul>
16808
16809 !! end
16810
16811 !! test
16812 HTML ordered list, closed tags (bug 5497)
16813 !! wikitext
16814 <ol>
16815 <li>One</li>
16816 <li>Two</li>
16817 </ol>
16818 !! html/php
16819 <ol>
16820 <li>One</li>
16821 <li>Two</li>
16822 </ol>
16823
16824 !! html/parsoid
16825 <ol data-parsoid='{"stx":"html"}'>
16826 <li data-parsoid='{"stx":"html"}'>One</li>
16827 <li data-parsoid='{"stx":"html"}'>Two</li>
16828 </ol>
16829
16830 !! end
16831
16832 !! test
16833 HTML ordered list, unclosed tags (bug 5497)
16834 !! options
16835 !! wikitext
16836 <ol>
16837 <li>One
16838 <li>Two
16839 </ol>
16840 !! html/php+tidy
16841 <ol>
16842 <li>One</li>
16843 <li>Two</li>
16844 </ol>
16845 !! html/parsoid
16846 <ol data-parsoid='{"stx":"html"}'>
16847 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16848 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16849 </ol>
16850
16851 !! end
16852
16853 !! test
16854 HTML nested bullet list, closed tags (bug 5497)
16855 !! wikitext
16856 <ul>
16857 <li>One</li>
16858 <li>Two:
16859 <ul>
16860 <li>Sub-one</li>
16861 <li>Sub-two</li>
16862 </ul>
16863 </li>
16864 </ul>
16865 !! html
16866 <ul>
16867 <li>One</li>
16868 <li>Two:
16869 <ul>
16870 <li>Sub-one</li>
16871 <li>Sub-two</li>
16872 </ul>
16873 </li>
16874 </ul>
16875
16876 !! end
16877
16878 !! test
16879 HTML nested bullet list, open tags (bug 5497)
16880 !! wikitext
16881 <ul>
16882 <li>One
16883 <li>Two:
16884 <ul>
16885 <li>Sub-one
16886 <li>Sub-two
16887 </ul>
16888 </ul>
16889 !! html/php+tidy
16890 <ul>
16891 <li>One</li>
16892 <li>Two:
16893 <ul>
16894 <li>Sub-one</li>
16895 <li>Sub-two</li>
16896 </ul>
16897 </li>
16898 </ul>
16899 !! html/parsoid
16900 <ul>
16901 <li>One
16902 </li>
16903 <li>Two:
16904 <ul>
16905 <li>Sub-one
16906 </li>
16907 <li>Sub-two
16908 </li>
16909 </ul>
16910 </li>
16911 </ul>
16912
16913 !! end
16914
16915 !! test
16916 HTML nested ordered list, closed tags (bug 5497)
16917 !! wikitext
16918 <ol>
16919 <li>One</li>
16920 <li>Two:
16921 <ol>
16922 <li>Sub-one</li>
16923 <li>Sub-two</li>
16924 </ol>
16925 </li>
16926 </ol>
16927 !! html
16928 <ol>
16929 <li>One</li>
16930 <li>Two:
16931 <ol>
16932 <li>Sub-one</li>
16933 <li>Sub-two</li>
16934 </ol>
16935 </li>
16936 </ol>
16937
16938 !! end
16939
16940 !! test
16941 HTML nested ordered list, open tags (bug 5497)
16942 !! wikitext
16943 <ol>
16944 <li>One
16945 <li>Two:
16946 <ol>
16947 <li>Sub-one
16948 <li>Sub-two
16949 </ol>
16950 </ol>
16951 !! html/php
16952 <ol>
16953 <li>One
16954 <li>Two:
16955 <ol>
16956 <li>Sub-one
16957 <li>Sub-two
16958 </ol>
16959 </ol>
16960
16961 !! html/parsoid
16962 <ol>
16963 <li>One
16964 </li>
16965 <li>Two:
16966 <ol>
16967 <li>Sub-one
16968 </li>
16969 <li>Sub-two
16970 </li>
16971 </ol>
16972 </li>
16973 </ol>
16974
16975 !! end
16976
16977 !! test
16978 HTML ordered list item with parameters oddity
16979 !! wikitext
16980 <ol><li id="fragment">One</li>
16981 </ol>
16982 !! html
16983 <ol><li id="fragment">One</li>
16984 </ol>
16985
16986 !! end
16987
16988 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
16989 !!test
16990 bug 5918: autonumbering
16991 !! wikitext
16992 [http://first/] [http://second] [ftp://ftp]
16993
16994 ftp://inlineftp
16995
16996 [mailto:enclosed@mail.tld With target]
16997
16998 [mailto:enclosed@mail.tld]
16999
17000 mailto:inline@mail.tld
17001 !! html/php
17002 <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>
17003 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
17004 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
17005 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
17006 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
17007 </p>
17008 !! html/parsoid
17009 <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>
17010 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
17011 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
17012 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
17013 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
17014 !! end
17015
17016
17017 #
17018 # Security and HTML correctness
17019 # From Nick Jenkins' fuzz testing
17020 #
17021
17022 !! test
17023 Fuzz testing: Parser13
17024 !! wikitext
17025 {|
17026 | http://a|
17027 !! html
17028 <table>
17029 <tr>
17030 <td>
17031 </td>
17032 </tr>
17033 </table>
17034
17035 !! end
17036
17037 !! test
17038 Fuzz testing: Parser14
17039 !! wikitext
17040 == onmouseover= ==
17041 http://__TOC__
17042 !! html
17043 <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>
17044 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17045 <ul>
17046 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17047 </ul>
17048 </div>
17049
17050
17051 !! html+tidy
17052 <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>
17053 <p>http://</p>
17054 <div id="toc" class="toc">
17055 <div id="toctitle">
17056 <h2>Contents</h2>
17057 </div>
17058 <ul>
17059 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17060 </ul>
17061 </div>
17062 <p></p>
17063 !! end
17064
17065 !! test
17066 Fuzz testing: Parser14-table
17067 !! options
17068 parsoid=wt2html,html2html
17069 !! wikitext
17070 ==a==
17071 {| STYLE=__TOC__
17072 !! html
17073 <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>
17074 <table style="&#95;_TOC&#95;_">
17075 <tr><td></td></tr>
17076 </table>
17077
17078 !! html+tidy
17079 <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>
17080 <table style="__TOC__">
17081 <tr>
17082 <td></td>
17083 </tr>
17084 </table>
17085 !! html/parsoid
17086 <h2>a</h2>
17087 <table style="__TOC__"></table>
17088 !! end
17089
17090 # Known to produce bogus xml (extra </td>)
17091 !! test
17092 Fuzz testing: Parser16
17093 !! wikitext
17094 {|
17095 !https://||||||
17096 !! html
17097 <table>
17098 <tr>
17099 <th>https://</th>
17100 <th></th>
17101 <th></th>
17102 <th>
17103 </td>
17104 </tr>
17105 </table>
17106
17107 !! html+tidy
17108 <table>
17109 <tr>
17110 <th>https://</th>
17111 <th></th>
17112 <th></th>
17113 <th></th>
17114 </tr>
17115 </table>
17116 !! end
17117
17118 !! test
17119 Fuzz testing: Parser21
17120 !! wikitext
17121 {|
17122 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17123 |
17124 !! html
17125 <table>
17126 <tr>
17127 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17128 </th>
17129 <td>
17130 </td>
17131 </tr>
17132 </table>
17133
17134 !! end
17135
17136 !! test
17137 Fuzz testing: Parser22
17138 !! wikitext
17139 http://===r:::https://b
17140
17141 {|
17142 !! html
17143 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17144 </p>
17145 <table>
17146 <tr><td></td></tr>
17147 </table>
17148
17149 !! end
17150
17151 # Known to produce bad XML for now
17152 !! test
17153 Fuzz testing: Parser24
17154 !! wikitext
17155 {|
17156 {{{|
17157 <u CLASS=
17158 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17159 <br style="onmouseover='alert(document.cookie);' " />
17160
17161 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17162 |
17163 !! html
17164 <table>
17165 {{{|
17166 <u class="&#124;">}}}} &gt;
17167 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17168
17169 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17170 <tr>
17171 <td></u>
17172 </td>
17173 </tr>
17174 </table>
17175
17176 !! end
17177
17178 # Note: the current result listed for this is not what the original one was,
17179 # but the original bug was JavaScript injection, which is fixed in any case.
17180 # It's not clear that the original result listed was any more correct than the
17181 # current one. Original result:
17182 # <p>{{{|
17183 # </p>
17184 # <li class="&#124;&#124;">
17185 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17186 !!test
17187 Fuzz testing: Parser25 (bug 6055)
17188 !! wikitext
17189 {{{
17190 |
17191 <LI CLASS=||
17192 >
17193 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17194 !! html
17195 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17196 </p>
17197 !! end
17198
17199 !!test
17200 Fuzz testing: URL adjacent extension (with space, clean)
17201 !! wikitext
17202 http://example.com <nowiki>junk</nowiki>
17203 !! html/php
17204 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17205 </p>
17206 !! html/parsoid
17207 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17208 !! end
17209
17210 !!test
17211 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17212 !! wikitext
17213 http://example.com<nowiki>junk</nowiki>
17214 !! html/php
17215 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17216 </p>
17217 !! html/parsoid
17218 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17219 !! end
17220
17221 !!test
17222 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17223 !! wikitext
17224 http://example.com<pre>junk</pre>
17225 !! html/php
17226 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17227
17228 !! html/php+tidy
17229 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17230 <pre>
17231 junk
17232 </pre>
17233 !! html/parsoid
17234 <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>
17235 !!end
17236
17237 !!test
17238 Fuzz testing: image with bogus manual thumbnail
17239 !! wikitext
17240 [[Image:foobar.jpg|thumbnail= ]]
17241 !! html/php
17242 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17243
17244 !! html/parsoid
17245 <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>
17246 !!end
17247
17248 !! test
17249 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17250 !! wikitext
17251 <pre dir="&#10;"></pre>
17252 !! html
17253 <pre dir="&#10;"></pre>
17254
17255 !! end
17256
17257 !! test
17258 Parsing optional HTML elements (Bug 6171)
17259 !! options
17260 !! wikitext
17261 <table>
17262 <tr>
17263 <td> Some tabular data</td>
17264 <td> More tabular data ...
17265 <td> And yet som tabular data</td>
17266 </tr>
17267 </table>
17268 !! html
17269 <table>
17270 <tr>
17271 <td> Some tabular data</td>
17272 <td> More tabular data ...
17273 </td><td> And yet som tabular data</td>
17274 </tr>
17275 </table>
17276
17277 !! end
17278
17279 !! test
17280 Correct handling of <td>, <tr> (Bug 6171)
17281 !! options
17282 !! wikitext
17283 <table>
17284 <tr>
17285 <td> Some tabular data</td>
17286 <td> More tabular data ...</td>
17287 <td> And yet som tabular data</td>
17288 </tr>
17289 </table>
17290 !! html
17291 <table>
17292 <tr>
17293 <td> Some tabular data</td>
17294 <td> More tabular data ...</td>
17295 <td> And yet som tabular data</td>
17296 </tr>
17297 </table>
17298
17299 !! end
17300
17301
17302 !! test
17303 Parsing crashing regression (fr:JavaScript)
17304 !! wikitext
17305 </body></x>
17306 !! html
17307 <p>&lt;/body&gt;&lt;/x&gt;
17308 </p>
17309 !! end
17310
17311 !! test
17312 Inline wiki vs wiki block nesting
17313 !! wikitext
17314 '''Bold paragraph
17315
17316 New wiki paragraph
17317 !! html
17318 <p><b>Bold paragraph</b>
17319 </p><p>New wiki paragraph
17320 </p>
17321 !! end
17322
17323 # FIXME: The current php output is documented
17324 # and desired output is the parsoid target.
17325 !! test
17326 Inline HTML vs wiki block nesting
17327 !! wikitext
17328 <b>Bold paragraph
17329
17330 New wiki paragraph
17331 !! html/php
17332 <p><b>Bold paragraph
17333 </p><p>New wiki paragraph</b>
17334 </p>
17335 !! html/parsoid
17336 <p><b>Bold paragraph</b>
17337 </p><p>New wiki paragraph
17338 </p>
17339 !! end
17340
17341 # Original result was this:
17342 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
17343 # </p>
17344 # While that might be marginally more intuitive, maybe, the six-apostrophe
17345 # construct is clearly pathological and the result stated here (which is what
17346 # the parser actually does) is about as reasonable as anything.
17347 !!test
17348 Mixing markup for italics and bold
17349 !! options
17350 !! wikitext
17351 '''bold''''''bold''bolditalics'''''
17352 !! html
17353 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
17354 </p>
17355 !! end
17356
17357
17358 !! article
17359 Xyzzyx
17360 !! text
17361 Article for special page transclusion test
17362 !! endarticle
17363
17364 !! test
17365 Special page transclusion
17366 !! options
17367 !! wikitext
17368 {{Special:Prefixindex/Xyzzyx}}
17369 !! html
17370 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17371 </ul>
17372
17373 !! end
17374
17375 !! test
17376 Special page transclusion twice (bug 5021)
17377 !! options
17378 !! wikitext
17379 {{Special:Prefixindex/Xyzzyx}}
17380 {{Special:Prefixindex/Xyzzyx}}
17381 !! html
17382 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17383 </ul>
17384 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17385 </ul>
17386
17387 !! end
17388
17389 !! test
17390 Transclusion of default MediaWiki message
17391 !! wikitext
17392 {{MediaWiki:Mainpage}}
17393 !! html
17394 <p>Main Page
17395 </p>
17396 !! end
17397
17398 !! test
17399 Transclusion of nonexistent MediaWiki message
17400 !! wikitext
17401 {{MediaWiki:Mainpagexxx}}
17402 !! html
17403 <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>
17404 </p>
17405 !! end
17406
17407 !! test
17408 Transclusion of MediaWiki message with underscore
17409 !! wikitext
17410 {{MediaWiki:history_short}}
17411 !! html
17412 <p>History
17413 </p>
17414 !! end
17415
17416 !! test
17417 Transclusion of MediaWiki message with space
17418 !! wikitext
17419 {{MediaWiki:history short}}
17420 !! html
17421 <p>History
17422 </p>
17423 !! end
17424
17425 !! test
17426 Invalid header with following text
17427 !! wikitext
17428 = x = y
17429 !! html
17430 <p>= x = y
17431 </p>
17432 !! end
17433
17434
17435 !! test
17436 Section extraction test (section 0)
17437 !! options
17438 section=0
17439 !! wikitext
17440 start
17441 ==a==
17442 ===aa===
17443 ====aaa====
17444 ==b==
17445 ===ba===
17446 ===bb===
17447 ====bba====
17448 ===bc===
17449 ==c==
17450 ===ca===
17451 !! html/php
17452 start
17453 !! end
17454
17455 !! test
17456 Section extraction test (section 1)
17457 !! options
17458 section=1
17459 !! wikitext
17460 start
17461 ==a==
17462 ===aa===
17463 ====aaa====
17464 ==b==
17465 ===ba===
17466 ===bb===
17467 ====bba====
17468 ===bc===
17469 ==c==
17470 ===ca===
17471 !! html/php
17472 ==a==
17473 ===aa===
17474 ====aaa====
17475 !! end
17476
17477 !! test
17478 Section extraction test (section 2)
17479 !! options
17480 section=2
17481 !! wikitext
17482 start
17483 ==a==
17484 ===aa===
17485 ====aaa====
17486 ==b==
17487 ===ba===
17488 ===bb===
17489 ====bba====
17490 ===bc===
17491 ==c==
17492 ===ca===
17493 !! html/php
17494 ===aa===
17495 ====aaa====
17496 !! end
17497
17498 !! test
17499 Section extraction test (section 3)
17500 !! options
17501 section=3
17502 !! wikitext
17503 start
17504 ==a==
17505 ===aa===
17506 ====aaa====
17507 ==b==
17508 ===ba===
17509 ===bb===
17510 ====bba====
17511 ===bc===
17512 ==c==
17513 ===ca===
17514 !! html/php
17515 ====aaa====
17516 !! end
17517
17518 !! test
17519 Section extraction test (section 4)
17520 !! options
17521 section=4
17522 !! wikitext
17523 start
17524 ==a==
17525 ===aa===
17526 ====aaa====
17527 ==b==
17528 ===ba===
17529 ===bb===
17530 ====bba====
17531 ===bc===
17532 ==c==
17533 ===ca===
17534 !! html/php
17535 ==b==
17536 ===ba===
17537 ===bb===
17538 ====bba====
17539 ===bc===
17540 !! end
17541
17542 !! test
17543 Section extraction test (section 5)
17544 !! options
17545 section=5
17546 !! wikitext
17547 start
17548 ==a==
17549 ===aa===
17550 ====aaa====
17551 ==b==
17552 ===ba===
17553 ===bb===
17554 ====bba====
17555 ===bc===
17556 ==c==
17557 ===ca===
17558 !! html/php
17559 ===ba===
17560 !! end
17561
17562 !! test
17563 Section extraction test (section 6)
17564 !! options
17565 section=6
17566 !! wikitext
17567 start
17568 ==a==
17569 ===aa===
17570 ====aaa====
17571 ==b==
17572 ===ba===
17573 ===bb===
17574 ====bba====
17575 ===bc===
17576 ==c==
17577 ===ca===
17578 !! html/php
17579 ===bb===
17580 ====bba====
17581 !! end
17582
17583 !! test
17584 Section extraction test (section 7)
17585 !! options
17586 section=7
17587 !! wikitext
17588 start
17589 ==a==
17590 ===aa===
17591 ====aaa====
17592 ==b==
17593 ===ba===
17594 ===bb===
17595 ====bba====
17596 ===bc===
17597 ==c==
17598 ===ca===
17599 !! html/php
17600 ====bba====
17601 !! end
17602
17603 !! test
17604 Section extraction test (section 8)
17605 !! options
17606 section=8
17607 !! wikitext
17608 start
17609 ==a==
17610 ===aa===
17611 ====aaa====
17612 ==b==
17613 ===ba===
17614 ===bb===
17615 ====bba====
17616 ===bc===
17617 ==c==
17618 ===ca===
17619 !! html/php
17620 ===bc===
17621 !! end
17622
17623 !! test
17624 Section extraction test (section 9)
17625 !! options
17626 section=9
17627 !! wikitext
17628 start
17629 ==a==
17630 ===aa===
17631 ====aaa====
17632 ==b==
17633 ===ba===
17634 ===bb===
17635 ====bba====
17636 ===bc===
17637 ==c==
17638 ===ca===
17639 !! html/php
17640 ==c==
17641 ===ca===
17642 !! end
17643
17644 !! test
17645 Section extraction test (section 10)
17646 !! options
17647 section=10
17648 !! wikitext
17649 start
17650 ==a==
17651 ===aa===
17652 ====aaa====
17653 ==b==
17654 ===ba===
17655 ===bb===
17656 ====bba====
17657 ===bc===
17658 ==c==
17659 ===ca===
17660 !! html/php
17661 ===ca===
17662 !! end
17663
17664 !! test
17665 Section extraction test (nonexistent section 11)
17666 !! options
17667 section=11
17668 !! wikitext
17669 start
17670 ==a==
17671 ===aa===
17672 ====aaa====
17673 ==b==
17674 ===ba===
17675 ===bb===
17676 ====bba====
17677 ===bc===
17678 ==c==
17679 ===ca===
17680 !! html/php
17681 !! end
17682
17683 !! test
17684 Section extraction test with bogus heading (section 1)
17685 !! options
17686 section=1
17687 !! wikitext
17688 ==a==
17689 ==bogus== not a legal section
17690 ==b==
17691 !! html/php
17692 ==a==
17693 ==bogus== not a legal section
17694 !! end
17695
17696 !! test
17697 Section extraction test with bogus heading (section 2)
17698 !! options
17699 section=2
17700 !! wikitext
17701 ==a==
17702 ==bogus== not a legal section
17703 ==b==
17704 !! html/php
17705 ==b==
17706 !! end
17707
17708 !! test
17709 Section extraction test with comment after heading (section 1)
17710 !! options
17711 section=1
17712 !! wikitext
17713 ==a==
17714 ==b== <!-- -->
17715 ==c==
17716 !! html/php
17717 ==a==
17718 !! end
17719
17720 !! test
17721 Section extraction test with comment after heading (section 2)
17722 !! options
17723 section=2
17724 !! wikitext
17725 ==a==
17726 ==b== <!-- -->
17727 ==c==
17728 !! html/php
17729 ==b== <!-- -->
17730 !! end
17731
17732 !! test
17733 Section extraction test with bogus <nowiki> heading (section 1)
17734 !! options
17735 section=1
17736 !! wikitext
17737 ==a==
17738 ==bogus== <nowiki>not a legal section</nowiki>
17739 ==b==
17740 !! html/php
17741 ==a==
17742 ==bogus== <nowiki>not a legal section</nowiki>
17743 !! end
17744
17745 !! test
17746 Section extraction test with bogus <nowiki> heading (section 2)
17747 !! options
17748 section=2
17749 !! wikitext
17750 ==a==
17751 ==bogus== <nowiki>not a legal section</nowiki>
17752 ==b==
17753 !! html/php
17754 ==b==
17755 !! end
17756
17757 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
17758 # instead of respecting commented sections
17759 !! test
17760 Section extraction prefixed by comment (section 1)
17761 !! options
17762 section=1
17763 !! wikitext
17764 <!-- -->==sec1==
17765 ==sec2==
17766 !! html/php
17767 ==sec2==
17768 !!end
17769
17770 !! test
17771 Section extraction prefixed by comment (section 2)
17772 !! options
17773 section=2
17774 !! wikitext
17775 <!-- -->==sec1==
17776 ==sec2==
17777 !! html/php
17778
17779 !!end
17780
17781 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
17782 # instead of respecting HTML-style headings
17783 !! test
17784 Section extraction, mixed wiki and html (section 1)
17785 !! options
17786 section=1
17787 !! wikitext
17788 <h2>unmarked</h2>
17789 unmarked
17790 ==1==
17791 one
17792 ==2==
17793 two
17794 !! html/php
17795 ==1==
17796 one
17797 !! end
17798
17799 !! test
17800 Section extraction, mixed wiki and html (section 2)
17801 !! options
17802 section=2
17803 !! wikitext
17804 <h2>unmarked</h2>
17805 unmarked
17806 ==1==
17807 one
17808 ==2==
17809 two
17810 !! html/php
17811 ==2==
17812 two
17813 !! end
17814
17815
17816 # Formerly testing for bug 3342
17817 !! test
17818 Section extraction, heading surrounded by <noinclude>
17819 !! options
17820 section=1
17821 !! wikitext
17822 <noinclude>==unmarked==</noinclude>
17823 ==marked==
17824 !! html/php
17825 ==marked==
17826 !!end
17827
17828 # Test behavior of bug 19910
17829 !! test
17830 Sectiion with all-equals
17831 !! options
17832 section=2
17833 !! wikitext
17834 ===
17835 The line above must have a trailing space
17836 === <!--
17837 --> <!-- -->
17838 But just in case it doesn't...
17839 !! html/php
17840 === <!--
17841 --> <!-- -->
17842 But just in case it doesn't...
17843 !! end
17844
17845 !! test
17846 Section replacement test (section 0)
17847 !! options
17848 replace=0,"xxx"
17849 !! wikitext
17850 start
17851 ==a==
17852 ===aa===
17853 ====aaa====
17854 ==b==
17855 ===ba===
17856 ===bb===
17857 ====bba====
17858 ===bc===
17859 ==c==
17860 ===ca===
17861 !! html/php
17862 xxx
17863
17864 ==a==
17865 ===aa===
17866 ====aaa====
17867 ==b==
17868 ===ba===
17869 ===bb===
17870 ====bba====
17871 ===bc===
17872 ==c==
17873 ===ca===
17874 !! end
17875
17876 !! test
17877 Section replacement test (section 1)
17878 !! options
17879 replace=1,"xxx"
17880 !! wikitext
17881 start
17882 ==a==
17883 ===aa===
17884 ====aaa====
17885 ==b==
17886 ===ba===
17887 ===bb===
17888 ====bba====
17889 ===bc===
17890 ==c==
17891 ===ca===
17892 !! html/php
17893 start
17894 xxx
17895
17896 ==b==
17897 ===ba===
17898 ===bb===
17899 ====bba====
17900 ===bc===
17901 ==c==
17902 ===ca===
17903 !! end
17904
17905 !! test
17906 Section replacement test (section 2)
17907 !! options
17908 replace=2,"xxx"
17909 !! wikitext
17910 start
17911 ==a==
17912 ===aa===
17913 ====aaa====
17914 ==b==
17915 ===ba===
17916 ===bb===
17917 ====bba====
17918 ===bc===
17919 ==c==
17920 ===ca===
17921 !! html/php
17922 start
17923 ==a==
17924 xxx
17925
17926 ==b==
17927 ===ba===
17928 ===bb===
17929 ====bba====
17930 ===bc===
17931 ==c==
17932 ===ca===
17933 !! end
17934
17935 !! test
17936 Section replacement test (section 3)
17937 !! options
17938 replace=3,"xxx"
17939 !! wikitext
17940 start
17941 ==a==
17942 ===aa===
17943 ====aaa====
17944 ==b==
17945 ===ba===
17946 ===bb===
17947 ====bba====
17948 ===bc===
17949 ==c==
17950 ===ca===
17951 !! html/php
17952 start
17953 ==a==
17954 ===aa===
17955 xxx
17956
17957 ==b==
17958 ===ba===
17959 ===bb===
17960 ====bba====
17961 ===bc===
17962 ==c==
17963 ===ca===
17964 !! end
17965
17966 !! test
17967 Section replacement test (section 4)
17968 !! options
17969 replace=4,"xxx"
17970 !! wikitext
17971 start
17972 ==a==
17973 ===aa===
17974 ====aaa====
17975 ==b==
17976 ===ba===
17977 ===bb===
17978 ====bba====
17979 ===bc===
17980 ==c==
17981 ===ca===
17982 !! html/php
17983 start
17984 ==a==
17985 ===aa===
17986 ====aaa====
17987 xxx
17988
17989 ==c==
17990 ===ca===
17991 !! end
17992
17993 !! test
17994 Section replacement test (section 5)
17995 !! options
17996 replace=5,"xxx"
17997 !! wikitext
17998 start
17999 ==a==
18000 ===aa===
18001 ====aaa====
18002 ==b==
18003 ===ba===
18004 ===bb===
18005 ====bba====
18006 ===bc===
18007 ==c==
18008 ===ca===
18009 !! html/php
18010 start
18011 ==a==
18012 ===aa===
18013 ====aaa====
18014 ==b==
18015 xxx
18016
18017 ===bb===
18018 ====bba====
18019 ===bc===
18020 ==c==
18021 ===ca===
18022 !! end
18023
18024 !! test
18025 Section replacement test (section 6)
18026 !! options
18027 replace=6,"xxx"
18028 !! wikitext
18029 start
18030 ==a==
18031 ===aa===
18032 ====aaa====
18033 ==b==
18034 ===ba===
18035 ===bb===
18036 ====bba====
18037 ===bc===
18038 ==c==
18039 ===ca===
18040 !! html/php
18041 start
18042 ==a==
18043 ===aa===
18044 ====aaa====
18045 ==b==
18046 ===ba===
18047 xxx
18048
18049 ===bc===
18050 ==c==
18051 ===ca===
18052 !! end
18053
18054 !! test
18055 Section replacement test (section 7)
18056 !! options
18057 replace=7,"xxx"
18058 !! wikitext
18059 start
18060 ==a==
18061 ===aa===
18062 ====aaa====
18063 ==b==
18064 ===ba===
18065 ===bb===
18066 ====bba====
18067 ===bc===
18068 ==c==
18069 ===ca===
18070 !! html/php
18071 start
18072 ==a==
18073 ===aa===
18074 ====aaa====
18075 ==b==
18076 ===ba===
18077 ===bb===
18078 xxx
18079
18080 ===bc===
18081 ==c==
18082 ===ca===
18083 !! end
18084
18085 !! test
18086 Section replacement test (section 8)
18087 !! options
18088 replace=8,"xxx"
18089 !! wikitext
18090 start
18091 ==a==
18092 ===aa===
18093 ====aaa====
18094 ==b==
18095 ===ba===
18096 ===bb===
18097 ====bba====
18098 ===bc===
18099 ==c==
18100 ===ca===
18101 !! html/php
18102 start
18103 ==a==
18104 ===aa===
18105 ====aaa====
18106 ==b==
18107 ===ba===
18108 ===bb===
18109 ====bba====
18110 xxx
18111
18112 ==c==
18113 ===ca===
18114 !!end
18115
18116 !! test
18117 Section replacement test (section 9)
18118 !! options
18119 replace=9,"xxx"
18120 !! wikitext
18121 start
18122 ==a==
18123 ===aa===
18124 ====aaa====
18125 ==b==
18126 ===ba===
18127 ===bb===
18128 ====bba====
18129 ===bc===
18130 ==c==
18131 ===ca===
18132 !! html/php
18133 start
18134 ==a==
18135 ===aa===
18136 ====aaa====
18137 ==b==
18138 ===ba===
18139 ===bb===
18140 ====bba====
18141 ===bc===
18142 xxx
18143 !! end
18144
18145 !! test
18146 Section replacement test (section 10)
18147 !! options
18148 replace=10,"xxx"
18149 !! wikitext
18150 start
18151 ==a==
18152 ===aa===
18153 ====aaa====
18154 ==b==
18155 ===ba===
18156 ===bb===
18157 ====bba====
18158 ===bc===
18159 ==c==
18160 ===ca===
18161 !! html/php
18162 start
18163 ==a==
18164 ===aa===
18165 ====aaa====
18166 ==b==
18167 ===ba===
18168 ===bb===
18169 ====bba====
18170 ===bc===
18171 ==c==
18172 xxx
18173 !! end
18174
18175 !! test
18176 Section replacement test with initial whitespace (bug 13728)
18177 !! options
18178 replace=2,"xxx"
18179 !! wikitext
18180 Preformatted initial line
18181 ==a==
18182 ===a===
18183 !! html/php
18184 Preformatted initial line
18185 ==a==
18186 xxx
18187 !! end
18188
18189
18190 !! test
18191 Section extraction, heading followed by pre with 20 spaces (bug 6398)
18192 !! options
18193 section=1
18194 !! wikitext
18195 ==a==
18196 a
18197 !! html/php
18198 ==a==
18199 a
18200 !! end
18201
18202 !! test
18203 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
18204 !! options
18205 section=1
18206 !! wikitext
18207 ==a==
18208 a
18209 !! html/php
18210 ==a==
18211 a
18212 !! end
18213
18214
18215 !! test
18216 Section extraction, <pre> around bogus header (bug 10309)
18217 !! options
18218 section=2
18219 !! wikitext
18220 == Section One ==
18221 <pre>
18222 =======
18223 </pre>
18224
18225 == Section Two ==
18226 stuff
18227 !! html/php
18228 == Section Two ==
18229 stuff
18230 !! end
18231
18232 !! test
18233 Section replacement, <pre> around bogus header (bug 10309)
18234 !! options
18235 replace=2,"xxx"
18236 !! wikitext
18237 == Section One ==
18238 <pre>
18239 =======
18240 </pre>
18241
18242 == Section Two ==
18243 stuff
18244 !! html/php
18245 == Section One ==
18246 <pre>
18247 =======
18248 </pre>
18249
18250 xxx
18251 !! end
18252
18253
18254 !! test
18255 Handling of &#x0A; in URLs
18256 !! wikitext
18257 ** irc://&#x0A;a
18258 !! html/php
18259 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18260
18261 !! html/parsoid
18262 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
18263 a">irc://
18264 a</a></li></ul></li></ul>
18265 !! end
18266
18267 !! test
18268 Handling of %0A in URLs
18269 !! wikitext
18270 ** irc://%0Aa
18271 !! html/php
18272 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18273
18274 !! html/parsoid
18275 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18276 !! end
18277
18278
18279 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18280 !! test
18281 5 quotes, code coverage +1 line
18282 !! options
18283 parsoid=wt2html
18284 !! wikitext
18285 '''''
18286 !! html/php
18287 !! html/parsoid
18288 <p><b><i></i></b></p>
18289 !! end
18290
18291 # same html as previous, but wikitext adjusted to match parsoid html2wt
18292 # note that wt2html and html2html will put the <i> before the <b>
18293 !! test
18294 5 quotes, code coverage +1 line w/ nowiki (1)
18295 !! options
18296 parsoid=wt2wt,html2wt
18297 !! wikitext
18298 '''''<nowiki/>'''''
18299 !! html/php
18300 <p><i></i>
18301 </p>
18302 !! html/parsoid
18303 <p><b><i></i></b></p>
18304 !! end
18305
18306 # same as previous, just swapping the <i> and <b>
18307 !! test
18308 5 quotes, code coverage +1 line w/ nowiki (2)
18309 !! wikitext
18310 '''''<nowiki/>'''''
18311 !! html/php
18312 <p><i></i>
18313 </p>
18314 !! html/parsoid
18315 <p><i><b></b></i></p>
18316 !! end
18317
18318 !! test
18319 Special:Search page linking.
18320 !! wikitext
18321 {{Special:search}}
18322 !! html
18323 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18324 </p>
18325 !! end
18326
18327 !! test
18328 {{!}} is a magic word
18329 !! wikitext
18330 {{!}} is a magic word there and {{!}} is still a magic word here
18331 | is not a magic word here but {{!}} is still a magic word here
18332 !! html/php
18333 <p>| is a magic word there and | is still a magic word here
18334 | is not a magic word here but | is still a magic word here
18335 </p>
18336 !! html/parsoid
18337 <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
18338 | 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>
18339
18340 !! end
18341
18342 !! test
18343 Say the magic word
18344 !! options
18345 title=[[Parser test]]
18346 !! wikitext
18347 * {{PAGENAME}}
18348 * {{PAGENAMEE}}
18349 * {{FULLPAGENAME}}
18350 * {{FULLPAGENAMEE}}
18351 * {{BASEPAGENAME}}
18352 * {{BASEPAGENAMEE}}
18353 * {{SUBPAGENAME}}
18354 * {{SUBPAGENAMEE}}
18355 * {{ROOTPAGENAME}}
18356 * {{ROOTPAGENAMEE}}
18357 * {{TALKPAGENAME}}
18358 * {{TALKPAGENAMEE}}
18359 * {{SUBJECTPAGENAME}}
18360 * {{SUBJECTPAGENAMEE}}
18361 * {{NAMESPACEE}}
18362 * {{NAMESPACE}}
18363 * {{NAMESPACENUMBER}}
18364 * {{TALKSPACE}}
18365 * {{TALKSPACEE}}
18366 * {{SUBJECTSPACE}}
18367 * {{SUBJECTSPACEE}}
18368 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18369 !! html
18370 <ul><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> Parser test</li>
18377 <li> Parser_test</li>
18378 <li> Parser test</li>
18379 <li> Parser_test</li>
18380 <li> Talk:Parser test</li>
18381 <li> Talk:Parser_test</li>
18382 <li> Parser test</li>
18383 <li> Parser_test</li>
18384 <li> </li>
18385 <li> </li>
18386 <li> 0</li>
18387 <li> Talk</li>
18388 <li> Talk</li>
18389 <li> </li>
18390 <li> </li>
18391 <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>
18392
18393 !! end
18394 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18395
18396 !! test
18397 Gallery
18398 !! wikitext
18399 <gallery>
18400 image1.png |
18401 image2.gif|||||
18402
18403 image3|
18404 image4 |300px| centre
18405 image5.svg| http://///////
18406 [[x|xx]]]]
18407 * image6
18408 </gallery>
18409 !! html
18410 <ul class="gallery mw-gallery-traditional">
18411 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18412 <div class="thumb" style="height: 150px;">Image1.png</div>
18413 <div class="gallerytext">
18414 </div>
18415 </div></li>
18416 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18417 <div class="thumb" style="height: 150px;">Image2.gif</div>
18418 <div class="gallerytext">
18419 </div>
18420 </div></li>
18421 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18422 <div class="thumb" style="height: 150px;">Image3</div>
18423 <div class="gallerytext">
18424 </div>
18425 </div></li>
18426 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18427 <div class="thumb" style="height: 150px;">Image4</div>
18428 <div class="gallerytext">
18429 <pre>centre
18430 </pre>
18431 </div>
18432 </div></li>
18433 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18434 <div class="thumb" style="height: 150px;">Image5.svg</div>
18435 <div class="gallerytext">
18436 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
18437 </p>
18438 </div>
18439 </div></li>
18440 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18441 <div class="thumb" style="height: 150px;">* image6</div>
18442 <div class="gallerytext">
18443 </div>
18444 </div></li>
18445 </ul>
18446
18447 !! end
18448
18449 !! test
18450 Gallery (with options)
18451 !! wikitext
18452 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
18453 File:Nonexistent.jpg|caption
18454 File:Nonexistent.jpg
18455 image:foobar.jpg|some '''caption''' [[Main Page]]
18456 image:foobar.jpg
18457 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
18458 </gallery>
18459 !! html
18460 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
18461 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
18462 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18463 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18464 <div class="gallerytext">
18465 <p>caption
18466 </p>
18467 </div>
18468 </div></li>
18469 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18470 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18471 <div class="gallerytext">
18472 </div>
18473 </div></li>
18474 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18475 <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>
18476 <div class="gallerytext">
18477 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18478 </p>
18479 </div>
18480 </div></li>
18481 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18482 <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>
18483 <div class="gallerytext">
18484 </div>
18485 </div></li>
18486 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18487 <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>
18488 <div class="gallerytext">
18489 <p>blabla.
18490 </p>
18491 </div>
18492 </div></li>
18493 </ul>
18494
18495 !! end
18496
18497 !! test
18498 Gallery with link that has fragment
18499 !! wikitext
18500 <gallery>
18501 image:foobar.jpg|link=Main_Page
18502 image:foobar.jpg|link=Main_Page#section
18503 image:foobar.jpg|link=Main Page#section|caption
18504 </gallery>
18505 !! html
18506 <ul class="gallery mw-gallery-traditional">
18507 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18508 <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>
18509 <div class="gallerytext">
18510 </div>
18511 </div></li>
18512 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18513 <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>
18514 <div class="gallerytext">
18515 </div>
18516 </div></li>
18517 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18518 <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>
18519 <div class="gallerytext">
18520 <p>caption
18521 </p>
18522 </div>
18523 </div></li>
18524 </ul>
18525
18526 !! end
18527
18528 !! test
18529 Gallery with wikitext inside caption
18530 !! wikitext
18531 <gallery>
18532 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
18533 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
18534 </gallery>
18535 !! html
18536 <ul class="gallery mw-gallery-traditional">
18537 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18538 <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>
18539 <div class="gallerytext">
18540 <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>
18541 </p>
18542 </div>
18543 </div></li>
18544 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18545 <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>
18546 <div class="gallerytext">
18547 <p>This is a test template
18548 </p>
18549 </div>
18550 </div></li>
18551 </ul>
18552
18553 !! end
18554
18555 !! test
18556 gallery (with showfilename option)
18557 !! wikitext
18558 <gallery showfilename>
18559 File:Nonexistent.jpg|caption
18560 File:Nonexistent.jpg
18561 image:foobar.jpg|some '''caption''' [[Main Page]]
18562 File:Foobar.jpg
18563 </gallery>
18564 !! html
18565 <ul class="gallery mw-gallery-traditional">
18566 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18567 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18568 <div class="gallerytext">
18569 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18570 caption
18571 </p>
18572 </div>
18573 </div></li>
18574 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18575 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18576 <div class="gallerytext">
18577 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18578 </p>
18579 </div>
18580 </div></li>
18581 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18582 <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>
18583 <div class="gallerytext">
18584 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18585 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18586 </p>
18587 </div>
18588 </div></li>
18589 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18590 <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>
18591 <div class="gallerytext">
18592 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18593 </p>
18594 </div>
18595 </div></li>
18596 </ul>
18597
18598 !! end
18599
18600 !! test
18601 Gallery (with namespace-less filenames)
18602 !! wikitext
18603 <gallery>
18604 File:Nonexistent.jpg
18605 Nonexistent.jpg
18606 image:foobar.jpg
18607 foobar.jpg
18608 </gallery>
18609 !! html
18610 <ul class="gallery mw-gallery-traditional">
18611 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18612 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18613 <div class="gallerytext">
18614 </div>
18615 </div></li>
18616 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18617 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18618 <div class="gallerytext">
18619 </div>
18620 </div></li>
18621 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18622 <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>
18623 <div class="gallerytext">
18624 </div>
18625 </div></li>
18626 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18627 <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>
18628 <div class="gallerytext">
18629 </div>
18630 </div></li>
18631 </ul>
18632
18633 !! end
18634
18635 !! test
18636 HTML Hex character encoding (spells the word "JavaScript")
18637 !! options
18638 parsoid=wt2html,wt2wt,html2html
18639 !! wikitext
18640 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
18641 !! html/php
18642 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
18643 </p>
18644 !! html/php+tidy
18645 <p>JavaScript</p>
18646 !! html/parsoid
18647 <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>
18648 !! end
18649
18650 !! test
18651 HTML Hex character encoding bogus encoding (bug 26437 regression check)
18652 !! wikitext
18653 &#xsee;&#XSEE;
18654 !! html/php
18655 <p>&amp;#xsee;&amp;#XSEE;
18656 </p>
18657 !! html/parsoid
18658 <p>&amp;#xsee;&amp;#XSEE;</p>
18659 !! end
18660
18661 !! test
18662 HTML Hex character encoding mixed case
18663 !! options
18664 parsoid=wt2html,wt2wt,html2html
18665 !! wikitext
18666 &#xEE;&#Xee;
18667 !! html/php
18668 <p>&#xee;&#xee;
18669 </p>
18670 !! html/php+tidy
18671 <p>îî</p>
18672 !! html/parsoid
18673 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
18674 !! end
18675
18676 # See: http://www.w3.org/TR/html5/syntax.html#character-references
18677 # Note that U+000C (form feed) is not a valid XML character, so
18678 # it is banned even though allowed in HTML5.
18679 !! test
18680 Illegal character references (T106578)
18681 !! wikitext
18682 ; Null: &#00;
18683 ; FF: &#xC;
18684 ; CR: &#xD;
18685 ; Control (low): &#8;
18686 ; Control (high): &#x7F; &#x9F;
18687 ; Surrogate: &#xD83D;&#xDCA9;
18688 ; This is an okay astral character: &#x1F4A9;
18689 !! html+tidy
18690 <dl>
18691 <dt>Null</dt>
18692 <dd>&amp;#00;</dd>
18693 <dt>FF</dt>
18694 <dd>&amp;#xC;</dd>
18695 <dt>CR</dt>
18696 <dd>&amp;#xD;</dd>
18697 <dt>Control (low)</dt>
18698 <dd>&amp;#8;</dd>
18699 <dt>Control (high)</dt>
18700 <dd>&amp;#x7F; &amp;#x9F;</dd>
18701 <dt>Surrogate</dt>
18702 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
18703 <dt>This is an okay astral character</dt>
18704 <dd>💩</dd>
18705 </dl>
18706 !! end
18707
18708 !! test
18709 __FORCETOC__ override
18710 !! wikitext
18711 __NEWSECTIONLINK__
18712 __FORCETOC__
18713 !! html/php
18714 <p><br />
18715 </p>
18716 !! end
18717
18718 !! test
18719 ISBN code coverage
18720 !! wikitext
18721 ISBN 978-0-1234-56&#x20;789
18722 !! html
18723 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
18724 </p>
18725 !! html+tidy
18726 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
18727 !! html/parsoid
18728 <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>
18729 !! end
18730
18731 !! test
18732 ISBN followed by 5 spaces
18733 !! wikitext
18734 ISBN
18735 !! html
18736 <p>ISBN
18737 </p>
18738 !! end
18739
18740 !! test
18741 Double ISBN
18742 !! wikitext
18743 ISBN ISBN 1234567890
18744 !! html/php
18745 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18746 </p>
18747 !! html/parsoid
18748 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
18749 !! end
18750
18751 # Uppercase X and lowercase x as well
18752 !! test
18753 ISBN with an X
18754 !! wikitext
18755 ISBN 3-462-04561-X
18756 ISBN 3-462-04561-x
18757 ISBN 080442957X
18758 ISBN 080442957x
18759 ISBN 978080442957X
18760 ISBN 978080442957x
18761 !! html/php
18762 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
18763 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
18764 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
18765 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
18766 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
18767 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
18768 </p>
18769 !! html/parsoid
18770 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
18771 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
18772 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
18773 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
18774 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
18775 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
18776 !! end
18777
18778 !! test
18779 ISBN with empty prefix (parsoid test)
18780 !! wikitext
18781 ISBN 1234567890
18782 !! html/php
18783 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18784 </p>
18785 !! html/parsoid
18786 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
18787 !! end
18788
18789 !! test
18790 Bug 22905: <abbr> followed by ISBN followed by </a>
18791 !! wikitext
18792 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
18793 !! html/php
18794 <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>
18795 </p>
18796 !! html/parsoid
18797 <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>
18798 !! end
18799
18800 !! test
18801 Double RFC
18802 !! wikitext
18803 RFC RFC 1234
18804 !! html
18805 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
18806 </p>
18807 !! end
18808
18809 !! test
18810 Double RFC with a wiki link
18811 !! wikitext
18812 RFC [[RFC 1234]]
18813 !! html
18814 <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>
18815 </p>
18816 !! end
18817
18818 !! test
18819 RFC code coverage
18820 !! wikitext
18821 RFC 983&#x20;987
18822 !! html
18823 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
18824 </p>
18825 !! html+tidy
18826 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
18827 !! end
18828
18829 !! test
18830 Centre-aligned image
18831 !! wikitext
18832 [[Image:foobar.jpg|centre]]
18833 !! html
18834 <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>
18835
18836 !!end
18837
18838 !! test
18839 None-aligned image
18840 !! wikitext
18841 [[Image:foobar.jpg|none]]
18842 !! html
18843 <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>
18844
18845 !!end
18846
18847 !! test
18848 Width + Height sized image (using px) (height is ignored)
18849 !! wikitext
18850 [[Image:foobar.jpg|640x480px]]
18851 !! html
18852 <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>
18853 </p>
18854 !!end
18855
18856 !! test
18857 Width-sized image (using px, no following whitespace)
18858 !! wikitext
18859 [[Image:foobar.jpg|640px]]
18860 !! html
18861 <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>
18862 </p>
18863 !!end
18864
18865 !! test
18866 Width-sized image (using px, with following whitespace - test regression from r39467)
18867 !! wikitext
18868 [[Image:foobar.jpg|640px ]]
18869 !! html
18870 <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>
18871 </p>
18872 !!end
18873
18874 !! test
18875 Width-sized image (using px, with preceding whitespace - test regression from r39467)
18876 !! wikitext
18877 [[Image:foobar.jpg| 640px]]
18878 !! html
18879 <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>
18880 </p>
18881 !!end
18882
18883 !! test
18884 Image with page parameter
18885 !! options
18886 djvu
18887 !! wikitext
18888 [[File:LoremIpsum.djvu|page=2]]
18889 !! html/php
18890 <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>
18891 </p>
18892 !! html/parsoid
18893 <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>
18894 !! end
18895
18896 !! test
18897 Another italics / bold test
18898 !! wikitext
18899 ''' ''x'
18900 !! html
18901 <pre>'<i> </i>x'
18902 </pre>
18903 !!end
18904
18905 # FIXME: The php output seems broken. It's interleaving some open/close tags.
18906 !! test
18907 dt/dd/dl test
18908 !! wikitext
18909 :;;;::
18910 !! html/php
18911 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
18912
18913 !! html/parsoid
18914 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
18915
18916 !!end
18917
18918
18919 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
18920 !! test
18921 Images with the "|" character in the comment
18922 !! wikitext
18923 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
18924 !! html/php
18925 <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>
18926
18927 !! html/parsoid
18928 <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>
18929 !! end
18930
18931 !! test
18932 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
18933 !! wikitext
18934 <html><script>alert(1);</script></html>
18935 !! html
18936 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
18937 </p>
18938 !! end
18939
18940 !! test
18941 HTML with raw HTML ($wgRawHtml==true)
18942 !! options
18943 wgRawHtml=1
18944 !! wikitext
18945 <html><script>alert(1);</script></html>
18946 !! html
18947 <p><script>alert(1);</script>
18948 </p>
18949 !! end
18950
18951 !! test
18952 Parents of subpages, one level up
18953 !! options
18954 subpage title=[[Subpage test/L1/L2/L3]]
18955 !! wikitext
18956 [[../|L2]]
18957 !! html
18958 <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>
18959 </p>
18960 !! end
18961
18962
18963 !! test
18964 Parents of subpages, one level up, not named
18965 !! options
18966 subpage title=[[Subpage test/L1/L2/L3]]
18967 !! wikitext
18968 [[../]]
18969 !! html
18970 <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>
18971 </p>
18972 !! end
18973
18974
18975
18976 !! test
18977 Parents of subpages, two levels up
18978 !! options
18979 subpage title=[[Subpage test/L1/L2/L3]]
18980 !! wikitext
18981 [[../../|L1]]2
18982
18983 [[../../|L1]]l
18984 !! html
18985 <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
18986 </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>
18987 </p>
18988 !! end
18989
18990 !! test
18991 Parents of subpages, two levels up, without trailing slash or name.
18992 !! options
18993 subpage title=[[Subpage test/L1/L2/L3]]
18994 !! wikitext
18995 [[../..]]
18996 !! html
18997 <p>[[../..]]
18998 </p>
18999 !! end
19000
19001 !! test
19002 Parents of subpages, two levels up, with lots of extra trailing slashes.
19003 !! options
19004 subpage title=[[Subpage test/L1/L2/L3]]
19005 !! wikitext
19006 [[../../////]]
19007 !! html
19008 <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>
19009 </p>
19010 !! end
19011
19012 !! article
19013 Subpage test/L1/L2/L3Sibling
19014 !! text
19015 Sibling article
19016 !! endarticle
19017
19018 !! test
19019 Transclusion of a sibling page (one level up)
19020 !! options
19021 subpage title=[[Subpage test/L1/L2/L3]]
19022 !! wikitext
19023 {{../L3Sibling}}
19024 !! html
19025 <p>Sibling article
19026 </p>
19027 !! end
19028
19029 !! test
19030 Transclusion of a child page
19031 !! options
19032 subpage title=[[Subpage test/L1/L2]]
19033 !! wikitext
19034 {{/L3Sibling}}
19035 !! html
19036 <p>Sibling article
19037 </p>
19038 !! end
19039
19040 !! test
19041 Non-transclusion because of too many up levels
19042 !! options
19043 subpage title=[[Subpage test/L1/L2/L3]]
19044 !! wikitext
19045 {{../../../../More than parent}}
19046 !! html
19047 <p>{{../../../../More than parent}}
19048 </p>
19049 !! end
19050
19051 !! test
19052 Definition list code coverage
19053 !! wikitext
19054 ; title : def
19055 ; title : def
19056 ;title: def
19057 !! html/php
19058 <dl><dt> title &#160;</dt>
19059 <dd> def</dd>
19060 <dt> title&#160;</dt>
19061 <dd> def</dd>
19062 <dt>title</dt>
19063 <dd> def</dd></dl>
19064
19065 !! html/parsoid
19066 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19067 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19068 <dt>title</dt><dd> def</dd></dl>
19069 !! end
19070
19071 !! test
19072 Don't fall for the self-closing div
19073 !! wikitext
19074 <div>hello world</div/>
19075 !! html
19076 <div>hello world</div>
19077
19078 !! end
19079
19080 !! test
19081 MSGNW magic word
19082 !! wikitext
19083 {{MSGNW:msg}}
19084 !! html/php
19085 <p>&#91;&#91;:Template:Msg&#93;&#93;
19086 </p>
19087 !! end
19088
19089 !! test
19090 RAW magic word
19091 !! wikitext
19092 {{RAW:QUERTY}}
19093 !! html
19094 <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>
19095 </p>
19096 !! end
19097
19098 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
19099 !! test
19100 Always escape literal '>' in output, not just after '<'
19101 !! wikitext
19102 ><>
19103 !! html
19104 <p>&gt;&lt;&gt;
19105 </p>
19106 !! end
19107
19108 !! test
19109 Template caching
19110 !! wikitext
19111 {{Test}}
19112 {{Test}}
19113 !! html
19114 <p>This is a test template
19115 This is a test template
19116 </p>
19117 !! end
19118
19119
19120 !! article
19121 MediaWiki:Fake
19122 !! text
19123 ==header==
19124 !! endarticle
19125
19126 !! test
19127 Inclusion of !userCanEdit() content
19128 !! wikitext
19129 {{MediaWiki:Fake}}
19130 !! html
19131 <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>
19132
19133 !! end
19134
19135
19136 !! test
19137 Out-of-order TOC heading levels
19138 !! wikitext
19139 ==2==
19140 ======6======
19141 ===3===
19142 =1=
19143 =====5=====
19144 ==2==
19145 !! html
19146 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19147 <ul>
19148 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
19149 <ul>
19150 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
19151 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
19152 </ul>
19153 </li>
19154 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
19155 <ul>
19156 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
19157 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
19158 </ul>
19159 </li>
19160 </ul>
19161 </div>
19162
19163 <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>
19164 <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>
19165 <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>
19166 <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>
19167 <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>
19168 <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>
19169
19170 !! end
19171
19172
19173 !! test
19174 ISBN with a dummy number
19175 !! wikitext
19176 ISBN ---
19177 !! html
19178 <p>ISBN ---
19179 </p>
19180 !! end
19181
19182
19183 !! test
19184 ISBN with space-delimited number
19185 !! wikitext
19186 ISBN 92 9017 032 8
19187 !! html
19188 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
19189 </p>
19190 !! end
19191
19192
19193 !! test
19194 ISBN with multiple spaces, no number
19195 !! wikitext
19196 ISBN foo
19197 !! html
19198 <p>ISBN foo
19199 </p>
19200 !! end
19201
19202
19203 !! test
19204 ISBN length
19205 !! wikitext
19206 ISBN 123456789
19207
19208 ISBN 1234567890
19209
19210 ISBN 12345678901
19211 !! html
19212 <p>ISBN 123456789
19213 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19214 </p><p>ISBN 12345678901
19215 </p>
19216 !! end
19217
19218
19219 !! test
19220 ISBN with trailing year (bug 8110)
19221 !! wikitext
19222 ISBN 1-234-56789-0 - 2006
19223
19224 ISBN 1 234 56789 0 - 2006
19225 !! html
19226 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
19227 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
19228 </p>
19229 !! end
19230
19231
19232 !! test
19233 anchorencode
19234 !! wikitext
19235 {{anchorencode:foo bar©#%n}}
19236 !! html
19237 <p>foo_bar.C2.A9.23.25n
19238 </p>
19239 !! end
19240
19241 !! test
19242 anchorencode trims spaces
19243 !! wikitext
19244 {{anchorencode: __pretty__please__}}
19245 !! html
19246 <p>pretty_please
19247 </p>
19248 !! end
19249
19250 !! test
19251 anchorencode deals with links
19252 !! wikitext
19253 {{anchorencode: [[hello|world]] [[hi]]}}
19254 !! html
19255 <p>world_hi
19256 </p>
19257 !! end
19258
19259 !! test
19260 anchorencode deals with templates
19261 !! wikitext
19262 {{anchorencode: {{Foo}} }}
19263 !! html
19264 <p>FOO
19265 </p>
19266 !! end
19267
19268 !! test
19269 anchorencode encodes like the TOC generator: (bug 18431)
19270 !! wikitext
19271 === _ +:.3A%3A&&amp;]] ===
19272 {{anchorencode: _ +:.3A%3A&&amp;]] }}
19273 __NOEDITSECTION__
19274 !! html
19275 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
19276 <p>.2B:.3A.253A.26.26.5D.5D
19277 </p>
19278 !! end
19279
19280 !! test
19281 Bug 6200: blockquotes and paragraph formatting
19282 !! wikitext
19283 <blockquote>
19284 foo
19285 </blockquote>
19286
19287 bar
19288
19289 baz
19290 !! html
19291 <blockquote>
19292 <p>foo
19293 </p>
19294 </blockquote>
19295 <p>bar
19296 </p>
19297 <pre>baz
19298 </pre>
19299 !! end
19300
19301 !! test
19302 Bug 8293: Use of center tag ruins paragraph formatting
19303 !! wikitext
19304 <center>
19305 foo
19306 </center>
19307
19308 bar
19309
19310 baz
19311 !! html
19312 <center>
19313 <p>foo
19314 </p>
19315 </center>
19316 <p>bar
19317 </p>
19318 <pre>baz
19319 </pre>
19320 !! end
19321
19322 !!test
19323 Parsing of overlapping (improperly nested) inline html tags
19324 !! wikitext
19325 <span><s>x</span></s>
19326 !! html/php
19327 <p><span><s>x&lt;/span&gt;</s></span>
19328 </p>
19329 !! html/parsoid
19330 <p><span><s>x</s></span>
19331 </p>
19332 !!end
19333
19334 ###
19335 ### Language variants related tests
19336 ###
19337 !! test
19338 Self-link in language variants
19339 !! options
19340 title=[[Dunav]] language=sr
19341 !! wikitext
19342 Both [[Dunav]] and [[Дунав]] are names for this river.
19343 !! html
19344 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
19345 </p>
19346 !!end
19347
19348 !! article
19349 Дуна
19350 !! text
19351 content
19352 !! endarticle
19353
19354 !! test
19355 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
19356 !! options
19357 title=[[Duna]] language=sr
19358 !! wikitext
19359 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
19360 !! html
19361 <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.
19362 </p>
19363 !! end
19364
19365 !! test
19366 Link to a section of a variant of this title shouldn't be parsed as self-link
19367 !! options
19368 title=[[Duna]] language=sr
19369 !! wikitext
19370 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
19371 !! html
19372 <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.
19373 </p>
19374 !! end
19375
19376 !! test
19377 Link to pages in language variants
19378 !! options
19379 language=sr
19380 !! wikitext
19381 Main Page can be written as [[Маин Паге]]
19382 !! html
19383 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
19384 </p>
19385 !!end
19386
19387
19388 !! test
19389 Multiple links to pages in language variants
19390 !! options
19391 language=sr
19392 !! wikitext
19393 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
19394 !! html
19395 <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>.
19396 </p>
19397 !!end
19398
19399
19400 !! test
19401 Simple template in language variants
19402 !! options
19403 language=sr
19404 !! wikitext
19405 {{тест}}
19406 !! html
19407 <p>This is a test template
19408 </p>
19409 !! end
19410
19411
19412 !! test
19413 Template with explicit namespace in language variants
19414 !! options
19415 language=sr
19416 !! wikitext
19417 {{Template:тест}}
19418 !! html
19419 <p>This is a test template
19420 </p>
19421 !! end
19422
19423
19424 !! test
19425 Basic test for template parameter in language variants
19426 !! options
19427 language=sr
19428 !! wikitext
19429 {{парамтест|param=foo}}
19430 !! html
19431 <p>This is a test template with parameter foo
19432 </p>
19433 !! end
19434
19435
19436 !! test
19437 Simple category in language variants
19438 !! options
19439 language=sr cat
19440 !! wikitext
19441 [[Category:МедиаWики Усер'с Гуиде]]
19442 !! html
19443 <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>
19444 !! end
19445
19446
19447 !! article
19448 Category:分类
19449 !! text
19450 blah
19451 !! endarticle
19452
19453 !! article
19454 Category:分類
19455 !! text
19456 blah
19457 !! endarticle
19458
19459 ## We used to, but no longer wt2wt this test since the default serializer
19460 ## will normalize all categories to serialize on their own line.
19461 ## This wikitext usage is going to be fairly uncommon in production and
19462 ## selser will take care of preserving formatting in those scenarios.
19463 !! test
19464 Don't convert blue categorylinks to another variant (bug 33210)
19465 !! options
19466 cat
19467 language=zh
19468 parsoid=wt2html
19469 !! wikitext
19470 [[A]][[Category:分类]]
19471 !! html/php
19472 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
19473 !! html/parsoid
19474 <p><a rel="mw:WikiLink" href="A" title="A">A</a></p>
19475 <link rel="mw:PageProp/Category" href="Category:分类"/>
19476 !! end
19477
19478 !! test
19479 Stripping -{}- tags (language variants)
19480 !! options
19481 language=sr
19482 !! wikitext
19483 Latin proverb: -{Ne nuntium necare}-
19484 !! html
19485 <p>Latin proverb: Ne nuntium necare
19486 </p>
19487 !! end
19488
19489
19490 !! test
19491 Prevent conversion with -{}- tags (language variants)
19492 !! options
19493 language=sr variant=sr-ec
19494 !! wikitext
19495 Latinski: -{Ne nuntium necare}-
19496 !! html
19497 <p>Латински: Ne nuntium necare
19498 </p>
19499 !! end
19500
19501
19502 !! test
19503 Prevent conversion of text with -{}- tags (language variants)
19504 !! options
19505 language=sr variant=sr-ec
19506 !! wikitext
19507 Latinski: -{Ne nuntium necare}-
19508 !! html
19509 <p>Латински: Ne nuntium necare
19510 </p>
19511 !! end
19512
19513
19514 !! test
19515 Prevent conversion of links with -{}- tags (language variants)
19516 !! options
19517 language=sr variant=sr-ec
19518 !! wikitext
19519 -{[[Main Page]]}-
19520 !! html
19521 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19522 </p>
19523 !! end
19524
19525
19526 !! test
19527 -{}- tags within headlines (within html for parserConvert())
19528 !! options
19529 language=sr variant=sr-ec
19530 !! wikitext
19531 == -{Naslov}- ==
19532 !! html
19533 <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>
19534
19535 !! end
19536
19537
19538 !! test
19539 Explicit definition of language variant alternatives
19540 !! options
19541 language=zh variant=zh-tw
19542 !! wikitext
19543 -{zh:China;zh-tw:Taiwan}-, not China
19544 !! html
19545 <p>Taiwan, not China
19546 </p>
19547 !! end
19548
19549
19550 !! test
19551 Conversion around HTML tags
19552 !! options
19553 language=sr variant=sr-ec
19554 !! wikitext
19555 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
19556 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
19557 !! html
19558 <p>
19559 <span title="ЛаCтин">ски</span>
19560 </p>
19561 !! end
19562
19563
19564 !! test
19565 Explicit session-wise language variant mapping (A flag and - flag)
19566 !! options
19567 language=zh variant=zh-tw
19568 !! wikitext
19569 Taiwan is not China.
19570 But -{A|zh:China;zh-tw:Taiwan}- is China,
19571 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
19572 and -{China}- is China.
19573 !! html
19574 <p>Taiwan is not China.
19575 But Taiwan is Taiwan,
19576 (This should be stripped!)
19577 and China is China.
19578 </p>
19579 !! end
19580
19581 !! test
19582 Explicit session-wise language variant mapping (H flag for hide)
19583 !! options
19584 language=zh variant=zh-tw
19585 !! wikitext
19586 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
19587 Taiwan is China.
19588 !! html
19589 <p>(This should be stripped!)
19590 Taiwan is Taiwan.
19591 </p>
19592 !! end
19593
19594 !! test
19595 Adding explicit conversion rule for title (T flag)
19596 !! options
19597 language=zh variant=zh-tw showtitle
19598 !! wikitext
19599 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19600 !! html
19601 Taiwan
19602 <p>Should be stripped!
19603 </p>
19604 !! end
19605
19606 !! test
19607 Testing that changing the language variant here in the tests actually works
19608 !! options
19609 language=zh variant=zh showtitle
19610 !! wikitext
19611 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19612 !! html
19613 China
19614 <p>Should be stripped!
19615 </p>
19616 !! end
19617
19618 !! test
19619 Recursive conversion of alt and title attrs shouldn't clear converter state
19620 !! options
19621 language=zh variant=zh-cn showtitle
19622 !! wikitext
19623 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
19624 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
19625 !! html
19626 China
19627 <p>
19628 Should be stripped<span title="Exclamation">!</span>
19629 </p>
19630 !! end
19631
19632 !! test
19633 Bug 24072: more test on conversion rule for title
19634 !! options
19635 language=zh variant=zh-tw showtitle
19636 !! wikitext
19637 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19638 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
19639 !! html
19640 Taiwan
19641 <p>This should be stripped!
19642 This won't take interferes with the title rule.
19643 </p>
19644 !! end
19645
19646 !! test
19647 Partly disable title conversion if variant == main language code
19648 !! options
19649 language=zh variant=zh title=[[ZH]] showtitle
19650 !! wikitext
19651 -{T|zh-cn:CN;zh-tw:TW}-
19652 !! html
19653 ZH
19654 <p>
19655 </p>
19656 !! end
19657
19658 !! test
19659 Partly disable title conversion if variant == main language code, more
19660 !! options
19661 language=zh variant=zh title=[[ZH]] showtitle
19662 !! wikitext
19663 -{T|TW}-
19664 !! html
19665 ZH
19666 <p>
19667 </p>
19668 !! end
19669
19670 !! test
19671 Raw output of variant escape tags (R flag)
19672 !! options
19673 language=zh variant=zh-tw
19674 !! wikitext
19675 Raw: -{R|zh:China;zh-tw:Taiwan}-
19676 !! html
19677 <p>Raw: zh:China;zh-tw:Taiwan
19678 </p>
19679 !! end
19680
19681 !! test
19682 Strings evaluating false shouldn't be ignored by Language converter (T51072)
19683 !! options
19684 language=zh variant=zh-cn
19685 !! input
19686 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
19687 !! result
19688 <p>0
19689 </p>
19690 !! end
19691
19692 !! test
19693 Conversion rules from [numeric-only string] to [something else] (T48634)
19694 !! options
19695 language=zh variant=zh-cn
19696 !! input
19697 -{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
19698 !! result
19699 <p>D12345EE12345
19700 </p>
19701 !! end
19702
19703 !! test
19704 Bidirectional converter rule entries with an empty value should be ignored (T53551)
19705 !! options
19706 language=zh variant=zh-cn
19707 !! input
19708 -{H|zh-cn:foo;zh-tw:;}-foobar
19709 !! result
19710 <p>foobar
19711 </p>
19712 !! end
19713
19714 !! test
19715 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
19716 !! options
19717 language=zh variant=zh-cn
19718 !! input
19719 -{H|=>zh-cn:foo;}-foobar
19720 !! result
19721 <p>foobar
19722 </p>
19723 !! end
19724
19725 !! test
19726 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
19727 !! options
19728 language=zh variant=zh-cn
19729 !! input
19730 -{H|}-foobar
19731 !! result
19732 <p>foobar
19733 </p>
19734 !! end
19735
19736 !! test
19737 Nested using of manual convert syntax
19738 !! options
19739 language=zh variant=zh-hk
19740 !! wikitext
19741 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
19742 !! html
19743 <p>Nested: Hello Hong Kong!
19744 </p>
19745 !! end
19746
19747 !! test
19748 Proper conversion of text in external links
19749 !! options
19750 language=sr variant=sr-ec
19751 !! wikitext
19752 http://www.google.com
19753 gopher://www.google.com
19754 [http://www.google.com http://www.google.com]
19755 [gopher://www.google.com gopher://www.google.com]
19756 [https://www.google.com irc://www.google.com]
19757 [ftp://www.google.com www.google.com/ftp://dir]
19758 [//www.google.com www.google.com]
19759 !! html
19760 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19761 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19762 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19763 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19764 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
19765 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
19766 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
19767 </p>
19768 !! end
19769
19770 !! test
19771 Do not convert roman numbers to language variants
19772 !! options
19773 language=sr variant=sr-ec
19774 !! wikitext
19775 Fridrih IV je car.
19776 !! html
19777 <p>Фридрих IV је цар.
19778 </p>
19779 !! end
19780
19781 !! test
19782 Unclosed language converter markup "-{"
19783 !! options
19784 language=sr
19785 !! wikitext
19786 -{T|hello
19787 !! html
19788 <p>-{T|hello
19789 </p>
19790 !! end
19791
19792 !! test
19793 Don't convert raw rule "-{R|=&gt;}-" to "=>"
19794 !! options
19795 language=sr
19796 !! wikitext
19797 -{R|=&gt;}-
19798 !! html
19799 <p>=&gt;
19800 </p>
19801 !!end
19802
19803 !! test
19804 Don't break link parsing if language converter markup is in the caption.
19805 !! options
19806 language=sr variant=sr-ec
19807 !! wikitext
19808 [[Main Page|-{R|main page}-]]
19809 !! html
19810 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
19811 </p>
19812 !! end
19813
19814 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19815 !! test
19816 Don't break image parsing if language converter markup is in the caption.
19817 !! options
19818 language=sr
19819 !! wikitext
19820 [[File:Foobar.jpg|-{R|caption}-]]
19821 !! html/parsoid
19822 <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>
19823 </p>
19824 !! end
19825
19826 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19827 !! test
19828 Don't break list handling if language converter markup is in the item.
19829 !! options
19830 language=zh variant=zh-cn
19831 !! wikitext
19832 ;-{zh-cn:AAA;zh-tw:BBB}-
19833 !! html/php
19834 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
19835
19836 !! html/parsoid
19837 <dl><dt>AAA
19838 </dt></dl>
19839 !! end
19840
19841 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19842 !! test
19843 Don't break table handling if language converter markup is in the cell.
19844 !! options
19845 language=sr variant=sr-ec
19846 !! wikitext
19847 {|
19848 |-
19849 | -{R|B}-
19850 |}
19851 !! html/php
19852 <table>
19853
19854 <tr>
19855 <td>Б}-
19856 </td></tr></table>
19857
19858 !! html/parsoid
19859 <table>
19860
19861 <tr>
19862 <td> B
19863 </td></tr></table>
19864
19865 !! end
19866
19867 !! test
19868 Bug 529: Uncovered bullet
19869 !! wikitext
19870 * Foo {{bullet}}
19871 !! html
19872 <ul><li> Foo </li>
19873 <li> Bar</li></ul>
19874
19875 !! end
19876
19877 # Plain MediaWiki does not remove empty lists, but tidy actually does.
19878 # Templates in Wikipedia rely on this behavior, as tidy has always been
19879 # enabled there. These tests are normally run *without* tidy, so specify the
19880 # full output here.
19881 # To test realistic parsing behavior, apply a tidy-like transformation to both
19882 # the expected output and your parser's output.
19883 !! test
19884 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
19885 !! wikitext
19886 ******* Foo {{bullet}}
19887 !! html
19888 <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>
19889 <li> Bar</li></ul>
19890
19891 !! end
19892
19893 !! test
19894 Bug 529: Uncovered table already at line-start
19895 !! wikitext
19896 x
19897
19898 {{table}}
19899 y
19900 !! html
19901 <p>x
19902 </p>
19903 <table>
19904 <tr>
19905 <td> 1 </td>
19906 <td> 2
19907 </td></tr>
19908 <tr>
19909 <td> 3 </td>
19910 <td> 4
19911 </td></tr></table>
19912 <p>y
19913 </p>
19914 !! end
19915
19916 !! test
19917 Bug 529: Uncovered bullet in parser function result
19918 !! wikitext
19919 * Foo {{lc:{{bullet}} }}
19920 !! html
19921 <ul><li> Foo </li>
19922 <li> bar</li></ul>
19923
19924 !! end
19925
19926 !! test
19927 Bug 5678: Double-parsed template argument
19928 !! wikitext
19929 {{lc:{{{1}}}|hello}}
19930 !! html
19931 <p>{{{1}}}
19932 </p>
19933 !! end
19934
19935 !! test
19936 Bug 5678: Double-parsed template invocation
19937 !! wikitext
19938 {{lc:{{paramtest {{!}} param = hello }} }}
19939 !! html
19940 <p>{{paramtest | param = hello }}
19941 </p>
19942 !! end
19943
19944 !! test
19945 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
19946 !! options
19947 language=cs
19948 title=[[Main Page]]
19949 !! wikitext
19950 {{PRVNÍVELKÉ:ěščř}}
19951 {{prvnívelké:ěščř}}
19952 {{PRVNÍMALÉ:ěščř}}
19953 {{prvnímalé:ěščř}}
19954 {{MALÁ:ěščř}}
19955 {{malá:ěščř}}
19956 {{VELKÁ:ěščř}}
19957 {{velká:ěščř}}
19958 !! html
19959 <p>Ěščř
19960 Ěščř
19961 ěščř
19962 ěščř
19963 ěščř
19964 ěščř
19965 ĚŠČŘ
19966 ĚŠČŘ
19967 </p>
19968 !! end
19969
19970 !! test
19971 Morwen/13: Unclosed link followed by heading
19972 !! wikitext
19973 [[link
19974 ==heading==
19975 !! html
19976 <p>[[link
19977 </p>
19978 <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>
19979
19980 !! end
19981
19982 !! test
19983 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
19984 !! wikitext
19985 {{foo|
19986 =heading=
19987 !! html
19988 <p>{{foo|
19989 </p>
19990 <h1><span class="mw-headline" id="heading">heading</span></h1>
19991
19992 !! end
19993
19994 !! test
19995 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
19996 !! wikitext
19997 {{foo|
19998 ==heading==
19999 !! html
20000 <p>{{foo|
20001 </p>
20002 <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>
20003
20004 !! end
20005
20006 !! test
20007 Tildes in comments
20008 !! options
20009 pst
20010 !! wikitext
20011 <!-- ~~~~ -->
20012 !! html/php
20013 <!-- ~~~~ -->
20014 !! end
20015
20016 !! test
20017 Paragraphs inside divs (no extra line breaks)
20018 !! wikitext
20019 <div>Line one
20020
20021 Line two</div>
20022 !! html
20023 <div>Line one
20024 Line two</div>
20025
20026 !! end
20027
20028 !! test
20029 Paragraphs inside divs (extra line break on open)
20030 !! wikitext
20031 <div>
20032 Line one
20033
20034 Line two</div>
20035 !! html
20036 <div>
20037 <p>Line one
20038 </p>
20039 Line two</div>
20040
20041 !! end
20042
20043 !! test
20044 Paragraphs inside divs (extra line break on close)
20045 !! wikitext
20046 <div>Line one
20047
20048 Line two
20049 </div>
20050 !! html
20051 <div>Line one
20052 <p>Line two
20053 </p>
20054 </div>
20055
20056 !! end
20057
20058 !! test
20059 Paragraphs inside divs (extra line break on open and close)
20060 !! wikitext
20061 <div>
20062 Line one
20063
20064 Line two
20065 </div>
20066 !! html
20067 <div>
20068 <p>Line one
20069 </p><p>Line two
20070 </p>
20071 </div>
20072
20073 !! end
20074
20075 !! test
20076 Nesting tags, paragraphs on lines which begin with <div>
20077 !! wikitext
20078 <div></div><strong>A
20079 B</strong>
20080 !! html/php+tidy
20081 <p><strong>A</strong></p>
20082 <p><strong>B</strong></p>
20083 !! html/parsoid
20084 <div></div>
20085 <p><strong>A
20086 B</strong>
20087 </p>
20088 !! end
20089
20090 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
20091 !! test
20092 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
20093 !! wikitext
20094 <blockquote>Line one
20095
20096 Line two</blockquote>
20097 !! html
20098 <blockquote>Line one
20099 Line two</blockquote>
20100
20101 !! html+tidy
20102 <blockquote>
20103 <p>Line one Line two</p>
20104 </blockquote>
20105 !! end
20106
20107 !! test
20108 Bug 6200: paragraphs inside blockquotes (extra line break on open)
20109 !! wikitext
20110 <blockquote>
20111 Line one
20112
20113 Line two</blockquote>
20114 !! html
20115 <blockquote>
20116 <p>Line one
20117 </p>
20118 Line two</blockquote>
20119
20120 !! html+tidy
20121 <blockquote>
20122 <p>Line one</p>
20123 Line two</blockquote>
20124 !! end
20125
20126 !! test
20127 Bug 6200: paragraphs inside blockquotes (extra line break on close)
20128 !! wikitext
20129 <blockquote>Line one
20130
20131 Line two
20132 </blockquote>
20133 !! html
20134 <blockquote>Line one
20135 <p>Line two
20136 </p>
20137 </blockquote>
20138
20139 !! html+tidy
20140 <blockquote>
20141 <p>Line one</p>
20142 <p>Line two</p>
20143 </blockquote>
20144 !! end
20145
20146 !! test
20147 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
20148 !! wikitext
20149 <blockquote>
20150 Line one
20151
20152 Line two
20153 </blockquote>
20154 !! html
20155 <blockquote>
20156 <p>Line one
20157 </p><p>Line two
20158 </p>
20159 </blockquote>
20160
20161 !! html+tidy
20162 <blockquote>
20163 <p>Line one</p>
20164 <p>Line two</p>
20165 </blockquote>
20166 !! end
20167
20168 !! test
20169 Paragraphs inside blockquotes/divs (no extra line breaks)
20170 !! wikitext
20171 <blockquote><div>Line one
20172
20173 Line two</div></blockquote>
20174 !! html
20175 <blockquote><div>Line one
20176 Line two</div></blockquote>
20177
20178 !! end
20179
20180 !! test
20181 Paragraphs inside blockquotes/divs (extra line break on open)
20182 !! wikitext
20183 <blockquote><div>
20184 Line one
20185
20186 Line two</div></blockquote>
20187 !! html
20188 <blockquote><div>
20189 <p>Line one
20190 </p>
20191 Line two</div></blockquote>
20192
20193 !! end
20194
20195 !! test
20196 Paragraphs inside blockquotes/divs (extra line break on close)
20197 !! wikitext
20198 <blockquote><div>Line one
20199
20200 Line two
20201 </div></blockquote>
20202 !! html
20203 <blockquote><div>Line one
20204 <p>Line two
20205 </p>
20206 </div></blockquote>
20207
20208 !! end
20209
20210 !! test
20211 Paragraphs inside blockquotes/divs (extra line break on open and close)
20212 !! wikitext
20213 <blockquote><div>
20214 Line one
20215
20216 Line two
20217 </div></blockquote>
20218 !! html
20219 <blockquote><div>
20220 <p>Line one
20221 </p><p>Line two
20222 </p>
20223 </div></blockquote>
20224
20225 !! end
20226
20227 !! test
20228 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
20229 !! options
20230 wgLinkHolderBatchSize=0
20231 !! wikitext
20232 [[meatball:1]]
20233 [[meatball:2]]
20234 [[meatball:3]]
20235 !! html
20236 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
20237 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
20238 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
20239 </p>
20240 !! end
20241
20242 !! test
20243 Free external link invading image caption
20244 !! wikitext
20245 [[Image:Foobar.jpg|thumb|http://x|hello]]
20246 !! html
20247 <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>
20248
20249 !! end
20250
20251 !! test
20252 Bug 15196: localised external link numbers
20253 !! options
20254 language=fa
20255 !! wikitext
20256 [http://en.wikipedia.org/]
20257 !! html/php
20258 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
20259 </p>
20260 !! html/parsoid
20261 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
20262 !! end
20263
20264 !! test
20265 Multibyte character in padleft
20266 !! wikitext
20267 {{padleft:-Hello|7|Æ}}
20268 !! html
20269 <p>Æ-Hello
20270 </p>
20271 !! end
20272
20273 !! test
20274 Multibyte character in padright
20275 !! wikitext
20276 {{padright:Hello-|7|Æ}}
20277 !! html
20278 <p>Hello-Æ
20279 </p>
20280 !! end
20281
20282 !!test
20283 formatdate parser function
20284 !! wikitext
20285 {{#formatdate:2009-03-24}}
20286 !! html
20287 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
20288 </p>
20289 !! end
20290
20291 !!test
20292 formatdate parser function, with default format
20293 !! wikitext
20294 {{#formatdate:2009-03-24|mdy}}
20295 !! html
20296 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
20297 </p>
20298 !! end
20299
20300 !! test
20301 Spacing of numbers in formatted dates
20302 !! wikitext
20303 {{#formatdate:January 15}}
20304 !! html
20305 <p><span class="mw-formatted-date" title="01-15">January 15</span>
20306 </p>
20307 !! end
20308
20309 !! test
20310 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
20311 !! options
20312 language=nl title=[[MediaWiki:Common.css]]
20313 !! wikitext
20314 {{#formatdate:2009-03-24|dmy}}
20315 !! html
20316 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
20317 </p>
20318 !! end
20319
20320 #
20321 #
20322 #
20323
20324 #
20325 # Edit comments
20326 #
20327
20328 !! test
20329 Edit comment with link
20330 !! options
20331 comment
20332 !! wikitext
20333 I like the [[Main Page]] a lot
20334 !! html/php
20335 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
20336 !!end
20337
20338 !! test
20339 Edit comment with link and link text
20340 !! options
20341 comment
20342 !! wikitext
20343 I like the [[Main Page|best pages]] a lot
20344 !! html/php
20345 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20346 !!end
20347
20348 !! test
20349 Edit comment with link and link text with suffix
20350 !! options
20351 comment
20352 !! wikitext
20353 I like the [[Main Page|best page]]s a lot
20354 !! html/php
20355 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20356 !!end
20357
20358 !! test
20359 Edit comment with section link (non-local, eg in history list)
20360 !! options
20361 comment title=[[Main Page]]
20362 !! wikitext
20363 /* External links */ removed bogus entries
20364 !! html/php
20365 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20366 !!end
20367
20368 !! test
20369 Edit comment with section link and text before it (non-local, eg in history list)
20370 !! options
20371 comment title=[[Main Page]]
20372 !! wikitext
20373 pre-comment text /* External links */ removed bogus entries
20374 !! html/php
20375 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>
20376 !!end
20377
20378 !! test
20379 Edit comment with section link (local, eg in diff view)
20380 !! options
20381 comment local title=[[Main Page]]
20382 !! wikitext
20383 /* External links */ removed bogus entries
20384 !! html/php
20385 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20386 !!end
20387
20388 !! test
20389 Edit comment with subpage link (bug 14080)
20390 !! options
20391 comment
20392 subpage
20393 title=[[Subpage test]]
20394 !! wikitext
20395 Poked at a [[/subpage]] here...
20396 !! html/php
20397 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
20398 !!end
20399
20400 !! test
20401 Edit comment with subpage link and link text (bug 14080)
20402 !! options
20403 comment
20404 subpage
20405 title=[[Subpage test]]
20406 !! wikitext
20407 Poked at a [[/subpage|neat little page]] here...
20408 !! html/php
20409 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
20410 !!end
20411
20412 !! test
20413 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
20414 !! options
20415 comment
20416 title=[[Subpage test]]
20417 !! wikitext
20418 Poked at a [[/subpage]] here...
20419 !! html/php
20420 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...
20421 !!end
20422
20423 !! test
20424 Edit comment with bare anchor link (local, as on diff)
20425 !! options
20426 comment
20427 local
20428 title=[[Main Page]]
20429 !! wikitext
20430 [[#section]]
20431 !! html/php
20432 <a href="#section">#section</a>
20433 !! end
20434
20435 !! test
20436 Edit comment with bare anchor link (non-local, as on history)
20437 !! options
20438 comment
20439 title=[[Main Page]]
20440 !! wikitext
20441 [[#section]]
20442 !! html/php
20443 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
20444 !! end
20445
20446 !! test
20447 Anchor starting with underscore
20448 !! options
20449 title=[[Foo]]
20450 !! wikitext
20451 [[#_ref|One]]
20452 !! html/php
20453 <p><a href="#_ref">One</a>
20454 </p>
20455 !! html/parsoid
20456 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
20457 !! end
20458
20459 !! test
20460 Id starting with underscore
20461 !! wikitext
20462 <div id="_ref"></div>
20463 !! html/*
20464 <div id="_ref"></div>
20465
20466 !! end
20467
20468 !! test
20469 Space normalisation on autocomment (bug 22784)
20470 !! options
20471 comment
20472 title=[[Main Page]]
20473 !! wikitext
20474 /* __hello__world__ */
20475 !! html/php
20476 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
20477 !! end
20478
20479 !! test
20480 percent-encoding and + signs in comments (Bug 26410)
20481 !! options
20482 comment
20483 !! wikitext
20484 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
20485 !! html/php
20486 <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>
20487 !! end
20488
20489 # Parsoid doesn't support this yet: see bug 73581
20490 # but it *should* omit the 'src' attribute if the image is bad.
20491 # PHP side of tests was disabled in
20492 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
20493 # because of issues in the PHP parserTests infrastructure
20494 # (but the output below is indeed what the PHP side emits)
20495 !! test
20496 Bad images - basic functionality
20497 !! wikitext
20498 [[File:Bad.jpg]]
20499 !! DISABLED/html/php
20500 !! html/parsoid
20501 <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>
20502 !! end
20503
20504 !! test
20505 Bad images - bug 16039: text after bad image disappears
20506 !! wikitext
20507 Foo bar
20508 [[File:Bad.jpg]]
20509 Bar foo
20510 !! DISABLED/html/php
20511 <p>Foo bar
20512 </p><p>Bar foo
20513 </p>
20514 !! html/parsoid
20515 <p>Foo bar
20516 <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>
20517 Bar foo</p>
20518 !! end
20519
20520 !! test
20521 Verify that displaytitle works (bug #22501) no displaytitle
20522 !! options
20523 showtitle
20524 !! config
20525 wgAllowDisplayTitle=true
20526 wgRestrictDisplayTitle=false
20527 !! wikitext
20528 this is not the the title
20529 !! html/php
20530 Parser test
20531 <p>this is not the the title
20532 </p>
20533 !! end
20534
20535 !! test
20536 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
20537 !! options
20538 showtitle
20539 title=[[Screen]]
20540 !! config
20541 wgAllowDisplayTitle=true
20542 wgRestrictDisplayTitle=false
20543 !! wikitext
20544 this is not the the title
20545 {{DISPLAYTITLE:whatever}}
20546 !! html/php
20547 whatever
20548 <p>this is not the the title
20549 </p>
20550 !! end
20551
20552 !! test
20553 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
20554 !! options
20555 showtitle
20556 title=[[Screen]]
20557 !! config
20558 wgAllowDisplayTitle=true
20559 wgRestrictDisplayTitle=true
20560 !! wikitext
20561 this is not the the title
20562 {{DISPLAYTITLE:whatever}}
20563 !! html/php
20564 Screen
20565 <p>this is not the the title
20566 </p>
20567 !! end
20568
20569 !! test
20570 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
20571 !! options
20572 showtitle
20573 title=[[Screen]]
20574 !! config
20575 wgAllowDisplayTitle=true
20576 wgRestrictDisplayTitle=true
20577 !! wikitext
20578 this is not the the title
20579 {{DISPLAYTITLE:screen}}
20580 !! html/php
20581 screen
20582 <p>this is not the the title
20583 </p>
20584 !! end
20585
20586 !! test
20587 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
20588 !! options
20589 showtitle
20590 title=[[Screen]]
20591 !! config
20592 wgAllowDisplayTitle=false
20593 !! wikitext
20594 this is not the the title
20595 {{DISPLAYTITLE:screen}}
20596 !! html/php
20597 Screen
20598 <p>this is not the the title
20599 <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>
20600 </p>
20601 !! end
20602
20603 !! test
20604 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
20605 !! options
20606 showtitle
20607 title=[[Screen]]
20608 !! config
20609 wgAllowDisplayTitle=false
20610 !! wikitext
20611 this is not the the title
20612 !! html/php
20613 Screen
20614 <p>this is not the the title
20615 </p>
20616 !! end
20617
20618 !! test
20619 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
20620 !! options
20621 showtitle
20622 title=[[Screen]]
20623 !! config
20624 wgAllowDisplayTitle=true
20625 wgRestrictDisplayTitle=true
20626 !! wikitext
20627 this is not the the title
20628 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
20629 !! html/php
20630 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
20631 <p>this is not the the title
20632 </p>
20633 !! end
20634
20635 !! test
20636 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
20637 !! options
20638 showtitle
20639 title=[[Screen]]
20640 !! config
20641 wgAllowDisplayTitle=true
20642 wgRestrictDisplayTitle=true
20643 !! wikitext
20644 this is not the the title
20645 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
20646 !! html/php
20647 <span style="color: red;">s</span>creen
20648 <p>this is not the the title
20649 </p>
20650 !! end
20651
20652 !! test
20653 Page status indicators: Empty name is invalid
20654 !! options
20655 showindicators
20656 !! wikitext
20657 <indicator name=" "></indicator>
20658 <indicator></indicator>
20659 !! html
20660 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20661 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20662 </p>
20663 !! end
20664
20665 !! test
20666 Page status indicators: Weird syntaxes that are okay
20667 !! options
20668 showindicators
20669 !! wikitext
20670 <indicator name="empty" />
20671 <indicator name="name"></indicator>
20672 !! html
20673 empty=
20674 name=
20675 <p><br />
20676 </p>
20677 !! end
20678
20679 !! test
20680 Page status indicators: Torture test
20681 !! options
20682 showindicators
20683 !! wikitext
20684 <indicator name="01">hello world</indicator>
20685 <indicator name="02">[[Main Page]]</indicator>
20686 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
20687 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
20688 <indicator name="05">* foo
20689 * bar</indicator>
20690 <indicator name="06"><nowiki>foo</nowiki></indicator>
20691 <indicator name="07"> Preformatted</indicator>
20692 <indicator name="08"><div>Broken tag</indicator>
20693 <indicator name="09">{| class=wikitable
20694 | cell
20695 |}</indicator>
20696 <indicator name="10">Two
20697
20698 paragraphs</indicator>
20699 !! html
20700 01=hello world
20701 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20702 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" />
20703 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>
20704 05=<ul><li> foo</li>
20705 <li> bar</li></ul>
20706
20707 06=foo
20708 07=<pre>Preformatted
20709 </pre>
20710 08=<div>Broken tag</div>
20711
20712 09=<table class="wikitable">
20713 <tr>
20714 <td> cell
20715 </td></tr></table>
20716
20717 10=<p>Two
20718 </p><p>paragraphs
20719 </p>
20720 <p><br />
20721 </p><p><br />
20722 </p><p><br />
20723 </p><p><br />
20724 </p><p><br />
20725 </p>
20726 !! end
20727
20728 !! test
20729 preload: check <noinclude> and <includeonly>
20730 !! options
20731 preload
20732 !! wikitext
20733 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
20734 !! html/php
20735 Hello kind world.
20736 !! end
20737
20738 !! test
20739 preload: check <onlyinclude>
20740 !! options
20741 preload
20742 !! wikitext
20743 Goodbye <onlyinclude>Hello world</onlyinclude>
20744 !! html/php
20745 Hello world
20746 !! end
20747
20748 !! test
20749 preload: can pass tags through if we want to
20750 !! options
20751 preload
20752 !! wikitext
20753 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
20754 !! html/php
20755 <includeonly>Hello world</includeonly>
20756 !! end
20757
20758 !! test
20759 preload: check that it doesn't try to do tricks
20760 !! options
20761 preload
20762 !! wikitext
20763 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20764 !! html/php
20765 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20766 !! end
20767
20768 !! test
20769 Play a bit with r67090 and bug 3158
20770 !! wikitext
20771 <div style="width:50% !important">&nbsp;</div>
20772 <div style="width:50%&nbsp;!important">&nbsp;</div>
20773 <div style="width:50%&#160;!important">&nbsp;</div>
20774 <div style="border : solid;">&nbsp;</div>
20775 !! html/php
20776 <div style="width:50% !important">&#160;</div>
20777 <div style="width:50% !important">&#160;</div>
20778 <div style="width:50% !important">&#160;</div>
20779 <div style="border&#160;: solid;">&#160;</div>
20780
20781 !! html/parsoid
20782 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20783 <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>
20784 <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>
20785 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20786
20787 !! end
20788
20789 !! test
20790 HTML5 data attributes
20791 !! wikitext
20792 <span data-foo="bar">Baz</span>
20793 <p data-abc-def_hij="">Quuz</p>
20794 !! html/php
20795 <p><span data-foo="bar">Baz</span>
20796 </p>
20797 <p data-abc-def_hij="">Quuz</p>
20798
20799 !! html/parsoid
20800 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
20801 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
20802 !! end
20803
20804 !! test
20805 Strip reserved data attributes
20806 !! wikitext
20807 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
20808 !! html/php
20809 <div data-ok="fred">d</div>
20810
20811 !! html/parsoid
20812 <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>
20813 !! end
20814
20815 !! test
20816 percent-encoding and + signs in internal links (Bug 26410)
20817 !! wikitext
20818 [[User:+%]] [[Page+title%]]
20819 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
20820 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
20821 [[%33%45]] [[%33%45+]]
20822 !! html/php
20823 <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>
20824 <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>
20825 <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>
20826 <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>
20827 </p>
20828 !! html/parsoid
20829 <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>
20830 <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>
20831 <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>
20832 <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>
20833 !! end
20834
20835 !! test
20836 Special characters in embedded file links (bug 27679)
20837 !! wikitext
20838 [[File:Contains & ampersand.jpg]]
20839 [[File:Does not exist.jpg|Title with & ampersand]]
20840 !! html/php
20841 <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>
20842 <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>
20843 </p>
20844 !! html/parsoid
20845 <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>
20846 <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>
20847 !! end
20848
20849 !! test
20850 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
20851 !! wikitext
20852 Text&apos;s been normalized?
20853 !! html
20854 <p>Text&#39;s been normalized?
20855 </p>
20856 !! end
20857
20858 !! test
20859 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
20860 !! wikitext
20861 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
20862 !! html
20863 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
20864 </p>
20865 !! end
20866
20867 !! test
20868 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
20869 !! wikitext
20870 [http://www.example.org/ ideograms]
20871 !! html
20872 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
20873 </p>
20874 !! end
20875
20876 !! test
20877 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
20878 !! wikitext
20879 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
20880 !! html
20881 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
20882 </p>
20883 !! end
20884
20885 !! article
20886 Mediawiki:loop1
20887 !! text
20888 {{Identical|A}}
20889 !! endarticle
20890
20891 !! article
20892 Mediawiki:loop2
20893 !! text
20894 {{Identical|B}}
20895 !! endarticle
20896
20897 !! article
20898 Template:Identical
20899 !! text
20900 {{int:loop1}}
20901 {{int:loop2}}
20902 !! endarticle
20903
20904 !! test
20905 Bug 31098 Template which includes system messages which includes the template
20906 !! wikitext
20907 {{Identical}}
20908 !! html
20909 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20910 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20911 </p>
20912 !! end
20913
20914 !! test
20915 Bug31490 Turkish: ucfirst 'blah'
20916 !! options
20917 language=tr
20918 !! wikitext
20919 {{ucfirst:blah}}
20920 !! html
20921 <p>Blah
20922 </p>
20923 !! end
20924
20925 !! test
20926 Bug31490 Turkish: ucfirst 'ix'
20927 !! options
20928 language=tr
20929 !! wikitext
20930 {{ucfirst:ix}}
20931 !! html
20932 <p>İx
20933 </p>
20934 !! end
20935
20936 !! test
20937 Bug31490 Turkish: lcfirst 'BLAH'
20938 !! options
20939 language=tr
20940 !! wikitext
20941 {{lcfirst:BLAH}}
20942 !! html
20943 <p>bLAH
20944 </p>
20945 !! end
20946
20947 !! test
20948 Bug31490 Turkish: ucfırst (with a dotless i)
20949 !! options
20950 language=tr
20951 !! wikitext
20952 {{ucfırst:blah}}
20953 !! html
20954 <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>
20955 </p>
20956 !! end
20957
20958 !! test
20959 Bug31490 ucfırst (with a dotless i) with English language
20960 !! options
20961 language=en
20962 !! wikitext
20963 {{ucfırst:blah}}
20964 !! html
20965 <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>
20966 </p>
20967 !! end
20968
20969 !! test
20970 Bug 26375: TOC with italics
20971 !! options
20972 title=[[Main Page]]
20973 !! wikitext
20974 __TOC__
20975 == ''Lost'' episodes ==
20976 !! html
20977 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20978 <ul>
20979 <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>
20980 </ul>
20981 </div>
20982
20983 <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>
20984
20985 !! end
20986
20987 !! test
20988 Bug 26375: TOC with bold
20989 !! options
20990 title=[[Main Page]]
20991 !! wikitext
20992 __TOC__
20993 == '''should be bold''' then normal text ==
20994 !! html
20995 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20996 <ul>
20997 <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>
20998 </ul>
20999 </div>
21000
21001 <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>
21002
21003 !! end
21004
21005 !! test
21006 Bug 33845: Headings become cursive in TOC when they contain an image
21007 !! options
21008 title=[[Main Page]]
21009 !! wikitext
21010 __TOC__
21011 == Image [[Image:foobar.jpg]] ==
21012 !! html
21013 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21014 <ul>
21015 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
21016 </ul>
21017 </div>
21018
21019 <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>
21020
21021 !! end
21022
21023 !! test
21024 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
21025 !! options
21026 title=[[Main Page]]
21027 !! wikitext
21028 __TOC__
21029 == <blockquote>Quote</blockquote> ==
21030 !! html
21031 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21032 <ul>
21033 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21034 </ul>
21035 </div>
21036
21037 <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>
21038
21039 !! html+tidy
21040 <p></p>
21041 <div id="toc" class="toc">
21042 <div id="toctitle">
21043 <h2>Contents</h2>
21044 </div>
21045 <ul>
21046 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21047 </ul>
21048 </div>
21049 <p></p>
21050 <h2><span class="mw-headline" id="Quote"></span></h2>
21051 <blockquote>
21052 <p><span class="mw-headline" id="Quote">Quote</span></p>
21053 </blockquote>
21054 <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>
21055 !! end
21056
21057 !! test
21058 Unclosed tags in TOC
21059 !! options
21060 title=[[Main Page]]
21061 !! wikitext
21062 __TOC__
21063 == Proof: 2 < 3 ==
21064 <small>Hanc marginis exiguitas non caperet.</small>
21065 QED
21066 !! html
21067 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21068 <ul>
21069 <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>
21070 </ul>
21071 </div>
21072
21073 <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>
21074 <p><small>Hanc marginis exiguitas non caperet.</small>
21075 QED
21076 </p>
21077 !! end
21078
21079 !! test
21080 Multiple tags in TOC
21081 !! wikitext
21082 __TOC__
21083 == <i>Foo</i> <b>Bar</b> ==
21084
21085 == <i>Foo</i> <blockquote>Bar</blockquote> ==
21086 !! html
21087 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21088 <ul>
21089 <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>
21090 <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>
21091 </ul>
21092 </div>
21093
21094 <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>
21095 <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>
21096
21097 !! html+tidy
21098 <p></p>
21099 <div id="toc" class="toc">
21100 <div id="toctitle">
21101 <h2>Contents</h2>
21102 </div>
21103 <ul>
21104 <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>
21105 <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>
21106 </ul>
21107 </div>
21108 <p></p>
21109 <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>
21110 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
21111 <blockquote>
21112 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
21113 </blockquote>
21114 <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>
21115 !! end
21116
21117 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
21118 # html5 tag parsing.
21119 !! test
21120 Tags with parameters in TOC
21121 !! options
21122 parsoid=wt2html
21123 !! wikitext
21124 __TOC__
21125 == <sup class="in-h2">Hello</sup> ==
21126
21127 == <sup class="a > b">Evilbye</sup> ==
21128 !! html/php
21129 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21130 <ul>
21131 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
21132 <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>
21133 </ul>
21134 </div>
21135
21136 <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>
21137 <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>
21138
21139 !! html/parsoid
21140 <meta property="mw:PageProp/toc" />
21141 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
21142
21143 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
21144 !! end
21145
21146 !! test
21147 span tags with directionality in TOC
21148 !! wikitext
21149 __TOC__
21150 == <span dir="ltr">C++</span> ==
21151
21152 == <span dir="rtl">זבנג!</span> ==
21153
21154 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
21155
21156 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
21157
21158 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
21159 !! html
21160 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21161 <ul>
21162 <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>
21163 <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>
21164 <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>
21165 <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>
21166 <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>
21167 </ul>
21168 </div>
21169
21170 <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>
21171 <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>
21172 <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>
21173 <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>
21174 <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>
21175
21176 !! end
21177
21178 !! test
21179 Bug 72884: bdi element in ToC
21180 !! wikitext
21181 __TOC__
21182 == <bdi>test</bdi> ==
21183 !! html
21184 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21185 <ul>
21186 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
21187 </ul>
21188 </div>
21189
21190 <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>
21191
21192 !! end
21193
21194 # Note that the html output does not have the <p></p>, but the
21195 # html+tidy output *does*. This is because the empty <p></p> is
21196 # removed by the sanitizer, but only when tidy is *not* enabled (!).
21197 !! test
21198 Empty <p> tag in TOC, removed by Sanitizer (T92892)
21199 !! wikitext
21200 __TOC__
21201 == x ==
21202 !! html
21203 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21204 <ul>
21205 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21206 </ul>
21207 </div>
21208
21209 <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>
21210
21211 !! html+tidy
21212 <p></p>
21213 <div id="toc" class="toc">
21214 <div id="toctitle">
21215 <h2>Contents</h2>
21216 </div>
21217 <ul>
21218 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21219 </ul>
21220 </div>
21221 <p></p>
21222 <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>
21223 !! end
21224
21225 !! article
21226 MediaWiki:Bug32057
21227 !! text
21228 == {{int:headline_sample}} ==
21229 !! endarticle
21230
21231 !! test
21232 Bug 32057: Title needed when expanding <h> nodes.
21233 !! options
21234 title=[[Main Page]]
21235 !! wikitext
21236 {{int:Bug32057}}
21237 !! html
21238 <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>
21239
21240 !! end
21241
21242 !! test
21243 Strip marker in urlencode
21244 !! wikitext
21245 {{urlencode:x<nowiki/>y}}
21246 {{urlencode:x<nowiki/>y|wiki}}
21247 {{urlencode:x<nowiki/>y|path}}
21248 {{urlencode:x<pre id="one">two</pre>y}}
21249 !! html
21250 <p>xy
21251 xy
21252 xy
21253 xy
21254 </p>
21255 !! end
21256
21257 !! test
21258 Strip marker in lc
21259 !! wikitext
21260 {{lc:x<nowiki/>y}}
21261 !! html
21262 <p>xy
21263 </p>
21264 !! end
21265
21266 !! test
21267 Strip marker in uc
21268 !! wikitext
21269 {{uc:x<nowiki/>y}}
21270 !! html
21271 <p>XY
21272 </p>
21273 !! end
21274
21275 !! test
21276 Strip marker in formatNum
21277 !! wikitext
21278 {{formatnum:1<nowiki/>2}}
21279 {{formatnum:1<nowiki/>2|R}}
21280 !! html
21281 <p>12
21282 12
21283 </p>
21284 !! end
21285
21286 !! test
21287 Check noCommafy in formatNum
21288 !! options
21289 language=be-tarask
21290 !! wikitext
21291 {{formatnum:123456.78}}
21292 {{formatnum:123456.78|NOSEP}}
21293 !! html
21294 <p>123 456,78
21295 123456.78
21296 </p>
21297 !! end
21298
21299 !! test
21300 Wrong option for formatNum (bug 56199)
21301 !! wikitext
21302 {{formatnum:1,234.56|Random}}
21303 {{formatnum:1,234.56|EVERYTHING}}
21304 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
21305 !! html
21306 <p>1,234.56
21307 1,234.56
21308 1,234.56
21309 </p>
21310 !! end
21311
21312 !! test
21313 Strip marker in grammar
21314 !! options
21315 language=fi
21316 !! wikitext
21317 {{grammar:elative|foo<nowiki/>bar}}
21318 !! html
21319 <p>foobarista
21320 </p>
21321 !! end
21322
21323 !! test
21324 Strip marker in padleft
21325 !! wikitext
21326 {{padleft:|2|x<nowiki/>y}}
21327 !! html
21328 <p>xy
21329 </p>
21330 !! end
21331
21332 !! test
21333 Strip marker in padright
21334 !! wikitext
21335 {{padright:|2|x<nowiki/>y}}
21336 !! html
21337 <p>xy
21338 </p>
21339 !! end
21340
21341 !! test
21342 Strip marker in anchorencode
21343 !! wikitext
21344 {{anchorencode:x<nowiki/>y}}
21345 !! html
21346 <p>xy
21347 </p>
21348 !! end
21349
21350 !! test
21351 nowiki inside link inside heading (bug 18295)
21352 !! wikitext
21353 ==[[foo|x<nowiki>y</nowiki>z]]==
21354 !! html
21355 <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>
21356
21357 !! end
21358
21359 !! test
21360 new support for bdi element (bug 31817)
21361 !! wikitext
21362 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21363 !! html
21364 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21365
21366 !!end
21367
21368 !! test
21369 Ignore pipe between table row attributes
21370 !! wikitext
21371 {|
21372 | quux
21373 |- id=foo | style='color: red'
21374 | bar
21375 |}
21376 !! html
21377 <table>
21378 <tr>
21379 <td> quux
21380 </td></tr>
21381 <tr id="foo" style="color: red">
21382 <td> bar
21383 </td></tr></table>
21384
21385 !! end
21386
21387 !!test
21388 Gallery override link with WikiLink (bug 34852)
21389 !! wikitext
21390 <gallery>
21391 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
21392 </gallery>
21393 !! html
21394 <ul class="gallery mw-gallery-traditional">
21395 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21396 <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>
21397 <div class="gallerytext">
21398 <p>caption
21399 </p>
21400 </div>
21401 </div></li>
21402 </ul>
21403
21404 !! end
21405
21406 !!test
21407 Gallery override link with absolute external link (bug 34852)
21408 !! wikitext
21409 <gallery>
21410 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21411 </gallery>
21412 !! html
21413 <ul class="gallery mw-gallery-traditional">
21414 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21415 <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>
21416 <div class="gallerytext">
21417 <p>caption
21418 </p>
21419 </div>
21420 </div></li>
21421 </ul>
21422
21423 !! end
21424
21425 !!test
21426 Gallery override link with malicious javascript (bug 34852)
21427 !! wikitext
21428 <gallery>
21429 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21430 </gallery>
21431 !! html
21432 <ul class="gallery mw-gallery-traditional">
21433 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21434 <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>
21435 <div class="gallerytext">
21436 <p>caption
21437 </p>
21438 </div>
21439 </div></li>
21440 </ul>
21441
21442 !! end
21443
21444 !!test
21445 Gallery with invalid title as link (bug 43964)
21446 !! wikitext
21447 <gallery>
21448 File:foobar.jpg|link=<
21449 </gallery>
21450 !! html
21451 <ul class="gallery mw-gallery-traditional">
21452 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21453 <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>
21454 <div class="gallerytext">
21455 </div>
21456 </div></li>
21457 </ul>
21458
21459 !! end
21460
21461 !!test
21462 Language parser function
21463 !! wikitext
21464 {{#language:ar}}
21465 !! html
21466 <p>العربية
21467 </p>
21468 !! end
21469
21470 !!test
21471 Padleft and padright as substr
21472 !! wikitext
21473 {{padleft:|3|abcde}}
21474 {{padright:|3|abcde}}
21475 !! html
21476 <p>abc
21477 abc
21478 </p>
21479 !! end
21480
21481 !!test
21482 Special parser function
21483 !! wikitext
21484 {{#special:RandomPage}}
21485 {{#special:BaDtItLe}}
21486 {{#special:Foobar}}
21487 !! html
21488 <p>Special:Random
21489 Special:Badtitle
21490 Special:Foobar
21491 </p>
21492 !! end
21493
21494 !!test
21495 Bug 34939 - Case insensitive link parsing ([HttP://])
21496 !! wikitext
21497 [HttP://MediaWiki.Org/]
21498 !! html/php
21499 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
21500 </p>
21501 !! html/parsoid
21502 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
21503 !! end
21504
21505 !!test
21506 Bug 34939 - Case insensitive link parsing ([HttP:// title])
21507 !! wikitext
21508 [HttP://MediaWiki.Org/ MediaWiki]
21509 !! html
21510 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
21511 </p>
21512 !! end
21513
21514 !!test
21515 Bug 34939 - Case insensitive link parsing (HttP://)
21516 !! wikitext
21517 HttP://MediaWiki.Org/
21518 !! html/php
21519 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
21520 </p>
21521 !! html/parsoid
21522 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
21523 !! end
21524
21525 !!test
21526 Disable TOC
21527 !! options
21528 notoc
21529 !! wikitext
21530 Lead
21531 == Section 1 ==
21532 == Section 2 ==
21533 == Section 3 ==
21534 == Section 4 ==
21535 == Section 5 ==
21536 !! html
21537 <p>Lead
21538 </p>
21539
21540 <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>
21541 <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>
21542 <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>
21543 <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>
21544 <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>
21545
21546 !! end
21547
21548
21549 ###
21550 ### Parsoid-specific tests
21551 ### Parsoid-PHP parser incompatibilities
21552 ###
21553 !!test
21554 1. SOL-sensitive wikitext tokens as template-args
21555 !!options
21556 parsoid=wt2html,wt2wt
21557 !! wikitext
21558 {{echo|*a}}
21559 {{echo|#a}}
21560 {{echo|:a}}
21561 !! html
21562 <span about="#mwt1" typeof="mw:Transclusion">
21563 </span><ul about="#mwt1"><li>a</li>
21564 </ul>
21565 <span about="#mwt2" typeof="mw:Transclusion">
21566 </span><ol about="#mwt2"><li>a</li>
21567 </ol>
21568 <span about="#mwt3" typeof="mw:Transclusion">
21569 </span><dl about="#mwt3"><dd>a</dd>
21570 </dl>
21571 !!end
21572
21573 #### -----------------------------------------------------------------
21574 #### Parsoid-specific functionality tests
21575 #### -----------------------------------------------------------------
21576
21577 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
21578 # We know wt2wt will fail, but we expect selser to pass.
21579 # Due to the nature of our testing, wt2wt and selser tests will enter the
21580 # blacklist and we'll catch selser regressions based on changes to the
21581 # blacklist entries for selser tests.
21582 !! test
21583 1. Bad treebuilder fixup of formatting elt is cleaned up
21584 !! options
21585 parsoid=wt2html,wt2wt
21586 !! wikitext
21587 {|
21588 |
21589 <small>
21590 [[Image:Foobar.jpg|right|Test]]
21591 </small>
21592 |}
21593 !! html/parsoid
21594 <table>
21595 <tbody><tr><td>
21596 <small>
21597 <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>
21598 </small>
21599 </td></tr>
21600 </tbody></table>
21601 !! end
21602
21603 !! test
21604 2. Bad treebuilder fixup of formatting elt is cleaned up
21605 !! options
21606 parsoid=wt2html,wt2wt
21607 !! wikitext
21608 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
21609
21610 <small>[[Image:Foobar.jpg|right|300px]]</small>
21611 !! html/parsoid
21612
21613 <p><b>foo</b></p>
21614 <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>
21615 <p><b>bar</b></p>
21616 <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>
21617 !! end
21618
21619 !! test
21620 3. Bad treebuilder fixup of formatting elt is cleaned up
21621 !! options
21622 parsoid=wt2html,wt2wt
21623 !! wikitext
21624 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
21625 !! html/parsoid
21626 <p><small><b>foo</b></small></p>
21627 <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>
21628 <p><small><b>bar</b></small></p>
21629 !! end
21630
21631 !! test
21632 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
21633 !! options
21634 parsoid=wt2html,wt2wt
21635 !! wikitext
21636 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
21637 !! html/parsoid
21638 <p><b><small></small></b></p>
21639 <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>
21640 <p></p>
21641 !! end
21642
21643 #### ----------------------------------------------------------------
21644 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
21645 #### tags. Parsoid's output for these tags differs from that of the
21646 #### PHP parser.
21647 #### ----------------------------------------------------------------
21648
21649 !!test
21650 Ref: 1. ref-location should be replaced with an index span
21651 !! wikitext
21652 A <ref>foo</ref>
21653 B <ref name="x">foo</ref>
21654 C <ref name="y" />
21655 <references />
21656 !! html/parsoid
21657 <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>
21658 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>
21659 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>
21660 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21661 <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>
21662 <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>
21663 <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>
21664 </ol>
21665 !!end
21666
21667 !!test
21668 Ref: 2. ref-tags with identical names should all get the same index
21669 !! wikitext
21670 A <ref name="x">foo</ref>
21671 B <ref name="x" />
21672 <references />
21673 !! html/parsoid
21674 <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>
21675 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>
21676 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21677 <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>
21678 </ol>
21679 !!end
21680
21681 !!test
21682 Ref: 3. spaces in ref-names should be ignored
21683 !! wikitext
21684 A <ref name="x">foo</ref>
21685 B <ref name=" x " />
21686 C <ref name= x />
21687 <references />
21688 !! html/parsoid
21689 <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>
21690 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>
21691 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>
21692 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21693 <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>
21694 </ol>
21695 !!end
21696
21697 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
21698 !!test
21699 Ref: 4. 'constructor' should be accepted as a valid ref-name
21700 !! wikitext
21701 A <ref name="constructor">foo</ref>
21702 <references />
21703 !! html/parsoid
21704 <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>
21705 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21706 <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>
21707 </ol>
21708 !!end
21709
21710 !!test
21711 Ref: 5. body should accept generic wikitext
21712 !! wikitext
21713 A <ref>
21714 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
21715 </ref>
21716
21717 <references />
21718 !! html/parsoid
21719 <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>
21720
21721 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21722 <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>
21723 </span></li>
21724 </ol>
21725 !!end
21726
21727 !!test
21728 Ref: 6. indent-pres should not be output in ref-body
21729 !! wikitext
21730 A <ref>
21731 foo
21732 bar
21733 baz
21734 </ref>
21735
21736 <references />
21737 !! html/parsoid
21738 <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>
21739
21740 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21741 <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
21742 bar
21743 baz
21744 </span></li>
21745 </ol>
21746 !!end
21747
21748 !!test
21749 Ref: 7. No p-wrapping in ref-body
21750 !! wikitext
21751 A <ref>
21752 foo
21753
21754 bar
21755
21756
21757 baz
21758
21759
21760
21761 booz
21762 </ref>
21763
21764 <references />
21765 !! html/parsoid
21766 <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>
21767
21768 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21769 <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
21770
21771 bar
21772
21773
21774 baz
21775
21776
21777
21778 booz
21779 </span></li>
21780 </ol>
21781 !!end
21782
21783 !!test
21784 Ref: 8. transclusion wikitext has lower precedence
21785 !! wikitext
21786 A <ref> foo {{echo|</ref> B C}}
21787
21788 <references />
21789 !! html/parsoid
21790 <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>
21791 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21792 <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>
21793 </ol>
21794 !!end
21795
21796 !!test
21797 Ref: 9. unclosed comments should not leak out of ref-body
21798 !! wikitext
21799 A <ref> foo <!--</ref> B C
21800 <references />
21801 !! html/parsoid
21802 <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>
21803 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21804 <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>
21805 </ol>
21806 !!end
21807
21808 !!test
21809 Ref: 10. Unclosed HTML tags should not leak out of ref-body
21810 !! wikitext
21811 A <ref> <b> foo </ref> B C
21812
21813 <references />
21814 !! html/parsoid
21815 <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>
21816
21817
21818 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21819 <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>
21820 </ol>
21821 !!end
21822
21823 !!test
21824 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
21825 !! wikitext
21826 A <ref>foo</ref> B
21827 C <ref>bar</ref> D
21828 <references />
21829 !! html/parsoid
21830 <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
21831 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>
21832 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21833 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li>
21834 <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>
21835 </ol>
21836 !!end
21837
21838 !!test
21839 Ref: 12. ref-tags act as trailing newline migration barrier
21840 !! wikitext
21841 <!--the newline at the end of this line moves out of the p tag-->a
21842
21843 b<!--the newline at the end of this line stays inside the p tag--> <ref />
21844 <ref />
21845
21846 c
21847 <references />
21848 !! html/parsoid
21849 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
21850
21851
21852 <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>
21853 <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>
21854
21855 <p>c</p>
21856 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21857 <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>
21858 <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>
21859 !!end
21860
21861 !!test
21862 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
21863 !! wikitext
21864 <ref>foo</ref> A
21865 <ref>bar
21866 </ref> B
21867 <references />
21868 !! html/parsoid
21869 <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
21870 <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>
21871 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21872 <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>
21873 <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
21874 </span></li>
21875 </ol>
21876 !!end
21877
21878 !!test
21879 Ref: 14. A nested ref-tag should be emitted as plain text
21880 !! wikitext
21881 <ref>foo <ref>bar</ref> baz</ref>
21882
21883 <references />
21884 !! html/parsoid
21885 <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>
21886 </p>
21887 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21888 <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>
21889 </ol>
21890 !!end
21891
21892 !!test
21893 Ref: 15. ref-tags with identical names should get identical indexes
21894 !! wikitext
21895 A1 <ref name="a">foo</ref> A2 <ref name="a" />
21896 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
21897
21898 <references />
21899 !! html/parsoid
21900 <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>
21901 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>
21902
21903 <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>
21904 </ol>
21905 !!end
21906
21907 ## We don't bother wt2wt-ing non-standard whitespace
21908 !!test
21909 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
21910 !!options
21911 parsoid=wt2html
21912 !! wikitext
21913 A <ref >foo</ref >
21914
21915 <references />
21916 !! html/parsoid
21917 <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>
21918 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21919 <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>
21920 !!end
21921
21922 !!test
21923 Ref: 17. Generate valid HTML5 id/about attributes
21924 !!wikitext
21925 <ref name="a b">foo</ref>
21926
21927 <references />
21928 !!html/parsoid
21929 <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>
21930 </p>
21931
21932 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21933 <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>
21934 </ol>
21935 !!end
21936
21937 !!test
21938 Ref: 18. T58916: Extension attributes should be parsed as plain text
21939 !!wikitext
21940 <ref name="{{echo|a}}">foo</ref>
21941
21942 <references />
21943 !!html/parsoid
21944 <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>
21945 </p>
21946
21947 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21948 <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>
21949 </ol>
21950 !!end
21951
21952 !!test
21953 Ref: 19. ref-tags with identical name encodings should get identical indexes
21954 !! wikitext
21955 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
21956
21957 <references />
21958 !! html/parsoid
21959 <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>
21960 </p>
21961 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21962 <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>
21963 </ol>
21964 !!end
21965
21966 !!test
21967 Ref: 20. ref-tags with identical names but different content should keep it
21968 !! wikitext
21969 A <ref name="foo">Foo one</ref>
21970 B <ref name="foo">Foo two</ref>
21971 C <ref name="foo" />
21972
21973 <references />
21974 !! html/parsoid
21975 <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>
21976 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>
21977 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>
21978
21979 <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>
21980 </ol>
21981 !!end
21982
21983 !!test
21984 References: 1. references tag without any refs should be handled properly
21985 !! wikitext
21986 <references />
21987 !! html/parsoid
21988 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21989 !!end
21990
21991 !!test
21992 References: 2. references tag with group only outputs references from that group
21993 !! wikitext
21994 A <ref group="a">foo</ref>
21995 B <ref group="b">bar</ref>
21996 C <ref>baz</ref>
21997
21998 <references group="a" />
21999 <references />
22000 <references group="b" />
22001 !! html/parsoid
22002 <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>
22003 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>
22004 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>
22005
22006 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
22007 <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>
22008 </ol>
22009 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
22010 <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>
22011 </ol>
22012 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
22013 <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>
22014 </ol>
22015 !!end
22016
22017 !!test
22018 References: 3. ref list should be cleared after processing references
22019 !! wikitext
22020 A <ref>foo</ref>
22021
22022 <references />
22023
22024 B <ref>bar</ref>
22025
22026 <references />
22027 !! html/parsoid
22028 <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>
22029
22030 <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>
22031 </ol>
22032
22033 <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>
22034
22035 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22036 <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>
22037 </ol>
22038 !!end
22039
22040 !!test
22041 References: 4. only referenced group should be cleared after processing references
22042 !! wikitext
22043 A <ref group="a">afoo</ref>
22044 B <ref>bfoo</ref>
22045
22046 <references group="a" />
22047
22048 C <ref>cfoo</ref>
22049
22050 <references />
22051 !! html/parsoid
22052 <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>
22053 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>
22054
22055 <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>
22056 </ol>
22057
22058 <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>
22059
22060 <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>
22061 </ol>
22062 !!end
22063
22064 ## Don't expect this to rt since we're dropping content
22065 !! test
22066 References: 5. ref tags in references should be processed while ignoring all other content
22067 !! options
22068 parsoid=wt2html,html2html
22069 !! wikitext
22070 A <ref name="a" />
22071 B <ref name="b">bar</ref>
22072
22073 <references>
22074 <ref name="a">foo</ref>
22075 This should just get lost.
22076 </references>
22077 !! html/parsoid
22078 <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>
22079 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>
22080
22081
22082 <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>
22083 </ol>
22084 !! end
22085
22086 !! test
22087 References: 6. <references /> from a transclusion
22088 !! wikitext
22089 <ref>Foo</ref> {{echo|<references />}}
22090 !! html/parsoid
22091 <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>
22092 </ol>
22093 !! end
22094
22095 !! test
22096 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
22097 !! wikitext
22098 A <ref>foo bar for a</ref>
22099 B <ref group="X" name="b" />
22100
22101 <references />
22102
22103 <references group="X">
22104 <ref name="b">foo</ref>
22105 </references>
22106 !! html/parsoid
22107 <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>
22108 B <span about="#mwt4" class="mw-ref" id="cite_ref-b_2-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","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>
22109 </p>
22110
22111 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22112 <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>
22113 </ol>
22114
22115 <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"}}'>
22116 <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>
22117 </ol>
22118 !! end
22119
22120 !! test
22121 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
22122 !! wikitext
22123 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
22124 <references />
22125 !! html/parsoid
22126 <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>
22127 <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>
22128 </ol>
22129 !!end
22130
22131 # This test only works in wt2html now as the <references /> are always generated
22132 # unless selser is active. Once T72722 is fixed, we should add a changes test
22133 # here to ensure that unrelated changes don't add the new <references /> in
22134 # wt2wt.
22135 !! test
22136 References: 9. Generate missing references list at the end
22137 !! wikitext
22138 A <ref>foo</ref>
22139 B <ref group="inexistent">bar</ref>
22140 !! html/parsoid
22141 <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>
22142 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22143 <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>
22144 </ol>
22145 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
22146 <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>
22147 </ol>
22148 !! end
22149
22150 !! test
22151 References: 10. New <references/> shouldn't be added for unrelated edits.
22152 !! options
22153 parsoid={
22154 "modes": ["selser"],
22155 "changes": [["#x", "remove"]],
22156 "selser": "noauto"
22157 }
22158 !! wikitext
22159 Unrelated text<span id="x"> that's going to disappear</span>.
22160 A <ref>foo</ref>
22161 !! wikitext/edited
22162 Unrelated text.
22163 A <ref>foo</ref>
22164 !!end
22165
22166 !! test
22167 Entities in ref name
22168 !! wikitext
22169 <ref name="test &amp; me">hi</ref>
22170 <references />
22171 !! html/parsoid
22172 <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>
22173 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22174 <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>
22175 </ol>
22176 !! end
22177
22178 # This test is wt2html only because we're permitting the serializer to produce
22179 # dirty diffs, normalizing the unclosed references to the self-closed version.
22180 !! test
22181 Generate references for unclosed references tag
22182 !! options
22183 parsoid=wt2html
22184 !! wikitext
22185 a<ref>foo</ref>
22186
22187 <references>
22188 !! html/parsoid
22189 <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>
22190 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22191 <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>
22192 !! end
22193
22194 !! test
22195 New reference serializes on its own line
22196 !! options
22197 parsoid=wt2wt,html2wt
22198 !! wikitext
22199 foo
22200 <references />
22201 !! html/parsoid
22202 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22203 !! end
22204
22205 #### ----------------------------------------------------------------
22206 #### Parsoid-only testing of Parsoid's impl of LST
22207 #### Not implemented yet, see
22208 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
22209 #### ----------------------------------------------------------------
22210
22211 !! test
22212 LST Sections: 1. Simple section start and end
22213 !! options
22214 parsoid={ "suppressErrors": true }
22215 !! wikitext
22216 <section begin="2011-05-16" />
22217 <section end="2014-04-10 (MW 1.23wmf22)" />
22218 !! html/parsoid
22219 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
22220 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
22221 !! end
22222
22223 #--------- Test stripping of empty nodes in template content ----------
22224 !!test
22225 Empty LI and TR nodes should be stripped from template content
22226 !!wikitext
22227 {{EmptyLITest}}
22228 {{EmptyTRTest}}
22229 !!html/parsoid
22230 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
22231 <li>a</li>
22232 <li>b</li>
22233 </ul>
22234 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
22235 <tbody>
22236 <tr>
22237 <td>foo</td>
22238 </tr>
22239 <tr>
22240 <td>bar</td>
22241 </tr>
22242 </tbody>
22243 </table>
22244 !!end
22245
22246 !!test
22247 Empty LI and TR nodes should not be stripped from top-level content
22248 !!wikitext
22249 * a
22250 *
22251 * b
22252 {|
22253 |-
22254 |-
22255 |foo
22256 |}
22257 !!html/parsoid
22258 <ul>
22259 <li> a</li>
22260 <li></li>
22261 <li> b</li>
22262 </ul>
22263 <table>
22264 <tbody>
22265 <tr></tr>
22266 <tr>
22267 <td>foo</td>
22268 </tr>
22269 </tbody>
22270 </table>
22271 !!end
22272
22273 !!test
22274 Empty TR nodes should not be stripped if they have any attributes set
22275 !!wikitext
22276 {{EmptyTRWithHTMLAttrTest}}
22277 !!html/parsoid
22278 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
22279 <tr align="center"></tr>
22280 <tr><td>foo</td></tr>
22281 <tr align="center"></tr>
22282 <tr><td>bar</td></tr>
22283 </table>
22284 !!end
22285
22286 #### ----------------------------------------------------------------
22287 #### The following section of tests are primarily to test
22288 #### wikitext escaping capabilities of Parsoid. Given that
22289 #### escaping can be done any number of ways, the wikitext (input)
22290 #### is always adjusted to reflect how Parsoid adds nowiki
22291 #### escape tags.
22292 ####
22293 #### We are marking several tests as parsoid-only since the
22294 #### HTML in the result section is different from what the
22295 #### PHP parser generates for it.
22296 #### ----------------------------------------------------------------
22297
22298
22299 #### --------------- Headings ---------------
22300 #### 0. Unnested
22301 #### 1. Nested inside html <h1>=foo=</h1>
22302 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
22303 #### 3. Nested inside html with wikitext split by html tags
22304 #### 4. No escape needed
22305 #### 5. Empty headings <h1></h1>
22306 #### 6. Heading chars in SOL context
22307 #### ----------------------------------------
22308 !! test
22309 Headings: 0. Unnested
22310 !! options
22311 parsoid=html2wt
22312 !! html/parsoid
22313 <p>=foo=</p>
22314
22315 <p> =foo=
22316 <!--cmt-->
22317 =foo=</p>
22318
22319 <p>=foo<i>a</i>=</p>
22320 !! wikitext
22321 <nowiki>=foo=</nowiki>
22322
22323 <nowiki> </nowiki>=foo=
22324 <!--cmt-->
22325 <nowiki>=foo=</nowiki>
22326
22327 =foo''a''<nowiki>=</nowiki>
22328 !!end
22329
22330 # New headings and existing headings are handled differently
22331 !! test
22332 Headings: 1. Nested inside html
22333 !! options
22334 parsoid=html2wt
22335 !! html/parsoid
22336 <h1>=foo=</h1>
22337 <h2>=foo=</h2>
22338 <h3>=foo=</h3>
22339
22340 <h1 data-parsoid=''>=foo=</h1>
22341 <h2 data-parsoid=''>=foo=</h2>
22342 <h3 data-parsoid=''>=foo=</h3>
22343 <h4 data-parsoid=''>=foo=</h4>
22344 <h5 data-parsoid=''>=foo=</h5>
22345 <h6 data-parsoid=''>=foo=</h6>
22346 !! wikitext
22347 = =foo= =
22348
22349 == =foo= ==
22350
22351 === =foo= ===
22352
22353 =<nowiki>=foo=</nowiki>=
22354 ==<nowiki>=foo=</nowiki>==
22355 ===<nowiki>=foo=</nowiki>===
22356 ====<nowiki>=foo=</nowiki>====
22357 =====<nowiki>=foo=</nowiki>=====
22358 ======<nowiki>=foo=</nowiki>======
22359
22360 !!end
22361
22362 !! test
22363 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
22364 !! options
22365 parsoid=html2wt
22366 !! html/parsoid
22367 <h1>foo</h1>*bar
22368 <h1>foo</h1>=bar
22369 <h1>foo</h1>=bar=
22370 !! wikitext
22371 = foo =
22372 <nowiki>*</nowiki>bar
22373
22374 = foo =
22375 =bar
22376
22377 = foo =
22378 <nowiki>=bar=</nowiki>
22379 !!end
22380
22381 !! test
22382 Headings: 3. Nested inside html with wikitext split by html tags
22383 !! options
22384 parsoid=html2wt
22385 !! html/parsoid
22386 <h1>=<b>bold</b>foo=</h1>
22387 !! wikitext
22388 = ='''bold'''foo= =
22389 !!end
22390
22391 !! test
22392 Headings: 4a. No escaping needed (testing just h1 and h2)
22393 !! options
22394 parsoid=html2wt
22395 !! html/parsoid
22396 <h1>=foo</h1>
22397 <h1>foo=</h1>
22398 <h1> =foo= </h1>
22399 <h1>=foo= bar</h1>
22400 <h2>=foo</h2>
22401 <h2>foo=</h2>
22402 <h1>=</h1>
22403 <h1><i>=</i>foo=</h1>
22404 !! wikitext
22405 = =foo =
22406
22407 = foo= =
22408
22409 = =foo= =
22410
22411 = =foo= bar =
22412
22413 == =foo ==
22414
22415 == foo= ==
22416
22417 = = =
22418
22419 = ''=''foo= =
22420 !!end
22421
22422 !! test
22423 Headings: 4b. No escaping needed (inside p-tags)
22424 !! options
22425 parsoid=html2wt
22426 !! html/parsoid
22427 <p>===
22428 =foo= x
22429 =foo= <s></s>
22430 </p>
22431 !! wikitext
22432 ===
22433 =foo= x
22434 =foo= <s></s>
22435 !!end
22436
22437 !! test
22438 Headings: 5. Empty headings
22439 !! options
22440 parsoid=html2wt
22441 !! html/parsoid
22442 <h1 data-parsoid='{}'></h1>
22443
22444 <h2 data-parsoid='{}'></h2>
22445
22446 <h3 data-parsoid='{}'></h3>
22447
22448 <h4 data-parsoid='{}'></h4>
22449
22450 <h5 data-parsoid='{}'></h5>
22451
22452 <h6 data-parsoid='{}'></h6>
22453 !! wikitext
22454 =<nowiki/>=
22455
22456 ==<nowiki/>==
22457
22458 ===<nowiki/>===
22459
22460 ====<nowiki/>====
22461
22462 =====<nowiki/>=====
22463
22464 ======<nowiki/>======
22465 !!end
22466
22467 !! test
22468 Headings: 6a. Heading chars in SOL context (with trailing spaces)
22469 !! options
22470 parsoid=html2wt
22471 !! html/parsoid
22472 <p>=a=</p>
22473
22474 <p>=a=</p>
22475
22476 <p>=a=</p>
22477 !! wikitext
22478 <nowiki>=a=</nowiki>
22479
22480 <nowiki>=a=</nowiki>
22481
22482 <nowiki>=a=</nowiki>
22483 !!end
22484
22485 !! test
22486 Headings: 6b. Heading chars in SOL context (with trailing newlines)
22487 !! options
22488 parsoid=html2wt
22489 !! html/parsoid
22490 <p>=a=
22491 b</p>
22492
22493 <p>=a=
22494 b</p>
22495
22496 <p>=a=
22497 b</p>
22498 !! wikitext
22499 <nowiki>=a=</nowiki>
22500 b
22501
22502 <nowiki>=a=</nowiki>
22503 b
22504
22505 <nowiki>=a=</nowiki>
22506 b
22507 !!end
22508
22509 !! test
22510 Headings: 6c. Heading chars in SOL context (leading newline break)
22511 !! options
22512 parsoid=html2wt
22513 !! html/parsoid
22514 <p>a
22515 =b=</p>
22516 !! wikitext
22517 a
22518 <nowiki>=b=</nowiki>
22519 !!end
22520
22521 !! test
22522 Headings: 6d. Heading chars in SOL context (with interspersed comments)
22523 !! options
22524 parsoid=html2wt
22525 !! html/parsoid
22526 <!--c0--><p>=a=</p>
22527
22528 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
22529 !! wikitext
22530 <!--c0--><nowiki>=a=</nowiki>
22531
22532 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
22533 !!end
22534
22535 !! test
22536 Headings: 6d. Heading chars in SOL context (No escaping needed)
22537 !! options
22538 parsoid=html2wt
22539 !! html/parsoid
22540 =a=<div>b</div>
22541 !! wikitext
22542 =a=<div>b</div>
22543 !!end
22544
22545 !! test
22546 Headings: 7. Insert a newline between new content and headings
22547 !! options
22548 parsoid=html2wt
22549 !! html/parsoid
22550 <h2>NEW</h2>
22551 <p>new</p>
22552 <h2 data-parsoid='{}'>A</h2>
22553 <p data-parsoid='{}'>a</p>
22554 !! wikitext
22555 == NEW ==
22556 new
22557
22558 ==A==
22559 a
22560
22561 !! end
22562
22563 #### --------------- Lists ---------------
22564 #### 0. Outside nests (*foo, etc.)
22565 #### 1. Nested inside html <ul><li>*foo</li></ul>
22566 #### 2. Inside definition lists
22567 #### 3. Only bullets at start should be escaped
22568 #### 4. No escapes needed
22569 #### 5. No unnecessary escapes
22570 #### 6. Escape bullets in SOL position
22571 #### 7. Escape bullets in a multi-line context
22572 #### ----------------------------------------
22573
22574 !! test
22575 Lists: 0. Outside nests
22576 !! options
22577 parsoid=html2wt
22578 !! html/parsoid
22579 <p>*foo</p>
22580
22581 <p>#foo</p>
22582
22583 <p>;Foo:bar</p>
22584 !! wikitext
22585 <nowiki>*</nowiki>foo
22586
22587 <nowiki>#</nowiki>foo
22588
22589 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
22590 !!end
22591
22592 ## Making these next 3 tests Parsoid-only since they are html2wt tests
22593 ## to test wikitext escaping, and insignificant whitespace diffs
22594 ## cause PHP parser tests to barf
22595 !! test
22596 Lists: 1. Nested inside html (No unnecessary escapes)
22597 !! options
22598 parsoid=html2wt
22599 !! html/parsoid
22600 <ul>
22601 <li>*foo</li>
22602 <li>#foo</li>
22603 <li>:foo</li>
22604 <li>;foo</li>
22605 <li data-parsoid='{}'>*foo</li>
22606 <li data-parsoid='{}'>#foo</li>
22607 <li data-parsoid='{}'>:foo</li>
22608 <li data-parsoid='{}'>;foo</li>
22609 </ul>
22610
22611 <ol>
22612 <li>*foo</li>
22613 <li>#foo</li>
22614 <li>:foo</li>
22615 <li>;foo</li>
22616 <li data-parsoid='{}'>*foo</li>
22617 <li data-parsoid='{}'>#foo</li>
22618 <li data-parsoid='{}'>:foo</li>
22619 <li data-parsoid='{}'>;foo</li>
22620 </ol>
22621 !! wikitext
22622 * *foo
22623 * #foo
22624 * :foo
22625 * ;foo
22626 *<nowiki>*foo</nowiki>
22627 *<nowiki>#foo</nowiki>
22628 *<nowiki>:foo</nowiki>
22629 *<nowiki>;foo</nowiki>
22630
22631 # *foo
22632 # #foo
22633 # :foo
22634 # ;foo
22635 #<nowiki>*foo</nowiki>
22636 #<nowiki>#foo</nowiki>
22637 #<nowiki>:foo</nowiki>
22638 #<nowiki>;foo</nowiki>
22639 !!end
22640
22641 !! test
22642 Lists: 2. Inside definition lists
22643 !! options
22644 parsoid=html2wt
22645 !! html/parsoid
22646 <dl><dt>;foo</dt></dl>
22647 <dl><dt>:foo</dt></dl>
22648 <dl><dt>:foo</dt>
22649 <dd>bar</dd></dl>
22650 <dl><dd>:foo</dd></dl>
22651 !! wikitext
22652 ; ;foo
22653
22654 ; <nowiki>:foo</nowiki>
22655
22656 ; <nowiki>:foo</nowiki>
22657 : bar
22658
22659 : :foo
22660 !!end
22661
22662 !! test
22663 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
22664 !! options
22665 parsoid=html2wt
22666 !! html/parsoid
22667 <ul>
22668 <li>*foo*bar</li>
22669 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
22670 </ul>
22671 !! wikitext
22672 * *foo*bar
22673 *<nowiki>*foo</nowiki>''it''*bar
22674 !!end
22675
22676 !! test
22677 Lists: 4. No escapes needed
22678 !! options
22679 parsoid=html2wt
22680 !! html/parsoid
22681 <ul>
22682 <li>foo*bar
22683 </li>
22684 </ul>
22685 <ul>
22686 <li><i>foo</i>*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 <ul>
22694 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
22695 </li>
22696 </ul>
22697 !! wikitext
22698 *foo*bar
22699
22700 *''foo''*bar
22701
22702 *[[Foo]]: bar
22703
22704 *[[Foo]]*bar
22705 !!end
22706
22707 !! test
22708 Lists: 5. No unnecessary escapes
22709 !! options
22710 parsoid=html2wt
22711 !! html/parsoid
22712 <ul><li> bar <span>[[foo]]</span></li></ul>
22713 <ul><li> =bar <span>[[foo]]</span></li></ul>
22714 <ul><li> [[bar <span>[[foo]]</span></li></ul>
22715 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
22716 <ul><li> =bar <span>foo]]</span>=</li></ul>
22717 <ul><li> <s></s>: a</li></ul>
22718 <ul><li> <i>* foo</i></li></ul>
22719
22720 !! wikitext
22721 * bar <span><nowiki>[[foo]]</nowiki></span>
22722
22723 * =bar <span><nowiki>[[foo]]</nowiki></span>
22724
22725 * [[bar <span><nowiki>[[foo]]</nowiki></span>
22726
22727 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
22728
22729 * =bar <span>foo]]</span>=
22730
22731 * <s></s>: a
22732
22733 * ''* foo''
22734 !!end
22735
22736 !! test
22737 Lists: 6. Escape bullets in SOL position
22738 !! options
22739 parsoid=html2wt
22740 !! html/parsoid
22741 <p><!--cmt-->*foo</p>
22742 !! wikitext
22743 <!--cmt--><nowiki>*</nowiki>foo
22744 !!end
22745
22746 !! test
22747 Lists: 7. Escape bullets in a multi-line context
22748 !! options
22749 parsoid=html2wt
22750 !! html/parsoid
22751 <p>a
22752 *b
22753 </p>
22754 !! wikitext
22755 a
22756 <nowiki>*</nowiki>b
22757 !!end
22758
22759 !! test
22760 Lists: 8. Escape colons only if not present in tags
22761 !! options
22762 parsoid=html2wt
22763 !! html/parsoid
22764 <dl><dt>a:b<i>c:d</i></dt></dl>
22765 !! wikitext
22766 ; <nowiki>a:b</nowiki>''c:d''
22767 !! end
22768
22769 #### --------------- HRs ---------------
22770 #### 1. Single line
22771 #### -----------------------------------
22772
22773 !! test
22774 HRs: 1. Single line
22775 !! options
22776 parsoid=html2wt
22777 !! html/parsoid
22778 <hr />----
22779 <hr />=foo=
22780 <hr />*foo
22781 !! wikitext
22782 ----<nowiki>----</nowiki>
22783 ----=foo=
22784 ----*foo
22785 !! end
22786
22787 #### --------------- Tables ---------------
22788 #### 1a. Simple example
22789 #### 1b. No escaping needed (!foo)
22790 #### 1c. No escaping needed (|foo)
22791 #### 1d. No escaping needed (|}foo)
22792 ####
22793 #### 2a. Nested in td (<td>foo|bar</td>)
22794 #### 2b. Nested in td (<td>foo||bar</td>)
22795 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
22796 ####
22797 #### 3a. Nested in th (<th>foo!bar</th>)
22798 #### 3b. Nested in th (<th>foo!!bar</th>)
22799 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
22800 ####
22801 #### 4a. Escape -
22802 #### 4b. Escape +
22803 #### 4c. No escaping needed
22804 #### --------------------------------------
22805
22806 !! test
22807 Tables: 1a. Simple example
22808 !! options
22809 parsoid=html2wt
22810 !! html/parsoid
22811 <p>{|
22812 |}
22813 </p>
22814 !! wikitext
22815 <nowiki>{|</nowiki>
22816 |}
22817 !! end
22818
22819 !! test
22820 Tables: 1b. No escaping needed
22821 !! options
22822 parsoid=html2wt
22823 !! html/parsoid
22824 <p>!foo
22825 </p>
22826 !! wikitext
22827 !foo
22828 !! end
22829
22830 !! test
22831 Tables: 1c. No escaping needed
22832 !! options
22833 parsoid=html2wt
22834 !! html/parsoid
22835 <p>|foo
22836 </p>
22837 !! wikitext
22838 |foo
22839 !! end
22840
22841 !! test
22842 Tables: 1d. No escaping needed
22843 !! options
22844 parsoid=html2wt
22845 !! html/parsoid
22846 <p>|}foo
22847 </p>
22848 !! wikitext
22849 |}foo
22850 !! end
22851
22852 !! test
22853 Tables: 2a. Nested in td
22854 !! options
22855 parsoid=html2wt
22856 !! html/parsoid
22857 <table><tbody><tr>
22858 <td>foo|bar</td></tr>
22859 <tr><td>x<div>a|b</div></td>
22860 </tbody></table>
22861 !! wikitext
22862 {|
22863 |<nowiki>foo|bar</nowiki>
22864 |-
22865 |x<div><nowiki>a|b</nowiki></div>
22866 |}
22867 !! html/php+tidy
22868 <table>
22869 <tr>
22870 <td>foo|bar</td>
22871 </tr>
22872 <tr>
22873 <td>x
22874 <div>a|b</div>
22875 </td>
22876 </tr>
22877 </table>
22878 !! end
22879
22880 !! test
22881 Tables: 2b. Nested in td
22882 !! options
22883 parsoid=html2wt
22884 !! html/parsoid
22885 <table><tbody><tr>
22886 <td>foo||bar</td>
22887 <td>a<i>b||c</i></td>
22888 <td>a<i><div>b||c</div></i></td>
22889 </tr></tbody></table>
22890 !! wikitext
22891 {|
22892 |<nowiki>foo||bar</nowiki>
22893 |a''<nowiki>b||c</nowiki>''
22894 |a''<div><nowiki>b||c</nowiki></div>''
22895 |}
22896 !! html/php
22897 <table>
22898 <tr>
22899 <td>foo||bar
22900 </td>
22901 <td>a<i>b||c</i>
22902 </td>
22903 <td>a<i><div>b||c</div></i>
22904 </td></tr></table>
22905
22906 !! end
22907
22908 !! test
22909 Tables: 2c. Nested in td -- no escaping needed
22910 !! options
22911 parsoid=html2wt
22912 !! html/*
22913 <table>
22914
22915 <tr>
22916 <td>foo!!bar
22917 </td></tr></table>
22918
22919 !! wikitext
22920 {|
22921
22922 |foo!!bar
22923 |}
22924 !! end
22925
22926 !! test
22927 Tables: 3a. Nested in th
22928 !! options
22929 parsoid=html2wt
22930 !! html/*
22931 <table>
22932
22933 <tr>
22934 <th>foo!bar
22935 </th></tr></table>
22936
22937 !! wikitext
22938 {|
22939
22940 !foo!bar
22941 |}
22942 !! end
22943
22944 !! test
22945 Tables: 3b. Nested in th
22946 !! options
22947 parsoid=html2wt
22948 !! html/parsoid
22949 <table><tbody>
22950 <tr><th>foo!!bar</th>
22951 <th><i>foo|bar</i></th>
22952 <th><i>foo!!bar</i></th>
22953 <th><i><span>foo!!bar</span></i></th>
22954 </tr></tbody></table>
22955 !! wikitext
22956 {|
22957 !<nowiki>foo!!bar</nowiki>
22958 !''<nowiki>foo|bar</nowiki>''
22959 !''<nowiki>foo!!bar</nowiki>''
22960 !''<span><nowiki>foo!!bar</nowiki></span>''
22961 |}
22962 !! html/php
22963 <table>
22964 <tr>
22965 <th>foo!!bar
22966 </th>
22967 <th><i>foo|bar</i>
22968 </th>
22969 <th><i>foo!!bar</i>
22970 </th>
22971 <th><i><span>foo!!bar</span></i>
22972 </th></tr></table>
22973
22974 !! end
22975
22976 !! test
22977 Tables: 3c. Nested in th
22978 !! options
22979 parsoid=html2wt
22980 !! html/parsoid
22981 <table><tbody>
22982 <tr><th>foo||bar</th>
22983 <th><span typeof="mw:Nowiki">foo||bar</span></th>
22984 </tr></tbody></table>
22985 !! wikitext
22986 {|
22987 !<nowiki>foo||bar</nowiki>
22988 !<nowiki>foo||bar</nowiki>
22989 |}
22990 !! html/php
22991 <table>
22992 <tr>
22993 <th>foo||bar
22994 </th>
22995 <th>foo||bar
22996 </th></tr></table>
22997
22998 !! end
22999
23000 !! test
23001 Tables: 4a. Escape -
23002 !! options
23003 parsoid=html2wt
23004 !! html/*
23005 <table>
23006
23007 <tr>
23008 <th>-bar
23009 </th></tr>
23010 <tr>
23011 <td>-bar
23012 </td></tr></table>
23013
23014 !! wikitext
23015 {|
23016
23017 !-bar
23018
23019 |-
23020 |<nowiki>-bar</nowiki>
23021 |}
23022 !! end
23023
23024 !! test
23025 Tables: 4b. Escape +
23026 !! options
23027 parsoid=html2wt
23028 !! html/*
23029 <table>
23030
23031 <tr>
23032 <th>+bar
23033 </th></tr>
23034 <tr>
23035 <td>+bar
23036 </td></tr></table>
23037
23038 !! wikitext
23039 {|
23040
23041 !+bar
23042
23043 |-
23044 |<nowiki>+bar</nowiki>
23045 |}
23046 !! end
23047
23048 !! test
23049 Tables: 4c. No escaping needed
23050 !! options
23051 parsoid=html2wt
23052 !! html/parsoid
23053 <table><tbody>
23054 <tr><td>foo-bar</td><td>foo+bar</td></tr>
23055 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
23056 <tr><td>foo
23057 <p>bar|baz
23058 +bar
23059 -bar</p></td></tr>
23060 <tr><td>x
23061 <div>a|b</div></td>
23062 </tbody></table>
23063 !! wikitext
23064 {|
23065 |foo-bar
23066 |foo+bar
23067 |-
23068 |''foo''-bar
23069 |''foo''+bar
23070 |-
23071 |foo
23072 bar|baz
23073 +bar
23074 -bar
23075 |-
23076 |x
23077 <div>a|b</div>
23078 |}
23079 !! html/php
23080 <table>
23081 <tr>
23082 <td>foo-bar
23083 </td>
23084 <td>foo+bar
23085 </td></tr>
23086 <tr>
23087 <td><i>foo</i>-bar
23088 </td>
23089 <td><i>foo</i>+bar
23090 </td></tr>
23091 <tr>
23092 <td>foo
23093 <p>bar|baz
23094 +bar
23095 -bar
23096 </p>
23097 </td></tr>
23098 <tr>
23099 <td>x
23100 <div>a|b</div>
23101 </td></tr></table>
23102
23103 !! end
23104
23105 !! test
23106 Tables: 4d. No escaping needed
23107 !! options
23108 parsoid=html2wt
23109 !! html/parsoid
23110 <table>
23111 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
23112 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
23113 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
23114 </tbody></table>
23115 !! wikitext
23116 {|
23117 |[[Foo]]-bar
23118 ||+1
23119 ||-2
23120 |}
23121 !! html/php
23122 <table>
23123 <tr>
23124 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
23125 </td>
23126 <td>+1
23127 </td>
23128 <td>-2
23129 </td></tr></table>
23130
23131 !! end
23132
23133 !! test
23134 T97430: Don't emit empty nowiki pairs around marker meta tags
23135 !! options
23136 parsoid=html2wt
23137 !! html/parsoid
23138 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23139 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
23140 !! wikitext
23141 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23142 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
23143 !! end
23144
23145 !! test
23146 Unclosed xmlish element in table line shouldn't eat end delimiters
23147 !! options
23148 parsoid=html2wt
23149 !! html/parsoid
23150 <table>
23151 <tbody><tr><td> &lt;foo</td>
23152 <td> bar></td></tr>
23153 </tbody></table>
23154 !! wikitext
23155 {|
23156 | <foo
23157 | bar>
23158 |}
23159 !! html/php
23160 <table>
23161 <tr>
23162 <td> &lt;foo
23163 </td>
23164 <td> bar&gt;
23165 </td></tr></table>
23166
23167 !! end
23168
23169 #### --------------- Links ----------------
23170 #### 1. Quote marks in link text
23171 #### 2. Wikilinks: Escapes needed
23172 #### 3. Wikilinks: No escapes needed
23173 #### 4. Extlinks: Escapes needed
23174 #### 5. Extlinks: No escapes needed
23175 #### --------------------------------------
23176 !! test
23177 Links 1. WikiLinks: No escapes needed
23178 !! options
23179 parsoid=html2wt
23180 !! html/parsoid
23181 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
23182 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
23183 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
23184 !! wikitext
23185 [[Foo|Foo''boo'']]
23186 [[Foo|[Foobar]]]
23187 [[Foo|x [Foobar] x]]
23188 !! html/php
23189 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
23190 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
23191 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
23192 </p>
23193 !! end
23194
23195 !! test
23196 Links 2. WikiLinks: Escapes needed
23197 !! options
23198 parsoid=html2wt
23199 !! html/parsoid
23200 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
23201 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
23202 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
23203 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
23204 <a href="Foo" rel="mw:WikiLink">|Bar</a>
23205 <a href="Foo" rel="mw:WikiLink">]]bar</a>
23206 <a href="Foo" rel="mw:WikiLink">[[bar</a>
23207 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
23208 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
23209 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
23210 !! wikitext
23211 [[Foo|<nowiki>Foobar]</nowiki>]]
23212 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
23213 [[Foo|<nowiki>[[Bar]]</nowiki>]]
23214 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
23215 [[Foo|<nowiki>|Bar</nowiki>]]
23216 [[Foo|<nowiki>]]bar</nowiki>]]
23217 [[Foo|<nowiki>[[bar</nowiki>]]
23218 [[Foo|<nowiki>x [[ y</nowiki>]]
23219 [[Foo|<nowiki>x ]] y</nowiki>]]
23220 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
23221 !! html/php
23222 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
23223 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
23224 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
23225 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
23226 <a href="/wiki/Foo" title="Foo">|Bar</a>
23227 <a href="/wiki/Foo" title="Foo">]]bar</a>
23228 <a href="/wiki/Foo" title="Foo">[[bar</a>
23229 <a href="/wiki/Foo" title="Foo">x [[ y</a>
23230 <a href="/wiki/Foo" title="Foo">x ]] y</a>
23231 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
23232 </p>
23233 !! end
23234
23235 !! test
23236 Links 3. WikiLinks: No escapes needed
23237 !! options
23238 parsoid=html2wt
23239 !! html/parsoid
23240 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
23241 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
23242 !! wikitext
23243 [[Foo|[Foobar]]
23244 [[Foo|foo|bar]]
23245 !! html/php
23246 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
23247 <a href="/wiki/Foo" title="Foo">foo|bar</a>
23248 </p>
23249 !! end
23250
23251 !! test
23252 Links 4. ExtLinks: Escapes needed
23253 !! options
23254 parsoid=html2wt
23255 !! html/parsoid
23256 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
23257 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
23258 <p>[http://google.com]</p>
23259 <p>[http://google.com google]</p>
23260 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
23261 <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>
23262 !! wikitext
23263 [http://google.com <nowiki>[google]</nowiki>]
23264 [http://google.com <nowiki>google]</nowiki>]
23265
23266 <nowiki>[http://google.com]</nowiki>
23267
23268 <nowiki>[http://google.com google]</nowiki>
23269
23270 [http://google.com<nowiki>]</nowiki>
23271
23272 [{{echo|http://google.com}}<nowiki>]</nowiki>
23273 !! html/php
23274 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
23275 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
23276 </p><p>[http://google.com]
23277 </p><p>[http://google.com google]
23278 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23279 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23280 </p>
23281 !! end
23282
23283 !! test
23284 Links 5. ExtLinks: No escapes needed
23285 !! options
23286 parsoid=html2wt
23287 !! html/parsoid
23288 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
23289 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
23290 !! wikitext
23291 [http://google.com [google]
23292
23293 [[http://google.com]]
23294 !! html/php
23295 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
23296 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
23297 </p>
23298 !! end
23299
23300 !! test
23301 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
23302 !! options
23303 parsoid=html2wt
23304 !! html/parsoid
23305 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
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>&amp;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" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23314 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
23315 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
23316 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
23317 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
23318 </p>
23319 !! wikitext
23320 x<nowiki/>http://example.com<nowiki/>y
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<nowiki/>;x
23329 http://example.com<nowiki/>!x
23330 http://example.com<nowiki/>=x
23331 http://example.com<nowiki/>(x)
23332 http://example.com(x<nowiki/>)
23333 !! end
23334
23335 !! test
23336 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23337 !! options
23338 parsoid=html2wt
23339 !! html/parsoid
23340 <p>x
23341 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
23342 y
23343 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
23344 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
23345 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
23346 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
23347 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
23348 </p>
23349 !! wikitext
23350 x
23351 http://example.com
23352 y
23353 "http://example.com"
23354 (http://example.com)
23355 (http://example.com) foo
23356 http://example.com,
23357 http://example.com, foo
23358 !! html/php
23359 <p>x
23360 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
23361 y
23362 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
23363 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
23364 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
23365 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
23366 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
23367 </p>
23368 !! end
23369
23370 !! test
23371 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23372 !! options
23373 parsoid=html2wt
23374 !! html/parsoid
23375 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
23376 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
23377 !! wikitext
23378 http://example.com.,;:!?\
23379 -http://example.com:
23380 !! html/php
23381 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
23382 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
23383 </p>
23384 !! end
23385
23386 !! test
23387 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
23388 !! options
23389 parsoid=html2wt
23390 !! html/parsoid
23391 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
23392 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
23393 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
23394 !! wikitext
23395 RFC 123<nowiki/>4
23396 RFC 123<nowiki/>y
23397 X<nowiki/>RFC 123<nowiki/>y
23398 !! end
23399
23400 !! test
23401 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
23402 !! options
23403 parsoid=html2wt
23404 !! html/parsoid
23405 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
23406 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
23407 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
23408 </p>
23409 !! wikitext
23410 RFC 123?foo
23411 RFC 123&foo
23412 -RFC 123-
23413 !! html/php
23414 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
23415 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
23416 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
23417 </p>
23418 !! end
23419
23420 !! test
23421 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
23422 !! options
23423 parsoid=html2wt
23424 !! html/parsoid
23425 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
23426 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23427 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23428 !! wikitext
23429 PMID 123<nowiki/>4
23430 PMID 123<nowiki/>y
23431 X<nowiki/>PMID 123<nowiki/>y
23432 !! end
23433
23434 !! test
23435 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
23436 !! options
23437 parsoid=html2wt
23438 !! html/parsoid
23439 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
23440 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
23441 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
23442 </p>
23443 !! wikitext
23444 PMID 123?foo
23445 PMID 123&foo
23446 -PMID 123-
23447 !! html/php
23448 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
23449 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
23450 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
23451 </p>
23452 !! end
23453
23454 !! test
23455 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
23456 !! options
23457 parsoid=html2wt
23458 !! html/parsoid
23459 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
23460 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
23461 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
23462 </p>
23463 !! wikitext
23464 ISBN 1234567890<nowiki/>1
23465 ISBN 1234567890<nowiki/>x
23466 a<nowiki/>ISBN 1234567890<nowiki/>b
23467 !! end
23468
23469 !! test
23470 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
23471 !! options
23472 parsoid=html2wt
23473 !! html/parsoid
23474 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
23475 !! wikitext
23476 -ISBN 1234567890's
23477 !! html/php
23478 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
23479 </p>
23480 !! end
23481
23482 !! test
23483 Links 14. Protect link-like plain text. (Parsoid bug T78425)
23484 !! options
23485 parsoid=html2wt
23486 !! html/*
23487 <p>this is not a link: http://example.com
23488 </p>
23489 !! wikitext
23490 this is not a link: <nowiki>http://example.com</nowiki>
23491 !! end
23492
23493 !! test
23494 Links 15. Link trails can't become link prefixes.
23495 !! options
23496 language=is
23497 parsoid=html2wt
23498 !! html/parsoid
23499 <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>
23500 !! wikitext
23501 [[Söfnuður]]-[[00]]
23502 !! html/php
23503 <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>
23504 </p>
23505 !! end
23506
23507 #### --------------- Quotes ---------------
23508 #### 1. Quotes inside <b> and <i>
23509 #### 2. Link fragments separated by <i> and <b> tags
23510 #### 3. Link fragments inside <i> and <b>
23511 #### 4. No escaping needed
23512 #### --------------------------------------
23513 !! test
23514 1a. Quotes inside <b> and <i>
23515 !! options
23516 parsoid=html2wt
23517 !! html/*
23518 <p><i>'foo'</i>
23519 <i>''foo''</i>
23520 <i>'''foo'''</i>
23521 <i>foo</i>'s
23522 <b>'foo'</b>
23523 <b>''foo''</b>
23524 <b>'''foo'''</b>
23525 <b>foo'<i>bar'</i>baz</b>
23526 <b>foo</b>'s
23527 '<i>foo</i>
23528 <i>foo</i>'
23529 <i>foo'</i>'
23530 '<i>foo</i>'
23531 '<b>foo</b>
23532 <b>foo</b>'
23533 '<b>foo</b>'
23534 <i>fools'<span> errand</span></i>
23535 <i><span>fool</span>'s errand</i>
23536 '<i>foo</i> bar '<i>baz</i>
23537 a|!*#-:;+-~[]{}b'<i>x</i>
23538 </p>
23539 !! wikitext
23540 ''<nowiki/>'foo'''
23541 ''<nowiki>''foo''</nowiki>''
23542 ''<nowiki>'''foo'''</nowiki>''
23543 ''foo''<nowiki/>'s
23544 '''<nowiki/>'foo''''
23545 '''<nowiki>''foo''</nowiki>'''
23546 '''<nowiki>'''foo'''</nowiki>'''
23547 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
23548 '''foo'''<nowiki/>'s
23549 '''foo''
23550 ''foo''<nowiki/>'
23551 ''foo'''<nowiki/>'
23552 '''foo''<nowiki/>'
23553 ''''foo'''
23554 '''foo'''<nowiki/>'
23555 ''''foo'''<nowiki/>'
23556 ''fools'<span> errand</span>''
23557 ''<span>fool</span>'s errand''
23558 '<nowiki/>''foo'' bar '''baz''
23559 a|!*#-:;+-~[]{}b'''x''
23560 !! end
23561
23562 !! test
23563 1b. Quotes inside <b> and <i> with other tags on same line
23564 !! options
23565 parsoid=html2wt
23566 !! html/parsoid
23567 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23568 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23569 <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>
23570 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
23571 '<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>
23572 '<i>foo</i> <div title="name">test</div>
23573 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
23574 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
23575 <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>
23576 </ol>
23577 !! wikitext
23578 '''a'' foo ''[[bar]]''
23579 ''a''' foo ''[[bar]]''
23580 ''a''' foo '''{{echo|[[bar]]}}'''
23581 [[foo]] x'''[[bar]]''
23582 '''foo'' <ref>test</ref>
23583 '''foo'' <div title="name">test</div>
23584 '''foo'' and <br> bar
23585 <references />
23586 !! end
23587
23588 !! test
23589 2. Link fragments separated by <i> and <b> tags
23590 !! options
23591 parsoid=html2wt
23592 !! html/parsoid
23593 <p>[[<i>foo</i>hello]]</p>
23594 <p>[[<b>foo</b>hello]]</p>
23595 !! wikitext
23596 [[''foo''<nowiki>hello]]</nowiki>
23597
23598 [['''foo'''<nowiki>hello]]</nowiki>
23599 !! end
23600
23601 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
23602 # this is one of the shortcomings of this format
23603 !! test
23604 3. Link fragments inside <i> and <b>
23605 !! options
23606 parsoid=html2wt
23607 !! html/parsoid
23608 <p><i>[[foo</i>]]</p>
23609 <p><b>[[foo</b>]]</p>
23610 !! wikitext
23611 ''[[foo''<nowiki>]]</nowiki>
23612
23613 '''[[foo'''<nowiki>]]</nowiki>
23614 !! end
23615
23616 !! test
23617 4. No escaping needed
23618 !! options
23619 options=html2wt
23620 !! html/parsoid
23621 <p>'<span><i>bar</i></span>'
23622 '<span><b>bar</b></span>'
23623 'a:b'foo
23624 </p>
23625 !! wikitext
23626 '<span>''bar''</span>'
23627 '<span>'''bar'''</span>'
23628 'a:b'foo
23629 !! end
23630
23631 #### ----------- Paragraphs ---------------
23632 #### 1. No unnecessary escapes
23633 #### --------------------------------------
23634
23635 !! test
23636 1. No unnecessary escapes
23637 !! options
23638 parsoid=html2wt
23639 !! html/parsoid
23640 <p>bar <span>[[foo]]</span>
23641 </p><p>=bar <span>[[foo]]</span>
23642 </p><p>[[bar <span>[[foo]]</span>
23643 </p><p>]]bar <span>[[foo]]</span>
23644 </p><p>=bar <span>foo]]</span>=
23645 </p>
23646 !! wikitext
23647 bar <span><nowiki>[[foo]]</nowiki></span>
23648
23649 =bar <span><nowiki>[[foo]]</nowiki></span>
23650
23651 [[bar <span><nowiki>[[foo]]</nowiki></span>
23652
23653 ]]bar <span><nowiki>[[foo]]</nowiki></span>
23654
23655 =bar <span>foo]]</span><nowiki>=</nowiki>
23656 !!end
23657
23658 #### ----------------------- PRE --------------------------
23659 #### 1. Leading whitespace in SOL context should be escaped
23660 #### ------------------------------------------------------
23661 !! test
23662 1. Leading whitespace in SOL context should be escaped
23663 !! options
23664 parsoid=html2wt
23665 !! html/parsoid
23666 <p> a</p>
23667
23668 <p> a</p>
23669
23670 <p> a(tab)</p>
23671
23672 <p> a
23673 <!--cmt-->
23674 a</p>
23675
23676 <p>a
23677 b</p>
23678
23679 <p>a
23680 b</p>
23681
23682 <p>a
23683 b</p>
23684 !! wikitext
23685 <nowiki> </nowiki>a
23686
23687 <nowiki> </nowiki> a
23688
23689 a(tab)
23690
23691 <nowiki> </nowiki> a
23692 <!--cmt-->
23693 <nowiki> </nowiki>a
23694
23695 a
23696 <nowiki> </nowiki>b
23697
23698 a
23699 b
23700
23701 a
23702 b
23703 !! html/php
23704 <p> a
23705 </p><p> a
23706 </p><p> a(tab)
23707 </p><p> a
23708 a
23709 </p><p>a
23710 b
23711 </p><p>a
23712 b
23713 </p><p>a
23714 b
23715 </p>
23716 !! end
23717
23718 !! test
23719 2. Leading whitespace in non-indent-pre contexts should not be escaped
23720 !! options
23721 parsoid=htm2wt
23722 !! html/parsoid
23723 <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>
23724 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23725 <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>
23726 b</span></li>
23727 </ol>
23728 !! wikitext
23729 foo <ref>''a''
23730 b</ref>
23731 <references />
23732 !! end
23733
23734 !! test
23735 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
23736 !! options
23737 parsoid=html2wt
23738 !! html/parsoid
23739 <blockquote>
23740 <p>
23741 a
23742 <span>b</span>
23743 c</p>
23744 </blockquote>
23745 !! wikitext
23746 <blockquote>
23747 a
23748 <span>b</span>
23749 c
23750 </blockquote>
23751 !! end
23752
23753 !! test
23754 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
23755 !! options
23756 options=html2wt
23757 !! html/parsoid
23758 <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>
23759 !! wikitext
23760 [[File:Foobar.jpg|thumb|caption]]
23761 !! end
23762
23763 !! test
23764 5. Nowiki escaping should account for indent-pres
23765 !! options
23766 parsoid=html2wt
23767 !! html/parsoid
23768 <pre>==foo==</pre>
23769 !! wikitext
23770 ==foo==
23771 !! end
23772
23773 !!test
23774 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
23775 !! options
23776 parsoid=html2wt
23777 !! html/parsoid
23778 <pre>
23779 * foo
23780 * bar
23781 </pre>
23782 !! wikitext
23783 * foo
23784 * bar
23785 !! end
23786
23787 #### --------------- Behavior Switches --------------------
23788
23789 !! test
23790 1. Valid behavior switches should be escaped
23791 !! options
23792 parsoid=html2wt
23793 !! html/parsoid
23794 __TOC__
23795 <i>__TOC__</i>
23796 !! wikitext
23797 <nowiki>__TOC__</nowiki>
23798 ''<nowiki>__TOC__</nowiki>''
23799 !! end
23800
23801 !! test
23802 2. Invalid behavior switches should not be escaped
23803 !! options
23804 parsoid=html2wt
23805 !! html/parsoid
23806 __TOO__
23807 __|__
23808 !! wikitext
23809 __TOO__
23810 __|__
23811 !! end
23812
23813 # We use indent-pre as an indirect way to test for sol-transparent behavior.
23814 !! test
23815 Behavior switches should be SOL-transparent
23816 !! options
23817 parsoid=html2wt
23818 !! html/parsoid
23819 <meta property="mw:PageProp/toc" />
23820
23821 <!-- this one's bogus -->
23822 <pre>__TOO__</pre>
23823
23824 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
23825
23826 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
23827 !! wikitext
23828 __TOC__
23829
23830 <!-- this one's bogus -->
23831 __TOO__
23832
23833 __TOC__ foo
23834
23835 __TOC__
23836 bar
23837 !! end
23838
23839 #### --------------- HTML tags ---------------
23840 #### 1. a tags
23841 #### 2. other tags
23842 #### 3. multi-line html tag
23843 #### 4. extension tags
23844 #### -----------------------------------------
23845 !! test
23846 1. a tags
23847 !! options
23848 parsoid=html2wt
23849 !! html/parsoid
23850 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
23851 !! wikitext
23852 <a href="http://google.com">google</a>
23853 !! end
23854
23855 !! test
23856 2. other tags
23857 !! options
23858 parsoid=html2wt
23859 !! html/parsoid
23860 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
23861 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
23862 <li> &lt;td&gt;</li></ul>
23863
23864 !! wikitext
23865 * <nowiki><div>foo</div></nowiki>
23866 * <nowiki><div style="color:red">foo</div></nowiki>
23867 * <nowiki><td></nowiki>
23868 !! end
23869
23870 !! test
23871 3. multi-line html tag
23872 !! options
23873 parsoid=html2wt
23874 !! html/parsoid
23875 <p>&lt;div
23876 &gt;foo&lt;/div
23877 &gt;
23878 </p>
23879 !! wikitext
23880 <nowiki><div
23881 >foo</div
23882 ></nowiki>
23883 !! end
23884
23885 !! test
23886 4. extension tags
23887 !! options
23888 parsoid=html2wt
23889 !! html/parsoid
23890 <p>&lt;ref&gt;foo&lt;/ref&gt;
23891 </p><p>&lt;ref&gt;bar
23892 </p><p>baz&lt;/ref&gt;
23893 </p>
23894 !! wikitext
23895 <nowiki><ref>foo</ref></nowiki>
23896
23897 <nowiki><ref>bar</nowiki>
23898
23899 baz<nowiki></ref></nowiki>
23900 !! end
23901
23902 #### --------------- Others ---------------
23903 !! test
23904 Escaping nowikis
23905 !! options
23906 parsoid=html2wt
23907 !! html/parsoid
23908 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
23909 </p>
23910 !! wikitext
23911 &lt;nowiki&gt;foo&lt;/nowiki&gt;
23912 !! end
23913
23914 ## The quote-char in the input is necessary for triggering the bug
23915 !! test
23916 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
23917 !! options
23918 parsoid=html2wt
23919 !! html/parsoid
23920 <p>foo's bar :</p>
23921 !! wikitext
23922 foo's bar :
23923 !! end
23924
23925 #----------- End of wikitext escaping tests --------------
23926
23927 !! test
23928
23929 Tag-like HTML structures are passed through as text
23930 !! wikitext
23931 <x y>
23932
23933 <x.y>
23934
23935 <x-y>
23936
23937 1>2
23938
23939 x<y
23940
23941 a>b
23942
23943 1<d e>f
23944 !! html
23945 <p>&lt;x y&gt;
23946 </p><p>&lt;x.y&gt;
23947 </p><p>&lt;x-y&gt;
23948 </p><p>1&gt;2
23949 </p><p>x&lt;y
23950 </p><p>a&gt;b
23951 </p><p>1&lt;d e&gt;f
23952 </p>
23953 !! end
23954
23955 !! test
23956 HTML tag with necessary entities in attributes
23957 !! wikitext
23958 <span title="&amp;amp;">foo</span>
23959 !! html
23960 <p><span title="&amp;amp;">foo</span>
23961 </p>
23962 !! end
23963
23964 !! test
23965 HTML tag with 'unnecessary' entity encoding in attributes
23966 !! wikitext
23967 <span title="&amp;">foo</span>
23968 !! html
23969 <p><span title="&amp;">foo</span>
23970 </p>
23971 !! end
23972
23973 !! test
23974 HTML tag with broken attribute value quoting
23975 !! options
23976 parsoid=wt2html,html2html
23977 !! wikitext
23978 <span title="Hello world>Foo</span>
23979 !! html/php
23980 <p><span title="Hello world">Foo</span>
23981 </p>
23982 !! html/parsoid
23983 <p><span title="Hello world">Foo</span></p>
23984 !! end
23985
23986 !! test
23987 Self-closed tag with broken attribute value quoting
23988 !! options
23989 parsoid=wt2html,html2html
23990 !! wikitext
23991 <div title="Hello world />Foo
23992 !! html/php+tidy
23993 <div title="Hello world"></div>
23994 <p>Foo</p>
23995 !! html/parsoid
23996 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
23997 !! end
23998
23999 !! test
24000 Table with broken attribute value quoting
24001 !! options
24002 parsoid=wt2html,html2html
24003 !! wikitext
24004 {|
24005 | title="Hello world|Foo
24006 |}
24007 !! html/php
24008 <table>
24009 <tr>
24010 <td title="Hello world">Foo
24011 </td></tr></table>
24012
24013 !! html/parsoid
24014 <table>
24015 <tr>
24016 <td title="Hello world">Foo
24017 </td></tr></table>
24018
24019 !! end
24020
24021 !! test
24022 Table with broken attribute value quoting on consecutive lines
24023 !! options
24024 parsoid=wt2html,html2html
24025 !! wikitext
24026 {|
24027 | title="Hello world|Foo
24028 | style="color:red|Bar
24029 |}
24030 !! html/php
24031 <table>
24032 <tr>
24033 <td title="Hello world">Foo
24034 </td>
24035 <td style="color:red">Bar
24036 </td></tr></table>
24037
24038 !! html/parsoid
24039 <table><tbody>
24040 <tr>
24041 <td title="Hello world">Foo
24042 </td><td style="color: red">Bar
24043 </td></tr></tbody></table>
24044
24045 !! end
24046
24047 !! test
24048 2. Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
24049 !! options
24050 parsoid
24051 !! wikitext
24052 {{}}
24053 !! html
24054 {{}}
24055 !! end
24056
24057 !! test
24058 1. Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
24059 !! options
24060 parsoid
24061 !! wikitext
24062 }}{{
24063 !! html
24064 }}{{
24065 !! end
24066
24067 !!test
24068 Accept empty td cell attribute
24069 !! wikitext
24070 {|
24071 | align="center" | foo || |
24072 |}
24073 !! html
24074 <table>
24075 <tr>
24076 <td align="center"> foo </td>
24077 <td>
24078 </td></tr></table>
24079
24080 !!end
24081
24082 !!test
24083 Non-empty attributes in th-cells
24084 !! wikitext
24085 {|
24086 ! Foo !! style="color: red" | Bar
24087 |}
24088 !! html
24089 <table>
24090 <tr>
24091 <th> Foo </th>
24092 <th style="color: red"> Bar
24093 </th></tr></table>
24094
24095 !!end
24096
24097 !!test
24098 Accept empty attributes in th-cells
24099 !! wikitext
24100 {|
24101 !| foo !!| bar
24102 |}
24103 !! html
24104 <table>
24105 <tr>
24106 <th> foo </th>
24107 <th> bar
24108 </th></tr></table>
24109
24110 !!end
24111
24112 !!test
24113 Empty table rows go away
24114 !! wikitext
24115 {|
24116 | Hello
24117 | there
24118 |- class="foo"
24119 |-
24120 |}
24121 !! html
24122 <table>
24123 <tr>
24124 <td> Hello
24125 </td>
24126 <td> there
24127 </td></tr>
24128
24129 </table>
24130
24131 !! end
24132
24133 ###
24134 ### Parsoid-centric tests for testing RTing of inter-element separators
24135 ### Edge cases not tested by existing parser tests and specific to
24136 ### Parsoid-specific serialization strategies.
24137 ###
24138
24139 !!test
24140 RT-ed inter-element separators should be valid separators
24141 !! wikitext
24142 {|
24143 |- [[foo]]
24144 |}
24145 !! html/php
24146 <table>
24147
24148 </table>
24149
24150 !! html/parsoid
24151 <table>
24152 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
24153 </tbody></table>
24154 !!end
24155
24156 # Parsoid-only since PHP parser relies on Tidy for correct output
24157 !!test
24158 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
24159 !!options
24160 parsoid
24161 !! wikitext
24162 {|
24163 |<small>foo
24164 bar
24165 |}
24166
24167 {|
24168 |<small>foo<small>
24169 |}
24170 !! html
24171 <table>
24172 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
24173 <p>bar</p></small></td></tr>
24174 </tbody></table>
24175
24176 <table>
24177 <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>
24178 </tbody></table>
24179 !!end
24180
24181 # Note that the "style" attribute is really a template parameter here.
24182 # The = would have to be {{=}} if you wanted the literal.
24183 !!test
24184 Empty TD followed by TD with tpl-generated attribute
24185 !! wikitext
24186 {|
24187 |-
24188 |
24189 |{{echo|style='color:red'}}|foo
24190 |}
24191 !! html
24192 <table>
24193
24194 <tr>
24195 <td>
24196 </td>
24197 <td>foo
24198 </td></tr></table>
24199
24200 !!end
24201
24202 !!test
24203 Indented table with an empty td
24204 !! wikitext
24205 {|
24206 |-
24207 |
24208 |foo
24209 |}
24210 !! html
24211 <table>
24212
24213 <tr>
24214 <td>
24215 </td>
24216 <td>foo
24217 </td></tr></table>
24218
24219 !!end
24220
24221 ## We have some newline diffs RT-ing this edge case
24222 ## and it is not important enough -- we seem to be emitting
24223 ## at most 2 newlines after a </tr> and this is unrelated to
24224 ## the issue from T85627 that this is testing.
24225 !!test
24226 Indented table with blank lines in between (T85627)
24227 !! options
24228 parsoid=wt2html
24229 !! wikitext
24230 {|
24231 |foo
24232
24233
24234 |}
24235 !! html
24236 <table>
24237
24238 <tr>
24239 <td>foo
24240 </td></tr></table>
24241
24242 !!end
24243
24244 !!test
24245 Indented block & table
24246 !! wikitext
24247 <div>foo</div>
24248 {|
24249 |foo
24250 |}
24251 !! html/php
24252 <div>foo</div>
24253 <table>
24254 <tr>
24255 <td>foo
24256 </td></tr></table>
24257
24258 !! html/parsoid
24259 <div data-parsoid='{"stx":"html"}'>foo</div>
24260 <table><tbody>
24261 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
24262 </tbody></table>
24263 !!end
24264
24265 !! test
24266 Indent and comment before table row
24267 !! wikitext
24268 {|
24269 <!--hi-->|-
24270 | there
24271 |}
24272 !! html/php
24273 <table>
24274
24275 <tr>
24276 <td> there
24277 </td></tr></table>
24278
24279 !! html/parsoid
24280 <table>
24281 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
24282 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
24283 </tbody></table>
24284 !! end
24285
24286 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
24287 !!test
24288 Empty TR followed by a template-generated TR
24289 !!options
24290 parsoid
24291 !! wikitext
24292 {|
24293 |-
24294 {{echo|<tr><td>foo</td></tr>}}
24295 |}
24296 !! html
24297 <table>
24298 <tbody>
24299 <tr></tr>
24300 <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}}]}'>
24301 <td>foo</td></tr>
24302 </tbody></table>
24303 !!end
24304
24305 ## PHP and parsoid output differ for this, and since this is primarily
24306 ## for testing Parsoid's serializer, marking this Parsoid only
24307 !!test
24308 Empty TR followed by mixed-ws-comment line should RT correctly
24309 !!options
24310 parsoid
24311 !! wikitext
24312 {|
24313 |-
24314 <!--c-->
24315 |-
24316 <!--c--> <!--d-->
24317 |}
24318 !! html
24319 <table>
24320 <tbody>
24321 <tr></tr>
24322 <!--c-->
24323 <tr>
24324 <!--c--> </tr><!--d-->
24325 </tbody></table>
24326
24327 !!end
24328
24329 !!test
24330 Multi-line image caption generated by templates with/without trailing newlines
24331 !! wikitext
24332 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
24333 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
24334 !! html/parsoid
24335 <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>
24336 <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>
24337 !!end
24338
24339 !! test
24340 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
24341 !! options
24342 parsoid=html2wt
24343 !! html/parsoid
24344 <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>
24345
24346 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
24347 !! wikitext
24348 <includeonly>foo</includeonly>
24349 new para
24350
24351 [[Category:Foo]]
24352
24353 = new heading =
24354 !! end
24355
24356 ## PHP emits broken html for this, and since this is primarily
24357 ## a Parsoid serializer test, marking this Parsoid only
24358 !!test
24359 Improperly nested inline or quotes tags with whitespace in between
24360 !! wikitext
24361 <span> <s>x</span> </s>
24362 ''' ''x''' ''
24363 !! html/parsoid
24364 <p><span> <s>x</s></span><s> </s>
24365 <b> <i>x</i></b><i> </i>
24366 </p>
24367 !!end
24368
24369 !!test
24370 Encapsulate protected attributes from wt
24371 !! wikitext
24372 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
24373 !! html/parsoid
24374 <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>
24375 </body>
24376 !!end
24377
24378 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
24379 ## Having nested or stray pre tags results in the attempt to add duplicates,
24380 ## causing an assertion fail. This test tries to prevent that situation.
24381 !!test
24382 Ensure ParagraphWrapper can deal with stray closing pre tags
24383 !!options
24384 parsoid=wt2html
24385 !! wikitext
24386 plain text</pre>
24387 !! html/parsoid
24388 plain text
24389 !!end
24390
24391 !!test
24392 1. Ensure fostered text content is wrapped in element nodes
24393 !!options
24394 parsoid=wt2html
24395 !! wikitext
24396 <table>hi</table><table>ho</table>
24397 !! html/parsoid
24398 <p>hi</p>
24399 <table></table>
24400 <p>ho</p>
24401 <table></table>
24402 !!end
24403
24404 !!test
24405 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
24406 !!options
24407 parsoid=wt2html,wt2wt
24408 !! wikitext
24409 <table>
24410 <tr> || ||
24411 <td> a
24412 </table>
24413 !! html/parsoid
24414 <p> || ||
24415 </p><table>
24416 <tbody><tr><td> a</td></tr>
24417 </tbody></table>
24418 !!end
24419
24420 !!test
24421 Encapsulation properly handles null DSR information from foster box
24422 !!options
24423 parsoid=wt2html,wt2wt
24424 !! wikitext
24425 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
24426 !! html/parsoid
24427 <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>
24428 !!end
24429
24430 !!test
24431 1. Encapsulate foster-parented transclusion content
24432 !!options
24433 parsoid=wt2wt,wt2html
24434 !! wikitext
24435 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
24436 !! html/parsoid
24437 <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>
24438 <tbody>
24439 <tr>
24440 <td>bar</td>
24441 </tr>
24442 </tbody>
24443 </table>
24444 !!end
24445
24446 !!test
24447 2. Encapsulate foster-parented transclusion content
24448 !!options
24449 parsoid=wt2wt,wt2html
24450 !! wikitext
24451 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
24452 !! html/parsoid
24453 <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>
24454 <table>
24455 <tbody>
24456 <tr>
24457 <td>bar</td>
24458 </tr>
24459 </tbody>
24460 </table>
24461 !!end
24462
24463 !!test
24464 3. Encapsulate foster-parented transclusion content
24465 !!options
24466 parsoid=wt2wt,wt2html
24467 !! wikitext
24468 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24469 !! html/parsoid
24470 <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;]}">
24471 <p>foo</p>
24472 </div>
24473 <table>
24474 <tbody>
24475 <tr>
24476 <td>bar</td>
24477 </tr>
24478 </tbody>
24479 </table>
24480 !!end
24481
24482 !!test
24483 4. Encapsulate foster-parented transclusion content
24484 !!options
24485 parsoid=wt2wt,wt2html
24486 !! wikitext
24487 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24488 !! html/parsoid
24489 <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;]}">
24490 <p>foo</p>
24491 </div>
24492 <table>
24493 <tbody>
24494 <tr>
24495 <td>bar</td>
24496 </tr>
24497 </tbody>
24498 </table>
24499 !!end
24500
24501 !!test
24502 5. Encapsulate foster-parented transclusion content
24503 !!options
24504 parsoid=wt2wt,wt2html
24505 !! wikitext
24506 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
24507 !! html/parsoid
24508 <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>
24509 <table>
24510 <tbody>
24511 <tr>
24512 <td>
24513 <div>
24514 <p>foo</p>
24515 </div>
24516 </td>
24517 </tr>
24518 </tbody>
24519 </table>
24520 !!end
24521
24522 !!test
24523 6. Encapsulate foster-parented transclusion content
24524 !!options
24525 parsoid=wt2wt,wt2html
24526 !! wikitext
24527 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
24528 !! html/parsoid
24529 <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>
24530 <table>
24531 <tbody>
24532 <tr>
24533 <td>
24534 <div>
24535 <p>foo</p>
24536 </div>
24537 </td>
24538 </tr>
24539 </tbody>
24540 </table>
24541 <p>ok</p>
24542 !!end
24543
24544 !!test
24545 7. Encapsulate foster-parented transclusion content
24546 !!options
24547 parsoid=wt2wt,wt2html
24548 !! wikitext
24549 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
24550 !! html/parsoid
24551 <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>
24552 <table>
24553 <tbody>
24554 <tr>
24555 <td>bar</td>
24556 </tr>
24557 </tbody>
24558 </table>
24559 !!end
24560
24561 # Note that the wt is broken on purpose: the = should be {{=}} if you
24562 # don't want it to be a template parameter key.
24563 !!test
24564 8. Encapsulate foster-parented transclusion content
24565 !!options
24566 parsoid=wt2wt,wt2html
24567 !! wikitext
24568 {{echo|a
24569 }}{|{{echo|style='color:red'}}
24570 |-
24571 |b
24572 |}
24573 !! html/parsoid
24574 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
24575 <span> </span>
24576 <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>
24577 <table>
24578 <tbody>
24579 <tr>
24580 <td>b</td>
24581 </tr>
24582 </tbody>
24583 </table>
24584 !!end
24585
24586 !!test
24587 9. Encapsulate foster-parented transclusion content
24588 !!options
24589 parsoid=wt2wt,wt2html
24590 !! wikitext
24591 <table>{{echo|hi</table>hello}}
24592 !! html/parsoid
24593 <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>
24594 !!end
24595
24596 !!test
24597 Table in fosterable position
24598 !!options
24599 parsoid=wt2html
24600 !! wikitext
24601 {{OpenTable}}
24602 <div>
24603 {|
24604 |}
24605 </div>
24606 |}
24607 !! html/parsoid
24608 <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">
24609 </span>
24610 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
24611
24612 <table>
24613 </table>
24614 !!end
24615
24616 # Parsoid only for bug 64747
24617 !! test
24618 Properly encapsulate empty-content transclusions in fosterable positions
24619 !! wikitext
24620 <table>
24621 {{#if:|
24622 <td>foo</td>
24623 }}
24624 </table>
24625 !! html/parsoid
24626 <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"}]]}'>
24627
24628 </table>
24629 !! end
24630
24631 !! test
24632 Always encapsulate foster box when template range is expanded to table
24633 !! options
24634 parsoid=wt2wt
24635 !! wikitext
24636 {|
24637 hello
24638 {{OpenTable}}
24639 |}
24640 !! html/parsoid
24641
24642 !! end
24643
24644 !! test
24645 T115289: Unclosed table
24646 !! wikitext
24647 {{echo|<table>}}<!--c-->[[Category:Two]]
24648 !! html/parsoid
24649 <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>
24650 !! end
24651
24652 !! test
24653 T115289: Don't migrate newlines out of tables with fostered content
24654 !! wikitext
24655 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
24656 !! html/parsoid
24657 <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>
24658 !! end
24659
24660 !! test
24661 T73074: More fostering fun
24662 !! wikitext
24663 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
24664 !! html/parsoid
24665 <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>
24666 !! end
24667
24668 !!test
24669 Support <object> element with .data attribute
24670 !!options
24671 parsoid=html2wt
24672 !! html/parsoid
24673 <object data="test.swf"></object>
24674 !! wikitext
24675 <object data="test.swf"></object>
24676 !!end
24677
24678 !! test
24679 Don't block XML namespace declaration
24680 !! wikitext
24681 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24682 !! html/php
24683 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24684 </p>
24685 !! html/parsoid
24686 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
24687 !! end
24688
24689 # -----------------------------------------------------------------
24690 # The following section of tests are primarily to spec requirements
24691 # around serialization of new/edited content.
24692 #
24693 # All these tests are marked Parsoid html2wt and html2html only
24694 # ----------------------------------------------------------------
24695
24696 # 'mi' is a localinterwiki prefix as well as a language
24697 !! test
24698 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
24699 !! options
24700 parsoid=html2wt
24701 !! html/parsoid
24702 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
24703 !! wikitext
24704 [[Foo]]
24705 !! end
24706
24707 # See T93839
24708 !! test
24709 New wikilinks should be serialized properly
24710 !! options
24711 parsoid=html2wt
24712 !! html/parsoid
24713 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
24714 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
24715 !! wikitext
24716 [[Foo]]
24717 [[Foo]]
24718 !! end
24719
24720 !! test
24721 New wiki links (href variations)
24722 !! options
24723 parsoid=html2wt
24724 !! html/parsoid
24725 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24726 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
24727 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
24728 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
24729 !! wikitext
24730 [[Foo_bar]]
24731 [[Foo_bar]]
24732 [[Foo_bar]]
24733 [[Toxine bactérienne]]
24734 !! end
24735
24736 !! test
24737 New wiki links (content string variations)
24738 !! options
24739 parsoid=html2wt
24740 !! html/parsoid
24741 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24742 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
24743 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
24744 !! wikitext
24745 [[Foo_bar]]
24746 [[Foo bar]]
24747 [[Foo_bar|./Foo_bar]]
24748 !! end
24749
24750 !! test
24751 New category links (href variations)
24752 !! options
24753 parsoid=html2wt
24754 !! html/parsoid
24755 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
24756 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
24757 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
24758 !! wikitext
24759 [[Category:Toxine bactérienne]]
24760 [[Category:Toxine bactérienne]]
24761 [[Category:Toxine bactérienne]]
24762 !! end
24763
24764 !! test
24765 New sol transparent links don't need indent-pre nowiki protection
24766 !! options
24767 parsoid=html2wt
24768 language=de
24769 !! html/parsoid
24770 <link rel="mw:PageProp/redirect" href="./Main_Page">
24771 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
24772 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
24773 !! wikitext
24774 #WEITERLEITUNG [[Main Page]]
24775 <!-- this is good --> [[Category:Good]]
24776 <!-- this is great --> [[Kategorie:Great]]
24777 !! end
24778
24779 !! test
24780 New interlanguage links (href variations)
24781 !! options
24782 parsoid=html2wt
24783 !! html/parsoid
24784 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
24785 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
24786 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
24787 !! wikitext
24788 [[es:Toxine bactérienne]]
24789 [[es:Toxine_bactérienne]]
24790 [[es:Toxine_bactérienne]]
24791 !! end
24792
24793 !! test
24794 Image: Modifying size of an image (1)
24795 !! options
24796 parsoid={
24797 "modes": ["wt2wt"],
24798 "changes": [
24799 ["img[height]", "attr", "height", "22"],
24800 ["img[width]", "attr", "width", "200"]
24801 ]
24802 }
24803 !! wikitext
24804 [[Image:Foobar.jpg|230x230px]]
24805 !! wikitext/edited
24806 [[Image:Foobar.jpg|200x200px]]
24807 !!end
24808
24809 !! test
24810 Image: Modifying size of an image (2)
24811 !! options
24812 parsoid={
24813 "modes": ["wt2wt"],
24814 "changes": [
24815 ["img[height]", "attr", "height", "100"],
24816 ["img[width]", "attr", "width", "500"]
24817 ]
24818 }
24819 !! wikitext
24820 [[Image:Foobar.jpg|230x230px]]
24821 !! wikitext/edited
24822 [[Image:Foobar.jpg|500x500px]]
24823 !!end
24824
24825 # Change in size is ignored so long as class='mw-default-size'
24826 !! test
24827 Image: Modifying size of an image (3)
24828 !! options
24829 parsoid={
24830 "modes": ["wt2wt"],
24831 "changes": [
24832 ["figure[class]", "removeClass", "mw-default-size"],
24833 ["figure img", "attr", "height", "19"],
24834 ["figure img", "attr", "width", "170"]
24835 ]
24836 }
24837 !! wikitext
24838 [[Image:Foobar.jpg|thumb]]
24839 !! wikitext/edited
24840 [[Image:Foobar.jpg|thumb|170x170px]]
24841 !!end
24842
24843 !! test
24844 Image: Modifying alignment of an image (bug 48665)
24845 !! options
24846 parsoid={
24847 "modes": ["wt2wt"],
24848 "changes": [
24849 ["figure[class]", "removeClass", "mw-halign-right"],
24850 ["figure[class]", "addClass", "mw-halign-left"]
24851 ]
24852 }
24853 !! wikitext
24854 [[Image:Foobar.jpg|thumb|caption|right]]
24855 !! wikitext/edited
24856 [[Image:Foobar.jpg|thumb|caption|left]]
24857 !! end
24858
24859 !! test
24860 Image: Modifying mw-default-size of an frameless image (bug 62805)
24861 !! options
24862 parsoid={
24863 "modes": ["wt2wt"],
24864 "changes": [
24865 ["figure.mw-default-size", "removeClass", "mw-default-size"]
24866 ]
24867 }
24868 !! wikitext
24869 [[Image:Foobar.jpg|frameless|right]]
24870 !! wikitext/edited
24871 [[Image:Foobar.jpg|frameless|right|220x220px]]
24872 !! end
24873
24874 !! test
24875 Image: Modifying valign of an image (bug 49221)
24876 !! options
24877 parsoid={
24878 "modes": ["wt2wt"],
24879 "changes": [
24880 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
24881 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
24882 ]
24883 }
24884 !! wikitext
24885 [[File:Foobar.jpg|20px|middle]]
24886 !! wikitext/edited
24887 [[File:Foobar.jpg|20px|text-top]]
24888 !! end
24889
24890 !! test
24891 Image: Modifying alt attribute of an image (bug 56400)
24892 !! options
24893 parsoid={
24894 "modes": ["wt2wt"],
24895 "changes": [
24896 ["img[alt]", "attr", "alt", "some alternate edited text"]
24897 ]
24898 }
24899 !! wikitext
24900 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
24901 !! wikitext/edited
24902 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
24903 !!end
24904
24905 !! test
24906 Image: Modifying caption of an image
24907 !! options
24908 parsoid={
24909 "modes": ["wt2wt"],
24910 "changes": [
24911 ["figcaption", "text", "new caption"]
24912 ]
24913 }
24914 !! wikitext
24915 [[Image:Foobar.jpg|thumb|original caption]]
24916 !! wikitext/edited
24917 [[Image:Foobar.jpg|thumb|new caption]]
24918 !!end
24919
24920 !! test
24921 Image: empty alt attribute (bug 48924)
24922 !! options
24923 parsoid
24924 !! wikitext
24925 [[File:Foobar.jpg|thumb|alt=|bar]]
24926 !! html
24927 <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>
24928 !! end
24929
24930 !! test
24931 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
24932 !! options
24933 parsoid=html2wt
24934 language=ar
24935 disabled
24936 !! html/parsoid
24937 <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>
24938 !! wikitext
24939 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
24940 !! end
24941
24942 !! test
24943 Image: Block level image should have \n before and after
24944 !! wikitext
24945 123
24946 [[File:Foobar.jpg|right|thumb|150x150px]]
24947 456
24948 !! html/parsoid
24949 <p>123</p>
24950 <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>
24951 <p>456</p>
24952 !!end
24953
24954 !! test
24955 Image: New block level image should have \n before and after (existing content)
24956 !! wikitext
24957 123
24958 [[File:Foobar.jpg|right|thumb|150x150px]]
24959 456
24960 !! html/parsoid
24961 <p>123</p>
24962 <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>
24963 <p>456</p>
24964 !!end
24965
24966 !! test
24967 Image: upright option (parsoid)
24968 !! wikitext
24969 [[File:Foobar.jpg|thumb|upright|caption]]
24970 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
24971 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
24972 !! html/parsoid
24973 <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>
24974 <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>
24975 <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>
24976 !!end
24977
24978 !! test
24979 Image: upright option is ignored on inline and frame images (parsoid)
24980 !! wikitext
24981 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
24982 !! html/parsoid
24983 <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>
24984 !!end
24985
24986 !! test
24987 Image: from basic HTML (1)
24988 !! options
24989 parsoid=html2wt
24990 !! html/parsoid
24991 <span typeof="mw:Image">
24992 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24993 </span>
24994 !! wikitext
24995 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24996 !! end
24997
24998 !! test
24999 Image: from basic HTML (2)
25000 !! options
25001 parsoid=html2wt
25002 !! html/parsoid
25003 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25004 !! wikitext
25005 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25006 !! end
25007
25008 !! test
25009 Image: from basic HTML (3)
25010 !! options
25011 parsoid=html2wt
25012 !! html/parsoid
25013 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
25014 !! wikitext
25015 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
25016 !! end
25017
25018 !! test
25019 Image: from basic HTML (4)
25020 !! options
25021 parsoid=html2wt
25022 !! html/parsoid
25023 <img src="./File:Foobar.jpg">
25024 !! wikitext
25025 [[File:Foobar.jpg|link=]]
25026 !! end
25027
25028 !! test
25029 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
25030 !! options
25031 parsoid=html2wt
25032 !! html/parsoid
25033 <ul>
25034 <li><p>foo</p></li>
25035 </ul>
25036 !! wikitext
25037 * foo
25038 !! end
25039
25040 !! test
25041 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
25042 !! options
25043 parsoid=html2wt
25044 !! html/parsoid
25045 <ul> <li>foo</li></ul>
25046 !! wikitext
25047 * foo
25048 !! end
25049
25050 !! test
25051 Don't strip leading whitespace when handling indent-pre suppressing tags
25052 !! options
25053 parsoid=html2wt
25054 !! html/parsoid
25055 <table>
25056 <tr><td> indented row</td></tr>
25057 </table>
25058 <blockquote><p>
25059 <b>This is very bold of you!</b>
25060 </p>
25061 <table><tr><td>
25062 indented cell (no pre-wrapping!)
25063 </td></tr></table>
25064 </blockquote>
25065 <p>foo</p>
25066 <div>bar</div>
25067 !! wikitext
25068 {|
25069 | indented row
25070 |}
25071 <blockquote>
25072 '''This is very bold of you!'''
25073
25074 {|
25075 |
25076 indented cell (no pre-wrapping!)
25077 |}
25078 </blockquote>
25079 foo
25080 <div>bar</div>
25081 !! end
25082
25083 !! test
25084 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
25085 !! options
25086 parsoid=html2wt
25087 !! html/parsoid
25088 <p>foo</p>
25089 <span>bar</span>
25090
25091 <span>foo2
25092 </span>bar2
25093
25094 <div>foo</div>
25095 <span>bar</span>
25096
25097 <div>
25098 <span>foo</span>
25099 </div>
25100 !! wikitext
25101 foo
25102
25103 <span>bar</span>
25104
25105 <span>foo2
25106 <nowiki> </nowiki></span>bar2
25107
25108 <div>foo</div>
25109 <nowiki> </nowiki><span>bar</span>
25110
25111 <div>
25112 <nowiki> </nowiki><span>foo</span>
25113 </div>
25114 !! end
25115
25116 !! test
25117 Lists: Dont insert newlines in a serialized list item.
25118 !! options
25119 parsoid=html2wt
25120 !! html/parsoid
25121 <ul><li>a<br>b</li><li>c</li></ul>
25122 !! wikitext
25123 * a<br>b
25124 * c
25125 !! end
25126
25127 !! test
25128 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
25129 !! options
25130 parsoid={
25131 "modes": ["html2wt"],
25132 "scrubWikitext": false
25133 }
25134 !! html/parsoid
25135 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25136 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25137
25138 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25139 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25140
25141 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
25142
25143 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25144 !! wikitext
25145 == hello there [[Category:A1]] ==
25146
25147 == [[Category:A2]] hi pal ==
25148
25149 == <!--foo--> [[Category:A3]] how goes it ==
25150
25151 == it goes well [[Category:A4]] <!--bar--> ==
25152
25153 ==howdy [[Category:A5]]==
25154
25155 == __TOC__ ok ==
25156 !! end
25157
25158 !! test
25159 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
25160 !! options
25161 parsoid={
25162 "modes": ["html2wt"],
25163 "scrubWikitext": true
25164 }
25165 !! html/parsoid
25166 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25167 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25168
25169 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25170 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25171
25172 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25173 !! wikitext
25174 == hello there ==
25175 [[Category:A1]]
25176 [[Category:A2]]
25177
25178 == hi pal ==
25179
25180 <!--foo--> [[Category:A3]]
25181
25182 == how goes it ==
25183
25184 == it goes well ==
25185 [[Category:A4]] <!--bar-->
25186
25187 __TOC__
25188
25189 == ok ==
25190 !! end
25191
25192 !! test
25193 Headings: Don't hoist metas that come from templates
25194 !! options
25195 parsoid={
25196 "modes": ["html2wt"],
25197 "scrubWikitext": true
25198 }
25199 !! html/parsoid
25200 <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>
25201 !! wikitext
25202 == {{echo|foo [[Category:Foo]]}} ==
25203 !! end
25204
25205 !! test
25206 Headings: Category in ref isn't hoisted
25207 !! options
25208 parsoid={
25209 "modes": ["html2wt"],
25210 "scrubWikitext": true
25211 }
25212 !! html/parsoid
25213 <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>
25214
25215 <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>
25216 !! wikitext
25217 == foo <ref>bar
25218 [[Category:Baz]] </ref> ==
25219
25220 <references />
25221 !! end
25222
25223 !! test
25224 Parsoid: Serialize positional parameters with = in them as named parameter
25225 !! options
25226 parsoid=html2wt
25227 !! html/parsoid
25228 <p about="#mwt1" typeof="mw:Transclusion"
25229 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
25230
25231 <p about="#mwt1" typeof="mw:Transclusion"
25232 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
25233
25234 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25235 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25236 <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>
25237 !! wikitext
25238 {{echo|1=f=oo}}
25239
25240 {{echo|1=f=oo|2=bar}}
25241
25242 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25243 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25244 {{echo|<nowiki>f=oo</nowiki>|bar}}
25245 !! end
25246
25247 !! test
25248 Parsoid: Serialize positional parameters with = in extlink as named parameter
25249 !! options
25250 parsoid=html2wt
25251 !! html/parsoid
25252 <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>
25253 !! wikitext
25254 {{echo|1=http://stuff?is=ok}}
25255 !! end
25256
25257 !! test
25258 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
25259 !! options
25260 parsoid=html2wt
25261 !! html/parsoid
25262 <div>a<p>b</p></div>
25263 <div>a
25264 <p>b</p></div>
25265 <div>
25266 a
25267 <p>b</p></div>
25268 !! wikitext
25269 <div>a
25270 b
25271 </div>
25272 <div>a
25273 b
25274 </div>
25275 <div>
25276 a
25277
25278 b
25279 </div>
25280 !! end
25281
25282 !! test
25283 Substrings resembling wikitext in hrefs should not get nowiki escapes
25284 !! options
25285 parsoid=html2wt
25286 !! html/parsoid
25287 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
25288 !! wikitext
25289 [[Foo''bar''baz]]
25290 !! end
25291
25292 !! test
25293 Enforce single-line context in the serializer
25294 !! options
25295 parsoid=html2wt
25296 !! html/parsoid
25297 <h2>testing
25298 123</h2>
25299
25300 <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">
25301 </span><span about="#mwt1">you</span> </h2>
25302
25303 <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>
25304
25305 <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
25306 there</span></li></ol>
25307
25308 <ul><li>asd
25309 sdf</li></ul>
25310
25311 <ul><li>foo
25312 bar
25313 baz</li>
25314 <li>foo <b>bar</b>
25315 baz</li></ul>
25316
25317 <dl><dt>hi
25318 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
25319 ho</dd></dl>
25320
25321 <dl><dd> <table>
25322 <tbody><tr><td> ha
25323 ha
25324 ha</td></tr>
25325 </tbody></table></dd></dl>
25326 !! wikitext
25327 == testing 123 ==
25328
25329 == hi {{bogus|there
25330 you}} ==
25331
25332 == foo <ref>hello
25333 there</ref> ==
25334
25335 <references />
25336
25337 * asd sdf
25338
25339 * foo bar baz
25340 * foo '''bar''' baz
25341
25342 ; hi ho : hi ho
25343
25344 : {|
25345 | ha
25346 ha
25347 ha
25348 |}
25349 !! end
25350
25351 !! test
25352 Serialize new placeholder space without spans
25353 !! options
25354 parsoid=html2wt
25355 !! html/parsoid
25356 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
25357
25358 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
25359
25360 <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>
25361 !! wikitext
25362 foo : bar
25363
25364 foo : bar
25365
25366 <ref>foo : bar</ref>ok
25367 !! end
25368
25369
25370 #-----------------------
25371 # Tag minimization tests
25372 #-----------------------
25373
25374 !! test
25375 1. I/B quote minimization: wikitext-only tags should be combined
25376 !! options
25377 parsoid=html2wt
25378 !! html/parsoid
25379 <p><i>A</i><i>B</i></p>
25380 <p><b>A</b><b>B</b></p>
25381 <p><i>A</i><b><i>B</i></b></p>
25382 <p><b>A</b><i><b>B</b></i></p>
25383 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
25384 <p><i><b>A</b></i><i><b>B</b></i></p>
25385 <p><i><b>A</b></i><b><i>B</i></b></p>
25386 <p><b><i>A</i></b><i><b>B</b></i></p>
25387 !! wikitext
25388 ''AB''
25389
25390 '''AB'''
25391
25392 ''A'''B'''''
25393
25394 '''A''B'''''
25395
25396 '''A''BC''D'''
25397
25398 '''''AB'''''
25399
25400 '''''AB'''''
25401
25402 '''''AB'''''
25403 !! end
25404
25405 !! test
25406 2. I/B quote minimization: wikitext and html tags should not be combined
25407 !! options
25408 parsoid=html2wt
25409 !! html/parsoid
25410 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
25411 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
25412 !! wikitext
25413 ''A''<i>B</i>
25414
25415 ''A''<nowiki/>'''<i>B</i>'''
25416 !! end
25417
25418 !! test
25419 3. I/B quote minimization: templated content stops minimization
25420 !! options
25421 parsoid=html2wt
25422 !! html/parsoid
25423 <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>
25424 <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>
25425 !! wikitext
25426 ''A''{{echo|''B''}}
25427
25428 ''A''{{echo|'''''B'''''}}
25429 !! end
25430
25431 !! test
25432 4. I/B quote minimization: new content should be mimimized with adjacent old content
25433 !! options
25434 parsoid=html2wt
25435 !! html/parsoid
25436 <p><i>A</i><i>B</i></p>
25437 <p><b>A</b><b>B</b></p>
25438 <p><i>A</i><b><i>B</i></b></p>
25439 !! wikitext
25440 ''AB''
25441
25442 '''AB'''
25443
25444 ''A'''B'''''
25445 !! end
25446
25447 !! test
25448 5a. Merge adjacent quote nodes if they've been edited
25449 !! options
25450 parsoid={
25451 "modes": ["wt2wt", "selser"],
25452 "changes": [
25453 ["p", "contents", "remove", ":contains('b')"]
25454 ]
25455 }
25456 !! wikitext
25457 ''a''b''c''
25458 !! wikitext/edited
25459 ''ac''
25460 !! end
25461
25462 !! test
25463 5b. Merge adjacent quote nodes if they've been edited
25464 !! options
25465 parsoid={
25466 "modes": ["wt2wt", "selser"],
25467 "changes": [
25468 ["#x", "remove"]
25469 ]
25470 }
25471 !! wikitext
25472 ''a''<span id="x">b</span>''c''
25473 !! wikitext/edited
25474 ''ac''
25475 !! end
25476
25477 !! test
25478 1. Merge adjacent link nodes as long as at least one element is new
25479 !! options
25480 parsoid={
25481 "modes": ["html2wt"],
25482 "scrubWikitext": true
25483 }
25484 !! html/parsoid
25485 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25486 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25487 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
25488 !! wikitext
25489 [[Football]]
25490 [[Football]]
25491 [[Football|Foot]][[Football|ball]]
25492 !! end
25493
25494 !! test
25495 2. Merge adjacent link nodes and enable additional normalizations
25496 !! options
25497 parsoid={
25498 "modes": ["html2wt"],
25499 "scrubWikitext": true
25500 }
25501 !! html/parsoid
25502 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
25503 !! wikitext
25504 [[Football|''Football'']]
25505 !! end
25506
25507 !! test
25508 3. Don't merge adjacent link nodes if scrubWikitext is false
25509 !! options
25510 parsoid={
25511 "modes": ["html2wt"],
25512 "scrubWikitext": false
25513 }
25514 !! html/parsoid
25515 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25516 !! wikitext
25517 [[Football|Foot]][[Football|ball]]
25518 !! end
25519
25520 #------------------------------
25521 # End of tag minimization tests
25522 #------------------------------
25523
25524 !!test
25525 Bug 54262: New entities
25526 !! options
25527 parsoid=html2wt
25528 !! html/parsoid
25529 <span typeof="mw:Entity">&nbsp;</span>
25530 !! wikitext
25531 &nbsp;
25532 !! end
25533
25534 ## Note that there is no wikitext output for 'unknownproperty' ##
25535 ## Unknown magic words are silently dropped ##
25536
25537 !! test
25538 Magic words
25539 !! options
25540 parsoid=html2wt
25541 !! html/parsoid
25542 <meta property='mw:PageProp/toc' />
25543 <meta property='mw:PageProp/notoc' />
25544 <meta property='mw:PageProp/forcetoc' />
25545 <meta property='mw:PageProp/index' />
25546 <meta property='mw:PageProp/noindex' />
25547 <meta property='mw:PageProp/nogallery' />
25548 <meta property='mw:PageProp/noeditsection' />
25549 <meta property='mw:PageProp/notitleconvert' />
25550 <meta property='mw:PageProp/nocontentconvert' />
25551 <meta property='mw:PageProp/unknownproperty' />
25552 !! wikitext
25553 __TOC__
25554 __NOTOC__
25555 __FORCETOC__
25556 __INDEX__
25557 __NOINDEX__
25558 __NOGALLERY__
25559 __NOEDITSECTION__
25560 __NOTITLECONVERT__
25561 __NOCONTENTCONVERT__
25562 !! end
25563
25564 !! test
25565 Consecutive <pre>s should not get merged
25566 !! options
25567 parsoid=html2wt,html2html
25568 !! html/parsoid
25569 <pre>a</pre><pre>b</pre>
25570
25571 <pre>c
25572 </pre><pre>
25573 d</pre>
25574
25575 <pre>e
25576
25577 </pre><pre>
25578
25579 f</pre>
25580 !! wikitext
25581 a
25582
25583 b
25584
25585 c
25586
25587 d
25588
25589 e
25590
25591
25592
25593 f
25594 !! end
25595
25596 !! test
25597 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
25598 !! options
25599 parsoid=html2wt
25600 !! html/parsoid
25601 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
25602 !! wikitext
25603 [[Special:BookSources/1234567890|ISBN 1234567895]]
25604 !! end
25605
25606 !! test
25607 Edited RFC links not serializable as RFC links should serialize as extlinks
25608 !! options
25609 parsoid=html2wt
25610 !! html/parsoid
25611 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
25612 !! wikitext
25613 [//tools.ietf.org/html/rfc123 New RFC]
25614 !! end
25615
25616 !! test
25617 Edited PMID links not serializable as PMID links should serialize as extlinks
25618 !! options
25619 parsoid=html2wt
25620 !! html/parsoid
25621 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
25622 !! wikitext
25623 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
25624 !! end
25625
25626 !! test
25627 WTS of autolinks with trailing/surrounding context
25628 !! options
25629 parsoid=html2wt
25630 !! html/parsoid
25631 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
25632 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
25633 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
25634 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
25635 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
25636 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
25637 !! wikitext
25638 http://cscott.net'''foo'''
25639
25640 http://cscott.net<b>foo</b>
25641
25642 '''http://cscott.net'''
25643
25644 '''http://cscott.net '''
25645
25646 '''http://cscott.net<nowiki/>x'''
25647
25648 http://cscott.net<nowiki/>x
25649 !! end
25650
25651 !! test
25652 WTS of autolinks with nowikis (round-trip)
25653 !! wikitext
25654 x<nowiki/>http://cscott.net<nowiki/>x
25655 !! html/parsoid
25656 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
25657 !! end
25658
25659 # this is the "easy" test because it leaves in place all the
25660 # data-parsoid information indicating this is an autolink
25661 !! test
25662 WTS of autolinks with escapes (editing)
25663 !! options
25664 parsoid={
25665 "modes": ["wt2wt"],
25666 "changes": [
25667 [ "meta", "remove" ]
25668 ]
25669 }
25670 !! wikitext
25671 x<nowiki/>http://cscott.net<nowiki/>x
25672 !! wikitext/edited
25673 x<nowiki/>http://cscott.net<nowiki/>x
25674 !! end
25675
25676 !! test
25677 WTS of edited autolink-like text (T103364)
25678 !! options
25679 parsoid={
25680 "modes": ["wt2wt"],
25681 "changes": [
25682 [ "span[typeof]", "removeAttr", "typeof" ]
25683 ]
25684 }
25685 !! wikitext
25686 Not a link: <nowiki>http://example.com</nowiki>.
25687 !! wikitext/edited
25688 Not a link: <span><nowiki>http://example.com</nowiki></span>.
25689 !! end
25690
25691 !! test
25692 WTS of newly-authored autolink-like text (T103364)
25693 !! options
25694 parsoid=html2wt
25695 !! html/parsoid
25696 <p>http://example.com is not a link.</p>
25697 !! wikitext
25698 <nowiki>http://example.com</nowiki> is not a link.
25699 !! end
25700
25701 !! test
25702 WTS of autolink-like text after an autolink (T108563)
25703 !! options
25704 parsoid=html2wt
25705 !! html/parsoid
25706 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
25707 !! wikitext
25708 http://example.com <nowiki>http://example.com</nowiki> is not a link.
25709 !! end
25710
25711 !! test
25712 Magic links inside links (not autolinked)
25713 !! wikitext
25714 [[Foo|http://example.com]]
25715 [[Foo|RFC 1234]]
25716 [[Foo|PMID 1234]]
25717 [[Foo|ISBN 123456789x]]
25718
25719 [http://foo.com http://example.com]
25720 [http://foo.com RFC 1234]
25721 [http://foo.com PMID 1234]
25722 [http://foo.com ISBN 123456789x]
25723 !! html+tidy
25724 <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>
25725 <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>
25726 !! html/parsoid
25727 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
25728 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
25729 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
25730 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
25731
25732 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
25733 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
25734 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
25735 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
25736 !! end
25737
25738 !! test
25739 Magic links inside image captions (autolinked)
25740 !! wikitext
25741 [[File:Foobar.jpg|thumb|http://example.com]]
25742 [[File:Foobar.jpg|thumb|RFC 1234]]
25743 [[File:Foobar.jpg|thumb|PMID 1234]]
25744 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
25745 !! html+tidy
25746 <div class="thumb tright">
25747 <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>
25748 <div class="thumbcaption">
25749 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25750 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
25751 </div>
25752 </div>
25753 <div class="thumb tright">
25754 <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>
25755 <div class="thumbcaption">
25756 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25757 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
25758 </div>
25759 </div>
25760 <div class="thumb tright">
25761 <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>
25762 <div class="thumbcaption">
25763 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25764 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
25765 </div>
25766 </div>
25767 <div class="thumb tright">
25768 <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>
25769 <div class="thumbcaption">
25770 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25771 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
25772 </div>
25773 </div>
25774 !! html/parsoid
25775 <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>
25776 <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>
25777 <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>
25778 <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>
25779 !! end
25780
25781 !! test
25782 WTS of magic word text (T109371)
25783 !! options
25784 parsoid=html2wt
25785 !! html/parsoid
25786 <p>RFC 1234</p>
25787 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
25788 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
25789 !! wikitext
25790 <nowiki>RFC 1234</nowiki>
25791
25792 [http://foo.com RFC 1234]
25793
25794 [[Foo|RFC 1234]]
25795 !! end
25796
25797 !! test
25798 Edited Redirect link should emit a non-piped wikitext link
25799 !! options
25800 parsoid=html2wt
25801 !! html/parsoid
25802 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
25803 !! wikitext
25804 #REDIRECT [[Bar]]
25805 !! end
25806
25807 !! test
25808 T75121: Infer extension name from typeOf if data-mw is not present
25809 !! options
25810 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25811 !! html/parsoid
25812 <div typeOf="mw:Extension/foo"></div>
25813 !! wikitext
25814 <foo />
25815 !! end
25816
25817 # Note that the <p> wrapping isn't present in PHP parser output
25818 # The important thing for this test is that P-wrapping doesn't
25819 # interfere with the <nowiki> protection for leading - in <td>
25820 # (which isn't necessary for <th>).
25821 !! test
25822 T88318: p-wrapped dash in table.
25823 !! options
25824 parsoid=html2wt,wt2wt
25825 !! html/parsoid
25826 <table><tbody>
25827 <tr><th><p>-</p></th><th><p>- </p></th></tr>
25828 <tr><td><p>-</p></td><td><p>- </p></td></tr>
25829 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
25830 </tbody></table>
25831 !! wikitext
25832 {|
25833 !-
25834 !-
25835 |-
25836 |<nowiki>-</nowiki>
25837 |<nowiki>- </nowiki>
25838 |-
25839 |<small>-</small>
25840 |<br>
25841 -
25842 |<br>
25843 -
25844 |}
25845 !! html/php+tidy
25846 <table>
25847 <tr>
25848 <th>-</th>
25849 <th>-</th>
25850 </tr>
25851 <tr>
25852 <td>-</td>
25853 <td>-</td>
25854 </tr>
25855 <tr>
25856 <td><small>-</small></td>
25857 <td><br />
25858 <p>-</p>
25859 </td>
25860 <td><br />
25861 <p>-</p>
25862 </td>
25863 </tr>
25864 </table>
25865 !! end
25866
25867 !! test
25868 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
25869 !! options
25870 parsoid=html2wt
25871 !! html/parsoid
25872 <table id='mwAb'>
25873 <td id='mwAc'>foo</td>
25874 <td id='serialize-this'>bar</td>
25875 </table>
25876 !! wikitext
25877 {|
25878 |foo
25879 | id="serialize-this" |bar
25880 |}
25881 !! end
25882
25883 !! test
25884 Parsoid-like element ids should not be serialized to wikitext unless shadowed
25885 !! options
25886 parsoid=html2wt
25887 !! html/parsoid
25888 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
25889 !! wikitext
25890 <div id="hello">ok</div>
25891 !! end
25892
25893 !! test
25894 WTS change modes
25895 !! options
25896 parsoid={
25897 "modes": ["wt2wt"],
25898 "changes": [
25899 [ "#xyz", "before", "<b>before</b> stuff " ],
25900 [ "#xyz", "after", " stuff <i>after</i>" ],
25901 [ "#xyz", "html", "x <b>y</b> z" ]
25902 ]
25903 }
25904 !! wikitext
25905 <span id="xyz">hello</span>
25906 !! wikitext/edited
25907 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
25908 !! end
25909
25910 !! test
25911 Never serialize a-tag as html, regardless of what data-parsoid has to say
25912 !! options
25913 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25914 !! html/parsoid
25915 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
25916 !! wikitext
25917 [[Foo]]
25918 !! end
25919
25920 ## SSS FIXME: This is broken output nevertheless.
25921 ## What might be a reasonable non-broken output for this?
25922 ## This is an edge case unlikely to be seen in production
25923 ## that I am not wasting more time on this right now.
25924 !! test
25925 Never serialize a-tag as html, no matter what attributes it has
25926 !! options
25927 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25928 !! html/parsoid
25929 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
25930 !! wikitext
25931 [http://boo.org http://boohoo.org]
25932 !! end
25933
25934 # Misnested is an indication that selser can reuse the source but these have
25935 # shown to sneak through on occasion. See T101768.
25936 # The original wikitext here is: [http://test.com [[one]] two three]
25937 !! test
25938 Strip span tags added to mark misnested links
25939 !! options
25940 parsoid=html2wt
25941 !! html/parsoid
25942 <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>
25943 !! wikitext
25944 [http://test.com][[one]] two three
25945 !! end
25946
25947 !! test
25948 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
25949 !! options
25950 parsoid=html2wt
25951 !! html/parsoid
25952 <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|}"]}'>
25953 <tbody><tr><td>d
25954 </td></tr>
25955 </tbody></table>
25956 !! wikitext
25957 {{echo|a}}
25958 {|{{echo|c
25959 {{!}}d
25960 }}
25961 |}
25962 !! end
25963
25964 ## This test verifies the presence and computation of this attribute indirectly
25965 ## by making an edit and ensuring that the serialization is correct (which it would be
25966 ## only if firstWikitextNode is properly set).
25967 !! test
25968 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
25969 !! options
25970 parsoid= {
25971 "modes": ["wt2wt"],
25972 "changes": [
25973 [ "div#x", "remove" ],
25974 [ "div", "before", "<div>new</div>" ]
25975 ]
25976 }
25977 !! wikitext
25978 <div id="x">foo</div>
25979 {|
25980 {{echo|<div>boo</div>
25981 {{!}}b}}
25982 |c
25983 |}
25984 !! wikitext/edited
25985
25986 <div>new</div>
25987 {|
25988 {{echo|<div>boo</div>
25989 {{!}}b}}
25990 |c
25991 |}
25992 !! end
25993
25994 # --------------------------------------------
25995 # Tests spec'ing wikitext serialization norms |
25996 # --------------------------------------------
25997
25998 !! test
25999 1. Categories should always be serialized on their own line
26000 !! options
26001 parsoid=html2wt
26002 !! html/parsoid
26003 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
26004 !! wikitext
26005 foo
26006 [[Category:Foo]]
26007 bar
26008 !! end
26009
26010 !! test
26011 2. Categories that are part of templates should not introduce a line break
26012 !! wikitext
26013 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
26014 !! html/parsoid
26015 <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>
26016 !! end
26017
26018 # Careful while editing these next 2 tests. There are \u200f characters
26019 # before and after the <link> tags in the HTML and following some
26020 # of the categories in wikitext
26021 # Do not remove these characters in edits.
26022 #
26023 # As part of the serialization, these bidi characters will get stripped.
26024 !! test
26025 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
26026 !! options
26027 parsoid={
26028 "modes": ["html2wt"],
26029 "scrubWikitext": true
26030 }
26031 !! html/parsoid
26032 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
26033 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
26034 !! wikitext
26035 [[קטגוריה:טקסים]]
26036 [[קטגוריה: שיטות משפט]]
26037 !! end
26038
26039 !! test
26040 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
26041 !! options
26042 parsoid={
26043 "modes": ["html2wt"],
26044 "scrubWikitext": true
26045 }
26046 !! html/parsoid
26047 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
26048 !! wikitext
26049 [[קטגוריה:טקסים]]
26050 ‏y
26051 !! end
26052
26053 !! test
26054 Lists: Add space after bullets
26055 !! options
26056 parsoid=html2wt
26057 !! html/parsoid
26058 <ul>
26059 <li>foo</li>
26060 <li> bar</li>
26061 <li><span> baz</span></li>
26062 </ul>
26063 !! wikitext
26064 * foo
26065 * bar
26066 * <span> baz</span>
26067 !! end
26068
26069 !! test
26070 1. Headings: Add space before/after == (T53744)
26071 !! options
26072 parsoid=html2wt
26073 !! html/parsoid
26074 <h2>foo</h2>
26075 <h2> bar</h2>
26076 <h2>baz </h2>
26077 <h2><span> baz</span></h2>
26078 !! wikitext
26079 == foo ==
26080
26081 == bar ==
26082
26083 == baz ==
26084
26085 == <span> baz</span> ==
26086 !! end
26087
26088 !! test
26089 2. Headings: Add space before/after == even after hoisted content
26090 !! options
26091 parsoid={
26092 "modes": ["html2wt"],
26093 "scrubWikitext": true
26094 }
26095 !! html/parsoid
26096 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
26097 !! wikitext
26098 [[Category:A2]]
26099
26100 == ok ==
26101 !! end
26102
26103 !! test
26104 1. Headings: suppress newly created empty headings
26105 !! options
26106 parsoid={
26107 "modes": ["html2wt"],
26108 "scrubWikitext": true
26109 }
26110 !! html/parsoid
26111 <h2></h2>
26112 !! wikitext
26113 !! end
26114
26115 !! test
26116 2. Headings: don't suppress empty headings if scrubWikitext is false
26117 !! options
26118 parsoid=html2wt
26119 !! html/parsoid
26120 <h2></h2>
26121 !! wikitext
26122 ==<nowiki/>==
26123 !! end
26124
26125 !! test
26126 3. Headings: suppress empty headings on edits
26127 !! options
26128 parsoid={
26129 "modes": ["selser"],
26130 "scrubWikitext": true,
26131 "changes": [
26132 [ "#x", "remove"]
26133 ]
26134 }
26135 !! wikitext
26136 ==<span id="x">foo</span>==
26137 !! wikitext/edited
26138 !! end
26139
26140 !! test
26141 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
26142 !! options
26143 parsoid={
26144 "modes": ["html2wt"],
26145 "scrubWikitext": true
26146 }
26147 !! html/parsoid
26148 <h2>foo<br/>bar</h2>
26149 <h2>foo <span><br/>bar</span> baz</h2>
26150 !! wikitext
26151 == foo bar ==
26152
26153 == foo <span> bar</span> baz ==
26154 !! end
26155
26156 !! test
26157 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
26158 !! options
26159 parsoid={
26160 "modes": ["html2wt"],
26161 "scrubWikitext": false
26162 }
26163 !! html/parsoid
26164 <h2>foo<br/>bar</h2>
26165 !! wikitext
26166 == foo<br> bar ==
26167 !! end
26168
26169 !! test
26170 1. WT Quote Tags: suppress newly created empty style tags
26171 !! options
26172 parsoid={
26173 "modes": ["html2wt"],
26174 "scrubWikitext": true
26175 }
26176 !! html/parsoid
26177 <i></i><b></b>
26178 !! wikitext
26179 !! end
26180
26181 !! test
26182 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
26183 !! options
26184 parsoid=html2wt
26185 !! html/parsoid
26186 <i></i><b></b>
26187 !! wikitext
26188 ''<nowiki/>'''''<nowiki/>'''
26189 !! end
26190
26191 !! test
26192 3. WT Quote Tags: suppress empty style tags on edits
26193 !! options
26194 parsoid={
26195 "modes": ["selser"],
26196 "scrubWikitext": true,
26197 "changes": [
26198 [ "#x", "remove"]
26199 ]
26200 }
26201 !! wikitext
26202 '''<span id="x">foo</span>'''
26203 !! wikitext/edited
26204 !! end
26205
26206 !! test
26207 1. Anchors: suppress newly created empty anchors
26208 !! options
26209 parsoid={
26210 "modes": ["html2wt"],
26211 "scrubWikitext": true
26212 }
26213 !! html/parsoid
26214 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26215 !! wikitext
26216 !! end
26217
26218 !! test
26219 2. Anchors: don't suppress empty anchors if scrubWikitext is false
26220 !! options
26221 parsoid={
26222 "modes": ["html2wt"],
26223 "scrubWikitext": false
26224 }
26225 !! html/parsoid
26226 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26227 !! wikitext
26228 [[Test|<nowiki/>]]
26229 !! end
26230
26231 !! test
26232 3. Anchors: suppress empty anchors on edits
26233 !! options
26234 parsoid={
26235 "modes": ["selser"],
26236 "scrubWikitext": true,
26237 "changes": [
26238 [ "#x", "remove"]
26239 ]
26240 }
26241 !! wikitext
26242 [[Test|<span id="x">foo</span>]]
26243 !! wikitext/edited
26244 !! end
26245
26246 !! test
26247 3a. Anchors: do not suppress numbered extlinks
26248 !! options
26249 parsoid={
26250 "modes": ["wt2wt"],
26251 "scrubWikitext": true
26252 }
26253 !! wikitext
26254 [http://foo.com]
26255 !! html/parsoid
26256 <a rel="mw:ExtLink" href="http://foo.com"></a>
26257 !! end
26258
26259 !! test
26260 3b. Anchors: do not suppress numbered extlinks
26261 !! options
26262 parsoid={
26263 "modes": ["wt2wt"],
26264 "scrubWikitext": true,
26265 "changes": [
26266 [ "#x", "remove"]
26267 ]
26268 }
26269 !! wikitext
26270 [http://foo.com <span id="x">foo</span>]
26271 !! wikitext/edited
26272 [http://foo.com]
26273 !! end
26274
26275 !!test
26276 Normalizations should be restricted to edited content
26277 !!options
26278 parsoid={
26279 "modes": ["selser"],
26280 "scrubWikitext": true,
26281 "changes": [
26282 [ "h1", "before", "<i></i>"]
26283 ]
26284 }
26285 !!wikitext
26286 a
26287 = =
26288 b
26289 !!wikitext/edited
26290 a
26291 = =
26292 b
26293 !!end
26294
26295 !! test
26296 1. Multiple normalizations (html2wt)
26297 !! options
26298 parsoid={
26299 "modes": ["html2wt"],
26300 "scrubWikitext": true
26301 }
26302 !! html
26303 <h2><i></i></h2>
26304 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
26305 </a><b><i></i></b>x</p>
26306 !! wikitext
26307
26308 [[foo]]
26309 x
26310
26311 !! end
26312
26313 !! test
26314 2. Multiple normalizations (selser)
26315 !! options
26316 parsoid={
26317 "modes": ["selser"],
26318 "scrubWikitext": true,
26319 "changes": [
26320 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
26321 ]
26322 }
26323 !! wikitext
26324 <span id="x">foo</span>
26325 !! wikitext/edited
26326 <span id="x">foo</span>
26327
26328 x
26329 !! end
26330
26331 !! test
26332 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
26333 !! options
26334 parsoid={
26335 "modes": ["html2wt"],
26336 "scrubWikitext": true
26337 }
26338 !! html/parsoid
26339 <p> hi</p>
26340 <p> hello</p>
26341 !! wikitext
26342 hi
26343
26344 hello
26345 !! end
26346
26347 !! test
26348 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
26349 !! options
26350 parsoid=html2wt
26351 !! html/parsoid
26352 <p> hi</p>
26353 <p> hello</p>
26354 !! wikitext
26355 <nowiki> </nowiki>hi
26356
26357 <nowiki> </nowiki> hello
26358 !! end
26359
26360 !! test
26361 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
26362 !! options
26363 parsoid={
26364 "modes": ["html2wt"],
26365 "scrubWikitext": true
26366 }
26367 !! html/parsoid
26368 <p>Foo
26369 bar
26370 baz</p>
26371
26372 <table><tr><td>Foo
26373 bar
26374 baz bang</td></tr></table>
26375
26376 <p><!--boo--> foo
26377 bar</p>
26378
26379 <p> foo
26380 bar<span>boo</span></p>
26381 !! wikitext
26382 Foo
26383 bar
26384 baz
26385
26386 {|
26387 |Foo
26388 bar
26389 baz bang
26390 |}
26391
26392 <!--boo-->foo
26393 bar
26394
26395 foo
26396 bar<span>boo</span>
26397 !! end
26398
26399 !! test
26400 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
26401 !! options
26402 parsoid={
26403 "modes": ["selser"],
26404 "scrubWikitext": true,
26405 "changes": [
26406 [ "p", "html", " a\n b" ]
26407 ]
26408 }
26409 !! wikitext
26410 xyz
26411 !! wikitext/edited
26412 a
26413 b
26414 !! end
26415
26416 !! test
26417 1. New links that end in spaces
26418 !! options
26419 parsoid={
26420 "modes": ["html2wt"],
26421 "scrubWikitext": false
26422 }
26423 !! html/parsoid
26424 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26425 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26426 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26427 !! wikitext
26428 [[Berlin ]]<nowiki/>is the capital of Germany.
26429
26430 [[Foo ]]'''bar'''
26431
26432 [[Boston ]] is a city.
26433 !! end
26434
26435 !! test
26436 2. New links that end in spaces
26437 !! options
26438 parsoid={
26439 "modes": ["html2wt"],
26440 "scrubWikitext": true
26441 }
26442 !! html/parsoid
26443 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26444 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26445 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26446 !! wikitext
26447 [[Berlin]] is the capital of Germany.
26448
26449 [[Foo]] '''bar'''
26450
26451 [[Boston]] is a city.
26452 !! end
26453
26454 !! test
26455 1. Table cells with escapable prefixes
26456 !! options
26457 parsoid={
26458 "modes": ["html2wt"],
26459 "scrubWikitext": false
26460 }
26461 !! html
26462 <table>
26463 <tr><td>a</td></tr>
26464 <tr><td>-</td></tr>
26465 <tr><td>+</td></tr>
26466 </table>
26467 !! wikitext
26468 {|
26469 |a
26470 |-
26471 |<nowiki>-</nowiki>
26472 |-
26473 |<nowiki>+</nowiki>
26474 |}
26475 !! end
26476
26477 !! test
26478 2. Table cells with escapable prefixes
26479 !! options
26480 parsoid={
26481 "modes": ["html2wt"],
26482 "scrubWikitext": true
26483 }
26484 !! html
26485 <table>
26486 <tr><td>a</td></tr>
26487 <tr><td>-</td></tr>
26488 <tr><td>+</td></tr>
26489 </table>
26490 !! wikitext
26491 {|
26492 |a
26493 |-
26494 | -
26495 |-
26496 | +
26497 |}
26498 !! end
26499
26500 !! test
26501 3a. Table cells with escapable prefixes after edits
26502 !! options
26503 parsoid={
26504 "modes": ["selser"],
26505 "scrubWikitext": true,
26506 "changes": [
26507 [ "table tbody tr:first-child td:first-child", "remove"]
26508 ]
26509 }
26510 !! wikitext
26511 {|
26512 |a||-
26513 |}
26514 !! wikitext/edited
26515 {|
26516 | -
26517 |}
26518 !! end
26519
26520 !! test
26521 3b. Table cells with escapable prefixes after edits
26522 !! options
26523 parsoid={
26524 "modes": ["selser"],
26525 "scrubWikitext": true,
26526 "changes": [
26527 [ "table tbody tr:first-child td:first-child", "html", "-" ],
26528 [ "#x", "remove" ]
26529 ]
26530 }
26531 !! wikitext
26532 {|
26533 |pqr
26534 |<span id="x">foo</span>+
26535 |}
26536 !! wikitext/edited
26537 {|
26538 | -
26539 | +
26540 |}
26541 !! end
26542
26543 # FIXME: This test will fail because
26544 # normalization doesn't realize that the id attribute
26545 # will eliminate the escapable scenario
26546 !! test
26547 4a. Table cells without escapable prefixes after edits
26548 !! options
26549 parsoid={
26550 "modes": ["selser"],
26551 "scrubWikitext": true,
26552 "changes": [
26553 [ "#x", "html", "-" ]
26554 ]
26555 }
26556 !! wikitext
26557 {|
26558 | id="x" |abcd
26559 |}
26560 !! wikitext/edited
26561 {|
26562 | id="x" |-
26563 |}
26564 !! end
26565
26566 ## This tests normalizer's ability to discriminate between
26567 ## cells having identical content.
26568 !! test
26569 4b. Table cells without escapable prefixes after edits
26570 !! options
26571 parsoid={
26572 "modes": ["selser"],
26573 "scrubWikitext": true,
26574 "changes": [
26575 [ "td", "html", "-" ]
26576 ]
26577 }
26578 !! wikitext
26579 {|
26580 |a||b
26581 |}
26582 !! wikitext/edited
26583 {|
26584 | -||-
26585 |}
26586 !! end
26587
26588 ## This tests normalizer's ability to not be tripped by
26589 ## comments (and whitespace)
26590 !! test
26591 4c. Table cells without escapable prefixes after edits
26592 !! options
26593 parsoid={
26594 "modes": ["selser"],
26595 "scrubWikitext": true,
26596 "changes": [
26597 [ "table tbody tr td:first-child", "remove" ]
26598 ]
26599 }
26600 !! wikitext
26601 {|
26602 |-
26603 <!--foo--> |a||-
26604 |}
26605 !! wikitext/edited
26606 {|
26607 |-
26608 <!--foo--> | -
26609 |}
26610 !! end
26611
26612 ## This tests normalizer's ability to handle HTML cells
26613 !! test
26614 4d. Table cells without escapable prefixes after edits
26615 !! options
26616 parsoid={
26617 "modes": ["selser"],
26618 "scrubWikitext": true,
26619 "changes": [
26620 [ "td", "html", "-" ]
26621 ]
26622 }
26623 !! wikitext
26624 <table>
26625 <tr><td>a</td></tr>
26626 </table>
26627 !! wikitext/edited
26628 <table>
26629 <tr><td>-</td></tr>
26630 </table>
26631 !! end
26632
26633 ## T111151 Remove font elements without attributes
26634 !! test
26635 5a. font tags without attributes should be dropped in scrubWikitext mode
26636 !! options
26637 parsoid={
26638 "modes": ["html2wt"],
26639 "scrubWikitext": true
26640 }
26641 !! html
26642 <font>foo</font>
26643 <font><font>bar</font></font>
26644 <font class="x">boo</font>
26645 !! wikitext
26646 foo
26647 bar
26648 <font class="x">boo</font>
26649 !! end
26650
26651 !! test
26652 5b. font tags should not be dropped without scrubWikitext being enabled
26653 !! options
26654 parsoid={
26655 "modes": ["html2wt"],
26656 "scrubWikitext": false
26657 }
26658 !! html
26659 <font>foo</font>
26660 !! wikitext
26661 <font>foo</font>
26662 !! end
26663
26664 !! test
26665 Escape nowiki DOM elements
26666 !! options
26667 parsoid=html2wt
26668 !! html/parsoid
26669 <nowiki><i>foo</i></nowiki>
26670 !! wikitext
26671 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
26672 !! end
26673
26674 # This is meant to be an interim fix while we go about figuring out
26675 # how to not introduce these trailing <nowiki/>s in the first place.
26676 !! test
26677 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
26678 !! options
26679 parsoid=html2wt
26680 !! html/parsoid
26681 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
26682 y</p>
26683 <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>
26684 <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>
26685 !! wikitext
26686 x
26687 y
26688
26689 {{echo|
26690 1 = <nowiki/>}}
26691
26692 {{echo|
26693 1 = <nowiki/>
26694 }}
26695 !! end
26696
26697 # ---------------------------------------------------
26698 # End of tests spec'ing wikitext serialization norms |
26699 # ---------------------------------------------------
26700
26701 # T104032
26702 !! test
26703 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
26704 !! options
26705 parsoid=html2wt
26706 !! html/parsoid
26707 a<p>b</p>
26708 <b>c</b><p>d</p>
26709 <table><tr>
26710 <td>a<p>b</p></td>
26711 <td><b>c</b><p>d</p></td>
26712 </tr></table>
26713 !! wikitext
26714 a
26715
26716 b
26717
26718 '''c'''
26719
26720 d
26721 {|
26722 |a
26723 b
26724 |'''c'''
26725 d
26726 |}
26727 !! end
26728
26729 # -----------------------------------------------------------------
26730 # End of section for Parsoid-only html2wt tests for serialization
26731 # of new content
26732 # -----------------------------------------------------------------
26733
26734 # -----------------------------------------------------------------
26735 # The following section of tests are primarily to spec behavior of
26736 # the selective serializer. All these tests have manual selser
26737 # changes. The automated selser changes for all tests handle the
26738 # wide variation of changes, but these tests here capture specs
26739 # deterministically.
26740 # ----------------------------------------------------------------
26741
26742 ## T90517
26743 !! test
26744 Selser: New comments should not be lost
26745 !! options
26746 parsoid={
26747 "modes": ["selser"],
26748 "changes": [
26749 [ "#a", "after", "<!--c1-->" ],
26750 [ "#b", "before", "<!--c2-->" ]
26751 ]
26752 }
26753 !! wikitext
26754 <span id="a">a</span>
26755
26756 <span id="b">b</span>
26757 !! wikitext/edited
26758 <span id="a">a</span><!--c1-->
26759
26760 <!--c2--><span id="b">b</span>
26761 !! end
26762
26763 ## T89383
26764 !! test
26765 Selser: Check for validity of DSR before using it
26766 !! options
26767 parsoid={
26768 "modes": ["selser"],
26769 "changes": [
26770 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
26771 ]
26772 }
26773 !! wikitext
26774 <span id="a">a</span>
26775 !! wikitext/edited
26776 {{DISPLAYTITLE:foo}}
26777 <span id="a">a</span>
26778 !! end
26779
26780 !! test
26781 1. DOMDiff: Changes to <ref> content should be looked up using id
26782 !! options
26783 parsoid={
26784 "modes": ["selser"],
26785 "changes": [
26786 ["#X", "after", "bar"],
26787 ["#Y", "after", "baz"]
26788 ]
26789 }
26790 !! wikitext
26791 X <ref><span id="X">foo</span></ref>
26792 Y <ref name="a" />
26793 <references>
26794 <ref name="a"><span id="Y">foo</span></ref>
26795 </references>
26796 !! wikitext/edited
26797 X <ref><span id="X">foo</span>bar</ref>
26798 Y <ref name="a" />
26799 <references>
26800 <ref name="a"><span id="Y">foo</span>baz</ref>
26801 </references>
26802 !! end
26803
26804 !! test
26805 2. DOMDiff: Changes to <ref> content should be looked up using id
26806 !! options
26807 parsoid={
26808 "modes": ["selser"],
26809 "changes": [
26810 ["#Z", "after", "bar"]
26811 ]
26812 }
26813 !! wikitext
26814 A <ref>foo bar for a</ref>
26815 B <ref group="X" name="b" />
26816
26817 <references />
26818
26819 <references group="X">
26820 <ref name="b"><span id="Z">foo</span></ref>
26821 </references>
26822 !! wikitext/edited
26823 A <ref>foo bar for a</ref>
26824 B <ref group="X" name="b" />
26825
26826 <references />
26827
26828 <references group="X">
26829 <ref name="b"><span id="Z">foo</span>bar</ref>
26830 </references>
26831 !! end
26832
26833 !! test
26834 Empty LI (T49673)
26835 !! wikitext
26836 * a
26837 *
26838 *
26839 * b
26840 !! html/php+tidy
26841 <ul>
26842 <li>a</li>
26843 <li class="mw-empty-li"></li>
26844 <li class="mw-empty-li"></li>
26845 <li>b</li>
26846 </ul>
26847 !! end