Merge "Add GENDER support for "you are blocked" messages in ChangeTags"
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from https://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # (ignored by Parsoid, since it emits <link>s)
18 # ill add inter-language links
19 # (ignored by Parsoid, since it emits <link>s)
20 # subpage enable subpages (disabled by default)
21 # title=[[XXX]] run test using article title XXX
22 # language=XXX set content language to XXX for this test
23 # variant=XXX set the variant of language for this test (eg zh-tw)
24 # disabled do not run test
25 # parsoid parsoid-specific options (not run by PHP parser unless
26 # the test includes an html/php section)
27 # php php-only test (not run by the parsoid parser unless
28 # the test includes an html/parsoid section)
29 # showtitle make the first line the title
30 # showindicators make the first lines the page status indicators
31 # comment run through Linker::formatComment() instead of main parser
32 # local format section links in edit comment text as local links
33 # notoc disable table of contents
34 # thumbsize=NNN set the default thumb size to NNNpx for this test
35 #
36 # You can also set the following parser properties via test options:
37 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
38 # wgLinkHolderBatchSize, wgRawHtml, wgInterwikiMagic,
39 # wgEnableMagicLinks
40 #
41 # For testing purposes, temporary articles can created:
42 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
43 # where '/' denotes a newline.
44
45 # This is the standard article assumed to exist.
46 !! article
47 Main Page
48 !! text
49 blah blah
50 !! endarticle
51
52 !!article
53 Foo
54 !!text
55 FOO
56 !!endarticle
57
58 !!article
59 Template:Foo
60 !!text
61 FOO
62 !!endarticle
63
64 !! article
65 Template:Blank
66 !! text
67 !! endarticle
68
69 !! article
70 Template:pipe
71 !! text
72 |
73 !! endarticle
74
75 !! article
76 Template:=
77 !! text
78 <nowiki>=</nowiki>
79 !! endarticle
80
81 !!article
82 MediaWiki:bad image list
83 !!text
84 * [[File:Bad.jpg]] except [[Nasty page]]
85 !!endarticle
86
87 !! article
88 Template:inner list
89 !! text
90 * item 1
91 !! endarticle
92
93 !! article
94 Template:tbl-start
95 !! text
96 {|
97 !! endarticle
98
99 !! article
100 Template:tbl-end
101 !! text
102 |}
103 !! endarticle
104
105 !! article
106 Template:echo
107 !! text
108 {{{1}}}
109 !! endarticle
110
111 !! article
112 Template:echo_with_span
113 !! text
114 <span>{{{1}}}</span>
115 !! endarticle
116
117 !! article
118 Template:echo_with_div
119 !! text
120 <div>{{{1}}}</div>
121 !! endarticle
122
123 !! article
124 Template:blank_param
125 !! text
126 {{{1}}}
127 {{{}}}
128 !! endarticle
129
130 !! article
131 Template:table_attribs
132 !! text
133 <noinclude>
134 |</noinclude>style="color:red;"|Foo
135 !! endarticle
136
137 !! article
138 Template:table_attribs_2
139 !! text
140 <noinclude>
141 |</noinclude>style="color:red;"|Foo
142 |Bar||Baz
143 !! endarticle
144
145 !! article
146 Template:table_attribs_3
147 !! text
148 <noinclude>
149 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
150 !! endarticle
151
152 !! article
153 Template:table_attribs_4
154 !! text
155 | style="background-color:#DC241f;" width="10px" |
156 !! endarticle
157
158 !! article
159 Template:table_attribs_5
160 !! text
161 <noinclude>
162 |</noinclude>style="color:red;"||Bar
163 !! endarticle
164
165 !! article
166 Template:table_attribs_6
167 !! text
168 style="background: <nowiki>
169
170
171 red;</nowiki>" |
172 !! endarticle
173
174 !! article
175 Template:table_attribs_7
176 !! text
177 <noinclude>
178 |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
179 !! endarticle
180
181 !! article
182 Template:table_header_cells
183 !! text
184 {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
185 !! endarticle
186
187 !! article
188 Template:table_cells
189 !! text
190 {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
191 !! endarticle
192
193 !! article
194 Template:PartialTable
195 !! text
196 {|
197 |-
198 !! endarticle
199
200 !! article
201 Template:image_attribs
202 !! text
203 <noinclude>
204 [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
205 !! endarticle
206
207 ## See T48811 for details
208 !! article
209 Template:mixed_attr_content_template
210 !! text
211 style="color:red;" title="T48811"
212 |-
213 |foo
214 !! endarticle
215
216 !! article
217 Template:definition_list
218 !! text
219 one
220 ::two
221 !! endarticle
222
223 !! article
224 A?b
225 !! text
226 Weirdo titles!
227 !! endarticle
228
229 !!article
230 Template:Bullet
231 !!text
232 * Bar
233 !!endarticle
234
235 !!article
236 Template:OpenTable
237 !!text
238 {|
239 !!endarticle
240
241 !!article
242 Template:EmptyLITest
243 !!text
244 *a
245 *
246 *
247 *b
248 !!endarticle
249
250 !!article
251 Template:EmptyTRTest
252 !!text
253 {|
254 |-
255 |-
256 |foo
257 |-
258 |-
259 |bar
260 |}
261 !!endarticle
262
263 !!article
264 Template:EmptyTRWithHTMLAttrTest
265 !!text
266 <table>
267 <tr align="center"></tr>
268 <tr><td>foo</td></tr>
269 <tr align="center"></tr>
270 <tr><td>bar</td></tr>
271 </table>
272 !!endarticle
273
274 ###
275 ### Basic tests
276 ###
277 !! test
278 Blank input
279 !! wikitext
280 !! html
281 !! end
282
283
284 !! test
285 Simple paragraph
286 !! wikitext
287 This is a simple paragraph.
288 !! html
289 <p>This is a simple paragraph.
290 </p>
291 !! end
292
293 !! test
294 Paragraphs with extra newline spacing
295 !! wikitext
296 foo
297
298 bar
299
300
301 baz
302
303
304
305 booz
306 !! html
307 <p>foo
308 </p><p>bar
309 </p><p><br />
310 baz
311 </p><p><br />
312 </p><p>booz
313 </p>
314 !! end
315
316 !! test
317 Paragraphs with newline spacing with comment lines in between
318 !! wikitext
319 ----
320 a
321 <!--foo-->
322 b
323 ----
324 a
325 <!--foo--><!--More than 1 comment, still stripped-->
326 b
327 ----
328 a
329 <!--foo--> <!----> <!-- bar -->
330 b
331 ----
332 a
333 <!--foo-->
334
335 b
336 ----
337 a
338
339 <!--foo-->
340 b
341 ----
342 a
343 <!--foo-->
344
345
346 b
347 ----
348 a
349
350
351 <!--foo-->
352 b
353 ----
354 !! html
355 <hr />
356 <p>a
357 b
358 </p>
359 <hr />
360 <p>a
361 b
362 </p>
363 <hr />
364 <p>a
365 b
366 </p>
367 <hr />
368 <p>a
369 </p><p>b
370 </p>
371 <hr />
372 <p>a
373 </p><p>b
374 </p>
375 <hr />
376 <p>a
377 </p><p><br />
378 b
379 </p>
380 <hr />
381 <p>a
382 </p><p><br />
383 b
384 </p>
385 <hr />
386
387 !! end
388
389 !! test
390 Paragraphs with newline spacing with non-empty white-space lines in between
391 !! wikitext
392 ----
393 a
394
395 b
396 ----
397 a
398
399
400 b
401 ----
402 !! html
403 <hr />
404 <p>a
405 </p><p>b
406 </p>
407 <hr />
408 <p>a
409 </p><p><br />
410 b
411 </p>
412 <hr />
413
414 !! end
415
416 !! test
417 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
418 !! wikitext
419 ----
420 a
421 <!--foo-->
422 b
423 ----
424 a
425 <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
426 b
427 ----
428 a
429
430 <!--foo-->
431 <!--bar-->
432 b
433 ----
434 a
435
436 <!--foo-->
437 <!--bar-->
438
439 b
440 ----
441 !! html
442 <hr />
443 <p>a
444 b
445 </p>
446 <hr />
447 <p>a
448 b
449 </p>
450 <hr />
451 <p>a
452 </p><p>b
453 </p>
454 <hr />
455 <p>a
456 </p><p><br />
457 b
458 </p>
459 <hr />
460
461 !! end
462
463 !! test
464 Extra newlines: More paragraphs with indented comment
465 !! wikitext
466 a
467
468 <!--boo-->
469
470 b
471 !! html
472 <p>a
473 </p><p><br />
474 b
475 </p>
476 !!end
477
478 !! test
479 Extra newlines followed by heading
480 !! wikitext
481 a
482
483
484
485 =b=
486 [[a]]
487
488
489 =b=
490 !! html
491 <p>a
492 </p><p><br />
493 </p>
494 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
495 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
496 </p><p><br />
497 </p>
498 <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
499
500 !! end
501
502 !! test
503 Extra newlines between heading and content are swallowed
504 !! wikitext
505 =b=
506
507
508
509 [[a]]
510 !! html
511 <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
512 <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
513 </p>
514 !! end
515
516 !! test
517 Parsing an URL
518 !! wikitext
519 http://fr.wikipedia.org/wiki/🍺
520 <!-- EasterEgg we love beer, better be able be able to link to it -->
521 !! html
522 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
523 </p>
524 !! end
525
526 # Note that the html+tidy output removes the spaces after the <li>,
527 # which is a bug (https://sourceforge.net/p/tidy/bugs/945/, etc).
528 # This is an issue for all tests with lists. We intentionally do
529 # *not* add html+tidy clauses for these, as we don't want to
530 # document/test the broken behavior. (Parsoid matches the non-tidy
531 # output in these cases.)
532
533 !! test
534 Simple list
535 !! wikitext
536 * Item 1
537 * Item 2
538 !! html
539 <ul><li> Item 1</li>
540 <li> Item 2</li></ul>
541
542 !! end
543
544 !! test
545 Italics and bold
546 !! wikitext
547 * plain
548 * plain''italic''plain
549 * plain''italic''plain''italic''plain
550 * plain'''bold'''plain
551 * plain'''bold'''plain'''bold'''plain
552 * plain''italic''plain'''bold'''plain
553 * plain'''bold'''plain''italic''plain
554 * plain''italic'''bold-italic'''italic''plain
555 * plain'''bold''bold-italic''bold'''plain
556 * plain'''''bold-italic'''italic''plain
557 * plain'''''bold-italic''bold'''plain
558 * plain''italic'''bold-italic'''''plain
559 * plain'''bold''bold-italic'''''plain
560 * plain l'''italic''plain
561 * plain l''''bold''' plain
562 !! html
563 <ul><li> plain</li>
564 <li> plain<i>italic</i>plain</li>
565 <li> plain<i>italic</i>plain<i>italic</i>plain</li>
566 <li> plain<b>bold</b>plain</li>
567 <li> plain<b>bold</b>plain<b>bold</b>plain</li>
568 <li> plain<i>italic</i>plain<b>bold</b>plain</li>
569 <li> plain<b>bold</b>plain<i>italic</i>plain</li>
570 <li> plain<i>italic<b>bold-italic</b>italic</i>plain</li>
571 <li> plain<b>bold<i>bold-italic</i>bold</b>plain</li>
572 <li> plain<i><b>bold-italic</b>italic</i>plain</li>
573 <li> plain<b><i>bold-italic</i>bold</b>plain</li>
574 <li> plain<i>italic<b>bold-italic</b></i>plain</li>
575 <li> plain<b>bold<i>bold-italic</i></b>plain</li>
576 <li> plain l'<i>italic</i>plain</li>
577 <li> plain l'<b>bold</b> plain</li></ul>
578
579 !! end
580
581 # this example taken from the [[simple:Moon]] article (bug 47326)
582 !! test
583 Italics and possessives (1)
584 !! wikitext
585 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
586 !! html
587 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
588 </p>
589 !! end
590
591 # this example taken from [[en:Flaming Pie]] (bug 49926)
592 !! test
593 Italics and possessives (2)
594 !! wikitext
595 '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
596 !! html
597 <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
598 </p>
599 !! end
600
601 # this example taken from [[en:Dictionary]] (bug 49926)
602 !! test
603 Italics and possessives (3)
604 !! wikitext
605 The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[[Accademia della Crusca]]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''.
606 !! html
607 <p>The first monolingual dictionary written in a Romance language was <i>Sebastián Covarrubias'</i> <i>Tesoro de la lengua castellana o española</i>, published in 1611 in Madrid. In 1612 the first edition of the <i>Vocabolario dell'<a href="/index.php?title=Accademia_della_Crusca&amp;action=edit&amp;redlink=1" class="new" title="Accademia della Crusca (page does not exist)">Accademia della Crusca</a></i>, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the <i>Dictionnaire Universel</i>.
608 </p>
609 !! end
610
611
612 ###
613 ### 2-quote opening sequence tests
614 ###
615 !! test
616 Italics and bold: 2-quote opening sequence: (2,2)
617 !! wikitext
618 ''foo''
619 !! html
620 <p><i>foo</i>
621 </p>
622 !!end
623
624 !! test
625 Italics and bold: 2-quote opening sequence: (2,3)
626 !! wikitext
627 ''foo'''
628 !! html/*
629 <p><i>foo'</i>
630 </p>
631 !!end
632
633 !! test
634 Italics and bold: 2-quote opening sequence: (2,4)
635 !! options
636 parsoid=wt2html
637 !! wikitext
638 ''foo''''
639 !! html/*
640 <p><i>foo''</i>
641 </p>
642 !!end
643
644 # same html as previous, but wikitext adjusted to match parsoid html2wt
645 !! test
646 Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
647 !! wikitext
648 ''foo<nowiki>''</nowiki>''
649 !! html
650 <p><i>foo''</i>
651 </p>
652 !! end
653
654 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
655 !! test
656 Italics and bold: 2-quote opening sequence: (2,5)
657 !! options
658 parsoid=wt2html
659 !! wikitext
660 ''foo'''''
661 !! html/php
662 <p><i>foo</i>
663 </p>
664 !! html/parsoid
665 <p><i>foo</i><b></b>
666 </p>
667 !!end
668
669 # same html as previous, but wikitext adjusted to match parsoid html2wt
670 !! test
671 Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
672 !! wikitext
673 ''foo'''''<nowiki/>'''
674 !! html/php
675 <p><i>foo</i>
676 </p>
677 !! html/parsoid
678 <p><i>foo</i><b></b>
679 </p>
680 !! end
681
682
683 ###
684 ### 3-quote opening sequence tests
685 ###
686
687 !! test
688 Italics and bold: 3-quote opening sequence: (3,2)
689 !! wikitext
690 '''foo''
691 !! html/*
692 <p>'<i>foo</i>
693 </p>
694 !!end
695
696 !! test
697 Italics and bold: 3-quote opening sequence: (3,3)
698 !! wikitext
699 '''foo'''
700 !! html
701 <p><b>foo</b>
702 </p>
703 !!end
704
705 !! test
706 Italics and bold: 3-quote opening sequence: (3,4)
707 !! wikitext
708 '''foo''''
709 !! html/*
710 <p><b>foo'</b>
711 </p>
712 !!end
713
714 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
715 !! test
716 Italics and bold: 3-quote opening sequence: (3,5)
717 !! options
718 parsoid=wt2html
719 !! wikitext
720 '''foo'''''
721 !! html/php
722 <p><b>foo</b>
723 </p>
724 !! html/parsoid
725 <p><b>foo</b><i></i>
726 </p>
727 !!end
728
729 # same html as previous, but wikitext adjusted to match parsoid html2wt
730 !! test
731 Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
732 !! wikitext
733 '''foo'''''<nowiki/>''
734 !! html/php
735 <p><b>foo</b>
736 </p>
737 !! html/parsoid
738 <p><b>foo</b><i></i>
739 </p>
740 !! end
741
742
743 ###
744 ### 4-quote opening sequence tests
745 ###
746
747 !! test
748 Italics and bold: 4-quote opening sequence: (4,2)
749 !! options
750 parsoid=wt2html
751 !! wikitext
752 ''''foo''
753 !! html/*
754 <p>''<i>foo</i>
755 </p>
756 !!end
757
758 # same html as previous, but wikitext adjusted to match parsoid html2wt
759 !! test
760 Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
761 !! wikitext
762 <nowiki>''</nowiki>''foo''
763 !! html
764 <p>''<i>foo</i>
765 </p>
766 !! end
767
768 !! test
769 Italics and bold: 4-quote opening sequence: (4,3)
770 !! wikitext
771 ''''foo'''
772 !! html/*
773 <p>'<b>foo</b>
774 </p>
775 !!end
776
777 !! test
778 Italics and bold: 4-quote opening sequence: (4,4)
779 !! options
780 parsoid=wt2html
781 !! wikitext
782 ''''foo''''
783 !! html/*
784 <p>'<b>foo'</b>
785 </p>
786 !!end
787
788 # same html as previous, but wikitext adjusted to match parsoid html2wt
789 !! test
790 Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
791 !! wikitext
792 '<nowiki/>'''foo''''
793 !! html
794 <p>'<b>foo'</b>
795 </p>
796 !! end
797
798 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
799 !! test
800 Italics and bold: 4-quote opening sequence: (4,5)
801 !! options
802 parsoid=wt2html
803 !! wikitext
804 ''''foo'''''
805 !! html/php
806 <p>'<b>foo</b>
807 </p>
808 !! html/parsoid
809 <p>'<b>foo</b><i></i>
810 </p>
811 !!end
812
813 # same html as previous, but wikitext adjusted to match parsoid html2wt
814 !! test
815 Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
816 !! wikitext
817 '<nowiki/>'''foo'''''<nowiki/>''
818 !! html/php
819 <p>'<b>foo</b>
820 </p>
821 !! html/parsoid
822 <p>'<b>foo</b><i></i>
823 </p>
824 !! end
825
826
827 ###
828 ### 5-quote opening sequence tests
829 ###
830
831 !! test
832 Italics and bold: 5-quote opening sequence: (5,2)
833 !! options
834 parsoid=wt2html
835 !! wikitext
836 '''''foo''
837 !! html/*
838 <p><b><i>foo</i></b>
839 </p>
840 !!end
841
842 # same html as previous, but wikitext adjusted to match parsoid html2wt
843 !! test
844 Italics and bold: 5-quote opening sequence: (5,2+3)
845 !! wikitext
846 '''''foo'''''
847 !! html/*
848 <p><i><b>foo</b></i>
849 </p>
850 !! end
851
852 !! test
853 Italics and bold: 5-quote opening sequence: (5,3)
854 !! options
855 parsoid=wt2html
856 !! wikitext
857 '''''foo'''
858 !! html/*
859 <p><i><b>foo</b></i>
860 </p>
861 !!end
862
863 # same html as previous, but wikitext adjusted to match parsoid html2wt
864 !! test
865 Italics and bold: 5-quote opening sequence: (5,3+2)
866 !! wikitext
867 '''''foo'''''
868 !! html
869 <p><i><b>foo</b></i>
870 </p>
871 !! end
872
873 !! test
874 Italics and bold: 5-quote opening sequence: (5,4)
875 !! options
876 parsoid=wt2html
877 !! wikitext
878 '''''foo''''
879 !! html/*
880 <p><i><b>foo'</b></i>
881 </p>
882 !!end
883
884 !! test
885 Italics and bold: 5-quote opening sequence: (5,5)
886 !! wikitext
887 '''''foo'''''
888 !! html
889 <p><i><b>foo</b></i>
890 </p>
891 !!end
892
893 !! test
894 Italics and bold: 5-quote opening sequence: (5,6)
895 !! wikitext
896 '''''foo''''''
897 !! html/*
898 <p><i><b>foo'</b></i>
899 </p>
900 !! end
901
902 ###
903 ### multiple quote sequences in a line
904 ###
905 !! test
906 Italics and bold: multiple quote sequences: (2,4,2)
907 !! options
908 parsoid=wt2html
909 !! wikitext
910 ''foo''''bar''
911 !! html/*
912 <p><i>foo'<b>bar</b></i>
913 </p>
914 !!end
915
916
917 # same html as previous, but wikitext adjusted to match parsoid html2wt
918 !! test
919 Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
920 !! wikitext
921 ''foo'<nowiki/>'''bar'''''
922 !! html
923 <p><i>foo'<b>bar</b></i>
924 </p>
925 !! end
926
927
928 !! test
929 Italics and bold: multiple quote sequences: (2,4,3)
930 !! options
931 parsoid=wt2html
932 !! wikitext
933 ''foo''''bar'''
934 !! html/*
935 <p><i>foo'<b>bar</b></i>
936 </p>
937 !!end
938
939
940 # same html as previous, but wikitext adjusted to match parsoid html2wt
941 !! test
942 Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
943 !! wikitext
944 ''foo'<nowiki/>'''bar'''''
945 !! html
946 <p><i>foo'<b>bar</b></i>
947 </p>
948 !! end
949
950
951 !! test
952 Italics and bold: multiple quote sequences: (2,4,4)
953 !! options
954 parsoid=wt2html
955 !! wikitext
956 ''foo''''bar''''
957 !! html/*
958 <p><i>foo'<b>bar'</b></i>
959 </p>
960 !!end
961
962
963 # same html as previous, but wikitext adjusted to match parsoid html2wt
964 !! test
965 Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
966 !! wikitext
967 ''foo'<nowiki/>'''bar'<nowiki/>'''''
968 !! html
969 <p><i>foo'<b>bar'</b></i>
970 </p>
971 !! end
972
973
974 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
975 !! test
976 Italics and bold: multiple quote sequences: (3,4,2)
977 !! options
978 parsoid=wt2html
979 !! wikitext
980 '''foo''''bar''
981 !! html/php
982 <p><b>foo'</b>bar
983 </p>
984 !! html/parsoid
985 <p><b>foo'</b>bar<i></i>
986 </p>
987 !!end
988
989 # same html as previous, but wikitext adjusted to match parsoid html2wt
990 !! test
991 Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
992 !! options
993 parsoid
994 !! wikitext
995 '''<nowiki>foo'</nowiki>'''bar''<nowiki/>''
996 !! html/php
997 <p><b>foo'</b>bar
998 </p>
999 !! html/parsoid
1000 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<i></i>
1001 </p>
1002 !! end
1003
1004
1005 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
1006 !! test
1007 Italics and bold: multiple quote sequences: (3,4,3)
1008 !! options
1009 parsoid=wt2html
1010 !! wikitext
1011 '''foo''''bar'''
1012 !! html/php
1013 <p><b>foo'</b>bar
1014 </p>
1015 !! html/parsoid
1016 <p><b>foo'</b>bar<b></b>
1017 </p>
1018 !!end
1019
1020 # same html as previous, but wikitext adjusted to match parsoid html2wt
1021 !! test
1022 Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
1023 !! wikitext
1024 '''<nowiki>foo'</nowiki>'''bar'''<nowiki/>'''
1025 !! html/php
1026 <p><b>foo'</b>bar
1027 </p>
1028 !! html/parsoid
1029 <p><b><span typeof="mw:Nowiki">foo'</span></b>bar<b></b>
1030 </p>
1031 !! end
1032
1033 ###
1034 ### other quote tests
1035 ###
1036 !! test
1037 Italics and bold: other quote tests: (2,3,5)
1038 !! wikitext
1039 ''this is about '''foo's family'''''
1040 !! html
1041 <p><i>this is about <b>foo's family</b></i>
1042 </p>
1043 !!end
1044
1045
1046 !! test
1047 Italics and bold: other quote tests: (2,(3,3),2)
1048 !! wikitext
1049 ''this is about '''foo's''' family''
1050 !! html
1051 <p><i>this is about <b>foo's</b> family</i>
1052 </p>
1053 !!end
1054
1055
1056 !! test
1057 Italics and bold: other quote tests: (3,2,3,2)
1058 !! options
1059 parsoid=wt2html
1060 !! wikitext
1061 '''this is about ''foo'''s family''
1062 !! html/*
1063 <p><b>this is about <i>foo</i></b><i>s family</i>
1064 </p>
1065 !!end
1066
1067
1068 # same html as previous, but wikitext adjusted to match parsoid html2wt
1069 !! test
1070 Italics and bold: other quote tests: (3,2,3+2+2,2)
1071 !! wikitext
1072 '''this is about ''foo'''''<nowiki/>''s family''
1073 !! html
1074 <p><b>this is about <i>foo</i></b><i>s family</i>
1075 </p>
1076 !! end
1077
1078
1079 !! test
1080 Italics and bold: other quote tests: (3,2,3,3)
1081 !! wikitext
1082 '''this is about ''foo'''s family'''
1083 !! html/*
1084 <p>'<i>this is about </i>foo<b>s family</b>
1085 </p>
1086 !!end
1087
1088
1089 !! test
1090 Italics and bold: other quote tests: (3,(2,2),3)
1091 !! wikitext
1092 '''this is about ''foo's'' family'''
1093 !! html
1094 <p><b>this is about <i>foo's</i> family</b>
1095 </p>
1096 !!end
1097
1098
1099 !! test
1100 Italicized possessive
1101 !! wikitext
1102 The ''[[Main Page]]'''s talk page.
1103 !! html/php
1104 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
1105 </p>
1106 !! html/parsoid
1107 <p>The <i><a rel="mw:WikiLink" href="Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
1108 !! end
1109
1110 !! test
1111 Parsoid only: Quote balancing context should be restricted to td/th cells on the same wikitext line
1112 (Requires tidy for PHP parser output to be fixed up)
1113 !! options
1114 parsoid=wt2html,wt2wt
1115 !! wikitext
1116 {|
1117 !''a!!''b
1118 |''a||''b
1119 |}
1120 !! html/php+tidy
1121 <table>
1122 <tr>
1123 <th><i>a</i></th>
1124 <th><i>b</i></th>
1125 <td><i>a</i></td>
1126 <td><i>b</i></td>
1127 </tr>
1128 </table>
1129 !! html/parsoid
1130 <table>
1131 <tbody><tr><th><i>a</i></th><th><i>b</i></th>
1132 <td><i>a</i></td><td><i>b</i></td></tr>
1133 </tbody></table>
1134 !! end
1135
1136 ###
1137 ### Non-html5 tags
1138 ###
1139
1140 !! test
1141 Non-html5 tags should be accepted
1142 !! wikitext
1143 <center>''foo''</center>
1144 <big>''foo''</big>
1145 <font>''foo''</font>
1146 <strike>''foo''</strike>
1147 <tt>''foo''</tt>
1148 !! html
1149 <center><i>foo</i></center>
1150 <p><big><i>foo</i></big>
1151 <font><i>foo</i></font>
1152 <strike><i>foo</i></strike>
1153 <tt><i>foo</i></tt>
1154 </p>
1155 !! end
1156
1157 !! test
1158 <wbr> is valid wikitext (bug 52468)
1159 !! wikitext
1160 <wbr>
1161 !! html
1162 <p><wbr />
1163 </p>
1164 !! end
1165
1166 # <strike> is HTML4, <s> is HTML4/5.
1167 !! test
1168 <s> or <strike> for strikethrough
1169 !! wikitext
1170 <strike>strike</strike>
1171
1172 <s>s</s>
1173 !! html
1174 <p><strike>strike</strike>
1175 </p><p><s>s</s>
1176 </p>
1177 !! end
1178
1179 ## a not permitted
1180 ## i,b,br omitted
1181 !! test
1182 Text-level semantic html elements in wikitext
1183 !! wikitext
1184 <em>text</em>
1185 <strong>text</strong>
1186 <small>text</small>
1187 <s>text</s>
1188 <cite>text</cite>
1189 <q>text</q>
1190 <dfn>text</dfn>
1191 <abbr>text</abbr>
1192 <data>text</data>
1193 <time>text</time>
1194 <code>text</code>
1195 <var>text</var>
1196 <samp>text</samp>
1197 <kbd>text</kbd>
1198 <sub>text</sub>
1199 <u>text</u>
1200 <mark>text</mark>
1201 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1202 <bdi>text</bdi>
1203 <bdo>text</bdo>
1204 <span>text</span>
1205 <wbr />
1206 !! html
1207 <p><em>text</em>
1208 <strong>text</strong>
1209 <small>text</small>
1210 <s>text</s>
1211 <cite>text</cite>
1212 <q>text</q>
1213 <dfn>text</dfn>
1214 <abbr>text</abbr>
1215 <data>text</data>
1216 <time>text</time>
1217 <code>text</code>
1218 <var>text</var>
1219 <samp>text</samp>
1220 <kbd>text</kbd>
1221 <sub>text</sub>
1222 <u>text</u>
1223 <mark>text</mark>
1224 <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
1225 <bdi>text</bdi>
1226 <bdo>text</bdo>
1227 <span>text</span>
1228 <wbr />
1229 </p>
1230 !! end
1231
1232 # test cases taken from
1233 # https://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
1234 !! test
1235 Ruby markup (W3C-style)
1236 !! wikitext
1237 ; Mono-ruby for individual base characters
1238 : <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
1239 ; Group ruby
1240 : <ruby>今日<rt>きょう</rt></ruby>
1241 ; Jukugo ruby
1242 : <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
1243 ; Inline ruby
1244 : <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
1245 ; Double-sided ruby
1246 : <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
1247 <ruby>
1248 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1249 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1250 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1251 </ruby>
1252 !! html
1253 <dl><dt> Mono-ruby for individual base characters</dt>
1254 <dd> <ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
1255 <dt> Group ruby</dt>
1256 <dd> <ruby>今日<rt>きょう</rt></ruby></dd>
1257 <dt> Jukugo ruby</dt>
1258 <dd> <ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
1259 <dt> Inline ruby</dt>
1260 <dd> <ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
1261 <dt> Double-sided ruby</dt>
1262 <dd> <ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby></dd></dl>
1263 <p><ruby>
1264 <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
1265 <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
1266 <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
1267 </ruby>
1268 </p>
1269 !! end
1270
1271 # The next two test different paths in the sanitizer.
1272 !! test
1273 Non-word characters don't terminate tag names (bug 17663, 40670, 52022)
1274 !! wikitext
1275 <blockquote|>a</blockquote>
1276
1277 <b→> doesn't terminate </b→>
1278
1279 <bä> doesn't terminate </bä>
1280
1281 <boo> doesn't terminate </boo>
1282
1283 <s.foo> doesn't terminate </s.foo>
1284
1285 <sub-ID#1>
1286 !! html
1287 <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
1288 </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
1289 </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
1290 </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
1291 </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
1292 </p><p>&lt;sub-ID#1&gt;
1293 </p>
1294 !! end
1295
1296 # There is a tidy bug here: https://sourceforge.net/p/tidy/bugs/946/
1297 # If the non-word-character tag made it through the sanitizer, tidy
1298 # would munge it up.
1299 !! test
1300 Non-word characters don't terminate tag names + tidy
1301 !! wikitext
1302 <blockquote|>a</blockquote>
1303
1304 <b→> doesn't terminate </b→>
1305
1306 <bä> doesn't terminate </bä>
1307
1308 <boo> doesn't terminate </boo>
1309
1310 <s.foo> doesn't terminate </s.foo>
1311
1312 <sub-ID#1>
1313 !! html+tidy
1314 <p>&lt;blockquote|&gt;a</p>
1315 <p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;</p>
1316 <p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;</p>
1317 <p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;</p>
1318 <p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;</p>
1319 <p>&lt;sub-ID#1&gt;</p>
1320 !! end
1321
1322 ###
1323 ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
1324 ### This checks that HTML5 tags (with non-word characters in the tag
1325 ### name) make it safely through the parser -- the Sanitizer will
1326 ### munge them later, as it should.
1327 ###
1328 !! test
1329 Non-word characters are valid in extension tags (T19663)
1330 !! wikitext
1331 <tåg>tåg</tåg>
1332 !! html/php
1333 <pre>
1334 'tåg'
1335 array (
1336 )
1337 </pre>
1338
1339 !! html/parsoid
1340 <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
1341 !! end
1342
1343 !! test
1344 Isolated close tags should be treated as literal text (bug 52760)
1345 !! options
1346 parsoid=wt2html
1347 !! wikitext
1348 </b>
1349
1350 <s.foo>s</s>
1351 !! html/php+tidy
1352 <p>&lt;s.foo&gt;s</p>
1353 !! html/parsoid
1354 <p>&lt;s.foo&gt;s</p>
1355 !! end
1356
1357 ###
1358 ### Special characters
1359 ###
1360
1361 !! test
1362 Bare pipe character (bug 52363)
1363 !! wikitext
1364 |
1365 !! html
1366 <p>|
1367 </p>
1368 !! end
1369
1370 !! test
1371 Bare pipe character from a template (bug 52363)
1372 !! wikitext
1373 {{pipe}}
1374 !! html
1375 <p>|
1376 </p>
1377 !! end
1378
1379 ###
1380 ### <nowiki> test cases
1381 ###
1382
1383 !! test
1384 <nowiki> unordered list
1385 !! wikitext
1386 <nowiki>* This is not an unordered list item.</nowiki>
1387 !! html/php
1388 <p>* This is not an unordered list item.
1389 </p>
1390 !! html/parsoid
1391 <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
1392 !! end
1393
1394 !! test
1395 <nowiki> spacing
1396 !! wikitext
1397 <nowiki>Lorem ipsum dolor
1398
1399 sed abit.
1400 sed nullum.
1401
1402 :and a colon
1403 </nowiki>
1404 !! html/php
1405 <p>Lorem ipsum dolor
1406
1407 sed abit.
1408 sed nullum.
1409
1410 :and a colon
1411
1412 </p>
1413 !! html/parsoid
1414 <p><span typeof="mw:Nowiki">Lorem ipsum dolor
1415
1416 sed abit.
1417 sed nullum.
1418
1419 :and a colon
1420 </span></p>
1421 !! end
1422
1423 !! test
1424 Don't parse <nowiki><span class="error"></nowiki> (T149622)
1425 !! wikitext
1426 <nowiki><span class="error"></nowiki>
1427 !! html/php
1428 <p>&lt;span class="error"&gt;
1429 </p>
1430 !! end
1431
1432 !! test
1433 nowiki 3
1434 !! wikitext
1435 :There is not nowiki.
1436 :There is <nowiki>nowiki</nowiki>.
1437
1438 #There is not nowiki.
1439 #There is <nowiki>nowiki</nowiki>.
1440
1441 *There is not nowiki.
1442 *There is <nowiki>nowiki</nowiki>.
1443 !! html/php
1444 <dl><dd>There is not nowiki.</dd>
1445 <dd>There is nowiki.</dd></dl>
1446 <ol><li>There is not nowiki.</li>
1447 <li>There is nowiki.</li></ol>
1448 <ul><li>There is not nowiki.</li>
1449 <li>There is nowiki.</li></ul>
1450
1451 !! html/parsoid
1452 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1453 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1454
1455 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1456 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1457
1458 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1459 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1460 !! end
1461
1462 !! test
1463 Entities inside <nowiki>
1464 !! wikitext
1465 <nowiki>&lt;</nowiki>
1466 !! html
1467 <p>&lt;
1468 </p>
1469 !! end
1470
1471 !! test
1472 Entities inside template parameters
1473 !! wikitext
1474 {{echo|&ndash;}}
1475 !! html/php+tidy
1476 <p>–</p>
1477 !! html/parsoid
1478 <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>
1479 !! end
1480
1481 !! test
1482 Properly escape nowiki when combined with other wiki markup
1483 !! options
1484 parsoid=html2wt
1485 !! html/parsoid
1486 <p>* &lt;/nowiki&gt; tag</p>
1487 !! wikitext
1488 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1489 !! end
1490
1491 !! test
1492 T93824: Put escaped HTML tags inside nowiki
1493 !! options
1494 parsoid=html2wt
1495 !! html/parsoid
1496 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1497 !! wikitext
1498 <nowiki><h2>foo</h2></nowiki>
1499 !! end
1500
1501 !! test
1502 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1503 !! options
1504 parsoid=html2wt
1505 !! html/parsoid
1506 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1507 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1508 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1509 !! wikitext
1510 This text: L'[[Foo]]
1511 This text: L<nowiki>''</nowiki>[[Foo]]
1512 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1513 !! end
1514
1515 # This test fails because wikitext whitespace is not normalized before comparing.
1516 !! test
1517 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1518 !! options
1519 parsoid=html2wt
1520 !! html/parsoid
1521 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1522 </p>
1523 !! wikitext
1524 This text : L<nowiki>''</nowiki>[[Foo]]
1525 !! end
1526
1527 # This test and the next one are html2wt only as they test that incorrect wikitext
1528 # passed in template arguments gets escaped or wrapped in nowikis where required.
1529 !! test
1530 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1531 !! options
1532 parsoid=html2wt
1533 !! html/parsoid
1534 <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>
1535 <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>
1536 !! wikitext
1537 {{echo|foo{{!}}bar}}
1538 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1539 !! end
1540
1541 !! test
1542 T53961: Output correct nowikis in template arguments
1543 !! options
1544 parsoid=html2wt
1545 !! html/parsoid
1546 <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>
1547 <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>
1548 <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>
1549 <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>
1550 <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>
1551 !! wikitext
1552 {{echo|a [ b}}
1553 {{echo|<nowiki>a }} b</nowiki>}}
1554 {{echo|<nowiki>a [[ b</nowiki>}}
1555 {{echo|<nowiki>a | {{ ]]</nowiki>}}
1556 {{echo|a <nowiki>}</nowiki>}}
1557 !! end
1558
1559 !! test
1560 Cases where "!!" needs nowiki protection
1561 !! options
1562 parsoid=html2wt
1563 !! html/parsoid
1564 <table>
1565 <tr><th>this needs protection !! here</th></tr>
1566 </table>
1567
1568 <table>
1569 <tr><th>this does not need
1570 protection !! here</th></tr>
1571 </table>
1572 !! wikitext
1573 {|
1574 !<nowiki>this needs protection !! here</nowiki>
1575 |}
1576
1577 {|
1578 !this does not need
1579 protection !! here
1580 |}
1581 !! end
1582
1583 ###
1584 ### Comments
1585 ###
1586 !! test
1587 Comments and Indent-Pre
1588 !! wikitext
1589 <!-- comment 1 --> asdf
1590
1591 <!-- comment 1 --> asdf
1592 <!-- comment 2 -->
1593
1594 <!-- comment 1 --> asdf
1595 <!-- comment 2 -->xyz
1596
1597 <!-- comment 1 --> asdf
1598 <!-- comment 2 --> xyz
1599 !! html
1600 <pre>asdf
1601 </pre>
1602 <pre>asdf
1603 </pre>
1604 <pre>asdf
1605 </pre>
1606 <p>xyz
1607 </p>
1608 <pre>asdf
1609 xyz
1610 </pre>
1611 !! end
1612
1613 !! test
1614 Comment test 2a
1615 !! wikitext
1616 asdf
1617 <!-- comment 1 -->
1618 jkl
1619 !! html
1620 <p>asdf
1621 jkl
1622 </p>
1623 !! end
1624
1625 !! test
1626 Comment test 2b
1627 !! wikitext
1628 asdf
1629 <!-- comment 1 -->
1630
1631 jkl
1632 !! html
1633 <p>asdf
1634 </p><p>jkl
1635 </p>
1636 !! end
1637
1638 !! test
1639 Comment test 3
1640 !! wikitext
1641 asdf
1642 <!-- comment 1 -->
1643 <!-- comment 2 -->
1644 jkl
1645 !! html
1646 <p>asdf
1647 jkl
1648 </p>
1649 !! end
1650
1651 !! test
1652 Comment test 4
1653 !! wikitext
1654 asdf<!-- comment 1 -->jkl
1655 !! html
1656 <p>asdfjkl
1657 </p>
1658 !! end
1659
1660 !! test
1661 Comment spacing
1662 !! wikitext
1663 a
1664 <!-- foo --> b <!-- bar -->
1665 c
1666 !! html
1667 <p>a
1668 </p>
1669 <pre> b
1670 </pre>
1671 <p>c
1672 </p>
1673 !! end
1674
1675 !! test
1676 Comment whitespace
1677 !! wikitext
1678 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1679 !! html
1680
1681 !! end
1682
1683 !! test
1684 Comment semantics and delimiters
1685 !! wikitext
1686 <!-- --><!----><!-----><!------>
1687 !! html/php
1688
1689 !! html/parsoid
1690 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1691 !! end
1692
1693 !! test
1694 Comment semantics and delimiters, redux
1695 !! wikitext
1696 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1697 -- foo -- funky huh? ... -->
1698 !! html/php
1699
1700 !! html/parsoid
1701 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1702 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1703 !! end
1704
1705 !! test
1706 Comment semantics and delimiters: directors cut
1707 !! wikitext
1708 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1709 everything starting with < followed by !-- until the first -- and > we see,
1710 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1711 -->-->
1712 !! html/php
1713 <p>--&gt;
1714 </p>
1715 !! html/parsoid
1716 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1717 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1718 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1719 --><p>--></p>
1720 !! end
1721
1722 !! test
1723 Comment semantics: nesting
1724 !! wikitext
1725 <!--<!-- no, we're not going to do anything fancy here -->-->
1726 !! html/php
1727 <p>--&gt;
1728 </p>
1729 !! html/parsoid
1730 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1731 !! end
1732
1733 # Parsoid closes the unclosed comment, even if it means a slight
1734 # round-trip diff.
1735 !! test
1736 Comment semantics: unclosed comment at end
1737 !! options
1738 parsoid=wt2html,html2html
1739 !! wikitext
1740 <!--This comment will run out to the end of the document
1741 !! html/php
1742
1743 !! html/parsoid
1744 <!--This comment will run out to the end of the document-->
1745 !! end
1746
1747 !! test
1748 Comment semantics: normalize comments to play nice with XML and browsers
1749 !! wikitext
1750 <!-- Browsers --!> think this is closed -->
1751 <!--> This would normally be text -->
1752 <!---> As would this -->
1753 <!-- XML doesn't like trailing dashes -------->
1754 <!-- Nor doubled hyphens -- anywhere in the data -->
1755 But this is not a comment.
1756 !! html/php
1757 <p>But this is not a comment.
1758 </p>
1759 !! html/parsoid
1760 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1761 <!--&#x3E; This would normally be text -->
1762 <!--&#x2D;&#x3E; As would this -->
1763 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1764 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1765 <p>But this is not a comment.</p>
1766 !! end
1767
1768 !! test
1769 Comment semantics: round-trip even text which contains encoded -->
1770 !! wikitext
1771 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1772 !! html/parsoid
1773 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1774 !! end
1775
1776 !! test
1777 Comment in template title
1778 !! wikitext
1779 {{f<!---->oo}}
1780 !! html
1781 <p>FOO
1782 </p>
1783 !! end
1784
1785 !! test
1786 Comment on its own line post-expand
1787 !! wikitext
1788 a
1789 {{blank}}<!---->
1790 b
1791 !! html
1792 <p>a
1793 </p><p>b
1794 </p>
1795 !! end
1796
1797 !! test
1798 Comment on its own line post-expand with non-significant whitespace
1799 !! wikitext
1800 a
1801 {{blank}} <!---->
1802 b
1803 !! html
1804 <p>a
1805 </p><p>b
1806 </p>
1807 !! end
1808
1809 !! test
1810 Multiple comments should still parse as SOL-transparent
1811 !! options
1812 parsoid=wt2html,wt2wt
1813 !! wikitext
1814 <!--c1-->*a
1815 <!--c2--><!--c3--><!--c4-->*b
1816 !! html/php
1817 <ul><li>a</li>
1818 <li>b</li></ul>
1819
1820 !! html/parsoid
1821 <!--c1--><ul>
1822 <li>a
1823 </li>
1824 <!--c2--><!--c3--><!--c4-->
1825 <li>b
1826 </li>
1827 </ul>
1828 !! end
1829
1830 ###
1831 ### paragraph wrapping tests
1832 ###
1833 !! test
1834 No block tags
1835 !! wikitext
1836 a
1837
1838 b
1839 !! html
1840 <p>a
1841 </p><p>b
1842 </p>
1843 !! end
1844
1845 !! test
1846 Block tag on one line (<div>)
1847 !! wikitext
1848 a <div>foo</div>
1849
1850 b
1851 !! html
1852 a <div>foo</div>
1853 <p>b
1854 </p>
1855 !! html+tidy
1856 <p>a</p>
1857 <div>foo</div>
1858 <p>b</p>
1859 !! end
1860
1861 !! test
1862 Block tag on one line (<blockquote>)
1863 !! wikitext
1864 a <blockquote>foo</blockquote>
1865
1866 b
1867 !! html
1868 a <blockquote>foo</blockquote>
1869 <p>b
1870 </p>
1871 !! html+tidy
1872 <p>a</p>
1873 <blockquote>
1874 <p>foo</p>
1875 </blockquote>
1876 <p>b</p>
1877 !! end
1878
1879 !! test
1880 Block tag on both lines (<div>)
1881 !! wikitext
1882 a <div>foo</div>
1883
1884 b <div>foo</div>
1885 !! html
1886 a <div>foo</div>
1887 b <div>foo</div>
1888
1889 !! html+tidy
1890 <p>a</p>
1891 <div>foo</div>
1892 <p>b</p>
1893 <div>foo</div>
1894 !! end
1895
1896 !! test
1897 Block tag on both lines (<blockquote>)
1898 !! wikitext
1899 a <blockquote>foo</blockquote>
1900
1901 b <blockquote>foo</blockquote>
1902 !! html
1903 a <blockquote>foo</blockquote>
1904 b <blockquote>foo</blockquote>
1905
1906 !! html+tidy
1907 <p>a</p>
1908 <blockquote>
1909 <p>foo</p>
1910 </blockquote>
1911 <p>b</p>
1912 <blockquote>
1913 <p>foo</p>
1914 </blockquote>
1915 !! end
1916
1917 !! test
1918 Multiple lines without block tags
1919 !! wikitext
1920 <div>foo</div> a
1921 b
1922 c
1923 d<!--foo--> e
1924 x <div>foo</div> z
1925 !! html
1926 <div>foo</div> a
1927 <p>b
1928 c
1929 d e
1930 </p>
1931 x <div>foo</div> z
1932
1933 !! html+tidy
1934 <div>foo</div>
1935 <p>a</p>
1936 <p>b c d e</p>
1937 <p>x</p>
1938 <div>foo</div>
1939 <p>z</p>
1940 !! end
1941
1942 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1943 # So, we have a separate section for Parsoid. We don't want
1944 # to mimic this stripping behavior in Parsoid. It affects
1945 # editing experience and also requires us to maintain additional
1946 # info for RT-ing.
1947 !! test
1948 Empty lines between lines with block tags
1949 !! wikitext
1950 <div></div>
1951
1952
1953 <div></div>a
1954
1955 b
1956 <div>a</div>b
1957
1958 <div>b</div>d
1959
1960
1961 <div>e</div>
1962 !! html
1963 <div></div>
1964 <p><br />
1965 </p>
1966 <div></div>a
1967 <p>b
1968 </p>
1969 <div>a</div>b
1970 <div>b</div>d
1971 <p><br />
1972 </p>
1973 <div>e</div>
1974
1975 !! html+tidy
1976 <p><br /></p>
1977 <p>a</p>
1978 <p>b</p>
1979 <div>a</div>
1980 <p>b</p>
1981 <div>b</div>
1982 <p>d</p>
1983 <p><br /></p>
1984 <div>e</div>
1985 !! html/parsoid
1986 <div data-parsoid='{"stx":"html"}'></div>
1987
1988 <p><br /></p>
1989 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1990
1991 <p>b</p>
1992 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1993
1994 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1995
1996 <p><br /></p>
1997 <div data-parsoid='{"stx":"html"}'>e</div>
1998 !! end
1999
2000 ## PHP parser emits output which is broken
2001 !! test
2002 Unclosed HTML p-tags should be handled properly
2003 !! wikitext
2004 <div><p>foo</div>
2005 a
2006
2007 b
2008 !! html/php+tidy
2009 <div>
2010 <p>foo</p>
2011 </div>
2012 <p>a</p>
2013 <p>b</p>
2014 !! html/parsoid
2015 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2016 <p>a</p>
2017 <p>b</p>
2018 !! end
2019
2020 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2021 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2022 ## them for now.
2023 !! test
2024 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2025 !! options
2026 parsoid=wt2html
2027 !! wikitext
2028 a [[Category:A1]] [[Category:A2]]
2029 [[Category:A3]]
2030 [[Category:A4]]
2031 !! html/parsoid
2032 <p>a</p>
2033 <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"/>
2034 !! end
2035
2036 !! test
2037 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2038 !! options
2039 parsoid=wt2html
2040 !! wikitext
2041 [[Category:A1]]a
2042 !! html/parsoid
2043 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2044 !! end
2045
2046 ###
2047 ### Preformatted text
2048 ###
2049 !! test
2050 Preformatted text
2051 !! wikitext
2052 This is some
2053 Preformatted text
2054 With ''italic''
2055 And '''bold'''
2056 And a [[Main Page|link]]
2057 !! html
2058 <pre>This is some
2059 Preformatted text
2060 With <i>italic</i>
2061 And <b>bold</b>
2062 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2063 </pre>
2064 !! end
2065
2066 !! test
2067 Tabs don't trigger preformatted text
2068 !! wikitext
2069 This is not
2070 preformatted text.
2071 This is preformatted text.
2072 So is this.
2073 !! html/php
2074 <p> This is not
2075 preformatted text.
2076 </p>
2077 <pre>This is preformatted text.
2078 So is this.
2079 </pre>
2080 !! html/parsoid
2081 <p> This is not
2082 preformatted text.</p>
2083 <pre>This is preformatted text.
2084 So is this.</pre>
2085 !! end
2086
2087 !! test
2088 Space before tab needs nowiki pre protection
2089 !! options
2090 parsoid=html2wt
2091 !! html/parsoid
2092 <p> a</p>
2093 !! wikitext
2094 <nowiki> </nowiki> a
2095 !! end
2096
2097 !! test
2098 Ident preformatting with inline content
2099 !! wikitext
2100 a
2101 ''b''
2102 !! html
2103 <pre>a
2104 <i>b</i>
2105 </pre>
2106 !! end
2107
2108 !! test
2109 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2110 !! wikitext
2111 <pre><nowiki>
2112 <b>
2113 <cite>
2114 <em>
2115 </nowiki></pre>
2116 !! html
2117 <pre>
2118 &lt;b&gt;
2119 &lt;cite&gt;
2120 &lt;em&gt;
2121 </pre>
2122
2123 !! end
2124
2125 !! test
2126 Regression with preformatted in <center>
2127 !! wikitext
2128 <center>
2129 Blah
2130 </center>
2131 !! html
2132 <center>
2133 <pre>Blah
2134 </pre>
2135 </center>
2136
2137 !! end
2138
2139 !! test
2140 Bug 52763: Preformatted in <blockquote>
2141 !! wikitext
2142 <blockquote>
2143 Blah
2144 {|
2145 |
2146 indented cell (no pre-wrapping!)
2147 |}
2148 </blockquote>
2149 !! html
2150 <blockquote>
2151 <p> Blah
2152 </p>
2153 <table>
2154 <tr>
2155 <td>
2156 <p> indented cell (no pre-wrapping!)
2157 </p>
2158 </td></tr></table>
2159 </blockquote>
2160
2161 !! end
2162
2163 !! test
2164 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2165 !! wikitext
2166 <blockquote>
2167 Foo
2168
2169 Bar
2170 </blockquote>
2171 !! html
2172 <blockquote>
2173 <p>Foo
2174 </p><p>Bar
2175 </p>
2176 </blockquote>
2177
2178 !! end
2179
2180 !! test
2181 Bug 15491: <ins>/<del> in blockquote
2182 !! wikitext
2183 <blockquote>
2184 Foo <del>bar</del> <ins>baz</ins> quux
2185 </blockquote>
2186 !! html
2187 <blockquote>
2188 <p>Foo <del>bar</del> <ins>baz</ins> quux
2189 </p>
2190 </blockquote>
2191
2192 !! end
2193
2194 # Note that the p-wrapping is newline sensitive, which could be
2195 # considered a bug: tidy will wrap only the 'Foo' in the example
2196 # below in a <p> tag. (see comment 23-25 of bug #6200)
2197 !! test
2198 Bug 15491: <ins>/<del> in blockquote (2)
2199 !! wikitext
2200 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2201 </blockquote>
2202 !! html
2203 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2204 </blockquote>
2205
2206 !! html+tidy
2207 <blockquote>
2208 <p>Foo</p>
2209 <del>bar</del> <ins>baz</ins> quux</blockquote>
2210 !! end
2211
2212 !! test
2213 <pre> with attributes (bug 3202)
2214 !! wikitext
2215 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2216 !! html
2217 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2218
2219 !! end
2220
2221 !! test
2222 <pre> with width attribute (bug 3202)
2223 !! wikitext
2224 <pre width="8">Narrow screen goodies</pre>
2225 !! html
2226 <pre width="8">Narrow screen goodies</pre>
2227
2228 !! end
2229
2230 !! test
2231 <pre> with forbidden attribute (bug 3202)
2232 !! wikitext
2233 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2234 !! html
2235 <pre width="8">Narrow screen goodies</pre>
2236
2237 !! end
2238
2239 !! test
2240 Entities inside <pre>
2241 !! wikitext
2242 <pre>&lt;</pre>
2243 !! html
2244 <pre>&lt;</pre>
2245
2246 !! end
2247
2248 !! test
2249 <pre> with forbidden attribute values (bug 3202)
2250 !! wikitext
2251 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2252 !! html
2253 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2254
2255 !! end
2256
2257 !! test
2258 <nowiki> inside <pre> (bug 13238)
2259 !! wikitext
2260 <pre>
2261 <nowiki>
2262 </pre>
2263 <pre>
2264 <nowiki></nowiki>
2265 </pre>
2266 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2267 !! html
2268 <pre>
2269 &lt;nowiki&gt;
2270 </pre>
2271 <pre>
2272
2273 </pre>
2274 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2275
2276 !! end
2277
2278 !! test
2279 <nowiki> inside of #tag:pre
2280 !! wikitext
2281 {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
2282 !! html/php
2283 <pre>Foo &#8594;bar</pre>
2284
2285 !! html/parsoid
2286 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:pre","function":"#tag"},"params":{"1":{"wt":"Foo &lt;nowiki>&amp;rarr;bar&lt;/nowiki>"}},"i":0}}]}'>Foo <span typeof="mw:Entity">→</span>bar</pre>
2287 !! end
2288
2289 !! test
2290 <nowiki> and <pre> preference (first one wins)
2291 !! wikitext
2292 <pre>
2293 <nowiki>
2294 </pre>
2295 </nowiki>
2296 </pre>
2297
2298 <nowiki>
2299 <pre>
2300 <nowiki>
2301 </pre>
2302 </nowiki>
2303 </pre>
2304
2305 !! html/php
2306 <pre>
2307 &lt;nowiki&gt;
2308 </pre>
2309 <p>&lt;/nowiki&gt;
2310 &lt;/pre&gt;
2311 </p><p>
2312 &lt;pre&gt;
2313 &lt;nowiki&gt;
2314 &lt;/pre&gt;
2315
2316 &lt;/pre&gt;
2317 </p>
2318 !! html/parsoid
2319 <pre data-parsoid='{"stx":"html","strippedNL":true}'>&lt;nowiki>
2320 </pre>
2321 <p><span typeof="mw:Placeholder" data-parsoid='{"src":"&lt;/nowiki>"}'>&lt;/nowiki></span>
2322 &lt;/pre></p>
2323
2324 <p><span typeof="mw:Nowiki">
2325 &lt;pre>
2326 &lt;nowiki>
2327 &lt;/pre>
2328 </span>
2329 &lt;/pre></p>
2330 !! end
2331
2332 !! test
2333 </pre> inside nowiki
2334 !! wikitext
2335 <nowiki></pre></nowiki>
2336 !! html
2337 <p>&lt;/pre&gt;
2338 </p>
2339 !! end
2340
2341 # Parsoid doesn't strip empty tags, like Tidy does.
2342 !! test
2343 Empty pre; pre inside other HTML tags (bug 54946)
2344 !! options
2345 parsoid=wt2html,wt2wt
2346 !! wikitext
2347 a
2348
2349 <div><pre>
2350 foo
2351 </pre></div>
2352 <pre></pre>
2353 !! html/php
2354 <p>a
2355 </p>
2356 <div><pre>
2357 foo
2358 </pre></div>
2359 <pre></pre>
2360
2361 !! html/php+tidy
2362 <p>a</p>
2363 <div>
2364 <pre>
2365 foo
2366 </pre></div>
2367 !! html/parsoid
2368 <p>a</p>
2369
2370 <div><pre>foo
2371 </pre></div>
2372 <pre></pre>
2373 !! end
2374
2375 !! test
2376 HTML pre followed by indent-pre
2377 !! wikitext
2378 <pre>foo</pre>
2379 bar
2380 !! html
2381 <pre>foo</pre>
2382 <pre>bar
2383 </pre>
2384 !! end
2385
2386 # Note that tidy removes the empty <p> tags from the start and end.
2387 # Parsoid does not, by design.
2388 !!test
2389 Block tag pre
2390 !! wikitext
2391 <p><pre>foo</pre></p>
2392 !! html/php+tidy
2393 <pre>
2394 foo
2395 </pre>
2396 !! html/parsoid
2397 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2398 !!end
2399
2400 !!test
2401 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2402 !! wikitext
2403 {{echo|}}
2404 !! html
2405
2406 !!end
2407
2408 !!test
2409 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2410 !! wikitext
2411 {{echo|
2412 foo}}
2413 !! html
2414 <p>foo
2415 </p>
2416 !!end
2417
2418 !! test
2419 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2420 !! wikitext
2421 {{echo|a
2422 b}}
2423 !! html
2424 <pre>a
2425 </pre>
2426 <p>b
2427 </p>
2428 !!end
2429
2430 !! test
2431 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2432 !! wikitext
2433 {{echo|a
2434 b
2435 c
2436 d
2437 e
2438 }}
2439 !! html
2440 <pre>a
2441 </pre>
2442 <p>b
2443 c
2444 </p>
2445 <pre>d
2446 </pre>
2447 <p>e
2448 </p>
2449 !!end
2450
2451 !!test
2452 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2453 !! wikitext
2454 {{echo| foo}}
2455
2456 {{echo| foo}}{{echo| bar}}
2457
2458 {{echo| foo}}
2459 {{echo| bar}}
2460
2461 {{echo|<!--cmt--> foo}}
2462
2463 <!--cmt-->{{echo| foo}}
2464
2465 {{echo|{{echo| }}bar}}
2466 !! html
2467 <pre>foo
2468 </pre>
2469 <pre>foo bar
2470 </pre>
2471 <pre>foo
2472 bar
2473 </pre>
2474 <pre>foo
2475 </pre>
2476 <pre>foo
2477 </pre>
2478 <pre>bar
2479 </pre>
2480 !!end
2481
2482 !! test
2483 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2484 !! wikitext
2485 {{echo| }}a
2486
2487 {{echo|
2488 }}a
2489
2490 {{echo|
2491 b}}
2492
2493 {{echo|a
2494 }}b
2495
2496 {{echo|a
2497 }} b
2498 !! html
2499 <pre>a
2500 </pre>
2501 <p><br />
2502 </p>
2503 <pre>a
2504 </pre>
2505 <p><br />
2506 </p>
2507 <pre>b
2508 </pre>
2509 <p>a
2510 </p>
2511 <pre>b
2512 </pre>
2513 <p>a
2514 </p>
2515 <pre>b
2516 </pre>
2517 !!end
2518
2519 !! test
2520 Pres with newline attributes
2521 !! wikitext
2522 <pre class="one
2523 two">hi</pre>
2524 !! html/php
2525 <pre class="one two">hi</pre>
2526
2527 !! html/parsoid
2528 <pre class="one
2529 two" data-parsoid='{"stx":"html"}'>hi</pre>
2530 !! end
2531
2532 !! test
2533 Things that look like <pre> tags aren't treated as such
2534 !! wikitext
2535 Barack Obama <President> of the United States
2536 <President></President>
2537 !! html
2538 <p>Barack Obama &lt;President&gt; of the United States
2539 &lt;President&gt;&lt;/President&gt;
2540 </p>
2541 !! end
2542
2543 !! test
2544 Handle broken pre-like tags (bug 64025)
2545 !! options
2546 parsoid=wt2html
2547 !! wikitext
2548 {{echo|<pre <pre>x</pre>}}
2549
2550 <table><pre </table>
2551 !! html/php
2552 <pre>x</pre>
2553 <table>&lt;pre </table>
2554
2555 !! html/php+tidy
2556 <pre>
2557 x
2558 </pre>
2559 <p>&lt;pre</p>
2560 !! html/parsoid
2561 <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>
2562
2563
2564 <p>&lt;pre </p>
2565
2566 <table></table>
2567 !! end
2568
2569 !! test
2570 Parsoid: handle pre with space after attribute
2571 !! options
2572 parsoid=wt2html
2573 !! wikitext
2574 <pre style="width:50%;" >{{echo|foo}}</pre>
2575 !! html/php
2576 <pre style="width:50%;">{{echo|foo}}</pre>
2577
2578 !! html/parsoid
2579 <pre style="width:50%;">{{echo|foo}}</pre>
2580 !! end
2581
2582 # TODO / maybe: fix wt2wt for this
2583 !! test
2584 Parsoid: Don't paragraph-wrap fosterable content
2585 !! options
2586 parsoid=wt2html
2587 !! wikitext
2588 {|
2589 <td></td>
2590 <td></td>
2591
2592
2593
2594 |}
2595 !! html
2596 <table>
2597
2598 <tbody>
2599 <tr>
2600 <td></td>
2601
2602 <td></td></tr>
2603
2604
2605
2606 </tbody></table>
2607 !! end
2608
2609 !! test
2610 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2611 !! options
2612 parsoid=wt2html
2613 !! wikitext
2614 {|
2615 <td>
2616 <td>
2617 </td>
2618
2619
2620
2621 |}
2622 !! html
2623 <table>
2624
2625 <tbody>
2626 <tr>
2627 <td></td>
2628
2629 <td>
2630 </td></tr>
2631
2632
2633
2634 </tbody></table>
2635 !! end
2636
2637
2638 #--------------------------------------------------------------------
2639 # Transclusion parameter whitespace stripping tests
2640 # Behavior is different for positional and named parameters
2641 #--------------------------------------------------------------------
2642 !! test
2643 Templates: Strip leading and trailing whitespace from named-param values
2644 !! wikitext
2645 {{echo|1= a }}
2646
2647 {{echo|1= {{echo|b}} }}
2648
2649 {{echo| 1 =
2650 c }}
2651
2652 {{echo| 1 =
2653 * d
2654 }}
2655 !! html
2656 <p>a
2657 </p><p>b
2658 </p><p>c
2659 </p>
2660 <ul><li> d</li></ul>
2661
2662 !! end
2663
2664 !! test
2665 Templates: Don't strip whitespace from positional-param values
2666 !! wikitext
2667 {{echo|a }}
2668
2669 {{echo|{{echo|b}} }}
2670
2671 {{echo| c
2672 }}
2673
2674 {{echo| {{echo|d}}
2675 }}
2676
2677 {{echo|
2678 e}}
2679
2680 {{echo|
2681 * f}}
2682
2683 {{echo|
2684 }}g
2685 !! html
2686 <p>a
2687 </p><p>b
2688 </p>
2689 <pre>c
2690 </pre>
2691 <p><br />
2692 </p>
2693 <pre>d
2694 </pre>
2695 <p><br />
2696 </p>
2697 <pre>e
2698 </pre>
2699 <p><br />
2700 </p>
2701 <ul><li> f</li></ul>
2702 <p><br />
2703 </p>
2704 <pre>g
2705 </pre>
2706 !! end
2707
2708 !! test
2709 Templates: Handle empty comment-and-ws-only lines correctly
2710 !! wikitext
2711 {{echo|foo
2712 <!--should be ignored-->
2713 <!--should be ignored as well-->
2714 bar}}
2715 !! html/php
2716 <p>foo
2717 bar
2718 </p>
2719 !! html/parsoid
2720 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo\n&lt;!--should be ignored-->\n &lt;!--should be ignored as well-->\nbar"}},"i":0}}]}'>foo <!--should be ignored--> <!--should be ignored as well--> bar</p>
2721 !! end
2722
2723 !! test
2724 Templates: Handle comments in the target
2725 !! wikitext
2726 {{echo
2727 <!-- should be ignored -->
2728 |foo}}
2729
2730 {{echo<!-- should be ignored -->
2731 |foo}}
2732
2733 {{echo<!-- should be ignored -->|foo}}
2734
2735 {{<!-- should be ignored -->echo|foo}}
2736 !! html/php
2737 <p>foo
2738 </p><p>foo
2739 </p><p>foo
2740 </p><p>foo
2741 </p>
2742 !! html/parsoid
2743 <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>
2744
2745 <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>
2746
2747 <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>
2748
2749 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2750 !!end
2751
2752 !! test
2753 Templates: Handle comments in parameter names (bug 67657)
2754 !! wikitext
2755 {{echo|1
2756 <!-- should be ignored -->
2757 =foo}}
2758
2759 {{echo|
2760 <!-- should be ignored -->
2761 1 = foo}}
2762
2763 {{echo|1<!-- should be ignored -->=foo}}
2764
2765 {{echo|<!-- should be ignored -->1=foo}}
2766 !! html/php
2767 <p>foo
2768 </p><p>foo
2769 </p><p>foo
2770 </p><p>foo
2771 </p>
2772 !! html/parsoid
2773 <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>
2774
2775 <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>
2776
2777 <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>
2778
2779 <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>
2780 !!end
2781
2782 !! test
2783 Templates: Other wikitext in parameter names (bug 67657)
2784 !! wikitext
2785 {{echo|''1''=foo}}
2786 !! html/php
2787 <p>{{{1}}}
2788 </p>
2789 !! html/parsoid
2790 <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>
2791 !!end
2792
2793 #--------------------------------------------------------------------
2794 # Transclusion parameter escaping tests
2795 #--------------------------------------------------------------------
2796 !! test
2797 Templates: Parsoid parameter escaping test 1
2798 !! wikitext
2799 {{echo|[foo]|{{echo|[bar]}}}}
2800 !! html/php+tidy
2801 <p>[foo]</p>
2802 !! html/parsoid
2803 <p about="#mwt1" typeof="mw:Transclusion"
2804 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2805 !! end
2806
2807 !! test
2808 Parsoid: Pipes in external links in template parameter
2809 !! wikitext
2810 {{echo|[{{echo|http://example.com}} link]}}
2811 !! html/php+tidy
2812 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2813 !! html/parsoid
2814 <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>
2815 !! end
2816
2817 !! test
2818 Parsoid: pipe in transclusion parameter
2819 !! wikitext
2820 {{echo|http://foo.com/a&#124;b}}
2821 !! html/php+tidy
2822 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2823 !! html/parsoid
2824 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2825 typeof="mw:Transclusion"
2826 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>
2827 !! end
2828
2829 !! test
2830 Parsoid: Pipe in external link target and content in template parameter
2831 !! options
2832 parsoid=html2wt,wt2wt
2833 !! wikitext
2834 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2835 !! html/php+tidy
2836 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2837 !! html/parsoid
2838 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2839 typeof="mw:Transclusion"
2840 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2841 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2842 !! end
2843
2844 !! test
2845 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2846 !! options
2847 parsoid
2848 !! wikitext
2849 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2850 !! html
2851 <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>
2852 !! end
2853
2854 !! test
2855 Templates: Don't escape already nowiki-escaped text in template parameters
2856 !! options
2857 parsoid=html2wt,wt2wt
2858 !! wikitext
2859 {{echo|foo<nowiki>|</nowiki>bar}}
2860 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2861 {{echo|<nowiki></nowiki>}}
2862 !! html/php+tidy
2863 <p>foo|bar &lt;div&gt;</p>
2864 !! html/parsoid
2865 <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>
2866 <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>
2867 <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>
2868 </p>
2869 !! end
2870
2871 ## Bug 52824
2872 !! test
2873 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2874 !! options
2875 parsoid=html2wt,wt2wt
2876 !! wikitext
2877 {{echo|{{echo|1=bar}}}}
2878 !! html/php+tidy
2879 <p>bar</p>
2880 !! html/parsoid
2881 <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>
2882 !! end
2883
2884 ## Bug 56733
2885 !! test
2886 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2887 !! wikitext
2888 {{echo|a : b}}
2889 !! html/php+tidy
2890 <p>a&#160;: b</p>
2891 !! html/parsoid
2892 <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>
2893 !! end
2894
2895 ## Bug T73412
2896 !! test
2897 Templates: Preserve blank parameter names
2898 !! wikitext
2899 {{echo|=foo}}
2900 !! html/php+tidy
2901 <p>{{{1}}}</p>
2902 !! html/parsoid
2903 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2904 !! end
2905
2906 !! test
2907 Templates: Preserve blank parameter names in other positions
2908 !! wikitext
2909 {{blank_param|bar|=foo}}
2910 !! html/php+tidy
2911 <p>bar foo</p>
2912 !! html/parsoid
2913 <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
2914 foo</p>
2915 !! end
2916
2917 ###
2918 ### Parsoid-centric tests for testing RT edge cases for pre
2919 ###
2920
2921 !!test
2922 1a. Indent-Pre and Comments
2923 !! wikitext
2924 a
2925 <!--a-->
2926 c
2927 !! html
2928 <pre>a
2929 </pre>
2930 <p>c
2931 </p>
2932 !!end
2933
2934 !!test
2935 1b. Indent-Pre and Comments
2936 !! wikitext
2937 a
2938 <!--a-->
2939 c
2940 !! html
2941 <pre>a
2942 </pre>
2943 <p>c
2944 </p>
2945 !!end
2946
2947 !!test
2948 1c. Indent-Pre and Comments
2949 !! wikitext
2950 <!--a--> a
2951
2952 <!--a--> a
2953 !! html
2954 <pre> a
2955 </pre>
2956 <pre> a
2957 </pre>
2958 !!end
2959
2960 !!test
2961 1d. Indent-Pre and Comments
2962 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2963 !! wikitext
2964 <!--a--> a
2965
2966 <!--b-->b
2967 !! html
2968 <pre>a
2969 </pre>
2970 <pre>b
2971 </pre>
2972 !!end
2973
2974 !!test
2975 2a. Indent-Pre and tables
2976 !! wikitext
2977 {|
2978 |-
2979 !h1!!h2
2980 |foo||bar
2981 |}
2982 !! html
2983 <table>
2984
2985 <tr>
2986 <th>h1</th>
2987 <th>h2
2988 </th>
2989 <td>foo</td>
2990 <td>bar
2991 </td></tr></table>
2992
2993 !!end
2994
2995 !!test
2996 2b. Indent-Pre and tables
2997 !! wikitext
2998 {|
2999 |-
3000 |foo
3001 |}
3002 !! html
3003 <table>
3004
3005 <tr>
3006 <td>foo
3007 </td></tr></table>
3008
3009 !!end
3010
3011 !!test
3012 2c. Indent-Pre and tables (bug 42252)
3013 !! wikitext
3014 {|
3015 |+ foo
3016 ! | bar
3017 |}
3018 !! html
3019 <table>
3020 <caption> foo
3021 </caption>
3022 <tr>
3023 <th> bar
3024 </th></tr></table>
3025
3026 !!end
3027
3028 !!test
3029 2d. Indent-Pre and tables
3030 !! wikitext
3031 a
3032 {|
3033 | b
3034 |}
3035 !! html/php
3036 <pre>a
3037 </pre>
3038 <table>
3039 <tr>
3040 <td> b
3041 </td></tr></table>
3042
3043 !! html/parsoid
3044 <pre>a</pre>
3045 <table>
3046 <tbody><tr><td> b</td></tr>
3047 </tbody></table>
3048 !!end
3049
3050 !!test
3051 2e. Indent-Pre and table-line syntax
3052 !! wikitext
3053 a
3054 | b
3055 | c
3056 !! html/php
3057 <pre>a
3058 | b
3059 | c
3060 </pre>
3061 !!end
3062
3063 !!test
3064 2f. Indent-pre started by table-line syntax
3065 !! wikitext
3066 a
3067 | b
3068 | c
3069 !! html/php
3070 <p>a
3071 </p>
3072 <pre>| b
3073 | c
3074 </pre>
3075 !! html/parsoid
3076 <p>a</p>
3077 <pre>
3078 | b
3079 | c</pre>
3080 !!end
3081
3082 !! test
3083 2g. Indented table markup mixed with indented pre content (proposed in bug 6200)
3084 !! wikitext
3085 <table>
3086 <tr>
3087 <td>
3088 Text that should be rendered preformatted
3089 </td>
3090 </tr>
3091 </table>
3092 !! html
3093 <table>
3094 <tr>
3095 <td>
3096 <pre>Text that should be rendered preformatted
3097 </pre>
3098 </td>
3099 </tr>
3100 </table>
3101
3102 !! end
3103
3104 !!test
3105 3a. Indent-Pre and block tags (single-line html)
3106 !! wikitext
3107 a <p> foo </p>
3108 b <div> foo </div>
3109 c <blockquote> foo </blockquote>
3110 <span> foo </span>
3111 !! html
3112 a <p> foo </p>
3113 b <div> foo </div>
3114 c <blockquote> foo </blockquote>
3115 <pre><span> foo </span>
3116 </pre>
3117 !! html/parsoid
3118 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3119 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3120 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3121 <pre><span> foo </span>
3122 </pre>
3123 !! html+tidy
3124 <p>a</p>
3125 <p>foo</p>
3126 <p>b</p>
3127 <div>foo</div>
3128 <p>c</p>
3129 <blockquote>
3130 <p>foo</p>
3131 </blockquote>
3132 <pre>
3133 <span> foo </span>
3134 </pre>
3135 !! end
3136
3137 !!test
3138 3b. Indent-Pre and block tags (multi-line html)
3139 !! wikitext
3140 a <span>foo</span>
3141 b <div> foo </div>
3142 !! html
3143 <pre>a <span>foo</span>
3144 </pre>
3145 b <div> foo </div>
3146
3147 !! html/parsoid
3148 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3149 b <div data-parsoid='{"stx":"html"}'> foo </div>
3150 !! html+tidy
3151 <pre>
3152 a <span>foo</span>
3153 </pre>
3154 <p>b</p>
3155 <div>foo</div>
3156 !!end
3157
3158 !!test
3159 3c. Indent-Pre and block tags (pre-content on separate line)
3160 !! wikitext
3161 <p>
3162 foo
3163 </p>
3164
3165 <div>
3166 foo
3167 </div>
3168
3169 <center>
3170 foo
3171 </center>
3172
3173 <blockquote>
3174 foo
3175 </blockquote>
3176
3177 <blockquote>
3178 <pre>
3179 foo
3180 </pre>
3181 </blockquote>
3182
3183 <table><tr><td>
3184 foo
3185 </td></tr></table>
3186
3187 <ul><li>
3188 foo
3189 </li></ul>
3190
3191 !! html
3192 <p>
3193 foo
3194 </p>
3195 <div>
3196 <pre>foo
3197 </pre>
3198 </div>
3199 <center>
3200 <pre>foo
3201 </pre>
3202 </center>
3203 <blockquote>
3204 <p> foo
3205 </p>
3206 </blockquote>
3207 <blockquote>
3208 <pre>
3209 foo
3210 </pre>
3211 </blockquote>
3212 <table><tr><td>
3213 <pre>foo
3214 </pre>
3215 </td></tr></table>
3216 <ul><li>
3217 foo
3218 </li></ul>
3219
3220 !!end
3221
3222 !! test
3223 4. Indent-Pre and extension tags
3224 !! wikitext
3225 a <tag />
3226 !! html/php
3227 a <pre>
3228 NULL
3229 array (
3230 )
3231 </pre>
3232
3233 !! html/parsoid
3234 a <pre typeof="mw:Extension/tag" about="#mwt2" data-parsoid='{}' data-mw='{"name":"tag","attrs":{},"body":null}'></pre>
3235 !! end
3236
3237 !!test
3238 Render paragraphs when indent-pre is suppressed in blocklevels
3239 !! wikitext
3240 <blockquote>
3241 foo
3242
3243 bar
3244 </blockquote>
3245 !! html
3246 <blockquote>
3247 <p> foo
3248 </p><p> bar
3249 </p>
3250 </blockquote>
3251
3252 !!end
3253
3254 !!test
3255 4. Multiple spaces at start-of-line
3256 !! wikitext
3257 <p> foo </p>
3258 foo
3259 {|
3260 |foo
3261 |}
3262 !! html
3263 <p> foo </p>
3264 <pre> foo
3265 </pre>
3266 <table>
3267 <tr>
3268 <td>foo
3269 </td></tr></table>
3270
3271 !!end
3272
3273 ## NOTE: the leading white-space chars on empty line are significant
3274 !! test
3275 5a. White-space in indent-pre
3276 !! wikitext
3277 a<br />
3278
3279 b
3280 !! html
3281 <pre>a<br />
3282
3283 b
3284 </pre>
3285 !! end
3286
3287 ## NOTE: the leading white-space chars on empty line are significant
3288 !! test
3289 5b. White-space in indent-pre
3290 !! wikitext
3291 a
3292
3293 b
3294
3295
3296 c
3297 !! html
3298 <pre>a
3299
3300 b
3301
3302
3303 c
3304 </pre>
3305 !! end
3306
3307 !! test
3308 5c. White-space in indent-pre
3309 !! wikitext
3310 ''a''
3311 ''b''
3312 ''c''
3313 !! html
3314 <pre><i>a</i>
3315 <i>b</i>
3316 <i>c</i>
3317 </pre>
3318 !! end
3319
3320 !! test
3321 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3322 !! wikitext
3323 a
3324
3325 <!-- continue -->
3326 b
3327
3328 c
3329
3330 d
3331 !! html
3332 <pre>a
3333
3334 b
3335 </pre>
3336 <pre>c
3337
3338 </pre>
3339 <p>d
3340 </p>
3341 !! end
3342
3343 !! test
3344 7a. Indent-pre and category links
3345 !! options
3346 parsoid=wt2html,wt2wt
3347 !! wikitext
3348 [[Category:foo]] <!-- No pre-wrapping -->
3349 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3350 !! html/php+tidy
3351 !! html/parsoid
3352 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3353 <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 -->
3354 !! end
3355
3356 ## We used to, but no longer wt2wt this test since the default serializer
3357 ## will normalize all categories to serialize on their own line.
3358 ## This wikitext usage is going to be fairly uncommon in production and
3359 ## selser will take care of preserving formatting in those scenarios.
3360 !! test
3361 7b. Indent-pre and category links
3362 !! options
3363 parsoid=wt2html
3364 !! wikitext
3365 [[Category:foo]] a
3366 [[Category:foo]] {{echo|b}}
3367 !! html/parsoid
3368 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3369 <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>
3370 !! end
3371
3372 !! test
3373 Indent-Pre: Newlines in comments shouldn't affect sol state
3374 !! wikitext
3375 a <!--
3376 foo
3377 --> b
3378 !! html/php+tidy
3379 <p>a b</p>
3380 !! html/parsoid
3381 <p>a <!--
3382 foo
3383 --> b</p>
3384 !! end
3385
3386 ###
3387 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3388 ###
3389
3390 !!test
3391 HTML-pre: 1. embedded newlines
3392 !! wikitext
3393 <pre>foo</pre>
3394
3395 <pre>
3396 foo
3397 </pre>
3398
3399 <pre>
3400
3401 foo
3402 </pre>
3403
3404 <pre>
3405
3406
3407 foo
3408 </pre>
3409 !! html/php+tidy
3410 <pre>
3411 foo
3412 </pre>
3413 <pre>
3414 foo
3415 </pre>
3416 <pre>
3417
3418 foo
3419 </pre>
3420 <pre>
3421
3422
3423 foo
3424 </pre>
3425 !! html/parsoid
3426 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3427
3428 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3429 foo
3430 </pre>
3431
3432 <pre data-parsoid='{"stx":"html"}'>
3433
3434 foo
3435 </pre>
3436
3437 <pre data-parsoid='{"stx":"html"}'>
3438
3439
3440 foo
3441 </pre>
3442 !!end
3443
3444 !! test
3445 HTML-pre: big spaces
3446 !! wikitext
3447 <pre>
3448
3449
3450
3451
3452 haha
3453
3454
3455
3456
3457 haha
3458
3459
3460
3461
3462 </pre>
3463 !! html/php+tidy
3464 <pre>
3465
3466
3467
3468
3469 haha
3470
3471
3472
3473
3474 haha
3475
3476
3477
3478
3479 </pre>
3480 !! html/parsoid
3481 <pre data-parsoid='{"stx":"html"}'>
3482
3483
3484
3485
3486 haha
3487
3488
3489
3490
3491 haha
3492
3493
3494
3495
3496 </pre>
3497 !! end
3498
3499 !!test
3500 HTML-pre: 2: indented text
3501 !! wikitext
3502 <pre>
3503 foo
3504 </pre>
3505 !! html
3506 <pre>
3507 foo
3508 </pre>
3509
3510 !!end
3511
3512 !!test
3513 HTML-pre: 3: other wikitext
3514 !! wikitext
3515 <pre>
3516 * foo
3517 # bar
3518 = no-h =
3519 '' no-italic ''
3520 [[ NoLink ]]
3521 </pre>
3522 !! html/php
3523 <pre>
3524 * foo
3525 # bar
3526 = no-h =
3527 '' no-italic ''
3528 [[ NoLink ]]
3529 </pre>
3530
3531 !! html/parsoid
3532 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3533 # bar
3534 = no-h =
3535 '' no-italic ''
3536 [[ NoLink ]]
3537 </pre>
3538 !!end
3539
3540 ###
3541 ### Definition lists
3542 ###
3543 !! test
3544 Simple definition
3545 !! wikitext
3546 ; name : Definition
3547 !! html
3548 <dl><dt> name&#160;</dt>
3549 <dd> Definition</dd></dl>
3550
3551 !! end
3552
3553 !! test
3554 Definition list for indentation only
3555 !! wikitext
3556 : Indented text
3557 !! html
3558 <dl><dd> Indented text</dd></dl>
3559
3560 !! end
3561
3562 !! test
3563 Definition list with no space
3564 !! wikitext
3565 ;name:Definition
3566 !! html
3567 <dl><dt>name</dt>
3568 <dd>Definition</dd></dl>
3569
3570 !!end
3571
3572 !! test
3573 Definition list with URL link
3574 !! wikitext
3575 ; http://example.com/ : definition
3576 !! html
3577 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3578 <dd> definition</dd></dl>
3579
3580 !! end
3581
3582 !! test
3583 Definition list with bracketed URL link
3584 !! wikitext
3585 ;[http://www.example.com/ Example]:Something about it
3586 !! html
3587 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3588 <dd>Something about it</dd></dl>
3589
3590 !! end
3591
3592 !! test
3593 Definition list with wikilink containing colon
3594 !! wikitext
3595 ; [[Help:FAQ]]: The least-read page on Wikipedia
3596 !! html
3597 <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>
3598 <dd> The least-read page on Wikipedia</dd></dl>
3599
3600 !! end
3601
3602 # At Brion's and JeLuF's insistence... :)
3603 !! test
3604 Definition list with news link containing colon
3605 !! wikitext
3606 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3607 !! html/php
3608 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3609 <dd> This isn't even a real newsgroup!</dd></dl>
3610
3611 !! html/parsoid
3612 <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>
3613 !! end
3614
3615 !! test
3616 Malformed definition list with colon
3617 !! wikitext
3618 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3619 !! html
3620 <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>
3621
3622 !! end
3623
3624 !! test
3625 Definition lists: colon in external link text
3626 !! wikitext
3627 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3628 !! html
3629 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3630 <dd> OK, I made that up</dd></dl>
3631
3632 !! end
3633
3634 !! test
3635 Definition lists: colon in HTML attribute
3636 !! wikitext
3637 ;<b style="display: inline">bold</b>
3638 !! html
3639 <dl><dt><b style="display: inline">bold</b></dt></dl>
3640
3641 !! end
3642
3643 !! test
3644 Definition lists: self-closed tag
3645 !! wikitext
3646 ;one<br/>two : two-line fun
3647 !! html
3648 <dl><dt>one<br />two&#160;</dt>
3649 <dd> two-line fun</dd></dl>
3650
3651 !! end
3652
3653 !! test
3654 Bug 11748: Literal closing tags
3655 !! wikitext
3656 <dl>
3657 <dt>test 1</dt>
3658 <dd>test test test test test</dd>
3659 <dt>test 2</dt>
3660 <dd>test test test test test</dd>
3661 </dl>
3662 !! html
3663 <dl>
3664 <dt>test 1</dt>
3665 <dd>test test test test test</dd>
3666 <dt>test 2</dt>
3667 <dd>test test test test test</dd>
3668 </dl>
3669
3670 !! end
3671
3672 !! test
3673 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3674 !! wikitext
3675 <ul><li>
3676 ; term : description
3677 * unordered
3678 </li></ul>
3679 !! html
3680 <ul><li>
3681 <dl><dt> term&#160;</dt>
3682 <dd> description</dd></dl>
3683 <ul><li> unordered</li></ul>
3684 </li></ul>
3685
3686 !! end
3687
3688 !! test
3689
3690 Definition list with empty definition and following paragraph
3691 !! wikitext
3692 ; term:
3693 Paragraph text
3694 !! html
3695 <dl><dt> term</dt>
3696 <dd></dd></dl>
3697 <p>Paragraph text
3698 </p>
3699 !! end
3700
3701 !! test
3702 Nested definition lists using html syntax
3703 !! wikitext
3704 <dl><dt>x</dt>
3705 <dd>a</dd>
3706 <dd>b</dd></dl>
3707 !! html
3708 <dl><dt>x</dt>
3709 <dd>a</dd>
3710 <dd>b</dd></dl>
3711
3712 !! end
3713
3714 !! test
3715 Definition Lists: No nesting: Multiple dd's
3716 !! wikitext
3717 ;x
3718 :a
3719 :b
3720 !! html
3721 <dl><dt>x</dt>
3722 <dd>a</dd>
3723 <dd>b</dd></dl>
3724
3725 !! end
3726
3727 !! test
3728 Definition Lists: Indentation: Regular
3729 !! wikitext
3730 :i1
3731 ::i2
3732 :::i3
3733 !! html
3734 <dl><dd>i1
3735 <dl><dd>i2
3736 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3737
3738 !! end
3739
3740 !! test
3741 Definition Lists: Indentation: Missing 1st level
3742 !! wikitext
3743 ::i2
3744 :::i3
3745 !! html
3746 <dl><dd><dl><dd>i2
3747 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3748
3749 !! end
3750
3751 !! test
3752 Definition Lists: Indentation: Multi-level indent
3753 !! wikitext
3754 :::i3
3755 !! html
3756 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3757
3758 !! end
3759
3760 !! test
3761 Definition Lists: Hacky use to indent tables
3762 !! wikitext
3763 ::{|
3764 |foo
3765 |bar
3766 |}
3767 this text
3768 should be left alone
3769 !! html
3770 <dl><dd><dl><dd><table>
3771 <tr>
3772 <td>foo
3773 </td>
3774 <td>bar
3775 </td></tr></table></dd></dl></dd></dl>
3776 <p>this text
3777 should be left alone
3778 </p>
3779 !! end
3780
3781 !! test
3782 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3783 !! wikitext
3784 <!-- foo -->
3785 ::{|
3786 |foo
3787 |bar
3788 |}<!-- bar -->
3789 this text
3790 should be left alone
3791 !! html/parsoid
3792 <!-- foo -->
3793 <dl><dd><dl><dd><table><tr>
3794 <td>foo</td>
3795 <td>bar</td>
3796 </tr></table><!-- bar --></dd></dl></dd></dl>
3797 <p>this text
3798 should be left alone</p>
3799 !! end
3800
3801 !! test
3802 Definition Lists: Hacky use to indent tables, with comment before table
3803 !! wikitext
3804 ::<!-- foo -->{|
3805 |foo
3806 |}
3807 !! html/parsoid
3808 <dl><dd><dl><dd><!-- foo --><table><tr>
3809 <td>foo</td>
3810 </tr></table></dd></dl></dd></dl>
3811 !! end
3812
3813 # The trailing whitespace in this test is to catch a regression in
3814 # Parsoid after T54473.
3815 !! test
3816 Definition Lists: Hacky use to indent tables (WS-insensitive)
3817 !! wikitext
3818 : {|
3819 |a
3820 |}
3821 !! html/php
3822 <dl><dd><table>
3823 <tr>
3824 <td>a
3825 </td></tr></table></dd></dl>
3826
3827 !! html/parsoid
3828 <dl><dd> <table>
3829 <tbody><tr><td>a</td></tr>
3830 </tbody></table> </dd></dl>
3831 !! end
3832
3833 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3834 ## as an empty dt item. It also ignores all but the last ";" when followed
3835 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3836 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3837 ## ";"s.
3838 ##
3839 ## Ex: ";;t2 ::d2" is transformed into:
3840 ##
3841 ## <dl>
3842 ## <dt>t2 </dt>
3843 ## <dd>
3844 ## <dl>
3845 ## <dt></dt>
3846 ## <dd>d2</dd>
3847 ## </dl>
3848 ## </dd>
3849 ## </dl>
3850 ##
3851 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3852 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3853 ##
3854 ## <dl>
3855 ## <dt>
3856 ## <dl>
3857 ## <dt>t2 </dt>
3858 ## <dd>:d2</dd>
3859 ## </dl>
3860 ## </dt>
3861 ## </dl>
3862 ##
3863 ## All Parsoid only definition list tests have this difference.
3864 ##
3865 ## See also: https://phabricator.wikimedia.org/T8569
3866 ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3867
3868 !! test
3869 Table / list interaction: indented table with lists in table contents
3870 !! wikitext
3871 :{|
3872 |-
3873 | a
3874 * b
3875 |-
3876 | c
3877 * d
3878 |}
3879 !! html
3880 <dl><dd><table>
3881
3882 <tr>
3883 <td> a
3884 <ul><li> b</li></ul>
3885 </td></tr>
3886 <tr>
3887 <td> c
3888 <ul><li> d</li></ul>
3889 </td></tr></table></dd></dl>
3890
3891 !! end
3892
3893 !!test
3894 Table / list interaction: lists nested in tables nested in indented lists
3895 !! wikitext
3896 :{|
3897 |
3898 :a
3899 :b
3900 |
3901 *c
3902 *d
3903 |}
3904
3905 *e
3906 *f
3907 !! html
3908 <dl><dd><table>
3909 <tr>
3910 <td>
3911 <dl><dd>a</dd>
3912 <dd>b</dd></dl>
3913 </td>
3914 <td>
3915 <ul><li>c</li>
3916 <li>d</li></ul>
3917 </td></tr></table></dd></dl>
3918 <ul><li>e</li>
3919 <li>f</li></ul>
3920
3921 !!end
3922
3923 !! test
3924 Definition Lists: Nesting: Multi-level (Parsoid only)
3925 !! options
3926 parsoid
3927 !! wikitext
3928 ;t1 :d1
3929 ;;t2 ::d2
3930 ;;;t3 :::d3
3931 !! html
3932 <dl>
3933 <dt>t1 </dt>
3934 <dd>d1</dd>
3935 <dt>
3936 <dl>
3937 <dt>t2 </dt>
3938 <dd>:d2</dd>
3939 <dt>
3940 <dl>
3941 <dt>t3 </dt>
3942 <dd>::d3</dd>
3943 </dl>
3944 </dt>
3945 </dl>
3946 </dt>
3947 </dl>
3948
3949
3950 !! end
3951
3952
3953 !! test
3954 Definition Lists: Nesting: Test 2 (Parsoid only)
3955 !! wikitext
3956 ;t1
3957 ::d2
3958 !! html/php+tidy
3959 <dl>
3960 <dt>t1</dt>
3961 <dd>
3962 <dl>
3963 <dd>d2</dd>
3964 </dl>
3965 </dd>
3966 </dl>
3967 !! html/parsoid
3968 <dl>
3969 <dt>t1</dt>
3970 <dd>
3971 <dl>
3972 <dd>d2</dd>
3973 </dl>
3974 </dd>
3975 </dl>
3976
3977 !! end
3978
3979
3980 !! test
3981 Definition Lists: Nesting: Test 3 (Parsoid only)
3982 !! wikitext
3983 :;t1
3984 ::::d2
3985 !! html/php+tidy
3986 <dl>
3987 <dd>
3988 <dl>
3989 <dt>t1</dt>
3990 <dd>
3991 <dl>
3992 <dd>
3993 <dl>
3994 <dd>d2</dd>
3995 </dl>
3996 </dd>
3997 </dl>
3998 </dd>
3999 </dl>
4000 </dd>
4001 </dl>
4002 !! html/parsoid
4003 <dl>
4004 <dd>
4005 <dl>
4006 <dt>t1</dt>
4007 <dd>
4008 <dl>
4009 <dd>
4010 <dl>
4011 <dd>d2</dd>
4012 </dl>
4013 </dd>
4014 </dl>
4015 </dd>
4016 </dl>
4017 </dd>
4018 </dl>
4019
4020 !! end
4021
4022
4023 !! test
4024 Definition Lists: Nesting: Test 4
4025 !! wikitext
4026 ::;t3
4027 :::d3
4028 !! html
4029 <dl><dd><dl><dd><dl><dt>t3</dt>
4030 <dd>d3</dd></dl></dd></dl></dd></dl>
4031
4032 !! end
4033
4034
4035 ## The Parsoid team believes the following three test exposes a
4036 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4037 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4038 ## It also exposes a "misfeature" in tidy, which doesn't like
4039 ## <dl> tags with a single <dt> child; it converts the <dt> into
4040 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4041 !! test
4042 Definition Lists: Mixed Lists: Test 1
4043 !! wikitext
4044 :;* foo
4045 ::* bar
4046 :; baz
4047 !! html/php
4048 <dl><dd><dl><dt><ul><li> foo</li>
4049 <li> bar</li></ul></dt></dl>
4050 <dl><dt> baz</dt></dl></dd></dl>
4051
4052 !! html/php+tidy
4053 <dl>
4054 <dd>
4055 <dl>
4056 <dd>
4057 <ul>
4058 <li>foo</li>
4059 <li>bar</li>
4060 </ul>
4061 </dd>
4062 </dl>
4063 <dl>
4064 <dt>baz</dt>
4065 </dl>
4066 </dd>
4067 </dl>
4068 !! html/parsoid
4069 <dl>
4070 <dd><dl>
4071 <dt><ul>
4072 <li> foo
4073 </li>
4074 </ul></dt>
4075 <dd><ul>
4076 <li> bar
4077 </li>
4078 </ul></dd>
4079 <dt> baz</dt>
4080 </dl></dd>
4081 </dl>
4082 !! end
4083
4084 !! test
4085 Definition Lists: Mixed Lists: Test 2
4086 !! wikitext
4087 *: d1
4088 *: d2
4089 !! html
4090 <ul><li><dl><dd> d1</dd>
4091 <dd> d2</dd></dl></li></ul>
4092
4093 !! end
4094
4095
4096 !! test
4097 Definition Lists: Mixed Lists: Test 3
4098 !! wikitext
4099 *::: d1
4100 *::: d2
4101 !! html
4102 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4103 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4104
4105 !! end
4106
4107
4108 !! test
4109 Definition Lists: Mixed Lists: Test 4
4110 !! wikitext
4111 *;d1 :d2
4112 *;d3 :d4
4113 !! html
4114 <ul><li><dl><dt>d1&#160;</dt>
4115 <dd>d2</dd>
4116 <dt>d3&#160;</dt>
4117 <dd>d4</dd></dl></li></ul>
4118
4119 !! end
4120
4121
4122 !! test
4123 Definition Lists: Mixed Lists: Test 5
4124 !! wikitext
4125 *:d1
4126 *:: d2
4127 !! html
4128 <ul><li><dl><dd>d1
4129 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4130
4131 !! end
4132
4133
4134 !! test
4135 Definition Lists: Mixed Lists: Test 6
4136 !! wikitext
4137 #*:d1
4138 #*::: d3
4139 !! html
4140 <ol><li><ul><li><dl><dd>d1
4141 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4142
4143 !! end
4144
4145
4146 !! test
4147 Definition Lists: Mixed Lists: Test 7
4148 !! wikitext
4149 :* d1
4150 :* d2
4151 !! html
4152 <dl><dd><ul><li> d1</li>
4153 <li> d2</li></ul></dd></dl>
4154
4155 !! end
4156
4157
4158 !! test
4159 Definition Lists: Mixed Lists: Test 8
4160 !! wikitext
4161 :* d1
4162 ::* d2
4163 !! html
4164 <dl><dd><ul><li> d1</li></ul>
4165 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4166
4167 !! end
4168
4169
4170 !! test
4171 Definition Lists: Mixed Lists: Test 9
4172 !! wikitext
4173 *;foo :bar
4174 !! html
4175 <ul><li><dl><dt>foo&#160;</dt>
4176 <dd>bar</dd></dl></li></ul>
4177
4178 !! end
4179
4180
4181 !! test
4182 Definition Lists: Mixed Lists: Test 10
4183 !! wikitext
4184 *#;foo :bar
4185 !! html
4186 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4187 <dd>bar</dd></dl></li></ol></li></ul>
4188
4189 !! end
4190
4191 # The Parsoid team disagrees with the PHP parser's seemingly-random
4192 # rules regarding dd/dt on the next two tests. Parsoid is more
4193 # consistent, and recognizes the shared nesting and keeps the
4194 # still-open tags around until the nesting is complete.
4195 # (And tidy again converts <dt> to <dd> before 'bar'.)
4196
4197 !! test
4198 Definition Lists: Mixed Lists: Test 11
4199 !! wikitext
4200 *#*#;*;;foo :bar
4201 *#*#;boo :baz
4202 !! html/php
4203 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4204 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4205 <dl><dt>boo&#160;</dt>
4206 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4207
4208 !! html/php+tidy
4209 <ul>
4210 <li>
4211 <ol>
4212 <li>
4213 <ul>
4214 <li>
4215 <ol>
4216 <li>
4217 <dl>
4218 <dt>foo&#160;</dt>
4219 <dd>
4220 <ul>
4221 <li>
4222 <dl>
4223 <dd>
4224 <dl>
4225 <dt>bar</dt>
4226 </dl>
4227 </dd>
4228 </dl>
4229 </li>
4230 </ul>
4231 </dd>
4232 </dl>
4233 <dl>
4234 <dt>boo&#160;</dt>
4235 <dd>baz</dd>
4236 </dl>
4237 </li>
4238 </ol>
4239 </li>
4240 </ul>
4241 </li>
4242 </ol>
4243 </li>
4244 </ul>
4245 !! html/parsoid
4246 <ul>
4247 <li>
4248 <ol>
4249 <li>
4250 <ul>
4251 <li>
4252 <ol>
4253 <li>
4254 <dl>
4255 <dt>
4256 <ul>
4257 <li>
4258 <dl>
4259 <dt>
4260 <dl>
4261 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4262 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4263 </dl></dt>
4264 </dl></li>
4265 </ul></dt>
4266 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4267 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4268 </dl></li>
4269 </ol></li>
4270 </ul></li>
4271 </ol></li>
4272 </ul>
4273 !! end
4274
4275
4276 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4277 # From whitelist:
4278 # * The test is wrong, there are two colons where there should be :;
4279 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4280 !! test
4281 Definition Lists: Weird Ones: Test 1
4282 !! wikitext
4283 *#;*::;; foo : bar (who uses this?)
4284 !! html/php
4285 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4286 <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>
4287
4288 !! html/php+tidy
4289 <ul>
4290 <li>
4291 <ol>
4292 <li>
4293 <dl>
4294 <dt>foo&#160;</dt>
4295 <dd>
4296 <ul>
4297 <li>
4298 <dl>
4299 <dd>
4300 <dl>
4301 <dd>
4302 <dl>
4303 <dd>
4304 <dl>
4305 <dt>bar (who uses this?)</dt>
4306 </dl>
4307 </dd>
4308 </dl>
4309 </dd>
4310 </dl>
4311 </dd>
4312 </dl>
4313 </li>
4314 </ul>
4315 </dd>
4316 </dl>
4317 </li>
4318 </ol>
4319 </li>
4320 </ul>
4321 !! html/parsoid
4322 <ul>
4323 <li>
4324 <ol>
4325 <li>
4326 <dl>
4327 <dt>
4328 <ul>
4329 <li>
4330 <dl>
4331 <dd>
4332 <dl>
4333 <dd>
4334 <dl>
4335 <dt>
4336 <dl>
4337 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4338 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4339 </dl></dt>
4340 </dl></dd>
4341 </dl></dd>
4342 </dl></li>
4343 </ul></dt>
4344 </dl></li>
4345 </ol></li>
4346 </ul>
4347 !! end
4348
4349 !! test
4350 Definition Lists: colons occurring in tags
4351 !! wikitext
4352 ;a:b
4353 ;'''a:b'''
4354 ;<i>a:b</i>
4355 ;<span>a:b</span>
4356 ;<div>a:b</div>
4357 ;<div>a
4358 :b</div>
4359 ;{{echo|a:b}}
4360 ;{{echo|''a:b''}}
4361 ;;;''a:b''
4362 !! html+tidy
4363 <dl>
4364 <dt>a</dt>
4365 <dd>b</dd>
4366 <dt><b>a:b</b></dt>
4367 <dt><i>a:b</i></dt>
4368 <dt><span>a:b</span></dt>
4369 <dd>
4370 <div>a:b</div>
4371 </dd>
4372 <dd>
4373 <div>a
4374 <dl>
4375 <dd>b</dd>
4376 </dl>
4377 </div>
4378 </dd>
4379 <dt>a</dt>
4380 <dd>b</dd>
4381 <dt><i>a:b</i></dt>
4382 </dl>
4383 <dl>
4384 <dd>
4385 <dl>
4386 <dd>
4387 <dl>
4388 <dt><i>a:b</i></dt>
4389 </dl>
4390 </dd>
4391 </dl>
4392 </dd>
4393 </dl>
4394 !! html/parsoid
4395 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4396 <dt><b>a:b</b></dt>
4397 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4398 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4399 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4400 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4401 <dd>b</dd>
4402 <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>
4403 <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>
4404 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4405 !! end
4406
4407 !! test
4408 Definition Lists: colons and tables 1
4409 !! wikitext
4410 :{|
4411 | x
4412 |}
4413 :{|
4414 | y
4415 |}
4416 !! html
4417 <dl><dd><table>
4418 <tr>
4419 <td> x
4420 </td></tr></table></dd></dl>
4421 <dl><dd><table>
4422 <tr>
4423 <td> y
4424 </td></tr></table></dd></dl>
4425
4426 !! end
4427
4428 # Parsoid's output (as documented below) differs from php's in this case.
4429 # This is probably a bug. If we fixup parsoid to match php's output, the
4430 # above test should pass and the below test case can be removed. It is
4431 # unclear which output is more desirable.
4432
4433 !! test
4434 Definition Lists: colons and tables 2
4435 !! wikitext
4436 :{|
4437 | x
4438 |}
4439 :{|
4440 | y
4441 |}
4442 !! html/parsoid
4443 <dl><dd><table>
4444 <tr>
4445 <td> x
4446 </td></tr></table></dd>
4447 <dd><table>
4448 <tr>
4449 <td> y
4450 </td></tr></table></dd></dl>
4451 !! end
4452
4453 !! test
4454 Definition Lists: template interaction
4455 !! wikitext
4456 ::{{definition_list}}
4457
4458 :one
4459 ::{{definition_list}}
4460 :::two
4461 :::three
4462 ::four
4463 !! html/parsoid
4464 <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">
4465 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4466
4467 <dl><dd data-parsoid='{}'>one
4468 <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">
4469 </span><dd about="#mwt2">two
4470 <dl><dd>two</dd>
4471 <dd>three</dd></dl></dd>
4472 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4473 !! end
4474
4475
4476 ###
4477 ### External links
4478 ###
4479 !! test
4480 External links: non-bracketed
4481 !! wikitext
4482 Non-bracketed: http://example.com
4483 !! html
4484 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4485 </p>
4486 !! end
4487
4488 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4489 !! test
4490 External links: numbered
4491 !! wikitext
4492 Numbered: [http://example.com]
4493 Numbered: [http://example.net]
4494 Numbered: [http://example.com]
4495 !! html/php
4496 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4497 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4498 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4499 </p>
4500 !! html/parsoid
4501 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4502 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4503 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4504 !!end
4505
4506 !! test
4507 External links: specified text
4508 !! wikitext
4509 Specified text: [http://example.com link]
4510 !! html
4511 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4512 </p>
4513 !!end
4514
4515 !! test
4516 External links: trail
4517 !! wikitext
4518 Linktrails should not work for external links: [http://example.com link]s
4519 !! html
4520 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4521 </p>
4522 !! end
4523
4524 !! test
4525 External links: dollar sign in URL
4526 !! wikitext
4527 http://example.com/1$2345
4528 !! html
4529 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4530 </p>
4531 !! end
4532
4533 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4534 !! test
4535 External links: dollar sign in URL (autonumber)
4536 !! wikitext
4537 [http://example.com/1$2345]
4538 !! html/php
4539 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4540 </p>
4541 !! html/parsoid
4542 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4543 !!end
4544
4545 !! test
4546 External links: open square bracket forbidden in URL (bug 4377)
4547 !! options
4548 parsoid=wt2html,wt2wt,html2html
4549 !! wikitext
4550 http://example.com/1[2345
4551 !! html/php
4552 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4553 </p>
4554 !! html/parsoid
4555 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4556 !! end
4557
4558 !! test
4559 External links: open square bracket forbidden in URL (named) (bug 4377)
4560 !! options
4561 parsoid=wt2html,html2html
4562 !! wikitext
4563 [http://example.com/1[2345]
4564 !! html/php
4565 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4566 </p>
4567 !! html/parsoid
4568 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4569 !!end
4570
4571 # parsoid adds a space before the link name
4572 !! test
4573 External links: open square bracket forbidden in URL (named) (bug 4377)
4574 Parsoid variant.
4575 !! wikitext
4576 [http://example.com/1 [2345]
4577 !! html
4578 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4579 </p>
4580 !!end
4581
4582 !! test
4583 External links: nowiki in URL link text (bug 6230)
4584 !! wikitext
4585 [http://example.com/ <nowiki>''example site''</nowiki>]
4586 !! html
4587 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4588 </p>
4589 !! end
4590
4591 !! test
4592 External links: newline forbidden in text (bug 6230 regression check)
4593 !! wikitext
4594 [http://example.com/ first
4595 second]
4596 !! html
4597 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4598 second]
4599 </p>
4600 !!end
4601
4602 !! test
4603 External links: Pipe char between url and text
4604 !! wikitext
4605 [http://example.com | link]
4606 !! html
4607 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4608 </p>
4609 !!end
4610
4611 !! test
4612 External links: protocol-relative URL in brackets
4613 !! wikitext
4614 [//example.com/ Test]
4615 !! html
4616 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4617 </p>
4618 !! end
4619
4620 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4621 !! test
4622 External links: protocol-relative URL in brackets without text
4623 !! wikitext
4624 [//example.com]
4625 !! html/php
4626 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4627 </p>
4628 !! html/parsoid
4629 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4630 !! end
4631
4632 !! test
4633 External links: protocol-relative URL in free text is left alone
4634 !! wikitext
4635 //example.com/Foo
4636 !! html
4637 <p>//example.com/Foo
4638 </p>
4639 !!end
4640
4641 !! test
4642 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4643 !! wikitext
4644 foo//example.com/Foo
4645 !! html
4646 <p>foo//example.com/Foo
4647 </p>
4648 !! end
4649
4650 !! test
4651 External links: with no contents
4652 !! wikitext
4653 [http://en.wikipedia.org/wiki/Foo]
4654
4655 [[wikipedia:Foo|Bar]]
4656
4657 [[wikipedia:Foo|<span>Bar</span>]]
4658 !! html/php
4659 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4660 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4661 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4662 </p>
4663 !! html/parsoid
4664 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4665 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4666 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4667 !! end
4668
4669 !! test
4670 External links: Free with trailing punctuation
4671 !! wikitext
4672 http://example.com,
4673 http://example.com;
4674 http://example.com\
4675 http://example.com.
4676 http://example.com:
4677 http://example.com!
4678 http://example.com?
4679 http://example.com)
4680 http://example.com/url_with_(brackets)
4681 (http://example.com/url_without_brackets)
4682 http://example.com/url_with_entity&amp;
4683 http://example.com/url_with_entity&#x26;
4684 http://example.com/url_with_entity&#038;
4685 http://example.com/url_with_entity&nbsp;
4686 http://example.com/url_with_entity&#xA0;
4687 http://example.com/url_with_entity&#160;
4688 http://example.com/url_with_entity&lt;
4689 http://example.com/url_with_entity&#x3C;
4690 http://example.com/url_with_entity&#60;
4691 !! html/php
4692 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4693 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4694 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4695 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4696 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4697 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4698 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4699 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4700 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4701 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4702 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4703 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4704 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4705 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4706 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4707 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4708 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4709 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4710 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4711 </p>
4712 !! html/parsoid
4713 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4714 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4715 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4716 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4717 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4718 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4719 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4720 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4721 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4722 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4723 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4724 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4725 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4726 <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>
4727 <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>
4728 <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>
4729 <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>
4730 <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>
4731 <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>
4732 !! end
4733
4734 !! test
4735 External links: tricky Parsoid html2html case
4736 !! options
4737 parsoid=wt2html,wt2wt,html2html
4738 !! wikitext
4739 http://example.com/url_with_entity&amp;amp;
4740 !! html/php
4741 <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>;
4742 </p>
4743 !! html/parsoid
4744 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4745 !! end
4746
4747 !! test
4748 External links: Free with trailing quotes (T113666)
4749 !! wikitext
4750 '''News:''' Stuff here
4751
4752 news:'a'b''c''d e
4753 !! html/php
4754 <p><b>News:</b> Stuff here
4755 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4756 </p>
4757 !! html/parsoid
4758 <p><b>News:</b> Stuff here</p>
4759 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4760 !! end
4761
4762 !! test
4763 External links: Lone protocols are never linked (T105697)
4764 !! wikitext
4765 http://
4766 http://;
4767 (http://)
4768 bitcoin:
4769 bitcoin:;
4770 (bitcoin:)
4771 !! html
4772 <p>http://
4773 http://;
4774 (http://)
4775 bitcoin:
4776 bitcoin:;
4777 (bitcoin:)
4778 </p>
4779 !! end
4780
4781 !! test
4782 External links: No preceding word characters allowed (bug 65278)
4783 !! wikitext
4784 NOPEhttp://example.com
4785 N0http://example.com
4786 ok:http://example.com
4787 ok-http://example.com
4788 !! html
4789 <p>NOPEhttp://example.com
4790 N0http://example.com
4791 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4792 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4793 </p>
4794 !! end
4795
4796 !! test
4797 External links: nofollow domain exception
4798 !! wikitext
4799 A [https://no-nofollow.org/foobar link], and another [https://example.org link].
4800 !! html
4801 <p>A <a class="external text" href="https://no-nofollow.org/foobar">link</a>, and another <a rel="nofollow" class="external text" href="https://example.org">link</a>.
4802 </p>
4803 !!end
4804
4805 !! test
4806 External image
4807 !! wikitext
4808 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4809 !! html
4810 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4811 </p>
4812 !! end
4813
4814 !! test
4815 External image from https
4816 !! wikitext
4817 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4818 !! html
4819 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
4820 </p>
4821 !! end
4822
4823 !! test
4824 External image (when not allowed)
4825 !! options
4826 wgAllowExternalImages=0
4827 !! wikitext
4828 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4829 !! html
4830 <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>
4831 </p>
4832 !! end
4833
4834 !! test
4835 Link to non-http image, no img tag
4836 !! wikitext
4837 Link to non-http image, no img tag: ftp://example.com/test.jpg
4838 !! html
4839 <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>
4840 </p>
4841 !! end
4842
4843 !! test
4844 External links: terminating separator
4845 !! wikitext
4846 Terminating separator: http://example.com/thing,
4847 !! html
4848 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4849 </p>
4850 !! end
4851
4852 !! test
4853 External links: intervening separator
4854 !! wikitext
4855 Intervening separator: http://example.com/1,2,3
4856 !! html
4857 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4858 </p>
4859 !! end
4860
4861 !! test
4862 External links: old bug with URL in query
4863 !! wikitext
4864 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4865 !! html
4866 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4867 </p>
4868 !! end
4869
4870 !! test
4871 External links: old URL-in-URL bug, mixed protocols
4872 !! wikitext
4873 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4874 !! html
4875 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4876 </p>
4877 !!end
4878
4879 # Since Parsoid is starting to emit canonical wikitext for links,
4880 # [http://example.com http://example.com] will not RT back to that
4881 # form anymore.
4882 !! test
4883 External links: URL in text
4884 !! options
4885 parsoid=wt2html
4886 !! wikitext
4887 URL in text: [http://example.com http://example.com]
4888 !! html/php
4889 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4890 </p>
4891 !! html/parsoid
4892 <p>URL in text: <a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
4893 !! end
4894
4895 !! test
4896 External links: Clickable images
4897 !! wikitext
4898 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4899 !! html/php
4900 <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>
4901 </p>
4902 !! html/parsoid
4903 <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>
4904 !! end
4905
4906 !! test
4907 External links: raw ampersand
4908 !! wikitext
4909 Old &amp; use: http://x&y
4910 !! html
4911 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4912 </p>
4913 !! end
4914
4915 !! test
4916 External links: encoded ampersand
4917 !! wikitext
4918 Old &amp; use: http://x&amp;y
4919 !! html/php
4920 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4921 </p>
4922 !! html/parsoid
4923 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4924 !! end
4925
4926 !! test
4927 External links: encoded equals (bug 6102)
4928 !! wikitext
4929 http://example.com/?foo&#61;bar
4930 !! html/php
4931 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4932 </p>
4933 !! html/parsoid
4934 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4935 !! end
4936
4937 ##
4938 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4939 ## does it number them. As discussed in bug 53505, we can identify
4940 ## autonumbered links via CSS.
4941 ##
4942
4943 !! test
4944 External links: [raw ampersand]
4945 !! wikitext
4946 Old &amp; use: [http://x&y]
4947 !! html/php
4948 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4949 </p>
4950 !! html/parsoid
4951 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4952 !! end
4953
4954 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4955 # mode will return the [raw ampersand] wikitext
4956 !! test
4957 External links: [encoded ampersand]
4958 !! options
4959 parsoid=wt2html,wt2wt,html2html
4960 !! wikitext
4961 Old &amp; use: [http://x&amp;y]
4962 !! html/php
4963 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4964 </p>
4965 !! html/parsoid
4966 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4967 !! end
4968
4969 !! test
4970 External links: [raw equals]
4971 !! wikitext
4972 [http://example.com/?foo=bar]
4973 !! html/php
4974 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4975 </p>
4976 !! html/parsoid
4977 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4978 !! end
4979
4980 # note that parsoid html is identical to [raw equals] case; so html2wt
4981 # mode will return the [raw equals] wikitext
4982 !! test
4983 External links: [encoded equals] (bug 6102)
4984 !! options
4985 parsoid=wt2html,wt2wt,html2html
4986 !! wikitext
4987 [http://example.com/?foo&#61;bar]
4988 !! html/php
4989 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4990 </p>
4991 !! html/parsoid
4992 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4993 !! end
4994
4995 # xxx parsoid strips the IDN character, so the round-trip tests will
4996 # obviously fail and are disabled. --cscott
4997 !! test
4998 External links: [IDN ignored character reference in hostname; strip it right off]
4999 !! options
5000 parsoid=wt2html,wt2wt,html2html
5001 !! wikitext
5002 [http://e&zwnj;xample.com/]
5003 !! html/php
5004 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
5005 </p>
5006 !! html/parsoid
5007 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
5008 !! end
5009
5010 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
5011 # Where an external link could easily circumvent the sanitization of the text of
5012 # a link like this (where an IDN-ignore character is in the URL somewhere), this
5013 # test demands a higher standard. That's a bit strange.
5014 #
5015 # Example:
5016 #
5017 # http://e‌xample.com -> [http://example.com|http://example.com]
5018 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
5019 #
5020 # The first example is sanitized, but the second is not. Any security benefits
5021 # from this production are trivial to circumvent. Either remove this test and
5022 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
5023 # the test accordingly.
5024 #
5025 # All our love,
5026 # The Parsoid team.
5027 # xxx parsoid strips the IDN character, so the round-trip tests will
5028 # obviously fail and are disabled. --cscott
5029 !! test
5030 External links: IDN ignored character reference in hostname; strip it right off
5031 !! options
5032 parsoid=wt2html,html2html
5033 !! wikitext
5034 http://e&zwnj;xample.com/
5035 !! html/php
5036 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5037 </p>
5038 !! html/parsoid
5039 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
5040 !! end
5041
5042 !! test
5043 External links: www.jpeg.org (bug 554)
5044 !! wikitext
5045 http://www.jpeg.org
5046 !! html
5047 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5048 </p>
5049 !! end
5050
5051 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
5052 !! test
5053 External links: URL within URL (original bug 2)
5054 !! wikitext
5055 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5056 !! html/php
5057 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5058 </p>
5059 !! html/parsoid
5060 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5061 !! end
5062
5063 !! test
5064 BUG 361: URL inside bracketed URL
5065 !! wikitext
5066 [http://www.example.com/foo http://www.example.com/bar]
5067 !! html
5068 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5069 </p>
5070 !! end
5071
5072 !! test
5073 BUG 361: URL within URL, not bracketed
5074 !! wikitext
5075 http://www.example.com/foo?=http://www.example.com/bar
5076 !! html
5077 <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>
5078 </p>
5079 !! end
5080
5081 !! test
5082 BUG 289: ">"-token in URL-tail
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>&lt;hello&gt;
5087 </p>
5088 !!end
5089
5090 !! test
5091 BUG 289: literal ">"-token in URL-tail
5092 !! wikitext
5093 http://www.example.com/<b>html</b>
5094 !! html/php
5095 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5096 </p>
5097 !! html/parsoid
5098 <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>
5099 !! end
5100
5101 !! test
5102 BUG 289: ">"-token in bracketed URL
5103 !! wikitext
5104 [http://www.example.com/<hello> stuff]
5105 !! html
5106 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5107 </p>
5108 !!end
5109
5110 !! test
5111 BUG 289: literal ">"-token in bracketed URL
5112 !! wikitext
5113 [http://www.example.com/<b>html</b> stuff]
5114 !! html
5115 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5116 </p>
5117 !!end
5118
5119 !! test
5120 BUG 289: literal double quote at end of URL
5121 !! wikitext
5122 http://www.example.com/"hello"
5123 !! html
5124 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5125 </p>
5126 !!end
5127
5128 !! test
5129 BUG 289: literal double quote in bracketed URL
5130 !! wikitext
5131 [http://www.example.com/"hello" stuff]
5132 !! html
5133 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5134 </p>
5135 !!end
5136
5137 !! test
5138 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5139 !! wikitext
5140 [http://www.example.com test]
5141 !! html
5142 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5143 </p>
5144 !! end
5145
5146 !! test
5147 External links: link text with spaces
5148 !! wikitext
5149 [http://www.example.com a b c]
5150 [http://www.example.com ''a'' ''b'']
5151 !! html
5152 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5153 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5154 </p>
5155 !! end
5156
5157 !! test
5158 External links: wiki links within external link (Bug 3695)
5159 !! options
5160 parsoid=wt2html,html2html
5161 !! wikitext
5162 [http://example.com [[wikilink]] embedded in ext link]
5163 !! html/php
5164 <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>
5165 </p>
5166 !! html/parsoid
5167 <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>
5168 !! end
5169
5170 !! test
5171 BUG 787: Links with one slash after the url protocol are invalid
5172 !! wikitext
5173 http:/example.com
5174
5175 [http:/example.com title]
5176 !! html
5177 <p>http:/example.com
5178 </p><p>[http:/example.com title]
5179 </p>
5180 !! end
5181
5182 !! test
5183 Bracketed external links with template-generated invalid target
5184 !! wikitext
5185 [{{echo|http:/example.com}} title]
5186 !! html
5187 <p>[http:/example.com title]
5188 </p>
5189 !! end
5190
5191 !! test
5192 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5193 !! wikitext
5194 ''[http://example.com text'']
5195 [http://example.com '''text]'''
5196 ''Something [http://example.com in italic'']
5197 ''Something [http://example.com mixed''''', even bold]'''
5198 '''''Now [http://example.com both''''']
5199 !! html
5200 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5201 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5202 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5203 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5204 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5205 </p>
5206 !! end
5207
5208
5209 !! test
5210 Bug 4781: %26 in URL
5211 !! wikitext
5212 http://www.example.com/?title=AT%26T
5213 !! html/php
5214 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5215 </p>
5216 !! html/parsoid
5217 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5218 !! end
5219
5220 # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5221 # % is actually legal in HTML5. Any change in output would need testing though.
5222 !! test
5223 Bug 4781, 5267: %25 in URL
5224 !! wikitext
5225 http://www.example.com/?title=100%25_Bran
5226 !! html/php
5227 <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>
5228 </p>
5229 !! html/parsoid
5230 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5231 !! end
5232
5233 !! test
5234 Bug 4781, 5267: %28, %29 in URL
5235 !! wikitext
5236 http://www.example.com/?title=Ben-Hur_%281959_film%29
5237 !! html/php
5238 <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>
5239 </p>
5240 !! html/parsoid
5241 <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>
5242 !! end
5243
5244
5245 !! test
5246 Bug 4781: %26 in autonumber URL
5247 !! wikitext
5248 [http://www.example.com/?title=AT%26T]
5249 !! html/php
5250 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5251 </p>
5252 !! html/parsoid
5253 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5254 !! end
5255
5256 !! test
5257 Bug 4781, 5267: %26 in autonumber URL
5258 !! wikitext
5259 [http://www.example.com/?title=100%25_Bran]
5260 !! html/php
5261 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5262 </p>
5263 !! html/parsoid
5264 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5265 !! end
5266
5267 !! test
5268 Bug 4781, 5267: %28, %29 in autonumber URL
5269 !! wikitext
5270 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5271 !! html/php
5272 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5273 </p>
5274 !! html/parsoid
5275 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5276 !! end
5277
5278
5279 !! test
5280 Bug 4781: %26 in bracketed URL
5281 !! wikitext
5282 [http://www.example.com/?title=AT%26T link]
5283 !! html/php
5284 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5285 </p>
5286 !! html/parsoid
5287 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5288 !! end
5289
5290 !! test
5291 Bug 4781, 5267: %25 in bracketed URL
5292 !! wikitext
5293 [http://www.example.com/?title=100%25_Bran link]
5294 !! html
5295 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5296 </p>
5297 !! end
5298
5299 !! test
5300 Bug 4781, 5267: %28, %29 in bracketed URL
5301 !! wikitext
5302 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5303 !! html/php
5304 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5305 </p>
5306 !! html/parsoid
5307 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5308 !! end
5309
5310 !! test
5311 External link containing a period in the anchor. (bug 63947)
5312 !! wikitext
5313 [//foo.org/bar#baz. bang]
5314
5315 [//foo.org/bar. bang]
5316 !! html/php
5317 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5318 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5319 </p>
5320 !! html/parsoid
5321 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5322 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5323 !! end
5324
5325 !! test
5326 External link containing a single quote. (bug 63947)
5327 !! wikitext
5328 [//foo.org/bar'baz]
5329
5330 [//foo.org/bar'baz bang]
5331 !! html/php
5332 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5333 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5334 </p>
5335 !! html/parsoid
5336 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5337 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5338 !! end
5339
5340 !! test
5341 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5342 !! wikitext
5343 Some [http://example.com/ pretty ''italics'' and stuff]!
5344 !! html
5345 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5346 </p>
5347 !! end
5348
5349 !! test
5350 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5351 !! wikitext
5352 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5353 !! html
5354 <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>
5355 </p>
5356 !! end
5357
5358 !! test
5359 External link containing double-single-quotes with no space separating the url from text in italics
5360 !! wikitext
5361 [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]].]
5362 !! html/php
5363 <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>
5364 </p>
5365 !! html/php+tidy
5366 <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>
5367 !! html/parsoid
5368 <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>
5369 !! end
5370
5371 !! test
5372 External link with comments in link text
5373 !! wikitext
5374 [http://www.google.com Google <!-- comment -->]
5375 !! html/php
5376 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5377 </p>
5378 !! html/parsoid
5379 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5380 !! end
5381
5382 !! test
5383 External link to bare IPv4 address
5384 !! wikitext
5385 [http://192.168.0.1 Link]
5386 !! html/php
5387 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5388 </p>
5389 !! html/parsoid
5390 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5391 !! end
5392
5393 !! test
5394 URL-encoding in URL functions (single parameter)
5395 !! wikitext
5396 {{localurl:Some page|amp=&}}
5397 !! html
5398 <p>/index.php?title=Some_page&amp;amp=&amp;
5399 </p>
5400 !! end
5401
5402 !! test
5403 URL-encoding in URL functions (multiple parameters)
5404 !! wikitext
5405 {{localurl:Some page|q=?&amp=&}}
5406 !! html
5407 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5408 </p>
5409 !! end
5410
5411 !! test
5412 Brackets in urls
5413 !! wikitext
5414 http://example.com/index.php?foozoid%5B%5D=bar
5415
5416 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5417 !! html/php
5418 <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>
5419 </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>
5420 </p>
5421 !! html/parsoid
5422 <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>
5423
5424 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5425 !! end
5426
5427 !! test
5428 IPv6 urls, autolink format (T23261)
5429 !! wikitext
5430 http://[2404:130:0:1000::187:2]/index.php
5431
5432 Examples from RFC 2373, section 2.2:
5433 * http://[1080::8:800:200C:417A]/unicast
5434 * http://[FF01::101]/multicast
5435 * http://[::1]/loopback
5436 * http://[::]/unspecified
5437 * http://[::13.1.68.3]/ipv4compat
5438 * http://[::FFFF:129.144.52.38]/ipv4compat
5439
5440 Examples from RFC 2732, section 2:
5441 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5442 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5443 * http://[3ffe:2a00:100:7031::1]
5444 * http://[1080::8:800:200C:417A]/foo
5445 * http://[::192.9.5.5]/ipng
5446 * http://[::FFFF:129.144.52.38]:80/index.html
5447 * http://[2010:836B:4179::836B:4179]
5448
5449 !! html/php
5450 <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>
5451 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5452 </p>
5453 <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>
5454 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5455 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5456 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5457 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5458 <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>
5459 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5460 </p>
5461 <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>
5462 <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>
5463 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5464 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5465 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5466 <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>
5467 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5468
5469 !! html/parsoid
5470 <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>
5471
5472 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5473 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5474 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5475 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5476 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5477 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5478 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5479
5480 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5481 <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>
5482 <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>
5483 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5484 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5485 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5486 <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>
5487 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5488 !! end
5489
5490 !! test
5491 IPv6 urls, bracketed format (T23261)
5492 !! wikitext
5493 [http://[2404:130:0:1000::187:2]/index.php test]
5494
5495 Examples from RFC 2373, section 2.2:
5496 * [http://[1080::8:800:200C:417A] unicast]
5497 * [http://[FF01::101] multicast]
5498 * [http://[::1]/ loopback]
5499 * [http://[::] unspecified]
5500 * [http://[::13.1.68.3] ipv4compat]
5501 * [http://[::FFFF:129.144.52.38] ipv4compat]
5502
5503 Examples from RFC 2732, section 2:
5504 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5505 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5506 * [http://[3ffe:2a00:100:7031::1] 3]
5507 * [http://[1080::8:800:200C:417A]/foo 4]
5508 * [http://[::192.9.5.5]/ipng 5]
5509 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5510 * [http://[2010:836B:4179::836B:4179] 7]
5511
5512 !! html/php
5513 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5514 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5515 </p>
5516 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5517 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5518 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5519 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5520 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5521 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5522 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5523 </p>
5524 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5525 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5526 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5527 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5528 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5529 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5530 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5531
5532 !! html/parsoid
5533 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5534
5535 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5536 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5537 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5538 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5539 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5540 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5541 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5542
5543 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5544 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5545 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5546 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5547 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5548 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5549 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5550 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5551 !! end
5552
5553 !! test
5554 Non-extlinks in brackets
5555 !! wikitext
5556 [foo]
5557 [foo bar]
5558 [foo ''bar'']
5559 [fool's] errand
5560 [fool's errand]
5561 [{{echo|foo}}]
5562 [{{echo|foo}} bar]
5563 [{{echo|foo}} ''bar'']
5564 [{{echo|foo}}l's] errand
5565 [{{echo|foo}}l's errand]
5566 [url={{echo|foo}}]
5567 [url=http://example.com]
5568 [http:// bare protocols don't count]
5569 !! html/php
5570 <p>[foo]
5571 [foo bar]
5572 [foo <i>bar</i>]
5573 [fool's] errand
5574 [fool's errand]
5575 [foo]
5576 [foo bar]
5577 [foo <i>bar</i>]
5578 [fool's] errand
5579 [fool's errand]
5580 [url=foo]
5581 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5582 [http:// bare protocols don't count]
5583 </p>
5584 !! html/parsoid
5585 <p>[foo]
5586 [foo bar]
5587 [foo <i>bar</i>]
5588 [fool's] errand
5589 [fool's errand]
5590 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5591 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5592 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5593 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5594 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5595 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5596 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5597 [http:// bare protocols don't count]</p>
5598 !! end
5599
5600 !! test
5601 Percent encoding in external links
5602 !! wikitext
5603 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5604 !! html/php
5605 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5606 </p>
5607 !! html/parsoid
5608 <p><a rel="mw:ExtLink"
5609 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5610 !! end
5611
5612 !! test
5613 Use url link syntax for links where the content is equal the link target
5614 !! wikitext
5615 http://example.com
5616 !! html/php
5617 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5618 </p>
5619 !! html/parsoid
5620 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5621 !! end
5622
5623 !! test
5624 Parenthesis in external links, especially URL links
5625 !! wikitext
5626 http://example.com)
5627
5628 http://example.com/test)
5629
5630 http://example.com/(test)
5631
5632 http://example.com/((test)
5633
5634 (http://example.com/(test))
5635
5636 (http://example.com/(test)))))
5637
5638 http://example.com/a)b
5639
5640 [http://example.com) foo]
5641 !! html/php
5642 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5643 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5644 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5645 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5646 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5647 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5648 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5649 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5650 </p>
5651 !! html/parsoid
5652 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5653 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5654 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5655 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5656 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5657 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5658 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5659 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5660 !! end
5661
5662 !! test
5663 Parenthesis in external links, w/ transclusion or comment
5664 !! wikitext
5665 (http://example.com/{{echo|hi}})
5666
5667 (http://example.com<!-- hi -->)
5668 !! html/php
5669 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5670 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5671 </p>
5672 !! html/parsoid
5673 <p>(<a typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[20,31,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"hi\"}},\"i\":0}}]}&#39;>hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
5674
5675 <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>
5676 !! end
5677
5678 !! test
5679 Serialize <a> tags with invalid link targets as plain text
5680 !! options
5681 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5682 !! html/parsoid
5683 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5684 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5685 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5686 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5687 !! wikitext
5688 text
5689 <nowiki>*</nowiki>text
5690 <nowiki>[[foo]]</nowiki>
5691 <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
5692 !! end
5693
5694 !! test
5695 mw:ExtLink -vs- mw:WikiLink (T94723)
5696 !! options
5697 parsoid=html2wt
5698 !! html/parsoid
5699 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
5700 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5701 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5702 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5703 <p>
5704 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5705 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5706 </p>
5707 !! wikitext
5708 [[Foo|Bar]]
5709 [[Foo|Bar]]
5710 [[wikipedia:Foo|Bar]]
5711 [[wikipedia:Foo|Bar]]
5712
5713 [[wikipedia:European_Robin|European Robin]]
5714 [[wikipedia:European_Robin|European Robin]]
5715 !! end
5716
5717 !! test
5718 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5719 !! options
5720 parsoid=wt2wt
5721 !! wikitext
5722 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5723 !! html/parsoid
5724 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5725 !! end
5726
5727
5728 ###
5729 ### Quotes
5730 ###
5731
5732 !! test
5733 Quotes
5734 !! wikitext
5735 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5736
5737 Normal text. '''''Bold italic text.''''' Normal text.
5738 !! html
5739 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5740 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5741 </p>
5742 !! end
5743
5744
5745 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5746 # parser strips. The wikitext contains just the first half of the bold
5747 # quote pair.
5748 !! test
5749 Unclosed and unmatched quotes
5750 !! wikitext
5751 '''''Bold italic text '''with bold deactivated''' in between.'''''
5752
5753 '''''Bold italic text ''with italic deactivated'' in between.'''''
5754
5755 '''Bold text..
5756
5757 ..spanning two paragraphs (should not work).'''
5758
5759 '''Bold tag left open
5760
5761 ''Italic tag left open
5762
5763 Normal text.
5764
5765 <!-- Unmatching number of opening, closing tags: -->
5766 '''This year''''s election ''should'' beat '''last year''''s.
5767
5768 ''Tom'''s car is bigger than ''Susan'''s.
5769
5770 Plain ''italic'''s plain
5771 !! html/php
5772 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5773 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5774 </p><p><b>Bold text..</b>
5775 </p><p>..spanning two paragraphs (should not work).
5776 </p><p><b>Bold tag left open</b>
5777 </p><p><i>Italic tag left open</i>
5778 </p><p>Normal text.
5779 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5780 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5781 </p><p>Plain <i>italic'</i>s plain
5782 </p>
5783 !! html/parsoid
5784 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5785 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5786 </p><p><b>Bold text..</b>
5787 </p><p>..spanning two paragraphs (should not work).<b></b>
5788 </p><p><b>Bold tag left open</b>
5789 </p><p><i>Italic tag left open</i>
5790 </p><p>Normal text.
5791 </p>
5792 <!-- Unmatching number of opening, closing tags: -->
5793 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5794 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5795 </p><p>Plain <i>italic'</i>s plain
5796 </p>
5797 !! end
5798
5799 ###
5800 ### Tables
5801 ###
5802 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5803 ###
5804
5805 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5806 # is the bare minimum required by the spec, see:
5807 # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5808 # Parsoid team replies: empty table tags are legal in HTML5
5809 !! test
5810 A table with no data.
5811 !! options
5812 parsoid=wt2html
5813 !! wikitext
5814 {||}
5815 !! html/php
5816
5817 !! html/parsoid
5818 <table></table>
5819
5820 !! end
5821
5822 !! test
5823 A table with stray table end tags on start tag line (wt2html)
5824 !! options
5825 parsoid=wt2html
5826 !! wikitext
5827 {|style="color: red;"|}
5828
5829 {|style="color: red;" |}
5830 |foo
5831 |}
5832
5833 {|style="color: red;"|} id="foo"
5834 |foo
5835 |}
5836
5837 {|style="color: red;" |} id="foo"
5838 |foo
5839 |}
5840 !! html
5841 <table style="color: red;"></table>
5842
5843 <table style="color: red;">
5844 <tbody><tr>
5845 <td>foo</td>
5846 </tr></tbody>
5847 </table>
5848
5849 <table style="color: red;" id="foo">
5850 <tbody><tr>
5851 <td>foo</td>
5852 </tr></tbody>
5853 </table>
5854
5855 <table style="color: red;" id="foo">
5856 <tbody><tr>
5857 <td>foo</td>
5858 </tr></tbody>
5859 </table>
5860
5861 !! end
5862
5863 !! test
5864 A table with no data (take 2)
5865 !! wikitext
5866 {|
5867 |}
5868 !! html/parsoid
5869 <table></table>
5870 !! end
5871
5872 # A table with nothing but a caption is invalid XHTML, we might want to render
5873 # this as <p>caption</p>
5874 # Parsoid team replies: table with only a caption is legal in HTML5
5875 !! test
5876 A table with nothing but a caption
5877 !! wikitext
5878 {|
5879 |+ caption
5880 |}
5881 !! html/php
5882 <table>
5883 <caption> caption
5884 </caption><tr><td></td></tr></table>
5885
5886 !! html/parsoid
5887 <table><caption> caption</caption></table>
5888 !! end
5889
5890 !! test
5891 A table with caption with default-spaced attributes and a table row
5892 !! wikitext
5893 {|
5894 |+ style="color: red;" | caption1
5895 |-
5896 | foo
5897 |}
5898 !! html
5899 <table>
5900 <caption style="color: red;"> caption1
5901 </caption>
5902 <tr>
5903 <td> foo
5904 </td></tr></table>
5905
5906 !! end
5907
5908 !! test
5909 A table with captions with non-default spaced attributes and a table row
5910 !! wikitext
5911 {|
5912 |+style="color: red;"|caption2
5913 |+ style="color: red;"| caption3
5914 |-
5915 | foo
5916 |}
5917 !! html
5918 <table>
5919 <caption style="color: red;">caption2
5920 </caption>
5921 <caption style="color: red;"> caption3
5922 </caption>
5923 <tr>
5924 <td> foo
5925 </td></tr></table>
5926
5927 !! end
5928
5929 !! test
5930 Table td-cell syntax variations
5931 !! wikitext
5932 {|
5933 | foo bar foo | baz
5934 | foo bar foo || baz
5935 | style='color:red;' | baz
5936 | style='color:red;' || baz
5937 |}
5938 !! html
5939 <table>
5940 <tr>
5941 <td> baz
5942 </td>
5943 <td> foo bar foo </td>
5944 <td> baz
5945 </td>
5946 <td style="color:red;"> baz
5947 </td>
5948 <td> style='color:red;' </td>
5949 <td> baz
5950 </td></tr></table>
5951
5952 !! end
5953
5954 !! test
5955 Simple table
5956 !! wikitext
5957 {|
5958 | 1 || 2
5959 |-
5960 | 3 || 4
5961 |}
5962 !! html
5963 <table>
5964 <tr>
5965 <td> 1 </td>
5966 <td> 2
5967 </td></tr>
5968 <tr>
5969 <td> 3 </td>
5970 <td> 4
5971 </td></tr></table>
5972
5973 !! end
5974
5975 !! test
5976 Simple table but with multiple dashes for row wikitext
5977 !! wikitext
5978 {|
5979 | foo
5980 |-----
5981 | bar
5982 |}
5983 !! html
5984 <table>
5985 <tr>
5986 <td> foo
5987 </td></tr>
5988 <tr>
5989 <td> bar
5990 </td></tr></table>
5991
5992 !! end
5993
5994 !! test
5995 Multiplication table
5996 !! wikitext
5997 {| border="1" cellpadding="2"
5998 |+Multiplication table
5999 |-
6000 ! &times; !! 1 !! 2 !! 3
6001 |-
6002 ! 1
6003 | 1 || 2 || 3
6004 |-
6005 ! 2
6006 | 2 || 4 || 6
6007 |-
6008 ! 3
6009 | 3 || 6 || 9
6010 |-
6011 ! 4
6012 | 4 || 8 || 12
6013 |-
6014 ! 5
6015 | 5 || 10 || 15
6016 |}
6017 !! html
6018 <table border="1" cellpadding="2">
6019 <caption>Multiplication table
6020 </caption>
6021 <tr>
6022 <th> &#215; </th>
6023 <th> 1 </th>
6024 <th> 2 </th>
6025 <th> 3
6026 </th></tr>
6027 <tr>
6028 <th> 1
6029 </th>
6030 <td> 1 </td>
6031 <td> 2 </td>
6032 <td> 3
6033 </td></tr>
6034 <tr>
6035 <th> 2
6036 </th>
6037 <td> 2 </td>
6038 <td> 4 </td>
6039 <td> 6
6040 </td></tr>
6041 <tr>
6042 <th> 3
6043 </th>
6044 <td> 3 </td>
6045 <td> 6 </td>
6046 <td> 9
6047 </td></tr>
6048 <tr>
6049 <th> 4
6050 </th>
6051 <td> 4 </td>
6052 <td> 8 </td>
6053 <td> 12
6054 </td></tr>
6055 <tr>
6056 <th> 5
6057 </th>
6058 <td> 5 </td>
6059 <td> 10 </td>
6060 <td> 15
6061 </td></tr></table>
6062
6063 !! end
6064
6065 !! test
6066 Accept "||" in table headings
6067 !! wikitext
6068 {|
6069 !h1 || h2
6070 |}
6071 !! html
6072 <table>
6073 <tr>
6074 <th>h1 </th>
6075 <th> h2
6076 </th></tr></table>
6077
6078 !! end
6079
6080 !! test
6081 Accept "!!" in table data
6082 !! wikitext
6083 {|
6084 | Foo!! ||
6085 |}
6086 !! html
6087 <table>
6088 <tr>
6089 <td> Foo!! </td>
6090 <td>
6091 </td></tr></table>
6092
6093 !! html/parsoid
6094 <table>
6095 <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>
6096 </tbody></table>
6097 !! end
6098
6099 !! test
6100 Accept "||" in indented table headings
6101 !! wikitext
6102 :{|
6103 !h1 || h2
6104 |}
6105 !! html
6106 <dl><dd><table>
6107 <tr>
6108 <th>h1 </th>
6109 <th> h2
6110 </th></tr></table></dd></dl>
6111
6112 !! end
6113
6114 !! test
6115 Accept "!!" in templates
6116 !! wikitext
6117 {|
6118 !a {{echo|b!!c}}
6119 |}
6120 !! html/php
6121 <table>
6122 <tr>
6123 <th>a b</th>
6124 <th>c
6125 </th></tr></table>
6126
6127 !! html/parsoid
6128 <table>
6129 <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>
6130 !! end
6131
6132 !! test
6133 Accept "!!" in table headings after newline
6134 !! wikitext
6135 {|
6136 !a
6137 b!!c
6138 |}
6139 !! html/php
6140 <table>
6141 <tr>
6142 <th>a
6143 <p>b!!c
6144 </p>
6145 </th></tr></table>
6146
6147 !! html/parsoid
6148 <table>
6149 <tbody><tr><th>a
6150 <p>b!!c</p></th></tr>
6151 </tbody></table>
6152 !! end
6153
6154 !! test
6155 Accept "!!" in table data of mixed wikitext / html syntax
6156 !! wikitext
6157 {|
6158 !a
6159 <tr><td>b!!c</td></tr>
6160 |}
6161 !! html+tidy
6162 <table>
6163 <tr>
6164 <th>a</th>
6165 </tr>
6166 <tr>
6167 <td>b!!c</td>
6168 </tr>
6169 </table>
6170 !! html/parsoid
6171 <table>
6172 <tbody><tr><th>a</th></tr>
6173 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6174 </tbody></table>
6175 !! end
6176
6177 !! test
6178 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6179 !! wikitext
6180 {|
6181 !| h1
6182 || a
6183 |}
6184 !! html
6185 <table>
6186 <tr>
6187 <th> h1
6188 </th>
6189 <td> a
6190 </td></tr></table>
6191
6192 !! end
6193
6194 !!test
6195 Accept "| !" at start of line in tables (ignore !-attribute)
6196 !! wikitext
6197 {|
6198 |-
6199 | !style="color:red" | bar
6200 |}
6201 !! html
6202 <table>
6203
6204 <tr>
6205 <td> bar
6206 </td></tr></table>
6207
6208 !!end
6209
6210 !!test
6211 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 +/-
6212 !! wikitext
6213 {|
6214 |-
6215 |style='color:red;'|+1
6216 |style='color:blue;'|-1
6217 |-
6218 | 1 || 2 || 3
6219 | 1 ||+2 ||-3
6220 |-
6221 | +1
6222 | -1
6223 |}
6224 !! html
6225 <table>
6226
6227 <tr>
6228 <td style="color:red;">+1
6229 </td>
6230 <td style="color:blue;">-1
6231 </td></tr>
6232 <tr>
6233 <td> 1 </td>
6234 <td> 2 </td>
6235 <td> 3
6236 </td>
6237 <td> 1 </td>
6238 <td>+2 </td>
6239 <td>-3
6240 </td></tr>
6241 <tr>
6242 <td> +1
6243 </td>
6244 <td> -1
6245 </td></tr></table>
6246
6247 !!end
6248
6249 !! test
6250 Table rowspan
6251 !! wikitext
6252 {| border=1
6253 | Cell 1, row 1
6254 |rowspan=2| Cell 2, row 1 (and 2)
6255 | Cell 3, row 1
6256 |-
6257 | Cell 1, row 2
6258 | Cell 3, row 2
6259 |}
6260 !! html
6261 <table border="1">
6262 <tr>
6263 <td> Cell 1, row 1
6264 </td>
6265 <td rowspan="2"> Cell 2, row 1 (and 2)
6266 </td>
6267 <td> Cell 3, row 1
6268 </td></tr>
6269 <tr>
6270 <td> Cell 1, row 2
6271 </td>
6272 <td> Cell 3, row 2
6273 </td></tr></table>
6274
6275 !! end
6276
6277 !! test
6278 Nested table
6279 !! wikitext
6280 {| border=1
6281 | &alpha;
6282 |
6283 {| bgcolor=#ABCDEF border=2
6284 |nested
6285 |-
6286 |table
6287 |}
6288 |the original table again
6289 |}
6290 !! html
6291 <table border="1">
6292 <tr>
6293 <td> &#945;
6294 </td>
6295 <td>
6296 <table bgcolor="#ABCDEF" border="2">
6297 <tr>
6298 <td>nested
6299 </td></tr>
6300 <tr>
6301 <td>table
6302 </td></tr></table>
6303 </td>
6304 <td>the original table again
6305 </td></tr></table>
6306
6307 !! end
6308
6309 !! test
6310 Invalid attributes in table cell (bug 1830)
6311 !! wikitext
6312 {|
6313 |Cell:|broken
6314 |}
6315 !! html
6316 <table>
6317 <tr>
6318 <td>broken
6319 </td></tr></table>
6320
6321 !! end
6322
6323 !! test
6324 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6325 !! wikitext
6326 {|
6327 | title="foo" |bar
6328 | title="foo<nowiki>|</nowiki>" |bar
6329 | title="foo<nowiki>|</nowiki>" bar
6330 |}
6331 !! html/php
6332 <table>
6333 <tr>
6334 <td title="foo">bar
6335 </td>
6336 <td title="foo&#124;">bar
6337 </td>
6338 <td> title="foo|" bar
6339 </td></tr></table>
6340
6341 !! html/parsoid
6342 <table>
6343 <tbody><tr><td title="foo">bar</td>
6344 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6345 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6346 </tbody></table>
6347 !! end
6348
6349 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6350 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6351 # *2wt modes will fail.
6352 !! test
6353 Table security: embedded pipes
6354 !! options
6355 parsoid=wt2html,html2html
6356 !! wikitext
6357 {|
6358 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6359 !! html/php
6360 <table>
6361 <tr>
6362 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6363 <td>]" onmouseover="alert(document.cookie)"&gt;test
6364 </td>
6365 </tr>
6366 </table>
6367
6368 !! html/parsoid
6369 <table><tbody>
6370 <tr>
6371 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6372 !! end
6373
6374 !! test
6375 Element attributes with double ! should not be broken up by <th>
6376 !! wikitext
6377 {|
6378 ! hi <div class="!!">ha</div> ho
6379 |}
6380 !! html/php
6381 <table>
6382 <tr>
6383 <th> hi <div class="!!">ha</div> ho
6384 </th></tr></table>
6385
6386 !! html/parsoid
6387 <table>
6388 <tbody><tr><th> hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
6389 </tbody></table>
6390 !! end
6391
6392 !! test
6393 ! and || in element attributes should not be parsed as <th>/<td>
6394 !! wikitext
6395 {|
6396 | <div style="color: red !important;" data-contrived="put this here ||">hi</div>
6397 |}
6398 !! html/php
6399 <table>
6400 <tr>
6401 <td> <div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
6402 </td></tr></table>
6403
6404 !! html/parsoid
6405 <table>
6406 <tbody><tr><td> <div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
6407 </tbody></table>
6408 !! end
6409
6410 # FIXME: The output seems broken. Filed as T110268.
6411 !! test
6412 ! and || in td attributes should not be parsed as <th>/<td>
6413 !! options
6414 parsoid=wt2html
6415 !! wikitext
6416 {|
6417 | style="color: red !important;" data-contrived="put this here ||" | foo
6418 |}
6419 !! html/php
6420 <table>
6421 <tr>
6422 <td> style="color: red !important;" data-contrived="put this here </td>
6423 <td> foo
6424 </td></tr></table>
6425
6426 !! html/parsoid
6427 <table>
6428 <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>
6429 </tbody></table>
6430 !! end
6431
6432 !! test
6433 Break on | in element attribute in template
6434 !! options
6435 parsoid=wt2html,html2html
6436 !! wikitext
6437 {{echo|1=<div class="hi|ho">ha</div>}}
6438 !! html/php
6439 <p>ho"&gt;ha&lt;/div&gt;
6440 </p>
6441 !! html/parsoid
6442 <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>
6443 !! end
6444
6445 ## We don't support roundtripping of these attributes in Parsoid.
6446 ## Selective serialization takes care of preventing dirty diffs.
6447 ## But, on edits, we dirty-diff the invalid attribute text.
6448 !! test
6449 Invalid text in table attributes should be discarded
6450 !! options
6451 parsoid=wt2html
6452 !! wikitext
6453 {| <span>boo</span> style='border:1px solid black'
6454 | <span>boo</span> style='color:blue' | 1
6455 |<span>boo</span> style='color:blue'| 2
6456 |}
6457 !! html/php
6458 <table style="border:1px solid black">
6459 <tr>
6460 <td style="color:blue"> 1
6461 </td>
6462 <td style="color:blue"> 2
6463 </td></tr></table>
6464
6465 !! html/parsoid
6466 <table style="border:1px solid black">
6467 <tr>
6468 <td style="color:blue"> 1</td>
6469 <td style="color:blue"> 2</td>
6470 </tr>
6471 </table>
6472 !! end
6473
6474 !! test
6475 Invalid text in table attributes should be preserved by selective serializer
6476 !! options
6477 parsoid={
6478 "modes": ["selser"],
6479 "changes": [
6480 ["td:first-child", "text", "abc"],
6481 ["td + td", "text", "xyz"]
6482 ]
6483 }
6484 !! wikitext
6485 {| <span>boo</span> style='border:1px solid black'
6486 | <span>boo</span> style='color:blue' | 1
6487 |<span>boo</span> style='color:blue'| 2
6488 |}
6489 !! wikitext/edited
6490 {| <span>boo</span> style='border:1px solid black'
6491 | <span>boo</span> style='color:blue' |abc
6492 |<span>boo</span> style='color:blue'|xyz
6493 |}
6494 !! end
6495
6496 !! test
6497 1. Template-generated table cell attributes and cell content
6498 !! wikitext
6499 {|
6500 |{{table_attribs}}
6501 | {{table_attribs}}
6502 || {{table_attribs_5}}
6503 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6504 |align=center {{table_attribs}}
6505 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6506 |}
6507 !! html
6508 <table>
6509 <tr>
6510 <td style="color:red;">Foo
6511 </td>
6512 <td style="color:red;">Foo
6513 </td>
6514 <td> style="color:red;"</td>
6515 <td>Bar
6516 </td>
6517 <td style="color:red;">Foo
6518 </td>
6519 <td align="center" style="color:red;">Foo
6520 </td>
6521 <td align="center" style="color:red;">Foo
6522 </td></tr></table>
6523
6524 !! end
6525
6526 !! test
6527 2. Template-generated table cell attributes and cell content
6528 !! wikitext
6529 {|
6530 |{{table_attribs_2}}
6531 |}
6532 !! html/php
6533 <table>
6534 <tr>
6535 <td style="color:red;">Foo
6536 </td>
6537 <td>Bar</td>
6538 <td>Baz
6539 </td></tr></table>
6540
6541 !! html/parsoid
6542 <table>
6543 <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>
6544 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6545 </tbody></table>
6546 !! end
6547
6548 !! test
6549 3. Template-generated table cell attributes and cell content
6550 !! wikitext
6551 {|
6552 !align=center {{table_header_cells}}
6553 |-
6554 |align=center {{table_cells}}
6555 |}
6556 !! html/php
6557 <table>
6558 <tr>
6559 <th align="center" style="color:red;">Foo</th>
6560 <th style="color:red;"><i>Bar</i></th>
6561 <th style="color:brown;"><i>Foo</i> and Baz
6562 </th></tr>
6563 <tr>
6564 <td align="center" style="color:red;">Foo</td>
6565 <td style="color:red;"><i>Bar</i></td>
6566 <td style="color:brown;"><i>Foo</i> and Baz
6567 </td></tr></table>
6568
6569 !! html/parsoid
6570 <table>
6571 <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>
6572 <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>
6573 </tbody></table>
6574 !! end
6575
6576 !! test
6577 4. Template-generated table cell attributes and cell content inside a templated table
6578 !! wikitext
6579 {{tbl-start}}
6580 !align=center {{table_header_cells}}
6581 |-
6582 |align=center {{table_cells}}
6583 {{tbl-end}}
6584 !! html/php
6585 <table>
6586 <tr>
6587 <th align="center" style="color:red;">Foo</th>
6588 <th style="color:red;"><i>Bar</i></th>
6589 <th style="color:brown;"><i>Foo</i> and Baz
6590 </th></tr>
6591 <tr>
6592 <td align="center" style="color:red;">Foo</td>
6593 <td style="color:red;"><i>Bar</i></td>
6594 <td style="color:brown;"><i>Foo</i> and Baz
6595 </td></tr></table>
6596
6597 !! html/parsoid
6598 <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}}]}'>
6599 <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>
6600 <tr>
6601 <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>
6602 </tbody></table>
6603 !! end
6604
6605 ## Edge case fix to prevent future regressions
6606 !! test
6607 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6608 !! wikitext
6609 {|
6610 |{{table_attribs_7}}
6611 |}
6612 <references />
6613 !! html/parsoid
6614 <table>
6615 <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>
6616 </tbody></table>
6617 <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>
6618 !! end
6619
6620 !! test
6621 Table with row followed by newlines and table heading
6622 !! options
6623 parsoid=wt2html,html2html
6624 !! wikitext
6625 {|
6626 |-
6627
6628 ! foo
6629 |}
6630 !! html/*
6631 <table>
6632
6633
6634 <tr>
6635 <th> foo
6636 </th></tr></table>
6637
6638 !! end
6639
6640 !! test
6641 Table with empty line following the start tag
6642 !! options
6643 parsoid=wt2html,html2html
6644 !! wikitext
6645 {|
6646
6647 |-
6648 | foo
6649 |}
6650 !! html/*
6651 <table>
6652
6653
6654 <tr>
6655 <td> foo
6656 </td></tr></table>
6657
6658 !! end
6659
6660 !! test
6661 Table attributes with empty value
6662 !! options
6663 parsoid=wt2html,html2html
6664 !! wikitext
6665 {|
6666 | style=| hello
6667 |}
6668 !! html/php
6669 <table>
6670 <tr>
6671 <td style=""> hello
6672 </td></tr></table>
6673
6674 !! html/parsoid
6675 <table>
6676 <tbody><tr><td style=""> hello</td></tr>
6677 </tbody></table>
6678 !! end
6679
6680 !! test
6681 Wikitext table with a lot of comments
6682 !! wikitext
6683 {|
6684 <!-- c0 -->
6685 | foo
6686 <!-- c1 -->
6687 |-<!-- c2 -->
6688 <!-- c3 -->
6689 |<!-- c4 -->
6690 <!-- c5 -->
6691 |}
6692 !! html
6693 <table>
6694 <tr>
6695 <td> foo
6696 </td></tr>
6697 <tr>
6698 <td>
6699 </td></tr></table>
6700
6701 !! end
6702
6703 !! test
6704 Wikitext table comments represented in parsoid dom
6705 !! wikitext
6706 {|<!--c1--><!--c2-->
6707 |-<!--c3-->
6708 | x
6709 |}
6710 !! html/php+tidy
6711 <table>
6712 <tr>
6713 <td>x</td>
6714 </tr>
6715 </table>
6716 !! html/parsoid
6717 <table><!--c1--><!--c2-->
6718 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6719 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6720 </tbody></table>
6721 !! end
6722
6723 !! test
6724 Wikitext table with double-line table cell
6725 !! wikitext
6726 {|
6727 |a
6728 b
6729 |}
6730 !! html
6731 <table>
6732 <tr>
6733 <td>a
6734 <p>b
6735 </p>
6736 </td></tr></table>
6737
6738 !! end
6739
6740 !! test
6741 Table cell with a single comment
6742 !! wikitext
6743 {|
6744 | <!-- c1 -->
6745 | a
6746 |}
6747 !! html
6748 <table>
6749 <tr>
6750 <td>
6751 </td>
6752 <td> a
6753 </td></tr></table>
6754
6755 !! end
6756
6757 !! test
6758 Table-cell after a comment-only-empty-line
6759 !! wikitext
6760 {|
6761 |a
6762 <!--c1-->
6763 <!--c2-->| b
6764 |}
6765 !! html
6766 <table>
6767 <tr>
6768 <td>a
6769 </td>
6770 <td> b
6771 </td></tr></table>
6772
6773 !! html/parsoid
6774 <table>
6775 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6776 <!--c1-->
6777 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6778 </tbody></table>
6779
6780 !! end
6781
6782 !! test
6783 Build table with {{!}}
6784 !! wikitext
6785 {{{!}} class="wikitable"
6786 ! header
6787 ! second header
6788 {{!}}- style="color:red;"
6789 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6790 {{!}}}
6791 !! html
6792 <table class="wikitable">
6793 <tr>
6794 <th> header
6795 </th>
6796 <th> second header
6797 </th></tr>
6798 <tr style="color:red;">
6799 <td> data </td>
6800 <td style="color:red;"> second data
6801 </td></tr></table>
6802
6803 !! end
6804
6805 !! test
6806 Build table with pipe as data
6807 !! wikitext
6808 {| class="wikitable"
6809 ! header
6810 ! second header
6811 |- style="color:red;"
6812 | data || style="color:red;" | second data
6813 |-
6814 | style="color:red;" | data with | || style="color:red;" | second data with |
6815 |-
6816 || data with | ||| second data with |
6817 |}
6818 !! html
6819 <table class="wikitable">
6820 <tr>
6821 <th> header
6822 </th>
6823 <th> second header
6824 </th></tr>
6825 <tr style="color:red;">
6826 <td> data </td>
6827 <td style="color:red;"> second data
6828 </td></tr>
6829 <tr>
6830 <td style="color:red;"> data with | </td>
6831 <td style="color:red;"> second data with |
6832 </td></tr>
6833 <tr>
6834 <td> data with | </td>
6835 <td> second data with |
6836 </td></tr></table>
6837
6838 !! end
6839
6840 !! test
6841 Build table with wikilink
6842 !! wikitext
6843 {| class="wikitable"
6844 ! header || second header
6845 |- style="color:red;"
6846 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6847 |-
6848 | data || second data [[Main Page|link|text with pipe]]
6849 |}
6850 !! html
6851 <table class="wikitable">
6852 <tr>
6853 <th> header </th>
6854 <th> second header
6855 </th></tr>
6856 <tr style="color:red;">
6857 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6858 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6859 </td></tr>
6860 <tr>
6861 <td> data </td>
6862 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6863 </td></tr></table>
6864
6865 !! end
6866
6867 # The expected HTML structure in this test is debatable. The PHP parser does
6868 # not parse this kind of table at all. The main focus for Parsoid is on
6869 # round-tripping, so this output is ok for now. TODO: revisit!
6870 !! test
6871 Wikitext table with html-syntax row
6872 !! wikitext
6873 {|
6874 |-
6875 <td>foo</td>
6876 |}
6877 !! html/parsoid
6878 <table>
6879 <tbody>
6880 <tr>
6881 <td>foo</td></tr></tbody></table>
6882 !! end
6883
6884 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6885 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6886 ## PHP parser, which tidy then compounds by fostering the content
6887 ## entirely out of the table. Parsoid recognizes the table context
6888 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6889 ## depends on PHP's treatment of broken table markup!
6890 !! test
6891 Implicit <td> after a |-
6892 !! options
6893 parsoid=wt2html,html2html
6894 !! wikitext
6895 {|
6896 |-
6897 a
6898 |}
6899 !! html/php
6900 <table>
6901
6902 a
6903 </table>
6904
6905 !! html/php+tidy
6906 <p>a</p>
6907 !! html/parsoid
6908 <table>
6909 <tr><td>a</td></tr>
6910 </table>
6911 !! end
6912
6913 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6914 !! test
6915 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6916 !! options
6917 parsoid=wt2html,html2html
6918 !! wikitext
6919 {|
6920 |-
6921 |
6922 a
6923 |-
6924 b
6925 |}
6926 !! html/php
6927 <table>
6928
6929 <tr>
6930 <td>
6931 <pre>a
6932 </pre>
6933 </td></tr>
6934 b
6935 </table>
6936
6937 !! html/php+tidy
6938 <p>b</p>
6939 <table>
6940 <tr>
6941 <td>
6942 <pre>
6943 a
6944 </pre></td>
6945 </tr>
6946 </table>
6947 !! html/parsoid
6948 <table>
6949 <tbody>
6950 <tr><td><pre>a</pre></td></tr>
6951 <tr><td> b</td></tr>
6952 </tbody>
6953 </table>
6954 !! end
6955
6956 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6957 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6958 !! test
6959 Lists should be recognized in an implicit <td> context
6960 !! options
6961 parsoid=wt2html,html2html
6962 !! wikitext
6963 {|
6964 |-
6965 *a
6966 |}
6967 !! html/php
6968 <table>
6969
6970 <ul><li>a</li></ul>
6971 </table>
6972
6973 !! html/php+tidy
6974 <ul>
6975 <li>a</li>
6976 </ul>
6977 !! html/parsoid
6978 <table>
6979 <tr>
6980 <td><ul>
6981 <li>a</li>
6982 </ul></td>
6983 </tr>
6984 </table>
6985 !! end
6986
6987 !! test
6988 Table cells not properly parsed in an implicit-td context
6989 !! wikitext
6990 {|
6991 |-
6992 {{table_attribs_4}} || a || b
6993 |}
6994 !! html/php+tidy
6995 <table>
6996 <tr>
6997 <td style="background-color:#DC241f;" width="10px"></td>
6998 <td>a</td>
6999 <td>b</td>
7000 </tr>
7001 </table>
7002 !! html/parsoid
7003 <table>
7004 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
7005 <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>
7006 </tbody></table>
7007 !! end
7008
7009 !! test
7010 Parsoid: Round-trip tables directly followed by content (bug 51219)
7011 !! options
7012 parsoid=wt2html,wt2wt
7013 !! wikitext
7014 {|
7015 |foo
7016 |} bar
7017
7018 {|
7019 |baz
7020 |}<b>quux</b>
7021 !! html+tidy
7022 <table>
7023 <tr>
7024 <td>foo</td>
7025 </tr>
7026 </table>
7027 <p>bar</p>
7028 <table>
7029 <tr>
7030 <td>baz</td>
7031 </tr>
7032 </table>
7033 <p><b>quux</b></p>
7034 !! end
7035
7036 !! test
7037 Parsoid: Default to a newline after tables in new content (bug 51219)
7038 !! options
7039 parsoid=html2wt
7040 !! html/parsoid
7041 <table><tbody>
7042 <tr><td>foo</td></tr></tbody></table> bar
7043 <table><tbody>
7044 <tr><td>baz</td></tr></tbody></table><b>quux</b>
7045 !! wikitext
7046 {|
7047 |foo
7048 |}
7049 <nowiki> </nowiki>bar
7050 {|
7051 |baz
7052 |}
7053 '''quux'''
7054 !! end
7055
7056 !! test
7057 Parsoid: newline inducing block nodes don't suppress <nowiki>
7058 !! options
7059 parsoid=html2wt
7060 !! html/parsoid
7061 a<h1>foo</h1>
7062 !! wikitext
7063 <nowiki> </nowiki>a
7064
7065 = foo =
7066 !! end
7067
7068 !! test
7069 Parsoid: Row-syntax table headings followed by comment & table cells
7070 !! options
7071 parsoid=wt2html,wt2wt
7072 !! wikitext
7073 {|
7074 ! foo || bar
7075 <!-- foo --> || baz || quux
7076 |}
7077 !! html/php
7078 <table>
7079 <tr>
7080 <th> foo </th>
7081 <th> bar
7082 </th>
7083 <td> baz </td>
7084 <td> quux
7085 </td></tr></table>
7086
7087 !! html/parsoid
7088 <table>
7089 <tbody><tr><th> foo </th><th> bar
7090 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
7091 </tbody></table>
7092 !! end
7093
7094 !!test
7095 Parsoid: Recover better from broken table attributes
7096 !!options
7097 parsoid=wt2html
7098 !!wikitext
7099 {| class="foo
7100 | class="bar" |
7101 foo
7102 |}
7103 !!html/php+tidy
7104 <table class="foo">
7105 <tr>
7106 <td class="bar">
7107 <p>foo</p>
7108 </td>
7109 </tr>
7110 </table>
7111 !!html/parsoid
7112 <table class="foo">
7113 <tr>
7114 <td class="bar">
7115 <p>foo</p></td></tr>
7116 </tbody></table>
7117 !!end
7118
7119 !! test
7120 Tables: Digest broken attributes on table and tr tag
7121 !! options
7122 parsoid=wt2html
7123 !! wikitext
7124 {| || |} ++
7125 |- || || ++ --
7126 |- > [
7127 |}
7128 !! html
7129 <table>
7130 <tbody>
7131 <tr></tr>
7132 <tr></tr>
7133 </tbody></table>
7134 !! end
7135
7136 # T137406: Whitespace in the HTML
7137 !! test
7138 1. Generate correct wikitext for tables with thead/tbody/tfoot
7139 !! options
7140 parsoid=html2wt
7141 !! html/parsoid
7142 <table>
7143 <caption>Test</caption>
7144 <thead>
7145 <tr>
7146 <th>Month</th>
7147 <th>Savings</th>
7148 </tr>
7149 </thead>
7150 <tbody>
7151 <tr>
7152 <td>January</td>
7153 <td>$100</td>
7154 </tr>
7155 <tr>
7156 <td>February</td>
7157 <td>$80</td>
7158 </tr>
7159 </tbody>
7160 <tfoot>
7161 <tr>
7162 <td>Sum</td>
7163 <td>$180</td>
7164 </tr>
7165 </tfoot>
7166 </table>
7167 !! wikitext
7168 {|
7169 |+Test
7170 !Month
7171 !Savings
7172 |-
7173 |January
7174 |$100
7175 |-
7176 |February
7177 |$80
7178 |-
7179 |Sum
7180 |$180
7181 |}
7182 !! html/php+tidy
7183 <table>
7184 <caption>Test</caption>
7185 <tr>
7186 <th>Month</th>
7187 <th>Savings</th>
7188 </tr>
7189 <tr>
7190 <td>January</td>
7191 <td>$100</td>
7192 </tr>
7193 <tr>
7194 <td>February</td>
7195 <td>$80</td>
7196 </tr>
7197 <tr>
7198 <td>Sum</td>
7199 <td>$180</td>
7200 </tr>
7201 </table>
7202 !! end
7203
7204 # T137406: No whitespace in the HTML
7205 !! test
7206 2. Generate correct wikitext for tables with thead/tbody/tfoot
7207 !! options
7208 parsoid=html2wt
7209 !! html/parsoid
7210 <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
7211 !! wikitext
7212 {|
7213 !heading
7214 |-
7215 |foo
7216 |}
7217 !! end
7218
7219 !! test
7220 Testing serialization after deletion in references
7221 !! options
7222 parsoid={
7223 "modes": ["wt2wt"],
7224 "changes": [
7225 ["#x", "remove"]
7226 ]
7227 }
7228 !! wikitext
7229 hi <ref><div id="x">ho</div></ref>
7230
7231 <references />
7232 !! wikitext/edited
7233 hi <ref></ref>
7234
7235 <references />
7236 !! end
7237
7238 !!test
7239 Testing serialization after deletion of table cells
7240 !!options
7241 parsoid={
7242 "modes": ["wt2wt", "selser"],
7243 "changes": [
7244 ["#x", "remove"]
7245 ]
7246 }
7247 !!wikitext
7248 {|
7249 !h1 !!h2 !!h3
7250 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7251 |}
7252 !! wikitext/edited
7253 {|
7254 !h1 !!h2 !!h3
7255 |c2 |||c3
7256 |}
7257 !!end
7258
7259 !! test
7260 Testing selser after addition of new row before first row (T125419)
7261 !! options
7262 parsoid={
7263 "modes": ["wt2wt", "selser"],
7264 "changes": [
7265 [ "tr", "before", "<tr><td>X</td></tr>" ]
7266 ]
7267 }
7268 !! wikitext
7269 {|
7270 |a
7271 |}
7272 !! wikitext/edited
7273 {|
7274 |X
7275 |-
7276 |a
7277 |}
7278 !! end
7279
7280 !! test
7281 Serialize new table rows in a HTML table using HTML tags
7282 !! options
7283 parsoid={
7284 "modes": ["wt2wt", "selser"],
7285 "changes": [
7286 [ "tr", "before", "<tr><td>X</td></tr>" ]
7287 ]
7288 }
7289 !! wikitext
7290 <table><tr><td>a</td></tr></table>
7291 !! wikitext/edited
7292 <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
7293 !! end
7294
7295 !! test
7296 Serialize new table cells in a HTML row using HTML tags
7297 !! options
7298 parsoid={
7299 "modes": ["wt2wt", "selser"],
7300 "changes": [
7301 [ "td", "before", "<td>X</td>" ]
7302 ]
7303 }
7304 !! wikitext
7305 <table><tr><td>a</td></tr></table>
7306 !! wikitext/edited
7307 <table><tr><td>X</td><td>a</td></tr></table>
7308 !! end
7309
7310 !! test
7311 Wikitext tables can be nested inside HTML tables
7312 !! options
7313 parsoid=html2wt
7314 !! html
7315 <table data-parsoid='{"stx":"html"}'>
7316 <tr><td>
7317 <table>
7318 <tr><td>foo</td></tr>
7319 </table>
7320 </td></tr>
7321 </table>
7322 !! wikitext
7323 <table>
7324 <tr><td>
7325 {|
7326 |foo
7327 |}
7328 </td></tr>
7329 </table>
7330 !! end
7331
7332 !! test
7333 Serialize wikitext list items as HTML list items when embedded in a HTML list
7334 !! options
7335 parsoid=html2wt
7336 !! html
7337 <ul data-parsoid='{"stx": "html"}'>
7338 <li data-parsoid='{}'>a</li>
7339 <li>b</li>
7340 </ul>
7341 !! wikitext
7342 <ul>
7343 <li>a</li>
7344 <li>b</li>
7345 </ul>
7346 !! end
7347
7348 # SSS FIXME: Is this actually a good thing given the
7349 # odd nested list output that is generated by MW?
7350 # <ul><li>foo<ul>..</ul></li></ul> instead of
7351 # <ul><li>foo</li><ul>..</ul></ul>
7352 !! test
7353 Wikitext lists can be nested inside HTML lists
7354 !! options
7355 parsoid=html2wt
7356 !! html
7357 <ul data-parsoid='{"stx": "html"}'>
7358 <li data-parsoid='{"stx": "html"}'>a
7359 <ul><li>b</li></ul>
7360 </li>
7361 </ul>
7362
7363 <ul data-parsoid='{"stx": "html"}'>
7364 <li>x
7365 <ul><li>y</li></ul>
7366 </li>
7367 </ul>
7368 !! wikitext
7369 <ul>
7370 <li>a
7371 * b
7372 </li>
7373 </ul>
7374
7375 <ul>
7376 <li>x
7377 * y
7378 </li>
7379 </ul>
7380 !! end
7381
7382 ###
7383 ### Internal links
7384 ###
7385 !! test
7386 Plain link, capitalized
7387 !! wikitext
7388 [[Main Page]]
7389 !! html
7390 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7391 </p>
7392 !! end
7393
7394 !! test
7395 Plain link, uncapitalized
7396 !! wikitext
7397 [[main Page]]
7398 !! html
7399 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7400 </p>
7401 !! end
7402
7403 !! test
7404 Piped link
7405 !! wikitext
7406 [[Main Page|The Main Page]]
7407 !! html
7408 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7409 </p>
7410 !! end
7411
7412 !! test
7413 Piped link with comment in link text
7414 !! wikitext
7415 [[Main Page|The Main<!--front--> Page]]
7416 !! html
7417 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7418 </p>
7419 !! end
7420
7421 !! test
7422 Piped link with multiple pipe characters in link text
7423 !! wikitext
7424 [[Main Page||The|Main|Page|]]
7425 !! html/php
7426 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7427 </p>
7428 !! html/parsoid
7429 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7430 !! end
7431
7432 !! test
7433 Piped link with no link text
7434 !! wikitext
7435 [[Thomas Bek (bishop of St David's)|]]
7436 !! html/php
7437 <p>[[Thomas Bek (bishop of St David's)|]]
7438 </p>
7439 !! html/parsoid
7440 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7441 !! end
7442
7443 !! test
7444 Piped link with empty link text
7445 !! wikitext
7446 [[Main Page|<nowiki />]] - empty nowiki
7447 [[Main Page| ]] - empty space
7448 [[Main Page|&nbsp;]] - empty non breaking space
7449 !! html/php
7450 <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
7451 <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
7452 <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
7453 </p>
7454 !! html/parsoid
7455 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki />"}'/></a> - empty nowiki
7456 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
7457 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span></a> - empty non breaking space</p>
7458 !! end
7459
7460 !! test
7461 Broken link
7462 !! wikitext
7463 [[Zigzagzogzagzig]]
7464 !! html
7465 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7466 </p>
7467 !! end
7468
7469 !! test
7470 Broken link with fragment
7471 !! wikitext
7472 [[Zigzagzogzagzig#zug]]
7473 !! html
7474 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7475 </p>
7476 !! end
7477
7478 !! test
7479 Special page link with fragment
7480 !! wikitext
7481 [[Special:Version#anchor]]
7482 !! html
7483 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7484 </p>
7485 !! end
7486
7487 !! test
7488 Nonexistent special page link with fragment
7489 !! wikitext
7490 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7491 !! html
7492 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7493 </p>
7494 !! end
7495
7496 !! test
7497 Link with prefix
7498 !! wikitext
7499 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7500 !! html
7501 <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>
7502 </p>
7503 !! end
7504
7505 !! test
7506 Link with suffix
7507 !! wikitext
7508 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7509 !! html
7510 <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>!!!
7511 </p>
7512 !! end
7513
7514 !! article
7515 prefixed article
7516 !! text
7517 Some text
7518 !! endarticle
7519
7520 !! test
7521 Bug 43661: Piped links with identical prefixes
7522 !! wikitext
7523 [[prefixed article|prefixed articles with spaces]]
7524
7525 [[prefixed article|prefixed articlesaoeu]]
7526
7527 [[Main Page|Main Page test]]
7528 !! html
7529 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7530 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7531 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7532 </p>
7533 !! end
7534
7535
7536 !! test
7537 Link with HTML entity in suffix / tail
7538 !! wikitext
7539 [[Main Page]]&quot;, [[Main Page]]&#97;
7540 !! html/php
7541 <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;
7542 </p>
7543 !! html/parsoid
7544 <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>
7545 !! end
7546
7547 !! test
7548 Link with 3 brackets
7549 !! wikitext
7550 [[[Main Page]]]
7551 Foo [[[Main Page]]]
7552 !! html
7553 <p>[[[Main Page]]]
7554 Foo [[[Main Page]]]
7555 </p>
7556 !! end
7557
7558 !! test
7559 Link with 4 brackets
7560 !! wikitext
7561 [[[[Main Page]]]]
7562 !! html
7563 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7564 </p>
7565 !! end
7566
7567 !! test
7568 Piped link with 3 brackets
7569 !! wikitext
7570 [[[main page|the main page]]]
7571 !! html
7572 <p>[[[main page|the main page]]]
7573 </p>
7574 !! end
7575
7576 !! test
7577 Piped link with extlink-like text
7578 !! wikitext
7579 [[Main Page|[bar]]]
7580 [[Main Page|This is a [bar]]]
7581 !! html/php
7582 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7583 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7584 </p>
7585 !! html/parsoid
7586 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7587 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7588 !! end
7589
7590 !! test
7591 Link with multiple pipes
7592 !! wikitext
7593 [[Main Page|The|Main|Page]]
7594 !! html
7595 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7596 </p>
7597 !! end
7598
7599 # Note that parsoid does not munge anchor text; all non-space
7600 # characters are valid in HTML5 ids.
7601 !! test
7602 Anchor containing a #. (bug 63430)
7603 !! wikitext
7604 [[Main Page#And#Link]]
7605 !! html/php
7606 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7607 </p>
7608 !! html/parsoid
7609 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
7610 !! end
7611
7612 !! test
7613 Link to namespaces
7614 !! wikitext
7615 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7616 !! html
7617 <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>
7618 </p>
7619 !! end
7620
7621 !! test
7622 Link with space in namespace
7623 !! wikitext
7624 [[User talk:Foo bar]]
7625 !! html
7626 <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>
7627 </p>
7628 !! end
7629
7630 !! article
7631 MemoryAlpha:AlphaTest
7632 !! text
7633 This is an article in the MemoryAlpha namespace
7634 (which shadows the memoryalpha interwiki link).
7635 !! endarticle
7636
7637 !! test
7638 Namespace takes precedence over interwiki link (bug 51680)
7639 !! wikitext
7640 [[MemoryAlpha:AlphaTest]]
7641 !! html
7642 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7643 </p>
7644 !! end
7645
7646 # The previous test doesn't work correctly in html2*, due to not recognizing the
7647 # link as an internal one. This one checks for the correct behavior.
7648 !! test
7649 Link to namespace preferred over interwiki with correct rel attribute
7650 !! options
7651 parsoid=html2wt,html2html
7652 !! html/parsoid
7653 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7654 !! wikitext
7655 [[MemoryAlpha:AlphaTest]]
7656 !! end
7657
7658 !! test
7659 Piped link to namespace
7660 !! wikitext
7661 [[Meta:Disclaimers|The disclaimers]]
7662 !! html
7663 <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>
7664 </p>
7665 !! end
7666
7667 !! test
7668 Link containing }
7669 !! wikitext
7670 [[Usually caused by a typo (oops}]]
7671 !! html
7672 <p>[[Usually caused by a typo (oops}]]
7673 </p>
7674 !! end
7675
7676 !! article
7677 7% Solution
7678 !! text
7679 Just a test of an article title containing a percent.
7680 !! endarticle
7681
7682 !! test
7683 Link containing % (not as a hex sequence)
7684 !! wikitext
7685 [[7% Solution]]
7686 [[7% Solution|7%25 Solution]]
7687 !! html/php
7688 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7689 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7690 </p>
7691 !! html/parsoid
7692 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7693 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7694 !! end
7695
7696 # note that the parsoid HTML is identical to the previous test output,
7697 # so the previous test ensures that the html2wt mode will generate the
7698 # "not as a hex sequence" wikitext.
7699 !! test
7700 Link containing % as a single hex sequence interpreted to char
7701 !! options
7702 parsoid=wt2wt,wt2html,html2html
7703 !! wikitext
7704 [[7%25 Solution]]
7705 [[7%25 Solution|7%25 Solution]]
7706 !! html/php
7707 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7708 <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
7709 </p>
7710 !! html/parsoid
7711 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
7712 <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
7713 !!end
7714
7715 !! test
7716 Link containing % as a double hex sequence interpreted to hex sequence
7717 !! wikitext
7718 [[7%2525 Solution]]
7719 !! html
7720 <p>[[7%2525 Solution]]
7721 </p>
7722 !!end
7723
7724 # note that parsoid does not munge anchor text; all non-space
7725 # characters are valid in HTML5 anchors.
7726 !! test
7727 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7728 Example for such a section: == < ==
7729 !! wikitext
7730 [[%23%3c]][[%23%3e]]
7731 !! html/php
7732 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7733 </p>
7734 !! html/parsoid
7735 <p><a rel="mw:WikiLink" href="./Main_Page#%3C" title="Main Page">#&lt;</a><a rel="mw:WikiLink" href="./Main_Page#%3E" title="Main Page">#></a></p>
7736 !! end
7737
7738 !! test
7739 Link containing "<#" and ">#" as a hex sequences
7740 !! wikitext
7741 [[%3c%23]][[%3e%23]]
7742 !! html
7743 <p>[[%3c%23]][[%3e%23]]
7744 </p>
7745 !! end
7746
7747 !! test
7748 Link containing an equals sign
7749 !! wikitext
7750 [[Special:BookSources/isbn=4-00-026157-6]]
7751 !! html/php
7752 <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>
7753 </p>
7754 !! html/parsoid
7755 <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>
7756 !! end
7757
7758 !! article
7759 Foo~bar
7760 !! text
7761 Just a test of an article title containing a tilde.
7762 !! endarticle
7763
7764 # note that links containing signatures, like [[Foo~~~~]], are
7765 # massaged by the pre-save transform (PST) and so the tildes are never
7766 # seen by the parser.
7767 !! test
7768 Link containing a tilde
7769 !! wikitext
7770 [[Foo~bar]]
7771 !! html/php
7772 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7773 </p>
7774 !! html/parsoid
7775 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7776 !! end
7777
7778 !! test
7779 Link containing double-single-quotes '' (bug 4598)
7780 !! wikitext
7781 [[Lista d''e paise d''o munno]]
7782 !! html/php
7783 <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>
7784 </p>
7785 !! html/parsoid
7786 <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>
7787 !! end
7788
7789 !! test
7790 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7791 !! wikitext
7792 Some [[Link|pretty ''italics'' and stuff]]!
7793 !! html/php
7794 <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>!
7795 </p>
7796 !! html/parsoid
7797 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7798 !! end
7799
7800 !! test
7801 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7802 !! wikitext
7803 ''Some [[Link|pretty ''italics'' and stuff]]!''
7804 !! html
7805 <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>
7806 </p>
7807 !! end
7808
7809 !! test
7810 Link with double quotes in title part (literal) and alternate part (interpreted)
7811 !! wikitext
7812 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7813
7814 [[''Pentecoste'']]
7815
7816 [[''Pentecoste''|Pentecoste]]
7817
7818 [[''Pentecoste''|''Pentecoste'']]
7819 !! html/php
7820 <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>
7821 </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>
7822 </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>
7823 </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>
7824 </p>
7825 !! html/parsoid
7826 <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>
7827 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7828 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7829 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7830 !! end
7831
7832 !! test
7833 Broken image links with HTML captions (bug 39700)
7834 !! wikitext
7835 [[File:Nonexistent|<script></script>]]
7836 [[File:Nonexistent|100x100px|<script></script>]]
7837 [[File:Nonexistent|&lt;]]
7838 [[File:Nonexistent|a<i>b</i>c]]
7839 !! html/php
7840 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7841 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7842 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7843 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7844 </p>
7845 !! html/parsoid
7846 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;script>&amp;lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></span>
7847 <span typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"100x100px"},{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;script>&amp;lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="100" width="100" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"100","width":"100"},"sa":{"resource":"File:Nonexistent"}}'/></a></span>
7848 <span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp;lt;"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=&#39;{\"src\":\"&amp;amp;lt;\",\"srcContent\":\"&amp;lt;\",\"dsr\":[107,111,null,null]}&#39;>&amp;lt;&lt;/span>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></span>
7849 <span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"a&lt;i>b&lt;/i>c"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"a&lt;i data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[134,142,3,4]}&#39;>b&lt;/i>c"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></span></p>
7850 !! end
7851
7852 !! test
7853 Plain link to URL
7854 !! wikitext
7855 [[http://www.example.com]]
7856 !! html/php
7857 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7858 </p>
7859 !! html/parsoid
7860 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7861 !! end
7862
7863 !! test
7864 Plain link to URL with link text
7865 !! wikitext
7866 [[http://www.example.com Link text]]
7867 !! html
7868 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7869 </p>
7870 !! end
7871
7872 !! test
7873 Plain link to protocol-relative URL
7874 !! wikitext
7875 [[//www.example.com]]
7876 !! html/php
7877 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7878 </p>
7879 !! html/parsoid
7880 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7881 !! end
7882
7883 !! test
7884 Plain link to protocol-relative URL with link text
7885 !! wikitext
7886 [[//www.example.com Link text]]
7887 !! html
7888 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7889 </p>
7890 !! end
7891
7892 !! test
7893 Plain link to page with question mark in title
7894 !! wikitext
7895 [[A?b]]
7896
7897 [[A?b|Baz]]
7898 !! html
7899 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7900 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7901 </p>
7902 !! end
7903
7904
7905 # I'm fairly sure the expected result here is wrong.
7906 # We want these to be URL links, not pseudo-pages with URLs for titles....
7907 # However the current output is also pretty screwy.
7908 #
7909 # ----
7910 # I'm changing it to match the current output--it arguably makes more
7911 # sense in the light of the test above. Old expected result was:
7912 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7913 #</p>
7914 # But I think this test is bordering on "garbage in, garbage out" anyway.
7915 # -- wtm
7916 !! test
7917 Piped link to URL
7918 !! wikitext
7919 Piped link to URL: [[http://www.example.com|an example URL]]
7920 !! html/php
7921 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7922 </p>
7923 !! html/parsoid
7924 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7925 !! end
7926
7927 !! test
7928 BUG 2: [[page|http://url/]] should link to page, not http://url/
7929 !! wikitext
7930 [[Main Page|http://url/]]
7931 !! html/php
7932 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7933 </p>
7934 !! html/parsoid
7935 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7936 !! end
7937
7938 # Parsoid does not mark self-links, by design.
7939 !! test
7940 BUG 337: Escaped self-links should be bold
7941 !! options
7942 title=[[Bug462]]
7943 !! wikitext
7944 [[Bu&#103;462]] [[Bug462]]
7945 !! html/php
7946 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7947 </p>
7948 !! html/php+tidy
7949 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7950 !! html/parsoid
7951 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7952 !! end
7953
7954 !! test
7955 Self-link to section should not be bold
7956 !! options
7957 title=[[Main Page]]
7958 !! wikitext
7959 [[Main Page#section]]
7960 !! html
7961 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7962 </p>
7963 !! end
7964
7965 !! article
7966 00
7967 !! text
7968 This is 00.
7969 !! endarticle
7970
7971 !!test
7972 Self-link to numeric title
7973 !!options
7974 title=[[0]]
7975 !! wikitext
7976 [[0]]
7977 !! html
7978 <p><strong class="selflink">0</strong>
7979 </p>
7980 !!end
7981
7982 !!test
7983 Link to numeric-equivalent title
7984 !!options
7985 title=[[0]]
7986 !! wikitext
7987 [[00]]
7988 !! html
7989 <p><a href="/wiki/00" title="00">00</a>
7990 </p>
7991 !!end
7992
7993 !! test
7994 <nowiki> inside a link
7995 !! wikitext
7996 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7997 !! html
7998 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7999 </p>
8000 !! end
8001
8002 !! test
8003 Non-breaking spaces in title
8004 !! wikitext
8005 [[&nbsp; Main &nbsp; Page &nbsp;]]
8006 !! html
8007 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
8008 </p>
8009 !!end
8010
8011 !! test
8012 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
8013 !! options
8014 language=ca
8015 !! wikitext
8016 '''[[Main Page]]'''
8017 !! html
8018 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
8019 </p>
8020 !! end
8021
8022 !! test
8023 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
8024 !! options
8025 language=ca
8026 !! wikitext
8027 ''[[Main Page]]''
8028 !! html
8029 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
8030 </p>
8031 !! end
8032
8033 !! test
8034 Internal link with en linktrail: no apostrophes (bug 27473)
8035 !! options
8036 language=en
8037 !! wikitext
8038 [[Something]]'nice
8039 !! html
8040 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
8041 </p>
8042 !! end
8043
8044 !! test
8045 Internal link with ca linktrail with apostrophes (bug 27473)
8046 !! options
8047 language=ca
8048 !! wikitext
8049 [[Something]]'nice
8050 !! html
8051 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
8052 </p>
8053 !! end
8054
8055 !! test
8056 Internal link with kaa linktrail with apostrophes (bug 27473)
8057 !! options
8058 language=kaa
8059 !! wikitext
8060 [[Something]]'nice
8061 !! html
8062 <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>
8063 </p>
8064 !! end
8065
8066 !! test
8067 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
8068 !! wikitext
8069 [[User:Foo/Test/63636:Bar|Test]]
8070 !! html/php
8071 <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>
8072 </p>
8073 !! html/parsoid
8074 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
8075 !! end
8076
8077 ## Mainly a sanity check for Parsoid
8078 !! test
8079 Handle title parsing for subpages
8080 !! options
8081 title=[[/123123]]
8082 !! wikitext
8083 123
8084 !! html/parsoid
8085 <p>123</p>
8086 !! end
8087
8088 ## FIXME: Add a working php section here
8089 !! test
8090 Link to a subpage from a namespace other than main
8091 !! options
8092 title=[[User:test]]
8093 !! wikitext
8094 [[/123]]
8095 !! html/parsoid
8096 <p><a rel="mw:WikiLink" href="./User:Test/123" title="User:Test/123" data-parsoid='{"stx":"simple","a":{"href":"./User:Test/123"},"sa":{"href":"/123"}}'>/123</a></p>
8097 !! end
8098
8099 !! test
8100 Ensure that transclusion titles are not url-decoded
8101 !! options
8102 subpage title=[[Test]]
8103 parsoid=wt2html
8104 !! wikitext
8105 {{Bar%C3%A9}} {{/Bar%C3%A9}}
8106 !! html/php
8107 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
8108 </p>
8109 !! html/parsoid
8110 <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
8111 !! end
8112
8113 !! test
8114 Purely hash wikilink
8115 !! options
8116 title=[[User:test/123]]
8117 !! wikitext
8118 [[#a|b]]
8119 !! html/php
8120 <p><a href="#a">b</a>
8121 </p>
8122 !! html/parsoid
8123 <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>
8124 !! end
8125
8126 !! test
8127 1. Interaction of linktrail and template encapsulation
8128 !! options
8129 parsoid
8130 !! wikitext
8131 {{echo|[[Foo]]}}l
8132 !! html
8133 <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>
8134 !! end
8135
8136 !! test
8137 2. Interaction of linktrail and template encapsulation
8138 !! options
8139 parsoid
8140 !! wikitext
8141 {{echo|Some [[Fool]]}}s
8142 !! html
8143 <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>
8144 !! end
8145
8146 !! test
8147 3. Interaction of linktrail and template encapsulation
8148 !! options
8149 parsoid
8150 !! wikitext
8151 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
8152 !! html
8153 <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>
8154 !! end
8155
8156 !! article
8157 Söfnuður
8158 !! text
8159 Test.
8160 !! endarticle
8161
8162 !! test
8163 Internal link with is link prefix
8164 !! options
8165 language=is
8166 !! wikitext
8167 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
8168 !! html
8169 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
8170 </p>
8171 !! end
8172
8173 !! article
8174 Mótmælendatrú
8175 !! text
8176 Test.
8177 !! endarticle
8178
8179 !! test
8180 Internal link with is link trail and link prefix
8181 !! options
8182 language=is
8183 !! wikitext
8184 [[mótmælendatrú|xxx]]ar
8185 [[mótmælendatrú]]ar
8186 mótmælenda[[söfnuður]]
8187 mótmælenda[[söfnuður|söfnuðir]]
8188 mótmælenda[[söfnuður|söfnuðir]]xxx
8189 !! html
8190 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
8191 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
8192 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
8193 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
8194 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
8195 </p>
8196 !! end
8197
8198 !! test
8199 Parsoid link trail escaping
8200 !! options
8201 parsoid=html2wt,html2html
8202 !! html/parsoid
8203 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
8204 !! wikitext
8205 [[apple]]<nowiki/>s
8206 !! end
8207
8208 !! test
8209 Parsoid link prefix escaping
8210 !! options
8211 language=is
8212 parsoid=html2wt,html2html
8213 !! html/parsoid
8214 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
8215 !! wikitext
8216 Aðrir mótmælenda<nowiki/>[[söfnuður]]
8217 !! end
8218
8219 !! test
8220 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
8221 !! wikitext
8222 [[Foo| bar]]
8223
8224 [[Foo| ''bar'']]
8225
8226 [http://wp.org foo]
8227
8228 [http://wp.org ''foo'']
8229 !! html
8230 <p><a href="/wiki/Foo" title="Foo"> bar</a>
8231 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
8232 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
8233 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
8234 </p>
8235 !! end
8236
8237 !! test
8238 Parsoid: Scoped parsing should handle mixed transclusions and plain text
8239 !! options
8240 parsoid
8241 !! wikitext
8242 [[Foo|{{echo|a}} b {{echo|c}}]]
8243 !! html
8244 <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>
8245 !! end
8246
8247 !! test
8248 Link with angle bracket after anchor
8249 !! wikitext
8250 [[Foo#<bar>]]
8251 !! html/php
8252 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
8253 </p>
8254 !! html/parsoid
8255 <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>
8256 !! end
8257
8258 ###
8259 ### Interwiki links (see maintenance/interwiki.sql)
8260 ###
8261
8262 !! test
8263 Inline interwiki link
8264 !! options
8265 parsoid=wt2html,wt2wt,html2html
8266 !! wikitext
8267 [[MeatBall:SoftSecurity]]
8268 !! html/php
8269 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
8270 </p>
8271 !! html/parsoid
8272 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
8273 !! end
8274
8275 !! test
8276 Inline interwiki link with empty title (bug 2372)
8277 !! options
8278 parsoid=wt2html,wt2wt,html2html
8279 !! wikitext
8280 [[MeatBall:]]
8281 !! html/php
8282 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
8283 </p>
8284 !! html/parsoid
8285 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
8286 !! end
8287
8288 !! test
8289 Interwiki link encoding conversion (bug 1636)
8290 !! wikitext
8291 *[[Wikipedia:ro:Olteni&#0355;a]]
8292 *[[Wikipedia:ro:Olteni&#355;a]]
8293 !! html
8294 <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>
8295 <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>
8296
8297 !! html+tidy
8298 <ul>
8299 <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>
8300 <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>
8301 </ul>
8302 !! end
8303
8304 !! test
8305 Interwiki link with fragment (bug 2130)
8306 !! wikitext
8307 [[MeatBall:SoftSecurity#foo]]
8308 !! html
8309 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
8310 </p>
8311 !! end
8312
8313 # Ideally the wikipedia: prefix here should be proto-relative too
8314 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
8315 # define the 'en' prefix, and originally the test used 'wikipedia',
8316 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
8317 # article.
8318 !! test
8319 Different interwiki prefixes mapping to the same URL
8320 !! wikitext
8321 [[:en:Foo]]
8322
8323 [[:en:Foo|Foo]]
8324
8325 [[wikipedia:Foo]]
8326
8327 [[:wikipedia:Foo|Foo]]
8328
8329 [[wikipedia:en:Foo]]
8330
8331 [[:wikipedia:en:Foo]]
8332
8333 [[ wikiPEdia :Foo]]
8334 !! html/parsoid
8335 <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>
8336
8337 <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>
8338
8339 <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>
8340
8341 <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>
8342
8343 <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>
8344
8345 <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>
8346
8347 <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>
8348 !! end
8349
8350 !! test
8351 Interwiki links that cannot be represented in wiki syntax
8352 !! wikitext
8353 [[meatball:ok]]
8354 [[meatball:ok#foo|ok with fragment]]
8355 [[meatball:ok_as_well?|ok ending with ? mark]]
8356 [http://de.wikipedia.org/wiki/Foo?action=history has query]
8357 [http://de.wikipedia.org/wiki/#foo is just fragment]
8358
8359 !! html/php
8360 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8361 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8362 <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>
8363 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8364 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8365 </p>
8366 !! html/parsoid
8367 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8368 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8369 <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>
8370 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8371 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8372 !! end
8373
8374 !! test
8375 Interwiki links: trail
8376 !! wikitext
8377 [[wikipedia:Foo|Ba]]r
8378 !! html/php
8379 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8380 </p>
8381 !! html/parsoid
8382 <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>
8383 !! end
8384
8385 !! test
8386 Local interwiki link
8387 !! options
8388 parsoid=wt2html,wt2wt,html2html
8389 !! wikitext
8390 [[local:Template:Foo]]
8391 !! html/php
8392 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8393 </p>
8394 !! html/parsoid
8395 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8396 !! end
8397
8398 # Parsoid does not mark self-links, by design.
8399 !! test
8400 Local interwiki link: self-link to current page
8401 !! options
8402 title=[[Main Page]]
8403 parsoid=wt2html,wt2wt,html2html
8404 !! wikitext
8405 [[local:Main Page]]
8406 !! html/php
8407 <p><strong class="selflink">local:Main Page</strong>
8408 </p>
8409 !! html/parsoid
8410 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8411 !! end
8412
8413 !! test
8414 Local interwiki link: prefix only (bug 64167)
8415 !! options
8416 parsoid=wt2html,wt2wt,html2html
8417 !! wikitext
8418 [[local:]]
8419 !! html/php
8420 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8421 </p>
8422 !! html/parsoid
8423 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8424 !! end
8425
8426 !! test
8427 Local interwiki link: with additional interwiki prefix (bug 61357)
8428 !! options
8429 parsoid=wt2html,wt2wt,html2html
8430 !! wikitext
8431 [[local:meatball:Hello]]
8432 !! html/php
8433 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8434 </p>
8435 !! html/parsoid
8436 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8437 !! end
8438
8439 !! test
8440 Multiple local interwiki link prefixes
8441 !! wikitext
8442 [[local:local:local:local:mi:local:Foo]]
8443 !! options
8444 parsoid=wt2html,wt2wt,html2html
8445 !! html/php
8446 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8447 </p>
8448 !! html/parsoid
8449 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8450 !! end
8451
8452 ###
8453 ### Interlanguage links
8454 ### Language links (so that searching for '### language' matches..)
8455 ###
8456
8457 !! test
8458 Interlanguage link
8459 !! wikitext
8460 Blah blah blah
8461 [[zh:Chinese]]
8462 !! html/php
8463 <p>Blah blah blah
8464 </p>
8465 !! html/parsoid
8466 <p>Blah blah blah</p>
8467 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8468 !! end
8469
8470 ## parsoid html2wt will lose the space variations
8471 !! test
8472 Interlanguage link with spacing
8473 !! options
8474 parsoid=wt2html,wt2wt,html2html
8475 !! wikitext
8476 Blah blah blah
8477 [[ zh : Chinese ]]
8478 !! html/php
8479 <p>Blah blah blah
8480 </p>
8481 !! html/parsoid
8482 <p>Blah blah blah</p>
8483 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8484 !! end
8485
8486 !! test
8487 Double interlanguage link
8488 !! wikitext
8489 Blah blah blah
8490 [[es:Spanish]]
8491 [[zh:Chinese]]
8492 !! html/php
8493 <p>Blah blah blah
8494 </p>
8495 !! html/parsoid
8496 <p>Blah blah blah</p>
8497 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8498 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8499 !! end
8500
8501 ## parsoid html2wt will lose the space variations
8502 !! test
8503 Interlanguage link variations
8504 !! options
8505 parsoid=wt2html,wt2wt,html2html
8506 !! wikitext
8507 Blah blah blah
8508 [[ es :Spanish]]
8509 [[ ZH :Chinese]]
8510 [[es:Foo_bar]]
8511 !! html/php
8512 <p>Blah blah blah
8513 </p>
8514 !! html/parsoid
8515 <p>Blah blah blah</p>
8516 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8517 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8518 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8519 !! end
8520
8521 ## parsoid html2wt will normalize the space to _
8522 !! test
8523 Space and question mark encoding in interlanguage links (T95473)
8524 !! options
8525 parsoid=wt2html,wt2wt,html2html
8526 !! wikitext
8527 Blah blah blah
8528 [[es:Foo bar?]]
8529 !! html/php
8530 <p>Blah blah blah
8531 </p>
8532 !! html/parsoid
8533 <p>Blah blah blah</p>
8534 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8535 !! end
8536
8537 !! test
8538 Interlanguage link, with prefix links
8539 !! options
8540 language=ln
8541 !! wikitext
8542 Blah blah blah
8543 [[zh:Chinese]]
8544 !! html/php
8545 <p>Blah blah blah
8546 </p>
8547 !! html/parsoid
8548 <p>Blah blah blah</p>
8549 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8550 !! end
8551
8552 !! test
8553 Double interlanguage link, with prefix links (bug 8897)
8554 !! options
8555 language=ln
8556 !! wikitext
8557 Blah blah blah
8558 [[es:Spanish]]
8559 [[zh:Chinese]]
8560 !! html/php
8561 <p>Blah blah blah
8562 </p>
8563 !! html/parsoid
8564 <p>Blah blah blah</p>
8565 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8566 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8567 !! end
8568
8569 !! test
8570 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8571 !! wikitext
8572 Blah blah blah
8573 [[mul:Article]]
8574 !! html/php
8575 <p>Blah blah blah
8576 </p>
8577 !! html/parsoid
8578 <p>Blah blah blah</p>
8579 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8580 !! end
8581
8582 ## PHP parser tests script needs an update
8583 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8584 !! test
8585 Language links render as inline links if $wgInterwikiMagic=false
8586 !! options
8587 wgInterwikiMagic=false
8588 parsoid=wt2html,wt2wt,html2html
8589 !! wikitext
8590 Blah blah blah
8591 [[zh:Chinese]]
8592 !! html/parsoid
8593 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8594 !! end
8595
8596 ## PHP parser tests script needs an update
8597 ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
8598 !! test
8599 Language links render as inline links in the Talk namespace
8600 !! options
8601 title=Talk:Foo
8602 parsoid=wt2html,wt2wt,html2html
8603 !! wikitext
8604 Blah blah blah
8605 [[zh:Chinese]]
8606 !! html/parsoid
8607 <p>Blah blah blah <a rel="mw:ExtLink" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
8608 !! end
8609
8610 !! test
8611 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8612 !! options
8613 language=ln
8614 !! wikitext
8615 [[WW&nbsp;II]]
8616 !! html
8617 <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>
8618 </p>
8619 !! end
8620
8621 !! test
8622 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8623 !! options
8624 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
8625 !! html/parsoid
8626 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8627 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8628 !! wikitext
8629 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8630
8631 He&amp;nbsp;llo He&amp;nbsp;llo
8632 !! html/php
8633 <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
8634 </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
8635 </p>
8636 !! end
8637
8638 # html2wt will fail because of title normalization without data-parsoid
8639 !! test
8640 Parsoid: handle constructor well
8641 !! options
8642 parsoid=wt2html,wt2wt
8643 !! wikitext
8644 [[constructor]]
8645
8646 [[constructor:foo]]
8647 !! html/php
8648 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8649 </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>
8650 </p>
8651 !! html/parsoid
8652 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
8653
8654 <p><a rel="mw:WikiLink" href="./Constructor:foo" title="Constructor:foo" data-parsoid='{"stx":"simple","a":{"href":"./Constructor:foo"},"sa":{"href":"constructor:foo"}}'>constructor:foo</a></p>
8655 !! end
8656
8657 !! article
8658 ko:
8659 !! text
8660 Test.
8661 !! endarticle
8662
8663 # Note that `ko` isn't a known interlanguage prefix
8664 !! test
8665 Parsoid: recognize interlanguage links without a target page
8666 !! options
8667 ill
8668 !! wikitext
8669 [[es:]]
8670
8671 [[ko:]]
8672 !! html/php
8673 es:
8674 !! html/parsoid
8675 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8676
8677 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8678 !! end
8679
8680 # Note that `ko` isn't a known interwiki prefix
8681 !! test
8682 Parsoid: recognize interwiki links without a target page
8683 !! options
8684 parsoid=wt2html,wt2wt,html2html
8685 !! wikitext
8686 [[:es:]]
8687
8688 [[:ko:]]
8689 !! html/php
8690 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8691 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8692 </p>
8693 !! html/parsoid
8694 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8695 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8696 !! end
8697
8698 !! test
8699 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8700 !! wikitext
8701 [[mi:Foo]]
8702 !! html/php
8703 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8704 </p>
8705 !! html/parsoid
8706 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8707 !! end
8708
8709 !! test
8710 Interlanguage link with preceding local interwiki link (bug 68085)
8711 !! options
8712 parsoid=wt2html,wt2wt,html2html
8713 !! wikitext
8714 Blah blah blah
8715 [[local:es:Spanish]]
8716 !! html/php
8717 <p>Blah blah blah
8718 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8719 </p>
8720 !! html/parsoid
8721 <p>Blah blah blah
8722 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8723 !! end
8724
8725 !! test
8726 Looks like an interlanguage link, but is actually a local interwiki
8727 !! options
8728 parsoid=wt2html,wt2wt,html2html
8729 !! wikitext
8730 Blah blah blah
8731 [[mi:Template:Foo]]
8732 !! html/php
8733 <p>Blah blah blah
8734 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8735 </p>
8736 !! html/parsoid
8737 <p>Blah blah blah
8738 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8739 !! end
8740
8741 ###
8742 ### Redirects, Parsoid-only
8743 ###
8744
8745 !! test
8746 1. Simple redirect to page
8747 !! wikitext
8748 #REDIRECT [[Main Page]]
8749 !! html/parsoid
8750 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8751 !! end
8752
8753 !! test
8754 2. Other redirect variants
8755 !! wikitext
8756 #REDIRECT [[Main_Page]]
8757 !! html/parsoid
8758 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8759 !! end
8760
8761 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8762 # This tests the Parsoid bail-out code.
8763 !! test
8764 3. Other redirect variants
8765 !! wikitext
8766 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8767 !! html/parsoid
8768 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8769 !! end
8770
8771 !! test
8772 4. Redirect to a templated destination
8773 !! wikitext
8774 #REDIRECT [[{{echo|Foo}}bar]]
8775 !! html/parsoid
8776 <link about="#mwt2" typeof="mw:ExpandedAttrs" rel="mw:PageProp/redirect" href="./Foobar" data-parsoid='{"a":{"href":"./Foobar"},"sa":{"href":"{{echo|Foo}}bar"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[12,24,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"Foo\"}},\"i\":0}}]}&#39;>Foo&lt;/span>bar"}]]}'/>
8777 !! end
8778
8779 !! test
8780 Empty redirect
8781 !! options
8782 parsoid=wt2html,wt2wt
8783 !! wikitext
8784 #REDIRECT [[]]
8785 !! html/parsoid
8786 <ol>
8787 <li>REDIRECT [[]]</li></ol>
8788 !! end
8789
8790 !! test
8791 Optional colon in #REDIRECT
8792 !! options
8793 # the colon is archaic syntax. we support it for wt2html, but we
8794 # don't care that it roundtrips back to the modern syntax.
8795 parsoid=wt2html,html2html
8796 !! wikitext
8797 #REDIRECT:[[Main Page]]
8798 !! html/parsoid
8799 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8800 !! end
8801
8802 !! test
8803 Whitespace in #REDIRECT with optional colon
8804 !! options
8805 # the colon and gratuitous whitespace is archaic syntax. we support
8806 # it for wt2html, but we don't care that it roundtrips back to the
8807 # modern syntax (without extra whitespace)
8808 parsoid=wt2html,html2html
8809 !! wikitext
8810
8811 #REDIRECT
8812 :
8813 [[Main Page]]
8814 !! html/parsoid
8815 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8816 !! end
8817
8818 !! test
8819 Piped link in #REDIRECT
8820 !! options
8821 # content after piped link is ignored. we support this syntax,
8822 # but don't care that the piped link is lost when we roundtrip this.
8823 parsoid=wt2html
8824 !! wikitext
8825 #REDIRECT [[Main Page|bar]]
8826 !! html/parsoid
8827 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8828 !! end
8829
8830 !! test
8831 Redirect to category (T104502)
8832 !! options
8833 parsoid=wt2html,wt2wt
8834 !! wikitext
8835 #REDIRECT [[Category:Foo]]
8836 !! html/parsoid
8837 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8838 !! end
8839
8840 !! test
8841 Redirect to category with URL encoding (T104502)
8842 !! options
8843 parsoid=wt2html
8844 !! wikitext
8845 #REDIRECT [[Category%3AFoo]]
8846 !! html/parsoid
8847 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8848 !! end
8849
8850 !! test
8851 Redirect to category page
8852 !! wikitext
8853 #REDIRECT [[:Category:Foo]]
8854 !! html/parsoid
8855 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8856 !! end
8857
8858 !! test
8859 Redirect to image page (1)
8860 !! wikitext
8861 #REDIRECT [[File:Wiki.png]]
8862 !! html/parsoid
8863 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8864 !! end
8865
8866 !! test
8867 Redirect to image page (2)
8868 !! wikitext
8869 #REDIRECT [[Image:Wiki.png]]
8870 !! html/parsoid
8871 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8872 !! end
8873
8874 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8875 # Next test confirms this.
8876 !! test
8877 Redirect to language (1) (T104918)
8878 !! options
8879 parsoid=wt2html,wt2wt,html2html
8880 !! wikitext
8881 #REDIRECT [[en:File:Wiki.png]]
8882 !! html/parsoid
8883 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8884 !! end
8885
8886 !! test
8887 Redirect to language (2) (T104918)
8888 !! wikitext
8889 #REDIRECT [[:en:File:Wiki.png]]
8890 !! html/parsoid
8891 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8892 !! end
8893
8894 !! test
8895 Redirect to interwiki (T104918)
8896 !! wikitext
8897 #REDIRECT [[meatball:File:Wiki.png]]
8898 !! html/parsoid
8899 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8900 !! end
8901
8902 !! test
8903 Non-English #REDIRECT
8904 !! options
8905 language=is
8906 !! wikitext
8907 #TILVÍSUN [[Main Page]]
8908 !! html/parsoid
8909 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8910 !! end
8911
8912 !! test
8913 Redirect syntax under text isn't considered a redirect
8914 !! wikitext
8915 some text
8916 #redirect [[Main Page]]
8917 !! html/parsoid
8918 <p>some text</p>
8919 <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>
8920 !! end
8921
8922 # FIXME: Should hoist the redirect to the top of the page and ensure there
8923 # is only one.
8924 !! test
8925 New redirect
8926 !! options
8927 parsoid=html2wt
8928 !! html/parsoid
8929 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8930 !! wikitext
8931 Foo
8932 #REDIRECT [[Foo]]
8933 !! end
8934
8935 ##
8936 ## XHTML tidiness
8937 ###
8938
8939 !! test
8940 <br> to <br />
8941 !! wikitext
8942 1<br>2<br />3
8943 !! html
8944 <p>1<br />2<br />3
8945 </p>
8946 !! end
8947
8948 !! test
8949 Broken br tag sanitization
8950 !! wikitext
8951 </br>
8952 !! html/php
8953 <p>&lt;/br&gt;
8954 </p>
8955 !! end
8956
8957 # TODO: Fix html2html mode (bug 51055)!
8958 !! test
8959 Parsoid: Broken br tag recognition
8960 !! options
8961 parsoid=wt2html
8962 !! wikitext
8963 </br>
8964
8965 <br/ >
8966 !! html+tidy
8967 <p><br /></p>
8968 <p><br /></p>
8969 !! end
8970
8971 !! test
8972 Incorrecly removing closing slashes from correctly formed XHTML
8973 !! wikitext
8974 <br style="clear:both;" />
8975 !! html
8976 <p><br style="clear:both;" />
8977 </p>
8978 !! end
8979
8980 !! test
8981 Failing to transform badly formed HTML into correct XHTML
8982 !! wikitext
8983 <br style="clear: left;">
8984 <br style="clear: right;">
8985 <br style="clear: both;">
8986 !! html
8987 <p><br style="clear: left;" />
8988 <br style="clear: right;" />
8989 <br style="clear: both;" />
8990 </p>
8991 !!end
8992
8993 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8994 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8995 !! test
8996 Handling html with a div self-closing tag
8997 !! wikitext
8998 <div title />
8999 <div title/>
9000 <div title/ >
9001 <div title=bar />
9002 <div title=bar/>
9003 <div title=bar/ >
9004 !! html/php
9005 <p>&lt;div title /&gt;
9006 &lt;div title/&gt;
9007 </p>
9008 <div>
9009 <p>&lt;div title=bar /&gt;
9010 &lt;div title=bar/&gt;
9011 </p>
9012 <div title="bar/"></div>
9013 </div>
9014
9015 !! html/parsoid
9016 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9017 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
9018 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
9019 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9020 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
9021 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
9022 !! end
9023
9024 !! test
9025 Handling html with a br self-closing tag
9026 !! wikitext
9027 <br title />
9028 <br title/>
9029 <br title/ >
9030 <br title=bar />
9031 <br title=bar/>
9032 <br title=bar/ >
9033 !! html/php
9034 <p><br title="" />
9035 <br title="" />
9036 <br />
9037 <br title="bar" />
9038 <br title="bar" />
9039 <br title="bar/" />
9040 </p>
9041 !! html/parsoid
9042 <p><br title="" />
9043 <br title="" />
9044 <br title="" />
9045 <br title="bar" />
9046 <br title="bar" />
9047 <br title="bar/" />
9048 </p>
9049 !! end
9050
9051 !! test
9052 Horizontal ruler (should it add that extra space?)
9053 !! wikitext
9054 <hr>
9055 <hr >
9056 foo <hr
9057 > bar
9058 !! html+tidy
9059 <hr />
9060 <hr />
9061 <p>foo</p>
9062 <hr />
9063 <p>bar</p>
9064 !! end
9065
9066 !! test
9067 Horizontal ruler -- 4+ dashes render hr
9068 !! wikitext
9069 ----
9070 !! html
9071 <hr />
9072
9073 !! end
9074
9075 !! test
9076 Horizontal ruler -- eats additional dashes on the same line
9077 !! wikitext
9078 ---------
9079 !! html
9080 <hr />
9081
9082 !! end
9083
9084 !! test
9085 Horizontal ruler -- does not collapse dashes on consecutive lines
9086 !! wikitext
9087 ----
9088 ----
9089 !! html
9090 <hr />
9091 <hr />
9092
9093 !! end
9094
9095 !! test
9096 Horizontal ruler -- <4 dashes render as plain text
9097 !! wikitext
9098 ---
9099 !! html
9100 <p>---
9101 </p>
9102 !! end
9103
9104 !! test
9105 Horizontal ruler -- Supports content following dashes on same line
9106 !! wikitext
9107 ---- Foo
9108 !! html
9109 <hr /> Foo
9110
9111 !! html+tidy
9112 <hr />
9113 <p>Foo</p>
9114 !! end
9115
9116 ###
9117 ### Block-level elements
9118 ###
9119 !! test
9120 Common list
9121 !! wikitext
9122 *Common list
9123 * item 2
9124 *item 3
9125 !! html
9126 <ul><li>Common list</li>
9127 <li> item 2</li>
9128 <li>item 3</li></ul>
9129
9130 !! end
9131
9132 !! test
9133 Numbered list
9134 !! wikitext
9135 #Numbered list
9136 #item 2
9137 # item 3
9138 !! html
9139 <ol><li>Numbered list</li>
9140 <li>item 2</li>
9141 <li> item 3</li></ol>
9142
9143 !! end
9144
9145 !! test
9146 Mixed list
9147 !! wikitext
9148 *Mixed list
9149 *# with numbers
9150 ** and bullets
9151 *# and numbers
9152 *bullets again
9153 **bullet level 2
9154 ***bullet level 3
9155 ***#Number on level 4
9156 **bullet level 2
9157 **#Number on level 3
9158 **#Number on level 3
9159 *#number level 2
9160 *Level 1
9161 *** Level 3
9162 #** Level 3, but ordered
9163 !! html
9164 <ul><li>Mixed list
9165 <ol><li> with numbers</li></ol>
9166 <ul><li> and bullets</li></ul>
9167 <ol><li> and numbers</li></ol></li>
9168 <li>bullets again
9169 <ul><li>bullet level 2
9170 <ul><li>bullet level 3
9171 <ol><li>Number on level 4</li></ol></li></ul></li>
9172 <li>bullet level 2
9173 <ol><li>Number on level 3</li>
9174 <li>Number on level 3</li></ol></li></ul>
9175 <ol><li>number level 2</li></ol></li>
9176 <li>Level 1
9177 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
9178 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
9179
9180 !! end
9181
9182 !! test
9183 1. Nested mixed wikitext and html list
9184 !! wikitext
9185 * hi
9186 * <ul><li>ho</li></ul>
9187 * hi
9188 ** ho
9189 !! html/php
9190 <ul><li> hi</li>
9191 <li> <ul><li>ho</li></ul></li>
9192 <li> hi
9193 <ul><li> ho</li></ul></li></ul>
9194
9195 !! html/parsoid
9196 <ul><li> hi</li>
9197 <li> <ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
9198 <li> hi
9199 <ul><li> ho</li></ul></li></ul>
9200 !! end
9201
9202 !! test
9203 2. Nested mixed wikitext and html list (incompatible)
9204 !! wikitext
9205 ; hi
9206 : {{echo|<li>ho</li>}}
9207 !! html/php
9208 <dl><dt> hi</dt>
9209 <dd> <li>ho</li></dd></dl>
9210
9211 !! html/parsoid
9212 <dl><dt> hi</dt>
9213 <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>
9214 !! end
9215
9216 !! test
9217 Nested lists 1
9218 !! wikitext
9219 *foo
9220 **bar
9221 !! html
9222 <ul><li>foo
9223 <ul><li>bar</li></ul></li></ul>
9224
9225 !! end
9226
9227 !! test
9228 Nested lists 2
9229 !! wikitext
9230 **foo
9231 *bar
9232 !! html
9233 <ul><li><ul><li>foo</li></ul></li>
9234 <li>bar</li></ul>
9235
9236 !! end
9237
9238 !! test
9239 Nested lists 3 (first element empty)
9240 !! wikitext
9241 *
9242 **bar
9243 !! html
9244 <ul><li>
9245 <ul><li>bar</li></ul></li></ul>
9246
9247 !! end
9248
9249 !! test
9250 Nested lists 4 (first element empty)
9251 !! wikitext
9252 **
9253 *bar
9254 !! html
9255 <ul><li><ul><li></li></ul></li>
9256 <li>bar</li></ul>
9257
9258 !! end
9259
9260 !! test
9261 Nested lists 5 (both elements empty)
9262 !! wikitext
9263 **
9264 *
9265 !! html
9266 <ul><li><ul><li></li></ul></li>
9267 <li></li></ul>
9268
9269 !! end
9270
9271 !! test
9272 Nested lists 6 (both elements empty)
9273 !! wikitext
9274 *
9275 **
9276 !! html
9277 <ul><li>
9278 <ul><li></li></ul></li></ul>
9279
9280 !! end
9281
9282 !! test
9283 Nested lists 7 (skip initial nesting levels)
9284 !! wikitext
9285 *** foo
9286 !! html
9287 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
9288
9289 !! end
9290
9291 !! test
9292 Nested lists 8 (multiple nesting transitions)
9293 !! wikitext
9294 * foo
9295 *** bar
9296 ** baz
9297 * boo
9298 !! html
9299 <ul><li> foo
9300 <ul><li><ul><li> bar</li></ul></li>
9301 <li> baz</li></ul></li>
9302 <li> boo</li></ul>
9303
9304 !! end
9305
9306 !! test
9307 Nested lists 9 (extension interaction)
9308 !! options
9309 parsoid
9310 !! wikitext
9311 *<references />
9312 !! html/parsoid
9313 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
9314 !! end
9315
9316 !! test
9317 1. Lists with start-of-line-transparent tokens before bullets: Comments
9318 !! wikitext
9319 *foo
9320 *<!--cmt-->bar
9321 <!--cmt-->*baz
9322 !! html
9323 <ul><li>foo</li>
9324 <li>bar</li>
9325 <li>baz</li></ul>
9326
9327 !! end
9328
9329 !! test
9330 2. Lists with start-of-line-transparent tokens before bullets: Template close
9331 !! wikitext
9332 *foo {{echo|bar
9333 }}*baz
9334 !! html
9335 <ul><li>foo bar</li>
9336 <li>baz</li></ul>
9337
9338 !! end
9339
9340 !! test
9341 List items are not parsed correctly following a <pre> block (bug 785)
9342 !! wikitext
9343 * <pre>foo</pre>
9344 * <pre>bar</pre>
9345 * zar
9346 !! html/php
9347 <ul><li> <pre>foo</pre></li>
9348 <li> <pre>bar</pre></li>
9349 <li> zar</li></ul>
9350
9351 !! html/parsoid
9352 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
9353 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
9354 <li> zar</li></ul>
9355 !! end
9356
9357 !! test
9358 List items from template
9359 !! wikitext
9360
9361 {{inner list}}
9362 * item 2
9363
9364 * item 0
9365 {{inner list}}
9366 * item 2
9367
9368 * item 0
9369 * notSOL{{inner list}}
9370 * item 2
9371 !! html
9372 <ul><li> item 1</li>
9373 <li> item 2</li></ul>
9374 <ul><li> item 0</li>
9375 <li> item 1</li>
9376 <li> item 2</li></ul>
9377 <ul><li> item 0</li>
9378 <li> notSOL</li>
9379 <li> item 1</li>
9380 <li> item 2</li></ul>
9381
9382 !! end
9383
9384 !! test
9385 List interrupted by empty line or heading
9386 !! wikitext
9387 * foo
9388
9389 ** bar
9390 == A heading ==
9391 * Another list item
9392 !! html
9393 <ul><li> foo</li></ul>
9394 <ul><li><ul><li> bar</li></ul></li></ul>
9395 <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>
9396 <ul><li> Another list item</li></ul>
9397
9398 !!end
9399
9400 !!test
9401 Multiple list tags generated by templates
9402 !! wikitext
9403 {{echo|<li>}}a
9404 {{echo|<li>}}b
9405 {{echo|<li>}}c
9406 !! html
9407 <li>a
9408 <li>b
9409 <li>c</li>
9410 </li>
9411 </li>
9412
9413 !! html+tidy
9414 <ul>
9415 <li>a</li>
9416 <li>b</li>
9417 <li>c</li>
9418 </ul>
9419 !!end
9420
9421 !!test
9422 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
9423 !! wikitext
9424 *a
9425 <!--This line will NOT split the list-->
9426 *b
9427 <!--This line will NOT split the list either-->
9428 *c
9429 <!--foo--> <!----> <!--This line NOT split the list either-->
9430 *d
9431 !! html
9432 <ul><li>a</li>
9433 <li>b</li>
9434 <li>c</li>
9435 <li>d</li></ul>
9436
9437 !!end
9438
9439 !!test
9440 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9441 !! wikitext
9442 *a
9443 <!--This line will NOT split the list-->
9444 *b
9445 <!--This line will NOT split the list either-->
9446 *c
9447 <!--foo--> <!----> <!--This line NOT split the list
9448 either-->
9449 *d
9450 !! html
9451 <ul><li>a</li>
9452 <li>b</li>
9453 <li>c</li>
9454 <li>d</li></ul>
9455
9456 !!end
9457
9458 !!test
9459 Test the li-hack
9460 (The PHP parser relies on Tidy for the hack)
9461 !!options
9462 parsoid=wt2html,wt2wt
9463 !! wikitext
9464 * foo
9465 * <li>li-hack
9466 * {{echo|<li>templated li-hack}}
9467 * <!--foo--> <li> unsupported li-hack with preceding comments
9468
9469 <ul>
9470 <li><li>not a li-hack
9471 </li>
9472 </ul>
9473 !! html+tidy
9474 <ul>
9475 <li>foo</li>
9476 <li>li-hack</li>
9477 <li>templated li-hack</li>
9478 <li>unsupported li-hack with preceding comments</li>
9479 </ul>
9480 <ul>
9481 <li>not a li-hack</li>
9482 </ul>
9483 !!end
9484
9485 !! test
9486 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9487 !! options
9488 parsoid
9489 !! wikitext
9490 # foo
9491 ## bar
9492 * foo
9493 ** bar
9494 : foo
9495 :: bar
9496 !! html
9497 <ol>
9498 <li> foo<ol>
9499 <li> bar</li>
9500 </ol></li>
9501 </ol><ul>
9502 <li> foo<ul>
9503 <li> bar</li>
9504 </ul></li>
9505 </ul><dl>
9506 <dd> foo<dl>
9507 <dd> bar</dd>
9508 </dl></dd>
9509 </dl>
9510 !! end
9511
9512 !! test
9513 Parsoid: Test of whitespace serialization with Templated bullets
9514 !! options
9515 parsoid
9516 !! wikitext
9517 * {{bullet}}
9518 !! html
9519 <ul>
9520 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9521 </ul>
9522 !! end
9523
9524 # ------------------------------------------------------------------------
9525 # The next set of tests are about Parsoid's ability to handle badly nested
9526 # tags (parse, minimize scope of fixup, and roundtrip back)
9527 # ------------------------------------------------------------------------
9528
9529 !! test
9530 Unbalanced closing block tags break a list
9531 (php parser relies on Tidy to fix up)
9532 !! wikitext
9533 <div>
9534 *a</div><div>
9535 *b</div>
9536 !! html+tidy
9537 <div>
9538 <ul>
9539 <li>a</li>
9540 </ul>
9541 </div>
9542 <div>
9543 <ul>
9544 <li>b</li>
9545 </ul>
9546 </div>
9547 !! end
9548
9549 # Parsoid fails this test, but it might be tricky to support properly.
9550 # See bug 68395.
9551 !! test
9552 Unbalanced closing non-block tags don't break a list
9553 (php parser relies on Tidy to fix up)
9554 !! wikitext
9555 <span>
9556 *a</span><span>
9557 *b</span>
9558 !! html/php+tidy
9559 <ul>
9560 <li><span>a</span></li>
9561 <li><span>b</span></li>
9562 </ul>
9563 !! html/parsoid
9564 <span>
9565 <ul>
9566 <li>a<span></span>
9567 </li>
9568 <li>b
9569 </li>
9570 </ul>
9571 </span>
9572 !! end
9573
9574 !! test
9575 Unclosed formatting tags that straddle lists are closed and reopened
9576 (php parser relies on Tidy to fix up)
9577 !! options
9578 parsoid=wt2html,wt2wt,html2html
9579 !! wikitext
9580 # <s> a
9581 # b </s>
9582 !! html/php+tidy
9583 <ol>
9584 <li><s>a</s></li>
9585 <li><s>b</s></li>
9586 </ol>
9587 !! html/parsoid
9588 <ol><li> <s> a</s></li>
9589 <li><s> b </s></li></ol>
9590 !! end
9591
9592 # See bug 68395.
9593 !!test
9594 1. List embedded in a formatting tag
9595 !! wikitext
9596 <small>
9597 * foo
9598 </small>
9599 !! html/php+tidy
9600 <ul>
9601 <li><small>foo</small></li>
9602 </ul>
9603 !! html/parsoid
9604 <small>
9605 <ul>
9606 <li> foo</li>
9607 </ul>
9608 </small>
9609 !!end
9610
9611 ## Ugly Parsoid output here
9612 ## Not sure what the right output is.
9613 !!test
9614 2. List embedded in a formatting tag
9615 !! wikitext
9616 <small>
9617 *a
9618 *b</small>
9619 !! html/php+tidy
9620 <ul>
9621 <li><small>a</small></li>
9622 <li><small>b</small></li>
9623 </ul>
9624 !! html/parsoid
9625 <small></small>
9626 <ul><small>
9627 <li>a</li>
9628 </small>
9629 <li><small>b</small></li>
9630 </ul>
9631 !!end
9632
9633 # Ugly Parsoid and PHP parser output here
9634 # Not sure if we want to make this a test!
9635 #
9636 ## !!test
9637 ## 3. Unclosed formatting tags in list elements
9638 ## !! wikitext
9639 ## *<small>a
9640 ## *<small>b
9641 ## !! html/php+tidy
9642 ## <ul>
9643 ## <li><small>a</small></li>
9644 ## <li><small><small>b</small></small></li>
9645 ## </ul>
9646 ## !! html/parsoid
9647 ## <ul>
9648 ## <li><small>a</small></li>
9649 ## <small>
9650 ## <li><small>b</small></li>
9651 ## </small></ul>
9652 ## !!end
9653
9654 # This is a bug in the PHP parser + tidy combination.
9655 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9656 # and then fostered out of the table by tidy.)
9657 # We believe the Parsoid output to be correct.
9658 !! test
9659 Table with missing opening <tr> tag
9660 !! options
9661 parsoid=wt2html,wt2wt
9662 !! wikitext
9663 <table>
9664 <td>foo</td>
9665 </tr>
9666 </table>
9667 !! html+tidy
9668 <table>
9669 <tr>
9670 <td>foo</td>
9671 </tr>
9672 </table>
9673 !! end
9674
9675 ###
9676 ### Magic Words
9677 ###
9678
9679 # Note that the current date is hard-coded as
9680 # 1970-01-01T00:02:03Z (a Thursday)
9681 # when running parser tests. The timezone is also fixed to GMT, so
9682 # local date will be identical to current date.
9683
9684 !! test
9685 Magic Word: {{CURRENTDAY}}
9686 !! wikitext
9687 {{CURRENTDAY}}
9688 !! html
9689 <p>1
9690 </p>
9691 !! end
9692
9693 !! test
9694 Magic Word: {{CURRENTDAY2}}
9695 !! wikitext
9696 {{CURRENTDAY2}}
9697 !! html
9698 <p>01
9699 </p>
9700 !! end
9701
9702 !! test
9703 Magic Word: {{CURRENTDAYNAME}}
9704 !! wikitext
9705 {{CURRENTDAYNAME}}
9706 !! html
9707 <p>Thursday
9708 </p>
9709 !! end
9710
9711 !! test
9712 Magic Word: {{CURRENTDOW}}
9713 !! wikitext
9714 {{CURRENTDOW}}
9715 !! html
9716 <p>4
9717 </p>
9718 !! end
9719
9720 !! test
9721 Magic Word: {{CURRENTMONTH}}
9722 !! wikitext
9723 {{CURRENTMONTH}}
9724 !! html
9725 <p>01
9726 </p>
9727 !! end
9728
9729 !! test
9730 Magic Word: {{CURRENTMONTH1}}
9731 !! wikitext
9732 {{CURRENTMONTH1}}
9733 !! html
9734 <p>1
9735 </p>
9736 !! end
9737
9738 !! test
9739 Magic Word: {{CURRENTMONTHABBREV}}
9740 !! wikitext
9741 {{CURRENTMONTHABBREV}}
9742 !! html
9743 <p>Jan
9744 </p>
9745 !! end
9746
9747 !! test
9748 Magic Word: {{CURRENTMONTHNAME}}
9749 !! wikitext
9750 {{CURRENTMONTHNAME}}
9751 !! html
9752 <p>January
9753 </p>
9754 !! end
9755
9756 !! test
9757 Magic Word: {{CURRENTMONTHNAMEGEN}}
9758 !! wikitext
9759 {{CURRENTMONTHNAMEGEN}}
9760 !! html
9761 <p>January
9762 </p>
9763 !! end
9764
9765 !! test
9766 Magic Word: {{CURRENTTIME}}
9767 !! wikitext
9768 {{CURRENTTIME}}
9769 !! html
9770 <p>00:02
9771 </p>
9772 !! end
9773
9774 !! test
9775 Magic Word: {{CURRENTHOUR}}
9776 !! wikitext
9777 {{CURRENTHOUR}}
9778 !! html
9779 <p>00
9780 </p>
9781 !! end
9782
9783 !! test
9784 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9785 !! wikitext
9786 {{CURRENTWEEK}}
9787 !! html
9788 <p>1
9789 </p>
9790 !! end
9791
9792 !! test
9793 Magic Word: {{CURRENTYEAR}}
9794 !! wikitext
9795 {{CURRENTYEAR}}
9796 !! html
9797 <p>1970
9798 </p>
9799 !! end
9800
9801 !! test
9802 Magic Word: {{CURRENTTIMESTAMP}}
9803 !! wikitext
9804 {{CURRENTTIMESTAMP}}
9805 !! html
9806 <p>19700101000203
9807 </p>
9808 !! end
9809
9810 !! test
9811 Magic Words LOCAL (UTC)
9812 !! wikitext
9813 * {{LOCALMONTH}}
9814 * {{LOCALMONTH1}}
9815 * {{LOCALMONTHNAME}}
9816 * {{LOCALMONTHNAMEGEN}}
9817 * {{LOCALMONTHABBREV}}
9818 * {{LOCALDAY}}
9819 * {{LOCALDAY2}}
9820 * {{LOCALDAYNAME}}
9821 * {{LOCALYEAR}}
9822 * {{LOCALTIME}}
9823 * {{LOCALHOUR}}
9824 * {{LOCALWEEK}}
9825 * {{LOCALDOW}}
9826 * {{LOCALTIMESTAMP}}
9827 !! html
9828 <ul><li> 01</li>
9829 <li> 1</li>
9830 <li> January</li>
9831 <li> January</li>
9832 <li> Jan</li>
9833 <li> 1</li>
9834 <li> 01</li>
9835 <li> Thursday</li>
9836 <li> 1970</li>
9837 <li> 00:02</li>
9838 <li> 00</li>
9839 <li> 1</li>
9840 <li> 4</li>
9841 <li> 19700101000203</li></ul>
9842
9843 !! end
9844
9845 !! test
9846 Magic Word: {{FULLPAGENAME}}
9847 !! options
9848 title=[[User:Ævar Arnfjörð Bjarmason]]
9849 !! wikitext
9850 {{FULLPAGENAME}}
9851 !! html
9852 <p>User:Ævar Arnfjörð Bjarmason
9853 </p>
9854 !! end
9855
9856 !! test
9857 Magic Word: {{FULLPAGENAMEE}}
9858 !! options
9859 title=[[User:Ævar Arnfjörð Bjarmason]]
9860 !! wikitext
9861 {{FULLPAGENAMEE}}
9862 !! html
9863 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9864 </p>
9865 !! end
9866
9867 !! test
9868 Magic Word: {{TALKSPACE}}
9869 !! options
9870 title=[[User:Ævar Arnfjörð Bjarmason]]
9871 !! wikitext
9872 {{TALKSPACE}}
9873 !! html
9874 <p>User talk
9875 </p>
9876 !! end
9877
9878 !! test
9879 Magic Word: {{TALKSPACE}}, same namespace
9880 !! options
9881 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9882 !! wikitext
9883 {{TALKSPACE}}
9884 !! html
9885 <p>User talk
9886 </p>
9887 !! end
9888
9889 !! test
9890 Magic Word: {{TALKSPACE}}, main namespace
9891 !! options
9892 title=[[Parser Test]]
9893 !! wikitext
9894 {{TALKSPACE}}
9895 !! html
9896 <p>Talk
9897 </p>
9898 !! end
9899
9900 !! test
9901 Magic Word: {{TALKSPACEE}}
9902 !! options
9903 title=[[User:Ævar Arnfjörð Bjarmason]]
9904 !! wikitext
9905 {{TALKSPACEE}}
9906 !! html
9907 <p>User_talk
9908 </p>
9909 !! end
9910
9911 !! test
9912 Magic Word: {{SUBJECTSPACE}}
9913 !! options
9914 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9915 !! wikitext
9916 {{SUBJECTSPACE}}
9917 !! html
9918 <p>User
9919 </p>
9920 !! end
9921
9922 !! test
9923 Magic Word: {{SUBJECTSPACE}}, same namespace
9924 !! options
9925 title=[[User:Ævar Arnfjörð Bjarmason]]
9926 !! wikitext
9927 {{SUBJECTSPACE}}
9928 !! html
9929 <p>User
9930 </p>
9931 !! end
9932
9933 !! test
9934 Magic Word: {{SUBJECTSPACE}}, main namespace
9935 !! options
9936 title=[[Parser Test]]
9937 !! wikitext
9938 {{SUBJECTSPACE}}
9939 !! html
9940
9941 !! end
9942
9943 !! test
9944 Magic Word: {{SUBJECTSPACEE}}
9945 !! options
9946 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9947 !! wikitext
9948 {{SUBJECTSPACEE}}
9949 !! html
9950 <p>User
9951 </p>
9952 !! end
9953
9954 !! test
9955 Magic Word: {{NAMESPACE}}
9956 !! options
9957 title=[[User:Ævar Arnfjörð Bjarmason]]
9958 !! wikitext
9959 {{NAMESPACE}}
9960 !! html
9961 <p>User
9962 </p>
9963 !! end
9964
9965 !! test
9966 Magic Word: {{NAMESPACEE}}
9967 !! options
9968 title=[[User:Ævar Arnfjörð Bjarmason]]
9969 !! wikitext
9970 {{NAMESPACEE}}
9971 !! html
9972 <p>User
9973 </p>
9974 !! end
9975
9976 !! test
9977 Magic Word: {{NAMESPACENUMBER}}
9978 !! options
9979 title=[[User:Ævar Arnfjörð Bjarmason]]
9980 !! wikitext
9981 {{NAMESPACENUMBER}}
9982 !! html
9983 <p>2
9984 </p>
9985 !! end
9986
9987 !! test
9988 Magic Word: {{SUBPAGENAME}}
9989 !! options
9990 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9991 !! wikitext
9992 {{SUBPAGENAME}}
9993 !! html
9994 <p>sub ö
9995 </p>
9996 !! end
9997
9998 !! test
9999 Magic Word: {{SUBPAGENAMEE}}
10000 !! options
10001 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
10002 !! wikitext
10003 {{SUBPAGENAMEE}}
10004 !! html
10005 <p>sub_%C3%B6
10006 </p>
10007 !! end
10008
10009 !! test
10010 Magic Word: {{ROOTPAGENAME}}
10011 !! options
10012 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10013 !! wikitext
10014 {{ROOTPAGENAME}}
10015 !! html
10016 <p>Ævar Arnfjörð Bjarmason
10017 </p>
10018 !! end
10019
10020 !! test
10021 Magic Word: {{ROOTPAGENAMEE}}
10022 !! options
10023 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
10024 !! wikitext
10025 {{ROOTPAGENAMEE}}
10026 !! html
10027 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10028 </p>
10029 !! end
10030
10031 !! test
10032 Magic Word: {{BASEPAGENAME}}
10033 !! options
10034 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10035 !! wikitext
10036 {{BASEPAGENAME}}
10037 !! html
10038 <p>Ævar Arnfjörð Bjarmason
10039 </p>
10040 !! end
10041
10042 !! test
10043 Magic Word: {{BASEPAGENAMEE}}
10044 !! options
10045 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
10046 !! wikitext
10047 {{BASEPAGENAMEE}}
10048 !! html
10049 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10050 </p>
10051 !! end
10052
10053 !! test
10054 Magic Word: {{TALKPAGENAME}}
10055 !! options
10056 title=[[User:Ævar Arnfjörð Bjarmason]]
10057 !! wikitext
10058 {{TALKPAGENAME}}
10059 !! html
10060 <p>User talk:Ævar Arnfjörð Bjarmason
10061 </p>
10062 !! end
10063
10064 !! test
10065 Magic Word: {{TALKPAGENAMEE}}
10066 !! options
10067 title=[[User:Ævar Arnfjörð Bjarmason]]
10068 !! wikitext
10069 {{TALKPAGENAMEE}}
10070 !! html
10071 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10072 </p>
10073 !! end
10074
10075 !! test
10076 Magic Word: {{SUBJECTPAGENAME}}
10077 !! options
10078 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10079 !! wikitext
10080 {{SUBJECTPAGENAME}}
10081 !! html
10082 <p>User:Ævar Arnfjörð Bjarmason
10083 </p>
10084 !! end
10085
10086 !! test
10087 Magic Word: {{SUBJECTPAGENAMEE}}
10088 !! options
10089 title=[[User talk:Ævar Arnfjörð Bjarmason]]
10090 !! wikitext
10091 {{SUBJECTPAGENAMEE}}
10092 !! html
10093 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10094 </p>
10095 !! end
10096
10097 !! test
10098 Magic Word: {{NUMBEROFFILES}}
10099 !! wikitext
10100 {{NUMBEROFFILES}}
10101 !! html
10102 <p>7
10103 </p>
10104 !! end
10105
10106 !! test
10107 Magic Word: {{PAGENAME}}
10108 !! options
10109 title=[[User:Ævar Arnfjörð Bjarmason]]
10110 !! wikitext
10111 {{PAGENAME}}
10112 !! html
10113 <p>Ævar Arnfjörð Bjarmason
10114 </p>
10115 !! end
10116
10117 !! test
10118 Magic Word: {{PAGENAME}} with metacharacters
10119 !! options
10120 title=[['foo & bar = baz']]
10121 !! wikitext
10122 ''{{PAGENAME}}''
10123 !! html/php
10124 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
10125 </p>
10126 !! html+tidy
10127 <p><i>'foo &amp; bar = baz'</i></p>
10128 !! end
10129
10130 !! test
10131 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
10132 !! options
10133 title=[[*RFC 1234 http://example.com/]]
10134 !! wikitext
10135 {{PAGENAME}}
10136 !! html/php
10137 <p>&#42;RFC&#32;1234 http&#58;//example.com/
10138 </p>
10139 !! html+tidy
10140 <p>*RFC 1234 http://example.com/</p>
10141 !! end
10142
10143 !! test
10144 Magic Word: {{PAGENAMEE}}
10145 !! options
10146 title=[[User:Ævar Arnfjörð Bjarmason]]
10147 !! wikitext
10148 {{PAGENAMEE}}
10149 !! html
10150 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
10151 </p>
10152 !! end
10153
10154 !! test
10155 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
10156 !! options
10157 title=[[*RFC 1234 http://example.com/]]
10158 !! wikitext
10159 {{PAGENAMEE}}
10160 !! html/php
10161 <p>&#42;RFC_1234_http&#58;//example.com/
10162 </p>
10163 !! html+tidy
10164 <p>*RFC_1234_http://example.com/</p>
10165 !! end
10166
10167 !! test
10168 Magic Word: {{REVISIONID}}
10169 !! wikitext
10170 {{REVISIONID}}
10171 !! html
10172 <p>1337
10173 </p>
10174 !! end
10175
10176 !! test
10177 Magic Word: {{SCRIPTPATH}}
10178 !! wikitext
10179 {{SCRIPTPATH}}
10180 !! html
10181
10182 !! end
10183
10184 !! test
10185 Magic Word: {{STYLEPATH}}
10186 !! wikitext
10187 {{STYLEPATH}}
10188 !! html
10189 <p>/skins
10190 </p>
10191 !! end
10192
10193 !! test
10194 Magic Word: {{SERVER}}
10195 !! wikitext
10196 {{SERVER}}
10197 !! html
10198 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10199 </p>
10200 !! end
10201
10202 !! test
10203 Magic Word: {{SERVERNAME}}
10204 !! wikitext
10205 {{SERVERNAME}}
10206 !! html
10207 <p>example.org
10208 </p>
10209 !! end
10210
10211 !! test
10212 Magic Word: {{SITENAME}}
10213 !! wikitext
10214 {{SITENAME}}
10215 !! html
10216 <p>MediaWiki
10217 </p>
10218 !! end
10219
10220 !! test
10221 Case-sensitive magic words, when cased differently, should just be template transclusions
10222 !! wikitext
10223 {{CurrentMonth}}
10224 {{currentday}}
10225 {{cURreNTweEK}}
10226 {{currentHour}}
10227 !! html
10228 <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>
10229 <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>
10230 <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>
10231 <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>
10232 </p>
10233 !! end
10234
10235 !! test
10236 Case-insensitive magic words should still work with weird casing.
10237 !! wikitext
10238 {{sErVeRNaMe}}
10239 {{LCFirst:AOEU}}
10240 {{ucFIRST:aoeu}}
10241 {{SERver}}
10242 !! html
10243 <p>example.org
10244 aOEU
10245 Aoeu
10246 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
10247 </p>
10248 !! end
10249
10250 # From plwiki:PLOS_ONE
10251 !! test
10252 Parsoid: Page property magic word with magic word contents
10253 !! wikitext
10254 {{DISPLAYTITLE:''{{PAGENAME}}''}}
10255 !! html/parsoid
10256 <meta property="mw:PageProp/displaytitle" content="Main Page" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"src":"{{DISPLAYTITLE:&#39;&#39;{{PAGENAME}}&#39;&#39;}}"}' data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;i data-parsoid=&#39;{\"dsr\":[15,31,2,2]}&#39;>&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[17,29,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"PAGENAME\",\"function\":\"pagename\"},\"params\":{},\"i\":0}}]}&#39;>Main Page&lt;/span>&lt;/i>"}]]}'/>
10257 !! end
10258
10259 !! test
10260 Parsoid: Template-generated DISPLAYTITLE
10261 !! wikitext
10262 {{{{echo|DISPLAYTITLE}}:Foo}}
10263 !! html/parsoid
10264 <meta property="mw:PageProp/displaytitle" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DISPLAYTITLE}}:Foo"},"params":{},"i":0}}]}'/>
10265 !! end
10266
10267 !! test
10268 Namespace 1 {{ns:1}}
10269 !! wikitext
10270 {{ns:1}}
10271 !! html
10272 <p>Talk
10273 </p>
10274 !! end
10275
10276 !! test
10277 Namespace 1 {{ns:01}}
10278 !! wikitext
10279 {{ns:01}}
10280 !! html
10281 <p>Talk
10282 </p>
10283 !! end
10284
10285 !! test
10286 Namespace 0 {{ns:0}} (bug 4783)
10287 !! wikitext
10288 {{ns:0}}
10289 !! html
10290
10291 !! end
10292
10293 !! test
10294 Namespace 0 {{ns:00}} (bug 4783)
10295 !! wikitext
10296 {{ns:00}}
10297 !! html
10298
10299 !! end
10300
10301 !! test
10302 Namespace -1 {{ns:-1}}
10303 !! wikitext
10304 {{ns:-1}}
10305 !! html
10306 <p>Special
10307 </p>
10308 !! end
10309
10310 !! test
10311 Namespace User {{ns:User}}
10312 !! wikitext
10313 {{ns:User}}
10314 !! html
10315 <p>User
10316 </p>
10317 !! end
10318
10319 !! test
10320 Namespace User talk {{ns:User_talk}}
10321 !! wikitext
10322 {{ns:User_talk}}
10323 !! html
10324 <p>User talk
10325 </p>
10326 !! end
10327
10328 !! test
10329 Namespace User talk {{ns:uSeR tAlK}}
10330 !! wikitext
10331 {{ns:uSeR tAlK}}
10332 !! html
10333 <p>User talk
10334 </p>
10335 !! end
10336
10337 !! test
10338 Namespace File {{ns:File}}
10339 !! wikitext
10340 {{ns:File}}
10341 !! html
10342 <p>File
10343 </p>
10344 !! end
10345
10346 !! test
10347 Namespace File {{ns:Image}}
10348 !! wikitext
10349 {{ns:Image}}
10350 !! html
10351 <p>File
10352 </p>
10353 !! end
10354
10355 !! test
10356 Namespace (lang=de) Benutzer {{ns:User}}
10357 !! options
10358 language=de
10359 !! wikitext
10360 {{ns:User}}
10361 !! html
10362 <p>Benutzer
10363 </p>
10364 !! end
10365
10366 !! test
10367 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
10368 !! options
10369 language=de
10370 !! wikitext
10371 {{ns:3}}
10372 !! html
10373 <p>Benutzer Diskussion
10374 </p>
10375 !! end
10376
10377
10378 !! test
10379 Urlencode
10380 !! wikitext
10381 {{urlencode:hi world?!}}
10382 {{urlencode:hi world?!|WIKI}}
10383 {{urlencode:hi world?!|PATH}}
10384 {{urlencode:hi world?!|QUERY}}
10385 !! html
10386 <p>hi+world%3F%21
10387 hi_world%3F!
10388 hi%20world%3F%21
10389 hi+world%3F%21
10390 </p>
10391 !! end
10392
10393 !! test
10394 Magic Word: prioritize type info over data-parsoid
10395 !! options
10396 parsoid=html2wt
10397 !! html/parsoid
10398 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
10399 !! wikitext
10400 __FORCETOC__
10401 !! end
10402
10403 !! test
10404 Magic Word: serialize on separate line (parsoid)
10405 !! options
10406 parsoid=wt2wt,html2wt
10407 !! wikitext
10408 foo
10409 __NOTOC__
10410 bar
10411 !! html/parsoid
10412 foo<meta property="mw:PageProp/notoc"/>bar
10413 !! end
10414
10415 !! test
10416 Magic Word: rt non-english wikis
10417 !! options
10418 parsoid=wt2wt
10419 language=de
10420 !! wikitext
10421 __NOEDITSECTION__
10422 !! html/parsoid
10423 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
10424 !! end
10425
10426 !!test
10427 __proto__ is treated as normal wikitext (T105997)
10428 !!wikitext
10429 __proto__
10430 !!html
10431 <p>__proto__
10432 </p>
10433 !!end
10434
10435 ###
10436 ### Magic links
10437 ###
10438 !! test
10439 Magic links: internal link to RFC (bug 479)
10440 !! wikitext
10441 [[RFC 123]]
10442 !! html/php
10443 <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>
10444 </p>
10445 !! html/parsoid
10446 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10447 !! end
10448
10449 !! test
10450 Magic links: RFC (bug 479)
10451 !! wikitext
10452 RFC 822
10453 !! html/php
10454 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10455 </p>
10456 !! html/parsoid
10457 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10458 !! end
10459
10460 !! test
10461 Magic links: RFC (bug 65278)
10462 !! wikitext
10463 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10464 !! html/php
10465 <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.
10466 </p>
10467 !! html/parsoid
10468 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10469 !! end
10470
10471 !! test
10472 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
10473 !! wikitext
10474 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10475 RFC
10476 822
10477 !! html/php
10478 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10479 RFC
10480 822
10481 </p>
10482 !! html/parsoid
10483 <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>
10484 RFC
10485 822</p>
10486 !! end
10487
10488 !! test
10489 Magic links: ISBN (bug 1937)
10490 !! wikitext
10491 ISBN 0-306-40615-2
10492 !! html/php
10493 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10494 </p>
10495 !! html/parsoid
10496 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10497 !! end
10498
10499 !! test
10500 Magic links: ISBN (bug 65278)
10501 !! wikitext
10502 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10503 !! html/php
10504 <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.
10505 </p>
10506 !! html/parsoid
10507 <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>
10508 !! end
10509
10510 !! test
10511 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10512 !! wikitext
10513 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10514 ISBN
10515 9780316098113
10516 ISBN 978
10517 0316098113
10518 !! html/php
10519 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10520 ISBN
10521 9780316098113
10522 ISBN 978
10523 0316098113
10524 </p>
10525 !! html/parsoid
10526 <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>
10527 ISBN
10528 9780316098113
10529 ISBN 978
10530 0316098113</p>
10531 !! end
10532
10533 !! test
10534 Magic links: PMID incorrectly converts space to underscore
10535 !! wikitext
10536 PMID 1234
10537 !! html/php
10538 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10539 </p>
10540 !! html/parsoid
10541 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10542 !! end
10543
10544 !! test
10545 Magic links: PMID (bug 65278)
10546 !! wikitext
10547 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10548 !! html/php
10549 <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.
10550 </p>
10551 !! html/parsoid
10552 <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>
10553 !! end
10554
10555 !! test
10556 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10557 !! wikitext
10558 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10559 PMID
10560 1234
10561 !! html/php
10562 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10563 PMID
10564 1234
10565 </p>
10566 !! html/parsoid
10567 <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>
10568 PMID
10569 1234</p>
10570 !! end
10571
10572 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10573 # since these are ExtLinkText, not MagicLinkText
10574 !! test
10575 Magic links: use appropriate serialization for "almost" magic links.
10576 !! wikitext
10577 X[[Special:BookSources/0978739256|foo]]
10578
10579 X[//tools.ietf.org/html/rfc1234 foo]
10580 !! html/php
10581 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10582 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10583 </p>
10584 !! html/parsoid
10585 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10586 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10587 !! end
10588
10589 !! test
10590 Magic links: All disabled (T47942)
10591 !! options
10592 wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
10593 !! wikitext
10594 ISBN 0-306-40615-2
10595 PMID 1234
10596 RFC 4321
10597 !! html/php
10598 <p>ISBN 0-306-40615-2
10599 PMID 1234
10600 RFC 4321
10601 </p>
10602 !! end
10603
10604 ###
10605 ### Templates
10606 ####
10607
10608 !! test
10609 Nonexistent template
10610 !! wikitext
10611 {{thistemplatedoesnotexist}}
10612 !! html
10613 <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>
10614 </p>
10615 !! end
10616
10617 !! test
10618 Template with invalid target containing tags
10619 !! wikitext
10620 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10621 !! html
10622 <p>{{a<b>b</b>|foo|a=b|a = b}}
10623 </p>
10624 !! end
10625
10626 !! test
10627 Template with invalid target containing unclosed tag
10628 !! wikitext
10629 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10630 !! html
10631 <p>{{a<b>|foo|a=b|a = b}}</b>
10632 </p>
10633 !! end
10634
10635 !! test
10636 Template with invalid target containing wikilink
10637 !! wikitext
10638 {{[[Main Page]]}}
10639 !! html/php
10640 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10641 </p>
10642 !! html/parsoid
10643 <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>
10644 !! end
10645
10646 !! test
10647 Template with just whitespace in it, bug #68421
10648 !! wikitext
10649 {{echo|{{ }}}}
10650 !! html/parsoid
10651 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{ }}"}},"i":0}}]}'>{{ }}</p>
10652 !! end
10653
10654 !! article
10655 Template:test
10656 !! text
10657 This is a test template
10658 !! endarticle
10659
10660 !! test
10661 Simple template
10662 !! wikitext
10663 {{test}}
10664 !! html
10665 <p>This is a test template
10666 </p>
10667 !! end
10668
10669 !! test
10670 Template with explicit namespace
10671 !! wikitext
10672 {{Template:test}}
10673 !! html
10674 <p>This is a test template
10675 </p>
10676 !! end
10677
10678
10679 !! article
10680 Template:paramtest
10681 !! text
10682 This is a test template with parameter {{{param}}}
10683 !! endarticle
10684
10685 !! test
10686 Template parameter
10687 !! wikitext
10688 {{paramtest|param=foo}}
10689 !! html
10690 <p>This is a test template with parameter foo
10691 </p>
10692 !! end
10693
10694 !! article
10695 Template:paramtestnum
10696 !! text
10697 [[{{{1}}}|{{{2}}}]]
10698 !! endarticle
10699
10700 !! test
10701 Template unnamed parameter
10702 !! wikitext
10703 {{paramtestnum|Main Page|the main page}}
10704 !! html
10705 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10706 </p>
10707 !! end
10708
10709 !! article
10710 Template:templatesimple
10711 !! text
10712 (test)
10713 !! endarticle
10714
10715 !! article
10716 Template:templateredirect
10717 !! text
10718 #redirect [[Template:templatesimple]]
10719 !! endarticle
10720
10721 !! article
10722 Template:templateasargtestnum
10723 !! text
10724 {{{{{1}}}}}
10725 !! endarticle
10726
10727 !! article
10728 Template:templateasargtest
10729 !! text
10730 {{template{{{templ}}}}}
10731 !! endarticle
10732
10733 !! article
10734 Template:templateasargtest2
10735 !! text
10736 {{{{{templ}}}}}
10737 !! endarticle
10738
10739 !! test
10740 Template with template name as unnamed argument
10741 !! wikitext
10742 {{templateasargtestnum|templatesimple}}
10743 !! html
10744 <p>(test)
10745 </p>
10746 !! end
10747
10748 !! test
10749 Template with template name as argument
10750 !! wikitext
10751 {{templateasargtest|templ=simple}}
10752 !! html
10753 <p>(test)
10754 </p>
10755 !! end
10756
10757 !! test
10758 Template with template name as argument (2)
10759 !! wikitext
10760 {{templateasargtest2|templ=templatesimple}}
10761 !! html
10762 <p>(test)
10763 </p>
10764 !! end
10765
10766 !! article
10767 Template:templateasargtestdefault
10768 !! text
10769 {{{{{templ|templatesimple}}}}}
10770 !! endarticle
10771
10772 !! article
10773 Template:templa
10774 !! text
10775 '''templ'''
10776 !! endarticle
10777
10778 !! test
10779 Template with default value
10780 !! wikitext
10781 {{templateasargtestdefault}}
10782 !! html
10783 <p>(test)
10784 </p>
10785 !! end
10786
10787 !! test
10788 Template with default value (value set)
10789 !! wikitext
10790 {{templateasargtestdefault|templ=templa}}
10791 !! html
10792 <p><b>templ</b>
10793 </p>
10794 !! end
10795
10796 !! test
10797 Template redirect
10798 !! wikitext
10799 {{templateredirect}}
10800 !! html/php
10801 <p>(test)
10802 </p>
10803 !! html/parsoid
10804 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10805 !! end
10806
10807 !! test
10808 Template with argument in separate line
10809 !! wikitext
10810 {{ templateasargtest |
10811 templ = simple }}
10812 !! html
10813 <p>(test)
10814 </p>
10815 !! end
10816
10817 !! test
10818 Template with complex template as argument
10819 !! wikitext
10820 {{paramtest|
10821 param ={{ templateasargtest |
10822 templ = simple }}}}
10823 !! html
10824 <p>This is a test template with parameter (test)
10825 </p>
10826 !! end
10827
10828 !! test
10829 Template with thumb image (with link in description)
10830 !! wikitext
10831 {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10832 !! html/php
10833 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>
10834
10835 !! html+tidy
10836 <p>This is a test template with parameter</p>
10837 <div class="thumb tright">
10838 <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>
10839 <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>
10840 </div>
10841 </div>
10842 !! html/parsoid
10843 <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>
10844 !! end
10845
10846 !! article
10847 Template:complextemplate
10848 !! text
10849 {{{1}}} {{paramtest|
10850 param ={{{param}}}}}
10851 !! endarticle
10852
10853 !! test
10854 Template with complex arguments
10855 !! wikitext
10856 {{complextemplate|
10857 param ={{ templateasargtest |
10858 templ = simple }}|[[Template:complextemplate|link]]}}
10859 !! html
10860 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10861 </p>
10862 !! end
10863
10864 !! test
10865 BUG 553: link with two variables in a piped link
10866 !! wikitext
10867 {|
10868 |[[{{{1}}}|{{{2}}}]]
10869 |}
10870 !! html/php
10871 <table>
10872 <tr>
10873 <td>[[{{{1}}}|{{{2}}}]]
10874 </td></tr></table>
10875
10876 !! html/parsoid
10877 <table>
10878 <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>
10879 !! end
10880
10881 # See: T2553
10882 !! test
10883 Abort table cell attribute parsing on wikilink
10884 !! wikitext
10885 {|
10886 | testing [[one|two]] | three || four
10887 | testing one two | three || four
10888 | testing="[[one|two]]" | three || four
10889 |}
10890 !! html/php
10891 <table>
10892 <tr>
10893 <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>
10894 <td> four
10895 </td>
10896 <td> three </td>
10897 <td> four
10898 </td>
10899 <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>
10900 <td> four
10901 </td></tr></table>
10902
10903 !! html/parsoid
10904 <table>
10905 <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>
10906 <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>
10907 <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>
10908 </tbody></table>
10909 !! end
10910
10911 !! test
10912 Don't abort table cell attribute parsing if wikilink is found in template arg
10913 !! wikitext
10914 {|
10915 | Test {{#tag:ref|One two "[[three]]" four}}
10916 |}
10917 !! html/parsoid
10918 <table>
10919 <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>
10920 </tbody></table>
10921 !! end
10922
10923 !! test
10924 Magic variable as template parameter
10925 !! wikitext
10926 {{paramtest|param={{SITENAME}}}}
10927 !! html
10928 <p>This is a test template with parameter MediaWiki
10929 </p>
10930 !! end
10931
10932 !! article
10933 Template:linktest
10934 !! text
10935 [[{{{param}}}|link]]
10936 !! endarticle
10937
10938 !! test
10939 Template parameter as link source
10940 !! wikitext
10941 {{linktest|param=Main Page}}
10942 !! html
10943 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10944 </p>
10945 !! end
10946
10947 !!article
10948 Template:paramtest2
10949 !! text
10950 including another template, {{paramtest|param={{{arg}}}}}
10951 !! endarticle
10952
10953 !! test
10954 Template passing argument to another template
10955 !! wikitext
10956 {{paramtest2|arg='hmm'}}
10957 !! html
10958 <p>including another template, This is a test template with parameter 'hmm'
10959 </p>
10960 !! end
10961
10962 !! article
10963 Template:Linktest2
10964 !! text
10965 Main Page
10966 !! endarticle
10967
10968 !! test
10969 Template as link source
10970 !! wikitext
10971 [[{{linktest2}}]]
10972
10973 [[{{linktest2}}|Main Page]]
10974
10975 [[{{linktest2}}]]Page
10976 !! html
10977 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10978 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10979 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10980 </p>
10981 !! end
10982
10983
10984 !! article
10985 Template:loop1
10986 !! text
10987 {{loop2}}
10988 !! endarticle
10989
10990 !! article
10991 Template:loop2
10992 !! text
10993 {{loop1}}
10994 !! endarticle
10995
10996 !! test
10997 Template infinite loop
10998 !! wikitext
10999 {{loop1}}
11000 !! html
11001 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
11002 </p>
11003 !! end
11004
11005 !! test
11006 Template from main namespace
11007 !! wikitext
11008 {{:Main Page}}
11009 !! html
11010 <p>blah blah
11011 </p>
11012 !! end
11013
11014 !! article
11015 Template:table
11016 !! text
11017 {|
11018 | 1 || 2
11019 |-
11020 | 3 || 4
11021 |}
11022 !! endarticle
11023
11024 !! test
11025 BUG 529: Template with table, not included at beginning of line
11026 !! wikitext
11027 foo {{table}}
11028 !! html
11029 <p>foo
11030 </p>
11031 <table>
11032 <tr>
11033 <td> 1 </td>
11034 <td> 2
11035 </td></tr>
11036 <tr>
11037 <td> 3 </td>
11038 <td> 4
11039 </td></tr></table>
11040
11041 !! end
11042
11043 !! test
11044 BUG 523: Template shouldn't eat newline (or add an extra one before table)
11045 !! wikitext
11046 foo
11047 {{table}}
11048 !! html
11049 <p>foo
11050 </p>
11051 <table>
11052 <tr>
11053 <td> 1 </td>
11054 <td> 2
11055 </td></tr>
11056 <tr>
11057 <td> 3 </td>
11058 <td> 4
11059 </td></tr></table>
11060
11061 !! end
11062
11063 !! test
11064 BUG 41: Template parameters shown as broken links
11065 !! wikitext
11066 {{{parameter}}}
11067 !! html
11068 <p>{{{parameter}}}
11069 </p>
11070 !! end
11071
11072 !! test
11073 Template with targets containing wikilinks
11074 !! wikitext
11075 {{[[foo]]}}
11076
11077 {{[[{{echo|foo}}]]}}
11078
11079 {{{{echo|[[foo}}]]}}
11080 !! html
11081 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11082 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
11083 </p><p>{{[[foo}}]]
11084 </p>
11085 !! end
11086
11087 !! article
11088 Template:''
11089 !! text
11090 bar
11091 !! endarticle
11092
11093 !! test
11094 Templates: Double quotes as template target
11095 !! wikitext
11096 foo {{''}} baz
11097 !! html/php
11098 <p>foo bar baz
11099 </p>
11100 !! html/parsoid
11101 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;","href":"./Template:&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
11102 </p>
11103 !! end
11104
11105 ## This test is about making sure Parsoid's data-mw is well formed in the
11106 ## face of multiple templates with intersecting and overlapping ranges. The
11107 ## wikitext itself is wretched.
11108 !! test
11109 Templates with intersecting and overlapping ranges
11110 !! wikitext
11111 {|{{echo|
11112 <p>ha</p>}}
11113 {|{{echo|
11114 <p>ho</p>}}
11115 {{echo|{{!}}hi}}
11116 |}
11117 !! html/php+tidy
11118 <p>ha</p>
11119 <p>ho</p>
11120 <table>
11121 <tr>
11122 <td></td>
11123 </tr>
11124 <tr>
11125 <td>hi</td>
11126 </tr>
11127 </table>
11128 <table>
11129 <tr>
11130 <td></td>
11131 </tr>
11132 </table>
11133 !! html/parsoid
11134 <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":""}]]}'>
11135
11136 </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
11137
11138 <tbody><tr><td>hi</td></tr>
11139 </tbody></table>
11140 !! end
11141
11142 !! article
11143 Template:MSGNW test
11144 !! text
11145 ''None'' of '''this''' should be
11146 * interpreted
11147 but rather passed unmodified
11148 {{test}}
11149 <gallery>
11150 File:Foobar.jpg
11151 </gallery>
11152 <!-- comment -->
11153 !! endarticle
11154
11155 # hmm, fix this or just deprecate msgnw and document its behavior?
11156 !! test
11157 msgnw keyword
11158 !! wikitext
11159 {{msgnw:MSGNW test}}
11160 !! html/php
11161 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
11162 &#42; interpreted
11163 &#32;but rather passed unmodified
11164 &#123;&#123;test&#125;&#125;
11165 &#60;gallery&#62;
11166 File:Foobar.jpg
11167 &#60;/gallery&#62;
11168 &#60;!-- comment --&#62;
11169 </p>
11170 !! end
11171
11172 !! test
11173 int keyword
11174 !! wikitext
11175 {{int:youhavenewmessages|lots of money|not!}}
11176 !! html
11177 <p>You have lots of money (not!).
11178 </p>
11179 !! end
11180
11181 !! test
11182 int keyword - non-existing message
11183 !! wikitext
11184 {{int:var}}
11185 !! html
11186 <p>⧼var⧽
11187 </p>
11188 !! end
11189
11190 !! article
11191 Template:Includes
11192 !! text
11193 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11194 !! endarticle
11195
11196 !! test
11197 <includeonly> and <noinclude> being included
11198 !! wikitext
11199 {{Includes}}
11200 !! html
11201 <p>Foobar
11202 </p>
11203 !! end
11204
11205 !! article
11206 Template:Includes2
11207 !! text
11208 <onlyinclude>Foo</onlyinclude>bar
11209 !! endarticle
11210
11211 !! test
11212 <onlyinclude> being included
11213 !! wikitext
11214 {{Includes2}}
11215 !! html
11216 <p>Foo
11217 </p>
11218 !! end
11219
11220
11221 !! article
11222 Template:Includes3
11223 !! text
11224 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
11225 !! endarticle
11226
11227 !! test
11228 <onlyinclude> and <includeonly> being included
11229 !! wikitext
11230 {{Includes3}}
11231 !! html
11232 <p>Foo
11233 </p>
11234 !! end
11235
11236 !! test
11237 <includeonly> and <noinclude> on a page
11238 !! wikitext
11239 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
11240 !! html
11241 <p>Foozar
11242 </p>
11243 !! end
11244
11245 !! test
11246 Un-closed <noinclude>
11247 !! wikitext
11248 <noinclude>
11249 !! html
11250 !! end
11251
11252 !! test
11253 <onlyinclude> on a page
11254 !! wikitext
11255 <onlyinclude>Foo</onlyinclude>bar
11256 !! html
11257 <p>Foobar
11258 </p>
11259 !! end
11260
11261 !! test
11262 Un-closed <onlyinclude>
11263 !! wikitext
11264 <onlyinclude>
11265 !! html
11266 !! end
11267
11268 !!test
11269 Self-closed noinclude, includeonly, onlyinclude tags
11270 !! wikitext
11271 <noinclude />
11272 <includeonly />
11273 <onlyinclude />
11274 !! html
11275 <p><br />
11276 </p>
11277 !!end
11278
11279 !!test
11280 Unbalanced includeonly and noinclude tags
11281 !! wikitext
11282 {|
11283 |a</noinclude>
11284 |b</noinclude></noinclude>
11285 |c</noinclude></includeonly>
11286 |d</includeonly></includeonly>
11287 |}
11288 !! html
11289 <table>
11290 <tr>
11291 <td>a
11292 </td>
11293 <td>b
11294 </td>
11295 <td>c&lt;/includeonly&gt;
11296 </td>
11297 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
11298 </td></tr></table>
11299
11300 !!end
11301
11302 !! article
11303 Template:Includeonly section
11304 !! text
11305 <includeonly>
11306 ==Includeonly section==
11307 </includeonly>
11308 ==Section T-1==
11309 !!endarticle
11310
11311 !! test
11312 Bug 6563: Edit link generation for section shown by <includeonly>
11313 !! wikitext
11314 {{includeonly section}}
11315 !! html
11316 <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>
11317 <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>
11318
11319 !! end
11320
11321 # Uses same input as the contents of [[Template:Includeonly section]]
11322 !! test
11323 Bug 6563: Section extraction for section shown by <includeonly>
11324 !! options
11325 section=T-2
11326 !! wikitext
11327 <includeonly>
11328 ==Includeonly section==
11329 </includeonly>
11330 ==Section T-2==
11331 !! html
11332 ==Section T-2==
11333 !! end
11334
11335 !! test
11336 Bug 6563: Edit link generation for section suppressed by <includeonly>
11337 !! wikitext
11338 <includeonly>
11339 ==Includeonly section==
11340 </includeonly>
11341 ==Section 1==
11342 !! html
11343 <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>
11344
11345 !! end
11346
11347 !! test
11348 Bug 6563: Section extraction for section suppressed by <includeonly>
11349 !! options
11350 section=1
11351 !! wikitext
11352 <includeonly>
11353 ==Includeonly section==
11354 </includeonly>
11355 ==Section 1==
11356 !! html
11357 ==Section 1==
11358 !! end
11359
11360 !! test
11361 Un-closed <includeonly>
11362 !! wikitext
11363 <includeonly>
11364 !! html/php
11365 !! html/parsoid
11366 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
11367 !! end
11368
11369 ## We used to, but no longer wt2wt this test since the default serializer
11370 ## will normalize the include directives to serialize on their own line.
11371 ## Selser will take care of preserving formatting in scenarios where they
11372 ## intermingled with other wikitext.
11373 !! test
11374 Includes and comments at SOL
11375 !! options
11376 parsoid=wt2html,html2html
11377 !! wikitext
11378 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
11379
11380 <noinclude>
11381 some
11382 </noinclude>* stuff
11383 * here
11384
11385 <includeonly>can have stuff</includeonly>=== here ===
11386
11387 !! html/php
11388 <h2><span class="mw-headline" id="hu">hu</span></h2>
11389 <p>some
11390 </p>
11391 <ul><li> stuff</li>
11392 <li> here</li></ul>
11393 <h3><span class="mw-headline" id="here">here</span></h3>
11394
11395 !! html/parsoid
11396 <!-- 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>
11397
11398 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
11399 <p>some</p>
11400 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
11401 <li> here</li></ul>
11402
11403 <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>
11404
11405 !! end
11406
11407 # TODO: test with DOM fragment reuse!
11408 !! test
11409 Parsoid: DOM fragment reuse
11410 !! options
11411 parsoid=wt2wt,wt2html
11412 !! wikitext
11413 a{{echo|b<table></table>c}}d
11414
11415 a{{echo|b
11416 <table></table>
11417 c}}d
11418
11419 {{echo|a
11420
11421 <table></table>
11422
11423 b}}
11424 !! html
11425 <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>
11426
11427 <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">
11428 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
11429 </span><p about="#mwt2">cd</p>
11430
11431 <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">
11432
11433 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
11434
11435 </span><p about="#mwt3">b</p>
11436 !! end
11437
11438 !! test
11439 Parsoid: Merge double tds (T52603)
11440 !! options
11441 parsoid
11442 !! wikitext
11443 {|
11444 |{{echo|{{!}} foo}}
11445 |}
11446 !! html
11447 <table><tbody>
11448 <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>
11449 </tbody></table>
11450 !! end
11451
11452 !! test
11453 Parsoid: Merge double tds in nested transclusion content (T52603)
11454 !! options
11455 parsoid
11456 !! wikitext
11457 {{echo|<div>}}
11458 {|
11459 |{{echo|{{!}} foo}}
11460 |}
11461 {{echo|</div>}}
11462 !! html
11463 <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}}]}'>
11464 <table><tbody>
11465 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
11466 </tbody></table>
11467 </div>
11468 !! end
11469
11470 ###
11471 ### <includeonly> and <noinclude> in attributes
11472 ###
11473 !!test
11474 0. includeonly around the entire attribute
11475 !! wikitext
11476 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
11477 !! html
11478 <p><span id="v2">bar</span>
11479 </p>
11480 !!end
11481
11482 !!test
11483 1. includeonly in html attr key
11484 !! wikitext
11485 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11486 !! html
11487 <p><span id="foo">bar</span>
11488 </p>
11489 !!end
11490
11491 !!test
11492 2. includeonly in html attr value
11493 !! wikitext
11494 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11495 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11496 !! html
11497 <p><span id="v1">bar</span>
11498 <span id="v1">bar</span>
11499 </p>
11500 !!end
11501
11502 !!test
11503 3. includeonly in part of an attr value
11504 !! wikitext
11505 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11506 !! html
11507 <p><span style="color:red;">bar</span>
11508 </p>
11509 !!end
11510
11511 !!test
11512 4. includeonly in table attributes
11513 !! wikitext
11514 {|
11515 |- <noinclude>
11516 |-
11517 |a
11518 </noinclude>
11519 |- <includeonly>
11520 |-
11521 |b
11522 </includeonly>
11523 |}
11524 !! html
11525 <table>
11526
11527
11528 <tr>
11529 <td>a
11530 </td></tr>
11531 </table>
11532
11533 !!end
11534
11535 ###
11536 ### Token Stream Patcher tests
11537 ###
11538 ### These tests won't always pass wt2wt and other modes because
11539 ### on serialization, the table will be output on a new line.
11540 ### For now, we are blacklisting them, and using this to test selser.
11541 ###
11542
11543 !!test
11544 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11545 !!options
11546 parsoid=wt2html,wt2wt
11547 !!wikitext
11548 {{echo|}}{| width = '100%'
11549 |foo
11550 |}
11551 !!html/parsoid
11552 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11553 <tbody><tr><td>foo</td></tr>
11554 </tbody></table>
11555 !!end
11556
11557 ## We used to, but no longer wt2wt this test since the default serializer
11558 ## will normalize the include directives to serialize on their own line.
11559 ## Selser will take care of preserving formatting in scenarios where they
11560 ## intermingled with other wikitext.
11561 !!test
11562 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11563 !!options
11564 parsoid=wt2html
11565 !!wikitext
11566 <includeonly>a</includeonly>{| {{{b}}}
11567 |c
11568 |}
11569 !!html/parsoid
11570 <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>a&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><table about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"a":{"{{{b}}}":null},"sa":{"{{{b}}}":""}}' data-mw='{"attribs":[[{"txt":"{{{b}}}","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=&#39;{\"dsr\":[31,38,null,null],\"src\":\"{{{b}}}\"}&#39;>{{{b}}}&lt;/span>"},{"html":""}]]}'>
11571 <tbody><tr><td>c</td></tr>
11572 </tbody></table>
11573 !!end
11574
11575 !! test
11576 Table wikitext syntax outside wiki-tables
11577 !! wikitext
11578 a
11579 |+ not a caption
11580 ! not a table heading
11581 |- not a table row
11582 | not a table cell
11583 | class="foo bar" | baz
11584 b
11585 |}
11586 |-
11587 c
11588 !! html
11589 <p>a
11590 |+ not a caption
11591 ! not a table heading
11592 |- not a table row
11593 | not a table cell
11594 | class="foo bar" | baz
11595 b
11596 |}
11597 |-
11598 c
11599 </p>
11600 !! end
11601
11602 ###
11603 ### Testing parsing of templates where a template arg
11604 ### has the same name as the template itself.
11605 ###
11606
11607 !! article
11608 Template:quote
11609 !! text
11610 {{{quote|{{{1}}}}}}
11611 !! endarticle
11612
11613 !!test
11614 Templates: Template Name/Arg clash: 1. Use of positional param
11615 !! wikitext
11616 {{quote|foo}}
11617 !! html
11618 <p>foo
11619 </p>
11620 !!end
11621
11622 !!test
11623 Templates: Template Name/Arg clash: 2. Use of named param
11624 !! wikitext
11625 {{quote|quote=foo}}
11626 !! html
11627 <p>foo
11628 </p>
11629 !!end
11630
11631 !!test
11632 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11633 !! wikitext
11634 {{quote|quote}}
11635 !! html
11636 <p>quote
11637 </p>
11638 !!end
11639
11640 ###
11641 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11642 ###
11643
11644 !!test
11645 Templates: 1. Simple use
11646 !! wikitext
11647 {{echo|Foo}}
11648 !! html
11649 <p>Foo
11650 </p>
11651 !!end
11652
11653 !!test
11654 Templates: 2. Inside a block tag
11655 !! wikitext
11656 <div>{{echo|Foo}}</div>
11657 <blockquote>{{echo|Foo}}</blockquote>
11658 !! html
11659 <div>Foo</div>
11660 <blockquote>Foo</blockquote>
11661
11662 !! html+tidy
11663 <div>Foo</div>
11664 <blockquote>
11665 <p>Foo</p>
11666 </blockquote>
11667 !!end
11668
11669 !!test
11670 Templates: P-wrapping: 1a. Templates on consecutive lines
11671 !! wikitext
11672 {{echo|Foo}}
11673 {{echo|bar}}
11674 !! html
11675 <p>Foo
11676 bar
11677 </p>
11678 !!end
11679
11680 !!test
11681 Templates: P-wrapping: 1b. Templates on consecutive lines
11682 !! wikitext
11683 Foo
11684
11685 {{echo|bar}}
11686 {{echo|baz}}
11687 !! html
11688 <p>Foo
11689 </p><p>bar
11690 baz
11691 </p>
11692 !!end
11693
11694 !!test
11695 Templates: P-wrapping: 1c. Templates on consecutive lines
11696 !! wikitext
11697 {{echo|Foo}}
11698 {{echo|bar}} <div>baz</div>
11699 !! html
11700 <p>Foo
11701 </p>
11702 bar <div>baz</div>
11703
11704 !! html+tidy
11705 <p>Foo</p>
11706 <p>bar</p>
11707 <div>baz</div>
11708 !! end
11709
11710 !!test
11711 Templates: P-wrapping: 1d. Template preceded by comment-only line
11712 !!options
11713 parsoid
11714 !! wikitext
11715 <!-- foo -->
11716 {{echo|Bar}}
11717 !! html
11718 <!-- foo -->
11719
11720 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11721 !!end
11722
11723 !!test
11724 Templates: Inline Text: 1. Multiple template uses
11725 !! wikitext
11726 {{echo|Foo}}bar{{echo|baz}}
11727 !! html
11728 <p>Foobarbaz
11729 </p>
11730 !!end
11731
11732 !!test
11733 Templates: Inline Text: 2. Back-to-back template uses
11734 !! wikitext
11735 {{echo|Foo}}{{echo|bar}}
11736 !! html
11737 <p>Foobar
11738 </p>
11739 !!end
11740
11741 !!test
11742 Templates: Block Tags: 1. Multiple template uses
11743 !! wikitext
11744 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11745 !! html
11746 <div>Foo</div><div>bar</div><div>baz</div>
11747
11748 !!end
11749
11750 !!test
11751 Templates: Block Tags: 2. Back-to-back template uses
11752 !! wikitext
11753 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11754 !! html
11755 <div>Foo</div><div>bar</div>
11756
11757 !!end
11758
11759 # This is an edge case relating to paragraph wrapping.
11760 !!test
11761 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11762 !! wikitext
11763 {{echo|a
11764 b</p>}}
11765 !! html/parsoid
11766 <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
11767 b</p>
11768 !!end
11769
11770 !!test
11771 Templates: Links: 1. Simple example
11772 !! wikitext
11773 {{echo|[[Foo|bar]]}}
11774 !! html
11775 <p><a href="/wiki/Foo" title="Foo">bar</a>
11776 </p>
11777 !!end
11778
11779 !!test
11780 Templates: Links: 2. Generation of link href
11781 !! wikitext
11782 [[{{echo|Foo}}|bar]]
11783 !! html
11784 <p><a href="/wiki/Foo" title="Foo">bar</a>
11785 </p>
11786 !!end
11787
11788 !!test
11789 Templates: Links: 3. Generation of part of a link href
11790 !! wikitext
11791 [[Fo{{echo|o}}|bar]]
11792
11793 [[Foo{{echo|bar}}]]
11794
11795 [[Foo{{echo|bar}}baz]]
11796
11797 [[Foo{{echo|bar}}|bar]]
11798
11799 [[:Foo{{echo|bar}}]]
11800
11801 [[:Foo{{echo|bar}}|bar]]
11802 !! html
11803 <p><a href="/wiki/Foo" title="Foo">bar</a>
11804 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11805 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11806 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11807 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11808 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11809 </p>
11810 !!end
11811
11812 !!test
11813 Templates: Links: 4. Multiple templates generating link href
11814 !! wikitext
11815 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11816 !! html
11817 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11818 </p>
11819 !!end
11820
11821 !!test
11822 Templates: Links: 5. Generation of link text
11823 !! wikitext
11824 [[Foo|{{echo|bar}}]]
11825 !! html
11826 <p><a href="/wiki/Foo" title="Foo">bar</a>
11827 </p>
11828 !!end
11829
11830 !!test
11831 Templates: Links: 5. Nested templates (only outermost template should be marked)
11832 !! wikitext
11833 {{echo|[[{{echo|Foo}}|bar]]}}
11834 !! html
11835 <p><a href="/wiki/Foo" title="Foo">bar</a>
11836 </p>
11837 !!end
11838
11839 !!test
11840 Templates: HTML Tag: 1. Generation of HTML attr. key
11841 !! wikitext
11842 <div {{echo|style}}="color:red;">foo</div>
11843 !! html
11844 <div style="color:red;">foo</div>
11845
11846 !!end
11847
11848 !!test
11849 Templates: HTML Tag: 2. Generation of HTML attr. value
11850 !! wikitext
11851 <div style={{echo|'color:red;'}}>foo</div>
11852 !! html
11853 <div style="color:red;">foo</div>
11854
11855 !!end
11856
11857 !!test
11858 Templates: HTML Tag: 3. Generation of HTML attr key and value
11859 !! wikitext
11860 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11861 !! html
11862 <div style="color:red;">foo</div>
11863
11864 !!end
11865
11866 !!test
11867 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11868 !! wikitext
11869 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11870 !! html
11871 <div title="This is a long title with just one piece templated">foo</div>
11872
11873 !!end
11874
11875 !!test
11876 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11877 !! wikitext
11878 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11879 !! html
11880 <div title="This is a long title with just one piece templated">foo</div>
11881
11882 !!end
11883
11884 !!test
11885 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11886 !! wikitext
11887 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11888 !! html
11889 <div title="This is a long title with just one piece templated">foo</div>
11890
11891 !!end
11892
11893 # SSS FIXME: While it is great we added support for all this,
11894 # do we want to make this part of the spec? Maybe we want to
11895 # deprecate this kind of usage in the future?
11896 !!test
11897 Templates: HTML Tag: 7. Generation of partial attribute key string
11898 !! wikitext
11899 <div st{{echo|yle}}="color:red;">foo</div>
11900 !! html
11901 <div style="color:red;">foo</div>
11902
11903 !!end
11904
11905 !! test
11906 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11907 !! wikitext
11908 <div {{echo|1=id="v1"}}>bar</div>
11909 !! html
11910 <div id="v1">bar</div>
11911
11912 !!end
11913
11914 !! test
11915 Templates: HTML Tag: 9. Multiple template-generated attributes
11916 !! wikitext
11917 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11918 !! html
11919 <div id="v1" title="foo">bar</div>
11920
11921 !!end
11922
11923 !! test
11924 Templates: Support for templates generating attributes and content
11925 !! wikitext
11926 {| {{mixed_attr_content_template}}
11927 |-
11928 |bar
11929 |}
11930 !! html/php
11931 <table style="color:red;" title="T48811">
11932
11933 <tr>
11934 <td>foo
11935 </td></tr>
11936 <tr>
11937 <td>bar
11938 </td></tr></table>
11939
11940 !! html/parsoid
11941 <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|}"]}'>
11942 <tbody><tr>
11943 <td>foo</td></tr>
11944 <tr>
11945 <td>bar</td></tr>
11946 </tbody></table>
11947 !!end
11948
11949 !! test
11950 1. Entities and nowikis inside templated attributes should be handled correctly
11951 !! wikitext
11952 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11953 !! html/php
11954 <div style="background:#f9f9f9;">foo</div>
11955
11956 !! html/parsoid
11957 <div style="background:#f9f9f9;" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html"}' data-mw='{"attribs":[[{"txt":"style","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[5,49,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"style{{=}}\\\"background:&amp;amp;#35;f9f9f9;\\\"\"}},\"i\":0}}]}&#39;>style&lt;/span>&lt;span typeof=\"mw:Nowiki\" about=\"#mwt1\" data-parsoid=\"{}\">=&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">\"background:&lt;/span>&lt;span typeof=\"mw:Entity\" about=\"#mwt1\" data-parsoid=&#39;{\"src\":\"&amp;amp;#35;\",\"srcContent\":\"#\"}&#39;>#&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">f9f9f9;\"&lt;/span>"},{"html":""}]]}'>foo</div>
11958 !! end
11959
11960 !! test
11961 2. Entities and nowikis inside templated attributes should be handled correctly
11962 !! wikitext
11963 {|
11964 |{{table_attribs_3}}
11965 |}
11966 !! html/php
11967 <table>
11968 <tr>
11969 <td style="background:#f9f9f9;">Foo
11970 </td></tr></table>
11971
11972 !! html/parsoid
11973 <table>
11974 <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>
11975 </tbody></table>
11976 !! end
11977
11978 !! test
11979 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11980 !! wikitext
11981 {{tbl-start}}
11982 |{{table_attribs_3}}
11983 {{tbl-end}}
11984 !! html/php
11985 <table>
11986 <tr>
11987 <td style="background:#f9f9f9;">Foo
11988 </td></tr></table>
11989
11990 !! html/parsoid
11991 <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}}]}'>
11992 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11993 </tbody></table>
11994 !! end
11995
11996 # T107622
11997 !! test
11998 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11999 !! wikitext
12000 {|
12001 | {{table_attribs_6}} hi
12002 |}
12003 !! html/php
12004 <table>
12005 <tr>
12006 <td style="background: red;"> hi
12007 </td></tr></table>
12008
12009 !! html/parsoid
12010 <table>
12011 <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>
12012 </tbody></table>
12013 !! end
12014
12015 !!test
12016 Templates: HTML Tables: 1. Generating start of a HTML table
12017 !! wikitext
12018 {{echo|<table><tr><td>foo</td>}}</tr></table>
12019 !! html
12020 <table><tr><td>foo</td></tr></table>
12021
12022 !!end
12023
12024 !!test
12025 Templates: HTML Tables: 2a. Generating middle of a HTML table
12026 !! wikitext
12027 <table><tr>{{echo|<td>foo</td>}}</tr></table>
12028 !! html
12029 <table><tr><td>foo</td></tr></table>
12030
12031 !!end
12032
12033 !!test
12034 Templates: HTML Tables: 2b. Generating middle of a HTML table
12035 !! wikitext
12036 <table>{{echo|<tr><td>foo</td></tr>}}</table>
12037 !! html
12038 <table><tr><td>foo</td></tr></table>
12039
12040 !!end
12041
12042 !!test
12043 Templates: HTML Tables: 3. Generating end of a HTML table
12044 !! wikitext
12045 <table><tr>{{echo|<td>foo</td></tr></table>}}
12046 !! html
12047 <table><tr><td>foo</td></tr></table>
12048
12049 !!end
12050
12051 !!test
12052 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
12053 !! wikitext
12054 {{echo|<table>}}<tr><td>foo</td></tr></table>
12055 !! html
12056 <table><tr><td>foo</td></tr></table>
12057
12058 !!end
12059
12060 !!test
12061 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
12062 !! wikitext
12063 <table>{{echo|<tr>}}<td>foo</td></tr></table>
12064 !! html
12065 <table><tr><td>foo</td></tr></table>
12066
12067 !!end
12068
12069 !!test
12070 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
12071 !! wikitext
12072 <table><tr>{{echo|<td>}}foo</td></tr></table>
12073 !! html
12074 <table><tr><td>foo</td></tr></table>
12075
12076 !!end
12077
12078 !!test
12079 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
12080 !! wikitext
12081 <table><tr><td>foo{{echo|</td>}}</tr></table>
12082 !! html
12083 <table><tr><td>foo</td></tr></table>
12084
12085 !!end
12086
12087 !!test
12088 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
12089 !! wikitext
12090 <table><tr><td>foo</td>{{echo|</tr>}}</table>
12091 !! html
12092 <table><tr><td>foo</td></tr></table>
12093
12094 !!end
12095
12096 !!test
12097 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
12098 !! wikitext
12099 <table><tr><td>foo</td></tr>{{echo|</table>}}
12100 !! html
12101 <table><tr><td>foo</td></tr></table>
12102
12103 !!end
12104
12105 !!test
12106 Templates: HTML Tables: 5. Proper fostering of categories from inside
12107 !!options
12108 parsoid=wt2html,wt2wt
12109 !! wikitext
12110 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
12111 <!--Two categories (Bug 50330)-->
12112 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
12113 !! html
12114 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
12115 <!--Two categories (Bug 50330)-->
12116 <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>
12117 !!end
12118
12119 !!test
12120 Templates: Wiki Tables: 1a. Fostering of entire template content
12121 !! wikitext
12122 {|
12123 {{echo|a}}
12124 |}
12125 !! html
12126 <table>
12127 a
12128 <tr><td></td></tr></table>
12129
12130 !! html+tidy
12131 <p>a</p>
12132 <table>
12133 <tr>
12134 <td></td>
12135 </tr>
12136 </table>
12137 !! end
12138
12139 !!test
12140 Templates: Wiki Tables: 1b. Fostering of entire template content
12141 !! wikitext
12142 {|
12143 {{echo|<div>}}
12144 foo
12145 {{echo|</div>}}
12146 |}
12147 !! html
12148 <table>
12149 <div>
12150 <p>foo
12151 </p>
12152 </div>
12153 <tr><td></td></tr></table>
12154
12155 !! html+tidy
12156 <div>
12157 <p>foo</p>
12158 </div>
12159 <table>
12160 <tr>
12161 <td></td>
12162 </tr>
12163 </table>
12164 !! end
12165
12166 !!test
12167 Templates: Wiki Tables: 2. Fostering of partial template content
12168 !! wikitext
12169 {|
12170 {{echo|a
12171 <div>b</div>}}
12172 |}
12173 !! html
12174 <table>
12175 a
12176 <div>b</div>
12177 <tr><td></td></tr></table>
12178
12179 !! html+tidy
12180 <p>a</p>
12181 <div>b</div>
12182 <table>
12183 <tr>
12184 <td></td>
12185 </tr>
12186 </table>
12187 !! end
12188
12189 !!test
12190 Templates: Wiki Tables: 3. td-content via multiple templates
12191 !! wikitext
12192 {|
12193 {{echo|{{pipe}}a}}{{echo|b}}
12194 |}
12195 !! html
12196 <table>
12197 <tr>
12198 <td>ab
12199 </td></tr></table>
12200
12201 !!end
12202
12203 !!test
12204 Templates: Wiki Tables: 4. Templated tags, no content
12205 !! wikitext
12206 {{tbl-start}}
12207 {{tbl-end}}
12208 !! html
12209 <table>
12210 <tr><td></td></tr></table>
12211
12212 !!end
12213
12214 !!test
12215 Templates: Wiki Tables: 5. Templated tags, regular td-tags
12216 !! wikitext
12217 {{tbl-start}}
12218 |foo
12219 {{tbl-end}}
12220 !! html
12221 <table>
12222 <tr>
12223 <td>foo
12224 </td></tr></table>
12225
12226 !!end
12227
12228 !!test
12229 Templates: Wiki Tables: 6. Templated tags, templated td-tags
12230 !! wikitext
12231 {{tbl-start}}
12232 {{!}}foo
12233 {{tbl-end}}
12234 !! html
12235 <table>
12236 <tr>
12237 <td>foo
12238 </td></tr></table>
12239
12240 !!end
12241
12242 ## This test case is very specific to Parsoid's internals
12243 ## and is hence only tested for Parsoid's code. Parsoid uses
12244 ## a <meta> marker tag for <ref> tags and they are expanded
12245 ## much later. We are verifying that this <meta> tag usage
12246 ## doesn't prevent foster parenting.
12247 !!test
12248 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
12249 !!wikitext
12250 {{PartialTable}}<ref>foo</ref>
12251 |}
12252
12253 <references />
12254 !!html/parsoid
12255 <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">
12256 <tbody>
12257 </tbody></table>
12258
12259 <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>
12260 !!end
12261
12262 !! test
12263 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
12264 !! wikitext
12265 {{echo|
12266 {{{!}}
12267 {{!}}-}}
12268 <onlyinclude>
12269 |foo
12270 </onlyinclude>
12271 {{!}}}
12272 !! html/parsoid
12273 <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{{!}}}"]}'>
12274 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
12275 <tbody><tr>
12276
12277 <td>foo
12278 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
12279 </tbody></table>
12280 !! end
12281
12282 !!test
12283 Templates: Lists: Multi-line list-items via templates
12284 !! wikitext
12285 *{{echo|a {{nonexistent|
12286 unused}}}}
12287 *{{echo|b {{nonexistent|
12288 unused}}}}
12289 !! html
12290 <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>
12291 <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>
12292
12293 !!end
12294
12295 !!test
12296 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
12297 !! wikitext
12298 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
12299 !! html
12300 <p><i>ab</i>c<i>d</i>e
12301 </p>
12302 !!end
12303
12304 !!test
12305 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
12306 (PHP parser generates misnested html)
12307 !! wikitext
12308 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
12309 !! html/parsoid
12310 <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>
12311 !!end
12312
12313 !!test
12314 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
12315 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
12316 !! options
12317 parsoid=wt2html,wt2wt
12318 !! wikitext
12319 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
12320 !! html
12321 <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>
12322 <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>
12323 <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>
12324 !!end
12325
12326 !!test
12327 Templates: Ugly nesting: 4. Divs opened/closed across templates
12328 !! wikitext
12329 a<div>b{{echo|c</div>d}}e
12330 !! html
12331 a<div>bc</div>de
12332
12333 !! html+tidy
12334 <p>a</p>
12335 <div>bc</div>
12336 <p>de</p>
12337 !! end
12338
12339 !!test
12340 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
12341 (Parsoid-centric)
12342 !! options
12343 parsoid
12344 !! wikitext
12345 {|
12346 |{{echo|foo</table>}}
12347 |bar
12348 |}
12349 !! html
12350 <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|}"]}'>
12351
12352 <tbody>
12353 <tr>
12354 <td>foo</td></tr></tbody></table><span about="#mwt1">
12355 </span><span about="#mwt1">|bar</span><span about="#mwt1">
12356 |}</span>
12357 !!end
12358
12359 !!test
12360 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
12361 (Parsoid-centric)
12362 !! options
12363 parsoid
12364 !! wikitext
12365 <table>
12366 <tr>
12367 <td>
12368 <table>
12369 <tr>
12370 <td>1. {{echo|foo </table>}}</td>
12371 <td> bar </td>
12372 <td>2. {{echo|baz </table>}}</td>
12373 </tr>
12374 <tr>
12375 <td>abc</td>
12376 </tr>
12377 </table>
12378 </td>
12379 </tr>
12380 <tr>
12381 <td>xyz</td>
12382 </tr>
12383 </table>
12384 !! html
12385 <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>"]}'>
12386 <tbody><tr>
12387 <td>
12388 <table>
12389 <tbody><tr>
12390 <td>1. foo </td></tr></tbody></table></td>
12391 <td> bar </td>
12392 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
12393 </span><span about="#mwt2">
12394 </span><span about="#mwt2">
12395 </span><span about="#mwt2">abc</span><span about="#mwt2">
12396 </span><span about="#mwt2">
12397 </span><span about="#mwt2">
12398 </span><span about="#mwt2">
12399 </span><span about="#mwt2">
12400 </span><span about="#mwt2">
12401 </span><span about="#mwt2">xyz</span><span about="#mwt2">
12402 </span><span about="#mwt2">
12403 </span>
12404 !!end
12405
12406 !! test
12407 Templates: Ugly templates: 3. newline-only template parameter
12408 !! wikitext
12409 foo {{echo|
12410 }}
12411 !! html
12412 <p>foo
12413 </p>
12414 !! end
12415
12416 # This looks like a bug: a single newline triggers p/br for some reason.
12417 !! test
12418 Templates: Ugly templates: 4. newline-only template parameter inconsistency
12419 !! wikitext
12420 {{echo|
12421 }}
12422 !! html
12423 <p><br />
12424 </p>
12425 !! end
12426
12427 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
12428 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
12429 !! test
12430 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
12431 !! wikitext
12432 {{echo|<table>}}
12433 {{echo|<div>foo}}
12434 {{echo|</table>}}
12435 !! html/parsoid
12436 <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
12437 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12438 </table>
12439 !! end
12440
12441 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
12442 # that are "identical" and generate nesting cycles in the algorithm
12443 !! test
12444 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
12445 !! wikitext
12446 {{echo|<table><tr><td><table>}}
12447 {{echo|<div>}}
12448 {{echo|</div>}}
12449 !! html/parsoid
12450 <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"}'>
12451 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
12452 </table></td></tr></tbody></table>
12453 !! end
12454
12455 !! test
12456 Templates: Parameters substituted at the top-level
12457 !! wikitext
12458 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
12459 !! html/php
12460 <p><i>who</i> me? <b>never!</b>
12461 </p>
12462 !! html/parsoid
12463 <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>
12464 !! end
12465
12466 !!test
12467 Parser Functions: 1. Simple example
12468 !! wikitext
12469 {{uc:foo}}
12470 !! html
12471 <p>FOO
12472 </p>
12473 !!end
12474
12475 !!test
12476 Parser Functions: 2. Nested use (only outermost should be marked up)
12477 !! wikitext
12478 {{uc:{{lc:FOO}}}}
12479 !! html
12480 <p>FOO
12481 </p>
12482 !!end
12483
12484 ###
12485 ### Pre-save transform tests
12486 ###
12487 !! test
12488 pre-save transform: subst:
12489 !! options
12490 pst
12491 !! wikitext
12492 {{subst:test}}
12493 !! html/php
12494 This is a test template
12495 !! end
12496
12497 !! test
12498 pre-save transform: normal template
12499 !! options
12500 pst
12501 !! wikitext
12502 {{test}}
12503 !! html/php
12504 {{test}}
12505 !! end
12506
12507 !! test
12508 pre-save transform: nonexistent template
12509 !! options
12510 pst
12511 !! wikitext
12512 {{thistemplatedoesnotexist}}
12513 !! html/php
12514 {{thistemplatedoesnotexist}}
12515 !! end
12516
12517 !! test
12518 pre-save transform: subst magic variables
12519 !! options
12520 pst
12521 !! wikitext
12522 {{subst:SITENAME}}
12523 !! html/php
12524 MediaWiki
12525 !! end
12526
12527 # This is bug 89, which I fixed. -- wtm
12528 !! test
12529 pre-save transform: subst: templates with parameters
12530 !! options
12531 pst
12532 !! wikitext
12533 {{subst:paramtest|param="something else"}}
12534 !! html/php
12535 This is a test template with parameter "something else"
12536 !! end
12537
12538 !! article
12539 Template:nowikitest
12540 !! text
12541 <nowiki>'''not wiki'''</nowiki>
12542 !! endarticle
12543
12544 !! test
12545 pre-save transform: nowiki in subst (bug 1188)
12546 !! options
12547 pst
12548 !! wikitext
12549 {{subst:nowikitest}}
12550 !! html/php
12551 <nowiki>'''not wiki'''</nowiki>
12552 !! end
12553
12554 !! article
12555 Template:commenttest
12556 !! text
12557 This template has <!-- a comment --> in it.
12558 !! endarticle
12559
12560 !! test
12561 pre-save transform: comment in subst (bug 1936)
12562 !! options
12563 pst
12564 !! wikitext
12565 {{subst:commenttest}}
12566 !! html/php
12567 This template has <!-- a comment --> in it.
12568 !! end
12569
12570 !! test
12571 pre-save transform: unclosed tag
12572 !! options
12573 pst
12574 !! wikitext
12575 <nowiki>'''not wiki'''
12576 !! html/php
12577 <nowiki>'''not wiki'''
12578 !! end
12579
12580 !! test
12581 pre-save transform: mixed tag case
12582 !! options
12583 pst
12584 !! wikitext
12585 <NOwiki>'''not wiki'''</noWIKI>
12586 !! html/php
12587 <NOwiki>'''not wiki'''</noWIKI>
12588 !! end
12589
12590 !! test
12591 pre-save transform: unclosed comment in <nowiki>
12592 !! options
12593 pst
12594 !! wikitext
12595 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12596 !! html/php
12597 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12598 !!end
12599
12600 # Leading @ in this template definition works around a limitation
12601 # in parsoid's parserTests which otherwise strips the <span> from the
12602 # result (confusing it for a template wrapper)
12603 !! article
12604 Template:dangerous
12605 !!text
12606 @<span onmouseover="alert('crap')">Oh no</span>
12607 !!endarticle
12608
12609 !!test
12610 (confirming safety of fix for subst bug 1936)
12611 !! wikitext
12612 {{Template:dangerous}}
12613 !! html
12614 <p>@<span>Oh no</span>
12615 </p>
12616 !! end
12617
12618 !! test
12619 pre-save transform: comment containing gallery (bug 5024)
12620 !! options
12621 pst
12622 !! wikitext
12623 <!-- <gallery>data</gallery> -->
12624 !! html/php
12625 <!-- <gallery>data</gallery> -->
12626 !!end
12627
12628 !! test
12629 pre-save transform: comment containing extension
12630 !! options
12631 pst
12632 !! wikitext
12633 <!-- <tag>data</tag> -->
12634 !! html/php
12635 <!-- <tag>data</tag> -->
12636 !!end
12637
12638 !! test
12639 pre-save transform: comment containing nowiki
12640 !! options
12641 pst
12642 !! wikitext
12643 <!-- <nowiki>data</nowiki> -->
12644 !! html/php
12645 <!-- <nowiki>data</nowiki> -->
12646 !!end
12647
12648 !! test
12649 pre-save transform: <noinclude> in subst (bug 3298)
12650 !! options
12651 pst
12652 !! wikitext
12653 {{subst:Includes}}
12654 !! html/php
12655 Foobar
12656 !! end
12657
12658 !! test
12659 pre-save transform: <onlyinclude> in subst (bug 3298)
12660 !! options
12661 pst
12662 !! wikitext
12663 {{subst:Includes2}}
12664 !! html/php
12665 Foo
12666 !! end
12667
12668 !! article
12669 Template:SubstTest
12670 !!text
12671 {{<includeonly>subst:</includeonly>Includes}}
12672 !! endarticle
12673
12674 !! article
12675 Template:SafeSubstTest
12676 !! text
12677 {{<includeonly>safesubst:</includeonly>Includes}}
12678 !! endarticle
12679
12680 !! test
12681 bug 22297: safesubst: works during PST
12682 !! options
12683 pst
12684 !! wikitext
12685 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12686 !! html/php
12687 FoobarFoobar
12688 !! end
12689
12690 !! test
12691 bug 22297: safesubst: works during normal parse
12692 !! wikitext
12693 {{SafeSubstTest}}
12694 !! html
12695 <p>Foobar
12696 </p>
12697 !! end
12698
12699 !! test
12700 subst: does not work during normal parse
12701 !! wikitext
12702 {{SubstTest}}
12703 !! html
12704 <p>{{subst:Includes}}
12705 </p>
12706 !! end
12707
12708 !! test
12709 pre-save transform: context links ("pipe trick")
12710 !! options
12711 pst
12712 !! wikitext
12713 [[Article (context)|]]
12714 [[Bar:Article|]]
12715 [[:Bar:Article|]]
12716 [[Bar:Article (context)|]]
12717 [[:Bar:Article (context)|]]
12718 [[|Article]]
12719 [[|Article (context)]]
12720 [[Bar:X (Y) Z|]]
12721 [[:Bar:X (Y) Z|]]
12722 !! html/php
12723 [[Article (context)|Article]]
12724 [[Bar:Article|Article]]
12725 [[:Bar:Article|Article]]
12726 [[Bar:Article (context)|Article]]
12727 [[:Bar:Article (context)|Article]]
12728 [[Article]]
12729 [[Article (context)]]
12730 [[Bar:X (Y) Z|X (Y) Z]]
12731 [[:Bar:X (Y) Z|X (Y) Z]]
12732 !! end
12733
12734 !! test
12735 pre-save transform: context links ("pipe trick") with interwiki prefix
12736 !! options
12737 pst
12738 !! wikitext
12739 [[interwiki:Article|]]
12740 [[:interwiki:Article|]]
12741 [[interwiki:Bar:Article|]]
12742 [[:interwiki:Bar:Article|]]
12743 !! html/php
12744 [[interwiki:Article|Article]]
12745 [[:interwiki:Article|Article]]
12746 [[interwiki:Bar:Article|Bar:Article]]
12747 [[:interwiki:Bar:Article|Bar:Article]]
12748 !! end
12749
12750 !! test
12751 pre-save transform: context links ("pipe trick") with parens in title
12752 !! options
12753 pst title=[[Somearticle (context)]]
12754 !! wikitext
12755 [[|Article]]
12756 !! html/php
12757 [[Article (context)|Article]]
12758 !! end
12759
12760 !! test
12761 pre-save transform: context links ("pipe trick") with comma in title
12762 !! options
12763 pst title=[[Someplace, Somewhere]]
12764 !! wikitext
12765 [[|Otherplace]]
12766 [[Otherplace, Elsewhere|]]
12767 [[Otherplace, Elsewhere, Anywhere|]]
12768 !! html/php
12769 [[Otherplace, Somewhere|Otherplace]]
12770 [[Otherplace, Elsewhere|Otherplace]]
12771 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12772 !! end
12773
12774 !! test
12775 pre-save transform: context links ("pipe trick") with parens and comma
12776 !! options
12777 pst title=[[Someplace (IGNORED), Somewhere]]
12778 !! wikitext
12779 [[|Otherplace]]
12780 [[Otherplace (place), Elsewhere|]]
12781 !! html/php
12782 [[Otherplace, Somewhere|Otherplace]]
12783 [[Otherplace (place), Elsewhere|Otherplace]]
12784 !! end
12785
12786 !! test
12787 pre-save transform: context links ("pipe trick") with comma and parens
12788 !! options
12789 pst title=[[Who, me? (context)]]
12790 !! wikitext
12791 [[|Yes, you.]]
12792 [[Me, Myself, and I (1937 song)|]]
12793 !! html/php
12794 [[Yes, you. (context)|Yes, you.]]
12795 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12796 !! end
12797
12798 !! test
12799 pre-save transform: context links ("pipe trick") with namespace
12800 !! options
12801 pst title=[[Ns:Somearticle]]
12802 !! wikitext
12803 [[|Article]]
12804 !! html/php
12805 [[Ns:Article|Article]]
12806 !! end
12807
12808 !! test
12809 pre-save transform: context links ("pipe trick") with namespace and parens
12810 !! options
12811 pst title=[[Ns:Somearticle (context)]]
12812 !! wikitext
12813 [[|Article]]
12814 !! html/php
12815 [[Ns:Article (context)|Article]]
12816 !! end
12817
12818 !! test
12819 pre-save transform: context links ("pipe trick") with namespace and comma
12820 !! options
12821 pst title=[[Ns:Somearticle, Context, Whatever]]
12822 !! wikitext
12823 [[|Article]]
12824 !! html/php
12825 [[Ns:Article, Context, Whatever|Article]]
12826 !! end
12827
12828 !! test
12829 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12830 !! options
12831 pst title=[[Ns:Somearticle, Context (context)]]
12832 !! wikitext
12833 [[|Article]]
12834 !! html/php
12835 [[Ns:Article (context)|Article]]
12836 !! end
12837
12838 !! test
12839 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12840 !! options
12841 pst title=[[Ns:Somearticle (IGNORED), Context]]
12842 !! wikitext
12843 [[|Article]]
12844 !! html/php
12845 [[Ns:Article, Context|Article]]
12846 !! end
12847
12848 !! test
12849 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12850 !! options
12851 pst
12852 !! wikitext
12853 [[Article(context)|]]
12854 [[Bar:Article(context)|]]
12855 [[:Bar:Article(context)|]]
12856 [[|Article(context)]]
12857 [[Bar:X(Y)Z|]]
12858 [[:Bar:X(Y)Z|]]
12859 !! html/php
12860 [[Article(context)|Article]]
12861 [[Bar:Article(context)|Article]]
12862 [[:Bar:Article(context)|Article]]
12863 [[Article(context)]]
12864 [[Bar:X(Y)Z|X(Y)Z]]
12865 [[:Bar:X(Y)Z|X(Y)Z]]
12866 !! end
12867
12868 !! test
12869 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12870 !! options
12871 pst
12872 !! wikitext
12873 [[Article (context)|]]
12874 [[Bar:Article (context)|]]
12875 [[:Bar:Article (context)|]]
12876 [[|Article (context)]]
12877 [[Bar:X (Y) Z|]]
12878 [[:Bar:X (Y) Z|]]
12879 !! html/php
12880 [[Article (context)|Article]]
12881 [[Bar:Article (context)|Article]]
12882 [[:Bar:Article (context)|Article]]
12883 [[Article (context)]]
12884 [[Bar:X (Y) Z|X (Y) Z]]
12885 [[:Bar:X (Y) Z|X (Y) Z]]
12886 !! end
12887
12888 !! test
12889 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12890 !! options
12891 pst
12892 !! wikitext
12893 [[Article(context)|]]
12894 [[Bar:Article(context)|]]
12895 [[:Bar:Article(context)|]]
12896 [[|Article(context)]]
12897 [[Bar:X(Y)Z|]]
12898 [[:Bar:X(Y)Z|]]
12899 !! html/php
12900 [[Article(context)|Article]]
12901 [[Bar:Article(context)|Article]]
12902 [[:Bar:Article(context)|Article]]
12903 [[Article(context)]]
12904 [[Bar:X(Y)Z|X(Y)Z]]
12905 [[:Bar:X(Y)Z|X(Y)Z]]
12906 !! end
12907
12908 !! test
12909 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12910 !! options
12911 pst
12912 !! wikitext
12913 [[Article (context), context|]]
12914 [[Article (context),context|]]
12915 [[Bar:Article (context), context|]]
12916 [[Bar:Article (context),context|]]
12917 [[:Bar:Article (context), context|]]
12918 [[:Bar:Article (context),context|]]
12919 !! html/php
12920 [[Article (context), context|Article]]
12921 [[Article (context),context|Article]]
12922 [[Bar:Article (context), context|Article]]
12923 [[Bar:Article (context),context|Article]]
12924 [[:Bar:Article (context), context|Article]]
12925 [[:Bar:Article (context),context|Article]]
12926 !! end
12927
12928 !! test
12929 pre-save transform: trim trailing empty lines
12930 !! options
12931 pst
12932 !! wikitext
12933 Empty lines are trimmed
12934
12935
12936
12937
12938 !! html/php
12939 Empty lines are trimmed
12940 !! end
12941
12942 !! test
12943 pre-save transform: Signature expansion
12944 !! options
12945 pst
12946 !! wikitext
12947 * ~~~
12948 * <noinclude>~~~</noinclude>
12949 * <includeonly>~~~</includeonly>
12950 * <onlyinclude>~~~</onlyinclude>
12951 !! html/php
12952 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12953 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12954 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12955 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12956 !! end
12957
12958
12959 !! test
12960 pre-save transform: Signature expansion in nowiki tags (bug 93)
12961 !! options
12962 pst disabled
12963 !! wikitext
12964 Shall not expand:
12965
12966 <nowiki>~~~~</nowiki>
12967
12968 <includeonly><nowiki>~~~~</nowiki></includeonly>
12969
12970 <noinclude><nowiki>~~~~</nowiki></noinclude>
12971
12972 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12973
12974 {{subst:Foo}} shall be converted to FOO
12975
12976 As well as inside noinclude/onlyinclude
12977 <noinclude>{{subst:Foo}}</noinclude>
12978 <onlyinclude>{{subst:Foo}}</onlyinclude>
12979
12980 But not inside includeonly
12981 <includeonly>{{subst:Foo}}</includeonly>
12982 !! html/php
12983 Shall not expand:
12984
12985 <nowiki>~~~~</nowiki>
12986
12987 <includeonly><nowiki>~~~~</nowiki></includeonly>
12988
12989 <noinclude><nowiki>~~~~</nowiki></noinclude>
12990
12991 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12992
12993 FOO shall be converted to FOO
12994
12995 As well as inside noinclude/onlyinclude
12996 <noinclude>FOO</noinclude>
12997 <onlyinclude>FOO</onlyinclude>
12998
12999 But not inside includeonly
13000 <includeonly>{{subst:Foo}}</includeonly>
13001 !! end
13002
13003 !! test
13004 Parsoid: Recognize nowiki with trailing space in tags
13005 !! options
13006 parsoid=wt2html
13007 !! wikitext
13008 <nowiki ><div>[[foo]]</nowiki >
13009
13010 a<nowiki / >b
13011
13012 c<nowiki />d
13013
13014 e<nowiki/ >f
13015 !! html
13016 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13017 <p>ab</p>
13018 <p>cd</p>
13019 <p>ef</p>
13020 !! end
13021
13022 !! test
13023 Parsoid: Recognize nowiki with odd capitalization
13024 !! options
13025 parsoid=wt2html
13026 !! wikitext
13027 <noWikI ><div>[[foo]]</Nowiki >
13028 !! html
13029 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
13030 !! end
13031
13032
13033 !! test
13034 Parsoid: Escape nowiki with trailing space in tags
13035 !! options
13036 parsoid=html2wt
13037 !! html/parsoid
13038 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
13039 <p>a&lt;nowiki /&gt;b</p>
13040 <p>c&lt;nowiki/ &gt;d</p>
13041 !! wikitext
13042 &lt;nowiki &gt; foo &lt;/nowiki &gt;
13043
13044 a&lt;nowiki /&gt;b
13045
13046 c&lt;nowiki/ &gt;d
13047 !! end
13048
13049 !! test
13050 Parsoid: Escape weird noWikI capitalizations
13051 !! options
13052 parsoid=html2wt
13053 !! html/parsoid
13054 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
13055 !! wikitext
13056 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
13057 !! end
13058
13059 ###
13060 ### Message transform tests
13061 ###
13062 !! test
13063 message transform: magic variables
13064 !! options
13065 msg
13066 !! wikitext
13067 {{SITENAME}}
13068 !! html
13069 MediaWiki
13070 !! end
13071
13072 !! test
13073 message transform: should not transform wiki markup
13074 !! options
13075 msg
13076 !! wikitext
13077 ''test''
13078 !! html
13079 ''test''
13080 !! end
13081
13082 !! test
13083 message transform: <noinclude> in transcluded template (bug 4926)
13084 !! options
13085 msg
13086 !! wikitext
13087 {{Includes}}
13088 !! html
13089 Foobar
13090 !! end
13091
13092 !! test
13093 message transform: <onlyinclude> in transcluded template (bug 4926)
13094 !! options
13095 msg
13096 !! wikitext
13097 {{Includes2}}
13098 !! html
13099 Foo
13100 !! end
13101
13102 !! test
13103 {{#special:}} page name, known
13104 !! options
13105 msg
13106 !! wikitext
13107 {{#special:Recentchanges}}
13108 !! html
13109 Special:RecentChanges
13110 !! end
13111
13112 !! test
13113 {{#special:}} page name with subpage, known
13114 !! options
13115 msg
13116 !! wikitext
13117 {{#special:Recentchanges/param}}
13118 !! html
13119 Special:RecentChanges/param
13120 !! end
13121
13122 !! test
13123 {{#special:}} page name, unknown
13124 !! options
13125 msg
13126 !! wikitext
13127 {{#special:foobar nonexistent}}
13128 !! html
13129 Special:Foobar nonexistent
13130 !! end
13131
13132 !! test
13133 {{#speciale:}} page name, known
13134 !! options
13135 msg
13136 !! wikitext
13137 {{#speciale:Recentchanges}}
13138 !! html
13139 Special:RecentChanges
13140 !! end
13141
13142 !! test
13143 {{#speciale:}} page name with subpage, known
13144 !! options
13145 msg
13146 !! wikitext
13147 {{#speciale:Recentchanges/param}}
13148 !! html
13149 Special:RecentChanges/param
13150 !! end
13151
13152 !! test
13153 {{#speciale:}} page name, unknown
13154 !! options
13155 msg
13156 !! wikitext
13157 {{#speciale:foobar nonexistent}}
13158 !! html
13159 Special:Foobar_nonexistent
13160 !! end
13161
13162 ###
13163 ### Images
13164 ###
13165 ### For Parsoid-specific tests, see
13166 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13167
13168 !! test
13169 Simple image
13170 !! options
13171 parsoid=wt2html,wt2wt,html2html
13172 !! wikitext
13173 [[Image:foobar.jpg]]
13174 !! html/php
13175 <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>
13176 </p>
13177 !! html/parsoid
13178 <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>
13179 !! end
13180
13181 !! test
13182 Simple image (using File: namespace, now canonical)
13183 !! wikitext
13184 [[File:Foobar.jpg]]
13185 !! html/php
13186 <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>
13187 </p>
13188 !! html/parsoid
13189 <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>
13190 !! end
13191
13192 !! test
13193 Right-aligned image
13194 !! wikitext
13195 [[File:Foobar.jpg|right]]
13196 !! html/php
13197 <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>
13198
13199 !! html/parsoid
13200 <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>
13201 !! end
13202
13203 !! test
13204 Image with caption
13205 !! wikitext
13206 [[File:Foobar.jpg|right|Caption text]]
13207 !! html/php
13208 <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>
13209
13210 !! html/parsoid
13211 <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>
13212 !! end
13213
13214 !! test
13215 Image with caption, bug 53312 #1
13216 !! wikitext
13217 [[File:Foobar.jpg|right|Caption page stuff]]
13218 !! html/php
13219 <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>
13220
13221 !! html/parsoid
13222 <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>
13223 !! end
13224
13225 !! test
13226 Image with caption, bug 53312 #2
13227 !! wikitext
13228 [[File:Foobar.jpg|right|Caption page=]]
13229 !! html/php
13230 <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>
13231
13232 !! html/parsoid
13233 <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>
13234 !! end
13235
13236 !! test
13237 Image with caption, bug 53312 #3
13238 !! wikitext
13239 [[File:Foobar.jpg|right|Caption page=stuff]]
13240 !! html/php
13241 <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>
13242
13243 !! html/parsoid
13244 <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>
13245 !! end
13246
13247 !! test
13248 Allow empty links in image captions (Bug 60753)
13249 !! options
13250 thumbsize=220
13251 !! wikitext
13252 [[File:Foobar.jpg|thumb|Caption [[Link1]]
13253 [[]]
13254 [[Link2]]
13255 ]]
13256 !! html/php
13257 <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>
13258
13259 !! html/parsoid
13260 <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>
13261 [[]]
13262 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
13263 </figcaption></figure>
13264 !! end
13265
13266 !! test
13267 Titles in unlinked images (T23454)
13268 !! wikitext
13269 [[File:Foobar.jpg|link=|stuff]]
13270 !! html/php
13271 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
13272 </p>
13273 !! end
13274
13275 !! test
13276 Link with empty target
13277 !! wikitext
13278 [[]]
13279 !! html
13280 <p>[[]]
13281 </p>
13282 !! end
13283
13284 !! test
13285 Image with link trail
13286 !! wikitext
13287 Linktrails should not work for images: [[File:Foobar.jpg]]s
13288 !! html/php
13289 <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
13290 </p>
13291 !! html/parsoid
13292 <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>
13293 !! end
13294
13295 !! test
13296 Image with empty attribute
13297 !! options
13298 parsoid=wt2html,wt2wt,html2html
13299 !! wikitext
13300 [[File:Foobar.jpg|right||Caption text]]
13301 !! html/php
13302 <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>
13303
13304 !! html/parsoid
13305 <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>
13306 !! end
13307
13308 !! test
13309 1. Block image with individual attributes from templates
13310 !! wikitext
13311 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
13312 !! html/php
13313 <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>
13314
13315 !! html/parsoid
13316 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"{{echo|137px}}"},{"ck":"caption","ak":"This is a caption"}]}' data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[24,38,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"137px\"}},\"i\":0}}]}&#39;>137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"16","width":"137"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>This is a caption</figcaption></figure>
13317 !! end
13318
13319 !! test
13320 2. Block Image with individual attributes from templates
13321 !! wikitext
13322 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
13323 !! html/php
13324 <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>
13325
13326 !! html/parsoid
13327 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt3" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"{{echo|thumb}}"},{"ck":"width","ak":"{{echo|137px}}"},{"ck":"caption","ak":"This is a caption"}]}' data-mw='{"attribs":[["thumbnail",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[18,32,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"thumb\"}},\"i\":0}}]}&#39;>thumb&lt;/span>"}],["width",{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[33,47,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"137px\"}},\"i\":0}}]}&#39;>137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"16","width":"137"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>This is a caption</figcaption></figure>
13328 !! end
13329
13330 !! test
13331 3. Inline image with individual attributes from templates
13332 !! wikitext
13333 [[File:Foobar.jpg|{{echo|50px}}]]
13334 !! html/php
13335 <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>
13336 </p>
13337 !! html/parsoid
13338 <p><span typeof="mw:Image mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"width","ak":"{{echo|50px}}"}]}' data-mw='{"attribs":[["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[18,31,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"50px\"}},\"i\":0}}]}&#39;>50px&lt;/span>"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13339 !! end
13340
13341 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
13342 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
13343 !! test
13344 Image with multiple attributes from the same template
13345 !! wikitext
13346 [[File:Foobar.jpg|{{image_attribs}}]]
13347 !! html/php
13348 <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>
13349
13350 !! html/parsoid
13351 <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>
13352 !! end
13353
13354 !! test
13355 Image with link tails
13356 !! options
13357 thumbsize=220
13358 !! wikitext
13359 123[[File:Foobar.jpg]]456
13360 123[[File:Foobar.jpg|right]]456
13361 123[[File:Foobar.jpg|thumb]]456
13362 !! html/php
13363 <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
13364 </p>
13365 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
13366 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
13367
13368 !! html/php+tidy
13369 <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>
13370 <p>123</p>
13371 <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>
13372 <p>456 123</p>
13373 <div class="thumb tright">
13374 <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>
13375 <div class="thumbcaption">
13376 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
13377 </div>
13378 </div>
13379 </div>
13380 <p>456</p>
13381 !! html/parsoid
13382 <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>
13383 <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>
13384 <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>
13385 !! end
13386
13387 !! test
13388 Image with multiple captions -- only last one is accepted
13389 !! wikitext
13390 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
13391 !! html/php
13392 <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>
13393
13394 !! html/parsoid
13395 <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>
13396 !! end
13397
13398 !! test
13399 Image with multiple widths -- use last
13400 !! wikitext
13401 [[File:Foobar.jpg|200px|300px|caption]]
13402 !! html/php
13403 <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>
13404 </p>
13405 !! html/parsoid
13406 <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>
13407 !! end
13408
13409 !! test
13410 Image with multiple alignments -- use first (bug 48664)
13411 !! options
13412 thumbsize=220
13413 !! wikitext
13414 [[File:Foobar.jpg|thumb|left|right|center|caption]]
13415
13416 [[File:Foobar.jpg|middle|text-top|caption]]
13417 !! html/php
13418 <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>
13419 <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>
13420 </p>
13421 !! html/parsoid
13422 <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>
13423 <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>
13424 !! end
13425
13426 !! test
13427 Image with width attribute at different positions
13428 !! wikitext
13429 [[File:Foobar.jpg|200px|right|Caption]]
13430 [[File:Foobar.jpg|right|200px|Caption]]
13431 [[File:Foobar.jpg|right|Caption|200px]]
13432 !! html/php
13433 <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>
13434 <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>
13435 <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>
13436
13437 !! html/parsoid
13438 <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>
13439 <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>
13440 <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>
13441 !! end
13442
13443 # a sad bit of backward-compatibility
13444 !! test
13445 Image with size specified with pxpx (bug 13500, 51628)
13446 !! options
13447 parsoid=wt2html,wt2wt,html2html
13448 !! wikitext
13449 [[File:Foobar.jpg|20pxpx]]
13450 [[File:Foobar.jpg|200x20pxpx]]
13451 !! html/php
13452 <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>
13453 <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>
13454 </p>
13455 !! html/parsoid
13456 <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>
13457 !! end
13458
13459 !! test
13460 Image with link parameter, wiki target
13461 !! wikitext
13462 [[File:Foobar.jpg|link=Main Page]]
13463 !! html/php
13464 <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>
13465 </p>
13466 !! html/parsoid
13467 <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>
13468 !! end
13469
13470 # parsoid bug 49293 (part 1)
13471 !! test
13472 Image with link parameter, URL target
13473 !! wikitext
13474 [[File:Foobar.jpg|link=http://example.com/]]
13475 !! html/php
13476 <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>
13477 </p>
13478 !! html/parsoid
13479 <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>
13480 !! end
13481
13482 # parsoid bug 49293 (part 2)
13483 !! test
13484 Image with link parameter, protocol-less URL target
13485 !! wikitext
13486 [[File:Foobar.jpg|link=//example.com/]]
13487 !! html/php
13488 <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>
13489 </p>
13490 !! html/parsoid
13491 <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>
13492 !! end
13493
13494 !! test
13495 Escaping non-block captions (T107435)
13496 !! options
13497 parsoid={
13498 "modes": ["wt2wt"],
13499 "changes": [
13500 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
13501 ]
13502 }
13503 !! wikitext
13504 [[Image:Foobar.jpg|caption]]
13505 !! wikitext/edited
13506 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
13507 !! end
13508
13509 # wgExternalLinkTarget not supported by Parsoid
13510 !! test
13511 Image with link parameter, wgExternalLinkTarget
13512 !! wikitext
13513 [[Image:foobar.jpg|link=http://example.com/]]
13514 !! config
13515 wgExternalLinkTarget='foobar'
13516 !! html/php
13517 <p><a href="http://example.com/" target="foobar" rel="nofollow noreferrer noopener"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13518 </p>
13519 !! end
13520
13521 !! test
13522 Image with link parameter, wgNoFollowLinks set to false
13523 !! wikitext
13524 [[Image:foobar.jpg|link=http://example.com/]]
13525 !! config
13526 wgNoFollowLinks=false
13527 !! html
13528 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13529 </p>
13530 !! end
13531
13532 !! test
13533 Image with link parameter, wgNoFollowDomainExceptions
13534 !! wikitext
13535 [[Image:foobar.jpg|link=http://example.com/]]
13536 !! config
13537 wgNoFollowDomainExceptions='example.com'
13538 !! html
13539 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13540 </p>
13541 !! end
13542
13543 # wgExternalLinkTarget not supported by Parsoid
13544 !! test
13545 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13546 !! wikitext
13547 [[Image:foobar.jpg|link=http://example.com/|Title]]
13548 !! config
13549 wgExternalLinkTarget='foobar'
13550 !! html/php
13551 <p><a href="http://example.com/" title="Title" target="foobar" rel="nofollow noreferrer noopener"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13552 </p>
13553 !! end
13554
13555 !! test
13556 Image with empty link parameter
13557 !! wikitext
13558 [[File:Foobar.jpg|link=]]
13559 !! html/php
13560 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13561 </p>
13562 !! html/parsoid
13563 <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>
13564 !! end
13565
13566 !! test
13567 Image with link parameter (wiki target) and unnamed parameter
13568 !! wikitext
13569 [[File:Foobar.jpg|link=Main_Page|Title]]
13570 !! html/php
13571 <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>
13572 </p>
13573 !! html/parsoid
13574 <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>
13575 !! end
13576
13577 !! test
13578 Image with link parameter (URL target) and unnamed parameter
13579 !! wikitext
13580 [[File:Foobar.jpg|link=http://example.com/|Title]]
13581 !! html/php
13582 <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>
13583 </p>
13584 !! html/parsoid
13585 <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>
13586 !! end
13587
13588 !! test
13589 Thumbnail image with link parameter
13590 !! options
13591 thumbsize=220
13592 parsoid=wt2html,wt2wt,html2html
13593 !! wikitext
13594 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13595 !! html/php
13596 <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>
13597
13598 !! html/parsoid
13599 <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>
13600 !! end
13601
13602 !! test
13603 Manually-specified thumbnail image
13604 !! options
13605 thumbsize=220
13606 !! wikitext
13607 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13608 !! html/php
13609 <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>
13610
13611 !! html/parsoid
13612 <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>
13613 !! end
13614
13615 !! test
13616 Manually-specified thumbnail image with explicit link to wiki page
13617 !! options
13618 thumbsize=220
13619 parsoid=wt2html,wt2wt,html2html
13620 !! wikitext
13621 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13622 !! html/php
13623 <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>
13624
13625 !! html/parsoid
13626 <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>
13627 !! end
13628
13629 !! test
13630 Manually-specified thumbnail image with explicit link to url
13631 !! options
13632 thumbsize=220
13633 parsoid=wt2html,wt2wt,html2html
13634 !! wikitext
13635 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13636 !! html/php
13637 <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>
13638
13639 !! html/parsoid
13640 <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>
13641 !! end
13642
13643 !! test
13644 Manually-specified thumbnail image with explicit no link
13645 !! options
13646 thumbsize=220
13647 parsoid=wt2html,wt2wt,html2html
13648 !! wikitext
13649 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13650 !! html/php
13651 <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>
13652
13653 !! html/parsoid
13654 <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>
13655 !! end
13656
13657 !! test
13658 Manually-specified thumbnail image with explicit link and alt text
13659 !! options
13660 thumbsize=220
13661 parsoid=wt2html,wt2wt,html2html
13662 !! wikitext
13663 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13664 !! html/php
13665 <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>
13666
13667 !! html/parsoid
13668 <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>
13669 !! end
13670
13671 !! test
13672 Image with frame and link
13673 !! options
13674 parsoid=wt2html,wt2wt,html2html
13675 !! wikitext
13676 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13677 !! html/php
13678 <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>
13679
13680 !! html/parsoid
13681 <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>
13682 !! end
13683
13684 !! test
13685 Image with frame and link and explicit alt
13686 !! options
13687 parsoid=wt2html,wt2wt,html2html
13688 !! wikitext
13689 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13690 !! html/php
13691 <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>
13692
13693 !! html/parsoid
13694 <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>
13695 !! end
13696
13697 !! test
13698 Image with wiki markup in implicit alt
13699 !! wikitext
13700 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13701
13702 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13703 !! html/php
13704 <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>
13705 </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>
13706 </p>
13707 !! html/parsoid
13708 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt"}]}' data-mw='{"caption":"testing &lt;b data-parsoid=&#39;{\"dsr\":[27,37,3,3]}&#39;>bold&lt;/b> in alt"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"Image:Foobar.jpg"}}'/></a></span></p>
13709
13710 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"alt","ak":"alt=testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img alt="testing bold in alt" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"alt":"testing bold in alt","resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"alt":"alt=testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt","resource":"Image:Foobar.jpg"}}'/></a></span></p>
13711 !! end
13712
13713 !! test
13714 Alt image option should handle most kinds of wikitext without barfing
13715 !! wikitext
13716 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13717 !! html/php
13718 <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>
13719
13720 !! html/parsoid
13721 <figure class="mw-default-size" typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"This is the image caption"},{"ck":"alt","ak":"alt=This is a [[link]] and a {{echo|&#39;&#39;bold template&#39;&#39;}}."}]}' data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["alt",{"html":"alt=This is a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[65,73,2,2]}&#39;>link&lt;/a> and a &lt;i about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"dsr\":[80,106,null,null],\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;#39;&amp;#39;bold template&amp;#39;&amp;#39;\"}},\"i\":0}}]}&#39;>bold template&lt;/i>."}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img alt="This is a link and a bold template." resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"alt":"This is a link and a bold template.","resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"alt":"alt=This is a [[link]] and a {{echo|&#39;&#39;bold template&#39;&#39;}}.","resource":"Image:Foobar.jpg"}}'/></a><figcaption>This is the image caption</figcaption></figure>
13722 !! end
13723
13724 ###################
13725 # Conflicting image format options.
13726 # First option specified should 'win'.
13727 # All three cases in each test should be identical.
13728
13729 !! test
13730 Image with 'frameless' first.
13731 !! options
13732 parsoid=wt2html,wt2wt,html2html
13733 !! wikitext
13734 [[File:Foobar.jpg|frameless|caption]]
13735
13736 [[File:Foobar.jpg|frameless|frame|caption]]
13737
13738 [[File:Foobar.jpg|frameless|thumb|caption]]
13739 !! html/php
13740 <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>
13741 </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>
13742 </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>
13743 </p>
13744 !! html/parsoid
13745 <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>
13746 <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>
13747 <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>
13748 !! end
13749
13750 !! test
13751 Image with 'frame' first.
13752 !! options
13753 parsoid=wt2html,wt2wt,html2html
13754 !! wikitext
13755 [[File:Foobar.jpg|frame|caption]]
13756 [[File:Foobar.jpg|frame|frameless|caption]]
13757 [[File:Foobar.jpg|frame|thumb|caption]]
13758 !! html/php
13759 <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>
13760 <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>
13761 <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>
13762
13763 !! html/parsoid
13764 <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>
13765 <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>
13766 <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>
13767 !! end
13768
13769 !! test
13770 Image with 'thumb' first.
13771 !! options
13772 parsoid=wt2html,wt2wt,html2html
13773 !! wikitext
13774 [[File:Foobar.jpg|thumb|caption]]
13775 [[File:Foobar.jpg|thumb|frameless|caption]]
13776 [[File:Foobar.jpg|thumb|frame|caption]]
13777 !! html/php
13778 <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>
13779 <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>
13780 <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>
13781
13782 !! html/parsoid
13783 <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>
13784 <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>
13785 <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>
13786 !! end
13787
13788 ###################
13789 # Image sizing.
13790 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13791 # and https://phabricator.wikimedia.org/T64258
13792 # Foobar has actual size of 1941x220
13793 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13794 # a scalable format.
13795 # 2. Framed images always ignore size options; always render at default size.
13796 # 3. "Unspecified format" and border are the only types which can be
13797 # enlarged.
13798
13799 !! test
13800 Image: "unspecified format" and border enlarge
13801 !! options
13802 parsoid=wt2html,wt2wt,html2html
13803 !! wikitext
13804 [[File:Foobar.jpg|2000px]]
13805
13806 [[File:Foobar.jpg|border|2000px]]
13807 !! html/php
13808 <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>
13809 </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>
13810 </p>
13811 !! html/parsoid
13812 <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>
13813 <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>
13814 !! end
13815
13816 !! test
13817 Image: "unspecified format" and border reduce
13818 !! options
13819 parsoid=wt2html,wt2wt,html2html
13820 !! wikitext
13821 [[File:Foobar.jpg|1000px]]
13822
13823 [[File:Foobar.jpg|border|1000px]]
13824 !! html/php
13825 <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>
13826 </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>
13827 </p>
13828 !! html/parsoid
13829 <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>
13830 <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>
13831 !! end
13832
13833 !! test
13834 Image: thumbs reduce
13835 !! options
13836 parsoid=wt2html,wt2wt,html2html
13837 !! wikitext
13838 [[File:Foobar.jpg|thumb|50px]]
13839 !! html/php
13840 <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>
13841
13842 !! html/parsoid
13843 <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>
13844 !! end
13845
13846 !! test
13847 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13848 !! options
13849 parsoid=wt2html,wt2wt,html2html
13850 !! wikitext
13851 [[File:Foobar.jpg|thumb|2000px]]
13852
13853 [[File:Foobar.svg|thumb|2000px]]
13854 !! html/php
13855 <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>
13856 <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>
13857
13858 !! html/parsoid
13859 <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>
13860 <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>
13861 !! end
13862
13863 !! test
13864 Image: frameless can reduce in size
13865 !! options
13866 parsoid=wt2html,wt2wt,html2html
13867 !! wikitext
13868 [[File:Foobar.jpg|frameless|50px]]
13869 !! html/php
13870 <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>
13871 </p>
13872 !! html/parsoid
13873 <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>
13874 !! end
13875
13876 !! test
13877 Image: bitmap frameless can't be enlarged past original size, but vector can
13878 !! options
13879 parsoid=wt2html,wt2wt,html2html
13880 !! wikitext
13881 [[File:Foobar.jpg|frameless|2000px]]
13882
13883 [[File:Foobar.svg|frameless|2000px]]
13884 !! html/php
13885 <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>
13886 </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>
13887 </p>
13888 !! html/parsoid
13889 <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>
13890 <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>
13891 !! end
13892
13893 !! test
13894 Image: framed images are always unscaled.
13895 !! options
13896 parsoid=wt2html,wt2wt,html2html
13897 !! wikitext
13898 [[File:Foobar.jpg|frame]]
13899
13900 [[File:Foobar.jpg|frame|50px]]
13901
13902 [[File:Foobar.jpg|frame|50x50px]]
13903
13904 [[File:Foobar.jpg|frame|2000px]]
13905 !! html/php
13906 <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>
13907 <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>
13908 <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>
13909 <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>
13910
13911 !! html/parsoid
13912 <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>
13913 <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>
13914 <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>
13915 <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>
13916 !! end
13917
13918 ###################
13919
13920 !! test
13921 Link to image page- image page normally doesn't exists, hence edit link
13922 Add test with existing image page
13923 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13924 !! wikitext
13925 [[:Image:test]]
13926 !! html
13927 <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>
13928 </p>
13929 !! end
13930
13931 !! test
13932 bug 18784 Link to non-existent image page with caption should use caption as link text
13933 !! wikitext
13934 [[:Image:test|caption]]
13935 !! html
13936 <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>
13937 </p>
13938 !! end
13939
13940 !! test
13941 Frameless image caption with a free URL
13942 !! wikitext
13943 [[File:Foobar.jpg|http://example.com]]
13944 !! html/php
13945 <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>
13946 </p>
13947 !! html/parsoid
13948 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"http://example.com"}]}' data-mw='{"caption":"&lt;a rel=\"mw:ExtLink\" href=\"http://example.com\" data-parsoid=&#39;{\"stx\":\"url\",\"dsr\":[18,36,0,0]}&#39;>http://example.com&lt;/a>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
13949 !! end
13950
13951 !! test
13952 Thumbnail image caption with a free URL
13953 !! options
13954 thumbsize=220
13955 !! wikitext
13956 [[File:Foobar.jpg|thumb|http://example.com]]
13957 !! html/php
13958 <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>
13959
13960 !! html/parsoid
13961 <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>
13962 !! end
13963
13964 !! test
13965 Thumbnail image caption with a free URL and explicit alt
13966 !! options
13967 thumbsize=220
13968 parsoid=wt2html,wt2wt,html2html
13969 !! wikitext
13970 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13971 !! html/php
13972 <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>
13973
13974 !! html/parsoid
13975 <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>
13976 !! end
13977
13978 !! test
13979 SVG thumbnails with no language set
13980 !! options
13981 !! wikitext
13982 [[File:Foobar.svg|thumb|caption]]
13983 !! html/php
13984 <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>
13985
13986 !! html/parsoid
13987 <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>
13988 !! end
13989
13990 !! test
13991 SVG thumbnails with language de
13992 !! options
13993 parsoid=wt2html,wt2wt,html2html
13994 !! wikitext
13995 [[File:Foobar.svg|thumb|caption|lang=de]]
13996 !! html/php
13997 <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>
13998
13999 !! html/parsoid
14000 <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>
14001 !! end
14002
14003 !! test
14004 SVG thumbnails with invalid language code
14005 !! options
14006 parsoid=wt2html,wt2wt,html2html
14007 !! wikitext
14008 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
14009 !! html/php
14010 <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>
14011
14012 !! html/parsoid
14013 <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>
14014 !! end
14015
14016 !! test
14017 BUG 1887: A ISBN with a thumbnail
14018 !! wikitext
14019 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
14020 !! html/php
14021 <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>
14022
14023 !! html/parsoid
14024 <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>
14025 !! end
14026
14027 !! test
14028 BUG 1887: A RFC with a thumbnail
14029 !! wikitext
14030 [[File:Foobar.jpg|thumb|This is RFC 12354]]
14031 !! html/php
14032 <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>
14033
14034 !! html/parsoid
14035 <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>
14036 !! end
14037
14038 !! test
14039 BUG 1887: A mailto link with a thumbnail
14040 !! wikitext
14041 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
14042 !! html/php
14043 <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>
14044
14045 !! html/parsoid
14046 <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>
14047 !! end
14048
14049 # Pending resolution to bug 368
14050 !! test
14051 BUG 648: Frameless image caption with a link
14052 !! wikitext
14053 [[File:Foobar.jpg|text with a [[link]] in it]]
14054 !! html/php
14055 <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>
14056 </p>
14057 !! html/parsoid
14058 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[link]] in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[30,38,2,2]}&#39;>link&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14059 !! end
14060
14061 !! test
14062 BUG 648: Frameless image caption with a link (suffix)
14063 !! wikitext
14064 [[File:Foobar.jpg|text with a [[link]]foo in it]]
14065 !! html/php
14066 <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>
14067 </p>
14068 !! html/parsoid
14069 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[link]]foo in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[30,41,2,5],\"tail\":\"foo\"}&#39;>linkfoo&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14070 !! end
14071
14072 !! test
14073 BUG 648: Frameless image caption with an interwiki link
14074 !! wikitext
14075 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
14076 !! html/php
14077 <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>
14078 </p>
14079 !! html/parsoid
14080 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[MeatBall:Link]] in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:ExtLink\" href=\"http://www.usemod.com/cgi-bin/mb.pl?Link\" title=\"meatball:Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"http://www.usemod.com/cgi-bin/mb.pl?Link\"},\"sa\":{\"href\":\"MeatBall:Link\"},\"isIW\":true,\"dsr\":[30,47,2,2]}&#39;>MeatBall:Link&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14081 !! end
14082
14083 !! test
14084 BUG 648: Frameless image caption with a piped interwiki link
14085 !! wikitext
14086 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
14087 !! html/php
14088 <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>
14089 </p>
14090 !! html/parsoid
14091 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[MeatBall:Link|link]] in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:ExtLink\" href=\"http://www.usemod.com/cgi-bin/mb.pl?Link\" title=\"meatball:Link\" data-parsoid=&#39;{\"stx\":\"piped\",\"a\":{\"href\":\"http://www.usemod.com/cgi-bin/mb.pl?Link\"},\"sa\":{\"href\":\"MeatBall:Link\"},\"isIW\":true,\"dsr\":[30,52,16,2]}&#39;>link&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14092 !! end
14093
14094 !! test
14095 T107474: Frameless image caption with <nowiki>
14096 !! wikitext
14097 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
14098 !! html/parsoid
14099 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;nowiki>text with a [[MeatBall:Link|link]] in it&lt;/nowiki>"}]}' data-mw='{"caption":"&lt;span typeof=\"mw:Nowiki\" data-parsoid=&#39;{\"dsr\":[18,75,8,9]}&#39;>text with a [[MeatBall:Link|link]] in it&lt;/span>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14100 !! end
14101
14102 !! test
14103 Escape HTML special chars in image alt text
14104 !! wikitext
14105 [[File:Foobar.jpg|& < > "]]
14106 !! html/php
14107 <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>
14108 </p>
14109 !! html/parsoid
14110 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp; &lt; > \""}]}' data-mw='{"caption":"&amp;amp; &amp;lt; > \""}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14111 !! end
14112
14113 !! test
14114 Entities in file name and attributes
14115 !! wikitext
14116 [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
14117 !! html/php
14118 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
14119 </p>
14120 !! html/parsoid
14121 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"bogus","ak":"manualthumb=7%25 solution.gif"},{"ck":"link","ak":"link=7%25 solution"},{"ck":"caption","ak":"[[7%25 solution]]"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;a rel=\"mw:WikiLink\" href=\"./7%25_solution\" title=\"7% solution\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./7%25_solution\"},\"sa\":{\"href\":\"7%25 solution\"},\"dsr\":[74,91,2,2]}&#39;>7% solution&lt;/a>"}'><a href="./7%25_solution" data-parsoid='{"a":{"href":"./7%25_solution"},"sa":{"href":"link=7%25 solution"}}'><img resource="./File:7%25_solution.gif" src="./Special:FilePath/7%25_solution.gif" height="220" width="220" data-parsoid='{"a":{"resource":"./File:7%25_solution.gif","height":"220","width":"220"},"sa":{"resource":"File:7%25 solution.gif"}}'/></a></span></p>
14122 !! end
14123
14124 !! test
14125 BUG 499: Alt text should have &#1234;, not &amp;1234;
14126 !! wikitext
14127 [[File:Foobar.jpg|&#9792;]]
14128 !! html/php
14129 <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>
14130 </p>
14131 !! html/parsoid
14132 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp;#9792;"}]}' data-mw='{"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=&#39;{\"src\":\"&amp;amp;#9792;\",\"srcContent\":\"♀\",\"dsr\":[18,25,null,null]}&#39;>♀&lt;/span>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14133 !! end
14134
14135 !! test
14136 Broken image caption with link
14137 !! options
14138 parsoid=wt2html,wt2wt,html2html
14139 !! wikitext
14140 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
14141 !! html/php
14142 <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.
14143 </p>
14144 !! html/parsoid
14145 <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>
14146 !! end
14147
14148 !! test
14149 Image caption containing another image
14150 !! wikitext
14151 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
14152 !! html/php
14153 <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>
14154
14155 !! html/parsoid
14156 <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>
14157 !! end
14158
14159 !! test
14160 Image: caption containing a newline
14161 !! wikitext
14162 [[File:Foobar.jpg|This
14163 *is some text]]
14164 !! html/php
14165 <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>
14166 </p>
14167 !! html/parsoid
14168 <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>
14169 !!end
14170
14171 !!test
14172 Image: caption containing leading space
14173 (The leading space should not trigger nowiki escaping in wt2wt mode)
14174 !! wikitext
14175 [[File:Foobar.jpg|thumb| bar]]
14176 !! html/php
14177 <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>
14178
14179 !! html/parsoid
14180 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption> bar</figcaption></figure>
14181 !!end
14182
14183 !! test
14184 Image: caption containing a table
14185 !! options
14186 parsoid=wt2html,wt2wt,html2html
14187 !! wikitext
14188 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
14189 {|
14190 ! Foo !! Bar
14191 |-
14192 | Foo1 || Bar1
14193 |}
14194 and some more text.]]
14195 !! html/php
14196 <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>
14197
14198 !! html/parsoid
14199 <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
14200 <table>
14201 <tbody>
14202 <tr><th>Foo </th><th>Bar</th></tr>
14203 <tr>
14204 <td>Foo1 </td>
14205 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
14206 !! end
14207
14208 !! test
14209 Bug 3090: External links other than http: in image captions
14210 !! wikitext
14211 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
14212 !! html/php
14213 <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>
14214
14215 !! html/parsoid
14216 <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>
14217 !! end
14218
14219 !! test
14220 Custom class
14221 !! options
14222 parsoid=wt2html,wt2wt,html2html
14223 !! wikitext
14224 [[Image:foobar.jpg|a|class=b]]
14225 !! html/php
14226 <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>
14227 </p>
14228 !! html/parsoid
14229 <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>
14230 !! end
14231
14232 !! test
14233 Localized image handling (1).
14234 !! options
14235 parsoid=wt2html,wt2wt,html2html
14236 language=es
14237 !! wikitext
14238 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
14239 !! html/php
14240 <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>
14241
14242 !! html/parsoid
14243 <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>
14244 !! end
14245
14246 !! test
14247 Localized image handling (2).
14248 !! options
14249 thumbsize=220
14250 parsoid=wt2html,wt2wt,html2html
14251 language=es
14252 !! wikitext
14253 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
14254 !! html/php
14255 <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>
14256
14257 !! html/parsoid
14258 <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>
14259 !! end
14260
14261 !! test
14262 Localized image handling (3).
14263 !! options
14264 language=fa
14265 parsoid=html2wt
14266 !! html/parsoid
14267 <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>
14268 !! wikitext
14269 [[File:Foobar.jpg|بندانگشتی]]
14270 !! end
14271
14272 !! test
14273 "border", "frameless" and "class" attributes on an image.
14274 !! options
14275 thumbsize=220
14276 parsoid=wt2html,wt2wt,html2html
14277 !! wikitext
14278 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
14279 !! html/php
14280 <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>
14281 </p>
14282 !! html/parsoid
14283 <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>
14284 !! end
14285
14286 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
14287 !! test
14288 Invalid image attributes (bug 62500)
14289 !! options
14290 thumbsize=220
14291 parsoid=wt2html,wt2wt,html2html
14292 !! wikitext
14293 [[File:Foobar.jpg|thumb|float|left|caption]]
14294
14295 [[File:Foobar.jpg|thumb|righ|caption]]
14296
14297 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
14298 !! html/php
14299 <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>
14300 <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>
14301 <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>
14302
14303 !! html/parsoid
14304 <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>
14305 <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>
14306 <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>
14307 !! end
14308
14309 !! article
14310 File:Barfoo.jpg
14311 !! text
14312 #REDIRECT [[File:Barfoo.jpg]]
14313 !! endarticle
14314
14315 # FIXME: Parsoid should run this test -- but we'd need to teach the
14316 # mockAPI about the redirected Barfoo.jpg image.
14317 !! test
14318 Redirected image
14319 !! wikitext
14320 [[Image:Barfoo.jpg]]
14321 !! html/php
14322 <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
14323 </p>
14324 !! end
14325
14326 !! test
14327 Missing image with uploads disabled
14328 !! options
14329 wgEnableUploads=0
14330 !! wikitext
14331 [[File:Foobaz.jpg]]
14332 !! html/php
14333 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
14334 </p>
14335 !! html/parsoid
14336 <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>
14337 !! end
14338
14339 # Parsoid-specific testing for images
14340 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
14341 # Currently imperfect due to a flaw in the Parsoid testrunner
14342 # Work in progress
14343 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
14344 # image tests.
14345
14346 !! test
14347 Parsoid-specific image handling - simple image with size and middle alignment
14348 !! wikitext
14349 [[File:Foobar.jpg|middle|50px]]
14350 !! html/parsoid
14351 <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>
14352 !! end
14353
14354 !! test
14355 Parsoid-specific image handling - simple image with size, middle alignment,
14356 non-standard namespace alias
14357 !! options
14358 parsoid=wt2wt,wt2html,html2html
14359 !! wikitext
14360 [[Image:Foobar.jpg|middle|50px]]
14361 !! html/parsoid
14362 <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>
14363 !! end
14364
14365 !! test
14366 Parsoid-specific image handling - simple image with size and middle alignment
14367 (existing content)
14368 !! wikitext
14369 [[File:Foobar.jpg|50px|middle]]
14370 !! html/parsoid
14371 <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>
14372 !! end
14373
14374 !! test
14375 Parsoid-specific image handling - simple image with size and middle alignment
14376 and non-standard namespace name
14377 !! options
14378 parsoid=wt2html,wt2wt,html2html
14379 !! wikitext
14380 [[Image:Foobar.jpg|50px|middle]]
14381 !! html/parsoid
14382 <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>
14383 !! end
14384
14385 !! test
14386 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
14387 !! wikitext
14388 [[File:Foobar.jpg|500x10px|baseline|caption]]
14389 !! html/parsoid
14390 <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>
14391 !! end
14392
14393 !! test
14394 Parsoid-specific image handling - simple image with border and size spec
14395 !! wikitext
14396 [[File:Foobar.jpg|50px|border|caption]]
14397 !! html/parsoid
14398 <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>
14399 !! end
14400
14401 !! test
14402 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14403 !! wikitext
14404 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
14405 !! html/parsoid
14406 <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>
14407 !! end
14408
14409 !! test
14410 Parsoid-specific image handling - thumbnail with halign, valign, and caption
14411 (existing content)
14412 !! wikitext
14413 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
14414 !! html/parsoid
14415 <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>
14416 !! end
14417
14418 !! test
14419 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
14420 !! wikitext
14421 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
14422 !! html/parsoid
14423 <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>
14424 !! end
14425
14426 !! test
14427 Parsoid-specific image handling - thumbnail with specific size, halign,
14428 valign, and caption (existing content)
14429 !! wikitext
14430 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
14431 !! html/parsoid
14432 <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>
14433 !! end
14434
14435 !! test
14436 Parsoid-specific image handling - framed image with specific size and caption
14437 (size is ignored)
14438 !! options
14439 parsoid=wt2html,wt2wt,html2html
14440 !! wikitext
14441 [[File:Foobar.jpg|frame|500x50px|caption]]
14442 !! html/parsoid
14443 <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>
14444 !! end
14445
14446 !! test
14447 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
14448 (size is ignored)
14449 !! options
14450 parsoid=wt2html,wt2wt,html2html
14451 !! wikitext
14452 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
14453 !! html/parsoid
14454 <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>
14455 !! end
14456
14457 !! test
14458 Parsoid-specific image handling - frameless image with specific size, border, and caption
14459 !! wikitext
14460 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
14461 !! html/parsoid
14462 <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>
14463 !! end
14464
14465 !! test
14466 Parsoid-specific image handling - simple image with a formatted caption
14467 !! wikitext
14468 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
14469 !! html/parsoid
14470 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;table>&lt;tr>&lt;td>a&lt;/td>&lt;td>b&lt;/td>&lt;/tr>&lt;tr>&lt;td>c&lt;/td>&lt;/tr>&lt;/table>"}]}' data-mw='{"caption":"&lt;table data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[18,81,7,8]}&#39;>&lt;tbody data-parsoid=&#39;{\"dsr\":[25,73,0,0]}&#39;>&lt;tr data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[25,54,4,5]}&#39;>&lt;td data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[29,39,4,5]}&#39;>a&lt;/td>&lt;td data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[39,49,4,5]}&#39;>b&lt;/td>&lt;/tr>&lt;tr data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[54,73,4,5]}&#39;>&lt;td data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[58,68,4,5]}&#39;>c&lt;/td>&lt;/tr>&lt;/tbody>&lt;/table>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14471 !! end
14472
14473 !! test
14474 Parsoid-specific image handling - caption with a template in it
14475 !! wikitext
14476 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
14477 !! html/parsoid
14478 <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>
14479 !! end
14480
14481 !! test
14482 Parsoid-specific image handling - caption with unbalanced tags in it
14483 !! options
14484 parsoid=wt2html,wt2wt,html2html
14485 !! wikitext
14486 foo
14487 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
14488 bar
14489 !! html/parsoid
14490 <p>foo</p>
14491 <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>
14492 <p>bar</p>
14493 !! end
14494
14495 !! test
14496 Parsoid-specific image handling - empty caption (1)
14497 !! options
14498 parsoid=wt2html,wt2wt
14499 !! wikitext
14500 [[File:Foobar.jpg|thumb|]]
14501 !! html/parsoid
14502 <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>
14503 !! end
14504
14505 # empty captions don't get serialized unless we're in the "round trip" case
14506 !! test
14507 Parsoid-specific image handling - empty caption (2)
14508 !! options
14509 parsoid=html2wt
14510 !! html/parsoid
14511 <figure class="mw-default-size" typeof="mw:Image/Thumb">
14512 <a href="./File:Foobar.jpg">
14513 <img resource="./File:Foobar.jpg"
14514 src="//example.com/images/3/3a/Foobar.jpg"
14515 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
14516 height="25" width="220"/>
14517 </a>
14518 <figcaption></figcaption>
14519 </figure>
14520 !! wikitext
14521 [[File:Foobar.jpg|thumb]]
14522 !! end
14523
14524 !! test
14525 Parsoid-specific image handling - whitespace caption
14526 !! wikitext
14527 [[File:Foobar.jpg|thumb| ]]
14528 !! html/parsoid
14529 <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>
14530 !! end
14531
14532 !! test
14533 Parsoid-specific image handling - lang option
14534 !! wikitext
14535 foo
14536 [[File:Foobar.svg|lang=de|caption]]
14537 bar
14538 !! html/parsoid
14539 <p>foo
14540 <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>
14541 bar</p>
14542 !! end
14543
14544 ## Edge case bugs in Parsoid from T93580
14545 !! test
14546 T93580: 1. Templated <ref> inside block images
14547 !! wikitext
14548 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14549
14550 <references />
14551 !! html/parsoid
14552 <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>
14553
14554 <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>
14555 !! end
14556
14557 !! test
14558 T93580: 2. <ref> inside inline images
14559 !! wikitext
14560 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14561
14562 <references />
14563 !! html/parsoid
14564 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: &lt;ref>foo&lt;/ref>"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;span about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[64,78,5,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-1\"},\"attrs\":{}}&#39;>&lt;a href=\"#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=&#39;{\"group\":\"\",\"name\":\"\",\"content\":\"foo\",\"hasRefInRef\":false,\"dsr\":[64,78,5,6]}&#39;/>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14565
14566 <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>
14567 !! end
14568
14569 !! test
14570 T93580: 3. Templated <ref> inside inline images
14571 !! wikitext
14572 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14573
14574 <references />
14575 !! html/parsoid
14576 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: {{echo|&lt;ref>{{echo|foo}}&lt;/ref>}}"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;span about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Transclusion mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[64,96,null,null],\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;lt;ref>{{echo|foo}}&amp;lt;/ref>\"}},\"i\":0}}]}&#39;>&lt;a href=\"#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Transclusion mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=&#39;{\"group\":\"\",\"name\":\"\",\"content\":\"foo\",\"hasRefInRef\":false,\"dsr\":[64,96,null,null],\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;lt;ref>{{echo|foo}}&amp;lt;/ref>\"}},\"i\":0}}]}&#39;/>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14577
14578 <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>
14579 !! end
14580
14581 ###
14582 ### Subpages
14583 ###
14584 !! article
14585 Subpage test/subpage
14586 !! text
14587 foo
14588 !! endarticle
14589
14590 !! test
14591 Subpage link
14592 !! options
14593 subpage title=[[Subpage test]]
14594 !! wikitext
14595 [[/subpage]]
14596 !! html
14597 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14598 </p>
14599 !! end
14600
14601 !! test
14602 Subpage noslash link
14603 !! options
14604 subpage title=[[Subpage test]]
14605 !! wikitext
14606 [[/subpage/]]
14607 !! html
14608 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14609 </p>
14610 !! end
14611
14612 !! article
14613 Subpage test/1/2/subpage
14614 !! text
14615 blah
14616 !! endarticle
14617
14618 !! test
14619 Relative subpage noslash link
14620 !! options
14621 parsoid=wt2wt,wt2html,html2html
14622 subpage title=[[Subpage test/1/2/3/4]]
14623 !! wikitext
14624 [[../../subpage/]]
14625
14626 [[../../subpage]]
14627 !! html/php
14628 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14629 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14630 </p>
14631 !! html/parsoid
14632 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14633 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14634 !! end
14635
14636 !! test
14637 Parsoid: dot-slash prefixed wikilinks
14638 !! wikitext
14639 [[./foo]]
14640
14641 [[././bar]]
14642
14643 [[././baz/]]
14644 !! html/php
14645 <p>[[./foo]]
14646 </p><p>[[././bar]]
14647 </p><p>[[././baz/]]
14648 </p>
14649 !! html/parsoid
14650 <p>[[./foo]]
14651 </p><p>[[././bar]]
14652 </p><p>[[././baz/]]
14653 </p>
14654 !! end
14655
14656 !! test
14657 Render invalid page names as plain text (bug 51090)
14658 !! wikitext
14659 [[./../foo|bar]]
14660 [[foo�|bar]]
14661 [[foo/.|bar]]
14662 [[foo/..|bar]]
14663 [[foo~~~bar]]
14664 [[foo>bar]]
14665 [[foo[bar]]
14666 [[.]]
14667 [[..]]
14668 [[foo././bar]]
14669
14670 [[{{echo|./../foo}}|bar]]
14671 [[{{echo|foo/.}}|bar]]
14672 [[{{echo|foo/..}}|bar]]
14673 [[{{echo|foo~~~~bar}}]]
14674 [[{{echo|foo>bar}}]]
14675 [[{{echo|foo././bar}}]]
14676 [[{{echo|foo{bar}}]]
14677 [[{{echo|foo}bar}}]]
14678 [[{{echo|foo[bar}}]]
14679 [[{{echo|foo]bar}}]]
14680 [[{{echo|foo<bar}}]]
14681 !!html/php
14682 <p>[[./../foo|bar]]
14683 [[foo�|bar]]
14684 [[foo/.|bar]]
14685 [[foo/..|bar]]
14686 [[foo~~~bar]]
14687 [[foo&gt;bar]]
14688 [[foo[bar]]
14689 [[.]]
14690 [[..]]
14691 [[foo././bar]]
14692 </p><p>[[./../foo|bar]]
14693 [[foo/.|bar]]
14694 [[foo/..|bar]]
14695 [[foo~~~~bar]]
14696 [[foo&gt;bar]]
14697 [[foo././bar]]
14698 [[foo{bar]]
14699 [[foo}bar]]
14700 [[foo[bar]]
14701 [[foo]bar]]
14702 [[foo&lt;bar]]
14703 </p>
14704 !!html/parsoid
14705 <p>[[./../foo|bar]]
14706 [[foo�|bar]]
14707 [[foo/.|bar]]
14708 [[foo/..|bar]]
14709 [[foo~~~bar]]
14710 [[foo>bar]]
14711 [[foo[bar]]
14712 [[.]]
14713 [[..]]
14714 [[foo././bar]]</p>
14715
14716 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14717 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14718 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14719 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14720 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14721 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14722 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14723 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14724 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14725 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14726 [[<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>
14727 !!end
14728
14729 !! test
14730 Disabled subpages
14731 !! wikitext
14732 [[/subpage]]
14733 !! html
14734 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14735 </p>
14736 !! end
14737
14738 !! test
14739 BUG 561: {{/Subpage}}
14740 !! options
14741 subpage title=[[Page]]
14742 !! wikitext
14743 {{/Subpage}}
14744 !! html
14745 <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>
14746 </p>
14747 !! end
14748
14749 ###
14750 ### Categories
14751 ###
14752 !! article
14753 Category:MediaWiki User's Guide
14754 !! text
14755 blah
14756 !! endarticle
14757
14758 !! test
14759 Link to category
14760 !! wikitext
14761 [[:Category:MediaWiki User's Guide]]
14762 !! html
14763 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14764 </p>
14765 !! end
14766
14767 !! test
14768 Simple category
14769 !! options
14770 cat
14771 !! wikitext
14772 [[Category:MediaWiki User's Guide]]
14773 !! html/php
14774 cat=MediaWiki_User's_Guide sort=
14775 !! html/parsoid
14776 <link rel="mw:PageProp/Category" href="./Category:MediaWiki_User's_Guide" data-parsoid='{"stx":"simple","a":{"href":"./Category:MediaWiki_User&#39;s_Guide"},"sa":{"href":"Category:MediaWiki User&#39;s Guide"}}'/>
14777 !! end
14778
14779 !! test
14780 PAGESINCATEGORY invalid title fatal (r33546 fix)
14781 !! wikitext
14782 {{PAGESINCATEGORY:<bogus>}}
14783 !! html
14784 <p>0
14785 </p>
14786 !! end
14787
14788 !! test
14789 Category with different sort key
14790 !! options
14791 cat
14792 !! wikitext
14793 [[Category:MediaWiki User's Guide|Foo]]
14794 !! html/php
14795 cat=MediaWiki_User's_Guide sort=Foo
14796 !! html/parsoid
14797 <link rel="mw:PageProp/Category" href="./Category:MediaWiki_User's_Guide#Foo" data-parsoid='{"stx":"piped","a":{"href":"./Category:MediaWiki_User&#39;s_Guide"},"sa":{"href":"Category:MediaWiki User&#39;s Guide"}}'/>
14798 !! end
14799
14800 !! test
14801 Category with identical sort key
14802 !! options
14803 cat
14804 !! wikitext
14805 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14806 !! html/php
14807 cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
14808 !! html/parsoid
14809 <link rel="mw:PageProp/Category" href="./Category:MediaWiki_User's_Guide#MediaWiki%20User's%20Guide" data-parsoid='{"stx":"piped","a":{"href":"./Category:MediaWiki_User&#39;s_Guide"},"sa":{"href":"Category:MediaWiki User&#39;s Guide"}}'/>
14810 !! end
14811
14812 !! test
14813 Category with empty sort key
14814 !! options
14815 cat
14816 pst
14817 !! wikitext
14818 [[Category:MediaWiki User's Guide|]]
14819 !! html/php
14820 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14821 !! end
14822
14823 !! test
14824 Category with empty sort key and parentheses
14825 !! options
14826 cat
14827 pst
14828 !! wikitext
14829 [[Category:Foo (bar)|]]
14830 !! html/php
14831 [[Category:Foo (bar)|Foo]]
14832 !! end
14833
14834 !! test
14835 Category with link tail
14836 !! options
14837 cat
14838 pst
14839 !! wikitext
14840 123[[Category:Foo]]456
14841 !! html/php
14842 123[[Category:Foo]]456
14843 !! end
14844
14845 !! test
14846 Category with template
14847 !! options
14848 cat
14849 pst
14850 !! wikitext
14851 [[Category:{{echo|Foo}}]]
14852 !! html/php
14853 [[Category:{{echo|Foo}}]]
14854 !! end
14855
14856 !! test
14857 Category with template in sort key
14858 !! options
14859 cat
14860 pst
14861 !! wikitext
14862 [[Category:Foo|{{echo|Bar}}]]
14863 !! html/php
14864 [[Category:Foo|{{echo|Bar}}]]
14865 !! end
14866
14867 !! test
14868 Category with template in sort key and title
14869 !! options
14870 cat
14871 pst
14872 !! wikitext
14873 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14874 !! html/php
14875 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14876 !! end
14877
14878 ## We used to, but no longer wt2wt this test since the default serializer
14879 ## will normalize all categories to serialize on their own line.
14880 ## This wikitext usage is going to be fairly uncommon in production and
14881 ## selser will take care of preserving formatting in those scenarios.
14882 !! test
14883 Category / paragraph interactions
14884 !! options
14885 parsoid=wt2html
14886 !! wikitext
14887 Foo [[Category:Baz]] Bar
14888
14889 Foo [[Category:Baz]]
14890 Bar
14891
14892 Foo
14893 [[Category:Baz]]
14894 Bar
14895
14896 Foo
14897 [[Category:Baz]] Bar
14898
14899 Foo
14900 [[Category:Baz]]
14901 [[Category:Baz]]
14902 [[Category:Baz]]
14903 Bar
14904
14905 [[Category:Baz]]
14906 [[Category:Baz]]
14907 [[Category:Baz]]
14908
14909 [[Category:Baz]]
14910 {{echo|[[Category:Baz]]}}
14911 [[Category:Baz]]
14912 !! html/php
14913 <p>Foo Bar
14914 </p><p>Foo
14915 Bar
14916 </p><p>Foo
14917 Bar
14918 </p><p>Foo Bar
14919 </p><p>Foo
14920 Bar
14921 </p>
14922 !! html/parsoid
14923 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14924 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14925 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14926 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14927 <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>
14928 <link rel="mw:PageProp/Category" href="Category:Baz"/>
14929 !! end
14930
14931 ## We used to, but no longer wt2wt this test since the default serializer
14932 ## will normalize all categories to serialize on their own line.
14933 ## This wikitext usage is going to be fairly uncommon in production and
14934 ## selser will take care of preserving formatting in those scenarios.
14935 ##
14936 ## The whitespace on the empty line is part of the test. Please do not delete
14937 !! test
14938 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14939 !! options
14940 parsoid=wt2html
14941 !! wikitext
14942 This
14943
14944 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14945
14946 {{echo|[[Category:Foo]] and so should this!}}
14947 !! html/php
14948 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14949 </p>
14950 !! html/parsoid
14951 <p>This
14952
14953 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14954
14955 <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>
14956 !! end
14957
14958 ## Parsoid will not try to wt2wt this while preserving newlines because
14959 ## it suppresses excess newlines within list items -- and we don't want to
14960 ## introduce a special case just for categories, which is, in reality somewhat
14961 ## odd behavior -- categories are unlikely to be used in list items like this
14962 ## in top-level pages and are only likely to show up in template-generated
14963 ## list items where this RT-ing is a non-issue.
14964 ##
14965 ## The whitespace on the empty line is part of the test. Please do not delete
14966 !! test
14967 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14968 !! options
14969 parsoid=wt2html
14970 !! wikitext
14971 * This
14972
14973 [[Category:Foo]] and this should be part of the same list item
14974 * So should this
14975
14976 {{echo|[[Category:Foo]] and this should be part of the same list item}}
14977 !! html
14978 <ul><li>This and this should be part of the same list item</li>
14979 <li>So should this and this should be part of the same list item</li></ul>
14980 !! html/parsoid
14981 <ul>
14982 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
14983 <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>
14984 </ul>
14985 !! end
14986
14987 ## Newlines and categories that follow the last item of a list
14988 ## are treated differently because this (list followed by categories)
14989 ## is an extremely common pattern on wikis.
14990 !! test
14991 3. Categories and newlines: newline suppression for last list item should RT properly
14992 !! wikitext
14993 * a
14994 * b
14995
14996 [[Category:Foo]]
14997
14998 [[Category:Bar]]
14999 [[Category:Baz]]
15000 !! html/parsoid
15001 <ul><li> a</li>
15002 <li> b</li></ul>
15003
15004 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15005
15006 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15007 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15008 !! end
15009
15010 !! test
15011 4. Categories and newlines: newline suppression for last list item should RT properly
15012 !! wikitext
15013 * a
15014 **** b
15015
15016 [[Category:Foo]]
15017 !! html/parsoid
15018 <ul><li> a
15019 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
15020
15021 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15022 !! end
15023
15024 ## only wt2html for this to make sure the algo only applies to the rightmost path
15025 !! test
15026 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
15027 !! options
15028 parsoid=wt2html
15029 !! wikitext
15030 * a
15031 ** b
15032 [[Category:Foo]]
15033 * c
15034 ** d
15035 [[Category:Foo]]
15036 !! html/parsoid
15037 <ul><li> a
15038 <ul><li> b
15039 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
15040 <li> c
15041 <ul><li> d</li></ul></li></ul>
15042 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
15043 !! end
15044
15045 ## We used to, but no longer wt2wt this test since the default serializer
15046 ## will normalize all categories to serialize on their own line.
15047 ## This wikitext usage is going to be fairly uncommon in production and
15048 ## selser will take care of preserving formatting in those scenarios.
15049 !! test
15050 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
15051 !! options
15052 parsoid=wt2html
15053 !! wikitext
15054 * a [[Category:Foo]]
15055 !! html/parsoid
15056 <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>
15057 !! end
15058
15059 # This test also demonstrates because of newline+category tunneling
15060 # through the list hander, template wrapping doesn't expand to the
15061 # containing list when the list item swallows the category.
15062 !! test
15063 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
15064 !! wikitext
15065 * {{echo|a
15066 [[Category:Foo]]}}
15067 !! html/parsoid
15068 <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
15069 </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>
15070 !! end
15071
15072 !! test
15073 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
15074 !! wikitext
15075 * a
15076
15077 {{echo|[[Category:Foo]]
15078 [[Category:Bar]]}}
15079 [[Category:Baz]]
15080 !! html/parsoid
15081 <ul><li> a</li></ul>
15082
15083 <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">
15084 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
15085 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
15086 !! end
15087
15088 !! test
15089 Category links with multiple namespaces
15090 !! wikitext
15091 [[Category:Project:Foo]]
15092 !! html/parsoid
15093 <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
15094 !! end
15095
15096 !! test
15097 Parsoid: Serialize link to category page with colon escape
15098 !! options
15099 parsoid
15100 !! wikitext
15101
15102 [[:Category:Foo]]
15103 [[:Category:Foo|Bar]]
15104 !! html
15105 <p>
15106 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
15107 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
15108 </p>
15109 !! end
15110
15111 # We used to, but no longer wt2wt this test since the default serializer
15112 # will normalize all categories to serialize on their own line.
15113 # This wikitext usage is going to be fairly uncommon in production and
15114 # selser will take care of preventing whitespace insertion if this
15115 # occurs in an article.
15116 #
15117 # html2html disabled for the same reason (whitespace insertion between
15118 # x and y).
15119 #
15120 # html2wt disabled because it localizes the "Category" namespace.
15121 !! test
15122 Link prefix/suffixes aren't applied to category links
15123 !! options
15124 parsoid=wt2html
15125 language=is
15126 !! wikitext
15127 x[[Category:Foo]]y
15128 !! html/php
15129 <p>xy
15130 </p>
15131 !! html/parsoid
15132 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
15133 !! end
15134
15135 !! test
15136 Parsoid: Serialize link to file page with colon escape
15137 !! options
15138 parsoid
15139 !! wikitext
15140
15141 [[:File:Foo.png]]
15142 [[:File:Foo.png|Bar]]
15143 !! html
15144 <p>
15145 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
15146 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
15147 </p>
15148 !! end
15149
15150 !! test
15151 Parsoid: Serialize a genuine category link without colon escape
15152 !! options
15153 parsoid
15154 !! wikitext
15155 [[Category:Foo]]
15156 [[Category:Foo|Bar]]
15157 !! html
15158 <link rel="mw:PageProp/Category" href="./Category:Foo">
15159 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
15160 !! end
15161
15162 !! test
15163 Normalize hrefs properly before testing for invalid link targets (bug 70894)
15164 !! options
15165 parsoid=html2wt
15166 !! html/parsoid
15167 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
15168 !! wikitext
15169 [[Category:Toxine bactérienne]]
15170 !! end
15171
15172 !! test
15173 Parsoid: Defaultsort
15174 !! wikitext
15175 {{DEFAULTSORT:Foo}}
15176 !! html/parsoid
15177 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
15178 !! end
15179
15180 !! test
15181 Parsoid: Defaultsort (template-generated)
15182 !! wikitext
15183 {{{{echo|DEFAULTSORT}}:Foo}}
15184 !! html/parsoid
15185 <meta property="mw:PageProp/categorydefaultsort" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DEFAULTSORT}}:Foo"},"params":{},"i":0}}]}'/>
15186 !! end
15187
15188 ###
15189 ### Inter-language links
15190 ###
15191 !! test
15192 Interlanguage links
15193 !! options
15194 ill
15195 !! wikitext
15196 [[es:Alimento]]
15197 [[fr:Nourriture]]
15198 [[zh:食品]]
15199 !! html/php
15200 es:Alimento fr:Nourriture zh:食品
15201 !! html/parsoid
15202 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
15203 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
15204 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
15205 !! end
15206
15207 !! test
15208 Duplicate interlanguage links (bug 24502)
15209 !! options
15210 ill
15211 !! wikitext
15212 [[es:1]]
15213 [[es:2]]
15214 [[fr:1]]
15215 [[fr:2]]
15216 !! html/php
15217 es:1 fr:1
15218 !! html/parsoid
15219 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
15220 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
15221 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
15222 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
15223 !! end
15224
15225 ###
15226 ### Sections
15227 ###
15228 !! test
15229 Basic section headings
15230 !! wikitext
15231 == Headline 1 ==
15232 Some text
15233
15234 ==Headline 2==
15235 More
15236 ===Smaller headline===
15237 Blah blah
15238 !! html
15239 <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>
15240 <p>Some text
15241 </p>
15242 <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>
15243 <p>More
15244 </p>
15245 <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>
15246 <p>Blah blah
15247 </p>
15248 !! end
15249
15250 !! test
15251 Section headings with TOC
15252 !! wikitext
15253 == Headline 1 ==
15254 === Subheadline 1 ===
15255 ===== Skipping a level =====
15256 ====== Skipping a level ======
15257
15258 == Headline 2 ==
15259 Some text
15260 ===Another headline===
15261 !! html
15262 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15263 <ul>
15264 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
15265 <ul>
15266 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
15267 <ul>
15268 <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>
15269 <ul>
15270 <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>
15271 </ul>
15272 </li>
15273 </ul>
15274 </li>
15275 </ul>
15276 </li>
15277 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
15278 <ul>
15279 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
15280 </ul>
15281 </li>
15282 </ul>
15283 </div>
15284
15285 <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>
15286 <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>
15287 <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>
15288 <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>
15289 <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>
15290 <p>Some text
15291 </p>
15292 <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>
15293
15294 !! end
15295
15296 !! test
15297 TOC anchors don't collide
15298 !! wikitext
15299 __FORCETOC__
15300 == Headline 2 ==
15301 == Headline ==
15302 == Headline 2 ==
15303 == Headline ==
15304 !! html/php
15305 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15306 <ul>
15307 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
15308 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
15309 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
15310 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
15311 </ul>
15312 </div>
15313
15314 <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>
15315 <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>
15316 <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>
15317 <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>
15318
15319 !! end
15320
15321 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
15322 !! test
15323 Handling of sections up to level 6 and beyond
15324 !! wikitext
15325 = Level 1 Heading=
15326 == Level 2 Heading==
15327 === Level 3 Heading===
15328 ==== Level 4 Heading====
15329 ===== Level 5 Heading=====
15330 ====== Level 6 Heading======
15331 ======= Level 7 Heading=======
15332 ======== Level 8 Heading========
15333 ========= Level 9 Heading=========
15334 ========== Level 10 Heading==========
15335 !! html
15336 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15337 <ul>
15338 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
15339 <ul>
15340 <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>
15341 <ul>
15342 <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>
15343 <ul>
15344 <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>
15345 <ul>
15346 <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>
15347 <ul>
15348 <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>
15349 <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>
15350 <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>
15351 <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>
15352 <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>
15353 </ul>
15354 </li>
15355 </ul>
15356 </li>
15357 </ul>
15358 </li>
15359 </ul>
15360 </li>
15361 </ul>
15362 </li>
15363 </ul>
15364 </div>
15365
15366 <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>
15367 <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>
15368 <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>
15369 <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>
15370 <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>
15371 <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>
15372 <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>
15373 <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>
15374 <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>
15375 <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>
15376
15377 !! end
15378
15379 !! test
15380 TOC regression (T11764)
15381 !! wikitext
15382 == title 1 ==
15383 === title 1.1 ===
15384 ==== title 1.1.1 ====
15385 === title 1.2 ===
15386 == title 2 ==
15387 === title 2.1 ===
15388 !! html
15389 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15390 <ul>
15391 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15392 <ul>
15393 <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>
15394 <ul>
15395 <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>
15396 </ul>
15397 </li>
15398 <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>
15399 </ul>
15400 </li>
15401 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15402 <ul>
15403 <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>
15404 </ul>
15405 </li>
15406 </ul>
15407 </div>
15408
15409 <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>
15410 <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>
15411 <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>
15412 <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>
15413 <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>
15414 <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>
15415
15416 !! end
15417
15418 !! test
15419 TOC for heading containing <span id="..."></span> (T96153)
15420 !! wikitext
15421 __FORCETOC__
15422 ==<span id="old-anchor"></span>New title==
15423 !! html/php
15424 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15425 <ul>
15426 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
15427 </ul>
15428 </div>
15429
15430 <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>
15431
15432 !! end
15433
15434 !! test
15435 TOC with wgMaxTocLevel=3 (bug 6204)
15436 !! options
15437 wgMaxTocLevel=3
15438 !! wikitext
15439 == title 1 ==
15440 === title 1.1 ===
15441 ==== title 1.1.1 ====
15442 === title 1.2 ===
15443 == title 2 ==
15444 === title 2.1 ===
15445 !! html
15446 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15447 <ul>
15448 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15449 <ul>
15450 <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>
15451 <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>
15452 </ul>
15453 </li>
15454 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
15455 <ul>
15456 <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>
15457 </ul>
15458 </li>
15459 </ul>
15460 </div>
15461
15462 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
15463 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
15464 <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>
15465 <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>
15466 <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>
15467 <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>
15468
15469 !! end
15470
15471 !! test
15472 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
15473 !! options
15474 wgMaxTocLevel=3
15475 !! wikitext
15476 ==Section 1==
15477 ===Section 1.1===
15478 ====Section 1.1.1====
15479 ====Section 1.1.1.1====
15480 ==Section 2==
15481 !! html
15482 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15483 <ul>
15484 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
15485 <ul>
15486 <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>
15487 </ul>
15488 </li>
15489 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
15490 </ul>
15491 </div>
15492
15493 <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>
15494 <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>
15495 <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>
15496 <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>
15497 <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>
15498
15499 !! end
15500
15501
15502 !! test
15503 Resolving duplicate section names
15504 !! wikitext
15505 == Foo bar ==
15506 == Foo bar ==
15507 !! html
15508 <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>
15509 <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>
15510
15511 !! end
15512
15513 !! test
15514 Resolving duplicate section names with differing case (bug 10721)
15515 !! wikitext
15516 == Foo bar ==
15517 == Foo Bar ==
15518 !! html
15519 <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>
15520 <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>
15521
15522 !! end
15523
15524 !! article
15525 Template:sections
15526 !! text
15527 ===Section 1===
15528 ==Section 2==
15529 !! endarticle
15530
15531 !! test
15532 Template with sections, __NOTOC__
15533 !! wikitext
15534 __NOTOC__
15535 ==Section 0==
15536 {{sections}}
15537 ==Section 4==
15538 !! html
15539 <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>
15540 <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>
15541 <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>
15542 <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>
15543
15544 !! end
15545
15546 !! test
15547 __NOEDITSECTION__ keyword
15548 !! wikitext
15549 __NOEDITSECTION__
15550 ==Section 1==
15551 ==Section 2==
15552 !! html
15553 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15554 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15555
15556 !! end
15557
15558 !! test
15559 Link inside a section heading
15560 !! wikitext
15561 ==Section with a [[Main Page|link]] in it==
15562 !! html
15563 <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>
15564
15565 !! end
15566
15567 !! test
15568 TOC regression (T14077)
15569 !! wikitext
15570 __TOC__
15571 == title 1 ==
15572 === title 1.1 ===
15573 == title 2 ==
15574 !! html
15575 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15576 <ul>
15577 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15578 <ul>
15579 <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>
15580 </ul>
15581 </li>
15582 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15583 </ul>
15584 </div>
15585
15586 <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>
15587 <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>
15588 <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>
15589
15590 !! end
15591
15592 !! test
15593 BUG 1219 URL next to image (good)
15594 !! wikitext
15595 http://example.com [[File:Foobar.jpg]]
15596 !! html/php
15597 <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>
15598 </p>
15599 !! html/parsoid
15600 <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>
15601 !!end
15602
15603 !! test
15604 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
15605 !! wikitext
15606 ===
15607 The line above must have a trailing space!
15608 === <!--
15609 --> <!-- -->
15610 But just in case it doesn't...
15611 !! html
15612 <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>
15613 <p>The line above must have a trailing space!
15614 </p>
15615 <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>
15616 <p>But just in case it doesn't...
15617 </p>
15618 !! end
15619
15620 !! test
15621 Header with special characters (bug 25462)
15622 !! wikitext
15623 The tooltips shall not show entities to the user (ie. be double escaped)
15624
15625 == text > text ==
15626 section 1
15627
15628 == text < text ==
15629 section 2
15630
15631 == text & text ==
15632 section 3
15633
15634 == text ' text ==
15635 section 4
15636
15637 == text " text ==
15638 section 5
15639 !! html
15640 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15641 </p>
15642 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15643 <ul>
15644 <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>
15645 <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>
15646 <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>
15647 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15648 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15649 </ul>
15650 </div>
15651
15652 <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>
15653 <p>section 1
15654 </p>
15655 <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>
15656 <p>section 2
15657 </p>
15658 <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>
15659 <p>section 3
15660 </p>
15661 <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>
15662 <p>section 4
15663 </p>
15664 <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>
15665 <p>section 5
15666 </p>
15667 !! end
15668
15669 !! test
15670 Header with space, plus and underscore as entity
15671 !! wikitext
15672 Id should not contain + for spaces
15673
15674 == Space between Text ==
15675 section 1
15676
15677 == Space-Entity&#32;between&#32;Text ==
15678 section 2
15679
15680 == Plus+between+Text ==
15681 section 3
15682
15683 == Plus-Entity&#43;between&#43;Text ==
15684 section 4
15685
15686 == Underscore_between_Text ==
15687 section 5
15688
15689 == Underscore-Entity&#95;between&#95;Text ==
15690 section 6
15691
15692 [[#Space between Text]]
15693 [[#Space-Entity&#32;between&#32;Text]]
15694 [[#Plus+between+Text]]
15695 [[#Plus-Entity&#43;between&#43;Text]]
15696 [[#Underscore_between_Text]]
15697 [[#Underscore-Entity&#95;between&#95;Text]]
15698 !! html
15699 <p>Id should not contain + for spaces
15700 </p>
15701 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15702 <ul>
15703 <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>
15704 <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>
15705 <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>
15706 <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>
15707 <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>
15708 <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>
15709 </ul>
15710 </div>
15711
15712 <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>
15713 <p>section 1
15714 </p>
15715 <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>
15716 <p>section 2
15717 </p>
15718 <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>
15719 <p>section 3
15720 </p>
15721 <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>
15722 <p>section 4
15723 </p>
15724 <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>
15725 <p>section 5
15726 </p>
15727 <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>
15728 <p>section 6
15729 </p><p><a href="#Space_between_Text">#Space between Text</a>
15730 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15731 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15732 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15733 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15734 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15735 </p>
15736 !! end
15737
15738 !! test
15739 Headers with excess '=' characters
15740 (Are similar tests necessary beyond the 1st level?)
15741 !! wikitext
15742 =foo==
15743 ==foo=
15744 =''italic'' heading==
15745 ==''italic'' heading=
15746 !! html
15747 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15748 <ul>
15749 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15750 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15751 <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>
15752 <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>
15753 </ul>
15754 </div>
15755
15756 <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>
15757 <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>
15758 <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>
15759 <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>
15760
15761 !! end
15762
15763 !! test
15764 HTML headers vs TOC (bug 23393)
15765 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15766 !! wikitext
15767 <h1>Header 1</h1>
15768 == Header 1.1 ==
15769 == Header 1.2 ==
15770
15771 <h1>Header 2
15772 </h1>
15773 == Header 2.1 ==
15774 == Header 2.2 ==
15775 __NOEDITSECTION__
15776 !! html
15777 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15778 <ul>
15779 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15780 <ul>
15781 <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>
15782 <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>
15783 </ul>
15784 </li>
15785 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15786 <ul>
15787 <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>
15788 <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>
15789 </ul>
15790 </li>
15791 </ul>
15792 </div>
15793
15794 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15795 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15796 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15797 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15798 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15799 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15800
15801 !! end
15802
15803 !! test
15804 Single-line or multiline-comments can follow headings
15805 !! options
15806 parsoid=wt2html,wt2wt
15807 !! wikitext
15808 ==foo==<!---->
15809 ==bar==<!--c1-->
15810 ==baz==<!--
15811 c2
15812 c3-->
15813 !! html
15814 <h2><span class="mw-headline" id="foo">foo</span></h2>
15815 <h2><span class="mw-headline" id="bar">bar</span></h2>
15816 <h2><span class="mw-headline" id="baz">baz</span></h2>
15817
15818 !! end
15819
15820 !! test
15821 BUG 1219 URL next to image (broken)
15822 !! wikitext
15823 http://example.com[[File:Foobar.jpg]]
15824 !! html/php
15825 <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>
15826 </p>
15827 !! html/parsoid
15828 <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>
15829 !!end
15830
15831 !! test
15832 Bug 1186 news: in the middle of text
15833 !! wikitext
15834 http://en.wikinews.org/wiki/Wikinews:Workplace
15835 !! html
15836 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15837 </p>
15838 !!end
15839
15840
15841 !! test
15842 Namespaced link must have a title
15843 !! wikitext
15844 [[Project:]]
15845 !! html
15846 <p>[[Project:]]
15847 </p>
15848 !!end
15849
15850 !! test
15851 Namespaced link must have a title (bad fragment version)
15852 !! wikitext
15853 [[Project:#fragment]]
15854 !! html
15855 <p>[[Project:#fragment]]
15856 </p>
15857 !!end
15858
15859
15860 ###
15861 ### HTML tags and HTML attributes
15862 ###
15863
15864 !! test
15865 div with no attributes
15866 !! wikitext
15867 <div>HTML rocks</div>
15868 !! html
15869 <div>HTML rocks</div>
15870
15871 !! end
15872
15873 !! test
15874 div with double-quoted attribute
15875 !! wikitext
15876 <div id="rock">HTML rocks</div>
15877 !! html
15878 <div id="rock">HTML rocks</div>
15879
15880 !! end
15881
15882 !! test
15883 div with single-quoted attribute
15884 !! wikitext
15885 <div id='rock'>HTML rocks</div>
15886 !! html
15887 <div id="rock">HTML rocks</div>
15888
15889 !! end
15890
15891 !! test
15892 div with unquoted attribute
15893 !! wikitext
15894 <div id=rock>HTML rocks</div>
15895 !! html
15896 <div id="rock">HTML rocks</div>
15897
15898 !! end
15899
15900 !! test
15901 div with illegal double attributes
15902 !! wikitext
15903 <div id="a" id="b">HTML rocks</div>
15904 !! html
15905 <div id="b">HTML rocks</div>
15906
15907 !!end
15908
15909 !! test
15910 div with empty attribute value, space before equals
15911 !! options
15912 parsoid=wt2html,html2html
15913 !! wikitext
15914 <div class =>HTML rocks</div>
15915 !! html/php
15916 <div class="">HTML rocks</div>
15917
15918 !! html/parsoid
15919 <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15920 !! end
15921
15922 !! test
15923 div with multiple empty attribute values
15924 !! options
15925 parsoid=wt2html,html2html
15926 !! wikitext
15927 <div id= title=>HTML rocks</div>
15928 !! html/php
15929 <div id="title.3D">HTML rocks</div>
15930
15931 !! html/parsoid
15932 <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
15933 !! end
15934
15935 !! test
15936 table with multiple empty attribute values
15937 !! options
15938 parsoid=wt2html,html2html
15939 !! wikitext
15940 {| title= id=
15941 | hi
15942 |}
15943 !! html/php
15944 <table title="id=">
15945 <tr>
15946 <td> hi
15947 </td></tr></table>
15948
15949 !! html/parsoid
15950 <table title="id=">
15951 <tbody><tr><td> hi</td></tr>
15952 </tbody></table>
15953 !! end
15954
15955 !! test
15956 div with braces in attribute value
15957 !! wikitext
15958 <div title="{}">Foo</div>
15959 !! html/php
15960 <div title="&#123;}">Foo</div>
15961
15962 !! html/parsoid
15963 <div title="{}">Foo</div>
15964 !! end
15965
15966 !! test
15967 div with empty attribute value, no space before equals
15968 !! options
15969 parsoid=wt2html,html2html
15970 !! wikitext
15971 <div class=>HTML rocks</div>
15972 !! html/php
15973 <div class="">HTML rocks</div>
15974
15975 !! html/parsoid
15976 <div class="">HTML rocks</div>
15977 !! end
15978
15979 !! test
15980 HTML multiple attributes correction
15981 !! wikitext
15982 <p class="error" class="awesome">Awesome!</p>
15983 !! html
15984 <p class="awesome">Awesome!</p>
15985
15986 !!end
15987
15988 !! test
15989 Table multiple attributes correction
15990 !! wikitext
15991 {|
15992 !+ class="error" class="awesome"| status
15993 |}
15994 !! html
15995 <table>
15996 <tr>
15997 <th class="awesome"> status
15998 </th></tr></table>
15999
16000 !!end
16001
16002 !! test
16003 DIV IN UPPERCASE
16004 !! wikitext
16005 <DIV ID="x">HTML ROCKS</DIV>
16006 !! html
16007 <div id="x">HTML ROCKS</div>
16008
16009 !!end
16010
16011 !! test
16012 Non-ASCII pseudo-tags are rendered as text
16013 !! wikitext
16014 <khyô>
16015 !! html
16016 <p>&lt;khyô&gt;
16017 </p>
16018 !! end
16019
16020 !! test
16021 Pseudo-tag with URL 'name' renders as url link
16022 !! wikitext
16023 <http://example.com/>
16024 !! html
16025 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
16026 </p>
16027 !! end
16028
16029 !! test
16030 text with amp in the middle of nowhere
16031 !! wikitext
16032 Remember AT&T?
16033 !! html
16034 <p>Remember AT&amp;T?
16035 </p>
16036 !! end
16037
16038 !! test
16039 text with character entity: eacute
16040 !! wikitext
16041 I always thought &eacute; was a cute letter.
16042 !! html
16043 <p>I always thought &#233; was a cute letter.
16044 </p>
16045 !! html+tidy
16046 <p>I always thought é was a cute letter.</p>
16047 !! end
16048
16049 !! test
16050 text with entity-escaped character entity-like string: eacute
16051 !! wikitext
16052 I always thought &amp;eacute; was a cute letter.
16053 !! html
16054 <p>I always thought &amp;eacute; was a cute letter.
16055 </p>
16056 !! end
16057
16058 !! test
16059 text with undefined character entity: xacute
16060 !! wikitext
16061 I always thought &xacute; was a cute letter.
16062 !! html
16063 <p>I always thought &amp;xacute; was a cute letter.
16064 </p>
16065 !! end
16066
16067 !! test
16068 HTML5 tags
16069 !! wikitext
16070 <data value="5">five</data>
16071 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16072 <mark>This highlighted text</mark>
16073 !! html
16074 <p><data value="5">five</data>
16075 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
16076 <mark>This highlighted text</mark>
16077 </p>
16078 !! end
16079
16080 !! test
16081 HTML tag with leading space is parsed as text
16082 !! wikitext
16083 < div>foo< /div>
16084 !! html
16085 <p>&lt; div&gt;foo&lt; /div&gt;
16086 </p>
16087 !! end
16088
16089 ###
16090 ### Nesting tests (see bug 41545, 50604, 51081)
16091 ###
16092
16093 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
16094 # Note that html2wt is considerably more difficult if we use <b> in
16095 # the test case, instead of <big>
16096 !! test
16097 Ensure that HTML adoption agency algorithm is properly implemented.
16098 !! wikitext
16099 <big>X<big>Y</big>Z</big>
16100 !! html
16101 <p><big>X<big>Y</big>Z</big>
16102 </p>
16103 !! end
16104
16105 # This was bug 41545 in the PHP parser.
16106 # Note that tidy doesn't handle this correctly.
16107 !! test
16108 Nesting of <kbd>
16109 !! wikitext
16110 <kbd>X<kbd>Y</kbd>Z</kbd>
16111 !! html
16112 <p><kbd>X<kbd>Y</kbd>Z</kbd>
16113 </p>
16114 !! end
16115
16116 # The following cases were bug 51081 in the PHP parser.
16117 # Note that there are some other nestable tags (b, i, etc) which are
16118 # not covered; see bug 51081 for discussion.
16119
16120 # Note that tidy doesn't handle this correctly.
16121 !! test
16122 Nesting of <em>
16123 !! wikitext
16124 <em>X<em>Y</em>Z</em>
16125 !! html
16126 <p><em>X<em>Y</em>Z</em>
16127 </p>
16128 !! end
16129
16130 # Note that tidy doesn't handle this correctly.
16131 !! test
16132 Nesting of <strong>
16133 !! wikitext
16134 <strong>X<strong>Y</strong>Z</strong>
16135 !! html
16136 <p><strong>X<strong>Y</strong>Z</strong>
16137 </p>
16138 !! end
16139
16140 !! test
16141 Nesting of <q>
16142 !! wikitext
16143 <q>X<q>Y</q>Z</q>
16144 !! html+tidy
16145 <p><q>X<q>Y</q>Z</q></p>
16146 !! end
16147
16148 # Note that tidy doesn't handle this correctly.
16149 !! test
16150 Nesting of <ruby>
16151 !! wikitext
16152 <ruby>X<ruby>Y</ruby>Z</ruby>
16153 !! html
16154 <p><ruby>X<ruby>Y</ruby>Z</ruby>
16155 </p>
16156 !! end
16157
16158 # Note that tidy doesn't handle this correctly.
16159 !! test
16160 Nesting of <bdo>
16161 !! wikitext
16162 <bdo>X<bdo>Y</bdo>Z</bdo>
16163 !! html
16164 <p><bdo>X<bdo>Y</bdo>Z</bdo>
16165 </p>
16166 !! end
16167
16168
16169 ###
16170 ### Media links
16171 ###
16172
16173 !! test
16174 Media link
16175 !! wikitext
16176 [[Media:Foobar.jpg]]
16177 !! html
16178 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
16179 </p>
16180 !! end
16181
16182 !! test
16183 Media link with text
16184 !! wikitext
16185 [[Media:Foobar.jpg|A neat file to look at]]
16186 !! html
16187 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
16188 </p>
16189 !! end
16190
16191 # FIXME: this is still bad HTML tag nesting
16192 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
16193 !! test
16194 Media link with nasty text
16195 !! wikitext
16196 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
16197 !! html
16198 <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>
16199
16200 !! html+tidy
16201 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
16202 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
16203 !! end
16204
16205 !! test
16206 Media link to nonexistent file (bug 1702)
16207 !! wikitext
16208 [[Media:No such.jpg]]
16209 !! html
16210 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
16211 </p>
16212 !! end
16213
16214 !! test
16215 Image link to nonexistent file (bug 1850 - good)
16216 !! wikitext
16217 [[File:No_such.jpg]]
16218 !! html/php
16219 <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>
16220 </p>
16221 !! html/parsoid
16222 <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>
16223 !! end
16224
16225 !! test
16226 :Image link to nonexistent file (bug 1850 - bad)
16227 !! wikitext
16228 [[:Image:No such.jpg]]
16229 !! html/php
16230 <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>
16231 </p>
16232 !! html/parsoid
16233 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
16234 !! end
16235
16236
16237
16238 !! test
16239 Character reference normalization in link text (bug 1938)
16240 !! wikitext
16241 [[Main Page|this&that]]
16242 !! html
16243 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
16244 </p>
16245 !!end
16246
16247 !! article
16248 אַ
16249 !! text
16250 Test for unicode normalization
16251
16252 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
16253 !! endarticle
16254
16255 !! test
16256 (bug 19451) Links should refer to the normalized form.
16257 !! wikitext
16258 [[&#xFB2E;]]
16259 [[&#x5d0;&#x5b7;]]
16260 [[&#x5d0;ַ]]
16261 [[א&#x5b7;]]
16262 [[אַ]]
16263 !! html
16264 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
16265 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
16266 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
16267 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
16268 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
16269 </p>
16270 !! end
16271
16272 !! test
16273 Empty attribute crash test (bug 2067)
16274 !! wikitext
16275 <font color="">foo</font>
16276 !! html
16277 <p><font color="">foo</font>
16278 </p>
16279 !! end
16280
16281 !! test
16282 Empty attribute crash test single-quotes (bug 2067)
16283 !! wikitext
16284 <font color=''>foo</font>
16285 !! html
16286 <p><font color="">foo</font>
16287 </p>
16288 !! end
16289
16290 !! test
16291 Attribute test: equals, then nothing
16292 !! options
16293 parsoid=wt2html,html2html
16294 !! wikitext
16295 <font color=>foo</font>
16296 !! html/php
16297 <p><font color="">foo</font>
16298 </p>
16299 !! html/parsoid
16300 <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
16301 !! end
16302
16303 !! test
16304 Attribute test: unquoted value
16305 !! options
16306 parsoid=wt2html,html2html
16307 !! wikitext
16308 <font color=x>foo</font>
16309 !! html/php
16310 <p><font color="x">foo</font>
16311 </p>
16312 !! html/parsoid
16313 <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
16314 !! end
16315
16316 !! test
16317 Attribute test: unquoted but illegal value (hash)
16318 !! wikitext
16319 <font color=#x>foo</font>
16320 !! html
16321 <p><font color="#x">foo</font>
16322 </p>
16323 !! end
16324
16325 # Parsoid does not serialize to empty attribute syntax,
16326 # so wt2wt and html2wt cases are skipped
16327 !! test
16328 Attribute test: no value (T54330)
16329 !! options
16330 parsoid=wt2html,html2html
16331 !! wikitext
16332 <font color>foo</font>
16333 !! html/php
16334 <p><font color="">foo</font>
16335 </p>
16336 !! html/parsoid
16337 <p><font color="">foo</font></p>
16338 !! end
16339
16340 !! test
16341 Bug 2095: link with three closing brackets
16342 !! wikitext
16343 [[Main Page]]]
16344 !! html/php
16345 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
16346 </p>
16347 !! html/parsoid
16348 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
16349 !! end
16350
16351 !! test
16352 Bug 2095: link with pipe and three closing brackets
16353 !! wikitext
16354 [[Main Page|link]]]
16355 !! html/php
16356 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
16357 </p>
16358 !! html/parsoid
16359 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
16360 !! end
16361
16362 !! test
16363 Bug 2095: link with pipe and three closing brackets, version 2
16364 !! wikitext
16365 [[Main Page|[http://example.com/]]]
16366 !! html/php
16367 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
16368 </p>
16369 !! html/parsoid
16370 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
16371 !! end
16372
16373
16374 ###
16375 ### Safety
16376 ###
16377
16378 !! article
16379 Template:Dangerous attribute
16380 !! text
16381 " onmouseover="alert(document.cookie)
16382 !! endarticle
16383
16384 !! article
16385 Template:Dangerous style attribute
16386 !! text
16387 border-size: expression(alert(document.cookie))
16388 !! endarticle
16389
16390 !! article
16391 Template:Div style
16392 !! text
16393 <div style="float: right; {{{1}}}">Magic div</div>
16394 !! endarticle
16395
16396 !! test
16397 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
16398 !! wikitext
16399 <div title="{{test}}"></div>
16400 !! html
16401 <div title="This is a test template"></div>
16402
16403 !! end
16404
16405 # Parsoid has enough context to handle this case
16406 !! test
16407 Bug 2304: HTML attribute safety (dangerous template; 2309)
16408 !! wikitext
16409 <div title="{{dangerous attribute}}"></div>
16410 !! html/php
16411 <div title=""></div>
16412
16413 !! html/parsoid
16414 <div title='" onmouseover="alert(document.cookie)' about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"title":"\" onmouseover=\"alert(document.cookie)"},"sa":{"title":"{{dangerous attribute}}"}}' data-mw='{"attribs":[[{"txt":"title"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[12,35,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"dangerous attribute\",\"href\":\"./Template:Dangerous_attribute\"},\"params\":{},\"i\":0}}]}&#39;>\" onmouseover=\"alert(document.cookie)&lt;/span>"}]]}'></div>
16415 !! end
16416
16417 !! test
16418 Bug 2304: HTML attribute safety (dangerous style template; 2309)
16419 !! wikitext
16420 <div style="{{dangerous style attribute}}"></div>
16421 !! html
16422 <div style="/* insecure input */"></div>
16423
16424 !! end
16425
16426 !! test
16427 Bug 2304: HTML attribute safety (safe parameter; 2309)
16428 !! wikitext
16429 {{div style|width: 200px}}
16430 !! html
16431 <div style="float: right; width: 200px">Magic div</div>
16432
16433 !! end
16434
16435 !! test
16436 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
16437 !! wikitext
16438 {{div style|width: expression(alert(document.cookie))}}
16439 !! html
16440 <div style="/* insecure input */">Magic div</div>
16441
16442 !! end
16443
16444 !! test
16445 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
16446 !! wikitext
16447 {{div style|"><script>alert(document.cookie)</script>}}
16448 !! html
16449 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16450
16451 !! end
16452
16453 !! test
16454 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
16455 !! wikitext
16456 {{div style|" ><script>alert(document.cookie)</script>}}
16457 !! html
16458 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
16459
16460 !! end
16461
16462 !! test
16463 Bug 2304: HTML attribute safety (link)
16464 !! wikitext
16465 <div title="[[Main Page]]"></div>
16466 !! html
16467 <div title="&#91;&#91;Main Page]]"></div>
16468
16469 !! end
16470
16471 !! test
16472 Bug 2304: HTML attribute safety (italics)
16473 !! wikitext
16474 <div title="''foobar''"></div>
16475 !! html
16476 <div title="&#39;&#39;foobar&#39;&#39;"></div>
16477
16478 !! end
16479
16480 !! test
16481 Bug 2304: HTML attribute safety (bold)
16482 !! wikitext
16483 <div title="'''foobar'''"></div>
16484 !! html
16485 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
16486
16487 !! end
16488
16489
16490 !! test
16491 Bug 2304: HTML attribute safety (ISBN)
16492 !! wikitext
16493 <div title="ISBN 1234567890"></div>
16494 !! html
16495 <div title="&#73;SBN 1234567890"></div>
16496
16497 !! end
16498
16499 !! test
16500 Bug 2304: HTML attribute safety (RFC)
16501 !! wikitext
16502 <div title="RFC 1234"></div>
16503 !! html
16504 <div title="&#82;FC 1234"></div>
16505
16506 !! end
16507
16508 !! test
16509 Bug 2304: HTML attribute safety (PMID)
16510 !! wikitext
16511 <div title="PMID 1234567890"></div>
16512 !! html
16513 <div title="&#80;MID 1234567890"></div>
16514
16515 !! end
16516
16517 !! test
16518 Bug 2304: HTML attribute safety (web link)
16519 !! wikitext
16520 <div title="http://example.com/"></div>
16521 !! html
16522 <div title="http&#58;//example.com/"></div>
16523
16524 !! end
16525
16526 !! test
16527 Bug 2304: HTML attribute safety (named web link)
16528 !! wikitext
16529 <div title="[http://example.com/ link]"></div>
16530 !! html
16531 <div title="&#91;http&#58;//example.com/ link]"></div>
16532
16533 !! end
16534
16535 !! test
16536 Bug 3244: HTML attribute safety (extension; safe)
16537 !! wikitext
16538 <div style="<nowiki>background:blue</nowiki>"></div>
16539 !! html
16540 <div style="background:blue"></div>
16541
16542 !! end
16543
16544 !! test
16545 Bug 3244: HTML attribute safety (extension; unsafe)
16546 !! wikitext
16547 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16548 !! html
16549 <div style="/* insecure input */"></div>
16550
16551 !! end
16552
16553 # More MSIE fun discovered by Tom Gilder
16554
16555 !! test
16556 MSIE CSS safety test: spurious slash
16557 !! wikitext
16558 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16559 !! html
16560 <div style="/* insecure input */">evil</div>
16561
16562 !! end
16563
16564 !! test
16565 MSIE CSS safety test: hex code
16566 !! wikitext
16567 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16568 !! html
16569 <div style="/* insecure input */">evil</div>
16570
16571 !! end
16572
16573 !! test
16574 MSIE CSS safety test: comment in url
16575 !! wikitext
16576 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16577 !! html
16578 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16579
16580 !! end
16581
16582 !! test
16583 MSIE CSS safety test: comment in expression
16584 !! wikitext
16585 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16586 !! html
16587 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16588
16589 !! end
16590
16591 !! test
16592 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
16593 !! wikitext
16594 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16595 !! html
16596 <p style="/* invalid control char */">A</p>
16597
16598 !! end
16599
16600 !! test
16601 MSIE 6 CSS safety test: Fullwidth (bug 55332)
16602 !! wikitext
16603 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16604 <div style="top:EXPRESSION(alert())">B</div>
16605 !! html
16606 <p style="/* insecure input */">A</p>
16607 <div style="/* insecure input */">B</div>
16608
16609 !! end
16610
16611 !! test
16612 MSIE 6 CSS safety test: IPA extensions (bug 55332)
16613 !! wikitext
16614 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16615 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16616 !! html
16617 <div style="/* insecure input */">A</div>
16618 <p style="/* insecure input */">B</p>
16619
16620 !! end
16621
16622 !! test
16623 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16624 !! wikitext
16625 <div style="background-image:url⁽javascript:alert())">A</div>
16626 <div style="background-image:url₍javascript:alert())">B</div>
16627 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16628 !! html
16629 <div style="/* insecure input */">A</div>
16630 <div style="/* insecure input */">B</div>
16631 <p style="/* insecure input */">C</p>
16632
16633 !! end
16634
16635 # FIXME: Parsoid fails to sanitize this! See T58846.
16636 !! test
16637 Opera -o-link CSS
16638 !! wikitext
16639 <div
16640 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;"
16641 style="-o-link:attr(title);-o-link-source:current">X</div>
16642 !! html
16643 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16644
16645 !! end
16646
16647 !! test
16648 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16649 !! wikitext
16650 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16651 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16652 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16653 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16654 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16655 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16656 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16657 !! html
16658 <p style="/* insecure input */">A</p>
16659 <p style="/* insecure input */">B</p>
16660 <p style="/* insecure input */">C</p>
16661 <p style="/* insecure input */">D</p>
16662 <p style="/* insecure input */">E</p>
16663 <p style="/* insecure input */">F</p>
16664 <p style="/* insecure input */">G</p>
16665
16666 !! end
16667
16668 !! test
16669 Table attribute legitimate extension
16670 !! wikitext
16671 {|
16672 !+ style="<nowiki>color:blue</nowiki>"| status
16673 |}
16674 !! html
16675 <table>
16676 <tr>
16677 <th style="color:blue"> status
16678 </th></tr></table>
16679
16680 !!end
16681
16682 !! test
16683 Table attribute safety
16684 !! wikitext
16685 {|
16686 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16687 |}
16688 !! html
16689 <table>
16690 <tr>
16691 <th style="/* insecure input */"> status
16692 </th></tr></table>
16693
16694 !! end
16695
16696 !! test
16697 CSS line continuation 1
16698 !! wikitext
16699 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16700 !! html
16701 <div style="/* insecure input */"></div>
16702
16703 !! end
16704
16705 !! test
16706 CSS line continuation 2
16707 !! wikitext
16708 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16709 !! html
16710 <div style="/* invalid control char */"></div>
16711
16712 !! end
16713
16714 !! article
16715 Template:Identity
16716 !! text
16717 {{{1}}}
16718 !! endarticle
16719
16720 !! test
16721 Expansion of multi-line templates in attribute values (bug 6255)
16722 !! wikitext
16723 <div style="background: {{identity|#00FF00}}">-</div>
16724 !! html
16725 <div style="background: #00FF00">-</div>
16726
16727 !! end
16728
16729
16730 !! test
16731 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16732 !! wikitext
16733 <div style="background:
16734 #00FF00">-</div>
16735 !! html/php
16736 <div style="background: #00FF00">-</div>
16737
16738 !! html/parsoid
16739 <div style="background:
16740 #00FF00">-</div>
16741 !! end
16742
16743 !! test
16744 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16745 !! wikitext
16746 <div style="background: &#10;#00FF00">-</div>
16747 !! html
16748 <div style="background: &#10;#00FF00">-</div>
16749
16750 !! end
16751
16752 !! test
16753 Tags which are hidden from Tidy cannot pass through the Sanitizer
16754 !! wikitext
16755 <mw:toc><script>alert();</script></mw:toc>
16756 !! html+tidy
16757 <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;</p>
16758 !! end
16759
16760 ###
16761 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16762 ###
16763 !! test
16764 Parser hook: empty input
16765 !! wikitext
16766 <tag></tag>
16767 !! html/php
16768 <pre>
16769 ''
16770 array (
16771 )
16772 </pre>
16773
16774 !! html/parsoid
16775 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16776 !! end
16777
16778 ## Don't expect parsoid to rt this form.
16779 !! test
16780 Parser hook: empty input using terminated empty elements
16781 !! options
16782 parsoid=wt2html,html2html
16783 !! wikitext
16784 <tag/>
16785 !! html/php
16786 <pre>
16787 NULL
16788 array (
16789 )
16790 </pre>
16791
16792 !! html/parsoid
16793 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16794 !! end
16795
16796 !! test
16797 Parser hook: empty input using terminated empty elements (space before)
16798 !! wikitext
16799 <tag />
16800 !! html/php
16801 <pre>
16802 NULL
16803 array (
16804 )
16805 </pre>
16806
16807 !! html/parsoid
16808 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16809 !! end
16810
16811 !! test
16812 Parser hook: basic input
16813 !! wikitext
16814 <tag>input</tag>
16815 !! html/php
16816 <pre>
16817 'input'
16818 array (
16819 )
16820 </pre>
16821
16822 !! html/parsoid
16823 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16824 !! end
16825
16826 ## Don't expect parsoid to rt this form.
16827 !! test
16828 Parser hook: case insensitive
16829 !! options
16830 parsoid=wt2html,html2html
16831 !! wikitext
16832 <TAG>input</TAG>
16833 !! html/php
16834 <pre>
16835 'input'
16836 array (
16837 )
16838 </pre>
16839
16840 !! html/parsoid
16841 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16842 !! end
16843
16844 ## Don't expect parsoid to rt this form.
16845 !! test
16846 Parser hook: case insensitive, redux
16847 !! options
16848 parsoid=wt2html,html2html
16849 !! wikitext
16850 <TaG>input</TAg>
16851 !! html/php
16852 <pre>
16853 'input'
16854 array (
16855 )
16856 </pre>
16857
16858 !! html/parsoid
16859 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16860 !! end
16861
16862 !! test
16863 Parser hook: nested tags
16864 !! wikitext
16865 <tag><tag></tag></tag>
16866 !! html/php
16867 <pre>
16868 '<tag>'
16869 array (
16870 )
16871 </pre>&lt;/tag&gt;
16872
16873 !! html/parsoid
16874 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
16875 !! end
16876
16877 !! test
16878 Parser hook: basic arguments
16879 !! wikitext
16880 <tag width="200" height="100" depth="50" square=""></tag>
16881 !! html/php
16882 <pre>
16883 ''
16884 array (
16885 'width' => '200',
16886 'height' => '100',
16887 'depth' => '50',
16888 'square' => '',
16889 )
16890 </pre>
16891
16892 !! html/parsoid
16893 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16894 !! end
16895
16896 ## Don't expect parsoid to rt this form.
16897 !! test
16898 Parser hook: basic arguments, variations
16899 !! options
16900 parsoid=wt2html,html2html
16901 !! wikitext
16902 <tag width=200 height = "100" depth = '50' square></tag>
16903 !! html/php
16904 <pre>
16905 ''
16906 array (
16907 'width' => '200',
16908 'height' => '100',
16909 'depth' => '50',
16910 'square' => '',
16911 )
16912 </pre>
16913
16914 !! html/parsoid
16915 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16916 !! end
16917
16918 !! test
16919 Parser hook: argument containing a forward slash (bug 5344)
16920 !! wikitext
16921 <tag filename="/tmp/bla"></tag>
16922 !! html/php
16923 <pre>
16924 ''
16925 array (
16926 'filename' => '/tmp/bla',
16927 )
16928 </pre>
16929
16930 !! html/parsoid
16931 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16932 !! end
16933
16934 ## Don't expect parsoid to rt this form.
16935 !! test
16936 Parser hook: empty input using terminated empty elements (bug 2374)
16937 !! options
16938 parsoid=wt2html,html2html
16939 !! wikitext
16940 <tag foo=bar/>text
16941 !! html/php
16942 <pre>
16943 NULL
16944 array (
16945 'foo' => 'bar',
16946 )
16947 </pre>text
16948
16949 !! html/parsoid
16950 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
16951 !! end
16952
16953 ## </tag> should be output literally since there is no matching tag that begins it
16954 ## Don't expect parsoid to rt this form.
16955 !! test
16956 Parser hook: basic arguments using terminated empty elements (bug 2374)
16957 !! options
16958 parsoid=wt2html
16959 !! wikitext
16960 <tag width=200 height = "100" depth = '50' square/>
16961 other stuff
16962 </tag>
16963 !! html/php
16964 <pre>
16965 NULL
16966 array (
16967 'width' => '200',
16968 'height' => '100',
16969 'depth' => '50',
16970 'square' => '',
16971 )
16972 </pre>
16973 <p>other stuff
16974 &lt;/tag&gt;
16975 </p>
16976 !! html/parsoid
16977 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":null}' about="#mwt2"></pre><p>other stuff
16978 &lt;/tag></p>
16979 !! end
16980
16981 ## Don't expect parsoid to rt this form.
16982 !! test
16983 Parser hook: Don't allow unclosed extension tags
16984 !! options
16985 parsoid=wt2html
16986 !! wikitext
16987 test <tag>123
16988
16989 this is a '''test'''
16990 !! html/php
16991 <p>test &lt;tag&gt;123
16992 </p><p>this is a <b>test</b>
16993 </p>
16994 !! html/parsoid
16995 <p>test &lt;tag>123</p>
16996
16997 <p>this is a <b>test</b></p>
16998 !! end
16999
17000 ###
17001 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
17002 ###
17003
17004 !! test
17005 Parser hook: static parser hook not inside a comment
17006 !! wikitext
17007 <statictag>hello, world</statictag>
17008
17009 <statictag action="flush" />
17010 !! html/php
17011 <p><br />
17012 hello, world
17013 </p>
17014 !! html/parsoid
17015 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
17016 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
17017 !! end
17018
17019 !! test
17020 Parser hook: static parser hook inside a comment
17021 !! wikitext
17022 <!-- <statictag>hello, world</statictag> -->
17023 <statictag action="flush" />
17024 !! html/php
17025 <p><br />
17026 </p>
17027 !! html/parsoid
17028 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
17029 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
17030 !! end
17031
17032 # Nested template calls; this case was broken by Parser.php rev 1.506,
17033 # since reverted.
17034
17035 !! article
17036 Template:One-parameter
17037 !! text
17038 (My parameter is: {{{1}}})
17039 !! endarticle
17040
17041 !! article
17042 Template:Map-one-parameter
17043 !! text
17044 {{{{{1}}}|{{{2}}}}}
17045 !! endarticle
17046
17047 !! test
17048 Nested template calls
17049 !! wikitext
17050 {{Map-one-parameter|One-parameter|param}}
17051 !! html
17052 <p>(My parameter is: param)
17053 </p>
17054 !! end
17055
17056
17057 ###
17058 ### Sanitizer
17059 ###
17060
17061 # HTML+Tidy effectively strips out the empty tags completely
17062 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
17063 # which Tidy would have done for the PHP parser had there been content inside it.
17064 !! test
17065 Sanitizer: Closing of open tags
17066 !! wikitext
17067 <s></s><table></table>
17068 !! html
17069 <s></s><table></table>
17070
17071 !! html/parsoid
17072 <p><s></s></p><table></table>
17073 !! end
17074
17075 !! test
17076 Sanitizer: Closing of open but not closed tags
17077 !! wikitext
17078 <s>foo
17079 !! html
17080 <p><s>foo</s>
17081 </p>
17082 !! end
17083
17084 !! test
17085 Sanitizer: Closing of closed but not open tags
17086 !! options
17087 parsoid=wt2html
17088 !! wikitext
17089 </s>
17090 !! html/php+tidy
17091 !! html/parsoid
17092 !! end
17093
17094 !! test
17095 Sanitizer: Closing of closed but not open table tags
17096 !! options
17097 parsoid=wt2html
17098 !! wikitext
17099 Table not started</td></tr></table>
17100 !! html/php+tidy
17101 <p>Table not started</p>
17102 !! html/parsoid
17103 <p>Table not started</p>
17104 !! end
17105
17106 !! test
17107 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
17108 !! wikitext
17109 <span id="æ: v">byte</span>[[#æ: v|backlink]]
17110 !! html
17111 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
17112 </p>
17113 !! end
17114
17115 # In HTML5, the restrictions are that id must contain at least one character,
17116 # and must not contain any space characters.
17117 !! test
17118 Sanitizer: Validating the contents of the id attribute (bug 4515)
17119 !! options
17120 disabled
17121 !! wikitext
17122 <br id="" /><br id="a space" />
17123 !! html
17124 Something ...
17125 !! end
17126
17127 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
17128 !! test
17129 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
17130 !! options
17131 disabled
17132 !! wikitext
17133 <br id="foo" /><br id="foo" />
17134 !! html
17135 Something need to be done. foo-2 ?
17136 !! end
17137
17138 !! test
17139 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
17140 !! wikitext
17141 <div itemscope>
17142 <meta itemprop="hello" content="world">
17143 <meta http-equiv="refresh" content="5">
17144 <meta itemprop="hello" http-equiv="refresh" content="5">
17145 <link itemprop="hello" href="{{SERVER}}">
17146 <link rel="stylesheet" href="{{SERVER}}">
17147 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
17148 </div>
17149 !! html
17150 <div itemscope="">
17151 <p> <meta itemprop="hello" content="world" />
17152 &lt;meta http-equiv="refresh" content="5"&gt;
17153 <meta itemprop="hello" content="5" />
17154 </p>
17155 <link itemprop="hello" href="http&#58;//example.org" />
17156 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
17157 <link itemprop="hello" href="http&#58;//example.org" />
17158 </div>
17159
17160 !! end
17161
17162 !! test
17163 Language converter: output gets cut off unexpectedly (bug 5757)
17164 !! options
17165 language=zh
17166 !! wikitext
17167 this bit is safe: }-
17168
17169 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
17170
17171 then we get cut off here: }-
17172
17173 all additional text is vanished
17174 !! html
17175 <p>this bit is safe: }-
17176 </p><p>but if we add a conversion instance: xxx
17177 </p><p>then we get cut off here: }-
17178 </p><p>all additional text is vanished
17179 </p>
17180 !! end
17181
17182 !! test
17183 Self closed html pairs (bug 5487)
17184 !! options
17185 !! wikitext
17186 <center><font id="bug" />Centered text</center>
17187 <div><font id="bug2" />In div text</div>
17188 !! html
17189 <center>&lt;font id="bug" /&gt;Centered text</center>
17190 <div>&lt;font id="bug2" /&gt;In div text</div>
17191
17192 !! end
17193
17194 #
17195 #
17196 #
17197
17198 !! test
17199 Punctuation: nbsp before exclamation
17200 !! wikitext
17201 C'est grave !
17202 !! html
17203 <p>C'est grave&#160;!
17204 </p>
17205 !! end
17206
17207 !! test
17208 Punctuation: CSS !important (bug 11874)
17209 !! wikitext
17210 <div style="width:50% !important">important</div>
17211 !! html
17212 <div style="width:50% !important">important</div>
17213
17214 !!end
17215
17216 !! test
17217 Punctuation: CSS ! important (bug 11874; with space after)
17218 !! wikitext
17219 <div style="width:50% ! important">important</div>
17220 !! html
17221 <div style="width:50% ! important">important</div>
17222
17223 !!end
17224
17225 !! test
17226 HTML bullet list, closed tags (bug 5497)
17227 !! wikitext
17228 <ul>
17229 <li>One</li>
17230 <li>Two</li>
17231 </ul>
17232 !! html/php
17233 <ul>
17234 <li>One</li>
17235 <li>Two</li>
17236 </ul>
17237
17238 !! html/parsoid
17239 <ul data-parsoid='{"stx":"html"}'>
17240 <li data-parsoid='{"stx":"html"}'>One</li>
17241 <li data-parsoid='{"stx":"html"}'>Two</li>
17242 </ul>
17243
17244 !! end
17245
17246 !! test
17247 HTML bullet list, unclosed tags (bug 5497)
17248 !! wikitext
17249 <ul>
17250 <li>One
17251 <li>Two
17252 </ul>
17253 !! html/php+tidy
17254 <ul>
17255 <li>One</li>
17256 <li>Two</li>
17257 </ul>
17258 !! html/parsoid
17259 <ul data-parsoid='{"stx":"html"}'>
17260 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17261 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17262 </ul>
17263
17264 !! end
17265
17266 !! test
17267 HTML ordered list, closed tags (bug 5497)
17268 !! wikitext
17269 <ol>
17270 <li>One</li>
17271 <li>Two</li>
17272 </ol>
17273 !! html/php
17274 <ol>
17275 <li>One</li>
17276 <li>Two</li>
17277 </ol>
17278
17279 !! html/parsoid
17280 <ol data-parsoid='{"stx":"html"}'>
17281 <li data-parsoid='{"stx":"html"}'>One</li>
17282 <li data-parsoid='{"stx":"html"}'>Two</li>
17283 </ol>
17284
17285 !! end
17286
17287 !! test
17288 HTML ordered list, unclosed tags (bug 5497)
17289 !! options
17290 !! wikitext
17291 <ol>
17292 <li>One
17293 <li>Two
17294 </ol>
17295 !! html/php+tidy
17296 <ol>
17297 <li>One</li>
17298 <li>Two</li>
17299 </ol>
17300 !! html/parsoid
17301 <ol data-parsoid='{"stx":"html"}'>
17302 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
17303 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
17304 </ol>
17305
17306 !! end
17307
17308 !! test
17309 HTML nested bullet list, closed tags (bug 5497)
17310 !! wikitext
17311 <ul>
17312 <li>One</li>
17313 <li>Two:
17314 <ul>
17315 <li>Sub-one</li>
17316 <li>Sub-two</li>
17317 </ul>
17318 </li>
17319 </ul>
17320 !! html/php
17321 <ul>
17322 <li>One</li>
17323 <li>Two:
17324 <ul>
17325 <li>Sub-one</li>
17326 <li>Sub-two</li>
17327 </ul>
17328 </li>
17329 </ul>
17330
17331 !! html/parsoid
17332 <ul data-parsoid='{"stx":"html"}'>
17333 <li data-parsoid='{"stx":"html"}'>One</li>
17334 <li data-parsoid='{"stx":"html"}'>Two:
17335 <ul data-parsoid='{"stx":"html"}'>
17336 <li data-parsoid='{"stx":"html"}'>Sub-one</li>
17337 <li data-parsoid='{"stx":"html"}'>Sub-two</li>
17338 </ul>
17339 </li>
17340 </ul>
17341 !! end
17342
17343 !! test
17344 HTML nested bullet list, open tags (bug 5497)
17345 !! wikitext
17346 <ul>
17347 <li>One
17348 <li>Two:
17349 <ul>
17350 <li>Sub-one
17351 <li>Sub-two
17352 </ul>
17353 </ul>
17354 !! html/php+tidy
17355 <ul>
17356 <li>One</li>
17357 <li>Two:
17358 <ul>
17359 <li>Sub-one</li>
17360 <li>Sub-two</li>
17361 </ul>
17362 </li>
17363 </ul>
17364 !! html/parsoid
17365 <ul>
17366 <li>One
17367 </li>
17368 <li>Two:
17369 <ul>
17370 <li>Sub-one
17371 </li>
17372 <li>Sub-two
17373 </li>
17374 </ul>
17375 </li>
17376 </ul>
17377
17378 !! end
17379
17380 !! test
17381 HTML nested ordered list, closed tags (bug 5497)
17382 !! wikitext
17383 <ol>
17384 <li>One</li>
17385 <li>Two:
17386 <ol>
17387 <li>Sub-one</li>
17388 <li>Sub-two</li>
17389 </ol>
17390 </li>
17391 </ol>
17392 !! html
17393 <ol>
17394 <li>One</li>
17395 <li>Two:
17396 <ol>
17397 <li>Sub-one</li>
17398 <li>Sub-two</li>
17399 </ol>
17400 </li>
17401 </ol>
17402
17403 !! end
17404
17405 !! test
17406 HTML nested ordered list, open tags (bug 5497)
17407 !! wikitext
17408 <ol>
17409 <li>One
17410 <li>Two:
17411 <ol>
17412 <li>Sub-one
17413 <li>Sub-two
17414 </ol>
17415 </ol>
17416 !! html/php
17417 <ol>
17418 <li>One
17419 <li>Two:
17420 <ol>
17421 <li>Sub-one
17422 <li>Sub-two
17423 </ol>
17424 </ol>
17425
17426 !! html/parsoid
17427 <ol>
17428 <li>One
17429 </li>
17430 <li>Two:
17431 <ol>
17432 <li>Sub-one
17433 </li>
17434 <li>Sub-two
17435 </li>
17436 </ol>
17437 </li>
17438 </ol>
17439
17440 !! end
17441
17442 !! test
17443 HTML ordered list item with parameters oddity
17444 !! wikitext
17445 <ol><li id="fragment">One</li>
17446 </ol>
17447 !! html
17448 <ol><li id="fragment">One</li>
17449 </ol>
17450
17451 !! end
17452
17453 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
17454 !!test
17455 bug 5918: autonumbering
17456 !! wikitext
17457 [http://first/] [http://second] [ftp://ftp]
17458
17459 ftp://inlineftp
17460
17461 [mailto:enclosed@mail.tld With target]
17462
17463 [mailto:enclosed@mail.tld]
17464
17465 mailto:inline@mail.tld
17466 !! html/php
17467 <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>
17468 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
17469 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
17470 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
17471 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
17472 </p>
17473 !! html/parsoid
17474 <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>
17475 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
17476 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
17477 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
17478 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
17479 !! end
17480
17481
17482 #
17483 # Security and HTML correctness
17484 # From Nick Jenkins' fuzz testing
17485 #
17486
17487 !! test
17488 Fuzz testing: Parser13
17489 !! wikitext
17490 {|
17491 | http://a|
17492 !! html
17493 <table>
17494 <tr>
17495 <td>
17496 </td>
17497 </tr>
17498 </table>
17499
17500 !! end
17501
17502 !! test
17503 Fuzz testing: Parser14
17504 !! wikitext
17505 == onmouseover= ==
17506 http://__TOC__
17507 !! html
17508 <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>
17509 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
17510 <ul>
17511 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17512 </ul>
17513 </div>
17514
17515
17516 !! html+tidy
17517 <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>
17518 <p>http://</p>
17519 <div id="toc" class="toc">
17520 <div id="toctitle">
17521 <h2>Contents</h2>
17522 </div>
17523 <ul>
17524 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
17525 </ul>
17526 </div>
17527 <p></p>
17528 !! end
17529
17530 !! test
17531 Fuzz testing: Parser14-table
17532 !! options
17533 parsoid=wt2html,html2html
17534 !! wikitext
17535 ==a==
17536 {| STYLE=__TOC__
17537 !! html
17538 <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>
17539 <table style="&#95;_TOC&#95;_">
17540 <tr><td></td></tr>
17541 </table>
17542
17543 !! html+tidy
17544 <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>
17545 <table style="__TOC__">
17546 <tr>
17547 <td></td>
17548 </tr>
17549 </table>
17550 !! html/parsoid
17551 <h2>a</h2>
17552 <table style="__TOC__"></table>
17553 !! end
17554
17555 # Known to produce bogus xml (extra </td>)
17556 !! test
17557 Fuzz testing: Parser16
17558 !! wikitext
17559 {|
17560 !https://||||||
17561 !! html
17562 <table>
17563 <tr>
17564 <th>https://</th>
17565 <th></th>
17566 <th></th>
17567 <th>
17568 </td>
17569 </tr>
17570 </table>
17571
17572 !! html+tidy
17573 <table>
17574 <tr>
17575 <th>https://</th>
17576 <th></th>
17577 <th></th>
17578 <th></th>
17579 </tr>
17580 </table>
17581 !! end
17582
17583 !! test
17584 Fuzz testing: Parser21
17585 !! wikitext
17586 {|
17587 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17588 |
17589 !! html
17590 <table>
17591 <tr>
17592 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17593 </th>
17594 <td>
17595 </td>
17596 </tr>
17597 </table>
17598
17599 !! end
17600
17601 !! test
17602 Fuzz testing: Parser22
17603 !! wikitext
17604 http://===r:::https://b
17605
17606 {|
17607 !! html
17608 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17609 </p>
17610 <table>
17611 <tr><td></td></tr>
17612 </table>
17613
17614 !! end
17615
17616 # Known to produce bad XML for now
17617 !! test
17618 Fuzz testing: Parser24
17619 !! wikitext
17620 {|
17621 {{{|
17622 <u CLASS=
17623 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17624 <br style="onmouseover='alert(document.cookie);' " />
17625
17626 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17627 |
17628 !! html
17629 <table>
17630 {{{|
17631 <u class="&#124;">}}}} &gt;
17632 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17633
17634 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17635 <tr>
17636 <td></u>
17637 </td>
17638 </tr>
17639 </table>
17640
17641 !! end
17642
17643 # Note: the current result listed for this is not what the original one was,
17644 # but the original bug was JavaScript injection, which is fixed in any case.
17645 # It's not clear that the original result listed was any more correct than the
17646 # current one. Original result:
17647 # <p>{{{|
17648 # </p>
17649 # <li class="&#124;&#124;">
17650 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17651 !!test
17652 Fuzz testing: Parser25 (bug 6055)
17653 !! wikitext
17654 {{{
17655 |
17656 <LI CLASS=||
17657 >
17658 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17659 !! html
17660 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17661 </p>
17662 !! end
17663
17664 !!test
17665 Fuzz testing: URL adjacent extension (with space, clean)
17666 !! wikitext
17667 http://example.com <nowiki>junk</nowiki>
17668 !! html/php
17669 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17670 </p>
17671 !! html/parsoid
17672 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17673 !! end
17674
17675 !!test
17676 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17677 !! wikitext
17678 http://example.com<nowiki>junk</nowiki>
17679 !! html/php
17680 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17681 </p>
17682 !! html/parsoid
17683 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17684 !! end
17685
17686 !!test
17687 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17688 !! wikitext
17689 http://example.com<pre>junk</pre>
17690 !! html/php
17691 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17692
17693 !! html/php+tidy
17694 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17695 <pre>
17696 junk
17697 </pre>
17698 !! html/parsoid
17699 <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>
17700 !!end
17701
17702 !!test
17703 Fuzz testing: image with bogus manual thumbnail
17704 !! wikitext
17705 [[Image:foobar.jpg|thumbnail= ]]
17706 !! html/php
17707 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17708
17709 !! html/parsoid
17710 <figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"manualthumb","ak":"thumbnail= "}]}' data-mw='{"errors":[{"key":"missing-thumbnail","message":"This thumbnail does not exist.","params":{"name":""}}],"thumb":""}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="./Special:FilePath/" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"220"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure>
17711 !!end
17712
17713 !! test
17714 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17715 !! wikitext
17716 <pre dir="&#10;"></pre>
17717 !! html
17718 <pre dir="&#10;"></pre>
17719
17720 !! end
17721
17722 !! test
17723 Parsing optional HTML elements (Bug 6171)
17724 !! options
17725 !! wikitext
17726 <table>
17727 <tr>
17728 <td> Some tabular data</td>
17729 <td> More tabular data ...
17730 <td> And yet som tabular data</td>
17731 </tr>
17732 </table>
17733 !! html
17734 <table>
17735 <tr>
17736 <td> Some tabular data</td>
17737 <td> More tabular data ...
17738 </td><td> And yet som tabular data</td>
17739 </tr>
17740 </table>
17741
17742 !! end
17743
17744 !! test
17745 Correct handling of <td>, <tr> (Bug 6171)
17746 !! options
17747 !! wikitext
17748 <table>
17749 <tr>
17750 <td> Some tabular data</td>
17751 <td> More tabular data ...</td>
17752 <td> And yet som tabular data</td>
17753 </tr>
17754 </table>
17755 !! html
17756 <table>
17757 <tr>
17758 <td> Some tabular data</td>
17759 <td> More tabular data ...</td>
17760 <td> And yet som tabular data</td>
17761 </tr>
17762 </table>
17763
17764 !! end
17765
17766
17767 !! test
17768 Parsing crashing regression (fr:JavaScript)
17769 !! wikitext
17770 </body></x>
17771 !! html
17772 <p>&lt;/body&gt;&lt;/x&gt;
17773 </p>
17774 !! end
17775
17776 !! test
17777 Inline wiki vs wiki block nesting
17778 !! wikitext
17779 '''Bold paragraph
17780
17781 New wiki paragraph
17782 !! html
17783 <p><b>Bold paragraph</b>
17784 </p><p>New wiki paragraph
17785 </p>
17786 !! end
17787
17788 # FIXME: The current php output is documented
17789 # and desired output is the parsoid target.
17790 !! test
17791 Inline HTML vs wiki block nesting
17792 !! wikitext
17793 <b>Bold paragraph
17794
17795 New wiki paragraph
17796 !! html/php
17797 <p><b>Bold paragraph
17798 </p><p>New wiki paragraph</b>
17799 </p>
17800 !! html/parsoid
17801 <p><b>Bold paragraph</b>
17802 </p><p>New wiki paragraph
17803 </p>
17804 !! end
17805
17806 # Original result was this:
17807 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
17808 # </p>
17809 # While that might be marginally more intuitive, maybe, the six-apostrophe
17810 # construct is clearly pathological and the result stated here (which is what
17811 # the parser actually does) is about as reasonable as anything.
17812 !!test
17813 Mixing markup for italics and bold
17814 !! options
17815 !! wikitext
17816 '''bold''''''bold''bolditalics'''''
17817 !! html
17818 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
17819 </p>
17820 !! end
17821
17822
17823 !! article
17824 Xyzzyx
17825 !! text
17826 Article for special page transclusion test
17827 !! endarticle
17828
17829 !! test
17830 Special page transclusion
17831 !! options
17832 !! wikitext
17833 {{Special:Prefixindex/Xyzzyx}}
17834 !! html
17835 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17836 </ul>
17837
17838 !! end
17839
17840 !! test
17841 Special page transclusion twice (bug 5021)
17842 !! options
17843 !! wikitext
17844 {{Special:Prefixindex/Xyzzyx}}
17845 {{Special:Prefixindex/Xyzzyx}}
17846 !! html
17847 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17848 </ul>
17849 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17850 </ul>
17851
17852 !! end
17853
17854 !! test
17855 Transclusion of default MediaWiki message
17856 !! wikitext
17857 {{MediaWiki:Mainpage}}
17858 !! html
17859 <p>Main Page
17860 </p>
17861 !! end
17862
17863 !! test
17864 Transclusion of nonexistent MediaWiki message
17865 !! wikitext
17866 {{MediaWiki:Mainpagexxx}}
17867 !! html
17868 <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>
17869 </p>
17870 !! end
17871
17872 !! test
17873 Transclusion of MediaWiki message with underscore
17874 !! wikitext
17875 {{MediaWiki:history_short}}
17876 !! html
17877 <p>History
17878 </p>
17879 !! end
17880
17881 !! test
17882 Transclusion of MediaWiki message with space
17883 !! wikitext
17884 {{MediaWiki:history short}}
17885 !! html
17886 <p>History
17887 </p>
17888 !! end
17889
17890 !! test
17891 Invalid header with following text
17892 !! wikitext
17893 = x = y
17894 !! html
17895 <p>= x = y
17896 </p>
17897 !! end
17898
17899
17900 !! test
17901 Section extraction test (section 0)
17902 !! options
17903 section=0
17904 !! wikitext
17905 start
17906 ==a==
17907 ===aa===
17908 ====aaa====
17909 ==b==
17910 ===ba===
17911 ===bb===
17912 ====bba====
17913 ===bc===
17914 ==c==
17915 ===ca===
17916 !! html/php
17917 start
17918 !! end
17919
17920 !! test
17921 Section extraction test (section 1)
17922 !! options
17923 section=1
17924 !! wikitext
17925 start
17926 ==a==
17927 ===aa===
17928 ====aaa====
17929 ==b==
17930 ===ba===
17931 ===bb===
17932 ====bba====
17933 ===bc===
17934 ==c==
17935 ===ca===
17936 !! html/php
17937 ==a==
17938 ===aa===
17939 ====aaa====
17940 !! end
17941
17942 !! test
17943 Section extraction test (section 2)
17944 !! options
17945 section=2
17946 !! wikitext
17947 start
17948 ==a==
17949 ===aa===
17950 ====aaa====
17951 ==b==
17952 ===ba===
17953 ===bb===
17954 ====bba====
17955 ===bc===
17956 ==c==
17957 ===ca===
17958 !! html/php
17959 ===aa===
17960 ====aaa====
17961 !! end
17962
17963 !! test
17964 Section extraction test (section 3)
17965 !! options
17966 section=3
17967 !! wikitext
17968 start
17969 ==a==
17970 ===aa===
17971 ====aaa====
17972 ==b==
17973 ===ba===
17974 ===bb===
17975 ====bba====
17976 ===bc===
17977 ==c==
17978 ===ca===
17979 !! html/php
17980 ====aaa====
17981 !! end
17982
17983 !! test
17984 Section extraction test (section 4)
17985 !! options
17986 section=4
17987 !! wikitext
17988 start
17989 ==a==
17990 ===aa===
17991 ====aaa====
17992 ==b==
17993 ===ba===
17994 ===bb===
17995 ====bba====
17996 ===bc===
17997 ==c==
17998 ===ca===
17999 !! html/php
18000 ==b==
18001 ===ba===
18002 ===bb===
18003 ====bba====
18004 ===bc===
18005 !! end
18006
18007 !! test
18008 Section extraction test (section 5)
18009 !! options
18010 section=5
18011 !! wikitext
18012 start
18013 ==a==
18014 ===aa===
18015 ====aaa====
18016 ==b==
18017 ===ba===
18018 ===bb===
18019 ====bba====
18020 ===bc===
18021 ==c==
18022 ===ca===
18023 !! html/php
18024 ===ba===
18025 !! end
18026
18027 !! test
18028 Section extraction test (section 6)
18029 !! options
18030 section=6
18031 !! wikitext
18032 start
18033 ==a==
18034 ===aa===
18035 ====aaa====
18036 ==b==
18037 ===ba===
18038 ===bb===
18039 ====bba====
18040 ===bc===
18041 ==c==
18042 ===ca===
18043 !! html/php
18044 ===bb===
18045 ====bba====
18046 !! end
18047
18048 !! test
18049 Section extraction test (section 7)
18050 !! options
18051 section=7
18052 !! wikitext
18053 start
18054 ==a==
18055 ===aa===
18056 ====aaa====
18057 ==b==
18058 ===ba===
18059 ===bb===
18060 ====bba====
18061 ===bc===
18062 ==c==
18063 ===ca===
18064 !! html/php
18065 ====bba====
18066 !! end
18067
18068 !! test
18069 Section extraction test (section 8)
18070 !! options
18071 section=8
18072 !! wikitext
18073 start
18074 ==a==
18075 ===aa===
18076 ====aaa====
18077 ==b==
18078 ===ba===
18079 ===bb===
18080 ====bba====
18081 ===bc===
18082 ==c==
18083 ===ca===
18084 !! html/php
18085 ===bc===
18086 !! end
18087
18088 !! test
18089 Section extraction test (section 9)
18090 !! options
18091 section=9
18092 !! wikitext
18093 start
18094 ==a==
18095 ===aa===
18096 ====aaa====
18097 ==b==
18098 ===ba===
18099 ===bb===
18100 ====bba====
18101 ===bc===
18102 ==c==
18103 ===ca===
18104 !! html/php
18105 ==c==
18106 ===ca===
18107 !! end
18108
18109 !! test
18110 Section extraction test (section 10)
18111 !! options
18112 section=10
18113 !! wikitext
18114 start
18115 ==a==
18116 ===aa===
18117 ====aaa====
18118 ==b==
18119 ===ba===
18120 ===bb===
18121 ====bba====
18122 ===bc===
18123 ==c==
18124 ===ca===
18125 !! html/php
18126 ===ca===
18127 !! end
18128
18129 !! test
18130 Section extraction test (nonexistent section 11)
18131 !! options
18132 section=11
18133 !! wikitext
18134 start
18135 ==a==
18136 ===aa===
18137 ====aaa====
18138 ==b==
18139 ===ba===
18140 ===bb===
18141 ====bba====
18142 ===bc===
18143 ==c==
18144 ===ca===
18145 !! html/php
18146 !! end
18147
18148 !! test
18149 Section extraction test with bogus heading (section 1)
18150 !! options
18151 section=1
18152 !! wikitext
18153 ==a==
18154 ==bogus== not a legal section
18155 ==b==
18156 !! html/php
18157 ==a==
18158 ==bogus== not a legal section
18159 !! end
18160
18161 !! test
18162 Section extraction test with bogus heading (section 2)
18163 !! options
18164 section=2
18165 !! wikitext
18166 ==a==
18167 ==bogus== not a legal section
18168 ==b==
18169 !! html/php
18170 ==b==
18171 !! end
18172
18173 !! test
18174 Section extraction test with comment after heading (section 1)
18175 !! options
18176 section=1
18177 !! wikitext
18178 ==a==
18179 ==b== <!-- -->
18180 ==c==
18181 !! html/php
18182 ==a==
18183 !! end
18184
18185 !! test
18186 Section extraction test with comment after heading (section 2)
18187 !! options
18188 section=2
18189 !! wikitext
18190 ==a==
18191 ==b== <!-- -->
18192 ==c==
18193 !! html/php
18194 ==b== <!-- -->
18195 !! end
18196
18197 !! test
18198 Section extraction test with bogus <nowiki> heading (section 1)
18199 !! options
18200 section=1
18201 !! wikitext
18202 ==a==
18203 ==bogus== <nowiki>not a legal section</nowiki>
18204 ==b==
18205 !! html/php
18206 ==a==
18207 ==bogus== <nowiki>not a legal section</nowiki>
18208 !! end
18209
18210 !! test
18211 Section extraction test with bogus <nowiki> heading (section 2)
18212 !! options
18213 section=2
18214 !! wikitext
18215 ==a==
18216 ==bogus== <nowiki>not a legal section</nowiki>
18217 ==b==
18218 !! html/php
18219 ==b==
18220 !! end
18221
18222 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
18223 # instead of respecting commented sections
18224 !! test
18225 Section extraction prefixed by comment (section 1)
18226 !! options
18227 section=1
18228 !! wikitext
18229 <!-- -->==sec1==
18230 ==sec2==
18231 !! html/php
18232 ==sec2==
18233 !!end
18234
18235 !! test
18236 Section extraction prefixed by comment (section 2)
18237 !! options
18238 section=2
18239 !! wikitext
18240 <!-- -->==sec1==
18241 ==sec2==
18242 !! html/php
18243
18244 !!end
18245
18246 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
18247 # instead of respecting HTML-style headings
18248 !! test
18249 Section extraction, mixed wiki and html (section 1)
18250 !! options
18251 section=1
18252 !! wikitext
18253 <h2>unmarked</h2>
18254 unmarked
18255 ==1==
18256 one
18257 ==2==
18258 two
18259 !! html/php
18260 ==1==
18261 one
18262 !! end
18263
18264 !! test
18265 Section extraction, mixed wiki and html (section 2)
18266 !! options
18267 section=2
18268 !! wikitext
18269 <h2>unmarked</h2>
18270 unmarked
18271 ==1==
18272 one
18273 ==2==
18274 two
18275 !! html/php
18276 ==2==
18277 two
18278 !! end
18279
18280
18281 # Formerly testing for bug 3342
18282 !! test
18283 Section extraction, heading surrounded by <noinclude>
18284 !! options
18285 section=1
18286 !! wikitext
18287 <noinclude>==unmarked==</noinclude>
18288 ==marked==
18289 !! html/php
18290 ==marked==
18291 !!end
18292
18293 # Test behavior of bug 19910
18294 !! test
18295 Sectiion with all-equals
18296 !! options
18297 section=2
18298 !! wikitext
18299 ===
18300 The line above must have a trailing space
18301 === <!--
18302 --> <!-- -->
18303 But just in case it doesn't...
18304 !! html/php
18305 === <!--
18306 --> <!-- -->
18307 But just in case it doesn't...
18308 !! end
18309
18310 !! test
18311 Section replacement test (section 0)
18312 !! options
18313 replace=0,"xxx"
18314 !! wikitext
18315 start
18316 ==a==
18317 ===aa===
18318 ====aaa====
18319 ==b==
18320 ===ba===
18321 ===bb===
18322 ====bba====
18323 ===bc===
18324 ==c==
18325 ===ca===
18326 !! html/php
18327 xxx
18328
18329 ==a==
18330 ===aa===
18331 ====aaa====
18332 ==b==
18333 ===ba===
18334 ===bb===
18335 ====bba====
18336 ===bc===
18337 ==c==
18338 ===ca===
18339 !! end
18340
18341 !! test
18342 Section replacement test (section 1)
18343 !! options
18344 replace=1,"xxx"
18345 !! wikitext
18346 start
18347 ==a==
18348 ===aa===
18349 ====aaa====
18350 ==b==
18351 ===ba===
18352 ===bb===
18353 ====bba====
18354 ===bc===
18355 ==c==
18356 ===ca===
18357 !! html/php
18358 start
18359 xxx
18360
18361 ==b==
18362 ===ba===
18363 ===bb===
18364 ====bba====
18365 ===bc===
18366 ==c==
18367 ===ca===
18368 !! end
18369
18370 !! test
18371 Section replacement test (section 2)
18372 !! options
18373 replace=2,"xxx"
18374 !! wikitext
18375 start
18376 ==a==
18377 ===aa===
18378 ====aaa====
18379 ==b==
18380 ===ba===
18381 ===bb===
18382 ====bba====
18383 ===bc===
18384 ==c==
18385 ===ca===
18386 !! html/php
18387 start
18388 ==a==
18389 xxx
18390
18391 ==b==
18392 ===ba===
18393 ===bb===
18394 ====bba====
18395 ===bc===
18396 ==c==
18397 ===ca===
18398 !! end
18399
18400 !! test
18401 Section replacement test (section 3)
18402 !! options
18403 replace=3,"xxx"
18404 !! wikitext
18405 start
18406 ==a==
18407 ===aa===
18408 ====aaa====
18409 ==b==
18410 ===ba===
18411 ===bb===
18412 ====bba====
18413 ===bc===
18414 ==c==
18415 ===ca===
18416 !! html/php
18417 start
18418 ==a==
18419 ===aa===
18420 xxx
18421
18422 ==b==
18423 ===ba===
18424 ===bb===
18425 ====bba====
18426 ===bc===
18427 ==c==
18428 ===ca===
18429 !! end
18430
18431 !! test
18432 Section replacement test (section 4)
18433 !! options
18434 replace=4,"xxx"
18435 !! wikitext
18436 start
18437 ==a==
18438 ===aa===
18439 ====aaa====
18440 ==b==
18441 ===ba===
18442 ===bb===
18443 ====bba====
18444 ===bc===
18445 ==c==
18446 ===ca===
18447 !! html/php
18448 start
18449 ==a==
18450 ===aa===
18451 ====aaa====
18452 xxx
18453
18454 ==c==
18455 ===ca===
18456 !! end
18457
18458 !! test
18459 Section replacement test (section 5)
18460 !! options
18461 replace=5,"xxx"
18462 !! wikitext
18463 start
18464 ==a==
18465 ===aa===
18466 ====aaa====
18467 ==b==
18468 ===ba===
18469 ===bb===
18470 ====bba====
18471 ===bc===
18472 ==c==
18473 ===ca===
18474 !! html/php
18475 start
18476 ==a==
18477 ===aa===
18478 ====aaa====
18479 ==b==
18480 xxx
18481
18482 ===bb===
18483 ====bba====
18484 ===bc===
18485 ==c==
18486 ===ca===
18487 !! end
18488
18489 !! test
18490 Section replacement test (section 6)
18491 !! options
18492 replace=6,"xxx"
18493 !! wikitext
18494 start
18495 ==a==
18496 ===aa===
18497 ====aaa====
18498 ==b==
18499 ===ba===
18500 ===bb===
18501 ====bba====
18502 ===bc===
18503 ==c==
18504 ===ca===
18505 !! html/php
18506 start
18507 ==a==
18508 ===aa===
18509 ====aaa====
18510 ==b==
18511 ===ba===
18512 xxx
18513
18514 ===bc===
18515 ==c==
18516 ===ca===
18517 !! end
18518
18519 !! test
18520 Section replacement test (section 7)
18521 !! options
18522 replace=7,"xxx"
18523 !! wikitext
18524 start
18525 ==a==
18526 ===aa===
18527 ====aaa====
18528 ==b==
18529 ===ba===
18530 ===bb===
18531 ====bba====
18532 ===bc===
18533 ==c==
18534 ===ca===
18535 !! html/php
18536 start
18537 ==a==
18538 ===aa===
18539 ====aaa====
18540 ==b==
18541 ===ba===
18542 ===bb===
18543 xxx
18544
18545 ===bc===
18546 ==c==
18547 ===ca===
18548 !! end
18549
18550 !! test
18551 Section replacement test (section 8)
18552 !! options
18553 replace=8,"xxx"
18554 !! wikitext
18555 start
18556 ==a==
18557 ===aa===
18558 ====aaa====
18559 ==b==
18560 ===ba===
18561 ===bb===
18562 ====bba====
18563 ===bc===
18564 ==c==
18565 ===ca===
18566 !! html/php
18567 start
18568 ==a==
18569 ===aa===
18570 ====aaa====
18571 ==b==
18572 ===ba===
18573 ===bb===
18574 ====bba====
18575 xxx
18576
18577 ==c==
18578 ===ca===
18579 !!end
18580
18581 !! test
18582 Section replacement test (section 9)
18583 !! options
18584 replace=9,"xxx"
18585 !! wikitext
18586 start
18587 ==a==
18588 ===aa===
18589 ====aaa====
18590 ==b==
18591 ===ba===
18592 ===bb===
18593 ====bba====
18594 ===bc===
18595 ==c==
18596 ===ca===
18597 !! html/php
18598 start
18599 ==a==
18600 ===aa===
18601 ====aaa====
18602 ==b==
18603 ===ba===
18604 ===bb===
18605 ====bba====
18606 ===bc===
18607 xxx
18608 !! end
18609
18610 !! test
18611 Section replacement test (section 10)
18612 !! options
18613 replace=10,"xxx"
18614 !! wikitext
18615 start
18616 ==a==
18617 ===aa===
18618 ====aaa====
18619 ==b==
18620 ===ba===
18621 ===bb===
18622 ====bba====
18623 ===bc===
18624 ==c==
18625 ===ca===
18626 !! html/php
18627 start
18628 ==a==
18629 ===aa===
18630 ====aaa====
18631 ==b==
18632 ===ba===
18633 ===bb===
18634 ====bba====
18635 ===bc===
18636 ==c==
18637 xxx
18638 !! end
18639
18640 !! test
18641 Section replacement test with initial whitespace (bug 13728)
18642 !! options
18643 replace=2,"xxx"
18644 !! wikitext
18645 Preformatted initial line
18646 ==a==
18647 ===a===
18648 !! html/php
18649 Preformatted initial line
18650 ==a==
18651 xxx
18652 !! end
18653
18654
18655 !! test
18656 Section extraction, heading followed by pre with 20 spaces (bug 6398)
18657 !! options
18658 section=1
18659 !! wikitext
18660 ==a==
18661 a
18662 !! html/php
18663 ==a==
18664 a
18665 !! end
18666
18667 !! test
18668 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
18669 !! options
18670 section=1
18671 !! wikitext
18672 ==a==
18673 a
18674 !! html/php
18675 ==a==
18676 a
18677 !! end
18678
18679
18680 !! test
18681 Section extraction, <pre> around bogus header (bug 10309)
18682 !! options
18683 section=2
18684 !! wikitext
18685 == Section One ==
18686 <pre>
18687 =======
18688 </pre>
18689
18690 == Section Two ==
18691 stuff
18692 !! html/php
18693 == Section Two ==
18694 stuff
18695 !! end
18696
18697 !! test
18698 Section replacement, <pre> around bogus header (bug 10309)
18699 !! options
18700 replace=2,"xxx"
18701 !! wikitext
18702 == Section One ==
18703 <pre>
18704 =======
18705 </pre>
18706
18707 == Section Two ==
18708 stuff
18709 !! html/php
18710 == Section One ==
18711 <pre>
18712 =======
18713 </pre>
18714
18715 xxx
18716 !! end
18717
18718
18719 !! test
18720 Handling of &#x0A; in URLs
18721 !! wikitext
18722 ** irc://&#x0A;a
18723 !! html/php
18724 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18725
18726 !! html/parsoid
18727 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
18728 a">irc://
18729 a</a></li></ul></li></ul>
18730 !! end
18731
18732 !! test
18733 Handling of %0A in URLs
18734 !! wikitext
18735 ** irc://%0Aa
18736 !! html/php
18737 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18738
18739 !! html/parsoid
18740 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18741 !! end
18742
18743
18744 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18745 !! test
18746 5 quotes, code coverage +1 line
18747 !! options
18748 parsoid=wt2html
18749 !! wikitext
18750 '''''
18751 !! html/php
18752 !! html/parsoid
18753 <p><b><i></i></b></p>
18754 !! end
18755
18756 # same html as previous, but wikitext adjusted to match parsoid html2wt
18757 # note that wt2html and html2html will put the <i> before the <b>
18758 !! test
18759 5 quotes, code coverage +1 line w/ nowiki (1)
18760 !! options
18761 parsoid=wt2wt,html2wt
18762 !! wikitext
18763 '''''<nowiki/>'''''
18764 !! html/php
18765 <p><i></i>
18766 </p>
18767 !! html/parsoid
18768 <p><b><i></i></b></p>
18769 !! end
18770
18771 # same as previous, just swapping the <i> and <b>
18772 !! test
18773 5 quotes, code coverage +1 line w/ nowiki (2)
18774 !! wikitext
18775 '''''<nowiki/>'''''
18776 !! html/php
18777 <p><i></i>
18778 </p>
18779 !! html/parsoid
18780 <p><i><b></b></i></p>
18781 !! end
18782
18783 !! test
18784 Special:Search page linking.
18785 !! wikitext
18786 {{Special:search}}
18787 !! html
18788 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18789 </p>
18790 !! end
18791
18792 !! test
18793 {{!}} is a magic word
18794 !! wikitext
18795 {{!}} is a magic word there and {{!}} is still a magic word here
18796 | is not a magic word here but {{!}} is still a magic word here
18797 !! html/php
18798 <p>| is a magic word there and | is still a magic word here
18799 | is not a magic word here but | is still a magic word here
18800 </p>
18801 !! html/parsoid
18802 <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
18803 | 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>
18804
18805 !! end
18806
18807 !! test
18808 Say the magic word
18809 !! options
18810 title=[[Parser test]]
18811 !! wikitext
18812 * {{PAGENAME}}
18813 * {{PAGENAMEE}}
18814 * {{FULLPAGENAME}}
18815 * {{FULLPAGENAMEE}}
18816 * {{BASEPAGENAME}}
18817 * {{BASEPAGENAMEE}}
18818 * {{SUBPAGENAME}}
18819 * {{SUBPAGENAMEE}}
18820 * {{ROOTPAGENAME}}
18821 * {{ROOTPAGENAMEE}}
18822 * {{TALKPAGENAME}}
18823 * {{TALKPAGENAMEE}}
18824 * {{SUBJECTPAGENAME}}
18825 * {{SUBJECTPAGENAMEE}}
18826 * {{NAMESPACEE}}
18827 * {{NAMESPACE}}
18828 * {{NAMESPACENUMBER}}
18829 * {{TALKSPACE}}
18830 * {{TALKSPACEE}}
18831 * {{SUBJECTSPACE}}
18832 * {{SUBJECTSPACEE}}
18833 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18834 !! html
18835 <ul><li> Parser test</li>
18836 <li> Parser_test</li>
18837 <li> Parser test</li>
18838 <li> Parser_test</li>
18839 <li> Parser test</li>
18840 <li> Parser_test</li>
18841 <li> Parser test</li>
18842 <li> Parser_test</li>
18843 <li> Parser test</li>
18844 <li> Parser_test</li>
18845 <li> Talk:Parser test</li>
18846 <li> Talk:Parser_test</li>
18847 <li> Parser test</li>
18848 <li> Parser_test</li>
18849 <li> </li>
18850 <li> </li>
18851 <li> 0</li>
18852 <li> Talk</li>
18853 <li> Talk</li>
18854 <li> </li>
18855 <li> </li>
18856 <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>
18857
18858 !! end
18859 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18860
18861 !! test
18862 Gallery
18863 !! wikitext
18864 <gallery>
18865 image1.png |
18866 image2.gif|||||
18867
18868 image3|
18869 image4 |300px| centre
18870 image5.svg| http://///////
18871 [[x|xx]]]]
18872 * image6
18873 </gallery>
18874 !! html
18875 <ul class="gallery mw-gallery-traditional">
18876 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18877 <div class="thumb" style="height: 150px;">Image1.png</div>
18878 <div class="gallerytext">
18879 </div>
18880 </div></li>
18881 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18882 <div class="thumb" style="height: 150px;">Image2.gif</div>
18883 <div class="gallerytext">
18884 </div>
18885 </div></li>
18886 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18887 <div class="thumb" style="height: 150px;">Image3</div>
18888 <div class="gallerytext">
18889 </div>
18890 </div></li>
18891 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18892 <div class="thumb" style="height: 150px;">Image4</div>
18893 <div class="gallerytext">
18894 <pre>centre
18895 </pre>
18896 </div>
18897 </div></li>
18898 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18899 <div class="thumb" style="height: 150px;">Image5.svg</div>
18900 <div class="gallerytext">
18901 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
18902 </p>
18903 </div>
18904 </div></li>
18905 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18906 <div class="thumb" style="height: 150px;">* image6</div>
18907 <div class="gallerytext">
18908 </div>
18909 </div></li>
18910 </ul>
18911
18912 !! end
18913
18914 !! test
18915 Gallery (with options)
18916 !! wikitext
18917 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
18918 File:Nonexistent.jpg|caption
18919 File:Nonexistent.jpg
18920 image:foobar.jpg|some '''caption''' [[Main Page]]
18921 image:foobar.jpg
18922 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
18923 </gallery>
18924 !! html
18925 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
18926 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
18927 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18928 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18929 <div class="gallerytext">
18930 <p>caption
18931 </p>
18932 </div>
18933 </div></li>
18934 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18935 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18936 <div class="gallerytext">
18937 </div>
18938 </div></li>
18939 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18940 <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>
18941 <div class="gallerytext">
18942 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18943 </p>
18944 </div>
18945 </div></li>
18946 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18947 <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>
18948 <div class="gallerytext">
18949 </div>
18950 </div></li>
18951 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18952 <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>
18953 <div class="gallerytext">
18954 <p>blabla.
18955 </p>
18956 </div>
18957 </div></li>
18958 </ul>
18959
18960 !! end
18961
18962 !! test
18963 Gallery with link that has fragment
18964 !! wikitext
18965 <gallery>
18966 image:foobar.jpg|link=Main_Page
18967 image:foobar.jpg|link=Main_Page#section
18968 image:foobar.jpg|link=Main Page#section|caption
18969 </gallery>
18970 !! html
18971 <ul class="gallery mw-gallery-traditional">
18972 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18973 <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>
18974 <div class="gallerytext">
18975 </div>
18976 </div></li>
18977 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18978 <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>
18979 <div class="gallerytext">
18980 </div>
18981 </div></li>
18982 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18983 <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>
18984 <div class="gallerytext">
18985 <p>caption
18986 </p>
18987 </div>
18988 </div></li>
18989 </ul>
18990
18991 !! end
18992
18993 !! test
18994 Gallery with wikitext inside caption
18995 !! wikitext
18996 <gallery>
18997 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
18998 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
18999 </gallery>
19000 !! html
19001 <ul class="gallery mw-gallery-traditional">
19002 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19003 <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>
19004 <div class="gallerytext">
19005 <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>
19006 </p>
19007 </div>
19008 </div></li>
19009 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19010 <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>
19011 <div class="gallerytext">
19012 <p>This is a test template
19013 </p>
19014 </div>
19015 </div></li>
19016 </ul>
19017
19018 !! end
19019
19020 !! test
19021 gallery (with showfilename option)
19022 !! wikitext
19023 <gallery showfilename>
19024 File:Nonexistent.jpg|caption
19025 File:Nonexistent.jpg
19026 image:foobar.jpg|some '''caption''' [[Main Page]]
19027 File:Foobar.jpg
19028 </gallery>
19029 !! html
19030 <ul class="gallery mw-gallery-traditional">
19031 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19032 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19033 <div class="gallerytext">
19034 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19035 caption
19036 </p>
19037 </div>
19038 </div></li>
19039 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19040 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19041 <div class="gallerytext">
19042 <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
19043 </p>
19044 </div>
19045 </div></li>
19046 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19047 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
19048 <div class="gallerytext">
19049 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19050 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19051 </p>
19052 </div>
19053 </div></li>
19054 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19055 <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>
19056 <div class="gallerytext">
19057 <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
19058 </p>
19059 </div>
19060 </div></li>
19061 </ul>
19062
19063 !! end
19064
19065 !! test
19066 Gallery (with namespace-less filenames)
19067 !! wikitext
19068 <gallery>
19069 File:Nonexistent.jpg
19070 Nonexistent.jpg
19071 image:foobar.jpg
19072 foobar.jpg
19073 </gallery>
19074 !! html
19075 <ul class="gallery mw-gallery-traditional">
19076 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19077 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19078 <div class="gallerytext">
19079 </div>
19080 </div></li>
19081 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19082 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
19083 <div class="gallerytext">
19084 </div>
19085 </div></li>
19086 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19087 <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>
19088 <div class="gallerytext">
19089 </div>
19090 </div></li>
19091 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
19092 <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>
19093 <div class="gallerytext">
19094 </div>
19095 </div></li>
19096 </ul>
19097
19098 !! end
19099
19100 !! test
19101 HTML Hex character encoding (spells the word "JavaScript")
19102 !! options
19103 parsoid=wt2html,wt2wt,html2html
19104 !! wikitext
19105 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
19106 !! html/php
19107 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
19108 </p>
19109 !! html/php+tidy
19110 <p>JavaScript</p>
19111 !! html/parsoid
19112 <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>
19113 !! end
19114
19115 !! test
19116 HTML Hex character encoding bogus encoding (bug 26437 regression check)
19117 !! wikitext
19118 &#xsee;&#XSEE;
19119 !! html/php
19120 <p>&amp;#xsee;&amp;#XSEE;
19121 </p>
19122 !! html/parsoid
19123 <p>&amp;#xsee;&amp;#XSEE;</p>
19124 !! end
19125
19126 !! test
19127 HTML Hex character encoding mixed case
19128 !! options
19129 parsoid=wt2html,wt2wt,html2html
19130 !! wikitext
19131 &#xEE;&#Xee;
19132 !! html/php
19133 <p>&#xee;&#xee;
19134 </p>
19135 !! html/php+tidy
19136 <p>îî</p>
19137 !! html/parsoid
19138 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
19139 !! end
19140
19141 # See: https://www.w3.org/TR/html5/syntax.html#character-references
19142 # Note that U+000C (form feed) is not a valid XML character, so
19143 # it is banned even though allowed in HTML5.
19144 !! test
19145 Illegal character references (T106578)
19146 !! wikitext
19147 ; Null: &#00;
19148 ; FF: &#xC;
19149 ; CR: &#xD;
19150 ; Control (low): &#8;
19151 ; Control (high): &#x7F; &#x9F;
19152 ; Surrogate: &#xD83D;&#xDCA9;
19153 ; This is an okay astral character: &#x1F4A9;
19154 !! html+tidy
19155 <dl>
19156 <dt>Null</dt>
19157 <dd>&amp;#00;</dd>
19158 <dt>FF</dt>
19159 <dd>&amp;#xC;</dd>
19160 <dt>CR</dt>
19161 <dd>&amp;#xD;</dd>
19162 <dt>Control (low)</dt>
19163 <dd>&amp;#8;</dd>
19164 <dt>Control (high)</dt>
19165 <dd>&amp;#x7F; &amp;#x9F;</dd>
19166 <dt>Surrogate</dt>
19167 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
19168 <dt>This is an okay astral character</dt>
19169 <dd>💩</dd>
19170 </dl>
19171 !! end
19172
19173 !! test
19174 __FORCETOC__ override
19175 !! wikitext
19176 __NEWSECTIONLINK__
19177 __FORCETOC__
19178 !! html/php
19179 <p><br />
19180 </p>
19181 !! end
19182
19183 !! test
19184 ISBN code coverage
19185 !! wikitext
19186 ISBN 978-0-1234-56&#x20;789
19187 !! html
19188 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
19189 </p>
19190 !! html+tidy
19191 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
19192 !! html/parsoid
19193 <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>
19194 !! end
19195
19196 !! test
19197 ISBN followed by 5 spaces
19198 !! wikitext
19199 ISBN
19200 !! html
19201 <p>ISBN
19202 </p>
19203 !! end
19204
19205 !! test
19206 Double ISBN
19207 !! wikitext
19208 ISBN ISBN 1234567890
19209 !! html/php
19210 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19211 </p>
19212 !! html/parsoid
19213 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
19214 !! end
19215
19216 # Uppercase X and lowercase x as well
19217 !! test
19218 ISBN with an X
19219 !! wikitext
19220 ISBN 3-462-04561-X
19221 ISBN 3-462-04561-x
19222 ISBN 080442957X
19223 ISBN 080442957x
19224 ISBN 978080442957X
19225 ISBN 978080442957x
19226 !! html/php
19227 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
19228 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
19229 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
19230 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
19231 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
19232 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
19233 </p>
19234 !! html/parsoid
19235 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
19236 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
19237 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
19238 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
19239 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
19240 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
19241 !! end
19242
19243 !! test
19244 ISBN with empty prefix (parsoid test)
19245 !! wikitext
19246 ISBN 1234567890
19247 !! html/php
19248 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19249 </p>
19250 !! html/parsoid
19251 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
19252 !! end
19253
19254 !! test
19255 Bug 22905: <abbr> followed by ISBN followed by </a>
19256 !! wikitext
19257 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
19258 !! html/php
19259 <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>
19260 </p>
19261 !! html/parsoid
19262 <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>
19263 !! end
19264
19265 !! test
19266 Double RFC
19267 !! wikitext
19268 RFC RFC 1234
19269 !! html
19270 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
19271 </p>
19272 !! end
19273
19274 !! test
19275 Double RFC with a wiki link
19276 !! wikitext
19277 RFC [[RFC 1234]]
19278 !! html
19279 <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>
19280 </p>
19281 !! end
19282
19283 !! test
19284 RFC code coverage
19285 !! wikitext
19286 RFC 983&#x20;987
19287 !! html
19288 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
19289 </p>
19290 !! html+tidy
19291 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
19292 !! end
19293
19294 !! test
19295 Centre-aligned image
19296 !! wikitext
19297 [[Image:foobar.jpg|centre]]
19298 !! html
19299 <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>
19300
19301 !!end
19302
19303 !! test
19304 None-aligned image
19305 !! wikitext
19306 [[Image:foobar.jpg|none]]
19307 !! html
19308 <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>
19309
19310 !!end
19311
19312 !! test
19313 Width + Height sized image (using px) (height is ignored)
19314 !! wikitext
19315 [[Image:foobar.jpg|640x480px]]
19316 !! html
19317 <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>
19318 </p>
19319 !!end
19320
19321 !! test
19322 Width-sized image (using px, no following whitespace)
19323 !! wikitext
19324 [[Image:foobar.jpg|640px]]
19325 !! html
19326 <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>
19327 </p>
19328 !!end
19329
19330 !! test
19331 Width-sized image (using px, with following whitespace - test regression from r39467)
19332 !! wikitext
19333 [[Image:foobar.jpg|640px ]]
19334 !! html
19335 <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>
19336 </p>
19337 !!end
19338
19339 !! test
19340 Width-sized image (using px, with preceding whitespace - test regression from r39467)
19341 !! wikitext
19342 [[Image:foobar.jpg| 640px]]
19343 !! html
19344 <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>
19345 </p>
19346 !!end
19347
19348 !! test
19349 Image with page parameter
19350 !! options
19351 djvu
19352 !! wikitext
19353 [[File:LoremIpsum.djvu|page=2]]
19354 !! html/php
19355 <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>
19356 </p>
19357 !! html/parsoid
19358 <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>
19359 !! end
19360
19361 !! test
19362 Another italics / bold test
19363 !! wikitext
19364 ''' ''x'
19365 !! html
19366 <pre>'<i> </i>x'
19367 </pre>
19368 !!end
19369
19370 # FIXME: The php output seems broken. It's interleaving some open/close tags.
19371 !! test
19372 dt/dd/dl test
19373 !! wikitext
19374 :;;;::
19375 !! html/php
19376 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
19377
19378 !! html/parsoid
19379 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
19380
19381 !!end
19382
19383
19384 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
19385 !! test
19386 Images with the "|" character in the comment
19387 !! wikitext
19388 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
19389 !! html/php
19390 <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>
19391
19392 !! html/parsoid
19393 <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>
19394 !! end
19395
19396 !! test
19397 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
19398 !! wikitext
19399 <html><script>alert(1);</script></html>
19400 !! html
19401 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
19402 </p>
19403 !! end
19404
19405 !! test
19406 HTML with raw HTML ($wgRawHtml==true)
19407 !! options
19408 wgRawHtml=1
19409 !! wikitext
19410 <html><script>alert(1);</script></html>
19411 !! html
19412 <p><script>alert(1);</script>
19413 </p>
19414 !! end
19415
19416 !! test
19417 Parents of subpages, one level up
19418 !! options
19419 subpage title=[[Subpage test/L1/L2/L3]]
19420 !! wikitext
19421 [[../|L2]]
19422 !! html
19423 <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>
19424 </p>
19425 !! end
19426
19427
19428 !! test
19429 Parents of subpages, one level up, not named
19430 !! options
19431 subpage title=[[Subpage test/L1/L2/L3]]
19432 !! wikitext
19433 [[../]]
19434 !! html
19435 <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>
19436 </p>
19437 !! end
19438
19439
19440
19441 !! test
19442 Parents of subpages, two levels up
19443 !! options
19444 subpage title=[[Subpage test/L1/L2/L3]]
19445 !! wikitext
19446 [[../../|L1]]2
19447
19448 [[../../|L1]]l
19449 !! html
19450 <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
19451 </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>
19452 </p>
19453 !! end
19454
19455 !! test
19456 Parents of subpages, two levels up, without trailing slash or name.
19457 !! options
19458 subpage title=[[Subpage test/L1/L2/L3]]
19459 !! wikitext
19460 [[../..]]
19461 !! html
19462 <p>[[../..]]
19463 </p>
19464 !! end
19465
19466 !! test
19467 Parents of subpages, two levels up, with lots of extra trailing slashes.
19468 !! options
19469 subpage title=[[Subpage test/L1/L2/L3]]
19470 !! wikitext
19471 [[../../////]]
19472 !! html
19473 <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>
19474 </p>
19475 !! end
19476
19477 !! article
19478 Subpage test/L1/L2/L3Sibling
19479 !! text
19480 Sibling article
19481 !! endarticle
19482
19483 !! test
19484 Transclusion of a sibling page (one level up)
19485 !! options
19486 subpage title=[[Subpage test/L1/L2/L3]]
19487 !! wikitext
19488 {{../L3Sibling}}
19489 !! html
19490 <p>Sibling article
19491 </p>
19492 !! end
19493
19494 !! test
19495 Transclusion of a child page
19496 !! options
19497 subpage title=[[Subpage test/L1/L2]]
19498 !! wikitext
19499 {{/L3Sibling}}
19500 !! html
19501 <p>Sibling article
19502 </p>
19503 !! end
19504
19505 # This is wt2html only in Parsoid because we add <nowiki>
19506 # because of {{..}} and we don't expect to fix that to
19507 # eliminate the nowikis selective for {{..}} markup.
19508 !! test
19509 Non-transclusion because of too many up levels
19510 !! options
19511 subpage title=[[Subpage test/L1/L2/L3]]
19512 parsoid=wt2html
19513 !! wikitext
19514 {{../../../../More than parent}}
19515 !! html/php
19516 <p>{{../../../../More than parent}}
19517 </p>
19518 !! html/parsoid
19519 <p>{{../../../../More than parent}}</p>
19520 !! end
19521
19522 !! test
19523 Definition list code coverage
19524 !! wikitext
19525 ; title : def
19526 ; title : def
19527 ;title: def
19528 !! html/php
19529 <dl><dt> title &#160;</dt>
19530 <dd> def</dd>
19531 <dt> title&#160;</dt>
19532 <dd> def</dd>
19533 <dt>title</dt>
19534 <dd> def</dd></dl>
19535
19536 !! html/parsoid
19537 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19538 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
19539 <dt>title</dt><dd> def</dd></dl>
19540 !! end
19541
19542 !! test
19543 Don't fall for the self-closing div
19544 !! wikitext
19545 <div>hello world</div/>
19546 !! html
19547 <div>hello world</div>
19548
19549 !! end
19550
19551 !! test
19552 MSGNW magic word
19553 !! wikitext
19554 {{MSGNW:msg}}
19555 !! html/php
19556 <p>&#91;&#91;:Template:Msg&#93;&#93;
19557 </p>
19558 !! end
19559
19560 !! test
19561 RAW magic word
19562 !! wikitext
19563 {{RAW:QUERTY}}
19564 !! html
19565 <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>
19566 </p>
19567 !! end
19568
19569 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
19570 !! test
19571 Always escape literal '>' in output, not just after '<'
19572 !! wikitext
19573 ><>
19574 !! html
19575 <p>&gt;&lt;&gt;
19576 </p>
19577 !! end
19578
19579 !! test
19580 Template caching
19581 !! wikitext
19582 {{Test}}
19583 {{Test}}
19584 !! html
19585 <p>This is a test template
19586 This is a test template
19587 </p>
19588 !! end
19589
19590
19591 !! article
19592 MediaWiki:Fake
19593 !! text
19594 ==header==
19595 !! endarticle
19596
19597 !! test
19598 Inclusion of !userCanEdit() content
19599 !! wikitext
19600 {{MediaWiki:Fake}}
19601 !! html
19602 <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>
19603
19604 !! end
19605
19606
19607 !! test
19608 Out-of-order TOC heading levels
19609 !! wikitext
19610 ==2==
19611 ======6======
19612 ===3===
19613 =1=
19614 =====5=====
19615 ==2==
19616 !! html
19617 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19618 <ul>
19619 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
19620 <ul>
19621 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
19622 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
19623 </ul>
19624 </li>
19625 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
19626 <ul>
19627 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
19628 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
19629 </ul>
19630 </li>
19631 </ul>
19632 </div>
19633
19634 <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>
19635 <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>
19636 <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>
19637 <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>
19638 <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>
19639 <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>
19640
19641 !! end
19642
19643
19644 !! test
19645 ISBN with a dummy number
19646 !! wikitext
19647 ISBN ---
19648 !! html
19649 <p>ISBN ---
19650 </p>
19651 !! end
19652
19653
19654 !! test
19655 ISBN with space-delimited number
19656 !! wikitext
19657 ISBN 92 9017 032 8
19658 !! html
19659 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
19660 </p>
19661 !! end
19662
19663
19664 !! test
19665 ISBN with multiple spaces, no number
19666 !! wikitext
19667 ISBN foo
19668 !! html
19669 <p>ISBN foo
19670 </p>
19671 !! end
19672
19673
19674 !! test
19675 ISBN length
19676 !! wikitext
19677 ISBN 123456789
19678
19679 ISBN 1234567890
19680
19681 ISBN 12345678901
19682 !! html
19683 <p>ISBN 123456789
19684 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19685 </p><p>ISBN 12345678901
19686 </p>
19687 !! end
19688
19689
19690 !! test
19691 ISBN with trailing year (bug 8110)
19692 !! wikitext
19693 ISBN 1-234-56789-0 - 2006
19694
19695 ISBN 1 234 56789 0 - 2006
19696 !! html
19697 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
19698 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
19699 </p>
19700 !! end
19701
19702
19703 !! test
19704 anchorencode
19705 !! wikitext
19706 {{anchorencode:foo bar©#%n}}
19707 !! html
19708 <p>foo_bar.C2.A9.23.25n
19709 </p>
19710 !! end
19711
19712 !! test
19713 anchorencode trims spaces
19714 !! wikitext
19715 {{anchorencode: __pretty__please__}}
19716 !! html
19717 <p>pretty_please
19718 </p>
19719 !! end
19720
19721 !! test
19722 anchorencode deals with links
19723 !! wikitext
19724 {{anchorencode: [[hello|world]] [[hi]]}}
19725 !! html
19726 <p>world_hi
19727 </p>
19728 !! end
19729
19730 !! test
19731 anchorencode deals with templates
19732 !! wikitext
19733 {{anchorencode: {{Foo}} }}
19734 !! html
19735 <p>FOO
19736 </p>
19737 !! end
19738
19739 !! test
19740 anchorencode encodes like the TOC generator: (bug 18431)
19741 !! wikitext
19742 === _ +:.3A%3A&&amp;]] ===
19743 {{anchorencode: _ +:.3A%3A&&amp;]] }}
19744 __NOEDITSECTION__
19745 !! html
19746 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
19747 <p>.2B:.3A.253A.26.26.5D.5D
19748 </p>
19749 !! end
19750
19751 !! test
19752 Bug 6200: blockquotes and paragraph formatting
19753 !! wikitext
19754 <blockquote>
19755 foo
19756 </blockquote>
19757
19758 bar
19759
19760 baz
19761 !! html
19762 <blockquote>
19763 <p>foo
19764 </p>
19765 </blockquote>
19766 <p>bar
19767 </p>
19768 <pre>baz
19769 </pre>
19770 !! end
19771
19772 !! test
19773 Bug 8293: Use of center tag ruins paragraph formatting
19774 !! wikitext
19775 <center>
19776 foo
19777 </center>
19778
19779 bar
19780
19781 baz
19782 !! html
19783 <center>
19784 <p>foo
19785 </p>
19786 </center>
19787 <p>bar
19788 </p>
19789 <pre>baz
19790 </pre>
19791 !! end
19792
19793 !!test
19794 Parsing of overlapping (improperly nested) inline html tags
19795 !! wikitext
19796 <span><s>x</span></s>
19797 !! html/php
19798 <p><span><s>x&lt;/span&gt;</s></span>
19799 </p>
19800 !! html/parsoid
19801 <p><span><s>x</s></span>
19802 </p>
19803 !!end
19804
19805 ###
19806 ### Language variants related tests
19807 ###
19808 !! test
19809 Self-link in language variants
19810 !! options
19811 title=[[Dunav]] language=sr
19812 !! wikitext
19813 Both [[Dunav]] and [[Дунав]] are names for this river.
19814 !! html
19815 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
19816 </p>
19817 !!end
19818
19819 !! article
19820 Дуна
19821 !! text
19822 content
19823 !! endarticle
19824
19825 !! test
19826 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
19827 !! options
19828 title=[[Duna]] language=sr
19829 !! wikitext
19830 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
19831 !! html
19832 <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.
19833 </p>
19834 !! end
19835
19836 !! test
19837 Link to a section of a variant of this title shouldn't be parsed as self-link
19838 !! options
19839 title=[[Duna]] language=sr
19840 !! wikitext
19841 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
19842 !! html
19843 <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.
19844 </p>
19845 !! end
19846
19847 !! test
19848 Link to pages in language variants
19849 !! options
19850 language=sr
19851 !! wikitext
19852 Main Page can be written as [[Маин Паге]]
19853 !! html
19854 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
19855 </p>
19856 !!end
19857
19858
19859 !! test
19860 Multiple links to pages in language variants
19861 !! options
19862 language=sr
19863 !! wikitext
19864 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
19865 !! html
19866 <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>.
19867 </p>
19868 !!end
19869
19870
19871 !! test
19872 Simple template in language variants
19873 !! options
19874 language=sr
19875 !! wikitext
19876 {{тест}}
19877 !! html
19878 <p>This is a test template
19879 </p>
19880 !! end
19881
19882
19883 !! test
19884 Template with explicit namespace in language variants
19885 !! options
19886 language=sr
19887 !! wikitext
19888 {{Template:тест}}
19889 !! html
19890 <p>This is a test template
19891 </p>
19892 !! end
19893
19894
19895 !! test
19896 Basic test for template parameter in language variants
19897 !! options
19898 language=sr
19899 !! wikitext
19900 {{парамтест|param=foo}}
19901 !! html
19902 <p>This is a test template with parameter foo
19903 </p>
19904 !! end
19905
19906 !! test
19907 Simple category in language variants
19908 !! options
19909 language=sr cat
19910 !! wikitext
19911 [[Category:МедиаWики Усер'с Гуиде]]
19912 !! html/php
19913 cat=МедиаWики_Усер'с_Гуиде sort=
19914 !! html/parsoid
19915 <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
19916 !! end
19917
19918 !! article
19919 Category:分类
19920 !! text
19921 blah
19922 !! endarticle
19923
19924 !! article
19925 Category:分類
19926 !! text
19927 blah
19928 !! endarticle
19929
19930 ## We used to, but no longer wt2wt this test since the default serializer
19931 ## will normalize all categories to serialize on their own line.
19932 ## This wikitext usage is going to be fairly uncommon in production and
19933 ## selser will take care of preserving formatting in those scenarios.
19934 !! test
19935 Don't convert blue categorylinks to another variant (bug 33210)
19936 !! options
19937 cat
19938 language=zh
19939 parsoid=wt2html
19940 !! wikitext
19941 [[A]][[Category:分类]]
19942 !! html/php
19943 cat=分类 sort=
19944 !! html/parsoid
19945 <p><a rel="mw:WikiLink" href="A" title="A">A</a></p>
19946 <link rel="mw:PageProp/Category" href="Category:分类"/>
19947 !! end
19948
19949 !! test
19950 Stripping -{}- tags (language variants)
19951 !! options
19952 language=sr
19953 !! wikitext
19954 Latin proverb: -{Ne nuntium necare}-
19955 !! html
19956 <p>Latin proverb: Ne nuntium necare
19957 </p>
19958 !! end
19959
19960
19961 !! test
19962 Prevent conversion with -{}- tags (language variants)
19963 !! options
19964 language=sr variant=sr-ec
19965 !! wikitext
19966 Latinski: -{Ne nuntium necare}-
19967 !! html
19968 <p>Латински: Ne nuntium necare
19969 </p>
19970 !! end
19971
19972
19973 !! test
19974 Prevent conversion of text with -{}- tags (language variants)
19975 !! options
19976 language=sr variant=sr-ec
19977 !! wikitext
19978 Latinski: -{Ne nuntium necare}-
19979 !! html
19980 <p>Латински: Ne nuntium necare
19981 </p>
19982 !! end
19983
19984
19985 !! test
19986 Prevent conversion of links with -{}- tags (language variants)
19987 !! options
19988 language=sr variant=sr-ec
19989 !! wikitext
19990 -{[[Main Page]]}-
19991 !! html
19992 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19993 </p>
19994 !! end
19995
19996
19997 !! test
19998 -{}- tags within headlines (within html for parserConvert())
19999 !! options
20000 language=sr variant=sr-ec
20001 !! wikitext
20002 == -{Naslov}- ==
20003 !! html
20004 <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>
20005
20006 !! end
20007
20008
20009 !! test
20010 Explicit definition of language variant alternatives
20011 !! options
20012 language=zh variant=zh-tw
20013 !! wikitext
20014 -{zh:China;zh-tw:Taiwan}-, not China
20015 !! html
20016 <p>Taiwan, not China
20017 </p>
20018 !! end
20019
20020
20021 !! test
20022 Conversion around HTML tags
20023 !! options
20024 language=sr variant=sr-ec
20025 !! wikitext
20026 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
20027 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
20028 !! html
20029 <p>
20030 <span title="ЛаCтин">ски</span>
20031 </p>
20032 !! end
20033
20034
20035 !! test
20036 Explicit session-wise language variant mapping (A flag and - flag)
20037 !! options
20038 language=zh variant=zh-tw
20039 !! wikitext
20040 Taiwan is not China.
20041 But -{A|zh:China;zh-tw:Taiwan}- is China,
20042 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
20043 and -{China}- is China.
20044 !! html
20045 <p>Taiwan is not China.
20046 But Taiwan is Taiwan,
20047 (This should be stripped!)
20048 and China is China.
20049 </p>
20050 !! end
20051
20052 !! test
20053 Explicit session-wise language variant mapping (H flag for hide)
20054 !! options
20055 language=zh variant=zh-tw
20056 !! wikitext
20057 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
20058 Taiwan is China.
20059 !! html
20060 <p>(This should be stripped!)
20061 Taiwan is Taiwan.
20062 </p>
20063 !! end
20064
20065 !! test
20066 Adding explicit conversion rule for title (T flag)
20067 !! options
20068 language=zh variant=zh-tw showtitle
20069 !! wikitext
20070 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20071 !! html
20072 Taiwan
20073 <p>Should be stripped!
20074 </p>
20075 !! end
20076
20077 !! test
20078 Testing that changing the language variant here in the tests actually works
20079 !! options
20080 language=zh variant=zh showtitle
20081 !! wikitext
20082 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20083 !! html
20084 China
20085 <p>Should be stripped!
20086 </p>
20087 !! end
20088
20089 !! test
20090 Recursive conversion of alt and title attrs shouldn't clear converter state
20091 !! options
20092 language=zh variant=zh-cn showtitle
20093 !! wikitext
20094 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
20095 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
20096 !! html
20097 China
20098 <p>
20099 Should be stripped<span title="Exclamation">!</span>
20100 </p>
20101 !! end
20102
20103 !! test
20104 Bug 24072: more test on conversion rule for title
20105 !! options
20106 language=zh variant=zh-tw showtitle
20107 !! wikitext
20108 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
20109 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
20110 !! html
20111 Taiwan
20112 <p>This should be stripped!
20113 This won't take interferes with the title rule.
20114 </p>
20115 !! end
20116
20117 !! test
20118 Partly disable title conversion if variant == main language code
20119 !! options
20120 language=zh variant=zh title=[[ZH]] showtitle
20121 !! wikitext
20122 -{T|zh-cn:CN;zh-tw:TW}-
20123 !! html
20124 ZH
20125 <p>
20126 </p>
20127 !! end
20128
20129 !! test
20130 Partly disable title conversion if variant == main language code, more
20131 !! options
20132 language=zh variant=zh title=[[ZH]] showtitle
20133 !! wikitext
20134 -{T|TW}-
20135 !! html
20136 ZH
20137 <p>
20138 </p>
20139 !! end
20140
20141 !! test
20142 Raw output of variant escape tags (R flag)
20143 !! options
20144 language=zh variant=zh-tw
20145 !! wikitext
20146 Raw: -{R|zh:China;zh-tw:Taiwan}-
20147 !! html
20148 <p>Raw: zh:China;zh-tw:Taiwan
20149 </p>
20150 !! end
20151
20152 !! test
20153 Strings evaluating false shouldn't be ignored by Language converter (T51072)
20154 !! options
20155 language=zh variant=zh-cn
20156 !! input
20157 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
20158 !! result
20159 <p>0
20160 </p>
20161 !! end
20162
20163 !! test
20164 Conversion rules from [numeric-only string] to [something else] (T48634)
20165 !! options
20166 language=zh variant=zh-cn
20167 !! input
20168 -{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
20169 !! result
20170 <p>D12345EE12345
20171 </p>
20172 !! end
20173
20174 !! test
20175 Bidirectional converter rule entries with an empty value should be ignored (T53551)
20176 !! options
20177 language=zh variant=zh-cn
20178 !! input
20179 -{H|zh-cn:foo;zh-tw:;}-foobar
20180 !! result
20181 <p>foobar
20182 </p>
20183 !! end
20184
20185 !! test
20186 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
20187 !! options
20188 language=zh variant=zh-cn
20189 !! input
20190 -{H|=>zh-cn:foo;}-foobar
20191 !! result
20192 <p>foobar
20193 </p>
20194 !! end
20195
20196 !! test
20197 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
20198 !! options
20199 language=zh variant=zh-cn
20200 !! input
20201 -{H|}-foobar
20202 !! result
20203 <p>foobar
20204 </p>
20205 !! end
20206
20207 !! test
20208 Nested using of manual convert syntax
20209 !! options
20210 language=zh variant=zh-hk
20211 !! wikitext
20212 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
20213 !! html
20214 <p>Nested: Hello Hong Kong!
20215 </p>
20216 !! end
20217
20218 # Since Parsoid is starting to emit canonical wikitext for links,
20219 # [http://example.com http://example.com] will not RT back to that
20220 # form anymore.
20221 !! test
20222 Proper conversion of text in external links
20223 !! options
20224 language=sr variant=sr-ec
20225 parsoid=wt2html
20226 !! wikitext
20227 http://www.google.com
20228 gopher://www.google.com
20229 [http://www.google.com http://www.google.com]
20230 [gopher://www.google.com gopher://www.google.com]
20231 [https://www.google.com irc://www.google.com]
20232 [ftp://www.google.com www.google.com/ftp://dir]
20233 [//www.google.com www.google.com]
20234 !! html/php
20235 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20236 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20237 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
20238 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
20239 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
20240 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20241 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
20242 </p>
20243 !! html/parsoid
20244 <p><a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20245 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20246 <a rel="mw:ExtLink" href="http://www.google.com">http://www.google.com</a>
20247 <a rel="mw:ExtLink" href="gopher://www.google.com">gopher://www.google.com</a>
20248 <a rel="mw:ExtLink" href="https://www.google.com">irc://www.google.com</a>
20249 <a rel="mw:ExtLink" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
20250 <a rel="mw:ExtLink" href="//www.google.com">www.гоогле.цом</a></p>
20251 !! end
20252
20253 !! test
20254 Do not convert roman numbers to language variants
20255 !! options
20256 language=sr variant=sr-ec
20257 !! wikitext
20258 Fridrih IV je car.
20259 !! html
20260 <p>Фридрих IV је цар.
20261 </p>
20262 !! end
20263
20264 !! test
20265 Unclosed language converter markup "-{"
20266 !! options
20267 language=sr
20268 !! wikitext
20269 -{T|hello
20270 !! html
20271 <p>-{T|hello
20272 </p>
20273 !! end
20274
20275 !! test
20276 Don't convert raw rule "-{R|=&gt;}-" to "=>"
20277 !! options
20278 language=sr
20279 !! wikitext
20280 -{R|=&gt;}-
20281 !! html
20282 <p>=&gt;
20283 </p>
20284 !!end
20285
20286 !! test
20287 Don't break link parsing if language converter markup is in the caption.
20288 !! options
20289 language=sr variant=sr-ec
20290 !! wikitext
20291 [[Main Page|-{R|main page}-]]
20292 !! html
20293 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
20294 </p>
20295 !! end
20296
20297 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20298 !! test
20299 Don't break image parsing if language converter markup is in the caption.
20300 !! options
20301 language=sr
20302 !! wikitext
20303 [[File:Foobar.jpg|-{R|caption}-]]
20304 !! html/parsoid
20305 <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>
20306 </p>
20307 !! end
20308
20309 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20310 !! test
20311 Don't break list handling if language converter markup is in the item.
20312 !! options
20313 language=zh variant=zh-cn
20314 !! wikitext
20315 ;-{zh-cn:AAA;zh-tw:BBB}-
20316 !! html/php
20317 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
20318
20319 !! html/parsoid
20320 <dl><dt>AAA
20321 </dt></dl>
20322 !! end
20323
20324 # FIXME: This test is currently broken in the PHP parser (bug 52661)
20325 !! test
20326 Don't break table handling if language converter markup is in the cell.
20327 !! options
20328 language=sr variant=sr-ec
20329 !! wikitext
20330 {|
20331 |-
20332 | -{R|B}-
20333 |}
20334 !! html/php
20335 <table>
20336
20337 <tr>
20338 <td>Б}-
20339 </td></tr></table>
20340
20341 !! html/parsoid
20342 <table>
20343
20344 <tr>
20345 <td> B
20346 </td></tr></table>
20347
20348 !! end
20349
20350 !! test
20351 Bug 529: Uncovered bullet
20352 !! wikitext
20353 * Foo {{bullet}}
20354 !! html
20355 <ul><li> Foo </li>
20356 <li> Bar</li></ul>
20357
20358 !! end
20359
20360 # Plain MediaWiki does not remove empty lists, but tidy actually does.
20361 # Templates in Wikipedia rely on this behavior, as tidy has always been
20362 # enabled there. These tests are normally run *without* tidy, so specify the
20363 # full output here.
20364 # To test realistic parsing behavior, apply a tidy-like transformation to both
20365 # the expected output and your parser's output.
20366 !! test
20367 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
20368 !! wikitext
20369 ******* Foo {{bullet}}
20370 !! html
20371 <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>
20372 <li> Bar</li></ul>
20373
20374 !! end
20375
20376 !! test
20377 Bug 529: Uncovered table already at line-start
20378 !! wikitext
20379 x
20380
20381 {{table}}
20382 y
20383 !! html
20384 <p>x
20385 </p>
20386 <table>
20387 <tr>
20388 <td> 1 </td>
20389 <td> 2
20390 </td></tr>
20391 <tr>
20392 <td> 3 </td>
20393 <td> 4
20394 </td></tr></table>
20395 <p>y
20396 </p>
20397 !! end
20398
20399 !! test
20400 Bug 529: Uncovered bullet in parser function result
20401 !! wikitext
20402 * Foo {{lc:{{bullet}} }}
20403 !! html
20404 <ul><li> Foo </li>
20405 <li> bar</li></ul>
20406
20407 !! end
20408
20409 !! test
20410 Bug 5678: Double-parsed template argument
20411 !! wikitext
20412 {{lc:{{{1}}}|hello}}
20413 !! html
20414 <p>{{{1}}}
20415 </p>
20416 !! end
20417
20418 !! test
20419 Bug 5678: Double-parsed template invocation
20420 !! wikitext
20421 {{lc:{{paramtest {{!}} param = hello }} }}
20422 !! html
20423 <p>{{paramtest | param = hello }}
20424 </p>
20425 !! end
20426
20427 !! test
20428 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
20429 !! options
20430 language=cs
20431 title=[[Main Page]]
20432 !! wikitext
20433 {{PRVNÍVELKÉ:ěščř}}
20434 {{prvnívelké:ěščř}}
20435 {{PRVNÍMALÉ:ěščř}}
20436 {{prvnímalé:ěščř}}
20437 {{MALÁ:ěščř}}
20438 {{malá:ěščř}}
20439 {{VELKÁ:ěščř}}
20440 {{velká:ěščř}}
20441 !! html
20442 <p>Ěščř
20443 Ěščř
20444 ěščř
20445 ěščř
20446 ěščř
20447 ěščř
20448 ĚŠČŘ
20449 ĚŠČŘ
20450 </p>
20451 !! end
20452
20453 !! test
20454 Morwen/13: Unclosed link followed by heading
20455 !! wikitext
20456 [[link
20457 ==heading==
20458 !! html
20459 <p>[[link
20460 </p>
20461 <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>
20462
20463 !! end
20464
20465 !! test
20466 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
20467 !! wikitext
20468 {{foo|
20469 =heading=
20470 !! html
20471 <p>{{foo|
20472 </p>
20473 <h1><span class="mw-headline" id="heading">heading</span></h1>
20474
20475 !! end
20476
20477 !! test
20478 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
20479 !! wikitext
20480 {{foo|
20481 ==heading==
20482 !! html
20483 <p>{{foo|
20484 </p>
20485 <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>
20486
20487 !! end
20488
20489 !! test
20490 Tildes in comments
20491 !! options
20492 pst
20493 !! wikitext
20494 <!-- ~~~~ -->
20495 !! html/php
20496 <!-- ~~~~ -->
20497 !! end
20498
20499 !! test
20500 Paragraphs inside divs (no extra line breaks)
20501 !! wikitext
20502 <div>Line one
20503
20504 Line two</div>
20505 !! html
20506 <div>Line one
20507 Line two</div>
20508
20509 !! end
20510
20511 !! test
20512 Paragraphs inside divs (extra line break on open)
20513 !! wikitext
20514 <div>
20515 Line one
20516
20517 Line two</div>
20518 !! html
20519 <div>
20520 <p>Line one
20521 </p>
20522 Line two</div>
20523
20524 !! end
20525
20526 !! test
20527 Paragraphs inside divs (extra line break on close)
20528 !! wikitext
20529 <div>Line one
20530
20531 Line two
20532 </div>
20533 !! html
20534 <div>Line one
20535 <p>Line two
20536 </p>
20537 </div>
20538
20539 !! end
20540
20541 !! test
20542 Paragraphs inside divs (extra line break on open and close)
20543 !! wikitext
20544 <div>
20545 Line one
20546
20547 Line two
20548 </div>
20549 !! html
20550 <div>
20551 <p>Line one
20552 </p><p>Line two
20553 </p>
20554 </div>
20555
20556 !! end
20557
20558 !! test
20559 Nesting tags, paragraphs on lines which begin with <div>
20560 !! wikitext
20561 <div></div><strong>A
20562 B</strong>
20563 !! html/php+tidy
20564 <p><strong>A</strong></p>
20565 <p><strong>B</strong></p>
20566 !! html/parsoid
20567 <div></div>
20568 <p><strong>A
20569 B</strong>
20570 </p>
20571 !! end
20572
20573 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
20574 !! test
20575 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
20576 !! wikitext
20577 <blockquote>Line one
20578
20579 Line two</blockquote>
20580 !! html
20581 <blockquote>Line one
20582 Line two</blockquote>
20583
20584 !! html+tidy
20585 <blockquote>
20586 <p>Line one Line two</p>
20587 </blockquote>
20588 !! end
20589
20590 !! test
20591 Bug 6200: paragraphs inside blockquotes (extra line break on open)
20592 !! wikitext
20593 <blockquote>
20594 Line one
20595
20596 Line two</blockquote>
20597 !! html
20598 <blockquote>
20599 <p>Line one
20600 </p>
20601 Line two</blockquote>
20602
20603 !! html+tidy
20604 <blockquote>
20605 <p>Line one</p>
20606 Line two</blockquote>
20607 !! end
20608
20609 !! test
20610 Bug 6200: paragraphs inside blockquotes (extra line break on close)
20611 !! wikitext
20612 <blockquote>Line one
20613
20614 Line two
20615 </blockquote>
20616 !! html
20617 <blockquote>Line one
20618 <p>Line two
20619 </p>
20620 </blockquote>
20621
20622 !! html+tidy
20623 <blockquote>
20624 <p>Line one</p>
20625 <p>Line two</p>
20626 </blockquote>
20627 !! end
20628
20629 !! test
20630 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
20631 !! wikitext
20632 <blockquote>
20633 Line one
20634
20635 Line two
20636 </blockquote>
20637 !! html
20638 <blockquote>
20639 <p>Line one
20640 </p><p>Line two
20641 </p>
20642 </blockquote>
20643
20644 !! html+tidy
20645 <blockquote>
20646 <p>Line one</p>
20647 <p>Line two</p>
20648 </blockquote>
20649 !! end
20650
20651 !! test
20652 Paragraphs inside blockquotes/divs (no extra line breaks)
20653 !! wikitext
20654 <blockquote><div>Line one
20655
20656 Line two</div></blockquote>
20657 !! html
20658 <blockquote><div>Line one
20659 Line two</div></blockquote>
20660
20661 !! end
20662
20663 !! test
20664 Paragraphs inside blockquotes/divs (extra line break on open)
20665 !! wikitext
20666 <blockquote><div>
20667 Line one
20668
20669 Line two</div></blockquote>
20670 !! html
20671 <blockquote><div>
20672 <p>Line one
20673 </p>
20674 Line two</div></blockquote>
20675
20676 !! end
20677
20678 !! test
20679 Paragraphs inside blockquotes/divs (extra line break on close)
20680 !! wikitext
20681 <blockquote><div>Line one
20682
20683 Line two
20684 </div></blockquote>
20685 !! html
20686 <blockquote><div>Line one
20687 <p>Line two
20688 </p>
20689 </div></blockquote>
20690
20691 !! end
20692
20693 !! test
20694 Paragraphs inside blockquotes/divs (extra line break on open and close)
20695 !! wikitext
20696 <blockquote><div>
20697 Line one
20698
20699 Line two
20700 </div></blockquote>
20701 !! html
20702 <blockquote><div>
20703 <p>Line one
20704 </p><p>Line two
20705 </p>
20706 </div></blockquote>
20707
20708 !! end
20709
20710 !! test
20711 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
20712 !! options
20713 wgLinkHolderBatchSize=0
20714 !! wikitext
20715 [[meatball:1]]
20716 [[meatball:2]]
20717 [[meatball:3]]
20718 !! html
20719 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
20720 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
20721 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
20722 </p>
20723 !! end
20724
20725 !! test
20726 Free external link invading image caption
20727 !! wikitext
20728 [[Image:Foobar.jpg|thumb|http://x|hello]]
20729 !! html
20730 <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>
20731
20732 !! end
20733
20734 !! test
20735 Bug 15196: localised external link numbers
20736 !! options
20737 language=fa
20738 !! wikitext
20739 [http://en.wikipedia.org/]
20740 !! html/php
20741 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
20742 </p>
20743 !! html/parsoid
20744 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
20745 !! end
20746
20747 !! test
20748 Multibyte character in padleft
20749 !! wikitext
20750 {{padleft:-Hello|7|Æ}}
20751 !! html
20752 <p>Æ-Hello
20753 </p>
20754 !! end
20755
20756 !! test
20757 Multibyte character in padright
20758 !! wikitext
20759 {{padright:Hello-|7|Æ}}
20760 !! html
20761 <p>Hello-Æ
20762 </p>
20763 !! end
20764
20765 !!test
20766 formatdate parser function
20767 !! wikitext
20768 {{#formatdate:2009-03-24}}
20769 !! html
20770 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
20771 </p>
20772 !! end
20773
20774 !!test
20775 formatdate parser function, with default format
20776 !! wikitext
20777 {{#formatdate:2009-03-24|mdy}}
20778 !! html
20779 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
20780 </p>
20781 !! end
20782
20783 !! test
20784 Spacing of numbers in formatted dates
20785 !! wikitext
20786 {{#formatdate:January 15}}
20787 !! html
20788 <p><span class="mw-formatted-date" title="01-15">January 15</span>
20789 </p>
20790 !! end
20791
20792 !! test
20793 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
20794 !! options
20795 language=nl title=[[MediaWiki:Common.css]]
20796 !! wikitext
20797 {{#formatdate:2009-03-24|dmy}}
20798 !! html
20799 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
20800 </p>
20801 !! end
20802
20803 #
20804 #
20805 #
20806
20807 #
20808 # Edit comments
20809 #
20810
20811 !! test
20812 Edit comment with link
20813 !! options
20814 comment
20815 !! wikitext
20816 I like the [[Main Page]] a lot
20817 !! html/php
20818 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
20819 !!end
20820
20821 !! test
20822 Edit comment with link and link text
20823 !! options
20824 comment
20825 !! wikitext
20826 I like the [[Main Page|best pages]] a lot
20827 !! html/php
20828 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20829 !!end
20830
20831 !! test
20832 Edit comment with link and link text with suffix
20833 !! options
20834 comment
20835 !! wikitext
20836 I like the [[Main Page|best page]]s a lot
20837 !! html/php
20838 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20839 !!end
20840
20841 !! test
20842 Edit comment with section link (non-local, eg in history list)
20843 !! options
20844 comment title=[[Main Page]]
20845 !! wikitext
20846 /* External links */ removed bogus entries
20847 !! html/php
20848 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20849 !!end
20850
20851 !! test
20852 Edit comment with section link and text before it (non-local, eg in history list)
20853 !! options
20854 comment title=[[Main Page]]
20855 !! wikitext
20856 pre-comment text /* External links */ removed bogus entries
20857 !! html/php
20858 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>
20859 !!end
20860
20861 !! test
20862 Edit comment with section link (local, eg in diff view)
20863 !! options
20864 comment local title=[[Main Page]]
20865 !! wikitext
20866 /* External links */ removed bogus entries
20867 !! html/php
20868 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20869 !!end
20870
20871 !! test
20872 Edit comment with subpage link (bug 14080)
20873 !! options
20874 comment
20875 subpage
20876 title=[[Subpage test]]
20877 !! wikitext
20878 Poked at a [[/subpage]] here...
20879 !! html/php
20880 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
20881 !!end
20882
20883 !! test
20884 Edit comment with subpage link and link text (bug 14080)
20885 !! options
20886 comment
20887 subpage
20888 title=[[Subpage test]]
20889 !! wikitext
20890 Poked at a [[/subpage|neat little page]] here...
20891 !! html/php
20892 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
20893 !!end
20894
20895 !! test
20896 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
20897 !! options
20898 comment
20899 title=[[Subpage test]]
20900 !! wikitext
20901 Poked at a [[/subpage]] here...
20902 !! html/php
20903 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...
20904 !!end
20905
20906 !! test
20907 Edit comment with bare anchor link (local, as on diff)
20908 !! options
20909 comment
20910 local
20911 title=[[Main Page]]
20912 !! wikitext
20913 [[#section]]
20914 !! html/php
20915 <a href="#section">#section</a>
20916 !! end
20917
20918 !! test
20919 Edit comment with bare anchor link (non-local, as on history)
20920 !! options
20921 comment
20922 title=[[Main Page]]
20923 !! wikitext
20924 [[#section]]
20925 !! html/php
20926 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
20927 !! end
20928
20929 !! test
20930 Anchor starting with underscore
20931 !! options
20932 title=[[Foo]]
20933 !! wikitext
20934 [[#_ref|One]]
20935 !! html/php
20936 <p><a href="#_ref">One</a>
20937 </p>
20938 !! html/parsoid
20939 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
20940 !! end
20941
20942 !! test
20943 Id starting with underscore
20944 !! wikitext
20945 <div id="_ref"></div>
20946 !! html/*
20947 <div id="_ref"></div>
20948
20949 !! end
20950
20951 !! test
20952 Edit comment with link with more than one pipe (T99346)
20953 !! options
20954 comment
20955 !! wikitext
20956 [[Main Page|Many|pipes]]
20957 !! html
20958 <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
20959 !! end
20960
20961 !! test
20962 Complex edit comment with link with more than one pipe (T99346)
20963 !! options
20964 comment
20965 !! wikitext
20966 Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
20967 !! html
20968 Created page with &quot;&lt;noinclude&gt;<a href="/index.php?title=Category:Requests_for_permissions/Bot&amp;action=edit&amp;redlink=1" class="new" title="Category:Requests for permissions/Bot (page does not exist)">{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}</a>&lt;/noinclude&gt; === <a href="/index.php?title=User:MineoBot&amp;action=edit&amp;redlink=1" class="new" title="User:MineoBot (page does not exist)">User:MineoBot</a> 8=== {{Request for permissions/links|Mineo...&quot;
20969 !! end
20970
20971 !! test
20972 Space normalisation on autocomment (bug 22784)
20973 !! options
20974 comment
20975 title=[[Main Page]]
20976 !! wikitext
20977 /* __hello__world__ */
20978 !! html/php
20979 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
20980 !! end
20981
20982 !! test
20983 percent-encoding and + signs in comments (Bug 26410)
20984 !! options
20985 comment
20986 !! wikitext
20987 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
20988 !! html/php
20989 <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>
20990 !! end
20991
20992 # Parsoid doesn't support this yet: see bug 73581
20993 # but it *should* omit the 'src' attribute if the image is bad.
20994 # PHP side of tests was disabled in
20995 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
20996 # because of issues in the PHP parserTests infrastructure
20997 # (but the output below is indeed what the PHP side emits)
20998 !! test
20999 Bad images - basic functionality
21000 !! wikitext
21001 [[File:Bad.jpg]]
21002 !! DISABLED/html/php
21003 !! html/parsoid
21004 <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>
21005 !! end
21006
21007 !! test
21008 Bad images - bug 16039: text after bad image disappears
21009 !! wikitext
21010 Foo bar
21011 [[File:Bad.jpg]]
21012 Bar foo
21013 !! DISABLED/html/php
21014 <p>Foo bar
21015 </p><p>Bar foo
21016 </p>
21017 !! html/parsoid
21018 <p>Foo bar
21019 <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>
21020 Bar foo</p>
21021 !! end
21022
21023 !! test
21024 Verify that displaytitle works (bug #22501) no displaytitle
21025 !! options
21026 showtitle
21027 !! config
21028 wgAllowDisplayTitle=true
21029 wgRestrictDisplayTitle=false
21030 !! wikitext
21031 this is not the the title
21032 !! html/php
21033 Parser test
21034 <p>this is not the the title
21035 </p>
21036 !! end
21037
21038 !! test
21039 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
21040 !! options
21041 showtitle
21042 title=[[Screen]]
21043 !! config
21044 wgAllowDisplayTitle=true
21045 wgRestrictDisplayTitle=false
21046 !! wikitext
21047 this is not the the title
21048 {{DISPLAYTITLE:whatever}}
21049 !! html/php
21050 whatever
21051 <p>this is not the the title
21052 </p>
21053 !! end
21054
21055 !! test
21056 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
21057 !! options
21058 showtitle
21059 title=[[Screen]]
21060 !! config
21061 wgAllowDisplayTitle=true
21062 wgRestrictDisplayTitle=true
21063 !! wikitext
21064 this is not the the title
21065 {{DISPLAYTITLE:whatever}}
21066 !! html/php
21067 Screen
21068 <p>this is not the the title
21069 </p>
21070 !! end
21071
21072 !! test
21073 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
21074 !! options
21075 showtitle
21076 title=[[Screen]]
21077 !! config
21078 wgAllowDisplayTitle=true
21079 wgRestrictDisplayTitle=true
21080 !! wikitext
21081 this is not the the title
21082 {{DISPLAYTITLE:screen}}
21083 !! html/php
21084 screen
21085 <p>this is not the the title
21086 </p>
21087 !! end
21088
21089 !! test
21090 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
21091 !! options
21092 showtitle
21093 title=[[Screen]]
21094 !! config
21095 wgAllowDisplayTitle=false
21096 !! wikitext
21097 this is not the the title
21098 {{DISPLAYTITLE:screen}}
21099 !! html/php
21100 Screen
21101 <p>this is not the the title
21102 <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>
21103 </p>
21104 !! end
21105
21106 !! test
21107 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
21108 !! options
21109 showtitle
21110 title=[[Screen]]
21111 !! config
21112 wgAllowDisplayTitle=false
21113 !! wikitext
21114 this is not the the title
21115 !! html/php
21116 Screen
21117 <p>this is not the the title
21118 </p>
21119 !! end
21120
21121 !! test
21122 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
21123 !! options
21124 showtitle
21125 title=[[Screen]]
21126 !! config
21127 wgAllowDisplayTitle=true
21128 wgRestrictDisplayTitle=true
21129 !! wikitext
21130 this is not the the title
21131 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
21132 !! html/php
21133 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
21134 <p>this is not the the title
21135 </p>
21136 !! end
21137
21138 !! test
21139 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
21140 !! options
21141 showtitle
21142 title=[[Screen]]
21143 !! config
21144 wgAllowDisplayTitle=true
21145 wgRestrictDisplayTitle=true
21146 !! wikitext
21147 this is not the the title
21148 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
21149 !! html/php
21150 <span style="color: red;">s</span>creen
21151 <p>this is not the the title
21152 </p>
21153 !! end
21154
21155 !! test
21156 Page status indicators: Empty name is invalid
21157 !! options
21158 showindicators
21159 !! wikitext
21160 <indicator name=" "></indicator>
21161 <indicator></indicator>
21162 !! html
21163 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21164 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
21165 </p>
21166 !! end
21167
21168 !! test
21169 Page status indicators: Weird syntaxes that are okay
21170 !! options
21171 showindicators
21172 !! wikitext
21173 <indicator name="empty" />
21174 <indicator name="name"></indicator>
21175 !! html
21176 empty=
21177 name=
21178 <p><br />
21179 </p>
21180 !! end
21181
21182 !! test
21183 Page status indicators: Torture test
21184 !! options
21185 showindicators
21186 !! wikitext
21187 <indicator name="01">hello world</indicator>
21188 <indicator name="02">[[Main Page]]</indicator>
21189 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
21190 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
21191 <indicator name="05">* foo
21192 * bar</indicator>
21193 <indicator name="06"><nowiki>foo</nowiki></indicator>
21194 <indicator name="07"> Preformatted</indicator>
21195 <indicator name="08"><div>Broken tag</indicator>
21196 <indicator name="09">{| class=wikitable
21197 | cell
21198 |}</indicator>
21199 <indicator name="10">Two
21200
21201 paragraphs</indicator>
21202 !! html
21203 01=hello world
21204 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
21205 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" />
21206 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>
21207 05=<ul><li> foo</li>
21208 <li> bar</li></ul>
21209
21210 06=foo
21211 07=<pre>Preformatted
21212 </pre>
21213 08=<div>Broken tag</div>
21214
21215 09=<table class="wikitable">
21216 <tr>
21217 <td> cell
21218 </td></tr></table>
21219
21220 10=<p>Two
21221 </p><p>paragraphs
21222 </p>
21223 <p><br />
21224 </p><p><br />
21225 </p><p><br />
21226 </p><p><br />
21227 </p><p><br />
21228 </p>
21229 !! end
21230
21231 !! test
21232 preload: check <noinclude> and <includeonly>
21233 !! options
21234 preload
21235 !! wikitext
21236 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
21237 !! html/php
21238 Hello kind world.
21239 !! end
21240
21241 !! test
21242 preload: check <onlyinclude>
21243 !! options
21244 preload
21245 !! wikitext
21246 Goodbye <onlyinclude>Hello world</onlyinclude>
21247 !! html/php
21248 Hello world
21249 !! end
21250
21251 !! test
21252 preload: can pass tags through if we want to
21253 !! options
21254 preload
21255 !! wikitext
21256 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
21257 !! html/php
21258 <includeonly>Hello world</includeonly>
21259 !! end
21260
21261 !! test
21262 preload: check that it doesn't try to do tricks
21263 !! options
21264 preload
21265 !! wikitext
21266 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21267 !! html/php
21268 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
21269 !! end
21270
21271 !! test
21272 Play a bit with r67090 and bug 3158
21273 !! wikitext
21274 <div style="width:50% !important">&nbsp;</div>
21275 <div style="width:50%&nbsp;!important">&nbsp;</div>
21276 <div style="width:50%&#160;!important">&nbsp;</div>
21277 <div style="border : solid;">&nbsp;</div>
21278 !! html/php
21279 <div style="width:50% !important">&#160;</div>
21280 <div style="width:50% !important">&#160;</div>
21281 <div style="width:50% !important">&#160;</div>
21282 <div style="border&#160;: solid;">&#160;</div>
21283
21284 !! html/parsoid
21285 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21286 <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>
21287 <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>
21288 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
21289
21290 !! end
21291
21292 !! test
21293 HTML5 data attributes
21294 !! wikitext
21295 <span data-foo="bar">Baz</span>
21296 <p data-abc-def_hij="">Quuz</p>
21297 !! html/php
21298 <p><span data-foo="bar">Baz</span>
21299 </p>
21300 <p data-abc-def_hij="">Quuz</p>
21301
21302 !! html/parsoid
21303 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
21304 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
21305 !! end
21306
21307 !! test
21308 Strip reserved data attributes
21309 !! wikitext
21310 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
21311 !! html/php
21312 <div data-ok="fred">d</div>
21313
21314 !! html/parsoid
21315 <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>
21316 !! end
21317
21318 !! test
21319 percent-encoding and + signs in internal links (Bug 26410)
21320 !! wikitext
21321 [[User:+%]] [[Page+title%]]
21322 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
21323 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
21324 [[%33%45]] [[%33%45+]]
21325 !! html/php
21326 <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>
21327 <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>
21328 <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>
21329 <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>
21330 </p>
21331 !! html/parsoid
21332 <p><a rel="mw:WikiLink" href="./User:+%25" title="User:+%" data-parsoid='{"stx":"simple","a":{"href":"./User:+%25"},"sa":{"href":"User:+%"}}'>User:+%</a> <a rel="mw:WikiLink" href="./Page+title%25" title="Page+title%" data-parsoid='{"stx":"simple","a":{"href":"./Page+title%25"},"sa":{"href":"Page+title%"}}'>Page+title%</a>
21333 <a rel="mw:WikiLink" href="./%25+" title="%+" data-parsoid='{"stx":"simple","a":{"href":"./%25+"},"sa":{"href":"%+"}}'>%+</a> <a rel="mw:WikiLink" href="./%25+" title="%+" data-parsoid='{"stx":"piped","a":{"href":"./%25+"},"sa":{"href":"%+"}}'>%20</a> <a rel="mw:WikiLink" href="./%25+" title="%+" data-parsoid='{"stx":"simple","a":{"href":"./%25+"},"sa":{"href":"%+ "}}'>%+ </a> <a rel="mw:WikiLink" href="./%25+r" title="%+r" data-parsoid='{"stx":"simple","a":{"href":"./%25+r"},"sa":{"href":"%+r"}}'>%+r</a>
21334 <a rel="mw:WikiLink" href="./%25" title="%" data-parsoid='{"stx":"simple","a":{"href":"./%25"},"sa":{"href":"%"}}'>%</a> <a rel="mw:WikiLink" href="./+" title="+" data-parsoid='{"stx":"simple","a":{"href":"./+"},"sa":{"href":"+"}}'>+</a> <span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"bogus","ak":"foo"},{"ck":"caption","ak":"[[bar]]"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;a rel=\"mw:WikiLink\" href=\"./Bar\" title=\"Bar\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Bar\"},\"sa\":{\"href\":\"bar\"},\"dsr\":[94,101,2,2]}&#39;>bar&lt;/a>"}'><a href="./File:%25+abc9" data-parsoid='{"a":{"href":"./File:%25+abc9"},"sa":{}}'><img resource="./File:%25+abc9" src="./Special:FilePath/%25+abc9" height="220" width="220" data-parsoid='{"a":{"resource":"./File:%25+abc9","height":"220","width":"220"},"sa":{"resource":"File:%+abc%39"}}'/></a></span>
21335 <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>
21336 !! end
21337
21338 !! test
21339 Special characters in embedded file links (bug 27679)
21340 !! wikitext
21341 [[File:Contains & ampersand.jpg]]
21342 [[File:Does not exist.jpg|Title with & ampersand]]
21343 !! html/php
21344 <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>
21345 <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>
21346 </p>
21347 !! html/parsoid
21348 <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>
21349 <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>
21350 !! end
21351
21352 !! test
21353 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
21354 !! wikitext
21355 Text&apos;s been normalized?
21356 !! html
21357 <p>Text&#39;s been normalized?
21358 </p>
21359 !! end
21360
21361 !! test
21362 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
21363 !! wikitext
21364 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
21365 !! html
21366 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
21367 </p>
21368 !! end
21369
21370 !! test
21371 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
21372 !! wikitext
21373 [http://www.example.org/ ideograms]
21374 !! html
21375 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
21376 </p>
21377 !! end
21378
21379 !! test
21380 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
21381 !! wikitext
21382 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
21383 !! html
21384 <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
21385 </p>
21386 !! end
21387
21388 !! article
21389 Mediawiki:loop1
21390 !! text
21391 {{Identical|A}}
21392 !! endarticle
21393
21394 !! article
21395 Mediawiki:loop2
21396 !! text
21397 {{Identical|B}}
21398 !! endarticle
21399
21400 !! article
21401 Template:Identical
21402 !! text
21403 {{int:loop1}}
21404 {{int:loop2}}
21405 !! endarticle
21406
21407 !! test
21408 Bug 31098 Template which includes system messages which includes the template
21409 !! wikitext
21410 {{Identical}}
21411 !! html
21412 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21413 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
21414 </p>
21415 !! end
21416
21417 !! test
21418 Bug31490 Turkish: ucfirst 'blah'
21419 !! options
21420 language=tr
21421 !! wikitext
21422 {{ucfirst:blah}}
21423 !! html
21424 <p>Blah
21425 </p>
21426 !! end
21427
21428 !! test
21429 Bug31490 Turkish: ucfirst 'ix'
21430 !! options
21431 language=tr
21432 !! wikitext
21433 {{ucfirst:ix}}
21434 !! html
21435 <p>İx
21436 </p>
21437 !! end
21438
21439 !! test
21440 Bug31490 Turkish: lcfirst 'BLAH'
21441 !! options
21442 language=tr
21443 !! wikitext
21444 {{lcfirst:BLAH}}
21445 !! html
21446 <p>bLAH
21447 </p>
21448 !! end
21449
21450 !! test
21451 Bug31490 Turkish: ucfırst (with a dotless i)
21452 !! options
21453 language=tr
21454 !! wikitext
21455 {{ucfırst:blah}}
21456 !! html
21457 <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>
21458 </p>
21459 !! end
21460
21461 !! test
21462 Bug31490 ucfırst (with a dotless i) with English language
21463 !! options
21464 language=en
21465 !! wikitext
21466 {{ucfırst:blah}}
21467 !! html
21468 <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>
21469 </p>
21470 !! end
21471
21472 !! test
21473 Bug 26375: TOC with italics
21474 !! options
21475 title=[[Main Page]]
21476 !! wikitext
21477 __TOC__
21478 == ''Lost'' episodes ==
21479 !! html
21480 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21481 <ul>
21482 <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>
21483 </ul>
21484 </div>
21485
21486 <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>
21487
21488 !! end
21489
21490 !! test
21491 Bug 26375: TOC with bold
21492 !! options
21493 title=[[Main Page]]
21494 !! wikitext
21495 __TOC__
21496 == '''should be bold''' then normal text ==
21497 !! html
21498 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21499 <ul>
21500 <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>
21501 </ul>
21502 </div>
21503
21504 <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>
21505
21506 !! end
21507
21508 !! test
21509 Bug 33845: Headings become cursive in TOC when they contain an image
21510 !! options
21511 title=[[Main Page]]
21512 !! wikitext
21513 __TOC__
21514 == Image [[Image:foobar.jpg]] ==
21515 !! html
21516 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21517 <ul>
21518 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
21519 </ul>
21520 </div>
21521
21522 <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>
21523
21524 !! end
21525
21526 !! test
21527 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
21528 !! options
21529 title=[[Main Page]]
21530 !! wikitext
21531 __TOC__
21532 == <blockquote>Quote</blockquote> ==
21533 !! html
21534 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21535 <ul>
21536 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21537 </ul>
21538 </div>
21539
21540 <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>
21541
21542 !! html+tidy
21543 <p></p>
21544 <div id="toc" class="toc">
21545 <div id="toctitle">
21546 <h2>Contents</h2>
21547 </div>
21548 <ul>
21549 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
21550 </ul>
21551 </div>
21552 <p></p>
21553 <h2><span class="mw-headline" id="Quote"></span></h2>
21554 <blockquote>
21555 <p><span class="mw-headline" id="Quote">Quote</span></p>
21556 </blockquote>
21557 <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>
21558 !! end
21559
21560 !! test
21561 Unclosed tags in TOC
21562 !! options
21563 title=[[Main Page]]
21564 !! wikitext
21565 __TOC__
21566 == Proof: 2 < 3 ==
21567 <small>Hanc marginis exiguitas non caperet.</small>
21568 QED
21569 !! html
21570 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21571 <ul>
21572 <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>
21573 </ul>
21574 </div>
21575
21576 <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>
21577 <p><small>Hanc marginis exiguitas non caperet.</small>
21578 QED
21579 </p>
21580 !! end
21581
21582 !! test
21583 Multiple tags in TOC
21584 !! wikitext
21585 __TOC__
21586 == <i>Foo</i> <b>Bar</b> ==
21587
21588 == <i>Foo</i> <blockquote>Bar</blockquote> ==
21589 !! html
21590 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21591 <ul>
21592 <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>
21593 <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>
21594 </ul>
21595 </div>
21596
21597 <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>
21598 <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>
21599
21600 !! html+tidy
21601 <p></p>
21602 <div id="toc" class="toc">
21603 <div id="toctitle">
21604 <h2>Contents</h2>
21605 </div>
21606 <ul>
21607 <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>
21608 <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>
21609 </ul>
21610 </div>
21611 <p></p>
21612 <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>
21613 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
21614 <blockquote>
21615 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
21616 </blockquote>
21617 <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>
21618 !! end
21619
21620 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
21621 # html5 tag parsing.
21622 !! test
21623 Tags with parameters in TOC
21624 !! options
21625 parsoid=wt2html
21626 !! wikitext
21627 __TOC__
21628 == <sup class="in-h2">Hello</sup> ==
21629
21630 == <sup class="a > b">Evilbye</sup> ==
21631 !! html/php
21632 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21633 <ul>
21634 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
21635 <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>
21636 </ul>
21637 </div>
21638
21639 <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>
21640 <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>
21641
21642 !! html/parsoid
21643 <meta property="mw:PageProp/toc" />
21644 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
21645
21646 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
21647 !! end
21648
21649 !! test
21650 span tags with directionality in TOC
21651 !! wikitext
21652 __TOC__
21653 == <span dir="ltr">C++</span> ==
21654
21655 == <span dir="rtl">זבנג!</span> ==
21656
21657 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
21658
21659 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
21660
21661 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
21662 !! html
21663 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21664 <ul>
21665 <li class="toclevel-1 tocsection-1"><a href="#C.2B.2B"><span class="tocnumber">1</span> <span class="toctext"><span dir="ltr">C++</span></span></a></li>
21666 <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>
21667 <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>
21668 <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>
21669 <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>
21670 </ul>
21671 </div>
21672
21673 <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>
21674 <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>
21675 <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>
21676 <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>
21677 <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>
21678
21679 !! end
21680
21681 !! test
21682 Bug 72884: bdi element in ToC
21683 !! wikitext
21684 __TOC__
21685 == <bdi>test</bdi> ==
21686 !! html
21687 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21688 <ul>
21689 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
21690 </ul>
21691 </div>
21692
21693 <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>
21694
21695 !! end
21696
21697 !! test
21698 T35715: s/strike element in ToC
21699 !! wikitext
21700 __TOC__
21701 == <s>test</s> test <strike>test</strike> ==
21702 !! html
21703 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21704 <ul>
21705 <li class="toclevel-1 tocsection-1"><a href="#test_test_test"><span class="tocnumber">1</span> <span class="toctext"><s>test</s> test <strike>test</strike></span></a></li>
21706 </ul>
21707 </div>
21708
21709 <h2><span class="mw-headline" id="test_test_test"><s>test</s> test <strike>test</strike></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: test test test">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
21710
21711 !! end
21712
21713 # Note that the html output does not have the <p></p>, but the
21714 # html+tidy output *does*. This is because the empty <p></p> is
21715 # removed by the sanitizer, but only when tidy is *not* enabled (!).
21716 !! test
21717 Empty <p> tag in TOC, removed by Sanitizer (T92892)
21718 !! wikitext
21719 __TOC__
21720 == x ==
21721 !! html
21722 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21723 <ul>
21724 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21725 </ul>
21726 </div>
21727
21728 <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>
21729
21730 !! html+tidy
21731 <p></p>
21732 <div id="toc" class="toc">
21733 <div id="toctitle">
21734 <h2>Contents</h2>
21735 </div>
21736 <ul>
21737 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21738 </ul>
21739 </div>
21740 <p></p>
21741 <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>
21742 !! end
21743
21744 !! article
21745 MediaWiki:Bug32057
21746 !! text
21747 == {{int:headline_sample}} ==
21748 !! endarticle
21749
21750 !! test
21751 Bug 32057: Title needed when expanding <h> nodes.
21752 !! options
21753 title=[[Main Page]]
21754 !! wikitext
21755 {{int:Bug32057}}
21756 !! html
21757 <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>
21758
21759 !! end
21760
21761 !! test
21762 Strip marker in urlencode
21763 !! wikitext
21764 {{urlencode:x<nowiki/>y}}
21765 {{urlencode:x<nowiki/>y|wiki}}
21766 {{urlencode:x<nowiki/>y|path}}
21767 {{urlencode:x<pre id="one">two</pre>y}}
21768 !! html
21769 <p>xy
21770 xy
21771 xy
21772 xy
21773 </p>
21774 !! end
21775
21776 !! test
21777 Strip marker in lc
21778 !! wikitext
21779 {{lc:x<nowiki/>y}}
21780 !! html
21781 <p>xy
21782 </p>
21783 !! end
21784
21785 !! test
21786 Strip marker in uc
21787 !! wikitext
21788 {{uc:x<nowiki/>y}}
21789 !! html
21790 <p>XY
21791 </p>
21792 !! end
21793
21794 !! test
21795 Strip marker in formatNum
21796 !! wikitext
21797 {{formatnum:1<nowiki/>2}}
21798 {{formatnum:1<nowiki/>2|R}}
21799 !! html
21800 <p>12
21801 12
21802 </p>
21803 !! end
21804
21805 !! test
21806 Check noCommafy in formatNum
21807 !! options
21808 language=be-tarask
21809 !! wikitext
21810 {{formatnum:123456.78}}
21811 {{formatnum:123456.78|NOSEP}}
21812 !! html
21813 <p>123 456,78
21814 123456.78
21815 </p>
21816 !! end
21817
21818 !! test
21819 Wrong option for formatNum (bug 56199)
21820 !! wikitext
21821 {{formatnum:1,234.56|Random}}
21822 {{formatnum:1,234.56|EVERYTHING}}
21823 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
21824 !! html
21825 <p>1,234.56
21826 1,234.56
21827 1,234.56
21828 </p>
21829 !! end
21830
21831 !! test
21832 Strip marker in grammar
21833 !! options
21834 language=fi
21835 !! wikitext
21836 {{grammar:elative|foo<nowiki/>bar}}
21837 !! html
21838 <p>foobarista
21839 </p>
21840 !! end
21841
21842 !! test
21843 Strip marker in padleft
21844 !! wikitext
21845 {{padleft:|2|x<nowiki/>y}}
21846 !! html
21847 <p>xy
21848 </p>
21849 !! end
21850
21851 !! test
21852 Strip marker in padright
21853 !! wikitext
21854 {{padright:|2|x<nowiki/>y}}
21855 !! html
21856 <p>xy
21857 </p>
21858 !! end
21859
21860 !! test
21861 Strip marker in anchorencode
21862 !! wikitext
21863 {{anchorencode:x<nowiki/>y}}
21864 !! html
21865 <p>xy
21866 </p>
21867 !! end
21868
21869 !! test
21870 nowiki inside link inside heading (bug 18295)
21871 !! wikitext
21872 ==[[foo|x<nowiki>y</nowiki>z]]==
21873 !! html
21874 <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>
21875
21876 !! end
21877
21878 !! test
21879 new support for bdi element (bug 31817)
21880 !! wikitext
21881 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21882 !! html
21883 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21884
21885 !!end
21886
21887 !! test
21888 Ignore pipe between table row attributes
21889 !! wikitext
21890 {|
21891 | quux
21892 |- id=foo | style='color: red'
21893 | bar
21894 |}
21895 !! html
21896 <table>
21897 <tr>
21898 <td> quux
21899 </td></tr>
21900 <tr id="foo" style="color: red">
21901 <td> bar
21902 </td></tr></table>
21903
21904 !! end
21905
21906 !!test
21907 Gallery override link with WikiLink (bug 34852)
21908 !! wikitext
21909 <gallery>
21910 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
21911 </gallery>
21912 !! html
21913 <ul class="gallery mw-gallery-traditional">
21914 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21915 <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>
21916 <div class="gallerytext">
21917 <p>caption
21918 </p>
21919 </div>
21920 </div></li>
21921 </ul>
21922
21923 !! end
21924
21925 !!test
21926 Gallery override link with absolute external link (bug 34852)
21927 !! wikitext
21928 <gallery>
21929 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21930 </gallery>
21931 !! html
21932 <ul class="gallery mw-gallery-traditional">
21933 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21934 <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>
21935 <div class="gallerytext">
21936 <p>caption
21937 </p>
21938 </div>
21939 </div></li>
21940 </ul>
21941
21942 !! end
21943
21944 !!test
21945 Gallery override link with malicious javascript (bug 34852)
21946 !! wikitext
21947 <gallery>
21948 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21949 </gallery>
21950 !! html
21951 <ul class="gallery mw-gallery-traditional">
21952 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21953 <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>
21954 <div class="gallerytext">
21955 <p>caption
21956 </p>
21957 </div>
21958 </div></li>
21959 </ul>
21960
21961 !! end
21962
21963 !!test
21964 Gallery with invalid title as link (bug 43964)
21965 !! wikitext
21966 <gallery>
21967 File:foobar.jpg|link=<
21968 </gallery>
21969 !! html
21970 <ul class="gallery mw-gallery-traditional">
21971 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21972 <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>
21973 <div class="gallerytext">
21974 </div>
21975 </div></li>
21976 </ul>
21977
21978 !! end
21979
21980 !!test
21981 Language parser function
21982 !! wikitext
21983 {{#language:ar}}
21984 !! html
21985 <p>العربية
21986 </p>
21987 !! end
21988
21989 !!test
21990 Padleft and padright as substr
21991 !! wikitext
21992 {{padleft:|3|abcde}}
21993 {{padright:|3|abcde}}
21994 !! html
21995 <p>abc
21996 abc
21997 </p>
21998 !! end
21999
22000 !!test
22001 Special parser function
22002 !! wikitext
22003 {{#special:RandomPage}}
22004 {{#special:BaDtItLe}}
22005 {{#special:Foobar}}
22006 !! html
22007 <p>Special:Random
22008 Special:Badtitle
22009 Special:Foobar
22010 </p>
22011 !! end
22012
22013 !!test
22014 Bug 34939 - Case insensitive link parsing ([HttP://])
22015 !! wikitext
22016 [HttP://MediaWiki.Org/]
22017 !! html/php
22018 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
22019 </p>
22020 !! html/parsoid
22021 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
22022 !! end
22023
22024 !!test
22025 Bug 34939 - Case insensitive link parsing ([HttP:// title])
22026 !! wikitext
22027 [HttP://MediaWiki.Org/ MediaWiki]
22028 !! html
22029 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
22030 </p>
22031 !! end
22032
22033 !!test
22034 Bug 34939 - Case insensitive link parsing (HttP://)
22035 !! wikitext
22036 HttP://MediaWiki.Org/
22037 !! html/php
22038 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
22039 </p>
22040 !! html/parsoid
22041 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
22042 !! end
22043
22044 !!test
22045 Disable TOC
22046 !! options
22047 notoc
22048 !! wikitext
22049 Lead
22050 == Section 1 ==
22051 == Section 2 ==
22052 == Section 3 ==
22053 == Section 4 ==
22054 == Section 5 ==
22055 !! html
22056 <p>Lead
22057 </p>
22058
22059 <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>
22060 <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>
22061 <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>
22062 <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>
22063 <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>
22064
22065 !! end
22066
22067
22068 ###
22069 ### Parsoid-specific tests
22070 ### Parsoid-PHP parser incompatibilities
22071 ###
22072 !!test
22073 1. SOL-sensitive wikitext tokens as template-args
22074 !!options
22075 parsoid=wt2html,wt2wt
22076 !! wikitext
22077 {{echo|*a}}
22078 {{echo|#a}}
22079 {{echo|:a}}
22080 !! html
22081 <span about="#mwt1" typeof="mw:Transclusion">
22082 </span><ul about="#mwt1"><li>a</li>
22083 </ul>
22084 <span about="#mwt2" typeof="mw:Transclusion">
22085 </span><ol about="#mwt2"><li>a</li>
22086 </ol>
22087 <span about="#mwt3" typeof="mw:Transclusion">
22088 </span><dl about="#mwt3"><dd>a</dd>
22089 </dl>
22090 !!end
22091
22092 #### -----------------------------------------------------------------
22093 #### Parsoid-specific functionality tests
22094 #### -----------------------------------------------------------------
22095
22096 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
22097 # We know wt2wt will fail, but we expect selser to pass.
22098 # Due to the nature of our testing, wt2wt and selser tests will enter the
22099 # blacklist and we'll catch selser regressions based on changes to the
22100 # blacklist entries for selser tests.
22101 !! test
22102 1. Bad treebuilder fixup of formatting elt is cleaned up
22103 !! options
22104 parsoid=wt2html,wt2wt
22105 !! wikitext
22106 {|
22107 |
22108 <small>
22109 [[Image:Foobar.jpg|right|Test]]
22110 </small>
22111 |}
22112 !! html/parsoid
22113 <table>
22114 <tbody><tr><td>
22115 <small>
22116 <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>
22117 </small>
22118 </td></tr>
22119 </tbody></table>
22120 !! end
22121
22122 !! test
22123 2. Bad treebuilder fixup of formatting elt is cleaned up
22124 !! options
22125 parsoid=wt2html,wt2wt
22126 !! wikitext
22127 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
22128
22129 <small>[[Image:Foobar.jpg|right|300px]]</small>
22130 !! html/parsoid
22131
22132 <p><b>foo</b></p>
22133 <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>
22134 <p><b>bar</b></p>
22135 <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>
22136 !! end
22137
22138 !! test
22139 3. Bad treebuilder fixup of formatting elt is cleaned up
22140 !! options
22141 parsoid=wt2html,wt2wt
22142 !! wikitext
22143 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
22144 !! html/parsoid
22145 <p><small><b>foo</b></small></p>
22146 <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>
22147 <p><small><b>bar</b></small></p>
22148 !! end
22149
22150 !! test
22151 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
22152 !! options
22153 parsoid=wt2html,wt2wt
22154 !! wikitext
22155 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
22156 !! html/parsoid
22157 <p><b><small></small></b></p>
22158 <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>
22159 <p></p>
22160 !! end
22161
22162 #### ----------------------------------------------------------------
22163 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
22164 #### tags. Parsoid's output for these tags differs from that of the
22165 #### PHP parser.
22166 #### ----------------------------------------------------------------
22167
22168 !!test
22169 Ref: 1. ref-location should be replaced with an index span
22170 !! wikitext
22171 A <ref>foo</ref>
22172 B <ref name="x">foo</ref>
22173 C <ref name="y" />
22174 <references />
22175 !! html/parsoid
22176 <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>
22177 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>
22178 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>
22179 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22180 <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>
22181 <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>
22182 <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>
22183 </ol>
22184 !!end
22185
22186 !!test
22187 Ref: 2. ref-tags with identical names should all get the same index
22188 !! wikitext
22189 A <ref name="x">foo</ref>
22190 B <ref name="x" />
22191 <references />
22192 !! html/parsoid
22193 <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>
22194 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>
22195 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22196 <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>
22197 </ol>
22198 !!end
22199
22200 !!test
22201 Ref: 3. spaces in ref-names should be ignored
22202 !! wikitext
22203 A <ref name="x">foo</ref>
22204 B <ref name=" x " />
22205 C <ref name= x />
22206 <references />
22207 !! html/parsoid
22208 <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>
22209 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>
22210 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>
22211 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22212 <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>
22213 </ol>
22214 !!end
22215
22216 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
22217 !!test
22218 Ref: 4. 'constructor' should be accepted as a valid ref-name
22219 !! wikitext
22220 A <ref name="constructor">foo</ref>
22221 <references />
22222 !! html/parsoid
22223 <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>
22224 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22225 <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>
22226 </ol>
22227 !!end
22228
22229 !!test
22230 Ref: 5. body should accept generic wikitext
22231 !! wikitext
22232 A <ref>
22233 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
22234 </ref>
22235
22236 <references />
22237 !! html/parsoid
22238 <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>
22239
22240 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22241 <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>
22242 </span></li>
22243 </ol>
22244 !!end
22245
22246 !!test
22247 Ref: 6. indent-pres should not be output in ref-body
22248 !! wikitext
22249 A <ref>
22250 foo
22251 bar
22252 baz
22253 </ref>
22254
22255 <references />
22256 !! html/parsoid
22257 <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>
22258
22259 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22260 <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
22261 bar
22262 baz
22263 </span></li>
22264 </ol>
22265 !!end
22266
22267 !!test
22268 Ref: 7. No p-wrapping in ref-body
22269 !! wikitext
22270 A <ref>
22271 foo
22272
22273 bar
22274
22275
22276 baz
22277
22278
22279
22280 booz
22281 </ref>
22282
22283 <references />
22284 !! html/parsoid
22285 <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>
22286
22287 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22288 <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
22289
22290 bar
22291
22292
22293 baz
22294
22295
22296
22297 booz
22298 </span></li>
22299 </ol>
22300 !!end
22301
22302 !!test
22303 Ref: 8. transclusion wikitext has lower precedence
22304 !! wikitext
22305 A <ref> foo {{echo|</ref> B C}}
22306
22307 <references />
22308 !! html/parsoid
22309 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B C}}</p>
22310 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22311 <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>
22312 </ol>
22313 !!end
22314
22315 !!test
22316 Ref: 9. unclosed comments should not leak out of ref-body
22317 !! wikitext
22318 A <ref> foo <!--</ref> B C
22319 <references />
22320 !! html/parsoid
22321 <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>
22322 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22323 <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>
22324 </ol>
22325 !!end
22326
22327 !!test
22328 Ref: 10. Unclosed HTML tags should not leak out of ref-body
22329 !! wikitext
22330 A <ref> <b> foo </ref> B C
22331
22332 <references />
22333 !! html/parsoid
22334 <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>
22335
22336
22337 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22338 <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>
22339 </ol>
22340 !!end
22341
22342 !!test
22343 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
22344 !! wikitext
22345 A <ref>foo</ref> B
22346 C <ref>bar</ref> D
22347 <references />
22348 !! html/parsoid
22349 <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
22350 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>
22351 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22352 <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>
22353 <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>
22354 </ol>
22355 !!end
22356
22357 !!test
22358 Ref: 12. ref-tags act as trailing newline migration barrier
22359 !! wikitext
22360 <!--the newline at the end of this line moves out of the p tag-->a
22361
22362 b<!--the newline at the end of this line stays inside the p tag--> <ref />
22363 <ref />
22364
22365 c
22366 <references />
22367 !! html/parsoid
22368 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
22369
22370
22371 <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>
22372 <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>
22373
22374 <p>c</p>
22375 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22376 <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>
22377 <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>
22378 !!end
22379
22380 !!test
22381 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
22382 !! wikitext
22383 <ref>foo</ref> A
22384 <ref>bar
22385 </ref> B
22386 <references />
22387 !! html/parsoid
22388 <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
22389 <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>
22390 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22391 <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>
22392 <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
22393 </span></li>
22394 </ol>
22395 !!end
22396
22397 !!test
22398 Ref: 14. A nested ref-tag should be emitted as plain text
22399 !! wikitext
22400 <ref>foo <ref>bar</ref> baz</ref>
22401
22402 <references />
22403 !! html/parsoid
22404 <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>
22405 </p>
22406 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22407 <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>
22408 </ol>
22409 !!end
22410
22411 !!test
22412 Ref: 15. ref-tags with identical names should get identical indexes
22413 !! wikitext
22414 A1 <ref name="a">foo</ref> A2 <ref name="a" />
22415 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
22416
22417 <references />
22418 !! html/parsoid
22419 <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>
22420 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>
22421
22422 <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>
22423 </ol>
22424 !!end
22425
22426 ## We don't bother wt2wt-ing non-standard whitespace
22427 !!test
22428 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
22429 !!options
22430 parsoid=wt2html
22431 !! wikitext
22432 A <ref >foo</ref >
22433
22434 <references />
22435 !! html/parsoid
22436 <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>
22437 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22438 <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>
22439 !!end
22440
22441 !!test
22442 Ref: 17. Generate valid HTML5 id/about attributes
22443 !!wikitext
22444 <ref name="a b">foo</ref>
22445
22446 <references />
22447 !!html/parsoid
22448 <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>
22449 </p>
22450
22451 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22452 <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>
22453 </ol>
22454 !!end
22455
22456 !!test
22457 Ref: 18. T58916: Extension attributes should be parsed as plain text
22458 !!wikitext
22459 <ref name="{{echo|a}}">foo</ref>
22460
22461 <references />
22462 !!html/parsoid
22463 <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>
22464 </p>
22465
22466 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22467 <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>
22468 </ol>
22469 !!end
22470
22471 !!test
22472 Ref: 19. ref-tags with identical name encodings should get identical indexes
22473 !! wikitext
22474 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
22475
22476 <references />
22477 !! html/parsoid
22478 <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>
22479 </p>
22480 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22481 <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>
22482 </ol>
22483 !!end
22484
22485 !!test
22486 Ref: 20. ref-tags with identical names but different content should keep it
22487 !! wikitext
22488 A <ref name="foo">Foo one</ref>
22489 B <ref name="foo">Foo two</ref>
22490 C <ref name="foo" />
22491
22492 <references />
22493 !! html/parsoid
22494 <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>
22495 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>
22496 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>
22497
22498 <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>
22499 </ol>
22500 !!end
22501
22502 !!test
22503 References: 1. references tag without any refs should be handled properly
22504 !! wikitext
22505 <references />
22506 !! html/parsoid
22507 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22508 !!end
22509
22510 !!test
22511 References: 2. references tag with group only outputs references from that group
22512 !! wikitext
22513 A <ref group="a">foo</ref>
22514 B <ref group="b">bar</ref>
22515 C <ref>baz</ref>
22516
22517 <references group="a" />
22518 <references />
22519 <references group="b" />
22520 !! html/parsoid
22521 <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>
22522 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>
22523 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>
22524
22525 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
22526 <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>
22527 </ol>
22528 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
22529 <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>
22530 </ol>
22531 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
22532 <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>
22533 </ol>
22534 !!end
22535
22536 !!test
22537 References: 3. ref list should be cleared after processing references
22538 !! wikitext
22539 A <ref>foo</ref>
22540
22541 <references />
22542
22543 B <ref>bar</ref>
22544
22545 <references />
22546 !! html/parsoid
22547 <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>
22548
22549 <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>
22550 </ol>
22551
22552 <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>
22553
22554 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
22555 <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>
22556 </ol>
22557 !!end
22558
22559 !!test
22560 References: 4. only referenced group should be cleared after processing references
22561 !! wikitext
22562 A <ref group="a">afoo</ref>
22563 B <ref>bfoo</ref>
22564
22565 <references group="a" />
22566
22567 C <ref>cfoo</ref>
22568
22569 <references />
22570 !! html/parsoid
22571 <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>
22572 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>
22573
22574 <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>
22575 </ol>
22576
22577 <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>
22578
22579 <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>
22580 </ol>
22581 !!end
22582
22583 ## Don't expect this to rt since we're dropping content
22584 !! test
22585 References: 5. ref tags in references should be processed while ignoring all other content
22586 !! options
22587 parsoid=wt2html,html2html
22588 !! wikitext
22589 A <ref name="a" />
22590 B <ref name="b">bar</ref>
22591
22592 <references>
22593 <ref name="a">foo</ref>
22594 This should just get lost.
22595 </references>
22596 !! html/parsoid
22597 <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>
22598 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>
22599
22600
22601 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{},"body":{"html":"\n&lt;span about=\"#mwt8\" class=\"mw-ref\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[59,82,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-a-1\"},\"attrs\":{\"name\":\"a\"}}&#39;>&lt;a href=\"#cite_note-a-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/span>\n"}}'><li about="#cite_note-a-1" id="cite_note-a-1"><a href="#cite_ref-a_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-a-1" class="mw-reference-text">foo</span></li><li about="#cite_note-b-2" id="cite_note-b-2"><a href="#cite_ref-b_2-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-b-2" class="mw-reference-text">bar</span></li>
22602 </ol>
22603 !! end
22604
22605 !! test
22606 References: 6. <references /> from a transclusion
22607 !! wikitext
22608 <ref>Foo</ref> {{echo|<references />}}
22609 !! html/parsoid
22610 <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>
22611 </ol>
22612 !! end
22613
22614 !! test
22615 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
22616 !! wikitext
22617 A <ref>foo bar for a</ref>
22618 B <ref group="X" name="b" />
22619
22620 <references />
22621
22622 <references group="X">
22623 <ref name="b">foo</ref>
22624 </references>
22625 !! html/parsoid
22626 <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>
22627 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>
22628 </p>
22629
22630 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
22631 <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>
22632 </ol>
22633
22634 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="X" data-mw='{"name":"references","attrs":{"group":"X"},"body":{"html":"\n&lt;span about=\"#mwt10\" class=\"mw-ref\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[96,119,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-b-2\"},\"attrs\":{\"name\":\"b\"}}&#39;>&lt;a href=\"#cite_note-b-2\" style=\"counter-reset: mw-Ref 1;\" data-mw-group=\"X\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[X 1]&lt;/span>&lt;/a>&lt;/span>\n"}}'>
22635 <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>
22636 </ol>
22637 !! end
22638
22639 !! test
22640 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
22641 !! wikitext
22642 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
22643 <references />
22644 !! html/parsoid
22645 <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>
22646 <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>
22647 </ol>
22648 !!end
22649
22650 # This test only works in wt2html now as the <references /> are always generated
22651 # unless selser is active. Once T72722 is fixed, we should add a changes test
22652 # here to ensure that unrelated changes don't add the new <references />
22653 # when selser is active.
22654 !! test
22655 References: 9. Generate missing references list at the end
22656 !! wikitext
22657 A <ref>foo</ref>
22658 B <ref group="inexistent">bar</ref>
22659 !! html/parsoid
22660 <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>
22661 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'>
22662 <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>
22663 </ol>
22664 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"},"autoGenerated":true}'>
22665 <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>
22666 </ol>
22667 !! end
22668
22669 !! test
22670 References: 10. New <references/> shouldn't be added for unrelated edits.
22671 !! options
22672 parsoid={
22673 "modes": ["selser"],
22674 "changes": [["#x", "remove"]],
22675 "selser": "noauto"
22676 }
22677 !! wikitext
22678 Unrelated text<span id="x"> that's going to disappear</span>.
22679 A <ref>foo</ref>
22680 !! wikitext/edited
22681 Unrelated text.
22682 A <ref>foo</ref>
22683 !!end
22684
22685 !! test
22686 Entities in ref name
22687 !! wikitext
22688 <ref name="test &amp; me">hi</ref>
22689 <references />
22690 !! html/parsoid
22691 <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>
22692 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22693 <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>
22694 </ol>
22695 !! end
22696
22697 ## The output here may look funny, but it's what the php parser will do. The
22698 ## unclosed references tag becomes escaped text, and then a new references
22699 ## tag is auto-generated. The test is wt2html only because it roundtrips with
22700 ## nowiki tags, and the auto-generated references tag is only dropped in
22701 ## rtTestMode.
22702 !! test
22703 Generate references for unclosed references tag
22704 !! options
22705 parsoid=wt2html
22706 !! wikitext
22707 a<ref>foo</ref>
22708
22709 <references>
22710 !! html/parsoid
22711 <p>a<span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span></p>
22712
22713 <p>&lt;references></p>
22714 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{},"autoGenerated":true}'><li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
22715 !! end
22716
22717 !! test
22718 New reference serializes on its own line
22719 !! options
22720 parsoid=wt2wt,html2wt
22721 !! wikitext
22722 foo
22723 <references />
22724 !! html/parsoid
22725 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22726 !! end
22727
22728 #### ----------------------------------------------------------------
22729 #### Parsoid-only testing of Parsoid's impl of LST
22730 #### Not implemented yet, see
22731 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
22732 #### ----------------------------------------------------------------
22733
22734 !! test
22735 LST Sections: 1. Simple section start and end
22736 !! options
22737 parsoid={ "suppressErrors": true }
22738 !! wikitext
22739 <section begin="2011-05-16" />
22740 <section end="2014-04-10 (MW 1.23wmf22)" />
22741 !! html/parsoid
22742 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
22743 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
22744 !! end
22745
22746 #--------- Test stripping of empty nodes in template content ----------
22747 !!test
22748 Empty LI and TR nodes should be stripped from template content
22749 !!wikitext
22750 {{EmptyLITest}}
22751 {{EmptyTRTest}}
22752 !!html/parsoid
22753 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
22754 <li>a</li>
22755 <li>b</li>
22756 </ul>
22757 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
22758 <tbody>
22759 <tr>
22760 <td>foo</td>
22761 </tr>
22762 <tr>
22763 <td>bar</td>
22764 </tr>
22765 </tbody>
22766 </table>
22767 !!end
22768
22769 !!test
22770 Empty LI and TR nodes should not be stripped from top-level content
22771 !!wikitext
22772 * a
22773 *
22774 * b
22775 {|
22776 |-
22777 |-
22778 |foo
22779 |}
22780 !!html/parsoid
22781 <ul>
22782 <li> a</li>
22783 <li></li>
22784 <li> b</li>
22785 </ul>
22786 <table>
22787 <tbody>
22788 <tr></tr>
22789 <tr>
22790 <td>foo</td>
22791 </tr>
22792 </tbody>
22793 </table>
22794 !!end
22795
22796 !!test
22797 Empty TR nodes should not be stripped if they have any attributes set
22798 !!wikitext
22799 {{EmptyTRWithHTMLAttrTest}}
22800 !!html/parsoid
22801 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
22802 <tr align="center"></tr>
22803 <tr><td>foo</td></tr>
22804 <tr align="center"></tr>
22805 <tr><td>bar</td></tr>
22806 </table>
22807 !!end
22808
22809 #### ----------------------------------------------------------------
22810 #### The following section of tests are primarily to test
22811 #### wikitext escaping capabilities of Parsoid. Given that
22812 #### escaping can be done any number of ways, the wikitext (input)
22813 #### is always adjusted to reflect how Parsoid adds nowiki
22814 #### escape tags.
22815 ####
22816 #### We are marking several tests as parsoid-only since the
22817 #### HTML in the result section is different from what the
22818 #### PHP parser generates for it.
22819 #### ----------------------------------------------------------------
22820
22821
22822 #### --------------- Headings ---------------
22823 #### 0. Unnested
22824 #### 1. Nested inside html <h1>=foo=</h1>
22825 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
22826 #### 3. Nested inside html with wikitext split by html tags
22827 #### 4. No escape needed
22828 #### 5. Empty headings <h1></h1>
22829 #### 6. Heading chars in SOL context
22830 #### ----------------------------------------
22831 !! test
22832 Headings: 0. Unnested
22833 !! options
22834 parsoid=html2wt
22835 !! html/parsoid
22836 <p>=foo=</p>
22837
22838 <p> =foo=
22839 <!--cmt-->
22840 =foo=</p>
22841
22842 <p>=foo<i>a</i>=</p>
22843 !! wikitext
22844 <nowiki>=foo=</nowiki>
22845
22846 <nowiki> </nowiki>=foo=
22847 <!--cmt-->
22848 <nowiki>=foo=</nowiki>
22849
22850 =foo''a''<nowiki>=</nowiki>
22851 !!end
22852
22853 # New headings and existing headings are handled differently
22854 !! test
22855 Headings: 1. Nested inside html
22856 !! options
22857 parsoid=html2wt
22858 !! html/parsoid
22859 <h1>=foo=</h1>
22860 <h2>=foo=</h2>
22861 <h3>=foo=</h3>
22862
22863 <h1 data-parsoid=''>=foo=</h1>
22864 <h2 data-parsoid=''>=foo=</h2>
22865 <h3 data-parsoid=''>=foo=</h3>
22866 <h4 data-parsoid=''>=foo=</h4>
22867 <h5 data-parsoid=''>=foo=</h5>
22868 <h6 data-parsoid=''>=foo=</h6>
22869 !! wikitext
22870 = =foo= =
22871
22872 == =foo= ==
22873
22874 === =foo= ===
22875
22876 =<nowiki>=foo=</nowiki>=
22877 ==<nowiki>=foo=</nowiki>==
22878 ===<nowiki>=foo=</nowiki>===
22879 ====<nowiki>=foo=</nowiki>====
22880 =====<nowiki>=foo=</nowiki>=====
22881 ======<nowiki>=foo=</nowiki>======
22882
22883 !!end
22884
22885 !! test
22886 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
22887 !! options
22888 parsoid=html2wt
22889 !! html/parsoid
22890 <h1>foo</h1>*bar
22891 <h1>foo</h1>=bar
22892 <h1>foo</h1>=bar=
22893 !! wikitext
22894 = foo =
22895 <nowiki>*</nowiki>bar
22896
22897 = foo =
22898 =bar
22899
22900 = foo =
22901 <nowiki>=bar=</nowiki>
22902 !!end
22903
22904 !! test
22905 Headings: 3. Nested inside html with wikitext split by html tags
22906 !! options
22907 parsoid=html2wt
22908 !! html/parsoid
22909 <h1>=<b>bold</b>foo=</h1>
22910 !! wikitext
22911 = ='''bold'''foo= =
22912 !!end
22913
22914 !! test
22915 Headings: 4a. No escaping needed (testing just h1 and h2)
22916 !! options
22917 parsoid=html2wt
22918 !! html/parsoid
22919 <h1>=foo</h1>
22920 <h1>foo=</h1>
22921 <h1> =foo= </h1>
22922 <h1>=foo= bar</h1>
22923 <h2>=foo</h2>
22924 <h2>foo=</h2>
22925 <h1>=</h1>
22926 <h1><i>=</i>foo=</h1>
22927 !! wikitext
22928 = =foo =
22929
22930 = foo= =
22931
22932 = =foo= =
22933
22934 = =foo= bar =
22935
22936 == =foo ==
22937
22938 == foo= ==
22939
22940 = = =
22941
22942 = ''=''foo= =
22943 !!end
22944
22945 !! test
22946 Headings: 4b. No escaping needed (inside p-tags)
22947 !! options
22948 parsoid=html2wt
22949 !! html/parsoid
22950 <p>===
22951 =foo= x
22952 =foo= <s></s>
22953 </p>
22954 !! wikitext
22955 ===
22956 =foo= x
22957 =foo= <s></s>
22958 !!end
22959
22960 !! test
22961 Headings: 5. Empty headings
22962 !! options
22963 parsoid=html2wt
22964 !! html/parsoid
22965 <h1 data-parsoid='{}'></h1>
22966
22967 <h2 data-parsoid='{}'></h2>
22968
22969 <h3 data-parsoid='{}'></h3>
22970
22971 <h4 data-parsoid='{}'></h4>
22972
22973 <h5 data-parsoid='{}'></h5>
22974
22975 <h6 data-parsoid='{}'></h6>
22976 !! wikitext
22977 =<nowiki/>=
22978
22979 ==<nowiki/>==
22980
22981 ===<nowiki/>===
22982
22983 ====<nowiki/>====
22984
22985 =====<nowiki/>=====
22986
22987 ======<nowiki/>======
22988 !!end
22989
22990 !! test
22991 Headings: 6a. Heading chars in SOL context (with trailing spaces)
22992 !! options
22993 parsoid=html2wt
22994 !! html/parsoid
22995 <p>=a=</p>
22996
22997 <p>=a=</p>
22998
22999 <p>=a=</p>
23000 !! wikitext
23001 <nowiki>=a=</nowiki>
23002
23003 <nowiki>=a=</nowiki>
23004
23005 <nowiki>=a=</nowiki>
23006 !!end
23007
23008 !! test
23009 Headings: 6b. Heading chars in SOL context (with trailing newlines)
23010 !! options
23011 parsoid=html2wt
23012 !! html/parsoid
23013 <p>=a=
23014 b</p>
23015
23016 <p>=a=
23017 b</p>
23018
23019 <p>=a=
23020 b</p>
23021 !! wikitext
23022 <nowiki>=a=</nowiki>
23023 b
23024
23025 <nowiki>=a=</nowiki>
23026 b
23027
23028 <nowiki>=a=</nowiki>
23029 b
23030 !!end
23031
23032 !! test
23033 Headings: 6c. Heading chars in SOL context (leading newline break)
23034 !! options
23035 parsoid=html2wt
23036 !! html/parsoid
23037 <p>a
23038 =b=</p>
23039 !! wikitext
23040 a
23041 <nowiki>=b=</nowiki>
23042 !!end
23043
23044 !! test
23045 Headings: 6d. Heading chars in SOL context (with interspersed comments)
23046 !! options
23047 parsoid=html2wt
23048 !! html/parsoid
23049 <!--c0--><p>=a=</p>
23050
23051 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
23052 !! wikitext
23053 <!--c0--><nowiki>=a=</nowiki>
23054
23055 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
23056 !!end
23057
23058 !! test
23059 Headings: 6d. Heading chars in SOL context (No escaping needed)
23060 !! options
23061 parsoid=html2wt
23062 !! html/parsoid
23063 =a=<div>b</div>
23064 !! wikitext
23065 =a=<div>b</div>
23066 !!end
23067
23068 !! test
23069 Headings: 7. Insert a newline between new content and headings
23070 !! options
23071 parsoid=html2wt
23072 !! html/parsoid
23073 <h2>NEW</h2>
23074 <p>new</p>
23075 <h2 data-parsoid='{}'>A</h2>
23076 <p data-parsoid='{}'>a</p>
23077 !! wikitext
23078 == NEW ==
23079 new
23080
23081 ==A==
23082 a
23083
23084 !! end
23085
23086 #### --------------- Lists ---------------
23087 #### 0. Outside nests (*foo, etc.)
23088 #### 1. Nested inside html <ul><li>*foo</li></ul>
23089 #### 2. Inside definition lists
23090 #### 3. Only bullets at start should be escaped
23091 #### 4. No escapes needed
23092 #### 5. No unnecessary escapes
23093 #### 6. Escape bullets in SOL position
23094 #### 7. Escape bullets in a multi-line context
23095 #### ----------------------------------------
23096
23097 !! test
23098 Lists: 0. Outside nests
23099 !! options
23100 parsoid=html2wt
23101 !! html/parsoid
23102 <p>*foo</p>
23103
23104 <p>#foo</p>
23105
23106 <p>;Foo:bar</p>
23107 !! wikitext
23108 <nowiki>*</nowiki>foo
23109
23110 <nowiki>#</nowiki>foo
23111
23112 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
23113 !!end
23114
23115 ## Making these next 3 tests Parsoid-only since they are html2wt tests
23116 ## to test wikitext escaping, and insignificant whitespace diffs
23117 ## cause PHP parser tests to barf
23118 !! test
23119 Lists: 1. Nested inside html (No unnecessary escapes)
23120 !! options
23121 parsoid=html2wt
23122 !! html/parsoid
23123 <ul>
23124 <li>*foo</li>
23125 <li>#foo</li>
23126 <li>:foo</li>
23127 <li>;foo</li>
23128 <li data-parsoid='{}'>*foo</li>
23129 <li data-parsoid='{}'>#foo</li>
23130 <li data-parsoid='{}'>:foo</li>
23131 <li data-parsoid='{}'>;foo</li>
23132 </ul>
23133
23134 <ol>
23135 <li>*foo</li>
23136 <li>#foo</li>
23137 <li>:foo</li>
23138 <li>;foo</li>
23139 <li data-parsoid='{}'>*foo</li>
23140 <li data-parsoid='{}'>#foo</li>
23141 <li data-parsoid='{}'>:foo</li>
23142 <li data-parsoid='{}'>;foo</li>
23143 </ol>
23144 !! wikitext
23145 * *foo
23146 * #foo
23147 * :foo
23148 * ;foo
23149 *<nowiki>*foo</nowiki>
23150 *<nowiki>#foo</nowiki>
23151 *<nowiki>:foo</nowiki>
23152 *<nowiki>;foo</nowiki>
23153
23154 # *foo
23155 # #foo
23156 # :foo
23157 # ;foo
23158 #<nowiki>*foo</nowiki>
23159 #<nowiki>#foo</nowiki>
23160 #<nowiki>:foo</nowiki>
23161 #<nowiki>;foo</nowiki>
23162 !!end
23163
23164 !! test
23165 Lists: 2. Inside definition lists
23166 !! options
23167 parsoid=html2wt
23168 !! html/parsoid
23169 <dl><dt>;foo</dt></dl>
23170 <dl><dt>:foo</dt></dl>
23171 <dl><dt>:foo</dt>
23172 <dd>bar</dd></dl>
23173 <dl><dd>:foo</dd></dl>
23174 !! wikitext
23175 ; ;foo
23176
23177 ; <nowiki>:foo</nowiki>
23178
23179 ; <nowiki>:foo</nowiki>
23180 : bar
23181
23182 : :foo
23183 !!end
23184
23185 !! test
23186 Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
23187 !! options
23188 parsoid=html2wt
23189 !! html/parsoid
23190 <ul>
23191 <li>*foo*bar</li>
23192 <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
23193 </ul>
23194 !! wikitext
23195 * *foo*bar
23196 *<nowiki>*foo</nowiki>''it''*bar
23197 !!end
23198
23199 !! test
23200 Lists: 4. No escapes needed
23201 !! options
23202 parsoid=html2wt
23203 !! html/parsoid
23204 <ul>
23205 <li>foo*bar
23206 </li>
23207 </ul>
23208 <ul>
23209 <li><i>foo</i>*bar
23210 </li>
23211 </ul>
23212 <ul>
23213 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
23214 </li>
23215 </ul>
23216 <ul>
23217 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
23218 </li>
23219 </ul>
23220 !! wikitext
23221 *foo*bar
23222
23223 *''foo''*bar
23224
23225 *[[Foo]]: bar
23226
23227 *[[Foo]]*bar
23228 !!end
23229
23230 !! test
23231 Lists: 5. No unnecessary escapes
23232 !! options
23233 parsoid=html2wt
23234 !! html/parsoid
23235 <ul><li> bar <span>[[foo]]</span></li></ul>
23236 <ul><li> =bar <span>[[foo]]</span></li></ul>
23237 <ul><li> [[bar <span>[[foo]]</span></li></ul>
23238 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
23239 <ul><li> =bar <span>foo]]</span>=</li></ul>
23240 <ul><li> <s></s>: a</li></ul>
23241 <ul><li> <i>* foo</i></li></ul>
23242
23243 !! wikitext
23244 * bar <span><nowiki>[[foo]]</nowiki></span>
23245
23246 * =bar <span><nowiki>[[foo]]</nowiki></span>
23247
23248 * [[bar <span><nowiki>[[foo]]</nowiki></span>
23249
23250 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
23251
23252 * =bar <span>foo]]</span>=
23253
23254 * <s></s>: a
23255
23256 * ''* foo''
23257 !!end
23258
23259 !! test
23260 Lists: 6. Escape bullets in SOL position
23261 !! options
23262 parsoid=html2wt
23263 !! html/parsoid
23264 <p><!--cmt-->*foo</p>
23265 !! wikitext
23266 <!--cmt--><nowiki>*</nowiki>foo
23267 !!end
23268
23269 !! test
23270 Lists: 7. Escape bullets in a multi-line context
23271 !! options
23272 parsoid=html2wt
23273 !! html/parsoid
23274 <p>a
23275 *b
23276 </p>
23277 !! wikitext
23278 a
23279 <nowiki>*</nowiki>b
23280 !!end
23281
23282 !! test
23283 Lists: 8. Escape colons only if not present in tags
23284 !! options
23285 parsoid=html2wt
23286 !! html/parsoid
23287 <dl><dt>a:b<i>c:d</i></dt></dl>
23288 !! wikitext
23289 ; <nowiki>a:b</nowiki>''c:d''
23290 !! end
23291
23292 #### --------------- HRs ---------------
23293 #### 1. Single line
23294 #### -----------------------------------
23295
23296 !! test
23297 HRs: 1. Single line
23298 !! options
23299 parsoid=html2wt
23300 !! html/parsoid
23301 <hr />----
23302 <hr />=foo=
23303 <hr />*foo
23304 !! wikitext
23305 ----<nowiki>----</nowiki>
23306 ----=foo=
23307 ----*foo
23308 !! end
23309
23310 #### --------------- Tables ---------------
23311 #### 1a. Simple example
23312 #### 1b. No escaping needed (!foo)
23313 #### 1c. No escaping needed (|foo)
23314 #### 1d. No escaping needed (|}foo)
23315 ####
23316 #### 2a. Nested in td (<td>foo|bar</td>)
23317 #### 2b. Nested in td (<td>foo||bar</td>)
23318 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
23319 ####
23320 #### 3a. Nested in th (<th>foo!bar</th>)
23321 #### 3b. Nested in th (<th>foo!!bar</th>)
23322 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
23323 ####
23324 #### 4a. Escape -
23325 #### 4b. Escape +
23326 #### 4c. No escaping needed
23327 #### --------------------------------------
23328
23329 !! test
23330 Tables: 1a. Simple example
23331 !! options
23332 parsoid=html2wt
23333 !! html/parsoid
23334 <p>{|
23335 |}
23336 </p>
23337 !! wikitext
23338 <nowiki>{|</nowiki>
23339 |}
23340 !! end
23341
23342 !! test
23343 Tables: 1b. No escaping needed
23344 !! options
23345 parsoid=html2wt
23346 !! html/parsoid
23347 <p>!foo
23348 </p>
23349 !! wikitext
23350 !foo
23351 !! end
23352
23353 !! test
23354 Tables: 1c. No escaping needed
23355 !! options
23356 parsoid=html2wt
23357 !! html/parsoid
23358 <p>|foo
23359 </p>
23360 !! wikitext
23361 |foo
23362 !! end
23363
23364 !! test
23365 Tables: 1d. No escaping needed
23366 !! options
23367 parsoid=html2wt
23368 !! html/parsoid
23369 <p>|}foo
23370 </p>
23371 !! wikitext
23372 |}foo
23373 !! end
23374
23375 !! test
23376 Tables: 2a. Nested in td
23377 !! options
23378 parsoid=html2wt
23379 !! html/parsoid
23380 <table><tbody><tr>
23381 <td>foo|bar</td></tr>
23382 <tr><td>x<div>a|b</div></td>
23383 </tbody></table>
23384 !! wikitext
23385 {|
23386 |<nowiki>foo|bar</nowiki>
23387 |-
23388 |x<div><nowiki>a|b</nowiki></div>
23389 |}
23390 !! html/php+tidy
23391 <table>
23392 <tr>
23393 <td>foo|bar</td>
23394 </tr>
23395 <tr>
23396 <td>x
23397 <div>a|b</div>
23398 </td>
23399 </tr>
23400 </table>
23401 !! end
23402
23403 !! test
23404 Tables: 2b. Nested in td
23405 !! options
23406 parsoid=html2wt
23407 !! html/parsoid
23408 <table><tbody><tr>
23409 <td>foo||bar</td>
23410 <td>a<i>b||c</i></td>
23411 <td>a<i><div>b||c</div></i></td>
23412 </tr></tbody></table>
23413 !! wikitext
23414 {|
23415 |<nowiki>foo||bar</nowiki>
23416 |a''<nowiki>b||c</nowiki>''
23417 |a''<div><nowiki>b||c</nowiki></div>''
23418 |}
23419 !! html/php
23420 <table>
23421 <tr>
23422 <td>foo||bar
23423 </td>
23424 <td>a<i>b||c</i>
23425 </td>
23426 <td>a<i><div>b||c</div></i>
23427 </td></tr></table>
23428
23429 !! end
23430
23431 !! test
23432 Tables: 2c. Nested in td -- no escaping needed
23433 !! options
23434 parsoid=html2wt
23435 !! html/*
23436 <table>
23437 <tr>
23438 <td>foo!!bar
23439 </td></tr></table>
23440
23441 !! wikitext
23442 {|
23443 |foo!!bar
23444 |}
23445 !! end
23446
23447 !! test
23448 Tables: 3a. Nested in th
23449 !! options
23450 parsoid=html2wt
23451 !! html/*
23452 <table>
23453 <tr>
23454 <th>foo!bar
23455 </th></tr></table>
23456
23457 !! wikitext
23458 {|
23459 !foo!bar
23460 |}
23461 !! end
23462
23463 !! test
23464 Tables: 3b. Nested in th
23465 !! options
23466 parsoid=html2wt
23467 !! html/parsoid
23468 <table><tbody>
23469 <tr><th>foo!!bar</th>
23470 <th><i>foo|bar</i></th>
23471 <th><i>foo!!bar</i></th>
23472 <th><i><span>foo!!bar</span></i></th>
23473 </tr></tbody></table>
23474 !! wikitext
23475 {|
23476 !<nowiki>foo!!bar</nowiki>
23477 !''<nowiki>foo|bar</nowiki>''
23478 !''<nowiki>foo!!bar</nowiki>''
23479 !''<span><nowiki>foo!!bar</nowiki></span>''
23480 |}
23481 !! html/php
23482 <table>
23483 <tr>
23484 <th>foo!!bar
23485 </th>
23486 <th><i>foo|bar</i>
23487 </th>
23488 <th><i>foo!!bar</i>
23489 </th>
23490 <th><i><span>foo!!bar</span></i>
23491 </th></tr></table>
23492
23493 !! end
23494
23495 !! test
23496 Tables: 3c. Nested in th
23497 !! options
23498 parsoid=html2wt
23499 !! html/parsoid
23500 <table><tbody>
23501 <tr><th>foo||bar</th>
23502 <th><span typeof="mw:Nowiki">foo||bar</span></th>
23503 </tr></tbody></table>
23504 !! wikitext
23505 {|
23506 !<nowiki>foo||bar</nowiki>
23507 !<nowiki>foo||bar</nowiki>
23508 |}
23509 !! html/php
23510 <table>
23511 <tr>
23512 <th>foo||bar
23513 </th>
23514 <th>foo||bar
23515 </th></tr></table>
23516
23517 !! end
23518
23519 !! test
23520 Tables: 4a. Escape -
23521 !! options
23522 parsoid=html2wt
23523 !! html/*
23524 <table>
23525 <tr>
23526 <th>-bar
23527 </th></tr>
23528 <tr>
23529 <td>-bar
23530 </td></tr></table>
23531
23532 !! wikitext
23533 {|
23534 !-bar
23535 |-
23536 |<nowiki>-bar</nowiki>
23537 |}
23538 !! end
23539
23540 !! test
23541 Tables: 4b. Escape +
23542 !! options
23543 parsoid=html2wt
23544 !! html/*
23545 <table>
23546 <tr>
23547 <th>+bar
23548 </th></tr>
23549 <tr>
23550 <td>+bar
23551 </td></tr></table>
23552
23553 !! wikitext
23554 {|
23555 !+bar
23556 |-
23557 |<nowiki>+bar</nowiki>
23558 |}
23559 !! end
23560
23561 !! test
23562 Tables: 4c. No escaping needed
23563 !! options
23564 parsoid=html2wt
23565 !! html/parsoid
23566 <table><tbody>
23567 <tr><td>foo-bar</td><td>foo+bar</td></tr>
23568 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
23569 <tr><td>foo
23570 <p>bar|baz
23571 +bar
23572 -bar</p></td></tr>
23573 <tr><td>x
23574 <div>a|b</div></td>
23575 </tbody></table>
23576 !! wikitext
23577 {|
23578 |foo-bar
23579 |foo+bar
23580 |-
23581 |''foo''-bar
23582 |''foo''+bar
23583 |-
23584 |foo
23585 bar|baz
23586 +bar
23587 -bar
23588 |-
23589 |x
23590 <div>a|b</div>
23591 |}
23592 !! html/php
23593 <table>
23594 <tr>
23595 <td>foo-bar
23596 </td>
23597 <td>foo+bar
23598 </td></tr>
23599 <tr>
23600 <td><i>foo</i>-bar
23601 </td>
23602 <td><i>foo</i>+bar
23603 </td></tr>
23604 <tr>
23605 <td>foo
23606 <p>bar|baz
23607 +bar
23608 -bar
23609 </p>
23610 </td></tr>
23611 <tr>
23612 <td>x
23613 <div>a|b</div>
23614 </td></tr></table>
23615
23616 !! end
23617
23618 !! test
23619 Tables: 4d. No escaping needed
23620 !! options
23621 parsoid=html2wt
23622 !! html/parsoid
23623 <table>
23624 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
23625 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
23626 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
23627 </tbody></table>
23628 !! wikitext
23629 {|
23630 |[[Foo]]-bar
23631 ||+1
23632 ||-2
23633 |}
23634 !! html/php
23635 <table>
23636 <tr>
23637 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
23638 </td>
23639 <td>+1
23640 </td>
23641 <td>-2
23642 </td></tr></table>
23643
23644 !! end
23645
23646 !! test
23647 T97430: Don't emit empty nowiki pairs around marker meta tags
23648 !! options
23649 parsoid=html2wt
23650 !! html/parsoid
23651 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23652 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
23653 !! wikitext
23654 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23655 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
23656 !! end
23657
23658 !! test
23659 Unclosed xmlish element in table line shouldn't eat end delimiters
23660 !! options
23661 parsoid=html2wt
23662 !! html/parsoid
23663 <table>
23664 <tbody><tr><td> &lt;foo</td>
23665 <td> bar></td></tr>
23666 </tbody></table>
23667 !! wikitext
23668 {|
23669 | <foo
23670 | bar>
23671 |}
23672 !! html/php
23673 <table>
23674 <tr>
23675 <td> &lt;foo
23676 </td>
23677 <td> bar&gt;
23678 </td></tr></table>
23679
23680 !! end
23681
23682 #### --------------- Links ----------------
23683 #### 1. Quote marks in link text
23684 #### 2. Wikilinks: Escapes needed
23685 #### 3. Wikilinks: No escapes needed
23686 #### 4. Extlinks: Escapes needed
23687 #### 5. Extlinks: No escapes needed
23688 #### --------------------------------------
23689 !! test
23690 Links 1. WikiLinks: No escapes needed
23691 !! options
23692 parsoid=html2wt
23693 !! html/parsoid
23694 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
23695 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
23696 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
23697 !! wikitext
23698 [[Foo|Foo''boo'']]
23699 [[Foo|[Foobar]]]
23700 [[Foo|x [Foobar] x]]
23701 !! html/php
23702 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
23703 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
23704 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
23705 </p>
23706 !! end
23707
23708 !! test
23709 Links 2. WikiLinks: Escapes needed
23710 !! options
23711 parsoid=html2wt
23712 !! html/parsoid
23713 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
23714 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
23715 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
23716 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
23717 <a href="Foo" rel="mw:WikiLink">|Bar</a>
23718 <a href="Foo" rel="mw:WikiLink">]]bar</a>
23719 <a href="Foo" rel="mw:WikiLink">[[bar</a>
23720 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
23721 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
23722 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
23723 !! wikitext
23724 [[Foo|<nowiki>Foobar]</nowiki>]]
23725 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
23726 [[Foo|<nowiki>[[Bar]]</nowiki>]]
23727 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
23728 [[Foo|<nowiki>|Bar</nowiki>]]
23729 [[Foo|<nowiki>]]bar</nowiki>]]
23730 [[Foo|<nowiki>[[bar</nowiki>]]
23731 [[Foo|<nowiki>x [[ y</nowiki>]]
23732 [[Foo|<nowiki>x ]] y</nowiki>]]
23733 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
23734 !! html/php
23735 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
23736 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
23737 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
23738 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
23739 <a href="/wiki/Foo" title="Foo">|Bar</a>
23740 <a href="/wiki/Foo" title="Foo">]]bar</a>
23741 <a href="/wiki/Foo" title="Foo">[[bar</a>
23742 <a href="/wiki/Foo" title="Foo">x [[ y</a>
23743 <a href="/wiki/Foo" title="Foo">x ]] y</a>
23744 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
23745 </p>
23746 !! end
23747
23748 !! test
23749 Links 3. WikiLinks: No escapes needed
23750 !! options
23751 parsoid=html2wt
23752 !! html/parsoid
23753 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
23754 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
23755 !! wikitext
23756 [[Foo|[Foobar]]
23757 [[Foo|foo|bar]]
23758 !! html/php
23759 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
23760 <a href="/wiki/Foo" title="Foo">foo|bar</a>
23761 </p>
23762 !! end
23763
23764 !! test
23765 Links 4. ExtLinks: Escapes needed
23766 !! options
23767 parsoid=html2wt
23768 !! html/parsoid
23769 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
23770 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
23771 <p>[http://google.com]</p>
23772 <p>[http://google.com google]</p>
23773 <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
23774 <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>
23775 !! wikitext
23776 [http://google.com <nowiki>[google]</nowiki>]
23777 [http://google.com <nowiki>google]</nowiki>]
23778
23779 <nowiki>[http://google.com]</nowiki>
23780
23781 <nowiki>[http://google.com google]</nowiki>
23782
23783 [http://google.com<nowiki>]</nowiki>
23784
23785 [{{echo|http://google.com}}<nowiki>]</nowiki>
23786 !! html/php
23787 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
23788 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
23789 </p><p>[http://google.com]
23790 </p><p>[http://google.com google]
23791 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23792 </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
23793 </p>
23794 !! end
23795
23796 !! test
23797 Links 5. ExtLinks: No escapes needed
23798 !! options
23799 parsoid=html2wt
23800 !! html/parsoid
23801 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
23802 <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
23803 !! wikitext
23804 [http://google.com [google]
23805
23806 [[http://google.com]]
23807 !! html/php
23808 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
23809 </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
23810 </p>
23811 !! end
23812
23813 !! test
23814 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
23815 !! options
23816 parsoid=html2wt
23817 !! html/parsoid
23818 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
23819 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
23820 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
23821 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
23822 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
23823 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
23824 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23825 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
23826 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23827 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
23828 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
23829 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
23830 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
23831 </p>
23832 !! wikitext
23833 x<nowiki/>http://example.com<nowiki/>y
23834 http://example.com<nowiki/>?x
23835 http://example.com<nowiki/>&x
23836 http://example.com<nowiki/>'x
23837 http://example.com<nowiki/>,x
23838 http://example.com<nowiki/>.x
23839 http://example.com<nowiki/>;x
23840 http://example.com<nowiki/>:x
23841 http://example.com<nowiki/>;x
23842 http://example.com<nowiki/>!x
23843 http://example.com<nowiki/>=x
23844 http://example.com<nowiki/>(x)
23845 http://example.com(x<nowiki/>)
23846 !! end
23847
23848 !! test
23849 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23850 !! options
23851 parsoid=html2wt
23852 !! html/parsoid
23853 <p>x
23854 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
23855 y
23856 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
23857 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
23858 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
23859 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
23860 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
23861 </p>
23862 !! wikitext
23863 x
23864 http://example.com
23865 y
23866 "http://example.com"
23867 (http://example.com)
23868 (http://example.com) foo
23869 http://example.com,
23870 http://example.com, foo
23871 !! html/php
23872 <p>x
23873 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
23874 y
23875 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
23876 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
23877 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
23878 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
23879 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
23880 </p>
23881 !! end
23882
23883 !! test
23884 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23885 !! options
23886 parsoid=html2wt
23887 !! html/parsoid
23888 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
23889 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
23890 !! wikitext
23891 http://example.com.,;:!?\
23892 -http://example.com:
23893 !! html/php
23894 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
23895 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
23896 </p>
23897 !! end
23898
23899 !! test
23900 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
23901 !! options
23902 parsoid=html2wt
23903 !! html/parsoid
23904 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
23905 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
23906 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
23907 !! wikitext
23908 RFC 123<nowiki/>4
23909 RFC 123<nowiki/>y
23910 X<nowiki/>RFC 123<nowiki/>y
23911 !! end
23912
23913 !! test
23914 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
23915 !! options
23916 parsoid=html2wt
23917 !! html/parsoid
23918 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
23919 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
23920 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
23921 </p>
23922 !! wikitext
23923 RFC 123?foo
23924 RFC 123&foo
23925 -RFC 123-
23926 !! html/php
23927 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
23928 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
23929 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
23930 </p>
23931 !! end
23932
23933 !! test
23934 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
23935 !! options
23936 parsoid=html2wt
23937 !! html/parsoid
23938 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
23939 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23940 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23941 !! wikitext
23942 PMID 123<nowiki/>4
23943 PMID 123<nowiki/>y
23944 X<nowiki/>PMID 123<nowiki/>y
23945 !! end
23946
23947 !! test
23948 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
23949 !! options
23950 parsoid=html2wt
23951 !! html/parsoid
23952 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
23953 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
23954 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
23955 </p>
23956 !! wikitext
23957 PMID 123?foo
23958 PMID 123&foo
23959 -PMID 123-
23960 !! html/php
23961 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
23962 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
23963 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
23964 </p>
23965 !! end
23966
23967 !! test
23968 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
23969 !! options
23970 parsoid=html2wt
23971 !! html/parsoid
23972 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
23973 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
23974 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
23975 </p>
23976 !! wikitext
23977 ISBN 1234567890<nowiki/>1
23978 ISBN 1234567890<nowiki/>x
23979 a<nowiki/>ISBN 1234567890<nowiki/>b
23980 !! end
23981
23982 !! test
23983 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
23984 !! options
23985 parsoid=html2wt
23986 !! html/parsoid
23987 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
23988 !! wikitext
23989 -ISBN 1234567890's
23990 !! html/php
23991 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
23992 </p>
23993 !! end
23994
23995 !! test
23996 Links 14. Protect link-like plain text. (Parsoid bug T78425)
23997 !! options
23998 parsoid=html2wt
23999 !! html/*
24000 <p>this is not a link: http://example.com
24001 </p>
24002 !! wikitext
24003 this is not a link: <nowiki>http://example.com</nowiki>
24004 !! end
24005
24006 !! test
24007 Links 15. Link trails can't become link prefixes.
24008 !! options
24009 language=is
24010 parsoid=html2wt
24011 !! html/parsoid
24012 <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>
24013 !! wikitext
24014 [[Söfnuður]]-[[00]]
24015 !! html/php
24016 <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>
24017 </p>
24018 !! end
24019
24020 #### --------------- Quotes ---------------
24021 #### 1. Quotes inside <b> and <i>
24022 #### 2. Link fragments separated by <i> and <b> tags
24023 #### 3. Link fragments inside <i> and <b>
24024 #### 4. No escaping needed
24025 #### --------------------------------------
24026 !! test
24027 1a. Quotes inside <b> and <i>
24028 !! options
24029 parsoid=html2wt
24030 !! html/*
24031 <p><i>'foo'</i>
24032 <i>''foo''</i>
24033 <i>'''foo'''</i>
24034 <i>foo</i>'s
24035 <b>'foo'</b>
24036 <b>''foo''</b>
24037 <b>'''foo'''</b>
24038 <b>foo'<i>bar'</i>baz</b>
24039 <b>foo</b>'s
24040 '<i>foo</i>
24041 <i>foo</i>'
24042 <i>foo'</i>'
24043 '<i>foo</i>'
24044 '<b>foo</b>
24045 <b>foo</b>'
24046 '<b>foo</b>'
24047 <i>fools'<span> errand</span></i>
24048 <i><span>fool</span>'s errand</i>
24049 '<i>foo</i> bar '<i>baz</i>
24050 a|!*#-:;+-~[]{}b'<i>x</i>
24051 </p>
24052 !! wikitext
24053 ''<nowiki/>'foo'''
24054 ''<nowiki>''foo''</nowiki>''
24055 ''<nowiki>'''foo'''</nowiki>''
24056 ''foo''<nowiki/>'s
24057 '''<nowiki/>'foo''''
24058 '''<nowiki>''foo''</nowiki>'''
24059 '''<nowiki>'''foo'''</nowiki>'''
24060 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
24061 '''foo'''<nowiki/>'s
24062 '''foo''
24063 ''foo''<nowiki/>'
24064 ''foo'''<nowiki/>'
24065 '''foo''<nowiki/>'
24066 ''''foo'''
24067 '''foo'''<nowiki/>'
24068 ''''foo'''<nowiki/>'
24069 ''fools'<span> errand</span>''
24070 ''<span>fool</span>'s errand''
24071 '<nowiki/>''foo'' bar '''baz''
24072 a|!*#-:;+-~[]{}b'''x''
24073 !! end
24074
24075 !! test
24076 1b. Quotes inside <b> and <i> with other tags on same line
24077 !! options
24078 parsoid=html2wt
24079 !! html/parsoid
24080 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24081 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
24082 <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>
24083 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
24084 '<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>
24085 '<i>foo</i> <div title="name">test</div>
24086 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
24087 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
24088 <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>
24089 </ol>
24090 !! wikitext
24091 '''a'' foo ''[[bar]]''
24092 ''a''' foo ''[[bar]]''
24093 ''a''' foo '''{{echo|[[bar]]}}'''
24094 [[foo]] x'''[[bar]]''
24095 '''foo'' <ref>test</ref>
24096 '''foo'' <div title="name">test</div>
24097 '''foo'' and <br> bar
24098 <references />
24099 !! end
24100
24101 !! test
24102 2. Link fragments separated by <i> and <b> tags
24103 !! options
24104 parsoid=html2wt
24105 !! html/parsoid
24106 <p>[[<i>foo</i>hello]]</p>
24107 <p>[[<b>foo</b>hello]]</p>
24108 !! wikitext
24109 [[''foo''<nowiki>hello]]</nowiki>
24110
24111 [['''foo'''<nowiki>hello]]</nowiki>
24112 !! end
24113
24114 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
24115 # this is one of the shortcomings of this format
24116 !! test
24117 3. Link fragments inside <i> and <b>
24118 !! options
24119 parsoid=html2wt
24120 !! html/parsoid
24121 <p><i>[[foo</i>]]</p>
24122 <p><b>[[foo</b>]]</p>
24123 !! wikitext
24124 ''[[foo''<nowiki>]]</nowiki>
24125
24126 '''[[foo'''<nowiki>]]</nowiki>
24127 !! end
24128
24129 !! test
24130 4. No escaping needed
24131 !! options
24132 options=html2wt
24133 !! html/parsoid
24134 <p>'<span><i>bar</i></span>'
24135 '<span><b>bar</b></span>'
24136 'a:b'foo
24137 </p>
24138 !! wikitext
24139 '<span>''bar''</span>'
24140 '<span>'''bar'''</span>'
24141 'a:b'foo
24142 !! end
24143
24144 #### ----------- Paragraphs ---------------
24145 #### 1. No unnecessary escapes
24146 #### --------------------------------------
24147
24148 !! test
24149 1. No unnecessary escapes
24150 !! options
24151 parsoid=html2wt
24152 !! html/parsoid
24153 <p>bar <span>[[foo]]</span>
24154 </p><p>=bar <span>[[foo]]</span>
24155 </p><p>[[bar <span>[[foo]]</span>
24156 </p><p>]]bar <span>[[foo]]</span>
24157 </p><p>=bar <span>foo]]</span>=
24158 </p>
24159 !! wikitext
24160 bar <span><nowiki>[[foo]]</nowiki></span>
24161
24162 =bar <span><nowiki>[[foo]]</nowiki></span>
24163
24164 [[bar <span><nowiki>[[foo]]</nowiki></span>
24165
24166 ]]bar <span><nowiki>[[foo]]</nowiki></span>
24167
24168 =bar <span>foo]]</span><nowiki>=</nowiki>
24169 !!end
24170
24171 #### ----------------------- PRE --------------------------
24172 #### 1. Leading whitespace in SOL context should be escaped
24173 #### ------------------------------------------------------
24174 !! test
24175 1. Leading whitespace in SOL context should be escaped
24176 !! options
24177 parsoid=html2wt
24178 !! html/parsoid
24179 <p> a</p>
24180
24181 <p> a</p>
24182
24183 <p> a(tab)</p>
24184
24185 <p> a
24186 <!--cmt-->
24187 a</p>
24188
24189 <p>a
24190 b</p>
24191
24192 <p>a
24193 b</p>
24194
24195 <p>a
24196 b</p>
24197 !! wikitext
24198 <nowiki> </nowiki>a
24199
24200 <nowiki> </nowiki> a
24201
24202 a(tab)
24203
24204 <nowiki> </nowiki> a
24205 <!--cmt-->
24206 <nowiki> </nowiki>a
24207
24208 a
24209 <nowiki> </nowiki>b
24210
24211 a
24212 b
24213
24214 a
24215 b
24216 !! html/php
24217 <p> a
24218 </p><p> a
24219 </p><p> a(tab)
24220 </p><p> a
24221 a
24222 </p><p>a
24223 b
24224 </p><p>a
24225 b
24226 </p><p>a
24227 b
24228 </p>
24229 !! end
24230
24231 !! test
24232 2. Leading whitespace in non-indent-pre contexts should not be escaped
24233 !! options
24234 parsoid=html2wt
24235 !! html/parsoid
24236 <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>
24237 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
24238 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><i>a</i>
24239 b</span></li>
24240 </ol>
24241 !! wikitext
24242 foo <ref>''a''
24243 b</ref>
24244 <references />
24245 !! end
24246
24247 !! test
24248 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
24249 !! options
24250 parsoid=html2wt
24251 !! html/parsoid
24252 <blockquote>
24253 <p>
24254 a
24255 <span>b</span>
24256 c</p>
24257 </blockquote>
24258 !! wikitext
24259 <blockquote>
24260 a
24261 <span>b</span>
24262 c
24263 </blockquote>
24264 !! end
24265
24266 !! test
24267 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
24268 !! options
24269 options=html2wt
24270 !! html/parsoid
24271 <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>
24272 !! wikitext
24273 [[File:Foobar.jpg|thumb|caption]]
24274 !! end
24275
24276 !! test
24277 5. Nowiki escaping should account for indent-pres
24278 !! options
24279 parsoid=html2wt
24280 !! html/parsoid
24281 <pre>==foo==</pre>
24282 !! wikitext
24283 ==foo==
24284 !! end
24285
24286 !!test
24287 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
24288 !! options
24289 parsoid=html2wt
24290 !! html/parsoid
24291 <pre>
24292 * foo
24293 * bar
24294 </pre>
24295 !! wikitext
24296 * foo
24297 * bar
24298 !! end
24299
24300 #### --------------- Behavior Switches --------------------
24301
24302 !! test
24303 1. Valid behavior switches should be escaped
24304 !! options
24305 parsoid=html2wt
24306 !! html/parsoid
24307 __TOC__
24308 <i>__TOC__</i>
24309 !! wikitext
24310 <nowiki>__TOC__</nowiki>
24311 ''<nowiki>__TOC__</nowiki>''
24312 !! end
24313
24314 !! test
24315 2. Invalid behavior switches should not be escaped
24316 !! options
24317 parsoid=html2wt
24318 !! html/parsoid
24319 __TOO__
24320 __|__
24321 !! wikitext
24322 __TOO__
24323 __|__
24324 !! end
24325
24326 # We use indent-pre as an indirect way to test for sol-transparent behavior.
24327 !! test
24328 Behavior switches should be SOL-transparent
24329 !! options
24330 parsoid=html2wt
24331 !! html/parsoid
24332 <meta property="mw:PageProp/toc" />
24333
24334 <!-- this one's bogus -->
24335 <pre>__TOO__</pre>
24336
24337 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
24338
24339 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
24340 !! wikitext
24341 __TOC__
24342
24343 <!-- this one's bogus -->
24344 __TOO__
24345
24346 __TOC__ foo
24347
24348 __TOC__
24349 bar
24350 !! end
24351
24352 #### --------------- HTML tags ---------------
24353 #### 1. a tags
24354 #### 2. other tags
24355 #### 3. multi-line html tag
24356 #### 4. extension tags
24357 #### -----------------------------------------
24358 !! test
24359 1. a tags
24360 !! options
24361 parsoid=html2wt
24362 !! html/parsoid
24363 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
24364 !! wikitext
24365 <a href="http://google.com">google</a>
24366 !! end
24367
24368 !! test
24369 2. other tags
24370 !! options
24371 parsoid=html2wt
24372 !! html/parsoid
24373 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
24374 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
24375 <li> &lt;td&gt;</li></ul>
24376
24377 !! wikitext
24378 * <nowiki><div>foo</div></nowiki>
24379 * <nowiki><div style="color:red">foo</div></nowiki>
24380 * <nowiki><td></nowiki>
24381 !! end
24382
24383 !! test
24384 3. multi-line html tag
24385 !! options
24386 parsoid=html2wt
24387 !! html/parsoid
24388 <p>&lt;div
24389 &gt;foo&lt;/div
24390 &gt;
24391 </p>
24392 !! wikitext
24393 <nowiki><div
24394 >foo</div
24395 ></nowiki>
24396 !! end
24397
24398 !! test
24399 4. extension tags
24400 !! options
24401 parsoid=html2wt
24402 !! html/parsoid
24403 <p>&lt;ref&gt;foo&lt;/ref&gt;
24404 </p><p>&lt;ref&gt;bar
24405 </p><p>baz&lt;/ref&gt;
24406 </p>
24407 !! wikitext
24408 <nowiki><ref>foo</ref></nowiki>
24409
24410 <nowiki><ref>bar</nowiki>
24411
24412 baz<nowiki></ref></nowiki>
24413 !! end
24414
24415 #### --------------- Others ---------------
24416 !! test
24417 Escaping nowikis
24418 !! options
24419 parsoid=html2wt
24420 !! html/parsoid
24421 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
24422 </p>
24423 !! wikitext
24424 &lt;nowiki&gt;foo&lt;/nowiki&gt;
24425 !! end
24426
24427 ## The quote-char in the input is necessary for triggering the bug
24428 !! test
24429 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
24430 !! options
24431 parsoid=html2wt
24432 !! html/parsoid
24433 <p>foo's bar :</p>
24434 !! wikitext
24435 foo's bar :
24436 !! end
24437
24438 #----------- End of wikitext escaping tests --------------
24439
24440 !! test
24441
24442 Tag-like HTML structures are passed through as text
24443 !! wikitext
24444 <x y>
24445
24446 <x.y>
24447
24448 <x-y>
24449
24450 1>2
24451
24452 x<y
24453
24454 a>b
24455
24456 1<d e>f
24457 !! html
24458 <p>&lt;x y&gt;
24459 </p><p>&lt;x.y&gt;
24460 </p><p>&lt;x-y&gt;
24461 </p><p>1&gt;2
24462 </p><p>x&lt;y
24463 </p><p>a&gt;b
24464 </p><p>1&lt;d e&gt;f
24465 </p>
24466 !! end
24467
24468 !! test
24469 HTML tag with necessary entities in attributes
24470 !! wikitext
24471 <span title="&amp;amp;">foo</span>
24472 !! html
24473 <p><span title="&amp;amp;">foo</span>
24474 </p>
24475 !! end
24476
24477 !! test
24478 HTML tag with 'unnecessary' entity encoding in attributes
24479 !! wikitext
24480 <span title="&amp;">foo</span>
24481 !! html
24482 <p><span title="&amp;">foo</span>
24483 </p>
24484 !! end
24485
24486 !! test
24487 HTML tag with broken attribute value quoting
24488 !! options
24489 parsoid=wt2html,html2html
24490 !! wikitext
24491 <span title="Hello world>Foo</span>
24492 !! html/php
24493 <p><span title="Hello world">Foo</span>
24494 </p>
24495 !! html/parsoid
24496 <p><span title="Hello world">Foo</span></p>
24497 !! end
24498
24499 !! test
24500 Self-closed tag with broken attribute value quoting
24501 !! options
24502 parsoid=wt2html,html2html
24503 !! wikitext
24504 <div title="Hello world />Foo
24505 !! html/php+tidy
24506 <div title="Hello world"></div>
24507 <p>Foo</p>
24508 !! html/parsoid
24509 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
24510 !! end
24511
24512 !! test
24513 Table with broken attribute value quoting
24514 !! options
24515 parsoid=wt2html,html2html
24516 !! wikitext
24517 {|
24518 | title="Hello world|Foo
24519 |}
24520 !! html/php
24521 <table>
24522 <tr>
24523 <td title="Hello world">Foo
24524 </td></tr></table>
24525
24526 !! html/parsoid
24527 <table>
24528 <tr>
24529 <td title="Hello world">Foo
24530 </td></tr></table>
24531
24532 !! end
24533
24534 !! test
24535 Table with broken attribute value quoting on consecutive lines
24536 !! options
24537 parsoid=wt2html,html2html
24538 !! wikitext
24539 {|
24540 | title="Hello world|Foo
24541 | style="color:red|Bar
24542 |}
24543 !! html/php
24544 <table>
24545 <tr>
24546 <td title="Hello world">Foo
24547 </td>
24548 <td style="color:red">Bar
24549 </td></tr></table>
24550
24551 !! html/parsoid
24552 <table><tbody>
24553 <tr>
24554 <td title="Hello world">Foo
24555 </td><td style="color: red">Bar
24556 </td></tr></tbody></table>
24557
24558 !! end
24559
24560 !!test
24561 Accept empty td cell attribute
24562 !! wikitext
24563 {|
24564 | align="center" | foo || |
24565 |}
24566 !! html
24567 <table>
24568 <tr>
24569 <td align="center"> foo </td>
24570 <td>
24571 </td></tr></table>
24572
24573 !!end
24574
24575 !!test
24576 Non-empty attributes in th-cells
24577 !! wikitext
24578 {|
24579 ! Foo !! style="color: red" | Bar
24580 |}
24581 !! html
24582 <table>
24583 <tr>
24584 <th> Foo </th>
24585 <th style="color: red"> Bar
24586 </th></tr></table>
24587
24588 !!end
24589
24590 !!test
24591 Accept empty attributes in th-cells
24592 !! wikitext
24593 {|
24594 !| foo !!| bar
24595 |}
24596 !! html
24597 <table>
24598 <tr>
24599 <th> foo </th>
24600 <th> bar
24601 </th></tr></table>
24602
24603 !!end
24604
24605 !!test
24606 Empty table rows go away
24607 !! wikitext
24608 {|
24609 | Hello
24610 | there
24611 |- class="foo"
24612 |-
24613 |}
24614 !! html
24615 <table>
24616 <tr>
24617 <td> Hello
24618 </td>
24619 <td> there
24620 </td></tr>
24621
24622 </table>
24623
24624 !! end
24625
24626 ###
24627 ### Parsoid-centric tests for testing RTing of inter-element separators
24628 ### Edge cases not tested by existing parser tests and specific to
24629 ### Parsoid-specific serialization strategies.
24630 ###
24631
24632 !!test
24633 RT-ed inter-element separators should be valid separators
24634 !! wikitext
24635 {|
24636 |- [[foo]]
24637 |}
24638 !! html/php
24639 <table>
24640
24641 </table>
24642
24643 !! html/parsoid
24644 <table>
24645 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
24646 </tbody></table>
24647 !!end
24648
24649 # Parsoid-only since PHP parser relies on Tidy for correct output
24650 !!test
24651 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
24652 !!options
24653 parsoid
24654 !! wikitext
24655 {|
24656 |<small>foo
24657 bar
24658 |}
24659
24660 {|
24661 |<small>foo<small>
24662 |}
24663 !! html
24664 <table>
24665 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
24666 <p>bar</p></small></td></tr>
24667 </tbody></table>
24668
24669 <table>
24670 <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>
24671 </tbody></table>
24672 !!end
24673
24674 # Note that the "style" attribute is really a template parameter here.
24675 # The = would have to be {{=}} if you wanted the literal.
24676 !!test
24677 Empty TD followed by TD with tpl-generated attribute
24678 !! wikitext
24679 {|
24680 |-
24681 |
24682 |{{echo|style='color:red'}}|foo
24683 |}
24684 !! html
24685 <table>
24686
24687 <tr>
24688 <td>
24689 </td>
24690 <td>foo
24691 </td></tr></table>
24692
24693 !!end
24694
24695 !!test
24696 Indented table with an empty td
24697 !! wikitext
24698 {|
24699 |-
24700 |
24701 |foo
24702 |}
24703 !! html
24704 <table>
24705
24706 <tr>
24707 <td>
24708 </td>
24709 <td>foo
24710 </td></tr></table>
24711
24712 !!end
24713
24714 ## We have some newline diffs RT-ing this edge case
24715 ## and it is not important enough -- we seem to be emitting
24716 ## at most 2 newlines after a </tr> and this is unrelated to
24717 ## the issue from T85627 that this is testing.
24718 !!test
24719 Indented table with blank lines in between (T85627)
24720 !! options
24721 parsoid=wt2html
24722 !! wikitext
24723 {|
24724 |foo
24725
24726
24727 |}
24728 !! html
24729 <table>
24730
24731 <tr>
24732 <td>foo
24733 </td></tr></table>
24734
24735 !!end
24736
24737 !!test
24738 Indented block & table
24739 !! wikitext
24740 <div>foo</div>
24741 {|
24742 |foo
24743 |}
24744 !! html/php
24745 <div>foo</div>
24746 <table>
24747 <tr>
24748 <td>foo
24749 </td></tr></table>
24750
24751 !! html/parsoid
24752 <div data-parsoid='{"stx":"html"}'>foo</div>
24753 <table><tbody>
24754 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
24755 </tbody></table>
24756 !!end
24757
24758 !! test
24759 Indent and comment before table row
24760 !! wikitext
24761 {|
24762 <!--hi-->|-
24763 | there
24764 |}
24765 !! html/php
24766 <table>
24767
24768 <tr>
24769 <td> there
24770 </td></tr></table>
24771
24772 !! html/parsoid
24773 <table>
24774 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
24775 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
24776 </tbody></table>
24777 !! end
24778
24779 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
24780 !!test
24781 Empty TR followed by a template-generated TR
24782 !!options
24783 parsoid
24784 !! wikitext
24785 {|
24786 |-
24787 {{echo|<tr><td>foo</td></tr>}}
24788 |}
24789 !! html
24790 <table>
24791 <tbody>
24792 <tr></tr>
24793 <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}}]}'>
24794 <td>foo</td></tr>
24795 </tbody></table>
24796 !!end
24797
24798 ## PHP and parsoid output differ for this, and since this is primarily
24799 ## for testing Parsoid's serializer, marking this Parsoid only
24800 !!test
24801 Empty TR followed by mixed-ws-comment line should RT correctly
24802 !!options
24803 parsoid
24804 !! wikitext
24805 {|
24806 |-
24807 <!--c-->
24808 |-
24809 <!--c--> <!--d-->
24810 |}
24811 !! html
24812 <table>
24813 <tbody>
24814 <tr></tr>
24815 <!--c-->
24816 <tr>
24817 <!--c--> </tr><!--d-->
24818 </tbody></table>
24819
24820 !!end
24821
24822 !!test
24823 Multi-line image caption generated by templates with/without trailing newlines
24824 !! wikitext
24825 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
24826 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
24827 !! html/parsoid
24828 <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>
24829 <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>
24830 !!end
24831
24832 !! test
24833 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
24834 !! options
24835 parsoid=html2wt
24836 !! html/parsoid
24837 <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>
24838
24839 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
24840 !! wikitext
24841 <includeonly>foo</includeonly>
24842 new para
24843
24844 [[Category:Foo]]
24845
24846 = new heading =
24847 !! end
24848
24849 ## PHP emits broken html for this, and since this is primarily
24850 ## a Parsoid serializer test, marking this Parsoid only
24851 !!test
24852 Improperly nested inline or quotes tags with whitespace in between
24853 !! wikitext
24854 <span> <s>x</span> </s>
24855 ''' ''x''' ''
24856 !! html/parsoid
24857 <p><span> <s>x</s></span><s> </s>
24858 <b> <i>x</i></b><i> </i>
24859 </p>
24860 !!end
24861
24862 !!test
24863 Encapsulate protected attributes from wt
24864 !! wikitext
24865 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
24866
24867 {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
24868 | ok
24869 |}
24870 !! html/parsoid
24871 <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>
24872
24873 <table data-x-typeof="mw:placeholder stuff" data-x-data-mw="whoo" data-x-data-parsoid="weird" data-x-data-parsoid-other="no" data-x-about="time" data-x-rel="mw:true">
24874 <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
24875 </tbody></table>
24876 !!end
24877
24878 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
24879 ## Having nested or stray pre tags results in the attempt to add duplicates,
24880 ## causing an assertion fail. This test tries to prevent that situation.
24881 !!test
24882 Ensure ParagraphWrapper can deal with stray closing pre tags
24883 !!options
24884 parsoid=wt2html
24885 !! wikitext
24886 plain text</pre>
24887 !! html/parsoid
24888 plain text
24889 !!end
24890
24891 !!test
24892 1. Ensure fostered text content is wrapped in element nodes
24893 !!options
24894 parsoid=wt2html
24895 !! wikitext
24896 <table>hi</table><table>ho</table>
24897 !! html/parsoid
24898 <p>hi</p>
24899 <table></table>
24900 <p>ho</p>
24901 <table></table>
24902 !!end
24903
24904 !!test
24905 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
24906 !!options
24907 parsoid=wt2html,wt2wt
24908 !! wikitext
24909 <table>
24910 <tr> || ||
24911 <td> a
24912 </table>
24913 !! html/parsoid
24914 <p> || ||
24915 </p><table>
24916 <tbody><tr><td> a</td></tr>
24917 </tbody></table>
24918 !!end
24919
24920 !!test
24921 Encapsulation properly handles null DSR information from foster box
24922 !!options
24923 parsoid=wt2html,wt2wt
24924 !! wikitext
24925 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
24926 !! html/parsoid
24927 <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>
24928 !!end
24929
24930 !!test
24931 1. Encapsulate foster-parented transclusion content
24932 !!options
24933 parsoid=wt2wt,wt2html
24934 !! wikitext
24935 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
24936 !! html/parsoid
24937 <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>
24938 <tbody>
24939 <tr>
24940 <td>bar</td>
24941 </tr>
24942 </tbody>
24943 </table>
24944 !!end
24945
24946 !!test
24947 2. Encapsulate foster-parented transclusion content
24948 !!options
24949 parsoid=wt2wt,wt2html
24950 !! wikitext
24951 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
24952 !! html/parsoid
24953 <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>
24954 <table>
24955 <tbody>
24956 <tr>
24957 <td>bar</td>
24958 </tr>
24959 </tbody>
24960 </table>
24961 !!end
24962
24963 !!test
24964 3. Encapsulate foster-parented transclusion content
24965 !!options
24966 parsoid=wt2wt,wt2html
24967 !! wikitext
24968 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24969 !! html/parsoid
24970 <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;]}">
24971 <p>foo</p>
24972 </div>
24973 <table>
24974 <tbody>
24975 <tr>
24976 <td>bar</td>
24977 </tr>
24978 </tbody>
24979 </table>
24980 !!end
24981
24982 !!test
24983 4. Encapsulate foster-parented transclusion content
24984 !!options
24985 parsoid=wt2wt,wt2html
24986 !! wikitext
24987 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24988 !! html/parsoid
24989 <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;]}">
24990 <p>foo</p>
24991 </div>
24992 <table>
24993 <tbody>
24994 <tr>
24995 <td>bar</td>
24996 </tr>
24997 </tbody>
24998 </table>
24999 !!end
25000
25001 !!test
25002 5. Encapsulate foster-parented transclusion content
25003 !!options
25004 parsoid=wt2wt,wt2html
25005 !! wikitext
25006 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
25007 !! html/parsoid
25008 <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>
25009 <table>
25010 <tbody>
25011 <tr>
25012 <td>
25013 <div>
25014 <p>foo</p>
25015 </div>
25016 </td>
25017 </tr>
25018 </tbody>
25019 </table>
25020 !!end
25021
25022 !!test
25023 6. Encapsulate foster-parented transclusion content
25024 !!options
25025 parsoid=wt2wt,wt2html
25026 !! wikitext
25027 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
25028 !! html/parsoid
25029 <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>
25030 <table>
25031 <tbody>
25032 <tr>
25033 <td>
25034 <div>
25035 <p>foo</p>
25036 </div>
25037 </td>
25038 </tr>
25039 </tbody>
25040 </table>
25041 <p>ok</p>
25042 !!end
25043
25044 !!test
25045 7. Encapsulate foster-parented transclusion content
25046 !!options
25047 parsoid=wt2wt,wt2html
25048 !! wikitext
25049 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
25050 !! html/parsoid
25051 <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>
25052 <table>
25053 <tbody>
25054 <tr>
25055 <td>bar</td>
25056 </tr>
25057 </tbody>
25058 </table>
25059 !!end
25060
25061 # Note that the wt is broken on purpose: the = should be {{=}} if you
25062 # don't want it to be a template parameter key.
25063 !!test
25064 8. Encapsulate foster-parented transclusion content
25065 !!options
25066 parsoid=wt2wt,wt2html
25067 !! wikitext
25068 {{echo|a
25069 }}{|{{echo|style='color:red'}}
25070 |-
25071 |b
25072 |}
25073 !! html/parsoid
25074 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
25075 <span> </span>
25076 <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>
25077 <table>
25078 <tbody>
25079 <tr>
25080 <td>b</td>
25081 </tr>
25082 </tbody>
25083 </table>
25084 !!end
25085
25086 !!test
25087 9. Encapsulate foster-parented transclusion content
25088 !!options
25089 parsoid=wt2wt,wt2html
25090 !! wikitext
25091 <table>{{echo|hi</table>hello}}
25092 !! html/parsoid
25093 <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>
25094 !!end
25095
25096 !!test
25097 Table in fosterable position
25098 !!options
25099 parsoid=wt2html
25100 !! wikitext
25101 {{OpenTable}}
25102 <div>
25103 {|
25104 |}
25105 </div>
25106 |}
25107 !! html/parsoid
25108 <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">
25109 </span>
25110 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
25111
25112 <table>
25113 </table>
25114 !!end
25115
25116 # Parsoid only for bug 64747
25117 !! test
25118 Properly encapsulate empty-content transclusions in fosterable positions
25119 !! wikitext
25120 <table>
25121 {{#if:|
25122 <td>foo</td>
25123 }}
25124 </table>
25125 !! html/parsoid
25126 <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"}]]}'>
25127
25128 </table>
25129 !! end
25130
25131 !! test
25132 Always encapsulate foster box when template range is expanded to table
25133 !! options
25134 parsoid=wt2wt
25135 !! wikitext
25136 {|
25137 hello
25138 {{OpenTable}}
25139 |}
25140 !! html/parsoid
25141
25142 !! end
25143
25144 !! test
25145 T115289: Unclosed table
25146 !! wikitext
25147 {{echo|<table>}}<!--c-->[[Category:Two]]
25148 !! html/parsoid
25149 <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>
25150 !! end
25151
25152 !! test
25153 T115289: Don't migrate newlines out of tables with fostered content
25154 !! wikitext
25155 <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
25156 !! html/parsoid
25157 <link rel="mw:PageProp/Category" href="./Category:One" about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"stx":"simple","a":{"href":"./Category:One"},"sa":{"href":"Category:One"},"fostered":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":["&lt;table>&lt;td>&lt;/td>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;tr>[[Category:One]]"}},"i":0}},"&lt;!--c-->[[Category:Two]]"]}'/><link rel="mw:PageProp/Category" href="./Category:Two" about="#mwt2"/><table about="#mwt2" data-parsoid='{"stx":"html","autoInsertedEnd":true}'><tbody><tr><td></td></tr><tr><!--c--></tr></tbody></table>
25158 !! end
25159
25160 !! test
25161 T73074: More fostering fun
25162 !! wikitext
25163 <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
25164 !! html/parsoid
25165 <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>
25166 !! end
25167
25168 !!test
25169 Support <object> element with .data attribute
25170 !!options
25171 parsoid=html2wt
25172 !! html/parsoid
25173 <object data="test.swf"></object>
25174 !! wikitext
25175 <object data="test.swf"></object>
25176 !!end
25177
25178 !! test
25179 Don't block XML namespace declaration
25180 !! wikitext
25181 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25182 !! html/php
25183 <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
25184 </p>
25185 !! html/parsoid
25186 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
25187 !! end
25188
25189 # -----------------------------------------------------------------
25190 # The following section of tests are primarily to spec requirements
25191 # around Parsoid's serialization (old, new, edited content)
25192 #
25193 # All these tests are marked Parsoid html2wt and html2html only
25194 # ----------------------------------------------------------------
25195
25196 !! test
25197 Ignore rel attribute in a-tags during serialization to url-links
25198 !! options
25199 parsoid=html2wt
25200 !! html/parsoid
25201 <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
25202 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
25203 <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
25204 !! wikitext
25205 http://en.wikipedia.org/wiki/Foobar
25206 http://en.wikipedia.org/wiki/Foobar
25207 http://en.wikipedia.org/wiki/Foobar
25208 !! end
25209
25210 # 'mi' is a localinterwiki prefix as well as a language
25211 !! test
25212 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
25213 !! options
25214 parsoid=html2wt
25215 !! html/parsoid
25216 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
25217 !! wikitext
25218 [[Foo]]
25219 !! end
25220
25221 # See T93839
25222 !! test
25223 New wikilinks should be serialized properly
25224 !! options
25225 parsoid=html2wt
25226 !! html/parsoid
25227 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
25228 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
25229 <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
25230 <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
25231 <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
25232 !! wikitext
25233 [[Foo]]
25234 [[Foo]]
25235 [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
25236 http://en.wikipedia.org/wiki/Foo
25237 [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
25238 !! end
25239
25240 !! test
25241 New wiki links (href variations)
25242 !! options
25243 parsoid=html2wt
25244 !! html/parsoid
25245 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25246 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
25247 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
25248 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
25249 !! wikitext
25250 [[Foo_bar]]
25251 [[Foo_bar]]
25252 [[Foo_bar]]
25253 [[Toxine bactérienne]]
25254 !! end
25255
25256 !! test
25257 New wiki links (content string variations)
25258 !! options
25259 parsoid=html2wt
25260 !! html/parsoid
25261 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
25262 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
25263 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
25264 !! wikitext
25265 [[Foo_bar]]
25266 [[Foo bar]]
25267 [[Foo_bar|./Foo_bar]]
25268 !! end
25269
25270 !! test
25271 New category links (href variations)
25272 !! options
25273 parsoid=html2wt
25274 !! html/parsoid
25275 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
25276 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
25277 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
25278 !! wikitext
25279 [[Category:Toxine bactérienne]]
25280 [[Category:Toxine bactérienne]]
25281 [[Category:Toxine bactérienne]]
25282 !! end
25283
25284 !! test
25285 New sol transparent links don't need indent-pre nowiki protection
25286 !! options
25287 parsoid=html2wt
25288 language=de
25289 !! html/parsoid
25290 <link rel="mw:PageProp/redirect" href="./Main_Page">
25291 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
25292 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
25293 !! wikitext
25294 #WEITERLEITUNG [[Main Page]]
25295 <!-- this is good --> [[Category:Good]]
25296 <!-- this is great --> [[Kategorie:Great]]
25297 !! end
25298
25299 !! test
25300 New interlanguage links (href variations)
25301 !! options
25302 parsoid=html2wt
25303 !! html/parsoid
25304 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
25305 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
25306 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
25307 !! wikitext
25308 [[es:Toxine bactérienne]]
25309 [[es:Toxine_bactérienne]]
25310 [[es:Toxine_bactérienne]]
25311 !! end
25312
25313 !! test
25314 Image: Modifying size of an image (1)
25315 !! options
25316 parsoid={
25317 "modes": ["wt2wt"],
25318 "changes": [
25319 ["img[height]", "attr", "height", "22"],
25320 ["img[width]", "attr", "width", "200"]
25321 ]
25322 }
25323 !! wikitext
25324 [[Image:Foobar.jpg|230x230px]]
25325 !! wikitext/edited
25326 [[Image:Foobar.jpg|200x200px]]
25327 !!end
25328
25329 !! test
25330 Image: Modifying size of an image (2)
25331 !! options
25332 parsoid={
25333 "modes": ["wt2wt"],
25334 "changes": [
25335 ["img[height]", "attr", "height", "100"],
25336 ["img[width]", "attr", "width", "500"]
25337 ]
25338 }
25339 !! wikitext
25340 [[Image:Foobar.jpg|230x230px]]
25341 !! wikitext/edited
25342 [[Image:Foobar.jpg|500x500px]]
25343 !!end
25344
25345 # Change in size is ignored so long as class='mw-default-size'
25346 !! test
25347 Image: Modifying size of an image (3)
25348 !! options
25349 parsoid={
25350 "modes": ["wt2wt"],
25351 "changes": [
25352 ["figure[class]", "removeClass", "mw-default-size"],
25353 ["figure img", "attr", "height", "19"],
25354 ["figure img", "attr", "width", "170"]
25355 ]
25356 }
25357 !! wikitext
25358 [[Image:Foobar.jpg|thumb]]
25359 !! wikitext/edited
25360 [[Image:Foobar.jpg|thumb|170x170px]]
25361 !!end
25362
25363 !! test
25364 Image: Modifying alignment of an image (bug 48665)
25365 !! options
25366 parsoid={
25367 "modes": ["wt2wt"],
25368 "changes": [
25369 ["figure[class]", "removeClass", "mw-halign-right"],
25370 ["figure[class]", "addClass", "mw-halign-left"]
25371 ]
25372 }
25373 !! wikitext
25374 [[Image:Foobar.jpg|thumb|caption|right]]
25375 !! wikitext/edited
25376 [[Image:Foobar.jpg|thumb|caption|left]]
25377 !! end
25378
25379 !! test
25380 Image: Modifying mw-default-size of an frameless image (bug 62805)
25381 !! options
25382 parsoid={
25383 "modes": ["wt2wt"],
25384 "changes": [
25385 ["figure.mw-default-size", "removeClass", "mw-default-size"]
25386 ]
25387 }
25388 !! wikitext
25389 [[Image:Foobar.jpg|frameless|right]]
25390 !! wikitext/edited
25391 [[Image:Foobar.jpg|frameless|right|220x220px]]
25392 !! end
25393
25394 !! test
25395 Image: Modifying valign of an image (bug 49221)
25396 !! options
25397 parsoid={
25398 "modes": ["wt2wt"],
25399 "changes": [
25400 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
25401 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
25402 ]
25403 }
25404 !! wikitext
25405 [[File:Foobar.jpg|20px|middle]]
25406 !! wikitext/edited
25407 [[File:Foobar.jpg|20px|text-top]]
25408 !! end
25409
25410 !! test
25411 Image: Modifying alt attribute of an image (bug 56400)
25412 !! options
25413 parsoid={
25414 "modes": ["wt2wt"],
25415 "changes": [
25416 ["img[alt]", "attr", "alt", "some alternate edited text"]
25417 ]
25418 }
25419 !! wikitext
25420 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
25421 !! wikitext/edited
25422 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
25423 !!end
25424
25425 !! test
25426 Image: Modifying caption of an image
25427 !! options
25428 parsoid={
25429 "modes": ["wt2wt"],
25430 "changes": [
25431 ["figcaption", "text", "new caption"]
25432 ]
25433 }
25434 !! wikitext
25435 [[Image:Foobar.jpg|thumb|original caption]]
25436 !! wikitext/edited
25437 [[Image:Foobar.jpg|thumb|new caption]]
25438 !!end
25439
25440 !! test
25441 Image: empty alt attribute (bug 48924)
25442 !! options
25443 parsoid
25444 !! wikitext
25445 [[File:Foobar.jpg|thumb|alt=|bar]]
25446 !! html
25447 <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>
25448 !! end
25449
25450 !! test
25451 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
25452 !! options
25453 parsoid=html2wt
25454 language=ar
25455 disabled
25456 !! html/parsoid
25457 <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>
25458 !! wikitext
25459 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
25460 !! end
25461
25462 !! test
25463 Image: Block level image should have \n before and after
25464 !! wikitext
25465 123
25466 [[File:Foobar.jpg|right|thumb|150x150px]]
25467 456
25468 !! html/parsoid
25469 <p>123</p>
25470 <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>
25471 <p>456</p>
25472 !!end
25473
25474 !! test
25475 Image: New block level image should have \n before and after (existing content)
25476 !! wikitext
25477 123
25478 [[File:Foobar.jpg|right|thumb|150x150px]]
25479 456
25480 !! html/parsoid
25481 <p>123</p>
25482 <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>
25483 <p>456</p>
25484 !!end
25485
25486 !! test
25487 Image: upright option (parsoid)
25488 !! wikitext
25489 [[File:Foobar.jpg|thumb|upright|caption]]
25490 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
25491 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
25492 !! html/parsoid
25493 <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>
25494 <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>
25495 <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>
25496 !!end
25497
25498 !! test
25499 Image: upright option is ignored on inline and frame images (parsoid)
25500 !! wikitext
25501 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
25502 !! html/parsoid
25503 <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>
25504 !!end
25505
25506 !! test
25507 Image: from basic HTML (1)
25508 !! options
25509 parsoid=html2wt
25510 !! html/parsoid
25511 <span typeof="mw:Image">
25512 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25513 </span>
25514 !! wikitext
25515 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25516 !! end
25517
25518 !! test
25519 Image: from basic HTML (2)
25520 !! options
25521 parsoid=html2wt
25522 !! html/parsoid
25523 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
25524 !! wikitext
25525 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
25526 !! end
25527
25528 !! test
25529 Image: from basic HTML (3)
25530 !! options
25531 parsoid=html2wt
25532 !! html/parsoid
25533 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
25534 !! wikitext
25535 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
25536 !! end
25537
25538 !! test
25539 Image: from basic HTML (4)
25540 !! options
25541 parsoid=html2wt
25542 !! html/parsoid
25543 <img src="./File:Foobar.jpg">
25544 !! wikitext
25545 [[File:Foobar.jpg|link=]]
25546 !! end
25547
25548 !! test
25549 Image: Invalid title as link
25550 !! wikitext
25551 [[File:Foobar.jpg|link=<]]
25552 !! html/php
25553 <p><a href="/wiki/File:Foobar.jpg" class="image" title="link=&lt;"><img alt="link=&lt;" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
25554 </p>
25555 !! html/parsoid
25556 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"link","ak":"link=&lt;"}]}' data-mw='{"caption":"link=&amp;lt;"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
25557 !! end
25558
25559 !! test
25560 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
25561 !! options
25562 parsoid=html2wt
25563 !! html/parsoid
25564 <ul>
25565 <li><p>foo</p></li>
25566 </ul>
25567 !! wikitext
25568 * foo
25569 !! end
25570
25571 !! test
25572 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
25573 !! options
25574 parsoid=html2wt
25575 !! html/parsoid
25576 <ul> <li>foo</li></ul>
25577 !! wikitext
25578 * foo
25579 !! end
25580
25581 !! test
25582 Don't strip leading whitespace when handling indent-pre suppressing tags
25583 !! options
25584 parsoid=html2wt
25585 !! html/parsoid
25586 <table>
25587 <tr><td> indented row</td></tr>
25588 </table>
25589 <blockquote><p>
25590 <b>This is very bold of you!</b>
25591 </p>
25592 <table><tr><td>
25593 indented cell (no pre-wrapping!)
25594 </td></tr></table>
25595 </blockquote>
25596 <p>foo</p>
25597 <div>bar</div>
25598 !! wikitext
25599 {|
25600 | indented row
25601 |}
25602 <blockquote>
25603 '''This is very bold of you!'''
25604
25605 {|
25606 |
25607 indented cell (no pre-wrapping!)
25608 |}
25609 </blockquote>
25610 foo
25611 <div>bar</div>
25612 !! end
25613
25614 !! test
25615 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
25616 !! options
25617 parsoid=html2wt
25618 !! html/parsoid
25619 <p>foo</p>
25620 <span>bar</span>
25621
25622 <span>foo2
25623 </span>bar2
25624
25625 <div>foo</div>
25626 <span>bar</span>
25627
25628 <div>
25629 <span>foo</span>
25630 </div>
25631 !! wikitext
25632 foo
25633
25634 <span>bar</span>
25635
25636 <span>foo2
25637 <nowiki> </nowiki></span>bar2
25638
25639 <div>foo</div>
25640 <nowiki> </nowiki><span>bar</span>
25641
25642 <div>
25643 <nowiki> </nowiki><span>foo</span>
25644 </div>
25645 !! end
25646
25647 !! test
25648 Lists: Dont insert newlines in a serialized list item.
25649 !! options
25650 parsoid=html2wt
25651 !! html/parsoid
25652 <ul><li>a<br>b</li><li>c</li></ul>
25653 !! wikitext
25654 * a<br>b
25655 * c
25656 !! end
25657
25658 !! test
25659 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
25660 !! options
25661 parsoid={
25662 "modes": ["html2wt"],
25663 "scrubWikitext": false
25664 }
25665 !! html/parsoid
25666 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25667 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25668
25669 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25670 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25671
25672 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
25673
25674 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25675 !! wikitext
25676 == hello there [[Category:A1]] ==
25677
25678 == [[Category:A2]] hi pal ==
25679
25680 == <!--foo--> [[Category:A3]] how goes it ==
25681
25682 == it goes well [[Category:A4]] <!--bar--> ==
25683
25684 ==howdy [[Category:A5]]==
25685
25686 == __TOC__ ok ==
25687 !! end
25688
25689 !! test
25690 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
25691 !! options
25692 parsoid={
25693 "modes": ["html2wt"],
25694 "scrubWikitext": true
25695 }
25696 !! html/parsoid
25697 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
25698 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
25699
25700 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
25701 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
25702
25703 <h2><meta property="mw:PageProp/toc" /> ok</h2>
25704 !! wikitext
25705 == hello there ==
25706 [[Category:A1]]
25707 [[Category:A2]]
25708
25709 == hi pal ==
25710
25711 <!--foo--> [[Category:A3]]
25712
25713 == how goes it ==
25714
25715 == it goes well ==
25716 [[Category:A4]] <!--bar-->
25717
25718 __TOC__
25719
25720 == ok ==
25721 !! end
25722
25723 !! test
25724 Headings: Don't hoist metas that come from templates
25725 !! options
25726 parsoid={
25727 "modes": ["html2wt"],
25728 "scrubWikitext": true
25729 }
25730 !! html/parsoid
25731 <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>
25732 !! wikitext
25733 == {{echo|foo [[Category:Foo]]}} ==
25734 !! end
25735
25736 !! test
25737 Headings: Category in ref isn't hoisted
25738 !! options
25739 parsoid={
25740 "modes": ["html2wt"],
25741 "scrubWikitext": true
25742 }
25743 !! html/parsoid
25744 <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>
25745
25746 <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>
25747 !! wikitext
25748 == foo <ref>bar
25749 [[Category:Baz]] </ref> ==
25750
25751 <references />
25752 !! end
25753
25754 !! test
25755 Parsoid: Serialize positional parameters with = in them as named parameter
25756 !! options
25757 parsoid=html2wt
25758 !! html/parsoid
25759 <p about="#mwt1" typeof="mw:Transclusion"
25760 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
25761
25762 <p about="#mwt1" typeof="mw:Transclusion"
25763 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
25764
25765 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25766 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25767 <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>
25768 !! wikitext
25769 {{echo|1=f=oo}}
25770
25771 {{echo|1=f=oo|2=bar}}
25772
25773 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25774 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25775 {{echo|<nowiki>f=oo</nowiki>|bar}}
25776 !! end
25777
25778 !! test
25779 Parsoid: Serialize positional parameters with = in extlink as named parameter
25780 !! options
25781 parsoid=html2wt
25782 !! html/parsoid
25783 <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>
25784 !! wikitext
25785 {{echo|1=http://stuff?is=ok}}
25786 !! end
25787
25788 !! test
25789 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
25790 !! options
25791 parsoid=html2wt
25792 !! html/parsoid
25793 <div>a<p>b</p></div>
25794 <div>a
25795 <p>b</p></div>
25796 <div>
25797 a
25798 <p>b</p></div>
25799 !! wikitext
25800 <div>a
25801 b
25802 </div>
25803 <div>a
25804 b
25805 </div>
25806 <div>
25807 a
25808
25809 b
25810 </div>
25811 !! end
25812
25813 !! test
25814 Substrings resembling wikitext in hrefs should not get nowiki escapes
25815 !! options
25816 parsoid=html2wt
25817 !! html/parsoid
25818 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
25819 !! wikitext
25820 [[Foo''bar''baz]]
25821 !! end
25822
25823 !! test
25824 Enforce single-line context in the serializer
25825 !! options
25826 parsoid=html2wt
25827 !! html/parsoid
25828 <h2>testing
25829 123</h2>
25830
25831 <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">
25832 </span><span about="#mwt1">you</span> </h2>
25833
25834 <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>
25835
25836 <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
25837 there</span></li></ol>
25838
25839 <ul><li>asd
25840 sdf</li></ul>
25841
25842 <ul><li>foo
25843 bar
25844 baz</li>
25845 <li>foo <b>bar</b>
25846 baz</li></ul>
25847
25848 <dl><dt>hi
25849 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
25850 ho</dd></dl>
25851
25852 <dl><dd> <table>
25853 <tbody><tr><td> ha
25854 ha
25855 ha</td></tr>
25856 </tbody></table></dd></dl>
25857 !! wikitext
25858 == testing 123 ==
25859
25860 == hi {{bogus|there
25861 you}} ==
25862
25863 == foo <ref>hello
25864 there</ref> ==
25865
25866 <references />
25867
25868 * asd sdf
25869
25870 * foo bar baz
25871 * foo '''bar''' baz
25872
25873 ; hi ho : hi ho
25874
25875 : {|
25876 | ha
25877 ha
25878 ha
25879 |}
25880 !! end
25881
25882 !! test
25883 Serialize new placeholder space without spans
25884 !! options
25885 parsoid=html2wt
25886 !! html/parsoid
25887 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
25888
25889 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
25890
25891 <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>
25892 !! wikitext
25893 foo : bar
25894
25895 foo : bar
25896
25897 <ref>foo : bar</ref>ok
25898 !! end
25899
25900
25901 #-----------------------
25902 # Tag minimization tests
25903 #-----------------------
25904
25905 !! test
25906 1. I/B quote minimization: wikitext-only tags should be combined
25907 !! options
25908 parsoid=html2wt
25909 !! html/parsoid
25910 <p><i>A</i><i>B</i></p>
25911 <p><b>A</b><b>B</b></p>
25912 <p><i>A</i><b><i>B</i></b></p>
25913 <p><b>A</b><i><b>B</b></i></p>
25914 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
25915 <p><i><b>A</b></i><i><b>B</b></i></p>
25916 <p><i><b>A</b></i><b><i>B</i></b></p>
25917 <p><b><i>A</i></b><i><b>B</b></i></p>
25918 !! wikitext
25919 ''AB''
25920
25921 '''AB'''
25922
25923 ''A'''B'''''
25924
25925 '''A''B'''''
25926
25927 '''A''BC''D'''
25928
25929 '''''AB'''''
25930
25931 '''''AB'''''
25932
25933 '''''AB'''''
25934 !! end
25935
25936 !! test
25937 2. I/B quote minimization: wikitext and html tags should not be combined
25938 !! options
25939 parsoid=html2wt
25940 !! html/parsoid
25941 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
25942 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
25943 !! wikitext
25944 ''A''<i>B</i>
25945
25946 ''A''<nowiki/>'''<i>B</i>'''
25947 !! end
25948
25949 !! test
25950 3. I/B quote minimization: templated content stops minimization
25951 !! options
25952 parsoid=html2wt
25953 !! html/parsoid
25954 <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>
25955 <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>
25956 !! wikitext
25957 ''A''{{echo|''B''}}
25958
25959 ''A''{{echo|'''''B'''''}}
25960 !! end
25961
25962 !! test
25963 4. I/B quote minimization: new content should be mimimized with adjacent old content
25964 !! options
25965 parsoid=html2wt
25966 !! html/parsoid
25967 <p><i>A</i><i>B</i></p>
25968 <p><b>A</b><b>B</b></p>
25969 <p><i>A</i><b><i>B</i></b></p>
25970 !! wikitext
25971 ''AB''
25972
25973 '''AB'''
25974
25975 ''A'''B'''''
25976 !! end
25977
25978 !! test
25979 5a. Merge adjacent quote nodes if they've been edited
25980 !! options
25981 parsoid={
25982 "modes": ["wt2wt", "selser"],
25983 "changes": [
25984 ["p", "contents", "remove", ":contains('b')"]
25985 ]
25986 }
25987 !! wikitext
25988 ''a''b''c''
25989 !! wikitext/edited
25990 ''ac''
25991 !! end
25992
25993 !! test
25994 5b. Merge adjacent quote nodes if they've been edited
25995 !! options
25996 parsoid={
25997 "modes": ["wt2wt", "selser"],
25998 "changes": [
25999 ["#x", "remove"]
26000 ]
26001 }
26002 !! wikitext
26003 ''a''<span id="x">b</span>''c''
26004 !! wikitext/edited
26005 ''ac''
26006 !! end
26007
26008 !! test
26009 1. Merge adjacent link nodes as long as at least one element is new
26010 !! options
26011 parsoid={
26012 "modes": ["html2wt"],
26013 "scrubWikitext": true
26014 }
26015 !! html/parsoid
26016 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26017 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26018 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
26019 !! wikitext
26020 [[Football]]
26021 [[Football]]
26022 [[Football|Foot]][[Football|ball]]
26023 !! end
26024
26025 !! test
26026 2. Merge adjacent link nodes and enable additional normalizations
26027 !! options
26028 parsoid={
26029 "modes": ["html2wt"],
26030 "scrubWikitext": true
26031 }
26032 !! html/parsoid
26033 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
26034 !! wikitext
26035 [[Football|''Football'']]
26036 !! end
26037
26038 !! test
26039 3. Don't merge adjacent link nodes if scrubWikitext is false
26040 !! options
26041 parsoid={
26042 "modes": ["html2wt"],
26043 "scrubWikitext": false
26044 }
26045 !! html/parsoid
26046 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
26047 !! wikitext
26048 [[Football|Foot]][[Football|ball]]
26049 !! end
26050
26051 #------------------------------
26052 # End of tag minimization tests
26053 #------------------------------
26054
26055 !!test
26056 Bug 54262: New entities
26057 !! options
26058 parsoid=html2wt
26059 !! html/parsoid
26060 <span typeof="mw:Entity">&nbsp;</span>
26061 !! wikitext
26062 &nbsp;
26063 !! end
26064
26065 ## Note that there is no wikitext output for 'unknownproperty' ##
26066 ## Unknown magic words are silently dropped ##
26067
26068 !! test
26069 Magic words
26070 !! options
26071 parsoid=html2wt
26072 !! html/parsoid
26073 <meta property='mw:PageProp/toc' />
26074 <meta property='mw:PageProp/notoc' />
26075 <meta property='mw:PageProp/forcetoc' />
26076 <meta property='mw:PageProp/index' />
26077 <meta property='mw:PageProp/noindex' />
26078 <meta property='mw:PageProp/nogallery' />
26079 <meta property='mw:PageProp/noeditsection' />
26080 <meta property='mw:PageProp/notitleconvert' />
26081 <meta property='mw:PageProp/nocontentconvert' />
26082 <meta property='mw:PageProp/unknownproperty' />
26083 !! wikitext
26084 __TOC__
26085 __NOTOC__
26086 __FORCETOC__
26087 __INDEX__
26088 __NOINDEX__
26089 __NOGALLERY__
26090 __NOEDITSECTION__
26091 __NOTITLECONVERT__
26092 __NOCONTENTCONVERT__
26093 !! end
26094
26095 !! test
26096 Consecutive <pre>s should not get merged
26097 !! options
26098 parsoid=html2wt,html2html
26099 !! html/parsoid
26100 <pre>a</pre><pre>b</pre>
26101
26102 <pre>c
26103 </pre><pre>
26104 d</pre>
26105
26106 <pre>e
26107
26108 </pre><pre>
26109
26110 f</pre>
26111 !! wikitext
26112 a
26113
26114 b
26115
26116 c
26117
26118 d
26119
26120 e
26121
26122
26123
26124 f
26125 !! end
26126
26127 !! test
26128 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
26129 !! options
26130 parsoid=html2wt
26131 !! html/parsoid
26132 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
26133 !! wikitext
26134 [[Special:BookSources/1234567890|ISBN 1234567895]]
26135 !! end
26136
26137 !! test
26138 Edited RFC links not serializable as RFC links should serialize as extlinks
26139 !! options
26140 parsoid=html2wt
26141 !! html/parsoid
26142 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
26143 !! wikitext
26144 [//tools.ietf.org/html/rfc123 New RFC]
26145 !! end
26146
26147 !! test
26148 Edited PMID links not serializable as PMID links should serialize as extlinks
26149 !! options
26150 parsoid=html2wt
26151 !! html/parsoid
26152 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
26153 !! wikitext
26154 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
26155 !! end
26156
26157 !! test
26158 WTS of autolinks with trailing/surrounding context
26159 !! options
26160 parsoid=html2wt
26161 !! html/parsoid
26162 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
26163 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
26164 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
26165 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
26166 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
26167 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
26168 !! wikitext
26169 http://cscott.net'''foo'''
26170
26171 http://cscott.net<b>foo</b>
26172
26173 '''http://cscott.net'''
26174
26175 '''http://cscott.net '''
26176
26177 '''http://cscott.net<nowiki/>x'''
26178
26179 http://cscott.net<nowiki/>x
26180 !! end
26181
26182 !! test
26183 WTS of autolinks with nowikis (round-trip)
26184 !! wikitext
26185 x<nowiki/>http://cscott.net<nowiki/>x
26186 !! html/parsoid
26187 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
26188 !! end
26189
26190 # this is the "easy" test because it leaves in place all the
26191 # data-parsoid information indicating this is an autolink
26192 !! test
26193 WTS of autolinks with escapes (editing)
26194 !! options
26195 parsoid={
26196 "modes": ["wt2wt"],
26197 "changes": [
26198 [ "meta", "remove" ]
26199 ]
26200 }
26201 !! wikitext
26202 x<nowiki/>http://cscott.net<nowiki/>x
26203 !! wikitext/edited
26204 x<nowiki/>http://cscott.net<nowiki/>x
26205 !! end
26206
26207 !! test
26208 WTS of edited autolink-like text (T103364)
26209 !! options
26210 parsoid={
26211 "modes": ["wt2wt"],
26212 "changes": [
26213 [ "span[typeof]", "removeAttr", "typeof" ]
26214 ]
26215 }
26216 !! wikitext
26217 Not a link: <nowiki>http://example.com</nowiki>.
26218 !! wikitext/edited
26219 Not a link: <span><nowiki>http://example.com</nowiki></span>.
26220 !! end
26221
26222 !! test
26223 WTS of newly-authored autolink-like text (T103364)
26224 !! options
26225 parsoid=html2wt
26226 !! html/parsoid
26227 <p>http://example.com is not a link.</p>
26228 !! wikitext
26229 <nowiki>http://example.com</nowiki> is not a link.
26230 !! end
26231
26232 !! test
26233 WTS of autolink-like text after an autolink (T108563)
26234 !! options
26235 parsoid=html2wt
26236 !! html/parsoid
26237 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
26238 !! wikitext
26239 http://example.com <nowiki>http://example.com</nowiki> is not a link.
26240 !! end
26241
26242 !! test
26243 Magic links inside links (not autolinked)
26244 !! wikitext
26245 [[Foo|http://example.com]]
26246 [[Foo|RFC 1234]]
26247 [[Foo|PMID 1234]]
26248 [[Foo|ISBN 123456789x]]
26249
26250 [http://foo.com http://example.com]
26251 [http://foo.com RFC 1234]
26252 [http://foo.com PMID 1234]
26253 [http://foo.com ISBN 123456789x]
26254 !! html+tidy
26255 <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>
26256 <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>
26257 !! html/parsoid
26258 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
26259 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
26260 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
26261 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
26262
26263 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
26264 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
26265 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
26266 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
26267 !! end
26268
26269 !! test
26270 Magic links inside image captions (autolinked)
26271 !! wikitext
26272 [[File:Foobar.jpg|thumb|http://example.com]]
26273 [[File:Foobar.jpg|thumb|RFC 1234]]
26274 [[File:Foobar.jpg|thumb|PMID 1234]]
26275 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
26276 !! html+tidy
26277 <div class="thumb tright">
26278 <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>
26279 <div class="thumbcaption">
26280 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26281 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
26282 </div>
26283 </div>
26284 <div class="thumb tright">
26285 <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>
26286 <div class="thumbcaption">
26287 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26288 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
26289 </div>
26290 </div>
26291 <div class="thumb tright">
26292 <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>
26293 <div class="thumbcaption">
26294 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26295 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
26296 </div>
26297 </div>
26298 <div class="thumb tright">
26299 <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>
26300 <div class="thumbcaption">
26301 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
26302 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
26303 </div>
26304 </div>
26305 !! html/parsoid
26306 <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>
26307 <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>
26308 <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>
26309 <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>
26310 !! end
26311
26312 !! test
26313 WTS of magic word text (T109371)
26314 !! options
26315 parsoid=html2wt
26316 !! html/parsoid
26317 <p>RFC 1234</p>
26318 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
26319 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
26320 !! wikitext
26321 <nowiki>RFC 1234</nowiki>
26322
26323 [http://foo.com RFC 1234]
26324
26325 [[Foo|RFC 1234]]
26326 !! end
26327
26328 !! test
26329 Edited Redirect link should emit a non-piped wikitext link
26330 !! options
26331 parsoid=html2wt
26332 !! html/parsoid
26333 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
26334 !! wikitext
26335 #REDIRECT [[Bar]]
26336 !! end
26337
26338 !! test
26339 T75121: Infer extension name from typeOf if data-mw is not present
26340 !! options
26341 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26342 !! html/parsoid
26343 <div typeOf="mw:Extension/foo"></div>
26344 !! wikitext
26345 <foo />
26346 !! end
26347
26348 # Note that the <p> wrapping isn't present in PHP parser output
26349 # The important thing for this test is that P-wrapping doesn't
26350 # interfere with the <nowiki> protection for leading - in <td>
26351 # (which isn't necessary for <th>).
26352 !! test
26353 T88318: p-wrapped dash in table.
26354 !! options
26355 parsoid=html2wt,wt2wt
26356 !! html/parsoid
26357 <table><tbody>
26358 <tr><th><p>-</p></th><th><p>- </p></th></tr>
26359 <tr><td><p>-</p></td><td><p>- </p></td></tr>
26360 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
26361 </tbody></table>
26362 !! wikitext
26363 {|
26364 !-
26365 !-
26366 |-
26367 |<nowiki>-</nowiki>
26368 |<nowiki>- </nowiki>
26369 |-
26370 |<small>-</small>
26371 |<br>
26372 -
26373 |<br>
26374 -
26375 |}
26376 !! html/php+tidy
26377 <table>
26378 <tr>
26379 <th>-</th>
26380 <th>-</th>
26381 </tr>
26382 <tr>
26383 <td>-</td>
26384 <td>-</td>
26385 </tr>
26386 <tr>
26387 <td><small>-</small></td>
26388 <td><br />
26389 <p>-</p>
26390 </td>
26391 <td><br />
26392 <p>-</p>
26393 </td>
26394 </tr>
26395 </table>
26396 !! end
26397
26398 !! test
26399 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
26400 !! options
26401 parsoid=html2wt
26402 !! html/parsoid
26403 <table id='mwAb'>
26404 <td id='mwAc'>foo</td>
26405 <td id='serialize-this'>bar</td>
26406 </table>
26407 !! wikitext
26408 {|
26409 |foo
26410 | id="serialize-this" |bar
26411 |}
26412 !! end
26413
26414 !! test
26415 Parsoid-like element ids should not be serialized to wikitext unless shadowed
26416 !! options
26417 parsoid=html2wt
26418 !! html/parsoid
26419 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
26420 !! wikitext
26421 <div id="hello">ok</div>
26422 !! end
26423
26424 !! test
26425 WTS change modes
26426 !! options
26427 parsoid={
26428 "modes": ["wt2wt"],
26429 "changes": [
26430 [ "#xyz", "before", "<b>before</b> stuff " ],
26431 [ "#xyz", "after", " stuff <i>after</i>" ],
26432 [ "#xyz", "html", "x <b>y</b> z" ]
26433 ]
26434 }
26435 !! wikitext
26436 <span id="xyz">hello</span>
26437 !! wikitext/edited
26438 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
26439 !! end
26440
26441 !! test
26442 Never serialize a-tag as html, regardless of what data-parsoid has to say
26443 !! options
26444 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26445 !! html/parsoid
26446 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
26447 !! wikitext
26448 [[Foo]]
26449 !! end
26450
26451 ## SSS FIXME: This is broken output nevertheless.
26452 ## What might be a reasonable non-broken output for this?
26453 ## This is an edge case unlikely to be seen in production
26454 ## that I am not wasting more time on this right now.
26455 !! test
26456 Never serialize a-tag as html, no matter what attributes it has
26457 !! options
26458 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
26459 !! html/parsoid
26460 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
26461 !! wikitext
26462 [http://boo.org http://boohoo.org]
26463 !! end
26464
26465 # Misnested is an indication that selser can reuse the source but these have
26466 # shown to sneak through on occasion. See T101768.
26467 # The original wikitext here is: [http://test.com [[one]] two three]
26468 !! test
26469 Strip span tags added to mark misnested links
26470 !! options
26471 parsoid=html2wt
26472 !! html/parsoid
26473 <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>
26474 !! wikitext
26475 [http://test.com][[one]] two three
26476 !! end
26477
26478 !! test
26479 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
26480 !! options
26481 parsoid=html2wt
26482 !! html/parsoid
26483 <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|}"]}'>
26484 <tbody><tr><td>d
26485 </td></tr>
26486 </tbody></table>
26487 !! wikitext
26488 {{echo|a}}
26489 {|{{echo|c
26490 {{!}}d
26491 }}
26492 |}
26493 !! end
26494
26495 ## This test verifies the presence and computation of this attribute indirectly
26496 ## by making an edit and ensuring that the serialization is correct (which it would be
26497 ## only if firstWikitextNode is properly set).
26498 !! test
26499 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
26500 !! options
26501 parsoid= {
26502 "modes": ["wt2wt"],
26503 "changes": [
26504 [ "div#x", "remove" ],
26505 [ "div", "before", "<div>new</div>" ]
26506 ]
26507 }
26508 !! wikitext
26509 <div id="x">foo</div>
26510 {|
26511 {{echo|<div>boo</div>
26512 {{!}}b}}
26513 |c
26514 |}
26515 !! wikitext/edited
26516
26517 <div>new</div>
26518 {|
26519 {{echo|<div>boo</div>
26520 {{!}}b}}
26521 |c
26522 |}
26523 !! end
26524
26525 # --------------------------------------------
26526 # Tests spec'ing wikitext serialization norms |
26527 # --------------------------------------------
26528
26529 !! test
26530 1. Categories should always be serialized on their own line
26531 !! options
26532 parsoid=html2wt
26533 !! html/parsoid
26534 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
26535 !! wikitext
26536 foo
26537 [[Category:Foo]]
26538 bar
26539 !! end
26540
26541 !! test
26542 2. Categories that are part of templates should not introduce a line break
26543 !! wikitext
26544 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
26545 !! html/parsoid
26546 <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>
26547 !! end
26548
26549 # Careful while editing these next 2 tests. There are \u200f characters
26550 # before and after the <link> tags in the HTML and following some
26551 # of the categories in wikitext
26552 # Do not remove these characters in edits.
26553 #
26554 # As part of the serialization, these bidi characters will get stripped.
26555 !! test
26556 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
26557 !! options
26558 parsoid={
26559 "modes": ["html2wt"],
26560 "scrubWikitext": true
26561 }
26562 !! html/parsoid
26563 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
26564 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
26565 !! wikitext
26566 [[קטגוריה:טקסים]]
26567 [[קטגוריה: שיטות משפט]]
26568 !! end
26569
26570 !! test
26571 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
26572 !! options
26573 parsoid={
26574 "modes": ["html2wt"],
26575 "scrubWikitext": true
26576 }
26577 !! html/parsoid
26578 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
26579 !! wikitext
26580 [[קטגוריה:טקסים]]
26581 ‏y
26582 !! end
26583
26584 !! test
26585 Lists: Add space after bullets
26586 !! options
26587 parsoid=html2wt
26588 !! html/parsoid
26589 <ul>
26590 <li>foo</li>
26591 <li> bar</li>
26592 <li><span> baz</span></li>
26593 </ul>
26594 !! wikitext
26595 * foo
26596 * bar
26597 * <span> baz</span>
26598 !! end
26599
26600 !! test
26601 1. Headings: Add space before/after == (T53744)
26602 !! options
26603 parsoid=html2wt
26604 !! html/parsoid
26605 <h2>foo</h2>
26606 <h2> bar</h2>
26607 <h2>baz </h2>
26608 <h2><span> baz</span></h2>
26609 !! wikitext
26610 == foo ==
26611
26612 == bar ==
26613
26614 == baz ==
26615
26616 == <span> baz</span> ==
26617 !! end
26618
26619 !! test
26620 2. Headings: Add space before/after == even after hoisted content
26621 !! options
26622 parsoid={
26623 "modes": ["html2wt"],
26624 "scrubWikitext": true
26625 }
26626 !! html/parsoid
26627 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
26628 !! wikitext
26629 [[Category:A2]]
26630
26631 == ok ==
26632 !! end
26633
26634 !! test
26635 1. Headings: suppress newly created empty headings
26636 !! options
26637 parsoid={
26638 "modes": ["html2wt"],
26639 "scrubWikitext": true
26640 }
26641 !! html/parsoid
26642 <h2></h2>
26643 !! wikitext
26644 !! end
26645
26646 !! test
26647 2. Headings: don't suppress empty headings if scrubWikitext is false
26648 !! options
26649 parsoid=html2wt
26650 !! html/parsoid
26651 <h2></h2>
26652 !! wikitext
26653 ==<nowiki/>==
26654 !! end
26655
26656 !! test
26657 3. Headings: suppress empty headings on edits
26658 !! options
26659 parsoid={
26660 "modes": ["selser"],
26661 "scrubWikitext": true,
26662 "changes": [
26663 [ "#x", "remove"]
26664 ]
26665 }
26666 !! wikitext
26667 ==<span id="x">foo</span>==
26668 !! wikitext/edited
26669 !! end
26670
26671 !! test
26672 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
26673 !! options
26674 parsoid={
26675 "modes": ["html2wt"],
26676 "scrubWikitext": true
26677 }
26678 !! html/parsoid
26679 <h2>foo<br/>bar</h2>
26680 <h2>foo <span><br/>bar</span> baz</h2>
26681 !! wikitext
26682 == foo bar ==
26683
26684 == foo <span> bar</span> baz ==
26685 !! end
26686
26687 !! test
26688 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
26689 !! options
26690 parsoid={
26691 "modes": ["html2wt"],
26692 "scrubWikitext": false
26693 }
26694 !! html/parsoid
26695 <h2>foo<br/>bar</h2>
26696 !! wikitext
26697 == foo<br> bar ==
26698 !! end
26699
26700 !! test
26701 1. WT Quote Tags: suppress newly created empty style tags
26702 !! options
26703 parsoid={
26704 "modes": ["html2wt"],
26705 "scrubWikitext": true
26706 }
26707 !! html/parsoid
26708 <i></i><b></b>
26709 !! wikitext
26710 !! end
26711
26712 !! test
26713 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
26714 !! options
26715 parsoid=html2wt
26716 !! html/parsoid
26717 <i></i><b></b>
26718 !! wikitext
26719 ''<nowiki/>'''''<nowiki/>'''
26720 !! end
26721
26722 !! test
26723 3. WT Quote Tags: suppress empty style tags on edits
26724 !! options
26725 parsoid={
26726 "modes": ["selser"],
26727 "scrubWikitext": true,
26728 "changes": [
26729 [ "#x", "remove"]
26730 ]
26731 }
26732 !! wikitext
26733 '''<span id="x">foo</span>'''
26734 !! wikitext/edited
26735 !! end
26736
26737 !! test
26738 1. Anchors: suppress newly created empty anchors
26739 !! options
26740 parsoid={
26741 "modes": ["html2wt"],
26742 "scrubWikitext": true
26743 }
26744 !! html/parsoid
26745 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26746 !! wikitext
26747 !! end
26748
26749 !! test
26750 2. Anchors: don't suppress empty anchors if scrubWikitext is false
26751 !! options
26752 parsoid={
26753 "modes": ["html2wt"],
26754 "scrubWikitext": false
26755 }
26756 !! html/parsoid
26757 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26758 !! wikitext
26759 [[Test|<nowiki/>]]
26760 !! end
26761
26762 !! test
26763 3. Anchors: suppress empty anchors on edits
26764 !! options
26765 parsoid={
26766 "modes": ["selser"],
26767 "scrubWikitext": true,
26768 "changes": [
26769 [ "#x", "remove"]
26770 ]
26771 }
26772 !! wikitext
26773 [[Test|<span id="x">foo</span>]]
26774 !! wikitext/edited
26775 !! end
26776
26777 !! test
26778 3a. Anchors: do not suppress numbered extlinks
26779 !! options
26780 parsoid={
26781 "modes": ["wt2wt"],
26782 "scrubWikitext": true
26783 }
26784 !! wikitext
26785 [http://foo.com]
26786 !! html/parsoid
26787 <a rel="mw:ExtLink" href="http://foo.com"></a>
26788 !! end
26789
26790 !! test
26791 3b. Anchors: do not suppress numbered extlinks
26792 !! options
26793 parsoid={
26794 "modes": ["wt2wt"],
26795 "scrubWikitext": true,
26796 "changes": [
26797 [ "#x", "remove"]
26798 ]
26799 }
26800 !! wikitext
26801 [http://foo.com <span id="x">foo</span>]
26802 !! wikitext/edited
26803 [http://foo.com]
26804 !! end
26805
26806 !!test
26807 Normalizations should be restricted to edited content
26808 !!options
26809 parsoid={
26810 "modes": ["selser"],
26811 "scrubWikitext": true,
26812 "changes": [
26813 [ "h1", "before", "<i></i>"]
26814 ]
26815 }
26816 !!wikitext
26817 a
26818 = =
26819 b
26820 !!wikitext/edited
26821 a
26822 = =
26823 b
26824 !!end
26825
26826 !! test
26827 1. Multiple normalizations (html2wt)
26828 !! options
26829 parsoid={
26830 "modes": ["html2wt"],
26831 "scrubWikitext": true
26832 }
26833 !! html
26834 <h2><i></i></h2>
26835 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
26836 </a><b><i></i></b>x</p>
26837 !! wikitext
26838
26839 [[foo]]
26840 x
26841
26842 !! end
26843
26844 !! test
26845 2. Multiple normalizations (selser)
26846 !! options
26847 parsoid={
26848 "modes": ["selser"],
26849 "scrubWikitext": true,
26850 "changes": [
26851 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
26852 ]
26853 }
26854 !! wikitext
26855 <span id="x">foo</span>
26856 !! wikitext/edited
26857 <span id="x">foo</span>
26858
26859 x
26860 !! end
26861
26862 !! test
26863 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
26864 !! options
26865 parsoid={
26866 "modes": ["html2wt"],
26867 "scrubWikitext": true
26868 }
26869 !! html/parsoid
26870 <p> hi</p>
26871 <p> hello</p>
26872 !! wikitext
26873 hi
26874
26875 hello
26876 !! end
26877
26878 !! test
26879 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
26880 !! options
26881 parsoid=html2wt
26882 !! html/parsoid
26883 <p> hi</p>
26884 <p> hello</p>
26885 !! wikitext
26886 <nowiki> </nowiki>hi
26887
26888 <nowiki> </nowiki> hello
26889 !! end
26890
26891 !! test
26892 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
26893 !! options
26894 parsoid={
26895 "modes": ["html2wt"],
26896 "scrubWikitext": true
26897 }
26898 !! html/parsoid
26899 <p>Foo
26900 bar
26901 baz</p>
26902
26903 <table><tr><td>Foo
26904 bar
26905 baz bang</td></tr></table>
26906
26907 <p><!--boo--> foo
26908 bar</p>
26909
26910 <p> foo
26911 bar<span>boo</span></p>
26912 !! wikitext
26913 Foo
26914 bar
26915 baz
26916
26917 {|
26918 |Foo
26919 bar
26920 baz bang
26921 |}
26922
26923 <!--boo-->foo
26924 bar
26925
26926 foo
26927 bar<span>boo</span>
26928 !! end
26929
26930 !! test
26931 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
26932 !! options
26933 parsoid={
26934 "modes": ["selser"],
26935 "scrubWikitext": true,
26936 "changes": [
26937 [ "p", "html", " a\n b" ]
26938 ]
26939 }
26940 !! wikitext
26941 xyz
26942 !! wikitext/edited
26943 a
26944 b
26945 !! end
26946
26947 !! test
26948 1. New links that end in spaces
26949 !! options
26950 parsoid={
26951 "modes": ["html2wt"],
26952 "scrubWikitext": false
26953 }
26954 !! html/parsoid
26955 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26956 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26957 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26958 !! wikitext
26959 [[Berlin ]]<nowiki/>is the capital of Germany.
26960
26961 [[Foo ]]'''bar'''
26962
26963 [[Boston ]] is a city.
26964 !! end
26965
26966 !! test
26967 2. New links that end in spaces
26968 !! options
26969 parsoid={
26970 "modes": ["html2wt"],
26971 "scrubWikitext": true
26972 }
26973 !! html/parsoid
26974 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26975 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26976 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26977 !! wikitext
26978 [[Berlin]] is the capital of Germany.
26979
26980 [[Foo]] '''bar'''
26981
26982 [[Boston]] is a city.
26983 !! end
26984
26985 !! test
26986 1. Table cells with escapable prefixes
26987 !! options
26988 parsoid={
26989 "modes": ["html2wt"],
26990 "scrubWikitext": false
26991 }
26992 !! html
26993 <table>
26994 <tr><td>a</td></tr>
26995 <tr><td>-</td></tr>
26996 <tr><td>+</td></tr>
26997 </table>
26998 !! wikitext
26999 {|
27000 |a
27001 |-
27002 |<nowiki>-</nowiki>
27003 |-
27004 |<nowiki>+</nowiki>
27005 |}
27006 !! end
27007
27008 !! test
27009 2. Table cells with escapable prefixes
27010 !! options
27011 parsoid={
27012 "modes": ["html2wt"],
27013 "scrubWikitext": true
27014 }
27015 !! html
27016 <table>
27017 <tr><td>a</td></tr>
27018 <tr><td>-</td></tr>
27019 <tr><td>+</td></tr>
27020 </table>
27021 !! wikitext
27022 {|
27023 |a
27024 |-
27025 | -
27026 |-
27027 | +
27028 |}
27029 !! end
27030
27031 !! test
27032 3a. Table cells with escapable prefixes after edits
27033 !! options
27034 parsoid={
27035 "modes": ["selser"],
27036 "scrubWikitext": true,
27037 "changes": [
27038 [ "table tbody tr:first-child td:first-child", "remove"]
27039 ]
27040 }
27041 !! wikitext
27042 {|
27043 |a||-
27044 |}
27045 !! wikitext/edited
27046 {|
27047 | -
27048 |}
27049 !! end
27050
27051 !! test
27052 3b. Table cells with escapable prefixes after edits
27053 !! options
27054 parsoid={
27055 "modes": ["selser"],
27056 "scrubWikitext": true,
27057 "changes": [
27058 [ "table tbody tr:first-child td:first-child", "html", "-" ],
27059 [ "#x", "remove" ]
27060 ]
27061 }
27062 !! wikitext
27063 {|
27064 |pqr
27065 |<span id="x">foo</span>+
27066 |}
27067 !! wikitext/edited
27068 {|
27069 | -
27070 | +
27071 |}
27072 !! end
27073
27074 # FIXME: This test will fail because
27075 # normalization doesn't realize that the id attribute
27076 # will eliminate the escapable scenario
27077 !! test
27078 4a. Table cells without escapable prefixes after edits
27079 !! options
27080 parsoid={
27081 "modes": ["selser"],
27082 "scrubWikitext": true,
27083 "changes": [
27084 [ "#x", "html", "-" ]
27085 ]
27086 }
27087 !! wikitext
27088 {|
27089 | id="x" |abcd
27090 |}
27091 !! wikitext/edited
27092 {|
27093 | id="x" |-
27094 |}
27095 !! end
27096
27097 ## This tests normalizer's ability to discriminate between
27098 ## cells having identical content.
27099 !! test
27100 4b. Table cells without escapable prefixes after edits
27101 !! options
27102 parsoid={
27103 "modes": ["selser"],
27104 "scrubWikitext": true,
27105 "changes": [
27106 [ "td", "html", "-" ]
27107 ]
27108 }
27109 !! wikitext
27110 {|
27111 |a||b
27112 |}
27113 !! wikitext/edited
27114 {|
27115 | -||-
27116 |}
27117 !! end
27118
27119 ## This tests normalizer's ability to not be tripped by
27120 ## comments (and whitespace)
27121 !! test
27122 4c. Table cells without escapable prefixes after edits
27123 !! options
27124 parsoid={
27125 "modes": ["selser"],
27126 "scrubWikitext": true,
27127 "changes": [
27128 [ "table tbody tr td:first-child", "remove" ]
27129 ]
27130 }
27131 !! wikitext
27132 {|
27133 |-
27134 <!--foo--> |a||-
27135 |}
27136 !! wikitext/edited
27137 {|
27138 |-
27139 <!--foo--> | -
27140 |}
27141 !! end
27142
27143 ## This tests normalizer's ability to handle HTML cells
27144 !! test
27145 4d. Table cells without escapable prefixes after edits
27146 !! options
27147 parsoid={
27148 "modes": ["selser"],
27149 "scrubWikitext": true,
27150 "changes": [
27151 [ "td", "html", "-" ]
27152 ]
27153 }
27154 !! wikitext
27155 <table>
27156 <tr><td>a</td></tr>
27157 </table>
27158 !! wikitext/edited
27159 <table>
27160 <tr><td>-</td></tr>
27161 </table>
27162 !! end
27163
27164 ## T111151 Remove font elements without attributes
27165 !! test
27166 5a. font tags without attributes should be dropped in scrubWikitext mode
27167 !! options
27168 parsoid={
27169 "modes": ["html2wt"],
27170 "scrubWikitext": true
27171 }
27172 !! html
27173 <font>foo</font>
27174 <font><font>bar</font></font>
27175 <font class="x">boo</font>
27176 !! wikitext
27177 foo
27178 bar
27179 <font class="x">boo</font>
27180 !! end
27181
27182 !! test
27183 5b. font tags should not be dropped without scrubWikitext being enabled
27184 !! options
27185 parsoid={
27186 "modes": ["html2wt"],
27187 "scrubWikitext": false
27188 }
27189 !! html
27190 <font>foo</font>
27191 !! wikitext
27192 <font>foo</font>
27193 !! end
27194
27195 !! test
27196 Escape nowiki DOM elements
27197 !! options
27198 parsoid=html2wt
27199 !! html/parsoid
27200 <nowiki><i>foo</i></nowiki>
27201 !! wikitext
27202 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
27203 !! end
27204
27205 # This is meant to be an interim fix while we go about figuring out
27206 # how to not introduce these trailing <nowiki/>s in the first place.
27207 !! test
27208 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
27209 !! options
27210 parsoid=html2wt
27211 !! html/parsoid
27212 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
27213 y</p>
27214 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","named":true,"spc":["\n"," "," ",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;nowiki/>"}},"i":0}}]}'></span></p>
27215 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","named":true,"spc":["\n"," "," ","\n"]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;nowiki/>"}},"i":0}}]}'></span></p>
27216 !! wikitext
27217 x
27218 y
27219
27220 {{echo|
27221 1 = <nowiki/>}}
27222
27223 {{echo|
27224 1 = <nowiki/>
27225 }}
27226 !! end
27227
27228 # ---------------------------------------------------
27229 # End of tests spec'ing wikitext serialization norms |
27230 # ---------------------------------------------------
27231
27232 # T104032
27233 !! test
27234 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
27235 !! options
27236 parsoid=html2wt
27237 !! html/parsoid
27238 a<p>b</p>
27239 <b>c</b><p>d</p>
27240 <table><tr>
27241 <td>a<p>b</p></td>
27242 <td><b>c</b><p>d</p></td>
27243 </tr></table>
27244 !! wikitext
27245 a
27246
27247 b
27248
27249 '''c'''
27250
27251 d
27252 {|
27253 |a
27254 b
27255 |'''c'''
27256 d
27257 |}
27258 !! end
27259
27260 # -----------------------------------------------------------------
27261 # End of section for Parsoid-only html2wt tests for serialization
27262 # of new content
27263 # -----------------------------------------------------------------
27264
27265 # -----------------------------------------------------------------
27266 # The following section of tests are primarily to spec behavior of
27267 # the selective serializer. All these tests have manual selser
27268 # changes. The automated selser changes for all tests handle the
27269 # wide variation of changes, but these tests here capture specs
27270 # deterministically.
27271 # ----------------------------------------------------------------
27272
27273 ## T90517
27274 !! test
27275 Selser: New comments should not be lost
27276 !! options
27277 parsoid={
27278 "modes": ["selser"],
27279 "changes": [
27280 [ "#a", "after", "<!--c1-->" ],
27281 [ "#b", "before", "<!--c2-->" ]
27282 ]
27283 }
27284 !! wikitext
27285 <span id="a">a</span>
27286
27287 <span id="b">b</span>
27288 !! wikitext/edited
27289 <span id="a">a</span><!--c1-->
27290
27291 <!--c2--><span id="b">b</span>
27292 !! end
27293
27294 ## T89383
27295 !! test
27296 Selser: Check for validity of DSR before using it
27297 !! options
27298 parsoid={
27299 "modes": ["selser"],
27300 "changes": [
27301 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
27302 ]
27303 }
27304 !! wikitext
27305 <span id="a">a</span>
27306 !! wikitext/edited
27307 {{DISPLAYTITLE:foo}}
27308 <span id="a">a</span>
27309 !! end
27310
27311 !! test
27312 1. DOMDiff: Changes to <ref> content should be looked up using id
27313 !! options
27314 parsoid={
27315 "modes": ["selser"],
27316 "changes": [
27317 ["#X", "after", "bar"],
27318 ["#Y", "after", "baz"]
27319 ]
27320 }
27321 !! wikitext
27322 X <ref><span id="X">foo</span></ref>
27323 Y <ref name="a" />
27324 <references>
27325 <ref name="a"><span id="Y">foo</span></ref>
27326 </references>
27327 !! wikitext/edited
27328 X <ref><span id="X">foo</span>bar</ref>
27329 Y <ref name="a" />
27330 <references>
27331 <ref name="a"><span id="Y">foo</span>baz</ref>
27332 </references>
27333 !! end
27334
27335 !! test
27336 2. DOMDiff: Changes to <ref> content should be looked up using id
27337 !! options
27338 parsoid={
27339 "modes": ["selser"],
27340 "changes": [
27341 ["#Z", "after", "bar"]
27342 ]
27343 }
27344 !! wikitext
27345 A <ref>foo bar for a</ref>
27346 B <ref group="X" name="b" />
27347
27348 <references />
27349
27350 <references group="X">
27351 <ref name="b"><span id="Z">foo</span></ref>
27352 </references>
27353 !! wikitext/edited
27354 A <ref>foo bar for a</ref>
27355 B <ref group="X" name="b" />
27356
27357 <references />
27358
27359 <references group="X">
27360 <ref name="b"><span id="Z">foo</span>bar</ref>
27361 </references>
27362 !! end
27363
27364 !! test
27365 DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
27366 !! options
27367 parsoid={
27368 "modes": ["selser"],
27369 "changes": [
27370 [ "div:first-child", "text", "bar" ]
27371 ]
27372 }
27373 !! wikitext
27374 <div style="{{1x|color:red;}}%">foo</div>
27375 !! wikitext/edited
27376 <div style="{{1x|color:red;}}%">bar</div>
27377 !! end
27378
27379 !! test
27380 Empty LI (T49673)
27381 !! wikitext
27382 * a
27383 *
27384 *
27385 * b
27386 !! html/php+tidy
27387 <ul>
27388 <li>a</li>
27389 <li class="mw-empty-elt"></li>
27390 <li class="mw-empty-elt"></li>
27391 <li>b</li>
27392 </ul>
27393 !! end
27394
27395 !! test
27396 Thumbnail output
27397 !! wikitext
27398 [[File:Thumb.png|thumb]]
27399 !! html/php+tidy
27400 <div class="thumb tright">
27401 <div class="thumbinner" style="width:137px;"><a href="/wiki/File:Thumb.png" class="image"><img alt="Thumb.png" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a>
27402 <div class="thumbcaption">
27403 <div class="magnify"><a href="/wiki/File:Thumb.png" class="internal" title="Enlarge"></a></div>
27404 </div>
27405 </div>
27406 </div>
27407 !! end
27408
27409 !! test
27410 unclosed internal link XSS (T137264)
27411 !! wikitext
27412 [[#%3Cscript%3Ealert(1)%3C/script%3E|
27413 !! html/php
27414 <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
27415 </p>
27416 !! html/parsoid
27417 <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
27418 !! end