438fe314cab0e917d08a71b407b5fa8e3b4bad54
[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 <p>||||
18304 </p>
18305 </div>
18306 </div></li>
18307 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18308 <div class="thumb" style="height: 150px;">Image3</div>
18309 <div class="gallerytext">
18310 </div>
18311 </div></li>
18312 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18313 <div class="thumb" style="height: 150px;">Image4</div>
18314 <div class="gallerytext">
18315 <p>300px| centre
18316 </p>
18317 </div>
18318 </div></li>
18319 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18320 <div class="thumb" style="height: 150px;">Image5.svg</div>
18321 <div class="gallerytext">
18322 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
18323 </p>
18324 </div>
18325 </div></li>
18326 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18327 <div class="thumb" style="height: 150px;">* image6</div>
18328 <div class="gallerytext">
18329 </div>
18330 </div></li>
18331 </ul>
18332
18333 !! end
18334
18335 !! test
18336 Gallery (with options)
18337 !! wikitext
18338 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
18339 File:Nonexistent.jpg|caption
18340 File:Nonexistent.jpg
18341 image:foobar.jpg|some '''caption''' [[Main Page]]
18342 image:foobar.jpg
18343 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
18344 </gallery>
18345 !! html
18346 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
18347 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
18348 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18349 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18350 <div class="gallerytext">
18351 <p>caption
18352 </p>
18353 </div>
18354 </div></li>
18355 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18356 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18357 <div class="gallerytext">
18358 </div>
18359 </div></li>
18360 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18361 <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>
18362 <div class="gallerytext">
18363 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18364 </p>
18365 </div>
18366 </div></li>
18367 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18368 <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>
18369 <div class="gallerytext">
18370 </div>
18371 </div></li>
18372 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18373 <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>
18374 <div class="gallerytext">
18375 <p>Blabla|blabla.
18376 </p>
18377 </div>
18378 </div></li>
18379 </ul>
18380
18381 !! end
18382
18383 !! test
18384 Gallery with link that has fragment
18385 !! wikitext
18386 <gallery>
18387 image:foobar.jpg|link=Main_Page
18388 image:foobar.jpg|link=Main_Page#section
18389 image:foobar.jpg|link=Main Page#section|caption
18390 </gallery>
18391 !! html
18392 <ul class="gallery mw-gallery-traditional">
18393 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18394 <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>
18395 <div class="gallerytext">
18396 </div>
18397 </div></li>
18398 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18399 <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>
18400 <div class="gallerytext">
18401 </div>
18402 </div></li>
18403 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18404 <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>
18405 <div class="gallerytext">
18406 <p>caption
18407 </p>
18408 </div>
18409 </div></li>
18410 </ul>
18411
18412 !! end
18413
18414 !! test
18415 Gallery with wikitext inside caption
18416 !! wikitext
18417 <gallery>
18418 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
18419 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
18420 </gallery>
18421 !! html
18422 <ul class="gallery mw-gallery-traditional">
18423 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18424 <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>
18425 <div class="gallerytext">
18426 <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>
18427 </p>
18428 </div>
18429 </div></li>
18430 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18431 <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>
18432 <div class="gallerytext">
18433 <p>This is a test template
18434 </p>
18435 </div>
18436 </div></li>
18437 </ul>
18438
18439 !! end
18440
18441 !! test
18442 gallery (with showfilename option)
18443 !! wikitext
18444 <gallery showfilename>
18445 File:Nonexistent.jpg|caption
18446 File:Nonexistent.jpg
18447 image:foobar.jpg|some '''caption''' [[Main Page]]
18448 File:Foobar.jpg
18449 </gallery>
18450 !! html
18451 <ul class="gallery mw-gallery-traditional">
18452 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18453 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18454 <div class="gallerytext">
18455 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18456 caption
18457 </p>
18458 </div>
18459 </div></li>
18460 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18461 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18462 <div class="gallerytext">
18463 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18464 </p>
18465 </div>
18466 </div></li>
18467 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18468 <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>
18469 <div class="gallerytext">
18470 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18471 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18472 </p>
18473 </div>
18474 </div></li>
18475 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18476 <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>
18477 <div class="gallerytext">
18478 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18479 </p>
18480 </div>
18481 </div></li>
18482 </ul>
18483
18484 !! end
18485
18486 !! test
18487 Gallery (with namespace-less filenames)
18488 !! wikitext
18489 <gallery>
18490 File:Nonexistent.jpg
18491 Nonexistent.jpg
18492 image:foobar.jpg
18493 foobar.jpg
18494 </gallery>
18495 !! html
18496 <ul class="gallery mw-gallery-traditional">
18497 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18498 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18499 <div class="gallerytext">
18500 </div>
18501 </div></li>
18502 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18503 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18504 <div class="gallerytext">
18505 </div>
18506 </div></li>
18507 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18508 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/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>
18509 <div class="gallerytext">
18510 </div>
18511 </div></li>
18512 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18513 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/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>
18514 <div class="gallerytext">
18515 </div>
18516 </div></li>
18517 </ul>
18518
18519 !! end
18520
18521 !! test
18522 HTML Hex character encoding (spells the word "JavaScript")
18523 !! options
18524 parsoid=wt2html,wt2wt,html2html
18525 !! wikitext
18526 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
18527 !! html/php
18528 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
18529 </p>
18530 !! html/php+tidy
18531 <p>JavaScript</p>
18532 !! html/parsoid
18533 <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>
18534 !! end
18535
18536 !! test
18537 HTML Hex character encoding bogus encoding (bug 26437 regression check)
18538 !! wikitext
18539 &#xsee;&#XSEE;
18540 !! html/php
18541 <p>&amp;#xsee;&amp;#XSEE;
18542 </p>
18543 !! html/parsoid
18544 <p>&amp;#xsee;&amp;#XSEE;</p>
18545 !! end
18546
18547 !! test
18548 HTML Hex character encoding mixed case
18549 !! options
18550 parsoid=wt2html,wt2wt,html2html
18551 !! wikitext
18552 &#xEE;&#Xee;
18553 !! html/php
18554 <p>&#xee;&#xee;
18555 </p>
18556 !! html/php+tidy
18557 <p>îî</p>
18558 !! html/parsoid
18559 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
18560 !! end
18561
18562 # See: http://www.w3.org/TR/html5/syntax.html#character-references
18563 # Note that U+000C (form feed) is not a valid XML character, so
18564 # it is banned even though allowed in HTML5.
18565 !! test
18566 Illegal character references (T106578)
18567 !! wikitext
18568 ; Null: &#00;
18569 ; FF: &#xC;
18570 ; CR: &#xD;
18571 ; Control (low): &#8;
18572 ; Control (high): &#x7F; &#x9F;
18573 ; Surrogate: &#xD83D;&#xDCA9;
18574 ; This is an okay astral character: &#x1F4A9;
18575 !! html+tidy
18576 <dl>
18577 <dt>Null</dt>
18578 <dd>&amp;#00;</dd>
18579 <dt>FF</dt>
18580 <dd>&amp;#xC;</dd>
18581 <dt>CR</dt>
18582 <dd>&amp;#xD;</dd>
18583 <dt>Control (low)</dt>
18584 <dd>&amp;#8;</dd>
18585 <dt>Control (high)</dt>
18586 <dd>&amp;#x7F; &amp;#x9F;</dd>
18587 <dt>Surrogate</dt>
18588 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
18589 <dt>This is an okay astral character</dt>
18590 <dd>💩</dd>
18591 </dl>
18592 !! end
18593
18594 !! test
18595 __FORCETOC__ override
18596 !! wikitext
18597 __NEWSECTIONLINK__
18598 __FORCETOC__
18599 !! html/php
18600 <p><br />
18601 </p>
18602 !! end
18603
18604 !! test
18605 ISBN code coverage
18606 !! wikitext
18607 ISBN 978-0-1234-56&#x20;789
18608 !! html
18609 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
18610 </p>
18611 !! html+tidy
18612 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
18613 !! html/parsoid
18614 <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>
18615 !! end
18616
18617 !! test
18618 ISBN followed by 5 spaces
18619 !! wikitext
18620 ISBN
18621 !! html
18622 <p>ISBN
18623 </p>
18624 !! end
18625
18626 !! test
18627 Double ISBN
18628 !! wikitext
18629 ISBN ISBN 1234567890
18630 !! html/php
18631 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18632 </p>
18633 !! html/parsoid
18634 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
18635 !! end
18636
18637 # Uppercase X and lowercase x as well
18638 !! test
18639 ISBN with an X
18640 !! wikitext
18641 ISBN 3-462-04561-X
18642 ISBN 3-462-04561-x
18643 ISBN 080442957X
18644 ISBN 080442957x
18645 ISBN 978080442957X
18646 ISBN 978080442957x
18647 !! html/php
18648 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
18649 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
18650 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
18651 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
18652 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
18653 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
18654 </p>
18655 !! html/parsoid
18656 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
18657 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
18658 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
18659 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
18660 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
18661 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
18662 !! end
18663
18664 !! test
18665 ISBN with empty prefix (parsoid test)
18666 !! wikitext
18667 ISBN 1234567890
18668 !! html/php
18669 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18670 </p>
18671 !! html/parsoid
18672 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
18673 !! end
18674
18675 !! test
18676 Bug 22905: <abbr> followed by ISBN followed by </a>
18677 !! wikitext
18678 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
18679 !! html/php
18680 <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>
18681 </p>
18682 !! html/parsoid
18683 <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>
18684 !! end
18685
18686 !! test
18687 Double RFC
18688 !! wikitext
18689 RFC RFC 1234
18690 !! html
18691 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
18692 </p>
18693 !! end
18694
18695 !! test
18696 Double RFC with a wiki link
18697 !! wikitext
18698 RFC [[RFC 1234]]
18699 !! html
18700 <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>
18701 </p>
18702 !! end
18703
18704 !! test
18705 RFC code coverage
18706 !! wikitext
18707 RFC 983&#x20;987
18708 !! html
18709 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
18710 </p>
18711 !! html+tidy
18712 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
18713 !! end
18714
18715 !! test
18716 Centre-aligned image
18717 !! wikitext
18718 [[Image:foobar.jpg|centre]]
18719 !! html
18720 <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>
18721
18722 !!end
18723
18724 !! test
18725 None-aligned image
18726 !! wikitext
18727 [[Image:foobar.jpg|none]]
18728 !! html
18729 <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>
18730
18731 !!end
18732
18733 !! test
18734 Width + Height sized image (using px) (height is ignored)
18735 !! wikitext
18736 [[Image:foobar.jpg|640x480px]]
18737 !! html
18738 <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>
18739 </p>
18740 !!end
18741
18742 !! test
18743 Width-sized image (using px, no following whitespace)
18744 !! wikitext
18745 [[Image:foobar.jpg|640px]]
18746 !! html
18747 <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>
18748 </p>
18749 !!end
18750
18751 !! test
18752 Width-sized image (using px, with following whitespace - test regression from r39467)
18753 !! wikitext
18754 [[Image:foobar.jpg|640px ]]
18755 !! html
18756 <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>
18757 </p>
18758 !!end
18759
18760 !! test
18761 Width-sized image (using px, with preceding whitespace - test regression from r39467)
18762 !! wikitext
18763 [[Image:foobar.jpg| 640px]]
18764 !! html
18765 <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>
18766 </p>
18767 !!end
18768
18769 !! test
18770 Image with page parameter
18771 !! options
18772 djvu
18773 !! wikitext
18774 [[File:LoremIpsum.djvu|page=2]]
18775 !! html/php
18776 <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>
18777 </p>
18778 !! html/parsoid
18779 <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>
18780 !! end
18781
18782 !! test
18783 Another italics / bold test
18784 !! wikitext
18785 ''' ''x'
18786 !! html
18787 <pre>'<i> </i>x'
18788 </pre>
18789 !!end
18790
18791 # FIXME: The php output seems broken. It's interleaving some open/close tags.
18792 !! test
18793 dt/dd/dl test
18794 !! wikitext
18795 :;;;::
18796 !! html/php
18797 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
18798
18799 !! html/parsoid
18800 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
18801
18802 !!end
18803
18804
18805 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
18806 !! test
18807 Images with the "|" character in the comment
18808 !! wikitext
18809 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
18810 !! html/php
18811 <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>
18812
18813 !! html/parsoid
18814 <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>
18815 !! end
18816
18817 !! test
18818 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
18819 !! wikitext
18820 <html><script>alert(1);</script></html>
18821 !! html
18822 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
18823 </p>
18824 !! end
18825
18826 !! test
18827 HTML with raw HTML ($wgRawHtml==true)
18828 !! options
18829 wgRawHtml=1
18830 !! wikitext
18831 <html><script>alert(1);</script></html>
18832 !! html
18833 <p><script>alert(1);</script>
18834 </p>
18835 !! end
18836
18837 !! test
18838 Parents of subpages, one level up
18839 !! options
18840 subpage title=[[Subpage test/L1/L2/L3]]
18841 !! wikitext
18842 [[../|L2]]
18843 !! html
18844 <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>
18845 </p>
18846 !! end
18847
18848
18849 !! test
18850 Parents of subpages, one level up, not named
18851 !! options
18852 subpage title=[[Subpage test/L1/L2/L3]]
18853 !! wikitext
18854 [[../]]
18855 !! html
18856 <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>
18857 </p>
18858 !! end
18859
18860
18861
18862 !! test
18863 Parents of subpages, two levels up
18864 !! options
18865 subpage title=[[Subpage test/L1/L2/L3]]
18866 !! wikitext
18867 [[../../|L1]]2
18868
18869 [[../../|L1]]l
18870 !! html
18871 <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
18872 </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>
18873 </p>
18874 !! end
18875
18876 !! test
18877 Parents of subpages, two levels up, without trailing slash or name.
18878 !! options
18879 subpage title=[[Subpage test/L1/L2/L3]]
18880 !! wikitext
18881 [[../..]]
18882 !! html
18883 <p>[[../..]]
18884 </p>
18885 !! end
18886
18887 !! test
18888 Parents of subpages, two levels up, with lots of extra trailing slashes.
18889 !! options
18890 subpage title=[[Subpage test/L1/L2/L3]]
18891 !! wikitext
18892 [[../../////]]
18893 !! html
18894 <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>
18895 </p>
18896 !! end
18897
18898 !! article
18899 Subpage test/L1/L2/L3Sibling
18900 !! text
18901 Sibling article
18902 !! endarticle
18903
18904 !! test
18905 Transclusion of a sibling page (one level up)
18906 !! options
18907 subpage title=[[Subpage test/L1/L2/L3]]
18908 !! wikitext
18909 {{../L3Sibling}}
18910 !! html
18911 <p>Sibling article
18912 </p>
18913 !! end
18914
18915 !! test
18916 Transclusion of a child page
18917 !! options
18918 subpage title=[[Subpage test/L1/L2]]
18919 !! wikitext
18920 {{/L3Sibling}}
18921 !! html
18922 <p>Sibling article
18923 </p>
18924 !! end
18925
18926 !! test
18927 Non-transclusion because of too many up levels
18928 !! options
18929 subpage title=[[Subpage test/L1/L2/L3]]
18930 !! wikitext
18931 {{../../../../More than parent}}
18932 !! html
18933 <p>{{../../../../More than parent}}
18934 </p>
18935 !! end
18936
18937 !! test
18938 Definition list code coverage
18939 !! wikitext
18940 ; title : def
18941 ; title : def
18942 ;title: def
18943 !! html/php
18944 <dl><dt> title &#160;</dt>
18945 <dd> def</dd>
18946 <dt> title&#160;</dt>
18947 <dd> def</dd>
18948 <dt>title</dt>
18949 <dd> def</dd></dl>
18950
18951 !! html/parsoid
18952 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18953 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18954 <dt>title</dt><dd> def</dd></dl>
18955 !! end
18956
18957 !! test
18958 Don't fall for the self-closing div
18959 !! wikitext
18960 <div>hello world</div/>
18961 !! html
18962 <div>hello world</div>
18963
18964 !! end
18965
18966 !! test
18967 MSGNW magic word
18968 !! wikitext
18969 {{MSGNW:msg}}
18970 !! html/php
18971 <p>&#91;&#91;:Template:Msg&#93;&#93;
18972 </p>
18973 !! end
18974
18975 !! test
18976 RAW magic word
18977 !! wikitext
18978 {{RAW:QUERTY}}
18979 !! html
18980 <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>
18981 </p>
18982 !! end
18983
18984 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
18985 !! test
18986 Always escape literal '>' in output, not just after '<'
18987 !! wikitext
18988 ><>
18989 !! html
18990 <p>&gt;&lt;&gt;
18991 </p>
18992 !! end
18993
18994 !! test
18995 Template caching
18996 !! wikitext
18997 {{Test}}
18998 {{Test}}
18999 !! html
19000 <p>This is a test template
19001 This is a test template
19002 </p>
19003 !! end
19004
19005
19006 !! article
19007 MediaWiki:Fake
19008 !! text
19009 ==header==
19010 !! endarticle
19011
19012 !! test
19013 Inclusion of !userCanEdit() content
19014 !! wikitext
19015 {{MediaWiki:Fake}}
19016 !! html
19017 <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>
19018
19019 !! end
19020
19021
19022 !! test
19023 Out-of-order TOC heading levels
19024 !! wikitext
19025 ==2==
19026 ======6======
19027 ===3===
19028 =1=
19029 =====5=====
19030 ==2==
19031 !! html
19032 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19033 <ul>
19034 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
19035 <ul>
19036 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
19037 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
19038 </ul>
19039 </li>
19040 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
19041 <ul>
19042 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
19043 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
19044 </ul>
19045 </li>
19046 </ul>
19047 </div>
19048
19049 <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>
19050 <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>
19051 <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>
19052 <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>
19053 <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>
19054 <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>
19055
19056 !! end
19057
19058
19059 !! test
19060 ISBN with a dummy number
19061 !! wikitext
19062 ISBN ---
19063 !! html
19064 <p>ISBN ---
19065 </p>
19066 !! end
19067
19068
19069 !! test
19070 ISBN with space-delimited number
19071 !! wikitext
19072 ISBN 92 9017 032 8
19073 !! html
19074 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
19075 </p>
19076 !! end
19077
19078
19079 !! test
19080 ISBN with multiple spaces, no number
19081 !! wikitext
19082 ISBN foo
19083 !! html
19084 <p>ISBN foo
19085 </p>
19086 !! end
19087
19088
19089 !! test
19090 ISBN length
19091 !! wikitext
19092 ISBN 123456789
19093
19094 ISBN 1234567890
19095
19096 ISBN 12345678901
19097 !! html
19098 <p>ISBN 123456789
19099 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19100 </p><p>ISBN 12345678901
19101 </p>
19102 !! end
19103
19104
19105 !! test
19106 ISBN with trailing year (bug 8110)
19107 !! wikitext
19108 ISBN 1-234-56789-0 - 2006
19109
19110 ISBN 1 234 56789 0 - 2006
19111 !! html
19112 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
19113 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
19114 </p>
19115 !! end
19116
19117
19118 !! test
19119 anchorencode
19120 !! wikitext
19121 {{anchorencode:foo bar©#%n}}
19122 !! html
19123 <p>foo_bar.C2.A9.23.25n
19124 </p>
19125 !! end
19126
19127 !! test
19128 anchorencode trims spaces
19129 !! wikitext
19130 {{anchorencode: __pretty__please__}}
19131 !! html
19132 <p>pretty_please
19133 </p>
19134 !! end
19135
19136 !! test
19137 anchorencode deals with links
19138 !! wikitext
19139 {{anchorencode: [[hello|world]] [[hi]]}}
19140 !! html
19141 <p>world_hi
19142 </p>
19143 !! end
19144
19145 !! test
19146 anchorencode deals with templates
19147 !! wikitext
19148 {{anchorencode: {{Foo}} }}
19149 !! html
19150 <p>FOO
19151 </p>
19152 !! end
19153
19154 !! test
19155 anchorencode encodes like the TOC generator: (bug 18431)
19156 !! wikitext
19157 === _ +:.3A%3A&&amp;]] ===
19158 {{anchorencode: _ +:.3A%3A&&amp;]] }}
19159 __NOEDITSECTION__
19160 !! html
19161 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
19162 <p>.2B:.3A.253A.26.26.5D.5D
19163 </p>
19164 !! end
19165
19166 !! test
19167 Bug 6200: blockquotes and paragraph formatting
19168 !! wikitext
19169 <blockquote>
19170 foo
19171 </blockquote>
19172
19173 bar
19174
19175 baz
19176 !! html
19177 <blockquote>
19178 <p>foo
19179 </p>
19180 </blockquote>
19181 <p>bar
19182 </p>
19183 <pre>baz
19184 </pre>
19185 !! end
19186
19187 !! test
19188 Bug 8293: Use of center tag ruins paragraph formatting
19189 !! wikitext
19190 <center>
19191 foo
19192 </center>
19193
19194 bar
19195
19196 baz
19197 !! html
19198 <center>
19199 <p>foo
19200 </p>
19201 </center>
19202 <p>bar
19203 </p>
19204 <pre>baz
19205 </pre>
19206 !! end
19207
19208 !!test
19209 Parsing of overlapping (improperly nested) inline html tags
19210 !! wikitext
19211 <span><s>x</span></s>
19212 !! html/php
19213 <p><span><s>x&lt;/span&gt;</s></span>
19214 </p>
19215 !! html/parsoid
19216 <p><span><s>x</s></span>
19217 </p>
19218 !!end
19219
19220 ###
19221 ### Language variants related tests
19222 ###
19223 !! test
19224 Self-link in language variants
19225 !! options
19226 title=[[Dunav]] language=sr
19227 !! wikitext
19228 Both [[Dunav]] and [[Дунав]] are names for this river.
19229 !! html
19230 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
19231 </p>
19232 !!end
19233
19234 !! article
19235 Дуна
19236 !! text
19237 content
19238 !! endarticle
19239
19240 !! test
19241 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
19242 !! options
19243 title=[[Duna]] language=sr
19244 !! wikitext
19245 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
19246 !! html
19247 <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.
19248 </p>
19249 !! end
19250
19251 !! test
19252 Link to a section of a variant of this title shouldn't be parsed as self-link
19253 !! options
19254 title=[[Duna]] language=sr
19255 !! wikitext
19256 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
19257 !! html
19258 <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.
19259 </p>
19260 !! end
19261
19262 !! test
19263 Link to pages in language variants
19264 !! options
19265 language=sr
19266 !! wikitext
19267 Main Page can be written as [[Маин Паге]]
19268 !! html
19269 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
19270 </p>
19271 !!end
19272
19273
19274 !! test
19275 Multiple links to pages in language variants
19276 !! options
19277 language=sr
19278 !! wikitext
19279 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
19280 !! html
19281 <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>.
19282 </p>
19283 !!end
19284
19285
19286 !! test
19287 Simple template in language variants
19288 !! options
19289 language=sr
19290 !! wikitext
19291 {{тест}}
19292 !! html
19293 <p>This is a test template
19294 </p>
19295 !! end
19296
19297
19298 !! test
19299 Template with explicit namespace in language variants
19300 !! options
19301 language=sr
19302 !! wikitext
19303 {{Template:тест}}
19304 !! html
19305 <p>This is a test template
19306 </p>
19307 !! end
19308
19309
19310 !! test
19311 Basic test for template parameter in language variants
19312 !! options
19313 language=sr
19314 !! wikitext
19315 {{парамтест|param=foo}}
19316 !! html
19317 <p>This is a test template with parameter foo
19318 </p>
19319 !! end
19320
19321
19322 !! test
19323 Simple category in language variants
19324 !! options
19325 language=sr cat
19326 !! wikitext
19327 [[Category:МедиаWики Усер'с Гуиде]]
19328 !! html
19329 <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>
19330 !! end
19331
19332
19333 !! article
19334 Category:分类
19335 !! text
19336 blah
19337 !! endarticle
19338
19339 !! article
19340 Category:分類
19341 !! text
19342 blah
19343 !! endarticle
19344
19345 ## We used to, but no longer wt2wt this test since the default serializer
19346 ## will normalize all categories to serialize on their own line.
19347 ## This wikitext usage is going to be fairly uncommon in production and
19348 ## selser will take care of preserving formatting in those scenarios.
19349 !! test
19350 Don't convert blue categorylinks to another variant (bug 33210)
19351 !! options
19352 cat
19353 language=zh
19354 parsoid=wt2html
19355 !! wikitext
19356 [[A]][[Category:分类]]
19357 !! html/php
19358 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
19359 !! html/parsoid
19360 <p><a rel="mw:WikiLink" href="A" title="A">A</a></p>
19361 <link rel="mw:PageProp/Category" href="Category:分类"/>
19362 !! end
19363
19364 !! test
19365 Stripping -{}- tags (language variants)
19366 !! options
19367 language=sr
19368 !! wikitext
19369 Latin proverb: -{Ne nuntium necare}-
19370 !! html
19371 <p>Latin proverb: Ne nuntium necare
19372 </p>
19373 !! end
19374
19375
19376 !! test
19377 Prevent conversion with -{}- tags (language variants)
19378 !! options
19379 language=sr variant=sr-ec
19380 !! wikitext
19381 Latinski: -{Ne nuntium necare}-
19382 !! html
19383 <p>Латински: Ne nuntium necare
19384 </p>
19385 !! end
19386
19387
19388 !! test
19389 Prevent conversion of text with -{}- tags (language variants)
19390 !! options
19391 language=sr variant=sr-ec
19392 !! wikitext
19393 Latinski: -{Ne nuntium necare}-
19394 !! html
19395 <p>Латински: Ne nuntium necare
19396 </p>
19397 !! end
19398
19399
19400 !! test
19401 Prevent conversion of links with -{}- tags (language variants)
19402 !! options
19403 language=sr variant=sr-ec
19404 !! wikitext
19405 -{[[Main Page]]}-
19406 !! html
19407 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19408 </p>
19409 !! end
19410
19411
19412 !! test
19413 -{}- tags within headlines (within html for parserConvert())
19414 !! options
19415 language=sr variant=sr-ec
19416 !! wikitext
19417 == -{Naslov}- ==
19418 !! html
19419 <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>
19420
19421 !! end
19422
19423
19424 !! test
19425 Explicit definition of language variant alternatives
19426 !! options
19427 language=zh variant=zh-tw
19428 !! wikitext
19429 -{zh:China;zh-tw:Taiwan}-, not China
19430 !! html
19431 <p>Taiwan, not China
19432 </p>
19433 !! end
19434
19435
19436 !! test
19437 Conversion around HTML tags
19438 !! options
19439 language=sr variant=sr-ec
19440 !! wikitext
19441 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
19442 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
19443 !! html
19444 <p>
19445 <span title="ЛаCтин">ски</span>
19446 </p>
19447 !! end
19448
19449
19450 !! test
19451 Explicit session-wise language variant mapping (A flag and - flag)
19452 !! options
19453 language=zh variant=zh-tw
19454 !! wikitext
19455 Taiwan is not China.
19456 But -{A|zh:China;zh-tw:Taiwan}- is China,
19457 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
19458 and -{China}- is China.
19459 !! html
19460 <p>Taiwan is not China.
19461 But Taiwan is Taiwan,
19462 (This should be stripped!)
19463 and China is China.
19464 </p>
19465 !! end
19466
19467 !! test
19468 Explicit session-wise language variant mapping (H flag for hide)
19469 !! options
19470 language=zh variant=zh-tw
19471 !! wikitext
19472 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
19473 Taiwan is China.
19474 !! html
19475 <p>(This should be stripped!)
19476 Taiwan is Taiwan.
19477 </p>
19478 !! end
19479
19480 !! test
19481 Adding explicit conversion rule for title (T flag)
19482 !! options
19483 language=zh variant=zh-tw showtitle
19484 !! wikitext
19485 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19486 !! html
19487 Taiwan
19488 <p>Should be stripped!
19489 </p>
19490 !! end
19491
19492 !! test
19493 Testing that changing the language variant here in the tests actually works
19494 !! options
19495 language=zh variant=zh showtitle
19496 !! wikitext
19497 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19498 !! html
19499 China
19500 <p>Should be stripped!
19501 </p>
19502 !! end
19503
19504 !! test
19505 Recursive conversion of alt and title attrs shouldn't clear converter state
19506 !! options
19507 language=zh variant=zh-cn showtitle
19508 !! wikitext
19509 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
19510 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
19511 !! html
19512 China
19513 <p>
19514 Should be stripped<span title="Exclamation">!</span>
19515 </p>
19516 !! end
19517
19518 !! test
19519 Bug 24072: more test on conversion rule for title
19520 !! options
19521 language=zh variant=zh-tw showtitle
19522 !! wikitext
19523 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19524 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
19525 !! html
19526 Taiwan
19527 <p>This should be stripped!
19528 This won't take interferes with the title rule.
19529 </p>
19530 !! end
19531
19532 !! test
19533 Partly disable title conversion if variant == main language code
19534 !! options
19535 language=zh variant=zh title=[[ZH]] showtitle
19536 !! wikitext
19537 -{T|zh-cn:CN;zh-tw:TW}-
19538 !! html
19539 ZH
19540 <p>
19541 </p>
19542 !! end
19543
19544 !! test
19545 Partly disable title conversion if variant == main language code, more
19546 !! options
19547 language=zh variant=zh title=[[ZH]] showtitle
19548 !! wikitext
19549 -{T|TW}-
19550 !! html
19551 ZH
19552 <p>
19553 </p>
19554 !! end
19555
19556 !! test
19557 Raw output of variant escape tags (R flag)
19558 !! options
19559 language=zh variant=zh-tw
19560 !! wikitext
19561 Raw: -{R|zh:China;zh-tw:Taiwan}-
19562 !! html
19563 <p>Raw: zh:China;zh-tw:Taiwan
19564 </p>
19565 !! end
19566
19567 !! test
19568 Strings evaluating false shouldn't be ignored by Language converter (T51072)
19569 !! options
19570 language=zh variant=zh-cn
19571 !! input
19572 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
19573 !! result
19574 <p>0
19575 </p>
19576 !! end
19577
19578 !! test
19579 Conversion rules from [numeric-only string] to [something else] (T48634)
19580 !! options
19581 language=zh variant=zh-cn
19582 !! input
19583 -{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
19584 !! result
19585 <p>D12345EE12345
19586 </p>
19587 !! end
19588
19589 !! test
19590 Bidirectional converter rule entries with an empty value should be ignored (T53551)
19591 !! options
19592 language=zh variant=zh-cn
19593 !! input
19594 -{H|zh-cn:foo;zh-tw:;}-foobar
19595 !! result
19596 <p>foobar
19597 </p>
19598 !! end
19599
19600 !! test
19601 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
19602 !! options
19603 language=zh variant=zh-cn
19604 !! input
19605 -{H|=>zh-cn:foo;}-foobar
19606 !! result
19607 <p>foobar
19608 </p>
19609 !! end
19610
19611 !! test
19612 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
19613 !! options
19614 language=zh variant=zh-cn
19615 !! input
19616 -{H|}-foobar
19617 !! result
19618 <p>foobar
19619 </p>
19620 !! end
19621
19622 !! test
19623 Nested using of manual convert syntax
19624 !! options
19625 language=zh variant=zh-hk
19626 !! wikitext
19627 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
19628 !! html
19629 <p>Nested: Hello Hong Kong!
19630 </p>
19631 !! end
19632
19633 !! test
19634 Proper conversion of text in external links
19635 !! options
19636 language=sr variant=sr-ec
19637 !! wikitext
19638 http://www.google.com
19639 gopher://www.google.com
19640 [http://www.google.com http://www.google.com]
19641 [gopher://www.google.com gopher://www.google.com]
19642 [https://www.google.com irc://www.google.com]
19643 [ftp://www.google.com www.google.com/ftp://dir]
19644 [//www.google.com www.google.com]
19645 !! html
19646 <p><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 free" href="http://www.google.com">http://www.google.com</a>
19649 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19650 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
19651 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
19652 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
19653 </p>
19654 !! end
19655
19656 !! test
19657 Do not convert roman numbers to language variants
19658 !! options
19659 language=sr variant=sr-ec
19660 !! wikitext
19661 Fridrih IV je car.
19662 !! html
19663 <p>Фридрих IV је цар.
19664 </p>
19665 !! end
19666
19667 !! test
19668 Unclosed language converter markup "-{"
19669 !! options
19670 language=sr
19671 !! wikitext
19672 -{T|hello
19673 !! html
19674 <p>-{T|hello
19675 </p>
19676 !! end
19677
19678 !! test
19679 Don't convert raw rule "-{R|=&gt;}-" to "=>"
19680 !! options
19681 language=sr
19682 !! wikitext
19683 -{R|=&gt;}-
19684 !! html
19685 <p>=&gt;
19686 </p>
19687 !!end
19688
19689 !! test
19690 Don't break link parsing if language converter markup is in the caption.
19691 !! options
19692 language=sr variant=sr-ec
19693 !! wikitext
19694 [[Main Page|-{R|main page}-]]
19695 !! html
19696 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
19697 </p>
19698 !! end
19699
19700 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19701 !! test
19702 Don't break image parsing if language converter markup is in the caption.
19703 !! options
19704 language=sr
19705 !! wikitext
19706 [[File:Foobar.jpg|-{R|caption}-]]
19707 !! html/parsoid
19708 <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>
19709 </p>
19710 !! end
19711
19712 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19713 !! test
19714 Don't break list handling if language converter markup is in the item.
19715 !! options
19716 language=zh variant=zh-cn
19717 !! wikitext
19718 ;-{zh-cn:AAA;zh-tw:BBB}-
19719 !! html/php
19720 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
19721
19722 !! html/parsoid
19723 <dl><dt>AAA
19724 </dt></dl>
19725 !! end
19726
19727 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19728 !! test
19729 Don't break table handling if language converter markup is in the cell.
19730 !! options
19731 language=sr variant=sr-ec
19732 !! wikitext
19733 {|
19734 |-
19735 | -{R|B}-
19736 |}
19737 !! html/php
19738 <table>
19739
19740 <tr>
19741 <td>Б}-
19742 </td></tr></table>
19743
19744 !! html/parsoid
19745 <table>
19746
19747 <tr>
19748 <td> B
19749 </td></tr></table>
19750
19751 !! end
19752
19753 !! test
19754 Bug 529: Uncovered bullet
19755 !! wikitext
19756 * Foo {{bullet}}
19757 !! html
19758 <ul><li> Foo </li>
19759 <li> Bar</li></ul>
19760
19761 !! end
19762
19763 # Plain MediaWiki does not remove empty lists, but tidy actually does.
19764 # Templates in Wikipedia rely on this behavior, as tidy has always been
19765 # enabled there. These tests are normally run *without* tidy, so specify the
19766 # full output here.
19767 # To test realistic parsing behavior, apply a tidy-like transformation to both
19768 # the expected output and your parser's output.
19769 !! test
19770 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
19771 !! wikitext
19772 ******* Foo {{bullet}}
19773 !! html
19774 <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>
19775 <li> Bar</li></ul>
19776
19777 !! end
19778
19779 !! test
19780 Bug 529: Uncovered table already at line-start
19781 !! wikitext
19782 x
19783
19784 {{table}}
19785 y
19786 !! html
19787 <p>x
19788 </p>
19789 <table>
19790 <tr>
19791 <td> 1 </td>
19792 <td> 2
19793 </td></tr>
19794 <tr>
19795 <td> 3 </td>
19796 <td> 4
19797 </td></tr></table>
19798 <p>y
19799 </p>
19800 !! end
19801
19802 !! test
19803 Bug 529: Uncovered bullet in parser function result
19804 !! wikitext
19805 * Foo {{lc:{{bullet}} }}
19806 !! html
19807 <ul><li> Foo </li>
19808 <li> bar</li></ul>
19809
19810 !! end
19811
19812 !! test
19813 Bug 5678: Double-parsed template argument
19814 !! wikitext
19815 {{lc:{{{1}}}|hello}}
19816 !! html
19817 <p>{{{1}}}
19818 </p>
19819 !! end
19820
19821 !! test
19822 Bug 5678: Double-parsed template invocation
19823 !! wikitext
19824 {{lc:{{paramtest {{!}} param = hello }} }}
19825 !! html
19826 <p>{{paramtest | param = hello }}
19827 </p>
19828 !! end
19829
19830 !! test
19831 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
19832 !! options
19833 language=cs
19834 title=[[Main Page]]
19835 !! wikitext
19836 {{PRVNÍVELKÉ:ěščř}}
19837 {{prvnívelké:ěščř}}
19838 {{PRVNÍMALÉ:ěščř}}
19839 {{prvnímalé:ěščř}}
19840 {{MALÁ:ěščř}}
19841 {{malá:ěščř}}
19842 {{VELKÁ:ěščř}}
19843 {{velká:ěščř}}
19844 !! html
19845 <p>Ěščř
19846 Ěščř
19847 ěščř
19848 ěščř
19849 ěščř
19850 ěščř
19851 ĚŠČŘ
19852 ĚŠČŘ
19853 </p>
19854 !! end
19855
19856 !! test
19857 Morwen/13: Unclosed link followed by heading
19858 !! wikitext
19859 [[link
19860 ==heading==
19861 !! html
19862 <p>[[link
19863 </p>
19864 <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>
19865
19866 !! end
19867
19868 !! test
19869 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
19870 !! wikitext
19871 {{foo|
19872 =heading=
19873 !! html
19874 <p>{{foo|
19875 </p>
19876 <h1><span class="mw-headline" id="heading">heading</span></h1>
19877
19878 !! end
19879
19880 !! test
19881 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
19882 !! wikitext
19883 {{foo|
19884 ==heading==
19885 !! html
19886 <p>{{foo|
19887 </p>
19888 <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>
19889
19890 !! end
19891
19892 !! test
19893 Tildes in comments
19894 !! options
19895 pst
19896 !! wikitext
19897 <!-- ~~~~ -->
19898 !! html/php
19899 <!-- ~~~~ -->
19900 !! end
19901
19902 !! test
19903 Paragraphs inside divs (no extra line breaks)
19904 !! wikitext
19905 <div>Line one
19906
19907 Line two</div>
19908 !! html
19909 <div>Line one
19910 Line two</div>
19911
19912 !! end
19913
19914 !! test
19915 Paragraphs inside divs (extra line break on open)
19916 !! wikitext
19917 <div>
19918 Line one
19919
19920 Line two</div>
19921 !! html
19922 <div>
19923 <p>Line one
19924 </p>
19925 Line two</div>
19926
19927 !! end
19928
19929 !! test
19930 Paragraphs inside divs (extra line break on close)
19931 !! wikitext
19932 <div>Line one
19933
19934 Line two
19935 </div>
19936 !! html
19937 <div>Line one
19938 <p>Line two
19939 </p>
19940 </div>
19941
19942 !! end
19943
19944 !! test
19945 Paragraphs inside divs (extra line break on open and close)
19946 !! wikitext
19947 <div>
19948 Line one
19949
19950 Line two
19951 </div>
19952 !! html
19953 <div>
19954 <p>Line one
19955 </p><p>Line two
19956 </p>
19957 </div>
19958
19959 !! end
19960
19961 !! test
19962 Nesting tags, paragraphs on lines which begin with <div>
19963 !! wikitext
19964 <div></div><strong>A
19965 B</strong>
19966 !! html/php+tidy
19967 <p><strong>A</strong></p>
19968 <p><strong>B</strong></p>
19969 !! html/parsoid
19970 <div></div>
19971 <p><strong>A
19972 B</strong>
19973 </p>
19974 !! end
19975
19976 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
19977 !! test
19978 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
19979 !! wikitext
19980 <blockquote>Line one
19981
19982 Line two</blockquote>
19983 !! html
19984 <blockquote>Line one
19985 Line two</blockquote>
19986
19987 !! html+tidy
19988 <blockquote>
19989 <p>Line one Line two</p>
19990 </blockquote>
19991 !! end
19992
19993 !! test
19994 Bug 6200: paragraphs inside blockquotes (extra line break on open)
19995 !! wikitext
19996 <blockquote>
19997 Line one
19998
19999 Line two</blockquote>
20000 !! html
20001 <blockquote>
20002 <p>Line one
20003 </p>
20004 Line two</blockquote>
20005
20006 !! html+tidy
20007 <blockquote>
20008 <p>Line one</p>
20009 Line two</blockquote>
20010 !! end
20011
20012 !! test
20013 Bug 6200: paragraphs inside blockquotes (extra line break on close)
20014 !! wikitext
20015 <blockquote>Line one
20016
20017 Line two
20018 </blockquote>
20019 !! html
20020 <blockquote>Line one
20021 <p>Line two
20022 </p>
20023 </blockquote>
20024
20025 !! html+tidy
20026 <blockquote>
20027 <p>Line one</p>
20028 <p>Line two</p>
20029 </blockquote>
20030 !! end
20031
20032 !! test
20033 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
20034 !! wikitext
20035 <blockquote>
20036 Line one
20037
20038 Line two
20039 </blockquote>
20040 !! html
20041 <blockquote>
20042 <p>Line one
20043 </p><p>Line two
20044 </p>
20045 </blockquote>
20046
20047 !! html+tidy
20048 <blockquote>
20049 <p>Line one</p>
20050 <p>Line two</p>
20051 </blockquote>
20052 !! end
20053
20054 !! test
20055 Paragraphs inside blockquotes/divs (no extra line breaks)
20056 !! wikitext
20057 <blockquote><div>Line one
20058
20059 Line two</div></blockquote>
20060 !! html
20061 <blockquote><div>Line one
20062 Line two</div></blockquote>
20063
20064 !! end
20065
20066 !! test
20067 Paragraphs inside blockquotes/divs (extra line break on open)
20068 !! wikitext
20069 <blockquote><div>
20070 Line one
20071
20072 Line two</div></blockquote>
20073 !! html
20074 <blockquote><div>
20075 <p>Line one
20076 </p>
20077 Line two</div></blockquote>
20078
20079 !! end
20080
20081 !! test
20082 Paragraphs inside blockquotes/divs (extra line break on close)
20083 !! wikitext
20084 <blockquote><div>Line one
20085
20086 Line two
20087 </div></blockquote>
20088 !! html
20089 <blockquote><div>Line one
20090 <p>Line two
20091 </p>
20092 </div></blockquote>
20093
20094 !! end
20095
20096 !! test
20097 Paragraphs inside blockquotes/divs (extra line break on open and close)
20098 !! wikitext
20099 <blockquote><div>
20100 Line one
20101
20102 Line two
20103 </div></blockquote>
20104 !! html
20105 <blockquote><div>
20106 <p>Line one
20107 </p><p>Line two
20108 </p>
20109 </div></blockquote>
20110
20111 !! end
20112
20113 !! test
20114 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
20115 !! options
20116 wgLinkHolderBatchSize=0
20117 !! wikitext
20118 [[meatball:1]]
20119 [[meatball:2]]
20120 [[meatball:3]]
20121 !! html
20122 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
20123 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
20124 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
20125 </p>
20126 !! end
20127
20128 !! test
20129 Free external link invading image caption
20130 !! wikitext
20131 [[Image:Foobar.jpg|thumb|http://x|hello]]
20132 !! html
20133 <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>
20134
20135 !! end
20136
20137 !! test
20138 Bug 15196: localised external link numbers
20139 !! options
20140 language=fa
20141 !! wikitext
20142 [http://en.wikipedia.org/]
20143 !! html/php
20144 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
20145 </p>
20146 !! html/parsoid
20147 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
20148 !! end
20149
20150 !! test
20151 Multibyte character in padleft
20152 !! wikitext
20153 {{padleft:-Hello|7|Æ}}
20154 !! html
20155 <p>Æ-Hello
20156 </p>
20157 !! end
20158
20159 !! test
20160 Multibyte character in padright
20161 !! wikitext
20162 {{padright:Hello-|7|Æ}}
20163 !! html
20164 <p>Hello-Æ
20165 </p>
20166 !! end
20167
20168 !!test
20169 formatdate parser function
20170 !! wikitext
20171 {{#formatdate:2009-03-24}}
20172 !! html
20173 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
20174 </p>
20175 !! end
20176
20177 !!test
20178 formatdate parser function, with default format
20179 !! wikitext
20180 {{#formatdate:2009-03-24|mdy}}
20181 !! html
20182 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
20183 </p>
20184 !! end
20185
20186 !! test
20187 Spacing of numbers in formatted dates
20188 !! wikitext
20189 {{#formatdate:January 15}}
20190 !! html
20191 <p><span class="mw-formatted-date" title="01-15">January 15</span>
20192 </p>
20193 !! end
20194
20195 !! test
20196 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
20197 !! options
20198 language=nl title=[[MediaWiki:Common.css]]
20199 !! wikitext
20200 {{#formatdate:2009-03-24|dmy}}
20201 !! html
20202 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
20203 </p>
20204 !! end
20205
20206 #
20207 #
20208 #
20209
20210 #
20211 # Edit comments
20212 #
20213
20214 !! test
20215 Edit comment with link
20216 !! options
20217 comment
20218 !! wikitext
20219 I like the [[Main Page]] a lot
20220 !! html/php
20221 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
20222 !!end
20223
20224 !! test
20225 Edit comment with link and link text
20226 !! options
20227 comment
20228 !! wikitext
20229 I like the [[Main Page|best pages]] a lot
20230 !! html/php
20231 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20232 !!end
20233
20234 !! test
20235 Edit comment with link and link text with suffix
20236 !! options
20237 comment
20238 !! wikitext
20239 I like the [[Main Page|best page]]s a lot
20240 !! html/php
20241 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20242 !!end
20243
20244 !! test
20245 Edit comment with section link (non-local, eg in history list)
20246 !! options
20247 comment title=[[Main Page]]
20248 !! wikitext
20249 /* External links */ removed bogus entries
20250 !! html/php
20251 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20252 !!end
20253
20254 !! test
20255 Edit comment with section link and text before it (non-local, eg in history list)
20256 !! options
20257 comment title=[[Main Page]]
20258 !! wikitext
20259 pre-comment text /* External links */ removed bogus entries
20260 !! html/php
20261 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>
20262 !!end
20263
20264 !! test
20265 Edit comment with section link (local, eg in diff view)
20266 !! options
20267 comment local title=[[Main Page]]
20268 !! wikitext
20269 /* External links */ removed bogus entries
20270 !! html/php
20271 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20272 !!end
20273
20274 !! test
20275 Edit comment with subpage link (bug 14080)
20276 !! options
20277 comment
20278 subpage
20279 title=[[Subpage test]]
20280 !! wikitext
20281 Poked at a [[/subpage]] here...
20282 !! html/php
20283 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
20284 !!end
20285
20286 !! test
20287 Edit comment with subpage link and link text (bug 14080)
20288 !! options
20289 comment
20290 subpage
20291 title=[[Subpage test]]
20292 !! wikitext
20293 Poked at a [[/subpage|neat little page]] here...
20294 !! html/php
20295 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
20296 !!end
20297
20298 !! test
20299 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
20300 !! options
20301 comment
20302 title=[[Subpage test]]
20303 !! wikitext
20304 Poked at a [[/subpage]] here...
20305 !! html/php
20306 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...
20307 !!end
20308
20309 !! test
20310 Edit comment with bare anchor link (local, as on diff)
20311 !! options
20312 comment
20313 local
20314 title=[[Main Page]]
20315 !! wikitext
20316 [[#section]]
20317 !! html/php
20318 <a href="#section">#section</a>
20319 !! end
20320
20321 !! test
20322 Edit comment with bare anchor link (non-local, as on history)
20323 !! options
20324 comment
20325 title=[[Main Page]]
20326 !! wikitext
20327 [[#section]]
20328 !! html/php
20329 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
20330 !! end
20331
20332 !! test
20333 Anchor starting with underscore
20334 !! options
20335 title=[[Foo]]
20336 !! wikitext
20337 [[#_ref|One]]
20338 !! html/php
20339 <p><a href="#_ref">One</a>
20340 </p>
20341 !! html/parsoid
20342 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
20343 !! end
20344
20345 !! test
20346 Id starting with underscore
20347 !! wikitext
20348 <div id="_ref"></div>
20349 !! html/*
20350 <div id="_ref"></div>
20351
20352 !! end
20353
20354 !! test
20355 Space normalisation on autocomment (bug 22784)
20356 !! options
20357 comment
20358 title=[[Main Page]]
20359 !! wikitext
20360 /* __hello__world__ */
20361 !! html/php
20362 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
20363 !! end
20364
20365 !! test
20366 percent-encoding and + signs in comments (Bug 26410)
20367 !! options
20368 comment
20369 !! wikitext
20370 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
20371 !! html/php
20372 <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>
20373 !! end
20374
20375 # Parsoid doesn't support this yet: see bug 73581
20376 # but it *should* omit the 'src' attribute if the image is bad.
20377 # PHP side of tests was disabled in
20378 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
20379 # because of issues in the PHP parserTests infrastructure
20380 # (but the output below is indeed what the PHP side emits)
20381 !! test
20382 Bad images - basic functionality
20383 !! wikitext
20384 [[File:Bad.jpg]]
20385 !! DISABLED/html/php
20386 !! html/parsoid
20387 <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>
20388 !! end
20389
20390 !! test
20391 Bad images - bug 16039: text after bad image disappears
20392 !! wikitext
20393 Foo bar
20394 [[File:Bad.jpg]]
20395 Bar foo
20396 !! DISABLED/html/php
20397 <p>Foo bar
20398 </p><p>Bar foo
20399 </p>
20400 !! html/parsoid
20401 <p>Foo bar
20402 <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>
20403 Bar foo</p>
20404 !! end
20405
20406 !! test
20407 Verify that displaytitle works (bug #22501) no displaytitle
20408 !! options
20409 showtitle
20410 !! config
20411 wgAllowDisplayTitle=true
20412 wgRestrictDisplayTitle=false
20413 !! wikitext
20414 this is not the the title
20415 !! html/php
20416 Parser test
20417 <p>this is not the the title
20418 </p>
20419 !! end
20420
20421 !! test
20422 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
20423 !! options
20424 showtitle
20425 title=[[Screen]]
20426 !! config
20427 wgAllowDisplayTitle=true
20428 wgRestrictDisplayTitle=false
20429 !! wikitext
20430 this is not the the title
20431 {{DISPLAYTITLE:whatever}}
20432 !! html/php
20433 whatever
20434 <p>this is not the the title
20435 </p>
20436 !! end
20437
20438 !! test
20439 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
20440 !! options
20441 showtitle
20442 title=[[Screen]]
20443 !! config
20444 wgAllowDisplayTitle=true
20445 wgRestrictDisplayTitle=true
20446 !! wikitext
20447 this is not the the title
20448 {{DISPLAYTITLE:whatever}}
20449 !! html/php
20450 Screen
20451 <p>this is not the the title
20452 </p>
20453 !! end
20454
20455 !! test
20456 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
20457 !! options
20458 showtitle
20459 title=[[Screen]]
20460 !! config
20461 wgAllowDisplayTitle=true
20462 wgRestrictDisplayTitle=true
20463 !! wikitext
20464 this is not the the title
20465 {{DISPLAYTITLE:screen}}
20466 !! html/php
20467 screen
20468 <p>this is not the the title
20469 </p>
20470 !! end
20471
20472 !! test
20473 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
20474 !! options
20475 showtitle
20476 title=[[Screen]]
20477 !! config
20478 wgAllowDisplayTitle=false
20479 !! wikitext
20480 this is not the the title
20481 {{DISPLAYTITLE:screen}}
20482 !! html/php
20483 Screen
20484 <p>this is not the the title
20485 <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>
20486 </p>
20487 !! end
20488
20489 !! test
20490 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
20491 !! options
20492 showtitle
20493 title=[[Screen]]
20494 !! config
20495 wgAllowDisplayTitle=false
20496 !! wikitext
20497 this is not the the title
20498 !! html/php
20499 Screen
20500 <p>this is not the the title
20501 </p>
20502 !! end
20503
20504 !! test
20505 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
20506 !! options
20507 showtitle
20508 title=[[Screen]]
20509 !! config
20510 wgAllowDisplayTitle=true
20511 wgRestrictDisplayTitle=true
20512 !! wikitext
20513 this is not the the title
20514 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
20515 !! html/php
20516 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
20517 <p>this is not the the title
20518 </p>
20519 !! end
20520
20521 !! test
20522 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
20523 !! options
20524 showtitle
20525 title=[[Screen]]
20526 !! config
20527 wgAllowDisplayTitle=true
20528 wgRestrictDisplayTitle=true
20529 !! wikitext
20530 this is not the the title
20531 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
20532 !! html/php
20533 <span style="color: red;">s</span>creen
20534 <p>this is not the the title
20535 </p>
20536 !! end
20537
20538 !! test
20539 Page status indicators: Empty name is invalid
20540 !! options
20541 showindicators
20542 !! wikitext
20543 <indicator name=" "></indicator>
20544 <indicator></indicator>
20545 !! html
20546 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20547 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20548 </p>
20549 !! end
20550
20551 !! test
20552 Page status indicators: Weird syntaxes that are okay
20553 !! options
20554 showindicators
20555 !! wikitext
20556 <indicator name="empty" />
20557 <indicator name="name"></indicator>
20558 !! html
20559 empty=
20560 name=
20561 <p><br />
20562 </p>
20563 !! end
20564
20565 !! test
20566 Page status indicators: Torture test
20567 !! options
20568 showindicators
20569 !! wikitext
20570 <indicator name="01">hello world</indicator>
20571 <indicator name="02">[[Main Page]]</indicator>
20572 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
20573 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
20574 <indicator name="05">* foo
20575 * bar</indicator>
20576 <indicator name="06"><nowiki>foo</nowiki></indicator>
20577 <indicator name="07"> Preformatted</indicator>
20578 <indicator name="08"><div>Broken tag</indicator>
20579 <indicator name="09">{| class=wikitable
20580 | cell
20581 |}</indicator>
20582 <indicator name="10">Two
20583
20584 paragraphs</indicator>
20585 !! html
20586 01=hello world
20587 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20588 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" />
20589 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>
20590 05=<ul><li> foo</li>
20591 <li> bar</li></ul>
20592
20593 06=foo
20594 07=<pre>Preformatted
20595 </pre>
20596 08=<div>Broken tag</div>
20597
20598 09=<table class="wikitable">
20599 <tr>
20600 <td> cell
20601 </td></tr></table>
20602
20603 10=<p>Two
20604 </p><p>paragraphs
20605 </p>
20606 <p><br />
20607 </p><p><br />
20608 </p><p><br />
20609 </p><p><br />
20610 </p><p><br />
20611 </p>
20612 !! end
20613
20614 !! test
20615 preload: check <noinclude> and <includeonly>
20616 !! options
20617 preload
20618 !! wikitext
20619 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
20620 !! html/php
20621 Hello kind world.
20622 !! end
20623
20624 !! test
20625 preload: check <onlyinclude>
20626 !! options
20627 preload
20628 !! wikitext
20629 Goodbye <onlyinclude>Hello world</onlyinclude>
20630 !! html/php
20631 Hello world
20632 !! end
20633
20634 !! test
20635 preload: can pass tags through if we want to
20636 !! options
20637 preload
20638 !! wikitext
20639 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
20640 !! html/php
20641 <includeonly>Hello world</includeonly>
20642 !! end
20643
20644 !! test
20645 preload: check that it doesn't try to do tricks
20646 !! options
20647 preload
20648 !! wikitext
20649 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20650 !! html/php
20651 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20652 !! end
20653
20654 !! test
20655 Play a bit with r67090 and bug 3158
20656 !! wikitext
20657 <div style="width:50% !important">&nbsp;</div>
20658 <div style="width:50%&nbsp;!important">&nbsp;</div>
20659 <div style="width:50%&#160;!important">&nbsp;</div>
20660 <div style="border : solid;">&nbsp;</div>
20661 !! html/php
20662 <div style="width:50% !important">&#160;</div>
20663 <div style="width:50% !important">&#160;</div>
20664 <div style="width:50% !important">&#160;</div>
20665 <div style="border&#160;: solid;">&#160;</div>
20666
20667 !! html/parsoid
20668 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20669 <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>
20670 <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>
20671 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20672
20673 !! end
20674
20675 !! test
20676 HTML5 data attributes
20677 !! wikitext
20678 <span data-foo="bar">Baz</span>
20679 <p data-abc-def_hij="">Quuz</p>
20680 !! html/php
20681 <p><span data-foo="bar">Baz</span>
20682 </p>
20683 <p data-abc-def_hij="">Quuz</p>
20684
20685 !! html/parsoid
20686 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
20687 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
20688 !! end
20689
20690 !! test
20691 Strip reserved data attributes
20692 !! wikitext
20693 <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
20694 !! html
20695 <div data-ok="fred">d</div>
20696
20697 !! end
20698
20699 !! test
20700 percent-encoding and + signs in internal links (Bug 26410)
20701 !! wikitext
20702 [[User:+%]] [[Page+title%]]
20703 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
20704 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
20705 [[%33%45]] [[%33%45+]]
20706 !! html/php
20707 <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>
20708 <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>
20709 <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>
20710 <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>
20711 </p>
20712 !! html/parsoid
20713 <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>
20714 <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>
20715 <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>
20716 <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>
20717 !! end
20718
20719 !! test
20720 Special characters in embedded file links (bug 27679)
20721 !! wikitext
20722 [[File:Contains & ampersand.jpg]]
20723 [[File:Does not exist.jpg|Title with & ampersand]]
20724 !! html/php
20725 <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>
20726 <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>
20727 </p>
20728 !! html/parsoid
20729 <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>
20730 <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>
20731 !! end
20732
20733 !! test
20734 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
20735 !! wikitext
20736 Text&apos;s been normalized?
20737 !! html
20738 <p>Text&#39;s been normalized?
20739 </p>
20740 !! end
20741
20742 !! test
20743 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
20744 !! wikitext
20745 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
20746 !! html
20747 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
20748 </p>
20749 !! end
20750
20751 !! test
20752 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
20753 !! wikitext
20754 [http://www.example.org/ ideograms]
20755 !! html
20756 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
20757 </p>
20758 !! end
20759
20760 !! test
20761 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
20762 !! wikitext
20763 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
20764 !! html
20765 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
20766 </p>
20767 !! end
20768
20769 !! article
20770 Mediawiki:loop1
20771 !! text
20772 {{Identical|A}}
20773 !! endarticle
20774
20775 !! article
20776 Mediawiki:loop2
20777 !! text
20778 {{Identical|B}}
20779 !! endarticle
20780
20781 !! article
20782 Template:Identical
20783 !! text
20784 {{int:loop1}}
20785 {{int:loop2}}
20786 !! endarticle
20787
20788 !! test
20789 Bug 31098 Template which includes system messages which includes the template
20790 !! wikitext
20791 {{Identical}}
20792 !! html
20793 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20794 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20795 </p>
20796 !! end
20797
20798 !! test
20799 Bug31490 Turkish: ucfirst 'blah'
20800 !! options
20801 language=tr
20802 !! wikitext
20803 {{ucfirst:blah}}
20804 !! html
20805 <p>Blah
20806 </p>
20807 !! end
20808
20809 !! test
20810 Bug31490 Turkish: ucfirst 'ix'
20811 !! options
20812 language=tr
20813 !! wikitext
20814 {{ucfirst:ix}}
20815 !! html
20816 <p>İx
20817 </p>
20818 !! end
20819
20820 !! test
20821 Bug31490 Turkish: lcfirst 'BLAH'
20822 !! options
20823 language=tr
20824 !! wikitext
20825 {{lcfirst:BLAH}}
20826 !! html
20827 <p>bLAH
20828 </p>
20829 !! end
20830
20831 !! test
20832 Bug31490 Turkish: ucfırst (with a dotless i)
20833 !! options
20834 language=tr
20835 !! wikitext
20836 {{ucfırst:blah}}
20837 !! html
20838 <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>
20839 </p>
20840 !! end
20841
20842 !! test
20843 Bug31490 ucfırst (with a dotless i) with English language
20844 !! options
20845 language=en
20846 !! wikitext
20847 {{ucfırst:blah}}
20848 !! html
20849 <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>
20850 </p>
20851 !! end
20852
20853 !! test
20854 Bug 26375: TOC with italics
20855 !! options
20856 title=[[Main Page]]
20857 !! wikitext
20858 __TOC__
20859 == ''Lost'' episodes ==
20860 !! html
20861 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20862 <ul>
20863 <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>
20864 </ul>
20865 </div>
20866
20867 <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>
20868
20869 !! end
20870
20871 !! test
20872 Bug 26375: TOC with bold
20873 !! options
20874 title=[[Main Page]]
20875 !! wikitext
20876 __TOC__
20877 == '''should be bold''' then normal text ==
20878 !! html
20879 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20880 <ul>
20881 <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>
20882 </ul>
20883 </div>
20884
20885 <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>
20886
20887 !! end
20888
20889 !! test
20890 Bug 33845: Headings become cursive in TOC when they contain an image
20891 !! options
20892 title=[[Main Page]]
20893 !! wikitext
20894 __TOC__
20895 == Image [[Image:foobar.jpg]] ==
20896 !! html
20897 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20898 <ul>
20899 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
20900 </ul>
20901 </div>
20902
20903 <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>
20904
20905 !! end
20906
20907 !! test
20908 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
20909 !! options
20910 title=[[Main Page]]
20911 !! wikitext
20912 __TOC__
20913 == <blockquote>Quote</blockquote> ==
20914 !! html
20915 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20916 <ul>
20917 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20918 </ul>
20919 </div>
20920
20921 <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>
20922
20923 !! html+tidy
20924 <p></p>
20925 <div id="toc" class="toc">
20926 <div id="toctitle">
20927 <h2>Contents</h2>
20928 </div>
20929 <ul>
20930 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20931 </ul>
20932 </div>
20933 <p></p>
20934 <h2><span class="mw-headline" id="Quote"></span></h2>
20935 <blockquote>
20936 <p><span class="mw-headline" id="Quote">Quote</span></p>
20937 </blockquote>
20938 <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>
20939 !! end
20940
20941 !! test
20942 Unclosed tags in TOC
20943 !! options
20944 title=[[Main Page]]
20945 !! wikitext
20946 __TOC__
20947 == Proof: 2 < 3 ==
20948 <small>Hanc marginis exiguitas non caperet.</small>
20949 QED
20950 !! html
20951 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20952 <ul>
20953 <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>
20954 </ul>
20955 </div>
20956
20957 <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>
20958 <p><small>Hanc marginis exiguitas non caperet.</small>
20959 QED
20960 </p>
20961 !! end
20962
20963 !! test
20964 Multiple tags in TOC
20965 !! wikitext
20966 __TOC__
20967 == <i>Foo</i> <b>Bar</b> ==
20968
20969 == <i>Foo</i> <blockquote>Bar</blockquote> ==
20970 !! html
20971 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20972 <ul>
20973 <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>
20974 <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>
20975 </ul>
20976 </div>
20977
20978 <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>
20979 <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>
20980
20981 !! html+tidy
20982 <p></p>
20983 <div id="toc" class="toc">
20984 <div id="toctitle">
20985 <h2>Contents</h2>
20986 </div>
20987 <ul>
20988 <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>
20989 <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>
20990 </ul>
20991 </div>
20992 <p></p>
20993 <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>
20994 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i></span></h2>
20995 <blockquote>
20996 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
20997 </blockquote>
20998 <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>
20999 !! end
21000
21001 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
21002 # html5 tag parsing.
21003 !! test
21004 Tags with parameters in TOC
21005 !! options
21006 parsoid=wt2html
21007 !! wikitext
21008 __TOC__
21009 == <sup class="in-h2">Hello</sup> ==
21010
21011 == <sup class="a > b">Evilbye</sup> ==
21012 !! html/php
21013 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21014 <ul>
21015 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
21016 <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>
21017 </ul>
21018 </div>
21019
21020 <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>
21021 <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>
21022
21023 !! html/parsoid
21024 <meta property="mw:PageProp/toc" />
21025 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
21026
21027 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
21028 !! end
21029
21030 !! test
21031 span tags with directionality in TOC
21032 !! wikitext
21033 __TOC__
21034 == <span dir="ltr">C++</span> ==
21035
21036 == <span dir="rtl">זבנג!</span> ==
21037
21038 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
21039
21040 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
21041
21042 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
21043 !! html
21044 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21045 <ul>
21046 <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>
21047 <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>
21048 <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>
21049 <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>
21050 <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>
21051 </ul>
21052 </div>
21053
21054 <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>
21055 <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>
21056 <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>
21057 <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>
21058 <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>
21059
21060 !! end
21061
21062 !! test
21063 Bug 72884: bdi element in ToC
21064 !! wikitext
21065 __TOC__
21066 == <bdi>test</bdi> ==
21067 !! html
21068 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21069 <ul>
21070 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
21071 </ul>
21072 </div>
21073
21074 <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>
21075
21076 !! end
21077
21078 # Note that the html output does not have the <p></p>, but the
21079 # html+tidy output *does*. This is because the empty <p></p> is
21080 # removed by the sanitizer, but only when tidy is *not* enabled (!).
21081 !! test
21082 Empty <p> tag in TOC, removed by Sanitizer (T92892)
21083 !! wikitext
21084 __TOC__
21085 == x ==
21086 !! html
21087 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21088 <ul>
21089 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21090 </ul>
21091 </div>
21092
21093 <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>
21094
21095 !! html+tidy
21096 <p></p>
21097 <div id="toc" class="toc">
21098 <div id="toctitle">
21099 <h2>Contents</h2>
21100 </div>
21101 <ul>
21102 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21103 </ul>
21104 </div>
21105 <p></p>
21106 <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>
21107 !! end
21108
21109 !! article
21110 MediaWiki:Bug32057
21111 !! text
21112 == {{int:headline_sample}} ==
21113 !! endarticle
21114
21115 !! test
21116 Bug 32057: Title needed when expanding <h> nodes.
21117 !! options
21118 title=[[Main Page]]
21119 !! wikitext
21120 {{int:Bug32057}}
21121 !! html
21122 <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>
21123
21124 !! end
21125
21126 !! test
21127 Strip marker in urlencode
21128 !! wikitext
21129 {{urlencode:x<nowiki/>y}}
21130 {{urlencode:x<nowiki/>y|wiki}}
21131 {{urlencode:x<nowiki/>y|path}}
21132 {{urlencode:x<pre id="one">two</pre>y}}
21133 !! html
21134 <p>xy
21135 xy
21136 xy
21137 xy
21138 </p>
21139 !! end
21140
21141 !! test
21142 Strip marker in lc
21143 !! wikitext
21144 {{lc:x<nowiki/>y}}
21145 !! html
21146 <p>xy
21147 </p>
21148 !! end
21149
21150 !! test
21151 Strip marker in uc
21152 !! wikitext
21153 {{uc:x<nowiki/>y}}
21154 !! html
21155 <p>XY
21156 </p>
21157 !! end
21158
21159 !! test
21160 Strip marker in formatNum
21161 !! wikitext
21162 {{formatnum:1<nowiki/>2}}
21163 {{formatnum:1<nowiki/>2|R}}
21164 !! html
21165 <p>12
21166 12
21167 </p>
21168 !! end
21169
21170 !! test
21171 Check noCommafy in formatNum
21172 !! options
21173 language=be-tarask
21174 !! wikitext
21175 {{formatnum:123456.78}}
21176 {{formatnum:123456.78|NOSEP}}
21177 !! html
21178 <p>123 456,78
21179 123456.78
21180 </p>
21181 !! end
21182
21183 !! test
21184 Wrong option for formatNum (bug 56199)
21185 !! wikitext
21186 {{formatnum:1,234.56|Random}}
21187 {{formatnum:1,234.56|EVERYTHING}}
21188 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
21189 !! html
21190 <p>1,234.56
21191 1,234.56
21192 1,234.56
21193 </p>
21194 !! end
21195
21196 !! test
21197 Strip marker in grammar
21198 !! options
21199 language=fi
21200 !! wikitext
21201 {{grammar:elative|foo<nowiki/>bar}}
21202 !! html
21203 <p>foobarista
21204 </p>
21205 !! end
21206
21207 !! test
21208 Strip marker in padleft
21209 !! wikitext
21210 {{padleft:|2|x<nowiki/>y}}
21211 !! html
21212 <p>xy
21213 </p>
21214 !! end
21215
21216 !! test
21217 Strip marker in padright
21218 !! wikitext
21219 {{padright:|2|x<nowiki/>y}}
21220 !! html
21221 <p>xy
21222 </p>
21223 !! end
21224
21225 !! test
21226 Strip marker in anchorencode
21227 !! wikitext
21228 {{anchorencode:x<nowiki/>y}}
21229 !! html
21230 <p>xy
21231 </p>
21232 !! end
21233
21234 !! test
21235 nowiki inside link inside heading (bug 18295)
21236 !! wikitext
21237 ==[[foo|x<nowiki>y</nowiki>z]]==
21238 !! html
21239 <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>
21240
21241 !! end
21242
21243 !! test
21244 new support for bdi element (bug 31817)
21245 !! wikitext
21246 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21247 !! html
21248 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21249
21250 !!end
21251
21252 !! test
21253 Ignore pipe between table row attributes
21254 !! wikitext
21255 {|
21256 | quux
21257 |- id=foo | style='color: red'
21258 | bar
21259 |}
21260 !! html
21261 <table>
21262 <tr>
21263 <td> quux
21264 </td></tr>
21265 <tr id="foo" style="color: red">
21266 <td> bar
21267 </td></tr></table>
21268
21269 !! end
21270
21271 !!test
21272 Gallery override link with WikiLink (bug 34852)
21273 !! wikitext
21274 <gallery>
21275 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
21276 </gallery>
21277 !! html
21278 <ul class="gallery mw-gallery-traditional">
21279 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21280 <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>
21281 <div class="gallerytext">
21282 <p>caption
21283 </p>
21284 </div>
21285 </div></li>
21286 </ul>
21287
21288 !! end
21289
21290 !!test
21291 Gallery override link with absolute external link (bug 34852)
21292 !! wikitext
21293 <gallery>
21294 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21295 </gallery>
21296 !! html
21297 <ul class="gallery mw-gallery-traditional">
21298 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21299 <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>
21300 <div class="gallerytext">
21301 <p>caption
21302 </p>
21303 </div>
21304 </div></li>
21305 </ul>
21306
21307 !! end
21308
21309 !!test
21310 Gallery override link with malicious javascript (bug 34852)
21311 !! wikitext
21312 <gallery>
21313 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21314 </gallery>
21315 !! html
21316 <ul class="gallery mw-gallery-traditional">
21317 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21318 <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>
21319 <div class="gallerytext">
21320 <p>caption
21321 </p>
21322 </div>
21323 </div></li>
21324 </ul>
21325
21326 !! end
21327
21328 !!test
21329 Gallery with invalid title as link (bug 43964)
21330 !! wikitext
21331 <gallery>
21332 File:foobar.jpg|link=<
21333 </gallery>
21334 !! html
21335 <ul class="gallery mw-gallery-traditional">
21336 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21337 <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>
21338 <div class="gallerytext">
21339 </div>
21340 </div></li>
21341 </ul>
21342
21343 !! end
21344
21345 !!test
21346 Language parser function
21347 !! wikitext
21348 {{#language:ar}}
21349 !! html
21350 <p>العربية
21351 </p>
21352 !! end
21353
21354 !!test
21355 Padleft and padright as substr
21356 !! wikitext
21357 {{padleft:|3|abcde}}
21358 {{padright:|3|abcde}}
21359 !! html
21360 <p>abc
21361 abc
21362 </p>
21363 !! end
21364
21365 !!test
21366 Special parser function
21367 !! wikitext
21368 {{#special:RandomPage}}
21369 {{#special:BaDtItLe}}
21370 {{#special:Foobar}}
21371 !! html
21372 <p>Special:Random
21373 Special:Badtitle
21374 Special:Foobar
21375 </p>
21376 !! end
21377
21378 !!test
21379 Bug 34939 - Case insensitive link parsing ([HttP://])
21380 !! wikitext
21381 [HttP://MediaWiki.Org/]
21382 !! html/php
21383 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
21384 </p>
21385 !! html/parsoid
21386 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
21387 !! end
21388
21389 !!test
21390 Bug 34939 - Case insensitive link parsing ([HttP:// title])
21391 !! wikitext
21392 [HttP://MediaWiki.Org/ MediaWiki]
21393 !! html
21394 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
21395 </p>
21396 !! end
21397
21398 !!test
21399 Bug 34939 - Case insensitive link parsing (HttP://)
21400 !! wikitext
21401 HttP://MediaWiki.Org/
21402 !! html/php
21403 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
21404 </p>
21405 !! html/parsoid
21406 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
21407 !! end
21408
21409 !!test
21410 Disable TOC
21411 !! options
21412 notoc
21413 !! wikitext
21414 Lead
21415 == Section 1 ==
21416 == Section 2 ==
21417 == Section 3 ==
21418 == Section 4 ==
21419 == Section 5 ==
21420 !! html
21421 <p>Lead
21422 </p>
21423
21424 <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>
21425 <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>
21426 <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>
21427 <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>
21428 <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>
21429
21430 !! end
21431
21432
21433 ###
21434 ### Parsoid-specific tests
21435 ### Parsoid-PHP parser incompatibilities
21436 ###
21437 !!test
21438 1. SOL-sensitive wikitext tokens as template-args
21439 !!options
21440 parsoid=wt2html,wt2wt
21441 !! wikitext
21442 {{echo|*a}}
21443 {{echo|#a}}
21444 {{echo|:a}}
21445 !! html
21446 <span about="#mwt1" typeof="mw:Transclusion">
21447 </span><ul about="#mwt1"><li>a</li>
21448 </ul>
21449 <span about="#mwt2" typeof="mw:Transclusion">
21450 </span><ol about="#mwt2"><li>a</li>
21451 </ol>
21452 <span about="#mwt3" typeof="mw:Transclusion">
21453 </span><dl about="#mwt3"><dd>a</dd>
21454 </dl>
21455 !!end
21456
21457 #### -----------------------------------------------------------------
21458 #### Parsoid-specific functionality tests
21459 #### -----------------------------------------------------------------
21460
21461 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
21462 # We know wt2wt will fail, but we expect selser to pass.
21463 # Due to the nature of our testing, wt2wt and selser tests will enter the
21464 # blacklist and we'll catch selser regressions based on changes to the
21465 # blacklist entries for selser tests.
21466 !! test
21467 1. Bad treebuilder fixup of formatting elt is cleaned up
21468 !! options
21469 parsoid=wt2html,wt2wt
21470 !! wikitext
21471 {|
21472 |
21473 <small>
21474 [[Image:Foobar.jpg|right|Test]]
21475 </small>
21476 |}
21477 !! html/parsoid
21478 <table>
21479 <tbody><tr><td>
21480 <small>
21481 <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>
21482 </small>
21483 </td></tr>
21484 </tbody></table>
21485 !! end
21486
21487 !! test
21488 2. Bad treebuilder fixup of formatting elt is cleaned up
21489 !! options
21490 parsoid=wt2html,wt2wt
21491 !! wikitext
21492 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
21493
21494 <small>[[Image:Foobar.jpg|right|300px]]</small>
21495 !! html/parsoid
21496
21497 <p><b>foo</b></p>
21498 <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>
21499 <p><b>bar</b></p>
21500 <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>
21501 !! end
21502
21503 !! test
21504 3. Bad treebuilder fixup of formatting elt is cleaned up
21505 !! options
21506 parsoid=wt2html,wt2wt
21507 !! wikitext
21508 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
21509 !! html/parsoid
21510 <p><small><b>foo</b></small></p>
21511 <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>
21512 <p><small><b>bar</b></small></p>
21513 !! end
21514
21515 !! test
21516 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
21517 !! options
21518 parsoid=wt2html,wt2wt
21519 !! wikitext
21520 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
21521 !! html/parsoid
21522 <p><b><small></small></b></p>
21523 <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>
21524 <p></p>
21525 !! end
21526
21527 #### ----------------------------------------------------------------
21528 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
21529 #### tags. Parsoid's output for these tags differs from that of the
21530 #### PHP parser.
21531 #### ----------------------------------------------------------------
21532
21533 !!test
21534 Ref: 1. ref-location should be replaced with an index span
21535 !! wikitext
21536 A <ref>foo</ref>
21537 B <ref name="x">foo</ref>
21538 C <ref name="y" />
21539 <references />
21540 !! html/parsoid
21541 <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>
21542 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>
21543 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>
21544 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21545 <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>
21546 <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>
21547 <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>
21548 </ol>
21549 !!end
21550
21551 !!test
21552 Ref: 2. ref-tags with identical names should all get the same index
21553 !! wikitext
21554 A <ref name="x">foo</ref>
21555 B <ref name="x" />
21556 <references />
21557 !! html/parsoid
21558 <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>
21559 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>
21560 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21561 <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>
21562 </ol>
21563 !!end
21564
21565 !!test
21566 Ref: 3. spaces in ref-names should be ignored
21567 !! wikitext
21568 A <ref name="x">foo</ref>
21569 B <ref name=" x " />
21570 C <ref name= x />
21571 <references />
21572 !! html/parsoid
21573 <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>
21574 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>
21575 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>
21576 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21577 <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>
21578 </ol>
21579 !!end
21580
21581 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
21582 !!test
21583 Ref: 4. 'constructor' should be accepted as a valid ref-name
21584 !! wikitext
21585 A <ref name="constructor">foo</ref>
21586 <references />
21587 !! html/parsoid
21588 <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>
21589 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21590 <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>
21591 </ol>
21592 !!end
21593
21594 !!test
21595 Ref: 5. body should accept generic wikitext
21596 !! wikitext
21597 A <ref>
21598 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
21599 </ref>
21600
21601 <references />
21602 !! html/parsoid
21603 <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>
21604
21605 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21606 <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>
21607 </span></li>
21608 </ol>
21609 !!end
21610
21611 !!test
21612 Ref: 6. indent-pres should not be output in ref-body
21613 !! wikitext
21614 A <ref>
21615 foo
21616 bar
21617 baz
21618 </ref>
21619
21620 <references />
21621 !! html/parsoid
21622 <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>
21623
21624 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21625 <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
21626 bar
21627 baz
21628 </span></li>
21629 </ol>
21630 !!end
21631
21632 !!test
21633 Ref: 7. No p-wrapping in ref-body
21634 !! wikitext
21635 A <ref>
21636 foo
21637
21638 bar
21639
21640
21641 baz
21642
21643
21644
21645 booz
21646 </ref>
21647
21648 <references />
21649 !! html/parsoid
21650 <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>
21651
21652 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21653 <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
21654
21655 bar
21656
21657
21658 baz
21659
21660
21661
21662 booz
21663 </span></li>
21664 </ol>
21665 !!end
21666
21667 !!test
21668 Ref: 8. transclusion wikitext has lower precedence
21669 !! wikitext
21670 A <ref> foo {{echo|</ref> B C}}
21671
21672 <references />
21673 !! html/parsoid
21674 <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>
21675 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21676 <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>
21677 </ol>
21678 !!end
21679
21680 !!test
21681 Ref: 9. unclosed comments should not leak out of ref-body
21682 !! wikitext
21683 A <ref> foo <!--</ref> B C
21684 <references />
21685 !! html/parsoid
21686 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B C</p>
21687 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21688 <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>
21689 </ol>
21690 !!end
21691
21692 !!test
21693 Ref: 10. Unclosed HTML tags should not leak out of ref-body
21694 !! wikitext
21695 A <ref> <b> foo </ref> B C
21696
21697 <references />
21698 !! html/parsoid
21699 <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>
21700
21701
21702 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21703 <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>
21704 </ol>
21705 !!end
21706
21707 !!test
21708 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
21709 !! wikitext
21710 A <ref>foo</ref> B
21711 C <ref>bar</ref> D
21712 <references />
21713 !! html/parsoid
21714 <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
21715 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>
21716 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21717 <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>
21718 <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>
21719 </ol>
21720 !!end
21721
21722 !!test
21723 Ref: 12. ref-tags act as trailing newline migration barrier
21724 !! wikitext
21725 <!--the newline at the end of this line moves out of the p tag-->a
21726
21727 b<!--the newline at the end of this line stays inside the p tag--> <ref />
21728 <ref />
21729
21730 c
21731 <references />
21732 !! html/parsoid
21733 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
21734
21735
21736 <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>
21737 <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>
21738
21739 <p>c</p>
21740 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21741 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"></span></li>
21742 <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>
21743 !!end
21744
21745 !!test
21746 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
21747 !! wikitext
21748 <ref>foo</ref> A
21749 <ref>bar
21750 </ref> B
21751 <references />
21752 !! html/parsoid
21753 <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
21754 <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>
21755 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21756 <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>
21757 <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
21758 </span></li>
21759 </ol>
21760 !!end
21761
21762 !!test
21763 Ref: 14. A nested ref-tag should be emitted as plain text
21764 !! wikitext
21765 <ref>foo <ref>bar</ref> baz</ref>
21766
21767 <references />
21768 !! html/parsoid
21769 <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>
21770 </p>
21771 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21772 <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>
21773 </ol>
21774 !!end
21775
21776 !!test
21777 Ref: 15. ref-tags with identical names should get identical indexes
21778 !! wikitext
21779 A1 <ref name="a">foo</ref> A2 <ref name="a" />
21780 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
21781
21782 <references />
21783 !! html/parsoid
21784 <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>
21785 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>
21786
21787 <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>
21788 </ol>
21789 !!end
21790
21791 ## We don't bother wt2wt-ing non-standard whitespace
21792 !!test
21793 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
21794 !!options
21795 parsoid=wt2html
21796 !! wikitext
21797 A <ref >foo</ref >
21798
21799 <references />
21800 !! html/parsoid
21801 <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>
21802 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21803 <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>
21804 !!end
21805
21806 !!test
21807 Ref: 17. Generate valid HTML5 id/about attributes
21808 !!wikitext
21809 <ref name="a b">foo</ref>
21810
21811 <references />
21812 !!html/parsoid
21813 <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>
21814 </p>
21815
21816 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21817 <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>
21818 </ol>
21819 !!end
21820
21821 !!test
21822 Ref: 18. T58916: Extension attributes should be parsed as plain text
21823 !!wikitext
21824 <ref name="{{echo|a}}">foo</ref>
21825
21826 <references />
21827 !!html/parsoid
21828 <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>
21829 </p>
21830
21831 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21832 <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>
21833 </ol>
21834 !!end
21835
21836 !!test
21837 Ref: 19. ref-tags with identical name encodings should get identical indexes
21838 !! wikitext
21839 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
21840
21841 <references />
21842 !! html/parsoid
21843 <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>
21844 </p>
21845 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21846 <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>
21847 </ol>
21848 !!end
21849
21850 !!test
21851 Ref: 20. ref-tags with identical names but different content should keep it
21852 !! wikitext
21853 A <ref name="foo">Foo one</ref>
21854 B <ref name="foo">Foo two</ref>
21855 C <ref name="foo" />
21856
21857 <references />
21858 !! html/parsoid
21859 <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>
21860 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>
21861 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>
21862
21863 <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>
21864 </ol>
21865 !!end
21866
21867 !!test
21868 References: 1. references tag without any refs should be handled properly
21869 !! wikitext
21870 <references />
21871 !! html/parsoid
21872 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21873 !!end
21874
21875 !!test
21876 References: 2. references tag with group only outputs references from that group
21877 !! wikitext
21878 A <ref group="a">foo</ref>
21879 B <ref group="b">bar</ref>
21880 C <ref>baz</ref>
21881
21882 <references group="a" />
21883 <references />
21884 <references group="b" />
21885 !! html/parsoid
21886 <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>
21887 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>
21888 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>
21889
21890 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
21891 <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>
21892 </ol>
21893 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
21894 <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>
21895 </ol>
21896 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
21897 <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>
21898 </ol>
21899 !!end
21900
21901 !!test
21902 References: 3. ref list should be cleared after processing references
21903 !! wikitext
21904 A <ref>foo</ref>
21905
21906 <references />
21907
21908 B <ref>bar</ref>
21909
21910 <references />
21911 !! html/parsoid
21912 <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>
21913
21914 <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>
21915 </ol>
21916
21917 <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>
21918
21919 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21920 <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>
21921 </ol>
21922 !!end
21923
21924 !!test
21925 References: 4. only referenced group should be cleared after processing references
21926 !! wikitext
21927 A <ref group="a">afoo</ref>
21928 B <ref>bfoo</ref>
21929
21930 <references group="a" />
21931
21932 C <ref>cfoo</ref>
21933
21934 <references />
21935 !! html/parsoid
21936 <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>
21937 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>
21938
21939 <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>
21940 </ol>
21941
21942 <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>
21943
21944 <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>
21945 </ol>
21946 !!end
21947
21948 !!test
21949 References: 5. ref tags in references should be processed while ignoring all other content
21950 !! wikitext
21951 A <ref name="a" />
21952 B <ref name="b">bar</ref>
21953
21954 <references>
21955 <ref name="a">foo</ref>
21956 This should just get lost.
21957 </references>
21958 !! html/parsoid
21959 <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>
21960 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>
21961
21962
21963 <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>
21964 </ol>
21965 !!end
21966
21967 !!test
21968 References: 6. <references /> from a transclusion
21969 !! wikitext
21970 <ref>Foo</ref> {{echo|<references />}}
21971 !! html/parsoid
21972 <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>
21973 </ol>
21974 !!end
21975
21976 !! test
21977 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
21978 !! wikitext
21979 A <ref>foo bar for a</ref>
21980 B <ref group="X" name="b" />
21981
21982 <references />
21983
21984 <references group="X">
21985 <ref name="b">foo</ref>
21986 </references>
21987 !! html/parsoid
21988 <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>
21989 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>
21990 </p>
21991
21992 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21993 <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>
21994 </ol>
21995
21996 <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"}}'>
21997 <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>
21998 </ol>
21999 !! end
22000
22001 !! test
22002 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
22003 !! wikitext
22004 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
22005 <references />
22006 !! html/parsoid
22007 <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>
22008 <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>
22009 </ol>
22010 !!end
22011
22012 # This test only works in wt2html now as the <references /> are always generated
22013 # unless selser is active. Once T72722 is fixed, we should add a changes test
22014 # here to ensure that unrelated changes don't add the new <references /> in
22015 # wt2wt.
22016 !! test
22017 References: 9. Generate missing references list at the end
22018 !! wikitext
22019 A <ref>foo</ref>
22020 B <ref group="inexistent">bar</ref>
22021 !! html/parsoid
22022 <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>
22023 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22024 <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>
22025 </ol>
22026 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
22027 <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>
22028 </ol>
22029 !! end
22030
22031 !! test
22032 References: 10. New <references/> shouldn't be added for unrelated edits.
22033 !! options
22034 parsoid={
22035 "modes": ["selser"],
22036 "changes": [["#x", "remove"]],
22037 "selser": "noauto"
22038 }
22039 !! wikitext
22040 Unrelated text<span id="x"> that's going to disappear</span>.
22041 A <ref>foo</ref>
22042 !! wikitext/edited
22043 Unrelated text.
22044 A <ref>foo</ref>
22045 !!end
22046
22047 !! test
22048 Entities in ref name
22049 !! wikitext
22050 <ref name="test &amp; me">hi</ref>
22051 <references />
22052 !! html/parsoid
22053 <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>
22054 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22055 <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>
22056 </ol>
22057 !! end
22058
22059 # This test is wt2html only because we're permitting the serializer to produce
22060 # dirty diffs, normalizing the unclosed references to the self-closed version.
22061 !! test
22062 Generate references for unclosed references tag
22063 !! options
22064 parsoid=wt2html
22065 !! wikitext
22066 a<ref>foo</ref>
22067
22068 <references>
22069 !! html/parsoid
22070 <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>
22071 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22072 <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>
22073 !! end
22074
22075 !! test
22076 New reference serializes on its own line
22077 !! options
22078 parsoid=wt2wt,html2wt
22079 !! wikitext
22080 foo
22081 <references />
22082 !! html/parsoid
22083 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22084 !! end
22085
22086 #### ----------------------------------------------------------------
22087 #### Parsoid-only testing of Parsoid's impl of LST
22088 #### Not implemented yet, see
22089 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
22090 #### ----------------------------------------------------------------
22091
22092 !! test
22093 LST Sections: 1. Simple section start and end
22094 !! options
22095 parsoid={ "suppressErrors": true }
22096 !! wikitext
22097 <section begin="2011-05-16" />
22098 <section end="2014-04-10 (MW 1.23wmf22)" />
22099 !! html/parsoid
22100 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
22101 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
22102 !! end
22103
22104 #--------- Test stripping of empty nodes in template content ----------
22105 !!test
22106 Empty LI and TR nodes should be stripped from template content
22107 !!wikitext
22108 {{EmptyLITest}}
22109 {{EmptyTRTest}}
22110 !!html/parsoid
22111 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
22112 <li>a</li>
22113 <li>b</li>
22114 </ul>
22115 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
22116 <tbody>
22117 <tr>
22118 <td>foo</td>
22119 </tr>
22120 <tr>
22121 <td>bar</td>
22122 </tr>
22123 </tbody>
22124 </table>
22125 !!end
22126
22127 !!test
22128 Empty LI and TR nodes should not be stripped from top-level content
22129 !!wikitext
22130 * a
22131 *
22132 * b
22133 {|
22134 |-
22135 |-
22136 |foo
22137 |}
22138 !!html/parsoid
22139 <ul>
22140 <li> a</li>
22141 <li></li>
22142 <li> b</li>
22143 </ul>
22144 <table>
22145 <tbody>
22146 <tr></tr>
22147 <tr>
22148 <td>foo</td>
22149 </tr>
22150 </tbody>
22151 </table>
22152 !!end
22153
22154 !!test
22155 Empty TR nodes should not be stripped if they have any attributes set
22156 !!wikitext
22157 {{EmptyTRWithHTMLAttrTest}}
22158 !!html/parsoid
22159 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
22160 <tr align="center"></tr>
22161 <tr><td>foo</td></tr>
22162 <tr align="center"></tr>
22163 <tr><td>bar</td></tr>
22164 </table>
22165 !!end
22166
22167 #### ----------------------------------------------------------------
22168 #### The following section of tests are primarily to test
22169 #### wikitext escaping capabilities of Parsoid. Given that
22170 #### escaping can be done any number of ways, the wikitext (input)
22171 #### is always adjusted to reflect how Parsoid adds nowiki
22172 #### escape tags.
22173 ####
22174 #### We are marking several tests as parsoid-only since the
22175 #### HTML in the result section is different from what the
22176 #### PHP parser generates for it.
22177 #### ----------------------------------------------------------------
22178
22179
22180 #### --------------- Headings ---------------
22181 #### 0. Unnested
22182 #### 1. Nested inside html <h1>=foo=</h1>
22183 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
22184 #### 3. Nested inside html with wikitext split by html tags
22185 #### 4. No escape needed
22186 #### 5. Empty headings <h1></h1>
22187 #### 6. Heading chars in SOL context
22188 #### ----------------------------------------
22189 !! test
22190 Headings: 0. Unnested
22191 !! options
22192 parsoid=html2wt
22193 !! html/parsoid
22194 <p>=foo=</p>
22195
22196 <p> =foo=
22197 <!--cmt-->
22198 =foo=</p>
22199
22200 <p>=foo<i>a</i>=</p>
22201 !! wikitext
22202 <nowiki>=foo=</nowiki>
22203
22204 <nowiki> </nowiki>=foo=
22205 <!--cmt-->
22206 <nowiki>=foo=</nowiki>
22207
22208 =foo''a''<nowiki>=</nowiki>
22209 !!end
22210
22211 # New headings and existing headings are handled differently
22212 !! test
22213 Headings: 1. Nested inside html
22214 !! options
22215 parsoid=html2wt
22216 !! html/parsoid
22217 <h1>=foo=</h1>
22218 <h2>=foo=</h2>
22219 <h3>=foo=</h3>
22220
22221 <h1 data-parsoid=''>=foo=</h1>
22222 <h2 data-parsoid=''>=foo=</h2>
22223 <h3 data-parsoid=''>=foo=</h3>
22224 <h4 data-parsoid=''>=foo=</h4>
22225 <h5 data-parsoid=''>=foo=</h5>
22226 <h6 data-parsoid=''>=foo=</h6>
22227 !! wikitext
22228 = =foo= =
22229
22230 == =foo= ==
22231
22232 === =foo= ===
22233
22234 =<nowiki>=foo=</nowiki>=
22235 ==<nowiki>=foo=</nowiki>==
22236 ===<nowiki>=foo=</nowiki>===
22237 ====<nowiki>=foo=</nowiki>====
22238 =====<nowiki>=foo=</nowiki>=====
22239 ======<nowiki>=foo=</nowiki>======
22240
22241 !!end
22242
22243 !! test
22244 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
22245 !! options
22246 parsoid=html2wt
22247 !! html/parsoid
22248 <h1>foo</h1>*bar
22249 <h1>foo</h1>=bar
22250 <h1>foo</h1>=bar=
22251 !! wikitext
22252 = foo =
22253 <nowiki>*</nowiki>bar
22254
22255 = foo =
22256 =bar
22257
22258 = foo =
22259 <nowiki>=bar=</nowiki>
22260 !!end
22261
22262 !! test
22263 Headings: 3. Nested inside html with wikitext split by html tags
22264 !! options
22265 parsoid=html2wt
22266 !! html/parsoid
22267 <h1>=<b>bold</b>foo=</h1>
22268 !! wikitext
22269 = ='''bold'''<nowiki>foo=</nowiki> =
22270 !!end
22271
22272 !! test
22273 Headings: 4a. No escaping needed (testing just h1 and h2)
22274 !! options
22275 parsoid=html2wt
22276 !! html/parsoid
22277 <h1>=foo</h1>
22278 <h1>foo=</h1>
22279 <h1> =foo= </h1>
22280 <h1>=foo= bar</h1>
22281 <h2>=foo</h2>
22282 <h2>foo=</h2>
22283 <h1>=</h1>
22284 <h1><i>=</i>foo=</h1>
22285 !! wikitext
22286 = =foo =
22287
22288 = foo= =
22289
22290 = =foo= =
22291
22292 = =foo= bar =
22293
22294 == =foo ==
22295
22296 == foo= ==
22297
22298 = = =
22299
22300 = ''=''foo= =
22301 !!end
22302
22303 !! test
22304 Headings: 4b. No escaping needed (inside p-tags)
22305 !! options
22306 parsoid=html2wt
22307 !! html/parsoid
22308 <p>===
22309 =foo= x
22310 =foo= <s></s>
22311 </p>
22312 !! wikitext
22313 ===
22314 =foo= x
22315 =foo= <s></s>
22316 !!end
22317
22318 !! test
22319 Headings: 5. Empty headings
22320 !! options
22321 parsoid=html2wt
22322 !! html/parsoid
22323 <h1 data-parsoid='{}'></h1>
22324
22325 <h2 data-parsoid='{}'></h2>
22326
22327 <h3 data-parsoid='{}'></h3>
22328
22329 <h4 data-parsoid='{}'></h4>
22330
22331 <h5 data-parsoid='{}'></h5>
22332
22333 <h6 data-parsoid='{}'></h6>
22334 !! wikitext
22335 =<nowiki/>=
22336
22337 ==<nowiki/>==
22338
22339 ===<nowiki/>===
22340
22341 ====<nowiki/>====
22342
22343 =====<nowiki/>=====
22344
22345 ======<nowiki/>======
22346 !!end
22347
22348 !! test
22349 Headings: 6a. Heading chars in SOL context (with trailing spaces)
22350 !! options
22351 parsoid=html2wt
22352 !! html/parsoid
22353 <p>=a=</p>
22354
22355 <p>=a=</p>
22356
22357 <p>=a=</p>
22358 !! wikitext
22359 <nowiki>=a=</nowiki>
22360
22361 <nowiki>=a=</nowiki>
22362
22363 <nowiki>=a=</nowiki>
22364 !!end
22365
22366 !! test
22367 Headings: 6b. Heading chars in SOL context (with trailing newlines)
22368 !! options
22369 parsoid=html2wt
22370 !! html/parsoid
22371 <p>=a=
22372 b</p>
22373
22374 <p>=a=
22375 b</p>
22376
22377 <p>=a=
22378 b</p>
22379 !! wikitext
22380 <nowiki>=a=</nowiki>
22381 b
22382
22383 <nowiki>=a=</nowiki>
22384 b
22385
22386 <nowiki>=a=</nowiki>
22387 b
22388 !!end
22389
22390 !! test
22391 Headings: 6c. Heading chars in SOL context (leading newline break)
22392 !! options
22393 parsoid=html2wt
22394 !! html/parsoid
22395 <p>a
22396 =b=</p>
22397 !! wikitext
22398 a
22399 <nowiki>=b=</nowiki>
22400 !!end
22401
22402 !! test
22403 Headings: 6d. Heading chars in SOL context (with interspersed comments)
22404 !! options
22405 parsoid=html2wt
22406 !! html/parsoid
22407 <!--c0--><p>=a=</p>
22408
22409 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
22410 !! wikitext
22411 <!--c0--><nowiki>=a=</nowiki>
22412
22413 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
22414 !!end
22415
22416 !! test
22417 Headings: 6d. Heading chars in SOL context (No escaping needed)
22418 !! options
22419 parsoid=html2wt
22420 !! html/parsoid
22421 =a=<div>b</div>
22422 !! wikitext
22423 =a=<div>b</div>
22424 !!end
22425
22426 !! test
22427 Headings: 7. Insert a newline between new content and headings
22428 !! options
22429 parsoid=html2wt
22430 !! html/parsoid
22431 <h2>NEW</h2>
22432 <p>new</p>
22433 <h2 data-parsoid='{}'>A</h2>
22434 <p data-parsoid='{}'>a</p>
22435 !! wikitext
22436 == NEW ==
22437 new
22438
22439 ==A==
22440 a
22441
22442 !! end
22443
22444 #### --------------- Lists ---------------
22445 #### 0. Outside nests (*foo, etc.)
22446 #### 1. Nested inside html <ul><li>*foo</li></ul>
22447 #### 2. Inside definition lists
22448 #### 3. Only bullets at start should be escaped
22449 #### 4. No escapes needed
22450 #### 5. No unnecessary escapes
22451 #### 6. Escape bullets in SOL position
22452 #### 7. Escape bullets in a multi-line context
22453 #### ----------------------------------------
22454
22455 !! test
22456 Lists: 0. Outside nests
22457 !! options
22458 parsoid=html2wt
22459 !! html/parsoid
22460 <p>*foo</p>
22461
22462 <p>#foo</p>
22463
22464 <p>;Foo:bar</p>
22465 !! wikitext
22466 <nowiki>*</nowiki>foo
22467
22468 <nowiki>#</nowiki>foo
22469
22470 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
22471 !!end
22472
22473 !! test
22474 Lists: 1. Nested inside html
22475 !! options
22476 parsoid=html2wt
22477 !! html/parsoid
22478 <ul><li>*foo</li></ul>
22479 <ul><li>#foo</li></ul>
22480 <ul><li>:foo</li></ul>
22481 <ul><li>;foo</li></ul>
22482 <ol><li>*foo</li></ol>
22483 <ol><li>#foo</li></ol>
22484 <ol><li>:foo</li></ol>
22485 <ol><li>;foo</li></ol>
22486
22487 !! wikitext
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
22502 #<nowiki>;foo</nowiki>
22503 !!end
22504
22505 !! test
22506 Lists: 2. Inside definition lists
22507 !! options
22508 parsoid=html2wt
22509 !! html/parsoid
22510 <dl><dt>;foo</dt></dl>
22511 <dl><dt>:foo</dt></dl>
22512 <dl><dt>:foo</dt>
22513 <dd>bar</dd></dl>
22514 <dl><dd>:foo</dd></dl>
22515
22516 !! wikitext
22517 ;<nowiki>;foo</nowiki>
22518
22519 ;<nowiki>:foo</nowiki>
22520
22521 ;<nowiki>:foo</nowiki>
22522 :bar
22523
22524 :<nowiki>:foo</nowiki>
22525 !!end
22526
22527 !! test
22528 Lists: 3. Only bullets at start of text should be escaped
22529 !! options
22530 parsoid=html2wt
22531 !! html/parsoid
22532 <ul><li>*foo*bar</li></ul>
22533 <ul><li>*foo<i>it</i>*bar</li></ul>
22534
22535 !! wikitext
22536 *<nowiki>*foo*bar</nowiki>
22537
22538 *<nowiki>*foo</nowiki>''it''*bar
22539 !!end
22540
22541 !! test
22542 Lists: 4. No escapes needed
22543 !! options
22544 parsoid=html2wt
22545 !! html/parsoid
22546 <ul>
22547 <li>foo*bar
22548 </li>
22549 </ul>
22550 <ul>
22551 <li><i>foo</i>*bar
22552 </li>
22553 </ul>
22554 <ul>
22555 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
22556 </li>
22557 </ul>
22558 <ul>
22559 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
22560 </li>
22561 </ul>
22562 !! wikitext
22563 *foo*bar
22564
22565 *''foo''*bar
22566
22567 *[[Foo]]: bar
22568
22569 *[[Foo]]*bar
22570 !!end
22571
22572 !! test
22573 Lists: 5. No unnecessary escapes
22574 !! options
22575 parsoid=html2wt
22576 !! html/parsoid
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> ]]bar <span>[[foo]]</span></li></ul>
22581 <ul><li> =bar <span>foo]]</span>=</li></ul>
22582 <ul><li> <s></s>: a</li></ul>
22583 <ul><li> <i>* foo</i></li></ul>
22584
22585 !! wikitext
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><nowiki>[[foo]]</nowiki></span>
22593
22594 * =bar <span>foo]]</span>=
22595
22596 * <s></s>: a
22597
22598 * ''* foo''
22599 !!end
22600
22601 !! test
22602 Lists: 6. Escape bullets in SOL position
22603 !! options
22604 parsoid=html2wt
22605 !! html/parsoid
22606 <p><!--cmt-->*foo</p>
22607 !! wikitext
22608 <!--cmt--><nowiki>*</nowiki>foo
22609 !!end
22610
22611 !! test
22612 Lists: 7. Escape bullets in a multi-line context
22613 !! options
22614 parsoid=html2wt
22615 !! html/parsoid
22616 <p>a
22617 *b
22618 </p>
22619 !! wikitext
22620 a
22621 <nowiki>*</nowiki>b
22622 !!end
22623
22624 !! test
22625 Lists: 8. Escape colons only if not present in tags
22626 !! options
22627 parsoid=html2wt
22628 !! html/parsoid
22629 <dl><dt>a:b<i>c:d</i></dt></dl>
22630 !! wikitext
22631 ; <nowiki>a:b</nowiki>''c:d''
22632 !! end
22633
22634 #### --------------- HRs ---------------
22635 #### 1. Single line
22636 #### -----------------------------------
22637
22638 !! test
22639 HRs: 1. Single line
22640 !! options
22641 parsoid=html2wt
22642 !! html/parsoid
22643 <hr />----
22644 <hr />=foo=
22645 <hr />*foo
22646 !! wikitext
22647 ----<nowiki>----</nowiki>
22648 ----=foo=
22649 ----*foo
22650 !! end
22651
22652 #### --------------- Tables ---------------
22653 #### 1a. Simple example
22654 #### 1b. No escaping needed (!foo)
22655 #### 1c. No escaping needed (|foo)
22656 #### 1d. No escaping needed (|}foo)
22657 ####
22658 #### 2a. Nested in td (<td>foo|bar</td>)
22659 #### 2b. Nested in td (<td>foo||bar</td>)
22660 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
22661 ####
22662 #### 3a. Nested in th (<th>foo!bar</th>)
22663 #### 3b. Nested in th (<th>foo!!bar</th>)
22664 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
22665 ####
22666 #### 4a. Escape -
22667 #### 4b. Escape +
22668 #### 4c. No escaping needed
22669 #### --------------------------------------
22670
22671 !! test
22672 Tables: 1a. Simple example
22673 !! options
22674 parsoid=html2wt
22675 !! html/parsoid
22676 <p>{|
22677 |}
22678 </p>
22679 !! wikitext
22680 <nowiki>{|</nowiki>
22681 |}
22682 !! end
22683
22684 !! test
22685 Tables: 1b. No escaping needed
22686 !! options
22687 parsoid=html2wt
22688 !! html/parsoid
22689 <p>!foo
22690 </p>
22691 !! wikitext
22692 !foo
22693 !! end
22694
22695 !! test
22696 Tables: 1c. No escaping needed
22697 !! options
22698 parsoid=html2wt
22699 !! html/parsoid
22700 <p>|foo
22701 </p>
22702 !! wikitext
22703 |foo
22704 !! end
22705
22706 !! test
22707 Tables: 1d. No escaping needed
22708 !! options
22709 parsoid=html2wt
22710 !! html/parsoid
22711 <p>|}foo
22712 </p>
22713 !! wikitext
22714 |}foo
22715 !! end
22716
22717 !! test
22718 Tables: 2a. Nested in td
22719 !! options
22720 parsoid=html2wt
22721 !! html/parsoid
22722 <table><tbody><tr>
22723 <td>foo|bar</td></tr>
22724 <tr><td>x<div>a|b</div></td>
22725 </tbody></table>
22726 !! wikitext
22727 {|
22728 |<nowiki>foo|bar</nowiki>
22729 |-
22730 |x<div><nowiki>a|b</nowiki></div>
22731 |}
22732 !! html/php+tidy
22733 <table>
22734 <tr>
22735 <td>foo|bar</td>
22736 </tr>
22737 <tr>
22738 <td>x
22739 <div>a|b</div>
22740 </td>
22741 </tr>
22742 </table>
22743 !! end
22744
22745 !! test
22746 Tables: 2b. Nested in td
22747 !! options
22748 parsoid=html2wt
22749 !! html/parsoid
22750 <table><tbody><tr>
22751 <td>foo||bar</td>
22752 <td>a<i>b||c</i></td>
22753 <td>a<i><div>b||c</div></i></td>
22754 </tr></tbody></table>
22755 !! wikitext
22756 {|
22757 |<nowiki>foo||bar</nowiki>
22758 |a''<nowiki>b||c</nowiki>''
22759 |a''<div><nowiki>b||c</nowiki></div>''
22760 |}
22761 !! html/php
22762 <table>
22763 <tr>
22764 <td>foo||bar
22765 </td>
22766 <td>a<i>b||c</i>
22767 </td>
22768 <td>a<i><div>b||c</div></i>
22769 </td></tr></table>
22770
22771 !! end
22772
22773 !! test
22774 Tables: 2c. Nested in td -- no escaping needed
22775 !! options
22776 parsoid=html2wt
22777 !! html/*
22778 <table>
22779
22780 <tr>
22781 <td>foo!!bar
22782 </td></tr></table>
22783
22784 !! wikitext
22785 {|
22786
22787 |foo!!bar
22788 |}
22789 !! end
22790
22791 !! test
22792 Tables: 3a. Nested in th
22793 !! options
22794 parsoid=html2wt
22795 !! html/*
22796 <table>
22797
22798 <tr>
22799 <th>foo!bar
22800 </th></tr></table>
22801
22802 !! wikitext
22803 {|
22804
22805 !foo!bar
22806 |}
22807 !! end
22808
22809 !! test
22810 Tables: 3b. Nested in th
22811 !! options
22812 parsoid=html2wt
22813 !! html/parsoid
22814 <table><tbody>
22815 <tr><th>foo!!bar</th>
22816 <th><i>foo|bar</i></th>
22817 <th><i>foo!!bar</i></th>
22818 <th><i><span>foo!!bar</span></i></th>
22819 </tr></tbody></table>
22820 !! wikitext
22821 {|
22822 !<nowiki>foo!!bar</nowiki>
22823 !''<nowiki>foo|bar</nowiki>''
22824 !''<nowiki>foo!!bar</nowiki>''
22825 !''<span><nowiki>foo!!bar</nowiki></span>''
22826 |}
22827 !! html/php
22828 <table>
22829 <tr>
22830 <th>foo!!bar
22831 </th>
22832 <th><i>foo|bar</i>
22833 </th>
22834 <th><i>foo!!bar</i>
22835 </th>
22836 <th><i><span>foo!!bar</span></i>
22837 </th></tr></table>
22838
22839 !! end
22840
22841 !! test
22842 Tables: 3c. Nested in th
22843 !! options
22844 parsoid=html2wt
22845 !! html/parsoid
22846 <table><tbody>
22847 <tr><th>foo||bar</th>
22848 <th><span typeof="mw:Nowiki">foo||bar</span></th>
22849 </tr></tbody></table>
22850 !! wikitext
22851 {|
22852 !<nowiki>foo||bar</nowiki>
22853 !<nowiki>foo||bar</nowiki>
22854 |}
22855 !! html/php
22856 <table>
22857 <tr>
22858 <th>foo||bar
22859 </th>
22860 <th>foo||bar
22861 </th></tr></table>
22862
22863 !! end
22864
22865 !! test
22866 Tables: 4a. Escape -
22867 !! options
22868 parsoid=html2wt
22869 !! html/*
22870 <table>
22871
22872 <tr>
22873 <th>-bar
22874 </th></tr>
22875 <tr>
22876 <td>-bar
22877 </td></tr></table>
22878
22879 !! wikitext
22880 {|
22881
22882 !-bar
22883
22884 |-
22885 |<nowiki>-bar</nowiki>
22886 |}
22887 !! end
22888
22889 !! test
22890 Tables: 4b. Escape +
22891 !! options
22892 parsoid=html2wt
22893 !! html/*
22894 <table>
22895
22896 <tr>
22897 <th>+bar
22898 </th></tr>
22899 <tr>
22900 <td>+bar
22901 </td></tr></table>
22902
22903 !! wikitext
22904 {|
22905
22906 !+bar
22907
22908 |-
22909 |<nowiki>+bar</nowiki>
22910 |}
22911 !! end
22912
22913 !! test
22914 Tables: 4c. No escaping needed
22915 !! options
22916 parsoid=html2wt
22917 !! html/parsoid
22918 <table><tbody>
22919 <tr><td>foo-bar</td><td>foo+bar</td></tr>
22920 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
22921 <tr><td>foo
22922 <p>bar|baz
22923 +bar
22924 -bar</p></td></tr>
22925 <tr><td>x
22926 <div>a|b</div></td>
22927 </tbody></table>
22928 !! wikitext
22929 {|
22930 |foo-bar
22931 |foo+bar
22932 |-
22933 |''foo''-bar
22934 |''foo''+bar
22935 |-
22936 |foo
22937 bar|baz
22938 +bar
22939 -bar
22940 |-
22941 |x
22942 <div>a|b</div>
22943 |}
22944 !! html/php
22945 <table>
22946 <tr>
22947 <td>foo-bar
22948 </td>
22949 <td>foo+bar
22950 </td></tr>
22951 <tr>
22952 <td><i>foo</i>-bar
22953 </td>
22954 <td><i>foo</i>+bar
22955 </td></tr>
22956 <tr>
22957 <td>foo
22958 <p>bar|baz
22959 +bar
22960 -bar
22961 </p>
22962 </td></tr>
22963 <tr>
22964 <td>x
22965 <div>a|b</div>
22966 </td></tr></table>
22967
22968 !! end
22969
22970 !! test
22971 Tables: 4d. No escaping needed
22972 !! options
22973 parsoid=html2wt
22974 !! html/parsoid
22975 <table>
22976 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
22977 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
22978 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
22979 </tbody></table>
22980 !! wikitext
22981 {|
22982 |[[Foo]]-bar
22983 ||+1
22984 ||-2
22985 |}
22986 !! html/php
22987 <table>
22988 <tr>
22989 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
22990 </td>
22991 <td>+1
22992 </td>
22993 <td>-2
22994 </td></tr></table>
22995
22996 !! end
22997
22998 !! test
22999 T97430: Don't emit empty nowiki pairs around marker meta tags
23000 !! options
23001 parsoid=html2wt
23002 !! html/parsoid
23003 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23004 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
23005 !! wikitext
23006 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
23007 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
23008 !! end
23009
23010 !! test
23011 Unclosed xmlish element in table line shouldn't eat end delimiters
23012 !! options
23013 parsoid=html2wt
23014 !! html/parsoid
23015 <table>
23016 <tbody><tr><td> &lt;foo</td>
23017 <td> bar></td></tr>
23018 </tbody></table>
23019 !! wikitext
23020 {|
23021 | <foo
23022 | bar>
23023 |}
23024 !! html/php
23025 <table>
23026 <tr>
23027 <td> &lt;foo
23028 </td>
23029 <td> bar&gt;
23030 </td></tr></table>
23031
23032 !! end
23033
23034 #### --------------- Links ----------------
23035 #### 1. Quote marks in link text
23036 #### 2. Wikilinks: Escapes needed
23037 #### 3. Wikilinks: No escapes needed
23038 #### 4. Extlinks: Escapes needed
23039 #### 5. Extlinks: No escapes needed
23040 #### --------------------------------------
23041 !! test
23042 Links 1. WikiLinks: No escapes needed
23043 !! options
23044 parsoid=html2wt
23045 !! html/parsoid
23046 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
23047 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
23048 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
23049 !! wikitext
23050 [[Foo|Foo''boo'']]
23051 [[Foo|[Foobar]]]
23052 [[Foo|x [Foobar] x]]
23053 !! html/php
23054 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
23055 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
23056 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
23057 </p>
23058 !! end
23059
23060 !! test
23061 Links 2. WikiLinks: Escapes needed
23062 !! options
23063 parsoid=html2wt
23064 !! html/parsoid
23065 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
23066 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
23067 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
23068 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
23069 <a href="Foo" rel="mw:WikiLink">|Bar</a>
23070 <a href="Foo" rel="mw:WikiLink">]]bar</a>
23071 <a href="Foo" rel="mw:WikiLink">[[bar</a>
23072 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
23073 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
23074 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
23075 !! wikitext
23076 [[Foo|<nowiki>Foobar]</nowiki>]]
23077 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
23078 [[Foo|<nowiki>[[Bar]]</nowiki>]]
23079 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
23080 [[Foo|<nowiki>|Bar</nowiki>]]
23081 [[Foo|<nowiki>]]bar</nowiki>]]
23082 [[Foo|<nowiki>[[bar</nowiki>]]
23083 [[Foo|<nowiki>x [[ y</nowiki>]]
23084 [[Foo|<nowiki>x ]] y</nowiki>]]
23085 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
23086 !! html/php
23087 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
23088 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
23089 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
23090 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
23091 <a href="/wiki/Foo" title="Foo">|Bar</a>
23092 <a href="/wiki/Foo" title="Foo">]]bar</a>
23093 <a href="/wiki/Foo" title="Foo">[[bar</a>
23094 <a href="/wiki/Foo" title="Foo">x [[ y</a>
23095 <a href="/wiki/Foo" title="Foo">x ]] y</a>
23096 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
23097 </p>
23098 !! end
23099
23100 !! test
23101 Links 3. WikiLinks: No escapes needed
23102 !! options
23103 parsoid=html2wt
23104 !! html/parsoid
23105 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
23106 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
23107 !! wikitext
23108 [[Foo|[Foobar]]
23109 [[Foo|foo|bar]]
23110 !! html/php
23111 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
23112 <a href="/wiki/Foo" title="Foo">foo|bar</a>
23113 </p>
23114 !! end
23115
23116 !! test
23117 Links 4. ExtLinks: Escapes needed
23118 !! options
23119 parsoid=html2wt
23120 !! html/parsoid
23121 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
23122 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
23123 <p>[http://google.com]</p>
23124 <p>[http://google.com google]</p>
23125 !! wikitext
23126 [http://google.com <nowiki>[google]</nowiki>]
23127 [http://google.com <nowiki>google]</nowiki>]
23128
23129 <nowiki>[http://google.com]</nowiki>
23130
23131 <nowiki>[http://google.com google]</nowiki>
23132
23133 !! html/php
23134 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
23135 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
23136 </p><p>[http://google.com]
23137 </p><p>[http://google.com google]
23138 </p>
23139 !! end
23140
23141 !! test
23142 Links 5. ExtLinks: No escapes needed
23143 !! options
23144 parsoid=html2wt
23145 !! html/parsoid
23146 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
23147 !! wikitext
23148 [http://google.com [google]
23149 !! html/php
23150 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
23151 </p>
23152 !! end
23153
23154 !! test
23155 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
23156 !! options
23157 parsoid=html2wt
23158 !! html/parsoid
23159 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
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>&amp;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" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
23170 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
23171 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
23172 </p>
23173 !! wikitext
23174 x<nowiki/>http://example.com<nowiki/>y
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<nowiki/>=x
23185 http://example.com<nowiki/>(x)
23186 http://example.com(x<nowiki/>)
23187 !! end
23188
23189 !! test
23190 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23191 !! options
23192 parsoid=html2wt
23193 !! html/parsoid
23194 <p>x
23195 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
23196 y
23197 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
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 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
23201 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
23202 </p>
23203 !! wikitext
23204 x
23205 http://example.com
23206 y
23207 "http://example.com"
23208 (http://example.com)
23209 (http://example.com) foo
23210 http://example.com,
23211 http://example.com, foo
23212 !! html/php
23213 <p>x
23214 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
23215 y
23216 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
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 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
23220 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
23221 </p>
23222 !! end
23223
23224 !! test
23225 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23226 !! options
23227 parsoid=html2wt
23228 !! html/parsoid
23229 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
23230 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
23231 !! wikitext
23232 http://example.com.,;:!?\
23233 -http://example.com:
23234 !! html/php
23235 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
23236 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
23237 </p>
23238 !! end
23239
23240 !! test
23241 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
23242 !! options
23243 parsoid=html2wt
23244 !! html/parsoid
23245 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
23246 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
23247 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
23248 !! wikitext
23249 RFC 123<nowiki/>4
23250 RFC 123<nowiki/>y
23251 X<nowiki/>RFC 123<nowiki/>y
23252 !! end
23253
23254 !! test
23255 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
23256 !! options
23257 parsoid=html2wt
23258 !! html/parsoid
23259 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
23260 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
23261 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
23262 </p>
23263 !! wikitext
23264 RFC 123?foo
23265 RFC 123&foo
23266 -RFC 123-
23267 !! html/php
23268 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
23269 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
23270 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
23271 </p>
23272 !! end
23273
23274 !! test
23275 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
23276 !! options
23277 parsoid=html2wt
23278 !! html/parsoid
23279 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
23280 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23281 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23282 !! wikitext
23283 PMID 123<nowiki/>4
23284 PMID 123<nowiki/>y
23285 X<nowiki/>PMID 123<nowiki/>y
23286 !! end
23287
23288 !! test
23289 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
23290 !! options
23291 parsoid=html2wt
23292 !! html/parsoid
23293 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
23294 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
23295 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
23296 </p>
23297 !! wikitext
23298 PMID 123?foo
23299 PMID 123&foo
23300 -PMID 123-
23301 !! html/php
23302 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
23303 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
23304 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
23305 </p>
23306 !! end
23307
23308 !! test
23309 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
23310 !! options
23311 parsoid=html2wt
23312 !! html/parsoid
23313 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
23314 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
23315 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
23316 </p>
23317 !! wikitext
23318 ISBN 1234567890<nowiki/>1
23319 ISBN 1234567890<nowiki/>x
23320 a<nowiki/>ISBN 1234567890<nowiki/>b
23321 !! end
23322
23323 !! test
23324 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (bug 64300)
23325 !! options
23326 parsoid=html2wt
23327 !! html/parsoid
23328 <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
23329 !! wikitext
23330 -ISBN 1234567890's
23331 !! html/php
23332 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
23333 </p>
23334 !! end
23335
23336 !! test
23337 Links 14. Protect link-like plain text. (Parsoid bug T78425)
23338 !! options
23339 parsoid=html2wt
23340 !! html/*
23341 <p>this is not a link: http://example.com
23342 </p>
23343 !! wikitext
23344 this is not a link: <nowiki>http://example.com</nowiki>
23345 !! end
23346
23347 !! test
23348 Links 15. Link trails can't become link prefixes.
23349 !! options
23350 language=is
23351 parsoid=html2wt
23352 !! html/parsoid
23353 <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>
23354 !! wikitext
23355 [[Söfnuður]]-[[00]]
23356 !! html/php
23357 <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>
23358 </p>
23359 !! end
23360
23361 #### --------------- Quotes ---------------
23362 #### 1. Quotes inside <b> and <i>
23363 #### 2. Link fragments separated by <i> and <b> tags
23364 #### 3. Link fragments inside <i> and <b>
23365 #### 4. No escaping needed
23366 #### --------------------------------------
23367 !! test
23368 1a. Quotes inside <b> and <i>
23369 !! options
23370 parsoid=html2wt
23371 !! html/*
23372 <p><i>'foo'</i>
23373 <i>''foo''</i>
23374 <i>'''foo'''</i>
23375 <i>foo</i>'s
23376 <b>'foo'</b>
23377 <b>''foo''</b>
23378 <b>'''foo'''</b>
23379 <b>foo'<i>bar'</i>baz</b>
23380 <b>foo</b>'s
23381 '<i>foo</i>
23382 <i>foo</i>'
23383 <i>foo'</i>'
23384 '<i>foo</i>'
23385 '<b>foo</b>
23386 <b>foo</b>'
23387 '<b>foo</b>'
23388 <i>fools'<span> errand</span></i>
23389 <i><span>fool</span>'s errand</i>
23390 '<i>foo</i> bar '<i>baz</i>
23391 a|!*#-:;+-~[]{}b'<i>x</i>
23392 </p>
23393 !! wikitext
23394 ''<nowiki/>'foo'''
23395 ''<nowiki>''foo''</nowiki>''
23396 ''<nowiki>'''foo'''</nowiki>''
23397 ''foo''<nowiki/>'s
23398 '''<nowiki/>'foo''''
23399 '''<nowiki>''foo''</nowiki>'''
23400 '''<nowiki>'''foo'''</nowiki>'''
23401 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
23402 '''foo'''<nowiki/>'s
23403 '''foo''
23404 ''foo''<nowiki/>'
23405 ''foo'''<nowiki/>'
23406 '''foo''<nowiki/>'
23407 ''''foo'''
23408 '''foo'''<nowiki/>'
23409 ''''foo'''<nowiki/>'
23410 ''fools'<span> errand</span>''
23411 ''<span>fool</span>'s errand''
23412 '<nowiki/>''foo'' bar '''baz''
23413 a|!*#-:;+-~[]{}b'''x''
23414 !! end
23415
23416 !! test
23417 1b. Quotes inside <b> and <i> with other tags on same line
23418 !! options
23419 parsoid=html2wt
23420 !! html/parsoid
23421 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23422 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23423 <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>
23424 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
23425 '<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>
23426 '<i>foo</i> <div title="name">test</div>
23427 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
23428 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
23429 <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>
23430 </ol>
23431 !! wikitext
23432 '''a'' foo ''[[bar]]''
23433 ''a''' foo ''[[bar]]''
23434 ''a''' foo '''{{echo|[[bar]]}}'''
23435 [[foo]] x'''[[bar]]''
23436 '''foo'' <ref>test</ref>
23437 '''foo'' <div title="name">test</div>
23438 '''foo'' and <br> bar
23439 <references />
23440 !! end
23441
23442 !! test
23443 2. Link fragments separated by <i> and <b> tags
23444 !! options
23445 parsoid=html2wt
23446 !! html/parsoid
23447 <p>[[<i>foo</i>hello]]</p>
23448 <p>[[<b>foo</b>hello]]</p>
23449 !! wikitext
23450 [[''foo''<nowiki>hello]]</nowiki>
23451
23452 [['''foo'''<nowiki>hello]]</nowiki>
23453 !! end
23454
23455 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
23456 # this is one of the shortcomings of this format
23457 !! test
23458 3. Link fragments inside <i> and <b>
23459 !! options
23460 parsoid=html2wt
23461 !! html/parsoid
23462 <p><i>[[foo</i>]]</p>
23463 <p><b>[[foo</b>]]</p>
23464 !! wikitext
23465 ''[[foo''<nowiki>]]</nowiki>
23466
23467 '''[[foo'''<nowiki>]]</nowiki>
23468 !! end
23469
23470 !! test
23471 4. No escaping needed
23472 !! options
23473 options=html2wt
23474 !! html/parsoid
23475 <p>'<span><i>bar</i></span>'
23476 '<span><b>bar</b></span>'
23477 'a:b'foo
23478 </p>
23479 !! wikitext
23480 '<span>''bar''</span>'
23481 '<span>'''bar'''</span>'
23482 'a:b'foo
23483 !! end
23484
23485 #### ----------- Paragraphs ---------------
23486 #### 1. No unnecessary escapes
23487 #### --------------------------------------
23488
23489 !! test
23490 1. No unnecessary escapes
23491 !! options
23492 parsoid=html2wt
23493 !! html/parsoid
23494 <p>bar <span>[[foo]]</span>
23495 </p><p>=bar <span>[[foo]]</span>
23496 </p><p>[[bar <span>[[foo]]</span>
23497 </p><p>]]bar <span>[[foo]]</span>
23498 </p><p>=bar <span>foo]]</span>=
23499 </p>
23500 !! wikitext
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><nowiki>[[foo]]</nowiki></span>
23508
23509 =bar <span>foo]]</span><nowiki>=</nowiki>
23510 !!end
23511
23512 #### ----------------------- PRE --------------------------
23513 #### 1. Leading whitespace in SOL context should be escaped
23514 #### ------------------------------------------------------
23515 !! test
23516 1. Leading whitespace in SOL context should be escaped
23517 !! options
23518 parsoid=html2wt
23519 !! html/parsoid
23520 <p> a</p>
23521
23522 <p> a</p>
23523
23524 <p> a(tab)</p>
23525
23526 <p> a
23527 <!--cmt-->
23528 a</p>
23529
23530 <p>a
23531 b</p>
23532
23533 <p>a
23534 b</p>
23535
23536 <p>a
23537 b</p>
23538 !! wikitext
23539 <nowiki> </nowiki>a
23540
23541 <nowiki> </nowiki> a
23542
23543 a(tab)
23544
23545 <nowiki> </nowiki> a
23546 <!--cmt-->
23547 <nowiki> </nowiki>a
23548
23549 a
23550 <nowiki> </nowiki>b
23551
23552 a
23553 b
23554
23555 a
23556 b
23557 !! html/php
23558 <p> a
23559 </p><p> a
23560 </p><p> a(tab)
23561 </p><p> a
23562 a
23563 </p><p>a
23564 b
23565 </p><p>a
23566 b
23567 </p><p>a
23568 b
23569 </p>
23570 !! end
23571
23572 !! test
23573 2. Leading whitespace in non-indent-pre contexts should not be escaped
23574 !! options
23575 parsoid=htm2wt
23576 !! html/parsoid
23577 <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>
23578 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23579 <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>
23580 b</span></li>
23581 </ol>
23582 !! wikitext
23583 foo <ref>''a''
23584 b</ref>
23585 <references />
23586 !! end
23587
23588 !! test
23589 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
23590 !! options
23591 parsoid=html2wt
23592 !! html/parsoid
23593 <blockquote>
23594 <p>
23595 a
23596 <span>b</span>
23597 c</p>
23598 </blockquote>
23599 !! wikitext
23600 <blockquote>
23601 a
23602 <span>b</span>
23603 c
23604 </blockquote>
23605 !! end
23606
23607 !! test
23608 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
23609 !! options
23610 options=html2wt
23611 !! html/parsoid
23612 <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>
23613 !! wikitext
23614 [[File:Foobar.jpg|thumb|caption]]
23615 !! end
23616
23617 !! test
23618 5. Nowiki escaping should account for indent-pres
23619 !! options
23620 parsoid=html2wt
23621 !! html/parsoid
23622 <pre>==foo==</pre>
23623 !! wikitext
23624 ==foo==
23625 !! end
23626
23627 !!test
23628 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
23629 !! options
23630 parsoid=html2wt
23631 !! html/parsoid
23632 <pre>
23633 * foo
23634 * bar
23635 </pre>
23636 !! wikitext
23637 * foo
23638 * bar
23639 !! end
23640
23641 #### --------------- Behavior Switches --------------------
23642
23643 !! test
23644 1. Valid behavior switches should be escaped
23645 !! options
23646 parsoid=html2wt
23647 !! html/parsoid
23648 __TOC__
23649 <i>__TOC__</i>
23650 !! wikitext
23651 <nowiki>__TOC__</nowiki>
23652 ''<nowiki>__TOC__</nowiki>''
23653 !! end
23654
23655 !! test
23656 2. Invalid behavior switches should not be escaped
23657 !! options
23658 parsoid=html2wt
23659 !! html/parsoid
23660 __TOO__
23661 __|__
23662 !! wikitext
23663 __TOO__
23664 __|__
23665 !! end
23666
23667 # We use indent-pre as an indirect way to test for sol-transparent behavior.
23668 !! test
23669 Behavior switches should be SOL-transparent
23670 !! options
23671 parsoid=html2wt
23672 !! html/parsoid
23673 <meta property="mw:PageProp/toc" />
23674
23675 <!-- this one's bogus -->
23676 <pre>__TOO__</pre>
23677
23678 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
23679
23680 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
23681 !! wikitext
23682 __TOC__
23683
23684 <!-- this one's bogus -->
23685 __TOO__
23686
23687 __TOC__ foo
23688
23689 __TOC__
23690 bar
23691 !! end
23692
23693 #### --------------- HTML tags ---------------
23694 #### 1. a tags
23695 #### 2. other tags
23696 #### 3. multi-line html tag
23697 #### 4. extension tags
23698 #### -----------------------------------------
23699 !! test
23700 1. a tags
23701 !! options
23702 parsoid=html2wt
23703 !! html/parsoid
23704 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
23705 !! wikitext
23706 <a href="http://google.com">google</a>
23707 !! end
23708
23709 !! test
23710 2. other tags
23711 !! options
23712 parsoid=html2wt
23713 !! html/parsoid
23714 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
23715 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
23716 <li> &lt;td&gt;</li></ul>
23717
23718 !! wikitext
23719 * <nowiki><div>foo</div></nowiki>
23720 * <nowiki><div style="color:red">foo</div></nowiki>
23721 * <nowiki><td></nowiki>
23722 !! end
23723
23724 !! test
23725 3. multi-line html tag
23726 !! options
23727 parsoid=html2wt
23728 !! html/parsoid
23729 <p>&lt;div
23730 &gt;foo&lt;/div
23731 &gt;
23732 </p>
23733 !! wikitext
23734 <nowiki><div
23735 >foo</div
23736 ></nowiki>
23737 !! end
23738
23739 !! test
23740 4. extension tags
23741 !! options
23742 parsoid=html2wt
23743 !! html/parsoid
23744 <p>&lt;ref&gt;foo&lt;/ref&gt;
23745 </p><p>&lt;ref&gt;bar
23746 </p><p>baz&lt;/ref&gt;
23747 </p>
23748 !! wikitext
23749 <nowiki><ref>foo</ref></nowiki>
23750
23751 <nowiki><ref>bar</nowiki>
23752
23753 baz<nowiki></ref></nowiki>
23754 !! end
23755
23756 #### --------------- Others ---------------
23757 !! test
23758 Escaping nowikis
23759 !! options
23760 parsoid=html2wt
23761 !! html/parsoid
23762 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
23763 </p>
23764 !! wikitext
23765 &lt;nowiki&gt;foo&lt;/nowiki&gt;
23766 !! end
23767
23768 ## The quote-char in the input is necessary for triggering the bug
23769 !! test
23770 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
23771 !! options
23772 parsoid=html2wt
23773 !! html/parsoid
23774 <p>foo's bar :</p>
23775 !! wikitext
23776 foo's bar :
23777 !! end
23778
23779 #----------- End of wikitext escaping tests --------------
23780
23781 !! test
23782
23783 Tag-like HTML structures are passed through as text
23784 !! wikitext
23785 <x y>
23786
23787 <x.y>
23788
23789 <x-y>
23790
23791 1>2
23792
23793 x<y
23794
23795 a>b
23796
23797 1<d e>f
23798 !! html
23799 <p>&lt;x y&gt;
23800 </p><p>&lt;x.y&gt;
23801 </p><p>&lt;x-y&gt;
23802 </p><p>1&gt;2
23803 </p><p>x&lt;y
23804 </p><p>a&gt;b
23805 </p><p>1&lt;d e&gt;f
23806 </p>
23807 !! end
23808
23809 !! test
23810 HTML tag with necessary entities in attributes
23811 !! wikitext
23812 <span title="&amp;amp;">foo</span>
23813 !! html
23814 <p><span title="&amp;amp;">foo</span>
23815 </p>
23816 !! end
23817
23818 !! test
23819 HTML tag with 'unnecessary' entity encoding in attributes
23820 !! wikitext
23821 <span title="&amp;">foo</span>
23822 !! html
23823 <p><span title="&amp;">foo</span>
23824 </p>
23825 !! end
23826
23827 !! test
23828 HTML tag with broken attribute value quoting
23829 !! wikitext
23830 <span title="Hello world>Foo</span>
23831 !! html/php
23832 <p><span title="Hello world">Foo</span>
23833 </p>
23834 !! html/parsoid
23835 <p><span title="Hello world">Foo</span>
23836 </p>
23837 !! end
23838
23839 !! test
23840 Self-closed tag with broken attribute value quoting
23841 !! options
23842 parsoid=wt2html,html2html
23843 !! wikitext
23844 <div title="Hello world />Foo
23845 !! html/php+tidy
23846 <div title="Hello world"></div>
23847 <p>Foo</p>
23848 !! html/parsoid
23849 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
23850 !! end
23851
23852 !! test
23853 Table with broken attribute value quoting
23854 !! wikitext
23855 {|
23856 | title="Hello world|Foo
23857 |}
23858 !! html/php
23859 <table>
23860 <tr>
23861 <td title="Hello world">Foo
23862 </td></tr></table>
23863
23864 !! html/parsoid
23865 <table>
23866 <tr>
23867 <td title="Hello world">Foo
23868 </td></tr></table>
23869
23870 !! end
23871
23872 !! test
23873 Table with broken attribute value quoting on consecutive lines
23874 !! wikitext
23875 {|
23876 | title="Hello world|Foo
23877 | style="color:red|Bar
23878 |}
23879 !! html/php
23880 <table>
23881 <tr>
23882 <td title="Hello world">Foo
23883 </td>
23884 <td style="color:red">Bar
23885 </td></tr></table>
23886
23887 !! html/parsoid
23888 <table><tbody>
23889 <tr>
23890 <td title="Hello world">Foo
23891 </td><td style="color: red">Bar
23892 </td></tr></tbody></table>
23893
23894 !! end
23895
23896 !! test
23897 2. Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23898 !! options
23899 parsoid
23900 !! wikitext
23901 {{}}
23902 !! html
23903 {{}}
23904 !! end
23905
23906 !! test
23907 1. Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23908 !! options
23909 parsoid
23910 !! wikitext
23911 }}{{
23912 !! html
23913 }}{{
23914 !! end
23915
23916 !!test
23917 Accept empty td cell attribute
23918 !! wikitext
23919 {|
23920 | align="center" | foo || |
23921 |}
23922 !! html
23923 <table>
23924 <tr>
23925 <td align="center"> foo </td>
23926 <td>
23927 </td></tr></table>
23928
23929 !!end
23930
23931 !!test
23932 Non-empty attributes in th-cells
23933 !! wikitext
23934 {|
23935 ! Foo !! style="color: red" | Bar
23936 |}
23937 !! html
23938 <table>
23939 <tr>
23940 <th> Foo </th>
23941 <th style="color: red"> Bar
23942 </th></tr></table>
23943
23944 !!end
23945
23946 !!test
23947 Accept empty attributes in th-cells
23948 !! wikitext
23949 {|
23950 !| foo !!| bar
23951 |}
23952 !! html
23953 <table>
23954 <tr>
23955 <th> foo </th>
23956 <th> bar
23957 </th></tr></table>
23958
23959 !!end
23960
23961 !!test
23962 Empty table rows go away
23963 !! wikitext
23964 {|
23965 | Hello
23966 | there
23967 |- class="foo"
23968 |-
23969 |}
23970 !! html
23971 <table>
23972 <tr>
23973 <td> Hello
23974 </td>
23975 <td> there
23976 </td></tr>
23977
23978 </table>
23979
23980 !! end
23981
23982 ###
23983 ### Parsoid-centric tests for testing RTing of inter-element separators
23984 ### Edge cases not tested by existing parser tests and specific to
23985 ### Parsoid-specific serialization strategies.
23986 ###
23987
23988 !!test
23989 RT-ed inter-element separators should be valid separators
23990 !! wikitext
23991 {|
23992 |- [[foo]]
23993 |}
23994 !! html/php
23995 <table>
23996
23997 </table>
23998
23999 !! html/parsoid
24000 <table>
24001 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
24002 </tbody></table>
24003 !!end
24004
24005 # Parsoid-only since PHP parser relies on Tidy for correct output
24006 !!test
24007 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
24008 !!options
24009 parsoid
24010 !! wikitext
24011 {|
24012 |<small>foo
24013 bar
24014 |}
24015
24016 {|
24017 |<small>foo<small>
24018 |}
24019 !! html
24020 <table>
24021 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
24022 <p>bar</p></small></td></tr>
24023 </tbody></table>
24024
24025 <table>
24026 <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>
24027 </tbody></table>
24028 !!end
24029
24030 # Note that the "style" attribute is really a template parameter here.
24031 # The = would have to be {{=}} if you wanted the literal.
24032 !!test
24033 Empty TD followed by TD with tpl-generated attribute
24034 !! wikitext
24035 {|
24036 |-
24037 |
24038 |{{echo|style='color:red'}}|foo
24039 |}
24040 !! html
24041 <table>
24042
24043 <tr>
24044 <td>
24045 </td>
24046 <td>foo
24047 </td></tr></table>
24048
24049 !!end
24050
24051 !!test
24052 Indented table with an empty td
24053 !! wikitext
24054 {|
24055 |-
24056 |
24057 |foo
24058 |}
24059 !! html
24060 <table>
24061
24062 <tr>
24063 <td>
24064 </td>
24065 <td>foo
24066 </td></tr></table>
24067
24068 !!end
24069
24070 ## We have some newline diffs RT-ing this edge case
24071 ## and it is not important enough -- we seem to be emitting
24072 ## at most 2 newlines after a </tr> and this is unrelated to
24073 ## the issue from T85627 that this is testing.
24074 !!test
24075 Indented table with blank lines in between (T85627)
24076 !! options
24077 parsoid=wt2html
24078 !! wikitext
24079 {|
24080 |foo
24081
24082
24083 |}
24084 !! html
24085 <table>
24086
24087 <tr>
24088 <td>foo
24089 </td></tr></table>
24090
24091 !!end
24092
24093 !!test
24094 Indented block & table
24095 !! wikitext
24096 <div>foo</div>
24097 {|
24098 |foo
24099 |}
24100 !! html/php
24101 <div>foo</div>
24102 <table>
24103 <tr>
24104 <td>foo
24105 </td></tr></table>
24106
24107 !! html/parsoid
24108 <div data-parsoid='{"stx":"html"}'>foo</div>
24109 <table><tbody>
24110 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
24111 </tbody></table>
24112 !!end
24113
24114 !! test
24115 Indent and comment before table row
24116 !! wikitext
24117 {|
24118 <!--hi-->|-
24119 | there
24120 |}
24121 !! html/php
24122 <table>
24123
24124 <tr>
24125 <td> there
24126 </td></tr></table>
24127
24128 !! html/parsoid
24129 <table>
24130 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
24131 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
24132 </tbody></table>
24133 !! end
24134
24135 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
24136 !!test
24137 Empty TR followed by a template-generated TR
24138 !!options
24139 parsoid
24140 !! wikitext
24141 {|
24142 |-
24143 {{echo|<tr><td>foo</td></tr>}}
24144 |}
24145 !! html
24146 <table>
24147 <tbody>
24148 <tr></tr>
24149 <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}}]}'>
24150 <td>foo</td></tr>
24151 </tbody></table>
24152 !!end
24153
24154 ## PHP and parsoid output differ for this, and since this is primarily
24155 ## for testing Parsoid's serializer, marking this Parsoid only
24156 !!test
24157 Empty TR followed by mixed-ws-comment line should RT correctly
24158 !!options
24159 parsoid
24160 !! wikitext
24161 {|
24162 |-
24163 <!--c-->
24164 |-
24165 <!--c--> <!--d-->
24166 |}
24167 !! html
24168 <table>
24169 <tbody>
24170 <tr></tr>
24171 <!--c-->
24172 <tr>
24173 <!--c--> </tr><!--d-->
24174 </tbody></table>
24175
24176 !!end
24177
24178 !!test
24179 Multi-line image caption generated by templates with/without trailing newlines
24180 !! wikitext
24181 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
24182 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
24183 !! html/parsoid
24184 <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>
24185 <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>
24186 !!end
24187
24188 !! test
24189 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
24190 !! options
24191 parsoid=html2wt
24192 !! html/parsoid
24193 <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>
24194
24195 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
24196 !! wikitext
24197 <includeonly>foo</includeonly>
24198 new para
24199
24200 [[Category:Foo]]
24201
24202 = new heading =
24203 !! end
24204
24205 ## PHP emits broken html for this, and since this is primarily
24206 ## a Parsoid serializer test, marking this Parsoid only
24207 !!test
24208 Improperly nested inline or quotes tags with whitespace in between
24209 !! wikitext
24210 <span> <s>x</span> </s>
24211 ''' ''x''' ''
24212 !! html/parsoid
24213 <p><span> <s>x</s></span><s> </s>
24214 <b> <i>x</i></b><i> </i>
24215 </p>
24216 !!end
24217
24218 !!test
24219 Encapsulate protected attributes from wt
24220 !! wikitext
24221 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
24222 !! html/parsoid
24223 <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>
24224 </body>
24225 !!end
24226
24227 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
24228 ## Having nested or stray pre tags results in the attempt to add duplicates,
24229 ## causing an assertion fail. This test tries to prevent that situation.
24230 !!test
24231 Ensure ParagraphWrapper can deal with stray closing pre tags
24232 !!options
24233 parsoid=wt2html
24234 !! wikitext
24235 plain text</pre>
24236 !! html/parsoid
24237 plain text
24238 !!end
24239
24240 !!test
24241 1. Ensure fostered text content is wrapped in element nodes
24242 !!options
24243 parsoid=wt2html
24244 !! wikitext
24245 <table>hi</table><table>ho</table>
24246 !! html/parsoid
24247 <p>hi</p>
24248 <table></table>
24249 <p>ho</p>
24250 <table></table>
24251 !!end
24252
24253 !!test
24254 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
24255 !!options
24256 parsoid=wt2html,wt2wt
24257 !! wikitext
24258 <table>
24259 <tr> || ||
24260 <td> a
24261 </table>
24262 !! html/parsoid
24263 <p> || ||
24264 </p><table>
24265 <tbody><tr><td> a</td></tr>
24266 </tbody></table>
24267 !!end
24268
24269 !!test
24270 Encapsulation properly handles null DSR information from foster box
24271 !!options
24272 parsoid=wt2html,wt2wt
24273 !! wikitext
24274 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
24275 !! html/parsoid
24276 <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>
24277 !!end
24278
24279 !!test
24280 1. Encapsulate foster-parented transclusion content
24281 !!options
24282 parsoid=wt2wt,wt2html
24283 !! wikitext
24284 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
24285 !! html/parsoid
24286 <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>
24287 <tbody>
24288 <tr>
24289 <td>bar</td>
24290 </tr>
24291 </tbody>
24292 </table>
24293 !!end
24294
24295 !!test
24296 2. Encapsulate foster-parented transclusion content
24297 !!options
24298 parsoid=wt2wt,wt2html
24299 !! wikitext
24300 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
24301 !! html/parsoid
24302 <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>
24303 <table>
24304 <tbody>
24305 <tr>
24306 <td>bar</td>
24307 </tr>
24308 </tbody>
24309 </table>
24310 !!end
24311
24312 !!test
24313 3. Encapsulate foster-parented transclusion content
24314 !!options
24315 parsoid=wt2wt,wt2html
24316 !! wikitext
24317 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24318 !! html/parsoid
24319 <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;]}">
24320 <p>foo</p>
24321 </div>
24322 <table>
24323 <tbody>
24324 <tr>
24325 <td>bar</td>
24326 </tr>
24327 </tbody>
24328 </table>
24329 !!end
24330
24331 !!test
24332 4. Encapsulate foster-parented transclusion content
24333 !!options
24334 parsoid=wt2wt,wt2html
24335 !! wikitext
24336 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24337 !! html/parsoid
24338 <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;]}">
24339 <p>foo</p>
24340 </div>
24341 <table>
24342 <tbody>
24343 <tr>
24344 <td>bar</td>
24345 </tr>
24346 </tbody>
24347 </table>
24348 !!end
24349
24350 !!test
24351 5. Encapsulate foster-parented transclusion content
24352 !!options
24353 parsoid=wt2wt,wt2html
24354 !! wikitext
24355 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
24356 !! html/parsoid
24357 <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>
24358 <table>
24359 <tbody>
24360 <tr>
24361 <td>
24362 <div>
24363 <p>foo</p>
24364 </div>
24365 </td>
24366 </tr>
24367 </tbody>
24368 </table>
24369 !!end
24370
24371 !!test
24372 6. Encapsulate foster-parented transclusion content
24373 !!options
24374 parsoid=wt2wt,wt2html
24375 !! wikitext
24376 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
24377 !! html/parsoid
24378 <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>
24379 <table>
24380 <tbody>
24381 <tr>
24382 <td>
24383 <div>
24384 <p>foo</p>
24385 </div>
24386 </td>
24387 </tr>
24388 </tbody>
24389 </table>
24390 <p>ok</p>
24391 !!end
24392
24393 !!test
24394 7. Encapsulate foster-parented transclusion content
24395 !!options
24396 parsoid=wt2wt,wt2html
24397 !! wikitext
24398 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
24399 !! html/parsoid
24400 <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>
24401 <table>
24402 <tbody>
24403 <tr>
24404 <td>bar</td>
24405 </tr>
24406 </tbody>
24407 </table>
24408 !!end
24409
24410 # Note that the wt is broken on purpose: the = should be {{=}} if you
24411 # don't want it to be a template parameter key.
24412 !!test
24413 8. Encapsulate foster-parented transclusion content
24414 !!options
24415 parsoid=wt2wt,wt2html
24416 !! wikitext
24417 {{echo|a
24418 }}{|{{echo|style='color:red'}}
24419 |-
24420 |b
24421 |}
24422 !! html/parsoid
24423 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
24424 <span> </span>
24425 <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>
24426 <table>
24427 <tbody>
24428 <tr>
24429 <td>b</td>
24430 </tr>
24431 </tbody>
24432 </table>
24433 !!end
24434
24435 !!test
24436 9. Encapsulate foster-parented transclusion content
24437 !!options
24438 parsoid=wt2wt,wt2html
24439 !! wikitext
24440 <table>{{echo|hi</table>hello}}
24441 !! html/parsoid
24442 <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>
24443 !!end
24444
24445 !!test
24446 Table in fosterable position
24447 !!options
24448 parsoid=wt2html,wt2wt
24449 !! wikitext
24450 {{OpenTable}}
24451 <div>
24452 {|
24453 |}
24454 </div>
24455 |}
24456 !! html/parsoid
24457 <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">
24458 </span>
24459 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
24460
24461 <table>
24462 </table>
24463 !!end
24464
24465 # Parsoid only for bug 64747
24466 !! test
24467 Properly encapsulate empty-content transclusions in fosterable positions
24468 !! wikitext
24469 <table>
24470 {{#if:|
24471 <td>foo</td>
24472 }}
24473 </table>
24474 !! html/parsoid
24475 <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":["","","",""]}]]}'>
24476
24477 </table>
24478 !! end
24479
24480 !! test
24481 Always encapsulate foster box when template range is expanded to table
24482 !! options
24483 parsoid=wt2wt
24484 !! wikitext
24485 {|
24486 hello
24487 {{OpenTable}}
24488 |}
24489 !! html/parsoid
24490
24491 !! end
24492
24493 !!test
24494 Support <object> element with .data attribute
24495 !!options
24496 parsoid=html2wt
24497 !! html/parsoid
24498 <object data="test.swf"></object>
24499 !! wikitext
24500 <object data="test.swf"></object>
24501 !!end
24502
24503 !! test
24504 Don't block XML namespace declaration
24505 !! wikitext
24506 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24507 !! html/php
24508 <p><span>MediaWiki</span>
24509 </p>
24510 !! html/parsoid
24511 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
24512 !! end
24513
24514 # -----------------------------------------------------------------
24515 # The following section of tests are primarily to spec requirements
24516 # around serialization of new/edited content.
24517 #
24518 # All these tests are marked Parsoid html2wt and html2html only
24519 # ----------------------------------------------------------------
24520
24521 # 'mi' is a localinterwiki prefix as well as a language
24522 !! test
24523 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
24524 !! options
24525 parsoid=html2wt
24526 !! html/parsoid
24527 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
24528 !! wikitext
24529 [[Foo]]
24530 !! end
24531
24532 # See T93839
24533 !! test
24534 New wikilinks should be serialized properly
24535 !! options
24536 parsoid=html2wt
24537 !! html/parsoid
24538 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
24539 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
24540 !! wikitext
24541 [[Foo]]
24542 [[Foo]]
24543 !! end
24544
24545 !! test
24546 New wiki links (href variations)
24547 !! options
24548 parsoid=html2wt
24549 !! html/parsoid
24550 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24551 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
24552 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
24553 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
24554 !! wikitext
24555 [[Foo_bar]]
24556 [[Foo_bar]]
24557 [[Foo_bar]]
24558 [[Toxine bactérienne]]
24559 !! end
24560
24561 !! test
24562 New wiki links (content string variations)
24563 !! options
24564 parsoid=html2wt
24565 !! html/parsoid
24566 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24567 <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
24568 <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
24569 !! wikitext
24570 [[Foo_bar]]
24571 [[Foo bar]]
24572 [[Foo_bar|./Foo_bar]]
24573 !! end
24574
24575 !! test
24576 New category links (href variations)
24577 !! options
24578 parsoid=html2wt
24579 !! html/parsoid
24580 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
24581 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
24582 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
24583 !! wikitext
24584 [[Category:Toxine bactérienne]]
24585 [[Category:Toxine bactérienne]]
24586 [[Category:Toxine bactérienne]]
24587 !! end
24588
24589 !! test
24590 New sol transparent links don't need indent-pre nowiki protection
24591 !! options
24592 parsoid=html2wt
24593 language=de
24594 !! html/parsoid
24595 <link rel="mw:PageProp/redirect" href="./Main_Page">
24596 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
24597 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
24598 !! wikitext
24599 #WEITERLEITUNG [[Main Page]]
24600 <!-- this is good --> [[Category:Good]]
24601 <!-- this is great --> [[Kategorie:Great]]
24602 !! end
24603
24604 !! test
24605 New interlanguage links (href variations)
24606 !! options
24607 parsoid=html2wt
24608 !! html/parsoid
24609 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
24610 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
24611 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
24612 !! wikitext
24613 [[es:Toxine bactérienne]]
24614 [[es:Toxine_bactérienne]]
24615 [[es:Toxine_bactérienne]]
24616 !! end
24617
24618 !! test
24619 Image: Modifying size of an image (1)
24620 !! options
24621 parsoid={
24622 "modes": ["wt2wt"],
24623 "changes": [
24624 ["img[height]", "attr", "height", "22"],
24625 ["img[width]", "attr", "width", "200"]
24626 ]
24627 }
24628 !! wikitext
24629 [[Image:Foobar.jpg|230x230px]]
24630 !! wikitext/edited
24631 [[Image:Foobar.jpg|200x200px]]
24632 !!end
24633
24634 !! test
24635 Image: Modifying size of an image (2)
24636 !! options
24637 parsoid={
24638 "modes": ["wt2wt"],
24639 "changes": [
24640 ["img[height]", "attr", "height", "100"],
24641 ["img[width]", "attr", "width", "500"]
24642 ]
24643 }
24644 !! wikitext
24645 [[Image:Foobar.jpg|230x230px]]
24646 !! wikitext/edited
24647 [[Image:Foobar.jpg|500x500px]]
24648 !!end
24649
24650 # Change in size is ignored so long as class='mw-default-size'
24651 !! test
24652 Image: Modifying size of an image (3)
24653 !! options
24654 parsoid={
24655 "modes": ["wt2wt"],
24656 "changes": [
24657 ["figure[class]", "removeClass", "mw-default-size"],
24658 ["figure img", "attr", "height", "19"],
24659 ["figure img", "attr", "width", "170"]
24660 ]
24661 }
24662 !! wikitext
24663 [[Image:Foobar.jpg|thumb]]
24664 !! wikitext/edited
24665 [[Image:Foobar.jpg|thumb|170x170px]]
24666 !!end
24667
24668 !! test
24669 Image: Modifying alignment of an image (bug 48665)
24670 !! options
24671 parsoid={
24672 "modes": ["wt2wt"],
24673 "changes": [
24674 ["figure[class]", "removeClass", "mw-halign-right"],
24675 ["figure[class]", "addClass", "mw-halign-left"]
24676 ]
24677 }
24678 !! wikitext
24679 [[Image:Foobar.jpg|thumb|caption|right]]
24680 !! wikitext/edited
24681 [[Image:Foobar.jpg|thumb|caption|left]]
24682 !! end
24683
24684 !! test
24685 Image: Modifying mw-default-size of an frameless image (bug 62805)
24686 !! options
24687 parsoid={
24688 "modes": ["wt2wt"],
24689 "changes": [
24690 ["figure.mw-default-size", "removeClass", "mw-default-size"]
24691 ]
24692 }
24693 !! wikitext
24694 [[Image:Foobar.jpg|frameless|right]]
24695 !! wikitext/edited
24696 [[Image:Foobar.jpg|frameless|right|220x220px]]
24697 !! end
24698
24699 !! test
24700 Image: Modifying valign of an image (bug 49221)
24701 !! options
24702 parsoid={
24703 "modes": ["wt2wt"],
24704 "changes": [
24705 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
24706 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
24707 ]
24708 }
24709 !! wikitext
24710 [[File:Foobar.jpg|20px|middle]]
24711 !! wikitext/edited
24712 [[File:Foobar.jpg|20px|text-top]]
24713 !! end
24714
24715 !! test
24716 Image: Modifying alt attribute of an image (bug 56400)
24717 !! options
24718 parsoid={
24719 "modes": ["wt2wt"],
24720 "changes": [
24721 ["img[alt]", "attr", "alt", "some alternate edited text"]
24722 ]
24723 }
24724 !! wikitext
24725 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
24726 !! wikitext/edited
24727 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
24728 !!end
24729
24730 !! test
24731 Image: Modifying caption of an image
24732 !! options
24733 parsoid={
24734 "modes": ["wt2wt"],
24735 "changes": [
24736 ["figcaption", "text", "new caption"]
24737 ]
24738 }
24739 !! wikitext
24740 [[Image:Foobar.jpg|thumb|original caption]]
24741 !! wikitext/edited
24742 [[Image:Foobar.jpg|thumb|new caption]]
24743 !!end
24744
24745 !! test
24746 Image: empty alt attribute (bug 48924)
24747 !! options
24748 parsoid
24749 !! wikitext
24750 [[File:Foobar.jpg|thumb|alt=|bar]]
24751 !! html
24752 <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>
24753 !! end
24754
24755 !! test
24756 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
24757 !! options
24758 parsoid=html2wt
24759 language=ar
24760 disabled
24761 !! html/parsoid
24762 <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>
24763 !! wikitext
24764 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
24765 !! end
24766
24767 !! test
24768 Image: Block level image should have \n before and after
24769 !! wikitext
24770 123
24771 [[File:Foobar.jpg|right|thumb|150x150px]]
24772 456
24773 !! html/parsoid
24774 <p>123</p>
24775 <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>
24776 <p>456</p>
24777 !!end
24778
24779 !! test
24780 Image: New block level image should have \n before and after (existing content)
24781 !! wikitext
24782 123
24783 [[File:Foobar.jpg|right|thumb|150x150px]]
24784 456
24785 !! html/parsoid
24786 <p>123</p>
24787 <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>
24788 <p>456</p>
24789 !!end
24790
24791 !! test
24792 Image: upright option (parsoid)
24793 !! wikitext
24794 [[File:Foobar.jpg|thumb|upright|caption]]
24795 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
24796 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
24797 !! html/parsoid
24798 <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>
24799 <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>
24800 <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>
24801 !!end
24802
24803 !! test
24804 Image: upright option is ignored on inline and frame images (parsoid)
24805 !! wikitext
24806 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
24807 !! html/parsoid
24808 <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>
24809 !!end
24810
24811 !! test
24812 Image: from basic HTML (1)
24813 !! options
24814 parsoid=html2wt
24815 !! html/parsoid
24816 <span typeof="mw:Image">
24817 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24818 </span>
24819 !! wikitext
24820 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24821 !! end
24822
24823 !! test
24824 Image: from basic HTML (2)
24825 !! options
24826 parsoid=html2wt
24827 !! html/parsoid
24828 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24829 !! wikitext
24830 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24831 !! end
24832
24833 !! test
24834 Image: from basic HTML (3)
24835 !! options
24836 parsoid=html2wt
24837 !! html/parsoid
24838 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
24839 !! wikitext
24840 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
24841 !! end
24842
24843 !! test
24844 Image: from basic HTML (4)
24845 !! options
24846 parsoid=html2wt
24847 !! html/parsoid
24848 <img src="./File:Foobar.jpg">
24849 !! wikitext
24850 [[File:Foobar.jpg|link=]]
24851 !! end
24852
24853 !! test
24854 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
24855 !! options
24856 parsoid=html2wt
24857 !! html/parsoid
24858 <ul>
24859 <li><p>foo</p></li>
24860 </ul>
24861 !! wikitext
24862 * foo
24863 !! end
24864
24865 !! test
24866 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
24867 !! options
24868 parsoid=html2wt
24869 !! html/parsoid
24870 <ul> <li>foo</li></ul>
24871 !! wikitext
24872 * foo
24873 !! end
24874
24875 !! test
24876 Don't strip leading whitespace when handling indent-pre suppressing tags
24877 !! options
24878 parsoid=html2wt
24879 !! html/parsoid
24880 <table>
24881 <tr><td> indented row</td></tr>
24882 </table>
24883 <blockquote><p>
24884 <b>This is very bold of you!</b>
24885 </p>
24886 <table><tr><td>
24887 indented cell (no pre-wrapping!)
24888 </td></tr></table>
24889 </blockquote>
24890 <p>foo</p>
24891 <div>bar</div>
24892 !! wikitext
24893 {|
24894 | indented row
24895 |}
24896 <blockquote>
24897 '''This is very bold of you!'''
24898
24899 {|
24900 |
24901 indented cell (no pre-wrapping!)
24902 |}
24903 </blockquote>
24904 foo
24905 <div>bar</div>
24906 !! end
24907
24908 !! test
24909 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
24910 !! options
24911 parsoid=html2wt
24912 !! html/parsoid
24913 <p>foo</p>
24914 <span>bar</span>
24915
24916 <span>foo2
24917 </span>bar2
24918
24919 <div>foo</div>
24920 <span>bar</span>
24921
24922 <div>
24923 <span>foo</span>
24924 </div>
24925 !! wikitext
24926 foo
24927
24928 <span>bar</span>
24929
24930 <span>foo2
24931 <nowiki> </nowiki></span>bar2
24932
24933 <div>foo</div>
24934 <nowiki> </nowiki><span>bar</span>
24935
24936 <div>
24937 <nowiki> </nowiki><span>foo</span>
24938 </div>
24939 !! end
24940
24941 !! test
24942 Lists: Dont insert newlines in a serialized list item.
24943 !! options
24944 parsoid=html2wt
24945 !! html/parsoid
24946 <ul><li>a<br>b</li><li>c</li></ul>
24947 !! wikitext
24948 * a<br>b
24949 * c
24950 !! end
24951
24952 !! test
24953 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
24954 !! options
24955 parsoid={
24956 "modes": ["html2wt"],
24957 "scrubWikitext": false
24958 }
24959 !! html/parsoid
24960 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
24961 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
24962
24963 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
24964 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
24965
24966 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
24967
24968 <h2><meta property="mw:PageProp/toc" /> ok</h2>
24969 !! wikitext
24970 == hello there [[Category:A1]] ==
24971
24972 == [[Category:A2]] hi pal ==
24973
24974 == <!--foo--> [[Category:A3]] how goes it ==
24975
24976 == it goes well [[Category:A4]] <!--bar--> ==
24977
24978 ==howdy [[Category:A5]]==
24979
24980 == __TOC__ ok ==
24981 !! end
24982
24983 !! test
24984 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
24985 !! options
24986 parsoid={
24987 "modes": ["html2wt"],
24988 "scrubWikitext": true
24989 }
24990 !! html/parsoid
24991 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
24992 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
24993
24994 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
24995 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
24996
24997 <h2><meta property="mw:PageProp/toc" /> ok</h2>
24998 !! wikitext
24999 == hello there ==
25000 [[Category:A1]]
25001 [[Category:A2]]
25002
25003 == hi pal ==
25004
25005 <!--foo--> [[Category:A3]]
25006
25007 == how goes it ==
25008
25009 == it goes well ==
25010 [[Category:A4]] <!--bar-->
25011
25012 __TOC__
25013
25014 == ok ==
25015 !! end
25016
25017 !! test
25018 Headings: Don't hoist metas that come from templates
25019 !! options
25020 parsoid={
25021 "modes": ["html2wt"],
25022 "scrubWikitext": true
25023 }
25024 !! html/parsoid
25025 <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>
25026 !! wikitext
25027 == {{echo|foo [[Category:Foo]]}} ==
25028 !! end
25029
25030 !! test
25031 Headings: Category in ref isn't hoisted
25032 !! options
25033 parsoid={
25034 "modes": ["html2wt"],
25035 "scrubWikitext": true
25036 }
25037 !! html/parsoid
25038 <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>
25039
25040 <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>
25041 !! wikitext
25042 == foo <ref>bar
25043 [[Category:Baz]] </ref> ==
25044
25045 <references />
25046 !! end
25047
25048 !! test
25049 Parsoid: Serialize positional parameters with = in them as named parameter
25050 !! options
25051 parsoid=html2wt
25052 !! html/parsoid
25053 <p about="#mwt1" typeof="mw:Transclusion"
25054 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
25055
25056 <p about="#mwt1" typeof="mw:Transclusion"
25057 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
25058
25059 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25060 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25061 <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>
25062 !! wikitext
25063 {{echo|1 = f=oo}}
25064
25065 {{echo|1 = f=oo|2 = bar}}
25066
25067 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25068 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25069 {{echo|<nowiki>f=oo</nowiki>|bar}}
25070 !! end
25071
25072 !! test
25073 Parsoid: Serialize positional parameters with = in extlink as named parameter
25074 !! options
25075 parsoid=html2wt
25076 !! html/parsoid
25077 <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>
25078 !! wikitext
25079 {{echo|1 = http://stuff?is=ok}}
25080 !! end
25081
25082 !! test
25083 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
25084 !! options
25085 parsoid=html2wt
25086 !! html/parsoid
25087 <div>a<p>b</p></div>
25088 <div>a
25089 <p>b</p></div>
25090 <div>
25091 a
25092 <p>b</p></div>
25093 !! wikitext
25094 <div>a
25095 b
25096 </div>
25097 <div>a
25098 b
25099 </div>
25100 <div>
25101 a
25102
25103 b
25104 </div>
25105 !! end
25106
25107 !! test
25108 Substrings resembling wikitext in hrefs should not get nowiki escapes
25109 !! options
25110 parsoid=html2wt
25111 !! html/parsoid
25112 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
25113 !! wikitext
25114 [[Foo''bar''baz]]
25115 !! end
25116
25117 !! test
25118 Enforce single-line context in the serializer
25119 !! options
25120 parsoid=html2wt
25121 !! html/parsoid
25122 <h2>testing
25123 123</h2>
25124
25125 <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">
25126 </span><span about="#mwt1">you</span> </h2>
25127
25128 <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>
25129
25130 <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
25131 there</span></li></ol>
25132
25133 <ul><li>asd
25134 sdf</li></ul>
25135
25136 <ul><li>foo
25137 bar
25138 baz</li>
25139 <li>foo <b>bar</b>
25140 baz</li></ul>
25141
25142 <dl><dt>hi
25143 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
25144 ho</dd></dl>
25145
25146 <dl><dd> <table>
25147 <tbody><tr><td> ha
25148 ha
25149 ha</td></tr>
25150 </tbody></table></dd></dl>
25151 !! wikitext
25152 == testing 123 ==
25153
25154 == hi {{bogus|there
25155 you}} ==
25156
25157 == foo <ref>hello
25158 there</ref> ==
25159
25160 <references />
25161
25162 * asd sdf
25163
25164 * foo bar baz
25165 * foo '''bar''' baz
25166
25167 ; hi ho : hi ho
25168
25169 : {|
25170 | ha
25171 ha
25172 ha
25173 |}
25174 !! end
25175
25176 !! test
25177 Serialize new placeholder space without spans
25178 !! options
25179 parsoid=html2wt
25180 !! html/parsoid
25181 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
25182
25183 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
25184
25185 <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>
25186 !! wikitext
25187 foo : bar
25188
25189 foo : bar
25190
25191 <ref>foo : bar</ref>ok
25192 !! end
25193
25194
25195 #-----------------------
25196 # Tag minimization tests
25197 #-----------------------
25198
25199 !! test
25200 1. I/B quote minimization: wikitext-only tags should be combined
25201 !! options
25202 parsoid=html2wt
25203 !! html/parsoid
25204 <p><i>A</i><i>B</i></p>
25205 <p><b>A</b><b>B</b></p>
25206 <p><i>A</i><b><i>B</i></b></p>
25207 <p><b>A</b><i><b>B</b></i></p>
25208 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
25209 <p><i><b>A</b></i><i><b>B</b></i></p>
25210 <p><i><b>A</b></i><b><i>B</i></b></p>
25211 <p><b><i>A</i></b><i><b>B</b></i></p>
25212 !! wikitext
25213 ''AB''
25214
25215 '''AB'''
25216
25217 ''A'''B'''''
25218
25219 '''A''B'''''
25220
25221 '''A''BC''D'''
25222
25223 '''''AB'''''
25224
25225 '''''AB'''''
25226
25227 '''''AB'''''
25228 !! end
25229
25230 !! test
25231 2. I/B quote minimization: wikitext and html tags should not be combined
25232 !! options
25233 parsoid=html2wt
25234 !! html/parsoid
25235 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
25236 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
25237 !! wikitext
25238 ''A''<i>B</i>
25239
25240 ''A''<nowiki/>'''<i>B</i>'''
25241 !! end
25242
25243 !! test
25244 3. I/B quote minimization: templated content stops minimization
25245 !! options
25246 parsoid=html2wt
25247 !! html/parsoid
25248 <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>
25249 <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>
25250 !! wikitext
25251 ''A''{{echo|''B''}}
25252
25253 ''A''{{echo|'''''B'''''}}
25254 !! end
25255
25256 !! test
25257 4. I/B quote minimization: new content should be mimimized with adjacent old content
25258 !! options
25259 parsoid=html2wt
25260 !! html/parsoid
25261 <p><i>A</i><i>B</i></p>
25262 <p><b>A</b><b>B</b></p>
25263 <p><i>A</i><b><i>B</i></b></p>
25264 !! wikitext
25265 ''AB''
25266
25267 '''AB'''
25268
25269 ''A'''B'''''
25270 !! end
25271
25272 !! test
25273 5a. Merge adjacent quote nodes if they've been edited
25274 !! options
25275 parsoid={
25276 "modes": ["wt2wt", "selser"],
25277 "changes": [
25278 ["p", "contents", "remove", ":contains('b')"]
25279 ]
25280 }
25281 !! wikitext
25282 ''a''b''c''
25283 !! wikitext/edited
25284 ''ac''
25285 !! end
25286
25287 !! test
25288 5b. Merge adjacent quote nodes if they've been edited
25289 !! options
25290 parsoid={
25291 "modes": ["wt2wt", "selser"],
25292 "changes": [
25293 ["#x", "remove"]
25294 ]
25295 }
25296 !! wikitext
25297 ''a''<span id="x">b</span>''c''
25298 !! wikitext/edited
25299 ''ac''
25300 !! end
25301
25302 !! test
25303 1. Merge adjacent link nodes as long as at least one element is new
25304 !! options
25305 parsoid={
25306 "modes": ["html2wt"],
25307 "scrubWikitext": true
25308 }
25309 !! html/parsoid
25310 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25311 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25312 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
25313 !! wikitext
25314 [[Football]]
25315 [[Football]]
25316 [[Football|Foot]][[Football|ball]]
25317 !! end
25318
25319 !! test
25320 2. Merge adjacent link nodes and enable additional normalizations
25321 !! options
25322 parsoid={
25323 "modes": ["html2wt"],
25324 "scrubWikitext": true
25325 }
25326 !! html/parsoid
25327 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
25328 !! wikitext
25329 [[Football|''Football'']]
25330 !! end
25331
25332 !! test
25333 3. Don't merge adjacent link nodes if scrubWikitext is false
25334 !! options
25335 parsoid={
25336 "modes": ["html2wt"],
25337 "scrubWikitext": false
25338 }
25339 !! html/parsoid
25340 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25341 !! wikitext
25342 [[Football|Foot]][[Football|ball]]
25343 !! end
25344
25345 #------------------------------
25346 # End of tag minimization tests
25347 #------------------------------
25348
25349 !!test
25350 Bug 54262: New entities
25351 !! options
25352 parsoid=html2wt
25353 !! html/parsoid
25354 <span typeof="mw:Entity">&nbsp;</span>
25355 !! wikitext
25356 &nbsp;
25357 !! end
25358
25359 ## Note that there is no wikitext output for 'unknownproperty' ##
25360 ## Unknown magic words are silently dropped ##
25361
25362 !! test
25363 Magic words
25364 !! options
25365 parsoid=html2wt
25366 !! html/parsoid
25367 <meta property='mw:PageProp/toc' />
25368 <meta property='mw:PageProp/notoc' />
25369 <meta property='mw:PageProp/forcetoc' />
25370 <meta property='mw:PageProp/index' />
25371 <meta property='mw:PageProp/noindex' />
25372 <meta property='mw:PageProp/nogallery' />
25373 <meta property='mw:PageProp/noeditsection' />
25374 <meta property='mw:PageProp/notitleconvert' />
25375 <meta property='mw:PageProp/nocontentconvert' />
25376 <meta property='mw:PageProp/unknownproperty' />
25377 !! wikitext
25378 __TOC__
25379 __NOTOC__
25380 __FORCETOC__
25381 __INDEX__
25382 __NOINDEX__
25383 __NOGALLERY__
25384 __NOEDITSECTION__
25385 __NOTITLECONVERT__
25386 __NOCONTENTCONVERT__
25387 !! end
25388
25389 !! test
25390 Consecutive <pre>s should not get merged
25391 !! options
25392 parsoid=html2wt,html2html
25393 !! html/parsoid
25394 <pre>a</pre><pre>b</pre>
25395
25396 <pre>c
25397 </pre><pre>
25398 d</pre>
25399
25400 <pre>e
25401
25402 </pre><pre>
25403
25404 f</pre>
25405 !! wikitext
25406 a
25407
25408 b
25409
25410 c
25411
25412 d
25413
25414 e
25415
25416
25417
25418 f
25419 !! end
25420
25421 !! test
25422 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
25423 !! options
25424 parsoid=html2wt
25425 !! html/parsoid
25426 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
25427 !! wikitext
25428 [[Special:BookSources/1234567890|ISBN 1234567895]]
25429 !! end
25430
25431 !! test
25432 Edited RFC links not serializable as RFC links should serialize as extlinks
25433 !! options
25434 parsoid=html2wt
25435 !! html/parsoid
25436 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
25437 !! wikitext
25438 [//tools.ietf.org/html/rfc123 New RFC]
25439 !! end
25440
25441 !! test
25442 Edited PMID links not serializable as PMID links should serialize as extlinks
25443 !! options
25444 parsoid=html2wt
25445 !! html/parsoid
25446 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
25447 !! wikitext
25448 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
25449 !! end
25450
25451 !! test
25452 WTS of autolinks with trailing/surrounding context
25453 !! options
25454 parsoid=html2wt
25455 !! html/parsoid
25456 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
25457 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
25458 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
25459 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
25460 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
25461 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
25462 !! wikitext
25463 http://cscott.net'''foo'''
25464
25465 http://cscott.net<b>foo</b>
25466
25467 '''http://cscott.net'''
25468
25469 '''http://cscott.net '''
25470
25471 '''http://cscott.net<nowiki/>x'''
25472
25473 http://cscott.net<nowiki/>x
25474 !! end
25475
25476 !! test
25477 WTS of autolinks with nowikis (round-trip)
25478 !! wikitext
25479 x<nowiki/>http://cscott.net<nowiki/>x
25480 !! html/parsoid
25481 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
25482 !! end
25483
25484 # this is the "easy" test because it leaves in place all the
25485 # data-parsoid information indicating this is an autolink
25486 !! test
25487 WTS of autolinks with escapes (editing)
25488 !! options
25489 parsoid={
25490 "modes": ["wt2wt"],
25491 "changes": [
25492 [ "meta", "remove" ]
25493 ]
25494 }
25495 !! wikitext
25496 x<nowiki/>http://cscott.net<nowiki/>x
25497 !! wikitext/edited
25498 x<nowiki/>http://cscott.net<nowiki/>x
25499 !! end
25500
25501 !! test
25502 WTS of edited autolink-like text (T103364)
25503 !! options
25504 parsoid={
25505 "modes": ["wt2wt"],
25506 "changes": [
25507 [ "span[typeof]", "removeAttr", "typeof" ]
25508 ]
25509 }
25510 !! wikitext
25511 Not a link: <nowiki>http://example.com</nowiki>.
25512 !! wikitext/edited
25513 Not a link: <span><nowiki>http://example.com</nowiki></span>.
25514 !! end
25515
25516 !! test
25517 WTS of newly-authored autolink-like text (T103364)
25518 !! options
25519 parsoid=html2wt
25520 !! html/parsoid
25521 <p>http://example.com is not a link.</p>
25522 !! wikitext
25523 <nowiki>http://example.com</nowiki> is not a link.
25524 !! end
25525
25526 !! test
25527 WTS of autolink-like text after an autolink (T108563)
25528 !! options
25529 parsoid=html2wt
25530 !! html/parsoid
25531 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
25532 !! wikitext
25533 http://example.com <nowiki>http://example.com</nowiki> is not a link.
25534 !! end
25535
25536 !! test
25537 Magic links inside links (not autolinked)
25538 !! wikitext
25539 [[Foo|http://example.com]]
25540 [[Foo|RFC 1234]]
25541 [[Foo|PMID 1234]]
25542 [[Foo|ISBN 123456789x]]
25543
25544 [http://foo.com http://example.com]
25545 [http://foo.com RFC 1234]
25546 [http://foo.com PMID 1234]
25547 [http://foo.com ISBN 123456789x]
25548 !! html+tidy
25549 <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>
25550 <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>
25551 !! html/parsoid
25552 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
25553 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
25554 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
25555 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
25556
25557 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
25558 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
25559 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
25560 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
25561 !! end
25562
25563 !! test
25564 Magic links inside image captions (autolinked)
25565 !! wikitext
25566 [[File:Foobar.jpg|thumb|http://example.com]]
25567 [[File:Foobar.jpg|thumb|RFC 1234]]
25568 [[File:Foobar.jpg|thumb|PMID 1234]]
25569 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
25570 !! html+tidy
25571 <div class="thumb tright">
25572 <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>
25573 <div class="thumbcaption">
25574 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25575 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
25576 </div>
25577 </div>
25578 <div class="thumb tright">
25579 <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>
25580 <div class="thumbcaption">
25581 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25582 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
25583 </div>
25584 </div>
25585 <div class="thumb tright">
25586 <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>
25587 <div class="thumbcaption">
25588 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25589 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
25590 </div>
25591 </div>
25592 <div class="thumb tright">
25593 <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>
25594 <div class="thumbcaption">
25595 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25596 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
25597 </div>
25598 </div>
25599 !! html/parsoid
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 rel="mw:ExtLink" href="http://example.com">http://example.com</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="//tools.ietf.org/html/rfc1234" rel="mw:ExtLink">RFC 1234</a></figcaption></figure>
25602 <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>
25603 <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>
25604 !! end
25605
25606 !! test
25607 WTS of magic word text (T109371)
25608 !! options
25609 parsoid=html2wt
25610 !! html/parsoid
25611 <p>RFC 1234</p>
25612 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
25613 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
25614 !! wikitext
25615 <nowiki>RFC 1234</nowiki>
25616
25617 [http://foo.com RFC 1234]
25618
25619 [[Foo|RFC 1234]]
25620 !! end
25621
25622 !! test
25623 Edited Redirect link should emit a non-piped wikitext link
25624 !! options
25625 parsoid=html2wt
25626 !! html/parsoid
25627 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
25628 !! wikitext
25629 #REDIRECT [[Bar]]
25630 !! end
25631
25632 !! test
25633 T75121: Infer extension name from typeOf if data-mw is not present
25634 !! options
25635 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25636 !! html/parsoid
25637 <div typeOf="mw:Extension/foo"></div>
25638 !! wikitext
25639 <foo />
25640 !! end
25641
25642 # Note that the <p> wrapping isn't present in PHP parser output
25643 # The important thing for this test is that P-wrapping doesn't
25644 # interfere with the <nowiki> protection for leading - in <td>
25645 # (which isn't necessary for <th>).
25646 !! test
25647 T88318: p-wrapped dash in table.
25648 !! options
25649 parsoid=html2wt,wt2wt
25650 !! html/parsoid
25651 <table><tbody>
25652 <tr><th><p>-</p></th><th><p>- </p></th></tr>
25653 <tr><td><p>-</p></td><td><p>- </p></td></tr>
25654 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
25655 </tbody></table>
25656 !! wikitext
25657 {|
25658 !-
25659 !-
25660 |-
25661 |<nowiki>-</nowiki>
25662 |<nowiki>- </nowiki>
25663 |-
25664 |<small>-</small>
25665 |<br>
25666 -
25667 |<br>
25668 -
25669 |}
25670 !! html/php+tidy
25671 <table>
25672 <tr>
25673 <th>-</th>
25674 <th>-</th>
25675 </tr>
25676 <tr>
25677 <td>-</td>
25678 <td>-</td>
25679 </tr>
25680 <tr>
25681 <td><small>-</small></td>
25682 <td><br />
25683 <p>-</p>
25684 </td>
25685 <td><br />
25686 <p>-</p>
25687 </td>
25688 </tr>
25689 </table>
25690 !! end
25691
25692 !! test
25693 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
25694 !! options
25695 parsoid=html2wt
25696 !! html/parsoid
25697 <table id='mwAb'>
25698 <td id='mwAc'>foo</td>
25699 <td id='serialize-this'>bar</td>
25700 </table>
25701 !! wikitext
25702 {|
25703 |foo
25704 | id="serialize-this" |bar
25705 |}
25706 !! end
25707
25708 !! test
25709 Parsoid-like element ids should not be serialized to wikitext unless shadowed
25710 !! options
25711 parsoid=html2wt
25712 !! html/parsoid
25713 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
25714 !! wikitext
25715 <div id="hello">ok</div>
25716 !! end
25717
25718 !! test
25719 WTS change modes
25720 !! options
25721 parsoid={
25722 "modes": ["wt2wt"],
25723 "changes": [
25724 [ "#xyz", "before", "<b>before</b> stuff " ],
25725 [ "#xyz", "after", " stuff <i>after</i>" ],
25726 [ "#xyz", "html", "x <b>y</b> z" ]
25727 ]
25728 }
25729 !! wikitext
25730 <span id="xyz">hello</span>
25731 !! wikitext/edited
25732 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
25733 !! end
25734
25735 !! test
25736 Never serialize a-tag as html, regardless of what data-parsoid has to say
25737 !! options
25738 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25739 !! html/parsoid
25740 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
25741 !! wikitext
25742 [[Foo]]
25743 !! end
25744
25745 ## SSS FIXME: This is broken output nevertheless.
25746 ## What might be a reasonable non-broken output for this?
25747 ## This is an edge case unlikely to be seen in production
25748 ## that I am not wasting more time on this right now.
25749 !! test
25750 Never serialize a-tag as html, no matter what attributes it has
25751 !! options
25752 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25753 !! html/parsoid
25754 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
25755 !! wikitext
25756 [http://boo.org http://boohoo.org]
25757 !! end
25758
25759 # Misnested is an indication that selser can reuse the source but these have
25760 # shown to sneak through on occasion. See T101768.
25761 # The original wikitext here is: [http://test.com [[one]] two three]
25762 !! test
25763 Strip span tags added to mark misnested links
25764 !! options
25765 parsoid=html2wt
25766 !! html/parsoid
25767 <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>
25768 !! wikitext
25769 [http://test.com][[one]] two three
25770 !! end
25771
25772 !! test
25773 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
25774 !! options
25775 parsoid=html2wt
25776 !! html/parsoid
25777 <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|}"]}'>
25778 <tbody><tr><td>d
25779 </td></tr>
25780 </tbody></table>
25781 !! wikitext
25782 {{echo|a}}
25783 {|{{echo|c
25784 {{!}}d
25785 }}
25786 |}
25787 !! end
25788
25789 ## This test verifies the presence and computation of this attribute indirectly
25790 ## by making an edit and ensuring that the serialization is correct (which it would be
25791 ## only if firstWikitextNode is properly set).
25792 !! test
25793 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
25794 !! options
25795 parsoid= {
25796 "modes": ["wt2wt"],
25797 "changes": [
25798 [ "div#x", "remove" ],
25799 [ "div", "before", "<div>new</div>" ]
25800 ]
25801 }
25802 !! wikitext
25803 <div id="x">foo</div>
25804 {|
25805 {{echo|<div>boo</div>
25806 {{!}}b}}
25807 |c
25808 |}
25809 !! wikitext/edited
25810
25811 <div>new</div>
25812 {|
25813 {{echo|<div>boo</div>
25814 {{!}}b}}
25815 |c
25816 |}
25817 !! end
25818
25819 # --------------------------------------------
25820 # Tests spec'ing wikitext serialization norms |
25821 # --------------------------------------------
25822
25823 !! test
25824 1. Categories should always be serialized on their own line
25825 !! options
25826 parsoid=html2wt
25827 !! html/parsoid
25828 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
25829 !! wikitext
25830 foo
25831 [[Category:Foo]]
25832 bar
25833 !! end
25834
25835 !! test
25836 2. Categories that are part of templates should not introduce a line break
25837 !! wikitext
25838 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
25839 !! html/parsoid
25840 <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>
25841 !! end
25842
25843 # Careful while editing these next 2 tests. There are \u200f characters
25844 # before and after the <link> tags in the HTML and following some
25845 # of the categories in wikitext
25846 # Do not remove these characters in edits.
25847 #
25848 # As part of the serialization, these bidi characters will get stripped.
25849 !! test
25850 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
25851 !! options
25852 parsoid={
25853 "modes": ["html2wt"],
25854 "scrubWikitext": true
25855 }
25856 !! html/parsoid
25857 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
25858 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
25859 !! wikitext
25860 [[קטגוריה:טקסים]]
25861 [[קטגוריה: שיטות משפט]]
25862 !! end
25863
25864 !! test
25865 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
25866 !! options
25867 parsoid={
25868 "modes": ["html2wt"],
25869 "scrubWikitext": true
25870 }
25871 !! html/parsoid
25872 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
25873 !! wikitext
25874 [[קטגוריה:טקסים]]
25875 ‏y
25876 !! end
25877
25878 !! test
25879 Lists: Add space after bullets
25880 !! options
25881 parsoid=html2wt
25882 !! html/parsoid
25883 <ul>
25884 <li>foo</li>
25885 <li> bar</li>
25886 <li><span> baz</span></li>
25887 </ul>
25888 !! wikitext
25889 * foo
25890 * bar
25891 * <span> baz</span>
25892 !! end
25893
25894 !! test
25895 1. Headings: Add space before/after == (T53744)
25896 !! options
25897 parsoid=html2wt
25898 !! html/parsoid
25899 <h2>foo</h2>
25900 <h2> bar</h2>
25901 <h2>baz </h2>
25902 <h2><span> baz</span></h2>
25903 !! wikitext
25904 == foo ==
25905
25906 == bar ==
25907
25908 == baz ==
25909
25910 == <span> baz</span> ==
25911 !! end
25912
25913 !! test
25914 2. Headings: Add space before/after == even after hoisted content
25915 !! options
25916 parsoid={
25917 "modes": ["html2wt"],
25918 "scrubWikitext": true
25919 }
25920 !! html/parsoid
25921 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
25922 !! wikitext
25923 [[Category:A2]]
25924
25925 == ok ==
25926 !! end
25927
25928 !! test
25929 1. Headings: suppress newly created empty headings
25930 !! options
25931 parsoid={
25932 "modes": ["html2wt"],
25933 "scrubWikitext": true
25934 }
25935 !! html/parsoid
25936 <h2></h2>
25937 !! wikitext
25938 !! end
25939
25940 !! test
25941 2. Headings: don't suppress empty headings if scrubWikitext is false
25942 !! options
25943 parsoid=html2wt
25944 !! html/parsoid
25945 <h2></h2>
25946 !! wikitext
25947 ==<nowiki/>==
25948 !! end
25949
25950 !! test
25951 3. Headings: suppress empty headings on edits
25952 !! options
25953 parsoid={
25954 "modes": ["selser"],
25955 "scrubWikitext": true,
25956 "changes": [
25957 [ "#x", "remove"]
25958 ]
25959 }
25960 !! wikitext
25961 ==<span id="x">foo</span>==
25962 !! wikitext/edited
25963 !! end
25964
25965 !! test
25966 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
25967 !! options
25968 parsoid={
25969 "modes": ["html2wt"],
25970 "scrubWikitext": true
25971 }
25972 !! html/parsoid
25973 <h2>foo<br/>bar</h2>
25974 <h2>foo <span><br/>bar</span> baz</h2>
25975 !! wikitext
25976 == foo bar ==
25977
25978 == foo <span> bar</span> baz ==
25979 !! end
25980
25981 !! test
25982 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
25983 !! options
25984 parsoid={
25985 "modes": ["html2wt"],
25986 "scrubWikitext": false
25987 }
25988 !! html/parsoid
25989 <h2>foo<br/>bar</h2>
25990 !! wikitext
25991 == foo<br> bar ==
25992 !! end
25993
25994 !! test
25995 1. WT Quote Tags: suppress newly created empty style tags
25996 !! options
25997 parsoid={
25998 "modes": ["html2wt"],
25999 "scrubWikitext": true
26000 }
26001 !! html/parsoid
26002 <i></i><b></b>
26003 !! wikitext
26004 !! end
26005
26006 !! test
26007 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
26008 !! options
26009 parsoid=html2wt
26010 !! html/parsoid
26011 <i></i><b></b>
26012 !! wikitext
26013 ''<nowiki/>'''''<nowiki/>'''
26014 !! end
26015
26016 !! test
26017 3. WT Quote Tags: suppress empty style tags on edits
26018 !! options
26019 parsoid={
26020 "modes": ["selser"],
26021 "scrubWikitext": true,
26022 "changes": [
26023 [ "#x", "remove"]
26024 ]
26025 }
26026 !! wikitext
26027 '''<span id="x">foo</span>'''
26028 !! wikitext/edited
26029 !! end
26030
26031 !! test
26032 1. Anchors: suppress newly created empty anchors
26033 !! options
26034 parsoid={
26035 "modes": ["html2wt"],
26036 "scrubWikitext": true
26037 }
26038 !! html/parsoid
26039 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26040 !! wikitext
26041 !! end
26042
26043 !! test
26044 2. Anchors: don't suppress empty anchors if scrubWikitext is false
26045 !! options
26046 parsoid={
26047 "modes": ["html2wt"],
26048 "scrubWikitext": false
26049 }
26050 !! html/parsoid
26051 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26052 !! wikitext
26053 [[Test|<nowiki/>]]
26054 !! end
26055
26056 !! test
26057 3. Anchors: suppress empty anchors on edits
26058 !! options
26059 parsoid={
26060 "modes": ["selser"],
26061 "scrubWikitext": true,
26062 "changes": [
26063 [ "#x", "remove"]
26064 ]
26065 }
26066 !! wikitext
26067 [[Test|<span id="x">foo</span>]]
26068 !! wikitext/edited
26069 !! end
26070
26071 !! test
26072 3a. Anchors: do not suppress numbered extlinks
26073 !! options
26074 parsoid={
26075 "modes": ["wt2wt"],
26076 "scrubWikitext": true
26077 }
26078 !! wikitext
26079 [http://foo.com]
26080 !! html/parsoid
26081 <a rel="mw:ExtLink" href="http://foo.com"></a>
26082 !! end
26083
26084 !! test
26085 3b. Anchors: do not suppress numbered extlinks
26086 !! options
26087 parsoid={
26088 "modes": ["wt2wt"],
26089 "scrubWikitext": true,
26090 "changes": [
26091 [ "#x", "remove"]
26092 ]
26093 }
26094 !! wikitext
26095 [http://foo.com <span id="x">foo</span>]
26096 !! wikitext/edited
26097 [http://foo.com]
26098 !! end
26099
26100 !!test
26101 Normalizations should be restricted to edited content
26102 !!options
26103 parsoid={
26104 "modes": ["selser"],
26105 "scrubWikitext": true,
26106 "changes": [
26107 [ "h1", "before", "<i></i>"]
26108 ]
26109 }
26110 !!wikitext
26111 a
26112 = =
26113 b
26114 !!wikitext/edited
26115 a
26116 = =
26117 b
26118 !!end
26119
26120 !! test
26121 1. Multiple normalizations (html2wt)
26122 !! options
26123 parsoid={
26124 "modes": ["html2wt"],
26125 "scrubWikitext": true
26126 }
26127 !! html
26128 <h2><i></i></h2>
26129 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
26130 </a><b><i></i></b>x</p>
26131 !! wikitext
26132
26133 [[foo]]
26134 x
26135
26136 !! end
26137
26138 !! test
26139 2. Multiple normalizations (selser)
26140 !! options
26141 parsoid={
26142 "modes": ["selser"],
26143 "scrubWikitext": true,
26144 "changes": [
26145 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
26146 ]
26147 }
26148 !! wikitext
26149 <span id="x">foo</span>
26150 !! wikitext/edited
26151 <span id="x">foo</span>
26152
26153 x
26154 !! end
26155
26156 !! test
26157 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
26158 !! options
26159 parsoid={
26160 "modes": ["html2wt"],
26161 "scrubWikitext": true
26162 }
26163 !! html/parsoid
26164 <p> hi</p>
26165 <p> hello</p>
26166 !! wikitext
26167 hi
26168
26169 hello
26170 !! end
26171
26172 !! test
26173 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
26174 !! options
26175 parsoid=html2wt
26176 !! html/parsoid
26177 <p> hi</p>
26178 <p> hello</p>
26179 !! wikitext
26180 <nowiki> </nowiki>hi
26181
26182 <nowiki> </nowiki> hello
26183 !! end
26184
26185 !! test
26186 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
26187 !! options
26188 parsoid={
26189 "modes": ["html2wt"],
26190 "scrubWikitext": true
26191 }
26192 !! html/parsoid
26193 <p>Foo
26194 bar
26195 baz</p>
26196
26197 <table><tr><td>Foo
26198 bar
26199 baz bang</td></tr></table>
26200
26201 <p><!--boo--> foo
26202 bar</p>
26203
26204 <p> foo
26205 bar<span>boo</span></p>
26206 !! wikitext
26207 Foo
26208 bar
26209 baz
26210
26211 {|
26212 |Foo
26213 bar
26214 baz bang
26215 |}
26216
26217 <!--boo-->foo
26218 bar
26219
26220 foo
26221 bar<span>boo</span>
26222 !! end
26223
26224 !! test
26225 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
26226 !! options
26227 parsoid={
26228 "modes": ["selser"],
26229 "scrubWikitext": true,
26230 "changes": [
26231 [ "p", "html", " a\n b" ]
26232 ]
26233 }
26234 !! wikitext
26235 xyz
26236 !! wikitext/edited
26237 a
26238 b
26239 !! end
26240
26241 !! test
26242 1. New links that end in spaces
26243 !! options
26244 parsoid={
26245 "modes": ["html2wt"],
26246 "scrubWikitext": false
26247 }
26248 !! html/parsoid
26249 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26250 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26251 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26252 !! wikitext
26253 [[Berlin ]]<nowiki/>is the capital of Germany.
26254
26255 [[Foo ]]'''bar'''
26256
26257 [[Boston ]] is a city.
26258 !! end
26259
26260 !! test
26261 2. New links that end in spaces
26262 !! options
26263 parsoid={
26264 "modes": ["html2wt"],
26265 "scrubWikitext": true
26266 }
26267 !! html/parsoid
26268 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26269 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26270 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26271 !! wikitext
26272 [[Berlin]] is the capital of Germany.
26273
26274 [[Foo]] '''bar'''
26275
26276 [[Boston]] is a city.
26277 !! end
26278
26279 !! test
26280 1. Table cells with escapable prefixes
26281 !! options
26282 parsoid={
26283 "modes": ["html2wt"],
26284 "scrubWikitext": false
26285 }
26286 !! html
26287 <table>
26288 <tr><td>a</td></tr>
26289 <tr><td>-</td></tr>
26290 <tr><td>+</td></tr>
26291 </table>
26292 !! wikitext
26293 {|
26294 |a
26295 |-
26296 |<nowiki>-</nowiki>
26297 |-
26298 |<nowiki>+</nowiki>
26299 |}
26300 !! end
26301
26302 !! test
26303 2. Table cells with escapable prefixes
26304 !! options
26305 parsoid={
26306 "modes": ["html2wt"],
26307 "scrubWikitext": true
26308 }
26309 !! html
26310 <table>
26311 <tr><td>a</td></tr>
26312 <tr><td>-</td></tr>
26313 <tr><td>+</td></tr>
26314 </table>
26315 !! wikitext
26316 {|
26317 |a
26318 |-
26319 | -
26320 |-
26321 | +
26322 |}
26323 !! end
26324
26325 !! test
26326 3a. Table cells with escapable prefixes after edits
26327 !! options
26328 parsoid={
26329 "modes": ["selser"],
26330 "scrubWikitext": true,
26331 "changes": [
26332 [ "table tbody tr:first-child td:first-child", "remove"]
26333 ]
26334 }
26335 !! wikitext
26336 {|
26337 |a||-
26338 |}
26339 !! wikitext/edited
26340 {|
26341 | -
26342 |}
26343 !! end
26344
26345 !! test
26346 3b. Table cells with escapable prefixes after edits
26347 !! options
26348 parsoid={
26349 "modes": ["selser"],
26350 "scrubWikitext": true,
26351 "changes": [
26352 [ "table tbody tr:first-child td:first-child", "html", "-" ],
26353 [ "#x", "remove" ]
26354 ]
26355 }
26356 !! wikitext
26357 {|
26358 |pqr
26359 |<span id="x">foo</span>+
26360 |}
26361 !! wikitext/edited
26362 {|
26363 | -
26364 | +
26365 |}
26366 !! end
26367
26368 # FIXME: This test will fail because
26369 # normalization doesn't realize that the id attribute
26370 # will eliminate the escapable scenario
26371 !! test
26372 4a. Table cells without escapable prefixes after edits
26373 !! options
26374 parsoid={
26375 "modes": ["selser"],
26376 "scrubWikitext": true,
26377 "changes": [
26378 [ "#x", "html", "-" ]
26379 ]
26380 }
26381 !! wikitext
26382 {|
26383 | id="x" |abcd
26384 |}
26385 !! wikitext/edited
26386 {|
26387 | id="x" |-
26388 |}
26389 !! end
26390
26391 ## This tests normalizer's ability to discriminate between
26392 ## cells having identical content.
26393 !! test
26394 4b. Table cells without escapable prefixes after edits
26395 !! options
26396 parsoid={
26397 "modes": ["selser"],
26398 "scrubWikitext": true,
26399 "changes": [
26400 [ "td", "html", "-" ]
26401 ]
26402 }
26403 !! wikitext
26404 {|
26405 |a||b
26406 |}
26407 !! wikitext/edited
26408 {|
26409 | -||-
26410 |}
26411 !! end
26412
26413 ## This tests normalizer's ability to not be tripped by
26414 ## comments (and whitespace)
26415 !! test
26416 4c. Table cells without escapable prefixes after edits
26417 !! options
26418 parsoid={
26419 "modes": ["selser"],
26420 "scrubWikitext": true,
26421 "changes": [
26422 [ "table tbody tr td:first-child", "remove" ]
26423 ]
26424 }
26425 !! wikitext
26426 {|
26427 |-
26428 <!--foo--> |a||-
26429 |}
26430 !! wikitext/edited
26431 {|
26432 |-
26433 <!--foo--> | -
26434 |}
26435 !! end
26436
26437 ## This tests normalizer's ability to handle HTML cells
26438 !! test
26439 4d. Table cells without escapable prefixes after edits
26440 !! options
26441 parsoid={
26442 "modes": ["selser"],
26443 "scrubWikitext": true,
26444 "changes": [
26445 [ "td", "html", "-" ]
26446 ]
26447 }
26448 !! wikitext
26449 <table>
26450 <tr><td>a</td></tr>
26451 </table>
26452 !! wikitext/edited
26453 <table>
26454 <tr><td>-</td></tr>
26455 </table>
26456 !! end
26457
26458 ## T111151 Remove font elements without attributes
26459 !! test
26460 5a. font tags without attributes should be dropped in scrubWikitext mode
26461 !! options
26462 parsoid={
26463 "modes": ["html2wt"],
26464 "scrubWikitext": true
26465 }
26466 !! html
26467 <font>foo</font>
26468 <font><font>bar</font></font>
26469 <font class="x">boo</font>
26470 !! wikitext
26471 foo
26472 bar
26473 <font class="x">boo</font>
26474 !! end
26475
26476 !! test
26477 5b. font tags should not be dropped without scrubWikitext being enabled
26478 !! options
26479 parsoid={
26480 "modes": ["html2wt"],
26481 "scrubWikitext": false
26482 }
26483 !! html
26484 <font>foo</font>
26485 !! wikitext
26486 <font>foo</font>
26487 !! end
26488
26489 !! test
26490 Escape nowiki DOM elements
26491 !! options
26492 parsoid=html2wt
26493 !! html/parsoid
26494 <nowiki><i>foo</i></nowiki>
26495 !! wikitext
26496 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
26497 !! end
26498
26499 # This is meant to be an interim fix while we go about figuring out
26500 # how to not introduce these trailing <nowiki/>s in the first place.
26501 !! test
26502 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
26503 !! options
26504 parsoid=html2wt
26505 !! html/parsoid
26506 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
26507 y</p>
26508 <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>
26509 <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>
26510 !! wikitext
26511 x
26512 y
26513
26514 {{echo|
26515 1 = <nowiki/>}}
26516
26517 {{echo|
26518 1 = <nowiki/>
26519 }}
26520 !! end
26521
26522 # ---------------------------------------------------
26523 # End of tests spec'ing wikitext serialization norms |
26524 # ---------------------------------------------------
26525
26526 # T104032
26527 !! test
26528 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
26529 !! options
26530 parsoid=html2wt
26531 !! html/parsoid
26532 a<p>b</p>
26533 <b>c</b><p>d</p>
26534 <table><tr>
26535 <td>a<p>b</p></td>
26536 <td><b>c</b><p>d</p></td>
26537 </tr></table>
26538 !! wikitext
26539 a
26540
26541 b
26542
26543 '''c'''
26544
26545 d
26546 {|
26547 |a
26548 b
26549 |'''c'''
26550 d
26551 |}
26552 !! end
26553
26554 # -----------------------------------------------------------------
26555 # End of section for Parsoid-only html2wt tests for serialization
26556 # of new content
26557 # -----------------------------------------------------------------
26558
26559 # -----------------------------------------------------------------
26560 # The following section of tests are primarily to spec behavior of
26561 # the selective serializer. All these tests have manual selser
26562 # changes. The automated selser changes for all tests handle the
26563 # wide variation of changes, but these tests here capture specs
26564 # deterministically.
26565 # ----------------------------------------------------------------
26566
26567 ## T90517
26568 !! test
26569 Selser: New comments should not be lost
26570 !! options
26571 parsoid={
26572 "modes": ["selser"],
26573 "changes": [
26574 [ "#a", "after", "<!--c1-->" ],
26575 [ "#b", "before", "<!--c2-->" ]
26576 ]
26577 }
26578 !! wikitext
26579 <span id="a">a</span>
26580
26581 <span id="b">b</span>
26582 !! wikitext/edited
26583 <span id="a">a</span><!--c1-->
26584
26585 <!--c2--><span id="b">b</span>
26586 !! end
26587
26588 ## T89383
26589 !! test
26590 Selser: Check for validity of DSR before using it
26591 !! options
26592 parsoid={
26593 "modes": ["selser"],
26594 "changes": [
26595 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
26596 ]
26597 }
26598 !! wikitext
26599 <span id="a">a</span>
26600 !! wikitext/edited
26601 {{DISPLAYTITLE:foo}}
26602 <span id="a">a</span>
26603 !! end
26604
26605 !! test
26606 1. DOMDiff: Changes to <ref> content should be looked up using id
26607 !! options
26608 parsoid={
26609 "modes": ["selser"],
26610 "changes": [
26611 ["#X", "after", "bar"],
26612 ["#Y", "after", "baz"]
26613 ]
26614 }
26615 !! wikitext
26616 X <ref><span id="X">foo</span></ref>
26617 Y <ref name="a" />
26618 <references>
26619 <ref name="a"><span id="Y">foo</span></ref>
26620 </references>
26621 !! wikitext/edited
26622 X <ref><span id="X">foo</span>bar</ref>
26623 Y <ref name="a" />
26624 <references>
26625 <ref name="a"><span id="Y">foo</span>baz</ref>
26626 </references>
26627 !! end
26628
26629 !! test
26630 2. DOMDiff: Changes to <ref> content should be looked up using id
26631 !! options
26632 parsoid={
26633 "modes": ["selser"],
26634 "changes": [
26635 ["#Z", "after", "bar"]
26636 ]
26637 }
26638 !! wikitext
26639 A <ref>foo bar for a</ref>
26640 B <ref group="X" name="b" />
26641
26642 <references />
26643
26644 <references group="X">
26645 <ref name="b"><span id="Z">foo</span></ref>
26646 </references>
26647 !! wikitext/edited
26648 A <ref>foo bar for a</ref>
26649 B <ref group="X" name="b" />
26650
26651 <references />
26652
26653 <references group="X">
26654 <ref name="b"><span id="Z">foo</span>bar</ref>
26655 </references>
26656 !! end
26657
26658 !! test
26659 Empty LI (T49673)
26660 !! wikitext
26661 * a
26662 *
26663 *
26664 * b
26665 !! html/php+tidy
26666 <ul>
26667 <li>a</li>
26668 <li class="mw-empty-li"></li>
26669 <li class="mw-empty-li"></li>
26670 <li>b</li>
26671 </ul>
26672 !! end