Sync up with Parsoid parserTests.
[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 ## PHP parser discards the "<pre " string
2524 !! test
2525 Handle broken pre-like tags (bug 64025)
2526 !! options
2527 parsoid=wt2html
2528 !! wikitext
2529 {{echo|<pre <pre>x</pre>}}
2530
2531 <table><pre </table>
2532 !! html/php
2533 <pre>x</pre>
2534 <table><pre></pre></table>
2535
2536 !! html/parsoid
2537 <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>
2538
2539
2540 <p>&lt;pre </p>
2541
2542 <table></table>
2543 !! end
2544
2545 !! test
2546 Parsoid: handle pre with space after attribute
2547 !! options
2548 parsoid=wt2html
2549 !! wikitext
2550 <pre style="width:50%;" >{{echo|foo}}</pre>
2551 !! html/php
2552 <pre style="width:50%;">{{echo|foo}}</pre>
2553
2554 !! html/parsoid
2555 <pre style="width:50%;">{{echo|foo}}</pre>
2556 !! end
2557
2558 # TODO / maybe: fix wt2wt for this
2559 !! test
2560 Parsoid: Don't paragraph-wrap fosterable content
2561 !! options
2562 parsoid=wt2html
2563 !! wikitext
2564 {|
2565 <td></td>
2566 <td></td>
2567
2568
2569
2570 |}
2571 !! html
2572 <table>
2573
2574 <tbody>
2575 <tr>
2576 <td></td>
2577
2578 <td></td></tr>
2579
2580
2581
2582 </tbody></table>
2583 !! end
2584
2585 !! test
2586 Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
2587 !! options
2588 parsoid=wt2html
2589 !! wikitext
2590 {|
2591 <td>
2592 <td>
2593 </td>
2594
2595
2596
2597 |}
2598 !! html
2599 <table>
2600
2601 <tbody>
2602 <tr>
2603 <td></td>
2604
2605 <td>
2606 </td></tr>
2607
2608
2609
2610 </tbody></table>
2611 !! end
2612
2613
2614 #--------------------------------------------------------------------
2615 # Transclusion parameter whitespace stripping tests
2616 # Behavior is different for positional and named parameters
2617 #--------------------------------------------------------------------
2618 !! test
2619 Templates: Strip leading and trailing whitespace from named-param values
2620 !! wikitext
2621 {{echo|1= a }}
2622
2623 {{echo|1= {{echo|b}} }}
2624
2625 {{echo| 1 =
2626 c }}
2627
2628 {{echo| 1 =
2629 * d
2630 }}
2631 !! html
2632 <p>a
2633 </p><p>b
2634 </p><p>c
2635 </p>
2636 <ul><li> d</li></ul>
2637
2638 !! end
2639
2640 !! test
2641 Templates: Don't strip whitespace from positional-param values
2642 !! wikitext
2643 {{echo|a }}
2644
2645 {{echo|{{echo|b}} }}
2646
2647 {{echo| c
2648 }}
2649
2650 {{echo| {{echo|d}}
2651 }}
2652
2653 {{echo|
2654 e}}
2655
2656 {{echo|
2657 * f}}
2658
2659 {{echo|
2660 }}g
2661 !! html
2662 <p>a
2663 </p><p>b
2664 </p>
2665 <pre>c
2666 </pre>
2667 <p><br />
2668 </p>
2669 <pre>d
2670 </pre>
2671 <p><br />
2672 </p>
2673 <pre>e
2674 </pre>
2675 <p><br />
2676 </p>
2677 <ul><li> f</li></ul>
2678 <p><br />
2679 </p>
2680 <pre>g
2681 </pre>
2682 !! end
2683
2684 !! test
2685 Templates: Handle empty comment-and-ws-only lines correctly
2686 !! wikitext
2687 {{echo|foo
2688 <!--should be ignored-->
2689 <!--should be ignored as well-->
2690 bar}}
2691 !! html
2692 <p>foo
2693 bar
2694 </p>
2695 !! end
2696
2697 !! test
2698 Templates: Handle comments in the target
2699 !! wikitext
2700 {{echo
2701 <!-- should be ignored -->
2702 |foo}}
2703
2704 {{echo<!-- should be ignored -->
2705 |foo}}
2706
2707 {{echo<!-- should be ignored -->|foo}}
2708
2709 {{<!-- should be ignored -->echo|foo}}
2710 !!html/parsoid
2711 <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>
2712
2713 <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>
2714
2715 <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>
2716
2717 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
2718 !!end
2719
2720 !! test
2721 Templates: Handle comments in parameter names (bug 67657)
2722 !! wikitext
2723 {{echo|1
2724 <!-- should be ignored -->
2725 =foo}}
2726
2727 {{echo|
2728 <!-- should be ignored -->
2729 1 = foo}}
2730
2731 {{echo|1<!-- should be ignored --> = foo}}
2732
2733 {{echo|<!-- should be ignored -->1 = foo}}
2734 !!html/parsoid
2735 <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>
2736
2737 <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>
2738
2739 <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>
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 -->1"}}},"i":0}}]}'>foo</p>
2742 !!end
2743
2744 !! test
2745 Templates: Other wikitext in parameter names (bug 67657)
2746 !! wikitext
2747 {{echo|''1''=foo}}
2748 !!html/parsoid
2749 <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>
2750 !!html/php
2751 <p>{{{1}}}
2752 </p>
2753 !!end
2754
2755 #--------------------------------------------------------------------
2756 # Transclusion parameter escaping tests
2757 #--------------------------------------------------------------------
2758 !! test
2759 Templates: Parsoid parameter escaping test 1
2760 !! wikitext
2761 {{echo|[foo]|{{echo|[bar]}}}}
2762 !! html/php+tidy
2763 <p>[foo]</p>
2764 !! html/parsoid
2765 <p about="#mwt1" typeof="mw:Transclusion"
2766 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
2767 !! end
2768
2769 !! test
2770 Parsoid: Pipes in external links in template parameter
2771 !! wikitext
2772 {{echo|[{{echo|http://example.com}} link]}}
2773 !! html/php+tidy
2774 <p><a rel="nofollow" class="external text" href="http://example.com">link</a></p>
2775 !! html/parsoid
2776 <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>
2777 !! end
2778
2779 !! test
2780 Parsoid: pipe in transclusion parameter
2781 !! wikitext
2782 {{echo|http://foo.com/a&#124;b}}
2783 !! html/php+tidy
2784 <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a></p>
2785 !! html/parsoid
2786 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2787 typeof="mw:Transclusion"
2788 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>
2789 !! end
2790
2791 !! test
2792 Parsoid: Pipe in external link target and content in template parameter
2793 !! options
2794 parsoid=html2wt,wt2wt
2795 !! wikitext
2796 {{echo|[http://foo.com/a&#124;b a&#124;b]}}
2797 !! html/php+tidy
2798 <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a></p>
2799 !! html/parsoid
2800 <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
2801 typeof="mw:Transclusion"
2802 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
2803 "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
2804 !! end
2805
2806 !! test
2807 Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
2808 !! options
2809 parsoid
2810 !! wikitext
2811 {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
2812 !! html
2813 <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>
2814 !! end
2815
2816 !! test
2817 Templates: Don't escape already nowiki-escaped text in template parameters
2818 !! options
2819 parsoid=html2wt,wt2wt
2820 !! wikitext
2821 {{echo|foo<nowiki>|</nowiki>bar}}
2822 {{echo|<nowiki>&lt;div&gt;</nowiki>}}
2823 {{echo|<nowiki></nowiki>}}
2824 !! html/php+tidy
2825 <p>foo|bar &lt;div&gt;</p>
2826 !! html/parsoid
2827 <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>
2828 <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>
2829 <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>
2830 </p>
2831 !! end
2832
2833 ## Bug 52824
2834 !! test
2835 Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
2836 !! options
2837 parsoid=html2wt,wt2wt
2838 !! wikitext
2839 {{echo|{{echo|1=bar}}}}
2840 !! html/php+tidy
2841 <p>bar</p>
2842 !! html/parsoid
2843 <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>
2844 !! end
2845
2846 ## Bug 56733
2847 !! test
2848 Templates parameters with special tokenizing behavior dont get modified because of arg escaping
2849 !! wikitext
2850 {{echo|a : b}}
2851 !! html/php+tidy
2852 <p>a&#160;: b</p>
2853 !! html/parsoid
2854 <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>
2855 !! end
2856
2857 ## Bug T73412
2858 !! test
2859 Templates: Preserve blank parameter names
2860 !! wikitext
2861 {{echo|=foo}}
2862 !! html/php+tidy
2863 <p>{{{1}}}</p>
2864 !! html/parsoid
2865 <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
2866 !! end
2867
2868 !! test
2869 Templates: Preserve blank parameter names in other positions
2870 !! wikitext
2871 {{blank_param|bar|=foo}}
2872 !! html/php+tidy
2873 <p>bar foo</p>
2874 !! html/parsoid
2875 <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
2876 foo</p>
2877 !! end
2878
2879 ###
2880 ### Parsoid-centric tests for testing RT edge cases for pre
2881 ###
2882
2883 !!test
2884 1a. Indent-Pre and Comments
2885 !! wikitext
2886 a
2887 <!--a-->
2888 c
2889 !! html
2890 <pre>a
2891 </pre>
2892 <p>c
2893 </p>
2894 !!end
2895
2896 !!test
2897 1b. Indent-Pre and Comments
2898 !! wikitext
2899 a
2900 <!--a-->
2901 c
2902 !! html
2903 <pre>a
2904 </pre>
2905 <p>c
2906 </p>
2907 !!end
2908
2909 !!test
2910 1c. Indent-Pre and Comments
2911 !! wikitext
2912 <!--a--> a
2913
2914 <!--a--> a
2915 !! html
2916 <pre> a
2917 </pre>
2918 <pre> a
2919 </pre>
2920 !!end
2921
2922 !!test
2923 1d. Indent-Pre and Comments
2924 (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
2925 !! wikitext
2926 <!--a--> a
2927
2928 <!--b-->b
2929 !! html
2930 <pre>a
2931 </pre>
2932 <pre>b
2933 </pre>
2934 !!end
2935
2936 !!test
2937 2a. Indent-Pre and tables
2938 !! wikitext
2939 {|
2940 |-
2941 !h1!!h2
2942 |foo||bar
2943 |}
2944 !! html
2945 <table>
2946
2947 <tr>
2948 <th>h1</th>
2949 <th>h2
2950 </th>
2951 <td>foo</td>
2952 <td>bar
2953 </td></tr></table>
2954
2955 !!end
2956
2957 !!test
2958 2b. Indent-Pre and tables
2959 !! wikitext
2960 {|
2961 |-
2962 |foo
2963 |}
2964 !! html
2965 <table>
2966
2967 <tr>
2968 <td>foo
2969 </td></tr></table>
2970
2971 !!end
2972
2973 !!test
2974 2c. Indent-Pre and tables (bug 42252)
2975 !! wikitext
2976 {|
2977 |+ foo
2978 ! | bar
2979 |}
2980 !! html
2981 <table>
2982 <caption> foo
2983 </caption>
2984 <tr>
2985 <th> bar
2986 </th></tr></table>
2987
2988 !!end
2989
2990 !!test
2991 2d. Indent-Pre and tables
2992 !! wikitext
2993 a
2994 {|
2995 | b
2996 |}
2997 !! html/php
2998 <pre>a
2999 </pre>
3000 <table>
3001 <tr>
3002 <td> b
3003 </td></tr></table>
3004
3005 !! html/parsoid
3006 <pre>a</pre>
3007 <table>
3008 <tbody><tr><td> b</td></tr>
3009 </tbody></table>
3010 !!end
3011
3012 !!test
3013 2e. Indent-Pre and table-line syntax
3014 !! wikitext
3015 a
3016 | b
3017 | c
3018 !! html/php
3019 <pre>a
3020 | b
3021 | c
3022 </pre>
3023 !!end
3024
3025 !!test
3026 2f. Indent-pre started by table-line syntax
3027 !! wikitext
3028 a
3029 | b
3030 | c
3031 !! html/php
3032 <p>a
3033 </p>
3034 <pre>| b
3035 | c
3036 </pre>
3037 !! html/parsoid
3038 <p>a</p>
3039 <pre>
3040 | b
3041 | c</pre>
3042 !!end
3043
3044 !!test
3045 3a. Indent-Pre and block tags (single-line html)
3046 !! wikitext
3047 a <p> foo </p>
3048 b <div> foo </div>
3049 c <blockquote> foo </blockquote>
3050 <span> foo </span>
3051 !! html
3052 a <p> foo </p>
3053 b <div> foo </div>
3054 c <blockquote> foo </blockquote>
3055 <pre><span> foo </span>
3056 </pre>
3057 !! html/parsoid
3058 <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
3059 <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
3060 <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
3061 <pre><span> foo </span>
3062 </pre>
3063 !! html+tidy
3064 <p>a</p>
3065 <p>foo</p>
3066 <p>b</p>
3067 <div>foo</div>
3068 <p>c</p>
3069 <blockquote>
3070 <p>foo</p>
3071 </blockquote>
3072 <pre>
3073 <span> foo </span>
3074 </pre>
3075 !! end
3076
3077 !!test
3078 3b. Indent-Pre and block tags (multi-line html)
3079 !! wikitext
3080 a <span>foo</span>
3081 b <div> foo </div>
3082 !! html
3083 <pre>a <span>foo</span>
3084 </pre>
3085 b <div> foo </div>
3086
3087 !! html/parsoid
3088 <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
3089 b <div data-parsoid='{"stx":"html"}'> foo </div>
3090 !! html+tidy
3091 <pre>
3092 a <span>foo</span>
3093 </pre>
3094 <p>b</p>
3095 <div>foo</div>
3096 !!end
3097
3098 !!test
3099 3c. Indent-Pre and block tags (pre-content on separate line)
3100 !! wikitext
3101 <p>
3102 foo
3103 </p>
3104
3105 <div>
3106 foo
3107 </div>
3108
3109 <center>
3110 foo
3111 </center>
3112
3113 <blockquote>
3114 foo
3115 </blockquote>
3116
3117 <blockquote>
3118 <pre>
3119 foo
3120 </pre>
3121 </blockquote>
3122
3123 <table><tr><td>
3124 foo
3125 </td></tr></table>
3126
3127 <ul><li>
3128 foo
3129 </li></ul>
3130
3131 !! html
3132 <p>
3133 foo
3134 </p>
3135 <div>
3136 <pre>foo
3137 </pre>
3138 </div>
3139 <center>
3140 <pre>foo
3141 </pre>
3142 </center>
3143 <blockquote>
3144 <p> foo
3145 </p>
3146 </blockquote>
3147 <blockquote>
3148 <pre>
3149 foo
3150 </pre>
3151 </blockquote>
3152 <table><tr><td>
3153 <pre>foo
3154 </pre>
3155 </td></tr></table>
3156 <ul><li>
3157 foo
3158 </li></ul>
3159
3160 !!end
3161
3162 !!test
3163 4. Indent-Pre and extension tags
3164 !! wikitext
3165 a <gallery>
3166 File:foobar.jpg
3167 </gallery>
3168 !! html
3169 a <ul class="gallery mw-gallery-traditional">
3170 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
3171 <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>
3172 <div class="gallerytext">
3173 </div>
3174 </div></li>
3175 </ul>
3176
3177 !! html+tidy
3178 <p>a</p>
3179 <ul class="gallery mw-gallery-traditional">
3180 <li class="gallerybox" style="width: 155px">
3181 <div style="width: 155px">
3182 <div class="thumb" style="width: 150px;">
3183 <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>
3184 </div>
3185 <div class="gallerytext"></div>
3186 </div>
3187 </li>
3188 </ul>
3189 !!end
3190
3191 !! test
3192 Table wikitext syntax outside wiki-tables
3193 !! wikitext
3194 a
3195 ! not a table heading
3196 |- not a table row
3197 | not a table cell
3198 | class="foo bar" | baz
3199 b
3200 |}
3201 |-
3202 c
3203 !! html
3204 <p>a
3205 ! not a table heading
3206 |- not a table row
3207 | not a table cell
3208 | class="foo bar" | baz
3209 b
3210 |}
3211 |-
3212 c
3213 </p>
3214 !! end
3215
3216 !!test
3217 Render paragraphs when indent-pre is suppressed in blocklevels
3218 !! wikitext
3219 <blockquote>
3220 foo
3221
3222 bar
3223 </blockquote>
3224 !! html
3225 <blockquote>
3226 <p> foo
3227 </p><p> bar
3228 </p>
3229 </blockquote>
3230
3231 !!end
3232
3233 !!test
3234 4. Multiple spaces at start-of-line
3235 !! wikitext
3236 <p> foo </p>
3237 foo
3238 {|
3239 |foo
3240 |}
3241 !! html
3242 <p> foo </p>
3243 <pre> foo
3244 </pre>
3245 <table>
3246 <tr>
3247 <td>foo
3248 </td></tr></table>
3249
3250 !!end
3251
3252 ## NOTE: the leading white-space chars on empty line are significant
3253 !! test
3254 5a. White-space in indent-pre
3255 !! wikitext
3256 a<br />
3257
3258 b
3259 !! html
3260 <pre>a<br />
3261
3262 b
3263 </pre>
3264 !! end
3265
3266 ## NOTE: the leading white-space chars on empty line are significant
3267 !! test
3268 5b. White-space in indent-pre
3269 !! wikitext
3270 a
3271
3272 b
3273
3274
3275 c
3276 !! html
3277 <pre>a
3278
3279 b
3280
3281
3282 c
3283 </pre>
3284 !! end
3285
3286 !! test
3287 5c. White-space in indent-pre
3288 !! wikitext
3289 ''a''
3290 ''b''
3291 ''c''
3292 !! html
3293 <pre><i>a</i>
3294 <i>b</i>
3295 <i>c</i>
3296 </pre>
3297 !! end
3298
3299 !! test
3300 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
3301 !! wikitext
3302 a
3303
3304 <!-- continue -->
3305 b
3306
3307 c
3308
3309 d
3310 !! html
3311 <pre>a
3312
3313 b
3314 </pre>
3315 <pre>c
3316
3317 </pre>
3318 <p>d
3319 </p>
3320 !! end
3321
3322 !! test
3323 7a. Indent-pre and category links
3324 !! options
3325 parsoid=wt2html,wt2wt
3326 !! wikitext
3327 [[Category:foo]] <!-- No pre-wrapping -->
3328 {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
3329 !! html/php+tidy
3330 !! html/parsoid
3331 <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
3332 <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 -->
3333 !! end
3334
3335 ## We used to, but no longer wt2wt this test since the default serializer
3336 ## will normalize all categories to serialize on their own line.
3337 ## This wikitext usage is going to be fairly uncommon in production and
3338 ## selser will take care of preserving formatting in those scenarios.
3339 !! test
3340 7b. Indent-pre and category links
3341 !! options
3342 parsoid=wt2html
3343 !! wikitext
3344 [[Category:foo]] a
3345 [[Category:foo]] {{echo|b}}
3346 !! html/parsoid
3347 <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
3348 <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>
3349 !! end
3350
3351 !! test
3352 Indent-Pre: Newlines in comments shouldn't affect sol state
3353 !! wikitext
3354 a <!--
3355 foo
3356 --> b
3357 !! html/php+tidy
3358 <p>a b</p>
3359 !! html/parsoid
3360 <p>a <!--
3361 foo
3362 --> b</p>
3363 !! end
3364
3365 ###
3366 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
3367 ###
3368
3369 !!test
3370 HTML-pre: 1. embedded newlines
3371 !! wikitext
3372 <pre>foo</pre>
3373
3374 <pre>
3375 foo
3376 </pre>
3377
3378 <pre>
3379
3380 foo
3381 </pre>
3382
3383 <pre>
3384
3385
3386 foo
3387 </pre>
3388 !! html/php+tidy
3389 <pre>
3390 foo
3391 </pre>
3392 <pre>
3393 foo
3394 </pre>
3395 <pre>
3396
3397 foo
3398 </pre>
3399 <pre>
3400
3401
3402 foo
3403 </pre>
3404 !! html/parsoid
3405 <pre data-parsoid='{"stx":"html"}'>foo</pre>
3406
3407 <pre data-parsoid='{"stx":"html","strippedNL":"\n"}'>
3408 foo
3409 </pre>
3410
3411 <pre data-parsoid='{"stx":"html"}'>
3412
3413 foo
3414 </pre>
3415
3416 <pre data-parsoid='{"stx":"html"}'>
3417
3418
3419 foo
3420 </pre>
3421 !!end
3422
3423 !! test
3424 HTML-pre: big spaces
3425 !! wikitext
3426 <pre>
3427
3428
3429
3430
3431 haha
3432
3433
3434
3435
3436 haha
3437
3438
3439
3440
3441 </pre>
3442 !! html/php+tidy
3443 <pre>
3444
3445
3446
3447
3448 haha
3449
3450
3451
3452
3453 haha
3454
3455
3456
3457
3458 </pre>
3459 !! html/parsoid
3460 <pre data-parsoid='{"stx":"html"}'>
3461
3462
3463
3464
3465 haha
3466
3467
3468
3469
3470 haha
3471
3472
3473
3474
3475 </pre>
3476 !! end
3477
3478 !!test
3479 HTML-pre: 2: indented text
3480 !! wikitext
3481 <pre>
3482 foo
3483 </pre>
3484 !! html
3485 <pre>
3486 foo
3487 </pre>
3488
3489 !!end
3490
3491 !!test
3492 HTML-pre: 3: other wikitext
3493 !! wikitext
3494 <pre>
3495 * foo
3496 # bar
3497 = no-h =
3498 '' no-italic ''
3499 [[ NoLink ]]
3500 </pre>
3501 !! html/php
3502 <pre>
3503 * foo
3504 # bar
3505 = no-h =
3506 '' no-italic ''
3507 [[ NoLink ]]
3508 </pre>
3509
3510 !! html/parsoid
3511 <pre data-parsoid='{"stx":"html","strippedNL":true}'>* foo
3512 # bar
3513 = no-h =
3514 '' no-italic ''
3515 [[ NoLink ]]
3516 </pre>
3517 !!end
3518
3519 ###
3520 ### Definition lists
3521 ###
3522 !! test
3523 Simple definition
3524 !! wikitext
3525 ; name : Definition
3526 !! html
3527 <dl><dt> name&#160;</dt>
3528 <dd> Definition</dd></dl>
3529
3530 !! end
3531
3532 !! test
3533 Definition list for indentation only
3534 !! wikitext
3535 : Indented text
3536 !! html
3537 <dl><dd> Indented text</dd></dl>
3538
3539 !! end
3540
3541 !! test
3542 Definition list with no space
3543 !! wikitext
3544 ;name:Definition
3545 !! html
3546 <dl><dt>name</dt>
3547 <dd>Definition</dd></dl>
3548
3549 !!end
3550
3551 !! test
3552 Definition list with URL link
3553 !! wikitext
3554 ; http://example.com/ : definition
3555 !! html
3556 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
3557 <dd> definition</dd></dl>
3558
3559 !! end
3560
3561 !! test
3562 Definition list with bracketed URL link
3563 !! wikitext
3564 ;[http://www.example.com/ Example]:Something about it
3565 !! html
3566 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
3567 <dd>Something about it</dd></dl>
3568
3569 !! end
3570
3571 !! test
3572 Definition list with wikilink containing colon
3573 !! wikitext
3574 ; [[Help:FAQ]]: The least-read page on Wikipedia
3575 !! html
3576 <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>
3577 <dd> The least-read page on Wikipedia</dd></dl>
3578
3579 !! end
3580
3581 # At Brion's and JeLuF's insistence... :)
3582 !! test
3583 Definition list with news link containing colon
3584 !! wikitext
3585 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
3586 !! html/php
3587 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
3588 <dd> This isn't even a real newsgroup!</dd></dl>
3589
3590 !! html/parsoid
3591 <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>
3592 !! end
3593
3594 !! test
3595 Malformed definition list with colon
3596 !! wikitext
3597 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
3598 !! html
3599 <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>
3600
3601 !! end
3602
3603 !! test
3604 Definition lists: colon in external link text
3605 !! wikitext
3606 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
3607 !! html
3608 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt>
3609 <dd> OK, I made that up</dd></dl>
3610
3611 !! end
3612
3613 !! test
3614 Definition lists: colon in HTML attribute
3615 !! wikitext
3616 ;<b style="display: inline">bold</b>
3617 !! html
3618 <dl><dt><b style="display: inline">bold</b></dt></dl>
3619
3620 !! end
3621
3622 !! test
3623 Definition lists: self-closed tag
3624 !! wikitext
3625 ;one<br/>two : two-line fun
3626 !! html
3627 <dl><dt>one<br />two&#160;</dt>
3628 <dd> two-line fun</dd></dl>
3629
3630 !! end
3631
3632 !! test
3633 Bug 11748: Literal closing tags
3634 !! wikitext
3635 <dl>
3636 <dt>test 1</dt>
3637 <dd>test test test test test</dd>
3638 <dt>test 2</dt>
3639 <dd>test test test test test</dd>
3640 </dl>
3641 !! html
3642 <dl>
3643 <dt>test 1</dt>
3644 <dd>test test test test test</dd>
3645 <dt>test 2</dt>
3646 <dd>test test test test test</dd>
3647 </dl>
3648
3649 !! end
3650
3651 !! test
3652 Definition and unordered list using wiki syntax nested in unordered list using html tags.
3653 !! wikitext
3654 <ul><li>
3655 ; term : description
3656 * unordered
3657 </li></ul>
3658 !! html
3659 <ul><li>
3660 <dl><dt> term&#160;</dt>
3661 <dd> description</dd></dl>
3662 <ul><li> unordered</li></ul>
3663 </li></ul>
3664
3665 !! end
3666
3667 !! test
3668
3669 Definition list with empty definition and following paragraph
3670 !! wikitext
3671 ; term:
3672 Paragraph text
3673 !! html
3674 <dl><dt> term</dt>
3675 <dd></dd></dl>
3676 <p>Paragraph text
3677 </p>
3678 !! end
3679
3680 !! test
3681 Nested definition lists using html syntax
3682 !! wikitext
3683 <dl><dt>x</dt>
3684 <dd>a</dd>
3685 <dd>b</dd></dl>
3686
3687 !! end
3688
3689 !! test
3690 Definition Lists: No nesting: Multiple dd's
3691 !! wikitext
3692 ;x
3693 :a
3694 :b
3695 !! html
3696 <dl><dt>x</dt>
3697 <dd>a</dd>
3698 <dd>b</dd></dl>
3699
3700 !! end
3701
3702 !! test
3703 Definition Lists: Indentation: Regular
3704 !! wikitext
3705 :i1
3706 ::i2
3707 :::i3
3708 !! html
3709 <dl><dd>i1
3710 <dl><dd>i2
3711 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3712
3713 !! end
3714
3715 !! test
3716 Definition Lists: Indentation: Missing 1st level
3717 !! wikitext
3718 ::i2
3719 :::i3
3720 !! html
3721 <dl><dd><dl><dd>i2
3722 <dl><dd>i3</dd></dl></dd></dl></dd></dl>
3723
3724 !! end
3725
3726 !! test
3727 Definition Lists: Indentation: Multi-level indent
3728 !! wikitext
3729 :::i3
3730 !! html
3731 <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
3732
3733 !! end
3734
3735 !! test
3736 Definition Lists: Hacky use to indent tables
3737 !! wikitext
3738 ::{|
3739 |foo
3740 |bar
3741 |}
3742 this text
3743 should be left alone
3744 !! html
3745 <dl><dd><dl><dd><table>
3746 <tr>
3747 <td>foo
3748 </td>
3749 <td>bar
3750 </td></tr></table></dd></dl></dd></dl>
3751 <p>this text
3752 should be left alone
3753 </p>
3754 !! end
3755
3756 !! test
3757 Definition Lists: Hacky use to indent tables, with comments (bug 63979)
3758 !! wikitext
3759 <!-- foo -->
3760 ::{|
3761 |foo
3762 |bar
3763 |}<!-- bar -->
3764 this text
3765 should be left alone
3766 !! html/parsoid
3767 <!-- foo -->
3768 <dl><dd><dl><dd><table><tr>
3769 <td>foo</td>
3770 <td>bar</td>
3771 </tr></table><!-- bar --></dd></dl></dd></dl>
3772 <p>this text
3773 should be left alone</p>
3774 !! end
3775
3776 !! test
3777 Definition Lists: Hacky use to indent tables, with comment before table
3778 !! wikitext
3779 ::<!-- foo -->{|
3780 |foo
3781 |}
3782 !! html/parsoid
3783 <dl><dd><dl><dd><!-- foo --><table><tr>
3784 <td>foo</td>
3785 </tr></table></dd></dl></dd></dl>
3786 !! end
3787
3788 # The trailing whitespace in this test is to catch a regression in
3789 # Parsoid after T54473.
3790 !! test
3791 Definition Lists: Hacky use to indent tables (WS-insensitive)
3792 !! wikitext
3793 : {|
3794 |a
3795 |}
3796 !! html/php
3797 <dl><dd><table>
3798 <tr>
3799 <td>a
3800 </td></tr></table></dd></dl>
3801
3802 !! html/parsoid
3803 <dl><dd> <table>
3804 <tbody><tr><td>a</td></tr>
3805 </tbody></table> </dd></dl>
3806 !! end
3807
3808 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
3809 ## as an empty dt item. It also ignores all but the last ";" when followed
3810 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
3811 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
3812 ## ";"s.
3813 ##
3814 ## Ex: ";;t2 ::d2" is transformed into:
3815 ##
3816 ## <dl>
3817 ## <dt>t2 </dt>
3818 ## <dd>
3819 ## <dl>
3820 ## <dt></dt>
3821 ## <dd>d2</dd>
3822 ## </dl>
3823 ## </dd>
3824 ## </dl>
3825 ##
3826 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
3827 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
3828 ##
3829 ## <dl>
3830 ## <dt>
3831 ## <dl>
3832 ## <dt>t2 </dt>
3833 ## <dd>:d2</dd>
3834 ## </dl>
3835 ## </dt>
3836 ## </dl>
3837 ##
3838 ## All Parsoid only definition list tests have this difference.
3839 ##
3840 ## See also: https://phabricator.wikimedia.org/T8569
3841 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
3842
3843 !! test
3844 Table / list interaction: indented table with lists in table contents
3845 !! wikitext
3846 :{|
3847 |-
3848 | a
3849 * b
3850 |-
3851 | c
3852 * d
3853 |}
3854 !! html
3855 <dl><dd><table>
3856
3857 <tr>
3858 <td> a
3859 <ul><li> b</li></ul>
3860 </td></tr>
3861 <tr>
3862 <td> c
3863 <ul><li> d</li></ul>
3864 </td></tr></table></dd></dl>
3865
3866 !! end
3867
3868 !!test
3869 Table / list interaction: lists nested in tables nested in indented lists
3870 !! wikitext
3871 :{|
3872 |
3873 :a
3874 :b
3875 |
3876 *c
3877 *d
3878 |}
3879
3880 *e
3881 *f
3882 !! html
3883 <dl><dd><table>
3884 <tr>
3885 <td>
3886 <dl><dd>a</dd>
3887 <dd>b</dd></dl>
3888 </td>
3889 <td>
3890 <ul><li>c</li>
3891 <li>d</li></ul>
3892 </td></tr></table></dd></dl>
3893 <ul><li>e</li>
3894 <li>f</li></ul>
3895
3896 !!end
3897
3898 !! test
3899 Definition Lists: Nesting: Multi-level (Parsoid only)
3900 !! options
3901 parsoid
3902 !! wikitext
3903 ;t1 :d1
3904 ;;t2 ::d2
3905 ;;;t3 :::d3
3906 !! html
3907 <dl>
3908 <dt>t1 </dt>
3909 <dd>d1</dd>
3910 <dt>
3911 <dl>
3912 <dt>t2 </dt>
3913 <dd>:d2</dd>
3914 <dt>
3915 <dl>
3916 <dt>t3 </dt>
3917 <dd>::d3</dd>
3918 </dl>
3919 </dt>
3920 </dl>
3921 </dt>
3922 </dl>
3923
3924
3925 !! end
3926
3927
3928 !! test
3929 Definition Lists: Nesting: Test 2 (Parsoid only)
3930 !! wikitext
3931 ;t1
3932 ::d2
3933 !! html/php+tidy
3934 <dl>
3935 <dt>t1</dt>
3936 <dd>
3937 <dl>
3938 <dd>d2</dd>
3939 </dl>
3940 </dd>
3941 </dl>
3942 !! html/parsoid
3943 <dl>
3944 <dt>t1</dt>
3945 <dd>
3946 <dl>
3947 <dd>d2</dd>
3948 </dl>
3949 </dd>
3950 </dl>
3951
3952 !! end
3953
3954
3955 !! test
3956 Definition Lists: Nesting: Test 3 (Parsoid only)
3957 !! wikitext
3958 :;t1
3959 ::::d2
3960 !! html/php+tidy
3961 <dl>
3962 <dd>
3963 <dl>
3964 <dt>t1</dt>
3965 <dd>
3966 <dl>
3967 <dd>
3968 <dl>
3969 <dd>d2</dd>
3970 </dl>
3971 </dd>
3972 </dl>
3973 </dd>
3974 </dl>
3975 </dd>
3976 </dl>
3977 !! html/parsoid
3978 <dl>
3979 <dd>
3980 <dl>
3981 <dt>t1</dt>
3982 <dd>
3983 <dl>
3984 <dd>
3985 <dl>
3986 <dd>d2</dd>
3987 </dl>
3988 </dd>
3989 </dl>
3990 </dd>
3991 </dl>
3992 </dd>
3993 </dl>
3994
3995 !! end
3996
3997
3998 !! test
3999 Definition Lists: Nesting: Test 4
4000 !! wikitext
4001 ::;t3
4002 :::d3
4003 !! html
4004 <dl><dd><dl><dd><dl><dt>t3</dt>
4005 <dd>d3</dd></dl></dd></dl></dd></dl>
4006
4007 !! end
4008
4009
4010 ## The Parsoid team believes the following three test exposes a
4011 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
4012 ## wrong to close the <dl> after the <dt> containing the <ul>.)
4013 ## It also exposes a "misfeature" in tidy, which doesn't like
4014 ## <dl> tags with a single <dt> child; it converts the <dt> into
4015 ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
4016 !! test
4017 Definition Lists: Mixed Lists: Test 1
4018 !! wikitext
4019 :;* foo
4020 ::* bar
4021 :; baz
4022 !! html/php
4023 <dl><dd><dl><dt><ul><li> foo</li>
4024 <li> bar</li></ul></dt></dl>
4025 <dl><dt> baz</dt></dl></dd></dl>
4026
4027 !! html/php+tidy
4028 <dl>
4029 <dd>
4030 <dl>
4031 <dd>
4032 <ul>
4033 <li>foo</li>
4034 <li>bar</li>
4035 </ul>
4036 </dd>
4037 </dl>
4038 <dl>
4039 <dt>baz</dt>
4040 </dl>
4041 </dd>
4042 </dl>
4043 !! html/parsoid
4044 <dl>
4045 <dd><dl>
4046 <dt><ul>
4047 <li> foo
4048 </li>
4049 </ul></dt>
4050 <dd><ul>
4051 <li> bar
4052 </li>
4053 </ul></dd>
4054 <dt> baz</dt>
4055 </dl></dd>
4056 </dl>
4057 !! end
4058
4059 !! test
4060 Definition Lists: Mixed Lists: Test 2
4061 !! wikitext
4062 *: d1
4063 *: d2
4064 !! html
4065 <ul><li><dl><dd> d1</dd>
4066 <dd> d2</dd></dl></li></ul>
4067
4068 !! end
4069
4070
4071 !! test
4072 Definition Lists: Mixed Lists: Test 3
4073 !! wikitext
4074 *::: d1
4075 *::: d2
4076 !! html
4077 <ul><li><dl><dd><dl><dd><dl><dd> d1</dd>
4078 <dd> d2</dd></dl></dd></dl></dd></dl></li></ul>
4079
4080 !! end
4081
4082
4083 !! test
4084 Definition Lists: Mixed Lists: Test 4
4085 !! wikitext
4086 *;d1 :d2
4087 *;d3 :d4
4088 !! html
4089 <ul><li><dl><dt>d1&#160;</dt>
4090 <dd>d2</dd>
4091 <dt>d3&#160;</dt>
4092 <dd>d4</dd></dl></li></ul>
4093
4094 !! end
4095
4096
4097 !! test
4098 Definition Lists: Mixed Lists: Test 5
4099 !! wikitext
4100 *:d1
4101 *:: d2
4102 !! html
4103 <ul><li><dl><dd>d1
4104 <dl><dd> d2</dd></dl></dd></dl></li></ul>
4105
4106 !! end
4107
4108
4109 !! test
4110 Definition Lists: Mixed Lists: Test 6
4111 !! wikitext
4112 #*:d1
4113 #*::: d3
4114 !! html
4115 <ol><li><ul><li><dl><dd>d1
4116 <dl><dd><dl><dd> d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
4117
4118 !! end
4119
4120
4121 !! test
4122 Definition Lists: Mixed Lists: Test 7
4123 !! wikitext
4124 :* d1
4125 :* d2
4126 !! html
4127 <dl><dd><ul><li> d1</li>
4128 <li> d2</li></ul></dd></dl>
4129
4130 !! end
4131
4132
4133 !! test
4134 Definition Lists: Mixed Lists: Test 8
4135 !! wikitext
4136 :* d1
4137 ::* d2
4138 !! html
4139 <dl><dd><ul><li> d1</li></ul>
4140 <dl><dd><ul><li> d2</li></ul></dd></dl></dd></dl>
4141
4142 !! end
4143
4144
4145 !! test
4146 Definition Lists: Mixed Lists: Test 9
4147 !! wikitext
4148 *;foo :bar
4149 !! html
4150 <ul><li><dl><dt>foo&#160;</dt>
4151 <dd>bar</dd></dl></li></ul>
4152
4153 !! end
4154
4155
4156 !! test
4157 Definition Lists: Mixed Lists: Test 10
4158 !! wikitext
4159 *#;foo :bar
4160 !! html
4161 <ul><li><ol><li><dl><dt>foo&#160;</dt>
4162 <dd>bar</dd></dl></li></ol></li></ul>
4163
4164 !! end
4165
4166 # The Parsoid team disagrees with the PHP parser's seemingly-random
4167 # rules regarding dd/dt on the next two tests. Parsoid is more
4168 # consistent, and recognizes the shared nesting and keeps the
4169 # still-open tags around until the nesting is complete.
4170 # (And tidy again converts <dt> to <dd> before 'bar'.)
4171
4172 !! test
4173 Definition Lists: Mixed Lists: Test 11
4174 !! wikitext
4175 *#*#;*;;foo :bar
4176 *#*#;boo :baz
4177 !! html/php
4178 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
4179 <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
4180 <dl><dt>boo&#160;</dt>
4181 <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
4182
4183 !! html/php+tidy
4184 <ul>
4185 <li>
4186 <ol>
4187 <li>
4188 <ul>
4189 <li>
4190 <ol>
4191 <li>
4192 <dl>
4193 <dt>foo&#160;</dt>
4194 <dd>
4195 <ul>
4196 <li>
4197 <dl>
4198 <dd>
4199 <dl>
4200 <dt>bar</dt>
4201 </dl>
4202 </dd>
4203 </dl>
4204 </li>
4205 </ul>
4206 </dd>
4207 </dl>
4208 <dl>
4209 <dt>boo&#160;</dt>
4210 <dd>baz</dd>
4211 </dl>
4212 </li>
4213 </ol>
4214 </li>
4215 </ul>
4216 </li>
4217 </ol>
4218 </li>
4219 </ul>
4220 !! html/parsoid
4221 <ul>
4222 <li>
4223 <ol>
4224 <li>
4225 <ul>
4226 <li>
4227 <ol>
4228 <li>
4229 <dl>
4230 <dt>
4231 <ul>
4232 <li>
4233 <dl>
4234 <dt>
4235 <dl>
4236 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4237 <dd data-parsoid='{"stx":"row"}'>bar</dd>
4238 </dl></dt>
4239 </dl></li>
4240 </ul></dt>
4241 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
4242 <dd data-parsoid='{"stx":"row"}'>baz</dd>
4243 </dl></li>
4244 </ol></li>
4245 </ul></li>
4246 </ol></li>
4247 </ul>
4248 !! end
4249
4250
4251 # Another case where tidy converts a <dt> to a <dd> (but Parsoid doesn't).
4252 # From whitelist:
4253 # * The test is wrong, there are two colons where there should be :;
4254 # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
4255 !! test
4256 Definition Lists: Weird Ones: Test 1
4257 !! wikitext
4258 *#;*::;; foo : bar (who uses this?)
4259 !! html/php
4260 <ul><li><ol><li><dl><dt> foo&#160;</dt>
4261 <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>
4262
4263 !! html/php+tidy
4264 <ul>
4265 <li>
4266 <ol>
4267 <li>
4268 <dl>
4269 <dt>foo&#160;</dt>
4270 <dd>
4271 <ul>
4272 <li>
4273 <dl>
4274 <dd>
4275 <dl>
4276 <dd>
4277 <dl>
4278 <dd>
4279 <dl>
4280 <dt>bar (who uses this?)</dt>
4281 </dl>
4282 </dd>
4283 </dl>
4284 </dd>
4285 </dl>
4286 </dd>
4287 </dl>
4288 </li>
4289 </ul>
4290 </dd>
4291 </dl>
4292 </li>
4293 </ol>
4294 </li>
4295 </ul>
4296 !! html/parsoid
4297 <ul>
4298 <li>
4299 <ol>
4300 <li>
4301 <dl>
4302 <dt>
4303 <ul>
4304 <li>
4305 <dl>
4306 <dd>
4307 <dl>
4308 <dd>
4309 <dl>
4310 <dt>
4311 <dl>
4312 <dt> foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
4313 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd>
4314 </dl></dt>
4315 </dl></dd>
4316 </dl></dd>
4317 </dl></li>
4318 </ul></dt>
4319 </dl></li>
4320 </ol></li>
4321 </ul>
4322 !! end
4323
4324 !! test
4325 Definition Lists: colons occurring in tags
4326 !! wikitext
4327 ;a:b
4328 ;'''a:b'''
4329 ;<i>a:b</i>
4330 ;<span>a:b</span>
4331 ;<div>a:b</div>
4332 ;<div>a
4333 :b</div>
4334 ;{{echo|a:b}}
4335 ;{{echo|''a:b''}}
4336 ;;;''a:b''
4337 !! html+tidy
4338 <dl>
4339 <dt>a</dt>
4340 <dd>b</dd>
4341 <dt><b>a:b</b></dt>
4342 <dt><i>a:b</i></dt>
4343 <dt><span>a:b</span></dt>
4344 <dd>
4345 <div>a:b</div>
4346 </dd>
4347 <dd>
4348 <div>a
4349 <dl>
4350 <dd>b</dd>
4351 </dl>
4352 </div>
4353 </dd>
4354 <dt>a</dt>
4355 <dd>b</dd>
4356 <dt><i>a:b</i></dt>
4357 </dl>
4358 <dl>
4359 <dd>
4360 <dl>
4361 <dd>
4362 <dl>
4363 <dt><i>a:b</i></dt>
4364 </dl>
4365 </dd>
4366 </dl>
4367 </dd>
4368 </dl>
4369 !! html/parsoid
4370 <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
4371 <dt><b>a:b</b></dt>
4372 <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
4373 <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
4374 <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
4375 <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
4376 <dd>b</dd>
4377 <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>
4378 <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>
4379 <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
4380 !! end
4381
4382 !! test
4383 Definition Lists: colons and tables 1
4384 !! wikitext
4385 :{|
4386 | x
4387 |}
4388 :{|
4389 | y
4390 |}
4391 !! html
4392 <dl><dd><table>
4393 <tr>
4394 <td> x
4395 </td></tr></table></dd></dl>
4396 <dl><dd><table>
4397 <tr>
4398 <td> y
4399 </td></tr></table></dd></dl>
4400
4401 !! end
4402
4403 # Parsoid's output (as documented below) differs from php's in this case.
4404 # This is probably a bug. If we fixup parsoid to match php's output, the
4405 # above test should pass and the below test case can be removed. It is
4406 # unclear which output is more desirable.
4407
4408 !! test
4409 Definition Lists: colons and tables 2
4410 !! wikitext
4411 :{|
4412 | x
4413 |}
4414 :{|
4415 | y
4416 |}
4417 !! html/parsoid
4418 <dl><dd><table>
4419 <tr>
4420 <td> x
4421 </td></tr></table></dd>
4422 <dd><table>
4423 <tr>
4424 <td> y
4425 </td></tr></table></dd></dl>
4426 !! end
4427
4428 !! test
4429 Definition Lists: template interaction
4430 !! wikitext
4431 ::{{definition_list}}
4432
4433 :one
4434 ::{{definition_list}}
4435 :::two
4436 :::three
4437 ::four
4438 !! html/parsoid
4439 <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">
4440 </span><dd about="#mwt1">two</dd></dl></dd></dl>
4441
4442 <dl><dd data-parsoid='{}'>one
4443 <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">
4444 </span><dd about="#mwt2">two
4445 <dl><dd>two</dd>
4446 <dd>three</dd></dl></dd>
4447 <dd data-parsoid='{}'>four</dd></dl></dd></dl>
4448 !! end
4449
4450
4451 ###
4452 ### External links
4453 ###
4454 !! test
4455 External links: non-bracketed
4456 !! wikitext
4457 Non-bracketed: http://example.com
4458 !! html
4459 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4460 </p>
4461 !! end
4462
4463 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4464 !! test
4465 External links: numbered
4466 !! wikitext
4467 Numbered: [http://example.com]
4468 Numbered: [http://example.net]
4469 Numbered: [http://example.com]
4470 !! html/php
4471 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
4472 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
4473 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
4474 </p>
4475 !! html/parsoid
4476 <p>Numbered: <a rel="mw:ExtLink" href="http://example.com"></a>
4477 Numbered: <a rel="mw:ExtLink" href="http://example.net"></a>
4478 Numbered: <a rel="mw:ExtLink" href="http://example.com"></a></p>
4479 !!end
4480
4481 !! test
4482 External links: specified text
4483 !! wikitext
4484 Specified text: [http://example.com link]
4485 !! html
4486 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
4487 </p>
4488 !!end
4489
4490 !! test
4491 External links: trail
4492 !! wikitext
4493 Linktrails should not work for external links: [http://example.com link]s
4494 !! html
4495 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
4496 </p>
4497 !! end
4498
4499 !! test
4500 External links: dollar sign in URL
4501 !! wikitext
4502 http://example.com/1$2345
4503 !! html
4504 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
4505 </p>
4506 !! end
4507
4508 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4509 !! test
4510 External links: dollar sign in URL (autonumber)
4511 !! wikitext
4512 [http://example.com/1$2345]
4513 !! html/php
4514 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
4515 </p>
4516 !! html/parsoid
4517 <p><a rel="mw:ExtLink" href="http://example.com/1$2345"></a></p>
4518 !!end
4519
4520 !! test
4521 External links: open square bracket forbidden in URL (bug 4377)
4522 !! options
4523 parsoid=wt2html,wt2wt,html2html
4524 !! wikitext
4525 http://example.com/1[2345
4526 !! html/php
4527 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
4528 </p>
4529 !! html/parsoid
4530 <p><a rel="mw:ExtLink" href="http://example.com/1">http://example.com/1</a>[2345</p>
4531 !! end
4532
4533 !! test
4534 External links: open square bracket forbidden in URL (named) (bug 4377)
4535 !! options
4536 parsoid=wt2html,html2html
4537 !! wikitext
4538 [http://example.com/1[2345]
4539 !! html/php
4540 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4541 </p>
4542 !! html/parsoid
4543 <p><a rel="mw:ExtLink" href="http://example.com/1">[2345</a></p>
4544 !!end
4545
4546 # parsoid adds a space before the link name
4547 !! test
4548 External links: open square bracket forbidden in URL (named) (bug 4377)
4549 Parsoid variant.
4550 !! wikitext
4551 [http://example.com/1 [2345]
4552 !! html
4553 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
4554 </p>
4555 !!end
4556
4557 !! test
4558 External links: nowiki in URL link text (bug 6230)
4559 !! wikitext
4560 [http://example.com/ <nowiki>''example site''</nowiki>]
4561 !! html
4562 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
4563 </p>
4564 !! end
4565
4566 !! test
4567 External links: newline forbidden in text (bug 6230 regression check)
4568 !! wikitext
4569 [http://example.com/ first
4570 second]
4571 !! html
4572 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
4573 second]
4574 </p>
4575 !!end
4576
4577 !! test
4578 External links: Pipe char between url and text
4579 !! wikitext
4580 [http://example.com | link]
4581 !! html
4582 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
4583 </p>
4584 !!end
4585
4586 !! test
4587 External links: protocol-relative URL in brackets
4588 !! wikitext
4589 [//example.com/ Test]
4590 !! html
4591 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
4592 </p>
4593 !! end
4594
4595 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
4596 !! test
4597 External links: protocol-relative URL in brackets without text
4598 !! wikitext
4599 [//example.com]
4600 !! html/php
4601 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
4602 </p>
4603 !! html/parsoid
4604 <p><a rel="mw:ExtLink" href="//example.com"></a></p>
4605 !! end
4606
4607 !! test
4608 External links: protocol-relative URL in free text is left alone
4609 !! wikitext
4610 //example.com/Foo
4611 !! html
4612 <p>//example.com/Foo
4613 </p>
4614 !!end
4615
4616 !! test
4617 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
4618 !! wikitext
4619 foo//example.com/Foo
4620 !! html
4621 <p>foo//example.com/Foo
4622 </p>
4623 !! end
4624
4625 !! test
4626 External links: with no contents
4627 !! wikitext
4628 [http://en.wikipedia.org/wiki/Foo]
4629
4630 [[wikipedia:Foo|Bar]]
4631
4632 [[wikipedia:Foo|<span>Bar</span>]]
4633 !! html/php
4634 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
4635 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
4636 </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
4637 </p>
4638 !! html/parsoid
4639 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo"></a></p>
4640 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
4641 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
4642 !! end
4643
4644 !! test
4645 External links: Free with trailing punctuation
4646 !! wikitext
4647 http://example.com,
4648 http://example.com;
4649 http://example.com\
4650 http://example.com.
4651 http://example.com:
4652 http://example.com!
4653 http://example.com?
4654 http://example.com)
4655 http://example.com/url_with_(brackets)
4656 (http://example.com/url_without_brackets)
4657 http://example.com/url_with_entity&amp;
4658 http://example.com/url_with_entity&#x26;
4659 http://example.com/url_with_entity&#038;
4660 http://example.com/url_with_entity&nbsp;
4661 http://example.com/url_with_entity&#xA0;
4662 http://example.com/url_with_entity&#160;
4663 http://example.com/url_with_entity&lt;
4664 http://example.com/url_with_entity&#x3C;
4665 http://example.com/url_with_entity&#60;
4666 !! html/php
4667 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
4668 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
4669 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
4670 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
4671 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
4672 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
4673 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
4674 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
4675 <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4676 (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4677 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4678 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4679 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4680 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4681 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
4682 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
4683 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
4684 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
4685 <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
4686 </p>
4687 !! html/parsoid
4688 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>,
4689 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>;
4690 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>\
4691 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>.
4692 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:
4693 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>!
4694 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>?
4695 <a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)
4696 <a rel="mw:ExtLink" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
4697 (<a rel="mw:ExtLink" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
4698 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4699 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4700 <a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
4701 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>
4702 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>
4703 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>
4704 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>
4705 <a rel="mw:ExtLink" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x3C;","srcContent":"&lt;"}'>&lt;</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;#60;","srcContent":"&lt;"}'>&lt;</span></p>
4707 !! end
4708
4709 !! test
4710 External links: tricky Parsoid html2html case
4711 !! options
4712 parsoid=wt2html,wt2wt,html2html
4713 !! wikitext
4714 http://example.com/url_with_entity&amp;amp;
4715 !! html/php
4716 <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>;
4717 </p>
4718 !! html/parsoid
4719 <p><a rel="mw:ExtLink" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
4720 !! end
4721
4722 !! test
4723 External links: Free with trailing quotes (T113666)
4724 !! wikitext
4725 '''News:''' Stuff here
4726
4727 news:'a'b''c''d e
4728 !! html/php
4729 <p><b>News:</b> Stuff here
4730 </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
4731 </p>
4732 !! html/parsoid
4733 <p><b>News:</b> Stuff here</p>
4734 <p><a rel="mw:ExtLink" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
4735 !! end
4736
4737 !! test
4738 External links: Lone protocols are never linked (T105697)
4739 !! wikitext
4740 http://
4741 http://;
4742 (http://)
4743 bitcoin:
4744 bitcoin:;
4745 (bitcoin:)
4746 !! html
4747 <p>http://
4748 http://;
4749 (http://)
4750 bitcoin:
4751 bitcoin:;
4752 (bitcoin:)
4753 </p>
4754 !! end
4755
4756 !! test
4757 External links: No preceding word characters allowed (bug 65278)
4758 !! wikitext
4759 NOPEhttp://example.com
4760 N0http://example.com
4761 ok:http://example.com
4762 ok-http://example.com
4763 !! html
4764 <p>NOPEhttp://example.com
4765 N0http://example.com
4766 ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4767 ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4768 </p>
4769 !! end
4770
4771 !! test
4772 External image
4773 !! wikitext
4774 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4775 !! html
4776 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4777 </p>
4778 !! end
4779
4780 !! test
4781 External image from https
4782 !! wikitext
4783 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4784 !! html
4785 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
4786 </p>
4787 !! end
4788
4789 !! test
4790 External image (when not allowed)
4791 !! options
4792 wgAllowExternalImages=0
4793 !! wikitext
4794 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
4795 !! html
4796 <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>
4797 </p>
4798 !! end
4799
4800 !! test
4801 Link to non-http image, no img tag
4802 !! wikitext
4803 Link to non-http image, no img tag: ftp://example.com/test.jpg
4804 !! html
4805 <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>
4806 </p>
4807 !! end
4808
4809 !! test
4810 External links: terminating separator
4811 !! wikitext
4812 Terminating separator: http://example.com/thing,
4813 !! html
4814 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
4815 </p>
4816 !! end
4817
4818 !! test
4819 External links: intervening separator
4820 !! wikitext
4821 Intervening separator: http://example.com/1,2,3
4822 !! html
4823 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
4824 </p>
4825 !! end
4826
4827 !! test
4828 External links: old bug with URL in query
4829 !! wikitext
4830 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
4831 !! html
4832 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
4833 </p>
4834 !! end
4835
4836 !! test
4837 External links: old URL-in-URL bug, mixed protocols
4838 !! wikitext
4839 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
4840 !! html
4841 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
4842 </p>
4843 !!end
4844
4845 !! test
4846 External links: URL in text
4847 !! wikitext
4848 URL in text: [http://example.com http://example.com]
4849 !! html
4850 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
4851 </p>
4852 !! end
4853
4854 !! test
4855 External links: Clickable images
4856 !! wikitext
4857 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
4858 !! html/php
4859 <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>
4860 </p>
4861 !! html/parsoid
4862 <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>
4863 !! end
4864
4865 !! test
4866 External links: raw ampersand
4867 !! wikitext
4868 Old &amp; use: http://x&y
4869 !! html
4870 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4871 </p>
4872 !! end
4873
4874 !! test
4875 External links: encoded ampersand
4876 !! wikitext
4877 Old &amp; use: http://x&amp;y
4878 !! html/php
4879 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
4880 </p>
4881 !! html/parsoid
4882 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y">http://x&amp;y</a></p>
4883 !! end
4884
4885 !! test
4886 External links: encoded equals (bug 6102)
4887 !! wikitext
4888 http://example.com/?foo&#61;bar
4889 !! html/php
4890 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
4891 </p>
4892 !! html/parsoid
4893 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
4894 !! end
4895
4896 ##
4897 ## Note that parsoid doesn't explicit mark autonumbered links, nor
4898 ## does it number them. As discussed in bug 53505, we can identify
4899 ## autonumbered links via CSS.
4900 ##
4901
4902 !! test
4903 External links: [raw ampersand]
4904 !! wikitext
4905 Old &amp; use: [http://x&y]
4906 !! html/php
4907 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4908 </p>
4909 !! html/parsoid
4910 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4911 !! end
4912
4913 # note that parsoid html is identical to [raw ampersand] case; so html2wt
4914 # mode will return the [raw ampersand] wikitext
4915 !! test
4916 External links: [encoded ampersand]
4917 !! options
4918 parsoid=wt2html,wt2wt,html2html
4919 !! wikitext
4920 Old &amp; use: [http://x&amp;y]
4921 !! html/php
4922 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
4923 </p>
4924 !! html/parsoid
4925 <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" href="http://x&amp;y"></a></p>
4926 !! end
4927
4928 !! test
4929 External links: [raw equals]
4930 !! wikitext
4931 [http://example.com/?foo=bar]
4932 !! html/php
4933 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4934 </p>
4935 !! html/parsoid
4936 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4937 !! end
4938
4939 # note that parsoid html is identical to [raw equals] case; so html2wt
4940 # mode will return the [raw equals] wikitext
4941 !! test
4942 External links: [encoded equals] (bug 6102)
4943 !! options
4944 parsoid=wt2html,wt2wt,html2html
4945 !! wikitext
4946 [http://example.com/?foo&#61;bar]
4947 !! html/php
4948 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
4949 </p>
4950 !! html/parsoid
4951 <p><a rel="mw:ExtLink" href="http://example.com/?foo=bar"></a></p>
4952 !! end
4953
4954 # xxx parsoid strips the IDN character, so the round-trip tests will
4955 # obviously fail and are disabled. --cscott
4956 !! test
4957 External links: [IDN ignored character reference in hostname; strip it right off]
4958 !! options
4959 parsoid=wt2html,wt2wt,html2html
4960 !! wikitext
4961 [http://e&zwnj;xample.com/]
4962 !! html/php
4963 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
4964 </p>
4965 !! html/parsoid
4966 <p><a rel="mw:ExtLink" href="http://example.com/"></a></p>
4967 !! end
4968
4969 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
4970 # Where an external link could easily circumvent the sanitization of the text of
4971 # a link like this (where an IDN-ignore character is in the URL somewhere), this
4972 # test demands a higher standard. That's a bit strange.
4973 #
4974 # Example:
4975 #
4976 # http://e‌xample.com -> [http://example.com|http://example.com]
4977 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
4978 #
4979 # The first example is sanitized, but the second is not. Any security benefits
4980 # from this production are trivial to circumvent. Either remove this test and
4981 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
4982 # the test accordingly.
4983 #
4984 # All our love,
4985 # The Parsoid team.
4986 # xxx parsoid strips the IDN character, so the round-trip tests will
4987 # obviously fail and are disabled. --cscott
4988 !! test
4989 External links: IDN ignored character reference in hostname; strip it right off
4990 !! options
4991 parsoid=wt2html,html2html
4992 !! wikitext
4993 http://e&zwnj;xample.com/
4994 !! html/php
4995 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
4996 </p>
4997 !! html/parsoid
4998 <p><a rel="mw:ExtLink" href="http://example.com/">http://example.com/</a></p>
4999 !! end
5000
5001 !! test
5002 External links: www.jpeg.org (bug 554)
5003 !! wikitext
5004 http://www.jpeg.org
5005 !! html
5006 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
5007 </p>
5008 !! end
5009
5010 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
5011 !! test
5012 External links: URL within URL (original bug 2)
5013 !! wikitext
5014 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
5015 !! html/php
5016 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
5017 </p>
5018 !! html/parsoid
5019 <p><a rel="mw:ExtLink" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
5020 !! end
5021
5022 !! test
5023 BUG 361: URL inside bracketed URL
5024 !! wikitext
5025 [http://www.example.com/foo http://www.example.com/bar]
5026 !! html
5027 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
5028 </p>
5029 !! end
5030
5031 !! test
5032 BUG 361: URL within URL, not bracketed
5033 !! wikitext
5034 http://www.example.com/foo?=http://www.example.com/bar
5035 !! html
5036 <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>
5037 </p>
5038 !! end
5039
5040 !! test
5041 BUG 289: ">"-token in URL-tail
5042 !! wikitext
5043 http://www.example.com/<hello>
5044 !! html
5045 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
5046 </p>
5047 !!end
5048
5049 !! test
5050 BUG 289: literal ">"-token in URL-tail
5051 !! wikitext
5052 http://www.example.com/<b>html</b>
5053 !! html/php
5054 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
5055 </p>
5056 !! html/parsoid
5057 <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>
5058 !! end
5059
5060 !! test
5061 BUG 289: ">"-token in bracketed URL
5062 !! wikitext
5063 [http://www.example.com/<hello> stuff]
5064 !! html
5065 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
5066 </p>
5067 !!end
5068
5069 !! test
5070 BUG 289: literal ">"-token in bracketed URL
5071 !! wikitext
5072 [http://www.example.com/<b>html</b> stuff]
5073 !! html
5074 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
5075 </p>
5076 !!end
5077
5078 !! test
5079 BUG 289: literal double quote at end of URL
5080 !! wikitext
5081 http://www.example.com/"hello"
5082 !! html
5083 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
5084 </p>
5085 !!end
5086
5087 !! test
5088 BUG 289: literal double quote in bracketed URL
5089 !! wikitext
5090 [http://www.example.com/"hello" stuff]
5091 !! html
5092 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
5093 </p>
5094 !!end
5095
5096 !! test
5097 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
5098 !! wikitext
5099 [http://www.example.com test]
5100 !! html
5101 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
5102 </p>
5103 !! end
5104
5105 !! test
5106 External links: link text with spaces
5107 !! wikitext
5108 [http://www.example.com a b c]
5109 [http://www.example.com ''a'' ''b'']
5110 !! html
5111 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
5112 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
5113 </p>
5114 !! end
5115
5116 !! test
5117 External links: wiki links within external link (Bug 3695)
5118 !! options
5119 parsoid=wt2html,html2html
5120 !! wikitext
5121 [http://example.com [[wikilink]] embedded in ext link]
5122 !! html/php
5123 <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>
5124 </p>
5125 !! html/parsoid
5126 <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>
5127 !! end
5128
5129 !! test
5130 BUG 787: Links with one slash after the url protocol are invalid
5131 !! wikitext
5132 http:/example.com
5133
5134 [http:/example.com title]
5135 !! html
5136 <p>http:/example.com
5137 </p><p>[http:/example.com title]
5138 </p>
5139 !! end
5140
5141 !! test
5142 Bracketed external links with template-generated invalid target
5143 !! wikitext
5144 [{{echo|http:/example.com}} title]
5145 !! html
5146 <p>[http:/example.com title]
5147 </p>
5148 !! end
5149
5150 !! test
5151 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
5152 !! wikitext
5153 ''[http://example.com text'']
5154 [http://example.com '''text]'''
5155 ''Something [http://example.com in italic'']
5156 ''Something [http://example.com mixed''''', even bold]'''
5157 '''''Now [http://example.com both''''']
5158 !! html
5159 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
5160 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
5161 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
5162 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
5163 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
5164 </p>
5165 !! end
5166
5167
5168 !! test
5169 Bug 4781: %26 in URL
5170 !! wikitext
5171 http://www.example.com/?title=AT%26T
5172 !! html/php
5173 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
5174 </p>
5175 !! html/parsoid
5176 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
5177 !! end
5178
5179 # According to http://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
5180 # % is actually legal in HTML5. Any change in output would need testing though.
5181 !! test
5182 Bug 4781, 5267: %25 in URL
5183 !! wikitext
5184 http://www.example.com/?title=100%25_Bran
5185 !! html/php
5186 <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>
5187 </p>
5188 !! html/parsoid
5189 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
5190 !! end
5191
5192 !! test
5193 Bug 4781, 5267: %28, %29 in URL
5194 !! wikitext
5195 http://www.example.com/?title=Ben-Hur_%281959_film%29
5196 !! html/php
5197 <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>
5198 </p>
5199 !! html/parsoid
5200 <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>
5201 !! end
5202
5203
5204 !! test
5205 Bug 4781: %26 in autonumber URL
5206 !! wikitext
5207 [http://www.example.com/?title=AT%26T]
5208 !! html/php
5209 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
5210 </p>
5211 !! html/parsoid
5212 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T"></a></p>
5213 !! end
5214
5215 !! test
5216 Bug 4781, 5267: %26 in autonumber URL
5217 !! wikitext
5218 [http://www.example.com/?title=100%25_Bran]
5219 !! html/php
5220 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
5221 </p>
5222 !! html/parsoid
5223 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=100%25_Bran"></a></p>
5224 !! end
5225
5226 !! test
5227 Bug 4781, 5267: %28, %29 in autonumber URL
5228 !! wikitext
5229 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
5230 !! html/php
5231 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
5232 </p>
5233 !! html/parsoid
5234 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
5235 !! end
5236
5237
5238 !! test
5239 Bug 4781: %26 in bracketed URL
5240 !! wikitext
5241 [http://www.example.com/?title=AT%26T link]
5242 !! html/php
5243 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
5244 </p>
5245 !! html/parsoid
5246 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=AT%26T">link</a></p>
5247 !! end
5248
5249 !! test
5250 Bug 4781, 5267: %25 in bracketed URL
5251 !! wikitext
5252 [http://www.example.com/?title=100%25_Bran link]
5253 !! html
5254 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
5255 </p>
5256 !! end
5257
5258 !! test
5259 Bug 4781, 5267: %28, %29 in bracketed URL
5260 !! wikitext
5261 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
5262 !! html/php
5263 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
5264 </p>
5265 !! html/parsoid
5266 <p><a rel="mw:ExtLink" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
5267 !! end
5268
5269 !! test
5270 External link containing a period in the anchor. (bug 63947)
5271 !! wikitext
5272 [//foo.org/bar#baz. bang]
5273
5274 [//foo.org/bar. bang]
5275 !! html/php
5276 <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
5277 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
5278 </p>
5279 !! html/parsoid
5280 <p><a rel="mw:ExtLink" href="//foo.org/bar#baz.">bang</a></p>
5281 <p><a rel="mw:ExtLink" href="//foo.org/bar.">bang</a></p>
5282 !! end
5283
5284 !! test
5285 External link containing a single quote. (bug 63947)
5286 !! wikitext
5287 [//foo.org/bar'baz]
5288
5289 [//foo.org/bar'baz bang]
5290 !! html/php
5291 <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
5292 </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
5293 </p>
5294 !! html/parsoid
5295 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz"></a></p>
5296 <p><a rel="mw:ExtLink" href="//foo.org/bar'baz">bang</a></p>
5297 !! end
5298
5299 !! test
5300 External link containing double-single-quotes in text '' (bug 4598 sanity check)
5301 !! wikitext
5302 Some [http://example.com/ pretty ''italics'' and stuff]!
5303 !! html
5304 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
5305 </p>
5306 !! end
5307
5308 !! test
5309 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
5310 !! wikitext
5311 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
5312 !! html
5313 <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>
5314 </p>
5315 !! end
5316
5317 !! test
5318 External link containing double-single-quotes with no space separating the url from text in italics
5319 !! wikitext
5320 [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]].]
5321 !! html/php
5322 <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>
5323 </p>
5324 !! html/php+tidy
5325 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de</a> <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>
5326 !! html/parsoid
5327 <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>
5328 !! end
5329
5330 !! test
5331 External link with comments in link text
5332 !! wikitext
5333 [http://www.google.com Google <!-- comment -->]
5334 !! html/php
5335 <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
5336 </p>
5337 !! html/parsoid
5338 <p><a rel="mw:ExtLink" href="http://www.google.com">Google <!-- comment --></a></p>
5339 !! end
5340
5341 !! test
5342 External link to bare IPv4 address
5343 !! wikitext
5344 [http://192.168.0.1 Link]
5345 !! html/php
5346 <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
5347 </p>
5348 !! html/parsoid
5349 <p><a rel="mw:ExtLink" href="http://192.168.0.1">Link</a></p>
5350 !! end
5351
5352 !! test
5353 URL-encoding in URL functions (single parameter)
5354 !! wikitext
5355 {{localurl:Some page|amp=&}}
5356 !! html
5357 <p>/index.php?title=Some_page&amp;amp=&amp;
5358 </p>
5359 !! end
5360
5361 !! test
5362 URL-encoding in URL functions (multiple parameters)
5363 !! wikitext
5364 {{localurl:Some page|q=?&amp=&}}
5365 !! html
5366 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
5367 </p>
5368 !! end
5369
5370 !! test
5371 Brackets in urls
5372 !! wikitext
5373 http://example.com/index.php?foozoid%5B%5D=bar
5374
5375 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
5376 !! html/php
5377 <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
5378 </p><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>
5379 </p>
5380 !! html/parsoid
5381 <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>
5382
5383 <p><a rel="mw:ExtLink" href="http://example.com/index.php?foozoid[]=bar">http://example.com/index.php?foozoid[]=bar</a></p>
5384 !! end
5385
5386 !! test
5387 IPv6 urls, autolink format (T23261)
5388 !! wikitext
5389 http://[2404:130:0:1000::187:2]/index.php
5390
5391 Examples from RFC 2373, section 2.2:
5392 * http://[1080::8:800:200C:417A]/unicast
5393 * http://[FF01::101]/multicast
5394 * http://[::1]/loopback
5395 * http://[::]/unspecified
5396 * http://[::13.1.68.3]/ipv4compat
5397 * http://[::FFFF:129.144.52.38]/ipv4compat
5398
5399 Examples from RFC 2732, section 2:
5400 * http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
5401 * http://[1080:0:0:0:8:800:200C:417A]/index.html
5402 * http://[3ffe:2a00:100:7031::1]
5403 * http://[1080::8:800:200C:417A]/foo
5404 * http://[::192.9.5.5]/ipng
5405 * http://[::FFFF:129.144.52.38]:80/index.html
5406 * http://[2010:836B:4179::836B:4179]
5407
5408 !! html/php
5409 <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>
5410 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5411 </p>
5412 <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>
5413 <li> <a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5414 <li> <a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5415 <li> <a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5416 <li> <a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5417 <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>
5418 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5419 </p>
5420 <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>
5421 <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>
5422 <li> <a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5423 <li> <a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5424 <li> <a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5425 <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>
5426 <li> <a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5427
5428 !! html/parsoid
5429 <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>
5430
5431 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5432 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
5433 <li> <a rel="mw:ExtLink" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
5434 <li> <a rel="mw:ExtLink" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
5435 <li> <a rel="mw:ExtLink" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
5436 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
5437 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
5438
5439 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5440 <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>
5441 <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>
5442 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
5443 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
5444 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
5445 <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>
5446 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
5447 !! end
5448
5449 !! test
5450 IPv6 urls, bracketed format (T23261)
5451 !! wikitext
5452 [http://[2404:130:0:1000::187:2]/index.php test]
5453
5454 Examples from RFC 2373, section 2.2:
5455 * [http://[1080::8:800:200C:417A] unicast]
5456 * [http://[FF01::101] multicast]
5457 * [http://[::1]/ loopback]
5458 * [http://[::] unspecified]
5459 * [http://[::13.1.68.3] ipv4compat]
5460 * [http://[::FFFF:129.144.52.38] ipv4compat]
5461
5462 Examples from RFC 2732, section 2:
5463 * [http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
5464 * [http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
5465 * [http://[3ffe:2a00:100:7031::1] 3]
5466 * [http://[1080::8:800:200C:417A]/foo 4]
5467 * [http://[::192.9.5.5]/ipng 5]
5468 * [http://[::FFFF:129.144.52.38]:80/index.html 6]
5469 * [http://[2010:836B:4179::836B:4179] 7]
5470
5471 !! html/php
5472 <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
5473 </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
5474 </p>
5475 <ul><li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5476 <li> <a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
5477 <li> <a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
5478 <li> <a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
5479 <li> <a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
5480 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5481 <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
5482 </p>
5483 <ul><li> <a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5484 <li> <a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5485 <li> <a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5486 <li> <a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5487 <li> <a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
5488 <li> <a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5489 <li> <a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5490
5491 !! html/parsoid
5492 <p><a rel="mw:ExtLink" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
5493
5494 <p>Examples from <a href="//tools.ietf.org/html/rfc2373" rel="mw:ExtLink">RFC 2373</a>, section 2.2:</p>
5495 <ul><li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]">unicast</a></li>
5496 <li> <a rel="mw:ExtLink" href="http://[FF01::101]">multicast</a></li>
5497 <li> <a rel="mw:ExtLink" href="http://[::1]/">loopback</a></li>
5498 <li> <a rel="mw:ExtLink" href="http://[::]">unspecified</a></li>
5499 <li> <a rel="mw:ExtLink" href="http://[::13.1.68.3]">ipv4compat</a></li>
5500 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
5501
5502 <p>Examples from <a href="//tools.ietf.org/html/rfc2732" rel="mw:ExtLink">RFC 2732</a>, section 2:</p>
5503 <ul><li> <a rel="mw:ExtLink" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
5504 <li> <a rel="mw:ExtLink" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
5505 <li> <a rel="mw:ExtLink" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
5506 <li> <a rel="mw:ExtLink" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
5507 <li> <a rel="mw:ExtLink" href="http://[::192.9.5.5]/ipng">5</a></li>
5508 <li> <a rel="mw:ExtLink" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
5509 <li> <a rel="mw:ExtLink" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
5510 !! end
5511
5512 !! test
5513 Non-extlinks in brackets
5514 !! wikitext
5515 [foo]
5516 [foo bar]
5517 [foo ''bar'']
5518 [fool's] errand
5519 [fool's errand]
5520 [{{echo|foo}}]
5521 [{{echo|foo}} bar]
5522 [{{echo|foo}} ''bar'']
5523 [{{echo|foo}}l's] errand
5524 [{{echo|foo}}l's errand]
5525 [url={{echo|foo}}]
5526 [url=http://example.com]
5527 [http:// bare protocols don't count]
5528 !! html/php
5529 <p>[foo]
5530 [foo bar]
5531 [foo <i>bar</i>]
5532 [fool's] errand
5533 [fool's errand]
5534 [foo]
5535 [foo bar]
5536 [foo <i>bar</i>]
5537 [fool's] errand
5538 [fool's errand]
5539 [url=foo]
5540 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
5541 [http:// bare protocols don't count]
5542 </p>
5543 !! html/parsoid
5544 <p>[foo]
5545 [foo bar]
5546 [foo <i>bar</i>]
5547 [fool's] errand
5548 [fool's errand]
5549 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span>]
5550 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> bar]
5551 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}"}'>foo</span> <i>bar</i>]
5552 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span>] errand
5553 [<span typeof="mw:Placeholder" data-parsoid='{"src":"{{echo|foo}}l&#39;s"}'>fool's</span> errand]
5554 [<span typeof="mw:Placeholder" data-parsoid='{"src":"url={{echo|foo}}"}'>url=foo</span>]
5555 [url=<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>]
5556 [http:// bare protocols don't count]</p>
5557 !! end
5558
5559 !! test
5560 Percent encoding in external links
5561 !! wikitext
5562 [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
5563 !! html/php
5564 <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
5565 </p>
5566 !! html/parsoid
5567 <p><a rel="mw:ExtLink"
5568 href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
5569 !! end
5570
5571 !! test
5572 Use url link syntax for links where the content is equal the link target
5573 !! wikitext
5574 http://example.com
5575 !! html/php
5576 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
5577 </p>
5578 !! html/parsoid
5579 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a></p>
5580 !! end
5581
5582 !! test
5583 Parenthesis in external links, especially URL links
5584 !! wikitext
5585 http://example.com)
5586
5587 http://example.com/test)
5588
5589 http://example.com/(test)
5590
5591 http://example.com/((test)
5592
5593 (http://example.com/(test))
5594
5595 (http://example.com/(test)))))
5596
5597 http://example.com/a)b
5598
5599 [http://example.com) foo]
5600 !! html/php
5601 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5602 </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
5603 </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
5604 </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
5605 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
5606 </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
5607 </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
5608 </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
5609 </p>
5610 !! html/parsoid
5611 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a>)</p>
5612 <p><a rel="mw:ExtLink" href="http://example.com/test">http://example.com/test</a>)</p>
5613 <p><a rel="mw:ExtLink" href="http://example.com/(test)">http://example.com/(test)</a></p>
5614 <p><a rel="mw:ExtLink" href="http://example.com/((test)">http://example.com/((test)</a></p>
5615 <p>(<a rel="mw:ExtLink" href="http://example.com/(test))">http://example.com/(test))</a></p>
5616 <p>(<a rel="mw:ExtLink" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
5617 <p><a rel="mw:ExtLink" href="http://example.com/a)b">http://example.com/a)b</a></p>
5618 <p><a rel="mw:ExtLink" href="http://example.com)">foo</a></p>
5619 !! end
5620
5621 !! test
5622 Parenthesis in external links, w/ transclusion or comment
5623 !! wikitext
5624 (http://example.com/{{echo|hi}})
5625
5626 (http://example.com<!-- hi -->)
5627 !! html/php
5628 <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
5629 </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
5630 </p>
5631 !! html/parsoid
5632 <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>
5633
5634 <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>
5635 !! end
5636
5637 !! test
5638 Serialize <a> tags with invalid link targets as plain text
5639 !! options
5640 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
5641 !! html/parsoid
5642 <a rel="mw:WikiLink" href="[[foo]]">text</a>
5643 <a rel="mw:WikiLink" href="[[foo]]">*text</a>
5644 <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
5645 <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
5646 !! wikitext
5647 text
5648 <nowiki>*</nowiki>text
5649 <nowiki>[[foo]]</nowiki>
5650 <nowiki>*a [[foo]]</nowiki>
5651 !! end
5652
5653 !! test
5654 mw:ExtLink -vs- mw:WikiLink (T94723)
5655 !! options
5656 parsoid=html2wt
5657 !! html/parsoid
5658 <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>
5659 <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
5660 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5661 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
5662 <p>
5663 <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5664 <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
5665 </p>
5666 !! wikitext
5667 [[Foo|Bar]]
5668 [[Foo|Bar]]
5669 [[wikipedia:Foo|Bar]]
5670 [[wikipedia:Foo|Bar]]
5671
5672 [[wikipedia:European_Robin|European Robin]]
5673 [[wikipedia:European_Robin|European Robin]]
5674 !! end
5675
5676 !! test
5677 mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
5678 !! options
5679 parsoid=wt2wt
5680 !! wikitext
5681 [http://en.wikipedia.org/wiki/European_Robin European Robin]
5682 !! html/parsoid
5683 THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
5684 !! end
5685
5686
5687 ###
5688 ### Quotes
5689 ###
5690
5691 !! test
5692 Quotes
5693 !! wikitext
5694 Normal text. '''Bold text.''' Normal text. ''Italic text.''
5695
5696 Normal text. '''''Bold italic text.''''' Normal text.
5697 !! html
5698 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
5699 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
5700 </p>
5701 !! end
5702
5703
5704 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
5705 # parser strips. The wikitext contains just the first half of the bold
5706 # quote pair.
5707 !! test
5708 Unclosed and unmatched quotes
5709 !! wikitext
5710 '''''Bold italic text '''with bold deactivated''' in between.'''''
5711
5712 '''''Bold italic text ''with italic deactivated'' in between.'''''
5713
5714 '''Bold text..
5715
5716 ..spanning two paragraphs (should not work).'''
5717
5718 '''Bold tag left open
5719
5720 ''Italic tag left open
5721
5722 Normal text.
5723
5724 <!-- Unmatching number of opening, closing tags: -->
5725 '''This year''''s election ''should'' beat '''last year''''s.
5726
5727 ''Tom'''s car is bigger than ''Susan'''s.
5728
5729 Plain ''italic'''s plain
5730 !! html/php
5731 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5732 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5733 </p><p><b>Bold text..</b>
5734 </p><p>..spanning two paragraphs (should not work).
5735 </p><p><b>Bold tag left open</b>
5736 </p><p><i>Italic tag left open</i>
5737 </p><p>Normal text.
5738 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5739 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5740 </p><p>Plain <i>italic'</i>s plain
5741 </p>
5742 !! html/parsoid
5743 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
5744 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
5745 </p><p><b>Bold text..</b>
5746 </p><p>..spanning two paragraphs (should not work).<b></b>
5747 </p><p><b>Bold tag left open</b>
5748 </p><p><i>Italic tag left open</i>
5749 </p><p>Normal text.
5750 </p>
5751 <!-- Unmatching number of opening, closing tags: -->
5752 <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
5753 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
5754 </p><p>Plain <i>italic'</i>s plain
5755 </p>
5756 !! end
5757
5758 ###
5759 ### Tables
5760 ###
5761 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
5762 ###
5763
5764 # This should not produce <table></table> as <table><tr><td></td></tr></table>
5765 # is the bare minimum required by the spec, see:
5766 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
5767 # Parsoid team replies: empty table tags are legal in HTML5
5768 !! test
5769 A table with no data.
5770 !! options
5771 parsoid=wt2html
5772 !! wikitext
5773 {||}
5774 !! html/php
5775
5776 !! html/parsoid
5777 <table></table>
5778
5779 !! end
5780
5781 !! test
5782 A table with stray table end tags on start tag line (wt2html)
5783 !! options
5784 parsoid=wt2html
5785 !! wikitext
5786 {|style="color: red;"|}
5787
5788 {|style="color: red;" |}
5789 |foo
5790 |}
5791
5792 {|style="color: red;"|} id="foo"
5793 |foo
5794 |}
5795
5796 {|style="color: red;" |} id="foo"
5797 |foo
5798 |}
5799 !! html
5800 <table style="color: red;"></table>
5801
5802 <table style="color: red;">
5803 <tbody><tr>
5804 <td>foo</td>
5805 </tr></tbody>
5806 </table>
5807
5808 <table style="color: red;" id="foo">
5809 <tbody><tr>
5810 <td>foo</td>
5811 </tr></tbody>
5812 </table>
5813
5814 <table style="color: red;" id="foo">
5815 <tbody><tr>
5816 <td>foo</td>
5817 </tr></tbody>
5818 </table>
5819
5820 !! end
5821
5822 !! test
5823 A table with no data (take 2)
5824 !! wikitext
5825 {|
5826 |}
5827 !! html/parsoid
5828 <table></table>
5829 !! end
5830
5831 # A table with nothing but a caption is invalid XHTML, we might want to render
5832 # this as <p>caption</p>
5833 # Parsoid team replies: table with only a caption is legal in HTML5
5834 !! test
5835 A table with nothing but a caption
5836 !! wikitext
5837 {|
5838 |+ caption
5839 |}
5840 !! html/php
5841 <table>
5842 <caption> caption
5843 </caption><tr><td></td></tr></table>
5844
5845 !! html/parsoid
5846 <table><caption> caption</caption></table>
5847 !! end
5848
5849 !! test
5850 A table with caption with default-spaced attributes and a table row
5851 !! wikitext
5852 {|
5853 |+ style="color: red;" | caption1
5854 |-
5855 | foo
5856 |}
5857 !! html
5858 <table>
5859 <caption style="color: red;"> caption1
5860 </caption>
5861 <tr>
5862 <td> foo
5863 </td></tr></table>
5864
5865 !! end
5866
5867 !! test
5868 A table with captions with non-default spaced attributes and a table row
5869 !! wikitext
5870 {|
5871 |+style="color: red;"|caption2
5872 |+ style="color: red;"| caption3
5873 |-
5874 | foo
5875 |}
5876 !! html
5877 <table>
5878 <caption style="color: red;">caption2
5879 </caption>
5880 <caption style="color: red;"> caption3
5881 </caption>
5882 <tr>
5883 <td> foo
5884 </td></tr></table>
5885
5886 !! end
5887
5888 !! test
5889 Table td-cell syntax variations
5890 !! wikitext
5891 {|
5892 | foo bar foo | baz
5893 | foo bar foo || baz
5894 | style='color:red;' | baz
5895 | style='color:red;' || baz
5896 |}
5897 !! html
5898 <table>
5899 <tr>
5900 <td> baz
5901 </td>
5902 <td> foo bar foo </td>
5903 <td> baz
5904 </td>
5905 <td style="color:red;"> baz
5906 </td>
5907 <td> style='color:red;' </td>
5908 <td> baz
5909 </td></tr></table>
5910
5911 !! end
5912
5913 !! test
5914 Simple table
5915 !! wikitext
5916 {|
5917 | 1 || 2
5918 |-
5919 | 3 || 4
5920 |}
5921 !! html
5922 <table>
5923 <tr>
5924 <td> 1 </td>
5925 <td> 2
5926 </td></tr>
5927 <tr>
5928 <td> 3 </td>
5929 <td> 4
5930 </td></tr></table>
5931
5932 !! end
5933
5934 !! test
5935 Simple table but with multiple dashes for row wikitext
5936 !! wikitext
5937 {|
5938 | foo
5939 |-----
5940 | bar
5941 |}
5942 !! html
5943 <table>
5944 <tr>
5945 <td> foo
5946 </td></tr>
5947 <tr>
5948 <td> bar
5949 </td></tr></table>
5950
5951 !! end
5952
5953 !! test
5954 Multiplication table
5955 !! wikitext
5956 {| border="1" cellpadding="2"
5957 |+Multiplication table
5958 |-
5959 ! &times; !! 1 !! 2 !! 3
5960 |-
5961 ! 1
5962 | 1 || 2 || 3
5963 |-
5964 ! 2
5965 | 2 || 4 || 6
5966 |-
5967 ! 3
5968 | 3 || 6 || 9
5969 |-
5970 ! 4
5971 | 4 || 8 || 12
5972 |-
5973 ! 5
5974 | 5 || 10 || 15
5975 |}
5976 !! html
5977 <table border="1" cellpadding="2">
5978 <caption>Multiplication table
5979 </caption>
5980 <tr>
5981 <th> &#215; </th>
5982 <th> 1 </th>
5983 <th> 2 </th>
5984 <th> 3
5985 </th></tr>
5986 <tr>
5987 <th> 1
5988 </th>
5989 <td> 1 </td>
5990 <td> 2 </td>
5991 <td> 3
5992 </td></tr>
5993 <tr>
5994 <th> 2
5995 </th>
5996 <td> 2 </td>
5997 <td> 4 </td>
5998 <td> 6
5999 </td></tr>
6000 <tr>
6001 <th> 3
6002 </th>
6003 <td> 3 </td>
6004 <td> 6 </td>
6005 <td> 9
6006 </td></tr>
6007 <tr>
6008 <th> 4
6009 </th>
6010 <td> 4 </td>
6011 <td> 8 </td>
6012 <td> 12
6013 </td></tr>
6014 <tr>
6015 <th> 5
6016 </th>
6017 <td> 5 </td>
6018 <td> 10 </td>
6019 <td> 15
6020 </td></tr></table>
6021
6022 !! end
6023
6024 !! test
6025 Accept "||" in table headings
6026 !! wikitext
6027 {|
6028 !h1 || h2
6029 |}
6030 !! html
6031 <table>
6032 <tr>
6033 <th>h1 </th>
6034 <th> h2
6035 </th></tr></table>
6036
6037 !! end
6038
6039 !! test
6040 Accept "!!" in table data
6041 !! wikitext
6042 {|
6043 | Foo!! ||
6044 |}
6045 !! html
6046 <table>
6047 <tr>
6048 <td> Foo!! </td>
6049 <td>
6050 </td></tr></table>
6051
6052 !! html/parsoid
6053 <table>
6054 <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>
6055 </tbody></table>
6056 !! end
6057
6058 !! test
6059 Accept "||" in indented table headings
6060 !! wikitext
6061 :{|
6062 !h1 || h2
6063 |}
6064 !! html
6065 <dl><dd><table>
6066 <tr>
6067 <th>h1 </th>
6068 <th> h2
6069 </th></tr></table></dd></dl>
6070
6071 !! end
6072
6073 !! test
6074 Accept "!!" in templates
6075 !! wikitext
6076 {|
6077 !a {{echo|b!!c}}
6078 |}
6079 !! html/php
6080 <table>
6081 <tr>
6082 <th>a b</th>
6083 <th>c
6084 </th></tr></table>
6085
6086 !! html/parsoid
6087 <table>
6088 <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>
6089 !! end
6090
6091 !! test
6092 Accept "!!" in table headings after newline
6093 !! wikitext
6094 {|
6095 !a
6096 b!!c
6097 |}
6098 !! html/php
6099 <table>
6100 <tr>
6101 <th>a
6102 <p>b!!c
6103 </p>
6104 </th></tr></table>
6105
6106 !! html/parsoid
6107 <table>
6108 <tbody><tr><th>a
6109 <p>b!!c</p></th></tr>
6110 </tbody></table>
6111 !! end
6112
6113 !! test
6114 Accept "!!" in table data of mixed wikitext / html syntax
6115 !! wikitext
6116 {|
6117 !a
6118 <tr><td>b!!c</td></tr>
6119 |}
6120 !! html+tidy
6121 <table>
6122 <tr>
6123 <th>a</th>
6124 </tr>
6125 <tr>
6126 <td>b!!c</td>
6127 </tr>
6128 </table>
6129 !! html/parsoid
6130 <table>
6131 <tbody><tr><th>a</th></tr>
6132 <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
6133 </tbody></table>
6134 !! end
6135
6136 !! test
6137 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
6138 !! wikitext
6139 {|
6140 !| h1
6141 || a
6142 |}
6143 !! html
6144 <table>
6145 <tr>
6146 <th> h1
6147 </th>
6148 <td> a
6149 </td></tr></table>
6150
6151 !! end
6152
6153 !!test
6154 Accept "| !" at start of line in tables (ignore !-attribute)
6155 !! wikitext
6156 {|
6157 |-
6158 | !style="color:red" | bar
6159 |}
6160 !! html
6161 <table>
6162
6163 <tr>
6164 <td> bar
6165 </td></tr></table>
6166
6167 !!end
6168
6169 !!test
6170 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 +/-
6171 !! wikitext
6172 {|
6173 |-
6174 |style='color:red;'|+1
6175 |style='color:blue;'|-1
6176 |-
6177 | 1 || 2 || 3
6178 | 1 ||+2 ||-3
6179 |-
6180 | +1
6181 | -1
6182 |}
6183 !! html
6184 <table>
6185
6186 <tr>
6187 <td style="color:red;">+1
6188 </td>
6189 <td style="color:blue;">-1
6190 </td></tr>
6191 <tr>
6192 <td> 1 </td>
6193 <td> 2 </td>
6194 <td> 3
6195 </td>
6196 <td> 1 </td>
6197 <td>+2 </td>
6198 <td>-3
6199 </td></tr>
6200 <tr>
6201 <td> +1
6202 </td>
6203 <td> -1
6204 </td></tr></table>
6205
6206 !!end
6207
6208 !! test
6209 Table rowspan
6210 !! wikitext
6211 {| border=1
6212 | Cell 1, row 1
6213 |rowspan=2| Cell 2, row 1 (and 2)
6214 | Cell 3, row 1
6215 |-
6216 | Cell 1, row 2
6217 | Cell 3, row 2
6218 |}
6219 !! html
6220 <table border="1">
6221 <tr>
6222 <td> Cell 1, row 1
6223 </td>
6224 <td rowspan="2"> Cell 2, row 1 (and 2)
6225 </td>
6226 <td> Cell 3, row 1
6227 </td></tr>
6228 <tr>
6229 <td> Cell 1, row 2
6230 </td>
6231 <td> Cell 3, row 2
6232 </td></tr></table>
6233
6234 !! end
6235
6236 !! test
6237 Nested table
6238 !! wikitext
6239 {| border=1
6240 | &alpha;
6241 |
6242 {| bgcolor=#ABCDEF border=2
6243 |nested
6244 |-
6245 |table
6246 |}
6247 |the original table again
6248 |}
6249 !! html
6250 <table border="1">
6251 <tr>
6252 <td> &#945;
6253 </td>
6254 <td>
6255 <table bgcolor="#ABCDEF" border="2">
6256 <tr>
6257 <td>nested
6258 </td></tr>
6259 <tr>
6260 <td>table
6261 </td></tr></table>
6262 </td>
6263 <td>the original table again
6264 </td></tr></table>
6265
6266 !! end
6267
6268 !! test
6269 Invalid attributes in table cell (bug 1830)
6270 !! wikitext
6271 {|
6272 |Cell:|broken
6273 |}
6274 !! html
6275 <table>
6276 <tr>
6277 <td>broken
6278 </td></tr></table>
6279
6280 !! end
6281
6282 !! test
6283 Table cell attributes: Pipes protected by nowikis should be treated as a plain character
6284 !! wikitext
6285 {|
6286 | title="foo" |bar
6287 | title="foo<nowiki>|</nowiki>" |bar
6288 | title="foo<nowiki>|</nowiki>" bar
6289 |}
6290 !! html/php
6291 <table>
6292 <tr>
6293 <td title="foo">bar
6294 </td>
6295 <td title="foo&#124;">bar
6296 </td>
6297 <td> title="foo|" bar
6298 </td></tr></table>
6299
6300 !! html/parsoid
6301 <table>
6302 <tbody><tr><td title="foo">bar</td>
6303 <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
6304 <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
6305 </tbody></table>
6306 !! end
6307
6308 # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
6309 # N.B. The "|}" to close the table is missing from the input, so parsoid's
6310 # *2wt modes will fail.
6311 !! test
6312 Table security: embedded pipes
6313 !! options
6314 parsoid=wt2html,html2html
6315 !! wikitext
6316 {|
6317 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
6318 !! html/php
6319 <table>
6320 <tr>
6321 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
6322 <td>]" onmouseover="alert(document.cookie)"&gt;test
6323 </td>
6324 </tr>
6325 </table>
6326
6327 !! html/parsoid
6328 <table><tbody>
6329 <tr>
6330 <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'><a rel="mw:ExtLink" href="ftp://|x||"></a>" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
6331 !! end
6332
6333 # FIXME: The output seems broken. Filed as T110268.
6334 !! test
6335 ! and || in td attributes should not be parsed as <th>/<td>
6336 !! options
6337 parsoid=wt2html
6338 !! wikitext
6339 {|
6340 | style="color: red !important;" data-contrived="put this here ||" | foo
6341 |}
6342 !! html/php
6343 <table>
6344 <tr>
6345 <td> style="color: red !important;" data-contrived="put this here </td>
6346 <td> foo
6347 </td></tr></table>
6348
6349 !! html/parsoid
6350 <table>
6351 <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>
6352 </tbody></table>
6353 !! end
6354
6355 !! test
6356 Indented table markup mixed with indented pre content (proposed in bug 6200)
6357 !! wikitext
6358 <table>
6359 <tr>
6360 <td>
6361 Text that should be rendered preformatted
6362 </td>
6363 </tr>
6364 </table>
6365 !! html
6366 <table>
6367 <tr>
6368 <td>
6369 <pre>Text that should be rendered preformatted
6370 </pre>
6371 </td>
6372 </tr>
6373 </table>
6374
6375 !! end
6376
6377 !! test
6378 1. Template-generated table cell attributes and cell content
6379 !! wikitext
6380 {|
6381 |{{table_attribs}}
6382 | {{table_attribs}}
6383 || {{table_attribs_5}}
6384 | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
6385 |align=center {{table_attribs}}
6386 | <!--foo--> align=center <!--bar--> {{table_attribs}}
6387 |}
6388 !! html
6389 <table>
6390 <tr>
6391 <td style="color:red;">Foo
6392 </td>
6393 <td style="color:red;">Foo
6394 </td>
6395 <td> style="color:red;"</td>
6396 <td>Bar
6397 </td>
6398 <td style="color:red;">Foo
6399 </td>
6400 <td align="center" style="color:red;">Foo
6401 </td>
6402 <td align="center" style="color:red;">Foo
6403 </td></tr></table>
6404
6405 !! end
6406
6407 !! test
6408 2. Template-generated table cell attributes and cell content
6409 !! wikitext
6410 {|
6411 |{{table_attribs_2}}
6412 |}
6413 !! html/php
6414 <table>
6415 <tr>
6416 <td style="color:red;">Foo
6417 </td>
6418 <td>Bar</td>
6419 <td>Baz
6420 </td></tr></table>
6421
6422 !! html/parsoid
6423 <table>
6424 <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>
6425 <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
6426 </tbody></table>
6427 !! end
6428
6429 !! test
6430 3. Template-generated table cell attributes and cell content
6431 !! wikitext
6432 {|
6433 !align=center {{table_header_cells}}
6434 |-
6435 |align=center {{table_cells}}
6436 |}
6437 !! html/php
6438 <table>
6439 <tr>
6440 <th align="center" style="color:red;">Foo</th>
6441 <th style="color:red;"><i>Bar</i></th>
6442 <th style="color:brown;"><i>Foo</i> and Baz
6443 </th></tr>
6444 <tr>
6445 <td align="center" style="color:red;">Foo</td>
6446 <td style="color:red;"><i>Bar</i></td>
6447 <td style="color:brown;"><i>Foo</i> and Baz
6448 </td></tr></table>
6449
6450 !! html/parsoid
6451 <table>
6452 <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>
6453 <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>
6454 </tbody></table>
6455 !! end
6456
6457 !! test
6458 4. Template-generated table cell attributes and cell content inside a templated table
6459 !! wikitext
6460 {{tbl-start}}
6461 !align=center {{table_header_cells}}
6462 |-
6463 |align=center {{table_cells}}
6464 {{tbl-end}}
6465 !! html/php
6466 <table>
6467 <tr>
6468 <th align="center" style="color:red;">Foo</th>
6469 <th style="color:red;"><i>Bar</i></th>
6470 <th style="color:brown;"><i>Foo</i> and Baz
6471 </th></tr>
6472 <tr>
6473 <td align="center" style="color:red;">Foo</td>
6474 <td style="color:red;"><i>Bar</i></td>
6475 <td style="color:brown;"><i>Foo</i> and Baz
6476 </td></tr></table>
6477
6478 !! html/parsoid
6479 <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}}]}'>
6480 <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>
6481 <tr>
6482 <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>
6483 </tbody></table>
6484 !! end
6485
6486 ## Edge case fix to prevent future regressions
6487 !! test
6488 T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
6489 !! wikitext
6490 {|
6491 |{{table_attribs_7}}
6492 |}
6493 <references />
6494 !! html/parsoid
6495 <table>
6496 <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>
6497 </tbody></table>
6498 <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>
6499 !! end
6500
6501 !! test
6502 Table with row followed by newlines and table heading
6503 !! wikitext
6504 {|
6505 |-
6506
6507 ! foo
6508 |}
6509 !! html
6510 <table>
6511
6512
6513 <tr>
6514 <th> foo
6515 </th></tr></table>
6516
6517 !! end
6518
6519 !! test
6520 Table with empty line following the start tag
6521 !! wikitext
6522 {|
6523
6524 |-
6525 | foo
6526 |}
6527 !! html
6528 <table>
6529
6530
6531 <tr>
6532 <td> foo
6533 </td></tr></table>
6534
6535 !! end
6536
6537 # FIXME: Preserve the attribute properly (with an empty string as value) in
6538 # the PHP parser. Parsoid implements the behavior below.
6539 !! test
6540 Table attributes with empty value
6541 !! wikitext
6542 {|
6543 | style=| hello
6544 |}
6545 !! html/parsoid
6546 <table>
6547 <tbody>
6548 <tr>
6549 <td style=""> hello
6550 </td></tr></tbody></table>
6551
6552 !! end
6553
6554 !! test
6555 Wikitext table with a lot of comments
6556 !! wikitext
6557 {|
6558 <!-- c0 -->
6559 | foo
6560 <!-- c1 -->
6561 |-<!-- c2 -->
6562 <!-- c3 -->
6563 |<!-- c4 -->
6564 <!-- c5 -->
6565 |}
6566 !! html
6567 <table>
6568 <tr>
6569 <td> foo
6570 </td></tr>
6571 <tr>
6572 <td>
6573 </td></tr></table>
6574
6575 !! end
6576
6577 !! test
6578 Wikitext table comments represented in parsoid dom
6579 !! wikitext
6580 {|<!--c1--><!--c2-->
6581 |-<!--c3-->
6582 | x
6583 |}
6584 !! html/php+tidy
6585 <table>
6586 <tr>
6587 <td>x</td>
6588 </tr>
6589 </table>
6590 !! html/parsoid
6591 <table><!--c1--><!--c2-->
6592 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
6593 <td data-parsoid='{"autoInsertedEnd":true}'> x</td></tr>
6594 </tbody></table>
6595 !! end
6596
6597 !! test
6598 Wikitext table with double-line table cell
6599 !! wikitext
6600 {|
6601 |a
6602 b
6603 |}
6604 !! html
6605 <table>
6606 <tr>
6607 <td>a
6608 <p>b
6609 </p>
6610 </td></tr></table>
6611
6612 !! end
6613
6614 !! test
6615 Table cell with a single comment
6616 !! wikitext
6617 {|
6618 | <!-- c1 -->
6619 | a
6620 |}
6621 !! html
6622 <table>
6623 <tr>
6624 <td>
6625 </td>
6626 <td> a
6627 </td></tr></table>
6628
6629 !! end
6630
6631 !! test
6632 Table-cell after a comment-only-empty-line
6633 !! wikitext
6634 {|
6635 |a
6636 <!--c1-->
6637 <!--c2-->| b
6638 |}
6639 !! html
6640 <table>
6641 <tr>
6642 <td>a
6643 </td>
6644 <td> b
6645 </td></tr></table>
6646
6647 !! html/parsoid
6648 <table>
6649 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
6650 <!--c1-->
6651 <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'> b</td></tr>
6652 </tbody></table>
6653
6654 !! end
6655
6656 !! test
6657 Build table with {{!}}
6658 !! wikitext
6659 {{{!}} class="wikitable"
6660 ! header
6661 ! second header
6662 {{!}}- style="color:red;"
6663 {{!}} data {{!}}{{!}} style="color:red;" {{!}} second data
6664 {{!}}}
6665 !! html
6666 <table class="wikitable">
6667 <tr>
6668 <th> header
6669 </th>
6670 <th> second header
6671 </th></tr>
6672 <tr style="color:red;">
6673 <td> data </td>
6674 <td style="color:red;"> second data
6675 </td></tr></table>
6676
6677 !! end
6678
6679 !! test
6680 Build table with pipe as data
6681 !! wikitext
6682 {| class="wikitable"
6683 ! header
6684 ! second header
6685 |- style="color:red;"
6686 | data || style="color:red;" | second data
6687 |-
6688 | style="color:red;" | data with | || style="color:red;" | second data with |
6689 |-
6690 || data with | ||| second data with |
6691 |}
6692 !! html
6693 <table class="wikitable">
6694 <tr>
6695 <th> header
6696 </th>
6697 <th> second header
6698 </th></tr>
6699 <tr style="color:red;">
6700 <td> data </td>
6701 <td style="color:red;"> second data
6702 </td></tr>
6703 <tr>
6704 <td style="color:red;"> data with | </td>
6705 <td style="color:red;"> second data with |
6706 </td></tr>
6707 <tr>
6708 <td> data with | </td>
6709 <td> second data with |
6710 </td></tr></table>
6711
6712 !! end
6713
6714 !! test
6715 Build table with wikilink
6716 !! wikitext
6717 {| class="wikitable"
6718 ! header || second header
6719 |- style="color:red;"
6720 | data [[Main Page|linktext]] || second data [[Main Page|linktext]]
6721 |-
6722 | data || second data [[Main Page|link|text with pipe]]
6723 |}
6724 !! html
6725 <table class="wikitable">
6726 <tr>
6727 <th> header </th>
6728 <th> second header
6729 </th></tr>
6730 <tr style="color:red;">
6731 <td> data <a href="/wiki/Main_Page" title="Main Page">linktext</a> </td>
6732 <td> second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
6733 </td></tr>
6734 <tr>
6735 <td> data </td>
6736 <td> second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
6737 </td></tr></table>
6738
6739 !! end
6740
6741 # The expected HTML structure in this test is debatable. The PHP parser does
6742 # not parse this kind of table at all. The main focus for Parsoid is on
6743 # round-tripping, so this output is ok for now. TODO: revisit!
6744 !! test
6745 Wikitext table with html-syntax row
6746 !! wikitext
6747 {|
6748 |-
6749 <td>foo</td>
6750 |}
6751 !! html/parsoid
6752 <table>
6753 <tbody>
6754 <tr>
6755 <td>foo</td></tr></tbody></table>
6756 !! end
6757
6758 ## Note that Parsoid output differs from PHP and PHP+tidy here.
6759 ## The lack of <tr> tags in the PHP output is arguably a bug in the
6760 ## PHP parser, which tidy then compounds by fostering the content
6761 ## entirely out of the table. Parsoid recognizes the table context
6762 ## and generates <tr> and <td> wrappers as needed. Hopefully nobody
6763 ## depends on PHP's treatment of broken table markup!
6764 !! test
6765 Implicit <td> after a |-
6766 !! options
6767 parsoid=wt2html,html2html
6768 !! wikitext
6769 {|
6770 |-
6771 a
6772 |}
6773 !! html/php
6774 <table>
6775
6776 a
6777 </table>
6778
6779 !! html/php+tidy
6780 <p>a</p>
6781 !! html/parsoid
6782 <table>
6783 <tr><td>a</td></tr>
6784 </table>
6785 !! end
6786
6787 # Again, Parsoid adds implicit <td>s here, PHP and Tidy strip the b out.
6788 !! test
6789 <pre> tags should be recognized in an explicit <td> context, but not in an implicit <td> context
6790 !! options
6791 parsoid=wt2html,html2html
6792 !! wikitext
6793 {|
6794 |-
6795 |
6796 a
6797 |-
6798 b
6799 |}
6800 !! html/php
6801 <table>
6802
6803 <tr>
6804 <td>
6805 <pre>a
6806 </pre>
6807 </td></tr>
6808 b
6809 </table>
6810
6811 !! html/php+tidy
6812 <p>b</p>
6813 <table>
6814 <tr>
6815 <td>
6816 <pre>
6817 a
6818 </pre></td>
6819 </tr>
6820 </table>
6821 !! html/parsoid
6822 <table>
6823 <tbody>
6824 <tr><td><pre>a</pre></td></tr>
6825 <tr><td> b</td></tr>
6826 </tbody>
6827 </table>
6828 !! end
6829
6830 # PHP + Tidy strips the list out of the table; Parsoid wraps it.
6831 # Parsoid generates the missing <td>, so wt2wt won't succeed.
6832 !! test
6833 Lists should be recognized in an implicit <td> context
6834 !! options
6835 parsoid=wt2html,html2html
6836 !! wikitext
6837 {|
6838 |-
6839 *a
6840 |}
6841 !! html/php
6842 <table>
6843
6844 <ul><li>a</li></ul>
6845 </table>
6846
6847 !! html/php+tidy
6848 <ul>
6849 <li>a</li>
6850 </ul>
6851 !! html/parsoid
6852 <table>
6853 <tr>
6854 <td><ul>
6855 <li>a</li>
6856 </ul></td>
6857 </tr>
6858 </table>
6859 !! end
6860
6861 !! test
6862 Table cells not properly parsed in an implicit-td context
6863 !! wikitext
6864 {|
6865 |-
6866 {{table_attribs_4}} || a || b
6867 |}
6868 !! html/php+tidy
6869 <table>
6870 <tr>
6871 <td style="background-color:#DC241f;" width="10px"></td>
6872 <td>a</td>
6873 <td>b</td>
6874 </tr>
6875 </table>
6876 !! html/parsoid
6877 <table>
6878 <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
6879 <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>
6880 </tbody></table>
6881 !! end
6882
6883 !! test
6884 Parsoid: Round-trip tables directly followed by content (bug 51219)
6885 !! options
6886 parsoid=wt2html,wt2wt
6887 !! wikitext
6888 {|
6889 |foo
6890 |} bar
6891
6892 {|
6893 |baz
6894 |}<b>quux</b>
6895 !! html+tidy
6896 <table>
6897 <tr>
6898 <td>foo</td>
6899 </tr>
6900 </table>
6901 <p>bar</p>
6902 <table>
6903 <tr>
6904 <td>baz</td>
6905 </tr>
6906 </table>
6907 <p><b>quux</b></p>
6908 !! end
6909
6910 !! test
6911 Parsoid: Default to a newline after tables in new content (bug 51219)
6912 !! options
6913 parsoid=html2wt
6914 !! html/parsoid
6915 <table><tbody>
6916 <tr><td>foo</td></tr></tbody></table> bar
6917 <table><tbody>
6918 <tr><td>baz</td></tr></tbody></table><b>quux</b>
6919 !! wikitext
6920 {|
6921 |foo
6922 |}
6923 <nowiki> </nowiki>bar
6924 {|
6925 |baz
6926 |}
6927 '''quux'''
6928 !! end
6929
6930 !! test
6931 Parsoid: newline inducing block nodes don't suppress <nowiki>
6932 !! options
6933 parsoid=html2wt
6934 !! html/parsoid
6935 a<h1>foo</h1>
6936 !! wikitext
6937 <nowiki> </nowiki>a
6938
6939 = foo =
6940 !! end
6941
6942 !! test
6943 Parsoid: Row-syntax table headings followed by comment & table cells
6944 !! options
6945 parsoid=wt2html,wt2wt
6946 !! wikitext
6947 {|
6948 ! foo || bar
6949 <!-- foo --> || baz || quux
6950 |}
6951 !! html/php
6952 <table>
6953 <tr>
6954 <th> foo </th>
6955 <th> bar
6956 </th>
6957 <td> baz </td>
6958 <td> quux
6959 </td></tr></table>
6960
6961 !! html/parsoid
6962 <table>
6963 <tbody><tr><th> foo </th><th> bar
6964 <!-- foo --> </th><td> baz </td><td> quux</td></tr>
6965 </tbody></table>
6966 !! end
6967
6968 !!test
6969 Parsoid: Recover better from broken table attributes
6970 !!options
6971 parsoid=wt2html
6972 !!wikitext
6973 {| class="foo
6974 | class="bar" |
6975 foo
6976 |}
6977 !!html/php+tidy
6978 <table class="foo">
6979 <tr>
6980 <td class="bar">
6981 <p>foo</p>
6982 </td>
6983 </tr>
6984 </table>
6985 !!html/parsoid
6986 <table class="foo">
6987 <tr>
6988 <td class="bar">
6989 <p>foo</p></td></tr>
6990 </tbody></table>
6991 !!end
6992
6993 !! test
6994 Tables: Digest broken attributes on table and tr tag
6995 !! options
6996 parsoid=wt2html
6997 !! wikitext
6998 {| || |} ++
6999 |- || || ++ --
7000 |- > [
7001 |}
7002 !! html
7003 <table>
7004 <tbody>
7005 <tr></tr>
7006 <tr></tr>
7007 </tbody></table>
7008 !! end
7009
7010 !! test
7011 Strip unsupported table tags
7012 !! options
7013 parsoid=html2wt
7014 !! html/parsoid
7015 <table>
7016 <thead>
7017 <tr>
7018 <th>Month</th>
7019 <th>Savings</th>
7020 </tr>
7021 </thead>
7022 <tbody>
7023 <tr>
7024 <td>January</td>
7025 <td>$100</td>
7026 </tr>
7027 <tr>
7028 <td>February</td>
7029 <td>$80</td>
7030 </tr>
7031 </tbody>
7032 <tfoot>
7033 <tr>
7034 <td>Sum</td>
7035 <td>$180</td>
7036 </tr>
7037 </tfoot>
7038 </table>
7039 !! wikitext
7040 {|
7041
7042 !Month
7043 !Savings
7044
7045 |January
7046 |$100
7047
7048 |-
7049 |February
7050 |$80
7051
7052 |Sum
7053 |$180
7054
7055 |}
7056 !! end
7057
7058 !!test
7059 Testing serialization after deletion of table cells
7060 !!options
7061 parsoid={
7062 "modes": ["wt2wt", "selser"],
7063 "changes": [
7064 ["#x", "remove"]
7065 ]
7066 }
7067 !!wikitext
7068 {|
7069 !h1 !!h2 !!h3
7070 | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
7071 |}
7072 !! wikitext/edited
7073 {|
7074 !h1 !!h2 !!h3
7075 |c2 |||c3
7076 |}
7077 !!end
7078
7079 ###
7080 ### Internal links
7081 ###
7082 !! test
7083 Plain link, capitalized
7084 !! wikitext
7085 [[Main Page]]
7086 !! html
7087 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7088 </p>
7089 !! end
7090
7091 !! test
7092 Plain link, uncapitalized
7093 !! wikitext
7094 [[main Page]]
7095 !! html
7096 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
7097 </p>
7098 !! end
7099
7100 !! test
7101 Piped link
7102 !! wikitext
7103 [[Main Page|The Main Page]]
7104 !! html
7105 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7106 </p>
7107 !! end
7108
7109 !! test
7110 Piped link with comment in link text
7111 !! wikitext
7112 [[Main Page|The Main<!--front--> Page]]
7113 !! html
7114 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
7115 </p>
7116 !! end
7117
7118 !! test
7119 Piped link with multiple pipe characters in link text
7120 !! wikitext
7121 [[Main Page||The|Main|Page|]]
7122 !! html/php
7123 <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
7124 </p>
7125 !! html/parsoid
7126 <p><a rel="mw:WikiLink" href="Main_Page" title="Main Page">|The|Main|Page|</a></p>
7127 !! end
7128
7129 !! test
7130 Piped link with no link text
7131 !! wikitext
7132 [[Thomas Bek (bishop of St David's)|]]
7133 !! html/php
7134 <p>[[Thomas Bek (bishop of St David's)|]]
7135 </p>
7136 !! html/parsoid
7137 <p>[[Thomas Bek (bishop of St David's)|]]</p>
7138 !! end
7139
7140 !! test
7141 Broken link
7142 !! wikitext
7143 [[Zigzagzogzagzig]]
7144 !! html
7145 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
7146 </p>
7147 !! end
7148
7149 !! test
7150 Broken link with fragment
7151 !! wikitext
7152 [[Zigzagzogzagzig#zug]]
7153 !! html
7154 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
7155 </p>
7156 !! end
7157
7158 !! test
7159 Special page link with fragment
7160 !! wikitext
7161 [[Special:Version#anchor]]
7162 !! html
7163 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
7164 </p>
7165 !! end
7166
7167 !! test
7168 Nonexistent special page link with fragment
7169 !! wikitext
7170 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
7171 !! html
7172 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
7173 </p>
7174 !! end
7175
7176 !! test
7177 Link with prefix
7178 !! wikitext
7179 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
7180 !! html
7181 <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>
7182 </p>
7183 !! end
7184
7185 !! test
7186 Link with suffix
7187 !! wikitext
7188 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
7189 !! html
7190 <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>!!!
7191 </p>
7192 !! end
7193
7194 !! article
7195 prefixed article
7196 !! text
7197 Some text
7198 !! endarticle
7199
7200 !! test
7201 Bug 43661: Piped links with identical prefixes
7202 !! wikitext
7203 [[prefixed article|prefixed articles with spaces]]
7204
7205 [[prefixed article|prefixed articlesaoeu]]
7206
7207 [[Main Page|Main Page test]]
7208 !! html
7209 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
7210 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
7211 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
7212 </p>
7213 !! end
7214
7215
7216 !! test
7217 Link with HTML entity in suffix / tail
7218 !! wikitext
7219 [[Main Page]]&quot;, [[Main Page]]&#97;
7220 !! html/php
7221 <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;
7222 </p>
7223 !! html/parsoid
7224 <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>
7225 !! end
7226
7227 !! test
7228 Link with 3 brackets
7229 !! wikitext
7230 [[[Main Page]]]
7231 Foo [[[Main Page]]]
7232 !! html
7233 <p>[[[Main Page]]]
7234 Foo [[[Main Page]]]
7235 </p>
7236 !! end
7237
7238 !! test
7239 Link with 4 brackets
7240 !! wikitext
7241 [[[[Main Page]]]]
7242 !! html
7243 <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
7244 </p>
7245 !! end
7246
7247 !! test
7248 Piped link with 3 brackets
7249 !! wikitext
7250 [[[main page|the main page]]]
7251 !! html
7252 <p>[[[main page|the main page]]]
7253 </p>
7254 !! end
7255
7256 !! test
7257 Piped link with extlink-like text
7258 !! wikitext
7259 [[Main Page|[bar]]]
7260 [[Main Page|This is a [bar]]]
7261 !! html/php
7262 <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
7263 <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
7264 </p>
7265 !! html/parsoid
7266 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
7267 <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a></p>
7268 !! end
7269
7270 !! test
7271 Link with multiple pipes
7272 !! wikitext
7273 [[Main Page|The|Main|Page]]
7274 !! html
7275 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
7276 </p>
7277 !! end
7278
7279 # Note that parsoid does not munge anchor text; all non-space
7280 # characters are valid in HTML5 ids.
7281 !! test
7282 Anchor containing a #. (bug 63430)
7283 !! wikitext
7284 [[Main Page#And#Link]]
7285 !! html/php
7286 <p><a href="/wiki/Main_Page#And.23Link" title="Main Page">Main Page#And#Link</a>
7287 </p>
7288 !! html/parsoid
7289 <p><a rel="mw:WikiLink" href="./Main_Page#And%23Link" title="Main Page">Main Page#And#Link</a></p>
7290 !! end
7291
7292 !! test
7293 Link to namespaces
7294 !! wikitext
7295 [[Talk:Parser testing]], [[Meta:Disclaimers]]
7296 !! html
7297 <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>
7298 </p>
7299 !! end
7300
7301 !! test
7302 Link with space in namespace
7303 !! wikitext
7304 [[User talk:Foo bar]]
7305 !! html
7306 <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>
7307 </p>
7308 !! end
7309
7310 !! article
7311 MemoryAlpha:AlphaTest
7312 !! text
7313 This is an article in the MemoryAlpha namespace
7314 (which shadows the memoryalpha interwiki link).
7315 !! endarticle
7316
7317 !! test
7318 Namespace takes precedence over interwiki link (bug 51680)
7319 !! wikitext
7320 [[MemoryAlpha:AlphaTest]]
7321 !! html
7322 <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
7323 </p>
7324 !! end
7325
7326 # The previous test doesn't work correctly in html2*, due to not recognizing the
7327 # link as an internal one. This one checks for the correct behavior.
7328 !! test
7329 Link to namespace preferred over interwiki with correct rel attribute
7330 !! options
7331 parsoid=html2wt,html2html
7332 !! html/parsoid
7333 <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
7334 !! wikitext
7335 [[MemoryAlpha:AlphaTest]]
7336 !! end
7337
7338 !! test
7339 Piped link to namespace
7340 !! wikitext
7341 [[Meta:Disclaimers|The disclaimers]]
7342 !! html
7343 <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>
7344 </p>
7345 !! end
7346
7347 !! test
7348 Link containing }
7349 !! wikitext
7350 [[Usually caused by a typo (oops}]]
7351 !! html
7352 <p>[[Usually caused by a typo (oops}]]
7353 </p>
7354 !! end
7355
7356 !! article
7357 7% Solution
7358 !! text
7359 Just a test of an article title containing a percent.
7360 !! endarticle
7361
7362 !! test
7363 Link containing % (not as a hex sequence)
7364 !! wikitext
7365 [[7% Solution]]
7366 !! html/php
7367 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7368 </p>
7369 !! html/parsoid
7370 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7371 !! end
7372
7373 # note that the parsoid HTML is identical to the previous test output,
7374 # so the previous test ensures that the html2wt mode will generate the
7375 # "not as a hex sequence" wikitext.
7376 !! test
7377 Link containing % as a single hex sequence interpreted to char
7378 !! options
7379 parsoid=wt2wt,wt2html,html2html
7380 !! wikitext
7381 [[7%25 Solution]]
7382 !! html/php
7383 <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
7384 </p>
7385 !! html/parsoid
7386 <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a></p>
7387 !!end
7388
7389 !! test
7390 Link containing % as a double hex sequence interpreted to hex sequence
7391 !! wikitext
7392 [[7%2525 Solution]]
7393 !! html
7394 <p>[[7%2525 Solution]]
7395 </p>
7396 !!end
7397
7398 # note that parsoid does not munge anchor text; all non-space
7399 # characters are valid in HTML5 anchors.
7400 !! test
7401 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
7402 Example for such a section: == < ==
7403 !! wikitext
7404 [[%23%3c]][[%23%3e]]
7405 !! html/php
7406 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
7407 </p>
7408 !! html/parsoid
7409 <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>
7410 !! end
7411
7412 !! test
7413 Link containing "<#" and ">#" as a hex sequences
7414 !! wikitext
7415 [[%3c%23]][[%3e%23]]
7416 !! html
7417 <p>[[%3c%23]][[%3e%23]]
7418 </p>
7419 !! end
7420
7421 !! test
7422 Link containing an equals sign
7423 !! wikitext
7424 [[Special:BookSources/isbn=4-00-026157-6]]
7425 !! html/php
7426 <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>
7427 </p>
7428 !! html/parsoid
7429 <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>
7430 !! end
7431
7432 !! article
7433 Foo~bar
7434 !! text
7435 Just a test of an article title containing a tilde.
7436 !! endarticle
7437
7438 # note that links containing signatures, like [[Foo~~~~]], are
7439 # massaged by the pre-save transform (PST) and so the tildes are never
7440 # seen by the parser.
7441 !! test
7442 Link containing a tilde
7443 !! wikitext
7444 [[Foo~bar]]
7445 !! html/php
7446 <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
7447 </p>
7448 !! html/parsoid
7449 <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
7450 !! end
7451
7452 !! test
7453 Link containing double-single-quotes '' (bug 4598)
7454 !! wikitext
7455 [[Lista d''e paise d''o munno]]
7456 !! html/php
7457 <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>
7458 </p>
7459 !! html/parsoid
7460 <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>
7461 !! end
7462
7463 !! test
7464 Link containing double-single-quotes '' in text (bug 4598 sanity check)
7465 !! wikitext
7466 Some [[Link|pretty ''italics'' and stuff]]!
7467 !! html/php
7468 <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>!
7469 </p>
7470 !! html/parsoid
7471 <p>Some <a rel="mw:WikiLink" href="Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
7472 !! end
7473
7474 !! test
7475 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
7476 !! wikitext
7477 ''Some [[Link|pretty ''italics'' and stuff]]!''
7478 !! html
7479 <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>
7480 </p>
7481 !! end
7482
7483 !! test
7484 Link with double quotes in title part (literal) and alternate part (interpreted)
7485 !! wikitext
7486 [[File:Denys_Savchenko_''Pentecoste''.jpg]]
7487
7488 [[''Pentecoste'']]
7489
7490 [[''Pentecoste''|Pentecoste]]
7491
7492 [[''Pentecoste''|''Pentecoste'']]
7493 !! html/php
7494 <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>
7495 </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>
7496 </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>
7497 </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>
7498 </p>
7499 !! html/parsoid
7500 <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>
7501 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
7502 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
7503 <p><a rel="mw:WikiLink" href="''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
7504 !! end
7505
7506 !! test
7507 Broken image links with HTML captions (bug 39700)
7508 !! wikitext
7509 [[File:Nonexistent|<script></script>]]
7510 [[File:Nonexistent|100x100px|<script></script>]]
7511 [[File:Nonexistent|&lt;]]
7512 [[File:Nonexistent|a<i>b</i>c]]
7513 !! html/php
7514 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7515 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
7516 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
7517 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
7518 </p>
7519 !! html/parsoid
7520 <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>
7521 <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>
7522 <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>
7523 <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>
7524 !! end
7525
7526 !! test
7527 Plain link to URL
7528 !! wikitext
7529 [[http://www.example.com]]
7530 !! html/php
7531 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
7532 </p>
7533 !! html/parsoid
7534 <p>[<a rel="mw:ExtLink" href="http://www.example.com"></a>]</p>
7535 !! end
7536
7537 !! test
7538 Plain link to URL with link text
7539 !! wikitext
7540 [[http://www.example.com Link text]]
7541 !! html
7542 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
7543 </p>
7544 !! end
7545
7546 !! test
7547 Plain link to protocol-relative URL
7548 !! wikitext
7549 [[//www.example.com]]
7550 !! html/php
7551 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
7552 </p>
7553 !! html/parsoid
7554 <p>[<a rel="mw:ExtLink" href="//www.example.com"></a>]</p>
7555 !! end
7556
7557 !! test
7558 Plain link to protocol-relative URL with link text
7559 !! wikitext
7560 [[//www.example.com Link text]]
7561 !! html
7562 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
7563 </p>
7564 !! end
7565
7566 !! test
7567 Plain link to page with question mark in title
7568 !! wikitext
7569 [[A?b]]
7570
7571 [[A?b|Baz]]
7572 !! html
7573 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
7574 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
7575 </p>
7576 !! end
7577
7578
7579 # I'm fairly sure the expected result here is wrong.
7580 # We want these to be URL links, not pseudo-pages with URLs for titles....
7581 # However the current output is also pretty screwy.
7582 #
7583 # ----
7584 # I'm changing it to match the current output--it arguably makes more
7585 # sense in the light of the test above. Old expected result was:
7586 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
7587 #</p>
7588 # But I think this test is bordering on "garbage in, garbage out" anyway.
7589 # -- wtm
7590 !! test
7591 Piped link to URL
7592 !! wikitext
7593 Piped link to URL: [[http://www.example.com|an example URL]]
7594 !! html/php
7595 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
7596 </p>
7597 !! html/parsoid
7598 <p>Piped link to URL: [<a rel="mw:ExtLink" href="http://www.example.com|an">example URL</a>]</p>
7599 !! end
7600
7601 !! test
7602 BUG 2: [[page|http://url/]] should link to page, not http://url/
7603 !! wikitext
7604 [[Main Page|http://url/]]
7605 !! html/php
7606 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
7607 </p>
7608 !! html/parsoid
7609 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
7610 !! end
7611
7612 # Parsoid does not mark self-links, by design.
7613 !! test
7614 BUG 337: Escaped self-links should be bold
7615 !! options
7616 title=[[Bug462]]
7617 !! wikitext
7618 [[Bu&#103;462]] [[Bug462]]
7619 !! html/php
7620 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
7621 </p>
7622 !! html/php+tidy
7623 <p><strong class="selflink">Bug462</strong> <strong class="selflink">Bug462</strong></p>
7624 !! html/parsoid
7625 <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
7626 !! end
7627
7628 !! test
7629 Self-link to section should not be bold
7630 !! options
7631 title=[[Main Page]]
7632 !! wikitext
7633 [[Main Page#section]]
7634 !! html
7635 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
7636 </p>
7637 !! end
7638
7639 !! article
7640 00
7641 !! text
7642 This is 00.
7643 !! endarticle
7644
7645 !!test
7646 Self-link to numeric title
7647 !!options
7648 title=[[0]]
7649 !! wikitext
7650 [[0]]
7651 !! html
7652 <p><strong class="selflink">0</strong>
7653 </p>
7654 !!end
7655
7656 !!test
7657 Link to numeric-equivalent title
7658 !!options
7659 title=[[0]]
7660 !! wikitext
7661 [[00]]
7662 !! html
7663 <p><a href="/wiki/00" title="00">00</a>
7664 </p>
7665 !!end
7666
7667 !! test
7668 <nowiki> inside a link
7669 !! wikitext
7670 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
7671 !! html
7672 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
7673 </p>
7674 !! end
7675
7676 !! test
7677 Non-breaking spaces in title
7678 !! wikitext
7679 [[&nbsp; Main &nbsp; Page &nbsp;]]
7680 !! html
7681 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
7682 </p>
7683 !!end
7684
7685 !! test
7686 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
7687 !! options
7688 language=ca
7689 !! wikitext
7690 '''[[Main Page]]'''
7691 !! html
7692 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
7693 </p>
7694 !! end
7695
7696 !! test
7697 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
7698 !! options
7699 language=ca
7700 !! wikitext
7701 ''[[Main Page]]''
7702 !! html
7703 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
7704 </p>
7705 !! end
7706
7707 !! test
7708 Internal link with en linktrail: no apostrophes (bug 27473)
7709 !! options
7710 language=en
7711 !! wikitext
7712 [[Something]]'nice
7713 !! html
7714 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
7715 </p>
7716 !! end
7717
7718 !! test
7719 Internal link with ca linktrail with apostrophes (bug 27473)
7720 !! options
7721 language=ca
7722 !! wikitext
7723 [[Something]]'nice
7724 !! html
7725 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
7726 </p>
7727 !! end
7728
7729 !! test
7730 Internal link with kaa linktrail with apostrophes (bug 27473)
7731 !! options
7732 language=kaa
7733 !! wikitext
7734 [[Something]]'nice
7735 !! html
7736 <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>
7737 </p>
7738 !! end
7739
7740 !! test
7741 Link with multiple ":" in a subpage-supporting namespace (bug 63636)
7742 !! wikitext
7743 [[User:Foo/Test/63636:Bar|Test]]
7744 !! html/php
7745 <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>
7746 </p>
7747 !! html/parsoid
7748 <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
7749 !! end
7750
7751 !! test
7752 Purely hash wikilink
7753 !! options
7754 title=[[User:test/123]]
7755 !! wikitext
7756 [[#a|b]]
7757 !! html/php
7758 <p><a href="#a">b</a>
7759 </p>
7760 !! html/parsoid
7761 <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>
7762 !! end
7763
7764 !! test
7765 1. Interaction of linktrail and template encapsulation
7766 !! options
7767 parsoid
7768 !! wikitext
7769 {{echo|[[Foo]]}}l
7770 !! html
7771 <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>
7772 !! end
7773
7774 !! test
7775 2. Interaction of linktrail and template encapsulation
7776 !! options
7777 parsoid
7778 !! wikitext
7779 {{echo|Some [[Fool]]}}s
7780 !! html
7781 <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>
7782 !! end
7783
7784 !! test
7785 3. Interaction of linktrail and template encapsulation
7786 !! options
7787 parsoid
7788 !! wikitext
7789 {{echo|Some [[Fool]]s are '''bold and foolish'''}}
7790 !! html
7791 <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>
7792 !! end
7793
7794 !! article
7795 Söfnuður
7796 !! text
7797 Test.
7798 !! endarticle
7799
7800 !! test
7801 Internal link with is link prefix
7802 !! options
7803 language=is
7804 !! wikitext
7805 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
7806 !! html
7807 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
7808 </p>
7809 !! end
7810
7811 !! article
7812 Mótmælendatrú
7813 !! text
7814 Test.
7815 !! endarticle
7816
7817 !! test
7818 Internal link with is link trail and link prefix
7819 !! options
7820 language=is
7821 !! wikitext
7822 [[mótmælendatrú|xxx]]ar
7823 [[mótmælendatrú]]ar
7824 mótmælenda[[söfnuður]]
7825 mótmælenda[[söfnuður|söfnuðir]]
7826 mótmælenda[[söfnuður|söfnuðir]]xxx
7827 !! html
7828 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
7829 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
7830 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
7831 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
7832 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
7833 </p>
7834 !! end
7835
7836 !! test
7837 Parsoid link trail escaping
7838 !! options
7839 parsoid=html2wt,html2html
7840 !! html/parsoid
7841 <p><a rel="mw:WikiLink" href="Apple" title="Apple">apple</a>s</p>
7842 !! wikitext
7843 [[apple]]<nowiki/>s
7844 !! end
7845
7846 !! test
7847 Parsoid link prefix escaping
7848 !! options
7849 language=is
7850 parsoid=html2wt,html2html
7851 !! html/parsoid
7852 <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður">söfnuður</a></p>
7853 !! wikitext
7854 Aðrir mótmælenda<nowiki/>[[söfnuður]]
7855 !! end
7856
7857 !! test
7858 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
7859 !! wikitext
7860 [[Foo| bar]]
7861
7862 [[Foo| ''bar'']]
7863
7864 [http://wp.org foo]
7865
7866 [http://wp.org ''foo'']
7867 !! html
7868 <p><a href="/wiki/Foo" title="Foo"> bar</a>
7869 </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
7870 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
7871 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
7872 </p>
7873 !! end
7874
7875 !! test
7876 Parsoid: Scoped parsing should handle mixed transclusions and plain text
7877 !! options
7878 parsoid
7879 !! wikitext
7880 [[Foo|{{echo|a}} b {{echo|c}}]]
7881 !! html
7882 <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>
7883 !! end
7884
7885 !! test
7886 Link with angle bracket after anchor
7887 !! wikitext
7888 [[Foo#<bar>]]
7889 !! html/php
7890 <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
7891 </p>
7892 !! html/parsoid
7893 <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>
7894 !! end
7895
7896 ###
7897 ### Interwiki links (see maintenance/interwiki.sql)
7898 ###
7899
7900 !! test
7901 Inline interwiki link
7902 !! options
7903 parsoid=wt2html,wt2wt,html2html
7904 !! wikitext
7905 [[MeatBall:SoftSecurity]]
7906 !! html/php
7907 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
7908 </p>
7909 !! html/parsoid
7910 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
7911 !! end
7912
7913 !! test
7914 Inline interwiki link with empty title (bug 2372)
7915 !! options
7916 parsoid=wt2html,wt2wt,html2html
7917 !! wikitext
7918 [[MeatBall:]]
7919 !! html/php
7920 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
7921 </p>
7922 !! html/parsoid
7923 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
7924 !! end
7925
7926 !! test
7927 Interwiki link encoding conversion (bug 1636)
7928 !! wikitext
7929 *[[Wikipedia:ro:Olteni&#0355;a]]
7930 *[[Wikipedia:ro:Olteni&#355;a]]
7931 !! html
7932 <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>
7933 <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>
7934
7935 !! html+tidy
7936 <ul>
7937 <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>
7938 <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>
7939 </ul>
7940 !! end
7941
7942 !! test
7943 Interwiki link with fragment (bug 2130)
7944 !! wikitext
7945 [[MeatBall:SoftSecurity#foo]]
7946 !! html
7947 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
7948 </p>
7949 !! end
7950
7951 # Ideally the wikipedia: prefix here should be proto-relative too
7952 # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
7953 # define the 'en' prefix, and originally the test used 'wikipedia',
7954 # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
7955 # article.
7956 !! test
7957 Different interwiki prefixes mapping to the same URL
7958 !! wikitext
7959 [[:en:Foo]]
7960
7961 [[:en:Foo|Foo]]
7962
7963 [[wikipedia:Foo]]
7964
7965 [[:wikipedia:Foo|Foo]]
7966
7967 [[wikipedia:en:Foo]]
7968
7969 [[:wikipedia:en:Foo]]
7970
7971 [[ wikiPEdia :Foo]]
7972 !! html/parsoid
7973 <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>
7974
7975 <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>
7976
7977 <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>
7978
7979 <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>
7980
7981 <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>
7982
7983 <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>
7984
7985 <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>
7986 !! end
7987
7988 !! test
7989 Interwiki links that cannot be represented in wiki syntax
7990 !! wikitext
7991 [[meatball:ok]]
7992 [[meatball:ok#foo|ok with fragment]]
7993 [[meatball:ok_as_well?|ok ending with ? mark]]
7994 [http://de.wikipedia.org/wiki/Foo?action=history has query]
7995 [http://de.wikipedia.org/wiki/#foo is just fragment]
7996
7997 !! html/php
7998 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
7999 <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
8000 <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>
8001 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8002 <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
8003 </p>
8004 !! html/parsoid
8005 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
8006 <a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
8007 <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>
8008 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
8009 <a rel="mw:ExtLink" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
8010 !! end
8011
8012 !! test
8013 Interwiki links: trail
8014 !! wikitext
8015 [[wikipedia:Foo|Ba]]r
8016 !! html/php
8017 <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
8018 </p>
8019 !! html/parsoid
8020 <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>
8021 !! end
8022
8023 !! test
8024 Local interwiki link
8025 !! options
8026 parsoid=wt2html,wt2wt,html2html
8027 !! wikitext
8028 [[local:Template:Foo]]
8029 !! html/php
8030 <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
8031 </p>
8032 !! html/parsoid
8033 <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
8034 !! end
8035
8036 # Parsoid does not mark self-links, by design.
8037 !! test
8038 Local interwiki link: self-link to current page
8039 !! options
8040 title=[[Main Page]]
8041 parsoid=wt2html,wt2wt,html2html
8042 !! wikitext
8043 [[local:Main Page]]
8044 !! html/php
8045 <p><strong class="selflink">local:Main Page</strong>
8046 </p>
8047 !! html/parsoid
8048 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
8049 !! end
8050
8051 !! test
8052 Local interwiki link: prefix only (bug 64167)
8053 !! options
8054 parsoid=wt2html,wt2wt,html2html
8055 !! wikitext
8056 [[local:]]
8057 !! html/php
8058 <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
8059 </p>
8060 !! html/parsoid
8061 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
8062 !! end
8063
8064 !! test
8065 Local interwiki link: with additional interwiki prefix (bug 61357)
8066 !! options
8067 parsoid=wt2html,wt2wt,html2html
8068 !! wikitext
8069 [[local:meatball:Hello]]
8070 !! html/php
8071 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
8072 </p>
8073 !! html/parsoid
8074 <p><a rel="mw:ExtLink" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
8075 !! end
8076
8077 !! test
8078 Multiple local interwiki link prefixes
8079 !! wikitext
8080 [[local:local:local:local:mi:local:Foo]]
8081 !! options
8082 parsoid=wt2html,wt2wt,html2html
8083 !! html/php
8084 <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
8085 </p>
8086 !! html/parsoid
8087 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
8088 !! end
8089
8090 ###
8091 ### Interlanguage links
8092 ### Language links (so that searching for '### language' matches..)
8093 ###
8094
8095 !! test
8096 Interlanguage link
8097 !! options
8098 parsoid=wt2html,wt2wt,html2html
8099 !! wikitext
8100 Blah blah blah
8101 [[zh:Chinese]]
8102 !! html/php
8103 <p>Blah blah blah
8104 </p>
8105 !! html/parsoid
8106 <p>Blah blah blah</p>
8107 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8108 !! end
8109
8110 !! test
8111 Interlanguage link with spacing
8112 !! options
8113 parsoid=wt2html,wt2wt,html2html
8114 !! wikitext
8115 Blah blah blah
8116 [[ zh : Chinese ]]
8117 !! html/php
8118 <p>Blah blah blah
8119 </p>
8120 !! html/parsoid
8121 <p>Blah blah blah</p>
8122 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8123 !! end
8124
8125 !! test
8126 Double interlanguage link
8127 !! options
8128 parsoid=wt2html,wt2wt,html2html
8129 !! wikitext
8130 Blah blah blah
8131 [[es:Spanish]]
8132 [[zh:Chinese]]
8133 !! html/php
8134 <p>Blah blah blah
8135 </p>
8136 !! html/parsoid
8137 <p>Blah blah blah</p>
8138 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8139 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8140 !! end
8141
8142 !! test
8143 Interlanguage link variations
8144 !! options
8145 parsoid=wt2html,wt2wt,html2html
8146 !! wikitext
8147 Blah blah blah
8148 [[ es :Spanish]]
8149 [[ ZH :Chinese]]
8150 [[es:Foo_bar]]
8151 !! html/php
8152 <p>Blah blah blah
8153 </p>
8154 !! html/parsoid
8155 <p>Blah blah blah</p>
8156 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
8157 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
8158 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
8159 !! end
8160
8161 !! test
8162 Space and question mark encoding in interlanguage links (T95473)
8163 !! options
8164 parsoid=wt2html,wt2wt,html2html
8165 !! wikitext
8166 Blah blah blah
8167 [[es:Foo bar?]]
8168 !! html/php
8169 <p>Blah blah blah
8170 </p>
8171 !! html/parsoid
8172 <p>Blah blah blah</p>
8173 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
8174 !! end
8175
8176 !! test
8177 Interlanguage link, with prefix links
8178 !! options
8179 language=ln
8180 !! wikitext
8181 Blah blah blah
8182 [[zh:Chinese]]
8183 !! html/php
8184 <p>Blah blah blah
8185 </p>
8186 !! html/parsoid
8187 <p>Blah blah blah</p>
8188 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8189 !! end
8190
8191 !! test
8192 Double interlanguage link, with prefix links (bug 8897)
8193 !! options
8194 language=ln
8195 !! wikitext
8196 Blah blah blah
8197 [[es:Spanish]]
8198 [[zh:Chinese]]
8199 !! html/php
8200 <p>Blah blah blah
8201 </p>
8202 !! html/parsoid
8203 <p>Blah blah blah</p>
8204 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
8205 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
8206 !! end
8207
8208 !! test
8209 "Extra" interlanguage links (bug 32189 / gerrit 111390)
8210 !! wikitext
8211 Blah blah blah
8212 [[mul:Article]]
8213 !! html/php
8214 <p>Blah blah blah
8215 </p>
8216 !! html/parsoid
8217 <p>Blah blah blah</p>
8218 <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
8219 !! end
8220
8221 !! test
8222 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
8223 !! options
8224 language=ln
8225 !! wikitext
8226 [[WW&nbsp;II]]
8227 !! html
8228 <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>
8229 </p>
8230 !! end
8231
8232 !! test
8233 Parsoid bug 53221: Wikilinks should be properly entity-escaped
8234 !! options
8235 parsoid=html2wt
8236 !! html/parsoid
8237 <p>He&amp;nbsp;llo <a href="Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8238 <p>He&amp;nbsp;llo <a href="He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
8239 !! wikitext
8240 He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
8241
8242 He&amp;nbsp;llo [[He&amp;nbsp;llo]]
8243 !! end
8244
8245 !! test
8246 Parsoid: handle constructor well
8247 !! wikitext
8248 [[constructor]]
8249
8250 [[constructor:foo]]
8251 !! html/php
8252 <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
8253 </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>
8254 </p>
8255 !! html/parsoid
8256 <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>
8257
8258 <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>
8259 !! end
8260
8261 !! article
8262 ko:
8263 !! text
8264 Test.
8265 !! endarticle
8266
8267 # Note that `ko` isn't a known interlanguage prefix
8268 !! test
8269 Parsoid: recognize interlanguage links without a target page
8270 !! options
8271 ill
8272 !! wikitext
8273 [[es:]]
8274
8275 [[ko:]]
8276 !! html/php
8277 es:
8278 !! html/parsoid
8279 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
8280
8281 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8282 !! end
8283
8284 # Note that `ko` isn't a known interwiki prefix
8285 !! test
8286 Parsoid: recognize interwiki links without a target page
8287 !! options
8288 parsoid=wt2html,wt2wt,html2html
8289 !! wikitext
8290 [[:es:]]
8291
8292 [[:ko:]]
8293 !! html/php
8294 <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
8295 </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
8296 </p>
8297 !! html/parsoid
8298 <p><a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
8299 <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
8300 !! end
8301
8302 !! test
8303 Handle interwiki links pointing to the current wiki as plain wiki links (bug 45209)
8304 !! wikitext
8305 [[mi:Foo]]
8306 !! html/php
8307 <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
8308 </p>
8309 !! html/parsoid
8310 <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
8311 !! end
8312
8313 !! test
8314 Interlanguage link with preceding local interwiki link (bug 68085)
8315 !! options
8316 parsoid=wt2html,wt2wt,html2html
8317 !! wikitext
8318 Blah blah blah
8319 [[local:es:Spanish]]
8320 !! html/php
8321 <p>Blah blah blah
8322 <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
8323 </p>
8324 !! html/parsoid
8325 <p>Blah blah blah
8326 <a rel="mw:ExtLink" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
8327 !! end
8328
8329 !! test
8330 Looks like an interlanguage link, but is actually a local interwiki
8331 !! options
8332 parsoid=wt2html,wt2wt,html2html
8333 !! wikitext
8334 Blah blah blah
8335 [[mi:Template:Foo]]
8336 !! html/php
8337 <p>Blah blah blah
8338 <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
8339 </p>
8340 !! html/parsoid
8341 <p>Blah blah blah
8342 <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
8343 !! end
8344
8345 ###
8346 ### Redirects, Parsoid-only
8347 ###
8348
8349 !! test
8350 1. Simple redirect to page
8351 !! wikitext
8352 #REDIRECT [[Main Page]]
8353 !! html/parsoid
8354 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8355 !! end
8356
8357 !! test
8358 2. Other redirect variants
8359 !! wikitext
8360 #REDIRECT [[Main_Page]]
8361 !! html/parsoid
8362 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
8363 !! end
8364
8365 # Not a valid redirect in PHP (although perhaps it was, once upon a time)
8366 # This tests the Parsoid bail-out code.
8367 !! test
8368 3. Other redirect variants
8369 !! wikitext
8370 #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
8371 !! html/parsoid
8372 <ol><li data-parsoid>REDIRECT [[[[Bar]]]]</li></ol>
8373 !! end
8374
8375 !! test
8376 4. Redirect to a templated destination
8377 !! wikitext
8378 #REDIRECT [[{{echo|Foo}}bar]]
8379 !! html/parsoid
8380 <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"}]]}'/>
8381 !! end
8382
8383 !! test
8384 Empty redirect
8385 !! options
8386 parsoid=wt2html,wt2wt
8387 !! wikitext
8388 #REDIRECT [[]]
8389 !! html/parsoid
8390 <ol>
8391 <li>REDIRECT [[]]</li></ol>
8392 !! end
8393
8394 !! test
8395 Optional colon in #REDIRECT
8396 !! options
8397 # the colon is archaic syntax. we support it for wt2html, but we
8398 # don't care that it roundtrips back to the modern syntax.
8399 parsoid=wt2html,html2html
8400 !! wikitext
8401 #REDIRECT:[[Main Page]]
8402 !! html/parsoid
8403 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8404 !! end
8405
8406 !! test
8407 Whitespace in #REDIRECT with optional colon
8408 !! options
8409 # the colon and gratuitous whitespace is archaic syntax. we support
8410 # it for wt2html, but we don't care that it roundtrips back to the
8411 # modern syntax (without extra whitespace)
8412 parsoid=wt2html,html2html
8413 !! wikitext
8414
8415 #REDIRECT
8416 :
8417 [[Main Page]]
8418 !! html/parsoid
8419 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8420 !! end
8421
8422 !! test
8423 Piped link in #REDIRECT
8424 !! options
8425 # content after piped link is ignored. we support this syntax,
8426 # but don't care that the piped link is lost when we roundtrip this.
8427 parsoid=wt2html
8428 !! wikitext
8429 #REDIRECT [[Main Page|bar]]
8430 !! html/parsoid
8431 <link rel="mw:PageProp/redirect" href="./Main_Page"/>
8432 !! end
8433
8434 !! test
8435 Redirect to category (T104502)
8436 !! options
8437 parsoid=wt2html,wt2wt
8438 !! wikitext
8439 #REDIRECT [[Category:Foo]]
8440 !! html/parsoid
8441 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8442 !! end
8443
8444 !! test
8445 Redirect to category with URL encoding (T104502)
8446 !! options
8447 parsoid=wt2html
8448 !! wikitext
8449 #REDIRECT [[Category%3AFoo]]
8450 !! html/parsoid
8451 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8452 !! end
8453
8454 !! test
8455 Redirect to category page
8456 !! wikitext
8457 #REDIRECT [[:Category:Foo]]
8458 !! html/parsoid
8459 <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
8460 !! end
8461
8462 !! test
8463 Redirect to image page (1)
8464 !! wikitext
8465 #REDIRECT [[File:Wiki.png]]
8466 !! html/parsoid
8467 <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
8468 !! end
8469
8470 !! test
8471 Redirect to image page (2)
8472 !! wikitext
8473 #REDIRECT [[Image:Wiki.png]]
8474 !! html/parsoid
8475 <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
8476 !! end
8477
8478 # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
8479 # Next test confirms this.
8480 !! test
8481 Redirect to language (1) (T104918)
8482 !! options
8483 parsoid=wt2html,wt2wt,html2html
8484 !! wikitext
8485 #REDIRECT [[en:File:Wiki.png]]
8486 !! html/parsoid
8487 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8488 !! end
8489
8490 !! test
8491 Redirect to language (2) (T104918)
8492 !! wikitext
8493 #REDIRECT [[:en:File:Wiki.png]]
8494 !! html/parsoid
8495 <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
8496 !! end
8497
8498 !! test
8499 Redirect to interwiki (T104918)
8500 !! wikitext
8501 #REDIRECT [[meatball:File:Wiki.png]]
8502 !! html/parsoid
8503 <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
8504 !! end
8505
8506 !! test
8507 Non-English #REDIRECT
8508 !! options
8509 language=is
8510 !! wikitext
8511 #TILVÍSUN [[Main Page]]
8512 !! html/parsoid
8513 <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
8514 !! end
8515
8516 !! test
8517 Redirect syntax under text isn't considered a redirect
8518 !! wikitext
8519 some text
8520 #redirect [[Main Page]]
8521 !! html/parsoid
8522 <p>some text</p>
8523 <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>
8524 !! end
8525
8526 # FIXME: Should hoist the redirect to the top of the page and ensure there
8527 # is only one.
8528 !! test
8529 New redirect
8530 !! options
8531 parsoid=html2wt
8532 !! html/parsoid
8533 <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
8534 !! wikitext
8535 Foo
8536 #REDIRECT [[Foo]]
8537 !! end
8538
8539 ##
8540 ## XHTML tidiness
8541 ###
8542
8543 !! test
8544 <br> to <br />
8545 !! wikitext
8546 1<br>2<br />3
8547 !! html
8548 <p>1<br />2<br />3
8549 </p>
8550 !! end
8551
8552 !! test
8553 Broken br tag sanitization
8554 !! wikitext
8555 </br>
8556 !! html/php
8557 <p>&lt;/br&gt;
8558 </p>
8559 !! end
8560
8561 # TODO: Fix html2html mode (bug 51055)!
8562 !! test
8563 Parsoid: Broken br tag recognition
8564 !! options
8565 parsoid=wt2html
8566 !! wikitext
8567 </br>
8568
8569 <br/ >
8570 !! html+tidy
8571 <p><br /></p>
8572 <p><br /></p>
8573 !! end
8574
8575 !! test
8576 Incorrecly removing closing slashes from correctly formed XHTML
8577 !! wikitext
8578 <br style="clear:both;" />
8579 !! html
8580 <p><br style="clear:both;" />
8581 </p>
8582 !! end
8583
8584 !! test
8585 Failing to transform badly formed HTML into correct XHTML
8586 !! wikitext
8587 <br style="clear: left;">
8588 <br style="clear: right;">
8589 <br style="clear: both;">
8590 !! html
8591 <p><br style="clear: left;" />
8592 <br style="clear: right;" />
8593 <br style="clear: both;" />
8594 </p>
8595 !!end
8596
8597 ## FIXME: Is Parsoid's acceptance of self-closing html-tags
8598 ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
8599 !! test
8600 Handling html with a div self-closing tag
8601 !! wikitext
8602 <div title />
8603 <div title/>
8604 <div title/ >
8605 <div title=bar />
8606 <div title=bar/>
8607 <div title=bar/ >
8608 !! html/php
8609 <p>&lt;div title /&gt;
8610 &lt;div title/&gt;
8611 </p>
8612 <div>
8613 <p>&lt;div title=bar /&gt;
8614 &lt;div title=bar/&gt;
8615 </p>
8616 <div title="bar/"></div>
8617 </div>
8618
8619 !! html/parsoid
8620 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8621 <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
8622 <div title="" data-parsoid='{"stx":"html","selfClose":true,"brokenHTMLTag":true}'></div>
8623 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8624 <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
8625 <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
8626 !! end
8627
8628 !! test
8629 Handling html with a br self-closing tag
8630 !! wikitext
8631 <br title />
8632 <br title/>
8633 <br title/ >
8634 <br title=bar />
8635 <br title=bar/>
8636 <br title=bar/ >
8637 !! html/php
8638 <p><br title="" />
8639 <br title="" />
8640 <br />
8641 <br title="bar" />
8642 <br title="bar" />
8643 <br title="bar/" />
8644 </p>
8645 !! html/parsoid
8646 <p><br title="" />
8647 <br title="" />
8648 <br title="" />
8649 <br title="bar" />
8650 <br title="bar" />
8651 <br title="bar/" />
8652 </p>
8653 !! end
8654
8655 !! test
8656 Horizontal ruler (should it add that extra space?)
8657 !! wikitext
8658 <hr>
8659 <hr >
8660 foo <hr
8661 > bar
8662 !! html+tidy
8663 <hr />
8664 <hr />
8665 <p>foo</p>
8666 <hr />
8667 <p>bar</p>
8668 !! end
8669
8670 !! test
8671 Horizontal ruler -- 4+ dashes render hr
8672 !! wikitext
8673 ----
8674 !! html
8675 <hr />
8676
8677 !! end
8678
8679 !! test
8680 Horizontal ruler -- eats additional dashes on the same line
8681 !! wikitext
8682 ---------
8683 !! html
8684 <hr />
8685
8686 !! end
8687
8688 !! test
8689 Horizontal ruler -- does not collapse dashes on consecutive lines
8690 !! wikitext
8691 ----
8692 ----
8693 !! html
8694 <hr />
8695 <hr />
8696
8697 !! end
8698
8699 !! test
8700 Horizontal ruler -- <4 dashes render as plain text
8701 !! wikitext
8702 ---
8703 !! html
8704 <p>---
8705 </p>
8706 !! end
8707
8708 !! test
8709 Horizontal ruler -- Supports content following dashes on same line
8710 !! wikitext
8711 ---- Foo
8712 !! html
8713 <hr /> Foo
8714
8715 !! html+tidy
8716 <hr />
8717 <p>Foo</p>
8718 !! end
8719
8720 ###
8721 ### Block-level elements
8722 ###
8723 !! test
8724 Common list
8725 !! wikitext
8726 *Common list
8727 * item 2
8728 *item 3
8729 !! html
8730 <ul><li>Common list</li>
8731 <li> item 2</li>
8732 <li>item 3</li></ul>
8733
8734 !! end
8735
8736 !! test
8737 Numbered list
8738 !! wikitext
8739 #Numbered list
8740 #item 2
8741 # item 3
8742 !! html
8743 <ol><li>Numbered list</li>
8744 <li>item 2</li>
8745 <li> item 3</li></ol>
8746
8747 !! end
8748
8749 !! test
8750 Mixed list
8751 !! wikitext
8752 *Mixed list
8753 *# with numbers
8754 ** and bullets
8755 *# and numbers
8756 *bullets again
8757 **bullet level 2
8758 ***bullet level 3
8759 ***#Number on level 4
8760 **bullet level 2
8761 **#Number on level 3
8762 **#Number on level 3
8763 *#number level 2
8764 *Level 1
8765 *** Level 3
8766 #** Level 3, but ordered
8767 !! html
8768 <ul><li>Mixed list
8769 <ol><li> with numbers</li></ol>
8770 <ul><li> and bullets</li></ul>
8771 <ol><li> and numbers</li></ol></li>
8772 <li>bullets again
8773 <ul><li>bullet level 2
8774 <ul><li>bullet level 3
8775 <ol><li>Number on level 4</li></ol></li></ul></li>
8776 <li>bullet level 2
8777 <ol><li>Number on level 3</li>
8778 <li>Number on level 3</li></ol></li></ul>
8779 <ol><li>number level 2</li></ol></li>
8780 <li>Level 1
8781 <ul><li><ul><li> Level 3</li></ul></li></ul></li></ul>
8782 <ol><li><ul><li><ul><li> Level 3, but ordered</li></ul></li></ul></li></ol>
8783
8784 !! end
8785
8786 !! test
8787 Nested lists 1
8788 !! wikitext
8789 *foo
8790 **bar
8791 !! html
8792 <ul><li>foo
8793 <ul><li>bar</li></ul></li></ul>
8794
8795 !! end
8796
8797 !! test
8798 Nested lists 2
8799 !! wikitext
8800 **foo
8801 *bar
8802 !! html
8803 <ul><li><ul><li>foo</li></ul></li>
8804 <li>bar</li></ul>
8805
8806 !! end
8807
8808 !! test
8809 Nested lists 3 (first element empty)
8810 !! wikitext
8811 *
8812 **bar
8813 !! html
8814 <ul><li>
8815 <ul><li>bar</li></ul></li></ul>
8816
8817 !! end
8818
8819 !! test
8820 Nested lists 4 (first element empty)
8821 !! wikitext
8822 **
8823 *bar
8824 !! html
8825 <ul><li><ul><li></li></ul></li>
8826 <li>bar</li></ul>
8827
8828 !! end
8829
8830 !! test
8831 Nested lists 5 (both elements empty)
8832 !! wikitext
8833 **
8834 *
8835 !! html
8836 <ul><li><ul><li></li></ul></li>
8837 <li></li></ul>
8838
8839 !! end
8840
8841 !! test
8842 Nested lists 6 (both elements empty)
8843 !! wikitext
8844 *
8845 **
8846 !! html
8847 <ul><li>
8848 <ul><li></li></ul></li></ul>
8849
8850 !! end
8851
8852 !! test
8853 Nested lists 7 (skip initial nesting levels)
8854 !! wikitext
8855 *** foo
8856 !! html
8857 <ul><li><ul><li><ul><li> foo</li></ul></li></ul></li></ul>
8858
8859 !! end
8860
8861 !! test
8862 Nested lists 8 (multiple nesting transitions)
8863 !! wikitext
8864 * foo
8865 *** bar
8866 ** baz
8867 * boo
8868 !! html
8869 <ul><li> foo
8870 <ul><li><ul><li> bar</li></ul></li>
8871 <li> baz</li></ul></li>
8872 <li> boo</li></ul>
8873
8874 !! end
8875
8876 !! test
8877 Nested lists 9 (extension interaction)
8878 !! options
8879 parsoid
8880 !! wikitext
8881 *<references />
8882 !! html/parsoid
8883 <ul><li data-parsoid='{}'><ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
8884 !! end
8885
8886 !! test
8887 1. Lists with start-of-line-transparent tokens before bullets: Comments
8888 !! wikitext
8889 *foo
8890 *<!--cmt-->bar
8891 <!--cmt-->*baz
8892 !! html
8893 <ul><li>foo</li>
8894 <li>bar</li>
8895 <li>baz</li></ul>
8896
8897 !! end
8898
8899 !! test
8900 2. Lists with start-of-line-transparent tokens before bullets: Template close
8901 !! wikitext
8902 *foo {{echo|bar
8903 }}*baz
8904 !! html
8905 <ul><li>foo bar</li>
8906 <li>baz</li></ul>
8907
8908 !! end
8909
8910 !! test
8911 List items are not parsed correctly following a <pre> block (bug 785)
8912 !! wikitext
8913 * <pre>foo</pre>
8914 * <pre>bar</pre>
8915 * zar
8916 !! html/php
8917 <ul><li> <pre>foo</pre></li>
8918 <li> <pre>bar</pre></li>
8919 <li> zar</li></ul>
8920
8921 !! html/parsoid
8922 <ul><li> <pre data-parsoid='{"stx":"html"}'>foo</pre></li>
8923 <li> <pre data-parsoid='{"stx":"html"}'>bar</pre></li>
8924 <li> zar</li></ul>
8925 !! end
8926
8927 !! test
8928 List items from template
8929 !! wikitext
8930
8931 {{inner list}}
8932 * item 2
8933
8934 * item 0
8935 {{inner list}}
8936 * item 2
8937
8938 * item 0
8939 * notSOL{{inner list}}
8940 * item 2
8941 !! html
8942 <ul><li> item 1</li>
8943 <li> item 2</li></ul>
8944 <ul><li> item 0</li>
8945 <li> item 1</li>
8946 <li> item 2</li></ul>
8947 <ul><li> item 0</li>
8948 <li> notSOL</li>
8949 <li> item 1</li>
8950 <li> item 2</li></ul>
8951
8952 !! end
8953
8954 !! test
8955 List interrupted by empty line or heading
8956 !! wikitext
8957 * foo
8958
8959 ** bar
8960 == A heading ==
8961 * Another list item
8962 !! html
8963 <ul><li> foo</li></ul>
8964 <ul><li><ul><li> bar</li></ul></li></ul>
8965 <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>
8966 <ul><li> Another list item</li></ul>
8967
8968 !!end
8969
8970 !!test
8971 Multiple list tags generated by templates
8972 !! wikitext
8973 {{echo|<li>}}a
8974 {{echo|<li>}}b
8975 {{echo|<li>}}c
8976 !! html
8977 <li>a
8978 <li>b
8979 <li>c</li>
8980 </li>
8981 </li>
8982
8983 !! html+tidy
8984 <ul>
8985 <li>a</li>
8986 <li>b</li>
8987 <li>c</li>
8988 </ul>
8989 !!end
8990
8991 !!test
8992 Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
8993 !! wikitext
8994 *a
8995 <!--This line will NOT split the list-->
8996 *b
8997 <!--This line will NOT split the list either-->
8998 *c
8999 <!--foo--> <!----> <!--This line NOT split the list either-->
9000 *d
9001 !! html
9002 <ul><li>a</li>
9003 <li>b</li>
9004 <li>c</li>
9005 <li>d</li></ul>
9006
9007 !!end
9008
9009 !!test
9010 Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
9011 !! wikitext
9012 *a
9013 <!--This line will NOT split the list-->
9014 *b
9015 <!--This line will NOT split the list either-->
9016 *c
9017 <!--foo--> <!----> <!--This line NOT split the list
9018 either-->
9019 *d
9020 !! html
9021 <ul><li>a</li>
9022 <li>b</li>
9023 <li>c</li>
9024 <li>d</li></ul>
9025
9026 !!end
9027
9028 !!test
9029 Test the li-hack
9030 (The PHP parser relies on Tidy for the hack)
9031 !!options
9032 parsoid=wt2html,wt2wt
9033 !! wikitext
9034 * foo
9035 * <li>li-hack
9036 * {{echo|<li>templated li-hack}}
9037 * <!--foo--> <li> unsupported li-hack with preceding comments
9038
9039 <ul>
9040 <li><li>not a li-hack
9041 </li>
9042 </ul>
9043 !! html+tidy
9044 <ul>
9045 <li>foo</li>
9046 <li>li-hack</li>
9047 <li>templated li-hack</li>
9048 <li>unsupported li-hack with preceding comments</li>
9049 </ul>
9050 <ul>
9051 <li>not a li-hack</li>
9052 </ul>
9053 !!end
9054
9055 !! test
9056 Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
9057 !! options
9058 parsoid
9059 !! wikitext
9060 # foo
9061 ## bar
9062 * foo
9063 ** bar
9064 : foo
9065 :: bar
9066 !! html
9067 <ol>
9068 <li> foo<ol>
9069 <li> bar</li>
9070 </ol></li>
9071 </ol><ul>
9072 <li> foo<ul>
9073 <li> bar</li>
9074 </ul></li>
9075 </ul><dl>
9076 <dd> foo<dl>
9077 <dd> bar</dd>
9078 </dl></dd>
9079 </dl>
9080 !! end
9081
9082 !! test
9083 Parsoid: Test of whitespace serialization with Templated bullets
9084 !! options
9085 parsoid
9086 !! wikitext
9087 * {{bullet}}
9088 !! html
9089 <ul>
9090 <li> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
9091 </ul>
9092 !! end
9093
9094 # ------------------------------------------------------------------------
9095 # The next set of tests are about Parsoid's ability to handle badly nested
9096 # tags (parse, minimize scope of fixup, and roundtrip back)
9097 # ------------------------------------------------------------------------
9098
9099 !! test
9100 Unbalanced closing block tags break a list
9101 (php parser relies on Tidy to fix up)
9102 !! wikitext
9103 <div>
9104 *a</div><div>
9105 *b</div>
9106 !! html+tidy
9107 <div>
9108 <ul>
9109 <li>a</li>
9110 </ul>
9111 </div>
9112 <div>
9113 <ul>
9114 <li>b</li>
9115 </ul>
9116 </div>
9117 !! end
9118
9119 # Parsoid fails this test, but it might be tricky to support properly.
9120 # See bug 68395.
9121 !! test
9122 Unbalanced closing non-block tags don't break a list
9123 (php parser relies on Tidy to fix up)
9124 !! wikitext
9125 <span>
9126 *a</span><span>
9127 *b</span>
9128 !! html/php+tidy
9129 <ul>
9130 <li><span>a</span></li>
9131 <li><span>b</span></li>
9132 </ul>
9133 !! html/parsoid
9134 <span>
9135 <ul>
9136 <li>a<span></span>
9137 </li>
9138 <li>b
9139 </li>
9140 </ul>
9141 </span>
9142 !! end
9143
9144 !! test
9145 Unclosed formatting tags that straddle lists are closed and reopened
9146 (php parser relies on Tidy to fix up)
9147 !! options
9148 parsoid=wt2html,wt2wt,html2html
9149 !! wikitext
9150 # <s> a
9151 # b </s>
9152 !! html/php+tidy
9153 <ol>
9154 <li><s>a</s></li>
9155 <li><s>b</s></li>
9156 </ol>
9157 !! html/parsoid
9158 <ol><li> <s> a</s></li>
9159 <li><s> b </s></li></ol>
9160 !! end
9161
9162 # See bug 68395.
9163 !!test
9164 1. List embedded in a formatting tag
9165 !! wikitext
9166 <small>
9167 * foo
9168 </small>
9169 !! html/php+tidy
9170 <ul>
9171 <li><small>foo</small></li>
9172 </ul>
9173 !! html/parsoid
9174 <small>
9175 <ul>
9176 <li> foo</li>
9177 </ul>
9178 </small>
9179 !!end
9180
9181 ## Ugly Parsoid output here
9182 ## Not sure what the right output is.
9183 !!test
9184 2. List embedded in a formatting tag
9185 !! wikitext
9186 <small>
9187 *a
9188 *b</small>
9189 !! html/php+tidy
9190 <ul>
9191 <li><small>a</small></li>
9192 <li><small>b</small></li>
9193 </ul>
9194 !! html/parsoid
9195 <small></small>
9196 <ul><small>
9197 <li>a</li>
9198 </small>
9199 <li><small>b</small></li>
9200 </ul>
9201 !!end
9202
9203 # Ugly Parsoid and PHP parser output here
9204 # Not sure if we want to make this a test!
9205 #
9206 ## !!test
9207 ## 3. Unclosed formatting tags in list elements
9208 ## !! wikitext
9209 ## *<small>a
9210 ## *<small>b
9211 ## !! html/php+tidy
9212 ## <ul>
9213 ## <li><small>a</small></li>
9214 ## <li><small><small>b</small></small></li>
9215 ## </ul>
9216 ## !! html/parsoid
9217 ## <ul>
9218 ## <li><small>a</small></li>
9219 ## <small>
9220 ## <li><small>b</small></li>
9221 ## </small></ul>
9222 ## !!end
9223
9224 # This is a bug in the PHP parser + tidy combination.
9225 # (The </tr> tag gets parsed as text and html-escaped by PHP,
9226 # and then fostered out of the table by tidy.)
9227 # We believe the Parsoid output to be correct.
9228 !! test
9229 Table with missing opening <tr> tag
9230 !! options
9231 parsoid=wt2html,wt2wt
9232 !! wikitext
9233 <table>
9234 <td>foo</td>
9235 </tr>
9236 </table>
9237 !! html+tidy
9238 <table>
9239 <tr>
9240 <td>foo</td>
9241 </tr>
9242 </table>
9243 !! end
9244
9245 ###
9246 ### Magic Words
9247 ###
9248
9249 # Note that the current date is hard-coded as
9250 # 1970-01-01T00:02:03Z (a Thursday)
9251 # when running parser tests. The timezone is also fixed to GMT, so
9252 # local date will be identical to current date.
9253
9254 !! test
9255 Magic Word: {{CURRENTDAY}}
9256 !! wikitext
9257 {{CURRENTDAY}}
9258 !! html
9259 <p>1
9260 </p>
9261 !! end
9262
9263 !! test
9264 Magic Word: {{CURRENTDAY2}}
9265 !! wikitext
9266 {{CURRENTDAY2}}
9267 !! html
9268 <p>01
9269 </p>
9270 !! end
9271
9272 !! test
9273 Magic Word: {{CURRENTDAYNAME}}
9274 !! wikitext
9275 {{CURRENTDAYNAME}}
9276 !! html
9277 <p>Thursday
9278 </p>
9279 !! end
9280
9281 !! test
9282 Magic Word: {{CURRENTDOW}}
9283 !! wikitext
9284 {{CURRENTDOW}}
9285 !! html
9286 <p>4
9287 </p>
9288 !! end
9289
9290 !! test
9291 Magic Word: {{CURRENTMONTH}}
9292 !! wikitext
9293 {{CURRENTMONTH}}
9294 !! html
9295 <p>01
9296 </p>
9297 !! end
9298
9299 !! test
9300 Magic Word: {{CURRENTMONTH1}}
9301 !! wikitext
9302 {{CURRENTMONTH1}}
9303 !! html
9304 <p>1
9305 </p>
9306 !! end
9307
9308 !! test
9309 Magic Word: {{CURRENTMONTHABBREV}}
9310 !! wikitext
9311 {{CURRENTMONTHABBREV}}
9312 !! html
9313 <p>Jan
9314 </p>
9315 !! end
9316
9317 !! test
9318 Magic Word: {{CURRENTMONTHNAME}}
9319 !! wikitext
9320 {{CURRENTMONTHNAME}}
9321 !! html
9322 <p>January
9323 </p>
9324 !! end
9325
9326 !! test
9327 Magic Word: {{CURRENTMONTHNAMEGEN}}
9328 !! wikitext
9329 {{CURRENTMONTHNAMEGEN}}
9330 !! html
9331 <p>January
9332 </p>
9333 !! end
9334
9335 !! test
9336 Magic Word: {{CURRENTTIME}}
9337 !! wikitext
9338 {{CURRENTTIME}}
9339 !! html
9340 <p>00:02
9341 </p>
9342 !! end
9343
9344 !! test
9345 Magic Word: {{CURRENTHOUR}}
9346 !! wikitext
9347 {{CURRENTHOUR}}
9348 !! html
9349 <p>00
9350 </p>
9351 !! end
9352
9353 !! test
9354 Magic Word: {{CURRENTWEEK}} (@bug 4594)
9355 !! wikitext
9356 {{CURRENTWEEK}}
9357 !! html
9358 <p>1
9359 </p>
9360 !! end
9361
9362 !! test
9363 Magic Word: {{CURRENTYEAR}}
9364 !! wikitext
9365 {{CURRENTYEAR}}
9366 !! html
9367 <p>1970
9368 </p>
9369 !! end
9370
9371 !! test
9372 Magic Word: {{CURRENTTIMESTAMP}}
9373 !! wikitext
9374 {{CURRENTTIMESTAMP}}
9375 !! html
9376 <p>19700101000203
9377 </p>
9378 !! end
9379
9380 !! test
9381 Magic Words LOCAL (UTC)
9382 !! wikitext
9383 * {{LOCALMONTH}}
9384 * {{LOCALMONTH1}}
9385 * {{LOCALMONTHNAME}}
9386 * {{LOCALMONTHNAMEGEN}}
9387 * {{LOCALMONTHABBREV}}
9388 * {{LOCALDAY}}
9389 * {{LOCALDAY2}}
9390 * {{LOCALDAYNAME}}
9391 * {{LOCALYEAR}}
9392 * {{LOCALTIME}}
9393 * {{LOCALHOUR}}
9394 * {{LOCALWEEK}}
9395 * {{LOCALDOW}}
9396 * {{LOCALTIMESTAMP}}
9397 !! html
9398 <ul><li> 01</li>
9399 <li> 1</li>
9400 <li> January</li>
9401 <li> January</li>
9402 <li> Jan</li>
9403 <li> 1</li>
9404 <li> 01</li>
9405 <li> Thursday</li>
9406 <li> 1970</li>
9407 <li> 00:02</li>
9408 <li> 00</li>
9409 <li> 1</li>
9410 <li> 4</li>
9411 <li> 19700101000203</li></ul>
9412
9413 !! end
9414
9415 !! test
9416 Magic Word: {{FULLPAGENAME}}
9417 !! options
9418 title=[[User:Ævar Arnfjörð Bjarmason]]
9419 !! wikitext
9420 {{FULLPAGENAME}}
9421 !! html
9422 <p>User:Ævar Arnfjörð Bjarmason
9423 </p>
9424 !! end
9425
9426 !! test
9427 Magic Word: {{FULLPAGENAMEE}}
9428 !! options
9429 title=[[User:Ævar Arnfjörð Bjarmason]]
9430 !! wikitext
9431 {{FULLPAGENAMEE}}
9432 !! html
9433 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9434 </p>
9435 !! end
9436
9437 !! test
9438 Magic Word: {{TALKSPACE}}
9439 !! options
9440 title=[[User:Ævar Arnfjörð Bjarmason]]
9441 !! wikitext
9442 {{TALKSPACE}}
9443 !! html
9444 <p>User talk
9445 </p>
9446 !! end
9447
9448 !! test
9449 Magic Word: {{TALKSPACE}}, same namespace
9450 !! options
9451 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9452 !! wikitext
9453 {{TALKSPACE}}
9454 !! html
9455 <p>User talk
9456 </p>
9457 !! end
9458
9459 !! test
9460 Magic Word: {{TALKSPACE}}, main namespace
9461 !! options
9462 title=[[Parser Test]]
9463 !! wikitext
9464 {{TALKSPACE}}
9465 !! html
9466 <p>Talk
9467 </p>
9468 !! end
9469
9470 !! test
9471 Magic Word: {{TALKSPACEE}}
9472 !! options
9473 title=[[User:Ævar Arnfjörð Bjarmason]]
9474 !! wikitext
9475 {{TALKSPACEE}}
9476 !! html
9477 <p>User_talk
9478 </p>
9479 !! end
9480
9481 !! test
9482 Magic Word: {{SUBJECTSPACE}}
9483 !! options
9484 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9485 !! wikitext
9486 {{SUBJECTSPACE}}
9487 !! html
9488 <p>User
9489 </p>
9490 !! end
9491
9492 !! test
9493 Magic Word: {{SUBJECTSPACE}}, same namespace
9494 !! options
9495 title=[[User:Ævar Arnfjörð Bjarmason]]
9496 !! wikitext
9497 {{SUBJECTSPACE}}
9498 !! html
9499 <p>User
9500 </p>
9501 !! end
9502
9503 !! test
9504 Magic Word: {{SUBJECTSPACE}}, main namespace
9505 !! options
9506 title=[[Parser Test]]
9507 !! wikitext
9508 {{SUBJECTSPACE}}
9509 !! html
9510
9511 !! end
9512
9513 !! test
9514 Magic Word: {{SUBJECTSPACEE}}
9515 !! options
9516 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9517 !! wikitext
9518 {{SUBJECTSPACEE}}
9519 !! html
9520 <p>User
9521 </p>
9522 !! end
9523
9524 !! test
9525 Magic Word: {{NAMESPACE}}
9526 !! options
9527 title=[[User:Ævar Arnfjörð Bjarmason]]
9528 !! wikitext
9529 {{NAMESPACE}}
9530 !! html
9531 <p>User
9532 </p>
9533 !! end
9534
9535 !! test
9536 Magic Word: {{NAMESPACEE}}
9537 !! options
9538 title=[[User:Ævar Arnfjörð Bjarmason]]
9539 !! wikitext
9540 {{NAMESPACEE}}
9541 !! html
9542 <p>User
9543 </p>
9544 !! end
9545
9546 !! test
9547 Magic Word: {{NAMESPACENUMBER}}
9548 !! options
9549 title=[[User:Ævar Arnfjörð Bjarmason]]
9550 !! wikitext
9551 {{NAMESPACENUMBER}}
9552 !! html
9553 <p>2
9554 </p>
9555 !! end
9556
9557 !! test
9558 Magic Word: {{SUBPAGENAME}}
9559 !! options
9560 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9561 !! wikitext
9562 {{SUBPAGENAME}}
9563 !! html
9564 <p>sub ö
9565 </p>
9566 !! end
9567
9568 !! test
9569 Magic Word: {{SUBPAGENAMEE}}
9570 !! options
9571 title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
9572 !! wikitext
9573 {{SUBPAGENAMEE}}
9574 !! html
9575 <p>sub_%C3%B6
9576 </p>
9577 !! end
9578
9579 !! test
9580 Magic Word: {{ROOTPAGENAME}}
9581 !! options
9582 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9583 !! wikitext
9584 {{ROOTPAGENAME}}
9585 !! html
9586 <p>Ævar Arnfjörð Bjarmason
9587 </p>
9588 !! end
9589
9590 !! test
9591 Magic Word: {{ROOTPAGENAMEE}}
9592 !! options
9593 title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
9594 !! wikitext
9595 {{ROOTPAGENAMEE}}
9596 !! html
9597 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9598 </p>
9599 !! end
9600
9601 !! test
9602 Magic Word: {{BASEPAGENAME}}
9603 !! options
9604 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9605 !! wikitext
9606 {{BASEPAGENAME}}
9607 !! html
9608 <p>Ævar Arnfjörð Bjarmason
9609 </p>
9610 !! end
9611
9612 !! test
9613 Magic Word: {{BASEPAGENAMEE}}
9614 !! options
9615 title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
9616 !! wikitext
9617 {{BASEPAGENAMEE}}
9618 !! html
9619 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9620 </p>
9621 !! end
9622
9623 !! test
9624 Magic Word: {{TALKPAGENAME}}
9625 !! options
9626 title=[[User:Ævar Arnfjörð Bjarmason]]
9627 !! wikitext
9628 {{TALKPAGENAME}}
9629 !! html
9630 <p>User talk:Ævar Arnfjörð Bjarmason
9631 </p>
9632 !! end
9633
9634 !! test
9635 Magic Word: {{TALKPAGENAMEE}}
9636 !! options
9637 title=[[User:Ævar Arnfjörð Bjarmason]]
9638 !! wikitext
9639 {{TALKPAGENAMEE}}
9640 !! html
9641 <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9642 </p>
9643 !! end
9644
9645 !! test
9646 Magic Word: {{SUBJECTPAGENAME}}
9647 !! options
9648 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9649 !! wikitext
9650 {{SUBJECTPAGENAME}}
9651 !! html
9652 <p>User:Ævar Arnfjörð Bjarmason
9653 </p>
9654 !! end
9655
9656 !! test
9657 Magic Word: {{SUBJECTPAGENAMEE}}
9658 !! options
9659 title=[[User talk:Ævar Arnfjörð Bjarmason]]
9660 !! wikitext
9661 {{SUBJECTPAGENAMEE}}
9662 !! html
9663 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9664 </p>
9665 !! end
9666
9667 !! test
9668 Magic Word: {{NUMBEROFFILES}}
9669 !! wikitext
9670 {{NUMBEROFFILES}}
9671 !! html
9672 <p>5
9673 </p>
9674 !! end
9675
9676 !! test
9677 Magic Word: {{PAGENAME}}
9678 !! options
9679 title=[[User:Ævar Arnfjörð Bjarmason]]
9680 !! wikitext
9681 {{PAGENAME}}
9682 !! html
9683 <p>Ævar Arnfjörð Bjarmason
9684 </p>
9685 !! end
9686
9687 !! test
9688 Magic Word: {{PAGENAME}} with metacharacters
9689 !! options
9690 title=[['foo & bar = baz']]
9691 !! wikitext
9692 ''{{PAGENAME}}''
9693 !! html/php
9694 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
9695 </p>
9696 !! html+tidy
9697 <p><i>'foo &amp; bar = baz'</i></p>
9698 !! end
9699
9700 !! test
9701 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
9702 !! options
9703 title=[[*RFC 1234 http://example.com/]]
9704 !! wikitext
9705 {{PAGENAME}}
9706 !! html/php
9707 <p>&#42;RFC&#32;1234 http&#58;//example.com/
9708 </p>
9709 !! html+tidy
9710 <p>*RFC 1234 http://example.com/</p>
9711 !! end
9712
9713 !! test
9714 Magic Word: {{PAGENAMEE}}
9715 !! options
9716 title=[[User:Ævar Arnfjörð Bjarmason]]
9717 !! wikitext
9718 {{PAGENAMEE}}
9719 !! html
9720 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
9721 </p>
9722 !! end
9723
9724 !! test
9725 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
9726 !! options
9727 title=[[*RFC 1234 http://example.com/]]
9728 !! wikitext
9729 {{PAGENAMEE}}
9730 !! html/php
9731 <p>&#42;RFC_1234_http&#58;//example.com/
9732 </p>
9733 !! html+tidy
9734 <p>*RFC_1234_http://example.com/</p>
9735 !! end
9736
9737 !! test
9738 Magic Word: {{REVISIONID}}
9739 !! wikitext
9740 {{REVISIONID}}
9741 !! html
9742 <p>1337
9743 </p>
9744 !! end
9745
9746 !! test
9747 Magic Word: {{SCRIPTPATH}}
9748 !! wikitext
9749 {{SCRIPTPATH}}
9750 !! html
9751 <p>/
9752 </p>
9753 !! end
9754
9755 !! test
9756 Magic Word: {{STYLEPATH}}
9757 !! wikitext
9758 {{STYLEPATH}}
9759 !! html
9760 <p>/skins
9761 </p>
9762 !! end
9763
9764 !! test
9765 Magic Word: {{SERVER}}
9766 !! wikitext
9767 {{SERVER}}
9768 !! html
9769 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9770 </p>
9771 !! end
9772
9773 !! test
9774 Magic Word: {{SERVERNAME}}
9775 !! wikitext
9776 {{SERVERNAME}}
9777 !! html
9778 <p>example.org
9779 </p>
9780 !! end
9781
9782 !! test
9783 Magic Word: {{SITENAME}}
9784 !! wikitext
9785 {{SITENAME}}
9786 !! html
9787 <p>MediaWiki
9788 </p>
9789 !! end
9790
9791 !! test
9792 Case-sensitive magic words, when cased differently, should just be template transclusions
9793 !! wikitext
9794 {{CurrentMonth}}
9795 {{currentday}}
9796 {{cURreNTweEK}}
9797 {{currentHour}}
9798 !! html
9799 <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>
9800 <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>
9801 <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>
9802 <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>
9803 </p>
9804 !! end
9805
9806 !! test
9807 Case-insensitive magic words should still work with weird casing.
9808 !! wikitext
9809 {{sErVeRNaMe}}
9810 {{LCFirst:AOEU}}
9811 {{ucFIRST:aoeu}}
9812 {{SERver}}
9813 !! html
9814 <p>example.org
9815 aOEU
9816 Aoeu
9817 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
9818 </p>
9819 !! end
9820
9821 # From plwiki:PLOS_ONE
9822 !! test
9823 Parsoid: Page property magic word with magic word contents
9824 !! wikitext
9825 {{DISPLAYTITLE:''{{PAGENAME}}''}}
9826 !! html/parsoid
9827 <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>"}]]}'/>
9828 !! end
9829
9830 !! test
9831 Parsoid: Template-generated DISPLAYTITLE
9832 !! wikitext
9833 {{{{echo|DISPLAYTITLE}}:Foo}}
9834 !! html/parsoid
9835 <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}}]}'/>
9836 !! end
9837
9838 !! test
9839 Namespace 1 {{ns:1}}
9840 !! wikitext
9841 {{ns:1}}
9842 !! html
9843 <p>Talk
9844 </p>
9845 !! end
9846
9847 !! test
9848 Namespace 1 {{ns:01}}
9849 !! wikitext
9850 {{ns:01}}
9851 !! html
9852 <p>Talk
9853 </p>
9854 !! end
9855
9856 !! test
9857 Namespace 0 {{ns:0}} (bug 4783)
9858 !! wikitext
9859 {{ns:0}}
9860 !! html
9861
9862 !! end
9863
9864 !! test
9865 Namespace 0 {{ns:00}} (bug 4783)
9866 !! wikitext
9867 {{ns:00}}
9868 !! html
9869
9870 !! end
9871
9872 !! test
9873 Namespace -1 {{ns:-1}}
9874 !! wikitext
9875 {{ns:-1}}
9876 !! html
9877 <p>Special
9878 </p>
9879 !! end
9880
9881 !! test
9882 Namespace User {{ns:User}}
9883 !! wikitext
9884 {{ns:User}}
9885 !! html
9886 <p>User
9887 </p>
9888 !! end
9889
9890 !! test
9891 Namespace User talk {{ns:User_talk}}
9892 !! wikitext
9893 {{ns:User_talk}}
9894 !! html
9895 <p>User talk
9896 </p>
9897 !! end
9898
9899 !! test
9900 Namespace User talk {{ns:uSeR tAlK}}
9901 !! wikitext
9902 {{ns:uSeR tAlK}}
9903 !! html
9904 <p>User talk
9905 </p>
9906 !! end
9907
9908 !! test
9909 Namespace File {{ns:File}}
9910 !! wikitext
9911 {{ns:File}}
9912 !! html
9913 <p>File
9914 </p>
9915 !! end
9916
9917 !! test
9918 Namespace File {{ns:Image}}
9919 !! wikitext
9920 {{ns:Image}}
9921 !! html
9922 <p>File
9923 </p>
9924 !! end
9925
9926 !! test
9927 Namespace (lang=de) Benutzer {{ns:User}}
9928 !! options
9929 language=de
9930 !! wikitext
9931 {{ns:User}}
9932 !! html
9933 <p>Benutzer
9934 </p>
9935 !! end
9936
9937 !! test
9938 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
9939 !! options
9940 language=de
9941 !! wikitext
9942 {{ns:3}}
9943 !! html
9944 <p>Benutzer Diskussion
9945 </p>
9946 !! end
9947
9948
9949 !! test
9950 Urlencode
9951 !! wikitext
9952 {{urlencode:hi world?!}}
9953 {{urlencode:hi world?!|WIKI}}
9954 {{urlencode:hi world?!|PATH}}
9955 {{urlencode:hi world?!|QUERY}}
9956 !! html
9957 <p>hi+world%3F%21
9958 hi_world%3F!
9959 hi%20world%3F%21
9960 hi+world%3F%21
9961 </p>
9962 !! end
9963
9964 !! test
9965 Magic Word: prioritize type info over data-parsoid
9966 !! options
9967 parsoid=html2wt
9968 !! html/parsoid
9969 <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
9970 !! wikitext
9971 __FORCETOC__
9972 !! end
9973
9974 !! test
9975 Magic Word: serialize on separate line (parsoid)
9976 !! options
9977 parsoid=wt2wt,html2wt
9978 !! wikitext
9979 foo
9980 __NOTOC__
9981 bar
9982 !! html/parsoid
9983 foo<meta property="mw:PageProp/notoc"/>bar
9984 !! end
9985
9986 !! test
9987 Magic Word: rt non-english wikis
9988 !! options
9989 parsoid=wt2wt
9990 language=de
9991 !! wikitext
9992 __NOEDITSECTION__
9993 !! html/parsoid
9994 <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
9995 !! end
9996
9997 !!test
9998 __proto__ is treated as normal wikitext (T105997)
9999 !!wikitext
10000 __proto__
10001 !!html
10002 <p>__proto__
10003 </p>
10004 !!end
10005
10006 ###
10007 ### Magic links
10008 ###
10009 !! test
10010 Magic links: internal link to RFC (bug 479)
10011 !! wikitext
10012 [[RFC 123]]
10013 !! html/php
10014 <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>
10015 </p>
10016 !! html/parsoid
10017 <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
10018 !! end
10019
10020 !! test
10021 Magic links: RFC (bug 479)
10022 !! wikitext
10023 RFC 822
10024 !! html/php
10025 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10026 </p>
10027 !! html/parsoid
10028 <p><a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a></p>
10029 !! end
10030
10031 !! test
10032 Magic links: RFC (bug 65278)
10033 !! wikitext
10034 This is RFC 822 but thisRFC 822 is not RFC 822linked.
10035 !! html/php
10036 <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.
10037 </p>
10038 !! html/parsoid
10039 <p>This is <a href="//tools.ietf.org/html/rfc822" rel="mw:ExtLink">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
10040 !! end
10041
10042 !! test
10043 Magic links: RFC (w/ non-newline whitespace, bug 28950/29025)
10044 !! wikitext
10045 RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
10046 RFC
10047 822
10048 !! html/php
10049 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
10050 RFC
10051 822
10052 </p>
10053 !! html/parsoid
10054 <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>
10055 RFC
10056 822</p>
10057 !! end
10058
10059 !! test
10060 Magic links: ISBN (bug 1937)
10061 !! wikitext
10062 ISBN 0-306-40615-2
10063 !! html/php
10064 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
10065 </p>
10066 !! html/parsoid
10067 <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
10068 !! end
10069
10070 !! test
10071 Magic links: ISBN (bug 65278)
10072 !! wikitext
10073 This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
10074 !! html/php
10075 <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.
10076 </p>
10077 !! html/parsoid
10078 <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>
10079 !! end
10080
10081 !! test
10082 Magic links: ISBN (w/ non-newline whitespace, bug 28950/29025)
10083 !! wikitext
10084 ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
10085 ISBN
10086 9780316098113
10087 ISBN 978
10088 0316098113
10089 !! html/php
10090 <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
10091 ISBN
10092 9780316098113
10093 ISBN 978
10094 0316098113
10095 </p>
10096 !! html/parsoid
10097 <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>
10098 ISBN
10099 9780316098113
10100 ISBN 978
10101 0316098113</p>
10102 !! end
10103
10104 !! test
10105 Magic links: PMID incorrectly converts space to underscore
10106 !! wikitext
10107 PMID 1234
10108 !! html/php
10109 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10110 </p>
10111 !! html/parsoid
10112 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink">PMID 1234</a></p>
10113 !! end
10114
10115 !! test
10116 Magic links: PMID (bug 65278)
10117 !! wikitext
10118 This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
10119 !! html/php
10120 <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.
10121 </p>
10122 !! html/parsoid
10123 <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>
10124 !! end
10125
10126 !! test
10127 Magic links: PMID (w/ non-newline whitespace, bug 28950/29025)
10128 !! wikitext
10129 PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
10130 PMID
10131 1234
10132 !! html/php
10133 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
10134 PMID
10135 1234
10136 </p>
10137 !! html/parsoid
10138 <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>
10139 PMID
10140 1234</p>
10141 !! end
10142
10143 # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
10144 # since these are ExtLinkText, not MagicLinkText
10145 !! test
10146 Magic links: use appropriate serialization for "almost" magic links.
10147 !! wikitext
10148 X[[Special:BookSources/0978739256|foo]]
10149
10150 X[//tools.ietf.org/html/rfc1234 foo]
10151 !! html/php
10152 <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
10153 </p><p>X<a rel="nofollow" class="external text" href="//tools.ietf.org/html/rfc1234">foo</a>
10154 </p>
10155 !! html/parsoid
10156 <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
10157 <p>X<a rel="mw:ExtLink" href="//tools.ietf.org/html/rfc1234">foo</a></p>
10158 !! end
10159
10160 ###
10161 ### Templates
10162 ####
10163
10164 !! test
10165 Nonexistent template
10166 !! wikitext
10167 {{thistemplatedoesnotexist}}
10168 !! html
10169 <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>
10170 </p>
10171 !! end
10172
10173 !! test
10174 Template with invalid target containing tags
10175 !! wikitext
10176 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10177 !! html
10178 <p>{{a<b>b</b>|foo|a=b|a = b}}
10179 </p>
10180 !! end
10181
10182 !! test
10183 Template with invalid target containing unclosed tag
10184 !! wikitext
10185 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
10186 !! html
10187 <p>{{a<b>|foo|a=b|a = b}}</b>
10188 </p>
10189 !! end
10190
10191 !! test
10192 Template with invalid target containing wikilink
10193 !! wikitext
10194 {{[[Main Page]]}}
10195 !! html/php
10196 <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
10197 </p>
10198 !! html/parsoid
10199 <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>
10200 !! end
10201
10202 !! test
10203 Template with just whitespace in it, bug #68421
10204 !! wikitext
10205 {{echo|{{ }}}}
10206 !! html/parsoid
10207 <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>
10208 !! end
10209
10210 !! article
10211 Template:test
10212 !! text
10213 This is a test template
10214 !! endarticle
10215
10216 !! test
10217 Simple template
10218 !! wikitext
10219 {{test}}
10220 !! html
10221 <p>This is a test template
10222 </p>
10223 !! end
10224
10225 !! test
10226 Template with explicit namespace
10227 !! wikitext
10228 {{Template:test}}
10229 !! html
10230 <p>This is a test template
10231 </p>
10232 !! end
10233
10234
10235 !! article
10236 Template:paramtest
10237 !! text
10238 This is a test template with parameter {{{param}}}
10239 !! endarticle
10240
10241 !! test
10242 Template parameter
10243 !! wikitext
10244 {{paramtest|param=foo}}
10245 !! html
10246 <p>This is a test template with parameter foo
10247 </p>
10248 !! end
10249
10250 !! article
10251 Template:paramtestnum
10252 !! text
10253 [[{{{1}}}|{{{2}}}]]
10254 !! endarticle
10255
10256 !! test
10257 Template unnamed parameter
10258 !! wikitext
10259 {{paramtestnum|Main Page|the main page}}
10260 !! html
10261 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
10262 </p>
10263 !! end
10264
10265 !! article
10266 Template:templatesimple
10267 !! text
10268 (test)
10269 !! endarticle
10270
10271 !! article
10272 Template:templateredirect
10273 !! text
10274 #redirect [[Template:templatesimple]]
10275 !! endarticle
10276
10277 !! article
10278 Template:templateasargtestnum
10279 !! text
10280 {{{{{1}}}}}
10281 !! endarticle
10282
10283 !! article
10284 Template:templateasargtest
10285 !! text
10286 {{template{{{templ}}}}}
10287 !! endarticle
10288
10289 !! article
10290 Template:templateasargtest2
10291 !! text
10292 {{{{{templ}}}}}
10293 !! endarticle
10294
10295 !! test
10296 Template with template name as unnamed argument
10297 !! wikitext
10298 {{templateasargtestnum|templatesimple}}
10299 !! html
10300 <p>(test)
10301 </p>
10302 !! end
10303
10304 !! test
10305 Template with template name as argument
10306 !! wikitext
10307 {{templateasargtest|templ=simple}}
10308 !! html
10309 <p>(test)
10310 </p>
10311 !! end
10312
10313 !! test
10314 Template with template name as argument (2)
10315 !! wikitext
10316 {{templateasargtest2|templ=templatesimple}}
10317 !! html
10318 <p>(test)
10319 </p>
10320 !! end
10321
10322 !! article
10323 Template:templateasargtestdefault
10324 !! text
10325 {{{{{templ|templatesimple}}}}}
10326 !! endarticle
10327
10328 !! article
10329 Template:templa
10330 !! text
10331 '''templ'''
10332 !! endarticle
10333
10334 !! test
10335 Template with default value
10336 !! wikitext
10337 {{templateasargtestdefault}}
10338 !! html
10339 <p>(test)
10340 </p>
10341 !! end
10342
10343 !! test
10344 Template with default value (value set)
10345 !! wikitext
10346 {{templateasargtestdefault|templ=templa}}
10347 !! html
10348 <p><b>templ</b>
10349 </p>
10350 !! end
10351
10352 !! test
10353 Template redirect
10354 !! wikitext
10355 {{templateredirect}}
10356 !! html/php
10357 <p>(test)
10358 </p>
10359 !! html/parsoid
10360 <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
10361 !! end
10362
10363 !! test
10364 Template with argument in separate line
10365 !! wikitext
10366 {{ templateasargtest |
10367 templ = simple }}
10368 !! html
10369 <p>(test)
10370 </p>
10371 !! end
10372
10373 !! test
10374 Template with complex template as argument
10375 !! wikitext
10376 {{paramtest|
10377 param ={{ templateasargtest |
10378 templ = simple }}}}
10379 !! html
10380 <p>This is a test template with parameter (test)
10381 </p>
10382 !! end
10383
10384 !! test
10385 Template with thumb image (with link in description)
10386 !! wikitext
10387 {{paramtest|param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
10388 !! html/php
10389 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>
10390
10391 !! html+tidy
10392 <p>This is a test template with parameter</p>
10393 <div class="thumb tright">
10394 <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>
10395 <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>
10396 </div>
10397 </div>
10398 !! html/parsoid
10399 <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>
10400 !! end
10401
10402 !! article
10403 Template:complextemplate
10404 !! text
10405 {{{1}}} {{paramtest|
10406 param ={{{param}}}}}
10407 !! endarticle
10408
10409 !! test
10410 Template with complex arguments
10411 !! wikitext
10412 {{complextemplate|
10413 param ={{ templateasargtest |
10414 templ = simple }}|[[Template:complextemplate|link]]}}
10415 !! html
10416 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
10417 </p>
10418 !! end
10419
10420 !! test
10421 BUG 553: link with two variables in a piped link
10422 !! wikitext
10423 {|
10424 |[[{{{1}}}|{{{2}}}]]
10425 |}
10426 !! html/php
10427 <table>
10428 <tr>
10429 <td>[[{{{1}}}|{{{2}}}]]
10430 </td></tr></table>
10431
10432 !! html/parsoid
10433 <table>
10434 <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>
10435 !! end
10436
10437 # See: T2553
10438 !! test
10439 Abort table cell attribute parsing on wikilink
10440 !! wikitext
10441 {|
10442 | testing [[one|two]] | three || four
10443 | testing one two | three || four
10444 |}
10445 !! html/php
10446 <table>
10447 <tr>
10448 <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>
10449 <td> four
10450 </td>
10451 <td> three </td>
10452 <td> four
10453 </td></tr></table>
10454
10455 !! html/parsoid
10456 <table>
10457 <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>
10458 <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>
10459 </tbody></table>
10460 !! end
10461
10462 !! test
10463 Don't abort table cell attribute parsing if wikilink is found in template arg
10464 !! wikitext
10465 {|
10466 | Test {{#tag:ref|One two "[[three]]" four}}
10467 |}
10468 !! html/parsoid
10469 <table>
10470 <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>
10471 </tbody></table>
10472 !! end
10473
10474 !! test
10475 Magic variable as template parameter
10476 !! wikitext
10477 {{paramtest|param={{SITENAME}}}}
10478 !! html
10479 <p>This is a test template with parameter MediaWiki
10480 </p>
10481 !! end
10482
10483 !! article
10484 Template:linktest
10485 !! text
10486 [[{{{param}}}|link]]
10487 !! endarticle
10488
10489 !! test
10490 Template parameter as link source
10491 !! wikitext
10492 {{linktest|param=Main Page}}
10493 !! html
10494 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
10495 </p>
10496 !! end
10497
10498 !!article
10499 Template:paramtest2
10500 !! text
10501 including another template, {{paramtest|param={{{arg}}}}}
10502 !! endarticle
10503
10504 !! test
10505 Template passing argument to another template
10506 !! wikitext
10507 {{paramtest2|arg='hmm'}}
10508 !! html
10509 <p>including another template, This is a test template with parameter 'hmm'
10510 </p>
10511 !! end
10512
10513 !! article
10514 Template:Linktest2
10515 !! text
10516 Main Page
10517 !! endarticle
10518
10519 !! test
10520 Template as link source
10521 !! wikitext
10522 [[{{linktest2}}]]
10523
10524 [[{{linktest2}}|Main Page]]
10525
10526 [[{{linktest2}}]]Page
10527 !! html
10528 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10529 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
10530 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
10531 </p>
10532 !! end
10533
10534
10535 !! article
10536 Template:loop1
10537 !! text
10538 {{loop2}}
10539 !! endarticle
10540
10541 !! article
10542 Template:loop2
10543 !! text
10544 {{loop1}}
10545 !! endarticle
10546
10547 !! test
10548 Template infinite loop
10549 !! wikitext
10550 {{loop1}}
10551 !! html
10552 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
10553 </p>
10554 !! end
10555
10556 !! test
10557 Template from main namespace
10558 !! wikitext
10559 {{:Main Page}}
10560 !! html
10561 <p>blah blah
10562 </p>
10563 !! end
10564
10565 !! article
10566 Template:table
10567 !! text
10568 {|
10569 | 1 || 2
10570 |-
10571 | 3 || 4
10572 |}
10573 !! endarticle
10574
10575 !! test
10576 BUG 529: Template with table, not included at beginning of line
10577 !! wikitext
10578 foo {{table}}
10579 !! html
10580 <p>foo
10581 </p>
10582 <table>
10583 <tr>
10584 <td> 1 </td>
10585 <td> 2
10586 </td></tr>
10587 <tr>
10588 <td> 3 </td>
10589 <td> 4
10590 </td></tr></table>
10591
10592 !! end
10593
10594 !! test
10595 BUG 523: Template shouldn't eat newline (or add an extra one before table)
10596 !! wikitext
10597 foo
10598 {{table}}
10599 !! html
10600 <p>foo
10601 </p>
10602 <table>
10603 <tr>
10604 <td> 1 </td>
10605 <td> 2
10606 </td></tr>
10607 <tr>
10608 <td> 3 </td>
10609 <td> 4
10610 </td></tr></table>
10611
10612 !! end
10613
10614 !! test
10615 BUG 41: Template parameters shown as broken links
10616 !! wikitext
10617 {{{parameter}}}
10618 !! html
10619 <p>{{{parameter}}}
10620 </p>
10621 !! end
10622
10623 !! test
10624 Template with targets containing wikilinks
10625 !! wikitext
10626 {{[[foo]]}}
10627
10628 {{[[{{echo|foo}}]]}}
10629
10630 {{{{echo|[[foo}}]]}}
10631 !! html
10632 <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10633 </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
10634 </p><p>{{[[foo}}]]
10635 </p>
10636 !! end
10637
10638 !! article
10639 Template:''
10640 !! text
10641 bar
10642 !! endarticle
10643
10644 !! test
10645 Templates: Double quotes as template target
10646 !! wikitext
10647 foo {{''}} baz
10648 !! html/php
10649 <p>foo bar baz
10650 </p>
10651 !! html/parsoid
10652 <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
10653 </p>
10654 !! end
10655
10656 !! article
10657 Template:MSGNW test
10658 !! text
10659 ''None'' of '''this''' should be
10660 * interpreted
10661 but rather passed unmodified
10662 {{test}}
10663 <gallery>
10664 File:Foobar.jpg
10665 </gallery>
10666 <!-- comment -->
10667 !! endarticle
10668
10669 # hmm, fix this or just deprecate msgnw and document its behavior?
10670 !! test
10671 msgnw keyword
10672 !! wikitext
10673 {{msgnw:MSGNW test}}
10674 !! html/php
10675 <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
10676 &#42; interpreted
10677 &#32;but rather passed unmodified
10678 &#123;&#123;test&#125;&#125;
10679 &#60;gallery&#62;
10680 File:Foobar.jpg
10681 &#60;/gallery&#62;
10682 &#60;!-- comment --&#62;
10683 </p>
10684 !! end
10685
10686 !! test
10687 int keyword
10688 !! wikitext
10689 {{int:youhavenewmessages|lots of money|not!}}
10690 !! html
10691 <p>You have lots of money (not!).
10692 </p>
10693 !! end
10694
10695 !! test
10696 int keyword - non-existing message
10697 !! wikitext
10698 {{int:var}}
10699 !! html
10700 <p>&lt;var&gt;
10701 </p>
10702 !! end
10703
10704 !! article
10705 Template:Includes
10706 !! text
10707 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10708 !! endarticle
10709
10710 !! test
10711 <includeonly> and <noinclude> being included
10712 !! wikitext
10713 {{Includes}}
10714 !! html
10715 <p>Foobar
10716 </p>
10717 !! end
10718
10719 !! article
10720 Template:Includes2
10721 !! text
10722 <onlyinclude>Foo</onlyinclude>bar
10723 !! endarticle
10724
10725 !! test
10726 <onlyinclude> being included
10727 !! wikitext
10728 {{Includes2}}
10729 !! html
10730 <p>Foo
10731 </p>
10732 !! end
10733
10734
10735 !! article
10736 Template:Includes3
10737 !! text
10738 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
10739 !! endarticle
10740
10741 !! test
10742 <onlyinclude> and <includeonly> being included
10743 !! wikitext
10744 {{Includes3}}
10745 !! html
10746 <p>Foo
10747 </p>
10748 !! end
10749
10750 !! test
10751 <includeonly> and <noinclude> on a page
10752 !! wikitext
10753 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
10754 !! html
10755 <p>Foozar
10756 </p>
10757 !! end
10758
10759 !! test
10760 Un-closed <noinclude>
10761 !! wikitext
10762 <noinclude>
10763 !! html
10764 !! end
10765
10766 !! test
10767 <onlyinclude> on a page
10768 !! wikitext
10769 <onlyinclude>Foo</onlyinclude>bar
10770 !! html
10771 <p>Foobar
10772 </p>
10773 !! end
10774
10775 !! test
10776 Un-closed <onlyinclude>
10777 !! wikitext
10778 <onlyinclude>
10779 !! html
10780 !! end
10781
10782 !!test
10783 Self-closed noinclude, includeonly, onlyinclude tags
10784 !! wikitext
10785 <noinclude />
10786 <includeonly />
10787 <onlyinclude />
10788 !! html
10789 <p><br />
10790 </p>
10791 !!end
10792
10793 !!test
10794 Unbalanced includeonly and noinclude tags
10795 !! wikitext
10796 {|
10797 |a</noinclude>
10798 |b</noinclude></noinclude>
10799 |c</noinclude></includeonly>
10800 |d</includeonly></includeonly>
10801 |}
10802 !! html
10803 <table>
10804 <tr>
10805 <td>a
10806 </td>
10807 <td>b
10808 </td>
10809 <td>c&lt;/includeonly&gt;
10810 </td>
10811 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
10812 </td></tr></table>
10813
10814 !!end
10815
10816 !! article
10817 Template:Includeonly section
10818 !! text
10819 <includeonly>
10820 ==Includeonly section==
10821 </includeonly>
10822 ==Section T-1==
10823 !!endarticle
10824
10825 !! test
10826 Bug 6563: Edit link generation for section shown by <includeonly>
10827 !! wikitext
10828 {{includeonly section}}
10829 !! html
10830 <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>
10831 <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>
10832
10833 !! end
10834
10835 # Uses same input as the contents of [[Template:Includeonly section]]
10836 !! test
10837 Bug 6563: Section extraction for section shown by <includeonly>
10838 !! options
10839 section=T-2
10840 !! wikitext
10841 <includeonly>
10842 ==Includeonly section==
10843 </includeonly>
10844 ==Section T-2==
10845 !! html
10846 ==Section T-2==
10847 !! end
10848
10849 !! test
10850 Bug 6563: Edit link generation for section suppressed by <includeonly>
10851 !! wikitext
10852 <includeonly>
10853 ==Includeonly section==
10854 </includeonly>
10855 ==Section 1==
10856 !! html
10857 <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>
10858
10859 !! end
10860
10861 !! test
10862 Bug 6563: Section extraction for section suppressed by <includeonly>
10863 !! options
10864 section=1
10865 !! wikitext
10866 <includeonly>
10867 ==Includeonly section==
10868 </includeonly>
10869 ==Section 1==
10870 !! html
10871 ==Section 1==
10872 !! end
10873
10874 !! test
10875 Un-closed <includeonly>
10876 !! wikitext
10877 <includeonly>
10878 !! html
10879 !! end
10880
10881 ## We used to, but no longer wt2wt this test since the default serializer
10882 ## will normalize the include directives to serialize on their own line.
10883 ## Selser will take care of preserving formatting in scenarios where they
10884 ## intermingled with other wikitext.
10885 !! test
10886 Includes and comments at SOL
10887 !! options
10888 parsoid=wt2html,html2html
10889 !! wikitext
10890 <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->== hu ==
10891
10892 <noinclude>
10893 some
10894 </noinclude>* stuff
10895 * here
10896
10897 <includeonly>can have stuff</includeonly>=== here ===
10898
10899 !! html/php
10900 <h2><span class="mw-headline" id="hu">hu</span></h2>
10901 <p>some
10902 </p>
10903 <ul><li> stuff</li>
10904 <li> here</li></ul>
10905 <h3><span class="mw-headline" id="here">here</span></h3>
10906
10907 !! html/parsoid
10908 <!-- 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>
10909
10910 <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
10911 <p>some</p>
10912 <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li> stuff</li>
10913 <li> here</li></ul>
10914
10915 <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>
10916
10917 !! end
10918
10919 # TODO: test with DOM fragment reuse!
10920 !! test
10921 Parsoid: DOM fragment reuse
10922 !! options
10923 parsoid=wt2wt,wt2html
10924 !! wikitext
10925 a{{echo|b<table></table>c}}d
10926
10927 a{{echo|b
10928 <table></table>
10929 c}}d
10930
10931 {{echo|a
10932
10933 <table></table>
10934
10935 b}}
10936 !! html
10937 <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>
10938
10939 <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">
10940 </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
10941 </span><p about="#mwt2">cd</p>
10942
10943 <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">
10944
10945 </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
10946
10947 </span><p about="#mwt3">b</p>
10948 !! end
10949
10950 !! test
10951 Parsoid: Merge double tds (T52603)
10952 !! options
10953 parsoid
10954 !! wikitext
10955 {|
10956 |{{echo|{{!}} foo}}
10957 |}
10958 !! html
10959 <table><tbody>
10960 <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>
10961 </tbody></table>
10962 !! end
10963
10964 !! test
10965 Parsoid: Merge double tds in nested transclusion content (T52603)
10966 !! options
10967 parsoid
10968 !! wikitext
10969 {{echo|<div>}}
10970 {|
10971 |{{echo|{{!}} foo}}
10972 |}
10973 {{echo|</div>}}
10974 !! html
10975 <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}}]}'>
10976 <table><tbody>
10977 <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
10978 </tbody></table>
10979 </div>
10980 !! end
10981
10982 ###
10983 ### <includeonly> and <noinclude> in attributes
10984 ###
10985 !!test
10986 0. includeonly around the entire attribute
10987 !! wikitext
10988 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
10989 !! html
10990 <p><span id="v2">bar</span>
10991 </p>
10992 !!end
10993
10994 !!test
10995 1. includeonly in html attr key
10996 !! wikitext
10997 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
10998 !! html
10999 <p><span id="foo">bar</span>
11000 </p>
11001 !!end
11002
11003 !!test
11004 2. includeonly in html attr value
11005 !! wikitext
11006 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
11007 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
11008 !! html
11009 <p><span id="v1">bar</span>
11010 <span id="v1">bar</span>
11011 </p>
11012 !!end
11013
11014 !!test
11015 3. includeonly in part of an attr value
11016 !! wikitext
11017 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
11018 !! html
11019 <p><span style="color:red;">bar</span>
11020 </p>
11021 !!end
11022
11023 !!test
11024 4. includeonly in table attributes
11025 !! wikitext
11026 {|
11027 |- <noinclude>
11028 |-
11029 |a
11030 </noinclude>
11031 |- <includeonly>
11032 |-
11033 |b
11034 </includeonly>
11035 |}
11036 !! html
11037 <table>
11038
11039
11040 <tr>
11041 <td>a
11042 </td></tr>
11043 </table>
11044
11045 !!end
11046
11047 ###
11048 ### Token Stream Patcher tests
11049 ###
11050 ### These tests won't always pass wt2wt and other modes because
11051 ### on serialization, the table will be output on a new line.
11052 ### For now, we are blacklisting them, and using this to test selser.
11053 ###
11054
11055 !!test
11056 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
11057 !!options
11058 parsoid=wt2html,wt2wt
11059 !!wikitext
11060 {{echo|}}{| width = '100%'
11061 |foo
11062 |}
11063 !!html/parsoid
11064 <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
11065 <tbody><tr><td>foo</td></tr>
11066 </tbody></table>
11067 !!end
11068
11069 ## We used to, but no longer wt2wt this test since the default serializer
11070 ## will normalize the include directives to serialize on their own line.
11071 ## Selser will take care of preserving formatting in scenarios where they
11072 ## intermingled with other wikitext.
11073 !!test
11074 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
11075 !!options
11076 parsoid=wt2html
11077 !!wikitext
11078 <includeonly>a</includeonly>{| {{{b}}}
11079 |c
11080 |}
11081 !!html/parsoid
11082 <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}}}":""}}'>
11083 <tbody><tr><td>c</td></tr>
11084 </tbody></table>
11085
11086 !!end
11087
11088 ###
11089 ### Testing parsing of templates where a template arg
11090 ### has the same name as the template itself.
11091 ###
11092
11093 !! article
11094 Template:quote
11095 !! text
11096 {{{quote|{{{1}}}}}}
11097 !! endarticle
11098
11099 !!test
11100 Templates: Template Name/Arg clash: 1. Use of positional param
11101 !! wikitext
11102 {{quote|foo}}
11103 !! html
11104 <p>foo
11105 </p>
11106 !!end
11107
11108 !!test
11109 Templates: Template Name/Arg clash: 2. Use of named param
11110 !! wikitext
11111 {{quote|quote=foo}}
11112 !! html
11113 <p>foo
11114 </p>
11115 !!end
11116
11117 !!test
11118 Templates: Template Name/Arg clash: 3. Use of named param with empty input
11119 !! wikitext
11120 {{quote|quote}}
11121 !! html
11122 <p>quote
11123 </p>
11124 !!end
11125
11126 ###
11127 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
11128 ###
11129
11130 !!test
11131 Templates: 1. Simple use
11132 !! wikitext
11133 {{echo|Foo}}
11134 !! html
11135 <p>Foo
11136 </p>
11137 !!end
11138
11139 !!test
11140 Templates: 2. Inside a block tag
11141 !! wikitext
11142 <div>{{echo|Foo}}</div>
11143 <blockquote>{{echo|Foo}}</blockquote>
11144 !! html
11145 <div>Foo</div>
11146 <blockquote>Foo</blockquote>
11147
11148 !! html+tidy
11149 <div>Foo</div>
11150 <blockquote>
11151 <p>Foo</p>
11152 </blockquote>
11153 !!end
11154
11155 !!test
11156 Templates: P-wrapping: 1a. Templates on consecutive lines
11157 !! wikitext
11158 {{echo|Foo}}
11159 {{echo|bar}}
11160 !! html
11161 <p>Foo
11162 bar
11163 </p>
11164 !!end
11165
11166 !!test
11167 Templates: P-wrapping: 1b. Templates on consecutive lines
11168 !! wikitext
11169 Foo
11170
11171 {{echo|bar}}
11172 {{echo|baz}}
11173 !! html
11174 <p>Foo
11175 </p><p>bar
11176 baz
11177 </p>
11178 !!end
11179
11180 !!test
11181 Templates: P-wrapping: 1c. Templates on consecutive lines
11182 !! wikitext
11183 {{echo|Foo}}
11184 {{echo|bar}} <div>baz</div>
11185 !! html
11186 <p>Foo
11187 </p>
11188 bar <div>baz</div>
11189
11190 !! html+tidy
11191 <p>Foo</p>
11192 <p>bar</p>
11193 <div>baz</div>
11194 !! end
11195
11196 !!test
11197 Templates: P-wrapping: 1d. Template preceded by comment-only line
11198 !!options
11199 parsoid
11200 !! wikitext
11201 <!-- foo -->
11202 {{echo|Bar}}
11203 !! html
11204 <!-- foo -->
11205
11206 <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
11207 !!end
11208
11209 !!test
11210 Templates: Inline Text: 1. Multiple template uses
11211 !! wikitext
11212 {{echo|Foo}}bar{{echo|baz}}
11213 !! html
11214 <p>Foobarbaz
11215 </p>
11216 !!end
11217
11218 !!test
11219 Templates: Inline Text: 2. Back-to-back template uses
11220 !! wikitext
11221 {{echo|Foo}}{{echo|bar}}
11222 !! html
11223 <p>Foobar
11224 </p>
11225 !!end
11226
11227 !!test
11228 Templates: Block Tags: 1. Multiple template uses
11229 !! wikitext
11230 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
11231 !! html
11232 <div>Foo</div><div>bar</div><div>baz</div>
11233
11234 !!end
11235
11236 !!test
11237 Templates: Block Tags: 2. Back-to-back template uses
11238 !! wikitext
11239 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
11240 !! html
11241 <div>Foo</div><div>bar</div>
11242
11243 !!end
11244
11245 # This is an edge case relating to paragraph wrapping.
11246 !!test
11247 Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
11248 !! wikitext
11249 {{echo|a
11250 b</p>}}
11251 !! html/parsoid
11252 <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
11253 b</p>
11254 !!end
11255
11256 !!test
11257 Templates: Links: 1. Simple example
11258 !! wikitext
11259 {{echo|[[Foo|bar]]}}
11260 !! html
11261 <p><a href="/wiki/Foo" title="Foo">bar</a>
11262 </p>
11263 !!end
11264
11265 !!test
11266 Templates: Links: 2. Generation of link href
11267 !! wikitext
11268 [[{{echo|Foo}}|bar]]
11269 !! html
11270 <p><a href="/wiki/Foo" title="Foo">bar</a>
11271 </p>
11272 !!end
11273
11274 !!test
11275 Templates: Links: 3. Generation of part of a link href
11276 !! wikitext
11277 [[Fo{{echo|o}}|bar]]
11278
11279 [[Foo{{echo|bar}}]]
11280
11281 [[Foo{{echo|bar}}baz]]
11282
11283 [[Foo{{echo|bar}}|bar]]
11284
11285 [[:Foo{{echo|bar}}]]
11286
11287 [[:Foo{{echo|bar}}|bar]]
11288 !! html
11289 <p><a href="/wiki/Foo" title="Foo">bar</a>
11290 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11291 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
11292 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11293 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11294 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
11295 </p>
11296 !!end
11297
11298 !!test
11299 Templates: Links: 4. Multiple templates generating link href
11300 !! wikitext
11301 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
11302 !! html
11303 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
11304 </p>
11305 !!end
11306
11307 !!test
11308 Templates: Links: 5. Generation of link text
11309 !! wikitext
11310 [[Foo|{{echo|bar}}]]
11311 !! html
11312 <p><a href="/wiki/Foo" title="Foo">bar</a>
11313 </p>
11314 !!end
11315
11316 !!test
11317 Templates: Links: 5. Nested templates (only outermost template should be marked)
11318 !! wikitext
11319 {{echo|[[{{echo|Foo}}|bar]]}}
11320 !! html
11321 <p><a href="/wiki/Foo" title="Foo">bar</a>
11322 </p>
11323 !!end
11324
11325 !!test
11326 Templates: HTML Tag: 1. Generation of HTML attr. key
11327 !! wikitext
11328 <div {{echo|style}}="color:red;">foo</div>
11329 !! html
11330 <div style="color:red;">foo</div>
11331
11332 !!end
11333
11334 !!test
11335 Templates: HTML Tag: 2. Generation of HTML attr. value
11336 !! wikitext
11337 <div style={{echo|'color:red;'}}>foo</div>
11338 !! html
11339 <div style="color:red;">foo</div>
11340
11341 !!end
11342
11343 !!test
11344 Templates: HTML Tag: 3. Generation of HTML attr key and value
11345 !! wikitext
11346 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
11347 !! html
11348 <div style="color:red;">foo</div>
11349
11350 !!end
11351
11352 !!test
11353 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
11354 !! wikitext
11355 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
11356 !! html
11357 <div title="This is a long title with just one piece templated">foo</div>
11358
11359 !!end
11360
11361 !!test
11362 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
11363 !! wikitext
11364 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
11365 !! html
11366 <div title="This is a long title with just one piece templated">foo</div>
11367
11368 !!end
11369
11370 !!test
11371 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
11372 !! wikitext
11373 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
11374 !! html
11375 <div title="This is a long title with just one piece templated">foo</div>
11376
11377 !!end
11378
11379 # SSS FIXME: While it is great we added support for all this,
11380 # do we want to make this part of the spec? Maybe we want to
11381 # deprecate this kind of usage in the future?
11382 !!test
11383 Templates: HTML Tag: 7. Generation of partial attribute key string
11384 !! wikitext
11385 <div st{{echo|yle}}="color:red;">foo</div>
11386 !! html
11387 <div style="color:red;">foo</div>
11388
11389 !!end
11390
11391 !! test
11392 Templates: HTML Tag: 8. Template-generated attribute (k=v)
11393 !! wikitext
11394 <div {{echo|1=id="v1"}}>bar</div>
11395 !! html
11396 <div id="v1">bar</div>
11397
11398 !!end
11399
11400 !! test
11401 Templates: HTML Tag: 9. Multiple template-generated attributes
11402 !! wikitext
11403 <div {{echo|1=id="v1" title="foo"}}>bar</div>
11404 !! html
11405 <div id="v1" title="foo">bar</div>
11406
11407 !!end
11408
11409 !! test
11410 Templates: Support for templates generating attributes and content
11411 !! wikitext
11412 {| {{mixed_attr_content_template}}
11413 |-
11414 |bar
11415 |}
11416 !! html/php
11417 <table style="color:red;" title="T48811">
11418
11419 <tr>
11420 <td>foo
11421 </td></tr>
11422 <tr>
11423 <td>bar
11424 </td></tr></table>
11425
11426 !! html/parsoid
11427 <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|}"]}'>
11428 <tbody><tr>
11429 <td>foo</td></tr>
11430 <tr>
11431 <td>bar</td></tr>
11432 </tbody></table>
11433 !!end
11434
11435 !! test
11436 1. Entities and nowikis inside templated attributes should be handled correctly
11437 !! wikitext
11438 <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
11439 !! html/php
11440 <div style="background:#f9f9f9;">foo</div>
11441
11442 !! html/parsoid
11443 <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>
11444 !! end
11445
11446 !! test
11447 2. Entities and nowikis inside templated attributes should be handled correctly
11448 !! wikitext
11449 {|
11450 |{{table_attribs_3}}
11451 |}
11452 !! html/php
11453 <table>
11454 <tr>
11455 <td style="background:#f9f9f9;">Foo
11456 </td></tr></table>
11457
11458 !! html/parsoid
11459 <table>
11460 <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>
11461 </tbody></table>
11462 !! end
11463
11464 !! test
11465 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11466 !! wikitext
11467 {{tbl-start}}
11468 |{{table_attribs_3}}
11469 {{tbl-end}}
11470 !! html/php
11471 <table>
11472 <tr>
11473 <td style="background:#f9f9f9;">Foo
11474 </td></tr></table>
11475
11476 !! html/parsoid
11477 <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}}]}'>
11478 <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
11479 </tbody></table>
11480 !! end
11481
11482 # T107622
11483 !! test
11484 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
11485 !! wikitext
11486 {|
11487 | {{table_attribs_6}} hi
11488 |}
11489 !! html/php
11490 <table>
11491 <tr>
11492 <td style="background: red;"> hi
11493 </td></tr></table>
11494
11495 !! html/parsoid
11496 <table>
11497 <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>
11498 </tbody></table>
11499 !! end
11500
11501 !!test
11502 Templates: HTML Tables: 1. Generating start of a HTML table
11503 !! wikitext
11504 {{echo|<table><tr><td>foo</td>}}</tr></table>
11505 !! html
11506 <table><tr><td>foo</td></tr></table>
11507
11508 !!end
11509
11510 !!test
11511 Templates: HTML Tables: 2a. Generating middle of a HTML table
11512 !! wikitext
11513 <table><tr>{{echo|<td>foo</td>}}</tr></table>
11514 !! html
11515 <table><tr><td>foo</td></tr></table>
11516
11517 !!end
11518
11519 !!test
11520 Templates: HTML Tables: 2b. Generating middle of a HTML table
11521 !! wikitext
11522 <table>{{echo|<tr><td>foo</td></tr>}}</table>
11523 !! html
11524 <table><tr><td>foo</td></tr></table>
11525
11526 !!end
11527
11528 !!test
11529 Templates: HTML Tables: 3. Generating end of a HTML table
11530 !! wikitext
11531 <table><tr>{{echo|<td>foo</td></tr></table>}}
11532 !! html
11533 <table><tr><td>foo</td></tr></table>
11534
11535 !!end
11536
11537 !!test
11538 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
11539 !! wikitext
11540 {{echo|<table>}}<tr><td>foo</td></tr></table>
11541 !! html
11542 <table><tr><td>foo</td></tr></table>
11543
11544 !!end
11545
11546 !!test
11547 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
11548 !! wikitext
11549 <table>{{echo|<tr>}}<td>foo</td></tr></table>
11550 !! html
11551 <table><tr><td>foo</td></tr></table>
11552
11553 !!end
11554
11555 !!test
11556 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
11557 !! wikitext
11558 <table><tr>{{echo|<td>}}foo</td></tr></table>
11559 !! html
11560 <table><tr><td>foo</td></tr></table>
11561
11562 !!end
11563
11564 !!test
11565 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
11566 !! wikitext
11567 <table><tr><td>foo{{echo|</td>}}</tr></table>
11568 !! html
11569 <table><tr><td>foo</td></tr></table>
11570
11571 !!end
11572
11573 !!test
11574 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
11575 !! wikitext
11576 <table><tr><td>foo</td>{{echo|</tr>}}</table>
11577 !! html
11578 <table><tr><td>foo</td></tr></table>
11579
11580 !!end
11581
11582 !!test
11583 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
11584 !! wikitext
11585 <table><tr><td>foo</td></tr>{{echo|</table>}}
11586 !! html
11587 <table><tr><td>foo</td></tr></table>
11588
11589 !!end
11590
11591 !!test
11592 Templates: HTML Tables: 5. Proper fostering of categories from inside
11593 !!options
11594 parsoid=wt2html,wt2wt
11595 !! wikitext
11596 <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
11597 <!--Two categories (Bug 50330)-->
11598 <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
11599 !! html
11600 <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
11601 <!--Two categories (Bug 50330)-->
11602 <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>
11603 !!end
11604
11605 !!test
11606 Templates: Wiki Tables: 1a. Fostering of entire template content
11607 !! wikitext
11608 {|
11609 {{echo|a}}
11610 |}
11611 !! html
11612 <table>
11613 a
11614 <tr><td></td></tr></table>
11615
11616 !! html+tidy
11617 <p>a</p>
11618 <table>
11619 <tr>
11620 <td></td>
11621 </tr>
11622 </table>
11623 !! end
11624
11625 !!test
11626 Templates: Wiki Tables: 1b. Fostering of entire template content
11627 !! wikitext
11628 {|
11629 {{echo|<div>}}
11630 foo
11631 {{echo|</div>}}
11632 |}
11633 !! html
11634 <table>
11635 <div>
11636 <p>foo
11637 </p>
11638 </div>
11639 <tr><td></td></tr></table>
11640
11641 !! html+tidy
11642 <div>
11643 <p>foo</p>
11644 </div>
11645 <table>
11646 <tr>
11647 <td></td>
11648 </tr>
11649 </table>
11650 !! end
11651
11652 !!test
11653 Templates: Wiki Tables: 2. Fostering of partial template content
11654 !! wikitext
11655 {|
11656 {{echo|a
11657 <div>b</div>}}
11658 |}
11659 !! html
11660 <table>
11661 a
11662 <div>b</div>
11663 <tr><td></td></tr></table>
11664
11665 !! html+tidy
11666 <p>a</p>
11667 <div>b</div>
11668 <table>
11669 <tr>
11670 <td></td>
11671 </tr>
11672 </table>
11673 !! end
11674
11675 !!test
11676 Templates: Wiki Tables: 3. td-content via multiple templates
11677 !! wikitext
11678 {|
11679 {{echo|{{pipe}}a}}{{echo|b}}
11680 |}
11681 !! html
11682 <table>
11683 <tr>
11684 <td>ab
11685 </td></tr></table>
11686
11687 !!end
11688
11689 !!test
11690 Templates: Wiki Tables: 4. Templated tags, no content
11691 !! wikitext
11692 {{tbl-start}}
11693 {{tbl-end}}
11694 !! html
11695 <table>
11696 <tr><td></td></tr></table>
11697
11698 !!end
11699
11700 !!test
11701 Templates: Wiki Tables: 5. Templated tags, regular td-tags
11702 !! wikitext
11703 {{tbl-start}}
11704 |foo
11705 {{tbl-end}}
11706 !! html
11707 <table>
11708 <tr>
11709 <td>foo
11710 </td></tr></table>
11711
11712 !!end
11713
11714 !!test
11715 Templates: Wiki Tables: 6. Templated tags, templated td-tags
11716 !! wikitext
11717 {{tbl-start}}
11718 {{!}}foo
11719 {{tbl-end}}
11720 !! html
11721 <table>
11722 <tr>
11723 <td>foo
11724 </td></tr></table>
11725
11726 !!end
11727
11728 ## This test case is very specific to Parsoid's internals
11729 ## and is hence only tested for Parsoid's code. Parsoid uses
11730 ## a <meta> marker tag for <ref> tags and they are expanded
11731 ## much later. We are verifying that this <meta> tag usage
11732 ## doesn't prevent foster parenting.
11733 !!test
11734 Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
11735 !!wikitext
11736 {{PartialTable}}<ref>foo</ref>
11737 |}
11738
11739 <references />
11740 !!html/parsoid
11741 <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">
11742 <tbody>
11743 </tbody></table>
11744
11745 <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>
11746 !!end
11747
11748 !! test
11749 Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
11750 !! wikitext
11751 {{echo|
11752 {{{!}}
11753 {{!}}-}}
11754 <onlyinclude>
11755 |foo
11756 </onlyinclude>
11757 {{!}}}
11758 !! html/parsoid
11759 <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{{!}}}"]}'>
11760 </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
11761 <tbody><tr>
11762
11763 <td>foo
11764 <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
11765 </tbody></table>
11766 !! end
11767
11768 !!test
11769 Templates: Lists: Multi-line list-items via templates
11770 !! wikitext
11771 *{{echo|a {{nonexistent|
11772 unused}}}}
11773 *{{echo|b {{nonexistent|
11774 unused}}}}
11775 !! html
11776 <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>
11777 <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>
11778
11779 !!end
11780
11781 !!test
11782 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
11783 !! wikitext
11784 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
11785 !! html
11786 <p><i>ab</i>c<i>d</i>e
11787 </p>
11788 !!end
11789
11790 !!test
11791 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
11792 (PHP parser generates misnested html)
11793 !! wikitext
11794 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
11795 !! html/parsoid
11796 <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>
11797 !!end
11798
11799 !!test
11800 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
11801 (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
11802 !! options
11803 parsoid=wt2html,wt2wt
11804 !! wikitext
11805 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
11806 !! html
11807 <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>
11808 <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>
11809 <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>
11810 !!end
11811
11812 !!test
11813 Templates: Ugly nesting: 4. Divs opened/closed across templates
11814 !! wikitext
11815 a<div>b{{echo|c</div>d}}e
11816 !! html
11817 a<div>bc</div>de
11818
11819 !! html+tidy
11820 <p>a</p>
11821 <div>bc</div>
11822 <p>de</p>
11823 !! end
11824
11825 !!test
11826 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
11827 (Parsoid-centric)
11828 !! options
11829 parsoid
11830 !! wikitext
11831 {|
11832 |{{echo|foo</table>}}
11833 |bar
11834 |}
11835 !! html
11836 <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|}"]}'>
11837
11838 <tbody>
11839 <tr>
11840 <td>foo</td></tr></tbody></table><span about="#mwt1">
11841 </span><span about="#mwt1">|bar</span><span about="#mwt1">
11842 |}</span>
11843 !!end
11844
11845 !!test
11846 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
11847 (Parsoid-centric)
11848 !! options
11849 parsoid
11850 !! wikitext
11851 <table>
11852 <tr>
11853 <td>
11854 <table>
11855 <tr>
11856 <td>1. {{echo|foo </table>}}</td>
11857 <td> bar </td>
11858 <td>2. {{echo|baz </table>}}</td>
11859 </tr>
11860 <tr>
11861 <td>abc</td>
11862 </tr>
11863 </table>
11864 </td>
11865 </tr>
11866 <tr>
11867 <td>xyz</td>
11868 </tr>
11869 </table>
11870 !! html
11871 <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>"]}'>
11872 <tbody><tr>
11873 <td>
11874 <table>
11875 <tbody><tr>
11876 <td>1. foo </td></tr></tbody></table></td>
11877 <td> bar </td>
11878 <td>2. baz </td></tr></tbody></table><span about="#mwt2">
11879 </span><span about="#mwt2">
11880 </span><span about="#mwt2">
11881 </span><span about="#mwt2">abc</span><span about="#mwt2">
11882 </span><span about="#mwt2">
11883 </span><span about="#mwt2">
11884 </span><span about="#mwt2">
11885 </span><span about="#mwt2">
11886 </span><span about="#mwt2">
11887 </span><span about="#mwt2">xyz</span><span about="#mwt2">
11888 </span><span about="#mwt2">
11889 </span>
11890 !!end
11891
11892 !! test
11893 Templates: Ugly templates: 3. newline-only template parameter
11894 !! wikitext
11895 foo {{echo|
11896 }}
11897 !! html
11898 <p>foo
11899 </p>
11900 !! end
11901
11902 # This looks like a bug: a single newline triggers p/br for some reason.
11903 !! test
11904 Templates: Ugly templates: 4. newline-only template parameter inconsistency
11905 !! wikitext
11906 {{echo|
11907 }}
11908 !! html
11909 <p><br />
11910 </p>
11911 !! end
11912
11913 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges that
11914 # have a true overlap (T1-start - T2-start - T1-end - T2-end).
11915 !! test
11916 Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
11917 !! wikitext
11918 {{echo|<table>}}
11919 {{echo|<div>foo}}
11920 {{echo|</table>}}
11921 !! html/parsoid
11922 <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
11923 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11924 </table>
11925 !! end
11926
11927 # Bug 64017 -- ugly wikitext with fostered content generates two template ranges
11928 # that are "identical" and generate nesting cycles in the algorithm
11929 !! test
11930 Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
11931 !! wikitext
11932 {{echo|<table><tr><td><table>}}
11933 {{echo|<div>}}
11934 {{echo|</div>}}
11935 !! html/parsoid
11936 <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"}'>
11937 </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
11938 </table></td></tr></tbody></table>
11939 !! end
11940
11941 !! test
11942 Templates: Parameters substituted at the top-level
11943 !! wikitext
11944 {{{foo|''who'' {{echo|me}}? '''never!'''}}}
11945 !! html/php
11946 <p><i>who</i> me? <b>never!</b>
11947 </p>
11948 !! html/parsoid
11949 <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>
11950 !! end
11951
11952 !!test
11953 Parser Functions: 1. Simple example
11954 !! wikitext
11955 {{uc:foo}}
11956 !! html
11957 <p>FOO
11958 </p>
11959 !!end
11960
11961 !!test
11962 Parser Functions: 2. Nested use (only outermost should be marked up)
11963 !! wikitext
11964 {{uc:{{lc:FOO}}}}
11965 !! html
11966 <p>FOO
11967 </p>
11968 !!end
11969
11970 ###
11971 ### Pre-save transform tests
11972 ###
11973 !! test
11974 pre-save transform: subst:
11975 !! options
11976 pst
11977 !! wikitext
11978 {{subst:test}}
11979 !! html/php
11980 This is a test template
11981 !! end
11982
11983 !! test
11984 pre-save transform: normal template
11985 !! options
11986 pst
11987 !! wikitext
11988 {{test}}
11989 !! html/php
11990 {{test}}
11991 !! end
11992
11993 !! test
11994 pre-save transform: nonexistent template
11995 !! options
11996 pst
11997 !! wikitext
11998 {{thistemplatedoesnotexist}}
11999 !! html/php
12000 {{thistemplatedoesnotexist}}
12001 !! end
12002
12003 !! test
12004 pre-save transform: subst magic variables
12005 !! options
12006 pst
12007 !! wikitext
12008 {{subst:SITENAME}}
12009 !! html/php
12010 MediaWiki
12011 !! end
12012
12013 # This is bug 89, which I fixed. -- wtm
12014 !! test
12015 pre-save transform: subst: templates with parameters
12016 !! options
12017 pst
12018 !! wikitext
12019 {{subst:paramtest|param="something else"}}
12020 !! html/php
12021 This is a test template with parameter "something else"
12022 !! end
12023
12024 !! article
12025 Template:nowikitest
12026 !! text
12027 <nowiki>'''not wiki'''</nowiki>
12028 !! endarticle
12029
12030 !! test
12031 pre-save transform: nowiki in subst (bug 1188)
12032 !! options
12033 pst
12034 !! wikitext
12035 {{subst:nowikitest}}
12036 !! html/php
12037 <nowiki>'''not wiki'''</nowiki>
12038 !! end
12039
12040 !! article
12041 Template:commenttest
12042 !! text
12043 This template has <!-- a comment --> in it.
12044 !! endarticle
12045
12046 !! test
12047 pre-save transform: comment in subst (bug 1936)
12048 !! options
12049 pst
12050 !! wikitext
12051 {{subst:commenttest}}
12052 !! html/php
12053 This template has <!-- a comment --> in it.
12054 !! end
12055
12056 !! test
12057 pre-save transform: unclosed tag
12058 !! options
12059 pst noxml
12060 !! wikitext
12061 <nowiki>'''not wiki'''
12062 !! html/php
12063 <nowiki>'''not wiki'''
12064 !! end
12065
12066 !! test
12067 pre-save transform: mixed tag case
12068 !! options
12069 pst noxml
12070 !! wikitext
12071 <NOwiki>'''not wiki'''</noWIKI>
12072 !! html/php
12073 <NOwiki>'''not wiki'''</noWIKI>
12074 !! end
12075
12076 !! test
12077 pre-save transform: unclosed comment in <nowiki>
12078 !! options
12079 pst noxml
12080 !! wikitext
12081 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12082 !! html/php
12083 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
12084 !!end
12085
12086 # Leading @ in this template definition works around a limitation
12087 # in parsoid's parserTests which otherwise strips the <span> from the
12088 # result (confusing it for a template wrapper)
12089 !! article
12090 Template:dangerous
12091 !!text
12092 @<span onmouseover="alert('crap')">Oh no</span>
12093 !!endarticle
12094
12095 !!test
12096 (confirming safety of fix for subst bug 1936)
12097 !! wikitext
12098 {{Template:dangerous}}
12099 !! html
12100 <p>@<span>Oh no</span>
12101 </p>
12102 !! end
12103
12104 !! test
12105 pre-save transform: comment containing gallery (bug 5024)
12106 !! options
12107 pst
12108 !! wikitext
12109 <!-- <gallery>data</gallery> -->
12110 !! html/php
12111 <!-- <gallery>data</gallery> -->
12112 !!end
12113
12114 !! test
12115 pre-save transform: comment containing extension
12116 !! options
12117 pst
12118 !! wikitext
12119 <!-- <tag>data</tag> -->
12120 !! html/php
12121 <!-- <tag>data</tag> -->
12122 !!end
12123
12124 !! test
12125 pre-save transform: comment containing nowiki
12126 !! options
12127 pst
12128 !! wikitext
12129 <!-- <nowiki>data</nowiki> -->
12130 !! html/php
12131 <!-- <nowiki>data</nowiki> -->
12132 !!end
12133
12134 !! test
12135 pre-save transform: <noinclude> in subst (bug 3298)
12136 !! options
12137 pst
12138 !! wikitext
12139 {{subst:Includes}}
12140 !! html/php
12141 Foobar
12142 !! end
12143
12144 !! test
12145 pre-save transform: <onlyinclude> in subst (bug 3298)
12146 !! options
12147 pst
12148 !! wikitext
12149 {{subst:Includes2}}
12150 !! html/php
12151 Foo
12152 !! end
12153
12154 !! article
12155 Template:SubstTest
12156 !!text
12157 {{<includeonly>subst:</includeonly>Includes}}
12158 !! endarticle
12159
12160 !! article
12161 Template:SafeSubstTest
12162 !! text
12163 {{<includeonly>safesubst:</includeonly>Includes}}
12164 !! endarticle
12165
12166 !! test
12167 bug 22297: safesubst: works during PST
12168 !! options
12169 pst
12170 !! wikitext
12171 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
12172 !! html/php
12173 FoobarFoobar
12174 !! end
12175
12176 !! test
12177 bug 22297: safesubst: works during normal parse
12178 !! wikitext
12179 {{SafeSubstTest}}
12180 !! html
12181 <p>Foobar
12182 </p>
12183 !! end
12184
12185 !! test
12186 subst: does not work during normal parse
12187 !! wikitext
12188 {{SubstTest}}
12189 !! html
12190 <p>{{subst:Includes}}
12191 </p>
12192 !! end
12193
12194 !! test
12195 pre-save transform: context links ("pipe trick")
12196 !! options
12197 pst
12198 !! wikitext
12199 [[Article (context)|]]
12200 [[Bar:Article|]]
12201 [[:Bar:Article|]]
12202 [[Bar:Article (context)|]]
12203 [[:Bar:Article (context)|]]
12204 [[|Article]]
12205 [[|Article (context)]]
12206 [[Bar:X (Y) Z|]]
12207 [[:Bar:X (Y) Z|]]
12208 !! html/php
12209 [[Article (context)|Article]]
12210 [[Bar:Article|Article]]
12211 [[:Bar:Article|Article]]
12212 [[Bar:Article (context)|Article]]
12213 [[:Bar:Article (context)|Article]]
12214 [[Article]]
12215 [[Article (context)]]
12216 [[Bar:X (Y) Z|X (Y) Z]]
12217 [[:Bar:X (Y) Z|X (Y) Z]]
12218 !! end
12219
12220 !! test
12221 pre-save transform: context links ("pipe trick") with interwiki prefix
12222 !! options
12223 pst
12224 !! wikitext
12225 [[interwiki:Article|]]
12226 [[:interwiki:Article|]]
12227 [[interwiki:Bar:Article|]]
12228 [[:interwiki:Bar:Article|]]
12229 !! html/php
12230 [[interwiki:Article|Article]]
12231 [[:interwiki:Article|Article]]
12232 [[interwiki:Bar:Article|Bar:Article]]
12233 [[:interwiki:Bar:Article|Bar:Article]]
12234 !! end
12235
12236 !! test
12237 pre-save transform: context links ("pipe trick") with parens in title
12238 !! options
12239 pst title=[[Somearticle (context)]]
12240 !! wikitext
12241 [[|Article]]
12242 !! html/php
12243 [[Article (context)|Article]]
12244 !! end
12245
12246 !! test
12247 pre-save transform: context links ("pipe trick") with comma in title
12248 !! options
12249 pst title=[[Someplace, Somewhere]]
12250 !! wikitext
12251 [[|Otherplace]]
12252 [[Otherplace, Elsewhere|]]
12253 [[Otherplace, Elsewhere, Anywhere|]]
12254 !! html/php
12255 [[Otherplace, Somewhere|Otherplace]]
12256 [[Otherplace, Elsewhere|Otherplace]]
12257 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
12258 !! end
12259
12260 !! test
12261 pre-save transform: context links ("pipe trick") with parens and comma
12262 !! options
12263 pst title=[[Someplace (IGNORED), Somewhere]]
12264 !! wikitext
12265 [[|Otherplace]]
12266 [[Otherplace (place), Elsewhere|]]
12267 !! html/php
12268 [[Otherplace, Somewhere|Otherplace]]
12269 [[Otherplace (place), Elsewhere|Otherplace]]
12270 !! end
12271
12272 !! test
12273 pre-save transform: context links ("pipe trick") with comma and parens
12274 !! options
12275 pst title=[[Who, me? (context)]]
12276 !! wikitext
12277 [[|Yes, you.]]
12278 [[Me, Myself, and I (1937 song)|]]
12279 !! html/php
12280 [[Yes, you. (context)|Yes, you.]]
12281 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
12282 !! end
12283
12284 !! test
12285 pre-save transform: context links ("pipe trick") with namespace
12286 !! options
12287 pst title=[[Ns:Somearticle]]
12288 !! wikitext
12289 [[|Article]]
12290 !! html/php
12291 [[Ns:Article|Article]]
12292 !! end
12293
12294 !! test
12295 pre-save transform: context links ("pipe trick") with namespace and parens
12296 !! options
12297 pst title=[[Ns:Somearticle (context)]]
12298 !! wikitext
12299 [[|Article]]
12300 !! html/php
12301 [[Ns:Article (context)|Article]]
12302 !! end
12303
12304 !! test
12305 pre-save transform: context links ("pipe trick") with namespace and comma
12306 !! options
12307 pst title=[[Ns:Somearticle, Context, Whatever]]
12308 !! wikitext
12309 [[|Article]]
12310 !! html/php
12311 [[Ns:Article, Context, Whatever|Article]]
12312 !! end
12313
12314 !! test
12315 pre-save transform: context links ("pipe trick") with namespace, comma and parens
12316 !! options
12317 pst title=[[Ns:Somearticle, Context (context)]]
12318 !! wikitext
12319 [[|Article]]
12320 !! html/php
12321 [[Ns:Article (context)|Article]]
12322 !! end
12323
12324 !! test
12325 pre-save transform: context links ("pipe trick") with namespace, parens and comma
12326 !! options
12327 pst title=[[Ns:Somearticle (IGNORED), Context]]
12328 !! wikitext
12329 [[|Article]]
12330 !! html/php
12331 [[Ns:Article, Context|Article]]
12332 !! end
12333
12334 !! test
12335 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
12336 !! options
12337 pst
12338 !! wikitext
12339 [[Article(context)|]]
12340 [[Bar:Article(context)|]]
12341 [[:Bar:Article(context)|]]
12342 [[|Article(context)]]
12343 [[Bar:X(Y)Z|]]
12344 [[:Bar:X(Y)Z|]]
12345 !! html/php
12346 [[Article(context)|Article]]
12347 [[Bar:Article(context)|Article]]
12348 [[:Bar:Article(context)|Article]]
12349 [[Article(context)]]
12350 [[Bar:X(Y)Z|X(Y)Z]]
12351 [[:Bar:X(Y)Z|X(Y)Z]]
12352 !! end
12353
12354 !! test
12355 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
12356 !! options
12357 pst
12358 !! wikitext
12359 [[Article (context)|]]
12360 [[Bar:Article (context)|]]
12361 [[:Bar:Article (context)|]]
12362 [[|Article (context)]]
12363 [[Bar:X (Y) Z|]]
12364 [[:Bar:X (Y) Z|]]
12365 !! html/php
12366 [[Article (context)|Article]]
12367 [[Bar:Article (context)|Article]]
12368 [[:Bar:Article (context)|Article]]
12369 [[Article (context)]]
12370 [[Bar:X (Y) Z|X (Y) Z]]
12371 [[:Bar:X (Y) Z|X (Y) Z]]
12372 !! end
12373
12374 !! test
12375 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
12376 !! options
12377 pst
12378 !! wikitext
12379 [[Article(context)|]]
12380 [[Bar:Article(context)|]]
12381 [[:Bar:Article(context)|]]
12382 [[|Article(context)]]
12383 [[Bar:X(Y)Z|]]
12384 [[:Bar:X(Y)Z|]]
12385 !! html/php
12386 [[Article(context)|Article]]
12387 [[Bar:Article(context)|Article]]
12388 [[:Bar:Article(context)|Article]]
12389 [[Article(context)]]
12390 [[Bar:X(Y)Z|X(Y)Z]]
12391 [[:Bar:X(Y)Z|X(Y)Z]]
12392 !! end
12393
12394 !! test
12395 pre-save transform: context links ("pipe trick") with commas (bug 21660)
12396 !! options
12397 pst
12398 !! wikitext
12399 [[Article (context), context|]]
12400 [[Article (context),context|]]
12401 [[Bar:Article (context), context|]]
12402 [[Bar:Article (context),context|]]
12403 [[:Bar:Article (context), context|]]
12404 [[:Bar:Article (context),context|]]
12405 !! html/php
12406 [[Article (context), context|Article]]
12407 [[Article (context),context|Article]]
12408 [[Bar:Article (context), context|Article]]
12409 [[Bar:Article (context),context|Article]]
12410 [[:Bar:Article (context), context|Article]]
12411 [[:Bar:Article (context),context|Article]]
12412 !! end
12413
12414 !! test
12415 pre-save transform: trim trailing empty lines
12416 !! options
12417 pst
12418 !! wikitext
12419 Empty lines are trimmed
12420
12421
12422
12423
12424 !! html/php
12425 Empty lines are trimmed
12426 !! end
12427
12428 !! test
12429 pre-save transform: Signature expansion
12430 !! options
12431 pst
12432 !! wikitext
12433 * ~~~
12434 * <noinclude>~~~</noinclude>
12435 * <includeonly>~~~</includeonly>
12436 * <onlyinclude>~~~</onlyinclude>
12437 !! html/php
12438 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
12439 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
12440 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
12441 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
12442 !! end
12443
12444
12445 !! test
12446 pre-save transform: Signature expansion in nowiki tags (bug 93)
12447 !! options
12448 pst disabled
12449 !! wikitext
12450 Shall not expand:
12451
12452 <nowiki>~~~~</nowiki>
12453
12454 <includeonly><nowiki>~~~~</nowiki></includeonly>
12455
12456 <noinclude><nowiki>~~~~</nowiki></noinclude>
12457
12458 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12459
12460 {{subst:Foo}} shall be converted to FOO
12461
12462 As well as inside noinclude/onlyinclude
12463 <noinclude>{{subst:Foo}}</noinclude>
12464 <onlyinclude>{{subst:Foo}}</onlyinclude>
12465
12466 But not inside includeonly
12467 <includeonly>{{subst:Foo}}</includeonly>
12468 !! html/php
12469 Shall not expand:
12470
12471 <nowiki>~~~~</nowiki>
12472
12473 <includeonly><nowiki>~~~~</nowiki></includeonly>
12474
12475 <noinclude><nowiki>~~~~</nowiki></noinclude>
12476
12477 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
12478
12479 FOO shall be converted to FOO
12480
12481 As well as inside noinclude/onlyinclude
12482 <noinclude>FOO</noinclude>
12483 <onlyinclude>FOO</onlyinclude>
12484
12485 But not inside includeonly
12486 <includeonly>{{subst:Foo}}</includeonly>
12487 !! end
12488
12489 !! test
12490 Parsoid: Recognize nowiki with trailing space in tags
12491 !! options
12492 parsoid=wt2html
12493 !! wikitext
12494 <nowiki ><div>[[foo]]</nowiki >
12495
12496 a<nowiki / >b
12497
12498 c<nowiki />d
12499
12500 e<nowiki/ >f
12501 !! html
12502 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12503 <p>ab</p>
12504 <p>cd</p>
12505 <p>ef</p>
12506 !! end
12507
12508 !! test
12509 Parsoid: Recognize nowiki with odd capitalization
12510 !! options
12511 parsoid=wt2html
12512 !! wikitext
12513 <noWikI ><div>[[foo]]</Nowiki >
12514 !! html
12515 <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
12516 !! end
12517
12518
12519 !! test
12520 Parsoid: Escape nowiki with trailing space in tags
12521 !! options
12522 parsoid=html2wt
12523 !! html/parsoid
12524 <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
12525 <p>a&lt;nowiki /&gt;b</p>
12526 <p>c&lt;nowiki/ &gt;d</p>
12527 !! wikitext
12528 &lt;nowiki &gt; foo &lt;/nowiki &gt;
12529
12530 a&lt;nowiki /&gt;b
12531
12532 c&lt;nowiki/ &gt;d
12533 !! end
12534
12535 !! test
12536 Parsoid: Escape weird noWikI capitalizations
12537 !! options
12538 parsoid=html2wt
12539 !! html/parsoid
12540 <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
12541 !! wikitext
12542 &lt;noWikI &gt; foo &lt;/NoWikI &gt;
12543 !! end
12544
12545 ###
12546 ### Message transform tests
12547 ###
12548 !! test
12549 message transform: magic variables
12550 !! options
12551 msg
12552 !! wikitext
12553 {{SITENAME}}
12554 !! html
12555 MediaWiki
12556 !! end
12557
12558 !! test
12559 message transform: should not transform wiki markup
12560 !! options
12561 msg
12562 !! wikitext
12563 ''test''
12564 !! html
12565 ''test''
12566 !! end
12567
12568 !! test
12569 message transform: <noinclude> in transcluded template (bug 4926)
12570 !! options
12571 msg
12572 !! wikitext
12573 {{Includes}}
12574 !! html
12575 Foobar
12576 !! end
12577
12578 !! test
12579 message transform: <onlyinclude> in transcluded template (bug 4926)
12580 !! options
12581 msg
12582 !! wikitext
12583 {{Includes2}}
12584 !! html
12585 Foo
12586 !! end
12587
12588 !! test
12589 {{#special:}} page name, known
12590 !! options
12591 msg
12592 !! wikitext
12593 {{#special:Recentchanges}}
12594 !! html
12595 Special:RecentChanges
12596 !! end
12597
12598 !! test
12599 {{#special:}} page name with subpage, known
12600 !! options
12601 msg
12602 !! wikitext
12603 {{#special:Recentchanges/param}}
12604 !! html
12605 Special:RecentChanges/param
12606 !! end
12607
12608 !! test
12609 {{#special:}} page name, unknown
12610 !! options
12611 msg
12612 !! wikitext
12613 {{#special:foobar nonexistent}}
12614 !! html
12615 Special:Foobar nonexistent
12616 !! end
12617
12618 !! test
12619 {{#speciale:}} page name, known
12620 !! options
12621 msg
12622 !! wikitext
12623 {{#speciale:Recentchanges}}
12624 !! html
12625 Special:RecentChanges
12626 !! end
12627
12628 !! test
12629 {{#speciale:}} page name with subpage, known
12630 !! options
12631 msg
12632 !! wikitext
12633 {{#speciale:Recentchanges/param}}
12634 !! html
12635 Special:RecentChanges/param
12636 !! end
12637
12638 !! test
12639 {{#speciale:}} page name, unknown
12640 !! options
12641 msg
12642 !! wikitext
12643 {{#speciale:foobar nonexistent}}
12644 !! html
12645 Special:Foobar_nonexistent
12646 !! end
12647
12648 ###
12649 ### Images
12650 ###
12651 ### For Parsoid-specific tests, see
12652 #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
12653
12654 !! test
12655 Simple image
12656 !! options
12657 parsoid=wt2html,wt2wt,html2html
12658 !! wikitext
12659 [[Image:foobar.jpg]]
12660 !! html/php
12661 <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>
12662 </p>
12663 !! html/parsoid
12664 <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>
12665 !! end
12666
12667 !! test
12668 Simple image (using File: namespace, now canonical)
12669 !! wikitext
12670 [[File:Foobar.jpg]]
12671 !! html/php
12672 <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>
12673 </p>
12674 !! html/parsoid
12675 <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>
12676 !! end
12677
12678 !! test
12679 Right-aligned image
12680 !! wikitext
12681 [[File:Foobar.jpg|right]]
12682 !! html/php
12683 <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>
12684
12685 !! html/parsoid
12686 <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>
12687 !! end
12688
12689 !! test
12690 Image with caption
12691 !! wikitext
12692 [[File:Foobar.jpg|right|Caption text]]
12693 !! html/php
12694 <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>
12695
12696 !! html/parsoid
12697 <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>
12698 !! end
12699
12700 !! test
12701 Image with caption, bug 53312 #1
12702 !! wikitext
12703 [[File:Foobar.jpg|right|Caption page stuff]]
12704 !! html/php
12705 <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>
12706
12707 !! html/parsoid
12708 <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>
12709 !! end
12710
12711 !! test
12712 Image with caption, bug 53312 #2
12713 !! wikitext
12714 [[File:Foobar.jpg|right|Caption page=]]
12715 !! html/php
12716 <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>
12717
12718 !! html/parsoid
12719 <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>
12720 !! end
12721
12722 !! test
12723 Image with caption, bug 53312 #3
12724 !! wikitext
12725 [[File:Foobar.jpg|right|Caption page=stuff]]
12726 !! html/php
12727 <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>
12728
12729 !! html/parsoid
12730 <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>
12731 !! end
12732
12733 !! test
12734 Allow empty links in image captions (Bug 60753)
12735 !! options
12736 thumbsize=220
12737 !! wikitext
12738 [[File:Foobar.jpg|thumb|Caption [[Link1]]
12739 [[]]
12740 [[Link2]]
12741 ]]
12742 !! html/php
12743 <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>
12744
12745 !! html/parsoid
12746 <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>
12747 [[]]
12748 <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
12749 </figcaption></figure>
12750 !! end
12751
12752 !! test
12753 Titles in unlinked images (T23454)
12754 !! wikitext
12755 [[File:Foobar.jpg|link=|stuff]]
12756 !! html/php
12757 <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
12758 </p>
12759 !! end
12760
12761 !! test
12762 Link with empty target
12763 !! wikitext
12764 [[]]
12765 !! html
12766 <p>[[]]
12767 </p>
12768 !! end
12769
12770 !! test
12771 Image with link trail
12772 !! wikitext
12773 Linktrails should not work for images: [[File:Foobar.jpg]]s
12774 !! html/php
12775 <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
12776 </p>
12777 !! html/parsoid
12778 <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>
12779 !! end
12780
12781 !! test
12782 Image with empty attribute
12783 !! options
12784 parsoid=wt2html,wt2wt,html2html
12785 !! wikitext
12786 [[File:Foobar.jpg|right||Caption text]]
12787 !! html/php
12788 <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>
12789
12790 !! html/parsoid
12791 <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>
12792 !! end
12793
12794 !! test
12795 1. Block image with individual attributes from templates
12796 !! wikitext
12797 [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
12798 !! html/php
12799 <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>
12800
12801 !! html/parsoid
12802 <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>
12803 !! end
12804
12805 !! test
12806 2. Block Image with individual attributes from templates
12807 !! wikitext
12808 [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
12809 !! html/php
12810 <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>
12811
12812 !! html/parsoid
12813 <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>
12814 !! end
12815
12816 !! test
12817 3. Inline image with individual attributes from templates
12818 !! wikitext
12819 [[File:Foobar.jpg|{{echo|50px}}]]
12820 !! html/php
12821 <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>
12822 </p>
12823 !! html/parsoid
12824 <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>
12825 !! end
12826
12827 ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
12828 ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
12829 !! test
12830 Image with multiple attributes from the same template
12831 !! wikitext
12832 [[File:Foobar.jpg|{{image_attribs}}]]
12833 !! html/php
12834 <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>
12835
12836 !! html/parsoid
12837 <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>
12838 !! end
12839
12840 !! test
12841 Image with link tails
12842 !! options
12843 thumbsize=220
12844 !! wikitext
12845 123[[File:Foobar.jpg]]456
12846 123[[File:Foobar.jpg|right]]456
12847 123[[File:Foobar.jpg|thumb]]456
12848 !! html/php
12849 <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
12850 </p>
12851 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
12852 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
12853
12854 !! html/php+tidy
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</p>
12856 <p>123</p>
12857 <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>
12858 <p>456 123</p>
12859 <div class="thumb tright">
12860 <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>
12861 <div class="thumbcaption">
12862 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
12863 </div>
12864 </div>
12865 </div>
12866 <p>456</p>
12867 !! html/parsoid
12868 <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>
12869 <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>
12870 <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>
12871 !! end
12872
12873 !! test
12874 Image with multiple captions -- only last one is accepted
12875 !! wikitext
12876 [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
12877 !! html/php
12878 <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>
12879
12880 !! html/parsoid
12881 <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>
12882 !! end
12883
12884 !! test
12885 Image with multiple widths -- use last
12886 !! wikitext
12887 [[File:Foobar.jpg|200px|300px|caption]]
12888 !! html/php
12889 <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>
12890 </p>
12891 !! html/parsoid
12892 <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>
12893 !! end
12894
12895 !! test
12896 Image with multiple alignments -- use first (bug 48664)
12897 !! options
12898 thumbsize=220
12899 !! wikitext
12900 [[File:Foobar.jpg|thumb|left|right|center|caption]]
12901
12902 [[File:Foobar.jpg|middle|text-top|caption]]
12903 !! html/php
12904 <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>
12905 <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>
12906 </p>
12907 !! html/parsoid
12908 <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>
12909 <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>
12910 !! end
12911
12912 !! test
12913 Image with width attribute at different positions
12914 !! wikitext
12915 [[File:Foobar.jpg|200px|right|Caption]]
12916 [[File:Foobar.jpg|right|200px|Caption]]
12917 [[File:Foobar.jpg|right|Caption|200px]]
12918 !! html/php
12919 <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>
12920 <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>
12921 <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>
12922
12923 !! html/parsoid
12924 <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>
12925 <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>
12926 <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>
12927 !! end
12928
12929 # a sad bit of backward-compatibility
12930 !! test
12931 Image with size specified with pxpx (bug 13500, 51628)
12932 !! options
12933 parsoid=wt2html,wt2wt,html2html
12934 !! wikitext
12935 [[File:Foobar.jpg|20pxpx]]
12936 [[File:Foobar.jpg|200x20pxpx]]
12937 !! html/php
12938 <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>
12939 <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>
12940 </p>
12941 !! html/parsoid
12942 <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>
12943 !! end
12944
12945 !! test
12946 Image with link parameter, wiki target
12947 !! wikitext
12948 [[File:Foobar.jpg|link=Main Page]]
12949 !! html/php
12950 <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>
12951 </p>
12952 !! html/parsoid
12953 <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>
12954 !! end
12955
12956 # parsoid bug 49293 (part 1)
12957 !! test
12958 Image with link parameter, URL target
12959 !! wikitext
12960 [[File:Foobar.jpg|link=http://example.com/]]
12961 !! html/php
12962 <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>
12963 </p>
12964 !! html/parsoid
12965 <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>
12966 !! end
12967
12968 # parsoid bug 49293 (part 2)
12969 !! test
12970 Image with link parameter, protocol-less URL target
12971 !! wikitext
12972 [[File:Foobar.jpg|link=//example.com/]]
12973 !! html/php
12974 <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>
12975 </p>
12976 !! html/parsoid
12977 <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>
12978 !! end
12979
12980 !! test
12981 Escaping non-block captions (T107435)
12982 !! options
12983 parsoid={
12984 "modes": ["wt2wt"],
12985 "changes": [
12986 ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
12987 ]
12988 }
12989 !! wikitext
12990 [[Image:Foobar.jpg|caption]]
12991 !! wikitext/edited
12992 [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
12993 !! end
12994
12995 # wgExternalLinkTarget not supported by Parsoid
12996 !! test
12997 Image with link parameter, wgExternalLinkTarget
12998 !! wikitext
12999 [[Image:foobar.jpg|link=http://example.com/]]
13000 !! config
13001 wgExternalLinkTarget='foobar'
13002 !! html/php
13003 <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>
13004 </p>
13005 !! end
13006
13007 !! test
13008 Image with link parameter, wgNoFollowLinks set to false
13009 !! wikitext
13010 [[Image:foobar.jpg|link=http://example.com/]]
13011 !! config
13012 wgNoFollowLinks=false
13013 !! html
13014 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13015 </p>
13016 !! end
13017
13018 !! test
13019 Image with link parameter, wgNoFollowDomainExceptions
13020 !! wikitext
13021 [[Image:foobar.jpg|link=http://example.com/]]
13022 !! config
13023 wgNoFollowDomainExceptions='example.com'
13024 !! html
13025 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
13026 </p>
13027 !! end
13028
13029 # wgExternalLinkTarget not supported by Parsoid
13030 !! test
13031 Image with link parameter, wgExternalLinkTarget, unnamed parameter
13032 !! wikitext
13033 [[Image:foobar.jpg|link=http://example.com/|Title]]
13034 !! config
13035 wgExternalLinkTarget='foobar'
13036 !! html/php
13037 <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>
13038 </p>
13039 !! end
13040
13041 !! test
13042 Image with empty link parameter
13043 !! wikitext
13044 [[File:Foobar.jpg|link=]]
13045 !! html/php
13046 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
13047 </p>
13048 !! html/parsoid
13049 <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>
13050 !! end
13051
13052 !! test
13053 Image with link parameter (wiki target) and unnamed parameter
13054 !! wikitext
13055 [[File:Foobar.jpg|link=Main_Page|Title]]
13056 !! html/php
13057 <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>
13058 </p>
13059 !! html/parsoid
13060 <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>
13061 !! end
13062
13063 !! test
13064 Image with link parameter (URL target) and unnamed parameter
13065 !! wikitext
13066 [[File:Foobar.jpg|link=http://example.com/|Title]]
13067 !! html/php
13068 <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>
13069 </p>
13070 !! html/parsoid
13071 <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>
13072 !! end
13073
13074 !! test
13075 Thumbnail image with link parameter
13076 !! options
13077 thumbsize=220
13078 parsoid=wt2html,wt2wt,html2html
13079 !! wikitext
13080 [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
13081 !! html/php
13082 <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>
13083
13084 !! html/parsoid
13085 <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>
13086 !! end
13087
13088 !! test
13089 Manually-specified thumbnail image
13090 !! options
13091 thumbsize=220
13092 !! wikitext
13093 [[File:Foobar.jpg|thumb=Thumb.png|Title]]
13094 !! html/php
13095 <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>
13096
13097 !! html/parsoid
13098 <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>
13099 !! end
13100
13101 !! test
13102 Manually-specified thumbnail image with explicit link to wiki page
13103 !! options
13104 thumbsize=220
13105 parsoid=wt2html,wt2wt,html2html
13106 !! wikitext
13107 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
13108 !! html/php
13109 <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>
13110
13111 !! html/parsoid
13112 <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>
13113 !! end
13114
13115 !! test
13116 Manually-specified thumbnail image with explicit link to url
13117 !! options
13118 thumbsize=220
13119 parsoid=wt2html,wt2wt,html2html
13120 !! wikitext
13121 [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
13122 !! html/php
13123 <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>
13124
13125 !! html/parsoid
13126 <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>
13127 !! end
13128
13129 !! test
13130 Manually-specified thumbnail image with explicit no link
13131 !! options
13132 thumbsize=220
13133 parsoid=wt2html,wt2wt,html2html
13134 !! wikitext
13135 [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
13136 !! html/php
13137 <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>
13138
13139 !! html/parsoid
13140 <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>
13141 !! end
13142
13143 !! test
13144 Manually-specified thumbnail image with explicit link and alt text
13145 !! options
13146 thumbsize=220
13147 parsoid=wt2html,wt2wt,html2html
13148 !! wikitext
13149 [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
13150 !! html/php
13151 <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>
13152
13153 !! html/parsoid
13154 <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>
13155 !! end
13156
13157 !! test
13158 Image with frame and link
13159 !! options
13160 parsoid=wt2html,wt2wt,html2html
13161 !! wikitext
13162 [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
13163 !! html/php
13164 <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>
13165
13166 !! html/parsoid
13167 <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>
13168 !! end
13169
13170 !! test
13171 Image with frame and link and explicit alt
13172 !! options
13173 parsoid=wt2html,wt2wt,html2html
13174 !! wikitext
13175 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
13176 !! html/php
13177 <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>
13178
13179 !! html/parsoid
13180 <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>
13181 !! end
13182
13183 !! test
13184 Image with wiki markup in implicit alt
13185 !! wikitext
13186 [[Image:Foobar.jpg|testing '''bold''' in alt]]
13187
13188 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
13189 !! html/php
13190 <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>
13191 </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>
13192 </p>
13193 !! html/parsoid
13194 <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>
13195 <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>
13196 !! end
13197
13198 !! test
13199 Alt image option should handle most kinds of wikitext without barfing
13200 !! wikitext
13201 [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
13202 !! html/php
13203 <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>
13204
13205 !! html/parsoid
13206 <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>
13207 !! end
13208
13209 ###################
13210 # Conflicting image format options.
13211 # First option specified should 'win'.
13212 # All three cases in each test should be identical.
13213
13214 !! test
13215 Image with 'frameless' first.
13216 !! options
13217 parsoid=wt2html,wt2wt,html2html
13218 !! wikitext
13219 [[File:Foobar.jpg|frameless|caption]]
13220
13221 [[File:Foobar.jpg|frameless|frame|caption]]
13222
13223 [[File:Foobar.jpg|frameless|thumb|caption]]
13224 !! html/php
13225 <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>
13226 </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>
13227 </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>
13228 </p>
13229 !! html/parsoid
13230 <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>
13231 <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>
13232 <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>
13233 !! end
13234
13235 !! test
13236 Image with 'frame' first.
13237 !! options
13238 parsoid=wt2html,wt2wt,html2html
13239 !! wikitext
13240 [[File:Foobar.jpg|frame|caption]]
13241 [[File:Foobar.jpg|frame|frameless|caption]]
13242 [[File:Foobar.jpg|frame|thumb|caption]]
13243 !! html/php
13244 <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>
13245 <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>
13246 <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>
13247
13248 !! html/parsoid
13249 <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>
13250 <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>
13251 <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>
13252 !! end
13253
13254 !! test
13255 Image with 'thumb' first.
13256 !! options
13257 parsoid=wt2html,wt2wt,html2html
13258 !! wikitext
13259 [[File:Foobar.jpg|thumb|caption]]
13260 [[File:Foobar.jpg|thumb|frameless|caption]]
13261 [[File:Foobar.jpg|thumb|frame|caption]]
13262 !! html/php
13263 <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>
13264 <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>
13265 <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>
13266
13267 !! html/parsoid
13268 <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>
13269 <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>
13270 <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>
13271 !! end
13272
13273 ###################
13274 # Image sizing.
13275 # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
13276 # and https://phabricator.wikimedia.org/T64258
13277 # Foobar has actual size of 1941x220
13278 # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
13279 # a scalable format.
13280 # 2. Framed images always ignore size options; always render at default size.
13281 # 3. "Unspecified format" and border are the only types which can be
13282 # enlarged.
13283
13284 !! test
13285 Image: "unspecified format" and border enlarge
13286 !! options
13287 parsoid=wt2html,wt2wt,html2html
13288 !! wikitext
13289 [[File:Foobar.jpg|2000px]]
13290
13291 [[File:Foobar.jpg|border|2000px]]
13292 !! html/php
13293 <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>
13294 </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>
13295 </p>
13296 !! html/parsoid
13297 <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>
13298 <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>
13299 !! end
13300
13301 !! test
13302 Image: "unspecified format" and border reduce
13303 !! options
13304 parsoid=wt2html,wt2wt,html2html
13305 !! wikitext
13306 [[File:Foobar.jpg|1000px]]
13307
13308 [[File:Foobar.jpg|border|1000px]]
13309 !! html/php
13310 <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>
13311 </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>
13312 </p>
13313 !! html/parsoid
13314 <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>
13315 <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>
13316 !! end
13317
13318 !! test
13319 Image: thumbs reduce
13320 !! options
13321 parsoid=wt2html,wt2wt,html2html
13322 !! wikitext
13323 [[File:Foobar.jpg|thumb|50px]]
13324 !! html/php
13325 <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>
13326
13327 !! html/parsoid
13328 <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>
13329 !! end
13330
13331 !! test
13332 Image: bitmap thumbs can't be enlarged past original size, but vector can.
13333 !! options
13334 parsoid=wt2html,wt2wt,html2html
13335 !! wikitext
13336 [[File:Foobar.jpg|thumb|2000px]]
13337
13338 [[File:Foobar.svg|thumb|2000px]]
13339 !! html/php
13340 <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>
13341 <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>
13342
13343 !! html/parsoid
13344 <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>
13345 <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>
13346 !! end
13347
13348 !! test
13349 Image: frameless can reduce in size
13350 !! options
13351 parsoid=wt2html,wt2wt,html2html
13352 !! wikitext
13353 [[File:Foobar.jpg|frameless|50px]]
13354 !! html/php
13355 <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>
13356 </p>
13357 !! html/parsoid
13358 <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>
13359 !! end
13360
13361 !! test
13362 Image: bitmap frameless can't be enlarged past original size, but vector can
13363 !! options
13364 parsoid=wt2html,wt2wt,html2html
13365 !! wikitext
13366 [[File:Foobar.jpg|frameless|2000px]]
13367
13368 [[File:Foobar.svg|frameless|2000px]]
13369 !! html/php
13370 <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>
13371 </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>
13372 </p>
13373 !! html/parsoid
13374 <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>
13375 <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>
13376 !! end
13377
13378 !! test
13379 Image: framed images are always unscaled.
13380 !! options
13381 parsoid=wt2html,wt2wt,html2html
13382 !! wikitext
13383 [[File:Foobar.jpg|frame]]
13384
13385 [[File:Foobar.jpg|frame|50px]]
13386
13387 [[File:Foobar.jpg|frame|50x50px]]
13388
13389 [[File:Foobar.jpg|frame|2000px]]
13390 !! html/php
13391 <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>
13392 <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>
13393 <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>
13394 <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>
13395
13396 !! html/parsoid
13397 <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>
13398 <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>
13399 <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>
13400 <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>
13401 !! end
13402
13403 ###################
13404
13405 !! test
13406 Link to image page- image page normally doesn't exists, hence edit link
13407 Add test with existing image page
13408 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
13409 !! wikitext
13410 [[:Image:test]]
13411 !! html
13412 <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>
13413 </p>
13414 !! end
13415
13416 !! test
13417 bug 18784 Link to non-existent image page with caption should use caption as link text
13418 !! wikitext
13419 [[:Image:test|caption]]
13420 !! html
13421 <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>
13422 </p>
13423 !! end
13424
13425 !! test
13426 Frameless image caption with a free URL
13427 !! wikitext
13428 [[File:Foobar.jpg|http://example.com]]
13429 !! html/php
13430 <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>
13431 </p>
13432 !! html/parsoid
13433 <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>
13434 !! end
13435
13436 !! test
13437 Thumbnail image caption with a free URL
13438 !! options
13439 thumbsize=220
13440 !! wikitext
13441 [[File:Foobar.jpg|thumb|http://example.com]]
13442 !! html/php
13443 <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>
13444
13445 !! html/parsoid
13446 <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>
13447 !! end
13448
13449 !! test
13450 Thumbnail image caption with a free URL and explicit alt
13451 !! options
13452 thumbsize=220
13453 parsoid=wt2html,wt2wt,html2html
13454 !! wikitext
13455 [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
13456 !! html/php
13457 <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>
13458
13459 !! html/parsoid
13460 <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>
13461 !! end
13462
13463 !! test
13464 SVG thumbnails with no language set
13465 !! options
13466 !! wikitext
13467 [[File:Foobar.svg|thumb|caption]]
13468 !! html/php
13469 <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>
13470
13471 !! html/parsoid
13472 <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>
13473 !! end
13474
13475 !! test
13476 SVG thumbnails with language de
13477 !! options
13478 parsoid=wt2html,wt2wt,html2html
13479 !! wikitext
13480 [[File:Foobar.svg|thumb|caption|lang=de]]
13481 !! html/php
13482 <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>
13483
13484 !! html/parsoid
13485 <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>
13486 !! end
13487
13488 !! test
13489 SVG thumbnails with invalid language code
13490 !! options
13491 parsoid=wt2html,wt2wt,html2html
13492 !! wikitext
13493 [[File:Foobar.svg|thumb|caption|lang=invalid.language.code]]
13494 !! html/php
13495 <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>
13496
13497 !! html/parsoid
13498 <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>
13499 !! end
13500
13501 !! test
13502 BUG 1887: A ISBN with a thumbnail
13503 !! wikitext
13504 [[File:Foobar.jpg|thumb|ISBN 1235467890]]
13505 !! html/php
13506 <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>
13507
13508 !! html/parsoid
13509 <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>
13510 !! end
13511
13512 !! test
13513 BUG 1887: A RFC with a thumbnail
13514 !! wikitext
13515 [[File:Foobar.jpg|thumb|This is RFC 12354]]
13516 !! html/php
13517 <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>
13518
13519 !! html/parsoid
13520 <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>
13521 !! end
13522
13523 !! test
13524 BUG 1887: A mailto link with a thumbnail
13525 !! wikitext
13526 [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
13527 !! html/php
13528 <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>
13529
13530 !! html/parsoid
13531 <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>
13532 !! end
13533
13534 # Pending resolution to bug 368
13535 !! test
13536 BUG 648: Frameless image caption with a link
13537 !! wikitext
13538 [[File:Foobar.jpg|text with a [[link]] in it]]
13539 !! html/php
13540 <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>
13541 </p>
13542 !! html/parsoid
13543 <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>
13544 !! end
13545
13546 !! test
13547 BUG 648: Frameless image caption with a link (suffix)
13548 !! wikitext
13549 [[File:Foobar.jpg|text with a [[link]]foo in it]]
13550 !! html/php
13551 <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>
13552 </p>
13553 !! html/parsoid
13554 <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>
13555 !! end
13556
13557 !! test
13558 BUG 648: Frameless image caption with an interwiki link
13559 !! wikitext
13560 [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
13561 !! html/php
13562 <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>
13563 </p>
13564 !! html/parsoid
13565 <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>
13566 !! end
13567
13568 !! test
13569 BUG 648: Frameless image caption with a piped interwiki link
13570 !! wikitext
13571 [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
13572 !! html/php
13573 <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>
13574 </p>
13575 !! html/parsoid
13576 <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>
13577 !! end
13578
13579 !! test
13580 T107474: Frameless image caption with <nowiki>
13581 !! wikitext
13582 [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
13583 !! html/parsoid
13584 <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>
13585 !! end
13586
13587 !! test
13588 Escape HTML special chars in image alt text
13589 !! wikitext
13590 [[File:Foobar.jpg|& < > "]]
13591 !! html/php
13592 <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>
13593 </p>
13594 !! html/parsoid
13595 <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>
13596 !! end
13597
13598 !! test
13599 BUG 499: Alt text should have &#1234;, not &amp;1234;
13600 !! wikitext
13601 [[File:Foobar.jpg|&#9792;]]
13602 !! html/php
13603 <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>
13604 </p>
13605 !! html/parsoid
13606 <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>
13607 !! end
13608
13609 !! test
13610 Broken image caption with link
13611 !! options
13612 parsoid=wt2html,wt2wt,html2html
13613 !! wikitext
13614 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
13615 !! html/php
13616 <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.
13617 </p>
13618 !! html/parsoid
13619 <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>
13620 !! end
13621
13622 !! test
13623 Image caption containing another image
13624 !! wikitext
13625 [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
13626 !! html/php
13627 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is a 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>
13628
13629 !! html/parsoid
13630 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>This is a 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>
13631 !! end
13632
13633 !! test
13634 Image: caption containing a newline
13635 !! wikitext
13636 [[File:Foobar.jpg|This
13637 *is some text]]
13638 !! html/php
13639 <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>
13640 </p>
13641 !! html/parsoid
13642 <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>
13643 !!end
13644
13645 !!test
13646 Image: caption containing leading space
13647 (The leading space should not trigger nowiki escaping in wt2wt mode)
13648 !! wikitext
13649 [[File:Foobar.jpg|thumb| bar]]
13650 !! html/php
13651 <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>
13652
13653 !! html/parsoid
13654 <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>
13655 !!end
13656
13657 !! test
13658 Image: caption containing a table
13659 !! options
13660 parsoid=wt2html,wt2wt,html2html
13661 !! wikitext
13662 [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
13663 {|
13664 ! Foo !! Bar
13665 |-
13666 | Foo1 || Bar1
13667 |}
13668 and some more text.]]
13669 !! html/php
13670 <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>
13671
13672 !! html/parsoid
13673 <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
13674 <table>
13675 <tbody>
13676 <tr><th>Foo </th><th>Bar</th></tr>
13677 <tr>
13678 <td>Foo1 </td>
13679 <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
13680 !! end
13681
13682 !! test
13683 Bug 3090: External links other than http: in image captions
13684 !! wikitext
13685 [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
13686 !! html/php
13687 <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>
13688
13689 !! html/parsoid
13690 <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>
13691 !! end
13692
13693 !! test
13694 Custom class
13695 !! options
13696 parsoid=wt2html,wt2wt,html2html
13697 !! wikitext
13698 [[Image:foobar.jpg|a|class=b]]
13699 !! html/php
13700 <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>
13701 </p>
13702 !! html/parsoid
13703 <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>
13704 !! end
13705
13706 !! test
13707 Localized image handling (1).
13708 !! options
13709 parsoid=wt2html,wt2wt,html2html
13710 language=es
13711 !! wikitext
13712 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
13713 !! html/php
13714 <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>
13715
13716 !! html/parsoid
13717 <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>
13718 !! end
13719
13720 !! test
13721 Localized image handling (2).
13722 !! options
13723 thumbsize=220
13724 parsoid=wt2html,wt2wt,html2html
13725 language=es
13726 !! wikitext
13727 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
13728 !! html/php
13729 <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>
13730
13731 !! html/parsoid
13732 <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>
13733 !! end
13734
13735 !! test
13736 "border", "frameless" and "class" attributes on an image.
13737 !! options
13738 thumbsize=220
13739 parsoid=wt2html,wt2wt,html2html
13740 !! wikitext
13741 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
13742 !! html/php
13743 <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>
13744 </p>
13745 !! html/parsoid
13746 <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>
13747 !! end
13748
13749 # Note that 'right' is the default alignment, despite the misspelled 'righ' below
13750 !! test
13751 Invalid image attributes (bug 62500)
13752 !! options
13753 thumbsize=220
13754 parsoid=wt2html,wt2wt,html2html
13755 !! wikitext
13756 [[File:Foobar.jpg|thumb|float|left|caption]]
13757
13758 [[File:Foobar.jpg|thumb|righ|caption]]
13759
13760 [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
13761 !! html/php
13762 <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>
13763 <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>
13764 <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>
13765
13766 !! html/parsoid
13767 <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>
13768 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
13769 <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>
13770 !! end
13771
13772 !! article
13773 File:Barfoo.jpg
13774 !! text
13775 #REDIRECT [[File:Barfoo.jpg]]
13776 !! endarticle
13777
13778 # FIXME: Parsoid should run this test -- but we'd need to teach the
13779 # mockAPI about the redirected Barfoo.jpg image.
13780 !! test
13781 Redirected image
13782 !! wikitext
13783 [[Image:Barfoo.jpg]]
13784 !! html/php
13785 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
13786 </p>
13787 !! end
13788
13789 !! test
13790 Missing image with uploads disabled
13791 !! options
13792 wgEnableUploads=0
13793 !! wikitext
13794 [[File:Foobaz.jpg]]
13795 !! html/php
13796 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
13797 </p>
13798 !! html/parsoid
13799 <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>
13800 !! end
13801
13802 # Parsoid-specific testing for images
13803 # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
13804 # Currently imperfect due to a flaw in the Parsoid testrunner
13805 # Work in progress
13806 # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
13807 # image tests.
13808
13809 !! test
13810 Parsoid-specific image handling - simple image with size and middle alignment
13811 !! wikitext
13812 [[File:Foobar.jpg|middle|50px]]
13813 !! html/parsoid
13814 <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>
13815 !! end
13816
13817 !! test
13818 Parsoid-specific image handling - simple image with size, middle alignment,
13819 non-standard namespace alias
13820 !! options
13821 parsoid=wt2wt,wt2html,html2html
13822 !! wikitext
13823 [[Image:Foobar.jpg|middle|50px]]
13824 !! html/parsoid
13825 <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>
13826 !! end
13827
13828 !! test
13829 Parsoid-specific image handling - simple image with size and middle alignment
13830 (existing content)
13831 !! wikitext
13832 [[File:Foobar.jpg|50px|middle]]
13833 !! html/parsoid
13834 <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>
13835 !! end
13836
13837 !! test
13838 Parsoid-specific image handling - simple image with size and middle alignment
13839 and non-standard namespace name
13840 !! options
13841 parsoid=wt2html,wt2wt,html2html
13842 !! wikitext
13843 [[Image:Foobar.jpg|50px|middle]]
13844 !! html/parsoid
13845 <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>
13846 !! end
13847
13848 !! test
13849 Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
13850 !! wikitext
13851 [[File:Foobar.jpg|500x10px|baseline|caption]]
13852 !! html/parsoid
13853 <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>
13854 !! end
13855
13856 !! test
13857 Parsoid-specific image handling - simple image with border and size spec
13858 !! wikitext
13859 [[File:Foobar.jpg|50px|border|caption]]
13860 !! html/parsoid
13861 <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>
13862 !! end
13863
13864 !! test
13865 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13866 !! wikitext
13867 [[File:Foobar.jpg|left|baseline|thumb|caption content]]
13868 !! html/parsoid
13869 <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>
13870 !! end
13871
13872 !! test
13873 Parsoid-specific image handling - thumbnail with halign, valign, and caption
13874 (existing content)
13875 !! wikitext
13876 [[File:Foobar.jpg|thumb|left|baseline|caption content]]
13877 !! html/parsoid
13878 <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>
13879 !! end
13880
13881 !! test
13882 Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
13883 !! wikitext
13884 [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
13885 !! html/parsoid
13886 <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>
13887 !! end
13888
13889 !! test
13890 Parsoid-specific image handling - thumbnail with specific size, halign,
13891 valign, and caption (existing content)
13892 !! wikitext
13893 [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
13894 !! html/parsoid
13895 <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>
13896 !! end
13897
13898 !! test
13899 Parsoid-specific image handling - framed image with specific size and caption
13900 (size is ignored)
13901 !! options
13902 parsoid=wt2html,wt2wt,html2html
13903 !! wikitext
13904 [[File:Foobar.jpg|frame|500x50px|caption]]
13905 !! html/parsoid
13906 <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>
13907 !! end
13908
13909 !! test
13910 Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
13911 (size is ignored)
13912 !! options
13913 parsoid=wt2html,wt2wt,html2html
13914 !! wikitext
13915 [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
13916 !! html/parsoid
13917 <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>
13918 !! end
13919
13920 !! test
13921 Parsoid-specific image handling - frameless image with specific size, border, and caption
13922 !! wikitext
13923 [[File:Foobar.jpg|frameless|442x50px|border|caption]]
13924 !! html/parsoid
13925 <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>
13926 !! end
13927
13928 !! test
13929 Parsoid-specific image handling - simple image with a formatted caption
13930 !! wikitext
13931 [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
13932 !! html/parsoid
13933 <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>
13934 !! end
13935
13936 !! test
13937 Parsoid-specific image handling - caption with a template in it
13938 !! wikitext
13939 [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
13940 !! html/parsoid
13941 <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>
13942 !! end
13943
13944 !! test
13945 Parsoid-specific image handling - caption with unbalanced tags in it
13946 !! options
13947 parsoid=wt2html,wt2wt,html2html
13948 !! wikitext
13949 foo
13950 [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
13951 bar
13952 !! html/parsoid
13953 <p>foo</p>
13954 <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>
13955 <p>bar</p>
13956 !! end
13957
13958 !! test
13959 Parsoid-specific image handling - empty caption (1)
13960 !! options
13961 parsoid=wt2html,wt2wt
13962 !! wikitext
13963 [[File:Foobar.jpg|thumb|]]
13964 !! html/parsoid
13965 <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>
13966 !! end
13967
13968 # empty captions don't get serialized unless we're in the "round trip" case
13969 !! test
13970 Parsoid-specific image handling - empty caption (2)
13971 !! options
13972 parsoid=html2wt
13973 !! html/parsoid
13974 <figure class="mw-default-size" typeof="mw:Image/Thumb">
13975 <a href="./File:Foobar.jpg">
13976 <img resource="./File:Foobar.jpg"
13977 src="//example.com/images/3/3a/Foobar.jpg"
13978 data-file-width="1941" data-file-height="220" data-file-type="bitmap"
13979 height="25" width="220"/>
13980 </a>
13981 <figcaption></figcaption>
13982 </figure>
13983 !! wikitext
13984 [[File:Foobar.jpg|thumb]]
13985 !! end
13986
13987 !! test
13988 Parsoid-specific image handling - whitespace caption
13989 !! wikitext
13990 [[File:Foobar.jpg|thumb| ]]
13991 !! html/parsoid
13992 <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>
13993 !! end
13994
13995 !! test
13996 Parsoid-specific image handling - lang option
13997 !! wikitext
13998 foo
13999 [[File:Foobar.svg|lang=de|caption]]
14000 bar
14001 !! html/parsoid
14002 <p>foo
14003 <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>
14004 bar</p>
14005 !! end
14006
14007 ## Edge case bugs in Parsoid from T93580
14008 !! test
14009 T93580: 1. Templated <ref> inside block images
14010 !! wikitext
14011 [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
14012
14013 <references />
14014 !! html/parsoid
14015 <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>
14016
14017 <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>
14018 !! end
14019
14020 !! test
14021 T93580: 2. <ref> inside inline images
14022 !! wikitext
14023 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
14024
14025 <references />
14026 !! html/parsoid
14027 <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>
14028
14029 <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>
14030 !! end
14031
14032 !! test
14033 T93580: 3. Templated <ref> inside inline images
14034 !! wikitext
14035 [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
14036
14037 <references />
14038 !! html/parsoid
14039 <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>
14040
14041 <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>
14042 !! end
14043
14044 ###
14045 ### Subpages
14046 ###
14047 !! article
14048 Subpage test/subpage
14049 !! text
14050 foo
14051 !! endarticle
14052
14053 !! test
14054 Subpage link
14055 !! options
14056 subpage title=[[Subpage test]]
14057 !! wikitext
14058 [[/subpage]]
14059 !! html
14060 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
14061 </p>
14062 !! end
14063
14064 !! test
14065 Subpage noslash link
14066 !! options
14067 subpage title=[[Subpage test]]
14068 !! wikitext
14069 [[/subpage/]]
14070 !! html
14071 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
14072 </p>
14073 !! end
14074
14075 !! article
14076 Subpage test/1/2/subpage
14077 !! text
14078 blah
14079 !! endarticle
14080
14081 !! test
14082 Relative subpage noslash link
14083 !! options
14084 parsoid=wt2wt,wt2html,html2html
14085 subpage title=[[Subpage test/1/2/3/4]]
14086 !! wikitext
14087 [[../../subpage/]]
14088
14089 [[../../subpage]]
14090 !! html/php
14091 <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
14092 </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
14093 </p>
14094 !! html/parsoid
14095 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
14096 <p><a rel="mw:WikiLink" href="Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
14097 !! end
14098
14099 !! test
14100 Parsoid: dot-slash prefixed wikilinks
14101 !! wikitext
14102 [[./foo]]
14103
14104 [[././bar]]
14105
14106 [[././baz/]]
14107 !! html/php
14108 <p>[[./foo]]
14109 </p><p>[[././bar]]
14110 </p><p>[[././baz/]]
14111 </p>
14112 !! html/parsoid
14113 <p>[[./foo]]
14114 </p><p>[[././bar]]
14115 </p><p>[[././baz/]]
14116 </p>
14117 !! end
14118
14119 !! test
14120 Render invalid page names as plain text (bug 51090)
14121 !! wikitext
14122 [[./../foo|bar]]
14123 [[foo�|bar]]
14124 [[foo/.|bar]]
14125 [[foo/..|bar]]
14126 [[foo~~~bar]]
14127 [[foo>bar]]
14128 [[foo[bar]]
14129 [[.]]
14130 [[..]]
14131 [[foo././bar]]
14132
14133 [[{{echo|./../foo}}|bar]]
14134 [[{{echo|foo/.}}|bar]]
14135 [[{{echo|foo/..}}|bar]]
14136 [[{{echo|foo~~~~bar}}]]
14137 [[{{echo|foo>bar}}]]
14138 [[{{echo|foo././bar}}]]
14139 [[{{echo|foo{bar}}]]
14140 [[{{echo|foo}bar}}]]
14141 [[{{echo|foo[bar}}]]
14142 [[{{echo|foo]bar}}]]
14143 [[{{echo|foo<bar}}]]
14144 !!html/php
14145 <p>[[./../foo|bar]]
14146 [[foo�|bar]]
14147 [[foo/.|bar]]
14148 [[foo/..|bar]]
14149 [[foo~~~bar]]
14150 [[foo&gt;bar]]
14151 [[foo[bar]]
14152 [[.]]
14153 [[..]]
14154 [[foo././bar]]
14155 </p><p>[[./../foo|bar]]
14156 [[foo/.|bar]]
14157 [[foo/..|bar]]
14158 [[foo~~~~bar]]
14159 [[foo&gt;bar]]
14160 [[foo././bar]]
14161 [[foo{bar]]
14162 [[foo}bar]]
14163 [[foo[bar]]
14164 [[foo]bar]]
14165 [[foo&lt;bar]]
14166 </p>
14167 !!html/parsoid
14168 <p>[[./../foo|bar]]
14169 [[foo�|bar]]
14170 [[foo/.|bar]]
14171 [[foo/..|bar]]
14172 [[foo~~~bar]]
14173 [[foo>bar]]
14174 [[foo[bar]]
14175 [[.]]
14176 [[..]]
14177 [[foo././bar]]</p>
14178
14179 <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
14180 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
14181 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
14182 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
14183 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
14184 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
14185 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
14186 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
14187 [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
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&lt;bar"}},"i":0}}]}'>foo&lt;bar</span>]]</p>
14190 !!end
14191
14192 !! test
14193 Disabled subpages
14194 !! wikitext
14195 [[/subpage]]
14196 !! html
14197 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
14198 </p>
14199 !! end
14200
14201 !! test
14202 BUG 561: {{/Subpage}}
14203 !! options
14204 subpage title=[[Page]]
14205 !! wikitext
14206 {{/Subpage}}
14207 !! html
14208 <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>
14209 </p>
14210 !! end
14211
14212 ###
14213 ### Categories
14214 ###
14215 !! article
14216 Category:MediaWiki User's Guide
14217 !! text
14218 blah
14219 !! endarticle
14220
14221 !! test
14222 Link to category
14223 !! wikitext
14224 [[:Category:MediaWiki User's Guide]]
14225 !! html
14226 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
14227 </p>
14228 !! end
14229
14230 !! test
14231 Simple category
14232 !! options
14233 cat
14234 !! wikitext
14235 [[Category:MediaWiki User's Guide]]
14236 !! html
14237 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14238 !! end
14239
14240 !! test
14241 PAGESINCATEGORY invalid title fatal (r33546 fix)
14242 !! wikitext
14243 {{PAGESINCATEGORY:<bogus>}}
14244 !! html
14245 <p>0
14246 </p>
14247 !! end
14248
14249 !! test
14250 Category with different sort key
14251 !! options
14252 cat
14253 !! wikitext
14254 [[Category:MediaWiki User's Guide|Foo]]
14255 !! html
14256 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14257 !! end
14258
14259 !! test
14260 Category with identical sort key
14261 !! options
14262 cat
14263 !! wikitext
14264 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14265 !! html
14266 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
14267 !! end
14268
14269 !! test
14270 Category with empty sort key
14271 !! options
14272 cat
14273 pst
14274 !! wikitext
14275 [[Category:MediaWiki User's Guide|]]
14276 !! html/php
14277 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
14278 !! end
14279
14280 !! test
14281 Category with empty sort key and parentheses
14282 !! options
14283 cat
14284 pst
14285 !! wikitext
14286 [[Category:Foo (bar)|]]
14287 !! html/php
14288 [[Category:Foo (bar)|Foo]]
14289 !! end
14290
14291 ## We used to, but no longer wt2wt this test since the default serializer
14292 ## will normalize all categories to serialize on their own line.
14293 ## This wikitext usage is going to be fairly uncommon in production and
14294 ## selser will take care of preserving formatting in those scenarios.
14295 !! test
14296 Category with link tail
14297 !! options
14298 cat
14299 pst
14300 parsoid=wt2html
14301 !! wikitext
14302 123[[Category:Foo]]456
14303 !! html/php
14304 123[[Category:Foo]]456
14305 !! html/parsoid
14306 <p>123<link rel="mw:PageProp/Category" href="Category:Foo"/>456</p>
14307 !! end
14308
14309 !! test
14310 Category with template
14311 !! options
14312 cat
14313 pst
14314 !! wikitext
14315 [[Category:{{echo|Foo}}]]
14316 !! html/php
14317 [[Category:{{echo|Foo}}]]
14318 !! end
14319
14320 !! test
14321 Category with template in sort key
14322 !! options
14323 cat
14324 pst
14325 !! wikitext
14326 [[Category:Foo|{{echo|Bar}}]]
14327 !! html/php
14328 [[Category:Foo|{{echo|Bar}}]]
14329 !! end
14330
14331 !! test
14332 Category with template in sort key and title
14333 !! options
14334 cat
14335 pst
14336 !! wikitext
14337 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14338 !! html/php
14339 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
14340 !! end
14341
14342 ## We used to, but no longer wt2wt this test since the default serializer
14343 ## will normalize all categories to serialize on their own line.
14344 ## This wikitext usage is going to be fairly uncommon in production and
14345 ## selser will take care of preserving formatting in those scenarios.
14346 !! test
14347 Category / paragraph interactions
14348 !! options
14349 parsoid=wt2html
14350 !! wikitext
14351 Foo [[Category:Baz]] Bar
14352
14353 Foo [[Category:Baz]]
14354 Bar
14355
14356 Foo
14357 [[Category:Baz]]
14358 Bar
14359
14360 Foo
14361 [[Category:Baz]] Bar
14362
14363 Foo
14364 [[Category:Baz]]
14365 [[Category:Baz]]
14366 [[Category:Baz]]
14367 Bar
14368
14369 [[Category:Baz]]
14370 [[Category:Baz]]
14371 [[Category:Baz]]
14372
14373 [[Category:Baz]]
14374 {{echo|[[Category:Baz]]}}
14375 [[Category:Baz]]
14376 !! html/php
14377 <p>Foo Bar
14378 </p><p>Foo
14379 Bar
14380 </p><p>Foo
14381 Bar
14382 </p><p>Foo Bar
14383 </p><p>Foo
14384 Bar
14385 </p>
14386 !! html/parsoid
14387 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14388 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14389 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14390 <p>Foo <link rel="mw:PageProp/Category" href="Category:Baz"/> Bar</p>
14391 <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>
14392 <link rel="mw:PageProp/Category" href="Category:Baz"/>
14393 !! end
14394
14395 ## We used to, but no longer wt2wt this test since the default serializer
14396 ## will normalize all categories to serialize on their own line.
14397 ## This wikitext usage is going to be fairly uncommon in production and
14398 ## selser will take care of preserving formatting in those scenarios.
14399 ##
14400 ## The whitespace on the empty line is part of the test. Please do not delete
14401 !! test
14402 1. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14403 !! options
14404 parsoid=wt2html
14405 !! wikitext
14406 This
14407
14408 [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
14409
14410 {{echo|[[Category:Foo]] and so should this!}}
14411 !! html/php
14412 <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
14413 </p>
14414 !! html/parsoid
14415 <p>This
14416
14417 <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
14418
14419 <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>
14420 !! end
14421
14422 ## Parsoid will not try to wt2wt this while preserving newlines because
14423 ## it suppresses excess newlines within list items -- and we don't want to
14424 ## introduce a special case just for categories, which is, in reality somewhat
14425 ## odd behavior -- categories are unlikely to be used in list items like this
14426 ## in top-level pages and are only likely to show up in template-generated
14427 ## list items where this RT-ing is a non-issue.
14428 ##
14429 ## The whitespace on the empty line is part of the test. Please do not delete
14430 !! test
14431 2. Categories and newlines: All preceding newlines should be suppressed (courtesy bug 87)
14432 !! options
14433 parsoid=wt2html
14434 !! wikitext
14435 * This
14436
14437 [[Category:Foo]] and this should be part of the same list item
14438 * So should this
14439
14440 {{echo|[[Category:Foo]] and this should be part of the same list item}}
14441 !! html
14442 <ul><li>This and this should be part of the same list item</li>
14443 <li>So should this and this should be part of the same list item</li></ul>
14444 !! html/parsoid
14445 <ul>
14446 <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
14447 <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>
14448 </ul>
14449 !! end
14450
14451 ## Newlines and categories that follow the last item of a list
14452 ## are treated differently because this (list followed by categories)
14453 ## is an extremely common pattern on wikis.
14454 !! test
14455 3. Categories and newlines: newline suppression for last list item should RT properly
14456 !! wikitext
14457 * a
14458 * b
14459
14460 [[Category:Foo]]
14461
14462 [[Category:Bar]]
14463 [[Category:Baz]]
14464 !! html/parsoid
14465 <ul><li> a</li>
14466 <li> b</li></ul>
14467
14468 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14469
14470 <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14471 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14472 !! end
14473
14474 !! test
14475 4. Categories and newlines: newline suppression for last list item should RT properly
14476 !! wikitext
14477 * a
14478 **** b
14479
14480 [[Category:Foo]]
14481 !! html/parsoid
14482 <ul><li> a
14483 <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
14484
14485 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14486 !! end
14487
14488 ## only wt2html for this to make sure the algo only applies to the rightmost path
14489 !! test
14490 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
14491 !! options
14492 parsoid=wt2html
14493 !! wikitext
14494 * a
14495 ** b
14496 [[Category:Foo]]
14497 * c
14498 ** d
14499 [[Category:Foo]]
14500 !! html/parsoid
14501 <ul><li> a
14502 <ul><li> b
14503 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
14504 <li> c
14505 <ul><li> d</li></ul></li></ul>
14506 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
14507 !! end
14508
14509 ## We used to, but no longer wt2wt this test since the default serializer
14510 ## will normalize all categories to serialize on their own line.
14511 ## This wikitext usage is going to be fairly uncommon in production and
14512 ## selser will take care of preserving formatting in those scenarios.
14513 !! test
14514 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
14515 !! options
14516 parsoid=wt2html
14517 !! wikitext
14518 * a [[Category:Foo]]
14519 !! html/parsoid
14520 <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>
14521 !! end
14522
14523 # This test also demonstrates because of newline+category tunneling
14524 # through the list hander, template wrapping doesn't expand to the
14525 # containing list when the list item swallows the category.
14526 !! test
14527 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
14528 !! wikitext
14529 * {{echo|a
14530 [[Category:Foo]]}}
14531 !! html/parsoid
14532 <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
14533 </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>
14534 !! end
14535
14536 !! test
14537 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
14538 !! wikitext
14539 * a
14540
14541 {{echo|[[Category:Foo]]
14542 [[Category:Bar]]}}
14543 [[Category:Baz]]
14544 !! html/parsoid
14545 <ul><li> a</li></ul>
14546
14547 <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">
14548 </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
14549 <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
14550 !! end
14551
14552 !! test
14553 Parsoid: Serialize link to category page with colon escape
14554 !! options
14555 parsoid
14556 !! wikitext
14557
14558 [[:Category:Foo]]
14559 [[:Category:Foo|Bar]]
14560 !! html
14561 <p>
14562 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
14563 <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
14564 </p>
14565 !! end
14566
14567 # We used to, but no longer wt2wt this test since the default serializer
14568 # will normalize all categories to serialize on their own line.
14569 # This wikitext usage is going to be fairly uncommon in production and
14570 # selser will take care of preventing whitespace insertion if this
14571 # occurs in an article.
14572 #
14573 # html2html disabled for the same reason (whitespace insertion between
14574 # x and y).
14575 #
14576 # html2wt disabled because it localizes the "Category" namespace.
14577 !! test
14578 Link prefix/suffixes aren't applied to category links
14579 !! options
14580 parsoid=wt2html
14581 language=is
14582 !! wikitext
14583 x[[Category:Foo]]y
14584 !! html/php
14585 <p>xy
14586 </p>
14587 !! html/parsoid
14588 <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
14589 !! end
14590
14591 !! test
14592 Parsoid: Serialize link to file page with colon escape
14593 !! options
14594 parsoid
14595 !! wikitext
14596
14597 [[:File:Foo.png]]
14598 [[:File:Foo.png|Bar]]
14599 !! html
14600 <p>
14601 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
14602 <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
14603 </p>
14604 !! end
14605
14606 !! test
14607 Parsoid: Serialize a genuine category link without colon escape
14608 !! options
14609 parsoid
14610 !! wikitext
14611 [[Category:Foo]]
14612 [[Category:Foo|Bar]]
14613 !! html
14614 <link rel="mw:PageProp/Category" href="./Category:Foo">
14615 <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
14616 !! end
14617
14618 !! test
14619 Normalize hrefs properly before testing for invalid link targets (bug 70894)
14620 !! options
14621 parsoid=html2wt
14622 !! html/parsoid
14623 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
14624 !! wikitext
14625 [[Category:Toxine bactérienne]]
14626 !! end
14627
14628 !! test
14629 Parsoid: Defaultsort
14630 !! wikitext
14631 {{DEFAULTSORT:Foo}}
14632 !! html/parsoid
14633 <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
14634 !! end
14635
14636 !! test
14637 Parsoid: Defaultsort (template-generated)
14638 !! wikitext
14639 {{{{echo|DEFAULTSORT}}:Foo}}
14640 !! html/parsoid
14641 <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}}]}'/>
14642 !! end
14643
14644 ###
14645 ### Inter-language links
14646 ###
14647 !! test
14648 Interlanguage links
14649 !! options
14650 ill
14651 !! wikitext
14652 [[es:Alimento]]
14653 [[fr:Nourriture]]
14654 [[zh:食品]]
14655 !! html/php
14656 es:Alimento fr:Nourriture zh:食品
14657 !! html/parsoid
14658 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
14659 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
14660 <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
14661 !! end
14662
14663 !! test
14664 Duplicate interlanguage links (bug 24502)
14665 !! options
14666 ill
14667 !! wikitext
14668 [[es:1]]
14669 [[es:2]]
14670 [[fr:1]]
14671 [[fr:2]]
14672 !! html/php
14673 es:1 fr:1
14674 !! html/parsoid
14675 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
14676 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
14677 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
14678 <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
14679 !! end
14680
14681 ###
14682 ### Sections
14683 ###
14684 !! test
14685 Basic section headings
14686 !! wikitext
14687 == Headline 1 ==
14688 Some text
14689
14690 ==Headline 2==
14691 More
14692 ===Smaller headline===
14693 Blah blah
14694 !! html
14695 <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>
14696 <p>Some text
14697 </p>
14698 <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>
14699 <p>More
14700 </p>
14701 <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>
14702 <p>Blah blah
14703 </p>
14704 !! end
14705
14706 !! test
14707 Section headings with TOC
14708 !! wikitext
14709 == Headline 1 ==
14710 === Subheadline 1 ===
14711 ===== Skipping a level =====
14712 ====== Skipping a level ======
14713
14714 == Headline 2 ==
14715 Some text
14716 ===Another headline===
14717 !! html
14718 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14719 <ul>
14720 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
14721 <ul>
14722 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
14723 <ul>
14724 <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>
14725 <ul>
14726 <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>
14727 </ul>
14728 </li>
14729 </ul>
14730 </li>
14731 </ul>
14732 </li>
14733 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
14734 <ul>
14735 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
14736 </ul>
14737 </li>
14738 </ul>
14739 </div>
14740
14741 <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>
14742 <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>
14743 <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>
14744 <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>
14745 <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>
14746 <p>Some text
14747 </p>
14748 <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>
14749
14750 !! end
14751
14752 !! test
14753 TOC anchors don't collide
14754 !! wikitext
14755 __FORCETOC__
14756 == Headline 2 ==
14757 == Headline ==
14758 == Headline 2 ==
14759 == Headline ==
14760 !! html/php
14761 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14762 <ul>
14763 <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
14764 <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
14765 <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
14766 <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
14767 </ul>
14768 </div>
14769
14770 <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>
14771 <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>
14772 <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>
14773 <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>
14774
14775 !! end
14776
14777 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
14778 !! test
14779 Handling of sections up to level 6 and beyond
14780 !! wikitext
14781 = Level 1 Heading=
14782 == Level 2 Heading==
14783 === Level 3 Heading===
14784 ==== Level 4 Heading====
14785 ===== Level 5 Heading=====
14786 ====== Level 6 Heading======
14787 ======= Level 7 Heading=======
14788 ======== Level 8 Heading========
14789 ========= Level 9 Heading=========
14790 ========== Level 10 Heading==========
14791 !! html
14792 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14793 <ul>
14794 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
14795 <ul>
14796 <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>
14797 <ul>
14798 <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>
14799 <ul>
14800 <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>
14801 <ul>
14802 <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>
14803 <ul>
14804 <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>
14805 <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>
14806 <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>
14807 <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>
14808 <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>
14809 </ul>
14810 </li>
14811 </ul>
14812 </li>
14813 </ul>
14814 </li>
14815 </ul>
14816 </li>
14817 </ul>
14818 </li>
14819 </ul>
14820 </div>
14821
14822 <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>
14823 <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>
14824 <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>
14825 <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>
14826 <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>
14827 <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>
14828 <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>
14829 <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>
14830 <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>
14831 <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>
14832
14833 !! end
14834
14835 !! test
14836 TOC regression (T11764)
14837 !! wikitext
14838 == title 1 ==
14839 === title 1.1 ===
14840 ==== title 1.1.1 ====
14841 === title 1.2 ===
14842 == title 2 ==
14843 === title 2.1 ===
14844 !! html
14845 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14846 <ul>
14847 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14848 <ul>
14849 <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>
14850 <ul>
14851 <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>
14852 </ul>
14853 </li>
14854 <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>
14855 </ul>
14856 </li>
14857 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14858 <ul>
14859 <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>
14860 </ul>
14861 </li>
14862 </ul>
14863 </div>
14864
14865 <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>
14866 <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>
14867 <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>
14868 <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>
14869 <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>
14870 <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>
14871
14872 !! end
14873
14874 !! test
14875 TOC for heading containing <span id="..."></span> (T96153)
14876 !! wikitext
14877 __FORCETOC__
14878 ==<span id="old-anchor"></span>New title==
14879 !! html/php
14880 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14881 <ul>
14882 <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
14883 </ul>
14884 </div>
14885
14886 <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>
14887
14888 !! end
14889
14890 !! test
14891 TOC with wgMaxTocLevel=3 (bug 6204)
14892 !! options
14893 wgMaxTocLevel=3
14894 !! wikitext
14895 == title 1 ==
14896 === title 1.1 ===
14897 ==== title 1.1.1 ====
14898 === title 1.2 ===
14899 == title 2 ==
14900 === title 2.1 ===
14901 !! html
14902 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14903 <ul>
14904 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
14905 <ul>
14906 <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>
14907 <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>
14908 </ul>
14909 </li>
14910 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
14911 <ul>
14912 <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>
14913 </ul>
14914 </li>
14915 </ul>
14916 </div>
14917
14918 <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>
14919 <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>
14920 <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>
14921 <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>
14922 <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>
14923 <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>
14924
14925 !! end
14926
14927 !! test
14928 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
14929 !! options
14930 wgMaxTocLevel=3
14931 !! wikitext
14932 ==Section 1==
14933 ===Section 1.1===
14934 ====Section 1.1.1====
14935 ====Section 1.1.1.1====
14936 ==Section 2==
14937 !! html
14938 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
14939 <ul>
14940 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
14941 <ul>
14942 <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>
14943 </ul>
14944 </li>
14945 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
14946 </ul>
14947 </div>
14948
14949 <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>
14950 <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>
14951 <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>
14952 <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>
14953 <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>
14954
14955 !! end
14956
14957
14958 !! test
14959 Resolving duplicate section names
14960 !! wikitext
14961 == Foo bar ==
14962 == Foo bar ==
14963 !! html
14964 <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>
14965 <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>
14966
14967 !! end
14968
14969 !! test
14970 Resolving duplicate section names with differing case (bug 10721)
14971 !! wikitext
14972 == Foo bar ==
14973 == Foo Bar ==
14974 !! html
14975 <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>
14976 <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>
14977
14978 !! end
14979
14980 !! article
14981 Template:sections
14982 !! text
14983 ===Section 1===
14984 ==Section 2==
14985 !! endarticle
14986
14987 !! test
14988 Template with sections, __NOTOC__
14989 !! wikitext
14990 __NOTOC__
14991 ==Section 0==
14992 {{sections}}
14993 ==Section 4==
14994 !! html
14995 <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>
14996 <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>
14997 <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>
14998 <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>
14999
15000 !! end
15001
15002 !! test
15003 __NOEDITSECTION__ keyword
15004 !! wikitext
15005 __NOEDITSECTION__
15006 ==Section 1==
15007 ==Section 2==
15008 !! html
15009 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
15010 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
15011
15012 !! end
15013
15014 !! test
15015 Link inside a section heading
15016 !! wikitext
15017 ==Section with a [[Main Page|link]] in it==
15018 !! html
15019 <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>
15020
15021 !! end
15022
15023 !! test
15024 TOC regression (T14077)
15025 !! wikitext
15026 __TOC__
15027 == title 1 ==
15028 === title 1.1 ===
15029 == title 2 ==
15030 !! html
15031 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15032 <ul>
15033 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
15034 <ul>
15035 <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>
15036 </ul>
15037 </li>
15038 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
15039 </ul>
15040 </div>
15041
15042 <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>
15043 <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>
15044 <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>
15045
15046 !! end
15047
15048 !! test
15049 BUG 1219 URL next to image (good)
15050 !! wikitext
15051 http://example.com [[File:Foobar.jpg]]
15052 !! html/php
15053 <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>
15054 </p>
15055 !! html/parsoid
15056 <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>
15057 !!end
15058
15059 !! test
15060 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
15061 !! wikitext
15062 ===
15063 The line above must have a trailing space!
15064 === <!--
15065 --> <!-- -->
15066 But just in case it doesn't...
15067 !! html
15068 <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>
15069 <p>The line above must have a trailing space!
15070 </p>
15071 <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>
15072 <p>But just in case it doesn't...
15073 </p>
15074 !! end
15075
15076 !! test
15077 Header with special characters (bug 25462)
15078 !! wikitext
15079 The tooltips shall not show entities to the user (ie. be double escaped)
15080
15081 == text > text ==
15082 section 1
15083
15084 == text < text ==
15085 section 2
15086
15087 == text & text ==
15088 section 3
15089
15090 == text ' text ==
15091 section 4
15092
15093 == text " text ==
15094 section 5
15095 !! html
15096 <p>The tooltips shall not show entities to the user (ie. be double escaped)
15097 </p>
15098 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15099 <ul>
15100 <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>
15101 <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>
15102 <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>
15103 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
15104 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
15105 </ul>
15106 </div>
15107
15108 <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>
15109 <p>section 1
15110 </p>
15111 <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>
15112 <p>section 2
15113 </p>
15114 <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>
15115 <p>section 3
15116 </p>
15117 <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>
15118 <p>section 4
15119 </p>
15120 <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>
15121 <p>section 5
15122 </p>
15123 !! end
15124
15125 !! test
15126 Header with space, plus and underscore as entity
15127 !! wikitext
15128 Id should not contain + for spaces
15129
15130 == Space between Text ==
15131 section 1
15132
15133 == Space-Entity&#32;between&#32;Text ==
15134 section 2
15135
15136 == Plus+between+Text ==
15137 section 3
15138
15139 == Plus-Entity&#43;between&#43;Text ==
15140 section 4
15141
15142 == Underscore_between_Text ==
15143 section 5
15144
15145 == Underscore-Entity&#95;between&#95;Text ==
15146 section 6
15147
15148 [[#Space between Text]]
15149 [[#Space-Entity&#32;between&#32;Text]]
15150 [[#Plus+between+Text]]
15151 [[#Plus-Entity&#43;between&#43;Text]]
15152 [[#Underscore_between_Text]]
15153 [[#Underscore-Entity&#95;between&#95;Text]]
15154 !! html
15155 <p>Id should not contain + for spaces
15156 </p>
15157 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15158 <ul>
15159 <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>
15160 <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>
15161 <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>
15162 <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>
15163 <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>
15164 <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>
15165 </ul>
15166 </div>
15167
15168 <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>
15169 <p>section 1
15170 </p>
15171 <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>
15172 <p>section 2
15173 </p>
15174 <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>
15175 <p>section 3
15176 </p>
15177 <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>
15178 <p>section 4
15179 </p>
15180 <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>
15181 <p>section 5
15182 </p>
15183 <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>
15184 <p>section 6
15185 </p><p><a href="#Space_between_Text">#Space between Text</a>
15186 <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
15187 <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
15188 <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
15189 <a href="#Underscore_between_Text">#Underscore_between_Text</a>
15190 <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
15191 </p>
15192 !! end
15193
15194 !! test
15195 Headers with excess '=' characters
15196 (Are similar tests necessary beyond the 1st level?)
15197 !! wikitext
15198 =foo==
15199 ==foo=
15200 =''italic'' heading==
15201 ==''italic'' heading=
15202 !! html
15203 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15204 <ul>
15205 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
15206 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
15207 <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>
15208 <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>
15209 </ul>
15210 </div>
15211
15212 <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>
15213 <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>
15214 <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>
15215 <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>
15216
15217 !! end
15218
15219 !! test
15220 HTML headers vs TOC (bug 23393)
15221 (__NOEDITSECTION__ for clearer output, doesn't matter here)
15222 !! wikitext
15223 <h1>Header 1</h1>
15224 == Header 1.1 ==
15225 == Header 1.2 ==
15226
15227 <h1>Header 2
15228 </h1>
15229 == Header 2.1 ==
15230 == Header 2.2 ==
15231 __NOEDITSECTION__
15232 !! html
15233 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
15234 <ul>
15235 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
15236 <ul>
15237 <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>
15238 <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>
15239 </ul>
15240 </li>
15241 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
15242 <ul>
15243 <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>
15244 <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>
15245 </ul>
15246 </li>
15247 </ul>
15248 </div>
15249
15250 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
15251 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
15252 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
15253 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
15254 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
15255 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
15256
15257 !! end
15258
15259 !! test
15260 Single-line or multiline-comments can follow headings
15261 !! options
15262 parsoid=wt2html,wt2wt
15263 !! wikitext
15264 ==foo==<!---->
15265 ==bar==<!--c1-->
15266 ==baz==<!--
15267 c2
15268 c3-->
15269 !! html
15270 <h2><span class="mw-headline" id="foo">foo</span></h2>
15271 <h2><span class="mw-headline" id="bar">bar</span></h2>
15272 <h2><span class="mw-headline" id="baz">baz</span></h2>
15273
15274 !! end
15275
15276 !! test
15277 BUG 1219 URL next to image (broken)
15278 !! wikitext
15279 http://example.com[[File:Foobar.jpg]]
15280 !! html/php
15281 <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>
15282 </p>
15283 !! html/parsoid
15284 <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>
15285 !!end
15286
15287 !! test
15288 Bug 1186 news: in the middle of text
15289 !! wikitext
15290 http://en.wikinews.org/wiki/Wikinews:Workplace
15291 !! html
15292 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
15293 </p>
15294 !!end
15295
15296
15297 !! test
15298 Namespaced link must have a title
15299 !! wikitext
15300 [[Project:]]
15301 !! html
15302 <p>[[Project:]]
15303 </p>
15304 !!end
15305
15306 !! test
15307 Namespaced link must have a title (bad fragment version)
15308 !! wikitext
15309 [[Project:#fragment]]
15310 !! html
15311 <p>[[Project:#fragment]]
15312 </p>
15313 !!end
15314
15315
15316 ###
15317 ### HTML tags and HTML attributes
15318 ###
15319
15320 !! test
15321 div with no attributes
15322 !! wikitext
15323 <div>HTML rocks</div>
15324 !! html
15325 <div>HTML rocks</div>
15326
15327 !! end
15328
15329 !! test
15330 div with double-quoted attribute
15331 !! wikitext
15332 <div id="rock">HTML rocks</div>
15333 !! html
15334 <div id="rock">HTML rocks</div>
15335
15336 !! end
15337
15338 !! test
15339 div with single-quoted attribute
15340 !! wikitext
15341 <div id='rock'>HTML rocks</div>
15342 !! html
15343 <div id="rock">HTML rocks</div>
15344
15345 !! end
15346
15347 !! test
15348 div with unquoted attribute
15349 !! wikitext
15350 <div id=rock>HTML rocks</div>
15351 !! html
15352 <div id="rock">HTML rocks</div>
15353
15354 !! end
15355
15356 !! test
15357 div with illegal double attributes
15358 !! wikitext
15359 <div id="a" id="b">HTML rocks</div>
15360 !! html
15361 <div id="b">HTML rocks</div>
15362
15363 !!end
15364
15365 # FIXME: produce empty string instead of "class" in the PHP parser, following
15366 # the HTML5 spec.
15367 !! test
15368 div with empty attribute value, space before equals
15369 !! options
15370 parsoid
15371 !! wikitext
15372 <div class =>HTML rocks</div>
15373 !! html
15374 <div class="">HTML rocks</div>
15375
15376 !! end
15377
15378 !! test
15379 div with multiple empty attribute values
15380 !! options
15381 parsoid
15382 !! wikitext
15383 <div id= title=>HTML rocks</div>
15384 !! html
15385 <div id="" title="">HTML rocks</div>
15386
15387 !! end
15388
15389 !! test
15390 table with multiple empty attribute values
15391 !! options
15392 parsoid
15393 !! wikitext
15394 {| title= id=
15395 | hi
15396 |}
15397 !! html
15398 <table title="" id="">
15399 <tbody><tr><td> hi</td></tr>
15400 </tbody></table>
15401 !! end
15402
15403 !! test
15404 div with braces in attribute value
15405 !! wikitext
15406 <div title="{}">Foo</div>
15407 !! html/php
15408 <div title="&#123;}">Foo</div>
15409
15410 !! html/parsoid
15411 <div title="{}">Foo</div>
15412 !! end
15413
15414 # This it very inconsistent in the PHP parser: it returns
15415 # class="class" if there is a space between the name and the equal sign (see
15416 # 'div with empty attribute value, space before equals'), but strips the
15417 # attribute completely if the space is missing. We hope that not much content
15418 # depends on this, so are implementing the behavior below in Parsoid for
15419 # consistencies' sake.
15420 # FIXME: fix this behavior in the PHP parser?
15421 !! test
15422 div with empty attribute value, no space before equals
15423 !! options
15424 parsoid=wt2html,html2html
15425 !! wikitext
15426 <div class=>HTML rocks</div>
15427 !! html/php
15428 <div>HTML rocks</div>
15429
15430 !! html/parsoid
15431 <div class="">HTML rocks</div>
15432 !! end
15433
15434 !! test
15435 HTML multiple attributes correction
15436 !! wikitext
15437 <p class="error" class="awesome">Awesome!</p>
15438 !! html
15439 <p class="awesome">Awesome!</p>
15440
15441 !!end
15442
15443 !! test
15444 Table multiple attributes correction
15445 !! wikitext
15446 {|
15447 !+ class="error" class="awesome"| status
15448 |}
15449 !! html
15450 <table>
15451 <tr>
15452 <th class="awesome"> status
15453 </th></tr></table>
15454
15455 !!end
15456
15457 !! test
15458 DIV IN UPPERCASE
15459 !! wikitext
15460 <DIV ID="x">HTML ROCKS</DIV>
15461 !! html
15462 <div id="x">HTML ROCKS</div>
15463
15464 !!end
15465
15466 !! test
15467 Non-ASCII pseudo-tags are rendered as text
15468 !! wikitext
15469 <khyô>
15470 !! html
15471 <p>&lt;khyô&gt;
15472 </p>
15473 !! end
15474
15475 !! test
15476 Pseudo-tag with URL 'name' renders as url link
15477 !! wikitext
15478 <http://example.com/>
15479 !! html
15480 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
15481 </p>
15482 !! end
15483
15484 !! test
15485 text with amp in the middle of nowhere
15486 !! wikitext
15487 Remember AT&T?
15488 !! html
15489 <p>Remember AT&amp;T?
15490 </p>
15491 !! end
15492
15493 !! test
15494 text with character entity: eacute
15495 !! wikitext
15496 I always thought &eacute; was a cute letter.
15497 !! html
15498 <p>I always thought &#233; was a cute letter.
15499 </p>
15500 !! html+tidy
15501 <p>I always thought é was a cute letter.</p>
15502 !! end
15503
15504 !! test
15505 text with entity-escaped character entity-like string: eacute
15506 !! wikitext
15507 I always thought &amp;eacute; was a cute letter.
15508 !! html
15509 <p>I always thought &amp;eacute; was a cute letter.
15510 </p>
15511 !! end
15512
15513 !! test
15514 text with undefined character entity: xacute
15515 !! wikitext
15516 I always thought &xacute; was a cute letter.
15517 !! html
15518 <p>I always thought &amp;xacute; was a cute letter.
15519 </p>
15520 !! end
15521
15522 !! test
15523 HTML5 tags
15524 !! wikitext
15525 <data value="5">five</data>
15526 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15527 <mark>This highlighted text</mark>
15528 !! html
15529 <p><data value="5">five</data>
15530 <time datetime="2000-01-01T00:00Z">The new millenium started</time>
15531 <mark>This highlighted text</mark>
15532 </p>
15533 !! end
15534
15535 !! test
15536 HTML tag with leading space is parsed as text
15537 !! wikitext
15538 < div>foo< /div>
15539 !! html
15540 <p>&lt; div&gt;foo&lt; /div&gt;
15541 </p>
15542 !! end
15543
15544 ###
15545 ### Nesting tests (see bug 41545, 50604, 51081)
15546 ###
15547
15548 # This test case is fixed in Parsoid by domino 1.0.12. (bug 50604)
15549 # Note that html2wt is considerably more difficult if we use <b> in
15550 # the test case, instead of <big>
15551 !! test
15552 Ensure that HTML adoption agency algorithm is properly implemented.
15553 !! wikitext
15554 <big>X<big>Y</big>Z</big>
15555 !! html
15556 <p><big>X<big>Y</big>Z</big>
15557 </p>
15558 !! end
15559
15560 # This was bug 41545 in the PHP parser.
15561 # Note that tidy doesn't handle this correctly.
15562 !! test
15563 Nesting of <kbd>
15564 !! wikitext
15565 <kbd>X<kbd>Y</kbd>Z</kbd>
15566 !! html
15567 <p><kbd>X<kbd>Y</kbd>Z</kbd>
15568 </p>
15569 !! end
15570
15571 # The following cases were bug 51081 in the PHP parser.
15572 # Note that there are some other nestable tags (b, i, etc) which are
15573 # not covered; see bug 51081 for discussion.
15574
15575 # Note that tidy doesn't handle this correctly.
15576 !! test
15577 Nesting of <em>
15578 !! wikitext
15579 <em>X<em>Y</em>Z</em>
15580 !! html
15581 <p><em>X<em>Y</em>Z</em>
15582 </p>
15583 !! end
15584
15585 # Note that tidy doesn't handle this correctly.
15586 !! test
15587 Nesting of <strong>
15588 !! wikitext
15589 <strong>X<strong>Y</strong>Z</strong>
15590 !! html
15591 <p><strong>X<strong>Y</strong>Z</strong>
15592 </p>
15593 !! end
15594
15595 !! test
15596 Nesting of <q>
15597 !! wikitext
15598 <q>X<q>Y</q>Z</q>
15599 !! html+tidy
15600 <p><q>X<q>Y</q>Z</q></p>
15601 !! end
15602
15603 # Note that tidy doesn't handle this correctly.
15604 !! test
15605 Nesting of <ruby>
15606 !! wikitext
15607 <ruby>X<ruby>Y</ruby>Z</ruby>
15608 !! html
15609 <p><ruby>X<ruby>Y</ruby>Z</ruby>
15610 </p>
15611 !! end
15612
15613 # Note that tidy doesn't handle this correctly.
15614 !! test
15615 Nesting of <bdo>
15616 !! wikitext
15617 <bdo>X<bdo>Y</bdo>Z</bdo>
15618 !! html
15619 <p><bdo>X<bdo>Y</bdo>Z</bdo>
15620 </p>
15621 !! end
15622
15623
15624 ###
15625 ### Media links
15626 ###
15627
15628 !! test
15629 Media link
15630 !! wikitext
15631 [[Media:Foobar.jpg]]
15632 !! html
15633 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
15634 </p>
15635 !! end
15636
15637 !! test
15638 Media link with text
15639 !! wikitext
15640 [[Media:Foobar.jpg|A neat file to look at]]
15641 !! html
15642 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
15643 </p>
15644 !! end
15645
15646 # FIXME: this is still bad HTML tag nesting
15647 # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
15648 !! test
15649 Media link with nasty text
15650 !! wikitext
15651 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
15652 !! html
15653 <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>
15654
15655 !! html+tidy
15656 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p>
15657 <div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div>
15658 !! end
15659
15660 !! test
15661 Media link to nonexistent file (bug 1702)
15662 !! wikitext
15663 [[Media:No such.jpg]]
15664 !! html
15665 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
15666 </p>
15667 !! end
15668
15669 !! test
15670 Image link to nonexistent file (bug 1850 - good)
15671 !! wikitext
15672 [[File:No_such.jpg]]
15673 !! html/php
15674 <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>
15675 </p>
15676 !! html/parsoid
15677 <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>
15678 !! end
15679
15680 !! test
15681 :Image link to nonexistent file (bug 1850 - bad)
15682 !! wikitext
15683 [[:Image:No such.jpg]]
15684 !! html/php
15685 <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>
15686 </p>
15687 !! html/parsoid
15688 <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
15689 !! end
15690
15691
15692
15693 !! test
15694 Character reference normalization in link text (bug 1938)
15695 !! wikitext
15696 [[Main Page|this&that]]
15697 !! html
15698 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
15699 </p>
15700 !!end
15701
15702 !! article
15703 אַ
15704 !! text
15705 Test for unicode normalization
15706
15707 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
15708 !! endarticle
15709
15710 !! test
15711 (bug 19451) Links should refer to the normalized form.
15712 !! wikitext
15713 [[&#xFB2E;]]
15714 [[&#x5d0;&#x5b7;]]
15715 [[&#x5d0;ַ]]
15716 [[א&#x5b7;]]
15717 [[אַ]]
15718 !! html
15719 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
15720 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
15721 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
15722 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
15723 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
15724 </p>
15725 !! end
15726
15727 !! test
15728 Empty attribute crash test (bug 2067)
15729 !! wikitext
15730 <font color="">foo</font>
15731 !! html
15732 <p><font color="">foo</font>
15733 </p>
15734 !! end
15735
15736 !! test
15737 Empty attribute crash test single-quotes (bug 2067)
15738 !! wikitext
15739 <font color=''>foo</font>
15740 !! html
15741 <p><font color="">foo</font>
15742 </p>
15743 !! end
15744
15745 !! test
15746 Attribute test: equals, then nothing
15747 !! wikitext
15748 <font color=>foo</font>
15749 !! html
15750 <p><font>foo</font>
15751 </p>
15752 !! end
15753
15754 !! test
15755 Attribute test: unquoted value
15756 !! wikitext
15757 <font color=x>foo</font>
15758 !! html
15759 <p><font color="x">foo</font>
15760 </p>
15761 !! end
15762
15763 !! test
15764 Attribute test: unquoted but illegal value (hash)
15765 !! wikitext
15766 <font color=#x>foo</font>
15767 !! html
15768 <p><font color="#x">foo</font>
15769 </p>
15770 !! end
15771
15772 # Parsoid does not serialize to empty attribute syntax,
15773 # so wt2wt and html2wt cases are skipped
15774 !! test
15775 Attribute test: no value (T54330)
15776 !! options
15777 parsoid=wt2html,html2html
15778 !! wikitext
15779 <font color>foo</font>
15780 !! html/php
15781 <p><font color="">foo</font>
15782 </p>
15783 !! html/parsoid
15784 <p><font color="">foo</font></p>
15785 !! end
15786
15787 !! test
15788 Bug 2095: link with three closing brackets
15789 !! wikitext
15790 [[Main Page]]]
15791 !! html/php
15792 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
15793 </p>
15794 !! html/parsoid
15795 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
15796 !! end
15797
15798 !! test
15799 Bug 2095: link with pipe and three closing brackets
15800 !! wikitext
15801 [[Main Page|link]]]
15802 !! html/php
15803 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
15804 </p>
15805 !! html/parsoid
15806 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
15807 !! end
15808
15809 !! test
15810 Bug 2095: link with pipe and three closing brackets, version 2
15811 !! wikitext
15812 [[Main Page|[http://example.com/]]]
15813 !! html/php
15814 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
15815 </p>
15816 !! html/parsoid
15817 <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
15818 !! end
15819
15820
15821 ###
15822 ### Safety
15823 ###
15824
15825 !! article
15826 Template:Dangerous attribute
15827 !! text
15828 " onmouseover="alert(document.cookie)
15829 !! endarticle
15830
15831 !! article
15832 Template:Dangerous style attribute
15833 !! text
15834 border-size: expression(alert(document.cookie))
15835 !! endarticle
15836
15837 !! article
15838 Template:Div style
15839 !! text
15840 <div style="float: right; {{{1}}}">Magic div</div>
15841 !! endarticle
15842
15843 !! test
15844 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
15845 !! wikitext
15846 <div title="{{test}}"></div>
15847 !! html
15848 <div title="This is a test template"></div>
15849
15850 !! end
15851
15852 # Parsoid has enough context to handle this case
15853 !! test
15854 Bug 2304: HTML attribute safety (dangerous template; 2309)
15855 !! wikitext
15856 <div title="{{dangerous attribute}}"></div>
15857 !! html/php
15858 <div title=""></div>
15859
15860 !! html/parsoid
15861 <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>
15862 !! end
15863
15864 !! test
15865 Bug 2304: HTML attribute safety (dangerous style template; 2309)
15866 !! wikitext
15867 <div style="{{dangerous style attribute}}"></div>
15868 !! html
15869 <div style="/* insecure input */"></div>
15870
15871 !! end
15872
15873 !! test
15874 Bug 2304: HTML attribute safety (safe parameter; 2309)
15875 !! wikitext
15876 {{div style|width: 200px}}
15877 !! html
15878 <div style="float: right; width: 200px">Magic div</div>
15879
15880 !! end
15881
15882 !! test
15883 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
15884 !! wikitext
15885 {{div style|width: expression(alert(document.cookie))}}
15886 !! html
15887 <div style="/* insecure input */">Magic div</div>
15888
15889 !! end
15890
15891 !! test
15892 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
15893 !! wikitext
15894 {{div style|"><script>alert(document.cookie)</script>}}
15895 !! html
15896 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15897
15898 !! end
15899
15900 !! test
15901 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
15902 !! wikitext
15903 {{div style|" ><script>alert(document.cookie)</script>}}
15904 !! html
15905 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
15906
15907 !! end
15908
15909 !! test
15910 Bug 2304: HTML attribute safety (link)
15911 !! wikitext
15912 <div title="[[Main Page]]"></div>
15913 !! html
15914 <div title="&#91;&#91;Main Page]]"></div>
15915
15916 !! end
15917
15918 !! test
15919 Bug 2304: HTML attribute safety (italics)
15920 !! wikitext
15921 <div title="''foobar''"></div>
15922 !! html
15923 <div title="&#39;&#39;foobar&#39;&#39;"></div>
15924
15925 !! end
15926
15927 !! test
15928 Bug 2304: HTML attribute safety (bold)
15929 !! wikitext
15930 <div title="'''foobar'''"></div>
15931 !! html
15932 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
15933
15934 !! end
15935
15936
15937 !! test
15938 Bug 2304: HTML attribute safety (ISBN)
15939 !! wikitext
15940 <div title="ISBN 1234567890"></div>
15941 !! html
15942 <div title="&#73;SBN 1234567890"></div>
15943
15944 !! end
15945
15946 !! test
15947 Bug 2304: HTML attribute safety (RFC)
15948 !! wikitext
15949 <div title="RFC 1234"></div>
15950 !! html
15951 <div title="&#82;FC 1234"></div>
15952
15953 !! end
15954
15955 !! test
15956 Bug 2304: HTML attribute safety (PMID)
15957 !! wikitext
15958 <div title="PMID 1234567890"></div>
15959 !! html
15960 <div title="&#80;MID 1234567890"></div>
15961
15962 !! end
15963
15964 !! test
15965 Bug 2304: HTML attribute safety (web link)
15966 !! wikitext
15967 <div title="http://example.com/"></div>
15968 !! html
15969 <div title="http&#58;//example.com/"></div>
15970
15971 !! end
15972
15973 !! test
15974 Bug 2304: HTML attribute safety (named web link)
15975 !! wikitext
15976 <div title="[http://example.com/ link]"></div>
15977 !! html
15978 <div title="&#91;http&#58;//example.com/ link]"></div>
15979
15980 !! end
15981
15982 !! test
15983 Bug 3244: HTML attribute safety (extension; safe)
15984 !! wikitext
15985 <div style="<nowiki>background:blue</nowiki>"></div>
15986 !! html
15987 <div style="background:blue"></div>
15988
15989 !! end
15990
15991 !! test
15992 Bug 3244: HTML attribute safety (extension; unsafe)
15993 !! wikitext
15994 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
15995 !! html
15996 <div style="/* insecure input */"></div>
15997
15998 !! end
15999
16000 # More MSIE fun discovered by Tom Gilder
16001
16002 !! test
16003 MSIE CSS safety test: spurious slash
16004 !! wikitext
16005 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
16006 !! html
16007 <div style="/* insecure input */">evil</div>
16008
16009 !! end
16010
16011 !! test
16012 MSIE CSS safety test: hex code
16013 !! wikitext
16014 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
16015 !! html
16016 <div style="/* insecure input */">evil</div>
16017
16018 !! end
16019
16020 !! test
16021 MSIE CSS safety test: comment in url
16022 !! wikitext
16023 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
16024 !! html
16025 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
16026
16027 !! end
16028
16029 !! test
16030 MSIE CSS safety test: comment in expression
16031 !! wikitext
16032 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
16033 !! html
16034 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
16035
16036 !! end
16037
16038 !! test
16039 CSS safety test (all browsers): vertical tab (bug 55332 / CVE-2013-4567)
16040 !! wikitext
16041 <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
16042 !! html
16043 <p style="/* invalid control char */">A</p>
16044
16045 !! end
16046
16047 !! test
16048 MSIE 6 CSS safety test: Fullwidth (bug 55332)
16049 !! wikitext
16050 <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
16051 <div style="top:EXPRESSION(alert())">B</div>
16052 !! html
16053 <p style="/* insecure input */">A</p>
16054 <div style="/* insecure input */">B</div>
16055
16056 !! end
16057
16058 !! test
16059 MSIE 6 CSS safety test: IPA extensions (bug 55332)
16060 !! wikitext
16061 <div style="background-image:uʀʟ(javascript:alert())">A</div>
16062 <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
16063 !! html
16064 <div style="/* insecure input */">A</div>
16065 <p style="/* insecure input */">B</p>
16066
16067 !! end
16068
16069 !! test
16070 MSIE 6 CSS safety test: sup/sub script (bug 55332)
16071 !! wikitext
16072 <div style="background-image:url⁽javascript:alert())">A</div>
16073 <div style="background-image:url₍javascript:alert())">B</div>
16074 <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
16075 !! html
16076 <div style="/* insecure input */">A</div>
16077 <div style="/* insecure input */">B</div>
16078 <p style="/* insecure input */">C</p>
16079
16080 !! end
16081
16082 # FIXME: Parsoid fails to sanitize this! See T58846.
16083 !! test
16084 Opera -o-link CSS
16085 !! wikitext
16086 <div
16087 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;"
16088 style="-o-link:attr(title);-o-link-source:current">X</div>
16089 !! html
16090 <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
16091
16092 !! end
16093
16094 !! test
16095 MSIE 6 CSS safety test: Repetition markers (bug 55332)
16096 !! wikitext
16097 <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
16098 <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
16099 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
16100 <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
16101 <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
16102 <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
16103 <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
16104 !! html
16105 <p style="/* insecure input */">A</p>
16106 <p style="/* insecure input */">B</p>
16107 <p style="/* insecure input */">C</p>
16108 <p style="/* insecure input */">D</p>
16109 <p style="/* insecure input */">E</p>
16110 <p style="/* insecure input */">F</p>
16111 <p style="/* insecure input */">G</p>
16112
16113 !! end
16114
16115 !! test
16116 Table attribute legitimate extension
16117 !! wikitext
16118 {|
16119 !+ style="<nowiki>color:blue</nowiki>"| status
16120 |}
16121 !! html
16122 <table>
16123 <tr>
16124 <th style="color:blue"> status
16125 </th></tr></table>
16126
16127 !!end
16128
16129 !! test
16130 Table attribute safety
16131 !! wikitext
16132 {|
16133 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
16134 |}
16135 !! html
16136 <table>
16137 <tr>
16138 <th style="/* insecure input */"> status
16139 </th></tr></table>
16140
16141 !! end
16142
16143 !! test
16144 CSS line continuation 1
16145 !! wikitext
16146 <div style="background-image: u\&#10;rl(test.jpg);"></div>
16147 !! html
16148 <div style="/* insecure input */"></div>
16149
16150 !! end
16151
16152 !! test
16153 CSS line continuation 2
16154 !! wikitext
16155 <div style="background-image: u\&#13;rl(test.jpg); "></div>
16156 !! html
16157 <div style="/* invalid control char */"></div>
16158
16159 !! end
16160
16161 !! article
16162 Template:Identity
16163 !! text
16164 {{{1}}}
16165 !! endarticle
16166
16167 !! test
16168 Expansion of multi-line templates in attribute values (bug 6255)
16169 !! wikitext
16170 <div style="background: {{identity|#00FF00}}">-</div>
16171 !! html
16172 <div style="background: #00FF00">-</div>
16173
16174 !! end
16175
16176
16177 !! test
16178 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
16179 !! wikitext
16180 <div style="background:
16181 #00FF00">-</div>
16182 !! html/php
16183 <div style="background: #00FF00">-</div>
16184
16185 !! html/parsoid
16186 <div style="background:
16187 #00FF00">-</div>
16188 !! end
16189
16190 !! test
16191 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
16192 !! wikitext
16193 <div style="background: &#10;#00FF00">-</div>
16194 !! html
16195 <div style="background: &#10;#00FF00">-</div>
16196
16197 !! end
16198
16199 !! test
16200 evil <math>-wiki-tags without Extension:Math enabled
16201 !! wikitext
16202 <math><img src="some evil external link"><script>some_evil_javascript();</script></math>
16203 !! html+tidy
16204 <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>
16205 !! end
16206
16207 ###
16208 ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
16209 ###
16210 !! test
16211 Parser hook: empty input
16212 !! wikitext
16213 <tag></tag>
16214 !! html/php
16215 <pre>
16216 ''
16217 array (
16218 )
16219 </pre>
16220
16221 !! html/parsoid
16222 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16223 !! end
16224
16225 ## Don't expect parsoid to rt this form.
16226 !! test
16227 Parser hook: empty input using terminated empty elements
16228 !! options
16229 parsoid=wt2html,html2html
16230 !! wikitext
16231 <tag/>
16232 !! html/php
16233 <pre>
16234 NULL
16235 array (
16236 )
16237 </pre>
16238
16239 !! html/parsoid
16240 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16241 !! end
16242
16243 !! test
16244 Parser hook: empty input using terminated empty elements (space before)
16245 !! wikitext
16246 <tag />
16247 !! html/php
16248 <pre>
16249 NULL
16250 array (
16251 )
16252 </pre>
16253
16254 !! html/parsoid
16255 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
16256 !! end
16257
16258 !! test
16259 Parser hook: basic input
16260 !! wikitext
16261 <tag>input</tag>
16262 !! html/php
16263 <pre>
16264 'input'
16265 array (
16266 )
16267 </pre>
16268
16269 !! html/parsoid
16270 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16271 !! end
16272
16273 ## Don't expect parsoid to rt this form.
16274 !! test
16275 Parser hook: case insensitive
16276 !! options
16277 parsoid=wt2html,html2html
16278 !! wikitext
16279 <TAG>input</TAG>
16280 !! html/php
16281 <pre>
16282 'input'
16283 array (
16284 )
16285 </pre>
16286
16287 !! html/parsoid
16288 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16289 !! end
16290
16291 ## Don't expect parsoid to rt this form.
16292 !! test
16293 Parser hook: case insensitive, redux
16294 !! options
16295 parsoid=wt2html,html2html
16296 !! wikitext
16297 <TaG>input</TAg>
16298 !! html/php
16299 <pre>
16300 'input'
16301 array (
16302 )
16303 </pre>
16304
16305 !! html/parsoid
16306 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
16307 !! end
16308
16309 !! test
16310 Parser hook: nested tags
16311 !! options
16312 noxml
16313 !! wikitext
16314 <tag><tag></tag></tag>
16315 !! html/php
16316 <pre>
16317 '<tag>'
16318 array (
16319 )
16320 </pre>&lt;/tag&gt;
16321
16322 !! html/parsoid
16323 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
16324 !! end
16325
16326 !! test
16327 Parser hook: basic arguments
16328 !! wikitext
16329 <tag width="200" height="100" depth="50" square=""></tag>
16330 !! html/php
16331 <pre>
16332 ''
16333 array (
16334 'width' => '200',
16335 'height' => '100',
16336 'depth' => '50',
16337 'square' => '',
16338 )
16339 </pre>
16340
16341 !! html/parsoid
16342 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16343 !! end
16344
16345 ## Don't expect parsoid to rt this form.
16346 !! test
16347 Parser hook: basic arguments, variations
16348 !! options
16349 parsoid=wt2html,html2html
16350 !! wikitext
16351 <tag width=200 height = "100" depth = '50' square></tag>
16352 !! html/php
16353 <pre>
16354 ''
16355 array (
16356 'width' => '200',
16357 'height' => '100',
16358 'depth' => '50',
16359 'square' => '',
16360 )
16361 </pre>
16362
16363 !! html/parsoid
16364 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16365 !! end
16366
16367 !! test
16368 Parser hook: argument containing a forward slash (bug 5344)
16369 !! wikitext
16370 <tag filename="/tmp/bla"></tag>
16371 !! html/php
16372 <pre>
16373 ''
16374 array (
16375 'filename' => '/tmp/bla',
16376 )
16377 </pre>
16378
16379 !! html/parsoid
16380 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
16381 !! end
16382
16383 ## Don't expect parsoid to rt this form.
16384 !! test
16385 Parser hook: empty input using terminated empty elements (bug 2374)
16386 !! options
16387 parsoid=wt2html,html2html
16388 !! wikitext
16389 <tag foo=bar/>text
16390 !! html/php
16391 <pre>
16392 NULL
16393 array (
16394 'foo' => 'bar',
16395 )
16396 </pre>text
16397
16398 !! html/parsoid
16399 <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
16400 !! end
16401
16402 # </tag> should be output literally since there is no matching tag that begins it
16403 !! test
16404 Parser hook: basic arguments using terminated empty elements (bug 2374)
16405 !! wikitext
16406 <tag width=200 height = "100" depth = '50' square/>
16407 other stuff
16408 </tag>
16409 !! html/php
16410 <pre>
16411 NULL
16412 array (
16413 'width' => '200',
16414 'height' => '100',
16415 'depth' => '50',
16416 'square' => '',
16417 )
16418 </pre>
16419 <p>other stuff
16420 &lt;/tag&gt;
16421 </p>
16422 !! end
16423
16424 ###
16425 ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
16426 ###
16427
16428 !! test
16429 Parser hook: static parser hook not inside a comment
16430 !! wikitext
16431 <statictag>hello, world</statictag>
16432
16433 <statictag action="flush" />
16434 !! html/php
16435 <p><br />
16436 hello, world
16437 </p>
16438 !! html/parsoid
16439 <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
16440 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
16441 !! end
16442
16443 !! test
16444 Parser hook: static parser hook inside a comment
16445 !! wikitext
16446 <!-- <statictag>hello, world</statictag> -->
16447 <statictag action="flush" />
16448 !! html/php
16449 <p><br />
16450 </p>
16451 !! html/parsoid
16452 <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
16453 <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt2"></p>
16454 !! end
16455
16456 # Nested template calls; this case was broken by Parser.php rev 1.506,
16457 # since reverted.
16458
16459 !! article
16460 Template:One-parameter
16461 !! text
16462 (My parameter is: {{{1}}})
16463 !! endarticle
16464
16465 !! article
16466 Template:Map-one-parameter
16467 !! text
16468 {{{{{1}}}|{{{2}}}}}
16469 !! endarticle
16470
16471 !! test
16472 Nested template calls
16473 !! wikitext
16474 {{Map-one-parameter|One-parameter|param}}
16475 !! html
16476 <p>(My parameter is: param)
16477 </p>
16478 !! end
16479
16480
16481 ###
16482 ### Sanitizer
16483 ###
16484
16485 # HTML+Tidy effectively strips out the empty tags completely
16486 # But since Parsoid doesn't it wraps the <s></s> tags in p-tags
16487 # which Tidy would have done for the PHP parser had there been content inside it.
16488 !! test
16489 Sanitizer: Closing of open tags
16490 !! wikitext
16491 <s></s><table></table>
16492 !! html
16493 <s></s><table></table>
16494
16495 !! html/parsoid
16496 <p><s></s></p><table></table>
16497 !! end
16498
16499 !! test
16500 Sanitizer: Closing of open but not closed tags
16501 !! wikitext
16502 <s>foo
16503 !! html
16504 <p><s>foo</s>
16505 </p>
16506 !! end
16507
16508 !! test
16509 Sanitizer: Closing of closed but not open tags
16510 !! options
16511 parsoid=wt2html
16512 !! wikitext
16513 </s>
16514 !! html/php+tidy
16515 !! html/parsoid
16516 !! end
16517
16518 !! test
16519 Sanitizer: Closing of closed but not open table tags
16520 !! options
16521 parsoid=wt2html
16522 !! wikitext
16523 Table not started</td></tr></table>
16524 !! html/php+tidy
16525 <p>Table not started</p>
16526 !! html/parsoid
16527 <p>Table not started</p>
16528 !! end
16529
16530 !! test
16531 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
16532 !! wikitext
16533 <span id="æ: v">byte</span>[[#æ: v|backlink]]
16534 !! html
16535 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
16536 </p>
16537 !! end
16538
16539 # In HTML5, the restrictions are that id must contain at least one character,
16540 # and must not contain any space characters.
16541 !! test
16542 Sanitizer: Validating the contents of the id attribute (bug 4515)
16543 !! options
16544 disabled
16545 !! wikitext
16546 <br id="" /><br id="a space" />
16547 !! html
16548 Something ...
16549 !! end
16550
16551 # In HTML5, id must be unique amongst all the ids in the element's home subtree.
16552 !! test
16553 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
16554 !! options
16555 disabled
16556 !! wikitext
16557 <br id="foo" /><br id="foo" />
16558 !! html
16559 Something need to be done. foo-2 ?
16560 !! end
16561
16562 !! test
16563 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
16564 !! wikitext
16565 <div itemscope>
16566 <meta itemprop="hello" content="world">
16567 <meta http-equiv="refresh" content="5">
16568 <meta itemprop="hello" http-equiv="refresh" content="5">
16569 <link itemprop="hello" href="{{SERVER}}">
16570 <link rel="stylesheet" href="{{SERVER}}">
16571 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
16572 </div>
16573 !! html
16574 <div itemscope="">
16575 <p> <meta itemprop="hello" content="world" />
16576 &lt;meta http-equiv="refresh" content="5"&gt;
16577 <meta itemprop="hello" content="5" />
16578 </p>
16579 <link itemprop="hello" href="http&#58;//example.org" />
16580 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
16581 <link itemprop="hello" href="http&#58;//example.org" />
16582 </div>
16583
16584 !! end
16585
16586 !! test
16587 Language converter: output gets cut off unexpectedly (bug 5757)
16588 !! options
16589 language=zh
16590 !! wikitext
16591 this bit is safe: }-
16592
16593 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
16594
16595 then we get cut off here: }-
16596
16597 all additional text is vanished
16598 !! html
16599 <p>this bit is safe: }-
16600 </p><p>but if we add a conversion instance: xxx
16601 </p><p>then we get cut off here: }-
16602 </p><p>all additional text is vanished
16603 </p>
16604 !! end
16605
16606 !! test
16607 Self closed html pairs (bug 5487)
16608 !! options
16609 !! wikitext
16610 <center><font id="bug" />Centered text</center>
16611 <div><font id="bug2" />In div text</div>
16612 !! html
16613 <center>&lt;font id="bug" /&gt;Centered text</center>
16614 <div>&lt;font id="bug2" /&gt;In div text</div>
16615
16616 !! end
16617
16618 #
16619 #
16620 #
16621
16622 !! test
16623 Punctuation: nbsp before exclamation
16624 !! wikitext
16625 C'est grave !
16626 !! html
16627 <p>C'est grave&#160;!
16628 </p>
16629 !! end
16630
16631 !! test
16632 Punctuation: CSS !important (bug 11874)
16633 !! wikitext
16634 <div style="width:50% !important">important</div>
16635 !! html
16636 <div style="width:50% !important">important</div>
16637
16638 !!end
16639
16640 !! test
16641 Punctuation: CSS ! important (bug 11874; with space after)
16642 !! wikitext
16643 <div style="width:50% ! important">important</div>
16644 !! html
16645 <div style="width:50% ! important">important</div>
16646
16647 !!end
16648
16649 !! test
16650 HTML bullet list, closed tags (bug 5497)
16651 !! wikitext
16652 <ul>
16653 <li>One</li>
16654 <li>Two</li>
16655 </ul>
16656 !! html/php
16657 <ul>
16658 <li>One</li>
16659 <li>Two</li>
16660 </ul>
16661
16662 !! html/parsoid
16663 <ul data-parsoid='{"stx":"html"}'>
16664 <li data-parsoid='{"stx":"html"}'>One</li>
16665 <li data-parsoid='{"stx":"html"}'>Two</li>
16666 </ul>
16667
16668 !! end
16669
16670 !! test
16671 HTML bullet list, unclosed tags (bug 5497)
16672 !! wikitext
16673 <ul>
16674 <li>One
16675 <li>Two
16676 </ul>
16677 !! html/php+tidy
16678 <ul>
16679 <li>One</li>
16680 <li>Two</li>
16681 </ul>
16682 !! html/parsoid
16683 <ul data-parsoid='{"stx":"html"}'>
16684 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16685 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16686 </ul>
16687
16688 !! end
16689
16690 !! test
16691 HTML ordered list, closed tags (bug 5497)
16692 !! wikitext
16693 <ol>
16694 <li>One</li>
16695 <li>Two</li>
16696 </ol>
16697 !! html/php
16698 <ol>
16699 <li>One</li>
16700 <li>Two</li>
16701 </ol>
16702
16703 !! html/parsoid
16704 <ol data-parsoid='{"stx":"html"}'>
16705 <li data-parsoid='{"stx":"html"}'>One</li>
16706 <li data-parsoid='{"stx":"html"}'>Two</li>
16707 </ol>
16708
16709 !! end
16710
16711 !! test
16712 HTML ordered list, unclosed tags (bug 5497)
16713 !! options
16714 !! wikitext
16715 <ol>
16716 <li>One
16717 <li>Two
16718 </ol>
16719 !! html/php+tidy
16720 <ol>
16721 <li>One</li>
16722 <li>Two</li>
16723 </ol>
16724 !! html/parsoid
16725 <ol data-parsoid='{"stx":"html"}'>
16726 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
16727 <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
16728 </ol>
16729
16730 !! end
16731
16732 !! test
16733 HTML nested bullet list, closed tags (bug 5497)
16734 !! wikitext
16735 <ul>
16736 <li>One</li>
16737 <li>Two:
16738 <ul>
16739 <li>Sub-one</li>
16740 <li>Sub-two</li>
16741 </ul>
16742 </li>
16743 </ul>
16744 !! html
16745 <ul>
16746 <li>One</li>
16747 <li>Two:
16748 <ul>
16749 <li>Sub-one</li>
16750 <li>Sub-two</li>
16751 </ul>
16752 </li>
16753 </ul>
16754
16755 !! end
16756
16757 !! test
16758 HTML nested bullet list, open tags (bug 5497)
16759 !! wikitext
16760 <ul>
16761 <li>One
16762 <li>Two:
16763 <ul>
16764 <li>Sub-one
16765 <li>Sub-two
16766 </ul>
16767 </ul>
16768 !! html/php+tidy
16769 <ul>
16770 <li>One</li>
16771 <li>Two:
16772 <ul>
16773 <li>Sub-one</li>
16774 <li>Sub-two</li>
16775 </ul>
16776 </li>
16777 </ul>
16778 !! html/parsoid
16779 <ul>
16780 <li>One
16781 </li>
16782 <li>Two:
16783 <ul>
16784 <li>Sub-one
16785 </li>
16786 <li>Sub-two
16787 </li>
16788 </ul>
16789 </li>
16790 </ul>
16791
16792 !! end
16793
16794 !! test
16795 HTML nested ordered list, closed tags (bug 5497)
16796 !! wikitext
16797 <ol>
16798 <li>One</li>
16799 <li>Two:
16800 <ol>
16801 <li>Sub-one</li>
16802 <li>Sub-two</li>
16803 </ol>
16804 </li>
16805 </ol>
16806 !! html
16807 <ol>
16808 <li>One</li>
16809 <li>Two:
16810 <ol>
16811 <li>Sub-one</li>
16812 <li>Sub-two</li>
16813 </ol>
16814 </li>
16815 </ol>
16816
16817 !! end
16818
16819 !! test
16820 HTML nested ordered list, open tags (bug 5497)
16821 !! wikitext
16822 <ol>
16823 <li>One
16824 <li>Two:
16825 <ol>
16826 <li>Sub-one
16827 <li>Sub-two
16828 </ol>
16829 </ol>
16830 !! html/php
16831 <ol>
16832 <li>One
16833 <li>Two:
16834 <ol>
16835 <li>Sub-one
16836 <li>Sub-two
16837 </ol>
16838 </ol>
16839
16840 !! html/parsoid
16841 <ol>
16842 <li>One
16843 </li>
16844 <li>Two:
16845 <ol>
16846 <li>Sub-one
16847 </li>
16848 <li>Sub-two
16849 </li>
16850 </ol>
16851 </li>
16852 </ol>
16853
16854 !! end
16855
16856 !! test
16857 HTML ordered list item with parameters oddity
16858 !! wikitext
16859 <ol><li id="fragment">One</li>
16860 </ol>
16861 !! html
16862 <ol><li id="fragment">One</li>
16863 </ol>
16864
16865 !! end
16866
16867 # parsoid doesn't explicitly mark autonumbered links, see bug 53505
16868 !!test
16869 bug 5918: autonumbering
16870 !! wikitext
16871 [http://first/] [http://second] [ftp://ftp]
16872
16873 ftp://inlineftp
16874
16875 [mailto:enclosed@mail.tld With target]
16876
16877 [mailto:enclosed@mail.tld]
16878
16879 mailto:inline@mail.tld
16880 !! html/php
16881 <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>
16882 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
16883 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
16884 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
16885 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
16886 </p>
16887 !! html/parsoid
16888 <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>
16889 <p><a rel="mw:ExtLink" href="ftp://inlineftp">ftp://inlineftp</a></p>
16890 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld">With target</a></p>
16891 <p><a rel="mw:ExtLink" href="mailto:enclosed@mail.tld"></a></p>
16892 <p><a rel="mw:ExtLink" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
16893 !! end
16894
16895
16896 #
16897 # Security and HTML correctness
16898 # From Nick Jenkins' fuzz testing
16899 #
16900
16901 !! test
16902 Fuzz testing: Parser13
16903 !! wikitext
16904 {|
16905 | http://a|
16906 !! html
16907 <table>
16908 <tr>
16909 <td>
16910 </td>
16911 </tr>
16912 </table>
16913
16914 !! end
16915
16916 !! test
16917 Fuzz testing: Parser14
16918 !! wikitext
16919 == onmouseover= ==
16920 http://__TOC__
16921 !! html
16922 <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>
16923 http://<div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
16924 <ul>
16925 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16926 </ul>
16927 </div>
16928
16929
16930 !! html+tidy
16931 <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>
16932 <p>http://</p>
16933 <div id="toc" class="toc">
16934 <div id="toctitle">
16935 <h2>Contents</h2>
16936 </div>
16937 <ul>
16938 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
16939 </ul>
16940 </div>
16941 <p></p>
16942 !! end
16943
16944 !! test
16945 Fuzz testing: Parser14-table
16946 !! wikitext
16947 ==a==
16948 {| STYLE=__TOC__
16949 !! html
16950 <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>
16951 <table style="&#95;_TOC&#95;_">
16952 <tr><td></td></tr>
16953 </table>
16954
16955 !! html+tidy
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="__TOC__">
16958 <tr>
16959 <td></td>
16960 </tr>
16961 </table>
16962 !! end
16963
16964 # Known to produce bogus xml (extra </td>)
16965 !! test
16966 Fuzz testing: Parser16
16967 !! options
16968 noxml
16969 !! wikitext
16970 {|
16971 !https://||||||
16972 !! html
16973 <table>
16974 <tr>
16975 <th>https://</th>
16976 <th></th>
16977 <th></th>
16978 <th>
16979 </td>
16980 </tr>
16981 </table>
16982
16983 !! html+tidy
16984 <table>
16985 <tr>
16986 <th>https://</th>
16987 <th></th>
16988 <th></th>
16989 <th></th>
16990 </tr>
16991 </table>
16992 !! end
16993
16994 !! test
16995 Fuzz testing: Parser21
16996 !! wikitext
16997 {|
16998 ! irc://{{ftp://a" onmouseover="alert('hello world');"
16999 |
17000 !! html
17001 <table>
17002 <tr>
17003 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
17004 </th>
17005 <td>
17006 </td>
17007 </tr>
17008 </table>
17009
17010 !! end
17011
17012 !! test
17013 Fuzz testing: Parser22
17014 !! wikitext
17015 http://===r:::https://b
17016
17017 {|
17018 !! html
17019 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
17020 </p>
17021 <table>
17022 <tr><td></td></tr>
17023 </table>
17024
17025 !! end
17026
17027 # Known to produce bad XML for now
17028 !! test
17029 Fuzz testing: Parser24
17030 !! options
17031 noxml
17032 !! wikitext
17033 {|
17034 {{{|
17035 <u CLASS=
17036 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
17037 <br style="onmouseover='alert(document.cookie);' " />
17038
17039 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17040 |
17041 !! html
17042 <table>
17043 {{{|
17044 <u class="&#124;">}}}} &gt;
17045 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
17046
17047 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
17048 <tr>
17049 <td></u>
17050 </td>
17051 </tr>
17052 </table>
17053
17054 !! end
17055
17056 # Note: the current result listed for this is not what the original one was,
17057 # but the original bug was JavaScript injection, which is fixed in any case.
17058 # It's not clear that the original result listed was any more correct than the
17059 # current one. Original result:
17060 # <p>{{{|
17061 # </p>
17062 # <li class="&#124;&#124;">
17063 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17064 !!test
17065 Fuzz testing: Parser25 (bug 6055)
17066 !! wikitext
17067 {{{
17068 |
17069 <LI CLASS=||
17070 >
17071 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
17072 !! html
17073 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
17074 </p>
17075 !! end
17076
17077 !!test
17078 Fuzz testing: URL adjacent extension (with space, clean)
17079 !! wikitext
17080 http://example.com <nowiki>junk</nowiki>
17081 !! html/php
17082 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
17083 </p>
17084 !! html/parsoid
17085 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
17086 !! end
17087
17088 !!test
17089 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
17090 !! wikitext
17091 http://example.com<nowiki>junk</nowiki>
17092 !! html/php
17093 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
17094 </p>
17095 !! html/parsoid
17096 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
17097 !! end
17098
17099 !!test
17100 Fuzz testing: URL adjacent extension (no space, dirty; pre)
17101 !! wikitext
17102 http://example.com<pre>junk</pre>
17103 !! html/php
17104 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
17105
17106 !! html/php+tidy
17107 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p>
17108 <pre>
17109 junk
17110 </pre>
17111 !! html/parsoid
17112 <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>
17113 !!end
17114
17115 !!test
17116 Fuzz testing: image with bogus manual thumbnail
17117 !! wikitext
17118 [[Image:foobar.jpg|thumbnail= ]]
17119 !! html/php
17120 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
17121
17122 !! html/parsoid
17123 <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>
17124 !!end
17125
17126 !! test
17127 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
17128 !! wikitext
17129 <pre dir="&#10;"></pre>
17130 !! html
17131 <pre dir="&#10;"></pre>
17132
17133 !! end
17134
17135 !! test
17136 Parsing optional HTML elements (Bug 6171)
17137 !! options
17138 !! wikitext
17139 <table>
17140 <tr>
17141 <td> Some tabular data</td>
17142 <td> More tabular data ...
17143 <td> And yet som tabular data</td>
17144 </tr>
17145 </table>
17146 !! html
17147 <table>
17148 <tr>
17149 <td> Some tabular data</td>
17150 <td> More tabular data ...
17151 </td><td> And yet som tabular data</td>
17152 </tr>
17153 </table>
17154
17155 !! end
17156
17157 !! test
17158 Correct handling of <td>, <tr> (Bug 6171)
17159 !! options
17160 !! wikitext
17161 <table>
17162 <tr>
17163 <td> Some tabular data</td>
17164 <td> More tabular data ...</td>
17165 <td> And yet som tabular data</td>
17166 </tr>
17167 </table>
17168 !! html
17169 <table>
17170 <tr>
17171 <td> Some tabular data</td>
17172 <td> More tabular data ...</td>
17173 <td> And yet som tabular data</td>
17174 </tr>
17175 </table>
17176
17177 !! end
17178
17179
17180 !! test
17181 Parsing crashing regression (fr:JavaScript)
17182 !! wikitext
17183 </body></x>
17184 !! html
17185 <p>&lt;/body&gt;&lt;/x&gt;
17186 </p>
17187 !! end
17188
17189 !! test
17190 Inline wiki vs wiki block nesting
17191 !! wikitext
17192 '''Bold paragraph
17193
17194 New wiki paragraph
17195 !! html
17196 <p><b>Bold paragraph</b>
17197 </p><p>New wiki paragraph
17198 </p>
17199 !! end
17200
17201 # FIXME: The current php output is documented
17202 # and desired output is the parsoid target.
17203 !! test
17204 Inline HTML vs wiki block nesting
17205 !! wikitext
17206 <b>Bold paragraph
17207
17208 New wiki paragraph
17209 !! html/php
17210 <p><b>Bold paragraph
17211 </p><p>New wiki paragraph</b>
17212 </p>
17213 !! html/parsoid
17214 <p><b>Bold paragraph</b>
17215 </p><p>New wiki paragraph
17216 </p>
17217 !! end
17218
17219 # Original result was this:
17220 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
17221 # </p>
17222 # While that might be marginally more intuitive, maybe, the six-apostrophe
17223 # construct is clearly pathological and the result stated here (which is what
17224 # the parser actually does) is about as reasonable as anything.
17225 !!test
17226 Mixing markup for italics and bold
17227 !! options
17228 !! wikitext
17229 '''bold''''''bold''bolditalics'''''
17230 !! html
17231 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
17232 </p>
17233 !! end
17234
17235
17236 !! article
17237 Xyzzyx
17238 !! text
17239 Article for special page transclusion test
17240 !! endarticle
17241
17242 !! test
17243 Special page transclusion
17244 !! options
17245 !! wikitext
17246 {{Special:Prefixindex/Xyzzyx}}
17247 !! html
17248 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17249 </ul>
17250
17251 !! end
17252
17253 !! test
17254 Special page transclusion twice (bug 5021)
17255 !! options
17256 !! wikitext
17257 {{Special:Prefixindex/Xyzzyx}}
17258 {{Special:Prefixindex/Xyzzyx}}
17259 !! html
17260 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17261 </ul>
17262 <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
17263 </ul>
17264
17265 !! end
17266
17267 !! test
17268 Transclusion of default MediaWiki message
17269 !! wikitext
17270 {{MediaWiki:Mainpage}}
17271 !! html
17272 <p>Main Page
17273 </p>
17274 !! end
17275
17276 !! test
17277 Transclusion of nonexistent MediaWiki message
17278 !! wikitext
17279 {{MediaWiki:Mainpagexxx}}
17280 !! html
17281 <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>
17282 </p>
17283 !! end
17284
17285 !! test
17286 Transclusion of MediaWiki message with underscore
17287 !! wikitext
17288 {{MediaWiki:history_short}}
17289 !! html
17290 <p>History
17291 </p>
17292 !! end
17293
17294 !! test
17295 Transclusion of MediaWiki message with space
17296 !! wikitext
17297 {{MediaWiki:history short}}
17298 !! html
17299 <p>History
17300 </p>
17301 !! end
17302
17303 !! test
17304 Invalid header with following text
17305 !! wikitext
17306 = x = y
17307 !! html
17308 <p>= x = y
17309 </p>
17310 !! end
17311
17312
17313 !! test
17314 Section extraction test (section 0)
17315 !! options
17316 section=0
17317 !! wikitext
17318 start
17319 ==a==
17320 ===aa===
17321 ====aaa====
17322 ==b==
17323 ===ba===
17324 ===bb===
17325 ====bba====
17326 ===bc===
17327 ==c==
17328 ===ca===
17329 !! html/php
17330 start
17331 !! end
17332
17333 !! test
17334 Section extraction test (section 1)
17335 !! options
17336 section=1
17337 !! wikitext
17338 start
17339 ==a==
17340 ===aa===
17341 ====aaa====
17342 ==b==
17343 ===ba===
17344 ===bb===
17345 ====bba====
17346 ===bc===
17347 ==c==
17348 ===ca===
17349 !! html/php
17350 ==a==
17351 ===aa===
17352 ====aaa====
17353 !! end
17354
17355 !! test
17356 Section extraction test (section 2)
17357 !! options
17358 section=2
17359 !! wikitext
17360 start
17361 ==a==
17362 ===aa===
17363 ====aaa====
17364 ==b==
17365 ===ba===
17366 ===bb===
17367 ====bba====
17368 ===bc===
17369 ==c==
17370 ===ca===
17371 !! html/php
17372 ===aa===
17373 ====aaa====
17374 !! end
17375
17376 !! test
17377 Section extraction test (section 3)
17378 !! options
17379 section=3
17380 !! wikitext
17381 start
17382 ==a==
17383 ===aa===
17384 ====aaa====
17385 ==b==
17386 ===ba===
17387 ===bb===
17388 ====bba====
17389 ===bc===
17390 ==c==
17391 ===ca===
17392 !! html/php
17393 ====aaa====
17394 !! end
17395
17396 !! test
17397 Section extraction test (section 4)
17398 !! options
17399 section=4
17400 !! wikitext
17401 start
17402 ==a==
17403 ===aa===
17404 ====aaa====
17405 ==b==
17406 ===ba===
17407 ===bb===
17408 ====bba====
17409 ===bc===
17410 ==c==
17411 ===ca===
17412 !! html/php
17413 ==b==
17414 ===ba===
17415 ===bb===
17416 ====bba====
17417 ===bc===
17418 !! end
17419
17420 !! test
17421 Section extraction test (section 5)
17422 !! options
17423 section=5
17424 !! wikitext
17425 start
17426 ==a==
17427 ===aa===
17428 ====aaa====
17429 ==b==
17430 ===ba===
17431 ===bb===
17432 ====bba====
17433 ===bc===
17434 ==c==
17435 ===ca===
17436 !! html/php
17437 ===ba===
17438 !! end
17439
17440 !! test
17441 Section extraction test (section 6)
17442 !! options
17443 section=6
17444 !! wikitext
17445 start
17446 ==a==
17447 ===aa===
17448 ====aaa====
17449 ==b==
17450 ===ba===
17451 ===bb===
17452 ====bba====
17453 ===bc===
17454 ==c==
17455 ===ca===
17456 !! html/php
17457 ===bb===
17458 ====bba====
17459 !! end
17460
17461 !! test
17462 Section extraction test (section 7)
17463 !! options
17464 section=7
17465 !! wikitext
17466 start
17467 ==a==
17468 ===aa===
17469 ====aaa====
17470 ==b==
17471 ===ba===
17472 ===bb===
17473 ====bba====
17474 ===bc===
17475 ==c==
17476 ===ca===
17477 !! html/php
17478 ====bba====
17479 !! end
17480
17481 !! test
17482 Section extraction test (section 8)
17483 !! options
17484 section=8
17485 !! wikitext
17486 start
17487 ==a==
17488 ===aa===
17489 ====aaa====
17490 ==b==
17491 ===ba===
17492 ===bb===
17493 ====bba====
17494 ===bc===
17495 ==c==
17496 ===ca===
17497 !! html/php
17498 ===bc===
17499 !! end
17500
17501 !! test
17502 Section extraction test (section 9)
17503 !! options
17504 section=9
17505 !! wikitext
17506 start
17507 ==a==
17508 ===aa===
17509 ====aaa====
17510 ==b==
17511 ===ba===
17512 ===bb===
17513 ====bba====
17514 ===bc===
17515 ==c==
17516 ===ca===
17517 !! html/php
17518 ==c==
17519 ===ca===
17520 !! end
17521
17522 !! test
17523 Section extraction test (section 10)
17524 !! options
17525 section=10
17526 !! wikitext
17527 start
17528 ==a==
17529 ===aa===
17530 ====aaa====
17531 ==b==
17532 ===ba===
17533 ===bb===
17534 ====bba====
17535 ===bc===
17536 ==c==
17537 ===ca===
17538 !! html/php
17539 ===ca===
17540 !! end
17541
17542 !! test
17543 Section extraction test (nonexistent section 11)
17544 !! options
17545 section=11
17546 !! wikitext
17547 start
17548 ==a==
17549 ===aa===
17550 ====aaa====
17551 ==b==
17552 ===ba===
17553 ===bb===
17554 ====bba====
17555 ===bc===
17556 ==c==
17557 ===ca===
17558 !! html/php
17559 !! end
17560
17561 !! test
17562 Section extraction test with bogus heading (section 1)
17563 !! options
17564 section=1
17565 !! wikitext
17566 ==a==
17567 ==bogus== not a legal section
17568 ==b==
17569 !! html/php
17570 ==a==
17571 ==bogus== not a legal section
17572 !! end
17573
17574 !! test
17575 Section extraction test with bogus heading (section 2)
17576 !! options
17577 section=2
17578 !! wikitext
17579 ==a==
17580 ==bogus== not a legal section
17581 ==b==
17582 !! html/php
17583 ==b==
17584 !! end
17585
17586 !! test
17587 Section extraction test with comment after heading (section 1)
17588 !! options
17589 section=1
17590 !! wikitext
17591 ==a==
17592 ==b== <!-- -->
17593 ==c==
17594 !! html/php
17595 ==a==
17596 !! end
17597
17598 !! test
17599 Section extraction test with comment after heading (section 2)
17600 !! options
17601 section=2
17602 !! wikitext
17603 ==a==
17604 ==b== <!-- -->
17605 ==c==
17606 !! html/php
17607 ==b== <!-- -->
17608 !! end
17609
17610 !! test
17611 Section extraction test with bogus <nowiki> heading (section 1)
17612 !! options
17613 section=1
17614 !! wikitext
17615 ==a==
17616 ==bogus== <nowiki>not a legal section</nowiki>
17617 ==b==
17618 !! html/php
17619 ==a==
17620 ==bogus== <nowiki>not a legal section</nowiki>
17621 !! end
17622
17623 !! test
17624 Section extraction test with bogus <nowiki> heading (section 2)
17625 !! options
17626 section=2
17627 !! wikitext
17628 ==a==
17629 ==bogus== <nowiki>not a legal section</nowiki>
17630 ==b==
17631 !! html/php
17632 ==b==
17633 !! end
17634
17635 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
17636 # instead of respecting commented sections
17637 !! test
17638 Section extraction prefixed by comment (section 1)
17639 !! options
17640 section=1
17641 !! wikitext
17642 <!-- -->==sec1==
17643 ==sec2==
17644 !! html/php
17645 ==sec2==
17646 !!end
17647
17648 !! test
17649 Section extraction prefixed by comment (section 2)
17650 !! options
17651 section=2
17652 !! wikitext
17653 <!-- -->==sec1==
17654 ==sec2==
17655 !! html/php
17656
17657 !!end
17658
17659 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
17660 # instead of respecting HTML-style headings
17661 !! test
17662 Section extraction, mixed wiki and html (section 1)
17663 !! options
17664 section=1
17665 !! wikitext
17666 <h2>unmarked</h2>
17667 unmarked
17668 ==1==
17669 one
17670 ==2==
17671 two
17672 !! html/php
17673 ==1==
17674 one
17675 !! end
17676
17677 !! test
17678 Section extraction, mixed wiki and html (section 2)
17679 !! options
17680 section=2
17681 !! wikitext
17682 <h2>unmarked</h2>
17683 unmarked
17684 ==1==
17685 one
17686 ==2==
17687 two
17688 !! html/php
17689 ==2==
17690 two
17691 !! end
17692
17693
17694 # Formerly testing for bug 3342
17695 !! test
17696 Section extraction, heading surrounded by <noinclude>
17697 !! options
17698 section=1
17699 !! wikitext
17700 <noinclude>==unmarked==</noinclude>
17701 ==marked==
17702 !! html/php
17703 ==marked==
17704 !!end
17705
17706 # Test behavior of bug 19910
17707 !! test
17708 Sectiion with all-equals
17709 !! options
17710 section=2
17711 !! wikitext
17712 ===
17713 The line above must have a trailing space
17714 === <!--
17715 --> <!-- -->
17716 But just in case it doesn't...
17717 !! html/php
17718 === <!--
17719 --> <!-- -->
17720 But just in case it doesn't...
17721 !! end
17722
17723 !! test
17724 Section replacement test (section 0)
17725 !! options
17726 replace=0,"xxx"
17727 !! wikitext
17728 start
17729 ==a==
17730 ===aa===
17731 ====aaa====
17732 ==b==
17733 ===ba===
17734 ===bb===
17735 ====bba====
17736 ===bc===
17737 ==c==
17738 ===ca===
17739 !! html/php
17740 xxx
17741
17742 ==a==
17743 ===aa===
17744 ====aaa====
17745 ==b==
17746 ===ba===
17747 ===bb===
17748 ====bba====
17749 ===bc===
17750 ==c==
17751 ===ca===
17752 !! end
17753
17754 !! test
17755 Section replacement test (section 1)
17756 !! options
17757 replace=1,"xxx"
17758 !! wikitext
17759 start
17760 ==a==
17761 ===aa===
17762 ====aaa====
17763 ==b==
17764 ===ba===
17765 ===bb===
17766 ====bba====
17767 ===bc===
17768 ==c==
17769 ===ca===
17770 !! html/php
17771 start
17772 xxx
17773
17774 ==b==
17775 ===ba===
17776 ===bb===
17777 ====bba====
17778 ===bc===
17779 ==c==
17780 ===ca===
17781 !! end
17782
17783 !! test
17784 Section replacement test (section 2)
17785 !! options
17786 replace=2,"xxx"
17787 !! wikitext
17788 start
17789 ==a==
17790 ===aa===
17791 ====aaa====
17792 ==b==
17793 ===ba===
17794 ===bb===
17795 ====bba====
17796 ===bc===
17797 ==c==
17798 ===ca===
17799 !! html/php
17800 start
17801 ==a==
17802 xxx
17803
17804 ==b==
17805 ===ba===
17806 ===bb===
17807 ====bba====
17808 ===bc===
17809 ==c==
17810 ===ca===
17811 !! end
17812
17813 !! test
17814 Section replacement test (section 3)
17815 !! options
17816 replace=3,"xxx"
17817 !! wikitext
17818 start
17819 ==a==
17820 ===aa===
17821 ====aaa====
17822 ==b==
17823 ===ba===
17824 ===bb===
17825 ====bba====
17826 ===bc===
17827 ==c==
17828 ===ca===
17829 !! html/php
17830 start
17831 ==a==
17832 ===aa===
17833 xxx
17834
17835 ==b==
17836 ===ba===
17837 ===bb===
17838 ====bba====
17839 ===bc===
17840 ==c==
17841 ===ca===
17842 !! end
17843
17844 !! test
17845 Section replacement test (section 4)
17846 !! options
17847 replace=4,"xxx"
17848 !! wikitext
17849 start
17850 ==a==
17851 ===aa===
17852 ====aaa====
17853 ==b==
17854 ===ba===
17855 ===bb===
17856 ====bba====
17857 ===bc===
17858 ==c==
17859 ===ca===
17860 !! html/php
17861 start
17862 ==a==
17863 ===aa===
17864 ====aaa====
17865 xxx
17866
17867 ==c==
17868 ===ca===
17869 !! end
17870
17871 !! test
17872 Section replacement test (section 5)
17873 !! options
17874 replace=5,"xxx"
17875 !! wikitext
17876 start
17877 ==a==
17878 ===aa===
17879 ====aaa====
17880 ==b==
17881 ===ba===
17882 ===bb===
17883 ====bba====
17884 ===bc===
17885 ==c==
17886 ===ca===
17887 !! html/php
17888 start
17889 ==a==
17890 ===aa===
17891 ====aaa====
17892 ==b==
17893 xxx
17894
17895 ===bb===
17896 ====bba====
17897 ===bc===
17898 ==c==
17899 ===ca===
17900 !! end
17901
17902 !! test
17903 Section replacement test (section 6)
17904 !! options
17905 replace=6,"xxx"
17906 !! wikitext
17907 start
17908 ==a==
17909 ===aa===
17910 ====aaa====
17911 ==b==
17912 ===ba===
17913 ===bb===
17914 ====bba====
17915 ===bc===
17916 ==c==
17917 ===ca===
17918 !! html/php
17919 start
17920 ==a==
17921 ===aa===
17922 ====aaa====
17923 ==b==
17924 ===ba===
17925 xxx
17926
17927 ===bc===
17928 ==c==
17929 ===ca===
17930 !! end
17931
17932 !! test
17933 Section replacement test (section 7)
17934 !! options
17935 replace=7,"xxx"
17936 !! wikitext
17937 start
17938 ==a==
17939 ===aa===
17940 ====aaa====
17941 ==b==
17942 ===ba===
17943 ===bb===
17944 ====bba====
17945 ===bc===
17946 ==c==
17947 ===ca===
17948 !! html/php
17949 start
17950 ==a==
17951 ===aa===
17952 ====aaa====
17953 ==b==
17954 ===ba===
17955 ===bb===
17956 xxx
17957
17958 ===bc===
17959 ==c==
17960 ===ca===
17961 !! end
17962
17963 !! test
17964 Section replacement test (section 8)
17965 !! options
17966 replace=8,"xxx"
17967 !! wikitext
17968 start
17969 ==a==
17970 ===aa===
17971 ====aaa====
17972 ==b==
17973 ===ba===
17974 ===bb===
17975 ====bba====
17976 ===bc===
17977 ==c==
17978 ===ca===
17979 !! html/php
17980 start
17981 ==a==
17982 ===aa===
17983 ====aaa====
17984 ==b==
17985 ===ba===
17986 ===bb===
17987 ====bba====
17988 xxx
17989
17990 ==c==
17991 ===ca===
17992 !!end
17993
17994 !! test
17995 Section replacement test (section 9)
17996 !! options
17997 replace=9,"xxx"
17998 !! wikitext
17999 start
18000 ==a==
18001 ===aa===
18002 ====aaa====
18003 ==b==
18004 ===ba===
18005 ===bb===
18006 ====bba====
18007 ===bc===
18008 ==c==
18009 ===ca===
18010 !! html/php
18011 start
18012 ==a==
18013 ===aa===
18014 ====aaa====
18015 ==b==
18016 ===ba===
18017 ===bb===
18018 ====bba====
18019 ===bc===
18020 xxx
18021 !! end
18022
18023 !! test
18024 Section replacement test (section 10)
18025 !! options
18026 replace=10,"xxx"
18027 !! wikitext
18028 start
18029 ==a==
18030 ===aa===
18031 ====aaa====
18032 ==b==
18033 ===ba===
18034 ===bb===
18035 ====bba====
18036 ===bc===
18037 ==c==
18038 ===ca===
18039 !! html/php
18040 start
18041 ==a==
18042 ===aa===
18043 ====aaa====
18044 ==b==
18045 ===ba===
18046 ===bb===
18047 ====bba====
18048 ===bc===
18049 ==c==
18050 xxx
18051 !! end
18052
18053 !! test
18054 Section replacement test with initial whitespace (bug 13728)
18055 !! options
18056 replace=2,"xxx"
18057 !! wikitext
18058 Preformatted initial line
18059 ==a==
18060 ===a===
18061 !! html/php
18062 Preformatted initial line
18063 ==a==
18064 xxx
18065 !! end
18066
18067
18068 !! test
18069 Section extraction, heading followed by pre with 20 spaces (bug 6398)
18070 !! options
18071 section=1
18072 !! wikitext
18073 ==a==
18074 a
18075 !! html/php
18076 ==a==
18077 a
18078 !! end
18079
18080 !! test
18081 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
18082 !! options
18083 section=1
18084 !! wikitext
18085 ==a==
18086 a
18087 !! html/php
18088 ==a==
18089 a
18090 !! end
18091
18092
18093 !! test
18094 Section extraction, <pre> around bogus header (bug 10309)
18095 !! options
18096 noxml section=2
18097 !! wikitext
18098 == Section One ==
18099 <pre>
18100 =======
18101 </pre>
18102
18103 == Section Two ==
18104 stuff
18105 !! html/php
18106 == Section Two ==
18107 stuff
18108 !! end
18109
18110 !! test
18111 Section replacement, <pre> around bogus header (bug 10309)
18112 !! options
18113 noxml replace=2,"xxx"
18114 !! wikitext
18115 == Section One ==
18116 <pre>
18117 =======
18118 </pre>
18119
18120 == Section Two ==
18121 stuff
18122 !! html/php
18123 == Section One ==
18124 <pre>
18125 =======
18126 </pre>
18127
18128 xxx
18129 !! end
18130
18131
18132 !! test
18133 Handling of &#x0A; in URLs
18134 !! wikitext
18135 ** irc://&#x0A;a
18136 !! html/php
18137 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18138
18139 !! html/parsoid
18140 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://
18141 a">irc://
18142 a</a></li></ul></li></ul>
18143 !! end
18144
18145 !! test
18146 Handling of %0A in URLs
18147 !! wikitext
18148 ** irc://%0Aa
18149 !! html/php
18150 <ul><li><ul><li> <a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18151
18152 !! html/parsoid
18153 <ul><li><ul><li> <a rel="mw:ExtLink" href="irc://%0Aa">irc://%0Aa</a></li></ul></li></ul>
18154 !! end
18155
18156
18157 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
18158 !! test
18159 5 quotes, code coverage +1 line
18160 !! options
18161 parsoid=wt2html
18162 !! wikitext
18163 '''''
18164 !! html/php
18165 !! html/parsoid
18166 <p><b><i></i></b></p>
18167 !! end
18168
18169 # same html as previous, but wikitext adjusted to match parsoid html2wt
18170 # note that wt2html and html2html will put the <i> before the <b>
18171 !! test
18172 5 quotes, code coverage +1 line w/ nowiki (1)
18173 !! options
18174 parsoid=wt2wt,html2wt
18175 !! wikitext
18176 '''''<nowiki/>'''''
18177 !! html/php
18178 <p><i></i>
18179 </p>
18180 !! html/parsoid
18181 <p><b><i></i></b></p>
18182 !! end
18183
18184 # same as previous, just swapping the <i> and <b>
18185 !! test
18186 5 quotes, code coverage +1 line w/ nowiki (2)
18187 !! wikitext
18188 '''''<nowiki/>'''''
18189 !! html/php
18190 <p><i></i>
18191 </p>
18192 !! html/parsoid
18193 <p><i><b></b></i></p>
18194 !! end
18195
18196 !! test
18197 Special:Search page linking.
18198 !! wikitext
18199 {{Special:search}}
18200 !! html
18201 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
18202 </p>
18203 !! end
18204
18205 !! test
18206 {{!}} is a magic word
18207 !! wikitext
18208 {{!}} is a magic word there and {{!}} is still a magic word here
18209 | is not a magic word here but {{!}} is still a magic word here
18210 !! html/php
18211 <p>| is a magic word there and | is still a magic word here
18212 | is not a magic word here but | is still a magic word here
18213 </p>
18214 !! html/parsoid
18215 <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
18216 | 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>
18217
18218 !! end
18219
18220 !! test
18221 Say the magic word
18222 !! options
18223 title=[[Parser test]]
18224 !! wikitext
18225 * {{PAGENAME}}
18226 * {{PAGENAMEE}}
18227 * {{FULLPAGENAME}}
18228 * {{FULLPAGENAMEE}}
18229 * {{BASEPAGENAME}}
18230 * {{BASEPAGENAMEE}}
18231 * {{SUBPAGENAME}}
18232 * {{SUBPAGENAMEE}}
18233 * {{ROOTPAGENAME}}
18234 * {{ROOTPAGENAMEE}}
18235 * {{TALKPAGENAME}}
18236 * {{TALKPAGENAMEE}}
18237 * {{SUBJECTPAGENAME}}
18238 * {{SUBJECTPAGENAMEE}}
18239 * {{NAMESPACEE}}
18240 * {{NAMESPACE}}
18241 * {{NAMESPACENUMBER}}
18242 * {{TALKSPACE}}
18243 * {{TALKSPACEE}}
18244 * {{SUBJECTSPACE}}
18245 * {{SUBJECTSPACEE}}
18246 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
18247 !! html
18248 <ul><li> Parser test</li>
18249 <li> Parser_test</li>
18250 <li> Parser test</li>
18251 <li> Parser_test</li>
18252 <li> Parser test</li>
18253 <li> Parser_test</li>
18254 <li> Parser test</li>
18255 <li> Parser_test</li>
18256 <li> Parser test</li>
18257 <li> Parser_test</li>
18258 <li> Talk:Parser test</li>
18259 <li> Talk:Parser_test</li>
18260 <li> Parser test</li>
18261 <li> Parser_test</li>
18262 <li> </li>
18263 <li> </li>
18264 <li> 0</li>
18265 <li> Talk</li>
18266 <li> Talk</li>
18267 <li> </li>
18268 <li> </li>
18269 <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>
18270
18271 !! end
18272 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
18273
18274 !! test
18275 Gallery
18276 !! wikitext
18277 <gallery>
18278 image1.png |
18279 image2.gif|||||
18280
18281 image3|
18282 image4 |300px| centre
18283 image5.svg| http://///////
18284 [[x|xx]]]]
18285 * image6
18286 </gallery>
18287 !! html
18288 <ul class="gallery mw-gallery-traditional">
18289 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18290 <div class="thumb" style="height: 150px;">Image1.png</div>
18291 <div class="gallerytext">
18292 </div>
18293 </div></li>
18294 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18295 <div class="thumb" style="height: 150px;">Image2.gif</div>
18296 <div class="gallerytext">
18297 <p>||||
18298 </p>
18299 </div>
18300 </div></li>
18301 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18302 <div class="thumb" style="height: 150px;">Image3</div>
18303 <div class="gallerytext">
18304 </div>
18305 </div></li>
18306 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18307 <div class="thumb" style="height: 150px;">Image4</div>
18308 <div class="gallerytext">
18309 <p>300px| centre
18310 </p>
18311 </div>
18312 </div></li>
18313 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18314 <div class="thumb" style="height: 150px;">Image5.svg</div>
18315 <div class="gallerytext">
18316 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
18317 </p>
18318 </div>
18319 </div></li>
18320 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18321 <div class="thumb" style="height: 150px;">* image6</div>
18322 <div class="gallerytext">
18323 </div>
18324 </div></li>
18325 </ul>
18326
18327 !! end
18328
18329 !! test
18330 Gallery (with options)
18331 !! wikitext
18332 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
18333 File:Nonexistent.jpg|caption
18334 File:Nonexistent.jpg
18335 image:foobar.jpg|some '''caption''' [[Main Page]]
18336 image:foobar.jpg
18337 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
18338 </gallery>
18339 !! html
18340 <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
18341 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
18342 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18343 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18344 <div class="gallerytext">
18345 <p>caption
18346 </p>
18347 </div>
18348 </div></li>
18349 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18350 <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
18351 <div class="gallerytext">
18352 </div>
18353 </div></li>
18354 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18355 <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>
18356 <div class="gallerytext">
18357 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18358 </p>
18359 </div>
18360 </div></li>
18361 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18362 <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>
18363 <div class="gallerytext">
18364 </div>
18365 </div></li>
18366 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
18367 <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>
18368 <div class="gallerytext">
18369 <p>Blabla|blabla.
18370 </p>
18371 </div>
18372 </div></li>
18373 </ul>
18374
18375 !! end
18376
18377 !! test
18378 Gallery with link that has fragment
18379 !! wikitext
18380 <gallery>
18381 image:foobar.jpg|link=Main_Page
18382 image:foobar.jpg|link=Main_Page#section
18383 image:foobar.jpg|link=Main Page#section|caption
18384 </gallery>
18385 !! html
18386 <ul class="gallery mw-gallery-traditional">
18387 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18388 <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>
18389 <div class="gallerytext">
18390 </div>
18391 </div></li>
18392 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18393 <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>
18394 <div class="gallerytext">
18395 </div>
18396 </div></li>
18397 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18398 <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>
18399 <div class="gallerytext">
18400 <p>caption
18401 </p>
18402 </div>
18403 </div></li>
18404 </ul>
18405
18406 !! end
18407
18408 !! test
18409 Gallery with wikitext inside caption
18410 !! wikitext
18411 <gallery>
18412 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
18413 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
18414 </gallery>
18415 !! html
18416 <ul class="gallery mw-gallery-traditional">
18417 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18418 <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>
18419 <div class="gallerytext">
18420 <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>
18421 </p>
18422 </div>
18423 </div></li>
18424 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18425 <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>
18426 <div class="gallerytext">
18427 <p>This is a test template
18428 </p>
18429 </div>
18430 </div></li>
18431 </ul>
18432
18433 !! end
18434
18435 !! test
18436 gallery (with showfilename option)
18437 !! wikitext
18438 <gallery showfilename>
18439 File:Nonexistent.jpg|caption
18440 File:Nonexistent.jpg
18441 image:foobar.jpg|some '''caption''' [[Main Page]]
18442 File:Foobar.jpg
18443 </gallery>
18444 !! html
18445 <ul class="gallery mw-gallery-traditional">
18446 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18447 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18448 <div class="gallerytext">
18449 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18450 caption
18451 </p>
18452 </div>
18453 </div></li>
18454 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18455 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18456 <div class="gallerytext">
18457 <p><a href="/wiki/File:Nonexistent.jpg" title="File:Nonexistent.jpg">Nonexistent.jpg</a><br />
18458 </p>
18459 </div>
18460 </div></li>
18461 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18462 <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>
18463 <div class="gallerytext">
18464 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18465 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
18466 </p>
18467 </div>
18468 </div></li>
18469 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18470 <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>
18471 <div class="gallerytext">
18472 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
18473 </p>
18474 </div>
18475 </div></li>
18476 </ul>
18477
18478 !! end
18479
18480 !! test
18481 Gallery (with namespace-less filenames)
18482 !! wikitext
18483 <gallery>
18484 File:Nonexistent.jpg
18485 Nonexistent.jpg
18486 image:foobar.jpg
18487 foobar.jpg
18488 </gallery>
18489 !! html
18490 <ul class="gallery mw-gallery-traditional">
18491 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18492 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18493 <div class="gallerytext">
18494 </div>
18495 </div></li>
18496 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18497 <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
18498 <div class="gallerytext">
18499 </div>
18500 </div></li>
18501 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18502 <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>
18503 <div class="gallerytext">
18504 </div>
18505 </div></li>
18506 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
18507 <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>
18508 <div class="gallerytext">
18509 </div>
18510 </div></li>
18511 </ul>
18512
18513 !! end
18514
18515 !! test
18516 HTML Hex character encoding (spells the word "JavaScript")
18517 !! options
18518 parsoid=wt2html,wt2wt,html2html
18519 !! wikitext
18520 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
18521 !! html/php
18522 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
18523 </p>
18524 !! html/php+tidy
18525 <p>JavaScript</p>
18526 !! html/parsoid
18527 <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>
18528 !! end
18529
18530 !! test
18531 HTML Hex character encoding bogus encoding (bug 26437 regression check)
18532 !! wikitext
18533 &#xsee;&#XSEE;
18534 !! html/php
18535 <p>&amp;#xsee;&amp;#XSEE;
18536 </p>
18537 !! html/parsoid
18538 <p>&amp;#xsee;&amp;#XSEE;</p>
18539 !! end
18540
18541 !! test
18542 HTML Hex character encoding mixed case
18543 !! options
18544 parsoid=wt2html,wt2wt,html2html
18545 !! wikitext
18546 &#xEE;&#Xee;
18547 !! html/php
18548 <p>&#xee;&#xee;
18549 </p>
18550 !! html/php+tidy
18551 <p>îî</p>
18552 !! html/parsoid
18553 <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
18554 !! end
18555
18556 # See: http://www.w3.org/TR/html5/syntax.html#character-references
18557 # Note that U+000C (form feed) is not a valid XML character, so
18558 # it is banned even though allowed in HTML5.
18559 !! test
18560 Illegal character references (T106578)
18561 !! wikitext
18562 ; Null: &#00;
18563 ; FF: &#xC;
18564 ; CR: &#xD;
18565 ; Control (low): &#8;
18566 ; Control (high): &#x7F; &#x9F;
18567 ; Surrogate: &#xD83D;&#xDCA9;
18568 ; This is an okay astral character: &#x1F4A9;
18569 !! html+tidy
18570 <dl>
18571 <dt>Null</dt>
18572 <dd>&amp;#00;</dd>
18573 <dt>FF</dt>
18574 <dd>&amp;#xC;</dd>
18575 <dt>CR</dt>
18576 <dd>&amp;#xD;</dd>
18577 <dt>Control (low)</dt>
18578 <dd>&amp;#8;</dd>
18579 <dt>Control (high)</dt>
18580 <dd>&amp;#x7F; &amp;#x9F;</dd>
18581 <dt>Surrogate</dt>
18582 <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
18583 <dt>This is an okay astral character</dt>
18584 <dd>💩</dd>
18585 </dl>
18586 !! end
18587
18588 !! test
18589 __FORCETOC__ override
18590 !! wikitext
18591 __NEWSECTIONLINK__
18592 __FORCETOC__
18593 !! html/php
18594 <p><br />
18595 </p>
18596 !! end
18597
18598 !! test
18599 ISBN code coverage
18600 !! wikitext
18601 ISBN 978-0-1234-56&#x20;789
18602 !! html
18603 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
18604 </p>
18605 !! html+tidy
18606 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789</p>
18607 !! html/parsoid
18608 <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>
18609 !! end
18610
18611 !! test
18612 ISBN followed by 5 spaces
18613 !! wikitext
18614 ISBN
18615 !! html
18616 <p>ISBN
18617 </p>
18618 !! end
18619
18620 !! test
18621 Double ISBN
18622 !! wikitext
18623 ISBN ISBN 1234567890
18624 !! html/php
18625 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18626 </p>
18627 !! html/parsoid
18628 <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
18629 !! end
18630
18631 # Uppercase X and lowercase x as well
18632 !! test
18633 ISBN with an X
18634 !! wikitext
18635 ISBN 3-462-04561-X
18636 ISBN 3-462-04561-x
18637 ISBN 080442957X
18638 ISBN 080442957x
18639 ISBN 978080442957X
18640 ISBN 978080442957x
18641 !! html/php
18642 <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
18643 <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
18644 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
18645 <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
18646 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
18647 <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
18648 </p>
18649 !! html/parsoid
18650 <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
18651 <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
18652 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
18653 <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
18654 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
18655 <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
18656 !! end
18657
18658 !! test
18659 ISBN with empty prefix (parsoid test)
18660 !! wikitext
18661 ISBN 1234567890
18662 !! html/php
18663 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
18664 </p>
18665 !! html/parsoid
18666 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
18667 !! end
18668
18669 !! test
18670 Bug 22905: <abbr> followed by ISBN followed by </a>
18671 !! wikitext
18672 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
18673 !! html/php
18674 <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>
18675 </p>
18676 !! html/parsoid
18677 <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>
18678 !! end
18679
18680 !! test
18681 Double RFC
18682 !! wikitext
18683 RFC RFC 1234
18684 !! html
18685 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
18686 </p>
18687 !! end
18688
18689 !! test
18690 Double RFC with a wiki link
18691 !! wikitext
18692 RFC [[RFC 1234]]
18693 !! html
18694 <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>
18695 </p>
18696 !! end
18697
18698 !! test
18699 RFC code coverage
18700 !! wikitext
18701 RFC 983&#x20;987
18702 !! html
18703 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
18704 </p>
18705 !! html+tidy
18706 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a> 987</p>
18707 !! end
18708
18709 !! test
18710 Centre-aligned image
18711 !! wikitext
18712 [[Image:foobar.jpg|centre]]
18713 !! html
18714 <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>
18715
18716 !!end
18717
18718 !! test
18719 None-aligned image
18720 !! wikitext
18721 [[Image:foobar.jpg|none]]
18722 !! html
18723 <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>
18724
18725 !!end
18726
18727 !! test
18728 Width + Height sized image (using px) (height is ignored)
18729 !! wikitext
18730 [[Image:foobar.jpg|640x480px]]
18731 !! html
18732 <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>
18733 </p>
18734 !!end
18735
18736 !! test
18737 Width-sized image (using px, no following whitespace)
18738 !! wikitext
18739 [[Image:foobar.jpg|640px]]
18740 !! html
18741 <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>
18742 </p>
18743 !!end
18744
18745 !! test
18746 Width-sized image (using px, with following whitespace - test regression from r39467)
18747 !! wikitext
18748 [[Image:foobar.jpg|640px ]]
18749 !! html
18750 <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>
18751 </p>
18752 !!end
18753
18754 !! test
18755 Width-sized image (using px, with preceding whitespace - test regression from r39467)
18756 !! wikitext
18757 [[Image:foobar.jpg| 640px]]
18758 !! html
18759 <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>
18760 </p>
18761 !!end
18762
18763 !! test
18764 Image with page parameter
18765 !! options
18766 djvu
18767 !! wikitext
18768 [[File:LoremIpsum.djvu|page=2]]
18769 !! html/php
18770 <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>
18771 </p>
18772 !! html/parsoid
18773 <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>
18774 !! end
18775
18776 !! test
18777 Another italics / bold test
18778 !! wikitext
18779 ''' ''x'
18780 !! html
18781 <pre>'<i> </i>x'
18782 </pre>
18783 !!end
18784
18785 # FIXME: The php output seems broken. It's interleaving some open/close tags.
18786 !! test
18787 dt/dd/dl test
18788 !! wikitext
18789 :;;;::
18790 !! html/php
18791 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
18792
18793 !! html/parsoid
18794 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
18795
18796 !!end
18797
18798
18799 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
18800 !! test
18801 Images with the "|" character in the comment
18802 !! wikitext
18803 [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
18804 !! html/php
18805 <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>
18806
18807 !! html/parsoid
18808 <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>
18809 !! end
18810
18811 !! test
18812 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
18813 !! wikitext
18814 <html><script>alert(1);</script></html>
18815 !! html
18816 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
18817 </p>
18818 !! end
18819
18820 !! test
18821 HTML with raw HTML ($wgRawHtml==true)
18822 !! options
18823 wgRawHtml=1
18824 !! wikitext
18825 <html><script>alert(1);</script></html>
18826 !! html
18827 <p><script>alert(1);</script>
18828 </p>
18829 !! end
18830
18831 !! test
18832 Parents of subpages, one level up
18833 !! options
18834 subpage title=[[Subpage test/L1/L2/L3]]
18835 !! wikitext
18836 [[../|L2]]
18837 !! html
18838 <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>
18839 </p>
18840 !! end
18841
18842
18843 !! test
18844 Parents of subpages, one level up, not named
18845 !! options
18846 subpage title=[[Subpage test/L1/L2/L3]]
18847 !! wikitext
18848 [[../]]
18849 !! html
18850 <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>
18851 </p>
18852 !! end
18853
18854
18855
18856 !! test
18857 Parents of subpages, two levels up
18858 !! options
18859 subpage title=[[Subpage test/L1/L2/L3]]
18860 !! wikitext
18861 [[../../|L1]]2
18862
18863 [[../../|L1]]l
18864 !! html
18865 <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
18866 </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>
18867 </p>
18868 !! end
18869
18870 !! test
18871 Parents of subpages, two levels up, without trailing slash or name.
18872 !! options
18873 subpage title=[[Subpage test/L1/L2/L3]]
18874 !! wikitext
18875 [[../..]]
18876 !! html
18877 <p>[[../..]]
18878 </p>
18879 !! end
18880
18881 !! test
18882 Parents of subpages, two levels up, with lots of extra trailing slashes.
18883 !! options
18884 subpage title=[[Subpage test/L1/L2/L3]]
18885 !! wikitext
18886 [[../../////]]
18887 !! html
18888 <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>
18889 </p>
18890 !! end
18891
18892 !! article
18893 Subpage test/L1/L2/L3Sibling
18894 !! text
18895 Sibling article
18896 !! endarticle
18897
18898 !! test
18899 Transclusion of a sibling page (one level up)
18900 !! options
18901 subpage title=[[Subpage test/L1/L2/L3]]
18902 !! wikitext
18903 {{../L3Sibling}}
18904 !! html
18905 <p>Sibling article
18906 </p>
18907 !! end
18908
18909 !! test
18910 Transclusion of a child page
18911 !! options
18912 subpage title=[[Subpage test/L1/L2]]
18913 !! wikitext
18914 {{/L3Sibling}}
18915 !! html
18916 <p>Sibling article
18917 </p>
18918 !! end
18919
18920 !! test
18921 Non-transclusion because of too many up levels
18922 !! options
18923 subpage title=[[Subpage test/L1/L2/L3]]
18924 !! wikitext
18925 {{../../../../More than parent}}
18926 !! html
18927 <p>{{../../../../More than parent}}
18928 </p>
18929 !! end
18930
18931 !! test
18932 Definition list code coverage
18933 !! wikitext
18934 ; title : def
18935 ; title : def
18936 ;title: def
18937 !! html/php
18938 <dl><dt> title &#160;</dt>
18939 <dd> def</dd>
18940 <dt> title&#160;</dt>
18941 <dd> def</dd>
18942 <dt>title</dt>
18943 <dd> def</dd></dl>
18944
18945 !! html/parsoid
18946 <dl><dt> title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18947 <dt> title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
18948 <dt>title</dt><dd> def</dd></dl>
18949 !! end
18950
18951 !! test
18952 Don't fall for the self-closing div
18953 !! wikitext
18954 <div>hello world</div/>
18955 !! html
18956 <div>hello world</div>
18957
18958 !! end
18959
18960 !! test
18961 MSGNW magic word
18962 !! wikitext
18963 {{MSGNW:msg}}
18964 !! html/php
18965 <p>&#91;&#91;:Template:Msg&#93;&#93;
18966 </p>
18967 !! end
18968
18969 !! test
18970 RAW magic word
18971 !! wikitext
18972 {{RAW:QUERTY}}
18973 !! html
18974 <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>
18975 </p>
18976 !! end
18977
18978 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
18979 !! test
18980 Always escape literal '>' in output, not just after '<'
18981 !! wikitext
18982 ><>
18983 !! html
18984 <p>&gt;&lt;&gt;
18985 </p>
18986 !! end
18987
18988 !! test
18989 Template caching
18990 !! wikitext
18991 {{Test}}
18992 {{Test}}
18993 !! html
18994 <p>This is a test template
18995 This is a test template
18996 </p>
18997 !! end
18998
18999
19000 !! article
19001 MediaWiki:Fake
19002 !! text
19003 ==header==
19004 !! endarticle
19005
19006 !! test
19007 Inclusion of !userCanEdit() content
19008 !! wikitext
19009 {{MediaWiki:Fake}}
19010 !! html
19011 <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>
19012
19013 !! end
19014
19015
19016 !! test
19017 Out-of-order TOC heading levels
19018 !! wikitext
19019 ==2==
19020 ======6======
19021 ===3===
19022 =1=
19023 =====5=====
19024 ==2==
19025 !! html
19026 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
19027 <ul>
19028 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
19029 <ul>
19030 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
19031 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
19032 </ul>
19033 </li>
19034 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
19035 <ul>
19036 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
19037 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
19038 </ul>
19039 </li>
19040 </ul>
19041 </div>
19042
19043 <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>
19044 <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>
19045 <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>
19046 <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>
19047 <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>
19048 <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>
19049
19050 !! end
19051
19052
19053 !! test
19054 ISBN with a dummy number
19055 !! wikitext
19056 ISBN ---
19057 !! html
19058 <p>ISBN ---
19059 </p>
19060 !! end
19061
19062
19063 !! test
19064 ISBN with space-delimited number
19065 !! wikitext
19066 ISBN 92 9017 032 8
19067 !! html
19068 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
19069 </p>
19070 !! end
19071
19072
19073 !! test
19074 ISBN with multiple spaces, no number
19075 !! wikitext
19076 ISBN foo
19077 !! html
19078 <p>ISBN foo
19079 </p>
19080 !! end
19081
19082
19083 !! test
19084 ISBN length
19085 !! wikitext
19086 ISBN 123456789
19087
19088 ISBN 1234567890
19089
19090 ISBN 12345678901
19091 !! html
19092 <p>ISBN 123456789
19093 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
19094 </p><p>ISBN 12345678901
19095 </p>
19096 !! end
19097
19098
19099 !! test
19100 ISBN with trailing year (bug 8110)
19101 !! wikitext
19102 ISBN 1-234-56789-0 - 2006
19103
19104 ISBN 1 234 56789 0 - 2006
19105 !! html
19106 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
19107 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
19108 </p>
19109 !! end
19110
19111
19112 !! test
19113 anchorencode
19114 !! wikitext
19115 {{anchorencode:foo bar©#%n}}
19116 !! html
19117 <p>foo_bar.C2.A9.23.25n
19118 </p>
19119 !! end
19120
19121 !! test
19122 anchorencode trims spaces
19123 !! wikitext
19124 {{anchorencode: __pretty__please__}}
19125 !! html
19126 <p>pretty_please
19127 </p>
19128 !! end
19129
19130 !! test
19131 anchorencode deals with links
19132 !! wikitext
19133 {{anchorencode: [[hello|world]] [[hi]]}}
19134 !! html
19135 <p>world_hi
19136 </p>
19137 !! end
19138
19139 !! test
19140 anchorencode deals with templates
19141 !! wikitext
19142 {{anchorencode: {{Foo}} }}
19143 !! html
19144 <p>FOO
19145 </p>
19146 !! end
19147
19148 !! test
19149 anchorencode encodes like the TOC generator: (bug 18431)
19150 !! wikitext
19151 === _ +:.3A%3A&&amp;]] ===
19152 {{anchorencode: _ +:.3A%3A&&amp;]] }}
19153 __NOEDITSECTION__
19154 !! html
19155 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
19156 <p>.2B:.3A.253A.26.26.5D.5D
19157 </p>
19158 !! end
19159
19160 !! test
19161 Bug 6200: blockquotes and paragraph formatting
19162 !! wikitext
19163 <blockquote>
19164 foo
19165 </blockquote>
19166
19167 bar
19168
19169 baz
19170 !! html
19171 <blockquote>
19172 <p>foo
19173 </p>
19174 </blockquote>
19175 <p>bar
19176 </p>
19177 <pre>baz
19178 </pre>
19179 !! end
19180
19181 !! test
19182 Bug 8293: Use of center tag ruins paragraph formatting
19183 !! wikitext
19184 <center>
19185 foo
19186 </center>
19187
19188 bar
19189
19190 baz
19191 !! html
19192 <center>
19193 <p>foo
19194 </p>
19195 </center>
19196 <p>bar
19197 </p>
19198 <pre>baz
19199 </pre>
19200 !! end
19201
19202 !!test
19203 Parsing of overlapping (improperly nested) inline html tags
19204 !! wikitext
19205 <span><s>x</span></s>
19206 !! html/php
19207 <p><span><s>x&lt;/span&gt;</s></span>
19208 </p>
19209 !! html/parsoid
19210 <p><span><s>x</s></span>
19211 </p>
19212 !!end
19213
19214 ###
19215 ### Language variants related tests
19216 ###
19217 !! test
19218 Self-link in language variants
19219 !! options
19220 title=[[Dunav]] language=sr
19221 !! wikitext
19222 Both [[Dunav]] and [[Дунав]] are names for this river.
19223 !! html
19224 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
19225 </p>
19226 !!end
19227
19228 !! article
19229 Дуна
19230 !! text
19231 content
19232 !! endarticle
19233
19234 !! test
19235 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
19236 !! options
19237 title=[[Duna]] language=sr
19238 !! wikitext
19239 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
19240 !! html
19241 <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.
19242 </p>
19243 !! end
19244
19245 !! test
19246 Link to a section of a variant of this title shouldn't be parsed as self-link
19247 !! options
19248 title=[[Duna]] language=sr
19249 !! wikitext
19250 [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
19251 !! html
19252 <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.
19253 </p>
19254 !! end
19255
19256 !! test
19257 Link to pages in language variants
19258 !! options
19259 language=sr
19260 !! wikitext
19261 Main Page can be written as [[Маин Паге]]
19262 !! html
19263 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
19264 </p>
19265 !!end
19266
19267
19268 !! test
19269 Multiple links to pages in language variants
19270 !! options
19271 language=sr
19272 !! wikitext
19273 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
19274 !! html
19275 <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>.
19276 </p>
19277 !!end
19278
19279
19280 !! test
19281 Simple template in language variants
19282 !! options
19283 language=sr
19284 !! wikitext
19285 {{тест}}
19286 !! html
19287 <p>This is a test template
19288 </p>
19289 !! end
19290
19291
19292 !! test
19293 Template with explicit namespace in language variants
19294 !! options
19295 language=sr
19296 !! wikitext
19297 {{Template:тест}}
19298 !! html
19299 <p>This is a test template
19300 </p>
19301 !! end
19302
19303
19304 !! test
19305 Basic test for template parameter in language variants
19306 !! options
19307 language=sr
19308 !! wikitext
19309 {{парамтест|param=foo}}
19310 !! html
19311 <p>This is a test template with parameter foo
19312 </p>
19313 !! end
19314
19315
19316 !! test
19317 Simple category in language variants
19318 !! options
19319 language=sr cat
19320 !! wikitext
19321 [[Category:МедиаWики Усер'с Гуиде]]
19322 !! html
19323 <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>
19324 !! end
19325
19326
19327 !! article
19328 Category:分类
19329 !! text
19330 blah
19331 !! endarticle
19332
19333 !! article
19334 Category:分類
19335 !! text
19336 blah
19337 !! endarticle
19338
19339 ## We used to, but no longer wt2wt this test since the default serializer
19340 ## will normalize all categories to serialize on their own line.
19341 ## This wikitext usage is going to be fairly uncommon in production and
19342 ## selser will take care of preserving formatting in those scenarios.
19343 !! test
19344 Don't convert blue categorylinks to another variant (bug 33210)
19345 !! options
19346 cat
19347 language=zh
19348 parsoid=wt2html
19349 !! wikitext
19350 [[A]][[Category:分类]]
19351 !! html/php
19352 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
19353 !! html/parsoid
19354 <p><a rel="mw:WikiLink" href="A" title="A">A</a></p>
19355 <link rel="mw:PageProp/Category" href="Category:分类"/>
19356 !! end
19357
19358 !! test
19359 Stripping -{}- tags (language variants)
19360 !! options
19361 language=sr
19362 !! wikitext
19363 Latin proverb: -{Ne nuntium necare}-
19364 !! html
19365 <p>Latin proverb: Ne nuntium necare
19366 </p>
19367 !! end
19368
19369
19370 !! test
19371 Prevent conversion with -{}- tags (language variants)
19372 !! options
19373 language=sr variant=sr-ec
19374 !! wikitext
19375 Latinski: -{Ne nuntium necare}-
19376 !! html
19377 <p>Латински: Ne nuntium necare
19378 </p>
19379 !! end
19380
19381
19382 !! test
19383 Prevent conversion of text with -{}- tags (language variants)
19384 !! options
19385 language=sr variant=sr-ec
19386 !! wikitext
19387 Latinski: -{Ne nuntium necare}-
19388 !! html
19389 <p>Латински: Ne nuntium necare
19390 </p>
19391 !! end
19392
19393
19394 !! test
19395 Prevent conversion of links with -{}- tags (language variants)
19396 !! options
19397 language=sr variant=sr-ec
19398 !! wikitext
19399 -{[[Main Page]]}-
19400 !! html
19401 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
19402 </p>
19403 !! end
19404
19405
19406 !! test
19407 -{}- tags within headlines (within html for parserConvert())
19408 !! options
19409 language=sr variant=sr-ec
19410 !! wikitext
19411 == -{Naslov}- ==
19412 !! html
19413 <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>
19414
19415 !! end
19416
19417
19418 !! test
19419 Explicit definition of language variant alternatives
19420 !! options
19421 language=zh variant=zh-tw
19422 !! wikitext
19423 -{zh:China;zh-tw:Taiwan}-, not China
19424 !! html
19425 <p>Taiwan, not China
19426 </p>
19427 !! end
19428
19429
19430 !! test
19431 Conversion around HTML tags
19432 !! options
19433 language=sr variant=sr-ec
19434 !! wikitext
19435 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
19436 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
19437 !! html
19438 <p>
19439 <span title="ЛаCтин">ски</span>
19440 </p>
19441 !! end
19442
19443
19444 !! test
19445 Explicit session-wise language variant mapping (A flag and - flag)
19446 !! options
19447 language=zh variant=zh-tw
19448 !! wikitext
19449 Taiwan is not China.
19450 But -{A|zh:China;zh-tw:Taiwan}- is China,
19451 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
19452 and -{China}- is China.
19453 !! html
19454 <p>Taiwan is not China.
19455 But Taiwan is Taiwan,
19456 (This should be stripped!)
19457 and China is China.
19458 </p>
19459 !! end
19460
19461 !! test
19462 Explicit session-wise language variant mapping (H flag for hide)
19463 !! options
19464 language=zh variant=zh-tw
19465 !! wikitext
19466 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
19467 Taiwan is China.
19468 !! html
19469 <p>(This should be stripped!)
19470 Taiwan is Taiwan.
19471 </p>
19472 !! end
19473
19474 !! test
19475 Adding explicit conversion rule for title (T flag)
19476 !! options
19477 language=zh variant=zh-tw showtitle
19478 !! wikitext
19479 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19480 !! html
19481 Taiwan
19482 <p>Should be stripped!
19483 </p>
19484 !! end
19485
19486 !! test
19487 Testing that changing the language variant here in the tests actually works
19488 !! options
19489 language=zh variant=zh showtitle
19490 !! wikitext
19491 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19492 !! html
19493 China
19494 <p>Should be stripped!
19495 </p>
19496 !! end
19497
19498 !! test
19499 Recursive conversion of alt and title attrs shouldn't clear converter state
19500 !! options
19501 language=zh variant=zh-cn showtitle
19502 !! wikitext
19503 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
19504 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
19505 !! html
19506 China
19507 <p>
19508 Should be stripped<span title="Exclamation">!</span>
19509 </p>
19510 !! end
19511
19512 !! test
19513 Bug 24072: more test on conversion rule for title
19514 !! options
19515 language=zh variant=zh-tw showtitle
19516 !! wikitext
19517 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
19518 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
19519 !! html
19520 Taiwan
19521 <p>This should be stripped!
19522 This won't take interferes with the title rule.
19523 </p>
19524 !! end
19525
19526 !! test
19527 Partly disable title conversion if variant == main language code
19528 !! options
19529 language=zh variant=zh title=[[ZH]] showtitle
19530 !! wikitext
19531 -{T|zh-cn:CN;zh-tw:TW}-
19532 !! html
19533 ZH
19534 <p>
19535 </p>
19536 !! end
19537
19538 !! test
19539 Partly disable title conversion if variant == main language code, more
19540 !! options
19541 language=zh variant=zh title=[[ZH]] showtitle
19542 !! wikitext
19543 -{T|TW}-
19544 !! html
19545 ZH
19546 <p>
19547 </p>
19548 !! end
19549
19550 !! test
19551 Raw output of variant escape tags (R flag)
19552 !! options
19553 language=zh variant=zh-tw
19554 !! wikitext
19555 Raw: -{R|zh:China;zh-tw:Taiwan}-
19556 !! html
19557 <p>Raw: zh:China;zh-tw:Taiwan
19558 </p>
19559 !! end
19560
19561 !! test
19562 Strings evaluating false shouldn't be ignored by Language converter (T51072)
19563 !! options
19564 language=zh variant=zh-cn
19565 !! input
19566 -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
19567 !! result
19568 <p>0
19569 </p>
19570 !! end
19571
19572 !! test
19573 Conversion rules from [numeric-only string] to [something else] (T48634)
19574 !! options
19575 language=zh variant=zh-cn
19576 !! input
19577 -{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
19578 !! result
19579 <p>D12345EE12345
19580 </p>
19581 !! end
19582
19583 !! test
19584 Bidirectional converter rule entries with an empty value should be ignored (T53551)
19585 !! options
19586 language=zh variant=zh-cn
19587 !! input
19588 -{H|zh-cn:foo;zh-tw:;}-foobar
19589 !! result
19590 <p>foobar
19591 </p>
19592 !! end
19593
19594 !! test
19595 Unidirectional converter rule entries with an empty "from" string should be ignored (T53551)
19596 !! options
19597 language=zh variant=zh-cn
19598 !! input
19599 -{H|=>zh-cn:foo;}-foobar
19600 !! result
19601 <p>foobar
19602 </p>
19603 !! end
19604
19605 !! test
19606 Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
19607 !! options
19608 language=zh variant=zh-cn
19609 !! input
19610 -{H|}-foobar
19611 !! result
19612 <p>foobar
19613 </p>
19614 !! end
19615
19616 !! test
19617 Nested using of manual convert syntax
19618 !! options
19619 language=zh variant=zh-hk
19620 !! wikitext
19621 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
19622 !! html
19623 <p>Nested: Hello Hong Kong!
19624 </p>
19625 !! end
19626
19627 !! test
19628 Proper conversion of text in external links
19629 !! options
19630 language=sr variant=sr-ec
19631 !! wikitext
19632 http://www.google.com
19633 gopher://www.google.com
19634 [http://www.google.com http://www.google.com]
19635 [gopher://www.google.com gopher://www.google.com]
19636 [https://www.google.com irc://www.google.com]
19637 [ftp://www.google.com www.google.com/ftp://dir]
19638 [//www.google.com www.google.com]
19639 !! html
19640 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19641 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19642 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
19643 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
19644 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
19645 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
19646 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
19647 </p>
19648 !! end
19649
19650 !! test
19651 Do not convert roman numbers to language variants
19652 !! options
19653 language=sr variant=sr-ec
19654 !! wikitext
19655 Fridrih IV je car.
19656 !! html
19657 <p>Фридрих IV је цар.
19658 </p>
19659 !! end
19660
19661 !! test
19662 Unclosed language converter markup "-{"
19663 !! options
19664 language=sr
19665 !! wikitext
19666 -{T|hello
19667 !! html
19668 <p>-{T|hello
19669 </p>
19670 !! end
19671
19672 !! test
19673 Don't convert raw rule "-{R|=&gt;}-" to "=>"
19674 !! options
19675 language=sr
19676 !! wikitext
19677 -{R|=&gt;}-
19678 !! html
19679 <p>=&gt;
19680 </p>
19681 !!end
19682
19683 !! test
19684 Don't break link parsing if language converter markup is in the caption.
19685 !! options
19686 language=sr variant=sr-ec
19687 !! wikitext
19688 [[Main Page|-{R|main page}-]]
19689 !! html
19690 <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
19691 </p>
19692 !! end
19693
19694 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19695 !! test
19696 Don't break image parsing if language converter markup is in the caption.
19697 !! options
19698 language=sr
19699 !! wikitext
19700 [[File:Foobar.jpg|-{R|caption}-]]
19701 !! html/parsoid
19702 <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>
19703 </p>
19704 !! end
19705
19706 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19707 !! test
19708 Don't break list handling if language converter markup is in the item.
19709 !! options
19710 language=zh variant=zh-cn
19711 !! wikitext
19712 ;-{zh-cn:AAA;zh-tw:BBB}-
19713 !! html/php
19714 <dl><dt><span class="error">在手动语言转换规则中检测到错误</span></dd></dl>
19715
19716 !! html/parsoid
19717 <dl><dt>AAA
19718 </dt></dl>
19719 !! end
19720
19721 # FIXME: This test is currently broken in the PHP parser (bug 52661)
19722 !! test
19723 Don't break table handling if language converter markup is in the cell.
19724 !! options
19725 language=sr variant=sr-ec
19726 !! wikitext
19727 {|
19728 |-
19729 | -{R|B}-
19730 |}
19731 !! html/php
19732 <table>
19733
19734 <tr>
19735 <td>Б}-
19736 </td></tr></table>
19737
19738 !! html/parsoid
19739 <table>
19740
19741 <tr>
19742 <td> B
19743 </td></tr></table>
19744
19745 !! end
19746
19747 !! test
19748 Bug 529: Uncovered bullet
19749 !! wikitext
19750 * Foo {{bullet}}
19751 !! html
19752 <ul><li> Foo </li>
19753 <li> Bar</li></ul>
19754
19755 !! end
19756
19757 # Plain MediaWiki does not remove empty lists, but tidy actually does.
19758 # Templates in Wikipedia rely on this behavior, as tidy has always been
19759 # enabled there. These tests are normally run *without* tidy, so specify the
19760 # full output here.
19761 # To test realistic parsing behavior, apply a tidy-like transformation to both
19762 # the expected output and your parser's output.
19763 !! test
19764 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
19765 !! wikitext
19766 ******* Foo {{bullet}}
19767 !! html
19768 <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>
19769 <li> Bar</li></ul>
19770
19771 !! end
19772
19773 !! test
19774 Bug 529: Uncovered table already at line-start
19775 !! wikitext
19776 x
19777
19778 {{table}}
19779 y
19780 !! html
19781 <p>x
19782 </p>
19783 <table>
19784 <tr>
19785 <td> 1 </td>
19786 <td> 2
19787 </td></tr>
19788 <tr>
19789 <td> 3 </td>
19790 <td> 4
19791 </td></tr></table>
19792 <p>y
19793 </p>
19794 !! end
19795
19796 !! test
19797 Bug 529: Uncovered bullet in parser function result
19798 !! wikitext
19799 * Foo {{lc:{{bullet}} }}
19800 !! html
19801 <ul><li> Foo </li>
19802 <li> bar</li></ul>
19803
19804 !! end
19805
19806 !! test
19807 Bug 5678: Double-parsed template argument
19808 !! wikitext
19809 {{lc:{{{1}}}|hello}}
19810 !! html
19811 <p>{{{1}}}
19812 </p>
19813 !! end
19814
19815 !! test
19816 Bug 5678: Double-parsed template invocation
19817 !! wikitext
19818 {{lc:{{paramtest {{!}} param = hello }} }}
19819 !! html
19820 <p>{{paramtest | param = hello }}
19821 </p>
19822 !! end
19823
19824 !! test
19825 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
19826 !! options
19827 language=cs
19828 title=[[Main Page]]
19829 !! wikitext
19830 {{PRVNÍVELKÉ:ěščř}}
19831 {{prvnívelké:ěščř}}
19832 {{PRVNÍMALÉ:ěščř}}
19833 {{prvnímalé:ěščř}}
19834 {{MALÁ:ěščř}}
19835 {{malá:ěščř}}
19836 {{VELKÁ:ěščř}}
19837 {{velká:ěščř}}
19838 !! html
19839 <p>Ěščř
19840 Ěščř
19841 ěščř
19842 ěščř
19843 ěščř
19844 ěščř
19845 ĚŠČŘ
19846 ĚŠČŘ
19847 </p>
19848 !! end
19849
19850 !! test
19851 Morwen/13: Unclosed link followed by heading
19852 !! wikitext
19853 [[link
19854 ==heading==
19855 !! html
19856 <p>[[link
19857 </p>
19858 <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>
19859
19860 !! end
19861
19862 !! test
19863 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
19864 !! wikitext
19865 {{foo|
19866 =heading=
19867 !! html
19868 <p>{{foo|
19869 </p>
19870 <h1><span class="mw-headline" id="heading">heading</span></h1>
19871
19872 !! end
19873
19874 !! test
19875 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
19876 !! wikitext
19877 {{foo|
19878 ==heading==
19879 !! html
19880 <p>{{foo|
19881 </p>
19882 <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>
19883
19884 !! end
19885
19886 !! test
19887 Tildes in comments
19888 !! options
19889 pst
19890 !! wikitext
19891 <!-- ~~~~ -->
19892 !! html/php
19893 <!-- ~~~~ -->
19894 !! end
19895
19896 !! test
19897 Paragraphs inside divs (no extra line breaks)
19898 !! wikitext
19899 <div>Line one
19900
19901 Line two</div>
19902 !! html
19903 <div>Line one
19904 Line two</div>
19905
19906 !! end
19907
19908 !! test
19909 Paragraphs inside divs (extra line break on open)
19910 !! wikitext
19911 <div>
19912 Line one
19913
19914 Line two</div>
19915 !! html
19916 <div>
19917 <p>Line one
19918 </p>
19919 Line two</div>
19920
19921 !! end
19922
19923 !! test
19924 Paragraphs inside divs (extra line break on close)
19925 !! wikitext
19926 <div>Line one
19927
19928 Line two
19929 </div>
19930 !! html
19931 <div>Line one
19932 <p>Line two
19933 </p>
19934 </div>
19935
19936 !! end
19937
19938 !! test
19939 Paragraphs inside divs (extra line break on open and close)
19940 !! wikitext
19941 <div>
19942 Line one
19943
19944 Line two
19945 </div>
19946 !! html
19947 <div>
19948 <p>Line one
19949 </p><p>Line two
19950 </p>
19951 </div>
19952
19953 !! end
19954
19955 !! test
19956 Nesting tags, paragraphs on lines which begin with <div>
19957 !! wikitext
19958 <div></div><strong>A
19959 B</strong>
19960 !! html/php+tidy
19961 <p><strong>A</strong></p>
19962 <p><strong>B</strong></p>
19963 !! html/parsoid
19964 <div></div>
19965 <p><strong>A
19966 B</strong>
19967 </p>
19968 !! end
19969
19970 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
19971 !! test
19972 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
19973 !! wikitext
19974 <blockquote>Line one
19975
19976 Line two</blockquote>
19977 !! html
19978 <blockquote>Line one
19979 Line two</blockquote>
19980
19981 !! html+tidy
19982 <blockquote>
19983 <p>Line one Line two</p>
19984 </blockquote>
19985 !! end
19986
19987 !! test
19988 Bug 6200: paragraphs inside blockquotes (extra line break on open)
19989 !! wikitext
19990 <blockquote>
19991 Line one
19992
19993 Line two</blockquote>
19994 !! html
19995 <blockquote>
19996 <p>Line one
19997 </p>
19998 Line two</blockquote>
19999
20000 !! html+tidy
20001 <blockquote>
20002 <p>Line one</p>
20003 Line two</blockquote>
20004 !! end
20005
20006 !! test
20007 Bug 6200: paragraphs inside blockquotes (extra line break on close)
20008 !! wikitext
20009 <blockquote>Line one
20010
20011 Line two
20012 </blockquote>
20013 !! html
20014 <blockquote>Line one
20015 <p>Line two
20016 </p>
20017 </blockquote>
20018
20019 !! html+tidy
20020 <blockquote>
20021 <p>Line one</p>
20022 <p>Line two</p>
20023 </blockquote>
20024 !! end
20025
20026 !! test
20027 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
20028 !! wikitext
20029 <blockquote>
20030 Line one
20031
20032 Line two
20033 </blockquote>
20034 !! html
20035 <blockquote>
20036 <p>Line one
20037 </p><p>Line two
20038 </p>
20039 </blockquote>
20040
20041 !! html+tidy
20042 <blockquote>
20043 <p>Line one</p>
20044 <p>Line two</p>
20045 </blockquote>
20046 !! end
20047
20048 !! test
20049 Paragraphs inside blockquotes/divs (no extra line breaks)
20050 !! wikitext
20051 <blockquote><div>Line one
20052
20053 Line two</div></blockquote>
20054 !! html
20055 <blockquote><div>Line one
20056 Line two</div></blockquote>
20057
20058 !! end
20059
20060 !! test
20061 Paragraphs inside blockquotes/divs (extra line break on open)
20062 !! wikitext
20063 <blockquote><div>
20064 Line one
20065
20066 Line two</div></blockquote>
20067 !! html
20068 <blockquote><div>
20069 <p>Line one
20070 </p>
20071 Line two</div></blockquote>
20072
20073 !! end
20074
20075 !! test
20076 Paragraphs inside blockquotes/divs (extra line break on close)
20077 !! wikitext
20078 <blockquote><div>Line one
20079
20080 Line two
20081 </div></blockquote>
20082 !! html
20083 <blockquote><div>Line one
20084 <p>Line two
20085 </p>
20086 </div></blockquote>
20087
20088 !! end
20089
20090 !! test
20091 Paragraphs inside blockquotes/divs (extra line break on open and close)
20092 !! wikitext
20093 <blockquote><div>
20094 Line one
20095
20096 Line two
20097 </div></blockquote>
20098 !! html
20099 <blockquote><div>
20100 <p>Line one
20101 </p><p>Line two
20102 </p>
20103 </div></blockquote>
20104
20105 !! end
20106
20107 !! test
20108 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
20109 !! options
20110 wgLinkHolderBatchSize=0
20111 !! wikitext
20112 [[meatball:1]]
20113 [[meatball:2]]
20114 [[meatball:3]]
20115 !! html
20116 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
20117 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
20118 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
20119 </p>
20120 !! end
20121
20122 !! test
20123 Free external link invading image caption
20124 !! wikitext
20125 [[Image:Foobar.jpg|thumb|http://x|hello]]
20126 !! html
20127 <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>
20128
20129 !! end
20130
20131 !! test
20132 Bug 15196: localised external link numbers
20133 !! options
20134 language=fa
20135 !! wikitext
20136 [http://en.wikipedia.org/]
20137 !! html/php
20138 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
20139 </p>
20140 !! html/parsoid
20141 <p><a rel="mw:ExtLink" href="http://en.wikipedia.org/"></a></p>
20142 !! end
20143
20144 !! test
20145 Multibyte character in padleft
20146 !! wikitext
20147 {{padleft:-Hello|7|Æ}}
20148 !! html
20149 <p>Æ-Hello
20150 </p>
20151 !! end
20152
20153 !! test
20154 Multibyte character in padright
20155 !! wikitext
20156 {{padright:Hello-|7|Æ}}
20157 !! html
20158 <p>Hello-Æ
20159 </p>
20160 !! end
20161
20162 !!test
20163 formatdate parser function
20164 !! wikitext
20165 {{#formatdate:2009-03-24}}
20166 !! html
20167 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
20168 </p>
20169 !! end
20170
20171 !!test
20172 formatdate parser function, with default format
20173 !! wikitext
20174 {{#formatdate:2009-03-24|mdy}}
20175 !! html
20176 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
20177 </p>
20178 !! end
20179
20180 !! test
20181 Spacing of numbers in formatted dates
20182 !! wikitext
20183 {{#formatdate:January 15}}
20184 !! html
20185 <p><span class="mw-formatted-date" title="01-15">January 15</span>
20186 </p>
20187 !! end
20188
20189 !! test
20190 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
20191 !! options
20192 language=nl title=[[MediaWiki:Common.css]]
20193 !! wikitext
20194 {{#formatdate:2009-03-24|dmy}}
20195 !! html
20196 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
20197 </p>
20198 !! end
20199
20200 #
20201 #
20202 #
20203
20204 #
20205 # Edit comments
20206 #
20207
20208 !! test
20209 Edit comment with link
20210 !! options
20211 comment
20212 !! wikitext
20213 I like the [[Main Page]] a lot
20214 !! html/php
20215 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
20216 !!end
20217
20218 !! test
20219 Edit comment with link and link text
20220 !! options
20221 comment
20222 !! wikitext
20223 I like the [[Main Page|best pages]] a lot
20224 !! html/php
20225 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20226 !!end
20227
20228 !! test
20229 Edit comment with link and link text with suffix
20230 !! options
20231 comment
20232 !! wikitext
20233 I like the [[Main Page|best page]]s a lot
20234 !! html/php
20235 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
20236 !!end
20237
20238 !! test
20239 Edit comment with section link (non-local, eg in history list)
20240 !! options
20241 comment title=[[Main Page]]
20242 !! wikitext
20243 /* External links */ removed bogus entries
20244 !! html/php
20245 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20246 !!end
20247
20248 !! test
20249 Edit comment with section link and text before it (non-local, eg in history list)
20250 !! options
20251 comment title=[[Main Page]]
20252 !! wikitext
20253 pre-comment text /* External links */ removed bogus entries
20254 !! html/php
20255 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>
20256 !!end
20257
20258 !! test
20259 Edit comment with section link (local, eg in diff view)
20260 !! options
20261 comment local title=[[Main Page]]
20262 !! wikitext
20263 /* External links */ removed bogus entries
20264 !! html/php
20265 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
20266 !!end
20267
20268 !! test
20269 Edit comment with subpage link (bug 14080)
20270 !! options
20271 comment
20272 subpage
20273 title=[[Subpage test]]
20274 !! wikitext
20275 Poked at a [[/subpage]] here...
20276 !! html/php
20277 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
20278 !!end
20279
20280 !! test
20281 Edit comment with subpage link and link text (bug 14080)
20282 !! options
20283 comment
20284 subpage
20285 title=[[Subpage test]]
20286 !! wikitext
20287 Poked at a [[/subpage|neat little page]] here...
20288 !! html/php
20289 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
20290 !!end
20291
20292 !! test
20293 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
20294 !! options
20295 comment
20296 title=[[Subpage test]]
20297 !! wikitext
20298 Poked at a [[/subpage]] here...
20299 !! html/php
20300 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...
20301 !!end
20302
20303 !! test
20304 Edit comment with bare anchor link (local, as on diff)
20305 !! options
20306 comment
20307 local
20308 title=[[Main Page]]
20309 !! wikitext
20310 [[#section]]
20311 !! html/php
20312 <a href="#section">#section</a>
20313 !! end
20314
20315 !! test
20316 Edit comment with bare anchor link (non-local, as on history)
20317 !! options
20318 comment
20319 title=[[Main Page]]
20320 !! wikitext
20321 [[#section]]
20322 !! html/php
20323 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
20324 !! end
20325
20326 !! test
20327 Anchor starting with underscore
20328 !! options
20329 title=[[Foo]]
20330 !! wikitext
20331 [[#_ref|One]]
20332 !! html/php
20333 <p><a href="#_ref">One</a>
20334 </p>
20335 !! html/parsoid
20336 <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
20337 !! end
20338
20339 !! test
20340 Id starting with underscore
20341 !! wikitext
20342 <div id="_ref"></div>
20343 !! html/*
20344 <div id="_ref"></div>
20345
20346 !! end
20347
20348 !! test
20349 Space normalisation on autocomment (bug 22784)
20350 !! options
20351 comment
20352 title=[[Main Page]]
20353 !! wikitext
20354 /* __hello__world__ */
20355 !! html/php
20356 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
20357 !! end
20358
20359 !! test
20360 percent-encoding and + signs in comments (Bug 26410)
20361 !! options
20362 comment
20363 !! wikitext
20364 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
20365 !! html/php
20366 <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>
20367 !! end
20368
20369 # Parsoid doesn't support this yet: see bug 73581
20370 # but it *should* omit the 'src' attribute if the image is bad.
20371 # PHP side of tests was disabled in
20372 # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
20373 # because of issues in the PHP parserTests infrastructure
20374 # (but the output below is indeed what the PHP side emits)
20375 !! test
20376 Bad images - basic functionality
20377 !! wikitext
20378 [[File:Bad.jpg]]
20379 !! DISABLED/html/php
20380 !! html/parsoid
20381 <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>
20382 !! end
20383
20384 !! test
20385 Bad images - bug 16039: text after bad image disappears
20386 !! wikitext
20387 Foo bar
20388 [[File:Bad.jpg]]
20389 Bar foo
20390 !! DISABLED/html/php
20391 <p>Foo bar
20392 </p><p>Bar foo
20393 </p>
20394 !! html/parsoid
20395 <p>Foo bar
20396 <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>
20397 Bar foo</p>
20398 !! end
20399
20400 !! test
20401 Verify that displaytitle works (bug #22501) no displaytitle
20402 !! options
20403 showtitle
20404 !! config
20405 wgAllowDisplayTitle=true
20406 wgRestrictDisplayTitle=false
20407 !! wikitext
20408 this is not the the title
20409 !! html/php
20410 Parser test
20411 <p>this is not the the title
20412 </p>
20413 !! end
20414
20415 !! test
20416 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
20417 !! options
20418 showtitle
20419 title=[[Screen]]
20420 !! config
20421 wgAllowDisplayTitle=true
20422 wgRestrictDisplayTitle=false
20423 !! wikitext
20424 this is not the the title
20425 {{DISPLAYTITLE:whatever}}
20426 !! html/php
20427 whatever
20428 <p>this is not the the title
20429 </p>
20430 !! end
20431
20432 !! test
20433 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
20434 !! options
20435 showtitle
20436 title=[[Screen]]
20437 !! config
20438 wgAllowDisplayTitle=true
20439 wgRestrictDisplayTitle=true
20440 !! wikitext
20441 this is not the the title
20442 {{DISPLAYTITLE:whatever}}
20443 !! html/php
20444 Screen
20445 <p>this is not the the title
20446 </p>
20447 !! end
20448
20449 !! test
20450 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
20451 !! options
20452 showtitle
20453 title=[[Screen]]
20454 !! config
20455 wgAllowDisplayTitle=true
20456 wgRestrictDisplayTitle=true
20457 !! wikitext
20458 this is not the the title
20459 {{DISPLAYTITLE:screen}}
20460 !! html/php
20461 screen
20462 <p>this is not the the title
20463 </p>
20464 !! end
20465
20466 !! test
20467 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
20468 !! options
20469 showtitle
20470 title=[[Screen]]
20471 !! config
20472 wgAllowDisplayTitle=false
20473 !! wikitext
20474 this is not the the title
20475 {{DISPLAYTITLE:screen}}
20476 !! html/php
20477 Screen
20478 <p>this is not the the title
20479 <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>
20480 </p>
20481 !! end
20482
20483 !! test
20484 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
20485 !! options
20486 showtitle
20487 title=[[Screen]]
20488 !! config
20489 wgAllowDisplayTitle=false
20490 !! wikitext
20491 this is not the the title
20492 !! html/php
20493 Screen
20494 <p>this is not the the title
20495 </p>
20496 !! end
20497
20498 !! test
20499 Verify that displaytitle handles inline CSS styles (bug 26547) - rejected value
20500 !! options
20501 showtitle
20502 title=[[Screen]]
20503 !! config
20504 wgAllowDisplayTitle=true
20505 wgRestrictDisplayTitle=true
20506 !! wikitext
20507 this is not the the title
20508 {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
20509 !! html/php
20510 <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
20511 <p>this is not the the title
20512 </p>
20513 !! end
20514
20515 !! test
20516 Verify that displaytitle handles inline CSS styles (bug 26547) - accepted value
20517 !! options
20518 showtitle
20519 title=[[Screen]]
20520 !! config
20521 wgAllowDisplayTitle=true
20522 wgRestrictDisplayTitle=true
20523 !! wikitext
20524 this is not the the title
20525 {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
20526 !! html/php
20527 <span style="color: red;">s</span>creen
20528 <p>this is not the the title
20529 </p>
20530 !! end
20531
20532 !! test
20533 Page status indicators: Empty name is invalid
20534 !! options
20535 showindicators
20536 !! wikitext
20537 <indicator name=" "></indicator>
20538 <indicator></indicator>
20539 !! html
20540 <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20541 <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
20542 </p>
20543 !! end
20544
20545 !! test
20546 Page status indicators: Weird syntaxes that are okay
20547 !! options
20548 showindicators
20549 !! wikitext
20550 <indicator name="empty" />
20551 <indicator name="name"></indicator>
20552 !! html
20553 empty=
20554 name=
20555 <p><br />
20556 </p>
20557 !! end
20558
20559 !! test
20560 Page status indicators: Torture test
20561 !! options
20562 showindicators
20563 !! wikitext
20564 <indicator name="01">hello world</indicator>
20565 <indicator name="02">[[Main Page]]</indicator>
20566 <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
20567 <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
20568 <indicator name="05">* foo
20569 * bar</indicator>
20570 <indicator name="06"><nowiki>foo</nowiki></indicator>
20571 <indicator name="07"> Preformatted</indicator>
20572 <indicator name="08"><div>Broken tag</indicator>
20573 <indicator name="09">{| class=wikitable
20574 | cell
20575 |}</indicator>
20576 <indicator name="10">Two
20577
20578 paragraphs</indicator>
20579 !! html
20580 01=hello world
20581 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
20582 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" />
20583 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>
20584 05=<ul><li> foo</li>
20585 <li> bar</li></ul>
20586
20587 06=foo
20588 07=<pre>Preformatted
20589 </pre>
20590 08=<div>Broken tag</div>
20591
20592 09=<table class="wikitable">
20593 <tr>
20594 <td> cell
20595 </td></tr></table>
20596
20597 10=<p>Two
20598 </p><p>paragraphs
20599 </p>
20600 <p><br />
20601 </p><p><br />
20602 </p><p><br />
20603 </p><p><br />
20604 </p><p><br />
20605 </p>
20606 !! end
20607
20608 !! test
20609 preload: check <noinclude> and <includeonly>
20610 !! options
20611 preload
20612 !! wikitext
20613 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
20614 !! html/php
20615 Hello kind world.
20616 !! end
20617
20618 !! test
20619 preload: check <onlyinclude>
20620 !! options
20621 preload
20622 !! wikitext
20623 Goodbye <onlyinclude>Hello world</onlyinclude>
20624 !! html/php
20625 Hello world
20626 !! end
20627
20628 !! test
20629 preload: can pass tags through if we want to
20630 !! options
20631 preload
20632 !! wikitext
20633 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
20634 !! html/php
20635 <includeonly>Hello world</includeonly>
20636 !! end
20637
20638 !! test
20639 preload: check that it doesn't try to do tricks
20640 !! options
20641 preload
20642 !! wikitext
20643 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20644 !! html/php
20645 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
20646 !! end
20647
20648 !! test
20649 Play a bit with r67090 and bug 3158
20650 !! wikitext
20651 <div style="width:50% !important">&nbsp;</div>
20652 <div style="width:50%&nbsp;!important">&nbsp;</div>
20653 <div style="width:50%&#160;!important">&nbsp;</div>
20654 <div style="border : solid;">&nbsp;</div>
20655 !! html/php
20656 <div style="width:50% !important">&#160;</div>
20657 <div style="width:50% !important">&#160;</div>
20658 <div style="width:50% !important">&#160;</div>
20659 <div style="border&#160;: solid;">&#160;</div>
20660
20661 !! html/parsoid
20662 <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20663 <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>
20664 <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>
20665 <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
20666
20667 !! end
20668
20669 !! test
20670 HTML5 data attributes
20671 !! wikitext
20672 <span data-foo="bar">Baz</span>
20673 <p data-abc-def_hij="">Quuz</p>
20674 !! html/php
20675 <p><span data-foo="bar">Baz</span>
20676 </p>
20677 <p data-abc-def_hij="">Quuz</p>
20678
20679 !! html/parsoid
20680 <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
20681 <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
20682 !! end
20683
20684 !! test
20685 percent-encoding and + signs in internal links (Bug 26410)
20686 !! wikitext
20687 [[User:+%]] [[Page+title%]]
20688 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
20689 [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
20690 [[%33%45]] [[%33%45+]]
20691 !! html/php
20692 <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>
20693 <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>
20694 <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>
20695 <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>
20696 </p>
20697 !! html/parsoid
20698 <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>
20699 <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>
20700 <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>
20701 <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>
20702 !! end
20703
20704 !! test
20705 Special characters in embedded file links (bug 27679)
20706 !! wikitext
20707 [[File:Contains & ampersand.jpg]]
20708 [[File:Does not exist.jpg|Title with & ampersand]]
20709 !! html/php
20710 <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>
20711 <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>
20712 </p>
20713 !! html/parsoid
20714 <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>
20715 <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>
20716 !! end
20717
20718 !! test
20719 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
20720 !! wikitext
20721 Text&apos;s been normalized?
20722 !! html
20723 <p>Text&#39;s been normalized?
20724 </p>
20725 !! end
20726
20727 !! test
20728 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
20729 !! wikitext
20730 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
20731 !! html
20732 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
20733 </p>
20734 !! end
20735
20736 !! test
20737 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
20738 !! wikitext
20739 [http://www.example.org/ ideograms]
20740 !! html
20741 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
20742 </p>
20743 !! end
20744
20745 !! test
20746 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
20747 !! wikitext
20748 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
20749 !! html
20750 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
20751 </p>
20752 !! end
20753
20754 !! article
20755 Mediawiki:loop1
20756 !! text
20757 {{Identical|A}}
20758 !! endarticle
20759
20760 !! article
20761 Mediawiki:loop2
20762 !! text
20763 {{Identical|B}}
20764 !! endarticle
20765
20766 !! article
20767 Template:Identical
20768 !! text
20769 {{int:loop1}}
20770 {{int:loop2}}
20771 !! endarticle
20772
20773 !! test
20774 Bug 31098 Template which includes system messages which includes the template
20775 !! wikitext
20776 {{Identical}}
20777 !! html
20778 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20779 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
20780 </p>
20781 !! end
20782
20783 !! test
20784 Bug31490 Turkish: ucfirst 'blah'
20785 !! options
20786 language=tr
20787 !! wikitext
20788 {{ucfirst:blah}}
20789 !! html
20790 <p>Blah
20791 </p>
20792 !! end
20793
20794 !! test
20795 Bug31490 Turkish: ucfirst 'ix'
20796 !! options
20797 language=tr
20798 !! wikitext
20799 {{ucfirst:ix}}
20800 !! html
20801 <p>İx
20802 </p>
20803 !! end
20804
20805 !! test
20806 Bug31490 Turkish: lcfirst 'BLAH'
20807 !! options
20808 language=tr
20809 !! wikitext
20810 {{lcfirst:BLAH}}
20811 !! html
20812 <p>bLAH
20813 </p>
20814 !! end
20815
20816 !! test
20817 Bug31490 Turkish: ucfırst (with a dotless i)
20818 !! options
20819 language=tr
20820 !! wikitext
20821 {{ucfırst:blah}}
20822 !! html
20823 <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>
20824 </p>
20825 !! end
20826
20827 !! test
20828 Bug31490 ucfırst (with a dotless i) with English language
20829 !! options
20830 language=en
20831 !! wikitext
20832 {{ucfırst:blah}}
20833 !! html
20834 <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>
20835 </p>
20836 !! end
20837
20838 !! test
20839 Bug 26375: TOC with italics
20840 !! options
20841 title=[[Main Page]]
20842 !! wikitext
20843 __TOC__
20844 == ''Lost'' episodes ==
20845 !! html
20846 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20847 <ul>
20848 <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>
20849 </ul>
20850 </div>
20851
20852 <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>
20853
20854 !! end
20855
20856 !! test
20857 Bug 26375: TOC with bold
20858 !! options
20859 title=[[Main Page]]
20860 !! wikitext
20861 __TOC__
20862 == '''should be bold''' then normal text ==
20863 !! html
20864 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20865 <ul>
20866 <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>
20867 </ul>
20868 </div>
20869
20870 <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>
20871
20872 !! end
20873
20874 !! test
20875 Bug 33845: Headings become cursive in TOC when they contain an image
20876 !! options
20877 title=[[Main Page]]
20878 !! wikitext
20879 __TOC__
20880 == Image [[Image:foobar.jpg]] ==
20881 !! html
20882 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20883 <ul>
20884 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
20885 </ul>
20886 </div>
20887
20888 <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>
20889
20890 !! end
20891
20892 !! test
20893 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
20894 !! options
20895 title=[[Main Page]]
20896 !! wikitext
20897 __TOC__
20898 == <blockquote>Quote</blockquote> ==
20899 !! html
20900 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20901 <ul>
20902 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20903 </ul>
20904 </div>
20905
20906 <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>
20907
20908 !! html+tidy
20909 <p></p>
20910 <div id="toc" class="toc">
20911 <div id="toctitle">
20912 <h2>Contents</h2>
20913 </div>
20914 <ul>
20915 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
20916 </ul>
20917 </div>
20918 <p></p>
20919 <h2><span class="mw-headline" id="Quote"></span></h2>
20920 <blockquote>
20921 <p><span class="mw-headline" id="Quote">Quote</span></p>
20922 </blockquote>
20923 <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>
20924 !! end
20925
20926 !! test
20927 Unclosed tags in TOC
20928 !! options
20929 title=[[Main Page]]
20930 !! wikitext
20931 __TOC__
20932 == Proof: 2 < 3 ==
20933 <small>Hanc marginis exiguitas non caperet.</small>
20934 QED
20935 !! html
20936 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20937 <ul>
20938 <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>
20939 </ul>
20940 </div>
20941
20942 <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>
20943 <p><small>Hanc marginis exiguitas non caperet.</small>
20944 QED
20945 </p>
20946 !! end
20947
20948 !! test
20949 Multiple tags in TOC
20950 !! wikitext
20951 __TOC__
20952 == <i>Foo</i> <b>Bar</b> ==
20953
20954 == <i>Foo</i> <blockquote>Bar</blockquote> ==
20955 !! html
20956 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20957 <ul>
20958 <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>
20959 <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>
20960 </ul>
20961 </div>
20962
20963 <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>
20964 <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>
20965
20966 !! html+tidy
20967 <p></p>
20968 <div id="toc" class="toc">
20969 <div id="toctitle">
20970 <h2>Contents</h2>
20971 </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 <p></p>
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></span></h2>
20980 <blockquote>
20981 <p><span class="mw-headline" id="Foo_Bar_2">Bar</span></p>
20982 </blockquote>
20983 <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>
20984 !! end
20985
20986 # Don't expect Parsoid to roundtrip this until the php parser comes closer to
20987 # html5 tag parsing.
20988 !! test
20989 Tags with parameters in TOC
20990 !! options
20991 parsoid=wt2html
20992 !! wikitext
20993 __TOC__
20994 == <sup class="in-h2">Hello</sup> ==
20995
20996 == <sup class="a > b">Evilbye</sup> ==
20997 !! html/php
20998 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
20999 <ul>
21000 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
21001 <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>
21002 </ul>
21003 </div>
21004
21005 <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>
21006 <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>
21007
21008 !! html/parsoid
21009 <meta property="mw:PageProp/toc" />
21010 <h2> <sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup> </h2>
21011
21012 <h2> <sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup> </h2>
21013 !! end
21014
21015 !! test
21016 span tags with directionality in TOC
21017 !! wikitext
21018 __TOC__
21019 == <span dir="ltr">C++</span> ==
21020
21021 == <span dir="rtl">זבנג!</span> ==
21022
21023 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
21024
21025 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
21026
21027 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
21028 !! html
21029 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21030 <ul>
21031 <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>
21032 <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>
21033 <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>
21034 <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>
21035 <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>
21036 </ul>
21037 </div>
21038
21039 <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>
21040 <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>
21041 <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>
21042 <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>
21043 <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>
21044
21045 !! end
21046
21047 !! test
21048 Bug 72884: bdi element in ToC
21049 !! wikitext
21050 __TOC__
21051 == <bdi>test</bdi> ==
21052 !! html
21053 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21054 <ul>
21055 <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
21056 </ul>
21057 </div>
21058
21059 <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>
21060
21061 !! end
21062
21063 # Note that the html output does not have the <p></p>, but the
21064 # html+tidy output *does*. This is because the empty <p></p> is
21065 # removed by the sanitizer, but only when tidy is *not* enabled (!).
21066 !! test
21067 Empty <p> tag in TOC, removed by Sanitizer (T92892)
21068 !! wikitext
21069 __TOC__
21070 == x ==
21071 !! html
21072 <div id="toc" class="toc"><div id="toctitle"><h2>Contents</h2></div>
21073 <ul>
21074 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21075 </ul>
21076 </div>
21077
21078 <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>
21079
21080 !! html+tidy
21081 <p></p>
21082 <div id="toc" class="toc">
21083 <div id="toctitle">
21084 <h2>Contents</h2>
21085 </div>
21086 <ul>
21087 <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
21088 </ul>
21089 </div>
21090 <p></p>
21091 <h2><span class="mw-headline" id="x">x</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: x">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
21092 !! end
21093
21094 !! article
21095 MediaWiki:Bug32057
21096 !! text
21097 == {{int:headline_sample}} ==
21098 !! endarticle
21099
21100 !! test
21101 Bug 32057: Title needed when expanding <h> nodes.
21102 !! options
21103 title=[[Main Page]]
21104 !! wikitext
21105 {{int:Bug32057}}
21106 !! html
21107 <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>
21108
21109 !! end
21110
21111 !! test
21112 Strip marker in urlencode
21113 !! wikitext
21114 {{urlencode:x<nowiki/>y}}
21115 {{urlencode:x<nowiki/>y|wiki}}
21116 {{urlencode:x<nowiki/>y|path}}
21117 {{urlencode:x<pre id="one">two</pre>y}}
21118 !! html
21119 <p>xy
21120 xy
21121 xy
21122 xy
21123 </p>
21124 !! end
21125
21126 !! test
21127 Strip marker in lc
21128 !! wikitext
21129 {{lc:x<nowiki/>y}}
21130 !! html
21131 <p>xy
21132 </p>
21133 !! end
21134
21135 !! test
21136 Strip marker in uc
21137 !! wikitext
21138 {{uc:x<nowiki/>y}}
21139 !! html
21140 <p>XY
21141 </p>
21142 !! end
21143
21144 !! test
21145 Strip marker in formatNum
21146 !! wikitext
21147 {{formatnum:1<nowiki/>2}}
21148 {{formatnum:1<nowiki/>2|R}}
21149 !! html
21150 <p>12
21151 12
21152 </p>
21153 !! end
21154
21155 !! test
21156 Check noCommafy in formatNum
21157 !! options
21158 language=be-tarask
21159 !! wikitext
21160 {{formatnum:123456.78}}
21161 {{formatnum:123456.78|NOSEP}}
21162 !! html
21163 <p>123 456,78
21164 123456.78
21165 </p>
21166 !! end
21167
21168 !! test
21169 Wrong option for formatNum (bug 56199)
21170 !! wikitext
21171 {{formatnum:1,234.56|Random}}
21172 {{formatnum:1,234.56|EVERYTHING}}
21173 {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
21174 !! html
21175 <p>1,234.56
21176 1,234.56
21177 1,234.56
21178 </p>
21179 !! end
21180
21181 !! test
21182 Strip marker in grammar
21183 !! options
21184 language=fi
21185 !! wikitext
21186 {{grammar:elative|foo<nowiki/>bar}}
21187 !! html
21188 <p>foobarista
21189 </p>
21190 !! end
21191
21192 !! test
21193 Strip marker in padleft
21194 !! wikitext
21195 {{padleft:|2|x<nowiki/>y}}
21196 !! html
21197 <p>xy
21198 </p>
21199 !! end
21200
21201 !! test
21202 Strip marker in padright
21203 !! wikitext
21204 {{padright:|2|x<nowiki/>y}}
21205 !! html
21206 <p>xy
21207 </p>
21208 !! end
21209
21210 !! test
21211 Strip marker in anchorencode
21212 !! wikitext
21213 {{anchorencode:x<nowiki/>y}}
21214 !! html
21215 <p>xy
21216 </p>
21217 !! end
21218
21219 !! test
21220 nowiki inside link inside heading (bug 18295)
21221 !! wikitext
21222 ==[[foo|x<nowiki>y</nowiki>z]]==
21223 !! html
21224 <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>
21225
21226 !! end
21227
21228 !! test
21229 new support for bdi element (bug 31817)
21230 !! wikitext
21231 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21232 !! html
21233 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
21234
21235 !!end
21236
21237 !! test
21238 Ignore pipe between table row attributes
21239 !! wikitext
21240 {|
21241 | quux
21242 |- id=foo | style='color: red'
21243 | bar
21244 |}
21245 !! html
21246 <table>
21247 <tr>
21248 <td> quux
21249 </td></tr>
21250 <tr id="foo" style="color: red">
21251 <td> bar
21252 </td></tr></table>
21253
21254 !! end
21255
21256 !!test
21257 Gallery override link with WikiLink (bug 34852)
21258 !! wikitext
21259 <gallery>
21260 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
21261 </gallery>
21262 !! html
21263 <ul class="gallery mw-gallery-traditional">
21264 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21265 <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>
21266 <div class="gallerytext">
21267 <p>caption
21268 </p>
21269 </div>
21270 </div></li>
21271 </ul>
21272
21273 !! end
21274
21275 !!test
21276 Gallery override link with absolute external link (bug 34852)
21277 !! wikitext
21278 <gallery>
21279 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
21280 </gallery>
21281 !! html
21282 <ul class="gallery mw-gallery-traditional">
21283 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21284 <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>
21285 <div class="gallerytext">
21286 <p>caption
21287 </p>
21288 </div>
21289 </div></li>
21290 </ul>
21291
21292 !! end
21293
21294 !!test
21295 Gallery override link with malicious javascript (bug 34852)
21296 !! wikitext
21297 <gallery>
21298 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
21299 </gallery>
21300 !! html
21301 <ul class="gallery mw-gallery-traditional">
21302 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21303 <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>
21304 <div class="gallerytext">
21305 <p>caption
21306 </p>
21307 </div>
21308 </div></li>
21309 </ul>
21310
21311 !! end
21312
21313 !!test
21314 Gallery with invalid title as link (bug 43964)
21315 !! wikitext
21316 <gallery>
21317 File:foobar.jpg|link=<
21318 </gallery>
21319 !! html
21320 <ul class="gallery mw-gallery-traditional">
21321 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
21322 <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>
21323 <div class="gallerytext">
21324 </div>
21325 </div></li>
21326 </ul>
21327
21328 !! end
21329
21330 !!test
21331 Language parser function
21332 !! wikitext
21333 {{#language:ar}}
21334 !! html
21335 <p>العربية
21336 </p>
21337 !! end
21338
21339 !!test
21340 Padleft and padright as substr
21341 !! wikitext
21342 {{padleft:|3|abcde}}
21343 {{padright:|3|abcde}}
21344 !! html
21345 <p>abc
21346 abc
21347 </p>
21348 !! end
21349
21350 !!test
21351 Special parser function
21352 !! wikitext
21353 {{#special:RandomPage}}
21354 {{#special:BaDtItLe}}
21355 {{#special:Foobar}}
21356 !! html
21357 <p>Special:Random
21358 Special:Badtitle
21359 Special:Foobar
21360 </p>
21361 !! end
21362
21363 !!test
21364 Bug 34939 - Case insensitive link parsing ([HttP://])
21365 !! wikitext
21366 [HttP://MediaWiki.Org/]
21367 !! html/php
21368 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
21369 </p>
21370 !! html/parsoid
21371 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/"></a></p>
21372 !! end
21373
21374 !!test
21375 Bug 34939 - Case insensitive link parsing ([HttP:// title])
21376 !! wikitext
21377 [HttP://MediaWiki.Org/ MediaWiki]
21378 !! html
21379 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
21380 </p>
21381 !! end
21382
21383 !!test
21384 Bug 34939 - Case insensitive link parsing (HttP://)
21385 !! wikitext
21386 HttP://MediaWiki.Org/
21387 !! html/php
21388 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
21389 </p>
21390 !! html/parsoid
21391 <p><a rel="mw:ExtLink" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
21392 !! end
21393
21394 !!test
21395 Disable TOC
21396 !! options
21397 notoc
21398 !! wikitext
21399 Lead
21400 == Section 1 ==
21401 == Section 2 ==
21402 == Section 3 ==
21403 == Section 4 ==
21404 == Section 5 ==
21405 !! html
21406 <p>Lead
21407 </p>
21408
21409 <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>
21410 <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>
21411 <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>
21412 <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>
21413 <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>
21414
21415 !! end
21416
21417
21418 ###
21419 ### Parsoid-specific tests
21420 ### Parsoid-PHP parser incompatibilities
21421 ###
21422 !!test
21423 1. SOL-sensitive wikitext tokens as template-args
21424 !!options
21425 parsoid=wt2html,wt2wt
21426 !! wikitext
21427 {{echo|*a}}
21428 {{echo|#a}}
21429 {{echo|:a}}
21430 !! html
21431 <span about="#mwt1" typeof="mw:Transclusion">
21432 </span><ul about="#mwt1"><li>a</li>
21433 </ul>
21434 <span about="#mwt2" typeof="mw:Transclusion">
21435 </span><ol about="#mwt2"><li>a</li>
21436 </ol>
21437 <span about="#mwt3" typeof="mw:Transclusion">
21438 </span><dl about="#mwt3"><dd>a</dd>
21439 </dl>
21440 !!end
21441
21442 #### -----------------------------------------------------------------
21443 #### Parsoid-specific functionality tests
21444 #### -----------------------------------------------------------------
21445
21446 # Bug 63642/66749: Formatting elt fixup around images is cleaned up.
21447 # We know wt2wt will fail, but we expect selser to pass.
21448 # Due to the nature of our testing, wt2wt and selser tests will enter the
21449 # blacklist and we'll catch selser regressions based on changes to the
21450 # blacklist entries for selser tests.
21451 !! test
21452 1. Bad treebuilder fixup of formatting elt is cleaned up
21453 !! options
21454 parsoid=wt2html,wt2wt
21455 !! wikitext
21456 {|
21457 |
21458 <small>
21459 [[Image:Foobar.jpg|right|Test]]
21460 </small>
21461 |}
21462 !! html/parsoid
21463 <table>
21464 <tbody><tr><td>
21465 <small>
21466 <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>
21467 </small>
21468 </td></tr>
21469 </tbody></table>
21470 !! end
21471
21472 !! test
21473 2. Bad treebuilder fixup of formatting elt is cleaned up
21474 !! options
21475 parsoid=wt2html,wt2wt
21476 !! wikitext
21477 '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
21478
21479 <small>[[Image:Foobar.jpg|right|300px]]</small>
21480 !! html/parsoid
21481
21482 <p><b>foo</b></p>
21483 <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>
21484 <p><b>bar</b></p>
21485 <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>
21486 !! end
21487
21488 !! test
21489 3. Bad treebuilder fixup of formatting elt is cleaned up
21490 !! options
21491 parsoid=wt2html,wt2wt
21492 !! wikitext
21493 <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
21494 !! html/parsoid
21495 <p><small><b>foo</b></small></p>
21496 <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><small><b>caption</b></small></figcaption></figure>
21497 <p><small><b>bar</b></small></p>
21498 !! end
21499
21500 !! test
21501 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
21502 !! options
21503 parsoid=wt2html,wt2wt
21504 !! wikitext
21505 '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
21506 !! html/parsoid
21507 <p><b><small></small></b></p>
21508 <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>
21509 <p></p>
21510 !! end
21511
21512 #### ----------------------------------------------------------------
21513 #### Parsoid-only testing of Parsoid's impl of <ref> and <references>
21514 #### tags. Parsoid's output for these tags differs from that of the
21515 #### PHP parser.
21516 #### ----------------------------------------------------------------
21517
21518 !!test
21519 Ref: 1. ref-location should be replaced with an index span
21520 !! wikitext
21521 A <ref>foo</ref>
21522 B <ref name="x">foo</ref>
21523 C <ref name="y" />
21524 <references />
21525 !! html/parsoid
21526 <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>
21527 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>
21528 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>
21529 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21530 <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>
21531 <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>
21532 <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>
21533 </ol>
21534 !!end
21535
21536 !!test
21537 Ref: 2. ref-tags with identical names should all get the same index
21538 !! wikitext
21539 A <ref name="x">foo</ref>
21540 B <ref name="x" />
21541 <references />
21542 !! html/parsoid
21543 <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>
21544 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>
21545 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21546 <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>
21547 </ol>
21548 !!end
21549
21550 !!test
21551 Ref: 3. spaces in ref-names should be ignored
21552 !! wikitext
21553 A <ref name="x">foo</ref>
21554 B <ref name=" x " />
21555 C <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>
21560 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>
21561 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21562 <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>
21563 </ol>
21564 !!end
21565
21566 # NOTE: constructor is a predefined property in JS and constructor as a ref-name can clash with it if not handled properly)
21567 !!test
21568 Ref: 4. 'constructor' should be accepted as a valid ref-name
21569 !! wikitext
21570 A <ref name="constructor">foo</ref>
21571 <references />
21572 !! html/parsoid
21573 <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>
21574 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21575 <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>
21576 </ol>
21577 !!end
21578
21579 !!test
21580 Ref: 5. body should accept generic wikitext
21581 !! wikitext
21582 A <ref>
21583 This is a '''[[bolded link]]''' and this is a {{echo|transclusion}}
21584 </ref>
21585
21586 <references />
21587 !! html/parsoid
21588 <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>
21589
21590 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21591 <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>
21592 </span></li>
21593 </ol>
21594 !!end
21595
21596 !!test
21597 Ref: 6. indent-pres should not be output in ref-body
21598 !! wikitext
21599 A <ref>
21600 foo
21601 bar
21602 baz
21603 </ref>
21604
21605 <references />
21606 !! html/parsoid
21607 <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>
21608
21609 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21610 <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
21611 bar
21612 baz
21613 </span></li>
21614 </ol>
21615 !!end
21616
21617 !!test
21618 Ref: 7. No p-wrapping in ref-body
21619 !! wikitext
21620 A <ref>
21621 foo
21622
21623 bar
21624
21625
21626 baz
21627
21628
21629
21630 booz
21631 </ref>
21632
21633 <references />
21634 !! html/parsoid
21635 <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>
21636
21637 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21638 <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
21639
21640 bar
21641
21642
21643 baz
21644
21645
21646
21647 booz
21648 </span></li>
21649 </ol>
21650 !!end
21651
21652 !!test
21653 Ref: 8. transclusion wikitext has lower precedence
21654 !! wikitext
21655 A <ref> foo {{echo|</ref> B C}}
21656
21657 <references />
21658 !! html/parsoid
21659 <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>
21660 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21661 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo {{echo|</span></li>
21662 </ol>
21663 !!end
21664
21665 !!test
21666 Ref: 9. unclosed comments should not leak out of ref-body
21667 !! wikitext
21668 A <ref> foo <!--</ref> B C
21669 <references />
21670 !! html/parsoid
21671 <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>
21672 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21673 <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>
21674 </ol>
21675 !!end
21676
21677 !!test
21678 Ref: 10. Unclosed HTML tags should not leak out of ref-body
21679 !! wikitext
21680 A <ref> <b> foo </ref> B C
21681
21682 <references />
21683 !! html/parsoid
21684 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> B C</p>
21685
21686
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"><b data-parsoid='{"stx":"html","autoInsertedEnd":true}'> foo </b></span></li>
21689 </ol>
21690 !!end
21691
21692 !!test
21693 Ref: 11. ref-tags acts like an inline element wrt P-wrapping
21694 !! wikitext
21695 A <ref>foo</ref> B
21696 C <ref>bar</ref> D
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
21700 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>
21701 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21702 <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>
21703 <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>
21704 </ol>
21705 !!end
21706
21707 !!test
21708 Ref: 12. ref-tags act as trailing newline migration barrier
21709 !! wikitext
21710 <!--the newline at the end of this line moves out of the p tag-->a
21711
21712 b<!--the newline at the end of this line stays inside the p tag--> <ref />
21713 <ref />
21714
21715 c
21716 <references />
21717 !! html/parsoid
21718 <!--the newline at the end of this line moves out of the p tag--><p>a</p>
21719
21720
21721 <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>
21722 <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>
21723
21724 <p>c</p>
21725 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21726 <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>
21727 <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>
21728 !!end
21729
21730 !!test
21731 Ref: 13. ref-tags are not SOL-transparent and block indent-pres
21732 !! wikitext
21733 <ref>foo</ref> A
21734 <ref>bar
21735 </ref> B
21736 <references />
21737 !! html/parsoid
21738 <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
21739 <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>
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">foo</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">bar
21743 </span></li>
21744 </ol>
21745 !!end
21746
21747 !!test
21748 Ref: 14. A nested ref-tag should be emitted as plain text
21749 !! wikitext
21750 <ref>foo <ref>bar</ref> baz</ref>
21751
21752 <references />
21753 !! html/parsoid
21754 <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>
21755 </p>
21756 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
21757 <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>
21758 </ol>
21759 !!end
21760
21761 !!test
21762 Ref: 15. ref-tags with identical names should get identical indexes
21763 !! wikitext
21764 A1 <ref name="a">foo</ref> A2 <ref name="a" />
21765 B1 <ref name="b" /> B2 <ref name="b">bar</ref>
21766
21767 <references />
21768 !! html/parsoid
21769 <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>
21770 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>
21771
21772 <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>
21773 </ol>
21774 !!end
21775
21776 ## We don't bother wt2wt-ing non-standard whitespace
21777 !!test
21778 Ref: 16. Tokenizer should accept non-standard whitespace in <ref> and </ref> tags
21779 !!options
21780 parsoid=wt2html
21781 !! wikitext
21782 A <ref >foo</ref >
21783
21784 <references />
21785 !! html/parsoid
21786 <p>A <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
21787 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21788 <li about="#cite_note-1" id="cite_note-1"><a href="#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
21789 !!end
21790
21791 !!test
21792 Ref: 17. Generate valid HTML5 id/about attributes
21793 !!wikitext
21794 <ref name="a b">foo</ref>
21795
21796 <references />
21797 !!html/parsoid
21798 <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>
21799 </p>
21800
21801 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21802 <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>
21803 </ol>
21804 !!end
21805
21806 !!test
21807 Ref: 18. T58916: Extension attributes should be parsed as plain text
21808 !!wikitext
21809 <ref name="{{echo|a}}">foo</ref>
21810
21811 <references />
21812 !!html/parsoid
21813 <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>
21814 </p>
21815
21816 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
21817 <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>
21818 </ol>
21819 !!end
21820
21821 !!test
21822 Ref: 19. ref-tags with identical name encodings should get identical indexes
21823 !! wikitext
21824 1 <ref name="a & b">foo</ref> 2 <ref name="a &amp; b" />
21825
21826 <references />
21827 !! html/parsoid
21828 <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>
21829 </p>
21830 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21831 <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>
21832 </ol>
21833 !!end
21834
21835 !!test
21836 Ref: 20. ref-tags with identical names but different content should keep it
21837 !! wikitext
21838 A <ref name="foo">Foo one</ref>
21839 B <ref name="foo">Foo two</ref>
21840 C <ref name="foo" />
21841
21842 <references />
21843 !! html/parsoid
21844 <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>
21845 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>
21846 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>
21847
21848 <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>
21849 </ol>
21850 !!end
21851
21852 !!test
21853 References: 1. references tag without any refs should be handled properly
21854 !! wikitext
21855 <references />
21856 !! html/parsoid
21857 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
21858 !!end
21859
21860 !!test
21861 References: 2. references tag with group only outputs references from that group
21862 !! wikitext
21863 A <ref group="a">foo</ref>
21864 B <ref group="b">bar</ref>
21865 C <ref>baz</ref>
21866
21867 <references group="a" />
21868 <references />
21869 <references group="b" />
21870 !! html/parsoid
21871 <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>
21872 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>
21873 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>
21874
21875 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw-group="a" data-mw='{"name":"references","attrs":{"group":"a"}}'>
21876 <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>
21877 </ol>
21878 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt10" data-mw='{"name":"references","attrs":{}}'>
21879 <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>
21880 </ol>
21881 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt12" data-mw-group="b" data-mw='{"name":"references","attrs":{"group":"b"}}'>
21882 <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>
21883 </ol>
21884 !!end
21885
21886 !!test
21887 References: 3. ref list should be cleared after processing references
21888 !! wikitext
21889 A <ref>foo</ref>
21890
21891 <references />
21892
21893 B <ref>bar</ref>
21894
21895 <references />
21896 !! html/parsoid
21897 <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>
21898
21899 <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>
21900 </ol>
21901
21902 <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>
21903
21904 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt8" data-mw='{"name":"references","attrs":{}}'>
21905 <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>
21906 </ol>
21907 !!end
21908
21909 !!test
21910 References: 4. only referenced group should be cleared after processing references
21911 !! wikitext
21912 A <ref group="a">afoo</ref>
21913 B <ref>bfoo</ref>
21914
21915 <references group="a" />
21916
21917 C <ref>cfoo</ref>
21918
21919 <references />
21920 !! html/parsoid
21921 <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>
21922 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>
21923
21924 <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>
21925 </ol>
21926
21927 <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>
21928
21929 <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>
21930 </ol>
21931 !!end
21932
21933 !!test
21934 References: 5. ref tags in references should be processed while ignoring all other content
21935 !! wikitext
21936 A <ref name="a" />
21937 B <ref name="b">bar</ref>
21938
21939 <references>
21940 <ref name="a">foo</ref>
21941 This should just get lost.
21942 </references>
21943 !! html/parsoid
21944 <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>
21945 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>
21946
21947
21948 <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>
21949 </ol>
21950 !!end
21951
21952 !!test
21953 References: 6. <references /> from a transclusion
21954 !! wikitext
21955 <ref>Foo</ref> {{echo|<references />}}
21956 !! html/parsoid
21957 <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>
21958 </ol>
21959 !!end
21960
21961 !! test
21962 References: 7. Multiple references tags (one without and one with nested refs) should be correctly handled
21963 !! wikitext
21964 A <ref>foo bar for a</ref>
21965 B <ref group="X" name="b" />
21966
21967 <references />
21968
21969 <references group="X">
21970 <ref name="b">foo</ref>
21971 </references>
21972 !! html/parsoid
21973 <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>
21974 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>
21975 </p>
21976
21977 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'>
21978 <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>
21979 </ol>
21980
21981 <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"}}'>
21982 <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>
21983 </ol>
21984 !! end
21985
21986 !! test
21987 References: 8. T88019: Remove <meta>s from templates inside <ref> that's itself inside a template
21988 !! wikitext
21989 X{{echo|<ref>foo {{echo|<b>bar</b>}} and {{echo|baz}} boo</ref>}}
21990 <references />
21991 !! html/parsoid
21992 <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>
21993 <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>
21994 </ol>
21995 !!end
21996
21997 # This test only works in wt2html now as the <references /> are always generated
21998 # unless selser is active. Once T72722 is fixed, we should add a changes test
21999 # here to ensure that unrelated changes don't add the new <references /> in
22000 # wt2wt.
22001 !! test
22002 References: 9. Generate missing references list at the end
22003 !! wikitext
22004 A <ref>foo</ref>
22005 B <ref group="inexistent">bar</ref>
22006 !! html/parsoid
22007 <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>
22008 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
22009 <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>
22010 </ol>
22011 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt6" data-mw-group="inexistent" data-mw='{"name":"references","attrs":{"group":"inexistent"}}'>
22012 <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>
22013 </ol>
22014 !! end
22015
22016 !! test
22017 References: 10. New <references/> shouldn't be added for unrelated edits.
22018 !! options
22019 parsoid={
22020 "modes": ["selser"],
22021 "changes": [["#x", "remove"]],
22022 "selser": "noauto"
22023 }
22024 !! wikitext
22025 Unrelated text<span id="x"> that's going to disappear</span>.
22026 A <ref>foo</ref>
22027 !! wikitext/edited
22028 Unrelated text.
22029 A <ref>foo</ref>
22030 !!end
22031
22032 !! test
22033 Entities in ref name
22034 !! wikitext
22035 <ref name="test &amp; me">hi</ref>
22036 <references />
22037 !! html/parsoid
22038 <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>
22039 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22040 <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>
22041 </ol>
22042 !! end
22043
22044 # This test is wt2html only because we're permitting the serializer to produce
22045 # dirty diffs, normalizing the unclosed references to the self-closed version.
22046 !! test
22047 Generate references for unclosed references tag
22048 !! options
22049 parsoid=wt2html
22050 !! wikitext
22051 a<ref>foo</ref>
22052
22053 <references>
22054 !! html/parsoid
22055 <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>
22056 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
22057 <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>
22058 !! end
22059
22060 !! test
22061 New reference serializes on its own line
22062 !! options
22063 parsoid=wt2wt,html2wt
22064 !! wikitext
22065 foo
22066 <references />
22067 !! html/parsoid
22068 foo<ol class="mw-references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol>
22069 !! end
22070
22071 #### ----------------------------------------------------------------
22072 #### Parsoid-only testing of Parsoid's impl of LST
22073 #### Not implemented yet, see
22074 #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
22075 #### ----------------------------------------------------------------
22076
22077 !! test
22078 LST Sections: 1. Simple section start and end
22079 !! options
22080 parsoid={ "suppressErrors": true }
22081 !! wikitext
22082 <section begin="2011-05-16" />
22083 <section end="2014-04-10 (MW 1.23wmf22)" />
22084 !! html/parsoid
22085 <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
22086 <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
22087 !! end
22088
22089 #--------- Test stripping of empty nodes in template content ----------
22090 !!test
22091 Empty LI and TR nodes should be stripped from template content
22092 !!wikitext
22093 {{EmptyLITest}}
22094 {{EmptyTRTest}}
22095 !!html/parsoid
22096 <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
22097 <li>a</li>
22098 <li>b</li>
22099 </ul>
22100 <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
22101 <tbody>
22102 <tr>
22103 <td>foo</td>
22104 </tr>
22105 <tr>
22106 <td>bar</td>
22107 </tr>
22108 </tbody>
22109 </table>
22110 !!end
22111
22112 !!test
22113 Empty LI and TR nodes should not be stripped from top-level content
22114 !!wikitext
22115 * a
22116 *
22117 * b
22118 {|
22119 |-
22120 |-
22121 |foo
22122 |}
22123 !!html/parsoid
22124 <ul>
22125 <li> a</li>
22126 <li></li>
22127 <li> b</li>
22128 </ul>
22129 <table>
22130 <tbody>
22131 <tr></tr>
22132 <tr>
22133 <td>foo</td>
22134 </tr>
22135 </tbody>
22136 </table>
22137 !!end
22138
22139 !!test
22140 Empty TR nodes should not be stripped if they have any attributes set
22141 !!wikitext
22142 {{EmptyTRWithHTMLAttrTest}}
22143 !!html/parsoid
22144 <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
22145 <tr align="center"></tr>
22146 <tr><td>foo</td></tr>
22147 <tr align="center"></tr>
22148 <tr><td>bar</td></tr>
22149 </table>
22150 !!end
22151
22152 #### ----------------------------------------------------------------
22153 #### The following section of tests are primarily to test
22154 #### wikitext escaping capabilities of Parsoid. Given that
22155 #### escaping can be done any number of ways, the wikitext (input)
22156 #### is always adjusted to reflect how Parsoid adds nowiki
22157 #### escape tags.
22158 ####
22159 #### We are marking several tests as parsoid-only since the
22160 #### HTML in the result section is different from what the
22161 #### PHP parser generates for it.
22162 #### ----------------------------------------------------------------
22163
22164
22165 #### --------------- Headings ---------------
22166 #### 0. Unnested
22167 #### 1. Nested inside html <h1>=foo=</h1>
22168 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
22169 #### 3. Nested inside html with wikitext split by html tags
22170 #### 4. No escape needed
22171 #### 5. Empty headings <h1></h1>
22172 #### 6. Heading chars in SOL context
22173 #### ----------------------------------------
22174 !! test
22175 Headings: 0. Unnested
22176 !! options
22177 parsoid=html2wt
22178 !! html/parsoid
22179 <p>=foo=</p>
22180
22181 <p> =foo=
22182 <!--cmt-->
22183 =foo=</p>
22184
22185 <p>=foo<i>a</i>=</p>
22186 !! wikitext
22187 <nowiki>=foo=</nowiki>
22188
22189 <nowiki> </nowiki>=foo=
22190 <!--cmt-->
22191 <nowiki>=foo=</nowiki>
22192
22193 =foo''a''<nowiki>=</nowiki>
22194 !!end
22195
22196 # New headings and existing headings are handled differently
22197 !! test
22198 Headings: 1. Nested inside html
22199 !! options
22200 parsoid=html2wt
22201 !! html/parsoid
22202 <h1>=foo=</h1>
22203 <h2>=foo=</h2>
22204 <h3>=foo=</h3>
22205
22206 <h1 data-parsoid=''>=foo=</h1>
22207 <h2 data-parsoid=''>=foo=</h2>
22208 <h3 data-parsoid=''>=foo=</h3>
22209 <h4 data-parsoid=''>=foo=</h4>
22210 <h5 data-parsoid=''>=foo=</h5>
22211 <h6 data-parsoid=''>=foo=</h6>
22212 !! wikitext
22213 = =foo= =
22214
22215 == =foo= ==
22216
22217 === =foo= ===
22218
22219 =<nowiki>=foo=</nowiki>=
22220 ==<nowiki>=foo=</nowiki>==
22221 ===<nowiki>=foo=</nowiki>===
22222 ====<nowiki>=foo=</nowiki>====
22223 =====<nowiki>=foo=</nowiki>=====
22224 ======<nowiki>=foo=</nowiki>======
22225
22226 !!end
22227
22228 !! test
22229 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
22230 !! options
22231 parsoid=html2wt
22232 !! html/parsoid
22233 <h1>foo</h1>*bar
22234 <h1>foo</h1>=bar
22235 <h1>foo</h1>=bar=
22236 !! wikitext
22237 = foo =
22238 <nowiki>*</nowiki>bar
22239
22240 = foo =
22241 =bar
22242
22243 = foo =
22244 <nowiki>=bar=</nowiki>
22245 !!end
22246
22247 !! test
22248 Headings: 3. Nested inside html with wikitext split by html tags
22249 !! options
22250 parsoid=html2wt
22251 !! html/parsoid
22252 <h1>=<b>bold</b>foo=</h1>
22253 !! wikitext
22254 = ='''bold'''<nowiki>foo=</nowiki> =
22255 !!end
22256
22257 !! test
22258 Headings: 4a. No escaping needed (testing just h1 and h2)
22259 !! options
22260 parsoid=html2wt
22261 !! html/parsoid
22262 <h1>=foo</h1>
22263 <h1>foo=</h1>
22264 <h1> =foo= </h1>
22265 <h1>=foo= bar</h1>
22266 <h2>=foo</h2>
22267 <h2>foo=</h2>
22268 <h1>=</h1>
22269 <h1><i>=</i>foo=</h1>
22270 !! wikitext
22271 = =foo =
22272
22273 = foo= =
22274
22275 = =foo= =
22276
22277 = =foo= bar =
22278
22279 == =foo ==
22280
22281 == foo= ==
22282
22283 = = =
22284
22285 = ''=''foo= =
22286 !!end
22287
22288 !! test
22289 Headings: 4b. No escaping needed (inside p-tags)
22290 !! options
22291 parsoid=html2wt
22292 !! html/parsoid
22293 <p>===
22294 =foo= x
22295 =foo= <s></s>
22296 </p>
22297 !! wikitext
22298 ===
22299 =foo= x
22300 =foo= <s></s>
22301 !!end
22302
22303 !! test
22304 Headings: 5. Empty headings
22305 !! options
22306 parsoid=html2wt
22307 !! html/parsoid
22308 <h1 data-parsoid='{}'></h1>
22309
22310 <h2 data-parsoid='{}'></h2>
22311
22312 <h3 data-parsoid='{}'></h3>
22313
22314 <h4 data-parsoid='{}'></h4>
22315
22316 <h5 data-parsoid='{}'></h5>
22317
22318 <h6 data-parsoid='{}'></h6>
22319 !! wikitext
22320 =<nowiki/>=
22321
22322 ==<nowiki/>==
22323
22324 ===<nowiki/>===
22325
22326 ====<nowiki/>====
22327
22328 =====<nowiki/>=====
22329
22330 ======<nowiki/>======
22331 !!end
22332
22333 !! test
22334 Headings: 6a. Heading chars in SOL context (with trailing spaces)
22335 !! options
22336 parsoid=html2wt
22337 !! html/parsoid
22338 <p>=a=</p>
22339
22340 <p>=a=</p>
22341
22342 <p>=a=</p>
22343 !! wikitext
22344 <nowiki>=a=</nowiki>
22345
22346 <nowiki>=a=</nowiki>
22347
22348 <nowiki>=a=</nowiki>
22349 !!end
22350
22351 !! test
22352 Headings: 6b. Heading chars in SOL context (with trailing newlines)
22353 !! options
22354 parsoid=html2wt
22355 !! html/parsoid
22356 <p>=a=
22357 b</p>
22358
22359 <p>=a=
22360 b</p>
22361
22362 <p>=a=
22363 b</p>
22364 !! wikitext
22365 <nowiki>=a=</nowiki>
22366 b
22367
22368 <nowiki>=a=</nowiki>
22369 b
22370
22371 <nowiki>=a=</nowiki>
22372 b
22373 !!end
22374
22375 !! test
22376 Headings: 6c. Heading chars in SOL context (leading newline break)
22377 !! options
22378 parsoid=html2wt
22379 !! html/parsoid
22380 <p>a
22381 =b=</p>
22382 !! wikitext
22383 a
22384 <nowiki>=b=</nowiki>
22385 !!end
22386
22387 !! test
22388 Headings: 6d. Heading chars in SOL context (with interspersed comments)
22389 !! options
22390 parsoid=html2wt
22391 !! html/parsoid
22392 <!--c0--><p>=a=</p>
22393
22394 <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
22395 !! wikitext
22396 <!--c0--><nowiki>=a=</nowiki>
22397
22398 <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
22399 !!end
22400
22401 !! test
22402 Headings: 6d. Heading chars in SOL context (No escaping needed)
22403 !! options
22404 parsoid=html2wt
22405 !! html/parsoid
22406 =a=<div>b</div>
22407 !! wikitext
22408 =a=<div>b</div>
22409 !!end
22410
22411 !! test
22412 Headings: 7. Insert a newline between new content and headings
22413 !! options
22414 parsoid=html2wt
22415 !! html/parsoid
22416 <h2>NEW</h2>
22417 <p>new</p>
22418 <h2 data-parsoid='{}'>A</h2>
22419 <p data-parsoid='{}'>a</p>
22420 !! wikitext
22421 == NEW ==
22422 new
22423
22424 ==A==
22425 a
22426
22427 !! end
22428
22429 #### --------------- Lists ---------------
22430 #### 0. Outside nests (*foo, etc.)
22431 #### 1. Nested inside html <ul><li>*foo</li></ul>
22432 #### 2. Inside definition lists
22433 #### 3. Only bullets at start should be escaped
22434 #### 4. No escapes needed
22435 #### 5. No unnecessary escapes
22436 #### 6. Escape bullets in SOL position
22437 #### 7. Escape bullets in a multi-line context
22438 #### ----------------------------------------
22439
22440 !! test
22441 Lists: 0. Outside nests
22442 !! options
22443 parsoid=html2wt
22444 !! html/parsoid
22445 <p>*foo</p>
22446
22447 <p>#foo</p>
22448
22449 <p>;Foo:bar</p>
22450 !! wikitext
22451 <nowiki>*</nowiki>foo
22452
22453 <nowiki>#</nowiki>foo
22454
22455 <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
22456 !!end
22457
22458 !! test
22459 Lists: 1. Nested inside html
22460 !! options
22461 parsoid=html2wt
22462 !! html/parsoid
22463 <ul><li>*foo</li></ul>
22464 <ul><li>#foo</li></ul>
22465 <ul><li>:foo</li></ul>
22466 <ul><li>;foo</li></ul>
22467 <ol><li>*foo</li></ol>
22468 <ol><li>#foo</li></ol>
22469 <ol><li>:foo</li></ol>
22470 <ol><li>;foo</li></ol>
22471
22472 !! wikitext
22473 *<nowiki>*foo</nowiki>
22474
22475 *<nowiki>#foo</nowiki>
22476
22477 *<nowiki>:foo</nowiki>
22478
22479 *<nowiki>;foo</nowiki>
22480
22481 #<nowiki>*foo</nowiki>
22482
22483 #<nowiki>#foo</nowiki>
22484
22485 #<nowiki>:foo</nowiki>
22486
22487 #<nowiki>;foo</nowiki>
22488 !!end
22489
22490 !! test
22491 Lists: 2. Inside definition lists
22492 !! options
22493 parsoid=html2wt
22494 !! html/parsoid
22495 <dl><dt>;foo</dt></dl>
22496 <dl><dt>:foo</dt></dl>
22497 <dl><dt>:foo</dt>
22498 <dd>bar</dd></dl>
22499 <dl><dd>:foo</dd></dl>
22500
22501 !! wikitext
22502 ;<nowiki>;foo</nowiki>
22503
22504 ;<nowiki>:foo</nowiki>
22505
22506 ;<nowiki>:foo</nowiki>
22507 :bar
22508
22509 :<nowiki>:foo</nowiki>
22510 !!end
22511
22512 !! test
22513 Lists: 3. Only bullets at start of text should be escaped
22514 !! options
22515 parsoid=html2wt
22516 !! html/parsoid
22517 <ul><li>*foo*bar</li></ul>
22518 <ul><li>*foo<i>it</i>*bar</li></ul>
22519
22520 !! wikitext
22521 *<nowiki>*foo*bar</nowiki>
22522
22523 *<nowiki>*foo</nowiki>''it''*bar
22524 !!end
22525
22526 !! test
22527 Lists: 4. No escapes needed
22528 !! options
22529 parsoid=html2wt
22530 !! html/parsoid
22531 <ul>
22532 <li>foo*bar
22533 </li>
22534 </ul>
22535 <ul>
22536 <li><i>foo</i>*bar
22537 </li>
22538 </ul>
22539 <ul>
22540 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
22541 </li>
22542 </ul>
22543 <ul>
22544 <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
22545 </li>
22546 </ul>
22547 !! wikitext
22548 *foo*bar
22549
22550 *''foo''*bar
22551
22552 *[[Foo]]: bar
22553
22554 *[[Foo]]*bar
22555 !!end
22556
22557 !! test
22558 Lists: 5. No unnecessary escapes
22559 !! options
22560 parsoid=html2wt
22561 !! html/parsoid
22562 <ul><li> bar <span>[[foo]]</span></li></ul>
22563 <ul><li> =bar <span>[[foo]]</span></li></ul>
22564 <ul><li> [[bar <span>[[foo]]</span></li></ul>
22565 <ul><li> ]]bar <span>[[foo]]</span></li></ul>
22566 <ul><li> =bar <span>foo]]</span>=</li></ul>
22567 <ul><li> <s></s>: a</li></ul>
22568 <ul><li> <i>* foo</i></li></ul>
22569
22570 !! wikitext
22571 * bar <span><nowiki>[[foo]]</nowiki></span>
22572
22573 * =bar <span><nowiki>[[foo]]</nowiki></span>
22574
22575 * [[bar <span><nowiki>[[foo]]</nowiki></span>
22576
22577 * ]]bar <span><nowiki>[[foo]]</nowiki></span>
22578
22579 * =bar <span>foo]]</span>=
22580
22581 * <s></s>: a
22582
22583 * ''* foo''
22584 !!end
22585
22586 !! test
22587 Lists: 6. Escape bullets in SOL position
22588 !! options
22589 parsoid=html2wt
22590 !! html/parsoid
22591 <p><!--cmt-->*foo</p>
22592 !! wikitext
22593 <!--cmt--><nowiki>*</nowiki>foo
22594 !!end
22595
22596 !! test
22597 Lists: 7. Escape bullets in a multi-line context
22598 !! options
22599 parsoid=html2wt
22600 !! html/parsoid
22601 <p>a
22602 *b
22603 </p>
22604 !! wikitext
22605 a
22606 <nowiki>*</nowiki>b
22607 !!end
22608
22609 !! test
22610 Lists: 8. Escape colons only if not present in tags
22611 !! options
22612 parsoid=html2wt
22613 !! html/parsoid
22614 <dl><dt>a:b<i>c:d</i></dt></dl>
22615 !! wikitext
22616 ; <nowiki>a:b</nowiki>''c:d''
22617 !! end
22618
22619 #### --------------- HRs ---------------
22620 #### 1. Single line
22621 #### -----------------------------------
22622
22623 !! test
22624 HRs: 1. Single line
22625 !! options
22626 parsoid=html2wt
22627 !! html/parsoid
22628 <hr />----
22629 <hr />=foo=
22630 <hr />*foo
22631 !! wikitext
22632 ----<nowiki>----</nowiki>
22633 ----=foo=
22634 ----*foo
22635 !! end
22636
22637 #### --------------- Tables ---------------
22638 #### 1a. Simple example
22639 #### 1b. No escaping needed (!foo)
22640 #### 1c. No escaping needed (|foo)
22641 #### 1d. No escaping needed (|}foo)
22642 ####
22643 #### 2a. Nested in td (<td>foo|bar</td>)
22644 #### 2b. Nested in td (<td>foo||bar</td>)
22645 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
22646 ####
22647 #### 3a. Nested in th (<th>foo!bar</th>)
22648 #### 3b. Nested in th (<th>foo!!bar</th>)
22649 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
22650 ####
22651 #### 4a. Escape -
22652 #### 4b. Escape +
22653 #### 4c. No escaping needed
22654 #### --------------------------------------
22655
22656 !! test
22657 Tables: 1a. Simple example
22658 !! options
22659 parsoid=html2wt
22660 !! html/parsoid
22661 <p>{|
22662 |}
22663 </p>
22664 !! wikitext
22665 <nowiki>{|</nowiki>
22666 |}
22667 !! end
22668
22669 !! test
22670 Tables: 1b. No escaping needed
22671 !! options
22672 parsoid=html2wt
22673 !! html/parsoid
22674 <p>!foo
22675 </p>
22676 !! wikitext
22677 !foo
22678 !! end
22679
22680 !! test
22681 Tables: 1c. No escaping needed
22682 !! options
22683 parsoid=html2wt
22684 !! html/parsoid
22685 <p>|foo
22686 </p>
22687 !! wikitext
22688 |foo
22689 !! end
22690
22691 !! test
22692 Tables: 1d. No escaping needed
22693 !! options
22694 parsoid=html2wt
22695 !! html/parsoid
22696 <p>|}foo
22697 </p>
22698 !! wikitext
22699 |}foo
22700 !! end
22701
22702 !! test
22703 Tables: 2a. Nested in td
22704 !! options
22705 parsoid=html2wt
22706 !! html/parsoid
22707 <table><tbody><tr>
22708 <td>foo|bar</td></tr>
22709 <tr><td>x<div>a|b</div></td>
22710 </tbody></table>
22711 !! wikitext
22712 {|
22713 |<nowiki>foo|bar</nowiki>
22714 |-
22715 |x<div><nowiki>a|b</nowiki></div>
22716 |}
22717 !! html/php+tidy
22718 <table>
22719 <tr>
22720 <td>foo|bar</td>
22721 </tr>
22722 <tr>
22723 <td>x
22724 <div>a|b</div>
22725 </td>
22726 </tr>
22727 </table>
22728 !! end
22729
22730 !! test
22731 Tables: 2b. Nested in td
22732 !! options
22733 parsoid=html2wt
22734 !! html/parsoid
22735 <table><tbody><tr>
22736 <td>foo||bar</td>
22737 <td>a<i>b||c</i></td>
22738 <td>a<i><div>b||c</div></i></td>
22739 </tr></tbody></table>
22740 !! wikitext
22741 {|
22742 |<nowiki>foo||bar</nowiki>
22743 |a''<nowiki>b||c</nowiki>''
22744 |a''<div><nowiki>b||c</nowiki></div>''
22745 |}
22746 !! html/php
22747 <table>
22748 <tr>
22749 <td>foo||bar
22750 </td>
22751 <td>a<i>b||c</i>
22752 </td>
22753 <td>a<i><div>b||c</div></i>
22754 </td></tr></table>
22755
22756 !! end
22757
22758 !! test
22759 Tables: 2c. Nested in td -- no escaping needed
22760 !! options
22761 parsoid=html2wt
22762 !! html/*
22763 <table>
22764
22765 <tr>
22766 <td>foo!!bar
22767 </td></tr></table>
22768
22769 !! wikitext
22770 {|
22771
22772 |foo!!bar
22773 |}
22774 !! end
22775
22776 !! test
22777 Tables: 3a. Nested in th
22778 !! options
22779 parsoid=html2wt
22780 !! html/*
22781 <table>
22782
22783 <tr>
22784 <th>foo!bar
22785 </th></tr></table>
22786
22787 !! wikitext
22788 {|
22789
22790 !foo!bar
22791 |}
22792 !! end
22793
22794 !! test
22795 Tables: 3b. Nested in th
22796 !! options
22797 parsoid=html2wt
22798 !! html/parsoid
22799 <table><tbody>
22800 <tr><th>foo!!bar</th>
22801 <th><i>foo|bar</i></th>
22802 <th><i>foo!!bar</i></th>
22803 <th><i><span>foo!!bar</span></i></th>
22804 </tr></tbody></table>
22805 !! wikitext
22806 {|
22807 !<nowiki>foo!!bar</nowiki>
22808 !''<nowiki>foo|bar</nowiki>''
22809 !''<nowiki>foo!!bar</nowiki>''
22810 !''<span><nowiki>foo!!bar</nowiki></span>''
22811 |}
22812 !! html/php
22813 <table>
22814 <tr>
22815 <th>foo!!bar
22816 </th>
22817 <th><i>foo|bar</i>
22818 </th>
22819 <th><i>foo!!bar</i>
22820 </th>
22821 <th><i><span>foo!!bar</span></i>
22822 </th></tr></table>
22823
22824 !! end
22825
22826 !! test
22827 Tables: 3c. Nested in th
22828 !! options
22829 parsoid=html2wt
22830 !! html/parsoid
22831 <table><tbody>
22832 <tr><th>foo||bar</th>
22833 <th><span typeof="mw:Nowiki">foo||bar</span></th>
22834 </tr></tbody></table>
22835 !! wikitext
22836 {|
22837 !<nowiki>foo||bar</nowiki>
22838 !<nowiki>foo||bar</nowiki>
22839 |}
22840 !! html/php
22841 <table>
22842 <tr>
22843 <th>foo||bar
22844 </th>
22845 <th>foo||bar
22846 </th></tr></table>
22847
22848 !! end
22849
22850 !! test
22851 Tables: 4a. Escape -
22852 !! options
22853 parsoid=html2wt
22854 !! html/*
22855 <table>
22856
22857 <tr>
22858 <th>-bar
22859 </th></tr>
22860 <tr>
22861 <td>-bar
22862 </td></tr></table>
22863
22864 !! wikitext
22865 {|
22866
22867 !-bar
22868
22869 |-
22870 |<nowiki>-bar</nowiki>
22871 |}
22872 !! end
22873
22874 !! test
22875 Tables: 4b. Escape +
22876 !! options
22877 parsoid=html2wt
22878 !! html/*
22879 <table>
22880
22881 <tr>
22882 <th>+bar
22883 </th></tr>
22884 <tr>
22885 <td>+bar
22886 </td></tr></table>
22887
22888 !! wikitext
22889 {|
22890
22891 !+bar
22892
22893 |-
22894 |<nowiki>+bar</nowiki>
22895 |}
22896 !! end
22897
22898 !! test
22899 Tables: 4c. No escaping needed
22900 !! options
22901 parsoid=html2wt
22902 !! html/parsoid
22903 <table><tbody>
22904 <tr><td>foo-bar</td><td>foo+bar</td></tr>
22905 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
22906 <tr><td>foo
22907 <p>bar|baz
22908 +bar
22909 -bar</p></td></tr>
22910 <tr><td>x
22911 <div>a|b</div></td>
22912 </tbody></table>
22913 !! wikitext
22914 {|
22915 |foo-bar
22916 |foo+bar
22917 |-
22918 |''foo''-bar
22919 |''foo''+bar
22920 |-
22921 |foo
22922 bar|baz
22923 +bar
22924 -bar
22925 |-
22926 |x
22927 <div>a|b</div>
22928 |}
22929 !! html/php
22930 <table>
22931 <tr>
22932 <td>foo-bar
22933 </td>
22934 <td>foo+bar
22935 </td></tr>
22936 <tr>
22937 <td><i>foo</i>-bar
22938 </td>
22939 <td><i>foo</i>+bar
22940 </td></tr>
22941 <tr>
22942 <td>foo
22943 <p>bar|baz
22944 +bar
22945 -bar
22946 </p>
22947 </td></tr>
22948 <tr>
22949 <td>x
22950 <div>a|b</div>
22951 </td></tr></table>
22952
22953 !! end
22954
22955 !! test
22956 Tables: 4d. No escaping needed
22957 !! options
22958 parsoid=html2wt
22959 !! html/parsoid
22960 <table>
22961 <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
22962 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
22963 <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
22964 </tbody></table>
22965 !! wikitext
22966 {|
22967 |[[Foo]]-bar
22968 ||+1
22969 ||-2
22970 |}
22971 !! html/php
22972 <table>
22973 <tr>
22974 <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
22975 </td>
22976 <td>+1
22977 </td>
22978 <td>-2
22979 </td></tr></table>
22980
22981 !! end
22982
22983 !! test
22984 T97430: Don't emit empty nowiki pairs around marker meta tags
22985 !! options
22986 parsoid=html2wt
22987 !! html/parsoid
22988 <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
22989 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
22990 !! wikitext
22991 <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
22992 |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
22993 !! end
22994
22995 !! test
22996 Unclosed xmlish element in table line shouldn't eat end delimiters
22997 !! options
22998 parsoid=html2wt
22999 !! html/parsoid
23000 <table>
23001 <tbody><tr><td> &lt;foo</td>
23002 <td> bar></td></tr>
23003 </tbody></table>
23004 !! wikitext
23005 {|
23006 | <foo
23007 | bar>
23008 |}
23009 !! html/php
23010 <table>
23011 <tr>
23012 <td> &lt;foo
23013 </td>
23014 <td> bar&gt;
23015 </td></tr></table>
23016
23017 !! end
23018
23019 #### --------------- Links ----------------
23020 #### 1. Quote marks in link text
23021 #### 2. Wikilinks: Escapes needed
23022 #### 3. Wikilinks: No escapes needed
23023 #### 4. Extlinks: Escapes needed
23024 #### 5. Extlinks: No escapes needed
23025 #### --------------------------------------
23026 !! test
23027 Links 1. WikiLinks: No escapes needed
23028 !! options
23029 parsoid=html2wt
23030 !! html/parsoid
23031 <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
23032 <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
23033 <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
23034 !! wikitext
23035 [[Foo|Foo''boo'']]
23036 [[Foo|[Foobar]]]
23037 [[Foo|x [Foobar] x]]
23038 !! html/php
23039 <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
23040 <a href="/wiki/Foo" title="Foo">[Foobar]</a>
23041 <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
23042 </p>
23043 !! end
23044
23045 !! test
23046 Links 2. WikiLinks: Escapes needed
23047 !! options
23048 parsoid=html2wt
23049 !! html/parsoid
23050 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
23051 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
23052 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
23053 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
23054 <a href="Foo" rel="mw:WikiLink">|Bar</a>
23055 <a href="Foo" rel="mw:WikiLink">]]bar</a>
23056 <a href="Foo" rel="mw:WikiLink">[[bar</a>
23057 <a href="Foo" rel="mw:WikiLink">x [[ y</a>
23058 <a href="Foo" rel="mw:WikiLink">x ]] y</a>
23059 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
23060 !! wikitext
23061 [[Foo|<nowiki>Foobar]</nowiki>]]
23062 [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
23063 [[Foo|<nowiki>[[Bar]]</nowiki>]]
23064 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
23065 [[Foo|<nowiki>|Bar</nowiki>]]
23066 [[Foo|<nowiki>]]bar</nowiki>]]
23067 [[Foo|<nowiki>[[bar</nowiki>]]
23068 [[Foo|<nowiki>x [[ y</nowiki>]]
23069 [[Foo|<nowiki>x ]] y</nowiki>]]
23070 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
23071 !! html/php
23072 <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
23073 <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
23074 <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
23075 <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
23076 <a href="/wiki/Foo" title="Foo">|Bar</a>
23077 <a href="/wiki/Foo" title="Foo">]]bar</a>
23078 <a href="/wiki/Foo" title="Foo">[[bar</a>
23079 <a href="/wiki/Foo" title="Foo">x [[ y</a>
23080 <a href="/wiki/Foo" title="Foo">x ]] y</a>
23081 <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
23082 </p>
23083 !! end
23084
23085 !! test
23086 Links 3. WikiLinks: No escapes needed
23087 !! options
23088 parsoid=html2wt
23089 !! html/parsoid
23090 <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
23091 <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
23092 !! wikitext
23093 [[Foo|[Foobar]]
23094 [[Foo|foo|bar]]
23095 !! html/php
23096 <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
23097 <a href="/wiki/Foo" title="Foo">foo|bar</a>
23098 </p>
23099 !! end
23100
23101 !! test
23102 Links 4. ExtLinks: Escapes needed
23103 !! options
23104 parsoid=html2wt
23105 !! html/parsoid
23106 <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
23107 <a rel="mw:ExtLink" href="http://google.com">google]</a></p>
23108 <p>[http://google.com]</p>
23109 <p>[http://google.com google]</p>
23110 !! wikitext
23111 [http://google.com <nowiki>[google]</nowiki>]
23112 [http://google.com <nowiki>google]</nowiki>]
23113
23114 <nowiki>[http://google.com]</nowiki>
23115
23116 <nowiki>[http://google.com google]</nowiki>
23117
23118 !! html/php
23119 <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
23120 <a rel="nofollow" class="external text" href="http://google.com">google]</a>
23121 </p><p>[http://google.com]
23122 </p><p>[http://google.com google]
23123 </p>
23124 !! end
23125
23126 !! test
23127 Links 5. ExtLinks: No escapes needed
23128 !! options
23129 parsoid=html2wt
23130 !! html/parsoid
23131 <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
23132 !! wikitext
23133 [http://google.com [google]
23134 !! html/php
23135 <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
23136 </p>
23137 !! end
23138
23139 !! test
23140 Links 6. Add <nowiki/>s between text-nodes and url-links when required (bug 64300)
23141 !! options
23142 parsoid=html2wt
23143 !! html/parsoid
23144 <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
23145 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
23146 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
23147 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
23148 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
23149 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
23150 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23151 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
23152 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
23153 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
23154 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
23155 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
23156 <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
23157 </p>
23158 !! wikitext
23159 x<nowiki/>http://example.com<nowiki/>y
23160 http://example.com<nowiki/>?x
23161 http://example.com<nowiki/>&x
23162 http://example.com<nowiki/>'x
23163 http://example.com<nowiki/>,x
23164 http://example.com<nowiki/>.x
23165 http://example.com<nowiki/>;x
23166 http://example.com<nowiki/>:x
23167 http://example.com<nowiki/>;x
23168 http://example.com<nowiki/>!x
23169 http://example.com<nowiki/>=x
23170 http://example.com<nowiki/>(x)
23171 http://example.com(x<nowiki/>)
23172 !! end
23173
23174 !! test
23175 Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23176 !! options
23177 parsoid=html2wt
23178 !! html/parsoid
23179 <p>x
23180 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
23181 y
23182 "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
23183 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
23184 (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
23185 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
23186 <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
23187 </p>
23188 !! wikitext
23189 x
23190 http://example.com
23191 y
23192 "http://example.com"
23193 (http://example.com)
23194 (http://example.com) foo
23195 http://example.com,
23196 http://example.com, foo
23197 !! html/php
23198 <p>x
23199 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
23200 y
23201 "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
23202 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
23203 (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
23204 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
23205 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
23206 </p>
23207 !! end
23208
23209 !! test
23210 Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (bug 64300)
23211 !! options
23212 parsoid=html2wt
23213 !! html/parsoid
23214 <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
23215 -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
23216 !! wikitext
23217 http://example.com.,;:!?\
23218 -http://example.com:
23219 !! html/php
23220 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
23221 -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
23222 </p>
23223 !! end
23224
23225 !! test
23226 Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (bug 64300)
23227 !! options
23228 parsoid=html2wt
23229 !! html/parsoid
23230 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
23231 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
23232 X<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
23233 !! wikitext
23234 RFC 123<nowiki/>4
23235 RFC 123<nowiki/>y
23236 X<nowiki/>RFC 123<nowiki/>y
23237 !! end
23238
23239 !! test
23240 Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (bug 64300)
23241 !! options
23242 parsoid=html2wt
23243 !! html/parsoid
23244 <p><a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
23245 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
23246 -<a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
23247 </p>
23248 !! wikitext
23249 RFC 123?foo
23250 RFC 123&foo
23251 -RFC 123-
23252 !! html/php
23253 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>?foo
23254 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
23255 -<a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc123">RFC 123</a>-
23256 </p>
23257 !! end
23258
23259 !! test
23260 Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (bug 64300)
23261 !! options
23262 parsoid=html2wt
23263 !! html/parsoid
23264 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
23265 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23266 X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
23267 !! wikitext
23268 PMID 123<nowiki/>4
23269 PMID 123<nowiki/>y
23270 X<nowiki/>PMID 123<nowiki/>y
23271 !! end
23272
23273 !! test
23274 Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (bug 64300)
23275 !! options
23276 parsoid=html2wt
23277 !! html/parsoid
23278 <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
23279 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
23280 -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
23281 </p>
23282 !! wikitext
23283 PMID 123?foo
23284 PMID 123&foo
23285 -PMID 123-
23286 !! html/php
23287 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
23288 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
23289 -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
23290 </p>
23291 !! end
23292
23293 !! test
23294 Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (bug 64300)
23295 !! options
23296 parsoid=html2wt
23297 !! html/parsoid
23298 <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
23299 <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
23300 a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
23301 </p>
23302 !! wikitext
23303 ISBN 1234567890<nowiki/>1
23304 ISBN 1234567890<nowiki/>x
23305 a<nowiki/>ISBN 1234567890<nowiki/>b
23306 !! end
23307
23308 !! test
23309 Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (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>'s
23314 !! wikitext
23315 -ISBN 1234567890's
23316 !! html/php
23317 <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
23318 </p>
23319 !! end
23320
23321 !! test
23322 Links 14. Protect link-like plain text. (Parsoid bug T78425)
23323 !! options
23324 parsoid=html2wt
23325 !! html/*
23326 <p>this is not a link: http://example.com
23327 </p>
23328 !! wikitext
23329 this is not a link: <nowiki>http://example.com</nowiki>
23330 !! end
23331
23332 !! test
23333 Links 15. Link trails can't become link prefixes.
23334 !! options
23335 language=is
23336 parsoid=html2wt
23337 !! html/parsoid
23338 <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>
23339 !! wikitext
23340 [[Söfnuður]]-[[00]]
23341 !! html/php
23342 <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>
23343 </p>
23344 !! end
23345
23346 #### --------------- Quotes ---------------
23347 #### 1. Quotes inside <b> and <i>
23348 #### 2. Link fragments separated by <i> and <b> tags
23349 #### 3. Link fragments inside <i> and <b>
23350 #### 4. No escaping needed
23351 #### --------------------------------------
23352 !! test
23353 1a. Quotes inside <b> and <i>
23354 !! options
23355 parsoid=html2wt
23356 !! html/*
23357 <p><i>'foo'</i>
23358 <i>''foo''</i>
23359 <i>'''foo'''</i>
23360 <i>foo</i>'s
23361 <b>'foo'</b>
23362 <b>''foo''</b>
23363 <b>'''foo'''</b>
23364 <b>foo'<i>bar'</i>baz</b>
23365 <b>foo</b>'s
23366 '<i>foo</i>
23367 <i>foo</i>'
23368 <i>foo'</i>'
23369 '<i>foo</i>'
23370 '<b>foo</b>
23371 <b>foo</b>'
23372 '<b>foo</b>'
23373 <i>fools'<span> errand</span></i>
23374 <i><span>fool</span>'s errand</i>
23375 '<i>foo</i> bar '<i>baz</i>
23376 a|!*#-:;+-~[]{}b'<i>x</i>
23377 </p>
23378 !! wikitext
23379 ''<nowiki/>'foo'''
23380 ''<nowiki>''foo''</nowiki>''
23381 ''<nowiki>'''foo'''</nowiki>''
23382 ''foo''<nowiki/>'s
23383 '''<nowiki/>'foo''''
23384 '''<nowiki>''foo''</nowiki>'''
23385 '''<nowiki>'''foo'''</nowiki>'''
23386 '''foo'<nowiki/>''bar'<nowiki/>''baz'''
23387 '''foo'''<nowiki/>'s
23388 '''foo''
23389 ''foo''<nowiki/>'
23390 ''foo'''<nowiki/>'
23391 '''foo''<nowiki/>'
23392 ''''foo'''
23393 '''foo'''<nowiki/>'
23394 ''''foo'''<nowiki/>'
23395 ''fools'<span> errand</span>''
23396 ''<span>fool</span>'s errand''
23397 '<nowiki/>''foo'' bar '''baz''
23398 a|!*#-:;+-~[]{}b'''x''
23399 !! end
23400
23401 !! test
23402 1b. Quotes inside <b> and <i> with other tags on same line
23403 !! options
23404 parsoid=html2wt
23405 !! html/parsoid
23406 '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23407 <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
23408 <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>
23409 <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
23410 '<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>
23411 '<i>foo</i> <div title="name">test</div>
23412 '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
23413 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
23414 <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>
23415 </ol>
23416 !! wikitext
23417 '''a'' foo ''[[bar]]''
23418 ''a''' foo ''[[bar]]''
23419 ''a''' foo '''{{echo|[[bar]]}}'''
23420 [[foo]] x'''[[bar]]''
23421 '''foo'' <ref>test</ref>
23422 '''foo'' <div title="name">test</div>
23423 '''foo'' and <br> bar
23424 <references />
23425 !! end
23426
23427 !! test
23428 2. Link fragments separated by <i> and <b> tags
23429 !! options
23430 parsoid=html2wt
23431 !! html/parsoid
23432 <p>[[<i>foo</i>hello]]</p>
23433 <p>[[<b>foo</b>hello]]</p>
23434 !! wikitext
23435 [[''foo''<nowiki>hello]]</nowiki>
23436
23437 [['''foo'''<nowiki>hello]]</nowiki>
23438 !! end
23439
23440 # FIXME: Escaping one or both of [[ and ]] is also acceptable --
23441 # this is one of the shortcomings of this format
23442 !! test
23443 3. Link fragments inside <i> and <b>
23444 !! options
23445 parsoid=html2wt
23446 !! html/parsoid
23447 <p><i>[[foo</i>]]</p>
23448 <p><b>[[foo</b>]]</p>
23449 !! wikitext
23450 ''[[foo''<nowiki>]]</nowiki>
23451
23452 '''[[foo'''<nowiki>]]</nowiki>
23453 !! end
23454
23455 !! test
23456 4. No escaping needed
23457 !! options
23458 options=html2wt
23459 !! html/parsoid
23460 <p>'<span><i>bar</i></span>'
23461 '<span><b>bar</b></span>'
23462 'a:b'foo
23463 </p>
23464 !! wikitext
23465 '<span>''bar''</span>'
23466 '<span>'''bar'''</span>'
23467 'a:b'foo
23468 !! end
23469
23470 #### ----------- Paragraphs ---------------
23471 #### 1. No unnecessary escapes
23472 #### --------------------------------------
23473
23474 !! test
23475 1. No unnecessary escapes
23476 !! options
23477 parsoid=html2wt
23478 !! html/parsoid
23479 <p>bar <span>[[foo]]</span>
23480 </p><p>=bar <span>[[foo]]</span>
23481 </p><p>[[bar <span>[[foo]]</span>
23482 </p><p>]]bar <span>[[foo]]</span>
23483 </p><p>=bar <span>foo]]</span>=
23484 </p>
23485 !! wikitext
23486 bar <span><nowiki>[[foo]]</nowiki></span>
23487
23488 =bar <span><nowiki>[[foo]]</nowiki></span>
23489
23490 [[bar <span><nowiki>[[foo]]</nowiki></span>
23491
23492 ]]bar <span><nowiki>[[foo]]</nowiki></span>
23493
23494 =bar <span>foo]]</span><nowiki>=</nowiki>
23495 !!end
23496
23497 #### ----------------------- PRE --------------------------
23498 #### 1. Leading whitespace in SOL context should be escaped
23499 #### ------------------------------------------------------
23500 !! test
23501 1. Leading whitespace in SOL context should be escaped
23502 !! options
23503 parsoid=html2wt
23504 !! html/parsoid
23505 <p> a</p>
23506
23507 <p> a</p>
23508
23509 <p> a(tab)</p>
23510
23511 <p> a
23512 <!--cmt-->
23513 a</p>
23514
23515 <p>a
23516 b</p>
23517
23518 <p>a
23519 b</p>
23520
23521 <p>a
23522 b</p>
23523 !! wikitext
23524 <nowiki> </nowiki>a
23525
23526 <nowiki> </nowiki> a
23527
23528 a(tab)
23529
23530 <nowiki> </nowiki> a
23531 <!--cmt-->
23532 <nowiki> </nowiki>a
23533
23534 a
23535 <nowiki> </nowiki>b
23536
23537 a
23538 b
23539
23540 a
23541 b
23542 !! html/php
23543 <p> a
23544 </p><p> a
23545 </p><p> a(tab)
23546 </p><p> a
23547 a
23548 </p><p>a
23549 b
23550 </p><p>a
23551 b
23552 </p><p>a
23553 b
23554 </p>
23555 !! end
23556
23557 !! test
23558 2. Leading whitespace in non-indent-pre contexts should not be escaped
23559 !! options
23560 parsoid=htm2wt
23561 !! html/parsoid
23562 <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>
23563 <ol class="mw-references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
23564 <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>
23565 b</span></li>
23566 </ol>
23567 !! wikitext
23568 foo <ref>''a''
23569 b</ref>
23570 <references />
23571 !! end
23572
23573 !! test
23574 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
23575 !! options
23576 parsoid=html2wt
23577 !! html/parsoid
23578 <blockquote>
23579 <p>
23580 a
23581 <span>b</span>
23582 c</p>
23583 </blockquote>
23584 !! wikitext
23585 <blockquote>
23586 a
23587 <span>b</span>
23588 c
23589 </blockquote>
23590 !! end
23591
23592 !! test
23593 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
23594 !! options
23595 options=html2wt
23596 !! html/parsoid
23597 <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>
23598 !! wikitext
23599 [[File:Foobar.jpg|thumb|caption]]
23600 !! end
23601
23602 !! test
23603 5. Nowiki escaping should account for indent-pres
23604 !! options
23605 parsoid=html2wt
23606 !! html/parsoid
23607 <pre>==foo==</pre>
23608 !! wikitext
23609 ==foo==
23610 !! end
23611
23612 !!test
23613 T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
23614 !! options
23615 parsoid=html2wt
23616 !! html/parsoid
23617 <pre>
23618 * foo
23619 * bar
23620 </pre>
23621 !! wikitext
23622 * foo
23623 * bar
23624 !! end
23625
23626 #### --------------- Behavior Switches --------------------
23627
23628 !! test
23629 1. Valid behavior switches should be escaped
23630 !! options
23631 parsoid=html2wt
23632 !! html/parsoid
23633 __TOC__
23634 <i>__TOC__</i>
23635 !! wikitext
23636 <nowiki>__TOC__</nowiki>
23637 ''<nowiki>__TOC__</nowiki>''
23638 !! end
23639
23640 !! test
23641 2. Invalid behavior switches should not be escaped
23642 !! options
23643 parsoid=html2wt
23644 !! html/parsoid
23645 __TOO__
23646 __|__
23647 !! wikitext
23648 __TOO__
23649 __|__
23650 !! end
23651
23652 # We use indent-pre as an indirect way to test for sol-transparent behavior.
23653 !! test
23654 Behavior switches should be SOL-transparent
23655 !! options
23656 parsoid=html2wt
23657 !! html/parsoid
23658 <meta property="mw:PageProp/toc" />
23659
23660 <!-- this one's bogus -->
23661 <pre>__TOO__</pre>
23662
23663 <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
23664
23665 <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
23666 !! wikitext
23667 __TOC__
23668
23669 <!-- this one's bogus -->
23670 __TOO__
23671
23672 __TOC__ foo
23673
23674 __TOC__
23675 bar
23676 !! end
23677
23678 #### --------------- HTML tags ---------------
23679 #### 1. a tags
23680 #### 2. other tags
23681 #### 3. multi-line html tag
23682 #### 4. extension tags
23683 #### -----------------------------------------
23684 !! test
23685 1. a tags
23686 !! options
23687 parsoid=html2wt
23688 !! html/parsoid
23689 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
23690 !! wikitext
23691 <a href="http://google.com">google</a>
23692 !! end
23693
23694 !! test
23695 2. other tags
23696 !! options
23697 parsoid=html2wt
23698 !! html/parsoid
23699 <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
23700 <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
23701 <li> &lt;td&gt;</li></ul>
23702
23703 !! wikitext
23704 * <nowiki><div>foo</div></nowiki>
23705 * <nowiki><div style="color:red">foo</div></nowiki>
23706 * <nowiki><td></nowiki>
23707 !! end
23708
23709 !! test
23710 3. multi-line html tag
23711 !! options
23712 parsoid=html2wt
23713 !! html/parsoid
23714 <p>&lt;div
23715 &gt;foo&lt;/div
23716 &gt;
23717 </p>
23718 !! wikitext
23719 <nowiki><div
23720 >foo</div
23721 ></nowiki>
23722 !! end
23723
23724 !! test
23725 4. extension tags
23726 !! options
23727 parsoid=html2wt
23728 !! html/parsoid
23729 <p>&lt;ref&gt;foo&lt;/ref&gt;
23730 </p><p>&lt;ref&gt;bar
23731 </p><p>baz&lt;/ref&gt;
23732 </p>
23733 !! wikitext
23734 <nowiki><ref>foo</ref></nowiki>
23735
23736 <nowiki><ref>bar</nowiki>
23737
23738 baz<nowiki></ref></nowiki>
23739 !! end
23740
23741 #### --------------- Others ---------------
23742 !! test
23743 Escaping nowikis
23744 !! options
23745 parsoid=html2wt
23746 !! html/parsoid
23747 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
23748 </p>
23749 !! wikitext
23750 &lt;nowiki&gt;foo&lt;/nowiki&gt;
23751 !! end
23752
23753 ## The quote-char in the input is necessary for triggering the bug
23754 !! test
23755 (Bug 52035) Nowiki-escaping should not get tripped by " :" in text
23756 !! options
23757 parsoid=html2wt
23758 !! html/parsoid
23759 <p>foo's bar :</p>
23760 !! wikitext
23761 foo's bar :
23762 !! end
23763
23764 #----------- End of wikitext escaping tests --------------
23765
23766 !! test
23767
23768 Tag-like HTML structures are passed through as text
23769 !! wikitext
23770 <x y>
23771
23772 <x.y>
23773
23774 <x-y>
23775
23776 1>2
23777
23778 x<y
23779
23780 a>b
23781
23782 1<d e>f
23783 !! html
23784 <p>&lt;x y&gt;
23785 </p><p>&lt;x.y&gt;
23786 </p><p>&lt;x-y&gt;
23787 </p><p>1&gt;2
23788 </p><p>x&lt;y
23789 </p><p>a&gt;b
23790 </p><p>1&lt;d e&gt;f
23791 </p>
23792 !! end
23793
23794 !! test
23795 HTML tag with necessary entities in attributes
23796 !! wikitext
23797 <span title="&amp;amp;">foo</span>
23798 !! html
23799 <p><span title="&amp;amp;">foo</span>
23800 </p>
23801 !! end
23802
23803 !! test
23804 HTML tag with 'unnecessary' entity encoding in attributes
23805 !! wikitext
23806 <span title="&amp;">foo</span>
23807 !! html
23808 <p><span title="&amp;">foo</span>
23809 </p>
23810 !! end
23811
23812 !! test
23813 HTML tag with broken attribute value quoting
23814 !! wikitext
23815 <span title="Hello world>Foo</span>
23816 !! html/php
23817 <p><span title="Hello world">Foo</span>
23818 </p>
23819 !! html/parsoid
23820 <p><span title="Hello world">Foo</span>
23821 </p>
23822 !! end
23823
23824 !! test
23825 Self-closed tag with broken attribute value quoting
23826 !! options
23827 parsoid=wt2html,html2html
23828 !! wikitext
23829 <div title="Hello world />Foo
23830 !! html/php+tidy
23831 <div title="Hello world"></div>
23832 <p>Foo</p>
23833 !! html/parsoid
23834 <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
23835 !! end
23836
23837 !! test
23838 Table with broken attribute value quoting
23839 !! wikitext
23840 {|
23841 | title="Hello world|Foo
23842 |}
23843 !! html/php
23844 <table>
23845 <tr>
23846 <td title="Hello world">Foo
23847 </td></tr></table>
23848
23849 !! html/parsoid
23850 <table>
23851 <tr>
23852 <td title="Hello world">Foo
23853 </td></tr></table>
23854
23855 !! end
23856
23857 !! test
23858 Table with broken attribute value quoting on consecutive lines
23859 !! wikitext
23860 {|
23861 | title="Hello world|Foo
23862 | style="color:red|Bar
23863 |}
23864 !! html/php
23865 <table>
23866 <tr>
23867 <td title="Hello world">Foo
23868 </td>
23869 <td style="color:red">Bar
23870 </td></tr></table>
23871
23872 !! html/parsoid
23873 <table><tbody>
23874 <tr>
23875 <td title="Hello world">Foo
23876 </td><td style="color: red">Bar
23877 </td></tr></tbody></table>
23878
23879 !! end
23880
23881 !! test
23882 2. Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23883 !! options
23884 parsoid
23885 !! wikitext
23886 {{}}
23887 !! html
23888 {{}}
23889 !! end
23890
23891 !! test
23892 1. Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
23893 !! options
23894 parsoid
23895 !! wikitext
23896 }}{{
23897 !! html
23898 }}{{
23899 !! end
23900
23901 !!test
23902 Accept empty td cell attribute
23903 !! wikitext
23904 {|
23905 | align="center" | foo || |
23906 |}
23907 !! html
23908 <table>
23909 <tr>
23910 <td align="center"> foo </td>
23911 <td>
23912 </td></tr></table>
23913
23914 !!end
23915
23916 !!test
23917 Non-empty attributes in th-cells
23918 !! wikitext
23919 {|
23920 ! Foo !! style="color: red" | Bar
23921 |}
23922 !! html
23923 <table>
23924 <tr>
23925 <th> Foo </th>
23926 <th style="color: red"> Bar
23927 </th></tr></table>
23928
23929 !!end
23930
23931 !!test
23932 Accept empty attributes in th-cells
23933 !! wikitext
23934 {|
23935 !| foo !!| bar
23936 |}
23937 !! html
23938 <table>
23939 <tr>
23940 <th> foo </th>
23941 <th> bar
23942 </th></tr></table>
23943
23944 !!end
23945
23946 !!test
23947 Empty table rows go away
23948 !! wikitext
23949 {|
23950 | Hello
23951 | there
23952 |- class="foo"
23953 |-
23954 |}
23955 !! html
23956 <table>
23957 <tr>
23958 <td> Hello
23959 </td>
23960 <td> there
23961 </td></tr>
23962
23963 </table>
23964
23965 !! end
23966
23967 ###
23968 ### Parsoid-centric tests for testing RTing of inter-element separators
23969 ### Edge cases not tested by existing parser tests and specific to
23970 ### Parsoid-specific serialization strategies.
23971 ###
23972
23973 !!test
23974 RT-ed inter-element separators should be valid separators
23975 !! wikitext
23976 {|
23977 |- [[foo]]
23978 |}
23979 !! html/php
23980 <table>
23981
23982 </table>
23983
23984 !! html/parsoid
23985 <table>
23986 <tbody><tr data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
23987 </tbody></table>
23988 !!end
23989
23990 # Parsoid-only since PHP parser relies on Tidy for correct output
23991 !!test
23992 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
23993 !!options
23994 parsoid
23995 !! wikitext
23996 {|
23997 |<small>foo
23998 bar
23999 |}
24000
24001 {|
24002 |<small>foo<small>
24003 |}
24004 !! html
24005 <table>
24006 <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
24007 <p>bar</p></small></td></tr>
24008 </tbody></table>
24009
24010 <table>
24011 <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>
24012 </tbody></table>
24013 !!end
24014
24015 # Note that the "style" attribute is really a template parameter here.
24016 # The = would have to be {{=}} if you wanted the literal.
24017 !!test
24018 Empty TD followed by TD with tpl-generated attribute
24019 !! wikitext
24020 {|
24021 |-
24022 |
24023 |{{echo|style='color:red'}}|foo
24024 |}
24025 !! html
24026 <table>
24027
24028 <tr>
24029 <td>
24030 </td>
24031 <td>foo
24032 </td></tr></table>
24033
24034 !!end
24035
24036 !!test
24037 Indented table with an empty td
24038 !! wikitext
24039 {|
24040 |-
24041 |
24042 |foo
24043 |}
24044 !! html
24045 <table>
24046
24047 <tr>
24048 <td>
24049 </td>
24050 <td>foo
24051 </td></tr></table>
24052
24053 !!end
24054
24055 ## We have some newline diffs RT-ing this edge case
24056 ## and it is not important enough -- we seem to be emitting
24057 ## at most 2 newlines after a </tr> and this is unrelated to
24058 ## the issue from T85627 that this is testing.
24059 !!test
24060 Indented table with blank lines in between (T85627)
24061 !! options
24062 parsoid=wt2html
24063 !! wikitext
24064 {|
24065 |foo
24066
24067
24068 |}
24069 !! html
24070 <table>
24071
24072 <tr>
24073 <td>foo
24074 </td></tr></table>
24075
24076 !!end
24077
24078 !!test
24079 Indented block & table
24080 !! wikitext
24081 <div>foo</div>
24082 {|
24083 |foo
24084 |}
24085 !! html/php
24086 <div>foo</div>
24087 <table>
24088 <tr>
24089 <td>foo
24090 </td></tr></table>
24091
24092 !! html/parsoid
24093 <div data-parsoid='{"stx":"html"}'>foo</div>
24094 <table><tbody>
24095 <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
24096 </tbody></table>
24097 !!end
24098
24099 !! test
24100 Indent and comment before table row
24101 !! wikitext
24102 {|
24103 <!--hi-->|-
24104 | there
24105 |}
24106 !! html/php
24107 <table>
24108
24109 <tr>
24110 <td> there
24111 </td></tr></table>
24112
24113 !! html/parsoid
24114 <table>
24115 <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
24116 <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
24117 </tbody></table>
24118 !! end
24119
24120 # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
24121 !!test
24122 Empty TR followed by a template-generated TR
24123 !!options
24124 parsoid
24125 !! wikitext
24126 {|
24127 |-
24128 {{echo|<tr><td>foo</td></tr>}}
24129 |}
24130 !! html
24131 <table>
24132 <tbody>
24133 <tr></tr>
24134 <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}}]}'>
24135 <td>foo</td></tr>
24136 </tbody></table>
24137 !!end
24138
24139 ## PHP and parsoid output differ for this, and since this is primarily
24140 ## for testing Parsoid's serializer, marking this Parsoid only
24141 !!test
24142 Empty TR followed by mixed-ws-comment line should RT correctly
24143 !!options
24144 parsoid
24145 !! wikitext
24146 {|
24147 |-
24148 <!--c-->
24149 |-
24150 <!--c--> <!--d-->
24151 |}
24152 !! html
24153 <table>
24154 <tbody>
24155 <tr></tr>
24156 <!--c-->
24157 <tr>
24158 <!--c--> </tr><!--d-->
24159 </tbody></table>
24160
24161 !!end
24162
24163 !!test
24164 Multi-line image caption generated by templates with/without trailing newlines
24165 !! wikitext
24166 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
24167 [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
24168 !! html/parsoid
24169 <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>
24170 <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>
24171 !!end
24172
24173 !! test
24174 New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
24175 !! options
24176 parsoid=html2wt
24177 !! html/parsoid
24178 <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>
24179
24180 <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
24181 !! wikitext
24182 <includeonly>foo</includeonly>
24183 new para
24184
24185 [[Category:Foo]]
24186
24187 = new heading =
24188 !! end
24189
24190 ## PHP emits broken html for this, and since this is primarily
24191 ## a Parsoid serializer test, marking this Parsoid only
24192 !!test
24193 Improperly nested inline or quotes tags with whitespace in between
24194 !! wikitext
24195 <span> <s>x</span> </s>
24196 ''' ''x''' ''
24197 !! html/parsoid
24198 <p><span> <s>x</s></span><s> </s>
24199 <b> <i>x</i></b><i> </i>
24200 </p>
24201 !!end
24202
24203 !!test
24204 Encapsulate protected attributes from wt
24205 !! wikitext
24206 <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
24207 !! html/parsoid
24208 <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>
24209 </body>
24210 !!end
24211
24212 ## Currently the p-wrapper is fragile in how it adds / removes transformations.
24213 ## Having nested or stray pre tags results in the attempt to add duplicates,
24214 ## causing an assertion fail. This test tries to prevent that situation.
24215 !!test
24216 Ensure ParagraphWrapper can deal with stray closing pre tags
24217 !!options
24218 parsoid=wt2html
24219 !! wikitext
24220 plain text</pre>
24221 !! html/parsoid
24222 plain text
24223 !!end
24224
24225 !!test
24226 1. Ensure fostered text content is wrapped in element nodes
24227 !!options
24228 parsoid=wt2html
24229 !! wikitext
24230 <table>hi</table><table>ho</table>
24231 !! html/parsoid
24232 <p>hi</p>
24233 <table></table>
24234 <p>ho</p>
24235 <table></table>
24236 !!end
24237
24238 !!test
24239 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
24240 !!options
24241 parsoid=wt2html,wt2wt
24242 !! wikitext
24243 <table>
24244 <tr> || ||
24245 <td> a
24246 </table>
24247 !! html/parsoid
24248 <p> || ||
24249 </p><table>
24250 <tbody><tr><td> a</td></tr>
24251 </tbody></table>
24252 !!end
24253
24254 !!test
24255 Encapsulation properly handles null DSR information from foster box
24256 !!options
24257 parsoid=wt2html,wt2wt
24258 !! wikitext
24259 {{echo|<table>foo<tr><td>bar</td></tr></table>}}
24260 !! html/parsoid
24261 <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>
24262 !!end
24263
24264 !!test
24265 1. Encapsulate foster-parented transclusion content
24266 !!options
24267 parsoid=wt2wt,wt2html
24268 !! wikitext
24269 <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
24270 !! html/parsoid
24271 <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>
24272 <tbody>
24273 <tr>
24274 <td>bar</td>
24275 </tr>
24276 </tbody>
24277 </table>
24278 !!end
24279
24280 !!test
24281 2. Encapsulate foster-parented transclusion content
24282 !!options
24283 parsoid=wt2wt,wt2html
24284 !! wikitext
24285 <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
24286 !! html/parsoid
24287 <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>
24288 <table>
24289 <tbody>
24290 <tr>
24291 <td>bar</td>
24292 </tr>
24293 </tbody>
24294 </table>
24295 !!end
24296
24297 !!test
24298 3. Encapsulate foster-parented transclusion content
24299 !!options
24300 parsoid=wt2wt,wt2html
24301 !! wikitext
24302 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24303 !! html/parsoid
24304 <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;]}">
24305 <p>foo</p>
24306 </div>
24307 <table>
24308 <tbody>
24309 <tr>
24310 <td>bar</td>
24311 </tr>
24312 </tbody>
24313 </table>
24314 !!end
24315
24316 !!test
24317 4. Encapsulate foster-parented transclusion content
24318 !!options
24319 parsoid=wt2wt,wt2html
24320 !! wikitext
24321 <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
24322 !! html/parsoid
24323 <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;]}">
24324 <p>foo</p>
24325 </div>
24326 <table>
24327 <tbody>
24328 <tr>
24329 <td>bar</td>
24330 </tr>
24331 </tbody>
24332 </table>
24333 !!end
24334
24335 !!test
24336 5. Encapsulate foster-parented transclusion content
24337 !!options
24338 parsoid=wt2wt,wt2html
24339 !! wikitext
24340 <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
24341 !! html/parsoid
24342 <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>
24343 <table>
24344 <tbody>
24345 <tr>
24346 <td>
24347 <div>
24348 <p>foo</p>
24349 </div>
24350 </td>
24351 </tr>
24352 </tbody>
24353 </table>
24354 !!end
24355
24356 !!test
24357 6. Encapsulate foster-parented transclusion content
24358 !!options
24359 parsoid=wt2wt,wt2html
24360 !! wikitext
24361 <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
24362 !! html/parsoid
24363 <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>
24364 <table>
24365 <tbody>
24366 <tr>
24367 <td>
24368 <div>
24369 <p>foo</p>
24370 </div>
24371 </td>
24372 </tr>
24373 </tbody>
24374 </table>
24375 <p>ok</p>
24376 !!end
24377
24378 !!test
24379 7. Encapsulate foster-parented transclusion content
24380 !!options
24381 parsoid=wt2wt,wt2html
24382 !! wikitext
24383 <table>{{echo|<p>foo</p>}}<td>bar</td></table>
24384 !! html/parsoid
24385 <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>
24386 <table>
24387 <tbody>
24388 <tr>
24389 <td>bar</td>
24390 </tr>
24391 </tbody>
24392 </table>
24393 !!end
24394
24395 # Note that the wt is broken on purpose: the = should be {{=}} if you
24396 # don't want it to be a template parameter key.
24397 !!test
24398 8. Encapsulate foster-parented transclusion content
24399 !!options
24400 parsoid=wt2wt,wt2html
24401 !! wikitext
24402 {{echo|a
24403 }}{|{{echo|style='color:red'}}
24404 |-
24405 |b
24406 |}
24407 !! html/parsoid
24408 <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
24409 <span> </span>
24410 <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>
24411 <table>
24412 <tbody>
24413 <tr>
24414 <td>b</td>
24415 </tr>
24416 </tbody>
24417 </table>
24418 !!end
24419
24420 !!test
24421 9. Encapsulate foster-parented transclusion content
24422 !!options
24423 parsoid=wt2wt,wt2html
24424 !! wikitext
24425 <table>{{echo|hi</table>hello}}
24426 !! html/parsoid
24427 <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>
24428 !!end
24429
24430 !!test
24431 Table in fosterable position
24432 !!options
24433 parsoid=wt2html,wt2wt
24434 !! wikitext
24435 {{OpenTable}}
24436 <div>
24437 {|
24438 |}
24439 </div>
24440 |}
24441 !! html/parsoid
24442 <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">
24443 </span>
24444 <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
24445
24446 <table>
24447 </table>
24448 !!end
24449
24450 # Parsoid only for bug 64747
24451 !! test
24452 Properly encapsulate empty-content transclusions in fosterable positions
24453 !! wikitext
24454 <table>
24455 {{#if:|
24456 <td>foo</td>
24457 }}
24458 </table>
24459 !! html/parsoid
24460 <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":["","","",""]}]]}'>
24461
24462 </table>
24463 !! end
24464
24465 !! test
24466 Always encapsulate foster box when template range is expanded to table
24467 !! options
24468 parsoid=wt2wt
24469 !! wikitext
24470 {|
24471 hello
24472 {{OpenTable}}
24473 |}
24474 !! html/parsoid
24475
24476 !! end
24477
24478 !!test
24479 Support <object> element with .data attribute
24480 !!options
24481 parsoid=html2wt
24482 !! html/parsoid
24483 <object data="test.swf"></object>
24484 !! wikitext
24485 <object data="test.swf"></object>
24486 !!end
24487
24488 !! test
24489 Don't block XML namespace declaration
24490 !! wikitext
24491 <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
24492 !! html/php
24493 <p><span>MediaWiki</span>
24494 </p>
24495 !! html/parsoid
24496 <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
24497 !! end
24498
24499 # -----------------------------------------------------------------
24500 # The following section of tests are primarily to spec requirements
24501 # around serialization of new/edited content.
24502 #
24503 # All these tests are marked Parsoid html2wt and html2html only
24504 # ----------------------------------------------------------------
24505
24506 # 'mi' is a localinterwiki prefix as well as a language
24507 !! test
24508 Serialize interwiki links pointing to the current wiki as plain wiki links (bug 65869)
24509 !! options
24510 parsoid=html2wt
24511 !! html/parsoid
24512 <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
24513 !! wikitext
24514 [[Foo]]
24515 !! end
24516
24517 # See T93839
24518 !! test
24519 New wikilinks should be serialized properly
24520 !! options
24521 parsoid=html2wt
24522 !! html/parsoid
24523 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
24524 <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
24525 !! wikitext
24526 [[Foo]]
24527 [[Foo]]
24528 !! end
24529
24530 !! test
24531 New wiki links (href variations)
24532 !! options
24533 parsoid=html2wt
24534 !! html/parsoid
24535 <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
24536 <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
24537 <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
24538 <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
24539 !! wikitext
24540 [[Foo_bar]]
24541 [[Foo_bar]]
24542 [[Foo_bar]]
24543 [[Toxine bactérienne]]
24544 !! end
24545
24546 !! test
24547 New wiki links (content string variations)
24548 !! options
24549 parsoid=html2wt
24550 !! html/parsoid
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="./Foo_bar">./Foo_bar</a>
24554 !! wikitext
24555 [[Foo_bar]]
24556 [[Foo bar]]
24557 [[Foo_bar|./Foo_bar]]
24558 !! end
24559
24560 !! test
24561 New category links (href variations)
24562 !! options
24563 parsoid=html2wt
24564 !! html/parsoid
24565 <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
24566 <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
24567 <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
24568 !! wikitext
24569 [[Category:Toxine bactérienne]]
24570 [[Category:Toxine bactérienne]]
24571 [[Category:Toxine bactérienne]]
24572 !! end
24573
24574 !! test
24575 New sol transparent links don't need indent-pre nowiki protection
24576 !! options
24577 parsoid=html2wt
24578 language=de
24579 !! html/parsoid
24580 <link rel="mw:PageProp/redirect" href="./Main_Page">
24581 <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
24582 <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
24583 !! wikitext
24584 #WEITERLEITUNG [[Main Page]]
24585 <!-- this is good --> [[Category:Good]]
24586 <!-- this is great --> [[Kategorie:Great]]
24587 !! end
24588
24589 !! test
24590 New interlanguage links (href variations)
24591 !! options
24592 parsoid=html2wt
24593 !! html/parsoid
24594 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
24595 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
24596 <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
24597 !! wikitext
24598 [[es:Toxine bactérienne]]
24599 [[es:Toxine_bactérienne]]
24600 [[es:Toxine_bactérienne]]
24601 !! end
24602
24603 !! test
24604 Image: Modifying size of an image (1)
24605 !! options
24606 parsoid={
24607 "modes": ["wt2wt"],
24608 "changes": [
24609 ["img[height]", "attr", "height", "22"],
24610 ["img[width]", "attr", "width", "200"]
24611 ]
24612 }
24613 !! wikitext
24614 [[Image:Foobar.jpg|230x230px]]
24615 !! wikitext/edited
24616 [[Image:Foobar.jpg|200x200px]]
24617 !!end
24618
24619 !! test
24620 Image: Modifying size of an image (2)
24621 !! options
24622 parsoid={
24623 "modes": ["wt2wt"],
24624 "changes": [
24625 ["img[height]", "attr", "height", "100"],
24626 ["img[width]", "attr", "width", "500"]
24627 ]
24628 }
24629 !! wikitext
24630 [[Image:Foobar.jpg|230x230px]]
24631 !! wikitext/edited
24632 [[Image:Foobar.jpg|500x500px]]
24633 !!end
24634
24635 # Change in size is ignored so long as class='mw-default-size'
24636 !! test
24637 Image: Modifying size of an image (3)
24638 !! options
24639 parsoid={
24640 "modes": ["wt2wt"],
24641 "changes": [
24642 ["figure[class]", "removeClass", "mw-default-size"],
24643 ["figure img", "attr", "height", "19"],
24644 ["figure img", "attr", "width", "170"]
24645 ]
24646 }
24647 !! wikitext
24648 [[Image:Foobar.jpg|thumb]]
24649 !! wikitext/edited
24650 [[Image:Foobar.jpg|thumb|170x170px]]
24651 !!end
24652
24653 !! test
24654 Image: Modifying alignment of an image (bug 48665)
24655 !! options
24656 parsoid={
24657 "modes": ["wt2wt"],
24658 "changes": [
24659 ["figure[class]", "removeClass", "mw-halign-right"],
24660 ["figure[class]", "addClass", "mw-halign-left"]
24661 ]
24662 }
24663 !! wikitext
24664 [[Image:Foobar.jpg|thumb|caption|right]]
24665 !! wikitext/edited
24666 [[Image:Foobar.jpg|thumb|caption|left]]
24667 !! end
24668
24669 !! test
24670 Image: Modifying mw-default-size of an frameless image (bug 62805)
24671 !! options
24672 parsoid={
24673 "modes": ["wt2wt"],
24674 "changes": [
24675 ["figure.mw-default-size", "removeClass", "mw-default-size"]
24676 ]
24677 }
24678 !! wikitext
24679 [[Image:Foobar.jpg|frameless|right]]
24680 !! wikitext/edited
24681 [[Image:Foobar.jpg|frameless|right|220x220px]]
24682 !! end
24683
24684 !! test
24685 Image: Modifying valign of an image (bug 49221)
24686 !! options
24687 parsoid={
24688 "modes": ["wt2wt"],
24689 "changes": [
24690 ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
24691 ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
24692 ]
24693 }
24694 !! wikitext
24695 [[File:Foobar.jpg|20px|middle]]
24696 !! wikitext/edited
24697 [[File:Foobar.jpg|20px|text-top]]
24698 !! end
24699
24700 !! test
24701 Image: Modifying alt attribute of an image (bug 56400)
24702 !! options
24703 parsoid={
24704 "modes": ["wt2wt"],
24705 "changes": [
24706 ["img[alt]", "attr", "alt", "some alternate edited text"]
24707 ]
24708 }
24709 !! wikitext
24710 [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
24711 !! wikitext/edited
24712 [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
24713 !!end
24714
24715 !! test
24716 Image: Modifying caption of an image
24717 !! options
24718 parsoid={
24719 "modes": ["wt2wt"],
24720 "changes": [
24721 ["figcaption", "text", "new caption"]
24722 ]
24723 }
24724 !! wikitext
24725 [[Image:Foobar.jpg|thumb|original caption]]
24726 !! wikitext/edited
24727 [[Image:Foobar.jpg|thumb|new caption]]
24728 !!end
24729
24730 !! test
24731 Image: empty alt attribute (bug 48924)
24732 !! options
24733 parsoid
24734 !! wikitext
24735 [[File:Foobar.jpg|thumb|alt=|bar]]
24736 !! html
24737 <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>
24738 !! end
24739
24740 !! test
24741 Image: new attributes should be serialized in wiki's language for RTL languages (bug 51852)
24742 !! options
24743 parsoid=html2wt
24744 language=ar
24745 disabled
24746 !! html/parsoid
24747 <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>
24748 !! wikitext
24749 [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
24750 !! end
24751
24752 !! test
24753 Image: Block level image should have \n before and after
24754 !! wikitext
24755 123
24756 [[File:Foobar.jpg|right|thumb|150x150px]]
24757 456
24758 !! html/parsoid
24759 <p>123</p>
24760 <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>
24761 <p>456</p>
24762 !!end
24763
24764 !! test
24765 Image: New block level image should have \n before and after (existing content)
24766 !! wikitext
24767 123
24768 [[File:Foobar.jpg|right|thumb|150x150px]]
24769 456
24770 !! html/parsoid
24771 <p>123</p>
24772 <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>
24773 <p>456</p>
24774 !!end
24775
24776 !! test
24777 Image: upright option (parsoid)
24778 !! wikitext
24779 [[File:Foobar.jpg|thumb|upright|caption]]
24780 [[File:Foobar.jpg|thumb|upright=0.5|caption]]
24781 [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
24782 !! html/parsoid
24783 <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>
24784 <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>
24785 <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>
24786 !!end
24787
24788 !! test
24789 Image: upright option is ignored on inline and frame images (parsoid)
24790 !! wikitext
24791 [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
24792 !! html/parsoid
24793 <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>
24794 !!end
24795
24796 !! test
24797 Image: from basic HTML (1)
24798 !! options
24799 parsoid=html2wt
24800 !! html/parsoid
24801 <span typeof="mw:Image">
24802 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24803 </span>
24804 !! wikitext
24805 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24806 !! end
24807
24808 !! test
24809 Image: from basic HTML (2)
24810 !! options
24811 parsoid=html2wt
24812 !! html/parsoid
24813 <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
24814 !! wikitext
24815 [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
24816 !! end
24817
24818 !! test
24819 Image: from basic HTML (3)
24820 !! options
24821 parsoid=html2wt
24822 !! html/parsoid
24823 <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
24824 !! wikitext
24825 [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
24826 !! end
24827
24828 !! test
24829 Image: from basic HTML (4)
24830 !! options
24831 parsoid=html2wt
24832 !! html/parsoid
24833 <img src="./File:Foobar.jpg">
24834 !! wikitext
24835 [[File:Foobar.jpg|link=]]
24836 !! end
24837
24838 !! test
24839 Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
24840 !! options
24841 parsoid=html2wt
24842 !! html/parsoid
24843 <ul>
24844 <li><p>foo</p></li>
24845 </ul>
24846 !! wikitext
24847 * foo
24848 !! end
24849
24850 !! test
24851 Lists: Serialize correctly even when list tags has unneeded whitespace between tags
24852 !! options
24853 parsoid=html2wt
24854 !! html/parsoid
24855 <ul> <li>foo</li></ul>
24856 !! wikitext
24857 * foo
24858 !! end
24859
24860 !! test
24861 Don't strip leading whitespace when handling indent-pre suppressing tags
24862 !! options
24863 parsoid=html2wt
24864 !! html/parsoid
24865 <table>
24866 <tr><td> indented row</td></tr>
24867 </table>
24868 <blockquote><p>
24869 <b>This is very bold of you!</b>
24870 </p>
24871 <table><tr><td>
24872 indented cell (no pre-wrapping!)
24873 </td></tr></table>
24874 </blockquote>
24875 <p>foo</p>
24876 <div>bar</div>
24877 !! wikitext
24878 {|
24879 | indented row
24880 |}
24881 <blockquote>
24882 '''This is very bold of you!'''
24883
24884 {|
24885 |
24886 indented cell (no pre-wrapping!)
24887 |}
24888 </blockquote>
24889 foo
24890 <div>bar</div>
24891 !! end
24892
24893 !! test
24894 Nowiki-wrap leading whitespace when handling indent-pre inducing tags
24895 !! options
24896 parsoid=html2wt
24897 !! html/parsoid
24898 <p>foo</p>
24899 <span>bar</span>
24900
24901 <span>foo2
24902 </span>bar2
24903
24904 <div>foo</div>
24905 <span>bar</span>
24906
24907 <div>
24908 <span>foo</span>
24909 </div>
24910 !! wikitext
24911 foo
24912
24913 <span>bar</span>
24914
24915 <span>foo2
24916 <nowiki> </nowiki></span>bar2
24917
24918 <div>foo</div>
24919 <nowiki> </nowiki><span>bar</span>
24920
24921 <div>
24922 <nowiki> </nowiki><span>foo</span>
24923 </div>
24924 !! end
24925
24926 !! test
24927 Lists: Dont insert newlines in a serialized list item.
24928 !! options
24929 parsoid=html2wt
24930 !! html/parsoid
24931 <ul><li>a<br>b</li><li>c</li></ul>
24932 !! wikitext
24933 * a<br>b
24934 * c
24935 !! end
24936
24937 !! test
24938 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
24939 !! options
24940 parsoid={
24941 "modes": ["html2wt"],
24942 "scrubWikitext": false
24943 }
24944 !! html/parsoid
24945 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
24946 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
24947
24948 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
24949 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
24950
24951 <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
24952
24953 <h2><meta property="mw:PageProp/toc" /> ok</h2>
24954 !! wikitext
24955 == hello there [[Category:A1]] ==
24956
24957 == [[Category:A2]] hi pal ==
24958
24959 == <!--foo--> [[Category:A3]] how goes it ==
24960
24961 == it goes well [[Category:A4]] <!--bar--> ==
24962
24963 ==howdy [[Category:A5]]==
24964
24965 == __TOC__ ok ==
24966 !! end
24967
24968 !! test
24969 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
24970 !! options
24971 parsoid={
24972 "modes": ["html2wt"],
24973 "scrubWikitext": true
24974 }
24975 !! html/parsoid
24976 <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
24977 <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
24978
24979 <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
24980 <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
24981
24982 <h2><meta property="mw:PageProp/toc" /> ok</h2>
24983 !! wikitext
24984 == hello there ==
24985 [[Category:A1]]
24986 [[Category:A2]]
24987
24988 == hi pal ==
24989
24990 <!--foo--> [[Category:A3]]
24991
24992 == how goes it ==
24993
24994 == it goes well ==
24995 [[Category:A4]] <!--bar-->
24996
24997 __TOC__
24998
24999 == ok ==
25000 !! end
25001
25002 !! test
25003 Headings: Don't hoist metas that come from templates
25004 !! options
25005 parsoid={
25006 "modes": ["html2wt"],
25007 "scrubWikitext": true
25008 }
25009 !! html/parsoid
25010 <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>
25011 !! wikitext
25012 == {{echo|foo [[Category:Foo]]}} ==
25013 !! end
25014
25015 !! test
25016 Headings: Category in ref isn't hoisted
25017 !! options
25018 parsoid={
25019 "modes": ["html2wt"],
25020 "scrubWikitext": true
25021 }
25022 !! html/parsoid
25023 <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>
25024
25025 <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>
25026 !! wikitext
25027 == foo <ref>bar
25028 [[Category:Baz]] </ref> ==
25029
25030 <references />
25031 !! end
25032
25033 !! test
25034 Parsoid: Serialize positional parameters with = in them as named parameter
25035 !! options
25036 parsoid=html2wt
25037 !! html/parsoid
25038 <p about="#mwt1" typeof="mw:Transclusion"
25039 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
25040
25041 <p about="#mwt1" typeof="mw:Transclusion"
25042 data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
25043
25044 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25045 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25046 <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>
25047 !! wikitext
25048 {{echo|1 = f=oo}}
25049
25050 {{echo|1 = f=oo|2 = bar}}
25051
25052 <!--Orig params with data-parsoid has heuristics for handling = chars-->
25053 <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
25054 {{echo|<nowiki>f=oo</nowiki>|bar}}
25055 !! end
25056
25057 !! test
25058 Parsoid: Serialize positional parameters with = in extlink as named parameter
25059 !! options
25060 parsoid=html2wt
25061 !! html/parsoid
25062 <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>
25063 !! wikitext
25064 {{echo|1 = http://stuff?is=ok}}
25065 !! end
25066
25067 !! test
25068 Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
25069 !! options
25070 parsoid=html2wt
25071 !! html/parsoid
25072 <div>a<p>b</p></div>
25073 <div>a
25074 <p>b</p></div>
25075 <div>
25076 a
25077 <p>b</p></div>
25078 !! wikitext
25079 <div>a
25080 b
25081 </div>
25082 <div>a
25083 b
25084 </div>
25085 <div>
25086 a
25087
25088 b
25089 </div>
25090 !! end
25091
25092 !! test
25093 Substrings resembling wikitext in hrefs should not get nowiki escapes
25094 !! options
25095 parsoid=html2wt
25096 !! html/parsoid
25097 <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
25098 !! wikitext
25099 [[Foo''bar''baz]]
25100 !! end
25101
25102 !! test
25103 Enforce single-line context in the serializer
25104 !! options
25105 parsoid=html2wt
25106 !! html/parsoid
25107 <h2>testing
25108 123</h2>
25109
25110 <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">
25111 </span><span about="#mwt1">you</span> </h2>
25112
25113 <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>
25114
25115 <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
25116 there</span></li></ol>
25117
25118 <ul><li>asd
25119 sdf</li></ul>
25120
25121 <ul><li>foo
25122 bar
25123 baz</li>
25124 <li>foo <b>bar</b>
25125 baz</li></ul>
25126
25127 <dl><dt>hi
25128 ho </dt><dd data-parsoid='{"stx":"row"}'> hi
25129 ho</dd></dl>
25130
25131 <dl><dd> <table>
25132 <tbody><tr><td> ha
25133 ha
25134 ha</td></tr>
25135 </tbody></table></dd></dl>
25136 !! wikitext
25137 == testing 123 ==
25138
25139 == hi {{bogus|there
25140 you}} ==
25141
25142 == foo <ref>hello
25143 there</ref> ==
25144
25145 <references />
25146
25147 * asd sdf
25148
25149 * foo bar baz
25150 * foo '''bar''' baz
25151
25152 ; hi ho : hi ho
25153
25154 : {|
25155 | ha
25156 ha
25157 ha
25158 |}
25159 !! end
25160
25161 !! test
25162 Serialize new placeholder space without spans
25163 !! options
25164 parsoid=html2wt
25165 !! html/parsoid
25166 <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
25167
25168 <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
25169
25170 <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>
25171 !! wikitext
25172 foo : bar
25173
25174 foo : bar
25175
25176 <ref>foo : bar</ref>ok
25177 !! end
25178
25179
25180 #-----------------------
25181 # Tag minimization tests
25182 #-----------------------
25183
25184 !! test
25185 1. I/B quote minimization: wikitext-only tags should be combined
25186 !! options
25187 parsoid=html2wt
25188 !! html/parsoid
25189 <p><i>A</i><i>B</i></p>
25190 <p><b>A</b><b>B</b></p>
25191 <p><i>A</i><b><i>B</i></b></p>
25192 <p><b>A</b><i><b>B</b></i></p>
25193 <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
25194 <p><i><b>A</b></i><i><b>B</b></i></p>
25195 <p><i><b>A</b></i><b><i>B</i></b></p>
25196 <p><b><i>A</i></b><i><b>B</b></i></p>
25197 !! wikitext
25198 ''AB''
25199
25200 '''AB'''
25201
25202 ''A'''B'''''
25203
25204 '''A''B'''''
25205
25206 '''A''BC''D'''
25207
25208 '''''AB'''''
25209
25210 '''''AB'''''
25211
25212 '''''AB'''''
25213 !! end
25214
25215 !! test
25216 2. I/B quote minimization: wikitext and html tags should not be combined
25217 !! options
25218 parsoid=html2wt
25219 !! html/parsoid
25220 <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
25221 <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
25222 !! wikitext
25223 ''A''<i>B</i>
25224
25225 ''A''<nowiki/>'''<i>B</i>'''
25226 !! end
25227
25228 !! test
25229 3. I/B quote minimization: templated content stops minimization
25230 !! options
25231 parsoid=html2wt
25232 !! html/parsoid
25233 <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>
25234 <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>
25235 !! wikitext
25236 ''A''{{echo|''B''}}
25237
25238 ''A''{{echo|'''''B'''''}}
25239 !! end
25240
25241 !! test
25242 4. I/B quote minimization: new content should be mimimized with adjacent old content
25243 !! options
25244 parsoid=html2wt
25245 !! html/parsoid
25246 <p><i>A</i><i>B</i></p>
25247 <p><b>A</b><b>B</b></p>
25248 <p><i>A</i><b><i>B</i></b></p>
25249 !! wikitext
25250 ''AB''
25251
25252 '''AB'''
25253
25254 ''A'''B'''''
25255 !! end
25256
25257 !! test
25258 5a. Merge adjacent quote nodes if they've been edited
25259 !! options
25260 parsoid={
25261 "modes": ["wt2wt", "selser"],
25262 "changes": [
25263 ["p", "contents", "remove", ":contains('b')"]
25264 ]
25265 }
25266 !! wikitext
25267 ''a''b''c''
25268 !! wikitext/edited
25269 ''ac''
25270 !! end
25271
25272 !! test
25273 5b. Merge adjacent quote nodes if they've been edited
25274 !! options
25275 parsoid={
25276 "modes": ["wt2wt", "selser"],
25277 "changes": [
25278 ["#x", "remove"]
25279 ]
25280 }
25281 !! wikitext
25282 ''a''<span id="x">b</span>''c''
25283 !! wikitext/edited
25284 ''ac''
25285 !! end
25286
25287 !! test
25288 1. Merge adjacent link nodes as long as at least one element is new
25289 !! options
25290 parsoid={
25291 "modes": ["html2wt"],
25292 "scrubWikitext": true
25293 }
25294 !! html/parsoid
25295 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25296 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25297 <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
25298 !! wikitext
25299 [[Football]]
25300 [[Football]]
25301 [[Football|Foot]][[Football|ball]]
25302 !! end
25303
25304 !! test
25305 2. Merge adjacent link nodes and enable additional normalizations
25306 !! options
25307 parsoid={
25308 "modes": ["html2wt"],
25309 "scrubWikitext": true
25310 }
25311 !! html/parsoid
25312 <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
25313 !! wikitext
25314 [[Football|''Football'']]
25315 !! end
25316
25317 !! test
25318 3. Don't merge adjacent link nodes if scrubWikitext is false
25319 !! options
25320 parsoid={
25321 "modes": ["html2wt"],
25322 "scrubWikitext": false
25323 }
25324 !! html/parsoid
25325 <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
25326 !! wikitext
25327 [[Football|Foot]][[Football|ball]]
25328 !! end
25329
25330 #------------------------------
25331 # End of tag minimization tests
25332 #------------------------------
25333
25334 !!test
25335 Bug 54262: New entities
25336 !! options
25337 parsoid=html2wt
25338 !! html/parsoid
25339 <span typeof="mw:Entity">&nbsp;</span>
25340 !! wikitext
25341 &nbsp;
25342 !! end
25343
25344 ## Note that there is no wikitext output for 'unknownproperty' ##
25345 ## Unknown magic words are silently dropped ##
25346
25347 !! test
25348 Magic words
25349 !! options
25350 parsoid=html2wt
25351 !! html/parsoid
25352 <meta property='mw:PageProp/toc' />
25353 <meta property='mw:PageProp/notoc' />
25354 <meta property='mw:PageProp/forcetoc' />
25355 <meta property='mw:PageProp/index' />
25356 <meta property='mw:PageProp/noindex' />
25357 <meta property='mw:PageProp/nogallery' />
25358 <meta property='mw:PageProp/noeditsection' />
25359 <meta property='mw:PageProp/notitleconvert' />
25360 <meta property='mw:PageProp/nocontentconvert' />
25361 <meta property='mw:PageProp/unknownproperty' />
25362 !! wikitext
25363 __TOC__
25364 __NOTOC__
25365 __FORCETOC__
25366 __INDEX__
25367 __NOINDEX__
25368 __NOGALLERY__
25369 __NOEDITSECTION__
25370 __NOTITLECONVERT__
25371 __NOCONTENTCONVERT__
25372 !! end
25373
25374 !! test
25375 Consecutive <pre>s should not get merged
25376 !! options
25377 parsoid=html2wt,html2html
25378 !! html/parsoid
25379 <pre>a</pre><pre>b</pre>
25380
25381 <pre>c
25382 </pre><pre>
25383 d</pre>
25384
25385 <pre>e
25386
25387 </pre><pre>
25388
25389 f</pre>
25390 !! wikitext
25391 a
25392
25393 b
25394
25395 c
25396
25397 d
25398
25399 e
25400
25401
25402
25403 f
25404 !! end
25405
25406 !! test
25407 Edited ISBN links not serializable as ISBN links should serialize as wikilinks
25408 !! options
25409 parsoid=html2wt
25410 !! html/parsoid
25411 <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
25412 !! wikitext
25413 [[Special:BookSources/1234567890|ISBN 1234567895]]
25414 !! end
25415
25416 !! test
25417 Edited RFC links not serializable as RFC links should serialize as extlinks
25418 !! options
25419 parsoid=html2wt
25420 !! html/parsoid
25421 <a href="//tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
25422 !! wikitext
25423 [//tools.ietf.org/html/rfc123 New RFC]
25424 !! end
25425
25426 !! test
25427 Edited PMID links not serializable as PMID links should serialize as extlinks
25428 !! options
25429 parsoid=html2wt
25430 !! html/parsoid
25431 <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
25432 !! wikitext
25433 [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
25434 !! end
25435
25436 !! test
25437 WTS of autolinks with trailing/surrounding context
25438 !! options
25439 parsoid=html2wt
25440 !! html/parsoid
25441 <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
25442 <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
25443 <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
25444 <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
25445 <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
25446 <p><a href="http://cscott.net">http://cscott.net</a>x</p>
25447 !! wikitext
25448 http://cscott.net'''foo'''
25449
25450 http://cscott.net<b>foo</b>
25451
25452 '''http://cscott.net'''
25453
25454 '''http://cscott.net '''
25455
25456 '''http://cscott.net<nowiki/>x'''
25457
25458 http://cscott.net<nowiki/>x
25459 !! end
25460
25461 !! test
25462 WTS of autolinks with nowikis (round-trip)
25463 !! wikitext
25464 x<nowiki/>http://cscott.net<nowiki/>x
25465 !! html/parsoid
25466 <p>x<a rel="mw:ExtLink" href="http://cscott.net">http://cscott.net</a>x</p>
25467 !! end
25468
25469 # this is the "easy" test because it leaves in place all the
25470 # data-parsoid information indicating this is an autolink
25471 !! test
25472 WTS of autolinks with escapes (editing)
25473 !! options
25474 parsoid={
25475 "modes": ["wt2wt"],
25476 "changes": [
25477 [ "meta", "remove" ]
25478 ]
25479 }
25480 !! wikitext
25481 x<nowiki/>http://cscott.net<nowiki/>x
25482 !! wikitext/edited
25483 x<nowiki/>http://cscott.net<nowiki/>x
25484 !! end
25485
25486 !! test
25487 WTS of edited autolink-like text (T103364)
25488 !! options
25489 parsoid={
25490 "modes": ["wt2wt"],
25491 "changes": [
25492 [ "span[typeof]", "removeAttr", "typeof" ]
25493 ]
25494 }
25495 !! wikitext
25496 Not a link: <nowiki>http://example.com</nowiki>.
25497 !! wikitext/edited
25498 Not a link: <span><nowiki>http://example.com</nowiki></span>.
25499 !! end
25500
25501 !! test
25502 WTS of newly-authored autolink-like text (T103364)
25503 !! options
25504 parsoid=html2wt
25505 !! html/parsoid
25506 <p>http://example.com is not a link.</p>
25507 !! wikitext
25508 <nowiki>http://example.com</nowiki> is not a link.
25509 !! end
25510
25511 !! test
25512 WTS of autolink-like text after an autolink (T108563)
25513 !! options
25514 parsoid=html2wt
25515 !! html/parsoid
25516 <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
25517 !! wikitext
25518 http://example.com <nowiki>http://example.com</nowiki> is not a link.
25519 !! end
25520
25521 !! test
25522 Magic links inside links (not autolinked)
25523 !! wikitext
25524 [[Foo|http://example.com]]
25525 [[Foo|RFC 1234]]
25526 [[Foo|PMID 1234]]
25527 [[Foo|ISBN 123456789x]]
25528
25529 [http://foo.com http://example.com]
25530 [http://foo.com RFC 1234]
25531 [http://foo.com PMID 1234]
25532 [http://foo.com ISBN 123456789x]
25533 !! html+tidy
25534 <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>
25535 <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>
25536 !! html/parsoid
25537 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
25538 <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
25539 <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
25540 <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
25541
25542 <p><a rel="mw:ExtLink" href="http://foo.com">http://example.com</a>
25543 <a rel="mw:ExtLink" href="http://foo.com">RFC 1234</a>
25544 <a rel="mw:ExtLink" href="http://foo.com">PMID 1234</a>
25545 <a rel="mw:ExtLink" href="http://foo.com">ISBN 123456789x</a></p>
25546 !! end
25547
25548 !! test
25549 Magic links inside image captions (autolinked)
25550 !! wikitext
25551 [[File:Foobar.jpg|thumb|http://example.com]]
25552 [[File:Foobar.jpg|thumb|RFC 1234]]
25553 [[File:Foobar.jpg|thumb|PMID 1234]]
25554 [[File:Foobar.jpg|thumb|ISBN 123456789x]]
25555 !! html+tidy
25556 <div class="thumb tright">
25557 <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>
25558 <div class="thumbcaption">
25559 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25560 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div>
25561 </div>
25562 </div>
25563 <div class="thumb tright">
25564 <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>
25565 <div class="thumbcaption">
25566 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25567 <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a></div>
25568 </div>
25569 </div>
25570 <div class="thumb tright">
25571 <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>
25572 <div class="thumbcaption">
25573 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25574 <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div>
25575 </div>
25576 </div>
25577 <div class="thumb tright">
25578 <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>
25579 <div class="thumbcaption">
25580 <div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>
25581 <a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div>
25582 </div>
25583 </div>
25584 !! html/parsoid
25585 <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>
25586 <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>
25587 <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>
25588 <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>
25589 !! end
25590
25591 !! test
25592 WTS of magic word text (T109371)
25593 !! options
25594 parsoid=html2wt
25595 !! html/parsoid
25596 <p>RFC 1234</p>
25597 <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
25598 <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
25599 !! wikitext
25600 <nowiki>RFC 1234</nowiki>
25601
25602 [http://foo.com RFC 1234]
25603
25604 [[Foo|RFC 1234]]
25605 !! end
25606
25607 !! test
25608 Edited Redirect link should emit a non-piped wikitext link
25609 !! options
25610 parsoid=html2wt
25611 !! html/parsoid
25612 <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
25613 !! wikitext
25614 #REDIRECT [[Bar]]
25615 !! end
25616
25617 !! test
25618 T75121: Infer extension name from typeOf if data-mw is not present
25619 !! options
25620 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25621 !! html/parsoid
25622 <div typeOf="mw:Extension/foo"></div>
25623 !! wikitext
25624 <foo />
25625 !! end
25626
25627 # Note that the <p> wrapping isn't present in PHP parser output
25628 # The important thing for this test is that P-wrapping doesn't
25629 # interfere with the <nowiki> protection for leading - in <td>
25630 # (which isn't necessary for <th>).
25631 !! test
25632 T88318: p-wrapped dash in table.
25633 !! options
25634 parsoid=html2wt,wt2wt
25635 !! html/parsoid
25636 <table><tbody>
25637 <tr><th><p>-</p></th><th><p>- </p></th></tr>
25638 <tr><td><p>-</p></td><td><p>- </p></td></tr>
25639 <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
25640 </tbody></table>
25641 !! wikitext
25642 {|
25643 !-
25644 !-
25645 |-
25646 |<nowiki>-</nowiki>
25647 |<nowiki>- </nowiki>
25648 |-
25649 |<small>-</small>
25650 |<br>
25651 -
25652 |<br>
25653 -
25654 |}
25655 !! html/php+tidy
25656 <table>
25657 <tr>
25658 <th>-</th>
25659 <th>-</th>
25660 </tr>
25661 <tr>
25662 <td>-</td>
25663 <td>-</td>
25664 </tr>
25665 <tr>
25666 <td><small>-</small></td>
25667 <td><br />
25668 <p>-</p>
25669 </td>
25670 <td><br />
25671 <p>-</p>
25672 </td>
25673 </tr>
25674 </table>
25675 !! end
25676
25677 !! test
25678 HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
25679 !! options
25680 parsoid=html2wt
25681 !! html/parsoid
25682 <table id='mwAb'>
25683 <td id='mwAc'>foo</td>
25684 <td id='serialize-this'>bar</td>
25685 </table>
25686 !! wikitext
25687 {|
25688 |foo
25689 | id="serialize-this" |bar
25690 |}
25691 !! end
25692
25693 !! test
25694 Parsoid-like element ids should not be serialized to wikitext unless shadowed
25695 !! options
25696 parsoid=html2wt
25697 !! html/parsoid
25698 <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
25699 !! wikitext
25700 <div id="hello">ok</div>
25701 !! end
25702
25703 !! test
25704 WTS change modes
25705 !! options
25706 parsoid={
25707 "modes": ["wt2wt"],
25708 "changes": [
25709 [ "#xyz", "before", "<b>before</b> stuff " ],
25710 [ "#xyz", "after", " stuff <i>after</i>" ],
25711 [ "#xyz", "html", "x <b>y</b> z" ]
25712 ]
25713 }
25714 !! wikitext
25715 <span id="xyz">hello</span>
25716 !! wikitext/edited
25717 '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
25718 !! end
25719
25720 !! test
25721 Never serialize a-tag as html, regardless of what data-parsoid has to say
25722 !! options
25723 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25724 !! html/parsoid
25725 <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
25726 !! wikitext
25727 [[Foo]]
25728 !! end
25729
25730 ## SSS FIXME: This is broken output nevertheless.
25731 ## What might be a reasonable non-broken output for this?
25732 ## This is an edge case unlikely to be seen in production
25733 ## that I am not wasting more time on this right now.
25734 !! test
25735 Never serialize a-tag as html, no matter what attributes it has
25736 !! options
25737 parsoid={ "modes": ["html2wt"], "suppressErrors": true }
25738 !! html/parsoid
25739 <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
25740 !! wikitext
25741 [http://boo.org http://boohoo.org]
25742 !! end
25743
25744 # Misnested is an indication that selser can reuse the source but these have
25745 # shown to sneak through on occasion. See T101768.
25746 # The original wikitext here is: [http://test.com [[one]] two three]
25747 !! test
25748 Strip span tags added to mark misnested links
25749 !! options
25750 parsoid=html2wt
25751 !! html/parsoid
25752 <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>
25753 !! wikitext
25754 [http://test.com][[one]] two three
25755 !! end
25756
25757 !! test
25758 Use data-parsoid.firstWikitextNode to compute newline constraints for template content
25759 !! options
25760 parsoid=html2wt
25761 !! html/parsoid
25762 <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|}"]}'>
25763 <tbody><tr><td>d
25764 </td></tr>
25765 </tbody></table>
25766 !! wikitext
25767 {{echo|a}}
25768 {|{{echo|c
25769 {{!}}d
25770 }}
25771 |}
25772 !! end
25773
25774 ## This test verifies the presence and computation of this attribute indirectly
25775 ## by making an edit and ensuring that the serialization is correct (which it would be
25776 ## only if firstWikitextNode is properly set).
25777 !! test
25778 data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
25779 !! options
25780 parsoid= {
25781 "modes": ["wt2wt"],
25782 "changes": [
25783 [ "div#x", "remove" ],
25784 [ "div", "before", "<div>new</div>" ]
25785 ]
25786 }
25787 !! wikitext
25788 <div id="x">foo</div>
25789 {|
25790 {{echo|<div>boo</div>
25791 {{!}}b}}
25792 |c
25793 |}
25794 !! wikitext/edited
25795
25796 <div>new</div>
25797 {|
25798 {{echo|<div>boo</div>
25799 {{!}}b}}
25800 |c
25801 |}
25802 !! end
25803
25804 # --------------------------------------------
25805 # Tests spec'ing wikitext serialization norms |
25806 # --------------------------------------------
25807
25808 !! test
25809 1. Categories should always be serialized on their own line
25810 !! options
25811 parsoid=html2wt
25812 !! html/parsoid
25813 foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
25814 !! wikitext
25815 foo
25816 [[Category:Foo]]
25817 bar
25818 !! end
25819
25820 !! test
25821 2. Categories that are part of templates should not introduce a line break
25822 !! wikitext
25823 foo {{echo|<span>bar</span> [[Category:baz]]}} bar
25824 !! html/parsoid
25825 <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>
25826 !! end
25827
25828 # Careful while editing these next 2 tests. There are \u200f characters
25829 # before and after the <link> tags in the HTML and following some
25830 # of the categories in wikitext
25831 # Do not remove these characters in edits.
25832 #
25833 # As part of the serialization, these bidi characters will get stripped.
25834 !! test
25835 RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
25836 !! options
25837 parsoid={
25838 "modes": ["html2wt"],
25839 "scrubWikitext": true
25840 }
25841 !! html/parsoid
25842 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
25843 ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
25844 !! wikitext
25845 [[קטגוריה:טקסים]]
25846 [[קטגוריה: שיטות משפט]]
25847 !! end
25848
25849 !! test
25850 RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
25851 !! options
25852 parsoid={
25853 "modes": ["html2wt"],
25854 "scrubWikitext": true
25855 }
25856 !! html/parsoid
25857 <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
25858 !! wikitext
25859 [[קטגוריה:טקסים]]
25860 ‏y
25861 !! end
25862
25863 !! test
25864 Lists: Add space after bullets
25865 !! options
25866 parsoid=html2wt
25867 !! html/parsoid
25868 <ul>
25869 <li>foo</li>
25870 <li> bar</li>
25871 <li><span> baz</span></li>
25872 </ul>
25873 !! wikitext
25874 * foo
25875 * bar
25876 * <span> baz</span>
25877 !! end
25878
25879 !! test
25880 1. Headings: Add space before/after == (T53744)
25881 !! options
25882 parsoid=html2wt
25883 !! html/parsoid
25884 <h2>foo</h2>
25885 <h2> bar</h2>
25886 <h2>baz </h2>
25887 <h2><span> baz</span></h2>
25888 !! wikitext
25889 == foo ==
25890
25891 == bar ==
25892
25893 == baz ==
25894
25895 == <span> baz</span> ==
25896 !! end
25897
25898 !! test
25899 2. Headings: Add space before/after == even after hoisted content
25900 !! options
25901 parsoid={
25902 "modes": ["html2wt"],
25903 "scrubWikitext": true
25904 }
25905 !! html/parsoid
25906 <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
25907 !! wikitext
25908 [[Category:A2]]
25909
25910 == ok ==
25911 !! end
25912
25913 !! test
25914 1. Headings: suppress newly created empty headings
25915 !! options
25916 parsoid={
25917 "modes": ["html2wt"],
25918 "scrubWikitext": true
25919 }
25920 !! html/parsoid
25921 <h2></h2>
25922 !! wikitext
25923 !! end
25924
25925 !! test
25926 2. Headings: don't suppress empty headings if scrubWikitext is false
25927 !! options
25928 parsoid=html2wt
25929 !! html/parsoid
25930 <h2></h2>
25931 !! wikitext
25932 ==<nowiki/>==
25933 !! end
25934
25935 !! test
25936 3. Headings: suppress empty headings on edits
25937 !! options
25938 parsoid={
25939 "modes": ["selser"],
25940 "scrubWikitext": true,
25941 "changes": [
25942 [ "#x", "remove"]
25943 ]
25944 }
25945 !! wikitext
25946 ==<span id="x">foo</span>==
25947 !! wikitext/edited
25948 !! end
25949
25950 !! test
25951 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
25952 !! options
25953 parsoid={
25954 "modes": ["html2wt"],
25955 "scrubWikitext": true
25956 }
25957 !! html/parsoid
25958 <h2>foo<br/>bar</h2>
25959 <h2>foo <span><br/>bar</span> baz</h2>
25960 !! wikitext
25961 == foo bar ==
25962
25963 == foo <span> bar</span> baz ==
25964 !! end
25965
25966 !! test
25967 Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
25968 !! options
25969 parsoid={
25970 "modes": ["html2wt"],
25971 "scrubWikitext": false
25972 }
25973 !! html/parsoid
25974 <h2>foo<br/>bar</h2>
25975 !! wikitext
25976 == foo<br> bar ==
25977 !! end
25978
25979 !! test
25980 1. WT Quote Tags: suppress newly created empty style tags
25981 !! options
25982 parsoid={
25983 "modes": ["html2wt"],
25984 "scrubWikitext": true
25985 }
25986 !! html/parsoid
25987 <i></i><b></b>
25988 !! wikitext
25989 !! end
25990
25991 !! test
25992 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
25993 !! options
25994 parsoid=html2wt
25995 !! html/parsoid
25996 <i></i><b></b>
25997 !! wikitext
25998 ''<nowiki/>'''''<nowiki/>'''
25999 !! end
26000
26001 !! test
26002 3. WT Quote Tags: suppress empty style tags on edits
26003 !! options
26004 parsoid={
26005 "modes": ["selser"],
26006 "scrubWikitext": true,
26007 "changes": [
26008 [ "#x", "remove"]
26009 ]
26010 }
26011 !! wikitext
26012 '''<span id="x">foo</span>'''
26013 !! wikitext/edited
26014 !! end
26015
26016 !! test
26017 1. Anchors: suppress newly created empty anchors
26018 !! options
26019 parsoid={
26020 "modes": ["html2wt"],
26021 "scrubWikitext": true
26022 }
26023 !! html/parsoid
26024 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26025 !! wikitext
26026 !! end
26027
26028 !! test
26029 2. Anchors: don't suppress empty anchors if scrubWikitext is false
26030 !! options
26031 parsoid={
26032 "modes": ["html2wt"],
26033 "scrubWikitext": false
26034 }
26035 !! html/parsoid
26036 <a rel="mw:WikiLink" href="./Test" title="Test"></a>
26037 !! wikitext
26038 [[Test|<nowiki/>]]
26039 !! end
26040
26041 !! test
26042 3. Anchors: suppress empty anchors on edits
26043 !! options
26044 parsoid={
26045 "modes": ["selser"],
26046 "scrubWikitext": true,
26047 "changes": [
26048 [ "#x", "remove"]
26049 ]
26050 }
26051 !! wikitext
26052 [[Test|<span id="x">foo</span>]]
26053 !! wikitext/edited
26054 !! end
26055
26056 !! test
26057 3a. Anchors: do not suppress numbered extlinks
26058 !! options
26059 parsoid={
26060 "modes": ["wt2wt"],
26061 "scrubWikitext": true
26062 }
26063 !! wikitext
26064 [http://foo.com]
26065 !! html/parsoid
26066 <a rel="mw:ExtLink" href="http://foo.com"></a>
26067 !! end
26068
26069 !! test
26070 3b. Anchors: do not suppress numbered extlinks
26071 !! options
26072 parsoid={
26073 "modes": ["wt2wt"],
26074 "scrubWikitext": true,
26075 "changes": [
26076 [ "#x", "remove"]
26077 ]
26078 }
26079 !! wikitext
26080 [http://foo.com <span id="x">foo</span>]
26081 !! wikitext/edited
26082 [http://foo.com]
26083 !! end
26084
26085 !!test
26086 Normalizations should be restricted to edited content
26087 !!options
26088 parsoid={
26089 "modes": ["selser"],
26090 "scrubWikitext": true,
26091 "changes": [
26092 [ "h1", "before", "<i></i>"]
26093 ]
26094 }
26095 !!wikitext
26096 a
26097 = =
26098 b
26099 !!wikitext/edited
26100 a
26101 = =
26102 b
26103 !!end
26104
26105 !! test
26106 1. Multiple normalizations (html2wt)
26107 !! options
26108 parsoid={
26109 "modes": ["html2wt"],
26110 "scrubWikitext": true
26111 }
26112 !! html
26113 <h2><i></i></h2>
26114 <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
26115 </a><b><i></i></b>x</p>
26116 !! wikitext
26117
26118 [[foo]]
26119 x
26120
26121 !! end
26122
26123 !! test
26124 2. Multiple normalizations (selser)
26125 !! options
26126 parsoid={
26127 "modes": ["selser"],
26128 "scrubWikitext": true,
26129 "changes": [
26130 [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
26131 ]
26132 }
26133 !! wikitext
26134 <span id="x">foo</span>
26135 !! wikitext/edited
26136 <span id="x">foo</span>
26137
26138 x
26139 !! end
26140
26141 !! test
26142 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
26143 !! options
26144 parsoid={
26145 "modes": ["html2wt"],
26146 "scrubWikitext": true
26147 }
26148 !! html/parsoid
26149 <p> hi</p>
26150 <p> hello</p>
26151 !! wikitext
26152 hi
26153
26154 hello
26155 !! end
26156
26157 !! test
26158 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
26159 !! options
26160 parsoid=html2wt
26161 !! html/parsoid
26162 <p> hi</p>
26163 <p> hello</p>
26164 !! wikitext
26165 <nowiki> </nowiki>hi
26166
26167 <nowiki> </nowiki> hello
26168 !! end
26169
26170 !! test
26171 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
26172 !! options
26173 parsoid={
26174 "modes": ["html2wt"],
26175 "scrubWikitext": true
26176 }
26177 !! html/parsoid
26178 <p>Foo
26179 bar
26180 baz</p>
26181
26182 <table><tr><td>Foo
26183 bar
26184 baz bang</td></tr></table>
26185
26186 <p><!--boo--> foo
26187 bar</p>
26188
26189 <p> foo
26190 bar<span>boo</span></p>
26191 !! wikitext
26192 Foo
26193 bar
26194 baz
26195
26196 {|
26197 |Foo
26198 bar
26199 baz bang
26200 |}
26201
26202 <!--boo-->foo
26203 bar
26204
26205 foo
26206 bar<span>boo</span>
26207 !! end
26208
26209 !! test
26210 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
26211 !! options
26212 parsoid={
26213 "modes": ["selser"],
26214 "scrubWikitext": true,
26215 "changes": [
26216 [ "p", "html", " a\n b" ]
26217 ]
26218 }
26219 !! wikitext
26220 xyz
26221 !! wikitext/edited
26222 a
26223 b
26224 !! end
26225
26226 !! test
26227 1. New links that end in spaces
26228 !! options
26229 parsoid={
26230 "modes": ["html2wt"],
26231 "scrubWikitext": false
26232 }
26233 !! html/parsoid
26234 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26235 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26236 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26237 !! wikitext
26238 [[Berlin ]]<nowiki/>is the capital of Germany.
26239
26240 [[Foo ]]'''bar'''
26241
26242 [[Boston ]] is a city.
26243 !! end
26244
26245 !! test
26246 2. New links that end in spaces
26247 !! options
26248 parsoid={
26249 "modes": ["html2wt"],
26250 "scrubWikitext": true
26251 }
26252 !! html/parsoid
26253 <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
26254 <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
26255 <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
26256 !! wikitext
26257 [[Berlin]] is the capital of Germany.
26258
26259 [[Foo]] '''bar'''
26260
26261 [[Boston]] is a city.
26262 !! end
26263
26264 !! test
26265 1. Table cells with escapable prefixes
26266 !! options
26267 parsoid={
26268 "modes": ["html2wt"],
26269 "scrubWikitext": false
26270 }
26271 !! html
26272 <table>
26273 <tr><td>a</td></tr>
26274 <tr><td>-</td></tr>
26275 <tr><td>+</td></tr>
26276 </table>
26277 !! wikitext
26278 {|
26279 |a
26280 |-
26281 |<nowiki>-</nowiki>
26282 |-
26283 |<nowiki>+</nowiki>
26284 |}
26285 !! end
26286
26287 !! test
26288 2. Table cells with escapable prefixes
26289 !! options
26290 parsoid={
26291 "modes": ["html2wt"],
26292 "scrubWikitext": true
26293 }
26294 !! html
26295 <table>
26296 <tr><td>a</td></tr>
26297 <tr><td>-</td></tr>
26298 <tr><td>+</td></tr>
26299 </table>
26300 !! wikitext
26301 {|
26302 |a
26303 |-
26304 | -
26305 |-
26306 | +
26307 |}
26308 !! end
26309
26310 !! test
26311 3a. Table cells with escapable prefixes after edits
26312 !! options
26313 parsoid={
26314 "modes": ["selser"],
26315 "scrubWikitext": true,
26316 "changes": [
26317 [ "table tbody tr:first-child td:first-child", "remove"]
26318 ]
26319 }
26320 !! wikitext
26321 {|
26322 |a||-
26323 |}
26324 !! wikitext/edited
26325 {|
26326 | -
26327 |}
26328 !! end
26329
26330 !! test
26331 3b. Table cells with escapable prefixes after edits
26332 !! options
26333 parsoid={
26334 "modes": ["selser"],
26335 "scrubWikitext": true,
26336 "changes": [
26337 [ "table tbody tr:first-child td:first-child", "html", "-" ],
26338 [ "#x", "remove" ]
26339 ]
26340 }
26341 !! wikitext
26342 {|
26343 |pqr
26344 |<span id="x">foo</span>+
26345 |}
26346 !! wikitext/edited
26347 {|
26348 | -
26349 | +
26350 |}
26351 !! end
26352
26353 # FIXME: This test will fail because
26354 # normalization doesn't realize that the id attribute
26355 # will eliminate the escapable scenario
26356 !! test
26357 4a. Table cells without escapable prefixes after edits
26358 !! options
26359 parsoid={
26360 "modes": ["selser"],
26361 "scrubWikitext": true,
26362 "changes": [
26363 [ "#x", "html", "-" ]
26364 ]
26365 }
26366 !! wikitext
26367 {|
26368 | id="x" |abcd
26369 |}
26370 !! wikitext/edited
26371 {|
26372 | id="x" |-
26373 |}
26374 !! end
26375
26376 ## This tests normalizer's ability to discriminate between
26377 ## cells having identical content.
26378 !! test
26379 4b. Table cells without escapable prefixes after edits
26380 !! options
26381 parsoid={
26382 "modes": ["selser"],
26383 "scrubWikitext": true,
26384 "changes": [
26385 [ "td", "html", "-" ]
26386 ]
26387 }
26388 !! wikitext
26389 {|
26390 |a||b
26391 |}
26392 !! wikitext/edited
26393 {|
26394 | -||-
26395 |}
26396 !! end
26397
26398 ## This tests normalizer's ability to not be tripped by
26399 ## comments (and whitespace)
26400 !! test
26401 4c. Table cells without escapable prefixes after edits
26402 !! options
26403 parsoid={
26404 "modes": ["selser"],
26405 "scrubWikitext": true,
26406 "changes": [
26407 [ "table tbody tr td:first-child", "remove" ]
26408 ]
26409 }
26410 !! wikitext
26411 {|
26412 |-
26413 <!--foo--> |a||-
26414 |}
26415 !! wikitext/edited
26416 {|
26417 |-
26418 <!--foo--> | -
26419 |}
26420 !! end
26421
26422 ## This tests normalizer's ability to handle HTML cells
26423 !! test
26424 4d. Table cells without escapable prefixes after edits
26425 !! options
26426 parsoid={
26427 "modes": ["selser"],
26428 "scrubWikitext": true,
26429 "changes": [
26430 [ "td", "html", "-" ]
26431 ]
26432 }
26433 !! wikitext
26434 <table>
26435 <tr><td>a</td></tr>
26436 </table>
26437 !! wikitext/edited
26438 <table>
26439 <tr><td>-</td></tr>
26440 </table>
26441 !! end
26442
26443 ## T111151 Remove font elements without attributes
26444 !! test
26445 5a. font tags without attributes should be dropped in scrubWikitext mode
26446 !! options
26447 parsoid={
26448 "modes": ["html2wt"],
26449 "scrubWikitext": true
26450 }
26451 !! html
26452 <font>foo</font>
26453 <font><font>bar</font></font>
26454 <font class="x">boo</font>
26455 !! wikitext
26456 foo
26457 bar
26458 <font class="x">boo</font>
26459 !! end
26460
26461 !! test
26462 5b. font tags should not be dropped without scrubWikitext being enabled
26463 !! options
26464 parsoid={
26465 "modes": ["html2wt"],
26466 "scrubWikitext": false
26467 }
26468 !! html
26469 <font>foo</font>
26470 !! wikitext
26471 <font>foo</font>
26472 !! end
26473
26474 !! test
26475 Escape nowiki DOM elements
26476 !! options
26477 parsoid=html2wt
26478 !! html/parsoid
26479 <nowiki><i>foo</i></nowiki>
26480 !! wikitext
26481 &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
26482 !! end
26483
26484 # This is meant to be an interim fix while we go about figuring out
26485 # how to not introduce these trailing <nowiki/>s in the first place.
26486 !! test
26487 T115717: Strip trailing <nowiki/>s (without affecting valid uses)
26488 !! options
26489 parsoid=html2wt
26490 !! html/parsoid
26491 <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
26492 y</p>
26493 <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>
26494 <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>
26495 !! wikitext
26496 x
26497 y
26498
26499 {{echo|
26500 1 = <nowiki/>}}
26501
26502 {{echo|
26503 1 = <nowiki/>
26504 }}
26505 !! end
26506
26507 # ---------------------------------------------------
26508 # End of tests spec'ing wikitext serialization norms |
26509 # ---------------------------------------------------
26510
26511 # T104032
26512 !! test
26513 Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
26514 !! options
26515 parsoid=html2wt
26516 !! html/parsoid
26517 a<p>b</p>
26518 <b>c</b><p>d</p>
26519 <table><tr>
26520 <td>a<p>b</p></td>
26521 <td><b>c</b><p>d</p></td>
26522 </tr></table>
26523 !! wikitext
26524 a
26525
26526 b
26527
26528 '''c'''
26529
26530 d
26531 {|
26532 |a
26533 b
26534 |'''c'''
26535 d
26536 |}
26537 !! end
26538
26539 # -----------------------------------------------------------------
26540 # End of section for Parsoid-only html2wt tests for serialization
26541 # of new content
26542 # -----------------------------------------------------------------
26543
26544 # -----------------------------------------------------------------
26545 # The following section of tests are primarily to spec behavior of
26546 # the selective serializer. All these tests have manual selser
26547 # changes. The automated selser changes for all tests handle the
26548 # wide variation of changes, but these tests here capture specs
26549 # deterministically.
26550 # ----------------------------------------------------------------
26551
26552 ## T90517
26553 !! test
26554 Selser: New comments should not be lost
26555 !! options
26556 parsoid={
26557 "modes": ["selser"],
26558 "changes": [
26559 [ "#a", "after", "<!--c1-->" ],
26560 [ "#b", "before", "<!--c2-->" ]
26561 ]
26562 }
26563 !! wikitext
26564 <span id="a">a</span>
26565
26566 <span id="b">b</span>
26567 !! wikitext/edited
26568 <span id="a">a</span><!--c1-->
26569
26570 <!--c2--><span id="b">b</span>
26571 !! end
26572
26573 ## T89383
26574 !! test
26575 Selser: Check for validity of DSR before using it
26576 !! options
26577 parsoid={
26578 "modes": ["selser"],
26579 "changes": [
26580 [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
26581 ]
26582 }
26583 !! wikitext
26584 <span id="a">a</span>
26585 !! wikitext/edited
26586 {{DISPLAYTITLE:foo}}
26587 <span id="a">a</span>
26588 !! end
26589
26590 !! test
26591 1. DOMDiff: Changes to <ref> content should be looked up using id
26592 !! options
26593 parsoid={
26594 "modes": ["selser"],
26595 "changes": [
26596 ["#X", "after", "bar"],
26597 ["#Y", "after", "baz"]
26598 ]
26599 }
26600 !! wikitext
26601 X <ref><span id="X">foo</span></ref>
26602 Y <ref name="a" />
26603 <references>
26604 <ref name="a"><span id="Y">foo</span></ref>
26605 </references>
26606 !! wikitext/edited
26607 X <ref><span id="X">foo</span>bar</ref>
26608 Y <ref name="a" />
26609 <references>
26610 <ref name="a"><span id="Y">foo</span>baz</ref>
26611 </references>
26612 !! end
26613
26614 !! test
26615 2. DOMDiff: Changes to <ref> content should be looked up using id
26616 !! options
26617 parsoid={
26618 "modes": ["selser"],
26619 "changes": [
26620 ["#Z", "after", "bar"]
26621 ]
26622 }
26623 !! wikitext
26624 A <ref>foo bar for a</ref>
26625 B <ref group="X" name="b" />
26626
26627 <references />
26628
26629 <references group="X">
26630 <ref name="b"><span id="Z">foo</span></ref>
26631 </references>
26632 !! wikitext/edited
26633 A <ref>foo bar for a</ref>
26634 B <ref group="X" name="b" />
26635
26636 <references />
26637
26638 <references group="X">
26639 <ref name="b"><span id="Z">foo</span>bar</ref>
26640 </references>
26641 !! end
26642
26643 !! test
26644 Empty LI (T49673)
26645 !! wikitext
26646 * a
26647 *
26648 *
26649 * b
26650 !! html/php+tidy
26651 <ul>
26652 <li>a</li>
26653 <li class="mw-empty-li"></li>
26654 <li class="mw-empty-li"></li>
26655 <li>b</li>
26656 </ul>
26657 !! end