Merge "Handle static access in TestingAccessWrapper"
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # (ignored by Parsoid, since it emits <link>s)
18 # ill add inter-language links
19 # (ignored by Parsoid, since it emits <link>s)
20 # subpage enable subpages (disabled by default)
21 # noxml don't check for XML well-formedness
22 # title=[[XXX]] run test using article title XXX
23 # language=XXX set content language to XXX for this test
24 # variant=XXX set the variant of language for this test (eg zh-tw)
25 # disabled do not run test
26 # parsoid parsoid-specific options (not run by PHP parser unless
27 # the test includes an html/php section)
28 # php php-only test (not run by the parsoid parser unless
29 # the test includes an html/parsoid section)
30 # showtitle make the first line the title
31 # showindicators make the first lines the page status indicators
32 # comment run through Linker::formatComment() instead of main parser
33 # local format section links in edit comment text as local links
34 # notoc disable table of contents
35 # thumbsize=NNN set the default thumb size to NNNpx for this test
36 #
37 # You can also set the following parser properties via test options:
38 # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
39 # wgLinkHolderBatchSize, wgRawHtml
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 (http://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 # http://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: http://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 nowiki 3
1425 !! wikitext
1426 :There is not nowiki.
1427 :There is <nowiki>nowiki</nowiki>.
1428
1429 #There is not nowiki.
1430 #There is <nowiki>nowiki</nowiki>.
1431
1432 *There is not nowiki.
1433 *There is <nowiki>nowiki</nowiki>.
1434 !! html/php
1435 <dl><dd>There is not nowiki.</dd>
1436 <dd>There is nowiki.</dd></dl>
1437 <ol><li>There is not nowiki.</li>
1438 <li>There is nowiki.</li></ol>
1439 <ul><li>There is not nowiki.</li>
1440 <li>There is nowiki.</li></ul>
1441
1442 !! html/parsoid
1443 <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
1444 <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
1445
1446 <ol><li data-parsoid='{}'>There is not nowiki.</li>
1447 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
1448
1449 <ul><li data-parsoid='{}'>There is not nowiki.</li>
1450 <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
1451 !! end
1452
1453 !! test
1454 Entities inside <nowiki>
1455 !! wikitext
1456 <nowiki>&lt;</nowiki>
1457 !! html
1458 <p>&lt;
1459 </p>
1460 !! end
1461
1462 !! test
1463 Entities inside template parameters
1464 !! wikitext
1465 {{echo|&ndash;}}
1466 !! html/php+tidy
1467 <p>–</p>
1468 !! html/parsoid
1469 <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>
1470 !! end
1471
1472 !! test
1473 Properly escape nowiki when combined with other wiki markup
1474 !! options
1475 parsoid=html2wt
1476 !! html/parsoid
1477 <p>* &lt;/nowiki&gt; tag</p>
1478 !! wikitext
1479 <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
1480 !! end
1481
1482 !! test
1483 T93824: Put escaped HTML tags inside nowiki
1484 !! options
1485 parsoid=html2wt
1486 !! html/parsoid
1487 <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
1488 !! wikitext
1489 <nowiki><h2>foo</h2></nowiki>
1490 !! end
1491
1492 !! test
1493 T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
1494 !! options
1495 parsoid=html2wt
1496 !! html/parsoid
1497 <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
1498 This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1499 This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
1500 !! wikitext
1501 This text: L'[[Foo]]
1502 This text: L<nowiki>''</nowiki>[[Foo]]
1503 This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
1504 !! end
1505
1506 # This test fails because wikitext whitespace is not normalized before comparing.
1507 !! test
1508 T71950: 2. Put nowiki as close to cause as possible, after ' :'
1509 !! options
1510 parsoid=html2wt
1511 !! html/parsoid
1512 <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
1513 </p>
1514 !! wikitext
1515 This text : L<nowiki>''</nowiki>[[Foo]]
1516 !! end
1517
1518 # This test and the next one are html2wt only as they test that incorrect wikitext
1519 # passed in template arguments gets escaped or wrapped in nowikis where required.
1520 !! test
1521 T71482: Use {{!}} instead of nowiki for single pipe in template argument
1522 !! options
1523 parsoid=html2wt
1524 !! html/parsoid
1525 <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>
1526 <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>
1527 !! wikitext
1528 {{echo|foo{{!}}bar}}
1529 {{echo|<nowiki>foo|bar |[[</nowiki>}}
1530 !! end
1531
1532 !! test
1533 T53961: Output correct nowikis in template arguments
1534 !! options
1535 parsoid=html2wt
1536 !! html/parsoid
1537 <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>
1538 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }} b&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></span>
1539 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [[ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt3"></span>
1540 <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a | {{ ]]&quot;}},&quot;i&quot;:0}}]}" about="#mwt4"></span>
1541 <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>
1542 !! wikitext
1543 {{echo|a [ b}}
1544 {{echo|a <nowiki>}}</nowiki> b}}
1545 {{echo|<nowiki>a [[ b</nowiki>}}
1546 {{echo|a {{!}} <nowiki>{{ ]]</nowiki>}}
1547 {{echo|a <nowiki>}</nowiki>}}
1548 !! end
1549
1550 !! test
1551 Cases where "!!" needs nowiki protection
1552 !! options
1553 parsoid=html2wt
1554 !! html/parsoid
1555 <table>
1556 <tr><th>this needs protection !! here</th></tr>
1557 </table>
1558
1559 <table>
1560 <tr><th>this does not need
1561 protection !! here</th></tr>
1562 </table>
1563 !! wikitext
1564 {|
1565 !<nowiki>this needs protection !! here</nowiki>
1566 |}
1567
1568 {|
1569 !this does not need
1570 protection !! here
1571 |}
1572 !! end
1573
1574 ###
1575 ### Comments
1576 ###
1577 !! test
1578 Comments and Indent-Pre
1579 !! wikitext
1580 <!-- comment 1 --> asdf
1581
1582 <!-- comment 1 --> asdf
1583 <!-- comment 2 -->
1584
1585 <!-- comment 1 --> asdf
1586 <!-- comment 2 -->xyz
1587
1588 <!-- comment 1 --> asdf
1589 <!-- comment 2 --> xyz
1590 !! html
1591 <pre>asdf
1592 </pre>
1593 <pre>asdf
1594 </pre>
1595 <pre>asdf
1596 </pre>
1597 <p>xyz
1598 </p>
1599 <pre>asdf
1600 xyz
1601 </pre>
1602 !! end
1603
1604 !! test
1605 Comment test 2a
1606 !! wikitext
1607 asdf
1608 <!-- comment 1 -->
1609 jkl
1610 !! html
1611 <p>asdf
1612 jkl
1613 </p>
1614 !! end
1615
1616 !! test
1617 Comment test 2b
1618 !! wikitext
1619 asdf
1620 <!-- comment 1 -->
1621
1622 jkl
1623 !! html
1624 <p>asdf
1625 </p><p>jkl
1626 </p>
1627 !! end
1628
1629 !! test
1630 Comment test 3
1631 !! wikitext
1632 asdf
1633 <!-- comment 1 -->
1634 <!-- comment 2 -->
1635 jkl
1636 !! html
1637 <p>asdf
1638 jkl
1639 </p>
1640 !! end
1641
1642 !! test
1643 Comment test 4
1644 !! wikitext
1645 asdf<!-- comment 1 -->jkl
1646 !! html
1647 <p>asdfjkl
1648 </p>
1649 !! end
1650
1651 !! test
1652 Comment spacing
1653 !! wikitext
1654 a
1655 <!-- foo --> b <!-- bar -->
1656 c
1657 !! html
1658 <p>a
1659 </p>
1660 <pre> b
1661 </pre>
1662 <p>c
1663 </p>
1664 !! end
1665
1666 !! test
1667 Comment whitespace
1668 !! wikitext
1669 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
1670 !! html
1671
1672 !! end
1673
1674 !! test
1675 Comment semantics and delimiters
1676 !! wikitext
1677 <!-- --><!----><!-----><!------>
1678 !! html/php
1679
1680 !! html/parsoid
1681 <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
1682 !! end
1683
1684 !! test
1685 Comment semantics and delimiters, redux
1686 !! wikitext
1687 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
1688 -- foo -- funky huh? ... -->
1689 !! html/php
1690
1691 !! html/parsoid
1692 <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
1693 &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
1694 !! end
1695
1696 !! test
1697 Comment semantics and delimiters: directors cut
1698 !! wikitext
1699 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
1700 everything starting with < followed by !-- until the first -- and > we see,
1701 that wouldn't be valid XML however, since in XML -- has to terminate a comment
1702 -->-->
1703 !! html/php
1704 <p>--&gt;
1705 </p>
1706 !! html/parsoid
1707 <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
1708 everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
1709 that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
1710 --><p>--></p>
1711 !! end
1712
1713 !! test
1714 Comment semantics: nesting
1715 !! wikitext
1716 <!--<!-- no, we're not going to do anything fancy here -->-->
1717 !! html/php
1718 <p>--&gt;
1719 </p>
1720 !! html/parsoid
1721 <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
1722 !! end
1723
1724 # Parsoid closes the unclosed comment, even if it means a slight
1725 # round-trip diff.
1726 !! test
1727 Comment semantics: unclosed comment at end
1728 !! options
1729 parsoid=wt2html,html2html
1730 !! wikitext
1731 <!--This comment will run out to the end of the document
1732 !! html/php
1733
1734 !! html/parsoid
1735 <!--This comment will run out to the end of the document-->
1736 !! end
1737
1738 !! test
1739 Comment semantics: normalize comments to play nice with XML and browsers
1740 !! wikitext
1741 <!-- Browsers --!> think this is closed -->
1742 <!--> This would normally be text -->
1743 <!---> As would this -->
1744 <!-- XML doesn't like trailing dashes -------->
1745 <!-- Nor doubled hyphens -- anywhere in the data -->
1746 But this is not a comment.
1747 !! html/php
1748 <p>But this is not a comment.
1749 </p>
1750 !! html/parsoid
1751 <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
1752 <!--&#x3E; This would normally be text -->
1753 <!--&#x2D;&#x3E; As would this -->
1754 <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
1755 <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
1756 <p>But this is not a comment.</p>
1757 !! end
1758
1759 !! test
1760 Comment semantics: round-trip even text which contains encoded -->
1761 !! wikitext
1762 <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
1763 !! html/parsoid
1764 <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
1765 !! end
1766
1767 !! test
1768 Comment in template title
1769 !! wikitext
1770 {{f<!---->oo}}
1771 !! html
1772 <p>FOO
1773 </p>
1774 !! end
1775
1776 !! test
1777 Comment on its own line post-expand
1778 !! wikitext
1779 a
1780 {{blank}}<!---->
1781 b
1782 !! html
1783 <p>a
1784 </p><p>b
1785 </p>
1786 !! end
1787
1788 !! test
1789 Comment on its own line post-expand with non-significant whitespace
1790 !! wikitext
1791 a
1792 {{blank}} <!---->
1793 b
1794 !! html
1795 <p>a
1796 </p><p>b
1797 </p>
1798 !! end
1799
1800 !! test
1801 Multiple comments should still parse as SOL-transparent
1802 !! options
1803 parsoid=wt2html,wt2wt
1804 !! wikitext
1805 <!--c1-->*a
1806 <!--c2--><!--c3--><!--c4-->*b
1807 !! html/php
1808 <ul><li>a</li>
1809 <li>b</li></ul>
1810
1811 !! html/parsoid
1812 <!--c1--><ul>
1813 <li>a
1814 </li>
1815 <!--c2--><!--c3--><!--c4-->
1816 <li>b
1817 </li>
1818 </ul>
1819 !! end
1820
1821 ###
1822 ### paragraph wrapping tests
1823 ###
1824 !! test
1825 No block tags
1826 !! wikitext
1827 a
1828
1829 b
1830 !! html
1831 <p>a
1832 </p><p>b
1833 </p>
1834 !! end
1835
1836 !! test
1837 Block tag on one line (<div>)
1838 !! wikitext
1839 a <div>foo</div>
1840
1841 b
1842 !! html
1843 a <div>foo</div>
1844 <p>b
1845 </p>
1846 !! html+tidy
1847 <p>a</p>
1848 <div>foo</div>
1849 <p>b</p>
1850 !! end
1851
1852 !! test
1853 Block tag on one line (<blockquote>)
1854 !! wikitext
1855 a <blockquote>foo</blockquote>
1856
1857 b
1858 !! html
1859 a <blockquote>foo</blockquote>
1860 <p>b
1861 </p>
1862 !! html+tidy
1863 <p>a</p>
1864 <blockquote>
1865 <p>foo</p>
1866 </blockquote>
1867 <p>b</p>
1868 !! end
1869
1870 !! test
1871 Block tag on both lines (<div>)
1872 !! wikitext
1873 a <div>foo</div>
1874
1875 b <div>foo</div>
1876 !! html
1877 a <div>foo</div>
1878 b <div>foo</div>
1879
1880 !! html+tidy
1881 <p>a</p>
1882 <div>foo</div>
1883 <p>b</p>
1884 <div>foo</div>
1885 !! end
1886
1887 !! test
1888 Block tag on both lines (<blockquote>)
1889 !! wikitext
1890 a <blockquote>foo</blockquote>
1891
1892 b <blockquote>foo</blockquote>
1893 !! html
1894 a <blockquote>foo</blockquote>
1895 b <blockquote>foo</blockquote>
1896
1897 !! html+tidy
1898 <p>a</p>
1899 <blockquote>
1900 <p>foo</p>
1901 </blockquote>
1902 <p>b</p>
1903 <blockquote>
1904 <p>foo</p>
1905 </blockquote>
1906 !! end
1907
1908 !! test
1909 Multiple lines without block tags
1910 !! wikitext
1911 <div>foo</div> a
1912 b
1913 c
1914 d<!--foo--> e
1915 x <div>foo</div> z
1916 !! html
1917 <div>foo</div> a
1918 <p>b
1919 c
1920 d e
1921 </p>
1922 x <div>foo</div> z
1923
1924 !! html+tidy
1925 <div>foo</div>
1926 <p>a</p>
1927 <p>b c d e</p>
1928 <p>x</p>
1929 <div>foo</div>
1930 <p>z</p>
1931 !! end
1932
1933 # Tidy strips out the empty <div> tags. Parsoid doesn't.
1934 # So, we have a separate section for Parsoid. We don't want
1935 # to mimic this stripping behavior in Parsoid. It affects
1936 # editing experience and also requires us to maintain additional
1937 # info for RT-ing.
1938 !! test
1939 Empty lines between lines with block tags
1940 !! wikitext
1941 <div></div>
1942
1943
1944 <div></div>a
1945
1946 b
1947 <div>a</div>b
1948
1949 <div>b</div>d
1950
1951
1952 <div>e</div>
1953 !! html
1954 <div></div>
1955 <p><br />
1956 </p>
1957 <div></div>a
1958 <p>b
1959 </p>
1960 <div>a</div>b
1961 <div>b</div>d
1962 <p><br />
1963 </p>
1964 <div>e</div>
1965
1966 !! html+tidy
1967 <p><br /></p>
1968 <p>a</p>
1969 <p>b</p>
1970 <div>a</div>
1971 <p>b</p>
1972 <div>b</div>
1973 <p>d</p>
1974 <p><br /></p>
1975 <div>e</div>
1976 !! html/parsoid
1977 <div data-parsoid='{"stx":"html"}'></div>
1978
1979 <p><br /></p>
1980 <div data-parsoid='{"stx":"html"}'></div><p>a</p>
1981
1982 <p>b</p>
1983 <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
1984
1985 <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
1986
1987 <p><br /></p>
1988 <div data-parsoid='{"stx":"html"}'>e</div>
1989 !! end
1990
1991 ## PHP parser emits output which is broken
1992 !! test
1993 Unclosed HTML p-tags should be handled properly
1994 !! wikitext
1995 <div><p>foo</div>
1996 a
1997
1998 b
1999 !! html/php+tidy
2000 <div>
2001 <p>foo</p>
2002 </div>
2003 <p>a</p>
2004 <p>b</p>
2005 !! html/parsoid
2006 <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
2007 <p>a</p>
2008 <p>b</p>
2009 !! end
2010
2011 ## SSS FIXME: I can come up with other scenarios where this doesn't work because
2012 ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
2013 ## them for now.
2014 !! test
2015 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
2016 !! options
2017 parsoid=wt2html
2018 !! wikitext
2019 a [[Category:A1]] [[Category:A2]]
2020 [[Category:A3]]
2021 [[Category:A4]]
2022 !! html/parsoid
2023 <p>a</p>
2024 <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"/>
2025 !! end
2026
2027 !! test
2028 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
2029 !! options
2030 parsoid=wt2html
2031 !! wikitext
2032 [[Category:A1]]a
2033 !! html/parsoid
2034 <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
2035 !! end
2036
2037 ###
2038 ### Preformatted text
2039 ###
2040 !! test
2041 Preformatted text
2042 !! wikitext
2043 This is some
2044 Preformatted text
2045 With ''italic''
2046 And '''bold'''
2047 And a [[Main Page|link]]
2048 !! html
2049 <pre>This is some
2050 Preformatted text
2051 With <i>italic</i>
2052 And <b>bold</b>
2053 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
2054 </pre>
2055 !! end
2056
2057 !! test
2058 Tabs don't trigger preformatted text
2059 !! wikitext
2060 This is not
2061 preformatted text.
2062 This is preformatted text.
2063 So is this.
2064 !! html/php
2065 <p> This is not
2066 preformatted text.
2067 </p>
2068 <pre>This is preformatted text.
2069 So is this.
2070 </pre>
2071 !! html/parsoid
2072 <p> This is not
2073 preformatted text.</p>
2074 <pre>This is preformatted text.
2075 So is this.</pre>
2076 !! end
2077
2078 !! test
2079 Space before tab needs nowiki pre protection
2080 !! options
2081 parsoid=html2wt
2082 !! html/parsoid
2083 <p> a</p>
2084 !! wikitext
2085 <nowiki> </nowiki> a
2086 !! end
2087
2088 !! test
2089 Ident preformatting with inline content
2090 !! wikitext
2091 a
2092 ''b''
2093 !! html
2094 <pre>a
2095 <i>b</i>
2096 </pre>
2097 !! end
2098
2099 !! test
2100 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
2101 !! wikitext
2102 <pre><nowiki>
2103 <b>
2104 <cite>
2105 <em>
2106 </nowiki></pre>
2107 !! html
2108 <pre>
2109 &lt;b&gt;
2110 &lt;cite&gt;
2111 &lt;em&gt;
2112 </pre>
2113
2114 !! end
2115
2116 !! test
2117 Regression with preformatted in <center>
2118 !! wikitext
2119 <center>
2120 Blah
2121 </center>
2122 !! html
2123 <center>
2124 <pre>Blah
2125 </pre>
2126 </center>
2127
2128 !! end
2129
2130 !! test
2131 Bug 52763: Preformatted in <blockquote>
2132 !! wikitext
2133 <blockquote>
2134 Blah
2135 {|
2136 |
2137 indented cell (no pre-wrapping!)
2138 |}
2139 </blockquote>
2140 !! html
2141 <blockquote>
2142 <p> Blah
2143 </p>
2144 <table>
2145 <tr>
2146 <td>
2147 <p> indented cell (no pre-wrapping!)
2148 </p>
2149 </td></tr></table>
2150 </blockquote>
2151
2152 !! end
2153
2154 !! test
2155 Bug 51086: Double newlines in blockquotes should be turned into paragraphs
2156 !! wikitext
2157 <blockquote>
2158 Foo
2159
2160 Bar
2161 </blockquote>
2162 !! html
2163 <blockquote>
2164 <p>Foo
2165 </p><p>Bar
2166 </p>
2167 </blockquote>
2168
2169 !! end
2170
2171 !! test
2172 Bug 15491: <ins>/<del> in blockquote
2173 !! wikitext
2174 <blockquote>
2175 Foo <del>bar</del> <ins>baz</ins> quux
2176 </blockquote>
2177 !! html
2178 <blockquote>
2179 <p>Foo <del>bar</del> <ins>baz</ins> quux
2180 </p>
2181 </blockquote>
2182
2183 !! end
2184
2185 # Note that the p-wrapping is newline sensitive, which could be
2186 # considered a bug: tidy will wrap only the 'Foo' in the example
2187 # below in a <p> tag. (see comment 23-25 of bug #6200)
2188 !! test
2189 Bug 15491: <ins>/<del> in blockquote (2)
2190 !! wikitext
2191 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2192 </blockquote>
2193 !! html
2194 <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
2195 </blockquote>
2196
2197 !! html+tidy
2198 <blockquote>
2199 <p>Foo</p>
2200 <del>bar</del> <ins>baz</ins> quux</blockquote>
2201 !! end
2202
2203 !! test
2204 <pre> with attributes (bug 3202)
2205 !! wikitext
2206 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2207 !! html
2208 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
2209
2210 !! end
2211
2212 !! test
2213 <pre> with width attribute (bug 3202)
2214 !! wikitext
2215 <pre width="8">Narrow screen goodies</pre>
2216 !! html
2217 <pre width="8">Narrow screen goodies</pre>
2218
2219 !! end
2220
2221 !! test
2222 <pre> with forbidden attribute (bug 3202)
2223 !! wikitext
2224 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
2225 !! html
2226 <pre width="8">Narrow screen goodies</pre>
2227
2228 !! end
2229
2230 !! test
2231 Entities inside <pre>
2232 !! wikitext
2233 <pre>&lt;</pre>
2234 !! html
2235 <pre>&lt;</pre>
2236
2237 !! end
2238
2239 !! test
2240 <pre> with forbidden attribute values (bug 3202)
2241 !! wikitext
2242 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
2243 !! html
2244 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
2245
2246 !! end
2247
2248 !! test
2249 <nowiki> inside <pre> (bug 13238)
2250 !! wikitext
2251 <pre>
2252 <nowiki>
2253 </pre>
2254 <pre>
2255 <nowiki></nowiki>
2256 </pre>
2257 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
2258 !! html
2259 <pre>
2260 &lt;nowiki&gt;
2261 </pre>
2262 <pre>
2263
2264 </pre>
2265 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
2266
2267 !! end
2268
2269 !! test
2270 <nowiki> and <pre> preference (first one wins)
2271 !! wikitext
2272 <pre>
2273 <nowiki>
2274 </pre>
2275 </nowiki>
2276 </pre>
2277
2278 <nowiki>
2279 <pre>
2280 <nowiki>
2281 </pre>
2282 </nowiki>
2283 </pre>
2284
2285 !! html/php
2286 <pre>
2287 &lt;nowiki&gt;
2288 </pre>
2289 <p>&lt;/nowiki&gt;
2290 &lt;/pre&gt;
2291 </p><p>
2292 &lt;pre&gt;
2293 &lt;nowiki&gt;
2294 &lt;/pre&gt;
2295
2296 &lt;/pre&gt;
2297 </p>
2298 !! html/parsoid
2299 <pre data-parsoid='{"stx":"html","strippedNL":true}'>&lt;nowiki>
2300 </pre>
2301 <p><span typeof="mw:Placeholder" data-parsoid='{"src":"&lt;/nowiki>"}'>&lt;/nowiki></span>
2302 &lt;/pre></p>
2303
2304 <p><span typeof="mw:Nowiki">
2305 &lt;pre>
2306 &lt;nowiki>
2307 &lt;/pre>
2308 </span>
2309 &lt;/pre></p>
2310 !! end
2311
2312 !! test
2313 </pre> inside nowiki
2314 !! wikitext
2315 <nowiki></pre></nowiki>
2316 !! html
2317 <p>&lt;/pre&gt;
2318 </p>
2319 !! end
2320
2321 # Parsoid doesn't strip empty tags, like Tidy does.
2322 !! test
2323 Empty pre; pre inside other HTML tags (bug 54946)
2324 !! options
2325 parsoid=wt2html,wt2wt
2326 !! wikitext
2327 a
2328
2329 <div><pre>
2330 foo
2331 </pre></div>
2332 <pre></pre>
2333 !! html/php
2334 <p>a
2335 </p>
2336 <div><pre>
2337 foo
2338 </pre></div>
2339 <pre></pre>
2340
2341 !! html/php+tidy
2342 <p>a</p>
2343 <div>
2344 <pre>
2345 foo
2346 </pre></div>
2347 !! html/parsoid
2348 <p>a</p>
2349
2350 <div><pre>foo
2351 </pre></div>
2352 <pre></pre>
2353 !! end
2354
2355 !! test
2356 HTML pre followed by indent-pre
2357 !! wikitext
2358 <pre>foo</pre>
2359 bar
2360 !! html
2361 <pre>foo</pre>
2362 <pre>bar
2363 </pre>
2364 !! end
2365
2366 # Note that tidy removes the empty <p> tags from the start and end.
2367 # Parsoid does not, by design.
2368 !!test
2369 Block tag pre
2370 !! wikitext
2371 <p><pre>foo</pre></p>
2372 !! html/php+tidy
2373 <pre>
2374 foo
2375 </pre>
2376 !! html/parsoid
2377 <p data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre data-parsoid='{"stx":"html"}'>foo</pre><p data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
2378 !!end
2379
2380 !!test
2381 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
2382 !! wikitext
2383 {{echo|}}
2384 !! html
2385
2386 !!end
2387
2388 !!test
2389 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
2390 !! wikitext
2391 {{echo|
2392 foo}}
2393 !! html
2394 <p>foo
2395 </p>
2396 !!end
2397
2398 !! test
2399 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
2400 !! wikitext
2401 {{echo|a
2402 b}}
2403 !! html
2404 <pre>a
2405 </pre>
2406 <p>b
2407 </p>
2408 !!end
2409
2410 !! test
2411 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
2412 !! wikitext
2413 {{echo|a
2414 b
2415 c
2416 d
2417 e
2418 }}
2419 !! html
2420 <pre>a
2421 </pre>
2422 <p>b
2423 c
2424 </p>
2425 <pre>d
2426 </pre>
2427 <p>e
2428 </p>
2429 !!end
2430
2431 !!test
2432 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
2433 !! wikitext
2434 {{echo| foo}}
2435
2436 {{echo| foo}}{{echo| bar}}
2437
2438 {{echo| foo}}
2439 {{echo| bar}}
2440
2441 {{echo|<!--cmt--> foo}}
2442
2443 <!--cmt-->{{echo| foo}}
2444
2445 {{echo|{{echo| }}bar}}
2446 !! html
2447 <pre>foo
2448 </pre>
2449 <pre>foo bar
2450 </pre>
2451 <pre>foo
2452 bar
2453 </pre>
2454 <pre>foo
2455 </pre>
2456 <pre>foo
2457 </pre>
2458 <pre>bar
2459 </pre>
2460 !!end
2461
2462 !! test
2463 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
2464 !! wikitext
2465 {{echo| }}a
2466
2467 {{echo|
2468 }}a
2469
2470 {{echo|
2471 b}}
2472
2473 {{echo|a
2474 }}b
2475
2476 {{echo|a
2477 }} b
2478 !! html
2479 <pre>a
2480 </pre>
2481 <p><br />
2482 </p>
2483 <pre>a
2484 </pre>
2485 <p><br />
2486 </p>
2487 <pre>b
2488 </pre>
2489 <p>a
2490 </p>
2491 <pre>b
2492 </pre>
2493 <p>a
2494 </p>
2495 <pre>b
2496 </pre>
2497 !!end
2498
2499 !! test
2500 Pres with newline attributes
2501 !! wikitext
2502 <pre class="one
2503 two">hi</pre>
2504 !! html/php
2505 <pre class="one two">hi</pre>
2506
2507 !! html/parsoid
2508 <pre class="one
2509 two" data-parsoid='{"stx":"html"}'>hi</pre>
2510 !! end
2511
2512 !! test
2513 Things that look like <pre> tags aren't treated as such
2514 !! wikitext
2515 Barack Obama <President> of the United States
2516 <President></President>
2517 !! html
2518 <p>Barack Obama &lt;President&gt; of the United States
2519 &lt;President&gt;&lt;/President&gt;
2520 </p>
2521 !! end
2522
2523 !! test
2524 Handle broken pre-like tags (bug 64025)
2525 !! options
2526 parsoid=wt2html
2527 !! wikitext
2528 {{echo|<pre <pre>x</pre>}}
2529
2530 <table><pre </table>
2531 !! html/php
2532 <pre>x</pre>
2533 <table>&lt;pre </table>
2534
2535 !! html/php+tidy
2536 <pre>
2537 x
2538 </pre>
2539 <p>&lt;pre</p>
2540 !! html/parsoid
2541 <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"a":{"&lt;pre":null},"sa":{"&lt;pre":""},"stx":"html","pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
2542
2543
2544 <p>&lt;pre </p>
2545
2546 <table></table>
2547 !! end
2548
2549 !! test
2550 Parsoid: handle pre with space after attribute
2551 !! options
2552 parsoid=wt2html
2553 !! wikitext
2554 <pre style="width:50%;" >{{echo|foo}}</pre>
2555 !! html/php
2556 <pre style="width:50%;">{{echo|foo}}</pre>
2557
2558 !! html/parsoid
2559 <pre style="width:50%;">{{echo|foo}}</pre>
2560 !! end
2561
2562 # TODO / maybe: fix wt2wt for this
2563 !! test
2564 Parsoid: Don't paragraph-wrap fosterable content
2565 !! options
2566 parsoid=wt2html
2567 !! wikitext
2568 {|
2569 <td></td>
2570 <td></td>
2571
2572
2573
2574 |}
2575 !! html
2576 <table>
2577
2578 <tbody>
2579 <tr>
2580 <td></td>
2581
2582 <td></td></tr>
2583
2584
2585
2586 </tbody></table>
2587 !! end
2588
2589 !! test
2590 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2591 !! options
2592 parsoid=wt2html
2593 !! wikitext
2594 {|
2595 <td>
2596 <td>
2597 </td>
2598
2599
2600
2601 |}
2602 !! html
2603 <table>
2604
2605 <tbody>
2606 <tr>
2607 <td></td>
2608
2609 <td>
2610 </td></tr>
2611
2612
2613
2614 </tbody></table>
2615 !! end
2616
2617
2618 #--------------------------------------------------------------------
2619 # Transclusion parameter whitespace stripping tests
2620 # Behavior is different for positional and named parameters
2621 #--------------------------------------------------------------------
2622 !! test
2623 Templates: Strip leading and trailing whitespace from named-param values
2624 !! wikitext
2625 {{echo|1= a }}
2626
2627 {{echo|1= {{echo|b}} }}
2628
2629 {{echo| 1 =
2630 c }}
2631
2632 {{echo| 1 =
2633 * d
2634 }}
2635 !! html
2636 <p>a
2637 </p><p>b
2638 </p><p>c
2639 </p>
2640 <ul><li> d</li></ul>
2641
2642 !! end
2643
2644 !! test
2645 Templates: Don't strip whitespace from positional-param values
2646 !! wikitext
2647 {{echo|a }}
2648
2649 {{echo|{{echo|b}} }}
2650
2651 {{echo| c
2652 }}
2653
2654 {{echo| {{echo|d}}
2655 }}
2656
2657 {{echo|
2658 e}}
2659
2660 {{echo|
2661 * f}}
2662
2663 {{echo|
2664 }}g
2665 !! html
2666 <p>a
2667 </p><p>b
2668 </p>
2669 <pre>c
2670 </pre>
2671 <p><br />
2672 </p>
2673 <pre>d
2674 </pre>
2675 <p><br />
2676 </p>
2677 <pre>e
2678 </pre>
2679 <p><br />
2680 </p>
2681 <ul><li> f</li></ul>
2682 <p><br />
2683 </p>
2684 <pre>g
2685 </pre>
2686 !! end
2687
2688 !! test
2689 Templates: Handle empty comment-and-ws-only lines correctly
2690 !! wikitext
2691 {{echo|foo
2692 <!--should be ignored-->
2693 <!--should be ignored as well-->
2694 bar}}
2695 !! html
2696 <p>foo
2697 bar
2698 </p>
2699 !! end
2700
2701 !! test
2702 Templates: Handle comments in the target
2703 !! wikitext
2704 {{echo
2705 <!-- should be ignored -->
2706 |foo}}
2707
2708 {{echo<!-- should be ignored -->
2709 |foo}}
2710
2711 {{echo<!-- should be ignored -->|foo}}
2712
2713 {{<!-- should be ignored -->echo|foo}}
2714 !!html/parsoid
2715 <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>
2716
2717 <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>
2718
2719 <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>
2720
2721 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2722 !!end
2723
2724 !! test
2725 Templates: Handle comments in parameter names (bug 67657)
2726 !! wikitext
2727 {{echo|1
2728 <!-- should be ignored -->
2729 =foo}}
2730
2731 {{echo|
2732 <!-- should be ignored -->
2733 1 = foo}}
2734
2735 {{echo|1<!-- should be ignored --> = foo}}
2736
2737 {{echo|<!-- should be ignored -->1 = foo}}
2738 !!html/parsoid
2739 <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>
2740
2741 <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>
2742
2743 <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>
2744
2745 <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>
2746 !!end
2747
2748 !! test
2749 Templates: Other wikitext in parameter names (bug 67657)
2750 !! wikitext
2751 {{echo|''1''=foo}}
2752 !!html/parsoid
2753 <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>
2754 !!html/php
2755 <p>{{{1}}}
2756 </p>
2757 !!end
2758
2759 #--------------------------------------------------------------------
2760 # Transclusion parameter escaping tests
2761 #--------------------------------------------------------------------
2762 !! test
2763 Templates: Parsoid parameter escaping test 1
2764 !! wikitext
2765 {{echo|[foo]|{{echo|[bar]}}}}
2766 !! html/php+tidy
2767 <p>[foo]</p>
2768 !! html/parsoid
2769 <p about="#mwt1" typeof="mw:Transclusion"
2770 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2771 !! end
2772
2773 !! test
2774 Parsoid: Pipes in external links in template parameter
2775 !! wikitext
2776 {{echo|[{{echo|http://example.com}} link]}}
2777 !! html/php+tidy
2778 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2779 !! html/parsoid
2780 <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>
2781 !! end
2782
2783 !! test
2784 Parsoid: pipe in transclusion parameter
2785 !! wikitext
2786 {{echo|http://foo.com/a&#124;b}}
2787 !! html/php+tidy
2788 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2789 !! html/parsoid
2790 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2791 typeof="mw:Transclusion"
2792 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>
2793 !! end
2794
2795 !! test
2796 Parsoid: Pipe in external link target and content in template parameter
2797 !! options
2798 parsoid=html2wt,wt2wt
2799 !! wikitext
2800 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2801 !! html/php+tidy
2802 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2803 !! html/parsoid
2804 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2805 typeof="mw:Transclusion"
2806 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2807 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2808 !! end
2809
2810 !! test
2811 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2812 !! options
2813 parsoid
2814 !! wikitext
2815 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2816 !! html
2817 <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>
2818 !! end
2819
2820 !! test
2821 Templates: Don't escape already nowiki-escaped text in template parameters
2822 !! options
2823 parsoid=html2wt,wt2wt
2824 !! wikitext
2825 {{echo|foo<nowiki>|</nowiki>bar}}
2826 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2827 {{echo|<nowiki></nowiki>}}
2828 !! html/php+tidy
2829 <p>foo|bar &lt;div&gt;</p>
2830 !! html/parsoid
2831 <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>
2832 <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>
2833 <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>
2834 </p>
2835 !! end
2836
2837 ## Bug 52824
2838 !! test
2839 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2840 !! options
2841 parsoid=html2wt,wt2wt
2842 !! wikitext
2843 {{echo|{{echo|1=bar}}}}
2844 !! html/php+tidy
2845 <p>bar</p>
2846 !! html/parsoid
2847 <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>
2848 !! end
2849
2850 ## Bug 56733
2851 !! test
2852 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2853 !! wikitext
2854 {{echo|a : b}}
2855 !! html/php+tidy
2856 <p>a&#160;: b</p>
2857 !! html/parsoid
2858 <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>
2859 !! end
2860
2861 ## Bug T73412
2862 !! test
2863 Templates: Preserve blank parameter names
2864 !! wikitext
2865 {{echo|=foo}}
2866 !! html/php+tidy
2867 <p>{{{1}}}</p>
2868 !! html/parsoid
2869 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2870 !! end
2871
2872 !! test
2873 Templates: Preserve blank parameter names in other positions
2874 !! wikitext
2875 {{blank_param|bar|=foo}}
2876 !! html/php+tidy
2877 <p>bar foo</p>
2878 !! html/parsoid
2879 <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]},{"k":"","named":true,"spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"blank_param","href":"./Template:Blank_param"},"params":{"1":{"wt":"bar"},"":{"wt":"foo"}},"i":0}}]}'>bar
2880 foo</p>
2881 !! end
2882
2883 ###
2884 ### Parsoid-centric tests for testing RT edge cases for pre
2885 ###
2886
2887 !!test
2888 1a. Indent-Pre and Comments
2889 !! wikitext
2890 a
2891 <!--a-->
2892 c
2893 !! html
2894 <pre>a
2895 </pre>
2896 <p>c
2897 </p>
2898 !!end
2899
2900 !!test
2901 1b. Indent-Pre and Comments
2902 !! wikitext
2903 a
2904 <!--a-->
2905 c
2906 !! html
2907 <pre>a
2908 </pre>
2909 <p>c
2910 </p>
2911 !!end
2912
2913 !!test
2914 1c. Indent-Pre and Comments
2915 !! wikitext
2916 <!--a--> a
2917
2918 <!--a--> a
2919 !! html
2920 <pre> a
2921 </pre>
2922 <pre> a
2923 </pre>
2924 !!end
2925
2926 !!test
2927 1d. Indent-Pre and Comments
2928 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2929 !! wikitext
2930 <!--a--> a
2931
2932 <!--b-->b
2933 !! html
2934 <pre>a
2935 </pre>
2936 <pre>b
2937 </pre>
2938 !!end
2939
2940 !!test
2941 2a. Indent-Pre and tables
2942 !! wikitext
2943 {|
2944 |-
2945 !h1!!h2
2946 |foo||bar
2947 |}
2948 !! html
2949 <table>
2950
2951 <tr>
2952 <th>h1</th>
2953 <th>h2
2954 </th>
2955 <td>foo</td>
2956 <td>bar
2957 </td></tr></table>
2958
2959 !!end
2960
2961 !!test
2962 2b. Indent-Pre and tables
2963 !! wikitext
2964 {|
2965 |-
2966 |foo
2967 |}
2968 !! html
2969 <table>
2970
2971 <tr>
2972 <td>foo
2973 </td></tr></table>
2974
2975 !!end
2976
2977 !!test
2978 2c. Indent-Pre and tables (bug 42252)
2979 !! wikitext
2980 {|
2981 |+ foo
2982 ! | bar
2983 |}
2984 !! html
2985 <table>
2986 <caption> foo
2987 </caption>
2988 <tr>
2989 <th> bar
2990 </th></tr></table>
2991
2992 !!end
2993
2994 !!test
2995 2d. Indent-Pre and tables
2996 !! wikitext
2997 a
2998 {|
2999 | b
3000 |}
3001 !! html/php
3002 <pre>a
3003 </pre>
3004 <table>
3005 <tr>
3006 <td> b
3007 </td></tr></table>
3008
3009 !! html/parsoid
3010 <pre>a</pre>
3011 <table>
3012 <tbody><tr><td> b</td></tr>
3013 </tbody></table>
3014 !!end
3015
3016 !!test
3017 2e. Indent-Pre and table-line syntax
3018 !! wikitext
3019 a
3020 | b
3021 | c
3022 !! html/php
3023 <pre>a
3024 | b
3025 | c
3026 </pre>
3027 !!end
3028
3029 !!test
3030 2f. Indent-pre started by table-line syntax
3031 !! wikitext
3032 a
3033 | b
3034 | c
3035 !! html/php
3036 <p>a
3037 </p>
3038 <pre>| b
3039 | c
3040 </pre>
3041 !! html/parsoid
3042 <p>a</p>
3043 <pre>
3044 | b
3045 | c</pre>
3046 !!end
3047
3048 !!test
3049 3a. Indent-Pre and block tags (single-line html)
3050 !! wikitext
3051 a <p> foo </p>
3052 b <div> foo </div>
3053 c <blockquote> foo </blockquote>
3054 <span> foo </span>
3055 !! html
3056 a <p> foo </p>
3057 b <div> foo </div>
3058 c <blockquote> foo </blockquote>
3059 <pre><span> foo </span>
3060 </pre>
3061 !! html/parsoid
3062 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3063 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3064 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3065 <pre><span> foo </span>
3066 </pre>
3067 !! html+tidy
3068 <p>a</p>
3069 <p>foo</p>
3070 <p>b</p>
3071 <div>foo</div>
3072 <p>c</p>
3073 <blockquote>
3074 <p>foo</p>
3075 </blockquote>
3076 <pre>
3077 <span> foo </span>
3078 </pre>
3079 !! end
3080
3081 !!test
3082 3b. Indent-Pre and block tags (multi-line html)
3083 !! wikitext
3084 a <span>foo</span>
3085 b <div> foo </div>
3086 !! html
3087 <pre>a <span>foo</span>
3088 </pre>
3089 b <div> foo </div>
3090
3091 !! html/parsoid
3092 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3093 b <div data-parsoid='{"stx":"html"}'> foo </div>
3094 !! html+tidy
3095 <pre>
3096 a <span>foo</span>
3097 </pre>
3098 <p>b</p>
3099 <div>foo</div>
3100 !!end
3101
3102 !!test
3103 3c. Indent-Pre and block tags (pre-content on separate line)
3104 !! wikitext
3105 <p>
3106 foo
3107 </p>
3108
3109 <div>
3110 foo
3111 </div>
3112
3113 <center>
3114 foo
3115 </center>
3116
3117 <blockquote>
3118 foo
3119 </blockquote>
3120
3121 <blockquote>
3122 <pre>
3123 foo
3124 </pre>
3125 </blockquote>
3126
3127 <table><tr><td>
3128 foo
3129 </td></tr></table>
3130
3131 <ul><li>
3132 foo
3133 </li></ul>
3134
3135 !! html
3136 <p>
3137 foo
3138 </p>
3139 <div>
3140 <pre>foo
3141 </pre>
3142 </div>
3143 <center>
3144 <pre>foo
3145 </pre>
3146 </center>
3147 <blockquote>
3148 <p> foo
3149 </p>
3150 </blockquote>
3151 <blockquote>
3152 <pre>
3153 foo
3154 </pre>
3155 </blockquote>
3156 <table><tr><td>
3157 <pre>foo
3158 </pre>
3159 </td></tr></table>
3160 <ul><li>
3161 foo
3162 </li></ul>
3163
3164 !!end
3165
3166 !!test
3167 4. Indent-Pre and extension tags
3168 !! wikitext
3169 a <gallery>
3170 File:foobar.jpg
3171 </gallery>
3172 !! html
3173 a <ul class="gallery mw-gallery-traditional">
3174 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
3175 <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>
3176 <div class="gallerytext">
3177 </div>
3178 </div></li>
3179 </ul>
3180
3181 !! html+tidy
3182 <p>a</p>
3183 <ul class="gallery mw-gallery-traditional">
3184 <li class="gallerybox" style="width: 155px">
3185 <div style="width: 155px">
3186 <div class="thumb" style="width: 150px;">
3187 <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>
3188 </div>
3189 <div class="gallerytext"></div>
3190 </div>
3191 </li>
3192 </ul>
3193 !!end
3194
3195 !! test
3196 Table wikitext syntax outside wiki-tables
3197 !! wikitext
3198 a
3199 ! not a table heading
3200 |- not a table row
3201 | not a table cell
3202 | class="foo bar" | baz
3203 b
3204 |}
3205 |-
3206 c
3207 !! html
3208 <p>a
3209 ! not a table heading
3210 |- not a table row
3211 | not a table cell
3212 | class="foo bar" | baz
3213 b
3214 |}
3215 |-
3216 c
3217 </p>
3218 !! end
3219
3220 !!test
3221 Render paragraphs when indent-pre is suppressed in blocklevels
3222 !! wikitext
3223 <blockquote>
3224 foo
3225
3226 bar
3227 </blockquote>
3228 !! html
3229 <blockquote>
3230 <p> foo
3231 </p><p> bar
3232 </p>
3233 </blockquote>
3234
3235 !!end
3236
3237 !!test
3238 4. Multiple spaces at start-of-line
3239 !! wikitext
3240 <p> foo </p>
3241 foo
3242 {|
3243 |foo
3244 |}
3245 !! html
3246 <p> foo </p>
3247 <pre> foo
3248 </pre>
3249 <table>
3250 <tr>
3251 <td>foo
3252 </td></tr></table>
3253
3254 !!end
3255
3256 ## NOTE: the leading white-space chars on empty line are significant
3257 !! test
3258 5a. White-space in indent-pre
3259 !! wikitext
3260 a<br />
3261
3262 b
3263 !! html
3264 <pre>a<br />
3265
3266 b
3267 </pre>
3268 !! end
3269
3270 ## NOTE: the leading white-space chars on empty line are significant
3271 !! test
3272 5b. White-space in indent-pre
3273 !! wikitext
3274 a
3275
3276 b
3277
3278
3279 c
3280 !! html
3281 <pre>a
3282
3283 b
3284
3285
3286 c
3287 </pre>
3288 !! end
3289
3290 !! test
3291 5c. White-space in indent-pre
3292 !! wikitext
3293 ''a''
3294 ''b''
3295 ''c''
3296 !! html
3297 <pre><i>a</i>
3298 <i>b</i>
3299 <i>c</i>
3300 </pre>
3301 !! end
3302
3303 !! test
3304 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3305 !! wikitext
3306 a
3307
3308 <!-- continue -->
3309 b
3310
3311 c
3312
3313 d
3314 !! html
3315 <pre>a
3316
3317 b
3318 </pre>
3319 <pre>c
3320
3321 </pre>
3322 <p>d
3323 </p>
3324 !! end
3325
3326 !! test
3327 7a. Indent-pre and category links
3328 !! options
3329 parsoid=wt2html,wt2wt
3330 !! wikitext
3331 [[Category:foo]] <!-- No pre-wrapping -->
3332 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3333 !! html/php+tidy
3334 !! html/parsoid
3335 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3336 <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 -->
3337 !! end
3338
3339 ## We used to, but no longer wt2wt this test since the default serializer
3340 ## will normalize all categories to serialize on their own line.
3341 ## This wikitext usage is going to be fairly uncommon in production and
3342 ## selser will take care of preserving formatting in those scenarios.
3343 !! test
3344 7b. Indent-pre and category links
3345 !! options
3346 parsoid=wt2html
3347 !! wikitext
3348 [[Category:foo]] a
3349 [[Category:foo]] {{echo|b}}
3350 !! html/parsoid
3351 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3352 <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>
3353 !! end
3354
3355 !! test
3356 Indent-Pre: Newlines in comments shouldn't affect sol state
3357 !! wikitext
3358 a <!--
3359 foo
3360 --> b
3361 !! html/php+tidy
3362 <p>a b</p>
3363 !! html/parsoid
3364 <p>a <!--
3365 foo
3366 --> b</p>
3367 !! end
3368
3369 ###
3370 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3371 ###
3372
3373 !!test
3374 HTML-pre: 1. embedded newlines
3375 !! wikitext
3376 <pre>foo</pre>
3377
3378 <pre>
3379 foo
3380 </pre>
3381
3382 <pre>
3383
3384 foo
3385 </pre>
3386
3387 <pre>
3388
3389
3390 foo
3391 </pre>
3392 !! html/php+tidy
3393 <pre>
3394 foo
3395 </pre>
3396 <pre>
3397 foo
3398 </pre>
3399 <pre>
3400
3401 foo
3402 </pre>
3403 <pre>
3404
3405
3406 foo
3407 </pre>
3408 !! html/parsoid
3409 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3410
3411 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3412 foo
3413 </pre>
3414
3415 <pre data-parsoid='{"stx":"html"}'>
3416
3417 foo
3418 </pre>
3419
3420 <pre data-parsoid='{"stx":"html"}'>
3421
3422
3423 foo
3424 </pre>
3425 !!end
3426
3427 !! test
3428 HTML-pre: big spaces
3429 !! wikitext
3430 <pre>
3431
3432
3433
3434
3435 haha
3436
3437
3438
3439
3440 haha
3441
3442
3443
3444
3445 </pre>
3446 !! html/php+tidy
3447 <pre>
3448
3449
3450
3451
3452 haha
3453
3454
3455
3456
3457 haha
3458
3459
3460
3461
3462 </pre>
3463 !! html/parsoid
3464 <pre data-parsoid='{"stx":"html"}'>
3465
3466
3467
3468
3469 haha
3470
3471
3472
3473
3474 haha
3475
3476
3477
3478
3479 </pre>
3480 !! end
3481
3482 !!test
3483 HTML-pre: 2: indented text
3484 !! wikitext
3485 <pre>
3486 foo
3487 </pre>
3488 !! html
3489 <pre>
3490 foo
3491 </pre>
3492
3493 !!end
3494
3495 !!test
3496 HTML-pre: 3: other wikitext
3497 !! wikitext
3498 <pre>
3499 * foo
3500 # bar
3501 = no-h =
3502 '' no-italic ''
3503 [[ NoLink ]]
3504 </pre>
3505 !! html/php
3506 <pre>
3507 * foo
3508 # bar
3509 = no-h =
3510 '' no-italic ''
3511 [[ NoLink ]]
3512 </pre>
3513
3514 !! html/parsoid
3515 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3516 # bar
3517 = no-h =
3518 '' no-italic ''
3519 [[ NoLink ]]
3520 </pre>
3521 !!end
3522
3523 ###
3524 ### Definition lists
3525 ###
3526 !! test
3527 Simple definition
3528 !! wikitext
3529 ; name : Definition
3530 !! html
3531 <dl><dt> name&#160;</dt>
3532 <dd> Definition</dd></dl>
3533
3534 !! end
3535
3536 !! test
3537 Definition list for indentation only
3538 !! wikitext
3539 : Indented text
3540 !! html
3541 <dl><dd> Indented text</dd></dl>
3542
3543 !! end
3544
3545 !! test
3546 Definition list with no space
3547 !! wikitext
3548 ;name:Definition
3549 !! html
3550 <dl><dt>name</dt>
3551 <dd>Definition</dd></dl>
3552
3553 !!end
3554
3555 !! test
3556 Definition list with URL link
3557 !! wikitext
3558 ; http://example.com/ : definition
3559 !! html
3560 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3561 <dd> definition</dd></dl>
3562
3563 !! end
3564
3565 !! test
3566 Definition list with bracketed URL link
3567 !! wikitext
3568 ;[http://www.example.com/ Example]:Something about it
3569 !! html
3570 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3571 <dd>Something about it</dd></dl>
3572
3573 !! end
3574
3575 !! test
3576 Definition list with wikilink containing colon
3577 !! wikitext
3578 ; [[Help:FAQ]]: The least-read page on Wikipedia
3579 !! html
3580 <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>
3581 <dd> The least-read page on Wikipedia</dd></dl>
3582
3583 !! end
3584
3585 # At Brion's and JeLuF's insistence... :)
3586 !! test
3587 Definition list with news link containing colon
3588 !! wikitext
3589 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3590 !! html/php
3591 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3592 <dd> This isn't even a real newsgroup!</dd></dl>
3593
3594 !! html/parsoid
3595 <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>
3596 !! end
3597
3598 !! test
3599 Malformed definition list with colon
3600 !! wikitext
3601 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3602 !! html
3603 <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>
3604
3605 !! end
3606
3607 !! test
3608 Definition lists: colon in external link text
3609 !! wikitext
3610 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3611 !! html
3612 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3613 <dd> OK, I made that up</dd></dl>
3614
3615 !! end
3616
3617 !! test
3618 Definition lists: colon in HTML attribute
3619 !! wikitext
3620 ;<b style="display: inline">bold</b>
3621 !! html
3622 <dl><dt><b style="display: inline">bold</b></dt></dl>
3623
3624 !! end
3625
3626 !! test
3627 Definition lists: self-closed tag
3628 !! wikitext
3629 ;one<br/>two : two-line fun
3630 !! html
3631 <dl><dt>one<br />two&#160;</dt>
3632 <dd> two-line fun</dd></dl>
3633
3634 !! end
3635
3636 !! test
3637 Bug 11748: Literal closing tags
3638 !! wikitext
3639 <dl>
3640 <dt>test 1</dt>
3641 <dd>test test test test test</dd>
3642 <dt>test 2</dt>
3643 <dd>test test test test test</dd>
3644 </dl>
3645 !! html
3646 <dl>
3647 <dt>test 1</dt>
3648 <dd>test test test test test</dd>
3649 <dt>test 2</dt>
3650 <dd>test test test test test</dd>
3651 </dl>
3652
3653 !! end
3654
3655 !! test
3656 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3657 !! wikitext
3658 <ul><li>
3659 ; term : description
3660 * unordered
3661 </li></ul>
3662 !! html
3663 <ul><li>
3664 <dl><dt> term&#160;</dt>
3665 <dd> description</dd></dl>
3666 <ul><li> unordered</li></ul>
3667 </li></ul>
3668
3669 !! end
3670
3671 !! test
3672
3673 Definition list with empty definition and following paragraph
3674 !! wikitext
3675 ; term:
3676 Paragraph text
3677 !! html
3678 <dl><dt> term</dt>
3679 <dd></dd></dl>
3680 <p>Paragraph text
3681 </p>
3682 !! end
3683
3684 !! test
3685 Nested definition lists using html syntax
3686 !! wikitext
3687 <dl><dt>x</dt>
3688 <dd>a</dd>
3689 <dd>b</dd></dl>
3690
3691 !! end
3692
3693 !! test
3694 Definition Lists: No nesting: Multiple dd's
3695 !! wikitext
3696 ;x
3697 :a
3698 :b
3699 !! html
3700 <dl><dt>x</dt>
3701 <dd>a</dd>
3702 <dd>b</dd></dl>
3703
3704 !! end
3705
3706 !! test
3707 Definition Lists: Indentation: Regular
3708 !! wikitext
3709 :i1
3710 ::i2
3711 :::i3
3712 !! html
3713 <dl><dd>i1
3714 <dl><dd>i2
3715 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3716
3717 !! end
3718
3719 !! test
3720 Definition Lists: Indentation: Missing 1st level
3721 !! wikitext
3722 ::i2
3723 :::i3
3724 !! html
3725 <dl><dd><dl><dd>i2
3726 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3727
3728 !! end
3729
3730 !! test
3731 Definition Lists: Indentation: Multi-level indent
3732 !! wikitext
3733 :::i3
3734 !! html
3735 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3736
3737 !! end
3738
3739 !! test
3740 Definition Lists: Hacky use to indent tables
3741 !! wikitext
3742 ::{|
3743 |foo
3744 |bar
3745 |}
3746 this text
3747 should be left alone
3748 !! html
3749 <dl><dd><dl><dd><table>
3750 <tr>
3751 <td>foo
3752 </td>
3753 <td>bar
3754 </td></tr></table></dd></dl></dd></dl>
3755 <p>this text
3756 should be left alone
3757 </p>
3758 !! end
3759
3760 !! test
3761 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3762 !! wikitext
3763 <!-- foo -->
3764 ::{|
3765 |foo
3766 |bar
3767 |}<!-- bar -->
3768 this text
3769 should be left alone
3770 !! html/parsoid
3771 <!-- foo -->
3772 <dl><dd><dl><dd><table><tr>
3773 <td>foo</td>
3774 <td>bar</td>
3775 </tr></table><!-- bar --></dd></dl></dd></dl>
3776 <p>this text
3777 should be left alone</p>
3778 !! end
3779
3780 !! test
3781 Definition Lists: Hacky use to indent tables, with comment before table
3782 !! wikitext
3783 ::<!-- foo -->{|
3784 |foo
3785 |}
3786 !! html/parsoid
3787 <dl><dd><dl><dd><!-- foo --><table><tr>
3788 <td>foo</td>
3789 </tr></table></dd></dl></dd></dl>
3790 !! end
3791
3792 # The trailing whitespace in this test is to catch a regression in
3793 # Parsoid after T54473.
3794 !! test
3795 Definition Lists: Hacky use to indent tables (WS-insensitive)
3796 !! wikitext
3797 : {|
3798 |a
3799 |}
3800 !! html/php
3801 <dl><dd><table>
3802 <tr>
3803 <td>a
3804 </td></tr></table></dd></dl>
3805
3806 !! html/parsoid
3807 <dl><dd> <table>
3808 <tbody><tr><td>a</td></tr>
3809 </tbody></table> </dd></dl>
3810 !! end
3811
3812 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3813 ## as an empty dt item. It also ignores all but the last ";" when followed
3814 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3815 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3816 ## ";"s.
3817 ##
3818 ## Ex: ";;t2 ::d2" is transformed into:
3819 ##
3820 ## <dl>
3821 ## <dt>t2 </dt>
3822 ## <dd>
3823 ## <dl>
3824 ## <dt></dt>
3825 ## <dd>d2</dd>
3826 ## </dl>
3827 ## </dd>
3828 ## </dl>
3829 ##
3830 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3831 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3832 ##
3833 ## <dl>
3834 ## <dt>
3835 ## <dl>
3836 ## <dt>t2 </dt>
3837 ## <dd>:d2</dd>
3838 ## </dl>
3839 ## </dt>
3840 ## </dl>
3841 ##
3842 ## All Parsoid only definition list tests have this difference.
3843 ##
3844 ## See also: https://phabricator.wikimedia.org/T8569
3845 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3846
3847 !! test
3848 Table / list interaction: indented table with lists in table contents
3849 !! wikitext
3850 :{|
3851 |-
3852 | a
3853 * b
3854 |-
3855 | c
3856 * d
3857 |}
3858 !! html
3859 <dl><dd><table>
3860
3861 <tr>
3862 <td> a
3863 <ul><li> b</li></ul>
3864 </td></tr>
3865 <tr>
3866 <td> c
3867 <ul><li> d</li></ul>
3868 </td></tr></table></dd></dl>
3869
3870 !! end
3871
3872 !!test
3873 Table / list interaction: lists nested in tables nested in indented lists
3874 !! wikitext
3875 :{|
3876 |
3877 :a
3878 :b
3879 |
3880 *c
3881 *d
3882 |}
3883
3884 *e
3885 *f
3886 !! html
3887 <dl><dd><table>
3888 <tr>
3889 <td>
3890 <dl><dd>a</dd>
3891 <dd>b</dd></dl>
3892 </td>
3893 <td>
3894 <ul><li>c</li>
3895 <li>d</li></ul>
3896 </td></tr></table></dd></dl>
3897 <ul><li>e</li>
3898 <li>f</li></ul>
3899
3900 !!end
3901
3902 !! test
3903 Definition Lists: Nesting: Multi-level (Parsoid only)
3904 !! options
3905 parsoid
3906 !! wikitext
3907 ;t1 :d1
3908 ;;t2 ::d2
3909 ;;;t3 :::d3
3910 !! html
3911 <dl>
3912 <dt>t1 </dt>
3913 <dd>d1</dd>
3914 <dt>
3915 <dl>
3916 <dt>t2 </dt>
3917 <dd>:d2</dd>
3918 <dt>
3919 <dl>
3920 <dt>t3 </dt>
3921 <dd>::d3</dd>
3922 </dl>
3923 </dt>
3924 </dl>
3925 </dt>
3926 </dl>
3927
3928
3929 !! end
3930
3931
3932 !! test
3933 Definition Lists: Nesting: Test 2 (Parsoid only)
3934 !! wikitext
3935 ;t1
3936 ::d2
3937 !! html/php+tidy
3938 <dl>
3939 <dt>t1</dt>
3940 <dd>
3941 <dl>
3942 <dd>d2</dd>
3943 </dl>
3944 </dd>
3945 </dl>
3946 !! html/parsoid
3947 <dl>
3948 <dt>t1</dt>
3949 <dd>
3950 <dl>
3951 <dd>d2</dd>
3952 </dl>
3953 </dd>
3954 </dl>
3955
3956 !! end
3957
3958
3959 !! test
3960 Definition Lists: Nesting: Test 3 (Parsoid only)
3961 !! wikitext
3962 :;t1
3963 ::::d2
3964 !! html/php+tidy
3965 <dl>
3966 <dd>
3967 <dl>
3968 <dt>t1</dt>
3969 <dd>
3970 <dl>
3971 <dd>
3972 <dl>
3973 <dd>d2</dd>
3974 </dl>
3975 </dd>
3976 </dl>
3977 </dd>
3978 </dl>
3979 </dd>
3980 </dl>
3981 !! html/parsoid
3982 <dl>
3983 <dd>
3984 <dl>
3985 <dt>t1</dt>
3986 <dd>
3987 <dl>
3988 <dd>
3989 <dl>
3990 <dd>d2</dd>
3991 </dl>
3992 </dd>
3993 </dl>
3994 </dd>
3995 </dl>
3996 </dd>
3997 </dl>
3998
3999 !! end
4000
4001
4002 !! test
4003 Definition Lists: Nesting: Test 4
4004 !! wikitext
4005 ::;t3
4006 :::d3
4007 !! html
4008 <dl><dd><dl><dd><dl><dt>t3</dt>
4009 <dd>d3</dd></dl></dd></dl></dd></dl>
4010
4011 !! end
4012
4013
4014 ## The Parsoid team believes the following three test exposes a
4015 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4016 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4017 ## It also exposes a "misfeature" in tidy, which doesn't like
4018 ## <dl> tags with a single <dt> child; it converts the <dt> into
4019 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4020 !! test
4021 Definition Lists: Mixed Lists: Test 1
4022 !! wikitext
4023 :;* foo
4024 ::* bar
4025 :; baz
4026 !! html/php
4027 <dl><dd><dl><dt><ul><li> foo</li>
4028 <li> bar</li></ul></dt></dl>
4029 <dl><dt> baz</dt></dl></dd></dl>
4030
4031 !! html/php+tidy
4032 <dl>
4033 <dd>
4034 <dl>
4035 <dd>
4036 <ul>
4037 <li>foo</li>
4038 <li>bar</li>
4039 </ul>
4040 </dd>
4041 </dl>
4042 <dl>
4043 <dt>baz</dt>
4044 </dl>
4045 </dd>
4046 </dl>
4047 !! html/parsoid
4048 <dl>
4049 <dd><dl>
4050 <dt><ul>
4051 <li> foo
4052 </li>
4053 </ul></dt>
4054 <dd><ul>
4055 <li> bar
4056 </li>
4057 </ul></dd>
4058 <dt> baz</dt>
4059 </dl></dd>
4060 </dl>
4061 !! end
4062
4063 !! test
4064 Definition Lists: Mixed Lists: Test 2
4065 !! wikitext
4066 *: d1
4067 *: d2
4068 !! html
4069 <ul><li><dl><dd> d1</dd>
4070 <dd> d2</dd></dl></li></ul>
4071
4072 !! end
4073
4074
4075 !! test
4076 Definition Lists: Mixed Lists: Test 3
4077 !! wikitext
4078 *::: d1
4079 *::: d2
4080 !! html
4081 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4082 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4083
4084 !! end
4085
4086
4087 !! test
4088 Definition Lists: Mixed Lists: Test 4
4089 !! wikitext
4090 *;d1 :d2
4091 *;d3 :d4
4092 !! html
4093 <ul><li><dl><dt>d1&#160;</dt>
4094 <dd>d2</dd>
4095 <dt>d3&#160;</dt>
4096 <dd>d4</dd></dl></li></ul>
4097
4098 !! end
4099
4100
4101 !! test
4102 Definition Lists: Mixed Lists: Test 5
4103 !! wikitext
4104 *:d1
4105 *:: d2
4106 !! html
4107 <ul><li><dl><dd>d1
4108 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4109
4110 !! end
4111
4112
4113 !! test
4114 Definition Lists: Mixed Lists: Test 6
4115 !! wikitext
4116 #*:d1
4117 #*::: d3
4118 !! html
4119 <ol><li><ul><li><dl><dd>d1
4120 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4121
4122 !! end
4123
4124
4125 !! test
4126 Definition Lists: Mixed Lists: Test 7
4127 !! wikitext
4128 :* d1
4129 :* d2
4130 !! html
4131 <dl><dd><ul><li> d1</li>
4132 <li> d2</li></ul></dd></dl>
4133
4134 !! end
4135
4136
4137 !! test
4138 Definition Lists: Mixed Lists: Test 8
4139 !! wikitext
4140 :* d1
4141 ::* d2
4142 !! html
4143 <dl><dd><ul><li> d1</li></ul>
4144 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4145
4146 !! end
4147
4148
4149 !! test
4150 Definition Lists: Mixed Lists: Test 9
4151 !! wikitext
4152 *;foo :bar
4153 !! html
4154 <ul><li><dl><dt>foo&#160;</dt>
4155 <dd>bar</dd></dl></li></ul>
4156
4157 !! end
4158
4159
4160 !! test
4161 Definition Lists: Mixed Lists: Test 10
4162 !! wikitext
4163 *#;foo :bar
4164 !! html
4165 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4166 <dd>bar</dd></dl></li></ol></li></ul>
4167
4168 !! end
4169
4170 # The Parsoid team disagrees with the PHP parser's seemingly-random
4171 # rules regarding dd/dt on the next two tests. Parsoid is more
4172 # consistent, and recognizes the shared nesting and keeps the
4173 # still-open tags around until the nesting is complete.
4174 # (And tidy again converts <dt> to <dd> before 'bar'.)
4175
4176 !! test
4177 Definition Lists: Mixed Lists: Test 11
4178 !! wikitext
4179 *#*#;*;;foo :bar
4180 *#*#;boo :baz
4181 !! html/php
4182 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4183 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4184 <dl><dt>boo&#160;</dt>
4185 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4186
4187 !! html/php+tidy
4188 <ul>
4189 <li>
4190 <ol>
4191 <li>
4192 <ul>
4193 <li>
4194 <ol>
4195 <li>
4196 <dl>
4197 <dt>foo&#160;</dt>
4198 <dd>
4199 <ul>
4200 <li>
4201 <dl>
4202 <dd>
4203 <dl>
4204 <dt>bar</dt>
4205 </dl>
4206 </dd>
4207 </dl>
4208 </li>
4209 </ul>
4210 </dd>
4211 </dl>
4212 <dl>
4213 <dt>boo&#160;</dt>
4214 <dd>baz</dd>
4215 </dl>
4216 </li>
4217 </ol>
4218 </li>
4219 </ul>
4220 </li>
4221 </ol>
4222 </li>
4223 </ul>
4224 !! html/parsoid
4225 <ul>
4226 <li>
4227 <ol>
4228 <li>
4229 <ul>
4230 <li>
4231 <ol>
4232 <li>
4233 <dl>
4234 <dt>
4235 <ul>
4236 <li>
4237 <dl>
4238 <dt>
4239 <dl>
4240 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4241 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4242 </dl></dt>
4243 </dl></li>
4244 </ul></dt>
4245 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4246 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4247 </dl></li>
4248 </ol></li>
4249 </ul></li>
4250 </ol></li>
4251 </ul>
4252 !! end
4253
4254
4255 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4256 # From whitelist:
4257 # * The test is wrong, there are two colons where there should be :;
4258 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4259 !! test
4260 Definition Lists: Weird Ones: Test 1
4261 !! wikitext
4262 *#;*::;; foo : bar (who uses this?)
4263 !! html/php
4264 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4265 <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>
4266
4267 !! html/php+tidy
4268 <ul>
4269 <li>
4270 <ol>
4271 <li>
4272 <dl>
4273 <dt>foo&#160;</dt>
4274 <dd>
4275 <ul>
4276 <li>
4277 <dl>
4278 <dd>
4279 <dl>
4280 <dd>
4281 <dl>
4282 <dd>
4283 <dl>
4284 <dt>bar (who uses this?)</dt>
4285 </dl>
4286 </dd>
4287 </dl>
4288 </dd>
4289 </dl>
4290 </dd>
4291 </dl>
4292 </li>
4293 </ul>
4294 </dd>
4295 </dl>
4296 </li>
4297 </ol>
4298 </li>
4299 </ul>
4300 !! html/parsoid
4301 <ul>
4302 <li>
4303 <ol>
4304 <li>
4305 <dl>
4306 <dt>
4307 <ul>
4308 <li>
4309 <dl>
4310 <dd>
4311 <dl>
4312 <dd>
4313 <dl>
4314 <dt>
4315 <dl>
4316 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4317 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4318 </dl></dt>
4319 </dl></dd>
4320 </dl></dd>
4321 </dl></li>
4322 </ul></dt>
4323 </dl></li>
4324 </ol></li>
4325 </ul>
4326 !! end
4327
4328 !! test
4329 Definition Lists: colons occurring in tags
4330 !! wikitext
4331 ;a:b
4332 ;'''a:b'''
4333 ;<i>a:b</i>
4334 ;<span>a:b</span>
4335 ;<div>a:b</div>
4336 ;<div>a
4337 :b</div>
4338 ;{{echo|a:b}}
4339 ;{{echo|''a:b''}}
4340 ;;;''a:b''
4341 !! html+tidy
4342 <dl>
4343 <dt>a</dt>
4344 <dd>b</dd>
4345 <dt><b>a:b</b></dt>
4346 <dt><i>a:b</i></dt>
4347 <dt><span>a:b</span></dt>
4348 <dd>
4349 <div>a:b</div>
4350 </dd>
4351 <dd>
4352 <div>a
4353 <dl>
4354 <dd>b</dd>
4355 </dl>
4356 </div>
4357 </dd>
4358 <dt>a</dt>
4359 <dd>b</dd>
4360 <dt><i>a:b</i></dt>
4361 </dl>
4362 <dl>
4363 <dd>
4364 <dl>
4365 <dd>
4366 <dl>
4367 <dt><i>a:b</i></dt>
4368 </dl>
4369 </dd>
4370 </dl>
4371 </dd>
4372 </dl>
4373 !! html/parsoid
4374 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4375 <dt><b>a:b</b></dt>
4376 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4377 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4378 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4379 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4380 <dd>b</dd>
4381 <dt><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a:b"}},"i":0}}]}'>a:b</span></dt>
4382 <dt><i about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;a:b&#39;&#39;"}},"i":0}}]}'>a:b</i>
4383 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4384 !! end
4385
4386 !! test
4387 Definition Lists: colons and tables 1
4388 !! wikitext
4389 :{|
4390 | x
4391 |}
4392 :{|
4393 | y
4394 |}
4395 !! html
4396 <dl><dd><table>
4397 <tr>
4398 <td> x
4399 </td></tr></table></dd></dl>
4400 <dl><dd><table>
4401 <tr>
4402 <td> y
4403 </td></tr></table></dd></dl>
4404
4405 !! end
4406
4407 # Parsoid's output (as documented below) differs from php's in this case.
4408 # This is probably a bug. If we fixup parsoid to match php's output, the
4409 # above test should pass and the below test case can be removed. It is
4410 # unclear which output is more desirable.
4411
4412 !! test
4413 Definition Lists: colons and tables 2
4414 !! wikitext
4415 :{|
4416 | x
4417 |}
4418 :{|
4419 | y
4420 |}
4421 !! html/parsoid
4422 <dl><dd><table>
4423 <tr>
4424 <td> x
4425 </td></tr></table></dd>
4426 <dd><table>
4427 <tr>
4428 <td> y
4429 </td></tr></table></dd></dl>
4430 !! end
4431
4432 !! test
4433 Definition Lists: template interaction
4434 !! wikitext
4435 ::{{definition_list}}
4436
4437 :one
4438 ::{{definition_list}}
4439 :::two
4440 :::three
4441 ::four
4442 !! html/parsoid
4443 <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">
4444 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4445
4446 <dl><dd data-parsoid='{}'>one
4447 <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">
4448 </span><dd about="#mwt2">two
4449 <dl><dd>two</dd>
4450 <dd>three</dd></dl></dd>
4451 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4452 !! end
4453
4454
4455 ###
4456 ### External links
4457 ###
4458 !! test
4459 External links: non-bracketed
4460 !! wikitext
4461 Non-bracketed: http://example.com
4462 !! html
4463 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4464 </p>
4465 !! end
4466
4467 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4468 !! test
4469 External links: numbered
4470 !! wikitext
4471 Numbered: [http://example.com]
4472 Numbered: [http://example.net]
4473 Numbered: [http://example.com]
4474 !! html/php
4475 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4476 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4477 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4478 </p>
4479 !! html/parsoid
4480 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4481 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4482 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4483 !!end
4484
4485 !! test
4486 External links: specified text
4487 !! wikitext
4488 Specified text: [http://example.com link]
4489 !! html
4490 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4491 </p>
4492 !!end
4493
4494 !! test
4495 External links: trail
4496 !! wikitext
4497 Linktrails should not work for external links: [http://example.com link]s
4498 !! html
4499 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4500 </p>
4501 !! end
4502
4503 !! test
4504 External links: dollar sign in URL
4505 !! wikitext
4506 http://example.com/1$2345
4507 !! html
4508 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4509 </p>
4510 !! end
4511
4512 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4513 !! test
4514 External links: dollar sign in URL (autonumber)
4515 !! wikitext
4516 [http://example.com/1$2345]
4517 !! html/php
4518 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4519 </p>
4520 !! html/parsoid
4521 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4522 !!end
4523
4524 !! test
4525 External links: open square bracket forbidden in URL (bug 4377)
4526 !! options
4527 parsoid=wt2html,wt2wt,html2html
4528 !! wikitext
4529 http://example.com/1[2345
4530 !! html/php
4531 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4532 </p>
4533 !! html/parsoid
4534 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4535 !! end
4536
4537 !! test
4538 External links: open square bracket forbidden in URL (named) (bug 4377)
4539 !! options
4540 parsoid=wt2html,html2html
4541 !! wikitext
4542 [http://example.com/1[2345]
4543 !! html/php
4544 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4545 </p>
4546 !! html/parsoid
4547 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4548 !!end
4549
4550 # parsoid adds a space before the link name
4551 !! test
4552 External links: open square bracket forbidden in URL (named) (bug 4377)
4553 Parsoid variant.
4554 !! wikitext
4555 [http://example.com/1 [2345]
4556 !! html
4557 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4558 </p>
4559 !!end
4560
4561 !! test
4562 External links: nowiki in URL link text (bug 6230)
4563 !! wikitext
4564 [http://example.com/ <nowiki>''example site''</nowiki>]
4565 !! html
4566 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4567 </p>
4568 !! end
4569
4570 !! test
4571 External links: newline forbidden in text (bug 6230 regression check)
4572 !! wikitext
4573 [http://example.com/ first
4574 second]
4575 !! html
4576 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4577 second]
4578 </p>
4579 !!end
4580
4581 !! test
4582 External links: Pipe char between url and text
4583 !! wikitext
4584 [http://example.com | link]
4585 !! html
4586 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4587 </p>
4588 !!end
4589
4590 !! test
4591 External links: protocol-relative URL in brackets
4592 !! wikitext
4593 [//example.com/ Test]
4594 !! html
4595 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4596 </p>
4597 !! end
4598
4599 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4600 !! test
4601 External links: protocol-relative URL in brackets without text
4602 !! wikitext
4603 [//example.com]
4604 !! html/php
4605 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4606 </p>
4607 !! html/parsoid
4608 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4609 !! end
4610
4611 !! test
4612 External links: protocol-relative URL in free text is left alone
4613 !! wikitext
4614 //example.com/Foo
4615 !! html
4616 <p>//example.com/Foo
4617 </p>
4618 !!end
4619
4620 !! test
4621 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4622 !! wikitext
4623 foo//example.com/Foo
4624 !! html
4625 <p>foo//example.com/Foo
4626 </p>
4627 !! end
4628
4629 !! test
4630 External links: with no contents
4631 !! wikitext
4632 [http://en.wikipedia.org/wiki/Foo]
4633
4634 [[wikipedia:Foo|Bar]]
4635
4636 [[wikipedia:Foo|<span>Bar</span>]]
4637 !! html/php
4638 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4639 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4640 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4641 </p>
4642 !! html/parsoid
4643 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4644 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4645 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4646 !! end
4647
4648 !! test
4649 External links: Free with trailing punctuation
4650 !! wikitext
4651 http://example.com,
4652 http://example.com;
4653 http://example.com\
4654 http://example.com.
4655 http://example.com:
4656 http://example.com!
4657 http://example.com?
4658 http://example.com)
4659 http://example.com/url_with_(brackets)
4660 (http://example.com/url_without_brackets)
4661 http://example.com/url_with_entity&amp;
4662 http://example.com/url_with_entity&#x26;
4663 http://example.com/url_with_entity&#038;
4664 http://example.com/url_with_entity&nbsp;
4665 http://example.com/url_with_entity&#xA0;
4666 http://example.com/url_with_entity&#160;
4667 http://example.com/url_with_entity&lt;
4668 http://example.com/url_with_entity&#x3C;
4669 http://example.com/url_with_entity&#60;
4670 !! html/php
4671 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4672 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4673 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4674 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4675 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4676 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4677 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4678 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4679 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4680 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4681 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4682 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4683 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4684 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4685 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4686 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4687 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4688 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4689 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4690 </p>
4691 !! html/parsoid
4692 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4693 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4694 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4695 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4696 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4697 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4698 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4699 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4700 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4701 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4702 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4703 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4704 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4705 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>
4706 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>
4707 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>
4708 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>
4709 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x3C;","srcContent":"&lt;"}'>&lt;</span>
4710 <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>
4711 !! end
4712
4713 !! test
4714 External links: tricky Parsoid html2html case
4715 !! options
4716 parsoid=wt2html,wt2wt,html2html
4717 !! wikitext
4718 http://example.com/url_with_entity&amp;amp;
4719 !! html/php
4720 <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>;
4721 </p>
4722 !! html/parsoid
4723 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4724 !! end
4725
4726 !! test
4727 External links: Free with trailing quotes (T113666)
4728 !! wikitext
4729 '''News:''' Stuff here
4730
4731 news:'a'b''c''d e
4732 !! html/php
4733 <p><b>News:</b> Stuff here
4734 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4735 </p>
4736 !! html/parsoid
4737 <p><b>News:</b> Stuff here</p>
4738 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4739 !! end
4740
4741 !! test
4742 External links: Lone protocols are never linked (T105697)
4743 !! wikitext
4744 http://
4745 http://;
4746 (http://)
4747 bitcoin:
4748 bitcoin:;
4749 (bitcoin:)
4750 !! html
4751 <p>http://
4752 http://;
4753 (http://)
4754 bitcoin:
4755 bitcoin:;
4756 (bitcoin:)
4757 </p>
4758 !! end
4759
4760 !! test
4761 External links: No preceding word characters allowed (bug 65278)
4762 !! wikitext
4763 NOPEhttp://example.com
4764 N0http://example.com
4765 ok:http://example.com
4766 ok-http://example.com
4767 !! html
4768 <p>NOPEhttp://example.com
4769 N0http://example.com
4770 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4771 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4772 </p>
4773 !! end
4774
4775 !! test
4776 External image
4777 !! wikitext
4778 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4779 !! html
4780 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4781 </p>
4782 !! end
4783
4784 !! test
4785 External image from https
4786 !! wikitext
4787 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4788 !! html
4789 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4790 </p>
4791 !! end
4792
4793 !! test
4794 External image (when not allowed)
4795 !! options
4796 wgAllowExternalImages=0
4797 !! wikitext
4798 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4799 !! html
4800 <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>
4801 </p>
4802 !! end
4803
4804 !! test
4805 Link to non-http image, no img tag
4806 !! wikitext
4807 Link to non-http image, no img tag: ftp://example.com/test.jpg
4808 !! html
4809 <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>
4810 </p>
4811 !! end
4812
4813 !! test
4814 External links: terminating separator
4815 !! wikitext
4816 Terminating separator: http://example.com/thing,
4817 !! html
4818 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4819 </p>
4820 !! end
4821
4822 !! test
4823 External links: intervening separator
4824 !! wikitext
4825 Intervening separator: http://example.com/1,2,3
4826 !! html
4827 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4828 </p>
4829 !! end
4830
4831 !! test
4832 External links: old bug with URL in query
4833 !! wikitext
4834 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4835 !! html
4836 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4837 </p>
4838 !! end
4839
4840 !! test
4841 External links: old URL-in-URL bug, mixed protocols
4842 !! wikitext
4843 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4844 !! html
4845 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4846 </p>
4847 !!end
4848
4849 !! test
4850 External links: URL in text
4851 !! wikitext
4852 URL in text: [http://example.com http://example.com]
4853 !! html
4854 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4855 </p>
4856 !! end
4857
4858 !! test
4859 External links: Clickable images
4860 !! wikitext
4861 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4862 !! html/php
4863 <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>
4864 </p>
4865 !! html/parsoid
4866 <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>
4867 !! end
4868
4869 !! test
4870 External links: raw ampersand
4871 !! wikitext
4872 Old &amp; use: http://x&y
4873 !! html
4874 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4875 </p>
4876 !! end
4877
4878 !! test
4879 External links: encoded ampersand
4880 !! wikitext
4881 Old &amp; use: http://x&amp;y
4882 !! html/php
4883 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4884 </p>
4885 !! html/parsoid
4886 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4887 !! end
4888
4889 !! test
4890 External links: encoded equals (bug 6102)
4891 !! wikitext
4892 http://example.com/?foo&#61;bar
4893 !! html/php
4894 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4895 </p>
4896 !! html/parsoid
4897 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4898 !! end
4899
4900 ##
4901 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4902 ## does it number them. As discussed in bug 53505, we can identify
4903 ## autonumbered links via CSS.
4904 ##
4905
4906 !! test
4907 External links: [raw ampersand]
4908 !! wikitext
4909 Old &amp; use: [http://x&y]
4910 !! html/php
4911 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4912 </p>
4913 !! html/parsoid
4914 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4915 !! end
4916
4917 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4918 # mode will return the [raw ampersand] wikitext
4919 !! test
4920 External links: [encoded ampersand]
4921 !! options
4922 parsoid=wt2html,wt2wt,html2html
4923 !! wikitext
4924 Old &amp; use: [http://x&amp;y]
4925 !! html/php
4926 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4927 </p>
4928 !! html/parsoid
4929 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4930 !! end
4931
4932 !! test
4933 External links: [raw equals]
4934 !! wikitext
4935 [http://example.com/?foo=bar]
4936 !! html/php
4937 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4938 </p>
4939 !! html/parsoid
4940 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4941 !! end
4942
4943 # note that parsoid html is identical to [raw equals] case; so html2wt
4944 # mode will return the [raw equals] wikitext
4945 !! test
4946 External links: [encoded equals] (bug 6102)
4947 !! options
4948 parsoid=wt2html,wt2wt,html2html
4949 !! wikitext
4950 [http://example.com/?foo&#61;bar]
4951 !! html/php
4952 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4953 </p>
4954 !! html/parsoid
4955 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4956 !! end
4957
4958 # xxx parsoid strips the IDN character, so the round-trip tests will
4959 # obviously fail and are disabled. --cscott
4960 !! test
4961 External links: [IDN ignored character reference in hostname; strip it right off]
4962 !! options
4963 parsoid=wt2html,wt2wt,html2html
4964 !! wikitext
4965 [http://e&zwnj;xample.com/]
4966 !! html/php
4967 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4968 </p>
4969 !! html/parsoid
4970 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4971 !! end
4972
4973 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4974 # Where an external link could easily circumvent the sanitization of the text of
4975 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4976 # test demands a higher standard. That's a bit strange.
4977 #
4978 # Example:
4979 #
4980 # http://e‌xample.com -> [http://example.com|http://example.com]
4981 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4982 #
4983 # The first example is sanitized, but the second is not. Any security benefits
4984 # from this production are trivial to circumvent. Either remove this test and
4985 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4986 # the test accordingly.
4987 #
4988 # All our love,
4989 # The Parsoid team.
4990 # xxx parsoid strips the IDN character, so the round-trip tests will
4991 # obviously fail and are disabled. --cscott
4992 !! test
4993 External links: IDN ignored character reference in hostname; strip it right off
4994 !! options
4995 parsoid=wt2html,html2html
4996 !! wikitext
4997 http://e&zwnj;xample.com/
4998 !! html/php
4999 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
5000 </p>
5001 !! html/parsoid
5002 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
5003 !! end
5004
5005 !! test
5006 External links: www.jpeg.org (bug 554)
5007 !! wikitext
5008 http://www.jpeg.org
5009 !! html
5010 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5011 </p>
5012 !! end
5013
5014 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
5015 !! test
5016 External links: URL within URL (original bug 2)
5017 !! wikitext
5018 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5019 !! html/php
5020 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5021 </p>
5022 !! html/parsoid
5023 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5024 !! end
5025
5026 !! test
5027 BUG 361: URL inside bracketed URL
5028 !! wikitext
5029 [http://www.example.com/foo http://www.example.com/bar]
5030 !! html
5031 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5032 </p>
5033 !! end
5034
5035 !! test
5036 BUG 361: URL within URL, not bracketed
5037 !! wikitext
5038 http://www.example.com/foo?=http://www.example.com/bar
5039 !! html
5040 <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>
5041 </p>
5042 !! end
5043
5044 !! test
5045 BUG 289: ">"-token in URL-tail
5046 !! wikitext
5047 http://www.example.com/<hello>
5048 !! html
5049 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5050 </p>
5051 !!end
5052
5053 !! test
5054 BUG 289: literal ">"-token in URL-tail
5055 !! wikitext
5056 http://www.example.com/<b>html</b>
5057 !! html/php
5058 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5059 </p>
5060 !! html/parsoid
5061 <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>
5062 !! end
5063
5064 !! test
5065 BUG 289: ">"-token in bracketed URL
5066 !! wikitext
5067 [http://www.example.com/<hello> stuff]
5068 !! html
5069 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5070 </p>
5071 !!end
5072
5073 !! test
5074 BUG 289: literal ">"-token in bracketed URL
5075 !! wikitext
5076 [http://www.example.com/<b>html</b> stuff]
5077 !! html
5078 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5079 </p>
5080 !!end
5081
5082 !! test
5083 BUG 289: literal double quote at end of URL
5084 !! wikitext
5085 http://www.example.com/"hello"
5086 !! html
5087 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5088 </p>
5089 !!end
5090
5091 !! test
5092 BUG 289: literal double quote in bracketed URL
5093 !! wikitext
5094 [http://www.example.com/"hello" stuff]
5095 !! html
5096 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5097 </p>
5098 !!end
5099
5100 !! test
5101 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5102 !! wikitext
5103 [http://www.example.com test]
5104 !! html
5105 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5106 </p>
5107 !! end
5108
5109 !! test
5110 External links: link text with spaces
5111 !! wikitext
5112 [http://www.example.com a b c]
5113 [http://www.example.com ''a'' ''b'']
5114 !! html
5115 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5116 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5117 </p>
5118 !! end
5119
5120 !! test
5121 External links: wiki links within external link (Bug 3695)
5122 !! options
5123 parsoid=wt2html,html2html
5124 !! wikitext
5125 [http://example.com [[wikilink]] embedded in ext link]
5126 !! html/php
5127 <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>
5128 </p>
5129 !! html/parsoid
5130 <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>
5131 !! end
5132
5133 !! test
5134 BUG 787: Links with one slash after the url protocol are invalid
5135 !! wikitext
5136 http:/example.com
5137
5138 [http:/example.com title]
5139 !! html
5140 <p>http:/example.com
5141 </p><p>[http:/example.com title]
5142 </p>
5143 !! end
5144
5145 !! test
5146 Bracketed external links with template-generated invalid target
5147 !! wikitext
5148 [{{echo|http:/example.com}} title]
5149 !! html
5150 <p>[http:/example.com title]
5151 </p>
5152 !! end
5153
5154 !! test
5155 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5156 !! wikitext
5157 ''[http://example.com text'']
5158 [http://example.com '''text]'''
5159 ''Something [http://example.com in italic'']
5160 ''Something [http://example.com mixed''''', even bold]'''
5161 '''''Now [http://example.com both''''']
5162 !! html
5163 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5164 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5165 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5166 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5167 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5168 </p>
5169 !! end
5170
5171
5172 !! test
5173 Bug 4781: %26 in URL
5174 !! wikitext
5175 http://www.example.com/?title=AT%26T
5176 !! html/php
5177 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5178 </p>
5179 !! html/parsoid
5180 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5181 !! end
5182
5183 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5184 # % is actually legal in HTML5. Any change in output would need testing though.
5185 !! test
5186 Bug 4781, 5267: %25 in URL
5187 !! wikitext
5188 http://www.example.com/?title=100%25_Bran
5189 !! html/php
5190 <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>
5191 </p>
5192 !! html/parsoid
5193 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5194 !! end
5195
5196 !! test
5197 Bug 4781, 5267: %28, %29 in URL
5198 !! wikitext
5199 http://www.example.com/?title=Ben-Hur_%281959_film%29
5200 !! html/php
5201 <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>
5202 </p>
5203 !! html/parsoid
5204 <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>
5205 !! end
5206
5207
5208 !! test
5209 Bug 4781: %26 in autonumber URL
5210 !! wikitext
5211 [http://www.example.com/?title=AT%26T]
5212 !! html/php
5213 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5214 </p>
5215 !! html/parsoid
5216 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5217 !! end
5218
5219 !! test
5220 Bug 4781, 5267: %26 in autonumber URL
5221 !! wikitext
5222 [http://www.example.com/?title=100%25_Bran]
5223 !! html/php
5224 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5225 </p>
5226 !! html/parsoid
5227 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5228 !! end
5229
5230 !! test
5231 Bug 4781, 5267: %28, %29 in autonumber URL
5232 !! wikitext
5233 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5234 !! html/php
5235 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5236 </p>
5237 !! html/parsoid
5238 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5239 !! end
5240
5241
5242 !! test
5243 Bug 4781: %26 in bracketed URL
5244 !! wikitext
5245 [http://www.example.com/?title=AT%26T link]
5246 !! html/php
5247 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5248 </p>
5249 !! html/parsoid
5250 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5251 !! end
5252
5253 !! test
5254 Bug 4781, 5267: %25 in bracketed URL
5255 !! wikitext
5256 [http://www.example.com/?title=100%25_Bran link]
5257 !! html
5258 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5259 </p>
5260 !! end
5261
5262 !! test
5263 Bug 4781, 5267: %28, %29 in bracketed URL
5264 !! wikitext
5265 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5266 !! html/php
5267 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5268 </p>
5269 !! html/parsoid
5270 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5271 !! end
5272
5273 !! test
5274 External link containing a period in the anchor. (bug 63947)
5275 !! wikitext
5276 [//foo.org/bar#baz. bang]
5277
5278 [//foo.org/bar. bang]
5279 !! html/php
5280 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5281 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5282 </p>
5283 !! html/parsoid
5284 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5285 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5286 !! end
5287
5288 !! test
5289 External link containing a single quote. (bug 63947)
5290 !! wikitext
5291 [//foo.org/bar'baz]
5292
5293 [//foo.org/bar'baz bang]
5294 !! html/php
5295 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5296 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5297 </p>
5298 !! html/parsoid
5299 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5300 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5301 !! end
5302
5303 !! test
5304 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5305 !! wikitext
5306 Some [http://example.com/ pretty ''italics'' and stuff]!
5307 !! html
5308 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5309 </p>
5310 !! end
5311
5312 !! test
5313 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5314 !! wikitext
5315 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5316 !! html
5317 <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>
5318 </p>
5319 !! end
5320
5321 !! test
5322 External link containing double-single-quotes with no space separating the url from text in italics
5323 !! wikitext
5324 [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]].]
5325 !! html/php
5326 <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>
5327 </p>
5328 !! html/php+tidy
5329 <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>
5330 !! html/parsoid
5331 <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>
5332 !! end
5333
5334 !! test
5335 External link with comments in link text
5336 !! wikitext
5337 [http://www.google.com Google <!-- comment -->]
5338 !! html/php
5339 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5340 </p>
5341 !! html/parsoid
5342 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5343 !! end
5344
5345 !! test
5346 External link to bare IPv4 address
5347 !! wikitext
5348 [http://192.168.0.1 Link]
5349 !! html/php
5350 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5351 </p>
5352 !! html/parsoid
5353 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5354 !! end
5355
5356 !! test
5357 URL-encoding in URL functions (single parameter)
5358 !! wikitext
5359 {{localurl:Some page|amp=&}}
5360 !! html
5361 <p>/index.php?title=Some_page&amp;amp=&amp;
5362 </p>
5363 !! end
5364
5365 !! test
5366 URL-encoding in URL functions (multiple parameters)
5367 !! wikitext
5368 {{localurl:Some page|q=?&amp=&}}
5369 !! html
5370 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5371 </p>
5372 !! end
5373
5374 !! test
5375 Brackets in urls
5376 !! wikitext
5377 http://example.com/index.php?foozoid%5B%5D=bar
5378
5379 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5380 !! html/php
5381 <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
5382 </p><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>
5383 </p>
5384 !! html/parsoid
5385 <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>
5386
5387 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5388 !! end
5389
5390 !! test
5391 IPv6 urls, autolink format (T23261)
5392 !! wikitext
5393 http://[2404:130:0:1000::187:2]/index.php
5394
5395 Examples from RFC 2373, section 2.2:
5396 * http://[1080::8:800:200C:417A]/unicast
5397 * http://[FF01::101]/multicast
5398 * http://[::1]/loopback
5399 * http://[::]/unspecified
5400 * http://[::13.1.68.3]/ipv4compat
5401 * http://[::FFFF:129.144.52.38]/ipv4compat
5402
5403 Examples from RFC 2732, section 2:
5404 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5405 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5406 * http://[3ffe:2a00:100:7031::1]
5407 * http://[1080::8:800:200C:417A]/foo
5408 * http://[::192.9.5.5]/ipng
5409 * http://[::FFFF:129.144.52.38]:80/index.html
5410 * http://[2010:836B:4179::836B:4179]
5411
5412 !! html/php
5413 <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>
5414 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5415 </p>
5416 <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>
5417 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5418 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5419 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5420 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5421 <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>
5422 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5423 </p>
5424 <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>
5425 <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>
5426 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5427 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5428 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5429 <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>
5430 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5431
5432 !! html/parsoid
5433 <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>
5434
5435 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5436 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5437 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5438 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5439 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5440 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5441 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5442
5443 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5444 <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>
5445 <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>
5446 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5447 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5448 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5449 <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>
5450 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5451 !! end
5452
5453 !! test
5454 IPv6 urls, bracketed format (T23261)
5455 !! wikitext
5456 [http://[2404:130:0:1000::187:2]/index.php test]
5457
5458 Examples from RFC 2373, section 2.2:
5459 * [http://[1080::8:800:200C:417A] unicast]
5460 * [http://[FF01::101] multicast]
5461 * [http://[::1]/ loopback]
5462 * [http://[::] unspecified]
5463 * [http://[::13.1.68.3] ipv4compat]
5464 * [http://[::FFFF:129.144.52.38] ipv4compat]
5465
5466 Examples from RFC 2732, section 2:
5467 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5468 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5469 * [http://[3ffe:2a00:100:7031::1] 3]
5470 * [http://[1080::8:800:200C:417A]/foo 4]
5471 * [http://[::192.9.5.5]/ipng 5]
5472 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5473 * [http://[2010:836B:4179::836B:4179] 7]
5474
5475 !! html/php
5476 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5477 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5478 </p>
5479 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5480 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5481 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5482 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5483 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5484 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5485 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5486 </p>
5487 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5488 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5489 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5490 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5491 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5492 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5493 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5494
5495 !! html/parsoid
5496 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5497
5498 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5499 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5500 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5501 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5502 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5503 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5504 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5505
5506 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5507 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5508 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5509 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5510 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5511 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5512 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5513 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5514 !! end
5515
5516 !! test
5517 Non-extlinks in brackets
5518 !! wikitext
5519 [foo]
5520 [foo bar]
5521 [foo ''bar'']
5522 [fool's] errand
5523 [fool's errand]
5524 [{{echo|foo}}]
5525 [{{echo|foo}} bar]
5526 [{{echo|foo}} ''bar'']
5527 [{{echo|foo}}l's] errand
5528 [{{echo|foo}}l's errand]
5529 [url={{echo|foo}}]
5530 [url=http://example.com]
5531 [http:// bare protocols don't count]
5532 !! html/php
5533 <p>[foo]
5534 [foo bar]
5535 [foo <i>bar</i>]
5536 [fool's] errand
5537 [fool's errand]
5538 [foo]
5539 [foo bar]
5540 [foo <i>bar</i>]
5541 [fool's] errand
5542 [fool's errand]
5543 [url=foo]
5544 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5545 [http:// bare protocols don't count]
5546 </p>
5547 !! html/parsoid
5548 <p>[foo]
5549 [foo bar]
5550 [foo <i>bar</i>]
5551 [fool's] errand
5552 [fool's errand]
5553 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5554 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5555 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5556 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5557 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5558 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5559 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5560 [http:// bare protocols don't count]</p>
5561 !! end
5562
5563 !! test
5564 Percent encoding in external links
5565 !! wikitext
5566 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5567 !! html/php
5568 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5569 </p>
5570 !! html/parsoid
5571 <p><a rel="mw:ExtLink"
5572 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5573 !! end
5574
5575 !! test
5576 Use url link syntax for links where the content is equal the link target
5577 !! wikitext
5578 http://example.com
5579 !! html/php
5580 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5581 </p>
5582 !! html/parsoid
5583 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5584 !! end
5585
5586 !! test
5587 Parenthesis in external links, especially URL links
5588 !! wikitext
5589 http://example.com)
5590
5591 http://example.com/test)
5592
5593 http://example.com/(test)
5594
5595 http://example.com/((test)
5596
5597 (http://example.com/(test))
5598
5599 (http://example.com/(test)))))
5600
5601 http://example.com/a)b
5602
5603 [http://example.com) foo]
5604 !! html/php
5605 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5606 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5607 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5608 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5609 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5610 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5611 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5612 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5613 </p>
5614 !! html/parsoid
5615 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5616 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5617 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5618 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5619 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5620 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5621 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5622 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5623 !! end
5624
5625 !! test
5626 Parenthesis in external links, w/ transclusion or comment
5627 !! wikitext
5628 (http://example.com/{{echo|hi}})
5629
5630 (http://example.com<!-- hi -->)
5631 !! html/php
5632 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5633 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5634 </p>
5635 !! html/parsoid
5636 <p>(<a typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[20,31,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;hi&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
5637
5638 <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>
5639 !! end
5640
5641 !! test
5642 Serialize <a> tags with invalid link targets as plain text
5643 !! options
5644 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5645 !! html/parsoid
5646 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5647 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5648 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5649 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5650 !! wikitext
5651 text
5652 <nowiki>*</nowiki>text
5653 <nowiki>[[foo]]</nowiki>
5654 <nowiki>*a [[foo]]</nowiki>
5655 !! end
5656
5657 !! test
5658 mw:ExtLink -vs- mw:WikiLink (T94723)
5659 !! options
5660 parsoid=html2wt
5661 !! html/parsoid
5662 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"},"dsr":[0,11,6,2]}'>Bar</a>
5663 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5664 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5665 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5666 <p>
5667 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5668 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5669 </p>
5670 !! wikitext
5671 [[Foo|Bar]]
5672 [[Foo|Bar]]
5673 [[wikipedia:Foo|Bar]]
5674 [[wikipedia:Foo|Bar]]
5675
5676 [[wikipedia:European_Robin|European Robin]]
5677 [[wikipedia:European_Robin|European Robin]]
5678 !! end
5679
5680 !! test
5681 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5682 !! options
5683 parsoid=wt2wt
5684 !! wikitext
5685 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5686 !! html/parsoid
5687 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5688 !! end
5689
5690
5691 ###
5692 ### Quotes
5693 ###
5694
5695 !! test
5696 Quotes
5697 !! wikitext
5698 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5699
5700 Normal text. '''''Bold italic text.''''' Normal text.
5701 !! html
5702 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5703 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5704 </p>
5705 !! end
5706
5707
5708 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5709 # parser strips. The wikitext contains just the first half of the bold
5710 # quote pair.
5711 !! test
5712 Unclosed and unmatched quotes
5713 !! wikitext
5714 '''''Bold italic text '''with bold deactivated''' in between.'''''
5715
5716 '''''Bold italic text ''with italic deactivated'' in between.'''''
5717
5718 '''Bold text..
5719
5720 ..spanning two paragraphs (should not work).'''
5721
5722 '''Bold tag left open
5723
5724 ''Italic tag left open
5725
5726 Normal text.
5727
5728 <!-- Unmatching number of opening, closing tags: -->
5729 '''This year''''s election ''should'' beat '''last year''''s.
5730
5731 ''Tom'''s car is bigger than ''Susan'''s.
5732
5733 Plain ''italic'''s plain
5734 !! html/php
5735 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5736 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5737 </p><p><b>Bold text..</b>
5738 </p><p>..spanning two paragraphs (should not work).
5739 </p><p><b>Bold tag left open</b>
5740 </p><p><i>Italic tag left open</i>
5741 </p><p>Normal text.
5742 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5743 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5744 </p><p>Plain <i>italic'</i>s plain
5745 </p>
5746 !! html/parsoid
5747 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5748 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5749 </p><p><b>Bold text..</b>
5750 </p><p>..spanning two paragraphs (should not work).<b></b>
5751 </p><p><b>Bold tag left open</b>
5752 </p><p><i>Italic tag left open</i>
5753 </p><p>Normal text.
5754 </p>
5755 <!-- Unmatching number of opening, closing tags: -->
5756 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5757 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5758 </p><p>Plain <i>italic'</i>s plain
5759 </p>
5760 !! end
5761
5762 ###
5763 ### Tables
5764 ###
5765 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5766 ###
5767
5768 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5769 # is the bare minimum required by the spec, see:
5770 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5771 # Parsoid team replies: empty table tags are legal in HTML5
5772 !! test
5773 A table with no data.
5774 !! options
5775 parsoid=wt2html
5776 !! wikitext
5777 {||}
5778 !! html/php
5779
5780 !! html/parsoid
5781 <table></table>
5782
5783 !! end
5784
5785 !! test
5786 A table with stray table end tags on start tag line (wt2html)
5787 !! options
5788 parsoid=wt2html
5789 !! wikitext
5790 {|style="color: red;"|}
5791
5792 {|style="color: red;" |}
5793 |foo
5794 |}
5795
5796 {|style="color: red;"|} id="foo"
5797 |foo
5798 |}
5799
5800 {|style="color: red;" |} id="foo"
5801 |foo
5802 |}
5803 !! html
5804 <table style="color: red;"></table>
5805
5806 <table style="color: red;">
5807 <tbody><tr>
5808 <td>foo</td>
5809 </tr></tbody>
5810 </table>
5811
5812 <table style="color: red;" id="foo">
5813 <tbody><tr>
5814 <td>foo</td>
5815 </tr></tbody>
5816 </table>
5817
5818 <table style="color: red;" id="foo">
5819 <tbody><tr>
5820 <td>foo</td>
5821 </tr></tbody>
5822 </table>
5823
5824 !! end
5825
5826 !! test
5827 A table with no data (take 2)
5828 !! wikitext
5829 {|
5830 |}
5831 !! html/parsoid
5832 <table></table>
5833 !! end
5834
5835 # A table with nothing but a caption is invalid XHTML, we might want to render
5836 # this as <p>caption</p>
5837 # Parsoid team replies: table with only a caption is legal in HTML5
5838 !! test
5839 A table with nothing but a caption
5840 !! wikitext
5841 {|
5842 |+ caption
5843 |}
5844 !! html/php
5845 <table>
5846 <caption> caption
5847 </caption><tr><td></td></tr></table>
5848
5849 !! html/parsoid
5850 <table><caption> caption</caption></table>
5851 !! end
5852
5853 !! test
5854 A table with caption with default-spaced attributes and a table row
5855 !! wikitext
5856 {|
5857 |+ style="color: red;" | caption1
5858 |-
5859 | foo
5860 |}
5861 !! html
5862 <table>
5863 <caption style="color: red;"> caption1
5864 </caption>
5865 <tr>
5866 <td> foo
5867 </td></tr></table>
5868
5869 !! end
5870
5871 !! test
5872 A table with captions with non-default spaced attributes and a table row
5873 !! wikitext
5874 {|
5875 |+style="color: red;"|caption2
5876 |+ style="color: red;"| caption3
5877 |-
5878 | foo
5879 |}
5880 !! html
5881 <table>
5882 <caption style="color: red;">caption2
5883 </caption>
5884 <caption style="color: red;"> caption3
5885 </caption>
5886 <tr>
5887 <td> foo
5888 </td></tr></table>
5889
5890 !! end
5891
5892 !! test
5893 Table td-cell syntax variations
5894 !! wikitext
5895 {|
5896 | foo bar foo | baz
5897 | foo bar foo || baz
5898 | style='color:red;' | baz
5899 | style='color:red;' || baz
5900 |}
5901 !! html
5902 <table>
5903 <tr>
5904 <td> baz
5905 </td>
5906 <td> foo bar foo </td>
5907 <td> baz
5908 </td>
5909 <td style="color:red;"> baz
5910 </td>
5911 <td> style='color:red;' </td>
5912 <td> baz
5913 </td></tr></table>
5914
5915 !! end
5916
5917 !! test
5918 Simple table
5919 !! wikitext
5920 {|
5921 | 1 || 2
5922 |-
5923 | 3 || 4
5924 |}
5925 !! html
5926 <table>
5927 <tr>
5928 <td> 1 </td>
5929 <td> 2
5930 </td></tr>
5931 <tr>
5932 <td> 3 </td>
5933 <td> 4
5934 </td></tr></table>
5935
5936 !! end
5937
5938 !! test
5939 Simple table but with multiple dashes for row wikitext
5940 !! wikitext
5941 {|
5942 | foo
5943 |-----
5944 | bar
5945 |}
5946 !! html
5947 <table>
5948 <tr>
5949 <td> foo
5950 </td></tr>
5951 <tr>
5952 <td> bar
5953 </td></tr></table>
5954
5955 !! end
5956
5957 !! test
5958 Multiplication table
5959 !! wikitext
5960 {| border="1" cellpadding="2"
5961 |+Multiplication table
5962 |-
5963 ! &times; !! 1 !! 2 !! 3
5964 |-
5965 ! 1
5966 | 1 || 2 || 3
5967 |-
5968 ! 2
5969 | 2 || 4 || 6
5970 |-
5971 ! 3
5972 | 3 || 6 || 9
5973 |-
5974 ! 4
5975 | 4 || 8 || 12
5976 |-
5977 ! 5
5978 | 5 || 10 || 15
5979 |}
5980 !! html
5981 <table border="1" cellpadding="2">
5982 <caption>Multiplication table
5983 </caption>
5984 <tr>
5985 <th> &#215; </th>
5986 <th> 1 </th>
5987 <th> 2 </th>
5988 <th> 3
5989 </th></tr>
5990 <tr>
5991 <th> 1
5992 </th>
5993 <td> 1 </td>
5994 <td> 2 </td>
5995 <td> 3
5996 </td></tr>
5997 <tr>
5998 <th> 2
5999 </th>
6000 <td> 2 </td>
6001 <td> 4 </td>
6002 <td> 6
6003 </td></tr>
6004 <tr>
6005 <th> 3
6006 </th>
6007 <td> 3 </td>
6008 <td> 6 </td>
6009 <td> 9
6010 </td></tr>
6011 <tr>
6012 <th> 4
6013 </th>
6014 <td> 4 </td>
6015 <td> 8 </td>
6016 <td> 12
6017 </td></tr>
6018 <tr>
6019 <th> 5
6020 </th>
6021 <td> 5 </td>
6022 <td> 10 </td>
6023 <td> 15
6024 </td></tr></table>
6025
6026 !! end
6027
6028 !! test
6029 Accept "||" in table headings
6030 !! wikitext
6031 {|
6032 !h1 || h2
6033 |}
6034 !! html
6035 <table>
6036 <tr>
6037 <th>h1 </th>
6038 <th> h2
6039 </th></tr></table>
6040
6041 !! end
6042
6043 !! test
6044 Accept "!!" in table data
6045 !! wikitext
6046 {|
6047 | Foo!! ||
6048 |}
6049 !! html
6050 <table>
6051 <tr>
6052 <td> Foo!! </td>
6053 <td>
6054 </td></tr></table>
6055
6056 !! html/parsoid
6057 <table>
6058 <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>
6059 </tbody></table>
6060 !! end
6061
6062 !! test
6063 Accept "||" in indented table headings
6064 !! wikitext
6065 :{|
6066 !h1 || h2
6067 |}
6068 !! html
6069 <dl><dd><table>
6070 <tr>
6071 <th>h1 </th>
6072 <th> h2
6073 </th></tr></table></dd></dl>
6074
6075 !! end
6076
6077 !! test
6078 Accept "!!" in templates
6079 !! wikitext
6080 {|
6081 !a {{echo|b!!c}}
6082 |}
6083 !! html/php
6084 <table>
6085 <tr>
6086 <th>a b</th>
6087 <th>c
6088 </th></tr></table>
6089
6090 !! html/parsoid
6091 <table>
6092 <tbody><tr><th typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[{"k":"1","spc":["","","",""]}]]}' 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>
6093 !! end
6094
6095 !! test
6096 Accept "!!" in table headings after newline
6097 !! wikitext
6098 {|
6099 !a
6100 b!!c
6101 |}
6102 !! html/php
6103 <table>
6104 <tr>
6105 <th>a
6106 <p>b!!c
6107 </p>
6108 </th></tr></table>
6109
6110 !! html/parsoid
6111 <table>
6112 <tbody><tr><th>a
6113 <p>b!!c</p></th></tr>
6114 </tbody></table>
6115 !! end
6116
6117 !! test
6118 Accept "!!" in table data of mixed wikitext / html syntax
6119 !! wikitext
6120 {|
6121 !a
6122 <tr><td>b!!c</td></tr>
6123 |}
6124 !! html+tidy
6125 <table>
6126 <tr>
6127 <th>a</th>
6128 </tr>
6129 <tr>
6130 <td>b!!c</td>
6131 </tr>
6132 </table>
6133 !! html/parsoid
6134 <table>
6135 <tbody><tr><th>a</th></tr>
6136 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6137 </tbody></table>
6138 !! end
6139
6140 !! test
6141 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6142 !! wikitext
6143 {|
6144 !| h1
6145 || a
6146 |}
6147 !! html
6148 <table>
6149 <tr>
6150 <th> h1
6151 </th>
6152 <td> a
6153 </td></tr></table>
6154
6155 !! end
6156
6157 !!test
6158 Accept "| !" at start of line in tables (ignore !-attribute)
6159 !! wikitext
6160 {|
6161 |-
6162 | !style="color:red" | bar
6163 |}
6164 !! html
6165 <table>
6166
6167 <tr>
6168 <td> bar
6169 </td></tr></table>
6170
6171 !!end
6172
6173 !!test
6174 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 +/-
6175 !! wikitext
6176 {|
6177 |-
6178 |style='color:red;'|+1
6179 |style='color:blue;'|-1
6180 |-
6181 | 1 || 2 || 3
6182 | 1 ||+2 ||-3
6183 |-
6184 | +1
6185 | -1
6186 |}
6187 !! html
6188 <table>
6189
6190 <tr>
6191 <td style="color:red;">+1
6192 </td>
6193 <td style="color:blue;">-1
6194 </td></tr>
6195 <tr>
6196 <td> 1 </td>
6197 <td> 2 </td>
6198 <td> 3
6199 </td>
6200 <td> 1 </td>
6201 <td>+2 </td>
6202 <td>-3
6203 </td></tr>
6204 <tr>
6205 <td> +1
6206 </td>
6207 <td> -1
6208 </td></tr></table>
6209
6210 !!end
6211
6212 !! test
6213 Table rowspan
6214 !! wikitext
6215 {| border=1
6216 | Cell 1, row 1
6217 |rowspan=2| Cell 2, row 1 (and 2)
6218 | Cell 3, row 1
6219 |-
6220 | Cell 1, row 2
6221 | Cell 3, row 2
6222 |}
6223 !! html
6224 <table border="1">
6225 <tr>
6226 <td> Cell 1, row 1
6227 </td>
6228 <td rowspan="2"> Cell 2, row 1 (and 2)
6229 </td>
6230 <td> Cell 3, row 1
6231 </td></tr>
6232 <tr>
6233 <td> Cell 1, row 2
6234 </td>
6235 <td> Cell 3, row 2
6236 </td></tr></table>
6237
6238 !! end
6239
6240 !! test
6241 Nested table
6242 !! wikitext
6243 {| border=1
6244 | &alpha;
6245 |
6246 {| bgcolor=#ABCDEF border=2
6247 |nested
6248 |-
6249 |table
6250 |}
6251 |the original table again
6252 |}
6253 !! html
6254 <table border="1">
6255 <tr>
6256 <td> &#945;
6257 </td>
6258 <td>
6259 <table bgcolor="#ABCDEF" border="2">
6260 <tr>
6261 <td>nested
6262 </td></tr>
6263 <tr>
6264 <td>table
6265 </td></tr></table>
6266 </td>
6267 <td>the original table again
6268 </td></tr></table>
6269
6270 !! end
6271
6272 !! test
6273 Invalid attributes in table cell (bug 1830)
6274 !! wikitext
6275 {|
6276 |Cell:|broken
6277 |}
6278 !! html
6279 <table>
6280 <tr>
6281 <td>broken
6282 </td></tr></table>
6283
6284 !! end
6285
6286 !! test
6287 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6288 !! wikitext
6289 {|
6290 | title="foo" |bar
6291 | title="foo<nowiki>|</nowiki>" |bar
6292 | title="foo<nowiki>|</nowiki>" bar
6293 |}
6294 !! html/php
6295 <table>
6296 <tr>
6297 <td title="foo">bar
6298 </td>
6299 <td title="foo&#124;">bar
6300 </td>
6301 <td> title="foo|" bar
6302 </td></tr></table>
6303
6304 !! html/parsoid
6305 <table>
6306 <tbody><tr><td title="foo">bar</td>
6307 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6308 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6309 </tbody></table>
6310 !! end
6311
6312 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6313 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6314 # *2wt modes will fail.
6315 !! test
6316 Table security: embedded pipes
6317 !! options
6318 parsoid=wt2html,html2html
6319 !! wikitext
6320 {|
6321 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6322 !! html/php
6323 <table>
6324 <tr>
6325 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6326 <td>]" onmouseover="alert(document.cookie)"&gt;test
6327 </td>
6328 </tr>
6329 </table>
6330
6331 !! html/parsoid
6332 <table><tbody>
6333 <tr>
6334 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6335 !! end
6336
6337 # FIXME: The output seems broken. Filed as T110268.
6338 !! test
6339 ! and || in td attributes should not be parsed as <th>/<td>
6340 !! options
6341 parsoid=wt2html
6342 !! wikitext
6343 {|
6344 | style="color: red !important;" data-contrived="put this here ||" | foo
6345 |}
6346 !! html/php
6347 <table>
6348 <tr>
6349 <td> style="color: red !important;" data-contrived="put this here </td>
6350 <td> foo
6351 </td></tr></table>
6352
6353 !! html/parsoid
6354 <table>
6355 <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>
6356 </tbody></table>
6357 !! end
6358
6359 !! test
6360 Indented table markup mixed with indented pre content (proposed in bug 6200)
6361 !! wikitext
6362 <table>
6363 <tr>
6364 <td>
6365 Text that should be rendered preformatted
6366 </td>
6367 </tr>
6368 </table>
6369 !! html
6370 <table>
6371 <tr>
6372 <td>
6373 <pre>Text that should be rendered preformatted
6374 </pre>
6375 </td>
6376 </tr>
6377 </table>
6378
6379 !! end
6380
6381 !! test
6382 1. Template-generated table cell attributes and cell content
6383 !! wikitext
6384 {|
6385 |{{table_attribs}}
6386 | {{table_attribs}}
6387 || {{table_attribs_5}}
6388 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6389 |align=center {{table_attribs}}
6390 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6391 |}
6392 !! html
6393 <table>
6394 <tr>
6395 <td style="color:red;">Foo
6396 </td>
6397 <td style="color:red;">Foo
6398 </td>
6399 <td> style="color:red;"</td>
6400 <td>Bar
6401 </td>
6402 <td style="color:red;">Foo
6403 </td>
6404 <td align="center" style="color:red;">Foo
6405 </td>
6406 <td align="center" style="color:red;">Foo
6407 </td></tr></table>
6408
6409 !! end
6410
6411 !! test
6412 2. Template-generated table cell attributes and cell content
6413 !! wikitext
6414 {|
6415 |{{table_attribs_2}}
6416 |}
6417 !! html/php
6418 <table>
6419 <tr>
6420 <td style="color:red;">Foo
6421 </td>
6422 <td>Bar</td>
6423 <td>Baz
6424 </td></tr></table>
6425
6426 !! html/parsoid
6427 <table>
6428 <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>
6429 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6430 </tbody></table>
6431 !! end
6432
6433 !! test
6434 3. Template-generated table cell attributes and cell content
6435 !! wikitext
6436 {|
6437 !align=center {{table_header_cells}}
6438 |-
6439 |align=center {{table_cells}}
6440 |}
6441 !! html/php
6442 <table>
6443 <tr>
6444 <th align="center" style="color:red;">Foo</th>
6445 <th style="color:red;"><i>Bar</i></th>
6446 <th style="color:brown;"><i>Foo</i> and Baz
6447 </th></tr>
6448 <tr>
6449 <td align="center" style="color:red;">Foo</td>
6450 <td style="color:red;"><i>Bar</i></td>
6451 <td style="color:brown;"><i>Foo</i> and Baz
6452 </td></tr></table>
6453
6454 !! html/parsoid
6455 <table>
6456 <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>
6457 <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>
6458 </tbody></table>
6459 !! end
6460
6461 !! test
6462 4. Template-generated table cell attributes and cell content inside a templated table
6463 !! wikitext
6464 {{tbl-start}}
6465 !align=center {{table_header_cells}}
6466 |-
6467 |align=center {{table_cells}}
6468 {{tbl-end}}
6469 !! html/php
6470 <table>
6471 <tr>
6472 <th align="center" style="color:red;">Foo</th>
6473 <th style="color:red;"><i>Bar</i></th>
6474 <th style="color:brown;"><i>Foo</i> and Baz
6475 </th></tr>
6476 <tr>
6477 <td align="center" style="color:red;">Foo</td>
6478 <td style="color:red;"><i>Bar</i></td>
6479 <td style="color:brown;"><i>Foo</i> and Baz
6480 </td></tr></table>
6481
6482 !! html/parsoid
6483 <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}}]}'>
6484 <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>
6485 <tr>
6486 <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>
6487 </tbody></table>
6488 !! end
6489
6490 ## Edge case fix to prevent future regressions
6491 !! test
6492 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6493 !! wikitext
6494 {|
6495 |{{table_attribs_7}}
6496 |}
6497 <references />
6498 !! html/parsoid
6499 <table>
6500 <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>
6501 </tbody></table>
6502 <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>
6503 !! end
6504
6505 !! test
6506 Table with row followed by newlines and table heading
6507 !! wikitext
6508 {|
6509 |-
6510
6511 ! foo
6512 |}
6513 !! html
6514 <table>
6515
6516
6517 <tr>
6518 <th> foo
6519 </th></tr></table>
6520
6521 !! end
6522
6523 !! test
6524 Table with empty line following the start tag
6525 !! wikitext
6526 {|
6527
6528 |-
6529 | foo
6530 |}
6531 !! html
6532 <table>
6533
6534
6535 <tr>
6536 <td> foo
6537 </td></tr></table>
6538
6539 !! end
6540
6541 # FIXME: Preserve the attribute properly (with an empty string as value) in
6542 # the PHP parser. Parsoid implements the behavior below.
6543 !! test
6544 Table attributes with empty value
6545 !! wikitext
6546 {|
6547 | style=| hello
6548 |}
6549 !! html/parsoid
6550 <table>
6551 <tbody>
6552 <tr>
6553 <td style=""> hello
6554 </td></tr></tbody></table>
6555
6556 !! end
6557
6558 !! test
6559 Wikitext table with a lot of comments
6560 !! wikitext
6561 {|
6562 <!-- c0 -->
6563 | foo
6564 <!-- c1 -->
6565 |-<!-- c2 -->
6566 <!-- c3 -->
6567 |<!-- c4 -->
6568 <!-- c5 -->
6569 |}
6570 !! html
6571 <table>
6572 <tr>
6573 <td> foo
6574 </td></tr>
6575 <tr>
6576 <td>
6577 </td></tr></table>
6578
6579 !! end
6580
6581 !! test
6582 Wikitext table comments represented in parsoid dom
6583 !! wikitext
6584 {|<!--c1--><!--c2-->
6585 |-<!--c3-->
6586 | x
6587 |}
6588 !! html/php+tidy
6589 <table>
6590 <tr>
6591 <td>x</td>
6592 </tr>
6593 </table>
6594 !! html/parsoid
6595 <table><!--c1--><!--c2-->
6596 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6597 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6598 </tbody></table>
6599 !! end
6600
6601 !! test
6602 Wikitext table with double-line table cell
6603 !! wikitext
6604 {|
6605 |a
6606 b
6607 |}
6608 !! html
6609 <table>
6610 <tr>
6611 <td>a
6612 <p>b
6613 </p>
6614 </td></tr></table>
6615
6616 !! end
6617
6618 !! test
6619 Table cell with a single comment
6620 !! wikitext
6621 {|
6622 | <!-- c1 -->
6623 | a
6624 |}
6625 !! html
6626 <table>
6627 <tr>
6628 <td>
6629 </td>
6630 <td> a
6631 </td></tr></table>
6632
6633 !! end
6634
6635 !! test
6636 Table-cell after a comment-only-empty-line
6637 !! wikitext
6638 {|
6639 |a
6640 <!--c1-->
6641 <!--c2-->| b
6642 |}
6643 !! html
6644 <table>
6645 <tr>
6646 <td>a
6647 </td>
6648 <td> b
6649 </td></tr></table>
6650
6651 !! html/parsoid
6652 <table>
6653 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6654 <!--c1-->
6655 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6656 </tbody></table>
6657
6658 !! end
6659
6660 !! test
6661 Build table with {{!}}
6662 !! wikitext
6663 {{{!}} class="wikitable"
6664 ! header
6665 ! second header
6666 {{!}}- style="color:red;"
6667 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6668 {{!}}}
6669 !! html
6670 <table class="wikitable">
6671 <tr>
6672 <th> header
6673 </th>
6674 <th> second header
6675 </th></tr>
6676 <tr style="color:red;">
6677 <td> data </td>
6678 <td style="color:red;"> second data
6679 </td></tr></table>
6680
6681 !! end
6682
6683 !! test
6684 Build table with pipe as data
6685 !! wikitext
6686 {| class="wikitable"
6687 ! header
6688 ! second header
6689 |- style="color:red;"
6690 | data || style="color:red;" | second data
6691 |-
6692 | style="color:red;" | data with | || style="color:red;" | second data with |
6693 |-
6694 || data with | ||| second data with |
6695 |}
6696 !! html
6697 <table class="wikitable">
6698 <tr>
6699 <th> header
6700 </th>
6701 <th> second header
6702 </th></tr>
6703 <tr style="color:red;">
6704 <td> data </td>
6705 <td style="color:red;"> second data
6706 </td></tr>
6707 <tr>
6708 <td style="color:red;"> data with | </td>
6709 <td style="color:red;"> second data with |
6710 </td></tr>
6711 <tr>
6712 <td> data with | </td>
6713 <td> second data with |
6714 </td></tr></table>
6715
6716 !! end
6717
6718 !! test
6719 Build table with wikilink
6720 !! wikitext
6721 {| class="wikitable"
6722 ! header || second header
6723 |- style="color:red;"
6724 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6725 |-
6726 | data || second data [[Main Page|link|text with pipe]]
6727 |}
6728 !! html
6729 <table class="wikitable">
6730 <tr>
6731 <th> header </th>
6732 <th> second header
6733 </th></tr>
6734 <tr style="color:red;">
6735 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6736 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6737 </td></tr>
6738 <tr>
6739 <td> data </td>
6740 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6741 </td></tr></table>
6742
6743 !! end
6744
6745 # The expected HTML structure in this test is debatable. The PHP parser does
6746 # not parse this kind of table at all. The main focus for Parsoid is on
6747 # round-tripping, so this output is ok for now. TODO: revisit!
6748 !! test
6749 Wikitext table with html-syntax row
6750 !! wikitext
6751 {|
6752 |-
6753 <td>foo</td>
6754 |}
6755 !! html/parsoid
6756 <table>
6757 <tbody>
6758 <tr>
6759 <td>foo</td></tr></tbody></table>
6760 !! end
6761
6762 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6763 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6764 ## PHP parser, which tidy then compounds by fostering the content
6765 ## entirely out of the table. Parsoid recognizes the table context
6766 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6767 ## depends on PHP's treatment of broken table markup!
6768 !! test
6769 Implicit <td> after a |-
6770 !! options
6771 parsoid=wt2html,html2html
6772 !! wikitext
6773 {|
6774 |-
6775 a
6776 |}
6777 !! html/php
6778 <table>
6779
6780 a
6781 </table>
6782
6783 !! html/php+tidy
6784 <p>a</p>
6785 !! html/parsoid
6786 <table>
6787 <tr><td>a</td></tr>
6788 </table>
6789 !! end
6790
6791 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6792 !! test
6793 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6794 !! options
6795 parsoid=wt2html,html2html
6796 !! wikitext
6797 {|
6798 |-
6799 |
6800 a
6801 |-
6802 b
6803 |}
6804 !! html/php
6805 <table>
6806
6807 <tr>
6808 <td>
6809 <pre>a
6810 </pre>
6811 </td></tr>
6812 b
6813 </table>
6814
6815 !! html/php+tidy
6816 <p>b</p>
6817 <table>
6818 <tr>
6819 <td>
6820 <pre>
6821 a
6822 </pre></td>
6823 </tr>
6824 </table>
6825 !! html/parsoid
6826 <table>
6827 <tbody>
6828 <tr><td><pre>a</pre></td></tr>
6829 <tr><td> b</td></tr>
6830 </tbody>
6831 </table>
6832 !! end
6833
6834 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6835 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6836 !! test
6837 Lists should be recognized in an implicit <td> context
6838 !! options
6839 parsoid=wt2html,html2html
6840 !! wikitext
6841 {|
6842 |-
6843 *a
6844 |}
6845 !! html/php
6846 <table>
6847
6848 <ul><li>a</li></ul>
6849 </table>
6850
6851 !! html/php+tidy
6852 <ul>
6853 <li>a</li>
6854 </ul>
6855 !! html/parsoid
6856 <table>
6857 <tr>
6858 <td><ul>
6859 <li>a</li>
6860 </ul></td>
6861 </tr>
6862 </table>
6863 !! end
6864
6865 !! test
6866 Table cells not properly parsed in an implicit-td context
6867 !! wikitext
6868 {|
6869 |-
6870 {{table_attribs_4}} || a || b
6871 |}
6872 !! html/php+tidy
6873 <table>
6874 <tr>
6875 <td style="background-color:#DC241f;" width="10px"></td>
6876 <td>a</td>
6877 <td>b</td>
6878 </tr>
6879 </table>
6880 !! html/parsoid
6881 <table>
6882 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6883 <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>
6884 </tbody></table>
6885 !! end
6886
6887 !! test
6888 Parsoid: Round-trip tables directly followed by content (bug 51219)
6889 !! options
6890 parsoid=wt2html,wt2wt
6891 !! wikitext
6892 {|
6893 |foo
6894 |} bar
6895
6896 {|
6897 |baz
6898 |}<b>quux</b>
6899 !! html+tidy
6900 <table>
6901 <tr>
6902 <td>foo</td>
6903 </tr>
6904 </table>
6905 <p>bar</p>
6906 <table>
6907 <tr>
6908 <td>baz</td>
6909 </tr>
6910 </table>
6911 <p><b>quux</b></p>
6912 !! end
6913
6914 !! test
6915 Parsoid: Default to a newline after tables in new content (bug 51219)
6916 !! options
6917 parsoid=html2wt
6918 !! html/parsoid
6919 <table><tbody>
6920 <tr><td>foo</td></tr></tbody></table> bar
6921 <table><tbody>
6922 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6923 !! wikitext
6924 {|
6925 |foo
6926 |}
6927 <nowiki> </nowiki>bar
6928 {|
6929 |baz
6930 |}
6931 '''quux'''
6932 !! end
6933
6934 !! test
6935 Parsoid: newline inducing block nodes don't suppress <nowiki>
6936 !! options
6937 parsoid=html2wt
6938 !! html/parsoid
6939 a<h1>foo</h1>
6940 !! wikitext
6941 <nowiki> </nowiki>a
6942
6943 = foo =
6944 !! end
6945
6946 !! test
6947 Parsoid: Row-syntax table headings followed by comment & table cells
6948 !! options
6949 parsoid=wt2html,wt2wt
6950 !! wikitext
6951 {|
6952 ! foo || bar
6953 <!-- foo --> || baz || quux
6954 |}
6955 !! html/php
6956 <table>
6957 <tr>
6958 <th> foo </th>
6959 <th> bar
6960 </th>
6961 <td> baz </td>
6962 <td> quux
6963 </td></tr></table>
6964
6965 !! html/parsoid
6966 <table>
6967 <tbody><tr><th> foo </th><th> bar
6968 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
6969 </tbody></table>
6970 !! end
6971
6972 !!test
6973 Parsoid: Recover better from broken table attributes
6974 !!options
6975 parsoid=wt2html
6976 !!wikitext
6977 {| class="foo
6978 | class="bar" |
6979 foo
6980 |}
6981 !!html/php+tidy
6982 <table class="foo">
6983 <tr>
6984 <td class="bar">
6985 <p>foo</p>
6986 </td>
6987 </tr>
6988 </table>
6989 !!html/parsoid
6990 <table class="foo">
6991 <tr>
6992 <td class="bar">
6993 <p>foo</p></td></tr>
6994 </tbody></table>
6995 !!end
6996
6997 !! test
6998 Tables: Digest broken attributes on table and tr tag
6999 !! options
7000 parsoid=wt2html
7001 !! wikitext
7002 {| || |} ++
7003 |- || || ++ --
7004 |- > [
7005 |}
7006 !! html
7007 <table>
7008 <tbody>
7009 <tr></tr>
7010 <tr></tr>
7011 </tbody></table>
7012 !! end
7013
7014 !! test
7015 Strip unsupported table tags
7016 !! options
7017 parsoid=html2wt
7018 !! html/parsoid
7019 <table>
7020 <thead>
7021 <tr>
7022 <th>Month</th>
7023 <th>Savings</th>
7024 </tr>
7025 </thead>
7026 <tbody>
7027 <tr>
7028 <td>January</td>
7029 <td>$100</td>
7030 </tr>
7031 <tr>
7032 <td>February</td>
7033 <td>$80</td>
7034 </tr>
7035 </tbody>
7036 <tfoot>
7037 <tr>
7038 <td>Sum</td>
7039 <td>$180</td>
7040 </tr>
7041 </tfoot>
7042 </table>
7043 !! wikitext
7044 {|
7045
7046 !Month
7047 !Savings
7048
7049 |January
7050 |$100
7051
7052 |-
7053 |February
7054 |$80
7055
7056 |Sum
7057 |$180
7058
7059 |}
7060 !! end
7061
7062 !!test
7063 Testing serialization after deletion of table cells
7064 !!options
7065 parsoid={
7066 "modes": ["wt2wt", "selser"],
7067 "changes": [
7068 ["#x", "remove"]
7069 ]
7070 }
7071 !!wikitext
7072 {|
7073 !h1 !!h2 !!h3
7074 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7075 |}
7076 !! wikitext/edited
7077 {|
7078 !h1 !!h2 !!h3
7079 |c2 |||c3
7080 |}
7081 !!end
7082
7083 ###
7084 ### Internal links
7085 ###
7086 !! test
7087 Plain link, capitalized
7088 !! wikitext
7089 [[Main Page]]
7090 !! html
7091 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7092 </p>
7093 !! end
7094
7095 !! test
7096 Plain link, uncapitalized
7097 !! wikitext
7098 [[main Page]]
7099 !! html
7100 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7101 </p>
7102 !! end
7103
7104 !! test
7105 Piped link
7106 !! wikitext
7107 [[Main Page|The Main Page]]
7108 !! html
7109 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7110 </p>
7111 !! end
7112
7113 !! test
7114 Piped link with comment in link text
7115 !! wikitext
7116 [[Main Page|The Main<!--front--> Page]]
7117 !! html
7118 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7119 </p>
7120 !! end
7121
7122 !! test
7123 Piped link with multiple pipe characters in link text
7124 !! wikitext
7125 [[Main Page||The|Main|Page|]]
7126 !! html/php
7127 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7128 </p>
7129 !! html/parsoid
7130 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7131 !! end
7132
7133 !! test
7134 Piped link with no link text
7135 !! wikitext
7136 [[Thomas Bek (bishop of St David's)|]]
7137 !! html/php
7138 <p>[[Thomas Bek (bishop of St David's)|]]
7139 </p>
7140 !! html/parsoid
7141 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7142 !! end
7143
7144 !! test
7145 Broken link
7146 !! wikitext
7147 [[Zigzagzogzagzig]]
7148 !! html
7149 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7150 </p>
7151 !! end
7152
7153 !! test
7154 Broken link with fragment
7155 !! wikitext
7156 [[Zigzagzogzagzig#zug]]
7157 !! html
7158 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7159 </p>
7160 !! end
7161
7162 !! test
7163 Special page link with fragment
7164 !! wikitext
7165 [[Special:Version#anchor]]
7166 !! html
7167 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7168 </p>
7169 !! end
7170
7171 !! test
7172 Nonexistent special page link with fragment
7173 !! wikitext
7174 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7175 !! html
7176 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7177 </p>
7178 !! end
7179
7180 !! test
7181 Link with prefix
7182 !! wikitext
7183 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7184 !! html
7185 <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>
7186 </p>
7187 !! end
7188
7189 !! test
7190 Link with suffix
7191 !! wikitext
7192 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7193 !! html
7194 <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>!!!
7195 </p>
7196 !! end
7197
7198 !! article
7199 prefixed article
7200 !! text
7201 Some text
7202 !! endarticle
7203
7204 !! test
7205 Bug 43661: Piped links with identical prefixes
7206 !! wikitext
7207 [[prefixed article|prefixed articles with spaces]]
7208
7209 [[prefixed article|prefixed articlesaoeu]]
7210
7211 [[Main Page|Main Page test]]
7212 !! html
7213 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7214 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7215 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7216 </p>
7217 !! end
7218
7219
7220 !! test
7221 Link with HTML entity in suffix / tail
7222 !! wikitext
7223 [[Main Page]]&quot;, [[Main Page]]&#97;
7224 !! html/php
7225 <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;
7226 </p>
7227 !! html/parsoid
7228 <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>
7229 !! end
7230
7231 !! test
7232 Link with 3 brackets
7233 !! wikitext
7234 [[[Main Page]]]
7235 Foo [[[Main Page]]]
7236 !! html
7237 <p>[[[Main Page]]]
7238 Foo [[[Main Page]]]
7239 </p>
7240 !! end
7241
7242 !! test
7243 Link with 4 brackets
7244 !! wikitext
7245 [[[[Main Page]]]]
7246 !! html
7247 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7248 </p>
7249 !! end
7250
7251 !! test
7252 Piped link with 3 brackets
7253 !! wikitext
7254 [[[main page|the main page]]]
7255 !! html
7256 <p>[[[main page|the main page]]]
7257 </p>
7258 !! end
7259
7260 !! test
7261 Piped link with extlink-like text
7262 !! wikitext
7263 [[Main Page|[bar]]]
7264 [[Main Page|This is a [bar]]]
7265 !! html/php
7266 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7267 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7268 </p>
7269 !! html/parsoid
7270 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7271 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7272 !! end
7273
7274 !! test
7275 Link with multiple pipes
7276 !! wikitext
7277 [[Main Page|The|Main|Page]]
7278 !! html
7279 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7280 </p>
7281 !! end
7282
7283 # Note that parsoid does not munge anchor text; all non-space
7284 # characters are valid in HTML5 ids.
7285 !! test
7286 Anchor containing a #. (bug 63430)
7287 !! wikitext
7288 [[Main Page#And#Link]]
7289 !! html/php
7290 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7291 </p>
7292 !! html/parsoid
7293 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
7294 !! end
7295
7296 !! test
7297 Link to namespaces
7298 !! wikitext
7299 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7300 !! html
7301 <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>
7302 </p>
7303 !! end
7304
7305 !! test
7306 Link with space in namespace
7307 !! wikitext
7308 [[User talk:Foo bar]]
7309 !! html
7310 <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>
7311 </p>
7312 !! end
7313
7314 !! article
7315 MemoryAlpha:AlphaTest
7316 !! text
7317 This is an article in the MemoryAlpha namespace
7318 (which shadows the memoryalpha interwiki link).
7319 !! endarticle
7320
7321 !! test
7322 Namespace takes precedence over interwiki link (bug 51680)
7323 !! wikitext
7324 [[MemoryAlpha:AlphaTest]]
7325 !! html
7326 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7327 </p>
7328 !! end
7329
7330 # The previous test doesn't work correctly in html2*, due to not recognizing the
7331 # link as an internal one. This one checks for the correct behavior.
7332 !! test
7333 Link to namespace preferred over interwiki with correct rel attribute
7334 !! options
7335 parsoid=html2wt,html2html
7336 !! html/parsoid
7337 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7338 !! wikitext
7339 [[MemoryAlpha:AlphaTest]]
7340 !! end
7341
7342 !! test
7343 Piped link to namespace
7344 !! wikitext
7345 [[Meta:Disclaimers|The disclaimers]]
7346 !! html
7347 <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>
7348 </p>
7349 !! end
7350
7351 !! test
7352 Link containing }
7353 !! wikitext
7354 [[Usually caused by a typo (oops}]]
7355 !! html
7356 <p>[[Usually caused by a typo (oops}]]
7357 </p>
7358 !! end
7359
7360 !! article
7361 7% Solution
7362 !! text
7363 Just a test of an article title containing a percent.
7364 !! endarticle
7365
7366 !! test
7367 Link containing % (not as a hex sequence)
7368 !! wikitext
7369 [[7% Solution]]
7370 !! html/php
7371 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7372 </p>
7373 !! html/parsoid
7374 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7375 !! end
7376
7377 # note that the parsoid HTML is identical to the previous test output,
7378 # so the previous test ensures that the html2wt mode will generate the
7379 # "not as a hex sequence" wikitext.
7380 !! test
7381 Link containing % as a single hex sequence interpreted to char
7382 !! options
7383 parsoid=wt2wt,wt2html,html2html
7384 !! wikitext
7385 [[7%25 Solution]]
7386 !! html/php
7387 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7388 </p>
7389 !! html/parsoid
7390 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7391 !!end
7392
7393 !! test
7394 Link containing % as a double hex sequence interpreted to hex sequence
7395 !! wikitext
7396 [[7%2525 Solution]]
7397 !! html
7398 <p>[[7%2525 Solution]]
7399 </p>
7400 !!end
7401
7402 # note that parsoid does not munge anchor text; all non-space
7403 # characters are valid in HTML5 anchors.
7404 !! test
7405 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7406 Example for such a section: == < ==
7407 !! wikitext
7408 [[%23%3c]][[%23%3e]]
7409 !! html/php
7410 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7411 </p>
7412 !! html/parsoid
7413 <p><a rel="mw:WikiLink" href="./Main%20Page#%3C" title="Main Page">#&lt;</a><a rel="mw:WikiLink" href="./Main%20Page#%3E" title="Main Page">#></a></p>
7414 !! end
7415
7416 !! test
7417 Link containing "<#" and ">#" as a hex sequences
7418 !! wikitext
7419 [[%3c%23]][[%3e%23]]
7420 !! html
7421 <p>[[%3c%23]][[%3e%23]]
7422 </p>
7423 !! end
7424
7425 !! test
7426 Link containing an equals sign
7427 !! wikitext
7428 [[Special:BookSources/isbn=4-00-026157-6]]
7429 !! html/php
7430 <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>
7431 </p>
7432 !! html/parsoid
7433 <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>
7434 !! end
7435
7436 !! article
7437 Foo~bar
7438 !! text
7439 Just a test of an article title containing a tilde.
7440 !! endarticle
7441
7442 # note that links containing signatures, like [[Foo~~~~]], are
7443 # massaged by the pre-save transform (PST) and so the tildes are never
7444 # seen by the parser.
7445 !! test
7446 Link containing a tilde
7447 !! wikitext
7448 [[Foo~bar]]
7449 !! html/php
7450 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7451 </p>
7452 !! html/parsoid
7453 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7454 !! end
7455
7456 !! test
7457 Link containing double-single-quotes '' (bug 4598)
7458 !! wikitext
7459 [[Lista d''e paise d''o munno]]
7460 !! html/php
7461 <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>
7462 </p>
7463 !! html/parsoid
7464 <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>
7465 !! end
7466
7467 !! test
7468 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7469 !! wikitext
7470 Some [[Link|pretty ''italics'' and stuff]]!
7471 !! html/php
7472 <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>!
7473 </p>
7474 !! html/parsoid
7475 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7476 !! end
7477
7478 !! test
7479 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7480 !! wikitext
7481 ''Some [[Link|pretty ''italics'' and stuff]]!''
7482 !! html
7483 <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>
7484 </p>
7485 !! end
7486
7487 !! test
7488 Link with double quotes in title part (literal) and alternate part (interpreted)
7489 !! wikitext
7490 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7491
7492 [[''Pentecoste'']]
7493
7494 [[''Pentecoste''|Pentecoste]]
7495
7496 [[''Pentecoste''|''Pentecoste'']]
7497 !! html/php
7498 <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>
7499 </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>
7500 </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>
7501 </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>
7502 </p>
7503 !! html/parsoid
7504 <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>
7505 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7506 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7507 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7508 !! end
7509
7510 !! test
7511 Broken image links with HTML captions (bug 39700)
7512 !! wikitext
7513 [[File:Nonexistent|<script></script>]]
7514 [[File:Nonexistent|100x100px|<script></script>]]
7515 [[File:Nonexistent|&lt;]]
7516 [[File:Nonexistent|a<i>b</i>c]]
7517 !! html/php
7518 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7519 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7520 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7521 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7522 </p>
7523 !! html/parsoid
7524 <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;script&amp;gt;&amp;lt;/script&amp;gt;"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span>
7525 <span typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&amp;lt;script&amp;gt;&amp;lt;/script&amp;gt;"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="100" width="100"/></a></span>
7526 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=\"{&amp;quot;src&amp;quot;:&amp;quot;&amp;amp;lt;&amp;quot;,&amp;quot;srcContent&amp;quot;:&amp;quot;&lt;&amp;quot;,&amp;quot;dsr&amp;quot;:[107,111,null,null]}\">&amp;lt;&lt;/span>"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span>
7527 <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"a&lt;i data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[134,142,3,4]}\">b&lt;/i>c"}'><a href="./File:Nonexistent"><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220"/></a></span></p>
7528 !! end
7529
7530 !! test
7531 Plain link to URL
7532 !! wikitext
7533 [[http://www.example.com]]
7534 !! html/php
7535 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7536 </p>
7537 !! html/parsoid
7538 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7539 !! end
7540
7541 !! test
7542 Plain link to URL with link text
7543 !! wikitext
7544 [[http://www.example.com Link text]]
7545 !! html
7546 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7547 </p>
7548 !! end
7549
7550 !! test
7551 Plain link to protocol-relative URL
7552 !! wikitext
7553 [[//www.example.com]]
7554 !! html/php
7555 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7556 </p>
7557 !! html/parsoid
7558 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7559 !! end
7560
7561 !! test
7562 Plain link to protocol-relative URL with link text
7563 !! wikitext
7564 [[//www.example.com Link text]]
7565 !! html
7566 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7567 </p>
7568 !! end
7569
7570 !! test
7571 Plain link to page with question mark in title
7572 !! wikitext
7573 [[A?b]]
7574
7575 [[A?b|Baz]]
7576 !! html
7577 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7578 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7579 </p>
7580 !! end
7581
7582
7583 # I'm fairly sure the expected result here is wrong.
7584 # We want these to be URL links, not pseudo-pages with URLs for titles....
7585 # However the current output is also pretty screwy.
7586 #
7587 # ----
7588 # I'm changing it to match the current output--it arguably makes more
7589 # sense in the light of the test above. Old expected result was:
7590 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7591 #</p>
7592 # But I think this test is bordering on "garbage in, garbage out" anyway.
7593 # -- wtm
7594 !! test
7595 Piped link to URL
7596 !! wikitext
7597 Piped link to URL: [[http://www.example.com|an example URL]]
7598 !! html/php
7599 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7600 </p>
7601 !! html/parsoid
7602 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7603 !! end
7604
7605 !! test
7606 BUG 2: [[page|http://url/]] should link to page, not http://url/
7607 !! wikitext
7608 [[Main Page|http://url/]]
7609 !! html/php
7610 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7611 </p>
7612 !! html/parsoid
7613 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7614 !! end
7615
7616 # Parsoid does not mark self-links, by design.
7617 !! test
7618 BUG 337: Escaped self-links should be bold
7619 !! options
7620 title=[[Bug462]]
7621 !! wikitext
7622 [[Bu&#103;462]] [[Bug462]]
7623 !! html/php
7624 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7625 </p>
7626 !! html/php+tidy
7627 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7628 !! html/parsoid
7629 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7630 !! end
7631
7632 !! test
7633 Self-link to section should not be bold
7634 !! options
7635 title=[[Main Page]]
7636 !! wikitext
7637 [[Main Page#section]]
7638 !! html
7639 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7640 </p>
7641 !! end
7642
7643 !! article
7644 00
7645 !! text
7646 This is 00.
7647 !! endarticle
7648
7649 !!test
7650 Self-link to numeric title
7651 !!options
7652 title=[[0]]
7653 !! wikitext
7654 [[0]]
7655 !! html
7656 <p><strong class="selflink">0</strong>
7657 </p>
7658 !!end
7659
7660 !!test
7661 Link to numeric-equivalent title
7662 !!options
7663 title=[[0]]
7664 !! wikitext
7665 [[00]]
7666 !! html
7667 <p><a href="/wiki/00" title="00">00</a>
7668 </p>
7669 !!end
7670
7671 !! test
7672 <nowiki> inside a link
7673 !! wikitext
7674 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7675 !! html
7676 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7677 </p>
7678 !! end
7679
7680 !! test
7681 Non-breaking spaces in title
7682 !! wikitext
7683 [[&nbsp; Main &nbsp; Page &nbsp;]]
7684 !! html
7685 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7686 </p>
7687 !!end
7688
7689 !! test
7690 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7691 !! options
7692 language=ca
7693 !! wikitext
7694 '''[[Main Page]]'''
7695 !! html
7696 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7697 </p>
7698 !! end
7699
7700 !! test
7701 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7702 !! options
7703 language=ca
7704 !! wikitext
7705 ''[[Main Page]]''
7706 !! html
7707 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7708 </p>
7709 !! end
7710
7711 !! test
7712 Internal link with en linktrail: no apostrophes (bug 27473)
7713 !! options
7714 language=en
7715 !! wikitext
7716 [[Something]]'nice
7717 !! html
7718 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
7719 </p>
7720 !! end
7721
7722 !! test
7723 Internal link with ca linktrail with apostrophes (bug 27473)
7724 !! options
7725 language=ca
7726 !! wikitext
7727 [[Something]]'nice
7728 !! html
7729 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
7730 </p>
7731 !! end
7732
7733 !! test
7734 Internal link with kaa linktrail with apostrophes (bug 27473)
7735 !! options
7736 language=kaa
7737 !! wikitext
7738 [[Something]]'nice
7739 !! html
7740 <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>
7741 </p>
7742 !! end
7743
7744 !! test
7745 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
7746 !! wikitext
7747 [[User:Foo/Test/63636:Bar|Test]]
7748 !! html/php
7749 <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>
7750 </p>
7751 !! html/parsoid
7752 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
7753 !! end
7754
7755 !! test
7756 Purely hash wikilink
7757 !! options
7758 title=[[User:test/123]]
7759 !! wikitext
7760 [[#a|b]]
7761 !! html/php
7762 <p><a href="#a">b</a>
7763 </p>
7764 !! html/parsoid
7765 <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>
7766 !! end
7767
7768 !! test
7769 1. Interaction of linktrail and template encapsulation
7770 !! options
7771 parsoid
7772 !! wikitext
7773 {{echo|[[Foo]]}}l
7774 !! html
7775 <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>
7776 !! end
7777
7778 !! test
7779 2. Interaction of linktrail and template encapsulation
7780 !! options
7781 parsoid
7782 !! wikitext
7783 {{echo|Some [[Fool]]}}s
7784 !! html
7785 <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","spc":["","","",""]}]]}'>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>
7786 !! end
7787
7788 !! test
7789 3. Interaction of linktrail and template encapsulation
7790 !! options
7791 parsoid
7792 !! wikitext
7793 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
7794 !! html
7795 <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","spc":["","","",""]}]]}'>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>
7796 !! end
7797
7798 !! article
7799 Söfnuður
7800 !! text
7801 Test.
7802 !! endarticle
7803
7804 !! test
7805 Internal link with is link prefix
7806 !! options
7807 language=is
7808 !! wikitext
7809 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
7810 !! html
7811 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
7812 </p>
7813 !! end
7814
7815 !! article
7816 Mótmælendatrú
7817 !! text
7818 Test.
7819 !! endarticle
7820
7821 !! test
7822 Internal link with is link trail and link prefix
7823 !! options
7824 language=is
7825 !! wikitext
7826 [[mótmælendatrú|xxx]]ar
7827 [[mótmælendatrú]]ar
7828 mótmælenda[[söfnuður]]
7829 mótmælenda[[söfnuður|söfnuðir]]
7830 mótmælenda[[söfnuður|söfnuðir]]xxx
7831 !! html
7832 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
7833 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
7834 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
7835 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
7836 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
7837 </p>
7838 !! end
7839
7840 !! test
7841 Parsoid link trail escaping
7842 !! options
7843 parsoid=html2wt,html2html
7844 !! html/parsoid
7845 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
7846 !! wikitext
7847 [[apple]]<nowiki/>s
7848 !! end
7849
7850 !! test
7851 Parsoid link prefix escaping
7852 !! options
7853 language=is
7854 parsoid=html2wt,html2html
7855 !! html/parsoid
7856 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
7857 !! wikitext
7858 Aðrir mótmælenda<nowiki/>[[söfnuður]]
7859 !! end
7860
7861 !! test
7862 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
7863 !! wikitext
7864 [[Foo| bar]]
7865
7866 [[Foo| ''bar'']]
7867
7868 [http://wp.org foo]
7869
7870 [http://wp.org ''foo'']
7871 !! html
7872 <p><a href="/wiki/Foo" title="Foo"> bar</a>
7873 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
7874 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
7875 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
7876 </p>
7877 !! end
7878
7879 !! test
7880 Parsoid: Scoped parsing should handle mixed transclusions and plain text
7881 !! options
7882 parsoid
7883 !! wikitext
7884 [[Foo|{{echo|a}} b {{echo|c}}]]
7885 !! html
7886 <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>
7887 !! end
7888
7889 !! test
7890 Link with angle bracket after anchor
7891 !! wikitext
7892 [[Foo#<bar>]]
7893 !! html/php
7894 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
7895 </p>
7896 !! html/parsoid
7897 <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>
7898 !! end
7899
7900 ###
7901 ### Interwiki links (see maintenance/interwiki.sql)
7902 ###
7903
7904 !! test
7905 Inline interwiki link
7906 !! options
7907 parsoid=wt2html,wt2wt,html2html
7908 !! wikitext
7909 [[MeatBall:SoftSecurity]]
7910 !! html/php
7911 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
7912 </p>
7913 !! html/parsoid
7914 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
7915 !! end
7916
7917 !! test
7918 Inline interwiki link with empty title (bug 2372)
7919 !! options
7920 parsoid=wt2html,wt2wt,html2html
7921 !! wikitext
7922 [[MeatBall:]]
7923 !! html/php
7924 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
7925 </p>
7926 !! html/parsoid
7927 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
7928 !! end
7929
7930 !! test
7931 Interwiki link encoding conversion (bug 1636)
7932 !! wikitext
7933 *[[Wikipedia:ro:Olteni&#0355;a]]
7934 *[[Wikipedia:ro:Olteni&#355;a]]
7935 !! html
7936 <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>
7937 <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>
7938
7939 !! html+tidy
7940 <ul>
7941 <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>
7942 <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>
7943 </ul>
7944 !! end
7945
7946 !! test
7947 Interwiki link with fragment (bug 2130)
7948 !! wikitext
7949 [[MeatBall:SoftSecurity#foo]]
7950 !! html
7951 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
7952 </p>
7953 !! end
7954
7955 # Ideally the wikipedia: prefix here should be proto-relative too
7956 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
7957 # define the 'en' prefix, and originally the test used 'wikipedia',
7958 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
7959 # article.
7960 !! test
7961 Different interwiki prefixes mapping to the same URL
7962 !! wikitext
7963 [[:en:Foo]]
7964
7965 [[:en:Foo|Foo]]
7966
7967 [[wikipedia:Foo]]
7968
7969 [[:wikipedia:Foo|Foo]]
7970
7971 [[wikipedia:en:Foo]]
7972
7973 [[:wikipedia:en:Foo]]
7974
7975 [[ wikiPEdia :Foo]]
7976 !! html/parsoid
7977 <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>
7978
7979 <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>
7980
7981 <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>
7982
7983 <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>
7984
7985 <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>
7986
7987 <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>
7988
7989 <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>
7990 !! end
7991
7992 !! test
7993 Interwiki links that cannot be represented in wiki syntax
7994 !! wikitext
7995 [[meatball:ok]]
7996 [[meatball:ok#foo|ok with fragment]]
7997 [[meatball:ok_as_well?|ok ending with ? mark]]
7998 [http://de.wikipedia.org/wiki/Foo?action=history has query]
7999 [http://de.wikipedia.org/wiki/#foo is just fragment]
8000
8001 !! html/php
8002 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
8003 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8004 <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>
8005 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8006 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8007 </p>
8008 !! html/parsoid
8009 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8010 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8011 <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>
8012 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8013 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8014 !! end
8015
8016 !! test
8017 Interwiki links: trail
8018 !! wikitext
8019 [[wikipedia:Foo|Ba]]r
8020 !! html/php
8021 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8022 </p>
8023 !! html/parsoid
8024 <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>
8025 !! end
8026
8027 !! test
8028 Local interwiki link
8029 !! options
8030 parsoid=wt2html,wt2wt,html2html
8031 !! wikitext
8032 [[local:Template:Foo]]
8033 !! html/php
8034 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8035 </p>
8036 !! html/parsoid
8037 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8038 !! end
8039
8040 # Parsoid does not mark self-links, by design.
8041 !! test
8042 Local interwiki link: self-link to current page
8043 !! options
8044 title=[[Main Page]]
8045 parsoid=wt2html,wt2wt,html2html
8046 !! wikitext
8047 [[local:Main Page]]
8048 !! html/php
8049 <p><strong class="selflink">local:Main Page</strong>
8050 </p>
8051 !! html/parsoid
8052 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8053 !! end
8054
8055 !! test
8056 Local interwiki link: prefix only (bug 64167)
8057 !! options
8058 parsoid=wt2html,wt2wt,html2html
8059 !! wikitext
8060 [[local:]]
8061 !! html/php
8062 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8063 </p>
8064 !! html/parsoid
8065 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8066 !! end
8067
8068 !! test
8069 Local interwiki link: with additional interwiki prefix (bug 61357)
8070 !! options
8071 parsoid=wt2html,wt2wt,html2html
8072 !! wikitext
8073 [[local:meatball:Hello]]
8074 !! html/php
8075 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8076 </p>
8077 !! html/parsoid
8078 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8079 !! end
8080
8081 !! test
8082 Multiple local interwiki link prefixes
8083 !! wikitext
8084 [[local:local:local:local:mi:local:Foo]]
8085 !! options
8086 parsoid=wt2html,wt2wt,html2html
8087 !! html/php
8088 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8089 </p>
8090 !! html/parsoid
8091 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8092 !! end
8093
8094 ###
8095 ### Interlanguage links
8096 ### Language links (so that searching for '### language' matches..)
8097 ###
8098
8099 !! test
8100 Interlanguage link
8101 !! options
8102 parsoid=wt2html,wt2wt,html2html
8103 !! wikitext
8104 Blah blah blah
8105 [[zh:Chinese]]
8106 !! html/php
8107 <p>Blah blah blah
8108 </p>
8109 !! html/parsoid
8110 <p>Blah blah blah</p>
8111 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8112 !! end
8113
8114 !! test
8115 Interlanguage link with spacing
8116 !! options
8117 parsoid=wt2html,wt2wt,html2html
8118 !! wikitext
8119 Blah blah blah
8120 [[ zh : Chinese ]]
8121 !! html/php
8122 <p>Blah blah blah
8123 </p>
8124 !! html/parsoid
8125 <p>Blah blah blah</p>
8126 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8127 !! end
8128
8129 !! test
8130 Double interlanguage link
8131 !! options
8132 parsoid=wt2html,wt2wt,html2html
8133 !! wikitext
8134 Blah blah blah
8135 [[es:Spanish]]
8136 [[zh:Chinese]]
8137 !! html/php
8138 <p>Blah blah blah
8139 </p>
8140 !! html/parsoid
8141 <p>Blah blah blah</p>
8142 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8143 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8144 !! end
8145
8146 !! test
8147 Interlanguage link variations
8148 !! options
8149 parsoid=wt2html,wt2wt,html2html
8150 !! wikitext
8151 Blah blah blah
8152 [[ es :Spanish]]
8153 [[ ZH :Chinese]]
8154 [[es:Foo_bar]]
8155 !! html/php
8156 <p>Blah blah blah
8157 </p>
8158 !! html/parsoid
8159 <p>Blah blah blah</p>
8160 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8161 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8162 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8163 !! end
8164
8165 !! test
8166 Space and question mark encoding in interlanguage links (T95473)
8167 !! options
8168 parsoid=wt2html,wt2wt,html2html
8169 !! wikitext
8170 Blah blah blah
8171 [[es:Foo bar?]]
8172 !! html/php
8173 <p>Blah blah blah
8174 </p>
8175 !! html/parsoid
8176 <p>Blah blah blah</p>
8177 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8178 !! end
8179
8180 !! test
8181 Interlanguage link, with prefix links
8182 !! options
8183 language=ln
8184 !! wikitext
8185 Blah blah blah
8186 [[zh:Chinese]]
8187 !! html/php
8188 <p>Blah blah blah
8189 </p>
8190 !! html/parsoid
8191 <p>Blah blah blah</p>
8192 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8193 !! end
8194
8195 !! test
8196 Double interlanguage link, with prefix links (bug 8897)
8197 !! options
8198 language=ln
8199 !! wikitext
8200 Blah blah blah
8201 [[es:Spanish]]
8202 [[zh:Chinese]]
8203 !! html/php
8204 <p>Blah blah blah
8205 </p>
8206 !! html/parsoid
8207 <p>Blah blah blah</p>
8208 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8209 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8210 !! end
8211
8212 !! test
8213 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8214 !! wikitext
8215 Blah blah blah
8216 [[mul:Article]]
8217 !! html/php
8218 <p>Blah blah blah
8219 </p>
8220 !! html/parsoid
8221 <p>Blah blah blah</p>
8222 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8223 !! end
8224
8225 !! test
8226 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8227 !! options
8228 language=ln
8229 !! wikitext
8230 [[WW&nbsp;II]]
8231 !! html
8232 <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>
8233 </p>
8234 !! end
8235
8236 !! test
8237 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8238 !! options
8239 parsoid=html2wt
8240 !! html/parsoid
8241 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8242 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8243 !! wikitext
8244 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8245
8246 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
8247 !! end
8248
8249 !! test
8250 Parsoid: handle constructor well
8251 !! wikitext
8252 [[constructor]]
8253
8254 [[constructor:foo]]
8255 !! html/php
8256 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8257 </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>
8258 </p>
8259 !! html/parsoid
8260 <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid="{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;./Constructor&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;constructor&quot;}}">constructor</a></p>
8261
8262 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid="{&quot;stx&quot;:&quot;simple&quot;,&quot;a&quot;:{&quot;href&quot;:&quot;./Foo&quot;},&quot;sa&quot;:{&quot;href&quot;:&quot;constructor:foo&quot;}}">constructor:foo</a></p>
8263 !! end
8264
8265 !! article
8266 ko:
8267 !! text
8268 Test.
8269 !! endarticle
8270
8271 # Note that `ko` isn't a known interlanguage prefix
8272 !! test
8273 Parsoid: recognize interlanguage links without a target page
8274 !! options
8275 ill
8276 !! wikitext
8277 [[es:]]
8278
8279 [[ko:]]
8280 !! html/php
8281 es:
8282 !! html/parsoid
8283 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8284
8285 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8286 !! end
8287
8288 # Note that `ko` isn't a known interwiki prefix
8289 !! test
8290 Parsoid: recognize interwiki links without a target page
8291 !! options
8292 parsoid=wt2html,wt2wt,html2html
8293 !! wikitext
8294 [[:es:]]
8295
8296 [[:ko:]]
8297 !! html/php
8298 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8299 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8300 </p>
8301 !! html/parsoid
8302 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8303 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8304 !! end
8305
8306 !! test
8307 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8308 !! wikitext
8309 [[mi:Foo]]
8310 !! html/php
8311 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8312 </p>
8313 !! html/parsoid
8314 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8315 !! end
8316
8317 !! test
8318 Interlanguage link with preceding local interwiki link (bug 68085)
8319 !! options
8320 parsoid=wt2html,wt2wt,html2html
8321 !! wikitext
8322 Blah blah blah
8323 [[local:es:Spanish]]
8324 !! html/php
8325 <p>Blah blah blah
8326 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8327 </p>
8328 !! html/parsoid
8329 <p>Blah blah blah
8330 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8331 !! end
8332
8333 !! test
8334 Looks like an interlanguage link, but is actually a local interwiki
8335 !! options
8336 parsoid=wt2html,wt2wt,html2html
8337 !! wikitext
8338 Blah blah blah
8339 [[mi:Template:Foo]]
8340 !! html/php
8341 <p>Blah blah blah
8342 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8343 </p>
8344 !! html/parsoid
8345 <p>Blah blah blah
8346 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8347 !! end
8348
8349 ###
8350 ### Redirects, Parsoid-only
8351 ###
8352
8353 !! test
8354 1. Simple redirect to page
8355 !! wikitext
8356 #REDIRECT [[Main Page]]
8357 !! html/parsoid
8358 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8359 !! end
8360
8361 !! test
8362 2. Other redirect variants
8363 !! wikitext
8364 #REDIRECT [[Main_Page]]
8365 !! html/parsoid
8366 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8367 !! end
8368
8369 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8370 # This tests the Parsoid bail-out code.
8371 !! test
8372 3. Other redirect variants
8373 !! wikitext
8374 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8375 !! html/parsoid
8376 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8377 !! end
8378
8379 !! test
8380 4. Redirect to a templated destination
8381 !! wikitext
8382 #REDIRECT [[{{echo|Foo}}bar]]
8383 !! html/parsoid
8384 <link typeof="mw:ExpandedAttrs" rel="mw:PageProp/redirect" href="./Foobar" data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[12,24,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;Foo&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">Foo&lt;/span>bar"}]]}'/>
8385 !! end
8386
8387 !! test
8388 Empty redirect
8389 !! options
8390 parsoid=wt2html,wt2wt
8391 !! wikitext
8392 #REDIRECT [[]]
8393 !! html/parsoid
8394 <ol>
8395 <li>REDIRECT [[]]</li></ol>
8396 !! end
8397
8398 !! test
8399 Optional colon in #REDIRECT
8400 !! options
8401 # the colon is archaic syntax. we support it for wt2html, but we
8402 # don't care that it roundtrips back to the modern syntax.
8403 parsoid=wt2html,html2html
8404 !! wikitext
8405 #REDIRECT:[[Main Page]]
8406 !! html/parsoid
8407 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8408 !! end
8409
8410 !! test
8411 Whitespace in #REDIRECT with optional colon
8412 !! options
8413 # the colon and gratuitous whitespace is archaic syntax. we support
8414 # it for wt2html, but we don't care that it roundtrips back to the
8415 # modern syntax (without extra whitespace)
8416 parsoid=wt2html,html2html
8417 !! wikitext
8418
8419 #REDIRECT
8420 :
8421 [[Main Page]]
8422 !! html/parsoid
8423 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8424 !! end
8425
8426 !! test
8427 Piped link in #REDIRECT
8428 !! options
8429 # content after piped link is ignored. we support this syntax,
8430 # but don't care that the piped link is lost when we roundtrip this.
8431 parsoid=wt2html
8432 !! wikitext
8433 #REDIRECT [[Main Page|bar]]
8434 !! html/parsoid
8435 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8436 !! end
8437
8438 !! test
8439 Redirect to category (T104502)
8440 !! options
8441 parsoid=wt2html,wt2wt
8442 !! wikitext
8443 #REDIRECT [[Category:Foo]]
8444 !! html/parsoid
8445 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8446 !! end
8447
8448 !! test
8449 Redirect to category with URL encoding (T104502)
8450 !! options
8451 parsoid=wt2html
8452 !! wikitext
8453 #REDIRECT [[Category%3AFoo]]
8454 !! html/parsoid
8455 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8456 !! end
8457
8458 !! test
8459 Redirect to category page
8460 !! wikitext
8461 #REDIRECT [[:Category:Foo]]
8462 !! html/parsoid
8463 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8464 !! end
8465
8466 !! test
8467 Redirect to image page (1)
8468 !! wikitext
8469 #REDIRECT [[File:Wiki.png]]
8470 !! html/parsoid
8471 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8472 !! end
8473
8474 !! test
8475 Redirect to image page (2)
8476 !! wikitext
8477 #REDIRECT [[Image:Wiki.png]]
8478 !! html/parsoid
8479 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8480 !! end
8481
8482 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8483 # Next test confirms this.
8484 !! test
8485 Redirect to language (1) (T104918)
8486 !! options
8487 parsoid=wt2html,wt2wt,html2html
8488 !! wikitext
8489 #REDIRECT [[en:File:Wiki.png]]
8490 !! html/parsoid
8491 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8492 !! end
8493
8494 !! test
8495 Redirect to language (2) (T104918)
8496 !! wikitext
8497 #REDIRECT [[:en:File:Wiki.png]]
8498 !! html/parsoid
8499 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8500 !! end
8501
8502 !! test
8503 Redirect to interwiki (T104918)
8504 !! wikitext
8505 #REDIRECT [[meatball:File:Wiki.png]]
8506 !! html/parsoid
8507 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8508 !! end
8509
8510 !! test
8511 Non-English #REDIRECT
8512 !! options
8513 language=is
8514 !! wikitext
8515 #TILVÍSUN [[Main Page]]
8516 !! html/parsoid
8517 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8518 !! end
8519
8520 !! test
8521 Redirect syntax under text isn't considered a redirect
8522 !! wikitext
8523 some text
8524 #redirect [[Main Page]]
8525 !! html/parsoid
8526 <p>some text</p>
8527 <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>
8528 !! end
8529
8530 # FIXME: Should hoist the redirect to the top of the page and ensure there
8531 # is only one.
8532 !! test
8533 New redirect
8534 !! options
8535 parsoid=html2wt
8536 !! html/parsoid
8537 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8538 !! wikitext
8539 Foo
8540 #REDIRECT [[Foo]]
8541 !! end
8542
8543 ##
8544 ## XHTML tidiness
8545 ###
8546
8547 !! test
8548 <br> to <br />
8549 !! wikitext
8550 1<br>2<br />3
8551 !! html
8552 <p>1<br />2<br />3
8553 </p>
8554 !! end
8555
8556 !! test
8557 Broken br tag sanitization
8558 !! wikitext
8559 </br>
8560 !! html/php
8561 <p>&lt;/br&gt;
8562 </p>
8563 !! end
8564
8565 # TODO: Fix html2html mode (bug 51055)!
8566 !! test
8567 Parsoid: Broken br tag recognition
8568 !! options
8569 parsoid=wt2html
8570 !! wikitext
8571 </br>
8572
8573 <br/ >
8574 !! html+tidy
8575 <p><br /></p>
8576 <p><br /></p>
8577 !! end
8578
8579 !! test
8580 Incorrecly removing closing slashes from correctly formed XHTML
8581 !! wikitext
8582 <br style="clear:both;" />
8583 !! html
8584 <p><br style="clear:both;" />
8585 </p>
8586 !! end
8587
8588 !! test
8589 Failing to transform badly formed HTML into correct XHTML
8590 !! wikitext
8591 <br style="clear: left;">
8592 <br style="clear: right;">
8593 <br style="clear: both;">
8594 !! html
8595 <p><br style="clear: left;" />
8596 <br style="clear: right;" />
8597 <br style="clear: both;" />
8598 </p>
8599 !!end
8600
8601 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8602 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8603 !! test
8604 Handling html with a div self-closing tag
8605 !! wikitext
8606 <div title />
8607 <div title/>
8608 <div title/ >
8609 <div title=bar />
8610 <div title=bar/>
8611 <div title=bar/ >
8612 !! html/php
8613 <p>&lt;div title /&gt;
8614 &lt;div title/&gt;
8615 </p>
8616 <div>
8617 <p>&lt;div title=bar /&gt;
8618 &lt;div title=bar/&gt;
8619 </p>
8620 <div title="bar/"></div>
8621 </div>
8622
8623 !! html/parsoid
8624 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8625 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8626 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
8627 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8628 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8629 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
8630 !! end
8631
8632 !! test
8633 Handling html with a br self-closing tag
8634 !! wikitext
8635 <br title />
8636 <br title/>
8637 <br title/ >
8638 <br title=bar />
8639 <br title=bar/>
8640 <br title=bar/ >
8641 !! html/php
8642 <p><br title="" />
8643 <br title="" />
8644 <br />
8645 <br title="bar" />
8646 <br title="bar" />
8647 <br title="bar/" />
8648 </p>
8649 !! html/parsoid
8650 <p><br title="" />
8651 <br title="" />
8652 <br title="" />
8653 <br title="bar" />
8654 <br title="bar" />
8655 <br title="bar/" />
8656 </p>
8657 !! end
8658
8659 !! test
8660 Horizontal ruler (should it add that extra space?)
8661 !! wikitext
8662 <hr>
8663 <hr >
8664 foo <hr
8665 > bar
8666 !! html+tidy
8667 <hr />
8668 <hr />
8669 <p>foo</p>
8670 <hr />
8671 <p>bar</p>
8672 !! end
8673
8674 !! test
8675 Horizontal ruler -- 4+ dashes render hr
8676 !! wikitext
8677 ----
8678 !! html
8679 <hr />
8680
8681 !! end
8682
8683 !! test
8684 Horizontal ruler -- eats additional dashes on the same line
8685 !! wikitext
8686 ---------
8687 !! html
8688 <hr />
8689
8690 !! end
8691
8692 !! test
8693 Horizontal ruler -- does not collapse dashes on consecutive lines
8694 !! wikitext
8695 ----
8696 ----
8697 !! html
8698 <hr />
8699 <hr />
8700
8701 !! end
8702
8703 !! test
8704 Horizontal ruler -- <4 dashes render as plain text
8705 !! wikitext
8706 ---
8707 !! html
8708 <p>---
8709 </p>
8710 !! end
8711
8712 !! test
8713 Horizontal ruler -- Supports content following dashes on same line
8714 !! wikitext
8715 ---- Foo
8716 !! html
8717 <hr /> Foo
8718
8719 !! html+tidy
8720 <hr />
8721 <p>Foo</p>
8722 !! end
8723
8724 ###
8725 ### Block-level elements
8726 ###
8727 !! test
8728 Common list
8729 !! wikitext
8730 *Common list
8731 * item 2
8732 *item 3
8733 !! html
8734 <ul><li>Common list</li>
8735 <li> item 2</li>
8736 <li>item 3</li></ul>
8737
8738 !! end
8739
8740 !! test
8741 Numbered list
8742 !! wikitext
8743 #Numbered list
8744 #item 2
8745 # item 3
8746 !! html
8747 <ol><li>Numbered list</li>
8748 <li>item 2</li>
8749 <li> item 3</li></ol>
8750
8751 !! end
8752
8753 !! test
8754 Mixed list
8755 !! wikitext
8756 *Mixed list
8757 *# with numbers
8758 ** and bullets
8759 *# and numbers
8760 *bullets again
8761 **bullet level 2
8762 ***bullet level 3
8763 ***#Number on level 4
8764 **bullet level 2
8765 **#Number on level 3
8766 **#Number on level 3
8767 *#number level 2
8768 *Level 1
8769 *** Level 3
8770 #** Level 3, but ordered
8771 !! html
8772 <ul><li>Mixed list
8773 <ol><li> with numbers</li></ol>
8774 <ul><li> and bullets</li></ul>
8775 <ol><li> and numbers</li></ol></li>
8776 <li>bullets again
8777 <ul><li>bullet level 2
8778 <ul><li>bullet level 3
8779 <ol><li>Number on level 4</li></ol></li></ul></li>
8780 <li>bullet level 2
8781 <ol><li>Number on level 3</li>
8782 <li>Number on level 3</li></ol></li></ul>
8783 <ol><li>number level 2</li></ol></li>
8784 <li>Level 1
8785 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
8786 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
8787
8788 !! end
8789
8790 !! test
8791 Nested lists 1
8792 !! wikitext
8793 *foo
8794 **bar
8795 !! html
8796 <ul><li>foo
8797 <ul><li>bar</li></ul></li></ul>
8798
8799 !! end
8800
8801 !! test
8802 Nested lists 2
8803 !! wikitext
8804 **foo
8805 *bar
8806 !! html
8807 <ul><li><ul><li>foo</li></ul></li>
8808 <li>bar</li></ul>
8809
8810 !! end
8811
8812 !! test
8813 Nested lists 3 (first element empty)
8814 !! wikitext
8815 *
8816 **bar
8817 !! html
8818 <ul><li>
8819 <ul><li>bar</li></ul></li></ul>
8820
8821 !! end
8822
8823 !! test
8824 Nested lists 4 (first element empty)
8825 !! wikitext
8826 **
8827 *bar
8828 !! html
8829 <ul><li><ul><li></li></ul></li>
8830 <li>bar</li></ul>
8831
8832 !! end
8833
8834 !! test
8835 Nested lists 5 (both elements empty)
8836 !! wikitext
8837 **
8838 *
8839 !! html
8840 <ul><li><ul><li></li></ul></li>
8841 <li></li></ul>
8842
8843 !! end
8844
8845 !! test
8846 Nested lists 6 (both elements empty)
8847 !! wikitext
8848 *
8849 **
8850 !! html
8851 <ul><li>
8852 <ul><li></li></ul></li></ul>
8853
8854 !! end
8855
8856 !! test
8857 Nested lists 7 (skip initial nesting levels)
8858 !! wikitext
8859 *** foo
8860 !! html
8861 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
8862
8863 !! end
8864
8865 !! test
8866 Nested lists 8 (multiple nesting transitions)
8867 !! wikitext
8868 * foo
8869 *** bar
8870 ** baz
8871 * boo
8872 !! html
8873 <ul><li> foo
8874 <ul><li><ul><li> bar</li></ul></li>
8875 <li> baz</li></ul></li>
8876 <li> boo</li></ul>
8877
8878 !! end
8879
8880 !! test
8881 Nested lists 9 (extension interaction)
8882 !! options
8883 parsoid
8884 !! wikitext
8885 *<references />
8886 !! html/parsoid
8887 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
8888 !! end
8889
8890 !! test
8891 1. Lists with start-of-line-transparent tokens before bullets: Comments
8892 !! wikitext
8893 *foo
8894 *<!--cmt-->bar
8895 <!--cmt-->*baz
8896 !! html
8897 <ul><li>foo</li>
8898 <li>bar</li>
8899 <li>baz</li></ul>
8900
8901 !! end
8902
8903 !! test
8904 2. Lists with start-of-line-transparent tokens before bullets: Template close
8905 !! wikitext
8906 *foo {{echo|bar
8907 }}*baz
8908 !! html
8909 <ul><li>foo bar</li>
8910 <li>baz</li></ul>
8911
8912 !! end
8913
8914 !! test
8915 List items are not parsed correctly following a <pre> block (bug 785)
8916 !! wikitext
8917 * <pre>foo</pre>
8918 * <pre>bar</pre>
8919 * zar
8920 !! html/php
8921 <ul><li> <pre>foo</pre></li>
8922 <li> <pre>bar</pre></li>
8923 <li> zar</li></ul>
8924
8925 !! html/parsoid
8926 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
8927 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
8928 <li> zar</li></ul>
8929 !! end
8930
8931 !! test
8932 List items from template
8933 !! wikitext
8934
8935 {{inner list}}
8936 * item 2
8937
8938 * item 0
8939 {{inner list}}
8940 * item 2
8941
8942 * item 0
8943 * notSOL{{inner list}}
8944 * item 2
8945 !! html
8946 <ul><li> item 1</li>
8947 <li> item 2</li></ul>
8948 <ul><li> item 0</li>
8949 <li> item 1</li>
8950 <li> item 2</li></ul>
8951 <ul><li> item 0</li>
8952 <li> notSOL</li>
8953 <li> item 1</li>
8954 <li> item 2</li></ul>
8955
8956 !! end
8957
8958 !! test
8959 List interrupted by empty line or heading
8960 !! wikitext
8961 * foo
8962
8963 ** bar
8964 == A heading ==
8965 * Another list item
8966 !! html
8967 <ul><li> foo</li></ul>
8968 <ul><li><ul><li> bar</li></ul></li></ul>
8969 <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>
8970 <ul><li> Another list item</li></ul>
8971
8972 !!end
8973
8974 !!test
8975 Multiple list tags generated by templates
8976 !! wikitext
8977 {{echo|<li>}}a
8978 {{echo|<li>}}b
8979 {{echo|<li>}}c
8980 !! html
8981 <li>a
8982 <li>b
8983 <li>c</li>
8984 </li>
8985 </li>
8986
8987 !! html+tidy
8988 <ul>
8989 <li>a</li>
8990 <li>b</li>
8991 <li>c</li>
8992 </ul>
8993 !!end
8994
8995 !!test
8996 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
8997 !! wikitext
8998 *a
8999 <!--This line will NOT split the list-->
9000 *b
9001 <!--This line will NOT split the list either-->
9002 *c
9003 <!--foo--> <!----> <!--This line NOT split the list either-->
9004 *d
9005 !! html
9006 <ul><li>a</li>
9007 <li>b</li>
9008 <li>c</li>
9009 <li>d</li></ul>
9010
9011 !!end
9012
9013 !!test
9014 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9015 !! wikitext
9016 *a
9017 <!--This line will NOT split the list-->
9018 *b
9019 <!--This line will NOT split the list either-->
9020 *c
9021 <!--foo--> <!----> <!--This line NOT split the list
9022 either-->
9023 *d
9024 !! html
9025 <ul><li>a</li>
9026 <li>b</li>
9027 <li>c</li>
9028 <li>d</li></ul>
9029
9030 !!end
9031
9032 !!test
9033 Test the li-hack
9034 (The PHP parser relies on Tidy for the hack)
9035 !!options
9036 parsoid=wt2html,wt2wt
9037 !! wikitext
9038 * foo
9039 * <li>li-hack
9040 * {{echo|<li>templated li-hack}}
9041 * <!--foo--> <li> unsupported li-hack with preceding comments
9042
9043 <ul>
9044 <li><li>not a li-hack
9045 </li>
9046 </ul>
9047 !! html+tidy
9048 <ul>
9049 <li>foo</li>
9050 <li>li-hack</li>
9051 <li>templated li-hack</li>
9052 <li>unsupported li-hack with preceding comments</li>
9053 </ul>
9054 <ul>
9055 <li>not a li-hack</li>
9056 </ul>
9057 !!end
9058
9059 !! test
9060 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9061 !! options
9062 parsoid
9063 !! wikitext
9064 # foo
9065 ## bar
9066 * foo
9067 ** bar
9068 : foo
9069 :: bar
9070 !! html
9071 <ol>
9072 <li> foo<ol>
9073 <li> bar</li>
9074 </ol></li>
9075 </ol><ul>
9076 <li> foo<ul>
9077 <li> bar</li>
9078 </ul></li>
9079 </ul><dl>
9080 <dd> foo<dl>
9081 <dd> bar</dd>
9082 </dl></dd>
9083 </dl>
9084 !! end
9085
9086 !! test
9087 Parsoid: Test of whitespace serialization with Templated bullets
9088 !! options
9089 parsoid
9090 !! wikitext
9091 * {{bullet}}
9092 !! html
9093 <ul>
9094 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9095 </ul>
9096 !! end
9097
9098 # ------------------------------------------------------------------------
9099 # The next set of tests are about Parsoid's ability to handle badly nested
9100 # tags (parse, minimize scope of fixup, and roundtrip back)
9101 # ------------------------------------------------------------------------
9102
9103 !! test
9104 Unbalanced closing block tags break a list
9105 (php parser relies on Tidy to fix up)
9106 !! wikitext
9107 <div>
9108 *a</div><div>
9109 *b</div>
9110 !! html+tidy
9111 <div>
9112 <ul>
9113 <li>a</li>
9114 </ul>
9115 </div>
9116 <div>
9117 <ul>
9118 <li>b</li>
9119 </ul>
9120 </div>
9121 !! end
9122
9123 # Parsoid fails this test, but it might be tricky to support properly.
9124 # See bug 68395.
9125 !! test
9126 Unbalanced closing non-block tags don't break a list
9127 (php parser relies on Tidy to fix up)
9128 !! wikitext
9129 <span>
9130 *a</span><span>
9131 *b</span>
9132 !! html/php+tidy
9133 <ul>
9134 <li><span>a</span></li>
9135 <li><span>b</span></li>
9136 </ul>
9137 !! html/parsoid
9138 <span>
9139 <ul>
9140 <li>a<span></span>
9141 </li>
9142 <li>b
9143 </li>
9144 </ul>
9145 </span>
9146 !! end
9147
9148 !! test
9149 Unclosed formatting tags that straddle lists are closed and reopened
9150 (php parser relies on Tidy to fix up)
9151 !! options
9152 parsoid=wt2html,wt2wt,html2html
9153 !! wikitext
9154 # <s> a
9155 # b </s>
9156 !! html/php+tidy
9157 <ol>
9158 <li><s>a</s></li>
9159 <li><s>b</s></li>
9160 </ol>
9161 !! html/parsoid
9162 <ol><li> <s> a</s></li>
9163 <li><s> b </s></li></ol>
9164 !! end
9165
9166 # See bug 68395.
9167 !!test
9168 1. List embedded in a formatting tag
9169 !! wikitext
9170 <small>
9171 * foo
9172 </small>
9173 !! html/php+tidy
9174 <ul>
9175 <li><small>foo</small></li>
9176 </ul>
9177 !! html/parsoid
9178 <small>
9179 <ul>
9180 <li> foo</li>
9181 </ul>
9182 </small>
9183 !!end
9184
9185 ## Ugly Parsoid output here
9186 ## Not sure what the right output is.
9187 !!test
9188 2. List embedded in a formatting tag
9189 !! wikitext
9190 <small>
9191 *a
9192 *b</small>
9193 !! html/php+tidy
9194 <ul>
9195 <li><small>a</small></li>
9196 <li><small>b</small></li>
9197 </ul>
9198 !! html/parsoid
9199 <small></small>
9200 <ul><small>
9201 <li>a</li>
9202 </small>
9203 <li><small>b</small></li>
9204 </ul>
9205 !!end
9206
9207 # Ugly Parsoid and PHP parser output here
9208 # Not sure if we want to make this a test!
9209 #
9210 ## !!test
9211 ## 3. Unclosed formatting tags in list elements
9212 ## !! wikitext
9213 ## *<small>a
9214 ## *<small>b
9215 ## !! html/php+tidy
9216 ## <ul>
9217 ## <li><small>a</small></li>
9218 ## <li><small><small>b</small></small></li>
9219 ## </ul>
9220 ## !! html/parsoid
9221 ## <ul>
9222 ## <li><small>a</small></li>
9223 ## <small>
9224 ## <li><small>b</small></li>
9225 ## </small></ul>
9226 ## !!end
9227
9228 # This is a bug in the PHP parser + tidy combination.
9229 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9230 # and then fostered out of the table by tidy.)
9231 # We believe the Parsoid output to be correct.
9232 !! test
9233 Table with missing opening <tr> tag
9234 !! options
9235 parsoid=wt2html,wt2wt
9236 !! wikitext
9237 <table>
9238 <td>foo</td>
9239 </tr>
9240 </table>
9241 !! html+tidy
9242 <table>
9243 <tr>
9244 <td>foo</td>
9245 </tr>
9246 </table>
9247 !! end
9248
9249 ###
9250 ### Magic Words
9251 ###
9252
9253 # Note that the current date is hard-coded as
9254 # 1970-01-01T00:02:03Z (a Thursday)
9255 # when running parser tests. The timezone is also fixed to GMT, so
9256 # local date will be identical to current date.
9257
9258 !! test
9259 Magic Word: {{CURRENTDAY}}
9260 !! wikitext
9261 {{CURRENTDAY}}
9262 !! html
9263 <p>1
9264 </p>
9265 !! end
9266
9267 !! test
9268 Magic Word: {{CURRENTDAY2}}
9269 !! wikitext
9270 {{CURRENTDAY2}}
9271 !! html
9272 <p>01
9273 </p>
9274 !! end
9275
9276 !! test
9277 Magic Word: {{CURRENTDAYNAME}}
9278 !! wikitext
9279 {{CURRENTDAYNAME}}
9280 !! html
9281 <p>Thursday
9282 </p>
9283 !! end
9284
9285 !! test
9286 Magic Word: {{CURRENTDOW}}
9287 !! wikitext
9288 {{CURRENTDOW}}
9289 !! html
9290 <p>4
9291 </p>
9292 !! end
9293
9294 !! test
9295 Magic Word: {{CURRENTMONTH}}
9296 !! wikitext
9297 {{CURRENTMONTH}}
9298 !! html
9299 <p>01
9300 </p>
9301 !! end
9302
9303 !! test
9304 Magic Word: {{CURRENTMONTH1}}
9305 !! wikitext
9306 {{CURRENTMONTH1}}
9307 !! html
9308 <p>1
9309 </p>
9310 !! end
9311
9312 !! test
9313 Magic Word: {{CURRENTMONTHABBREV}}
9314 !! wikitext
9315 {{CURRENTMONTHABBREV}}
9316 !! html
9317 <p>Jan
9318 </p>
9319 !! end
9320
9321 !! test
9322 Magic Word: {{CURRENTMONTHNAME}}
9323 !! wikitext
9324 {{CURRENTMONTHNAME}}
9325 !! html
9326 <p>January
9327 </p>
9328 !! end
9329
9330 !! test
9331 Magic Word: {{CURRENTMONTHNAMEGEN}}
9332 !! wikitext
9333 {{CURRENTMONTHNAMEGEN}}
9334 !! html
9335 <p>January
9336 </p>
9337 !! end
9338
9339 !! test
9340 Magic Word: {{CURRENTTIME}}
9341 !! wikitext
9342 {{CURRENTTIME}}
9343 !! html
9344 <p>00:02
9345 </p>
9346 !! end
9347
9348 !! test
9349 Magic Word: {{CURRENTHOUR}}
9350 !! wikitext
9351 {{CURRENTHOUR}}
9352 !! html
9353 <p>00
9354 </p>
9355 !! end
9356
9357 !! test
9358 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9359 !! wikitext
9360 {{CURRENTWEEK}}
9361 !! html
9362 <p>1
9363 </p>
9364 !! end
9365
9366 !! test
9367 Magic Word: {{CURRENTYEAR}}
9368 !! wikitext
9369 {{CURRENTYEAR}}
9370 !! html
9371 <p>1970
9372 </p>
9373 !! end
9374
9375 !! test
9376 Magic Word: {{CURRENTTIMESTAMP}}
9377 !! wikitext
9378 {{CURRENTTIMESTAMP}}
9379 !! html
9380 <p>19700101000203
9381 </p>
9382 !! end
9383
9384 !! test
9385 Magic Words LOCAL (UTC)
9386 !! wikitext
9387 * {{LOCALMONTH}}
9388 * {{LOCALMONTH1}}
9389 * {{LOCALMONTHNAME}}
9390 * {{LOCALMONTHNAMEGEN}}
9391 * {{LOCALMONTHABBREV}}
9392 * {{LOCALDAY}}
9393 * {{LOCALDAY2}}
9394 * {{LOCALDAYNAME}}
9395 * {{LOCALYEAR}}
9396 * {{LOCALTIME}}
9397 * {{LOCALHOUR}}
9398 * {{LOCALWEEK}}
9399 * {{LOCALDOW}}
9400 * {{LOCALTIMESTAMP}}
9401 !! html
9402 <ul><li> 01</li>
9403 <li> 1</li>
9404 <li> January</li>
9405 <li> January</li>
9406 <li> Jan</li>
9407 <li> 1</li>
9408 <li> 01</li>
9409 <li> Thursday</li>
9410 <li> 1970</li>
9411 <li> 00:02</li>
9412 <li> 00</li>
9413 <li> 1</li>
9414 <li> 4</li>
9415 <li> 19700101000203</li></ul>
9416
9417 !! end
9418
9419 !! test
9420 Magic Word: {{FULLPAGENAME}}
9421 !! options
9422 title=[[User:Ævar Arnfjörð Bjarmason]]
9423 !! wikitext
9424 {{FULLPAGENAME}}
9425 !! html
9426 <p>User:Ævar Arnfjörð Bjarmason
9427 </p>
9428 !! end
9429
9430 !! test
9431 Magic Word: {{FULLPAGENAMEE}}
9432 !! options
9433 title=[[User:Ævar Arnfjörð Bjarmason]]
9434 !! wikitext
9435 {{FULLPAGENAMEE}}
9436 !! html
9437 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9438 </p>
9439 !! end
9440
9441 !! test
9442 Magic Word: {{TALKSPACE}}
9443 !! options
9444 title=[[User:Ævar Arnfjörð Bjarmason]]
9445 !! wikitext
9446 {{TALKSPACE}}
9447 !! html
9448 <p>User talk
9449 </p>
9450 !! end
9451
9452 !! test
9453 Magic Word: {{TALKSPACE}}, same namespace
9454 !! options
9455 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9456 !! wikitext
9457 {{TALKSPACE}}
9458 !! html
9459 <p>User talk
9460 </p>
9461 !! end
9462
9463 !! test
9464 Magic Word: {{TALKSPACE}}, main namespace
9465 !! options
9466 title=[[Parser Test]]
9467 !! wikitext
9468 {{TALKSPACE}}
9469 !! html
9470 <p>Talk
9471 </p>
9472 !! end
9473
9474 !! test
9475 Magic Word: {{TALKSPACEE}}
9476 !! options
9477 title=[[User:Ævar Arnfjörð Bjarmason]]
9478 !! wikitext
9479 {{TALKSPACEE}}
9480 !! html
9481 <p>User_talk
9482 </p>
9483 !! end
9484
9485 !! test
9486 Magic Word: {{SUBJECTSPACE}}
9487 !! options
9488 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9489 !! wikitext
9490 {{SUBJECTSPACE}}
9491 !! html
9492 <p>User
9493 </p>
9494 !! end
9495
9496 !! test
9497 Magic Word: {{SUBJECTSPACE}}, same namespace
9498 !! options
9499 title=[[User:Ævar Arnfjörð Bjarmason]]
9500 !! wikitext
9501 {{SUBJECTSPACE}}
9502 !! html
9503 <p>User
9504 </p>
9505 !! end
9506
9507 !! test
9508 Magic Word: {{SUBJECTSPACE}}, main namespace
9509 !! options
9510 title=[[Parser Test]]
9511 !! wikitext
9512 {{SUBJECTSPACE}}
9513 !! html
9514
9515 !! end
9516
9517 !! test
9518 Magic Word: {{SUBJECTSPACEE}}
9519 !! options
9520 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9521 !! wikitext
9522 {{SUBJECTSPACEE}}
9523 !! html
9524 <p>User
9525 </p>
9526 !! end
9527
9528 !! test
9529 Magic Word: {{NAMESPACE}}
9530 !! options
9531 title=[[User:Ævar Arnfjörð Bjarmason]]
9532 !! wikitext
9533 {{NAMESPACE}}
9534 !! html
9535 <p>User
9536 </p>
9537 !! end
9538
9539 !! test
9540 Magic Word: {{NAMESPACEE}}
9541 !! options
9542 title=[[User:Ævar Arnfjörð Bjarmason]]
9543 !! wikitext
9544 {{NAMESPACEE}}
9545 !! html
9546 <p>User
9547 </p>
9548 !! end
9549
9550 !! test
9551 Magic Word: {{NAMESPACENUMBER}}
9552 !! options
9553 title=[[User:Ævar Arnfjörð Bjarmason]]
9554 !! wikitext
9555 {{NAMESPACENUMBER}}
9556 !! html
9557 <p>2
9558 </p>
9559 !! end
9560
9561 !! test
9562 Magic Word: {{SUBPAGENAME}}
9563 !! options
9564 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9565 !! wikitext
9566 {{SUBPAGENAME}}
9567 !! html
9568 <p>sub ö
9569 </p>
9570 !! end
9571
9572 !! test
9573 Magic Word: {{SUBPAGENAMEE}}
9574 !! options
9575 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9576 !! wikitext
9577 {{SUBPAGENAMEE}}
9578 !! html
9579 <p>sub_%C3%B6
9580 </p>
9581 !! end
9582
9583 !! test
9584 Magic Word: {{ROOTPAGENAME}}
9585 !! options
9586 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9587 !! wikitext
9588 {{ROOTPAGENAME}}
9589 !! html
9590 <p>Ævar Arnfjörð Bjarmason
9591 </p>
9592 !! end
9593
9594 !! test
9595 Magic Word: {{ROOTPAGENAMEE}}
9596 !! options
9597 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9598 !! wikitext
9599 {{ROOTPAGENAMEE}}
9600 !! html
9601 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9602 </p>
9603 !! end
9604
9605 !! test
9606 Magic Word: {{BASEPAGENAME}}
9607 !! options
9608 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9609 !! wikitext
9610 {{BASEPAGENAME}}
9611 !! html
9612 <p>Ævar Arnfjörð Bjarmason
9613 </p>
9614 !! end
9615
9616 !! test
9617 Magic Word: {{BASEPAGENAMEE}}
9618 !! options
9619 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9620 !! wikitext
9621 {{BASEPAGENAMEE}}
9622 !! html
9623 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9624 </p>
9625 !! end
9626
9627 !! test
9628 Magic Word: {{TALKPAGENAME}}
9629 !! options
9630 title=[[User:Ævar Arnfjörð Bjarmason]]
9631 !! wikitext
9632 {{TALKPAGENAME}}
9633 !! html
9634 <p>User talk:Ævar Arnfjörð Bjarmason
9635 </p>
9636 !! end
9637
9638 !! test
9639 Magic Word: {{TALKPAGENAMEE}}
9640 !! options
9641 title=[[User:Ævar Arnfjörð Bjarmason]]
9642 !! wikitext
9643 {{TALKPAGENAMEE}}
9644 !! html
9645 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9646 </p>
9647 !! end
9648
9649 !! test
9650 Magic Word: {{SUBJECTPAGENAME}}
9651 !! options
9652 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9653 !! wikitext
9654 {{SUBJECTPAGENAME}}
9655 !! html
9656 <p>User:Ævar Arnfjörð Bjarmason
9657 </p>
9658 !! end
9659
9660 !! test
9661 Magic Word: {{SUBJECTPAGENAMEE}}
9662 !! options
9663 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9664 !! wikitext
9665 {{SUBJECTPAGENAMEE}}
9666 !! html
9667 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9668 </p>
9669 !! end
9670
9671 !! test
9672 Magic Word: {{NUMBEROFFILES}}
9673 !! wikitext
9674 {{NUMBEROFFILES}}
9675 !! html
9676 <p>6
9677 </p>
9678 !! end
9679
9680 !! test
9681 Magic Word: {{PAGENAME}}
9682 !! options
9683 title=[[User:Ævar Arnfjörð Bjarmason]]
9684 !! wikitext
9685 {{PAGENAME}}
9686 !! html
9687 <p>Ævar Arnfjörð Bjarmason
9688 </p>
9689 !! end
9690
9691 !! test
9692 Magic Word: {{PAGENAME}} with metacharacters
9693 !! options
9694 title=[['foo & bar = baz']]
9695 !! wikitext
9696 ''{{PAGENAME}}''
9697 !! html/php
9698 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
9699 </p>
9700 !! html+tidy
9701 <p><i>'foo &amp; bar = baz'</i></p>
9702 !! end
9703
9704 !! test
9705 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
9706 !! options
9707 title=[[*RFC 1234 http://example.com/]]
9708 !! wikitext
9709 {{PAGENAME}}
9710 !! html/php
9711 <p>&#42;RFC&#32;1234 http&#58;//example.com/
9712 </p>
9713 !! html+tidy
9714 <p>*RFC 1234 http://example.com/</p>
9715 !! end
9716
9717 !! test
9718 Magic Word: {{PAGENAMEE}}
9719 !! options
9720 title=[[User:Ævar Arnfjörð Bjarmason]]
9721 !! wikitext
9722 {{PAGENAMEE}}
9723 !! html
9724 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9725 </p>
9726 !! end
9727
9728 !! test
9729 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
9730 !! options
9731 title=[[*RFC 1234 http://example.com/]]
9732 !! wikitext
9733 {{PAGENAMEE}}
9734 !! html/php
9735 <p>&#42;RFC_1234_http&#58;//example.com/
9736 </p>
9737 !! html+tidy
9738 <p>*RFC_1234_http://example.com/</p>
9739 !! end
9740
9741 !! test
9742 Magic Word: {{REVISIONID}}
9743 !! wikitext
9744 {{REVISIONID}}
9745 !! html
9746 <p>1337
9747 </p>
9748 !! end
9749
9750 !! test
9751 Magic Word: {{SCRIPTPATH}}
9752 !! wikitext
9753 {{SCRIPTPATH}}
9754 !! html
9755 <p>/
9756 </p>
9757 !! end
9758
9759 !! test
9760 Magic Word: {{STYLEPATH}}
9761 !! wikitext
9762 {{STYLEPATH}}
9763 !! html
9764 <p>/skins
9765 </p>
9766 !! end
9767
9768 !! test
9769 Magic Word: {{SERVER}}
9770 !! wikitext
9771 {{SERVER}}
9772 !! html
9773 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9774 </p>
9775 !! end
9776
9777 !! test
9778 Magic Word: {{SERVERNAME}}
9779 !! wikitext
9780 {{SERVERNAME}}
9781 !! html
9782 <p>example.org
9783 </p>
9784 !! end
9785
9786 !! test
9787 Magic Word: {{SITENAME}}
9788 !! wikitext
9789 {{SITENAME}}
9790 !! html
9791 <p>MediaWiki
9792 </p>
9793 !! end
9794
9795 !! test
9796 Case-sensitive magic words, when cased differently, should just be template transclusions
9797 !! wikitext
9798 {{CurrentMonth}}
9799 {{currentday}}
9800 {{cURreNTweEK}}
9801 {{currentHour}}
9802 !! html
9803 <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>
9804 <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>
9805 <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>
9806 <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>
9807 </p>
9808 !! end
9809
9810 !! test
9811 Case-insensitive magic words should still work with weird casing.
9812 !! wikitext
9813 {{sErVeRNaMe}}
9814 {{LCFirst:AOEU}}
9815 {{ucFIRST:aoeu}}
9816 {{SERver}}
9817 !! html
9818 <p>example.org
9819 aOEU
9820 Aoeu
9821 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9822 </p>
9823 !! end
9824
9825 # From plwiki:PLOS_ONE
9826 !! test
9827 Parsoid: Page property magic word with magic word contents
9828 !! wikitext
9829 {{DISPLAYTITLE:''{{PAGENAME}}''}}
9830 !! html/parsoid
9831 <meta property="mw:PageProp/displaytitle" content="Main Page" about="#mwt2" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;i data-parsoid=\"{&amp;quot;dsr&amp;quot;:[15,31,2,2]}\">&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[]],&amp;quot;dsr&amp;quot;:[17,29,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;PAGENAME&amp;quot;,&amp;quot;function&amp;quot;:&amp;quot;pagename&amp;quot;},&amp;quot;params&amp;quot;:{},&amp;quot;i&amp;quot;:0}}]}\">Main Page&lt;/span>&lt;/i>"}]]}'/>
9832 !! end
9833
9834 !! test
9835 Parsoid: Template-generated DISPLAYTITLE
9836 !! wikitext
9837 {{{{echo|DISPLAYTITLE}}:Foo}}
9838 !! html/parsoid
9839 <meta property="mw:PageProp/displaytitle" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[0,29,null,null],"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DISPLAYTITLE}}:Foo"},"params":{},"i":0}}]}'/>
9840 !! end
9841
9842 !! test
9843 Namespace 1 {{ns:1}}
9844 !! wikitext
9845 {{ns:1}}
9846 !! html
9847 <p>Talk
9848 </p>
9849 !! end
9850
9851 !! test
9852 Namespace 1 {{ns:01}}
9853 !! wikitext
9854 {{ns:01}}
9855 !! html
9856 <p>Talk
9857 </p>
9858 !! end
9859
9860 !! test
9861 Namespace 0 {{ns:0}} (bug 4783)
9862 !! wikitext
9863 {{ns:0}}
9864 !! html
9865
9866 !! end
9867
9868 !! test
9869 Namespace 0 {{ns:00}} (bug 4783)
9870 !! wikitext
9871 {{ns:00}}
9872 !! html
9873
9874 !! end
9875
9876 !! test
9877 Namespace -1 {{ns:-1}}
9878 !! wikitext
9879 {{ns:-1}}
9880 !! html
9881 <p>Special
9882 </p>
9883 !! end
9884
9885 !! test
9886 Namespace User {{ns:User}}
9887 !! wikitext
9888 {{ns:User}}
9889 !! html
9890 <p>User
9891 </p>
9892 !! end
9893
9894 !! test
9895 Namespace User talk {{ns:User_talk}}
9896 !! wikitext
9897 {{ns:User_talk}}
9898 !! html
9899 <p>User talk
9900 </p>
9901 !! end
9902
9903 !! test
9904 Namespace User talk {{ns:uSeR tAlK}}
9905 !! wikitext
9906 {{ns:uSeR tAlK}}
9907 !! html
9908 <p>User talk
9909 </p>
9910 !! end
9911
9912 !! test
9913 Namespace File {{ns:File}}
9914 !! wikitext
9915 {{ns:File}}
9916 !! html
9917 <p>File
9918 </p>
9919 !! end
9920
9921 !! test
9922 Namespace File {{ns:Image}}
9923 !! wikitext
9924 {{ns:Image}}
9925 !! html
9926 <p>File
9927 </p>
9928 !! end
9929
9930 !! test
9931 Namespace (lang=de) Benutzer {{ns:User}}
9932 !! options
9933 language=de
9934 !! wikitext
9935 {{ns:User}}
9936 !! html
9937 <p>Benutzer
9938 </p>
9939 !! end
9940
9941 !! test
9942 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
9943 !! options
9944 language=de
9945 !! wikitext
9946 {{ns:3}}
9947 !! html
9948 <p>Benutzer Diskussion
9949 </p>
9950 !! end
9951
9952
9953 !! test
9954 Urlencode
9955 !! wikitext
9956 {{urlencode:hi world?!}}
9957 {{urlencode:hi world?!|WIKI}}
9958 {{urlencode:hi world?!|PATH}}
9959 {{urlencode:hi world?!|QUERY}}
9960 !! html
9961 <p>hi+world%3F%21
9962 hi_world%3F!
9963 hi%20world%3F%21
9964 hi+world%3F%21
9965 </p>
9966 !! end
9967
9968 !! test
9969 Magic Word: prioritize type info over data-parsoid
9970 !! options
9971 parsoid=html2wt
9972 !! html/parsoid
9973 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
9974 !! wikitext
9975 __FORCETOC__
9976 !! end
9977
9978 !! test
9979 Magic Word: serialize on separate line (parsoid)
9980 !! options
9981 parsoid=wt2wt,html2wt
9982 !! wikitext
9983 foo
9984 __NOTOC__
9985 bar
9986 !! html/parsoid
9987 foo<meta property="mw:PageProp/notoc"/>bar
9988 !! end
9989
9990 !! test
9991 Magic Word: rt non-english wikis
9992 !! options
9993 parsoid=wt2wt
9994 language=de
9995 !! wikitext
9996 __NOEDITSECTION__
9997 !! html/parsoid
9998 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
9999 !! end
10000
10001 !!test
10002 __proto__ is treated as normal wikitext (T105997)
10003 !!wikitext
10004 __proto__
10005 !!html
10006 <p>__proto__
10007 </p>
10008 !!end
10009
10010 ###
10011 ### Magic links
10012 ###
10013 !! test
10014 Magic links: internal link to RFC (bug 479)
10015 !! wikitext
10016 [[RFC 123]]
10017 !! html/php
10018 <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>
10019 </p>
10020 !! html/parsoid
10021 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10022 !! end
10023
10024 !! test
10025 Magic links: RFC (bug 479)
10026 !! wikitext
10027 RFC 822
10028 !! html/php
10029 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10030 </p>
10031 !! html/parsoid
10032 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10033 !! end
10034
10035 !! test
10036 Magic links: RFC (bug 65278)
10037 !! wikitext
10038 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10039 !! html/php
10040 <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.
10041 </p>
10042 !! html/parsoid
10043 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10044 !! end
10045
10046 !! test
10047 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
10048 !! wikitext
10049 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10050 RFC
10051 822
10052 !! html/php
10053 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10054 RFC
10055 822
10056 </p>
10057 !! html/parsoid
10058 <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>
10059 RFC
10060 822</p>
10061 !! end
10062
10063 !! test
10064 Magic links: ISBN (bug 1937)
10065 !! wikitext
10066 ISBN 0-306-40615-2
10067 !! html/php
10068 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10069 </p>
10070 !! html/parsoid
10071 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10072 !! end
10073
10074 !! test
10075 Magic links: ISBN (bug 65278)
10076 !! wikitext
10077 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10078 !! html/php
10079 <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.
10080 </p>
10081 !! html/parsoid
10082 <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>
10083 !! end
10084
10085 !! test
10086 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10087 !! wikitext
10088 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10089 ISBN
10090 9780316098113
10091 ISBN 978
10092 0316098113
10093 !! html/php
10094 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10095 ISBN
10096 9780316098113
10097 ISBN 978
10098 0316098113
10099 </p>
10100 !! html/parsoid
10101 <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>
10102 ISBN
10103 9780316098113
10104 ISBN 978
10105 0316098113</p>
10106 !! end
10107
10108 !! test
10109 Magic links: PMID incorrectly converts space to underscore
10110 !! wikitext
10111 PMID 1234
10112 !! html/php
10113 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10114 </p>
10115 !! html/parsoid
10116 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10117 !! end
10118
10119 !! test
10120 Magic links: PMID (bug 65278)
10121 !! wikitext
10122 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10123 !! html/php
10124 <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.
10125 </p>
10126 !! html/parsoid
10127 <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>
10128 !! end
10129
10130 !! test
10131 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10132 !! wikitext
10133 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10134 PMID
10135 1234
10136 !! html/php
10137 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10138 PMID
10139 1234
10140 </p>
10141 !! html/parsoid
10142 <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>
10143 PMID
10144 1234</p>
10145 !! end
10146
10147 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10148 # since these are ExtLinkText, not MagicLinkText
10149 !! test
10150 Magic links: use appropriate serialization for "almost" magic links.
10151 !! wikitext
10152 X[[Special:BookSources/0978739256|foo]]
10153
10154 X[//tools.ietf.org/html/rfc1234 foo]
10155 !! html/php
10156 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10157 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10158 </p>
10159 !! html/parsoid
10160 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10161 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10162 !! end
10163
10164 ###
10165 ### Templates
10166 ####
10167
10168 !! test
10169 Nonexistent template
10170 !! wikitext
10171 {{thistemplatedoesnotexist}}
10172 !! html
10173 <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>
10174 </p>
10175 !! end
10176
10177 !! test
10178 Template with invalid target containing tags
10179 !! wikitext
10180 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10181 !! html
10182 <p>{{a<b>b</b>|foo|a=b|a = b}}
10183 </p>
10184 !! end
10185
10186 !! test
10187 Template with invalid target containing unclosed tag
10188 !! wikitext
10189 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10190 !! html
10191 <p>{{a<b>|foo|a=b|a = b}}</b>
10192 </p>
10193 !! end
10194
10195 !! test
10196 Template with invalid target containing wikilink
10197 !! wikitext
10198 {{[[Main Page]]}}
10199 !! html/php
10200 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10201 </p>
10202 !! html/parsoid
10203 <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>
10204 !! end
10205
10206 !! test
10207 Template with just whitespace in it, bug #68421
10208 !! wikitext
10209 {{echo|{{ }}}}
10210 !! html/parsoid
10211 <p><span typeof="mw:Transclusion mw:Nowiki" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{ }}"}},"i":0}}]}'>{{ }}</span></p>
10212 !! end
10213
10214 !! article
10215 Template:test
10216 !! text
10217 This is a test template
10218 !! endarticle
10219
10220 !! test
10221 Simple template
10222 !! wikitext
10223 {{test}}
10224 !! html
10225 <p>This is a test template
10226 </p>
10227 !! end
10228
10229 !! test
10230 Template with explicit namespace
10231 !! wikitext
10232 {{Template:test}}
10233 !! html
10234 <p>This is a test template
10235 </p>
10236 !! end
10237
10238
10239 !! article
10240 Template:paramtest
10241 !! text
10242 This is a test template with parameter {{{param}}}
10243 !! endarticle
10244
10245 !! test
10246 Template parameter
10247 !! wikitext
10248 {{paramtest|param=foo}}
10249 !! html
10250 <p>This is a test template with parameter foo
10251 </p>
10252 !! end
10253
10254 !! article
10255 Template:paramtestnum
10256 !! text
10257 [[{{{1}}}|{{{2}}}]]
10258 !! endarticle
10259
10260 !! test
10261 Template unnamed parameter
10262 !! wikitext
10263 {{paramtestnum|Main Page|the main page}}
10264 !! html
10265 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10266 </p>
10267 !! end
10268
10269 !! article
10270 Template:templatesimple
10271 !! text
10272 (test)
10273 !! endarticle
10274
10275 !! article
10276 Template:templateredirect
10277 !! text
10278 #redirect [[Template:templatesimple]]
10279 !! endarticle
10280
10281 !! article
10282 Template:templateasargtestnum
10283 !! text
10284 {{{{{1}}}}}
10285 !! endarticle
10286
10287 !! article
10288 Template:templateasargtest
10289 !! text
10290 {{template{{{templ}}}}}
10291 !! endarticle
10292
10293 !! article
10294 Template:templateasargtest2
10295 !! text
10296 {{{{{templ}}}}}
10297 !! endarticle
10298
10299 !! test
10300 Template with template name as unnamed argument
10301 !! wikitext
10302 {{templateasargtestnum|templatesimple}}
10303 !! html
10304 <p>(test)
10305 </p>
10306 !! end
10307
10308 !! test
10309 Template with template name as argument
10310 !! wikitext
10311 {{templateasargtest|templ=simple}}
10312 !! html
10313 <p>(test)
10314 </p>
10315 !! end
10316
10317 !! test
10318 Template with template name as argument (2)
10319 !! wikitext
10320 {{templateasargtest2|templ=templatesimple}}
10321 !! html
10322 <p>(test)
10323 </p>
10324 !! end
10325
10326 !! article
10327 Template:templateasargtestdefault
10328 !! text
10329 {{{{{templ|templatesimple}}}}}
10330 !! endarticle
10331
10332 !! article
10333 Template:templa
10334 !! text
10335 '''templ'''
10336 !! endarticle
10337
10338 !! test
10339 Template with default value
10340 !! wikitext
10341 {{templateasargtestdefault}}
10342 !! html
10343 <p>(test)
10344 </p>
10345 !! end
10346
10347 !! test
10348 Template with default value (value set)
10349 !! wikitext
10350 {{templateasargtestdefault|templ=templa}}
10351 !! html
10352 <p><b>templ</b>
10353 </p>
10354 !! end
10355
10356 !! test
10357 Template redirect
10358 !! wikitext
10359 {{templateredirect}}
10360 !! html/php
10361 <p>(test)
10362 </p>
10363 !! html/parsoid
10364 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10365 !! end
10366
10367 !! test
10368 Template with argument in separate line
10369 !! wikitext
10370 {{ templateasargtest |
10371 templ = simple }}
10372 !! html
10373 <p>(test)
10374 </p>
10375 !! end
10376
10377 !! test
10378 Template with complex template as argument
10379 !! wikitext
10380 {{paramtest|
10381 param ={{ templateasargtest |
10382 templ = simple }}}}
10383 !! html
10384 <p>This is a test template with parameter (test)
10385 </p>
10386 !! end
10387
10388 !! test
10389 Template with thumb image (with link in description)
10390 !! wikitext
10391 {{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10392 !! html/php
10393 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>
10394
10395 !! html+tidy
10396 <p>This is a test template with parameter</p>
10397 <div class="thumb tright">
10398 <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>
10399 <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>
10400 </div>
10401 </div>
10402 !! html/parsoid
10403 <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>
10404 !! end
10405
10406 !! article
10407 Template:complextemplate
10408 !! text
10409 {{{1}}} {{paramtest|
10410 param ={{{param}}}}}
10411 !! endarticle
10412
10413 !! test
10414 Template with complex arguments
10415 !! wikitext
10416 {{complextemplate|
10417 param ={{ templateasargtest |
10418 templ = simple }}|[[Template:complextemplate|link]]}}
10419 !! html
10420 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10421 </p>
10422 !! end
10423
10424 !! test
10425 BUG 553: link with two variables in a piped link
10426 !! wikitext
10427 {|
10428 |[[{{{1}}}|{{{2}}}]]
10429 |}
10430 !! html/php
10431 <table>
10432 <tr>
10433 <td>[[{{{1}}}|{{{2}}}]]
10434 </td></tr></table>
10435
10436 !! html/parsoid
10437 <table>
10438 <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>
10439 !! end
10440
10441 # See: T2553
10442 !! test
10443 Abort table cell attribute parsing on wikilink
10444 !! wikitext
10445 {|
10446 | testing [[one|two]] | three || four
10447 | testing one two | three || four
10448 |}
10449 !! html/php
10450 <table>
10451 <tr>
10452 <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>
10453 <td> four
10454 </td>
10455 <td> three </td>
10456 <td> four
10457 </td></tr></table>
10458
10459 !! html/parsoid
10460 <table>
10461 <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>
10462 <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></tr>
10463 </tbody></table>
10464 !! end
10465
10466 !! test
10467 Don't abort table cell attribute parsing if wikilink is found in template arg
10468 !! wikitext
10469 {|
10470 | Test {{#tag:ref|One two "[[three]]" four}}
10471 |}
10472 !! html/parsoid
10473 <table>
10474 <tbody><tr><td> Test <ref about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}' 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>
10475 </tbody></table>
10476 !! end
10477
10478 !! test
10479 Magic variable as template parameter
10480 !! wikitext
10481 {{paramtest|param={{SITENAME}}}}
10482 !! html
10483 <p>This is a test template with parameter MediaWiki
10484 </p>
10485 !! end
10486
10487 !! article
10488 Template:linktest
10489 !! text
10490 [[{{{param}}}|link]]
10491 !! endarticle
10492
10493 !! test
10494 Template parameter as link source
10495 !! wikitext
10496 {{linktest|param=Main Page}}
10497 !! html
10498 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10499 </p>
10500 !! end
10501
10502 !!article
10503 Template:paramtest2
10504 !! text
10505 including another template, {{paramtest|param={{{arg}}}}}
10506 !! endarticle
10507
10508 !! test
10509 Template passing argument to another template
10510 !! wikitext
10511 {{paramtest2|arg='hmm'}}
10512 !! html
10513 <p>including another template, This is a test template with parameter 'hmm'
10514 </p>
10515 !! end
10516
10517 !! article
10518 Template:Linktest2
10519 !! text
10520 Main Page
10521 !! endarticle
10522
10523 !! test
10524 Template as link source
10525 !! wikitext
10526 [[{{linktest2}}]]
10527
10528 [[{{linktest2}}|Main Page]]
10529
10530 [[{{linktest2}}]]Page
10531 !! html
10532 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10533 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10534 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10535 </p>
10536 !! end
10537
10538
10539 !! article
10540 Template:loop1
10541 !! text
10542 {{loop2}}
10543 !! endarticle
10544
10545 !! article
10546 Template:loop2
10547 !! text
10548 {{loop1}}
10549 !! endarticle
10550
10551 !! test
10552 Template infinite loop
10553 !! wikitext
10554 {{loop1}}
10555 !! html
10556 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10557 </p>
10558 !! end
10559
10560 !! test
10561 Template from main namespace
10562 !! wikitext
10563 {{:Main Page}}
10564 !! html
10565 <p>blah blah
10566 </p>
10567 !! end
10568
10569 !! article
10570 Template:table
10571 !! text
10572 {|
10573 | 1 || 2
10574 |-
10575 | 3 || 4
10576 |}
10577 !! endarticle
10578
10579 !! test
10580 BUG 529: Template with table, not included at beginning of line
10581 !! wikitext
10582 foo {{table}}
10583 !! html
10584 <p>foo
10585 </p>
10586 <table>
10587 <tr>
10588 <td> 1 </td>
10589 <td> 2
10590 </td></tr>
10591 <tr>
10592 <td> 3 </td>
10593 <td> 4
10594 </td></tr></table>
10595
10596 !! end
10597
10598 !! test
10599 BUG 523: Template shouldn't eat newline (or add an extra one before table)
10600 !! wikitext
10601 foo
10602 {{table}}
10603 !! html
10604 <p>foo
10605 </p>
10606 <table>
10607 <tr>
10608 <td> 1 </td>
10609 <td> 2
10610 </td></tr>
10611 <tr>
10612 <td> 3 </td>
10613 <td> 4
10614 </td></tr></table>
10615
10616 !! end
10617
10618 !! test
10619 BUG 41: Template parameters shown as broken links
10620 !! wikitext
10621 {{{parameter}}}
10622 !! html
10623 <p>{{{parameter}}}
10624 </p>
10625 !! end
10626
10627 !! test
10628 Template with targets containing wikilinks
10629 !! wikitext
10630 {{[[foo]]}}
10631
10632 {{[[{{echo|foo}}]]}}
10633
10634 {{{{echo|[[foo}}]]}}
10635 !! html
10636 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10637 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10638 </p><p>{{[[foo}}]]
10639 </p>
10640 !! end
10641
10642 !! article
10643 Template:''
10644 !! text
10645 bar
10646 !! endarticle
10647
10648 !! test
10649 Templates: Double quotes as template target
10650 !! wikitext
10651 foo {{''}} baz
10652 !! html/php
10653 <p>foo bar baz
10654 </p>
10655 !! html/parsoid
10656 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
10657 </p>
10658 !! end
10659
10660 !! article
10661 Template:MSGNW test
10662 !! text
10663 ''None'' of '''this''' should be
10664 * interpreted
10665 but rather passed unmodified
10666 {{test}}
10667 <gallery>
10668 File:Foobar.jpg
10669 </gallery>
10670 <!-- comment -->
10671 !! endarticle
10672
10673 # hmm, fix this or just deprecate msgnw and document its behavior?
10674 !! test
10675 msgnw keyword
10676 !! wikitext
10677 {{msgnw:MSGNW test}}
10678 !! html/php
10679 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
10680 &#42; interpreted
10681 &#32;but rather passed unmodified
10682 &#123;&#123;test&#125;&#125;
10683 &#60;gallery&#62;
10684 File:Foobar.jpg
10685 &#60;/gallery&#62;
10686 &#60;!-- comment --&#62;
10687 </p>
10688 !! end
10689
10690 !! test
10691 int keyword
10692 !! wikitext
10693 {{int:youhavenewmessages|lots of money|not!}}
10694 !! html
10695 <p>You have lots of money (not!).
10696 </p>
10697 !! end
10698
10699 !! test
10700 int keyword - non-existing message
10701 !! wikitext
10702 {{int:var}}
10703 !! html
10704 <p>&lt;var&gt;
10705 </p>
10706 !! end
10707
10708 !! article
10709 Template:Includes
10710 !! text
10711 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10712 !! endarticle
10713
10714 !! test
10715 <includeonly> and <noinclude> being included
10716 !! wikitext
10717 {{Includes}}
10718 !! html
10719 <p>Foobar
10720 </p>
10721 !! end
10722
10723 !! article
10724 Template:Includes2
10725 !! text
10726 <onlyinclude>Foo</onlyinclude>bar
10727 !! endarticle
10728
10729 !! test
10730 <onlyinclude> being included
10731 !! wikitext
10732 {{Includes2}}
10733 !! html
10734 <p>Foo
10735 </p>
10736 !! end
10737
10738
10739 !! article
10740 Template:Includes3
10741 !! text
10742 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
10743 !! endarticle
10744
10745 !! test
10746 <onlyinclude> and <includeonly> being included
10747 !! wikitext
10748 {{Includes3}}
10749 !! html
10750 <p>Foo
10751 </p>
10752 !! end
10753
10754 !! test
10755 <includeonly> and <noinclude> on a page
10756 !! wikitext
10757 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10758 !! html
10759 <p>Foozar
10760 </p>
10761 !! end
10762
10763 !! test
10764 Un-closed <noinclude>
10765 !! wikitext
10766 <noinclude>
10767 !! html
10768 !! end
10769
10770 !! test
10771 <onlyinclude> on a page
10772 !! wikitext
10773 <onlyinclude>Foo</onlyinclude>bar
10774 !! html
10775 <p>Foobar
10776 </p>
10777 !! end
10778
10779 !! test
10780 Un-closed <onlyinclude>
10781 !! wikitext
10782 <onlyinclude>
10783 !! html
10784 !! end
10785
10786 !!test
10787 Self-closed noinclude, includeonly, onlyinclude tags
10788 !! wikitext
10789 <noinclude />
10790 <includeonly />
10791 <onlyinclude />
10792 !! html
10793 <p><br />
10794 </p>
10795 !!end
10796
10797 !!test
10798 Unbalanced includeonly and noinclude tags
10799 !! wikitext
10800 {|
10801 |a</noinclude>
10802 |b</noinclude></noinclude>
10803 |c</noinclude></includeonly>
10804 |d</includeonly></includeonly>
10805 |}
10806 !! html
10807 <table>
10808 <tr>
10809 <td>a
10810 </td>
10811 <td>b
10812 </td>
10813 <td>c&lt;/includeonly&gt;
10814 </td>
10815 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
10816 </td></tr></table>
10817
10818 !!end
10819
10820 !! article
10821 Template:Includeonly section
10822 !! text
10823 <includeonly>
10824 ==Includeonly section==
10825 </includeonly>
10826 ==Section T-1==
10827 !!endarticle
10828
10829 !! test
10830 Bug 6563: Edit link generation for section shown by <includeonly>
10831 !! wikitext
10832 {{includeonly section}}
10833 !! html
10834 <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>
10835 <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>
10836
10837 !! end
10838
10839 # Uses same input as the contents of [[Template:Includeonly section]]
10840 !! test
10841 Bug 6563: Section extraction for section shown by <includeonly>
10842 !! options
10843 section=T-2
10844 !! wikitext
10845 <includeonly>
10846 ==Includeonly section==
10847 </includeonly>
10848 ==Section T-2==
10849 !! html
10850 ==Section T-2==
10851 !! end
10852
10853 !! test
10854 Bug 6563: Edit link generation for section suppressed by <includeonly>
10855 !! wikitext
10856 <includeonly>
10857 ==Includeonly section==
10858 </includeonly>
10859 ==Section 1==
10860 !! html
10861 <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>
10862
10863 !! end
10864
10865 !! test
10866 Bug 6563: Section extraction for section suppressed by <includeonly>
10867 !! options
10868 section=1
10869 !! wikitext
10870 <includeonly>
10871 ==Includeonly section==
10872 </includeonly>
10873 ==Section 1==
10874 !! html
10875 ==Section 1==
10876 !! end
10877
10878 !! test
10879 Un-closed <includeonly>
10880 !! wikitext
10881 <includeonly>
10882 !! html
10883 <p>&lt;includeonly&gt;
10884 </p>
10885 !! end
10886
10887 ## We used to, but no longer wt2wt this test since the default serializer
10888 ## will normalize the include directives to serialize on their own line.
10889 ## Selser will take care of preserving formatting in scenarios where they
10890 ## intermingled with other wikitext.
10891 !! test
10892 Includes and comments at SOL
10893 !! options
10894 parsoid=wt2html,html2html
10895 !! wikitext
10896 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
10897
10898 <noinclude>
10899 some
10900 </noinclude>* stuff
10901 * here
10902
10903 <includeonly>can have stuff</includeonly>=== here ===
10904
10905 !! html/php
10906 <h2><span class="mw-headline" id="hu">hu</span></h2>
10907 <p>some
10908 </p>
10909 <ul><li> stuff</li>
10910 <li> here</li></ul>
10911 <h3><span class="mw-headline" id="here">here</span></h3>
10912
10913 !! html/parsoid
10914 <!-- 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>
10915
10916 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
10917 <p>some</p>
10918 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
10919 <li> here</li></ul>
10920
10921 <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>
10922
10923 !! end
10924
10925 # TODO: test with DOM fragment reuse!
10926 !! test
10927 Parsoid: DOM fragment reuse
10928 !! options
10929 parsoid=wt2wt,wt2html
10930 !! wikitext
10931 a{{echo|b<table></table>c}}d
10932
10933 a{{echo|b
10934 <table></table>
10935 c}}d
10936
10937 {{echo|a
10938
10939 <table></table>
10940
10941 b}}
10942 !! html
10943 <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","spc":["","","",""]}]]}'>ab</p><table about="#mwt1" data-parsoid='{"stx":"html"}'></table><p about="#mwt1">cd</p>
10944
10945 <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","spc":["","","",""]}]]}'>ab</p><span about="#mwt2">
10946 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
10947 </span><p about="#mwt2">cd</p>
10948
10949 <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","spc":["","","",""]}]]}'>a</p><span about="#mwt3">
10950
10951 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
10952
10953 </span><p about="#mwt3">b</p>
10954 !! end
10955
10956 !! test
10957 Parsoid: Merge double tds (T52603)
10958 !! options
10959 parsoid
10960 !! wikitext
10961 {|
10962 |{{echo|{{!}} foo}}
10963 |}
10964 !! html
10965 <table><tbody>
10966 <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>
10967 </tbody></table>
10968 !! end
10969
10970 !! test
10971 Parsoid: Merge double tds in nested transclusion content (T52603)
10972 !! options
10973 parsoid
10974 !! wikitext
10975 {{echo|<div>}}
10976 {|
10977 |{{echo|{{!}} foo}}
10978 |}
10979 {{echo|</div>}}
10980 !! html
10981 <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}}]}'>
10982 <table><tbody>
10983 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
10984 </tbody></table>
10985 </div>
10986 !! end
10987
10988 ###
10989 ### <includeonly> and <noinclude> in attributes
10990 ###
10991 !!test
10992 0. includeonly around the entire attribute
10993 !! wikitext
10994 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
10995 !! html
10996 <p><span id="v2">bar</span>
10997 </p>
10998 !!end
10999
11000 !!test
11001 1. includeonly in html attr key
11002 !! wikitext
11003 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
11004 !! html
11005 <p><span id="foo">bar</span>
11006 </p>
11007 !!end
11008
11009 !!test
11010 2. includeonly in html attr value
11011 !! wikitext
11012 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11013 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11014 !! html
11015 <p><span id="v1">bar</span>
11016 <span id="v1">bar</span>
11017 </p>
11018 !!end
11019
11020 !!test
11021 3. includeonly in part of an attr value
11022 !! wikitext
11023 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11024 !! html
11025 <p><span style="color:red;">bar</span>
11026 </p>
11027 !!end
11028
11029 !!test
11030 4. includeonly in table attributes
11031 !! wikitext
11032 {|
11033 |- <noinclude>
11034 |-
11035 |a
11036 </noinclude>
11037 |- <includeonly>
11038 |-
11039 |b
11040 </includeonly>
11041 |}
11042 !! html
11043 <table>
11044
11045
11046 <tr>
11047 <td>a
11048 </td></tr>
11049 </table>
11050
11051 !!end
11052
11053 ###
11054 ### Token Stream Patcher tests
11055 ###
11056 ### These tests won't always pass wt2wt and other modes because
11057 ### on serialization, the table will be output on a new line.
11058 ### For now, we are blacklisting them, and using this to test selser.
11059 ###
11060
11061 !!test
11062 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11063 !!options
11064 parsoid=wt2html,wt2wt
11065 !!wikitext
11066 {{echo|}}{| width = '100%'
11067 |foo
11068 |}
11069 !!html/parsoid
11070 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11071 <tbody><tr><td>foo</td></tr>
11072 </tbody></table>
11073 !!end
11074
11075 ## We used to, but no longer wt2wt this test since the default serializer
11076 ## will normalize the include directives to serialize on their own line.
11077 ## Selser will take care of preserving formatting in scenarios where they
11078 ## intermingled with other wikitext.
11079 !!test
11080 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11081 !!options
11082 parsoid=wt2html
11083 !!wikitext
11084 <includeonly>a</includeonly>{| {{{b}}}
11085 |c
11086 |}
11087 !!html/parsoid
11088 <meta typeof="mw:Includes/IncludeOnly"/><meta typeof="mw:Includes/IncludeOnly/End"/><table about="#mwt2" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"{{{b}}}","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[31,38,null,null],&amp;quot;src&amp;quot;:&amp;quot;{{{b}}}&amp;quot;}\">{{{b}}}&lt;/span>"},{"html":""}]]}' data-parsoid='{"a":{"{{{b}}}":null},"sa":{"{{{b}}}":""}}'>
11089 <tbody><tr><td>c</td></tr>
11090 </tbody></table>
11091
11092 !!end
11093
11094 ###
11095 ### Testing parsing of templates where a template arg
11096 ### has the same name as the template itself.
11097 ###
11098
11099 !! article
11100 Template:quote
11101 !! text
11102 {{{quote|{{{1}}}}}}
11103 !! endarticle
11104
11105 !!test
11106 Templates: Template Name/Arg clash: 1. Use of positional param
11107 !! wikitext
11108 {{quote|foo}}
11109 !! html
11110 <p>foo
11111 </p>
11112 !!end
11113
11114 !!test
11115 Templates: Template Name/Arg clash: 2. Use of named param
11116 !! wikitext
11117 {{quote|quote=foo}}
11118 !! html
11119 <p>foo
11120 </p>
11121 !!end
11122
11123 !!test
11124 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11125 !! wikitext
11126 {{quote|quote}}
11127 !! html
11128 <p>quote
11129 </p>
11130 !!end
11131
11132 ###
11133 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11134 ###
11135
11136 !!test
11137 Templates: 1. Simple use
11138 !! wikitext
11139 {{echo|Foo}}
11140 !! html
11141 <p>Foo
11142 </p>
11143 !!end
11144
11145 !!test
11146 Templates: 2. Inside a block tag
11147 !! wikitext
11148 <div>{{echo|Foo}}</div>
11149 <blockquote>{{echo|Foo}}</blockquote>
11150 !! html
11151 <div>Foo</div>
11152 <blockquote>Foo</blockquote>
11153
11154 !! html+tidy
11155 <div>Foo</div>
11156 <blockquote>
11157 <p>Foo</p>
11158 </blockquote>
11159 !!end
11160
11161 !!test
11162 Templates: P-wrapping: 1a. Templates on consecutive lines
11163 !! wikitext
11164 {{echo|Foo}}
11165 {{echo|bar}}
11166 !! html
11167 <p>Foo
11168 bar
11169 </p>
11170 !!end
11171
11172 !!test
11173 Templates: P-wrapping: 1b. Templates on consecutive lines
11174 !! wikitext
11175 Foo
11176
11177 {{echo|bar}}
11178 {{echo|baz}}
11179 !! html
11180 <p>Foo
11181 </p><p>bar
11182 baz
11183 </p>
11184 !!end
11185
11186 !!test
11187 Templates: P-wrapping: 1c. Templates on consecutive lines
11188 !! wikitext
11189 {{echo|Foo}}
11190 {{echo|bar}} <div>baz</div>
11191 !! html
11192 <p>Foo
11193 </p>
11194 bar <div>baz</div>
11195
11196 !! html+tidy
11197 <p>Foo</p>
11198 <p>bar</p>
11199 <div>baz</div>
11200 !! end
11201
11202 !!test
11203 Templates: P-wrapping: 1d. Template preceded by comment-only line
11204 !!options
11205 parsoid
11206 !! wikitext
11207 <!-- foo -->
11208 {{echo|Bar}}
11209 !! html
11210 <!-- foo -->
11211
11212 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11213 !!end
11214
11215 !!test
11216 Templates: Inline Text: 1. Multiple template uses
11217 !! wikitext
11218 {{echo|Foo}}bar{{echo|baz}}
11219 !! html
11220 <p>Foobarbaz
11221 </p>
11222 !!end
11223
11224 !!test
11225 Templates: Inline Text: 2. Back-to-back template uses
11226 !! wikitext
11227 {{echo|Foo}}{{echo|bar}}
11228 !! html
11229 <p>Foobar
11230 </p>
11231 !!end
11232
11233 !!test
11234 Templates: Block Tags: 1. Multiple template uses
11235 !! wikitext
11236 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11237 !! html
11238 <div>Foo</div><div>bar</div><div>baz</div>
11239
11240 !!end
11241
11242 !!test
11243 Templates: Block Tags: 2. Back-to-back template uses
11244 !! wikitext
11245 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11246 !! html
11247 <div>Foo</div><div>bar</div>
11248
11249 !!end
11250
11251 # This is an edge case relating to paragraph wrapping.
11252 !!test
11253 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11254 !! wikitext
11255 {{echo|a
11256 b</p>}}
11257 !! html/parsoid
11258 <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
11259 b</p>
11260 !!end
11261
11262 !!test
11263 Templates: Links: 1. Simple example
11264 !! wikitext
11265 {{echo|[[Foo|bar]]}}
11266 !! html
11267 <p><a href="/wiki/Foo" title="Foo">bar</a>
11268 </p>
11269 !!end
11270
11271 !!test
11272 Templates: Links: 2. Generation of link href
11273 !! wikitext
11274 [[{{echo|Foo}}|bar]]
11275 !! html
11276 <p><a href="/wiki/Foo" title="Foo">bar</a>
11277 </p>
11278 !!end
11279
11280 !!test
11281 Templates: Links: 3. Generation of part of a link href
11282 !! wikitext
11283 [[Fo{{echo|o}}|bar]]
11284
11285 [[Foo{{echo|bar}}]]
11286
11287 [[Foo{{echo|bar}}baz]]
11288
11289 [[Foo{{echo|bar}}|bar]]
11290
11291 [[:Foo{{echo|bar}}]]
11292
11293 [[:Foo{{echo|bar}}|bar]]
11294 !! html
11295 <p><a href="/wiki/Foo" title="Foo">bar</a>
11296 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11297 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11298 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11299 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11300 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11301 </p>
11302 !!end
11303
11304 !!test
11305 Templates: Links: 4. Multiple templates generating link href
11306 !! wikitext
11307 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11308 !! html
11309 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11310 </p>
11311 !!end
11312
11313 !!test
11314 Templates: Links: 5. Generation of link text
11315 !! wikitext
11316 [[Foo|{{echo|bar}}]]
11317 !! html
11318 <p><a href="/wiki/Foo" title="Foo">bar</a>
11319 </p>
11320 !!end
11321
11322 !!test
11323 Templates: Links: 5. Nested templates (only outermost template should be marked)
11324 !! wikitext
11325 {{echo|[[{{echo|Foo}}|bar]]}}
11326 !! html
11327 <p><a href="/wiki/Foo" title="Foo">bar</a>
11328 </p>
11329 !!end
11330
11331 !!test
11332 Templates: HTML Tag: 1. Generation of HTML attr. key
11333 !! wikitext
11334 <div {{echo|style}}="color:red;">foo</div>
11335 !! html
11336 <div style="color:red;">foo</div>
11337
11338 !!end
11339
11340 !!test
11341 Templates: HTML Tag: 2. Generation of HTML attr. value
11342 !! wikitext
11343 <div style={{echo|'color:red;'}}>foo</div>
11344 !! html
11345 <div style="color:red;">foo</div>
11346
11347 !!end
11348
11349 !!test
11350 Templates: HTML Tag: 3. Generation of HTML attr key and value
11351 !! wikitext
11352 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11353 !! html
11354 <div style="color:red;">foo</div>
11355
11356 !!end
11357
11358 !!test
11359 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11360 !! wikitext
11361 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11362 !! html
11363 <div title="This is a long title with just one piece templated">foo</div>
11364
11365 !!end
11366
11367 !!test
11368 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11369 !! wikitext
11370 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11371 !! html
11372 <div title="This is a long title with just one piece templated">foo</div>
11373
11374 !!end
11375
11376 !!test
11377 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11378 !! wikitext
11379 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11380 !! html
11381 <div title="This is a long title with just one piece templated">foo</div>
11382
11383 !!end
11384
11385 # SSS FIXME: While it is great we added support for all this,
11386 # do we want to make this part of the spec? Maybe we want to
11387 # deprecate this kind of usage in the future?
11388 !!test
11389 Templates: HTML Tag: 7. Generation of partial attribute key string
11390 !! wikitext
11391 <div st{{echo|yle}}="color:red;">foo</div>
11392 !! html
11393 <div style="color:red;">foo</div>
11394
11395 !!end
11396
11397 !! test
11398 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11399 !! wikitext
11400 <div {{echo|1=id="v1"}}>bar</div>
11401 !! html
11402 <div id="v1">bar</div>
11403
11404 !!end
11405
11406 !! test
11407 Templates: HTML Tag: 9. Multiple template-generated attributes
11408 !! wikitext
11409 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11410 !! html
11411 <div id="v1" title="foo">bar</div>
11412
11413 !!end
11414
11415 !! test
11416 Templates: Support for templates generating attributes and content
11417 !! wikitext
11418 {| {{mixed_attr_content_template}}
11419 |-
11420 |bar
11421 |}
11422 !! html/php
11423 <table style="color:red;" title="T48811">
11424
11425 <tr>
11426 <td>foo
11427 </td></tr>
11428 <tr>
11429 <td>bar
11430 </td></tr></table>
11431
11432 !! html/parsoid
11433 <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|}"]}'>
11434 <tbody><tr>
11435 <td>foo</td></tr>
11436 <tr>
11437 <td>bar</td></tr>
11438 </tbody></table>
11439 !!end
11440
11441 !! test
11442 1. Entities and nowikis inside templated attributes should be handled correctly
11443 !! wikitext
11444 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11445 !! html/php
11446 <div style="background:#f9f9f9;">foo</div>
11447
11448 !! html/parsoid
11449 <div style="background:#f9f9f9;" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html"}' data-mw='{"attribs":[[{"txt":"style","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[5,49,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;style{{=}}\\&amp;quot;background:&amp;amp;#35;f9f9f9;\\&amp;quot;&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">style&lt;/span>&lt;span typeof=\"mw:Nowiki\" about=\"#mwt1\" data-parsoid=\"{}\">=&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">\"background:&lt;/span>&lt;span typeof=\"mw:Entity\" about=\"#mwt1\" data-parsoid=\"{&amp;quot;src&amp;quot;:&amp;quot;&amp;amp;#35;&amp;quot;,&amp;quot;srcContent&amp;quot;:&amp;quot;#&amp;quot;}\">#&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">f9f9f9;\"&lt;/span>"},{"html":""}]]}'>foo</div>
11450 !! end
11451
11452 !! test
11453 2. Entities and nowikis inside templated attributes should be handled correctly
11454 !! wikitext
11455 {|
11456 |{{table_attribs_3}}
11457 |}
11458 !! html/php
11459 <table>
11460 <tr>
11461 <td style="background:#f9f9f9;">Foo
11462 </td></tr></table>
11463
11464 !! html/parsoid
11465 <table>
11466 <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>
11467 </tbody></table>
11468 !! end
11469
11470 !! test
11471 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11472 !! wikitext
11473 {{tbl-start}}
11474 |{{table_attribs_3}}
11475 {{tbl-end}}
11476 !! html/php
11477 <table>
11478 <tr>
11479 <td style="background:#f9f9f9;">Foo
11480 </td></tr></table>
11481
11482 !! html/parsoid
11483 <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}}]}'>
11484 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11485 </tbody></table>
11486 !! end
11487
11488 # T107622
11489 !! test
11490 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11491 !! wikitext
11492 {|
11493 | {{table_attribs_6}} hi
11494 |}
11495 !! html/php
11496 <table>
11497 <tr>
11498 <td style="background: red;"> hi
11499 </td></tr></table>
11500
11501 !! html/parsoid
11502 <table>
11503 <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>
11504 </tbody></table>
11505 !! end
11506
11507 !!test
11508 Templates: HTML Tables: 1. Generating start of a HTML table
11509 !! wikitext
11510 {{echo|<table><tr><td>foo</td>}}</tr></table>
11511 !! html
11512 <table><tr><td>foo</td></tr></table>
11513
11514 !!end
11515
11516 !!test
11517 Templates: HTML Tables: 2a. Generating middle of a HTML table
11518 !! wikitext
11519 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11520 !! html
11521 <table><tr><td>foo</td></tr></table>
11522
11523 !!end
11524
11525 !!test
11526 Templates: HTML Tables: 2b. Generating middle of a HTML table
11527 !! wikitext
11528 <table>{{echo|<tr><td>foo</td></tr>}}</table>
11529 !! html
11530 <table><tr><td>foo</td></tr></table>
11531
11532 !!end
11533
11534 !!test
11535 Templates: HTML Tables: 3. Generating end of a HTML table
11536 !! wikitext
11537 <table><tr>{{echo|<td>foo</td></tr></table>}}
11538 !! html
11539 <table><tr><td>foo</td></tr></table>
11540
11541 !!end
11542
11543 !!test
11544 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
11545 !! wikitext
11546 {{echo|<table>}}<tr><td>foo</td></tr></table>
11547 !! html
11548 <table><tr><td>foo</td></tr></table>
11549
11550 !!end
11551
11552 !!test
11553 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
11554 !! wikitext
11555 <table>{{echo|<tr>}}<td>foo</td></tr></table>
11556 !! html
11557 <table><tr><td>foo</td></tr></table>
11558
11559 !!end
11560
11561 !!test
11562 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
11563 !! wikitext
11564 <table><tr>{{echo|<td>}}foo</td></tr></table>
11565 !! html
11566 <table><tr><td>foo</td></tr></table>
11567
11568 !!end
11569
11570 !!test
11571 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
11572 !! wikitext
11573 <table><tr><td>foo{{echo|</td>}}</tr></table>
11574 !! html
11575 <table><tr><td>foo</td></tr></table>
11576
11577 !!end
11578
11579 !!test
11580 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
11581 !! wikitext
11582 <table><tr><td>foo</td>{{echo|</tr>}}</table>
11583 !! html
11584 <table><tr><td>foo</td></tr></table>
11585
11586 !!end
11587
11588 !!test
11589 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
11590 !! wikitext
11591 <table><tr><td>foo</td></tr>{{echo|</table>}}
11592 !! html
11593 <table><tr><td>foo</td></tr></table>
11594
11595 !!end
11596
11597 !!test
11598 Templates: HTML Tables: 5. Proper fostering of categories from inside
11599 !!options
11600 parsoid=wt2html,wt2wt
11601 !! wikitext
11602 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
11603 <!--Two categories (Bug 50330)-->
11604 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
11605 !! html
11606 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
11607 <!--Two categories (Bug 50330)-->
11608 <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>
11609 !!end
11610
11611 !!test
11612 Templates: Wiki Tables: 1a. Fostering of entire template content
11613 !! wikitext
11614 {|
11615 {{echo|a}}
11616 |}
11617 !! html
11618 <table>
11619 a
11620 <tr><td></td></tr></table>
11621
11622 !! html+tidy
11623 <p>a</p>
11624 <table>
11625 <tr>
11626 <td></td>
11627 </tr>
11628 </table>
11629 !! end
11630
11631 !!test
11632 Templates: Wiki Tables: 1b. Fostering of entire template content
11633 !! wikitext
11634 {|
11635 {{echo|<div>}}
11636 foo
11637 {{echo|</div>}}
11638 |}
11639 !! html
11640 <table>
11641 <div>
11642 <p>foo
11643 </p>
11644 </div>
11645 <tr><td></td></tr></table>
11646
11647 !! html+tidy
11648 <div>
11649 <p>foo</p>
11650 </div>
11651 <table>
11652 <tr>
11653 <td></td>
11654 </tr>
11655 </table>
11656 !! end
11657
11658 !!test
11659 Templates: Wiki Tables: 2. Fostering of partial template content
11660 !! wikitext
11661 {|
11662 {{echo|a
11663 <div>b</div>}}
11664 |}
11665 !! html
11666 <table>
11667 a
11668 <div>b</div>
11669 <tr><td></td></tr></table>
11670
11671 !! html+tidy
11672 <p>a</p>
11673 <div>b</div>
11674 <table>
11675 <tr>
11676 <td></td>
11677 </tr>
11678 </table>
11679 !! end
11680
11681 !!test
11682 Templates: Wiki Tables: 3. td-content via multiple templates
11683 !! wikitext
11684 {|
11685 {{echo|{{pipe}}a}}{{echo|b}}
11686 |}
11687 !! html
11688 <table>
11689 <tr>
11690 <td>ab
11691 </td></tr></table>
11692
11693 !!end
11694
11695 !!test
11696 Templates: Wiki Tables: 4. Templated tags, no content
11697 !! wikitext
11698 {{tbl-start}}
11699 {{tbl-end}}
11700 !! html
11701 <table>
11702 <tr><td></td></tr></table>
11703
11704 !!end
11705
11706 !!test
11707 Templates: Wiki Tables: 5. Templated tags, regular td-tags
11708 !! wikitext
11709 {{tbl-start}}
11710 |foo
11711 {{tbl-end}}
11712 !! html
11713 <table>
11714 <tr>
11715 <td>foo
11716 </td></tr></table>
11717
11718 !!end
11719
11720 !!test
11721 Templates: Wiki Tables: 6. Templated tags, templated td-tags
11722 !! wikitext
11723 {{tbl-start}}
11724 {{!}}foo
11725 {{tbl-end}}
11726 !! html
11727 <table>
11728 <tr>
11729 <td>foo
11730 </td></tr></table>
11731
11732 !!end
11733
11734 ## This test case is very specific to Parsoid's internals
11735 ## and is hence only tested for Parsoid's code. Parsoid uses
11736 ## a <meta> marker tag for <ref> tags and they are expanded
11737 ## much later. We are verifying that this <meta> tag usage
11738 ## doesn't prevent foster parenting.
11739 !!test
11740 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
11741 !!wikitext
11742 {{PartialTable}}<ref>foo</ref>
11743 |}
11744
11745 <references />
11746 !!html/parsoid
11747 <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">
11748 <tbody>
11749 </tbody></table>
11750
11751 <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>
11752 !!end
11753
11754 !! test
11755 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
11756 !! wikitext
11757 {{echo|
11758 {{{!}}
11759 {{!}}-}}
11760 <onlyinclude>
11761 |foo
11762 </onlyinclude>
11763 {{!}}}
11764 !! html/parsoid
11765 <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{{!}}}"]}'>
11766 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
11767 <tbody><tr>
11768
11769 <td>foo
11770 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
11771 </tbody></table>
11772 !! end
11773
11774 !!test
11775 Templates: Lists: Multi-line list-items via templates
11776 !! wikitext
11777 *{{echo|a {{nonexistent|
11778 unused}}}}
11779 *{{echo|b {{nonexistent|
11780 unused}}}}
11781 !! html
11782 <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>
11783 <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>
11784
11785 !!end
11786
11787 !!test
11788 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
11789 !! wikitext
11790 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
11791 !! html
11792 <p><i>ab</i>c<i>d</i>e
11793 </p>
11794 !!end
11795
11796 !!test
11797 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
11798 (PHP parser generates misnested html)
11799 !! wikitext
11800 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
11801 !! html/parsoid
11802 <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>
11803 !!end
11804
11805 !!test
11806 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
11807 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
11808 !! options
11809 parsoid=wt2html,wt2wt
11810 !! wikitext
11811 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
11812 !! html
11813 <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>
11814 <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>
11815 <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>
11816 !!end
11817
11818 !!test
11819 Templates: Ugly nesting: 4. Divs opened/closed across templates
11820 !! wikitext
11821 a<div>b{{echo|c</div>d}}e
11822 !! html
11823 a<div>bc</div>de
11824
11825 !! html+tidy
11826 <p>a</p>
11827 <div>bc</div>
11828 <p>de</p>
11829 !! end
11830
11831 !!test
11832 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
11833 (Parsoid-centric)
11834 !! options
11835 parsoid
11836 !! wikitext
11837 {|
11838 |{{echo|foo</table>}}
11839 |bar
11840 |}
11841 !! html
11842 <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|}"]}'>
11843
11844 <tbody>
11845 <tr>
11846 <td>foo</td></tr></tbody></table><span about="#mwt1">
11847 </span><span about="#mwt1">|bar</span><span about="#mwt1">
11848 |}</span>
11849 !!end
11850
11851 !!test
11852 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
11853 (Parsoid-centric)
11854 !! options
11855 parsoid
11856 !! wikitext
11857 <table>
11858 <tr>
11859 <td>
11860 <table>
11861 <tr>
11862 <td>1. {{echo|foo </table>}}</td>
11863 <td> bar </td>
11864 <td>2. {{echo|baz </table>}}</td>
11865 </tr>
11866 <tr>
11867 <td>abc</td>
11868 </tr>
11869 </table>
11870 </td>
11871 </tr>
11872 <tr>
11873 <td>xyz</td>
11874 </tr>
11875 </table>
11876 !! html
11877 <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>"]}'>
11878 <tbody><tr>
11879 <td>
11880 <table>
11881 <tbody><tr>
11882 <td>1. foo </td></tr></tbody></table></td>
11883 <td> bar </td>
11884 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
11885 </span><span about="#mwt2">
11886 </span><span about="#mwt2">
11887 </span><span about="#mwt2">abc</span><span about="#mwt2">
11888 </span><span about="#mwt2">
11889 </span><span about="#mwt2">
11890 </span><span about="#mwt2">
11891 </span><span about="#mwt2">
11892 </span><span about="#mwt2">
11893 </span><span about="#mwt2">xyz</span><span about="#mwt2">
11894 </span><span about="#mwt2">
11895 </span>
11896 !!end
11897
11898 !! test
11899 Templates: Ugly templates: 3. newline-only template parameter
11900 !! wikitext
11901 foo {{echo|
11902 }}
11903 !! html
11904 <p>foo
11905 </p>
11906 !! end
11907
11908 # This looks like a bug: a single newline triggers p/br for some reason.
11909 !! test
11910 Templates: Ugly templates: 4. newline-only template parameter inconsistency
11911 !! wikitext
11912 {{echo|
11913 }}
11914 !! html
11915 <p><br />
11916 </p>
11917 !! end
11918
11919 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
11920 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
11921 !! test
11922 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
11923 !! wikitext
11924 {{echo|<table>}}
11925 {{echo|<div>foo}}
11926 {{echo|</table>}}
11927 !! html/parsoid
11928 <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","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}]]}'>foo
11929 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11930 </table>
11931 !! end
11932
11933 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
11934 # that are "identical" and generate nesting cycles in the algorithm
11935 !! test
11936 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
11937 !! wikitext
11938 {{echo|<table><tr><td><table>}}
11939 {{echo|<div>}}
11940 {{echo|</div>}}
11941 !! html/parsoid
11942 <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","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}],[{"k":"1","spc":["","","",""]}]]}'><tbody><tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>
11943 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11944 </table></td></tr></tbody></table>
11945 !! end
11946
11947 !! test
11948 Templates: Parameters substituted at the top-level
11949 !! wikitext
11950 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
11951 !! html/php
11952 <p><i>who</i> me? <b>never!</b>
11953 </p>
11954 !! html/parsoid
11955 <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>
11956 !! end
11957
11958 !!test
11959 Parser Functions: 1. Simple example
11960 !! wikitext
11961 {{uc:foo}}
11962 !! html
11963 <p>FOO
11964 </p>
11965 !!end
11966
11967 !!test
11968 Parser Functions: 2. Nested use (only outermost should be marked up)
11969 !! wikitext
11970 {{uc:{{lc:FOO}}}}
11971 !! html
11972 <p>FOO
11973 </p>
11974 !!end
11975
11976 ###
11977 ### Pre-save transform tests
11978 ###
11979 !! test
11980 pre-save transform: subst:
11981 !! options
11982 pst
11983 !! wikitext
11984 {{subst:test}}
11985 !! html/php
11986 This is a test template
11987 !! end
11988
11989 !! test
11990 pre-save transform: normal template
11991 !! options
11992 pst
11993 !! wikitext
11994 {{test}}
11995 !! html/php
11996 {{test}}
11997 !! end
11998
11999 !! test
12000 pre-save transform: nonexistent template
12001 !! options
12002 pst
12003 !! wikitext
12004 {{thistemplatedoesnotexist}}
12005 !! html/php
12006 {{thistemplatedoesnotexist}}
12007 !! end
12008
12009 !! test
12010 pre-save transform: subst magic variables
12011 !! options
12012 pst
12013 !! wikitext
12014 {{subst:SITENAME}}
12015 !! html/php
12016 MediaWiki
12017 !! end
12018
12019 # This is bug 89, which I fixed. -- wtm
12020 !! test
12021 pre-save transform: subst: templates with parameters
12022 !! options
12023 pst
12024 !! wikitext
12025 {{subst:paramtest|param="something else"}}
12026 !! html/php
12027 This is a test template with parameter "something else"
12028 !! end
12029
12030 !! article
12031 Template:nowikitest
12032 !! text
12033 <nowiki>'''not wiki'''</nowiki>
12034 !! endarticle
12035
12036 !! test
12037 pre-save transform: nowiki in subst (bug 1188)
12038 !! options
12039 pst
12040 !! wikitext
12041 {{subst:nowikitest}}
12042 !! html/php
12043 <nowiki>'''not wiki'''</nowiki>
12044 !! end
12045
12046 !! article
12047 Template:commenttest
12048 !! text
12049 This template has <!-- a comment --> in it.
12050 !! endarticle
12051
12052 !! test
12053 pre-save transform: comment in subst (bug 1936)
12054 !! options
12055 pst
12056 !! wikitext
12057 {{subst:commenttest}}
12058 !! html/php
12059 This template has <!-- a comment --> in it.
12060 !! end
12061
12062 !! test
12063 pre-save transform: unclosed tag
12064 !! options
12065 pst noxml
12066 !! wikitext
12067 <nowiki>'''not wiki'''
12068 !! html/php
12069 <nowiki>'''not wiki'''
12070 !! end
12071
12072 !! test
12073 pre-save transform: mixed tag case
12074 !! options
12075 pst noxml
12076 !! wikitext
12077 <NOwiki>'''not wiki'''</noWIKI>
12078 !! html/php
12079 <NOwiki>'''not wiki'''</noWIKI>
12080 !! end
12081
12082 !! test
12083 pre-save transform: unclosed comment in <nowiki>
12084 !! options
12085 pst noxml
12086 !! wikitext
12087 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12088 !! html/php
12089 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12090 !!end
12091
12092 # Leading @ in this template definition works around a limitation
12093 # in parsoid's parserTests which otherwise strips the <span> from the
12094 # result (confusing it for a template wrapper)
12095 !! article
12096 Template:dangerous
12097 !!text
12098 @<span onmouseover="alert('crap')">Oh no</span>
12099 !!endarticle
12100
12101 !!test
12102 (confirming safety of fix for subst bug 1936)
12103 !! wikitext
12104 {{Template:dangerous}}
12105 !! html
12106 <p>@<span>Oh no</span>
12107 </p>
12108 !! end
12109
12110 !! test
12111 pre-save transform: comment containing gallery (bug 5024)
12112 !! options
12113 pst
12114 !! wikitext
12115 <!-- <gallery>data</gallery> -->
12116 !! html/php
12117 <!-- <gallery>data</gallery> -->
12118 !!end
12119
12120 !! test
12121 pre-save transform: comment containing extension
12122 !! options
12123 pst
12124 !! wikitext
12125 <!-- <tag>data</tag> -->
12126 !! html/php
12127 <!-- <tag>data</tag> -->
12128 !!end
12129
12130 !! test
12131 pre-save transform: comment containing nowiki
12132 !! options
12133 pst
12134 !! wikitext
12135 <!-- <nowiki>data</nowiki> -->
12136 !! html/php
12137 <!-- <nowiki>data</nowiki> -->
12138 !!end
12139
12140 !! test
12141 pre-save transform: <noinclude> in subst (bug 3298)
12142 !! options
12143 pst
12144 !! wikitext
12145 {{subst:Includes}}
12146 !! html/php
12147 Foobar
12148 !! end
12149
12150 !! test
12151 pre-save transform: <onlyinclude> in subst (bug 3298)
12152 !! options
12153 pst
12154 !! wikitext
12155 {{subst:Includes2}}
12156 !! html/php
12157 Foo
12158 !! end
12159
12160 !! article
12161 Template:SubstTest
12162 !!text
12163 {{<includeonly>subst:</includeonly>Includes}}
12164 !! endarticle
12165
12166 !! article
12167 Template:SafeSubstTest
12168 !! text
12169 {{<includeonly>safesubst:</includeonly>Includes}}
12170 !! endarticle
12171
12172 !! test
12173 bug 22297: safesubst: works during PST
12174 !! options
12175 pst
12176 !! wikitext
12177 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12178 !! html/php
12179 FoobarFoobar
12180 !! end
12181
12182 !! test
12183 bug 22297: safesubst: works during normal parse
12184 !! wikitext
12185 {{SafeSubstTest}}
12186 !! html
12187 <p>Foobar
12188 </p>
12189 !! end
12190
12191 !! test
12192 subst: does not work during normal parse
12193 !! wikitext
12194 {{SubstTest}}
12195 !! html
12196 <p>{{subst:Includes}}
12197 </p>
12198 !! end
12199
12200 !! test
12201 pre-save transform: context links ("pipe trick")
12202 !! options
12203 pst
12204 !! wikitext
12205 [[Article (context)|]]
12206 [[Bar:Article|]]
12207 [[:Bar:Article|]]
12208 [[Bar:Article (context)|]]
12209 [[:Bar:Article (context)|]]
12210 [[|Article]]
12211 [[|Article (context)]]
12212 [[Bar:X (Y) Z|]]
12213 [[:Bar:X (Y) Z|]]
12214 !! html/php
12215 [[Article (context)|Article]]
12216 [[Bar:Article|Article]]
12217 [[:Bar:Article|Article]]
12218 [[Bar:Article (context)|Article]]
12219 [[:Bar:Article (context)|Article]]
12220 [[Article]]
12221 [[Article (context)]]
12222 [[Bar:X (Y) Z|X (Y) Z]]
12223 [[:Bar:X (Y) Z|X (Y) Z]]
12224 !! end
12225
12226 !! test
12227 pre-save transform: context links ("pipe trick") with interwiki prefix
12228 !! options
12229 pst
12230 !! wikitext
12231 [[interwiki:Article|]]
12232 [[:interwiki:Article|]]
12233 [[interwiki:Bar:Article|]]
12234 [[:interwiki:Bar:Article|]]
12235 !! html/php
12236 [[interwiki:Article|Article]]
12237 [[:interwiki:Article|Article]]
12238 [[interwiki:Bar:Article|Bar:Article]]
12239 [[:interwiki:Bar:Article|Bar:Article]]
12240 !! end
12241
12242 !! test
12243 pre-save transform: context links ("pipe trick") with parens in title
12244 !! options
12245 pst title=[[Somearticle (context)]]
12246 !! wikitext
12247 [[|Article]]
12248 !! html/php
12249 [[Article (context)|Article]]
12250 !! end
12251
12252 !! test
12253 pre-save transform: context links ("pipe trick") with comma in title
12254 !! options
12255 pst title=[[Someplace, Somewhere]]
12256 !! wikitext
12257 [[|Otherplace]]
12258 [[Otherplace, Elsewhere|]]
12259 [[Otherplace, Elsewhere, Anywhere|]]
12260 !! html/php
12261 [[Otherplace, Somewhere|Otherplace]]
12262 [[Otherplace, Elsewhere|Otherplace]]
12263 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12264 !! end
12265
12266 !! test
12267 pre-save transform: context links ("pipe trick") with parens and comma
12268 !! options
12269 pst title=[[Someplace (IGNORED), Somewhere]]
12270 !! wikitext
12271 [[|Otherplace]]
12272 [[Otherplace (place), Elsewhere|]]
12273 !! html/php
12274 [[Otherplace, Somewhere|Otherplace]]
12275 [[Otherplace (place), Elsewhere|Otherplace]]
12276 !! end
12277
12278 !! test
12279 pre-save transform: context links ("pipe trick") with comma and parens
12280 !! options
12281 pst title=[[Who, me? (context)]]
12282 !! wikitext
12283 [[|Yes, you.]]
12284 [[Me, Myself, and I (1937 song)|]]
12285 !! html/php
12286 [[Yes, you. (context)|Yes, you.]]
12287 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12288 !! end
12289
12290 !! test
12291 pre-save transform: context links ("pipe trick") with namespace
12292 !! options
12293 pst title=[[Ns:Somearticle]]
12294 !! wikitext
12295 [[|Article]]
12296 !! html/php
12297 [[Ns:Article|Article]]
12298 !! end
12299
12300 !! test
12301 pre-save transform: context links ("pipe trick") with namespace and parens
12302 !! options
12303 pst title=[[Ns:Somearticle (context)]]
12304 !! wikitext
12305 [[|Article]]
12306 !! html/php
12307 [[Ns:Article (context)|Article]]
12308 !! end
12309
12310 !! test
12311 pre-save transform: context links ("pipe trick") with namespace and comma
12312 !! options
12313 pst title=[[Ns:Somearticle, Context, Whatever]]
12314 !! wikitext
12315 [[|Article]]
12316 !! html/php
12317 [[Ns:Article, Context, Whatever|Article]]
12318 !! end
12319
12320 !! test
12321 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12322 !! options
12323 pst title=[[Ns:Somearticle, Context (context)]]
12324 !! wikitext
12325 [[|Article]]
12326 !! html/php
12327 [[Ns:Article (context)|Article]]
12328 !! end
12329
12330 !! test
12331 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12332 !! options
12333 pst title=[[Ns:Somearticle (IGNORED), Context]]
12334 !! wikitext
12335 [[|Article]]
12336 !! html/php
12337 [[Ns:Article, Context|Article]]
12338 !! end
12339
12340 !! test
12341 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12342 !! options
12343 pst
12344 !! wikitext
12345 [[Article(context)|]]
12346 [[Bar:Article(context)|]]
12347 [[:Bar:Article(context)|]]
12348 [[|Article(context)]]
12349 [[Bar:X(Y)Z|]]
12350 [[:Bar:X(Y)Z|]]
12351 !! html/php
12352 [[Article(context)|Article]]
12353 [[Bar:Article(context)|Article]]
12354 [[:Bar:Article(context)|Article]]
12355 [[Article(context)]]
12356 [[Bar:X(Y)Z|X(Y)Z]]
12357 [[:Bar:X(Y)Z|X(Y)Z]]
12358 !! end
12359
12360 !! test
12361 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12362 !! options
12363 pst
12364 !! wikitext
12365 [[Article (context)|]]
12366 [[Bar:Article (context)|]]
12367 [[:Bar:Article (context)|]]
12368 [[|Article (context)]]
12369 [[Bar:X (Y) Z|]]
12370 [[:Bar:X (Y) Z|]]
12371 !! html/php
12372 [[Article (context)|Article]]
12373 [[Bar:Article (context)|Article]]
12374 [[:Bar:Article (context)|Article]]
12375 [[Article (context)]]
12376 [[Bar:X (Y) Z|X (Y) Z]]
12377 [[:Bar:X (Y) Z|X (Y) Z]]
12378 !! end
12379
12380 !! test
12381 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12382 !! options
12383 pst
12384 !! wikitext
12385 [[Article(context)|]]
12386 [[Bar:Article(context)|]]
12387 [[:Bar:Article(context)|]]
12388 [[|Article(context)]]
12389 [[Bar:X(Y)Z|]]
12390 [[:Bar:X(Y)Z|]]
12391 !! html/php
12392 [[Article(context)|Article]]
12393 [[Bar:Article(context)|Article]]
12394 [[:Bar:Article(context)|Article]]
12395 [[Article(context)]]
12396 [[Bar:X(Y)Z|X(Y)Z]]
12397 [[:Bar:X(Y)Z|X(Y)Z]]
12398 !! end
12399
12400 !! test
12401 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12402 !! options
12403 pst
12404 !! wikitext
12405 [[Article (context), context|]]
12406 [[Article (context),context|]]
12407 [[Bar:Article (context), context|]]
12408 [[Bar:Article (context),context|]]
12409 [[:Bar:Article (context), context|]]
12410 [[:Bar:Article (context),context|]]
12411 !! html/php
12412 [[Article (context), context|Article]]
12413 [[Article (context),context|Article]]
12414 [[Bar:Article (context), context|Article]]
12415 [[Bar:Article (context),context|Article]]
12416 [[:Bar:Article (context), context|Article]]
12417 [[:Bar:Article (context),context|Article]]
12418 !! end
12419
12420 !! test
12421 pre-save transform: trim trailing empty lines
12422 !! options
12423 pst
12424 !! wikitext
12425 Empty lines are trimmed
12426
12427
12428
12429
12430 !! html/php
12431 Empty lines are trimmed
12432 !! end
12433
12434 !! test
12435 pre-save transform: Signature expansion
12436 !! options
12437 pst
12438 !! wikitext
12439 * ~~~
12440 * <noinclude>~~~</noinclude>
12441 * <includeonly>~~~</includeonly>
12442 * <onlyinclude>~~~</onlyinclude>
12443 !! html/php
12444 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12445 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12446 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12447 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12448 !! end
12449
12450
12451 !! test
12452 pre-save transform: Signature expansion in nowiki tags (bug 93)
12453 !! options
12454 pst disabled
12455 !! wikitext
12456 Shall not expand:
12457
12458 <nowiki>~~~~</nowiki>
12459
12460 <includeonly><nowiki>~~~~</nowiki></includeonly>
12461
12462 <noinclude><nowiki>~~~~</nowiki></noinclude>
12463
12464 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12465
12466 {{subst:Foo}} shall be converted to FOO
12467
12468 As well as inside noinclude/onlyinclude
12469 <noinclude>{{subst:Foo}}</noinclude>
12470 <onlyinclude>{{subst:Foo}}</onlyinclude>
12471
12472 But not inside includeonly
12473 <includeonly>{{subst:Foo}}</includeonly>
12474 !! html/php
12475 Shall not expand:
12476
12477 <nowiki>~~~~</nowiki>
12478
12479 <includeonly><nowiki>~~~~</nowiki></includeonly>
12480
12481 <noinclude><nowiki>~~~~</nowiki></noinclude>
12482
12483 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12484
12485 FOO shall be converted to FOO
12486
12487 As well as inside noinclude/onlyinclude
12488 <noinclude>FOO</noinclude>
12489 <onlyinclude>FOO</onlyinclude>
12490
12491 But not inside includeonly
12492 <includeonly>{{subst:Foo}}</includeonly>
12493 !! end
12494
12495 !! test
12496 Parsoid: Recognize nowiki with trailing space in tags
12497 !! options
12498 parsoid=wt2html
12499 !! wikitext
12500 <nowiki ><div>[[foo]]</nowiki >
12501
12502 a<nowiki / >b
12503
12504 c<nowiki />d
12505
12506 e<nowiki/ >f
12507 !! html
12508 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12509 <p>ab</p>
12510 <p>cd</p>
12511 <p>ef</p>
12512 !! end
12513
12514 !! test
12515 Parsoid: Recognize nowiki with odd capitalization
12516 !! options
12517 parsoid=wt2html
12518 !! wikitext
12519 <noWikI ><div>[[foo]]</Nowiki >
12520 !! html
12521 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12522 !! end
12523
12524
12525 !! test
12526 Parsoid: Escape nowiki with trailing space in tags
12527 !! options
12528 parsoid=html2wt
12529 !! html/parsoid
12530 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12531 <p>a&lt;nowiki /&gt;b</p>
12532 <p>c&lt;nowiki/ &gt;d</p>
12533 !! wikitext
12534 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12535
12536 a&lt;nowiki /&gt;b
12537
12538 c&lt;nowiki/ &gt;d
12539 !! end
12540
12541 !! test
12542 Parsoid: Escape weird noWikI capitalizations
12543 !! options
12544 parsoid=html2wt
12545 !! html/parsoid
12546 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
12547 !! wikitext
12548 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
12549 !! end
12550
12551 ###
12552 ### Message transform tests
12553 ###
12554 !! test
12555 message transform: magic variables
12556 !! options
12557 msg
12558 !! wikitext
12559 {{SITENAME}}
12560 !! html
12561 MediaWiki
12562 !! end
12563
12564 !! test
12565 message transform: should not transform wiki markup
12566 !! options
12567 msg
12568 !! wikitext
12569 ''test''
12570 !! html
12571 ''test''
12572 !! end
12573
12574 !! test
12575 message transform: <noinclude> in transcluded template (bug 4926)
12576 !! options
12577 msg
12578 !! wikitext
12579 {{Includes}}
12580 !! html
12581 Foobar
12582 !! end
12583
12584 !! test
12585 message transform: <onlyinclude> in transcluded template (bug 4926)
12586 !! options
12587 msg
12588 !! wikitext
12589 {{Includes2}}
12590 !! html
12591 Foo
12592 !! end
12593
12594 !! test
12595 {{#special:}} page name, known
12596 !! options
12597 msg
12598 !! wikitext
12599 {{#special:Recentchanges}}
12600 !! html
12601 Special:RecentChanges
12602 !! end
12603
12604 !! test
12605 {{#special:}} page name with subpage, known
12606 !! options
12607 msg
12608 !! wikitext
12609 {{#special:Recentchanges/param}}
12610 !! html
12611 Special:RecentChanges/param
12612 !! end
12613
12614 !! test
12615 {{#special:}} page name, unknown
12616 !! options
12617 msg
12618 !! wikitext
12619 {{#special:foobar nonexistent}}
12620 !! html
12621 Special:Foobar nonexistent
12622 !! end
12623
12624 !! test
12625 {{#speciale:}} page name, known
12626 !! options
12627 msg
12628 !! wikitext
12629 {{#speciale:Recentchanges}}
12630 !! html
12631 Special:RecentChanges
12632 !! end
12633
12634 !! test
12635 {{#speciale:}} page name with subpage, known
12636 !! options
12637 msg
12638 !! wikitext
12639 {{#speciale:Recentchanges/param}}
12640 !! html
12641 Special:RecentChanges/param
12642 !! end
12643
12644 !! test
12645 {{#speciale:}} page name, unknown
12646 !! options
12647 msg
12648 !! wikitext
12649 {{#speciale:foobar nonexistent}}
12650 !! html
12651 Special:Foobar_nonexistent
12652 !! end
12653
12654 ###
12655 ### Images
12656 ###
12657 ### For Parsoid-specific tests, see
12658 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12659
12660 !! test
12661 Simple image
12662 !! options
12663 parsoid=wt2html,wt2wt,html2html
12664 !! wikitext
12665 [[Image:foobar.jpg]]
12666 !! html/php
12667 <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>
12668 </p>
12669 !! html/parsoid
12670 <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>
12671 !! end
12672
12673 !! test
12674 Simple image (using File: namespace, now canonical)
12675 !! wikitext
12676 [[File:Foobar.jpg]]
12677 !! html/php
12678 <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>
12679 </p>
12680 !! html/parsoid
12681 <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>
12682 !! end
12683
12684 !! test
12685 Right-aligned image
12686 !! wikitext
12687 [[File:Foobar.jpg|right]]
12688 !! html/php
12689 <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>
12690
12691 !! html/parsoid
12692 <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>
12693 !! end
12694
12695 !! test
12696 Image with caption
12697 !! wikitext
12698 [[File:Foobar.jpg|right|Caption text]]
12699 !! html/php
12700 <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>
12701
12702 !! html/parsoid
12703 <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>
12704 !! end
12705
12706 !! test
12707 Image with caption, bug 53312 #1
12708 !! wikitext
12709 [[File:Foobar.jpg|right|Caption page stuff]]
12710 !! html/php
12711 <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>
12712
12713 !! html/parsoid
12714 <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>
12715 !! end
12716
12717 !! test
12718 Image with caption, bug 53312 #2
12719 !! wikitext
12720 [[File:Foobar.jpg|right|Caption page=]]
12721 !! html/php
12722 <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>
12723
12724 !! html/parsoid
12725 <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>
12726 !! end
12727
12728 !! test
12729 Image with caption, bug 53312 #3
12730 !! wikitext
12731 [[File:Foobar.jpg|right|Caption page=stuff]]
12732 !! html/php
12733 <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>
12734
12735 !! html/parsoid
12736 <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>
12737 !! end
12738
12739 !! test
12740 Allow empty links in image captions (Bug 60753)
12741 !! options
12742 thumbsize=220
12743 !! wikitext
12744 [[File:Foobar.jpg|thumb|Caption [[Link1]]
12745 [[]]
12746 [[Link2]]
12747 ]]
12748 !! html/php
12749 <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>
12750
12751 !! html/parsoid
12752 <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>
12753 [[]]
12754 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
12755 </figcaption></figure>
12756 !! end
12757
12758 !! test
12759 Titles in unlinked images (T23454)
12760 !! wikitext
12761 [[File:Foobar.jpg|link=|stuff]]
12762 !! html/php
12763 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
12764 </p>
12765 !! end
12766
12767 !! test
12768 Link with empty target
12769 !! wikitext
12770 [[]]
12771 !! html
12772 <p>[[]]
12773 </p>
12774 !! end
12775
12776 !! test
12777 Image with link trail
12778 !! wikitext
12779 Linktrails should not work for images: [[File:Foobar.jpg]]s
12780 !! html/php
12781 <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
12782 </p>
12783 !! html/parsoid
12784 <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>
12785 !! end
12786
12787 !! test
12788 Image with empty attribute
12789 !! options
12790 parsoid=wt2html,wt2wt,html2html
12791 !! wikitext
12792 [[File:Foobar.jpg|right||Caption text]]
12793 !! html/php
12794 <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>
12795
12796 !! html/parsoid
12797 <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>
12798 !! end
12799
12800 !! test
12801 1. Block image with individual attributes from templates
12802 !! wikitext
12803 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
12804 !! html/php
12805 <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>
12806
12807 !! html/parsoid
12808 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[24,38,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
12809 !! end
12810
12811 !! test
12812 2. Block Image with individual attributes from templates
12813 !! wikitext
12814 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
12815 !! html/php
12816 <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>
12817
12818 !! html/parsoid
12819 <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt3" data-mw='{"attribs":[["thumbnail",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[18,32,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;thumb&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">thumb&lt;/span>"}],["width",{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[33,47,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;137px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137"/></a><figcaption>This is a caption</figcaption></figure>
12820 !! end
12821
12822 !! test
12823 3. Inline image with individual attributes from templates
12824 !! wikitext
12825 [[File:Foobar.jpg|{{echo|50px}}]]
12826 !! html/php
12827 <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>
12828 </p>
12829 !! html/parsoid
12830 <p><span typeof="mw:Image mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"width","ak":"{{echo|50px}}"}]}' data-mw='{"attribs":[["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;dsr&amp;quot;:[18,31,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;50px&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">50px&lt;/span>"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></span></p>
12831 !! end
12832
12833 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
12834 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
12835 !! test
12836 Image with multiple attributes from the same template
12837 !! wikitext
12838 [[File:Foobar.jpg|{{image_attribs}}]]
12839 !! html/php
12840 <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>
12841
12842 !! html/parsoid
12843 <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>
12844 !! end
12845
12846 !! test
12847 Image with link tails
12848 !! options
12849 thumbsize=220
12850 !! wikitext
12851 123[[File:Foobar.jpg]]456
12852 123[[File:Foobar.jpg|right]]456
12853 123[[File:Foobar.jpg|thumb]]456
12854 !! html/php
12855 <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
12856 </p>
12857 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
12858 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
12859
12860 !! html/php+tidy
12861 <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>
12862 <p>123</p>
12863 <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>
12864 <p>456 123</p>
12865 <div class="thumb tright">
12866 <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>
12867 <div class="thumbcaption">
12868 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
12869 </div>
12870 </div>
12871 </div>
12872 <p>456</p>
12873 !! html/parsoid
12874 <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>
12875 <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>
12876 <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>
12877 !! end
12878
12879 !! test
12880 Image with multiple captions -- only last one is accepted
12881 !! wikitext
12882 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
12883 !! html/php
12884 <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>
12885
12886 !! html/parsoid
12887 <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>
12888 !! end
12889
12890 !! test
12891 Image with multiple widths -- use last
12892 !! wikitext
12893 [[File:Foobar.jpg|200px|300px|caption]]
12894 !! html/php
12895 <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>
12896 </p>
12897 !! html/parsoid
12898 <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>
12899 !! end
12900
12901 !! test
12902 Image with multiple alignments -- use first (bug 48664)
12903 !! options
12904 thumbsize=220
12905 !! wikitext
12906 [[File:Foobar.jpg|thumb|left|right|center|caption]]
12907
12908 [[File:Foobar.jpg|middle|text-top|caption]]
12909 !! html/php
12910 <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>
12911 <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>
12912 </p>
12913 !! html/parsoid
12914 <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>
12915 <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>
12916 !! end
12917
12918 !! test
12919 Image with width attribute at different positions
12920 !! wikitext
12921 [[File:Foobar.jpg|200px|right|Caption]]
12922 [[File:Foobar.jpg|right|200px|Caption]]
12923 [[File:Foobar.jpg|right|Caption|200px]]
12924 !! html/php
12925 <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>
12926 <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>
12927 <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>
12928
12929 !! html/parsoid
12930 <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>
12931 <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>
12932 <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>
12933 !! end
12934
12935 # a sad bit of backward-compatibility
12936 !! test
12937 Image with size specified with pxpx (bug 13500, 51628)
12938 !! options
12939 parsoid=wt2html,wt2wt,html2html
12940 !! wikitext
12941 [[File:Foobar.jpg|20pxpx]]
12942 [[File:Foobar.jpg|200x20pxpx]]
12943 !! html/php
12944 <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>
12945 <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>
12946 </p>
12947 !! html/parsoid
12948 <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>
12949 !! end
12950
12951 !! test
12952 Image with link parameter, wiki target
12953 !! wikitext
12954 [[File:Foobar.jpg|link=Main Page]]
12955 !! html/php
12956 <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>
12957 </p>
12958 !! html/parsoid
12959 <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>
12960 !! end
12961
12962 # parsoid bug 49293 (part 1)
12963 !! test
12964 Image with link parameter, URL target
12965 !! wikitext
12966 [[File:Foobar.jpg|link=http://example.com/]]
12967 !! html/php
12968 <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>
12969 </p>
12970 !! html/parsoid
12971 <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>
12972 !! end
12973
12974 # parsoid bug 49293 (part 2)
12975 !! test
12976 Image with link parameter, protocol-less URL target
12977 !! wikitext
12978 [[File:Foobar.jpg|link=//example.com/]]
12979 !! html/php
12980 <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>
12981 </p>
12982 !! html/parsoid
12983 <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>
12984 !! end
12985
12986 !! test
12987 Escaping non-block captions (T107435)
12988 !! options
12989 parsoid={
12990 "modes": ["wt2wt"],
12991 "changes": [
12992 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
12993 ]
12994 }
12995 !! wikitext
12996 [[Image:Foobar.jpg|caption]]
12997 !! wikitext/edited
12998 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
12999 !! end
13000
13001 # wgExternalLinkTarget not supported by Parsoid
13002 !! test
13003 Image with link parameter, wgExternalLinkTarget
13004 !! wikitext
13005 [[Image:foobar.jpg|link=http://example.com/]]
13006 !! config
13007 wgExternalLinkTarget='foobar'
13008 !! html/php
13009 <p><a href="http://example.com/" target="foobar" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13010 </p>
13011 !! end
13012
13013 !! test
13014 Image with link parameter, wgNoFollowLinks set to false
13015 !! wikitext
13016 [[Image:foobar.jpg|link=http://example.com/]]
13017 !! config
13018 wgNoFollowLinks=false
13019 !! html
13020 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13021 </p>
13022 !! end
13023
13024 !! test
13025 Image with link parameter, wgNoFollowDomainExceptions
13026 !! wikitext
13027 [[Image:foobar.jpg|link=http://example.com/]]
13028 !! config
13029 wgNoFollowDomainExceptions='example.com'
13030 !! html
13031 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13032 </p>
13033 !! end
13034
13035 # wgExternalLinkTarget not supported by Parsoid
13036 !! test
13037 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13038 !! wikitext
13039 [[Image:foobar.jpg|link=http://example.com/|Title]]
13040 !! config
13041 wgExternalLinkTarget='foobar'
13042 !! html/php
13043 <p><a href="http://example.com/" title="Title" target="foobar" rel="nofollow"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13044 </p>
13045 !! end
13046
13047 !! test
13048 Image with empty link parameter
13049 !! wikitext
13050 [[File:Foobar.jpg|link=]]
13051 !! html/php
13052 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13053 </p>
13054 !! html/parsoid
13055 <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>
13056 !! end
13057
13058 !! test
13059 Image with link parameter (wiki target) and unnamed parameter
13060 !! wikitext
13061 [[File:Foobar.jpg|link=Main_Page|Title]]
13062 !! html/php
13063 <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>
13064 </p>
13065 !! html/parsoid
13066 <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>
13067 !! end
13068
13069 !! test
13070 Image with link parameter (URL target) and unnamed parameter
13071 !! wikitext
13072 [[File:Foobar.jpg|link=http://example.com/|Title]]
13073 !! html/php
13074 <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>
13075 </p>
13076 !! html/parsoid
13077 <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>
13078 !! end
13079
13080 !! test
13081 Thumbnail image with link parameter
13082 !! options
13083 thumbsize=220
13084 parsoid=wt2html,wt2wt,html2html
13085 !! wikitext
13086 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13087 !! html/php
13088 <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>
13089
13090 !! html/parsoid
13091 <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>
13092 !! end
13093
13094 !! test
13095 Manually-specified thumbnail image
13096 !! options
13097 thumbsize=220
13098 !! wikitext
13099 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13100 !! html/php
13101 <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>
13102
13103 !! html/parsoid
13104 <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>
13105 !! end
13106
13107 !! test
13108 Manually-specified thumbnail image with explicit link to wiki page
13109 !! options
13110 thumbsize=220
13111 parsoid=wt2html,wt2wt,html2html
13112 !! wikitext
13113 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13114 !! html/php
13115 <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>
13116
13117 !! html/parsoid
13118 <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>
13119 !! end
13120
13121 !! test
13122 Manually-specified thumbnail image with explicit link to url
13123 !! options
13124 thumbsize=220
13125 parsoid=wt2html,wt2wt,html2html
13126 !! wikitext
13127 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13128 !! html/php
13129 <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>
13130
13131 !! html/parsoid
13132 <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>
13133 !! end
13134
13135 !! test
13136 Manually-specified thumbnail image with explicit no link
13137 !! options
13138 thumbsize=220
13139 parsoid=wt2html,wt2wt,html2html
13140 !! wikitext
13141 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13142 !! html/php
13143 <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>
13144
13145 !! html/parsoid
13146 <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>
13147 !! end
13148
13149 !! test
13150 Manually-specified thumbnail image with explicit link and alt text
13151 !! options
13152 thumbsize=220
13153 parsoid=wt2html,wt2wt,html2html
13154 !! wikitext
13155 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13156 !! html/php
13157 <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>
13158
13159 !! html/parsoid
13160 <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>
13161 !! end
13162
13163 !! test
13164 Image with frame and link
13165 !! options
13166 parsoid=wt2html,wt2wt,html2html
13167 !! wikitext
13168 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13169 !! html/php
13170 <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>
13171
13172 !! html/parsoid
13173 <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>
13174 !! end
13175
13176 !! test
13177 Image with frame and link and explicit alt
13178 !! options
13179 parsoid=wt2html,wt2wt,html2html
13180 !! wikitext
13181 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13182 !! html/php
13183 <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>
13184
13185 !! html/parsoid
13186 <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>
13187 !! end
13188
13189 !! test
13190 Image with wiki markup in implicit alt
13191 !! wikitext
13192 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13193
13194 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13195 !! html/php
13196 <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>
13197 </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>
13198 </p>
13199 !! html/parsoid
13200 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"testing &lt;b data-parsoid=\"{&amp;quot;dsr&amp;quot;:[27,37,3,3]}\">bold&lt;/b> in alt"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"Image:Foobar.jpg"}}'/></a></span></p>
13201 <p><span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img alt="testing bold in alt" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"alt":"testing bold in alt","resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"alt":"alt=testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt","resource":"Image:Foobar.jpg"}}'/></a></span></p>
13202 !! end
13203
13204 !! test
13205 Alt image option should handle most kinds of wikitext without barfing
13206 !! wikitext
13207 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13208 !! html/php
13209 <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>
13210
13211 !! html/parsoid
13212 <figure class="mw-default-size" typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"This is the image caption"},{"ck":"alt","ak":"alt=This is a [[link]] and a {{echo|&#39;&#39;bold template&#39;&#39;}}."}]}' data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["alt",{"html":"alt=This is a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;simple&amp;quot;,&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;./Link&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;link&amp;quot;},&amp;quot;dsr&amp;quot;:[65,73,2,2]}\">link&lt;/a> and a &lt;i about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[80,106,null,null],&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;&#39;&#39;bold template&#39;&#39;&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">bold template&lt;/i>."}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img alt="This is a link and a bold template." resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"alt":"This is a link and a bold template.","resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"alt":"alt=This is a [[link]] and a {{echo|&#39;&#39;bold template&#39;&#39;}}.","resource":"Image:Foobar.jpg"}}'/></a><figcaption>This is the image caption</figcaption></figure>
13213 !! end
13214
13215 ###################
13216 # Conflicting image format options.
13217 # First option specified should 'win'.
13218 # All three cases in each test should be identical.
13219
13220 !! test
13221 Image with 'frameless' first.
13222 !! options
13223 parsoid=wt2html,wt2wt,html2html
13224 !! wikitext
13225 [[File:Foobar.jpg|frameless|caption]]
13226
13227 [[File:Foobar.jpg|frameless|frame|caption]]
13228
13229 [[File:Foobar.jpg|frameless|thumb|caption]]
13230 !! html/php
13231 <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>
13232 </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>
13233 </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>
13234 </p>
13235 !! html/parsoid
13236 <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>
13237 <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>
13238 <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>
13239 !! end
13240
13241 !! test
13242 Image with 'frame' first.
13243 !! options
13244 parsoid=wt2html,wt2wt,html2html
13245 !! wikitext
13246 [[File:Foobar.jpg|frame|caption]]
13247 [[File:Foobar.jpg|frame|frameless|caption]]
13248 [[File:Foobar.jpg|frame|thumb|caption]]
13249 !! html/php
13250 <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>
13251 <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>
13252 <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>
13253
13254 !! html/parsoid
13255 <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>
13256 <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>
13257 <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>
13258 !! end
13259
13260 !! test
13261 Image with 'thumb' first.
13262 !! options
13263 parsoid=wt2html,wt2wt,html2html
13264 !! wikitext
13265 [[File:Foobar.jpg|thumb|caption]]
13266 [[File:Foobar.jpg|thumb|frameless|caption]]
13267 [[File:Foobar.jpg|thumb|frame|caption]]
13268 !! html/php
13269 <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>
13270 <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>
13271 <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>
13272
13273 !! html/parsoid
13274 <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>
13275 <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>
13276 <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>
13277 !! end
13278
13279 ###################
13280 # Image sizing.
13281 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13282 # and https://phabricator.wikimedia.org/T64258
13283 # Foobar has actual size of 1941x220
13284 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13285 # a scalable format.
13286 # 2. Framed images always ignore size options; always render at default size.
13287 # 3. "Unspecified format" and border are the only types which can be
13288 # enlarged.
13289
13290 !! test
13291 Image: "unspecified format" and border enlarge
13292 !! options
13293 parsoid=wt2html,wt2wt,html2html
13294 !! wikitext
13295 [[File:Foobar.jpg|2000px]]
13296
13297 [[File:Foobar.jpg|border|2000px]]
13298 !! html/php
13299 <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>
13300 </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>
13301 </p>
13302 !! html/parsoid
13303 <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>
13304 <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>
13305 !! end
13306
13307 !! test
13308 Image: "unspecified format" and border reduce
13309 !! options
13310 parsoid=wt2html,wt2wt,html2html
13311 !! wikitext
13312 [[File:Foobar.jpg|1000px]]
13313
13314 [[File:Foobar.jpg|border|1000px]]
13315 !! html/php
13316 <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>
13317 </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>
13318 </p>
13319 !! html/parsoid
13320 <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>
13321 <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>
13322 !! end
13323
13324 !! test
13325 Image: thumbs reduce
13326 !! options
13327 parsoid=wt2html,wt2wt,html2html
13328 !! wikitext
13329 [[File:Foobar.jpg|thumb|50px]]
13330 !! html/php
13331 <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>
13332
13333 !! html/parsoid
13334 <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>
13335 !! end
13336
13337 !! test
13338 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13339 !! options
13340 parsoid=wt2html,wt2wt,html2html
13341 !! wikitext
13342 [[File:Foobar.jpg|thumb|2000px]]
13343
13344 [[File:Foobar.svg|thumb|2000px]]
13345 !! html/php
13346 <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>
13347 <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>
13348
13349 !! html/parsoid
13350 <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>
13351 <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>
13352 !! end
13353
13354 !! test
13355 Image: frameless can reduce in size
13356 !! options
13357 parsoid=wt2html,wt2wt,html2html
13358 !! wikitext
13359 [[File:Foobar.jpg|frameless|50px]]
13360 !! html/php
13361 <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>
13362 </p>
13363 !! html/parsoid
13364 <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>
13365 !! end
13366
13367 !! test
13368 Image: bitmap frameless can't be enlarged past original size, but vector can
13369 !! options
13370 parsoid=wt2html,wt2wt,html2html
13371 !! wikitext
13372 [[File:Foobar.jpg|frameless|2000px]]
13373
13374 [[File:Foobar.svg|frameless|2000px]]
13375 !! html/php
13376 <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>
13377 </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>
13378 </p>
13379 !! html/parsoid
13380 <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>
13381 <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>
13382 !! end
13383
13384 !! test
13385 Image: framed images are always unscaled.
13386 !! options
13387 parsoid=wt2html,wt2wt,html2html
13388 !! wikitext
13389 [[File:Foobar.jpg|frame]]
13390
13391 [[File:Foobar.jpg|frame|50px]]
13392
13393 [[File:Foobar.jpg|frame|50x50px]]
13394
13395 [[File:Foobar.jpg|frame|2000px]]
13396 !! html/php
13397 <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>
13398 <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>
13399 <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>
13400 <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>
13401
13402 !! html/parsoid
13403 <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>
13404 <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>
13405 <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>
13406 <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>
13407 !! end
13408
13409 ###################
13410
13411 !! test
13412 Link to image page- image page normally doesn't exists, hence edit link
13413 Add test with existing image page
13414 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13415 !! wikitext
13416 [[:Image:test]]
13417 !! html
13418 <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>
13419 </p>
13420 !! end
13421
13422 !! test
13423 bug 18784 Link to non-existent image page with caption should use caption as link text
13424 !! wikitext
13425 [[:Image:test|caption]]
13426 !! html
13427 <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>
13428 </p>
13429 !! end
13430
13431 !! test
13432 Frameless image caption with a free URL
13433 !! wikitext
13434 [[File:Foobar.jpg|http://example.com]]
13435 !! html/php
13436 <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>
13437 </p>
13438 !! html/parsoid
13439 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&lt;a rel=\"mw:ExtLink\" href=\"http://example.com\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;url&amp;quot;,&amp;quot;dsr&amp;quot;:[18,36,0,0]}\">http://example.com&lt;/a>"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13440 !! end
13441
13442 !! test
13443 Thumbnail image caption with a free URL
13444 !! options
13445 thumbsize=220
13446 !! wikitext
13447 [[File:Foobar.jpg|thumb|http://example.com]]
13448 !! html/php
13449 <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>
13450
13451 !! html/parsoid
13452 <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>
13453 !! end
13454
13455 !! test
13456 Thumbnail image caption with a free URL and explicit alt
13457 !! options
13458 thumbsize=220
13459 parsoid=wt2html,wt2wt,html2html
13460 !! wikitext
13461 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13462 !! html/php
13463 <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>
13464
13465 !! html/parsoid
13466 <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>
13467 !! end
13468
13469 !! test
13470 SVG thumbnails with no language set
13471 !! options
13472 !! wikitext
13473 [[File:Foobar.svg|thumb|caption]]
13474 !! html/php
13475 <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>
13476
13477 !! html/parsoid
13478 <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>
13479 !! end
13480
13481 !! test
13482 SVG thumbnails with language de
13483 !! options
13484 parsoid=wt2html,wt2wt,html2html
13485 !! wikitext
13486 [[File:Foobar.svg|thumb|caption|lang=de]]
13487 !! html/php
13488 <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>
13489
13490 !! html/parsoid
13491 <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>
13492 !! end
13493
13494 !! test
13495 SVG thumbnails with invalid language code
13496 !! options
13497 parsoid=wt2html,wt2wt,html2html
13498 !! wikitext
13499 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
13500 !! html/php
13501 <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>
13502
13503 !! html/parsoid
13504 <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>
13505 !! end
13506
13507 !! test
13508 BUG 1887: A ISBN with a thumbnail
13509 !! wikitext
13510 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
13511 !! html/php
13512 <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>
13513
13514 !! html/parsoid
13515 <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>
13516 !! end
13517
13518 !! test
13519 BUG 1887: A RFC with a thumbnail
13520 !! wikitext
13521 [[File:Foobar.jpg|thumb|This is RFC 12354]]
13522 !! html/php
13523 <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>
13524
13525 !! html/parsoid
13526 <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>
13527 !! end
13528
13529 !! test
13530 BUG 1887: A mailto link with a thumbnail
13531 !! wikitext
13532 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
13533 !! html/php
13534 <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>
13535
13536 !! html/parsoid
13537 <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>
13538 !! end
13539
13540 # Pending resolution to bug 368
13541 !! test
13542 BUG 648: Frameless image caption with a link
13543 !! wikitext
13544 [[File:Foobar.jpg|text with a [[link]] in it]]
13545 !! html/php
13546 <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>
13547 </p>
13548 !! html/parsoid
13549 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;simple&amp;quot;,&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;./Link&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;link&amp;quot;},&amp;quot;dsr&amp;quot;:[30,38,2,2]}\">link&lt;/a> in it"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13550 !! end
13551
13552 !! test
13553 BUG 648: Frameless image caption with a link (suffix)
13554 !! wikitext
13555 [[File:Foobar.jpg|text with a [[link]]foo in it]]
13556 !! html/php
13557 <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>
13558 </p>
13559 !! html/parsoid
13560 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;simple&amp;quot;,&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;./Link&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;link&amp;quot;},&amp;quot;dsr&amp;quot;:[30,41,2,5],&amp;quot;tail&amp;quot;:&amp;quot;foo&amp;quot;}\">linkfoo&lt;/a> in it"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13561 !! end
13562
13563 !! test
13564 BUG 648: Frameless image caption with an interwiki link
13565 !! wikitext
13566 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
13567 !! html/php
13568 <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>
13569 </p>
13570 !! html/parsoid
13571 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a &lt;a rel=\"mw:ExtLink\" href=\"http://www.usemod.com/cgi-bin/mb.pl?Link\" title=\"meatball:Link\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;simple&amp;quot;,&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;http://www.usemod.com/cgi-bin/mb.pl?Link&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;MeatBall:Link&amp;quot;},&amp;quot;isIW&amp;quot;:true,&amp;quot;dsr&amp;quot;:[30,47,2,2]}\">MeatBall:Link&lt;/a> in it"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13572 !! end
13573
13574 !! test
13575 BUG 648: Frameless image caption with a piped interwiki link
13576 !! wikitext
13577 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
13578 !! html/php
13579 <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>
13580 </p>
13581 !! html/parsoid
13582 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"text with a &lt;a rel=\"mw:ExtLink\" href=\"http://www.usemod.com/cgi-bin/mb.pl?Link\" title=\"meatball:Link\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;piped&amp;quot;,&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;http://www.usemod.com/cgi-bin/mb.pl?Link&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;MeatBall:Link&amp;quot;},&amp;quot;isIW&amp;quot;:true,&amp;quot;dsr&amp;quot;:[30,52,16,2]}\">link&lt;/a> in it"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13583 !! end
13584
13585 !! test
13586 T107474: Frameless image caption with <nowiki>
13587 !! wikitext
13588 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
13589 !! html/parsoid
13590 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&lt;span typeof=\"mw:Nowiki\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[18,75,8,9]}\">text with a [[MeatBall:Link|link]] in it&lt;/span>"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13591 !! end
13592
13593 !! test
13594 Escape HTML special chars in image alt text
13595 !! wikitext
13596 [[File:Foobar.jpg|& < > "]]
13597 !! html/php
13598 <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>
13599 </p>
13600 !! html/parsoid
13601 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&amp;amp; &amp;lt; &amp;gt; \""}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13602 !! end
13603
13604 !! test
13605 BUG 499: Alt text should have &#1234;, not &amp;1234;
13606 !! wikitext
13607 [[File:Foobar.jpg|&#9792;]]
13608 !! html/php
13609 <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>
13610 </p>
13611 !! html/parsoid
13612 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=\"{&amp;quot;src&amp;quot;:&amp;quot;&amp;amp;#9792;&amp;quot;,&amp;quot;srcContent&amp;quot;:&amp;quot;♀&amp;quot;,&amp;quot;dsr&amp;quot;:[18,25,null,null]}\">♀&lt;/span>"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13613 !! end
13614
13615 !! test
13616 Broken image caption with link
13617 !! options
13618 parsoid=wt2html,wt2wt,html2html
13619 !! wikitext
13620 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
13621 !! html/php
13622 <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.
13623 </p>
13624 !! html/parsoid
13625 <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>
13626 !! end
13627
13628 !! test
13629 Image caption containing another image
13630 !! wikitext
13631 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
13632 !! html/php
13633 <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>
13634
13635 !! html/parsoid
13636 <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>
13637 !! end
13638
13639 !! test
13640 Image: caption containing a newline
13641 !! wikitext
13642 [[File:Foobar.jpg|This
13643 *is some text]]
13644 !! html/php
13645 <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>
13646 </p>
13647 !! html/parsoid
13648 <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>
13649 !!end
13650
13651 !!test
13652 Image: caption containing leading space
13653 (The leading space should not trigger nowiki escaping in wt2wt mode)
13654 !! wikitext
13655 [[File:Foobar.jpg|thumb| bar]]
13656 !! html/php
13657 <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>
13658
13659 !! html/parsoid
13660 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption> bar</figcaption></figure>
13661 !!end
13662
13663 !! test
13664 Image: caption containing a table
13665 !! options
13666 parsoid=wt2html,wt2wt,html2html
13667 !! wikitext
13668 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
13669 {|
13670 ! Foo !! Bar
13671 |-
13672 | Foo1 || Bar1
13673 |}
13674 and some more text.]]
13675 !! html/php
13676 <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>
13677
13678 !! html/parsoid
13679 <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
13680 <table>
13681 <tbody>
13682 <tr><th>Foo </th><th>Bar</th></tr>
13683 <tr>
13684 <td>Foo1 </td>
13685 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
13686 !! end
13687
13688 !! test
13689 Bug 3090: External links other than http: in image captions
13690 !! wikitext
13691 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
13692 !! html/php
13693 <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>
13694
13695 !! html/parsoid
13696 <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>
13697 !! end
13698
13699 !! test
13700 Custom class
13701 !! options
13702 parsoid=wt2html,wt2wt,html2html
13703 !! wikitext
13704 [[Image:foobar.jpg|a|class=b]]
13705 !! html/php
13706 <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>
13707 </p>
13708 !! html/parsoid
13709 <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>
13710 !! end
13711
13712 !! test
13713 Localized image handling (1).
13714 !! options
13715 parsoid=wt2html,wt2wt,html2html
13716 language=es
13717 !! wikitext
13718 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
13719 !! html/php
13720 <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>
13721
13722 !! html/parsoid
13723 <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>
13724 !! end
13725
13726 !! test
13727 Localized image handling (2).
13728 !! options
13729 thumbsize=220
13730 parsoid=wt2html,wt2wt,html2html
13731 language=es
13732 !! wikitext
13733 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
13734 !! html/php
13735 <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>
13736
13737 !! html/parsoid
13738 <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>
13739 !! end
13740
13741 !! test
13742 "border", "frameless" and "class" attributes on an image.
13743 !! options
13744 thumbsize=220
13745 parsoid=wt2html,wt2wt,html2html
13746 !! wikitext
13747 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
13748 !! html/php
13749 <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>
13750 </p>
13751 !! html/parsoid
13752 <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>
13753 !! end
13754
13755 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
13756 !! test
13757 Invalid image attributes (bug 62500)
13758 !! options
13759 thumbsize=220
13760 parsoid=wt2html,wt2wt,html2html
13761 !! wikitext
13762 [[File:Foobar.jpg|thumb|float|left|caption]]
13763
13764 [[File:Foobar.jpg|thumb|righ|caption]]
13765
13766 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
13767 !! html/php
13768 <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>
13769 <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>
13770 <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>
13771
13772 !! html/parsoid
13773 <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>
13774 <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>
13775 <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>
13776 !! end
13777
13778 !! article
13779 File:Barfoo.jpg
13780 !! text
13781 #REDIRECT [[File:Barfoo.jpg]]
13782 !! endarticle
13783
13784 # FIXME: Parsoid should run this test -- but we'd need to teach the
13785 # mockAPI about the redirected Barfoo.jpg image.
13786 !! test
13787 Redirected image
13788 !! wikitext
13789 [[Image:Barfoo.jpg]]
13790 !! html/php
13791 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
13792 </p>
13793 !! end
13794
13795 !! test
13796 Missing image with uploads disabled
13797 !! options
13798 wgEnableUploads=0
13799 !! wikitext
13800 [[File:Foobaz.jpg]]
13801 !! html/php
13802 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
13803 </p>
13804 !! html/parsoid
13805 <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>
13806 !! end
13807
13808 # Parsoid-specific testing for images
13809 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13810 # Currently imperfect due to a flaw in the Parsoid testrunner
13811 # Work in progress
13812 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
13813 # image tests.
13814
13815 !! test
13816 Parsoid-specific image handling - simple image with size and middle alignment
13817 !! wikitext
13818 [[File:Foobar.jpg|middle|50px]]
13819 !! html/parsoid
13820 <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>
13821 !! end
13822
13823 !! test
13824 Parsoid-specific image handling - simple image with size, middle alignment,
13825 non-standard namespace alias
13826 !! options
13827 parsoid=wt2wt,wt2html,html2html
13828 !! wikitext
13829 [[Image:Foobar.jpg|middle|50px]]
13830 !! html/parsoid
13831 <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>
13832 !! end
13833
13834 !! test
13835 Parsoid-specific image handling - simple image with size and middle alignment
13836 (existing content)
13837 !! wikitext
13838 [[File:Foobar.jpg|50px|middle]]
13839 !! html/parsoid
13840 <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>
13841 !! end
13842
13843 !! test
13844 Parsoid-specific image handling - simple image with size and middle alignment
13845 and non-standard namespace name
13846 !! options
13847 parsoid=wt2html,wt2wt,html2html
13848 !! wikitext
13849 [[Image:Foobar.jpg|50px|middle]]
13850 !! html/parsoid
13851 <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>
13852 !! end
13853
13854 !! test
13855 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
13856 !! wikitext
13857 [[File:Foobar.jpg|500x10px|baseline|caption]]
13858 !! html/parsoid
13859 <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>
13860 !! end
13861
13862 !! test
13863 Parsoid-specific image handling - simple image with border and size spec
13864 !! wikitext
13865 [[File:Foobar.jpg|50px|border|caption]]
13866 !! html/parsoid
13867 <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>
13868 !! end
13869
13870 !! test
13871 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13872 !! wikitext
13873 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
13874 !! html/parsoid
13875 <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>
13876 !! end
13877
13878 !! test
13879 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13880 (existing content)
13881 !! wikitext
13882 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
13883 !! html/parsoid
13884 <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>
13885 !! end
13886
13887 !! test
13888 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
13889 !! wikitext
13890 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
13891 !! html/parsoid
13892 <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>
13893 !! end
13894
13895 !! test
13896 Parsoid-specific image handling - thumbnail with specific size, halign,
13897 valign, and caption (existing content)
13898 !! wikitext
13899 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
13900 !! html/parsoid
13901 <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>
13902 !! end
13903
13904 !! test
13905 Parsoid-specific image handling - framed image with specific size and caption
13906 (size is ignored)
13907 !! options
13908 parsoid=wt2html,wt2wt,html2html
13909 !! wikitext
13910 [[File:Foobar.jpg|frame|500x50px|caption]]
13911 !! html/parsoid
13912 <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>
13913 !! end
13914
13915 !! test
13916 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
13917 (size is ignored)
13918 !! options
13919 parsoid=wt2html,wt2wt,html2html
13920 !! wikitext
13921 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
13922 !! html/parsoid
13923 <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>
13924 !! end
13925
13926 !! test
13927 Parsoid-specific image handling - frameless image with specific size, border, and caption
13928 !! wikitext
13929 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
13930 !! html/parsoid
13931 <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>
13932 !! end
13933
13934 !! test
13935 Parsoid-specific image handling - simple image with a formatted caption
13936 !! wikitext
13937 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
13938 !! html/parsoid
13939 <p><span class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"&lt;table data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[18,81,7,8]}\">&lt;tbody data-parsoid=\"{&amp;quot;dsr&amp;quot;:[25,73,0,0]}\">&lt;tr data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[25,54,4,5]}\">&lt;td data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[29,39,4,5]}\">a&lt;/td>&lt;td data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[39,49,4,5]}\">b&lt;/td>&lt;/tr>&lt;tr data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[54,73,4,5]}\">&lt;td data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;dsr&amp;quot;:[58,68,4,5]}\">c&lt;/td>&lt;/tr>&lt;/tbody>&lt;/table>"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
13940 !! end
13941
13942 !! test
13943 Parsoid-specific image handling - caption with a template in it
13944 !! wikitext
13945 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
13946 !! html/parsoid
13947 <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>
13948 !! end
13949
13950 !! test
13951 Parsoid-specific image handling - caption with unbalanced tags in it
13952 !! options
13953 parsoid=wt2html,wt2wt,html2html
13954 !! wikitext
13955 foo
13956 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
13957 bar
13958 !! html/parsoid
13959 <p>foo</p>
13960 <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>
13961 <p>bar</p>
13962 !! end
13963
13964 !! test
13965 Parsoid-specific image handling - empty caption (1)
13966 !! options
13967 parsoid=wt2html,wt2wt
13968 !! wikitext
13969 [[File:Foobar.jpg|thumb|]]
13970 !! html/parsoid
13971 <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>
13972 !! end
13973
13974 # empty captions don't get serialized unless we're in the "round trip" case
13975 !! test
13976 Parsoid-specific image handling - empty caption (2)
13977 !! options
13978 parsoid=html2wt
13979 !! html/parsoid
13980 <figure class="mw-default-size" typeof="mw:Image/Thumb">
13981 <a href="./File:Foobar.jpg">
13982 <img resource="./File:Foobar.jpg"
13983 src="//example.com/images/3/3a/Foobar.jpg"
13984 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
13985 height="25" width="220"/>
13986 </a>
13987 <figcaption></figcaption>
13988 </figure>
13989 !! wikitext
13990 [[File:Foobar.jpg|thumb]]
13991 !! end
13992
13993 !! test
13994 Parsoid-specific image handling - whitespace caption
13995 !! wikitext
13996 [[File:Foobar.jpg|thumb| ]]
13997 !! html/parsoid
13998 <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>
13999 !! end
14000
14001 !! test
14002 Parsoid-specific image handling - lang option
14003 !! wikitext
14004 foo
14005 [[File:Foobar.svg|lang=de|caption]]
14006 bar
14007 !! html/parsoid
14008 <p>foo
14009 <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>
14010 bar</p>
14011 !! end
14012
14013 ## Edge case bugs in Parsoid from T93580
14014 !! test
14015 T93580: 1. Templated <ref> inside block images
14016 !! wikitext
14017 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14018
14019 <references />
14020 !! html/parsoid
14021 <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>
14022
14023 <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>
14024 !! end
14025
14026 !! test
14027 T93580: 2. <ref> inside inline images
14028 !! wikitext
14029 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14030
14031 <references />
14032 !! html/parsoid
14033 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: &lt;ref>foo&lt;/ref>"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;span about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[64,78,5,6]}\" data-mw=\"{&amp;quot;name&amp;quot;:&amp;quot;ref&amp;quot;,&amp;quot;body&amp;quot;:{&amp;quot;id&amp;quot;:&amp;quot;mw-reference-text-cite_note-1&amp;quot;},&amp;quot;attrs&amp;quot;:{}}\">&lt;a href=\"#cite_note-1\" style=\"counter-reset: mw-Ref 1;\">&lt;span class=\"mw-reflink-text\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=\"{&amp;quot;group&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;content&amp;quot;:&amp;quot;foo&amp;quot;,&amp;quot;hasRefInRef&amp;quot;:false,&amp;quot;dsr&amp;quot;:[64,78,5,6],&amp;quot;tmp&amp;quot;:{}}\" data-mw=\"{}\">"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14034
14035 <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>
14036 !! end
14037
14038 !! test
14039 T93580: 3. Templated <ref> inside inline images
14040 !! wikitext
14041 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14042
14043 <references />
14044 !! html/parsoid
14045 <p><span class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: {{echo|&lt;ref>{{echo|foo}}&lt;/ref>}}"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;span about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Transclusion mw:Extension/ref\" data-parsoid=\"{&amp;quot;dsr&amp;quot;:[64,96,null,null],&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;&lt;ref>{{echo|foo}}&lt;/ref>&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">&lt;a href=\"#cite_note-1\" style=\"counter-reset: mw-Ref 1;\">&lt;span class=\"mw-reflink-text\">[1]&lt;/span>&lt;/a>&lt;/span>&lt;meta typeof=\"mw:Transclusion mw:Extension/ref/Marker\" about=\"#mwt2\" data-parsoid=\"{&amp;quot;group&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;name&amp;quot;:&amp;quot;&amp;quot;,&amp;quot;content&amp;quot;:&amp;quot;foo&amp;quot;,&amp;quot;hasRefInRef&amp;quot;:false,&amp;quot;dsr&amp;quot;:[64,96,null,null],&amp;quot;pi&amp;quot;:[[{&amp;quot;k&amp;quot;:&amp;quot;1&amp;quot;,&amp;quot;spc&amp;quot;:[&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;,&amp;quot;&amp;quot;]}]],&amp;quot;tmp&amp;quot;:{}}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;echo&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Echo&amp;quot;},&amp;quot;params&amp;quot;:{&amp;quot;1&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;&lt;ref>{{echo|foo}}&lt;/ref>&amp;quot;}},&amp;quot;i&amp;quot;:0}}]}\">"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></span></p>
14046
14047 <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>
14048 !! end
14049
14050 ###
14051 ### Subpages
14052 ###
14053 !! article
14054 Subpage test/subpage
14055 !! text
14056 foo
14057 !! endarticle
14058
14059 !! test
14060 Subpage link
14061 !! options
14062 subpage title=[[Subpage test]]
14063 !! wikitext
14064 [[/subpage]]
14065 !! html
14066 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14067 </p>
14068 !! end
14069
14070 !! test
14071 Subpage noslash link
14072 !! options
14073 subpage title=[[Subpage test]]
14074 !! wikitext
14075 [[/subpage/]]
14076 !! html
14077 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14078 </p>
14079 !! end
14080
14081 !! article
14082 Subpage test/1/2/subpage
14083 !! text
14084 blah
14085 !! endarticle
14086
14087 !! test
14088 Relative subpage noslash link
14089 !! options
14090 parsoid=wt2wt,wt2html,html2html
14091 subpage title=[[Subpage test/1/2/3/4]]
14092 !! wikitext
14093 [[../../subpage/]]
14094
14095 [[../../subpage]]
14096 !! html/php
14097 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14098 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14099 </p>
14100 !! html/parsoid
14101 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14102 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14103 !! end
14104
14105 !! test
14106 Parsoid: dot-slash prefixed wikilinks
14107 !! wikitext
14108 [[./foo]]
14109
14110 [[././bar]]
14111
14112 [[././baz/]]
14113 !! html/php
14114 <p>[[./foo]]
14115 </p><p>[[././bar]]
14116 </p><p>[[././baz/]]
14117 </p>
14118 !! html/parsoid
14119 <p>[[./foo]]
14120 </p><p>[[././bar]]
14121 </p><p>[[././baz/]]
14122 </p>
14123 !! end
14124
14125 !! test
14126 Render invalid page names as plain text (bug 51090)
14127 !! wikitext
14128 [[./../foo|bar]]
14129 [[foo�|bar]]
14130 [[foo/.|bar]]
14131 [[foo/..|bar]]
14132 [[foo~~~bar]]
14133 [[foo>bar]]
14134 [[foo[bar]]
14135 [[.]]
14136 [[..]]
14137 [[foo././bar]]
14138
14139 [[{{echo|./../foo}}|bar]]
14140 [[{{echo|foo/.}}|bar]]
14141 [[{{echo|foo/..}}|bar]]
14142 [[{{echo|foo~~~~bar}}]]
14143 [[{{echo|foo>bar}}]]
14144 [[{{echo|foo././bar}}]]
14145 [[{{echo|foo{bar}}]]
14146 [[{{echo|foo}bar}}]]
14147 [[{{echo|foo[bar}}]]
14148 [[{{echo|foo]bar}}]]
14149 [[{{echo|foo<bar}}]]
14150 !!html/php
14151 <p>[[./../foo|bar]]
14152 [[foo�|bar]]
14153 [[foo/.|bar]]
14154 [[foo/..|bar]]
14155 [[foo~~~bar]]
14156 [[foo&gt;bar]]
14157 [[foo[bar]]
14158 [[.]]
14159 [[..]]
14160 [[foo././bar]]
14161 </p><p>[[./../foo|bar]]
14162 [[foo/.|bar]]
14163 [[foo/..|bar]]
14164 [[foo~~~~bar]]
14165 [[foo&gt;bar]]
14166 [[foo././bar]]
14167 [[foo{bar]]
14168 [[foo}bar]]
14169 [[foo[bar]]
14170 [[foo]bar]]
14171 [[foo&lt;bar]]
14172 </p>
14173 !!html/parsoid
14174 <p>[[./../foo|bar]]
14175 [[foo�|bar]]
14176 [[foo/.|bar]]
14177 [[foo/..|bar]]
14178 [[foo~~~bar]]
14179 [[foo>bar]]
14180 [[foo[bar]]
14181 [[.]]
14182 [[..]]
14183 [[foo././bar]]</p>
14184
14185 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14186 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14187 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14188 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14189 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14190 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14191 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14192 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14193 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
14194 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
14195 [[<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>
14196 !!end
14197
14198 !! test
14199 Disabled subpages
14200 !! wikitext
14201 [[/subpage]]
14202 !! html
14203 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14204 </p>
14205 !! end
14206
14207 !! test
14208 BUG 561: {{/Subpage}}
14209 !! options
14210 subpage title=[[Page]]
14211 !! wikitext
14212 {{/Subpage}}
14213 !! html
14214 <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>
14215 </p>
14216 !! end
14217
14218 ###
14219 ### Categories
14220 ###
14221 !! article
14222 Category:MediaWiki User's Guide
14223 !! text
14224 blah
14225 !! endarticle
14226
14227 !! test
14228 Link to category
14229 !! wikitext
14230 [[:Category:MediaWiki User's Guide]]
14231 !! html
14232 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14233 </p>
14234 !! end
14235
14236 !! test
14237 Simple category
14238 !! options
14239 cat
14240 !! wikitext
14241 [[Category:MediaWiki User's Guide]]
14242 !! html
14243 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14244 !! end
14245
14246 !! test
14247 PAGESINCATEGORY invalid title fatal (r33546 fix)
14248 !! wikitext
14249 {{PAGESINCATEGORY:<bogus>}}
14250 !! html
14251 <p>0
14252 </p>
14253 !! end
14254
14255 !! test
14256 Category with different sort key
14257 !! options
14258 cat
14259 !! wikitext
14260 [[Category:MediaWiki User's Guide|Foo]]
14261 !! html
14262 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14263 !! end
14264
14265 !! test
14266 Category with identical sort key
14267 !! options
14268 cat
14269 !! wikitext
14270 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14271 !! html
14272 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14273 !! end
14274
14275 !! test
14276 Category with empty sort key
14277 !! options
14278 cat
14279 pst
14280 !! wikitext
14281 [[Category:MediaWiki User's Guide|]]
14282 !! html/php
14283 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14284 !! end
14285
14286 !! test
14287 Category with empty sort key and parentheses
14288 !! options
14289 cat
14290 pst
14291 !! wikitext
14292 [[Category:Foo (bar)|]]
14293 !! html/php
14294 [[Category:Foo (bar)|Foo]]
14295 !! end
14296
14297 ## We used to, but no longer wt2wt this test since the default serializer
14298 ## will normalize all categories to serialize on their own line.
14299 ## This wikitext usage is going to be fairly uncommon in production and
14300 ## selser will take care of preserving formatting in those scenarios.
14301 !! test
14302 Category with link tail
14303 !! options
14304 cat
14305 pst
14306 parsoid=wt2html
14307 !! wikitext
14308 123[[Category:Foo]]456
14309 !! html/php
14310 123[[Category:Foo]]456
14311 !! html/parsoid
14312 <p>123<link rel="mw:PageProp/Category" href="Category:Foo"/>456</p>
14313 !! end
14314
14315 !! test
14316 Category with template
14317 !! options
14318 cat
14319 pst
14320 !! wikitext
14321 [[Category:{{echo|Foo}}]]
14322 !! html/php
14323 [[Category:{{echo|Foo}}]]
14324 !! end
14325
14326 !! test
14327 Category with template in sort key
14328 !! options
14329 cat
14330 pst
14331 !! wikitext
14332 [[Category:Foo|{{echo|Bar}}]]
14333 !! html/php
14334 [[Category:Foo|{{echo|Bar}}]]
14335 !! end
14336
14337 !! test
14338 Category with template in sort key and title
14339 !! options
14340 cat
14341 pst
14342 !! wikitext
14343 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14344 !! html/php
14345 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14346 !! end
14347
14348 ## We used to, but no longer wt2wt this test since the default serializer
14349 ## will normalize all categories to serialize on their own line.
14350 ## This wikitext usage is going to be fairly uncommon in production and
14351 ## selser will take care of preserving formatting in those scenarios.
14352 !! test
14353 Category / paragraph interactions
14354 !! options
14355 parsoid=wt2html
14356 !! wikitext
14357 Foo [[Category:Baz]] Bar
14358
14359 Foo [[Category:Baz]]
14360 Bar
14361
14362 Foo
14363 [[Category:Baz]]
14364 Bar
14365
14366 Foo
14367 [[Category:Baz]] Bar
14368
14369 Foo
14370 [[Category:Baz]]
14371 [[Category:Baz]]
14372 [[Category:Baz]]
14373 Bar
14374
14375 [[Category:Baz]]
14376 [[Category:Baz]]
14377 [[Category:Baz]]
14378
14379 [[Category:Baz]]
14380 {{echo|[[Category:Baz]]}}
14381 [[Category:Baz]]
14382 !! html/php
14383 <p>Foo Bar
14384 </p><p>Foo
14385 Bar
14386 </p><p>Foo
14387 Bar
14388 </p><p>Foo Bar
14389 </p><p>Foo
14390 Bar
14391 </p>
14392 !! html/parsoid
14393 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14394 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14395 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14396 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14397 <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>
14398 <link rel="mw:PageProp/Category" href="Category:Baz"/>
14399 !! end
14400
14401 ## We used to, but no longer wt2wt this test since the default serializer
14402 ## will normalize all categories to serialize on their own line.
14403 ## This wikitext usage is going to be fairly uncommon in production and
14404 ## selser will take care of preserving formatting in those scenarios.
14405 ##
14406 ## The whitespace on the empty line is part of the test. Please do not delete
14407 !! test
14408 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14409 !! options
14410 parsoid=wt2html
14411 !! wikitext
14412 This
14413
14414 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14415
14416 {{echo|[[Category:Foo]] and so should this!}}
14417 !! html/php
14418 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14419 </p>
14420 !! html/parsoid
14421 <p>This
14422
14423 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14424
14425 <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>
14426 !! end
14427
14428 ## Parsoid will not try to wt2wt this while preserving newlines because
14429 ## it suppresses excess newlines within list items -- and we don't want to
14430 ## introduce a special case just for categories, which is, in reality somewhat
14431 ## odd behavior -- categories are unlikely to be used in list items like this
14432 ## in top-level pages and are only likely to show up in template-generated
14433 ## list items where this RT-ing is a non-issue.
14434 ##
14435 ## The whitespace on the empty line is part of the test. Please do not delete
14436 !! test
14437 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14438 !! options
14439 parsoid=wt2html
14440 !! wikitext
14441 * This
14442
14443 [[Category:Foo]] and this should be part of the same list item
14444 * So should this
14445
14446 {{echo|[[Category:Foo]] and this should be part of the same list item}}
14447 !! html
14448 <ul><li>This and this should be part of the same list item</li>
14449 <li>So should this and this should be part of the same list item</li></ul>
14450 !! html/parsoid
14451 <ul>
14452 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
14453 <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>
14454 </ul>
14455 !! end
14456
14457 ## Newlines and categories that follow the last item of a list
14458 ## are treated differently because this (list followed by categories)
14459 ## is an extremely common pattern on wikis.
14460 !! test
14461 3. Categories and newlines: newline suppression for last list item should RT properly
14462 !! wikitext
14463 * a
14464 * b
14465
14466 [[Category:Foo]]
14467
14468 [[Category:Bar]]
14469 [[Category:Baz]]
14470 !! html/parsoid
14471 <ul><li> a</li>
14472 <li> b</li></ul>
14473
14474 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14475
14476 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14477 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14478 !! end
14479
14480 !! test
14481 4. Categories and newlines: newline suppression for last list item should RT properly
14482 !! wikitext
14483 * a
14484 **** b
14485
14486 [[Category:Foo]]
14487 !! html/parsoid
14488 <ul><li> a
14489 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
14490
14491 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14492 !! end
14493
14494 ## only wt2html for this to make sure the algo only applies to the rightmost path
14495 !! test
14496 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
14497 !! options
14498 parsoid=wt2html
14499 !! wikitext
14500 * a
14501 ** b
14502 [[Category:Foo]]
14503 * c
14504 ** d
14505 [[Category:Foo]]
14506 !! html/parsoid
14507 <ul><li> a
14508 <ul><li> b
14509 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
14510 <li> c
14511 <ul><li> d</li></ul></li></ul>
14512 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14513 !! end
14514
14515 ## We used to, but no longer wt2wt this test since the default serializer
14516 ## will normalize all categories to serialize on their own line.
14517 ## This wikitext usage is going to be fairly uncommon in production and
14518 ## selser will take care of preserving formatting in those scenarios.
14519 !! test
14520 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
14521 !! options
14522 parsoid=wt2html
14523 !! wikitext
14524 * a [[Category:Foo]]
14525 !! html/parsoid
14526 <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>
14527 !! end
14528
14529 # This test also demonstrates because of newline+category tunneling
14530 # through the list hander, template wrapping doesn't expand to the
14531 # containing list when the list item swallows the category.
14532 !! test
14533 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
14534 !! wikitext
14535 * {{echo|a
14536 [[Category:Foo]]}}
14537 !! html/parsoid
14538 <ul><li> <span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n[[Category:Foo]]"}},"i":0}}]}'>a
14539 </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>
14540 !! end
14541
14542 !! test
14543 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
14544 !! wikitext
14545 * a
14546
14547 {{echo|[[Category:Foo]]
14548 [[Category:Bar]]}}
14549 [[Category:Baz]]
14550 !! html/parsoid
14551 <ul><li> a</li></ul>
14552
14553 <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","spc":["","","",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]]\n[[Category:Bar]]"}},"i":0}}]}'/><span about="#mwt1">
14554 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14555 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14556 !! end
14557
14558 !! test
14559 Parsoid: Serialize link to category page with colon escape
14560 !! options
14561 parsoid
14562 !! wikitext
14563
14564 [[:Category:Foo]]
14565 [[:Category:Foo|Bar]]
14566 !! html
14567 <p>
14568 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
14569 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
14570 </p>
14571 !! end
14572
14573 # We used to, but no longer wt2wt this test since the default serializer
14574 # will normalize all categories to serialize on their own line.
14575 # This wikitext usage is going to be fairly uncommon in production and
14576 # selser will take care of preventing whitespace insertion if this
14577 # occurs in an article.
14578 #
14579 # html2html disabled for the same reason (whitespace insertion between
14580 # x and y).
14581 #
14582 # html2wt disabled because it localizes the "Category" namespace.
14583 !! test
14584 Link prefix/suffixes aren't applied to category links
14585 !! options
14586 parsoid=wt2html
14587 language=is
14588 !! wikitext
14589 x[[Category:Foo]]y
14590 !! html/php
14591 <p>xy
14592 </p>
14593 !! html/parsoid
14594 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
14595 !! end
14596
14597 !! test
14598 Parsoid: Serialize link to file page with colon escape
14599 !! options
14600 parsoid
14601 !! wikitext
14602
14603 [[:File:Foo.png]]
14604 [[:File:Foo.png|Bar]]
14605 !! html
14606 <p>
14607 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
14608 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
14609 </p>
14610 !! end
14611
14612 !! test
14613 Parsoid: Serialize a genuine category link without colon escape
14614 !! options
14615 parsoid
14616 !! wikitext
14617 [[Category:Foo]]
14618 [[Category:Foo|Bar]]
14619 !! html
14620 <link rel="mw:PageProp/Category" href="./Category:Foo">
14621 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
14622 !! end
14623
14624 !! test
14625 Normalize hrefs properly before testing for invalid link targets (bug 70894)
14626 !! options
14627 parsoid=html2wt
14628 !! html/parsoid
14629 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
14630 !! wikitext
14631 [[Category:Toxine bactérienne]]
14632 !! end
14633
14634 !! test
14635 Parsoid: Defaultsort
14636 !! wikitext
14637 {{DEFAULTSORT:Foo}}
14638 !! html/parsoid
14639 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
14640 !! end
14641
14642 !! test
14643 Parsoid: Defaultsort (template-generated)
14644 !! wikitext
14645 {{{{echo|DEFAULTSORT}}:Foo}}
14646 !! html/parsoid
14647 <meta property="mw:PageProp/categorydefaultsort" content="Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[0,28,null,null],"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|DEFAULTSORT}}:Foo"},"params":{},"i":0}}]}'/>
14648 !! end
14649
14650 ###
14651 ### Inter-language links
14652 ###
14653 !! test
14654 Interlanguage links
14655 !! options
14656 ill
14657 !! wikitext
14658 [[es:Alimento]]
14659 [[fr:Nourriture]]
14660 [[zh:食品]]
14661 !! html/php
14662 es:Alimento fr:Nourriture zh:食品
14663 !! html/parsoid
14664 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
14665 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
14666 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
14667 !! end
14668
14669 !! test
14670 Duplicate interlanguage links (bug 24502)
14671 !! options
14672 ill
14673 !! wikitext
14674 [[es:1]]
14675 [[es:2]]
14676 [[fr:1]]
14677 [[fr:2]]
14678 !! html/php
14679 es:1 fr:1
14680 !! html/parsoid
14681 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
14682 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
14683 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
14684 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
14685 !! end
14686
14687 ###
14688 ### Sections
14689 ###
14690 !! test
14691 Basic section headings
14692 !! wikitext
14693 == Headline 1 ==
14694 Some text
14695
14696 ==Headline 2==
14697 More
14698 ===Smaller headline===
14699 Blah blah
14700 !! html
14701 <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>
14702 <p>Some text
14703 </p>
14704 <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>
14705 <p>More
14706 </p>
14707 <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>
14708 <p>Blah blah
14709 </p>
14710 !! end
14711
14712 !! test
14713 Section headings with TOC
14714 !! wikitext
14715 == Headline 1 ==
14716 === Subheadline 1 ===
14717 ===== Skipping a level =====
14718 ====== Skipping a level ======
14719
14720 == Headline 2 ==
14721 Some text
14722 ===Another headline===
14723 !! html
14724 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14725 <ul>
14726 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
14727 <ul>
14728 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
14729 <ul>
14730 <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>
14731 <ul>
14732 <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>
14733 </ul>
14734 </li>
14735 </ul>
14736 </li>
14737 </ul>
14738 </li>
14739 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
14740 <ul>
14741 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
14742 </ul>
14743 </li>
14744 </ul>
14745 </div>
14746
14747 <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>
14748 <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>
14749 <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>
14750 <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>
14751 <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>
14752 <p>Some text
14753 </p>
14754 <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>
14755
14756 !! end
14757
14758 !! test
14759 TOC anchors don't collide
14760 !! wikitext
14761 __FORCETOC__
14762 == Headline 2 ==
14763 == Headline ==
14764 == Headline 2 ==
14765 == Headline ==
14766 !! html/php
14767 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14768 <ul>
14769 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
14770 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
14771 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
14772 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
14773 </ul>
14774 </div>
14775
14776 <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>
14777 <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>
14778 <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>
14779 <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>
14780
14781 !! end
14782
14783 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
14784 !! test
14785 Handling of sections up to level 6 and beyond
14786 !! wikitext
14787 = Level 1 Heading=
14788 == Level 2 Heading==
14789 === Level 3 Heading===
14790 ==== Level 4 Heading====
14791 ===== Level 5 Heading=====
14792 ====== Level 6 Heading======
14793 ======= Level 7 Heading=======
14794 ======== Level 8 Heading========
14795 ========= Level 9 Heading=========
14796 ========== Level 10 Heading==========
14797 !! html
14798 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14799 <ul>
14800 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
14801 <ul>
14802 <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>
14803 <ul>
14804 <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>
14805 <ul>
14806 <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>
14807 <ul>
14808 <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>
14809 <ul>
14810 <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>
14811 <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>
14812 <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>
14813 <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>
14814 <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>
14815 </ul>
14816 </li>
14817 </ul>
14818 </li>
14819 </ul>
14820 </li>
14821 </ul>
14822 </li>
14823 </ul>
14824 </li>
14825 </ul>
14826 </div>
14827
14828 <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>
14829 <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>
14830 <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>
14831 <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>
14832 <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>
14833 <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>
14834 <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>
14835 <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>
14836 <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>
14837 <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>
14838
14839 !! end
14840
14841 !! test
14842 TOC regression (T11764)
14843 !! wikitext
14844 == title 1 ==
14845 === title 1.1 ===
14846 ==== title 1.1.1 ====
14847 === title 1.2 ===
14848 == title 2 ==
14849 === title 2.1 ===
14850 !! html
14851 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14852 <ul>
14853 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14854 <ul>
14855 <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>
14856 <ul>
14857 <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>
14858 </ul>
14859 </li>
14860 <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>
14861 </ul>
14862 </li>
14863 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14864 <ul>
14865 <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>
14866 </ul>
14867 </li>
14868 </ul>
14869 </div>
14870
14871 <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>
14872 <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>
14873 <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>
14874 <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>
14875 <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>
14876 <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>
14877
14878 !! end
14879
14880 !! test
14881 TOC for heading containing <span id="..."></span> (T96153)
14882 !! wikitext
14883 __FORCETOC__
14884 ==<span id="old-anchor"></span>New title==
14885 !! html/php
14886 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14887 <ul>
14888 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
14889 </ul>
14890 </div>
14891
14892 <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>
14893
14894 !! end
14895
14896 !! test
14897 TOC with wgMaxTocLevel=3 (bug 6204)
14898 !! options
14899 wgMaxTocLevel=3
14900 !! wikitext
14901 == title 1 ==
14902 === title 1.1 ===
14903 ==== title 1.1.1 ====
14904 === title 1.2 ===
14905 == title 2 ==
14906 === title 2.1 ===
14907 !! html
14908 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14909 <ul>
14910 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14911 <ul>
14912 <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>
14913 <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>
14914 </ul>
14915 </li>
14916 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14917 <ul>
14918 <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>
14919 </ul>
14920 </li>
14921 </ul>
14922 </div>
14923
14924 <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>
14925 <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>
14926 <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>
14927 <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>
14928 <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>
14929 <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>
14930
14931 !! end
14932
14933 !! test
14934 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
14935 !! options
14936 wgMaxTocLevel=3
14937 !! wikitext
14938 ==Section 1==
14939 ===Section 1.1===
14940 ====Section 1.1.1====
14941 ====Section 1.1.1.1====
14942 ==Section 2==
14943 !! html
14944 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14945 <ul>
14946 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
14947 <ul>
14948 <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>
14949 </ul>
14950 </li>
14951 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
14952 </ul>
14953 </div>
14954
14955 <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>
14956 <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>
14957 <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>
14958 <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>
14959 <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>
14960
14961 !! end
14962
14963
14964 !! test
14965 Resolving duplicate section names
14966 !! wikitext
14967 == Foo bar ==
14968 == Foo bar ==
14969 !! html
14970 <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>
14971 <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>
14972
14973 !! end
14974
14975 !! test
14976 Resolving duplicate section names with differing case (bug 10721)
14977 !! wikitext
14978 == Foo bar ==
14979 == Foo Bar ==
14980 !! html
14981 <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>
14982 <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>
14983
14984 !! end
14985
14986 !! article
14987 Template:sections
14988 !! text
14989 ===Section 1===
14990 ==Section 2==
14991 !! endarticle
14992
14993 !! test
14994 Template with sections, __NOTOC__
14995 !! wikitext
14996 __NOTOC__
14997 ==Section 0==
14998 {{sections}}
14999 ==Section 4==
15000 !! html
15001 <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>
15002 <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>
15003 <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>
15004 <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>
15005
15006 !! end
15007
15008 !! test
15009 __NOEDITSECTION__ keyword
15010 !! wikitext
15011 __NOEDITSECTION__
15012 ==Section 1==
15013 ==Section 2==
15014 !! html
15015 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15016 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15017
15018 !! end
15019
15020 !! test
15021 Link inside a section heading
15022 !! wikitext
15023 ==Section with a [[Main Page|link]] in it==
15024 !! html
15025 <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>
15026
15027 !! end
15028
15029 !! test
15030 TOC regression (T14077)
15031 !! wikitext
15032 __TOC__
15033 == title 1 ==
15034 === title 1.1 ===
15035 == title 2 ==
15036 !! html
15037 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15038 <ul>
15039 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15040 <ul>
15041 <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>
15042 </ul>
15043 </li>
15044 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15045 </ul>
15046 </div>
15047
15048 <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>
15049 <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>
15050 <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>
15051
15052 !! end
15053
15054 !! test
15055 BUG 1219 URL next to image (good)
15056 !! wikitext
15057 http://example.com [[File:Foobar.jpg]]
15058 !! html/php
15059 <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>
15060 </p>
15061 !! html/parsoid
15062 <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>
15063 !!end
15064
15065 !! test
15066 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
15067 !! wikitext
15068 ===
15069 The line above must have a trailing space!
15070 === <!--
15071 --> <!-- -->
15072 But just in case it doesn't...
15073 !! html
15074 <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>
15075 <p>The line above must have a trailing space!
15076 </p>
15077 <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>
15078 <p>But just in case it doesn't...
15079 </p>
15080 !! end
15081
15082 !! test
15083 Header with special characters (bug 25462)
15084 !! wikitext
15085 The tooltips shall not show entities to the user (ie. be double escaped)
15086
15087 == text > text ==
15088 section 1
15089
15090 == text < text ==
15091 section 2
15092
15093 == text & text ==
15094 section 3
15095
15096 == text ' text ==
15097 section 4
15098
15099 == text " text ==
15100 section 5
15101 !! html
15102 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15103 </p>
15104 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15105 <ul>
15106 <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>
15107 <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>
15108 <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>
15109 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15110 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15111 </ul>
15112 </div>
15113
15114 <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>
15115 <p>section 1
15116 </p>
15117 <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>
15118 <p>section 2
15119 </p>
15120 <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>
15121 <p>section 3
15122 </p>
15123 <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>
15124 <p>section 4
15125 </p>
15126 <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>
15127 <p>section 5
15128 </p>
15129 !! end
15130
15131 !! test
15132 Header with space, plus and underscore as entity
15133 !! wikitext
15134 Id should not contain + for spaces
15135
15136 == Space between Text ==
15137 section 1
15138
15139 == Space-Entity&#32;between&#32;Text ==
15140 section 2
15141
15142 == Plus+between+Text ==
15143 section 3
15144
15145 == Plus-Entity&#43;between&#43;Text ==
15146 section 4
15147
15148 == Underscore_between_Text ==
15149 section 5
15150
15151 == Underscore-Entity&#95;between&#95;Text ==
15152 section 6
15153
15154 [[#Space between Text]]
15155 [[#Space-Entity&#32;between&#32;Text]]
15156 [[#Plus+between+Text]]
15157 [[#Plus-Entity&#43;between&#43;Text]]
15158 [[#Underscore_between_Text]]
15159 [[#Underscore-Entity&#95;between&#95;Text]]
15160 !! html
15161 <p>Id should not contain + for spaces
15162 </p>
15163 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15164 <ul>
15165 <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>
15166 <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>
15167 <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>
15168 <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>
15169 <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>
15170 <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>
15171 </ul>
15172 </div>
15173
15174 <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>
15175 <p>section 1
15176 </p>
15177 <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>
15178 <p>section 2
15179 </p>
15180 <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>
15181 <p>section 3
15182 </p>
15183 <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>
15184 <p>section 4
15185 </p>
15186 <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>
15187 <p>section 5
15188 </p>
15189 <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>
15190 <p>section 6
15191 </p><p><a href="#Space_between_Text">#Space between Text</a>
15192 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15193 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15194 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15195 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15196 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15197 </p>
15198 !! end
15199
15200 !! test
15201 Headers with excess '=' characters
15202 (Are similar tests necessary beyond the 1st level?)
15203 !! wikitext
15204 =foo==
15205 ==foo=
15206 =''italic'' heading==
15207 ==''italic'' heading=
15208 !! html
15209 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15210 <ul>
15211 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15212 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15213 <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>
15214 <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>
15215 </ul>
15216 </div>
15217
15218 <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>
15219 <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>
15220 <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>
15221 <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>
15222
15223 !! end
15224
15225 !! test
15226 HTML headers vs TOC (bug 23393)
15227 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15228 !! wikitext
15229 <h1>Header 1</h1>
15230 == Header 1.1 ==
15231 == Header 1.2 ==
15232
15233 <h1>Header 2
15234 </h1>
15235 == Header 2.1 ==
15236 == Header 2.2 ==
15237 __NOEDITSECTION__
15238 !! html
15239 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15240 <ul>
15241 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15242 <ul>
15243 <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>
15244 <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>
15245 </ul>
15246 </li>
15247 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15248 <ul>
15249 <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>
15250 <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>
15251 </ul>
15252 </li>
15253 </ul>
15254 </div>
15255
15256 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15257 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15258 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15259 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15260 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15261 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15262
15263 !! end
15264
15265 !! test
15266 Single-line or multiline-comments can follow headings
15267 !! options
15268 parsoid=wt2html,wt2wt
15269 !! wikitext
15270 ==foo==<!---->
15271 ==bar==<!--c1-->
15272 ==baz==<!--
15273 c2
15274 c3-->
15275 !! html
15276 <h2><span class="mw-headline" id="foo">foo</span></h2>
15277 <h2><span class="mw-headline" id="bar">bar</span></h2>
15278 <h2><span class="mw-headline" id="baz">baz</span></h2>
15279
15280 !! end
15281
15282 !! test
15283 BUG 1219 URL next to image (broken)
15284 !! wikitext
15285 http://example.com[[File:Foobar.jpg]]
15286 !! html/php
15287 <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>
15288 </p>
15289 !! html/parsoid
15290 <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>
15291 !!end
15292
15293 !! test
15294 Bug 1186 news: in the middle of text
15295 !! wikitext
15296 http://en.wikinews.org/wiki/Wikinews:Workplace
15297 !! html
15298 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15299 </p>
15300 !!end
15301
15302
15303 !! test
15304 Namespaced link must have a title
15305 !! wikitext
15306 [[Project:]]
15307 !! html
15308 <p>[[Project:]]
15309 </p>
15310 !!end
15311
15312 !! test
15313 Namespaced link must have a title (bad fragment version)
15314 !! wikitext
15315 [[Project:#fragment]]
15316 !! html
15317 <p>[[Project:#fragment]]
15318 </p>
15319 !!end
15320
15321
15322 ###
15323 ### HTML tags and HTML attributes
15324 ###
15325
15326 !! test
15327 div with no attributes
15328 !! wikitext
15329 <div>HTML rocks</div>
15330 !! html
15331 <div>HTML rocks</div>
15332
15333 !! end
15334
15335 !! test
15336 div with double-quoted attribute
15337 !! wikitext
15338 <div id="rock">HTML rocks</div>
15339 !! html
15340 <div id="rock">HTML rocks</div>
15341
15342 !! end
15343
15344 !! test
15345 div with single-quoted attribute
15346 !! wikitext
15347 <div id='rock'>HTML rocks</div>
15348 !! html
15349 <div id="rock">HTML rocks</div>
15350
15351 !! end
15352
15353 !! test
15354 div with unquoted attribute
15355 !! wikitext
15356 <div id=rock>HTML rocks</div>
15357 !! html
15358 <div id="rock">HTML rocks</div>
15359
15360 !! end
15361
15362 !! test
15363 div with illegal double attributes
15364 !! wikitext
15365 <div id="a" id="b">HTML rocks</div>
15366 !! html
15367 <div id="b">HTML rocks</div>
15368
15369 !!end
15370
15371 # FIXME: produce empty string instead of "class" in the PHP parser, following
15372 # the HTML5 spec.
15373 !! test
15374 div with empty attribute value, space before equals
15375 !! options
15376 parsoid
15377 !! wikitext
15378 <div class =>HTML rocks</div>
15379 !! html
15380 <div class="">HTML rocks</div>
15381
15382 !! end
15383
15384 !! test
15385 div with multiple empty attribute values
15386 !! options
15387 parsoid
15388 !! wikitext
15389 <div id= title=>HTML rocks</div>
15390 !! html
15391 <div id="" title="">HTML rocks</div>
15392
15393 !! end
15394
15395 !! test
15396 table with multiple empty attribute values
15397 !! options
15398 parsoid
15399 !! wikitext
15400 {| title= id=
15401 | hi
15402 |}
15403 !! html
15404 <table title="" id="">
15405 <tbody><tr><td> hi</td></tr>
15406 </tbody></table>
15407 !! end
15408
15409 !! test
15410 div with braces in attribute value
15411 !! wikitext
15412 <div title="{}">Foo</div>
15413 !! html/php
15414 <div title="&#123;}">Foo</div>
15415
15416 !! html/parsoid
15417 <div title="{}">Foo</div>
15418 !! end
15419
15420 # This it very inconsistent in the PHP parser: it returns
15421 # class="class" if there is a space between the name and the equal sign (see
15422 # 'div with empty attribute value, space before equals'), but strips the
15423 # attribute completely if the space is missing. We hope that not much content
15424 # depends on this, so are implementing the behavior below in Parsoid for
15425 # consistencies' sake.
15426 # FIXME: fix this behavior in the PHP parser?
15427 !! test
15428 div with empty attribute value, no space before equals
15429 !! options
15430 parsoid=wt2html,html2html
15431 !! wikitext
15432 <div class=>HTML rocks</div>
15433 !! html/php
15434 <div>HTML rocks</div>
15435
15436 !! html/parsoid
15437 <div class="">HTML rocks</div>
15438 !! end
15439
15440 !! test
15441 HTML multiple attributes correction
15442 !! wikitext
15443 <p class="error" class="awesome">Awesome!</p>
15444 !! html
15445 <p class="awesome">Awesome!</p>
15446
15447 !!end
15448
15449 !! test
15450 Table multiple attributes correction
15451 !! wikitext
15452 {|
15453 !+ class="error" class="awesome"| status
15454 |}
15455 !! html
15456 <table>
15457 <tr>
15458 <th class="awesome"> status
15459 </th></tr></table>
15460
15461 !!end
15462
15463 !! test
15464 DIV IN UPPERCASE
15465 !! wikitext
15466 <DIV ID="x">HTML ROCKS</DIV>
15467 !! html
15468 <div id="x">HTML ROCKS</div>
15469
15470 !!end
15471
15472 !! test
15473 Non-ASCII pseudo-tags are rendered as text
15474 !! wikitext
15475 <khyô>
15476 !! html
15477 <p>&lt;khyô&gt;
15478 </p>
15479 !! end
15480
15481 !! test
15482 Pseudo-tag with URL 'name' renders as url link
15483 !! wikitext
15484 <http://example.com/>
15485 !! html
15486 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
15487 </p>
15488 !! end
15489
15490 !! test
15491 text with amp in the middle of nowhere
15492 !! wikitext
15493 Remember AT&T?
15494 !! html
15495 <p>Remember AT&amp;T?
15496 </p>
15497 !! end
15498
15499 !! test
15500 text with character entity: eacute
15501 !! wikitext
15502 I always thought &eacute; was a cute letter.
15503 !! html
15504 <p>I always thought &#233; was a cute letter.
15505 </p>
15506 !! html+tidy
15507 <p>I always thought é was a cute letter.</p>
15508 !! end
15509
15510 !! test
15511 text with entity-escaped character entity-like string: eacute
15512 !! wikitext
15513 I always thought &amp;eacute; was a cute letter.
15514 !! html
15515 <p>I always thought &amp;eacute; was a cute letter.
15516 </p>
15517 !! end
15518
15519 !! test
15520 text with undefined character entity: xacute
15521 !! wikitext
15522 I always thought &xacute; was a cute letter.
15523 !! html
15524 <p>I always thought &amp;xacute; was a cute letter.
15525 </p>
15526 !! end
15527
15528 !! test
15529 HTML5 tags
15530 !! wikitext
15531 <data value="5">five</data>
15532 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15533 <mark>This highlighted text</mark>
15534 !! html
15535 <p><data value="5">five</data>
15536 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15537 <mark>This highlighted text</mark>
15538 </p>
15539 !! end
15540
15541 !! test
15542 HTML tag with leading space is parsed as text
15543 !! wikitext
15544 < div>foo< /div>
15545 !! html
15546 <p>&lt; div&gt;foo&lt; /div&gt;
15547 </p>
15548 !! end
15549
15550 ###
15551 ### Nesting tests (see bug 41545, 50604, 51081)
15552 ###
15553
15554 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
15555 # Note that html2wt is considerably more difficult if we use <b> in
15556 # the test case, instead of <big>
15557 !! test
15558 Ensure that HTML adoption agency algorithm is properly implemented.
15559 !! wikitext
15560 <big>X<big>Y</big>Z</big>
15561 !! html
15562 <p><big>X<big>Y</big>Z</big>
15563 </p>
15564 !! end
15565
15566 # This was bug 41545 in the PHP parser.
15567 # Note that tidy doesn't handle this correctly.
15568 !! test
15569 Nesting of <kbd>
15570 !! wikitext
15571 <kbd>X<kbd>Y</kbd>Z</kbd>
15572 !! html
15573 <p><kbd>X<kbd>Y</kbd>Z</kbd>
15574 </p>
15575 !! end
15576
15577 # The following cases were bug 51081 in the PHP parser.
15578 # Note that there are some other nestable tags (b, i, etc) which are
15579 # not covered; see bug 51081 for discussion.
15580
15581 # Note that tidy doesn't handle this correctly.
15582 !! test
15583 Nesting of <em>
15584 !! wikitext
15585 <em>X<em>Y</em>Z</em>
15586 !! html
15587 <p><em>X<em>Y</em>Z</em>
15588 </p>
15589 !! end
15590
15591 # Note that tidy doesn't handle this correctly.
15592 !! test
15593 Nesting of <strong>
15594 !! wikitext
15595 <strong>X<strong>Y</strong>Z</strong>
15596 !! html
15597 <p><strong>X<strong>Y</strong>Z</strong>
15598 </p>
15599 !! end
15600
15601 !! test
15602 Nesting of <q>
15603 !! wikitext
15604 <q>X<q>Y</q>Z</q>
15605 !! html+tidy
15606 <p><q>X<q>Y</q>Z</q></p>
15607 !! end
15608
15609 # Note that tidy doesn't handle this correctly.
15610 !! test
15611 Nesting of <ruby>
15612 !! wikitext
15613 <ruby>X<ruby>Y</ruby>Z</ruby>
15614 !! html
15615 <p><ruby>X<ruby>Y</ruby>Z</ruby>
15616 </p>
15617 !! end
15618
15619 # Note that tidy doesn't handle this correctly.
15620 !! test
15621 Nesting of <bdo>
15622 !! wikitext
15623 <bdo>X<bdo>Y</bdo>Z</bdo>
15624 !! html
15625 <p><bdo>X<bdo>Y</bdo>Z</bdo>
15626 </p>
15627 !! end
15628
15629
15630 ###
15631 ### Media links
15632 ###
15633
15634 !! test
15635 Media link
15636 !! wikitext
15637 [[Media:Foobar.jpg]]
15638 !! html
15639 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
15640 </p>
15641 !! end
15642
15643 !! test
15644 Media link with text
15645 !! wikitext
15646 [[Media:Foobar.jpg|A neat file to look at]]
15647 !! html
15648 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
15649 </p>
15650 !! end
15651
15652 # FIXME: this is still bad HTML tag nesting
15653 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
15654 !! test
15655 Media link with nasty text
15656 !! wikitext
15657 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
15658 !! html
15659 <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>
15660
15661 !! html+tidy
15662 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
15663 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
15664 !! end
15665
15666 !! test
15667 Media link to nonexistent file (bug 1702)
15668 !! wikitext
15669 [[Media:No such.jpg]]
15670 !! html
15671 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
15672 </p>
15673 !! end
15674
15675 !! test
15676 Image link to nonexistent file (bug 1850 - good)
15677 !! wikitext
15678 [[File:No_such.jpg]]
15679 !! html/php
15680 <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>
15681 </p>
15682 !! html/parsoid
15683 <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>
15684 !! end
15685
15686 !! test
15687 :Image link to nonexistent file (bug 1850 - bad)
15688 !! wikitext
15689 [[:Image:No such.jpg]]
15690 !! html/php
15691 <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>
15692 </p>
15693 !! html/parsoid
15694 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
15695 !! end
15696
15697
15698
15699 !! test
15700 Character reference normalization in link text (bug 1938)
15701 !! wikitext
15702 [[Main Page|this&that]]
15703 !! html
15704 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
15705 </p>
15706 !!end
15707
15708 !! article
15709 אַ
15710 !! text
15711 Test for unicode normalization
15712
15713 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
15714 !! endarticle
15715
15716 !! test
15717 (bug 19451) Links should refer to the normalized form.
15718 !! wikitext
15719 [[&#xFB2E;]]
15720 [[&#x5d0;&#x5b7;]]
15721 [[&#x5d0;ַ]]
15722 [[א&#x5b7;]]
15723 [[אַ]]
15724 !! html
15725 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
15726 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
15727 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
15728 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
15729 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
15730 </p>
15731 !! end
15732
15733 !! test
15734 Empty attribute crash test (bug 2067)
15735 !! wikitext
15736 <font color="">foo</font>
15737 !! html
15738 <p><font color="">foo</font>
15739 </p>
15740 !! end
15741
15742 !! test
15743 Empty attribute crash test single-quotes (bug 2067)
15744 !! wikitext
15745 <font color=''>foo</font>
15746 !! html
15747 <p><font color="">foo</font>
15748 </p>
15749 !! end
15750
15751 !! test
15752 Attribute test: equals, then nothing
15753 !! wikitext
15754 <font color=>foo</font>
15755 !! html
15756 <p><font>foo</font>
15757 </p>
15758 !! end
15759
15760 !! test
15761 Attribute test: unquoted value
15762 !! wikitext
15763 <font color=x>foo</font>
15764 !! html
15765 <p><font color="x">foo</font>
15766 </p>
15767 !! end
15768
15769 !! test
15770 Attribute test: unquoted but illegal value (hash)
15771 !! wikitext
15772 <font color=#x>foo</font>
15773 !! html
15774 <p><font color="#x">foo</font>
15775 </p>
15776 !! end
15777
15778 # Parsoid does not serialize to empty attribute syntax,
15779 # so wt2wt and html2wt cases are skipped
15780 !! test
15781 Attribute test: no value (T54330)
15782 !! options
15783 parsoid=wt2html,html2html
15784 !! wikitext
15785 <font color>foo</font>
15786 !! html/php
15787 <p><font color="">foo</font>
15788 </p>
15789 !! html/parsoid
15790 <p><font color="">foo</font></p>
15791 !! end
15792
15793 !! test
15794 Bug 2095: link with three closing brackets
15795 !! wikitext
15796 [[Main Page]]]
15797 !! html/php
15798 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
15799 </p>
15800 !! html/parsoid
15801 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
15802 !! end
15803
15804 !! test
15805 Bug 2095: link with pipe and three closing brackets
15806 !! wikitext
15807 [[Main Page|link]]]
15808 !! html/php
15809 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
15810 </p>
15811 !! html/parsoid
15812 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
15813 !! end
15814
15815 !! test
15816 Bug 2095: link with pipe and three closing brackets, version 2
15817 !! wikitext
15818 [[Main Page|[http://example.com/]]]
15819 !! html/php
15820 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
15821 </p>
15822 !! html/parsoid
15823 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
15824 !! end
15825
15826
15827 ###
15828 ### Safety
15829 ###
15830
15831 !! article
15832 Template:Dangerous attribute
15833 !! text
15834 " onmouseover="alert(document.cookie)
15835 !! endarticle
15836
15837 !! article
15838 Template:Dangerous style attribute
15839 !! text
15840 border-size: expression(alert(document.cookie))
15841 !! endarticle
15842
15843 !! article
15844 Template:Div style
15845 !! text
15846 <div style="float: right; {{{1}}}">Magic div</div>
15847 !! endarticle
15848
15849 !! test
15850 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
15851 !! wikitext
15852 <div title="{{test}}"></div>
15853 !! html
15854 <div title="This is a test template"></div>
15855
15856 !! end
15857
15858 # Parsoid has enough context to handle this case
15859 !! test
15860 Bug 2304: HTML attribute safety (dangerous template; 2309)
15861 !! wikitext
15862 <div title="{{dangerous attribute}}"></div>
15863 !! html/php
15864 <div title=""></div>
15865
15866 !! html/parsoid
15867 <div title='" onmouseover="alert(document.cookie)' about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"title":"\" onmouseover=\"alert(document.cookie)"},"sa":{"title":"{{dangerous attribute}}"}}' data-mw='{"attribs":[[{"txt":"title"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=\"{&amp;quot;pi&amp;quot;:[[]],&amp;quot;dsr&amp;quot;:[12,35,null,null]}\" data-mw=\"{&amp;quot;parts&amp;quot;:[{&amp;quot;template&amp;quot;:{&amp;quot;target&amp;quot;:{&amp;quot;wt&amp;quot;:&amp;quot;dangerous attribute&amp;quot;,&amp;quot;href&amp;quot;:&amp;quot;./Template:Dangerous_attribute&amp;quot;},&amp;quot;params&amp;quot;:{},&amp;quot;i&amp;quot;:0}}]}\">\" onmouseover=\"alert(document.cookie)&lt;/span>"}]]}'></div>
15868 !! end
15869
15870 !! test
15871 Bug 2304: HTML attribute safety (dangerous style template; 2309)
15872 !! wikitext
15873 <div style="{{dangerous style attribute}}"></div>
15874 !! html
15875 <div style="/* insecure input */"></div>
15876
15877 !! end
15878
15879 !! test
15880 Bug 2304: HTML attribute safety (safe parameter; 2309)
15881 !! wikitext
15882 {{div style|width: 200px}}
15883 !! html
15884 <div style="float: right; width: 200px">Magic div</div>
15885
15886 !! end
15887
15888 !! test
15889 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
15890 !! wikitext
15891 {{div style|width: expression(alert(document.cookie))}}
15892 !! html
15893 <div style="/* insecure input */">Magic div</div>
15894
15895 !! end
15896
15897 !! test
15898 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
15899 !! wikitext
15900 {{div style|"><script>alert(document.cookie)</script>}}
15901 !! html
15902 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15903
15904 !! end
15905
15906 !! test
15907 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
15908 !! wikitext
15909 {{div style|" ><script>alert(document.cookie)</script>}}
15910 !! html
15911 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15912
15913 !! end
15914
15915 !! test
15916 Bug 2304: HTML attribute safety (link)
15917 !! wikitext
15918 <div title="[[Main Page]]"></div>
15919 !! html
15920 <div title="&#91;&#91;Main Page]]"></div>
15921
15922 !! end
15923
15924 !! test
15925 Bug 2304: HTML attribute safety (italics)
15926 !! wikitext
15927 <div title="''foobar''"></div>
15928 !! html
15929 <div title="&#39;&#39;foobar&#39;&#39;"></div>
15930
15931 !! end
15932
15933 !! test
15934 Bug 2304: HTML attribute safety (bold)
15935 !! wikitext
15936 <div title="'''foobar'''"></div>
15937 !! html
15938 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
15939
15940 !! end
15941
15942
15943 !! test
15944 Bug 2304: HTML attribute safety (ISBN)
15945 !! wikitext
15946 <div title="ISBN 1234567890"></div>
15947 !! html
15948 <div title="&#73;SBN 1234567890"></div>
15949
15950 !! end
15951
15952 !! test
15953 Bug 2304: HTML attribute safety (RFC)
15954 !! wikitext
15955 <div title="RFC 1234"></div>
15956 !! html
15957 <div title="&#82;FC 1234"></div>
15958
15959 !! end
15960
15961 !! test
15962 Bug 2304: HTML attribute safety (PMID)
15963 !! wikitext
15964 <div title="PMID 1234567890"></div>
15965 !! html
15966 <div title="&#80;MID 1234567890"></div>
15967
15968 !! end
15969
15970 !! test
15971 Bug 2304: HTML attribute safety (web link)
15972 !! wikitext
15973 <div title="http://example.com/"></div>
15974 !! html
15975 <div title="http&#58;//example.com/"></div>
15976
15977 !! end
15978
15979 !! test
15980 Bug 2304: HTML attribute safety (named web link)
15981 !! wikitext
15982 <div title="[http://example.com/ link]"></div>
15983 !! html
15984 <div title="&#91;http&#58;//example.com/ link]"></div>
15985
15986 !! end
15987
15988 !! test
15989 Bug 3244: HTML attribute safety (extension; safe)
15990 !! wikitext
15991 <div style="<nowiki>background:blue</nowiki>"></div>
15992 !! html
15993 <div style="background:blue"></div>
15994
15995 !! end
15996
15997 !! test
15998 Bug 3244: HTML attribute safety (extension; unsafe)
15999 !! wikitext
16000 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
16001 !! html
16002 <div style="/* insecure input */"></div>
16003
16004 !! end
16005
16006 # More MSIE fun discovered by Tom Gilder
16007
16008 !! test
16009 MSIE CSS safety test: spurious slash
16010 !! wikitext
16011 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16012 !! html
16013 <div style="/* insecure input */">evil</div>
16014
16015 !! end
16016
16017 !! test
16018 MSIE CSS safety test: hex code
16019 !! wikitext
16020 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16021 !! html
16022 <div style="/* insecure input */">evil</div>
16023
16024 !! end
16025
16026 !! test
16027 MSIE CSS safety test: comment in url
16028 !! wikitext
16029 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16030 !! html
16031 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16032
16033 !! end
16034
16035 !! test
16036 MSIE CSS safety test: comment in expression
16037 !! wikitext
16038 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16039 !! html
16040 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16041
16042 !! end
16043
16044 !! test
16045 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
16046 !! wikitext
16047 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16048 !! html
16049 <p style="/* invalid control char */">A</p>
16050
16051 !! end
16052
16053 !! test
16054 MSIE 6 CSS safety test: Fullwidth (bug 55332)
16055 !! wikitext
16056 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16057 <div style="top:EXPRESSION(alert())">B</div>
16058 !! html
16059 <p style="/* insecure input */">A</p>
16060 <div style="/* insecure input */">B</div>
16061
16062 !! end
16063
16064 !! test
16065 MSIE 6 CSS safety test: IPA extensions (bug 55332)
16066 !! wikitext
16067 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16068 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16069 !! html
16070 <div style="/* insecure input */">A</div>
16071 <p style="/* insecure input */">B</p>
16072
16073 !! end
16074
16075 !! test
16076 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16077 !! wikitext
16078 <div style="background-image:url⁽javascript:alert())">A</div>
16079 <div style="background-image:url₍javascript:alert())">B</div>
16080 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16081 !! html
16082 <div style="/* insecure input */">A</div>
16083 <div style="/* insecure input */">B</div>
16084 <p style="/* insecure input */">C</p>
16085
16086 !! end
16087
16088 # FIXME: Parsoid fails to sanitize this! See T58846.
16089 !! test
16090 Opera -o-link CSS
16091 !! wikitext
16092 <div
16093 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;"
16094 style="-o-link:attr(title);-o-link-source:current">X</div>
16095 !! html
16096 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16097
16098 !! end
16099
16100 !! test
16101 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16102 !! wikitext
16103 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16104 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16105 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16106 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16107 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16108 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16109 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16110 !! html
16111 <p style="/* insecure input */">A</p>
16112 <p style="/* insecure input */">B</p>
16113 <p style="/* insecure input */">C</p>
16114 <p style="/* insecure input */">D</p>
16115 <p style="/* insecure input */">E</p>
16116 <p style="/* insecure input */">F</p>
16117 <p style="/* insecure input */">G</p>
16118
16119 !! end
16120
16121 !! test
16122 Table attribute legitimate extension
16123 !! wikitext
16124 {|
16125 !+ style="<nowiki>color:blue</nowiki>"| status
16126 |}
16127 !! html
16128 <table>
16129 <tr>
16130 <th style="color:blue"> status
16131 </th></tr></table>
16132
16133 !!end
16134
16135 !! test
16136 Table attribute safety
16137 !! wikitext
16138 {|
16139 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16140 |}
16141 !! html
16142 <table>
16143 <tr>
16144 <th style="/* insecure input */"> status
16145 </th></tr></table>
16146
16147 !! end
16148
16149 !! test
16150 CSS line continuation 1
16151 !! wikitext
16152 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16153 !! html
16154 <div style="/* insecure input */"></div>
16155
16156 !! end
16157
16158 !! test
16159 CSS line continuation 2
16160 !! wikitext
16161 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16162 !! html
16163 <div style="/* invalid control char */"></div>
16164
16165 !! end
16166
16167 !! article
16168 Template:Identity
16169 !! text
16170 {{{1}}}
16171 !! endarticle
16172
16173 !! test
16174 Expansion of multi-line templates in attribute values (bug 6255)
16175 !! wikitext
16176 <div style="background: {{identity|#00FF00}}">-</div>
16177 !! html
16178 <div style="background: #00FF00">-</div>
16179
16180 !! end
16181
16182
16183 !! test
16184 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16185 !! wikitext
16186 <div style="background:
16187 #00FF00">-</div>
16188 !! html/php
16189 <div style="background: #00FF00">-</div>
16190
16191 !! html/parsoid
16192 <div style="background:
16193 #00FF00">-</div>
16194 !! end
16195
16196 !! test
16197 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16198 !! wikitext
16199 <div style="background: &#10;#00FF00">-</div>
16200 !! html
16201 <div style="background: &#10;#00FF00">-</div>
16202
16203 !! end
16204
16205 !! test
16206 evil <math>-wiki-tags without Extension:Math enabled
16207 !! wikitext
16208 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
16209 !! html+tidy
16210 <p>&lt;math&gt;&lt;img src="some evil external link"&gt;&lt;script&gt;some_evil_javascript();&lt;/script&gt;&lt;/math&gt;</p>
16211 !! end
16212
16213 ###
16214 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16215 ###
16216 !! test
16217 Parser hook: empty input
16218 !! wikitext
16219 <tag></tag>
16220 !! html/php
16221 <pre>
16222 ''
16223 array (
16224 )
16225 </pre>
16226
16227 !! html/parsoid
16228 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16229 !! end
16230
16231 ## Don't expect parsoid to rt this form.
16232 !! test
16233 Parser hook: empty input using terminated empty elements
16234 !! options
16235 parsoid=wt2html,html2html
16236 !! wikitext
16237 <tag/>
16238 !! html/php
16239 <pre>
16240 NULL
16241 array (
16242 )
16243 </pre>
16244
16245 !! html/parsoid
16246 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16247 !! end
16248
16249 !! test
16250 Parser hook: empty input using terminated empty elements (space before)
16251 !! wikitext
16252 <tag />
16253 !! html/php
16254 <pre>
16255 NULL
16256 array (
16257 )
16258 </pre>
16259
16260 !! html/parsoid
16261 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16262 !! end
16263
16264 !! test
16265 Parser hook: basic input
16266 !! wikitext
16267 <tag>input</tag>
16268 !! html/php
16269 <pre>
16270 'input'
16271 array (
16272 )
16273 </pre>
16274
16275 !! html/parsoid
16276 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16277 !! end
16278
16279 ## Don't expect parsoid to rt this form.
16280 !! test
16281 Parser hook: case insensitive
16282 !! options
16283 parsoid=wt2html,html2html
16284 !! wikitext
16285 <TAG>input</TAG>
16286 !! html/php
16287 <pre>
16288 'input'
16289 array (
16290 )
16291 </pre>
16292
16293 !! html/parsoid
16294 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16295 !! end
16296
16297 ## Don't expect parsoid to rt this form.
16298 !! test
16299 Parser hook: case insensitive, redux
16300 !! options
16301 parsoid=wt2html,html2html
16302 !! wikitext
16303 <TaG>input</TAg>
16304 !! html/php
16305 <pre>
16306 'input'
16307 array (
16308 )
16309 </pre>
16310
16311 !! html/parsoid
16312 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16313 !! end
16314
16315 !! test
16316 Parser hook: nested tags
16317 !! options
16318 noxml
16319 !! wikitext
16320 <tag><tag></tag></tag>
16321 !! html/php
16322 <pre>
16323 '<tag>'
16324 array (
16325 )
16326 </pre>&lt;/tag&gt;
16327
16328 !! html/parsoid
16329 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
16330 !! end
16331
16332 !! test
16333 Parser hook: basic arguments
16334 !! wikitext
16335 <tag width="200" height="100" depth="50" square=""></tag>
16336 !! html/php
16337 <pre>
16338 ''
16339 array (
16340 'width' => '200',
16341 'height' => '100',
16342 'depth' => '50',
16343 'square' => '',
16344 )
16345 </pre>
16346
16347 !! html/parsoid
16348 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16349 !! end
16350
16351 ## Don't expect parsoid to rt this form.
16352 !! test
16353 Parser hook: basic arguments, variations
16354 !! options
16355 parsoid=wt2html,html2html
16356 !! wikitext
16357 <tag width=200 height = "100" depth = '50' square></tag>
16358 !! html/php
16359 <pre>
16360 ''
16361 array (
16362 'width' => '200',
16363 'height' => '100',
16364 'depth' => '50',
16365 'square' => '',
16366 )
16367 </pre>
16368
16369 !! html/parsoid
16370 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16371 !! end
16372
16373 !! test
16374 Parser hook: argument containing a forward slash (bug 5344)
16375 !! wikitext
16376 <tag filename="/tmp/bla"></tag>
16377 !! html/php
16378 <pre>
16379 ''
16380 array (
16381 'filename' => '/tmp/bla',
16382 )
16383 </pre>
16384
16385 !! html/parsoid
16386 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16387 !! end
16388
16389 ## Don't expect parsoid to rt this form.
16390 !! test
16391 Parser hook: empty input using terminated empty elements (bug 2374)
16392 !! options
16393 parsoid=wt2html,html2html
16394 !! wikitext
16395 <tag foo=bar/>text
16396 !! html/php
16397 <pre>
16398 NULL
16399 array (
16400 'foo' => 'bar',
16401 )
16402 </pre>text
16403
16404 !! html/parsoid
16405 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
16406 !! end
16407
16408 # </tag> should be output literally since there is no matching tag that begins it
16409 !! test
16410 Parser hook: basic arguments using terminated empty elements (bug 2374)
16411 !! wikitext
16412 <tag width=200 height = "100" depth = '50' square/>
16413 other stuff
16414 </tag>
16415 !! html/php
16416 <pre>
16417 NULL
16418 array (
16419 'width' => '200',
16420 'height' => '100',
16421 'depth' => '50',
16422 'square' => '',
16423 )
16424 </pre>
16425 <p>other stuff
16426 &lt;/tag&gt;
16427 </p>
16428 !! end
16429
16430 ###
16431 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
16432 ###
16433
16434 !! test
16435 Parser hook: static parser hook not inside a comment
16436 !! wikitext
16437 <statictag>hello, world</statictag>
16438
16439 <statictag action="flush" />
16440 !! html/php
16441 <p><br />
16442 hello, world
16443 </p>
16444 !! html/parsoid
16445 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
16446 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
16447 !! end
16448
16449 !! test
16450 Parser hook: static parser hook inside a comment
16451 !! wikitext
16452 <!-- <statictag>hello, world</statictag> -->
16453 <statictag action="flush" />
16454 !! html/php
16455 <p><br />
16456 </p>
16457 !! html/parsoid
16458 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
16459 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
16460 !! end
16461
16462 # Nested template calls; this case was broken by Parser.php rev 1.506,
16463 # since reverted.
16464
16465 !! article
16466 Template:One-parameter
16467 !! text
16468 (My parameter is: {{{1}}})
16469 !! endarticle
16470
16471 !! article
16472 Template:Map-one-parameter
16473 !! text
16474 {{{{{1}}}|{{{2}}}}}
16475 !! endarticle
16476
16477 !! test
16478 Nested template calls
16479 !! wikitext
16480 {{Map-one-parameter|One-parameter|param}}
16481 !! html
16482 <p>(My parameter is: param)
16483 </p>
16484 !! end
16485
16486
16487 ###
16488 ### Sanitizer
16489 ###
16490
16491 # HTML+Tidy effectively strips out the empty tags completely
16492 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
16493 # which Tidy would have done for the PHP parser had there been content inside it.
16494 !! test
16495 Sanitizer: Closing of open tags
16496 !! wikitext
16497 <s></s><table></table>
16498 !! html
16499 <s></s><table></table>
16500
16501 !! html/parsoid
16502 <p><s></s></p><table></table>
16503 !! end
16504
16505 !! test
16506 Sanitizer: Closing of open but not closed tags
16507 !! wikitext
16508 <s>foo
16509 !! html
16510 <p><s>foo</s>
16511 </p>
16512 !! end
16513
16514 !! test
16515 Sanitizer: Closing of closed but not open tags
16516 !! options
16517 parsoid=wt2html
16518 !! wikitext
16519 </s>
16520 !! html/php+tidy
16521 !! html/parsoid
16522 !! end
16523
16524 !! test
16525 Sanitizer: Closing of closed but not open table tags
16526 !! options
16527 parsoid=wt2html
16528 !! wikitext
16529 Table not started</td></tr></table>
16530 !! html/php+tidy
16531 <p>Table not started</p>
16532 !! html/parsoid
16533 <p>Table not started</p>
16534 !! end
16535
16536 !! test
16537 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
16538 !! wikitext
16539 <span id="æ: v">byte</span>[[#æ: v|backlink]]
16540 !! html
16541 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
16542 </p>
16543 !! end
16544
16545 # In HTML5, the restrictions are that id must contain at least one character,
16546 # and must not contain any space characters.
16547 !! test
16548 Sanitizer: Validating the contents of the id attribute (bug 4515)
16549 !! options
16550 disabled
16551 !! wikitext
16552 <br id="" /><br id="a space" />
16553 !! html
16554 Something ...
16555 !! end
16556
16557 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
16558 !! test
16559 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
16560 !! options
16561 disabled
16562 !! wikitext
16563 <br id="foo" /><br id="foo" />
16564 !! html
16565 Something need to be done. foo-2 ?
16566 !! end
16567
16568 !! test
16569 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
16570 !! wikitext
16571 <div itemscope>
16572 <meta itemprop="hello" content="world">
16573 <meta http-equiv="refresh" content="5">
16574 <meta itemprop="hello" http-equiv="refresh" content="5">
16575 <link itemprop="hello" href="{{SERVER}}">
16576 <link rel="stylesheet" href="{{SERVER}}">
16577 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
16578 </div>
16579 !! html
16580 <div itemscope="">
16581 <p> <meta itemprop="hello" content="world" />
16582 &lt;meta http-equiv="refresh" content="5"&gt;
16583 <meta itemprop="hello" content="5" />
16584 </p>
16585 <link itemprop="hello" href="http&#58;//example.org" />
16586 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
16587 <link itemprop="hello" href="http&#58;//example.org" />
16588 </div>
16589
16590 !! end
16591
16592 !! test
16593 Language converter: output gets cut off unexpectedly (bug 5757)
16594 !! options
16595 language=zh
16596 !! wikitext
16597 this bit is safe: }-
16598
16599 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
16600
16601 then we get cut off here: }-
16602
16603 all additional text is vanished
16604 !! html
16605 <p>this bit is safe: }-
16606 </p><p>but if we add a conversion instance: xxx
16607 </p><p>then we get cut off here: }-
16608 </p><p>all additional text is vanished
16609 </p>
16610 !! end
16611
16612 !! test
16613 Self closed html pairs (bug 5487)
16614 !! options
16615 !! wikitext
16616 <center><font id="bug" />Centered text</center>
16617 <div><font id="bug2" />In div text</div>
16618 !! html
16619 <center>&lt;font id="bug" /&gt;Centered text</center>
16620 <div>&lt;font id="bug2" /&gt;In div text</div>
16621
16622 !! end
16623
16624 #
16625 #
16626 #
16627
16628 !! test
16629 Punctuation: nbsp before exclamation
16630 !! wikitext
16631 C'est grave !
16632 !! html
16633 <p>C'est grave&#160;!
16634 </p>
16635 !! end
16636
16637 !! test
16638 Punctuation: CSS !important (bug 11874)
16639 !! wikitext
16640 <div style="width:50% !important">important</div>
16641 !! html
16642 <div style="width:50% !important">important</div>
16643
16644 !!end
16645
16646 !! test
16647 Punctuation: CSS ! important (bug 11874; with space after)
16648 !! wikitext
16649 <div style="width:50% ! important">important</div>
16650 !! html
16651 <div style="width:50% ! important">important</div>
16652
16653 !!end
16654
16655 !! test
16656 HTML bullet list, closed tags (bug 5497)
16657 !! wikitext
16658 <ul>
16659 <li>One</li>
16660 <li>Two</li>
16661 </ul>
16662 !! html/php
16663 <ul>
16664 <li>One</li>
16665 <li>Two</li>
16666 </ul>
16667
16668 !! html/parsoid
16669 <ul data-parsoid='{"stx":"html"}'>
16670 <li data-parsoid='{"stx":"html"}'>One</li>
16671 <li data-parsoid='{"stx":"html"}'>Two</li>
16672 </ul>
16673
16674 !! end
16675
16676 !! test
16677 HTML bullet list, unclosed tags (bug 5497)
16678 !! wikitext
16679 <ul>
16680 <li>One
16681 <li>Two
16682 </ul>
16683 !! html/php+tidy
16684 <ul>
16685 <li>One</li>
16686 <li>Two</li>
16687 </ul>
16688 !! html/parsoid
16689 <ul data-parsoid='{"stx":"html"}'>
16690 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16691 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16692 </ul>
16693
16694 !! end
16695
16696 !! test
16697 HTML ordered list, closed tags (bug 5497)
16698 !! wikitext
16699 <ol>
16700 <li>One</li>
16701 <li>Two</li>
16702 </ol>
16703 !! html/php
16704 <ol>
16705 <li>One</li>
16706 <li>Two</li>
16707 </ol>
16708
16709 !! html/parsoid
16710 <ol data-parsoid='{"stx":"html"}'>
16711 <li data-parsoid='{"stx":"html"}'>One</li>
16712 <li data-parsoid='{"stx":"html"}'>Two</li>
16713 </ol>
16714
16715 !! end
16716
16717 !! test
16718 HTML ordered list, unclosed tags (bug 5497)
16719 !! options
16720 !! wikitext
16721 <ol>
16722 <li>One
16723 <li>Two
16724 </ol>
16725 !! html/php+tidy
16726 <ol>
16727 <li>One</li>
16728 <li>Two</li>
16729 </ol>
16730 !! html/parsoid
16731 <ol data-parsoid='{"stx":"html"}'>
16732 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16733 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16734 </ol>
16735
16736 !! end
16737
16738 !! test
16739 HTML nested bullet list, closed tags (bug 5497)
16740 !! wikitext
16741 <ul>
16742 <li>One</li>
16743 <li>Two:
16744 <ul>
16745 <li>Sub-one</li>
16746 <li>Sub-two</li>
16747 </ul>
16748 </li>
16749 </ul>
16750 !! html
16751 <ul>
16752 <li>One</li>
16753 <li>Two:
16754 <ul>
16755 <li>Sub-one</li>
16756 <li>Sub-two</li>
16757 </ul>
16758 </li>
16759 </ul>
16760
16761 !! end
16762
16763 !! test
16764 HTML nested bullet list, open tags (bug 5497)
16765 !! wikitext
16766 <ul>
16767 <li>One
16768 <li>Two:
16769 <ul>
16770 <li>Sub-one
16771 <li>Sub-two
16772 </ul>
16773 </ul>
16774 !! html/php+tidy
16775 <ul>
16776 <li>One</li>
16777 <li>Two:
16778 <ul>
16779 <li>Sub-one</li>
16780 <li>Sub-two</li>
16781 </ul>
16782 </li>
16783 </ul>
16784 !! html/parsoid
16785 <ul>
16786 <li>One
16787 </li>
16788 <li>Two:
16789 <ul>
16790 <li>Sub-one
16791 </li>
16792 <li>Sub-two
16793 </li>
16794 </ul>
16795 </li>
16796 </ul>
16797
16798 !! end
16799
16800 !! test
16801 HTML nested ordered list, closed tags (bug 5497)
16802 !! wikitext
16803 <ol>
16804 <li>One</li>
16805 <li>Two:
16806 <ol>
16807 <li>Sub-one</li>
16808 <li>Sub-two</li>
16809 </ol>
16810 </li>
16811 </ol>
16812 !! html
16813 <ol>
16814 <li>One</li>
16815 <li>Two:
16816 <ol>
16817 <li>Sub-one</li>
16818 <li>Sub-two</li>
16819 </ol>
16820 </li>
16821 </ol>
16822
16823 !! end
16824
16825 !! test
16826 HTML nested ordered list, open tags (bug 5497)
16827 !! wikitext
16828 <ol>
16829 <li>One
16830 <li>Two:
16831 <ol>
16832 <li>Sub-one
16833 <li>Sub-two
16834 </ol>
16835 </ol>
16836 !! html/php
16837 <ol>
16838 <li>One
16839 <li>Two:
16840 <ol>
16841 <li>Sub-one
16842 <li>Sub-two
16843 </ol>
16844 </ol>
16845
16846 !! html/parsoid
16847 <ol>
16848 <li>One
16849 </li>
16850 <li>Two:
16851 <ol>
16852 <li>Sub-one
16853 </li>
16854 <li>Sub-two
16855 </li>
16856 </ol>
16857 </li>
16858 </ol>
16859
16860 !! end
16861
16862 !! test
16863 HTML ordered list item with parameters oddity
16864 !! wikitext
16865 <ol><li id="fragment">One</li>
16866 </ol>
16867 !! html
16868 <ol><li id="fragment">One</li>
16869 </ol>
16870
16871 !! end
16872
16873 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
16874 !!test
16875 bug 5918: autonumbering
16876 !! wikitext
16877 [http://first/] [http://second] [ftp://ftp]
16878
16879 ftp://inlineftp
16880
16881 [mailto:enclosed@mail.tld With target]
16882
16883 [mailto:enclosed@mail.tld]
16884
16885 mailto:inline@mail.tld
16886 !! html/php
16887 <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>
16888 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
16889 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
16890 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
16891 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
16892 </p>
16893 !! html/parsoid
16894 <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>
16895 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
16896 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
16897 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
16898 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
16899 !! end
16900
16901
16902 #
16903 # Security and HTML correctness
16904 # From Nick Jenkins' fuzz testing
16905 #
16906
16907 !! test
16908 Fuzz testing: Parser13
16909 !! wikitext
16910 {|
16911 | http://a|
16912 !! html
16913 <table>
16914 <tr>
16915 <td>
16916 </td>
16917 </tr>
16918 </table>
16919
16920 !! end
16921
16922 !! test
16923 Fuzz testing: Parser14
16924 !! wikitext
16925 == onmouseover= ==
16926 http://__TOC__
16927 !! html
16928 <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>
16929 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16930 <ul>
16931 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16932 </ul>
16933 </div>
16934
16935
16936 !! html+tidy
16937 <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>
16938 <p>http://</p>
16939 <div id="toc" class="toc">
16940 <div id="toctitle">
16941 <h2>Contents</h2>
16942 </div>
16943 <ul>
16944 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16945 </ul>
16946 </div>
16947 <p></p>
16948 !! end
16949
16950 !! test
16951 Fuzz testing: Parser14-table
16952 !! wikitext
16953 ==a==
16954 {| STYLE=__TOC__
16955 !! html
16956 <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>
16957 <table style="&#95;_TOC&#95;_">
16958 <tr><td></td></tr>
16959 </table>
16960
16961 !! html+tidy
16962 <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>
16963 <table style="__TOC__">
16964 <tr>
16965 <td></td>
16966 </tr>
16967 </table>
16968 !! end
16969
16970 # Known to produce bogus xml (extra </td>)
16971 !! test
16972 Fuzz testing: Parser16
16973 !! options
16974 noxml
16975 !! wikitext
16976 {|
16977 !https://||||||
16978 !! html
16979 <table>
16980 <tr>
16981 <th>https://</th>
16982 <th></th>
16983 <th></th>
16984 <th>
16985 </td>
16986 </tr>
16987 </table>
16988
16989 !! html+tidy
16990 <table>
16991 <tr>
16992 <th>https://</th>
16993 <th></th>
16994 <th></th>
16995 <th></th>
16996 </tr>
16997 </table>
16998 !! end
16999
17000 !! test
17001 Fuzz testing: Parser21
17002 !! wikitext
17003 {|
17004 ! irc://{{ftp://a" onmouseover="alert('hello world');"
17005 |
17006 !! html
17007 <table>
17008 <tr>
17009 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17010 </th>
17011 <td>
17012 </td>
17013 </tr>
17014 </table>
17015
17016 !! end
17017
17018 !! test
17019 Fuzz testing: Parser22
17020 !! wikitext
17021 http://===r:::https://b
17022
17023 {|
17024 !! html
17025 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17026 </p>
17027 <table>
17028 <tr><td></td></tr>
17029 </table>
17030
17031 !! end
17032
17033 # Known to produce bad XML for now
17034 !! test
17035 Fuzz testing: Parser24
17036 !! options
17037 noxml
17038 !! wikitext
17039 {|
17040 {{{|
17041 <u CLASS=
17042 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17043 <br style="onmouseover='alert(document.cookie);' " />
17044
17045 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17046 |
17047 !! html
17048 <table>
17049 {{{|
17050 <u class="&#124;">}}}} &gt;
17051 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17052
17053 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17054 <tr>
17055 <td></u>
17056 </td>
17057 </tr>
17058 </table>
17059
17060 !! end
17061
17062 # Note: the current result listed for this is not what the original one was,
17063 # but the original bug was JavaScript injection, which is fixed in any case.
17064 # It's not clear that the original result listed was any more correct than the
17065 # current one. Original result:
17066 # <p>{{{|
17067 # </p>
17068 # <li class="&#124;&#124;">
17069 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17070 !!test
17071 Fuzz testing: Parser25 (bug 6055)
17072 !! wikitext
17073 {{{
17074 |
17075 <LI CLASS=||
17076 >
17077 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17078 !! html
17079 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17080 </p>
17081 !! end
17082
17083 !!test
17084 Fuzz testing: URL adjacent extension (with space, clean)
17085 !! wikitext
17086 http://example.com <nowiki>junk</nowiki>
17087 !! html/php
17088 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17089 </p>
17090 !! html/parsoid
17091 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17092 !! end
17093
17094 !!test
17095 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17096 !! wikitext
17097 http://example.com<nowiki>junk</nowiki>
17098 !! html/php
17099 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17100 </p>
17101 !! html/parsoid
17102 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17103 !! end
17104
17105 !!test
17106 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17107 !! wikitext
17108 http://example.com<pre>junk</pre>
17109 !! html/php
17110 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17111
17112 !! html/php+tidy
17113 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17114 <pre>
17115 junk
17116 </pre>
17117 !! html/parsoid
17118 <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>
17119 !!end
17120
17121 !!test
17122 Fuzz testing: image with bogus manual thumbnail
17123 !! wikitext
17124 [[Image:foobar.jpg|thumbnail= ]]
17125 !! html/php
17126 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17127
17128 !! html/parsoid
17129 <figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"manualthumb","ak":"thumbnail= "}],"dsr":[0,32,2,2]}' data-mw='{"errors":[{"key":"missing-thumbnail","message":"This thumbnail does not exist.","params":{"name":""}}],"thumb":""}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{},"dsr":[2,30,null,null]}'><img resource="./File:Foobar.jpg" src="./Special:FilePath/" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"220"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure>
17130 !!end
17131
17132 !! test
17133 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17134 !! wikitext
17135 <pre dir="&#10;"></pre>
17136 !! html
17137 <pre dir="&#10;"></pre>
17138
17139 !! end
17140
17141 !! test
17142 Parsing optional HTML elements (Bug 6171)
17143 !! options
17144 !! wikitext
17145 <table>
17146 <tr>
17147 <td> Some tabular data</td>
17148 <td> More tabular data ...
17149 <td> And yet som tabular data</td>
17150 </tr>
17151 </table>
17152 !! html
17153 <table>
17154 <tr>
17155 <td> Some tabular data</td>
17156 <td> More tabular data ...
17157 </td><td> And yet som tabular data</td>
17158 </tr>
17159 </table>
17160
17161 !! end
17162
17163 !! test
17164 Correct handling of <td>, <tr> (Bug 6171)
17165 !! options
17166 !! wikitext
17167 <table>
17168 <tr>
17169 <td> Some tabular data</td>
17170 <td> More tabular data ...</td>
17171 <td> And yet som tabular data</td>
17172 </tr>
17173 </table>
17174 !! html
17175 <table>
17176 <tr>
17177 <td> Some tabular data</td>
17178 <td> More tabular data ...</td>
17179 <td> And yet som tabular data</td>
17180 </tr>
17181 </table>
17182
17183 !! end
17184
17185
17186 !! test
17187 Parsing crashing regression (fr:JavaScript)
17188 !! wikitext
17189 </body></x>
17190 !! html
17191 <p>&lt;/body&gt;&lt;/x&gt;
17192 </p>
17193 !! end
17194
17195 !! test
17196 Inline wiki vs wiki block nesting
17197 !! wikitext
17198 '''Bold paragraph
17199
17200 New wiki paragraph
17201 !! html
17202 <p><b>Bold paragraph</b>
17203 </p><p>New wiki paragraph
17204 </p>
17205 !! end
17206
17207 # FIXME: The current php output is documented
17208 # and desired output is the parsoid target.
17209 !! test
17210 Inline HTML vs wiki block nesting
17211 !! wikitext
17212 <b>Bold paragraph
17213
17214 New wiki paragraph
17215 !! html/php
17216 <p><b>Bold paragraph
17217 </p><p>New wiki paragraph</b>
17218 </p>
17219 !! html/parsoid
17220 <p><b>Bold paragraph</b>
17221 </p><p>New wiki paragraph
17222 </p>
17223 !! end
17224
17225 # Original result was this:
17226 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
17227 # </p>
17228 # While that might be marginally more intuitive, maybe, the six-apostrophe
17229 # construct is clearly pathological and the result stated here (which is what
17230 # the parser actually does) is about as reasonable as anything.
17231 !!test
17232 Mixing markup for italics and bold
17233 !! options
17234 !! wikitext
17235 '''bold''''''bold''bolditalics'''''
17236 !! html
17237 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
17238 </p>
17239 !! end
17240
17241
17242 !! article
17243 Xyzzyx
17244 !! text
17245 Article for special page transclusion test
17246 !! endarticle
17247
17248 !! test
17249 Special page transclusion
17250 !! options
17251 !! wikitext
17252 {{Special:Prefixindex/Xyzzyx}}
17253 !! html
17254 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17255 </ul>
17256
17257 !! end
17258
17259 !! test
17260 Special page transclusion twice (bug 5021)
17261 !! options
17262 !! wikitext
17263 {{Special:Prefixindex/Xyzzyx}}
17264 {{Special:Prefixindex/Xyzzyx}}
17265 !! html
17266 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17267 </ul>
17268 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17269 </ul>
17270
17271 !! end
17272
17273 !! test
17274 Transclusion of default MediaWiki message
17275 !! wikitext
17276 {{MediaWiki:Mainpage}}
17277 !! html
17278 <p>Main Page
17279 </p>
17280 !! end
17281
17282 !! test
17283 Transclusion of nonexistent MediaWiki message
17284 !! wikitext
17285 {{MediaWiki:Mainpagexxx}}
17286 !! html
17287 <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>
17288 </p>
17289 !! end
17290
17291 !! test
17292 Transclusion of MediaWiki message with underscore
17293 !! wikitext
17294 {{MediaWiki:history_short}}
17295 !! html
17296 <p>History
17297 </p>
17298 !! end
17299
17300 !! test
17301 Transclusion of MediaWiki message with space
17302 !! wikitext
17303 {{MediaWiki:history short}}
17304 !! html
17305 <p>History
17306 </p>
17307 !! end
17308
17309 !! test
17310 Invalid header with following text
17311 !! wikitext
17312 = x = y
17313 !! html
17314 <p>= x = y
17315 </p>
17316 !! end
17317
17318
17319 !! test
17320 Section extraction test (section 0)
17321 !! options
17322 section=0
17323 !! wikitext
17324 start
17325 ==a==
17326 ===aa===
17327 ====aaa====
17328 ==b==
17329 ===ba===
17330 ===bb===
17331 ====bba====
17332 ===bc===
17333 ==c==
17334 ===ca===
17335 !! html/php
17336 start
17337 !! end
17338
17339 !! test
17340 Section extraction test (section 1)
17341 !! options
17342 section=1
17343 !! wikitext
17344 start
17345 ==a==
17346 ===aa===
17347 ====aaa====
17348 ==b==
17349 ===ba===
17350 ===bb===
17351 ====bba====
17352 ===bc===
17353 ==c==
17354 ===ca===
17355 !! html/php
17356 ==a==
17357 ===aa===
17358 ====aaa====
17359 !! end
17360
17361 !! test
17362 Section extraction test (section 2)
17363 !! options
17364 section=2
17365 !! wikitext
17366 start
17367 ==a==
17368 ===aa===
17369 ====aaa====
17370 ==b==
17371 ===ba===
17372 ===bb===
17373 ====bba====
17374 ===bc===
17375 ==c==
17376 ===ca===
17377 !! html/php
17378 ===aa===
17379 ====aaa====
17380 !! end
17381
17382 !! test
17383 Section extraction test (section 3)
17384 !! options
17385 section=3
17386 !! wikitext
17387 start
17388 ==a==
17389 ===aa===
17390 ====aaa====
17391 ==b==
17392 ===ba===
17393 ===bb===
17394 ====bba====
17395 ===bc===
17396 ==c==
17397 ===ca===
17398 !! html/php
17399 ====aaa====
17400 !! end
17401
17402 !! test
17403 Section extraction test (section 4)
17404 !! options
17405 section=4
17406 !! wikitext
17407 start
17408 ==a==
17409 ===aa===
17410 ====aaa====
17411 ==b==
17412 ===ba===
17413 ===bb===
17414 ====bba====
17415 ===bc===
17416 ==c==
17417 ===ca===
17418 !! html/php
17419 ==b==
17420 ===ba===
17421 ===bb===
17422 ====bba====
17423 ===bc===
17424 !! end
17425
17426 !! test
17427 Section extraction test (section 5)
17428 !! options
17429 section=5
17430 !! wikitext
17431 start
17432 ==a==
17433 ===aa===
17434 ====aaa====
17435 ==b==
17436 ===ba===
17437 ===bb===
17438 ====bba====
17439 ===bc===
17440 ==c==
17441 ===ca===
17442 !! html/php
17443 ===ba===
17444 !! end
17445
17446 !! test
17447 Section extraction test (section 6)
17448 !! options
17449 section=6
17450 !! wikitext
17451 start
17452 ==a==
17453 ===aa===
17454 ====aaa====
17455 ==b==
17456 ===ba===
17457 ===bb===
17458 ====bba====
17459 ===bc===
17460 ==c==
17461 ===ca===
17462 !! html/php
17463 ===bb===
17464 ====bba====
17465 !! end
17466
17467 !! test
17468 Section extraction test (section 7)
17469 !! options
17470 section=7
17471 !! wikitext
17472 start
17473 ==a==
17474 ===aa===
17475 ====aaa====
17476 ==b==
17477 ===ba===
17478 ===bb===
17479 ====bba====
17480 ===bc===
17481 ==c==
17482 ===ca===
17483 !! html/php
17484 ====bba====
17485 !! end
17486
17487 !! test
17488 Section extraction test (section 8)
17489 !! options
17490 section=8
17491 !! wikitext
17492 start
17493 ==a==
17494 ===aa===
17495 ====aaa====
17496 ==b==
17497 ===ba===
17498 ===bb===
17499 ====bba====
17500 ===bc===
17501 ==c==
17502 ===ca===
17503 !! html/php
17504 ===bc===
17505 !! end
17506
17507 !! test
17508 Section extraction test (section 9)
17509 !! options
17510 section=9
17511 !! wikitext
17512 start
17513 ==a==
17514 ===aa===
17515 ====aaa====
17516 ==b==
17517 ===ba===
17518 ===bb===
17519 ====bba====
17520 ===bc===
17521 ==c==
17522 ===ca===
17523 !! html/php
17524 ==c==
17525 ===ca===
17526 !! end
17527
17528 !! test
17529 Section extraction test (section 10)
17530 !! options
17531 section=10
17532 !! wikitext
17533 start
17534 ==a==
17535 ===aa===
17536 ====aaa====
17537 ==b==
17538 ===ba===
17539 ===bb===
17540 ====bba====
17541 ===bc===
17542 ==c==
17543 ===ca===
17544 !! html/php
17545 ===ca===
17546 !! end
17547
17548 !! test
17549 Section extraction test (nonexistent section 11)
17550 !! options
17551 section=11
17552 !! wikitext
17553 start
17554 ==a==
17555 ===aa===
17556 ====aaa====
17557 ==b==
17558 ===ba===
17559 ===bb===
17560 ====bba====
17561 ===bc===
17562 ==c==
17563 ===ca===
17564 !! html/php
17565 !! end
17566
17567 !! test
17568 Section extraction test with bogus heading (section 1)
17569 !! options
17570 section=1
17571 !! wikitext
17572 ==a==
17573 ==bogus== not a legal section
17574 ==b==
17575 !! html/php
17576 ==a==
17577 ==bogus== not a legal section
17578 !! end
17579
17580 !! test
17581 Section extraction test with bogus heading (section 2)
17582 !! options
17583 section=2
17584 !! wikitext
17585 ==a==
17586 ==bogus== not a legal section
17587 ==b==
17588 !! html/php
17589 ==b==
17590 !! end
17591
17592 !! test
17593 Section extraction test with comment after heading (section 1)
17594 !! options
17595 section=1
17596 !! wikitext
17597 ==a==
17598 ==b== <!-- -->
17599 ==c==
17600 !! html/php
17601 ==a==
17602 !! end
17603
17604 !! test
17605 Section extraction test with comment after heading (section 2)
17606 !! options
17607 section=2
17608 !! wikitext
17609 ==a==
17610 ==b== <!-- -->
17611 ==c==
17612 !! html/php
17613 ==b== <!-- -->
17614 !! end
17615
17616 !! test
17617 Section extraction test with bogus <nowiki> heading (section 1)
17618 !! options
17619 section=1
17620 !! wikitext
17621 ==a==
17622 ==bogus== <nowiki>not a legal section</nowiki>
17623 ==b==
17624 !! html/php
17625 ==a==
17626 ==bogus== <nowiki>not a legal section</nowiki>
17627 !! end
17628
17629 !! test
17630 Section extraction test with bogus <nowiki> heading (section 2)
17631 !! options
17632 section=2
17633 !! wikitext
17634 ==a==
17635 ==bogus== <nowiki>not a legal section</nowiki>
17636 ==b==
17637 !! html/php
17638 ==b==
17639 !! end
17640
17641 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
17642 # instead of respecting commented sections
17643 !! test
17644 Section extraction prefixed by comment (section 1)
17645 !! options
17646 section=1
17647 !! wikitext
17648 <!-- -->==sec1==
17649 ==sec2==
17650 !! html/php
17651 ==sec2==
17652 !!end
17653
17654 !! test
17655 Section extraction prefixed by comment (section 2)
17656 !! options
17657 section=2
17658 !! wikitext
17659 <!-- -->==sec1==
17660 ==sec2==
17661 !! html/php
17662
17663 !!end
17664
17665 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
17666 # instead of respecting HTML-style headings
17667 !! test
17668 Section extraction, mixed wiki and html (section 1)
17669 !! options
17670 section=1
17671 !! wikitext
17672 <h2>unmarked</h2>
17673 unmarked
17674 ==1==
17675 one
17676 ==2==
17677 two
17678 !! html/php
17679 ==1==
17680 one
17681 !! end
17682
17683 !! test
17684 Section extraction, mixed wiki and html (section 2)
17685 !! options
17686 section=2
17687 !! wikitext
17688 <h2>unmarked</h2>
17689 unmarked
17690 ==1==
17691 one
17692 ==2==
17693 two
17694 !! html/php
17695 ==2==
17696 two
17697 !! end
17698
17699
17700 # Formerly testing for bug 3342
17701 !! test
17702 Section extraction, heading surrounded by <noinclude>
17703 !! options
17704 section=1
17705 !! wikitext
17706 <noinclude>==unmarked==</noinclude>
17707 ==marked==
17708 !! html/php
17709 ==marked==
17710 !!end
17711
17712 # Test behavior of bug 19910
17713 !! test
17714 Sectiion with all-equals
17715 !! options
17716 section=2
17717 !! wikitext
17718 ===
17719 The line above must have a trailing space
17720 === <!--
17721 --> <!-- -->
17722 But just in case it doesn't...
17723 !! html/php
17724 === <!--
17725 --> <!-- -->
17726 But just in case it doesn't...
17727 !! end
17728
17729 !! test
17730 Section replacement test (section 0)
17731 !! options
17732 replace=0,"xxx"
17733 !! wikitext
17734 start
17735 ==a==
17736 ===aa===
17737 ====aaa====
17738 ==b==
17739 ===ba===
17740 ===bb===
17741 ====bba====
17742 ===bc===
17743 ==c==
17744 ===ca===
17745 !! html/php
17746 xxx
17747
17748 ==a==
17749 ===aa===
17750 ====aaa====
17751 ==b==
17752 ===ba===
17753 ===bb===
17754 ====bba====
17755 ===bc===
17756 ==c==
17757 ===ca===
17758 !! end
17759
17760 !! test
17761 Section replacement test (section 1)
17762 !! options
17763 replace=1,"xxx"
17764 !! wikitext
17765 start
17766 ==a==
17767 ===aa===
17768 ====aaa====
17769 ==b==
17770 ===ba===
17771 ===bb===
17772 ====bba====
17773 ===bc===
17774 ==c==
17775 ===ca===
17776 !! html/php
17777 start
17778 xxx
17779
17780 ==b==
17781 ===ba===
17782 ===bb===
17783 ====bba====
17784 ===bc===
17785 ==c==
17786 ===ca===
17787 !! end
17788
17789 !! test
17790 Section replacement test (section 2)
17791 !! options
17792 replace=2,"xxx"
17793 !! wikitext
17794 start
17795 ==a==
17796 ===aa===
17797 ====aaa====
17798 ==b==
17799 ===ba===
17800 ===bb===
17801 ====bba====
17802 ===bc===
17803 ==c==
17804 ===ca===
17805 !! html/php
17806 start
17807 ==a==
17808 xxx
17809
17810 ==b==
17811 ===ba===
17812 ===bb===
17813 ====bba====
17814 ===bc===
17815 ==c==
17816 ===ca===
17817 !! end
17818
17819 !! test
17820 Section replacement test (section 3)
17821 !! options
17822 replace=3,"xxx"
17823 !! wikitext
17824 start
17825 ==a==
17826 ===aa===
17827 ====aaa====
17828 ==b==
17829 ===ba===
17830 ===bb===
17831 ====bba====
17832 ===bc===
17833 ==c==
17834 ===ca===
17835 !! html/php
17836 start
17837 ==a==
17838 ===aa===
17839 xxx
17840
17841 ==b==
17842 ===ba===
17843 ===bb===
17844 ====bba====
17845 ===bc===
17846 ==c==
17847 ===ca===
17848 !! end
17849
17850 !! test
17851 Section replacement test (section 4)
17852 !! options
17853 replace=4,"xxx"
17854 !! wikitext
17855 start
17856 ==a==
17857 ===aa===
17858 ====aaa====
17859 ==b==
17860 ===ba===
17861 ===bb===
17862 ====bba====
17863 ===bc===
17864 ==c==
17865 ===ca===
17866 !! html/php
17867 start
17868 ==a==
17869 ===aa===
17870 ====aaa====
17871 xxx
17872
17873 ==c==
17874 ===ca===
17875 !! end
17876
17877 !! test
17878 Section replacement test (section 5)
17879 !! options
17880 replace=5,"xxx"
17881 !! wikitext
17882 start
17883 ==a==
17884 ===aa===
17885 ====aaa====
17886 ==b==
17887 ===ba===
17888 ===bb===
17889 ====bba====
17890 ===bc===
17891 ==c==
17892 ===ca===
17893 !! html/php
17894 start
17895 ==a==
17896 ===aa===
17897 ====aaa====
17898 ==b==
17899 xxx
17900
17901 ===bb===
17902 ====bba====
17903 ===bc===
17904 ==c==
17905 ===ca===
17906 !! end
17907
17908 !! test
17909 Section replacement test (section 6)
17910 !! options
17911 replace=6,"xxx"
17912 !! wikitext
17913 start
17914 ==a==
17915 ===aa===
17916 ====aaa====
17917 ==b==
17918 ===ba===
17919 ===bb===
17920 ====bba====
17921 ===bc===
17922 ==c==
17923 ===ca===
17924 !! html/php
17925 start
17926 ==a==
17927 ===aa===
17928 ====aaa====
17929 ==b==
17930 ===ba===
17931 xxx
17932
17933 ===bc===
17934 ==c==
17935 ===ca===
17936 !! end
17937
17938 !! test
17939 Section replacement test (section 7)
17940 !! options
17941 replace=7,"xxx"
17942 !! wikitext
17943 start
17944 ==a==
17945 ===aa===
17946 ====aaa====
17947 ==b==
17948 ===ba===
17949 ===bb===
17950 ====bba====
17951 ===bc===
17952 ==c==
17953 ===ca===
17954 !! html/php
17955 start
17956 ==a==
17957 ===aa===
17958 ====aaa====
17959 ==b==
17960 ===ba===
17961 ===bb===
17962 xxx
17963
17964 ===bc===
17965 ==c==
17966 ===ca===
17967 !! end
17968
17969 !! test
17970 Section replacement test (section 8)
17971 !! options
17972 replace=8,"xxx"
17973 !! wikitext
17974 start
17975 ==a==
17976 ===aa===
17977 ====aaa====
17978 ==b==
17979 ===ba===
17980 ===bb===
17981 ====bba====
17982 ===bc===
17983 ==c==
17984 ===ca===
17985 !! html/php
17986 start
17987 ==a==
17988 ===aa===
17989 ====aaa====
17990 ==b==
17991 ===ba===
17992 ===bb===
17993 ====bba====
17994 xxx
17995
17996 ==c==
17997 ===ca===
17998 !!end
17999
18000 !! test
18001 Section replacement test (section 9)
18002 !! options
18003 replace=9,"xxx"
18004 !! wikitext
18005 start
18006 ==a==
18007 ===aa===
18008 ====aaa====
18009 ==b==
18010 ===ba===
18011 ===bb===
18012 ====bba====
18013 ===bc===
18014 ==c==
18015 ===ca===
18016 !! html/php
18017 start
18018 ==a==
18019 ===aa===
18020 ====aaa====
18021 ==b==
18022 ===ba===
18023 ===bb===
18024 ====bba====
18025 ===bc===
18026 xxx
18027 !! end
18028
18029 !! test
18030 Section replacement test (section 10)
18031 !! options
18032 replace=10,"xxx"
18033 !! wikitext
18034 start
18035 ==a==
18036 ===aa===
18037 ====aaa====
18038 ==b==
18039 ===ba===
18040 ===bb===
18041 ====bba====
18042 ===bc===
18043 ==c==
18044 ===ca===
18045 !! html/php
18046 start
18047 ==a==
18048 ===aa===
18049 ====aaa====
18050 ==b==
18051 ===ba===
18052 ===bb===
18053 ====bba====
18054 ===bc===
18055 ==c==
18056 xxx
18057 !! end
18058
18059 !! test
18060 Section replacement test with initial whitespace (bug 13728)
18061 !! options
18062 replace=2,"xxx"
18063 !! wikitext
18064 Preformatted initial line
18065 ==a==
18066 ===a===
18067 !! html/php
18068 Preformatted initial line
18069 ==a==
18070 xxx
18071 !! end
18072
18073
18074 !! test
18075 Section extraction, heading followed by pre with 20 spaces (bug 6398)
18076 !! options
18077 section=1
18078 !! wikitext
18079 ==a==
18080 a
18081 !! html/php
18082 ==a==
18083 a
18084 !! end
18085
18086 !! test
18087 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
18088 !! options
18089 section=1
18090 !! wikitext
18091 ==a==
18092 a
18093 !! html/php
18094 ==a==
18095 a
18096 !! end
18097
18098
18099 !! test
18100 Section extraction, <pre> around bogus header (bug 10309)
18101 !! options
18102 noxml section=2
18103 !! wikitext
18104 == Section One ==
18105 <pre>
18106 =======
18107 </pre>
18108
18109 == Section Two ==
18110 stuff
18111 !! html/php
18112 == Section Two ==
18113 stuff
18114 !! end
18115
18116 !! test
18117 Section replacement, <pre> around bogus header (bug 10309)
18118 !! options
18119 noxml replace=2,"xxx"
18120 !! wikitext
18121 == Section One ==
18122 <pre>
18123 =======
18124 </pre>
18125
18126 == Section Two ==
18127 stuff
18128 !! html/php
18129 == Section One ==
18130 <pre>
18131 =======
18132 </pre>
18133
18134 xxx
18135 !! end
18136
18137
18138 !! test
18139 Handling of &#x0A; in URLs
18140 !! wikitext
18141 ** irc://&#x0A;a
18142 !! html/php
18143 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18144
18145 !! html/parsoid
18146 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
18147 a">irc://
18148 a</a></li></ul></li></ul>
18149 !! end
18150
18151 !! test
18152 Handling of %0A in URLs
18153 !! wikitext
18154 ** irc://%0Aa
18155 !! html/php
18156 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18157
18158 !! html/parsoid
18159 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18160 !! end
18161
18162
18163 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18164 !! test
18165 5 quotes, code coverage +1 line
18166 !! options
18167 parsoid=wt2html
18168 !! wikitext
18169 '''''
18170 !! html/php
18171 !! html/parsoid
18172 <p><b><i></i></b></p>
18173 !! end
18174
18175 # same html as previous, but wikitext adjusted to match parsoid html2wt
18176 # note that wt2html and html2html will put the <i> before the <b>
18177 !! test
18178 5 quotes, code coverage +1 line w/ nowiki (1)
18179 !! options
18180 parsoid=wt2wt,html2wt
18181 !! wikitext
18182 '''''<nowiki/>'''''
18183 !! html/php
18184 <p><i></i>
18185 </p>
18186 !! html/parsoid
18187 <p><b><i></i></b></p>
18188 !! end
18189
18190 # same as previous, just swapping the <i> and <b>
18191 !! test
18192 5 quotes, code coverage +1 line w/ nowiki (2)
18193 !! wikitext
18194 '''''<nowiki/>'''''
18195 !! html/php
18196 <p><i></i>
18197 </p>
18198 !! html/parsoid
18199 <p><i><b></b></i></p>
18200 !! end
18201
18202 !! test
18203 Special:Search page linking.
18204 !! wikitext
18205 {{Special:search}}
18206 !! html
18207 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18208 </p>
18209 !! end
18210
18211 !! test
18212 {{!}} is a magic word
18213 !! wikitext
18214 {{!}} is a magic word there and {{!}} is still a magic word here
18215 | is not a magic word here but {{!}} is still a magic word here
18216 !! html/php
18217 <p>| is a magic word there and | is still a magic word here
18218 | is not a magic word here but | is still a magic word here
18219 </p>
18220 !! html/parsoid
18221 <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
18222 | 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>
18223
18224 !! end
18225
18226 !! test
18227 Say the magic word
18228 !! options
18229 title=[[Parser test]]
18230 !! wikitext
18231 * {{PAGENAME}}
18232 * {{PAGENAMEE}}
18233 * {{FULLPAGENAME}}
18234 * {{FULLPAGENAMEE}}
18235 * {{BASEPAGENAME}}
18236 * {{BASEPAGENAMEE}}
18237 * {{SUBPAGENAME}}
18238 * {{SUBPAGENAMEE}}
18239 * {{ROOTPAGENAME}}
18240 * {{ROOTPAGENAMEE}}
18241 * {{TALKPAGENAME}}
18242 * {{TALKPAGENAMEE}}
18243 * {{SUBJECTPAGENAME}}
18244 * {{SUBJECTPAGENAMEE}}
18245 * {{NAMESPACEE}}
18246 * {{NAMESPACE}}
18247 * {{NAMESPACENUMBER}}
18248 * {{TALKSPACE}}
18249 * {{TALKSPACEE}}
18250 * {{SUBJECTSPACE}}
18251 * {{SUBJECTSPACEE}}
18252 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18253 !! html
18254 <ul><li> Parser test</li>
18255 <li> Parser_test</li>
18256 <li> Parser test</li>
18257 <li> Parser_test</li>
18258 <li> Parser test</li>
18259 <li> Parser_test</li>
18260 <li> Parser test</li>
18261 <li> Parser_test</li>
18262 <li> Parser test</li>
18263 <li> Parser_test</li>
18264 <li> Talk:Parser test</li>
18265 <li> Talk:Parser_test</li>
18266 <li> Parser test</li>
18267 <li> Parser_test</li>
18268 <li> </li>
18269 <li> </li>
18270 <li> 0</li>
18271 <li> Talk</li>
18272 <li> Talk</li>
18273 <li> </li>
18274 <li> </li>
18275 <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>
18276
18277 !! end
18278 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18279
18280 !! test
18281 Gallery
18282 !! wikitext
18283 <gallery>
18284 image1.png |
18285 image2.gif|||||
18286
18287 image3|
18288 image4 |300px| centre
18289 image5.svg| http://///////
18290 [[x|xx]]]]
18291 * image6
18292 </gallery>
18293 !! html
18294 <ul class="gallery mw-gallery-traditional">
18295 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18296 <div class="thumb" style="height: 150px;">Image1.png</div>
18297 <div class="gallerytext">
18298 </div>
18299 </div></li>
18300 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18301 <div class="thumb" style="height: 150px;">Image2.gif</div>
18302 <div class="gallerytext">
18303 </div>
18304 </div></li>
18305 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18306 <div class="thumb" style="height: 150px;">Image3</div>
18307 <div class="gallerytext">
18308 </div>
18309 </div></li>
18310 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18311 <div class="thumb" style="height: 150px;">Image4</div>
18312 <div class="gallerytext">
18313 <pre>centre
18314 </pre>
18315 </div>
18316 </div></li>
18317 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18318 <div class="thumb" style="height: 150px;">Image5.svg</div>
18319 <div class="gallerytext">
18320 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
18321 </p>
18322 </div>
18323 </div></li>
18324 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18325 <div class="thumb" style="height: 150px;">* image6</div>
18326 <div class="gallerytext">
18327 </div>
18328 </div></li>
18329 </ul>
18330
18331 !! end
18332
18333 !! test
18334 Gallery (with options)
18335 !! wikitext
18336 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
18337 File:Nonexistent.jpg|caption
18338 File:Nonexistent.jpg
18339 image:foobar.jpg|some '''caption''' [[Main Page]]
18340 image:foobar.jpg
18341 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
18342 </gallery>
18343 !! html
18344 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
18345 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
18346 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18347 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18348 <div class="gallerytext">
18349 <p>caption
18350 </p>
18351 </div>
18352 </div></li>
18353 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18354 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18355 <div class="gallerytext">
18356 </div>
18357 </div></li>
18358 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18359 <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>
18360 <div class="gallerytext">
18361 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18362 </p>
18363 </div>
18364 </div></li>
18365 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18366 <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>
18367 <div class="gallerytext">
18368 </div>
18369 </div></li>
18370 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18371 <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>
18372 <div class="gallerytext">
18373 <p>blabla.
18374 </p>
18375 </div>
18376 </div></li>
18377 </ul>
18378
18379 !! end
18380
18381 !! test
18382 Gallery with link that has fragment
18383 !! wikitext
18384 <gallery>
18385 image:foobar.jpg|link=Main_Page
18386 image:foobar.jpg|link=Main_Page#section
18387 image:foobar.jpg|link=Main Page#section|caption
18388 </gallery>
18389 !! html
18390 <ul class="gallery mw-gallery-traditional">
18391 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18392 <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>
18393 <div class="gallerytext">
18394 </div>
18395 </div></li>
18396 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18397 <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>
18398 <div class="gallerytext">
18399 </div>
18400 </div></li>
18401 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18402 <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>
18403 <div class="gallerytext">
18404 <p>caption
18405 </p>
18406 </div>
18407 </div></li>
18408 </ul>
18409
18410 !! end
18411
18412 !! test
18413 Gallery with wikitext inside caption
18414 !! wikitext
18415 <gallery>
18416 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
18417 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
18418 </gallery>
18419 !! html
18420 <ul class="gallery mw-gallery-traditional">
18421 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18422 <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>
18423 <div class="gallerytext">
18424 <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>
18425 </p>
18426 </div>
18427 </div></li>
18428 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18429 <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>
18430 <div class="gallerytext">
18431 <p>This is a test template
18432 </p>
18433 </div>
18434 </div></li>
18435 </ul>
18436
18437 !! end
18438
18439 !! test
18440 gallery (with showfilename option)
18441 !! wikitext
18442 <gallery showfilename>
18443 File:Nonexistent.jpg|caption
18444 File:Nonexistent.jpg
18445 image:foobar.jpg|some '''caption''' [[Main Page]]
18446 File:Foobar.jpg
18447 </gallery>
18448 !! html
18449 <ul class="gallery mw-gallery-traditional">
18450 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18451 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18452 <div class="gallerytext">
18453 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18454 caption
18455 </p>
18456 </div>
18457 </div></li>
18458 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18459 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18460 <div class="gallerytext">
18461 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18462 </p>
18463 </div>
18464 </div></li>
18465 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18466 <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>
18467 <div class="gallerytext">
18468 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18469 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18470 </p>
18471 </div>
18472 </div></li>
18473 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18474 <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>
18475 <div class="gallerytext">
18476 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18477 </p>
18478 </div>
18479 </div></li>
18480 </ul>
18481
18482 !! end
18483
18484 !! test
18485 Gallery (with namespace-less filenames)
18486 !! wikitext
18487 <gallery>
18488 File:Nonexistent.jpg
18489 Nonexistent.jpg
18490 image:foobar.jpg
18491 foobar.jpg
18492 </gallery>
18493 !! html
18494 <ul class="gallery mw-gallery-traditional">
18495 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18496 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18497 <div class="gallerytext">
18498 </div>
18499 </div></li>
18500 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18501 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18502 <div class="gallerytext">
18503 </div>
18504 </div></li>
18505 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18506 <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>
18507 <div class="gallerytext">
18508 </div>
18509 </div></li>
18510 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18511 <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>
18512 <div class="gallerytext">
18513 </div>
18514 </div></li>
18515 </ul>
18516
18517 !! end
18518
18519 !! test
18520 HTML Hex character encoding (spells the word "JavaScript")
18521 !! options
18522 parsoid=wt2html,wt2wt,html2html
18523 !! wikitext
18524 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
18525 !! html/php
18526 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
18527 </p>
18528 !! html/php+tidy
18529 <p>JavaScript</p>
18530 !! html/parsoid
18531 <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>
18532 !! end
18533
18534 !! test
18535 HTML Hex character encoding bogus encoding (bug 26437 regression check)
18536 !! wikitext
18537 &#xsee;&#XSEE;
18538 !! html/php
18539 <p>&amp;#xsee;&amp;#XSEE;
18540 </p>
18541 !! html/parsoid
18542 <p>&amp;#xsee;&amp;#XSEE;</p>
18543 !! end
18544
18545 !! test
18546 HTML Hex character encoding mixed case
18547 !! options
18548 parsoid=wt2html,wt2wt,html2html
18549 !! wikitext
18550 &#xEE;&#Xee;
18551 !! html/php
18552 <p>&#xee;&#xee;
18553 </p>
18554 !! html/php+tidy
18555 <p>îî</p>
18556 !! html/parsoid
18557 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
18558 !! end
18559
18560 # See: http://www.w3.org/TR/html5/syntax.html#character-references
18561 # Note that U+000C (form feed) is not a valid XML character, so
18562 # it is banned even though allowed in HTML5.
18563 !! test
18564 Illegal character references (T106578)
18565 !! wikitext
18566 ; Null: &#00;
18567 ; FF: &#xC;
18568 ; CR: &#xD;
18569 ; Control (low): &#8;
18570 ; Control (high): &#x7F; &#x9F;
18571 ; Surrogate: &#xD83D;&#xDCA9;
18572 ; This is an okay astral character: &#x1F4A9;
18573 !! html+tidy
18574 <dl>
18575 <dt>Null</dt>
18576 <dd>&amp;#00;</dd>
18577 <dt>FF</dt>
18578 <dd>&amp;#xC;</dd>
18579 <dt>CR</dt>
18580 <dd>&amp;#xD;</dd>
18581 <dt>Control (low)</dt>
18582 <dd>&amp;#8;</dd>
18583 <dt>Control (high)</dt>
18584 <dd>&amp;#x7F; &amp;#x9F;</dd>
18585 <dt>Surrogate</dt>
18586 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
18587 <dt>This is an okay astral character</dt>
18588 <dd>💩</dd>
18589 </dl>
18590 !! end
18591
18592 !! test
18593 __FORCETOC__ override
18594 !! wikitext
18595 __NEWSECTIONLINK__
18596 __FORCETOC__
18597 !! html/php
18598 <p><br />
18599 </p>
18600 !! end
18601
18602 !! test
18603 ISBN code coverage
18604 !! wikitext
18605 ISBN 978-0-1234-56&#x20;789
18606 !! html
18607 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
18608 </p>
18609 !! html+tidy
18610 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
18611 !! html/parsoid
18612 <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>
18613 !! end
18614
18615 !! test
18616 ISBN followed by 5 spaces
18617 !! wikitext
18618 ISBN
18619 !! html
18620 <p>ISBN
18621 </p>
18622 !! end
18623
18624 !! test
18625 Double ISBN
18626 !! wikitext
18627 ISBN ISBN 1234567890
18628 !! html/php
18629 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18630 </p>
18631 !! html/parsoid
18632 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
18633 !! end
18634
18635 # Uppercase X and lowercase x as well
18636 !! test
18637 ISBN with an X
18638 !! wikitext
18639 ISBN 3-462-04561-X
18640 ISBN 3-462-04561-x
18641 ISBN 080442957X
18642 ISBN 080442957x
18643 ISBN 978080442957X
18644 ISBN 978080442957x
18645 !! html/php
18646 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
18647 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
18648 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
18649 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
18650 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
18651 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
18652 </p>
18653 !! html/parsoid
18654 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
18655 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
18656 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
18657 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
18658 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
18659 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
18660 !! end
18661
18662 !! test
18663 ISBN with empty prefix (parsoid test)
18664 !! wikitext
18665 ISBN 1234567890
18666 !! html/php
18667 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18668 </p>
18669 !! html/parsoid
18670 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
18671 !! end
18672
18673 !! test
18674 Bug 22905: <abbr> followed by ISBN followed by </a>
18675 !! wikitext
18676 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
18677 !! html/php
18678 <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>
18679 </p>
18680 !! html/parsoid
18681 <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>
18682 !! end
18683
18684 !! test
18685 Double RFC
18686 !! wikitext
18687 RFC RFC 1234
18688 !! html
18689 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
18690 </p>
18691 !! end
18692
18693 !! test
18694 Double RFC with a wiki link
18695 !! wikitext
18696 RFC [[RFC 1234]]
18697 !! html
18698 <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>
18699 </p>
18700 !! end
18701
18702 !! test
18703 RFC code coverage
18704 !! wikitext
18705 RFC 983&#x20;987
18706 !! html
18707 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
18708 </p>
18709 !! html+tidy
18710 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
18711 !! end
18712
18713 !! test
18714 Centre-aligned image
18715 !! wikitext
18716 [[Image:foobar.jpg|centre]]
18717 !! html
18718 <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>
18719
18720 !!end
18721
18722 !! test
18723 None-aligned image
18724 !! wikitext
18725 [[Image:foobar.jpg|none]]
18726 !! html
18727 <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>
18728
18729 !!end
18730
18731 !! test
18732 Width + Height sized image (using px) (height is ignored)
18733 !! wikitext
18734 [[Image:foobar.jpg|640x480px]]
18735 !! html
18736 <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>
18737 </p>
18738 !!end
18739
18740 !! test
18741 Width-sized image (using px, no following whitespace)
18742 !! wikitext
18743 [[Image:foobar.jpg|640px]]
18744 !! html
18745 <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>
18746 </p>
18747 !!end
18748
18749 !! test
18750 Width-sized image (using px, with following whitespace - test regression from r39467)
18751 !! wikitext
18752 [[Image:foobar.jpg|640px ]]
18753 !! html
18754 <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>
18755 </p>
18756 !!end
18757
18758 !! test
18759 Width-sized image (using px, with preceding whitespace - test regression from r39467)
18760 !! wikitext
18761 [[Image:foobar.jpg| 640px]]
18762 !! html
18763 <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>
18764 </p>
18765 !!end
18766
18767 !! test
18768 Image with page parameter
18769 !! options
18770 djvu
18771 !! wikitext
18772 [[File:LoremIpsum.djvu|page=2]]
18773 !! html/php
18774 <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>
18775 </p>
18776 !! html/parsoid
18777 <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>
18778 !! end
18779
18780 !! test
18781 Another italics / bold test
18782 !! wikitext
18783 ''' ''x'
18784 !! html
18785 <pre>'<i> </i>x'
18786 </pre>
18787 !!end
18788
18789 # FIXME: The php output seems broken. It's interleaving some open/close tags.
18790 !! test
18791 dt/dd/dl test
18792 !! wikitext
18793 :;;;::
18794 !! html/php
18795 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
18796
18797 !! html/parsoid
18798 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
18799
18800 !!end
18801
18802
18803 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
18804 !! test
18805 Images with the "|" character in the comment
18806 !! wikitext
18807 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
18808 !! html/php
18809 <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>
18810
18811 !! html/parsoid
18812 <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>
18813 !! end
18814
18815 !! test
18816 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
18817 !! wikitext
18818 <html><script>alert(1);</script></html>
18819 !! html
18820 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
18821 </p>
18822 !! end
18823
18824 !! test
18825 HTML with raw HTML ($wgRawHtml==true)
18826 !! options
18827 wgRawHtml=1
18828 !! wikitext
18829 <html><script>alert(1);</script></html>
18830 !! html
18831 <p><script>alert(1);</script>
18832 </p>
18833 !! end
18834
18835 !! test
18836 Parents of subpages, one level up
18837 !! options
18838 subpage title=[[Subpage test/L1/L2/L3]]
18839 !! wikitext
18840 [[../|L2]]
18841 !! html
18842 <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>
18843 </p>
18844 !! end
18845
18846
18847 !! test
18848 Parents of subpages, one level up, not named
18849 !! options
18850 subpage title=[[Subpage test/L1/L2/L3]]
18851 !! wikitext
18852 [[../]]
18853 !! html
18854 <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>
18855 </p>
18856 !! end
18857
18858
18859
18860 !! test
18861 Parents of subpages, two levels up
18862 !! options
18863 subpage title=[[Subpage test/L1/L2/L3]]
18864 !! wikitext
18865 [[../../|L1]]2
18866
18867 [[../../|L1]]l
18868 !! html
18869 <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
18870 </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>
18871 </p>
18872 !! end
18873
18874 !! test
18875 Parents of subpages, two levels up, without trailing slash or name.
18876 !! options
18877 subpage title=[[Subpage test/L1/L2/L3]]
18878 !! wikitext
18879 [[../..]]
18880 !! html
18881 <p>[[../..]]
18882 </p>
18883 !! end
18884
18885 !! test
18886 Parents of subpages, two levels up, with lots of extra trailing slashes.
18887 !! options
18888 subpage title=[[Subpage test/L1/L2/L3]]
18889 !! wikitext
18890 [[../../////]]
18891 !! html
18892 <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>
18893 </p>
18894 !! end
18895
18896 !! article
18897 Subpage test/L1/L2/L3Sibling
18898 !! text
18899 Sibling article
18900 !! endarticle
18901
18902 !! test
18903 Transclusion of a sibling page (one level up)
18904 !! options
18905 subpage title=[[Subpage test/L1/L2/L3]]
18906 !! wikitext
18907 {{../L3Sibling}}
18908 !! html
18909 <p>Sibling article
18910 </p>
18911 !! end
18912
18913 !! test
18914 Transclusion of a child page
18915 !! options
18916 subpage title=[[Subpage test/L1/L2]]
18917 !! wikitext
18918 {{/L3Sibling}}
18919 !! html
18920 <p>Sibling article
18921 </p>
18922 !! end
18923
18924 !! test
18925 Non-transclusion because of too many up levels
18926 !! options
18927 subpage title=[[Subpage test/L1/L2/L3]]
18928 !! wikitext
18929 {{../../../../More than parent}}
18930 !! html
18931 <p>{{../../../../More than parent}}
18932 </p>
18933 !! end
18934
18935 !! test
18936 Definition list code coverage
18937 !! wikitext
18938 ; title : def
18939 ; title : def
18940 ;title: def
18941 !! html/php
18942 <dl><dt> title &#160;</dt>
18943 <dd> def</dd>
18944 <dt> title&#160;</dt>
18945 <dd> def</dd>
18946 <dt>title</dt>
18947 <dd> def</dd></dl>
18948
18949 !! html/parsoid
18950 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18951 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18952 <dt>title</dt><dd> def</dd></dl>
18953 !! end
18954
18955 !! test
18956 Don't fall for the self-closing div
18957 !! wikitext
18958 <div>hello world</div/>
18959 !! html
18960 <div>hello world</div>
18961
18962 !! end
18963
18964 !! test
18965 MSGNW magic word
18966 !! wikitext
18967 {{MSGNW:msg}}
18968 !! html/php
18969 <p>&#91;&#91;:Template:Msg&#93;&#93;
18970 </p>
18971 !! end
18972
18973 !! test
18974 RAW magic word
18975 !! wikitext
18976 {{RAW:QUERTY}}
18977 !! html
18978 <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>
18979 </p>
18980 !! end
18981
18982 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
18983 !! test
18984 Always escape literal '>' in output, not just after '<'
18985 !! wikitext
18986 ><>
18987 !! html
18988 <p>&gt;&lt;&gt;
18989 </p>
18990 !! end
18991
18992 !! test
18993 Template caching
18994 !! wikitext
18995 {{Test}}
18996 {{Test}}
18997 !! html
18998 <p>This is a test template
18999 This is a test template
19000 </p>
19001 !! end
19002
19003
19004 !! article
19005 MediaWiki:Fake
19006 !! text
19007 ==header==
19008 !! endarticle
19009
19010 !! test
19011 Inclusion of !userCanEdit() content
19012 !! wikitext
19013 {{MediaWiki:Fake}}
19014 !! html
19015 <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>
19016
19017 !! end
19018
19019
19020 !! test
19021 Out-of-order TOC heading levels
19022 !! wikitext
19023 ==2==
19024 ======6======
19025 ===3===
19026 =1=
19027 =====5=====
19028 ==2==
19029 !! html
19030 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19031 <ul>
19032 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
19033 <ul>
19034 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
19035 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
19036 </ul>
19037 </li>
19038 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
19039 <ul>
19040 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
19041 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
19042 </ul>
19043 </li>
19044 </ul>
19045 </div>
19046
19047 <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>
19048 <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>
19049 <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>
19050 <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>
19051 <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>
19052 <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>
19053
19054 !! end
19055
19056
19057 !! test
19058 ISBN with a dummy number
19059 !! wikitext
19060 ISBN ---
19061 !! html
19062 <p>ISBN ---
19063 </p>
19064 !! end
19065
19066
19067 !! test
19068 ISBN with space-delimited number
19069 !! wikitext
19070 ISBN 92 9017 032 8
19071 !! html
19072 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
19073 </p>
19074 !! end
19075
19076
19077 !! test
19078 ISBN with multiple spaces, no number
19079 !! wikitext
19080 ISBN foo
19081 !! html
19082 <p>ISBN foo
19083 </p>
19084 !! end
19085
19086
19087 !! test
19088 ISBN length
19089 !! wikitext
19090 ISBN 123456789
19091
19092 ISBN 1234567890
19093
19094 ISBN 12345678901
19095 !! html
19096 <p>ISBN 123456789
19097 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19098 </p><p>ISBN 12345678901
19099 </p>
19100 !! end
19101
19102
19103 !! test
19104 ISBN with trailing year (bug 8110)
19105 !! wikitext
19106 ISBN 1-234-56789-0 - 2006
19107
19108 ISBN 1 234 56789 0 - 2006
19109 !! html
19110 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
19111 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
19112 </p>
19113 !! end
19114
19115
19116 !! test
19117 anchorencode
19118 !! wikitext
19119 {{anchorencode:foo bar©#%n}}
19120 !! html
19121 <p>foo_bar.C2.A9.23.25n
19122 </p>
19123 !! end
19124
19125 !! test
19126 anchorencode trims spaces
19127 !! wikitext
19128 {{anchorencode: __pretty__please__}}
19129 !! html
19130 <p>pretty_please
19131 </p>
19132 !! end
19133
19134 !! test
19135 anchorencode deals with links
19136 !! wikitext
19137 {{anchorencode: [[hello|world]] [[hi]]}}
19138 !! html
19139 <p>world_hi
19140 </p>
19141 !! end
19142
19143 !! test
19144 anchorencode deals with templates
19145 !! wikitext
19146 {{anchorencode: {{Foo}} }}
19147 !! html
19148 <p>FOO
19149 </p>
19150 !! end
19151
19152 !! test
19153 anchorencode encodes like the TOC generator: (bug 18431)
19154 !! wikitext
19155 === _ +:.3A%3A&&amp;]] ===
19156 {{anchorencode: _ +:.3A%3A&&amp;]] }}
19157 __NOEDITSECTION__
19158 !! html
19159 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
19160 <p>.2B:.3A.253A.26.26.5D.5D
19161 </p>
19162 !! end
19163
19164 !! test
19165 Bug 6200: blockquotes and paragraph formatting
19166 !! wikitext
19167 <blockquote>
19168 foo
19169 </blockquote>
19170
19171 bar
19172
19173 baz
19174 !! html
19175 <blockquote>
19176 <p>foo
19177 </p>
19178 </blockquote>
19179 <p>bar
19180 </p>
19181 <pre>baz
19182 </pre>
19183 !! end
19184
19185 !! test
19186 Bug 8293: Use of center tag ruins paragraph formatting
19187 !! wikitext
19188 <center>
19189 foo
19190 </center>
19191
19192 bar
19193
19194 baz
19195 !! html
19196 <center>
19197 <p>foo
19198 </p>
19199 </center>
19200 <p>bar
19201 </p>
19202 <pre>baz
19203 </pre>
19204 !! end
19205
19206 !!test
19207 Parsing of overlapping (improperly nested) inline html tags
19208 !! wikitext
19209 <span><s>x</span></s>
19210 !! html/php
19211 <p><span><s>x&lt;/span&gt;</s></span>
19212 </p>
19213 !! html/parsoid
19214 <p><span><s>x</s></span>
19215 </p>
19216 !!end
19217
19218 ###
19219 ### Language variants related tests
19220 ###
19221 !! test
19222 Self-link in language variants
19223 !! options
19224 title=[[Dunav]] language=sr
19225 !! wikitext
19226 Both [[Dunav]] and [[Дунав]] are names for this river.
19227 !! html
19228 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
19229 </p>
19230 !!end
19231
19232 !! article
19233 Дуна
19234 !! text
19235 content
19236 !! endarticle
19237
19238 !! test
19239 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
19240 !! options
19241 title=[[Duna]] language=sr
19242 !! wikitext
19243 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
19244 !! html
19245 <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.
19246 </p>
19247 !! end
19248
19249 !! test
19250 Link to a section of a variant of this title shouldn't be parsed as self-link
19251 !! options
19252 title=[[Duna]] language=sr
19253 !! wikitext
19254 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
19255 !! html
19256 <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.
19257 </p>
19258 !! end
19259
19260 !! test
19261 Link to pages in language variants
19262 !! options
19263 language=sr
19264 !! wikitext
19265 Main Page can be written as [[Маин Паге]]
19266 !! html
19267 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
19268 </p>
19269 !!end
19270
19271
19272 !! test
19273 Multiple links to pages in language variants
19274 !! options
19275 language=sr
19276 !! wikitext
19277 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
19278 !! html
19279 <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>.
19280 </p>
19281 !!end
19282
19283
19284 !! test
19285 Simple template in language variants
19286 !! options
19287 language=sr
19288 !! wikitext
19289 {{тест}}
19290 !! html
19291 <p>This is a test template
19292 </p>
19293 !! end
19294
19295
19296 !! test
19297 Template with explicit namespace in language variants
19298 !! options
19299 language=sr
19300 !! wikitext
19301 {{Template:тест}}
19302 !! html
19303 <p>This is a test template
19304 </p>
19305 !! end
19306
19307
19308 !! test
19309 Basic test for template parameter in language variants
19310 !! options
19311 language=sr
19312 !! wikitext
19313 {{парамтест|param=foo}}
19314 !! html
19315 <p>This is a test template with parameter foo
19316 </p>
19317 !! end
19318
19319
19320 !! test
19321 Simple category in language variants
19322 !! options
19323 language=sr cat
19324 !! wikitext
19325 [[Category:МедиаWики Усер'с Гуиде]]
19326 !! html
19327 <a href="/wiki/%D0%9A%D0%B0%D1%82%D0%B5%D0%B3%D0%BE%D1%80%D0%B8%D1%98%D0%B0:MediaWiki_User%27s_Guide" title="Категорија:MediaWiki User's Guide">MediaWiki User's Guide</a>
19328 !! end
19329
19330
19331 !! article
19332 Category:分类
19333 !! text
19334 blah
19335 !! endarticle
19336
19337 !! article
19338 Category:分類
19339 !! text
19340 blah
19341 !! endarticle
19342
19343 ## We used to, but no longer wt2wt this test since the default serializer
19344 ## will normalize all categories to serialize on their own line.
19345 ## This wikitext usage is going to be fairly uncommon in production and
19346 ## selser will take care of preserving formatting in those scenarios.
19347 !! test
19348 Don't convert blue categorylinks to another variant (bug 33210)
19349 !! options
19350 cat
19351 language=zh
19352 parsoid=wt2html
19353 !! wikitext
19354 [[A]][[Category:分类]]
19355 !! html/php
19356 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
19357 !! html/parsoid
19358 <p><a rel="mw:WikiLink" href="A" title="A">A</a></p>
19359 <link rel="mw:PageProp/Category" href="Category:分类"/>
19360 !! end
19361
19362 !! test
19363 Stripping -{}- tags (language variants)
19364 !! options
19365 language=sr
19366 !! wikitext
19367 Latin proverb: -{Ne nuntium necare}-
19368 !! html
19369 <p>Latin proverb: Ne nuntium necare
19370 </p>
19371 !! end
19372
19373
19374 !! test
19375 Prevent conversion with -{}- tags (language variants)
19376 !! options
19377 language=sr variant=sr-ec
19378 !! wikitext
19379 Latinski: -{Ne nuntium necare}-
19380 !! html
19381 <p>Латински: Ne nuntium necare
19382 </p>
19383 !! end
19384
19385
19386 !! test
19387 Prevent conversion of text with -{}- tags (language variants)
19388 !! options
19389 language=sr variant=sr-ec
19390 !! wikitext
19391 Latinski: -{Ne nuntium necare}-
19392 !! html
19393 <p>Латински: Ne nuntium necare
19394 </p>
19395 !! end
19396
19397
19398 !! test
19399 Prevent conversion of links with -{}- tags (language variants)
19400 !! options
19401 language=sr variant=sr-ec
19402 !! wikitext
19403 -{[[Main Page]]}-
19404 !! html
19405 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19406 </p>
19407 !! end
19408
19409
19410 !! test
19411 -{}- tags within headlines (within html for parserConvert())
19412 !! options
19413 language=sr variant=sr-ec
19414 !! wikitext
19415 == -{Naslov}- ==
19416 !! html
19417 <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>
19418
19419 !! end
19420
19421
19422 !! test
19423 Explicit definition of language variant alternatives
19424 !! options
19425 language=zh variant=zh-tw
19426 !! wikitext
19427 -{zh:China;zh-tw:Taiwan}-, not China
19428 !! html
19429 <p>Taiwan, not China
19430 </p>
19431 !! end
19432
19433
19434 !! test
19435 Conversion around HTML tags
19436 !! options
19437 language=sr variant=sr-ec
19438 !! wikitext
19439 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
19440 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
19441 !! html
19442 <p>
19443 <span title="ЛаCтин">ски</span>
19444 </p>
19445 !! end
19446
19447
19448 !! test
19449 Explicit session-wise language variant mapping (A flag and - flag)
19450 !! options
19451 language=zh variant=zh-tw
19452 !! wikitext
19453 Taiwan is not China.
19454 But -{A|zh:China;zh-tw:Taiwan}- is China,
19455 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
19456 and -{China}- is China.
19457 !! html
19458 <p>Taiwan is not China.
19459 But Taiwan is Taiwan,
19460 (This should be stripped!)
19461 and China is China.
19462 </p>
19463 !! end
19464
19465 !! test
19466 Explicit session-wise language variant mapping (H flag for hide)
19467 !! options
19468 language=zh variant=zh-tw
19469 !! wikitext
19470 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
19471 Taiwan is China.
19472 !! html
19473 <p>(This should be stripped!)
19474 Taiwan is Taiwan.
19475 </p>
19476 !! end
19477
19478 !! test
19479 Adding explicit conversion rule for title (T flag)
19480 !! options
19481 language=zh variant=zh-tw showtitle
19482 !! wikitext
19483 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19484 !! html
19485 Taiwan
19486 <p>Should be stripped!
19487 </p>
19488 !! end
19489
19490 !! test
19491 Testing that changing the language variant here in the tests actually works
19492 !! options
19493 language=zh variant=zh showtitle
19494 !! wikitext
19495 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19496 !! html
19497 China
19498 <p>Should be stripped!
19499 </p>
19500 !! end
19501
19502 !! test
19503 Recursive conversion of alt and title attrs shouldn't clear converter state
19504 !! options
19505 language=zh variant=zh-cn showtitle
19506 !! wikitext
19507 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
19508 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
19509 !! html
19510 China
19511 <p>
19512 Should be stripped<span title="Exclamation">!</span>
19513 </p>
19514 !! end
19515
19516 !! test
19517 Bug 24072: more test on conversion rule for title
19518 !! options
19519 language=zh variant=zh-tw showtitle
19520 !! wikitext
19521 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19522 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
19523 !! html
19524 Taiwan
19525 <p>This should be stripped!
19526 This won't take interferes with the title rule.
19527 </p>
19528 !! end
19529
19530 !! test
19531 Partly disable title conversion if variant == main language code
19532 !! options
19533 language=zh variant=zh title=[[ZH]] showtitle
19534 !! wikitext
19535 -{T|zh-cn:CN;zh-tw:TW}-
19536 !! html
19537 ZH
19538 <p>
19539 </p>
19540 !! end
19541
19542 !! test
19543 Partly disable title conversion if variant == main language code, more
19544 !! options
19545 language=zh variant=zh title=[[ZH]] showtitle
19546 !! wikitext
19547 -{T|TW}-
19548 !! html
19549 ZH
19550 <p>
19551 </p>
19552 !! end
19553
19554 !! test
19555 Raw output of variant escape tags (R flag)
19556 !! options
19557 language=zh variant=zh-tw
19558 !! wikitext
19559 Raw: -{R|zh:China;zh-tw:Taiwan}-
19560 !! html
19561 <p>Raw: zh:China;zh-tw:Taiwan
19562 </p>
19563 !! end
19564
19565 !! test
19566 Strings evaluating false shouldn't be ignored by Language converter (T51072)
19567 !! options
19568 language=zh variant=zh-cn
19569 !! input
19570 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
19571 !! result
19572 <p>0
19573 </p>
19574 !! end
19575
19576 !! test
19577 Conversion rules from [numeric-only string] to [something else] (T48634)
19578 !! options
19579 language=zh variant=zh-cn
19580 !! input
19581 -{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
19582 !! result
19583 <p>D12345EE12345
19584 </p>
19585 !! end
19586
19587 !! test
19588 Bidirectional converter rule entries with an empty value should be ignored (T53551)
19589 !! options
19590 language=zh variant=zh-cn
19591 !! input
19592 -{H|zh-cn:foo;zh-tw:;}-foobar
19593 !! result
19594 <p>foobar
19595 </p>
19596 !! end
19597
19598 !! test
19599 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
19600 !! options
19601 language=zh variant=zh-cn
19602 !! input
19603 -{H|=>zh-cn:foo;}-foobar
19604 !! result
19605 <p>foobar
19606 </p>
19607 !! end
19608
19609 !! test
19610 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
19611 !! options
19612 language=zh variant=zh-cn
19613 !! input
19614 -{H|}-foobar
19615 !! result
19616 <p>foobar
19617 </p>
19618 !! end
19619
19620 !! test
19621 Nested using of manual convert syntax
19622 !! options
19623 language=zh variant=zh-hk
19624 !! wikitext
19625 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
19626 !! html
19627 <p>Nested: Hello Hong Kong!
19628 </p>
19629 !! end
19630
19631 !! test
19632 Proper conversion of text in external links
19633 !! options
19634 language=sr variant=sr-ec
19635 !! wikitext
19636 http://www.google.com
19637 gopher://www.google.com
19638 [http://www.google.com http://www.google.com]
19639 [gopher://www.google.com gopher://www.google.com]
19640 [https://www.google.com irc://www.google.com]
19641 [ftp://www.google.com www.google.com/ftp://dir]
19642 [//www.google.com www.google.com]
19643 !! html
19644 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19645 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19646 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19647 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19648 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
19649 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
19650 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
19651 </p>
19652 !! end
19653
19654 !! test
19655 Do not convert roman numbers to language variants
19656 !! options
19657 language=sr variant=sr-ec
19658 !! wikitext
19659 Fridrih IV je car.
19660 !! html
19661 <p>Фридрих IV је цар.
19662 </p>
19663 !! end
19664
19665 !! test
19666 Unclosed language converter markup "-{"
19667 !! options
19668 language=sr
19669 !! wikitext
19670 -{T|hello
19671 !! html
19672 <p>-{T|hello
19673 </p>
19674 !! end
19675
19676 !! test
19677 Don't convert raw rule "-{R|=&gt;}-" to "=>"
19678 !! options
19679 language=sr
19680 !! wikitext
19681 -{R|=&gt;}-
19682 !! html
19683 <p>=&gt;
19684 </p>
19685 !!end
19686
19687 !! test
19688 Don't break link parsing if language converter markup is in the caption.
19689 !! options
19690 language=sr variant=sr-ec
19691 !! wikitext
19692 [[Main Page|-{R|main page}-]]
19693 !! html
19694 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
19695 </p>
19696 !! end
19697
19698 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19699 !! test
19700 Don't break image parsing if language converter markup is in the caption.
19701 !! options
19702 language=sr
19703 !! wikitext
19704 [[File:Foobar.jpg|-{R|caption}-]]
19705 !! html/parsoid
19706 <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>
19707 </p>
19708 !! end
19709
19710 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19711 !! test
19712 Don't break list handling if language converter markup is in the item.
19713 !! options
19714 language=zh variant=zh-cn
19715 !! wikitext
19716 ;-{zh-cn:AAA;zh-tw:BBB}-
19717 !! html/php
19718 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
19719
19720 !! html/parsoid
19721 <dl><dt>AAA
19722 </dt></dl>
19723 !! end
19724
19725 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19726 !! test
19727 Don't break table handling if language converter markup is in the cell.
19728 !! options
19729 language=sr variant=sr-ec
19730 !! wikitext
19731 {|
19732 |-
19733 | -{R|B}-
19734 |}
19735 !! html/php
19736 <table>
19737
19738 <tr>
19739 <td>Б}-
19740 </td></tr></table>
19741
19742 !! html/parsoid
19743 <table>
19744
19745 <tr>
19746 <td> B
19747 </td></tr></table>
19748
19749 !! end
19750
19751 !! test
19752 Bug 529: Uncovered bullet
19753 !! wikitext
19754 * Foo {{bullet}}
19755 !! html
19756 <ul><li> Foo </li>
19757 <li> Bar</li></ul>
19758
19759 !! end
19760
19761 # Plain MediaWiki does not remove empty lists, but tidy actually does.
19762 # Templates in Wikipedia rely on this behavior, as tidy has always been
19763 # enabled there. These tests are normally run *without* tidy, so specify the
19764 # full output here.
19765 # To test realistic parsing behavior, apply a tidy-like transformation to both
19766 # the expected output and your parser's output.
19767 !! test
19768 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
19769 !! wikitext
19770 ******* Foo {{bullet}}
19771 !! html
19772 <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>
19773 <li> Bar</li></ul>
19774
19775 !! end
19776
19777 !! test
19778 Bug 529: Uncovered table already at line-start
19779 !! wikitext
19780 x
19781
19782 {{table}}
19783 y
19784 !! html
19785 <p>x
19786 </p>
19787 <table>
19788 <tr>
19789 <td> 1 </td>
19790 <td> 2
19791 </td></tr>
19792 <tr>
19793 <td> 3 </td>
19794 <td> 4
19795 </td></tr></table>
19796 <p>y
19797 </p>
19798 !! end
19799
19800 !! test
19801 Bug 529: Uncovered bullet in parser function result
19802 !! wikitext
19803 * Foo {{lc:{{bullet}} }}
19804 !! html
19805 <ul><li> Foo </li>
19806 <li> bar</li></ul>
19807
19808 !! end
19809
19810 !! test
19811 Bug 5678: Double-parsed template argument
19812 !! wikitext
19813 {{lc:{{{1}}}|hello}}
19814 !! html
19815 <p>{{{1}}}
19816 </p>
19817 !! end
19818
19819 !! test
19820 Bug 5678: Double-parsed template invocation
19821 !! wikitext
19822 {{lc:{{paramtest {{!}} param = hello }} }}
19823 !! html
19824 <p>{{paramtest | param = hello }}
19825 </p>
19826 !! end
19827
19828 !! test
19829 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
19830 !! options
19831 language=cs
19832 title=[[Main Page]]
19833 !! wikitext
19834 {{PRVNÍVELKÉ:ěščř}}
19835 {{prvnívelké:ěščř}}
19836 {{PRVNÍMALÉ:ěščř}}
19837 {{prvnímalé:ěščř}}
19838 {{MALÁ:ěščř}}
19839 {{malá:ěščř}}
19840 {{VELKÁ:ěščř}}
19841 {{velká:ěščř}}
19842 !! html
19843 <p>Ěščř
19844 Ěščř
19845 ěščř
19846 ěščř
19847 ěščř
19848 ěščř
19849 ĚŠČŘ
19850 ĚŠČŘ
19851 </p>
19852 !! end
19853
19854 !! test
19855 Morwen/13: Unclosed link followed by heading
19856 !! wikitext
19857 [[link
19858 ==heading==
19859 !! html
19860 <p>[[link
19861 </p>
19862 <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>
19863
19864 !! end
19865
19866 !! test
19867 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
19868 !! wikitext
19869 {{foo|
19870 =heading=
19871 !! html
19872 <p>{{foo|
19873 </p>
19874 <h1><span class="mw-headline" id="heading">heading</span></h1>
19875
19876 !! end
19877
19878 !! test
19879 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
19880 !! wikitext
19881 {{foo|
19882 ==heading==
19883 !! html
19884 <p>{{foo|
19885 </p>
19886 <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>
19887
19888 !! end
19889
19890 !! test
19891 Tildes in comments
19892 !! options
19893 pst
19894 !! wikitext
19895 <!-- ~~~~ -->
19896 !! html/php
19897 <!-- ~~~~ -->
19898 !! end
19899
19900 !! test
19901 Paragraphs inside divs (no extra line breaks)
19902 !! wikitext
19903 <div>Line one
19904
19905 Line two</div>
19906 !! html
19907 <div>Line one
19908 Line two</div>
19909
19910 !! end
19911
19912 !! test
19913 Paragraphs inside divs (extra line break on open)
19914 !! wikitext
19915 <div>
19916 Line one
19917
19918 Line two</div>
19919 !! html
19920 <div>
19921 <p>Line one
19922 </p>
19923 Line two</div>
19924
19925 !! end
19926
19927 !! test
19928 Paragraphs inside divs (extra line break on close)
19929 !! wikitext
19930 <div>Line one
19931
19932 Line two
19933 </div>
19934 !! html
19935 <div>Line one
19936 <p>Line two
19937 </p>
19938 </div>
19939
19940 !! end
19941
19942 !! test
19943 Paragraphs inside divs (extra line break on open and close)
19944 !! wikitext
19945 <div>
19946 Line one
19947
19948 Line two
19949 </div>
19950 !! html
19951 <div>
19952 <p>Line one
19953 </p><p>Line two
19954 </p>
19955 </div>
19956
19957 !! end
19958
19959 !! test
19960 Nesting tags, paragraphs on lines which begin with <div>
19961 !! wikitext
19962 <div></div><strong>A
19963 B</strong>
19964 !! html/php+tidy
19965 <p><strong>A</strong></p>
19966 <p><strong>B</strong></p>
19967 !! html/parsoid
19968 <div></div>
19969 <p><strong>A
19970 B</strong>
19971 </p>
19972 !! end
19973
19974 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
19975 !! test
19976 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
19977 !! wikitext
19978 <blockquote>Line one
19979
19980 Line two</blockquote>
19981 !! html
19982 <blockquote>Line one
19983 Line two</blockquote>
19984
19985 !! html+tidy
19986 <blockquote>
19987 <p>Line one Line two</p>
19988 </blockquote>
19989 !! end
19990
19991 !! test
19992 Bug 6200: paragraphs inside blockquotes (extra line break on open)
19993 !! wikitext
19994 <blockquote>
19995 Line one
19996
19997 Line two</blockquote>
19998 !! html
19999 <blockquote>
20000 <p>Line one
20001 </p>
20002 Line two</blockquote>
20003
20004 !! html+tidy
20005 <blockquote>
20006 <p>Line one</p>
20007 Line two</blockquote>
20008 !! end
20009
20010 !! test
20011 Bug 6200: paragraphs inside blockquotes (extra line break on close)
20012 !! wikitext
20013 <blockquote>Line one
20014
20015 Line two
20016 </blockquote>
20017 !! html
20018 <blockquote>Line one
20019 <p>Line two
20020 </p>
20021 </blockquote>
20022
20023 !! html+tidy
20024 <blockquote>
20025 <p>Line one</p>
20026 <p>Line two</p>
20027 </blockquote>
20028 !! end
20029
20030 !! test
20031 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
20032 !! wikitext
20033 <blockquote>
20034 Line one
20035
20036 Line two
20037 </blockquote>
20038 !! html
20039 <blockquote>
20040 <p>Line one
20041 </p><p>Line two
20042 </p>
20043 </blockquote>
20044
20045 !! html+tidy
20046 <blockquote>
20047 <p>Line one</p>
20048 <p>Line two</p>
20049 </blockquote>
20050 !! end
20051
20052 !! test
20053 Paragraphs inside blockquotes/divs (no extra line breaks)
20054 !! wikitext
20055 <blockquote><div>Line one
20056
20057 Line two</div></blockquote>
20058 !! html
20059 <blockquote><div>Line one
20060 Line two</div></blockquote>
20061
20062 !! end
20063
20064 !! test
20065 Paragraphs inside blockquotes/divs (extra line break on open)
20066 !! wikitext
20067 <blockquote><div>
20068 Line one
20069
20070 Line two</div></blockquote>
20071 !! html
20072 <blockquote><div>
20073 <p>Line one
20074 </p>
20075 Line two</div></blockquote>
20076
20077 !! end
20078
20079 !! test
20080 Paragraphs inside blockquotes/divs (extra line break on close)
20081 !! wikitext
20082 <blockquote><div>Line one
20083
20084 Line two
20085 </div></blockquote>
20086 !! html
20087 <blockquote><div>Line one
20088 <p>Line two
20089 </p>
20090 </div></blockquote>
20091
20092 !! end
20093
20094 !! test
20095 Paragraphs inside blockquotes/divs (extra line break on open and close)
20096 !! wikitext
20097 <blockquote><div>
20098 Line one
20099
20100 Line two
20101 </div></blockquote>
20102 !! html
20103 <blockquote><div>
20104 <p>Line one
20105 </p><p>Line two
20106 </p>
20107 </div></blockquote>
20108
20109 !! end
20110
20111 !! test
20112 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
20113 !! options
20114 wgLinkHolderBatchSize=0
20115 !! wikitext
20116 [[meatball:1]]
20117 [[meatball:2]]
20118 [[meatball:3]]
20119 !! html
20120 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
20121 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
20122 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
20123 </p>
20124 !! end
20125
20126 !! test
20127 Free external link invading image caption
20128 !! wikitext
20129 [[Image:Foobar.jpg|thumb|http://x|hello]]
20130 !! html
20131 <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>
20132
20133 !! end
20134
20135 !! test
20136 Bug 15196: localised external link numbers
20137 !! options
20138 language=fa
20139 !! wikitext
20140 [http://en.wikipedia.org/]
20141 !! html/php
20142 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
20143 </p>
20144 !! html/parsoid
20145 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
20146 !! end
20147
20148 !! test
20149 Multibyte character in padleft
20150 !! wikitext
20151 {{padleft:-Hello|7|Æ}}
20152 !! html
20153 <p>Æ-Hello
20154 </p>
20155 !! end
20156
20157 !! test
20158 Multibyte character in padright
20159 !! wikitext
20160 {{padright:Hello-|7|Æ}}
20161 !! html
20162 <p>Hello-Æ
20163 </p>
20164 !! end
20165
20166 !!test
20167 formatdate parser function
20168 !! wikitext
20169 {{#formatdate:2009-03-24}}
20170 !! html
20171 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
20172 </p>
20173 !! end
20174
20175 !!test
20176 formatdate parser function, with default format
20177 !! wikitext
20178 {{#formatdate:2009-03-24|mdy}}
20179 !! html
20180 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
20181 </p>
20182 !! end
20183
20184 !! test
20185 Spacing of numbers in formatted dates
20186 !! wikitext
20187 {{#formatdate:January 15}}
20188 !! html
20189 <p><span class="mw-formatted-date" title="01-15">January 15</span>
20190 </p>
20191 !! end
20192
20193 !! test
20194 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
20195 !! options
20196 language=nl title=[[MediaWiki:Common.css]]
20197 !! wikitext
20198 {{#formatdate:2009-03-24|dmy}}
20199 !! html
20200 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
20201 </p>
20202 !! end
20203
20204 #
20205 #
20206 #
20207
20208 #
20209 # Edit comments
20210 #
20211
20212 !! test
20213 Edit comment with link
20214 !! options
20215 comment
20216 !! wikitext
20217 I like the [[Main Page]] a lot
20218 !! html/php
20219 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
20220 !!end
20221
20222 !! test
20223 Edit comment with link and link text
20224 !! options
20225 comment
20226 !! wikitext
20227 I like the [[Main Page|best pages]] a lot
20228 !! html/php
20229 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20230 !!end
20231
20232 !! test
20233 Edit comment with link and link text with suffix
20234 !! options
20235 comment
20236 !! wikitext
20237 I like the [[Main Page|best page]]s a lot
20238 !! html/php
20239 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20240 !!end
20241
20242 !! test
20243 Edit comment with section link (non-local, eg in history list)
20244 !! options
20245 comment title=[[Main Page]]
20246 !! wikitext
20247 /* External links */ removed bogus entries
20248 !! html/php
20249 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20250 !!end
20251
20252 !! test
20253 Edit comment with section link and text before it (non-local, eg in history list)
20254 !! options
20255 comment title=[[Main Page]]
20256 !! wikitext
20257 pre-comment text /* External links */ removed bogus entries
20258 !! html/php
20259 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>
20260 !!end
20261
20262 !! test
20263 Edit comment with section link (local, eg in diff view)
20264 !! options
20265 comment local title=[[Main Page]]
20266 !! wikitext
20267 /* External links */ removed bogus entries
20268 !! html/php
20269 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20270 !!end
20271
20272 !! test
20273 Edit comment with subpage link (bug 14080)
20274 !! options
20275 comment
20276 subpage
20277 title=[[Subpage test]]
20278 !! wikitext
20279 Poked at a [[/subpage]] here...
20280 !! html/php
20281 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
20282 !!end
20283
20284 !! test
20285 Edit comment with subpage link and link text (bug 14080)
20286 !! options
20287 comment
20288 subpage
20289 title=[[Subpage test]]
20290 !! wikitext
20291 Poked at a [[/subpage|neat little page]] here...
20292 !! html/php
20293 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
20294 !!end
20295
20296 !! test
20297 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
20298 !! options
20299 comment
20300 title=[[Subpage test]]
20301 !! wikitext
20302 Poked at a [[/subpage]] here...
20303 !! html/php
20304 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...
20305 !!end
20306
20307 !! test
20308 Edit comment with bare anchor link (local, as on diff)
20309 !! options
20310 comment
20311 local
20312 title=[[Main Page]]
20313 !! wikitext
20314 [[#section]]
20315 !! html/php
20316 <a href="#section">#section</a>
20317 !! end
20318
20319 !! test
20320 Edit comment with bare anchor link (non-local, as on history)
20321 !! options
20322 comment
20323 title=[[Main Page]]
20324 !! wikitext
20325 [[#section]]
20326 !! html/php
20327 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
20328 !! end
20329
20330 !! test
20331 Anchor starting with underscore
20332 !! options
20333 title=[[Foo]]
20334 !! wikitext
20335 [[#_ref|One]]
20336 !! html/php
20337 <p><a href="#_ref">One</a>
20338 </p>
20339 !! html/parsoid
20340 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
20341 !! end
20342
20343 !! test
20344 Id starting with underscore
20345 !! wikitext
20346 <div id="_ref"></div>
20347 !! html/*
20348 <div id="_ref"></div>
20349
20350 !! end
20351
20352 !! test
20353 Space normalisation on autocomment (bug 22784)
20354 !! options
20355 comment
20356 title=[[Main Page]]
20357 !! wikitext
20358 /* __hello__world__ */
20359 !! html/php
20360 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
20361 !! end
20362
20363 !! test
20364 percent-encoding and + signs in comments (Bug 26410)
20365 !! options
20366 comment
20367 !! wikitext
20368 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
20369 !! html/php
20370 <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>
20371 !! end
20372
20373 # Parsoid doesn't support this yet: see bug 73581
20374 # but it *should* omit the 'src' attribute if the image is bad.
20375 # PHP side of tests was disabled in
20376 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
20377 # because of issues in the PHP parserTests infrastructure
20378 # (but the output below is indeed what the PHP side emits)
20379 !! test
20380 Bad images - basic functionality
20381 !! wikitext
20382 [[File:Bad.jpg]]
20383 !! DISABLED/html/php
20384 !! html/parsoid
20385 <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>
20386 !! end
20387
20388 !! test
20389 Bad images - bug 16039: text after bad image disappears
20390 !! wikitext
20391 Foo bar
20392 [[File:Bad.jpg]]
20393 Bar foo
20394 !! DISABLED/html/php
20395 <p>Foo bar
20396 </p><p>Bar foo
20397 </p>
20398 !! html/parsoid
20399 <p>Foo bar
20400 <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>
20401 Bar foo</p>
20402 !! end
20403
20404 !! test
20405 Verify that displaytitle works (bug #22501) no displaytitle
20406 !! options
20407 showtitle
20408 !! config
20409 wgAllowDisplayTitle=true
20410 wgRestrictDisplayTitle=false
20411 !! wikitext
20412 this is not the the title
20413 !! html/php
20414 Parser test
20415 <p>this is not the the title
20416 </p>
20417 !! end
20418
20419 !! test
20420 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
20421 !! options
20422 showtitle
20423 title=[[Screen]]
20424 !! config
20425 wgAllowDisplayTitle=true
20426 wgRestrictDisplayTitle=false
20427 !! wikitext
20428 this is not the the title
20429 {{DISPLAYTITLE:whatever}}
20430 !! html/php
20431 whatever
20432 <p>this is not the the title
20433 </p>
20434 !! end
20435
20436 !! test
20437 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
20438 !! options
20439 showtitle
20440 title=[[Screen]]
20441 !! config
20442 wgAllowDisplayTitle=true
20443 wgRestrictDisplayTitle=true
20444 !! wikitext
20445 this is not the the title
20446 {{DISPLAYTITLE:whatever}}
20447 !! html/php
20448 Screen
20449 <p>this is not the the title
20450 </p>
20451 !! end
20452
20453 !! test
20454 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
20455 !! options
20456 showtitle
20457 title=[[Screen]]
20458 !! config
20459 wgAllowDisplayTitle=true
20460 wgRestrictDisplayTitle=true
20461 !! wikitext
20462 this is not the the title
20463 {{DISPLAYTITLE:screen}}
20464 !! html/php
20465 screen
20466 <p>this is not the the title
20467 </p>
20468 !! end
20469
20470 !! test
20471 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
20472 !! options
20473 showtitle
20474 title=[[Screen]]
20475 !! config
20476 wgAllowDisplayTitle=false
20477 !! wikitext
20478 this is not the the title
20479 {{DISPLAYTITLE:screen}}
20480 !! html/php
20481 Screen
20482 <p>this is not the the title
20483 <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>
20484 </p>
20485 !! end
20486
20487 !! test
20488 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
20489 !! options
20490 showtitle
20491 title=[[Screen]]
20492 !! config
20493 wgAllowDisplayTitle=false
20494 !! wikitext
20495 this is not the the title
20496 !! html/php
20497 Screen
20498 <p>this is not the the title
20499 </p>
20500 !! end
20501
20502 !! test
20503 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
20504 !! options
20505 showtitle
20506 title=[[Screen]]
20507 !! config
20508 wgAllowDisplayTitle=true
20509 wgRestrictDisplayTitle=true
20510 !! wikitext
20511 this is not the the title
20512 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
20513 !! html/php
20514 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
20515 <p>this is not the the title
20516 </p>
20517 !! end
20518
20519 !! test
20520 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
20521 !! options
20522 showtitle
20523 title=[[Screen]]
20524 !! config
20525 wgAllowDisplayTitle=true
20526 wgRestrictDisplayTitle=true
20527 !! wikitext
20528 this is not the the title
20529 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
20530 !! html/php
20531 <span style="color: red;">s</span>creen
20532 <p>this is not the the title
20533 </p>
20534 !! end
20535
20536 !! test
20537 Page status indicators: Empty name is invalid
20538 !! options
20539 showindicators
20540 !! wikitext
20541 <indicator name=" "></indicator>
20542 <indicator></indicator>
20543 !! html
20544 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20545 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20546 </p>
20547 !! end
20548
20549 !! test
20550 Page status indicators: Weird syntaxes that are okay
20551 !! options
20552 showindicators
20553 !! wikitext
20554 <indicator name="empty" />
20555 <indicator name="name"></indicator>
20556 !! html
20557 empty=
20558 name=
20559 <p><br />
20560 </p>
20561 !! end
20562
20563 !! test
20564 Page status indicators: Torture test
20565 !! options
20566 showindicators
20567 !! wikitext
20568 <indicator name="01">hello world</indicator>
20569 <indicator name="02">[[Main Page]]</indicator>
20570 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
20571 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
20572 <indicator name="05">* foo
20573 * bar</indicator>
20574 <indicator name="06"><nowiki>foo</nowiki></indicator>
20575 <indicator name="07"> Preformatted</indicator>
20576 <indicator name="08"><div>Broken tag</indicator>
20577 <indicator name="09">{| class=wikitable
20578 | cell
20579 |}</indicator>
20580 <indicator name="10">Two
20581
20582 paragraphs</indicator>
20583 !! html
20584 01=hello world
20585 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20586 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" />
20587 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>
20588 05=<ul><li> foo</li>
20589 <li> bar</li></ul>
20590
20591 06=foo
20592 07=<pre>Preformatted
20593 </pre>
20594 08=<div>Broken tag</div>
20595
20596 09=<table class="wikitable">
20597 <tr>
20598 <td> cell
20599 </td></tr></table>
20600
20601 10=<p>Two
20602 </p><p>paragraphs
20603 </p>
20604 <p><br />
20605 </p><p><br />
20606 </p><p><br />
20607 </p><p><br />
20608 </p><p><br />
20609 </p>
20610 !! end
20611
20612 !! test
20613 preload: check <noinclude> and <includeonly>
20614 !! options
20615 preload
20616 !! wikitext
20617 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
20618 !! html/php
20619 Hello kind world.
20620 !! end
20621
20622 !! test
20623 preload: check <onlyinclude>
20624 !! options
20625 preload
20626 !! wikitext
20627 Goodbye <onlyinclude>Hello world</onlyinclude>
20628 !! html/php
20629 Hello world
20630 !! end
20631
20632 !! test
20633 preload: can pass tags through if we want to
20634 !! options
20635 preload
20636 !! wikitext
20637 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
20638 !! html/php
20639 <includeonly>Hello world</includeonly>
20640 !! end
20641
20642 !! test
20643 preload: check that it doesn't try to do tricks
20644 !! options
20645 preload
20646 !! wikitext
20647 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20648 !! html/php
20649 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20650 !! end
20651
20652 !! test
20653 Play a bit with r67090 and bug 3158
20654 !! wikitext
20655 <div style="width:50% !important">&nbsp;</div>
20656 <div style="width:50%&nbsp;!important">&nbsp;</div>
20657 <div style="width:50%&#160;!important">&nbsp;</div>
20658 <div style="border : solid;">&nbsp;</div>
20659 !! html/php
20660 <div style="width:50% !important">&#160;</div>
20661 <div style="width:50% !important">&#160;</div>
20662 <div style="width:50% !important">&#160;</div>
20663 <div style="border&#160;: solid;">&#160;</div>
20664
20665 !! html/parsoid
20666 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20667 <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>
20668 <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>
20669 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20670
20671 !! end
20672
20673 !! test
20674 HTML5 data attributes
20675 !! wikitext
20676 <span data-foo="bar">Baz</span>
20677 <p data-abc-def_hij="">Quuz</p>
20678 !! html/php
20679 <p><span data-foo="bar">Baz</span>
20680 </p>
20681 <p data-abc-def_hij="">Quuz</p>
20682
20683 !! html/parsoid
20684 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
20685 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
20686 !! end
20687
20688 !! test
20689 Strip reserved data attributes
20690 !! wikitext
20691 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
20692 !! html
20693 <div data-ok="fred">d</div>
20694
20695 !! end
20696
20697 !! test
20698 percent-encoding and + signs in internal links (Bug 26410)
20699 !! wikitext
20700 [[User:+%]] [[Page+title%]]
20701 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
20702 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
20703 [[%33%45]] [[%33%45+]]
20704 !! html/php
20705 <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>
20706 <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>
20707 <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>
20708 <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>
20709 </p>
20710 !! html/parsoid
20711 <p><a rel="mw:WikiLink" href="./User:+%25" title="User:+%">User:+%</a> <a rel="mw:WikiLink" href="Page+title%25" title="Page+title%">Page+title%</a>
20712 <a rel="mw:WikiLink" href="%25+" title="%+">%+</a> <a rel="mw:WikiLink" href="%25+" title="%+">%20</a> <a rel="mw:WikiLink" href="%25+" title="%+">%+ </a> <a rel="mw:WikiLink" href="%25+r" title="%+r">%+r</a>
20713 <a rel="mw:WikiLink" href="%25" title="%">%</a> <a rel="mw:WikiLink" href="+" title="+">+</a> <span class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"bogus","ak":"foo"},{"ck":"caption","ak":"[[bar]]"}]}' data-mw='{"errors":[{"key":"missing-image","message":"This image does not exist."}],"caption":"&lt;a rel=\"mw:WikiLink\" href=\"./Bar\" title=\"Bar\" data-parsoid=\"{&amp;quot;stx&amp;quot;:&amp;quot;simple&amp;quot;,&amp;quot;a&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;./Bar&amp;quot;},&amp;quot;sa&amp;quot;:{&amp;quot;href&amp;quot;:&amp;quot;bar&amp;quot;},&amp;quot;dsr&amp;quot;:[94,101,2,2]}\">bar&lt;/a>"}'><a href="./File:%25+abc9"><img resource="./File:%25+abc9" src="./Special:FilePath/%25+abc9" height="220" width="220" data-parsoid='{"a":{"resource":"./File:%25+abc9","height":"220","width":"220"},"sa":{"resource":"File:%+abc%39"}}'/></a></span>
20714 <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>
20715 !! end
20716
20717 !! test
20718 Special characters in embedded file links (bug 27679)
20719 !! wikitext
20720 [[File:Contains & ampersand.jpg]]
20721 [[File:Does not exist.jpg|Title with & ampersand]]
20722 !! html/php
20723 <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>
20724 <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>
20725 </p>
20726 !! html/parsoid
20727 <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>
20728 <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>
20729 !! end
20730
20731 !! test
20732 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
20733 !! wikitext
20734 Text&apos;s been normalized?
20735 !! html
20736 <p>Text&#39;s been normalized?
20737 </p>
20738 !! end
20739
20740 !! test
20741 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
20742 !! wikitext
20743 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
20744 !! html
20745 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
20746 </p>
20747 !! end
20748
20749 !! test
20750 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
20751 !! wikitext
20752 [http://www.example.org/ ideograms]
20753 !! html
20754 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
20755 </p>
20756 !! end
20757
20758 !! test
20759 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
20760 !! wikitext
20761 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
20762 !! html
20763 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
20764 </p>
20765 !! end
20766
20767 !! article
20768 Mediawiki:loop1
20769 !! text
20770 {{Identical|A}}
20771 !! endarticle
20772
20773 !! article
20774 Mediawiki:loop2
20775 !! text
20776 {{Identical|B}}
20777 !! endarticle
20778
20779 !! article
20780 Template:Identical
20781 !! text
20782 {{int:loop1}}
20783 {{int:loop2}}
20784 !! endarticle
20785
20786 !! test
20787 Bug 31098 Template which includes system messages which includes the template
20788 !! wikitext
20789 {{Identical}}
20790 !! html
20791 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20792 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20793 </p>
20794 !! end
20795
20796 !! test
20797 Bug31490 Turkish: ucfirst 'blah'
20798 !! options
20799 language=tr
20800 !! wikitext
20801 {{ucfirst:blah}}
20802 !! html
20803 <p>Blah
20804 </p>
20805 !! end
20806
20807 !! test
20808 Bug31490 Turkish: ucfirst 'ix'
20809 !! options
20810 language=tr
20811 !! wikitext
20812 {{ucfirst:ix}}
20813 !! html
20814 <p>İx
20815 </p>
20816 !! end
20817
20818 !! test
20819 Bug31490 Turkish: lcfirst 'BLAH'
20820 !! options
20821 language=tr
20822 !! wikitext
20823 {{lcfirst:BLAH}}
20824 !! html
20825 <p>bLAH
20826 </p>
20827 !! end
20828
20829 !! test
20830 Bug31490 Turkish: ucfırst (with a dotless i)
20831 !! options
20832 language=tr
20833 !! wikitext
20834 {{ucfırst:blah}}
20835 !! html
20836 <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>
20837 </p>
20838 !! end
20839
20840 !! test
20841 Bug31490 ucfırst (with a dotless i) with English language
20842 !! options
20843 language=en
20844 !! wikitext
20845 {{ucfırst:blah}}
20846 !! html
20847 <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>
20848 </p>
20849 !! end
20850
20851 !! test
20852 Bug 26375: TOC with italics
20853 !! options
20854 title=[[Main Page]]
20855 !! wikitext
20856 __TOC__
20857 == ''Lost'' episodes ==
20858 !! html
20859 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20860 <ul>
20861 <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>
20862 </ul>
20863 </div>
20864
20865 <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>
20866
20867 !! end
20868
20869 !! test
20870 Bug 26375: TOC with bold
20871 !! options
20872 title=[[Main Page]]
20873 !! wikitext
20874 __TOC__
20875 == '''should be bold''' then normal text ==
20876 !! html
20877 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20878 <ul>
20879 <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>
20880 </ul>
20881 </div>
20882
20883 <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>
20884
20885 !! end
20886
20887 !! test
20888 Bug 33845: Headings become cursive in TOC when they contain an image
20889 !! options
20890 title=[[Main Page]]
20891 !! wikitext
20892 __TOC__
20893 == Image [[Image:foobar.jpg]] ==
20894 !! html
20895 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20896 <ul>
20897 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
20898 </ul>
20899 </div>
20900
20901 <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>
20902
20903 !! end
20904
20905 !! test
20906 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
20907 !! options
20908 title=[[Main Page]]
20909 !! wikitext
20910 __TOC__
20911 == <blockquote>Quote</blockquote> ==
20912 !! html
20913 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20914 <ul>
20915 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20916 </ul>
20917 </div>
20918
20919 <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>
20920
20921 !! html+tidy
20922 <p></p>
20923 <div id="toc" class="toc">
20924 <div id="toctitle">
20925 <h2>Contents</h2>
20926 </div>
20927 <ul>
20928 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20929 </ul>
20930 </div>
20931 <p></p>
20932 <h2><span class="mw-headline" id="Quote"></span></h2>
20933 <blockquote>
20934 <p><span class="mw-headline" id="Quote">Quote</span></p>
20935 </blockquote>
20936 <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>
20937 !! end
20938
20939 !! test
20940 Unclosed tags in TOC
20941 !! options
20942 title=[[Main Page]]
20943 !! wikitext
20944 __TOC__
20945 == Proof: 2 < 3 ==
20946 <small>Hanc marginis exiguitas non caperet.</small>
20947 QED
20948 !! html
20949 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20950 <ul>
20951 <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>
20952 </ul>
20953 </div>
20954
20955 <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>
20956 <p><small>Hanc marginis exiguitas non caperet.</small>
20957 QED
20958 </p>
20959 !! end
20960
20961 !! test
20962 Multiple tags in TOC
20963 !! wikitext
20964 __TOC__
20965 == <i>Foo</i> <b>Bar</b> ==
20966
20967 == <i>Foo</i> <blockquote>Bar</blockquote> ==
20968 !! html
20969 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20970 <ul>
20971 <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>
20972 <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>
20973 </ul>
20974 </div>
20975
20976 <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>
20977 <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>
20978
20979 !! html+tidy
20980 <p></p>
20981 <div id="toc" class="toc">
20982 <div id="toctitle">
20983 <h2>Contents</h2>
20984 </div>
20985 <ul>
20986 <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>
20987 <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>
20988 </ul>
20989 </div>
20990 <p></p>
20991 <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>
20992 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
20993 <blockquote>
20994 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
20995 </blockquote>
20996 <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>
20997 !! end
20998
20999 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
21000 # html5 tag parsing.
21001 !! test
21002 Tags with parameters in TOC
21003 !! options
21004 parsoid=wt2html
21005 !! wikitext
21006 __TOC__
21007 == <sup class="in-h2">Hello</sup> ==
21008
21009 == <sup class="a > b">Evilbye</sup> ==
21010 !! html/php
21011 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21012 <ul>
21013 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
21014 <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>
21015 </ul>
21016 </div>
21017
21018 <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>
21019 <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>
21020
21021 !! html/parsoid
21022 <meta property="mw:PageProp/toc" />
21023 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
21024
21025 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
21026 !! end
21027
21028 !! test
21029 span tags with directionality in TOC
21030 !! wikitext
21031 __TOC__
21032 == <span dir="ltr">C++</span> ==
21033
21034 == <span dir="rtl">זבנג!</span> ==
21035
21036 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
21037
21038 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
21039
21040 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
21041 !! html
21042 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21043 <ul>
21044 <li class="toclevel-1 tocsection-1"><a href="#C.2B.2B"><span class="tocnumber">1</span> <span class="toctext"><span dir="ltr">C++</span></span></a></li>
21045 <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>
21046 <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>
21047 <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>
21048 <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>
21049 </ul>
21050 </div>
21051
21052 <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>
21053 <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>
21054 <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>
21055 <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>
21056 <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>
21057
21058 !! end
21059
21060 !! test
21061 Bug 72884: bdi element in ToC
21062 !! wikitext
21063 __TOC__
21064 == <bdi>test</bdi> ==
21065 !! html
21066 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21067 <ul>
21068 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
21069 </ul>
21070 </div>
21071
21072 <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>
21073
21074 !! end
21075
21076 # Note that the html output does not have the <p></p>, but the
21077 # html+tidy output *does*. This is because the empty <p></p> is
21078 # removed by the sanitizer, but only when tidy is *not* enabled (!).
21079 !! test
21080 Empty <p> tag in TOC, removed by Sanitizer (T92892)
21081 !! wikitext
21082 __TOC__
21083 == x ==
21084 !! html
21085 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21086 <ul>
21087 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21088 </ul>
21089 </div>
21090
21091 <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>
21092
21093 !! html+tidy
21094 <p></p>
21095 <div id="toc" class="toc">
21096 <div id="toctitle">
21097 <h2>Contents</h2>
21098 </div>
21099 <ul>
21100 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21101 </ul>
21102 </div>
21103 <p></p>
21104 <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>
21105 !! end
21106
21107 !! article
21108 MediaWiki:Bug32057
21109 !! text
21110 == {{int:headline_sample}} ==
21111 !! endarticle
21112
21113 !! test
21114 Bug 32057: Title needed when expanding <h> nodes.
21115 !! options
21116 title=[[Main Page]]
21117 !! wikitext
21118 {{int:Bug32057}}
21119 !! html
21120 <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>
21121
21122 !! end
21123
21124 !! test
21125 Strip marker in urlencode
21126 !! wikitext
21127 {{urlencode:x<nowiki/>y}}
21128 {{urlencode:x<nowiki/>y|wiki}}
21129 {{urlencode:x<nowiki/>y|path}}
21130 {{urlencode:x<pre id="one">two</pre>y}}
21131 !! html
21132 <p>xy
21133 xy
21134 xy
21135 xy
21136 </p>
21137 !! end
21138
21139 !! test
21140 Strip marker in lc
21141 !! wikitext
21142 {{lc:x<nowiki/>y}}
21143 !! html
21144 <p>xy
21145 </p>
21146 !! end
21147
21148 !! test
21149 Strip marker in uc
21150 !! wikitext
21151 {{uc:x<nowiki/>y}}
21152 !! html
21153 <p>XY
21154 </p>
21155 !! end
21156
21157 !! test
21158 Strip marker in formatNum
21159 !! wikitext
21160 {{formatnum:1<nowiki/>2}}
21161 {{formatnum:1<nowiki/>2|R}}
21162 !! html
21163 <p>12
21164 12
21165 </p>
21166 !! end
21167
21168 !! test
21169 Check noCommafy in formatNum
21170 !! options
21171 language=be-tarask
21172 !! wikitext
21173 {{formatnum:123456.78}}
21174 {{formatnum:123456.78|NOSEP}}
21175 !! html
21176 <p>123 456,78
21177 123456.78
21178 </p>
21179 !! end
21180
21181 !! test
21182 Wrong option for formatNum (bug 56199)
21183 !! wikitext
21184 {{formatnum:1,234.56|Random}}
21185 {{formatnum:1,234.56|EVERYTHING}}
21186 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
21187 !! html
21188 <p>1,234.56
21189 1,234.56
21190 1,234.56
21191 </p>
21192 !! end
21193
21194 !! test
21195 Strip marker in grammar
21196 !! options
21197 language=fi
21198 !! wikitext
21199 {{grammar:elative|foo<nowiki/>bar}}
21200 !! html
21201 <p>foobarista
21202 </p>
21203 !! end
21204
21205 !! test
21206 Strip marker in padleft
21207 !! wikitext
21208 {{padleft:|2|x<nowiki/>y}}
21209 !! html
21210 <p>xy
21211 </p>
21212 !! end
21213
21214 !! test
21215 Strip marker in padright
21216 !! wikitext
21217 {{padright:|2|x<nowiki/>y}}
21218 !! html
21219 <p>xy
21220 </p>
21221 !! end
21222
21223 !! test
21224 Strip marker in anchorencode
21225 !! wikitext
21226 {{anchorencode:x<nowiki/>y}}
21227 !! html
21228 <p>xy
21229 </p>
21230 !! end
21231
21232 !! test
21233 nowiki inside link inside heading (bug 18295)
21234 !! wikitext
21235 ==[[foo|x<nowiki>y</nowiki>z]]==
21236 !! html
21237 <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>
21238
21239 !! end
21240
21241 !! test
21242 new support for bdi element (bug 31817)
21243 !! wikitext
21244 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21245 !! html
21246 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21247
21248 !!end
21249
21250 !! test
21251 Ignore pipe between table row attributes
21252 !! wikitext
21253 {|
21254 | quux
21255 |- id=foo | style='color: red'
21256 | bar
21257 |}
21258 !! html
21259 <table>
21260 <tr>
21261 <td> quux
21262 </td></tr>
21263 <tr id="foo" style="color: red">
21264 <td> bar
21265 </td></tr></table>
21266
21267 !! end
21268
21269 !!test
21270 Gallery override link with WikiLink (bug 34852)
21271 !! wikitext
21272 <gallery>
21273 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
21274 </gallery>
21275 !! html
21276 <ul class="gallery mw-gallery-traditional">
21277 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21278 <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>
21279 <div class="gallerytext">
21280 <p>caption
21281 </p>
21282 </div>
21283 </div></li>
21284 </ul>
21285
21286 !! end
21287
21288 !!test
21289 Gallery override link with absolute external link (bug 34852)
21290 !! wikitext
21291 <gallery>
21292 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21293 </gallery>
21294 !! html
21295 <ul class="gallery mw-gallery-traditional">
21296 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21297 <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>
21298 <div class="gallerytext">
21299 <p>caption
21300 </p>
21301 </div>
21302 </div></li>
21303 </ul>
21304
21305 !! end
21306
21307 !!test
21308 Gallery override link with malicious javascript (bug 34852)
21309 !! wikitext
21310 <gallery>
21311 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21312 </gallery>
21313 !! html
21314 <ul class="gallery mw-gallery-traditional">
21315 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21316 <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>
21317 <div class="gallerytext">
21318 <p>caption
21319 </p>
21320 </div>
21321 </div></li>
21322 </ul>
21323
21324 !! end
21325
21326 !!test
21327 Gallery with invalid title as link (bug 43964)
21328 !! wikitext
21329 <gallery>
21330 File:foobar.jpg|link=<
21331 </gallery>
21332 !! html
21333 <ul class="gallery mw-gallery-traditional">
21334 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21335 <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>
21336 <div class="gallerytext">
21337 </div>
21338 </div></li>
21339 </ul>
21340
21341 !! end
21342
21343 !!test
21344 Language parser function
21345 !! wikitext
21346 {{#language:ar}}
21347 !! html
21348 <p>العربية
21349 </p>
21350 !! end
21351
21352 !!test
21353 Padleft and padright as substr
21354 !! wikitext
21355 {{padleft:|3|abcde}}
21356 {{padright:|3|abcde}}
21357 !! html
21358 <p>abc
21359 abc
21360 </p>
21361 !! end
21362
21363 !!test
21364 Special parser function
21365 !! wikitext
21366 {{#special:RandomPage}}
21367 {{#special:BaDtItLe}}
21368 {{#special:Foobar}}
21369 !! html
21370 <p>Special:Random
21371 Special:Badtitle
21372 Special:Foobar
21373 </p>
21374 !! end
21375
21376 !!test
21377 Bug 34939 - Case insensitive link parsing ([HttP://])
21378 !! wikitext
21379 [HttP://MediaWiki.Org/]
21380 !! html/php
21381 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
21382 </p>
21383 !! html/parsoid
21384 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
21385 !! end
21386
21387 !!test
21388 Bug 34939 - Case insensitive link parsing ([HttP:// title])
21389 !! wikitext
21390 [HttP://MediaWiki.Org/ MediaWiki]
21391 !! html
21392 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
21393 </p>
21394 !! end
21395
21396 !!test
21397 Bug 34939 - Case insensitive link parsing (HttP://)
21398 !! wikitext
21399 HttP://MediaWiki.Org/
21400 !! html/php
21401 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
21402 </p>
21403 !! html/parsoid
21404 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
21405 !! end
21406
21407 !!test
21408 Disable TOC
21409 !! options
21410 notoc
21411 !! wikitext
21412 Lead
21413 == Section 1 ==
21414 == Section 2 ==
21415 == Section 3 ==
21416 == Section 4 ==
21417 == Section 5 ==
21418 !! html
21419 <p>Lead
21420 </p>
21421
21422 <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>
21423 <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>
21424 <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>
21425 <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>
21426 <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>
21427
21428 !! end
21429
21430
21431 ###
21432 ### Parsoid-specific tests
21433 ### Parsoid-PHP parser incompatibilities
21434 ###
21435 !!test
21436 1. SOL-sensitive wikitext tokens as template-args
21437 !!options
21438 parsoid=wt2html,wt2wt
21439 !! wikitext
21440 {{echo|*a}}
21441 {{echo|#a}}
21442 {{echo|:a}}
21443 !! html
21444 <span about="#mwt1" typeof="mw:Transclusion">
21445 </span><ul about="#mwt1"><li>a</li>
21446 </ul>
21447 <span about="#mwt2" typeof="mw:Transclusion">
21448 </span><ol about="#mwt2"><li>a</li>
21449 </ol>
21450 <span about="#mwt3" typeof="mw:Transclusion">
21451 </span><dl about="#mwt3"><dd>a</dd>
21452 </dl>
21453 !!end
21454
21455 #### -----------------------------------------------------------------
21456 #### Parsoid-specific functionality tests
21457 #### -----------------------------------------------------------------
21458
21459 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
21460 # We know wt2wt will fail, but we expect selser to pass.
21461 # Due to the nature of our testing, wt2wt and selser tests will enter the
21462 # blacklist and we'll catch selser regressions based on changes to the
21463 # blacklist entries for selser tests.
21464 !! test
21465 1. Bad treebuilder fixup of formatting elt is cleaned up
21466 !! options
21467 parsoid=wt2html,wt2wt
21468 !! wikitext
21469 {|
21470 |
21471 <small>
21472 [[Image:Foobar.jpg|right|Test]]
21473 </small>
21474 |}
21475 !! html/parsoid
21476 <table>
21477 <tbody><tr><td>
21478 <small>
21479 <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>
21480 </small>
21481 </td></tr>
21482 </tbody></table>
21483 !! end
21484
21485 !! test
21486 2. Bad treebuilder fixup of formatting elt is cleaned up
21487 !! options
21488 parsoid=wt2html,wt2wt
21489 !! wikitext
21490 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
21491
21492 <small>[[Image:Foobar.jpg|right|300px]]</small>
21493 !! html/parsoid
21494
21495 <p><b>foo</b></p>
21496 <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>
21497 <p><b>bar</b></p>
21498 <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>
21499 !! end
21500
21501 !! test
21502 3. Bad treebuilder fixup of formatting elt is cleaned up
21503 !! options
21504 parsoid=wt2html,wt2wt
21505 !! wikitext
21506 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
21507 !! html/parsoid
21508 <p><small><b>foo</b></small></p>
21509 <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>
21510 <p><small><b>bar</b></small></p>
21511 !! end
21512
21513 !! test
21514 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
21515 !! options
21516 parsoid=wt2html,wt2wt
21517 !! wikitext
21518 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
21519 !! html/parsoid
21520 <p><b><small></small></b></p>
21521 <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>
21522 <p></p>
21523 !! end
21524
21525 #### ----------------------------------------------------------------
21526 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
21527 #### tags. Parsoid's output for these tags differs from that of the
21528 #### PHP parser.
21529 #### ----------------------------------------------------------------
21530
21531 !!test
21532 Ref: 1. ref-location should be replaced with an index span
21533 !! wikitext
21534 A <ref>foo</ref>
21535 B <ref name="x">foo</ref>
21536 C <ref name="y" />
21537 <references />
21538 !! html/parsoid
21539 <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>
21540 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>
21541 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>
21542 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21543 <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>
21544 <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>
21545 <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>
21546 </ol>
21547 !!end
21548
21549 !!test
21550 Ref: 2. ref-tags with identical names should all get the same index
21551 !! wikitext
21552 A <ref name="x">foo</ref>
21553 B <ref name="x" />
21554 <references />
21555 !! html/parsoid
21556 <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>
21557 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>
21558 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21559 <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>
21560 </ol>
21561 !!end
21562
21563 !!test
21564 Ref: 3. spaces in ref-names should be ignored
21565 !! wikitext
21566 A <ref name="x">foo</ref>
21567 B <ref name=" x " />
21568 C <ref name= x />
21569 <references />
21570 !! html/parsoid
21571 <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>
21572 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>
21573 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>
21574 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21575 <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>
21576 </ol>
21577 !!end
21578
21579 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
21580 !!test
21581 Ref: 4. 'constructor' should be accepted as a valid ref-name
21582 !! wikitext
21583 A <ref name="constructor">foo</ref>
21584 <references />
21585 !! html/parsoid
21586 <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>
21587 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21588 <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>
21589 </ol>
21590 !!end
21591
21592 !!test
21593 Ref: 5. body should accept generic wikitext
21594 !! wikitext
21595 A <ref>
21596 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
21597 </ref>
21598
21599 <references />
21600 !! html/parsoid
21601 <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>
21602
21603 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21604 <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>
21605 </span></li>
21606 </ol>
21607 !!end
21608
21609 !!test
21610 Ref: 6. indent-pres should not be output in ref-body
21611 !! wikitext
21612 A <ref>
21613 foo
21614 bar
21615 baz
21616 </ref>
21617
21618 <references />
21619 !! html/parsoid
21620 <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>
21621
21622 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21623 <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
21624 bar
21625 baz
21626 </span></li>
21627 </ol>
21628 !!end
21629
21630 !!test
21631 Ref: 7. No p-wrapping in ref-body
21632 !! wikitext
21633 A <ref>
21634 foo
21635
21636 bar
21637
21638
21639 baz
21640
21641
21642
21643 booz
21644 </ref>
21645
21646 <references />
21647 !! html/parsoid
21648 <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>
21649
21650 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21651 <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
21652
21653 bar
21654
21655
21656 baz
21657
21658
21659
21660 booz
21661 </span></li>
21662 </ol>
21663 !!end
21664
21665 !!test
21666 Ref: 8. transclusion wikitext has lower precedence
21667 !! wikitext
21668 A <ref> foo {{echo|</ref> B C}}
21669
21670 <references />
21671 !! html/parsoid
21672 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B C<span typeof="mw:Nowiki">}}</span></p>
21673 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21674 <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>
21675 </ol>
21676 !!end
21677
21678 !!test
21679 Ref: 9. unclosed comments should not leak out of ref-body
21680 !! wikitext
21681 A <ref> foo <!--</ref> B C
21682 <references />
21683 !! html/parsoid
21684 <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>
21685 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21686 <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>
21687 </ol>
21688 !!end
21689
21690 !!test
21691 Ref: 10. Unclosed HTML tags should not leak out of ref-body
21692 !! wikitext
21693 A <ref> <b> foo </ref> B C
21694
21695 <references />
21696 !! html/parsoid
21697 <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>
21698
21699
21700 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21701 <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>
21702 </ol>
21703 !!end
21704
21705 !!test
21706 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
21707 !! wikitext
21708 A <ref>foo</ref> B
21709 C <ref>bar</ref> D
21710 <references />
21711 !! html/parsoid
21712 <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
21713 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>
21714 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21715 <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>
21716 <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>
21717 </ol>
21718 !!end
21719
21720 !!test
21721 Ref: 12. ref-tags act as trailing newline migration barrier
21722 !! wikitext
21723 <!--the newline at the end of this line moves out of the p tag-->a
21724
21725 b<!--the newline at the end of this line stays inside the p tag--> <ref />
21726 <ref />
21727
21728 c
21729 <references />
21730 !! html/parsoid
21731 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
21732
21733
21734 <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>
21735 <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>
21736
21737 <p>c</p>
21738 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21739 <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>
21740 <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>
21741 !!end
21742
21743 !!test
21744 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
21745 !! wikitext
21746 <ref>foo</ref> A
21747 <ref>bar
21748 </ref> B
21749 <references />
21750 !! html/parsoid
21751 <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
21752 <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>
21753 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21754 <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>
21755 <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
21756 </span></li>
21757 </ol>
21758 !!end
21759
21760 !!test
21761 Ref: 14. A nested ref-tag should be emitted as plain text
21762 !! wikitext
21763 <ref>foo <ref>bar</ref> baz</ref>
21764
21765 <references />
21766 !! html/parsoid
21767 <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>
21768 </p>
21769 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21770 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo &lt;ref>bar&lt;/ref> baz</span></li>
21771 </ol>
21772 !!end
21773
21774 !!test
21775 Ref: 15. ref-tags with identical names should get identical indexes
21776 !! wikitext
21777 A1 <ref name="a">foo</ref> A2 <ref name="a" />
21778 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
21779
21780 <references />
21781 !! html/parsoid
21782 <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>
21783 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>
21784
21785 <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>
21786 </ol>
21787 !!end
21788
21789 ## We don't bother wt2wt-ing non-standard whitespace
21790 !!test
21791 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
21792 !!options
21793 parsoid=wt2html
21794 !! wikitext
21795 A <ref >foo</ref >
21796
21797 <references />
21798 !! html/parsoid
21799 <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>
21800 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21801 <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>
21802 !!end
21803
21804 !!test
21805 Ref: 17. Generate valid HTML5 id/about attributes
21806 !!wikitext
21807 <ref name="a b">foo</ref>
21808
21809 <references />
21810 !!html/parsoid
21811 <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>
21812 </p>
21813
21814 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21815 <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>
21816 </ol>
21817 !!end
21818
21819 !!test
21820 Ref: 18. T58916: Extension attributes should be parsed as plain text
21821 !!wikitext
21822 <ref name="{{echo|a}}">foo</ref>
21823
21824 <references />
21825 !!html/parsoid
21826 <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>
21827 </p>
21828
21829 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21830 <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>
21831 </ol>
21832 !!end
21833
21834 !!test
21835 Ref: 19. ref-tags with identical name encodings should get identical indexes
21836 !! wikitext
21837 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
21838
21839 <references />
21840 !! html/parsoid
21841 <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>
21842 </p>
21843 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21844 <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>
21845 </ol>
21846 !!end
21847
21848 !!test
21849 Ref: 20. ref-tags with identical names but different content should keep it
21850 !! wikitext
21851 A <ref name="foo">Foo one</ref>
21852 B <ref name="foo">Foo two</ref>
21853 C <ref name="foo" />
21854
21855 <references />
21856 !! html/parsoid
21857 <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>
21858 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>
21859 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>
21860
21861 <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>
21862 </ol>
21863 !!end
21864
21865 !!test
21866 References: 1. references tag without any refs should be handled properly
21867 !! wikitext
21868 <references />
21869 !! html/parsoid
21870 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21871 !!end
21872
21873 !!test
21874 References: 2. references tag with group only outputs references from that group
21875 !! wikitext
21876 A <ref group="a">foo</ref>
21877 B <ref group="b">bar</ref>
21878 C <ref>baz</ref>
21879
21880 <references group="a" />
21881 <references />
21882 <references group="b" />
21883 !! html/parsoid
21884 <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>
21885 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>
21886 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>
21887
21888 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
21889 <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>
21890 </ol>
21891 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
21892 <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>
21893 </ol>
21894 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
21895 <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>
21896 </ol>
21897 !!end
21898
21899 !!test
21900 References: 3. ref list should be cleared after processing references
21901 !! wikitext
21902 A <ref>foo</ref>
21903
21904 <references />
21905
21906 B <ref>bar</ref>
21907
21908 <references />
21909 !! html/parsoid
21910 <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>
21911
21912 <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>
21913 </ol>
21914
21915 <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>
21916
21917 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21918 <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>
21919 </ol>
21920 !!end
21921
21922 !!test
21923 References: 4. only referenced group should be cleared after processing references
21924 !! wikitext
21925 A <ref group="a">afoo</ref>
21926 B <ref>bfoo</ref>
21927
21928 <references group="a" />
21929
21930 C <ref>cfoo</ref>
21931
21932 <references />
21933 !! html/parsoid
21934 <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>
21935 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>
21936
21937 <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>
21938 </ol>
21939
21940 <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>
21941
21942 <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>
21943 </ol>
21944 !!end
21945
21946 !!test
21947 References: 5. ref tags in references should be processed while ignoring all other content
21948 !! wikitext
21949 A <ref name="a" />
21950 B <ref name="b">bar</ref>
21951
21952 <references>
21953 <ref name="a">foo</ref>
21954 This should just get lost.
21955 </references>
21956 !! html/parsoid
21957 <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>
21958 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>
21959
21960
21961 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","body":{"extsrc":"&lt;ref name=\"a\">foo&lt;/ref>\nThis should just get lost.","html":"\n&lt;span about=\"#mwt8\" class=\"mw-ref\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[59,82,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-a-1\"},\"attrs\":{\"name\":\"a\"}}&#39;>&lt;a href=\"#cite_note-a-1\" style=\"counter-reset: mw-Ref 1;\">&lt;span class=\"mw-reflink-text\">[1]&lt;/span>&lt;/a>&lt;/span>\n"},"attrs":{}}'><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>
21962 </ol>
21963 !!end
21964
21965 !!test
21966 References: 6. <references /> from a transclusion
21967 !! wikitext
21968 <ref>Foo</ref> {{echo|<references />}}
21969 !! html/parsoid
21970 <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>
21971 </ol>
21972 !!end
21973
21974 !! test
21975 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
21976 !! wikitext
21977 A <ref>foo bar for a</ref>
21978 B <ref group="X" name="b" />
21979
21980 <references />
21981
21982 <references group="X">
21983 <ref name="b">foo</ref>
21984 </references>
21985 !! html/parsoid
21986 <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>
21987 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>
21988 </p>
21989
21990 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21991 <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>
21992 </ol>
21993
21994 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="X" data-mw='{"name":"references","body":{"extsrc":"&lt;ref name=\"b\">foo&lt;/ref>","html":"\n&lt;span about=\"#mwt10\" class=\"mw-ref\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[96,119,14,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-b-2\"},\"attrs\":{\"name\":\"b\"}}&#39;>&lt;a href=\"#cite_note-b-2\" style=\"counter-reset: mw-Ref 1;\" data-mw-group=\"X\">&lt;span class=\"mw-reflink-text\">[X 1]&lt;/span>&lt;/a>&lt;/span>\n"},"attrs":{"group":"X"}}'>
21995 <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>
21996 </ol>
21997 !! end
21998
21999 !! test
22000 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
22001 !! wikitext
22002 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
22003 <references />
22004 !! html/parsoid
22005 <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>
22006 <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>
22007 </ol>
22008 !!end
22009
22010 # This test only works in wt2html now as the <references /> are always generated
22011 # unless selser is active. Once T72722 is fixed, we should add a changes test
22012 # here to ensure that unrelated changes don't add the new <references /> in
22013 # wt2wt.
22014 !! test
22015 References: 9. Generate missing references list at the end
22016 !! wikitext
22017 A <ref>foo</ref>
22018 B <ref group="inexistent">bar</ref>
22019 !! html/parsoid
22020 <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>
22021 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22022 <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>
22023 </ol>
22024 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
22025 <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>
22026 </ol>
22027 !! end
22028
22029 !! test
22030 References: 10. New <references/> shouldn't be added for unrelated edits.
22031 !! options
22032 parsoid={
22033 "modes": ["selser"],
22034 "changes": [["#x", "remove"]],
22035 "selser": "noauto"
22036 }
22037 !! wikitext
22038 Unrelated text<span id="x"> that's going to disappear</span>.
22039 A <ref>foo</ref>
22040 !! wikitext/edited
22041 Unrelated text.
22042 A <ref>foo</ref>
22043 !!end
22044
22045 !! test
22046 Entities in ref name
22047 !! wikitext
22048 <ref name="test &amp; me">hi</ref>
22049 <references />
22050 !! html/parsoid
22051 <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>
22052 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22053 <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>
22054 </ol>
22055 !! end
22056
22057 # This test is wt2html only because we're permitting the serializer to produce
22058 # dirty diffs, normalizing the unclosed references to the self-closed version.
22059 !! test
22060 Generate references for unclosed references tag
22061 !! options
22062 parsoid=wt2html
22063 !! wikitext
22064 a<ref>foo</ref>
22065
22066 <references>
22067 !! html/parsoid
22068 <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>
22069 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22070 <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>
22071 !! end
22072
22073 !! test
22074 New reference serializes on its own line
22075 !! options
22076 parsoid=wt2wt,html2wt
22077 !! wikitext
22078 foo
22079 <references />
22080 !! html/parsoid
22081 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22082 !! end
22083
22084 #### ----------------------------------------------------------------
22085 #### Parsoid-only testing of Parsoid's impl of LST
22086 #### Not implemented yet, see
22087 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
22088 #### ----------------------------------------------------------------
22089
22090 !! test
22091 LST Sections: 1. Simple section start and end
22092 !! options
22093 parsoid={ "suppressErrors": true }
22094 !! wikitext
22095 <section begin="2011-05-16" />
22096 <section end="2014-04-10 (MW 1.23wmf22)" />
22097 !! html/parsoid
22098 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
22099 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
22100 !! end
22101
22102 #--------- Test stripping of empty nodes in template content ----------
22103 !!test
22104 Empty LI and TR nodes should be stripped from template content
22105 !!wikitext
22106 {{EmptyLITest}}
22107 {{EmptyTRTest}}
22108 !!html/parsoid
22109 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
22110 <li>a</li>
22111 <li>b</li>
22112 </ul>
22113 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
22114 <tbody>
22115 <tr>
22116 <td>foo</td>
22117 </tr>
22118 <tr>
22119 <td>bar</td>
22120 </tr>
22121 </tbody>
22122 </table>
22123 !!end
22124
22125 !!test
22126 Empty LI and TR nodes should not be stripped from top-level content
22127 !!wikitext
22128 * a
22129 *
22130 * b
22131 {|
22132 |-
22133 |-
22134 |foo
22135 |}
22136 !!html/parsoid
22137 <ul>
22138 <li> a</li>
22139 <li></li>
22140 <li> b</li>
22141 </ul>
22142 <table>
22143 <tbody>
22144 <tr></tr>
22145 <tr>
22146 <td>foo</td>
22147 </tr>
22148 </tbody>
22149 </table>
22150 !!end
22151
22152 !!test
22153 Empty TR nodes should not be stripped if they have any attributes set
22154 !!wikitext
22155 {{EmptyTRWithHTMLAttrTest}}
22156 !!html/parsoid
22157 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
22158 <tr align="center"></tr>
22159 <tr><td>foo</td></tr>
22160 <tr align="center"></tr>
22161 <tr><td>bar</td></tr>
22162 </table>
22163 !!end
22164
22165 #### ----------------------------------------------------------------
22166 #### The following section of tests are primarily to test
22167 #### wikitext escaping capabilities of Parsoid. Given that
22168 #### escaping can be done any number of ways, the wikitext (input)
22169 #### is always adjusted to reflect how Parsoid adds nowiki
22170 #### escape tags.
22171 ####
22172 #### We are marking several tests as parsoid-only since the
22173 #### HTML in the result section is different from what the
22174 #### PHP parser generates for it.
22175 #### ----------------------------------------------------------------
22176
22177
22178 #### --------------- Headings ---------------
22179 #### 0. Unnested
22180 #### 1. Nested inside html <h1>=foo=</h1>
22181 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
22182 #### 3. Nested inside html with wikitext split by html tags
22183 #### 4. No escape needed
22184 #### 5. Empty headings <h1></h1>
22185 #### 6. Heading chars in SOL context
22186 #### ----------------------------------------
22187 !! test
22188 Headings: 0. Unnested
22189 !! options
22190 parsoid=html2wt
22191 !! html/parsoid
22192 <p>=foo=</p>
22193
22194 <p> =foo=
22195 <!--cmt-->
22196 =foo=</p>
22197
22198 <p>=foo<i>a</i>=</p>
22199 !! wikitext
22200 <nowiki>=foo=</nowiki>
22201
22202 <nowiki> </nowiki>=foo=
22203 <!--cmt-->
22204 <nowiki>=foo=</nowiki>
22205
22206 =foo''a''<nowiki>=</nowiki>
22207 !!end
22208
22209 # New headings and existing headings are handled differently
22210 !! test
22211 Headings: 1. Nested inside html
22212 !! options
22213 parsoid=html2wt
22214 !! html/parsoid
22215 <h1>=foo=</h1>
22216 <h2>=foo=</h2>
22217 <h3>=foo=</h3>
22218
22219 <h1 data-parsoid=''>=foo=</h1>
22220 <h2 data-parsoid=''>=foo=</h2>
22221 <h3 data-parsoid=''>=foo=</h3>
22222 <h4 data-parsoid=''>=foo=</h4>
22223 <h5 data-parsoid=''>=foo=</h5>
22224 <h6 data-parsoid=''>=foo=</h6>
22225 !! wikitext
22226 = =foo= =
22227
22228 == =foo= ==
22229
22230 === =foo= ===
22231
22232 =<nowiki>=foo=</nowiki>=
22233 ==<nowiki>=foo=</nowiki>==
22234 ===<nowiki>=foo=</nowiki>===
22235 ====<nowiki>=foo=</nowiki>====
22236 =====<nowiki>=foo=</nowiki>=====
22237 ======<nowiki>=foo=</nowiki>======
22238
22239 !!end
22240
22241 !! test
22242 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
22243 !! options
22244 parsoid=html2wt
22245 !! html/parsoid
22246 <h1>foo</h1>*bar
22247 <h1>foo</h1>=bar
22248 <h1>foo</h1>=bar=
22249 !! wikitext
22250 = foo =
22251 <nowiki>*</nowiki>bar
22252
22253 = foo =
22254 =bar
22255
22256 = foo =
22257 <nowiki>=bar=</nowiki>
22258 !!end
22259
22260 !! test
22261 Headings: 3. Nested inside html with wikitext split by html tags
22262 !! options
22263 parsoid=html2wt
22264 !! html/parsoid
22265 <h1>=<b>bold</b>foo=</h1>
22266 !! wikitext
22267 = ='''bold'''<nowiki>foo=</nowiki> =
22268 !!end
22269
22270 !! test
22271 Headings: 4a. No escaping needed (testing just h1 and h2)
22272 !! options
22273 parsoid=html2wt
22274 !! html/parsoid
22275 <h1>=foo</h1>
22276 <h1>foo=</h1>
22277 <h1> =foo= </h1>
22278 <h1>=foo= bar</h1>
22279 <h2>=foo</h2>
22280 <h2>foo=</h2>
22281 <h1>=</h1>
22282 <h1><i>=</i>foo=</h1>
22283 !! wikitext
22284 = =foo =
22285
22286 = foo= =
22287
22288 = =foo= =
22289
22290 = =foo= bar =
22291
22292 == =foo ==
22293
22294 == foo= ==
22295
22296 = = =
22297
22298 = ''=''foo= =
22299 !!end
22300
22301 !! test
22302 Headings: 4b. No escaping needed (inside p-tags)
22303 !! options
22304 parsoid=html2wt
22305 !! html/parsoid
22306 <p>===
22307 =foo= x
22308 =foo= <s></s>
22309 </p>
22310 !! wikitext
22311 ===
22312 =foo= x
22313 =foo= <s></s>
22314 !!end
22315
22316 !! test
22317 Headings: 5. Empty headings
22318 !! options
22319 parsoid=html2wt
22320 !! html/parsoid
22321 <h1 data-parsoid='{}'></h1>
22322
22323 <h2 data-parsoid='{}'></h2>
22324
22325 <h3 data-parsoid='{}'></h3>
22326
22327 <h4 data-parsoid='{}'></h4>
22328
22329 <h5 data-parsoid='{}'></h5>
22330
22331 <h6 data-parsoid='{}'></h6>
22332 !! wikitext
22333 =<nowiki/>=
22334
22335 ==<nowiki/>==
22336
22337 ===<nowiki/>===
22338
22339 ====<nowiki/>====
22340
22341 =====<nowiki/>=====
22342
22343 ======<nowiki/>======
22344 !!end
22345
22346 !! test
22347 Headings: 6a. Heading chars in SOL context (with trailing spaces)
22348 !! options
22349 parsoid=html2wt
22350 !! html/parsoid
22351 <p>=a=</p>
22352
22353 <p>=a=</p>
22354
22355 <p>=a=</p>
22356 !! wikitext
22357 <nowiki>=a=</nowiki>
22358
22359 <nowiki>=a=</nowiki>
22360
22361 <nowiki>=a=</nowiki>
22362 !!end
22363
22364 !! test
22365 Headings: 6b. Heading chars in SOL context (with trailing newlines)
22366 !! options
22367 parsoid=html2wt
22368 !! html/parsoid
22369 <p>=a=
22370 b</p>
22371
22372 <p>=a=
22373 b</p>
22374
22375 <p>=a=
22376 b</p>
22377 !! wikitext
22378 <nowiki>=a=</nowiki>
22379 b
22380
22381 <nowiki>=a=</nowiki>
22382 b
22383
22384 <nowiki>=a=</nowiki>
22385 b
22386 !!end
22387
22388 !! test
22389 Headings: 6c. Heading chars in SOL context (leading newline break)
22390 !! options
22391 parsoid=html2wt
22392 !! html/parsoid
22393 <p>a
22394 =b=</p>
22395 !! wikitext
22396 a
22397 <nowiki>=b=</nowiki>
22398 !!end
22399
22400 !! test
22401 Headings: 6d. Heading chars in SOL context (with interspersed comments)
22402 !! options
22403 parsoid=html2wt
22404 !! html/parsoid
22405 <!--c0--><p>=a=</p>
22406
22407 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
22408 !! wikitext
22409 <!--c0--><nowiki>=a=</nowiki>
22410
22411 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
22412 !!end
22413
22414 !! test
22415 Headings: 6d. Heading chars in SOL context (No escaping needed)
22416 !! options
22417 parsoid=html2wt
22418 !! html/parsoid
22419 =a=<div>b</div>
22420 !! wikitext
22421 =a=<div>b</div>
22422 !!end
22423
22424 !! test
22425 Headings: 7. Insert a newline between new content and headings
22426 !! options
22427 parsoid=html2wt
22428 !! html/parsoid
22429 <h2>NEW</h2>
22430 <p>new</p>
22431 <h2 data-parsoid='{}'>A</h2>
22432 <p data-parsoid='{}'>a</p>
22433 !! wikitext
22434 == NEW ==
22435 new
22436
22437 ==A==
22438 a
22439
22440 !! end
22441
22442 #### --------------- Lists ---------------
22443 #### 0. Outside nests (*foo, etc.)
22444 #### 1. Nested inside html <ul><li>*foo</li></ul>
22445 #### 2. Inside definition lists
22446 #### 3. Only bullets at start should be escaped
22447 #### 4. No escapes needed
22448 #### 5. No unnecessary escapes
22449 #### 6. Escape bullets in SOL position
22450 #### 7. Escape bullets in a multi-line context
22451 #### ----------------------------------------
22452
22453 !! test
22454 Lists: 0. Outside nests
22455 !! options
22456 parsoid=html2wt
22457 !! html/parsoid
22458 <p>*foo</p>
22459
22460 <p>#foo</p>
22461
22462 <p>;Foo:bar</p>
22463 !! wikitext
22464 <nowiki>*</nowiki>foo
22465
22466 <nowiki>#</nowiki>foo
22467
22468 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
22469 !!end
22470
22471 !! test
22472 Lists: 1. Nested inside html
22473 !! options
22474 parsoid=html2wt
22475 !! html/parsoid
22476 <ul><li>*foo</li></ul>
22477 <ul><li>#foo</li></ul>
22478 <ul><li>:foo</li></ul>
22479 <ul><li>;foo</li></ul>
22480 <ol><li>*foo</li></ol>
22481 <ol><li>#foo</li></ol>
22482 <ol><li>:foo</li></ol>
22483 <ol><li>;foo</li></ol>
22484
22485 !! wikitext
22486 *<nowiki>*foo</nowiki>
22487
22488 *<nowiki>#foo</nowiki>
22489
22490 *<nowiki>:foo</nowiki>
22491
22492 *<nowiki>;foo</nowiki>
22493
22494 #<nowiki>*foo</nowiki>
22495
22496 #<nowiki>#foo</nowiki>
22497
22498 #<nowiki>:foo</nowiki>
22499
22500 #<nowiki>;foo</nowiki>
22501 !!end
22502
22503 !! test
22504 Lists: 2. Inside definition lists
22505 !! options
22506 parsoid=html2wt
22507 !! html/parsoid
22508 <dl><dt>;foo</dt></dl>
22509 <dl><dt>:foo</dt></dl>
22510 <dl><dt>:foo</dt>
22511 <dd>bar</dd></dl>
22512 <dl><dd>:foo</dd></dl>
22513
22514 !! wikitext
22515 ;<nowiki>;foo</nowiki>
22516
22517 ;<nowiki>:foo</nowiki>
22518
22519 ;<nowiki>:foo</nowiki>
22520 :bar
22521
22522 :<nowiki>:foo</nowiki>
22523 !!end
22524
22525 !! test
22526 Lists: 3. Only bullets at start of text should be escaped
22527 !! options
22528 parsoid=html2wt
22529 !! html/parsoid
22530 <ul><li>*foo*bar</li></ul>
22531 <ul><li>*foo<i>it</i>*bar</li></ul>
22532
22533 !! wikitext
22534 *<nowiki>*foo*bar</nowiki>
22535
22536 *<nowiki>*foo</nowiki>''it''*bar
22537 !!end
22538
22539 !! test
22540 Lists: 4. No escapes needed
22541 !! options
22542 parsoid=html2wt
22543 !! html/parsoid
22544 <ul>
22545 <li>foo*bar
22546 </li>
22547 </ul>
22548 <ul>
22549 <li><i>foo</i>*bar
22550 </li>
22551 </ul>
22552 <ul>
22553 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
22554 </li>
22555 </ul>
22556 <ul>
22557 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
22558 </li>
22559 </ul>
22560 !! wikitext
22561 *foo*bar
22562
22563 *''foo''*bar
22564
22565 *[[Foo]]: bar
22566
22567 *[[Foo]]*bar
22568 !!end
22569
22570 !! test
22571 Lists: 5. No unnecessary escapes
22572 !! options
22573 parsoid=html2wt
22574 !! html/parsoid
22575 <ul><li> bar <span>[[foo]]</span></li></ul>
22576 <ul><li> =bar <span>[[foo]]</span></li></ul>
22577 <ul><li> [[bar <span>[[foo]]</span></li></ul>
22578 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
22579 <ul><li> =bar <span>foo]]</span>=</li></ul>
22580 <ul><li> <s></s>: a</li></ul>
22581 <ul><li> <i>* foo</i></li></ul>
22582
22583 !! wikitext
22584 * bar <span><nowiki>[[foo]]</nowiki></span>
22585
22586 * =bar <span><nowiki>[[foo]]</nowiki></span>
22587
22588 * [[bar <span><nowiki>[[foo]]</nowiki></span>
22589
22590 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
22591
22592 * =bar <span>foo]]</span>=
22593
22594 * <s></s>: a
22595
22596 * ''* foo''
22597 !!end
22598
22599 !! test
22600 Lists: 6. Escape bullets in SOL position
22601 !! options
22602 parsoid=html2wt
22603 !! html/parsoid
22604 <p><!--cmt-->*foo</p>
22605 !! wikitext
22606 <!--cmt--><nowiki>*</nowiki>foo
22607 !!end
22608
22609 !! test
22610 Lists: 7. Escape bullets in a multi-line context
22611 !! options
22612 parsoid=html2wt
22613 !! html/parsoid
22614 <p>a
22615 *b
22616 </p>
22617 !! wikitext
22618 a
22619 <nowiki>*</nowiki>b
22620 !!end
22621
22622 !! test
22623 Lists: 8. Escape colons only if not present in tags
22624 !! options
22625 parsoid=html2wt
22626 !! html/parsoid
22627 <dl><dt>a:b<i>c:d</i></dt></dl>
22628 !! wikitext
22629 ; <nowiki>a:b</nowiki>''c:d''
22630 !! end
22631
22632 #### --------------- HRs ---------------
22633 #### 1. Single line
22634 #### -----------------------------------
22635
22636 !! test
22637 HRs: 1. Single line
22638 !! options
22639 parsoid=html2wt
22640 !! html/parsoid
22641 <hr />----
22642 <hr />=foo=
22643 <hr />*foo
22644 !! wikitext
22645 ----<nowiki>----</nowiki>
22646 ----=foo=
22647 ----*foo
22648 !! end
22649
22650 #### --------------- Tables ---------------
22651 #### 1a. Simple example
22652 #### 1b. No escaping needed (!foo)
22653 #### 1c. No escaping needed (|foo)
22654 #### 1d. No escaping needed (|}foo)
22655 ####
22656 #### 2a. Nested in td (<td>foo|bar</td>)
22657 #### 2b. Nested in td (<td>foo||bar</td>)
22658 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
22659 ####
22660 #### 3a. Nested in th (<th>foo!bar</th>)
22661 #### 3b. Nested in th (<th>foo!!bar</th>)
22662 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
22663 ####
22664 #### 4a. Escape -
22665 #### 4b. Escape +
22666 #### 4c. No escaping needed
22667 #### --------------------------------------
22668
22669 !! test
22670 Tables: 1a. Simple example
22671 !! options
22672 parsoid=html2wt
22673 !! html/parsoid
22674 <p>{|
22675 |}
22676 </p>
22677 !! wikitext
22678 <nowiki>{|</nowiki>
22679 |}
22680 !! end
22681
22682 !! test
22683 Tables: 1b. No escaping needed
22684 !! options
22685 parsoid=html2wt
22686 !! html/parsoid
22687 <p>!foo
22688 </p>
22689 !! wikitext
22690 !foo
22691 !! end
22692
22693 !! test
22694 Tables: 1c. No escaping needed
22695 !! options
22696 parsoid=html2wt
22697 !! html/parsoid
22698 <p>|foo
22699 </p>
22700 !! wikitext
22701 |foo
22702 !! end
22703
22704 !! test
22705 Tables: 1d. No escaping needed
22706 !! options
22707 parsoid=html2wt
22708 !! html/parsoid
22709 <p>|}foo
22710 </p>
22711 !! wikitext
22712 |}foo
22713 !! end
22714
22715 !! test
22716 Tables: 2a. Nested in td
22717 !! options
22718 parsoid=html2wt
22719 !! html/parsoid
22720 <table><tbody><tr>
22721 <td>foo|bar</td></tr>
22722 <tr><td>x<div>a|b</div></td>
22723 </tbody></table>
22724 !! wikitext
22725 {|
22726 |<nowiki>foo|bar</nowiki>
22727 |-
22728 |x<div><nowiki>a|b</nowiki></div>
22729 |}
22730 !! html/php+tidy
22731 <table>
22732 <tr>
22733 <td>foo|bar</td>
22734 </tr>
22735 <tr>
22736 <td>x
22737 <div>a|b</div>
22738 </td>
22739 </tr>
22740 </table>
22741 !! end
22742
22743 !! test
22744 Tables: 2b. Nested in td
22745 !! options
22746 parsoid=html2wt
22747 !! html/parsoid
22748 <table><tbody><tr>
22749 <td>foo||bar</td>
22750 <td>a<i>b||c</i></td>
22751 <td>a<i><div>b||c</div></i></td>
22752 </tr></tbody></table>
22753 !! wikitext
22754 {|
22755 |<nowiki>foo||bar</nowiki>
22756 |a''<nowiki>b||c</nowiki>''
22757 |a''<div><nowiki>b||c</nowiki></div>''
22758 |}
22759 !! html/php
22760 <table>
22761 <tr>
22762 <td>foo||bar
22763 </td>
22764 <td>a<i>b||c</i>
22765 </td>
22766 <td>a<i><div>b||c</div></i>
22767 </td></tr></table>
22768
22769 !! end
22770
22771 !! test
22772 Tables: 2c. Nested in td -- no escaping needed
22773 !! options
22774 parsoid=html2wt
22775 !! html/*
22776 <table>
22777
22778 <tr>
22779 <td>foo!!bar
22780 </td></tr></table>
22781
22782 !! wikitext
22783 {|
22784
22785 |foo!!bar
22786 |}
22787 !! end
22788
22789 !! test
22790 Tables: 3a. Nested in th
22791 !! options
22792 parsoid=html2wt
22793 !! html/*
22794 <table>
22795
22796 <tr>
22797 <th>foo!bar
22798 </th></tr></table>
22799
22800 !! wikitext
22801 {|
22802
22803 !foo!bar
22804 |}
22805 !! end
22806
22807 !! test
22808 Tables: 3b. Nested in th
22809 !! options
22810 parsoid=html2wt
22811 !! html/parsoid
22812 <table><tbody>
22813 <tr><th>foo!!bar</th>
22814 <th><i>foo|bar</i></th>
22815 <th><i>foo!!bar</i></th>
22816 <th><i><span>foo!!bar</span></i></th>
22817 </tr></tbody></table>
22818 !! wikitext
22819 {|
22820 !<nowiki>foo!!bar</nowiki>
22821 !''<nowiki>foo|bar</nowiki>''
22822 !''<nowiki>foo!!bar</nowiki>''
22823 !''<span><nowiki>foo!!bar</nowiki></span>''
22824 |}
22825 !! html/php
22826 <table>
22827 <tr>
22828 <th>foo!!bar
22829 </th>
22830 <th><i>foo|bar</i>
22831 </th>
22832 <th><i>foo!!bar</i>
22833 </th>
22834 <th><i><span>foo!!bar</span></i>
22835 </th></tr></table>
22836
22837 !! end
22838
22839 !! test
22840 Tables: 3c. Nested in th
22841 !! options
22842 parsoid=html2wt
22843 !! html/parsoid
22844 <table><tbody>
22845 <tr><th>foo||bar</th>
22846 <th><span typeof="mw:Nowiki">foo||bar</span></th>
22847 </tr></tbody></table>
22848 !! wikitext
22849 {|
22850 !<nowiki>foo||bar</nowiki>
22851 !<nowiki>foo||bar</nowiki>
22852 |}
22853 !! html/php
22854 <table>
22855 <tr>
22856 <th>foo||bar
22857 </th>
22858 <th>foo||bar
22859 </th></tr></table>
22860
22861 !! end
22862
22863 !! test
22864 Tables: 4a. Escape -
22865 !! options
22866 parsoid=html2wt
22867 !! html/*
22868 <table>
22869
22870 <tr>
22871 <th>-bar
22872 </th></tr>
22873 <tr>
22874 <td>-bar
22875 </td></tr></table>
22876
22877 !! wikitext
22878 {|
22879
22880 !-bar
22881
22882 |-
22883 |<nowiki>-bar</nowiki>
22884 |}
22885 !! end
22886
22887 !! test
22888 Tables: 4b. Escape +
22889 !! options
22890 parsoid=html2wt
22891 !! html/*
22892 <table>
22893
22894 <tr>
22895 <th>+bar
22896 </th></tr>
22897 <tr>
22898 <td>+bar
22899 </td></tr></table>
22900
22901 !! wikitext
22902 {|
22903
22904 !+bar
22905
22906 |-
22907 |<nowiki>+bar</nowiki>
22908 |}
22909 !! end
22910
22911 !! test
22912 Tables: 4c. No escaping needed
22913 !! options
22914 parsoid=html2wt
22915 !! html/parsoid
22916 <table><tbody>
22917 <tr><td>foo-bar</td><td>foo+bar</td></tr>
22918 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
22919 <tr><td>foo
22920 <p>bar|baz
22921 +bar
22922 -bar</p></td></tr>
22923 <tr><td>x
22924 <div>a|b</div></td>
22925 </tbody></table>
22926 !! wikitext
22927 {|
22928 |foo-bar
22929 |foo+bar
22930 |-
22931 |''foo''-bar
22932 |''foo''+bar
22933 |-
22934 |foo
22935 bar|baz
22936 +bar
22937 -bar
22938 |-
22939 |x
22940 <div>a|b</div>
22941 |}
22942 !! html/php
22943 <table>
22944 <tr>
22945 <td>foo-bar
22946 </td>
22947 <td>foo+bar
22948 </td></tr>
22949 <tr>
22950 <td><i>foo</i>-bar
22951 </td>
22952 <td><i>foo</i>+bar
22953 </td></tr>
22954 <tr>
22955 <td>foo
22956 <p>bar|baz
22957 +bar
22958 -bar
22959 </p>
22960 </td></tr>
22961 <tr>
22962 <td>x
22963 <div>a|b</div>
22964 </td></tr></table>
22965
22966 !! end
22967
22968 !! test
22969 Tables: 4d. No escaping needed
22970 !! options
22971 parsoid=html2wt
22972 !! html/parsoid
22973 <table>
22974 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
22975 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
22976 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
22977 </tbody></table>
22978 !! wikitext
22979 {|
22980 |[[Foo]]-bar
22981 ||+1
22982 ||-2
22983 |}
22984 !! html/php
22985 <table>
22986 <tr>
22987 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
22988 </td>
22989 <td>+1
22990 </td>
22991 <td>-2
22992 </td></tr></table>
22993
22994 !! end
22995
22996 !! test
22997 T97430: Don't emit empty nowiki pairs around marker meta tags
22998 !! options
22999 parsoid=html2wt
23000 !! html/parsoid
23001 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23002 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
23003 !! wikitext
23004 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23005 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
23006 !! end
23007
23008 !! test
23009 Unclosed xmlish element in table line shouldn't eat end delimiters
23010 !! options
23011 parsoid=html2wt
23012 !! html/parsoid
23013 <table>
23014 <tbody><tr><td> &lt;foo</td>
23015 <td> bar></td></tr>
23016 </tbody></table>
23017 !! wikitext
23018 {|
23019 | <foo
23020 | bar>
23021 |}
23022 !! html/php
23023 <table>
23024 <tr>
23025 <td> &lt;foo
23026 </td>
23027 <td> bar&gt;
23028 </td></tr></table>
23029
23030 !! end
23031
23032 #### --------------- Links ----------------
23033 #### 1. Quote marks in link text
23034 #### 2. Wikilinks: Escapes needed
23035 #### 3. Wikilinks: No escapes needed
23036 #### 4. Extlinks: Escapes needed
23037 #### 5. Extlinks: No escapes needed
23038 #### --------------------------------------
23039 !! test
23040 Links 1. WikiLinks: No escapes needed
23041 !! options
23042 parsoid=html2wt
23043 !! html/parsoid
23044 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
23045 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
23046 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
23047 !! wikitext
23048 [[Foo|Foo''boo'']]
23049 [[Foo|[Foobar]]]
23050 [[Foo|x [Foobar] x]]
23051 !! html/php
23052 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
23053 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
23054 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
23055 </p>
23056 !! end
23057
23058 !! test
23059 Links 2. WikiLinks: Escapes needed
23060 !! options
23061 parsoid=html2wt
23062 !! html/parsoid
23063 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
23064 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
23065 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
23066 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
23067 <a href="Foo" rel="mw:WikiLink">|Bar</a>
23068 <a href="Foo" rel="mw:WikiLink">]]bar</a>
23069 <a href="Foo" rel="mw:WikiLink">[[bar</a>
23070 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
23071 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
23072 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
23073 !! wikitext
23074 [[Foo|<nowiki>Foobar]</nowiki>]]
23075 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
23076 [[Foo|<nowiki>[[Bar]]</nowiki>]]
23077 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
23078 [[Foo|<nowiki>|Bar</nowiki>]]
23079 [[Foo|<nowiki>]]bar</nowiki>]]
23080 [[Foo|<nowiki>[[bar</nowiki>]]
23081 [[Foo|<nowiki>x [[ y</nowiki>]]
23082 [[Foo|<nowiki>x ]] y</nowiki>]]
23083 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
23084 !! html/php
23085 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
23086 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
23087 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
23088 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
23089 <a href="/wiki/Foo" title="Foo">|Bar</a>
23090 <a href="/wiki/Foo" title="Foo">]]bar</a>
23091 <a href="/wiki/Foo" title="Foo">[[bar</a>
23092 <a href="/wiki/Foo" title="Foo">x [[ y</a>
23093 <a href="/wiki/Foo" title="Foo">x ]] y</a>
23094 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
23095 </p>
23096 !! end
23097
23098 !! test
23099 Links 3. WikiLinks: No escapes needed
23100 !! options
23101 parsoid=html2wt
23102 !! html/parsoid
23103 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
23104 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
23105 !! wikitext
23106 [[Foo|[Foobar]]
23107 [[Foo|foo|bar]]
23108 !! html/php
23109 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
23110 <a href="/wiki/Foo" title="Foo">foo|bar</a>
23111 </p>
23112 !! end
23113
23114 !! test
23115 Links 4. ExtLinks: Escapes needed
23116 !! options
23117 parsoid=html2wt
23118 !! html/parsoid
23119 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
23120 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
23121 <p>[http://google.com]</p>
23122 <p>[http://google.com google]</p>
23123 !! wikitext
23124 [http://google.com <nowiki>[google]</nowiki>]
23125 [http://google.com <nowiki>google]</nowiki>]
23126
23127 <nowiki>[http://google.com]</nowiki>
23128
23129 <nowiki>[http://google.com google]</nowiki>
23130
23131 !! html/php
23132 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
23133 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
23134 </p><p>[http://google.com]
23135 </p><p>[http://google.com google]
23136 </p>
23137 !! end
23138
23139 !! test
23140 Links 5. ExtLinks: No escapes needed
23141 !! options
23142 parsoid=html2wt
23143 !! html/parsoid
23144 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
23145 !! wikitext
23146 [http://google.com [google]
23147 !! html/php
23148 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
23149 </p>
23150 !! end
23151
23152 !! test
23153 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
23154 !! options
23155 parsoid=html2wt
23156 !! html/parsoid
23157 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
23158 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
23159 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
23160 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
23161 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
23162 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
23163 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23164 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
23165 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23166 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
23167 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
23168 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
23169 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
23170 </p>
23171 !! wikitext
23172 x<nowiki/>http://example.com<nowiki/>y
23173 http://example.com<nowiki/>?x
23174 http://example.com<nowiki/>&x
23175 http://example.com<nowiki/>'x
23176 http://example.com<nowiki/>,x
23177 http://example.com<nowiki/>.x
23178 http://example.com<nowiki/>;x
23179 http://example.com<nowiki/>:x
23180 http://example.com<nowiki/>;x
23181 http://example.com<nowiki/>!x
23182 http://example.com<nowiki/>=x
23183 http://example.com<nowiki/>(x)
23184 http://example.com(x<nowiki/>)
23185 !! end
23186
23187 !! test
23188 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23189 !! options
23190 parsoid=html2wt
23191 !! html/parsoid
23192 <p>x
23193 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
23194 y
23195 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
23196 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
23197 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
23198 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
23199 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
23200 </p>
23201 !! wikitext
23202 x
23203 http://example.com
23204 y
23205 "http://example.com"
23206 (http://example.com)
23207 (http://example.com) foo
23208 http://example.com,
23209 http://example.com, foo
23210 !! html/php
23211 <p>x
23212 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
23213 y
23214 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
23215 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
23216 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
23217 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
23218 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
23219 </p>
23220 !! end
23221
23222 !! test
23223 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23224 !! options
23225 parsoid=html2wt
23226 !! html/parsoid
23227 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
23228 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
23229 !! wikitext
23230 http://example.com.,;:!?\
23231 -http://example.com:
23232 !! html/php
23233 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
23234 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
23235 </p>
23236 !! end
23237
23238 !! test
23239 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
23240 !! options
23241 parsoid=html2wt
23242 !! html/parsoid
23243 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
23244 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
23245 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
23246 !! wikitext
23247 RFC 123<nowiki/>4
23248 RFC 123<nowiki/>y
23249 X<nowiki/>RFC 123<nowiki/>y
23250 !! end
23251
23252 !! test
23253 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
23254 !! options
23255 parsoid=html2wt
23256 !! html/parsoid
23257 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
23258 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
23259 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
23260 </p>
23261 !! wikitext
23262 RFC 123?foo
23263 RFC 123&foo
23264 -RFC 123-
23265 !! html/php
23266 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
23267 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
23268 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
23269 </p>
23270 !! end
23271
23272 !! test
23273 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
23274 !! options
23275 parsoid=html2wt
23276 !! html/parsoid
23277 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
23278 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23279 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23280 !! wikitext
23281 PMID 123<nowiki/>4
23282 PMID 123<nowiki/>y
23283 X<nowiki/>PMID 123<nowiki/>y
23284 !! end
23285
23286 !! test
23287 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
23288 !! options
23289 parsoid=html2wt
23290 !! html/parsoid
23291 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
23292 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
23293 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
23294 </p>
23295 !! wikitext
23296 PMID 123?foo
23297 PMID 123&foo
23298 -PMID 123-
23299 !! html/php
23300 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
23301 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
23302 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
23303 </p>
23304 !! end
23305
23306 !! test
23307 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
23308 !! options
23309 parsoid=html2wt
23310 !! html/parsoid
23311 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
23312 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
23313 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
23314 </p>
23315 !! wikitext
23316 ISBN 1234567890<nowiki/>1
23317 ISBN 1234567890<nowiki/>x
23318 a<nowiki/>ISBN 1234567890<nowiki/>b
23319 !! end
23320
23321 !! test
23322 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
23323 !! options
23324 parsoid=html2wt
23325 !! html/parsoid
23326 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
23327 !! wikitext
23328 -ISBN 1234567890's
23329 !! html/php
23330 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
23331 </p>
23332 !! end
23333
23334 !! test
23335 Links 14. Protect link-like plain text. (Parsoid bug T78425)
23336 !! options
23337 parsoid=html2wt
23338 !! html/*
23339 <p>this is not a link: http://example.com
23340 </p>
23341 !! wikitext
23342 this is not a link: <nowiki>http://example.com</nowiki>
23343 !! end
23344
23345 !! test
23346 Links 15. Link trails can't become link prefixes.
23347 !! options
23348 language=is
23349 parsoid=html2wt
23350 !! html/parsoid
23351 <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>
23352 !! wikitext
23353 [[Söfnuður]]-[[00]]
23354 !! html/php
23355 <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>
23356 </p>
23357 !! end
23358
23359 #### --------------- Quotes ---------------
23360 #### 1. Quotes inside <b> and <i>
23361 #### 2. Link fragments separated by <i> and <b> tags
23362 #### 3. Link fragments inside <i> and <b>
23363 #### 4. No escaping needed
23364 #### --------------------------------------
23365 !! test
23366 1a. Quotes inside <b> and <i>
23367 !! options
23368 parsoid=html2wt
23369 !! html/*
23370 <p><i>'foo'</i>
23371 <i>''foo''</i>
23372 <i>'''foo'''</i>
23373 <i>foo</i>'s
23374 <b>'foo'</b>
23375 <b>''foo''</b>
23376 <b>'''foo'''</b>
23377 <b>foo'<i>bar'</i>baz</b>
23378 <b>foo</b>'s
23379 '<i>foo</i>
23380 <i>foo</i>'
23381 <i>foo'</i>'
23382 '<i>foo</i>'
23383 '<b>foo</b>
23384 <b>foo</b>'
23385 '<b>foo</b>'
23386 <i>fools'<span> errand</span></i>
23387 <i><span>fool</span>'s errand</i>
23388 '<i>foo</i> bar '<i>baz</i>
23389 a|!*#-:;+-~[]{}b'<i>x</i>
23390 </p>
23391 !! wikitext
23392 ''<nowiki/>'foo'''
23393 ''<nowiki>''foo''</nowiki>''
23394 ''<nowiki>'''foo'''</nowiki>''
23395 ''foo''<nowiki/>'s
23396 '''<nowiki/>'foo''''
23397 '''<nowiki>''foo''</nowiki>'''
23398 '''<nowiki>'''foo'''</nowiki>'''
23399 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
23400 '''foo'''<nowiki/>'s
23401 '''foo''
23402 ''foo''<nowiki/>'
23403 ''foo'''<nowiki/>'
23404 '''foo''<nowiki/>'
23405 ''''foo'''
23406 '''foo'''<nowiki/>'
23407 ''''foo'''<nowiki/>'
23408 ''fools'<span> errand</span>''
23409 ''<span>fool</span>'s errand''
23410 '<nowiki/>''foo'' bar '''baz''
23411 a|!*#-:;+-~[]{}b'''x''
23412 !! end
23413
23414 !! test
23415 1b. Quotes inside <b> and <i> with other tags on same line
23416 !! options
23417 parsoid=html2wt
23418 !! html/parsoid
23419 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23420 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23421 <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>
23422 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
23423 '<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>
23424 '<i>foo</i> <div title="name">test</div>
23425 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
23426 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
23427 <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>
23428 </ol>
23429 !! wikitext
23430 '''a'' foo ''[[bar]]''
23431 ''a''' foo ''[[bar]]''
23432 ''a''' foo '''{{echo|[[bar]]}}'''
23433 [[foo]] x'''[[bar]]''
23434 '''foo'' <ref>test</ref>
23435 '''foo'' <div title="name">test</div>
23436 '''foo'' and <br> bar
23437 <references />
23438 !! end
23439
23440 !! test
23441 2. Link fragments separated by <i> and <b> tags
23442 !! options
23443 parsoid=html2wt
23444 !! html/parsoid
23445 <p>[[<i>foo</i>hello]]</p>
23446 <p>[[<b>foo</b>hello]]</p>
23447 !! wikitext
23448 [[''foo''<nowiki>hello]]</nowiki>
23449
23450 [['''foo'''<nowiki>hello]]</nowiki>
23451 !! end
23452
23453 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
23454 # this is one of the shortcomings of this format
23455 !! test
23456 3. Link fragments inside <i> and <b>
23457 !! options
23458 parsoid=html2wt
23459 !! html/parsoid
23460 <p><i>[[foo</i>]]</p>
23461 <p><b>[[foo</b>]]</p>
23462 !! wikitext
23463 ''[[foo''<nowiki>]]</nowiki>
23464
23465 '''[[foo'''<nowiki>]]</nowiki>
23466 !! end
23467
23468 !! test
23469 4. No escaping needed
23470 !! options
23471 options=html2wt
23472 !! html/parsoid
23473 <p>'<span><i>bar</i></span>'
23474 '<span><b>bar</b></span>'
23475 'a:b'foo
23476 </p>
23477 !! wikitext
23478 '<span>''bar''</span>'
23479 '<span>'''bar'''</span>'
23480 'a:b'foo
23481 !! end
23482
23483 #### ----------- Paragraphs ---------------
23484 #### 1. No unnecessary escapes
23485 #### --------------------------------------
23486
23487 !! test
23488 1. No unnecessary escapes
23489 !! options
23490 parsoid=html2wt
23491 !! html/parsoid
23492 <p>bar <span>[[foo]]</span>
23493 </p><p>=bar <span>[[foo]]</span>
23494 </p><p>[[bar <span>[[foo]]</span>
23495 </p><p>]]bar <span>[[foo]]</span>
23496 </p><p>=bar <span>foo]]</span>=
23497 </p>
23498 !! wikitext
23499 bar <span><nowiki>[[foo]]</nowiki></span>
23500
23501 =bar <span><nowiki>[[foo]]</nowiki></span>
23502
23503 [[bar <span><nowiki>[[foo]]</nowiki></span>
23504
23505 ]]bar <span><nowiki>[[foo]]</nowiki></span>
23506
23507 =bar <span>foo]]</span><nowiki>=</nowiki>
23508 !!end
23509
23510 #### ----------------------- PRE --------------------------
23511 #### 1. Leading whitespace in SOL context should be escaped
23512 #### ------------------------------------------------------
23513 !! test
23514 1. Leading whitespace in SOL context should be escaped
23515 !! options
23516 parsoid=html2wt
23517 !! html/parsoid
23518 <p> a</p>
23519
23520 <p> a</p>
23521
23522 <p> a(tab)</p>
23523
23524 <p> a
23525 <!--cmt-->
23526 a</p>
23527
23528 <p>a
23529 b</p>
23530
23531 <p>a
23532 b</p>
23533
23534 <p>a
23535 b</p>
23536 !! wikitext
23537 <nowiki> </nowiki>a
23538
23539 <nowiki> </nowiki> a
23540
23541 a(tab)
23542
23543 <nowiki> </nowiki> a
23544 <!--cmt-->
23545 <nowiki> </nowiki>a
23546
23547 a
23548 <nowiki> </nowiki>b
23549
23550 a
23551 b
23552
23553 a
23554 b
23555 !! html/php
23556 <p> a
23557 </p><p> a
23558 </p><p> a(tab)
23559 </p><p> a
23560 a
23561 </p><p>a
23562 b
23563 </p><p>a
23564 b
23565 </p><p>a
23566 b
23567 </p>
23568 !! end
23569
23570 !! test
23571 2. Leading whitespace in non-indent-pre contexts should not be escaped
23572 !! options
23573 parsoid=htm2wt
23574 !! html/parsoid
23575 <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>
23576 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23577 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><i data-parsoid='{"dsr":[9,14,2,2]}'>a</i>
23578 b</span></li>
23579 </ol>
23580 !! wikitext
23581 foo <ref>''a''
23582 b</ref>
23583 <references />
23584 !! end
23585
23586 !! test
23587 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
23588 !! options
23589 parsoid=html2wt
23590 !! html/parsoid
23591 <blockquote>
23592 <p>
23593 a
23594 <span>b</span>
23595 c</p>
23596 </blockquote>
23597 !! wikitext
23598 <blockquote>
23599 a
23600 <span>b</span>
23601 c
23602 </blockquote>
23603 !! end
23604
23605 !! test
23606 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
23607 !! options
23608 options=html2wt
23609 !! html/parsoid
23610 <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>
23611 !! wikitext
23612 [[File:Foobar.jpg|thumb|caption]]
23613 !! end
23614
23615 !! test
23616 5. Nowiki escaping should account for indent-pres
23617 !! options
23618 parsoid=html2wt
23619 !! html/parsoid
23620 <pre>==foo==</pre>
23621 !! wikitext
23622 ==foo==
23623 !! end
23624
23625 !!test
23626 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
23627 !! options
23628 parsoid=html2wt
23629 !! html/parsoid
23630 <pre>
23631 * foo
23632 * bar
23633 </pre>
23634 !! wikitext
23635 * foo
23636 * bar
23637 !! end
23638
23639 #### --------------- Behavior Switches --------------------
23640
23641 !! test
23642 1. Valid behavior switches should be escaped
23643 !! options
23644 parsoid=html2wt
23645 !! html/parsoid
23646 __TOC__
23647 <i>__TOC__</i>
23648 !! wikitext
23649 <nowiki>__TOC__</nowiki>
23650 ''<nowiki>__TOC__</nowiki>''
23651 !! end
23652
23653 !! test
23654 2. Invalid behavior switches should not be escaped
23655 !! options
23656 parsoid=html2wt
23657 !! html/parsoid
23658 __TOO__
23659 __|__
23660 !! wikitext
23661 __TOO__
23662 __|__
23663 !! end
23664
23665 # We use indent-pre as an indirect way to test for sol-transparent behavior.
23666 !! test
23667 Behavior switches should be SOL-transparent
23668 !! options
23669 parsoid=html2wt
23670 !! html/parsoid
23671 <meta property="mw:PageProp/toc" />
23672
23673 <!-- this one's bogus -->
23674 <pre>__TOO__</pre>
23675
23676 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
23677
23678 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
23679 !! wikitext
23680 __TOC__
23681
23682 <!-- this one's bogus -->
23683 __TOO__
23684
23685 __TOC__ foo
23686
23687 __TOC__
23688 bar
23689 !! end
23690
23691 #### --------------- HTML tags ---------------
23692 #### 1. a tags
23693 #### 2. other tags
23694 #### 3. multi-line html tag
23695 #### 4. extension tags
23696 #### -----------------------------------------
23697 !! test
23698 1. a tags
23699 !! options
23700 parsoid=html2wt
23701 !! html/parsoid
23702 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
23703 !! wikitext
23704 <a href="http://google.com">google</a>
23705 !! end
23706
23707 !! test
23708 2. other tags
23709 !! options
23710 parsoid=html2wt
23711 !! html/parsoid
23712 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
23713 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
23714 <li> &lt;td&gt;</li></ul>
23715
23716 !! wikitext
23717 * <nowiki><div>foo</div></nowiki>
23718 * <nowiki><div style="color:red">foo</div></nowiki>
23719 * <nowiki><td></nowiki>
23720 !! end
23721
23722 !! test
23723 3. multi-line html tag
23724 !! options
23725 parsoid=html2wt
23726 !! html/parsoid
23727 <p>&lt;div
23728 &gt;foo&lt;/div
23729 &gt;
23730 </p>
23731 !! wikitext
23732 <nowiki><div
23733 >foo</div
23734 ></nowiki>
23735 !! end
23736
23737 !! test
23738 4. extension tags
23739 !! options
23740 parsoid=html2wt
23741 !! html/parsoid
23742 <p>&lt;ref&gt;foo&lt;/ref&gt;
23743 </p><p>&lt;ref&gt;bar
23744 </p><p>baz&lt;/ref&gt;
23745 </p>
23746 !! wikitext
23747 <nowiki><ref>foo</ref></nowiki>
23748
23749 <nowiki><ref>bar</nowiki>
23750
23751 baz<nowiki></ref></nowiki>
23752 !! end
23753
23754 #### --------------- Others ---------------
23755 !! test
23756 Escaping nowikis
23757 !! options
23758 parsoid=html2wt
23759 !! html/parsoid
23760 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
23761 </p>
23762 !! wikitext
23763 &lt;nowiki&gt;foo&lt;/nowiki&gt;
23764 !! end
23765
23766 ## The quote-char in the input is necessary for triggering the bug
23767 !! test
23768 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
23769 !! options
23770 parsoid=html2wt
23771 !! html/parsoid
23772 <p>foo's bar :</p>
23773 !! wikitext
23774 foo's bar :
23775 !! end
23776
23777 #----------- End of wikitext escaping tests --------------
23778
23779 !! test
23780
23781 Tag-like HTML structures are passed through as text
23782 !! wikitext
23783 <x y>
23784
23785 <x.y>
23786
23787 <x-y>
23788
23789 1>2
23790
23791 x<y
23792
23793 a>b
23794
23795 1<d e>f
23796 !! html
23797 <p>&lt;x y&gt;
23798 </p><p>&lt;x.y&gt;
23799 </p><p>&lt;x-y&gt;
23800 </p><p>1&gt;2
23801 </p><p>x&lt;y
23802 </p><p>a&gt;b
23803 </p><p>1&lt;d e&gt;f
23804 </p>
23805 !! end
23806
23807 !! test
23808 HTML tag with necessary entities in attributes
23809 !! wikitext
23810 <span title="&amp;amp;">foo</span>
23811 !! html
23812 <p><span title="&amp;amp;">foo</span>
23813 </p>
23814 !! end
23815
23816 !! test
23817 HTML tag with 'unnecessary' entity encoding in attributes
23818 !! wikitext
23819 <span title="&amp;">foo</span>
23820 !! html
23821 <p><span title="&amp;">foo</span>
23822 </p>
23823 !! end
23824
23825 !! test
23826 HTML tag with broken attribute value quoting
23827 !! wikitext
23828 <span title="Hello world>Foo</span>
23829 !! html/php
23830 <p><span title="Hello world">Foo</span>
23831 </p>
23832 !! html/parsoid
23833 <p><span title="Hello world">Foo</span>
23834 </p>
23835 !! end
23836
23837 !! test
23838 Self-closed tag with broken attribute value quoting
23839 !! options
23840 parsoid=wt2html,html2html
23841 !! wikitext
23842 <div title="Hello world />Foo
23843 !! html/php+tidy
23844 <div title="Hello world"></div>
23845 <p>Foo</p>
23846 !! html/parsoid
23847 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
23848 !! end
23849
23850 !! test
23851 Table with broken attribute value quoting
23852 !! wikitext
23853 {|
23854 | title="Hello world|Foo
23855 |}
23856 !! html/php
23857 <table>
23858 <tr>
23859 <td title="Hello world">Foo
23860 </td></tr></table>
23861
23862 !! html/parsoid
23863 <table>
23864 <tr>
23865 <td title="Hello world">Foo
23866 </td></tr></table>
23867
23868 !! end
23869
23870 !! test
23871 Table with broken attribute value quoting on consecutive lines
23872 !! wikitext
23873 {|
23874 | title="Hello world|Foo
23875 | style="color:red|Bar
23876 |}
23877 !! html/php
23878 <table>
23879 <tr>
23880 <td title="Hello world">Foo
23881 </td>
23882 <td style="color:red">Bar
23883 </td></tr></table>
23884
23885 !! html/parsoid
23886 <table><tbody>
23887 <tr>
23888 <td title="Hello world">Foo
23889 </td><td style="color: red">Bar
23890 </td></tr></tbody></table>
23891
23892 !! end
23893
23894 !! test
23895 2. Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23896 !! options
23897 parsoid
23898 !! wikitext
23899 {{}}
23900 !! html
23901 {{}}
23902 !! end
23903
23904 !! test
23905 1. Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23906 !! options
23907 parsoid
23908 !! wikitext
23909 }}{{
23910 !! html
23911 }}{{
23912 !! end
23913
23914 !!test
23915 Accept empty td cell attribute
23916 !! wikitext
23917 {|
23918 | align="center" | foo || |
23919 |}
23920 !! html
23921 <table>
23922 <tr>
23923 <td align="center"> foo </td>
23924 <td>
23925 </td></tr></table>
23926
23927 !!end
23928
23929 !!test
23930 Non-empty attributes in th-cells
23931 !! wikitext
23932 {|
23933 ! Foo !! style="color: red" | Bar
23934 |}
23935 !! html
23936 <table>
23937 <tr>
23938 <th> Foo </th>
23939 <th style="color: red"> Bar
23940 </th></tr></table>
23941
23942 !!end
23943
23944 !!test
23945 Accept empty attributes in th-cells
23946 !! wikitext
23947 {|
23948 !| foo !!| bar
23949 |}
23950 !! html
23951 <table>
23952 <tr>
23953 <th> foo </th>
23954 <th> bar
23955 </th></tr></table>
23956
23957 !!end
23958
23959 !!test
23960 Empty table rows go away
23961 !! wikitext
23962 {|
23963 | Hello
23964 | there
23965 |- class="foo"
23966 |-
23967 |}
23968 !! html
23969 <table>
23970 <tr>
23971 <td> Hello
23972 </td>
23973 <td> there
23974 </td></tr>
23975
23976 </table>
23977
23978 !! end
23979
23980 ###
23981 ### Parsoid-centric tests for testing RTing of inter-element separators
23982 ### Edge cases not tested by existing parser tests and specific to
23983 ### Parsoid-specific serialization strategies.
23984 ###
23985
23986 !!test
23987 RT-ed inter-element separators should be valid separators
23988 !! wikitext
23989 {|
23990 |- [[foo]]
23991 |}
23992 !! html/php
23993 <table>
23994
23995 </table>
23996
23997 !! html/parsoid
23998 <table>
23999 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
24000 </tbody></table>
24001 !!end
24002
24003 # Parsoid-only since PHP parser relies on Tidy for correct output
24004 !!test
24005 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
24006 !!options
24007 parsoid
24008 !! wikitext
24009 {|
24010 |<small>foo
24011 bar
24012 |}
24013
24014 {|
24015 |<small>foo<small>
24016 |}
24017 !! html
24018 <table>
24019 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
24020 <p>bar</p></small></td></tr>
24021 </tbody></table>
24022
24023 <table>
24024 <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>
24025 </tbody></table>
24026 !!end
24027
24028 # Note that the "style" attribute is really a template parameter here.
24029 # The = would have to be {{=}} if you wanted the literal.
24030 !!test
24031 Empty TD followed by TD with tpl-generated attribute
24032 !! wikitext
24033 {|
24034 |-
24035 |
24036 |{{echo|style='color:red'}}|foo
24037 |}
24038 !! html
24039 <table>
24040
24041 <tr>
24042 <td>
24043 </td>
24044 <td>foo
24045 </td></tr></table>
24046
24047 !!end
24048
24049 !!test
24050 Indented table with an empty td
24051 !! wikitext
24052 {|
24053 |-
24054 |
24055 |foo
24056 |}
24057 !! html
24058 <table>
24059
24060 <tr>
24061 <td>
24062 </td>
24063 <td>foo
24064 </td></tr></table>
24065
24066 !!end
24067
24068 ## We have some newline diffs RT-ing this edge case
24069 ## and it is not important enough -- we seem to be emitting
24070 ## at most 2 newlines after a </tr> and this is unrelated to
24071 ## the issue from T85627 that this is testing.
24072 !!test
24073 Indented table with blank lines in between (T85627)
24074 !! options
24075 parsoid=wt2html
24076 !! wikitext
24077 {|
24078 |foo
24079
24080
24081 |}
24082 !! html
24083 <table>
24084
24085 <tr>
24086 <td>foo
24087 </td></tr></table>
24088
24089 !!end
24090
24091 !!test
24092 Indented block & table
24093 !! wikitext
24094 <div>foo</div>
24095 {|
24096 |foo
24097 |}
24098 !! html/php
24099 <div>foo</div>
24100 <table>
24101 <tr>
24102 <td>foo
24103 </td></tr></table>
24104
24105 !! html/parsoid
24106 <div data-parsoid='{"stx":"html"}'>foo</div>
24107 <table><tbody>
24108 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
24109 </tbody></table>
24110 !!end
24111
24112 !! test
24113 Indent and comment before table row
24114 !! wikitext
24115 {|
24116 <!--hi-->|-
24117 | there
24118 |}
24119 !! html/php
24120 <table>
24121
24122 <tr>
24123 <td> there
24124 </td></tr></table>
24125
24126 !! html/parsoid
24127 <table>
24128 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
24129 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
24130 </tbody></table>
24131 !! end
24132
24133 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
24134 !!test
24135 Empty TR followed by a template-generated TR
24136 !!options
24137 parsoid
24138 !! wikitext
24139 {|
24140 |-
24141 {{echo|<tr><td>foo</td></tr>}}
24142 |}
24143 !! html
24144 <table>
24145 <tbody>
24146 <tr></tr>
24147 <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}}]}'>
24148 <td>foo</td></tr>
24149 </tbody></table>
24150 !!end
24151
24152 ## PHP and parsoid output differ for this, and since this is primarily
24153 ## for testing Parsoid's serializer, marking this Parsoid only
24154 !!test
24155 Empty TR followed by mixed-ws-comment line should RT correctly
24156 !!options
24157 parsoid
24158 !! wikitext
24159 {|
24160 |-
24161 <!--c-->
24162 |-
24163 <!--c--> <!--d-->
24164 |}
24165 !! html
24166 <table>
24167 <tbody>
24168 <tr></tr>
24169 <!--c-->
24170 <tr>
24171 <!--c--> </tr><!--d-->
24172 </tbody></table>
24173
24174 !!end
24175
24176 !!test
24177 Multi-line image caption generated by templates with/without trailing newlines
24178 !! wikitext
24179 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
24180 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
24181 !! html/parsoid
24182 <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>
24183 <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>
24184 !!end
24185
24186 !! test
24187 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
24188 !! options
24189 parsoid=html2wt
24190 !! html/parsoid
24191 <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>
24192
24193 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
24194 !! wikitext
24195 <includeonly>foo</includeonly>
24196 new para
24197
24198 [[Category:Foo]]
24199
24200 = new heading =
24201 !! end
24202
24203 ## PHP emits broken html for this, and since this is primarily
24204 ## a Parsoid serializer test, marking this Parsoid only
24205 !!test
24206 Improperly nested inline or quotes tags with whitespace in between
24207 !! wikitext
24208 <span> <s>x</span> </s>
24209 ''' ''x''' ''
24210 !! html/parsoid
24211 <p><span> <s>x</s></span><s> </s>
24212 <b> <i>x</i></b><i> </i>
24213 </p>
24214 !!end
24215
24216 !!test
24217 Encapsulate protected attributes from wt
24218 !! wikitext
24219 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
24220 !! html/parsoid
24221 <body><div data-x-typeof="mw:placeholder stuff" data-x-data-mw="whoo" data-x-data-parsoid="weird" data-x-data-parsoid-other="no" data-x-about="time" data-x-rel="mw:true">foo</div>
24222 </body>
24223 !!end
24224
24225 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
24226 ## Having nested or stray pre tags results in the attempt to add duplicates,
24227 ## causing an assertion fail. This test tries to prevent that situation.
24228 !!test
24229 Ensure ParagraphWrapper can deal with stray closing pre tags
24230 !!options
24231 parsoid=wt2html
24232 !! wikitext
24233 plain text</pre>
24234 !! html/parsoid
24235 plain text
24236 !!end
24237
24238 !!test
24239 1. Ensure fostered text content is wrapped in element nodes
24240 !!options
24241 parsoid=wt2html
24242 !! wikitext
24243 <table>hi</table><table>ho</table>
24244 !! html/parsoid
24245 <p>hi</p>
24246 <table></table>
24247 <p>ho</p>
24248 <table></table>
24249 !!end
24250
24251 !!test
24252 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
24253 !!options
24254 parsoid=wt2html,wt2wt
24255 !! wikitext
24256 <table>
24257 <tr> || ||
24258 <td> a
24259 </table>
24260 !! html/parsoid
24261 <p> || ||
24262 </p><table>
24263 <tbody><tr><td> a</td></tr>
24264 </tbody></table>
24265 !!end
24266
24267 !!test
24268 Encapsulation properly handles null DSR information from foster box
24269 !!options
24270 parsoid=wt2html,wt2wt
24271 !! wikitext
24272 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
24273 !! html/parsoid
24274 <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>
24275 !!end
24276
24277 !!test
24278 1. Encapsulate foster-parented transclusion content
24279 !!options
24280 parsoid=wt2wt,wt2html
24281 !! wikitext
24282 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
24283 !! html/parsoid
24284 <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>
24285 <tbody>
24286 <tr>
24287 <td>bar</td>
24288 </tr>
24289 </tbody>
24290 </table>
24291 !!end
24292
24293 !!test
24294 2. Encapsulate foster-parented transclusion content
24295 !!options
24296 parsoid=wt2wt,wt2html
24297 !! wikitext
24298 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
24299 !! html/parsoid
24300 <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>
24301 <table>
24302 <tbody>
24303 <tr>
24304 <td>bar</td>
24305 </tr>
24306 </tbody>
24307 </table>
24308 !!end
24309
24310 !!test
24311 3. Encapsulate foster-parented transclusion content
24312 !!options
24313 parsoid=wt2wt,wt2html
24314 !! wikitext
24315 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24316 !! html/parsoid
24317 <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;]}">
24318 <p>foo</p>
24319 </div>
24320 <table>
24321 <tbody>
24322 <tr>
24323 <td>bar</td>
24324 </tr>
24325 </tbody>
24326 </table>
24327 !!end
24328
24329 !!test
24330 4. Encapsulate foster-parented transclusion content
24331 !!options
24332 parsoid=wt2wt,wt2html
24333 !! wikitext
24334 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24335 !! html/parsoid
24336 <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;]}">
24337 <p>foo</p>
24338 </div>
24339 <table>
24340 <tbody>
24341 <tr>
24342 <td>bar</td>
24343 </tr>
24344 </tbody>
24345 </table>
24346 !!end
24347
24348 !!test
24349 5. Encapsulate foster-parented transclusion content
24350 !!options
24351 parsoid=wt2wt,wt2html
24352 !! wikitext
24353 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
24354 !! html/parsoid
24355 <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>
24356 <table>
24357 <tbody>
24358 <tr>
24359 <td>
24360 <div>
24361 <p>foo</p>
24362 </div>
24363 </td>
24364 </tr>
24365 </tbody>
24366 </table>
24367 !!end
24368
24369 !!test
24370 6. Encapsulate foster-parented transclusion content
24371 !!options
24372 parsoid=wt2wt,wt2html
24373 !! wikitext
24374 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
24375 !! html/parsoid
24376 <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>
24377 <table>
24378 <tbody>
24379 <tr>
24380 <td>
24381 <div>
24382 <p>foo</p>
24383 </div>
24384 </td>
24385 </tr>
24386 </tbody>
24387 </table>
24388 <p>ok</p>
24389 !!end
24390
24391 !!test
24392 7. Encapsulate foster-parented transclusion content
24393 !!options
24394 parsoid=wt2wt,wt2html
24395 !! wikitext
24396 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
24397 !! html/parsoid
24398 <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>
24399 <table>
24400 <tbody>
24401 <tr>
24402 <td>bar</td>
24403 </tr>
24404 </tbody>
24405 </table>
24406 !!end
24407
24408 # Note that the wt is broken on purpose: the = should be {{=}} if you
24409 # don't want it to be a template parameter key.
24410 !!test
24411 8. Encapsulate foster-parented transclusion content
24412 !!options
24413 parsoid=wt2wt,wt2html
24414 !! wikitext
24415 {{echo|a
24416 }}{|{{echo|style='color:red'}}
24417 |-
24418 |b
24419 |}
24420 !! html/parsoid
24421 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
24422 <span> </span>
24423 <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>
24424 <table>
24425 <tbody>
24426 <tr>
24427 <td>b</td>
24428 </tr>
24429 </tbody>
24430 </table>
24431 !!end
24432
24433 !!test
24434 9. Encapsulate foster-parented transclusion content
24435 !!options
24436 parsoid=wt2wt,wt2html
24437 !! wikitext
24438 <table>{{echo|hi</table>hello}}
24439 !! html/parsoid
24440 <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","spc":["","","",""]}]]}'>hi</p><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><p about="#mwt2">hello</p>
24441 !!end
24442
24443 !!test
24444 Table in fosterable position
24445 !!options
24446 parsoid=wt2html,wt2wt
24447 !! wikitext
24448 {{OpenTable}}
24449 <div>
24450 {|
24451 |}
24452 </div>
24453 |}
24454 !! html/parsoid
24455 <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"OpenTable","href":"./Template:OpenTable"},"params":{},"i":0}},"\n&lt;div>"]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[]]}'></div><span about="#mwt1">
24456 </span>
24457 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
24458
24459 <table>
24460 </table>
24461 !!end
24462
24463 # Parsoid only for bug 64747
24464 !! test
24465 Properly encapsulate empty-content transclusions in fosterable positions
24466 !! wikitext
24467 <table>
24468 {{#if:|
24469 <td>foo</td>
24470 }}
24471 </table>
24472 !! html/parsoid
24473 <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","spc":["","","",""]}]]}'>
24474
24475 </table>
24476 !! end
24477
24478 !! test
24479 Always encapsulate foster box when template range is expanded to table
24480 !! options
24481 parsoid=wt2wt
24482 !! wikitext
24483 {|
24484 hello
24485 {{OpenTable}}
24486 |}
24487 !! html/parsoid
24488
24489 !! end
24490
24491 !!test
24492 Support <object> element with .data attribute
24493 !!options
24494 parsoid=html2wt
24495 !! html/parsoid
24496 <object data="test.swf"></object>
24497 !! wikitext
24498 <object data="test.swf"></object>
24499 !!end
24500
24501 !! test
24502 Don't block XML namespace declaration
24503 !! wikitext
24504 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24505 !! html/php
24506 <p><span>MediaWiki</span>
24507 </p>
24508 !! html/parsoid
24509 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
24510 !! end
24511
24512 # -----------------------------------------------------------------
24513 # The following section of tests are primarily to spec requirements
24514 # around serialization of new/edited content.
24515 #
24516 # All these tests are marked Parsoid html2wt and html2html only
24517 # ----------------------------------------------------------------
24518
24519 # 'mi' is a localinterwiki prefix as well as a language
24520 !! test
24521 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
24522 !! options
24523 parsoid=html2wt
24524 !! html/parsoid
24525 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
24526 !! wikitext
24527 [[Foo]]
24528 !! end
24529
24530 # See T93839
24531 !! test
24532 New wikilinks should be serialized properly
24533 !! options
24534 parsoid=html2wt
24535 !! html/parsoid
24536 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
24537 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
24538 !! wikitext
24539 [[Foo]]
24540 [[Foo]]
24541 !! end
24542
24543 !! test
24544 New wiki links (href variations)
24545 !! options
24546 parsoid=html2wt
24547 !! html/parsoid
24548 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24549 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
24550 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
24551 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
24552 !! wikitext
24553 [[Foo_bar]]
24554 [[Foo_bar]]
24555 [[Foo_bar]]
24556 [[Toxine bactérienne]]
24557 !! end
24558
24559 !! test
24560 New wiki links (content string variations)
24561 !! options
24562 parsoid=html2wt
24563 !! html/parsoid
24564 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24565 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
24566 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
24567 !! wikitext
24568 [[Foo_bar]]
24569 [[Foo bar]]
24570 [[Foo_bar|./Foo_bar]]
24571 !! end
24572
24573 !! test
24574 New category links (href variations)
24575 !! options
24576 parsoid=html2wt
24577 !! html/parsoid
24578 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
24579 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
24580 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
24581 !! wikitext
24582 [[Category:Toxine bactérienne]]
24583 [[Category:Toxine bactérienne]]
24584 [[Category:Toxine bactérienne]]
24585 !! end
24586
24587 !! test
24588 New sol transparent links don't need indent-pre nowiki protection
24589 !! options
24590 parsoid=html2wt
24591 language=de
24592 !! html/parsoid
24593 <link rel="mw:PageProp/redirect" href="./Main_Page">
24594 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
24595 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
24596 !! wikitext
24597 #WEITERLEITUNG [[Main Page]]
24598 <!-- this is good --> [[Category:Good]]
24599 <!-- this is great --> [[Kategorie:Great]]
24600 !! end
24601
24602 !! test
24603 New interlanguage links (href variations)
24604 !! options
24605 parsoid=html2wt
24606 !! html/parsoid
24607 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
24608 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
24609 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
24610 !! wikitext
24611 [[es:Toxine bactérienne]]
24612 [[es:Toxine_bactérienne]]
24613 [[es:Toxine_bactérienne]]
24614 !! end
24615
24616 !! test
24617 Image: Modifying size of an image (1)
24618 !! options
24619 parsoid={
24620 "modes": ["wt2wt"],
24621 "changes": [
24622 ["img[height]", "attr", "height", "22"],
24623 ["img[width]", "attr", "width", "200"]
24624 ]
24625 }
24626 !! wikitext
24627 [[Image:Foobar.jpg|230x230px]]
24628 !! wikitext/edited
24629 [[Image:Foobar.jpg|200x200px]]
24630 !!end
24631
24632 !! test
24633 Image: Modifying size of an image (2)
24634 !! options
24635 parsoid={
24636 "modes": ["wt2wt"],
24637 "changes": [
24638 ["img[height]", "attr", "height", "100"],
24639 ["img[width]", "attr", "width", "500"]
24640 ]
24641 }
24642 !! wikitext
24643 [[Image:Foobar.jpg|230x230px]]
24644 !! wikitext/edited
24645 [[Image:Foobar.jpg|500x500px]]
24646 !!end
24647
24648 # Change in size is ignored so long as class='mw-default-size'
24649 !! test
24650 Image: Modifying size of an image (3)
24651 !! options
24652 parsoid={
24653 "modes": ["wt2wt"],
24654 "changes": [
24655 ["figure[class]", "removeClass", "mw-default-size"],
24656 ["figure img", "attr", "height", "19"],
24657 ["figure img", "attr", "width", "170"]
24658 ]
24659 }
24660 !! wikitext
24661 [[Image:Foobar.jpg|thumb]]
24662 !! wikitext/edited
24663 [[Image:Foobar.jpg|thumb|170x170px]]
24664 !!end
24665
24666 !! test
24667 Image: Modifying alignment of an image (bug 48665)
24668 !! options
24669 parsoid={
24670 "modes": ["wt2wt"],
24671 "changes": [
24672 ["figure[class]", "removeClass", "mw-halign-right"],
24673 ["figure[class]", "addClass", "mw-halign-left"]
24674 ]
24675 }
24676 !! wikitext
24677 [[Image:Foobar.jpg|thumb|caption|right]]
24678 !! wikitext/edited
24679 [[Image:Foobar.jpg|thumb|caption|left]]
24680 !! end
24681
24682 !! test
24683 Image: Modifying mw-default-size of an frameless image (bug 62805)
24684 !! options
24685 parsoid={
24686 "modes": ["wt2wt"],
24687 "changes": [
24688 ["figure.mw-default-size", "removeClass", "mw-default-size"]
24689 ]
24690 }
24691 !! wikitext
24692 [[Image:Foobar.jpg|frameless|right]]
24693 !! wikitext/edited
24694 [[Image:Foobar.jpg|frameless|right|220x220px]]
24695 !! end
24696
24697 !! test
24698 Image: Modifying valign of an image (bug 49221)
24699 !! options
24700 parsoid={
24701 "modes": ["wt2wt"],
24702 "changes": [
24703 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
24704 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
24705 ]
24706 }
24707 !! wikitext
24708 [[File:Foobar.jpg|20px|middle]]
24709 !! wikitext/edited
24710 [[File:Foobar.jpg|20px|text-top]]
24711 !! end
24712
24713 !! test
24714 Image: Modifying alt attribute of an image (bug 56400)
24715 !! options
24716 parsoid={
24717 "modes": ["wt2wt"],
24718 "changes": [
24719 ["img[alt]", "attr", "alt", "some alternate edited text"]
24720 ]
24721 }
24722 !! wikitext
24723 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
24724 !! wikitext/edited
24725 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
24726 !!end
24727
24728 !! test
24729 Image: Modifying caption of an image
24730 !! options
24731 parsoid={
24732 "modes": ["wt2wt"],
24733 "changes": [
24734 ["figcaption", "text", "new caption"]
24735 ]
24736 }
24737 !! wikitext
24738 [[Image:Foobar.jpg|thumb|original caption]]
24739 !! wikitext/edited
24740 [[Image:Foobar.jpg|thumb|new caption]]
24741 !!end
24742
24743 !! test
24744 Image: empty alt attribute (bug 48924)
24745 !! options
24746 parsoid
24747 !! wikitext
24748 [[File:Foobar.jpg|thumb|alt=|bar]]
24749 !! html
24750 <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>
24751 !! end
24752
24753 !! test
24754 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
24755 !! options
24756 parsoid=html2wt
24757 language=ar
24758 disabled
24759 !! html/parsoid
24760 <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>
24761 !! wikitext
24762 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
24763 !! end
24764
24765 !! test
24766 Image: Block level image should have \n before and after
24767 !! wikitext
24768 123
24769 [[File:Foobar.jpg|right|thumb|150x150px]]
24770 456
24771 !! html/parsoid
24772 <p>123</p>
24773 <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>
24774 <p>456</p>
24775 !!end
24776
24777 !! test
24778 Image: New block level image should have \n before and after (existing content)
24779 !! wikitext
24780 123
24781 [[File:Foobar.jpg|right|thumb|150x150px]]
24782 456
24783 !! html/parsoid
24784 <p>123</p>
24785 <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>
24786 <p>456</p>
24787 !!end
24788
24789 !! test
24790 Image: upright option (parsoid)
24791 !! wikitext
24792 [[File:Foobar.jpg|thumb|upright|caption]]
24793 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
24794 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
24795 !! html/parsoid
24796 <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>
24797 <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>
24798 <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>
24799 !!end
24800
24801 !! test
24802 Image: upright option is ignored on inline and frame images (parsoid)
24803 !! wikitext
24804 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
24805 !! html/parsoid
24806 <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>
24807 !!end
24808
24809 !! test
24810 Image: from basic HTML (1)
24811 !! options
24812 parsoid=html2wt
24813 !! html/parsoid
24814 <span typeof="mw:Image">
24815 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24816 </span>
24817 !! wikitext
24818 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24819 !! end
24820
24821 !! test
24822 Image: from basic HTML (2)
24823 !! options
24824 parsoid=html2wt
24825 !! html/parsoid
24826 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24827 !! wikitext
24828 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24829 !! end
24830
24831 !! test
24832 Image: from basic HTML (3)
24833 !! options
24834 parsoid=html2wt
24835 !! html/parsoid
24836 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
24837 !! wikitext
24838 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
24839 !! end
24840
24841 !! test
24842 Image: from basic HTML (4)
24843 !! options
24844 parsoid=html2wt
24845 !! html/parsoid
24846 <img src="./File:Foobar.jpg">
24847 !! wikitext
24848 [[File:Foobar.jpg|link=]]
24849 !! end
24850
24851 !! test
24852 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
24853 !! options
24854 parsoid=html2wt
24855 !! html/parsoid
24856 <ul>
24857 <li><p>foo</p></li>
24858 </ul>
24859 !! wikitext
24860 * foo
24861 !! end
24862
24863 !! test
24864 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
24865 !! options
24866 parsoid=html2wt
24867 !! html/parsoid
24868 <ul> <li>foo</li></ul>
24869 !! wikitext
24870 * foo
24871 !! end
24872
24873 !! test
24874 Don't strip leading whitespace when handling indent-pre suppressing tags
24875 !! options
24876 parsoid=html2wt
24877 !! html/parsoid
24878 <table>
24879 <tr><td> indented row</td></tr>
24880 </table>
24881 <blockquote><p>
24882 <b>This is very bold of you!</b>
24883 </p>
24884 <table><tr><td>
24885 indented cell (no pre-wrapping!)
24886 </td></tr></table>
24887 </blockquote>
24888 <p>foo</p>
24889 <div>bar</div>
24890 !! wikitext
24891 {|
24892 | indented row
24893 |}
24894 <blockquote>
24895 '''This is very bold of you!'''
24896
24897 {|
24898 |
24899 indented cell (no pre-wrapping!)
24900 |}
24901 </blockquote>
24902 foo
24903 <div>bar</div>
24904 !! end
24905
24906 !! test
24907 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
24908 !! options
24909 parsoid=html2wt
24910 !! html/parsoid
24911 <p>foo</p>
24912 <span>bar</span>
24913
24914 <span>foo2
24915 </span>bar2
24916
24917 <div>foo</div>
24918 <span>bar</span>
24919
24920 <div>
24921 <span>foo</span>
24922 </div>
24923 !! wikitext
24924 foo
24925
24926 <span>bar</span>
24927
24928 <span>foo2
24929 <nowiki> </nowiki></span>bar2
24930
24931 <div>foo</div>
24932 <nowiki> </nowiki><span>bar</span>
24933
24934 <div>
24935 <nowiki> </nowiki><span>foo</span>
24936 </div>
24937 !! end
24938
24939 !! test
24940 Lists: Dont insert newlines in a serialized list item.
24941 !! options
24942 parsoid=html2wt
24943 !! html/parsoid
24944 <ul><li>a<br>b</li><li>c</li></ul>
24945 !! wikitext
24946 * a<br>b
24947 * c
24948 !! end
24949
24950 !! test
24951 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
24952 !! options
24953 parsoid={
24954 "modes": ["html2wt"],
24955 "scrubWikitext": false
24956 }
24957 !! html/parsoid
24958 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
24959 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
24960
24961 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
24962 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
24963
24964 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
24965
24966 <h2><meta property="mw:PageProp/toc" /> ok</h2>
24967 !! wikitext
24968 == hello there [[Category:A1]] ==
24969
24970 == [[Category:A2]] hi pal ==
24971
24972 == <!--foo--> [[Category:A3]] how goes it ==
24973
24974 == it goes well [[Category:A4]] <!--bar--> ==
24975
24976 ==howdy [[Category:A5]]==
24977
24978 == __TOC__ ok ==
24979 !! end
24980
24981 !! test
24982 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
24983 !! options
24984 parsoid={
24985 "modes": ["html2wt"],
24986 "scrubWikitext": true
24987 }
24988 !! html/parsoid
24989 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
24990 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
24991
24992 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
24993 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
24994
24995 <h2><meta property="mw:PageProp/toc" /> ok</h2>
24996 !! wikitext
24997 == hello there ==
24998 [[Category:A1]]
24999 [[Category:A2]]
25000
25001 == hi pal ==
25002
25003 <!--foo--> [[Category:A3]]
25004
25005 == how goes it ==
25006
25007 == it goes well ==
25008 [[Category:A4]] <!--bar-->
25009
25010 __TOC__
25011
25012 == ok ==
25013 !! end
25014
25015 !! test
25016 Headings: Don't hoist metas that come from templates
25017 !! options
25018 parsoid={
25019 "modes": ["html2wt"],
25020 "scrubWikitext": true
25021 }
25022 !! html/parsoid
25023 <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>
25024 !! wikitext
25025 == {{echo|foo [[Category:Foo]]}} ==
25026 !! end
25027
25028 !! test
25029 Headings: Category in ref isn't hoisted
25030 !! options
25031 parsoid={
25032 "modes": ["html2wt"],
25033 "scrubWikitext": true
25034 }
25035 !! html/parsoid
25036 <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>
25037
25038 <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>
25039 !! wikitext
25040 == foo <ref>bar
25041 [[Category:Baz]] </ref> ==
25042
25043 <references />
25044 !! end
25045
25046 !! test
25047 Parsoid: Serialize positional parameters with = in them as named parameter
25048 !! options
25049 parsoid=html2wt
25050 !! html/parsoid
25051 <p about="#mwt1" typeof="mw:Transclusion"
25052 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
25053
25054 <p about="#mwt1" typeof="mw:Transclusion"
25055 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
25056
25057 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25058 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25059 <p data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]},{"k":"2","spc":["","","",""]}]]}' 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>
25060 !! wikitext
25061 {{echo|1 = f=oo}}
25062
25063 {{echo|1 = f=oo|2 = bar}}
25064
25065 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25066 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25067 {{echo|<nowiki>f=oo</nowiki>|bar}}
25068 !! end
25069
25070 !! test
25071 Parsoid: Serialize positional parameters with = in extlink as named parameter
25072 !! options
25073 parsoid=html2wt
25074 !! html/parsoid
25075 <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>
25076 !! wikitext
25077 {{echo|1 = http://stuff?is=ok}}
25078 !! end
25079
25080 !! test
25081 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
25082 !! options
25083 parsoid=html2wt
25084 !! html/parsoid
25085 <div>a<p>b</p></div>
25086 <div>a
25087 <p>b</p></div>
25088 <div>
25089 a
25090 <p>b</p></div>
25091 !! wikitext
25092 <div>a
25093 b
25094 </div>
25095 <div>a
25096 b
25097 </div>
25098 <div>
25099 a
25100
25101 b
25102 </div>
25103 !! end
25104
25105 !! test
25106 Substrings resembling wikitext in hrefs should not get nowiki escapes
25107 !! options
25108 parsoid=html2wt
25109 !! html/parsoid
25110 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
25111 !! wikitext
25112 [[Foo''bar''baz]]
25113 !! end
25114
25115 !! test
25116 Enforce single-line context in the serializer
25117 !! options
25118 parsoid=html2wt
25119 !! html/parsoid
25120 <h2>testing
25121 123</h2>
25122
25123 <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">
25124 </span><span about="#mwt1">you</span> </h2>
25125
25126 <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>
25127
25128 <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
25129 there</span></li></ol>
25130
25131 <ul><li>asd
25132 sdf</li></ul>
25133
25134 <ul><li>foo
25135 bar
25136 baz</li>
25137 <li>foo <b>bar</b>
25138 baz</li></ul>
25139
25140 <dl><dt>hi
25141 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
25142 ho</dd></dl>
25143
25144 <dl><dd> <table>
25145 <tbody><tr><td> ha
25146 ha
25147 ha</td></tr>
25148 </tbody></table></dd></dl>
25149 !! wikitext
25150 == testing 123 ==
25151
25152 == hi {{bogus|there
25153 you}} ==
25154
25155 == foo <ref>hello
25156 there</ref> ==
25157
25158 <references />
25159
25160 * asd sdf
25161
25162 * foo bar baz
25163 * foo '''bar''' baz
25164
25165 ; hi ho : hi ho
25166
25167 : {|
25168 | ha
25169 ha
25170 ha
25171 |}
25172 !! end
25173
25174 !! test
25175 Serialize new placeholder space without spans
25176 !! options
25177 parsoid=html2wt
25178 !! html/parsoid
25179 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
25180
25181 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
25182
25183 <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>
25184 !! wikitext
25185 foo : bar
25186
25187 foo : bar
25188
25189 <ref>foo : bar</ref>ok
25190 !! end
25191
25192
25193 #-----------------------
25194 # Tag minimization tests
25195 #-----------------------
25196
25197 !! test
25198 1. I/B quote minimization: wikitext-only tags should be combined
25199 !! options
25200 parsoid=html2wt
25201 !! html/parsoid
25202 <p><i>A</i><i>B</i></p>
25203 <p><b>A</b><b>B</b></p>
25204 <p><i>A</i><b><i>B</i></b></p>
25205 <p><b>A</b><i><b>B</b></i></p>
25206 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
25207 <p><i><b>A</b></i><i><b>B</b></i></p>
25208 <p><i><b>A</b></i><b><i>B</i></b></p>
25209 <p><b><i>A</i></b><i><b>B</b></i></p>
25210 !! wikitext
25211 ''AB''
25212
25213 '''AB'''
25214
25215 ''A'''B'''''
25216
25217 '''A''B'''''
25218
25219 '''A''BC''D'''
25220
25221 '''''AB'''''
25222
25223 '''''AB'''''
25224
25225 '''''AB'''''
25226 !! end
25227
25228 !! test
25229 2. I/B quote minimization: wikitext and html tags should not be combined
25230 !! options
25231 parsoid=html2wt
25232 !! html/parsoid
25233 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
25234 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
25235 !! wikitext
25236 ''A''<i>B</i>
25237
25238 ''A''<nowiki/>'''<i>B</i>'''
25239 !! end
25240
25241 !! test
25242 3. I/B quote minimization: templated content stops minimization
25243 !! options
25244 parsoid=html2wt
25245 !! html/parsoid
25246 <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>
25247 <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>
25248 !! wikitext
25249 ''A''{{echo|''B''}}
25250
25251 ''A''{{echo|'''''B'''''}}
25252 !! end
25253
25254 !! test
25255 4. I/B quote minimization: new content should be mimimized with adjacent old content
25256 !! options
25257 parsoid=html2wt
25258 !! html/parsoid
25259 <p><i>A</i><i>B</i></p>
25260 <p><b>A</b><b>B</b></p>
25261 <p><i>A</i><b><i>B</i></b></p>
25262 !! wikitext
25263 ''AB''
25264
25265 '''AB'''
25266
25267 ''A'''B'''''
25268 !! end
25269
25270 !! test
25271 5a. Merge adjacent quote nodes if they've been edited
25272 !! options
25273 parsoid={
25274 "modes": ["wt2wt", "selser"],
25275 "changes": [
25276 ["p", "contents", "remove", ":contains('b')"]
25277 ]
25278 }
25279 !! wikitext
25280 ''a''b''c''
25281 !! wikitext/edited
25282 ''ac''
25283 !! end
25284
25285 !! test
25286 5b. Merge adjacent quote nodes if they've been edited
25287 !! options
25288 parsoid={
25289 "modes": ["wt2wt", "selser"],
25290 "changes": [
25291 ["#x", "remove"]
25292 ]
25293 }
25294 !! wikitext
25295 ''a''<span id="x">b</span>''c''
25296 !! wikitext/edited
25297 ''ac''
25298 !! end
25299
25300 !! test
25301 1. Merge adjacent link nodes as long as at least one element is new
25302 !! options
25303 parsoid={
25304 "modes": ["html2wt"],
25305 "scrubWikitext": true
25306 }
25307 !! html/parsoid
25308 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25309 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25310 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
25311 !! wikitext
25312 [[Football]]
25313 [[Football]]
25314 [[Football|Foot]][[Football|ball]]
25315 !! end
25316
25317 !! test
25318 2. Merge adjacent link nodes and enable additional normalizations
25319 !! options
25320 parsoid={
25321 "modes": ["html2wt"],
25322 "scrubWikitext": true
25323 }
25324 !! html/parsoid
25325 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
25326 !! wikitext
25327 [[Football|''Football'']]
25328 !! end
25329
25330 !! test
25331 3. Don't merge adjacent link nodes if scrubWikitext is false
25332 !! options
25333 parsoid={
25334 "modes": ["html2wt"],
25335 "scrubWikitext": false
25336 }
25337 !! html/parsoid
25338 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25339 !! wikitext
25340 [[Football|Foot]][[Football|ball]]
25341 !! end
25342
25343 #------------------------------
25344 # End of tag minimization tests
25345 #------------------------------
25346
25347 !!test
25348 Bug 54262: New entities
25349 !! options
25350 parsoid=html2wt
25351 !! html/parsoid
25352 <span typeof="mw:Entity">&nbsp;</span>
25353 !! wikitext
25354 &nbsp;
25355 !! end
25356
25357 ## Note that there is no wikitext output for 'unknownproperty' ##
25358 ## Unknown magic words are silently dropped ##
25359
25360 !! test
25361 Magic words
25362 !! options
25363 parsoid=html2wt
25364 !! html/parsoid
25365 <meta property='mw:PageProp/toc' />
25366 <meta property='mw:PageProp/notoc' />
25367 <meta property='mw:PageProp/forcetoc' />
25368 <meta property='mw:PageProp/index' />
25369 <meta property='mw:PageProp/noindex' />
25370 <meta property='mw:PageProp/nogallery' />
25371 <meta property='mw:PageProp/noeditsection' />
25372 <meta property='mw:PageProp/notitleconvert' />
25373 <meta property='mw:PageProp/nocontentconvert' />
25374 <meta property='mw:PageProp/unknownproperty' />
25375 !! wikitext
25376 __TOC__
25377 __NOTOC__
25378 __FORCETOC__
25379 __INDEX__
25380 __NOINDEX__
25381 __NOGALLERY__
25382 __NOEDITSECTION__
25383 __NOTITLECONVERT__
25384 __NOCONTENTCONVERT__
25385 !! end
25386
25387 !! test
25388 Consecutive <pre>s should not get merged
25389 !! options
25390 parsoid=html2wt,html2html
25391 !! html/parsoid
25392 <pre>a</pre><pre>b</pre>
25393
25394 <pre>c
25395 </pre><pre>
25396 d</pre>
25397
25398 <pre>e
25399
25400 </pre><pre>
25401
25402 f</pre>
25403 !! wikitext
25404 a
25405
25406 b
25407
25408 c
25409
25410 d
25411
25412 e
25413
25414
25415
25416 f
25417 !! end
25418
25419 !! test
25420 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
25421 !! options
25422 parsoid=html2wt
25423 !! html/parsoid
25424 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
25425 !! wikitext
25426 [[Special:BookSources/1234567890|ISBN 1234567895]]
25427 !! end
25428
25429 !! test
25430 Edited RFC links not serializable as RFC links should serialize as extlinks
25431 !! options
25432 parsoid=html2wt
25433 !! html/parsoid
25434 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
25435 !! wikitext
25436 [//tools.ietf.org/html/rfc123 New RFC]
25437 !! end
25438
25439 !! test
25440 Edited PMID links not serializable as PMID links should serialize as extlinks
25441 !! options
25442 parsoid=html2wt
25443 !! html/parsoid
25444 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
25445 !! wikitext
25446 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
25447 !! end
25448
25449 !! test
25450 WTS of autolinks with trailing/surrounding context
25451 !! options
25452 parsoid=html2wt
25453 !! html/parsoid
25454 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
25455 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
25456 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
25457 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
25458 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
25459 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
25460 !! wikitext
25461 http://cscott.net'''foo'''
25462
25463 http://cscott.net<b>foo</b>
25464
25465 '''http://cscott.net'''
25466
25467 '''http://cscott.net '''
25468
25469 '''http://cscott.net<nowiki/>x'''
25470
25471 http://cscott.net<nowiki/>x
25472 !! end
25473
25474 !! test
25475 WTS of autolinks with nowikis (round-trip)
25476 !! wikitext
25477 x<nowiki/>http://cscott.net<nowiki/>x
25478 !! html/parsoid
25479 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
25480 !! end
25481
25482 # this is the "easy" test because it leaves in place all the
25483 # data-parsoid information indicating this is an autolink
25484 !! test
25485 WTS of autolinks with escapes (editing)
25486 !! options
25487 parsoid={
25488 "modes": ["wt2wt"],
25489 "changes": [
25490 [ "meta", "remove" ]
25491 ]
25492 }
25493 !! wikitext
25494 x<nowiki/>http://cscott.net<nowiki/>x
25495 !! wikitext/edited
25496 x<nowiki/>http://cscott.net<nowiki/>x
25497 !! end
25498
25499 !! test
25500 WTS of edited autolink-like text (T103364)
25501 !! options
25502 parsoid={
25503 "modes": ["wt2wt"],
25504 "changes": [
25505 [ "span[typeof]", "removeAttr", "typeof" ]
25506 ]
25507 }
25508 !! wikitext
25509 Not a link: <nowiki>http://example.com</nowiki>.
25510 !! wikitext/edited
25511 Not a link: <span><nowiki>http://example.com</nowiki></span>.
25512 !! end
25513
25514 !! test
25515 WTS of newly-authored autolink-like text (T103364)
25516 !! options
25517 parsoid=html2wt
25518 !! html/parsoid
25519 <p>http://example.com is not a link.</p>
25520 !! wikitext
25521 <nowiki>http://example.com</nowiki> is not a link.
25522 !! end
25523
25524 !! test
25525 WTS of autolink-like text after an autolink (T108563)
25526 !! options
25527 parsoid=html2wt
25528 !! html/parsoid
25529 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
25530 !! wikitext
25531 http://example.com <nowiki>http://example.com</nowiki> is not a link.
25532 !! end
25533
25534 !! test
25535 Magic links inside links (not autolinked)
25536 !! wikitext
25537 [[Foo|http://example.com]]
25538 [[Foo|RFC 1234]]
25539 [[Foo|PMID 1234]]
25540 [[Foo|ISBN 123456789x]]
25541
25542 [http://foo.com http://example.com]
25543 [http://foo.com RFC 1234]
25544 [http://foo.com PMID 1234]
25545 [http://foo.com ISBN 123456789x]
25546 !! html+tidy
25547 <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>
25548 <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>
25549 !! html/parsoid
25550 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
25551 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
25552 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
25553 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
25554
25555 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
25556 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
25557 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
25558 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
25559 !! end
25560
25561 !! test
25562 Magic links inside image captions (autolinked)
25563 !! wikitext
25564 [[File:Foobar.jpg|thumb|http://example.com]]
25565 [[File:Foobar.jpg|thumb|RFC 1234]]
25566 [[File:Foobar.jpg|thumb|PMID 1234]]
25567 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
25568 !! html+tidy
25569 <div class="thumb tright">
25570 <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>
25571 <div class="thumbcaption">
25572 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25573 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
25574 </div>
25575 </div>
25576 <div class="thumb tright">
25577 <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>
25578 <div class="thumbcaption">
25579 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25580 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
25581 </div>
25582 </div>
25583 <div class="thumb tright">
25584 <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>
25585 <div class="thumbcaption">
25586 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25587 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
25588 </div>
25589 </div>
25590 <div class="thumb tright">
25591 <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>
25592 <div class="thumbcaption">
25593 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25594 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
25595 </div>
25596 </div>
25597 !! html/parsoid
25598 <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>
25599 <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>
25600 <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>
25601 <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>
25602 !! end
25603
25604 !! test
25605 WTS of magic word text (T109371)
25606 !! options
25607 parsoid=html2wt
25608 !! html/parsoid
25609 <p>RFC 1234</p>
25610 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
25611 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
25612 !! wikitext
25613 <nowiki>RFC 1234</nowiki>
25614
25615 [http://foo.com RFC 1234]
25616
25617 [[Foo|RFC 1234]]
25618 !! end
25619
25620 !! test
25621 Edited Redirect link should emit a non-piped wikitext link
25622 !! options
25623 parsoid=html2wt
25624 !! html/parsoid
25625 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
25626 !! wikitext
25627 #REDIRECT [[Bar]]
25628 !! end
25629
25630 !! test
25631 T75121: Infer extension name from typeOf if data-mw is not present
25632 !! options
25633 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25634 !! html/parsoid
25635 <div typeOf="mw:Extension/foo"></div>
25636 !! wikitext
25637 <foo />
25638 !! end
25639
25640 # Note that the <p> wrapping isn't present in PHP parser output
25641 # The important thing for this test is that P-wrapping doesn't
25642 # interfere with the <nowiki> protection for leading - in <td>
25643 # (which isn't necessary for <th>).
25644 !! test
25645 T88318: p-wrapped dash in table.
25646 !! options
25647 parsoid=html2wt,wt2wt
25648 !! html/parsoid
25649 <table><tbody>
25650 <tr><th><p>-</p></th><th><p>- </p></th></tr>
25651 <tr><td><p>-</p></td><td><p>- </p></td></tr>
25652 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
25653 </tbody></table>
25654 !! wikitext
25655 {|
25656 !-
25657 !-
25658 |-
25659 |<nowiki>-</nowiki>
25660 |<nowiki>- </nowiki>
25661 |-
25662 |<small>-</small>
25663 |<br>
25664 -
25665 |<br>
25666 -
25667 |}
25668 !! html/php+tidy
25669 <table>
25670 <tr>
25671 <th>-</th>
25672 <th>-</th>
25673 </tr>
25674 <tr>
25675 <td>-</td>
25676 <td>-</td>
25677 </tr>
25678 <tr>
25679 <td><small>-</small></td>
25680 <td><br />
25681 <p>-</p>
25682 </td>
25683 <td><br />
25684 <p>-</p>
25685 </td>
25686 </tr>
25687 </table>
25688 !! end
25689
25690 !! test
25691 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
25692 !! options
25693 parsoid=html2wt
25694 !! html/parsoid
25695 <table id='mwAb'>
25696 <td id='mwAc'>foo</td>
25697 <td id='serialize-this'>bar</td>
25698 </table>
25699 !! wikitext
25700 {|
25701 |foo
25702 | id="serialize-this" |bar
25703 |}
25704 !! end
25705
25706 !! test
25707 Parsoid-like element ids should not be serialized to wikitext unless shadowed
25708 !! options
25709 parsoid=html2wt
25710 !! html/parsoid
25711 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
25712 !! wikitext
25713 <div id="hello">ok</div>
25714 !! end
25715
25716 !! test
25717 WTS change modes
25718 !! options
25719 parsoid={
25720 "modes": ["wt2wt"],
25721 "changes": [
25722 [ "#xyz", "before", "<b>before</b> stuff " ],
25723 [ "#xyz", "after", " stuff <i>after</i>" ],
25724 [ "#xyz", "html", "x <b>y</b> z" ]
25725 ]
25726 }
25727 !! wikitext
25728 <span id="xyz">hello</span>
25729 !! wikitext/edited
25730 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
25731 !! end
25732
25733 !! test
25734 Never serialize a-tag as html, regardless of what data-parsoid has to say
25735 !! options
25736 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25737 !! html/parsoid
25738 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
25739 !! wikitext
25740 [[Foo]]
25741 !! end
25742
25743 ## SSS FIXME: This is broken output nevertheless.
25744 ## What might be a reasonable non-broken output for this?
25745 ## This is an edge case unlikely to be seen in production
25746 ## that I am not wasting more time on this right now.
25747 !! test
25748 Never serialize a-tag as html, no matter what attributes it has
25749 !! options
25750 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25751 !! html/parsoid
25752 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
25753 !! wikitext
25754 [http://boo.org http://boohoo.org]
25755 !! end
25756
25757 # Misnested is an indication that selser can reuse the source but these have
25758 # shown to sneak through on occasion. See T101768.
25759 # The original wikitext here is: [http://test.com [[one]] two three]
25760 !! test
25761 Strip span tags added to mark misnested links
25762 !! options
25763 parsoid=html2wt
25764 !! html/parsoid
25765 <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>
25766 !! wikitext
25767 [http://test.com][[one]] two three
25768 !! end
25769
25770 !! test
25771 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
25772 !! options
25773 parsoid=html2wt
25774 !! html/parsoid
25775 <span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","spc":["","","",""]}]]}' 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","spc":["","","",""]}]]}' data-mw='{"parts":["{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"c\n{{!}}d\n"}},"i":0}},"\n|}"]}'>
25776 <tbody><tr><td>d
25777 </td></tr>
25778 </tbody></table>
25779 !! wikitext
25780 {{echo|a}}
25781 {|{{echo|c
25782 {{!}}d
25783 }}
25784 |}
25785 !! end
25786
25787 ## This test verifies the presence and computation of this attribute indirectly
25788 ## by making an edit and ensuring that the serialization is correct (which it would be
25789 ## only if firstWikitextNode is properly set).
25790 !! test
25791 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
25792 !! options
25793 parsoid= {
25794 "modes": ["wt2wt"],
25795 "changes": [
25796 [ "div#x", "remove" ],
25797 [ "div", "before", "<div>new</div>" ]
25798 ]
25799 }
25800 !! wikitext
25801 <div id="x">foo</div>
25802 {|
25803 {{echo|<div>boo</div>
25804 {{!}}b}}
25805 |c
25806 |}
25807 !! wikitext/edited
25808
25809 <div>new</div>
25810 {|
25811 {{echo|<div>boo</div>
25812 {{!}}b}}
25813 |c
25814 |}
25815 !! end
25816
25817 # --------------------------------------------
25818 # Tests spec'ing wikitext serialization norms |
25819 # --------------------------------------------
25820
25821 !! test
25822 1. Categories should always be serialized on their own line
25823 !! options
25824 parsoid=html2wt
25825 !! html/parsoid
25826 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
25827 !! wikitext
25828 foo
25829 [[Category:Foo]]
25830 bar
25831 !! end
25832
25833 !! test
25834 2. Categories that are part of templates should not introduce a line break
25835 !! wikitext
25836 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
25837 !! html/parsoid
25838 <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>
25839 !! end
25840
25841 # Careful while editing these next 2 tests. There are \u200f characters
25842 # before and after the <link> tags in the HTML and following some
25843 # of the categories in wikitext
25844 # Do not remove these characters in edits.
25845 #
25846 # As part of the serialization, these bidi characters will get stripped.
25847 !! test
25848 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
25849 !! options
25850 parsoid={
25851 "modes": ["html2wt"],
25852 "scrubWikitext": true
25853 }
25854 !! html/parsoid
25855 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
25856 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
25857 !! wikitext
25858 [[קטגוריה:טקסים]]
25859 [[קטגוריה: שיטות משפט]]
25860 !! end
25861
25862 !! test
25863 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
25864 !! options
25865 parsoid={
25866 "modes": ["html2wt"],
25867 "scrubWikitext": true
25868 }
25869 !! html/parsoid
25870 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
25871 !! wikitext
25872 [[קטגוריה:טקסים]]
25873 ‏y
25874 !! end
25875
25876 !! test
25877 Lists: Add space after bullets
25878 !! options
25879 parsoid=html2wt
25880 !! html/parsoid
25881 <ul>
25882 <li>foo</li>
25883 <li> bar</li>
25884 <li><span> baz</span></li>
25885 </ul>
25886 !! wikitext
25887 * foo
25888 * bar
25889 * <span> baz</span>
25890 !! end
25891
25892 !! test
25893 1. Headings: Add space before/after == (T53744)
25894 !! options
25895 parsoid=html2wt
25896 !! html/parsoid
25897 <h2>foo</h2>
25898 <h2> bar</h2>
25899 <h2>baz </h2>
25900 <h2><span> baz</span></h2>
25901 !! wikitext
25902 == foo ==
25903
25904 == bar ==
25905
25906 == baz ==
25907
25908 == <span> baz</span> ==
25909 !! end
25910
25911 !! test
25912 2. Headings: Add space before/after == even after hoisted content
25913 !! options
25914 parsoid={
25915 "modes": ["html2wt"],
25916 "scrubWikitext": true
25917 }
25918 !! html/parsoid
25919 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
25920 !! wikitext
25921 [[Category:A2]]
25922
25923 == ok ==
25924 !! end
25925
25926 !! test
25927 1. Headings: suppress newly created empty headings
25928 !! options
25929 parsoid={
25930 "modes": ["html2wt"],
25931 "scrubWikitext": true
25932 }
25933 !! html/parsoid
25934 <h2></h2>
25935 !! wikitext
25936 !! end
25937
25938 !! test
25939 2. Headings: don't suppress empty headings if scrubWikitext is false
25940 !! options
25941 parsoid=html2wt
25942 !! html/parsoid
25943 <h2></h2>
25944 !! wikitext
25945 ==<nowiki/>==
25946 !! end
25947
25948 !! test
25949 3. Headings: suppress empty headings on edits
25950 !! options
25951 parsoid={
25952 "modes": ["selser"],
25953 "scrubWikitext": true,
25954 "changes": [
25955 [ "#x", "remove"]
25956 ]
25957 }
25958 !! wikitext
25959 ==<span id="x">foo</span>==
25960 !! wikitext/edited
25961 !! end
25962
25963 !! test
25964 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
25965 !! options
25966 parsoid={
25967 "modes": ["html2wt"],
25968 "scrubWikitext": true
25969 }
25970 !! html/parsoid
25971 <h2>foo<br/>bar</h2>
25972 <h2>foo <span><br/>bar</span> baz</h2>
25973 !! wikitext
25974 == foo bar ==
25975
25976 == foo <span> bar</span> baz ==
25977 !! end
25978
25979 !! test
25980 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
25981 !! options
25982 parsoid={
25983 "modes": ["html2wt"],
25984 "scrubWikitext": false
25985 }
25986 !! html/parsoid
25987 <h2>foo<br/>bar</h2>
25988 !! wikitext
25989 == foo<br> bar ==
25990 !! end
25991
25992 !! test
25993 1. WT Quote Tags: suppress newly created empty style tags
25994 !! options
25995 parsoid={
25996 "modes": ["html2wt"],
25997 "scrubWikitext": true
25998 }
25999 !! html/parsoid
26000 <i></i><b></b>
26001 !! wikitext
26002 !! end
26003
26004 !! test
26005 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
26006 !! options
26007 parsoid=html2wt
26008 !! html/parsoid
26009 <i></i><b></b>
26010 !! wikitext
26011 ''<nowiki/>'''''<nowiki/>'''
26012 !! end
26013
26014 !! test
26015 3. WT Quote Tags: suppress empty style tags on edits
26016 !! options
26017 parsoid={
26018 "modes": ["selser"],
26019 "scrubWikitext": true,
26020 "changes": [
26021 [ "#x", "remove"]
26022 ]
26023 }
26024 !! wikitext
26025 '''<span id="x">foo</span>'''
26026 !! wikitext/edited
26027 !! end
26028
26029 !! test
26030 1. Anchors: suppress newly created empty anchors
26031 !! options
26032 parsoid={
26033 "modes": ["html2wt"],
26034 "scrubWikitext": true
26035 }
26036 !! html/parsoid
26037 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26038 !! wikitext
26039 !! end
26040
26041 !! test
26042 2. Anchors: don't suppress empty anchors if scrubWikitext is false
26043 !! options
26044 parsoid={
26045 "modes": ["html2wt"],
26046 "scrubWikitext": false
26047 }
26048 !! html/parsoid
26049 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26050 !! wikitext
26051 [[Test|<nowiki/>]]
26052 !! end
26053
26054 !! test
26055 3. Anchors: suppress empty anchors on edits
26056 !! options
26057 parsoid={
26058 "modes": ["selser"],
26059 "scrubWikitext": true,
26060 "changes": [
26061 [ "#x", "remove"]
26062 ]
26063 }
26064 !! wikitext
26065 [[Test|<span id="x">foo</span>]]
26066 !! wikitext/edited
26067 !! end
26068
26069 !! test
26070 3a. Anchors: do not suppress numbered extlinks
26071 !! options
26072 parsoid={
26073 "modes": ["wt2wt"],
26074 "scrubWikitext": true
26075 }
26076 !! wikitext
26077 [http://foo.com]
26078 !! html/parsoid
26079 <a rel="mw:ExtLink" href="http://foo.com"></a>
26080 !! end
26081
26082 !! test
26083 3b. Anchors: do not suppress numbered extlinks
26084 !! options
26085 parsoid={
26086 "modes": ["wt2wt"],
26087 "scrubWikitext": true,
26088 "changes": [
26089 [ "#x", "remove"]
26090 ]
26091 }
26092 !! wikitext
26093 [http://foo.com <span id="x">foo</span>]
26094 !! wikitext/edited
26095 [http://foo.com]
26096 !! end
26097
26098 !!test
26099 Normalizations should be restricted to edited content
26100 !!options
26101 parsoid={
26102 "modes": ["selser"],
26103 "scrubWikitext": true,
26104 "changes": [
26105 [ "h1", "before", "<i></i>"]
26106 ]
26107 }
26108 !!wikitext
26109 a
26110 = =
26111 b
26112 !!wikitext/edited
26113 a
26114 = =
26115 b
26116 !!end
26117
26118 !! test
26119 1. Multiple normalizations (html2wt)
26120 !! options
26121 parsoid={
26122 "modes": ["html2wt"],
26123 "scrubWikitext": true
26124 }
26125 !! html
26126 <h2><i></i></h2>
26127 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
26128 </a><b><i></i></b>x</p>
26129 !! wikitext
26130
26131 [[foo]]
26132 x
26133
26134 !! end
26135
26136 !! test
26137 2. Multiple normalizations (selser)
26138 !! options
26139 parsoid={
26140 "modes": ["selser"],
26141 "scrubWikitext": true,
26142 "changes": [
26143 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
26144 ]
26145 }
26146 !! wikitext
26147 <span id="x">foo</span>
26148 !! wikitext/edited
26149 <span id="x">foo</span>
26150
26151 x
26152 !! end
26153
26154 !! test
26155 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
26156 !! options
26157 parsoid={
26158 "modes": ["html2wt"],
26159 "scrubWikitext": true
26160 }
26161 !! html/parsoid
26162 <p> hi</p>
26163 <p> hello</p>
26164 !! wikitext
26165 hi
26166
26167 hello
26168 !! end
26169
26170 !! test
26171 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
26172 !! options
26173 parsoid=html2wt
26174 !! html/parsoid
26175 <p> hi</p>
26176 <p> hello</p>
26177 !! wikitext
26178 <nowiki> </nowiki>hi
26179
26180 <nowiki> </nowiki> hello
26181 !! end
26182
26183 !! test
26184 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
26185 !! options
26186 parsoid={
26187 "modes": ["html2wt"],
26188 "scrubWikitext": true
26189 }
26190 !! html/parsoid
26191 <p>Foo
26192 bar
26193 baz</p>
26194
26195 <table><tr><td>Foo
26196 bar
26197 baz bang</td></tr></table>
26198
26199 <p><!--boo--> foo
26200 bar</p>
26201
26202 <p> foo
26203 bar<span>boo</span></p>
26204 !! wikitext
26205 Foo
26206 bar
26207 baz
26208
26209 {|
26210 |Foo
26211 bar
26212 baz bang
26213 |}
26214
26215 <!--boo-->foo
26216 bar
26217
26218 foo
26219 bar<span>boo</span>
26220 !! end
26221
26222 !! test
26223 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
26224 !! options
26225 parsoid={
26226 "modes": ["selser"],
26227 "scrubWikitext": true,
26228 "changes": [
26229 [ "p", "html", " a\n b" ]
26230 ]
26231 }
26232 !! wikitext
26233 xyz
26234 !! wikitext/edited
26235 a
26236 b
26237 !! end
26238
26239 !! test
26240 1. New links that end in spaces
26241 !! options
26242 parsoid={
26243 "modes": ["html2wt"],
26244 "scrubWikitext": false
26245 }
26246 !! html/parsoid
26247 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26248 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26249 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26250 !! wikitext
26251 [[Berlin ]]<nowiki/>is the capital of Germany.
26252
26253 [[Foo ]]'''bar'''
26254
26255 [[Boston ]] is a city.
26256 !! end
26257
26258 !! test
26259 2. New links that end in spaces
26260 !! options
26261 parsoid={
26262 "modes": ["html2wt"],
26263 "scrubWikitext": true
26264 }
26265 !! html/parsoid
26266 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26267 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26268 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26269 !! wikitext
26270 [[Berlin]] is the capital of Germany.
26271
26272 [[Foo]] '''bar'''
26273
26274 [[Boston]] is a city.
26275 !! end
26276
26277 !! test
26278 1. Table cells with escapable prefixes
26279 !! options
26280 parsoid={
26281 "modes": ["html2wt"],
26282 "scrubWikitext": false
26283 }
26284 !! html
26285 <table>
26286 <tr><td>a</td></tr>
26287 <tr><td>-</td></tr>
26288 <tr><td>+</td></tr>
26289 </table>
26290 !! wikitext
26291 {|
26292 |a
26293 |-
26294 |<nowiki>-</nowiki>
26295 |-
26296 |<nowiki>+</nowiki>
26297 |}
26298 !! end
26299
26300 !! test
26301 2. Table cells with escapable prefixes
26302 !! options
26303 parsoid={
26304 "modes": ["html2wt"],
26305 "scrubWikitext": true
26306 }
26307 !! html
26308 <table>
26309 <tr><td>a</td></tr>
26310 <tr><td>-</td></tr>
26311 <tr><td>+</td></tr>
26312 </table>
26313 !! wikitext
26314 {|
26315 |a
26316 |-
26317 | -
26318 |-
26319 | +
26320 |}
26321 !! end
26322
26323 !! test
26324 3a. Table cells with escapable prefixes after edits
26325 !! options
26326 parsoid={
26327 "modes": ["selser"],
26328 "scrubWikitext": true,
26329 "changes": [
26330 [ "table tbody tr:first-child td:first-child", "remove"]
26331 ]
26332 }
26333 !! wikitext
26334 {|
26335 |a||-
26336 |}
26337 !! wikitext/edited
26338 {|
26339 | -
26340 |}
26341 !! end
26342
26343 !! test
26344 3b. Table cells with escapable prefixes after edits
26345 !! options
26346 parsoid={
26347 "modes": ["selser"],
26348 "scrubWikitext": true,
26349 "changes": [
26350 [ "table tbody tr:first-child td:first-child", "html", "-" ],
26351 [ "#x", "remove" ]
26352 ]
26353 }
26354 !! wikitext
26355 {|
26356 |pqr
26357 |<span id="x">foo</span>+
26358 |}
26359 !! wikitext/edited
26360 {|
26361 | -
26362 | +
26363 |}
26364 !! end
26365
26366 # FIXME: This test will fail because
26367 # normalization doesn't realize that the id attribute
26368 # will eliminate the escapable scenario
26369 !! test
26370 4a. Table cells without escapable prefixes after edits
26371 !! options
26372 parsoid={
26373 "modes": ["selser"],
26374 "scrubWikitext": true,
26375 "changes": [
26376 [ "#x", "html", "-" ]
26377 ]
26378 }
26379 !! wikitext
26380 {|
26381 | id="x" |abcd
26382 |}
26383 !! wikitext/edited
26384 {|
26385 | id="x" |-
26386 |}
26387 !! end
26388
26389 ## This tests normalizer's ability to discriminate between
26390 ## cells having identical content.
26391 !! test
26392 4b. Table cells without escapable prefixes after edits
26393 !! options
26394 parsoid={
26395 "modes": ["selser"],
26396 "scrubWikitext": true,
26397 "changes": [
26398 [ "td", "html", "-" ]
26399 ]
26400 }
26401 !! wikitext
26402 {|
26403 |a||b
26404 |}
26405 !! wikitext/edited
26406 {|
26407 | -||-
26408 |}
26409 !! end
26410
26411 ## This tests normalizer's ability to not be tripped by
26412 ## comments (and whitespace)
26413 !! test
26414 4c. Table cells without escapable prefixes after edits
26415 !! options
26416 parsoid={
26417 "modes": ["selser"],
26418 "scrubWikitext": true,
26419 "changes": [
26420 [ "table tbody tr td:first-child", "remove" ]
26421 ]
26422 }
26423 !! wikitext
26424 {|
26425 |-
26426 <!--foo--> |a||-
26427 |}
26428 !! wikitext/edited
26429 {|
26430 |-
26431 <!--foo--> | -
26432 |}
26433 !! end
26434
26435 ## This tests normalizer's ability to handle HTML cells
26436 !! test
26437 4d. Table cells without escapable prefixes after edits
26438 !! options
26439 parsoid={
26440 "modes": ["selser"],
26441 "scrubWikitext": true,
26442 "changes": [
26443 [ "td", "html", "-" ]
26444 ]
26445 }
26446 !! wikitext
26447 <table>
26448 <tr><td>a</td></tr>
26449 </table>
26450 !! wikitext/edited
26451 <table>
26452 <tr><td>-</td></tr>
26453 </table>
26454 !! end
26455
26456 ## T111151 Remove font elements without attributes
26457 !! test
26458 5a. font tags without attributes should be dropped in scrubWikitext mode
26459 !! options
26460 parsoid={
26461 "modes": ["html2wt"],
26462 "scrubWikitext": true
26463 }
26464 !! html
26465 <font>foo</font>
26466 <font><font>bar</font></font>
26467 <font class="x">boo</font>
26468 !! wikitext
26469 foo
26470 bar
26471 <font class="x">boo</font>
26472 !! end
26473
26474 !! test
26475 5b. font tags should not be dropped without scrubWikitext being enabled
26476 !! options
26477 parsoid={
26478 "modes": ["html2wt"],
26479 "scrubWikitext": false
26480 }
26481 !! html
26482 <font>foo</font>
26483 !! wikitext
26484 <font>foo</font>
26485 !! end
26486
26487 !! test
26488 Escape nowiki DOM elements
26489 !! options
26490 parsoid=html2wt
26491 !! html/parsoid
26492 <nowiki><i>foo</i></nowiki>
26493 !! wikitext
26494 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
26495 !! end
26496
26497 # This is meant to be an interim fix while we go about figuring out
26498 # how to not introduce these trailing <nowiki/>s in the first place.
26499 !! test
26500 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
26501 !! options
26502 parsoid=html2wt
26503 !! html/parsoid
26504 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
26505 y</p>
26506 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[0,23,null,null],"pi":[[{"k":"1","named":true,"spc":["\n"," "," ",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;nowiki/>"}},"i":0}}]}'></span></p>
26507 <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[0,24,null,null],"pi":[[{"k":"1","named":true,"spc":["\n"," "," ","\n"]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;nowiki/>"}},"i":0}}]}'></span></p>
26508 !! wikitext
26509 x
26510 y
26511
26512 {{echo|
26513 1 = <nowiki/>}}
26514
26515 {{echo|
26516 1 = <nowiki/>
26517 }}
26518 !! end
26519
26520 # ---------------------------------------------------
26521 # End of tests spec'ing wikitext serialization norms |
26522 # ---------------------------------------------------
26523
26524 # T104032
26525 !! test
26526 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
26527 !! options
26528 parsoid=html2wt
26529 !! html/parsoid
26530 a<p>b</p>
26531 <b>c</b><p>d</p>
26532 <table><tr>
26533 <td>a<p>b</p></td>
26534 <td><b>c</b><p>d</p></td>
26535 </tr></table>
26536 !! wikitext
26537 a
26538
26539 b
26540
26541 '''c'''
26542
26543 d
26544 {|
26545 |a
26546 b
26547 |'''c'''
26548 d
26549 |}
26550 !! end
26551
26552 # -----------------------------------------------------------------
26553 # End of section for Parsoid-only html2wt tests for serialization
26554 # of new content
26555 # -----------------------------------------------------------------
26556
26557 # -----------------------------------------------------------------
26558 # The following section of tests are primarily to spec behavior of
26559 # the selective serializer. All these tests have manual selser
26560 # changes. The automated selser changes for all tests handle the
26561 # wide variation of changes, but these tests here capture specs
26562 # deterministically.
26563 # ----------------------------------------------------------------
26564
26565 ## T90517
26566 !! test
26567 Selser: New comments should not be lost
26568 !! options
26569 parsoid={
26570 "modes": ["selser"],
26571 "changes": [
26572 [ "#a", "after", "<!--c1-->" ],
26573 [ "#b", "before", "<!--c2-->" ]
26574 ]
26575 }
26576 !! wikitext
26577 <span id="a">a</span>
26578
26579 <span id="b">b</span>
26580 !! wikitext/edited
26581 <span id="a">a</span><!--c1-->
26582
26583 <!--c2--><span id="b">b</span>
26584 !! end
26585
26586 ## T89383
26587 !! test
26588 Selser: Check for validity of DSR before using it
26589 !! options
26590 parsoid={
26591 "modes": ["selser"],
26592 "changes": [
26593 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
26594 ]
26595 }
26596 !! wikitext
26597 <span id="a">a</span>
26598 !! wikitext/edited
26599 {{DISPLAYTITLE:foo}}
26600 <span id="a">a</span>
26601 !! end
26602
26603 !! test
26604 1. DOMDiff: Changes to <ref> content should be looked up using id
26605 !! options
26606 parsoid={
26607 "modes": ["selser"],
26608 "changes": [
26609 ["#X", "after", "bar"],
26610 ["#Y", "after", "baz"]
26611 ]
26612 }
26613 !! wikitext
26614 X <ref><span id="X">foo</span></ref>
26615 Y <ref name="a" />
26616 <references>
26617 <ref name="a"><span id="Y">foo</span></ref>
26618 </references>
26619 !! wikitext/edited
26620 X <ref><span id="X">foo</span>bar</ref>
26621 Y <ref name="a" />
26622 <references>
26623 <ref name="a"><span id="Y">foo</span>baz</ref>
26624 </references>
26625 !! end
26626
26627 !! test
26628 2. DOMDiff: Changes to <ref> content should be looked up using id
26629 !! options
26630 parsoid={
26631 "modes": ["selser"],
26632 "changes": [
26633 ["#Z", "after", "bar"]
26634 ]
26635 }
26636 !! wikitext
26637 A <ref>foo bar for a</ref>
26638 B <ref group="X" name="b" />
26639
26640 <references />
26641
26642 <references group="X">
26643 <ref name="b"><span id="Z">foo</span></ref>
26644 </references>
26645 !! wikitext/edited
26646 A <ref>foo bar for a</ref>
26647 B <ref group="X" name="b" />
26648
26649 <references />
26650
26651 <references group="X">
26652 <ref name="b"><span id="Z">foo</span>bar</ref>
26653 </references>
26654 !! end
26655
26656 !! test
26657 Empty LI (T49673)
26658 !! wikitext
26659 * a
26660 *
26661 *
26662 * b
26663 !! html/php+tidy
26664 <ul>
26665 <li>a</li>
26666 <li class="mw-empty-li"></li>
26667 <li class="mw-empty-li"></li>
26668 <li>b</li>
26669 </ul>
26670 !! end